Submit
Path:
~
/
/
usr
/
share
/
grafana
/
public
/
build
/
File Content:
5017.003cacead1bba1cba035.js
(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[5017],{76287:(Q,A,e)=>{"use strict";e.d(A,{p:()=>o});var t=e(96540),n=e(94841);function o(s){const{children:r,instanceSettings:g}=s,u=(0,t.useMemo)(()=>({instanceSettings:g,meta:g.meta}),[g]);return t.createElement(n.o.Provider,{value:u},r)}},94841:(Q,A,e)=>{"use strict";e.d(A,{o:()=>n});var t=e(96540);const n=(0,t.createContext)(void 0)},13834:(Q,A,e)=>{"use strict";e.d(A,{a:()=>o});var t=e(96540),n=e(94841);function o(s){const{children:r,...g}=s;return t.createElement(n.o.Provider,{value:g},r)}},95187:(Q,A,e)=>{"use strict";e.d(A,{S:()=>t});function t(n){return"instanceSettings"in n&&"meta"in n}},92470:(Q,A,e)=>{"use strict";e.d(A,{Q:()=>o});var t=e(96540),n=e(94841);function o(){const u=(0,t.useContext)(n.o);if(!u)throw new Error("usePluginContext must be used within a PluginContextProvider");return u}function s(){return o().meta}function r(){return o().meta.jsonData}function g(){return o().meta.info.version}},33948:(Q,A,e)=>{"use strict";e.d(A,{I:()=>s,f:()=>o});var t=e(11261),n=e(14236);class o{constructor(u,c){return this.fields=[],this.length=0,s(u,c)}}function s(g,u){const c={fields:[],length:g.length};if(!g?.length)return c;if(u){for(const l of u)c.fields.push(r(l,g.map(f=>f[l])));return c}const i=g.find(l=>l!=null);return i!=null&&(typeof i=="object"?c.fields=Object.keys(i).map(l=>r(l,g.map(f=>f[l]))):c.fields.push(r(t.Bc,g))),c}function r(g,u){const c={name:g,config:{},values:u,type:t.PU.other};return c.type=(0,n.dF)(c)??t.PU.other,c}},33526:(Q,A,e)=>{"use strict";e.d(A,{x:()=>o});var t=e(36120),n=e(37471);class o extends n.k{constructor(r){super(void 0,g=>new t.$({...r,buffer:g}))}}},89667:(Q,A,e)=>{"use strict";e.d(A,{EL:()=>r,Nw:()=>c,or:()=>u,t:()=>s});var t=e(11261),n=e(14236);const o={Inf:1/0,NegInf:-1/0,Undef:void 0,NaN:NaN};function s(i,l){for(const f in i){const d=o[f];for(const h of i[f])h<l.length&&(l[h]=d)}}function r(i,l){for(let f=0;f<l.length;f++)l[f]=i[Number(l[f])]}function g(i,l){for(const f of l)if(f!=null)return(0,n.by)(i,f);return t.PU.other}function u(i){const{schema:l,data:f}=i;if(!l||!l.fields)throw new Error("JSON needs a fields definition");const d=f?f.values.reduce((p,m)=>Math.max(p,m.length),0):0,h=l.fields.map((p,m)=>{let a=f?f.values[m]:[],v=a.length,E=p.type;v!==d&&(a.length=d,a.fill(void 0,v));let D=f?.entities?.[m];D&&s(D,a);let b=f?.enums?.[m];b&&(r(b,a),E=t.PU.string);const C=f?.nanos?.[m],y={...p,type:E??g(p.name,a),config:p.config??{},values:a,entities:D??{}};return C!=null&&(y.nanos=C),y});return{...l,fields:h,length:d}}function c(i){const l={values:[]},f=[];let d=!1;const h={refId:i.refId,meta:i.meta,name:i.name,fields:i.fields.map(p=>{const{values:m,nanos:a,state:v,display:E,...D}=p;return"entities"in D&&delete D.entities,l.values.push(m),a!=null?(f.push(a),d=!0):f.push(null),D})};return d&&(l.nanos=f),{schema:h,data:l}}},78368:(Q,A,e)=>{"use strict";e.d(A,{R:()=>n});var t=e(18008);class n extends t.F{constructor(s){super(),this.data=s,this.index=0;const r={},g={};for(let u=0;u<s.fields.length;u++){const c=s.fields[u];if(!c.name)continue;g[c.name]=c;const i=()=>c.values.get(this.index);r.hasOwnProperty(c.name)||Object.defineProperty(r,c.name,{enumerable:!0,get:i}),r.hasOwnProperty(u.toString())||Object.defineProperty(r,u,{enumerable:!1,get:i})}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)}))}}},85404:(Q,A,e)=>{"use strict";e.d(A,{L:()=>o});var t=e(11261),n=e(14236);class o{constructor(r){this.fields=[],this.fieldByName={},this.fieldByType={},this.fields=r.fields.map((g,u)=>({...g,index:u}));for(let g=0;g<r.fields.length;g++){const u=r.fields[g];if(u.type===t.PU.other){const c=(0,n.dF)(u);c&&(u.type=c)}this.fieldByType[u.type]||(this.fieldByType[u.type]=[]),this.fieldByType[u.type].push({...u,index:g}),this.fieldByName[u.name]?console.warn("Duplicate field names in DataFrame: ",u.name):this.fieldByName[u.name]={...u,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(i=>g||!i.config.custom?.hidden)}hasFieldNamed(r){return!!this.fieldByName[r]}hasFieldWithNameAndType(r,g){return!!this.fieldByName[r]&&this.fieldByType[g].filter(u=>u.name===r).length>0}getFieldByName(r){return this.fieldByName[r]}getFieldsByLabel(r,g){return Object.values(this.fieldByName).filter(u=>u.labels&&u.labels[r]===g)}}},37471:(Q,A,e)=>{"use strict";e.d(A,{p:()=>g,k:()=>u});var t=e(2543),n=e(11261),o=e(14236);function s(c,i){return i.type||(i.name==="time"||i.name==="Time"?i.type=n.PU.time:i.type=(0,o.HW)(c)),i.type===n.PU.number?l=>parseFloat(l):i.type===n.PU.boolean?l=>!(l[0]==="F"||l[0]==="f"||l[0]==="0"):l=>l}var r=e(18008);const g=void 0;class u extends r.F{constructor(i,l){if(super(),this.fields=[],this.first=[],this.parsers=void 0,this.creator=l||(f=>f??[]),i){const{name:f,refId:d,meta:h,fields:p}=i;if(f&&(this.name=f),d&&(this.refId=d),h&&(this.meta=h),p)for(const m of p)this.addField(m)}Object.defineProperty(this,"length",{enumerable:!0,get:()=>this.first.length})}get length(){return this.first.length}addFieldFor(i,l){return this.addField({name:l||"",type:(0,o.HW)(i)})}addField(i,l){let f;i.values&&(f=i.values);let d=i.type;!d&&(i.name==="time"||i.name==="Time")?d=n.PU.time:(!d&&f&&f.length&&(d=(0,o.HW)(f[0])),d||(d=n.PU.other));let h=i.name;h||(h=`Field ${this.fields.length+1}`);const p={...i,name:h,type:d,config:i.config||{},values:this.creator(f)};if(d===n.PU.other&&(d=(0,o.dF)(p),d&&(p.type=d)),this.fields.push(p),this.first=this.fields[0].values,l)for(;p.values.length<l;)p.values.push(g);else this.validate();return p}validate(){const i=this.fields.reduce((l,f)=>Math.max(l,f.values.length),0);for(const l of this.fields)for(;l.values.length!==i;)l.values.push(g)}setParser(i,l){return this.parsers||(this.parsers=new Map),this.parsers.set(i,l),l}parseValue(i,l){let f=this.parsers?.get(i);return f||(f=this.setParser(i,s(l,i))),f(l)}appendRow(i){for(let l=this.fields.length;l<i.length;l++)this.addField({name:`Field ${l+1}`,type:(0,o.HW)(i[l])});if(this.length<1)for(let l=0;l<this.fields.length;l++){const f=this.fields[l];(!f.type||f.type===n.PU.other)&&(f.type=(0,o.HW)(i[l]))}for(let l=0;l<this.fields.length;l++){const f=this.fields[l];let d=i[l];f.type!==n.PU.string&&(0,t.isString)(d)&&(d=this.parseValue(f,d)),f.values.push(d)}}push(...i){for(const l of i)this.add(l);return this.length}reverse(){for(const i of this.fields)i.values.reverse();return this}add(i){const l=i;for(const f of this.fields){let d=l[f.name];f.type!==n.PU.string&&(0,t.isString)(d)&&(d=this.parseValue(f,d)),d===void 0&&(d=g),f.values.push(d)}}set(i,l){if(i>this.length)throw new Error("Unable to set value beyond current length");const f=l||{};for(const d of this.fields)d.values[i]=f[d.name]}get(i){const l={};for(const f of this.fields)l[f.name]=f.values[i];return l}toJSON(){return(0,o.Kl)(this)}}},9631:(Q,A,e)=>{"use strict";e.d(A,{Kh:()=>u,Ls:()=>p,k9:()=>f,m8:()=>d,wC:()=>a});var t=e(11261),n=e(8249),o=e(73060),s=e(43659),r=e(14236),g=e(89667),u=(C=>(C.Append="append",C.Replace="replace",C))(u||{});const c="__name__";var i=(C=>(C[C.wide=0]="wide",C[C.labels=1]="labels",C))(i||{});const l=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=(y,M,T)=>{const I=M?Object.assign({},{...this.options,...M}):this.options,x=(0,r.By)(this,y),S=D(x.fields.map(P=>P.values),typeof T?.maxLength=="number"?Math.min(T.maxLength,I.maxLength):I.maxLength,this.timeFieldIndex,I.maxDelta);x.fields=x.fields.map(P=>({...P,values:P.values?.slice(S)}));const O=x.fields[0]?.values?.length??0;return{...x,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:I}},this.initFromSerialized=y=>{this.name=y.name,this.refId=y.refId,this.meta=y.meta,this.length=y.length,this.labels=y.labels,this.schemaFields=y.schemaFields,this.timeFieldIndex=y.timeFieldIndex,this.pushMode=y.pushMode,this.packetInfo.length=y.packetInfo.length,this.packetInfo.number=y.packetInfo.number,this.packetInfo.action="replace",this.packetInfo.schemaChanged=!0,this.fields=y.fields.map(M=>({...M,type:M.type??t.PU.other,config:M.config??{},values:M.values??[]})),E(this.fields.map(M=>M.values),this.options.maxLength,this.timeFieldIndex,this.options.maxDelta)},this.needsResizing=({maxLength:y,maxDelta:M})=>{const T=y&&this.options.maxLength<y,I=M&&this.options.maxDelta<M,x=M&&this.options.maxDelta===1/0;return!!(T||I||x)},this.resize=({maxLength:y,maxDelta:M})=>{M&&(this.options.maxDelta===1/0?this.options.maxDelta=M:this.options.maxDelta=Math.max(M,this.options.maxDelta)),this.options.maxLength=Math.max(this.options.maxLength,y??0)},this.pushNewValues=y=>{if(!y?.length)return;this.packetInfo.action=this.options.action,this.packetInfo.number++,this.packetInfo.length=y[0].length,this.packetInfo.schemaChanged=!1,this.options.action==="append"?v(this.fields.map(T=>T.values),y,this.options.maxLength,this.timeFieldIndex,this.options.maxDelta):(y.forEach((T,I)=>{this.fields[I]&&(this.fields[I].values=T)}),E(this.fields.map(T=>T.values),this.options.maxLength,this.timeFieldIndex,this.options.maxDelta));const M=this.fields?.[0]?.values.length;M!==void 0&&(this.length=M)},this.resetStateCalculations=()=>{this.fields.forEach(y=>{y.state={...y.state??{},calcs:void 0,range:void 0}})},this.getMatchingFieldIndexes=y=>this.fields.map((M,T)=>y(M)?T:void 0).filter(M=>M!==void 0),this.getValuesFromLastPacket=()=>this.fields.map(y=>{const M=y.values;return M.slice(Math.max(M.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:y,data:M}=C;if(this.packetInfo.number++,this.packetInfo.length=0,this.packetInfo.schemaChanged=!1,y){this.pushMode=0,this.timeFieldIndex=y.fields.findIndex(S=>S.type===t.PU.time);const T=y.fields[0];this.timeFieldIndex===1&&T.type===t.PU.string&&(T.name==="labels"||T.name==="Labels")&&(this.pushMode=1,this.timeFieldIndex=0);const I=this.pushMode===1?y.fields.slice(1):y.fields;this.refId=y.refId,y.meta&&(this.meta={...y.meta});const{displayNameFormat:x}=this.options;if(b(this.schemaFields,I)){const S=I.length;this.fields.forEach((O,P)=>{const L=I[P%S];O.config=L.config??{},O.labels=L.labels}),x&&this.fields.forEach(O=>{const P={[c]:O.name,...O.labels};O.config.displayNameFromDS=(0,s.j)(x,P)})}else{this.packetInfo.schemaChanged=!0;const S=this.pushMode===0;this.fields=I.map(O=>{const P=O.config??{};if(x){const L={[c]:O.name,...O.labels};P.displayNameFromDS=(0,s.j)(x,L)}return{config:P,name:O.name,labels:O.labels,type:O.type??t.PU.other,values:S?this.fields.find(L=>L.name===O.name&&O.type===L.type)?.values??Array(this.length).fill(void 0):[]}})}this.schemaFields=I}if(M&&M.values.length&&M.values[0].length){let{values:T,entities:I}=M;if(I&&I.forEach((S,O)=>{S&&(0,g.t)(S,T[O])}),this.pushMode===1){const S=h(T);for(const L of S.keys())this.labels.has(L)||(this.packetInfo.schemaChanged=!0,this.addLabel(L));let O=Array(this.schemaFields.length).fill([]),P=[];this.labels.forEach(L=>{P.push(S.get(L)??O)}),T=(0,o.fj)(P)}if(T.length!==this.fields.length){if(this.fields.length)throw new Error(`push message mismatch. Expected: ${this.fields.length}, received: ${T.length} (labels=${this.pushMode===1})`);this.fields=T.map((S,O)=>{let P=`Field ${O}`,L=(0,r.HW)(S[0]);return O===0&&L===t.PU.number&&S[0]>1600016688632&&(L=t.PU.time,P="Time"),{name:P,type:L,config:{},values:[]}})}let x=T;this.packetInfo.length=T[0].length,this.alwaysReplace||!this.length?this.packetInfo.action="replace":(this.packetInfo.action="append",x=this.fields.map(S=>S.values),v(x,T,this.options.maxLength,this.timeFieldIndex,this.options.maxDelta)),x.forEach((S,O)=>{const P=this.fields[O],{state:L}=P;P.values=S,L&&(L.calcs=void 0)}),this.length=x[0].length}return{...this.packetInfo}}addLabel(C){const{displayNameFormat:y}=this.options,M=this.labels.size,T=m(C);if(M===0)this.fields.forEach((I,x)=>{if(x>0&&(I.labels=T,y)){const S={[c]:I.name,...T};I.config.displayNameFromDS=(0,s.j)(y,S)}});else for(let I=1;I<this.schemaFields.length;I++){let x=this.schemaFields[I];const S=x.config??{};if(y){const O={[c]:x.name,...T};S.displayNameFromDS=(0,s.j)(y,O)}this.fields.push({...x,config:S,labels:T,values:Array(this.length).fill(void 0)})}this.labels.add(C)}};let f=l;f.deserialize=C=>{const y=new l(C.options);return y.initFromSerialized(C),y},f.empty=C=>new l(d(C)),f.fromDataFrameJSON=(C,y)=>{const M=new l(d(y));return M.push(C),M};function d(C){return{maxLength:C?.maxLength??1e3,maxDelta:C?.maxDelta??1/0,action:C?.action??"append",displayNameFormat:C?.displayNameFormat}}function h(C){let y=new Set(C[0]),M=new Map;y.forEach(T=>{let I=Array(C.length-1).fill(null).map(()=>[]);M.set(T,I)});for(let T=0;T<C[0].length;T++){let I=M.get(C[0][T]);for(let x=1;x<C.length;x++)I[x-1].push(C[x][T])}return M}function p(C,y,M,T){let I;M=M||0,T=T||y.length-1;let x=T<=2147483647;for(;T-M>1;)I=x?M+T>>1:Math.floor((M+T)/2),y[I]<C?M=I:T=I;return C-y[M]<=y[T]-C?M:T}function m(C){if(!C.length)return{};if(C.charAt(0)==="{")return(0,n.Xy)(C);const y={};return C.split(",").forEach(M=>{const[T,I]=M.trim().split("=");y[T]=I}),y}function a(C){const y=C.packetInfo;return y?.action?y:void 0}function v(C,y,M=1/0,T=0,I=1/0){for(let x=0;x<C.length;x++)for(let S=0;S<y[x].length;S++)C[x].push(y[x][S]);return E(C,M,T,I)}function E(C,y=1/0,M=0,T=1/0){const I=D(C,y,M,T);if(I)for(let x=0;x<C.length;x++)C[x].splice(0,I);return I}function D(C,y=1/0,M=0,T=1/0){if(!C[0]?.length)return 0;const I=C[0].length;let x=0;if(I>y&&(x=I-y),T!==1/0&&M>=0){const S=C[M],O=S[x],P=S[I-1];P-O>T&&(x=p(P-T,S,x))}return x}function b(C,y){if(C?.length!==y.length)return!1;for(let M=0;M<C.length;M++){const T=C[M],I=y[M];if(T.name!==I.name||T.type!==I.type)return!1}return!0}},61443:(Q,A,e)=>{"use strict";e.d(A,{Km:()=>r,P4:()=>o,WK:()=>s,g6:()=>n,r4:()=>t,xB:()=>g});const t=(u,c)=>({name:u,columns:c}),n=u=>u.columns,o=(u,c)=>u.columns[c],s=(u,c,i)=>u.columns[c].values[i],r=(u,c,i)=>u.columns.map(l=>l.values[i]),g=(u,c)=>u[c]},21423:(Q,A,e)=>{"use strict";e.d(A,{J3:()=>s,ab:()=>g,bW:()=>o});var t=e(2543),n=e.n(t);function o(u,c,i){if(u===c)return!0;if(u?.fields?.length!==c?.fields?.length||u.name!==c.name)return!1;for(let l=0;l<u.fields.length;l++){const f=u.fields[l],d=c.fields[l];if(f.type!==d.type||f.name!==d.name)return!1;if(i)continue;if(f.labels&&d.labels&&!g(f.labels,d.labels))return!1;const h=f.config,p=d.config;let m=Object.keys(h),a=Object.keys(p);if(m.length!==a.length)return!1;for(const v of m){if(!(v in p))return!1;if(v!=="interval"&&!(0,t.isEqual)(h[v],p[v]))return!1}}return!0}function s(u,c,i){if(u===c)return!0;if(u?.length!==c?.length)return!1;for(let l=0;l<u.length;l++)if(!i(u[l],c[l]))return!1;return!0}const r=(u,c)=>u===c;function g(u,c,i=r){if(u===c)return!0;const l=Object.keys(u),f=Object.keys(c);if(l.length!==f.length)return!1;for(let d of l)if(!i(u[d],c[d]))return!1;return!0}},48120:(Q,A,e)=>{"use strict";e.d(A,{Bt:()=>r.Bt,By:()=>r.By,EI:()=>r.EI,EL:()=>c.EL,ES:()=>r.ES,HW:()=>r.HW,Ij:()=>u.I,J3:()=>i.J3,KR:()=>r.KR,Kh:()=>f.Kh,Kl:()=>r.Kl,Km:()=>g.Km,LI:()=>r.LI,Lc:()=>n.L,Ls:()=>f.Ls,N$:()=>r.N$,Nw:()=>c.Nw,P4:()=>g.P4,Rh:()=>t.R,S1:()=>l.S1,Vc:()=>r.Vc,WK:()=>g.WK,XQ:()=>r.XQ,Yn:()=>r.Yn,aH:()=>l.aH,ab:()=>i.ab,bW:()=>i.bW,by:()=>r.by,ci:()=>r.ci,dF:()=>r.dF,fG:()=>u.f,g6:()=>g.g6,hF:()=>l.hF,jq:()=>l.jq,k2:()=>s.k,k9:()=>f.k9,oE:()=>r.oE,or:()=>c.or,pH:()=>r.pH,pk:()=>s.p,q7:()=>r.q7,r4:()=>g.r4,t:()=>c.t,t9:()=>l.t9,tP:()=>l.tP,uY:()=>l.uY,w3:()=>r.w3,x8:()=>o.x,xB:()=>g.xB});var t=e(78368),n=e(85404),o=e(33526),s=e(37471),r=e(14236),g=e(61443),u=e(33948),c=e(89667),i=e(21423),l=e(19845),f=e(9631)},14236:(Q,A,e)=>{"use strict";e.d(A,{Bt:()=>R,By:()=>P,EI:()=>H,ES:()=>I,HW:()=>v,KR:()=>L,Kl:()=>O,LI:()=>y,N$:()=>B,Vc:()=>M,XQ:()=>D,Yn:()=>S,by:()=>m,ci:()=>C,dF:()=>E,oE:()=>a,pH:()=>b,q7:()=>x,w3:()=>T});var t=e(2543),n=e.n(t),o=e(47232),s=e(48241),r=e(28240),g=e(11261),u=e(39070),c=e(33948),i=e(89667);function l(w){const N=w.columns.map(V=>{const{text:G,type:_,...K}=V,j=[];return{name:G?.length?G:V,config:K||{},values:j,type:_&&Object.values(g.PU).includes(_)?_:g.PU.other}});if(!(0,t.isArray)(w.rows))throw new Error(`Expected table rows to be array, got ${typeof w.rows}.`);for(const V of w.rows)for(let G=0;G<N.length;G++)N[G].values.push(V[G]);for(const V of N)if(V.type===g.PU.other){const G=E(V);G&&(V.type=G)}return{fields:N,refId:w.refId,meta:w.meta,name:w.name,length:w.rows.length}}function f(w){const N=[],V=[],G=w.datapoints||w.points;for(const K of G)V.push(K[0]),N.push(K[1]);const _=[{name:g.LE,type:g.PU.time,config:{},values:N},{name:g.Bc,type:g.PU.number,config:{unit:w.unit},values:V,labels:w.tags}];return w.title&&(_[1].config.displayNameFromDS=w.title),{name:w.target||w.name,refId:w.refId,meta:w.meta,fields:_,length:V.length}}function d(w){const N=[],V=[];for(let G=0;G<w.data.length;G++){const _=w.data[G];N.push(_[1]),V.push(_[0])}return{name:w.label,fields:[{name:w.label||g.Bc,type:g.PU.number,config:{},values:N},{name:g.LE,type:g.PU.time,config:{unit:"dateTimeAsIso"},values:V}],length:N.length}}function h(w){const N=[{name:w.target,type:g.PU.other,labels:w.tags,config:{unit:w.unit,filterable:w.filterable},values:[]}];for(const V of w.datapoints)N[0].values.push(V);return{name:w.target,refId:w.target,meta:{json:!0},fields:N,length:w.datapoints.length}}const p=/^\s*(-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?|NAN)\s*$/i;function m(w,N){return w&&(w=w.toLowerCase(),w==="date"||w==="time")?g.PU.time:v(N)}function a(w){return w instanceof Date||(0,o.Ar)(w)?g.PU.time:(0,t.isNumber)(w)?g.PU.number:(0,t.isString)(w)?g.PU.string:(0,t.isBoolean)(w)?g.PU.boolean:g.PU.other}function v(w){return w instanceof Date||(0,o.Ar)(w)?g.PU.time:(0,t.isNumber)(w)?g.PU.number:(0,t.isString)(w)?p.test(w)?g.PU.number:w==="true"||w==="TRUE"||w==="True"||w==="false"||w==="FALSE"||w==="False"?g.PU.boolean:g.PU.string:(0,t.isBoolean)(w)?g.PU.boolean:g.PU.other}function E(w){if(w.name){const N=w.name.toLowerCase();if(N==="date"||N==="time")return g.PU.time}for(let N=0;N<w.values.length;N++){const V=w.values[N];if(V!=null)return v(V)}}const D=(w,N=!1)=>{for(const V of w.fields)if(!V.type||V.type===g.PU.other||N)return{...w,fields:w.fields.map(G=>G.type&&G.type!==g.PU.other&&!N?G:{...G,type:E(G)||g.PU.other})};return w},b=w=>!!(w&&w.hasOwnProperty("columns")),C=w=>!!(w&&w.hasOwnProperty("fields")),y=w=>!!(C(w)&&w.hasOwnProperty("value"));function M(w){if("fields"in w)return"length"in w&&w.fields[0]?.values?.get?w:H(w);if(w.hasOwnProperty("type")&&w.type==="docs")return h(w);if(w.hasOwnProperty("datapoints")||w.hasOwnProperty("points"))return f(w);if(w.hasOwnProperty("data"))return w.hasOwnProperty("schema")?(0,i.or)(w):d(w);if(w.hasOwnProperty("columns"))return l(w);if(Array.isArray(w))return(0,c.I)(w);throw console.warn("Can not convert",w),new Error("Unsupported data format")}const T=w=>{const{fields:N}=w,V=w.length,G=[];if(N.length===2){const{timeField:_,timeIndex:K}=L(w);if(_){const k=N[K===0?1:0],Y=N[K];for(let ee=0;ee<V;ee++)G.push([k.values[ee],Y.values[ee]]);return{alias:w.name,target:(0,r.Ct)(k,w),datapoints:G,unit:N[0].config?N[0].config.unit:void 0,refId:w.refId,meta:w.meta}}}for(let _=0;_<V;_++){const K=[];for(let j=0;j<N.length;j++)K.push(N[j].values[_]);G.push(K)}return w.meta&&w.meta.json?{alias:N[0].name||w.name,target:N[0].name||w.name,datapoints:N[0].values,filterable:N[0].config?N[0].config.filterable:void 0,type:"docs"}:{columns:N.map(_=>{const{name:K,config:j}=_;if(j){const{...k}=j;return k.text=K,k}return{text:K}}),type:"table",refId:w.refId,meta:w.meta,rows:G}};function I(w,N,V=!1){const G=w.fields[N];if(!G)return w;const _=[];for(let j=0;j<w.length;j++)_.push(j);const K=(0,s.iX)(G,V);return _.sort(K),{...w,fields:w.fields.map(j=>{const k={...j,values:j.values.map((ee,re)=>j.values[_[re]])},{nanos:Y}=j;return Y!==void 0&&(k.nanos=Y.map((ee,re)=>Y[_[re]])),k})}}function x(w){return{...w,fields:w.fields.map(N=>{const V=[...N.values];V.reverse();const G={...N,values:V},{nanos:_}=N;if(_!==void 0){const K=[..._];K.reverse(),G.nanos=K}return G})}}function S(w,N){const V=[];for(const G of w.fields)V.push(G.values[N]);return V}function O(w){return P(w)}function P(w,N){return{fields:(N?w.fields.filter(N):w.fields).map(_=>{let K=_.values;return{name:_.name,type:_.type,config:_.config,values:K,labels:_.labels}}),refId:w.refId,meta:w.meta,name:w.name}}const L=w=>{for(let N=0;N<w.fields.length;N++)if(w.fields[N].type===g.PU.time)return{timeField:w.fields[N],timeIndex:N};return{}};function U(w){const N=D(M(w));if(N.fields&&N.fields.length)for(const V of N.fields)V.state=null;return N}function R(w){return!w||!(0,t.isArray)(w)?[]:w.map(N=>U(N))}function B(w,N){const{series:V,annotations:G}=w;if(w.state===u.Gu.Loading&&V.length===0)return N||(N=w),{...N,state:u.Gu.Loading,request:w.request};const _=performance.now(),K=V.map(Y=>U(Y)),j=R(G),k=performance.now();return{...w,series:K,annotations:j,timings:{dataProcessingTime:k-_}}}function H(w){let N=0;const V=w.fields.map((G,_)=>{const{state:K,...j}=G;return j.name||(j.name=`Field ${_+1}`),j.config||(j.config={}),j.values?j.values.length>N&&(N=j.values.length):j.values=new Array(N),j.type||(j.type=E(j)??g.PU.other),j});return{...w,fields:V,length:N}}},19845:(Q,A,e)=>{"use strict";e.d(A,{S1:()=>c,aH:()=>s,hF:()=>g,jq:()=>r,t9:()=>i,tP:()=>u,uY:()=>l});var t=e(11261),n=e(14236);const o=100;function s(f){if(f.fields.length<2)return!1;const d=f.fields.find(p=>p.type===t.PU.number);let h=!1;for(const p of f.fields)if(g(p)){h=!0;break}return h&&d!==void 0}function r(f){return!f.find(d=>!s(d))}function g(f){if(f.type!==t.PU.time)return!1;let d=null,h=f.values.length>o?o:f.values.length;for(let p=0;p<h;p++){const m=f.values[p];if(d===null||m!==null&&m>d)d=m;else return!1}return!0}function u(f){for(let d=0;d<f.length;d++){const h=(0,n.KR)(f[d]);if(h.timeField!==void 0&&h.timeIndex!==void 0)return!0}return!1}function c(f){return f.fields.some(d=>d.type===t.PU.time)}function i(f,d){if(f.meta?.uniqueRowIdFields!==void 0)return f.meta.uniqueRowIdFields.map(h=>f.fields[h].values[d]).join("-")}function l(f,d){if(d instanceof Array)for(let h=0;h<d.length;h++)f.fields[h].values.push(d[h]);else for(const h of f.fields)h.values.push(d[h.name]);try{f.length++}catch{}}},1933:(Q,A,e)=>{"use strict";e.d(A,{G:()=>r,O:()=>g});var t=e(2543),n=e.n(t),o=e(43127);let s=()=>o.lE;const r=u=>{s=u??s},g=u=>u?.timeZone&&!(0,t.isEmpty)(u.timeZone)?u.timeZone:s()??o.lE},85858:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{isMathString:()=>r,isValid:()=>u,parse:()=>g,parseDateMath:()=>c,roundToFiscal:()=>i});var t=e(2543),n=e.n(t),o=e(47232);const s=["y","M","w","d","h","m","s","Q"];function r(l){return l?!!(typeof l=="string"&&(l.substring(0,3)==="now"||l.includes("||"))):!1}function g(l,f,d,h){if(l){if(typeof l!="string")return(0,o.Ar)(l)?l:(0,t.isDate)(l)?(0,o.KQ)(l):void 0;{let p,m="",a,v;return l.substring(0,3)==="now"?(p=(0,o.oZ)(d),m=l.substring(3)):(a=l.indexOf("||"),a===-1?(v=l,m=""):(v=l.substring(0,a),m=l.substring(a+2)),p=(0,o.KQ)(v,o.mt)),m.length?c(m,p,f,h):p}}}function u(l){const f=g(l);return f&&(0,o.Ar)(f)?f.isValid():!1}function c(l,f,d,h=0){const p=l.replace(/\s/g,""),m=(0,o.KQ)(f);let a=0;const v=p.length;for(;a<v;){const E=p.charAt(a++);let D,b,C,y=!1;if(E==="/")D=0;else if(E==="+")D=1;else if(E==="-")D=2;else return;if(isNaN(parseInt(p.charAt(a),10)))b=1;else if(p.length===2)b=parseInt(p.charAt(a),10);else{const T=a;for(;!isNaN(parseInt(p.charAt(a),10));)if(a++,a>10)return;b=parseInt(p.substring(T,a),10)}if(D===0&&b!==1)return;C=p.charAt(a++),C==="f"&&(C=p.charAt(a++),y=!0);const M=C;if((0,t.includes)(s,M))D===0?y?i(h,m,M,d):d?m.endOf(M):m.startOf(M):D===1?m.add(b,M):D===2&&m.subtract(b,M);else return}return m}function i(l,f,d,h){switch(d){case"y":return h?i(l,f,d,!1).add(11,"M").endOf("M"):f.subtract((f.month()-l+12)%12,"M").startOf("M"),f;case"Q":return h?i(l,f,d,!1).add(2,"M").endOf("M"):f.subtract((f.month()-l+12)%3,"M").startOf("M"),f;default:return}}},70416:(Q,A,e)=>{"use strict";e.d(A,{E9:()=>g,Ri:()=>u,V3:()=>d,WT:()=>c,dU:()=>r,di:()=>l,pp:()=>f,vd:()=>i});var t=e(89369),n=e(68284),o=e(25579);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(p,m=!0){if((0,t.d)(p.start,p.end))return"";const a=(0,n.F)(p);return Object.entries(a).reduce((v,[E,D])=>D&&D!==0&&!(E==="seconds"&&!m&&v)?v+`${v!==""?" ":""}${D}${s[E][0]}`:v,"")}function g(p){return p.split(" ").reduce((m,a)=>{const v=a.match(/(\d+)(.+)/),E=v?.[1],D=v?.[2];if(!(E&&D))return m;const b=Object.entries(s).find(([y,M])=>M?.includes(v[2])),C=parseInt(E,10);return b?{...m,[b[0]]:C}:m},{})}function u(p,m){return(0,o.W)(p,m)}function c(p){const m=new Date;return u(m,p).getTime()-m.getTime()}function i(p){return!isNaN(Date.parse(p))}function l(p){for(const m of p.trim().split(" ")){const a=m.match(/(\d+)(.+)/);if(a===null||a.length!==3||!Object.entries(s).find(([E,D])=>D?.includes(a[2]))?.[0])return!1}return!0}function f(p){return h(p,["h","m","s","ms","us","\xB5s","ns"])}function d(p){return h(p,["y","M","w","d","h","m","s","ms","us","\xB5s","ns"])}function h(p,m){for(const a of p.trim().split(" ")){const v=a.match(/([0-9]*[.]?[0-9]+)(.+)/);if(v===null||v.length!==3||!m.includes(v[2]))return!1}return!0}},42994:(Q,A,e)=>{"use strict";e.d(A,{JE:()=>o,Od:()=>s,WC:()=>r});const t="YYYY-MM-DD HH:mm:ss",n="YYYY-MM-DD HH:mm:ss.SSS";class o{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(c){this.fullDate=c.fullDate,this.interval=c.interval,c.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(c){return`time:${c?this.fullDateMS:this.fullDate}`}}function s(u,c,i){if(g())return i??t;!c&&navigator&&(c=[...navigator.languages]);const l=new Intl.DateTimeFormat(c||void 0,u),f=l.formatToParts(new Date),h={year:"YYYY",month:"MM",day:"DD",hour:l.resolvedOptions().hour12?"hh":"HH",minute:"mm",second:"ss",weekday:"ddd",era:"N",dayPeriod:"A",timeZoneName:"Z"};return f.map(p=>h[p.type]||p.value).join("")}const r=new o,g=()=>!("DateTimeFormat"in Intl)||!("formatToParts"in Intl.DateTimeFormat.prototype)},72724:(Q,A,e)=>{"use strict";e.d(A,{LE:()=>r,M7:()=>g,_Q:()=>c,fq:()=>u,jw:()=>i});var t=e(84743),n=e.n(t),o=e(1933),s=e(42994);const r=(d,h)=>f(d,(0,o.O)(h)).format(l(h)),g=(d,h)=>f(d,(0,o.O)(h)).format(),u=(d,h)=>f(d,(0,o.O)(h)).fromNow(),c=(d,h)=>f(d,(0,o.O)(h)).format(`${s.WC.fullDate} z`),i=(d,h)=>f(d,(0,o.O)(h)).format("z"),l=d=>d?.defaultWithMS?d?.format??s.WC.fullDateMS:d?.format??s.WC.fullDate,f=(d,h)=>{const p=d,m=n().tz.zone(h);if(m&&m.name)return n().utc(p).tz(m.name);switch(h){case"utc":return n().utc(p);default:return n().utc(p).local()}}},38698:(Q,A,e)=>{"use strict";e.d(A,{$D:()=>o.$D,AN:()=>o.AN,Ah:()=>o.Ah,Ar:()=>o.Ar,E9:()=>c.E9,GZ:()=>i.G,HD:()=>s.HD,IM:()=>c.pp,Ii:()=>n,JE:()=>r.JE,JK:()=>o.JK,KQ:()=>o.KQ,LE:()=>g.LE,M7:()=>g.M7,O:()=>i.O,Od:()=>r.Od,P3:()=>s.P3,QZ:()=>s.QZ,Ri:()=>c.Ri,U3:()=>s.U3,V3:()=>c.V3,WC:()=>r.WC,WT:()=>c.WT,XN:()=>o.XN,_Q:()=>g._Q,bQ:()=>u.b,dU:()=>c.dU,di:()=>c.di,fq:()=>g.fq,g$:()=>s.g$,jw:()=>g.jw,le:()=>s.le,mt:()=>o.mt,ns:()=>t,oZ:()=>o.oZ,pp:()=>o.pp,u8:()=>o.u8,vd:()=>c.vd,xQ:()=>o.xQ,xS:()=>o.xS,yT:()=>o.yT});var t=e(85858),n=e(65879),o=e(47232),s=e(91410),r=e(42994),g=e(72724),u=e(53531),c=e(70416),i=e(1933)},47232:(Q,A,e)=>{"use strict";e.d(A,{$D:()=>a,AN:()=>d,Ah:()=>l,Ar:()=>c,JK:()=>r,KQ:()=>f,XN:()=>g,mt:()=>o,oZ:()=>h,pp:()=>m,u8:()=>u,xQ:()=>p,xS:()=>s,yT:()=>i});var t=e(95093),n=e.n(t);const o=n().ISO_8601,s=v=>{n().locale(v)},r=()=>n().locale(),g=()=>n().localeData(),u=v=>v===null||typeof v=="string"||typeof v=="number"||v instanceof Date||Array.isArray(v)&&v.every(E=>typeof E=="string"||typeof E=="number")||c(v),c=v=>n().isMoment(v),i=(v,E)=>n().utc(v,E),l=(v,E)=>n().duration(v,E),f=(v,E)=>n()(v,E),d=v=>f(v),h=(v,E,D)=>{if(v==="utc")return i(E,D);if(v&&v!=="browser"){let b;if(typeof E=="string"&&D?b=n().tz(E,D,v):b=n().tz(E,v),c(b))return b}return f(E,D)},p=v=>n().weekdays().findIndex(E=>E.toLowerCase()===v.toLowerCase()),m=v=>["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"].findIndex(E=>E.toLowerCase()===v.toLowerCase()),a=v=>{const E="-weekStart",D=r().replace(E,""),b=v?m(v):-1;b!==-1?n().locale(D+E,{parentLocale:D,week:{dow:b}}):s(D)}},53531:(Q,A,e)=>{"use strict";e.d(A,{b:()=>i});var t=e(2543),n=e.n(t),o=e(84743),s=e.n(o),r=e(1933),g=e(85858),u=e(42994),c=e(47232);const i=(d,h)=>(0,c.Ar)(d)?d:typeof d=="string"?l(d,h):f(d,h),l=(d,h)=>{if(d.indexOf("now")!==-1)return(0,g.isValid)(d)&&(0,g.parse)(d,h?.roundUp,h?.timeZone,h?.fiscalYearStartMonth)||s()();const p=(0,r.O)(h),m=s().tz.zone(p),a=h?.format??u.WC.fullDate;if(m&&m.name)return s().tz(d,a,m.name);switch((0,t.lowerCase)(p)){case"utc":return s().utc(d,a);default:return s()(d,a)}},f=(d,h)=>{const p=d,m=(0,r.O)(h),a=s().tz.zone(m);if(a&&a.name)return s().tz(p,a.name);switch((0,t.lowerCase)(m)){case"utc":return s().utc(p);default:return s()(p)}}},65879:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{calculateInterval:()=>C,convertRawToRange:()=>m,describeInterval:()=>T,describeTextRange:()=>f,describeTimeRange:()=>d,describeTimeRangeAbbreviation:()=>p,intervalToMs:()=>x,intervalToSeconds:()=>I,isFiscal:()=>v,isRelativeTime:()=>a,isRelativeTimeRange:()=>E,isValidTimeSpan:()=>h,msRangeToTimeString:()=>b,relativeToTimeRange:()=>P,roundInterval:()=>S,secondsToHms:()=>D,timeRangeToRelative:()=>O});var t=e(2543),n=e.n(t),o=e(85858),s=e(72724),r=e(47232),g=e(53531);const u={s:{display:"second"},m:{display:"minute"},h:{display:"hour"},d:{display:"day"},w:{display:"week"},M:{display:"month"},y:{display:"year"}},c=[{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"}],i=[{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"}],l={};(0,t.each)(c,L=>{l[L.from+" to "+L.to]=L}),(0,t.each)(i,L=>{l[L.from+" to "+L.to]=L});function f(L){const U=L.indexOf("+")!==0;L.indexOf("now")===-1&&(L=(U?"now-":"now")+L);let R=l[L+" to now"];if(R)return R;U?R={from:L,to:"now",display:""}:R={from:"now",to:L,display:""};const B=/^now([-+])(\d+)(\w)/.exec(L);if(B){const H=B[3],w=parseInt(B[2],10),N=u[H];N&&(R.display=U?"Last ":"Next ",R.display+=w+" "+N.display,R.section=N.section,w>1&&(R.display+="s"))}else R.display=R.from+" to "+R.to,R.invalid=!0;return R}function d(L,U){const R=l[L.from.toString()+" to "+L.to.toString()];if(R)return R.display;const B={timeZone:U};if((0,r.Ar)(L.from)&&(0,r.Ar)(L.to))return(0,s.LE)(L.from,B)+" to "+(0,s.LE)(L.to,B);if((0,r.Ar)(L.from)){const H=o.parse(L.to,!0,"utc");return H?(0,s.LE)(L.from,B)+" to "+(0,s.fq)(H,B):""}if((0,r.Ar)(L.to)){const H=o.parse(L.from,!1,"utc");return H?(0,s.fq)(H,B)+" to "+(0,s.LE)(L.to,B):""}return L.to.toString()==="now"?f(L.from).display:L.from.toString()+" to "+L.to.toString()}const h=L=>L.indexOf("$")===0||L.indexOf("+$")===0?!0:f(L).invalid!==!0,p=(L,U)=>{if((0,r.Ar)(L.from))return(0,s.jw)(L.from,{timeZone:U});const R=o.parse(L.from,!0);return R?(0,s.jw)(R,{timeZone:U}):""},m=(L,U,R,B)=>{const H=(0,g.b)(L.from,{roundUp:!1,timeZone:U,fiscalYearStartMonth:R,format:B}),w=(0,g.b)(L.to,{roundUp:!0,timeZone:U,fiscalYearStartMonth:R,format:B});return o.isMathString(L.from)||o.isMathString(L.to)?{from:H,to:w,raw:L}:{from:H,to:w,raw:{from:H,to:w}}};function a(L){return typeof L=="string"?L.indexOf("now")>=0:!1}function v(L){return typeof L.raw.from=="string"&&L.raw.from.indexOf("f")>0?!0:typeof L.raw.to=="string"&&L.raw.to.indexOf("f")>0}function E(L){return a(L.from)||a(L.to)}function D(L){const U=Math.floor(L/31536e3);if(U)return U+"y";const R=Math.floor(L%31536e3/86400);if(R)return R+"d";const B=Math.floor(L%31536e3%86400/3600);if(B)return B+"h";const H=Math.floor(L%31536e3%86400%3600/60);if(H)return H+"m";const w=Math.floor(L%31536e3%86400%3600%60);if(w)return w+"s";const N=Math.floor(L*1e3);return N?N+"ms":"less than a millisecond"}function b(L){const U=Number((L/1e3).toFixed()),R=Math.floor(U/60/60),B=Math.floor(U/60)-R*60,H=Number((U%60).toFixed());let w=R?R+"h":"",N=B?B+"min":"",V=H?H+"sec":"";return w&&N?w=w+" ":w=w,(N||w)&&V?N=N+" ":N=N,w+N+V||"less than 1sec"}function C(L,U,R){let B=1;R&&(B=x(R));let H=S((L.to.valueOf()-L.from.valueOf())/U);return B>H&&(H=B),{intervalMs:H,interval:D(H/1e3)}}const y=/(-?\d+(?:\.\d+)?)(ms|[Mwdhmsy])/,M={y:31536e3,M:2592e3,w:604800,d:86400,h:3600,m:60,s:1,ms:.001};function T(L){if(Number(L))return{sec:M.s,type:"s",count:parseInt(L,10)};const U=L.match(y);if(!U||!(0,t.has)(M,U[2]))throw new Error(`Invalid interval string, has to be either unit-less or end with one of the following units: "${Object.keys(M).join(", ")}"`);return{sec:M[U[2]],type:U[2],count:parseInt(U[1],10)}}function I(L){const U=T(L);return U.sec*U.count}function x(L){const U=T(L);return U.sec*1e3*U.count}function S(L){switch(!0){case L<10:return 1;case L<15:return 10;case L<35:return 20;case L<75:return 50;case L<150:return 100;case L<350:return 200;case L<750:return 500;case L<1500:return 1e3;case L<3500:return 2e3;case L<7500:return 5e3;case L<12500:return 1e4;case L<17500:return 15e3;case L<25e3:return 2e4;case L<45e3:return 3e4;case L<9e4:return 6e4;case L<21e4:return 12e4;case L<45e4:return 3e5;case L<75e4:return 6e5;case L<105e4:return 9e5;case L<15e5:return 12e5;case L<27e5:return 18e5;case L<54e5:return 36e5;case L<9e6:return 72e5;case L<162e5:return 108e5;case L<324e5:return 216e5;case L<864e5:return 432e5;case L<6048e5:return 864e5;case L<18144e5:return 6048e5;case L<36288e5:return 2592e6;default:return 31536e6}}function O(L,U=(0,r.KQ)()){const R=U.unix()-L.from.unix(),B=U.unix()-L.to.unix();return{from:R,to:B}}function P(L,U=(0,r.KQ)()){const R=(0,r.KQ)(U).subtract(L.from,"s"),B=L.to===0?(0,r.KQ)(U):(0,r.KQ)(U).subtract(L.to,"s");return{from:R,to:B,raw:{from:R,to:B}}}},91410:(Q,A,e)=>{"use strict";e.d(A,{HD:()=>c,P3:()=>l,QZ:()=>i,U3:()=>f,g$:()=>g,le:()=>u});var t=e(2543),n=e.n(t),o=e(84743),s=e.n(o),r=e(1933),g=(v=>(v.default="",v.localBrowserTime="browser",v.utc="utc",v))(g||{});const u=v=>{switch((0,r.O)({timeZone:v})){case"browser":return"Local browser time";case"utc":return"UTC";default:return v}},c=v=>s().tz.zone(v),i=(v,E)=>{const D=d(v,E);return D||p(v,E)},l=(0,t.memoize)((v=!1)=>{const E=[];return v===!0?E.push("","browser","utc"):v&&E.push(...v),s().tz.names().reduce((D,b)=>{const C=a[b];return!Array.isArray(C)||C.length===0||D.push(b),D},E)}),f=(0,t.memoize)((v=!1)=>{const D=l(v).reduce((b,C)=>{const y=C.indexOf("/");if(y===-1){const T="";return b[T]=b[T]??[],b[T].push(C),b}const M=C.slice(0,y);return b[M]=b[M]??[],b[M].push(C),b},{});return Object.keys(D).map(b=>({name:b,zones:D[b]}))}),d=(v,E)=>{switch(v){case"utc":return{name:"Coordinated Universal Time",ianaName:"UTC",zone:v,countries:[],abbreviation:"UTC, GMT",offsetInMins:0};case"":{const D=(0,r.O)(),C=D==="browser"||D==="utc"?d(D,E):p(D,E);return{countries:a[D]??[],abbreviation:"",offsetInMins:0,...C,ianaName:C?.ianaName??"",name:"Default",zone:v}}case"browser":{const D=s().tz.guess(!0),b=p(D,E);return{countries:a[D]??[],abbreviation:"Your local time",offsetInMins:new Date().getTimezoneOffset(),...b,name:"Browser Time",ianaName:b?.ianaName??"",zone:v}}default:return}},h=v=>/^(\+|\-).+/.test(v)?"":v,p=(v,E)=>{const D=s().tz.zone(v);if(D)return{name:v,ianaName:D.name,zone:v,countries:a[v]??[],abbreviation:h(D.abbr(E)),offsetInMins:D.utcOffset(E)}},m={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"},a=(()=>s().tz.countries().reduce((v,E)=>s().tz.zonesForCountry(E).reduce((b,C)=>{b[C]||(b[C]=[]);const y=m[E];return y&&b[C].push({code:E,name:y}),b},v),{}))()},18226:(Q,A,e)=>{"use strict";e.d(A,{o:()=>s});var t=e(74486),n=e(88483),o=e(16126);class s{constructor(){this.subscribers=new Map,this.emitter=new t.A}publish(u){this.emitter.emit(u.type,u)}subscribe(u,c){return this.getStream(u).subscribe({next:c})}getStream(u){return new n.c(c=>{const i=l=>{c.next(l)};return this.emitter.on(u.type,i),this.subscribers.set(i,c),()=>{this.emitter.off(u.type,i),this.subscribers.delete(i)}})}newScopedBus(u,c){return new r([u],this,c)}emit(u,c){typeof u=="string"?this.emitter.emit(u,{type:u,payload:c}):this.emitter.emit(u.name,{type:u.name,payload:c})}on(u,c,i){if(c.wrapper=l=>{c(l.payload)},typeof u=="string"?this.emitter.on(u,c.wrapper):this.emitter.on(u.name,c.wrapper),i){const l=i.$on("$destroy",()=>{this.off(u,c),l()})}}off(u,c){if(typeof u=="string"){this.emitter.off(u,c.wrapper);return}this.emitter.off(u.name,c.wrapper)}removeAllListeners(){this.emitter.removeAllListeners();for(const[u,c]of this.subscribers)c.complete(),this.subscribers.delete(u)}}class r{constructor(u,c,i){this.path=u,this.eventBus=c,this.filterConfig=i??{onlyLocal:!1}}publish(u){u.origin||(u.origin=this),this.eventBus.publish(u)}filter(u){return this.filterConfig.onlyLocal?u.origin===this:!0}getStream(u){return this.eventBus.getStream(u).pipe((0,o.p)(this.filter.bind(this)))}subscribe(u,c){return this.getStream(u).subscribe({next:c})}removeAllListeners(){this.eventBus.removeAllListeners()}newScopedBus(u,c){return new r([...this.path,u],this,c)}}},69129:(Q,A,e)=>{"use strict";e.d(A,{LL:()=>i,LO:()=>s,NI:()=>c,We:()=>r,b_:()=>n,gc:()=>g,ql:()=>o,wE:()=>u});var t=e(65463);class n extends t.x{}n.type="data-hover";class o extends t.a{}o.type="data-hover-clear";class s extends t.x{}s.type="data-select";class r extends t.x{}r.type="annotation-event";class g extends t.x{}g.type="dashboard-loaded";class u extends t.a{}u.type="datasource-updated-successfully";class c extends t.a{}c.type="datasource-test-succeeded";class i extends t.a{}i.type="datasource-test-failed"},89550:(Q,A,e)=>{"use strict";e.d(A,{R:()=>n});const t=new Set;function n(o){if(t.has(o))throw new Error(`There is already an event defined with type '${o}'`);return t.add(o),{name:o}}},56302:(Q,A,e)=>{"use strict";e.d(A,{LL:()=>s.LL,LO:()=>s.LO,NI:()=>s.NI,Rb:()=>t.R,We:()=>s.We,aV:()=>n.a,b_:()=>s.b_,gc:()=>s.gc,or:()=>o.o,ql:()=>s.ql,wE:()=>s.wE,x$:()=>n.x});var t=e(89550),n=e(65463),o=e(18226),s=e(69129)},65463:(Q,A,e)=>{"use strict";e.d(A,{a:()=>t,x:()=>n});class t{constructor(){this.type=this.__proto__.constructor.type}setTags(s){return this.tags=new Set(s),this}}class n extends t{constructor(s){super(),this.payload=s}}},66670:(Q,A,e)=>{"use strict";e.d(A,{K:()=>n});var t=e(83077);class n extends t.O{}},57875:(Q,A,e)=>{"use strict";e.d(A,{H:()=>p,J:()=>d});var t=e(2543),n=e.n(t),o=e(14236),s=e(53531),r=e(47232),g=e(11261),u=e(28802),c=e(62398),i=e(83195),l=e(58563);const f={dateTimeAsIso:!0,dateTimeAsIsoNoDateIfToday:!0,dateTimeAsUS:!0,dateTimeAsUSNoDateIfToday:!0,dateTimeAsLocal:!0,dateTimeAsLocalNoDateIfToday:!0,dateTimeFromNow:!0};function d(a){if(!a||(0,t.isEmpty)(a)||!a.field)return h;const v=a.field,E=v.config??{},{palette:D}=a.theme.visualization;let b=E.unit,C=b&&(f[b]||b.startsWith("time:")),y=!1;if(v.type===g.PU.time&&!C){if(b="dateTimeAsSystem",C=!0,v.values&&v.values.length>1){let L=v.values[0],U=v.values[v.values.length-1];typeof L=="string"?(L=(0,s.b)(L).unix(),U=(0,s.b)(U).unix()):(L/=1e3,U/=1e3),y=Math.abs(U-L)<60}}else v.type===g.PU.boolean?(0,i.j9)(b)||(b="bool"):!b&&v.type===g.PU.string&&(b="string");const M=b?.startsWith("currency"),T=(0,i.j9)(b),I=v.type===g.PU.number,S=!C&&!M&&!T&&!(b==="locale")&&I&&E.decimals==null,O=(0,i.j_)(b||"none"),P=(0,l.jc)(v,a.theme);return(L,U)=>{const{mappings:R}=E,B=b==="string";C&&typeof L=="string"&&(L=(0,r.yT)(L).valueOf());let H=B?NaN:(0,u.t)(L),w,N,V,G,_,K;if(R&&R.length>0){const k=(0,c.Zz)(R,L);k&&(k.text!=null&&(w=k.text),k.color!=null&&(G=a.theme.visualization.getColorByName(k.color)),k.icon!=null&&(_=k.icon))}else if(v.type===g.PU.enum){if(L==null)return{text:"",numeric:NaN};const k=+L;if(E&&E.type&&E.type.enum){const{text:Y,color:ee}=E.type.enum;if(w=Y?Y[k]:`${L}`,G=ee?ee[k]:void 0,G==null){const re=D[k%D.length];G=a.theme.visualization.getColorByName(re)}}}if(!Number.isNaN(H)){if(w==null&&!(0,t.isBoolean)(L)){let k;S&&U!=null?(k=O(H,U,null,a.timeZone,y),k.text=+k.text+""):k=O(H,E.decimals,null,a.timeZone,y),w=k.text,V=k.suffix,N=k.prefix}if(G==null){const k=P(H);G=k.color,K=k.percent}}if(w==null&&(0,t.isArray)(L)&&(w=(0,t.join)(L,", ")),w==null&&(w=(0,t.toString)(L),w||(E.noValue?w=E.noValue:w="")),!G){const k=P(-1/0);G=k.color,K=k.percent}const j={text:w,numeric:H,prefix:N,suffix:V,color:G};return _!=null&&(j.icon=_),K!=null&&(j.percent=K),j}}function h(a){return{text:(0,t.toString)(a),numeric:(0,u.t)(a)}}function p(){return a=>({text:(0,o.oE)(a)==="other"?`${JSON.stringify(a,m())}`:`${a}`,numeric:null})}const m=()=>{const a=new WeakSet;return(v,E)=>{if(typeof E=="object"&&E!==null){if(a.has(E))return;a.add(E)}return E}}},8066:(Q,A,e)=>{"use strict";e.d(A,{Hs:()=>p,Qi:()=>h,lz:()=>m,uf:()=>f});var t=e(21197),n=e(55459),o=e.n(n),s=e(84140),r=e(23596),g=e(75059),u=e(24293),c=e(83077),i=e(58563),l=e(47737);const f=new c.O(()=>[{id:u.Y.Fixed,name:"Single color",description:"Set a specific color",getCalculator:a},{id:u.Y.Shades,name:"Shades of a color",description:"Select shades of a specific color",getCalculator:v},{id:u.Y.Thresholds,name:"From thresholds",isByValue:!0,description:"Derive colors from thresholds",getCalculator:(E,D)=>(b,C,y)=>{const M=y??l.QS;return D.visualization.getColorByName(M.color)}},new d({id:u.Y.PaletteClassic,name:"Classic palette",isContinuous:!1,isByValue:!1,getColors:E=>E.visualization.palette}),new d({id:u.Y.PaletteClassicByName,name:"Classic palette (by series name)",isContinuous:!1,isByValue:!1,useSeriesName:!0,getColors:E=>E.visualization.palette.filter(D=>r.getContrastRatio(E.visualization.getColorByName(D),E.colors.background.primary)>=E.colors.contrastThreshold)}),new d({id:u.Y.ContinuousGrYlRd,name:"Green-Yellow-Red",isContinuous:!0,isByValue:!0,getColors:E=>["green","yellow","red"]}),new d({id:u.Y.ContinuousRdYlGr,name:"Red-Yellow-Green",isContinuous:!0,isByValue:!0,getColors:E=>["red","yellow","green"]}),new d({id:u.Y.ContinuousBlYlRd,name:"Blue-Yellow-Red",isContinuous:!0,isByValue:!0,getColors:E=>["dark-blue","super-light-yellow","dark-red"]}),new d({id:u.Y.ContinuousYlRd,name:"Yellow-Red",isContinuous:!0,isByValue:!0,getColors:E=>["super-light-yellow","dark-red"]}),new d({id:u.Y.ContinuousBlPu,name:"Blue-Purple",isContinuous:!0,isByValue:!0,getColors:E=>["blue","purple"]}),new d({id:u.Y.ContinuousYlBl,name:"Yellow-Blue",isContinuous:!0,isByValue:!0,getColors:E=>["super-light-yellow","dark-blue"]}),new d({id:u.Y.ContinuousBlues,name:"Blues",isContinuous:!0,isByValue:!0,getColors:E=>["panel-bg","dark-blue"]}),new d({id:u.Y.ContinuousReds,name:"Reds",isContinuous:!0,isByValue:!0,getColors:E=>["panel-bg","dark-red"]}),new d({id:u.Y.ContinuousGreens,name:"Greens",isContinuous:!0,isByValue:!0,getColors:E=>["panel-bg","dark-green"]}),new d({id:u.Y.ContinuousPurples,name:"Purples",isContinuous:!0,isByValue:!0,getColors:E=>["panel-bg","dark-purple"]})]);class d{constructor(D){this.id=D.id,this.name=D.name,this.description=D.description,this.getNamedColors=D.getColors,this.isContinuous=D.isContinuous,this.isByValue=D.isByValue,this.useSeriesName=D.useSeriesName}getColors(D){return this.getNamedColors?this.colorCache&&this.colorCacheTheme===D?this.colorCache:(this.colorCache=this.getNamedColors(D).map(D.visualization.getColorByName),this.colorCacheTheme=D,this.colorCache):[]}getInterpolator(){return this.interpolator||(this.interpolator=(0,t.Ik)(this.colorCache)),this.interpolator}getCalculator(D,b){const C=this.getColors(b);return this.isByValue?this.isContinuous?(y,M,T)=>this.getInterpolator()(M):(y,M,T)=>C[M*(C.length-1)]:this.useSeriesName?(y,M,T)=>C[Math.abs(o()(D.name))%C.length]:(y,M,T)=>{const I=D.state?.seriesIndex??0;return C[I%C.length]}}}function h(E){return f.get(E.config.color?.mode??u.Y.Thresholds)}function p(E){return f.get(E??u.Y.Thresholds)}function m(E,D){const b=h(E);if(!b.isByValue)return{color:b.getCalculator(E,D)(0,0),threshold:l.QS,percent:1};const C=(0,i.jc)(E,D),y=E.config.color?.seriesBy??"last",T=(0,g.Nw)({field:E,reducers:[y]})[y]??0;return C(T)}function a(E,D){return()=>D.visualization.getColorByName(E.config.color?.fixedColor??u.F)}function v(E,D){return()=>{const b=D.visualization.getColorByName(E.config.color?.fixedColor??u.F),C=[b],y=6,M=10,T=35,I=35;for(let S=1;S<y;S++)C.push((0,s.A)(b).spin(S/y*M).brighten(S/y*T).toHexString()),C.push((0,s.A)(b).spin(-(S/y)*M).darken(S/y*I).toHexString());const x=E.state?.seriesIndex??0;return C[x%C.length]}}},56323:(Q,A,e)=>{"use strict";e.d(A,{PI:()=>v,Pm:()=>a,XS:()=>y,Zo:()=>I,a_:()=>m,eG:()=>C,k3:()=>f,k_:()=>p,nF:()=>h,py:()=>d});var t=e(2543),n=e.n(t),o=e(78368),s=e(14236),r=e(85200),g=e(75059),u=e(1173),c=e(11261),i=e(57875),l=e(28240);const f="__series.name",d="__field.displayName",h="__field.labels",p="__calc",m="__cell_",a=25,v=S=>{const{replaceVariables:O,reduceOptions:P,timeZone:L,theme:U}=S,R=P.calcs.length?P.calcs:[g.gy.last],B=[],H=(0,r.NS)(P.fields?{id:u.Ct.byRegexp,options:P.fields}:{id:u.Ct.numeric}),w=S.data??[],N=P.limit?P.limit:a;let V=!1;for(let G=0;G<w.length&&!V;G++){const _=w[G],{timeField:K}=(0,s.KR)(_),j=new o.R(_);for(let k=0;k<_.fields.length&&!V;k++){const Y=_.fields[k],ee=Y.getLinks;if(!H(Y,_,w))continue;let re=Y.config;Y.state?.range&&(re={...re,...Y.state?.range});let J=Y.config.displayName??"";const ne=Y.display??(0,i.J)({field:Y,theme:S.theme,timeZone:L});if(P.values)for(let q=0;q<Y.values.length;q++){Y.state=D(Y,B.length);const te=x(Y,q),oe=ne(Y.values[q]),ue=E(_,Y,q,O,te),ie=b(ue,S.fieldConfig,U);if(B.push({name:"",field:re,display:{...oe,title:ue,color:ie??oe.color},view:j,colIndex:k,rowIndex:q,getLinks:ee?()=>ee({valueRowIndex:q}):()=>[],hasLinks:C(Y)}),B.length>=N){V=!0;break}}else{const q=(0,g.Nw)({field:Y,reducers:R});for(const te of R){const oe=Y.state?.scopedVars??{};oe[p]={value:te,text:te};const ue=ne(q[te]);J!==""?ue.title=O(J,oe):ue.title=(0,l.Ct)(Y,_,w),ue.percentChange=S.percentChange?(0,g.Nw)({field:Y,reducers:[g.gy.diffperc]}).diffperc:void 0;let ie;S.sparkline&&(ie={y:_.fields[k],x:K},te===g.gy.last?ie.highlightIndex=ie.y.values.length-1:te===g.gy.first&&(ie.highlightIndex=0));const ge=_.length===1?0:void 0;B.push({name:te,field:re,display:ue,sparkline:ie,view:j,colIndex:k,getLinks:ee?()=>ee({calculatedValue:ue,valueRowIndex:ge}):()=>[],hasLinks:C(Y)})}}}}return B.length===0&&B.push(M(S)),B};function E(S,O,P,L,U){const R=O.config.displayName;if(R)return R.indexOf(m)?L(I(R),U):L(R,U);let B=[],H=0;for(const w of S.fields)if(w!==O)if(w.type===c.PU.string){const N=w.values[P]??"",V=w.display?w.display(N).text:N;V.length>0&&B.push(V)}else w.type===c.PU.number&&H++;return(H||B.length===0)&&B.push((0,l.Ct)(O,S)),B.join(" ")}function D(S,O){return{...S.state,seriesIndex:O}}function b(S,O,P){for(const L of O.overrides)if(L.matcher.id==="byName"&&L.matcher.options===S){for(const U of L.properties)if(U.id==="color"&&U.value)return P.visualization.getColorByName(U.value.fixedColor)}return null}function C(S){return S.config?.links?.length?S.config.links.length>0:!1}function y(S){let O="",P="",L="",U="";for(let R=0;R<S.length;R++){const B=S[R].display;B.text&&B.text.length>P.length&&(P=B.text),B.title&&B.title.length>O.length&&(O=B.title),B.prefix&&B.prefix.length>L.length&&(L=B.prefix),B.suffix&&B.suffix.length>U.length&&(U=B.suffix)}return{text:P,title:O,suffix:U,prefix:L}}function M(S){const O="No data",{fieldConfig:P,timeZone:L}=S,{defaults:U}=P,B=(0,i.J)({field:{type:c.PU.other,config:U},theme:S.theme,timeZone:L})(null),H=T(B,O);return{name:O,field:{...U,max:U.max??0,min:U.min??0},display:{text:H,numeric:0,color:B.color},hasLinks:!1}}function T(S,O){return!S||(0,t.isEmpty)(S.text)?O:S.text}function I(S){return S.replace(/\${__cell_(\d+)(.*?)}|\[\[__cell_(\d+)(.*?)\]\]|\$__cell_(\d+)(\S*)/g,(O,P,L,U,R,B,H)=>`\${__data.fields[${P??U??B}]${L??R??H}}`)}function x(S,O){return S.state?.scopedVars?.__dataContext?{...S.state?.scopedVars,__dataContext:{value:{...S.state?.scopedVars?.__dataContext.value,rowIndex:O}}}:S.state?.scopedVars}},90708:(Q,A,e)=>{"use strict";e.d(A,{BF:()=>I,K3:()=>O,_M:()=>S,nJ:()=>E,rJ:()=>P,we:()=>D});var t=e(2543),n=e.n(t),o=e(96540),s=e(80292),r=e(52622),g=e(14236),u=e(21423),c=e(23596),i=e(75059),l=e(85200),f=e(11261),d=e(24293),h=e(71733),p=e(6709),m=e(57875),a=e(58563),v=e(69550);function E(U){let R=null,B=null;const H=[i.gy.min,i.gy.max];for(const w of U)for(const N of w.fields)if(N.type===f.PU.number){const V=(0,i.Nw)({field:N,reducers:H}),G=V[i.gy.min],_=V[i.gy.max];(R===null||G<R)&&(R=G),(B===null||_>B)&&(B=_)}return{min:R,max:B,delta:(B??0)-(R??0)}}function D(U){if(!U.data)return[];const R=U.fieldConfig;if(!R)return U.data;const B=U.fieldConfigRegistry??v.G;let H=0,w;const N=[];if(R.overrides)for(const V of R.overrides){const G=l.sJ.get(V.matcher.id);G&&N.push({match:G.get(V.matcher.options),properties:V.properties})}return U.data.map((V,G)=>{const _={...V};_.fields=_.fields.map(K=>({...K,config:(0,t.cloneDeep)(K.config),state:{...K.state}}));for(const K of _.fields){const j=K.config;K.state.scopedVars={__dataContext:{value:{data:U.data,frame:_,frameIndex:G,field:K}}};const k={field:K,data:U.data,dataFrameIndex:G,replaceVariables:U.replaceVariables,fieldConfigRegistry:B};M(j,R.defaults,k);for(const J of N)if(J.match(K,_,U.data))for(const ne of J.properties)y(j,ne,k);let Y=K.type;if(!Y||Y===f.PU.other){const J=(0,g.dF)(K);J&&(Y=J)}const{range:ee,newGlobalRange:re}=b(j,K,w,U.data);if(w=re,K.state.seriesIndex=H,K.state.range=ee,K.type=Y,K.type!==f.PU.time&&H++,K.display=(0,m.J)({field:K,theme:U.theme,timeZone:U.timeZone}),K.config.unit!=="dateTimeFromNow"&&(K.display=C(K.display,2500)),K.getLinks=S(_,K,K.state.scopedVars,k.replaceVariables,U.timeZone,U.dataLinkPostProcessor),K.type===f.PU.nestedFrames)for(const J of K.values)for(let ne=0;ne<J.length;ne++)for(const q of J[ne].fields)q.display=(0,m.J)({field:q,theme:U.theme,timeZone:U.timeZone}),q.state={scopedVars:{__dataContext:{value:{data:J,frame:J[ne],frameIndex:ne,field:q}}}},q.getLinks=S(J[ne],q,q.state.scopedVars,k.replaceVariables,U.timeZone,U.dataLinkPostProcessor)}return _})}function b(U,R,B,H){if(R.type!==f.PU.number||(0,t.isNumber)(U.min)&&(0,t.isNumber)(U.max))return{newGlobalRange:B};if(U.fieldMinMax){const G=(0,a.AP)(R),_=U.min??G.min,K=U.max??G.max;return{range:{min:_,max:K,delta:K-_},newGlobalRange:B}}const w=B??E(H),N=U.min??w.min,V=U.max??w.max;return{range:{min:N,max:V,delta:V-N},newGlobalRange:w}}function C(U,R=2500){const B=new Map;for(let H=-1;H<=15;H++)B.set(H,new Map);return(H,w)=>{let N=B.get(w??-1),V=N.get(H);return V||(N.size===R&&N.clear(),V=U(H,w),V.color&&(V.color=(0,c.asHexString)(V.color)),N.set(H,V)),V}}function y(U,R,B){const w=B.fieldConfigRegistry.getIfExists(R.id);if(!w)return;const N=w.process(R.value,B,w.settings);N==null?w.isCustom&&U.custom?(0,t.unset)(U.custom,w.path):(0,t.unset)(U,w.path):w.isCustom?(U.custom||(U.custom={}),(0,t.set)(U.custom,w.path,N)):(0,t.set)(U,w.path,N)}function M(U,R,B){U.links&&R.links&&(U.links=[...U.links,...R.links]);for(const H of B.fieldConfigRegistry.list())H.isCustom&&!U.custom&&(U.custom={}),T(H.isCustom?U.custom:U,H.isCustom?R.custom:R,H,B);I(U)}function T(U,R,B,H){const w=(0,t.get)(U,B.path);if(w==null){const N=H.fieldConfigRegistry.getIfExists(B.id);if(!N)return;if(N&&N.shouldApply(H.field)){const V=N.process((0,t.get)(R,N.path),H,N.settings);V!=null&&(0,t.set)(U,N.path,V)}}}function I(U){const{thresholds:R}=U;if(U.color?U.color.mode||delete U.color:R&&(U.color={mode:d.Y.Thresholds}),U.hasOwnProperty("min")&&U.hasOwnProperty("max")&&U.min>U.max){const B=U.max;U.max=U.min,U.min=B}}const x=U=>{const{link:R,linkModel:B,dataLinkScopedVars:H,field:w,replaceVariables:N}=U;return R.internal?(0,p.u)({link:R,internalLink:R.internal,scopedVars:H,field:w,range:R.internal.range,replaceVariables:N}):B},S=(U,R,B,H,w,N)=>V=>!R.config.links||R.config.links.length===0?[]:R.config.links.map(_=>{const K=L(U,R,B),j={...B,__dataContext:K},k=(ee,re,J)=>H(ee,{...j,...re},J);V.valueRowIndex!==void 0&&!isNaN(V.valueRowIndex)?K.value.rowIndex=V.valueRowIndex:K.value.calculatedValue=V.calculatedValue;let Y;if(_.onClick)Y={href:_.url,title:H(_.title||"",j),target:_.targetBlank?"_blank":void 0,onClick:(ee,re)=>{_.onClick({origin:re??R,e:ee,replaceVariables:k})},origin:R};else{let ee=_.onBuildUrl?_.onBuildUrl({origin:R,replaceVariables:k}):_.url;ee&&(ee=h.I.assureBaseUrl(ee.replace(/\n/g,"")),ee=H(ee,j,r.$m.UriEncode),ee=h.I.processUrl(ee)),Y={href:ee,title:H(_.title||"",j),target:_.targetBlank?"_blank":void 0,origin:R}}return(N||x)({frame:U,field:R,dataLinkScopedVars:j,replaceVariables:H,config:V,link:_,linkModel:Y})}).filter(_=>!!_);function O(U){if(!U||U.length===0)return[];const R=[...U],B=(0,m.H)();for(let H=0;H<R.length;H++){const w={...R[H]},N=[...w.fields];for(let V=0;V<N.length;V++)N[V]={...N[V],display:B};R[H]={...w,fields:N}}return R}function P(U,R,B,H,w,N,V){const G=U?.fieldConfigRegistry,_=(0,o.useRef)(0),K=(0,s.A)(B?.series);return(0,o.useMemo)(()=>{if(!G||!R||!B)return;const j=B?.series;B.structureRev==null&&j&&K&&!(0,u.J3)(j,K,u.bW)&&_.current++;const k={structureRev:_.current,...B,series:D({data:j,fieldConfig:R,fieldConfigRegistry:G,replaceVariables:N,theme:w,timeZone:H,dataLinkPostProcessor:V})};return B.annotations&&B.annotations.length>0&&(k.annotations=D({data:B.annotations,fieldConfig:{defaults:{},overrides:[]},replaceVariables:N,theme:w,timeZone:H,dataLinkPostProcessor:V})),k},[G,R,B,K,H,w,N,V])}function L(U,R,B){return B?.__dataContext?{value:{...B.__dataContext.value}}:{value:{frame:U,field:R,data:[U]}}}},28240:(Q,A,e)=>{"use strict";e.d(A,{Ct:()=>r,Fm:()=>s,Ri:()=>o,fk:()=>u});var t=e(11261),n=e(8249);function o(i,l){if(i.name)return i.name;const f=[];for(const d of i.fields)if(d.type!==t.PU.time){if(f.length>1)break;f.push(r(d,i))}return f.length===1?f[0]:l===void 0&&i.fields.length>0?i.fields.filter(d=>d.type!==t.PU.time).map(d=>r(d,i)).join(", "):i.refId?`Series (${i.refId})`:`Series (${l})`}function s(i){i.forEach(l=>{l.fields.forEach(f=>{r(f,l,i)})})}function r(i,l,f){const d=i.state?.displayName,h=!!(f&&f.length>1);if(d&&h===i.state?.multipleFrames)return d;const p=g(i,l,f);return i.state=i.state||{},i.state.displayName=p,i.state.multipleFrames=h,p}function g(i,l,f){const d=i.config?.displayName&&i.config?.displayName.length,h=!!l?.meta?.timeCompare?.isTimeShiftQuery;let p=d?i.config.displayName:i.name;if(d)return h?`${p} (comparison)`:p;if(l&&i.config?.displayNameFromDS)return h?`${i.config.displayNameFromDS} (comparison)`:i.config.displayNameFromDS;if(i.type===t.PU.time&&!i.labels)return p??t.LE;let m=[],a=!1;if(f&&f.length>1){for(let D=1;D<f.length;D++)if(f[D].name!==f[D-1].name){a=!0;break}}let v=!1,E=!1;if(a&&l?.name&&(m.push(l.name),v=!0),i.name&&i.name!==t.Bc&&m.push(i.name),i.labels&&l){let D=c(f??[l]);if(D)i.labels[D]&&(m.push(i.labels[D]),E=!0);else{let b=(0,n.h6)(i.labels);b&&(m.push(b),E=!0)}}return l&&!v&&!E&&i.name===t.Bc&&l.name&&l.name.length>0&&(m.push(l.name),v=!0),m.length?p=m.join(" "):i.name?p=i.name:p=t.Bc,p===i.name&&(p=u(i,l)),h&&(p=`${p} (comparison)`),p}function u(i,l){let f=0,d=!1;if(l)for(let h=0;h<l.fields.length;h++){const p=l.fields[h];if(i===p){if(d=!0,f>0){f++;break}}else if(i.name===p.name&&(f++,d))break}return f?`${i.name} ${f}`:i.name}function c(i){let l=null;for(let f=0;f<i.length;f++){const d=i[f];for(const h of d.fields)if(h.labels){for(const p in h.labels)if(l===null)l=p;else if(p!==l)return null}}return l}},92461:(Q,A,e)=>{"use strict";e.d(A,{F:()=>r});var t=e(2543),n=e.n(t),o=e(83195),s=e(57875);function r(g){return new Proxy({},{get:(u,c)=>{let i=g.frame.fields.find(h=>c===h.name);if(!i){const h=(0,t.toNumber)(c);i=g.frame.fields[h]}if(i||(i=g.frame.fields.find(h=>c===h.config.displayName)),i||(i=g.frame.fields.find(h=>h.labels?c===h.labels.name:!1)),!i)return;const l=i.display??(0,s.J)(),f=i.values[g.rowIndex],d=l(f);return d.toString=()=>(0,o.cN)(d),d}})}},63877:(Q,A,e)=>{"use strict";e.d(A,{AM:()=>s.AM,AP:()=>f.AP,BF:()=>c.BF,Ch:()=>s.Ch,Ct:()=>l.Ct,DJ:()=>o.D,FM:()=>s.FM,FU:()=>i.F,Fm:()=>l.Fm,Gs:()=>o.G,HB:()=>n.H,Hs:()=>r.Hs,JO:()=>n.J,K3:()=>c.K3,Kr:()=>g.K,N7:()=>s.N7,OU:()=>s.OU,PI:()=>t.PI,Pm:()=>t.Pm,Qi:()=>r.Qi,RU:()=>u.RU,Ri:()=>l.Ri,X4:()=>s.X4,XS:()=>t.XS,Zo:()=>t.Zo,a_:()=>t.a_,eG:()=>t.eG,fk:()=>l.fk,hL:()=>s.hL,hS:()=>s.hS,jc:()=>f.jc,k3:()=>t.k3,k_:()=>t.k_,lG:()=>s.lG,lz:()=>r.lz,m0:()=>s.m0,nF:()=>t.nF,py:()=>t.py,rJ:()=>c.rJ,uf:()=>r.uf,we:()=>c.we,xT:()=>s.xT,xg:()=>f.xg,yQ:()=>u.yQ});var t=e(56323),n=e(57875),o=e(69550),s=e(27310),r=e(8066),g=e(66670),u=e(47737),c=e(90708),i=e(92461),l=e(28240),f=e(58563)},27310:(Q,A,e)=>{"use strict";e.d(A,{AM:()=>o,Ch:()=>s,FM:()=>l,N7:()=>c,OU:()=>u,X4:()=>f,hL:()=>g,hS:()=>t,lG:()=>i,m0:()=>n,xT:()=>r});const t=d=>d,n=(d,h,p)=>{if(d!=null)return parseFloat(d)},o=(d,h,p)=>(delete h.field?.state?.displayName,u(d,h,p)),s=(d,h,p)=>d,r=(d,h,p)=>d,g=(d,h,p)=>d,u=(d,h,p)=>d==null?d:p&&p.expandTemplateVars&&h.replaceVariables&&typeof d=="string"?h.replaceVariables(d,h.field.state.scopedVars):`${d}`,c=(d,h,p)=>d,i=(d,h,p)=>d,l=(d,h,p)=>d;var f=(d=>(d.IncludeAll="all",d.ExcludeBaseNames="exclude",d.OnlyBaseNames="only",d))(f||{})},58563:(Q,A,e)=>{"use strict";e.d(A,{AP:()=>i,jc:()=>u,xg:()=>l});var t=e(2543),n=e.n(t),o=e(75059),s=e(11261),r=e(8066),g=e(47737);function u(f,d){if(f.type===s.PU.boolean)return c(f,d);const p=(0,r.Qi)(f).getCalculator(f,d),m=f.state?.range??i(f);return a=>{let v=0;a!==-1/0&&(v=(a-m.min)/m.delta,Number.isNaN(v)&&(v=0));const E=(0,g.k5)(f,a,v);return{percent:v,threshold:E,color:p(a,v,E)}}}function c(f,d){const h={color:d.visualization.getColorByName("green"),percent:1,threshold:void 0},p={color:d.visualization.getColorByName("red"),percent:0,threshold:void 0},m=(0,r.Qi)(f);if(m.isContinuous&&m.getColors){const a=m.getColors(d);h.color=a[a.length-1],p.color=a[0]}return a=>a?h:p}function i(f){if(f.type!==s.PU.number)return{min:0,max:100,delta:100};let d=f.config.min,h=f.config.max;if(!(0,t.isNumber)(d)||!(0,t.isNumber)(h))if(f.values&&f.values.length){const p=(0,o.Nw)({field:f,reducers:[o.gy.min,o.gy.max]});(0,t.isNumber)(d)||(d=p[o.gy.min]),(0,t.isNumber)(h)||(h=p[o.gy.max])}else d=0,h=100;return{min:d,max:h,delta:h-d}}function l(f,d){const{config:h}=f;let{min:p,max:m}=h;return(0,t.isNumber)(p)&&(0,t.isNumber)(m)?h:d||!f.state?.range?{...h,...i(f)}:{...h,...f.state.range}}},69550:(Q,A,e)=>{"use strict";e.d(A,{D:()=>s,G:()=>o});var t=e(83077),n=e(66670);const o=new n.K,s=new t.O},47737:(Q,A,e)=>{"use strict";e.d(A,{QS:()=>o,RU:()=>g,k5:()=>r,yQ:()=>s});var t=e(24293),n=e(50082);const o={value:0,color:t.F};function s(u,c){if(!c||c.length===0)return o;let i=c[0];for(const l of c)if(u>=l.value)i=l;else break;return i}function r(u,c,i){const{thresholds:l}=u.config;return l?.mode===n.O.Percentage?s(i*100,l?.steps):s(c,l?.steps)}function g(u){return u.sort((c,i)=>c.value-i.value)}},10361:(Q,A,e)=>{"use strict";e.d(A,{a:()=>t.aG});var t=e(52622)},39954:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{AnnotationChangeEvent:()=>f.We,AppendedVectors:()=>s.kV,ArrayDataFrame:()=>r.fG,ArrayVector:()=>s.Ld,AsNumberVector:()=>s.vG,BinaryOperationID:()=>t.kP,BinaryOperationVector:()=>s.E0,BusEventBase:()=>f.aV,BusEventWithPayload:()=>f.x$,ByNamesMatcherMode:()=>g.PP,CSVHeaderStyle:()=>t.F7,CSVReader:()=>t.i8,CircularDataFrame:()=>r.x8,CircularVector:()=>s.$e,ConstantVector:()=>s.m$,DEFAULT_FIELD_DISPLAY_VALUES_LIMIT:()=>l.Pm,DashboardLoadedEvent:()=>f.gc,DataFrameView:()=>r.Rh,DataHoverClearEvent:()=>f.ql,DataHoverEvent:()=>f.b_,DataLinkBuiltInVars:()=>t.cI,DataSelectEvent:()=>f.LO,DataSourcePluginContextProvider:()=>C.p,DataSourceTestFailed:()=>f.LL,DataSourceTestSucceeded:()=>f.NI,DataSourceUpdatedSuccessfully:()=>f.wE,DataTransformerID:()=>g.Fy,DocsId:()=>t.fu,EventBusSrv:()=>f.or,FieldCache:()=>r.Lc,FieldConfigEditorBuilder:()=>t.bk,FieldConfigOptionsRegistry:()=>l.Kr,FieldMatcherID:()=>g.Ct,FieldNamePickerBaseNameMode:()=>l.X4,FormattedVector:()=>s.aO,FrameGeometrySourceMode:()=>p.a,FrameMatcherID:()=>g.jR,ISO_8601:()=>u.mt,IndexVector:()=>s.QL,InternalTimeZones:()=>u.g$,LayoutModes:()=>a.R,LegacyMappingType:()=>t.An,MISSING_VALUE:()=>r.pk,MatcherID:()=>g.cV,MutableDataFrame:()=>r.k2,NodeGraphDataFrameFieldNames:()=>t.uc,PanelOptionsEditorBuilder:()=>t.pv,PanelPlugin:()=>v.m,PluginContextProvider:()=>b.a,ReducerID:()=>g.gy,Registry:()=>t.OR,SortedVector:()=>s.Fb,StreamingDataFrame:()=>r.k9,StreamingFrameAction:()=>r.Kh,SystemDateFormatsState:()=>u.JE,ThemeContext:()=>d.Dx,TransformerCategory:()=>g.m_,UnaryOperationID:()=>t._G,VAR_CALC:()=>l.k_,VAR_CELL_PREFIX:()=>l.a_,VAR_FIELD_LABELS:()=>l.nF,VAR_FIELD_NAME:()=>l.py,VAR_SERIES_NAME:()=>l.k3,ValueMatcherID:()=>g.Js,addDurationToDate:()=>u.Ri,addRow:()=>r.uY,anySeriesWithTimeField:()=>r.tP,anyToNumber:()=>t.to,applyFieldOverrides:()=>l.we,applyNullInsertThreshold:()=>g.MS,applyRawFieldOverrides:()=>l.K3,arrayToDataFrame:()=>r.Ij,arrayUtils:()=>t.XC,binaryOperators:()=>t.bP,booleanOverrideProcessor:()=>l.FM,booleanValueFormatter:()=>i.Qc,buildHistogram:()=>g.p3,cacheFieldDisplayNames:()=>l.Fm,classicColors:()=>t.tj,closestIdx:()=>r.Ls,colorManipulator:()=>d.MV,compareArrayValues:()=>r.J3,compareDataFrameStructures:()=>r.bW,containsSearchFilter:()=>t.Eg,convertOldAngularValueMappings:()=>t.bh,createDataFrame:()=>r.EI,createDimension:()=>r.r4,createFieldConfigRegistry:()=>D.O,createTheme:()=>d.an,dataFrameFromJSON:()=>r.or,dataFrameToJSON:()=>r.Nw,dataLinksOverrideProcessor:()=>l.Ch,dateMath:()=>u.ns,dateTime:()=>u.KQ,dateTimeAsMoment:()=>u.AN,dateTimeForTimeZone:()=>u.oZ,dateTimeFormat:()=>u.LE,dateTimeFormatISO:()=>u.M7,dateTimeFormatTimeAgo:()=>u.fq,dateTimeFormatWithAbbrevation:()=>u._Q,dateTimeParse:()=>u.bQ,decodeFieldValueEntities:()=>r.t,decodeFieldValueEnums:()=>r.EL,defaultCalcs:()=>g.C6,deprecationWarning:()=>t.lt,displayNameOverrideProcessor:()=>l.AM,doStandardCalcs:()=>g.H3,durationToMilliseconds:()=>u.WT,ensureTimeField:()=>g.ks,escapeRegex:()=>c.$f,escapeStringForRegex:()=>c.jD,eventFactory:()=>f.Rb,fieldColorModeRegistry:()=>l.uf,fieldMatchers:()=>g.sJ,fieldReducers:()=>g.AS,filterFieldConfigOverrides:()=>E.aW,findCommonLabels:()=>t.yO,findHighlightChunksInText:()=>c.Oq,findMatchesInText:()=>c.bs,findUniqueLabels:()=>t.s6,fixCellTemplateExpressions:()=>l.Zo,formatLabels:()=>t.h6,formattedValueToString:()=>i.cN,frameMatchers:()=>g.RE,getActiveThreshold:()=>l.yQ,getAllValuesFromDimension:()=>r.Km,getBuiltInThemes:()=>d.k7,getColumnFromDimension:()=>r.P4,getColumnsFromDimension:()=>r.g6,getDataFrameRow:()=>r.Yn,getDataSourceRef:()=>t.p$,getDataSourceUID:()=>t.Iz,getDimensionByName:()=>r.xB,getDisplayProcessor:()=>l.JO,getDisplayValueAlignmentFactors:()=>l.XS,getFieldColorMode:()=>l.Hs,getFieldColorModeForField:()=>l.Qi,getFieldConfigWithMinMax:()=>l.xg,getFieldDisplayName:()=>l.Ct,getFieldDisplayValues:()=>l.PI,getFieldDisplayValuesProxy:()=>l.FU,getFieldMatcher:()=>g.NS,getFieldSeriesColor:()=>l.lz,getFieldTypeFromValue:()=>r.oE,getFlotPairs:()=>t.RZ,getFlotPairsConstant:()=>t.rG,getFrameDisplayName:()=>l.Ri,getFrameMatchers:()=>g.Dq,getHistogramFields:()=>g.ix,getLinksSupplier:()=>T._M,getLocale:()=>u.JK,getLocaleData:()=>u.XN,getMinMaxAndDelta:()=>l.AP,getNextRefId:()=>m.M,getPanelOptionsWithDefaults:()=>E.F,getProcessedDataFrames:()=>r.Bt,getRawDisplayProcessor:()=>l.HB,getRowUniqueId:()=>r.t9,getScaleCalculator:()=>l.jc,getSearchFilterScopedVar:()=>t.cs,getSeriesTimeStep:()=>t.tY,getThemeById:()=>d.gh,getTimeField:()=>r.KR,getTimeZone:()=>u.O,getTimeZoneGroups:()=>u.U3,getTimeZoneInfo:()=>u.QZ,getTimeZones:()=>u.P3,getUniqueFieldName:()=>l.fk,getValueFormat:()=>i.j_,getValueFormats:()=>i.Ke,getValueFormatterIndex:()=>i.uH,getValueFromDimension:()=>r.WK,getValueMatcher:()=>g.kK,getWeekdayIndex:()=>u.xQ,getWeekdayIndexByEnglishName:()=>u.pp,getZone:()=>u.HD,guessDecimals:()=>t.E6,guessFieldTypeForField:()=>r.dF,guessFieldTypeFromNameAndValue:()=>r.by,guessFieldTypeFromValue:()=>r.HW,guessFieldTypes:()=>r.XQ,hasLinks:()=>l.eG,hasMsResolution:()=>t.dO,hasTimeField:()=>r.S1,histogramBucketSizes:()=>g.rW,histogramFieldInfo:()=>g.Rt,histogramFieldsToFrame:()=>g.cg,histogramFrameBucketMaxFieldName:()=>g.dA,histogramFrameBucketMinFieldName:()=>g.d$,histogramTransformer:()=>g.OA,identityOverrideProcessor:()=>l.hS,incrRound:()=>g.ZU,incrRoundDn:()=>g.rs,incrRoundUp:()=>g.Uh,intervalToAbbreviatedDurationString:()=>u.dU,isBooleanUnit:()=>i.j9,isCustomFieldProp:()=>E.TQ,isDataFrame:()=>r.ci,isDataFrameWithValue:()=>r.LI,isDataSourcePluginContext:()=>M.S,isDataSourceRef:()=>t.fN,isDateTime:()=>u.Ar,isDateTimeInput:()=>u.u8,isEmptyObject:()=>t.RI,isHistogramFrameBucketMaxFieldName:()=>g.H1,isHistogramFrameBucketMinFieldName:()=>g.NX,isLikelyAscendingVector:()=>g.g2,isReducerID:()=>g.Em,isStandardFieldProp:()=>E.nx,isTableData:()=>r.pH,isTimeSeriesField:()=>r.hF,isTimeSeriesFrame:()=>r.aH,isTimeSeriesFrames:()=>r.jq,isValidDate:()=>u.vd,isValidDuration:()=>u.di,isValidGoDuration:()=>u.IM,isValidGrafanaDuration:()=>u.V3,localTimeFormat:()=>u.Od,locale:()=>i.Hg,locationUtil:()=>t.Ig,makeClassES5Compatible:()=>t.Yi,mapInternalLinkToExplore:()=>t.uS,matchAllLabels:()=>t._p,matchPluginId:()=>t._8,monacoLanguageRegistry:()=>h.l,nullToValue:()=>g.CF,numberOverrideProcessor:()=>l.m0,objRemoveUndefined:()=>t.wm,onUpdateDatasourceJsonDataOption:()=>t.PG,onUpdateDatasourceJsonDataOptionChecked:()=>t.EX,onUpdateDatasourceJsonDataOptionSelect:()=>t.BD,onUpdateDatasourceOption:()=>t.zX,onUpdateDatasourceResetOption:()=>t.yV,onUpdateDatasourceSecureJsonDataOption:()=>t.mn,onUpdateDatasourceSecureJsonDataOptionSelect:()=>t.wY,outerJoinDataFrames:()=>g.KP,parseDuration:()=>u.E9,parseFlags:()=>c.bQ,parseLabels:()=>t.Xy,preProcessPanelData:()=>r.N$,rangeUtil:()=>u.Ii,readCSV:()=>t.Jh,reduceField:()=>g.Nw,renderLegendFormat:()=>t.j_,renderMarkdown:()=>c.Gc,renderTextPanelMarkdown:()=>c.Pn,restoreCustomOverrideRules:()=>E.H9,reverseDataFrame:()=>r.q7,roundDecimals:()=>t.hB,scaledUnits:()=>i.yP,selectOverrideProcessor:()=>l.hL,serializeStateToUrlParam:()=>t.Pp,setLocale:()=>u.xS,setTimeZoneResolver:()=>u.GZ,setWeekStart:()=>u.$D,shallowCompare:()=>r.ab,simpleCountUnit:()=>i.UR,sortDataFrame:()=>r.ES,sortThresholds:()=>l.RU,standardEditorsRegistry:()=>l.DJ,standardFieldConfigEditorRegistry:()=>l.Gs,standardTransformers:()=>g.c9,standardTransformersRegistry:()=>g.h9,stringFormater:()=>i.cH,stringOverrideProcessor:()=>l.OU,stringStartsAsRegEx:()=>c.AP,stringToJsRegex:()=>c.dO,stringToMs:()=>c.dc,systemDateFormats:()=>u.WC,textUtil:()=>c.sQ,thresholdsOverrideProcessor:()=>l.N7,timeZoneAbbrevation:()=>u.jw,timeZoneFormatUserFriendly:()=>u.le,toCSV:()=>t._O,toDataFrame:()=>r.Vc,toDataFrameDTO:()=>r.Kl,toDuration:()=>u.Ah,toFilteredDataFrameDTO:()=>r.By,toFixed:()=>i.Mg,toFixedScaled:()=>i.gZ,toFixedUnit:()=>i.G8,toFloatOrUndefined:()=>c.$D,toIntegerOrUndefined:()=>c.vb,toLegacyResponseData:()=>r.w3,toNumberString:()=>c.kT,toOption:()=>t.zL,toPascalCase:()=>c.MX,toURLRange:()=>t.sQ,toUtc:()=>u.yT,transformDataFrame:()=>g.m6,unEscapeStringFromRegex:()=>c.xb,unaryOperators:()=>t.j7,unitOverrideProcessor:()=>l.lG,updateDatasourcePluginJsonDataOption:()=>t.lO,updateDatasourcePluginOption:()=>t.pN,updateDatasourcePluginResetOption:()=>t.QP,updateDatasourcePluginSecureJsonDataOption:()=>t.wp,urlUtil:()=>t.kM,useFieldOverrides:()=>l.rJ,usePluginContext:()=>y.Q,validateFieldConfig:()=>l.BF,valueMappingsOverrideProcessor:()=>l.xT,valueMatchers:()=>g.hI,vectorator:()=>s.Ek,withLoadingIndicator:()=>t.kz});var t=e(94032),n=e(64572),o={};for(const I 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","UnaryOperationID","anyToNumber","arrayUtils","binaryOperators","classicColors","containsSearchFilter","convertOldAngularValueMappings","deprecationWarning","findCommonLabels","findUniqueLabels","formatLabels","getDataSourceRef","getDataSourceUID","getFlotPairs","getFlotPairsConstant","getSearchFilterScopedVar","getSeriesTimeStep","guessDecimals","hasMsResolution","isDataSourceRef","isEmptyObject","locationUtil","makeClassES5Compatible","mapInternalLinkToExplore","matchAllLabels","matchPluginId","objRemoveUndefined","onUpdateDatasourceJsonDataOption","onUpdateDatasourceJsonDataOptionChecked","onUpdateDatasourceJsonDataOptionSelect","onUpdateDatasourceOption","onUpdateDatasourceResetOption","onUpdateDatasourceSecureJsonDataOption","onUpdateDatasourceSecureJsonDataOptionSelect","parseLabels","readCSV","renderLegendFormat","roundDecimals","serializeStateToUrlParam","toCSV","toOption","toURLRange","unaryOperators","updateDatasourcePluginJsonDataOption","updateDatasourcePluginOption","updateDatasourcePluginResetOption","updateDatasourcePluginSecureJsonDataOption","urlUtil","withLoadingIndicator"].indexOf(I)<0&&(o[I]=()=>n[I]);e.d(A,o);var s=e(31978),r=e(48120),g=e(34687),u=e(38698),c=e(40672),i=e(56496),l=e(63877),f=e(56302),d=e(74529),h=e(58612),p=e(10361),m=e(21809),a=e(19484),v=e(65158),E=e(581),D=e(28528),b=e(13834),C=e(76287),y=e(92470),M=e(95187),T=e(90708)},58612:(Q,A,e)=>{"use strict";e.d(A,{l:()=>t.l});var t=e(96915)},96915:(Q,A,e)=>{"use strict";e.d(A,{l:()=>n});var t=e(83077);const n=new t.O},65158:(Q,A,e)=>{"use strict";e.d(A,{m:()=>c});var t=e(2543),n=e.n(t),o=e(66670),s=e(43429),r=e(95344),g=e(60264),u=e(28528);class c extends s.Ud{constructor(l){super(),this._fieldConfigDefaults={defaults:{},overrides:[]},this._initConfigRegistry=()=>new o.K,this.dataSupport={annotations:!1,alertStates:!1},this.panel=l}get defaults(){let l=this._defaults||{};if(!this._defaults&&this.optionsSupplier){const f=new g.pv;this.optionsSupplier(f,{data:[]});for(const d of f.getItems())d.defaultValue!=null&&(0,t.set)(l,d.path,d.defaultValue)}return l}get fieldConfigDefaults(){const l=this._fieldConfigDefaults.defaults;l.custom={};for(const f of this.fieldConfigRegistry.list())f.defaultValue!==void 0&&(0,t.set)(l,f.id,f.defaultValue);return{defaults:{...l},overrides:this._fieldConfigDefaults.overrides}}setDefaults(l){return(0,r.l)("PanelPlugin","setDefaults","setPanelOptions"),this._defaults=l,this}get fieldConfigRegistry(){return this._fieldConfigRegistry||(this._fieldConfigRegistry=this._initConfigRegistry()),this._fieldConfigRegistry}setEditor(l){return(0,r.l)("PanelPlugin","setEditor","setPanelOptions"),this.editor=l,this}setNoPadding(){return this.noPadding=!0,this}setMigrationHandler(l){return this.onPanelMigration=l,this}setPanelChangeHandler(l){return this.onPanelTypeChanged=l,this}setPanelOptions(l){return this.optionsSupplier=l,this}getPanelOptionsSupplier(){return this.optionsSupplier??(()=>{})}setDataSupport(l){return this.dataSupport={...this.dataSupport,...l},this}useFieldConfig(l={}){return this._initConfigRegistry=()=>(0,u.O)(l,this.meta.name),this}setSuggestionsSupplier(l){return this.suggestionsSupplier=l,this}getSuggestionsSupplier(){return this.suggestionsSupplier}hasPluginId(l){return this.meta.id===l}}},581:(Q,A,e)=>{"use strict";e.d(A,{F:()=>u,H9:()=>h,TQ:()=>p,aW:()=>i,nx:()=>m});var t=e(2543),n=e.n(t),o=e(8066),s=e(24293),r=e(37055),g=e(50082);function u({plugin:a,currentOptions:v,currentFieldConfig:E,isAfterPluginChange:D}){const b=(0,t.mergeWith)({},a.defaults,v||{},(M,T)=>{if((0,t.isArray)(T))return T}),C=c(E,a),y=f(a,C,D);return{options:b,fieldConfig:y}}function c(a,v){const E=v.fieldConfigDefaults,D={defaults:(0,t.mergeWith)({},E.defaults,a?a.defaults:{},(b,C)=>{if((0,t.isArray)(C))return C}),overrides:a?.overrides??[]};l(D.defaults,"",v.fieldConfigRegistry),D.defaults.thresholds&&d(D.defaults.thresholds),D.overrides=i(D.overrides,b=>v.fieldConfigRegistry.getIfExists(b.id)!==void 0);for(const b of D.overrides)for(const C of b.properties)C.id==="thresholds"&&d(C.value);return D}function i(a,v){return a.map(E=>{const D=E.properties.filter(v);return{...E,properties:D}}).filter(E=>E.properties.length>0)}function l(a,v,E){let D=!1;for(const[b,C]of Object.entries(a)){const y=`${v}${b}`,M=!!E.getIfExists(y);if(M){D=!0;continue}(0,t.isArray)(C)||!(0,t.isObject)(C)?M||(0,t.unset)(a,b):l(C,`${y}.`,E)||(0,t.unset)(a,b)}return D}function f(a,v,E){if(!E)return v;const D=a.fieldConfigRegistry.getIfExists(r.uo.Color);if(D&&D.settings){const b=D.settings,C=o.uf.getIfExists(v.defaults.color?.mode);if(!b.byValueSupport&&(!C||C.isByValue))return v.defaults.color={mode:s.Y.PaletteClassic},v;if(b.byValueSupport&&b.preferThresholdsMode&&C?.id!==s.Y.Fixed&&(!C||!C.isByValue))return v.defaults.color={mode:s.Y.Thresholds},v;if(b.bySeriesSupport&&C?.isByValue)return v.defaults.color={mode:s.Y.PaletteClassic},v}return v}function d(a){a.mode||(a.mode=g.O.Absolute),a.steps?a.steps.length&&(a.steps[0].value=-1/0):a.steps=[]}function h(a,v){const E={defaults:{...a.defaults,custom:v.defaults.custom},overrides:[...a.overrides]};for(const D of v.overrides)for(const b of D.properties)if(p(b)){const C=E.overrides.find(y=>(0,t.isEqual)(y.matcher,D.matcher));C?C!==D&&C.properties.push(b):E.overrides.push(D)}return E}function p(a){return a.id.startsWith("custom.")}function m(a){return!p(a)}},28528:(Q,A,e)=>{"use strict";e.d(A,{O:()=>s});var t=e(66670),n=e(69550),o=e(60264);function s(g={},u){const c=new t.K,i=n.G.list(),l={};if(g.useCustomConfig){const f=new o.bk;g.useCustomConfig(f);for(const d of f.getRegistry().list())if(d.isCustom=!0,d.id="custom."+d.id,r(d,i)){const h=l[d.category[0]]??[];h.push(d),l[d.category[0]]=h}else c.register(d)}for(let f of i){const d=f.id;if(!(g.disableStandardOptions&&g.disableStandardOptions.indexOf(d)>-1)){if(g.standardOptions){const h=g.standardOptions[d]?.hideFromDefaults,p=g.standardOptions[d]?.defaultValue,m=g.standardOptions[d]?.settings;h&&(f={...f,hideFromDefaults:h}),p&&(f={...f,defaultValue:p}),m&&(f={...f,settings:f.settings?{...f.settings,...m}:m})}if(c.register(f),f.category&&l[f.category[0]])for(let h of l[f.category[0]])c.register(h)}}for(const f of c.list())if(f.path.indexOf("[")>0)throw new Error(`[${u}] Field config paths do not support arrays: ${f.id}`);return c}function r(g,u){return!!u.find(c=>g.category&&c.category&&g.category[0]===c.category[0])}},21809:(Q,A,e)=>{"use strict";e.d(A,{M:()=>t.M});var t=e(77789)},77789:(Q,A,e)=>{"use strict";e.d(A,{M:()=>t});const t=o=>{for(let s=0;;s++){const r=n(s);if(!o.some(g=>g.refId===r))return r}};function n(o){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZ";return o<s.length?s[o]:n(Math.floor(o/s.length)-1)+s[o%s.length]}},40672:(Q,A,e)=>{"use strict";e.d(A,{$D:()=>t.$D,$f:()=>t.$f,AP:()=>t.AP,Gc:()=>n.G,MX:()=>t.MX,Oq:()=>o.Oq,Pn:()=>n.P,bQ:()=>o.bQ,bs:()=>o.bs,dO:()=>t.dO,dc:()=>t.dc,jD:()=>t.jD,kT:()=>t.kT,sQ:()=>r,vb:()=>t.vb,xb:()=>t.xb});var t=e(54479),n=e(36663),o=e(21),s=e(80997);const r={escapeHtml:s.ZD,hasAnsiCodes:s.kE,sanitize:s.aj,sanitizeTextPanelContent:s.G$,sanitizeUrl:s.Jf,sanitizeSVGContent:s.rX,sanitizeTrustedTypes:s.oI,sanitizeTrustedTypesRSS:s.kc}},36663:(Q,A,e)=>{"use strict";e.d(A,{G:()=>g,P:()=>u});var t=e(60023),n=e(33836),o=e(80997);let s=!1;const r={pedantic:!1,gfm:!0,breaks:!1};function g(c,i){s||(t.xI.use((0,n.z)()),t.xI.setOptions({...r}),s=!0);let l;i?.breaks&&(l={...r,breaks:!0});const f=(0,t.xI)(c||"",l);if(typeof f!="string")throw new Error("Failed to process markdown synchronously.");return i?.noSanitize?f:(0,o.G$)(f)}function u(c,i){s||(t.xI.use((0,n.z)()),t.xI.setOptions({...r}),s=!0);const l=(0,t.xI)(c||"");if(typeof l!="string")throw new Error("Failed to process markdown synchronously.");return i?.noSanitize?l:(0,o.G$)(l)}},80997:(Q,A,e)=>{"use strict";e.d(A,{G$:()=>f,Jf:()=>h,ZD:()=>m,aj:()=>c,kE:()=>p,kc:()=>i,oI:()=>l,rX:()=>d});var t=e(16750),n=e(42838),o=e.n(n),s=e(34005),r=e.n(s);const g=Object.keys(s.whiteList).reduce((a,v)=>(a[v]=s.whiteList[v]?.concat(["class","style"]),a),{}),u=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 c(a){try{return o().sanitize(a,{USE_PROFILES:{html:!0},FORBID_TAGS:["form","input"]})}catch{return console.error("String could not be sanitized",a),m(a)}}function i(a){return o().sanitize(a,{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 l(a){return o().sanitize(a,{RETURN_TRUSTED_TYPE:!0})}function f(a){try{return u.process(a)}catch{return console.error("String could not be sanitized",a),"Text string could not be sanitized"}}function d(a){return o().sanitize(a,{USE_PROFILES:{svg:!0,svgFilters:!0}})}function h(a){return(0,t.J)(a)}function p(a){return/\u001b\[\d{1,2}m/.test(a)}function m(a){return String(a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")}},54479:(Q,A,e)=>{"use strict";e.d(A,{$D:()=>p,$f:()=>a,AP:()=>i,MX:()=>m,dO:()=>l,dc:()=>f,jD:()=>u,kT:()=>d,vb:()=>h,xb:()=>c});var t=e(2543),n=e.n(t);const s="([\\"+["(","[","{","}","]",")","\\","|","*","+","-",".","?","<",">","#","&","^","$"].join("\\")+"])",r=new RegExp(s,"g"),g=new RegExp("(\\\\)"+s,"g");function u(v){return v&&v.replace(r,"\\$1")}function c(v){return v&&v.replace(g,"$2")}function i(v){return v?v[0]==="/":!1}function l(v){if(!i(v))return new RegExp(`^${v}$`);const E=v.match(new RegExp("^/(.*?)/(g?i?m?y?s?)$"));if(!E)throw new Error(`'${v}' is not a valid regular expression.`);return new RegExp(E[1],E[2])}function f(v){if(!v)return 0;const E=parseInt(v,10),D=v.slice(String(E).length),b=1e3,C=b*60,y=C*60,M=y*24;switch(D){case"s":return E*b;case"m":return E*C;case"h":return E*y;case"d":return E*M;default:if(!D)return isNaN(E)?0:E;throw new Error("Not supported unit: "+D)}}function d(v){return v!=null&&Number.isFinite(v)?v.toString():""}function h(v){if(!v)return;const E=parseInt(v,10);return isNaN(E)?void 0:E}function p(v){if(!v)return;const E=parseFloat(v);return isNaN(E)?void 0:E}function m(v){const E=(0,t.camelCase)(v);return E.charAt(0).toUpperCase()+E.substring(1)}function a(v){return v.replace(/[\\^$*+?.()|[\]{}\/]/g,"\\$&")}},21:(Q,A,e)=>{"use strict";e.d(A,{Oq:()=>t,bQ:()=>g,bs:()=>o});function t({searchWords:u,textToHighlight:c}){const i=[];for(const l of u)typeof l=="string"&&i.push(...o(c,l));return i}const n=u=>u.replace(/[[{(][\w,.\/:;<=>?:*+]+$/,"");function o(u,c){if(!u||!c)return[];const i=[],{cleaned:l,flags:f}=g(n(c));let d;try{d=new RegExp(`(?:${l})`,f)}catch{return i}return u.replace(d,(h,...p)=>{if(h){const m=p[p.length-2];i.push({text:h,start:m,length:h.length,end:m+h.length})}return""}),i}const s="-",r=/\(\?([ims-]+)\)/g;function g(u){const c=new Set(["g"]);return{cleaned:u.replace(r,(l,f)=>{const d=f.startsWith(s);for(let h=0;h<f.length;++h){const p=f.charAt(h);d||f.charAt(h-1)===s?c.delete(p):p!==s&&c.add(p)}return""}),flags:Array.from(c).join("")}}},23596:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{alpha:()=>p,asHexString:()=>g,asRgbString:()=>u,darken:()=>m,decomposeColor:()=>i,emphasize:()=>h,getContrastRatio:()=>f,getLuminance:()=>d,hexToRgb:()=>o,hslToRgb:()=>c,lighten:()=>a,recomposeColor:()=>l,rgbToHex:()=>r});var t=e(84140);function n(v,E=0,D=1){return Math.min(Math.max(E,v),D)}function o(v){v=v.slice(1);const E=new RegExp(`.{1,${v.length>=6?2:1}}`,"g");let D=v.match(E);if(!D)return"";let b=Array.from(D);return b[0].length===1&&(b=b.map(C=>C+C)),b?`rgb${b.length===4?"a":""}(${b.map((C,y)=>y<3?parseInt(C,16):Math.round(parseInt(C,16)/255*1e3)/1e3).join(", ")})`:""}function s(v){const E=v.toString(16);return E.length===1?`0${E}`:E}function r(v){if(v.indexOf("#")===0)return v;const{values:E}=i(v);return`#${E.map(D=>s(D)).join("")}`}function g(v){if(v[0]==="#")return v;const E=(0,t.A)(v);return E.getAlpha()===1?E.toHexString():E.toHex8String()}function u(v){return v.startsWith("rgb")?v:(0,t.A)(v).toRgbString()}function c(v){const E=i(v),{values:D}=E,b=D[0],C=D[1]/100,y=D[2]/100,M=C*Math.min(y,1-y),T=(S,O=(S+b/30)%12)=>y-M*Math.max(Math.min(O-3,9-O,1),-1);let I="rgb";const x=[Math.round(T(0)*255),Math.round(T(8)*255),Math.round(T(4)*255)];return E.type==="hsla"&&(I+="a",x.push(D[3])),l({type:I,values:x})}function i(v){if(typeof v!="string")return v;if(v.charAt(0)==="#")return i(o(v));const E=v.indexOf("("),D=v.substring(0,E);if(["rgb","rgba","hsl","hsla","color"].indexOf(D)===-1)throw new Error(`Unsupported '${v}' color. The following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color()`);let b=v.substring(E+1,v.length-1),C;if(D==="color"){if(b=b.split(" "),C=b.shift(),b.length===4&&b[3].charAt(0)==="/"&&(b[3]=b[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 b=b.split(",");return b=b.map(y=>parseFloat(y)),{type:D,values:b,colorSpace:C}}function l(v){const{type:E,colorSpace:D}=v;let b=v.values;return E.indexOf("rgb")!==-1?b=b.map((C,y)=>y<3?parseInt(C,10):C):E.indexOf("hsl")!==-1&&(b[1]=`${b[1]}%`,b[2]=`${b[2]}%`),E.indexOf("color")!==-1?b=`${D} ${b.join(" ")}`:b=`${b.join(", ")}`,`${E}(${b})`}function f(v,E,D){const b=d(v),C=d(E,D);return(Math.max(b,C)+.05)/(Math.min(b,C)+.05)}function d(v,E){const D=i(v);let b=D.type==="hsl"?i(c(v)).values:D.values;if(E&&D.type==="rgba"){const y=i(E),M=b[3];b[0]=b[0]*M+y.values[0]*(1-M),b[1]=b[1]*M+y.values[1]*(1-M),b[2]=b[2]*M+y.values[2]*(1-M)}const C=b.map(y=>(D.type!=="color"&&(y/=255),y<=.03928?y/12.92:((y+.055)/1.055)**2.4));return Number((.2126*C[0]+.7152*C[1]+.0722*C[2]).toFixed(3))}function h(v,E=.15){return d(v)>.5?m(v,E):a(v,E)}function p(v,E){if(v==="")return"#000000";if(E=n(E),v[0]==="#"){if(v.length===9)v=v.substring(0,7);else if(v.length<=5){let b="#";for(let C=1;C<4;C++)b+=v[C]+v[C];v=b}return v+Math.round(E*255).toString(16).padStart(2,"0")}else{if(v[3]==="(")return v.replace(")",`, ${E})`);if(v[4]==="(")return v.substring(0,v.lastIndexOf(","))+`, ${E})`}const D=i(v);return D.type==="color"?D.values[3]=`/${E}`:D.values[3]=E,l(D)}function m(v,E){const D=i(v);if(E=n(E),D.type.indexOf("hsl")!==-1)D.values[2]*=1-E;else if(D.type.indexOf("rgb")!==-1||D.type.indexOf("color")!==-1)for(let b=0;b<3;b+=1)D.values[b]*=1-E;return l(D)}function a(v,E){const D=i(v);if(E=n(E),D.type.indexOf("hsl")!==-1)D.values[2]+=(100-D.values[2])*E;else if(D.type.indexOf("rgb")!==-1)for(let b=0;b<3;b+=1)D.values[b]+=(255-D.values[b])*E;else if(D.type.indexOf("color")!==-1)for(let b=0;b<3;b+=1)D.values[b]+=(1-D.values[b])*E;return l(D)}},60578:(Q,A,e)=>{"use strict";e.d(A,{D:()=>o});var t=e(96540),n=e(47696);const o=t.createContext((0,n.a)());o.displayName="ThemeContext"},47696:(Q,A,e)=>{"use strict";e.d(A,{a:()=>R});function t(){const H=["xs","sm","md","lg","xl","xxl"],w="px",N={xs:0,sm:544,md:769,lg:992,xl:1200,xxl:1440};function V(_){return`@media (min-width:${typeof _=="number"?_:N[_]}${w})`}function G(_){return`@media (max-width:${(typeof _=="number"?_:N[_])-5/100}${w})`}return{values:N,up:V,down:G,keys:H,unit:w}}var n=e(2543),o=e(23596);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 u(B){const H=new r,w=new g,N=(B.mode??"dark")==="dark"?H:w,{primary:V=N.primary,secondary:G=N.secondary,info:_=N.info,warning:K=N.warning,success:j=N.success,error:k=N.error,tonalOffset:Y=N.tonalOffset,hoverFactor:ee=N.hoverFactor,contrastThreshold:re=N.contrastThreshold,...J}=B;function ne(te,oe=re){return(0,o.getContrastRatio)(H.text.maxContrast,te,N.background.primary)>=oe?H.text.maxContrast:w.text.maxContrast}const q=({color:te,name:oe})=>{if(te={...te,name:oe},!te.main)throw new Error(`Missing main color for ${oe}`);return te.text||(te.text=te.main),te.border||(te.border=te.text),te.shade||(te.shade=N.mode==="light"?(0,o.darken)(te.main,Y):(0,o.lighten)(te.main,Y)),te.transparent||(te.transparent=(0,o.alpha)(te.main,.15)),te.contrastText||(te.contrastText=ne(te.main)),te.borderTransparent||(te.borderTransparent=(0,o.alpha)(te.border,.25)),te};return(0,n.merge)({...N,primary:q({color:V,name:"primary"}),secondary:q({color:G,name:"secondary"}),info:q({color:_,name:"info"}),error:q({color:k,name:"error"}),success:q({color:j,name:"success"}),warning:q({color:K,name:"warning"}),getContrastText:ne,emphasize:(te,oe)=>(0,o.emphasize)(te,oe??ee)},J)}function c(B,H){const w={padding:1,headerHeight:4,background:B.background.primary,borderColor:B.border.weak,boxShadow:"none"},N={borderColor:B.border.medium,borderHover:B.border.strong,text:B.text.primary,background:B.mode==="dark"?B.background.canvas:B.background.primary};return{height:{sm:3,md:4,lg:6},input:N,panel:w,dropdown:{background:N.background},tooltip:{background:B.background.secondary,text:B.text.primary},dashboard:{background:B.background.canvas,padding:1},overlay:{background:B.mode==="dark"?"rgba(63, 62, 62, 0.45)":"rgba(208, 209, 211, 0.24)"},sidemenu:{width:57},menuTabs:{height:42},textHighlight:{text:B.warning.contrastText,background:B.warning.main},horizontalDrawer:{defaultHeight:400},table:{rowHoverBackground:B.emphasize(B.background.primary,.03)}}}function i(B){return B.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 l(B){const H=B.borderRadius??2;return{radius:{default:"2px",pill:"9999px",circle:"100%"},borderRadius:V=>`${(V??1)*H}px`}}function f(B={}){const{gridSize:H=8}=B,w=V=>typeof V=="string"?V:V*H,N=(...V)=>(V.length===0&&(V[0]=1),V.map(G=>{const _=w(G);return typeof _=="number"?`${_}px`:_}).join(" "));return N.gridSize=H,N.x0="0px",N.x0_25="2px",N.x0_5="4px",N.x1="8px",N.x1_5="12px",N.x2="16px",N.x2_5="20px",N.x3="24px",N.x4="32px",N.x5="40px",N.x6="48px",N.x8="64px",N.x10="80px",N}const d={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)"},h={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function p(B=["all"],H={}){const{duration:w=h.standard,easing:N=d.easeInOut,delay:V=0}=H;return(Array.isArray(B)?B:[B]).map(G=>`${G} ${typeof w=="string"?w:a(w)} ${N} ${typeof V=="string"?V:a(V)}`).join(",")}function m(B){if(!B)return 0;const H=B/36;return Math.round((4+15*H**.25+H/5)*10)}function a(B){return`${Math.round(B)}ms`}function v(){return{create:p,duration:h,easing:d,getAutoHeightDuration:m}}const E='"Inter", "Helvetica", "Arial", sans-serif',D="'Roboto Mono', monospace";function b(B,H={}){const{fontFamily:w=E,fontFamilyMonospace:N=D,fontSize:V=14,fontWeightLight:G=300,fontWeightRegular:_=400,fontWeightMedium:K=500,fontWeightBold:j=500,htmlFontSize:k=14}=H,Y=V/14,ee=q=>`${q/k*Y}rem`,re=(q,te,oe,ue,ie)=>{if(oe%2!==0||te%2!==0)throw new Error("Font size and line height should be integer multiples of 2 to prevent issues with alignment");return{fontFamily:w,fontWeight:q,fontSize:ee(te),lineHeight:oe/te,...w===E?{letterSpacing:`${C(ue/te)}em`}:{},...ie}},J={h1:re(_,28,32,-.25),h2:re(_,24,28,0),h3:re(_,22,24,0),h4:re(_,18,22,.25),h5:re(_,16,22,0),h6:re(K,14,22,.15),body:re(_,V,22,.15),bodySmall:re(_,12,18,.15)};return{htmlFontSize:k,pxToRem:ee,fontFamily:w,fontFamilyMonospace:N,fontSize:V,fontWeightLight:G,fontWeightRegular:_,fontWeightMedium:K,fontWeightBold:j,size:{base:"14px",xs:"10px",sm:"12px",md:"14px",lg:"18px"},...J}}function C(B){return Math.round(B*1e5)/1e5}var y=e(25137);function M(B){const H={name:"Grafana Default",typography:{fontFamily:{sansSerif:B.typography.fontFamily,monospace:B.typography.fontFamilyMonospace},size:{base:`${B.typography.fontSize}px`,xs:B.typography.size.xs,sm:B.typography.size.sm,md:B.typography.size.md,lg:B.typography.size.lg},heading:{h1:B.typography.h1.fontSize,h2:B.typography.h2.fontSize,h3:B.typography.h3.fontSize,h4:B.typography.h4.fontSize,h5:B.typography.h5.fontSize,h6:B.typography.h6.fontSize},weight:{light:B.typography.fontWeightLight,regular:B.typography.fontWeightRegular,semibold:B.typography.fontWeightMedium,bold:B.typography.fontWeightBold},lineHeight:{xs:B.typography.bodySmall.lineHeight,sm:B.typography.bodySmall.lineHeight,md:B.typography.body.lineHeight,lg:B.typography.h2.lineHeight},link:{decoration:"none",hoverDecoration:"none"}},breakpoints:{xs:`${B.breakpoints.values.xs}px`,sm:`${B.breakpoints.values.sm}px`,md:`${B.breakpoints.values.md}px`,lg:`${B.breakpoints.values.lg}px`,xl:`${B.breakpoints.values.xl}px`,xxl:`${B.breakpoints.values.xxl}px`},spacing:{base:B.spacing.gridSize,insetSquishMd:B.spacing(.5,1),d:B.spacing(2),xxs:B.spacing(.25),xs:B.spacing(.5),sm:B.spacing(1),md:B.spacing(2),lg:B.spacing(3),xl:B.spacing(4),gutter:B.spacing(4),formSpacingBase:B.spacing.gridSize,formMargin:`${B.spacing.gridSize*4}px`,formFieldsetMargin:`${B.spacing.gridSize*2}px`,formInputHeight:B.spacing.gridSize*4,formButtonHeight:B.spacing.gridSize*4,formInputPaddingHorizontal:`${B.spacing.gridSize}px`,formInputAffixPaddingHorizontal:`${B.spacing.gridSize/2}px`,formInputMargin:`${B.spacing.gridSize*2}px`,formLabelPadding:"0 0 0 2px",formLabelMargin:`0 0 ${B.spacing.gridSize/2+"px"} 0`,formValidationMessagePadding:"4px 8px",formValidationMessageMargin:"4px 0 0 0",inlineFormMargin:"4px"},border:{radius:{sm:B.shape.borderRadius(1),md:B.shape.borderRadius(2),lg:B.shape.borderRadius(3)},width:{sm:"1px"}},height:{sm:B.spacing.gridSize*B.components.height.sm,md:B.spacing.gridSize*B.components.height.md,lg:B.spacing.gridSize*B.components.height.lg},panelPadding:B.components.panel.padding*B.spacing.gridSize,panelHeaderHeight:B.spacing.gridSize*B.components.panel.headerHeight,zIndex:B.zIndex},w={...T,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"},N={bg1:B.colors.background.primary,bg2:B.colors.background.secondary,bg3:B.colors.action.hover,dashboardBg:B.colors.background.canvas,bgBlue1:B.colors.primary.main,bgBlue2:B.colors.primary.shade},V={border1:B.colors.border.weak,border2:B.colors.border.medium,border3:B.colors.border.strong},G={textStrong:B.colors.text.maxContrast,textHeading:B.colors.text.primary,text:B.colors.text.primary,textSemiWeak:B.colors.text.secondary,textWeak:B.colors.text.secondary,textFaint:B.colors.text.disabled,textBlue:B.colors.primary.text},_={formLabel:B.colors.text.primary,formDescription:B.colors.text.secondary,formInputBg:B.components.input.background,formInputBgDisabled:B.colors.action.disabledBackground,formInputBorder:B.components.input.borderColor,formInputBorderHover:B.components.input.borderHover,formInputBorderActive:B.colors.primary.border,formInputBorderInvalid:B.colors.error.border,formInputPlaceholderText:B.colors.text.disabled,formInputText:B.components.input.text,formInputDisabledText:B.colors.action.disabledText,formFocusOutline:B.colors.primary.main,formValidationMessageText:B.colors.error.contrastText,formValidationMessageBg:B.colors.error.main};return{...H,type:B.colors.mode==="dark"?y.I.Dark:y.I.Light,isDark:B.isDark,isLight:B.isLight,name:B.name,palette:{...w,brandPrimary:w.orange,brandSuccess:B.colors.success.main,brandWarning:B.colors.warning.main,brandDanger:B.colors.error.main,queryRed:B.colors.error.text,queryGreen:B.colors.success.text,queryPurple:"#fe85fc",queryOrange:w.orange,online:B.colors.success.main,warn:B.colors.success.main,critical:B.colors.success.main},colors:{...N,...V,..._,...G,bodyBg:B.colors.background.canvas,panelBg:B.components.panel.background,panelBorder:B.components.panel.borderColor,pageHeaderBg:B.colors.background.canvas,pageHeaderBorder:B.colors.background.canvas,dropdownBg:_.formInputBg,dropdownShadow:w.black,dropdownOptionHoverBg:N.bg2,link:B.colors.text.primary,linkDisabled:B.colors.text.disabled,linkHover:B.colors.text.maxContrast,linkExternal:B.colors.text.link},shadows:{listItem:"none"},visualization:B.visualization}}const T={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 I=e(24293);function x(B){const H=B.mode==="light"?O():S(),w={};for(const G of H)for(const _ of G.shades)if(w[_.name]=_.color,_.aliases)for(const K of _.aliases)w[K]=_.color;w.transparent="rgba(0,0,0,0)",w["panel-bg"]=B.background.primary,w.text=B.text.primary;const N=G=>{if(!G)return I.F;const _=w[G];if(_)return _;if(G[0]==="#"||G.indexOf("rgb")>-1)return G;const K=L[G.toLowerCase()];return K?(w[G]=K,K):G},V=P();return{hues:H,palette:V,getColorByName:N}}function S(){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 P(){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 L={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"};var U=e(67255);function R(B={}){const{colors:H={},spacing:w={},shape:N={},typography:V={}}=B,G=u(H),_=t(),K=f(w),j=l(N),k=b(G,V),Y=i(G),ee=v(),re=c(G,Y),J=x(G),ne={name:G.mode==="dark"?"Dark":"Light",isDark:G.mode==="dark",isLight:G.mode==="light",colors:G,breakpoints:_,spacing:K,shape:j,components:re,typography:k,shadows:Y,transitions:ee,visualization:J,zIndex:{...U.f},flags:{}};return{...ne,v1:M(ne)}}},74529:(Q,A,e)=>{"use strict";e.d(A,{Dx:()=>s.D,MV:()=>o,an:()=>t.a,gh:()=>n.g,k7:()=>n.k});var t=e(47696),n=e(97594),o=e(23596),s=e(60578)},97594:(Q,A,e)=>{"use strict";e.d(A,{g:()=>o,k:()=>s});var t=e(83077),n=e(47696);function o(i){return(r.getIfExists(i)??r.get("dark")).build()}function s(i){return r.list().filter(l=>i?!0:!l.isExtra)}const r=new t.O(()=>[{id:"system",name:"System preference",build:g},{id:"dark",name:"Dark",build:()=>(0,n.a)({colors:{mode:"dark"}})},{id:"light",name:"Light",build:()=>(0,n.a)({colors:{mode:"light"}})},{id:"blue-night",name:"Blue night",build:c,isExtra:!0},{id:"midnight",name:"Midnight",build:u,isExtra:!0}]);function g(){const l=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";return o(l)}function u(){const i="204, 204, 220";return(0,n.a)({name:"Midnight",colors:{mode:"dark",background:{canvas:"#000000",primary:"#000000",secondary:"#181818"},border:{weak:`rgba(${i}, 0.17)`,medium:`rgba(${i}, 0.25)`,strong:`rgba(${i}, 0.35)`}}})}function c(){return(0,n.a)({name:"Blue night",colors:{mode:"dark",background:{canvas:"#15161d",primary:"#15161d",secondary:"#1d1f2e"},border:{weak:"#2e304f",medium:"#2e304f",strong:"#2e304f"}}})}},67255:(Q,A,e)=>{"use strict";e.d(A,{f:()=>t});const t={activePanel:999,navbarFixed:1e3,sidemenu:1020,dropdown:1030,typeahead:1030,tooltip:1040,modalBackdrop:1050,modal:1060,portal:1061}},75059:(Q,A,e)=>{"use strict";e.d(A,{AS:()=>i,C6:()=>l,Em:()=>u,H3:()=>f,Nw:()=>c,gy:()=>g});var t=e(2543),n=e.n(t),o=e(39070),s=e(11261),r=e(83077),g=(D=>(D.sum="sum",D.max="max",D.min="min",D.logmin="logmin",D.mean="mean",D.variance="variance",D.stdDev="stdDev",D.last="last",D.first="first",D.count="count",D.range="range",D.diff="diff",D.diffperc="diffperc",D.delta="delta",D.step="step",D.firstNotNull="firstNotNull",D.lastNotNull="lastNotNull",D.changeCount="changeCount",D.distinctCount="distinctCount",D.allIsZero="allIsZero",D.allIsNull="allIsNull",D.allValues="allValues",D.uniqueValues="uniqueValues",D))(g||{});function u(D){return Object.keys(g).includes(D)}function c(D){const{field:b,reducers:C}=D;if(!b||!C||C.length<1)return{};if(b.state?.calcs){const O=[];for(const P of C)b.state.calcs.hasOwnProperty(P)||O.push(P);if(O.length<1)return{...b.state.calcs}}b.state||(b.state={});const y=i.list(C),M=b.values;if(M&&M.length<1){const O={...b.state.calcs};for(const P of y)O[P.id]=P.emptyInputResult!==null?P.emptyInputResult:null;return b.state.calcs=O}const{nullValueMode:T=o.UW.Ignore}=b.config,I=T===o.UW.Ignore,x=T===o.UW.AsZero;if(y.length===1&&y[0].reduce){const O=y[0].reduce(b,I,x);return b.state.calcs={...b.state.calcs,...O},O}let S=f(b,I,x);for(const O of y)!S.hasOwnProperty(O.id)&&O.reduce&&(S={...S,...O.reduce(b,I,x)});return b.state.calcs={...b.state.calcs,...S},S}const i=new r.O(()=>[{id:"lastNotNull",name:"Last *",description:"Last non-null value (also excludes NaNs)",standard:!0,aliasIds:["current"],reduce:m},{id:"last",name:"Last",description:"Last value",standard:!0,reduce:p},{id:"firstNotNull",name:"First *",description:"First non-null value (also excludes NaNs)",standard:!0,reduce:h},{id:"first",name:"First",description:"First Value",standard:!0,reduce:d},{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:a},{id:"stdDev",name:"StdDev",description:"Standard deviation of all values in a field",standard:!1,reduce:a},{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:v},{id:"distinctCount",name:"Distinct Count",description:"Number of distinct values",standard:!1,reduce:E},{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:D=>({allValues:[...D.values]})},{id:"uniqueValues",name:"All unique values",description:"Returns an array with all unique values",standard:!1,reduce:D=>({uniqueValues:[...new Set(D.values)]})}]),l={sum:0,max:-Number.MAX_VALUE,min:Number.MAX_VALUE,logmin:Number.MAX_VALUE,mean:null,last:null,first:null,lastNotNull:null,firstNotNull:null,count:0,nonNullCount:0,allIsNull:!0,allIsZero:!0,range:null,diff:null,delta:0,step:Number.MAX_VALUE,diffperc:0,previousDeltaUp:!0};function f(D,b,C){const y={...l},M=D.values;if(!M)return y;const T=D.type===s.PU.number||D.type===s.PU.time;for(let I=0;I<M.length;I++){let x=M[I];if(I===0&&(y.first=x),y.last=x,x==null){if(b)continue;C&&(x=0)}if(y.count++,x!=null&&!Number.isNaN(x)){const S=y.firstNotNull===null;if(S&&(y.firstNotNull=x),T){if(y.sum+=x,y.allIsNull=!1,y.nonNullCount++,!S){const O=x-y.lastNotNull;y.step>O&&(y.step=O),y.lastNotNull>x?(y.previousDeltaUp=!1,I===M.length-1&&(y.delta+=x)):(y.previousDeltaUp?y.delta+=O:y.delta+=x,y.previousDeltaUp=!0)}x>y.max&&(y.max=x),x<y.min&&(y.min=x),x<y.logmin&&x>0&&(y.logmin=x)}x!==0&&(y.allIsZero=!1),y.lastNotNull=x}}return y.max===-Number.MAX_VALUE&&(y.max=null),y.min===Number.MAX_VALUE&&(y.min=null),y.step===Number.MAX_VALUE&&(y.step=null),y.nonNullCount>0&&(y.mean=y.sum/y.nonNullCount),y.allIsNull&&(y.allIsZero=!1),y.max!==null&&y.min!==null&&(y.range=y.max-y.min),(0,t.isNumber)(y.firstNotNull)&&(0,t.isNumber)(y.lastNotNull)&&(y.diff=y.lastNotNull-y.firstNotNull),(0,t.isNumber)(y.firstNotNull)&&(0,t.isNumber)(y.diff)&&(y.diffperc=y.diff/y.firstNotNull),y}function d(D,b,C){return{first:D.values[0]}}function h(D,b,C){const y=D.values;for(let M=0;M<y.length;M++){const T=y[M];if(T!=null&&!Number.isNaN(T))return{firstNotNull:T}}return{firstNotNull:null}}function p(D,b,C){const y=D.values;return{last:y[y.length-1]}}function m(D,b,C){const y=D.values;let M=y.length-1;for(;M>=0;){const T=y[M--];if(T!=null&&!Number.isNaN(T))return{lastNotNull:T}}return{lastNotNull:null}}function a(D,b,C){if(!(D.type===s.PU.number||D.type===s.PU.time))return{variance:0,stdDev:0};let y=0,M=0,T=0;const I=D.values;for(let x=0;x<I.length;x++){const S=I[x];if(S!=null){T++;let O=M;M+=(S-O)/T,y+=(S-O)*(S-M)}}if(T>0){const x=y/T;return{variance:x,stdDev:Math.sqrt(x)}}return{variance:0,stdDev:0}}function v(D,b,C){const y=D.values;let M=0,T=!0,I=null;for(let x=0;x<y.length;x++){let S=y[x];if(S===null){if(b)continue;C&&(S=0)}!T&&I!==S&&M++,T=!1,I=S}return{changeCount:M}}function E(D,b,C){const y=D.values,M=new Set;for(let T=0;T<y.length;T++){let I=y[T];if(I===null){if(b)continue;C&&(I=0)}M.add(I)}return{distinctCount:M.size}}},34687:(Q,A,e)=>{"use strict";e.d(A,{AS:()=>r.AS,C6:()=>r.C6,CF:()=>h.C,Ct:()=>t.Ct,Dq:()=>o.Dq,Em:()=>r.Em,Fy:()=>n.F,H1:()=>l.H1,H3:()=>r.H3,Js:()=>t.Js,KP:()=>i.Fd,MS:()=>d.M,NS:()=>o.NS,NX:()=>l.NX,Nw:()=>r.Nw,OA:()=>l.OA,PP:()=>c.PP,RE:()=>o.RE,Rt:()=>l.Rt,Uh:()=>l.Uh,ZU:()=>l.ZU,c9:()=>s.c,cV:()=>t.cV,cg:()=>l.cg,d$:()=>l.d$,dA:()=>l.dA,g2:()=>i.g2,gy:()=>r.gy,h9:()=>u.h,hI:()=>o.hI,ix:()=>l.ix,jR:()=>t.jR,kK:()=>o.kK,ks:()=>f.ks,m6:()=>g.m,m_:()=>u.m,p3:()=>l.p3,rW:()=>l.rW,rs:()=>l.rs,sJ:()=>o.sJ});var t=e(1173),n=e(18282),o=e(85200),s=e(57934),r=e(75059),g=e(2514),u=e(97497),c=e(58972),i=e(73060),l=e(77678),f=e(50311),d=e(46294),h=e(39624)},85200:(Q,A,e)=>{"use strict";e.d(A,{Dq:()=>v,NS:()=>a,RE:()=>p,hI:()=>m,kK:()=>E,sJ:()=>h});var t=e(83077),n=e(7029),o=e(24814),s=e(58972),r=e(72693),g=e(8549),u=e(83855),c=e(60005),i=e(21262),l=e(70218),f=e(55008),d=e(16378);const h=new t.O(()=>[...(0,r.nz)(),...(0,n._)(),...(0,s.P7)(),...(0,u.W)(),o.u]),p=new t.O(()=>[...(0,r.UM)(),...(0,s.Y7)(),...(0,g.i)()]),m=new t.O(()=>[...(0,i._)(),...(0,l.E)(),...(0,c.d)(),...(0,f.G)(),...(0,d.z)()]);function a(D){const b=h.get(D.id);if(!b)throw new Error("Unknown field matcher: "+D.id);return b.get(D.options)}function v(D){const b=p.get(D.id);if(!b)throw new Error("Unknown frame matcher: "+D.id);return b.get(D.options)}function E(D){const b=m.get(D.id);if(!b)throw new Error("Unknown value matcher: "+D.id);return b.get(D.options)}},58972:(Q,A,e)=>{"use strict";e.d(A,{P7:()=>p,PP:()=>r,Y7:()=>m});var t=e(28240),n=e(54479),o=e(11261),s=e(1173),r=(a=>(a.exclude="exclude",a.include="include",a))(r||{});const g={id:s.Ct.byName,name:"Field Name",description:"match the field name",defaultOptions:"",get:a=>{const E=c(new Set([a]));return(D,b,C)=>a===D.name||a===(0,t.Ct)(D,b,C)||!!(E&&E(D,b,C))},getOptionsDisplayText:a=>`Field name: ${a}`},u={id:s.Ct.byNames,name:"Field Names",description:"match any of the given the field names",defaultOptions:{mode:"include",names:[]},get:a=>{const{names:v,mode:E="include"}=a,D=new Set(v??[]),b=c(D),C=(y,M,T)=>D.has(y.name)||D.has((0,t.Ct)(y,M,T))||!!(b&&b(y,M,T));return E==="exclude"?(y,M,T)=>!C(y,M,T):C},getOptionsDisplayText:a=>{const{names:v,mode:E}=a,D=(v??[]).join(", ");return E==="exclude"?`All except: ${D}`:`All of: ${D}`}};function c(a){let v;return window?.grafanaBootData?.settings?.featureToggles?.dataplaneFrontendFallback&&(a.has(o.Bc)?v=(D,b)=>!!D.labels&&D.labels?.__name__===D.name:(a.has("Time")||a.has("time"))&&(v=(D,b)=>b.meta?.typeVersion==null&&D.type===o.PU.time)),v}const i={id:s.Ct.byRegexp,name:"Field Name by Regexp",description:"match the field name by a given regexp pattern",defaultOptions:"/.*/",get:a=>{const v=d(a);return(E,D,b)=>{const C=(0,t.Ct)(E,D,b);return!!v&&v.test(C)}},getOptionsDisplayText:a=>`Field name by pattern: ${a}`},l={id:s.Ct.byFrameRefID,name:"Fields by frame refId",description:"match all fields returned in data frame with refId.",defaultOptions:"",get:a=>(v,E,D)=>E.refId===a,getOptionsDisplayText:a=>`Math all fields returned by query with reference ID: ${a}`},f={id:s.Ct.byRegexpOrNames,name:"Field Name by Regexp or Names",description:"match the field name by a given regexp pattern or given names",defaultOptions:{pattern:"/.*/",names:[]},get:a=>{const v=i.get(a?.pattern||""),E=u.get({mode:"include",names:a?.names??[]});return(D,b,C)=>E(D,b,C)||v(D,b,C)},getOptionsDisplayText:a=>{const v=a?.pattern??"",E=a?.names?.join(",")??"";return`Field name by pattern: ${v} or names: ${E}`}},d=a=>{if(a)try{return(0,n.dO)(a)}catch(v){console.error(v);return}},h={id:s.jR.byName,name:"Frame Name",description:"match the frame name",defaultOptions:"/.*/",get:a=>{const v=(0,n.dO)(a);return E=>v.test(E.name||"")},getOptionsDisplayText:a=>`Frame name: ${a}`};function p(){return[g,i,u,f,l]}function m(){return[h]}},72693:(Q,A,e)=>{"use strict";e.d(A,{UM:()=>b,Yg:()=>l,nz:()=>D,zx:()=>h});var t=e(11261),n=e(85200),o=e(1173);const s={id:o.cV.anyMatch,name:"Any",description:"Any child matches (OR)",excludeFromPicker:!0,defaultOptions:[],get:C=>{const y=C.map(M=>(0,n.NS)(M));return(M,T,I)=>{for(const x of y)if(x(M,T,I))return!0;return!1}},getOptionsDisplayText:C=>{let y="";for(const M of C){y.length>0&&(y+=" OR ");const T=n.sJ.get(M.id);y+=T.getOptionsDisplayText?T.getOptionsDisplayText(M):T.name}return y}},r={id:o.cV.anyMatch,name:"Any",description:"Any child matches (OR)",excludeFromPicker:!0,defaultOptions:[],get:C=>{const y=C.map(M=>(0,n.Dq)(M));return M=>{for(const T of y)if(T(M))return!0;return!1}},getOptionsDisplayText:C=>{let y="";for(const M of C){y.length>0&&(y+=" OR ");const T=n.RE.get(M.id);y+=T.getOptionsDisplayText?T.getOptionsDisplayText(M):T.name}return y}},g={id:o.cV.allMatch,name:"All",description:"Everything matches (AND)",excludeFromPicker:!0,defaultOptions:[],get:C=>{const y=C.map(M=>(0,n.NS)(M));return(M,T,I)=>{for(const x of y)if(!x(M,T,I))return!1;return!0}},getOptionsDisplayText:C=>{let y="";for(const M of C){y.length>0&&(y+=" AND ");const T=n.sJ.get(M.id);y+=T.getOptionsDisplayText?T.getOptionsDisplayText(M):T.name}return y}},u={id:o.cV.allMatch,name:"All",description:"Everything matches (AND)",excludeFromPicker:!0,defaultOptions:[],get:C=>{const y=C.map(M=>(0,n.Dq)(M));return M=>{for(const T of y)if(!T(M))return!1;return!0}},getOptionsDisplayText:C=>{let y="";for(const M of C){y.length>0&&(y+=" AND ");const T=n.RE.get(M.id);y+=T.getOptionsDisplayText?T.getOptionsDisplayText(M):T.name}return y}},c={id:o.cV.invertMatch,name:"NOT",description:"Inverts other matchers",excludeFromPicker:!0,get:C=>{const y=(0,n.NS)(C);return(M,T,I)=>!y(M,T,I)},getOptionsDisplayText:C=>{const y=n.sJ.get(C.id);return"NOT "+(y.getOptionsDisplayText?y.getOptionsDisplayText(C.options):y.name)}},i={id:o.cV.invertMatch,name:"NOT",description:"Inverts other matchers",excludeFromPicker:!0,get:C=>{const y=(0,n.Dq)(C);return M=>!y(M)},getOptionsDisplayText:C=>{const y=n.RE.get(C.id);return"NOT "+(y.getOptionsDisplayText?y.getOptionsDisplayText(C.options):y.name)}},l=C=>!0,f=C=>!0,d=C=>!1,h=C=>C.type!==t.PU.time,p=C=>!1,m={id:o.cV.alwaysMatch,name:"All Fields",description:"Always Match",get:C=>l,getOptionsDisplayText:C=>"Always"},a={id:o.cV.alwaysMatch,name:"All Frames",description:"Always Match",get:C=>f,getOptionsDisplayText:C=>"Always"},v={id:o.cV.neverMatch,name:"No Fields",description:"Never Match",excludeFromPicker:!0,get:C=>d,getOptionsDisplayText:C=>"Never"},E={id:o.cV.neverMatch,name:"No Frames",description:"Never Match",get:C=>p,getOptionsDisplayText:C=>"Never"};function D(){return[s,g,c,m,v]}function b(){return[r,u,i,a,E]}},97497:(Q,A,e)=>{"use strict";e.d(A,{h:()=>o,m:()=>n});var t=e(83077),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 o=new t.O},2514:(Q,A,e)=>{"use strict";e.d(A,{m:()=>i});var t=e(62467),n=e(69862),o=e(81160),s=e(85200),r=e(97497);const g=(f,d)=>h=>{const p=r.h.get(f.id);if(!p)return h;const a={...p.transformation.defaultOptions??{},...f.options},v=f.filter?.options?(0,s.Dq)(f.filter):void 0;return h.pipe((0,n.Z)(E=>(0,t.of)(u(E,v)).pipe(p.transformation.operator(a,d),c(E,p,v))))};function u(f,d){return d?f.filter(h=>d(h)):f}const c=(f,d,h)=>p=>p.pipe((0,o.T)(m=>{if(m===f)return m;if(h){let a=0;const v=f.filter((E,D)=>{const b=!h(E);return b&&!a&&(a=D),b});v.length&&m.splice(a,0,...v)}return m}));function i(f,d,h){const p=(0,t.of)(d);if(!f.length)return p;const m=[],a=h??{interpolate:v=>v};for(let v=0;v<f.length;v++){const E=f[v];if(l(E))m.push(E(a));else{if(E.disabled)continue;m.push(g(E,a))}}return p.pipe.apply(p,m)}function l(f){return typeof f=="function"}},57934:(Q,A,e)=>{"use strict";e.d(A,{c:()=>pe});var t=e(66350),n=e(82150),o=e(50311),s=e(34125),r=e(64224),g=e(35602),u=e(1173),c=e(18282);const i={id:c.F.filterByRefId,name:"Filter data by query refId",description:"select a subset of results",defaultOptions:{},operator:(le,Te)=>Ee=>{const Re={};return le.include&&(Re.include={id:u.jR.byRefId,options:le.include}),le.exclude&&(Re.exclude={id:u.jR.byRefId,options:le.exclude}),Ee.pipe(r.I.operator(Re,Te))}};var l=e(73376),f=e(15400),d=e(81160),h=e(81010);const p={id:c.F.formatTime,name:"Format time",description:"Set the output format of a time field",defaultOptions:{timeField:"",outputFormat:"",useTimezone:!0},isApplicable:le=>{for(const Te of le)for(const Ee of Te.fields)if(Ee.type==="time")return h.M.Applicable;return h.M.NotApplicable},isApplicableDescription:"The Format time transformation requires a time field to work. No time field could be found.",operator:le=>Te=>Te.pipe((0,d.T)(Ee=>{const Re=m(le.timeField,le.outputFormat,le.timezone);return!Array.isArray(Ee)||Ee.length===0?Ee:Ee.map(me=>({...me,fields:Re(me.fields)}))}))},m=(le,Te,Ee)=>Re=>Re.map(me=>{if(me.name===le){let Me=null;return Ee?Me=(0,o.Xv)(me,Te,{timeZone:Ee}):Me=(0,o.Xv)(me,Te),Me}return me});var a=e(25094),v=e(68133),E=e(28240),D=e(11261),b=e(85200);const C="Time",y="Time",M="Value",T=h.N.Empty,I=window?.grafanaBootData?.settings?.featureToggles?.dataplaneFrontendFallback,x={id:c.F.groupingToMatrix,name:"Grouping to Matrix",description:"Groups series by field and return a matrix visualisation",defaultOptions:{columnField:C,rowField:y,valueField:M},isApplicable:le=>{let Te=0;for(const Ee of le)Te+=Ee.fields.length;return Te>=3?h.M.Applicable:h.M.NotApplicable},isApplicableDescription:le=>{let Te=0;for(const Ee of le)Te+=Ee.fields.length;return`Grouping to matrix requiers at least 3 fields to work. Currently there are ${Te} fields.`},operator:le=>Te=>Te.pipe((0,d.T)(Ee=>{const Re=le.columnField||C,me=le.rowField||y,Me=le.valueField||M,ye=le.emptyValue||T;if(Ee.length!==1)return Ee;const Le=Ee[0],We=O(Le,Re),Be=O(Le,me),Ye=O(Le,Me),at=`${me}\\${Re}`;if(!We||!Be||!Ye)return Ee;const st=S(We.values),Ke=S(Be.values),Xe={};for(let Ge=0;Ge<Ye.values.length;Ge++){const xe=We.values[Ge],$e=Be.values[Ge],be=Ye.values[Ge];Xe[xe]||(Xe[xe]={}),Xe[xe][$e]=be}const He=[{name:at,values:Ke,type:D.PU.string,config:{}}];for(const Ge of st){let xe=[];for(const $e of Ke){const be=Xe[Ge][$e]??P(ye);xe.push(be)}I&&typeof Ge=="number"&&(Ye.config={...Ye.config,displayNameFromDS:void 0}),He.push({name:Ge.toString(),values:xe,config:Ye.config,type:Ye.type})}return[{fields:He,length:Ke.length}]}))};function S(le){const Te=new Set;for(let Ee=0;Ee<le.length;Ee++)Te.add(le[Ee]);return Array.from(Te)}function O(le,Te){for(let Ee=0;Ee<le.fields.length;Ee++){const Re=le.fields[Ee];let me;if(I?me=b.sJ.get(u.Ct.byName).get(Te)(Re,le,[le]):me=Te===(0,E.Ct)(Re),me)return Re}return null}function P(le){switch(le){case h.N.False:return!1;case h.N.True:return!0;case h.N.Null:return null;case h.N.Empty:default:return""}}var L=e(77678),U=e(41511),R=e(6829),B=e(67641);const H=10,w={id:c.F.limit,name:"Limit",description:"Limit the number of items to the top N",defaultOptions:{limitField:H},operator:(le,Te)=>Ee=>Ee.pipe((0,d.T)(Re=>{let me=H;return le.limitField!==void 0&&(typeof le.limitField=="string"?(0,B.w)()?me=parseInt(Te.interpolate(le.limitField),10):me=parseInt(le.limitField,10):me=le.limitField),Re.map(Me=>Me.length>me?{...Me,fields:Me.fields.map(ye=>({...ye,values:ye.values.slice(0,me)})),length:me}:Me)}))};var N=e(58140),V=e(64586),G=e(82280);const _={id:c.F.rename,name:"Rename fields by name",description:"Rename fields based on configuration given by user",defaultOptions:{renameByName:{}},operator:le=>Te=>Te.pipe((0,d.T)(Ee=>{const Re=K(le.renameByName);return!Array.isArray(Ee)||Ee.length===0?Ee:Ee.map(me=>({...me,fields:Re(me)}))}))},K=le=>Te=>!le||Object.keys(le).length===0?Te.fields:Te.fields.map(Ee=>{const Re=(0,E.Ct)(Ee,Te),me=le[Re];return typeof me!="string"||me.length===0?Ee:{...Ee,config:{...Ee.config,displayName:me},state:{...Ee.state,displayName:me}}}),j={id:c.F.organize,name:"Organize fields by name",description:"Order, filter and rename fields based on configuration given by user",defaultOptions:{excludeByName:{},indexByName:{},renameByName:{},includeByName:{}},isApplicable:le=>le.length>1?h.M.NotPossible:h.M.Applicable,operator:(le,Te)=>Ee=>Ee.pipe(g.D.operator({include:le.includeByName?{names:k(le.includeByName)}:void 0,exclude:{names:k(le.excludeByName)}},Te),G.x.operator(le,Te),_.operator(le,Te))},k=le=>le?Object.keys(le).filter(Te=>le[Te]):[];var Y=e(21128),ee=e(54479);const re={id:c.F.renameByRegex,name:"Rename fields by regex",description:"Rename fields based on regular expression by users.",defaultOptions:{regex:"(.*)",renamePattern:"$1"},operator:le=>Te=>Te.pipe((0,d.T)(Ee=>!Array.isArray(Ee)||Ee.length===0?Ee:Ee.map(J(le))))},J=le=>Te=>{const Ee=(0,ee.dO)(le.regex),Re=Te.fields.map(me=>{const Me=(0,E.Ct)(me,Te);if(!Ee.test(Me))return me;const ye=Me.replace(Ee,le.renamePattern);return{...me,config:{...me.config,displayName:ye},state:{...me.state,displayName:ye}}});return{...Te,fields:Re}};var ne=e(2543),q=e(37471),te=e(14236),oe=e(19845);const ue={id:c.F.seriesToRows,name:"Series to rows",description:"Combines multiple series into a single serie and appends a column with metric name per value.",defaultOptions:{},operator:le=>Te=>Te.pipe((0,d.T)(Ee=>{if(!Array.isArray(Ee)||Ee.length<=1||(Ee=Ee.filter(Le=>Le.length>0),!(0,oe.jq)(Ee)))return Ee;const Re={},me=new Set,Me=new q.k,ye={name:D.aI,values:[],config:{},type:D.PU.string};for(let Le=0;Le<Ee.length;Le++){const We=Ee[Le];for(let Be=0;Be<We.fields.length;Be++){const Ye=We.fields[Be];if(Ye.type===D.PU.time){Re[Le]=Be,me.has(D.LE)||(Me.addField(ie(Ye,D.LE)),Me.addField(ye),me.add(D.LE));continue}me.has(D.Bc)||(Me.addField(ie(Ye,D.Bc)),me.add(D.Bc))}}for(let Le=0;Le<Ee.length;Le++){const We=Ee[Le];for(let Be=0;Be<We.length;Be++){const Ye=Re[Le],at=Ye===0?1:0;Me.add({[D.LE]:We.fields[Ye].values[Be],[D.aI]:(0,E.Ri)(We),[D.Bc]:We.fields[at].values[Be]})}}return[(0,te.ES)(Me,0,!0)]}))},ie=(le,Te)=>({...(0,ne.omit)(le,["values","state","labels","config","name"]),name:Te,values:[],config:{...(0,ne.omit)(le.config,["displayName","displayNameFromDS"])}}),ge={id:c.F.sortBy,name:"Sort by",description:"Sort fields in a frame.",defaultOptions:{fields:{}},operator:(le,Te)=>Ee=>Ee.pipe((0,d.T)(Re=>!Array.isArray(Re)||Re.length===0||!le?.sort?.length?Re:he(Re,le.sort,Te)))};function he(le,Te,Ee){return le.map(Re=>{const me=De(Re,Te,Ee);return me.length&&me[0].index!=null?(0,te.ES)(Re,me[0].index,me[0].desc):Re})}function De(le,Te,Ee){return Te.map(Re=>Re.index!=null?Re:(0,B.w)()?{...Re,index:le.fields.findIndex(me=>Ee.interpolate(Re.field)===(0,E.Ct)(me,le))}:{...Re,index:le.fields.findIndex(me=>Re.field===(0,E.Ct)(me,le))})}const pe={noopTransformer:V.W,filterFieldsTransformer:r.z,filterFieldsByNameTransformer:g.D,filterFramesTransformer:r.I,filterFramesByRefIdTransformer:i,filterByValueTransformer:l.Sv,formatStringTransformer:f.yt,formatTimeTransformer:p,orderFieldsTransformer:G.x,organizeFieldsTransformer:j,reduceTransformer:Y.Wj,concatenateTransformer:n.vz,calculateFieldTransformer:t.SC,joinByFieldTransformer:U.L,seriesToColumnsTransformer:U.L,seriesToRowsTransformer:ue,renameFieldsTransformer:_,labelsToFieldsTransformer:R.V,ensureColumnsTransformer:s.b,groupByTransformer:a.of,sortByTransformer:ge,mergeTransformer:N.o,renameByRegexTransformer:re,histogramTransformer:L.OA,convertFieldTypeTransformer:o.zM,groupingToMatrixTransformer:x,limitTransformer:w,groupToNestedTable:v._X}},66350:(Q,A,e)=>{"use strict";e.d(A,{Bp:()=>v,SC:()=>M,UY:()=>a,Uj:()=>b,ip:()=>E,sw:()=>H});var t=e(2543),n=e.n(t),o=e(81160),s=e(14236),r=e(28240),g=e(11261),u=e(39070),c=e(11710),i=e(27618),l=e(75059),f=e(85200),d=e(1173),h=e(34125),p=e(18282),m=e(64586),a=(w=>(w.ReduceRow="reduceRow",w.CumulativeFunctions="cumulativeFunctions",w.WindowFunctions="windowFunctions",w.BinaryOperation="binary",w.UnaryOperation="unary",w.Index="index",w))(a||{}),v=(w=>(w.Percentage="percentage",w.Fixed="fixed",w))(v||{}),E=(w=>(w.Trailing="trailing",w.Centered="centered",w))(E||{});const D={reducer:l.gy.sum},b={reducer:l.gy.mean,windowAlignment:"trailing",windowSizeMode:"percentage",windowSize:.1},C={left:"",operator:c.k.Add,right:""},y={operator:i._.Abs,fieldName:""},M={id:p.F.calculateField,name:"Add field from calculation",description:"Use the row values to calculate a new field",defaultOptions:{mode:"reduceRow",reduce:{reducer:l.gy.sum}},operator:(w,N)=>V=>{const G=w&&w.timeSeries!==!1?h.b.operator(null,N):m.W.operator({},N);return w.alias!=null&&(w.alias=N.interpolate(w.alias)),V.pipe(G,(0,o.T)(_=>{const K=w.mode??"reduceRow";let j;switch(K){case"reduceRow":j=L((0,t.defaults)(w.reduce,D),_);break;case"cumulativeFunctions":j=P((0,t.defaults)(w.cumulative,D),_);break;case"windowFunctions":j=T((0,t.defaults)(w.window,b),_);break;case"unary":j=B((0,t.defaults)(w.unary,y),_);break;case"binary":const k={...w.binary,left:N.interpolate(w.binary?.left),right:N.interpolate(w.binary?.right)};j=R((0,t.defaults)(k,C),_);break;case"index":return _.map(Y=>{const ee=[...Array(Y.length).keys()];if(w.index?.asPercentile)for(let J=0;J<ee.length;J++)ee[J]=ee[J]/ee.length;const re={name:w.alias??"Row",type:g.PU.number,values:ee,config:w.index?.asPercentile?{unit:"percentunit"}:{}};return{...Y,fields:w.replaceFields?[re]:[...Y.fields,re]}})}return j?_.map(k=>{const Y=j(k);if(!Y)return k;const ee={name:H(w),type:g.PU.number,config:{},values:Y};let re=[];if(w.replaceFields){const{timeField:J}=(0,s.KR)(k);J&&w.timeSeries!==!1?re=[J,ee]:re=[ee]}else re=[...k.fields,ee];return{...k,fields:re}}):_}))}};function T(w,N){if(w.windowSize<=0)throw new Error("Add field from calculation transformation - Window size must be larger than 0");let V=(0,f.NS)({id:d.Ct.numeric});return w.field&&(V=(0,f.NS)({id:d.Ct.byNames,options:{names:[w.field]}})),G=>{const _=Math.ceil(w.windowSize*(w.windowSizeMode==="percentage"?G.length:1));let K=null;for(const j of G.fields)if(V(j,G,N)){K=j;break}if(K){if(![l.gy.mean,l.gy.stdDev,l.gy.variance].includes(w.reducer))throw new Error(`Add field from calculation transformation - Unsupported reducer: ${w.reducer}`);return w.windowAlignment==="centered"?x(G,w.reducer,K,_):I(G,w.reducer,K,_)}}}function I(w,N,V,G){const _=[];let K=0,j=0;for(let k=0;k<w.length;k++)if(N===l.gy.mean){const Y=V.values[k];Y!=null&&(j++,K+=Y,k>G-1&&(K-=V.values[k-G],j--)),_.push(j===0?0:K/j)}else if(N===l.gy.variance){const Y=Math.max(0,k-G+1),ee=k+1;_.push(S(V.values.slice(Y,ee)))}else if(N===l.gy.stdDev){const Y=Math.max(0,k-G+1),ee=k+1;_.push(O(V.values.slice(Y,ee)))}return _}function x(w,N,V,G){const _=[];let K=0,j=0;const k=Math.ceil(G/2)-1,Y=Math.floor(G/2);for(let ee=0;ee<w.length;ee++){const re=ee-Y,J=ee+k;if(N===l.gy.mean){if(ee===0)for(let ne=0;ne<k+1&&ne<V.values.length;ne++)V.values[ne]!=null&&(K+=V.values[ne],j++);else J<V.values.length&&V.values[J]!=null&&(K+=V.values[J],j++),re>0&&V.values[re-1]!=null&&(K-=V.values[re-1],j--);_.push(j===0?0:K/j)}else if(N===l.gy.variance){const ne=V.values.slice(Math.max(0,re),Math.min(J+1,V.values.length));_.push(S(ne))}else if(N===l.gy.stdDev){const ne=V.values.slice(Math.max(0,re),Math.min(J+1,V.values.length));_.push(O(ne))}}return _}function S(w){if(w.length<1)return 0;let N=0,V=0,G=0;for(let K=0;K<w.length;K++){const j=w[K];if(j!=null){G++;let k=V;V+=(j-k)/G,N+=(j-k)*(j-V)}}return G===0?0:N/G}function O(w){return Math.sqrt(S(w))}function P(w,N){let V=(0,f.NS)({id:d.Ct.numeric});if(w.field&&(V=(0,f.NS)({id:d.Ct.byNames,options:{names:[w.field]}})),![l.gy.mean,l.gy.sum].includes(w.reducer))throw new Error(`Add field from calculation transformation - Unsupported reducer: ${w.reducer}`);return G=>{let _=null;for(const k of G.fields)if(V(k,G,N)){_=k;break}if(!_)return;const K=[];let j=0;for(let k=0;k<G.length;k++)j+=_.values[k]??0,w.reducer===l.gy.sum?K.push(j):w.reducer===l.gy.mean&&K.push(j/(k+1));return K}}function L(w,N){let V=(0,f.NS)({id:d.Ct.numeric});w.include&&w.include.length&&(V=(0,f.NS)({id:d.Ct.byNames,options:{names:w.include}}));const G=l.AS.get(w.reducer);if(!G)throw new Error(`Unknown reducer: ${w.reducer}`);const _=G.reduce??l.H3,K=w.nullValueMode===u.UW.Ignore,j=w.nullValueMode===u.UW.AsZero;return k=>{const Y=[];for(const ne of k.fields)V(ne,k,N)&&Y.push(ne.values);const ee=Y.length,re={name:"temp",values:new Array(ee),type:g.PU.number,config:{}},J=[];for(let ne=0;ne<k.length;ne++){for(let q=0;q<ee;q++)re.values[q]=Y[q][ne];J.push(_(re,K,j)[w.reducer])}return J}}function U(w,N,V){if(!N)return;for(const _ of w.fields)if(N===(0,r.Ct)(_,w,V))return _.type===g.PU.boolean?_.values.map(K=>K?1:0):_.values;const G=parseFloat(N);if(!isNaN(G))return new Array(w.length).fill(G)}function R(w,N){const V=c.b.getIfExists(w.operator);return G=>{const _=U(G,w.left,N),K=U(G,w.right,N);if(!_||!K||!V)return;const j=new Array(_.length);for(let k=0;k<j.length;k++)j[k]=V.operation(_[k],K[k]);return j}}function B(w,N){const V=i.j.getIfExists(w.operator);return G=>{let _=[];for(const j of G.fields)w.fieldName===(0,r.Ct)(j,G,N)&&j.type===g.PU.number&&(_=j.values);if(!_.length||!V)return;const K=new Array(_.length);for(let j=0;j<K.length;j++)K[j]=V.operation(_[j]);return K}}function H(w){if(w.alias?.length)return w.alias;switch(w.mode){case"cumulativeFunctions":{const{cumulative:N}=w;return`cumulative ${N?.reducer??""}${N?.field?`(${N.field})`:""}`}case"windowFunctions":{const{window:N}=w;return`${N?.windowAlignment??""} moving ${N?.reducer??""}${N?.field?`(${N.field})`:""}`}case"unary":{const{unary:N}=w;return`${N?.operator??""}${N?.fieldName?`(${N.fieldName})`:""}`}case"binary":{const{binary:N}=w;return`${N?.left??""} ${N?.operator??""} ${N?.right??""}`.replace(/\$/g,"")}case"reduceRow":{const N=l.AS.getIfExists(w.reduce?.reducer);if(N)return N.name}break;case"index":return"Row"}return"math"}},82150:(Q,A,e)=>{"use strict";e.d(A,{vz:()=>r,x1:()=>s});var t=e(81160),n=e(11261),o=e(18282),s=(u=>(u.Drop="drop",u.FieldName="field",u.Label="label",u))(s||{});const r={id:o.F.concatenate,name:"Concatenate fields",description:"Combine all fields into a single frame. Values will be appended with undefined values if not the same length.",defaultOptions:{frameNameMode:"field",frameNameLabel:"frame"},operator:u=>c=>c.pipe((0,t.T)(i=>!Array.isArray(i)||i.length<2?i:[g(i,u)]))};function g(u,c){let i=!0,l=u[0].length;const f=c.frameNameLabel??"frame";let d=[];for(const h of u){l!==h.length&&(i=!1,l=Math.max(l,h.length));for(const p of h.fields){const m={...p};m.state=void 0,h.name&&(c.frameNameMode==="drop"||(c.frameNameMode==="label"?(m.labels={...p.labels},m.labels[f]=h.name):!m.name||m.name===n.Bc?m.name=h.name:m.name=`${h.name} \xB7 ${p.name}`)),d.push(m)}}return i||(d=d.map(h=>{if(h.values.length===l)return h;const p=h.values.slice();return p.length=l,{...h,values:p}})),{fields:d,length:l}}},50311:(Q,A,e)=>{"use strict";e.d(A,{Xv:()=>p,ks:()=>a,s7:()=>i,zM:()=>u});var t=e(81160),n=e(53531),o=e(11261),s=e(85200),r=e(1173),g=e(18282);const u={id:g.F.convertFieldType,name:"Convert field type",description:"Convert a field to a specified field type.",defaultOptions:{fields:{},conversions:[{targetField:void 0,destinationType:void 0,dateFormat:void 0,timezone:void 0}]},operator:(E,D)=>b=>b.pipe((0,t.T)(C=>u.transformer(E,D)(C))),transformer:E=>D=>!Array.isArray(D)||D.length===0?D:c(E,D)??[]};function c(E,D){if(!E.conversions.length)return D;const b=D.map(C=>({...C}));for(const C of E.conversions){if(!C.targetField)continue;const y=s.sJ.get(r.Ct.byName).get(C.targetField);for(const M of b)M.fields=M.fields.map(T=>y(T,M,b)?i(T,C):T)}return b}function i(E,D){switch(D.destinationType){case o.PU.time:return a(E,D.dateFormat);case o.PU.number:return d(E);case o.PU.string:return p(E,D.dateFormat,{timeZone:D.timezone},D.joinWith);case o.PU.boolean:return h(E);case o.PU.enum:return v(E,D.enumConfig);case o.PU.other:return m(E);default:return E}}const l=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3,})?(?:Z|[-+]\d{2}:?\d{2})$/;function f(E,D){let b=D?{format:D}:void 0;const C=E.values.slice();let y=C.find(T=>T!=null),M=typeof y=="string"&&l.test(y);for(let T=0;T<C.length;T++)if(C[T]){let I=M?Date.parse(C[T]):(0,n.b)(C[T],b).valueOf();C[T]=Number.isFinite(I)?I:null}else C[T]=null;return{...E,type:o.PU.time,values:C}}function d(E){const D=E.values.slice(),b=D.some(C=>typeof C=="string");for(let C=0;C<D.length;C++){let y=D[C];b&&y!=null&&typeof y=="string"&&(y=y.replace(/,/g,""));const M=+y;D[C]=Number.isFinite(M)?M:null}return{...E,type:o.PU.number,values:D}}function h(E){const D=E.values.slice();for(let b=0;b<D.length;b++)D[b]=!!D[b];return{...E,type:o.PU.boolean,values:D}}function p(E,D,b,C){let y=E.values;switch(E.type){case o.PU.time:y=y.map(M=>(0,n.b)(M,b).format(D));break;case o.PU.other:y=y.map(M=>C?.length&&Array.isArray(M)?M.join(C):JSON.stringify(M));break;default:y=y.map(M=>`${M}`)}return{...E,type:o.PU.string,values:y}}function m(E){const D=E.values.slice();for(let b=0;b<D.length;b++)try{D[b]=JSON.parse(D[b])}catch{D[b]=null}return{...E,type:o.PU.other,values:D}}function a(E,D){const b=typeof E.values[0]=="number";return E.type===o.PU.time&&b?E:b?{...E,type:o.PU.time}:f(E,D)}function v(E,D){const b={...D},C=E.values.slice(),y=new Map;if(b.text&&b.text.length>0)for(let M=0;M<b.text.length;M++)y.set(b.text[M],M);else return E;for(let M=0;M<C.length;M++){const T=C[M];C[M]=y.get(T)}return{...E,config:{...E.config,type:{enum:b}},type:o.PU.enum,values:C}}},34125:(Q,A,e)=>{"use strict";e.d(A,{b:()=>r});var t=e(81160),n=e(14236),o=e(18282),s=e(41511);const r={id:o.F.ensureColumns,name:"Ensure Columns Transformer",description:"Will check if current data frames is series or columns. If in series it will convert to columns.",operator:(u,c)=>i=>i.pipe((0,t.T)(l=>r.transformer(u,c)(l))),transformer:(u,c)=>i=>{const l=g(i);return i.length>1&&l?s.L.transformer({byField:l},c)(i):i}};function g(u){let c;for(const i of u){const{timeField:l}=(0,n.KR)(i);if(!l)return;if(!c)c=l.name;else if(c!==l.name)return}return c}},64224:(Q,A,e)=>{"use strict";e.d(A,{I:()=>g,z:()=>r});var t=e(81160),n=e(85200),o=e(18282),s=e(64586);const r={id:o.F.filterFields,name:"Filter Fields",description:"select a subset of fields",defaultOptions:{},operator:(u,c)=>i=>!u.include&&!u.exclude?i.pipe(s.W.operator({},c)):(typeof u.include?.options=="string"?u.include.options=c.interpolate(u.include?.options):typeof u.include?.options?.pattern=="string"&&(u.include.options.pattern=c.interpolate(u.include?.options.pattern)),typeof u.exclude?.options=="string"?u.exclude.options=c.interpolate(u.exclude?.options):typeof u.exclude?.options?.pattern=="string"&&(u.exclude.options.pattern=c.interpolate(u.exclude?.options.pattern)),i.pipe((0,t.T)(l=>{const f=u.include?(0,n.NS)(u.include):null,d=u.exclude?(0,n.NS)(u.exclude):null,h=[];for(const p of l){const m=[];for(let v=0;v<p.fields.length;v++){const E=p.fields[v];if(d){if(d(E,p,l))continue;f||m.push(E)}f&&f(E,p,l)&&m.push(E)}if(!m.length)continue;const a={...p,fields:m};h.push(a)}return h})))},g={id:o.F.filterFrames,name:"Filter Frames",description:"select a subset of frames",defaultOptions:{},operator:(u,c)=>i=>!u.include&&!u.exclude?i.pipe(s.W.operator({},c)):i.pipe((0,t.T)(l=>{const f=u.include?(0,n.Dq)(u.include):null,d=u.exclude?(0,n.Dq)(u.exclude):null,h=[];for(const p of l){if(d){if(d(p))continue;f||h.push(p)}f&&f(p)&&h.push(p)}return h}))}},35602:(Q,A,e)=>{"use strict";e.d(A,{D:()=>s,R:()=>r});var t=e(1173),n=e(64224),o=e(18282);const s={id:o.F.filterFieldsByName,name:"Filter fields by name",description:"select a subset of fields",defaultOptions:{},operator:(g,u)=>c=>c.pipe(n.z.operator({include:r(u,g.include,g.byVariable),exclude:r(u,g.exclude,g.byVariable)},u))},r=(g,u,c)=>{if(!u)return;const{names:i,pattern:l,variable:f}=u;if(c&&f){const d=g.interpolate(f);if(/\{.*\}/.test(d)){const h=d.slice(1).slice(0,-1).split(",");return{id:t.Ct.byNames,options:{names:h}}}return{id:t.Ct.byNames,options:{names:d.split(",")}}}if(!((!Array.isArray(i)||i.length===0)&&!l))return l?!Array.isArray(i)||i.length===0?{id:t.Ct.byRegexp,options:l}:{id:t.Ct.byRegexpOrNames,options:u}:{id:t.Ct.byNames,options:{names:i}}}},73376:(Q,A,e)=>{"use strict";e.d(A,{Sm:()=>i,Sv:()=>l,j4:()=>c});var t=e(81160),n=e(28240),o=e(85200),s=e(1173),r=e(18282),g=e(64586),u=e(67641),c=(h=>(h.exclude="exclude",h.include="include",h))(c||{}),i=(h=>(h.all="all",h.any="any",h))(i||{});const l={id:r.F.filterByValue,name:"Filter data by values",description:"select a subset of results based on values",defaultOptions:{filters:[],type:"include",match:"any"},operator:(h,p)=>m=>{const a=h.filters,v=h.match==="all",E=h.type==="include";if(!Array.isArray(a)||a.length===0)return m.pipe(g.W.operator({},p));const D=[];return(0,u.w)()&&D.push(...a.map(b=>{if(b.config.id===s.Js.between){const C=p.interpolate(b.config.options.from),y=p.interpolate(b.config.options.to);return{...b,config:{...b.config,options:{...b.config.options,to:y,from:C}}}}else{if(b.config.id===s.Js.regex)return b;if(b.config.options.value){const C=p.interpolate(b.config.options.value),y={...b,config:{...b.config,options:{...b.config.options,value:C}}};return y.config.options.value=C,y}}return b})),m.pipe((0,t.T)(b=>{if(!Array.isArray(b)||b.length===0)return b;const C=new Set;for(const T of b){const I=d(T,b);let x;(0,u.w)()?x=f(D,I):x=f(a,I);for(let S=0;S<T.length;S++){if(C.has(S))continue;let O=!0;for(const P of x){const L=P(S,T,b);if(!v&&L){O=!0;break}if(v&&!L){O=!1;break}O=L}O&&C.add(S)}}const y=[],M=E?C.size:b[0].length-C.size;for(const T of b){const I=[];for(const x of T.fields){const S=[];for(let O=0;O<T.length;O++){if(E&&C.has(O)){S.push(x.values[O]);continue}if(!E&&!C.has(O)){S.push(x.values[O]);continue}}I.push({...x,values:S,state:{}})}y.push({...T,fields:I,length:M})}return y}))}},f=(h,p)=>{const m=()=>!1;return h.map(a=>{const v=p[a.fieldName]??-1;if(v<0)return console.warn(`[FilterByValue] Could not find index for field name: ${a.fieldName}`),m;const E=(0,o.kK)(a.config);return(D,b,C)=>E(D,b.fields[v],b,C)})},d=(h,p)=>h.fields.reduce((m,a,v)=>{const E=(0,n.Ct)(a,h,p);return m[E]=v,m},{})},15400:(Q,A,e)=>{"use strict";e.d(A,{gs:()=>g,yt:()=>i});var t=e(81160),n=e(11261),o=e(85200),s=e(1173),r=e(18282),g=(f=>(f.UpperCase="Upper Case",f.LowerCase="Lower Case",f.SentenceCase="Sentence Case",f.TitleCase="Title Case",f.PascalCase="Pascal Case",f.CamelCase="Camel Case",f.SnakeCase="Snake Case",f.KebabCase="Kebab Case",f.Trim="Trim",f.Substring="Substring",f))(g||{});const u=f=>{const d=f.split(" ");for(let h=0;h<d.length;h++)d[h]=d[h].charAt(0).toUpperCase()+d[h].slice(1).toLowerCase();return d},c=f=>d=>d.values.map(h=>{switch(f.outputFormat){case"Upper Case":return h.toUpperCase();case"Lower Case":return h.toLowerCase();case"Sentence Case":return h.charAt(0).toUpperCase()+h.slice(1);case"Title Case":return u(h).join(" ");case"Pascal Case":return u(h).join("");case"Camel Case":return h=u(h).join(""),h.charAt(0).toLowerCase()+h.slice(1);case"Snake Case":return h.toLowerCase().split(" ").join("_");case"Kebab Case":return h.toLowerCase().split(" ").join("-");case"Trim":return h.trim();case"Substring":return h.substring(f.substringStart,f.substringEnd)}}),i={id:r.F.formatString,name:"Format string",description:"Manipulate string fields formatting",defaultOptions:{stringField:"",outputFormat:"Upper Case"},operator:f=>d=>d.pipe((0,t.T)(h=>{if(h.length===0)return h;const p=o.sJ.get(s.Ct.byName).get(f.stringField),m=c(f),a=l(p,m);return h.map(v=>({...v,fields:a(v,h)}))}))},l=(f,d)=>(h,p)=>h.fields.map(m=>{if(f(m,h,p)){const a=d(m);return{...m,type:n.PU.string,values:a}}return m})},25094:(Q,A,e)=>{"use strict";e.d(A,{Ce:()=>p,R3:()=>c,Y2:()=>h,of:()=>i});var t=e(81160),n=e(14236),o=e(28240),s=e(81010),r=e(11261),g=e(75059),u=e(18282),c=(m=>(m.aggregate="aggregate",m.groupBy="groupby",m))(c||{});const i={id:u.F.groupBy,name:"Group by",description:"Group the data by a field values then process calculations for each group.",defaultOptions:{fields:{}},isApplicable:m=>{let a=0;for(const v of m)v.fields.length>a&&(a=v.fields.length);return a>=2?s.M.Applicable:s.M.NotApplicable},isApplicableDescription:m=>{let a=0;for(const v of m)v.fields.length>a&&(a=v.fields.length);return`The Group by transformation requires a series with at least two fields to work. The maximum number of fields found on a series is ${a}`},operator:m=>a=>a.pipe((0,t.T)(v=>{if(!Object.keys(m.fields).find(b=>m.fields[b].operation==="groupby"))return v;const D=[];for(const b of v){const C=b.fields.filter(T=>l(T,m));if(C.length===0)continue;const y=h(b,C),M=p(C,y);for(const T of b.fields){if(!f(T,m))continue;const I=(0,o.Ct)(T),x=m.fields[I].aggregations,S={};y.forEach(O=>{const P=O[I],L=(0,g.Nw)({field:P,reducers:x});for(const U of x)Array.isArray(S[U])||(S[U]=[]),S[U].push(L[U])});for(const O of x){const P={name:`${I} (${O})`,values:S[O]??[],type:r.PU.other,config:{}};P.type=d(O,T,P),M.push(P)}}D.push({fields:M,length:y.size})}return D}))},l=(m,a)=>{const v=(0,o.Ct)(m);return a?.fields[v]?.operation==="groupby"},f=(m,a)=>{const v=(0,o.Ct)(m);return a?.fields[v]?.operation==="aggregate"&&Array.isArray(a?.fields[v].aggregations)&&a?.fields[v].aggregations.length>0};function d(m,a,v){switch(m){case g.gy.allIsNull:return r.PU.boolean;case g.gy.last:case g.gy.lastNotNull:case g.gy.first:case g.gy.firstNotNull:return a.type;default:return(0,n.dF)(v)??r.PU.string}}function h(m,a){const v=new Map;for(let E=0;E<m.length;E++){const D=String(a.map(C=>C.values[E])),b=v.get(D)??{};v.has(D)||v.set(D,b);for(let C of m.fields){const y=(0,o.Ct)(C);b[y]||(b[y]={name:y,type:C.type,config:{...C.config},values:[]}),b[y].values.push(C.values[E])}}return v}function p(m,a){const v=[];for(const E of m){const D=[],b=(0,o.Ct)(E);a.forEach(C=>{D.push(C[b].values[0])}),v.push({name:E.name,type:E.type,config:{...E.config},values:D})}return v}},68133:(Q,A,e)=>{"use strict";e.d(A,{_X:()=>l,lu:()=>c});var t=e(81160),n=e(14236),o=e(28240),s=e(11261),r=e(75059),g=e(25094),u=e(18282);const c=!0;var i=(a=>(a.aggregate="aggregate",a.groupBy="groupby",a))(i||{});const l={id:u.F.groupToNestedTable,name:"Group to nested tables",description:"Group data by a field value and create nested tables with the grouped data",defaultOptions:{showSubframeHeaders:c,fields:{}},operator:a=>v=>v.pipe((0,t.T)(E=>{if(!Object.keys(a.fields).find(C=>a.fields[C].operation==="groupby"))return E;const b=[];for(const C of E){const y=C.fields.filter(x=>d(x,a));if(y.length===0)continue;const M=(0,g.Y2)(C,y),T=(0,g.Ce)(y,M),I=m(M,a);for(let x=0;x<C.fields.length;x++){const S=C.fields[x];if(!h(S,a))continue;const O=(0,o.Ct)(S),P=a.fields[O].aggregations,L={};M.forEach(U=>{const R=U[O],B=(0,r.Nw)({field:R,reducers:P});for(const H of P)Array.isArray(L[H])||(L[H]=[]),L[H].push(B[H])});for(const U of P){const R={name:`${O} (${U})`,values:L[U],type:s.PU.other,config:{}};R.type=p(U,S,R),T.push(R)}}T.push({config:{},name:"Nested frames",type:s.PU.nestedFrames,values:I}),b.push({fields:T,length:M.size})}return b}))};function f(a,v,E){return{meta:{custom:{noHeader:!(E.showSubframeHeaders===void 0?c:E.showSubframeHeaders)}},length:v,fields:a}}const d=(a,v)=>{const E=(0,o.Ct)(a);return v?.fields[E]?.operation==="groupby"},h=(a,v)=>{const E=(0,o.Ct)(a);return v?.fields[E]?.operation==="aggregate"&&Array.isArray(v?.fields[E].aggregations)&&v?.fields[E].aggregations.length>0},p=(a,v,E)=>{switch(a){case r.gy.allIsNull:return s.PU.boolean;case r.gy.last:case r.gy.lastNotNull:case r.gy.first:case r.gy.firstNotNull:return v.type;default:return(0,n.dF)(E)??s.PU.string}};function m(a,v){const E=[];for(const[,D]of a){const b=[];for(const[C,y]of Object.entries(D)){const M=v.fields[C];(M===void 0||M.aggregations===void 0||M.operation==="aggregate"&&M.aggregations.length===0||M.operation===null||M.operation===void 0)&&b.push(y)}b.length>0?E.push([f(b,b[0].values.length,v)]):E.push([f([],0,v)])}return E}},77678:(Q,A,e)=>{"use strict";e.d(A,{H1:()=>D,NX:()=>v,OA:()=>m,Rt:()=>p,Uh:()=>M,ZU:()=>y,cg:()=>x,d$:()=>a,dA:()=>E,ix:()=>b,p3:()=>C,rW:()=>l,rs:()=>T});var t=e(81160),n=e(57875),o=e(47696),s=e(41260),r=e(11261),g=e(97706),u=e(18282),c=e(73060),i=e(67641);const l=[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],f=30,d=[],h=(S,O)=>S-O,p={bucketCount:{name:"Bucket count",description:"approx bucket count"},bucketSize:{name:"Bucket size",description:void 0},bucketOffset:{name:"Bucket offset",description:"for non-zero-based buckets"},combine:{name:"Combine series",description:"combine all series into a single histogram"}},m={id:u.F.histogram,name:"Histogram",description:"Calculate a histogram from input data.",defaultOptions:{fields:{}},operator:(S,O)=>P=>P.pipe((0,t.T)(L=>m.transformer(S,O)(L))),transformer:(S,O)=>P=>{if(!Array.isArray(P)||P.length===0)return P;let L,U;S.bucketSize&&((0,i.w)()&&(S.bucketSize=O.interpolate(S.bucketSize.toString())),typeof S.bucketSize=="string"?L=parseFloat(S.bucketSize):L=S.bucketSize,isNaN(L)&&(L=void 0)),S.bucketOffset&&((0,i.w)()&&(S.bucketOffset=O.interpolate(S.bucketOffset.toString())),typeof S.bucketOffset=="string"?U=parseFloat(S.bucketOffset):U=S.bucketOffset,isNaN(U)&&(U=void 0));const R={bucketSize:L,bucketOffset:U,combine:S.combine},B=C(P,R);return B==null?[]:[x(B)]}},a="xMin";function v(S){return S===a||S==="BucketMin"}const E="xMax";function D(S){return S===E||S==="BucketMax"}function b(S){if(S.meta?.type===s.m.HeatmapCells){let U=S.fields.find(G=>G.name==="yMin"),R=S.fields.find(G=>G.name==="yMax"),B=S.fields.find(G=>G.name==="count"),H=[...new Set(R.values)].sort((G,_)=>G-_),w=[...new Set(U.values)].sort((G,_)=>G-_),N=new Map;H.forEach(G=>N.set(G,0));for(let G=0;G<R.values.length;G++){let _=R.values[G];N.set(_,N.get(_)+B.values[G])}return{xMin:{...U,name:"xMin",values:w},xMax:{...R,name:"xMax",values:H},counts:[{...B,values:[...N.values()]}]}}else if(S.meta?.type===s.m.HeatmapRows){let U=[],R=[],B=[],H="0";return S.fields.forEach(N=>{if(N.type===r.PU.number){let V=N.values.reduce((G,_)=>G+_,0);B.push(V),U.push(H),R.push(H=N.name)}}),B.push(0),U.push(H),R.push(H),{xMin:{...S.fields[1],name:"xMin",type:r.PU.string,values:U},xMax:{...S.fields[1],name:"xMax",type:r.PU.string,values:R},counts:[{...S.fields[1],name:"count",type:r.PU.number,values:B}]}}let O,P;const L=[];for(const U of S.fields)v(U.name)?O=U:D(U.name)?P=U:U.type===r.PU.number&&L.push(U);if(!P&&O&&O.values.length>1){let U=O.values,R=(0,g.h)(U[1]-U[0],6);P={...O,name:E,values:U.map(B=>B+R)}}if(!O&&P&&P?.values.length>1){let U=P.values,R=(0,g.h)(U[1]-U[0],6);O={...P,name:a,values:U.map(B=>B-R)}}if(O&&P&&L.length)return{xMin:O,xMax:P,counts:L}}function C(S,O){let P=O?.bucketSize,L=O?.bucketCount??f,U=O?.bucketOffset??0;if(!P||P<0){let K=[];for(const J of S)for(const ne of J.fields)ne.type===r.PU.number&&(K=K.concat(ne.values));K=K.filter(J=>J!=null),K.sort((J,ne)=>J-ne);let j=1/0;if(K.length===1)j=1;else for(let J=1;J<K.length;J++){let ne=K[J]-K[J-1];ne!==0&&(j=Math.min(j,ne))}let k=K[0];const re=(K[K.length-1]-k)/L;for(let J=0;J<l.length;J++){let ne=l[J];if(re<ne&&ne>=j){P=ne;break}}}const R=K=>T(K-U,P)+U;let B=((""+P).match(/\.\d+$/)??["."])[0].length-1,H=[],w=[],N;for(const K of S)for(const j of K.fields)if(j.type===r.PU.number){let k=I(j.values,R,d,h);H.push(k),w.push({...j,config:{...j.config,unit:j.config.unit==="short"?"short":void 0}}),!N&&j.config.unit&&(N=j.config)}if(!w.length)return null;let V=(0,c.fj)(H);for(let K=1;K<V.length;K++){let j=V[K];for(let k=0;k<j.length;k++)j[k]==null&&(j[k]=0)}const G={name:a,values:V[0],type:r.PU.number,state:void 0,config:B===0?N??{}:{...N,decimals:B}},_={...G,name:E,values:V[0].map(K=>K+P)};if(O?.combine){const K=new Array(V[0].length).fill(0);for(let j=1;j<V.length;j++)for(let k=0;k<K.length;k++)K[k]+=V[j][k];w=[{...w[0],name:"count",values:K,type:r.PU.number,state:void 0}]}else w.forEach((K,j)=>{K.values=V[j+1]});return{xMin:G,xMax:_,counts:w}}function y(S,O){return Math.round(S/O)*O}function M(S,O){return Math.ceil(S/O)*O}function T(S,O){return Math.floor(S/O)*O}function I(S,O,P,L){let U=new Map;for(let w=0;w<S.length;w++){let N=S[w];N!=null&&(N=O(N));let V=U.get(N);V?V.count++:U.set(N,{value:N,count:1})}P&&P.forEach(w=>U.delete(w));let R=[...U.values()];L&&R.sort((w,N)=>L(w.value,N.value));let B=Array(R.length),H=Array(R.length);for(let w=0;w<R.length;w++)B[w]=R[w].value,H[w]=R[w].count;return[B,H]}function x(S,O){if(!S.xMin.display){const P=(0,n.J)({field:S.xMin,theme:O??(0,o.a)()});S.xMin.display=P,S.xMax.display=P}return S.counts[0].display=(0,n.J)({field:S.counts[0],theme:O??(0,o.a)()}),{length:S.xMin.values.length,meta:{type:s.m.Histogram},fields:[S.xMin,S.xMax,...S.counts]}}},41511:(Q,A,e)=>{"use strict";e.d(A,{L:()=>u,W:()=>g});var t=e(81160),n=e(85200),o=e(1173),s=e(18282),r=e(73060),g=(c=>(c.outer="outer",c.inner="inner",c.outerTabular="outerTabular",c))(g||{});const u={id:s.F.joinByField,aliasIds:[s.F.seriesToColumns],name:"Join by field",description:"Combine rows from two or more tables, based on a related field between them. This can be used to outer join multiple time series on the _time_ field to show many time series in one table.",defaultOptions:{byField:void 0,mode:"outer"},operator:(c,i)=>l=>l.pipe((0,t.T)(f=>u.transformer(c,i)(f))),transformer:(c,i)=>{let l;return f=>{if(f.length>1){c.byField&&!l&&(l=n.sJ.get(o.Ct.byName).get(i.interpolate(c.byField)));const d=(0,r.Fd)({frames:f,joinBy:l,mode:c.mode});if(d)return[d]}return f}}}},73060:(Q,A,e)=>{"use strict";e.d(A,{Fd:()=>l,Yj:()=>i,fj:()=>a,g2:()=>v});var t=e(86643),n=e(14236),o=e(11261),s=e(85200),r=e(1173),g=e(41511);function u(E){const{timeField:D}=(0,n.KR)(E[0]);if(D)return s.sJ.get(r.Ct.firstTimeField).get({});let b=[];for(const C of E[0].fields)C.type===o.PU.number&&b.push(C.name);for(let C=1;C<E.length;C++){const y=[];for(const M of E[0].fields)M.type===o.PU.number&&y.push(M.name);b=b.filter(M=>!y.includes(M))}return s.sJ.get(r.Ct.byName).get(b[0])}function c(E){return E.joinBy??u(E.frames)}function i(E,D){if(D>=0){let b=E.fields[D];b.type!==o.PU.string&&!v(b.values)&&(E=(0,n.ES)(E,D))}return E}function l(E){if(!E.frames?.length)return;if(E.frames.length===1){let x=E.frames[0],S=x;const O=c(E);let P=S.fields.findIndex(L=>O(L,S,E.frames));if(E.keepOriginIndices&&(S={...x,fields:x.fields.map((L,U)=>{const R={...L},B={frameIndex:0,fieldIndex:U};return R.state?R.state.origin=B:R.state={origin:B},R})},P>0)){const L=S.fields[P],U=S.fields.filter((R,B)=>B!==P);U.unshift(L),S.fields=U,P=0}if(P>=0&&(S=i(S,P)),E.keep){let L=S.fields.filter((U,R)=>R===P||E.keep(U,S,E.frames));x!==S?S.fields=L:S={...x,fields:L}}return S}const D=[],b=[],C=[],y=[];let M=1;const T=c(E);for(let x=0;x<E.frames.length;x++){const S=E.frames[x];if(!S||!S.fields?.length)continue;const O=[d];let P,L=[],U=[];for(let B=0;B<S.fields.length;B++){const H=S.fields[B];if(H.state=H.state||{},!P&&T(H,S,E.frames))P=H;else{if(E.keep&&!E.keep(H,S,E.frames))continue;let w=H.config.custom?.spanNulls;O.push(w===!0?d:w===-1?h:p);let N=H.labels??{},V=H.name;S.name&&(H.name===o.Bc?V=S.name:N={...N,name:S.name}),L.push({...H,name:V,labels:N})}E.keepOriginIndices&&(H.state.origin={frameIndex:x,fieldIndex:B})}if(!P)continue;C.length===0&&C.push(P),D.push(O);const R=[P.values];for(const B of L)R.push(B.values),C.push(B),delete B.state?.displayName,U.push(M),M++;y.push(U),b.push(R)}let I=[];return E.mode===g.W.outerTabular?I=f(b,y,C.length,D):I=a(b,D,E.mode),{length:I[0]?I[0].length:0,fields:C.map((x,S)=>({...x,values:I[S]}))}}function f(E,D,b,C){let y={};for(let T=0;T<E.length;T++){let I=E[T],x=I[0];for(let S=0;S<E.length;S++){if(S===T)continue;let O=E[S],P=O[0];for(let L=0;L<x.length;L++){const U=x[L],R=b-1;let B=[U].concat(new Array(R)),H=0;for(let w=1;w<I.length;w++){const N=D[T][H];B[N]=I[w][L],H++}for(let w=0;w<P.length;w++)if(x[L]===P[w]){let N=0;for(let V=1;V<O.length;V++){const G=D[S][N];B[G]=O[V][w],N++}break}y[JSON.stringify(B)]=B}}}let M=[];for(let T=0;T<b;T++)M.push(new Array(0));for(let T in y){const I=y[T];for(let x=0;x<I.length;x++)M[x].push(I[x])}return M}const d=0,h=1,p=2;function m(E,D,b){for(let C=0,y,M=-1;C<D.length;C++){let T=D[C];if(T>M){for(y=T-1;y>=0&&E[y]==null;)E[y--]=null;for(y=T+1;y<b&&E[y]==null;)E[M=y++]=null}}}function a(E,D,b=g.W.outer){let C;if(b===g.W.inner)C=new Set((0,t.A)(E.map(I=>I[0])));else{C=new Set;for(let I=0;I<E.length;I++){let S=E[I][0],O=S.length;for(let P=0;P<O;P++)C.add(S[P])}}let y=[Array.from(C).sort((I,x)=>I-x)],M=y[0].length,T=new Map;for(let I=0;I<M;I++)T.set(y[0][I],I);for(let I=0;I<E.length;I++){let x=E[I],S=x[0];for(let O=1;O<x.length;O++){let P=x[O],L=Array(M).fill(void 0),U=D?D[I][O]:h,R=[];for(let B=0;B<P.length;B++){let H=P[B],w=T.get(S[B]);H===null?U!==d&&(L[w]=H,U===p&&R.push(w)):L[w]=H}m(L,R,M),y.push(L)}}return y}function v(E,D=50){const b=E.length;if(b<=1)return!0;let C=0,y=b-1;for(;C<=y&&E[C]==null;)C++;for(;y>=C&&E[y]==null;)y--;if(y<=C)return!0;const M=Math.max(1,Math.floor((y-C+1)/D));for(let T=E[C],I=C+M;I<=y;I+=M){const x=E[I];if(x!=null){if(x<=T)return!1;T=x}}return!0}},6829:(Q,A,e)=>{"use strict";e.d(A,{V:()=>g,n:()=>r});var t=e(81160),n=e(28240),o=e(11261),s=e(18282),r=(c=>(c.Columns="columns",c.Rows="rows",c))(r||{});const g={id:s.F.labelsToFields,name:"Labels to fields",description:"Extract time series labels to fields (columns or rows)",defaultOptions:{},operator:(c,i)=>l=>l.pipe((0,t.T)(f=>g.transformer(c,i)(f))),transformer:c=>i=>{if(c.mode==="rows")return u(i,c.keepLabels);const l=[],f=c.keepLabels?.length?new Set(c.keepLabels):void 0;for(const d of i){const h=[],p={};for(const m of d.fields){if(!m.labels){h.push(m);continue}const a={...m,config:{...m.config,displayName:void 0,displayNameFromDS:void 0},labels:void 0};h.push(a);for(const v of Object.keys(m.labels)){if(f&&!f.has(v))continue;if(c.valueLabel===v){a.name=m.labels[v];continue}(p[v]??(p[v]=new Set)).add(m.labels[v])}}for(const m in p)for(const a of p[m]){const v=new Array(d.length).fill(a);h.push({name:m,type:o.PU.string,values:v,config:{}})}l.push({...d,fields:h,length:d.length})}return l}};function u(c,i){const l=[];for(const f of c)for(const d of f.fields)if(d.labels){const h=[],p=[];if(i)for(const m of i)h.push(m),p.push(d.labels[m]);else for(const[m,a]of Object.entries(d.labels))h.push(m),p.push(a);p.length&&l.push({...f,name:(0,n.Ct)(d,f,c),fields:[{name:"label",type:o.PU.string,config:{},values:h},{name:"value",type:o.PU.string,config:{},values:p}],length:p.length})}return l}},58140:(Q,A,e)=>{"use strict";e.d(A,{o:()=>u});var t=e(2543),n=e.n(t),o=e(81160),s=e(37471),r=e(81010),g=e(18282);const u={id:g.F.merge,name:"Merge series/tables",description:"Merges multiple series/tables into a single serie/table",defaultOptions:{},isApplicable:p=>p.length>1?r.M.Applicable:r.M.NotApplicable,isApplicableDescription:p=>`The merge transformation requires at least 2 data series to work. There is currently ${p.length} data series.`,operator:p=>m=>m.pipe((0,o.T)(a=>{if(!Array.isArray(a)||a.length<=1)return a;const v=a.filter(x=>x.fields.length>0);if(v.length===0)return[a[0]];const E=new Set,D={},b=[],C=new s.k;for(let x=0;x<v.length;x++){const S=v[x];for(let O=0;O<S.fields.length;O++){const P=S.fields[O];E.has(P.name)||(C.addField(c(P)),E.add(P.name)),D[P.name]=D[P.name]||{},D[P.name][x]=O,v.length-1===x&&d(D,P,v)&&b.push(P.name)}}if(b.length===0)return a;const y={},M=[],T=i(v,D,b),I=l(v,E,D);for(let x=0;x<v.length;x++){const S=v[x];for(let O=0;O<S.length;O++){const P=T(x,O),L=I(x,O);if(!Array.isArray(y[P])){y[P]=[L],M.push(h(P,y));continue}let U=!1;y[P]=y[P].map(R=>f(R,L)?(U=!0,{...R,...L}):R),U||(y[P].push(L),M.push(h(P,y)))}}for(const x of M){const S=y[x.key][x.index];S&&C.add(S)}return[C]}))},c=p=>({...(0,t.omit)(p,["values","state","labels","config"]),values:[],config:{...(0,t.omit)(p.config,"displayName")}}),i=(p,m,a)=>{const v=a.reduce((E,D)=>Object.keys(m[D]).reduce((b,C)=>(b[C]=b[C]||[],b[C].push(m[D][C]),b),E),{});return(E,D)=>v[E].reduce((b,C)=>b+p[E].fields[C].values[D],"")},l=(p,m,a)=>(v,E)=>{const D={},b=Array.from(m);for(const C of b){const y=a[C];if(!y)continue;const M=y[v];if(typeof M!="number")continue;const T=p[v];if(!T||!T.fields)continue;const I=T.fields[M];!I||!I.values||(D[C]=I.values[E])}return D},f=(p,m)=>{let a=!0;for(const v in m)if(!(typeof p[v]>"u")&&p[v]!==null&&p[v]!==m[v]){a=!1;break}return a},d=(p,m,a)=>Object.keys(p[m.name]).length===a.length,h=(p,m)=>({key:p,index:m[p].length-1})},64586:(Q,A,e)=>{"use strict";e.d(A,{W:()=>n});var t=e(18282);const n={id:t.F.noop,name:"noop",description:"No-operation transformer",defaultOptions:{},operator:o=>s=>s,transformer:o=>s=>s}},46294:(Q,A,e)=>{"use strict";e.d(A,{M:()=>s});var t=e(11261);const n={threshold:(g,u,c)=>g+c,midpoint:(g,u,c)=>(g+u)/2,plusone:(g,u,c)=>g+1};function o(g,u){return g.fields.find(c=>u!=null?c.name===u:c.type===t.PU.time)}function s(g){if(g.frame.length===0)return g.frame;let u=!0,{frame:c,refFieldName:i,refFieldPseudoMax:l,refFieldPseudoMin:f,insertMode:d}=g;d||(d=n.threshold);const h=o(c,i);if(h==null)return c;h.state={...h.state,nullThresholdApplied:!0};const p=c.fields.map(a=>a.config.custom?.insertNulls||h.config.interval||null),m=new Set(p);if(m.delete(null),m.size===0)return c;if(m.size===1){const a=m.values().next().value;if(a<=0)return c;const v=h.values,E=c.fields.map(b=>b.values),D=r(v,E,a,f,l,d,u);return D===E?c:{...c,length:D[0].length,fields:c.fields.map((b,C)=>({...b,values:D[C]}))}}return c}function r(g,u,c,i=null,l=null,f,d){const h=g.length,p=[];if(i!=null&&i<g[0]){let E=Math.ceil((g[0]-i)/c),D=g[0]-E*c;for(;D<g[0];)p.push(f(D-c,D,c)),D+=c}p.push(g[0]);let m=g[0];for(let E=1;E<h;E++){const D=g[E];for(;D-m>c&&(p.push(f(m,D,c)),m+=c,!!d););p.push(D),m=D}if(l!=null&&l>m)for(;m+c<l;)p.push(f(m,l,c)),m+=c;const a=p.length;if(a===h)return u;const v=[];for(let E of u){let D;if(E!==g){D=Array(a);for(let b=0,C=0;b<a;b++)D[b]=g[C]===p[b]?E[C++]:null}else D=p;v.push(D)}return v}},39624:(Q,A,e)=>{"use strict";e.d(A,{C:()=>t});function t(n){return{...n,fields:n.fields.map(o=>{const s=+o.config?.noValue;if(Number.isNaN(s))return o;{const r=o.values.slice();for(let g=0;g<r.length;g++)r[g]===null&&(r[g]=s);return{...o,values:r}}})}}},82280:(Q,A,e)=>{"use strict";e.d(A,{X:()=>u,x:()=>g});var t=e(2543),n=e.n(t),o=e(81160),s=e(28240),r=e(18282);const g={id:r.F.order,name:"Order fields by name",description:"Order fields based on configuration given by user",defaultOptions:{indexByName:{}},operator:l=>f=>f.pipe((0,o.T)(d=>{const h=c(l.indexByName);return!Array.isArray(d)||d.length===0?d:d.map(p=>({...p,fields:h(p.fields,d,p)}))}))},u=l=>(f,d)=>i(f,l)-i(d,l),c=l=>(f,d,h)=>{if(!Array.isArray(f)||f.length===0||!l||Object.keys(l).length===0)return f;const p=u(l);return(0,t.clone)(f).sort((m,a)=>p((0,s.Ct)(m,h,d),(0,s.Ct)(a,h,d)))},i=(l,f)=>Number.isInteger(f[l])?f[l]:Number.MAX_SAFE_INTEGER},21128:(Q,A,e)=>{"use strict";e.d(A,{Wj:()=>l,rV:()=>i});var t=e(81160),n=e(14236),o=e(28240),s=e(11261),r=e(75059),g=e(85200),u=e(72693),c=e(18282),i=(a=>(a.SeriesToRows="seriesToRows",a.ReduceFields="reduceFields",a))(i||{});const l={id:c.F.reduce,name:"Reduce",description:"Reduce all rows or data points to a single value using a function like max, min, mean or last.",defaultOptions:{reducers:[r.gy.max]},operator:a=>v=>v.pipe((0,t.T)(E=>{if(!a?.reducers?.length)return E;const D=a.fields?(0,g.NS)(a.fields):a.includeTimeField&&a.mode==="reduceFields"?u.Yg:u.zx;if(a.mode==="reduceFields")return p(E,D,a.reducers);const b=f(E,D,a.reducers,a.labelsToFields);return b?[b]:[]}))};function f(a,v,E,D){const b=r.AS.list(E),C=b.map(T=>T.id),y=[],M=D?d(a):[];for(const T of a){const I=T.fields.filter(U=>v(U,T,a)),x=I.length,S=[],O=new Array(x);S.push({name:"Field",type:s.PU.string,values:O,config:{}});const P={};if(D)for(const U of M)P[U]=new Array(x),S.push({name:U,type:s.PU.string,values:P[U],config:{}});const L={};for(const U of b)L[U.id]=new Array(x),S.push({name:U.name,type:s.PU.other,values:L[U.id],config:{}});for(let U=0;U<I.length;U++){const R=I[U],B=(0,r.Nw)({field:R,reducers:C});if(D){if(O[U]=R.name,R.labels)for(const H of Object.keys(R.labels))P[H][U]=R.labels[H]}else O[U]=(0,o.Ct)(R,T,a);for(const H of b){const w=B[H.id];L[H.id][U]=w}}for(const U of S)if(U.type===s.PU.other){const R=(0,n.dF)(U);R&&(U.type=R)}y.push({...T,fields:S,length:x})}return h(y)}function d(a){const v=new Set;for(const E of a)for(const D of E.fields)if(D.labels)for(const b of Object.keys(D.labels))v.add(b);return[...v]}function h(a){if(!a?.length)return;const v=a[0];for(let E=1;E<a.length;E++){const D=a[E];for(let b=0;b<v.fields.length;b++){const C=v.fields[b];for(let y=0;y<D.fields.length;y++){const M=D.fields[y],T=b===0&&y===0,I=C.type===M.type&&C.name===M.name;if(T||I){const x=C.values,S=M.values;C.values=x.concat(S)}}}}return v.name=void 0,v.length=v.fields[0].values.length,v}function p(a,v,E){const b=r.AS.list(E).map(y=>y.id),C=[];for(const y of a){const M=[];for(const T of y.fields)if(v(T,y,a)){const I=(0,r.Nw)({field:T,reducers:b});for(const x of b){const S=I[x],O={...T,type:m(x,T),values:[S]};O.state=void 0,b.length>1&&(O.labels||(O.labels={}),O.labels.reducer=r.AS.get(x).name),M.push(O)}}M.length&&C.push({...y,fields:M,length:1})}return C}function m(a,v){switch(a){case r.gy.allValues:case r.gy.uniqueValues:return s.PU.other;case r.gy.first:case r.gy.firstNotNull:case r.gy.last:case r.gy.lastNotNull:return v.type;default:return s.PU.number}}},67641:(Q,A,e)=>{"use strict";e.d(A,{w:()=>t});const t=()=>window?.grafanaBootData?.settings?.featureToggles?.transformationsVariableSupport},22544:()=>{},12463:()=>{},43585:(Q,A,e)=>{"use strict";e.d(A,{O:()=>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||{})},8790:(Q,A,e)=>{"use strict";e.d(A,{V:()=>t});var t=(n=>(n.Field="field",n.Text="text",n.Skip="skip",n))(t||{})},41987:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>r,Jk:()=>o,hX:()=>s});var t=e(43429),n=e(74135),o=(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))(o||{});class s extends t.Ud{constructor(){super(...arguments),this._extensionConfigs=[]}init(u){}setRootPage(u){return this.root=u,this}setComponentsFromLegacyExports(u){if(u.ConfigCtrl&&(this.angularConfigCtrl=u.ConfigCtrl),this.meta&&this.meta.includes){for(const c of this.meta.includes)if(c.type===t.ib.page&&c.component&&!u[c.component]){console.warn("App Page uses unknown component: ",c.component,this.meta);continue}}}get extensionConfigs(){return this._extensionConfigs}configureExtensionLink(u){return this._extensionConfigs.push({...u,type:n.u.link}),this}configureExtensionComponent(u){return this._extensionConfigs.push({...u,type:n.u.component}),this}}var r=(g=>(g.alpha="alpha",g.beta="beta",g))(r||{})},61268:(Q,A,e)=>{"use strict";e.d(A,{r:()=>t});var t=(n=>(n.OpenSource="Open Source",n.Pro="Pro",n.Enterprise="Enterprise",n))(t||{})},58649:(Q,A,e)=>{"use strict";e.d(A,{En:()=>o,d1:()=>n,tw:()=>t});const t=0,n=100,o="SAML"},94624:(Q,A,e)=>{"use strict";e.d(A,{y:()=>t});var t=(n=>(n[n.Off=0]="Off",n[n.Crosshair=1]="Crosshair",n[n.Tooltip=2]="Tooltip",n))(t||{})},39070:(Q,A,e)=>{"use strict";e.d(A,{Gu:()=>t,Gv:()=>g,Nx:()=>n,UW:()=>o,zz:()=>s});var t=(u=>(u.NotStarted="NotStarted",u.Loading="Loading",u.Streaming="Streaming",u.Done="Done",u.Error="Error",u))(t||{});const n=["graph","table","logs","trace","nodeGraph","flamegraph","rawPrometheus"];var o=(u=>(u.Null="null",u.Ignore="connected",u.AsZero="null as zero",u))(o||{});const s=u=>!!u;function r(u){return u}function g(u){return typeof u=="object"&&u!==null?!0:!1}},11261:(Q,A,e)=>{"use strict";e.d(A,{Bc:()=>n,LE:()=>o,PU:()=>t,aI:()=>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.nestedFrames="nestedFrames",r))(t||{});const n="Value",o="Time",s="Metric"},41260:(Q,A,e)=>{"use strict";e.d(A,{m:()=>t});var t=(n=>(n.TimeSeriesWide="timeseries-wide",n.TimeSeriesLong="timeseries-long",n.TimeSeriesMany="timeseries-many",n.TimeSeriesMulti="timeseries-multi",n.NumericWide="numeric-wide",n.NumericMulti="numeric-multi",n.NumericLong="numeric-long",n.LogLines="log-lines",n.DirectoryListing="directory-listing",n.HeatmapRows="heatmap-rows",n.HeatmapCells="heatmap-cells",n.Histogram="histogram",n))(t||{})},91890:(Q,A,e)=>{"use strict";e.d(A,{$0:()=>o,CC:()=>n,uP:()=>s,x0:()=>t});var t=(r=>(r.Datasource="Datasource",r.Correlations="Correlations",r.ExploreCorrelationsEditor="CorrelationsEditor",r))(t||{}),n=(r=>(r.Regex="regex",r.Logfmt="logfmt",r))(n||{}),o=(r=>(r.Series="series",r.Field="field",r.Fields="fields",r.Value="value",r.BuiltIn="built-in",r.Template="template",r))(o||{}),s=(r=>(r.Values="values",r))(s||{})},40187:(Q,A,e)=>{"use strict";e.d(A,{Is:()=>u,ZF:()=>r,mA:()=>s,tD:()=>o,v2:()=>g});var t=e(92341),n=e(43429);class o extends n.Ud{constructor(i){super(),this.DataSourceClass=i,this.components={}}setConfigEditor(i){return this.components.ConfigEditor=i,this}setConfigCtrl(i){return this.angularConfigCtrl=i,this}setQueryCtrl(i){return this.components.QueryCtrl=i,this}setAnnotationQueryCtrl(i){return this.components.AnnotationsQueryCtrl=i,this}setQueryEditor(i){return this.components.QueryEditor=i,this}setExploreQueryField(i){return this.components.ExploreQueryField=i,this}setExploreMetricsQueryField(i){return this.components.ExploreMetricsQueryField=i,this}setExploreLogsQueryField(i){return this.components.ExploreLogsQueryField=i,this}setQueryEditorHelp(i){return this.components.QueryEditorHelp=i,this}setExploreStartPage(i){return this.setQueryEditorHelp(i)}setVariableQueryEditor(i){return this.components.VariableQueryEditor=i,this}setMetadataInspector(i){return this.components.MetadataInspector=i,this}setComponentsFromLegacyExports(i){this.angularConfigCtrl=i.ConfigCtrl,this.components.QueryCtrl=i.QueryCtrl,this.components.AnnotationsQueryCtrl=i.AnnotationsQueryCtrl,this.components.ExploreQueryField=i.ExploreQueryField,this.components.QueryEditor=i.QueryEditor,this.components.QueryEditorHelp=i.QueryEditorHelp,this.components.VariableQueryEditor=i.VariableQueryEditor}}class s{constructor(i){this.name=i.name,this.id=i.id,this.type=i.type,this.meta=i.meta,this.cachingConfig=i.cachingConfig,this.uid=i.uid}getRef(){return{type:this.type,uid:this.uid}}}var r=(c=>(c.Logs="Logs",c.Metrics="Metrics",c.Tracing="Tracing",c))(r||{}),g=(c=>(c.Cancelled="cancelled",c.Timeout="timeout",c.Unknown="unknown",c))(g||{});class u{}u=(0,t.Y)(u),s=(0,t.Y)(s)},50349:()=>{},50219:()=>{},24293:(Q,A,e)=>{"use strict";e.d(A,{F:()=>n,Y:()=>t});var t=(o=>(o.Thresholds="thresholds",o.PaletteClassic="palette-classic",o.PaletteClassicByName="palette-classic-by-name",o.PaletteSaturated="palette-saturated",o.ContinuousGrYlRd="continuous-GrYlRd",o.ContinuousRdYlGr="continuous-RdYlGr",o.ContinuousBlYlRd="continuous-BlYlRd",o.ContinuousYlRd="continuous-YlRd",o.ContinuousBlPu="continuous-BlPu",o.ContinuousYlBl="continuous-YlBl",o.ContinuousBlues="continuous-blues",o.ContinuousReds="continuous-reds",o.ContinuousGreens="continuous-greens",o.ContinuousPurples="continuous-purples",o.Fixed="fixed",o.Shades="shades",o))(t||{});const n="#808080"},37055:(Q,A,e)=>{"use strict";e.d(A,{Ow:()=>n,ZW:()=>t,uo:()=>o});function t(s){return r=>"__systemRef"in r&&r.__systemRef===s}const n=s=>"__systemRef"in s&&typeof s.__systemRef=="string";var o=(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))(o||{})},93015:()=>{},58318:()=>{},49812:()=>{},8887:(Q,A,e)=>{"use strict";e.d(A,{Uo:()=>o,az:()=>t,n6:()=>n});const t={google:!0,microsoft:!0,github:!0,gitlab:!0,okta:!0,discord:!0,hipchat:!0,amazon:!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,"application-observability":!0,apps:!0,"archive-alt":!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,asserts:!0,"expand-arrows":!0,at:!0,ai:!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,docker:!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-edit-alt":!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,"frontend-observability":!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-ml":!0,"gf-movepane-left":!0,"gf-movepane-right":!0,"gf-portrait":!0,"gf-service-account":!0,"gf-show-context":!0,"gf-pin":!0,"gf-prometheus":!0,"gf-traces":!0,globe:!0,grafana:!0,"graph-bar":!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,spinner:!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,unarchive:!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,"web-section-alt":!0,"wrap-text":!0,rss:!0,x:!0};function n(s){return!s||typeof s!="string"?!1:s in t}function o(s){if(n(s))return s}},64572:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{AbstractLabelOperator:()=>u.D_,AlertState:()=>re.O,AnnotationEventFieldSource:()=>c.V,AppEvents:()=>_.r1,AppPlugin:()=>I.hX,CoreApp:()=>I.Jk,CustomVariableSupport:()=>j.f5,DEFAULT_SAML_NAME:()=>t.En,DashboardCursorSync:()=>g.y,DataFrameType:()=>s.m,DataLinkConfigOrigin:()=>r.x0,DataQueryErrorType:()=>x.v2,DataSourceApi:()=>x.mA,DataSourcePlugin:()=>x.tD,DataSourceVariableSupport:()=>j.ZV,DataTopic:()=>u.QR,DefaultTimeZone:()=>h.lE,ExploreMode:()=>x.ZF,FALLBACK_COLOR:()=>L.F,FeatureState:()=>I.Ay,FieldColorModeId:()=>L.Y,FieldConfigProperty:()=>M.uo,FieldType:()=>o.PU,GAUGE_DEFAULT_MAXIMUM:()=>t.d1,GAUGE_DEFAULT_MINIMUM:()=>t.tw,GrafanaPlugin:()=>O.Ud,GrafanaThemeType:()=>U.I,LanguageProvider:()=>x.Is,LegacyGraphHoverClearEvent:()=>_.Tq,LegacyGraphHoverEvent:()=>_.kb,LiveChannelConnectionState:()=>K.ZF,LiveChannelEventType:()=>K.o4,LiveChannelScope:()=>K.qD,LiveChannelType:()=>K.os,LoadingState:()=>n.Gu,LogLevel:()=>i.$b,LogRowContextQueryDirection:()=>i.ZF,LogsDedupDescription:()=>i._C,LogsDedupStrategy:()=>i.fY,LogsMetaKind:()=>i.tG,LogsSortOrder:()=>i.uH,LogsVolumeType:()=>i.Aj,MappingType:()=>m.d,NullValueMode:()=>n.UW,OrgRole:()=>R.X,PageLayoutType:()=>l.k,PanelEvents:()=>_.ee,PluginErrorCode:()=>O.ZK,PluginExtensionPoints:()=>ie.S,PluginExtensionTypes:()=>ie.u,PluginIncludeType:()=>O.ib,PluginSignatureStatus:()=>O.Ac,PluginSignatureType:()=>O.kv,PluginState:()=>O.pn,PluginType:()=>O.QE,SpecialValue:()=>y.N,SpecialValueMatch:()=>m.W,StandardVariableSupport:()=>j.J$,SupplementaryQueryType:()=>i.cF,SupportedTransformationType:()=>r.CC,TIME_FORMAT:()=>h.G$,TIME_SERIES_METRIC_FIELD_NAME:()=>o.aI,TIME_SERIES_TIME_FIELD_NAME:()=>o.LE,TIME_SERIES_VALUE_FIELD_NAME:()=>o.Bc,ThresholdsMode:()=>p.O,TransformationApplicabilityLevels:()=>y.M,VariableHide:()=>P.zL,VariableOrigin:()=>r.$0,VariableRefresh:()=>P.CO,VariableSort:()=>P.ZG,VariableSuggestionsScope:()=>r.uP,VariableSupportBase:()=>j.xi,VariableSupportType:()=>j.Qz,VisualizationSuggestionScore:()=>S.nQ,VisualizationSuggestionsBuilder:()=>S.v2,VisualizationSuggestionsListAppender:()=>S.NV,VizOrientation:()=>S.wV,availableIconsIndex:()=>ue.az,getDefaultRelativeTimeRange:()=>h.Cn,getDefaultTimeRange:()=>h.E2,hasLogsContextSupport:()=>i.Ol,hasLogsContextUiSupport:()=>i.wj,hasQueryExportSupport:()=>u.Ee,hasQueryImportSupport:()=>u.FL,hasQueryModificationSupport:()=>i._0,hasSupplementaryQuerySupport:()=>i.Nc,hasToggleableQueryFiltersSupport:()=>i.FP,isIconName:()=>ue.n6,isLiveChannelJoinEvent:()=>K.Cz,isLiveChannelLeaveEvent:()=>K.jQ,isLiveChannelMessageEvent:()=>K.Z7,isLiveChannelStatusEvent:()=>K.ew,isObject:()=>n.Gv,isSystemOverride:()=>M.Ow,isSystemOverrideWithRef:()=>M.ZW,isTruthy:()=>n.zz,isUnsignedPluginSignature:()=>ee.x,isValidLiveChannelAddress:()=>K.aj,makeArrayIndexableVector:()=>T.N,parseLiveChannelAddress:()=>K.DG,patchArrayVectorProrotypeMethods:()=>T.V,preferredVisualizationTypes:()=>n.Nx,toIconName:()=>ue.Uo,toLiveChannelId:()=>K.Qp});var t=e(58649),n=e(39070),o=e(11261),s=e(41260),r=e(91890),g=e(94624),u=e(73372),c=e(8790),i=e(9557),l=e(64388),f=e(98102),d=e.n(f),oe={};for(const ge in f)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isObject","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","hasQueryModificationSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType"].indexOf(ge)<0&&(oe[ge]=()=>f[ge]);e.d(A,oe);var h=e(43127),p=e(50082),m=e(25019),a=e(50349),v=e.n(a),oe={};for(const ge in a)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isObject","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","hasQueryModificationSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch"].indexOf(ge)<0&&(oe[ge]=()=>a[ge]);e.d(A,oe);var E=e(49812),D=e.n(E),oe={};for(const ge in E)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isObject","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","hasQueryModificationSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch"].indexOf(ge)<0&&(oe[ge]=()=>E[ge]);e.d(A,oe);var b=e(22544),C=e.n(b),oe={};for(const ge in b)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isObject","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","hasQueryModificationSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch"].indexOf(ge)<0&&(oe[ge]=()=>b[ge]);e.d(A,oe);var y=e(81010),M=e(37055),T=e(35853),I=e(41987),x=e(40187),S=e(47070),O=e(43429),P=e(12470),L=e(24293),U=e(25137),R=e(62625),B=e(93015),H=e.n(B),oe={};for(const ge in B)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isObject","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","hasQueryModificationSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch","SpecialValue","TransformationApplicabilityLevels","FieldConfigProperty","isSystemOverride","isSystemOverrideWithRef","makeArrayIndexableVector","patchArrayVectorProrotypeMethods","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(ge)<0&&(oe[ge]=()=>B[ge]);e.d(A,oe);var w=e(38893),N=e.n(w),oe={};for(const ge in w)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isObject","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","hasQueryModificationSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch","SpecialValue","TransformationApplicabilityLevels","FieldConfigProperty","isSystemOverride","isSystemOverrideWithRef","makeArrayIndexableVector","patchArrayVectorProrotypeMethods","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(ge)<0&&(oe[ge]=()=>w[ge]);e.d(A,oe);var V=e(50219),G=e.n(V),oe={};for(const ge in V)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isObject","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","hasQueryModificationSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch","SpecialValue","TransformationApplicabilityLevels","FieldConfigProperty","isSystemOverride","isSystemOverrideWithRef","makeArrayIndexableVector","patchArrayVectorProrotypeMethods","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(ge)<0&&(oe[ge]=()=>V[ge]);e.d(A,oe);var _=e(26272),K=e(55004),j=e(29505),k=e(58318),Y=e.n(k),oe={};for(const ge in k)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isObject","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","hasQueryModificationSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch","SpecialValue","TransformationApplicabilityLevels","FieldConfigProperty","isSystemOverride","isSystemOverrideWithRef","makeArrayIndexableVector","patchArrayVectorProrotypeMethods","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(ge)<0&&(oe[ge]=()=>k[ge]);e.d(A,oe);var ee=e(51527),re=e(43585),J=e(64367),ne=e.n(J),oe={};for(const ge in J)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isObject","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","hasQueryModificationSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch","SpecialValue","TransformationApplicabilityLevels","FieldConfigProperty","isSystemOverride","isSystemOverrideWithRef","makeArrayIndexableVector","patchArrayVectorProrotypeMethods","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(ge)<0&&(oe[ge]=()=>J[ge]);e.d(A,oe);var q=e(12463),te=e.n(q),oe={};for(const ge in q)["default","isUnsignedPluginSignature","PluginExtensionTypes","PluginExtensionPoints","DEFAULT_SAML_NAME","GAUGE_DEFAULT_MAXIMUM","GAUGE_DEFAULT_MINIMUM","LoadingState","NullValueMode","isObject","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","hasQueryModificationSupport","hasSupplementaryQuerySupport","hasToggleableQueryFiltersSupport","PageLayoutType","DefaultTimeZone","TIME_FORMAT","getDefaultRelativeTimeRange","getDefaultTimeRange","ThresholdsMode","MappingType","SpecialValueMatch","SpecialValue","TransformationApplicabilityLevels","FieldConfigProperty","isSystemOverride","isSystemOverrideWithRef","makeArrayIndexableVector","patchArrayVectorProrotypeMethods","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(ge)<0&&(oe[ge]=()=>q[ge]);e.d(A,oe);var ue=e(8887),ie=e(74135)},19484:(Q,A,e)=>{"use strict";e.d(A,{R:()=>t});var t=(n=>(n.Grid="grid",n.List="list",n))(t||{})},26272:(Q,A,e)=>{"use strict";e.d(A,{Tq:()=>g,ee:()=>s,kb:()=>r,r1:()=>o});var t=e(89550),n=e(65463);const o={alertSuccess:(0,t.R)("alert-success"),alertWarning:(0,t.R)("alert-warning"),alertError:(0,t.R)("alert-error")},s={refresh:(0,t.R)("refresh"),componentDidMount:(0,t.R)("component-did-mount"),dataReceived:(0,t.R)("data-received"),dataError:(0,t.R)("data-error"),dataFramesReceived:(0,t.R)("data-frames-received"),dataSnapshotLoad:(0,t.R)("data-snapshot-load"),editModeInitialized:(0,t.R)("init-edit-mode"),initPanelActions:(0,t.R)("init-panel-actions"),initialized:(0,t.R)("panel-initialized"),panelTeardown:(0,t.R)("panel-teardown"),render:(0,t.R)("render")};class r extends n.x{}r.type="graph-hover";class g extends n.a{constructor(){super(...arguments),this.payload={point:{}}}}g.type="graph-hover-clear"},55004:(Q,A,e)=>{"use strict";e.d(A,{Cz:()=>g,DG:()=>i,Qp:()=>f,Z7:()=>c,ZF:()=>o,aj:()=>l,ew:()=>r,jQ:()=>u,o4:()=>s,os:()=>n,qD:()=>t});var t=(d=>(d.DataSource="ds",d.Plugin="plugin",d.Grafana="grafana",d.Stream="stream",d))(t||{}),n=(d=>(d.DataStream="stream",d.DataFrame="frame",d.JSON="json",d))(n||{}),o=(d=>(d.Pending="pending",d.Connected="connected",d.Connecting="connecting",d.Disconnected="disconnected",d.Shutdown="shutdown",d.Invalid="invalid",d))(o||{}),s=(d=>(d.Status="status",d.Join="join",d.Leave="leave",d.Message="message",d))(s||{});function r(d){return d.type==="status"}function g(d){return d.type==="join"}function u(d){return d.type==="leave"}function c(d){return d.type==="message"}function i(d){if(d?.length){let h=d.trim().split("/");if(h.length>=3)return{scope:h[0],namespace:h[1],path:h.slice(2).join("/")}}}function l(d){return!!(d?.path&&d.namespace&&d.scope)}function f(d){if(!d.scope)return"";let h=d.scope;return!d.namespace||(h+="/"+d.namespace,!d.path)?h:h+"/"+d.path}},9557:(Q,A,e)=>{"use strict";e.d(A,{$b:()=>n,Aj:()=>c,FP:()=>f,Nc:()=>i,Ol:()=>g,ZF:()=>r,_0:()=>d,_C:()=>s,cF:()=>u,fY:()=>t.fY,tG:()=>o,uH:()=>t.uH,wj:()=>l});var t=e(52622),n=(h=>(h.emerg="critical",h.fatal="critical",h.alert="critical",h.crit="critical",h.critical="critical",h.warn="warning",h.warning="warning",h.err="error",h.eror="error",h.error="error",h.info="info",h.information="info",h.informational="info",h.notice="info",h.dbug="debug",h.debug="debug",h.trace="trace",h.unknown="unknown",h))(n||{}),o=(h=>(h[h.Number=0]="Number",h[h.String=1]="String",h[h.LabelsMap=2]="LabelsMap",h[h.Error=3]="Error",h))(o||{}),s=(h=>(h.none="No de-duplication",h.exact="De-duplication of successive lines that are identical, ignoring ISO datetimes.",h.numbers="De-duplication of successive lines that are identical when ignoring numbers, e.g., IP addresses, latencies.",h.signature="De-duplication of successive lines that have identical punctuation and whitespace.",h))(s||{}),r=(h=>(h.Backward="BACKWARD",h.Forward="FORWARD",h))(r||{});const g=h=>!h||typeof h!="object"?!1:"getLogRowContext"in h;var u=(h=>(h.LogsVolume="LogsVolume",h.LogsSample="LogsSample",h))(u||{}),c=(h=>(h.FullRange="FullRange",h.Limited="Limited",h))(c||{});const i=(h,p)=>h?("getDataProvider"in h||"getSupplementaryRequest"in h)&&"getSupplementaryQuery"in h&&"getSupportedSupplementaryQueryTypes"in h&&h.getSupportedSupplementaryQueryTypes().includes(p):!1,l=h=>!h||typeof h!="object"?!1:"getLogRowContextUi"in h,f=h=>h!=null&&typeof h=="object"&&"toggleQueryFilter"in h&&"queryHasFilter"in h,d=h=>h!=null&&typeof h=="object"&&"modifyQuery"in h&&"getSupportedQueryModifications"in h},64388:(Q,A,e)=>{"use strict";e.d(A,{k:()=>t});var t=(n=>(n[n.Standard=0]="Standard",n[n.Canvas=1]="Canvas",n[n.Custom=2]="Custom",n))(t||{})},62625:(Q,A,e)=>{"use strict";e.d(A,{X:()=>t});var t=(n=>(n.None="None",n.Viewer="Viewer",n.Editor="Editor",n.Admin="Admin",n))(t||{})},47070:(Q,A,e)=>{"use strict";e.d(A,{NV:()=>u,nQ:()=>r,v2:()=>g,wV:()=>s});var t=e(2543),n=e.n(t),o=e(11261),s=(c=>(c.Auto="auto",c.Vertical="vertical",c.Horizontal="horizontal",c))(s||{}),r=(c=>(c[c.Best=100]="Best",c[c.Good=70]="Good",c[c.OK=50]="OK",c))(r||{});class g{constructor(i,l){this.list=[],this.data=i,this.panel=l,this.dataSummary=this.computeDataSummary()}getListAppender(i){return new u(this.list,i)}computeDataSummary(){const i=this.data?.series||[];let l=0,f=0,d=0,h=0,p=0,m=0,a;for(const v of i){h+=v.length,v.meta?.preferredVisualisationType&&(a=v.meta.preferredVisualisationType);for(const E of v.fields)switch(m++,E.type){case o.PU.number:l+=1;break;case o.PU.time:f+=1;break;case o.PU.string:d+=1;break}v.length>p&&(p=v.length)}return{numberFieldCount:l,timeFieldCount:f,stringFieldCount:d,rowCountTotal:h,rowCountMax:p,fieldCount:m,preferredVisualisationType:a,frameCount:i.length,hasData:h>0,hasTimeField:f>0,hasNumberField:l>0,hasStringField:d>0}}getList(){return this.list}}class u{constructor(i,l){this.list=i,this.defaults=l}append(i){this.list.push((0,t.defaultsDeep)(i,this.defaults))}}},43429:(Q,A,e)=>{"use strict";e.d(A,{Ac:()=>o,QE:()=>n,Ud:()=>u,ZK:()=>r,ib:()=>g,kv:()=>s,pn:()=>t});var t=(c=>(c.alpha="alpha",c.beta="beta",c.stable="stable",c.deprecated="deprecated",c))(t||{}),n=(c=>(c.panel="panel",c.datasource="datasource",c.app="app",c.renderer="renderer",c.secretsmanager="secretsmanager",c))(n||{}),o=(c=>(c.internal="internal",c.valid="valid",c.invalid="invalid",c.modified="modified",c.missing="missing",c))(o||{}),s=(c=>(c.grafana="grafana",c.commercial="commercial",c.community="community",c.private="private",c.core="core",c))(s||{}),r=(c=>(c.missingSignature="signatureMissing",c.invalidSignature="signatureInvalid",c.modifiedSignature="signatureModified",c))(r||{}),g=(c=>(c.dashboard="dashboard",c.page="page",c.panel="panel",c.datasource="datasource",c))(g||{});class u{addConfigPage(i){return this.configPages||(this.configPages=[]),this.configPages.push(i),this}setChannelSupport(){return console.warn("[deprecation] plugin is using ignored option: setChannelSupport",this.meta),this}constructor(){this.meta={}}}},74135:(Q,A,e)=>{"use strict";e.d(A,{S:()=>n,u:()=>t});var t=(o=>(o.link="link",o.component="component",o))(t||{}),n=(o=>(o.AlertInstanceAction="grafana/alerting/instance/action",o.CommandPalette="grafana/commandpalette/action",o.DashboardPanelMenu="grafana/dashboard/panel/menu",o.DataSourceConfig="grafana/datasources/config",o.ExploreToolbarAction="grafana/explore/toolbar/action",o.UserProfileTab="grafana/user/profile/tab",o))(n||{})},51527:(Q,A,e)=>{"use strict";e.d(A,{x:()=>n});var t=e(43429);function n(o){return o&&o!==t.Ac.valid&&o!==t.Ac.internal}},73372:(Q,A,e)=>{"use strict";e.d(A,{D_:()=>n,Ee:()=>s,FL:()=>o,QR:()=>t.QR});var t=e(52622),n=(r=>(r.Equal="Equal",r.NotEqual="NotEqual",r.EqualRegEx="EqualRegEx",r.NotEqualRegEx="NotEqualRegEx",r))(n||{});const o=r=>!r||typeof r!="object"?!1:"importFromAbstractQueries"in r,s=r=>!r||typeof r!="object"?!1:"exportToAbstractQueries"in r},98102:()=>{},64367:()=>{},12470:(Q,A,e)=>{"use strict";e.d(A,{CO:()=>t,ZG:()=>n,zL:()=>o});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[s.naturalAsc=7]="naturalAsc",s[s.naturalDesc=8]="naturalDesc",s))(n||{}),o=(s=>(s[s.dontHide=0]="dontHide",s[s.hideLabel=1]="hideLabel",s[s.hideVariable=2]="hideVariable",s))(o||{})},25137:(Q,A,e)=>{"use strict";e.d(A,{I:()=>t});var t=(n=>(n.Light="light",n.Dark="dark",n))(t||{})},50082:(Q,A,e)=>{"use strict";e.d(A,{O:()=>t});var t=(n=>(n.Absolute="absolute",n.Percentage="percentage",n))(t||{})},43127:(Q,A,e)=>{"use strict";e.d(A,{Cn:()=>g,E2:()=>r,G$:()=>s,lE:()=>o});var t=e(52622),n=e(47232);const o=t.vp,s="YYYY-MM-DD HH:mm:ss";function r(){const u=(0,n.KQ)();return{from:(0,n.KQ)(u).subtract(6,"hour"),to:u,raw:{from:"now-6h",to:"now"}}}function g(){return{from:600,to:0}}},38893:()=>{},81010:(Q,A,e)=>{"use strict";e.d(A,{M:()=>t,N:()=>n});var t=(o=>(o[o.NotPossible=-1]="NotPossible",o[o.NotApplicable=0]="NotApplicable",o[o.Applicable=1]="Applicable",o[o.HighlyApplicable=2]="HighlyApplicable",o))(t||{}),n=(o=>(o.True="true",o.False="false",o.Null="null",o.Empty="empty",o))(n||{})},25019:(Q,A,e)=>{"use strict";e.d(A,{W:()=>n,d:()=>t});var t=(o=>(o.ValueToText="value",o.RangeToText="range",o.RegexToText="regex",o.SpecialValue="special",o))(t||{}),n=(o=>(o.True="true",o.False="false",o.Null="null",o.NaN="nan",o.NullAndNaN="null+nan",o.Empty="empty",o))(n||{})},29505:(Q,A,e)=>{"use strict";e.d(A,{J$:()=>o,Qz:()=>t,ZV:()=>r,f5:()=>s,xi:()=>n});var t=(g=>(g.Legacy="legacy",g.Standard="standard",g.Custom="custom",g.Datasource="datasource",g))(t||{});class n{}class o extends n{getType(){return"standard"}}class s extends n{getType(){return"custom"}}class r extends n{getType(){return"datasource"}}},35853:(Q,A,e)=>{"use strict";e.d(A,{N:()=>n,V:()=>t});function t(){Object.getOwnPropertyDescriptor(Array.prototype,"toArray")||Object.defineProperties(Array.prototype,{get:{value:function(o){return this[o]},writable:!0,enumerable:!1,configurable:!0},set:{value:function(o,s){this[o]=s},writable:!0,enumerable:!1,configurable:!0},add:{value:function(o){this.push(o)},writable:!0,enumerable:!1,configurable:!0},toArray:{value:function(){return this},writable:!0,enumerable:!1,configurable:!0}})}t();function n(o){return new Proxy(o,{get(s,r,g){if(typeof r!="symbol"){const u=+r;if(String(u)===r)return s.get(u)}return Reflect.get(s,r,g)},set(s,r,g,u){if(typeof r!="symbol"){const c=+r;if(String(c)===r)return s.set(c,g),!0}return Reflect.set(s,r,g,u)}})}},60264:(Q,A,e)=>{"use strict";e.d(A,{bk:()=>u,pv:()=>l,iF:()=>i});var t=e(2543),n=e(69550),o=e(27310),s=e(39070),r=e(83077);class g{constructor(){this.properties=[]}addCustomEditor(d){return this.properties.push(d),this}getRegistry(){return new r.O(()=>this.properties)}getItems(){return this.properties}}class u extends g{addNumberInput(d){return this.addCustomEditor({...d,id:d.path,override:n.D.get("number").editor,editor:n.D.get("number").editor,process:o.m0,shouldApply:d.shouldApply??(()=>!0),settings:d.settings||{}})}addSliderInput(d){return this.addCustomEditor({...d,id:d.path,override:n.D.get("slider").editor,editor:n.D.get("slider").editor,process:o.m0,shouldApply:d.shouldApply??(()=>!0),settings:d.settings||{}})}addTextInput(d){return this.addCustomEditor({...d,id:d.path,override:n.D.get("text").editor,editor:n.D.get("text").editor,process:o.OU,shouldApply:d.shouldApply??(()=>!0),settings:d.settings||{}})}addSelect(d){return this.addCustomEditor({...d,id:d.path,override:n.D.get("select").editor,editor:n.D.get("select").editor,process:o.hL,shouldApply:d.shouldApply?d.shouldApply:()=>!0,settings:d.settings||{options:[]}})}addRadio(d){return this.addCustomEditor({...d,id:d.path,override:n.D.get("radio").editor,editor:n.D.get("radio").editor,process:o.hL,shouldApply:d.shouldApply?d.shouldApply:()=>!0,settings:d.settings||{options:[]}})}addBooleanSwitch(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("boolean").editor,override:n.D.get("boolean").editor,process:o.FM,shouldApply:d.shouldApply?d.shouldApply:()=>!0,settings:d.settings||{}})}addColorPicker(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("color").editor,override:n.D.get("color").editor,process:o.hS,shouldApply:d.shouldApply?d.shouldApply:()=>!0,settings:d.settings||{}})}addUnitPicker(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("unit").editor,override:n.D.get("unit").editor,process:o.lG,shouldApply:d.shouldApply?d.shouldApply:()=>!0,settings:d.settings||{}})}addFieldNamePicker(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("field-name").editor,override:n.D.get("field-name").editor,process:o.hS,shouldApply:d.shouldApply?d.shouldApply:()=>!0,settings:d.settings||{}})}addGenericEditor(d,h){return this.addCustomEditor({...d,id:d.path,editor:h,override:h,process:o.hS,shouldApply:d.shouldApply?d.shouldApply:()=>!0,settings:d.settings||{}})}}class c{constructor(d){this.cfg=d,this.path="",this.id="nested-panel-options",this.name="nested",this.editor=()=>null,this.getBuilder=()=>this.cfg.build,this.getNestedValueAccess=h=>{const p=this.cfg.values;return p?p(h):{getValue:m=>h.getValue(`${this.path}.${m}`),onChange:(m,a)=>h.onChange(`${this.path}.${m}`,a)}},this.path=d.path,this.category=d.category,this.defaultValue=this.getDefaultValue(d)}getDefaultValue(d){let h=(0,s.Gv)(d.defaultValue)?(0,t.cloneDeep)(d.defaultValue):{};const p=new l;d.build(p,{data:[]});for(const m of p.getItems())m.defaultValue!=null&&(0,t.set)(h,m.path,m.defaultValue);return h}}function i(f){return(0,s.Gv)(f)&&"id"in f&&f.id==="nested-panel-options"}class l extends g{addNestedOptions(d){const h=new c(d);return this.addCustomEditor(h)}addNumberInput(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("number").editor})}addSliderInput(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("slider").editor})}addTextInput(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("text").editor})}addStringArray(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("strings").editor})}addSelect(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("select").editor})}addMultiSelect(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("multi-select").editor})}addRadio(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("radio").editor})}addBooleanSwitch(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("boolean").editor})}addColorPicker(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("color").editor,settings:d.settings||{}})}addTimeZonePicker(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("timezone").editor,settings:d.settings||{}})}addUnitPicker(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("unit").editor})}addFieldNamePicker(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("field-name").editor})}addDashboardPicker(d){return this.addCustomEditor({...d,id:d.path,editor:n.D.get("dashboard-uid").editor})}}},28802:(Q,A,e)=>{"use strict";e.d(A,{t:()=>o});var t=e(2543),n=e.n(t);function o(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)}},14588:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{moveItemImmutably:()=>n,sortValues:()=>r});var t=e(52622);function n(g,u,c){const i=[...g];return Array.prototype.splice.call(i,c,0,Array.prototype.splice.call(i,u,1)[0]),i}const o=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),s=(g,u)=>g-u;function r(g){return(u,c)=>{if(u===c)return 0;if(c==null||typeof c=="string"&&c.trim()==="")return-1;if(u==null||typeof u=="string"&&u?.trim()==="")return 1;let i=o.compare;return typeof u=="number"&&typeof c=="number"&&(i=s),g===t.xB.Descending?i(c,u):i(u,c)}}},11710:(Q,A,e)=>{"use strict";e.d(A,{b:()=>o,k:()=>n});var t=e(83077),n=(s=>(s.Add="+",s.Subtract="-",s.Divide="/",s.Multiply="*",s))(n||{});const o=new t.O(()=>[{id:"+",name:"Add",operation:(s,r)=>s+r,binaryOperationID:"+"},{id:"-",name:"Subtract",operation:(s,r)=>s-r,binaryOperationID:"-"},{id:"*",name:"Multiply",operation:(s,r)=>s*r,binaryOperationID:"*"},{id:"/",name:"Divide",operation:(s,r)=>s/r,binaryOperationID:"/"}])},72436:(Q,A,e)=>{"use strict";e.d(A,{F7:()=>l,Jh:()=>f,_O:()=>E,i8:()=>h});var t=e(2543),n=e.n(t),o=e(44809),s=e.n(o),r=e(37471),g=e(14236),u=e(28240),c=e(11261),i=e(83195),l=(D=>(D[D.full=0]="full",D[D.name=1]="name",D[D.none=2]="none",D))(l||{});function f(D,b){return new h(b).readCSV(D)}var d=(D=>(D[D.Starting=0]="Starting",D[D.InHeader=1]="InHeader",D[D.ReadingRows=2]="ReadingRows",D))(d||{});class h{constructor(b){this.chunk=(C,y)=>{for(let M=0;M<C.data.length;M++){const T=C.data[M];if(T.length<1)continue;const I=T[0];if(I){if(I.startsWith("#")){const x=I.indexOf("#",2);if(x>0){const S=I.slice(1,x),O=S==="name";if(O||{unit:"#"}.hasOwnProperty(S)){this.state===2&&(this.current=new r.k({fields:[]}),this.data.push(this.current));const L=I.slice(x+1);if(O){this.current.addFieldFor(void 0,L);for(let U=1;U<T.length;U++)this.current.addFieldFor(void 0,T[U])}else{const{fields:U}=this.current;for(let R=0;R<U.length;R++){U[R].config||(U[R].config={});const B=U[R].config;B[S]=R===0?L:T[R]}}this.state=1;continue}}else if(this.state===0){this.state=1;continue}continue}if(this.state===0){if((0,g.HW)(I)===c.PU.string){for(const S of T)this.current.addFieldFor(void 0,S);this.state=1;continue}this.state=1}}if(this.state,this.state=2,T.length>this.current.fields.length){const{fields:x}=this.current;for(let S=x.length;S<T.length;S++)this.current.addFieldFor(T[S]);this.callback&&this.callback.onHeader(this.current.fields)}this.current.appendRow(T),this.callback&&this.callback.onRow(T)}},b||(b={}),this.config=b.config||{},this.callback=b.callback,this.current=new r.k({fields:[]}),this.state=0,this.data=[]}readCSV(b){this.current=new r.k({fields:[]}),this.data=[this.current];const C={...this.config,dynamicTyping:!1,skipEmptyLines:!0,comments:!1,chunk:this.chunk};return s().parse(b,C),this.data}}function p(D,b){if(D==null)return"";const C=D.toString();return C.includes('"')?b.quoteChar+C.replace(/"/gi,'""')+b.quoteChar:C.includes(` `)||b.delimiter&&C.includes(b.delimiter)?b.quoteChar+C+b.quoteChar:C}function m(D,b){return D.display?C=>{const y=D.display(C);return p((0,i.cN)(y),b)}:C=>p(C,b)}function a(D,b,C){const y=D==="name",M=D==="type";for(const T of b){const I=T.config;if(y||M||I&&I.hasOwnProperty(D)){let x="#"+D+"#";for(let S=0;S<b.length;S++){S>0&&(x=x+C.delimiter);let O=b[S].name;M?O=b[S].type:y||(O=b[S].config[D]),O&&(x=x+p(O,C))}return x+C.newline}}return""}function v(){const D=["x","y"];return D.toLocaleString?D.toLocaleString().charAt(1):","}function E(D,b){if(!D)return"";b=(0,t.defaults)(b,{delimiter:v(),newline:`\r `,quoteChar:'"',encoding:"",headerStyle:1,useExcelHeader:!1});let C=b.useExcelHeader?`sep=${b.delimiter}${b.newline}`:"";for(let y=0;y<D.length;y++){const M=D[y],{fields:T}=M;if(T.length===0)continue;if(b.headerStyle===0)C=C+a("name",T,b)+a("type",T,b)+a("unit",T,b)+a("dateFormat",T,b);else if(b.headerStyle===1){for(let x=0;x<T.length;x++)x>0&&(C+=b.delimiter),C+=`"${(0,u.Ct)(T[x],M).replace(/"/g,'""')}"`;C+=b.newline}const I=T[0].values.length;if(I>0){const x=T.map(S=>m(S,b));for(let S=0;S<I;S++){for(let O=0;O<T.length;O++){O>0&&(C=C+b.delimiter);const P=T[O].values[S];P!==null&&(C=C+x[O](P))}S!==I-1&&(C=C+b.newline)}}y!==D.length-1&&(C=C+b.newline)}return C}},6709:(Q,A,e)=>{"use strict";e.d(A,{c:()=>o,u:()=>s});var t=e(71733),n=e(76885);const o={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(c){const{onClickFn:i,replaceVariables:l,link:f,scopedVars:d,range:h,field:p,internalLink:m}=c,a=g(f.internal?.query,d,l),v=g(f.internal?.panelsState,d,l),E=g(f.internal?.meta?.correlationData,d,l),D=f.title?f.title:m.datasourceName;return{title:l(D,d),href:r(m.datasourceUid,a,h,v),onClick:i?b=>{b.preventDefault&&b.preventDefault(),i({datasourceUid:m.datasourceUid,queries:[a],panelsState:v,correlationHelperData:E,range:h})}:void 0,target:f?.targetBlank?"_blank":"_self",origin:p}}function r(c,i,l,f){return t.I.assureBaseUrl(`/explore?left=${encodeURIComponent((0,n.Pp)({...l?.raw?{range:(0,n.sQ)(l.raw)}:{},datasource:c,queries:[i],panelsState:f}))}`)}function g(c,i,l){if(!c)return c;if(typeof c=="string")return l(c,i);const f=JSON.parse(JSON.stringify(c));return u(f,i,l)}function u(c,i,l){for(const f of Object.keys(c))typeof c[f]=="string"?c[f]=l(c[f],i):typeof c[f]=="object"&&c[f]!==null&&(c[f]=u(c[f],i,l));return c}},22391:(Q,A,e)=>{"use strict";e.d(A,{BD:()=>i,EX:()=>l,Iz:()=>r,PG:()=>u,QP:()=>a,fN:()=>s,lO:()=>p,mn:()=>c,p$:()=>o,pN:()=>h,wY:()=>f,wp:()=>m,yV:()=>d,zX:()=>g});var t=e(2543),n=e.n(t);function o(v){return{uid:v.uid,type:v.type}}function s(v){return typeof v=="object"&&typeof v?.uid=="string"}function r(v){if(s(v))return v.uid;if((0,t.isString)(v))return v}const g=(v,E)=>D=>{h(v,E,D.currentTarget.value)},u=(v,E)=>D=>{p(v,E,D.currentTarget.value)},c=(v,E)=>D=>{m(v,E,D.currentTarget.value)},i=(v,E)=>D=>{p(v,E,D.value)},l=(v,E)=>D=>{p(v,E,D.currentTarget.checked)},f=(v,E)=>D=>{m(v,E,D.value)},d=(v,E)=>D=>{a(v,E)};function h(v,E,D){const b=v.options;v.onOptionsChange({...b,[E]:D})}const p=(v,E,D)=>{const b=v.options;v.onOptionsChange({...b,jsonData:{...b.jsonData,[E]:D}})},m=(v,E,D)=>{const b=v.options;v.onOptionsChange({...b,secureJsonData:{...b.secureJsonData?b.secureJsonData:{},[E]:D}})},a=(v,E)=>{const D=v.options;v.onOptionsChange({...D,secureJsonData:{...D.secureJsonData?D.secureJsonData:{},[E]:""},secureJsonFields:{...D.secureJsonFields,[E]:!1}})}},95344:(Q,A,e)=>{"use strict";e.d(A,{l:()=>n});const t={},n=(o,s,r)=>{let g=`[Deprecation warning] ${o}: ${s} is deprecated`;r&&(g+=`. Use ${r} instead`);const u=Date.now(),c=t[g];(!c||u-c>1e4)&&(console.warn(g),t[g]=u)}},87885:(Q,A,e)=>{"use strict";e.d(A,{f:()=>t});var t=(n=>(n[n.Transformations=0]="Transformations",n[n.FieldConfig=1]="FieldConfig",n[n.FieldConfigOverrides=2]="FieldConfigOverrides",n))(t||{})},39306:(Q,A,e)=>{"use strict";e.d(A,{R:()=>n,r:()=>o});var t=e(39070);function n({xField:s,yField:r,nullValueMode:g}){const u=s.values,c=r.values,i=u.length;if(c.length!==i)throw new Error("Unexpected field length");const l=g===t.UW.Ignore,f=g===t.UW.AsZero,d=[];for(let h=0;h<i;h++){const p=u[h];let m=c[h];if(m===null){if(l)continue;f&&(m=0)}p!==null&&d.push([p,m])}return d}function o(s,r){if(!r.from||!r.to||!s||s.length===0)return[];const g=r.from.valueOf(),u=r.to.valueOf(),c=s[0][1];return[[g,c],[u,c]]}},94032:(Q,A,e)=>{"use strict";e.d(A,{kP:()=>d.k,F7:()=>r.F7,i8:()=>r.i8,cI:()=>b.c,fu:()=>C.f,bk:()=>a.bk,An:()=>I.An,uc:()=>p.u,pv:()=>a.pv,OR:()=>n.O,_G:()=>h._,to:()=>M.t,XC:()=>t,bP:()=>d.b,tj:()=>i,Eg:()=>x.E,bh:()=>I.bh,lt:()=>s.l,yO:()=>g.yO,s6:()=>g.s6,h6:()=>g.h6,p$:()=>o.p$,Iz:()=>o.Iz,RZ:()=>v.R,rG:()=>v.r,cs:()=>x.c,tY:()=>l,E6:()=>u.E,dO:()=>f,fN:()=>o.fN,RI:()=>c.R,Ig:()=>E.I,Yi:()=>y.Y,uS:()=>b.u,_p:()=>g._p,_8:()=>O._,wm:()=>c.w,PG:()=>o.PG,EX:()=>o.EX,BD:()=>o.BD,zX:()=>o.zX,yV:()=>o.yV,mn:()=>o.mn,wY:()=>o.wY,Xy:()=>g.Xy,Jh:()=>r.Jh,j_:()=>S.j,hB:()=>u.h,Pp:()=>D.Pp,_O:()=>r._O,zL:()=>m.z,sQ:()=>D.sQ,j7:()=>h.j,lO:()=>o.lO,pN:()=>o.pN,QP:()=>o.QP,wp:()=>o.wp,kM:()=>D.kM,kz:()=>T.k});var t=e(14588),n=e(83077),o=e(22391),s=e(95344),r=e(72436),g=e(8249),u=e(97706),c=e(92041);const i=["#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"],l=P=>{let L,U,R=Number.MAX_VALUE;for(let B=0;B<P.values.length;B++){const H=P.values[B];if(L!==void 0){const w=H-L;U===void 0&&(R=w),w<R&&(R=w)}L=H}return R},f=P=>{for(let L=0;L<P.values.length;L++){const U=P.values[L];if(U!=null){const R=U.toString();if(R.length===13&&R%1e3!==0)return!0}}return!1};var d=e(11710),h=e(27618),p=e(25352),m=e(50877),a=e(60264),v=e(39306),E=e(71733),D=e(76885),b=e(6709),C=e(87885),y=e(92341),M=e(28802),T=e(72495),I=e(62398),x=e(92053),S=e(43659),O=e(80147)},8249:(Q,A,e)=>{"use strict";e.d(A,{Xy:()=>n,_p:()=>r,h6:()=>g,s6:()=>s,yO:()=>o});const t=/\b(\w+)(!?=~?)"([^"\n]*?)"/g;function n(u){const c={};return u.replace(t,(i,l,f,d)=>(c[l]=d,"")),c}function o(u){return u.reduce((c,i)=>{if(!i)throw new Error("Need parsed labels to find common labels.");return Object.keys(i).forEach(l=>{(c[l]===void 0||c[l]!==i[l])&&delete c[l]}),Object.keys(c).forEach(l=>{i[l]===void 0&&delete c[l]}),c},{...u[0]})}function s(u,c){const i={...u};return Object.keys(c).forEach(l=>{delete i[l]}),i}function r(u,c){if(!u)return!0;for(const[i,l]of Object.entries(u))if(!c||c[i]!==l)return!1;return!0}function g(u,c="",i){if(!u||Object.keys(u).length===0)return c;const f=Object.keys(u).sort().map(d=>`${d}="${u[d]}"`).join(", ");return i?f:["{",f,"}"].join("")}},71733:(Q,A,e)=>{"use strict";e.d(A,{I:()=>f});var t=e(40672),n=e(76885);let o={appSubUrl:""},s,r;const g=d=>{try{return new URL(d)}catch{return}},u=d=>{const h=g(d);if(h&&h.origin!==window.location.origin)return d;const p=o.appSubUrl??"",m=p.endsWith("/")?1:0,a=d.startsWith("http");let v=p;return(!d.startsWith("/")||a)&&(v=`${window.location.origin}${p}`),d.length>0&&(d.indexOf(v+"/")===0||d===v)?d.slice(v.length-m):d},c=d=>d.startsWith("/")?`${o.appSubUrl}${u(d)}`:d,f={initialize:d=>{o=d.config,s=d.getTimeRangeForUrl,r=d.getVariablesUrlParams},stripBaseFromUrl:u,assureBaseUrl:c,updateSearchParams:(d,h)=>{const p=new URLSearchParams(h);try{const m=new URL(d);return p.forEach((a,v)=>m.searchParams.set(v,a)),m.href}catch{const m=new URLSearchParams(d);return p.forEach((a,v)=>{m.set(v,a)}),"?"+m.toString()}},getTimeRangeUrlParams:()=>s?n.kM.toUrlParams(s()):null,getVariablesUrlParams:d=>{if(!r)return null;const h=r(d);return n.kM.toUrlParams(h)},getUrlForPartial:(d,h)=>{const p=n.kM.parseKeyValue(d.search.startsWith("?")?d.search.substring(1):d.search);for(const m of Object.keys(h))h[m]===null||h[m]===void 0?delete p[m]:p[m]=h[m];return c(n.kM.renderUrl(d.pathname,p))},processUrl:d=>o.disableSanitizeHtml?d:t.sQ.sanitizeUrl(d)}},92341:(Q,A,e)=>{"use strict";e.d(A,{Y:()=>t});function t(n){return new Proxy(n,{apply(o,s,r){return(typeof Reflect>"u"||!Reflect.construct)&&alert("Browser is too old"),Reflect.construct(o,r,s.constructor)}})}},80147:(Q,A,e)=>{"use strict";e.d(A,{_:()=>t});function t(n,o){return o.id===n?!0:o.aliasIDs?o.aliasIDs.includes(n):!1}},25352:(Q,A,e)=>{"use strict";e.d(A,{u:()=>t});var t=(n=>(n.id="id",n.title="title",n.subTitle="subtitle",n.mainStat="mainstat",n.secondaryStat="secondarystat",n.arc="arc__",n.icon="icon",n.color="color",n.source="source",n.target="target",n.detail="detail__",n.nodeRadius="noderadius",n.thickness="thickness",n.highlighted="highlighted",n))(t||{})},97706:(Q,A,e)=>{"use strict";e.d(A,{E:()=>n,h:()=>t});function t(o,s=0){if(Number.isInteger(o))return o;let r=10**s,g=o*r*(1+Number.EPSILON);return Math.round(g)/r}function n(o){return((""+o).split(".")[1]||"").length}},92041:(Q,A,e)=>{"use strict";e.d(A,{R:()=>n,w:()=>t});const t=o=>Object.keys(o).reduce((s,r)=>(o[r]!==void 0&&(s[r]=o[r]),s),{}),n=o=>typeof o=="object"&&o!==null&&Object.keys(o).length===0},50877:(Q,A,e)=>{"use strict";e.d(A,{z:()=>t});const t=n=>({label:n,value:n})},27618:(Q,A,e)=>{"use strict";e.d(A,{_:()=>n,j:()=>o});var t=e(83077),n=(s=>(s.Abs="abs",s.Exp="exp",s.Ln="ln",s.Floor="floor",s.Ceil="ceil",s))(n||{});const o=new t.O(()=>[{id:"abs",name:"Absolute value",operation:s=>Math.abs(s),unaryOperationID:"abs"},{id:"exp",name:"Natural exponent",operation:s=>Math.exp(s),unaryOperationID:"exp"},{id:"ln",name:"Natural logarithm",operation:s=>Math.log(s),unaryOperationID:"ln"},{id:"floor",name:"Floor",operation:s=>Math.floor(s),unaryOperationID:"floor"},{id:"ceil",name:"Ceiling",operation:s=>Math.ceil(s),unaryOperationID:"ceil"}])},76885:(Q,A,e)=>{"use strict";e.d(A,{Pp:()=>f,kM:()=>l,sQ:()=>d});var t=e(47232);/** * @preserve jquery-param (c) 2015 KNOWLEDGECODE | MIT */function n(h,p){return p&&Object.keys(p).length>0&&(h+="?"+s(p)),h}function o(h,p){return encodeURIComponent(h).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,p?"%20":"+").replace(/[!'()*]/g,function(m){return"%"+m.charCodeAt(0).toString(16).toUpperCase()})}function s(h,p=!0){const m=[],a=/\[\]$/,v=p?(C,y)=>o(C,y):(C,y)=>encodeURIComponent(C),E=C=>Object.prototype.toString.call(C)==="[object Array]",D=(C,y)=>{if(y=typeof y=="function"?y():y===null||y===void 0?"":y,typeof y!="boolean")m[m.length]=v(C,!0)+"="+v(y,!0);else{const M=y?"":"="+v("false",!0);m[m.length]=v(C,!0)+M}},b=(C,y)=>{let M,T,I;if(C)if(E(y))for(M=0,T=y.length;M<T;M++)a.test(C)?D(C,y[M]):b(C,y[M]);else if(y&&String(y)==="[object Object]")for(I in y)b(C+"["+I+"]",y[I]);else D(C,y);else if(E(y))for(M=0,T=y.length;M<T;M++)D(y[M].name,y[M].value);else for(I in y)b(I,y[I]);return m};return b("",h).join("&")}function r(h){return s(h,!1)}function g(h,p){if(p!=null&&p!==""){const m=h.indexOf("?");m!==-1?h.length-m>1&&(h+="&"):h+="?",h+=p}return h}function u(){const p=window.location.search.substring(1).split("&"),m={};for(const a of p){const v=a.split("=");if(v.length>1){const E=decodeURIComponent(v[0]),D=decodeURIComponent(v[1]);E in m?m[E]=[...m[E],D]:m[E]=[D]}else if(v.length===1){const E=decodeURIComponent(v[0]);m[E]=!0}}return m}function c(h){const p={},m=(h||"").split("&");for(let a of m){let v,E,D;if(a&&(E=a=a.replace(/\+/g,"%20"),v=a.indexOf("="),v!==-1&&(E=a.substring(0,v),D=a.substring(v+1)),E=i(E),E!==void 0)){D=D!==void 0?i(D):!0;let b;typeof D=="string"&&D!==""?b=D==="true"||D==="false"?D==="true":D:b=D,p.hasOwnProperty(E)?Array.isArray(p[E])?p[E].push(D):p[E]=[p[E],isNaN(b)?D:b]:p[E]=isNaN(b)?D:b}}return p}function i(h){try{return decodeURIComponent(h)}catch{return}}const l={renderUrl:n,toUrlParams:s,appendQueryToUrl:g,getUrlSearchParams:u,parseKeyValue:c,serializeParams:r};function f(h,p){return p!==void 0&&console.warn("`compact` parameter is deprecated and will be removed in a future release"),JSON.stringify(h)}const d=h=>{let p=h.from;(0,t.Ar)(p)&&(p=p.valueOf().toString());let m=h.to;return(0,t.Ar)(m)&&(m=m.valueOf().toString()),{from:p,to:m}}},62398:(Q,A,e)=>{"use strict";e.d(A,{An:()=>g,Zz:()=>s,bh:()=>u});var t=e(47737),n=e(54479),o=e(25019);function s(i,l){for(const f of i)switch(f.type){case o.d.ValueToText:if(l==null)continue;const d=f.options[l];if(d)return d;break;case o.d.RangeToText:if(l==null)continue;const h=parseFloat(l);if(isNaN(h)||!isNaN(f.options.from)&&h<f.options.from||!isNaN(f.options.to)&&h>f.options.to)continue;return f.options.result;case o.d.RegexToText:if(l==null||typeof l!="string")continue;const a=(0,n.dO)(f.options.pattern);if(l.match(a)){const v={...f.options.result};return v.text!=null&&(v.text=l.replace(a,f.options.result.text||"")),v}case o.d.SpecialValue:switch(f.options.match){case o.W.Null:{if(l==null)return f.options.result;break}case o.W.NaN:{if(typeof l=="number"&&isNaN(l))return f.options.result;break}case o.W.NullAndNaN:{if(typeof l=="number"&&isNaN(l)||l==null)return f.options.result;break}case o.W.True:{if(l===!0||l==="true")return f.options.result;break}case o.W.False:{if(l===!1||l==="false")return f.options.result;break}case o.W.Empty:{if(l==="")return f.options.result;break}}}return null}function r(i){return(typeof i=="number"||typeof i=="string"&&i.trim()!=="")&&!isNaN(i)}var g=(i=>(i[i.ValueToText=1]="ValueToText",i[i.RangeToText=2]="RangeToText",i))(g||{});function u(i,l){const f=[];let d=i.mappingType;if(i.mappingType||(i.valueMaps&&i.valueMaps.length?d=1:i.rangeMaps&&i.rangeMaps.length&&(d=2)),d===1)for(let h=0;h<i.valueMaps.length;h++){const p=i.valueMaps[h];f.push(c({...p,id:h,type:o.d.ValueToText},i.fieldConfig?.defaults?.thresholds||l))}else if(d===2)for(let h=0;h<i.rangeMaps.length;h++){const p=i.rangeMaps[h];f.push(c({...p,id:h,type:o.d.RangeToText},i.fieldConfig?.defaults?.thresholds||l))}return f}function c(i,l){const f={type:o.d.ValueToText,options:{}},d=[];let h;const p=parseFloat(i.text);if(l&&!isNaN(p)){const m=(0,t.yQ)(p,l.steps);m&&m.color&&(h=m.color)}switch(i.type){case 1:case o.d.ValueToText:i.value!=null&&(i.value==="null"?d.push({type:o.d.SpecialValue,options:{match:o.W.Null,result:{text:i.text,color:h}}}):f.options[String(i.value)]={text:i.text,color:h});break;case 2:case o.d.RangeToText:i.from==="null"||i.to==="null"?d.push({type:o.d.SpecialValue,options:{match:o.W.Null,result:{text:i.text,color:h}}}):d.push({type:o.d.RangeToText,options:{from:+i.from,to:+i.to,result:{text:i.text,color:h}}});break}return Object.keys(f.options).length>0&&d.unshift(f),d[0]}},92053:(Q,A,e)=>{"use strict";e.d(A,{E:()=>n,c:()=>o});const t="__searchFilter",n=s=>s&&typeof s=="string"?s.indexOf(t)!==-1:!1,o=s=>{const{query:r,wildcardChar:g}=s;if(!n(r))return{};let{options:u}=s;return u=u||{searchFilter:""},{__searchFilter:{value:u.searchFilter?`${u.searchFilter}${g}`:`${g}`,text:""}}}},72495:(Q,A,e)=>{"use strict";e.d(A,{k:()=>r});var t=e(44240),n=e(39697),o=e(65961),s=e(67791);function r({whileLoading:g,source:u}){return(0,t.h)((0,n.O)(200).pipe((0,o.u)(g),(0,s.Q)(u)),u)}},56496:(Q,A,e)=>{"use strict";e.d(A,{G8:()=>t.G8,Hg:()=>t.Hg,Ke:()=>t.Ke,Mg:()=>t.Mg,Qc:()=>t.Qc,UR:()=>t.UR,cH:()=>t.cH,cN:()=>t.cN,gZ:()=>t.gZ,j9:()=>t.j9,j_:()=>t.j_,uH:()=>t.uH,yP:()=>t.yP});var t=e(83195)},26517:(Q,A,e)=>{"use strict";e.d(A,{Gl:()=>n,cL:()=>r,rT:()=>c,yW:()=>u});var t=e(83195);function n(i,l){const f=["","K","M","B","T"],d=(0,t.yP)(1e3,f);return(h,p,m)=>{if(h==null)return{text:""};const a=h<0;a&&(h=Math.abs(h));const v=d(h,p,m);return l?v.suffix=v.suffix!==void 0?`${v.suffix}${i}`:void 0:v.prefix=i,a&&(v.prefix=`-${v.prefix?.length?v.prefix:""}`),v}}const o=["f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"],s=o.indexOf("");function r(i){const l=o.findIndex(f=>f.normalize("NFKD")===i.normalize("NFKD"));return l<0?0:l-s}const g=["","Ki","Mi","Gi","Ti","Pi","Ei","Zi","Yi"];function u(i,l=0){const f=g.map(d=>" "+d+i);return(0,t.yP)(1024,f,l)}function c(i,l=0){const f=o.map(d=>" "+d+i);return(0,t.yP)(1e3,f,s+l)}},83195:(Q,A,e)=>{"use strict";e.d(A,{Qc:()=>ue,cN:()=>j,j_:()=>Te,Ke:()=>Re,uH:()=>Ee,j9:()=>oe,Hg:()=>he,yP:()=>ge,UR:()=>De,cH:()=>pe,Mg:()=>re,gZ:()=>ne,G8:()=>te});var t=e(2543);function n(me,Me){return me===null?{text:""}:{text:re(me,Me),suffix:"%"}}function o(me,Me){return me===null?{text:""}:{text:re(100*me,Me),suffix:"%"}}function s(me,Me){if(me==null)return{text:""};const ye=r(me,Me);return ye.text.substring(0,1)==="-"?ye.text="-0x"+ye.text.substring(1):ye.text="0x"+ye.text,ye}function r(me,Me){return me==null?{text:""}:{text:parseFloat(re(me,Me)).toString(16).toUpperCase()}}function g(me,Me){return me==null?{text:""}:{text:me.toExponential(Me??void 0)}}var u=e(72724),c=e(42994),i=e(47232),l=(me=>(me.Year="year",me.Month="month",me.Week="week",me.Day="day",me.Hour="hour",me.Minute="minute",me.Second="second",me.Millisecond="millisecond",me))(l||{});const f=["year","month","week","day","hour","minute","second","millisecond"],d={year:31536e3,month:2592e3,week:604800,day:86400,hour:3600,minute:60,second:1,millisecond:.001};function h(me,Me){return me===null?{text:""}:Math.abs(me)<1e3?{text:re(me,Me),suffix:" ns"}:Math.abs(me)<1e6?ne(me/1e3,Me," \xB5s"):Math.abs(me)<1e9?ne(me/1e6,Me," ms"):Math.abs(me)<6e10?ne(me/1e9,Me," s"):Math.abs(me)<36e11?ne(me/6e10,Me," min"):Math.abs(me)<864e11?ne(me/36e11,Me," hour"):ne(me/864e11,Me," day")}function p(me,Me){return me===null?{text:""}:Math.abs(me)<1e3?{text:re(me,Me),suffix:" \xB5s"}:Math.abs(me)<1e6?ne(me/1e3,Me," ms"):ne(me/1e6,Me," s")}function m(me,Me,ye){return me===null?{text:""}:Math.abs(me)<1e3?{text:re(me,Me),suffix:" ms"}:Math.abs(me)<6e4?ne(me/1e3,Me," s"):Math.abs(me)<36e5?ne(me/6e4,Me," min"):Math.abs(me)<864e5?ne(me/36e5,Me," hour"):Math.abs(me)<31536e6?ne(me/864e5,Me," day"):ne(me/31536e6,Me," year")}function a(me,Me){if(me!=null&&Me!==null&&Me!==void 0)return me-Me}function v(me,Me){return me===null?{text:""}:me===0?{text:"0",suffix:" s"}:Math.abs(me)<1e-6?ne(me*1e9,Me," ns"):Math.abs(me)<.001?ne(me*1e6,Me," \xB5s"):Math.abs(me)<1?ne(me*1e3,Me," ms"):Math.abs(me)<60?{text:re(me,Me),suffix:" s"}:Math.abs(me)<3600?ne(me/60,Me," min"):Math.abs(me)<86400?ne(me/3600,Me," hour"):Math.abs(me)<604800?ne(me/86400,Me," day"):Math.abs(me)<31536e3?ne(me/604800,Me," week"):ne(me/31556900,Me," year")}function E(me,Me){return me===null?{text:""}:Math.abs(me)<60?{text:re(me,Me),suffix:" min"}:Math.abs(me)<1440?ne(me/60,Me," hour"):Math.abs(me)<10080?ne(me/1440,Me," day"):Math.abs(me)<604800?ne(me/10080,Me," week"):ne(me/525948,Me," year")}function D(me,Me){return me===null?{text:""}:Math.abs(me)<24?{text:re(me,Me),suffix:" hour"}:Math.abs(me)<168?ne(me/24,Me," day"):Math.abs(me)<8760?ne(me/168,Me," week"):ne(me/8760,Me," year")}function b(me,Me){return me===null?{text:""}:Math.abs(me)<7?{text:re(me,Me),suffix:" day"}:Math.abs(me)<365?ne(me/7,Me," week"):ne(me/365,Me," year")}function C(me,Me,ye){if(me===null)return{text:""};if(me===0)return{text:"0",suffix:" "+ye+"s"};if(me<0){const Ye=C(-me,Me,ye);return Ye.suffix||(Ye.suffix=""),Ye.suffix+=" ago",Ye}me*=d[ye]*1e3;const Le=[];let We=!1,Be=0;Me!=null&&(Be=Me);for(let Ye=0;Ye<f.length&&Be>=0;Ye++){const at=d[f[Ye]]*1e3,st=me/at;if(st>=1||We){We=!0;const Ke=Math.floor(st),Xe=f[Ye]+(Ke!==1?"s":"");Le.push(Ke+" "+Xe),me=me%at,Be--}}return{text:Le.join(", ")}}function y(me,Me){if(me===null)return{text:""};if(me<1e3)return{text:(0,i.yT)(me).format("SSS\\m\\s")};if(me<6e4){let Be="ss\\s:SSS\\m\\s";return Me===0&&(Be="ss\\s"),{text:(0,i.yT)(me).format(Be)}}if(me<36e5){let Be="mm\\m:ss\\s:SSS\\m\\s";return Me===0?Be="mm\\m":Me===1&&(Be="mm\\m:ss\\s"),{text:(0,i.yT)(me).format(Be)}}let ye="mm\\m:ss\\s:SSS\\m\\s";const Le=`${("0"+Math.floor((0,i.Ah)(me,"milliseconds").asHours())).slice(-2)}h`;return Me===0?ye="":Me===1?ye="mm\\m":Me===2&&(ye="mm\\m:ss\\s"),{text:ye?`${Le}:${(0,i.yT)(me).format(ye)}`:Le}}function M(me,Me){return C(me,Me,"millisecond")}function T(me,Me){return C(me,Me,"second")}function I(me){if(me<0){const Be=I(-me);return Be.suffix||(Be.suffix=""),Be.suffix+=" ago",Be}const Me=[],ye=Math.floor(me/3600),Le=Math.floor(me%3600/60),We=Math.floor(me%3600%60);return ye>9?Me.push(""+ye):Me.push("0"+ye),Le>9?Me.push(""+Le):Me.push("0"+Le),We>9?Me.push(""+We):Me.push("0"+We),{text:Me.join(":")}}function x(me){if(me<0){const We=x(-me);return We.suffix||(We.suffix=""),We.suffix+=" ago",We}let Me="";const ye=Math.floor(me/(24*3600));ye>0&&(Me=ye+" d ");const Le=I(me-ye*24*3600);return{text:Me+Le.text}}function S(me,Me){return v(me/100,Me)}function O(me,Me){return y(me,Me)}function P(me,Me){return y(me*1e3,Me)}function L(me,Me){return(ye,Le,We,Be)=>Me&&(0,i.KQ)().isSame(ye,"day")?{text:(0,u.LE)(ye,{format:Me,timeZone:Be})}:{text:(0,u.LE)(ye,{format:me,timeZone:Be})}}const U=L("YYYY-MM-DD HH:mm:ss"),R=L("YYYY-MM-DD HH:mm:ss","HH:mm:ss"),B=L("MM/DD/YYYY h:mm:ss a"),H=L("MM/DD/YYYY h:mm:ss a","h:mm:ss a");function w(){return L((0,c.Od)({year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}))}function N(){return L((0,c.Od)({year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}),(0,c.Od)({hour:"2-digit",minute:"2-digit",second:"2-digit"}))}function V(me,Me,ye,Le,We){return{text:(0,u.LE)(me,{format:We?c.WC.fullDateMS:c.WC.fullDate,timeZone:Le})}}function G(me,Me,ye,Le){return{text:(0,u.fq)(me,{timeZone:Le})}}var _=e(26517);const K=()=>[{name:"Misc",formats:[{name:"Number",id:"none",fn:te("")},{name:"String",id:"string",fn:pe},{name:"short",id:"short",fn:ge(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:o},{name:"Humidity (%H)",id:"humidity",fn:te("%H")},{name:"Decibel",id:"dB",fn:te("dB")},{name:"Candela (cd)",id:"candela",fn:(0,_.rT)("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:he},{name:"Pixels",id:"pixel",fn:te("px")}]},{name:"Acceleration",formats:[{name:"Meters/sec\xB2",id:"accMS2",fn:te("m/sec\xB2")},{name:"Feet/sec\xB2",id:"accFS2",fn:te("f/sec\xB2")},{name:"G unit",id:"accG",fn:te("g")}]},{name:"Angle",formats:[{name:"Degrees (\xB0)",id:"degree",fn:te("\xB0")},{name:"Radians",id:"radian",fn:te("rad")},{name:"Gradian",id:"grad",fn:te("grad")},{name:"Arc Minutes",id:"arcmin",fn:te("arcmin")},{name:"Arc Seconds",id:"arcsec",fn:te("arcsec")}]},{name:"Area",formats:[{name:"Square Meters (m\xB2)",id:"areaM2",fn:te("m\xB2")},{name:"Square Feet (ft\xB2)",id:"areaF2",fn:te("ft\xB2")},{name:"Square Miles (mi\xB2)",id:"areaMI2",fn:te("mi\xB2")},{name:"Acres (ac)",id:"acres",fn:te("ac")},{name:"Hectares (ha)",id:"hectares",fn:te("ha")}]},{name:"Computation",formats:[{name:"FLOP/s",id:"flops",fn:(0,_.rT)("FLOPS")},{name:"MFLOP/s",id:"mflops",fn:(0,_.rT)("FLOPS",2)},{name:"GFLOP/s",id:"gflops",fn:(0,_.rT)("FLOPS",3)},{name:"TFLOP/s",id:"tflops",fn:(0,_.rT)("FLOPS",4)},{name:"PFLOP/s",id:"pflops",fn:(0,_.rT)("FLOPS",5)},{name:"EFLOP/s",id:"eflops",fn:(0,_.rT)("FLOPS",6)},{name:"ZFLOP/s",id:"zflops",fn:(0,_.rT)("FLOPS",7)},{name:"YFLOP/s",id:"yflops",fn:(0,_.rT)("FLOPS",8)}]},{name:"Concentration",formats:[{name:"parts-per-million (ppm)",id:"ppm",fn:te("ppm")},{name:"parts-per-billion (ppb)",id:"conppb",fn:te("ppb")},{name:"nanogram per cubic meter (ng/m\xB3)",id:"conngm3",fn:te("ng/m\xB3")},{name:"nanogram per normal cubic meter (ng/Nm\xB3)",id:"conngNm3",fn:te("ng/Nm\xB3")},{name:"microgram per cubic meter (\u03BCg/m\xB3)",id:"con\u03BCgm3",fn:te("\u03BCg/m\xB3")},{name:"microgram per normal cubic meter (\u03BCg/Nm\xB3)",id:"con\u03BCgNm3",fn:te("\u03BCg/Nm\xB3")},{name:"milligram per cubic meter (mg/m\xB3)",id:"conmgm3",fn:te("mg/m\xB3")},{name:"milligram per normal cubic meter (mg/Nm\xB3)",id:"conmgNm3",fn:te("mg/Nm\xB3")},{name:"gram per cubic meter (g/m\xB3)",id:"congm3",fn:te("g/m\xB3")},{name:"gram per normal cubic meter (g/Nm\xB3)",id:"congNm3",fn:te("g/Nm\xB3")},{name:"milligrams per decilitre (mg/dL)",id:"conmgdL",fn:te("mg/dL")},{name:"millimoles per litre (mmol/L)",id:"conmmolL",fn:te("mmol/L")}]},{name:"Currency",formats:[{name:"Dollars ($)",id:"currencyUSD",fn:(0,_.Gl)("$")},{name:"Pounds (\xA3)",id:"currencyGBP",fn:(0,_.Gl)("\xA3")},{name:"Euro (\u20AC)",id:"currencyEUR",fn:(0,_.Gl)("\u20AC")},{name:"Yen (\xA5)",id:"currencyJPY",fn:(0,_.Gl)("\xA5")},{name:"Rubles (\u20BD)",id:"currencyRUB",fn:(0,_.Gl)("\u20BD")},{name:"Hryvnias (\u20B4)",id:"currencyUAH",fn:(0,_.Gl)("\u20B4")},{name:"Real (R$)",id:"currencyBRL",fn:(0,_.Gl)("R$")},{name:"Danish Krone (kr)",id:"currencyDKK",fn:(0,_.Gl)("kr",!0)},{name:"Icelandic Kr\xF3na (kr)",id:"currencyISK",fn:(0,_.Gl)("kr",!0)},{name:"Norwegian Krone (kr)",id:"currencyNOK",fn:(0,_.Gl)("kr",!0)},{name:"Swedish Krona (kr)",id:"currencySEK",fn:(0,_.Gl)("kr",!0)},{name:"Czech koruna (czk)",id:"currencyCZK",fn:(0,_.Gl)("czk")},{name:"Swiss franc (CHF)",id:"currencyCHF",fn:(0,_.Gl)("CHF")},{name:"Polish Z\u0142oty (PLN)",id:"currencyPLN",fn:(0,_.Gl)("PLN")},{name:"Bitcoin (\u0E3F)",id:"currencyBTC",fn:(0,_.Gl)("\u0E3F")},{name:"Milli Bitcoin (\u0E3F)",id:"currencymBTC",fn:(0,_.Gl)("mBTC")},{name:"Micro Bitcoin (\u0E3F)",id:"currency\u03BCBTC",fn:(0,_.Gl)("\u03BCBTC")},{name:"South African Rand (R)",id:"currencyZAR",fn:(0,_.Gl)("R")},{name:"Indian Rupee (\u20B9)",id:"currencyINR",fn:(0,_.Gl)("\u20B9")},{name:"South Korean Won (\u20A9)",id:"currencyKRW",fn:(0,_.Gl)("\u20A9")},{name:"Indonesian Rupiah (Rp)",id:"currencyIDR",fn:(0,_.Gl)("Rp")},{name:"Philippine Peso (PHP)",id:"currencyPHP",fn:(0,_.Gl)("PHP")},{name:"Vietnamese Dong (VND)",id:"currencyVND",fn:(0,_.Gl)("\u0111",!0)},{name:"Turkish Lira (\u20BA)",id:"currencyTRY",fn:(0,_.Gl)("\u20BA",!0)},{name:"Malaysian Ringgit (RM)",id:"currencyMYR",fn:(0,_.Gl)("RM")},{name:"CFP franc (XPF)",id:"currencyXPF",fn:(0,_.Gl)("XPF")},{name:"Bulgarian Lev (BGN)",id:"currencyBGN",fn:(0,_.Gl)("BGN")},{name:"Guaran\xED (\u20B2)",id:"currencyPYG",fn:(0,_.Gl)("\u20B2")}]},{name:"Data",formats:[{name:"bytes(IEC)",id:"bytes",fn:(0,_.yW)("B")},{name:"bytes(SI)",id:"decbytes",fn:(0,_.rT)("B")},{name:"bits(IEC)",id:"bits",fn:(0,_.yW)("b")},{name:"bits(SI)",id:"decbits",fn:(0,_.rT)("b")},{name:"kibibytes",id:"kbytes",fn:(0,_.yW)("B",1)},{name:"kilobytes",id:"deckbytes",fn:(0,_.rT)("B",1)},{name:"mebibytes",id:"mbytes",fn:(0,_.yW)("B",2)},{name:"megabytes",id:"decmbytes",fn:(0,_.rT)("B",2)},{name:"gibibytes",id:"gbytes",fn:(0,_.yW)("B",3)},{name:"gigabytes",id:"decgbytes",fn:(0,_.rT)("B",3)},{name:"tebibytes",id:"tbytes",fn:(0,_.yW)("B",4)},{name:"terabytes",id:"dectbytes",fn:(0,_.rT)("B",4)},{name:"pebibytes",id:"pbytes",fn:(0,_.yW)("B",5)},{name:"petabytes",id:"decpbytes",fn:(0,_.rT)("B",5)}]},{name:"Data rate",formats:[{name:"packets/sec",id:"pps",fn:(0,_.rT)("p/s")},{name:"bytes/sec(IEC)",id:"binBps",fn:(0,_.yW)("B/s")},{name:"bytes/sec(SI)",id:"Bps",fn:(0,_.rT)("B/s")},{name:"bits/sec(IEC)",id:"binbps",fn:(0,_.yW)("b/s")},{name:"bits/sec(SI)",id:"bps",fn:(0,_.rT)("b/s")},{name:"kibibytes/sec",id:"KiBs",fn:(0,_.yW)("B/s",1)},{name:"kibibits/sec",id:"Kibits",fn:(0,_.yW)("b/s",1)},{name:"kilobytes/sec",id:"KBs",fn:(0,_.rT)("B/s",1)},{name:"kilobits/sec",id:"Kbits",fn:(0,_.rT)("b/s",1)},{name:"mebibytes/sec",id:"MiBs",fn:(0,_.yW)("B/s",2)},{name:"mebibits/sec",id:"Mibits",fn:(0,_.yW)("b/s",2)},{name:"megabytes/sec",id:"MBs",fn:(0,_.rT)("B/s",2)},{name:"megabits/sec",id:"Mbits",fn:(0,_.rT)("b/s",2)},{name:"gibibytes/sec",id:"GiBs",fn:(0,_.yW)("B/s",3)},{name:"gibibits/sec",id:"Gibits",fn:(0,_.yW)("b/s",3)},{name:"gigabytes/sec",id:"GBs",fn:(0,_.rT)("B/s",3)},{name:"gigabits/sec",id:"Gbits",fn:(0,_.rT)("b/s",3)},{name:"tebibytes/sec",id:"TiBs",fn:(0,_.yW)("B/s",4)},{name:"tebibits/sec",id:"Tibits",fn:(0,_.yW)("b/s",4)},{name:"terabytes/sec",id:"TBs",fn:(0,_.rT)("B/s",4)},{name:"terabits/sec",id:"Tbits",fn:(0,_.rT)("b/s",4)},{name:"pebibytes/sec",id:"PiBs",fn:(0,_.yW)("B/s",5)},{name:"pebibits/sec",id:"Pibits",fn:(0,_.yW)("b/s",5)},{name:"petabytes/sec",id:"PBs",fn:(0,_.rT)("B/s",5)},{name:"petabits/sec",id:"Pbits",fn:(0,_.rT)("b/s",5)}]},{name:"Date & time",formats:[{name:"Datetime ISO",id:"dateTimeAsIso",fn:U},{name:"Datetime ISO (No date if today)",id:"dateTimeAsIsoNoDateIfToday",fn:R},{name:"Datetime US",id:"dateTimeAsUS",fn:B},{name:"Datetime US (No date if today)",id:"dateTimeAsUSNoDateIfToday",fn:H},{name:"Datetime local",id:"dateTimeAsLocal",fn:w()},{name:"Datetime local (No date if today)",id:"dateTimeAsLocalNoDateIfToday",fn:N()},{name:"Datetime default",id:"dateTimeAsSystem",fn:V},{name:"From Now",id:"dateTimeFromNow",fn:G}]},{name:"Energy",formats:[{name:"Watt (W)",id:"watt",fn:(0,_.rT)("W")},{name:"Kilowatt (kW)",id:"kwatt",fn:(0,_.rT)("W",1)},{name:"Megawatt (MW)",id:"megwatt",fn:(0,_.rT)("W",2)},{name:"Gigawatt (GW)",id:"gwatt",fn:(0,_.rT)("W",3)},{name:"Milliwatt (mW)",id:"mwatt",fn:(0,_.rT)("W",-1)},{name:"Watt per square meter (W/m\xB2)",id:"Wm2",fn:te("W/m\xB2")},{name:"Volt-Ampere (VA)",id:"voltamp",fn:(0,_.rT)("VA")},{name:"Kilovolt-Ampere (kVA)",id:"kvoltamp",fn:(0,_.rT)("VA",1)},{name:"Volt-Ampere reactive (VAr)",id:"voltampreact",fn:(0,_.rT)("VAr")},{name:"Kilovolt-Ampere reactive (kVAr)",id:"kvoltampreact",fn:(0,_.rT)("VAr",1)},{name:"Watt-hour (Wh)",id:"watth",fn:(0,_.rT)("Wh")},{name:"Watt-hour per Kilogram (Wh/kg)",id:"watthperkg",fn:(0,_.rT)("Wh/kg")},{name:"Kilowatt-hour (kWh)",id:"kwatth",fn:(0,_.rT)("Wh",1)},{name:"Kilowatt-min (kWm)",id:"kwattm",fn:(0,_.rT)("W-Min",1)},{name:"Megawatt-hour (MWh)",id:"mwatth",fn:(0,_.rT)("Wh",2)},{name:"Ampere-hour (Ah)",id:"amph",fn:(0,_.rT)("Ah")},{name:"Kiloampere-hour (kAh)",id:"kamph",fn:(0,_.rT)("Ah",1)},{name:"Milliampere-hour (mAh)",id:"mamph",fn:(0,_.rT)("Ah",-1)},{name:"Joule (J)",id:"joule",fn:(0,_.rT)("J")},{name:"Electron volt (eV)",id:"ev",fn:(0,_.rT)("eV")},{name:"Ampere (A)",id:"amp",fn:(0,_.rT)("A")},{name:"Kiloampere (kA)",id:"kamp",fn:(0,_.rT)("A",1)},{name:"Milliampere (mA)",id:"mamp",fn:(0,_.rT)("A",-1)},{name:"Volt (V)",id:"volt",fn:(0,_.rT)("V")},{name:"Kilovolt (kV)",id:"kvolt",fn:(0,_.rT)("V",1)},{name:"Millivolt (mV)",id:"mvolt",fn:(0,_.rT)("V",-1)},{name:"Decibel-milliwatt (dBm)",id:"dBm",fn:(0,_.rT)("dBm")},{name:"Milliohm (m\u03A9)",id:"mohm",fn:(0,_.rT)("\u03A9",-1)},{name:"Ohm (\u03A9)",id:"ohm",fn:(0,_.rT)("\u03A9")},{name:"Kiloohm (k\u03A9)",id:"kohm",fn:(0,_.rT)("\u03A9",1)},{name:"Megaohm (M\u03A9)",id:"Mohm",fn:(0,_.rT)("\u03A9",2)},{name:"Farad (F)",id:"farad",fn:(0,_.rT)("F")},{name:"Microfarad (\xB5F)",id:"\xB5farad",fn:(0,_.rT)("F",-2)},{name:"Nanofarad (nF)",id:"nfarad",fn:(0,_.rT)("F",-3)},{name:"Picofarad (pF)",id:"pfarad",fn:(0,_.rT)("F",-4)},{name:"Femtofarad (fF)",id:"ffarad",fn:(0,_.rT)("F",-5)},{name:"Henry (H)",id:"henry",fn:(0,_.rT)("H")},{name:"Millihenry (mH)",id:"mhenry",fn:(0,_.rT)("H",-1)},{name:"Microhenry (\xB5H)",id:"\xB5henry",fn:(0,_.rT)("H",-2)},{name:"Lumens (Lm)",id:"lumens",fn:(0,_.rT)("Lm")}]},{name:"Flow",formats:[{name:"Gallons/min (gpm)",id:"flowgpm",fn:te("gpm")},{name:"Cubic meters/sec (cms)",id:"flowcms",fn:te("cms")},{name:"Cubic feet/sec (cfs)",id:"flowcfs",fn:te("cfs")},{name:"Cubic feet/min (cfm)",id:"flowcfm",fn:te("cfm")},{name:"Litre/hour",id:"litreh",fn:te("L/h")},{name:"Litre/min (L/min)",id:"flowlpm",fn:te("L/min")},{name:"milliLitre/min (mL/min)",id:"flowmlpm",fn:te("mL/min")},{name:"Lux (lx)",id:"lux",fn:te("lux")}]},{name:"Force",formats:[{name:"Newton-meters (Nm)",id:"forceNm",fn:(0,_.rT)("Nm")},{name:"Kilonewton-meters (kNm)",id:"forcekNm",fn:(0,_.rT)("Nm",1)},{name:"Newtons (N)",id:"forceN",fn:(0,_.rT)("N")},{name:"Kilonewtons (kN)",id:"forcekN",fn:(0,_.rT)("N",1)}]},{name:"Hash rate",formats:[{name:"hashes/sec",id:"Hs",fn:(0,_.rT)("H/s")},{name:"kilohashes/sec",id:"KHs",fn:(0,_.rT)("H/s",1)},{name:"megahashes/sec",id:"MHs",fn:(0,_.rT)("H/s",2)},{name:"gigahashes/sec",id:"GHs",fn:(0,_.rT)("H/s",3)},{name:"terahashes/sec",id:"THs",fn:(0,_.rT)("H/s",4)},{name:"petahashes/sec",id:"PHs",fn:(0,_.rT)("H/s",5)},{name:"exahashes/sec",id:"EHs",fn:(0,_.rT)("H/s",6)}]},{name:"Mass",formats:[{name:"milligram (mg)",id:"massmg",fn:(0,_.rT)("g",-1)},{name:"gram (g)",id:"massg",fn:(0,_.rT)("g")},{name:"pound (lb)",id:"masslb",fn:te("lb")},{name:"kilogram (kg)",id:"masskg",fn:(0,_.rT)("g",1)},{name:"metric ton (t)",id:"masst",fn:te("t")}]},{name:"Length",formats:[{name:"millimeter (mm)",id:"lengthmm",fn:(0,_.rT)("m",-1)},{name:"inch (in)",id:"lengthin",fn:te("in")},{name:"feet (ft)",id:"lengthft",fn:te("ft")},{name:"meter (m)",id:"lengthm",fn:(0,_.rT)("m")},{name:"kilometer (km)",id:"lengthkm",fn:(0,_.rT)("m",1)},{name:"mile (mi)",id:"lengthmi",fn:te("mi")}]},{name:"Pressure",formats:[{name:"Millibars",id:"pressurembar",fn:(0,_.rT)("bar",-1)},{name:"Bars",id:"pressurebar",fn:(0,_.rT)("bar")},{name:"Kilobars",id:"pressurekbar",fn:(0,_.rT)("bar",1)},{name:"Pascals",id:"pressurepa",fn:(0,_.rT)("Pa")},{name:"Hectopascals",id:"pressurehpa",fn:te("hPa")},{name:"Kilopascals",id:"pressurekpa",fn:te("kPa")},{name:"Inches of mercury",id:"pressurehg",fn:te('"Hg')},{name:"PSI",id:"pressurepsi",fn:ge(1e3,["psi","ksi","Mpsi"])}]},{name:"Radiation",formats:[{name:"Becquerel (Bq)",id:"radbq",fn:(0,_.rT)("Bq")},{name:"curie (Ci)",id:"radci",fn:(0,_.rT)("Ci")},{name:"Gray (Gy)",id:"radgy",fn:(0,_.rT)("Gy")},{name:"rad",id:"radrad",fn:(0,_.rT)("rad")},{name:"Sievert (Sv)",id:"radsv",fn:(0,_.rT)("Sv")},{name:"milliSievert (mSv)",id:"radmsv",fn:(0,_.rT)("Sv",-1)},{name:"microSievert (\xB5Sv)",id:"radusv",fn:(0,_.rT)("Sv",-2)},{name:"rem",id:"radrem",fn:(0,_.rT)("rem")},{name:"Exposure (C/kg)",id:"radexpckg",fn:(0,_.rT)("C/kg")},{name:"roentgen (R)",id:"radr",fn:(0,_.rT)("R")},{name:"Sievert/hour (Sv/h)",id:"radsvh",fn:(0,_.rT)("Sv/h")},{name:"milliSievert/hour (mSv/h)",id:"radmsvh",fn:(0,_.rT)("Sv/h",-1)},{name:"microSievert/hour (\xB5Sv/h)",id:"radusvh",fn:(0,_.rT)("Sv/h",-2)}]},{name:"Rotational Speed",formats:[{name:"Revolutions per minute (rpm)",id:"rotrpm",fn:te("rpm")},{name:"Hertz (Hz)",id:"rothz",fn:(0,_.rT)("Hz")},{name:"Kilohertz (kHz)",id:"rotkhz",fn:(0,_.rT)("Hz",1)},{name:"Megahertz (MHz)",id:"rotmhz",fn:(0,_.rT)("Hz",2)},{name:"Gigahertz (GHz)",id:"rotghz",fn:(0,_.rT)("Hz",3)},{name:"Radians per second (rad/s)",id:"rotrads",fn:te("rad/s")},{name:"Degrees per second (\xB0/s)",id:"rotdegs",fn:te("\xB0/s")}]},{name:"Temperature",formats:[{name:"Celsius (\xB0C)",id:"celsius",fn:te("\xB0C")},{name:"Fahrenheit (\xB0F)",id:"fahrenheit",fn:te("\xB0F")},{name:"Kelvin (K)",id:"kelvin",fn:te("K")}]},{name:"Time",formats:[{name:"Hertz (1/s)",id:"hertz",fn:(0,_.rT)("Hz")},{name:"nanoseconds (ns)",id:"ns",fn:h},{name:"microseconds (\xB5s)",id:"\xB5s",fn:p},{name:"milliseconds (ms)",id:"ms",fn:m},{name:"seconds (s)",id:"s",fn:v},{name:"minutes (m)",id:"m",fn:E},{name:"hours (h)",id:"h",fn:D},{name:"days (d)",id:"d",fn:b},{name:"duration (ms)",id:"dtdurationms",fn:M},{name:"duration (s)",id:"dtdurations",fn:T},{name:"duration (hh:mm:ss)",id:"dthms",fn:I},{name:"duration (d hh:mm:ss)",id:"dtdhms",fn:x},{name:"Timeticks (s/100)",id:"timeticks",fn:S},{name:"clock (ms)",id:"clockms",fn:O},{name:"clock (s)",id:"clocks",fn:P}]},{name:"Throughput",formats:[{name:"counts/sec (cps)",id:"cps",fn:De("c/s")},{name:"ops/sec (ops)",id:"ops",fn:De("ops/s")},{name:"requests/sec (rps)",id:"reqps",fn:De("req/s")},{name:"reads/sec (rps)",id:"rps",fn:De("rd/s")},{name:"writes/sec (wps)",id:"wps",fn:De("wr/s")},{name:"I/O ops/sec (iops)",id:"iops",fn:De("io/s")},{name:"events/sec (eps)",id:"eps",fn:De("evt/s")},{name:"messages/sec (mps)",id:"mps",fn:De("msg/s")},{name:"records/sec (rps)",id:"recps",fn:De("rec/s")},{name:"rows/sec (rps)",id:"rowsps",fn:De("rows/s")},{name:"counts/min (cpm)",id:"cpm",fn:De("c/m")},{name:"ops/min (opm)",id:"opm",fn:De("ops/m")},{name:"requests/min (rpm)",id:"reqpm",fn:De("req/m")},{name:"reads/min (rpm)",id:"rpm",fn:De("rd/m")},{name:"writes/min (wpm)",id:"wpm",fn:De("wr/m")},{name:"events/min (epm)",id:"epm",fn:De("evts/m")},{name:"messages/min (mpm)",id:"mpm",fn:De("msgs/m")},{name:"records/min (rpm)",id:"recpm",fn:De("rec/m")},{name:"rows/min (rpm)",id:"rowspm",fn:De("rows/m")}]},{name:"Velocity",formats:[{name:"meters/second (m/s)",id:"velocityms",fn:te("m/s")},{name:"kilometers/hour (km/h)",id:"velocitykmh",fn:te("km/h")},{name:"miles/hour (mph)",id:"velocitymph",fn:te("mph")},{name:"knot (kn)",id:"velocityknot",fn:te("kn")}]},{name:"Volume",formats:[{name:"millilitre (mL)",id:"mlitre",fn:(0,_.rT)("L",-1)},{name:"litre (L)",id:"litre",fn:(0,_.rT)("L")},{name:"cubic meter",id:"m3",fn:te("m\xB3")},{name:"Normal cubic meter",id:"Nm3",fn:te("Nm\xB3")},{name:"cubic decimeter",id:"dm3",fn:te("dm\xB3")},{name:"gallons",id:"gallons",fn:te("gal")}]},{name:"Boolean",formats:[{name:"True / False",id:"bool",fn:ue("True","False")},{name:"Yes / No",id:"bool_yes_no",fn:ue("Yes","No")},{name:"On / Off",id:"bool_on_off",fn:ue("On","Off")}]}];function j(me){return`${me.prefix??""}${me.text}${me.suffix??""}`}let k=[];const Y={};let ee=!1;function re(me,Me){if(me===null)return"";if(me===Number.NEGATIVE_INFINITY||me===Number.POSITIVE_INFINITY)return me.toLocaleString();if(Me==null&&(Me=J(me)),me===0)return me.toFixed(Me);const ye=Me?Math.pow(10,Math.max(0,Me)):1,Le=String(Math.round(me*ye)/ye);if(Le.indexOf("e")!==-1||me===0)return Le;const We=Le.indexOf("."),Be=We===-1?0:Le.length-We-1;return Be<Me?(Be?Le:Le+".")+String(ye).slice(1,Me-Be+1):Le}function J(me){const Me=Math.abs(me);let Le=-Math.floor(Math.log(Me)/Math.LN10)+1;const We=Math.pow(10,-Le);return Me/We>2.25&&++Le,me%1===0&&(Le=0),Math.max(0,Le)}function ne(me,Me,ye){return{text:re(me,Me),suffix:q(ye,Math.abs(me)>1)}}function q(me,Me){if(!Me)return me;switch(me){case" min":case" hour":case" day":case" week":case" year":return`${me}s`;default:return me}}function te(me,Me){return(ye,Le)=>{if(ye===null)return{text:""};const We=re(ye,Le);return me?Me?{text:We,prefix:me}:{text:We,suffix:" "+me}:{text:We}}}function oe(me){return me&&me.startsWith("bool")}function ue(me,Me){return ye=>({text:ye?me:Me})}const ie=(me,Me)=>Math.log10(Me)/Math.log10(me);function ge(me,Me,ye=0){return(Le,We)=>{if(Le==null)return{text:""};if(Le===Number.NEGATIVE_INFINITY||Le===Number.POSITIVE_INFINITY||isNaN(Le))return{text:Le.toLocaleString()};const Be=Le===0?0:Math.floor(ie(me,Math.abs(Le))),Ye=Me[(0,t.clamp)(ye+Be,0,Me.length-1)];return{text:re(Le/me**(0,t.clamp)(Be,-ye,Me.length-ye-1),We),suffix:Ye}}}function he(me,Me){return me==null?{text:""}:{text:me.toLocaleString(void 0,{maximumFractionDigits:Me??void 0})}}function De(me){const ye=ge(1e3,["","K","M","B","T"]);return(Le,We,Be)=>{if(Le===null)return{text:""};const Ye=ye(Le,We,Be);return Ye.suffix+=" "+me,Ye}}function pe(me){return{text:`${me}`}}function le(){k=K();for(const me of k)for(const Me of me.formats)Y[Me.id]=Me.fn;[{from:"farenheit",to:"fahrenheit"}].forEach(me=>{const Me=Y[me.to];Me&&(Y[me.from]=Me)}),ee=!0}function Te(me){if(!me)return te("");ee||le();const Me=Y[me];if(!Me&&me){let ye=me.indexOf(":");if(ye>0){const Le=me.substring(0,ye),We=me.substring(ye+1);if(Le==="prefix")return te(We,!0);if(Le==="suffix")return te(We,!1);if(Le==="time")return L(We);if(Le==="si"){const Be=(0,_.cL)(We.charAt(0)),Ye=Be===0?We:We.substring(1);return(0,_.rT)(Ye,Be)}if(Le==="count")return De(We);if(Le==="currency")return(0,_.Gl)(We);if(Le==="bool"){if(ye=We.indexOf("/"),ye>=0){const Be=We.substring(0,ye),Ye=We.substring(ye+1);return ue(Be,Ye)}return ue(We,"-")}}return te(me)}return Me}function Ee(){return ee||le(),Y}function Re(){return ee||le(),k.map(me=>({text:me.name,submenu:me.formats.map(Me=>({text:Me.name,value:Me.id}))}))}},36120:(Q,A,e)=>{"use strict";e.d(A,{$:()=>o});var t=e(35853),n=e(18008);class o extends n.F{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.N)(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 u=this.length-r;this.tail?this.buffer=g.slice(u,g.length):this.buffer=g.slice(0,g.length-u)}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}}},18008:(Q,A,e)=>{"use strict";e.d(A,{E:()=>r,F:()=>o});var t=e(83239),n;class o{constructor(){this[n]={}}*iterator(){for(let u=0;u<this.length;u++)yield this.get(u)}set(u,c){throw"unsupported operation"}add(u){throw"unsupported operation"}push(...u){for(const c of u)this.add(c);return this.length}[Symbol.iterator](){return this.iterator()}forEach(u){return r(this).forEach(u)}map(u){return r(this).map(u)}filter(u){return r(this).filter(u)}at(u){return this.get(u)}toArray(){return(0,t.i)(this)}join(u){return this.toArray().join(u)}toJSON(){return this.toArray()}pop(){throw new Error("Method not implemented.")}concat(...u){throw new Error("Method not implemented.")}reverse(){throw new Error("Method not implemented.")}shift(){throw new Error("Method not implemented.")}sort(u){throw new Error("Method not implemented.")}splice(u,c,...i){throw new Error("Method not implemented.")}unshift(...u){throw new Error("Method not implemented.")}fill(u,c,i){throw new Error("Method not implemented.")}copyWithin(u,c,i){throw new Error("Method not implemented.")}slice(u,c){return this.toArray().slice(u,c)}indexOf(u,c){return this.toArray().indexOf(u,c)}lastIndexOf(u,c){return this.toArray().lastIndexOf(u,c)}every(u,c){return this.toArray().every(u,c)}some(u,c){return this.toArray().some(u,c)}reduce(u,c){throw new Error("Method not implemented.")}reduceRight(u,c){throw new Error("Method not implemented.")}find(u,c){return this.toArray().find(u,c)}findIndex(u,c){return this.toArray().findIndex(u,c)}entries(){return this.toArray().entries()}keys(){return this.toArray().keys()}values(){return this.toArray().values()}includes(u,c){return this.toArray().includes(u,c)}flatMap(u,c){return this.toArray().flatMap(u,c)}flat(u){throw new Error("Method not implemented.")}}n=Symbol.unscopables;const s=[];function r(g){return{*[Symbol.iterator](){for(let u=0;u<g.length;u++)yield g.get(u)},forEach(u){for(let c=0;c<g.length;c++)u(g.get(c),c,s)},map(u){const c=[];for(let i=0;i<g.length;i++)c.push(u(g.get(i),i,s));return c},filter(u){const c=[];let i=0;for(const l of this)u(l,i++,s)&&c.push(l);return c}}}},43548:(Q,A,e)=>{"use strict";e.d(A,{F:()=>s});var t=e(35853),n=e(18008),o=e(83239);class s extends n.F{constructor(g,u){return super(),this.source=g,this.order=u,(0,t.N)(this)}get length(){return this.source.length}get(g){return this.source.get(this.order[g])}toArray(){return(0,o.i)(this)}toJSON(){return(0,o.i)(this)}getOrderArray(){return this.order}}},31978:(Q,A,e)=>{"use strict";e.d(A,{kV:()=>s,Ld:()=>u,vG:()=>a,E0:()=>l,$e:()=>c.$,m$:()=>i,aO:()=>h,QL:()=>m,Fb:()=>f.F,Ek:()=>n.E});var t=e(35853),n=e(18008),o=e(83239);class s extends n.F{constructor(E=0){return super(),this.length=0,this.source=[],this.length=E,(0,t.N)(this)}setLength(E){if(E>this.length)this.length=E;else if(E<this.length){const D=[];for(const b of this.source)if(D.push(b),b.end>E){b.end=E;break}this.source=D,this.length=E}}append(E){const D={start:this.length,end:this.length+E.length,values:E};return this.length=D.end,this.source.push(D),D}get(E){for(let D=0;D<this.source.length;D++){const b=this.source[D];if(E>=b.start&&E<b.end)return b.values[E-b.start]}}toArray(){return(0,o.i)(this)}toJSON(){return(0,o.i)(this)}}const r="ArrayVector is deprecated and will be removed in Grafana 11. Please use plain arrays for field.values.";let g=!1;class u extends Array{get buffer(){return this}set buffer(E){this.length=0;const D=E?.length;if(D){let b=65e3,C=Math.ceil(D/b);for(let y=0;y<C;y++)this.push.apply(this,E.slice(y*b,(y+1)*b))}}constructor(E){super(),this.buffer=E??[],g||(console.warn(r),g=!0)}toJSON(){return[...this]}}var c=e(36120);class i extends Array{constructor(E,D){return super(),new Array(D).fill(E)}}class l extends Array{constructor(E,D,b){super();const C=new Array(E.length);for(let y=0;y<C.length;y++)C[y]=b(E[y],D[y]);return C}}var f=e(43548),d=e(83195);class h extends Array{constructor(E,D){return super(),E.map(b=>(0,d.cN)(D(b)))}}var p=e(11261);class m extends Array{constructor(E){super();const D=new Array(E);for(let b=0;b<E;b++)D[b]=b;return D}static newField(E){return{name:"",values:new m(E),type:p.PU.number,config:{min:0,max:E-1}}}}class a extends Array{constructor(E){return super(),E.map(D=>+D)}}},83239:(Q,A,e)=>{"use strict";e.d(A,{i:()=>t});function t(n){const o=Array(n.length);for(let s=0;s<n.length;s++)o[s]=n.get(s);return o}},13390:(Q,A,e)=>{"use strict";e.d(A,{X:()=>t});const t={RadioButton:{container:"data-testid radio-button"},Breadcrumbs:{breadcrumb:n=>`data-testid ${n} breadcrumb`},TimePicker:{openButton:"data-testid TimePicker Open Button",overlayContent:"data-testid TimePicker Overlay Content",fromField:"data-testid Time Range from field",toField:"data-testid Time Range to field",applyTimeRange:"data-testid TimePicker submit button",copyTimeRange:"data-testid TimePicker copy button",pasteTimeRange:"data-testid TimePicker paste button",calendar:{label:"data-testid Time Range calendar",openButton:"data-testid Open time range calendar",closeButton:"data-testid 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"},DateTimePicker:{input:"data-testid date-time-input"},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:"data-testid Datasource HTTP settings url"},Jaeger:{traceIDInput:"Trace ID"},Prometheus:{configPage:{connectionSettings:"Data source connection URL",manageAlerts:"prometheus-alerts-manager",scrapeInterval:"data-testid scrape interval",queryTimeout:"data-testid query timeout",defaultEditor:"data-testid default editor",disableMetricLookup:"disable-metric-lookup",prometheusType:"data-testid prometheus type",prometheusVersion:"data-testid prometheus version",cacheLevel:"data-testid cache level",incrementalQuerying:"prometheus-incremental-querying",queryOverlapWindow:"data-testid query overlap window",disableRecordingRules:"disable-recording-rules",customQueryParameters:"data-testid custom query parameters",httpMethod:"data-testid http method",exemplarsAddButton:"data-testid Add exemplar config button",internalLinkSwitch:"data-testid Internal link switch"},queryEditor:{explain:"data-testid prometheus explain switch wrapper",editorToggle:"data-testid QueryEditorModeToggle",options:"data-testid prometheus options",legend:"data-testid prometheus legend wrapper",format:"data-testid prometheus format",step:"prometheus-step",type:"data-testid prometheus type",exemplars:"prometheus-exemplars",builder:{metricSelect:"data-testid metric select",hints:"data-testid prometheus hints",metricsExplorer:"data-testid metrics explorer",queryAdvisor:"data-testid query advisor"},code:{queryField:"data-testid prometheus query field",metricsBrowser:{openButton:"data-testid open metrics browser",selectMetric:"data-testid select a metric",metricList:"data-testid metric list",labelNamesFilter:"data-testid label names filter",labelValuesFilter:"data-testid label values filter",useQuery:"data-testid use query",useAsRateQuery:"data-testid use as rate query",validateSelector:"data-testid validate selector",clear:"data-testid clear"}}},exemplarMarker:"data-testid Exemplar marker",variableQueryEditor:{queryType:"data-testid query type",labelnames:{metricRegex:"data-testid label names metric regex"},labelValues:{labelSelect:"data-testid label values label select"},metricNames:{metricRegex:"data-testid metric names metric regex"},varQueryResult:"data-testid variable query result",seriesQuery:"data-testid prometheus series query",classicQuery:"data-testid prometheus classic query"},annotations:{minStep:"prometheus-annotation-min-step",title:"data-testid prometheus annotation title",tags:"data-testid prometheus annotation tags",text:"data-testid prometheus annotation text",seriesValueAsTimestamp:"data-testid prometheus annotation series value as timestamp"}}},Menu:{MenuComponent:n=>`${n} menu`,MenuGroup:n=>`${n} menu group`,MenuItem:n=>`${n} menu item`,SubMenu:{container:"data-testid SubMenu container",icon:"data-testid SubMenu icon"}},Panels:{Panel:{title:n=>`data-testid Panel header ${n}`,headerItems:n=>`data-testid 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}`,status:n=>`data-testid Panel status ${n}`,loadingBar:()=>"Panel loading bar",HoverWidget:{container:"data-testid hover-header-container",dragIcon:"data-testid drag-icon"},PanelDataErrorMessage:"data-testid Panel data error message"},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:"data testid Pie Chart Slice"},Text:{container:()=>".markdown-html"},Table:{header:"table header",footer:"table-footer",body:"data-testid table body"}}},VizLegend:{seriesName:n=>`data-testid VizLegend series ${n}`},Drawer:{General:{title:n=>`Drawer title ${n}`,expand:"Drawer expand",contract:"Drawer contract",close:"data-testid Drawer close",rcContentWrapper:()=>".rc-drawer-content-wrapper",subtitle:"data-testid drawer subtitle"}},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",showZoomField:"Map controls Show zoom control field property editor",showAttributionField:"Map controls Show attribution field property editor",showScaleField:"Map controls Show scale field property editor",showMeasureField:"Map controls Show measure tools field property editor",showDebugField:"Map controls Show debug field property editor",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:"data-testid query-history-button",addQuery:"data-testid query-tab-add-query"},QueryHistory:{queryText:"Query text"},QueryEditorRows:{rows:"Query editor row"},QueryEditorRow:{actionButton:n=>`data-testid ${n}`,title:n=>`Query editor row title ${n}`,container:n=>`Query editor row ${n}`},AlertTab:{content:"data-testid 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}`,disableTransformationButton:"data-testid Disable transformation button",Reduce:{modeLabel:"data-testid Transform mode label",calculationsLabel:"data-testid Transform calculations label"},SpatialOperations:{actionLabel:"root Action field property editor",locationLabel:"root Location Mode 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:"data-testid search transformations",noTransformationsMessage:"data-testid no transformations message",addTransformationButton:"data-testid add transformation button",removeAllTransformationsButton:"data-testid remove all transformations button"},NavBar:{Configuration:{button:"Configuration"},Toggle:{button:"data-testid Toggle menu"},Reporting:{button:"Reporting"}},NavMenu:{Menu:"data-testid navigation mega-menu",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:"data-testid 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:"data-testid folder-picker-input"},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",dataSourceList:"data-testid Data source list dropdown",advancedModal:{dataSourceList:"data-testid Data source list",builtInDataSourceList:"data-testid Built in data source list"}},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:"data-testid Query field"},QueryBuilder:{queryPatterns:"data-testid Query patterns",labelSelect:"data-testid Select label",valueSelect:"data-testid Select value",matchOperatorSelect:"data-testid Select match operator"},ValuePicker:{button:n=>`data-testid Value picker button ${n}`,select:n=>`data-testid 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:"data-testid Loading indicator"},CallToActionCard:{button:n=>`Call to action button ${n}`,buttonV2:n=>`data-testid Call to action button ${n}`},DataLinksContextMenu:{singleLink:"data-testid Data link"},CodeEditor:{container:"data-testid 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:"data-testid 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",extensionPointTabs:"data-testid-extension-point-tabs",extensionPointTab:n=>`data-testid-extension-point-tab-${n}`},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"},Tooltip:{container:"data-testid tooltip"}}},13544:(Q,A,e)=>{"use strict";e.d(A,{Tp:()=>o});var t=e(13390);const o={pages:{Login:{url:"/login",username:"data-testid Username input field",password:"data-testid Password input field",submit:"data-testid Login button",skip:"data-testid Skip change password button"},Home:{url:"/"},DataSource:{name:"data-testid Data source settings page name input field",delete:"Data source settings page Delete button",readOnly:"data-testid Data source settings page read only message",saveAndTest:"data-testid Data source settings page Save and Test button",alert:"data-testid 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",shareButton:"data-testid share-button"},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.X.CallToActionCard.button("Add annotation query"),addAnnotationCTAV2:t.X.CallToActionCard.buttonV2("Add annotation query"),annotations:"data-testid list-annotations"},Settings:{name:"Annotations settings name input"},NewAnnotation:{panelFilterSelect:"data-testid annotations-panel-filter",showInLabel:"show-in-label",previewInDashboard:"data-testid annotations-preview",delete:"data-testid annotations-delete",apply:"data-testid annotations-apply",enable:"data-testid annotation-enable",hide:"data-testid annotation-hide"}},Variables:{List:{addVariableCTA:t.X.CallToActionCard.button("Add variable"),addVariableCTAV2:t.X.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:"data-testid Variable editor Form Multi switch",selectionOptionsIncludeAllSwitch:"data-testid Variable editor Form IncludeAll switch",selectionOptionsCustomAllInput:"data-testid Variable editor Form IncludeAll field",previewOfValuesOption:"data-testid Variable editor Preview of Values option",submitButton:"data-testid Variable editor Run Query button",applyButton:"data-testid Variable editor Apply button"},QueryVariable:{queryOptionsDataSourceSelect:t.X.DataSourcePicker.inputV2,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:"data-testid 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",autoEnabledCheckbox:"data-testid interval variable auto value checkbox",stepCountIntervalSelect:"data-testid interval variable step count input",minIntervalInput:"data-testid interval variable mininum interval input"},GroupByVariable:{dataSourceSelect:t.X.DataSourcePicker.inputV2,infoText:"data-testid group by variable info text",modeToggle:"data-testid group by variable mode toggle"},AdHocFiltersVariable:{datasourceSelect:t.X.DataSourcePicker.inputV2,infoText:"data-testid ad-hoc filters variable info text"}}}},Annotations:{marker:"data-testid annotation-marker"},Rows:{Repeated:{ConfigSection:{warningMessage:"data-testid Repeated rows warning message"}}}},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:{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"},PublicDashboardConfirmAccess:{submitButton:"data-testid confirm-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:"data-testid Unsigned plugins notice"},PluginPage:{page:"Plugin page",signatureInfo:"data-testid Plugin signature info",disabledInfo:"data-testid Plugin disabled info"},PlaylistForm:{name:"Playlist name",interval:"Playlist interval",itemDelete:"data-testid playlist-form-delete-item"},BrowseDashboards:{table:{body:"data-testid browse-dashboards-table",row:s=>`data-testid browse dashboards row ${s}`,checkbox:s=>`data-testid ${s} checkbox`},NewFolderForm:{form:"data-testid new folder form",nameInput:"data-testid new-folder-name-input",createButton:"data-testid new-folder-create-button"}},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",anonUserDevices:"data-testid anon-user-devices-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"},UserAnonListPage:{container:"data-testid user-anon-list-page"},UsersListPublicDashboardsPage:{container:"data-testid users-list-public-dashboards-page",DashboardsListModal:{listItem:s=>`data-testid dashboards-list-item-${s}`}}},ProfilePage:{url:"/profile"}},components:t.X}},76365:(Q,A,e)=>{"use strict";e.d(A,{Jz:()=>h,oA:()=>d,Ik:()=>f});var t=e(11261),n=e(47696),o=e(57875),s=e(5546),r=e(2543);function g(m,a){const v=u(m);return c(v,a,"parents")}function u(m){return m.map(a=>{if(!a.parents?.length)return a;const v={...a,children:[]},E=[{child:v,parent:a.parents[0]}];for(;E.length;){const D=E.shift(),b={...D.parent,children:D.child?[D.child]:[],parents:[]};D.child&&(b.value=D.child.value,D.child.parents=[b]),D.parent.parents?.length&&E.push({child:b,parent:D.parent.parents[0]})}return v})}function c(m,a,v="children"){const E=v==="parents"?"children":"parents",D=[],b=[{previous:void 0,items:m,level:0}];for(;b.length;){const C=b.shift(),y=C.items.flatMap(x=>x.itemIndexes),M={value:C.items.reduce((x,S)=>x+S.value,0),itemIndexes:y,children:[],parents:[],start:0,level:C.level};if(D[C.level]=D[C.level]||[],D[C.level].push(M),C.previous){M[E]=[C.previous];const x=C.previous[v]?.reduce((S,O)=>S+O.value,0)||0;M.start=C.previous.start+x,C.previous[v].push(M)}const T=C.items.flatMap(x=>x[v]||[]),I=(0,r.groupBy)(T,x=>a.getLabel(x.itemIndexes[0]));for(const x of Object.values(I))b.push({previous:M,items:x,level:C.level+1})}return v==="parents"&&(D.reverse(),D.forEach((C,y)=>{C.forEach(M=>{M.level=y})})),D}function i(m,a){const v=[];let E=0,D;const b={};for(let y=0;y<m.data.length;y++){const M=m.getLevel(y),T=y>0?m.getLevel(y-1):void 0;if(v[M]=v[M]||[],T&&T>=M){const x=v[M][v[M].length-1];E=x.start+m.getValue(x.itemIndexes[0])+m.getValueRight(x.itemIndexes[0]),D=x.parents[0]}const I={itemIndexes:[y],value:m.getValue(y)+m.getValueRight(y),valueRight:m.isDiffFlamegraph()?m.getValueRight(y):void 0,start:E,parents:D&&[D],children:[],level:M};b[m.getLabel(y)]?b[m.getLabel(y)].push(I):b[m.getLabel(y)]=[I],D&&D.children.push(I),D=I,v[M].push(I)}const C=new l(a?.collapsingThreshold);return a?.collapsing&&C.addTree(v[0][0]),[v,b,C.getMap()]}class l{constructor(a){this.map=new Map,this.threshold=.99,a!==void 0&&(this.threshold=a)}addTree(a){const v=[a];for(;v.length;){const E=v.shift();E.parents?.length&&this.addItem(E,E.parents[0]),E.children.length&&v.unshift(...E.children)}}addItem(a,v){if(v&&a.value>v.value*this.threshold&&v.children.length===1)if(this.map.has(v)){const E=this.map.get(v);this.map.set(a,E),E.items.push(a)}else{const E={items:[v,a],collapsed:!0};this.map.set(v,E),this.map.set(a,E)}}getMap(){return new Map(this.map)}}function f(m){return m.missingFields.length?`Data is missing fields: ${m.missingFields.join(", ")}`:m.wrongTypeFields.length?`Data has fields of wrong type: ${m.wrongTypeFields.map(a=>`${a.name} has type ${a.type} but should be ${a.expectedTypes.join(" or ")}`).join(", ")}`:""}function d(m){const a=[["label",[t.PU.string,t.PU.enum]],["level",[t.PU.number]],["value",[t.PU.number]],["self",[t.PU.number]]],v=[],E=[];for(const D of a){const[b,C]=D,y=m.fields.find(M=>M.name===b);if(!y){v.push(b);continue}C.includes(y.type)||E.push({name:b,expectedTypes:C,type:y.type})}if(v.length>0||E.length>0)return{wrongTypeFields:E,missingFields:v}}class h{constructor(a,v,E=(0,n.a)()){this.data=a,this.options=v;const D=d(a);if(D)throw new Error(f(D));if(this.labelField=a.fields.find(C=>C.name==="label"),this.levelField=a.fields.find(C=>C.name==="level"),this.valueField=a.fields.find(C=>C.name==="value"),this.selfField=a.fields.find(C=>C.name==="self"),this.valueRightField=a.fields.find(C=>C.name==="valueRight"),this.selfRightField=a.fields.find(C=>C.name==="selfRight"),(this.valueField||this.selfField)&&!(this.valueField&&this.selfField))throw new Error("Malformed dataFrame: both valueRight and selfRight has to be present if one of them is present.");const b=this.labelField?.config?.type?.enum;b?(this.labelDisplayProcessor=(0,o.J)({field:this.labelField,theme:E}),this.uniqueLabels=b.text||[]):(this.labelDisplayProcessor=C=>({text:C+"",numeric:0}),this.uniqueLabels=[...new Set(this.labelField.values)]),this.valueDisplayProcessor=(0,o.J)({field:this.valueField,theme:E})}isDiffFlamegraph(){return this.valueRightField&&this.selfRightField}getLabel(a){return this.labelDisplayProcessor(this.labelField.values[a]).text}getLevel(a){return this.levelField.values[a]}getValue(a){return p(this.valueField,a)}getValueRight(a){return p(this.valueRightField,a)}getSelf(a){return p(this.selfField,a)}getSelfRight(a){return p(this.selfRightField,a)}getSelfDisplay(a){return this.valueDisplayProcessor(this.getSelf(a))}getUniqueLabels(){return this.uniqueLabels}getUnitTitle(){switch(this.valueField.config.unit){case s.Zk.Bytes:return"RAM";case s.Zk.Nanoseconds:return"Time"}return"Count"}getLevels(){return this.initLevels(),this.levels}getSandwichLevels(a){const v=this.getNodesWithLabel(a);if(!v?.length)return[[],[]];const E=g(v,this),D=c(v,this);return[E,D]}getNodesWithLabel(a){return this.initLevels(),this.uniqueLabelsMap[a]}getCollapsedMap(){return this.initLevels(),this.collapsedMap}initLevels(){if(!this.levels){const[a,v,E]=i(this,this.options);this.levels=a,this.uniqueLabelsMap=v,this.collapsedMap=E}}}function p(m,a){return m?(typeof a=="number"?[a]:a).reduce((E,D)=>E+m.values[D],0):0}},85194:(Q,A,e)=>{"use strict";e.d(A,{A:()=>ca});var t=e(32196),n=e(53076),o=e(96540),s=e(49185),r=e(60578),g=e(14578);const u=22*window.devicePixelRatio,c=10*window.devicePixelRatio,i=.5*window.devicePixelRatio,l=20*window.devicePixelRatio,f=.5*window.devicePixelRatio,d=4*window.devicePixelRatio,h=3*window.devicePixelRatio,p=3*window.devicePixelRatio,m=4*window.devicePixelRatio,a=2*window.devicePixelRatio,v=800,E=120;var D=e(64539),b=e(59093),C=e(28122);const M=({itemData:Rt,onMenuItemClick:qt,onItemFocus:gn,onSandwich:Cn,collapseConfig:mn,onExpandGroup:Sn,onCollapseGroup:Tn,onExpandAllGroups:$n,onCollapseAllGroups:Mn,collapsing:Ln,allGroupsExpanded:na,allGroupsCollapsed:pa})=>{function ia(){return o.createElement(o.Fragment,null,o.createElement(D.D,{label:"Focus block",icon:"eye",onClick:()=>{gn(),qt()}}),o.createElement(D.D,{label:"Copy function name",icon:"copy",onClick:()=>{navigator.clipboard.writeText(Rt.label).then(()=>{qt()})}}),o.createElement(D.D,{label:"Sandwich view",icon:"gf-show-context",onClick:()=>{Cn(),qt()}}),Ln&&o.createElement(b.r,{label:"Grouping"},mn?mn.collapsed?o.createElement(D.D,{label:"Expand group",icon:"angle-double-down",onClick:()=>{Sn(),qt()}}):o.createElement(D.D,{label:"Collapse group",icon:"angle-double-up",onClick:()=>{Tn(),qt()}}):null,!na&&o.createElement(D.D,{label:"Expand all groups",icon:"angle-double-down",onClick:()=>{$n(),qt()}}),!pa&&o.createElement(D.D,{label:"Collapse all groups",icon:"angle-double-up",onClick:()=>{Mn(),qt()}})))}return o.createElement("div",{"data-testid":"contextMenu"},o.createElement(C.t,{renderMenuItems:ia,x:Rt.posX+10,y:Rt.posY,focusOnOpen:!1}))};var T=e(83195),I=e(40845),x=e(28389),S=e(17464),O=e(69503);const P=({data:Rt,item:qt,totalTicks:gn,position:Cn,collapseConfig:mn})=>{const Sn=(0,I.of)(B);if(!(qt&&Cn))return null;let Tn;if(Rt.isDiffFlamegraph()){const $n=U(Rt,qt,gn);Tn=o.createElement(x.j,{className:Sn.tooltipTable,columns:[{id:"label",header:""},{id:"baseline",header:"Baseline"},{id:"comparison",header:"Comparison"},{id:"diff",header:"Diff"}],data:$n,getRowId:Mn=>Mn.rowId})}else{const $n=L(Rt,qt,gn);Tn=o.createElement("p",{className:Sn.lastParagraph},$n.unitTitle,o.createElement("br",null),"Total: ",o.createElement("b",null,$n.unitValue)," (",$n.percentValue,"%)",o.createElement("br",null),"Self: ",o.createElement("b",null,$n.unitSelf)," (",$n.percentSelf,"%)",o.createElement("br",null),"Samples: ",o.createElement("b",null,$n.samples))}return o.createElement(S.ZL,null,o.createElement(O.o,{className:Sn.tooltipContainer,position:Cn,offset:{x:15,y:0}},o.createElement("div",{className:Sn.tooltipContent},o.createElement("p",{className:Sn.tooltipName},Rt.getLabel(qt.itemIndexes[0]),mn&&mn.collapsed?o.createElement("span",null,o.createElement("br",null),"and ",mn.items.length," similar items"):""),Tn)))},L=(Rt,qt,gn)=>{const Cn=Rt.valueDisplayProcessor(qt.value),mn=Rt.getSelfDisplay(qt.itemIndexes),Sn=Math.round(1e4*(Cn.numeric/gn))/100,Tn=Math.round(1e4*(mn.numeric/gn))/100;let $n=Cn.text+Cn.suffix,Mn=mn.text+mn.suffix;const Ln=Rt.getUnitTitle();return Ln==="Count"&&(Cn.suffix||($n=Cn.text),mn.suffix||(Mn=mn.text)),{percentValue:Sn,percentSelf:Tn,unitTitle:Ln,unitValue:$n,unitSelf:Mn,samples:Cn.numeric.toLocaleString()}},U=(Rt,qt,gn)=>{const mn=Rt.getLevels()[0][0].valueRight,Sn=gn-mn,Tn=qt.value-qt.valueRight,$n=Math.round(1e4*Tn/Sn)/100,Mn=Math.round(1e4*qt.valueRight/mn)/100,Ln=(Mn-$n)/$n*100,na=R(Rt,Rt.valueDisplayProcessor(Tn)),pa=R(Rt,Rt.valueDisplayProcessor(qt.valueRight)),ia=(0,T.j_)("short");return[{rowId:"1",label:"% of total",baseline:$n+"%",comparison:Mn+"%",diff:ia(Ln).text+"%"},{rowId:"2",label:"Value",baseline:na,comparison:pa,diff:R(Rt,Rt.valueDisplayProcessor(qt.valueRight-Tn))},{rowId:"3",label:"Samples",baseline:ia(Tn).text,comparison:ia(qt.valueRight).text,diff:ia(qt.valueRight-Tn).text}]};function R(Rt,qt){let gn=qt.text+qt.suffix;return Rt.getUnitTitle()==="Count"&&(qt.suffix||(gn=qt.text)),gn}const B=Rt=>({tooltipContainer:(0,t.css)` title: tooltipContainer; overflow: hidden; `,tooltipContent:(0,t.css)` title: tooltipContent; font-size: ${Rt.typography.bodySmall.fontSize}; width: 100%; `,tooltipName:(0,t.css)` title: tooltipName; margin-top: 0; word-break: break-all; `,lastParagraph:(0,t.css)` title: lastParagraph; margin-bottom: 0; `,name:(0,t.css)` title: name; margin-bottom: 10px; `,tooltipTable:(0,t.css)` title: tooltipTable; max-width: 400px; `}),H=P;var w=e(84140),N=e(5546),V=e(44115);function G(Rt,qt=0){let gn,Cn,mn,Sn,Tn,$n,Mn,Ln;for(gn=Rt.length&3,Cn=Rt.length-gn,mn=qt,Tn=3432918353,$n=461845907,Ln=0;Ln<Cn;)Mn=Rt.charCodeAt(Ln)&255|(Rt.charCodeAt(++Ln)&255)<<8|(Rt.charCodeAt(++Ln)&255)<<16|(Rt.charCodeAt(++Ln)&255)<<24,++Ln,Mn=(Mn&65535)*Tn+(((Mn>>>16)*Tn&65535)<<16)&4294967295,Mn=Mn<<15|Mn>>>17,Mn=(Mn&65535)*$n+(((Mn>>>16)*$n&65535)<<16)&4294967295,mn^=Mn,mn=mn<<13|mn>>>19,Sn=(mn&65535)*5+(((mn>>>16)*5&65535)<<16)&4294967295,mn=(Sn&65535)+27492+(((Sn>>>16)+58964&65535)<<16);switch(Mn=0,gn){case 3:Mn^=(Rt.charCodeAt(Ln+2)&255)<<16;case 2:Mn^=(Rt.charCodeAt(Ln+1)&255)<<8;case 1:Mn^=Rt.charCodeAt(Ln)&255;default:Mn=(Mn&65535)*Tn+(((Mn>>>16)*Tn&65535)<<16)&4294967295,Mn=Mn<<15|Mn>>>17,Mn=(Mn&65535)*$n+(((Mn>>>16)*$n&65535)<<16)&4294967295,mn^=Mn}return mn^=Rt.length,mn^=mn>>>16,mn=(mn&65535)*2246822507+(((mn>>>16)*2246822507&65535)<<16)&4294967295,mn^=mn>>>13,mn=(mn&65535)*3266489909+(((mn>>>16)*3266489909&65535)<<16)&4294967295,mn^=mn>>>16,mn>>>0}const _=[(0,w.A)({h:24,s:69,l:60}),(0,w.A)({h:34,s:65,l:65}),(0,w.A)({h:194,s:52,l:61}),(0,w.A)({h:163,s:45,l:55}),(0,w.A)({h:211,s:48,l:60}),(0,w.A)({h:246,s:40,l:65}),(0,w.A)({h:305,s:63,l:79}),(0,w.A)({h:47,s:100,l:73}),(0,w.A)({r:183,g:219,b:171}),(0,w.A)({r:244,g:213,b:152}),(0,w.A)({r:78,g:146,b:249}),(0,w.A)({r:249,g:186,b:143}),(0,w.A)({r:242,g:145,b:145}),(0,w.A)({r:130,g:181,b:216}),(0,w.A)({r:229,g:168,b:226}),(0,w.A)({r:174,g:162,b:224}),(0,w.A)({r:154,g:196,b:138}),(0,w.A)({r:242,g:201,b:109}),(0,w.A)({r:101,g:197,b:219}),(0,w.A)({r:249,g:147,b:78}),(0,w.A)({r:234,g:100,b:96}),(0,w.A)({r:81,g:149,b:206}),(0,w.A)({r:214,g:131,b:206}),(0,w.A)({r:128,g:110,b:183})],K=ee(1,100,0,1),j=ee(100,100,0,1),k=`linear-gradient(90deg, ${K} 0%, ${j} 100%)`,Y=`linear-gradient(90deg, ${_[0]} 0%, ${_[2]} 30%, ${_[6]} 50%, ${_[7]} 70%, ${_[8]} 100%)`;function ee(Rt,qt,gn,Cn){const mn=Math.min(1,Rt/qt/(Cn-gn)),Sn=50-50*mn,Tn=65+7*mn;return(0,w.A)({h:Sn,s:100,l:Tn})}function re(Rt,qt){const gn=ie(Rt),mn=G(gn||"",0)%_.length;let Sn=_[mn].clone();return qt.isLight&&(Sn=Sn.brighten(15)),Sn}const J=["rgb(0, 170, 0)","rgb(148, 142, 142)","rgb(200, 0, 0)"],ne=`linear-gradient(90deg, ${J[0]} 0%, ${J[1]} 50%, ${J[2]} 100%)`,q=["rgb(26, 133, 255)","rgb(148, 142, 142)","rgb(220, 50, 32)"],te=`linear-gradient(90deg, ${q[0]} 0%, ${q[1]} 50%, ${q[2]} 100%)`;function oe(Rt,qt,gn,Cn,mn){const Sn=mn===N.yU.Default?J:q,Tn=(0,V.scaleLinear)().domain([-100,0,100]).range(Sn),$n=Rt-qt,Mn=gn-Cn;if(Cn===0||Mn===0){const Xn=Tn(0);return(0,w.A)(Xn)}const Ln=Math.round(1e4*$n/Mn)/100,pa=(Math.round(1e4*qt/Cn)/100-Ln)/Ln*100,ia=Tn(pa);return(0,w.A)(ia)}const ue=[["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 ie(Rt){for(const[qt,gn]of ue){const Cn=Rt.match(gn);if(Cn)return Cn.groups?.packageName||""}}function ge(Rt){const{canvasRef:qt,data:gn,root:Cn,depth:mn,direction:Sn,wrapperWidth:Tn,rangeMin:$n,rangeMax:Mn,matchedLabels:Ln,textAlign:na,totalViewTicks:pa,totalColorTicks:ia,totalTicksRight:Xn,colorScheme:Da,focusedItemData:ba,collapsedMap:Oa}=Rt,sa=Te(qt,Tn,mn),Jn=(0,I.$j)(),Va=(0,o.useMemo)(()=>{const Ms=(0,w.A)(Jn.colors.background.secondary);return Jn.isLight?Ms.darken(10).toHexString():Ms.lighten(10).toHexString()},[Jn]),ts=le(ia,Xn,Da,Jn,Va,$n,Mn,Ln,ba?ba.item.level:0),Ds=he(sa,gn,ts,na,Oa);(0,o.useEffect)(()=>{if(!sa)return;sa.clearRect(0,0,sa.canvas.width,sa.canvas.height);const Ms=new Path2D;pe(Cn,Sn,gn,pa,$n,Mn,Tn,Oa,(Ns,cs,Ps,ir,Cs,as,ar)=>{ar?Ms.rect(cs,Ps,ir,Cs):Ds(Ns,cs,Ps,ir,Cs,as)}),sa.fillStyle=Va,sa.fill(Ms)},[sa,gn,Cn,Tn,$n,Mn,pa,Sn,Ds,Oa,Va])}function he(Rt,qt,gn,Cn,mn){return(0,o.useMemo)(()=>Rt?(Tn,$n,Mn,Ln,na,pa)=>{Rt.beginPath(),Rt.rect($n+f,Mn,Ln,na),Rt.fillStyle=gn(Tn,pa,!1),Rt.stroke(),Rt.fill();const ia=mn.get(Tn);let Xn=pa;ia&&ia.collapsed&&(Xn=`(${ia.items.length}) `+pa),Ln>=l&&(ia?(Ee(Rt,qt,Xn,Tn,Ln,Cn==="left"?$n+m+a:$n,Mn,Cn),De(Rt,$n,Mn,na,Tn,ia)):Ee(Rt,qt,Xn,Tn,Ln,$n,Mn,Cn))}:()=>{},[Rt,gn,Cn,qt,mn])}function De(Rt,qt,gn,Cn,mn,Sn){const Tn=qt+m;Rt.beginPath(),Rt.rect(qt,gn,Tn-qt+h+p,Cn),Rt.fill(),Rt.beginPath(),Sn.collapsed?Rt.rect(Tn,gn+Cn/4,h,Cn/2):Sn.items[0]===mn?Rt.rect(Tn,gn+Cn/2,h,Cn/2):Sn.items[Sn.items.length-1]===mn?Rt.rect(Tn,gn,h,Cn/2):Rt.rect(Tn,gn,h,Cn),Rt.fillStyle="#666",Rt.fill()}function pe(Rt,qt,gn,Cn,mn,Sn,Tn,$n,Mn){const Ln=[];Ln.push({item:Rt,levelOffset:0});const na=Tn*window.devicePixelRatio/Cn/(Sn-mn);let pa;for(;Ln.length>0;){const{item:ia,levelOffset:Xn}=Ln.shift();let Da=ia.value;const ba=Da*na<=c,Oa=Da*na-(ba?0:f*2),sa=u;if(Oa<i)continue;let Jn=0,Va=!1;const ts=$n.get(ia),Ds=ts&&ts.collapsed;if(Ds&&pa===ts.items[0]?(Jn=qt==="children"?-1:1,Va=!0):pa=void 0,!Va){const Ns=Re(ia.start,Cn,mn,na),cs=(ia.level+Xn)*u;let Ps=gn.getLabel(ia.itemIndexes[0]);Ds&&(pa=ia),Mn(ia,Ns,cs,Oa,sa,Ps,ba)}const Ms=qt==="children"?ia.children:ia.parents;Ms&&Ln.unshift(...Ms.map(Ns=>({item:Ns,levelOffset:Xn+Jn})))}}function le(Rt,qt,gn,Cn,mn,Sn,Tn,$n,Mn){return(0,o.useCallback)(function(na,pa,ia){if(ia&&!$n)return mn;const Xn=na.valueRight!==void 0&&(gn===N.yU.Default||gn===N.yU.DiffColorBlind)?oe(na.value,na.valueRight,Rt,qt,gn):gn===N.zM.ValueBased?ee(na.value,Rt,Sn,Tn):re(pa,Cn);return $n?$n.has(pa)?Xn.toHslString():mn:na.level>Mn-1?Xn.toHslString():Xn.lighten(15).toHslString()},[Rt,qt,gn,Cn,Sn,Tn,$n,Mn,mn])}function Te(Rt,qt,gn){const[Cn,mn]=(0,o.useState)();return(0,o.useEffect)(()=>{if(!(gn&&Rt.current))return;const Sn=Rt.current.getContext("2d"),Tn=u*gn;Rt.current.width=Math.round(qt*window.devicePixelRatio),Rt.current.height=Math.round(Tn),Rt.current.style.width=`${qt}px`,Rt.current.style.height=`${Tn/window.devicePixelRatio}px`,Sn.textBaseline="middle",Sn.font=12*window.devicePixelRatio+"px monospace",Sn.strokeStyle="white",mn(Sn)},[Rt,mn,qt,gn]),Cn}function Ee(Rt,qt,gn,Cn,mn,Sn,Tn,$n){Rt.save(),Rt.clip(),Rt.fillStyle="#222";const Mn=qt.valueDisplayProcessor(Cn.value),Ln=Mn.suffix?Mn.text+Mn.suffix:Mn.text,na=Rt.measureText(gn),pa=mn-d;let ia=`${gn} (${Ln})`,Xn=Math.max(Sn,0)+d;na.width>pa&&(Rt.textAlign=$n,$n==="right"&&(ia=gn,Xn=Sn+mn-d)),Rt.fillText(ia,Xn,Tn+u/2+2),Rt.restore()}function Re(Rt,qt,gn,Cn){return(Rt-qt*gn)*Cn}const me=({data:Rt,rangeMin:qt,rangeMax:gn,matchedLabels:Cn,setRangeMin:mn,setRangeMax:Sn,onItemFocused:Tn,focusedItemData:$n,textAlign:Mn,onSandwich:Ln,colorScheme:na,totalProfileTicks:pa,totalProfileTicksRight:ia,totalViewTicks:Xn,root:Da,direction:ba,depth:Oa,showFlameGraphOnly:sa,collapsedMap:Jn,setCollapsedMap:Va,collapsing:ts})=>{const Ds=Le(),[Ms,{width:Ns}]=(0,s.A)(),cs=(0,o.useRef)(null),[Ps,ir]=(0,o.useState)(),[Cs,as]=(0,o.useState)();ge({canvasRef:cs,colorScheme:na,data:Rt,focusedItemData:$n,root:Da,direction:ba,depth:Oa,rangeMax:gn,rangeMin:qt,matchedLabels:Cn,textAlign:Mn,totalViewTicks:Xn,totalColorTicks:Rt.isDiffFlamegraph()?pa:Xn,totalTicksRight:ia,wrapperWidth:Ns,collapsedMap:Jn});const ar=(0,o.useCallback)(os=>{ir(void 0);const is=cs.current.clientWidth/Xn/(gn-qt),Ls=We({x:os.nativeEvent.offsetX,y:os.nativeEvent.offsetY},Da,ba,Oa,is,Xn,qt,Jn);as(Ls?{posY:os.clientY,posX:os.clientX,item:Ls,label:Rt.getLabel(Ls.itemIndexes[0])}:void 0)},[Rt,qt,gn,Xn,Da,ba,Oa,Jn]),[lr,Is]=(0,o.useState)(),cr=(0,o.useCallback)(os=>{if(Cs===void 0){ir(void 0),Is(void 0);const is=cs.current.clientWidth/Xn/(gn-qt),Ls=We({x:os.nativeEvent.offsetX,y:os.nativeEvent.offsetY},Da,ba,Oa,is,Xn,qt,Jn);Ls&&(Is({x:os.clientX,y:os.clientY}),ir(Ls))}},[qt,gn,Xn,Cs,Is,Da,ba,Oa,Jn]),Zs=(0,o.useCallback)(()=>{ir(void 0)},[]);return(0,o.useEffect)(()=>{const os=is=>{is.target instanceof HTMLElement&&is.target.parentElement?.id!=="flameGraphCanvasContainer_clickOutsideCheck"&&as(void 0)};return window.addEventListener("click",os),()=>window.removeEventListener("click",os)},[as]),o.createElement("div",{className:Ds.graph},o.createElement("div",{className:Ds.canvasWrapper,id:"flameGraphCanvasContainer_clickOutsideCheck",ref:Ms},o.createElement("canvas",{ref:cs,"data-testid":"flameGraph",onClick:ar,onMouseMove:cr,onMouseLeave:Zs})),o.createElement(H,{position:lr,item:Ps,data:Rt,totalTicks:Xn,collapseConfig:Ps?Jn.get(Ps):void 0}),!sa&&Cs&&o.createElement(M,{itemData:Cs,collapsing:ts,collapseConfig:Jn.get(Cs.item),onMenuItemClick:()=>{as(void 0)},onItemFocus:()=>{mn(Cs.item.start/Xn),Sn((Cs.item.start+Cs.item.value)/Xn),Tn(Cs)},onSandwich:()=>{Ln(Rt.getLabel(Cs.item.itemIndexes[0]))},onExpandGroup:()=>{Va(Me(Jn,Cs.item,!1))},onCollapseGroup:()=>{Va(Me(Jn,Cs.item,!0))},onExpandAllGroups:()=>{Va(ye(Jn,!1))},onCollapseAllGroups:()=>{Va(ye(Jn,!0))},allGroupsCollapsed:Array.from(Jn.values()).every(os=>os.collapsed),allGroupsExpanded:Array.from(Jn.values()).every(os=>!os.collapsed)}))};function Me(Rt,qt,gn){const Cn=new Map(Rt),mn=Rt.get(qt),Sn={...mn,collapsed:gn};for(const Tn of mn.items)Cn.set(Tn,Sn);return Cn}function ye(Rt,qt){const gn=new Map(Rt);for(const Cn of Rt.keys()){const Sn={...Rt.get(Cn),collapsed:qt};gn.set(Cn,Sn)}return gn}const Le=()=>({graph:(0,t.css)({label:"graph",overflow:"auto",flexGrow:1,flexBasis:"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)({label:"sandwichMarker",writingMode:"vertical-lr",transform:"rotate(180deg)",overflow:"hidden",whiteSpace:"nowrap"}),sandwichMarkerIcon:(0,t.css)({label:"sandwichMarkerIcon",verticalAlign:"baseline"})}),We=(Rt,qt,gn,Cn,mn,Sn,Tn,$n)=>{let Mn=qt,Ln=gn==="children"?0:Cn-1;const na=Math.floor(Rt.y/(u/window.devicePixelRatio));let pa;for(;Mn;){const ia=Mn;if(Mn=void 0,Ln===na){pa=ia;break}const Xn=gn==="children"?ia.children:ia.parents||[];for(const Da of Xn){const ba=Re(Da.start,Sn,Tn,mn),Oa=Re(Da.start+Da.value,Sn,Tn,mn);if(ba<=Rt.x&&Rt.x<Oa){Mn=Da;const sa=$n.get(Da);(!sa||!sa.collapsed||sa.items[0]===Da)&&(Ln=Ln+(gn==="children"?1:-1));break}}}return pa},Be=me;var Ye=e(29158);const at=o.memo(({data:Rt,focusedItem:qt,totalTicks:gn,sandwichedLabel:Cn,onFocusPillClick:mn,onSandwichPillClick:Sn})=>{const Tn=(0,I.of)(st),$n=[],Mn=(0,T.j_)("short")(gn),Ln=Rt.valueDisplayProcessor(gn);let na=Ln.text+Ln.suffix;const pa=Rt.getUnitTitle();if(pa==="Count"&&(Ln.suffix||(na=Ln.text)),$n.push(o.createElement("div",{className:Tn.metadataPill,key:"default"},na," | ",Mn.text,Mn.suffix," samples (",pa,")")),Cn&&$n.push(o.createElement("span",{key:"sandwich"},o.createElement(g.I,{size:"sm",name:"angle-right"}),o.createElement("div",{className:Tn.metadataPill},o.createElement(g.I,{size:"sm",name:"gf-show-context"})," ",o.createElement("span",{className:Tn.metadataPillName},Cn.substring(Cn.lastIndexOf("/")+1)),o.createElement(Ye.K,{className:Tn.pillCloseButton,name:"times",size:"sm",onClick:Sn,tooltip:"Remove sandwich view","aria-label":"Remove sandwich view"})))),qt){const ia=Math.round(1e4*(qt.item.value/gn))/100;$n.push(o.createElement("span",{key:"focus"},o.createElement(g.I,{size:"sm",name:"angle-right"}),o.createElement("div",{className:Tn.metadataPill},o.createElement(g.I,{size:"sm",name:"eye"})," ",ia,"% of total",o.createElement(Ye.K,{className:Tn.pillCloseButton,name:"times",size:"sm",onClick:mn,tooltip:"Remove focus","aria-label":"Remove focus"}))))}return o.createElement(o.Fragment,null,o.createElement("div",{className:Tn.metadata},$n))});at.displayName="FlameGraphMetadata";const st=Rt=>({metadataPill:(0,t.css)` label: metadataPill; display: inline-flex; align-items: center; background: ${Rt.colors.background.secondary}; border-radius: ${Rt.shape.borderRadius(8)}; padding: ${Rt.spacing(.5,1)}; font-size: ${Rt.typography.bodySmall.fontSize}; font-weight: ${Rt.typography.fontWeightMedium}; line-height: ${Rt.typography.bodySmall.lineHeight}; color: ${Rt.colors.text.secondary}; `,pillCloseButton:(0,t.css)` label: pillCloseButton; vertical-align: text-bottom; margin: ${Rt.spacing(0,.5)}; `,metadata:(0,t.css)` margin: 8px 0; text-align: center; `,metadataPillName:(0,t.css)` label: metadataPillName; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: ${Rt.spacing(.5)}; `}),Ke=at,Xe=({data:Rt,rangeMin:qt,rangeMax:gn,matchedLabels:Cn,setRangeMin:mn,setRangeMax:Sn,onItemFocused:Tn,focusedItemData:$n,textAlign:Mn,onSandwich:Ln,sandwichItem:na,onFocusPillClick:pa,onSandwichPillClick:ia,colorScheme:Xn,showFlameGraphOnly:Da,collapsing:ba})=>{const Oa=He(),[sa,Jn]=(0,o.useState)(new Map),[Va,ts]=(0,o.useState)(),[Ds,Ms]=(0,o.useState)(),[Ns,cs]=(0,o.useState)(0),[Ps,ir]=(0,o.useState)(),[Cs,as]=(0,o.useState)(0);if((0,o.useEffect)(()=>{if(Rt){Jn(Rt.getCollapsedMap());let Is=Rt.getLevels(),cr=Is.length?Is[0][0].value:0,Zs=Is.length?Is[0][0].valueRight:void 0,os=cr,is;if(na){const[Ls,ks]=Rt.getSandwichLevels(na);Is=ks,is=Ls,os=ks[0]?.[0]?.value??0}ts(Is),Ms(is),cs(cr),ir(Zs),as(os)}},[Rt,na]),!Va)return null;const ar={data:Rt,rangeMin:qt,rangeMax:gn,matchedLabels:Cn,setRangeMin:mn,setRangeMax:Sn,onItemFocused:Tn,focusedItemData:$n,textAlign:Mn,onSandwich:Ln,colorScheme:Xn,totalProfileTicks:Ns,totalProfileTicksRight:Ps,totalViewTicks:Cs,showFlameGraphOnly:Da,collapsedMap:sa,setCollapsedMap:Jn,collapsing:ba},lr=Ds?o.createElement(o.Fragment,null,o.createElement("div",{className:Oa.sandwichCanvasWrapper},o.createElement("div",{className:Oa.sandwichMarker},"Callers",o.createElement(g.I,{className:Oa.sandwichMarkerIcon,name:"arrow-down"})),o.createElement(Be,{...ar,root:Ds[Ds.length-1][0],depth:Ds.length,direction:"parents",collapsing:!1})),o.createElement("div",{className:Oa.sandwichCanvasWrapper},o.createElement("div",{className:(0,t.cx)(Oa.sandwichMarker,Oa.sandwichMarkerCalees)},o.createElement(g.I,{className:Oa.sandwichMarkerIcon,name:"arrow-up"}),"Callees"),o.createElement(Be,{...ar,root:Va[0][0],depth:Va.length,direction:"children",collapsing:!1}))):o.createElement(Be,{...ar,root:Va[0][0],depth:Va.length,direction:"children"});return o.createElement("div",{className:Oa.graph},o.createElement(Ke,{data:Rt,focusedItem:$n,sandwichedLabel:na,totalTicks:Cs,onFocusPillClick:pa,onSandwichPillClick:ia}),lr)},He=()=>({graph:(0,t.css)` label: graph; overflow: auto; flex-grow: 1; flex-basis: 50%; `,sandwichCanvasWrapper:(0,t.css)` label: sandwichCanvasWrapper; display: flex; margin-bottom: ${u/window.devicePixelRatio}px; `,sandwichMarker:(0,t.css)` label: sandwichMarker; writing-mode: vertical-lr; transform: rotate(180deg); overflow: hidden; white-space: nowrap; `,sandwichMarkerCalees:(0,t.css)` label: sandwichMarkerCalees; text-align: right; `,sandwichMarkerIcon:(0,t.css)` label: sandwichMarkerIcon; vertical-align: baseline; `}),Ge=Xe;var xe=e(76365),$e=e(75198),be=e(80292),Z=e(55852),ae=e(10354),de=e(94354),ve=e(38138),Ue=e(83122);const _e=({search:Rt,setSearch:qt,selectedView:gn,setSelectedView:Cn,containerWidth:mn,onReset:Sn,textAlign:Tn,onTextAlignChange:$n,showResetButton:Mn,colorScheme:Ln,onColorSchemeChange:na,stickyHeader:pa,extraHeaderElements:ia,vertical:Xn,isDiffMode:Da})=>{const ba=(0,I.of)(nt,pa),[Oa,sa]=ot(Rt,qt),Jn=Oa!==""?o.createElement(Z.$n,{icon:"times",fill:"text",size:"sm",onClick:()=>{qt(""),sa("")}},"Clear"):null;return o.createElement("div",{className:ba.header},o.createElement("div",{className:ba.inputContainer},o.createElement(ae.p,{value:Oa||"",onChange:Va=>{sa(Va.currentTarget.value)},placeholder:"Search...",suffix:Jn})),o.createElement("div",{className:ba.rightContainer},Mn&&o.createElement(Z.$n,{variant:"secondary",fill:"outline",size:"sm",icon:"history-alt",tooltip:"Reset focus and sandwich state",onClick:()=>{Sn()},className:ba.buttonSpacing,"aria-label":"Reset focus and sandwich state"}),o.createElement(ze,{value:Ln,onChange:na,isDiffMode:Da}),o.createElement(de.z,{size:"sm",disabled:gn===N.F8.TopTable,options:Ve,value:Tn,onChange:$n,className:ba.buttonSpacing}),o.createElement(de.z,{size:"sm",options:Ne(mn,Xn),value:gn,onChange:Cn}),ia&&o.createElement("div",{className:ba.extraElements},ia)))};function ze(Rt){const qt=(0,I.of)(nt,!1);let gn=o.createElement(ve.W,null,o.createElement(ve.W.Item,{label:"By package name",onClick:()=>Rt.onChange(N.zM.PackageBased)}),o.createElement(ve.W.Item,{label:"By value",onClick:()=>Rt.onChange(N.zM.ValueBased)}));Rt.isDiffMode&&(gn=o.createElement(ve.W,null,o.createElement(ve.W.Item,{label:"Default (green to red)",onClick:()=>Rt.onChange(N.yU.Default)}),o.createElement(ve.W.Item,{label:"Color blind (blue to red)",onClick:()=>Rt.onChange(N.yU.DiffColorBlind)})));const Cn={[N.zM.ValueBased]:qt.colorDotByValue,[N.zM.PackageBased]:qt.colorDotByPackage,[N.yU.DiffColorBlind]:qt.colorDotDiffColorBlind,[N.yU.Default]:qt.colorDotDiffDefault}[Rt.value]||qt.colorDotByValue;return o.createElement(Ue.m,{overlay:gn},o.createElement(Z.$n,{variant:"secondary",fill:"outline",size:"sm",tooltip:"Change color scheme",onClick:()=>{},className:qt.buttonSpacing,"aria-label":"Change color scheme"},o.createElement("span",{className:(0,t.cx)(qt.colorDot,Cn)})))}const Ve=[{value:"left",description:"Align text left",icon:"align-left"},{value:"right",description:"Align text right",icon:"align-right"}];function Ne(Rt,qt){let gn=[{value:N.F8.TopTable,label:"Top Table",description:"Only show top table"},{value:N.F8.FlameGraph,label:"Flame Graph",description:"Only show flame graph"}];return(Rt>=v||qt)&&gn.push({value:N.F8.Both,label:"Both",description:"Show both the top table and flame graph"}),gn}function ot(Rt,qt){const[gn,Cn]=(0,o.useState)(Rt),mn=(0,be.A)(Rt);return(0,$e.A)(()=>{qt(gn)},250,[gn]),(0,o.useEffect)(()=>{mn!==Rt&&Rt!==gn&&Cn(Rt)},[Rt,mn,gn]),[gn,Cn]}const nt=(Rt,qt)=>({header:(0,t.css)` label: header; display: flex; flex-wrap: wrap; justify-content: space-between; width: 100%; top: 0; ${qt?(0,t.css)` z-index: ${Rt.zIndex.navbarFixed}; position: sticky; padding-bottom: ${Rt.spacing(1)}; padding-top: ${Rt.spacing(1)}; background: ${Rt.colors.background.primary}; `:""}; `,inputContainer:(0,t.css)` label: inputContainer; margin-right: 20px; flex-grow: 1; min-width: 150px; max-width: 350px; `,rightContainer:(0,t.css)` label: rightContainer; display: flex; align-items: flex-start; flex-wrap: wrap; `,buttonSpacing:(0,t.css)` label: buttonSpacing; margin-right: ${Rt.spacing(1)}; `,resetButton:(0,t.css)` label: resetButton; display: flex; margin-right: ${Rt.spacing(2)}; `,resetButtonIconWrapper:(0,t.css)` label: resetButtonIcon; padding: 0 5px; color: ${Rt.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: ${k}; `,colorDotByPackage:(0,t.css)` label: colorDotByPackage; background: ${Y}; `,colorDotDiffDefault:(0,t.css)` label: colorDotDiffDefault; background: ${ne}; `,colorDotDiffColorBlind:(0,t.css)` label: colorDotDiffColorBlind; background: ${te}; `,extraElements:(0,t.css)` label: extraElements; margin-left: ${Rt.spacing(1)}; `}),pt=_e;var mt=e(70713),gt=e(11261),Pt=e(25019),Mt=e(90708),Yt=e(77093),zt=e(52622);const _t=o.memo(({data:Rt,onSymbolClick:qt,search:gn,matchedLabels:Cn,onSearch:mn,sandwichItem:Sn,onSandwich:Tn,onTableSort:$n})=>{const Mn=(0,o.useMemo)(()=>{let Xn={};for(let Da=0;Da<Rt.data.length;Da++){const ba=Rt.getValue(Da),Oa=Rt.getValueRight(Da),sa=Rt.getSelf(Da),Jn=Rt.getLabel(Da);(!Cn||Cn.has(Jn))&&(Xn[Jn]=Xn[Jn]||{},Xn[Jn].self=Xn[Jn].self?Xn[Jn].self+sa:sa,Xn[Jn].total=Xn[Jn].total?Xn[Jn].total+ba:ba,Xn[Jn].totalRight=Xn[Jn].totalRight?Xn[Jn].totalRight+Oa:Oa)}return Xn},[Rt,Cn]),Ln=(0,I.of)(jt),na=(0,I.$j)(),[pa,ia]=(0,o.useState)([{displayName:"Self",desc:!0}]);return o.createElement("div",{className:Ln.topTableContainer,"data-testid":"topTable"},o.createElement(mt.Ay,{style:{width:"100%"}},({width:Xn,height:Da})=>{if(Xn<3||Da<3)return null;const ba=rt(Rt,Mn,Xn,qt,mn,Tn,na,gn,Sn);return o.createElement(Yt.X,{initialSortBy:pa,onSortByChange:Oa=>{Oa&&Oa.length&&$n?.(Oa[0].displayName+"_"+(Oa[0].desc?"desc":"asc")),ia(Oa)},data:ba,width:Xn,height:Da})}))});_t.displayName="FlameGraphTopTableContainer";function rt(Rt,qt,gn,Cn,mn,Sn,Tn,$n,Mn){const Ln=ft(Sn,mn,$n,Mn),na={type:gt.PU.string,name:"Symbol",values:[],config:{custom:{width:gn-Dn-E*2},links:[{title:"Highlight symbol",url:"",onClick:Xn=>{const ba=Xn.origin.field.values[Xn.origin.rowIndex];Cn(ba)}}]}};let pa;if(Rt.isDiffFlamegraph()){na.config.custom.width=gn-Dn-E*3;const Xn=It("Baseline","percent"),Da=It("Comparison","percent"),ba=It("Diff","percent");ba.config.custom.cellOptions.type=zt.ob.ColorText,ba.config.mappings=[{type:Pt.d.ValueToText,options:{[1/0]:{text:"new",color:"red"}}},{type:Pt.d.ValueToText,options:{[-100]:{text:"removed",color:"green"}}},{type:Pt.d.RangeToText,options:{from:0,to:1/0,result:{color:"red"}}},{type:Pt.d.RangeToText,options:{from:-1/0,to:0,result:{color:"green"}}}];const Oa=Rt.getLevels(),sa=Oa.length?Oa[0][0].value:0,Jn=Oa.length?Oa[0][0].valueRight:void 0;for(let Va in qt){Ln.values.push(null),na.values.push(Va);const ts=qt[Va].total,Ds=qt[Va].totalRight,Ms=sa-Jn,Ns=Math.round(1e4*ts/Ms)/100,cs=Math.round(1e4*Ds/Jn)/100,Ps=(cs-Ns)/Ns*100;ba.values.push(Ps),Xn.values.push(Ns),Da.values.push(cs)}pa={fields:[Ln,na,Xn,Da,ba],length:na.values.length}}else{const Xn=It("Self",Rt.selfField.config.unit),Da=It("Total",Rt.valueField.config.unit);for(let ba in qt)Ln.values.push(null),na.values.push(ba),Xn.values.push(qt[ba].self),Da.values.push(qt[ba].total);pa={fields:[Ln,na,Xn,Da],length:na.values.length}}return(0,Mt.we)({data:[pa],fieldConfig:{defaults:{},overrides:[]},replaceVariables:Xn=>Xn,theme:Tn})[0]}function It(Rt,qt){const gn={width:E,align:"auto",inspect:!1,cellOptions:{type:zt.ob.Auto}};return{type:gt.PU.number,name:Rt,values:[],config:{unit:qt,custom:gn}}}const Dn=61;function ft(Rt,qt,gn,Cn){const mn={type:zt.ob.Custom,cellComponent:Tn=>o.createElement(yt,{frame:Tn.frame,onSandwich:Rt,onSearch:qt,search:gn,sandwichItem:Cn,rowIndex:Tn.rowIndex})},Sn={filterable:!1,width:Dn,hideHeader:!0,inspect:!1,align:"auto",cellOptions:mn};return{type:gt.PU.number,name:"actions",values:[],config:{custom:Sn}}}function yt(Rt){const qt=cn(),gn=Rt.frame.fields.find(Sn=>Sn.name==="Symbol")?.values[Rt.rowIndex],Cn=Rt.search===gn,mn=Rt.sandwichItem===gn;return o.createElement("div",{className:qt.actionCellWrapper},o.createElement(Ye.K,{className:qt.actionCellButton,name:"search",variant:Cn?"primary":"secondary",tooltip:Cn?"Clear from search":"Search for symbol","aria-label":Cn?"Clear from search":"Search for symbol",onClick:()=>{Rt.onSearch(Cn?"":gn)}}),o.createElement(Ye.K,{className:qt.actionCellButton,name:"gf-show-context",tooltip:mn?"Remove from sandwich view":"Show in sandwich view",variant:mn?"primary":"secondary","aria-label":mn?"Remove from sandwich view":"Show in sandwich view",onClick:()=>{Rt.onSandwich(mn?void 0:gn)}}))}const jt=Rt=>({topTableContainer:(0,t.css)({label:"topTableContainer",padding:Rt.spacing(1),backgroundColor:Rt.colors.background.secondary,height:"100%"})}),cn=()=>({actionCellWrapper:(0,t.css)` label: actionCellWrapper; display: flex; height: 24px; `,actionCellButton:(0,t.css)` label: actionCellButton; margin-right: 0; width: 24px; `}),pn=_t,on=new n.A,Xt=({data:Rt,onTableSymbolClick:qt,onViewSelected:gn,onTextAlignSelected:Cn,onTableSort:mn,getTheme:Sn,stickyHeader:Tn,extraHeaderElements:$n,vertical:Mn,showFlameGraphOnly:Ln,disableCollapsing:na})=>{const[pa,ia]=(0,o.useState)(),[Xn,Da]=(0,o.useState)(0),[ba,Oa]=(0,o.useState)(1),[sa,Jn]=(0,o.useState)(""),[Va,ts]=(0,o.useState)(N.F8.Both),[Ds,{width:Ms}]=(0,s.A)(),[Ns,cs]=(0,o.useState)("left"),[Ps,ir]=(0,o.useState)(),Cs=Sn(),as=(0,o.useMemo)(()=>{if(Rt)return new xe.Jz(Rt,{collapsing:!na},Cs)},[Rt,Cs,na]),[ar,lr]=fn(as),Is=hn(Cs),cr=An(sa,as);(0,o.useEffect)(()=>{Ms>0&&Ms<v&&Va===N.F8.Both&&!Mn&&ts(N.F8.FlameGraph)},[Va,ts,Ms,Mn]);const Zs=(0,o.useCallback)(()=>{ia(void 0),Da(0),Oa(1)},[ia,Oa,Da]);function os(){ir(void 0)}(0,o.useEffect)(()=>{Zs(),os()},[Rt,Zs]);const is=(0,o.useCallback)(qs=>{sa===qs?Jn(""):(qt?.(qs),Jn(qs),Zs())},[Jn,Zs,qt,sa]);if(!as)return null;const Ls=o.createElement(Ge,{data:as,rangeMin:Xn,rangeMax:ba,matchedLabels:cr,setRangeMin:Da,setRangeMax:Oa,onItemFocused:qs=>ia(qs),focusedItemData:pa,textAlign:Ns,sandwichItem:Ps,onSandwich:qs=>{Zs(),ir(qs)},onFocusPillClick:Zs,onSandwichPillClick:os,colorScheme:ar,showFlameGraphOnly:Ln,collapsing:!na}),ks=o.createElement(pn,{data:as,onSymbolClick:is,search:sa,matchedLabels:cr,sandwichItem:Ps,onSandwich:ir,onSearch:Jn,onTableSort:mn});let Pr;return Ln||Va===N.F8.FlameGraph?Pr=Ls:Va===N.F8.TopTable?Pr=o.createElement("div",{className:Is.tableContainer},ks):Va===N.F8.Both&&(Mn?Pr=o.createElement("div",null,o.createElement("div",{className:Is.verticalGraphContainer},Ls),o.createElement("div",{className:Is.verticalTableContainer},ks)):Pr=o.createElement("div",{className:Is.horizontalContainer},o.createElement("div",{className:Is.horizontalTableContainer},ks),o.createElement("div",{className:Is.horizontalGraphContainer},Ls))),o.createElement(r.D.Provider,{value:Cs},o.createElement("div",{ref:Ds,className:Is.container},!Ln&&o.createElement(pt,{search:sa,setSearch:Jn,selectedView:Va,setSelectedView:qs=>{ts(qs),gn?.(qs)},containerWidth:Ms,onReset:()=>{Zs(),os()},textAlign:Ns,onTextAlignChange:qs=>{cs(qs),Cn?.(qs)},showResetButton:!!(pa||Ps),colorScheme:ar,onColorSchemeChange:lr,stickyHeader:!!Tn,extraHeaderElements:$n,vertical:Mn,isDiffMode:!!as.isDiffFlamegraph()}),o.createElement("div",{className:Is.body},Pr)))};function fn(Rt){const qt=Rt?.isDiffFlamegraph()?N.yU.Default:N.zM.PackageBased,[gn,Cn]=(0,o.useState)(qt);return(0,o.useEffect)(()=>{Cn(qt)},[qt]),[gn,Cn]}function An(Rt,qt){return(0,o.useMemo)(()=>{if(Rt&&qt){const gn=new Set;let Cn=on.filter(qt.getUniqueLabels(),Rt);if(Cn)for(let mn of Cn)gn.add(qt.getUniqueLabels()[mn]);return gn}},[Rt,qt])}function hn(Rt){return{container:(0,t.css)({label:"container",overflow:"auto",height:"100%",display:"flex",flex:"1 1 0",flexDirection:"column",minHeight:0,gap:Rt.spacing(1)}),body:(0,t.css)({label:"body",flexGrow:1}),tableContainer:(0,t.css)({height:800}),horizontalContainer:(0,t.css)({label:"horizontalContainer",display:"flex",minHeight:0,flexDirection:"row",columnGap:Rt.spacing(1),width:"100%"}),horizontalGraphContainer:(0,t.css)({flexBasis:"50%"}),horizontalTableContainer:(0,t.css)({flexBasis:"50%",maxHeight:800}),verticalGraphContainer:(0,t.css)({marginBottom:Rt.spacing(1)}),verticalTableContainer:(0,t.css)({height:800})}}const ca=Xt},5546:(Q,A,e)=>{"use strict";e.d(A,{F8:()=>n,Zk:()=>t,yU:()=>s,zM:()=>o});var t=(r=>(r.Bytes="bytes",r.Short="short",r.Nanoseconds="ns",r))(t||{}),n=(r=>(r.TopTable="topTable",r.FlameGraph="flameGraph",r.Both="both",r))(n||{}),o=(r=>(r.ValueBased="valueBased",r.PackageBased="packageBased",r))(o||{}),s=(r=>(r.Default="default",r.DiffColorBlind="diffColorBlind",r))(s||{})},20323:(Q,A,e)=>{"use strict";e.d(A,{e:()=>u});var t=e(96540),n=e(40996),o=e(14186),s=e(10354);const r=/^(-?\d+(?:\.\d+)?)(ms|[Mwdhmsy])$/,g=(c,i)=>!(c.match(i)||!c),u=c=>{const i=c.validationRegex||r,[l,f]=(0,t.useState)(()=>c.value?g(c.value,i):!1);(0,n.A)(()=>{f(g(c.value,i))},500,[c.value]);const d={labelWidth:26,disabled:c.disabled??!1,invalid:l,error:c.isInvalidError};return c.label&&(d.label=c.label,d.tooltip=c.tooltip||""),t.createElement(o.I,{...d},t.createElement(s.p,{type:"text",placeholder:c.placeholder||"0",width:c.width||40,onChange:h=>{c.onChange(h.currentTarget.value)},value:c.value,"aria-label":c.ariaLabel||"interval input"}))}},61653:(Q,A,e)=>{"use strict";e.d(A,{Dk:()=>p,NI:()=>a,ft:()=>h,x3:()=>d});var t=e(32196),n=e(96540),o=e(50877),s=e(22391),r=e(29020),g=e(35931),u=e(40845),c=e(39268),i=e(14186),l=e(88323),f=e(10354);const d="None",h="Duration",p="Tag";function m({options:E,onOptionsChange:D}){const b=(0,u.of)(v),C=[d,h,p].map(o.z);return n.createElement("div",{className:(0,t.css)({width:"100%"})},n.createElement(c.C,{className:b.row},n.createElement(i.I,{label:"Label",labelWidth:26,tooltip:"Default: duration",grow:!0},n.createElement(l.l6,{inputId:"label",options:C,value:E.jsonData.spanBar?.type||"",onChange:y=>{(0,s.lO)({onOptionsChange:D,options:E},"spanBar",{...E.jsonData.spanBar,type:y?.value??""})},placeholder:"Duration",isClearable:!0,"aria-label":"select-label-name",width:40}))),E.jsonData.spanBar?.type===p&&n.createElement(c.C,{className:b.row},n.createElement(i.I,{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(f.p,{type:"text",placeholder:"Enter tag key",onChange:y=>(0,s.lO)({onOptionsChange:D,options:E},"spanBar",{...E.jsonData.spanBar,tag:y.currentTarget.value}),value:E.jsonData.spanBar?.tag||"",width:40}))))}const a=({options:E,onOptionsChange:D})=>{let b=E.type;return b+=E.type==="tempo"?"/configure-tempo-data-source/#span-bar":"/#span-bar",n.createElement(r.I,{title:"Span bar",description:n.createElement(g.H,{description:"Add additional info next to the service and operation on a span bar row in the trace view.",suffix:b,feature:"the span bar"})},n.createElement(m,{options:E,onOptionsChange:D}))},v=E=>({infoText:(0,t.css)({label:"infoText",paddingBottom:E.spacing(2),color:E.colors.text.secondary}),row:(0,t.css)({label:"row",alignItems:"baseline"})})},63009:(Q,A,e)=>{"use strict";e.d(A,{l:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(57752),r=e(76892),g=e(27746);const u=({values:i,onChange:l,id:f})=>{const d=(0,o.of)(c);return n.createElement("div",{className:d.wrapper},i.length?i.map((h,p)=>n.createElement("div",{className:d.pair,key:p},n.createElement(s.o,{id:`${f}-key-${p}`,placeholder:"Tag name",value:h.key,onChange:m=>{l(i.map((a,v)=>v===p?{...a,key:String(m)}:a))}}),n.createElement(r.c,{"aria-label":"equals",className:d.operator},"as"),n.createElement(s.o,{id:`${f}-value-${p}`,placeholder:"New name (optional)",value:h.value||"",onChange:m=>{l(i.map((a,v)=>v===p?{...a,value:String(m)}:a))}}),n.createElement(g.I,{onClick:()=>l([...i.slice(0,p),...i.slice(p+1)]),className:(0,t.cx)(d.removeTag,"query-part"),"aria-label":"Remove tag",type:"button",icon:"times"}),p===i.length-1?n.createElement(g.I,{onClick:()=>l([...i,{key:"",value:""}]),className:"query-part","aria-label":"Add tag",type:"button",icon:"plus"}):null)):n.createElement(g.I,{icon:"plus",onClick:()=>l([...i,{key:"",value:""}]),className:"query-part","aria-label":"Add tag",type:"button"}))},c=i=>({wrapper:(0,t.css)({display:"flex",flexDirection:"column",gap:`${i.spacing(.5)} 0`}),pair:(0,t.css)({display:"flex",justifyContent:"start",alignItems:"center"}),operator:(0,t.css)({color:i.v1.palette.orange,width:"auto"}),removeTag:(0,t.css)({marginRight:i.spacing(.5)})})},43549:(Q,A,e)=>{"use strict";e.d(A,{FJ:()=>v,T0:()=>E,XX:()=>a,cJ:()=>m,sn:()=>d});var t=e(32196),n=e(96540),o=e(91062),s=e(35931),r=e(55882),g=e(39268),u=e(14186),c=e(15292),i=e(10354),l=e(20323),f=e(63009);function d(D){if(D?.tracesToLogsV2)return D.tracesToLogsV2;if(!D?.tracesToLogs)return;const b={customQuery:!1};return b.datasourceUid=D.tracesToLogs.datasourceUid,b.tags=D.tracesToLogs.mapTagNamesEnabled?D.tracesToLogs.mappedTags:D.tracesToLogs.tags?.map(C=>({key:C})),b.filterByTraceID=D.tracesToLogs.filterByTraceID,b.filterBySpanID=D.tracesToLogs.filterBySpanID,b.spanStartTimeShift=D.tracesToLogs.spanStartTimeShift,b.spanEndTimeShift=D.tracesToLogs.spanEndTimeShift,b}function h({options:D,onOptionsChange:b}){const C=["loki","elasticsearch","grafana-splunk-datasource","grafana-opensearch-datasource","grafana-falconlogscale-datasource","googlecloud-logging-datasource"],y=(0,n.useMemo)(()=>d(D.jsonData)||{customQuery:!1},[D.jsonData]),{query:M="",tags:T,customQuery:I}=y,x=(0,n.useCallback)(S=>{b({...D,jsonData:{...D.jsonData,tracesToLogsV2:{...y,...S},tracesToLogs:void 0}})},[b,D,y]);return n.createElement("div",{className:(0,t.css)({width:"100%"})},n.createElement(g.C,null,n.createElement(u.I,{tooltip:"The logs data source the trace is going to navigate to",label:"Data source",labelWidth:26},n.createElement(r.s,{inputId:"trace-to-logs-data-source-picker",filter:S=>C.includes(S.type),current:y.datasourceUid,noDefault:!0,width:40,onChange:S=>x({datasourceUid:S.uid})}))),n.createElement(g.C,null,n.createElement(l.e,{label:m("start"),tooltip:a("start","0"),value:y.spanStartTimeShift||"",onChange:S=>{x({spanStartTimeShift:S})},isInvalidError:v})),n.createElement(g.C,null,n.createElement(l.e,{label:m("end"),tooltip:a("end","0"),value:y.spanEndTimeShift||"",onChange:S=>{x({spanEndTimeShift:S})},isInvalidError:v})),n.createElement(g.C,null,n.createElement(u.I,{tooltip:"Tags that will be used in the query. Default tags: 'cluster', 'hostname', 'namespace', 'pod', 'service.name', 'service.namespace'",label:"Tags",labelWidth:26},n.createElement(f.l,{values:T??[],onChange:S=>x({tags:S})}))),n.createElement(p,{disabled:I,type:"trace",id:"filterByTraceID",value:!!y.filterByTraceID,onChange:S=>x({filterByTraceID:S})}),n.createElement(p,{disabled:I,type:"span",id:"filterBySpanID",value:!!y.filterBySpanID,onChange:S=>x({filterBySpanID:S})}),n.createElement(g.C,null,n.createElement(u.I,{tooltip:"Use a custom query with the possibility to interpolate variables from the trace or span",label:"Use custom query",labelWidth:26},n.createElement(c.K,{id:"customQuerySwitch",value:I,onChange:S=>x({customQuery:S.currentTarget.checked})}))),I&&n.createElement(u.I,{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(i.p,{label:"Query",type:"text",allowFullScreen:!0,value:M,onChange:S=>x({query:S.currentTarget.value})})))}function p(D){return n.createElement(g.C,null,n.createElement(u.I,{disabled:D.disabled,label:`Filter by ${D.type} ID`,labelWidth:26,grow:!0,tooltip:`Filters logs by ${D.type} ID`},n.createElement(c.K,{id:D.id,value:D.value,onChange:b=>D.onChange(b.currentTarget.checked)})))}const m=D=>`Span ${D} time shift`,a=(D,b)=>`Shifts the ${D} time of the span. Default: ${b} (Time units can be used here, for example: 5s, -1m, 3h)`,v="Invalid time shift. See tooltip for examples.",E=({options:D,onOptionsChange:b})=>{let C=D.type;return C+=D.type==="tempo"?"/configure-tempo-data-source/#trace-to-logs":"/#trace-to-logs",n.createElement(o.A,{title:"Trace to logs",description:n.createElement(s.H,{description:"Navigate from a trace span to the selected data source's logs.",suffix:C,feature:"trace to logs"}),isCollapsible:!0,isInitiallyOpen:!0},n.createElement(h,{options:D,onOptionsChange:b}))}},80822:(Q,A,e)=>{"use strict";e.d(A,{Wn:()=>r,_k:()=>s});var t=e(41260),n=e(11261),o=e(21423);function s(d,h){const p=r({data:d.series},{data:h.series}).data;return{...d,series:p}}function r(d,h){if(!d)return i(h);h.data.forEach(v=>{const E=d.data.find(D=>f(D,v));if(!E){d.data.push(l(v));return}g(E,v)});const p=[...d.errors??[],...h.errors??[]];p.length>0&&(d.errors=p);const m=d.error??h.error;m!=null&&(d.error=m);const a=[...d.traceIds??[],...h.traceIds??[]];return a.length>0&&(d.traceIds=a),d}function g(d,h){const p=Math.max(d.fields.length,h.fields.length);for(let m=0;m<p;m++){if(!d.fields[m])continue;const a=d.fields[m].name?h.fields.find(v=>v.name===d.fields[m].name):h.fields[m];if(a&&(d.fields[m].values=[].concat.apply(a.values,d.fields[m].values),a.nanos)){const v=d.fields[m].nanos?.slice()||[];d.fields[m].nanos=h.fields[m].nanos?.concat(v)}}d.length+=h.length,d.meta={...d.meta,stats:c(d.meta?.stats??[],h.meta?.stats??[])}}const u="Summary: total bytes processed";function c(d,h){const p=d.find(v=>v.displayName===u),m=h.find(v=>v.displayName===u);if(m!=null&&p!=null)return[{value:m.value+p.value,displayName:u,unit:p.unit}];const a=m??p;return a!=null?[a]:[]}function i(d){return{...d,data:d.data.map(l)}}function l(d){return{...d,fields:d.fields.map(h=>({...h,values:h.values}))}}function f(d,h){if(d.refId!==h.refId)return!1;const p=d.meta?.type,m=h.meta?.type;if(p!==m)return!1;if(p===t.m.TimeSeriesMulti){const E=d.fields.find(b=>b.type===n.PU.number),D=h.fields.find(b=>b.type===n.PU.number);return E===void 0||D===void 0?!1:(0,o.ab)(E.labels??{},D.labels??{})}const a=d.meta?.custom?.frameType,v=h.meta?.custom?.frameType;return a==="LabeledTimeValues"&&v==="LabeledTimeValues"}},32528:(Q,A,e)=>{"use strict";e.d(A,{GT:()=>g,dY:()=>c,jP:()=>s,pl:()=>r});var t=e(37471),n=e(25352),o=e(11261);function s(i){return i.sort((f,d)=>f[0]-d[0]),i.reduce((f,d)=>{if(!f.length)return[d];const h=f.slice(-1)[0],[p,m]=h,[a,v]=d;return v<m?f:a>m?[...f,d]:[...f.slice(0,-1),[p,v]]},[]).reduce((f,d)=>f+(d[1]-d[0]),0)}function r(i){const l={};let f;for(let d=0;f=i(d),!!f;d++){l[f.id]?l[f.id].span=f.span:l[f.id]={span:f.span,children:[]};for(const h of f.parentIds)h&&(l[h]?l[h].children.push(f.id):l[h]={span:void 0,children:[f.id]})}return l}function g(i,l,f){return{main:`${u(i)}ms (${u(i/l*100)}%)`,secondary:`${u(f)}ms (${u(f/i*100)}%)`}}function u(i){return parseFloat(i.toFixed(2))}function c(){const i=new t.k({fields:[{name:n.u.id,type:o.PU.string},{name:n.u.title,type:o.PU.string},{name:n.u.subTitle,type:o.PU.string},{name:n.u.mainStat,type:o.PU.string,config:{displayName:"Total time (% of trace)"}},{name:n.u.secondaryStat,type:o.PU.string,config:{displayName:"Self time (% of total)"}},{name:n.u.color,type:o.PU.number,config:{color:{mode:"continuous-GrYlRd"},displayName:"Self time / Trace duration"}}],meta:{preferredVisualisationType:"nodeGraph"}}),l=new t.k({fields:[{name:n.u.id,type:o.PU.string},{name:n.u.target,type:o.PU.string},{name:n.u.source,type:o.PU.string}],meta:{preferredVisualisationType:"nodeGraph"}});return[i,l]}},5261:(Q,A,e)=>{"use strict";e.d(A,{L:()=>n,y:()=>o});var t=e(32264);function n(s){return{grafana_version:t.$.buildInfo.version,plugin_type:String(s.type),plugin_version:s.info.version,plugin_id:s.id,plugin_name:s.name}}function o(s){return{...n(s.meta),datasource_uid:s.uid}}},44027:(Q,A,e)=>{"use strict";e.d(A,{G:()=>u});var t=e(96540),n=e(92470),o=e(95187),s=e(14110),r=e(5261);const g="grafana_plugin_";function u(){const i=(0,n.Q)();return(0,t.useMemo)(()=>{const l=(0,o.S)(i)?(0,r.y)(i.instanceSettings):(0,r.L)(i.meta);return(f,d)=>{if(!c(f))throw new Error(`Interactions reported in plugins should start with: "${g}".`);return(0,s.rR)(f,{...d,...l})}},[i])}function c(i){return i.startsWith(g)&&i.length>g.length}},61298:(Q,A,e)=>{"use strict";e.d(A,{fX:()=>o,nB:()=>n,n_:()=>t,p6:()=>s});var t=(r=>(r.DashboardView="dashboard-view",r.DataRequest="data-request",r))(t||{});const n=r=>!!r.payload.page,o=r=>!!r.payload.interactionName,s=r=>!!r.payload.experimentId},14110:(Q,A,e)=>{"use strict";e.d(A,{G$:()=>s,Jy:()=>r,Xp:()=>u,rR:()=>g});var t=e(32264),n=e(12131),o=e(63415);const s=c=>{(0,o.x$)().addEvent({type:o.on.MetaAnalytics,payload:c})},r=()=>{const c=n.Ny.getLocation(),i=`${t.$.appSubUrl??""}${c.pathname}${c.search}${c.hash}`;(0,o.x$)().addEvent({type:o.on.Pageview,payload:{page:i}})},g=(c,i)=>{(0,o.x$)().addEvent({type:o.on.Interaction,payload:{interactionName:c,properties:i}})},u=(c,i,l)=>{(0,o.x$)().addEvent({type:o.on.ExperimentView,payload:{experimentId:c,experimentGroup:i,experimentVariant:l}})}},55882:(Q,A,e)=>{"use strict";e.d(A,{s:()=>l});var t=e(96540),n=e(22391),o=e(51527),s=e(13544),r=e(88323),g=e(66864),u=e(98624),c=e(19347),i=e(26657);class l extends t.PureComponent{constructor(d){super(d),this.dataSourceSrv=(0,c.l)(),this.state={},this.onChange=(h,p)=>{if(p.action==="clear"&&this.props.onClear){this.props.onClear();return}const m=this.dataSourceSrv.getInstanceSettings(h.value);m&&(this.props.onChange(m),this.setState({error:void 0}))}}componentDidMount(){const{current:d}=this.props;this.dataSourceSrv.getInstanceSettings(d)||this.setState({error:"Could not find data source "+d})}getCurrentValue(){const{current:d,hideTextValue:h,noDefault:p}=this.props;if(!d&&p)return;const m=this.dataSourceSrv.getInstanceSettings(d);if(m)return{label:m.name.slice(0,37),value:m.uid,imgUrl:m.meta.info.logos.small,hideText:h,meta:m.meta};const a=(0,n.Iz)(d);return a===i.dR.uid||a===i.dR.name?{label:a,value:a,hideText:h}:{label:(a??"no name")+" - not found",value:a??void 0,imgUrl:"",hideText:h}}getDataSourceOptions(){const{alerting:d,tracing:h,metrics:p,mixed:m,dashboard:a,variables:v,annotations:E,pluginId:D,type:b,filter:C,logs:y}=this.props;return this.dataSourceSrv.getList({alerting:d,tracing:h,metrics:p,logs:y,dashboard:a,mixed:m,variables:v,annotations:E,pluginId:D,filter:C,type:b}).map(T=>({value:T.name,label:`${T.name}${T.isDefault?" (default)":""}`,imgUrl:T.meta.info.logos.small,meta:T.meta}))}render(){const{autoFocus:d,onBlur:h,onClear:p,openMenuOnFocus:m,placeholder:a,width:v,inputId:E,disabled:D=!1,isLoading:b=!1}=this.props,{error:C}=this.state,y=this.getDataSourceOptions(),M=this.getCurrentValue(),T=typeof p=="function";return t.createElement("div",{"aria-label":"Data source picker select container","data-testid":s.Tp.components.DataSourcePicker.container},t.createElement(r.l6,{isLoading:b,disabled:D,"aria-label":"Select a data source","data-testid":s.Tp.components.DataSourcePicker.inputV2,inputId:E||"data-source-picker",className:"ds-picker select-container",isMulti:!1,isClearable:T,backspaceRemovesValue:!1,onChange:this.onChange,options:y,autoFocus:d,onBlur:h,width:v,openMenuOnFocus:m,maxMenuHeight:500,placeholder:a,noOptionsMessage:"No datasources found",value:M??null,invalid:!!C||!!this.props.invalid,getOptionLabel:I=>I.meta&&(0,o.x)(I.meta.signature)&&I!==M?t.createElement(g.Gy,{align:"center",justify:"space-between",height:"auto"},t.createElement("span",null,I.label)," ",t.createElement(u.B,{status:I.meta.signature})):I.label||""}))}}l.defaultProps={autoFocus:!1,openMenuOnFocus:!1,placeholder:"Select data source"}},96937:(Q,A,e)=>{"use strict";e.d(A,{f:()=>t,p:()=>n});let t=()=>{throw new Error("EmbeddedDashboard requires runtime initialization")};function n(o){t=o}},97152:(Q,A,e)=>{"use strict";e.d(A,{a:()=>n,e:()=>o});var t=e(96540);let n=({message:s})=>t.createElement("div",null,"Unable to render data: ",s,".");function o(s){n=s}},24308:(Q,A,e)=>{"use strict";e.d(A,{Y:()=>o,m:()=>n});var t=e(96540);let n=()=>t.createElement("div",null,"PanelRenderer can only be used after Grafana instance has been started.");function o(s){n=s}},46235:(Q,A,e)=>{"use strict";e.d(A,{V:()=>n,l:()=>o});var t=e(96540);let n=({children:s})=>t.createElement("div",null,s);function o(s){n=s}},32264:(Q,A,e)=>{"use strict";e.d(A,{$:()=>l,p:()=>r});var t=e(2543),n=e.n(t),o=e(42994),s=e(97594);class r{constructor(d){this.publicDashboardsEnabled=!0,this.snapshotEnabled=!0,this.datasources={},this.panels={},this.apps={},this.auth={},this.minRefreshInterval="",this.appUrl="",this.appSubUrl="",this.namespace="default",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.anonymousDeviceLimit=void 0,this.licenseInfo={},this.rendererAvailable=!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.analytics={enabled:!0},this.googleAnalytics4SendManualPageViews=!1,this.sqlConnectionLimits={maxOpenConns:100,maxIdleConns:100,connMaxLifetime:14400},this.disableFrontendSandboxForPlugins=[],this.bootData=d.bootData;const h={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,h,d),this.buildInfo=d.buildInfo||h.buildInfo,this.dateFormats&&o.WC.update(this.dateFormats),this.buildInfo.env==="development"&&u(this),g(this),this.featureToggles.disableAngular&&(this.angularSupportEnabled=!1),this.theme2=(0,s.g)(this.bootData.user.theme),this.bootData.user.lightTheme=this.theme2.isLight,this.theme=this.theme2.v1}}function g(f){const d=f.featureToggles,h="grafana.featureToggles",p=window.localStorage.getItem(h);if(p){const m=p.split(",");for(const a of m){const[v,E]=a.split("="),D=E==="true"||E==="1";d[v]=D,console.log(`Setting feature toggle ${v} = ${D} via localstorage`)}}}function u(f){if(window.location.href.indexOf("__feature")===-1)return;new URLSearchParams(window.location.search).forEach((h,p)=>{if(p.startsWith("__feature.")){const m=f.featureToggles,a=p.substring(10),v=h==="true"||h==="";v!==m[p]&&(m[a]=v,console.log(`Setting feature toggle ${a} = ${v} via url`))}})}const c=window.grafanaBootData||{settings:{},user:{},navTree:[]},i=c.settings;i.bootData=c;const l=new r(i)},13303:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{CopyPanelEvent:()=>l.ah,DataSourcePicker:()=>x.s,DataSourceWithBackend:()=>D.iy,EchoEventType:()=>r.on,EmbeddedDashboard:()=>L.f,FakeEchoSrv:()=>r.c_,GrafanaBootConfig:()=>h.p,HealthCheckError:()=>D.b1,HealthStatus:()=>D.VQ,HistoryWrapper:()=>i.K9,MetaAnalyticsEventName:()=>p.n_,PanelDataErrorView:()=>y.a,PanelRenderer:()=>C.m,PluginPage:()=>I.V,RefreshEvent:()=>l._,StreamingFrameAction:()=>c.Kh,SystemJS:()=>m.zO,ThemeChangedEvent:()=>l.E8,TimeRangeUpdatedEvent:()=>l.sR,config:()=>h.$,createDataSourcePluginEventProperties:()=>S.y,createMonitoringLogger:()=>E.DW,createPluginEventProperties:()=>S.L,createQueryRunner:()=>T.d,featureEnabled:()=>v.a,frameToMetricFindValue:()=>b.$h,getAngularLoader:()=>n.E,getAppEvents:()=>l.J7,getBackendSrv:()=>t.AI,getDataSourceSrv:()=>o.l,getEchoSrv:()=>r.x$,getGrafanaLiveSrv:()=>c.oF,getLegacyAngularInjector:()=>u.C,getLocationSrv:()=>s.X,getPluginComponentExtensions:()=>f.Dp,getPluginExtensions:()=>f.O3,getPluginImportUtils:()=>m.o,getPluginLinkExtensions:()=>f.Kf,getRunRequest:()=>T.XJ,getTemplateSrv:()=>g.w,isExperimentViewEvent:()=>p.p6,isFetchError:()=>t.NF,isInteractionEvent:()=>p.fX,isPageviewEvent:()=>p.nB,isPluginExtensionComponent:()=>d.a,isPluginExtensionLink:()=>d.D,loadPluginCss:()=>m.PL,locationSearchToObject:()=>i.SE,locationService:()=>i.Ny,logDebug:()=>E.MD,logError:()=>E.vV,logInfo:()=>E.fH,logWarning:()=>E.FF,navigationLogger:()=>i.Lc,registerEchoBackend:()=>r.pl,reportExperimentView:()=>a.Xp,reportInteraction:()=>a.rR,reportMetaAnalytics:()=>a.G$,reportPageview:()=>a.Jy,setAngularLoader:()=>n.w,setAppEvents:()=>l.H8,setBackendSrv:()=>t.u5,setDataSourceSrv:()=>o.h,setEchoSrv:()=>r.H2,setEmbeddedDashboard:()=>L.p,setGrafanaLiveSrv:()=>c.S8,setLegacyAngularInjector:()=>u.j,setLocationService:()=>i.vG,setLocationSrv:()=>s.T,setPluginExtensionGetter:()=>f.cE,setPluginImportUtils:()=>m.se,setQueryRunnerFactory:()=>T.HC,setReturnToPreviousHook:()=>P._,setRunRequest:()=>T.pC,setTemplateSrv:()=>g.d,toDataQueryError:()=>M.u,toDataQueryResponse:()=>b.bE,usePluginInteractionReporter:()=>O.G,useReturnToPrevious:()=>P.i});var t=e(17172),n=e(7376),o=e(19347),s=e(23509),r=e(63415),g=e(72574),u=e(81634),c=e(78731),i=e(12131),l=e(3591),f=e(4402),d=e(80882),h=e(32264),p=e(61298),m=e(89191),a=e(14110),v=e(33378),E=e(34867),D=e(26657),b=e(47773),C=e(24308),y=e(97152),M=e(12091),T=e(63639),I=e(46235),x=e(55882),S=e(5261),O=e(44027),P=e(14778),L=e(96937)},7376:(Q,A,e)=>{"use strict";e.d(A,{E:()=>o,w:()=>n});let t;function n(s){t=s}function o(){return t}},63415:(Q,A,e)=>{"use strict";e.d(A,{H2:()=>o,c_:()=>g,on:()=>t,pl:()=>r,x$:()=>s});var t=(u=>(u.Performance="performance",u.MetaAnalytics="meta-analytics",u.Pageview="pageview",u.Interaction="interaction",u.ExperimentView="experimentview",u.GrafanaJavascriptAgent="grafana-javascript-agent",u))(t||{});let n;function o(u){if(n instanceof g)for(const c of n.buffer)u.addEvent(c.event,c.meta);n=u}function s(){return n||(n=new g),n}const r=u=>{s().addBackend(u)};class g{constructor(){this.buffer=[]}flush(){this.buffer=[]}addBackend(c){}addEvent(c,i){this.buffer.push({event:c,meta:i})}}},12131:(Q,A,e)=>{"use strict";e.d(A,{K9:()=>u,Lc:()=>d,Ny:()=>i,SE:()=>c,vG:()=>l});var t=e(17929),n=e(76885),o=e(95344),s=e(91040),r=e(40621),g=e(32264);class u{constructor(p){this.history=p||t.zR({basename:g.$.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(p,m){const a=this.history.location,v=this.getSearchObject();for(const D of Object.keys(p))p[D]===null||p[D]===void 0?delete v[D]:v[D]=p[D];const E=n.kM.renderUrl(a.pathname,v);m?this.history.replace(E,this.history.location.state):this.history.push(E,this.history.location.state)}push(p){this.history.push(p)}replace(p){this.history.replace(p)}reload(){const p=this.history.location.state?.routeReloadCounter;this.history.replace({...this.history.location,state:{routeReloadCounter:p?p+1:1}})}getLocation(){return this.history.location}getSearchObject(){return c(this.history.location.search)}update(p){if((0,o.l)("LocationSrv","update","partial, push or replace"),p.partial&&p.query)this.partial(p.query,p.partial);else{const m={pathname:p.path};p.query&&(m.search=n.kM.toUrlParams(p.query)),p.replace?this.replace(m):this.push(m)}}}function c(h){let p=typeof h=="number"?String(h):h;return p.length>0?p.startsWith("?")?n.kM.parseKeyValue(p.substring(1)):n.kM.parseKeyValue(p):{}}let i=new u;const l=h=>{throw new Error("locationService can be only overriden in test environment")},f=(0,s.h)("Router"),d=f.logger;(0,r.h)("location",i,f)},23509:(Q,A,e)=>{"use strict";e.d(A,{T:()=>n,X:()=>o});let t;function n(s){t=s}function o(){return t}},63639:(Q,A,e)=>{"use strict";e.d(A,{HC:()=>n,XJ:()=>g,d:()=>o,pC:()=>r});let t;const n=u=>{if(t)throw new Error("Runner should only be set when Grafana is starting.");t=u},o=()=>{if(!t)throw new Error("`createQueryRunner` can only be used after Grafana instance has started.");return t()};let s;function r(u){if(s)throw new Error("runRequest function should only be set once, when Grafana is starting.");s=u}function g(){if(!s)throw new Error("getRunRequest can only be used after Grafana instance has started.");return s}},3591:(Q,A,e)=>{"use strict";e.d(A,{E8:()=>o,H8:()=>u,J7:()=>c,_:()=>n,ah:()=>r,sR:()=>s});var t=e(65463);class n extends t.a{}n.type="refresh";class o extends t.x{}o.type="theme-changed";class s extends t.x{}s.type="time-range-updated";class r extends t.x{}r.type="copy-panel";let g;function u(i){g=i}function c(){return g}},17172:(Q,A,e)=>{"use strict";e.d(A,{AI:()=>s,NF:()=>t,u5:()=>o});function t(r){return typeof r=="object"&&r!==null&&"status"in r&&"data"in r}let n;const o=r=>{n=r},s=()=>n},19347:(Q,A,e)=>{"use strict";e.d(A,{h:()=>n,l:()=>o});let t;function n(s){t=s}function o(){return t}},81634:(Q,A,e)=>{"use strict";e.d(A,{C:()=>o,j:()=>n});let t;const n=s=>{t=s},o=()=>t},78731:(Q,A,e)=>{"use strict";e.d(A,{Kh:()=>t.Kh,S8:()=>o,oF:()=>s});var t=e(9631);let n;const o=r=>{n=r},s=()=>n},4402:(Q,A,e)=>{"use strict";e.d(A,{Dp:()=>u,Kf:()=>g,O3:()=>r,cE:()=>o});var t=e(80882);let n;function o(c){if(n)throw new Error("setPluginExtensionGetter() function should only be called once, when Grafana is starting.");n=c}function s(){if(!n)throw new Error("getPluginExtensionGetter() can only be used after the Grafana instance has started.");return n}const r=c=>s()(c),g=c=>{const{extensions:i}=r(c);return{extensions:i.filter(t.D)}},u=c=>{const{extensions:i}=r(c);return{extensions:i.filter(t.a)}}},80882:(Q,A,e)=>{"use strict";e.d(A,{D:()=>n,a:()=>o});var t=e(74135);function n(s){return s?s.type===t.u.link&&("path"in s||"onClick"in s):!1}function o(s){return s?s.type===t.u.component&&"component"in s:!1}},72574:(Q,A,e)=>{"use strict";e.d(A,{d:()=>n,w:()=>o});let t;const n=s=>{t=s},o=()=>t},26657:(Q,A,e)=>{"use strict";e.d(A,{iy:()=>M,dR:()=>E,b1:()=>b,VQ:()=>C,s9:()=>D,ph:()=>I,x7:()=>T});var t=e(62467),n=e(75505),o=e(44240),s=e(63720),r=e(66847),g=e(40187),u=e(22391),c=e(55004),i=e(89667),l=e(92341),f=e(32264),d=e(19347),h=e(78731),p=e(17172),m=e(9631),a=e(47773);function v(x){const{intervalMs:S,maxDataPoints:O,requestId:P,panelId:L,queryCachingTTL:U,range:{from:R,to:B}}=x;if(!x.targets.length)return(0,t.of)({data:[]});const H={intervalMs:S,maxDataPoints:O,queryCachingTTL:U,timeRange:{from:R.valueOf().toString(),to:B.valueOf().toString(),timezone:x.timezone}};return(0,p.AI)().fetch({url:`/api/public/dashboards/${f.$.publicDashboardAccessToken}/panels/${L}/query`,method:"POST",data:H,requestId:P}).pipe((0,s.n)(w=>(0,t.of)((0,a.bE)(w,x.targets))),(0,r.W)(w=>(0,t.of)((0,a.bE)(w))))}const E=Object.freeze({type:"__expr__",uid:"__expr__",name:"Expression"});function D(x){if(!x)return!1;const S=typeof x=="string"?x:x.type;return S===E.type||S===E.name||S==="-100"}class b extends Error{constructor(S,O){super(S),this.details=O,this.name="HealthCheckError"}}var C=(x=>(x.Unknown="UNKNOWN",x.OK="OK",x.Error="ERROR",x))(C||{}),y=(x=>(x.PluginID="X-Plugin-Id",x.DatasourceUID="X-Datasource-Uid",x.DashboardUID="X-Dashboard-Uid",x.PanelID="X-Panel-Id",x.PanelPluginId="X-Panel-Plugin-Id",x.QueryGroupID="X-Query-Group-Id",x.FromExpression="X-Grafana-From-Expr",x.SkipQueryCache="X-Cache-Skip",x))(y||{});class M extends g.mA{constructor(S){super(S),this.streamOptionsProvider=I}query(S){if(f.$.publicDashboardAccessToken)return v(S);const{intervalMs:O,maxDataPoints:P,queryCachingTTL:L,range:U,requestId:R,hideFromInspector:B=!1}=S;let H=S.targets;this.filterQuery&&(H=H.filter(k=>this.filterQuery(k)));let w=!1;const N=new Set,V=new Set,G=H.map(k=>{let Y=this.getRef(),ee=this.id,re=!0;if(D(k.datasource))return w=!0,{...k,datasource:E};if(k.datasource){const J=(0,d.l)().getInstanceSettings(k.datasource,S.scopedVars);if(!J)throw new Error(`Unknown Datasource: ${JSON.stringify(k.datasource)}`);const ne=J.rawRef??(0,u.p$)(J),q=J.id;(ne.uid!==Y.uid||ee!==q)&&(Y=ne,ee=q,re=!1)}return Y.type?.length&&N.add(Y.type),Y.uid?.length&&V.add(Y.uid),{...re?this.applyTemplateVariables(k,S.scopedVars,S.filters):k,datasource:Y,datasourceId:ee,intervalMs:O,maxDataPoints:P,queryCachingTTL:L}});if(!G.length)return(0,t.of)({data:[]});const _={queries:G,from:U?.from.valueOf().toString(),to:U?.to.valueOf().toString()};if(f.$.featureToggles.queryOverLive)return(0,h.oF)().getQueryData({request:S,body:_});const K={};K["X-Plugin-Id"]=Array.from(N).join(", "),K["X-Datasource-Uid"]=Array.from(V).join(", ");let j="/api/ds/query?ds_type="+this.type;return w&&(K["X-Grafana-From-Expr"]="true",j+="&expression=true"),R&&(j+=`&requestId=${R}`),S.dashboardUID&&(K["X-Dashboard-Uid"]=S.dashboardUID),S.panelId&&(K["X-Panel-Id"]=`${S.panelId}`),S.panelPluginId&&(K["X-Panel-Plugin-Id"]=`${S.panelPluginId}`),S.queryGroupId&&(K["X-Query-Group-Id"]=`${S.queryGroupId}`),S.skipQueryCache&&(K["X-Cache-Skip"]="true"),(0,p.AI)().fetch({url:j,method:"POST",data:_,requestId:R,hideFromInspector:B,headers:K}).pipe((0,s.n)(k=>{const Y=(0,a.bE)(k,G);return Y.data?.length&&Y.data.find(ee=>ee.meta?.channel)?T(Y,S,this.streamOptionsProvider):(0,t.of)(Y)}),(0,r.W)(k=>(0,t.of)((0,a.bE)(k))))}getRequestHeaders(){const S={};return S["X-Plugin-Id"]=this.type,S["X-Datasource-Uid"]=this.uid,S}interpolateVariablesInQueries(S,O,P){return S.map(L=>this.applyTemplateVariables(L,O,P))}applyTemplateVariables(S,O,P){return S}async getResource(S,O,P){const L=this.getRequestHeaders();return(await(0,n.s)((0,p.AI)().fetch({...P,method:"GET",headers:P?.headers?{...P.headers,...L}:L,params:O??P?.params,url:`/api/datasources/uid/${this.uid}/resources/${S}`}))).data}async postResource(S,O,P){const L=this.getRequestHeaders();return(await(0,n.s)((0,p.AI)().fetch({...P,method:"POST",headers:P?.headers?{...P.headers,...L}:L,data:O??{...O},url:`/api/datasources/uid/${this.uid}/resources/${S}`}))).data}async callHealthCheck(){return(0,n.s)((0,p.AI)().fetch({method:"GET",url:`/api/datasources/uid/${this.uid}/health`,showErrorAlert:!1,headers:this.getRequestHeaders()})).then(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 b(S.message,S.details)}))}}function T(x,S,O){const P=(0,h.oF)();if(!P)return(0,t.of)(x);const L=[],U=[];for(const R of x.data){const B=(0,c.DG)(R.meta?.channel);if(B){const H=R;U.push(P.getDataStream({addr:B,buffer:O(S,H),frame:(0,i.Nw)(R)}))}else L.push(R)}return L.length&&U.push((0,t.of)({...x,data:L})),U.length===1?U[0]:(0,o.h)(...U)}const I=(x,S)=>{const O={maxLength:x.maxDataPoints??500,action:m.Kh.Append};return x.rangeRaw?.to==="now"&&(O.maxDelta=x.range.to.valueOf()-x.range.from.valueOf()),O};M=(0,l.Y)(M)},33378:(Q,A,e)=>{"use strict";e.d(A,{a:()=>n});var t=e(32264);const n=o=>{const{enabledFeatures:s}=t.$.licenseInfo;return s&&s[o]}},34867:(Q,A,e)=>{"use strict";e.d(A,{DW:()=>c,FF:()=>r,MD:()=>g,fH:()=>s,vV:()=>u});var t=e(32631),n=e(37930),o=e(32264);function s(i,l){o.$.grafanaJavascriptAgent.enabled&&t.P.api.pushLog([i],{level:n.$b.INFO,context:l})}function r(i,l){o.$.grafanaJavascriptAgent.enabled&&t.P.api.pushLog([i],{level:n.$b.WARN,context:l})}function g(i,l){o.$.grafanaJavascriptAgent.enabled&&t.P.api.pushLog([i],{level:n.$b.DEBUG,context:l})}function u(i,l){o.$.grafanaJavascriptAgent.enabled&&t.P.api.pushError(i,{context:l})}function c(i,l){const f=d=>({source:i,...l,...d});return{logDebug:(d,h)=>g(d,f(h)),logInfo:(d,h)=>s(d,f(h)),logWarning:(d,h)=>r(d,f(h)),logError:(d,h)=>u(d,f(h))}}},89191:(Q,A,e)=>{"use strict";e.d(A,{PL:()=>i,o:()=>d,se:()=>f,zO:()=>c});var t=e(59511),n=e.n(t),o=e(65024),s=e.n(o),r=e(57516),g=e.n(r),u=e(32264);const c=window.System;async function i(h){try{const p=u.$.bootData.user.theme==="light"?h.light:h.dark;return c.import(p)}catch(p){console.error(p)}}let l;function f(h){if(l)throw new Error("pluginImportUtils should only be set once, when Grafana is starting.");l=h}function d(){if(!l)throw new Error("pluginImportUtils can only be used after Grafana instance has started.");return l}window.__grafana_amd_define=window.define,window.define=void 0},47773:(Q,A,e)=>{"use strict";e.d(A,{$h:()=>f,bE:()=>u});var t=e(39070),n=e(89667),o=e(14236),s=e(11261),r=e(12091);const g={severity:"info",text:"Cached response"};function u(d,h){const p={data:[],state:t.Gu.Done},m="traceId"in d?d.traceId:void 0;m!=null&&(p.traceIds=[m]);const a=d;if(a.data?.results){const v=a.data.results,E=h?.length?h.map(C=>C.refId):Object.keys(v),D=c(a),b=[];for(const C of E){const y=v[C];y&&(y.refId=C,b.push(y))}for(const C of b){if(C.error){const y={refId:C.refId,message:C.error,status:C.status};m!=null&&(y.traceId=m),p.error||(p.error={...y}),p.errors?p.errors.push({...y}):p.errors=[{...y}],p.state=t.Gu.Error}if(C.frames?.length){for(let y of C.frames){D&&(y=i(y));const M=(0,n.or)(y);M.refId||(M.refId=C.refId),p.data.push(M)}continue}if(C.series?.length)for(const y of C.series)y.refId||(y.refId=C.refId),p.data.push((0,o.Vc)(y));if(C.tables?.length)for(const y of C.tables)y.refId||(y.refId=C.refId),p.data.push((0,o.Vc)(y))}}return a.status&&a.status!==200&&(p.state!==t.Gu.Error&&(p.state=t.Gu.Error),p.error||(p.error=(0,r.u)(d))),p}function c(d){const h=d?.headers;return!h||!h.get?!1:h.get("X-Cache")==="HIT"}function i(d){return{...d,schema:{...d.schema,fields:[...d.schema?.fields??[]],meta:{...d.schema?.meta,notices:[...d.schema?.meta?.notices??[],g],isCachedResponse:!0}}}}function l(d){const h=u(d);if(h.error?.data?.message)return{status:"error",message:h.error.data.message,details:h.error?.data?.error?{message:h.error.data.error}:void 0};if(h.error?.refId&&h.error?.message)return{status:"error",message:h.error.message};throw d}function f(d){if(!d||!d.length)return[];const h=[];let p=d.fields.find(m=>m.type===s.PU.string);if(p||(p=d.fields.find(m=>m.type!==s.PU.time)),p)for(let m=0;m<p.values.length;m++)h.push({text:""+p.values[m]});return h}},14778:(Q,A,e)=>{"use strict";e.d(A,{_:()=>n,i:()=>o});let t;const n=s=>{t=s},o=()=>t?t():()=>console.error("ReturnToPrevious hook not found")},52622:(Q,A,e)=>{"use strict";e.d(A,{$N:()=>R,$l:()=>N,$m:()=>Y,$p:()=>P,D7:()=>c,F8:()=>L,GR:()=>h,J1:()=>u,L4:()=>a,Lt:()=>b,Ly:()=>M,NU:()=>p,Nj:()=>D,ON:()=>C,QH:()=>n,QR:()=>t,RU:()=>s,SV:()=>U,T6:()=>G,TZ:()=>V,WQ:()=>o,Wq:()=>K,Y$:()=>f,aG:()=>g,dx:()=>m,eX:()=>w,fY:()=>ee,gs:()=>E,lm:()=>T,ob:()=>_,on:()=>v,qM:()=>k,q_:()=>r,uH:()=>i,vM:()=>l,vp:()=>ne,wV:()=>x,xB:()=>B,yL:()=>d,yp:()=>O,zT:()=>re});var t=(q=>(q.AlertStates="alertStates",q.Annotations="annotations",q.Series="series",q))(t||{}),n=(q=>(q.Linear="linear",q.Quad="quad",q))(n||{}),o=(q=>(q.Clamped="clamped",q.Mod="mod",q))(o||{}),s=(q=>(q.Field="field",q.Fixed="fixed",q.Template="template",q))(s||{}),r=(q=>(q.Field="field",q.Fixed="fixed",q.Mapping="mapping",q))(r||{}),g=(q=>(q.Auto="auto",q.Coords="coords",q.Geohash="geohash",q.Lookup="lookup",q))(g||{}),u=(q=>(q.Count="count",q.Size="size",q))(u||{}),c=(q=>(q.auto="auto",q.ge="ge",q.le="le",q.unknown="unknown",q))(c||{}),i=(q=>(q.Ascending="Ascending",q.Descending="Descending",q))(i||{}),l=(q=>(q.Auto="auto",q.Bottom="bottom",q.Hidden="hidden",q.Left="left",q.Right="right",q.Top="top",q))(l||{}),f=(q=>(q.Series="series",q.Text="text",q))(f||{}),d=(q=>(q.Always="always",q.Auto="auto",q.Never="never",q))(d||{}),h=(q=>(q.Bars="bars",q.Line="line",q.Points="points",q))(h||{}),p=(q=>(q.Constant="constant",q.NegativeY="negative-Y",q))(p||{}),m=(q=>(q.Linear="linear",q.Smooth="smooth",q.StepAfter="stepAfter",q.StepBefore="stepBefore",q))(m||{}),a=(q=>(q.Linear="linear",q.Log="log",q.Ordinal="ordinal",q.Symlog="symlog",q))(a||{}),v=(q=>(q.Hue="hue",q.None="none",q.Opacity="opacity",q.Scheme="scheme",q))(v||{}),E=(q=>(q.None="none",q.Normal="normal",q.Percent="percent",q))(E||{}),D=(q=>(q[q.After=1]="After",q[q.Before=-1]="Before",q[q.Center=0]="Center",q))(D||{}),b=(q=>(q[q.Horizontal=0]="Horizontal",q[q.Vertical=1]="Vertical",q))(b||{}),C=(q=>(q[q.Down=-1]="Down",q[q.Left=-1]="Left",q[q.Right=1]="Right",q[q.Up=1]="Up",q))(C||{});const y={dash:[]};var M=(q=>(q.Area="area",q.Dashed="dashed",q.DashedAndArea="dashed+area",q.Line="line",q.LineAndArea="line+area",q.Off="off",q.Series="series",q))(M||{}),T=(q=>(q.Hidden="hidden",q.List="list",q.Table="table",q))(T||{});const I={calcs:[]};var x=(q=>(q.Auto="auto",q.Horizontal="horizontal",q.Vertical="vertical",q))(x||{});const S={timezone:[]};var O=(q=>(q.Background="background",q.BackgroundSolid="background_solid",q.None="none",q.Value="value",q))(O||{}),P=(q=>(q.Area="area",q.Line="line",q.None="none",q))(P||{}),L=(q=>(q.Auto="auto",q.Center="center",q))(L||{}),U=(q=>(q.Auto="auto",q.Name="name",q.None="none",q.Value="value",q.ValueAndName="value_and_name",q))(U||{}),R=(q=>(q.Multi="multi",q.None="none",q.Single="single",q))(R||{}),B=(q=>(q.Ascending="asc",q.Descending="desc",q.None="none",q))(B||{});const H={calcs:[]};var w=(q=>(q.Basic="basic",q.Gradient="gradient",q.Lcd="lcd",q))(w||{}),N=(q=>(q.Color="color",q.Hidden="hidden",q.Text="text",q))(N||{}),V=(q=>(q.Auto="auto",q.Left="left",q.Top="top",q))(V||{}),G=(q=>(q.Auto="auto",q.Manual="manual",q))(G||{}),_=(q=>(q.Auto="auto",q.BasicGauge="basic",q.ColorBackground="color-background",q.ColorBackgroundSolid="color-background-solid",q.ColorText="color-text",q.Custom="custom",q.DataLinks="data-links",q.Gauge="gauge",q.GradientGauge="gradient-gauge",q.Image="image",q.JSONView="json-view",q.LcdGauge="lcd-gauge",q.Sparkline="sparkline",q))(_||{}),K=(q=>(q.Basic="basic",q.Gradient="gradient",q))(K||{});const j={fields:[],reducer:[]};var k=(q=>(q.Lg="lg",q.Md="md",q.Sm="sm",q))(k||{}),Y=(q=>(q.CSV="csv",q.Date="date",q.Distributed="distributed",q.DoubleQuote="doublequote",q.Glob="glob",q.HTML="html",q.JSON="json",q.Lucene="lucene",q.PercentEncode="percentencode",q.Pipe="pipe",q.QueryParam="queryparam",q.Raw="raw",q.Regex="regex",q.SQLString="sqlstring",q.SingleQuote="singlequote",q.Text="text",q.UriEncode="uriencode",q))(Y||{}),ee=(q=>(q.exact="exact",q.none="none",q.numbers="numbers",q.signature="signature",q))(ee||{}),re=(q=>(q.EQ="eq",q.GT="gt",q.GTE="gte",q.LT="lt",q.LTE="lte",q.NEQ="neq",q))(re||{});const J={align:"auto",inspect:!1},ne="browser"},33623:(Q,A,e)=>{"use strict";e.d(A,{KQ:()=>o,QB:()=>s});var t=e(52622);const n="10.4.19",o={barRadius:0,barWidth:.97,fullHighlight:!1,groupWidth:.7,orientation:t.wV.Auto,showValue:t.yL.Auto,stacking:t.gs.None,xTickLabelRotation:0,xTickLabelSpacing:0},s={fillOpacity:80,gradientMode:t.on.None,lineWidth:1}},16371:(Q,A,e)=>{"use strict";e.d(A,{K:()=>o});var t=e(52622);const n="10.4.19",o={displayMode:t.eX.Gradient,maxVizHeight:300,minVizHeight:16,minVizWidth:8,namePlacement:t.TZ.Auto,showUnfilled:!0,sizing:t.T6.Auto,valueMode:t.$l.Color}},37827:(Q,A,e)=>{"use strict";e.d(A,{K:()=>n});const t="10.4.19",n={selectedSeries:0}},44955:(Q,A,e)=>{"use strict";e.d(A,{K:()=>o});var t=e(52622);const n="10.4.19",o={minVizHeight:75,minVizWidth:75,showThresholdLabels:!1,showThresholdMarkers:!0,sizing:t.T6.Auto}},87487:(Q,A,e)=>{"use strict";e.d(A,{KQ:()=>n});const t="10.4.19",n={layers:[]},o={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||{})},96529:(Q,A,e)=>{"use strict";e.d(A,{KQ:()=>r});var t=e(52622);const n="10.4.19";var o=(g=>(g.Opacity="opacity",g.Scheme="scheme",g))(o||{}),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.yL.Auto,tooltip:{mode:t.$N.Single,yHistogram:!1,showColorScale:!1}}},42226:(Q,A,e)=>{"use strict";e.d(A,{KQ:()=>o,QB:()=>s});var t=e(52622);const n="10.4.19",o={bucketCount:30,bucketOffset:0},s={fillOpacity:80,gradientMode:t.on.None,lineWidth:1}},69383:(Q,A,e)=>{"use strict";e.d(A,{K:()=>n});const t="10.4.19",n={showImage:!0}},65391:(Q,A,e)=>{"use strict";e.d(A,{KQ:()=>g});const t="10.4.19";var n=(u=>(u.Donut="donut",u.Pie="pie",u))(n||{}),o=(u=>(u.Name="name",u.Percent="percent",u.Value="value",u))(o||{}),s=(u=>(u.Percent="percent",u.Value="value",u))(s||{});const r={values:[]},g={displayLabels:[]}},89607:(Q,A,e)=>{"use strict";e.d(A,{K:()=>o});var t=e(52622);const n="10.4.19",o={colorMode:t.yp.Value,graphMode:t.$p.Area,justifyMode:t.F8.Auto,showPercentChange:!1,textMode:t.SV.Auto,wideLayout:!0}},15821:(Q,A,e)=>{"use strict";e.d(A,{KQ:()=>o,QB:()=>s});var t=e(52622);const n="10.4.19",o={alignValue:"left",mergeValues:!0,rowHeight:.9,showValue:t.yL.Auto},s={fillOpacity:70,lineWidth:0}},64337:(Q,A,e)=>{"use strict";e.d(A,{KQ:()=>o,QB:()=>s});var t=e(52622);const n="10.4.19",o={colWidth:.9,rowHeight:.9,showValue:t.yL.Auto},s={fillOpacity:70,lineWidth:1}},52037:(Q,A,e)=>{"use strict";e.d(A,{K:()=>o});var t=e(52622);const n="10.4.19",o={cellHeight:t.qM.Sm,footer:{show:!1,countRows:!1,reducer:[]},frameIndex:0,showHeader:!0,showTypeIcons:!1,sortBy:[]}},12183:(Q,A,e)=>{"use strict";e.d(A,{KQ:()=>g});const t="10.4.19";var n=(u=>(u.Code="code",u.HTML="html",u.Markdown="markdown",u))(n||{}),o=(u=>(u.Go="go",u.Html="html",u.Json="json",u.Markdown="markdown",u.Plaintext="plaintext",u.Sql="sql",u.Typescript="typescript",u.Xml="xml",u.Yaml="yaml",u))(o||{});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"}},10055:(Q,A,e)=>{"use strict";e.d(A,{KQ:()=>u});var t=e(52622);const n="10.4.19";var o=(c=>(c.Auto="auto",c.Manual="manual",c))(o||{}),s=(c=>(c.Lines="lines",c.Points="points",c.PointsAndLines="points+lines",c))(s||{});const r={exclude:[]},g={label:t.yL.Auto,show:"points"},u={series:[]}},73134:(Q,A,e)=>{"use strict";e.d(A,{CO:()=>g,GW:()=>M,OA:()=>D,Ol:()=>d,QB:()=>y,Ye:()=>T,ZG:()=>c,aD:()=>o,bf:()=>s,bt:()=>b,dM:()=>p,lt:()=>a,rw:()=>r,ss:()=>C,yV:()=>v});const t={tags:[]},n={exclude:!1,ids:[]},o={list:[]},s={builtIn:0,enable:!0,hide:!1},r={includeAll:!1,multi:!1,options:[],skipUrlSync:!1};var g=(I=>(I[I.never=0]="never",I[I.onDashboardLoad=1]="onDashboardLoad",I[I.onTimeRangeChanged=2]="onTimeRangeChanged",I))(g||{}),u=(I=>(I[I.dontHide=0]="dontHide",I[I.hideLabel=1]="hideLabel",I[I.hideVariable=2]="hideVariable",I))(u||{}),c=(I=>(I[I.alphabeticalAsc=1]="alphabeticalAsc",I[I.alphabeticalCaseInsensitiveAsc=5]="alphabeticalCaseInsensitiveAsc",I[I.alphabeticalCaseInsensitiveDesc=6]="alphabeticalCaseInsensitiveDesc",I[I.alphabeticalDesc=2]="alphabeticalDesc",I[I.disabled=0]="disabled",I[I.naturalAsc=7]="naturalAsc",I[I.naturalDesc=8]="naturalDesc",I[I.numericalAsc=3]="numericalAsc",I[I.numericalDesc=4]="numericalDesc",I))(c||{});const i={asDropdown:!1,includeVars:!1,keepTime:!1,tags:[],targetBlank:!1};var l=(I=>(I.ContinuousBlPu="continuous-BlPu",I.ContinuousBlYlRd="continuous-BlYlRd",I.ContinuousBlues="continuous-blues",I.ContinuousGrYlRd="continuous-GrYlRd",I.ContinuousGreens="continuous-greens",I.ContinuousPurples="continuous-purples",I.ContinuousRdYlGr="continuous-RdYlGr",I.ContinuousReds="continuous-reds",I.ContinuousYlBl="continuous-YlBl",I.ContinuousYlRd="continuous-YlRd",I.Fixed="fixed",I.PaletteClassic="palette-classic",I.PaletteClassicByName="palette-classic-by-name",I.Shades="shades",I.Thresholds="thresholds",I))(l||{});const f={h:9,w:12,x:0,y:0};var d=(I=>(I.Absolute="absolute",I.Percentage="percentage",I))(d||{});const h={steps:[]};var p=(I=>(I.RangeToText="range",I.RegexToText="regex",I.SpecialValue="special",I.ValueToText="value",I))(p||{}),m=(I=>(I.Empty="empty",I.False="false",I.NaN="nan",I.Null="null",I.NullAndNan="null+nan",I.True="true",I))(m||{});const a={hidden:!1,refresh_intervals:["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"],time_options:["5m","15m","1h","6h","12h","24h","2d","7d","30d"]};var v=(I=>(I[I.Crosshair=1]="Crosshair",I[I.Off=0]="Off",I[I.Tooltip=2]="Tooltip",I))(v||{});const E=0,D={links:[],repeatDirection:"h",targets:[],transformations:[],transparent:!1},b={overrides:[]},C={id:""},y={links:[],mappings:[]},M={collapsed:!1,panels:[]},T={editable:!0,fiscalYearStartMonth:0,graphTooltip:0,links:[],panels:[],schemaVersion:36,tags:[],timezone:"browser"}},39651:(Q,A,e)=>{"use strict";e.d(A,{Gu:()=>o,gB:()=>n});var t=e(52622);const n={align:"auto",inspect:!1,cellOptions:{type:t.ob.Auto}};var o=(s=>(s.NotStarted="NotStarted",s.Loading="Loading",s.Streaming="Streaming",s.Done="Done",s.Error="Error",s))(o||{})},79422:(Q,A,e)=>{"use strict";e.d(A,{Ye:()=>o,lt:()=>r,rw:()=>s,zL:()=>n});var t=e(73134),n=(h=>(h[h.dontHide=0]="dontHide",h[h.hideLabel=1]="hideLabel",h[h.hideVariable=2]="hideVariable",h))(n||{});const o=t.Ye,s={...t.rw},r=t.lt,g=t.OA,u=t.GW,c=t.QB,i=t.bt,l=t.ss,f=t.bf,d=t.aD},42418:(Q,A,e)=>{"use strict";e.d(A,{F:()=>i,H:()=>l});var t=e(32196),n=e(96540),o=e(13544),s=e(40845),r=e(55852),g=e(14578),u=e(90613),c=e(94753);const i=n.forwardRef(({title:d,onRemove:h,children:p,buttonContent:m,elevated:a,bottomSpacing:v,topSpacing:E,className:D,severity:b="error",...C},y)=>{const M=(0,s.$j)(),I=f(M,b,!!d,a,v,E),x={error:"alert",warning:"alert",info:"status",success:"status"},S=C.role||x[b],O=C["aria-label"]||d;return n.createElement("div",{ref:y,className:(0,t.cx)(I.wrapper,D),role:S,"aria-label":O,...C},n.createElement(u.a,{"data-testid":o.Tp.components.Alert.alertV2(b),display:"flex",backgroundColor:b,borderRadius:"default",paddingY:1,paddingX:2,borderStyle:"solid",borderColor:b,alignItems:"stretch",boxShadow:a?"z3":void 0},n.createElement(u.a,{paddingTop:1,paddingRight:2},n.createElement("div",{className:I.icon},n.createElement(g.I,{size:"xl",name:l(b)}))),n.createElement(u.a,{paddingY:1,grow:1},n.createElement(c.E,{color:"primary",weight:"medium"},d),p&&n.createElement("div",{className:I.content},p)),h&&!m&&n.createElement("div",{className:I.close},n.createElement(r.$n,{"aria-label":"Close alert",icon:"times",onClick:h,type:"button",fill:"text",variant:"secondary"})),h&&m&&n.createElement(u.a,{marginLeft:1,display:"flex",alignItems:"center"},n.createElement(r.$n,{"aria-label":"Close alert",variant:"secondary",onClick:h,type:"button"},m))))});i.displayName="Alert";const l=d=>{switch(d){case"error":return"exclamation-circle";case"warning":return"exclamation-triangle";case"info":return"info-circle";case"success":return"check"}},f=(d,h,p,m,a,v)=>{const E=d.colors[h];return{wrapper:(0,t.css)({flexGrow:1,marginBottom:d.spacing(a??2),marginTop:d.spacing(v??0),position:"relative","&:before":{content:'""',position:"absolute",top:0,left:0,bottom:0,right:0,background:d.colors.background.primary,zIndex:-1}}),icon:(0,t.css)({color:E.text}),content:(0,t.css)({color:d.colors.text.primary,paddingTop:p?d.spacing(.5):0,maxHeight:"50vh",overflowY:"auto"}),close:(0,t.css)({position:"relative",color:d.colors.text.secondary,background:"none",display:"flex",top:"-6px",right:"-14px"})}}},28270:(Q,A,e)=>{"use strict";e.d(A,{p:()=>h});var t=e(32196),n=e(2543),o=e(96540),s=e(40845),r=e(88575),g=e(32982);const u=o.memo(()=>{const m=(0,s.of)(c);return o.createElement("div",{className:m.ellipsis},o.createElement("span",{className:m.firstDot},"."),o.createElement("span",{className:m.secondDot},"."),o.createElement("span",{className:m.thirdDot},"."))});u.displayName="EllipsisAnimated";const c=()=>({ellipsis:(0,t.css)({display:"inline"}),firstDot:(0,t.css)({animation:`${i} 2s linear infinite`}),secondDot:(0,t.css)({animation:`${l} 2s linear infinite`}),thirdDot:(0,t.css)({animation:`${f} 2s linear infinite`})}),i=(0,t.keyframes)` 0% { opacity: 1; } 65% { opacity: 1; } 66% { opacity: 0.5; } 100% { opacity: 0; } `,l=(0,t.keyframes)` 0% { opacity: 0; } 21% { opacity: 0.5; } 22% { opacity: 1; } 65% { opacity: 1; } 66% { opacity: 0.5; } 100% { opacity: 0; } `,f=(0,t.keyframes)` 0% { opacity: 0; } 43% { opacity: 0.5; } 44% { opacity: 1; } 65% { opacity: 1; } 66% { opacity: 0.5; } 100% { opacity: 0; } `,d=2*1e3;function h(m){const{invalid:a,loading:v,onFinishChange:E,saveErrorMessage:D="Error saving this value",error:b,children:C,disabled:y,...M}=m,[T,I]=o.useState({isLoading:!1,showSuccess:!1,showError:a}),x=(0,o.useRef)(null);o.useEffect(()=>{let U;if(T.showSuccess){const R=T.showError?0:d;U=setTimeout(()=>{I({...T,showSuccess:!1})},R)}return()=>{window.clearTimeout(U)}},[T]);const S=(0,o.useCallback)(U=>{a||(I({...T,isLoading:!0,showSuccess:!1}),E(U).then(()=>{I({isLoading:!1,showSuccess:!0,showError:!1})}).catch(()=>{I({...T,isLoading:!1,showError:!0})}))},[a,T,E]),O=(0,o.useMemo)(()=>(0,n.debounce)(S,600,{leading:!1}),[S]),P=a||T.showError||void 0,L=(0,s.of)(p);return o.createElement(o.Fragment,null,o.createElement(r.D,{...M,loading:v||void 0,invalid:P,disabled:y,error:b||T.showError&&D,ref:x,className:L.widthFitContent},o.cloneElement(C(U=>{O(U)}))),T.isLoading&&o.createElement(g.r,{referenceElement:x.current,placement:"right"},"Saving ",o.createElement(u,null)),T.showSuccess&&o.createElement(g.r,{suffixIcon:"check",referenceElement:x.current,placement:"right"},"Saved!"))}h.displayName="AutoSaveField";const p=()=>({widthFitContent:(0,t.css)({width:"fit-content"})})},39938:(Q,A,e)=>{"use strict";e.d(A,{E:()=>f});var t=e(32196),n=e(96540),o=e(70255),s=e(84140),r=e(40845),g=e(72129),u=e(14578),c=e(56034);const i=n.memo(({icon:p,color:m,text:a,tooltip:v,className:E,...D})=>{const b=(0,r.of)(h,m),C=n.createElement("div",{className:(0,t.cx)(b.wrapper,E),...D},p&&n.createElement(u.I,{name:p,size:"sm"}),a);return v?n.createElement(c.m,{content:v,placement:"auto"},C):C});i.displayName="Badge";const l=({rootProps:p})=>{const m=(0,r.of)(d);return n.createElement(o.A,{width:60,height:22,containerClassName:m.container,...p})},f=(0,g.j)(i,l),d=()=>({container:(0,t.css)({lineHeight:1})}),h=(p,m)=>{let a=p.visualization.getColorByName(m),v="",E="",D="";return p.isDark?(E=(0,s.A)(a).setAlpha(.15).toString(),v=(0,s.A)(a).setAlpha(.25).toString(),D=(0,s.A)(a).lighten(15).toString()):(E=(0,s.A)(a).setAlpha(.15).toString(),v=(0,s.A)(a).setAlpha(.25).toString(),D=(0,s.A)(a).darken(20).toString()),{wrapper:(0,t.css)({display:"inline-flex",padding:"1px 4px",borderRadius:p.shape.radius.default,background:E,border:`1px solid ${v}`,color:D,fontWeight:p.typography.fontWeightRegular,gap:"2px",fontSize:p.typography.bodySmall.fontSize,lineHeight:p.typography.bodySmall.lineHeight,alignItems:"center"})}}},97696:(Q,A,e)=>{"use strict";e.d(A,{xE:()=>C});var t=e(32196),n=e(96540),o=e(84140),s=e(58649),r=e(47070),g=e(50082),u=e(83195),c=e(24293),i=e(8066),l=e(13544),f=e(52622),d=e(29413),h=e(55852),p=e(9286);const m=18,a=50,v=150,E=1.5,D=1,b=10;class C extends n.PureComponent{render(){const{onClick:B,className:H,theme:w}=this.props,{title:N}=this.props.value,V=T(this.props);return B?n.createElement("button",{type:"button",style:V.wrapper,onClick:B,className:(0,t.cx)((0,h.my)(w),H)},n.createElement("div",{style:V.title},N),this.renderBarAndValue()):n.createElement("div",{style:V.wrapper,className:H},N&&n.createElement("div",{style:V.title},N),this.renderBarAndValue())}renderBarAndValue(){switch(this.props.displayMode){case"lcd":return this.renderRetroBars();case"basic":case"gradient":default:return this.renderBasicAndGradientBars()}}renderBasicAndGradientBars(){const{value:B,showUnfilled:H,valueDisplayMode:w}=this.props,N=O(this.props);return n.createElement("div",{style:N.wrapper},w!==f.$l.Hidden&&n.createElement(p.i,{"data-testid":l.Tp.components.Panels.Visualization.BarGauge.valueV2,value:B,style:N.value}),H&&n.createElement("div",{style:N.emptyBar}),n.createElement("div",{style:N.bar}))}renderRetroBars(){const{display:B,field:H,value:w,itemSpacing:N,alignmentFactors:V,orientation:G,lcdCellWidth:_,text:K,valueDisplayMode:j,theme:k}=this.props,{valueHeight:Y,valueWidth:ee,maxBarHeight:re,maxBarWidth:J,wrapperWidth:ne,wrapperHeight:q}=I(this.props),te=H.min??s.tw,oe=H.max??s.d1,ue=y(G),ie=oe-te,ge=ue?re:J,he=N,De=Math.floor(ge/_),pe=Math.floor((ge-he*De)/De),le=L(this.props),Ee=U(V||w,le,ee,Y,G,K),Re={width:`${ne}px`,height:`${q}px`,display:"flex"};ue?(Re.flexDirection="column-reverse",Re.alignItems="center"):(Re.flexDirection="row",Re.alignItems="center",Ee.justifyContent="flex-end");const me=[];for(let Me=0;Me<De;Me++){const ye=te+ie/De*Me,Le=x(ye,w,B),We={borderRadius:k.shape.radius.default};Le.isLit?We.backgroundImage=`radial-gradient(${Le.background} 10%, ${Le.backgroundShade})`:We.backgroundColor=Le.background,ue?(We.height=`${pe}px`,We.width=`${J}px`,We.marginTop=`${he}px`):(We.width=`${pe}px`,We.height=`${re}px`,We.marginRight=`${he}px`),me.push(n.createElement("div",{key:Me.toString(),style:We}))}return n.createElement("div",{style:Re},me,j!==f.$l.Hidden&&n.createElement(p.i,{"data-testid":l.Tp.components.Panels.Visualization.BarGauge.valueV2,value:w,style:Ee}))}}C.defaultProps={lcdCellWidth:12,value:{text:"100",numeric:100},displayMode:f.eX.Gradient,orientation:r.wV.Horizontal,field:{min:0,max:100,thresholds:{mode:g.O.Absolute,steps:[]}},itemSpacing:8,showUnfilled:!0};function y(R){return R===r.wV.Vertical}function M(R){const{height:B,width:H,alignmentFactors:w,orientation:N,text:V,namePlacement:G}=R,_=w?w.title:R.value.title;if(!_)return{fontSize:0,width:0,height:0,placement:"above"};if(y(N)){const J=V?.titleSize??14;return{fontSize:J,width:H,height:J*E,placement:"below"}}if(B>40&&G===f.TZ.Auto||G===f.TZ.Top){if(V?.titleSize)return{fontSize:V?.titleSize,width:0,height:V.titleSize*E,placement:"above"};const ne=Math.max(Math.min(B*.45,a),17);return{fontSize:ne/E,width:0,height:ne,placement:"above"}}const Y=Math.max(B*.6,m)/E,ee=(0,d.kD)(_,Y),re=Math.min(ee.width+15,H*.4);return{fontSize:V?.titleSize??Y,height:0,width:re,placement:"left"}}function T(R){const B={display:"flex",overflow:"hidden",width:"100%"},H=M(R),w={fontSize:`${H.fontSize}px`,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",width:"100%",alignItems:"center",alignSelf:"center"};return y(R.orientation)?(B.flexDirection="column-reverse",w.textAlign="center"):H.placement==="above"?B.flexDirection="column":(B.flexDirection="row",w.width=`${H.width}px`,w.textAlign="right",w.paddingRight="10px"),{wrapper:B,title:w}}function I(R){const{height:B,width:H,orientation:w,text:N,alignmentFactors:V,valueDisplayMode:G}=R,_=M(R),K=V??R.value,j=(0,u.cN)(K);let k=0,Y=0,ee=0,re=0,J=0,ne=0;const q=N?.valueSize??Math.max(_.fontSize,12),oe=(0,d.kD)(j,q).width+b*2;return y(w)?(N?.valueSize?ee=N.valueSize*D:ee=Math.min(Math.max(B*.1,m),a),re=H,G===f.$l.Hidden&&(ee=0,re=0),k=B-(_.height+ee),Y=H,J=H,ne=B-_.height):(G===f.$l.Hidden?(ee=0,re=0):(ee=B-_.height,re=Math.max(Math.min(H*.2,v),oe)),k=B-_.height,Y=H-re-_.width,_.placement==="above"?(J=H,ne=B-_.height):(J=H-_.width,ne=B)),{valueWidth:re,valueHeight:ee,maxBarWidth:Y,maxBarHeight:k,wrapperHeight:ne,wrapperWidth:J}}function x(R,B,H){if(R===null)return{background:c.F,border:c.F};const w=H?H(R).color:null;return w?B===null||isNaN(B.numeric)||R!==null&&R>B.numeric?{background:(0,o.A)(w).setAlpha(.18).toRgbString(),border:"transparent",isLit:!1}:{background:(0,o.A)(w).setAlpha(.95).toRgbString(),backgroundShade:(0,o.A)(w).setAlpha(.55).toRgbString(),border:(0,o.A)(w).setAlpha(.9).toRgbString(),isLit:!0}:{background:c.F,border:c.F}}function S(R,B,H){const w=Math.min((R-B)/(H-B),1);return isNaN(w)?0:w}function O(R){const{displayMode:B,field:H,value:w,alignmentFactors:N,orientation:V,theme:G,text:_}=R,{valueWidth:K,valueHeight:j,maxBarHeight:k,maxBarWidth:Y}=I(R),ee=H.min??s.tw,re=H.max??s.d1,J=S(w.numeric,ee,re),ne=L(R),q=w.color??c.F,oe=U(N||w,ne,K,j,V,_),ue=B==="basic",ie={display:"flex",flexGrow:1},ge={borderRadius:G.shape.radius.default,position:"relative",zIndex:1},he={background:G.colors.background.secondary,flexGrow:1,display:"flex",borderRadius:G.shape.radius.default,position:"relative"};if(y(V)){const De=Math.max(J*k,1);ie.flexDirection="column",ie.justifyContent="flex-end",ge.transition="height 1s",ge.height=`${De}px`,ge.width=`${Y}px`,he.bottom="-3px",he.width=`${K}px`,ue?(ge.background=`${(0,o.A)(q).setAlpha(.35).toRgbString()}`,ge.borderTop=`2px solid ${q}`):ge.background=P(R,k)}else{const De=Math.max(J*Y,1);ie.flexDirection="row-reverse",ie.justifyContent="flex-end",ie.alignItems="stretch",ge.transition="width 1s",ge.height=`${k}px`,ge.width=`${De}px`,he.left="-3px",he.height=`${j}px`,ue?(ge.background=`${(0,o.A)(q).setAlpha(.35).toRgbString()}`,ge.borderRight=`2px solid ${q}`):ge.background=P(R,Y)}return{wrapper:ie,bar:ge,value:oe,emptyBar:he}}function P(R,B){const{field:H,value:w,orientation:N,theme:V}=R,G=y(N)?"0deg":"90deg",_=H.min,K=H.max;let j="",k=0,Y=(0,i.Hs)(H.color?.mode);if(Y.id===c.Y.Thresholds){const ee=H.thresholds;for(let re=0;re<ee.steps.length;re++){const J=ee.steps[re],ne=R.theme.visualization.getColorByName(J.color),q=ee.mode===g.O.Percentage?J.value/100:S(J.value,_,K),te=q*B,oe=Math.round(te-(te-k)/2),ue=ee.mode===g.O.Percentage?_+(K-_)*q:J.value;if(j==="")j=`linear-gradient(${G}, ${ne}, ${ne}`;else{if(w.numeric<ue)break;k=te,j+=` ${oe}px, ${ne}`}}return j+")"}if(Y.isContinuous&&Y.getColors){const ee=Y.getColors(V);for(let re=0;re<ee.length;re++){const J=ee[re];if(j==="")j=`linear-gradient(${G}, ${J} 0px`;else{const q=re/(ee.length-1)*B;j+=`, ${J} ${q}px`}}return j+")"}return w.color??c.F}function L(R){if(R.valueDisplayMode==="text")return R.theme.colors.text.primary;const{value:B}=R;return B.color?B.color:c.F}function U(R,B,H,w,N,V){const G={color:B,height:`${w}px`,width:`${H}px`,display:"flex",alignItems:"center",lineHeight:D};let _=H;const K=(0,u.cN)(R);return y(N)?(G.fontSize=V?.valueSize??(0,d.Vr)(K,_,w,D),G.justifyContent="center"):(G.fontSize=V?.valueSize??(0,d.Vr)(K,_-b*2,w,D),G.justifyContent="flex-end",G.paddingLeft=`${b}px`,G.paddingRight=`${b}px`,_-=b),G}},37494:(Q,A,e)=>{"use strict";e.d(A,{yV:()=>L,yp:()=>x,$p:()=>S,F8:()=>O,SV:()=>P});var t=e(32196),n=e(96540),o=e(55852),s=e(9286),r=e(84140),g=e(11261),u=e(83195),c=e(52622),i=e(24284),l=e(29413),f=e(5926),d=e(14578);const h=({percentChange:U,styles:R})=>{const B=U&&(U>0?"arrow-up":U<0?"arrow-down":void 0);return n.createElement("div",{style:R.containerStyles},B&&n.createElement(d.I,{name:B,height:R.iconSize,width:R.iconSize,viewBox:"6 6 12 12"}),p(U))},p=U=>U?.toLocaleString(void 0,{style:"percent",maximumSignificantDigits:3})??"",m=1.2,a=30,v=500;class E{constructor(R){this.props=R;const{width:B,height:H,value:w,text:N}=R;this.valueColor=w.color??"gray",this.panelPadding=H>100?12:8,this.textValues=I(R),this.justifyCenter=T(R.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=B-this.panelPadding*2,this.maxTextHeight=H-this.panelPadding*2,N&&(N.titleSize&&(this.titleFontSize=N.titleSize,this.titleToAlignTo=void 0),N.valueSize&&(this.valueFontSize=N.valueSize,this.valueToAlignTo=""))}getTitleStyles(){const R={fontSize:`${this.titleFontSize}px`,lineHeight:m};return(this.props.colorMode===x.Background||this.props.colorMode===x.BackgroundSolid)&&(R.color=(0,i.mZ)(this.valueColor,this.props.theme.isDark)),R}getValueStyles(){const R={fontSize:this.valueFontSize,fontWeight:v,lineHeight:m,position:"relative",zIndex:1};switch(this.justifyCenter&&(R.textAlign="center"),this.props.colorMode){case x.Value:R.color=this.valueColor;break;case x.Background:case x.BackgroundSolid:R.color=(0,i.mZ)(this.valueColor,this.props.theme.isDark);break;case x.None:R.color=this.props.theme.colors.text.primary;break}return R}getPercentChangeStyles(R){const H=this.getValueAndTitleContainerStyles(),w=Math.max(this.valueFontSize/2.5,12);let N=Math.max(this.valueFontSize/3,10);const V=R>0?this.props.theme.visualization.getColorByName("green"):this.props.theme.visualization.getColorByName("red"),G={fontSize:w,fontWeight:v,lineHeight:m,position:"relative",display:"flex",alignItems:"center",gap:Math.max(w/3,4),zIndex:1,color:V};switch(this.justifyCenter&&(G.textAlign="center"),H.flexDirection==="column"&&w>12&&(G.marginTop=-(w/4)),H.flexDirection==="row"&&(G.alignItems="baseline",G.lineHeight=m*2.5),this.props.colorMode){case x.Background:case x.BackgroundSolid:G.color=(0,i.mZ)(this.valueColor,this.props.theme.isDark);break}return this.props.textMode===P.None&&(G.fontSize=(0,l.Vr)(p(R),this.maxTextWidth*.8,this.maxTextHeight*.8,m,void 0,v),N=G.fontSize*.8),{containerStyles:G,iconSize:N}}getValueAndTitleContainerStyles(){const R={display:"flex",flexWrap:"wrap"};return this.justifyCenter&&(R.alignItems="center",R.justifyContent="center",R.flexGrow=1,R.gap="0.75ch"),R}getPanelStyles(){const{width:R,height:B,theme:H,colorMode:w,textMode:N}=this.props,V={width:`${R}px`,height:`${B}px`,padding:`${N===P.None?2:this.panelPadding}px`,borderRadius:H.shape.radius.default,position:"relative",display:"flex"},G=H.isDark?1:-.7;switch(w){case x.Background:const _=(0,r.A)(this.valueColor).darken(15*G).spin(8).toRgbString(),K=(0,r.A)(this.valueColor).darken(5*G).spin(-8).toRgbString();V.background=`linear-gradient(120deg, ${_}, ${K})`;break;case x.BackgroundSolid:V.background=(0,r.A)(this.valueColor).toString();break;case x.Value:V.background="transparent";break}return this.justifyCenter&&(V.alignItems="center",V.flexDirection="row"),V}renderChart(){const{sparkline:R,colorMode:B}=this.props;if(!R||R.y?.type!==g.PU.number)return null;let H,w;switch(B){case x.Background:case x.BackgroundSolid:H="rgba(255,255,255,0.4)",w=(0,r.A)(this.valueColor).brighten(40).toRgbString();break;case x.None:case x.Value:default:w=this.valueColor,H=(0,r.A)(this.valueColor).setAlpha(.2).toRgbString();break}const N={custom:{drawStyle:c.GR.Line,lineWidth:1,fillColor:H,lineColor:w}};return n.createElement("div",{style:this.getChartStyles()},n.createElement(f.O,{height:this.chartHeight,width:this.chartWidth,sparkline:R,config:N,theme:this.props.theme}))}getChartStyles(){return{position:"absolute",right:0,bottom:0}}}class D extends E{constructor(R){super(R);const B=this.titleToAlignTo?.length?.3:1;this.valueToAlignTo.length&&(this.valueFontSize=(0,l.Vr)(this.valueToAlignTo,this.maxTextWidth*B,this.maxTextHeight,m,void 0,v)),this.titleToAlignTo?.length&&(this.titleFontSize=(0,l.Vr)(this.titleToAlignTo,this.maxTextWidth*.6,this.maxTextHeight,m,a),this.titleFontSize=Math.min(this.valueFontSize*.7,this.titleFontSize))}getValueAndTitleContainerStyles(){const R=super.getValueAndTitleContainerStyles();return R.flexDirection="row",R.alignItems="center",R.flexGrow=1,this.justifyCenter||(R.justifyContent="space-between"),R}renderChart(){return null}getPanelStyles(){const R=super.getPanelStyles();return R.alignItems="center",R}}class b extends E{constructor(R){super(R);const{width:B,height:H}=R,w=.5,N=.6,V=1-N,G=.4;this.chartWidth=B,this.chartHeight=H*w,this.titleToAlignTo?.length&&(this.titleFontSize=(0,l.Vr)(this.titleToAlignTo,this.maxTextWidth*N,this.maxTextHeight*G,m,a)),this.valueToAlignTo.length&&(this.valueFontSize=(0,l.Vr)(this.valueToAlignTo,this.maxTextWidth*V,this.maxTextHeight*w,m,void 0,v))}getValueAndTitleContainerStyles(){const R=super.getValueAndTitleContainerStyles();return R.flexDirection="row",R.flexGrow=1,this.justifyCenter||(R.justifyContent="space-between"),R}getPanelStyles(){const R=super.getPanelStyles();return R.flexDirection="row",R.justifyContent="space-between",R}}class C extends E{constructor(R){super(R);const{width:B,height:H}=R,w=.15,N=.25;let V=0;this.chartHeight=H*N,this.chartWidth=B,this.titleToAlignTo?.length&&(this.titleFontSize=(0,l.Vr)(this.titleToAlignTo,this.maxTextWidth,H*w,m,a),V=this.titleFontSize*m),this.valueToAlignTo.length&&(this.valueFontSize=(0,l.Vr)(this.valueToAlignTo,this.maxTextWidth,this.maxTextHeight-this.chartHeight-V,m,void 0,v)),this.titleToAlignTo?.length&&(this.titleFontSize=Math.min(this.valueFontSize*.7,this.titleFontSize)),this.chartHeight=H-this.titleFontSize*m-this.valueFontSize*m}getValueAndTitleContainerStyles(){const R=super.getValueAndTitleContainerStyles();return R.flexDirection="column",R.justifyContent="center",R}getPanelStyles(){const R=super.getPanelStyles();return R.flexDirection="column",R}}class y extends E{constructor(R){super(R);const{height:B}=R,H=.15;let w=0;this.titleToAlignTo?.length&&(this.titleFontSize=(0,l.Vr)(this.titleToAlignTo,this.maxTextWidth,B*H,m,a),w=this.titleFontSize*m),this.valueToAlignTo.length&&(this.valueFontSize=(0,l.Vr)(this.valueToAlignTo,this.maxTextWidth,this.maxTextHeight-w,m,void 0,v)),this.titleToAlignTo?.length&&(this.titleFontSize=Math.min(this.valueFontSize*.7,this.titleFontSize))}getValueAndTitleContainerStyles(){const R=super.getValueAndTitleContainerStyles();return R.flexDirection="column",R.flexGrow=1,R}renderChart(){return null}getPanelStyles(){const R=super.getPanelStyles();return R.alignItems="center",R}}function M(U){const{width:R,height:B,sparkline:H}=U;return R/B>2.5&&!U.disableWideLayout?B>50&&H&&H.y.values.length>1?new b(U):new D(U):B>100&&H&&H.y.values.length>1?new C(U):new y(U)}function T(U,R){return U===O.Center?!0:(R??"").length===0}function I(U){const{value:R,alignmentFactors:B,count:H}=U;let{textMode:w}=U;const N=B?B.title:R.title,V=(0,u.cN)(B||R);switch(w===P.Auto&&(H??1)===1&&(w=P.Value),w){case P.Name:return{...R,title:void 0,prefix:void 0,suffix:void 0,text:R.title||"",titleToAlignTo:void 0,valueToAlignTo:N??"",tooltip:(0,u.cN)(R)};case P.Value:return{...R,title:void 0,titleToAlignTo:void 0,valueToAlignTo:V,tooltip:R.title};case P.None:return{numeric:R.numeric,color:R.color,title:void 0,text:"",titleToAlignTo:void 0,valueToAlignTo:"1",tooltip:`Name: ${R.title} Value: ${(0,u.cN)(R)}`};case P.ValueAndName:default:return{...R,titleToAlignTo:N,valueToAlignTo:V}}}var x=(U=>(U.Background="background",U.BackgroundSolid="background_solid",U.None="none",U.Value="value",U))(x||{}),S=(U=>(U.None="none",U.Line="line",U.Area="area",U))(S||{}),O=(U=>(U.Auto="auto",U.Center="center",U))(O||{}),P=(U=>(U.Auto="auto",U.Value="value",U.ValueAndName="value_and_name",U.Name="name",U.None="none",U))(P||{});class L extends n.PureComponent{render(){const{onClick:R,className:B,hasLinks:H,theme:w}=this.props,N=M(this.props),V=N.getPanelStyles(),G=N.getValueAndTitleContainerStyles(),_=N.getValueStyles(),K=N.getTitleStyles(),j=N.textValues,k=this.props.value.percentChange,Y=k!=null&&!Number.isNaN(k),ee=H?void 0:j.tooltip;return R?n.createElement("button",{type:"button",className:(0,t.cx)((0,o.my)(w),B),style:V,onClick:R,title:ee},n.createElement("div",{style:G},j.title&&n.createElement("div",{style:K},j.title),n.createElement(s.i,{value:j,style:_})),N.renderChart()):n.createElement("div",{className:B,style:V,title:ee},n.createElement("div",{style:G},j.title&&n.createElement("div",{style:K},j.title),n.createElement(s.i,{value:j,style:_}),Y&&n.createElement(h,{percentChange:k,styles:N.getPercentChangeStyles(k)})),N.renderChart())}}L.defaultProps={justifyMode:"auto"}},54438:(Q,A,e)=>{"use strict";e.d(A,{J:()=>u});var t=e(32196),n=e(96540),o=e(23257),s=e.n(o),r=e(40845),g=e(5313);const u=(0,n.forwardRef)(({name:i,value:l,hidden:f,facets:d,onClick:h,className:p,loading:m,searchTerm:a,active:v,style:E,title:D,highlightParts:b,...C},y)=>{const M=(0,r.$j)(),T=c(M),I=a?[a]:[],x=(0,n.useCallback)(O=>{h&&!f&&h(i,l,O)},[h,i,f,l]);let S=l||i;return d&&(S=`${S} (${d})`),n.createElement("button",{key:S,ref:y,onClick:x,style:E,title:D||S,type:"button",role:"option","aria-selected":!!v,className:(0,t.cx)(T.base,v&&T.active,m&&T.loading,f&&T.hidden,p,h&&!f&&T.hover),...C},b!==void 0?n.createElement(g.z,{text:S,highlightClassName:T.matchHighLight,highlightParts:b}):n.createElement(s(),{textToHighlight:S,searchWords:I,autoEscape:!0,highlightClassName:T.matchHighLight}))});u.displayName="Label";const c=i=>({base:(0,t.css)({display:"inline-block",cursor:"pointer",fontSize:i.typography.size.sm,lineHeight:i.typography.bodySmall.lineHeight,backgroundColor:i.colors.background.secondary,color:i.colors.text.primary,whiteSpace:"nowrap",textShadow:"none",padding:i.spacing(.5),borderRadius:i.shape.radius.default,border:"none",marginRight:i.spacing(1),marginBottom:i.spacing(.5)}),loading:(0,t.css)({fontWeight:i.typography.fontWeightMedium,backgroundColor:i.colors.primary.shade,color:i.colors.text.primary,animation:"pulse 3s ease-out 0s infinite normal forwards","@keyframes pulse":{"0%":{color:i.colors.text.primary},"50%":{color:i.colors.text.secondary},"100%":{color:i.colors.text.disabled}}}),active:(0,t.css)({fontWeight:i.typography.fontWeightMedium,backgroundColor:i.colors.primary.main,color:i.colors.primary.contrastText}),matchHighLight:(0,t.css)({background:"inherit",color:i.components.textHighlight.text,backgroundColor:i.components.textHighlight.background}),hidden:(0,t.css)({opacity:.6,cursor:"default",border:"1px solid transparent"}),hover:(0,t.css)({["&:hover"]:{opacity:.85,cursor:"pointer"}})})},55852:(Q,A,e)=>{"use strict";e.d(A,{$n:()=>l,Ez:()=>v,U_:()=>m,hs:()=>d,my:()=>a,z9:()=>f});var t=e(32196),n=e(96540),o=e(40845),s=e(16797),r=e(87266),g=e(14578),u=e(56034);const c=null,i=null,l=n.forwardRef(({variant:E="primary",size:D="md",fill:b="solid",icon:C,fullWidth:y,children:M,className:T,type:I="button",tooltip:x,tooltipPlacement:S,...O},P)=>{const L=(0,o.$j)(),U=d({theme:L,size:D,variant:E,fill:b,fullWidth:y,iconOnly:!M}),R=n.createElement("button",{className:(0,t.cx)(U.button,T),type:I,...O,ref:x?void 0:P},C&&n.createElement(g.I,{name:C,size:D,className:U.icon}),M&&n.createElement("span",{className:U.content},M));return x?n.createElement(u.m,{ref:P,content:x,placement:S},R):R});l.displayName="Button";const f=n.forwardRef(({variant:E="primary",size:D="md",fill:b="solid",icon:C,fullWidth:y,children:M,className:T,onBlur:I,onFocus:x,disabled:S,tooltip:O,tooltipPlacement:P,...L},U)=>{const R=(0,o.$j)(),B=d({theme:R,fullWidth:y,size:D,variant:E,fill:b,iconOnly:!M}),H=(0,t.cx)(B.button,{[(0,t.css)(B.disabled,{pointerEvents:"none"})]:S},T),w=n.createElement("a",{className:H,...L,tabIndex:S?-1:0,"aria-disabled":S,ref:O?void 0:U},C&&n.createElement(g.I,{name:C,size:D,className:B.icon}),M&&n.createElement("span",{className:B.content},M));return O?n.createElement(u.m,{ref:U,content:O,placement:P},w):w});f.displayName="LinkButton";const d=E=>{const{theme:D,variant:b,fill:C="solid",size:y,iconOnly:M,fullWidth:T}=E,{height:I,padding:x,fontSize:S}=(0,r.SM)(y,D),O=m(D,b,C),P=p(D,b,C),L=(0,s.getFocusStyles)(D),U=D.spacing.gridSize*x-1;return{button:(0,t.css)({label:"button",display:"inline-flex",alignItems:"center",fontSize:S,fontWeight:D.typography.fontWeightMedium,fontFamily:D.typography.fontFamily,padding:`0 ${U}px`,height:D.spacing(I),lineHeight:`${D.spacing.gridSize*I-2}px`,verticalAlign:"middle",cursor:"pointer",borderRadius:D.shape.radius.default,"&:focus":L,"&:focus-visible":L,"&:focus:not(:focus-visible)":(0,s.getMouseFocusStyles)(D),...T&&{flexGrow:1,justifyContent:"center"},...O,":disabled":P,"&[disabled]":P}),disabled:(0,t.css)(P),img:(0,t.css)({width:"16px",height:"16px",margin:D.spacing(0,1,0,.5)}),icon:M?(0,t.css)({marginRight:D.spacing(-x/2),marginLeft:D.spacing(-x/2)}):(0,t.css)({marginRight:D.spacing(x/2)}),content:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"center",whiteSpace:"nowrap",overflow:"hidden",height:"100%"})}};function h(E,D,b){let C=D.border,y="transparent",M="transparent";return D.name==="secondary"&&(y=D.border,M=E.colors.emphasize(D.border,.25),C=E.colors.border.strong),b==="outline"?{background:"transparent",color:D.text,border:`1px solid ${C}`,transition:E.transitions.create(["background-color","border-color","color"],{duration:E.transitions.duration.short}),"&:hover":{background:D.transparent,borderColor:E.colors.emphasize(C,.25),color:D.text}}:b==="text"?{background:"transparent",color:D.text,border:"1px solid transparent",transition:E.transitions.create(["background-color","color"],{duration:E.transitions.duration.short}),"&:focus":{outline:"none",textDecoration:"none"},"&:hover":{background:D.transparent,textDecoration:"none"}}:{background:D.main,color:D.contrastText,border:`1px solid ${y}`,transition:E.transitions.create(["background-color","box-shadow","border-color","color"],{duration:E.transitions.duration.short}),"&:hover":{background:D.shade,color:D.contrastText,boxShadow:E.shadows.z1,borderColor:M}}}function p(E,D,b){const C={cursor:"not-allowed",boxShadow:"none",color:E.colors.text.disabled,transition:"none"};return b==="text"?{...C,background:"transparent",border:"1px solid transparent"}:b==="outline"?{...C,background:"transparent",border:`1px solid ${E.colors.border.weak}`}:{...C,background:E.colors.action.disabledBackground,border:"1px solid transparent"}}function m(E,D,b){switch(D){case"secondary":return h(E,E.colors.secondary,b);case"destructive":return h(E,E.colors.error,b);case"success":return h(E,E.colors.success,b);case"primary":default:return h(E,E.colors.primary,b)}}const a=E=>(0,t.css)({background:"transparent",color:E.colors.text.primary,border:"none",padding:0}),v=E=>(0,t.css)({background:"transparent",border:"none",padding:0,fontFamily:"inherit",color:"inherit",height:"100%","&:hover":{background:"transparent",color:"inherit"}})},19727:(Q,A,e)=>{"use strict";e.d(A,{e:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=(0,n.forwardRef)(({className:g,children:u,...c},i)=>{const l=(0,o.of)(r);return n.createElement("div",{ref:i,className:(0,t.cx)("button-group",l.wrapper,g),...c},u)});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}})})},61458:(Q,A,e)=>{"use strict";e.d(A,{V:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({className:g,children:u})=>{const c=(0,o.of)(r);return n.createElement("div",{className:(0,t.cx)(c,g)},u)},r=()=>(0,t.css)({display:"flex",button:{flexGrow:1,justifyContent:"center"},"> *":{flexGrow:1},label:{flexGrow:1,textAlign:"center"}})},32012:(Q,A,e)=>{"use strict";e.d(A,{H:()=>c});var t=e(32196),n=e(24442),o=e(96540),s=e(40845),r=e(55852),g=e(58898),u=e(14578);const c=l=>{const{onChange:f,className:d,loadData:h,icon:p,buttonProps:m,hideDownIcon:a,variant:v,disabled:E,...D}=l,b=(0,s.of)(i);let C=l.children;return a||(C=[l.children,o.createElement(u.I,{key:"down-icon",name:"angle-down",className:b.icons.right})]),o.createElement(n.A,{onChange:(0,g.k)(f),loadData:(0,g.W)(h),dropdownClassName:b.popup,...D,expandIcon:null},o.createElement(r.$n,{icon:p,disabled:E,variant:v,...m??{}},C))};c.displayName="ButtonCascader";const i=l=>({popup:(0,t.css)({label:"popup",zIndex:l.zIndex.dropdown}),icons:{right:(0,t.css)({margin:"1px 0 0 4px"}),left:(0,t.css)({margin:"-1px 4px 0 0"})}})},76442:(Q,A,e)=>{"use strict";e.d(A,{c:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({message:g,callToActionElement:u,footer:c,className:i})=>{const l=(0,o.of)(r);return n.createElement("div",{className:(0,t.cx)([l.wrapper,i])},g&&n.createElement("div",{className:l.message},g),u,c&&n.createElement("div",{className:l.footer},c))},r=g=>({wrapper:(0,t.css)({label:"call-to-action-card",background:g.colors.background.secondary,borderRadius:g.shape.radius.default,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flexGrow:1,padding:g.spacing(3),[g.breakpoints.down("sm")]:{padding:g.spacing(3,1)}}),message:(0,t.css)({marginBottom:g.spacing(3),fontStyle:"italic"}),footer:(0,t.css)({marginTop:g.spacing(3)})})},10860:(Q,A,e)=>{"use strict";e.d(A,{H:()=>y,Z:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(16797),r=e(81507);const g=n.createContext(null),u=({disabled:M,href:T,onClick:I,children:x,isSelected:S,isCompact:O,className:P,...L})=>{const U=(0,n.useMemo)(()=>n.Children.toArray(x).some(w=>n.isValidElement(w)&&w.type===c),[x]),R=M||!I&&!T,B=I&&!M?I:void 0,H=(0,o.of)(r.i,M,R,S,O);return n.createElement(r.Q,{disableEvents:M,disableHover:R,isSelected:S,className:(0,t.cx)(H.container,P),...L},n.createElement(g.Provider,{value:{href:T,onClick:B,disabled:M,isSelected:S}},!U&&n.createElement(c,null),x))},c=({children:M,className:T,"aria-label":I})=>{const x=(0,n.useContext)(g),S=(0,o.of)(i),{href:O,onClick:P,isSelected:L}=x??{href:void 0,onClick:void 0,isSelected:void 0};return n.createElement("h2",{className:(0,t.cx)(S.heading,T)},O?n.createElement("a",{href:O,className:S.linkHack,"aria-label":I,onClick:P},M):P?n.createElement("button",{onClick:P,className:S.linkHack,"aria-label":I,type:"button"},M):n.createElement(n.Fragment,null,M),L!==void 0&&n.createElement("input",{"aria-label":"option",type:"radio",checked:L,readOnly:!0}))};c.displayName="Heading";const i=M=>({heading:(0,t.css)({gridArea:"Heading",justifySelf:"start",display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",marginBottom:0,fontSize:M.typography.size.md,letterSpacing:"inherit",lineHeight:M.typography.body.lineHeight,color:M.colors.text.primary,fontWeight:M.typography.fontWeightMedium,"& input[readonly]":{cursor:"inherit"}}),linkHack:(0,t.css)({all:"unset","&::after":{position:"absolute",content:'""',top:0,bottom:0,left:0,right:0,borderRadius:M.shape.radius.default},"&:focus-visible":{outline:"none",outlineOffset:0,boxShadow:"none","&::after":{...(0,s.getFocusStyles)(M),zIndex:1}}})}),l=({children:M,className:T})=>{const I=(0,o.of)(f);return n.createElement("div",{className:(0,t.cx)(I.tagList,T)},M)};l.displayName="Tags";const f=M=>({tagList:(0,t.css)({position:"relative",gridArea:"Tags",alignSelf:"center"})}),d=({children:M,className:T})=>{const I=(0,o.of)(h);return n.createElement("p",{className:(0,t.cx)(I.description,T)},M)};d.displayName="Description";const h=M=>({description:(0,t.css)({width:"100%",gridArea:"Description",margin:M.spacing(1,0,0),color:M.colors.text.secondary,lineHeight:M.typography.body.lineHeight})}),p=({children:M,align:T="start",className:I})=>{const x=(0,o.of)(m);return n.createElement("div",{className:(0,t.cx)(x.media,I,(0,t.css)({alignSelf:T}))},M)};p.displayName="Figure";const m=M=>({media:(0,t.css)({position:"relative",gridArea:"Figure",marginRight:M.spacing(2),width:"40px","> img":{width:"100%"},"&:empty":{display:"none"}})}),a=(0,n.memo)(({children:M,className:T,separator:I="|"})=>{const x=(0,o.of)(v);let S=M;const O=n.Children.toArray(M).filter(Boolean);return O.length?(S=O.map((P,L)=>n.createElement("div",{key:`element_${L}`,className:x.metadataItem},P)),O.length>1&&I&&(S=O.reduce((P,L,U)=>[P,n.createElement("span",{key:`separator_${U}`,className:x.separator},I),L])),n.createElement("div",{className:(0,t.cx)(x.metadata,T)},S)):null});a.displayName="Meta";const v=M=>({metadata:(0,t.css)({gridArea:"Meta",display:"flex",alignItems:"center",width:"100%",fontSize:M.typography.size.sm,color:M.colors.text.secondary,margin:M.spacing(.5,0,0),lineHeight:M.typography.bodySmall.lineHeight,overflowWrap:"anywhere"}),metadataItem:(0,t.css)({zIndex:0}),separator:(0,t.css)({margin:`0 ${M.spacing(1)}`})}),E=({children:M,disabled:T,variant:I,className:x})=>{const S=(0,o.of)(D),P=(0,n.useContext)(g)?.disabled||T,L=I==="primary"?S.actions:S.secondaryActions;return n.createElement("div",{className:(0,t.cx)(L,x)},n.Children.map(M,U=>n.isValidElement(U)?(0,n.cloneElement)(U,{disabled:P,...U.props}):null))},D=M=>({actions:(0,t.css)({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:M.spacing(1),gridArea:"Actions",marginTop:M.spacing(2)}),secondaryActions:(0,t.css)({alignSelf:"center",color:M.colors.text.secondary,display:"flex",flexDirection:"row",flexWrap:"wrap",gap:M.spacing(1),gridArea:"Secondary",marginTop:M.spacing(2)})}),b=({children:M,disabled:T,className:I})=>n.createElement(E,{variant:"primary",disabled:T,className:I},M);b.displayName="Actions";const C=({children:M,disabled:T,className:I})=>n.createElement(E,{variant:"secondary",disabled:T,className:I},M);C.displayName="SecondaryActions";const y=M=>({inner:(0,t.css)({display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",flexWrap:"wrap"}),...i(M),...v(M),...h(M),...m(M),...D(M),...f(M)});u.Heading=c,u.Tags=l,u.Figure=p,u.Meta=a,u.Actions=b,u.SecondaryActions=C,u.Description=d},81507:(Q,A,e)=>{"use strict";e.d(A,{Q:()=>u,i:()=>c});var t=e(32196),n=e(96540),o=e(40845),s=e(16797);const r=({children:i,href:l})=>{const{inner:f}=(0,o.of)(g);return l?n.createElement("a",{className:f,href:l},i):n.createElement(n.Fragment,null,i)},g=i=>({inner:(0,t.css)({display:"flex",width:"100%",padding:i.spacing(2)})}),u=({children:i,disableEvents:l,disableHover:f,isSelected:d,className:h,href:p,...m})=>{const{oldContainer:a}=(0,o.of)(c,l,f,d);return n.createElement("div",{...m,className:(0,t.cx)(a,h)},n.createElement(r,{href:p},i))},c=(i,l=!1,f=!1,d,h)=>{const p=d!==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:i.spacing(h?1:2),background:i.colors.background.secondary,borderRadius:i.shape.radius.default,marginBottom:"8px",pointerEvents:l?"none":"auto",transition:i.transitions.create(["background-color","box-shadow","border-color","color"],{duration:i.transitions.duration.short}),...!f&&{"&:hover":{background:i.colors.emphasize(i.colors.background.secondary,.03),cursor:"pointer",zIndex:1},"&:focus":s.getFocusStyles(i)},...p&&{cursor:"pointer"},...d&&{outline:`solid 2px ${i.colors.primary.border}`}}),oldContainer:(0,t.css)({display:"flex",width:"100%",background:i.colors.background.secondary,borderRadius:i.shape.radius.default,position:"relative",pointerEvents:l?"none":"auto",marginBottom:i.spacing(1),transition:i.transitions.create(["background-color","box-shadow","border-color","color"],{duration:i.transitions.duration.short}),...!f&&{"&:hover":{background:i.colors.emphasize(i.colors.background.secondary,.03),cursor:"pointer",zIndex:1},"&:focus":s.getFocusStyles(i)}})}}},3988:(Q,A,e)=>{"use strict";e.d(A,{v:()=>d});var t=e(32196),n=e(47078),o=e.n(n),s=e(24442),r=e(96540),g=e(14578),u=e(10354),c=e(88323),i=e(58898);const l=(0,t.css)({"&:focus":{outline:"none"}}),f=" / ";class d extends r.PureComponent{constructor(p){super(p),this.flattenOptions=(E,D=[])=>{let b=[];for(const C of E){const y=[...D];y.push(C),!C.items||C.items.length===0?b.push({singleLabel:y[y.length-1].label,label:y.map(M=>M.label).join(this.props.separator||f),value:y.map(M=>M.value)}):b=[...b,...this.flattenOptions(C.items,y)]}return b},this.getSearchableOptions=o()(E=>this.flattenOptions(E)),this.onChange=(E,D)=>{const b=this.props.hideActiveLevelLabel?"":this.props.displayAllSelectedLevels?D.map(y=>y.label).join(this.props.separator||f):D[D.length-1].label,C={rcValue:{value:E,label:b},focusCascade:!0,activeLabel:b,isSearching:!1};this.setState(C),this.props.onSelect(D[D.length-1].value)},this.onSelect=E=>{const D=E.value||[],b=this.props.displayAllSelectedLevels?E.label:E.singleLabel||"",C={activeLabel:b,rcValue:{value:D,label:b},isSearching:!1,focusCascade:!1};this.setState(C),this.props.onSelect(D[D.length-1])},this.onCreateOption=E=>{this.setState({activeLabel:E,rcValue:[],isSearching:!1}),this.props.onSelect(E)},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=E=>{["ArrowDown","ArrowUp","Enter","ArrowLeft","ArrowRight","Backspace"].includes(E.key)||this.setState({focusCascade:!1,isSearching:!0})},this.onSelectInputChange=E=>{E===""&&this.setState({isSearching:!1})};const m=this.getSearchableOptions(p.options),{rcValue:a,activeLabel:v}=this.setInitialValue(m,p.initialValue);this.state={isSearching:!1,focusCascade:!1,rcValue:a,activeLabel:v}}setInitialValue(p,m){if(!m)return{rcValue:[],activeLabel:""};for(const a of p){const v=a.value||[];if(v[v.length-1]===m)return{rcValue:v,activeLabel:this.props.displayAllSelectedLevels?a.label:a.singleLabel||""}}return this.props.allowCustomValue?{rcValue:[],activeLabel:m}:{rcValue:[],activeLabel:""}}render(){const{allowCustomValue:p,formatCreateLabel:m,placeholder:a,width:v,changeOnSelect:E,options:D,disabled:b}=this.props,{focusCascade:C,isSearching:y,rcValue:M,activeLabel:T}=this.state,I=this.getSearchableOptions(D);return r.createElement("div",null,y?r.createElement(c.l6,{allowCustomValue:p,placeholder:a,autoFocus:!C,onChange:this.onSelect,onBlur:this.onBlur,options:I,onCreateOption:this.onCreateOption,formatCreateLabel:m,width:v,onInputChange:this.onSelectInputChange,disabled:b}):r.createElement(s.A,{onChange:(0,i.k)(this.onChange),options:D,changeOnSelect:E,value:M.value,fieldNames:{label:"label",value:"value",children:"items"},expandIcon:null,open:this.props.alwaysOpen,disabled:b},r.createElement("div",{className:l},r.createElement(u.p,{autoFocus:this.props.autoFocus,width:v,placeholder:a,onBlur:this.onBlurCascade,value:T,onKeyDown:this.onInputKeyDown,onChange:()=>{},suffix:C?r.createElement(g.I,{name:"angle-up"}):r.createElement(g.I,{name:"angle-down",style:{marginBottom:0,marginLeft:"4px"}}),disabled:b}))))}}d.defaultProps={changeOnSelect:!0}},58898:(Q,A,e)=>{"use strict";e.d(A,{W:()=>n,k:()=>t});const t=r=>(g,u)=>{r&&r(g.map(c=>String(c)),o(u))},n=r=>g=>{r&&r(o(g))},o=r=>r.map(s),s=r=>({value:r.value??"",label:r.label})},8866:(Q,A,e)=>{"use strict";e.d(A,{N:()=>n});var t=e(96540);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||s.target instanceof Node&&!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}},10534:(Q,A,e)=>{"use strict";e.d(A,{b:()=>i});var t=e(32196),n=e(96540),o=e(76412),s=e(40845),r=e(55852),g=e(14578),u=e(32982);const c=2*1e3;function i({onClipboardCopy:d,onClipboardError:h,children:p,getText:m,icon:a,variant:v,...E}){const D=(0,s.of)(f),[b,C]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let T;return b&&(T=setTimeout(()=>{C(!1)},c)),()=>{window.clearTimeout(T)}},[b]);const y=(0,n.useRef)(null),M=(0,n.useCallback)(async()=>{const T=m();try{await l(T,y),C(!0),d?.(T)}catch(I){h?.(T,I)}},[m,d,h]);return n.createElement(n.Fragment,null,b&&n.createElement(u.r,{placement:"top",referenceElement:y.current},n.createElement(o.x,{i18nKey:"clipboard-button.inline-toast.success"},"Copied")),n.createElement(r.$n,{onClick:M,icon:a,variant:b?"success":v,"aria-label":b?"Copied":void 0,...E,className:(0,t.cx)(D.button,b&&D.successButton,E.className),ref:y},p,b&&n.createElement("div",{className:D.successOverlay},n.createElement(g.I,{name:"check"}))))}const l=async(d,h)=>{if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(d);{const p=document.createElement("textarea");h.current?.appendChild(p),p.value=d,p.focus(),p.select(),document.execCommand("copy"),p.remove()}},f=d=>({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"})})},57418:(Q,A,e)=>{"use strict";e.d(A,{M:()=>i});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(40845),g=e(16797),u=e(14578),c=e(62930);const i=({label:f,isOpen:d,onToggle:h,className:p,contentClassName:m,children:a,labelId:v,loading:E=!1,headerDataTestId:D,contentDataTestId:b})=>{const[C,y]=(0,s.useState)(d),M=(0,r.of)(l),T=S=>{S.target instanceof HTMLElement&&S.target.tagName==="A"||(S.preventDefault(),S.stopPropagation(),h?.(!C),y(!C))},{current:I}=(0,s.useRef)((0,n.uniqueId)()),x=v??`collapse-label-${I}`;return s.createElement(s.Fragment,null,s.createElement("div",{onClick:T,className:(0,t.cx)(M.header,p)},s.createElement("button",{type:"button",id:`collapse-button-${I}`,className:M.button,onClick:T,"aria-expanded":C&&!E,"aria-controls":`collapse-content-${I}`,"aria-labelledby":x},E?s.createElement(c.y,{className:M.spinner}):s.createElement(u.I,{name:C?"angle-up":"angle-down",className:M.icon})),s.createElement("div",{className:M.label,id:`collapse-label-${I}`,"data-testid":D},f)),C&&s.createElement("div",{id:`collapse-content-${I}`,className:(0,t.cx)(M.content,m),"data-testid":b},a))},l=f=>({header:(0,t.css)({display:"flex",cursor:"pointer",boxSizing:"border-box",flexDirection:"row-reverse",position:"relative",justifyContent:"space-between",fontSize:f.typography.size.lg,padding:`${f.spacing(.5)} 0`,"&:focus-within":(0,g.getFocusStyles)(f)}),button:(0,t.css)({all:"unset","&:focus-visible":{outline:"none",outlineOffset:"unset",transition:"none",boxShadow:"none"}}),icon:(0,t.css)({color:f.colors.text.secondary}),content:(0,t.css)({padding:`${f.spacing(2)} 0`}),spinner:(0,t.css)({display:"flex",alignItems:"center",width:f.spacing(2)}),label:(0,t.css)({display:"flex"})})},82762:(Q,A,e)=>{"use strict";e.d(A,{S:()=>c,a:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(55852),r=e(14578);const g=i=>({collapse:(0,t.css)({label:"collapse",marginBottom:i.spacing(1),backgroundColor:i.colors.background.primary,border:`1px solid ${i.colors.border.weak}`,position:"relative",borderRadius:i.shape.radius.default,width:"100%",display:"flex",flexDirection:"column",flex:"1 1 0"}),collapseBody:(0,t.css)({label:"collapse__body",padding:i.spacing(i.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:i.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:i.colors.primary.main},"@keyframes loader":{from:{left:"-25%",opacity:.1},to:{left:"100%",opacity:1}}}),header:(0,t.css)({label:"collapse__header",padding:i.spacing(1,2,1,2),display:"flex",transition:"all 0.1s linear"}),headerCollapsed:(0,t.css)({label:"collapse__header--collapsed",padding:i.spacing(1,2,1,2)}),headerLabel:(0,t.css)({label:"collapse__header-label",fontWeight:i.typography.fontWeightMedium,marginRight:i.spacing(1),fontSize:i.typography.size.md,display:"flex",flex:"0 0 100%"}),icon:(0,t.css)({label:"collapse__icon",margin:i.spacing(.25,1,0,-1)})}),u=({isOpen:i,onToggle:l,...f})=>{const[d,h]=(0,n.useState)(i);return n.createElement(c,{isOpen:d,collapsible:!0,...f,onToggle:()=>{h(!d),l&&l(!d)}})},c=({isOpen:i,label:l,loading:f,collapsible:d,onToggle:h,className:p,children:m})=>{const a=(0,o.of)(s.my),v=(0,o.of)(g),E=()=>{h&&h(!i)},D=(0,t.cx)([v.collapse,p]),b=f?(0,t.cx)([v.loader,v.loaderActive]):(0,t.cx)([v.loader]),C=d?(0,t.cx)([v.header]):(0,t.cx)([v.headerCollapsed]);return n.createElement("div",{className:D},n.createElement("button",{type:"button",className:(0,t.cx)(a,C),onClick:E},d&&n.createElement(r.I,{className:v.icon,name:i?"angle-down":"angle-right"}),n.createElement("div",{className:(0,t.cx)([v.headerLabel])},l)),i&&n.createElement("div",{className:(0,t.cx)([v.collapseBody])},n.createElement("div",{className:b}),n.createElement("div",{className:v.bodyContentWrapper},m)))};c.displayName="Collapse"},36314:(Q,A,e)=>{"use strict";e.d(A,{A:()=>i});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(84140),g=e(40845),u=e(10354);const c=(0,s.forwardRef)(({color:d,onChange:h,isClearable:p=!1,onClick:m,onBlur:a,disabled:v,buttonAriaLabel:E,...D},b)=>{const[C,y]=(0,s.useState)(d),[M,T]=(0,s.useState)(d),I=(0,s.useMemo)(()=>(0,n.debounce)(h,100),[]);(0,s.useEffect)(()=>{const O=(0,r.A)(d);O.isValid()&&d!==M&&(y(O.toString()),T(d))},[d,M]);const x=O=>{const{value:P}=O.currentTarget;if(y(P),P===""&&p){I(P);return}const L=(0,r.A)(P);L.isValid()&&I(L.toString())},S=O=>{(0,r.A)(C).isValid()||y(d),a?.(O)};return s.createElement(u.p,{...D,value:C,onChange:x,disabled:v,onClick:m,onBlur:S,addonBefore:s.createElement(l,{onClick:m,ariaLabel:E,disabled:v,color:d}),ref:b})});c.displayName="ColorInput";const i=c,l=({color:d,onClick:h,disabled:p,ariaLabel:m})=>{const a=(0,g.of)(f);return s.createElement("button",{type:"button",onClick:h,"aria-label":m,disabled:p||!h,className:(0,t.cx)(a,(0,t.css)({backgroundColor:d}))})},f=d=>(0,t.css)({height:"100%",width:`${d.spacing.gridSize*4}px`,borderRadius:`${d.shape.radius.default} 0 0 ${d.shape.radius.default}`,border:`1px solid ${d.colors.border.medium}`})},83598:(Q,A,e)=>{"use strict";e.d(A,{Dp:()=>h,sk:()=>d});var t=e(32196),n=e(96540),o=e(40845),s=e(3911),r=e(40321),g=e(13840),u=e(95868),c=e(70045),i=e(83876),l=e(70104);const f=(m,a="ColorPicker")=>{var v;return v=class extends n.Component{constructor(){super(...arguments),this.pickerTriggerRef=(0,n.createRef)()}render(){const{theme:E,children:D,onChange:b,color:C}=this.props,y=p(E),M=n.createElement(m,{...this.props,children:null,onChange:b});return n.createElement(u.I,{content:M,hideAfter:300},(T,I,x)=>n.createElement(n.Fragment,null,this.pickerTriggerRef.current&&n.createElement(g.A,{...x,referenceElement:this.pickerTriggerRef.current,wrapperClassName:y.colorPicker,onMouseLeave:I,onMouseEnter:T,onKeyDown:S=>(0,r.Q)(S,I)}),D?D({ref:this.pickerTriggerRef,showColorPicker:T,hideColorPicker:I}):n.createElement(i.q,{ref:this.pickerTriggerRef,onClick:T,onMouseLeave:I,color:E.visualization.getColorByName(C||"#000000"),"aria-label":C})))}},v.displayName=a,v},d=(0,o.cV)(f(c.$,"ColorPicker")),h=(0,o.cV)(f(l.o,"SeriesColorPicker")),p=(0,s.N)(m=>({colorPicker:(0,t.css)({position:"absolute",zIndex:m.zIndex.tooltip,color:m.colors.text.primary,maxWidth:"400px",fontSize:m.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"}})}))},99128:(Q,A,e)=>{"use strict";e.d(A,{i:()=>l});var t=e(32196),n=e(96540),o=e(7612),s=e(65229),r=e(23596),g=e(40845),u=e(8866),c=e(36314),i=e(95151);const l=(0,n.forwardRef)(({value:d="",onChange:h,returnColorAs:p="rgb",...m},a)=>{const[v,E]=(0,n.useState)(d),[D,b]=(0,n.useState)(!1),C=(0,g.$j)(),y=(0,g.of)(f),M=(0,g.of)(i.$);return(0,s.A)(T=>{if(T===d)return;if(!T){h("");return}const I=C.visualization.getColorByName(T);h(p==="rgb"?r.asRgbString(I):r.asHexString(I))},500,[v]),n.createElement(u.N,{onClick:()=>b(!1)},n.createElement("div",{className:y.wrapper},D&&!m.disabled&&n.createElement(o.p9,{"data-testid":"color-popover",color:v,onChange:E,className:(0,t.cx)(M.root,y.picker)}),n.createElement(c.A,{...m,theme:C,color:v,onChange:E,buttonAriaLabel:"Open color picker",onClick:()=>b(!0),onBlur:()=>b(!1),ref:a,isClearable:!0})))});l.displayName="ColorPickerInput";const f=d=>({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"})})},70045:(Q,A,e)=>{"use strict";e.d(A,{$:()=>v});var t=e(32196),n=e(7887),o=e(96540),s=e(23596),r=e(40845),g=e(3911),u=e(83876),c=e(2543);function i(D,b){const C=new Array(D.length);for(let y=0;y<D.length;y++){const M=D.length-1-y;C[y]=b(D[M],M,D)}return C}const f=({hue:D,selectedColor:b,onColorSelect:C,...y})=>{const M=(0,c.upperFirst)(D.name),T=(0,r.of)(d);return o.createElement("div",{className:T.colorRow},o.createElement("div",{className:T.colorLabel},M),o.createElement("div",{...y,className:T.swatchRow},i(D.shades,I=>o.createElement(u.q,{key:I.name,"aria-label":I.name,variant:I.primary?u.h.Large:u.h.Small,isSelected:I.name===b,color:I.color,onClick:()=>C(I.name)}))))},d=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"})}),h=({color:D,onChange:b})=>{const C=(0,r.$j)(),y=(0,r.of)(p),M=[];for(const T of C.visualization.hues)M.push(o.createElement(f,{key:T.name,selectedColor:D,hue:T,onColorSelect:b}));return o.createElement(o.Fragment,null,o.createElement("div",{className:y.swatches},M),o.createElement("div",{className:y.extraColors},o.createElement(u.q,{isSelected:D==="transparent",color:"rgba(0,0,0,0)",label:"Transparent",onClick:()=>b("transparent")}),o.createElement(u.q,{isSelected:D==="text",color:C.colors.text.primary,label:"Text color",onClick:()=>b("text")})))},p=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 m=e(95151);class a extends o.Component{constructor(b){super(b),this.getTabClassName=C=>{const{activePicker:y}=this.state;return`ColorPickerPopover__tab ${y===C&&"ColorPickerPopover__tab--active"}`},this.handleChange=C=>{const{onChange:y,enableNamedColors:M,theme:T}=this.props;if(M)return y(C);y(s.asHexString(T.visualization.getColorByName(C)))},this.onTabChange=C=>()=>this.setState({activePicker:C}),this.renderPicker=()=>{const{activePicker:C}=this.state,{color:y}=this.props;switch(C){case"spectrum":return o.createElement(m.A,{color:y,onChange:this.handleChange});case"palette":return o.createElement(h,{color:y,onChange:this.handleChange});default:return this.renderCustomPicker(C)}},this.renderCustomPicker=C=>{const{customPickers:y,color:M,theme:T}=this.props;return y?o.createElement(y[C].tabComponent,{color:M,theme:T,onChange:this.handleChange}):null},this.renderCustomPickerTabs=()=>{const{customPickers:C}=this.props;return C?o.createElement(o.Fragment,null,Object.keys(C).map(y=>o.createElement("button",{className:this.getTabClassName(y),onClick:this.onTabChange(y),key:y,type:"button"},C[y].name))):null},this.state={activePicker:"palette"}}render(){const{theme:b}=this.props,C=E(b);return o.createElement(n.n1,{contain:!0,restoreFocus:!0,autoFocus:!0},o.createElement("div",{tabIndex:-1,className:C.colorPickerPopover},o.createElement("div",{className:C.colorPickerPopoverTabs},o.createElement("button",{className:this.getTabClassName("palette"),onClick:this.onTabChange("palette"),type:"button"},"Colors"),o.createElement("button",{className:this.getTabClassName("spectrum"),onClick:this.onTabChange("spectrum"),type:"button"},"Custom"),this.renderCustomPickerTabs()),o.createElement("div",{className:C.colorPickerPopoverContent},this.renderPicker())))}}const v=(0,r.cV)(a);v.displayName="ColorPickerPopover";const E=(0,g.N)(D=>({colorPickerPopover:(0,t.css)({borderRadius:D.shape.radius.default,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.radius.default} ${D.shape.radius.default} 0 0`})}))},83876:(Q,A,e)=>{"use strict";e.d(A,{h:()=>u,q:()=>c});var t=e(32196),n=e(7887),o=e(96540),s=e(84140),r=e(13544),g=e(40845),u=(l=>(l.Small="small",l.Large="large",l))(u||{});const c=o.forwardRef(({color:l,label:f,variant:d="small",isSelected:h,"aria-label":p,...m},a)=>{const v=(0,g.$j)(),{isFocusVisible:E,focusProps:D}=(0,n.og)(),b=i(v,d,l,E,h),C=!!f,y=p||f;return o.createElement("div",{ref:a,className:b.wrapper,"data-testid":r.Tp.components.ColorSwatch.name,...m},C&&o.createElement("span",{className:b.label},f),o.createElement("button",{className:b.swatch,...D,"aria-label":y?`${y} color`:"Pick a color",type:"button"}))}),i=(l,f,d,h,p)=>{const m=(0,s.A)(d),v=f==="small"?"16px":"32px";let E="none";return m.getAlpha()<.1&&(E=`2px solid ${l.colors.border.medium}`),{wrapper:(0,t.css)({display:"flex",alignItems:"center",cursor:"pointer"}),label:(0,t.css)({marginRight:l.spacing(1)}),swatch:(0,t.css)({width:v,height:v,background:`${d}`,border:E,borderRadius:l.shape.radius.circle,outlineOffset:"1px",outline:h?`2px solid ${l.colors.primary.main}`:"none",boxShadow:p?`inset 0 0 0 2px ${d}, inset 0 0 0 4px ${l.colors.getContrastText(d)}`:"none",transition:l.transitions.create(["transform"],{duration:l.transitions.duration.short}),"&:hover":{transform:"scale(1.1)"},"@media (forced-colors: active)":{forcedColorAdjust:"none"}})}};c.displayName="ColorSwatch"},70104:(Q,A,e)=>{"use strict";e.d(A,{o:()=>g,t:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(74716),r=e(70045);const g=i=>{const l=(0,o.of)(c),{yaxis:f,onToggleAxis:d,color:h,...p}=i,m=d?{yaxis:{name:"Y-Axis",tabComponent(){return n.createElement(s.d,{key:"yaxisSwitch",label:"Use right y-axis",className:l.colorPickerAxisSwitch,labelClass:l.colorPickerAxisSwitchLabel,checked:f===2,onChange:()=>{d&&d()}})}}}:void 0;return n.createElement(r.$,{...p,color:h||"#000000",customPickers:m})},u=(0,o.cV)(g),c=()=>({colorPickerAxisSwitch:(0,t.css)({width:"100%"}),colorPickerAxisSwitchLabel:(0,t.css)({display:"flex",flexGrow:1})})},95151:(Q,A,e)=>{"use strict";e.d(A,{$:()=>l,A:()=>f});var t=e(32196),n=e(96540),o=e(7612),s=e(65229),r=e(84140),g=e(23596),u=e(40845),c=e(36314);const i=({color:d,onChange:h})=>{const[p,m]=(0,n.useState)(d);(0,s.A)(D=>{h(g.asHexString(a.visualization.getColorByName(D)))},500,[p]);const a=(0,u.$j)(),v=(0,u.of)(l),E=(0,n.useMemo)(()=>p.startsWith("rgba")?p:(0,r.A)(a.visualization.getColorByName(d)).toRgbString(),[p,a,d]);return n.createElement("div",{className:v.wrapper},n.createElement(o.p9,{className:v.root,color:E,onChange:m}),n.createElement(c.A,{theme:a,color:E,onChange:m,className:v.colorInput}))},l=d=>({wrapper:(0,t.css)({flexGrow:1}),root:(0,t.css)({"&.react-colorful":{width:"auto"},".react-colorful":{"&__saturation":{borderRadius:`${d.shape.radius.default} ${d.shape.radius.default} 0 0`},"&__alpha":{borderRadius:`0 0 ${d.shape.radius.default} ${d.shape.radius.default}`},"&__alpha, &__hue":{height:d.spacing(2),position:"relative"},"&__pointer":{height:d.spacing(2),width:d.spacing(2)}}}),colorInput:(0,t.css)({marginTop:d.spacing(2)})}),f=i},82702:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(3911),r=e(55852);class g extends n.PureComponent{constructor(){super(...arguments),this.mainButtonRef=n.createRef(),this.confirmButtonRef=n.createRef(),this.state={showConfirm:!1},this.onClickButton=l=>{l&&l.preventDefault(),this.setState({showConfirm:!0},()=>{this.props.autoFocus&&this.confirmButtonRef.current&&this.confirmButtonRef.current.focus()}),this.props.onClick&&this.props.onClick()},this.onClickCancel=l=>{l&&l.preventDefault(),this.setState({showConfirm:!1},()=>{this.mainButtonRef.current?.focus()}),this.props.onCancel&&this.props.onCancel()},this.onConfirm=l=>{l&&l.preventDefault(),this.props.onConfirm(),this.props.closeOnConfirm&&this.setState({showConfirm:!1})}}render(){const{theme:l,className:f,size:d,disabled:h,confirmText:p,confirmVariant:m,children:a}=this.props,v=c(l),E=(0,t.cx)(f,this.state.showConfirm?v.buttonHide:v.buttonShow,h&&v.buttonDisabled),D=(0,t.cx)(v.confirmButton,this.state.showConfirm?v.confirmButtonShow:v.confirmButtonHide),b=h?()=>{}:this.onClickButton;return n.createElement("span",{className:v.buttonContainer},n.createElement("div",{className:(0,t.cx)(h&&v.disabled)},n.createElement("span",{className:E},typeof a=="string"?n.createElement(r.$n,{size:d,fill:"text",onClick:b,ref:this.mainButtonRef},a):n.cloneElement(a,{onClick:b,ref:this.mainButtonRef}))),n.createElement("span",{className:D},n.createElement(r.$n,{size:d,variant:m,onClick:this.onConfirm,ref:this.confirmButtonRef},p),n.createElement(r.$n,{size:d,fill:"text",onClick:this.onClickCancel},"Cancel")))}}const u=(0,o.cV)(g),c=(0,s.N)(i=>({buttonContainer:(0,t.css)({display:"flex",alignItems:"center",justifyContent:"flex-end"}),buttonDisabled:(0,t.css)({textDecoration:"none",color:i.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:i.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"})}));u.defaultProps={size:"md",confirmText:"Save",disabled:!1,confirmVariant:"primary"},u.displayName="ConfirmButton"},91605:(Q,A,e)=>{"use strict";e.d(A,{e:()=>s});var t=e(96540),n=e(55852),o=e(82702);const s=({size:r,disabled:g,onConfirm:u,"aria-label":c,closeOnConfirm:i})=>t.createElement(o.Z,{confirmText:"Delete",confirmVariant:"destructive",size:r||"md",disabled:g,onConfirm:u,closeOnConfirm:i},t.createElement(n.$n,{"aria-label":c,variant:"destructive",icon:"times",size:r||"sm"}))},96374:(Q,A,e)=>{"use strict";e.d(A,{u:()=>i});var t=e(32196),n=e(96540),o=e(13544),s=e(40845),r=e(55852),g=e(10354),u=e(66864),c=e(37390);const i=({isOpen:f,title:d,body:h,description:p,confirmText:m,confirmVariant:a="destructive",confirmationText:v,dismissText:E="Cancel",dismissVariant:D="secondary",alternativeText:b,modalClass:C,icon:y="exclamation-triangle",onConfirm:M,onDismiss:T,onAlternative:I,confirmButtonVariant:x="destructive"})=>{const[S,O]=(0,n.useState)(!!v),P=(0,s.of)(l),L=(0,n.useRef)(null),U=B=>{O(v?.toLowerCase().localeCompare(B.currentTarget.value.toLowerCase())!==0)};(0,n.useEffect)(()=>{f&&L.current?.focus()},[f]),(0,n.useEffect)(()=>{f&&O(!!v)},[f,v]);const R=async()=>{O(!0);try{await M()}finally{O(!1)}};return n.createElement(c.a,{className:(0,t.cx)(P.modal,C),title:d,icon:y,isOpen:f,onDismiss:T},n.createElement("div",{className:P.modalText},h,p?n.createElement("div",{className:P.modalDescription},p):null,v?n.createElement("div",{className:P.modalConfirmationInput},n.createElement(u.Gy,null,n.createElement(g.p,{placeholder:`Type "${v}" to confirm`,onChange:U}))):null),n.createElement(c.a.ButtonRow,null,n.createElement(r.$n,{variant:D,onClick:T,fill:"outline"},E),n.createElement(r.$n,{variant:x,onClick:R,disabled:S,ref:L,"data-testid":o.Tp.pages.ConfirmModal.delete},m),I?n.createElement(r.$n,{variant:"primary",onClick:I},b):null))},l=f=>({modal:(0,t.css)({width:"500px"}),modalText:(0,t.css)({fontSize:f.typography.h5.fontSize,color:f.colors.text.primary}),modalDescription:(0,t.css)({fontSize:f.typography.body.fontSize}),modalConfirmationInput:(0,t.css)({paddingTop:f.spacing(1)})})},28122:(Q,A,e)=>{"use strict";e.d(A,{t:()=>g});var t=e(96540),n=e(29647),o=e(13544),s=e(38138),r=e(17464);const g=t.memo(({x:u,y:c,onClose:i,focusOnOpen:l=!0,renderMenuItems:f,renderHeader:d})=>{const h=(0,t.useRef)(null),[p,m]=(0,t.useState)({});(0,t.useLayoutEffect)(()=>{const b=h.current;if(b){const C=b.getBoundingClientRect(),y=5,M={right:window.innerWidth<u+C.width,bottom:window.innerHeight<c+C.height+y};m({position:"fixed",left:M.right?u-C.width-y:u-y,top:Math.max(0,M.bottom?c-C.height-y:c+y)})}},[u,c]),(0,n.A)(h,()=>{i?.()});const a=d?.(),v=f?.(),E=b=>{l&&b(0)},D=b=>{b.key==="Escape"&&(b.preventDefault(),b.stopPropagation(),i?.())};return t.createElement(r.ZL,null,t.createElement(s.W,{header:a,ref:h,style:p,ariaLabel:o.Tp.components.Menu.MenuComponent("Context"),onOpen:E,onClick:i,onKeyDown:D},v))});g.displayName="ContextMenu"},51686:(Q,A,e)=>{"use strict";e.d(A,{n:()=>o});var t=e(96540),n=e(28122);const o=({children:s,renderMenuItems:r,focusOnOpen:g=!0})=>{const[u,c]=(0,t.useState)(!1),[i,l]=(0,t.useState)({x:0,y:0});return t.createElement(t.Fragment,null,s({openMenu:f=>{c(!0),l({x:f.pageX,y:f.pageY})}}),u&&t.createElement(n.t,{onClose:()=>c(!1),x:i.x,y:i.y,renderMenuItems:r,focusOnOpen:g}))}},40276:(Q,A,e)=>{"use strict";e.d(A,{E:()=>u,A:()=>c});var t=e(32196),n=e(96540),o=e(62295),s=e(40845);const r=({children:l})=>{const[f,d]=(0,n.useState)(!1),[h,p]=(0,n.useState)(!1),m=(0,n.useRef)(null),a=(0,n.useRef)(null),v=(0,s.of)(g);return(0,n.useEffect)(()=>{const E=new IntersectionObserver(D=>{D.forEach(b=>{b.target===m.current?d(!b.isIntersecting):b.target===a.current&&p(!b.isIntersecting)})});return[m,a].forEach(D=>{D.current&&E.observe(D.current)}),()=>E.disconnect()},[]),n.createElement(n.Fragment,null,n.createElement("div",{className:(0,t.cx)(v.scrollIndicator,v.scrollTopIndicator,{[v.scrollIndicatorVisible]:f})}),n.createElement("div",{className:v.scrollContent},n.createElement("div",{ref:m}),l,n.createElement("div",{ref:a})),n.createElement("div",{className:(0,t.cx)(v.scrollIndicator,v.scrollBottomIndicator,{[v.scrollIndicatorVisible]:h})}))},g=l=>({scrollContent:(0,t.css)({flex:1,position:"relative"}),scrollIndicator:(0,t.css)({height:l.spacing(6),left:0,opacity:0,pointerEvents:"none",position:"absolute",right:0,transition:l.transitions.create("opacity"),zIndex:1}),scrollTopIndicator:(0,t.css)({background:`linear-gradient(0deg, transparent, ${l.colors.background.canvas})`,top:0}),scrollBottomIndicator:(0,t.css)({background:`linear-gradient(180deg, transparent, ${l.colors.background.canvas})`,bottom:0}),scrollIndicatorVisible:(0,t.css)({opacity:1})}),u=({autoHide:l=!1,autoHideTimeout:f=200,setScrollTop:d,className:h,testId:p,autoHeightMin:m="0",autoHeightMax:a="100%",hideTracksWhenNotNeeded:v=!1,hideHorizontalTrack:E,hideVerticalTrack:D,scrollRefCallback:b,showScrollIndicators:C=!1,updateAfterMountMs:y,scrollTop:M,onScroll:T,children:I})=>{const x=(0,n.useRef)(null),S=(0,s.of)(i);(0,n.useEffect)(()=>{x.current&&b&&b(x.current.view)},[x,b]),(0,n.useEffect)(()=>{x.current&&M!=null&&x.current.scrollTop(M)},[M]),(0,n.useEffect)(()=>{y&&setTimeout(()=>{const w=x.current;w?.update&&w.update()},y)},[y]);function O(w,N,V){return V.style&&N&&(V.style.display="none"),n.createElement("div",{...V,className:w})}const P=(0,n.useCallback)(w=>O("track-horizontal",E,w),[E]),L=(0,n.useCallback)(w=>O("track-vertical",D,w),[D]),U=(0,n.useCallback)(w=>n.createElement("div",{...w,className:"thumb-horizontal"}),[]),R=(0,n.useCallback)(w=>n.createElement("div",{...w,className:"thumb-vertical"}),[]),B=(0,n.useCallback)(w=>(w.style&&w.style.WebkitOverflowScrolling==="touch"&&(w.style.WebkitOverflowScrolling="auto"),n.createElement("div",{...w,className:"scrollbar-view"})),[]),H=(0,n.useCallback)(()=>{x.current&&d&&d(x.current.getValues())},[d]);return n.createElement(o.Ay,{"data-testid":p,ref:x,className:(0,t.cx)(S.customScrollbar,h,{[S.scrollbarWithScrollIndicators]:C}),onScrollStop:H,autoHeight:!0,autoHide:l,autoHideTimeout:f,hideTracksWhenNotNeeded:v,autoHeightMax:a,autoHeightMin:m,renderTrackHorizontal:P,renderTrackVertical:L,renderThumbHorizontal:U,renderThumbVertical:R,renderView:B,onScroll:T},C?n.createElement(r,null,I):I)},c=u,i=l=>({customScrollbar:(0,t.css)({display:"flex",flexGrow:1,".scrollbar-view":{display:"flex",flexGrow:1,flexDirection:"column"},".track-vertical":{borderRadius:l.shape.borderRadius(2),width:`${l.spacing(1)} !important`,right:0,bottom:l.spacing(.25),top:l.spacing(.25)},".track-horizontal":{borderRadius:l.shape.borderRadius(2),height:`${l.spacing(1)} !important`,right:l.spacing(.25),bottom:l.spacing(.25),left:l.spacing(.25)},".thumb-vertical":{background:l.colors.action.focus,borderRadius:l.shape.borderRadius(2),opacity:0},".thumb-horizontal":{background:l.colors.action.focus,borderRadius:l.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"}})})},14689:(Q,A,e)=>{"use strict";e.d(A,{R:()=>o});var t=e(96540),n=e(55852);function o({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.$n,{icon:s.target==="_blank"?"external-link-alt":void 0,variant:"primary",size:"sm",...r},s.title))}},64078:(Q,A,e)=>{"use strict";e.d(A,{l:()=>I});var t=e(32196),n=e(95361),o=e(18491),s=e(36376),r=e(28848),g=e.n(r),u=e(96540),c=e(80292),i=e(75226),l=e(29317),f=e(91890),d=e(6709),h=e(41781),p=e(40845),m=e(72307),a=e(40276),v=e(10354),E=e(17464),D=e(43538);class b{getBoundingClientRect(){const O=window.getSelection(),P=O&&O.anchorNode;return P&&P.parentElement?P.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 C=(S,O)=>S-O*Math.floor(S/O),y={builtInVariable:{pattern:/(\${\S+?})/}},M=[(0,h.D)({onlyIn:S=>"type"in S&&S.type==="code_block",getSyntax:()=>"links"},{...g().languages,links:y})],T=S=>({input:(0,v.n)({theme:S,invalid:!1}).input,editor:(0,t.css)({".token.builtInVariable":{color:S.colors.success.text},".token.variable":{color:S.colors.primary.text}}),suggestionsWrapper:(0,t.css)({boxShadow:S.shadows.z2}),wrapperOverrides:(0,t.css)({width:"100%","> .slate-query-field__wrapper":{padding:0,backgroundColor:"transparent",border:"none"}})}),I=(0,u.memo)(({value:S,onChange:O,suggestions:P,placeholder:L="http://your-grafana.com/d/000000010/annotations"})=>{const U=(0,u.useRef)(null),R=(0,p.of)(T),[B,H]=(0,u.useState)(!1),[w,N]=(0,u.useState)(0),[V,G]=(0,u.useState)((0,m.mO)(S)),_=(0,c.A)(V),[K,j]=(0,u.useState)(0),k=[(0,n.cY)(({rects:ue})=>({alignmentAxis:ue.reference.width})),(0,o.UU)({fallbackAxisSideDirection:"start",crossAxis:!1,boundary:document.body}),(0,o.BN)()],{refs:Y,floatingStyles:ee}=(0,s.we)({open:B,placement:"bottom-start",onOpenChange:H,middleware:k,whileElementsMounted:o.ll,strategy:"fixed"}),re=(0,u.useRef)({showingSuggestions:B,suggestions:P,suggestionsIndex:w,linkUrl:V,onChange:O});re.current={showingSuggestions:B,suggestions:P,suggestionsIndex:w,linkUrl:V,onChange:O};const J=(0,u.useRef)(null);(0,u.useEffect)(()=>{j(x(J.current,w))},[w]);const ne=u.useCallback((ue,ie)=>{if(!re.current.showingSuggestions){if(ue.key==="="||ue.key==="$"||ue.keyCode===32&&ue.ctrlKey){const ge=new b;return Y.setReference(ge),H(!0)}return ie()}switch(ue.key){case"Backspace":case"Escape":return H(!1),N(0);case"Enter":return ue.preventDefault(),te(re.current.suggestions[re.current.suggestionsIndex]);case"ArrowDown":case"ArrowUp":ue.preventDefault();const ge=ue.key==="ArrowDown"?1:-1;return N(he=>C(he+ge,re.current.suggestions.length));default:return ie()}},[]);(0,u.useEffect)(()=>{_&&_.selection.isFocused&&!V.selection.isFocused&&re.current.onChange(i.A.serialize(V))},[V,_]);const q=u.useCallback(({value:ue})=>{G(ue)},[]),te=(ue,ie=U.current)=>{const he=oe()==="$";ue.origin!==f.$0.Template||ue.value===d.c.includeVars?ie.insertText(`${he?"":"$"}{${ue.value}}`):ie.insertText(`${he?"":"$"}{${ue.value}:queryparam}`),G(ie.value),H(!1),N(0),re.current.onChange(i.A.serialize(ie.value))},oe=()=>{const ue=document.getElementById("data-link-input");let ie="",ge,he;return window.getSelection&&(ge=window.getSelection(),ge&&ge.rangeCount>0&&(he=ge.getRangeAt(0).cloneRange(),he.collapse(!0),he.setStart(ue,0),ie=he.toString().slice(-1))),ie};return u.createElement("div",{className:R.wrapperOverrides},u.createElement("div",{className:"slate-query-field__wrapper"},u.createElement("div",{id:"data-link-input",className:"slate-query-field"},B&&u.createElement(E.ZL,null,u.createElement("div",{ref:Y.setFloating,style:ee},u.createElement(a.A,{scrollTop:K,autoHeightMax:"300px",setScrollTop:({scrollTop:ue})=>j(ue)},u.createElement(D.k,{activeRef:J,suggestions:re.current.suggestions,onSuggestionSelect:te,onClose:()=>H(!1),activeIndex:w})))),u.createElement(l.KE,{schema:m.yx,ref:U,placeholder:L,value:re.current.linkUrl,onChange:q,onKeyDown:(ue,ie,ge)=>ne(ue,ge),plugins:M,className:(0,t.cx)(R.editor,R.input,(0,t.css)({padding:"3px 8px"}))}))))});I.displayName="DataLinkInput";function x(S,O){return(S?.clientHeight??0)*O}},43538:(Q,A,e)=>{"use strict";e.d(A,{k:()=>i});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(37151),g=e(40845),u=e(33552);const c=f=>({list:(0,t.css)({borderBottom:`1px solid ${f.colors.border.weak}`,"&:last-child":{border:"none"}}),wrapper:(0,t.css)({background:f.colors.background.primary,width:"250px"}),item:(0,t.css)({background:"none",padding:"2px 8px",userSelect:"none",color:f.colors.text.primary,cursor:"pointer","&:hover":{background:f.colors.action.hover}}),label:(0,t.css)({color:f.colors.text.secondary}),activeItem:(0,t.css)({background:f.colors.background.secondary,"&:hover":{background:f.colors.background.secondary}}),itemValue:(0,t.css)({fontFamily:f.typography.fontFamilyMonospace,fontSize:f.typography.size.sm})}),i=({suggestions:f,...d})=>{const h=(0,s.useRef)(null);(0,r.A)(h,()=>{d.onClose&&d.onClose()});const p=(0,s.useMemo)(()=>(0,n.groupBy)(f,a=>a.origin),[f]),m=(0,g.of)(c);return s.createElement("div",{role:"menu",ref:h,className:m.wrapper},Object.keys(p).map((a,v)=>{const E=v===0?0:Object.keys(p).reduce((D,b,C)=>C>=v?D:D+p[b].length,0);return s.createElement(l,{...d,suggestions:p[a],label:`${(0,n.capitalize)(a)}`,activeIndex:d.activeIndex,activeIndexOffset:E,key:a})}))};i.displayName="DataLinkSuggestions";const l=s.memo(({activeIndex:f,activeIndexOffset:d,label:h,onClose:p,onSuggestionSelect:m,suggestions:a,activeRef:v})=>{const E=(0,g.of)(c);return s.createElement(s.Fragment,null,s.createElement(u.B,{className:E.list,items:a,renderItem:(D,b)=>{const C=b+d===f;return s.createElement("div",{role:"menuitem",tabIndex:0,className:(0,t.cx)(E.item,C&&E.activeItem),ref:C?v:void 0,onClick:()=>{m(D)},title:D.documentation},s.createElement("span",{className:E.itemValue},s.createElement("span",{className:E.label},h)," ",D.label))}}))});l.displayName="DataLinkSuggestionsList"},59796:(Q,A,e)=>{"use strict";e.d(A,{e:()=>c});var t=e(32196),n=e(96540),o=e(13544),s=e(14555),r=e(51686),g=e(59093),u=e(64539);const c=({children:i,links:l,style:f})=>{const d=[{items:(0,s.J)(l),label:"Data links"}],h=d[0].items.length,p=()=>d.map((a,v)=>n.createElement(g.r,{key:`${a.label}${v}`,label:a.label},(a.items||[]).map((E,D)=>n.createElement(u.D,{key:`${a.label}-${v}-${D}}`,url:E.url,label:E.label,target:E.target,icon:E.icon,active:E.active,onClick:E.onClick})))),m=(0,t.css)({cursor:"context-menu"});if(h>1)return n.createElement(r.n,{renderMenuItems:p},({openMenu:a})=>i({openMenu:a,targetClassName:m}));{const a=l()[0];return n.createElement("a",{href:a.href,onClick:a.onClick,target:a.target,title:a.title,style:{...f,overflow:"hidden",display:"flex"},"data-testid":o.Tp.components.DataLinksContextMenu.singleLink},i({}))}}},64919:(Q,A,e)=>{"use strict";e.d(A,{e:()=>D});var t=e(32196),n=e(2543),o=e(96540),s=e(40845),r=e(55852),g=e(37390),u=e(14555),c=e(88575),i=e(10354),l=e(15292),f=e(64078);const d=C=>({listItem:(0,t.css)({marginBottom:C.spacing()}),infoText:(0,t.css)({paddingBottom:C.spacing(2),marginLeft:"66px",color:C.colors.text.secondary})}),h=o.memo(({index:C,value:y,onChange:M,suggestions:T,isLast:I})=>{const x=(0,s.of)(d),S=(L,U)=>{M(C,{...y,url:L},U)},O=L=>{M(C,{...y,title:L.target.value})},P=()=>{M(C,{...y,targetBlank:!y.targetBlank})};return o.createElement("div",{className:x.listItem},o.createElement(c.D,{label:"Title"},o.createElement(i.p,{value:y.title,onChange:O,placeholder:"Show details"})),o.createElement(c.D,{label:"URL",invalid:(0,u.F)(y.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."},o.createElement(f.l,{value:y.url,onChange:S,suggestions:T})),o.createElement(c.D,{label:"Open in new tab"},o.createElement(l.d,{value:y.targetBlank||!1,onChange:P})),I&&o.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."))});h.displayName="DataLinkEditor";const p=({link:C,index:y,getSuggestions:M,onSave:T,onCancel:I})=>{const[x,S]=(0,o.useState)(C);return o.createElement(o.Fragment,null,o.createElement(h,{value:x,index:y,isLast:!1,suggestions:M(),onChange:(O,P)=>{S(P)}}),o.createElement(g.a.ButtonRow,null,o.createElement(r.$n,{variant:"secondary",onClick:()=>I(y),fill:"outline"},"Cancel"),o.createElement(r.$n,{onClick:()=>{T(y,x)}},"Save")))};var m=e(72093),a=e(29158);const v=({link:C,onEdit:y,onRemove:M})=>{const T=(0,s.of)(E),{title:I="",url:x=""}=C,S=I.trim()!=="",O=x.trim()!=="",P=(0,u.F)(x);return o.createElement("div",{className:T.wrapper},o.createElement("div",{className:T.titleWrapper},o.createElement("div",{className:(0,t.cx)(T.url,!O&&T.notConfigured,P&&T.errored)},S?I:"Data link title not provided"),o.createElement("div",{className:T.actionButtons},o.createElement(a.K,{name:"pen",onClick:y,tooltip:"Edit data link title"}),o.createElement(a.K,{name:"times",onClick:M,tooltip:"Remove data link title"}))),o.createElement("div",{className:(0,t.cx)(T.url,!O&&T.notConfigured,P&&T.errored),title:x},O?x:"Data link url not provided"),P&&o.createElement(m.P,null,"Explore data link may not work in the future. Please edit."))},E=C=>({wrapper:(0,t.css)({marginBottom:C.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:C.spacing(1),display:"flex"}),errored:(0,t.css)({color:C.colors.error.text,fontStyle:"italic"}),notConfigured:(0,t.css)({fontStyle:"italic"}),title:(0,t.css)({color:C.colors.text.primary,fontSize:C.typography.size.sm,fontWeight:C.typography.fontWeightMedium}),url:(0,t.css)({color:C.colors.text.secondary,fontSize:C.typography.size.sm,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"90%"})}),D=({links:C,onChange:y,getSuggestions:M,data:T})=>{const[I,x]=(0,o.useState)(null),[S,O]=(0,o.useState)(!1),P=(0,s.of)(b),L=C??[],U=I!==null,R=(N,V)=>{if(S)if(V.title.trim()===""&&V.url.trim()===""){O(!1),x(null);return}else x(null),O(!1);const G=(0,n.cloneDeep)(L);G[N]=V,y(G),x(null)},B=()=>{let N=(0,n.cloneDeep)(L);x(N.length),O(!0)},H=N=>{S&&O(!1),x(null)},w=N=>{const V=(0,n.cloneDeep)(L);V.splice(N,1),y(V)};return o.createElement(o.Fragment,null,L.length>0&&o.createElement("div",{className:P.wrapper},L.map((N,V)=>o.createElement(v,{key:`${N.title}/${V}`,index:V,link:N,onChange:R,onEdit:()=>x(V),onRemove:()=>w(V),data:T}))),U&&I!==null&&o.createElement(g.a,{title:"Edit link",isOpen:!0,closeOnBackdropClick:!1,onDismiss:()=>{H(I)}},o.createElement(p,{index:I,link:S?{title:"",url:""}:L[I],data:T,onSave:R,onCancel:H,getSuggestions:M})),o.createElement(r.$n,{size:"sm",icon:"plus",onClick:B,variant:"secondary"},"Add link"))},b=C=>({wrapper:(0,t.css)({marginBottom:C.spacing(2)})})},79961:(Q,A,e)=>{"use strict";e.d(A,{n:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(14578),r=e(14689);function g({links:c}){const i=(0,o.of)(u);if(c.length===1)return n.createElement(r.R,{link:c[0]});const l=c.filter(d=>d.target==="_blank"),f=c.filter(d=>d.target==="_self");return n.createElement(n.Fragment,null,f.map((d,h)=>n.createElement(r.R,{key:h,link:d})),n.createElement("div",{className:i.wrapper},n.createElement("p",{className:i.externalLinksHeading},"External links"),l.map((d,h)=>n.createElement("a",{key:h,href:d.href,target:d.target,className:i.externalLink},n.createElement(s.I,{name:"external-link-alt"}),d.title))))}const u=c=>({wrapper:(0,t.css)({flexBasis:"150px",width:"100px",marginTop:c.spacing(1)}),externalLinksHeading:(0,t.css)({color:c.colors.text.secondary,fontWeight:c.typography.fontWeightRegular,fontSize:c.typography.size.sm,margin:0}),externalLink:(0,t.css)({color:c.colors.text.link,fontWeight:c.typography.fontWeightRegular,display:"block",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis","&:hover":{textDecoration:"underline"},div:{marginRight:c.spacing(1)}})})},19849:(Q,A,e)=>{"use strict";e.d(A,{i:()=>s});var t=e(96540),n=e(15292),o=e(14186);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(o.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.K,{value:r.jsonData.manageAlerts!==!1,onChange:u=>g({...r,jsonData:{...r.jsonData,manageAlerts:u.currentTarget.checked}})}))))))}},28623:(Q,A,e)=>{"use strict";e.d(A,{K:()=>u});var t=e(96540),n=e(55852),o=e(14186),s=e(39268),r=e(10354),g=e(21744);const u=({hasCert:c,label:i,onChange:l,onClick:f,placeholder:d})=>t.createElement(s.C,null,t.createElement(o.I,{label:i,labelWidth:14,disabled:c},c?t.createElement(r.p,{type:"text",value:"configured",width:24}):t.createElement(g.f,{rows:7,onChange:l,placeholder:d,required:!0})),c&&t.createElement(n.$n,{variant:"secondary",onClick:f,style:{marginLeft:4}},"Reset"))},11184:(Q,A,e)=>{"use strict";e.d(A,{P:()=>d});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(40845),g=e(55852),u=e(90090),c=e(14578),i=e(56286);const l=()=>({layout:(0,t.css)({display:"flex",alignItems:"center",marginBottom:"4px","> *":{marginLeft:"4px",marginBottom:0,height:"100%","&:first-child, &:last-child":{marginLeft:0}}})}),f=({header:p,onBlur:m,onChange:a,onRemove:v,onReset:E})=>{const D=(0,r.of)(l);return s.createElement("div",{className:D.layout},s.createElement(u.z,{label:"Header",name:"name",placeholder:"X-Custom-Header",labelWidth:5,value:p.name||"",onChange:b=>a({...p,name:b.target.value}),onBlur:m}),s.createElement(i.L,{label:"Value","aria-label":"Value",name:"value",isConfigured:p.configured,value:p.value,labelWidth:5,inputWidth:p.configured?11:12,placeholder:"Header Value",onReset:()=>E(p.id),onChange:b=>a({...p,value:b.target.value}),onBlur:m}),s.createElement(g.$n,{type:"button","aria-label":"Remove header",variant:"secondary",size:"xs",onClick:b=>v(p.id)},s.createElement(c.I,{name:"trash-alt"})))};f.displayName="CustomHeaderRow";class d extends s.PureComponent{constructor(m){super(m),this.state={headers:[]},this.updateSettings=()=>{const{headers:D}=this.state,b=Object.fromEntries(Object.entries(this.props.dataSourceConfig.jsonData).filter(([y,M])=>!y.startsWith("httpHeaderName"))),C=Object.fromEntries(Object.entries(this.props.dataSourceConfig.secureJsonData||{}).filter(([y,M])=>!y.startsWith("httpHeaderValue")));for(const[y,M]of D.entries())b[`httpHeaderName${y+1}`]=M.name,M.configured||(C[`httpHeaderValue${y+1}`]=M.value);this.props.onChange({...this.props.dataSourceConfig,jsonData:b,secureJsonData:C})},this.onHeaderAdd=()=>{this.setState(D=>({headers:[...D.headers,{id:(0,n.uniqueId)(),name:"",value:"",configured:!1}]}))},this.onHeaderChange=(D,b)=>{this.setState(({headers:C})=>({headers:C.map((y,M)=>D!==M?y:{...b})}))},this.onHeaderReset=D=>{this.setState(({headers:b})=>({headers:b.map((C,y)=>C.id!==D?C:{...C,value:"",configured:!1})}))},this.onHeaderRemove=D=>{this.setState(({headers:b})=>({headers:b.filter(C=>C.id!==D)}),this.updateSettings)};const{jsonData:a,secureJsonData:v,secureJsonFields:E}=this.props.dataSourceConfig;this.state={headers:Object.keys(a).sort().filter(D=>D.startsWith("httpHeaderName")).map((D,b)=>({id:(0,n.uniqueId)(),name:a[D],value:v!==void 0?v[D]:"",configured:E&&E[`httpHeaderValue${b+1}`]||!1}))}}render(){const{headers:m}=this.state,{dataSourceConfig:a}=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,m.map((v,E)=>s.createElement(f,{key:v.id,header:v,onChange:D=>{this.onHeaderChange(E,D)},onBlur:this.updateSettings,onRemove:this.onHeaderRemove,onReset:this.onHeaderReset}))),!a.readOnly&&s.createElement("div",{className:"gf-form"},s.createElement(g.$n,{variant:"secondary",icon:"plus",type:"button",onClick:v=>{this.onHeaderAdd()}},"Add header")))}}var h=null},91409:(Q,A,e)=>{"use strict";e.d(A,{t:()=>T});var t=e(32196),n=e(96540),o=e(13544),s=e(40845),r=e(90090),g=e(38894),u=e(14186),c=e(91634),i=e(14578),l=e(88323),f=e(15292),d=e(79924),h=e(56286);const p=({dataSourceConfig:I,onChange:x})=>{const S=I.secureJsonData?I.secureJsonData.basicAuthPassword:"",O=()=>{x({...I,secureJsonData:{...I.secureJsonData,basicAuthPassword:""},secureJsonFields:{...I.secureJsonFields,basicAuthPassword:!1}})},P=L=>{x({...I,secureJsonData:{...I.secureJsonData,basicAuthPassword:L.currentTarget.value}})};return n.createElement(n.Fragment,null,n.createElement(u.I,{disabled:I.readOnly},n.createElement(r.z,{label:"User",labelWidth:10,inputWidth:18,placeholder:"user",value:I.basicAuthUser,onChange:L=>x({...I,basicAuthUser:L.currentTarget.value})})),n.createElement(u.I,{disabled:I.readOnly},n.createElement(h.L,{isConfigured:!!(I.secureJsonFields&&I.secureJsonFields.basicAuthPassword),value:S||"",inputWidth:18,labelWidth:10,onReset:O,onChange:P})))};var m=e(11184);const a=26,v=({dataSourceConfig:I,onChange:x,showForwardOAuthIdentityOption:S=!0})=>n.createElement(n.Fragment,null,n.createElement("div",{className:"gf-form-inline"},n.createElement(u.I,{label:"TLS Client Auth",labelWidth:a,disabled:I.readOnly},n.createElement(f.K,{id:"http-settings-tls-client-auth",value:I.jsonData.tlsAuth||!1,onChange:O=>x({...I.jsonData,tlsAuth:O.currentTarget.checked})})),n.createElement(u.I,{label:"With CA Cert",tooltip:"Needed for verifying self-signed TLS Certs",labelWidth:a,disabled:I.readOnly},n.createElement(f.K,{id:"http-settings-ca-cert",value:I.jsonData.tlsAuthWithCACert||!1,onChange:O=>x({...I.jsonData,tlsAuthWithCACert:O.currentTarget.checked})}))),n.createElement("div",{className:"gf-form-inline"},n.createElement(u.I,{label:"Skip TLS Verify",labelWidth:a,disabled:I.readOnly},n.createElement(f.K,{id:"http-settings-skip-tls-verify",value:I.jsonData.tlsSkipVerify||!1,onChange:O=>x({...I.jsonData,tlsSkipVerify:O.currentTarget.checked})}))),S&&n.createElement("div",{className:"gf-form-inline"},n.createElement(u.I,{label:"Forward OAuth Identity",tooltip:"Forward the user's upstream OAuth identity to the data source (Their access token gets passed along).",labelWidth:a,disabled:I.readOnly},n.createElement(f.K,{id:"http-settings-forward-oauth",value:I.jsonData.oauthPassThru||!1,onChange:O=>x({...I.jsonData,oauthPassThru:O.currentTarget.checked})}))));var E=e(17081),D=e(95180);const b=[{label:"Server (default)",value:"proxy"},{label:"Browser",value:"direct"}],C={label:"Server (default)",value:"proxy"},y=()=>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.")),M=26,T=I=>{const{defaultUrl:x,dataSourceConfig:S,onChange:O,showAccessOptions:P,sigV4AuthToggleEnabled:L,showForwardOAuthIdentityOption:U,azureAuthSettings:R,renderSigV4Editor:B,secureSocksDSProxyEnabled:H,urlLabel:w,urlDocs:N}=I,[V,G]=(0,n.useState)(!1),[_,K]=(0,n.useState)(!1),j=(0,s.$j)();let k;const Y=(0,n.useCallback)(oe=>{const ue=R?.azureAuthSupported&&R.getAzureAuthEnabled(S)||!1;if(K(ue),ue){const ie=S.jsonData.oauthPassThru!==void 0?S.jsonData.oauthPassThru:!1;oe={...oe,jsonData:{...S.jsonData,oauthPassThru:ue?!1:ie}}}O({...S,...oe})},[R,S,O]);switch(S.access){case"direct":k=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.",N);break;case"proxy":k=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.",N);break;default:k=n.createElement(n.Fragment,null,"Specify a complete HTTP URL (for example http://your_server:8080) ",N)}const ee=n.createElement(l.l6,{"aria-label":"Access",className:"width-20 gf-form-input",options:b,value:b.filter(oe=>oe.value===S.access)[0]||C,onChange:oe=>Y({access:oe.value}),disabled:S.readOnly}),re=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/.test(S.url),J=(0,t.css)({boxShadow:`inset 0 0px 5px ${j.v1.palette.red}`}),ne=(0,t.cx)({["width-20"]:!0,[J]:!re}),q=(0,n.useId)(),te=n.createElement(c.p,{id:q,className:ne,placeholder:x,value:S.url,"data-testid":o.Tp.components.DataSource.DataSourceHttpSettings.urlInput,onChange:oe=>Y({url:oe.currentTarget.value}),disabled:S.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.z,{interactive:!!N,label:w??"URL",labelWidth:13,tooltip:k,inputEl:te})),P&&n.createElement(n.Fragment,null,n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(r.z,{label:"Access",labelWidth:13,inputWidth:20,inputEl:ee})),n.createElement("div",{className:"gf-form"},n.createElement("button",{type:"button",className:"gf-form-label query-keyword pointer",onClick:()=>G(oe=>!oe)},"Help\xA0",n.createElement(i.I,{name:V?"angle-down":"angle-right",style:{marginBottom:0}})))),V&&n.createElement(y,null)),S.access==="proxy"&&n.createElement("div",{className:"gf-form-group"},n.createElement("div",{className:"gf-form"},n.createElement(g.I,{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(d.u,{tags:S.jsonData.keepCookies,width:40,onChange:oe=>Y({jsonData:{...S.jsonData,keepCookies:oe}}),disabled:S.readOnly})),n.createElement("div",{className:"gf-form"},n.createElement(r.z,{label:"Timeout",type:"number",labelWidth:13,inputWidth:20,tooltip:"HTTP request timeout in seconds",placeholder:"Timeout in seconds","aria-label":"Timeout in seconds",value:S.jsonData.timeout,onChange:oe=>{Y({jsonData:{...S.jsonData,timeout:parseInt(oe.currentTarget.value,10)}})},disabled:S.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(u.I,{label:"Basic auth",labelWidth:M,disabled:S.readOnly},n.createElement(f.K,{id:"http-settings-basic-auth",value:S.basicAuth,onChange:oe=>{Y({basicAuth:oe.currentTarget.checked})}})),n.createElement(u.I,{label:"With Credentials",tooltip:"Whether credentials such as cookies or auth headers should be sent with cross-site requests.",labelWidth:M,disabled:S.readOnly},n.createElement(f.K,{id:"http-settings-with-credentials",value:S.withCredentials,onChange:oe=>{Y({withCredentials:oe.currentTarget.checked})}}))),R?.azureAuthSupported&&n.createElement("div",{className:"gf-form-inline"},n.createElement(u.I,{label:"Azure Authentication",tooltip:"Use Azure authentication for Azure endpoint.",labelWidth:M,disabled:S.readOnly},n.createElement(f.K,{id:"http-settings-azure-auth",value:_,onChange:oe=>{Y(R.setAzureAuthEnabled(S,oe.currentTarget.checked))}}))),L&&n.createElement("div",{className:"gf-form-inline"},n.createElement(u.I,{label:"SigV4 auth",labelWidth:M,disabled:S.readOnly},n.createElement(f.K,{id:"http-settings-sigv4-auth",value:S.jsonData.sigV4Auth||!1,onChange:oe=>{Y({jsonData:{...S.jsonData,sigV4Auth:oe.currentTarget.checked}})}}))),S.access==="proxy"&&n.createElement(v,{dataSourceConfig:S,onChange:oe=>Y({jsonData:oe}),showForwardOAuthIdentityOption:_?!1:U})),S.basicAuth&&n.createElement(n.Fragment,null,n.createElement("h6",null,"Basic Auth Details"),n.createElement("div",{className:"gf-form-group"},n.createElement(p,{...I}))),R?.azureAuthSupported&&_&&R.azureSettingsUI&&n.createElement(R.azureSettingsUI,{dataSourceConfig:S,onChange:O}),S.jsonData.sigV4Auth&&L&&B,(S.jsonData.tlsAuth||S.jsonData.tlsAuthWithCACert)&&n.createElement(D.j,{dataSourceConfig:S,onChange:O}),S.access==="proxy"&&n.createElement(m.P,{dataSourceConfig:S,onChange:O})),H&&n.createElement(E.Y,{options:S,onOptionsChange:O}))}},17081:(Q,A,e)=>{"use strict";e.d(A,{Y:()=>s});var t=e(96540),n=e(15292),o=e(14186);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(o.I,{labelWidth:26,label:"Enabled",tooltip:"Connect to this datasource via the secure socks proxy."},t.createElement(n.K,{value:r.jsonData.enableSecureSocksProxy??!1,onChange:u=>g({...r,jsonData:{...r.jsonData,enableSecureSocksProxy:u.currentTarget.checked}})}))))))}},95180:(Q,A,e)=>{"use strict";e.d(A,{j:()=>u});var t=e(32196),n=e(96540),o=e(90090),s=e(14578),r=e(56034),g=e(28623);const u=({dataSourceConfig:c,onChange:i})=>{const l=c.secureJsonFields&&c.secureJsonFields.tlsCACert,f=c.secureJsonFields&&c.secureJsonFields.tlsClientCert,d=c.secureJsonFields&&c.secureJsonFields.tlsClientKey,h=c.jsonData&&c.jsonData.serverName,p=v=>E=>{E.preventDefault();const D={...c.secureJsonFields};D[v]=!1,i({...c,secureJsonFields:D})},m=v=>E=>{const D={...c.secureJsonData};D[v]=E.currentTarget.value,i({...c,secureJsonData:D})},a=v=>{const E={...c.jsonData,serverName:v.currentTarget.value};i({...c,jsonData:E})};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.m,{placement:"right-end",content:"TLS/SSL Certs are encrypted and stored in the Grafana database.",theme:"info"},n.createElement(s.I,{name:"info-circle",size:"xs",style:{marginLeft:"10px"}}))),n.createElement("div",null,c.jsonData.tlsAuthWithCACert&&n.createElement(g.K,{hasCert:!!l,onChange:m("tlsCACert"),placeholder:"Begins with -----BEGIN CERTIFICATE-----",label:"CA Cert",onClick:p("tlsCACert")}),c.jsonData.tlsAuth&&n.createElement(n.Fragment,null,n.createElement("div",{className:"gf-form"},n.createElement(o.z,{label:"ServerName",labelWidth:7,inputWidth:30,placeholder:"domain.example.com",value:h&&c.jsonData.serverName,onChange:a})),n.createElement(g.K,{hasCert:!!f,label:"Client Cert",onChange:m("tlsClientCert"),placeholder:"Begins with -----BEGIN CERTIFICATE-----",onClick:p("tlsClientCert")}),n.createElement(g.K,{hasCert:!!d,label:"Client Key",placeholder:"Begins with -----BEGIN RSA PRIVATE KEY-----",onChange:m("tlsClientKey"),onClick:p("tlsClientKey")}))))}},56181:(Q,A,e)=>{"use strict";e.d(A,{l:()=>c});var t=e(32196),n=e(96540),o=e(29426),s=e(40845),r=e(8866),g=e(14578),u=e(72265);const c=(0,n.memo)(f=>{const d=(0,s.of)(l),{isOpen:h,onClose:p}=f;return h?n.createElement(r.N,{useCapture:!0,includeButtonPress:!1,onClick:p},n.createElement("div",{className:d.modal,"data-testid":"date-picker"},n.createElement(i,{...f}))):null});c.displayName="DatePicker";const i=(0,n.memo)(({value:f,minDate:d,maxDate:h,onChange:p})=>{const m=(0,s.of)(u.h2);return n.createElement(o.Ay,{className:m.body,tileClassName:m.title,value:f||new Date,minDate:d,maxDate:h,nextLabel:n.createElement(g.I,{name:"angle-right"}),prevLabel:n.createElement(g.I,{name:"angle-left"}),onChange:a=>{a&&!Array.isArray(a)&&p(a)},locale:"en"})});i.displayName="Body";const l=f=>({modal:(0,t.css)({zIndex:f.zIndex.modal,position:"absolute",boxShadow:f.shadows.z3,backgroundColor:f.colors.background.primary,border:`1px solid ${f.colors.border.weak}`,borderTopLeftRadius:f.shape.radius.default,borderBottomLeftRadius:f.shape.radius.default,"button:disabled":{color:f.colors.text.disabled}})})},98239:(Q,A,e)=>{"use strict";e.d(A,{l:()=>c});var t=e(32196),n=e(96540),o=e(47232),s=e(40845),r=e(10354),g=e(56181);const u=l=>(0,o.KQ)(l).format("L"),c=({value:l,minDate:f,maxDate:d,onChange:h,closeOnSelect:p,placeholder:m="Date",...a})=>{const[v,E]=n.useState(!1),D=(0,s.of)(i);return n.createElement("div",{className:D.container},n.createElement(r.p,{type:"text",autoComplete:"off",placeholder:m,value:l&&u(l),onClick:()=>E(!0),onChange:b=>{b.target.value===""&&h("")},className:D.input,...a}),n.createElement(g.l,{isOpen:v,value:l&&typeof l!="string"?l:(0,o.KQ)().toDate(),minDate:f,maxDate:d,onChange:b=>{h(b),p&&E(!1)},onClose:()=>E(!1)}))},i=()=>({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"}})})},63383:(Q,A,e)=>{"use strict";e.d(A,{K:()=>M});var t=e(32196),n=e(80279),o=e(7887),s=e(82148),r=e(96540),g=e(29426),u=e(39522),c=e(49045),i=e(72724),l=e(47232),f=e(13390),d=e(40845),h=e(55852),p=e(14186),m=e(14578),a=e(10354),v=e(66864),E=e(88448),D=e(17464),b=e(66070),C=e(72265),y=e(47619);const M=({date:S,maxDate:O,minDate:P,label:L,onChange:U,disabledHours:R,disabledMinutes:B,disabledSeconds:H,showSeconds:w=!0})=>{const[N,V]=(0,r.useState)(!1),G=(0,r.useRef)(null),{overlayProps:_,underlayProps:K}=(0,s.e)({onClose:()=>V(!1),isDismissable:!0,isOpen:N,shouldCloseOnInteractOutside:ge=>{const he=document.getElementsByClassName(b.i)[0];return!(he&&he.contains(ge))}},G),{dialogProps:j}=(0,n.s)({},G),k=(0,d.$j)(),{modalBackdrop:Y}=(0,d.of)(E.o),ee=(0,c.A)(`(min-width: ${k.breakpoints.values.lg}px)`),re=(0,d.of)(x),[J,ne]=(0,r.useState)(),[q,te]=(0,r.useState)(),oe=(0,u.E)(J,q,{placement:"bottom-start"}),ue=(0,r.useCallback)(ge=>{V(!1),U(ge)},[U]),ie=(0,r.useCallback)(ge=>{ge.preventDefault(),V(!0)},[V]);return r.createElement("div",{"data-testid":"date-time-picker",style:{position:"relative"}},r.createElement(T,{date:S,onChange:U,isFullscreen:ee,onOpen:ie,label:L,ref:ne,showSeconds:w}),N?ee?r.createElement(D.ZL,null,r.createElement(o.n1,{contain:!0,autoFocus:!0,restoreFocus:!0},r.createElement("div",{ref:G,..._,...j},r.createElement(I,{date:S,onChange:ue,isFullscreen:!0,onClose:()=>V(!1),maxDate:O,minDate:P,ref:te,style:oe.styles.popper,showSeconds:w,disabledHours:R,disabledMinutes:B,disabledSeconds:H})))):r.createElement(D.ZL,null,r.createElement("div",{className:Y,...K}),r.createElement(o.n1,{contain:!0,autoFocus:!0,restoreFocus:!0},r.createElement("div",{ref:G,..._,...j},r.createElement("div",{className:re.modal},r.createElement(I,{date:S,maxDate:O,minDate:P,onChange:ue,isFullscreen:!1,onClose:()=>V(!1),showSeconds:w,disabledHours:R,disabledMinutes:B,disabledSeconds:H}))))):null)},T=r.forwardRef(({date:S,label:O,onChange:P,onOpen:L,showSeconds:U=!0},R)=>{const B=U?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD HH:mm",[H,w]=(0,r.useState)(()=>({value:S?(0,i.LE)(S):(0,i.LE)((0,l.KQ)()),invalid:!1}));(0,r.useEffect)(()=>{S&&w({invalid:!(0,y.f)((0,i.LE)(S,{format:B})),value:(0,l.Ar)(S)?(0,i.LE)(S,{format:B}):S})},[S,B]);const N=(0,r.useCallback)(_=>{const K=!(0,y.f)(_.currentTarget.value);w({value:_.currentTarget.value,invalid:K})},[]),V=(0,r.useCallback)(()=>{if(!H.invalid){const _=(0,l.KQ)(H.value);P(_)}},[H,P]),G=r.createElement(h.$n,{"aria-label":"Time picker",icon:"calendar-alt",variant:"secondary",onClick:L});return r.createElement(p.I,{label:O,invalid:!!(H.value&&H.invalid),className:(0,t.css)({marginBottom:0})},r.createElement(a.p,{onChange:N,addonAfter:G,value:H.value,onBlur:V,"data-testid":f.X.DateTimePicker.input,placeholder:"Select date/time",ref:R}))});T.displayName="DateTimeInput";const I=r.forwardRef(({date:S,onClose:O,onChange:P,isFullscreen:L,maxDate:U,minDate:R,style:B,showSeconds:H=!0,disabledHours:w,disabledMinutes:N,disabledSeconds:V},G)=>{const _=(0,d.of)(C.h2),K=(0,d.of)(x),[j,k]=(0,r.useState)(()=>S&&S.isValid()?S.toDate():new Date),Y=(0,r.useCallback)(re=>{re&&!Array.isArray(re)&&k(J=>(re.setHours(J.getHours()),re.setMinutes(J.getMinutes()),re.setSeconds(J.getSeconds()),re))},[]),ee=(0,r.useCallback)(re=>{k(re.toDate())},[]);return r.createElement("div",{className:(0,t.cx)(K.container,{[K.fullScreen]:L}),style:B,ref:G},r.createElement(g.Ay,{next2Label:null,prev2Label:null,value:j,nextLabel:r.createElement(m.I,{name:"angle-right"}),nextAriaLabel:"Next month",prevLabel:r.createElement(m.I,{name:"angle-left"}),prevAriaLabel:"Previous month",onChange:Y,locale:"en",className:_.body,tileClassName:_.title,maxDate:U,minDate:R}),r.createElement("div",{className:K.time},r.createElement(b.R,{showSeconds:H,onChange:ee,value:(0,l.KQ)(j),disabledHours:w,disabledMinutes:N,disabledSeconds:V})),r.createElement(v.Gy,null,r.createElement(h.$n,{type:"button",onClick:()=>P((0,l.KQ)(j))},"Apply"),r.createElement(h.$n,{variant:"secondary",type:"button",onClick:O},"Cancel")))});I.displayName="DateTimeCalendar";const x=S=>({container:(0,t.css)({padding:S.spacing(1),border:`1px ${S.colors.border.weak} solid`,borderRadius:S.shape.radius.default,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"})})},3759:(Q,A,e)=>{"use strict";e.d(A,{N:()=>b});var t=e(32196),n=e(80279),o=e(7887),s=e(82148),r=e(96540),g=e(39522),u=e(40845),c=e(76412),i=e(55852),l=e(40276),f=e(88575),d=e(14578),h=e(10354),p=e(56034),m=e(42617),a=e(65172),v=e(32432),E=e(28716);const D=v.o.filter(I=>(0,E.QU)(I.from));function b(I){const{timeRange:x,onChange:S}=I,[O,P]=(0,r.useState)(!1),L=(0,r.useCallback)(()=>P(!1),[]),U=(0,E.Bw)(x),[R,B]=(0,r.useState)({value:U.from,validation:(0,E.kB)(U.from)}),[H,w]=(0,r.useState)({value:U.to,validation:(0,E.kB)(U.to)}),N=(0,r.useRef)(null),{overlayProps:V,underlayProps:G}=(0,s.e)({onClose:()=>P(!1),isDismissable:!0,isOpen:O},N),{dialogProps:_}=(0,n.s)({},N),[K,j]=(0,r.useState)(null),[k,Y]=(0,r.useState)(null),ee=(0,g.E)(K,k,{placement:"auto-start"}),re=(0,u.of)(M(R.validation.errorMessage,H.validation.errorMessage)),J=te=>{const oe=(0,E.Tl)(te);oe&&(L(),B({...R,value:te.from}),w({...H,value:te.to}),S(oe))},ne=(0,r.useCallback)(te=>{te.stopPropagation(),te.preventDefault(),P(!O)},[O]),q=te=>{if(te.preventDefault(),!H.validation.isValid||!R.validation.isValid)return;const oe=(0,E.Tl)({from:R.value,to:H.value,display:""});oe&&(S(oe),P(!1))};return r.createElement("div",{className:re.container,ref:j},r.createElement("button",{className:re.pickerInput,type:"button",onClick:ne},r.createElement("span",{className:re.clockIcon},r.createElement(d.I,{name:"clock-nine"})),r.createElement("span",null,U.from," to ",U.to),r.createElement("span",{className:re.caretIcon},r.createElement(d.I,{name:O?"angle-up":"angle-down",size:"lg"}))),O&&r.createElement("div",null,r.createElement("div",{role:"presentation",className:re.backdrop,...G}),r.createElement(o.n1,{contain:!0,autoFocus:!0,restoreFocus:!0},r.createElement("div",{ref:N,...V,..._},r.createElement("div",{className:re.content,ref:Y,style:ee.styles.popper,...ee.attributes},r.createElement("div",{className:re.body},r.createElement(l.A,{className:re.leftSide,hideHorizontalTrack:!0},r.createElement(a.l,{title:(0,c.t)("time-picker.time-range.example-title","Example time ranges"),options:D,onChange:J,value:U})),r.createElement("div",{className:re.rightSide},r.createElement("div",{className:re.title},r.createElement(m.e,null,r.createElement(p.m,{content:r.createElement(C,null),placement:"bottom",theme:"info"},r.createElement("div",null,r.createElement(c.x,{i18nKey:"time-picker.time-range.specify"},"Specify time range ",r.createElement(d.I,{name:"info-circle"})))))),r.createElement(f.D,{label:"From",invalid:!R.validation.isValid,error:R.validation.errorMessage},r.createElement(h.p,{onClick:te=>te.stopPropagation(),onBlur:()=>B({...R,validation:(0,E.kB)(R.value)}),onChange:te=>B({...R,value:te.currentTarget.value}),value:R.value})),r.createElement(f.D,{label:"To",invalid:!H.validation.isValid,error:H.validation.errorMessage},r.createElement(h.p,{onClick:te=>te.stopPropagation(),onBlur:()=>w({...H,validation:(0,E.kB)(H.value)}),onChange:te=>w({...H,value:te.currentTarget.value}),value:H.value})),r.createElement(i.$n,{"aria-label":"TimePicker submit button",onClick:q},"Apply time range"))))))))}const C=()=>{const I=(0,u.of)(y);return r.createElement(r.Fragment,null,r.createElement("div",{className:I.supported},"Supported formats: ",r.createElement("code",{className:I.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:I.tooltip},"From: now-10m To: now"),r.createElement("div",{className:I.link},"For more information see"," ",r.createElement("a",{href:"https://grafana.com/docs/grafana/latest/dashboards/time-range-controls/"},"docs ",r.createElement(d.I,{name:"external-link-alt"})),"."))},y=I=>({supported:(0,t.css)({marginBottom:I.spacing(1)}),tooltip:(0,t.css)({margin:0}),link:(0,t.css)({marginTop:I.spacing(1)})}),M=(I,x)=>S=>{const O=(0,h.n)({theme:S,invalid:!1}),L=250+T(S,I)+T(S,x);return{backdrop:(0,t.css)({position:"fixed",zIndex:S.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:`${S.spacing.gridSize*S.components.height.md-2}px`})),caretIcon:(0,t.cx)(O.suffix,(0,t.css)({position:"relative",marginLeft:S.spacing(.5)})),clockIcon:(0,t.cx)(O.prefix,(0,t.css)({position:"relative",marginRight:S.spacing(.5)})),content:(0,t.css)({background:S.colors.background.primary,boxShadow:S.shadows.z3,position:"absolute",zIndex:S.zIndex.modal,width:"500px",top:"100%",borderRadius:S.shape.radius.default,border:`1px solid ${S.colors.border.weak}`,left:0,whiteSpace:"normal"}),body:(0,t.css)({display:"flex",height:`${L}px`}),description:(0,t.css)({color:S.colors.text.secondary,fontSize:S.typography.size.sm}),leftSide:(0,t.css)({width:"50% !important",borderRight:`1px solid ${S.colors.border.medium}`}),rightSide:(0,t.css)({width:"50%",padding:S.spacing(1)}),title:(0,t.css)({marginBottom:S.spacing(1)})}};function T(I,x){return x?x.length>34?I.spacing.gridSize*6.5:I.spacing.gridSize*4:0}},28716:(Q,A,e)=>{"use strict";e.d(A,{Bw:()=>o,QU:()=>r,Tl:()=>n,kB:()=>s});const t=/^now$|^now\-(\d{1,10})([wdhms])$/,n=i=>({from:g(i.from),to:g(i.to)}),o=i=>{const l=c(i.from),f=c(i.to);return{from:l,to:f,display:`${l} to ${f}`}},s=(i,l=Date.now())=>r(i)?g(i)>Math.ceil(l/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=i=>t.test(i),g=i=>{const l=t.exec(i);if(!l||l.length!==3)return 0;const[,f,d]=l,h=parseInt(f,10);return isNaN(h)?0:h*u[d]},u={w:604800,d:86400,h:3600,m:60,s:1},c=i=>i<=0?"now":i>=u.w&&i%u.w===0?`now-${i/u.w}w`:i>=u.d&&i%u.d===0?`now-${i/u.d}d`:i>=u.h&&i%u.h===0?`now-${i/u.h}h`:i>=u.m&&i%u.m===0?`now-${i/u.m}m`:`now-${i}s`},66070:(Q,A,e)=>{"use strict";e.d(A,{R:()=>l,i:()=>i});var t=e(32196),n=e(57389),o=e(96540),s=e(47232),r=e(40845),g=e(16797),u=e(87266),c=e(14578);const i="time-of-day-picker-panel",l=({minuteStep:h=1,showHour:p=!0,showSeconds:m=!1,onChange:a,value:v,size:E="auto",disabled:D,disabledHours:b,disabledMinutes:C,disabledSeconds:y})=>{const M=(0,r.of)(d);return o.createElement(n.A,{className:(0,t.cx)((0,u.lH)()[E],M.input),popupClassName:(0,t.cx)(M.picker,i),defaultValue:(0,s.AN)(),onChange:T=>{if((0,s.u8)(T))return a((0,s.KQ)(T))},allowEmpty:!1,showSecond:m,value:(0,s.AN)(v),showHour:p,minuteStep:h,inputIcon:o.createElement(f,{wrapperStyle:M.caretWrapper}),disabled:D,disabledHours:b,disabledMinutes:C,disabledSeconds:y})},f=({wrapperStyle:h=""})=>o.createElement("div",{className:h},o.createElement(c.I,{name:"angle-down"})),d=h=>{const p=h.components.input.background,m=h.v1.palette.black,a=h.colors.background.secondary,v=h.shape.radius.default,E=h.components.input.borderColor;return{caretWrapper:(0,t.css)({position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)",display:"inline-block",textAlign:"right",color:h.colors.text.secondary}),picker:(0,t.css)({".rc-time-picker-panel-select":{fontSize:"14px",backgroundColor:p,borderColor:E,li:{outlineWidth:"2px","&.rc-time-picker-panel-select-option-selected":{backgroundColor:"inherit",border:`1px solid ${h.v1.palette.orange}`,borderRadius:v},"&:hover":{background:a},"&.rc-time-picker-panel-select-option-disabled":{color:h.colors.action.disabledText}}},".rc-time-picker-panel-inner":{boxShadow:`0px 4px 4px ${m}`,backgroundColor:p,borderColor:E,borderRadius:v,marginTop:"3px",".rc-time-picker-panel-input-wrap":{marginRight:"2px","&, .rc-time-picker-panel-input":{backgroundColor:p,paddingTop:"2px"}},".rc-time-picker-panel-combobox":{display:"flex"}}}),input:(0,t.css)({".rc-time-picker-input":{backgroundColor:p,borderRadius:v,borderColor:E,height:h.spacing(4),"&:focus":(0,g.getFocusStyles)(h),"&:disabled":{backgroundColor:h.colors.action.disabledBackground,color:h.colors.action.disabledText,border:`1px solid ${h.colors.action.disabledBackground}`,"&:focus":{boxShadow:"none"}}}})}}},54230:(Q,A,e)=>{"use strict";e.d(A,{b:()=>m});var t=e(32196),n=e(96540),o=e(47232),s=e(43127),r=e(13544),g=e(40845),u=e(8866),c=e(14578),i=e(10354),l=e(85068),f=e(3799),d=e(32432),h=e(47619);const p=()=>{},m=({value:v,onChange:E,onChangeTimeZone:D=p,clearable:b,hideTimeZone:C=!0,timeZone:y="browser",placeholder:M="Select time range",isReversed:T=!0,hideQuickRanges:I=!1,disabled:x=!1,showIcon:S=!1})=>{const[O,P]=(0,n.useState)(!1),L=(0,g.of)(a,x),U=w=>{w.stopPropagation(),w.preventDefault(),!x&&P(!O)},R=()=>{P(!1)},B=w=>{R(),E(w)},H=w=>{w.stopPropagation();const N=(0,o.KQ)(null),V=(0,o.KQ)(null);E({from:N,to:V,raw:{from:N,to:V}})};return n.createElement("div",{className:L.container},n.createElement("button",{type:"button",className:L.pickerInput,"data-testid":r.Tp.components.TimePicker.openButton,onClick:U},S&&n.createElement(c.I,{name:"clock-nine",size:"sm",className:L.icon}),n.createElement(f.f,{value:v,timeZone:y,placeholder:M}),!x&&n.createElement("span",{className:L.caretIcon},(0,h.X)(v)&&b&&n.createElement(c.I,{className:L.clearIcon,name:"times",size:"lg",onClick:H}),n.createElement(c.I,{name:O?"angle-up":"angle-down",size:"lg"}))),O&&n.createElement(u.N,{includeButtonPress:!1,onClick:R},n.createElement(l.r,{timeZone:y,value:(0,h.X)(v)?v:(0,s.E2)(),onChange:B,quickOptions:d.o,onChangeTimeZone:D,className:L.content,hideTimeZone:C,isReversed:T,hideQuickRanges:I})))},a=(v,E=!1)=>{const D=(0,i.n)({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)(D.input,E&&D.inputDisabled,D.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)(D.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)})}}},15666:(Q,A,e)=>{"use strict";e.d(A,{$6:()=>D,_8:()=>y,xS:()=>C});var t=e(32196),n=e(80279),o=e(7887),s=e(82148),r=e(96540),g=e(65879),u=e(72724),c=e(91410),i=e(85858),l=e(13544),f=e(40845),d=e(76412),h=e(19727),p=e(88448),m=e(27746),a=e(56034),v=e(85068),E=e(32432);function D(x){const[S,O]=(0,r.useState)(!1),{value:P,onMoveBackward:L,onMoveForward:U,onZoom:R,onError:B,timeZone:H,fiscalYearStartMonth:w,timeSyncButton:N,isSynced:V,history:G,onChangeTimeZone:_,onChangeFiscalYearStartMonth:K,hideQuickRanges:j,widthOverride:k,isOnCanvas:Y,onToolbarTimePickerClick:ee}=x,re=Re=>{x.onChange(Re),O(!1)};(0,r.useEffect)(()=>{S&&ee&&ee()},[S,ee]);const J=()=>{O(Re=>!Re)},ne=()=>{O(!1)},q=(0,r.createRef)(),te=(0,r.createRef)(),{overlayProps:oe,underlayProps:ue}=(0,s.e)({onClose:ne,isDismissable:!0,isOpen:S,shouldCloseOnInteractOutside:Re=>!te.current?.contains(Re)},q),{dialogProps:ie}=(0,n.s)({},q),ge=(0,f.of)(T),{modalBackdrop:he}=(0,f.of)(p.o),De=!g.isRelativeTime(P.raw.from)||!g.isRelativeTime(P.raw.to),pe=V?"active":Y?"canvas":"default",Te=P?.to?.isBefore(P.from)?"exclamation-triangle":"clock-nine",Ee=M(P,H);return r.createElement(h.e,{className:ge.container},De&&r.createElement(m.I,{"aria-label":(0,d.t)("time-picker.range-picker.backwards-time-aria-label","Move time range backwards"),variant:pe,onClick:L,icon:"angle-left",narrow:!0}),r.createElement(a.m,{ref:te,content:r.createElement(C,{timeRange:P,timeZone:H}),placement:"bottom",interactive:!0},r.createElement(m.I,{"data-testid":l.Tp.components.TimePicker.openButton,"aria-label":(0,d.t)("time-picker.range-picker.current-time-selected","Time range selected: {{currentTimeRange}}",{currentTimeRange:Ee}),"aria-controls":"TimePickerContent",onClick:J,icon:Te,isOpen:S,variant:pe},r.createElement(y,{...x}))),S&&r.createElement("div",{"data-testid":l.Tp.components.TimePicker.overlayContent},r.createElement("div",{role:"presentation",className:(0,t.cx)(he,ge.backdrop),...ue}),r.createElement(o.n1,{contain:!0,autoFocus:!0,restoreFocus:!0},r.createElement("section",{className:ge.content,ref:q,...oe,...ie},r.createElement(v.r,{timeZone:H,fiscalYearStartMonth:w,value:P,onChange:re,quickOptions:E.o,history:G,showHistory:!0,widthOverride:k,onChangeTimeZone:_,onChangeFiscalYearStartMonth:K,hideQuickRanges:j,onError:B})))),N,De&&r.createElement(m.I,{"aria-label":(0,d.t)("time-picker.range-picker.forwards-time-aria-label","Move time range forwards"),onClick:U,icon:"angle-right",narrow:!0,variant:pe}),r.createElement(a.m,{content:b,placement:"bottom"},r.createElement(m.I,{"aria-label":(0,d.t)("time-picker.range-picker.zoom-out-button","Zoom out time range"),onClick:R,icon:"search-minus",variant:pe})))}D.displayName="TimeRangePicker";const b=()=>r.createElement(r.Fragment,null,r.createElement(d.x,{i18nKey:"time-picker.range-picker.zoom-out-tooltip"},"Time range zoom out ",r.createElement("br",null)," CTRL+Z")),C=({timeRange:x,timeZone:S})=>{const O=(0,f.of)(I);return r.createElement(r.Fragment,null,(0,u.LE)(x.from,{timeZone:S}),r.createElement("div",{className:"text-center"},r.createElement(d.x,{i18nKey:"time-picker.range-picker.to"},"to")),(0,u.LE)(x.to,{timeZone:S}),r.createElement("div",{className:"text-center"},r.createElement("span",{className:O.utc},(0,c.le)(S))))},y=(0,r.memo)(({hideText:x,value:S,timeZone:O})=>{const P=(0,f.of)(I);return x?null:r.createElement("span",{className:P.container},r.createElement("span",null,M(S,O)),r.createElement("span",{className:P.utc},g.describeTimeRangeAbbreviation(S,O)))});y.displayName="TimePickerButtonLabel";const M=(x,S)=>{const O={to:i.isMathString(x.raw.to)?x.raw.to:x.to,from:i.isMathString(x.raw.from)?x.raw.from:x.from};return g.describeTimeRange(O,S)},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}})}),I=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})})},72265:(Q,A,e)=>{"use strict";e.d(A,{h2:()=>h,nB:()=>c});var t=e(32196),n=e(96540),o=e(29426),s=e(91410),r=e(53531),g=e(40845),u=e(14578);function c({onChange:p,from:m,to:a,timeZone:v}){const E=i(m,a,new Date,v),D=f(p,v),b=(0,g.of)(h);return n.createElement(o.Ay,{selectRange:!0,next2Label:null,prev2Label:null,className:b.body,tileClassName:b.title,value:E,nextLabel:n.createElement(u.I,{name:"angle-right"}),prevLabel:n.createElement(u.I,{name:"angle-left"}),onChange:D,locale:"en"})}c.displayName="Body";function i(p,m,a=new Date,v){let E=p.isValid()?p.toDate():a,D=m.isValid()?m.toDate():a;return v&&([E,D]=l(E,D,v)),E>D?[D,E]:[E,D]}function l(p,m,a){const v=(0,s.HD)(a);if(!v)return[p,m];const E=v.utcOffset(p.getTime()),D=v.utcOffset(m.getTime()),b=p.getTimezoneOffset(),C=m.getTimezoneOffset(),y=E-b,M=D-C,T=new Date(p.getTime()-y*1e3*60),I=new Date(m.getTime()-M*1e3*60);return[T,I]}function f(p,m){return(0,n.useCallback)(a=>{if(!Array.isArray(a))return console.error("onCalendarChange: should be run in selectRange={true}");if(a[0]&&a[1]){const v=(0,r.b)(d(a[0]),{timeZone:m}),E=(0,r.b)(d(a[1]),{timeZone:m});p(v,E)}},[p,m])}function d(p){return[p.getFullYear(),p.getMonth(),p.getDate(),p.getHours(),p.getMinutes(),p.getSeconds()]}const h=p=>{const m=".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},[`${m}, .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"}},[`${m}, .react-calendar__tile--rangeStart`]:{borderTopLeftRadius:"20px",borderBottomLeftRadius:"20px"},[`${m}, .react-calendar__tile--rangeEnd`]:{borderTopRightRadius:"20px",borderBottomRightRadius:"20px"}})}}},85068:(Q,A,e)=>{"use strict";e.d(A,{r:()=>ge});var t=e(32196),n=e(96540),o=e(47232),s=e(65879),r=e(13544),g=e(40845),u=e(16797),c=e(76412),i=e(40276),l=e(67647),f=e(14578),d=e(2543),h=e(91410),p=e(55852),m=e(88575),a=e(94354),v=e(88323),E=e(20333),D=e(79451),b=e(17624),C=e(67459),y=e(32432);const M=ye=>{const{timeZone:Le,fiscalYearStartMonth:We,timestamp:Be=Date.now(),onChangeTimeZone:Ye,onChangeFiscalYearStartMonth:at}=ye,[st,Ke]=(0,n.useState)(!1),[Xe,He]=(0,n.useState)("tz"),Ge=(0,n.useCallback)(be=>{be&&be.stopPropagation(),Ke(!st)},[st,Ke]),xe=(0,g.of)(T);if(!(0,d.isString)(Le))return null;const $e=(0,h.QZ)(Le,Be);return $e?n.createElement("div",null,n.createElement("section",{"aria-label":(0,c.t)("time-picker.footer.time-zone-selection","Time zone selection"),className:xe.container},n.createElement("div",{className:xe.timeZoneContainer},n.createElement("div",{className:xe.timeZone},n.createElement(C.U,{title:$e.name}),n.createElement("div",{className:xe.spacer}),n.createElement(D.E,{info:$e})),n.createElement(b.X,{timeZone:Le,timestamp:Be})),n.createElement("div",{className:xe.spacer}),n.createElement(p.$n,{variant:"secondary",onClick:Ge,size:"sm"},n.createElement(c.x,{i18nKey:"time-picker.footer.change-settings-button"},"Change time settings"))),st?n.createElement("div",{className:xe.editContainer},n.createElement("div",null,n.createElement(a.z,{value:Xe,options:[{label:(0,c.t)("time-picker.footer.time-zone-option","Time zone"),value:"tz"},{label:(0,c.t)("time-picker.footer.fiscal-year-option","Fiscal year"),value:"fy"}],onChange:He})),Xe==="tz"?n.createElement("section",{"data-testid":r.Tp.components.TimeZonePicker.containerV2,className:(0,t.cx)(xe.timeZoneContainer,xe.timeSettingContainer)},n.createElement(E.U,{includeInternal:!0,onChange:be=>{Ge(),(0,d.isString)(be)&&Ye(be)},onBlur:Ge,menuShouldPortal:!1})):n.createElement("section",{"data-testid":r.Tp.components.TimeZonePicker.containerV2,className:(0,t.cx)(xe.timeZoneContainer,xe.timeSettingContainer)},n.createElement(m.D,{className:xe.fiscalYearField,label:(0,c.t)("time-picker.footer.fiscal-year-start","Fiscal year start month")},n.createElement(v.l6,{value:We,menuShouldPortal:!1,options:y.Z,onChange:be=>{at&&at(be.value??0)}})))):null):null},T=ye=>({container:(0,t.css)({borderTop:`1px solid ${ye.colors.border.weak}`,padding:"11px",display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"}),editContainer:(0,t.css)({borderTop:`1px solid ${ye.colors.border.weak}`,padding:"11px",justifyContent:"space-between",alignItems:"center"}),spacer:(0,t.css)({marginLeft:"7px"}),timeSettingContainer:(0,t.css)({paddingTop:ye.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 I=e(42617),x=e(53531),S=e(72724),O=e(10354),P=e(56034),L=e(47619),U=e(80279),R=e(7887),B=e(82148),H=e(88448),w=e(72265),N=e(67061);function V({onClose:ye,onApply:Le}){return n.createElement(N.B,{gap:2,justifyContent:"space-between"},n.createElement(p.$n,{variant:"secondary",onClick:ye},n.createElement(c.x,{i18nKey:"time-picker.calendar.cancel-button"},"Cancel")),n.createElement(p.$n,{onClick:Le},n.createElement(c.x,{i18nKey:"time-picker.calendar.apply-button"},"Apply time range")))}V.displayName="Footer";var G=e(29158);function _({onClose:ye}){return n.createElement(N.B,{justifyContent:"space-between"},n.createElement(I.e,null,n.createElement(c.x,{i18nKey:"time-picker.calendar.select-time"},"Select a time range")),n.createElement(G.K,{"data-testid":r.Tp.components.TimePicker.calendar.closeButton,tooltip:(0,c.t)("time-picker.calendar.close","Close calendar"),name:"times",variant:"secondary",onClick:ye}))}_.displayName="Header";const K=(ye,Le=!1)=>({container:(0,t.css)({top:0,position:"absolute",[`${Le?"left":"right"}`]:"546px"}),modalContainer:(0,t.css)({label:"modalContainer",margin:"0 auto"}),calendar:(0,t.css)({display:"flex",flexDirection:"column",gap:ye.spacing(1),padding:ye.spacing(1),label:"calendar",boxShadow:ye.shadows.z3,backgroundColor:ye.colors.background.primary,border:`1px solid ${ye.colors.border.weak}`,borderRadius:ye.shape.radius.default}),modal:(0,t.css)({label:"modal",boxShadow:ye.shadows.z3,left:"50%",position:"fixed",top:"50%",transform:"translate(-50%, -50%)",zIndex:ye.zIndex.modal})});function j(ye){const Le=(0,g.$j)(),{modalBackdrop:We}=(0,g.of)(H.o),Be=K(Le,ye.isReversed),{isOpen:Ye,isFullscreen:at,onClose:st}=ye,Ke=n.createRef(),{dialogProps:Xe}=(0,U.s)({"aria-label":r.Tp.components.TimePicker.calendar.label},Ke),{overlayProps:He}=(0,B.e)({isDismissable:!0,isOpen:Ye,onClose:st},Ke),Ge=!at;if(!Ye)return null;const xe=n.createElement("section",{className:Be.calendar,ref:Ke,...He,...Xe,"data-testid":r.Tp.components.TimePicker.calendar.label},n.createElement(_,{...ye}),n.createElement(w.nB,{...ye}),Ge&&n.createElement(V,{...ye}));return Ge?n.createElement(B.Sf,null,n.createElement("div",{className:We}),n.createElement(R.n1,{contain:!0,autoFocus:!0,restoreFocus:!0},n.createElement("div",{className:Be.modal},n.createElement("div",{className:Be.modalContainer},xe)))):n.createElement(R.n1,{contain:!0,restoreFocus:!0,autoFocus:!0},n.createElement("div",{className:Be.container},xe))}const k=(0,n.memo)(j);j.displayName="TimePickerCalendar";const Y={default:()=>(0,c.t)("time-picker.range-content.default-error",'Please enter a past date or "now"'),range:()=>(0,c.t)("time-picker.range-content.range-error",`"From" can't be after "To"`)},ee=ye=>{const{value:Le,isFullscreen:We=!1,timeZone:Be,onApply:Ye,isReversed:at,fiscalYearStartMonth:st,onError:Ke}=ye,[Xe,He]=J(Le.raw.from,Le.raw.to,Be),Ge=(0,g.of)(q),[xe,$e]=(0,n.useState)(Xe),[be,Z]=(0,n.useState)(He),[ae,de]=(0,n.useState)(!1),ve=(0,n.useId)(),Ue=(0,n.useId)();(0,n.useEffect)(()=>{const[Mt,Yt]=J(Le.raw.from,Le.raw.to,Be);$e(Mt),Z(Yt)},[Le.raw.from,Le.raw.to,Be]);const _e=(0,n.useCallback)(Mt=>{Mt.preventDefault(),de(!0)},[de]),ze=(0,n.useCallback)(()=>{if(be.invalid||xe.invalid)return;const Mt={from:xe.value,to:be.value},Yt=s.convertRawToRange(Mt,Be,st);Ye(Yt)},[xe.invalid,xe.value,Ye,Be,be.invalid,be.value,st]),Ve=(0,n.useCallback)((Mt,Yt)=>{const[zt,_t]=J(Mt,Yt,Be);$e(zt),Z(_t)},[Be]),Ne=Mt=>{Mt.key==="Enter"&&ze()},ot=()=>{const Mt={from:xe.value,to:be.value};navigator.clipboard.writeText(JSON.stringify(Mt))},nt=async()=>{const Mt=await navigator.clipboard.readText();let Yt;try{Yt=JSON.parse(Mt)}catch{Ke&&Ke(Mt);return}const[zt,_t]=J(Yt.from,Yt.to,Be);$e(zt),Z(_t)},pt=s.convertRawToRange({from:"now/fy",to:"now/fy"},Be,st),mt=(0,c.t)("time-picker.range-content.fiscal-year","Fiscal year"),gt=n.createElement("div",{className:Ge.tooltip},s.isFiscal(Le)?n.createElement(P.m,{content:`${mt}: ${pt.from.format("MMM-DD")} - ${pt.to.format("MMM-DD")}`},n.createElement(f.I,{name:"info-circle"})):null),Pt=n.createElement(p.$n,{"aria-label":(0,c.t)("time-picker.range-content.open-input-calendar","Open calendar"),"data-testid":r.Tp.components.TimePicker.calendar.openButton,icon:"calendar-alt",variant:"secondary",type:"button",onClick:_e});return n.createElement("div",null,n.createElement("div",{className:Ge.fieldContainer},n.createElement(m.D,{label:(0,c.t)("time-picker.range-content.from-input","From"),invalid:xe.invalid,error:xe.errorMessage},n.createElement(O.p,{id:ve,onClick:Mt=>Mt.stopPropagation(),onChange:Mt=>Ve(Mt.currentTarget.value,be.value),addonAfter:Pt,onKeyDown:Ne,"data-testid":r.Tp.components.TimePicker.fromField,value:xe.value})),gt),n.createElement("div",{className:Ge.fieldContainer},n.createElement(m.D,{label:(0,c.t)("time-picker.range-content.to-input","To"),invalid:be.invalid,error:be.errorMessage},n.createElement(O.p,{id:Ue,onClick:Mt=>Mt.stopPropagation(),onChange:Mt=>Ve(xe.value,Mt.currentTarget.value),addonAfter:Pt,onKeyDown:Ne,"data-testid":r.Tp.components.TimePicker.toField,value:be.value})),gt),n.createElement("div",{className:Ge.buttonsContainer},n.createElement(p.$n,{"data-testid":r.Tp.components.TimePicker.copyTimeRange,icon:"copy",variant:"secondary",tooltip:(0,c.t)("time-picker.copy-paste.tooltip-copy","Copy time range to clipboard"),type:"button",onClick:ot}),n.createElement(p.$n,{"data-testid":r.Tp.components.TimePicker.pasteTimeRange,icon:"clipboard-alt",variant:"secondary",tooltip:(0,c.t)("time-picker.copy-paste.tooltip-paste","Paste time range"),type:"button",onClick:nt}),n.createElement(p.$n,{"data-testid":r.Tp.components.TimePicker.applyTimeRange,type:"button",onClick:ze},n.createElement(c.x,{i18nKey:"time-picker.range-content.apply-button"},"Apply time range"))),n.createElement(k,{isFullscreen:We,isOpen:ae,from:(0,x.b)(xe.value,{timeZone:Be}),to:(0,x.b)(be.value,{timeZone:Be}),onApply:ze,onClose:()=>de(!1),onChange:Ve,timeZone:Be,isReversed:at}))};function re(ye,Le,We){const Be={from:ye,to:Le},Ye=s.convertRawToRange(Be,We);return!(Ye.from.isSame(Ye.to)||Ye.from.isBefore(Ye.to))}function J(ye,Le,We){const Be=ne(ye,We),Ye=ne(Le,We),at=!(0,L.f)(Be,!1,We),st=!(0,L.f)(Ye,!0,We),Ke=re(Be,Ye,We)&&!st;return[{value:Be,invalid:at||Ke,errorMessage:Ke&&!at?Y.range():Y.default()},{value:Ye,invalid:st,errorMessage:Y.default()}]}function ne(ye,Le){return(0,o.Ar)(ye)?(0,S.LE)(ye,{timeZone:Le}):ye}function q(ye){return{fieldContainer:(0,t.css)({display:"flex"}),buttonsContainer:(0,t.css)({display:"flex",gap:ye.spacing(.5),marginTop:ye.spacing(1)}),tooltip:(0,t.css)({paddingLeft:ye.spacing(1),paddingTop:ye.spacing(3)})}}var te=e(65172);const oe=(ye,Le)=>s.convertRawToRange({from:ye.from,to:ye.to},Le),ue=(ye,Le)=>{const We=(0,S.LE)(ye.from,{timeZone:Le}),Be=(0,S.LE)(ye.to,{timeZone:Le});return{from:We,to:Be,display:`${We} to ${Be}`}},ie=ye=>{const{quickOptions:Le=[],isReversed:We,isFullscreen:Be,hideQuickRanges:Ye,timeZone:at,fiscalYearStartMonth:st,value:Ke,onChange:Xe,history:He,showHistory:Ge,className:xe,hideTimeZone:$e,onChangeTimeZone:be,onChangeFiscalYearStartMonth:Z}=ye,ae=!He?.length,de=Be&&Ge||!Be&&(Ge&&!ae||!Ye),ve=(0,g.of)(Ee,We,Ye,de,Be),Ue=le(He,at),_e=Te(Ke.raw,Le),[ze,Ve]=(0,n.useState)(""),Ne=Le.filter(nt=>nt.display.toLowerCase().includes(ze.toLowerCase())),ot=nt=>Xe(oe(nt));return n.createElement("div",{id:"TimePickerContent",className:(0,t.cx)(ve.container,xe)},n.createElement("div",{className:ve.body},(!Be||!Ye)&&n.createElement("div",{className:ve.rightSide},n.createElement("div",{className:ve.timeRangeFilter},n.createElement(l.Z,{width:0,value:ze,onChange:Ve,placeholder:(0,c.t)("time-picker.content.filter-placeholder","Search quick ranges")})),n.createElement(i.E,null,!Be&&n.createElement(he,{...ye,historyOptions:Ue}),!Ye&&n.createElement(te.l,{options:Ne,onChange:ot,value:_e}))),Be&&n.createElement("div",{className:ve.leftSide},n.createElement(De,{...ye,historyOptions:Ue}))),!$e&&Be&&n.createElement(M,{timeZone:at,fiscalYearStartMonth:st,onChangeTimeZone:be,onChangeFiscalYearStartMonth:Z}))},ge=ye=>{const{widthOverride:Le}=ye,We=(0,g.$j)(),Be=(Le||window.innerWidth)>=We.breakpoints.values.lg;return n.createElement(ie,{...ye,isFullscreen:Be})},he=ye=>{const{value:Le,hideQuickRanges:We,onChange:Be,timeZone:Ye,historyOptions:at=[],showHistory:st,onError:Ke}=ye,Xe=(0,g.of)(Re),He=(0,o.Ar)(Le.raw.from)||(0,o.Ar)(Le.raw.to),[Ge,xe]=(0,n.useState)(!He),$e=We?!1:Ge,be=Z=>Be(oe(Z,Ye));return n.createElement("fieldset",null,n.createElement("div",{className:Xe.header},n.createElement("button",{type:"button",className:Xe.expandButton,onClick:()=>{We||xe(!$e)},"data-testid":r.Tp.components.TimePicker.absoluteTimeRangeTitle,"aria-expanded":!$e,"aria-controls":"expanded-timerange"},n.createElement(I.e,null,n.createElement(c.x,{i18nKey:"time-picker.absolute.title"},"Absolute time range")),!We&&n.createElement(f.I,{name:$e?"angle-down":"angle-up"}))),!$e&&n.createElement("div",{className:Xe.body,id:"expanded-timerange"},n.createElement("div",{className:Xe.form},n.createElement(ee,{value:Le,onApply:Be,timeZone:Ye,isFullscreen:!1,onError:Ke})),st&&n.createElement(te.l,{title:(0,c.t)("time-picker.absolute.recent-title","Recently used absolute ranges"),options:at,onChange:be,placeholderEmpty:null})))},De=ye=>{const{onChange:Le,value:We,timeZone:Be,fiscalYearStartMonth:Ye,isReversed:at,historyOptions:st,onError:Ke}=ye,Xe=(0,g.of)(me,ye.hideQuickRanges),He=Ge=>Le(oe(Ge,Be));return n.createElement(n.Fragment,null,n.createElement("div",{className:Xe.container},n.createElement("div",{className:Xe.title,"data-testid":r.Tp.components.TimePicker.absoluteTimeRangeTitle},n.createElement(I.e,null,n.createElement(c.x,{i18nKey:"time-picker.absolute.title"},"Absolute time range"))),n.createElement(ee,{value:We,timeZone:Be,fiscalYearStartMonth:Ye,onApply:Le,isFullscreen:!0,isReversed:at,onError:Ke})),ye.showHistory&&n.createElement("div",{className:Xe.recent},n.createElement(te.l,{title:(0,c.t)("time-picker.absolute.recent-title","Recently used absolute ranges"),options:st||[],onChange:He,placeholderEmpty:n.createElement(pe,null)})))},pe=(0,n.memo)(()=>{const ye=(0,g.of)(Me),Le=(0,c.t)("time-picker.content.empty-recent-list-info","It looks like you haven't used this time picker before. As soon as you enter some time intervals, recently used intervals will appear here.");return n.createElement("div",{className:ye.container},n.createElement("div",null,n.createElement("span",null,Le)),n.createElement(c.x,{i18nKey:"time-picker.content.empty-recent-list-docs"},n.createElement("div",null,n.createElement("a",{className:ye.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 le(ye,Le){return!Array.isArray(ye)||ye.length===0?[]:ye.map(We=>ue(We,Le))}pe.displayName="EmptyRecentList";const Te=(ye,Le)=>(0,n.useMemo)(()=>{if(s.isRelativeTimeRange(ye))return Le.find(We=>We.from===ye.from&&We.to===ye.to)},[ye,Le]),Ee=(ye,Le,We,Be,Ye)=>({container:(0,t.css)({background:ye.colors.background.primary,boxShadow:ye.shadows.z3,width:`${Ye?"546px":"262px"}`,borderRadius:ye.shape.radius.default,border:`1px solid ${ye.colors.border.weak}`,[`${Le?"left":"right"}`]:0}),body:(0,t.css)({display:"flex",flexDirection:"row-reverse",height:`${Be?"381px":"217px"}`,maxHeight:"100vh"}),leftSide:(0,t.css)({display:"flex",flexDirection:"column",borderRight:`${Le?"none":`1px solid ${ye.colors.border.weak}`}`,width:`${We?"100%":"60%"}`,overflow:"hidden",order:Le?1:0}),rightSide:(0,t.css)({width:`${Ye?"40%":"100%"}; !important`,borderRight:Le?`1px solid ${ye.colors.border.weak}`:"none",display:"flex",flexDirection:"column"}),timeRangeFilter:(0,t.css)({padding:ye.spacing(1)}),spacing:(0,t.css)({marginTop:"16px"})}),Re=ye=>({header:(0,t.css)({display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",borderBottom:`1px solid ${ye.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)(ye)}),body:(0,t.css)({borderBottom:`1px solid ${ye.colors.border.weak}`}),form:(0,t.css)({padding:"7px 9px 7px 9px"})}),me=(ye,Le)=>({container:(0,t.css)({paddingTop:"9px",paddingLeft:"11px",paddingRight:Le?"11px":"20%"}),title:(0,t.css)({marginBottom:"11px"}),recent:(0,t.css)({flexGrow:1,display:"flex",flexDirection:"column",justifyContent:"flex-end",paddingTop:ye.spacing(1)})}),Me=ye=>({container:(0,t.css)({padding:"12px",margin:"12px","a, span":{fontSize:"13px"}}),link:(0,t.css)({color:ye.colors.text.link})})},42617:(Q,A,e)=>{"use strict";e.d(A,{e:()=>r});var t=e(32196),n=e(96540),o=e(40845);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 u=(0,o.of)(s);return n.createElement("h3",{className:u.text},g)});r.displayName="TimePickerTitle"},3799:(Q,A,e)=>{"use strict";e.d(A,{f:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(15666),r=e(47619);const g=(0,n.memo)(function({hideText:i,value:l,timeZone:f="browser",placeholder:d="No time range selected",className:h}){const p=(0,o.of)(u);return i?null:n.createElement("span",{className:h},(0,r.X)(l)?n.createElement(s._8,{value:l,timeZone:f}):n.createElement("span",{className:p.placeholder},d))}),u=c=>({placeholder:(0,t.css)({color:c.colors.text.disabled,opacity:1})})},65172:(Q,A,e)=>{"use strict";e.d(A,{l:()=>l});var t=e(32196),n=e(96540),o=e(40845),s=e(76412),r=e(42617),g=e(62938),u=e(16797);const c=a=>({container:(0,t.css)({display:"flex",alignItems:"center",flexDirection:"row-reverse",justifyContent:"space-between"}),selected:(0,t.css)({background:a.colors.action.selected,fontWeight:a.typography.fontWeightMedium}),radio:(0,t.css)({opacity:0,width:"0 !important","&:focus-visible + label":(0,u.getFocusStyles)(a)}),label:(0,t.css)({cursor:"pointer",flex:1,padding:"7px 9px 7px 9px","&:hover":{background:a.colors.action.hover,cursor:"pointer"}})}),i=(0,n.memo)(({value:a,onSelect:v,selected:E=!1,name:D})=>{const b=(0,o.of)(c),C=(0,g.A)();return n.createElement("li",{className:(0,t.cx)(b.container,E&&b.selected)},n.createElement("input",{className:b.radio,checked:E,name:D,type:"checkbox",id:C,onChange:()=>v(a)}),n.createElement("label",{className:b.label,htmlFor:C},a.display))});i.displayName="TimeRangeOption";const l=a=>{const v=(0,o.of)(p),{title:E,options:D,placeholderEmpty:b}=a;return typeof b<"u"&&D.length<=0?n.createElement(n.Fragment,null,b):E?n.createElement("section",{"aria-label":E},n.createElement("fieldset",null,n.createElement("div",{className:v.title},n.createElement(r.e,null,E)),n.createElement(f,{...a}))):n.createElement(f,{...a})},f=({options:a,value:v,onChange:E,title:D})=>{const b=(0,o.of)(m);return n.createElement(n.Fragment,null,n.createElement("ul",{"aria-roledescription":(0,s.t)("time-picker.time-range.aria-role","Time range selection")},a.map((C,y)=>n.createElement(i,{key:d(C,y),value:C,selected:h(C,v),onSelect:E,name:D??(0,s.t)("time-picker.time-range.default-title","Time ranges")}))),n.createElement("div",{className:b.grow}))};function d(a,v){return`${a.from}-${a.to}-${v}`}function h(a,v){return!v||!a?!1:v.from===a.from&&v.to===a.to}const p=()=>({title:(0,t.css)({display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 16px 5px 9px"})}),m=()=>({grow:(0,t.css)({flexGrow:1,alignItems:"flex-start"})})},20333:(Q,A,e)=>{"use strict";e.d(A,{U:()=>E});var t=e(2543),n=e(96540),o=e(91410),s=e(76412),r=e(88323),g=e(32196),u=e(40845);const c=T=>{const{children:I,label:x}=T,S=(0,u.of)(i);return x?n.createElement("div",null,n.createElement("div",{className:S.header},n.createElement("span",{className:S.label},x)),I):n.createElement("div",null,I)},i=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 l=e(17624),f=e(14578),d=e(79451),h=e(67459);const p="tz-utc-offset",m=T=>{const{children:I,innerProps:x,innerRef:S,data:O,isSelected:P,isFocused:L}=T,U=(0,u.of)(v),R=Date.now(),B=(0,g.cx)(U.container,L&&U.containerFocused);if(!(0,t.isString)(O.value))return null;const H=(0,o.QZ)(O.value,R);return n.createElement("div",{className:B,...x,ref:S,"aria-label":"Select option"},n.createElement("div",{className:(0,g.cx)(U.leftColumn,U.row)},n.createElement("div",{className:(0,g.cx)(U.leftColumn,U.wideRow)},n.createElement(h.U,{title:I}),n.createElement("div",{className:U.spacer}),n.createElement(d.E,{info:H})),n.createElement("div",{className:U.rightColumn},n.createElement(l.X,{timeZone:H?.ianaName||O.value,timestamp:R,className:p}),P&&n.createElement("span",null,n.createElement(f.I,{name:"check"})))))},a=T=>{const{children:I,innerProps:x,innerRef:S,data:O,isSelected:P,isFocused:L}=T,U=(0,u.of)(v),R=Date.now(),B=(0,g.cx)(U.container,L&&U.containerFocused);if(!(0,t.isString)(O.value))return null;const H=(0,o.QZ)(O.value,R);return n.createElement("div",{className:B,...x,ref:S,"aria-label":"Select option"},n.createElement("div",{className:U.body},n.createElement("div",{className:U.row},n.createElement("div",{className:U.leftColumn},n.createElement(h.U,{title:I})),n.createElement("div",{className:U.rightColumn},P&&n.createElement("span",null,n.createElement(f.I,{name:"check"})))),n.createElement("div",{className:U.row},n.createElement("div",{className:U.leftColumn},n.createElement(d.E,{info:H})),n.createElement("div",{className:U.rightColumn},n.createElement(l.X,{timestamp:R,timeZone:H?.ianaName||O.value,className:p})))))},v=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"})}),E=T=>{const{onChange:I,width:x,autoFocus:S=!1,onBlur:O,value:P,includeInternal:L=!1,disabled:U=!1,inputId:R,menuShouldPortal:B=!0,openMenuOnFocus:H=!0}=T,w=D(L),N=b(w,P),V=y(),G=x&&x<=45?a:m,_=(0,n.useCallback)(K=>{if(!K||!(0,t.isString)(K.value))return I(P);I(K.value)},[I,P]);return n.createElement(r.l6,{inputId:R,value:N,placeholder:(0,s.t)("time-picker.zone.select-search-input","Type to search (country, city, abbreviation)"),autoFocus:S,menuShouldPortal:B,openMenuOnFocus:H,width:x,filterOption:V,options:w,onChange:_,onBlur:O,components:{Option:G,Group:c},disabled:U,"aria-label":(0,s.t)("time-picker.zone.select-aria-label","Time zone picker")})},D=T=>{const I=Date.now();return(0,o.U3)(T).map(S=>{const O=S.zones.reduce((P,L)=>{const U=(0,o.QZ)(L,I);return U&&P.push({label:U.name,value:U.zone,searchIndex:M(U,I)}),P},[]);return{label:S.name,options:O}})},b=(T,I)=>(0,n.useMemo)(()=>{if(I===void 0)return;const x=(0,t.toLower)(I);return T.find(O=>O.label?x.startsWith((0,t.toLower)(O.label)):C(x))?.options.find(O=>(0,t.isEmpty)(x)?O.value===o.g$.default:(0,t.toLower)(O.value)===x)},[T,I]),C=T=>{switch(T){case o.g$.default:case o.g$.localBrowserTime:case o.g$.utc:return!0;default:return!1}},y=()=>(0,n.useCallback)((T,I)=>!I||!T.data||!T.data.searchIndex?!0:T.data.searchIndex.indexOf((0,t.toLower)(I))>-1,[]),M=(T,I)=>{const x=[(0,t.toLower)(T.name),(0,t.toLower)(T.abbreviation),(0,t.toLower)((0,l.t)(I,T.zone))];for(const S of T.countries)x.push((0,t.toLower)(S.name)),x.push((0,t.toLower)(S.code));return x.join("|")}},79451:(Q,A,e)=>{"use strict";e.d(A,{E:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({info:u})=>{const c=(0,o.of)(g),i=r(u);return u?n.createElement("div",{className:c.description},i):null},r=u=>(0,n.useMemo)(()=>{const c=[];if(!u)return"";if(u.name==="Europe/Simferopol")return"Ukraine, EEST";if(u.countries.length>0){const i=u.countries[0];c.push(i.name)}return u.abbreviation&&c.push(u.abbreviation),c.join(", ")},[u]),g=u=>({description:(0,t.css)({fontWeight:"normal",fontSize:u.typography.size.sm,color:u.colors.text.secondary,whiteSpace:"normal",textOverflow:"ellipsis"})})},17624:(Q,A,e)=>{"use strict";e.d(A,{X:()=>u,t:()=>c});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(72724),g=e(40845);const u=l=>{const{timestamp:f,timeZone:d,className:h}=l,p=(0,g.of)(i);return(0,n.isString)(d)?s.createElement(s.Fragment,null,s.createElement("span",{className:(0,t.cx)(p.offset,h)},c(f,d))):null},c=(l,f)=>{const d=(0,r.LE)(l,{timeZone:f,format:"Z"});return d==="+00:00"?"UTC":`UTC${d}`},i=l=>{const f=(0,t.css)({fontWeight:"normal",fontSize:l.typography.size.sm,color:l.colors.text.secondary,whiteSpace:"normal"});return{offset:(0,t.css)(f,{color:l.colors.text.primary,background:l.colors.background.secondary,padding:"2px 5px",borderRadius:l.shape.radius.default,marginLeft:"4px"})}}},67459:(Q,A,e)=>{"use strict";e.d(A,{U:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({title:g})=>{const u=(0,o.of)(r);return g?n.createElement("span",{className:u.title},g):null},r=g=>({title:(0,t.css)({fontWeight:g.typography.fontWeightRegular,textOverflow:"ellipsis"})})},15648:(Q,A,e)=>{"use strict";e.d(A,{l:()=>r});var t=e(96540),n=e(13544),o=e(88323);const s=[{value:"",label:"Default"},{value:"saturday",label:"Saturday"},{value:"sunday",label:"Sunday"},{value:"monday",label:"Monday"}],r=g=>{const{onChange:u,width:c,autoFocus:i=!1,onBlur:l,value:f,disabled:d=!1,inputId:h}=g,p=(0,t.useCallback)(m=>{m.value!==void 0&&u(m.value)},[u]);return t.createElement(o.l6,{inputId:h,value:s.find(m=>m.value===f)?.value,placeholder:n.Tp.components.WeekStartPicker.placeholder,autoFocus:i,openMenuOnFocus:!0,width:c,options:s,onChange:p,onBlur:l,disabled:d})}},32432:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>n,o:()=>t});const t=[{from:"now-5m",to:"now",display:"Last 5 minutes"},{from:"now-15m",to:"now",display:"Last 15 minutes"},{from:"now-30m",to:"now",display:"Last 30 minutes"},{from:"now-1h",to:"now",display:"Last 1 hour"},{from:"now-3h",to:"now",display:"Last 3 hours"},{from:"now-6h",to:"now",display:"Last 6 hours"},{from:"now-12h",to:"now",display:"Last 12 hours"},{from:"now-24h",to:"now",display:"Last 24 hours"},{from:"now-2d",to:"now",display:"Last 2 days"},{from:"now-7d",to:"now",display:"Last 7 days"},{from:"now-30d",to:"now",display:"Last 30 days"},{from:"now-90d",to:"now",display:"Last 90 days"},{from:"now-6M",to:"now",display:"Last 6 months"},{from:"now-1y",to:"now",display:"Last 1 year"},{from:"now-2y",to:"now",display:"Last 2 years"},{from:"now-5y",to:"now",display:"Last 5 years"},{from:"now-1d/d",to:"now-1d/d",display:"Yesterday"},{from:"now-2d/d",to:"now-2d/d",display:"Day before yesterday"},{from:"now-7d/d",to:"now-7d/d",display:"This day last week"},{from:"now-1w/w",to:"now-1w/w",display:"Previous week"},{from:"now-1M/M",to:"now-1M/M",display:"Previous month"},{from:"now-1Q/fQ",to:"now-1Q/fQ",display:"Previous fiscal quarter"},{from:"now-1y/y",to:"now-1y/y",display:"Previous year"},{from:"now-1y/fy",to:"now-1y/fy",display:"Previous fiscal year"},{from:"now/d",to:"now/d",display:"Today"},{from:"now/d",to:"now",display:"Today so far"},{from:"now/w",to:"now/w",display:"This week"},{from:"now/w",to:"now",display:"This week so far"},{from:"now/M",to:"now/M",display:"This month"},{from:"now/M",to:"now",display:"This month so far"},{from:"now/y",to:"now/y",display:"This year"},{from:"now/y",to:"now",display:"This year so far"},{from:"now/fQ",to:"now",display:"This fiscal quarter so far"},{from:"now/fQ",to:"now/fQ",display:"This fiscal quarter"},{from:"now/fy",to:"now",display:"This fiscal year so far"},{from:"now/fy",to:"now/fy",display:"This fiscal year"}],n=[{label:"January",value:0},{label:"February",value:1},{label:"March",value:2},{label:"April",value:3},{label:"May",value:4},{label:"June",value:5},{label:"July",value:6},{label:"August",value:7},{label:"September",value:8},{label:"October",value:9},{label:"November",value:10},{label:"December",value:11}]},47619:(Q,A,e)=>{"use strict";e.d(A,{X:()=>r,f:()=>s});var t=e(47232),n=e(85858),o=e(53531);function s(g,u,c){return(0,t.Ar)(g)?g.isValid():n.isMathString(g)?n.isValid(g):(0,o.b)(g,{roundUp:u,timeZone:c}).isValid()}function r(g){return n.isValid(g.from)&&n.isValid(g.to)}},25994:(Q,A,e)=>{"use strict";e.d(A,{c:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({direction:g="horizontal",spacing:u=2})=>{const c=(0,o.of)(r,u);return g==="vertical"?n.createElement("div",{className:c.verticalDivider}):n.createElement("hr",{className:c.horizontalDivider})};s.displayName="Divider";const r=(g,u)=>({horizontalDivider:(0,t.css)({borderTop:`1px solid ${g.colors.border.weak}`,margin:g.spacing(u,0),width:"100%"}),verticalDivider:(0,t.css)({borderRight:`1px solid ${g.colors.border.weak}`,margin:g.spacing(0,u),height:"100%"})})},69144:(Q,A,e)=>{"use strict";e.d(A,{l:()=>n});var t=e(32196);const n=(o,s)=>{const r=s||"middle",g=o.colors.emphasize(o.colors.background.secondary,.15),u=o.colors.primary.border,c=o.spacing(2),i=4,l=200;let f="50%",d="50%";switch(r){case"start":{f="0%",d="0%";break}case"end":{f="100%",d="100%";break}}const h=(0,t.css)({position:"relative","&:before":{content:'""',position:"absolute",transition:o.transitions.create("border-color"),zIndex:1},"&:after":{background:g,content:'""',position:"absolute",transition:o.transitions.create("background"),transform:"translate(-50%, -50%)",borderRadius:o.shape.radius.pill,zIndex:1},"&:hover":{"&:before":{borderColor:u},"&:after":{background:u}}});return{dragHandleVertical:(0,t.cx)(h,(0,t.css)({cursor:"col-resize",width:c,"&:before":{borderRight:"1px solid transparent",height:"100%",left:f,transform:"translateX(-50%)"},"&:after":{left:f,top:"50%",height:l,width:i}})),dragHandleHorizontal:(0,t.cx)(h,(0,t.css)({height:c,cursor:"row-resize","&:before":{borderTop:"1px solid transparent",top:d,transform:"translateY(-50%)",width:"100%"},"&:after":{left:"50%",top:d,height:i,width:l}}))}}},87978:(Q,A,e)=>{"use strict";e.d(A,{_:()=>p});var t=e(32196),n=e(80279),o=e(7887),s=e(82148),r=e(50848),g=e(96540),u=e(13544),c=e(40845),i=e(76412),l=e(40276),f=e(69144),d=e(29158),h=e(94753);function p({children:C,onClose:y,closeOnMaskClick:M=!0,scrollableContent:T=!0,title:I,subtitle:x,width:S,size:O="md",tabs:P}){const[L,U,R]=m(),B=(0,c.of)(E),H=(0,c.of)(b,O,L??S),w=(0,c.of)(f.l),N=g.useRef(null),{dialogProps:V,titleProps:G}=(0,n.s)({},N),{overlayProps:_}=(0,s.e)({isDismissable:!1,isOpen:!0,onClose:y},N);v();const K=(0,t.cx)(B.drawer,H),j=g.createElement("div",{className:B.content},C);return g.createElement(r.A,{open:!0,onClose:y,placement:"right",getContainer:".main-view",className:B.drawerContent,rootClassName:K,width:"",motion:{motionAppear:!0,motionName:B.drawerMotion},maskClassName:B.mask,maskClosable:M,maskMotion:{motionAppear:!0,motionName:B.maskMotion}},g.createElement(o.n1,{restoreFocus:!0,contain:!0,autoFocus:!0},g.createElement("div",{"aria-label":typeof I=="string"?u.Tp.components.Drawer.General.title(I):u.Tp.components.Drawer.General.title("no title"),className:B.container,..._,...V,ref:N},g.createElement("div",{className:(0,t.cx)(w.dragHandleVertical,B.resizer),onMouseDown:U,onTouchStart:R}),typeof I=="string"&&g.createElement("div",{className:(0,t.cx)(B.header,!!P&&B.headerWithTabs)},g.createElement("div",{className:B.actions},g.createElement(d.K,{name:"times",variant:"secondary",onClick:y,"data-testid":u.Tp.components.Drawer.General.close,tooltip:(0,i.t)("grafana-ui.drawer.close","Close")})),g.createElement("div",{className:B.titleWrapper},g.createElement(h.E,{element:"h3",...G},I),x&&g.createElement("div",{className:B.subtitle,"data-testid":u.Tp.components.Drawer.General.subtitle},x),P&&g.createElement("div",{className:B.tabsWrapper},P))),typeof I!="string"&&I,T?g.createElement(l.E,null,j):j)))}function m(){const[C,y]=(0,g.useState)(void 0),M=(0,g.useCallback)(P=>{y(a(P.clientX))},[]),T=(0,g.useCallback)(P=>{const L=P.touches[0];y(a(L.clientX))},[]),I=(0,g.useCallback)(P=>{document.removeEventListener("mousemove",M),document.removeEventListener("mouseup",I)},[M]),x=(0,g.useCallback)(P=>{document.removeEventListener("touchmove",T),document.removeEventListener("touchend",x)},[T]);function S(P){P.stopPropagation(),P.preventDefault(),document.addEventListener("mousemove",M),document.addEventListener("mouseup",I)}function O(P){P.stopPropagation(),P.preventDefault(),document.addEventListener("touchmove",T),document.addEventListener("touchend",x)}return[C,S,O]}function a(C){let y=document.body.offsetWidth-(C-document.body.offsetLeft);return`${Math.min(y/document.body.clientWidth*100,98).toFixed(2)}vw`}function v(){(0,g.useEffect)(()=>{if(document.body)return document.body.classList.add("body-drawer-open"),()=>{document.body.classList.remove("body-drawer-open")}},[])}const E=C=>({container:(0,t.css)({display:"flex",flexDirection:"column",height:"100%",flex:"1 1 0",minHeight:"100%",position:"relative"}),drawer:(0,t.css)({".main-view &":{top:80},".main-view--search-bar-hidden &":{top:40},".main-view--chrome-hidden &":{top:0},".rc-drawer-content-wrapper":{boxShadow:C.shadows.z3}}),drawerContent:(0,t.css)({backgroundColor:`${C.colors.background.primary} !important`,display:"flex",overflow:"unset",flexDirection:"column"}),drawerMotion:(0,t.css)({"&-appear":{transform:"translateX(100%)",transition:"none !important","&-active":{transition:`${C.transitions.create("transform")} !important`,transform:"translateX(0)"}}}),mask:(0,t.css)({backgroundColor:"transparent",position:"fixed","&:before":{backgroundColor:`${C.components.overlay.background} !important`,backdropFilter:"blur(1px)",bottom:0,content:'""',left:0,position:"fixed",right:0,".main-view &":{top:80},".main-view--search-bar-hidden &":{top:40},".main-view--chrome-hidden &":{top:0}}}),maskMotion:(0,t.css)({"&-appear":{opacity:0,"&-active":{opacity:1,transition:C.transitions.create("opacity")}}}),header:(0,t.css)({label:"drawer-header",flexGrow:0,padding:C.spacing(2,2,3),borderBottom:`1px solid ${C.colors.border.weak}`}),headerWithTabs:(0,t.css)({borderBottom:"none"}),actions:(0,t.css)({position:"absolute",right:C.spacing(1),top:C.spacing(1)}),titleWrapper:(0,t.css)({label:"drawer-title",overflowWrap:"break-word"}),subtitle:(0,t.css)({label:"drawer-subtitle",color:C.colors.text.secondary,paddingTop:C.spacing(1)}),content:(0,t.css)({padding:C.spacing(2),height:"100%",flexGrow:1}),tabsWrapper:(0,t.css)({label:"drawer-tabs",paddingLeft:C.spacing(2),margin:C.spacing(1,-1,-3,-3)}),resizer:(0,t.css)({top:0,left:C.spacing(-1),bottom:0,position:"absolute",zIndex:C.zIndex.modal})}),D={sm:{width:"25vw",minWidth:384},md:{width:"50vw",minWidth:568},lg:{width:"75vw",minWidth:744}};function b(C,y,M){let T=M??D[y].width,I=D[y].minWidth;return(0,t.css)({".rc-drawer-content-wrapper":{label:`drawer-content-wrapper-${y}`,width:T,minWidth:I,overflow:"unset",[C.breakpoints.down("md")]:{width:`calc(100% - ${C.spacing(2)}) !important`,minWidth:0}}})}},9261:(Q,A,e)=>{"use strict";e.d(A,{f:()=>d});var t=e(32196),n=e(95361),o=e(18491),s=e(36376),r=e(7887),g=e(96540),u=e(40845),c=e(38138),i=e(64539),l=e(27746);const f=p=>{const{className:m,options:a,value:v,onChange:E,narrow:D,variant:b,...C}=p,y=(0,u.of)(h),[M,T]=(0,g.useState)(!1),I=[(0,n.cY)(0),(0,o.UU)({fallbackAxisSideDirection:"end",crossAxis:!1,boundary:document.body}),(0,o.BN)()],{context:x,refs:S,floatingStyles:O}=(0,s.we)({open:M,placement:"bottom-end",onOpenChange:T,middleware:I,whileElementsMounted:o.ll}),P=(0,s.kp)(x),L=(0,s.s9)(x),{getReferenceProps:U,getFloatingProps:R}=(0,s.bv)([L,P]),B=H=>{E(H),T(!1)};return g.createElement("div",{className:y.wrapper},g.createElement(l.I,{className:m,isOpen:M,narrow:D,variant:b,ref:S.setReference,...U(),...C},v?.label||(v?.value!=null?String(v?.value):null)),M&&g.createElement("div",{className:y.menuWrapper,ref:S.setFloating,...R(),style:O},g.createElement(r.n1,{contain:!0,autoFocus:!0,restoreFocus:!0},g.createElement(c.W,{tabIndex:-1,onClose:()=>T(!1)},a.map(H=>g.createElement(i.D,{key:`${H.value}`,label:H.label??String(H.value),onClick:()=>B(H),active:H.value===v?.value,ariaChecked:H.value===v?.value,ariaLabel:H.ariaLabel||H.label,role:"menuitemradio"}))))))};f.displayName="ButtonSelect";const d=g.memo(f),h=p=>({wrapper:(0,t.css)({position:"relative",display:"inline-flex"}),menuWrapper:(0,t.css)({zIndex:p.zIndex.dropdown})})},83122:(Q,A,e)=>{"use strict";e.d(A,{m:()=>f});var t=e(32196),n=e(95361),o=e(18491),s=e(36376),r=e(7887),g=e(96540),u=e(86634),c=e(67892),i=e(18976),l=e(17464);const f=g.memo(({children:h,overlay:p,placement:m,offset:a,onVisibleChange:v})=>{const[E,D]=(0,g.useState)(!1),b=(0,g.useRef)(null);(0,g.useEffect)(()=>{v?.(E)},[v,E]);const C=[(0,n.cY)({mainAxis:a?.[0]??8,crossAxis:a?.[1]??0}),(0,o.UU)({fallbackAxisSideDirection:"end",crossAxis:!1,boundary:document.body}),(0,o.BN)()],{context:y,refs:M,floatingStyles:T}=(0,s.we)({open:E,placement:(0,i.O)(m),onOpenChange:D,middleware:C,whileElementsMounted:o.ll}),I=(0,s.kp)(y),x=(0,s.s9)(y),{getReferenceProps:S,getFloatingProps:O}=(0,s.bv)([x,I]),P=150,L=d(P),U=()=>{D(!1)},R=B=>{B.key==="Tab"&&D(!1)};return g.createElement(g.Fragment,null,g.cloneElement(h,{ref:M.setReference,...S()}),E&&g.createElement(l.ZL,null,g.createElement(r.n1,{autoFocus:!0,restoreFocus:!0,contain:!0},g.createElement("div",{ref:M.setFloating,style:T,onClick:U,onKeyDown:R},g.createElement(u.A,{nodeRef:b,appear:!0,in:!0,timeout:{appear:P,exit:0,enter:0},classNames:L},g.createElement("div",{ref:b},c.renderOrCallToRender(p,{...O()})))))))});f.displayName="Dropdown";const d=h=>({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 ${h}ms cubic-bezier(0.2, 0, 0.2, 1), opacity ${h}ms cubic-bezier(0.2, 0, 0.2, 1)`})})},41670:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({children:g})=>{const u=(0,o.of)(r);return n.createElement("div",{className:u.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)})})},66602:(Q,A,e)=>{"use strict";e.d(A,{Xc:()=>u,Xw:()=>g,tH:()=>r});var t=e(96540),n=e(32631),o=e(42418),s=e(52446);class r extends t.PureComponent{constructor(){super(...arguments),this.state={error:null,errorInfo:null}}componentDidCatch(i,l){n.P?.api?.pushError(i),this.setState({error:i,errorInfo:l}),this.props.onError&&this.props.onError(i)}componentDidUpdate(i){const{dependencies:l,onRecover:f}=this.props;if(this.state.error&&l&&i.dependencies){for(let d=0;d<l.length;d++)if(l[d]!==i.dependencies[d]){this.setState({error:null,errorInfo:null}),f&&f();break}}}render(){const{children:i}=this.props,{error:l,errorInfo:f}=this.state;return i({error:l,errorInfo:f})}}class g extends t.PureComponent{render(){const{title:i,children:l,style:f,dependencies:d}=this.props;return t.createElement(r,{dependencies:d},({error:h,errorInfo:p})=>p?f==="alertbox"?t.createElement(o.F,{title:i||""},t.createElement("details",{style:{whiteSpace:"pre-wrap"}},h&&h.toString(),t.createElement("br",null),p.componentStack)):t.createElement(s.D,{title:i||"",error:h,errorInfo:p}):l)}}g.defaultProps={title:"An unexpected error happened",style:"alertbox"};function u(c,i={}){const l=f=>t.createElement(g,{...i},t.createElement(c,{...f}));return l.displayName="WithErrorBoundary",l}},52446:(Q,A,e)=>{"use strict";e.d(A,{D:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({error:g,errorInfo:u,title:c})=>{const i=(0,o.of)(r);return n.createElement("div",{className:i},n.createElement("h2",null,c),n.createElement("details",{style:{whiteSpace:"pre-wrap"}},g&&g.toString(),n.createElement("br",null),u&&u.componentStack))};s.displayName="ErrorWithStack";const r=()=>(0,t.css)({width:"500px",margin:"64px auto"})},37270:(Q,A,e)=>{"use strict";e.d(A,{gH:()=>d,wI:()=>m});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(20978),g=e(47172),u=e(83195),c=e(40845),i=e(42418),l=e(14578),f=e(95950);function d({options:b,children:C,readAs:y,onLoad:M,fileListRenderer:T,onFileRemove:I}){const[x,S]=(0,s.useState)([]),[O,P]=(0,s.useState)([]),L=(0,u.j_)("decbytes")(b?.maxSize?b?.maxSize:0),U=(0,s.useCallback)((Y,ee)=>{S(re=>re.map(J=>(J.id===Y.id&&ee(J),J)))},[]),R=(0,s.useCallback)((Y,ee,re)=>{let J=Y.map(E);if(b?.multiple===!1?S(J):S(ne=>[...ne,...J]),K(ee),b?.onDrop)b.onDrop(Y,ee,re);else for(const ne of J){const q=new FileReader,te=()=>{y?q[y](ne.file):q.readAsText(ne.file)};U(ne,oe=>{oe.abortUpload=()=>{q.abort()},oe.retryUpload=()=>{U(ne,ue=>{ue.error=null,ue.progress=void 0}),te()}}),q.onabort=()=>{U(ne,oe=>{oe.error=new DOMException("Aborted")})},q.onprogress=oe=>{U(ne,ue=>{ue.progress=oe.loaded})},q.onload=()=>{M?.(q.result)},q.onerror=()=>{U(ne,oe=>{oe.error=q.error})},te()}},[M,b,y,U]),B=Y=>{const ee=x.filter(re=>Y.id!==re.id);S(ee),I?.(Y)},{getRootProps:H,getInputProps:w,isDragActive:N}=(0,r.VB)({...b,useFsAccessApi:!1,onDrop:R,accept:p(b?.accept)}),V=(0,c.$j)(),G=D(V,N),_=x.map(Y=>T?T(Y,B):s.createElement(f.I,{key:Y.id,file:Y,removeFile:B})),K=Y=>{let ee=[];Y.map(re=>{re.errors.map(J=>{ee.findIndex(ne=>ne.code===J.code&&ne.message===J.message)===-1&&ee.push(J)})}),P(ee)},j=Y=>s.createElement("div",{className:G.errorAlert},s.createElement(i.F,{title:"Upload failed",severity:"error",onRemove:k},Y.map(ee=>{switch(ee.code){case g.O4.FileTooLarge:return s.createElement("div",{key:ee.message+ee.code},"File is larger than ",(0,u.cN)(L));default:return s.createElement("div",{key:ee.message+ee.code},ee.message)}}))),k=()=>{P([])};return s.createElement("div",{className:G.container},s.createElement("div",{"data-testid":"dropzone",...H({className:G.dropzone})},s.createElement("input",{...w()}),C??s.createElement(m,{primaryText:a(x,b)})),O.length>0&&j(O),s.createElement("small",{className:(0,t.cx)(G.small,G.acceptContainer)},b?.maxSize&&`Max file size: ${(0,u.cN)(L)}`,b?.maxSize&&b?.accept&&s.createElement("span",{className:G.acceptSeparator},"|"),b?.accept&&v(b.accept)),_)}function h(b){return["txt","json","csv","xls","yml"].some(C=>b.match(C))?"text/plain":"application/octet-stream"}function p(b){return(0,n.isString)(b)?{[h(b)]:[b]}:Array.isArray(b)?b.reduce((C,y)=>{const M=h(y);return C[M]=C[M]?[...C[M],y]:[y],C},{}):b}function m({primaryText:b="Drop file here or click to upload",secondaryText:C=""}){const y=(0,c.$j)(),M=D(y);return s.createElement("div",{className:(0,t.cx)(M.defaultDropZone),"data-testid":"file-drop-zone-default-children"},s.createElement(l.I,{className:(0,t.cx)(M.icon),name:"upload",size:"xl"}),s.createElement("h6",{className:(0,t.cx)(M.primaryText)},b),s.createElement("small",{className:M.small},C))}function a(b,C){return C?.multiple===void 0||C?.multiple?"Upload file":b.length?"Replace file":"Upload file"}function v(b){return(0,n.isString)(b)?`Accepted file type: ${b}`:Array.isArray(b)?`Accepted file types: ${b.join(", ")}`:`Accepted file types: ${Object.values(b).flat().join(", ")}`}function E(b){return{id:(0,n.uniqueId)("file"),file:b,error:null}}function D(b,C){return{container:(0,t.css)({display:"flex",flexDirection:"column",width:"100%",padding:b.spacing(2),borderRadius:b.shape.radius.default,border:`1px dashed ${b.colors.border.strong}`,backgroundColor:C?b.colors.background.secondary:b.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:b.spacing(1)}),primaryText:(0,t.css)({marginBottom:b.spacing(1)}),acceptContainer:(0,t.css)({textAlign:"center",margin:0}),acceptSeparator:(0,t.css)({margin:`0 ${b.spacing(1)}`}),small:(0,t.css)({color:b.colors.text.secondary}),errorAlert:(0,t.css)({paddingTop:"10px"})}}},95950:(Q,A,e)=>{"use strict";e.d(A,{I:()=>l});var t=e(32196),n=e(96540),o=e(83195),s=e(40845),r=e(53550),g=e(55852),u=e(14578),c=e(29158);const i="Remove file";function l({file:d,removeFile:h}){const p=(0,s.of)(f),{file:m,progress:a,error:v,abortUpload:E,retryUpload:D}=d,b=()=>v?n.createElement(n.Fragment,null,n.createElement("span",{className:p.error},v.message),D&&n.createElement(c.K,{name:"sync",tooltip:"Retry",tooltipPlacement:"top",onClick:D}),h&&n.createElement(c.K,{className:D?p.marginLeft:"",name:"trash-alt",onClick:()=>h(d),tooltip:i})):a&&m.size>a?n.createElement(n.Fragment,null,n.createElement("progress",{className:p.progressBar,max:m.size,value:a}),n.createElement("span",{className:p.paddingLeft},Math.round(a/m.size*100),"%"),E&&n.createElement(g.$n,{variant:"secondary",type:"button",fill:"text",onClick:E},"Cancel upload")):h&&n.createElement(c.K,{name:"trash-alt",onClick:()=>h(d),tooltip:i,tooltipPlacement:"top"}),C=(0,o.j_)("decbytes")(m.size);return n.createElement("div",{className:p.fileListContainer},n.createElement("span",{className:p.fileNameWrapper},n.createElement(u.I,{name:"file-blank",size:"lg","aria-hidden":!0}),n.createElement("span",{className:p.padding},(0,r.i)(m.name)),n.createElement("span",null,(0,o.cN)(C))),n.createElement("div",{className:p.fileNameWrapper},b()))}function f(d){return{fileListContainer:(0,t.css)({width:"100%",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:d.spacing(2),border:`1px dashed ${d.colors.border.medium}`,backgroundColor:`${d.colors.background.secondary}`,marginTop:d.spacing(1)}),fileNameWrapper:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"center"}),padding:(0,t.css)({padding:d.spacing(0,1)}),paddingLeft:(0,t.css)({paddingLeft:d.spacing(2)}),marginLeft:(0,t.css)({marginLeft:d.spacing(1)}),error:(0,t.css)({paddingRight:d.spacing(2),color:d.colors.error.text}),progressBar:(0,t.css)({borderRadius:d.shape.radius.default,height:"4px","::-webkit-progress-bar":{backgroundColor:d.colors.border.weak,borderRadius:d.shape.radius.default},"::-webkit-progress-value":{backgroundColor:d.colors.primary.main,borderRadius:d.shape.radius.default}})}}},92887:(Q,A,e)=>{"use strict";e.d(A,{IB:()=>n.I,gH:()=>t.gH,wI:()=>t.wI});var t=e(37270),n=e(95950)},73546:(Q,A,e)=>{"use strict";e.d(A,{e:()=>l});var t=e(32196),n=e(96540),o=e(62938),s=e(13544),r=e(40845),g=e(16797),u=e(53550),c=e(55852),i=e(14578);const l=({onFileUpload:d,className:h,children:p="Upload file",accept:m="*",size:a="md",showFileName:v})=>{const E=(0,r.of)(f(a)),[D,b]=(0,n.useState)(""),C=(0,o.A)(),y=(0,n.useCallback)(M=>{const T=M.currentTarget?.files?.[0];T&&b(T.name??""),d(M)},[d]);return n.createElement(n.Fragment,null,n.createElement("input",{type:"file",id:C,className:E.fileUpload,onChange:y,multiple:!1,accept:m,"data-testid":s.Tp.components.FileUpload.inputField}),n.createElement("label",{htmlFor:C,className:(0,t.cx)(E.labelWrapper,h)},n.createElement(i.I,{name:"upload",className:E.icon}),p),v&&D&&n.createElement("span",{"aria-label":"File name",className:E.fileName,"data-testid":s.Tp.components.FileUpload.fileNameSpan},(0,u.i)(D)))},f=d=>h=>{const p=(0,c.hs)({theme:h,variant:"primary",size:d,iconOnly:!1}),m=(0,g.getFocusStyles)(h);return{fileUpload:(0,t.css)({height:"0.1px",opacity:"0",overflow:"hidden",position:"absolute",width:"0.1px",zIndex:-1,"&:focus + label":m,"&:focus-visible + label":m}),labelWrapper:p.button,icon:p.icon,fileName:(0,t.css)({marginLeft:h.spacing(.5)})}}},67647:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>u});var t=e(96540),n=e(54479);function o(...c){const i=t.useRef(null);return t.useEffect(()=>{c.forEach(l=>{l&&(typeof l=="function"?l(i.current):l.current=i.current)})},[c]),i}var s=e(55852),r=e(14578),g=e(10354);const u=t.forwardRef(({value:c,width:i,onChange:l,escapeRegex:f=!0,...d},h)=>{const p=t.useRef(null),m=o(h,p),a=c!==""?t.createElement(s.$n,{icon:"times",fill:"text",size:"sm",onClick:v=>{p.current?.focus(),l(""),v.stopPropagation()}},"Clear"):null;return t.createElement(g.p,{prefix:t.createElement(r.I,{name:"search"}),suffix:a,width:i,type:"text",value:f?(0,n.xb)(c??""):c,onChange:v=>l(f?(0,n.jD)(v.currentTarget.value):v.currentTarget.value),...d,ref:m})});u.displayName="FilterInput"},92174:(Q,A,e)=>{"use strict";e.d(A,{m:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(55852),r=e(14578);const g=({label:c,selected:i,onClick:l,icon:f="check"})=>{const d=(0,o.of)(u),h=(0,o.of)(s.my);return n.createElement("button",{type:"button",className:(0,t.cx)(h,d.wrapper,i&&d.selected),onClick:l},n.createElement("span",null,c),i&&n.createElement(r.I,{name:f,className:d.icon}))},u=c=>({wrapper:(0,t.css)({background:c.colors.background.secondary,borderRadius:c.shape.radius.pill,padding:c.spacing(0,2),fontSize:c.typography.bodySmall.fontSize,fontWeight:c.typography.fontWeightMedium,lineHeight:c.typography.bodySmall.lineHeight,color:c.colors.text.secondary,display:"flex",alignItems:"center",height:"32px",position:"relative",border:`1px solid ${c.colors.background.secondary}`,whiteSpace:"nowrap","&:hover":{background:c.colors.action.hover,color:c.colors.text.primary}}),selected:(0,t.css)({color:c.colors.text.primary,background:c.colors.action.selected,"&:hover":{background:c.colors.action.focus}}),icon:(0,t.css)({marginLeft:c.spacing(.5)})})},90090:(Q,A,e)=>{"use strict";e.d(A,{z:()=>r});var t=e(32196),n=e(96540),o=e(38894);const s={labelWidth:6,inputWidth:12},r=({label:u,tooltip:c,labelWidth:i,inputWidth:l,inputEl:f,className:d,interactive:h,...p})=>{const m=g();return n.createElement("div",{className:(0,t.cx)(m.formField,d)},n.createElement(o.I,{width:i,tooltip:c,interactive:h},u),f||n.createElement("input",{type:"text",className:`gf-form-input ${l?`width-${l}`:""}`,...p,disabled:p.disabled}))};r.displayName="FormField",r.defaultProps=s;const g=()=>({formField:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"flex-start",textAlign:"left",position:"relative"})})},38894:(Q,A,e)=>{"use strict";e.d(A,{I:()=>u});var t=e(46942),n=e.n(t),o=e(96540),s=e(14578),r=e(56034);const u=({children:c,isFocused:i,isInvalid:l,className:f,htmlFor:d,tooltip:h,width:p,interactive:m,...a})=>{const v=n()(f,`gf-form-label width-${p||"10"}`,{"gf-form-label--is-focused":i,"gf-form-label--is-invalid":l});return o.createElement("label",{className:v,...a,htmlFor:d},c,h&&o.createElement(r.m,{placement:"top",content:h,theme:"info",interactive:m},o.createElement(s.I,{name:"info-circle",size:"sm",style:{marginLeft:"10px"}})))}},9286:(Q,A,e)=>{"use strict";e.d(A,{i:()=>o});var t=e(96540);function n(s){return s<20?.9:s<26?.8:.6}const o=({value:s,className:r,style:g,...u})=>{const c=(s.prefix??"").length>0,i=(s.suffix??"").length>0;let l;if(g&&g.fontSize&&typeof g.fontSize=="number"){const f=g.fontSize,d=n(f);l={fontSize:f*d}}return t.createElement("div",{className:r,style:g,...u},t.createElement("div",null,c&&t.createElement("span",null,s.prefix),t.createElement("span",null,s.text),i&&t.createElement("span",{style:l},s.suffix)))};o.displayName="FormattedDisplayValue"},10880:(Q,A,e)=>{"use strict";e.d(A,{S:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(16797),r=e(60029);const g=n.forwardRef(({label:c,description:i,value:l,htmlValue:f,onChange:d,disabled:h,className:p,indeterminate:m,invalid:a,...v},E)=>{const D=(0,n.useCallback)(y=>{d&&d(y)},[d]),b=(0,o.of)(u,a),C=m?"mixed":void 0;return n.createElement("label",{className:(0,t.cx)(b.wrapper,p)},n.createElement("div",{className:b.checkboxWrapper},n.createElement("input",{type:"checkbox",className:(0,t.cx)(b.input,m&&b.inputIndeterminate),checked:l,disabled:h,onChange:D,value:f,"aria-checked":C,...v,ref:E}),n.createElement("span",{className:b.checkmark})),c&&n.createElement("span",{className:b.label},c),i&&n.createElement("span",{className:b.description},i))}),u=(c,i=!1)=>{const l=(0,r.f)(c),f=2,d=1,h=p=>i?c.colors.error.border:p;return{wrapper:(0,t.css)({display:"inline-grid",alignItems:"center",columnGap:c.spacing(d),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)(c),"&:focus:not(:focus-visible) + span":(0,s.getMouseFocusStyles)(c),"&:checked + span":{background:c.colors.primary.main,border:`1px solid ${h(c.colors.primary.main)}`,"&:hover":{background:c.colors.primary.shade},"&:after":{content:'""',position:"absolute",zIndex:2,left:"4px",top:0,width:"6px",height:"12px",border:`solid ${c.colors.primary.contrastText}`,borderWidth:"0 3px 3px 0",transform:"rotate(45deg)"}},"&:disabled + span":{backgroundColor:c.colors.action.disabledBackground,cursor:"not-allowed",border:`1px solid ${h(c.colors.action.disabledBackground)}`,"&:hover":{backgroundColor:c.colors.action.disabledBackground},"&:after":{borderColor:c.colors.action.disabledText}}}),inputIndeterminate:(0,t.css)({"&[aria-checked='mixed'] + span":{border:`1px solid ${h(c.colors.primary.main)}`,background:c.colors.primary.main,"&:hover":{background:c.colors.primary.shade},"&:after":{content:'""',position:"absolute",zIndex:2,left:"2px",right:"2px",top:"calc(50% - 1.5px)",height:"3px",border:`1.5px solid ${c.colors.primary.contrastText}`,backgroundColor:c.colors.primary.contrastText,width:"auto",transform:"none"}},"&:disabled[aria-checked='mixed'] + span":{backgroundColor:c.colors.action.disabledBackground,border:`1px solid ${h(c.colors.error.transparent)}`,"&:after":{borderColor:c.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:c.spacing(f),height:c.spacing(f),borderRadius:c.shape.radius.default,background:c.components.input.background,border:`1px solid ${h(c.components.input.borderColor)}`,"&:hover":{cursor:"pointer",borderColor:h(c.components.input.borderHover)}}),label:(0,t.cx)(l.label,(0,t.css)({gridColumnStart:2,gridRowStart:1,position:"relative",zIndex:2,cursor:"pointer",maxWidth:"fit-content",lineHeight:c.typography.bodySmall.lineHeight,marginBottom:0})),description:(0,t.cx)(l.description,(0,t.css)({gridColumnStart:2,gridRowStart:2,lineHeight:c.typography.bodySmall.lineHeight,marginTop:0}))}};g.displayName="Checkbox"},88575:(Q,A,e)=>{"use strict";e.d(A,{D:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(67892),r=e(72093),g=e(60029);const u=n.forwardRef(({label:l,description:f,horizontal:d,invalid:h,loading:p,disabled:m,required:a,error:v,children:E,className:D,validationMessageHorizontalOverflow:b,htmlFor:C,...y},M)=>{const T=(0,o.of)(i),I=C??(0,s.getChildId)(E),x=typeof l=="string"?n.createElement(g.J,{htmlFor:I,description:f},`${l}${a?" *":""}`):l,S=c({invalid:h,disabled:m,loading:p});return n.createElement("div",{className:(0,t.cx)(T.field,d&&T.fieldHorizontal,D),...y},x,n.createElement("div",null,n.createElement("div",{ref:M},n.cloneElement(E,S)),h&&v&&!d&&n.createElement("div",{className:(0,t.cx)(T.fieldValidationWrapper,{[T.validationMessageHorizontalOverflow]:!!b})},n.createElement(r.P,null,v))),h&&v&&d&&n.createElement("div",{className:(0,t.cx)(T.fieldValidationWrapper,T.fieldValidationWrapperHorizontal,{[T.validationMessageHorizontalOverflow]:!!b})},n.createElement(r.P,null,v)))});u.displayName="Field";function c(l){for(const f in l)l[f]===void 0&&delete l[f];return l}const i=l=>({field:(0,t.css)({display:"flex",flexDirection:"column",marginBottom:l.spacing(2)}),fieldHorizontal:(0,t.css)({flexDirection:"row",justifyContent:"space-between",flexWrap:"wrap"}),fieldValidationWrapper:(0,t.css)({marginTop:l.spacing(.5)}),fieldValidationWrapperHorizontal:(0,t.css)({flex:"1 1 100%"}),validationMessageHorizontalOverflow:(0,t.css)({width:0,overflowX:"visible","& > *":{whiteSpace:"nowrap"}})})},95984:(Q,A,e)=>{"use strict";e.d(A,{E:()=>n});var t=e(49785);const n=({name:o,control:s,children:r,...g})=>{const{fields:u,append:c,prepend:i,remove:l,swap:f,move:d,insert:h}=(0,t.jz)({control:s,name:o,...g});return r({fields:u,append:c,prepend:i,remove:l,swap:f,move:d,insert:h})}},84167:(Q,A,e)=>{"use strict";e.d(A,{n:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(17408);const r=({label:u,children:c,className:i,...l})=>{const f=(0,o.of)(g);return n.createElement("fieldset",{className:(0,t.cx)(f.wrapper,i),...l},u&&n.createElement(s.s,null,u),c)},g=u=>({wrapper:(0,t.css)({marginBottom:u.spacing(4),"&:last-child":{marginBottom:0}})})},72093:(Q,A,e)=>{"use strict";e.d(A,{P:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(14578);const r=({children:u,horizontal:c,className:i})=>{const l=(0,o.of)(g),f=(0,t.cx)(c?l.horizontal:l.vertical,i);return n.createElement("div",{role:"alert",className:f},n.createElement(s.I,{className:l.fieldValidationMessageIcon,name:"exclamation-triangle"}),u)},g=u=>{const c=` font-size: ${u.typography.size.sm}; font-weight: ${u.typography.fontWeightMedium}; padding: ${u.spacing(.5,1)}; color: ${u.colors.error.contrastText}; background: ${u.colors.error.main}; border-radius: ${u.shape.radius.default}; position: relative; display: inline-block; align-self: flex-start; a { color: ${u.colors.error.contrastText}; text-decoration: underline; } a:hover { text-decoration: none; } `;return{vertical:(0,t.css)(c,{margin:u.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 ${u.colors.error.main} transparent`,borderStyle:"solid"}}),horizontal:(0,t.css)(c,{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:u.spacing()})}}},51253:(Q,A,e)=>{"use strict";e.d(A,{l:()=>s});var t=e(32196),n=e(96540),o=e(49785);function s({defaultValues:r,onSubmit:g,validateOnMount:u=!1,validateFieldsOnMount:c,children:i,validateOn:l="onSubmit",maxWidth:f=600,...d}){const{handleSubmit:h,trigger:p,formState:m,...a}=(0,o.mN)({mode:l,defaultValues:r});return(0,n.useEffect)(()=>{u&&p(c)},[p,c,u]),n.createElement("form",{className:(0,t.css)({maxWidth:f!=="none"?f+"px":f,width:"100%"}),onSubmit:h(g),...d},i({errors:m.errors,formState:m,trigger:p,...a}))}},14186:(Q,A,e)=>{"use strict";e.d(A,{I:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(67892),r=e(72093),g=e(76892);const u=({children:i,label:l,tooltip:f,labelWidth:d="auto",invalid:h,loading:p,disabled:m,required:a,className:v,htmlFor:E,grow:D,shrink:b,error:C,transparent:y,interactive:M,...T})=>{const I=(0,o.$j)(),x=c(I,D,b),S=E??(0,s.getChildId)(i),O=typeof l=="string"?n.createElement(g.c,{interactive:M,width:d,tooltip:f,htmlFor:S,transparent:y},`${l}${a?" *":""}`):l;return n.createElement("div",{className:(0,t.cx)(x.container,v),...T},O,n.createElement("div",{className:x.childContainer},n.cloneElement(i,{invalid:h,disabled:m,loading:p}),h&&C&&n.createElement("div",{className:(0,t.cx)(x.fieldValidationWrapper)},n.createElement(r.P,null,C))))};u.displayName="InlineField";const c=(i,l,f)=>({container:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"flex-start",textAlign:"left",position:"relative",flex:`${l?1:0} ${f?1:0} auto`,margin:`0 ${i.spacing(.5)} ${i.spacing(.5)} 0`}),childContainer:(0,t.css)({flex:`${l?1:0} ${f?1:0} auto`}),fieldValidationWrapper:(0,t.css)({marginTop:i.spacing(.5)})})},39268:(Q,A,e)=>{"use strict";e.d(A,{C:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({children:g,className:u,...c})=>{const i=(0,o.of)(r);return n.createElement("div",{className:(0,t.cx)(i.container,u),...c},g)},r=g=>({container:(0,t.css)({label:"InlineFieldRow",display:"flex",flexDirection:"row",flexWrap:"wrap",alignContent:"flex-start",rowGap:g.spacing(.5)})})},76892:(Q,A,e)=>{"use strict";e.d(A,{c:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(14578),r=e(56034);const g=({children:c,className:i,tooltip:l,width:f,transparent:d,interactive:h,as:p="label",...m})=>{const a=(0,o.of)(u,d,f);return n.createElement(p,{className:(0,t.cx)(a.label,i),...m},c,l&&n.createElement(r.m,{interactive:h,placement:"top",content:l,theme:"info"},n.createElement(s.I,{tabIndex:0,name:"info-circle",size:"sm",className:a.icon})))},u=(c,i=!1,l)=>({label:(0,t.css)({display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0,padding:c.spacing(0,1),fontWeight:c.typography.fontWeightMedium,fontSize:c.typography.size.sm,backgroundColor:i?"transparent":c.colors.background.secondary,height:c.spacing(c.components.height.md),lineHeight:c.spacing(c.components.height.md),marginRight:c.spacing(.5),borderRadius:c.shape.radius.default,border:"none",width:l?l!=="auto"?`${8*l}px`:l:"100%",color:c.colors.text.primary}),icon:(0,t.css)({color:c.colors.text.secondary,marginLeft:"10px",":hover":{color:c.colors.text.primary}})})},63056:(Q,A,e)=>{"use strict";e.d(A,{e:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({children:g,className:u,grow:c,...i})=>{const l=(0,o.of)(r,c);return n.createElement("div",{className:(0,t.cx)(l.container,u),...i},g)};s.displayName="InlineSegmentGroup";const r=(g,u)=>({container:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"flex-start",textAlign:"left",position:"relative",flex:`${u?1:0} 0 auto`,marginBottom:g.spacing(.5)})})},60029:(Q,A,e)=>{"use strict";e.d(A,{J:()=>r,f:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(14578);const r=({children:u,description:c,className:i,category:l,...f})=>{const d=(0,o.of)(g),h=l?.map((p,m)=>n.createElement("span",{className:d.categories,key:`${p}/${m}`},n.createElement("span",null,p),n.createElement(s.I,{name:"angle-right",className:d.chevron})));return n.createElement("div",{className:(0,t.cx)(d.label,i)},n.createElement("label",{...f},n.createElement("div",{className:d.labelContent},h,u),c&&n.createElement("span",{className:d.description},c)))},g=u=>({label:(0,t.css)({label:"Label",fontSize:u.typography.size.sm,fontWeight:u.typography.fontWeightMedium,lineHeight:1.25,marginBottom:u.spacing(.5),color:u.colors.text.primary,maxWidth:"480px"}),labelContent:(0,t.css)({display:"flex",alignItems:"center"}),description:(0,t.css)({label:"Label-description",color:u.colors.text.secondary,fontSize:u.typography.size.sm,fontWeight:u.typography.fontWeightRegular,marginTop:u.spacing(.25),display:"block"}),categories:(0,t.css)({label:"Label-categories",display:"inline-flex",alignItems:"center"}),chevron:(0,t.css)({margin:u.spacing(0,.25)})})},91634:(Q,A,e)=>{"use strict";e.d(A,{O:()=>r,p:()=>g});var t=e(46942),n=e.n(t),o=e(96540),s=e(29734),r=(u=>(u.Invalid="invalid",u.Valid="valid",u))(r||{});class g extends o.PureComponent{constructor(){super(...arguments),this.state={error:null},this.validatorAsync=c=>i=>{const l=(0,s.tf)(i.target.value,c);this.setState(f=>({...f,error:l?l[0]:null}))},this.populateEventPropsWithStatus=(c,i)=>{const l={...c};return i&&Object.keys(s.Pw).forEach(f=>{((0,s.K)(f,i)||c[f])&&(l[f]=async d=>{d.persist(),(0,s.K)(f,i)&&await this.validatorAsync(i[f]).apply(this,[d]),c[f]&&c[f].apply(null,[d,this.status])})}),l}}get status(){return this.state.error?"invalid":"valid"}get isInvalid(){return this.status==="invalid"}render(){const{validationEvents:c,className:i,hideErrorMessage:l,inputRef:f,...d}=this.props,{error:h}=this.state,p=n()("gf-form-input",{invalid:this.isInvalid},i),m=this.populateEventPropsWithStatus(d,c);return o.createElement("div",{style:{flexGrow:1}},o.createElement("input",{...m,ref:f,className:p}),h&&!l&&o.createElement("span",null,h))}}g.defaultProps={className:""}},24169:(Q,A,e)=>{"use strict";e.d(A,{A:()=>r,s:()=>s});var t=e(96540),n=e(28581),o=e(14578);const s=g=>{const u=g.selectProps.menuIsOpen;return t.createElement(n.c.IndicatorsContainer,{...g},t.createElement(o.I,{name:u?"angle-up":"angle-down",style:{marginTop:"7px"}}))},r=s},11206:(Q,A,e)=>{"use strict";e.d(A,{A:()=>s,l:()=>o});var t=e(96540),n=e(28581);const o=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=o},99091:(Q,A,e)=>{"use strict";e.d(A,{DW:()=>y,l6:()=>C});var t=e(46942),n=e.n(t),o=e(96540),s=e(28581),r=e(46005),g=e(8539),u=e(66963),c=e(60578),i=e(40276),l=e(80970),f=e(62235),d=e(23731),h=e(56034),p=e(24169),m=e(11206),a=e(14578);const v=I=>{const{children:x,isSelected:S,data:O}=I;return o.createElement(s.c.Option,{...I},o.createElement("div",{className:"gf-form-select-box__desc-option"},O.imgUrl&&o.createElement("img",{className:"gf-form-select-box__desc-option__img",src:O.imgUrl,alt:""}),o.createElement("div",{className:"gf-form-select-box__desc-option__body"},o.createElement("div",null,x),O.description&&o.createElement("div",{className:"gf-form-select-box__desc-option__desc"},O.description)),S&&o.createElement(a.I,{name:"check","aria-hidden":"true"})))},E=null,D=I=>o.createElement(s.c.MenuList,{...I},o.createElement(i.E,{autoHide:!1,autoHeightMax:"inherit"},I.children)),b=class extends o.PureComponent{render(){const{defaultValue:I,getOptionLabel:x,getOptionValue:S,onChange:O,options:P,placeholder:L,width:U,value:R,className:B,isDisabled:H,isLoading:w,isSearchable:N,isClearable:V,backspaceRemovesValue:G,isMulti:_,autoFocus:K,openMenuOnFocus:j,onBlur:k,maxMenuHeight:Y,noOptionsMessage:ee,isOpen:re,components:J,tooltipContent:ne,tabSelectsValue:q,onCloseMenu:te,onOpenMenu:oe,allowCustomValue:ue,formatCreateLabel:ie,"aria-label":ge}=this.props;let he="";U&&(he="width-"+U);let De=r.Ay;const pe={};ue&&(De=u.A,pe.formatCreateLabel=ie??(Ee=>Ee));const le=n()("gf-form-input","gf-form-input--form-dropdown",he,B),Te={...b.defaultProps.components,...J};return o.createElement(M,{onCloseMenu:te,onOpenMenu:oe,tooltipContent:ne,isOpen:re},(Ee,Re)=>o.createElement(De,{captureMenuScroll:!1,classNamePrefix:"gf-form-select-box",className:le,components:Te,defaultValue:I,value:R,getOptionLabel:x,getOptionValue:S,menuShouldScrollIntoView:!1,isSearchable:N,onChange:O,options:P,placeholder:L||"Choose",styles:(0,d.A)(this.context),isDisabled:H,isLoading:w,isClearable:V,autoFocus:K,onBlur:k,openMenuOnFocus:j,maxMenuHeight:Y,noOptionsMessage:ee,isMulti:_,backspaceRemovesValue:G,menuIsOpen:re,onMenuOpen:Ee,onMenuClose:Re,tabSelectsValue:q,"aria-label":ge,...pe}))}};let C=b;C.contextType=c.D,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:v,SingleValue:f.K,IndicatorsContainer:p.A,MenuList:D,Group:l.n}};class y extends o.PureComponent{render(){const{defaultValue:x,getOptionLabel:S,getOptionValue:O,onChange:P,placeholder:L,width:U,value:R,className:B,loadOptions:H,defaultOptions:w,isLoading:N,loadingMessage:V,noOptionsMessage:G,isDisabled:_,isSearchable:K,isClearable:j,backspaceRemovesValue:k,autoFocus:Y,onBlur:ee,openMenuOnFocus:re,maxMenuHeight:J,isMulti:ne,tooltipContent:q,onCloseMenu:te,onOpenMenu:oe,isOpen:ue}=this.props;let ie="";U&&(ie="width-"+U);const ge=n()("gf-form-input","gf-form-input--form-dropdown",ie,B);return o.createElement(M,{onCloseMenu:te,onOpenMenu:oe,tooltipContent:q,isOpen:ue},(he,De)=>o.createElement(g.A,{captureMenuScroll:!1,classNamePrefix:"gf-form-select-box",className:ge,components:{Option:v,SingleValue:f.K,IndicatorsContainer:p.A,NoOptionsMessage:m.A},defaultValue:x,value:R,getOptionLabel:S,getOptionValue:O,menuShouldScrollIntoView:!1,onChange:P,loadOptions:H,isLoading:N,defaultOptions:w,placeholder:L||"Choose",styles:(0,d.A)(this.context),loadingMessage:V,noOptionsMessage:G,isDisabled:_,isSearchable:K,isClearable:j,autoFocus:Y,onBlur:ee,openMenuOnFocus:re,maxMenuHeight:J,isMulti:ne,backspaceRemovesValue:k}))}}y.contextType=c.D,y.defaultProps={className:"",components:{},loadingMessage:()=>"Loading...",isDisabled:!1,isClearable:!1,isMulti:!1,isSearchable:!0,backspaceRemovesValue:!0,autoFocus:!1,openMenuOnFocus:!1,maxMenuHeight:300};class M extends o.PureComponent{constructor(){super(...arguments),this.state={isOpenInternal:!1},this.onOpenMenu=()=>{const{onOpenMenu:x}=this.props;x&&x(),this.setState({isOpenInternal:!0})},this.onCloseMenu=()=>{const{onCloseMenu:x}=this.props;x&&x(),this.setState({isOpenInternal:!1})}}render(){const{children:x,isOpen:S,tooltipContent:O}=this.props,{isOpenInternal:P}=this.state;let L;return(P||S)&&(L=!1),O?o.createElement(h.m,{show:L,content:O,placement:"bottom"},o.createElement("div",null,x(this.onOpenMenu,this.onCloseMenu))):o.createElement("div",null,x(this.onOpenMenu,this.onCloseMenu))}}const T=null},74716:(Q,A,e)=>{"use strict";e.d(A,{d:()=>g});var t=e(2543),n=e.n(t),o=e(96540),s=e(14578),r=e(56034);class g extends o.PureComponent{constructor(){super(...arguments),this.state={id:(0,t.uniqueId)()},this.internalOnChange=c=>{c.stopPropagation(),this.props.onChange(c)}}render(){const{labelClass:c="",switchClass:i="",label:l,checked:f,disabled:d,transparent:h,className:p,tooltip:m,tooltipPlacement:a}=this.props,v=this.state.id,E=`gf-form-label ${c} ${h?"gf-form-label--transparent":""} pointer`,D=`gf-form-switch ${i} ${h?"gf-form-switch--transparent":""}`;return o.createElement("div",{className:"gf-form-switch-container-react"},o.createElement("label",{htmlFor:v,className:`gf-form gf-form-switch-container ${p||""}`},l&&o.createElement("div",{className:E},l,m&&o.createElement(r.m,{placement:a||"auto",content:m,theme:"info"},o.createElement(s.I,{name:"info-circle",size:"sm",style:{marginLeft:"10px"}}))),o.createElement("div",{className:D},o.createElement("input",{disabled:d,id:v,type:"checkbox",checked:f,onChange:this.internalOnChange}),o.createElement("span",{className:"gf-form-switch__slider"}))))}}},17408:(Q,A,e)=>{"use strict";e.d(A,{s:()=>r});var t=e(32196),n=e(96540),o=e(40845);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:u,...c})=>{const i=(0,o.of)(s);return n.createElement("legend",{className:(0,t.cx)(i.legend,u),...c},g)}},94354:(Q,A,e)=>{"use strict";e.d(A,{z:()=>h});var t=e(32196),n=e(2543),o=e(96540),s=e(8887),r=e(40845),g=e(14578),u=e(13544),c=e(16797),i=e(56034),l=e(87266);const f=o.forwardRef(({children:m,active:a=!1,disabled:v=!1,size:E="md",onChange:D,onClick:b,id:C,name:y=void 0,description:M,fullWidth:T,"aria-label":I},x)=>{const S=(0,r.of)(d,E,T),O=o.createElement("input",{type:"radio",className:S.radio,onChange:D,onClick:b,disabled:v,id:C,checked:a,name:y,"aria-label":I,ref:x});return M?o.createElement("div",{className:S.radioOption,"data-testid":u.Tp.components.RadioButton.container},o.createElement(i.m,{content:M,placement:"bottom"},O),o.createElement("label",{className:S.radioLabel,htmlFor:C,title:M||I},m)):o.createElement("div",{className:S.radioOption,"data-testid":u.Tp.components.RadioButton.container},O,o.createElement("label",{className:S.radioLabel,htmlFor:C,title:M||I},m))});f.displayName="RadioButton";const d=(m,a,v)=>{const{fontSize:E,height:D,padding:b}=(0,l.SM)(a,m),C=m.colors.text.secondary,y=m.colors.text.primary,M=D*m.spacing.gridSize-4-2;return{radioOption:(0,t.css)({display:"flex",justifyContent:"space-between",position:"relative",flex:v?"1 0 0":"none",textAlign:"center"}),radio:(0,t.css)({position:"absolute",opacity:0,zIndex:2,width:"100% !important",height:"100%",cursor:"pointer","&:checked + label":{color:m.colors.text.primary,fontWeight:m.typography.fontWeightMedium,background:m.colors.action.selected,zIndex:1},"&:focus + label, &:focus-visible + label":(0,c.getFocusStyles)(m),"&:focus:not(:focus-visible) + label":(0,c.getMouseFocusStyles)(m),"&:disabled + label":{color:m.colors.text.disabled,cursor:"not-allowed"}}),radioLabel:(0,t.css)({display:"flex",alignItems:"center",justifyContent:"center",fontSize:E,height:`${M}px`,lineHeight:`${M}px`,color:C,padding:m.spacing(0,b),borderRadius:m.shape.radius.default,background:m.colors.background.primary,cursor:"pointer",userSelect:"none",whiteSpace:"nowrap",flexGrow:1,"&:hover":{color:y}})}};function h({options:m,value:a,onChange:v,onClick:E,disabled:D,disabledOptions:b,size:C="md",id:y,className:M,fullWidth:T=!1,autoFocus:I=!1,"aria-label":x,invalid:S=!1}){const O=(0,o.useCallback)(H=>()=>{v&&v(H.value)},[v]),P=(0,o.useCallback)(H=>()=>{E&&E(H.value)},[E]),L=y??(0,n.uniqueId)("radiogroup-"),U=(0,o.useRef)(L),R=(0,r.of)(p),B=(0,o.useRef)(null);return(0,o.useEffect)(()=>{I&&B.current&&B.current.focus()},[I]),o.createElement("div",{role:"radiogroup","aria-label":x,className:(0,t.cx)(R.radioGroup,T&&R.fullWidth,S&&R.invalid,M)},m.map((H,w)=>{const N=b&&H.value&&b.includes(H.value),V=H.icon?(0,s.Uo)(H.icon):void 0,G=!!(H.imgUrl||H.label||H.component);return o.createElement(f,{size:C,disabled:N||D,active:a===H.value,key:`o.label-${w}`,"aria-label":H.ariaLabel,onChange:O(H),onClick:P(H),id:`option-${H.value}-${L}`,name:U.current,description:H.description,fullWidth:T,ref:a===H.value?B:void 0},V&&o.createElement(g.I,{name:V,className:(0,t.cx)(G&&R.icon)}),H.imgUrl&&o.createElement("img",{src:H.imgUrl,alt:H.label,className:R.img}),H.label," ",H.component?o.createElement(H.component,null):null)}))}h.displayName="RadioButtonGroup";const p=m=>({radioGroup:(0,t.css)({display:"inline-flex",flexDirection:"row",flexWrap:"nowrap",border:`1px solid ${m.components.input.borderColor}`,borderRadius:m.shape.radius.default,padding:"2px"}),fullWidth:(0,t.css)({display:"flex"}),icon:(0,t.css)({marginRight:"6px"}),img:(0,t.css)({width:m.spacing(2),height:m.spacing(2),marginRight:m.spacing(1)}),invalid:(0,t.css)({border:`1px solid ${m.colors.error.border}`})})},5173:(Q,A,e)=>{"use strict";e.d(A,{a:()=>u});var t=e(32196),n=e(2543),o=e(96540),s=e(40845);const r=({id:i,name:l,label:f,checked:d,value:h,disabled:p,description:m,onChange:a})=>{const v=(0,s.of)(g);return o.createElement("label",{title:m,className:v.label},o.createElement("input",{id:i,name:l,type:"radio",checked:d,value:h,disabled:p,className:v.input,onChange:()=>a&&a(i)}),o.createElement("div",null,f,m&&o.createElement("div",{className:v.description},m)))},g=i=>({input:(0,t.css)({position:"relative",appearance:"none",outline:"none",backgroundColor:i.colors.background.canvas,width:`${i.spacing(2)} !important`,height:i.spacing(2),border:`1px solid ${i.colors.border.medium}`,borderRadius:i.shape.radius.circle,margin:"3px 0",":checked":{backgroundColor:i.v1.palette.white,border:`5px solid ${i.colors.primary.main}`},":disabled":{backgroundColor:`${i.colors.action.disabledBackground} !important`,borderColor:i.colors.border.weak},":disabled:checked":{border:`1px solid ${i.colors.border.weak}`},":disabled:checked::after":{content:'""',width:"6px",height:"6px",backgroundColor:i.colors.text.disabled,borderRadius:i.shape.radius.circle,display:"inline-block",position:"absolute",top:"4px",left:"4px"},":focus":{outline:"none !important",boxShadow:`0 0 0 1px ${i.colors.background.canvas}, 0 0 0 3px ${i.colors.primary.main}`}}),label:(0,t.css)({fontSize:i.typography.fontSize,lineHeight:"22px",display:"grid",gridTemplateColumns:`${i.spacing(2)} auto`,gap:i.spacing(1)}),description:(0,t.css)({fontSize:i.typography.size.sm,color:i.colors.text.secondary})});function u({name:i,id:l,options:f,value:d,onChange:h,className:p,disabled:m,disabledOptions:a=[]}){const v=(0,s.of)(c),E=l??(0,n.uniqueId)("radiogroup-list-");return o.createElement("div",{id:l,className:(0,t.cx)(v.container,p),role:"radiogroup"},f.map((D,b)=>{const C=`${E}-${b}`,y=d&&d===D.value,M=m||a.some(I=>I===D.value),T=()=>h&&D.value&&h(D.value);return o.createElement(r,{key:b,id:C,name:i,label:D.label,description:D.description,checked:y,value:D.value,disabled:M,onChange:T})}))}const c=i=>({container:(0,t.css)({display:"grid",gap:i.spacing(1)})})},87266:(Q,A,e)=>{"use strict";e.d(A,{SM:()=>c,Xb:()=>s,g$:()=>r,gm:()=>o,lH:()=>g});var t=e(32196),n=e(16797);const o=i=>(0,t.css)({"&:focus":(0,n.getFocusStyles)(i)}),s=(i,l=!1)=>{const f=l?i.colors.error.border:i.components.input.borderColor,d=l?i.colors.error.shade:i.components.input.borderHover,h=i.components.input.background,p=i.components.input.text,m=i.isDark?"#2e2f35":"#bab4ca";return(0,t.cx)(r(i),(0,t.css)({background:h,lineHeight:i.typography.body.lineHeight,fontSize:i.typography.size.md,color:p,border:`1px solid ${f}`,"&:-webkit-autofill, &:-webkit-autofill:hover":{boxShadow:`inset 0 0 0 1px rgba(255, 255, 255, 0), inset 0 0 0 100px ${h}!important`,WebkitTextFillColor:`${p} !important`,borderColor:m},"&:-webkit-autofill:focus":{boxShadow:`0 0 0 2px ${i.colors.background.primary}, 0 0 0px 4px ${i.colors.primary.main}, inset 0 0 0 1px rgba(255, 255, 255, 0), inset 0 0 0 100px ${h}!important`,WebkitTextFillColor:`${p} !important`},"&:hover":{borderColor:d},"&:focus":{outline:"none"},"&:disabled":{backgroundColor:i.colors.action.disabledBackground,color:i.colors.action.disabledText,border:`1px solid ${i.colors.action.disabledBackground}`,"&:hover":{borderColor:f}},"&::placeholder":{color:i.colors.text.disabled,opacity:1}}))},r=i=>(0,t.css)({padding:i.spacing(0,1,0,1)}),g=()=>({sm:(0,t.css)({width:u("sm")}),md:(0,t.css)({width:u("md")}),lg:(0,t.css)({width:u("lg")}),auto:(0,t.css)({width:u("auto")})}),u=i=>{switch(i){case"sm":return"200px";case"md":return"320px";case"lg":return"580px";case"auto":default:return"auto"}};function c(i,l){switch(i){case"sm":return{padding:1,fontSize:l.typography.size.sm,height:l.components.height.sm};case"lg":return{padding:3,fontSize:l.typography.size.lg,height:l.components.height.lg};case"md":default:return{padding:2,fontSize:l.typography.size.md,height:l.components.height.md}}}},95164:(Q,A,e)=>{"use strict";e.d(A,{_:()=>m});var t=e(34796),n=e.n(t),o=e(96540),s=e(83195),r=e(58649),g=e(50082),u=e(52622),c=e(29413),i=e(55852),l=e(24293),f=e(47737);const d={mode:g.O.Absolute,steps:[{value:-1/0,color:"green"},{value:80,color:"red"}]};function h(a,v,E,D){const b=E!=null,C=D===u.wV.Vertical?v:a,y=Math.min(C*.15/1.5,20),M=y*1.5,T=b?v-M:v,I=Math.min(T,a);return{showLabel:b,gaugeHeight:I,titleFontSize:y}}function p(a,v,E,D){if(v.color?.mode!==l.Y.Thresholds)return[{value:v.min??r.tw,color:E.color??l.F}];const b=v.thresholds??d,C=b.mode===g.O.Percentage,y=b.steps;let M=v.min??r.tw,T=v.max??r.d1;C&&(M=0,T=100);const I=(0,f.yQ)(M,y),x=(0,f.yQ)(T,y),S=[{value:+M.toFixed(a),color:D.visualization.getColorByName(I.color)}];let O=!0;for(let P=0;P<y.length;P++){const L=y[P];if(O){I===L&&(O=!1);continue}const U=y[P-1];if(S.push({value:L.value,color:D.visualization.getColorByName(U.color)}),L===x)break}return S.push({value:+T.toFixed(a),color:D.visualization.getColorByName(x.color)}),S}class m extends o.PureComponent{constructor(){super(...arguments),this.canvasElement=null,this.renderVisualization=()=>{const{width:v,value:E,height:D,onClick:b,text:C,theme:y,orientation:M}=this.props,T=h(v,D,E.title,M),I=M===u.wV.Vertical?`${T.gaugeHeight}px`:"100%",x=o.createElement("div",{style:{height:`${T.gaugeHeight}px`,width:I},ref:S=>this.canvasElement=S});return o.createElement(o.Fragment,null,b?o.createElement("button",{className:(0,i.my)(y),type:"button",onClick:b},x):x,T.showLabel&&o.createElement("div",{style:{textAlign:"center",fontSize:C?.titleSize??T.titleFontSize,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",position:"relative",width:I,top:"-4px",cursor:"default"}},E.title))}}componentDidMount(){this.draw()}componentDidUpdate(){this.draw()}draw(){const{field:v,showThresholdLabels:E,showThresholdMarkers:D,width:b,height:C,theme:y,value:M,orientation:T}=this.props,I=h(b,C,M.title),x=T===u.wV.Vertical?I.gaugeHeight:b,S=Math.min(x,I.gaugeHeight),O=y.colors.background.secondary,P=E?1.5:1,L=Math.min(S/5.5,40)/P,U=L/5,R=(0,s.cN)(M),H=Math.min(x,S*1.3)*.9-((L+(D?U:0)+(E?10:0))*2+10),w=this.props.text?.valueSize??(0,c.Vr)(R,H,S,1,L*1.7),N=Math.max(w/2.5,12);let V=v.min??r.tw,G=v.max??r.d1,_=M.numeric;v.thresholds?.mode===g.O.Percentage&&(V=0,G=100,M.percent===void 0?_=(_-V)/(G-V)*100:_=M.percent*100);const K=v.decimals===void 0?2:v.decimals;D&&(V=+V.toFixed(K),G=+G.toFixed(K));const j={series:{gauges:{gauge:{min:V,max:G,neutralValue:v.custom?.neutral,background:{color:O},border:{color:null},shadow:{show:!1},width:L},frame:{show:!1},label:{show:!1},layout:{margin:0,thresholdWidth:0,vMargin:0},cell:{border:{width:0}},threshold:{values:p(K,v,M,y),label:{show:E,margin:U+1,font:{size:N}},show:D,width:U},value:{color:M.color,formatter:()=>R,font:{size:w,family:y.typography.fontFamily}},show:!0}}},k={data:[[0,_]],label:M.title};try{this.canvasElement&&n().plot(this.canvasElement,[k],j)}catch(Y){console.error("Gauge rendering error",Y,j,M)}}render(){return o.createElement("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",overflow:"hidden"},className:this.props.className},this.renderVisualization())}}m.defaultProps={showThresholdMarkers:!0,showThresholdLabels:!1,field:{min:0,max:100,thresholds:d}}},14578:(Q,A,e)=>{"use strict";e.d(A,{I:()=>c});var t=e(32196),n=e(96540),o=e(8867),s=e(8887),r=e(40845),g=e(78318);const u=i=>({icon:(0,t.css)({display:"inline-block",fill:"currentColor",flexShrink:0,label:"Icon",lineHeight:0,verticalAlign:"middle"}),orange:(0,t.css)({fill:i.v1.palette.orange})}),c=n.forwardRef(({size:i="md",type:l="default",name:f,className:d,style:h,title:p="",...m},a)=>{const v=(0,r.of)(u);(0,s.n6)(f)||console.warn("Icon component passed an invalid icon name",f);const E=f==="fa fa-spinner"?"spinner":f,D=(0,g.Wj)(),b=(0,g.cs)(i),C=b,y=f.startsWith("gf-bar-align")?16:f.startsWith("gf-interp")?30:b,M=(0,g.Xi)(E,l),T=`${D}${M}/${E}.svg`,I=(0,t.cx)(v.icon,d,l==="mono"?{[v.orange]:f==="favorite"}:"",E==="spinner"&&"fa-spin");return n.createElement(o.default,{innerRef:a,src:T,width:y,height:C,title:p,className:I,style:h,...m})});c.displayName="Icon"},78318:(Q,A,e)=>{"use strict";e.d(A,{Wj:()=>r,Xi:()=>n,cs:()=>o});const t=["grafana","favorite","heart-break","heart","panel-add","library-panel","circle-mono"];function n(g,u){return g?.startsWith("gf-")?"custom":t.includes(g)?"mono":u==="default"?"unicons":u==="solid"?"solid":"mono"}function o(g){switch(g){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}}let s;function r(){if(s)return s;const g=typeof window<"u"&&window.__grafana_public_path__;return g?s=g+"img/icons/":s="public/img/icons/",s}},29158:(Q,A,e)=>{"use strict";e.d(A,{K:()=>l});var t=e(32196),n=e(96540),o=e(95344),s=e(23596),r=e(40845),g=e(16797),u=e(14578),c=e(78318),i=e(56034);const l=n.forwardRef((d,h)=>{const{size:p="md",variant:m="secondary"}=d;let a;p==="xxl"||p==="xxxl"?((0,o.l)("IconButton",'size="xxl" and size="xxxl"','size="xl"'),a="xl"):a=p;const v=(0,r.of)(f,a,m);let E,D;if("tooltip"in d){const{tooltip:b}=d;E=typeof b=="string"?b:void 0}else if("ariaLabel"in d||"aria-label"in d){const{ariaLabel:b,["aria-label"]:C}=d;E=C||b,D=h}if("tooltip"in d){const{name:b,iconType:C,className:y,tooltip:M,tooltipPlacement:T,...I}=d;return n.createElement(i.m,{ref:h,content:M,placement:T},n.createElement("button",{...I,ref:D,"aria-label":E,className:(0,t.cx)(v.button,y),type:"button"},n.createElement(u.I,{name:b,size:a,className:v.icon,type:C})))}else{const{name:b,iconType:C,className:y,...M}=d;return n.createElement("button",{...M,ref:D,"aria-label":E,className:(0,t.cx)(v.button,y),type:"button"},n.createElement(u.I,{name:b,size:a,className:v.icon,type:C}))}});l.displayName="IconButton";const f=(d,h,p)=>{const m=(0,c.cs)(h)+d.spacing.gridSize;let a=d.colors.text.primary;return p==="primary"?a=d.colors.primary.text:p==="destructive"&&(a=d.colors.error.text),{button:(0,t.css)({zIndex:0,position:"relative",margin:`0 ${d.spacing.x0_5} 0 0`,boxShadow:"none",border:"none",display:"inline-flex",background:"transparent",justifyContent:"center",alignItems:"center",padding:0,color:a,"&[disabled], &:disabled":{cursor:"not-allowed",color:d.colors.action.disabledText,opacity:.65},"&:before":{zIndex:-1,position:"absolute",opacity:0,width:`${m}px`,height:`${m}px`,borderRadius:d.shape.radius.default,content:'""',transitionDuration:"0.2s",transitionTimingFunction:"cubic-bezier(0.4, 0, 0.2, 1)",transitionProperty:"opacity"},"&:focus, &:focus-visible":(0,g.getFocusStyles)(d),"&:focus:not(:focus-visible)":(0,g.getMouseFocusStyles)(d),"&:hover":{"&:before":{backgroundColor:p==="secondary"?d.colors.action.hover:s.alpha(a,.12),opacity:1}}}),icon:(0,t.css)({verticalAlign:"baseline"})}}},86460:(Q,A,e)=>{"use strict";e.d(A,{e:()=>u,y:()=>i});var t=e(32196),n=e(96540),o=e(41987),s=e(40845),r=e(39938),g=e(37166);const u=n.memo(n.forwardRef(({title:f,featureState:d,...h},p)=>{const m=(0,s.of)(c),a=d?n.createElement(n.Fragment,null,n.createElement("div",{className:m.badge},n.createElement(i,{featureState:d})),n.createElement("h3",null,f)):n.createElement("h3",null,f);return n.createElement(g.w,{branded:!0,title:a,urlTitle:"Read documentation",ref:p,...h})}));u.displayName="FeatureInfoBox";const c=f=>({badge:(0,t.css)({marginBottom:f.spacing(1)})}),i=({featureState:f,tooltip:d})=>{const h=l(f);return n.createElement(r.E,{text:h.text,color:h.color,icon:h.icon,tooltip:d})};function l(f){switch(f){case o.Ay.alpha:return{text:"Alpha",icon:"exclamation-triangle",color:"orange"}}return{text:"Beta",icon:"rocket",color:"blue"}}},37166:(Q,A,e)=>{"use strict";e.d(A,{w:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(42418),r=e(14578);const g=n.memo(n.forwardRef(({title:c,className:i,children:l,branded:f,url:d,urlTitle:h,onDismiss:p,severity:m="info",...a},v)=>{const E=(0,o.of)(u);return n.createElement(s.F,{severity:m,className:i,...a,ref:v,title:c},n.createElement("div",null,l),d&&n.createElement("a",{href:d,className:(0,t.cx)("external-link",E.docsLink),target:"_blank",rel:"noreferrer"},n.createElement(r.I,{name:"book"})," ",h||"Read more"))}));g.displayName="InfoBox";const u=c=>({docsLink:(0,t.css)({display:"inline-block",marginTop:c.spacing(2)})})},32982:(Q,A,e)=>{"use strict";e.d(A,{r:()=>i});var t=e(32196),n=e(95361),o=e(18491),s=e(36376),r=e(96540),g=e(40845),u=e(14578),c=e(17464);function i({referenceElement:d,children:h,suffixIcon:p,placement:m}){const a=(0,g.of)(l),v=(0,g.$j)(),E=[(0,n.cY)(8),(0,o.UU)({fallbackAxisSideDirection:"end",crossAxis:!1,boundary:document.body}),(0,o.BN)()],{context:D,refs:b,floatingStyles:C}=(0,s.we)({open:!0,placement:m,middleware:E,whileElementsMounted:o.ll,strategy:"fixed"});(0,r.useLayoutEffect)(()=>{b.setReference(d)},[d,b]);const{styles:y}=(0,s.DL)(D,{initial:({side:M})=>({opacity:0,transform:f(M,v)}),duration:v.transitions.duration.shortest});return r.createElement(c.ZL,null,r.createElement("div",{style:{display:"inline-block",...C},ref:b.setFloating,"aria-live":"polite"},r.createElement("span",{className:(0,t.cx)(a.root),style:y},h&&r.createElement("span",null,h),p&&r.createElement(u.I,{name:p}))))}const l=d=>({root:(0,t.css)({...d.typography.bodySmall,willChange:"transform",background:d.components.tooltip.background,color:d.components.tooltip.text,padding:d.spacing(.5,1.5),borderRadius:d.shape.radius.pill,display:"inline-flex",gap:d.spacing(.5),alignItems:"center"})}),f=(d,h)=>{switch(d){case"top":return`translateY(${h.spacing(1)})`;case"bottom":return`translateY(-${h.spacing(1)})`;case"left":return`translateX(${h.spacing(1)})`;case"right":return`translateX(-${h.spacing(1)})`}}},51440:(Q,A,e)=>{"use strict";e.d(A,{D:()=>s});var t=e(96540),n=e(29413),o=e(10354);const s=t.forwardRef((g,u)=>{const{defaultValue:c="",minWidth:i=10,maxWidth:l,onCommitChange:f,onKeyDown:d,onBlur:h,...p}=g,[m,a]=t.useState(c),[v,E]=t.useState(i);return(0,t.useEffect)(()=>{E(r(m.toString(),i,l))},[m,l,i]),t.createElement(o.p,{...p,ref:u,value:m.toString(),onChange:D=>{a(D.currentTarget.value)},width:v,onBlur:D=>{h?h(D):f&&f(D)},onKeyDown:D=>{d?d(D):D.key==="Enter"&&f&&f(D)},"data-testid":"autosize-input"})});function r(g,u,c){if(!g)return u;const i=3,l=(0,n.kD)(g.toString(),14).width/8+i;return u&&l<u?u:c&&l>c?c:l}s.displayName="AutoSizeInput"},10354:(Q,A,e)=>{"use strict";e.d(A,{n:()=>i,p:()=>c});var t=e(32196),n=e(96540),o=e(71473),s=e(40845),r=e(3911),g=e(87266),u=e(62930);const c=n.forwardRef((l,f)=>{const{className:d,addonAfter:h,addonBefore:p,prefix:m,suffix:a,invalid:v,loading:E,width:D=0,...b}=l,[C,y]=(0,o.A)(),[M,T]=(0,o.A)(),I=(0,s.$j)(),x=i({theme:I,invalid:!!v,width:D});return n.createElement("div",{className:(0,t.cx)(x.wrapper,d),"data-testid":"input-wrapper"},!!p&&n.createElement("div",{className:x.addon},p),n.createElement("div",{className:x.inputWrapper},m&&n.createElement("div",{className:x.prefix,ref:C},m),n.createElement("input",{ref:f,className:x.input,...b,style:{paddingLeft:m?y.width+12:void 0,paddingRight:a||E?T.width+12:void 0}}),(a||E)&&n.createElement("div",{className:x.suffix,ref:M},E&&n.createElement(u.y,{className:x.loadingIndicator,inline:!0}),a)),!!h&&n.createElement("div",{className:x.addon},h))});c.displayName="Input";const i=(0,r.N)(({theme:l,invalid:f=!1,width:d})=>{const h="28px",p=(0,t.css)({position:"absolute",top:0,zIndex:1,display:"flex",alignItems:"center",justifyContent:"center",flexGrow:0,flexShrink:0,fontSize:l.typography.size.md,height:"100%",minWidth:h,color:l.colors.text.secondary});return{wrapper:(0,t.cx)((0,t.css)({label:"input-wrapper",display:"flex",width:d?l.spacing(d):"100%",height:l.spacing(l.components.height.md),borderRadius:l.shape.radius.default,"&:hover":{"> .prefix, .suffix, .input":{borderColor:f?l.colors.error.border:l.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:h},"&:not(:last-child)":{paddingRight:h},"&[readonly]":{cursor:"default"}}}),input:(0,t.cx)((0,g.gm)(l),(0,g.Xb)(l,f),(0,t.css)({label:"input-input",position:"relative",zIndex:0,flexGrow:1,borderRadius:l.shape.radius.default,height:"100%",width:"100%"})),inputDisabled:(0,t.css)({backgroundColor:l.colors.action.disabledBackground,color:l.colors.action.disabledText,border:`1px solid ${l.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)(p,(0,t.css)({label:"input-prefix",paddingLeft:l.spacing(1),paddingRight:l.spacing(.5),borderRight:"none",borderTopRightRadius:0,borderBottomRightRadius:0})),suffix:(0,t.cx)(p,(0,t.css)({label:"input-suffix",paddingLeft:l.spacing(1),paddingRight:l.spacing(1),marginBottom:"-2px",borderLeft:"none",borderTopLeftRadius:0,borderBottomLeftRadius:0,right:0})),loadingIndicator:(0,t.css)({"& + *":{marginLeft:l.spacing(.5)}})}})},16504:(Q,A,e)=>{"use strict";e.d(A,{e:()=>n});var t=e(49785);const n=t.xI},28389:(Q,A,e)=>{"use strict";e.d(A,{j:()=>a});var t=e(32196),n=e(2543),o=e(96540),s=e(32885),r=e(39070),g=e(40845),u=e(14578),c=e(19384),i=e(56034),l=e(29158);const f=(0,t.css)({display:"flex",alignItems:"center",height:"100%"});function d({row:b,__rowID:C}){return o.createElement("div",{className:f},o.createElement(l.K,{tooltip:"toggle row expanded","aria-controls":C,name:b.isExpanded?"angle-down":"angle-right","aria-expanded":b.isExpanded,...b.getToggleRowExpandedProps(),size:"lg"}))}const h="__expander";function p(b){return[{id:h,Cell:d,disableSortBy:!0,width:0},...b.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 m=b=>{const C=b.colors.emphasize(b.colors.background.primary,.03);return{container:(0,t.css)({display:"flex",gap:b.spacing(2),flexDirection:"column",width:"100%",overflowX:"auto"}),table:(0,t.css)({borderRadius:b.shape.radius.default,width:"100%",td:{padding:b.spacing(1)},"td, th":{minWidth:b.spacing(3)}}),disableGrow:(0,t.css)({width:0}),header:(0,t.css)({borderBottom:`1px solid ${b.colors.border.weak}`,"&, & > button":{position:"relative",whiteSpace:"nowrap",padding:b.spacing(1)},"& > button":{"&:after":{content:'"\\00a0"'},width:"100%",height:"100%",background:"none",border:"none",paddingRight:b.spacing(2.5),textAlign:"left",fontWeight:b.typography.fontWeightMedium}}),row:(0,t.css)({label:"row",borderBottom:`1px solid ${b.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 ${b.colors.border.weak}`,position:"relative",padding:b.spacing(2,2,2,5),"&:before":{content:'""',position:"absolute",width:"1px",top:0,left:"16px",bottom:b.spacing(2),background:b.colors.border.medium}}}),sortableHeader:(0,t.css)({"&&":{padding:0}})}};function a({className:b,columns:C,data:y,getRowId:M,headerTooltips:T,pageSize:I=0,renderExpandedRow:x,fetchData:S}){const O=(0,g.of)(m),P=(0,o.useMemo)(()=>p(C),[C]),L=v(),U=(0,o.useCallback)(j=>`${L}-${j.id}`.replace(/\s/g,""),[L]),R=[s.useSortBy,s.useExpanded],B=y.length>I,H=I>0&&B;H&&R.push(s.usePagination);const w=(0,s.useTable)({columns:P,data:y,autoResetExpanded:!1,autoResetSortBy:!1,disableMultiSort:!0,manualSortBy:!!S,getRowId:M,initialState:{hiddenColumns:[!x&&h,...P.filter(j=>!(!j.visible||j.visible(y))).map(j=>j.id).filter(r.zz)].filter(r.zz)}},...R),{getTableProps:N,getTableBodyProps:V,headerGroups:G,prepareRow:_}=w,{sortBy:K}=w.state;return(0,o.useEffect)(()=>{S&&S({sortBy:K})},[K,S]),(0,o.useEffect)(()=>{H&&w.setPageSize(I)},[H,I,w.setPageSize,w]),o.createElement("div",{className:O.container},o.createElement("table",{...N(),className:(0,t.cx)(O.table,b)},o.createElement("thead",null,G.map(j=>{const{key:k,...Y}=j.getHeaderGroupProps();return o.createElement("tr",{key:k,...Y},j.headers.map(ee=>{const{key:re,...J}=ee.getHeaderProps(),ne=T?.[ee.id];return o.createElement("th",{key:re,className:(0,t.cx)(O.header,{[O.disableGrow]:ee.width===0,[O.sortableHeader]:ee.canSort}),...J,...ee.isSorted&&{"aria-sort":ee.isSortedDesc?"descending":"ascending"}},o.createElement(D,{column:ee,headerTooltip:ne}))}))})),o.createElement("tbody",{...V()},(H?w.page:w.rows).map(j=>{_(j);const{key:k,...Y}=j.getRowProps(),ee=U(j),re=j.isExpanded;return o.createElement(o.Fragment,{key:k},o.createElement("tr",{...Y,className:(0,t.cx)(O.row,re&&O.expandedRow)},j.cells.map(J=>{const{key:ne,...q}=J.getCellProps();return o.createElement("td",{key:ne,...q},J.render("Cell",{__rowID:ee}))})),re&&x&&o.createElement("tr",{...Y,id:ee,className:O.expandedContentRow},o.createElement("td",{colSpan:j.cells.length},x(j.original))))}))),H&&o.createElement("span",null,o.createElement(c.d,{currentPage:w.state.pageIndex+1,numberOfPages:w.pageOptions.length,onNavigate:j=>w.gotoPage(j-1)})))}const v=()=>(0,o.useMemo)(()=>(0,n.uniqueId)("InteractiveTable"),[]),E=b=>({sortIcon:(0,t.css)({position:"absolute",top:b.spacing(1)}),headerTooltipIcon:(0,t.css)({marginLeft:b.spacing(.5)})});function D({column:{canSort:b,render:C,isSorted:y,isSortedDesc:M,getSortByToggleProps:T},headerTooltip:I}){const x=(0,g.of)(E),{onClick:S}=T(),O=o.createElement(o.Fragment,null,C("Header"),I&&o.createElement(i.m,{theme:"info-alt",content:I.content,placement:"top-end"},o.createElement(u.I,{className:x.headerTooltipIcon,name:I.iconName||"info-circle","data-testid":"header-tooltip-icon"})),y&&o.createElement("span",{"aria-hidden":"true",className:x.sortIcon},o.createElement(u.I,{name:M?"angle-down":"angle-up"})));return b?o.createElement("button",{type:"button",onClick:S},O):O}},24022:(Q,A,e)=>{"use strict";e.d(A,{B:()=>o});var t=e(96540),n=e(44533);class o extends t.PureComponent{constructor(){super(...arguments),this.wrapperRef=(0,t.createRef)(),this.renderJson=()=>{const{json:r,config:g,open:u,onDidRender:c}=this.props,i=this.wrapperRef.current,l=new n.O(r,u,g);i.hasChildNodes()?i.replaceChild(l.render(),i.lastChild):i.appendChild(l.render()),c&&c(l.json)}}componentDidMount(){this.renderJson()}componentDidUpdate(){this.renderJson()}render(){const{className:r}=this.props;return t.createElement("div",{className:r,ref:this.wrapperRef})}}o.defaultProps={open:3,config:{animateOpen:!0}}},44533:(Q,A,e)=>{"use strict";e.d(A,{O:()=>v});var t=e(2543);function n(E){return E.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function o(E){return!!E&&typeof E==="object"}function s(E){if(E===void 0)return"";if(E===null||typeof E=="object"&&!E.constructor)return"Object";const b=/function ([^(]*)/.exec(E.constructor.toString());return b&&b.length>1?b[1]:""}function r(E){return E===null?"null":typeof E}function g(E,D){const b=r(E);return b==="null"||b==="undefined"?b:(b==="string"&&(D='"'+n(D)+'"'),b==="function"?E.toString().replace(/[\r\n]/g,"").replace(/\{.*\}/,"")+"{\u2026}":D)}let u="";function c(E){return o(E)?(u=s(E),Array.isArray(E)&&(u+="["+E.length+"]")):u=g(E,E.toString()),u}function i(E){return`json-formatter-${E}`}function l(E,D,b){const C=document.createElement(E);return D&&C.classList.add(i(D)),b!==void 0&&(b instanceof Node?C.appendChild(b):C.appendChild(document.createTextNode(String(b)))),C}const f=/(^\d{1,4}[\.|\\/|-]\d{1,2}[\.|\\/|-]\d{1,4})(\s*(?:0?[1-9]:[0-5]|1(?=[012])\d:[0-5])\d\s*[ap]m)?$/,d=/\d{2}:\d{2}:\d{2} GMT-\d{4}/,h=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/,p=10,m=typeof window<"u"&&window.requestAnimationFrame||(E=>(E(),0)),a={animateOpen:!0,animateClose:!0};class v{constructor(D,b=1,C=a,y){this.json=D,this.open=b,this.config=C,this.key=y,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"&&(f.test(this.json)||h.test(this.json)||d.test(this.json))}get isUrl(){return this.type==="string"&&this.json.indexOf("http")===0}get isArray(){return Array.isArray(this.json)}get isObject(){return o(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(i("open")))}openAtDepth(D=1){D<0||(this.open=D,this.isOpen=D!==0,this.element&&(this.removeChildren(!1),D===0?this.element.classList.remove(i("open")):(this.appendChildren(this.config.animateOpen),this.element.classList.add(i("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=l("span");return D.appendChild(l("span","bracket","[")),this.isNumberArray()?(this.json.forEach((b,C)=>{C>0&&D.appendChild(l("span","array-comma",",")),D.appendChild(l("span","number",b))}),this.skipChildren=!0):D.appendChild(l("span","number",this.json.length)),D.appendChild(l("span","bracket","]")),D}render(D=!1){this.element=l("div","row");const b=l("a","toggler-link"),C=l("span","toggler");if(this.isObject&&b.appendChild(C),this.hasKey&&b.appendChild(l("span","key",`${this.key}:`)),this.isObject){const M=l("span","value"),T=l("span"),I=l("span","constructor-name",this.constructorName);if(T.appendChild(I),this.isArray){const x=this.renderArray();T.appendChild(x)}M.appendChild(T),b.appendChild(M)}else{const M=this.isUrl?l("a"):l("span");M.classList.add(i(this.type)),this.isDate&&M.classList.add(i("date")),this.isUrl&&(M.classList.add(i("url")),M.setAttribute("href",this.json));const T=g(this.json,this.json);M.appendChild(document.createTextNode(T)),b.appendChild(M)}const y=l("div","children");return this.isObject&&y.classList.add(i("object")),this.isArray&&y.classList.add(i("array")),this.isEmpty&&y.classList.add(i("empty")),this.config&&this.config.theme&&this.element.classList.add(i(this.config.theme)),this.isOpen&&this.element.classList.add(i("open")),D||this.element.appendChild(b),this.skipChildren?b.removeChild(C):this.element.appendChild(y),this.isObject&&this.isOpen&&this.appendChildren(),this.isObject&&b.addEventListener("click",this.toggleOpen.bind(this)),this.element}appendChildren(D=!1){const b=this.element&&this.element.querySelector(`div.${i("children")}`);if(!(!b||this.isEmpty))if(D){let C=0;const y=()=>{const M=this.keys[C],T=new v(this.json[M],this.open-1,this.config,M);b.appendChild(T.render()),C+=1,C<this.keys.length&&(C>p?y():m(y))};m(y)}else this.keys.forEach(C=>{const y=new v(this.json[C],this.open-1,this.config,C);b.appendChild(y.render())})}removeChildren(D=!1){const b=this.element&&this.element.querySelector(`div.${i("children")}`);if(D){let C=0;const y=()=>{b&&b.children.length&&(b.removeChild(b.children[0]),C+=1,C>p?y():m(y))};m(y)}else b&&(b.innerHTML="")}}},90613:(Q,A,e)=>{"use strict";e.d(A,{a:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(16795);const r=(0,n.forwardRef)((i,l)=>{const{children:f,margin:d,marginX:h,marginY:p,marginTop:m,marginBottom:a,marginLeft:v,marginRight:E,padding:D,paddingX:b,paddingY:C,paddingTop:y,paddingBottom:M,paddingLeft:T,paddingRight:I,display:x,backgroundColor:S,grow:O,shrink:P,basis:L,flex:U,borderColor:R,borderStyle:B,borderRadius:H,justifyContent:w,alignItems:N,boxShadow:V,element:G,gap:_,...K}=i,j=(0,o.of)(c,d,h,p,m,a,v,E,D,b,C,y,M,T,I,x,S,O,P,L,U,R,B,H,w,N,V,_),k=G??"div";return n.createElement(k,{ref:l,className:j.root,...K},f)});r.displayName="Box";const g=(i,l)=>{switch(i){case"error":case"success":case"info":case"warning":return l.colors[i].borderTransparent;default:return i?l.colors.border[i]:void 0}},u=(i,l)=>{switch(i){case"error":case"success":case"info":case"warning":return l.colors[i].transparent;default:return i?l.colors.background[i]:void 0}},c=(i,l,f,d,h,p,m,a,v,E,D,b,C,y,M,T,I,x,S,O,P,L,U,R,B,H,w,N)=>({root:(0,t.css)([(0,s.Y)(i,l,V=>({margin:i.spacing(V)})),(0,s.Y)(i,f,V=>({marginLeft:i.spacing(V),marginRight:i.spacing(V)})),(0,s.Y)(i,d,V=>({marginTop:i.spacing(V),marginBottom:i.spacing(V)})),(0,s.Y)(i,h,V=>({marginTop:i.spacing(V)})),(0,s.Y)(i,p,V=>({marginBottom:i.spacing(V)})),(0,s.Y)(i,m,V=>({marginLeft:i.spacing(V)})),(0,s.Y)(i,a,V=>({marginRight:i.spacing(V)})),(0,s.Y)(i,v,V=>({padding:i.spacing(V)})),(0,s.Y)(i,E,V=>({paddingLeft:i.spacing(V),paddingRight:i.spacing(V)})),(0,s.Y)(i,D,V=>({paddingTop:i.spacing(V),paddingBottom:i.spacing(V)})),(0,s.Y)(i,b,V=>({paddingTop:i.spacing(V)})),(0,s.Y)(i,C,V=>({paddingBottom:i.spacing(V)})),(0,s.Y)(i,y,V=>({paddingLeft:i.spacing(V)})),(0,s.Y)(i,M,V=>({paddingRight:i.spacing(V)})),(0,s.Y)(i,T,V=>({display:V})),(0,s.Y)(i,I,V=>({backgroundColor:u(V,i)})),(0,s.Y)(i,x,V=>({flexGrow:V})),(0,s.Y)(i,S,V=>({flexShrink:V})),(0,s.Y)(i,O,V=>({flexBasis:V})),(0,s.Y)(i,P,V=>({flex:V})),(0,s.Y)(i,U,V=>({borderStyle:V})),(0,s.Y)(i,L,V=>({borderColor:g(V,i)})),(U||L)&&{borderWidth:"1px"},(0,s.Y)(i,B,V=>({justifyContent:V})),(0,s.Y)(i,H,V=>({alignItems:V})),(0,s.Y)(i,R,V=>({borderRadius:i.shape.radius[V]})),(0,s.Y)(i,w,V=>({boxShadow:i.shadows[V]})),(0,s.Y)(i,N,V=>({gap:i.spacing(V)}))])})},71259:(Q,A,e)=>{"use strict";e.d(A,{x:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(16795);const r=(0,n.forwardRef)((u,c)=>{const{children:i,gap:l,columns:f,minColumnWidth:d,...h}=u,p=(0,o.of)(g,l,f,d);return n.createElement("div",{ref:c,...h,className:p.grid},i)});r.displayName="Grid";const g=(u,c,i,l)=>({grid:(0,t.css)([{display:"grid"},(0,s.Y)(u,c,f=>({gap:u.spacing(f)})),l&&(0,s.Y)(u,l,f=>({gridTemplateColumns:`repeat(auto-fill, minmax(${u.spacing(f)}, 1fr))`})),i&&(0,s.Y)(u,i,f=>({gridTemplateColumns:`repeat(${f}, 1fr)`}))])})},66864:(Q,A,e)=>{"use strict";e.d(A,{Gy:()=>g,PE:()=>r,gW:()=>u,mc:()=>c});var t=e(32196),n=e(96540),o=e(40845),s=(d=>(d[d.Horizontal=0]="Horizontal",d[d.Vertical=1]="Vertical",d))(s||{});const r=({children:d,orientation:h=0,spacing:p="sm",justify:m="flex-start",align:a="normal",wrap:v=!1,width:E="100%",height:D="100%",...b})=>{const C=(0,o.of)(i,h,p,m,a,v);return n.createElement("div",{className:C.layout,style:{width:E,height:D},...b},n.Children.toArray(d).filter(Boolean).map((y,M)=>n.createElement("div",{className:C.childWrapper,key:M},y)))},g=({children:d,spacing:h,justify:p,align:m="center",wrap:a,width:v,height:E})=>n.createElement(r,{spacing:h,justify:p,orientation:0,align:m,width:v,height:E,wrap:a},d),u=({children:d,spacing:h,justify:p,align:m,width:a,height:v})=>n.createElement(r,{spacing:h,justify:p,orientation:1,align:m,width:a,height:v},d),c=({children:d,padding:h,margin:p,grow:m,shrink:a})=>{const v=(0,o.of)(f,h,p);return n.createElement("div",{className:(0,t.cx)(v.wrapper,m!==void 0&&(0,t.css)({flexGrow:m}),a!==void 0&&(0,t.css)({flexShrink:a}))},d)},i=(d,h,p,m,a,v)=>{const E=p!=="none"?d.spacing(l[p]):0,D=h===0&&!v||h===1?0:`-${E}`,b=h===1?"vertical-group":"horizontal-group";return{layout:(0,t.css)({label:b,display:"flex",flexDirection:h===1?"column":"row",flexWrap:v?"wrap":"nowrap",justifyContent:m,alignItems:a,height:"100%",maxWidth:"100%",marginBottom:D}),childWrapper:(0,t.css)({label:"layoutChildrenWrapper",marginBottom:h===0&&!v?0:E,marginRight:h===0?E:0,display:"flex",alignItems:a,"&:last-child":{marginBottom:h===1?0:void 0,marginRight:h===0?0:void 0}})}},l={none:0,xs:.5,sm:1,md:2,lg:3},f=(d,h,p)=>{const m=h&&h!=="none"&&d.spacing(l[h])||0,a=p&&p!=="none"&&d.spacing(l[p])||0;return{wrapper:(0,t.css)({label:"container",margin:a,padding:m})}}},18348:(Q,A,e)=>{"use strict";e.d(A,{N:()=>n});var t=e(96540);const n=(0,t.createContext)({boostZIndex:()=>()=>{}})},68402:(Q,A,e)=>{"use strict";e.d(A,{$:()=>o});var t=e(96540),n=e(90613);const o=({v:s=0,h:r=0,layout:g})=>t.createElement(n.a,{paddingRight:r,paddingBottom:s,display:g==="inline"?"inline-block":"block"})},67061:(Q,A,e)=>{"use strict";e.d(A,{B:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(16795);const r=n.forwardRef((u,c)=>{const{gap:i=1,alignItems:l,justifyContent:f,direction:d,wrap:h,children:p,grow:m,shrink:a,basis:v,flex:E,...D}=u,b=(0,o.of)(g,i,l,f,d,h,m,a,v,E);return n.createElement("div",{ref:c,className:b.flex,...D},p)});r.displayName="Stack";const g=(u,c,i,l,f,d,h,p,m,a)=>({flex:(0,t.css)([{display:"flex"},(0,s.Y)(u,f,v=>({flexDirection:v})),(0,s.Y)(u,d,v=>({flexWrap:v})),(0,s.Y)(u,i,v=>({alignItems:v})),(0,s.Y)(u,l,v=>({justifyContent:v})),(0,s.Y)(u,c,v=>({gap:u.spacing(v)})),(0,s.Y)(u,h,v=>({flexGrow:v})),(0,s.Y)(u,p,v=>({flexShrink:v})),(0,s.Y)(u,m,v=>({flexBasis:v})),(0,s.Y)(u,a,v=>({flex:v}))])})},16795:(Q,A,e)=>{"use strict";e.d(A,{Y:()=>n});function t(o,s,r,g){const u=s[g];if(u!=null)return{[o.breakpoints.up(g)]:r(u)}}function n(o,s,r){return s==null?null:typeof s!="object"||!("xs"in s)?r(s):[t(o,s,r,"xs"),t(o,s,r,"sm"),t(o,s,r,"md"),t(o,s,r,"lg"),t(o,s,r,"xl"),t(o,s,r,"xxl")]}},50720:(Q,A,e)=>{"use strict";e.d(A,{N:()=>r});var t=e(96540),n=e(54625),o=e(71733),s=e(40672);const r=(0,t.forwardRef)(({href:g,children:u,...c},i)=>{const l=o.I.stripBaseFromUrl(s.sQ.sanitizeUrl(g??""));return t.createElement(n.Link,{ref:i,to:l,...c},u)});r.displayName="Link"},72109:(Q,A,e)=>{"use strict";e.d(A,{Y:()=>l});var t=e(32196),n=e(96540),o=e(40672),s=e(71733),r=e(40845),g=e(14578),u=e(71356),c=e(50720);const i={h1:"xl",h2:"xl",h3:"lg",h4:"lg",h5:"md",h6:"md",body:"md",bodySmall:"xs"},l=(0,n.forwardRef)(({href:d,color:h="link",external:p=!1,inline:m=!0,variant:a="body",weight:v,icon:E,children:D,...b},C)=>{const y=o.sQ.sanitizeUrl(d??""),M=(0,r.$j)(),T=f(M,m,a,v,h),I=E||"external-link-alt";if(p)return n.createElement("a",{href:y,ref:C,...b,target:"_blank",rel:"noreferrer",className:T},D,n.createElement(g.I,{size:i[a]||"md",name:I}));const x=s.I.stripBaseFromUrl(y);return n.createElement(c.N,{ref:C,href:x,...b,className:T},D,E&&n.createElement(g.I,{name:E,size:i[a]||"md"}))});l.displayName="TextLink";const f=(d,h,p,m,a)=>(0,t.css)([p&&{...d.typography[p]},m&&{fontWeight:(0,u.iV)(m,d)},a&&{color:d.colors.text[a]},{alignItems:"center",gap:"0.25em",display:"inline-flex",textDecoration:"none","&:hover":{textDecoration:"underline",color:d.colors.text.link}},h&&{textDecoration:"underline","&:hover":{textDecoration:"none"}}])},85918:(Q,A,e)=>{"use strict";e.d(A,{p:()=>r});var t=e(32196),n=e(96540),o=e(3911);const s=(0,o.N)((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(u){super(u)}render(){const{items:u,renderItem:c,getItemKey:i,className:l,inline:f}=this.props,d=s(f);return n.createElement("ul",{className:(0,t.cx)(d.list,l)},u.map((h,p)=>n.createElement("li",{className:d.item,key:i?i(h):p},c(h,p))))}}},1551:(Q,A,e)=>{"use strict";e.d(A,{c:()=>o});var t=e(96540),n=e(85918);class o extends t.PureComponent{render(){return t.createElement(n.p,{inline:!0,...this.props})}}},33552:(Q,A,e)=>{"use strict";e.d(A,{B:()=>o});var t=e(96540),n=e(85918);class o extends t.PureComponent{render(){return t.createElement(n.p,{...this.props})}}},57514:(Q,A,e)=>{"use strict";e.d(A,{G:()=>l});var t=e(32196),n=e(96540),o=e(40845);const s=28,r=2.4,g=500,u=4e3,c=300,i=100/s*100;function l({width:d,delay:h=c,ariaLabel:p="Loading bar"}){const m=Math.min(Math.max(Math.round(d*r),g),u),a=(0,o.of)(f,h,m),v={overflow:"hidden"};return n.createElement("div",{style:v},n.createElement("div",{"aria-label":p,className:a.bar}))}const f=(d,h,p)=>{const m=(0,t.keyframes)({"0%":{transform:"translateX(-100%)"},"85%, 100%":{transform:`translateX(${i}%)`}});return{bar:(0,t.css)({width:s+"%",height:1,background:"linear-gradient(90deg, rgba(110, 159, 255, 0) 0%, #6E9FFF 80.75%, rgba(110, 159, 255, 0) 100%)",transform:"translateX(-100%)",animationName:m,animationDelay:`${h}ms`,animationDuration:`${p}ms`,animationTimingFunction:"linear",animationIterationCount:"infinite",willChange:"transform"})}}},39558:(Q,A,e)=>{"use strict";e.d(A,{_:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(62930);const r=({text:u,className:c,...i})=>{const l=(0,o.of)(g);return n.createElement("div",{className:(0,t.cx)(l.container,c),...i},u," ",n.createElement(s.y,{inline:!0}))},g=u=>({container:(0,t.css)({marginBottom:u.spacing(4)})})},76218:(Q,A,e)=>{"use strict";e.d(A,{O:()=>s});var t=e(96540),n=e(88323),o=e(64278);const s=({value:r,onChange:g,context:u,item:c})=>{const i=c.settings??{},l=(0,o.sE)(u.data,i?.filter),f=(0,o.m3)(l,r,void 0,void 0,i.baseNameMode),d=(0,t.useCallback)(p=>{if(!(p&&!(0,o.v3)(p.value,l)))return g(p?.value)},[l,g]),h=f.find(p=>p.value===r);return t.createElement(t.Fragment,null,t.createElement(n.l6,{value:h,placeholder:i.placeholderText??"Select field",options:f,onChange:d,noOptionsMessage:i.noFieldsMessage,width:i.width,isClearable:i.isClearable!==!1}))}},9988:(Q,A,e)=>{"use strict";e.d(A,{bx:()=>c,cH:()=>f});var t=e(96540),n=e(11261),o=e(1173),s=e(85200),r=e(4025),g=e(88323);const u=(0,t.memo)(d=>{const{data:h,options:p,onChange:m,id:a}=d,v=i(h),E=l(v,p),D=(0,t.useCallback)(C=>m(C.value),[m]),b=E.find(C=>C.value===p);return t.createElement(g.l6,{inputId:a,value:b,options:E,onChange:D})});u.displayName="FieldTypeMatcherEditor";const c=[{value:n.PU.number,label:"Number",icon:(0,r.lV)(n.PU.number)},{value:n.PU.string,label:"String",icon:(0,r.lV)(n.PU.string)},{value:n.PU.time,label:"Time",icon:(0,r.lV)(n.PU.time)},{value:n.PU.boolean,label:"Boolean",icon:(0,r.lV)(n.PU.boolean)},{value:n.PU.trace,label:"Traces",icon:(0,r.lV)(n.PU.trace)},{value:n.PU.enum,label:"Enum",icon:(0,r.lV)(n.PU.enum)},{value:n.PU.other,label:"Other",icon:(0,r.lV)(n.PU.other)}],i=d=>(0,t.useMemo)(()=>{const h=new Map;for(const p of c)h.set(p.value,0);for(const p of d)for(const m of p.fields){const a=m.type||n.PU.other;let v=h.get(a);v||(v=0),h.set(a,v+1)}return h},[d]),l=(d,h)=>(0,t.useMemo)(()=>{let p=!1;const m=[];for(const a of c){const v=d.get(a.value),E=h===a.value;(v||E)&&m.push({...a,label:`${a.label} (${d.get(a.value)})`}),E&&(p=!0)}return h&&!p&&m.push({value:h,label:`${h} (No matches)`}),m},[d,h]),f={id:o.Ct.byType,component:u,matcher:s.sJ.get(o.Ct.byType),name:"Fields with type",description:"Set properties for fields of a specific type (number, string, boolean)",optionsToLabel:d=>d}},19346:(Q,A,e)=>{"use strict";e.d(A,{N:()=>l,r1:()=>p});var t=e(32196),n=e(96540),o=e(75059),s=e(1173),r=e(85200),g=e(52622),u=e(40845),c=e(10354),i=e(88323);const l=[{label:"==",value:g.zT.EQ},{label:"!=",value:g.zT.NEQ},{label:">",value:g.zT.GT},{label:">=",value:g.zT.GTE},{label:"<",value:g.zT.LT},{label:"<=",value:g.zT.LTE}];function f(m){return m===o.gy.allIsNull||m===o.gy.allIsZero}const d=({options:m,onChange:a})=>{const v=(0,u.of)(h),E=(0,n.useMemo)(()=>o.AS.selectOptions([m?.reducer]),[m?.reducer]),D=(0,n.useCallback)(T=>a({...m,reducer:T.value}),[m,a]),b=(0,n.useCallback)(T=>a({...m,op:T.value}),[m,a]),C=(0,n.useCallback)(T=>{const I=T.currentTarget.valueAsNumber;return a({...m,value:I})},[m,a]),y=m??{},M=f(m.reducer);return n.createElement("div",{className:v.spot},n.createElement(i.l6,{value:E.current,options:E.options,onChange:D,placeholder:"Select field reducer"}),y.reducer&&!M&&n.createElement(n.Fragment,null,n.createElement(i.l6,{value:l.find(T=>T.value===y.op),options:l,onChange:b,"aria-label":"Comparison operator",width:19}),n.createElement(c.p,{type:"number",value:y.value,onChange:C})))},h=m=>({spot:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"center",alignContent:"flex-end",gap:"4px"})}),p={id:s.Ct.byValue,component:d,matcher:r.sJ.get(s.Ct.byValue),name:"Fields with values",description:"Set properties for fields with reducer condition",optionsToLabel:m=>`${m?.reducer} ${m?.op} ${m?.value}`}},74668:(Q,A,e)=>{"use strict";e.d(A,{R:()=>l,X:()=>u});var t=e(96540),n=e(28240),o=e(1173),s=e(85200),r=e(88323);const g=(f,d,h)=>{if(!h)return;let p=f.find(m=>!d.some(a=>m===a));if(p)return p};function u({value:f,data:d,onChange:h,placeholder:p}){const m=(0,t.useMemo)(()=>c(d),[d]),[a,v]=(0,t.useState)({refIds:[],value:void 0}),E=(0,t.useMemo)(()=>m.find(b=>b.value===f)??g(m,a.refIds,a.value),[f,m,a]),D=(0,t.useCallback)(b=>{h(b?.value)},[h]);return(m!==a.refIds||E?.value!==a.value)&&v({refIds:m,value:E?.value}),t.createElement(r.l6,{options:m,onChange:D,isClearable:!0,placeholder:p??"Select query refId",value:E})}function c(f){const d=new Map;for(const p of f){const m=p.refId??"",a=d.get(m)??[];a.length===0&&d.set(m,a),a.push(p)}const h=[];for(const[p,m]of d.entries())h.push({value:p,label:`Query: ${p??"(missing refId)"}`,description:i(m)});return h}function i(f){return`Frames (${f.length}): ${f.slice(0,Math.min(3,f.length)).map(d=>(0,n.Ri)(d)).join(", ")} ${f.length>3?"...":""}`}const l={id:o.Ct.byFrameRefID,component:f=>t.createElement(u,{value:f.options,data:f.data,onChange:f.onChange}),matcher:s.sJ.get(o.Ct.byFrameRefID),name:"Fields returned by query",description:"Set properties for fields from a specific query",optionsToLabel:f=>f}},84349:(Q,A,e)=>{"use strict";e.d(A,{g:()=>v});var t=e(83077),n=e(96540),o=e(1173),s=e(85200),r=e(10354);const g=(0,n.memo)(E=>{const{options:D,onChange:b}=E,C=(0,n.useCallback)(y=>b(y.target.value),[b]);return n.createElement(r.p,{placeholder:"Enter regular expression",defaultValue:D,onBlur:C})});g.displayName="FieldNameByRegexMatcherEditor";const u={id:o.Ct.byRegexp,component:g,matcher:s.sJ.get(o.Ct.byRegexp),name:"Fields with name matching regex",description:"Set properties for fields with names matching a regex",optionsToLabel:E=>E};var c=e(88323),i=e(64278);const l=(0,n.memo)(E=>{const{data:D,options:b,onChange:C,id:y}=E,M=(0,i.sE)(D),T=(0,i.m3)(M,b),I=(0,n.useCallback)(S=>{if((0,i.v3)(S.value,M))return C(S.value)},[M,C]),x=T.find(S=>S.value===b);return n.createElement(c.l6,{value:x,options:T,onChange:I,inputId:y})});l.displayName="FieldNameMatcherEditor";const f={id:o.Ct.byName,component:l,matcher:s.sJ.get(o.Ct.byName),name:"Fields with name",description:"Set properties for a specific field",optionsToLabel:E=>E},d=(0,n.memo)(E=>{const{data:D,options:b,onChange:C}=E,{readOnly:y,prefix:M}=b,T=(0,i.sE)(D),I=(0,i.m3)(T,void 0),x=(0,n.useCallback)(S=>{if(Array.isArray(S))return C({...b,names:S.reduce((O,P)=>((0,i.v3)(P.value,T)&&O.push(P.value),O),[])})},[T,C,b]);if(y){const S=(b.names??[]).join(", ");return n.createElement(r.p,{value:S,readOnly:!0,disabled:!0,prefix:M})}return n.createElement(c.KF,{value:b.names,options:I,onChange:x})});d.displayName="FieldNameMatcherEditor";const h={id:o.Ct.byNames,component:d,matcher:s.sJ.get(o.Ct.byNames),name:"Fields with name",description:"Set properties for a specific field",optionsToLabel:E=>(E.names??[]).join(", "),excludeFromPicker:!0};var p=e(9988),m=e(19346),a=e(74668);const v=new t.O(()=>[f,u,p.cH,a.R,h,m.r1])},64278:(Q,A,e)=>{"use strict";e.d(A,{BP:()=>g,m3:()=>c,sE:()=>u,v3:()=>r});var t=e(96540),n=e(28240),o=e(27310),s=e(4025);function r(i,l){return i?l.display.has(i)||l.raw.has(i):!1}function g(i,l){const f={display:new Set,raw:new Set,fields:new Map};for(const d of i)for(const h of d.fields){if(l&&!l(h))continue;const p=(0,n.Ct)(h,d,i);f.display.add(p),f.fields.set(p,h),h.name&&p!==h.name&&(f.raw.add(h.name),f.fields.set(h.name,h))}return f}function u(i,l){return(0,t.useMemo)(()=>g(i,l),[i,l])}function c(i,l,f,d,h){return(0,t.useMemo)(()=>{let p=!1;const m=[];if(f&&m.push(f),h===o.X4.OnlyBaseNames)for(const a of i.raw)!p&&a===l&&(p=!0),m.push({value:a,label:`${a} (base field name)`});else{for(const a of i.display){!p&&a===l&&(p=!0);const v=i.fields.get(a);(!d||d===v?.type)&&m.push({value:a,label:a,icon:v?(0,s.SS)(v):void 0})}if(h!==o.X4.ExcludeBaseNames)for(const a of i.raw)i.display.has(a)||(!p&&a===l&&(p=!0),m.push({value:a,label:`${a} (base field name)`}))}return l&&!p&&m.push({value:l,label:`${l} (not found)`}),m},[i,l,f,d,h])}},38138:(Q,A,e)=>{"use strict";e.d(A,{W:()=>i});var t=e(32196),n=e(96540),o=e(40845),s=e(27183),r=e(59093),g=e(64539),u=e(32653);const c=n.forwardRef(({header:f,children:d,ariaLabel:h,onOpen:p,onClose:m,onKeyDown:a,...v},E)=>{const D=(0,o.of)(l),b=(0,n.useRef)(null);(0,n.useImperativeHandle)(E,()=>b.current);const[C]=(0,u.t)({localRef:b,onOpen:p,onClose:m,onKeyDown:a});return n.createElement("div",{...v,tabIndex:-1,ref:b,className:D.wrapper,role:"menu","aria-label":h,onKeyDown:C},f&&n.createElement("div",{className:(0,t.cx)(D.header,!!d&&n.Children.toArray(d).length>0&&D.headerBorder)},f),d)});c.displayName="Menu";const i=Object.assign(c,{Item:g.D,Divider:s.N,Group:r.r}),l=f=>({header:(0,t.css)({padding:`${f.spacing(.5,1,1,1)}`}),headerBorder:(0,t.css)({borderBottom:`1px solid ${f.colors.border.weak}`}),wrapper:(0,t.css)({background:`${f.colors.background.primary}`,boxShadow:`${f.shadows.z3}`,display:"inline-block",borderRadius:`${f.shape.radius.default}`,padding:`${f.spacing(.5,0)}`})})},27183:(Q,A,e)=>{"use strict";e.d(A,{N:()=>s});var t=e(32196),n=e(96540),o=e(40845);function s(){const g=(0,o.of)(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)})})},59093:(Q,A,e)=>{"use strict";e.d(A,{r:()=>g});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(40845);const g=({label:c,ariaLabel:i,children:l})=>{const f=(0,r.of)(u),d=`group-label-${(0,n.uniqueId)()}`;return s.createElement("div",{role:"group","aria-labelledby":!i&&c?d:void 0,"aria-label":i},c&&s.createElement("label",{id:d,className:f.groupLabel,"aria-hidden":!0},c),l)};g.displayName="MenuGroup";const u=c=>({groupLabel:(0,t.css)({color:c.colors.text.secondary,fontSize:c.typography.size.sm,padding:c.spacing(.5,1)})})},64539:(Q,A,e)=>{"use strict";e.d(A,{D:()=>d});var t=e(32196),n=e(96540),o=e(40845),s=e(16797),r=e(14578),g=e(67061),u=e(13544),c=e(32653);const i=p=>{if(!p)return!1;const m=p.parentElement.getBoundingClientRect(),a=p.getBoundingClientRect();return a.width!==0&&m.right+a.width+10>window.innerWidth},l=n.memo(({items:p,isOpen:m,openedWithArrow:a,setOpenedWithArrow:v,close:E,customStyle:D})=>{const b=(0,o.of)(f),C=(0,n.useRef)(null),[y]=(0,c.t)({localRef:C,isMenuOpen:m,openedWithArrow:a,setOpenedWithArrow:v,close:E}),[M,T]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{m&&C.current&&T(i(C.current))},[m]),n.createElement(n.Fragment,null,n.createElement("div",{className:b.iconWrapper,"aria-hidden":!0,"data-testid":u.Tp.components.Menu.SubMenu.icon},n.createElement(r.I,{name:"angle-right",className:b.icon})),m&&n.createElement("div",{ref:C,className:(0,t.cx)(b.subMenu,{[b.pushLeft]:M}),"data-testid":u.Tp.components.Menu.SubMenu.container,style:D},n.createElement("div",{tabIndex:-1,className:b.itemsWrapper,role:"menu",onKeyDown:y},p)))});l.displayName="SubMenu";const f=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.radius.default}),pushLeft:(0,t.css)({right:"100%",left:"unset"}),subMenu:(0,t.css)({position:"absolute",top:0,left:"100%",zIndex:p.zIndex.dropdown})}),d=n.memo(n.forwardRef((p,m)=>{const{url:a,icon:v,label:E,description:D,ariaLabel:b,ariaChecked:C,target:y,onClick:M,className:T,active:I,disabled:x,destructive:S,childItems:O,role:P="menuitem",tabIndex:L=-1,customSubMenuContainerStyles:U,shortcut:R,testId:B}=p,H=(0,o.of)(h),[w,N]=(0,n.useState)(I),[V,G]=(0,n.useState)(!1),[_,K]=(0,n.useState)(!1),j=(0,n.useCallback)(()=>{x||(G(!0),N(!0))},[x]),k=(0,n.useCallback)(()=>{x||(G(!1),N(!1))},[x]),Y=O&&O.length>0,ee=Y?"div":a===void 0?"button":"a",re=(0,t.cx)({[H.item]:!0,[H.active]:w,[H.disabled]:x,[H.destructive]:S&&!x},T),J={[ee==="button"?"disabled":"aria-disabled"]:x,...ee==="a"&&x&&{href:void 0,onClick:void 0},...x&&{tabIndex:-1,["data-disabled"]:x}},ne=(0,n.useRef)(null);(0,n.useImperativeHandle)(m,()=>ne.current);const q=ue=>{switch(ue.key){case"ArrowRight":ue.preventDefault(),ue.stopPropagation(),Y&&(G(!0),K(!0),N(!0));break;default:break}},te=()=>{G(!1),N(!1),ne?.current?.focus()},oe=!!(R&&R.length>0);return n.createElement(ee,{target:y,className:re,rel:y==="_blank"?"noopener noreferrer":void 0,href:a,onClick:M,onMouseEnter:j,onMouseLeave:k,onKeyDown:q,role:a===void 0?P:void 0,"data-role":"menuitem",ref:ne,"data-testid":B,"aria-label":b,"aria-checked":C,tabIndex:L,...J},n.createElement(g.B,{direction:"row",justifyContent:"flex-start",alignItems:"center"},v&&n.createElement(r.I,{name:v,className:H.icon,"aria-hidden":!0}),n.createElement("span",{className:H.ellipsis},E),n.createElement("div",{className:(0,t.cx)(H.rightWrapper,{[H.withShortcut]:oe})},oe&&n.createElement("div",{className:H.shortcut},n.createElement(r.I,{name:"keyboard",title:"keyboard shortcut"}),R),Y&&n.createElement(l,{items:O,isOpen:V,openedWithArrow:_,setOpenedWithArrow:K,close:te,customStyle:U}))),D&&n.createElement("div",{className:(0,t.cx)(H.description,H.ellipsis,{[H.descriptionWithIcon]:v!==void 0})},D))}));d.displayName="MenuItem";const h=p=>({item:(0,t.css)({background:"none",cursor:"pointer",whiteSpace:"nowrap",color:p.colors.text.primary,display:"flex",flexDirection:"column",alignItems:"stretch",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,label:"menu-item-disabled","&:hover, &:focus, &:focus-visible":{cursor:"not-allowed",background:"none",color:p.colors.action.disabledText}}),icon:(0,t.css)({opacity:.7,color:p.colors.text.secondary}),rightWrapper:(0,t.css)({display:"flex",alignItems:"center",marginLeft:"auto"}),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}),description:(0,t.css)({...p.typography.bodySmall,color:p.colors.text.secondary,textAlign:"start"}),descriptionWithIcon:(0,t.css)({marginLeft:p.spacing(3)}),ellipsis:(0,t.css)({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})})},32653:(Q,A,e)=>{"use strict";e.d(A,{t:()=>r});var t=e(96540),n=e(94701);const o=(g,u)=>(g%u+u)%u,s=-1,r=({localRef:g,isMenuOpen:u,openedWithArrow:c,setOpenedWithArrow:i,close:l,onOpen:f,onClose:d,onKeyDown:h})=>{const[p,m]=(0,t.useState)(s);return(0,t.useEffect)(()=>{u&&c&&(m(0),i?.(!1))},[u,c,i]),(0,t.useEffect)(()=>{const v=g?.current?.querySelectorAll('[data-role="menuitem"]:not([data-disabled])');v?.[p]?.focus(),v?.forEach((E,D)=>{E.tabIndex=D===p?0:-1})},[g,p]),(0,n.A)(()=>{f?.(m)}),[v=>{const E=g?.current?.querySelectorAll('[data-role="menuitem"]:not([data-disabled])'),D=E?.length??0;switch(v.key){case"ArrowUp":v.preventDefault(),v.stopPropagation(),m(o(p-1,D));break;case"ArrowDown":v.preventDefault(),v.stopPropagation(),m(o(p+1,D));break;case"ArrowLeft":v.preventDefault(),v.stopPropagation(),m(s),l?.();break;case"Home":v.preventDefault(),v.stopPropagation(),m(0);break;case"End":v.preventDefault(),v.stopPropagation(),m(D-1);break;case"Enter":v.preventDefault(),v.stopPropagation(),E?.[p]?.click();break;case"Escape":d?.();break;case"Tab":v.preventDefault(),d?.();break;default:break}h?.(v)}]}},37390:(Q,A,e)=>{"use strict";e.d(A,{a:()=>d});var t=e(32196),n=e(80279),o=e(7887),s=e(82148),r=e(96540),g=e(40845),u=e(76412),c=e(29158),i=e(66864),l=e(29473),f=e(88448);function d(m){const{title:a,children:v,isOpen:E=!1,closeOnEscape:D=!0,closeOnBackdropClick:b=!0,className:C,contentClassName:y,onDismiss:M,onClickBackdrop:T,trapFocus:I=!0}=m,x=(0,g.of)(f.o),S=(0,r.useRef)(null),{overlayProps:O,underlayProps:P}=(0,s.e)({isKeyboardDismissDisabled:!D,isOpen:E,onClose:M},S),{dialogProps:L,titleProps:U}=(0,n.s)({},S);if(!E)return null;const R=(0,t.cx)(x.modalHeader,typeof a!="string"&&x.modalHeaderWithTabs);return r.createElement(s.Sf,null,r.createElement("div",{role:"presentation",className:x.modalBackdrop,onClick:T||(b?M:void 0),...P}),r.createElement(o.n1,{contain:I,autoFocus:!0,restoreFocus:!0},r.createElement("div",{className:(0,t.cx)(x.modal,C),ref:S,...O,...L},r.createElement("div",{className:R},typeof a=="string"&&r.createElement(p,{...m,title:a,id:U.id}),typeof a!="string"&&a,r.createElement("div",{className:x.modalHeaderClose},r.createElement(c.K,{name:"times",size:"xl",onClick:M,"aria-label":(0,u.t)("grafana-ui.modal.close-tooltip","Close")}))),r.createElement("div",{className:(0,t.cx)(x.modalContent,y)},v))))}function h({leftItems:m,children:a}){const v=(0,g.of)(f.o);return m?r.createElement("div",{className:v.modalButtonRow},r.createElement(i.Gy,{justify:"space-between"},r.createElement(i.Gy,{justify:"flex-start",spacing:"md"},m),r.createElement(i.Gy,{justify:"flex-end",spacing:"md"},a))):r.createElement("div",{className:v.modalButtonRow},r.createElement(i.Gy,{justify:"flex-end",spacing:"md",wrap:!0},a))}d.ButtonRow=h;function p({icon:m,iconTooltip:a,title:v,id:E}){return r.createElement(l.r,{icon:m,iconTooltip:a,title:v,id:E})}},29473:(Q,A,e)=>{"use strict";e.d(A,{r:()=>s});var t=e(96540),n=e(40845),o=e(88448);const s=({icon:r,iconTooltip:g,title:u,children:c,id:i})=>{const l=(0,n.of)(o.o);return t.createElement(t.Fragment,null,t.createElement("h2",{className:l.modalHeaderTitle,id:i},u),c)}},95246:(Q,A,e)=>{"use strict";e.d(A,{O:()=>n});var t=e(96540);const n=({children:o})=>t.createElement("div",{className:"share-modal-body"},t.createElement("div",{className:"share-modal-header"},t.createElement("div",{className:"share-modal-content"},o)))},25897:(Q,A,e)=>{"use strict";e.d(A,{J:()=>r});var t=e(96540),n=e(40675),o=e(63021),s=e(29473);const r=({icon:g,title:u,tabs:c,activeTab:i,onChangeTab:l})=>t.createElement(s.r,{icon:g,title:u},t.createElement(o.U,{hideBorder:!0},c.map((f,d)=>t.createElement(n.o,{key:`${f.value}-${d}`,label:f.label,icon:f.icon,suffix:f.tabSuffix,active:f.value===i,onChangeTab:()=>l(f)}))))},71678:(Q,A,e)=>{"use strict";e.d(A,{$s:()=>r,EO:()=>s,YO:()=>o,wE:()=>n});var t=e(96540);const n=t.createContext({component:null,props:{},showModal:()=>{},hideModal:()=>{}});class o extends t.Component{constructor(u){super(u),this.showModal=(c,i)=>{this.setState({component:c,props:i})},this.hideModal=()=>{this.setState({component:null,props:{}})},this.state={component:u.component||null,props:u.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:u})=>g?t.createElement(g,{...u}):null),r=n.Consumer},88448:(Q,A,e)=>{"use strict";e.d(A,{o:()=>n});var t=e(32196);const n=o=>{const s=o.shape.radius.default;return{modal:(0,t.css)({position:"fixed",zIndex:o.zIndex.modal,background:o.colors.background.primary,boxShadow:o.shadows.z3,borderRadius:s,border:`1px solid ${o.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:o.zIndex.modalBackdrop,top:0,right:0,bottom:0,left:0,backgroundColor:o.components.overlay.background,backdropFilter:"blur(1px)"}),modalHeader:(0,t.css)({label:"modalHeader",display:"flex",alignItems:"center",minHeight:"42px",margin:o.spacing(1,2,0,2)}),modalHeaderWithTabs:(0,t.css)({borderBottom:`1px solid ${o.colors.border.weak}`}),modalHeaderTitle:(0,t.css)({fontSize:o.typography.size.lg,margin:o.spacing(0,4,0,1),display:"flex",alignItems:"center",position:"relative",top:"2px"}),modalHeaderIcon:(0,t.css)({marginRight:o.spacing(2),fontSize:"inherit","&:before":{verticalAlign:"baseline"}}),modalHeaderClose:(0,t.css)({height:"100%",display:"flex",alignItems:"center",color:o.colors.text.secondary,flexGrow:1,justifyContent:"flex-end"}),modalContent:(0,t.css)({overflow:"auto",padding:o.spacing(3),width:"100%"}),modalButtonRow:(0,t.css)({paddingTop:o.spacing(3)})}}},32372:(Q,A,e)=>{"use strict";e.d(A,{B:()=>h});var t=e(32196),n=e(96540),o=e(96915),s=e(13544),r=e(40845),g=e(85828),u=e(19716);function c(m){for(let a=m.length-1;a>0;a--){const v=m.charAt(a);if(v==="$")return{index:a,prefix:m.substring(a)};if(v===" "||v===" "||v==='"'||v==="'")return{index:a+1,prefix:m.substring(a+1)}}return{index:0,prefix:m}}function i(m,a,v,E){const D=[];for(const b of v)a&&!b.label.startsWith(a)||D.push({...b,kind:l(m,b.kind),range:E,insertText:b.insertText??b.label});return D}function l(m,a){switch(a){case u.q.Method:return m.languages.CompletionItemKind.Method;case u.q.Field:return m.languages.CompletionItemKind.Field;case u.q.Property:return m.languages.CompletionItemKind.Property;case u.q.Constant:return m.languages.CompletionItemKind.Constant;case u.q.Text:return m.languages.CompletionItemKind.Text}return m.languages.CompletionItemKind.Text}function f(m,a,v,E){if(!(!a||!v))return m.languages.registerCompletionItemProvider(a,{triggerCharacters:["$"],provideCompletionItems:(D,b,C)=>{if(D.id!==E)return;const y={startLineNumber:b.lineNumber,endLineNumber:b.lineNumber,startColumn:b.column,endColumn:b.column};if(C.triggerCharacter==="$")return y.startColumn=b.column-1,{suggestions:i(m,"$",v(),y)};const M=D.getValueInRange({startLineNumber:b.lineNumber,startColumn:1,endLineNumber:b.lineNumber,endColumn:b.column}),{index:T,prefix:I}=c(M);y.startColumn=T+1;const x=i(m,I,v(),y);if(x.length)return{suggestions:x}}})}class d extends n.PureComponent{constructor(a){super(a),this.loadCustomLanguage=()=>{const{language:v}=this.props,E=o.l.getIfExists(v);return E?E.init():Promise.resolve()},this.getEditorValue=()=>"",this.onBlur=()=>{const{onBlur:v}=this.props;v&&v(this.getEditorValue())},this.onFocus=()=>{const{onFocus:v}=this.props;v&&v(this.getEditorValue())},this.onSave=()=>{const{onSave:v}=this.props;v&&v(this.getEditorValue())},this.handleBeforeMount=v=>{this.monaco=v;const{onBeforeEditorMount:E}=this.props;E?.(v)},this.handleOnMount=(v,E)=>{const{getSuggestions:D,language:b,onChange:C,onEditorDidMount:y}=this.props;this.modelId=v.getModel()?.id,this.getEditorValue=()=>v.getValue(),D&&this.modelId&&(this.completionCancel=f(E,b,D,this.modelId)),v.onKeyDown(T=>{T.keyCode===E.KeyCode.KeyS&&(T.ctrlKey||T.metaKey)&&(T.preventDefault(),this.onSave())});const M=this.loadCustomLanguage();C&&v.getModel()?.onDidChangeContent(()=>C(v.getValue())),y&&M.then(()=>y(v,E))}}componentWillUnmount(){this.completionCancel&&this.completionCancel.dispose(),this.props.onEditorWillUnmount?.()}componentDidUpdate(a){const{getSuggestions:v,language:E}=this.props,D=a.language!==E;if(a.getSuggestions!==v||D){if(this.completionCancel&&this.completionCancel.dispose(),!this.monaco){console.warn("Monaco instance not loaded yet");return}v&&this.modelId&&(this.completionCancel=f(this.monaco,E,v,this.modelId))}D&&this.loadCustomLanguage()}render(){const{theme:a,language:v,width:E,height:D,showMiniMap:b,showLineNumbers:C,readOnly:y,monacoOptions:M}=this.props,{alwaysConsumeMouseWheel:T,...I}=M??{},x=this.props.value??"",S=x.length>100,O=this.props.containerStyles??p(a).container,P={wordWrap:"off",tabSize:2,codeLens:!1,contextmenu:!1,minimap:{enabled:S&&b,renderCharacters:!1},readOnly:y,lineNumbersMinChars:4,lineDecorationsWidth:1*a.spacing.gridSize,overviewRulerBorder:!1,automaticLayout:!0,padding:{top:.5*a.spacing.gridSize,bottom:.5*a.spacing.gridSize},fixedOverflowWidgets:!0,scrollbar:{alwaysConsumeMouseWheel:T??!1}};return C||(P.glyphMargin=!1,P.folding=!1,P.lineNumbers="off",P.lineNumbersMinChars=0),n.createElement("div",{className:O,onFocus:this.onFocus,onBlur:this.onBlur,"data-testid":s.Tp.components.CodeEditor.container},n.createElement(g.m,{width:E,height:D,language:v,value:x,options:{...P,...I??{}},beforeMount:this.handleBeforeMount,onMount:this.handleOnMount,keepCurrentModel:!0}))}}const h=(0,r.cV)(d),p=m=>({container:(0,t.css)({borderRadius:m.shape.radius.default,border:`1px solid ${m.components.input.borderColor}`})})},85828:(Q,A,e)=>{"use strict";e.d(A,{m:()=>g});var t=e(96540),n=e(16817);const o=u=>{const c=(0,n.A)(async()=>await u);return{...c,dependency:c.value}};var s=e(52446),r=e(39558);const g=u=>{const{loading:c,error:i,dependency:l}=o(e.e(8926).then(e.bind(e,16556)));if(c)return t.createElement(r._,{text:""});if(i)return t.createElement(s.D,{title:"React Monaco Editor failed to load",error:i,errorInfo:{componentStack:i?.stack||""}});const f=l.ReactMonacoEditor;return t.createElement(f,{...u})}},19716:(Q,A,e)=>{"use strict";e.d(A,{q:()=>t});var t=(n=>(n.Method="method",n.Field="field",n.Property="property",n.Constant="constant",n.Text="text",n))(t||{})},99544:(Q,A,e)=>{"use strict";e.d(A,{O:()=>n});var t=e(19716);function n(o){const s="${"+o.value+"}",r=o.value===o.label?o.origin:`${o.label} / ${o.origin}`;return{label:s,kind:t.q.Property,detail:r,documentation:o.documentation}}},95247:(Q,A,e)=>{"use strict";e.d(A,{d:()=>l});var t=e(32196),n=e(96540),o=e(13544),s=e(40845),r=e(16797),g=e(14578),u=e(29158),c=e(50720),i=e(15068);const l=n.memo(({title:d,section:h,parent:p,pageIcon:m,onGoBack:a,children:v,titleHref:E,parentHref:D,leftItems:b,isFullscreen:C,className:y,"aria-label":M,buttonOverflowAlignment:T="right",forceShowLeftItems:I=!1})=>{const x=(0,s.of)(f),S=(0,t.cx)("page-toolbar",x.toolbar,{["page-toolbar--fullscreen"]:C,[x.noPageIcon]:!m},y),O=n.createElement(n.Fragment,null,n.createElement("span",{className:x.truncateText},d),h&&n.createElement("span",{className:x.pre}," / ",h));return n.createElement("nav",{className:S,"aria-label":M},n.createElement("div",{className:x.leftWrapper},m&&!a&&n.createElement("div",{className:x.pageIcon},n.createElement(g.I,{name:m,size:"lg","aria-hidden":!0})),a&&n.createElement("div",{className:x.pageIcon},n.createElement(u.K,{name:"arrow-left",tooltip:"Go back (Esc)",tooltipPlacement:"bottom",size:"xxl","data-testid":o.Tp.components.BackButton.backArrow,onClick:a})),n.createElement("nav",{"aria-label":"Search links",className:x.navElement},p&&D&&n.createElement(n.Fragment,null,n.createElement(c.N,{"aria-label":`Search dashboard in the ${p} folder`,className:(0,t.cx)(x.titleText,x.parentLink,x.titleLink,x.truncateText),href:D},p," ",n.createElement("span",{className:x.parentIcon})),E&&n.createElement("span",{className:(0,t.cx)(x.titleText,x.titleDivider),"aria-hidden":!0},"/")),(d||!!b?.length)&&n.createElement("div",{className:x.titleWrapper},d&&n.createElement("h1",{className:x.h1Styles},E?n.createElement(c.N,{"aria-label":"Search dashboard by name",className:(0,t.cx)(x.titleText,x.titleLink),href:E},O):n.createElement("div",{className:x.titleText},O)),b?.map((P,L)=>n.createElement("div",{className:(0,t.cx)(x.leftActionItem,{[x.forceShowLeftActionItems]:I}),key:L},P))))),n.createElement(i.U,{alignment:T},n.Children.toArray(v).filter(Boolean)))});l.displayName="PageToolbar";const f=d=>{const{spacing:h,typography:p}=d,m=(0,r.getFocusStyles)(d);return{pre:(0,t.css)({whiteSpace:"pre"}),toolbar:(0,t.css)({alignItems:"center",background:d.colors.background.canvas,display:"flex",gap:d.spacing(2),justifyContent:"space-between",padding:d.spacing(1.5,2),[d.breakpoints.down("md")]:{paddingLeft:"53px"}}),noPageIcon:(0,t.css)({[d.breakpoints.down("md")]:{paddingLeft:d.spacing(2)}}),leftWrapper:(0,t.css)({display:"flex",flexWrap:"nowrap",maxWidth:"70%"}),pageIcon:(0,t.css)({display:"none",[d.breakpoints.up("sm")]:{display:"flex",paddingRight:d.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:h(0,1,0,0),lineHeight:"inherit",flexGrow:1,minWidth:0}),parentIcon:(0,t.css)({marginLeft:d.spacing(.5)}),titleText:(0,t.css)({display:"flex",fontSize:p.size.lg,margin:0,borderRadius:d.shape.radius.default}),titleLink:(0,t.css)({"&:focus-visible":m}),titleDivider:(0,t.css)({padding:h(0,.5,0,.5),display:"none",[d.breakpoints.up("md")]:{display:"unset"}}),parentLink:(0,t.css)({display:"none",[d.breakpoints.up("md")]:{display:"unset",flex:1}}),leftActionItem:(0,t.css)({display:"none",alignItems:"center",paddingRight:h(.5),[d.breakpoints.up("md")]:{display:"flex"}}),forceShowLeftActionItems:(0,t.css)({display:"flex"})}}},19384:(Q,A,e)=>{"use strict";e.d(A,{d:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(55852),r=e(14578);const g=({currentPage:c,numberOfPages:i,onNavigate:l,hideWhenSinglePage:f,showSmallVersion:d,className:h})=>{const p=(0,o.of)(u),m=d?1:8,a=(0,n.useMemo)(()=>{const v=[...new Array(i).keys()],E=i>m,D=(b,C)=>n.createElement("li",{key:b,className:p.item},n.createElement(s.$n,{size:"sm",variant:C,onClick:()=>l(b)},b));return v.reduce((b,C)=>{const y=C+1,M=y===c?"primary":"secondary",T=m,I=i-m+1,x=I-T,S=y===1||y===i,O=x>-1&&c>=T&&c<=I,P=d?1:3,L=d?0:2;return E?S||c<T&&y<T||x>=0&&c>I&&y>I||x<0&&c>=T&&y>I||O&&y>=c-L&&y<=c+L?b.push(D(y,M)):(y===T&&c<T||y===I&&c>I||O&&(y===c-P||y===c+P))&&b.push(n.createElement("li",{key:y,className:p.item},n.createElement(r.I,{className:p.ellipsis,name:"ellipsis-v"}))):b.push(D(y,M)),b},[])},[c,i,l,m,d,p.ellipsis,p.item]);return f&&i<=1?null:n.createElement("div",{className:(0,t.cx)(p.container,h)},n.createElement("ol",null,n.createElement("li",{className:p.item},n.createElement(s.$n,{"aria-label":"previous page",size:"sm",variant:"secondary",onClick:()=>l(c-1),disabled:c===1},n.createElement(r.I,{name:"angle-left"}))),a,n.createElement("li",{className:p.item},n.createElement(s.$n,{"aria-label":"next page",size:"sm",variant:"secondary",onClick:()=>l(c+1),disabled:c===i},n.createElement(r.I,{name:"angle-right"})))))},u=()=>({container:(0,t.css)({float:"right"}),item:(0,t.css)({display:"inline-block",paddingLeft:"10px",marginBottom:"5px"}),ellipsis:(0,t.css)({transform:"rotate(90deg)"})})},89963:(Q,A,e)=>{"use strict";e.d(A,{I:()=>u});var t=e(32196),n=e(96540),o=e(13544),s=e(40845),r=e(14578),g=e(56034);const u=({onCancel:i,loading:l})=>{const f=(0,s.of)(c);return l?n.createElement(g.m,{content:"Cancel query"},n.createElement(r.I,{className:(0,t.cx)("spin-clockwise",{[f.clickable]:!!i}),name:"sync",size:"sm",onClick:i,"data-testid":o.Tp.components.LoadingIndicator.icon})):null},c=()=>({clickable:(0,t.css)({cursor:"pointer"})})},79041:(Q,A,e)=>{"use strict";e.d(A,{XF:()=>s,d2:()=>r,e4:()=>o});var t=e(96540),n=e(18226);const o=t.createContext({eventsScope:"global",eventBus:new n.o}),s=o.Provider,r=()=>t.useContext(o)},91052:(Q,A,e)=>{"use strict";e.d(A,{NR:()=>U});var t=e(89963),n=e(32196),o=e(96540),s=e(42941),r=e(49185),g=e(39070),u=e(13544),c=e(40845),i=e(16797);function l({children:R,delay:B}){const[H,w]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{window.setTimeout(()=>{w(!0)},B)},[R,B]),o.createElement(o.Fragment,null,H?R:null)}var f=e(14578),d=e(57514),h=e(56034),p=e(83122),m=e(27746);function a({menu:R,title:B,placement:H="bottom",offset:w,dragClassCancel:N,menuButtonClass:V,onOpenMenu:G}){const _=B?u.Tp.components.Panels.Panel.menu(B):"panel-menu-button",K=(0,o.useCallback)(j=>{j&&G&&G()},[G]);return o.createElement(p.m,{overlay:R,placement:H,offset:w,onVisibleChange:K},o.createElement(m.I,{"aria-label":`Menu for panel with ${B?`title ${B}`:"no title"}`,title:"Menu",icon:"ellipsis-v",iconSize:"md",narrow:!0,"data-testid":_,className:(0,n.cx)(V,N)}))}function v({menu:R,title:B,dragClass:H,children:w,offset:N=-32,onOpenMenu:V}){const G=(0,c.of)(E),_=(0,o.useRef)(null),K=u.Tp.components.Panels.Panel.HoverWidget,j=(0,o.useCallback)(Y=>{_.current?.setPointerCapture(Y.pointerId)},[]),k=(0,o.useCallback)(Y=>{_.current?.releasePointerCapture(Y.pointerId)},[]);return w===void 0||o.Children.count(w)===0?null:o.createElement("div",{className:(0,n.cx)(G.container,"show-on-hover"),style:{top:N},"data-testid":K.container},H&&o.createElement("div",{className:(0,n.cx)(G.square,G.draggable,H),onPointerDown:j,onPointerUp:k,ref:_,"data-testid":K.dragIcon},o.createElement(f.I,{name:"expand-arrows",className:G.draggableIcon})),w,R&&o.createElement(a,{menu:R,title:B,placement:"bottom",menuButtonClass:G.menuButton,onOpenMenu:V}))}function E(R){return{container:(0,n.css)({label:"hover-container-widget",transition:"all .1s linear",display:"flex",position:"absolute",zIndex:1,right:0,boxSizing:"content-box",alignItems:"center",background:R.colors.background.secondary,color:R.colors.text.primary,border:`1px solid ${R.colors.border.weak}`,borderRadius:R.shape.radius.default,height:R.spacing(4),boxShadow:R.shadows.z1}),square:(0,n.css)({display:"flex",justifyContent:"center",alignItems:"center",width:R.spacing(4),height:"100%"}),draggable:(0,n.css)({cursor:"move",[R.breakpoints.down("md")]:{display:"none"}}),menuButton:(0,n.css)({background:"inherit",border:"none","&:hover":{background:R.colors.secondary.main}}),draggableIcon:(0,n.css)({transform:"rotate(45deg)",color:R.colors.text.secondary,"&:hover":{color:R.colors.text.primary}})}}var D=e(55852);const b=(0,o.forwardRef)(({className:R,children:B,href:H,onClick:w,target:N,title:V,...G},_)=>{const K=(0,c.of)(C);return H?o.createElement("a",{ref:_,href:H,onClick:w,target:N,title:V,className:(0,n.cx)(K.linkItem,R),...G},B):w?o.createElement(D.$n,{ref:_,className:(0,n.cx)(K.item,R),variant:"secondary",fill:"text",onClick:w},B):o.createElement("span",{ref:_,className:(0,n.cx)(K.item,R),...G},B)});b.displayName="TitleItem";const C=R=>{const B=(0,n.css)({color:`${R.colors.text.secondary}`,label:"panel-header-item",cursor:"auto",border:"none",borderRadius:`${R.shape.radius.default}`,padding:`${R.spacing(0,1)}`,height:`${R.spacing(R.components.panel.headerHeight)}`,display:"flex",alignItems:"center",justifyContent:"center","&:focus, &:focus-visible":{...(0,i.getFocusStyles)(R),zIndex:1},"&: focus:not(:focus-visible)":(0,i.getMouseFocusStyles)(R),"&:hover ":{boxShadow:`${R.shadows.z1}`,background:`${R.colors.background.secondary}`,color:`${R.colors.text.primary}`}});return{item:B,linkItem:(0,n.cx)(B,(0,n.css)({cursor:"pointer"}))}};function y({description:R,className:B}){const H=(0,c.of)(M),w=()=>{const N=typeof R=="function"?R():R;return o.createElement("div",{className:"panel-info-content markdown-html"},o.createElement("div",{dangerouslySetInnerHTML:{__html:N}}))};return R!==""?o.createElement(h.m,{interactive:!0,content:w},o.createElement(b,{className:(0,n.cx)(B,H.description)},o.createElement(f.I,{name:"info-circle",size:"md"}))):null}const M=R=>({description:(0,n.css)({code:{whiteSpace:"normal",wordWrap:"break-word"},"pre > code":{display:"block"}})});function T({message:R,onClick:B,ariaLabel:H="status"}){const w=(0,c.of)(I);return o.createElement(m.I,{className:w.buttonStyles,onClick:B,variant:"destructive",icon:"exclamation-triangle",iconSize:"md",tooltip:R||"","aria-label":H,"data-testid":u.Tp.components.Panels.Panel.status("error")})}const I=R=>{const{headerHeight:B,padding:H}=R.components.panel;return{buttonStyles:(0,n.css)({label:"panel-header-state-button",display:"flex",alignItems:"center",justifyContent:"center",padding:R.spacing(H),width:R.spacing(B),height:R.spacing(B),borderRadius:R.shape.radius.default})}};function x({width:R,height:B,children:H,padding:w="md",title:N="",description:V="",displayMode:G="default",titleItems:_,menu:K,dragClass:j,dragClassCancel:k,hoverHeader:Y=!1,hoverHeaderOffset:ee,loadingState:re,statusMessage:J,statusMessageOnClick:ne,leftItems:q,actions:te,onCancelQuery:oe,onOpenMenu:ue,collapsible:ie=!1,collapsed:ge,onToggleCollapse:he}){const De=(0,c.$j)(),pe=(0,c.of)(L),le=(0,o.useId)(),Te=!Y,[Ee,Re]=(0,s.A)(!0);ge===void 0&&(ge=!Ee);const me="show-on-hover",Me=G==="transparent",ye=O(De,Te),{contentStyle:Le,innerWidth:We,innerHeight:Be}=P(w,De,ye,ge,B,R),Ye={height:ye,cursor:j?"move":"auto"},at={width:R,height:ge?void 0:B},[st,{width:Ke}]=(0,r.A)();q&&(te=q);const Xe=typeof N=="string"?u.Tp.components.Panels.Panel.title(N):"Panel",He=o.createElement(o.Fragment,null,!ie&&N&&o.createElement("h6",{title:typeof N=="string"?N:void 0,className:pe.title},N),ie&&o.createElement("h6",{className:pe.title},o.createElement("button",{type:"button",className:pe.clearButtonStyles,onClick:()=>{Re(),he&&he(!ge)},"aria-expanded":!ge,"aria-controls":ge?void 0:le},o.createElement(f.I,{name:ge?"angle-right":"angle-down","aria-hidden":!!N,"aria-label":N?void 0:"toggle collapse panel"}),N)),o.createElement("div",{className:(0,n.cx)(pe.titleItems,k),"data-testid":"title-items-container"},o.createElement(y,{description:V,className:k}),_),re===g.Gu.Streaming&&o.createElement(h.m,{content:oe?"Stop streaming":"Streaming"},o.createElement(b,{className:k,"data-testid":"panel-streaming",onClick:oe},o.createElement(f.I,{name:"circle-mono",size:"md",className:pe.streaming}))),re===g.Gu.Loading&&oe&&o.createElement(l,{delay:2e3},o.createElement(h.m,{content:"Cancel query"},o.createElement(b,{className:(0,n.cx)(k,pe.pointer),"data-testid":"panel-cancel-query",onClick:oe},o.createElement(f.I,{name:"sync-slash",size:"md"})))),o.createElement("div",{className:pe.rightAligned},te&&o.createElement("div",{className:pe.rightActions},S(te,Ge=>Ge))));return o.createElement("div",{className:(0,n.cx)(pe.container,{[pe.transparentContainer]:Me}),style:at,"data-testid":Xe,tabIndex:0,ref:st},o.createElement("div",{className:pe.loadingBarContainer},re===g.Gu.Loading?o.createElement(d.G,{width:Ke,ariaLabel:"Panel loading bar"}):null),Y&&o.createElement(o.Fragment,null,o.createElement(v,{menu:K,title:typeof N=="string"?N:void 0,offset:ee,dragClass:j,onOpenMenu:ue},He),J&&o.createElement("div",{className:pe.errorContainerFloating},o.createElement(T,{message:J,onClick:ne,ariaLabel:"Panel status"}))),Te&&o.createElement("div",{className:(0,n.cx)(pe.headerContainer,j),style:Ye,"data-testid":"header-container"},J&&o.createElement("div",{className:k},o.createElement(T,{message:J,onClick:ne,ariaLabel:"Panel status"})),He,K&&o.createElement(a,{menu:K,title:typeof N=="string"?N:void 0,placement:"bottom-end",menuButtonClass:(0,n.cx)(pe.menuItem,k,me),onOpenMenu:ue})),!ge&&o.createElement("div",{id:le,className:(0,n.cx)(pe.content,B===void 0&&pe.containNone),style:Le},typeof H=="function"?H(We,Be):H))}const S=(R,B)=>{const H=o.Children.toArray(R).filter(Boolean);return H.length>0?B(H):null},O=(R,B)=>B?R.spacing.gridSize*R.components.panel.headerHeight:0,P=(R,B,H,w,N,V)=>{const G=(R==="md"?B.components.panel.padding:0)*B.spacing.gridSize,_=G*2,K=1*2;let j=0;V&&(j=V-_-K);let k=0;return N&&(k=N-H-_-K),w&&(k=H),{contentStyle:{padding:G},innerWidth:j,innerHeight:k}},L=R=>{const{background:B,borderColor:H,padding:w}=R.components.panel;return{container:(0,n.css)({label:"panel-container",backgroundColor:B,border:`1px solid ${H}`,position:"relative",borderRadius:R.shape.radius.default,height:"100%",display:"flex",flexDirection:"column","> *":{zIndex:0},"&:hover, &:active, &:focus":{zIndex:R.zIndex.activePanel},".show-on-hover":{opacity:"0",visibility:"hidden"},"&:focus-visible, &:hover":{".show-on-hover":{opacity:"1",visibility:"visible"}},"&:focus-visible":(0,i.getFocusStyles)(R),"&:focus-within:not(:focus)":{".show-on-hover":{visibility:"visible",opacity:"1"}}}),transparentContainer:(0,n.css)({label:"panel-transparent-container",backgroundColor:"transparent",border:"1px solid transparent",boxSizing:"border-box","&:hover":{border:`1px solid ${H}`}}),loadingBarContainer:(0,n.css)({label:"panel-loading-bar-container",position:"absolute",top:0,width:"100%"}),containNone:(0,n.css)({contain:"none"}),content:(0,n.css)({label:"panel-content",flexGrow:1,contain:"size layout"}),headerContainer:(0,n.css)({label:"panel-header",display:"flex",alignItems:"center"}),pointer:(0,n.css)({cursor:"pointer"}),streaming:(0,n.css)({label:"panel-streaming",marginRight:0,color:R.colors.success.text,"&:hover":{color:R.colors.success.text}}),title:(0,n.css)({label:"panel-title",display:"flex",marginBottom:0,padding:R.spacing(0,w),textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",fontSize:R.typography.h6.fontSize,fontWeight:R.typography.h6.fontWeight}),items:(0,n.css)({display:"flex"}),item:(0,n.css)({display:"flex",justifyContent:"center",alignItems:"center"}),hiddenMenu:(0,n.css)({visibility:"hidden"}),menuItem:(0,n.css)({label:"panel-menu",border:"none",background:R.colors.secondary.main,"&:hover":{background:R.colors.secondary.shade}}),errorContainerFloating:(0,n.css)({label:"error-container",position:"absolute",left:0,top:0,zIndex:1}),rightActions:(0,n.css)({display:"flex",padding:R.spacing(0,w),gap:R.spacing(1)}),rightAligned:(0,n.css)({label:"right-aligned-container",marginLeft:"auto",display:"flex",alignItems:"center"}),titleItems:(0,n.css)({display:"flex",height:"100%"}),clearButtonStyles:(0,n.css)({alignItems:"center",display:"flex",gap:R.spacing(.5),background:"transparent",color:R.colors.text.primary,border:"none",padding:0,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",fontSize:R.typography.h6.fontSize,fontWeight:R.typography.h6.fontWeight})}},U=x;U.LoadingIndicator=t.I,U.TitleItem=b},88895:(Q,A,e)=>{"use strict";e.d(A,{B:()=>t});var t=(n=>(n.ToggleSelection="select",n.AppendToSelection="append",n))(t||{})},52494:(Q,A,e)=>{"use strict";e.d(A,{_:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({children:g,className:u,...c})=>{const i=(0,o.of)(r);return n.createElement("div",{className:(0,t.cx)(i,u),...c},g)},r=g=>(0,t.css)({backgroundColor:g.components.panel.background,border:`1px solid ${g.components.panel.borderColor}`,borderRadius:g.shape.radius.default})},98624:(Q,A,e)=>{"use strict";e.d(A,{B:()=>s});var t=e(96540),n=e(43429),o=e(39938);const s=({status:g,color:u,...c})=>{const i=r(g);return t.createElement(o.E,{text:i.text,color:i.color,icon:i.icon,tooltip:i.tooltip,...c})};s.displayName="PluginSignatureBadge";function r(g){switch(g||(g=n.Ac.invalid),g){case n.Ac.internal:return{text:"Core",color:"blue",tooltip:"Core plugin that is bundled with Grafana"};case n.Ac.valid:return{text:"Signed",icon:"lock",color:"green",tooltip:"Signed and verified plugin"};case n.Ac.invalid:return{text:"Invalid signature",icon:"exclamation-triangle",color:"red",tooltip:"Invalid plugin signature"};case n.Ac.modified:return{text:"Modified signature",icon:"exclamation-triangle",color:"red",tooltip:"Valid signature but content has been modified"};case n.Ac.missing:return{text:"Missing signature",icon:"exclamation-triangle",color:"red",tooltip:"Missing plugin signature"};default:return{text:"Unsigned",icon:"exclamation-triangle",color:"red",tooltip:"Unsigned external plugin"}}}},17464:(Q,A,e)=>{"use strict";e.d(A,{ZL:()=>s,gF:()=>r,qB:()=>g});var t=e(96540),n=e(40961),o=e(40845);function s(c){const{children:i,className:l,root:f,forwardedRef:d}=c,h=(0,o.$j)(),p=(0,t.useRef)(null),m=f??r();return p.current||(p.current=document.createElement("div"),l&&(p.current.className=l),p.current.style.position="relative",p.current.style.zIndex=`${h.zIndex.portal}`),(0,t.useLayoutEffect)(()=>(p.current&&m.appendChild(p.current),()=>{p.current&&m.removeChild(p.current)}),[m]),n.createPortal(t.createElement("div",{ref:d},i),p.current)}function r(){return window.document.getElementById("grafana-portal-container")??document.body}function g(){return t.createElement("div",{id:"grafana-portal-container"})}const u=t.forwardRef((c,i)=>t.createElement(s,{...c,forwardedRef:i}));u.displayName="RefForwardingPortal"},20084:(Q,A,e)=>{"use strict";e.d(A,{X:()=>C});var t=e(32196),n=e(46942),o=e.n(n),s=e(2543),r=e.n(s),g=e(96540),u=e(75226),c=e(29317),i=e(13544),l=e(80903),f=e(4269),d=e(88295),h=e(74738),p=e(31589),m=e(1020),a=e(99453),v=e(40845),E=e(16797),D=e(72307);class b extends g.PureComponent{constructor(T){super(T),this.lastExecutedValue=null,this.mounted=!1,this.editor=null,this.onChange=(P,L)=>{const U=P.document!==this.state.value.document,R=this.state.value;this.props.onRichValueChange&&this.props.onRichValueChange(P),this.setState({value:P},()=>{if(U){const B=u.A.serialize(R)!==u.A.serialize(P);B&&L&&this.runOnChangeAndRunQuery(),B&&!L&&this.runOnChangeDebounced()}})},this.runOnChange=()=>{const{onChange:P}=this.props,L=u.A.serialize(this.state.value);P&&P(this.cleanText(L))},this.runOnRunQuery=()=>{const{onRunQuery:P}=this.props;P&&(P(),this.lastExecutedValue=this.state.value)},this.runOnChangeAndRunQuery=()=>{this.runOnChange(),this.runOnRunQuery()},this.handleBlur=(P,L,U)=>{const{onBlur:R}=this.props;if(R)R();else{const B=this.lastExecutedValue?u.A.serialize(this.lastExecutedValue):"",H=u.A.serialize(L.value);B!==H&&this.runOnChangeAndRunQuery()}return U()},this.runOnChangeDebounced=(0,s.debounce)(this.runOnChange,500);const{onTypeahead:I,cleanText:x,portalOrigin:S,onWillApplySuggestion:O}=T;this.plugins=[(0,l.Pz)({onTypeahead:I,cleanText:x,portalOrigin:S,onWillApplySuggestion:O}),(0,f.U)({handler:this.runOnChangeAndRunQuery}),(0,d.O)(),(0,h.v)(),(0,p.l)(),(0,m.T)(),(0,a.s)(),...T.additionalPlugins||[]].filter(P=>P),this.state={suggestions:[],typeaheadContext:null,typeaheadPrefix:"",typeaheadText:"",value:(0,D.mO)(T.query||"",T.syntax)}}componentDidMount(){this.mounted=!0}componentWillUnmount(){this.mounted=!1}componentDidUpdate(T,I){const{query:x,syntax:S,syntaxLoaded:O}=this.props;if(!T.syntaxLoaded&&O&&this.editor){const L=this.editor.insertText(" ").deleteBackward(1);this.onChange(L.value,!0)}const{value:P}=this.state;x!==T.query&&x!==u.A.serialize(P)&&this.setState({value:(0,D.mO)(x||"",S)})}cleanText(T){return T.replace(/[\r]/g,"")}render(){const{disabled:T,theme:I}=this.props,x=o()("slate-query-field__wrapper",{"slate-query-field__wrapper--disabled":T}),S=y(I);return g.createElement("div",{className:(0,t.cx)(x,S.wrapper)},g.createElement("div",{className:"slate-query-field","data-testid":i.Tp.components.QueryField.container},g.createElement(c.KE,{ref:O=>this.editor=O,schema:D.yx,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.cV)(b);C.defaultProps={onBlur:()=>{}};const y=M=>{const T=(0,E.getFocusStyles)(M);return{wrapper:(0,t.css)({"&:focus-within":T})}}},11134:(Q,A,e)=>{"use strict";e.d(A,{cC:()=>f,cb:()=>i});var t=e(91e3),n=e(96540),o=e(70416),s=e(13544),r=e(76412),g=e(19727),u=e(9261),c=e(27746);const i=["5s","10s","30s","1m","5m","15m","30m","1h","2h","1d"],l=class extends n.PureComponent{constructor(p){super(p),this.onChangeSelect=m=>{const{onIntervalChanged:a}=this.props;a&&m.value!=null&&a(m.value)}}getVariant(){return this.props.isLive?"primary":this.props.isLoading?"destructive":this.props.primary?"primary":this.props.isOnCanvas?"canvas":"default"}render(){const{onRefresh:p,intervals:m,tooltip:a,value:v,text:E,isLoading:D,noIntervalPicker:b,width:C,showAutoInterval:y}=this.props,M=v||"",T=this.getVariant(),I=h({intervals:m,showAutoInterval:y}),x=I.find(({value:N})=>N===M),S=d(l.offOption.value);let O=x||S;O.label===S.label&&(O={value:""});const P=O.ariaLabel,L=(0,r.t)("refresh-picker.aria-label.duration-selected","Choose refresh time interval with current interval {{durationAriaLabel}} selected",{durationAriaLabel:P}),U=(0,r.t)("refresh-picker.aria-label.choose-interval","Auto refresh turned off. Choose refresh time interval"),R=O.value===""?U:L,B=(0,r.t)("refresh-picker.tooltip.interval-selected","Set auto refresh interval"),H=(0,r.t)("refresh-picker.tooltip.turned-off","Auto refresh off"),w=O.value===""?H:B;return n.createElement(g.e,{className:"refresh-picker"},n.createElement(c.I,{"aria-label":E,tooltip:a,onClick:p,variant:T,icon:D?"spinner":"sync",style:C?{width:C}:void 0,"data-testid":s.Tp.components.RefreshPicker.runButtonV2},E),!b&&n.createElement(u.f,{value:O,options:I,onChange:this.onChangeSelect,variant:T,"data-testid":s.Tp.components.RefreshPicker.intervalButtonV2,"aria-label":R,tooltip:w}))}};let f=l;f.offOption={label:"Off",value:"",ariaLabel:"Turn off auto refresh"},f.liveOption={label:"Live",value:"LIVE",ariaLabel:"Turn on live streaming"},f.autoOption={label:"Auto",value:"auto",ariaLabel:"Select refresh from the query range"},f.isLive=p=>p===l.liveOption.value;function d(p){switch(p){case f.liveOption.value:return{label:(0,r.t)("refresh-picker.live-option.label","Live"),value:p,ariaLabel:(0,r.t)("refresh-picker.live-option.aria-label","Turn on live streaming")};case f.offOption.value:return{label:(0,r.t)("refresh-picker.off-option.label","Off"),value:p,ariaLabel:(0,r.t)("refresh-picker.off-option.aria-label","Turn off auto refresh")};case f.autoOption.value:return{label:(0,r.t)("refresh-picker.auto-option.label",f.autoOption.label),value:p,ariaLabel:(0,r.t)("refresh-picker.auto-option.aria-label",f.autoOption.ariaLabel)}}return{label:p,value:p}}function h({intervals:p=i,showAutoInterval:m=!1}={}){const a=p.map(v=>{const E=(0,o.E9)(v),D=(0,t.a)(E);return{label:v,value:v,ariaLabel:D}});return m&&a.unshift(d(f.autoOption.value)),a.unshift(d(f.offOption.value)),a}},44522:(Q,A,e)=>{"use strict";e.d(A,{I:()=>o});var t=e(96540),n=e(40672);function o({component:s,content:r,...g}){return t.createElement(s||"span",{dangerouslySetInnerHTML:{__html:n.sQ.sanitize(r)},...g})}},56286:(Q,A,e)=>{"use strict";e.d(A,{L:()=>c});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(55852),g=e(90090);const u=()=>({noRadiusInput:(0,t.css)({borderBottomRightRadius:"0 !important",borderTopRightRadius:"0 !important"}),noRadiusButton:(0,t.css)({borderBottomLeftRadius:"0 !important",borderTopLeftRadius:"0 !important"})}),c=({label:i="Password",labelWidth:l,inputWidth:f=12,onReset:d,isConfigured:h,tooltip:p,placeholder:m="Password",interactive:a,...v})=>{const E=u();return s.createElement(g.z,{label:i,tooltip:p,interactive:a,labelWidth:l,inputEl:h?s.createElement(s.Fragment,null,s.createElement("input",{type:"text",className:(0,t.cx)(`gf-form-input width-${f}`,E.noRadiusInput),disabled:!0,value:"configured",...(0,n.omit)(v,"value")}),s.createElement(r.$n,{onClick:d,variant:"secondary",type:"button"},"Reset")):s.createElement("input",{type:"password",className:`gf-form-input width-${f}`,placeholder:m,...v})})};c.displayName="SecretFormField"},9226:(Q,A,e)=>{"use strict";e.d(A,{L4:()=>u});var t=e(96540),n=e(55852),o=e(10354),s=e(67061);const r="configured",g="Reset",u=({isConfigured:c,onReset:i,...l})=>t.createElement(s.B,null,!c&&t.createElement(o.p,{...l,type:"password"}),c&&t.createElement(t.Fragment,null,t.createElement(o.p,{...l,type:"text",disabled:!0,value:r}),t.createElement(n.$n,{onClick:i,variant:"secondary"},g)))},49718:(Q,A,e)=>{"use strict";e.d(A,{L:()=>t.L4});var t=e(9226)},58724:(Q,A,e)=>{"use strict";e.d(A,{lp:()=>l});var t=e(32196),n=e(96540),o=e(40845),s=e(55852),r=e(66864),g=e(21744);const u="configured",c="Reset",i=f=>({configuredStyle:(0,t.css)({minHeight:f.spacing(f.components.height.md),paddingTop:f.spacing(.5),resize:"none"})}),l=({isConfigured:f,onReset:d,...h})=>{const p=(0,o.of)(i);return n.createElement(r.Gy,null,!f&&n.createElement(g.f,{...h}),f&&n.createElement(g.f,{...h,rows:1,disabled:!0,value:u,className:(0,t.cx)(p.configuredStyle)}),f&&n.createElement(s.$n,{onClick:d,variant:"secondary"},c))}},7968:(Q,A,e)=>{"use strict";e.d(A,{l:()=>t.lp});var t=e(58724)},38401:(Q,A,e)=>{"use strict";e.d(A,{Y:()=>l});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(40845),g=e(76892),u=e(13102),c=e(86997),i=e(2336);function l({options:f,value:d,onChange:h,Component:p,className:m,allowCustomValue:a,allowEmptyValue:v,placeholder:E,disabled:D,inputMinWidth:b,inputPlaceholder:C,onExpandedChange:y,autofocus:M=!1,...T}){const[I,x,S,O]=(0,i.Q)(M,y),P=b?Math.max(b,x):x,L=(0,r.of)(c.m);if(!S){const U=(0,n.isObject)(d)?d.label:d,R=U!=null?String(U):void 0;return s.createElement(I,{disabled:D,Component:p||s.createElement(g.c,{className:(0,t.cx)(L.segment,{[L.queryPlaceholder]:E!==void 0&&!d,[L.disabled]:D},m)},R||E)})}return s.createElement(u.a,{...T,value:d&&!(0,n.isObject)(d)?{value:d}:d,placeholder:C,options:f,width:P,onClickOutside:()=>O(!1),allowCustomValue:a,allowEmptyValue:v,onChange:U=>{O(!1),h(U)}})}},83684:(Q,A,e)=>{"use strict";e.d(A,{s:()=>d});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(41053),g=e(40845),u=e(76412),c=e(76892),i=e(13102),l=e(86997),f=e(2336);function d({value:p,onChange:m,loadOptions:a,reloadOptionsOnChange:v=!1,Component:E,className:D,allowCustomValue:b,allowEmptyValue:C,disabled:y,placeholder:M,inputMinWidth:T,inputPlaceholder:I,autofocus:x=!1,onExpandedChange:S,noOptionMessageHandler:O=h,...P}){const[L,U]=(0,r.A)(a,[a]),[R,B,H,w]=(0,f.Q)(x,S),N=T?Math.max(T,B):B,V=(0,g.of)(l.m);if(!H){const G=(0,n.isObject)(p)?p.label:p,_=G!=null?String(G):void 0;return s.createElement(R,{onClick:v?void 0:U,disabled:y,Component:E||s.createElement(c.c,{className:(0,t.cx)(V.segment,{[V.queryPlaceholder]:M!==void 0&&!p,[V.disabled]:y},D)},_||M)})}return s.createElement(i.a,{...P,value:p&&!(0,n.isObject)(p)?{value:p}:p,placeholder:I,options:L.value??[],loadOptions:v?U:void 0,width:N,noOptionsMessage:O(L),allowCustomValue:b,allowEmptyValue:C,onClickOutside:()=>{w(!1)},onChange:G=>{w(!1),m(G)}})}function h(p){return p.loading?(0,u.t)("grafana-ui.segment-async.loading","Loading options..."):p.error?(0,u.t)("grafana-ui.segment-async.error","Failed to load options"):(0,u.t)("grafana-ui.segment-async.no-options","No options found")}},57752:(Q,A,e)=>{"use strict";e.d(A,{o:()=>l});var t=e(32196),n=e(96540),o=e(37151),s=e(40845),r=e(29413),g=e(76892),u=e(86997),c=e(2336);const i=14;function l({value:f,onChange:d,Component:h,className:p,placeholder:m,inputPlaceholder:a,disabled:v,autofocus:E=!1,onExpandedChange:D,...b}){const C=(0,n.useRef)(null),[y,M]=(0,n.useState)(f),[T,I]=(0,n.useState)((0,r.kD)((f||"").toString(),i).width),[x,,S,O]=(0,c.Q)(E,D),P=(0,s.of)(u.m);if((0,o.A)(C,()=>{O(!1),d(y)}),!S)return n.createElement(x,{disabled:v,Component:h||n.createElement(g.c,{className:(0,t.cx)(P.segment,{[P.queryPlaceholder]:m!==void 0&&!y,[P.disabled]:v},p)},f||m)});const L=(0,t.css)({width:`${Math.max(T+20,32)}px`});return n.createElement("input",{...b,ref:C,autoFocus:!0,className:(0,t.cx)("gf-form gf-form-input",L),value:y,placeholder:a,onChange:U=>{const{width:R}=(0,r.kD)(U.target.value,i);I(R),M(U.target.value)},onBlur:()=>{O(!1),d(y)},onKeyDown:U=>{[13,27].includes(U.keyCode)&&(O(!1),d(y))}})}},64765:(Q,A,e)=>{"use strict";e.d(A,{L:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(39268),r=e(76892);const g=({label:c,htmlFor:i,children:l,fill:f})=>{const d=(0,o.of)(u);return n.createElement(n.Fragment,null,n.createElement(s.C,null,n.createElement(r.c,{htmlFor:i,width:12,className:d.label},c),l,f&&n.createElement("div",{className:d.fill},n.createElement(r.c,null,""))))},u=c=>({label:(0,t.css)({color:c.colors.primary.text}),fill:(0,t.css)({flexGrow:1,marginBottom:c.spacing(.5)})})},13102:(Q,A,e)=>{"use strict";e.d(A,{a:()=>s});var t=e(96540),n=e(40845),o=e(88323);function s({value:r,placeholder:g="",options:u=[],onChange:c,onClickOutside:i,loadOptions:l=void 0,width:f,noOptionsMessage:d="",allowCustomValue:h=!1,allowEmptyValue:p=!1,...m}){const a=(0,t.useRef)(null),v=(0,n.$j)();let E=f>0?f/v.spacing.gridSize:void 0,D,b={};return l?(D=o.DW,b={loadOptions:l,defaultOptions:!0}):D=o.l6,t.createElement("div",{...m,ref:a},t.createElement(D,{width:E,noOptionsMessage:d,placeholder:g,autoFocus:!0,isOpen:!0,onChange:c,options:u,value:r,closeMenuOnSelect:!1,onCloseMenu:()=>{if(a&&a.current){const C=a.current.querySelector('input[id^="react-select-"]');C&&(C.value||p)?c({value:C.value,label:C.value}):i()}},allowCustomValue:h,...b}))}},86997:(Q,A,e)=>{"use strict";e.d(A,{m:()=>n});var t=e(32196);const n=o=>{const s="v1"in o?o.v1.palette:o.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"})}}},2336:(Q,A,e)=>{"use strict";e.d(A,{Q:()=>s});var t=e(96540),n=e(40845),o=e(55852);const s=(r,g)=>{const u=(0,t.useRef)(null),c=(0,n.of)(o.my),[i,l]=(0,t.useState)(r),[f,d]=(0,t.useState)(0),h=m=>{l(m),g&&g(m)};return[({Component:m,onClick:a,disabled:v})=>t.createElement("button",{type:"button",className:c,ref:u,disabled:v,onClick:()=>{h(!0),u&&u.current&&d(u.current.clientWidth*1.25),a?.()}},m),f,i,h]}},5342:(Q,A,e)=>{"use strict";e.d(A,{O:()=>r,p:()=>g});var t=e(96540),n=e(40845),o=e(29158),s=e(88824);const r=({innerProps:u,children:c})=>{const i=(0,n.$j)(),l=(0,s.J)(i);return t.createElement("div",{...u,className:l.multiValueContainer},c)},g=({children:u,innerProps:c})=>{const i=(0,n.$j)(),l=(0,s.J)(i);return t.createElement(o.K,{...c,name:"times",size:"sm",className:l.multiValueRemove,tooltip:"Remove"})}},88323:(Q,A,e)=>{"use strict";e.d(A,{Iv:()=>K,DW:()=>V,gZ:()=>_,KF:()=>N,l6:()=>w,KA:()=>D.K,ip:()=>G});var t=e(96540),n=e(72635),o=e(46005),s=e(8539),r=e(93943),g=e(66963),u=e(50877),c=e(40845),i=e(14578),l=e(62930);function f({selectProps:j}){const k=j.menuIsOpen,Y=k?"search":"angle-down",ee=k?"sm":"md";return t.createElement(i.I,{name:Y,size:ee})}var d=e(32196),h=e(10354);const p=t.forwardRef((j,k)=>{const{children:Y}=j,ee=(0,c.$j)(),re=(0,h.n)({theme:ee,invalid:!1});return t.createElement("div",{className:(0,d.cx)(re.suffix,(0,d.css)({position:"relative"})),ref:k},Y)});p.displayName="IndicatorsContainer";var m=e(87266);const a=t.forwardRef(function({focused:k,invalid:Y,disabled:ee,children:re,innerProps:J,prefix:ne,...q},te){const oe=(0,c.of)(v,Y,!!ne);return t.createElement("div",{className:oe.input,...J,ref:te},ne&&t.createElement("div",{className:(0,d.cx)(oe.prefix)},ne),re)}),v=(j,k,Y)=>{const ee=(0,h.n)({theme:j,invalid:k});return{input:(0,d.cx)((0,m.g$)(j),(0,d.css)({width:"100%",maxWidth:"100%",display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap",justifyContent:"space-between",paddingRight:0,position:"relative",boxSizing:"border-box"}),Y&&(0,d.css)({paddingLeft:0})),prefix:(0,d.cx)(ee.prefix,(0,d.css)({position:"relative"}))}};var E=e(5342),D=e(4603),b=e(12681),C=e(80970),y=e(62235),M=e(88824);class T extends t.Component{render(){const{children:k}=this.props,{selectProps:Y}=this.props;if(Y&&Array.isArray(k)&&Array.isArray(k[0])&&Y.maxVisibleValues!==void 0&&!(Y.showAllSelectedWhenOpen&&Y.menuIsOpen)){const[ee,...re]=k,J=ee.slice(0,Y.maxVisibleValues);return this.renderContainer([J,...re])}return this.renderContainer(k)}renderContainer(k){const{isMulti:Y,theme:ee,selectProps:re}=this.props,J=this.props.selectProps?.noMultiValueWrap&&!this.props.selectProps?.menuIsOpen,ne=(0,M.J)(ee),q=re["data-testid"],te=(0,d.cx)(ne.valueContainer,Y&&ne.valueContainerMulti,J&&ne.valueContainerMultiNoWrap);return t.createElement("div",{"data-testid":q,className:te},k)}}const I=(0,c.cV)(T);var x=e(23731);const S=(j,k)=>{if(Array.isArray(j)){const Y=j.filter(Boolean);return Y?.length?Y:void 0}if(typeof j=="object")return[j];if(typeof j=="string"||typeof j=="number"){const Y=O(j,k);if(Y)return[Y]}},O=(j,k)=>{for(const Y of k)if("options"in Y){let ee=O(j,Y.options);if(ee)return ee}else if("value"in Y&&Y.value===j)return Y;return null},P=j=>j.map(({description:k,...Y})=>Y),L=j=>{const{children:k,innerProps:Y,selectProps:{menuIsOpen:ee,onMenuClose:re,onMenuOpen:J},isFocused:ne,isMulti:q,getValue:te,innerRef:oe}=j,ue=j.selectProps;return ue.renderControl?t.createElement(ue.renderControl,{isOpen:ee,value:q?te():te()[0],ref:oe,onClick:ee?re:J,onBlur:re,disabled:!!ue.disabled,invalid:!!ue.invalid}):t.createElement(a,{ref:oe,innerProps:Y,prefix:ue.prefix,focused:ne,invalid:!!ue.invalid,disabled:!!ue.disabled},k)};function U({allowCustomValue:j=!1,allowCreateWhileLoading:k=!1,"aria-label":Y,"data-testid":ee,autoFocus:re=!1,backspaceRemovesValue:J=!0,blurInputOnSelect:ne,cacheOptions:q,className:te,closeMenuOnSelect:oe=!0,components:ue,createOptionPosition:ie="last",defaultOptions:ge,defaultValue:he,disabled:De=!1,filterOption:pe,formatCreateLabel:le,getOptionLabel:Te,getOptionValue:Ee,inputValue:Re,invalid:me,isClearable:Me=!1,id:ye,isLoading:Le=!1,isMulti:We=!1,inputId:Be,isOpen:Ye,isOptionDisabled:at,isSearchable:st=!0,loadOptions:Ke,loadingMessage:Xe="Loading options...",maxMenuHeight:He=300,minMenuHeight:Ge,maxVisibleValues:xe,menuPlacement:$e="auto",menuPosition:be,menuShouldPortal:Z=!0,noOptionsMessage:ae=(0,n.t)("grafana-ui.select.no-options-label","No options found"),onBlur:de,onChange:ve,onCloseMenu:Ue,onCreateOption:_e,onInputChange:ze,onKeyDown:Ve,onMenuScrollToBottom:Ne,onMenuScrollToTop:ot,onOpenMenu:nt,onFocus:pt,openMenuOnFocus:mt=!1,options:gt=[],placeholder:Pt=(0,n.t)("grafana-ui.select.placeholder","Choose"),prefix:Mt,renderControl:Yt,showAllSelectedWhenOpen:zt=!0,tabSelectsValue:_t=!0,value:rt,virtualized:It=!1,noMultiValueWrap:Dn,width:ft,isValidNewOption:yt,formatOptionLabel:jt,hideSelectedOptions:cn,...pn}){const on=(0,c.$j)(),Xt=(0,M.J)(on),fn=(0,t.useRef)(null),[An,hn]=(0,t.useState)(!1),ca=(0,x.z)(on,ft),[Rt,qt]=(0,t.useState)(!!Re);(0,t.useEffect)(()=>{if(Ke&&Ye&&fn.current&&fn.current.controlRef&&$e==="auto"){const Ln=window.innerHeight-fn.current.controlRef.getBoundingClientRect().bottom;hn(Ln<He)}},[He,$e,Ke,Ye]);const gn=(0,t.useCallback)((Ln,na)=>{if(We&&Ln==null)return ve([],na);ve(Ln,na)},[We,ve]);let Cn=o.Ay;const mn={};let Sn={},Tn;if(We&&Ke)Tn=rt;else if(We&&rt&&Array.isArray(rt)&&!Ke)Tn=rt.map(Ln=>{const na=O(Ln.value??Ln,gt);return!j||na?na:typeof Ln=="string"?(0,u.z)(Ln):Ln});else if(Ke){const Ln=he||rt;Tn=Ln?[Ln]:[]}else Tn=S(rt,gt);const $n={"aria-label":Y,"data-testid":ee,autoFocus:re,backspaceRemovesValue:J,blurInputOnSelect:ne,captureMenuScroll:Ne||ot,closeMenuOnSelect:oe,defaultValue:he,disabled:De,filterOption:Rt?pe:null,getOptionLabel:Te,getOptionValue:Ee,hideSelectedOptions:cn,inputValue:Re,invalid:me,isClearable:Me,id:ye,isDisabled:De,isLoading:Le,isMulti:We,inputId:Be,isOptionDisabled:at,isSearchable:st,maxMenuHeight:He,minMenuHeight:Ge,maxVisibleValues:xe,menuIsOpen:Ye,menuPlacement:$e==="auto"&&An?"top":$e,menuPosition:be,menuShouldBlockScroll:!0,menuPortalTarget:Z&&typeof document<"u"?document.body:void 0,menuShouldScrollIntoView:!1,onBlur:de,onChange:gn,onInputChange:(Ln,na)=>{qt(!!Ln),ze?.(Ln,na)},onKeyDown:Ve,onMenuClose:Ue,onMenuOpen:nt,onMenuScrollToBottom:Ne,onMenuScrollToTop:ot,onFocus:pt,formatOptionLabel:jt,openMenuOnFocus:mt,options:It?P(gt):gt,placeholder:Pt,prefix:Mt,renderControl:Yt,showAllSelectedWhenOpen:zt,tabSelectsValue:_t,value:We?Tn:Tn?.[0],noMultiValueWrap:Dn};j&&(Cn=g.A,mn.allowCreateWhileLoading=k,mn.formatCreateLabel=le??R,mn.onCreateOption=_e,mn.createOptionPosition=ie,mn.isValidNewOption=yt),Ke&&(Cn=j?r.A:s.A,Sn={loadOptions:Ke,cacheOptions:q,defaultOptions:ge});const Mn=It?b.zd:b.eB;return t.createElement(t.Fragment,null,t.createElement(Cn,{ref:fn,components:{MenuList:Mn,Group:C.n,ValueContainer:I,IndicatorsContainer:B,IndicatorSeparator:H,Control:L,Option:b.o5,ClearIndicator(Ln){const{clearValue:na}=Ln;return t.createElement(i.I,{name:"times",role:"button","aria-label":"select-clear-value",className:Xt.singleValueRemove,onMouseDown:pa=>{pa.preventDefault(),pa.stopPropagation(),na()}})},LoadingIndicator(){return t.createElement(l.y,{inline:!0})},LoadingMessage(){return t.createElement("div",{className:Xt.loadingMessage},Xe)},NoOptionsMessage(){return t.createElement("div",{className:Xt.loadingMessage,"aria-label":"No options provided"},ae)},DropdownIndicator:f,SingleValue(Ln){return t.createElement(y.K,{...Ln,isDisabled:De})},SelectContainer:D.K,MultiValueContainer:E.O,MultiValueRemove:De?()=>null:E.p,...ue},styles:ca,className:te,...$n,...mn,...Sn,...pn}))}function R(j){return t.createElement("div",{style:{display:"flex",gap:"8px",alignItems:"center"}},t.createElement("div",null,j),t.createElement("div",{style:{flexGrow:1}}),t.createElement("div",{className:"muted small",style:{display:"flex",gap:"8px",alignItems:"center"}},"Hit enter to add"))}function B(j){const{showAllSelectedWhenOpen:k,maxVisibleValues:Y,menuIsOpen:ee}=j.selectProps,re=j.getValue();if(Y!==void 0&&Array.isArray(j.children)){const J=re.length;if(J>Y&&!(k&&ee)){const ne=[...j.children];return ne.splice(-1,0,t.createElement("span",{key:"excess-values",id:"excess-values"},"(+",J-Y,")")),t.createElement(p,{...j},ne)}}return t.createElement(p,{...j})}function H(){return t.createElement(t.Fragment,null)}function w(j){return t.createElement(U,{...j})}function N(j){return t.createElement(U,{...j,isMulti:!0})}function V(j){return t.createElement(U,{...j})}function G(j){return t.createElement(U,{virtualized:!0,...j})}function _(j){return t.createElement(U,{virtualized:!0,...j})}function K(j){return t.createElement(U,{...j,isMulti:!0})}},4603:(Q,A,e)=>{"use strict";e.d(A,{K:()=>c});var t=e(32196),n=e(96540),o=e(28581),s=e(40845),r=e(16797),g=e(87266),u=e(10354);const c=l=>{const{isDisabled:f,isFocused:d,children:h,selectProps:{invalid:p=!1}}=l,m=(0,s.of)(i,d,f,p);return n.createElement(o.c.SelectContainer,{...l,className:(0,t.cx)(m.wrapper,l.className)},h)},i=(l,f,d,h)=>{const p=(0,u.n)({theme:l,invalid:h});return{wrapper:(0,t.cx)(p.wrapper,(0,g.Xb)(l,h),f&&(0,t.css)((0,r.getFocusStyles)(l)),d&&p.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:d?"not-allowed":"pointer"}))}}},12681:(Q,A,e)=>{"use strict";e.d(A,{eB:()=>f,o5:()=>m,zd:()=>p});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(91793),g=e(8887),u=e(40845),c=e(40276),i=e(14578),l=e(88824);const f=({children:a,maxHeight:v,innerRef:E,innerProps:D})=>{const b=(0,u.$j)(),C=(0,l.J)(b);return s.createElement("div",{...D,className:C.menu,style:{maxHeight:v},"aria-label":"Select options menu"},s.createElement(c.E,{scrollRefCallback:E,autoHide:!1,autoHeightMax:"inherit",hideHorizontalTrack:!0},a))};f.displayName="SelectMenu";const d=37,h=7,p=({children:a,maxHeight:v,options:E,getValue:D})=>{const b=(0,u.$j)(),C=(0,l.J)(b),[y]=D(),T=(y?E.findIndex(O=>O.value===y.value):0)*d;if(!Array.isArray(a))return null;const x=((0,n.max)(E.map(O=>O.label?.length))??0)*h,S=Math.min(E.length*d,v);return s.createElement(r.Y1,{className:C.menu,height:S,width:x,"aria-label":"Select options menu",itemCount:a.length,itemSize:d,initialScrollOffset:T},({index:O,style:P})=>s.createElement("div",{style:{...P,overflow:"hidden"}},a[O]))};p.displayName="VirtualizedSelectMenu";const m=({children:a,data:v,innerProps:E,innerRef:D,isFocused:b,isSelected:C,renderOptionLabel:y})=>{const M=(0,u.$j)(),T=(0,l.J)(M),I=v.icon?(0,g.Uo)(v.icon):void 0,{onMouseMove:x,onMouseOver:S,...O}=E;return s.createElement("div",{ref:D,className:(0,t.cx)(T.option,b&&T.optionFocused,C&&T.optionSelected,v.isDisabled&&T.optionDisabled),...O,"aria-label":"Select option",title:v.title},I&&s.createElement(i.I,{name:I,className:T.optionIcon}),v.imgUrl&&s.createElement("img",{className:T.optionImage,src:v.imgUrl,alt:v.label||String(v.value)}),s.createElement("div",{className:T.optionBody},s.createElement("span",null,y?y(v):a),v.description&&s.createElement("div",{className:T.optionDescription},v.description),v.component&&s.createElement(v.component,null)))};m.displayName="SelectMenuOptions"},80970:(Q,A,e)=>{"use strict";e.d(A,{n:()=>c});var t=e(32196),n=e(96540),o=e(3911),s=e(40845),r=e(14578);const g=(0,o.N)(i=>({header:(0,t.css)({display:"flex",alignItems:"center",justifyContent:"flex-start",justifyItems:"center",cursor:"pointer",padding:"7px 10px",width:"100%",borderBottom:`1px solid ${i.colors.background.secondary}`,"&:hover":{color:i.colors.text.maxContrast}}),label:(0,t.css)({flexGrow:1}),icon:(0,t.css)({paddingRight:"2px"})}));class u extends n.PureComponent{constructor(){super(...arguments),this.state={expanded:!1},this.onToggleChildren=()=>{this.setState(l=>({expanded:!l.expanded}))}}componentDidMount(){if(this.props.data.expanded)this.setState({expanded:!0});else if(this.props.selectProps&&this.props.selectProps.value){const{value:l}=this.props.selectProps.value;l&&this.props.options.some(f=>f.value===l)&&this.setState({expanded:!0})}}componentDidUpdate(l){l.selectProps.inputValue!==""&&this.setState({expanded:!0})}render(){const{children:l,label:f,theme:d}=this.props,{expanded:h}=this.state,p=g(d);return n.createElement("div",null,n.createElement("div",{className:p.header,onClick:this.onToggleChildren,role:"presentation"},n.createElement("span",{className:p.label},f),n.createElement(r.I,{className:p.icon,name:h?"angle-up":"angle-down"})),h&&l)}}const c=(0,s.cV)(u)},62235:(Q,A,e)=>{"use strict";e.d(A,{K:()=>d});var t=e(32196),n=e(96540),o=e(28581),s=e(8887),r=e(40845);function g(p,m={}){const{duration:a=250,delay:v=250}=m,[E,D]=(0,n.useState)(p),b=(0,n.useRef)();return(0,n.useEffect)(()=>{let C;if(p)C=setTimeout(()=>{b.current=new Date,D(p)},v);else{const y=b.current?Date.now()-b.current.valueOf():0,M=()=>{b.current=void 0,D(p)};y>=a?M():C=setTimeout(M,a-y)}return()=>{C&&(clearTimeout(C),C=void 0)}},[p,a,v]),E}var u=e(14578),c=e(62930),i=e(31511),l=e(72960);const f=p=>({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:p.spacing(1),color:p.colors.text.secondary}),disabled:(0,t.css)({color:p.colors.text.disabled}),isOpen:(0,t.css)({color:p.colors.text.disabled})}),d=p=>{const{children:m,data:a,isDisabled:v}=p,E=(0,r.of)(f),D=g(a.loading||!1,{delay:250,duration:750}),b=a.icon?(0,s.Uo)(a.icon):void 0;return n.createElement(o.c.SingleValue,{...p,className:(0,t.cx)(E.singleValue,v&&E.disabled,p.selectProps.menuIsOpen&&E.isOpen)},a.imgUrl?n.createElement(h,{loading:D,imgUrl:a.imgUrl,styles:E,alt:String(a.label??a.value)}):n.createElement(n.Fragment,null,n.createElement(l.n,{horizontal:!0,size:16,visible:D,duration:150},n.createElement("div",{className:E.spinnerWrapper},n.createElement(c.y,{className:E.spinnerIcon,inline:!0}))),b&&n.createElement(u.I,{name:b,role:"img",className:E.optionIcon})),!a.hideText&&m)},h=p=>n.createElement("div",{className:p.styles.spinnerWrapper},n.createElement(i.A,{duration:150,visible:p.loading},n.createElement(c.y,{className:p.styles.spinnerIcon,inline:!0})),n.createElement(i.A,{duration:150,visible:!p.loading},n.createElement("img",{className:p.styles.spinnerIcon,src:p.imgUrl,alt:p.alt})))},88824:(Q,A,e)=>{"use strict";e.d(A,{J:()=>o});var t=e(32196),n=e(3911);const o=(0,n.N)(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,"@media (forced-colors: active), (prefers-contrast: more)":{border:`1px solid ${s.colors.primary.border}`}}}),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,"@media (forced-colors: active), (prefers-contrast: more)":{border:`1px solid ${s.colors.primary.border}`}}),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"}),valueContainerMultiNoWrap:(0,t.css)({flexWrap:"nowrap"}),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.radius.default,margin:s.spacing(.25,1,.25,0),padding:s.spacing(.25,0,.25,1),color:s.colors.text.primary,fontSize:s.typography.size.sm,overflow:"hidden",whiteSpace:"nowrap","&: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}})}))},23731:(Q,A,e)=>{"use strict";e.d(A,{A:()=>n,z:()=>o});var t=e(96540);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:()=>({overflow:"hidden",textOverflow:"ellipsis"}),multiValueRemove:()=>({}),noOptionsMessage:()=>({}),option:()=>({}),placeholder:r=>({...r,color:s.colors.text.secondary}),singleValue:()=>({}),valueContainer:()=>({})}}function o(s,r){return(0,t.useMemo)(()=>({...n(s),menuPortal:g=>({...g,zIndex:s.zIndex.portal}),menu:({top:g,bottom:u,position:c})=>({top:g,bottom:u,position:c,minWidth:"100%",zIndex:s.zIndex.dropdown}),container:()=>({width:r?s.spacing(r):"100%",display:r==="auto"?"inline-flex":"flex"}),option:(g,u)=>({...g,opacity:u.isDisabled?.5:1})}),[s,r])}},62883:()=>{},67570:(Q,A,e)=>{"use strict";e.d(A,{u:()=>h});var t=e(2543),n=e.n(t),o=e(96540),s=e(13752),r=e(62467),g=e(11150),u=e(96083),c=e(63720),i=e(59099),l=e(54479),f=e(11134);function d(p){return{label:p,value:stringToMs(p)}}class h extends o.PureComponent{constructor(m){super(m),this.propsSubject=new s.B,this.subscription=null}componentDidMount(){this.subscription=this.propsSubject.pipe((0,c.n)(m=>f.cC.isLive(m.interval)?(0,r.of)({}):m.loading?g.t:(0,u.Y)((0,l.dc)(m.interval))),(0,i.M)(()=>this.props.func())).subscribe(),this.propsSubject.next(this.props)}componentDidUpdate(m){f.cC.isLive(m.interval)&&f.cC.isLive(this.props.interval)||(0,t.isEqual)(m,this.props)||this.propsSubject.next(this.props)}componentWillUnmount(){this.subscription&&this.subscription.unsubscribe(),this.propsSubject.unsubscribe()}render(){return null}}},63250:(Q,A,e)=>{"use strict";e.d(A,{I1:()=>v,_$:()=>h,gl:()=>f});var t=e(2543),n=e.n(t),o=e(75059),s=e(47070),r=e(50082),g=e(62398),u=e(24293),c=e(90708),i=e(47737);const l=["reduceOptions","orientation"];function f(E,D,b){let C=E.options;if(E.fieldConfig=E.fieldConfig||{defaults:{},overrides:[]},D==="singlestat"&&b.angular)return d(E,b);for(const y of l)b.hasOwnProperty(y)&&(C[y]=(0,t.cloneDeep)(b[y]));return C}function d(E,D){const b=D.angular,C=o.AS.getIfExists(b.valueName),y={reduceOptions:{calcs:[C?C.id:o.gy.mean]},orientation:s.wV.Horizontal},M={};if(b.format&&(M.unit=b.format),b.tableColumn&&(y.reduceOptions.fields=`/^${b.tableColumn}$/`),b.nullPointMode&&(M.nullValueMode=b.nullPointMode),b.nullText&&(M.noValue=b.nullText),(b.decimals||b.decimals===0)&&(M.decimals=b.decimals),b.thresholds&&b.colors){const I=b.thresholds.split(",").map(S=>Number(S.trim())),x=[];for(const S of b.colors){const O=x.length-1;O>=0?x.push({value:I[O],color:S}):x.push({value:-1/0,color:S})}M.thresholds={mode:r.O.Absolute,steps:x}}const T=(0,g.bh)(b,M.thresholds);return T&&T.length&&(M.mappings=T),b.gauge&&b.gauge.show&&(M.min=b.gauge.minValue,M.max=b.gauge.maxValue),E.fieldConfig.defaults=M,y}function h(E){if(!E.options)return{};const D=parseFloat(E.pluginVersion||"6.1");let b=E.options;D<6.2&&(b=m(b)),D<6.3&&(b=p(b));const{fieldOptions:C}=b;if(D<6.6&&C){if(C&&C.override){const{override:T,...I}=b.fieldOptions;b={...b,fieldOptions:{...I,overrides:[]}}}let y=C?.defaults?.thresholds;y?delete C.defaults.thresholds:(y=C?.thresholds,delete C.thresholds),y&&(C.defaults.thresholds={mode:r.O.Absolute,steps:y});const{defaults:M}=C;M.color&&typeof M.color=="string"&&(M.color={mode:u.Y.Fixed,fixedColor:M.color}),(0,c.BF)(M)}if(D<7&&(E.fieldConfig=E.fieldConfig||{defaults:{},overrides:[]},E.fieldConfig={defaults:C&&C.defaults?{...E.fieldConfig.defaults,...C.defaults}:E.fieldConfig.defaults,overrides:C&&C.overrides?[...E.fieldConfig.overrides,...C.overrides]:E.fieldConfig.overrides},C&&(b.reduceOptions={values:C.values,limit:C.limit,calcs:C.calcs}),delete b.fieldOptions),D<7.1){const y=E.fieldConfig.defaults.title;y!=null&&(E.fieldConfig.defaults.displayName=y,delete E.fieldConfig.defaults.title)}if(D<8){const y=E.fieldConfig?.defaults;let M=y?.unit;M==="percent"?((0,t.isNumber)(y.min)||(y.min=0),(0,t.isNumber)(y.max)||(y.max=100)):M==="percentunit"&&((0,t.isNumber)(y.min)||(y.min=0),(0,t.isNumber)(y.max)||(y.max=1))}return b}function p(E){const{fieldOptions:D}=E;if(!D)return E;const{mappings:b,...C}=E.fieldOptions;let y;return E.thresholds&&(y={mode:r.O.Absolute,steps:a(E.thresholds)}),{...E,fieldOptions:{...C,defaults:{...D.defaults,mappings:b,thresholds:y}}}}function m(E){const{valueOptions:D}=E;if(!D)return E;const b={},C={};if(b.mappings=E.valueMappings,b.thresholds=E.thresholds,b.defaults=C,C.unit=D.unit,C.decimals=D.decimals,D.stat){const M=o.AS.get(D.stat);M&&(b.calcs=[M.id])}C.min=E.minValue,C.max=E.maxValue;const y={...E,fieldOptions:b};return(0,t.omit)(y,"valueMappings","thresholds","valueOptions","minValue","maxValue")}function a(E){if(!E||!E.length)return;const D=E.map(b=>({value:b.value===null?-1/0:b.value,color:b.color}));return(0,i.RU)(D),D[0].value=-1/0,D}function v(E){return(0,g.bh)(E)}},37713:(Q,A,e)=>{"use strict";e.d(A,{I1:()=>t.I1,_$:()=>t._$,gl:()=>t.gl});var t=e(63250)},47097:(Q,A,e)=>{"use strict";e.d(A,{F:()=>f});var t=e(32196),n=e(94659),o=e(9821),s=e(96540),r=e(40845),g=e(80427);const u=d=>{const{value:h,children:p,visible:m,placement:a,tipFormatter:v,...E}=d,D=(0,s.useRef)(null),b=(0,s.useRef)(null),C=(0,r.of)(c);function y(){b.current!==null&&cancelAnimationFrame(b.current)}function M(){b.current=requestAnimationFrame(()=>{D.current?.forceAlign()})}return(0,s.useEffect)(()=>(m?M():y(),y),[h,m]),s.createElement(g.A,{overlayClassName:C.tooltip,placement:a,overlay:v??h,overlayInnerStyle:{minHeight:"auto"},ref:D,visible:m,...E},p)},c=d=>({tooltip:(0,t.css)({position:"absolute",display:"block",visibility:"visible",fontSize:d.typography.bodySmall.fontSize,opacity:.9,padding:3,zIndex:d.zIndex.tooltip})}),i=u;var l=e(24849);const f=({min:d,max:h,onChange:p,onAfterChange:m,orientation:a="horizontal",reverse:v,step:E,formatTooltipResult:D,value:b,tooltipAlwaysVisible:C=!0})=>{const y=(0,s.useCallback)(S=>{p?.(typeof S=="number"?[S,S]:S)},[p]),M=(0,s.useCallback)(S=>{m?.(typeof S=="number"?[S,S]:S)},[m]),T=a==="horizontal",I=(0,r.of)(l.$,T),x=(S,O)=>s.createElement(i,{value:O.value,visible:C||O.dragging,tipFormatter:D?()=>D(O.value):void 0,placement:T?"top":"right"},S);return s.createElement("div",{className:(0,t.cx)(I.container,I.slider)},s.createElement(n.Global,{styles:I.tooltip}),s.createElement(o.A,{min:d,max:h,step:E,defaultValue:b,range:!0,onChange:y,onChangeComplete:M,vertical:!T,reverse:v,handleRender:x}))};f.displayName="RangeSlider"},77014:(Q,A,e)=>{"use strict";e.d(A,{A:()=>c});var t=e(32196),n=e(94659),o=e(9821),s=e(96540),r=e(40845),g=e(10354),u=e(24849);const c=({min:i,max:l,onChange:f,onAfterChange:d,orientation:h="horizontal",reverse:p,step:m,value:a,ariaLabelForHandle:v,marks:E,included:D})=>{const b=h==="horizontal",C=(0,r.of)(u.$,b,!!E),y=o.A,[M,T]=(0,s.useState)(a??i),I=(0,s.useCallback)(U=>{const R=typeof U=="number"?U:U[0];T(R),f?.(R)},[T,f]),x=(0,s.useCallback)(U=>{let R=+U.target.value;Number.isNaN(R)&&(R=0),T(R),f&&f(R),d&&d(R)},[f,d]),S=(0,s.useCallback)(U=>{const R=+U.target.value;R>l?T(l):R<i&&T(i)},[l,i]),O=(0,s.useCallback)(U=>{const R=typeof U=="number"?U:U[0];d?.(R)},[d]),P=b?[]:[C.sliderInputVertical],L=b?[]:[C.sliderInputFieldVertical];return s.createElement("div",{className:(0,t.cx)(C.container,C.slider)},s.createElement(n.Global,{styles:C.tooltip}),s.createElement("div",{className:(0,t.cx)(C.sliderInput,...P)},s.createElement(y,{min:i,max:l,step:m,defaultValue:a,value:M,onChange:I,onChangeComplete:O,vertical:!b,reverse:p,ariaLabelForHandle:v,marks:E,included:D}),s.createElement(g.p,{type:"text",className:(0,t.cx)(C.sliderInputField,...L),value:M,onChange:x,onBlur:S,min:i,max:l})))};c.displayName="Slider"},24849:(Q,A,e)=>{"use strict";e.d(A,{$:()=>o});var t=e(32196),n=e(94659);const o=(s,r,g=!1)=>{const{spacing:u}=s,c=s.colors.border.strong,i=s.colors.primary.main,l=s.colors.primary.main,d=`box-shadow: 0px 0px 0px 6px ${s.colors.primary.transparent}`;return{container:(0,t.css)({width:"100%",margin:r?"inherit":u(1,3,1,1),paddingBottom:r&&g?s.spacing(1):"inherit",height:r?"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: ${s.spacing(1.75)}; } .rc-slider-mark-text { color: ${s.colors.text.disabled}; font-size: ${s.typography.bodySmall.fontSize}; } .rc-slider-mark-text-active { color: ${s.colors.text.primary}; } .rc-slider-handle { border: none; background-color: ${l}; box-shadow: ${s.shadows.z1}; cursor: pointer; opacity: 1; } .rc-slider-handle:hover, .rc-slider-handle:active, .rc-slider-handle-click-focused:focus { ${d}; } // 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 ${s.colors.text.primary}; } .rc-slider-dot, .rc-slider-dot-active { background-color: ${s.colors.text.primary}; border-color: ${s.colors.text.primary}; } .rc-slider-track { background-color: ${i}; } .rc-slider-rail { background-color: ${c}; cursor: pointer; } `,tooltip:(0,n.css)` body { .rc-slider-tooltip { cursor: grab; user-select: none; z-index: ${s.zIndex.tooltip}; } .rc-slider-tooltip-inner { color: ${s.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:s.spacing(3),width:"60px",input:{textAlign:"center"}}),sliderInputFieldVertical:(0,t.css)({margin:`0 0 ${s.spacing(3)} 0`,order:1})}}},5926:(Q,A,e)=>{"use strict";e.d(A,{O:()=>a});var t=e(2543),n=e(96540),o=e(39624),s=e(21423),r=e(11261),g=e(8066),u=e(52622),c=e(81297),i=e(51336),l=e(16895),f=e(73060),d=e(14236),h=e(46294);function p(v,E){const D=v.y.values.length,b={...v.y.config,...E},C=v.x??{name:"",values:[...Array(D).keys()],type:r.PU.number,config:{}};let y={refId:"sparkline",fields:[C,{...v.y,config:b}],length:D};return(0,f.g2)(C.values)||(y=(0,d.ES)(y,0)),(0,h.M)({frame:y,refFieldPseudoMin:v.timeRange?.from.valueOf(),refFieldPseudoMax:v.timeRange?.to.valueOf()})}const m={drawStyle:u.GR.Line,showPoints:u.yL.Auto,axisPlacement:u.vM.Hidden,pointSize:2};class a extends n.PureComponent{constructor(E){super(E);const D=p(E.sparkline,E.config);this.state={data:(0,l.bq)(D,(0,l.ro)(D)),alignedDataFrame:D,configBuilder:this.prepareConfig(D)}}static getDerivedStateFromProps(E,D){const b=p(E.sparkline,E.config),C=(0,o.C)(b);return C?{...D,data:(0,l.bq)(C,(0,l.ro)(C)),alignedDataFrame:C}:{...D}}componentDidUpdate(E,D){const{alignedDataFrame:b}=this.state;if(!b)return;let C=!1;E.sparkline!==this.props.sparkline?C=!(0,s.bW)(this.state.alignedDataFrame,D.alignedDataFrame):C=!(0,t.isEqual)(E.config,this.props.config),C&&this.setState({configBuilder:this.prepareConfig(b)})}getYRange(E){let{min:D,max:b}=this.state.alignedDataFrame.fields[1].state?.range;const C=+this.state.alignedDataFrame.fields[1].config?.noValue;return Number.isNaN(C)||(D=Math.min(D,+C),b=Math.max(b,+C)),D===b?(D===0?b=100:(D=0,b*=2),[D,b]):[Math.max(D,E.config.min??-1/0),Math.min(b,E.config.max??1/0)]}prepareConfig(E){const{theme:D}=this.props,b=new i.e;b.setCursor({show:!1,x:!1,y:!1});const C=E.fields[0];b.addScale({scaleKey:"x",orientation:u.Lt.Horizontal,direction:u.ON.Right,isTime:!1,range:()=>{const{sparkline:y}=this.props;if(y.x){if(y.timeRange&&y.x.type===r.PU.time)return[y.timeRange.from.valueOf(),y.timeRange.to.valueOf()];const M=y.x.values;return[M[0],M[M.length-1]]}return[0,y.y.values.length-1]}}),b.addAxis({scaleKey:"x",theme:D,placement:u.vM.Hidden});for(let y=0;y<E.fields.length;y++){const M=E.fields[y],T=M.config,I={...m,...T.custom};if(M===C||M.type!==r.PU.number)continue;const x=T.unit||"__fixed";b.addScale({scaleKey:x,orientation:u.Lt.Vertical,direction:u.ON.Up,range:()=>this.getYRange(M)}),b.addAxis({scaleKey:x,theme:D,placement:u.vM.Hidden});const S=(0,g.Qi)(M),O=S.getCalculator(M,D)(0,0),P=I.drawStyle===u.GR.Points?u.yL.Always:I.showPoints;b.addSeries({pxAlign:!1,scaleKey:x,theme:D,colorMode:S,thresholds:T.thresholds,drawStyle:I.drawStyle,lineColor:I.lineColor??O,lineWidth:I.lineWidth,lineInterpolation:I.lineInterpolation,showPoints:P,pointSize:I.pointSize,fillOpacity:I.fillOpacity,fillColor:I.fillColor,lineStyle:I.lineStyle,gradientMode:I.gradientMode})}return b}render(){const{data:E,configBuilder:D}=this.state,{width:b,height:C}=this.props;return n.createElement(c.Z,{data:E,config:D,width:b,height:C})}}},62930:(Q,A,e)=>{"use strict";e.d(A,{y:()=>c});var t=e(32196),n=e(96540),o=e(8867),s=e(40845),r=e(4025),g=e(14578),u=e(78318);const c=({className:f,inline:d=!1,iconClassName:h,style:p,size:m="md"})=>{const a=(0,s.of)(i),v=(0,s.of)(l,m);if(typeof m!="string"||!(0,r.rJ)(m)){const E=(0,u.Wj)(),D="spinner",b=(0,u.Xi)(D,"default"),C=`${E}${b}/${D}.svg`;return n.createElement("div",{"data-testid":"Spinner",style:p,className:(0,t.cx)({[a.inline]:d},v.wrapper,f)},n.createElement(o.default,{src:C,width:m,height:m,className:(0,t.cx)("fa-spin",v.icon,f),style:p}))}return n.createElement("div",{"data-testid":"Spinner",style:p,className:(0,t.cx)({[a.inline]:d},f)},n.createElement(g.I,{className:(0,t.cx)("fa-spin",h),name:"spinner",size:m,"aria-label":"loading spinner"}))},i=f=>({inline:(0,t.css)({display:"inline-block"})}),l=(f,d)=>({wrapper:(0,t.css)({fontSize:typeof d=="string"?d:`${d}px`}),icon:(0,t.css)({display:"inline-block",fill:"currentColor",flexShrink:0,label:"Icon",lineHeight:0,verticalAlign:"middle"})})},34722:(Q,A,e)=>{"use strict";e.d(A,{O:()=>u});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(40845),g=e(69144);function u(v){const{direction:E="row",initialSize:D=.5,primaryPaneStyles:b,secondaryPaneStyles:C,onSizeChanged:y,onResizing:M,dragPosition:T="middle",children:I}=v,{containerRef:x,firstPaneRef:S,minDimProp:O,splitterProps:P,secondPaneRef:L}=h(E,y,M),U=s.Children.toArray(I),R=(0,r.of)(c,E),B=(0,r.of)(g.l,T),H=E==="column"?B.dragHandleHorizontal:B.dragHandleVertical,w=(0,s.useId)(),V=U.length===2?"visible":"hidden";let G=D;return I[1]||(G=1),s.createElement("div",{ref:x,className:R.container},s.createElement("div",{ref:S,className:R.panel,style:{flexGrow:(0,n.clamp)(G,0,1),[O]:"min-content",...b},id:`start-panel-${w}`},U[0]),U[1]&&s.createElement(s.Fragment,null,s.createElement("div",{className:H,...P,role:"separator","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":D*100,"aria-controls":`start-panel-${w}`,"aria-label":"Pane resize widget",tabIndex:0}),s.createElement("div",{ref:L,className:R.panel,style:{flexGrow:(0,n.clamp)(1-D,0,1),[O]:"min-content",visibility:`${V}`,...C},id:`end-panel-${w}`},U[1])))}function c(v,E){return{container:(0,t.css)({display:"flex",flexDirection:E==="row"?"row":"column",width:"100%",flexGrow:1,overflow:"hidden"}),panel:(0,t.css)({display:"flex",position:"relative",flexBasis:0}),dragEdge:{second:(0,t.css)({top:0,left:v.spacing(-1),bottom:0,position:"absolute",zIndex:v.zIndex.modal}),first:(0,t.css)({top:0,left:v.spacing(-1),bottom:0,position:"absolute",zIndex:v.zIndex.modal})}}}const i=.3,l=new Set(["ArrowUp","ArrowDown"]),f=new Set(["ArrowLeft","ArrowRight"]),d={row:{dim:"width",axis:"clientX",min:"minWidth",max:"maxWidth"},column:{dim:"height",axis:"clientY",min:"minHeight",max:"maxHeight"}};function h(v,E,D){const C=(0,s.useRef)(null),y=(0,s.useRef)(null),M=(0,s.useRef)(null),T=(0,s.useRef)(null),I=(0,s.useRef)(null),x=(0,s.useRef)("1fr"),S=(0,s.useRef)(void 0),O=(0,s.useRef)(void 0),P=d[v].dim,L=d[v].axis,U=d[v].min,R=d[v].max;a(T.current,ee=>{for(const re of ee){if(!re.target.isSameNode(T.current)||!y.current)return;const J=y.current.getBoundingClientRect()[P],ne=m(y.current);C.current.ariaValueNow=`${(0,n.clamp)((J-ne[U])/(ne[R]-ne[U])*100,0,100)}`}},500,[R,U,v,P]);const B=(0,s.useRef)(null),H=(0,s.useCallback)(ee=>{y.current&&(x.current=y.current.getBoundingClientRect()[P],I.current=T.current.getBoundingClientRect()[P],B.current=ee[L],C.current.setPointerCapture(ee.pointerId),S.current=m(y.current),O.current=void 0)},[P,L]),w=(0,s.useCallback)(ee=>{if(B.current!==null&&x.current!=="1fr"){const re=ee[L]-B.current,J=S.current,ne=(0,n.clamp)(x.current+re,J[U],J[R]),q=ne/(I.current-16);y.current.style.flexGrow=`${q}`,M.current.style.flexGrow=`${1-q}`;const te=p(ne,J[U],J[R]-J[U]);C.current.ariaValueNow=`${te}`,D?.(q,ne)}},[16,L,U,R,D]),N=(0,s.useCallback)(ee=>{ee.preventDefault(),ee.stopPropagation(),C.current.releasePointerCapture(ee.pointerId),B.current=null,typeof x.current=="number"&&E?.(parseFloat(y.current.style.flexGrow),x.current)},[E]),V=(0,s.useRef)(new Set),G=(0,s.useRef)(null),_=(0,s.useCallback)(ee=>{if(V.current.size===0){G.current=null;return}else if(x.current==="1fr")return;const ne=(ee-(G.current??ee))*i;let q=0;v==="row"?(V.current.has("ArrowLeft")&&(q-=ne),V.current.has("ArrowRight")&&(q+=ne)):(V.current.has("ArrowUp")&&(q-=ne),V.current.has("ArrowDown")&&(q+=ne));const te=S.current,oe=y.current.getBoundingClientRect()[P],ue=(0,n.clamp)(oe+q,te[U],te[R]),ie=ue/(I.current-16);y.current.style.flexGrow=`${ie}`,M.current.style.flexGrow=`${1-ie}`,C.current.ariaValueNow=p(ue,te[U],te[R]),D?.(ie,ue),G.current=ee,window.requestAnimationFrame(_)},[v,16,U,R,P,D]),K=(0,s.useCallback)(ee=>{if(!y.current||!M.current||!C.current||!T.current)return;if(ee.key==="Enter"){O.current===void 0?(O.current=y.current.style.flexGrow,y.current.style.flexGrow="0",M.current.style.flexGrow="1"):(y.current.style.flexGrow=O.current,M.current.style.flexGrow=`${1-parseFloat(O.current)}`,O.current=void 0);return}else if(ee.key==="Home"){S.current=m(y.current),I.current=T.current.getBoundingClientRect()[P];const J=S.current[U]/(I.current-16);y.current.style.flexGrow=`${J}`,M.current.style.flexGrow=`${1-J}`,C.current.ariaValueNow="0";return}else if(ee.key==="End"){S.current=m(y.current),I.current=T.current.getBoundingClientRect()[P];const J=S.current[R]/(I.current-16);y.current.style.flexGrow=`${J}`,M.current.style.flexGrow=`${1-J}`,C.current.ariaValueNow="100";return}if(!(v==="column"&&l.has(ee.key)||v==="row"&&f.has(ee.key))||V.current.has(ee.key))return;if(O.current=void 0,ee.preventDefault(),ee.stopPropagation(),x.current=y.current.getBoundingClientRect()[P],I.current=T.current.getBoundingClientRect()[P],S.current=m(y.current),!V.current.has(ee.key)){const J=V.current.size===0;V.current.add(ee.key),J&&window.requestAnimationFrame(_)}},[v,_,16,R,P,U]),j=(0,s.useCallback)(ee=>{v==="row"&&!f.has(ee.key)||v==="column"&&!l.has(ee.key)||(V.current.delete(ee.key),typeof x.current=="number"&&E?.(parseFloat(y.current.style.flexGrow),x.current))},[v,E]),k=(0,s.useCallback)(()=>{if(!y.current||!M.current)return;y.current.style.flexGrow="0.5",M.current.style.flexGrow="0.5";const ee=m(y.current);S.current=ee,x.current=y.current.getBoundingClientRect()[P],C.current.ariaValueNow=`${(x.current-ee[U])/(ee[R]-ee[U])*100}`},[R,P,U]),Y=(0,s.useCallback)(()=>{V.current.size>0&&(V.current.clear(),B.current=null,typeof x.current=="number"&&E?.(parseFloat(y.current.style.flexGrow),x.current))},[E]);return{containerRef:T,firstPaneRef:y,minDimProp:U,splitterProps:{onPointerUp:N,onPointerDown:H,onPointerMove:w,onKeyDown:K,onKeyUp:j,onDoubleClick:k,onBlur:Y,ref:C,style:{[P]:"16px"}},secondPaneRef:M}}function p(v,E,D){return`${(0,n.clamp)((v-E)/(D-E)*100,0,100)}`}function m(v){const E=document.body.style.overflow,D=v.style.width,b=v.style.height,C=v.style.flexGrow;document.body.style.overflow="hidden",v.style.flexGrow="0";const{width:y,height:M}=v.getBoundingClientRect();v.style.flexGrow="100";const{width:T,height:I}=v.getBoundingClientRect();return document.body.style.overflow=E,v.style.width=D,v.style.height=b,v.style.flexGrow=C,{minWidth:y,maxWidth:T,minHeight:M,maxHeight:I}}function a(v,E,D=0,b){const C=(0,n.throttle)(E,D);(0,s.useLayoutEffect)(()=>{if(!v)return;const y=new ResizeObserver(C);return y.observe(v,{box:"device-pixel-content-box"}),()=>y.disconnect()},b)}},42734:(Q,A,e)=>{"use strict";e.d(A,{S:()=>g});var t=e(2543),n=e.n(t),o=e(96540),s=e(75059),r=e(88323);class g extends o.PureComponent{constructor(){super(...arguments),this.checkInput=()=>{const{stats:c,allowMultiple:i,defaultStat:l,onChange:f}=this.props,d=s.AS.list(c);if(d.length!==c.length){const h=d.map(m=>m.id),p=(0,t.difference)(c,h);console.warn("Unknown stats",p,c),f(d.map(m=>m.id))}!i&&c.length>1&&(console.warn("Removing extra stat",c),f([c[0]])),l&&c.length<1&&f([l])},this.onSelectionChange=c=>{const{onChange:i}=this.props;Array.isArray(c)?i(c.map(l=>l.value)):i(c&&c.value?[c.value]:[])}}componentDidMount(){this.checkInput()}componentDidUpdate(c){this.checkInput()}render(){const{stats:c,allowMultiple:i,defaultStat:l,placeholder:f,className:d,menuPlacement:h,width:p,inputId:m,filterOptions:a}=this.props,v=s.AS.selectOptions(c,a);return o.createElement(r.l6,{value:v.current,className:d,isClearable:!l,isMulti:i,width:p,isSearchable:!0,options:v.options,placeholder:f,onChange:this.onSelectionChange,menuPlacement:h,inputId:m})}}g.defaultProps={allowMultiple:!1}},15292:(Q,A,e)=>{"use strict";e.d(A,{K:()=>i,d:()=>c});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(95344),g=e(40845),u=e(16797);const c=s.forwardRef(({value:f,checked:d,onChange:h,id:p,label:m,disabled:a,invalid:v=!1,...E},D)=>{d&&(0,r.l)("Switch","checked prop","value");const b=(0,g.of)(l),C=(0,s.useRef)(p||(0,n.uniqueId)("switch-"));return s.createElement("div",{className:(0,t.cx)(b.switch,v&&b.invalid)},s.createElement("input",{type:"checkbox",disabled:a,checked:f,onChange:y=>{!a&&h?.(y)},id:C.current,...E,ref:D}),s.createElement("label",{htmlFor:C.current,"aria-label":m??"Toggle switch"}))});c.displayName="Switch";const i=s.forwardRef(({transparent:f,className:d,showLabel:h,label:p,value:m,id:a,invalid:v,...E},D)=>{const b=(0,g.of)(l,f);return s.createElement("div",{className:(0,t.cx)(b.inlineContainer,d,E.disabled&&b.disabled,v&&b.invalid)},h&&s.createElement("label",{htmlFor:a,className:(0,t.cx)(b.inlineLabel,m&&b.inlineLabelEnabled,"inline-switch-label")},p),s.createElement(c,{...E,id:a,label:p,ref:D,value:m}))});i.displayName="Switch";const l=(f,d)=>({switch:(0,t.css)({width:"32px",height:"16px",position:"relative",lineHeight:1,input:{opacity:0,left:"-100vw",zIndex:-1e3,position:"absolute","&:checked + label":{background:f.colors.primary.main,borderColor:f.colors.primary.main,"&:hover":{background:f.colors.primary.shade},"&::after":{transform:"translate3d(18px, -50%, 0)",background:f.colors.primary.contrastText}},"&:disabled + label":{background:f.colors.action.disabledBackground,borderColor:f.colors.border.weak,cursor:"not-allowed","&:hover":{background:f.colors.action.disabledBackground}},"&:disabled:checked + label":{"&::after":{background:f.colors.text.disabled}},"&:focus + label, &:focus-visible + label":(0,u.getFocusStyles)(f),"&:focus:not(:focus-visible) + label":(0,u.getMouseFocusStyles)(f)},label:{width:"100%",height:"100%",cursor:"pointer",borderRadius:f.shape.radius.pill,background:f.components.input.background,border:`1px solid ${f.components.input.borderColor}`,transition:"all 0.3s ease","&:hover":{borderColor:f.components.input.borderHover},"&::after":{position:"absolute",display:"block",content:'""',width:"12px",height:"12px",borderRadius:f.shape.radius.circle,background:f.colors.text.secondary,boxShadow:f.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:f.spacing(0,1),height:f.spacing(f.components.height.md),display:"inline-flex",alignItems:"center",background:d?"transparent":f.components.input.background,border:`1px solid ${d?"transparent":f.components.input.borderColor}`,borderRadius:f.shape.radius.default,"&:hover":{border:`1px solid ${d?"transparent":f.components.input.borderHover}`,".inline-switch-label":{color:f.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:f.spacing(1),color:f.colors.text.secondary,whiteSpace:"nowrap"}),inlineLabelEnabled:(0,t.css)({color:f.colors.text.primary}),invalid:(0,t.css)({"input + label, input:checked + label, input:hover + label":{border:`1px solid ${f.colors.error.border}`}})})},60734:(Q,A,e)=>{"use strict";e.d(A,{q:()=>i});var t=e(32196),n=e(96540),o=e(29158),s=e(63021),r=e(40675),g=e(40980),u=e(40845),c=e(40276);function i({tabs:f,defaultTab:d,closeIconTooltip:h,onClose:p}){const[m,a]=(0,n.useState)(f.some(C=>C.value===d)?d:f[0].value),v=(0,u.of)(l),E=(0,u.$j)(),D=C=>{a(C.value)},b=`calc(100% - (${E.components.menuTabs.height}px + ${E.spacing(1)}))`;return n.createElement("div",{className:v.container},n.createElement(s.U,{className:v.tabs},f.map(C=>n.createElement(r.o,{key:C.value,label:C.label,active:C.value===m,onChangeTab:()=>D(C),icon:C.icon})),n.createElement(o.K,{className:v.close,onClick:p,name:"times",tooltip:h??"Close"})),n.createElement(c.E,{autoHeightMin:b,autoHeightMax:b},n.createElement(g.J,{className:v.tabContent},f.find(C=>C.value===m)?.content)))}const l=f=>({container:(0,t.css)({height:"100%"}),tabContent:(0,t.css)({padding:f.spacing(2),backgroundColor:f.colors.background.primary,height:"100%"}),close:(0,t.css)({position:"absolute",right:"16px",top:"5px",cursor:"pointer",fontSize:f.typography.size.lg}),tabs:(0,t.css)({paddingTop:f.spacing(1),borderColor:f.colors.border.weak,ul:{marginLeft:f.spacing(2)}})})},92015:(Q,A,e)=>{"use strict";e.d(A,{u:()=>u,d:()=>i});var t=e(96540),n=e(75059),o=e(13544),s=e(32196);const r=l=>{const f=(0,s.css)({width:"100%",listStyle:"none"}),d=(0,s.css)({width:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between"});return l.value&&!Array.isArray(l.value)?t.createElement("span",null,l.value):l.value&&Array.isArray(l.value)&&l.value.length>0?t.createElement("ul",{className:f},l.value.map((h,p)=>{const m=Object.keys(h)[0];return t.createElement("li",{className:d,key:p},t.createElement("span",null,m),t.createElement("span",null,h[m]))})):g},g=()=>t.createElement("span",null,"\xA0");function u(l){const{totalColumnsWidth:f,footerGroups:d,isPaginationVisible:h,tableStyles:p}=l,m=o.Tp.components.Panels.Visualization.Table;return t.createElement("div",{style:{position:h?"relative":"absolute",width:f?`${f}px`:"100%",bottom:"0px"}},d.map(a=>{const{key:v,...E}=a.getFooterGroupProps();return t.createElement("div",{className:p.tfoot,...E,key:v,"data-testid":m.footer},a.headers.map(D=>c(D,p)))}))}function c(l,f){const d=l.getHeaderProps();return d?(d.style=d.style??{},d.style.position="absolute",d.style.justifyContent=l.justifyContent,t.createElement("div",{className:f.headerCell,...d},l.render("Footer"))):null}function i(l,f,d){if(f===void 0)return g;if(d){if(f[l]===void 0)return g;const h=n.AS.get(n.gy.count).name;return r({value:[{[h]:String(f[l])}]})}return r({value:f[l]})}},30355:(Q,A,e)=>{"use strict";e.d(A,{a:()=>d,t:()=>f});var t=e(96540),n=e(58563),o=e(14236),s=e(11261),r=e(52622),g=e(40845),u=e(29413),c=e(9286),i=e(5926),l=e(77659);const f={type:r.ob.Sparkline,drawStyle:r.GR.Line,lineInterpolation:r.dx.Smooth,lineWidth:1,fillOpacity:17,gradientMode:r.on.Hue,pointSize:2,barAlignment:r.Nj.Center,showPoints:r.yL.Never,hideValue:!1},d=m=>{const{field:a,innerWidth:v,tableStyles:E,cell:D,cellProps:b,timeRange:C}=m,y=h(D.value),M=(0,g.$j)();if(!y)return t.createElement("div",{...b,className:E.cellContainer},a.config.noValue||"no data");y.x&&!y.x.config.interval&&y.x.values.length>1&&(y.x.config.interval=y.x.values[1]-y.x.values[0]),y.y.values=y.y.values.map(L=>Number.isFinite(L)?L:null);const T=(0,n.AP)(y.y);y.y.config.min=T.min,y.y.config.max=T.max,y.y.state={range:T},y.timeRange=C;const I=p(a),x={color:a.config.color,custom:{...f,...I}},S=a.config.custom?.cellOptions?.hideValue;let O=0,P=null;if(!S){const L=(0,o.LI)(D.value)?D.value.value:null,U=a.display(L),R=(0,l.zi)(a,U,D.row.index);O=(0,u.kD)(`${R.prefix??""}${R.text}${R.suffix??""}`,16).width+M.spacing.gridSize,P=t.createElement(c.i,{style:{width:`${O-M.spacing.gridSize}px`,textAlign:"right",marginRight:M.spacing(1)},value:U})}return t.createElement("div",{...b,className:E.cellContainer},P,t.createElement("div",null,t.createElement(i.O,{width:v-O,height:E.cellHeightInner,sparkline:y,config:x,theme:E.theme})))};function h(m){if(Array.isArray(m))return{y:{name:"test",type:s.PU.number,values:m,config:{}}};if((0,o.ci)(m)){const a=m.fields.find(E=>E.type===s.PU.time),v=m.fields.find(E=>E.type===s.PU.number);if(a&&v)return{x:a,y:v}}}function p(m){let a=(0,l.bk)(m);if(a.type===r.ob.Auto&&(a={...a,type:r.ob.Sparkline}),a.type===r.ob.Sparkline)return a;throw new Error(`Expected options type ${r.ob.Sparkline} but got ${a.type}`)}},77093:(Q,A,e)=>{"use strict";e.d(A,{X:()=>Re});var t=e(96540),n=e(32885),o=e(75059),s=e(11261),r=e(19845),g=e(13544),u=e(52622),c=e(40845),i=e(40276),l=e(19384),f=e(92015),d=e(4025),h=e(14578),p=e(32196),m=e(13840),a=e(8866),v=e(66864),E=e(60029),D=e(29158),b=e(55852),C=e(91793),y=e(83195),M=e(67647),T=e(9261),I=e(10880);const x=28,S=x*5,O={Contains:{label:"Contains",value:"Contains",description:"Contains"},"=":{label:"=",value:"=",description:"Equals"},"!=":{label:"!=",value:"!=",description:"Not equals"},">":{label:">",value:">",description:"Greater"},">=":{label:">=",value:">=",description:"Greater or Equal"},"<":{label:"<",value:"<",description:"Less"},"<=":{label:"<=",value:"<=",description:"Less or Equal"},Expression:{label:"Expression",value:"Expression",description:'Bool Expression (Char $ represents the column value in the expression, e.g. "$ >= 10 && $ <= 12")'}},P=Object.values(O),L=O.Contains,U=O.Expression,R=me=>{if(me=me.trim().replace(/\\/g,""),/^(\d{4}-\d{2}-\d{2}|\d{4}\/\d{2}\/\d{2})/.test(me)){const Le=new Date(me);if(!isNaN(Le.getTime())){const We=(0,y.j_)("dateTimeAsIso");return(0,y.cN)(We(Le.getTime()))}}const Me=parseFloat(me);if(!isNaN(Me))return Me;const ye=me.toLowerCase();return ye==="true"||ye==="false"?ye==="true":me},B=({options:me,values:Me,caseSensitive:ye,showOperators:Le,onChange:We})=>{const[Be,Ye]=(0,t.useState)(L),[at,st]=(0,t.useState)(""),Ke=(0,t.useMemo)(()=>new RegExp(at,ye?void 0:"i"),[at,ye]),Xe=(0,t.useMemo)(()=>me.filter(ze=>{if(!Le||!at||Be.value===L.value)return ze.label===void 0?!1:Ke.test(ze.label);if(Be.value===U.value){if(ze.value===void 0)return!1;try{const Ve=at.replace(/\\/g,""),Ne=new Function("$",`'use strict'; return ${Ve};`),ot=R(ze.value);return Ne(ot)}catch{}return!1}else{if(ze.value===void 0)return!1;const Ve=R(ze.value),Ne=R(at);switch(Be.value){case"=":return Ve===Ne;case"!=":return Ve!==Ne;case">":return Ve>Ne;case">=":return Ve>=Ne;case"<":return Ve<Ne;case"<=":return Ve<=Ne}return!1}}),[me,Ke,Le,Be,at]),He=(0,t.useMemo)(()=>Xe.filter(ze=>Me.includes(ze)),[Xe,Me]),Ge=(0,t.useMemo)(()=>Xe.length===He.length,[Xe,He]),xe=(0,t.useMemo)(()=>He.length>0&&Xe.length>He.length,[Xe,He]),$e=(0,t.useMemo)(()=>He.length?`${He.length} selected`:"Select all",[He]),be=(0,t.useMemo)(()=>Xe.length!==He.length?"Add all displayed values to the filter":"Remove all displayed values from the filter",[Xe,He]),Z=(0,c.of)(H),de=(0,c.$j)().spacing.gridSize,ve=(0,t.useMemo)(()=>Math.min(Xe.length*x,S)+de,[de,Xe.length]),Ue=(0,t.useCallback)(ze=>Ve=>{const Ne=Ve.currentTarget.checked?Me.concat(ze):Me.filter(ot=>ot.value!==ze.value);We(Ne)},[We,Me]),_e=(0,t.useCallback)(()=>{if(Xe.length===He.length){const ze=Me.filter(Ve=>!Xe.includes(Ve));We(ze)}else{const ze=[...new Set([...Me,...Xe])];We(ze)}},[We,Me,Xe,He]);return t.createElement(v.gW,{spacing:"md"},!Le&&t.createElement(M.Z,{placeholder:"Filter values",onChange:st,value:at}),Le&&t.createElement(v.Gy,null,t.createElement(T.f,{variant:"canvas",options:P,onChange:Ye,value:Be,tooltip:Be.description}),t.createElement(M.Z,{placeholder:"Filter values",onChange:st,value:at})),!Xe.length&&t.createElement(E.J,null,"No values"),Xe.length&&t.createElement(C.Y1,{height:ve,itemCount:Xe.length,itemSize:x,width:"100%",className:Z.filterList},({index:ze,style:Ve})=>{const Ne=Xe[ze],{value:ot,label:nt}=Ne,pt=Me.find(mt=>mt.value===ot)!==void 0;return t.createElement("div",{className:Z.filterListRow,style:Ve,title:nt},t.createElement(I.S,{value:pt,label:nt,onChange:Ue(Ne)}))}),Xe.length&&t.createElement(v.gW,{spacing:"xs"},t.createElement("div",{className:(0,p.cx)(Z.selectDivider)}),t.createElement("div",{className:(0,p.cx)(Z.filterListRow)},t.createElement(I.S,{value:Ge,indeterminate:xe,label:$e,description:be,onChange:_e}))))},H=me=>({filterList:(0,p.css)({label:"filterList"}),filterListRow:(0,p.css)({label:"filterListRow",cursor:"pointer",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",padding:me.spacing(.5),":hover":{backgroundColor:me.colors.action.hover}}),selectDivider:(0,p.css)({label:"selectDivider",width:"100%",borderTop:`1px solid ${me.colors.border.medium}`,padding:me.spacing(.5,2)})});var w=e(77659);const N=({column:{preFilteredRows:me,filterValue:Me,setFilter:ye},onClose:Le,field:We})=>{const Be=(0,c.$j)(),Ye=(0,t.useMemo)(()=>(0,w.MY)(me,We),[me,We]),at=(0,t.useMemo)(()=>(0,w.Yz)(Ye),[Ye]),st=(0,t.useMemo)(()=>(0,w.Sj)(at,Me),[at,Me]),[Ke,Xe]=(0,t.useState)(st),[He,Ge]=(0,t.useState)(!1),xe=(0,t.useCallback)(de=>Le(),[Le]),$e=(0,t.useCallback)(de=>{const ve=Ke.length?Ke:void 0;ye(ve),Le()},[ye,Ke,Le]),be=(0,t.useCallback)(de=>{ye(void 0),Le()},[ye,Le]),Z=(0,t.useMemo)(()=>Me!==void 0,[Me]),ae=(0,c.of)(V);return t.createElement(a.N,{onClick:xe,useCapture:!0},t.createElement("div",{className:(0,p.cx)(ae.filterContainer),onClick:G},t.createElement(v.gW,{spacing:"lg"},t.createElement(v.gW,{spacing:"xs"},t.createElement(v.Gy,{justify:"space-between",align:"center"},t.createElement(E.J,{className:ae.label},"Filter by values:"),t.createElement(D.K,{name:"text-fields",tooltip:"Match case",style:{color:He?Be.colors.text.link:Be.colors.text.disabled},onClick:()=>{Ge(de=>!de)}})),t.createElement("div",{className:(0,p.cx)(ae.listDivider)}),t.createElement(B,{onChange:Xe,values:Ke,options:at,caseSensitive:He,showOperators:!0})),t.createElement(v.Gy,{spacing:"lg"},t.createElement(v.Gy,null,t.createElement(b.$n,{size:"sm",onClick:$e},"Ok"),t.createElement(b.$n,{size:"sm",variant:"secondary",onClick:xe},"Cancel")),Z&&t.createElement(v.Gy,null,t.createElement(b.$n,{fill:"text",size:"sm",onClick:be},"Clear filter"))))))},V=me=>({filterContainer:(0,p.css)({label:"filterContainer",width:"100%",minWidth:"250px",height:"100%",maxHeight:"400px",backgroundColor:me.colors.background.primary,border:`1px solid ${me.colors.border.weak}`,padding:me.spacing(2),margin:me.spacing(1,0),boxShadow:me.shadows.z3,borderRadius:me.shape.radius.default}),listDivider:(0,p.css)({label:"listDivider",width:"100%",borderTop:`1px solid ${me.colors.border.medium}`,padding:me.spacing(.5,2)}),label:(0,p.css)({marginBottom:0})}),G=me=>{me.stopPropagation()},_=({column:me,field:Me,tableStyles:ye})=>{const Le=(0,t.useRef)(null),[We,Be]=(0,t.useState)(!1),Ye=(0,c.of)(K),at=(0,t.useMemo)(()=>!!me.filterValue,[me.filterValue]),st=(0,t.useCallback)(()=>Be(!0),[Be]),Ke=(0,t.useCallback)(()=>Be(!1),[Be]);return!Me||!Me.config.custom?.filterable?null:t.createElement("button",{className:(0,p.cx)(ye.headerFilter,at?Ye.filterIconEnabled:Ye.filterIconDisabled),ref:Le,type:"button",onClick:st},t.createElement(h.I,{name:"filter"}),We&&Le.current&&t.createElement(m.A,{content:t.createElement(N,{column:me,tableStyles:ye,field:Me,onClose:Ke}),placement:"bottom-start",referenceElement:Le.current,show:!0}))},K=me=>({filterIconEnabled:(0,p.css)({label:"filterIconEnabled",color:me.colors.primary.text}),filterIconDisabled:(0,p.css)({label:"filterIconDisabled",color:me.colors.text.disabled})}),j=me=>{const{headerGroups:Me,showTypeIcons:ye,tableStyles:Le}=me,We=g.Tp.components.Panels.Visualization.Table;return t.createElement("div",{role:"rowgroup",className:Le.headerRow},Me.map(Be=>{const{key:Ye,...at}=Be.getHeaderGroupProps();return t.createElement("div",{className:Le.thead,...at,key:Ye,"aria-label":We.header,role:"row"},Be.headers.map((st,Ke)=>k(st,Le,ye)))}))};function k(me,Me,ye){const Le=me.getHeaderProps(),We=me.field??null;return me.canResize&&(Le.style.userSelect=me.isResizing?"none":"auto"),Le.style.position="absolute",Le.style.justifyContent=me.justifyContent,t.createElement("div",{className:Me.headerCell,...Le,role:"columnheader"},me.canSort&&t.createElement(t.Fragment,null,t.createElement("button",{...me.getSortByToggleProps(),className:Me.headerCellLabel},ye&&t.createElement(h.I,{name:(0,d.SS)(We),title:We?.type,size:"sm",className:Me.typeIcon}),t.createElement("div",null,me.render("Header")),me.isSorted&&(me.isSortedDesc?t.createElement(h.I,{size:"lg",name:"arrow-down",className:Me.sortIcon}):t.createElement(h.I,{name:"arrow-up",size:"lg",className:Me.sortIcon}))),me.canFilter&&t.createElement(_,{column:me,tableStyles:Me,field:We})),!me.canSort&&me.render("Header"),!me.canSort&&me.canFilter&&t.createElement(_,{column:me,tableStyles:Me,field:We}),me.canResize&&t.createElement("div",{...me.getResizerProps(),className:Me.resizeHandle}))}var Y=e(64423),ee=e(56978),re=e(69129),J=e(79041);function ne({tableStyles:me,nestedData:Me,rowIndex:ye,width:Le,cellHeight:We}){const Be=Me.values,Ye=[],at=(0,c.$j)(),st=(0,c.of)(q);let Ke=me.rowHeight+at.spacing.gridSize;return Be[ye].forEach((Xe,He)=>{const Ge=!!Xe.meta?.custom?.noHeader,xe=me.rowHeight*(Xe.length+(Ge?0:1)),$e={height:xe,paddingLeft:w.jV,position:"absolute",top:Ke};Ke+=xe+at.spacing.gridSize,Ye.push(t.createElement("div",{style:$e,key:`subTable_${ye}_${He}`},t.createElement(Re,{data:Xe,width:Le-w.jV,height:me.rowHeight*(Xe.length+1),noHeader:Ge,cellHeight:We})))}),t.createElement("div",{className:st.subTables},Ye)}const q=me=>({subTables:(0,p.css)({"&:before":{content:'""',position:"absolute",width:"1px",top:me.spacing(5),left:me.spacing(1),bottom:me.spacing(2),background:me.colors.border.medium}})});function te(me,Me,ye){return me.values[Me].reduce((Be,Ye)=>{if(Ye.length){const at=!!Ye.meta?.custom?.noHeader;return Be+ye.rowHeight*(Ye.length+(at?0:1))+8}return Be},ye.rowHeight)??ye.rowHeight}var oe=e(49618);const ue=me=>{const{data:Me,rows:ye,headerHeight:Le,footerPaginationEnabled:We,rowHeight:Be,itemCount:Ye,pageIndex:at,tableState:st,prepareRow:Ke,onCellFilterAdded:Xe,width:He,cellHeight:Ge=u.qM.Sm,timeRange:xe,tableStyles:$e,nestedDataField:be,listHeight:Z,listRef:ae,enableSharedCrosshair:de=!1,initialRowIndex:ve=void 0}=me,[Ue,_e]=(0,t.useState)(ve),ze=(0,c.$j)(),Ve=(0,J.d2)(),Ne=(0,t.useMemo)(()=>{const zt=Me.fields.find(_t=>_t.type===s.PU.time);return zt?(0,w.HY)(zt):0},[Me]),ot=(0,t.useCallback)((zt,_t)=>{if(!Ve||!de||!(0,r.S1)(_t))return;const rt=_t.fields.find(It=>It.type===s.PU.time);Ve.eventBus.publish(new re.b_({point:{time:rt.values[zt]}}))},[de,Ve]),nt=(0,t.useCallback)(()=>{!Ve||!de||Ve.eventBus.publish(new re.ql)},[de,Ve]),pt=(0,t.useCallback)(zt=>{if(zt.payload.point?.time&&zt.payload.rowIndex!==void 0){const _t=Me.fields.find(ft=>ft.type===s.PU.time),rt=_t.values[zt.payload.rowIndex],It=zt.payload.point.time;if((0,w.Iy)(It,rt,Ne)){_e(zt.payload.rowIndex);return}const Dn=_t.values.findIndex(ft=>(0,w.Iy)(It,ft,Ne));if(Dn!==-1){_e(Dn);return}_e(void 0)}},[Me.fields,Ne]);(0,t.useEffect)(()=>{if(!Ve||!de||!(0,r.S1)(Me)||We)return;const zt=new Y.yU;return zt.add(Ve.eventBus.getStream(re.b_).pipe((0,ee.B)(250)).subscribe({next:_t=>{Ve.eventBus!==_t.origin&&pt(_t)}})),zt.add(Ve.eventBus.getStream(re.ql).pipe((0,ee.B)(250)).subscribe({next:_t=>{Ve.eventBus!==_t.origin&&_e(void 0)}})),()=>{zt.unsubscribe()}},[Me,de,We,pt,Ve]);let mt;if(Ue!==void 0){const zt=ye.findIndex(_t=>_t.index===Ue);zt!==-1&&(mt=Le+(zt-1)*Be)}const gt=(0,t.useCallback)(zt=>st.pageIndex*st.pageSize+zt,[st.pageIndex,st.pageSize]),Pt=(0,t.useCallback)(({index:zt,style:_t,rowHighlightIndex:rt})=>{const It=gt(zt),Dn=ye[It];let ft={};Ke(Dn);const yt=st.expanded[Dn.id]?(0,p.css)({"&:hover":{background:"inherit"}}):{};return rt!==void 0&&Dn.index===rt&&(_t={..._t,backgroundColor:ze.components.table.rowHoverBackground},ft={"aria-selected":"true"}),t.createElement("div",{...Dn.getRowProps({style:_t,...ft}),className:(0,p.cx)($e.row,yt),onMouseEnter:()=>ot(zt,Me),onMouseLeave:nt},be&&st.expanded[Dn.id]&&t.createElement(ne,{nestedData:be,tableStyles:$e,rowIndex:zt,width:He,cellHeight:Ge}),Dn.cells.map((jt,cn)=>t.createElement(oe.n,{key:cn,tableStyles:$e,cell:jt,onCellFilterAdded:Xe,columnIndex:cn,columnCount:Dn.cells.length,timeRange:xe,frame:Me})))},[Ge,Me,be,Xe,ot,nt,Ke,gt,ye,st.expanded,$e,ze.components.table.rowHoverBackground,xe,He]),Mt=zt=>{const _t=gt(zt),rt=ye[_t];return st.expanded[rt.id]&&be?te(be,zt,$e):$e.rowHeight},Yt=zt=>{const{scrollTop:_t}=zt.currentTarget;ae.current!==null&&ae.current.scrollTo(_t)};return t.createElement(t.Fragment,null,t.createElement(i.A,{onScroll:Yt,hideHorizontalTrack:!0,scrollTop:mt},t.createElement(C._m,{key:Be+at,height:Z,itemCount:Ye,itemSize:Mt,width:"100%",ref:ae,style:{overflow:void 0}},({index:zt,style:_t})=>Pt({index:zt,style:_t,rowHighlightIndex:Ue}))))};function ie(me,Me){(0,t.useEffect)(()=>{if(me.current&&Me.current){const ye=me.current.querySelector(".track-vertical"),Le=Me.current.firstChild;Le&&ye&&(ye.remove(),Le instanceof HTMLElement&&(Le.querySelector(":scope > .track-vertical")?.remove(),Le.append(ye)))}})}function ge(me,Me,ye,Le){const We=JSON.stringify(Object.keys(me.expanded));(0,t.useEffect)(()=>{let Be=0;Le||(Number.isFinite(me.lastExpandedOrCollapsedIndex)&&(Be=me.lastExpandedOrCollapsedIndex),Be=me.pageIndex===0?Be-1:Be-me.pageIndex-me.pageIndex*me.pageSize),Me.current?.resetAfterIndex(Math.max(Be,0))},[me.lastExpandedOrCollapsedIndex,me.pageSize,me.pageIndex,Me,ye,We,Le])}var he=e(28240);function De({onColumnResize:me,onSortByChange:Me,data:ye}){return(0,t.useCallback)((Le,We)=>{switch(We.type){case"columnDoneResizing":if(me){const Ye=Le.columnResizing.headerIdWidths[0][0],at=parseInt(Ye,10),st=Math.round(Le.columnResizing.columnWidths[Ye]),Ke=ye.fields[at];if(!Ke)return Le;const Xe=(0,he.Ct)(Ke,ye);me(Xe,st)}case"toggleSortBy":if(Me){const Be=[];for(const Ye of Le.sortBy){const at=ye.fields[parseInt(Ye.id,10)];at&&Be.push({displayName:(0,he.Ct)(at,ye),desc:Ye.desc})}Me(Be)}case"toggleRowExpanded":if(We.id)return{...Le,lastExpandedOrCollapsedIndex:parseInt(We.id,10)}}return Le},[ye,me,Me])}function pe(me,Me){const ye={};if(me){ye.sortBy=[];for(const Le of me)for(const We of Me)We.Header===Le.displayName&&ye.sortBy.push({id:We.id,desc:Le.desc})}return ye}var le=e(69770);const Te=150,Ee=36,Re=(0,t.memo)(me=>{const{ariaLabel:Me,data:ye,height:Le,onCellFilterAdded:We,width:Be,columnMinWidth:Ye=Te,noHeader:at,resizable:st=!0,initialSortBy:Ke,footerOptions:Xe,showTypeIcons:He,footerValues:Ge,enablePagination:xe,cellHeight:$e=u.qM.Sm,timeRange:be,enableSharedCrosshair:Z=!1,initialRowIndex:ae=void 0}=me,de=(0,t.useRef)(null),ve=(0,t.useRef)(null),Ue=(0,t.useRef)(null),_e=(0,c.$j)(),ze=(0,le.k)(_e,$e),Ve=at?0:ze.rowHeight,[Ne,ot]=(0,t.useState)(Ge),nt=(0,t.useMemo)(()=>{const Sn=Ee;let Tn=0;if(!Ne)return 0;for(const $n of Ne)Array.isArray($n)&&$n.length>Tn&&(Tn=$n.length);return Tn>1?Sn*Tn:Sn},[Ne]),pt=(0,t.useMemo)(()=>ye.fields.length?Array(ye.length).fill(0):[],[ye]),mt=!!(Xe?.countRows&&Xe.reducer&&Xe.reducer.length&&Xe.reducer[0]===o.gy.count),gt=ye.fields.find(Sn=>Sn.type===s.PU.nestedFrames),Pt=gt!==void 0,Mt=(0,t.useMemo)(()=>(0,w.GH)(ye,Be,Ye,Pt,Ne,mt),[ye,Be,Ye,Ne,Pt,mt]),Yt=(0,t.useRef)(),zt=De({...me,onSortByChange:Sn=>{Yt.current(!1),me.onSortByChange&&me.onSortByChange(Sn)}}),_t=!!ye.meta?.uniqueRowIdFields?.length,rt=(0,t.useMemo)(()=>{const Sn={columns:Mt,data:pt,disableResizing:!st,stateReducer:zt,autoResetPage:!1,initialState:pe(Ke,Mt),autoResetFilters:!1,sortTypes:{number:w.Ok,"alphanumeric-insensitive":w.IM}};return _t&&(Sn.getRowId=(Tn,$n)=>(0,r.t9)(ye,$n),Sn.autoResetExpanded=!1),Sn},[Ke,Mt,pt,st,zt,_t,ye]),{getTableProps:It,headerGroups:Dn,footerGroups:ft,rows:yt,prepareRow:jt,totalColumnsWidth:cn,page:pn,state:on,gotoPage:Xt,setPageSize:fn,pageOptions:An,toggleAllRowsExpanded:hn}=(0,n.useTable)(rt,n.useFilters,n.useSortBy,n.useAbsoluteLayout,n.useResizeColumns,n.useExpanded,n.usePagination),ca=on;Yt.current=hn,(0,t.useEffect)(()=>{Xe||ot(Ge)},[Ge,Xe]),(0,t.useEffect)(()=>{if(!Xe)return;if(!Xe.show){ot(void 0);return}if(mt){const Tn=[];Tn[0]=Dn[0]?.headers[0]?.filteredRows.length.toString()??ye.length.toString(),ot(Tn);return}const Sn=(0,w.Ux)(Dn[0].headers,(0,w.XX)(yt),Xe,_e);ot(Sn)},[Xe,_e,on.filters,ye]);let Rt=Le-(Ve+nt);xe&&(Rt-=ze.cellHeight);const qt=Math.round(Rt/ze.rowHeight)-1;(0,t.useEffect)(()=>{qt<=0||fn(qt)},[qt,fn]),(0,t.useEffect)(()=>{ye.length/qt<on.pageIndex&&Xt(0)},[ye]),ge(ca,de,ye,_t),ie(Ue,ve);const gn=(0,t.useCallback)(Sn=>{Xt(Sn-1)},[Xt]),Cn=xe?pn.length:yt.length;let mn=null;if(xe){const Sn=on.pageIndex*on.pageSize+1;let Tn=Sn+on.pageSize-1;const $n=Be<550;Tn>ye.length&&(Tn=ye.length),mn=t.createElement("div",{className:ze.paginationWrapper},t.createElement(l.d,{currentPage:on.pageIndex+1,numberOfPages:An.length,showSmallVersion:$n,onNavigate:gn}),$n?null:t.createElement("div",{className:ze.paginationSummary},Sn," - ",Tn," of ",ye.length," rows"))}return t.createElement("div",{...It(),className:ze.table,"aria-label":Me,role:"table",ref:ve,style:{width:Be,height:Le}},t.createElement(i.E,{hideVerticalTrack:!0},t.createElement("div",{className:ze.tableContentWrapper(cn)},!at&&t.createElement(j,{headerGroups:Dn,showTypeIcons:He,tableStyles:ze}),Cn>0?t.createElement("div",{"data-testid":g.Tp.components.Panels.Visualization.Table.body,ref:Ue},t.createElement(ue,{data:ye,rows:yt,width:Be,cellHeight:$e,headerHeight:Ve,rowHeight:ze.rowHeight,itemCount:Cn,pageIndex:on.pageIndex,listHeight:Rt,listRef:de,tableState:on,prepareRow:jt,timeRange:be,onCellFilterAdded:We,nestedDataField:gt,tableStyles:ze,footerPaginationEnabled:!!xe,enableSharedCrosshair:Z,initialRowIndex:ae})):t.createElement("div",{style:{height:Le-Ve,width:Be},className:ze.noData},"No data"),Ne&&t.createElement(f.u,{isPaginationVisible:!!xe,footerValues:Ne,footerGroups:ft,totalColumnsWidth:cn,tableStyles:ze}))),mn)});Re.displayName="Table"},49618:(Q,A,e)=>{"use strict";e.d(A,{n:()=>n});var t=e(96540);const n=({cell:o,tableStyles:s,onCellFilterAdded:r,timeRange:g,userProps:u,frame:c})=>{const i=o.getCellProps(),l=o.column.field;if(!l?.display)return null;i.style&&(i.style.minWidth=i.style.width,i.style.justifyContent=o.column.justifyContent);let f=(typeof o.column.width=="number"?o.column.width:24)-s.cellPadding*2;return t.createElement(t.Fragment,null,o.render("Cell",{field:l,tableStyles:s,onCellFilterAdded:r,cellProps:i,innerWidth:f,timeRange:g,userProps:u,frame:c}))}},69770:(Q,A,e)=>{"use strict";e.d(A,{k:()=>n});var t=e(32196);function n(s,r){const g=s.colors.border.weak,u=s.colors.primary.border,c=6,i=o(s,r,c),l=i+2,f=28,d=(h,p,m,a)=>(0,t.css)({label:m?"cellContainerOverflow":"cellContainerNoOverflow",padding:`${c}px`,width:"100%",height:`${l-1}px`,display:"flex",...a?{overflow:"hidden",textOverflow:"ellipsis",userSelect:"text",whiteSpace:"nowrap"}:{},alignItems:"center",borderRight:`1px solid ${g}`,color:h??void 0,background:p??void 0,backgroundClip:"padding-box","&:last-child:not(:only-child)":{borderRight:"none"},"&:hover":{overflow:m?"visible":void 0,width:m?"auto !important":void 0,boxShadow:m?`0 0 2px ${s.colors.primary.main}`:void 0,background:m?p??s.components.table.rowHoverBackground:void 0,zIndex:m?1:void 0,".cellActions":{visibility:"visible",opacity:1,width:"auto"}},a:{color:"inherit"},".cellActions":{display:"flex",position:m?void 0:"absolute",top:m?void 0:0,right:m?void 0:0,margin:m?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:p?"none":s.colors.emphasize(s.colors.background.primary,.03),svg:{color:h}},".cellActionsLeft":{right:"auto !important",left:0},".cellActionsTransparent":{background:"none"}});return{theme:s,cellHeight:i,buildCellContainerStyle:d,cellPadding:c,cellHeightInner:i-c*2,rowHeight:l,table:(0,t.css)({height:"100%",width:"100%",overflow:"auto",display:"flex",flexDirection:"column"}),thead:(0,t.css)({label:"thead",height:`${f}px`,overflowY:"auto",overflowX:"hidden",position:"relative"}),tfoot:(0,t.css)({label:"tfoot",height:`${f}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 ${c}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}}),cellContainerText:d(void 0,void 0,!0,!0),cellContainerTextNoOverflow:d(void 0,void 0,!1,!0),cellContainer:d(void 0,void 0,!0,!1),cellContainerNoOverflow:d(void 0,void 0,!1,!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,paddingRight:s.spacing(1.5),"&: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:`${i}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:h=>{const p=h!==void 0?`${h}px`:"100%";return(0,t.css)({label:"tableContentWrapper",width:p,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:u,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:`${l}px`,cursor:"pointer"})}}function o(s,r,g){const u=s.typography.fontSize,c=s.typography.body.lineHeight;switch(r){case"md":return 42;case"lg":return 48;case"sm":default:return g*2+u*c}}},88407:(Q,A,e)=>{"use strict";e.d(A,{Zi:()=>n,mc:()=>t});const t="=",n="!="},77659:(Q,A,e)=>{"use strict";e.d(A,{jV:()=>ne,HY:()=>st,MY:()=>ie,XX:()=>Me,zi:()=>Ye,bk:()=>Le,GH:()=>te,Sj:()=>pe,Ux:()=>Re,j1:()=>q,Iy:()=>at,o7:()=>We,IM:()=>le,Ok:()=>Te,Yz:()=>he});var t=e(2543),n=e(47078),o=e.n(n),s=e(11261),r=e(28240),g=e(14236),u=e(19845),c=e(83195),i=e(75059),l=e(57875),f=e(52622),d=e(96540),h=e(50082),p=e(58563),m=e(47070),a=e(97696),v=e(59796);const E={mode:h.O.Absolute,steps:[{color:"blue",value:-1/0},{color:"green",value:20}]},D=Ke=>{const{field:Xe,innerWidth:He,tableStyles:Ge,cell:xe,cellProps:$e,row:be}=Ke,Z=Xe.display(xe.value),ae=Le(Xe);let de=(0,p.xg)(Xe,!1);de.thresholds||(de={...de,thresholds:E});let ve=f.eX.Gradient,Ue;ae.type===f.ob.Gauge&&(ve=ae.mode??f.eX.Gradient,Ue=ae.valueDisplayMode!==void 0?ae.valueDisplayMode:f.$l.Text);const _e=()=>(0,t.isFunction)(Xe.getLinks)?Xe.getLinks({valueRowIndex:be.index}):[],ze=!!_e().length,Ve=Ye(Xe,Z,xe.row.index),Ne=ot=>{const{openMenu:nt,targetClassName:pt}=ot;return d.createElement(a.xE,{width:He,height:Ge.cellHeightInner,field:de,display:Xe.display,text:{valueSize:14},value:Z,orientation:m.wV.Horizontal,theme:Ge.theme,alignmentFactors:Ve,onClick:nt,className:pt,itemSpacing:1,lcdCellWidth:8,displayMode:ve,valueDisplayMode:Ue})};return d.createElement("div",{...$e,className:Ge.cellContainer},ze&&d.createElement(v.e,{links:_e,style:{display:"flex",width:"100%"}},ot=>Ne(ot)),!ze&&Ne({}))};var b=e(90914);const C=Ke=>{const{field:Xe,row:He,cellProps:Ge,tableStyles:xe}=Ke,$e=(0,b.k)(Xe,He);return d.createElement("div",{...Ge,className:xe.cellContainerText},$e&&$e.map((be,Z)=>d.createElement("span",{key:Z,className:xe.cellLink,onClick:be.onClick},d.createElement("a",{href:be.href,target:be.target},be.title))))};var y=e(32196),M=e(84140),T=e(40845),I=e(24284),x=e(55852),S=e(29158),O=e(66864),P=e(10534),L=e(37390),U=e(32372);function R({value:Ke,onDismiss:Xe,mode:He}){let Ge=Ke;if((0,t.isString)(Ke)){const $e=Ke.trim();if($e[0]==="{"||$e[0]==="["||He==="code")try{Ke=JSON.parse(Ke),He="code"}catch{He="text"}else He="text"}else Ge=JSON.stringify(Ke,null," ");let xe=Ge;return He==="code"&&(xe=JSON.stringify(Ke,null," ")),d.createElement(L.a,{onDismiss:Xe,isOpen:!0,title:"Inspect value"},He==="code"?d.createElement(U.B,{width:"100%",height:500,language:"json",showLineNumbers:!0,showMiniMap:(xe&&xe.length)>100,value:xe,readOnly:!0}):d.createElement("pre",null,xe),d.createElement(L.a.ButtonRow,null,d.createElement(P.b,{icon:"copy",getText:()=>xe},"Copy to Clipboard")))}var B=e(88407);function H({field:Ke,cell:Xe,previewMode:He,showFilters:Ge,onCellFilterAdded:xe}){const[$e,be]=(0,d.useState)(!1),Z=q(Ke)==="flex-end",ae=!!Ke.config.custom?.inspect,de={size:"sm",tooltipPlacement:"top"},ve=(0,d.useCallback)(_e=>{xe&&xe({key:Ke.name,operator:B.mc,value:Xe.value})},[Xe,Ke,xe]),Ue=(0,d.useCallback)(_e=>{xe&&xe({key:Ke.name,operator:B.Zi,value:Xe.value})},[Xe,Ke,xe]);return d.createElement(d.Fragment,null,d.createElement("div",{className:`cellActions ${Z?"cellActionsLeft":""}`},d.createElement(O.Gy,{spacing:"xs"},ae&&d.createElement(S.K,{name:"eye",tooltip:"Inspect value",onClick:()=>{be(!0)},...de}),Ge&&d.createElement(S.K,{name:"search-plus",onClick:ve,tooltip:"Filter for value",...de}),Ge&&d.createElement(S.K,{name:"search-minus",onClick:Ue,tooltip:"Filter out value",...de}))),$e&&d.createElement(R,{mode:He,value:Xe.value,onDismiss:()=>{be(!1)}}))}const w=Ke=>{const{field:Xe,cell:He,tableStyles:Ge,row:xe,cellProps:$e,frame:be}=Ke,Z=!!Xe.config.custom?.inspect,ae=Xe.display(He.value),de=Ke.onCellFilterAdded&&Xe.config.filterable,ve=de&&He.value!==void 0||Z,Ue=Le(Xe),_e=!!(0,b.k)(Xe,xe)?.length,ze=(0,T.of)(x.Ez),[Ve,Ne]=(0,d.useState)(!1);let ot;const nt=()=>{Ne(!1)},pt=()=>{Ne(!0)};if(Ue.type===f.ob.Custom){const Pt=Ue.cellComponent;ot=d.createElement(Pt,{field:Xe,value:He.value,rowIndex:xe.index,frame:be})}else d.isValidElement(He.value)?ot=He.value:ot=(0,c.cN)(ae);const mt=typeof ot=="string",gt=N(Ge,Ue,ae,Z,mt);if(mt){let Pt=$e.style?.justifyContent;Pt==="flex-end"?$e.style={...$e.style,textAlign:"right"}:Pt==="center"&&($e.style={...$e.style,textAlign:"center"})}return d.createElement("div",{...$e,onMouseEnter:ve?pt:void 0,onMouseLeave:ve?nt:void 0,className:gt},!_e&&(mt?`${ot}`:d.createElement("div",{className:Ge.cellText},ot)),_e&&d.createElement(v.e,{links:()=>(0,b.k)(Xe,xe)||[]},Pt=>Pt.openMenu?d.createElement("button",{className:(0,y.cx)(ze,V(Ge,Ue,Pt.targetClassName)),onClick:Pt.openMenu},ot):d.createElement("div",{className:V(Ge,Ue,Pt.targetClassName)},ot)),Ve&&ve&&d.createElement(H,{...Ke,previewMode:"text",showFilters:de}))};function N(Ke,Xe,He,Ge=!1,xe=!1){const $e=Ke.theme.isDark?1:-.7;let be,Z;if(Xe.type===f.ob.ColorText)be=He.color;else if(Xe.type===f.ob.ColorBackground){const ae=Xe.mode??f.Wq.Gradient;if(ae===f.Wq.Basic)be=(0,I.mZ)(He.color,Ke.theme.isDark),Z=(0,M.A)(He.color).toRgbString();else if(ae===f.Wq.Gradient){const de=(0,M.A)(He.color).darken(10*$e).spin(5);be=(0,I.mZ)(He.color,Ke.theme.isDark),Z=`linear-gradient(120deg, ${de.toRgbString()}, ${He.color})`}}return be!==void 0||Z!==void 0?Ke.buildCellContainerStyle(be,Z,!Ge,xe):xe?Ge?Ke.cellContainerTextNoOverflow:Ke.cellContainerText:Ge?Ke.cellContainerNoOverflow:Ke.cellContainer}function V(Ke,Xe,He){return Xe.type===f.ob.Auto?(0,y.cx)(Ke.cellLink,He):(0,y.cx)(Ke.cellLinkForColoredCell,He)}var G=e(92015),_=e(64136),K=e(27430);function j(Ke){const{cell:Xe,tableStyles:He,cellProps:Ge}=Ke;let xe="";return Xe.value instanceof K.A?xe=new _.A().writeGeometry(Xe.value,{featureProjection:"EPSG:3857",dataProjection:"EPSG:4326"}):Xe.value!=null&&(xe=`${Xe.value}`),d.createElement("div",{...Ge,className:He.cellContainer},d.createElement("div",{className:He.cellText,style:{fontFamily:"monospace"}},xe))}const k=Ke=>{const{field:Xe,cell:He,tableStyles:Ge,row:xe,cellProps:$e}=Ke,be=Xe.display(He.value),Z=!!(0,b.k)(Xe,xe)?.length,ae=(0,T.of)(x.Ez);return d.createElement("div",{...$e,className:Ge.cellContainer},!Z&&d.createElement("img",{src:be.text,className:Ge.imageCell,alt:""}),Z&&d.createElement(v.e,{style:{height:"100%"},links:()=>(0,b.k)(Xe,xe)||[]},de=>{const ve=d.createElement("img",{src:be.text,className:Ge.imageCell,alt:""});return de.openMenu?d.createElement(x.$n,{className:(0,y.cx)(ae),onClick:de.openMenu},ve):ve}))};function Y(Ke){const{cell:Xe,tableStyles:He,cellProps:Ge,field:xe,row:$e}=Ke,be=!!xe.config.custom?.inspect,Z=(0,y.css)({cursor:"pointer",fontFamily:"monospace"});let ae=Xe.value,de=ae;if((0,t.isString)(ae))try{ae=JSON.parse(ae)}catch{}else de=JSON.stringify(ae,null," ");const ve=!!(0,b.k)(xe,$e)?.length,Ue=(0,T.of)(x.Ez);return d.createElement("div",{...Ge,className:be?He.cellContainerNoOverflow:He.cellContainer},d.createElement("div",{className:(0,y.cx)(He.cellText,Z)},!ve&&d.createElement("div",{className:He.cellText},de),ve&&d.createElement(v.e,{links:()=>(0,b.k)(xe,$e)||[]},_e=>_e.openMenu?d.createElement(x.$n,{className:(0,y.cx)(Ue),onClick:_e.openMenu},de):d.createElement(d.Fragment,null,de))),be&&d.createElement(H,{...Ke,previewMode:"code"}))}var ee=e(14578);function re({row:Ke,tableStyles:Xe}){return d.createElement("div",{className:Xe.expanderCell,...Ke.getToggleRowExpandedProps()},d.createElement(ee.I,{"aria-label":Ke.isExpanded?"Collapse row":"Expand row",name:Ke.isExpanded?"angle-down":"angle-right",size:"lg"}))}var J=e(30355);const ne=50;function q(Ke){if(!Ke)return"flex-start";if(Ke.config.custom)switch(Ke.config.custom.align){case"right":return"flex-end";case"left":return"flex-start";case"center":return"center"}return Ke.type===s.PU.number?"flex-end":"flex-start"}function te(Ke,Xe,He,Ge,xe,$e){const be=[];let Z=0;Ge&&(be.push({Header:()=>null,id:"expander",Cell:re,width:ne,minWidth:ne,filter:(de,ve,Ue)=>[],justifyContent:"left",field:Ke.fields[0],sortType:"basic"}),Xe-=ne);for(const[de,ve]of Ke.fields.entries()){const Ue=ve.config.custom||{};if(Ue.hidden||ve.type===s.PU.nestedFrames)continue;Ue.width?Xe-=Ue.width:Z++;const _e=Ve=>{switch(Ve){case s.PU.number:case s.PU.frame:return"number";case s.PU.time:return"basic";default:return"alphanumeric-insensitive"}},ze=oe(Ue.cellOptions?.type,ve);be.push({Cell:ze,id:de.toString(),field:ve,Header:Ue.hideHeader?"":(0,r.Ct)(ve,Ke),accessor:(Ve,Ne)=>ve.values[Ne],sortType:_e(ve.type),width:Ue.width,minWidth:Ue.minWidth??He,filter:o()(ue(ve)),justifyContent:q(ve),Footer:(0,G.d)(de,xe,$e)})}let ae=Xe/Z;for(let de=Z;de>0;de--)for(const ve of be)!ve.width&&ve.minWidth>ae&&(ve.width=ve.minWidth,Xe-=ve.width,Z-=1,ae=Xe/Z);for(const de of be)de.width||(de.width=ae),de.minWidth=50;return be}function oe(Ke,Xe){switch(Ke){case f.ob.Custom:case f.ob.ColorText:case f.ob.ColorBackground:return w;case f.ob.Image:return k;case f.ob.Gauge:return D;case f.ob.Sparkline:return J.a;case f.ob.JSONView:return Y;case f.ob.DataLinks:return C}if(Xe.type===s.PU.geo)return j;if(Xe.type===s.PU.frame){const He=Xe.values[0];return(0,g.ci)(He)&&(0,u.aH)(He)?J.a:Y}return Xe.type===s.PU.other?Y:w}function ue(Ke){return function(Xe,He,Ge){return Xe.length===0||!Ge||!Ke?Xe:Xe.filter(xe=>{if(!xe.values.hasOwnProperty(He))return!1;const $e=ge(xe,Ke);return Ge.find(be=>be.value===$e)!==void 0})}}function ie(Ke,Xe){if(!Xe||Ke.length===0)return{};const He={};for(let Ge=0;Ge<Ke.length;Ge++){const xe=ge(Ke[Ge],Xe);He[xe||"(Blanks)"]=xe}return He}function ge(Ke,Xe){if(!Xe||!Ke)return"";const He=Xe.values[Ke.index],Ge=Xe.display?Xe.display(He):He;return Xe.display?(0,c.cN)(Ge):Ge}function he(Ke){return Object.keys(Ke).reduce((Xe,He)=>Xe.concat({value:Ke[He],label:He}),[]).sort(De)}function De(Ke,Xe){return Ke.label===void 0&&Xe.label===void 0?0:Ke.label===void 0&&Xe.label!==void 0?-1:Ke.label!==void 0&&Xe.label===void 0?1:Ke.label<Xe.label?-1:Ke.label>Xe.label?1:0}function pe(Ke,Xe){return Xe?Ke.filter(He=>Xe.some(Ge=>Ge.value===He.value)):[]}function le(Ke,Xe,He){return String(Ke.values[He]).localeCompare(String(Xe.values[He]),void 0,{sensitivity:"base"})}function Te(Ke,Xe,He){const Ge=Ee(Ke.values[He]),xe=Ee(Xe.values[He]);return Ge===xe?0:Ge>xe?1:-1}function Ee(Ke){return(0,g.LI)(Ke)?Ke.value??Number.NEGATIVE_INFINITY:Ke==null||Ke===""||isNaN(Ke)?Number.NEGATIVE_INFINITY:typeof Ke=="number"?Ke:Number(Ke)}function Re(Ke,Xe,He,Ge){return Be(Ke),Ke.map((xe,$e)=>{if(xe?.field?.type!==s.PU.number)return $e===0&&He.reducer&&He.reducer.length>0?i.AS.get(He.reducer[0]).name:void 0;let be=(0,t.clone)(xe.field);return be.values=Xe[xe.id],be.state=void 0,xe.field=be,He.fields&&He.fields.length>0?He.fields.find(ae=>ae===xe?.field?.name)?me(xe.field,He.reducer,Ge):void 0:me(xe.field,He.reducer||[],Ge)})}function me(Ke,Xe,He){const Ge=Ke.display??(0,l.J)({field:Ke,theme:He}),xe=Xe[0],$e=(0,i.Nw)({field:Ke,reducers:Xe})[xe];return(0,c.cN)(Ge($e))}function Me(Ke){const Xe=[];for(const He in Ke)for(const[Ge,xe]of Object.entries(Ke[He].values))Xe[Ge]===void 0&&(Xe[Ge]=[]),Xe[Ge].push(xe);return Xe}const ye={type:f.ob.Auto};function Le(Ke){return Ke.config.custom?.displayMode?We(Ke.config.custom?.displayMode):Ke.config.custom?.cellOptions?Ke.config.custom.cellOptions:ye}function We(Ke){switch(Ke){case"basic":case"gradient-gauge":case"lcd-gauge":let Xe=f.eX.Basic;return Ke==="gradient-gauge"?Xe=f.eX.Gradient:Ke==="lcd-gauge"&&(Xe=f.eX.Lcd),{type:f.ob.Gauge,mode:Xe};case"color-background":case"color-background-solid":let He=f.Wq.Basic;return Ke==="color-background"&&(He=f.Wq.Gradient),{type:f.ob.ColorBackground,mode:He};default:return{type:Ke}}}function Be(Ke){const Xe=Ke.findIndex((He,Ge)=>He?.id!==String(Ge));Xe===-1||Ke[Xe]?.id==="expander"||(Ke.splice(Xe,0,{id:String(Xe)}),Be(Ke))}function Ye(Ke,Xe,He){let Ge=Ke.state?.alignmentFactors;if(Ge)return Ge.text.length<Xe.text.length&&(Ge.text=Xe.text),Ge;{Ge={...Xe};const xe=Math.min(Ke.values.length,He+1e3);for(let $e=He+1;$e<xe;$e++)Ke.display(Ke.values[$e]).text.length>Ge.text.length&&(Ge.text=Xe.text);return Ke.state?Ke.state.alignmentFactors=Ge:Ke.state={alignmentFactors:Ge},Ge}}function at(Ke,Xe,He){return Math.abs(Math.floor(Ke)-Xe)<He}function st(Ke){let Xe=-Number.MAX_VALUE,He=Number.MAX_VALUE;if(Ke.values.length<2)return 0;for(let Ge=0;Ge<Ke.values.length;Ge++){const xe=Ke.values[Ge];xe>Xe&&(Xe=xe),xe<He&&(He=xe)}return(Xe-He)/Ke.values.length}},14746:(Q,A,e)=>{"use strict";e.d(A,{b:()=>f});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(72436),g=e(40845),u=e(3911),c=e(14578),i=e(21744);class l extends s.PureComponent{constructor(p){super(p),this.readCSV=(0,n.debounce)(()=>{const{config:v}=this.props,{text:E}=this.state;this.setState({data:(0,r.Jh)(E,{config:v})})},150),this.onTextChange=v=>{this.setState({text:v.target.value})};const{text:m,config:a}=p;this.state={text:m,data:(0,r.Jh)(m,{config:a})}}componentDidUpdate(p,m){const{text:a}=this.state;(a!==m.text||this.props.config!==p.config)&&this.readCSV(),this.props.text!==p.text&&this.props.text!==a&&this.setState({text:this.props.text}),this.state.data!==m.data&&this.props.onSeriesParsed(this.state.data,this.state.text)}render(){const{width:p,height:m,theme:a}=this.props,{data:v}=this.state,E=d(a);return s.createElement("div",{className:E.tableInputCsv},s.createElement(i.f,{style:{width:p,height:m},placeholder:"Enter CSV here...",value:this.state.text,onChange:this.onTextChange,className:E.textarea}),v&&s.createElement("footer",{className:E.footer},v.map((D,b)=>s.createElement("span",{key:b},"Rows:",D.length,", Columns:",D.fields.length," \xA0",s.createElement(c.I,{name:"check-circle"})))))}}const f=(0,g.cV)(l);f.displayName="TableInputCSV";const d=(0,u.N)(h=>({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:h.colors.success.main,padding:`1px ${h.spacing(.5)}`,fontSize:"80%"})}))},53402:(Q,A,e)=>{"use strict";e.d(A,{p:()=>r});var t=e(32196),n=e(96540),o=e(83195),s=e(40845);const r=({value:u})=>{const c=(0,s.of)(g);return n.createElement("span",{className:c.counter},(0,o.Hg)(u,0).text)},g=u=>({counter:(0,t.css)({label:"counter",marginLeft:u.spacing(1),borderRadius:u.spacing(3),backgroundColor:u.colors.action.hover,padding:u.spacing(.25,1),color:u.colors.text.secondary,fontWeight:u.typography.fontWeightMedium,fontSize:u.typography.size.sm})})},40675:(Q,A,e)=>{"use strict";e.d(A,{o:()=>i});var t=e(32196),n=e(96540),o=e(13544),s=e(40845),r=e(16797),g=e(55852),u=e(14578),c=e(53402);const i=n.forwardRef(({label:f,active:d,icon:h,onChangeTab:p,counter:m,suffix:a,className:v,href:E,...D},b)=>{const C=(0,s.of)(l),y=(0,s.of)(g.my),M=()=>n.createElement(n.Fragment,null,h&&n.createElement(u.I,{name:h}),f,typeof m=="number"&&n.createElement(c.p,{value:m}),a&&n.createElement(a,{className:C.suffix})),I={className:(0,t.cx)(y,C.link,d?C.activeStyle:C.notActive),...D,onClick:p,"aria-label":D["aria-label"]||o.Tp.components.Tab.title(f),role:"tab","aria-selected":d};return E?n.createElement("div",{className:C.item},n.createElement("a",{...I,href:E,ref:b},M())):n.createElement("div",{className:C.item},n.createElement("button",{...I,type:"button",ref:b},M()))});i.displayName="Tab";const l=f=>({item:(0,t.css)({listStyle:"none",position:"relative",display:"flex",whiteSpace:"nowrap",padding:f.spacing(.5)}),link:(0,t.css)({color:f.colors.text.secondary,padding:f.spacing(1,1.5,.5),borderRadius:f.shape.radius.default,display:"block",height:"100%",svg:{marginRight:f.spacing(1)},"&:focus-visible":(0,r.getFocusStyles)(f),"&::before":{display:"block",content:'" "',position:"absolute",left:0,right:0,height:"4px",borderRadius:f.shape.radius.default,bottom:0}}),notActive:(0,t.css)({"a:hover, &:hover, &:focus":{color:f.colors.text.primary,"&::before":{backgroundColor:f.colors.action.hover}}}),activeStyle:(0,t.css)({label:"activeTabStyle",color:f.colors.text.primary,overflow:"hidden","&::before":{backgroundImage:f.colors.gradients.brandHorizontal}}),suffix:(0,t.css)({marginLeft:f.spacing(1)})})},40980:(Q,A,e)=>{"use strict";e.d(A,{J:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({children:g,className:u,...c})=>{const i=(0,o.of)(r);return n.createElement("div",{...c,className:(0,t.cx)(i.tabContent,u)},g)},r=g=>({tabContent:(0,t.css)({background:g.colors.background.primary})})},63021:(Q,A,e)=>{"use strict";e.d(A,{U:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=n.forwardRef(({children:g,className:u,hideBorder:c=!1},i)=>{const l=(0,o.of)(r);return n.createElement("div",{className:(0,t.cx)(l.tabsWrapper,c&&l.noBorder,u),ref:i},n.createElement("div",{className:l.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`,alignItems:"center"})});s.displayName="TabsBar"},90685:(Q,A,e)=>{"use strict";e.d(A,{s:()=>u});var t=e(32196),n=e(96540),o=e(13544),s=e(40845),r=e(14578),g=e(53402);const u=n.forwardRef(({label:i,active:l,icon:f,counter:d,className:h,suffix:p,onChangeTab:m,href:a,...v},E)=>{const D=(0,s.of)(c),b=()=>n.createElement(n.Fragment,null,f&&n.createElement(r.I,{name:f}),i,typeof d=="number"&&n.createElement(g.p,{value:d}),p&&n.createElement(p,{className:D.suffix})),C=(0,t.cx)(D.link,l&&D.activeStyle);return n.createElement("a",{href:a,className:C,...v,onClick:m,"aria-label":v["aria-label"]||o.Tp.components.Tab.title(i),role:"tab","aria-selected":l,ref:E},b())});u.displayName="Tab";const c=i=>({link:(0,t.css)({padding:"6px 12px",display:"block",height:"100%",cursor:"pointer",position:"relative",color:i.colors.text.primary,svg:{marginRight:i.spacing(1)},"&:hover, &:focus":{textDecoration:"underline"}}),activeStyle:(0,t.css)({label:"activeTabStyle",color:i.colors.text.maxContrast,overflow:"hidden","&::before":{display:"block",content:'" "',position:"absolute",left:0,width:"4px",bottom:"2px",top:"2px",borderRadius:i.shape.radius.default,backgroundImage:"linear-gradient(0deg, #f05a28 30%, #fbca0a 99%)"}}),suffix:(0,t.css)({marginLeft:i.spacing(1)})})},78369:(Q,A,e)=>{"use strict";e.d(A,{v:()=>l});var t=e(32196),n=e(96540),o=e(70255),s=e(40845),r=e(69613),g=e(72129),u=e(14578);const c=(0,n.forwardRef)(({name:h,onClick:p,icon:m,className:a,colorIndex:v,...E},D)=>{const b=(0,s.$j)(),C=d(b,h,v),y=T=>{T.preventDefault(),T.stopPropagation(),p?.(h,T)},M=(0,t.cx)(C.wrapper,a,{[C.hover]:p!==void 0});return p?n.createElement("button",{...E,className:M,onClick:y,ref:D},m&&n.createElement(u.I,{name:m}),h):n.createElement("span",{...E,className:M,ref:D},m&&n.createElement(u.I,{name:m}),h)});c.displayName="Tag";const i=({rootProps:h})=>{const p=(0,s.of)(f);return n.createElement(o.A,{width:60,height:22,containerClassName:p.container,...h})},l=(0,g.j)(c,i),f=()=>({container:(0,t.css)({lineHeight:1})}),d=(h,p,m)=>{let a;return m===void 0?a=(0,r.MC)(p):a=(0,r.yC)(m),{wrapper:(0,t.css)({appearance:"none",borderStyle:"none",fontWeight:h.typography.fontWeightMedium,fontSize:h.typography.size.sm,lineHeight:h.typography.bodySmall.lineHeight,verticalAlign:"baseline",backgroundColor:a.color,color:h.v1.palette.gray98,whiteSpace:"nowrap",textShadow:"none",padding:"3px 6px",borderRadius:h.shape.radius.default}),hover:(0,t.css)({"&:hover":{opacity:.85,cursor:"pointer"}})}}},64149:(Q,A,e)=>{"use strict";e.d(A,{L:()=>c});var t=e(32196),n=e(96540),o=e(40845),s=e(72129),r=e(78369);const g=(0,n.memo)((0,n.forwardRef)(({displayMax:f,tags:d,icon:h,onClick:p,className:m,getAriaLabel:a,getColorIndex:v},E)=>{const D=(0,o.$j)(),b=l(D,!!(f&&f>0)),C=d.length,y=f?d.slice(0,f):d;return n.createElement("ul",{className:(0,t.cx)(b.wrapper,m),"aria-label":"Tags",ref:E},y.map((M,T)=>n.createElement("li",{className:b.li,key:M},n.createElement(r.v,{name:M,icon:h,onClick:p,"aria-label":a?.(M,T),"data-tag-id":T,colorIndex:v?.(M,T)}))),f&&f>0&&C-f>0&&n.createElement("span",{className:b.moreTagsLabel},"+ ",C-f))}));g.displayName="TagList";const u=({rootProps:f})=>{const d=(0,o.of)(i);return n.createElement("div",{className:d.container,...f},n.createElement(r.v.Skeleton,null),n.createElement(r.v.Skeleton,null))},c=(0,s.j)(g,u),i=f=>({container:(0,t.css)({display:"flex",gap:f.spacing(1)})}),l=(f,d)=>({wrapper:(0,t.css)({position:"relative",alignItems:d?"center":"unset",display:"flex",flex:"1 1 auto",flexWrap:"wrap",flexShrink:d?0:1,justifyContent:"flex-end",gap:"6px"}),moreTagsLabel:(0,t.css)({color:f.colors.text.secondary,fontSize:f.typography.size.sm}),li:(0,t.css)({listStyle:"none"})})},79924:(Q,A,e)=>{"use strict";e.d(A,{u:()=>l});var t=e(32196),n=e(96540),o=e(40845),s=e(55852),r=e(10354),g=e(69613),u=e(29158);const c=({name:d,disabled:h,onRemove:p})=>{const{color:m,borderColor:a}=(0,n.useMemo)(()=>(0,g.MC)(d),[d]),v=(0,o.of)(i);return n.createElement("li",{className:v.itemStyle,style:{backgroundColor:m,borderColor:a}},n.createElement("span",{className:v.nameStyle},d),n.createElement(u.K,{name:"times",size:"lg",disabled:h,tooltip:`Remove "${d}" tag`,onClick:()=>p(d),className:v.buttonStyles}))},i=d=>{const h=d.spacing.gridSize*3;return{itemStyle:(0,t.css)({display:"flex",gap:"3px",alignItems:"center",height:`${h}px`,lineHeight:`${h-2}px`,color:"#fff",borderWidth:"1px",borderStyle:"solid",borderRadius:d.shape.radius.default,padding:`0 ${d.spacing(.5)}`,whiteSpace:"nowrap",textShadow:"none",fontWeight:500,fontSize:d.typography.size.sm}),nameStyle:(0,t.css)({maxWidth:"25ch",textOverflow:"ellipsis",overflow:"hidden"}),buttonStyles:(0,t.css)({margin:0,"&:hover::before":{display:"none"}})}},l=({placeholder:d="New tag (enter key to add)",tags:h=[],onChange:p,width:m,className:a,disabled:v,addOnBlur:E,invalid:D,id:b})=>{const[C,y]=(0,n.useState)(""),M=(0,o.of)(f),T=(0,o.$j)(),I=(0,n.useCallback)(L=>{y(L.target.value)},[]),x=L=>{p(h.filter(U=>U!==L))},S=L=>{L?.preventDefault(),h.includes(C)||p(h.concat(C)),y("")},O=()=>{E&&C&&S()},P=L=>{L.key==="Enter"&&C!==""&&S(L)};return n.createElement("div",{className:(0,t.cx)(M.wrapper,a,m?(0,t.css)({width:T.spacing(m)}):"")},n.createElement(r.p,{id:b,disabled:v,placeholder:d,onChange:I,value:C,onKeyDown:P,onBlur:O,invalid:D,suffix:n.createElement(s.$n,{fill:"text",className:M.addButtonStyle,onClick:S,size:"md",disabled:C.length<=0},"Add")}),h?.length>0&&n.createElement("ul",{className:M.tags},h.map(L=>n.createElement(c,{key:L,name:L,onRemove:x,disabled:v}))))},f=d=>({wrapper:(0,t.css)({minHeight:d.spacing(4),display:"flex",flexDirection:"column",gap:d.spacing(1),flexWrap:"wrap"}),tags:(0,t.css)({display:"flex",justifyContent:"flex-start",flexWrap:"wrap",gap:d.spacing(.5)}),addButtonStyle:(0,t.css)({margin:`0 -${d.spacing(1)}`})})},94753:(Q,A,e)=>{"use strict";e.d(A,{E:()=>c});var t=e(32196),n=e(96540),o=e(40845),s=e(65848),r=e(56034);const g=n.forwardRef(({childElement:l,children:f},d)=>{const[h,p]=(0,n.useState)(!1),m=(0,n.useRef)(null);(0,n.useImperativeHandle)(d,()=>m.current);const a=(0,n.useMemo)(()=>new ResizeObserver(E=>{for(const D of E)D.target.clientWidth&&D.target.scrollWidth&&(D.target.scrollWidth>D.target.clientWidth&&p(!0),D.target.scrollWidth<=D.target.clientWidth&&p(!1))}),[]);(0,n.useEffect)(()=>{const{current:E}=m;return E&&a.observe(E),()=>{a.disconnect()}},[p,a]);const v=E=>typeof E=="string"?E:s.renderToStaticMarkup(n.createElement(n.Fragment,null,E)).replace(/(<([^>]+)>)/gi,"");return h?n.createElement(r.m,{ref:m,content:v(f)},l(void 0)):l(m)});g.displayName="TruncatedText";var u=e(71356);const c=n.forwardRef(({element:l="span",variant:f,weight:d,color:h,truncate:p,italic:m,textAlignment:a,children:v,...E},D)=>{const b=(0,o.of)(i,l,f,h,d,p,m,a),C=y=>(0,n.createElement)(l,{...E,style:void 0,className:b,ref:y},v);return!p||l==="span"?C(void 0):n.createElement(g,{childElement:C,children:v,ref:D})});c.displayName="Text";const i=(l,f,d,h,p,m,a,v)=>(0,t.css)([{margin:0,padding:0,...(0,u.d$)(l,f,d)},d&&{...l.typography[d]},h&&{color:(0,u.vT)(h,l)},p&&{fontWeight:(0,u.iV)(p,l)},m&&{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},a&&{fontStyle:"italic"},v&&{textAlign:v}])},71356:(Q,A,e)=>{"use strict";e.d(A,{d$:()=>o,iV:()=>t,vT:()=>n});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}},o=(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}}},21744:(Q,A,e)=>{"use strict";e.d(A,{f:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(87266);const r=n.forwardRef(({invalid:u,className:c,...i},l)=>{const f=(0,o.of)(g,u);return n.createElement("textarea",{...i,className:(0,t.cx)(f.textarea,c),ref:l})}),g=(u,c=!1)=>({textarea:(0,t.cx)((0,s.Xb)(u),(0,s.gm)(u),(0,t.css)({display:"block",borderRadius:u.shape.radius.default,padding:`${u.spacing.gridSize/4}px ${u.spacing.gridSize}px`,width:"100%",borderColor:c?u.colors.error.border:u.components.input.borderColor}))});r.displayName="TextArea"},60782:(Q,A,e)=>{"use strict";e.d(A,{G:()=>l});var t=e(32196),n=e(95361),o=e(18491),s=e(34743),r=e(36376),g=e(96540),u=e(40845),c=e(18976),i=e(29158);const l=g.memo(({children:d,theme:h="info",placement:p="auto",content:m,title:a,closeButton:v=!0,onClose:E,footer:D,fitContent:b=!1,onOpen:C,show:y})=>{const M=(0,g.useRef)(null),T=(0,u.$j)(),I=(0,u.of)(f),x=I[h],[S,O]=(0,g.useState)(y),P=y??S,L=[(0,n.cY)(8),(0,o.UU)({fallbackAxisSideDirection:"end",crossAxis:!1,boundary:document.body}),(0,o.BN)(),(0,s.UE)({element:M})],{context:U,refs:R,floatingStyles:B}=(0,r.we)({open:P,placement:(0,c.O)(p),onOpenChange:G=>{y===void 0&&O(G),G?C?.():E?.()},middleware:L,whileElementsMounted:o.ll,strategy:"fixed"}),H=(0,r.kp)(U),w=(0,r.s9)(U),{getReferenceProps:N,getFloatingProps:V}=(0,r.bv)([w,H]);return g.createElement(g.Fragment,null,g.cloneElement(d,{ref:R.setReference,tabIndex:0,"aria-expanded":P,...N()}),P&&g.createElement(r.s3,{context:U,modal:!1,closeOnFocusOut:!1},g.createElement("div",{"data-testid":"toggletip-content",className:(0,t.cx)(x.container,{[I.fitContent]:b}),ref:R.setFloating,style:B,...V()},g.createElement(r.ie,{strokeWidth:.3,stroke:T.colors.border.weak,className:x.arrow,ref:M,context:U}),!!a&&g.createElement("div",{className:x.header},a),v&&g.createElement("div",{className:x.headerClose},g.createElement(i.K,{"aria-label":"Close",name:"times","data-testid":"toggletip-header-close",onClick:()=>{O(!1),E?.()}})),g.createElement("div",{className:x.body},(typeof m=="string"||g.isValidElement(m))&&m,typeof m=="function"&&m({})),!!D&&g.createElement("div",{className:x.footer},D))))});l.displayName="Toggletip";const f=d=>{const h=(0,c.f)(d,d.colors.background.primary,d.colors.border.weak,d.components.tooltip.text,{topBottom:2,rightLeft:2}),p=(0,c.f)(d,d.colors.error.main,d.colors.error.main,d.colors.error.contrastText,{topBottom:2,rightLeft:2});return{info:h,error:p,fitContent:(0,t.css)({maxWidth:"fit-content"})}}},27746:(Q,A,e)=>{"use strict";e.d(A,{I:()=>l});var t=e(32196),n=e(96540),o=e(8887),s=e(13544),r=e(40845),g=e(16797),u=e(55852),c=e(14578),i=e(56034);const l=(0,n.forwardRef)(({tooltip:p,icon:m,iconSize:a,className:v,children:E,imgSrc:D,imgAlt:b,fullWidth:C,isOpen:y,narrow:M,variant:T="default",iconOnly:I,"aria-label":x,isHighlighted:S,...O},P)=>{const L=(0,r.of)(h),U=(0,t.cx)({[L.button]:!0,[L.buttonFullWidth]:C,[L.narrow]:M},L[T],v),R=(0,t.cx)({[L.content]:!0,[L.contentWithIcon]:!!m,[L.contentWithRightIcon]:y!==void 0}),B=n.createElement("button",{ref:P,className:U,"aria-label":f(x,p),"aria-expanded":y,...O},d(m,a),D&&n.createElement("img",{className:L.img,src:D,alt:b??""}),E&&!I&&n.createElement("div",{className:R},E),y===!1&&n.createElement(c.I,{name:"angle-down"}),y===!0&&n.createElement(c.I,{name:"angle-up"}),S&&n.createElement("div",{className:L.highlight}));return p?n.createElement(i.m,{ref:P,content:p,placement:"bottom"},B):B});l.displayName="ToolbarButton";function f(p,m){return p||(m?s.Tp.components.PageToolbar.item(m):void 0)}function d(p,m){return p?(0,o.n6)(p)?n.createElement(c.I,{name:p,size:`${m||"lg"}`}):p:null}const h=p=>{const m=(0,u.U_)(p,"primary","solid"),a=(0,u.U_)(p,"destructive","solid"),v=(0,t.css)({color:p.colors.text.primary,background:p.colors.secondary.main,"&:hover":{color:p.colors.text.primary,background:p.colors.secondary.shade,border:`1px solid ${p.colors.border.medium}`}});return{button:(0,t.css)({label:"toolbar-button",position:"relative",display:"flex",alignItems:"center",height:p.spacing(p.components.height.md),padding:p.spacing(0,1),borderRadius:p.shape.radius.default,lineHeight:`${p.components.height.md*p.spacing.gridSize-2}px`,fontWeight:p.typography.fontWeightMedium,border:`1px solid ${p.colors.secondary.border}`,whiteSpace:"nowrap",transition:p.transitions.create(["background","box-shadow","border-color","color"],{duration:p.transitions.duration.short}),"&:focus, &:focus-visible":{...(0,g.getFocusStyles)(p),zIndex:1},"&:focus:not(:focus-visible)":(0,g.getMouseFocusStyles)(p),"&:hover":{boxShadow:p.shadows.z1},"&[disabled], &:disabled":{cursor:"not-allowed",opacity:p.colors.action.disabledOpacity,background:p.colors.action.disabledBackground,boxShadow:"none","&:hover":{color:p.colors.text.disabled,background:p.colors.action.disabledBackground,boxShadow:"none"}}}),default:(0,t.css)({color:p.colors.text.secondary,background:"transparent",border:"1px solid transparent","&:hover":{color:p.colors.text.primary,background:p.colors.background.secondary}}),canvas:v,active:(0,t.cx)(v,(0,t.css)({"&::before":{display:"block",content:'" "',position:"absolute",left:0,right:0,height:"2px",bottom:0,borderRadius:p.shape.radius.default,backgroundImage:p.colors.gradients.brandHorizontal}})),primary:(0,t.css)(m),destructive:(0,t.css)(a),narrow:(0,t.css)({padding:p.spacing(0,.5)}),img:(0,t.css)({width:"16px",height:"16px",marginRight:p.spacing(1)}),buttonFullWidth:(0,t.css)({flexGrow:1}),content:(0,t.css)({flexGrow:1}),contentWithIcon:(0,t.css)({display:"none",paddingLeft:p.spacing(1),[`@media ${g.mediaUp(p.v1.breakpoints.md)}`]:{display:"block"}}),contentWithRightIcon:(0,t.css)({paddingRight:p.spacing(.5)}),highlight:(0,t.css)({backgroundColor:p.colors.success.main,borderRadius:p.shape.radius.circle,width:"6px",height:"6px",position:"absolute",top:"-3px",right:"-3px",zIndex:1})}}},15068:(Q,A,e)=>{"use strict";e.d(A,{U:()=>i});var t=e(32196),n=e(80279),o=e(7887),s=e(82148),r=e(96540),g=e(40845),u=e(17464),c=e(27746);const i=(0,r.forwardRef)(({alignment:f="left",className:d,children:h,...p},m)=>{const a=r.Children.toArray(h).filter(P=>P!=null),[v,E]=(0,r.useState)(Array(a.length).fill(!1)),D=(0,r.useRef)(null),[b,C]=(0,r.useState)(!1),y=(0,r.useRef)(null),M=(0,r.createRef)(),{overlayProps:T}=(0,s.e)({onClose:()=>C(!1),isDismissable:!0,isOpen:b,shouldCloseOnInteractOutside:P=>{const L=(0,u.gF)();return!y.current?.contains(P)&&!L.contains(P)}},M),{dialogProps:I}=(0,n.s)({},M),x=(0,g.$j)(),S=f==="left"?v.indexOf(!1)-1:v.length,O=l(x,S,f);return(0,r.useLayoutEffect)(()=>{const P=new IntersectionObserver(L=>{L.forEach(U=>{if(U.target instanceof HTMLElement&&U.target.parentNode){const R=Array.prototype.indexOf.call(U.target.parentNode.children,U.target);E(B=>{const H=[...B];return H[R]=U.isIntersecting,H})}})},{threshold:1,root:D.current});return D.current&&Array.from(D.current.children).forEach(L=>{L instanceof HTMLElement&&L!==y.current&&P.observe(L)}),()=>P.disconnect()},[h]),r.createElement("div",{ref:D,className:(0,t.cx)(O.container,d),...p},a.map((P,L)=>r.createElement("div",{key:L,style:{order:L,visibility:v[L]?"visible":"hidden"},className:O.childWrapper},P)),v.includes(!1)&&r.createElement("div",{ref:y,className:O.overflowButton},r.createElement(c.I,{variant:b?"active":"default",tooltip:"Show more items",onClick:()=>C(!b),icon:"ellipsis-v",iconOnly:!0,narrow:!0}),b&&r.createElement(o.n1,{contain:!0,autoFocus:!0},r.createElement("div",{className:O.overflowItems,ref:M,...T,...I},a.map((P,L)=>!v[L]&&P)))))});i.displayName="ToolbarButtonRow";const l=(f,d,h)=>({overflowButton:(0,t.css)({order:d}),overflowItems:(0,t.css)({alignItems:"center",backgroundColor:f.colors.background.primary,borderRadius:f.shape.radius.default,boxShadow:f.shadows.z2,display:"flex",flexWrap:"wrap",gap:f.spacing(1),marginTop:f.spacing(1),maxWidth:"80vw",padding:f.spacing(.5,1),position:"absolute",right:0,top:"100%",width:"max-content",zIndex:f.zIndex.dropdown}),container:(0,t.css)({alignItems:"center",display:"flex",gap:f.spacing(1),justifyContent:h==="left"?"flex-start":"flex-end",minWidth:0,position:"relative"}),childWrapper:(0,t.css)({alignItems:"center",display:"flex",gap:f.spacing(1)})})},13840:(Q,A,e)=>{"use strict";e.d(A,{A:()=>c});var t=e(96540),n=e(16802),o=e(69703),s=e(22669),r=e(17464);const g={transitionProperty:"opacity",transitionDuration:"200ms",transitionTimingFunction:"linear",opacity:0},u={exited:{opacity:0},entering:{opacity:0},entered:{opacity:1,transitionDelay:"0s"},exiting:{opacity:0,transitionDelay:"500ms"}};class c extends t.PureComponent{render(){const{content:l,show:f,placement:d,className:h,wrapperClassName:p,renderArrow:m,referenceElement:a,...v}=this.props;return t.createElement(n.mS,null,t.createElement(s.Ay,{in:f,timeout:100,mountOnEnter:!0,unmountOnExit:!0},E=>t.createElement(r.ZL,null,t.createElement(o.N,{placement:d,referenceElement:a,modifiers:[{name:"preventOverflow",enabled:!0,options:{rootBoundary:"viewport"}},{name:"eventListeners",options:{scroll:!0,resize:!0}}]},({ref:D,style:b,placement:C,arrowProps:y,update:M})=>t.createElement("div",{ref:D,style:{...b,...g,...u[E]},"data-placement":C,className:`${p}`,...v},t.createElement("div",{className:h},typeof l=="string"&&l,t.isValidElement(l)&&t.cloneElement(l),typeof l=="function"&&l({updatePopperPosition:M}),m&&m({arrowProps:y,placement:C})))))))}}},95868:(Q,A,e)=>{"use strict";e.d(A,{I:()=>n});var t=e(96540);class n extends t.Component{constructor(){super(...arguments),this.hideTimeout=null,this.state={show:!1},this.showPopper=()=>{this.hideTimeout&&clearTimeout(this.hideTimeout),this.setState({show:!0})},this.hidePopper=()=>{this.hideTimeout=setTimeout(()=>{this.setState({show:!1})},this.props.hideAfter)}}render(){const{children:s,content:r,placement:g="auto"}=this.props,{show:u}=this.state;return s(this.showPopper,this.hidePopper,{show:u,placement:g,content:r})}}},56034:(Q,A,e)=>{"use strict";e.d(A,{m:()=>l});var t=e(95361),n=e(18491),o=e(34743),s=e(36376),r=e(96540),g=e(13544),u=e(40845),c=e(18976),i=e(17464);const l=r.forwardRef(({children:d,theme:h,interactive:p,show:m,placement:a,content:v},E)=>{const D=(0,r.useRef)(null),[b,C]=(0,r.useState)(m),y=m??b,M=[(0,t.cY)(8),(0,n.UU)({fallbackAxisSideDirection:"end",crossAxis:!1,boundary:document.body}),(0,n.BN)(),(0,o.UE)({element:D})],{context:T,refs:I,floatingStyles:x}=(0,s.we)({open:y,placement:(0,c.O)(a),onOpenChange:C,middleware:M,whileElementsMounted:n.ll}),S=(0,r.useId)(),O=(0,s.Mk)(T,{delay:{close:p?100:0},move:!1}),P=(0,s.iQ)(T),L=(0,s.s9)(T),{getReferenceProps:U,getFloatingProps:R}=(0,s.bv)([L,O,P]),B=typeof v=="function",w=(0,u.of)(f)[h??"info"],N=(0,r.useCallback)(G=>{I.setReference(G),typeof E=="function"?E(G):E&&(E.current=G)},[E,I]),V="aria-label"in d.props&&d.props["aria-label"]===v;return r.createElement(r.Fragment,null,r.cloneElement(d,{ref:N,tabIndex:0,"aria-describedby":!V&&y?S:void 0,...U()}),y&&r.createElement(i.ZL,null,r.createElement("div",{ref:I.setFloating,style:x,...R()},r.createElement(s.ie,{className:w.arrow,ref:D,context:T}),r.createElement("div",{"data-testid":g.Tp.components.Tooltip.container,id:S,role:"tooltip",className:w.container},typeof v=="string"&&v,r.isValidElement(v)&&r.cloneElement(v),B&&v({})))))});l.displayName="Tooltip";const f=d=>{const h=(0,c.f)(d,d.components.tooltip.background,d.components.tooltip.background,d.components.tooltip.text,{topBottom:.5,rightLeft:1}),p=(0,c.f)(d,d.colors.error.main,d.colors.error.main,d.colors.error.contrastText,{topBottom:.5,rightLeft:1});return{info:h,["info-alt"]:h,error:p}}},5313:(Q,A,e)=>{"use strict";e.d(A,{z:()=>o});var t=e(96540);function n(s,r){const g=[];return s.forEach(u=>{g.push(u.start,u.end+1)}),g[0]!==0&&g.unshift(0),g[g.length-1]!==r&&g.push(r),g}const o=s=>{let{highlightParts:r,text:g,highlightClassName:u}=s;if(!r?.length)return null;let c=[],i=n(r,g.length),l=r[0].start===0;for(let f=1;f<i.length;f++){let d=i[f-1],h=i[f];c.push((0,t.createElement)(l?"mark":"span",{key:f-1,className:l?u:void 0},g.substring(d,h))),l=!l}return t.createElement("div",null,c)}},2056:(Q,A,e)=>{"use strict";e.d(A,{p:()=>r});var t=e(96540),n=e(83195),o=e(3988);function s(g){return`Custom unit: ${g}`}class r extends t.PureComponent{constructor(){super(...arguments),this.onChange=u=>{this.props.onChange(u.value)}}render(){const{value:u,width:c}=this.props;let i;const f=(0,n.Ke)().map(d=>{const h=d.submenu.map(p=>{const m={label:p.text,value:p.value};return p.value===u&&(i=m),m});return{label:d.text,value:d.text,items:h}});return u&&!i&&(i={value:u,label:u}),t.createElement(o.v,{width:c,initialValue:i&&i.label,allowCustomValue:!0,changeOnSelect:!1,formatCreateLabel:s,options:f,placeholder:"Choose",onSelect:this.props.onChange})}}},12942:(Q,A,e)=>{"use strict";e.d(A,{e:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(16795);const r=({src:u,alt:c,width:i,height:l})=>{const f=(0,o.of)(g,i,l);return n.createElement("img",{className:f.image,src:u,alt:c})},g=(u,c=3,i=3)=>({image:(0,t.css)([(0,s.Y)(u,c,l=>({width:u.spacing(l)})),(0,s.Y)(u,i,l=>({height:u.spacing(l)})),{borderRadius:u.shape.radius.circle}])})},99635:(Q,A,e)=>{"use strict";e.d(A,{n:()=>c});var t=e(32196),n=e(96540),o=e(47232),s=e(40845),r=e(56034);const g=f=>{const h=(0,o.KQ)(f).diff((0,o.KQ)(),"hours",!1);return`Active last ${(Math.floor(-h/24)+1)*24}h`},u=f=>{if(!f)return"";const[d,h]=f.split(" ");return`${d?.[0]??""}${h?.[0]??""}`.toUpperCase()},c=({userView:f,className:d,children:h,onClick:p,showTooltip:m=!0})=>{const{user:a,lastActiveAt:v}=f,E=(0,o.KQ)(v).diff((0,o.KQ)(),"minutes",!0)>=-15,D=(0,s.$j)(),b=(0,n.useMemo)(()=>l(D,E),[D,E]),C=n.createElement("button",{type:"button",onClick:p,className:(0,t.cx)(b.container,p&&b.pointer,d),"aria-label":`${a.name} icon`},h?n.createElement("div",{className:(0,t.cx)(b.content,b.textContent)},h):a.avatarUrl?n.createElement("img",{className:b.content,src:a.avatarUrl,alt:`${a.name} avatar`}):n.createElement("div",{className:(0,t.cx)(b.content,b.textContent)},u(a.name)));if(m){const y=n.createElement("div",{className:b.tooltipContainer},n.createElement("div",{className:b.tooltipName},a.name),n.createElement("div",{className:b.tooltipDate},E?n.createElement("div",{className:b.dotContainer},n.createElement("span",null,"Active last 15m"),n.createElement("span",{className:b.dot})):g(v)));return n.createElement(r.m,{content:y},C)}else return C},i=f=>`0 0 0 1px ${f}`,l=(f,d)=>{const h=d?f.colors.primary.main:f.colors.border.medium,p=d?f.colors.primary.text:f.colors.border.strong;return{container:(0,t.css)({padding:0,width:"30px",height:"30px",background:"none",border:"none",borderRadius:f.shape.radius.circle,"& > *":{borderRadius:f.shape.radius.circle}}),content:(0,t.css)({lineHeight:"24px",maxWidth:"100%",border:`3px ${f.colors.background.primary} solid`,boxShadow:i(h),backgroundClip:"padding-box","&:hover":{boxShadow:i(p)}}),textContent:(0,t.css)({background:f.colors.background.primary,padding:0,color:f.colors.text.secondary,textAlign:"center",fontSize:f.typography.size.sm,"&:focus":{boxShadow:i(h)}}),tooltipContainer:(0,t.css)({textAlign:"center",padding:f.spacing(0,1)}),tooltipName:(0,t.css)({fontWeight:f.typography.fontWeightBold}),tooltipDate:(0,t.css)({fontWeight:f.typography.fontWeightRegular}),dotContainer:(0,t.css)({display:"flex",alignItems:"center"}),dot:(0,t.css)({height:"6px",width:"6px",backgroundColor:f.colors.primary.main,borderRadius:f.shape.radius.circle,display:"inline-block",marginLeft:f.spacing(1)}),pointer:(0,t.css)({cursor:"pointer"})}}},51986:(Q,A,e)=>{"use strict";e.d(A,{i:()=>g});var t=e(96540),n=e(13544),o=e(40845),s=e(55852),r=e(88323);function g({"aria-label":u,label:c,icon:i,options:l,onChange:f,variant:d,minWidth:h=16,size:p="sm",isFullWidth:m=!0,menuPlacement:a,fill:v,buttonCss:E}){const[D,b]=(0,t.useState)(!1),C=(0,o.$j)();return t.createElement(t.Fragment,null,!D&&t.createElement(s.$n,{size:p||"sm",className:E,icon:i||"plus",onClick:()=>b(!0),variant:d,fill:v,fullWidth:m,"data-testid":n.Tp.components.ValuePicker.button(u??c)},c),D&&t.createElement("span",{style:{minWidth:C.spacing(h),flexGrow:m?1:void 0}},t.createElement(r.l6,{placeholder:c,options:l,"aria-label":n.Tp.components.ValuePicker.select(u??c),isOpen:!0,onCloseMenu:()=>b(!1),autoFocus:!0,onChange:y=>{b(!1),f(y)},menuPlacement:a})))}},67266:(Q,A,e)=>{"use strict";e.d(A,{KU:()=>u});var t=e(32196),n=e(96540),o=e(49185),s=e(40845),r=e(16797),g=e(40276);const u=({width:l,height:f,legend:d,children:h})=>{const p=(0,s.$j)(),m=(0,s.of)(c),a={display:"flex",width:`${l}px`,height:`${f}px`},[v,E]=(0,o.A)();if(!d)return n.createElement(n.Fragment,null,n.createElement("div",{style:a,className:m.viz},h(l,f)));let{placement:D,maxHeight:b="35%",maxWidth:C="60%"}=d.props;document.body.clientWidth<p.breakpoints.values.lg&&(D="bottom");let y=null;const M={};switch(D){case"bottom":a.flexDirection="column",M.maxHeight=b,E.height&&(y={width:l,height:f-E.height});break;case"right":a.flexDirection="row",M.maxWidth=C,E.width&&(y={width:l-E.width,height:f}),d.props.width&&(M.width=d.props.width,y={width:l-d.props.width,height:f});break}return y?.width===0&&(y.width=l),y?.height===0&&(y.height=f),n.createElement("div",{style:a},n.createElement("div",{className:m.viz},y&&h(y.width,y.height)),n.createElement("div",{style:M,ref:v},n.createElement(g.E,{hideHorizontalTrack:!0},d)))},c=l=>({viz:(0,t.css)({flexGrow:2,borderRadius:l.shape.radius.default,"&:focus-visible":(0,r.getFocusStyles)(l)})}),i=({children:l})=>n.createElement(n.Fragment,null,l);u.Legend=i},94536:(Q,A,e)=>{"use strict";e.d(A,{p:()=>r});var t=e(32196),n=e(96540),o=e(8066),s=e(40845);const r=n.memo(n.forwardRef(({color:u,className:c,gradient:i,...l},f)=>{const d=(0,s.$j)(),h=(0,s.of)(g);let p;if(i){const a=o.uf.get(i).getColors?.(d);a?.length?p=`linear-gradient(90deg, ${a.join(", ")})`:p=d.visualization.getColorByName("")}else p=u;const m={background:p,width:"14px",height:"4px",borderRadius:d.shape.radius.pill,display:"inline-block",marginRight:"8px"};return n.createElement("div",{"data-testid":"series-icon",ref:f,className:(0,t.cx)(c,h.forcedColors),style:m,...l})})),g=()=>({forcedColors:(0,t.css)({"@media (forced-colors: active)":{forcedColorAdjust:"none"}})});r.displayName="SeriesIcon"},55726:(Q,A,e)=>{"use strict";e.d(A,{t:()=>I});var t=e(96540),n=e(69129),o=e(52622),s=e(79041),r=e(88895),g=e(32196),u=e(40845),c=e(1551),i=e(33552),l=e(34375);const f=({items:x,itemRenderer:S,onLabelMouseOver:O,onLabelMouseOut:P,onLabelClick:L,placement:U,className:R,readonly:B})=>{const H=(0,u.of)(d);S||(S=N=>t.createElement(l.M,{item:N,onLabelClick:L,onLabelMouseOver:O,onLabelMouseOut:P,readonly:B}));const w=N=>`${N.getItemKey?N.getItemKey():N.label}`;switch(U){case"right":{const N=(V,G)=>t.createElement("span",{className:H.itemRight},S(V,G));return t.createElement("div",{className:(0,g.cx)(H.rightWrapper,R)},t.createElement(i.B,{items:x,renderItem:N,getItemKey:w}))}case"bottom":default:{const N=x.filter(_=>_.yAxis===1),V=x.filter(_=>_.yAxis!==1),G=(_,K)=>t.createElement("span",{className:H.itemBottom},S(_,K));return t.createElement("div",{className:(0,g.cx)(H.bottomWrapper,R)},N.length>0&&t.createElement("div",{className:H.section},t.createElement(c.c,{items:N,renderItem:G,getItemKey:w})),V.length>0&&t.createElement("div",{className:(0,g.cx)(H.section,H.sectionRight)},t.createElement(c.c,{items:V,renderItem:G,getItemKey:w})))}}};f.displayName="VizLegendList";const d=x=>{const S=(0,g.css)({paddingRight:"10px",display:"flex",fontSize:x.typography.bodySmall.fontSize,whiteSpace:"nowrap"});return{itemBottom:S,itemRight:(0,g.cx)(S,(0,g.css)({marginBottom:x.spacing(.5)})),rightWrapper:(0,g.css)({paddingLeft:x.spacing(.5)}),bottomWrapper:(0,g.css)({display:"flex",flexWrap:"wrap",justifyContent:"space-between",width:"100%",paddingLeft:x.spacing(.5),gap:"15px 25px"}),section:(0,g.css)({display:"flex"}),sectionRight:(0,g.css)({justifyContent:"flex-end",flexGrow:1,flexBasis:"50%"})}};var h=e(14578),p=e(83195),m=e(16797),a=e(94134);const v=({item:x,onLabelClick:S,onLabelMouseOver:O,onLabelMouseOut:P,className:L,readonly:U})=>{const R=(0,u.of)(E),B=(0,t.useCallback)(N=>{O&&O(x,N)},[x,O]),H=(0,t.useCallback)(N=>{P&&P(x,N)},[x,P]),w=(0,t.useCallback)(N=>{S&&S(x,N)},[x,S]);return t.createElement("tr",{className:(0,g.cx)(R.row,L)},t.createElement("td",null,t.createElement("span",{className:R.itemWrapper},t.createElement(a.R,{color:x.color,seriesName:x.label,readonly:U}),t.createElement("button",{disabled:U,type:"button",title:x.label,onBlur:H,onFocus:B,onMouseOver:B,onMouseOut:H,onClick:U?void 0:w,className:(0,g.cx)(R.label,x.disabled&&R.labelDisabled)},x.label," ",x.yAxis===2&&t.createElement("span",{className:R.yAxisLabel},"(right y-axis)")))),x.getDisplayValues&&x.getDisplayValues().map((N,V)=>t.createElement("td",{className:R.value,key:`${N.title}-${V}`},(0,p.cN)(N))))};v.displayName="LegendTableItem";const E=x=>{const S=m.hoverColor(x.colors.background.primary,x);return{row:(0,g.css)({label:"LegendRow",fontSize:x.v1.typography.size.sm,borderBottom:`1px solid ${x.colors.border.weak}`,td:{padding:x.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:x.colors.text.disabled}),itemWrapper:(0,g.css)({display:"flex",whiteSpace:"nowrap",alignItems:"center"}),value:(0,g.css)({textAlign:"right"}),yAxisLabel:(0,g.css)({color:x.colors.text.secondary})}},D="Name",b=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}).compare,C=({items:x,sortBy:S,sortDesc:O,itemRenderer:P,className:L,onToggleSort:U,onLabelClick:R,onLabelMouseOver:B,onLabelMouseOut:H,readonly:w,isSortable:N})=>{const V=(0,u.of)(y),G={};N&&(G[D]="");for(const _ of x)if(_.getDisplayValues)for(const K of _.getDisplayValues())G[K.title??"?"]=K.description??"";if(S!=null){let _=new Map;x.forEach(j=>{if(S!==D&&j.getDisplayValues){const k=j.getDisplayValues().find(ee=>ee.title===S),Y=k==null||Number.isNaN(k.numeric)?-1/0:k.numeric;_.set(j,Y)}});let K=O?-1:1;S===D?x.sort((j,k)=>K*b(j.label,k.label)):x.sort((j,k)=>{const Y=_.get(j)??0,ee=_.get(k)??0;return K*(Y-ee)})}return P||(P=(_,K)=>t.createElement(v,{key:`${_.label}-${K}`,item:_,onLabelClick:R,onLabelMouseOver:B,onLabelMouseOut:H,readonly:w})),t.createElement("table",{className:(0,g.cx)(V.table,L)},t.createElement("thead",null,t.createElement("tr",null,!N&&t.createElement("th",null),Object.keys(G).map(_=>t.createElement("th",{title:G[_],key:_,className:(0,g.cx)(V.header,U&&V.headerSortable,N&&V.nameHeader,{[V.withIcon]:S===_}),onClick:()=>{U&&U(_)}},_,S===_&&t.createElement(h.I,{size:"xs",name:O?"angle-down":"angle-up"}))))),t.createElement("tbody",null,x.map(P)))},y=x=>({table:(0,g.css)({width:"100%","th:first-child":{width:"100%",borderBottom:`1px solid ${x.colors.border.weak}`}}),header:(0,g.css)({color:x.colors.primary.text,fontWeight:x.typography.fontWeightMedium,borderBottom:`1px solid ${x.colors.border.weak}`,padding:x.spacing(.25,1,.25,1),fontSize:x.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 M=e(29995);function T(x){return x.ctrlKey||x.metaKey||x.shiftKey?r.B.AppendToSelection:r.B.ToggleSelection}function I({items:x,displayMode:S,sortBy:O,seriesVisibilityChangeBehavior:P=M.K.Isolate,sortDesc:L,onLabelClick:U,onToggleSort:R,placement:B,className:H,itemRenderer:w,readonly:N,isSortable:V}){const{eventBus:G,onToggleSeriesVisibility:_,onToggleLegendSort:K}=(0,s.d2)(),j=(0,t.useCallback)((ee,re)=>{G?.publish({type:n.b_.type,payload:{raw:re,x:0,y:0,dataId:ee.label}})},[G]),k=(0,t.useCallback)((ee,re)=>{G?.publish({type:n.ql.type,payload:{raw:re,x:0,y:0,dataId:ee.label}})},[G]),Y=(0,t.useCallback)((ee,re)=>{U&&U(ee,re),_&&_(ee.label,P===M.K.Hide?r.B.AppendToSelection:T(re))},[_,U,P]);switch(S){case o.lm.Table:return t.createElement(C,{className:H,items:x,placement:B,sortBy:O,sortDesc:L,onLabelClick:Y,onToggleSort:R||K,onLabelMouseOver:j,onLabelMouseOut:k,itemRenderer:w,readonly:N,isSortable:V});case o.lm.List:return t.createElement(f,{className:H,items:x,placement:B,onLabelMouseOver:j,onLabelMouseOut:k,onLabelClick:Y,itemRenderer:w,readonly:N});default:return null}}I.displayName="VizLegend"},34375:(Q,A,e)=>{"use strict";e.d(A,{M:()=>f});var t=e(32196),n=e(96540),o=e(13544),s=e(40845),r=e(94134),g=e(2543),u=e(83195),c=e(1551);const i=({stats:h})=>{const p=(0,s.of)(l);return h.length===0?null:n.createElement(c.c,{className:p.list,items:h,renderItem:m=>n.createElement("div",{className:p.item,title:m.description},m.title&&`${(0,g.capitalize)(m.title)}:`," ",(0,u.cN)(m))})},l=()=>({list:(0,t.css)({flexGrow:1,textAlign:"right"}),item:(0,t.css)({marginLeft:"8px"})});i.displayName="VizLegendStatsList";const f=({item:h,onLabelClick:p,onLabelMouseOver:m,onLabelMouseOut:a,className:v,readonly:E})=>{const D=(0,s.of)(d),b=(0,n.useCallback)(M=>{m&&m(h,M)},[h,m]),C=(0,n.useCallback)(M=>{a&&a(h,M)},[h,a]),y=(0,n.useCallback)(M=>{p&&p(h,M)},[h,p]);return n.createElement("div",{className:(0,t.cx)(D.itemWrapper,h.disabled&&D.itemDisabled,v),"data-testid":o.Tp.components.VizLegend.seriesName(h.label)},n.createElement(r.R,{seriesName:h.label,color:h.color,gradient:h.gradient,readonly:E}),n.createElement("button",{disabled:E,type:"button",onBlur:C,onFocus:b,onMouseOver:b,onMouseOut:C,onClick:y,className:D.label},h.label),h.getDisplayValues&&n.createElement(i,{stats:h.getDisplayValues()}))};f.displayName="VizLegendListItem";const d=h=>({label:(0,t.css)({label:"LegendLabel",whiteSpace:"nowrap",background:"none",border:"none",fontSize:"inherit",padding:0,userSelect:"text"}),itemDisabled:(0,t.css)({label:"LegendLabelDisabled",color:h.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:h.v1.palette.gray2})})},94134:(Q,A,e)=>{"use strict";e.d(A,{R:()=>r});var t=e(96540),n=e(83598),o=e(79041),s=e(94536);const r=t.memo(({seriesName:g,color:u,gradient:c,readonly:i})=>{const{onSeriesColorChange:l}=(0,o.d2)(),f=(0,t.useCallback)(d=>l(g,d),[g,l]);return g&&l&&u&&!i?t.createElement(n.Dp,{color:u,onChange:f,enableNamedColors:!0},({ref:d,showColorPicker:h,hideColorPicker:p})=>t.createElement(s.p,{color:u,className:"pointer",ref:d,onClick:h,onMouseLeave:p})):t.createElement(s.p,{color:u,gradient:c})});r.displayName="VizLegendSeriesIcon"},29995:(Q,A,e)=>{"use strict";e.d(A,{K:()=>t});var t=(n=>(n[n.Isolate=0]="Isolate",n[n.Hide=1]="Hide",n))(t||{})},12509:(Q,A,e)=>{"use strict";e.d(A,{S:()=>g});var t=e(2543),n=e(96540),o=e(47070);const s=(c,i,l,f)=>{const d=r(c,i,f),h=r(i,c,f),p=Math.max(d,h);let m=Math.floor(c/p),a=Math.ceil(f/m);m=Math.ceil(f/a);const v=m-(m*a-f),E=c/v-l+l/v;return{width:c/m-l+l/m,height:i/a-l+l/a,widthOnLastRow:E,xCount:m,yCount:a}};function r(c,i,l){const f=Math.ceil(Math.sqrt(l*c/i));return Math.floor(f*i/c)*f<l?i/Math.ceil(f*i/c):c/f}class g extends n.PureComponent{constructor(i){super(i),this.state={values:i.getValues()}}componentDidUpdate(i){const{renderCounter:l,source:f}=this.props;(l!==i.renderCounter||f!==i.source)&&this.setState({values:this.props.getValues()})}getOrientation(){const{orientation:i,width:l,height:f}=this.props;return i===o.wV.Auto?l>f?o.wV.Vertical:o.wV.Horizontal:i}renderGrid(){const{renderValue:i,height:l,width:f,itemSpacing:d,getAlignmentFactors:h,orientation:p}=this.props,{values:m}=this.state,a=s(f,l,d,m.length),v=h?h(m,a.width,a.height):{};let E=0,D=0,b=[];for(let C=0;C<m.length;C++){const y=m[C],T=D===a.yCount-1?a.widthOnLastRow:a.width,I=a.height,x=E*T+d*E,S=D*I+d*D,O={position:"absolute",left:x,top:S,width:`${T}px`,height:`${I}px`};b.push(n.createElement("div",{key:C,style:O},i({value:y,width:T,height:I,alignmentFactors:v,orientation:p,count:m.length}))),E++,E===a.xCount&&(E=0,D++)}return n.createElement("div",{style:{position:"relative"}},b)}render(){const{renderValue:i,height:l,width:f,itemSpacing:d,getAlignmentFactors:h,autoGrid:p,orientation:m,maxVizHeight:a,minVizWidth:v,minVizHeight:E}=this.props,{values:D}=this.state;if(p&&m===o.wV.Auto)return this.renderGrid();const b={display:"flex"},C={display:"flex",overflow:`${v?"auto":"hidden"} ${E?"auto":"hidden"}`};let y=l,M=f;const T=this.getOrientation();switch(T){case o.wV.Horizontal:const x=(l+d)/D.length-d;C.flexDirection="column",C.height=`${l}px`,b.marginBottom=`${d}px`,M=f,y=(0,t.clamp)(x,E??0,a??x);break;case o.wV.Vertical:C.flexDirection="row",C.justifyContent="space-between",b.marginRight=`${d}px`,y=l,M=Math.max(f/D.length-d+d/D.length,v??0)}b.width=`${M}px`,b.height=`${y}px`;const I=h?h(D,M,y):{};return n.createElement("div",{style:C},D.map((x,S)=>n.createElement("div",{key:S,style:u(b,S,D.length)},i({value:x,width:M,height:y,alignmentFactors:I,orientation:T,count:D.length}))))}}g.defaultProps={itemSpacing:8};function u(c,i,l){return i===l-1?{...c,marginRight:0,marginBottom:0}:c}},3139:(Q,A,e)=>{"use strict";e.d(A,{g:()=>g,o:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(94536);const r=c=>({icon:(0,t.css)({marginRight:c.spacing(1),verticalAlign:"middle"}),seriesTable:(0,t.css)({display:"table"}),seriesTableRow:(0,t.css)({display:"table-row",fontSize:c.typography.bodySmall.fontSize}),seriesTableCell:(0,t.css)({display:"table-cell"}),label:(0,t.css)({wordBreak:"break-all"}),value:(0,t.css)({paddingLeft:c.spacing(2),textAlign:"right"}),activeSeries:(0,t.css)({fontWeight:c.typography.fontWeightBold,color:c.colors.text.maxContrast}),timestamp:(0,t.css)({fontWeight:c.typography.fontWeightBold,fontSize:c.typography.bodySmall.fontSize})}),g=({color:c,label:i,value:l,isActive:f})=>{const d=(0,o.of)(r);return n.createElement("div",{"data-testid":"SeriesTableRow",className:(0,t.cx)(d.seriesTableRow,f&&d.activeSeries)},c&&n.createElement("div",{className:d.seriesTableCell},n.createElement(s.p,{color:c,className:d.icon})),i&&n.createElement("div",{className:(0,t.cx)(d.seriesTableCell,d.label)},i),l&&n.createElement("div",{className:(0,t.cx)(d.seriesTableCell,d.value)},l))},u=({timestamp:c,series:i})=>{const l=(0,o.of)(r);return n.createElement(n.Fragment,null,c&&n.createElement("div",{className:l.timestamp,"aria-label":"Timestamp"},c),i.map((f,d)=>n.createElement(g,{isActive:f.isActive,label:f.label,color:f.color,value:f.value,key:`${f.label}-${d}`})))}},75128:(Q,A,e)=>{"use strict";e.d(A,{n:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(17464),r=e(69503);const g=({content:c,position:i,offset:l})=>{const f=(0,o.of)(u);return i?n.createElement(s.ZL,{className:f.portal},n.createElement(r.o,{position:i,offset:l||{x:0,y:0}},c)):null};g.displayName="VizTooltip";const u=()=>({portal:(0,t.css)({position:"absolute",top:0,left:0,pointerEvents:"none",width:"100%",height:"100%"})})},69503:(Q,A,e)=>{"use strict";e.d(A,{o:()=>u});var t=e(32196),n=e(96540),o=e(52908),s=e(40845),r=e(16797),g=e(10875);const u=({position:{x:i,y:l},offset:{x:f,y:d},children:h,allowPointerEvents:p=!1,className:m,...a})=>{const v=(0,n.useRef)(null),[E,D]=(0,n.useState)({width:0,height:0}),{width:b,height:C}=(0,o.A)(),[y,M]=(0,n.useState)({x:i+f,y:l+d}),T=(0,n.useMemo)(()=>new ResizeObserver(x=>{for(let S of x){const O=Math.floor(S.contentRect.width+16),P=Math.floor(S.contentRect.height+2*8);(E.width!==O||E.height!==P)&&D({width:Math.min(O,b),height:Math.min(P,C)})}}),[E,b,C]);(0,n.useLayoutEffect)(()=>(v.current&&T.observe(v.current),()=>{T.disconnect()}),[T]),(0,n.useLayoutEffect)(()=>{if(v&&v.current){const{x,y:S}=(0,g.Ju)(i,l,E.width,E.height,f,d,b,C);M({x,y:S})}},[b,C,i,f,l,d,E]);const I=(0,s.of)(c);return n.createElement("div",{ref:v,style:{position:"fixed",left:0,pointerEvents:p?"auto":"none",top:0,transform:`translate(${y.x}px, ${y.y}px)`,transition:"transform ease-out 0.1s"},"aria-live":"polite","aria-atomic":"true",...a,className:(0,t.cx)(I.wrapper,m)},h)};u.displayName="VizTooltipContainer";const c=i=>({wrapper:(0,t.css)((0,r.getTooltipContainerStyles)(i))})},11389:(Q,A,e)=>{"use strict";e.d(A,{o:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(13471);const r=({contentLabelValue:u,customContent:c,isPinned:i,scrollable:l=!1})=>{const f=(0,o.of)(g),d=l?{maxHeight:400,overflowY:"auto"}:{};return n.createElement("div",{className:f.wrapper,style:d},n.createElement("div",null,u.map((h,p)=>{const{label:m,value:a,color:v,colorIndicator:E,colorPlacement:D,isActive:b}=h;return n.createElement(s.B,{key:p,label:m,value:a,color:v,colorIndicator:E,colorPlacement:D,isActive:b,justify:"space-between",isPinned:i})})),c?.map((h,p)=>n.createElement("div",{key:p,className:f.customContentPadding},h)))},g=u=>({wrapper:(0,t.css)({display:"flex",flexDirection:"column",flex:1,gap:4,borderTop:`1px solid ${u.colors.border.medium}`,padding:u.spacing(1)}),customContentPadding:(0,t.css)({padding:`${u.spacing(1)} 0`})})},58749:(Q,A,e)=>{"use strict";e.d(A,{S:()=>c});var t=e(32196),n=e(96540),o=e(66864),s=e(14689),r=e(55852),g=e(40845);const u="add-annotation-button",c=({dataLinks:l,annotate:f})=>{const d=(0,g.of)(i),h=()=>{const p={variant:"secondary"};return n.createElement(o.Gy,null,l.map((m,a)=>n.createElement(s.R,{key:a,link:m,buttonProps:p})))};return n.createElement("div",{className:d.wrapper},l.length>0&&n.createElement("div",{className:d.dataLinks},h()),f&&n.createElement("div",{className:d.addAnnotations},n.createElement(r.$n,{icon:"comment-alt",variant:"secondary",size:"sm",id:u,onClick:f},"Add annotation")))},i=l=>({wrapper:(0,t.css)({display:"flex",flexDirection:"column",flex:1,padding:l.spacing(0)}),dataLinks:(0,t.css)({overflowX:"auto",overflowY:"hidden",whiteSpace:"nowrap",maskImage:"linear-gradient(90deg, rgba(0, 0, 0, 1) 80%, transparent)",borderTop:`1px solid ${l.colors.border.medium}`,padding:l.spacing(1)}),addAnnotations:(0,t.css)({borderTop:`1px solid ${l.colors.border.medium}`,padding:l.spacing(1)})})},92663:(Q,A,e)=>{"use strict";e.d(A,{A:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(13471);const r=({headerLabel:i,isPinned:l})=>{const{label:f,value:d,color:h,colorIndicator:p}=i;return n.createElement(s.B,{label:f,value:d,color:h,colorIndicator:p,marginRight:"22px",isPinned:l})},g=({keyValuePairs:i,isPinned:l})=>n.createElement(n.Fragment,null,i?.map((f,d)=>n.createElement(s.B,{key:d,label:f.label,value:f.value,color:f.color,colorIndicator:f.colorIndicator,justify:"space-between",isPinned:l}))),u=({headerLabel:i,keyValuePairs:l,customValueDisplay:f,isPinned:d})=>{const h=(0,o.of)(c);return n.createElement("div",{className:h.wrapper},n.createElement(r,{headerLabel:i,isPinned:d}),f||n.createElement(g,{keyValuePairs:l,isPinned:d}))},c=i=>({wrapper:(0,t.css)({display:"flex",flexDirection:"column",flex:1,padding:i.spacing(1)})})},13471:(Q,A,e)=>{"use strict";e.d(A,{B:()=>m});var t=e(32196),n=e(96540),o=e(40845),s=e(32982),r=e(56034),g=e(24293),u=e(79871),c=e(10875),i=(v=>(v[v.Leading=0]="Leading",v[v.Trailing=1]="Trailing",v))(i||{});const l=({color:v=g.F,colorIndicator:E=u.Ev,position:D=0})=>{const b=(0,o.of)(f);return n.createElement("span",{style:{backgroundColor:v},className:(0,t.cx)(D===0?b.leading:b.trailing,(0,c.L$)(E,b))})},f=v=>({leading:(0,t.css)({marginRight:v.spacing(.5)}),trailing:(0,t.css)({marginLeft:v.spacing(.5)}),series:(0,t.css)({width:"14px",height:"4px",borderRadius:v.shape.radius.pill,minWidth:"14px"}),value:(0,t.css)({width:"12px",height:"12px",borderRadius:v.shape.radius.default,fontWeight:500,minWidth:"12px"}),hexagon:(0,t.css)({}),pie_1_4:(0,t.css)({}),pie_2_4:(0,t.css)({}),pie_3_4:(0,t.css)({}),marker_sm:(0,t.css)({width:"4px",height:"4px",borderRadius:v.shape.radius.circle,minWidth:"4px"}),marker_md:(0,t.css)({width:"8px",height:"8px",borderRadius:v.shape.radius.circle,minWidth:"8px"}),marker_lg:(0,t.css)({width:"12px",height:"12px",borderRadius:v.shape.radius.circle,minWidth:"12px"})});var d=(v=>(v.label="label",v.value="value",v))(d||{});const h="Copied to clipboard",p=2*1e3,m=({label:v,value:E,color:D,colorIndicator:b,colorPlacement:C=u.lJ.first,justify:y="flex-start",isActive:M=!1,marginRight:T="0px",isPinned:I})=>{const x=(0,o.of)(a,y,T),[S,O]=(0,n.useState)(!1),[P,L]=(0,n.useState)(!1),[U,R]=(0,n.useState)(null),[B,H]=(0,n.useState)(!1),w=(0,n.useRef)(null),N=(0,n.useRef)(null);(0,n.useEffect)(()=>{let Y;return B&&(Y=setTimeout(()=>{H(!1)},p)),()=>{window.clearTimeout(Y)}},[B]);const V=async(Y,ee)=>{if(!(navigator?.clipboard&&window.isSecureContext)){G(Y,ee);return}try{await navigator.clipboard.writeText(Y),R({[`${ee}`]:Y}),H(!0)}catch{R(null)}},G=(Y,ee)=>{const re=document.createElement("textarea");w.current?.appendChild(re),re.value=Y,re.focus(),re.select();try{document.execCommand("copy")&&(R({[`${ee}`]:Y}),H(!0))}catch(J){console.error("Unable to copy to clipboard",J)}re.remove()},_=Y=>{Y.currentTarget.offsetWidth<Y.currentTarget.scrollWidth&&O(!0)},K=()=>O(!1),j=Y=>{Y.currentTarget.offsetWidth<Y.currentTarget.scrollWidth&&L(!0)},k=()=>L(!1);return n.createElement("div",{className:x.contentWrapper},(D||v)&&n.createElement("div",{className:x.valueWrapper},D&&C===u.lJ.first&&n.createElement(l,{color:D,colorIndicator:b}),I?n.createElement(n.Fragment,null,n.createElement(r.m,{content:v,interactive:!1,show:S},n.createElement(n.Fragment,null,B&&U?.label&&n.createElement(s.r,{placement:"top",referenceElement:w.current},h),n.createElement("div",{className:(0,t.cx)(x.label,M&&x.activeSeries,navigator?.clipboard&&x.copy),onMouseEnter:_,onMouseLeave:K,onClick:()=>V(v,"label"),ref:w},v)))):n.createElement("div",{className:(0,t.cx)(x.label,M&&x.activeSeries)},v)),n.createElement("div",{className:x.valueWrapper},D&&C===u.lJ.leading&&n.createElement(l,{color:D,colorIndicator:b,position:i.Leading}),I?n.createElement(r.m,{content:E?E.toString():"",interactive:!1,show:P},n.createElement(n.Fragment,null,B&&U?.value&&n.createElement(s.r,{placement:"top",referenceElement:N.current},h),n.createElement("div",{className:(0,t.cx)(x.value,M,navigator?.clipboard&&x.copy),onMouseEnter:j,onMouseLeave:k,onClick:()=>V(E?E.toString():"","value"),ref:N},E))):n.createElement("div",{className:(0,t.cx)(x.value,M)},E),D&&C===u.lJ.trailing&&n.createElement(l,{color:D,colorIndicator:b,position:i.Trailing})))},a=(v,E,D)=>({contentWrapper:(0,t.css)({display:"flex",alignItems:"center",justifyContent:E,flexWrap:"wrap",marginRight:D}),label:(0,t.css)({color:v.colors.text.secondary,fontWeight:400,textOverflow:"ellipsis",overflow:"hidden",marginRight:v.spacing(2)}),value:(0,t.css)({fontWeight:500,textOverflow:"ellipsis",overflow:"hidden"}),valueWrapper:(0,t.css)({display:"flex",alignItems:"center",minWidth:0}),activeSeries:(0,t.css)({fontWeight:v.typography.fontWeightBold,color:v.colors.text.maxContrast}),copy:(0,t.css)({cursor:"pointer"})})},79871:(Q,A,e)=>{"use strict";e.d(A,{Ev:()=>o,fX:()=>t,lJ:()=>n});var t=(s=>(s.series="series",s.value="value",s.hexagon="hexagon",s.pie_1_4="pie_1_4",s.pie_2_4="pie_2_4",s.pie_3_4="pie_3_4",s.marker_sm="marker_sm",s.marker_md="marker_md",s.marker_lg="marker_lg",s))(t||{}),n=(s=>(s.hidden="hidden",s.first="first",s.leading="leading",s.trailing="trailing",s))(n||{});const o="series"},10875:(Q,A,e)=>{"use strict";e.d(A,{Ju:()=>g,L$:()=>u,cp:()=>f});var t=e(11261),n=e(83195),o=e(24293),s=e(52622),r=e(79871);const g=(d=0,h=0,p=0,m=0,a=0,v=0,E=0,D=0)=>{let b=d,C=h;const y=Math.max(d+a+p-(E-a),0),M=Math.abs(Math.min(d-a-p-a,0)),T=y>0,I=M>0,x=Math.max(h+v+m-(D-v),0),S=Math.abs(Math.min(h-v-m-v,0)),O=x>0,P=S>0;return T&&I?b=y>M?a:E-a-p:T?b=d-a-p:b=d+a,O&&P?C=x>S?v:D-v-m:O?C=h-v-m:C=h+v,{x:b,y:C}},u=(d,h)=>{switch(d){case r.fX.value:return h.value;case r.fX.series:return h.series;case r.fX.hexagon:return h.hexagon;case r.fX.pie_1_4:return h.pie_1_4;case r.fX.pie_2_4:return h.pie_2_4;case r.fX.pie_3_4:return h.pie_3_4;case r.fX.marker_sm:return h.marker_sm;case r.fX.marker_md:return h.marker_md;case r.fX.marker_lg:return h.marker_lg;default:return h.value}},c=(d,h)=>d.numeric-h.numeric,i=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),l=(d,h)=>i.compare(`${d.value}`,`${h.value}`),f=(d,h,p,m,a,v,E=D=>!0)=>{let D=[],b=!1;for(let C=0;C<d.length;C++){const y=d[C];if(y===h||y.type===t.PU.time||!E(y)||y.config.custom?.hideFrom?.tooltip||y.config.custom?.hideFrom?.viz||a===s.$N.Single&&m!==C)continue;let M=p[C];if(M==null)continue;y.type===t.PU.number||y.type===t.PU.boolean||y.type===t.PU.enum||(b=!1);const T=d[C].values[M],I=y.display(T),x=Number.isNaN(I.numeric)?v===s.xB.Descending?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER:I.numeric;D.push({label:y.state?.displayName??y.name,value:(0,n.cN)(I),color:I.color??o.F,colorIndicator:r.fX.series,colorPlacement:r.lJ.first,isActive:a===s.$N.Multi&&m===C,numeric:x})}if(v!==s.xB.None&&D.length>1){const C=b?c:l,y=v===s.xB.Descending?-1:1;D.sort((M,T)=>y*C(M,T))}return D}},94333:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{Alert:()=>Ve.F,AlertingSettings:()=>qt.i,AsyncMultiSelect:()=>br.Iv,AsyncSelect:()=>br.DW,AsyncVirtualizedSelect:()=>br.gZ,AutoSaveField:()=>Y.p,AutoSizeInput:()=>ro.D,Avatar:()=>kn.e,Badge:()=>Ar.E,BarGauge:()=>He.xE,BarGaugeDisplayMode:()=>Ys.eX,BigValue:()=>st.yV,BigValueColorMode:()=>st.yp,BigValueGraphMode:()=>st.$p,BigValueJustifyMode:()=>st.F8,BigValueTextMode:()=>st.SV,Box:()=>as.a,BrowserLabel:()=>xs.J,Button:()=>Va.$n,ButtonCascader:()=>C.H,ButtonGroup:()=>ts.e,ButtonSelect:()=>sn.f,CallToActionCard:()=>Yt.c,Card:()=>bo.Z,CardContainer:()=>Ot.Q,Cascader:()=>b.v,CertificationKey:()=>mn.K,Checkbox:()=>oo.S,ClickOutsideWrapper:()=>Pt.N,ClipboardButton:()=>D.b,CodeEditor:()=>oe.B,CodeEditorSuggestionItemKind:()=>ie.q,CollapsableSection:()=>nt.M,Collapse:()=>ot.S,ColorPicker:()=>I.sk,ColorPickerInput:()=>x.i,ConfirmButton:()=>l.Z,ConfirmModal:()=>q.u,Container:()=>Zr.mc,ContextMenu:()=>zt.t,ControlledCollapse:()=>ot.a,Counter:()=>Ye.p,CustomHeadersSettings:()=>Rt.P,CustomScrollbar:()=>v.E,DataLinkButton:()=>pt.R,DataLinkInput:()=>yt.l,DataLinksContextMenu:()=>jt.e,DataLinksInlineEditor:()=>ft.e,DataSourceHttpSettings:()=>ca.t,DatePicker:()=>V.l,DatePickerWithInput:()=>G.l,DateTimePicker:()=>_.K,DeleteButton:()=>f.e,Divider:()=>ma.c,Drawer:()=>Xn._,Dropdown:()=>Zt.m,EmptySearchResult:()=>O.Z,ErrorBoundary:()=>An.tH,ErrorBoundaryAlert:()=>An.Xw,ErrorWithStack:()=>hn.D,EventsCanvas:()=>ds.a,FIXED_UNIT:()=>kr.s,FadeTransition:()=>Tn.A,FeatureBadge:()=>on.y,FeatureInfoBox:()=>on.e,Field:()=>Zs.D,FieldArray:()=>Ir.E,FieldLinkList:()=>mt.n,FieldSet:()=>is.n,FieldValidationMessage:()=>Ls.P,FileDropzone:()=>ur.gH,FileDropzoneDefaultChildren:()=>ur.wI,FileListItem:()=>ur.IB,FileUpload:()=>io.e,FilterInput:()=>Za.Z,FilterPill:()=>ne.m,Form:()=>Oa.l,FormattedValueDisplay:()=>$t.i,FullWidthButtonContainer:()=>gt.V,Gauge:()=>Xe._,Graph:()=>qa.T,GraphContextMenu:()=>Wr.H,GraphContextMenuHeader:()=>Wr.i,GraphNG:()=>To.o,GraphSeriesToggler:()=>Ne.M,GraphWithLegend:()=>Qs.I,Grid:()=>lr.x,HorizontalGroup:()=>Zr.Gy,Icon:()=>c.I,IconButton:()=>i.K,InfoBox:()=>pn.w,InlineField:()=>ks.I,InlineFieldRow:()=>Cr.C,InlineFormLabel:()=>ua.I,InlineLabel:()=>qs.c,InlineSegmentGroup:()=>Pr.e,InlineSwitch:()=>St.K,InlineToast:()=>y.r,Input:()=>Ss.p,InputControl:()=>Jn.e,InteractiveTable:()=>j.j,JSONFormatter:()=>Xt.B,JsonExplorer:()=>fn.O,KeyboardPlugin:()=>Vs.Z7,Label:()=>cr.J,LayoutItemContext:()=>Ia.N,LegacyForms:()=>ko,LegacyInputStatus:()=>n.O,Legend:()=>os.s,Link:()=>Ps.N,LinkButton:()=>Va.z9,List:()=>K.B,LoadingBar:()=>T.G,LoadingPlaceholder:()=>M._,Marker:()=>ds.pH,Menu:()=>_t.W,MenuGroup:()=>rt.r,MenuItem:()=>It.D,Modal:()=>he.a,ModalHeader:()=>De.r,ModalRoot:()=>Te.EO,ModalTabContent:()=>le.O,ModalTabsHeader:()=>pe.J,ModalsContext:()=>Te.wE,ModalsController:()=>Te.$s,ModalsProvider:()=>Te.YO,MultiSelect:()=>br.KF,PageToolbar:()=>Ee.d,Pagination:()=>ee.d,PanelChrome:()=>Z.NR,PanelChromeLoadingIndicator:()=>ae.I,PanelContainer:()=>lo._,PanelContextProvider:()=>de.XF,PanelContextRoot:()=>de.e4,PlotLegend:()=>ws.$,PluginSignatureBadge:()=>vn.B,Popover:()=>p.A,PopoverController:()=>h.I,Portal:()=>a.ZL,PortalContainer:()=>a.qB,QueryField:()=>te.X,RadioButtonGroup:()=>zo.z,RadioButtonList:()=>$s.a,RangeSlider:()=>ba.F,ReactMonacoEditor:()=>ue.m,RefreshPicker:()=>U.cC,RelativeTimeRangePicker:()=>Co.N,RenderUserContentAsHTML:()=>at.I,ScaleDistribution:()=>Ys.L4,SecretInput:()=>bs.L,SecretTextArea:()=>Yn.l,SecureSocksProxySettings:()=>gn.Y,Segment:()=>Mn.Y,SegmentAsync:()=>Ln.s,SegmentInput:()=>na.o,SegmentSection:()=>ia.L,SegmentSelect:()=>pa.a,Select:()=>br.l6,SelectContainer:()=>br.KA,SeriesColorPicker:()=>I.Dp,SeriesColorPickerPopover:()=>S.o,SeriesColorPickerPopoverWithTheme:()=>S.t,SeriesIcon:()=>cn.p,SeriesTable:()=>$e.o,SeriesTableRow:()=>$e.g,SeriesVisibilityChangeBehavior:()=>Ue.K,SeriesVisibilityChangeMode:()=>ha.B,SetInterval:()=>Re.u,SlideOutTransition:()=>$n.n,Slider:()=>Da.A,Space:()=>Is.$,Sparkline:()=>Ke.O,Spinner:()=>Sn.y,Splitter:()=>za.O,Stack:()=>ar.B,StatsPicker:()=>L.S,Switch:()=>St.d,TLSAuthSettings:()=>Cn.j,Tab:()=>Le.o,TabContent:()=>Be.J,TabbedContainer:()=>E.q,Table:()=>me.X,TableInputCSV:()=>Me.b,TabsBar:()=>ye.U,Tag:()=>re.v,TagList:()=>J.L,TagsInput:()=>k.u,Text:()=>Cs.E,TextArea:()=>vo.f,TextLink:()=>ir.Y,TimeOfDayPicker:()=>H.R,TimePickerTooltip:()=>R.xS,TimeRangeInput:()=>Fr.b,TimeRangeLabel:()=>B.f,TimeRangePicker:()=>R.$6,TimeSeries:()=>Mo.Z,TimeZonePicker:()=>w.U,Toggletip:()=>m.G,ToolbarButton:()=>Ds.I,ToolbarButtonRow:()=>Ms.U,Tooltip:()=>d.m,TooltipPlugin:()=>Vs.Tk,TooltipPlugin2:()=>Vs.xl,UPLOT_AXIS_FONT_SIZE:()=>vs.pi,UPlotChart:()=>zr.Z,UPlotConfigBuilder:()=>sr.e,UnitPicker:()=>P.p,UserIcon:()=>wn.n,ValuePicker:()=>Ns.i,VerticalGroup:()=>Zr.gW,VerticalTab:()=>We.s,VirtualizedSelect:()=>br.ip,VizLayout:()=>ve.KU,VizLegend:()=>_e.t,VizLegendListItem:()=>ze.M,VizRepeater:()=>be.S,VizTooltip:()=>Ge.n,VizTooltipContainer:()=>xe.o,WeekStartPicker:()=>N.l,WithContextMenu:()=>Dn.n,XYCanvas:()=>ds._X,ZoomPlugin:()=>Vs.jn,buildScaleKey:()=>ti.My,clearButtonStyles:()=>Va.my,convertOldAngularValueMapping:()=>Mt.I1,defaultIntervals:()=>U.cb,fieldMatchersUI:()=>cs.g,getCardStyles:()=>bo.H,getDragStyles:()=>Qa.l,getInputStyles:()=>Ss.n,getPortalContainer:()=>a.gF,getSelectStyles:()=>so.J,graphFieldOptions:()=>Ha.t,graphTickFormatter:()=>co.Yn,graphTimeFormat:()=>co.Jc,preparePlotFrame:()=>ti.mY,resetSelectStyles:()=>Lo.A,sharedInputStyle:()=>sa.Xb,sharedSingleStatMigrationHandler:()=>Mt._$,sharedSingleStatPanelChangedHandler:()=>Mt.gl,useGraphNGContext:()=>vi.I,usePanelContext:()=>de.d2,variableSuggestionToCodeEditorSuggestion:()=>ge.O,withErrorBoundary:()=>An.Xc});var t=e(90090),n=e(91634),o=e(24169),s=e(11206),r=e(99091),g=e(74716),u=e(56286),c=e(14578),i=e(29158),l=e(82702),f=e(91605),d=e(56034),h=e(95868),p=e(13840),m=e(60782),a=e(17464),v=e(40276),E=e(60734),D=e(10534),b=e(3988),C=e(32012),y=e(32982),M=e(39558),T=e(57514),I=e(83598),x=e(99128),S=e(70104),O=e(41670),P=e(2056),L=e(42734),U=e(11134),R=e(15666),B=e(3799),H=e(66070),w=e(20333),N=e(15648),V=e(56181),G=e(98239),_=e(63383),K=e(33552),j=e(28389),k=e(79924),Y=e(28270),ee=e(19384),re=e(78369),J=e(64149),ne=e(92174),q=e(96374),te=e(20084),oe=e(32372),ue=e(85828),ie=e(19716),ge=e(99544),he=e(37390),De=e(29473),pe=e(25897),le=e(95246),Te=e(71678),Ee=e(95247),Re=e(67570),me=e(77093),Me=e(14746),ye=e(63021),Le=e(40675),We=e(90685),Be=e(40980),Ye=e(53402),at=e(44522),st=e(37494),Ke=e(5926),Xe=e(95164),He=e(97696),Ge=e(75128),xe=e(69503),$e=e(3139),be=e(12509),Z=e(91052),ae=e(89963),de=e(79041),ve=e(67266),Ue=e(29995),_e=e(55726),ze=e(34375),Ve=e(42418),Ne=e(84656),ot=e(82762),nt=e(57418),pt=e(14689),mt=e(79961),gt=e(61458),Pt=e(8866),Mt=e(37713),Yt=e(76442),zt=e(28122),_t=e(38138),rt=e(59093),It=e(64539),Dn=e(51686),ft=e(64919),yt=e(64078),jt=e(59796),cn=e(94536),pn=e(37166),on=e(86460),Xt=e(24022),fn=e(44533),An=e(66602),hn=e(52446),ca=e(91409),Rt=e(11184),qt=e(19849),gn=e(17081),Cn=e(95180),mn=e(28623),Sn=e(62930),Tn=e(31511),$n=e(72960),Mn=e(38401),Ln=e(83684),na=e(57752),pa=e(13102),ia=e(64765),Xn=e(87978),Da=e(77014),ba=e(47097),Oa=e(51253),sa=e(87266),Jn=e(16504),Va=e(55852),ts=e(19727),Ds=e(27746),Ms=e(15068),Ns=e(51986),cs=e(84349),Ps=e(50720),ir=e(72109),Cs=e(94753),as=e(90613),ar=e(67061),lr=e(71259),Is=e(68402),cr=e(60029),Zs=e(88575),os=e(17408),is=e(84167),Ls=e(72093),ks=e(14186),Pr=e(63056),qs=e(76892),Cr=e(39268),Ir=e(95984),Lo=e(23731),br=e(88323),so=e(88824),hs=e(62883),Nr=e.n(hs),wr={};for(const Ho in hs)["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","BarGauge","VizTooltip","VizTooltipContainer","SeriesTable","SeriesTableRow","VizRepeater","PanelChrome","PanelChromeLoadingIndicator","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","Text","Box","Stack","Grid","Space","Label","Field","Legend","FieldSet","FieldValidationMessage","InlineField","InlineSegmentGroup","InlineLabel","InlineFieldRow","FieldArray","resetSelectStyles","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","Avatar","InlineFormLabel","Divider","getDragStyles","Splitter","LayoutItemContext","LegacyForms","LegacyInputStatus","ScaleDistribution","BarGaugeDisplayMode","UPlotConfigBuilder","UPLOT_AXIS_FONT_SIZE","UPlotChart","PlotLegend","FIXED_UNIT","BrowserLabel","PanelContainer","Graph","GraphWithLegend","GraphContextMenu","GraphContextMenuHeader","graphTimeFormat","graphTickFormatter","GraphNG","TimeSeries","useGraphNGContext","preparePlotFrame","buildScaleKey","convertOldAngularValueMapping","sharedSingleStatMigrationHandler","sharedSingleStatPanelChangedHandler","AsyncMultiSelect","AsyncSelect","AsyncVirtualizedSelect","MultiSelect","Select","SelectContainer","VirtualizedSelect"].indexOf(Ho)<0&&(wr[Ho]=()=>hs[Ho]);e.d(A,wr);var Zr=e(66864),Ar=e(39938),zo=e(94354),$s=e(5173),Ss=e(10354),ro=e(51440),Za=e(67647),bs=e(49718),Yn=e(7968),St=e(15292),oo=e(10880),vo=e(21744),io=e(73546),ur=e(92887),Fr=e(54230),Co=e(3759),bo=e(10860),Ot=e(81507),$t=e(9286),sn=e(9261),Zt=e(83122),vn=e(98624),wn=e(99635),kn=e(12942),ua=e(38894),ma=e(25994),Qa=e(69144),za=e(34722),Ia=e(18348),Ha=e(52198),Ys=e(52622),sr=e(51336),vs=e(30501),zr=e(81297),ws=e(24182),ds=e(96747),Vs=e(66737),kr=e(52811),ha=e(88895),xs=e(54438),lo=e(52494),qa=e(48747),Qs=e(5484),Wr=e(33083),co=e(65036),To=e(99755),Mo=e(18262),vi=e(16998),ti=e(65575);const ko={SecretFormField:u.L,FormField:t.z,Select:r.l6,AsyncSelect:r.DW,IndicatorsContainer:o.s,NoOptionsMessage:s.l,Input:n.p,Switch:g.d}},31511:(Q,A,e)=>{"use strict";e.d(A,{A:()=>r});var t=e(32196),n=e(96540),o=e(86634),s=e(40845);function r(u){const{visible:c,children:i,duration:l=250}=u,f=(0,s.of)(g,l);return n.createElement(o.A,{in:c,mountOnEnter:!0,unmountOnExit:!0,timeout:l,classNames:f},i)}const g=(u,c)=>({enter:(0,t.css)({label:"enter",opacity:0}),enterActive:(0,t.css)({label:"enterActive",opacity:1,transition:`opacity ${c}ms ease-out`}),exit:(0,t.css)({label:"exit",opacity:1}),exitActive:(0,t.css)({label:"exitActive",opacity:0,transition:`opacity ${c}ms ease-out`})})},72960:(Q,A,e)=>{"use strict";e.d(A,{n:()=>r});var t=e(32196),n=e(96540),o=e(86634),s=e(40845);function r(u){const{visible:c,children:i,duration:l=250,horizontal:f,size:d}=u,h=(0,s.of)(g,l,f?"width":"height",d);return n.createElement(o.A,{in:c,mountOnEnter:!0,unmountOnExit:!0,timeout:l,classNames:h},i)}const g=(u,c,i,l)=>({enter:(0,t.css)({label:"enter",[`${i}`]:0,opacity:0}),enterActive:(0,t.css)({label:"enterActive",[`${i}`]:`${l}px`,opacity:1,transition:`opacity ${c}ms ease-out, ${i} ${c}ms ease-out`}),exit:(0,t.css)({label:"exit",[`${i}`]:`${l}px`,opacity:1}),exitActive:(0,t.css)({label:"exitActive",opacity:0,[`${i}`]:0,transition:`opacity ${c}ms ease-out, ${i} ${c}ms ease-out`})})},81297:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>u});var t=e(96540),n=e(36613),o=e(16895);function s(c,i){return i.width===c.width&&i.height===c.height}function r(c,i){return i.data===c.data}function g(c,i){return i.config===c.config}class u extends t.Component{constructor(i){super(i),this.plotContainer=(0,t.createRef)(),this.plotCanvasBBox=(0,t.createRef)(),this.state={plot:null}}reinitPlot(){let{width:i,height:l,plotRef:f}=this.props;if(this.state.plot?.destroy(),i===0&&l===0)return;this.props.config.addHook("setSize",p=>{p.over});const d={width:Math.floor(this.props.width),height:Math.floor(this.props.height),...this.props.config.getConfig()};(0,o.uY)("UPlot",!1,"Reinitializing plot",d);const h=new n.A(d,this.props.data,this.plotContainer.current);f&&f(h),this.setState({plot:h})}componentDidMount(){this.reinitPlot()}componentWillUnmount(){this.state.plot?.destroy()}componentDidUpdate(i){let{plot:l}=this.state;s(i,this.props)?g(i,this.props)?r(i,this.props)||l?.setData(this.props.data):this.reinitPlot():l?.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)}}},24182:(Q,A,e)=>{"use strict";e.d(A,{$:()=>d,t:()=>f});var t=e(96540),n=e(28240),o=e(8066),s=e(75059),r=e(57875),g=e(52622),u=e(40845),c=e(67266),i=e(55726);const l=h=>h==null?"-":h.toFixed(1);function f(h,p){return h.getSeries().some(m=>{const a=m.props.dataFrameFieldIndex;if(!a)return!1;const v=p[a.frameIndex]?.fields[a.fieldIndex];return!(!v||v.config.custom?.hideFrom?.legend)})}const d=t.memo(({data:h,config:p,placement:m,calcs:a,displayMode:v,...E})=>{const D=(0,u.$j)(),b=p.getSeries().map(C=>{const y=C.props,M=y.dataFrameFieldIndex,T=p.getAxisPlacement(C.props.scaleKey);if(!M)return;const I=h[M.frameIndex]?.fields[M.fieldIndex];if(!I||I.config.custom?.hideFrom?.legend)return;const x=(0,n.Ct)(I,h[M.frameIndex],h),O=(0,o.lz)(I,D).color;return{disabled:!(y.show??!0),fieldIndex:M,color:O,label:x,yAxis:T===g.vM.Left||T===g.vM.Bottom?1:2,getDisplayValues:()=>{if(!a?.length)return[];const P=I.display??l;let L=null;const U=(0,s.Nw)({field:I,reducers:a});return a.map(R=>{const B=s.AS.get(R);let H=P;return B.id===s.gy.diffperc&&(H=(0,r.J)({field:{...I,config:{...I.config,unit:"percentunit"}},theme:D})),(B.id===s.gy.count||B.id===s.gy.changeCount||B.id===s.gy.distinctCount)&&(L||(L=(0,r.J)({field:{...I,config:{...I.config,unit:"none"}},theme:D})),H=L),{...H(U[R]),title:B.name,description:B.description}})},getItemKey:()=>`${x}-${M.frameIndex}-${M.fieldIndex}`}}).filter(C=>C!==void 0);return t.createElement(c.KU.Legend,{placement:m,...E},t.createElement(i.t,{placement:m,items:b,displayMode:v,sortBy:E.sortBy,sortDesc:E.sortDesc,isSortable:!0}))});d.displayName="PlotLegend"},52198:(Q,A,e)=>{"use strict";e.d(A,{t:()=>n});var t=e(52622);const n={drawStyle:[{label:"Lines",value:t.GR.Line},{label:"Bars",value:t.GR.Bars},{label:"Points",value:t.GR.Points}],lineInterpolation:[{description:"Linear",value:t.dx.Linear,icon:"gf-interpolation-linear"},{description:"Smooth",value:t.dx.Smooth,icon:"gf-interpolation-smooth"},{description:"Step before",value:t.dx.StepBefore,icon:"gf-interpolation-step-before"},{description:"Step after",value:t.dx.StepAfter,icon:"gf-interpolation-step-after"}],barAlignment:[{description:"Before",value:t.Nj.Before,icon:"gf-bar-alignment-before"},{description:"Center",value:t.Nj.Center,icon:"gf-bar-alignment-center"},{description:"After",value:t.Nj.After,icon:"gf-bar-alignment-after"}],showPoints:[{label:"Auto",value:t.yL.Auto,description:"Show points when the density is low"},{label:"Always",value:t.yL.Always},{label:"Never",value:t.yL.Never}],axisPlacement:[{label:"Auto",value:t.vM.Auto,description:"First field on the left, everything else on the right"},{label:"Left",value:t.vM.Left},{label:"Right",value:t.vM.Right},{label:"Hidden",value:t.vM.Hidden}],fillGradient:[{label:"None",value:t.on.None},{label:"Opacity",value:t.on.Opacity,description:"Enable fill opacity gradient"},{label:"Hue",value:t.on.Hue,description:"Small color hue gradient"},{label:"Scheme",value:t.on.Scheme,description:"Use color scheme to define gradient"}],stacking:[{label:"Off",value:t.gs.None},{label:"Normal",value:t.gs.Normal},{label:"100%",value:t.gs.Percent}],thresholdsDisplayModes:[{label:"Off",value:t.Ly.Off},{label:"As lines",value:t.Ly.Line},{label:"As lines (dashed)",value:t.Ly.Dashed},{label:"As filled regions",value:t.Ly.Area},{label:"As filled regions and lines",value:t.Ly.LineAndArea},{label:"As filled regions and lines (dashed)",value:t.Ly.DashedAndArea}]}},30501:(Q,A,e)=>{"use strict";e.d(A,{fU:()=>h,pi:()=>i,zH:()=>f});var t=e(83195),n=e(97706),o=e(42994),s=e(72724),r=e(52622),g=e(29413),u=e(52811),c=e(93060);const i=12,l=8;class f extends u.R{merge(a){this.props.size=(0,c.Y)("max",this.props.size,a.size),this.props.label||(this.props.label=a.label),this.props.placement===r.vM.Auto&&(this.props.placement=a.placement)}calculateSpace(a,v,E,D,b){const C=a.axes[v],y=a.scales[C.scale];if(C.side!==2||!y)return 30;const M=40;if(y.time){const T=b/M,I=(D-E)/T,x=h(a,[E],v,M,I);return(0,g.kD)(x[0],i).width+18}return M}calculateAxisSize(a,v,E){const D=a.axes[E];let b=D.ticks.size;if(D.side===2)b+=D.gap+i;else if(v?.length){let C=v.reduce((M,T)=>Math.max(M,(0,g.kD)(T,i).width),0);const y=Math.min(a.width*.4,C);b+=D.gap+D.labelGap+y}return Math.ceil(b)}getConfig(){let{scaleKey:a,label:v,show:E=!0,placement:D=r.vM.Auto,grid:b={show:!0},ticks:C,space:y,filter:M,gap:T=5,formatValue:I,splits:x,values:S,incrs:O,isTime:P,timeZone:L,theme:U,tickLabelRotation:R,size:B,color:H,border:w,decimals:N,distr:V=r.L4.Linear}=this.props;const G=`${i}px ${U.typography.fontFamily}`,_=U.isDark?"rgba(240, 250, 255, 0.09)":"rgba(0, 10, 23, 0.09)";(0,t.j9)(a)&&(x=[0,1]),N===0&&V===r.L4.Linear&&(M=(j,k)=>k.map(Y=>Number.isInteger(Y)?Y:null));let K={scale:a,show:E,stroke:H??U.colors.text.primary,side:p(D),font:G,size:B??((j,k,Y)=>this.calculateAxisSize(j,k,Y)),rotate:R,gap:T,labelGap:0,grid:{show:b.show,stroke:_,width:1/devicePixelRatio},ticks:Object.assign({show:!0,stroke:w?.show?H??U.colors.text.primary:_,width:1/devicePixelRatio,size:4},C),splits:x,values:S,space:y??((j,k,Y,ee,re)=>this.calculateSpace(j,k,Y,ee,re)),filter:M,incrs:O};return w?.show&&(K.border={stroke:H??U.colors.text.primary,width:1/devicePixelRatio,...w}),v!=null&&v.length>0&&(K.label=v,K.labelSize=i+l,K.labelFont=G,K.labelGap=l),S?K.values=S:P?K.values=h:I&&(K.values=(j,k,Y,ee,re)=>{let J=(0,n.E)((0,n.h)(re,6));return k.map(ne=>I(ne,J>0?J:void 0))}),K.timeZone=L,K}}const d={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 h(m,a,v,E,D){const b=m.axes[v].timeZone,C=m.scales.x,y=(C?.max??0)-(C?.min??0),M=Math.round(d.year/d.day)*d.day,T=Math.round(D/d.day)*d.day;let I=o.WC.interval.year;return D<d.second?I=o.WC.interval.millisecond:D<=d.minute?I=o.WC.interval.second:y<=d.day?I=o.WC.interval.minute:D<=d.day?I=o.WC.interval.hour:y<d.year?I=o.WC.interval.day:T===M?I=o.WC.interval.year:D<=d.year&&(I=o.WC.interval.month),a.map(x=>x==null?"":(0,s.LE)(x,{format:I,timeZone:b}))}function p(m){switch(m){case r.vM.Top:return 0;case r.vM.Right:return 1;case r.vM.Bottom:return 2;case r.vM.Left:}return 3}},51336:(Q,A,e)=>{"use strict";e.d(A,{e:()=>b});var t=e(2543),n=e(36613),o=e(43127),s=e(91410),r=e(52622),g=e(16895),u=e(30501),c=e(93060),i=e(24293),l=e(23596),f=e(52811),d=e(74863);class h extends f.R{getConfig(){const{facets:y,drawStyle:M,pathBuilder:T,pointsBuilder:I,pointsFilter:x,lineInterpolation:S,lineWidth:O,lineStyle:P,barAlignment:L,barWidthFactor:U,barMaxWidth:R,showPoints:B,pointSize:H,scaleKey:w,pxAlign:N,spanNulls:V,show:G=!0}=this.props;let _={},K=this.getLineColor();_.stroke=K,_.width=O,P&&P.fill!=="solid"&&(P.fill==="dot"&&(_.cap="round"),_.dash=P.dash??[10,10]),T!=null?_.paths=T:M===r.GR.Points?_.paths=()=>null:M!=null&&(_.paths=(Y,ee,re,J)=>m(M,S,L,U,R)(Y,ee,re,J));const j=typeof K=="string"?K:(Y,ee)=>Y.series[ee]._stroke,k={points:{stroke:j,fill:j,size:!H||H<O?void 0:H,filter:x}};return I!=null?k.points.show=I:M===r.GR.Points?k.points.show=!0:B===r.yL.Auto?M===r.GR.Bars&&(k.points.show=!1):B===r.yL.Never?k.points.show=!1:B===r.yL.Always&&(k.points.show=!0),{scale:w,facets:y,spanGaps:typeof V=="number"?!1:V,value:()=>"",pxAlign:N,show:G,fill:this.getFill(),..._,...k}}getLineColor(){const{lineColor:y,gradientMode:M,colorMode:T,thresholds:I,theme:x,hardMin:S,hardMax:O,softMin:P,softMax:L,dynamicSeriesColor:U}=this.props;return M===r.on.None&&U?(R,B)=>U(B)??y??i.F:M===r.on.Scheme&&T?.id!==i.Y.Fixed?(0,d.pl)(1,x,T,I,S,O,P,L):M===r.on.Hue?(0,d.B5)(y??i.F,1,x):y??i.F}getFill(){const{lineColor:y,fillColor:M,gradientMode:T,fillOpacity:I,colorMode:x,thresholds:S,theme:O,hardMin:P,hardMax:L,softMin:U,softMax:R,dynamicSeriesColor:B}=this.props;if(M)return M;const H=T??r.on.None,w=(I??0)/100;if(H===r.on.None&&B&&w>0)return(N,V)=>{let G=N.series[V]._stroke;return l.alpha(G??"",w)};switch(H){case r.on.Opacity:return(0,d.WO)(M??y,w);case r.on.Hue:return(0,d.B5)(M??y,w,O);case r.on.Scheme:if(x?.id!==i.Y.Fixed)return(0,d.pl)(w,O,x,S,P,L,U,R);default:if(w>0)return l.alpha(y??"",w)}}}let p;function m(C,y,M=r.Nj.Center,T=.6,I=200){const x=n.A.paths;if(p||(p={linear:x.linear(),smooth:x.spline(),stepBefore:x.stepped({align:-1}),stepAfter:x.stepped({align:1})}),C===r.GR.Bars){let S=`bars|${M}|${T}|${I}`;return p[S]||(p[S]=x.bars({size:[T,I],align:M})),p[S]}else if(C===r.GR.Line){if(y===r.dx.StepBefore)return p.stepBefore;if(y===r.dx.StepAfter)return p.stepAfter;if(y===r.dx.Smooth)return p.smooth}return p.linear}var a=e(84140),v=e(50082);function E(C){const y=C.config.mode===r.Ly.Dashed||C.config.mode===r.Ly.DashedAndArea?[10,10]:null;function M(B,H,w,N){let V=B.ctx,G=0;for(let _=0;_<w.length;_++)if(w[_].color==="transparent"){G=_;break}V.lineWidth=2,y&&V.setLineDash(y);for(let _=1;_<w.length;_++){const K=w[_];let j;G>=_&&_>0?j=(0,a.A)(N.visualization.getColorByName(w[_-1].color)):j=(0,a.A)(N.visualization.getColorByName(K.color)),j.getAlpha()===1&&j.setAlpha(.7);let k=Math.round(B.bbox.left),Y=Math.round(B.valToPos(K.value,H,!0)),ee=Math.round(B.bbox.left+B.bbox.width),re=Math.round(B.valToPos(K.value,H,!0));V.beginPath(),V.moveTo(k,Y),V.lineTo(ee,re),V.strokeStyle=j.toString(),V.stroke()}}function T(B,H,w,N){let V=B.ctx,G=(0,d.Z8)(B,H,w.map(_=>{let K=(0,a.A)(N.visualization.getColorByName(_.color));return K.getAlpha()===1&&K.setAlpha(.15),[_.value,K.toString()]}),!0);V.fillStyle=G,V.fillRect(B.bbox.left,B.bbox.top,B.bbox.width,B.bbox.height)}const{scaleKey:I,thresholds:x,theme:S,config:O,hardMin:P,hardMax:L,softMin:U,softMax:R}=C;return B=>{const H=B.ctx,{min:w,max:N}=B.scales.x,{min:V,max:G}=B.scales[I];if(w==null||N==null||V==null||G==null)return;let{steps:_,mode:K}=x;if(K===v.O.Percentage){let[j,k]=(0,d.EJ)(B,I,P,L,U,R),Y=k-j;_=_.map(ee=>({...ee,value:j+Y*(ee.value/100)}))}switch(H.save(),O.mode){case r.Ly.Line:case r.Ly.Dashed:M(B,I,_,S);break;case r.Ly.Area:T(B,I,_,S);break;case r.Ly.LineAndArea:case r.Ly.DashedAndArea:T(B,I,_,S),M(B,I,_,S)}H.restore()}}const D={drag:{setScale:!1},points:{size:(C,y)=>C.series[y].points.size*2,width:(C,y,M)=>M/4},focus:{prox:30}};class b{constructor(y=o.lE){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=M=>{let T=new Date(M);return this.tz?n.A.tzDate(T,this.tz):T},this.tz=(0,s.QZ)(y,Date.now())?.ianaName}addHook(y,M){(0,g.uY)("UPlotConfigBuilder",!1,"addHook",y),this.hooks[y]||(this.hooks[y]=[]),this.hooks[y].push(M)}addThresholds(y){this.thresholds[y.scaleKey]||(this.thresholds[y.scaleKey]=y,this.addHook("drawClear",E(y)))}addAxis(y){y.placement=y.placement??r.vM.Auto,y.grid=y.grid??{};let M=y.scaleKey;if(M==="x"&&(M+=y.timeZone??""),this.axes[M]){this.axes[M].merge(y);return}y.placement===r.vM.Auto&&(y.placement=this.hasLeftAxis?r.vM.Right:r.vM.Left),y.placement===r.vM.Left&&(this.hasLeftAxis=!0),y.placement===r.vM.Hidden&&(y.grid.show=!1,y.size=0),this.axes[M]=new u.zH(y)}getAxisPlacement(y){return this.axes[y]?.props.placement??r.vM.Left}setCursor(y){this.cursor=(0,t.merge)({},this.cursor,y)}setMode(y){this.mode=y}setSelect(y){this.select=y}addSeries(y){this.series.push(new h(y))}getSeries(){return this.series}addScale(y){const M=this.scales.find(T=>T.props.scaleKey===y.scaleKey);if(M){M.merge(y);return}this.scales.push(new c.G(y))}addBand(y){this.bands.push(y)}setStackingGroups(y){this.stackingGroups=y}getStackingGroups(){return this.stackingGroups}setTooltipInterpolator(y){this.tooltipInterpolator=y}getTooltipInterpolator(){return this.tooltipInterpolator}setPrepData(y){this.prepData=M=>(this.frames=M,y(M,this.getStackingGroups()))}setSync(){this.sync=!0}hasSync(){return this.sync}setPadding(y){this.padding=y}getConfig(){if(this.cachedConfig)return this.cachedConfig;const y={...g.NN,mode:this.mode,series:[this.mode===2?null:{value:()=>""}]};y.axes=this.ensureNonOverlappingAxes(Object.values(this.axes)).map(T=>T.getConfig()),y.series=[...y.series,...this.series.map(T=>T.getConfig())],y.scales=this.scales.reduce((T,I)=>({...T,...I.getConfig()}),{}),y.hooks=this.hooks,y.select=this.select;const M=(T="")=>(I,x)=>{let S=I.series[x].points._stroke;if(typeof S!="string"){let O=this.frames[0].fields[x];S=O.display(O.values[I.cursor.idxs[x]]).color}return S+T};return y.cursor=(0,t.merge)({},D,{points:{stroke:M("80"),fill:M()}},this.cursor),y.tzDate=this.tzDate,Array.isArray(this.padding)&&(y.padding=this.padding),this.stackingGroups.forEach(T=>{(0,g.Tz)(T).forEach(I=>{this.addBand(I)})}),this.bands.length&&(y.bands=this.bands),this.cachedConfig=y,y}ensureNonOverlappingAxes(y){const M=y.find(x=>x.props.scaleKey==="x"),T=y.filter(x=>x.props.grid?.show===void 0),I=T.findIndex(x=>x.props.placement===r.vM.Left||x.props.placement===r.vM.Right||x.props.placement===r.vM.Bottom&&x!==M);for(let x=0;x<T.length;x++)T[x]===M||x===I?T[x].props.grid.show=!0:T[x].props.grid.show=!1;return y}}},93060:(Q,A,e)=>{"use strict";e.d(A,{G:()=>g,Y:()=>u});var t=e(36613),n=e(77678),o=e(83195),s=e(52622),r=e(52811);class g extends r.R{merge(i){this.props.min=u("min",this.props.min,i.min),this.props.max=u("max",this.props.max,i.max)}getConfig(){let{isTime:i,scaleKey:l,min:f,max:d,softMin:h,softMax:p,range:m,direction:a,orientation:v,centeredZero:E,decimals:D}=this.props;const b=this.props.distribution,C=i?{}:{distr:b===s.L4.Symlog?4:b===s.L4.Log?3:b===s.L4.Ordinal?2:1,log:b===s.L4.Log||b===s.L4.Symlog?this.props.log??2:void 0,asinh:b===s.L4.Symlog?this.props.linearThreshold??1:void 0};if(b===s.L4.Log){let L=this.props.log,U=L===2?Math.log2:Math.log10;f!=null&&(f<=0?f=null:f=L**Math.floor(U(f))),d!=null&&(d<=0?d=null:d=L**Math.ceil(U(d))),h!=null&&(h<=0?h=null:h=L**Math.floor(U(h))),p!=null&&(p<=0?p=null:p=L**Math.ceil(U(p)))}let y=h==null?3:1,M=p==null?3:1;const T={min:{pad:.1,hard:f??-1/0,soft:h||0,mode:y},max:{pad:.1,hard:d??1/0,soft:p||0,mode:M}};let I=h==null&&f!=null,x=p==null&&d!=null,S=I&&x;const O=(L,U,R,B)=>{const H=L.scales[B];let w=[U,R];if(B==="x"&&!i&&b===s.L4.Linear||!S&&U==null&&R==null)return w;let N=H.log??10;if(H.distr===1||H.distr===2||H.distr===4){if(E){let V=Math.abs(U),G=Math.abs(R),_=Math.max(V,G);_===0&&(_=80),U=-_,R=_}H.distr===4?w=t.A.rangeAsinh(U,R,N,!0):w=t.A.rangeNum(I?f:U,x?d:R,T)}else H.distr===3&&(w=t.A.rangeLog(f??U,d??R,N,!0));if(D===0)if(H.distr===1||H.distr===2)w[0]=(0,n.rs)(w[0],1),w[1]=(0,n.Uh)(w[1],1);else if(H.distr===3){let V=H.log===2?Math.log2:Math.log10;if(w[0]<=1)w[0]=1;else{let _=Math.floor(V(w[0]));w[0]=N**_}let G=Math.ceil(V(w[1]));w[1]=N**G,w[0]===w[1]&&(w[1]*=N)}else H.distr===4&&(w[0]=(0,n.rs)(w[0],1),w[1]=(0,n.Uh)(w[1],1));return(H.distr===1||H.distr===4)&&(I&&(w[0]=f),x&&(w[1]=d)),w[0]>=w[1]&&(w[0]=H.distr===3?1:0,w[1]=100),w};let P=!i&&!S;return(0,o.j9)(l)&&(P=!1,m=[0,1]),{[l]:{time:i,auto:P,range:m??O,dir:a,ori:v,...C}}}}function u(c,i,l){const f=i!=null,d=l!=null;return f?d?c==="min"?i<l?i:l:i>l?i:l:i:l}},74863:(Q,A,e)=>{"use strict";e.d(A,{B5:()=>i,EJ:()=>h,WO:()=>c,Z8:()=>f,pl:()=>m});var t=e(84140),n=e(23596),o=e(24293),s=e(50082),r=e(52622),g=e(29413);function u(a,v,E){let D=0,b=0,C=0,y=0;return a===3?(b=v.top,y=v.top+v.height):a===2?(D=v.left+v.width,C=v.left):a===1?(b=v.top+v.height,y=v.top):a===0&&(D=v.left,C=v.left+v.width),E.createLinearGradient(D,b,C,y)}function c(a,v){return(E,D)=>{const b=(0,g.Yc)(),C=u(E.scales.x.ori===r.Lt.Horizontal?3:2,E.bbox,b);return C.addColorStop(0,n.alpha(a,v)),C.addColorStop(1,n.alpha(a,0)),C}}function i(a,v,E){return(D,b)=>{const C=(0,g.Yc)(),y=u(D.scales.x.ori===r.Lt.Horizontal?3:2,D.bbox,C),M=(0,t.A)(a).spin(-25).darken(5),T=(0,t.A)(a).saturate(20).spin(20).brighten(10);return E.isDark?(y.addColorStop(0,T.lighten(10).setAlpha(v).toString()),y.addColorStop(1,M.darken(10).setAlpha(v).toString())):(y.addColorStop(0,T.lighten(10).setAlpha(v).toString()),y.addColorStop(1,M.setAlpha(v).toString())),y}}var l=(a=>(a[a.Right=0]="Right",a[a.Up=1]="Up",a[a.Left=2]="Left",a[a.Down=3]="Down",a))(l||{});function f(a,v,E,D=!1){let b=a.scales[v],C=null,y=null;for(let w=0;w<E.length;w++){let N=E[w][0];if((N<=b.min||C==null)&&(C=w),y=w,N>=b.max)break}if(C===y)return E[C][1];let M=E[C][0],T=E[y][0];M===-1/0&&(M=b.min),T===1/0&&(T=b.max);let I=Math.round(a.valToPos(M,v,!0)),x=Math.round(a.valToPos(T,v,!0)),S=I-x;if(S===0)return E[y][1];let O,P,L,U;a.scales.x.ori===r.Lt.Horizontal?(O=L=0,P=I,U=x):(P=U=0,O=I,L=x);let B=(0,g.Yc)().createLinearGradient(O,P,L,U),H;for(let w=C;w<=y;w++){let N=E[w],V=w===C?I:w===y?x:Math.round(a.valToPos(N[0],v,!0)),G=(I-V)/S;D&&w>C&&B.addColorStop(G,H),B.addColorStop(G,H=N[1])}return B}function d(a,v){let E=a.scales[v],D=1/0,b=-1/0;return a.series.forEach((C,y)=>{if(C.show&&C.scale===v)if(C.min==null){let M=a.data[y];for(let T=0;T<M.length;T++)M[T]!=null&&(D=Math.min(D,M[T]),b=Math.max(b,M[T]))}else D=Math.min(D,C.min),b=Math.max(b,C.max)}),b===D&&(D=E.min,b=E.max),[D,b]}function h(a,v,E,D,b,C){let y=E??b??null,M=D??C??null;if(y==null||M==null){let[T,I]=d(a,v);y=y??T??0,M=M??I??100}return[y,M]}function p(a){return a==="transparent"||a[0]==="#"&&a.slice(-2)==="00"}function m(a,v,E,D,b,C,y,M){if(!E)throw Error("Missing colorMode required for color scheme gradients");if(!D)throw Error("Missing thresholds required for color scheme gradients");return(T,I)=>{let x=T.series[I].scale,S="";if(E.id===o.Y.Thresholds)if(D.mode===s.O.Absolute){const O=D.steps.map(P=>[P.value,p(P.color)?"#0000":n.alpha(v.visualization.getColorByName(P.color),a)]);S=f(T,x,O,!0)}else{const[O,P]=h(T,x,b,C,y,M),L=P-O,U=D.steps.map(R=>[O+L*(R.value/100),n.alpha(v.visualization.getColorByName(R.color),a)]);S=f(T,x,U,!0)}else if(E.getColors){const O=E.getColors(v),[P,L]=h(T,x,b,C,y,M),U=L-P,R=O.map((B,H)=>[P+U*(H/(O.length-1)),n.alpha(v.visualization.getColorByName(B),a)]);S=f(T,x,R,!1)}return S}}},78226:(Q,A,e)=>{"use strict";e.d(A,{a:()=>r});var t=e(96540),n=e(1604),o=e(6967),s=e(97620);function r({id:g,events:u,renderEventMarker:c,mapEventToXYCoords:i,config:l}){const f=(0,t.useRef)(),[d,h]=(0,t.useState)(0),p=(0,n.A)();(0,t.useLayoutEffect)(()=>{l.addHook("init",a=>{f.current=a}),l.addHook("draw",()=>{p()&&h(a=>a+1)})},[l,h]);const m=(0,t.useMemo)(()=>{const a=[];if(!f.current||u.length===0)return a;for(let v=0;v<u.length;v++){const E=u[v];for(let D=0;D<E.length;D++){const b=i(E,{fieldIndex:D,frameIndex:v});b&&a.push(t.createElement(o.p,{...b,key:`${g}-marker-${v}-${D}`},c(E,{fieldIndex:D,frameIndex:v})))}}return t.createElement(t.Fragment,null,a)},[u,c,d]);return f.current?t.createElement(s._,{left:f.current.bbox.left/window.devicePixelRatio,top:f.current.bbox.top/window.devicePixelRatio},m):null}},6967:(Q,A,e)=>{"use strict";e.d(A,{p:()=>n});var t=e(96540);const n=({x:o,y:s,children:r})=>t.createElement("div",{style:{position:"absolute",top:`${s}px`,left:`${o}px`}},r)},97620:(Q,A,e)=>{"use strict";e.d(A,{_:()=>o});var t=e(32196),n=e(96540);const o=({children:s,left:r,top:g})=>{const u=(0,n.useMemo)(()=>(0,t.css)({position:"absolute",overflow:"visible",left:`${r}px`,top:`${g}px`}),[r,g]);return n.createElement("div",{className:u},s)}},96747:(Q,A,e)=>{"use strict";e.d(A,{_X:()=>o._,a:()=>t.a,pH:()=>n.p});var t=e(78226),n=e(6967),o=e(97620)},55129:(Q,A,e)=>{"use strict";e.d(A,{M:()=>o});var t=e(52622),n=e(52811);function o(r,g){const u="na",c=`${r.min!==void 0?r.min:u}-${r.max!==void 0?r.max:u}`,i=`${r.custom?.axisSoftMin!==void 0?r.custom.axisSoftMin:u}-${r.custom?.axisSoftMax!==void 0?r.custom.axisSoftMax:u}`,l=`${r.custom?.axisPlacement!==void 0?r.custom?.axisPlacement:t.vM.Auto}`,f=r.unit??n.s,d=r.custom?.scaleDistribution?s(r.custom.scaleDistribution):t.L4.Linear,h=r.custom?.axisLabel?r.custom.axisLabel:u;return`${f}/${c}/${i}/${l}/${d}/${h}/${g}`}function s(r){return r.type===t.L4.Log?`${r.type}${r.log}`:r.type}},23117:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>c});var t=e(2543),n=e.n(t),o=e(96540);const s=.1,r=2,g=new Set(["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Shift"," "]),u=i=>{let l=i.root.closest("[tabindex]"),f=new Set,d=null,h=null;if(!l)return;const p=(C,y)=>{const{cursor:M}=i;if(M.left===void 0||M.top===void 0)return;const{width:T,height:I}=i.over.style,[x,S]=[Math.floor(parseFloat(T)),Math.floor(parseFloat(I))];i.setCursor({left:(0,t.clamp)(M.left+C,0,x),top:(0,t.clamp)(M.top+y,0,S)})},m=C=>{if(f.size===0||!i){h=null;return}const T=(C-(h??C))*s;let I=0,x=0;f.has("ArrowUp")&&(x-=T),f.has("ArrowDown")&&(x+=T),f.has("ArrowLeft")&&(I-=T),f.has("ArrowRight")&&(I+=T),f.has("Shift")&&(I*=r,x*=r),p(I,x);const{cursor:S}=i;if(f.has(" ")&&S){const O=Number(i.over.style.height.slice(0,-2));i.setSelect({left:S.left<d?S.left:d,top:0,width:Math.abs(S.left-(d??S.left)),height:O},!1)}h=C,window.requestAnimationFrame(m)},a=C=>{if(C.key==="Tab"){i.setCursor({left:-5,top:-5});return}if(!g.has(C.key))return;if(C.preventDefault(),C.stopPropagation(),!f.has(C.key)){const M=f.size===0;f.add(C.key),d=C.key===" "&&d===null?i.cursor.left:d,M&&window.requestAnimationFrame(m)}},v=C=>{g.has(C.key)&&(f.delete(C.key),C.key===" "&&(C.preventDefault(),C.stopPropagation(),i.setSelect(i.select),d=null))},E=()=>{if(!l?.matches(":focus-visible"))return;const C=parseFloat(i.over.style.width),y=parseFloat(i.over.style.height);i.setCursor({left:C/2,top:y/2})},D=()=>{h=null,d=null,f.clear(),i.setSelect({left:0,top:0,width:0,height:0},!1)};l.addEventListener("keydown",a),l.addEventListener("keyup",v),l.addEventListener("focus",E),l.addEventListener("blur",D);const b=()=>{l?.removeEventListener("keydown",a),l?.removeEventListener("keyup",v),l?.removeEventListener("focus",E),l?.removeEventListener("blur",D),l=null};(i.hooks.destroy??=[]).push(b)},c=({config:i})=>((0,o.useLayoutEffect)(()=>i.addHook("init",u),[i]),null)},16615:(Q,A,e)=>{"use strict";e.d(A,{T:()=>E,n:()=>b});var t=e(32196),n=e(96540),o=e(1604),s=e(94624),r=e(57875),g=e(24293),u=e(28240),c=e(83195),i=e(11261),l=e(14588),f=e(52622),d=e(40845),h=e(17464),p=e(3139),m=e(69503),a=e(16895);const v=10,E=({mode:y=f.$N.Single,sortOrder:M=f.xB.None,sync:T,timeZone:I,config:x,renderTooltip:S,...O})=>{const P=(0,n.useRef)(),L=(0,d.$j)(),[U,R]=(0,n.useState)(null),[B,H]=(0,n.useState)(null),[w,N]=(0,n.useState)([]),[V,G]=(0,n.useState)(null),[_,K]=(0,n.useState)(!1),j=(0,o.A)();let k=null;const Y="TooltipPlugin",ee=(0,d.of)(C);if((0,n.useEffect)(()=>{(0,a.uY)(Y,!0,`Focused series: ${U}, focused point: ${B}`)},[B,U]),(0,n.useLayoutEffect)(()=>{let te;const oe=()=>{j()&&(K(!0),P.current?.root.classList.add("plot-active"))},ue=()=>{j()&&(G(null),K(!1),P.current?.root.classList.remove("plot-active"))};x.addHook("syncRect",(ge,he)=>te=he),x.addHook("init",ge=>{P.current=ge,ge.over.addEventListener("mouseenter",oe),ge.over.addEventListener("mouseleave",ue),k=ge.root.closest("[tabindex]"),k&&(k.addEventListener("focus",oe),k.addEventListener("blur",ue)),T&&T()===s.y.Crosshair&&ge.root.classList.add("shared-crosshair")});const ie=x.getTooltipInterpolator();return ie?x.addHook("setCursor",ge=>{ie(R,H,he=>{if(he){G(null);return}if(!te)return;const{x:De,y:pe}=b(ge,te);De!==void 0&&pe!==void 0&&G({x:De,y:pe})},ge)}):(x.addHook("setLegend",ge=>{j()&&(H(ge.legend.idx),N(ge.legend.idxs.slice()))}),x.addHook("setCursor",ge=>{if(!te||!j())return;const{x:he,y:De}=b(ge,te);G(he!==void 0&&De!==void 0?{x:he,y:De}:null)}),x.addHook("setSeries",(ge,he)=>{j()&&R(he)})),()=>{G(null),P.current&&(P.current.over.removeEventListener("mouseleave",ue),P.current.over.removeEventListener("mouseenter",oe),k&&(k.removeEventListener("focus",oe),k.removeEventListener("blur",ue)))}},[x,G,K,H,N]),B===null||!_&&T&&T()===s.y.Crosshair)return null;let re=O.data.fields[0];if(!re)return null;const J=re.display||(0,r.J)({field:re,timeZone:I,theme:L});let ne=null,q=J(re.values[B]).text;if(S)ne=S(O.data,U,B);else{if(y===f.$N.Single&&U!==null){const te=O.data.fields[U];if(!te)return null;const oe=w?.[U]??B;q=J(re.values[oe]).text;const ie=(te.display||(0,r.J)({field:te,timeZone:I,theme:L}))(te.values[oe]);ne=n.createElement(p.o,{series:[{color:ie.color||g.F,label:(0,u.Ct)(te,O.data,O.frames),value:ie?(0,c.cN)(ie):null}],timestamp:q})}if(y===f.$N.Multi){let te=[];const oe=O.data,ue=oe.fields,ie=[];for(let ge=0;ge<ue.length;ge++){const he=oe.fields[ge];if(!he||he===re||he.type===i.PU.time||he.type!==i.PU.number||he.config.custom?.hideFrom?.tooltip||he.config.custom?.hideFrom?.viz)continue;const De=O.data.fields[ge].values[w[ge]],pe=he.display(De);ie.push(De),te.push({color:pe.color||g.F,label:(0,u.Ct)(he,oe,O.frames),value:pe?(0,c.cN)(pe):null,isActive:U===ge})}if(M!==f.xB.None){const ge=[...te],he=l.sortValues(M);te.sort((De,pe)=>{const le=ge.indexOf(De),Te=ge.indexOf(pe);return he(ie[le],ie[Te])})}ne=n.createElement(p.o,{series:te,timestamp:q})}}return n.createElement(h.ZL,{className:_?ee.tooltipWrapper:void 0},ne&&V&&n.createElement(m.o,{position:{x:V.x,y:V.y},offset:{x:v,y:v}},ne))};function D({left:y,top:M},T){return y===void 0||M===void 0?!1:y<0||y>T.width||M<0||M>T.height}function b(y,M){let T,I;const x=y.cursor.left||0,S=y.cursor.top||0;if(D(y.cursor,M)){const O=y.posToIdx(x);if(S<0||S>M.height){let P=(0,a.sw)(y,O);P&&(I=M.top+P,x>=0&&x<=M.width&&(T=M.left+y.valToPos(y.data[0][y.posToIdx(x)],y.series[0].scale)))}}else T=M.left+x,I=M.top+S;return{x:T,y:I}}const C=y=>({tooltipWrapper:(0,t.css)({"z-index":y.zIndex.portal+1+" !important"})})},77455:(Q,A,e)=>{"use strict";e.d(A,{b3:()=>d,xl:()=>v});var t=e(32196),n=e(96540),o=e(40961),s=e(40845),r=e(18348),g=e(29158);const u=({onClick:D,"aria-label":b,style:C})=>{const y=(0,s.of)(c);return n.createElement(g.K,{"aria-label":b??"Close",className:y,name:"times",onClick:D,style:C})},c=D=>(0,t.css)({position:"absolute",margin:"0px",right:D.spacing(1),top:D.spacing(1.25)}),i=void 0,l=void 0,f=10;var d=(D=>(D[D.xOne=0]="xOne",D[D.xAll=1]="xAll",D[D.xyOne=2]="xyOne",D))(d||{});function h(D,b){return{...D,...b,style:{...D.style,...b.style}}}const p={style:{transform:"",pointerEvents:"none"},isHovering:!1,isPinned:!1,contents:null,plot:null,dismiss:()=>{}},m=5,a=D=>D!=null&&!D.ctrlKey&&!D.metaKey,v=({config:D,hoverMode:b,render:C,clientZoom:y=!1,queryZoom:M,maxWidth:T,maxHeight:I})=>{const x=(0,n.useRef)(null),[{plot:S,isHovering:O,isPinned:P,contents:L,style:U,dismiss:R},B]=(0,n.useReducer)(h,p),{boostZIndex:H}=(0,n.useContext)(r.N);(0,n.useEffect)(()=>P?H():void 0,[P]);const w=(0,n.useRef)();T=P?i:T??i,I??=l;const N=(0,s.of)(E,T,I),V=(0,n.useRef)(C);return V.current=C,(0,n.useLayoutEffect)(()=>{w.current={width:0,height:0,observer:new ResizeObserver(Ee=>{let Re=w.current;for(const me of Ee)me.borderBoxSize?.length>0?(Re.width=me.borderBoxSize[0].inlineSize,Re.height=me.borderBoxSize[0].blockSize):(Re.width=me.contentRect.width,Re.height=me.contentRect.height)})};let G=!1,_=!1,K=S,j=O,k=!1,Y=P,ee=U;const re=()=>{j=ue!=null||b===1&&k};let J=0,ne=0,q={lft:0,top:0,rgt:screen.width,btm:screen.height},te=null,oe=S?.cursor.idxs.slice(),ue=null,ie=!1,ge=!1,he=!1;const De=(Ee=!1)=>{ge||(j?queueMicrotask(le):setTimeout(le,100),ge=!0),Ee&&(he=!0)},pe=Ee=>{x.current.contains(Ee.target)||Te()},le=()=>{ge=!1,he&&(ee={pointerEvents:Y?"all":"none"},K.cursor._lock=Y,Y?(document.addEventListener("mousedown",pe,!0),document.addEventListener("keydown",pe,!0)):(document.removeEventListener("mousedown",pe,!0),document.removeEventListener("keydown",pe,!0)),he=!1);let Ee={style:ee,isPinned:Y,isHovering:j,contents:j||te!=null?V.current(K,oe,ue,Y,Te,te,ie):null,dismiss:Te};B(Ee),te=null,ie=!1},Te=()=>{let Ee=Y;Y=!1,j=!1,K.setCursor({left:-10,top:-10}),De(Ee)};D.addHook("init",Ee=>{B({plot:K=Ee}),y&&Ee.over.addEventListener("mousedown",Me=>{if(a(Me)&&Me.button===0&&Me.shiftKey){_=!0,Ee.cursor.drag.x=!1,Ee.cursor.drag.y=!0;let ye=Le=>{Ee.cursor.drag.x=!0,Ee.cursor.drag.y=!1,document.removeEventListener("mouseup",ye,!0)};document.addEventListener("mouseup",ye,!0)}},!0),Ee.over.addEventListener("click",Me=>{if(Me.target===Ee.over)if(Me.ctrlKey||Me.metaKey){let ye=Ee.posToVal(Ee.cursor.left,"x");te={from:ye,to:ye},De(!1)}else j&&ue!=null&&!Y&&setTimeout(()=>{Y=!0,De(!0)},0)});const Re="pageContent",me=16;Ee.over.addEventListener("mouseenter",()=>{let Me=document.documentElement,ye=Me.clientWidth-me,Le=Me.clientHeight-me,We=0,Be=0,Ye=ye,at=Le,st=Ee.root;for(;st!=null&&st.id!==Re;){let Ke=getComputedStyle(st),Xe=Ke.getPropertyValue("overflow-x"),He=Ke.getPropertyValue("overflow-y");if(Xe!=="visible"||He!=="visible"){let Ge=st.getBoundingClientRect();We=Math.max(Ge.x,We),Be=Math.max(Ge.y,Be),Ye=Math.min(We+Ge.width,Ye),at=Math.min(Be+Ge.height,at);break}st=st.parentElement}q.lft=We,q.top=Be,q.rgt=Ye,q.btm=at},{capture:!0})}),D.addHook("setSelect",Ee=>{if(y||M!=null)if(a(Ee.cursor.event)){if(y&&_){if(Ee.select.height>=m){for(let Re in Ee.scales)if(Re!=="x"){const me=Ee.posToVal(Ee.select.top,Re),Me=Ee.posToVal(Ee.select.top+Ee.select.height,Re);Ee.setScale(Re,{min:Me,max:me})}G=!0}_=!1}else if(M!=null&&Ee.select.width>=m){const Re=Ee.posToVal(Ee.select.left,"x"),me=Ee.posToVal(Ee.select.left+Ee.select.width,"x");M({from:Re,to:me}),G=!1}}else te={from:Ee.posToVal(Ee.select.left,"x"),to:Ee.posToVal(Ee.select.left+Ee.select.width,"x")},De(!0);Ee.setSelect({left:0,width:0,top:0,height:0},!1)}),(y||M!=null)&&D.setCursor({bind:{dblclick:Ee=>()=>{if(!a(Ee.cursor.event))return null;if(y&&G){for(let Re in Ee.scales)Re!=="x"&&Ee.setScale(Re,{min:null,max:null});G=!1}else if(M!=null){let Re=Ee.scales.x;const me=Re.min,Me=Re.max,ye=(Me-me)/2;M({from:me-ye,to:Me+ye})}return null}}}),D.addHook("setData",Ee=>{G=!1,_=!1}),D.addHook("setSeries",(Ee,Re)=>{ue=Re,re(),De()}),D.addHook("setLegend",Ee=>{oe=K?.cursor.idxs.slice(),k=oe.some((Re,me)=>me>0&&Re!=null),re(),De()}),D.addHook("setCursor",Ee=>{let{left:Re=-10,top:me=-10,event:Me}=Ee.cursor;if(Re>=0||me>=0){ie=Me==null;let ye="";if(ie)ye=`translateX(${Re}px) translateY(${Ee.rect.height/2}px) translateY(-50%)`;else{let{width:Le,height:We}=w.current;Le+=f,We+=f;let Be=Ee.rect.left+Re,Ye=Ee.rect.top+me;ne!==0?Ye+We<q.btm||Ye-We<0?ne=0:ne!==-We&&(ne=-We):Ye+We>q.btm&&Ye-We>=0&&(ne=-We),J!==0?Be+Le<q.rgt||Be-Le<0?J=0:J!==-Le&&(J=-Le):Be+Le>q.rgt&&Be-Le>=0&&(J=-Le);const at=Re+(J===0?f:-f),st=me+(ne===0?f:-f);ye=`translateX(${at}px) ${J===0?"":"translateX(-100%)"} translateY(${st}px) ${ne===0?"":"translateY(-100%)"}`}j&&(x.current!=null?x.current.style.transform=ye:(ee.transform=ye,De()))}})},[D]),(0,n.useLayoutEffect)(()=>{const G=w.current;if(x.current!=null){G.observer.observe(x.current);const{width:_,height:K}=x.current.getBoundingClientRect();G.width=_,G.height=K;let j=S.cursor.event;if(j!=null){const k=j.type!=="mousemove";k&&(j=new MouseEvent("mousemove",{view:window,bubbles:!0,cancelable:!0,clientX:j.clientX,clientY:j.clientY,screenX:j.screenX,screenY:j.screenY})),!(k?!1:performance.now()-j.timeStamp>16)&&S.over.dispatchEvent(j)}else S.setCursor({left:S.cursor.left,top:S.cursor.top},!0)}else G.width=0,G.height=0},[O]),S&&O?(0,o.createPortal)(n.createElement("div",{className:(0,t.cx)(N.tooltipWrapper,P&&N.pinned),style:U,ref:x},P&&n.createElement(u,{onClick:R}),L),S.over):null},E=(D,b,C)=>({tooltipWrapper:(0,t.css)({top:0,left:0,zIndex:D.zIndex.tooltip,whiteSpace:"pre",borderRadius:D.shape.radius.default,position:"absolute",background:D.colors.background.primary,border:`1px solid ${D.colors.border.weak}`,boxShadow:D.shadows.z2,userSelect:"text",maxWidth:b??"none",maxHeight:C??"none",overflowY:"auto"}),pinned:(0,t.css)({boxShadow:D.shadows.z3})})},10175:(Q,A,e)=>{"use strict";e.d(A,{j:()=>s});var t=e(96540);const n=5,o=r=>r!=null&&!r.ctrlKey&&!r.metaKey,s=({onZoom:r,config:g,withZoomY:u=!1})=>((0,t.useLayoutEffect)(()=>{let c=!1,i=!1;u&&g.addHook("init",l=>{l.over.addEventListener("mousedown",f=>{if(o(f)&&f.button===0&&f.shiftKey){i=!0,l.cursor.drag.x=!1,l.cursor.drag.y=!0;let d=h=>{l.cursor.drag.x=!0,l.cursor.drag.y=!1,document.removeEventListener("mouseup",d,!0)};document.addEventListener("mouseup",d,!0)}},!0)}),g.addHook("setSelect",l=>{if(o(l.cursor.event)){if(u&&i){if(l.select.height>=n){for(let f in l.scales)if(f!=="x"){const d=l.posToVal(l.select.top,f),h=l.posToVal(l.select.top+l.select.height,f);l.setScale(f,{min:h,max:d})}c=!0}i=!1}else if(l.select.width>=n){const f=l.posToVal(l.select.left,"x"),d=l.posToVal(l.select.left+l.select.width,"x");r({from:f,to:d}),c=!1}}l.setSelect({left:0,width:0,top:0,height:0},!1)}),g.setCursor({bind:{dblclick:l=>()=>{if(!o(l.cursor.event))return null;if(u&&c){for(let f in l.scales)f!=="x"&&l.setScale(f,{min:null,max:null});c=!1}else{let f=l.scales.x;const d=f.min,h=f.max,p=(h-d)/2;r({from:d-p,to:h+p})}return null}}})},[g]),null)},66737:(Q,A,e)=>{"use strict";e.d(A,{Tk:()=>n.T,Z7:()=>s.Z,jn:()=>t.j,xl:()=>o.xl});var t=e(10175),n=e(16615),o=e(77455),s=e(23117)},52811:(Q,A,e)=>{"use strict";e.d(A,{R:()=>n,s:()=>t});const t="__fixed";class n{constructor(s){this.props=s}}},16895:(Q,A,e)=>{"use strict";e.d(A,{NN:()=>l,Tz:()=>d,bq:()=>p,ro:()=>h,sw:()=>m,uY:()=>D});var t=e(11261),n=e(50311),o=e(52622),s=e(40621),r=e(91040),g=e(55129);const u=/\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 c(b){return b.replace(u,C=>`{${C}}`)}const i=(b,C,y)=>{let M=C%2?y[0]||y[2]:y[1]||y[3];return y[C]||!M?0:8},l={ms:1,focus:{alpha:1},cursor:{focus:{prox:30}},legend:{show:!1},padding:[i,i,i,i],series:[],hooks:{}};var f=(b=>(b[b.Pos=1]="Pos",b[b.Neg=-1]="Neg",b))(f||{});function d(b){let C=[],{series:y,dir:M}=b,T=y.length-1,I=y.slice().reverse();return I.forEach((x,S)=>{if(S!==T){let O=I[S+1];C.push({series:[x,O],dir:-1*M})}}),C}function h(b){let C=new Map;return b.fields.forEach(({config:y,values:M,type:T},I)=>{if(I===0)return;let{custom:x}=y;if(x==null||x.hideFrom?.viz)return;let{stacking:S}=x;if(S==null)return;let{mode:O,group:P}=S;if(O===o.gs.None)return;let L=x.transform,U=a(L,M),R=x.drawStyle,B=R===o.GR.Bars?x.barAlignment:R===o.GR.Line?x.lineInterpolation:null,H=`${U}|${O}|${P}|${(0,g.M)(y,T)}|${R}|${B}`,w=C.get(H);w==null&&(w={series:[],dir:U},C.set(H,w)),w.series.push(I)}),[...C.values()]}function p(b,C,y){let M=Array(b.fields.length),T=C.length,I=b.length,x=T>0?Array(I).fill(0):[],S=T>0?Array(I).fill(!1):[],O=Array.from({length:T},()=>x.slice()),P=Array.from({length:T},()=>S.slice());if(C.forEach((L,U)=>{let R=P[U];L.series.forEach(B=>{let H=b.fields[B];if(H.config.custom?.hideFrom?.viz)return;let w=H.values;for(let N=0;N<I;N++)w[N]!=null&&(R[N]=!0)})}),b.fields.forEach((L,U)=>{let R=L.values;if(U===0){L.type===t.PU.time?M[U]=(0,n.ks)(L).values:M[U]=R;return}let{custom:B}=L.config;if(!B||B.hideFrom?.viz){M[U]=R;return}if(B.transform===o.NU.Constant){let w=R.findIndex(V=>V!=null),N=R[w];R=Array(R.length).fill(void 0),R[w]=N}else if(R=R.slice(),B.transform===o.NU.NegativeY)for(let w=0;w<R.length;w++)R[w]!=null&&(R[w]*=-1);let H=B.stacking?.mode;if(!H||H===o.gs.None)M[U]=R;else{let w=C.findIndex(_=>_.series.indexOf(U)>-1),N=O[w],V=P[w],G=M[U]=Array(I);for(let _=0;_<I;_++){let K=R[_];K!=null?G[_]=N[_]+=K:G[_]=V[_]?N[_]:K}}}),y){let L=M.map((U,R)=>{let B=C.findIndex(H=>H.series.indexOf(R)>-1);return B!==-1?O[B]:U});y({totals:L})}return b.fields.forEach((L,U)=>{if(U===0||L.config.custom?.hideFrom?.viz)return;if(L.config.custom?.stacking?.mode===o.gs.Percent){let B=C.findIndex(V=>V.series.indexOf(U)>-1),H=O[B],w=C[B],N=M[U];for(let V=0;V<I;V++){let G=N[V];G!=null&&(N[V]=H[V]===0?0:w.dir*(G/H[V]))}}}),M}function m(b,C){let y,M=1,T=1,I=b.data[1][C],x=b.data[1][C];for(let S=1;S<b.data.length;S++){const P=b.data[S][C];P!=null&&(I==null?I=P:P>I&&(I=b.data[S][C],M=S),x==null?x=P:P<x&&(x=b.data[S][C],T=S))}return x==null&&I==null?y=void 0:x!=null&&I!=null?y=(b.valToPos(x,b.series[T].scale)+b.valToPos(I,b.series[M].scale))/2:y=b.valToPos(x||I,b.series[M||T].scale),y!==void 0&&y<0&&(y=b.bbox.height/devicePixelRatio),y}function a(b,C){const y=v(C);return b===o.NU.NegativeY?y?1:-1:y?-1:1}function v(b,C=100){const y=b.length;if(y===0)return!1;let M=0,T=y-1;for(;M<=T&&b[M]==null;)M++;for(;T>=M&&b[T]==null;)T--;let I=0,x=0;if(T>=M){const S=Math.max(1,Math.floor((T-M+1)/C));for(let O=M;O<=T;O+=S){const P=b[O];P!=null&&typeof P=="number"&&(P<0||Object.is(P,-0)?I++:P>0&&x++)}if(I>x)return!0}return!1}const E=(0,r.h)("uPlot"),D=E.logger;(0,s.h)("graphng",void 0,E)},48747:(Q,A,e)=>{"use strict";e.d(A,{T:()=>a});var t=e(34796),n=e.n(t),o=e(2543),s=e(96540),r=e(61443),g=e(52622),u=e(75128),c=e(33083),i=e(3139),l=e(65036);const f=({dimensions:E,activeDimensions:D,pos:b,timeZone:C})=>{let y=null;if(D.xAxis===null)return null;D.yAxis&&(y=D.yAxis[0]);const M=D.xAxis[1]?(0,r.WK)(E.xAxis,D.xAxis[0],D.xAxis[1]):b.x,T=(0,l.DU)(E.yAxis.columns,E.xAxis.columns,M,C),I=T.time,x=T.results.map((S,O)=>({color:S.color,label:S.label,value:S.value,isActive:y===O}));return s.createElement(i.o,{series:x,timestamp:I})};f.displayName="MultiModeGraphTooltip";var d=e(83195),h=e(28240);const p=({dimensions:E,activeDimensions:D,timeZone:b})=>{if(D.yAxis===null||D.yAxis[1]===void 0||D.xAxis===null||D.xAxis[1]===void 0)return null;const C=(0,r.WK)(E.xAxis,D.xAxis[0],D.xAxis[1]),y=(0,r.P4)(E.xAxis,D.xAxis[0]),M=y.display?(0,d.cN)(y.display(C)):C,T=(0,r.P4)(E.yAxis,D.yAxis[0]),I=(0,r.WK)(E.yAxis,D.yAxis[0],D.yAxis[1]),x=T.display,S=x(I);return s.createElement(i.o,{series:[{color:S.color,label:(0,h.Ct)(T),value:(0,d.cN)(S)}],timestamp:M})};p.displayName="SingleModeGraphTooltip";const m=({mode:E=g.$N.Single,dimensions:D,activeDimensions:b,pos:C,timeZone:y})=>!b||!b.xAxis?null:E==="single"?s.createElement(p,{dimensions:D,activeDimensions:b,timeZone:y}):s.createElement(f,{dimensions:D,activeDimensions:b,pos:C,timeZone:y});m.displayName="GraphTooltip";class a extends s.PureComponent{constructor(){super(...arguments),this.state={isTooltipVisible:!1,isContextVisible:!1},this.element=null,this.$element=null,this.onPlotSelected=(D,b)=>{const{onHorizontalRegionSelected:C}=this.props;C&&C(b.xaxis.from,b.xaxis.to)},this.onPlotHover=(D,b,C)=>{this.setState({isTooltipVisible:!0,activeItem:C,pos:b})},this.onPlotClick=(D,b,C)=>{this.setState({isContextVisible:!0,isTooltipVisible:!1,contextItem:C,contextPos:b})},this.renderTooltip=()=>{const{children:D,series:b,timeZone:C}=this.props,{pos:y,activeItem:M,isTooltipVisible:T}=this.state;let I;if(!T||!y||b.length===0||(s.Children.forEach(D,H=>{if(I)return;(H&&H.type&&(H.type.displayName||H.type.name))===u.n.displayName&&(I=H)}),!I))return null;const x=I.props,S=x.mode||"single";if(!M&&S==="single")return null;const O=x.tooltipComponent||m,P=M?M.series.seriesIndex:0,L=M?M.dataIndex:void 0,U={xAxis:[P,L],yAxis:M?[M.series.seriesIndex,M.dataIndex]:null},R={dimensions:{xAxis:(0,r.r4)("xAxis",b.map(H=>H.timeField)),yAxis:(0,r.r4)("yAxis",b.map(H=>H.valueField))},activeDimensions:U,pos:y,mode:x.mode||g.$N.Single,timeZone:C},B=s.createElement(O,{...R});return s.cloneElement(I,{content:B,position:{x:y.pageX,y:y.pageY},offset:{x:10,y:10}})},this.renderContextMenu=()=>{const{series:D}=this.props,{contextPos:b,contextItem:C,isContextVisible:y}=this.state;if(!y||!b||!C||D.length===0)return null;const M=C?C.series.seriesIndex:0,T=C?C.dataIndex:void 0,I={xAxis:[M,T],yAxis:C?[C.series.seriesIndex,C.dataIndex]:null},x={xAxis:(0,r.r4)("xAxis",D.map(L=>L.timeField)),yAxis:(0,r.r4)("yAxis",D.map(L=>L.valueField))},S=()=>this.setState({isContextVisible:!1}),O=()=>({datapoint:C.datapoint,dataIndex:C.dataIndex,series:C.series,seriesIndex:C.series.seriesIndex,pageX:b.pageX,pageY:b.pageY}),P={x:b.pageX,y:b.pageY,onClose:S,getContextMenuSource:O,timeZone:this.props.timeZone,dimensions:x,contextDimensions:I};return s.createElement(c.H,{...P})},this.getBarWidth=()=>{const{series:D}=this.props;return Math.min(...D.map(b=>b.timeStep))}}componentDidUpdate(D,b){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,o.uniqBy)(D.map(b=>{const C=b.yAxis?b.yAxis.index:1,y=b.yAxis&&b.yAxis.min&&!isNaN(b.yAxis.min)?b.yAxis.min:null,M=b.yAxis&&b.yAxis.tickDecimals&&!isNaN(b.yAxis.tickDecimals)?b.yAxis.tickDecimals:null;return{show:!0,index:C,position:C===1?"left":"right",min:y,tickDecimals:M}}),b=>b.index)}draw(){if(this.element===null)return;const{width:D,series:b,timeRange:C,showLines:y,showBars:M,showPoints:T,isStacked:I,lineWidth:x,timeZone:S,onHorizontalRegionSelected:O}=this.props;if(!D)return;const P=D/100,L=C.from.valueOf(),U=C.to.valueOf(),R=this.getYAxes(b),B={legend:{show:!1},series:{stack:I,lines:{show:y,lineWidth:x,zero:!1},points:{show:T,fill:1,fillColor:!1,radius:2},bars:{show:M,fill:1,barWidth:M?this.getBarWidth()/1.5:1,zero:!1,lineWidth:x},shadowSize:0},xaxis:{timezone:S,show:!0,mode:"time",min:L,max:U,label:"Datetime",ticks:P,timeformat:(0,l.Jc)(P,L,U),tickFormatter:l.Yn},yaxes:R,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,b.filter(H=>H.isVisible),B)}catch(H){throw console.error("Graph rendering error",H,B,b),new Error("Error rendering panel")}}render(){const{ariaLabel:D,height:b,width:C,series:y}=this.props,M=y.length===0,T=this.renderTooltip(),I=this.renderContextMenu();return s.createElement("div",{className:"graph-panel","aria-label":D},s.createElement("div",{className:"graph-panel__chart",ref:x=>this.element=x,style:{height:b,width:C},onMouseLeave:()=>{this.setState({isTooltipVisible:!1})}}),M&&s.createElement("div",{className:"datapoints-warning"},"No data"),T,I)}}a.defaultProps={showLines:!0,showPoints:!1,showBars:!1,isStacked:!1,lineWidth:1};const v=null},33083:(Q,A,e)=>{"use strict";e.d(A,{H:()=>d,i:()=>h});var t=e(32196),n=e(96540),o=e(61443),s=e(72724),r=e(28122),g=e(9286),u=e(66864),c=e(59093),i=e(64539),l=e(94536),f=e(40845);const d=({getContextMenuSource:m,timeZone:a,itemsGroup:v,dimensions:E,contextDimensions:D,...b})=>{const C=m(),y=v?v.map(I=>({...I,items:I.items?.filter(x=>x.label)})):[],M=()=>{if(!C)return null;let I;if(E?.yAxis&&D?.yAxis?.[1]){const S=(0,o.WK)(E.yAxis,D.yAxis[0],D.yAxis[1]),O=C.series.valueField.display;I=O(S)}const x=(0,s.LE)(C.datapoint[0],{defaultWithMS:C.series.hasMsResolution,timeZone:a});return n.createElement(h,{timestamp:x,seriesColor:C.series.color,displayName:C.series.alias||C.series.label,displayValue:I})},T=()=>y?.map((I,x)=>n.createElement(c.r,{key:`${I.label}${x}`,label:I.label},(I.items||[]).map(S=>n.createElement(i.D,{key:`${S.label}`,url:S.url,label:S.label,target:S.target,icon:S.icon,active:S.active,onClick:S.onClick}))));return n.createElement(r.t,{...b,renderMenuItems:T,renderHeader:M})},h=({timestamp:m,seriesColor:a,displayName:v,displayValue:E})=>{const D=(0,f.of)(p);return n.createElement("div",{className:D.wrapper},n.createElement("strong",null,m),n.createElement(u.Gy,null,n.createElement("div",null,n.createElement(l.p,{color:a}),n.createElement("span",{className:D.displayName},v)),E&&n.createElement(g.i,{value:E})))};function p(m){return{wrapper:(0,t.css)({padding:m.spacing(.5,1),fontSize:m.typography.size.sm,zIndex:m.zIndex.tooltip}),displayName:(0,t.css)({whiteSpace:"nowrap",paddingLeft:m.spacing(.5)})}}},84656:(Q,A,e)=>{"use strict";e.d(A,{M:()=>s});var t=e(2543),n=e.n(t),o=e(96540);class s extends o.Component{constructor(g){super(g),this.onSeriesToggle=this.onSeriesToggle.bind(this),this.state={hiddenSeries:[],toggledSeries:g.series}}componentDidUpdate(g){const{series:u}=this.props;(0,t.isEqual)(g.series,u)||this.setState({hiddenSeries:[],toggledSeries:u})}onSeriesToggle(g,u){const{series:c,onHiddenSeriesChanged:i}=this.props,{hiddenSeries:l}=this.state;if(u.ctrlKey||u.metaKey||u.shiftKey){const p=l.indexOf(g)>-1?l.filter(a=>a!==g):l.concat([g]),m=c.map(a=>({...a,isVisible:p.indexOf(a.label)===-1}));this.setState({hiddenSeries:p,toggledSeries:m},()=>i?i(p):void 0);return}const f=c.map(p=>p.label),d=l.length+1===f.length?[]:(0,t.difference)(f,[g]),h=c.map(p=>({...p,isVisible:d.indexOf(p.label)===-1}));this.setState({hiddenSeries:d,toggledSeries:h},()=>i?i(d):void 0)}render(){const{children:g}=this.props,{toggledSeries:u}=this.state;return g({onSeriesToggle:this.onSeriesToggle,toggledSeries:u})}}},5484:(Q,A,e)=>{"use strict";e.d(A,{I:()=>c});var t=e(32196),n=e(96540),o=e(40276),s=e(55726),r=e(40845),g=e(48747);const u=(l,f=!1,d=!1)=>{const h=l.reduce((m,a)=>m+(a[1]||0),0)===0,p=!l.reduce((m,a)=>m&&a[1]!==null,!0);return f&&p||d&&h},c=l=>{const{series:f,timeRange:d,width:h,height:p,showBars:m,showLines:a,showPoints:v,sortLegendBy:E,sortLegendDesc:D,legendDisplayMode:b,legendVisibility:C,placement:y,onSeriesToggle:M,onToggleSort:T,hideEmpty:I,hideZero:x,isStacked:S,lineWidth:O,onHorizontalRegionSelected:P,timeZone:L,children:U,ariaLabel:R}=l,{graphContainer:B,wrapper:H,legendContainer:w}=(0,r.of)(i,l.placement),N=f.reduce((V,G)=>u(G.data,I,x)?V:V.concat([{label:G.label,color:G.color||"",disabled:!G.isVisible,yAxis:G.yAxis.index,getDisplayValues:()=>G.info||[]}]),[]);return n.createElement("div",{className:H,"aria-label":R},n.createElement("div",{className:B},n.createElement(g.T,{series:f,timeRange:d,timeZone:L,showLines:a,showPoints:v,showBars:m,width:h,height:p,isStacked:S,lineWidth:O,onHorizontalRegionSelected:P},U)),C&&n.createElement("div",{className:w},n.createElement(o.E,{hideHorizontalTrack:!0},n.createElement(s.t,{items:N,displayMode:b,placement:y,sortBy:E,sortDesc:D,onLabelClick:(V,G)=>{M&&M(V.label,G)},onToggleSort:T}))))},i=(l,f)=>({wrapper:(0,t.css)({display:"flex",flexDirection:f==="bottom"?"column":"row"}),graphContainer:(0,t.css)({minHeight:"65%",flexGrow:1}),legendContainer:(0,t.css)({padding:"10px 0",maxHeight:f==="bottom"?"35%":"none"})})},65036:(Q,A,e)=>{"use strict";e.d(A,{DU:()=>g,Jc:()=>c,Yn:()=>u});var t=e(83195),n=e(28240),o=e(72724),s=e(42994);const r=(i,l)=>{let f=0,d=i.values.length-1,h;for(;;){if(f>d)return Math.max(d,0);h=Math.floor((f+d)/2);const p=i.values[h];if(p===l)return h;p&&p<l?f=h+1:d=h-1}},g=(i,l,f,d)=>{let h,p,m,a,v;const E=[];let D,b;for(h=0;h<i.length;h++){p=i[h];const C=l[h];m=r(C,f),a=f-C.values[m],v=C.values[m],(D===void 0||a>=0&&(a<D||D<0)||a<0&&a>D)&&(D=a,b=C.display?(0,t.cN)(C.display(v)):v);const y=p.display(p.values[m]);E.push({value:(0,t.cN)(y),datapointIndex:m,seriesIndex:h,color:y.color,label:(0,n.Ct)(p),time:C.display?(0,t.cN)(C.display(v)):v})}return{results:E,time:b}},u=(i,l)=>(0,o.LE)(i,{format:l?.options?.timeformat,timeZone:l?.options?.timezone}),c=(i,l,f)=>{if(l&&f&&i){const d=f-l,h=d/i/1e3,p=86400010,m=31536e6;return h<=10?s.WC.interval.millisecond:h<=45?s.WC.interval.second:d<=p?s.WC.interval.minute:h<=8e4?s.WC.interval.hour:d<=m?s.WC.interval.day:h<=31536e3?s.WC.interval.month:s.WC.interval.year}return s.WC.interval.minute}},99755:(Q,A,e)=>{"use strict";e.d(A,{o:()=>m});var t=e(96540),n=e(64423),o=e(99165),s=e(85200),r=e(1173),g=e(11261),u=e(69129),c=e(26272),i=e(79041),l=e(67266),f=e(81297),d=e(16895),h=e(65575);function p(a,v,E=[]){for(const D of E)if(typeof D=="function"){if(!D(a,v))return!1}else if(v[D]!==a[D])return!1;return!0}class m extends t.Component{constructor(v){super(v),this.panelContext={},this.subscription=new n.yU,this.getTimeRange=()=>this.props.timeRange;let E=this.prepState(v);E.alignedData=E.config.prepData([E.alignedFrame]),this.state=E,this.plotInstance=t.createRef()}prepState(v,E=!0){let D=null;const{frames:b,fields:C,preparePlotFrame:y}=v,T=(y||h.mY)(b,C||{x:s.sJ.get(r.Ct.firstTimeField).get({}),y:s.sJ.get(r.Ct.byTypes).get(new Set([g.PU.number,g.PU.enum]))},v.timeRange);if((0,d.uY)("GraphNG",!1,"data aligned",T),T){let I=this.state?.config;E&&(I=v.prepConfig(T,this.props.frames,this.getTimeRange),(0,d.uY)("GraphNG",!1,"config prepared",I)),D={alignedFrame:T,config:I},(0,d.uY)("GraphNG",!1,"data prepared",D.alignedData)}return D}handleCursorUpdate(v){const E=v.payload?.point?.time,D=this.plotInstance.current;if(D&&E){const b=D.valToPos(E,"x");let C;if(b&&(C=(0,d.sw)(D,D.posToIdx(b))),!C||!b)return;D.setCursor({left:b,top:C})}}componentDidMount(){this.panelContext=this.context;const{eventBus:v}=this.panelContext;this.subscription.add(v.getStream(u.b_).pipe((0,o.c)(50)).subscribe({next:E=>{v!==E.origin&&this.handleCursorUpdate(E)}})),this.subscription.add(v.getStream(c.kb).pipe((0,o.c)(50)).subscribe({next:E=>this.handleCursorUpdate(E)})),this.subscription.add(v.getStream(u.ql).pipe((0,o.c)(50)).subscribe({next:()=>{const E=this.plotInstance?.current;E&&!E.cursor._lock&&E.setCursor({left:-10,top:-10})}}))}componentDidUpdate(v){const{frames:E,structureRev:D,timeZone:b,propsToDiff:C}=this.props,y=!p(v,this.props,C);if(E!==v.frames||y||b!==v.timeZone){let M=this.prepState(this.props,!1);M&&((this.state.config===void 0||b!==v.timeZone||D!==v.structureRev||!D||y)&&(M.config=this.props.prepConfig(M.alignedFrame,this.props.frames,this.getTimeRange),(0,d.uY)("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:E,children:D,renderLegend:b}=this.props,{config:C,alignedFrame:y,alignedData:M}=this.state;return C?t.createElement(l.KU,{width:v,height:E,legend:b(C)},(T,I)=>t.createElement(f.Z,{config:C,data:M,width:T,height:I,plotRef:x=>this.plotInstance.current=x},D?D(C,y):null)):null}}m.contextType=i.e4},16998:(Q,A,e)=>{"use strict";e.d(A,{I:()=>o});var t=e(96540);const n=t.createContext({}),o=()=>{const{data:s,dimFields:r,mapSeriesIndexToDataFrameFieldIndex:g}=(0,t.useContext)(n),u=(0,t.useCallback)(()=>{const c=r.x;let i=null;for(let l=0;l<s.fields.length;l++)if(c(s.fields[l],s,[s])){i=s.fields[l];break}return i},[s,r]);return{dimFields:r,mapSeriesIndexToDataFrameFieldIndex:g,getXAxisField:u,alignedData:s}}},65575:(Q,A,e)=>{"use strict";e.d(A,{My:()=>h,wX:()=>l,mY:()=>d});var t=e(11261),n=e(73060),o=e(52622),s=e(52811);const r={threshold:(m,a,v)=>m+v,midpoint:(m,a,v)=>(m+a)/2,plusone:(m,a,v)=>m+1};function g(m){if(m.frame.length===0)return m.frame;let a=!0,{frame:v,refFieldName:E,refFieldPseudoMax:D,refFieldPseudoMin:b,insertMode:C}=m;C||(C=r.threshold);const y=l(v,E);if(y==null)return v;y.state={...y.state,nullThresholdApplied:!0};const M=v.fields.map(I=>I.config.custom?.insertNulls||y.config.interval||null),T=new Set(M);if(T.delete(null),T.size===0)return v;if(T.size===1){const I=T.values().next().value;if(I<=0)return v;const x=y.values,S=v.fields.map(P=>P.values),O=u(x,S,I,b,D,C,a);return O===S?v:{...v,length:O[0].length,fields:v.fields.map((P,L)=>({...P,values:O[L]}))}}return v}function u(m,a,v,E=null,D=null,b,C){const y=m.length,M=[];if(E!=null&&E<m[0]){let S=Math.ceil((m[0]-E)/v),O=m[0]-S*v;for(;O<m[0];)M.push(b(O-v,O,v)),O+=v}M.push(m[0]);let T=m[0];for(let S=1;S<y;S++){const O=m[S];for(;O-T>v&&(M.push(b(T,O,v)),T+=v,!!C););M.push(O),T=O}if(D!=null&&D>T)for(;T+v<D;)M.push(b(T,D,v)),T+=v;const I=M.length;if(I===y)return a;const x=[];for(let S of a){let O;if(S!==m){O=Array(I);for(let P=0,L=0;P<I;P++)O[P]=m[L]===M[P]?S[L++]:null}else O=M;x.push(O)}return x}function c(m,a,v){let E,D;for(let b=0;b<a.length;b++)if(a[b]==null)D==null&&E!=null&&(D=b);else{if(D!=null){if(m[b]-E<v)for(;D<b;)a[D++]=void 0;D=null}E=m[b]}return a}function i(m){return m.type===t.PU.number&&m.config.custom?.drawStyle===o.GR.Bars&&!m.config.custom?.hideFrom?.viz}function l(m,a){return m.fields.find(v=>a!=null?v.name===a:v.type===t.PU.time)}function f(m,a){const v=l(m,a);let E=v?.values;for(let D=0;D<m.fields.length;D++){let b=m.fields[D];if(b===v||i(b))continue;let C=b.config.custom?.spanNulls;typeof C=="number"&&C!==-1&&E&&(b.values=c(E,b.values,C))}return m}function d(m,a,v){let E;e:for(let y of m)for(let M of y.fields)if(a.x(M,y,m)){E=M;break e}m=m.map(y=>E?.state?.nullThresholdApplied?y:g({frame:y,refFieldName:E.name,refFieldPseudoMin:v?.from.valueOf(),refFieldPseudoMax:v?.to.valueOf()}));let D=0;m.forEach(y=>{y.fields.forEach(M=>{i(M)&&(M.config.custom={...M.config.custom,spanNulls:-1},D++)})});let b=1/0;D>1&&m.forEach(y=>{if(!y.fields.some(i))return;const M=E.values;for(let T=0;T<M.length;T++)T>0&&(b=Math.min(b,M[T]-M[T-1]))});let C=(0,n.Fd)({frames:m,joinBy:a.x,keep:a.y,keepOriginIndices:!0});return C?(C=f(C,E.name),b!==1/0&&(C.fields.forEach((y,M)=>{let T=y.values;if(M===0){let I=T[T.length-1];T.push(I+b,I+2*b)}else i(y)?T.push(null,null):T.push(void 0,void 0)}),C.length+=2),C):null}function h(m,a){const v="na",E=`${m.min!==void 0?m.min:v}-${m.max!==void 0?m.max:v}`,D=`${m.custom?.axisSoftMin!==void 0?m.custom.axisSoftMin:v}-${m.custom?.axisSoftMax!==void 0?m.custom.axisSoftMax:v}`,b=`${m.custom?.axisPlacement!==void 0?m.custom?.axisPlacement:o.vM.Auto}`,C=m.unit??s.s,y=m.custom?.scaleDistribution?p(m.custom.scaleDistribution):o.L4.Linear,M=m.custom?.axisLabel?m.custom.axisLabel:v;return`${C}/${E}/${D}/${b}/${y}/${M}/${a}`}function p(m){return m.type===o.L4.Log?`${m.type}${m.log}`:m.type}},18262:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>P});var t=e(96540),n=e(79041),o=e(24182),s=e(40845),r=e(99755),g=e(2543),u=e(36613),c=e(11261),i=e(83195),l=e(57875),f=e(8066),d=e(24293),h=e(28240),p=e(94624),m=e(69129),a=e(52622),v=e(51336),E=e(74863),D=e(16895),b=e(65575);const C=new Set(["bytes","bits","kbytes","mbytes","gbytes","tbytes","pbytes","binBps","binbps","KiBs","Kibits","MiBs","Mibits","GiBs","Gibits","TiBs","Tibits","PiBs","Pibits"]),y=Array(53);for(let L=0;L<y.length;L++)y[L]=2**L;const M=(L,U=1)=>L==null?"-":L.toFixed(U),T={drawStyle:a.GR.Line,showPoints:a.yL.Auto,axisPlacement:a.vM.Auto},I=({frame:L,theme:U,timeZones:R,getTimeRange:B,eventBus:H,sync:w,allFrames:N,renderers:V,tweakScale:G=j=>j,tweakAxis:_=j=>j,eventsScope:K="__global_"})=>{const j=new v.e(R[0]);let k;j.setPrepData(he=>(k=he[0],(0,D.bq)(he[0],j.getStackingGroups())));const Y=L.fields[0];if(!Y)return j;const ee="x";let re="_x",J="";const ne=Y.config.custom?.axisPlacement!==a.vM.Hidden?a.vM.Bottom:a.vM.Hidden,q=Y.config.custom?.axisPlacement!==a.vM.Hidden;if(Y.type===c.PU.time){re="time",j.addScale({scaleKey:ee,orientation:a.Lt.Horizontal,direction:a.ON.Right,isTime:!0,range:()=>{const De=B();return[De.from.valueOf(),De.to.valueOf()]}});const he=R.length>1?(De,pe)=>pe.map((le,Te)=>Te<2?null:le):void 0;for(let De=0;De<R.length;De++){const pe=R[De];j.addAxis({scaleKey:ee,isTime:!0,placement:ne,show:q,label:Y.config.custom?.axisLabel,timeZone:pe,theme:U,grid:{show:De===0&&Y.config.custom?.axisGridShow},filter:he})}R.length>1&&j.addHook("drawAxes",De=>{De.ctx.save(),De.ctx.fillStyle=U.colors.text.primary,De.ctx.textAlign="left",De.ctx.textBaseline="bottom";let pe=0;De.axes.forEach(le=>{if(le.side===2){let Te=le._pos+le._size;De.ctx.fillText(R[pe],De.bbox.left,Te*u.A.pxRatio),pe++}}),De.ctx.restore()})}else Y.config.unit&&(re=Y.config.unit),j.addScale({scaleKey:ee,orientation:a.Lt.Horizontal,direction:a.ON.Right,range:(he,De,pe)=>[Y.config.min??De,Y.config.max??pe]}),j.addAxis({scaleKey:ee,placement:ne,show:q,label:Y.config.custom?.axisLabel,theme:U,grid:{show:Y.config.custom?.axisGridShow},formatValue:(he,De)=>(0,i.cN)(Y.display(he,De))});let te=V?.flatMap(he=>Object.values(he.fieldMap).filter(De=>he.indicesOnly.indexOf(De)===-1))??[],oe;for(let he=1;he<L.fields.length;he++){const De=L.fields[he],pe={...De.config,custom:{...T,...De.config.custom}},le=pe.custom;if(De===Y||De.type!==c.PU.number&&De.type!==c.PU.enum)continue;let Te=De.display??M;De.config.custom?.stacking?.mode===a.gs.Percent&&(Te=(0,l.J)({field:{...De,config:{...De.config,unit:"percentunit"}},theme:U}));const Ee=(0,b.My)(pe,De.type),Re=(0,f.Qi)(De),Me=(0,f.lz)(De,U).color;if(j.addScale(G({scaleKey:Ee,orientation:a.Lt.Vertical,direction:a.ON.Up,distribution:le.scaleDistribution?.type,log:le.scaleDistribution?.log,linearThreshold:le.scaleDistribution?.linearThreshold,min:De.config.min,max:De.config.max,softMin:le.axisSoftMin,softMax:le.axisSoftMax,centeredZero:le.axisCenteredZero,range:le.stacking?.mode===a.gs.Percent?(st,Ke,Xe)=>(Ke=Ke<0?-1:0,Xe=Xe>0?1:0,[Ke,Xe]):De.type===c.PU.enum?(st,Ke,Xe)=>[-1,De.config.type.enum.text.length]:void 0,decimals:De.config.decimals},De)),J||(J=Ee),le.axisPlacement!==a.vM.Hidden){let st;le.axisColorMode===a.Y$.Series&&(Re.isByValue&&De.config.custom?.gradientMode===a.on.Scheme&&Re.id===d.Y.Thresholds?st=(0,E.pl)(1,U,Re,De.config.thresholds):st=Me);const Ke={border:{show:le.axisBorderShow||!1,width:1/devicePixelRatio,stroke:st||U.colors.text.primary},ticks:{show:le.axisBorderShow||!1,stroke:st||U.colors.text.primary},color:st||U.colors.text.primary};let Xe,He,Ge;if(C.has(pe.unit))Xe=y;else if(De.type===c.PU.enum){let xe=De.config.type.enum.text;Ge=xe.map(($e,be)=>be),He=xe}j.addAxis(_({scaleKey:Ee,label:le.axisLabel,size:le.axisWidth,placement:le.axisPlacement??a.vM.Auto,formatValue:(xe,$e)=>(0,i.cN)(Te(xe,$e)),theme:U,grid:{show:le.axisGridShow},decimals:De.config.decimals,distr:le.scaleDistribution?.type,splits:Ge,values:He,incrs:Xe,...Ke},De))}const ye=le.drawStyle===a.GR.Points?a.yL.Always:le.showPoints;let Le=()=>null;le.spanNulls!==!0&&(Le=(st,Ke,Xe,He)=>{let Ge=[],xe=st.series[Ke];if(!Xe&&He&&He.length){const[$e,be]=xe.idxs,Z=st.data[0],ae=st.data[Ke],de=Math.round(st.valToPos(Z[$e],"x",!0)),ve=Math.round(st.valToPos(Z[be],"x",!0));He[0][0]===de&&Ge.push($e);for(let Ue=0;Ue<He.length;Ue++){let _e=He[Ue],ze=He[Ue+1];if(ze&&_e[1]===ze[0]){let Ve=st.posToIdx(_e[1],!0);if(ae[Ve]==null)for(let Ne=1;Ne<100;Ne++){if(ae[Ve+Ne]!=null){Ve+=Ne;break}if(ae[Ve-Ne]!=null){Ve-=Ne;break}}Ge.push(Ve)}}He[He.length-1][1]===ve&&Ge.push(be)}return Ge.length?Ge:null});let{fillOpacity:We}=le,Be=null,Ye=null;if(De.state?.origin){oe||(oe=x(L,N));const st=N[De.state.origin.frameIndex],Ke=st?.fields[De.state.origin.fieldIndex],Xe=(0,h.Ct)(Ke??De,st,N);if(te.indexOf(Xe)>=0)Be=()=>null,Ye=()=>{};else if(le.transform===a.NU.Constant){const He=u.A.paths.linear();Be=(Ge,xe)=>{const $e=Ge._data,be=B();let Z=[be.from.valueOf(),be.to.valueOf()],ae=$e[xe].find(Ue=>Ue!=null),de=[ae,ae],ve=$e.slice();return ve[0]=Z,ve[xe]=de,He({...Ge,_data:ve},xe,0,1)}}if(le.fillBelowTo){const He=L.fields.find(be=>le.fillBelowTo===be.name||le.fillBelowTo===be.config?.displayNameFromDS||le.fillBelowTo===(0,h.Ct)(be,L,N)),Ge=He?(0,h.Ct)(He,L,N):le.fillBelowTo,xe=oe.get(Xe),$e=oe.get(Ge);(0,g.isNumber)($e)&&(0,g.isNumber)(xe)?(j.addBand({series:[xe,$e],fill:void 0}),We||(We=35)):We=0}}let at;Re.id===d.Y.Thresholds&&(at=st=>(0,f.lz)(k.fields[st],U).color),j.addSeries({pathBuilder:Be,pointsBuilder:Ye,scaleKey:Ee,showPoints:ye,pointsFilter:Le,colorMode:Re,fillOpacity:We,theme:U,dynamicSeriesColor:at,drawStyle:le.drawStyle,lineColor:le.lineColor??Me,lineWidth:le.lineWidth,lineInterpolation:le.lineInterpolation,lineStyle:le.lineStyle,barAlignment:le.barAlignment,barWidthFactor:le.barWidthFactor,barMaxWidth:le.barMaxWidth,pointSize:le.pointSize,spanNulls:le.spanNulls||!1,show:!le.hideFrom?.viz,gradientMode:le.gradientMode,thresholds:pe.thresholds,hardMin:De.config.min,hardMax:De.config.max,softMin:le.axisSoftMin,softMax:le.axisSoftMax,dataFrameFieldIndex:De.state?.origin}),le.thresholdsStyle&&pe.thresholds&&(le.thresholdsStyle.mode??a.Ly.Off)!==a.Ly.Off&&j.addThresholds({config:le.thresholdsStyle,thresholds:pe.thresholds,scaleKey:Ee,theme:U,hardMin:De.config.min,hardMax:De.config.max,softMin:le.axisSoftMin,softMax:le.axisSoftMax})}let ue=(0,D.ro)(L);j.setStackingGroups(ue),V?.forEach(he=>{oe||(oe=x(L,N));let De={};for(let pe in he.fieldMap){let le=he.fieldMap[pe];De[pe]=oe.get(le)}he.init(j,De)}),j.scaleKeys=[ee,J];const ie=15;let ge={dataIdx:(he,De,pe,le)=>{let Te=he.data[De];if(Te[pe]==null){let Ee=null,Re=null,me;for(me=pe;Ee==null&&me-- >0;)Te[me]!=null&&(Ee=me);for(me=pe;Re==null&&me++<Te.length;)Te[me]!=null&&(Re=me);let Me=he.data[0],ye=he.valToPos(le,"x"),Le=Re==null?1/0:he.valToPos(Me[Re],"x"),We=Ee==null?-1/0:he.valToPos(Me[Ee],"x"),Be=ye-We,Ye=Le-ye;Be<=Ye?Be<=ie&&(pe=Ee):Ye<=ie&&(pe=Re)}return pe}};if(w&&w()!==p.y.Off){const he={point:{[ee]:null,[J]:null},data:L},De=new m.b_(he);ge.sync={key:K,filters:{pub:(pe,le,Te,Ee,Re,me,Me)=>w&&w()===p.y.Off?!1:(he.rowIndex=Me,Te<0&&Ee<0?(he.point[re]=null,he.point[J]=null,H.publish(new m.ql)):(he.point[re]=le.posToVal(Te,ee),he.point[J]=le.posToVal(Ee,J),he.point.panelRelY=Ee>0?Ee/me:1,H.publish(De),De.payload.down=void 0),!0)},scales:[ee,J]}}return j.setSync(),j.setCursor(ge),j};function x(L,U){const R=new Map;return L.fields.forEach((B,H)=>{const w=B.state?.origin;if(w){const N=U[w.frameIndex]?.fields[w.fieldIndex];N&&R.set((0,h.Ct)(N,U[w.frameIndex],U),H)}}),R}const S=["legend","options","theme"];class O extends t.Component{constructor(){super(...arguments),this.prepConfig=(U,R,B)=>{const{eventBus:H,eventsScope:w,sync:N}=this.context,{theme:V,timeZone:G,renderers:_,tweakAxis:K,tweakScale:j}=this.props;return I({frame:U,theme:V,timeZones:Array.isArray(G)?G:[G],getTimeRange:B,eventBus:H,sync:N,allFrames:R,renderers:_,tweakScale:j,tweakAxis:K,eventsScope:w})},this.renderLegend=U=>{const{legend:R,frames:B}=this.props;return!U||R&&!R.showLegend||!(0,o.t)(U,B)?null:t.createElement(o.$,{data:B,config:U,...R})}}render(){return t.createElement(r.o,{...this.props,prepConfig:this.prepConfig,propsToDiff:S,renderLegend:this.renderLegend})}}O.contextType=n.e4;const P=(0,s.cV)(O);P.displayName="TimeSeries"},8984:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{ALERTING_COLOR:()=>s.xj,AxisPlacement:()=>c.vM,BarAlignment:()=>c.Nj,BarValueVisibility:()=>c.TC,BracesPlugin:()=>u.e1,ClearPlugin:()=>u.vJ,ClipboardPlugin:()=>u.sW,DEFAULT_ANNOTATION_COLOR:()=>s.Mk,DOMUtil:()=>s.bk,DrawStyle:()=>c.yg,EventsWithValidation:()=>s.Pw,GlobalStyles:()=>r.kH,GraphGradientMode:()=>c.on,GraphThresholdsStyleMode:()=>c.Ly,IndentationPlugin:()=>u.TA,LegendDisplayMode:()=>c.lm,LineInterpolation:()=>c.dx,NO_DATA_COLOR:()=>s.nO,NewlinePlugin:()=>u.Om,NodeGraphDataFrameFieldNames:()=>s.uc,OK_COLOR:()=>s.Xw,PENDING_COLOR:()=>s.ct,PointVisibility:()=>c.nT,REGION_FILL_ALPHA:()=>s.UJ,ReactUtils:()=>s.zt,RunnerPlugin:()=>u.Ul,SCHEMA:()=>s.yx,ScaleDirection:()=>c.ON,ScaleOrientation:()=>c.Lt,SearchFunctionType:()=>s.Tt,SelectionShortcutsPlugin:()=>u.l9,SlatePrism:()=>u.De,StackingMode:()=>c.gs,SuggestionsPlugin:()=>u.Pz,TableCellDisplayMode:()=>c.ob,ThemeContext:()=>r.Dx,TooltipDisplayMode:()=>c.$N,ansicolor:()=>s.DB,attachDebugger:()=>s.hF,calculateFontSize:()=>s.Vr,colors:()=>s.Tj,commonOptionsBuilder:()=>g.j,createLogger:()=>s.h,fuzzyMatch:()=>s.It,getCanvasContext:()=>s.Yc,getCellLinks:()=>s.kl,getScrollbarWidth:()=>s.XJ,getTagColor:()=>s.yC,getTagColorIndexFromName:()=>s.JF,getTagColorsFromName:()=>s.MC,getTextColorForAlphaBackground:()=>s.mZ,getTextColorForBackground:()=>s.sg,getTheme:()=>r.O4,hasValidationEvent:()=>s.K,isCompactUrl:()=>s.Fr,linkModelToContextMenuItems:()=>s.Jl,makeFragment:()=>s.dF,makeValue:()=>s.mO,measureText:()=>s.kD,mockTheme:()=>r.mG,mockThemeContext:()=>r.fq,regexValidation:()=>s.RP,sortedColors:()=>s.Ih,styleMixins:()=>r.YF,stylesFactory:()=>r.N3,useForceUpdate:()=>s.CH,useStyles:()=>r.IS,useStyles2:()=>r.of,useTheme:()=>r.DP,useTheme2:()=>r.$j,validate:()=>s.tf,withTheme:()=>r.SL,withTheme2:()=>r.cV});var t=e(94333),o={};for(const i in t)i!=="default"&&(o[i]=()=>t[i]);e.d(A,o);var n=e(80186),o={};for(const i in n)["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","BarGauge","VizTooltip","VizTooltipContainer","SeriesTable","SeriesTableRow","VizRepeater","PanelChrome","PanelChromeLoadingIndicator","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","Text","Box","Stack","Grid","Space","Label","Field","Legend","FieldSet","FieldValidationMessage","InlineField","InlineSegmentGroup","InlineLabel","InlineFieldRow","FieldArray","resetSelectStyles","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","Avatar","InlineFormLabel","Divider","getDragStyles","Splitter","LayoutItemContext","LegacyForms","LegacyInputStatus","ScaleDistribution","BarGaugeDisplayMode","UPlotConfigBuilder","UPLOT_AXIS_FONT_SIZE","UPlotChart","PlotLegend","FIXED_UNIT","BrowserLabel","PanelContainer","Graph","GraphWithLegend","GraphContextMenu","GraphContextMenuHeader","graphTimeFormat","graphTickFormatter","GraphNG","TimeSeries","useGraphNGContext","preparePlotFrame","buildScaleKey","convertOldAngularValueMapping","sharedSingleStatMigrationHandler","sharedSingleStatPanelChangedHandler","AsyncMultiSelect","AsyncSelect","AsyncVirtualizedSelect","MultiSelect","Select","SelectContainer","VirtualizedSelect","SecretInput","SecretTextArea","FileDropzone","FileDropzoneDefaultChildren","FileListItem","graphFieldOptions","EventsCanvas","Marker","XYCanvas","KeyboardPlugin","TooltipPlugin","TooltipPlugin2","ZoomPlugin","SeriesVisibilityChangeMode"].indexOf(i)<0&&(o[i]=()=>n[i]);e.d(A,o);var s=e(99598),r=e(7918),g=e(42482),u=e(82175),c=e(49149)},38248:(Q,A,e)=>{"use strict";e.d(A,{W:()=>h,r:()=>l});var t=e(96540),n=e(11261),o=e(27310),s=e(52622),r=e(88575),g=e(94354),u=e(10354),c=e(88323),i=e(52198);function l(p,m,a){const v=["Axis"];p.addRadio({path:"axisPlacement",name:"Placement",category:v,defaultValue:i.t.axisPlacement[0].value,settings:{options:i.t.axisPlacement}}).addTextInput({path:"axisLabel",name:"Label",category:v,defaultValue:"",settings:{placeholder:"Optional text",expandTemplateVars:!0},showIf:E=>E.axisPlacement!==s.vM.Hidden,shouldApply:E=>E.type!==n.PU.time&&E.type!==n.PU.string}).addNumberInput({path:"axisWidth",name:"Width",category:v,settings:{placeholder:"Auto"},showIf:E=>E.axisPlacement!==s.vM.Hidden}).addRadio({path:"axisGridShow",name:"Show grid lines",category:v,defaultValue:void 0,settings:{options:[{value:void 0,label:"Auto"},{value:!0,label:"On"},{value:!1,label:"Off"}]},showIf:E=>E.axisPlacement!==s.vM.Hidden}).addRadio({path:"axisColorMode",name:"Color",category:v,defaultValue:s.Y$.Text,settings:{options:[{value:s.Y$.Text,label:"Text"},{value:s.Y$.Series,label:"Series"}]},showIf:E=>E.axisPlacement!==s.vM.Hidden}).addBooleanSwitch({path:"axisBorderShow",name:"Show border",category:v,defaultValue:!1,showIf:E=>E.axisPlacement!==s.vM.Hidden}),p.addCustomEditor({id:"scaleDistribution",path:"scaleDistribution",name:"Scale",category:v,editor:h,override:h,defaultValue:{type:s.L4.Linear},shouldApply:E=>E.type===n.PU.number,process:o.hS}).addBooleanSwitch({path:"axisCenteredZero",name:"Centered zero",category:v,defaultValue:!1,showIf:E=>E.scaleDistribution?.type!==s.L4.Log}).addNumberInput({path:"axisSoftMin",name:"Soft min",defaultValue:m.axisSoftMin,category:v,settings:{placeholder:"See: Standard options > Min"}}).addNumberInput({path:"axisSoftMax",name:"Soft max",defaultValue:m.axisSoftMax,category:v,settings:{placeholder:"See: Standard options > Max"}})}const f=[{label:"Linear",value:s.L4.Linear},{label:"Logarithmic",value:s.L4.Log},{label:"Symlog",value:s.L4.Symlog}],d=[{label:"2",value:2},{label:"10",value:10}],h=({value:p,onChange:m})=>{const a=p?.type??s.L4.Linear,v=p?.log??2;return t.createElement(t.Fragment,null,t.createElement("div",{style:{marginBottom:16}},t.createElement(g.z,{value:a,options:f,onChange:E=>{m({...p,type:E,log:E===s.L4.Linear?void 0:v})}})),(a===s.L4.Log||a===s.L4.Symlog)&&t.createElement(r.D,{label:"Log base"},t.createElement(c.l6,{options:d,value:v,onChange:E=>{m({...p,log:E.value})}})),a===s.L4.Symlog&&t.createElement(r.D,{label:"Linear threshold"},t.createElement(u.p,{placeholder:"1",value:p?.linearThreshold,onChange:E=>{m({...p,linearThreshold:Number(E.currentTarget.value)})}})))}},11404:(Q,A,e)=>{"use strict";e.d(A,{e:()=>u});var t=e(2543),n=e.n(t),o=e(96540),s=e(92174),r=e(66864);const g=({value:c,onChange:i})=>{const l=(0,o.useCallback)(f=>{i({...c,[f]:!c[f]})},[c,i]);return o.createElement(r.Gy,{spacing:"xs"},Object.keys(c).map(f=>{const d=f;return o.createElement(s.m,{icon:c[d]?"eye-slash":"eye",onClick:()=>l(d),key:d,label:(0,t.startCase)(d),selected:c[d]})}))};function u(c){c.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:i=>i})}},22680:(Q,A,e)=>{"use strict";e.d(A,{H:()=>o});var t=e(69550),n=e(52622);function o(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.lm.List,settings:{options:[{value:n.lm.List,label:"List"},{value:n.lm.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.D.get("stats-picker").editor,defaultValue:[],settings:{allowMultiple:!0},showIf:g=>g.legend.showLegend!==!1})}},56675:(Q,A,e)=>{"use strict";e.d(A,{I:()=>f,m:()=>l});var t=e(96540),n=e(27310),o=e(11261),s=e(52622),r=e(94354),g=e(29158),u=e(10354),c=e(66864),i=e(52198);const l=({value:d,context:h,onChange:p,item:m})=>t.createElement(c.Gy,null,t.createElement(r.z,{value:d?.mode||s.gs.None,options:m.settings?.options??[],onChange:a=>{p({...d,mode:a})}}),h.isOverride&&d?.mode&&d?.mode!==s.gs.None&&t.createElement(u.p,{type:"text",placeholder:"Group",suffix:t.createElement(g.K,{name:"question-circle",tooltip:"Name of the stacking group",tooltipPlacement:"top"}),defaultValue:d?.group,onChange:a=>{p({...d,group:a.currentTarget.value.trim()})}}));function f(d,h,p=["Graph styles"]){d.addCustomEditor({id:"stacking",path:"stacking",name:"Stack series",category:p,defaultValue:h,editor:l,override:l,settings:{options:i.t.stacking},process:n.hS,shouldApply:m=>m.type===o.PU.number})}},71242:(Q,A,e)=>{"use strict";e.d(A,{I:()=>t});function t(n,o=!0){o&&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})}},89654:(Q,A,e)=>{"use strict";e.d(A,{D:()=>n});var t=e(52622);function n(o,s=!1,r=!1,g){const u=["Tooltip"],c=s?[{value:t.$N.Single,label:"Single"},{value:t.$N.None,label:"Hidden"}]:[{value:t.$N.Single,label:"Single"},{value:t.$N.Multi,label:"All"},{value:t.$N.None,label:"Hidden"}],i=[{value:t.xB.None,label:"None"},{value:t.xB.Ascending,label:"Ascending"},{value:t.xB.Descending,label:"Descending"}];o.addRadio({path:"tooltip.mode",name:"Tooltip mode",category:u,defaultValue:g?.tooltip?.mode??t.$N.Single,settings:{options:c}}).addRadio({path:"tooltip.sort",name:"Values sort order",category:u,defaultValue:g?.tooltip?.sort??t.xB.None,showIf:l=>l.tooltip?.mode===t.$N.Multi,settings:{options:i}}),r&&o.addNumberInput({path:"tooltip.hoverProximity",name:"Hover proximity",description:"How close the cursor must be to a point to trigger the tooltip, in pixels",category:u,settings:{integer:!0}}),o.addNumberInput({path:"tooltip.maxWidth",name:"Max width",category:u,settings:{integer:!0},showIf:l=>l.tooltip?.mode!==t.$N.None}).addNumberInput({path:"tooltip.maxHeight",name:"Max height",category:u,settings:{integer:!0},showIf:l=>l.tooltip?.mode!==t.$N.None})}},42482:(Q,A,e)=>{"use strict";e.d(A,{j:()=>t});var t={};e.r(t),e.d(t,{ScaleDistributionEditor:()=>n.W,StackingEditor:()=>u.m,addAxisConfig:()=>n.r,addHideFrom:()=>o.e,addLegendOptions:()=>s.H,addStackingConfig:()=>u.I,addTextSizeOptions:()=>g.I,addTooltipOptions:()=>r.D});var n=e(38248),o=e(11404),s=e(22680),r=e(89654),g=e(71242),u=e(56675)},49149:(Q,A,e)=>{"use strict";e.d(A,{$N:()=>t.$N,Lt:()=>t.Lt,Ly:()=>t.Ly,Nj:()=>t.Nj,ON:()=>t.ON,TC:()=>t.yL,dx:()=>t.dx,gs:()=>t.gs,lm:()=>t.lm,nT:()=>t.yL,ob:()=>t.ob,on:()=>t.on,vM:()=>t.vM,yg:()=>t.GR});var t=e(52622)},3547:(Q,A,e)=>{"use strict";e.d(A,{e:()=>s});var t=e(62938);const n={"[":"]","{":"}","(":")"},o="brace_match";function s(){return{onKeyDown(r,g,u){const{value:c}=g;switch(r.key){case"(":case"{":case"[":{const{start:{offset:i,key:l},end:{offset:f,key:d},focus:{offset:h}}=c.selection,p=c.focusText.text;if(c.selection.isExpanded)return r.preventDefault(),g.insertTextByKey(l,i,r.key).insertTextByKey(d,f+1,n[r.key]).moveEndBackward(1),!0;if(h===p.length||p[h]===" "||Object.values(n).includes(p[h])){r.preventDefault();const m=n[r.key],a={key:`${o}-${(0,t.A)()}`,type:`${o}-${m}`,anchor:{key:l,offset:i,object:"point"},focus:{key:d,offset:f+1,object:"point"},object:"annotation"};return g.insertText(r.key).insertText(m).addAnnotation(a).moveBackward(1),!0}break}case")":case"}":case"]":{const i=c.anchorText.text,l=c.selection.anchor.offset,f=i[l],d=r.key,h=`${o}-${d}`,p=c.annotations.find(m=>m?.type===h&&m.anchor.key===c.anchorText.key);if(p&&f===d&&!c.selection.isExpanded)return r.preventDefault(),g.moveFocusForward(1).removeAnnotation(p).moveAnchorForward(1),!0;break}case"Backspace":{const i=c.anchorText.text,l=c.selection.anchor.offset,f=i[l-1],d=i[l];if(n[f]&&n[f]===d)return r.preventDefault(),g.deleteBackward(1).deleteForward(1).focus(),!0}default:break}return u()}}}},74738:(Q,A,e)=>{"use strict";e.d(A,{v:()=>t});function t(){return{onKeyDown(n,o,s){const r=o.value;if(r.selection.isExpanded)return s();if(n.key==="k"&&n.ctrlKey){n.preventDefault();const g=r.anchorText.text,u=r.selection.anchor.offset,i=g.length-u;return o.deleteForward(i),!0}return s()}}}},99453:(Q,A,e)=>{"use strict";e.d(A,{s:()=>o});const t=(s,r,g)=>{if(!s.length)return;const u=s.slice(0,-1).join("").length+s.length-1;return s.join(` `).slice(r,u+g)},n=s=>s?.replace(/[\uFEFF]/g,"");function o(){const s={onCopy(r,g,u){r.preventDefault();const{document:c,selection:i}=g.value,{start:{offset:l},end:{offset:f}}=i,d=c.getLeafBlocksAtRange(i).toArray().map(p=>p.text),h=n(t(d,l,f));return h&&r.clipboardData&&r.clipboardData.setData("Text",h),!0},onPaste(r,g,u){if(r.preventDefault(),r.clipboardData){const i=n(r.clipboardData.getData("Text"))?.split(` `);if(i&&i.length){g.insertText(i[0]);for(const l of i.slice(1))g.splitBlock().insertText(l)}}return!0}};return{...s,onCut(r,g,u){return s.onCopy(r,g,u),g.deleteAtRange(g.value.selection),!0}}}},1020:(Q,A,e)=>{"use strict";e.d(A,{T:()=>l});var t=e(57746),n=e(82611),o=e(75226);const s=(0,t.Sn)("mod+["),r=(0,t.Sn)("shift+tab"),g=(0,t.Sn)("mod+]"),u=" ",c=(f,d,h)=>{const{startBlock:p,endBlock:m,selection:{start:{offset:a,key:v},end:{offset:E,key:D}}}=d.value;if(o.A.serialize(d.value)==="")return;f.preventDefault();const b=p.getFirstText();b&&a===0&&v===b.key&&E===b.text.length&&D===b.key||!p.equals(m)?i(d,"right"):d.insertText(u)},i=(f,d)=>{const h=f.value.selection,p=f.value.document.getLeafBlocksAtRange(h).toArray();if(d==="left")for(const m of p){const a=m.text.length-m.text.trimLeft().length,v=m.getFirstText().key,E={anchor:{key:v,offset:a,path:[]},focus:{key:v,offset:a,path:[]}};f.deleteBackwardAtRange(n.Q6.create(E),Math.min(u.length,a))}else{const{startText:m}=f.value,a=m.text.slice(0,h.start.offset),v=/^\s*$/.test(a);for(const E of p)f.insertTextByKey(E.getFirstText().key,0,u);v&&f.moveStartBackward(u.length)}};function l(){return{onKeyDown(f,d,h){if(s(f)||r(f))f.preventDefault(),i(d,"left");else if(g(f))f.preventDefault(),i(d,"right");else if(f.key==="Tab")c(f,d,h);else return h();return!0}}}},82175:(Q,A,e)=>{"use strict";e.d(A,{De:()=>c.D,Om:()=>r.O,Pz:()=>i.Pz,TA:()=>s.T,Ul:()=>g.U,e1:()=>t.e,l9:()=>u.l,sW:()=>o.s,vJ:()=>n.v});var t=e(3547),n=e(74738),o=e(99453),s=e(1020),r=e(88295),g=e(4269),u=e(31589),c=e(41781),i=e(80903)},88295:(Q,A,e)=>{"use strict";e.d(A,{O:()=>n});function t(o){let s=o.length-o.trimLeft().length;if(s){let r=o[0];for(;--s;)r+=o[0];return r}return""}function n(){return{onKeyDown(o,s,r){const g=s.value;if(g.selection.isExpanded)return r();if(o.key==="Enter"){o.preventDefault();const{startBlock:u}=g,c=u.text,i=t(c);return s.splitBlock().insertText(i).focus()}return r()}}}},4269:(Q,A,e)=>{"use strict";e.d(A,{U:()=>t});function t({handler:n}){return{onKeyDown(o,s,r){return n&&o.key==="Enter"&&(o.shiftKey||o.ctrlKey)?(o.preventDefault(),n(o),s):r()}}}},31589:(Q,A,e)=>{"use strict";e.d(A,{l:()=>o});var t=e(57746);const n=(0,t.Sn)("mod+l");function o(){return{onKeyDown(s,r,g){if(n(s)){s.preventDefault();const{focusBlock:u,document:c}=r.value;r.moveAnchorToStartOfBlock(),c.getNextBlock(u.key)?r.moveFocusToStartOfNextBlock():r.moveFocusToEndOfText()}else return g();return!0}}}},84694:(Q,A,e)=>{"use strict";e.d(A,{A:()=>n});const n="prism-token"},41781:(Q,A,e)=>{"use strict";e.d(A,{D:()=>d,R:()=>a});var t=e(28848),n=e.n(t),o=e(82611),s=e(84694),r=e(49568),g=e(96540);function u(v){return v.object==="block"&&v.type==="code_block"}function c(v){return"javascript"}function i(v,E,D){const{decoration:b}=v;if(b.type!==s.A)return D();const C=b.data.get("className");return g.createElement("span",{className:C},v.children)}class l extends(0,r.Record)({onlyIn:u,getSyntax:c,renderDecoration:i}){constructor(E){super(E)}}const f=l;function d(v={},E=n().languages){const D=new f(v);return{decorateNode:(b,C,y)=>{if(!D.onlyIn(b))return y();const M=o.eB.create(b),T=D.getSyntax(M),I=E[T];if(!I)return[];const S=M.getTexts().map(U=>U&&U.getText()).join(` `),O=n().tokenize(S,I),P=a(O),L=C.value.data.set("tokens",P);return C.setData(L),h(D,O,M)},renderDecoration:(b,C,y)=>D.renderDecoration({children:b.children,decoration:b.decoration},C,y)}}function h(v,E,D){const b=D.getTexts(),C=[];let y=0,M=0;return b.forEach(T=>{M=y+T.getText().length;let I=0;function x(S,O){if(typeof S=="string"){if(O){const P=p({text:T,textStart:y,textEnd:M,start:I,end:I+S.length,className:`prism-token token ${O}`,block:D});P&&C.push(P)}I+=S.length}else if(O=`${O} ${S.type}`,S.alias&&(O+=" "+S.alias),typeof S.content=="string"){const P=p({text:T,textStart:y,textEnd:M,start:I,end:I+S.content.length,className:`prism-token token ${O}`,block:D});P&&C.push(P),I+=S.content.length}else for(let P=0;P<S.content.length;P+=1)x(S.content[P],O)}E.forEach(x),y=M+1}),C}function p({text:v,textStart:E,textEnd:D,start:b,end:C,className:y,block:M}){return b>=D||C<=E?null:(b=Math.max(b,E),C=Math.min(C,D),b-=E,C-=E,M.createDecoration({object:"decoration",anchor:{key:v.key,offset:b,object:"point"},focus:{key:v.key,offset:C,object:"point"},type:s.A,data:{className:y}}))}function m(v){return typeof v=="string"?[{content:v,types:[],aliases:[]}]:Array.isArray(v)?v.flatMap(E=>m(E)):v instanceof n().Token?m(v.content).flatMap(E=>{let D=[];return typeof v.alias=="string"?D=[v.alias]:D=v.alias??[],{content:E.content,types:[v.type,...E.types],aliases:[...D,...E.aliases]}}):[]}function a(v){const E=m(v);if(!E.length)return[];const D=E[0];D.prev=null,D.next=E.length>=2?E[1]:null,D.offsets={start:0,end:D.content.length};for(let C=1;C<E.length-1;C++)E[C].prev=E[C-1],E[C].next=E[C+1],E[C].offsets={start:E[C-1].offsets.end,end:E[C-1].offsets.end+E[C].content.length};const b=E[E.length-1];return b.prev=E.length>=2?E[E.length-2]:null,b.next=null,b.offsets={start:E.length>=2?E[E.length-2].offsets.end:0,end:E.length>=2?E[E.length-2].offsets.end+b.content.length:b.content.length},E}},80903:(Q,A,e)=>{"use strict";e.d(A,{Pz:()=>U});var t=e(2543),n=e(96540),o=e(40961),s=e(91793),r=e(60578),g=e(50774),u=e(49579);const c=H=>H.reduce((w,{items:N,label:V})=>(w.push({label:V,kind:g.I.GroupTitle}),N.reduce((G,_)=>(G.push(_),G),w)),[]),i=H=>H.reduce((w,N)=>w.length<N.label.length?N.label:w,""),l=(H,w,N)=>{const V=(0,u.A)(N,{font:H.typography.fontFamilyMonospace,fontSize:H.typography.bodySmall.fontSize,fontWeight:"normal"}),G=d(V.width,H),_=f(V.height,H),K=h(_,w);return{listWidth:G,listHeight:K,itemHeight:_}},f=(H,w)=>{const N=w.spacing.gridSize*2;return H+N},d=(H,w)=>{const N=w.spacing.gridSize*3,V=800;return Math.min(Math.max(H+N,200),V)},h=(H,w)=>{const N=Math.min(w.length,10),V=100,G=N*H;return Math.max(G,V)};var p=e(32196),m=e(36663),a=e(40845);const v=(H,w,N)=>({typeaheadItem:(0,p.css)({label:"type-ahead-item",zIndex:11,padding:H.spacing(1,1,1,2),border:H.colors.border.medium,overflowY:"scroll",overflowX:"hidden",outline:"none",background:H.colors.background.secondary,color:H.colors.text.secondary,boxShadow:`0 0 20px ${H.v1.colors.dropdownShadow}`,visibility:N===!0?"visible":"hidden",width:"250px",minHeight:`${w+parseInt(H.spacing(.25),10)}px`,position:"relative",wordBreak:"break-word"})}),E=({item:H,height:w})=>{const N=H&&!!H.documentation,V=H?H.label:"",G=(0,m.G)(H?.documentation),_=(0,a.$j)(),K=v(_,w,N);return n.createElement("div",{className:(0,p.cx)([K.typeaheadItem])},n.createElement("b",null,V),n.createElement("hr",null),n.createElement("div",{dangerouslySetInnerHTML:{__html:G}}))};var D=e(23257),b=e.n(D),C=e(5313);const y=H=>({typeaheadItem:(0,p.css)({border:"none",background:"none",textAlign:"left",label:"type-ahead-item",height:"auto",fontFamily:H.typography.fontFamilyMonospace,padding:H.spacing(1,1,1,2),fontSize:H.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,p.css)({label:"type-ahead-item-selected",backgroundColor:H.colors.background.secondary}),typeaheadItemMatch:(0,p.css)({label:"type-ahead-item-match",color:H.v1.palette.yellow,borderBottom:`1px solid ${H.v1.palette.yellow}`,padding:"inherit",background:"inherit"}),typeaheadItemGroupTitle:(0,p.css)({label:"type-ahead-item-group-title",color:H.colors.text.secondary,fontSize:H.typography.bodySmall.fontSize,lineHeight:H.typography.body.lineHeight,padding:H.spacing(1)})}),M=H=>{const w=(0,a.of)(y),{isSelected:N,item:V,prefix:G,style:_,onMouseEnter:K,onMouseLeave:j,onClickItem:k}=H,Y=N?(0,p.cx)([w.typeaheadItem,w.typeaheadItemSelected]):(0,p.cx)([w.typeaheadItem]),ee=(0,p.cx)([w.typeaheadItemMatch]),re=(0,p.cx)([w.typeaheadItemGroupTitle]),J=V.label||"";return V.kind===g.I.GroupTitle?n.createElement("li",{className:re,style:_},n.createElement("span",null,J)):n.createElement("li",{role:"none"},n.createElement("button",{role:"menuitem",className:Y,style:_,onMouseDown:k,onMouseEnter:K,onMouseLeave:j,type:"button"},V.highlightParts!==void 0?n.createElement(C.z,{text:J,highlightClassName:ee,highlightParts:V.highlightParts}):n.createElement(b(),{textToHighlight:J,searchWords:[G??""],autoEscape:!0,highlightClassName:ee})))},T=(H,w)=>H-w*Math.floor(H/w);class I 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=c(this.props.groupedItems),N=i(w),{listWidth:V,listHeight:G,itemHeight:_}=l(this.context,w,N);this.setState({listWidth:V,listHeight:G,itemHeight:_,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 V=c(this.props.groupedItems),G=i(V),{listWidth:_,listHeight:K,itemHeight:j}=l(this.context,V,G);this.setState({listWidth:_,listHeight:K,itemHeight:j,allItems:V,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 V=this.state.typeaheadIndex||0;let G=T(V+w,N);this.state.allItems[G].kind===g.I.GroupTitle&&(G=T(G+w,N)),this.setState({typeaheadIndex:G});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 V=N.parentElement.getBoundingClientRect(),G=window.scrollX,_=window.scrollY;return`position: absolute; display: flex; top: ${V.top+_+V.height+6}px; left: ${V.left+G-2}px`}return""}render(){const{prefix:w,isOpen:N=!1,origin:V}=this.props,{allItems:G,listWidth:_,listHeight:K,itemHeight:j,hoveredItem:k,typeaheadIndex:Y}=this.state,ee=k||Y,re=G[k||Y||0];return n.createElement(x,{origin:V,isOpen:N,style:this.menuPosition},n.createElement("ul",{role:"menu",className:"typeahead","data-testid":"typeahead"},n.createElement(s.Y1,{ref:this.listRef,itemCount:G.length,itemSize:j,itemKey:J=>{const ne=G&&G[J];return ne?`${J}-${ne.label}`:`${J}`},width:_,height:K},({index:J,style:ne})=>{const q=G&&G[J];return q?n.createElement(M,{onClickItem:()=>this.props.onSelectSuggestion?this.props.onSelectSuggestion(q):{},isSelected:Y===null?!1:G[Y]===q,item:q,prefix:w,style:ne,onMouseEnter:()=>this.onMouseEnter(J),onMouseLeave:this.onMouseLeave}):null})),ee&&n.createElement(E,{height:K,item:re}))}}I.contextType=r.D;class x extends n.PureComponent{constructor(w){super(w);const{index:N=0,origin:V="query",style:G}=w;this.node=document.createElement("div"),this.node.setAttribute("style",G),this.node.classList.add("slate-typeahead",`slate-typeahead-${V}-${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"),o.createPortal(this.props.children,this.node)):(this.node.classList.remove("slate-typeahead--open"),null)}}var S=e(72307),O=e(75071),P=e(84694);const L=250;function U({onTypeahead:H,cleanText:w,onWillApplySuggestion:N,portalOrigin:V}){let G,_={groupedItems:[],typeaheadPrefix:"",typeaheadContext:"",typeaheadText:""};const K=(0,t.debounce)(R,L),j=k=>{_={..._,...k}};return{onBlur:(k,Y,ee)=>(_={..._,groupedItems:[]},ee()),onClick:(k,Y,ee)=>(_={..._,groupedItems:[]},ee()),onKeyDown:(k,Y,ee)=>{const J=_.groupedItems.length;switch(k.key){case"Escape":{if(J)return k.preventDefault(),_={..._,groupedItems:[]},Y.insertText("");break}case"ArrowDown":case"ArrowUp":if(J){k.preventDefault(),G.moveMenuIndex(k.key==="ArrowDown"?1:-1);return}break;case"Enter":{if(!(k.shiftKey||k.ctrlKey)&&J)return k.preventDefault(),G.insertSuggestion();break}case"Tab":{if(J)return k.preventDefault(),G.insertSuggestion();break}default:{k.key.length===1&&K(Y,j,H,w);break}}return ee()},commands:{selectSuggestion:(k,Y)=>{const ee=_.groupedItems;if(!ee||!ee.length)return k;const re=k.applyTypeahead(Y);return K(k,j,H,w),re},applyTypeahead:(k,Y)=>{let ee=Y.insertText||Y.label;const re=Y.kind==="function",J=Y.move||0,ne=J>0?J:0,q=J<0?-J:0,{typeaheadPrefix:te,typeaheadText:oe,typeaheadContext:ue}=_;N&&(ee=N(ee,{groupedItems:_.groupedItems,typeaheadContext:ue,typeaheadPrefix:te,typeaheadText:oe}));const{forward:ie,backward:ge}=B(ee,te,oe,re,Y.deleteBackwards,w);if(ee.match(/\n/)){const he=(0,S.dF)(ee);return k.deleteBackward(ge).deleteForward(ie).insertFragment(he).focus(),k}return _={..._,groupedItems:[]},k.snapshotSelection().deleteBackward(ge).deleteForward(ie).insertText(ee).moveForward(ne).moveBackward(q).focus(),k}},renderEditor(k,Y,ee){if(Y.value.selection.isExpanded)return ee();const re=ee();return n.createElement(n.Fragment,null,re,n.createElement(I,{menuRef:J=>G=J,origin:V,prefix:_.typeaheadPrefix,isOpen:!!_.groupedItems.length,groupedItems:_.groupedItems,onSelectSuggestion:Y.selectSuggestion}))}}}const R=async(H,w,N,V)=>{if(!N)return;const{value:G}=H,{selection:_}=G,K=G.document.getClosestBlock(G.focusBlock.key),j=G.selection.start.offset-1,k=K&&K.getDecorations(H),Y=k?k.filter(ge=>ge.start.offset<=j&&ge.end.offset>j&&ge.type===P.A).toArray():[],ee=k&&k.filter(ge=>ge.end.offset<=j&&ge.type===P.A&&ge.data.get("className").includes("label-key")).last(),re=ee&&G.focusText.text.slice(ee.start.offset,ee.end.offset),J=Y.map(ge=>ge.data.get("className")).join(" ").split(" ").filter(ge=>ge.length);let ne=G.focusText.text,q=ne.slice(0,_.focus.offset);Y.length&&(ne=G.focusText.text.slice(Y[0].start.offset,Y[0].end.offset),q=G.focusText.text.slice(Y[0].start.offset,_.focus.offset));const te=q.match(/(?:!?=~?"?|")(.*)/);te?q=te[1]:V&&(q=V(q));const{suggestions:oe,context:ue}=await N({prefix:q,text:ne,value:G,wrapperClasses:J,labelKey:re||void 0,editor:H}),ie=oe.map(ge=>{if(!ge.items)return ge;const he=ge.searchFunctionType||(ge.prefixMatch?O.T.Prefix:O.T.Word),De=O.H[he];let pe={...ge};return q&&(ge.skipFilter||(pe.items=pe.items.filter(le=>(le.filterText||le.label).length>=q.length),pe.items=De(pe.items,q)),pe.items=pe.items.filter(le=>!(le.insertText===q||(le.filterText??le.label)===q))),ge.skipSort||(pe.items=(0,t.sortBy)(pe.items,le=>le.sortText===void 0?le.sortValue!==void 0?le.sortValue:le.label:le.sortText||le.label)),pe}).filter(ge=>ge.items&&ge.items.length);w({groupedItems:ie,typeaheadPrefix:q,typeaheadContext:ue,typeaheadText:ne}),H.blur().focus()};function B(H,w,N,V,G,_){const K=G||w.length,j=_?_(N):N,k=N.indexOf(w),Y=k>-1?j.length-k-w.length:j.length-w.length;return{forward:!!(w&&Y>0||H===N)&&!V?Y+k:0,backward:K}}},93218:(Q,A,e)=>{"use strict";e.d(A,{k:()=>m});var t=e(94659),n=e(96540),o=e(40845);function s(a){return(0,t.css)({".panel-options-group":{borderBottom:`1px solid ${a.colors.border.weak}`},".panel-options-group__header":{padding:a.spacing(1,2,1,1),position:"relative",display:"flex",alignItems:"center",cursor:"pointer",fontWeight:500,color:a.colors.text.primary,"&:hover":{background:a.colors.emphasize(a.colors.background.primary,.03)}},".panel-options-group__icon":{color:a.colors.text.secondary,marginRight:a.spacing(1),padding:a.spacing(0,.9,0,.6)},".panel-options-group__title":{position:"relative"},".panel-options-group__body":{padding:a.spacing(1,2,1,4)}})}function r(a){return(0,t.css)({".card-section":{marginBottom:a.spacing(4)},".card-list":{display:"flex",flexDirection:"row",flexWrap:"wrap",listStyleType:"none"},".card-item":{display:"block",height:"100%",background:a.colors.background.secondary,boxShadow:"none",padding:a.spacing(2),borderRadius:"4px","&:hover":{background:a.colors.emphasize(a.colors.background.secondary,.03)},".label-tag":{marginLeft:a.spacing(1),fontSize:"11px",padding:"2px 6px"}},".card-item-body":{display:"flex",overflow:"hidden"},".card-item-details":{overflow:"hidden"},".card-item-header":{marginBottom:a.spacing(2)},".card-item-type":{color:a.colors.text.secondary,textTransform:"uppercase",fontSize:a.typography.size.sm,fontWeight:a.typography.fontWeightMedium},".card-item-badge":{margin:"6px 0"},".card-item-notice":{fontSize:a.typography.size.sm},".card-item-name":{color:a.colors.text.primary,overflow:"hidden",textOverflow:"ellipsis",width:"100%"},".card-item-label":{marginLeft:a.spacing(1)},".card-item-sub-name":{color:a.colors.text.secondary,overflow:"hidden",textOverflow:"ellipsis",width:"100%"},".card-item-sub-name--header":{color:a.colors.text.secondary,textTransform:"uppercase",marginBottom:a.spacing(2),fontSize:a.typography.size.sm,fontWeight:"bold"},".card-list-layout-grid":{".card-item-type":{display:"inline-block"},".card-item-notice":{fontSize:a.typography.size.sm,display:"inline-block",marginLeft:a.spacing(2)},".card-item-header-action":{float:"right"},".card-item-wrapper":{width:"100%",padding:a.spacing(0,2,2,0)},".card-item-wrapper--clickable":{cursor:"pointer"},".card-item-figure":{margin:a.spacing(0,2,2,0),height:"80px",img:{width:"80px"}},".card-item-name":{fontSize:a.typography.h3.fontSize},[a.breakpoints.up("md")]:{".card-item-wrapper":{width:"50%"}},[a.breakpoints.up("lg")]:{".card-item-wrapper":{width:"33.333333%"}},"&.card-list-layout-grid--max-2-col":{[a.breakpoints.up("lg")]:{".card-item-wrapper":{width:"50%"}}}},".card-list-layout-list":{".card-item-wrapper":{padding:0,width:"100%",marginBottom:a.spacing(1)},".card-item-wrapper--clickable":{cursor:"pointer"},".card-item":{borderRadius:"2px"},".card-item-header":{float:"right",textAlign:"right"},".card-item-figure":{margin:a.spacing(0,2,0,0),img:{width:"48px"}},".card-item-name":{fontSize:a.typography.h4.fontSize},".card-item-sub-name":{fontSize:a.typography.size.sm},".layout-selector":{marginRight:0}}})}var g=e(16797);function u(a){return(0,t.css)({html:{MsOverflowStyle:"scrollbar",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)",height:"100%",fontSize:`${a.typography.htmlFontSize}px`,fontFamily:a.typography.fontFamily,lineHeight:a.typography.body.lineHeight,fontKerning:"normal"},":root":{colorScheme:a.colors.mode},body:{height:"100%",width:"100%",position:"absolute",color:a.colors.text.primary,backgroundColor:a.colors.background.canvas,...c(a.typography.body)},"h1, .h1":c(a.typography.h1),"h2, .h2":c(a.typography.h2),"h3, .h3":c(a.typography.h3),"h4, .h4":c(a.typography.h4),"h5, .h5":c(a.typography.h5),"h6, .h6":c(a.typography.h6),p:{margin:a.spacing(0,0,2)},button:{letterSpacing:a.typography.body.letterSpacing,"&:focus-visible":(0,g.getFocusStyles)(a),"&:focus":{outline:"none"}},small:{fontSize:a.typography.bodySmall.fontSize},"b, strong":{fontWeight:a.typography.fontWeightMedium},em:{fontStyle:"italic",color:a.colors.text.primary},cite:{fontStyle:"normal"},".muted":{color:a.colors.text.secondary},"a.muted:hover, a.muted:focus":{color:a.colors.text.primary},".text-warning":{color:a.colors.warning.text,"&:hover, &:focus":{color:a.colors.emphasize(a.colors.warning.text,.15)}},".text-error":{color:a.colors.error.text,"&:hover, &:focus":{color:a.colors.emphasize(a.colors.error.text,.15)}},".text-success":{color:"$success-text-color","&:hover, &:focus":{color:a.colors.emphasize(a.colors.success.text,.15)}},a:{cursor:"pointer",color:a.colors.text.primary,textDecoration:"none","&:focus":{outline:"none"},"&:focus-visible":(0,g.getFocusStyles)(a),"&:[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:a.components.textHighlight.background,color:a.components.textHighlight.text,padding:0}})}function c(a){return{margin:0,fontSize:a.fontSize,lineHeight:a.lineHeight,fontWeight:a.fontWeight,letterSpacing:a.letterSpacing,fontFamily:a.fontFamily,marginBottom:"0.45em"}}function i(a){return(0,t.css)({"iframe.intercom-borderless-frame":{colorScheme:a.colors.mode}})}function l(a){return(0,t.css)({"input, button, select, textarea":{fontFamily:a.typography.body.fontFamily,fontSize:a.typography.body.fontSize,fontWeight:a.typography.body.fontWeight,lineHeight:a.typography.body.lineHeight},"input, select":{backgroundColor:a.components.input.background,color:a.components.input.text,border:"none",boxShadow:"none"},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 f(a){return(0,t.css)({})}function d(a){const v=a.breakpoints.values.xxl+a.spacing.gridSize*2+a.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:a.spacing(2),paddingRight:a.spacing(2),[a.breakpoints.up("sm")]:{margin:a.spacing(0,1)},[a.breakpoints.up("md")]:{margin:a.spacing(0,2)},[`@media (min-width: ${v}px)`]:{maxWidth:`${a.breakpoints.values.xxl}px`,marginLeft:"auto",marginRight:"auto",width:"100%"}},".page-full":{marginLeft:a.spacing(2),paddingLeft:a.spacing(2),paddingRight:a.spacing(2)},".page-body":{padding:a.spacing(1),background:a.components.panel.background,border:`1px solid ${a.components.panel.borderColor}`,marginBottom:"32px",[a.breakpoints.up("md")]:{padding:a.spacing(2)},[a.breakpoints.up("lg")]:{padding:a.spacing(3)}},".page-heading":{fontSize:a.typography.h4.fontSize,marginTop:0,marginBottom:a.spacing(2)},".page-action-bar":{marginBottom:a.spacing(2),display:"flex",alignItems:"flex-start",gap:a.spacing(2)},".page-action-bar--narrow":{marginBottom:0},".page-action-bar__spacer":{width:a.spacing(2),flexGrow:1},".page-sub-heading":{marginBottom:a.spacing(2)},".page-sub-heading-icon":{marginLeft:a.spacing(1),marginTop:a.spacing(.5)},".page-hidden":{display:"none"}})}var h=e(72129);const p=a=>(0,t.css)({".react-loading-skeleton":h.Q});function m(){const a=(0,o.$j)();return n.createElement(t.Global,{styles:[u(a),i(a),l(a),d(a),r(a),s(a),f(a),p(a)]})}},40845:(Q,A,e)=>{"use strict";e.d(A,{$j:()=>h,DP:()=>d,IS:()=>p,SL:()=>l,cV:()=>f,fq:()=>a,of:()=>m});var t=e(4146),n=e.n(t),o=e(47078),s=e.n(o),r=e(96540),g=e(60578),u=e(3911);let c=null;const i=new WeakMap,l=v=>{const E=D=>{const b=c||g.D;return r.createElement(b.Consumer,null,C=>r.createElement(v,{...D,theme:C.v1}))};return E.displayName=`WithTheme(${v.displayName})`,n()(E,v),E},f=v=>{const E=D=>{const b=c||g.D;return r.createElement(b.Consumer,null,C=>r.createElement(v,{...D,theme:C}))};return E.displayName=`WithTheme(${v.displayName})`,n()(E,v),E};function d(){return(0,r.useContext)(c||g.D).v1}function h(){return(0,r.useContext)(c||g.D)}function p(v){const E=d();let D=i.get(v);return D||(D=(0,u.N)(v),i.set(v,D)),D(E)}function m(v,...E){const D=h();let b=i.get(v);return b||(b=s()(v,{maxSize:10}),i.set(v,b)),b(D,...E)}const a=v=>(c=r.createContext(v),()=>{c=null})},7918:(Q,A,e)=>{"use strict";e.d(A,{kH:()=>c.k,Dx:()=>t.D,O4:()=>r,mG:()=>g,fq:()=>n.fq,YF:()=>i,N3:()=>u.N,IS:()=>n.IS,of:()=>n.of,DP:()=>n.DP,$j:()=>n.$j,SL:()=>n.SL,cV:()=>n.cV});var t=e(60578),n=e(40845),o=e(47696);let s;const r=(l="dark")=>s?s(l):(0,o.a)({colors:{mode:l}}).v1,g=l=>(s=l,()=>{s=null});var u=e(3911),c=e(93218),i=e(16797)},16797:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{cardChrome:()=>n,focusCss:()=>c,getFocusStyles:()=>l,getMouseFocusStyles:()=>i,getTooltipContainerStyles:()=>f,hoverColor:()=>o,listItem:()=>s,listItemSelected:()=>r,mediaUp:()=>g});var t=e(84140);function n(d){return` background: ${d.colors.background.secondary}; &:hover { background: ${o(d.colors.background.secondary,d)}; } box-shadow: ${d.components.panel.boxShadow}; border-radius: ${d.shape.radius.default}; `}function o(d,h){return h.isDark?(0,t.A)(d).brighten(2).toString():(0,t.A)(d).darken(2).toString()}function s(d){return` background: ${d.colors.background.secondary}; &:hover { background: ${o(d.colors.background.secondary,d)}; } box-shadow: ${d.components.panel.boxShadow}; border-radius: ${d.shape.radius.default}; `}function r(d){return` background: ${o(d.colors.background.secondary,d)}; color: ${d.colors.text.maxContrast}; `}function g(d){return`only screen and (min-width: ${d})`}const u=d=>d.hasOwnProperty("v1"),c=d=>{const h=u(d),p=h?d.colors.background.canvas:d.colors.bodyBg,m=h?d.colors.primary.main:d.colors.formFocusOutline;return` outline: 2px dotted transparent; outline-offset: 2px; box-shadow: 0 0 0 2px ${p}, 0 0 0px 4px ${m}; transition-property: outline, outline-offset, box-shadow; transition-duration: 0.2s; transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);`};function i(d){return{outline:"none",boxShadow:"none"}}function l(d){return{outline:"2px dotted transparent",outlineOffset:"2px",boxShadow:`0 0 0 2px ${d.colors.background.canvas}, 0 0 0px 4px ${d.colors.primary.main}`,transitionTimingFunction:"cubic-bezier(0.19, 1, 0.22, 1)",transitionDuration:"0.2s",transitionProperty:"outline, outline-offset, box-shadow"}}const f=d=>({overflow:"hidden",background:d.colors.background.secondary,boxShadow:d.shadows.z2,maxWidth:"800px",padding:d.spacing(1),borderRadius:d.shape.radius.default,zIndex:d.zIndex.tooltip})},3911:(Q,A,e)=>{"use strict";e.d(A,{N:()=>o});var t=e(47078),n=e.n(t);function o(s){return n()(s)}},50774:(Q,A,e)=>{"use strict";e.d(A,{I:()=>t});var t=(n=>(n.GroupTitle="GroupTitle",n))(t||{})},29621:()=>{"use strict"},4025:(Q,A,e)=>{"use strict";e.d(A,{GO:()=>s,SS:()=>r,Uo:()=>t.Uo,lV:()=>g,rJ:()=>o});var t=e(8887),n=e(11261);const o=u=>["xs","sm","md","lg","xl","xxl","xxxl"].includes(u),s=()=>Object.keys(t.az);function r(u){return g(u?.type)}function g(u){if(u)switch(u){case n.PU.time:return"clock-nine";case n.PU.string:return"font";case n.PU.number:return"calculator-alt";case n.PU.boolean:return"toggle-on";case n.PU.trace:return"info-circle";case n.PU.enum:return"list-ol";case n.PU.geo:return"map-marker";case n.PU.other:return"brackets-curly"}return"question-circle"}},80186:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{CompletionItemKind:()=>r.I,getAvailableIcons:()=>c.GO,getFieldTypeIcon:()=>c.SS,getFieldTypeIconName:()=>c.lV,isIconSize:()=>c.rJ,toIconName:()=>c.Uo});var t=e(64611),n=e.n(t),m={};for(const a in t)a!=="default"&&(m[a]=()=>t[a]);e.d(A,m);var o=e(11866),s=e.n(o),m={};for(const a in o)a!=="default"&&(m[a]=()=>o[a]);e.d(A,m);var r=e(50774),g=e(29621),u=e.n(g),m={};for(const a in g)["default","CompletionItemKind"].indexOf(a)<0&&(m[a]=()=>g[a]);e.d(A,m);var c=e(4025),i=e(19932),l=e.n(i),m={};for(const a in i)["default","CompletionItemKind","getAvailableIcons","getFieldTypeIcon","getFieldTypeIconName","isIconSize","toIconName"].indexOf(a)<0&&(m[a]=()=>i[a]);e.d(A,m);var f=e(72389),d=e.n(f),m={};for(const a in f)["default","CompletionItemKind","getAvailableIcons","getFieldTypeIcon","getFieldTypeIconName","isIconSize","toIconName"].indexOf(a)<0&&(m[a]=()=>f[a]);e.d(A,m);var h=e(65484),p=e.n(h),m={};for(const a in h)["default","CompletionItemKind","getAvailableIcons","getFieldTypeIcon","getFieldTypeIconName","isIconSize","toIconName"].indexOf(a)<0&&(m[a]=()=>h[a]);e.d(A,m)},11866:()=>{"use strict"},65484:()=>{"use strict"},19932:()=>{"use strict"},72389:()=>{"use strict"},64611:()=>{"use strict"},40321:(Q,A,e)=>{"use strict";e.d(A,{Q:()=>t});const t=(n,o)=>{n.key==="Tab"||n.altKey||n.ctrlKey||n.metaKey||(n.stopPropagation(),n.key==="Escape"&&o())}},24284:(Q,A,e)=>{"use strict";e.d(A,{Ih:()=>v,Mk:()=>r,Tj:()=>f,UJ:()=>l,Xw:()=>g,ct:()=>i,mZ:()=>a,nO:()=>c,sg:()=>m,xj:()=>u});var t=e(2543),n=e.n(t),o=e(84140);const s=4,r="rgba(0, 211, 255, 1)",g="rgba(11, 237, 50, 1)",u="rgba(237, 46, 24, 1)",c="rgba(150, 150, 150, 1)",i="rgba(247, 149, 32, 1)",l=.09,f=["#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 d(E){const D=(0,t.map)(E,h),b=(0,t.sortBy)(D,["h"]),C=(0,t.chunk)(b,s),y=(0,t.map)(C,T=>(0,t.sortBy)(T,"l")),M=(0,t.flattenDeep)((0,t.zip)(...y));return(0,t.map)(M,p)}function h(E){return(0,o.A)(E).toHsl()}function p(E){return(0,o.A)(E).toHexString()}function m(E){return(0,o.A)(E).getBrightness()>180?"rgb(32, 34, 38)":"rgb(247, 248, 250)"}function a(E,D){const b=(0,o.A)(E),C=b.getBrightness();return b.getAlpha()<.3?D?"rgb(247, 248, 250)":"rgb(32, 34, 38)":C>180?"rgb(32, 34, 38)":"rgb(247, 248, 250)"}let v=d(f)},14555:(Q,A,e)=>{"use strict";e.d(A,{F:()=>n,J:()=>t});const t=o=>o().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=o=>/\/explore\?.*&(left|right)=\[(.*\,){2,}(.*){1}\]/.test(o)},40621:(Q,A,e)=>{"use strict";e.d(A,{h:()=>t});function t(n,o,s){}},53550:(Q,A,e)=>{"use strict";e.d(A,{i:()=>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}`}},9830:(Q,A,e)=>{"use strict";e.d(A,{I:()=>o});var t=e(2543),n=e.n(t);function o(s,r){let g=0,u=s.indexOf(r);r=r.replace(/\s/g,"");const c=[];if(u!==-1)return{distance:0,found:!0,ranges:[{start:u,end:u+r.length-1}]};for(const i of r){const l=s.indexOf(i,u);if(l===-1)return{distance:1/0,ranges:[],found:!1};if(u!==-1&&(g+=l-u),u=l+1,c.length===0)c.push({start:l,end:l});else{const f=(0,t.last)(c);l===f.end+1?f.end++:c.push({start:l,end:l})}}return{distance:g,ranges:c,found:!0}}},76412:(Q,A,e)=>{"use strict";e.d(A,{t:()=>c,x:()=>g});var t=e(72635),n=e(96540),o=e(65414),s=e(52822);function r(){typeof t.default.options.resources!="object"&&t.default.use(o.r9).init({resources:{},returnEmptyString:!1,lng:"en-US"})}const g=i=>(r(),n.createElement(s.x,{...i})),u=t.default.t,c=(i,l,f)=>(r(),u(i,l,f))},99598:(Q,A,e)=>{"use strict";e.d(A,{xj:()=>r.xj,Mk:()=>r.Mk,bk:()=>t,Pw:()=>g.Pw,nO:()=>r.nO,uc:()=>E,Xw:()=>r.Xw,ct:()=>r.ct,UJ:()=>r.UJ,zt:()=>s,yx:()=>u.yx,Tt:()=>p.T,DB:()=>m.DB,hF:()=>v.h,Vr:()=>d.Vr,Tj:()=>r.Tj,h:()=>a.h,It:()=>D.I,Yc:()=>d.Yc,kl:()=>f.k,XJ:()=>l.X,yC:()=>i.yC,JF:()=>i.JF,MC:()=>i.MC,mZ:()=>r.mZ,sg:()=>r.sg,K:()=>g.K,Fr:()=>c.F,Jl:()=>c.J,dF:()=>u.dF,mO:()=>u.mO,kD:()=>d.kD,RP:()=>g.RP,Ih:()=>r.Ih,CH:()=>h.C,tf:()=>g.tf});var t={};e.r(t),e.d(t,{getNextCharacter:()=>o,getPreviousCousin:()=>n}),typeof window<"u"&&"Element"in window&&!Element.prototype.closest&&(Element.prototype.closest=function(b){const C=(this.document||this.ownerDocument).querySelectorAll(b);let y=this,M;do{for(M=C.length;--M>=0&&C.item(M)!==y;);y=y.parentElement}while(M<0&&y);return y});function n(b,C){let y=b.parentElement.previousSibling,M;for(;y;){if(M=y.querySelector(C),M)return M;y=y.previousSibling}}function o(b){const C=(b||window).getSelection();if(!C||!C.anchorNode)return null;const y=C.getRangeAt(0),M=C.anchorNode.textContent,T=y.startOffset;return M.slice(T,T+1)}var s=e(67892),r=e(24284),g=e(29734),u=e(72307),c=e(14555),i=e(69613),l=e(5260),f=e(90914),d=e(29413),h=e(69731),p=e(75071),m=e(88838),a=e(91040),v=e(40621),E=(b=>(b.id="id",b.title="title",b.subTitle="subTitle",b.mainStat="mainStat",b.secondaryStat="secondaryStat",b.source="source",b.target="target",b.detail="detail__",b.arc="arc__",b.color="color",b))(E||{}),D=e(9830)},91040:(Q,A,e)=>{"use strict";e.d(A,{h:()=>s});var t=e(2543),n=e.n(t);const o=(0,t.throttle)((...r)=>{console.log(...r)},500),s=r=>{let g=!1;return typeof window<"u"&&(g=window.localStorage.getItem("grafana.debug")==="true"),{logger:(u,c=!1,...i)=>{},enable:()=>g=!0,disable:()=>g=!1,isEnabled:()=>g}}},29413:(Q,A,e)=>{"use strict";e.d(A,{Vr:()=>u,Yc:()=>r,kD:()=>g});let t;const n=new Map,o=500;let s="";function r(){return t||(t=document.createElement("canvas").getContext("2d")),t}function g(c,i,l=400){const f=`${l} ${i}px 'Inter'`,d=c+f,h=n.get(d);if(h)return h;const p=r();s!==f&&(p.font=s=f);const m=p.measureText(c);return n.size===o&&n.clear(),n.set(d,m),m}function u(c,i,l,f,d,h){const p=g(c,14,h),m=i/(p.width+2)*14,a=l/f,v=Math.min(a,m);return Math.min(v,d??v)}},67892:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{getChildId:()=>n,renderOrCallToRender:()=>o});var t=e(96540);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 o(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`)}},5260:(Q,A,e)=>{"use strict";e.d(A,{X:()=>n});let t=null;function n(){if(t!==null)return t;if(typeof document<"u"){const o=document.createElement("div"),s={width:"100px",height:"100px",position:"absolute",top:"-9999px",overflow:"scroll",MsOverflowStyle:"scrollbar"};Object.keys(s).map(r=>{o.style[r]=s[r]}),document.body.appendChild(o),t=o.offsetWidth-o.clientWidth,document.body.removeChild(o)}else t=0;return t||0}},75071:(Q,A,e)=>{"use strict";e.d(A,{H:()=>g,T:()=>n});var t=e(9830),n=(u=>(u.Word="Word",u.Prefix="Prefix",u.Fuzzy="Fuzzy",u))(n||{});const g={Word:(u,c)=>u.filter(i=>(i.filterText||i.label).includes(c)),Prefix:(u,c)=>u.filter(i=>(i.filterText||i.label).startsWith(c)),Fuzzy:(u,c)=>(c=c.toLowerCase(),u.filter(i=>{const{distance:l,ranges:f,found:d}=(0,t.I)(i.label.toLowerCase(),c);return d?(i.sortValue=l,i.highlightParts=f,!0):!1}))}},72129:(Q,A,e)=>{"use strict";e.d(A,{Q:()=>s,j:()=>r});var t=e(32196),n=e(96540);const s={animationName:(0,t.keyframes)({"0%":{opacity:0},"100%":{opacity:1}}),animationDelay:"100ms",animationTimingFunction:"ease-in",animationDuration:"100ms",animationFillMode:"backwards"},r=(g,u)=>Object.assign(g,{Skeleton:i=>n.createElement(u,{...i,rootProps:{style:s}})})},72307:(Q,A,e)=>{"use strict";e.d(A,{dF:()=>o,mO:()=>s,yx:()=>n});var t=e(82611);const n={document:{nodes:[{match:[{type:"paragraph"},{type:"code_block"},{type:"code_line"}]}]},inlines:{}},o=(r,g)=>{const u=r.split(` `).map(i=>t.eB.create({type:"code_line",nodes:[t.EY.create(i)]})),c=t.eB.create({data:{syntax:g},type:"code_block",nodes:u});return t.yo.create({nodes:[c]})},s=(r,g)=>{const u=o(r,g);return t.WT.create({document:u})}},90914:(Q,A,e)=>{"use strict";e.d(A,{k:()=>t});const t=(n,o)=>{let s;if(n.getLinks&&(s=n.getLinks({valueRowIndex:o.index})),!!s){for(let r=0;r<s?.length;r++)if(s[r].onClick){const g=s[r].onClick;s[r].onClick=u=>{u.ctrlKey||u.metaKey||u.shiftKey||(u.preventDefault(),g(u,{field:n,rowIndex:o.index}))}}return s}}},69613:(Q,A,e)=>{"use strict";e.d(A,{JF:()=>o,MC:()=>s,yC:()=>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 o(c=""){const i=g(c.toLowerCase());return Math.abs(i%t.length)}function s(c=""){const i=o(c);return r(i)}function r(c){return{color:t[c],borderColor:n[c]}}function g(c){let i=5381;for(let l=0;l<c.length;l++)i=(i<<5)+i+c.charCodeAt(l);return i}var u={getTagColorsFromName:s}},18976:(Q,A,e)=>{"use strict";e.d(A,{O:()=>o,f:()=>s});var t=e(32196),n=e(23596);function o(r){switch(r){case"auto":return"bottom";case"auto-start":return"bottom-start";case"auto-end":return"bottom-end";default:return r??"bottom"}}function s(r,g,u,c,i){return{arrow:(0,t.css)({fill:g}),container:(0,t.css)({backgroundColor:g,borderRadius:r.shape.radius.default,border:`1px solid ${u}`,boxShadow:r.shadows.z2,color:c,fontSize:r.typography.bodySmall.fontSize,padding:r.spacing(i.topBottom,i.rightLeft),transition:"opacity 0.3s",zIndex:r.zIndex.tooltip,maxWidth:"400px",overflowWrap:"break-word","&[data-popper-interactive='false']":{pointerEvents:"none"},code:{border:"none",display:"inline",background:n.darken(g,.1),color:c,whiteSpace:"normal"},pre:{background:n.darken(g,.1),color:c},a:{color:c,textDecoration:"underline"},"a:hover":{textDecoration:"none"}}),headerClose:(0,t.css)({color:r.colors.text.secondary,position:"absolute",right:r.spacing(1),top:r.spacing(1.5),backgroundColor:"transparent",border:0}),header:(0,t.css)({paddingTop:r.spacing(1),paddingBottom:r.spacing(2)}),body:(0,t.css)({paddingTop:r.spacing(1),paddingBottom:r.spacing(1)}),footer:(0,t.css)({paddingTop:r.spacing(2),paddingBottom:r.spacing(1)})}}},69731:(Q,A,e)=>{"use strict";e.d(A,{C:()=>n});var t=e(96540);function n(){const[o,s]=(0,t.useState)(0);return()=>s(r=>r+1)}},29734:(Q,A,e)=>{"use strict";e.d(A,{K:()=>o,Pw:()=>t,RP:()=>s,tf:()=>n});var t=(r=>(r.onBlur="onBlur",r.onFocus="onFocus",r.onChange="onChange",r))(t||{});const n=(r,g)=>{const u=g.reduce((c,i)=>i.rule(r)?c:c.concat(i.errorMessage),[]);return u.length>0?u:null},o=(r,g)=>g&&g[r],s=(r,g)=>({rule:u=>!!u.match(r),errorMessage:g||"Value is not valid"})},91950:(Q,A,e)=>{"use strict";e.d(A,{A:()=>o,f:()=>r});var t=e(2543),n=e.n(t);class o{constructor(u){if(this.columns=[],this.columnMap={},this.rows=[],this.type="table",u){if(u.columns)for(const c of u.columns)this.addColumn(c);if(u.rows)for(const c of u.rows)this.addRow(c)}}sort(u){u.col===null||u.col===void 0||this.columns.length<=u.col||(this.rows.sort((c,i)=>(c=c[u.col],i=i[u.col],+(c==null)-+(i==null)||+(c>i)||-(c<i))),u.desc&&this.rows.reverse(),this.columns[u.col].sort=!0,this.columns[u.col].desc=u.desc)}addColumn(u){this.columnMap[u.text]||(this.columns.push(u),this.columnMap[u.text]=u)}addRow(u){this.rows.push(u)}}function s(g,u,c){let i=!1;for(let l=0;l<g.length;l++)if(u[l]!==void 0&&c[l]!==void 0){if(u[l]!==c[l])return!1}else(u[l]===void 0||c[l]===void 0)&&(i=!0);return i}function r(g,...u){const c=g||new o;if(arguments.length===1)return c;if(arguments.length===2)return c.columns=u[0].hasOwnProperty("columns")?[...u[0].columns]:[],c.rows=u[0].hasOwnProperty("rows")?[...u[0].rows]:[],c;const i=u.filter(a=>!!a.columns),l={},f=i.slice().reduce((a,v)=>(v.columns.forEach(E=>{const{text:D}=E;l[D]===void 0&&(l[D]=a.length,a.push(E))}),a),[]),d=i.map(a=>a.columns.map(v=>l[v.text])),h=i.reduce((a,v,E)=>{const D=d[E];return v.rows.forEach(b=>{const C=[];D.forEach((y,M)=>{C[y]=b[M]}),a.push(C)}),a},[]),p={},m=h.reduce((a,v,E)=>{if(!p[E]){let D=E+1;for(;D<h.length;){const b=(0,t.findIndex)(h,C=>s(f,v,C),D);if(b>-1){const C=h[b];for(let y=0;y<f.length;y++)v[y]===void 0&&C[y]!==void 0&&(v[y]=C[y]);p[b]=C,D=b+1}else break}a.push(v)}return a},[]);return c.columns=f,c.rows=m,c}},97007:(Q,A,e)=>{"use strict";e.d(A,{N:()=>n});var t=e(30038);const n=(0,t.VP)("core/cleanUpState")},82467:(Q,A,e)=>{"use strict";e.d(A,{Do:()=>t.Do,Vz:()=>n.Vz,YA:()=>n.YA,dx:()=>t.dx});var t=e(16001),n=e(28215)},28138:(Q,A,e)=>{"use strict";e.d(A,{A:()=>o,l:()=>n});var t=e(18226);const n=new t.o,o=n},5108:(Q,A,e)=>{"use strict";e.d(A,{x:()=>H});var t=e(32196),n=e(2543),o=e(96540),s=e(40845),r=e(68402),g=e(90613),u=e(94753),c=e(55852),i=e(9025),l=e(44836),f=e(27677),d=e(43907),h=e(67061),p=e(88323),m=e(25469),a=e(17172);class v extends o.Component{constructor(Y){super(Y),this.state={isLoading:!1},this.search=this.search.bind(this),this.debouncedSearch=(0,n.debounce)(this.search,300,{leading:!0,trailing:!0})}search(Y){return this.setState({isLoading:!0}),(0,n.isNil)(Y)&&(Y=""),(0,a.AI)().get("/api/serviceaccounts/search").then(ee=>ee.serviceAccounts.map(re=>({id:re.id,value:re.id,label:re.login,imgUrl:re.avatarUrl,login:re.login}))).finally(()=>{this.setState({isLoading:!1})})}render(){const{className:Y,onSelected:ee,inputId:re}=this.props,{isLoading:J}=this.state;return o.createElement("div",{className:"service-account-picker","data-testid":"serviceAccountPicker"},o.createElement(p.DW,{isClearable:!0,className:Y,inputId:re,isLoading:J,defaultOptions:!0,loadOptions:this.debouncedSearch,onChange:ee,placeholder:"Start typing to search for service accounts",noOptionsMessage:"No service accounts found","aria-label":"Service Account picker"}))}}class E extends o.Component{constructor(Y){super(Y),this.state={isLoading:!1},this.search=this.search.bind(this),this.debouncedSearch=(0,n.debounce)(this.search,300,{leading:!0,trailing:!0})}componentDidMount(){const{teamId:Y}=this.props;Y&&(0,a.AI)().get(`/api/teams/${Y}`).then(ee=>{this.setState({value:{value:ee,label:ee.name,imgUrl:ee.avatarUrl}})})}search(Y){return this.setState({isLoading:!0}),(0,n.isNil)(Y)&&(Y=""),(0,a.AI)().get(`/api/teams/search?perpage=100&page=1&query=${Y}`).then(ee=>{const re=ee.teams.map(J=>({value:J,label:J.name,imgUrl:J.avatarUrl}));return this.setState({isLoading:!1}),re})}render(){const{onSelected:Y,className:ee}=this.props,{isLoading:re,value:J}=this.state;return o.createElement("div",{className:"user-picker","data-testid":"teamPicker"},o.createElement(p.DW,{isLoading:re,defaultOptions:!0,loadOptions:this.debouncedSearch,value:J,onChange:Y,className:ee,placeholder:"Select a team",noOptionsMessage:"No teams found","aria-label":"Team picker"}))}}class D extends o.Component{constructor(Y){super(Y),this.state={isLoading:!1},this.search=this.search.bind(this),this.debouncedSearch=(0,n.debounce)(this.search,300,{leading:!0,trailing:!0})}search(Y){return this.setState({isLoading:!0}),(0,n.isNil)(Y)&&(Y=""),(0,a.AI)().get(`/api/org/users/lookup?query=${Y}&limit=100`).then(ee=>ee.map(re=>({id:re.userId,value:re.userId,label:re.login,imgUrl:re.avatarUrl,login:re.login}))).finally(()=>{this.setState({isLoading:!1})})}render(){const{className:Y,onSelected:ee,inputId:re}=this.props,{isLoading:J}=this.state;return o.createElement("div",{className:"user-picker","data-testid":"userPicker"},o.createElement(p.DW,{isClearable:!0,className:Y,inputId:re,isLoading:J,defaultOptions:!0,loadOptions:this.debouncedSearch,onChange:ee,placeholder:"Start typing to search for user",noOptionsMessage:"No users found","aria-label":"User picker"}))}}var b=e(24897),C=(k=>(k.None="None",k.Team="Team",k.User="User",k.ServiceAccount="ServiceAccount",k.BuiltInRole="builtInRole",k))(C||{});const y=({title:k=(0,l.t)("access-control.add-permission.title","Add permission for"),permissions:Y,assignments:ee,onAdd:re,onCancel:J})=>{const[ne,q]=(0,o.useState)(C.None),[te,oe]=(0,o.useState)(0),[ue,ie]=(0,o.useState)(0),[ge,he]=(0,o.useState)(""),[De,pe]=(0,o.useState)(""),le=(0,o.useMemo)(()=>{const Ee=[];return ee.users&&Ee.push({value:C.User,label:(0,l.t)("access-control.add-permission.user-label","User")}),ee.serviceAccounts&&Ee.push({value:C.ServiceAccount,label:(0,l.t)("access-control.add-permission.serviceaccount-label","Service Account")}),ee.teams&&Ee.push({value:C.Team,label:(0,l.t)("access-control.add-permission.team-label","Team")}),ee.builtInRoles&&Ee.push({value:C.BuiltInRole,label:(0,l.t)("access-control.add-permission.role-label","Role")}),Ee},[ee]);(0,o.useEffect)(()=>{Y.length>0&&pe(Y[0])},[Y]);const Te=()=>ne===C.Team&&te>0||ne===C.User&&ue>0||ne===C.ServiceAccount&&ue>0||C.BuiltInRole&&b.XT.hasOwnProperty(ge);return o.createElement("div",{className:"cta-form","aria-label":"Permissions slider"},o.createElement(m.J,{onClick:J}),o.createElement("h5",null,k),o.createElement("form",{name:"addPermission",onSubmit:Ee=>{Ee.preventDefault(),re({userId:ue,teamId:te,builtInRole:ge,permission:De,target:ne})}},o.createElement(h.B,{gap:1,direction:"row"},o.createElement(p.l6,{"aria-label":"Role to add new permission to",value:ne,options:le,onChange:Ee=>q(Ee.value),disabled:le.length===0,width:"auto"}),ne===C.User&&o.createElement(D,{onSelected:Ee=>ie(Ee?.value||0)}),ne===C.ServiceAccount&&o.createElement(v,{onSelected:Ee=>ie(Ee?.value||0)}),ne===C.Team&&o.createElement(E,{onSelected:Ee=>oe(Ee.value?.id||0)}),ne===C.BuiltInRole&&o.createElement(p.l6,{"aria-label":"Built-in role picker",options:Object.values(b.XT).filter(Ee=>Ee!==b.XT.None).map(Ee=>({value:Ee,label:Ee})),onChange:Ee=>he(Ee.value||""),width:"auto"}),o.createElement(p.l6,{"aria-label":"Permission Level",width:"auto",value:Y.find(Ee=>Ee===De),options:Y.map(Ee=>({label:Ee,value:Ee})),onChange:Ee=>pe(Ee.value||"")}),o.createElement(c.$n,{type:"submit",disabled:!Te()},o.createElement(l.x6,{i18nKey:"access-control.add-permissions.save"},"Save")))))};var M=e(56034),T=e(14578);const I=({item:k,permissionLevels:Y,canSet:ee,onRemove:re,onChange:J})=>{const ne=(0,s.of)(L);return o.createElement("tr",null,o.createElement("td",null,x(k)),o.createElement("td",null,O(k)),o.createElement("td",null,k.isInherited&&o.createElement("em",{className:"muted no-wrap"},"Inherited from folder")),o.createElement("td",null,o.createElement(p.l6,{disabled:!ee||!k.isManaged,onChange:q=>J(k,q.value),value:Y.find(q=>q===k.permission),options:Y.map(q=>({value:q,label:q}))})),o.createElement("td",null,k.warning?o.createElement(M.m,{content:o.createElement(o.Fragment,null,o.createElement(g.a,{marginBottom:1},k.warning),P(k))},o.createElement(T.I,{name:"exclamation-triangle",className:ne.warning})):o.createElement(M.m,{content:P(k)},o.createElement(T.I,{name:"info-circle"}))),o.createElement("td",null,k.isManaged?o.createElement(c.$n,{size:"sm",icon:"times",variant:"destructive",disabled:!ee,onClick:()=>re(k),"aria-label":`Remove permission for ${S(k)}`}):o.createElement(M.m,{content:k.isInherited?"Inherited Permission":"Provisioned Permission"},o.createElement(c.$n,{size:"sm",icon:"lock"}))))},x=k=>k.teamId?o.createElement("img",{className:"filter-table__avatar",src:k.teamAvatarUrl,alt:`Avatar for team ${k.teamId}`}):k.userId?o.createElement("img",{className:"filter-table__avatar",src:k.userAvatarUrl,alt:`Avatar for user ${k.userId}`}):o.createElement(T.I,{size:"xl",name:"shield"}),S=k=>k.userId?k.userLogin:k.teamId?k.team:k.builtInRole,O=k=>k.userId?o.createElement("span",{key:"name"},k.userLogin," "):k.teamId?o.createElement("span",{key:"name"},k.team," "):k.builtInRole?o.createElement("span",{key:"name"},k.builtInRole," "):o.createElement("span",{key:"name"}),P=k=>`Actions: ${[...new Set(k.actions)].sort().join(" ")}`,L=k=>({warning:(0,t.css)({color:k.colors.warning.main})}),U=({title:k,items:Y,compareKey:ee,permissionLevels:re,canSet:J,onRemove:ne,onChange:q})=>{const te=(0,o.useMemo)(()=>{const oe={};for(let ue of Y){const ie=ue[ee];if(!oe[ie]){oe[ie]=ue;continue}if(ue.actions.length>oe[ie].actions.length){oe[ie]=ue;continue}ue.actions.length===oe[ie].actions.length&&!ue.isInherited&&(oe[ie]=ue)}return Object.keys(oe).map(ue=>oe[ue])},[Y,ee]);return te.length===0?null:o.createElement("div",null,o.createElement("table",{className:"filter-table gf-form-group"},o.createElement("thead",null,o.createElement("tr",null,o.createElement("th",{style:{width:"1%"}}),o.createElement("th",null,k),o.createElement("th",{style:{width:"1%"}}),o.createElement("th",{style:{width:"40%"}},o.createElement(l.x6,{i18nKey:"access-control.permission-list.permission"},"Permission")),o.createElement("th",{style:{width:"1%"}}),o.createElement("th",{style:{width:"1%"}}))),o.createElement("tbody",null,te.map((oe,ue)=>o.createElement(I,{item:oe,onRemove:ne,onChange:q,canSet:J,key:`${ue}-${oe.userId}`,permissionLevels:re})))))},R="",B={permissions:[],assignments:{teams:!1,users:!1,serviceAccounts:!1,builtInRoles:!1}},H=({title:k=(0,l.t)("access-control.permissions.title","Permissions"),buttonLabel:Y=(0,l.t)("access-control.permissions.add-label","Add a permission"),emptyLabel:ee=(0,l.t)("access-control.permissions.no-permissions","There are no permissions"),resource:re,resourceId:J,canSetPermissions:ne,addPermissionTitle:q,getWarnings:te})=>{const oe=(0,s.of)(j),[ue,ie]=(0,o.useState)(!1),[ge,he]=(0,o.useState)([]),[De,pe]=(0,o.useState)(B),le=(0,o.useCallback)(async()=>{let st=await N(re,J);te&&(st=te(st)),he(st)},[re,J,te]);(0,o.useEffect)(()=>{w(re).then(st=>(pe(st),le()))},[re,J,le]);const Te=st=>{let Ke=null;st.target===C.User||st.target===C.ServiceAccount?Ke=V(re,J,st.userId,st.permission):st.target===C.Team?Ke=G(re,J,st.teamId,st.permission):st.target===C.BuiltInRole&&(Ke=_(re,J,st.builtInRole,st.permission)),Ke!==null&&Ke.then(le)},Ee=st=>{let Ke=null;st.userId?Ke=V(re,J,st.userId,R):st.teamId?Ke=G(re,J,st.teamId,R):st.isServiceAccount&&st.userId?Ke=V(re,J,st.userId,R):st.builtInRole&&(Ke=_(re,J,st.builtInRole,R)),Ke!==null&&Ke.then(le)},Re=(st,Ke)=>{st.permission!==Ke&&(st.userId?Te({permission:Ke,userId:st.userId,target:C.User}):st.isServiceAccount?Te({permission:Ke,userId:st.userId,target:C.User}):st.teamId?Te({permission:Ke,teamId:st.teamId,target:C.Team}):st.builtInRole&&Te({permission:Ke,builtInRole:st.builtInRole,target:C.BuiltInRole}))},me=(0,o.useMemo)(()=>(0,n.sortBy)(ge.filter(st=>st.teamId),["team","isManaged"]),[ge]),Me=(0,o.useMemo)(()=>(0,n.sortBy)(ge.filter(st=>st.userId&&!st.isServiceAccount),["userLogin","isManaged"]),[ge]),ye=(0,o.useMemo)(()=>(0,n.sortBy)(ge.filter(st=>st.userId&&st.isServiceAccount),["userLogin","isManaged"]),[ge]),Le=(0,o.useMemo)(()=>(0,n.sortBy)(ge.filter(st=>st.builtInRole),["builtInRole","isManaged"]),[ge]),We=(0,l.t)("access-control.permissions.role","Role"),Be=(0,l.t)("access-control.permissions.user","User"),Ye=(0,l.t)("access-control.permissions.serviceaccount","Service Account"),at=(0,l.t)("access-control.permissions.team","Team");return o.createElement("div",null,ne&&re==="folders"&&o.createElement(o.Fragment,null,o.createElement(l.x6,{i18nKey:"access-control.permissions.permissions-change-warning"},"This will change permissions for this folder and all its descendants. In total, this will affect:"),o.createElement(d.x,{selectedItems:{folder:{[J]:!0},dashboard:{},panel:{},$all:!1}}),o.createElement(r.$,{v:2})),ge.length===0&&o.createElement(g.a,null,o.createElement(u.E,null,ee)),o.createElement(U,{title:We,items:Le,compareKey:"builtInRole",permissionLevels:De.permissions,onChange:Re,onRemove:Ee,canSet:ne}),o.createElement(U,{title:Be,items:Me,compareKey:"userLogin",permissionLevels:De.permissions,onChange:Re,onRemove:Ee,canSet:ne}),o.createElement(U,{title:Ye,items:ye,compareKey:"userLogin",permissionLevels:De.permissions,onChange:Re,onRemove:Ee,canSet:ne}),o.createElement(U,{title:at,items:me,compareKey:"team",permissionLevels:De.permissions,onChange:Re,onRemove:Ee,canSet:ne}),ne&&o.createElement(o.Fragment,null,o.createElement(c.$n,{className:oe.addPermissionButton,variant:"primary",key:"add-permission",onClick:()=>ie(!0),icon:"plus"},Y),o.createElement(i.a,{in:ue},o.createElement(y,{title:q,onAdd:Te,permissions:De.permissions,assignments:De.assignments,onCancel:()=>ie(!1)}))))},w=async k=>{try{return await(0,f.AI)().get(`/api/access-control/${k}/description`)}catch(Y){return console.error("failed to load resource description: ",Y),B}},N=(k,Y)=>(0,f.AI)().get(`/api/access-control/${k}/${Y}`),V=(k,Y,ee,re)=>K(k,Y,"users",ee,re),G=(k,Y,ee,re)=>K(k,Y,"teams",ee,re),_=(k,Y,ee,re)=>K(k,Y,"builtInRoles",ee,re),K=(k,Y,ee,re,J)=>(0,f.AI)().post(`/api/access-control/${k}/${Y}/${ee}/${re}`,{permission:J}),j=k=>({breakdown:(0,t.css)({...k.typography.bodySmall,color:k.colors.text.secondary,marginBottom:k.spacing(2)}),addPermissionButton:(0,t.css)({marginBottom:k.spacing(2)})})},9025:(Q,A,e)=>{"use strict";e.d(A,{a:()=>g});var t=e(96540),n=e(22669);const o="200px",s=200,r={transition:`max-height ${s}ms ease-in-out`,overflow:"hidden"},g=({children:u,in:c,maxHeight:i=o,style:l=r})=>{const f={exited:{maxHeight:0},entering:{maxHeight:i},entered:{maxHeight:"unset",overflow:"visible"},exiting:{maxHeight:0}};return t.createElement(n.Ay,{in:c,timeout:s},d=>t.createElement("div",{style:{...l,...f[d]}},u))}},75269:(Q,A,e)=>{"use strict";e.d(A,{H:()=>o});var t=e(96540),n=e(76888);const o=t.memo(({actions:s})=>{const{chrome:r}=(0,n.Il)();return(0,t.useLayoutEffect)(()=>{r.update({actions:s})}),null});o.displayName="TopNavUpdate"},10804:(Q,A,e)=>{"use strict";e.d(A,{K:()=>s});var t=e(32196),n=e(96540),o=e(40845);function s({className:g,leftActionsSeparator:u}){const c=(0,o.of)(r);return u?n.createElement("div",{className:(0,t.cx)(g,c.leftActionsSeparator)}):n.createElement("div",{className:(0,t.cx)(g,c.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})})},57571:(Q,A,e)=>{"use strict";e.d(A,{l:()=>t});const t=40},19361:(Q,A,e)=>{"use strict";e.d(A,{M:()=>i});var t=e(32196),n=e(96540),o=e(23596),s=e(40845);const r=({className:l,logo:f})=>n.createElement("img",{className:l,src:`${f||"public/img/grafana_icon.svg"}`,alt:"Grafana"}),g=({className:l,children:f})=>{const d=(0,s.$j)(),h=(0,t.css)({"&:before":{content:'""',position:"fixed",left:0,right:0,bottom:0,top:0,background:`url(public/img/g8_login_${d.isDark?"dark":"light"}.svg)`,backgroundPosition:"top center",backgroundSize:"auto",backgroundRepeat:"no-repeat",opacity:0,transition:"opacity 3s ease-in-out",[d.breakpoints.up("md")]:{backgroundPosition:"center",backgroundSize:"cover"}}});return n.createElement("div",{className:(0,t.cx)(h,l)},f)},u=({className:l})=>n.createElement("img",{className:l,src:"public/img/grafana_icon.svg",alt:"Grafana"}),c=()=>{const l=(0,s.$j)();return(0,t.css)({background:o.alpha(l.colors.background.primary,.7),backgroundSize:"cover"})};class i{}i.LoginLogo=r,i.LoginBackground=g,i.MenuLogo=u,i.LoginBoxBackground=c,i.AppTitle="Grafana",i.LoginTitle="Welcome to Grafana",i.HideEdition=!1,i.GetLoginSubTitle=()=>null},3984:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>t});function t(n,o,s){const r=[];let g=!1,u;function c(i,l=!1){if(g)return;const f=i.url?.split("?")??["",""];let d=f[0];const h=new URLSearchParams(f[1]);if(h.has("editview")&&(d+=`?editview=${h.get("editview")}`),s&&d===s.url){r.unshift({text:s.text,href:i.url??""}),g=!0;return}const p=d.length>0&&u===d;u=d,!i.hideFromBreadcrumbs&&!(l&&p)&&r.unshift({text:i.text,href:i.url??""}),i.parentItem&&c(i.parentItem)}return o&&c(o),c(n,!0),r}},25469:(Q,A,e)=>{"use strict";e.d(A,{J:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(29158);const r=({onClick:u,"aria-label":c,style:i})=>{const l=(0,o.of)(g);return n.createElement(s.K,{"aria-label":c??"Close",className:l,name:"times",onClick:u,style:i,tooltip:"Close"})},g=u=>(0,t.css)({position:"absolute",right:u.spacing(.5),top:u.spacing(1)})},27921:(Q,A,e)=>{"use strict";e.d(A,{A:()=>n});var t=e(96540);const n=o=>t.lazy(o)},7521:(Q,A,e)=>{"use strict";e.d(A,{A:()=>l});var t=e(32196),n=e(96540),o=e(13544),s=e(14578),r=e(55852),g=e(76442);const u=(0,t.css)({textAlign:"center"}),c=(0,t.css)({maxWidth:"700px",margin:"0 auto"}),l=({title:f,buttonIcon:d,buttonLink:h,buttonTitle:p,buttonDisabled:m,onClick:a,proTip:v,proTipLink:E,proTipLinkTitle:D,proTipTarget:b,infoBox:C,infoBoxTitle:y})=>{const M=()=>n.createElement(n.Fragment,null,v?n.createElement("span",{key:"proTipFooter"},n.createElement(s.I,{name:"rocket"}),n.createElement(n.Fragment,null," ProTip: ",v," "),E&&n.createElement("a",{href:E,target:b,className:"text-link"},D)):"",C?n.createElement("div",{key:"infoBoxHtml",className:`grafana-info-box ${c}`},y&&n.createElement("h5",null,y),n.createElement("div",{dangerouslySetInnerHTML:C})):""),T=M()?"":(0,t.css)({marginBottom:"20px"}),I=h?r.z9:r.$n,x=n.createElement(I,{size:"lg",onClick:a,href:h,icon:d,className:T,"data-testid":o.Tp.components.CallToActionCard.buttonV2(p),disabled:m},p);return n.createElement(g.c,{className:u,message:f,footer:M(),callToActionElement:x})}},38645:(Q,A,e)=>{"use strict";e.d(A,{Dd:()=>r,wi:()=>i});var t=e(96540),n=e(32264),o=e(14578),s=e(44836);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(f){return{hasReleaseNotes:!0,isBeta:f.includes("-beta")}}function u(f){const{buildInfo:d,licenseInfo:h}=n.$,p=[],m=h.stateInfo?` (${h.stateInfo})`:"";if(f||p.push({target:"_blank",id:"license",text:`${d.edition}${m}`,url:h.licenseUrl}),d.hideVersion)return p;const{hasReleaseNotes:a}=g(d.version);return p.push({target:"_blank",id:"version",text:`v${d.version} (${d.commit})`,url:a?"https://github.com/grafana/grafana/blob/main/CHANGELOG.md":void 0}),d.hasUpdate&&p.push({target:"_blank",id:"updateVersion",text:"New version available!",icon:"download-alt",url:"https://grafana.com/grafana/download?utm_source=grafana_footer"}),p}function c(f){r=f}const i=t.memo(({customLinks:f,hideEdition:d})=>{const h=(f||r()).concat(u(d));return t.createElement("footer",{className:"footer"},t.createElement("div",{className:"text-center"},t.createElement("ul",null,h.map(p=>t.createElement("li",{key:p.text},t.createElement(l,{item:p}))))))});i.displayName="Footer";function l({item:f}){const d=f.url?t.createElement("a",{href:f.url,target:f.target,rel:"noopener noreferrer",id:f.id},f.text):f.text;return t.createElement(t.Fragment,null,f.icon&&t.createElement(o.I,{name:f.icon})," ",d)}},53153:(Q,A,e)=>{"use strict";e.d(A,{S:()=>d});var t=e(96540),n=e(49785),o=e(13544),s=e(40845),r=e(42418),g=e(88575),u=e(66864),c=e(55852),i=e(56034),l=e(4691),f=e(78361);const d=({onSubmit:h,onSkip:p,showDefaultPasswordWarning:m})=>{const a=(0,s.of)(l.$),{handleSubmit:v,register:E,getValues:D,formState:{errors:b}}=(0,n.mN)({defaultValues:{newPassword:"",confirmNew:""}}),C=y=>{h(y.newPassword)};return t.createElement("form",{onSubmit:v(C)},m&&t.createElement(r.F,{severity:"info",title:"Continuing to use the default password exposes you to security risks."}),t.createElement(g.D,{label:"New password",invalid:!!b.newPassword,error:b?.newPassword?.message},t.createElement(f.s,{...E("newPassword",{required:"New Password is required"}),id:"new-password",autoFocus:!0,autoComplete:"new-password"})),t.createElement(g.D,{label:"Confirm new password",invalid:!!b.confirmNew,error:b?.confirmNew?.message},t.createElement(f.s,{...E("confirmNew",{required:"Confirmed Password is required",validate:y=>y===D().newPassword||"Passwords must match!"}),id:"confirm-new-password",autoComplete:"new-password"})),t.createElement(u.gW,null,t.createElement(c.$n,{type:"submit",className:a.submitButton},"Submit"),p&&t.createElement(i.m,{content:"If you skip you will be prompted to change password next time you log in.",placement:"bottom"},t.createElement(c.$n,{fill:"text",onClick:p,type:"button","data-testid":o.Tp.pages.Login.skip},"Skip"))))}},30249:(Q,A,e)=>{"use strict";e.d(A,{o:()=>m});var t=e(96540),n=e(64423),o=e(99165),s=e(85200),r=e(1173),g=e(11261),u=e(69129),c=e(26272),i=e(67266),l=e(79041),f=e(81297),d=e(16895),h=e(40458);function p(a,v,E=[]){for(const D of E)if(typeof D=="function"){if(!D(a,v))return!1}else if(v[D]!==a[D])return!1;return!0}class m extends t.Component{constructor(v){super(v),this.panelContext={},this.subscription=new n.yU,this.getTimeRange=()=>this.props.timeRange;let E=this.prepState(v);E.alignedData=E.config.prepData([E.alignedFrame]),this.state=E,this.plotInstance=t.createRef()}prepState(v,E=!0){let D=null;const{frames:b,fields:C,preparePlotFrame:y}=v,T=(y||h.m)(b,C||{x:s.sJ.get(r.Ct.firstTimeField).get({}),y:s.sJ.get(r.Ct.byTypes).get(new Set([g.PU.number,g.PU.enum]))},v.timeRange);if((0,d.uY)("GraphNG",!1,"data aligned",T),T){let I=this.state?.config;E&&(I=v.prepConfig(T,this.props.frames,this.getTimeRange),(0,d.uY)("GraphNG",!1,"config prepared",I)),D={alignedFrame:T,config:I},(0,d.uY)("GraphNG",!1,"data prepared",D.alignedData)}return D}handleCursorUpdate(v){if(v.tags?.has("uplot"))return;const E=v.payload?.point?.time,D=this.plotInstance.current;if(D&&E){const b=D.valToPos(E,"x");let C;if(b&&(C=(0,d.sw)(D,D.posToIdx(b))),!C||!b)return;D.setCursor({left:b,top:C})}}componentDidMount(){this.panelContext=this.context;const{eventBus:v}=this.panelContext;this.subscription.add(v.getStream(u.b_).pipe((0,o.c)(50)).subscribe({next:E=>{v!==E.origin&&this.handleCursorUpdate(E)}})),this.subscription.add(v.getStream(c.kb).pipe((0,o.c)(50)).subscribe({next:E=>this.handleCursorUpdate(E)})),this.subscription.add(v.getStream(u.ql).pipe((0,o.c)(50)).subscribe({next:()=>{const E=this.plotInstance?.current;E&&!E.cursor._lock&&E.setCursor({left:-10,top:-10})}}))}componentDidUpdate(v){const{frames:E,structureRev:D,timeZone:b,propsToDiff:C}=this.props,y=!p(v,this.props,C);if(E!==v.frames||y||b!==v.timeZone){let M=this.prepState(this.props,!1);M&&((this.state.config===void 0||b!==v.timeZone||D!==v.structureRev||!D||y)&&(M.config=this.props.prepConfig(M.alignedFrame,this.props.frames,this.getTimeRange),(0,d.uY)("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:E,children:D,renderLegend:b}=this.props,{config:C,alignedFrame:y,alignedData:M}=this.state;return C?t.createElement(i.KU,{width:v,height:E,legend:b(C)},(T,I)=>t.createElement(f.Z,{config:C,data:M,width:T,height:I,plotRef:x=>this.plotInstance.current=x},D?D(C,y):null)):null}}m.contextType=l.e4},40458:(Q,A,e)=>{"use strict";e.d(A,{m:()=>i});var t=e(11261),n=e(73060),o=e(46294);function s(l,f,d){let h,p;for(let m=0;m<f.length;m++)if(f[m]==null)p==null&&h!=null&&(p=m);else{if(p!=null&&h!=null){if(l[m]-h<d)for(;p<m;)f[p++]=void 0;p=null}h=l[m]}return f}var r=e(52622);function g(l){return l.type===t.PU.number&&l.config.custom?.drawStyle===r.GR.Bars&&!l.config.custom?.hideFrom?.viz}function u(l,f){return l.fields.find(d=>f!=null?d.name===f:d.type===t.PU.time)}function c(l,f){const d=u(l,f);let h=d?.values;for(let p=0;p<l.fields.length;p++){let m=l.fields[p];if(m===d||g(m))continue;let a=m.config.custom?.spanNulls;typeof a=="number"&&a!==-1&&h&&(m.values=s(h,m.values,a))}return l}function i(l,f,d){let h;e:for(let v of l)for(let E of v.fields)if(f.x(E,v,l)){h=E;break e}l=l.map(v=>h?.state?.nullThresholdApplied?v:(0,o.M)({frame:v,refFieldName:h.name,refFieldPseudoMin:d?.from.valueOf(),refFieldPseudoMax:d?.to.valueOf()}));let p=0;l.forEach(v=>{v.fields.forEach(E=>{g(E)&&(E.config.custom={...E.config.custom,spanNulls:-1},p++)})});let m=1/0;p>1&&l.forEach(v=>{if(!v.fields.some(g))return;const E=h.values;for(let D=0;D<E.length;D++)D>0&&(m=Math.min(m,E[D]-E[D-1]))});let a=(0,n.Fd)({frames:l,joinBy:f.x,keep:f.y,keepOriginIndices:!0});return a?(a=c(a,h.name),m!==1/0&&(a.fields.forEach((v,E)=>{let D=v.values;if(E===0){let b=D[D.length-1];D.push(b+m,b+2*m)}else g(v)?D.push(null,null):D.push(void 0,void 0)}),a.length+=2),a):null}},18759:(Q,A,e)=>{"use strict";e.d(A,{T:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(16795);function r({children:u,spacing:c,level:i}){const l=(0,o.of)(g,c,i);return n.createElement("span",{className:(0,t.css)(l.indentor)},u)}const g=(u,c,i)=>({indentor:(0,t.css)((0,s.Y)(u,c,l=>({paddingLeft:u.spacing(l*i)})))})},54391:(Q,A,e)=>{"use strict";e.d(A,{R:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(14578),r=e(10354),g=e(72093);const u=({name:i,onChange:l,verifyLayerNameUniqueness:f,overrideStyles:d})=>{const h=(0,o.of)(c),[p,m]=(0,n.useState)(!1),[a,v]=(0,n.useState)(null),E=T=>{m(!0)},D=T=>{if(m(!1),a){v(null);return}i!==T&&l(T)},b=T=>{const I=T.currentTarget.value.trim();if(I.length===0){v("An empty layer name is not allowed");return}if(f&&!f(I)&&I!==i){v("Layer name already exists");return}a&&v(null)},C=T=>{D(T.currentTarget.value.trim())},y=T=>{T.key==="Enter"&&D(T.currentTarget.value)},M=T=>{T.target.select()};return n.createElement(n.Fragment,null,n.createElement("div",{className:h.wrapper},!p&&n.createElement("button",{className:h.layerNameWrapper,title:"Edit layer name",onClick:E,"data-testid":"layer-name-div"},n.createElement("span",{className:d?"":h.layerName},i),n.createElement(s.I,{name:"pen",className:h.layerEditIcon,size:"sm"})),p&&n.createElement(n.Fragment,null,n.createElement(r.p,{type:"text",defaultValue:i,onBlur:C,autoFocus:!0,onKeyDown:y,onFocus:M,invalid:a!==null,onChange:b,className:h.layerNameInput,"data-testid":"layer-name-input"}),a&&n.createElement(g.P,{horizontal:!0},a))))},c=i=>({wrapper:(0,t.css)({label:"Wrapper",display:"flex",alignItems:"center",marginLeft:i.spacing(.5)}),layerNameWrapper:(0,t.css)({display:"flex",cursor:"pointer",border:"1px solid transparent",borderRadius:i.shape.radius.default,alignItems:"center",padding:`0 0 0 ${i.spacing(.5)}`,margin:0,background:"transparent","&:hover":{background:i.colors.action.hover,border:`1px dashed ${i.colors.border.strong}`},"&:focus":{border:`2px solid ${i.colors.primary.border}`},"&:hover, &:focus":{".query-name-edit-icon":{visibility:"visible"}}}),layerName:(0,t.css)({fontWeight:i.typography.fontWeightMedium,color:i.colors.primary.text,cursor:"pointer",overflow:"hidden",marginLeft:i.spacing(.5)}),layerEditIcon:(0,t.cx)((0,t.css)({marginLeft:i.spacing(2),visibility:"hidden"}),"query-name-edit-icon"),layerNameInput:(0,t.css)({maxWidth:"300px",margin:"-4px 0"})})},61680:(Q,A,e)=>{"use strict";e.d(A,{b:()=>o});var t=e(96540),n=e(33390);const o=s=>{const{children:r,storageKey:g,defaultValue:u}=s,[c,i]=(0,t.useState)({value:n.A.getObject(s.storageKey,s.defaultValue)});(0,t.useEffect)(()=>{const d=h=>{h.key===g&&i({value:n.A.getObject(s.storageKey,s.defaultValue)})};return window.addEventListener("storage",d),()=>{window.removeEventListener("storage",d)}});const l=d=>{try{n.A.setObject(g,d)}catch(h){console.error(h)}i({value:d})},f=()=>{try{n.A.delete(g)}catch(d){console.log(d)}i({value:u})};return t.createElement(t.Fragment,null,r(c.value,l,f))}},87570:(Q,A,e)=>{"use strict";e.d(A,{A:()=>u});var t=e(96540),n=e(17172),o=e(2913),s=e(44836);const r=()=>!!o.Ay.oauth&&Object.keys(o.Ay.oauth).length>0;class g extends t.PureComponent{constructor(l){super(l),this.changePassword=f=>{const d={newPassword:f,confirmNew:f,oldPassword:"admin"};if(this.props.resetCode){const h={code:this.props.resetCode,newPassword:f,confirmPassword:f};(0,n.AI)().post("/api/user/password/reset",h).then(()=>{this.toGrafana()})}else(0,n.AI)().put("/api/user/password",d).then(()=>{this.toGrafana()}).catch(h=>console.error(h))},this.login=f=>{this.setState({loginErrorMessage:void 0,isLoggingIn:!0}),(0,n.AI)().post("/login",f,{showErrorAlert:!1}).then(d=>{if(this.result=d,f.password!=="admin"||o.Ay.ldapEnabled||o.Ay.authProxyEnabled){this.toGrafana();return}else this.changeView(f.password==="admin")}).catch(d=>{const h=(0,n.NF)(d)?c(d):void 0;this.setState({isLoggingIn:!1,loginErrorMessage:h||(0,s.t)("login.error.unknown","Unknown error occurred")})})},this.changeView=f=>{this.setState({isChangingPassword:!0,showDefaultPasswordWarning:f})},this.toGrafana=()=>{this.result?.redirectUrl?o.Ay.appSubUrl!==""&&!this.result.redirectUrl.startsWith(o.Ay.appSubUrl)?window.location.assign(o.Ay.appSubUrl+this.result.redirectUrl):window.location.assign(this.result.redirectUrl):window.location.assign(o.Ay.appSubUrl+"/")},this.state={isLoggingIn:!1,isChangingPassword:!1,showDefaultPasswordWarning:!1,loginErrorMessage:o.Ay.loginError}}render(){const{children:l}=this.props,{isLoggingIn:f,isChangingPassword:d,showDefaultPasswordWarning:h,loginErrorMessage:p}=this.state,{login:m,toGrafana:a,changePassword:v}=this,{loginHint:E,passwordHint:D,disableLoginForm:b,disableUserSignUp:C}=o.Ay;return t.createElement(t.Fragment,null,l({isOauthEnabled:r(),loginHint:E,passwordHint:D,disableLoginForm:b,disableUserSignUp:C,login:m,isLoggingIn:f,changePassword:v,skipPasswordChange:a,isChangingPassword:d,showDefaultPasswordWarning:h,loginErrorMessage:p}))}}const u=g;function c(i){switch(i.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 i.data?.message}}},4691:(Q,A,e)=>{"use strict";e.d(A,{$:()=>d,Q:()=>f});var t=e(32196),n=e(96540),o=e(49785),s=e(13544),r=e(40845),g=e(88575),u=e(10354),c=e(55852),i=e(44836),l=e(78361);const f=({children:h,onSubmit:p,isLoggingIn:m,passwordHint:a,loginHint:v})=>{const E=(0,r.of)(d),D=(0,n.useId)(),b=(0,n.useId)(),{handleSubmit:C,register:y,formState:{errors:M}}=(0,o.mN)({mode:"onChange"});return n.createElement("div",{className:E.wrapper},n.createElement("form",{onSubmit:C(p)},n.createElement(g.D,{label:(0,i.t)("login.form.username-label","Email or username"),invalid:!!M.user,error:M.user?.message},n.createElement(u.p,{...y("user",{required:(0,i.t)("login.form.username-required","Email or username is required")}),id:D,autoFocus:!0,autoCapitalize:"none",placeholder:v,"data-testid":s.Tp.pages.Login.username})),n.createElement(g.D,{label:(0,i.t)("login.form.password-label","Password"),invalid:!!M.password,error:M.password?.message},n.createElement(l.s,{...y("password",{required:(0,i.t)("login.form.password-required","Password is required")}),id:b,autoComplete:"current-password",placeholder:a})),n.createElement(c.$n,{type:"submit","data-testid":s.Tp.pages.Login.submit,className:E.submitButton,disabled:m},m?(0,i.t)("login.form.submit-loading-label","Logging in..."):(0,i.t)("login.form.submit-label","Log in")),h))},d=h=>({wrapper:(0,t.css)({width:"100%",paddingBottom:h.spacing(2)}),submitButton:(0,t.css)({justifyContent:"center",width:"100%"})})},20851:(Q,A,e)=>{"use strict";e.d(A,{GU:()=>u,YO:()=>i,qm:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(19361),r=e(38645);const g=({children:l,enterAnimation:f=!0})=>{const d=(0,o.of)(i);return n.createElement("div",{className:(0,t.cx)(d.loginInnerBox,f&&d.enterAnimation)},l)},u=({children:l,branding:f,isChangingPassword:d})=>{const h=(0,o.of)(i),[p,m]=(0,n.useState)(!1),a=f?.loginSubtitle??s.M.GetLoginSubTitle(),v=f?.loginTitle??s.M.LoginTitle,E=f?.loginBoxBackground||s.M.LoginBoxBackground(),D=f?.loginLogo,b=f?.hideEdition??s.M.HideEdition;return(0,n.useEffect)(()=>m(!0),[]),n.createElement(s.M.LoginBackground,{className:(0,t.cx)(h.container,p&&h.loginAnim,f?.loginBackground)},n.createElement("div",{className:h.loginMain},n.createElement("div",{className:(0,t.cx)(h.loginContent,E,"login-content-box")},n.createElement("div",{className:h.loginLogoWrapper},n.createElement(s.M.LoginLogo,{className:h.loginLogo,logo:D}),n.createElement("div",{className:h.titleWrapper},d?n.createElement("h1",{className:h.mainTitle},"Update your password"):n.createElement(n.Fragment,null,n.createElement("h1",{className:h.mainTitle},v),a&&n.createElement("h3",{className:h.subTitle},a)))),n.createElement("div",{className:h.loginOuterBox},l))),f?.hideFooter?n.createElement(n.Fragment,null):n.createElement(r.wi,{hideEdition:b,customLinks:f?.footerLinks}))},c=(0,t.keyframes)` from{ opacity: 0; transform: translate(-60px, 0px); } to{ opacity: 1; transform: translate(0px, 0px); }`,i=l=>({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)({justifyContent:"center",width:"100%"}),loginLogo:(0,t.css)({width:"100%",maxWidth:60,marginBottom:l.spacing(2),[l.breakpoints.up("sm")]:{maxWidth:100}}),loginLogoWrapper:(0,t.css)({display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",padding:l.spacing(3)}),titleWrapper:(0,t.css)({textAlign:"center"}),mainTitle:(0,t.css)({fontSize:22,[l.breakpoints.up("sm")]:{fontSize:32}}),subTitle:(0,t.css)({fontSize:l.typography.size.md,color:l.colors.text.secondary}),loginContent:(0,t.css)({maxWidth:478,width:"calc(100% - 2rem)",display:"flex",alignItems:"stretch",flexDirection:"column",position:"relative",justifyContent:"flex-start",zIndex:1,minHeight:320,borderRadius:l.shape.radius.default,padding:l.spacing(2,0),opacity:0,transition:"opacity 0.5s ease-in-out",[l.breakpoints.up("sm")]:{minHeight:l.spacing(40),justifyContent:"center"}}),loginOuterBox:(0,t.css)({display:"flex",overflowY:"hidden",alignItems:"center",justifyContent:"center"}),loginInnerBox:(0,t.css)({padding:l.spacing(0,2,2,2),display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",flexGrow:1,maxWidth:415,width:"100%",transform:"translate(0px, 0px)",transition:"0.25s ease"}),enterAnimation:(0,t.css)({animation:`${c} ease-out 0.2s`})})},60188:(Q,A,e)=>{"use strict";e.d(A,{Q:()=>g});var t=e(2543),n=e.n(t),o=e(96540),s=e(10354),r=e(88575);class g extends o.PureComponent{constructor(){super(...arguments),this.state={text:"",inputCorrected:!1},this.inputRef=o.createRef(),this.updateValue=()=>{const c=this.inputRef.current?.value;let i=!1,l="";const f=this.props.min,d=this.props.max;let h=c!==""?Number(c):void 0;h&&!Number.isNaN(h)&&(f!=null&&h<f?(l=f.toString(),i=!0):d!=null&&h>d?(l=d.toString(),i=!0):l=c??"",this.setState({text:l,inputCorrected:i})),i&&this.updateValueDebounced(),!Number.isNaN(h)&&h!==this.props.value&&this.props.onChange(h)},this.updateValueDebounced=(0,t.debounce)(this.updateValue,500),this.onChange=c=>{this.setState({text:c.currentTarget.value}),this.updateValueDebounced()},this.onKeyPress=c=>{c.key==="Enter"&&this.updateValue()}}componentDidMount(){this.setState({text:isNaN(this.props.value)?"":`${this.props.value}`})}componentDidUpdate(c){if(this.props.value!==c.value){const i=isNaN(this.props.value)?"":`${this.props.value}`;i!==this.state.text&&this.setState({text:i})}}renderInput(){return o.createElement(s.p,{type:"number",ref:this.inputRef,min:this.props.min,max:this.props.max,step:this.props.step,autoFocus:this.props.autoFocus,value:this.state.text,onChange:this.onChange,onBlur:this.updateValue,onKeyPress:this.onKeyPress,placeholder:this.props.placeholder,disabled:this.props.fieldDisabled,width:this.props.width,suffix:this.props.suffix})}render(){const{inputCorrected:c}=this.state;if(c){let i="",{min:l,max:f}=this.props;return f==null?l!=null&&(i=`< ${l}`):l!=null?i=`${l} < > ${f}`:i=`> ${f}`,o.createElement(r.D,{invalid:c,error:`Out of range ${i}`,validationMessageHorizontalOverflow:!0,style:{direction:"rtl"}},this.renderInput())}return this.renderInput()}}},77268:(Q,A,e)=>{"use strict";e.d(A,{a:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(83598),r=e(29158),g=e(83876);const u=({value:i,settings:l,onChange:f,details:d})=>{const h=(0,o.$j)(),p=(0,o.of)(c);return n.createElement(s.sk,{color:i??"",onChange:f,enableNamedColors:l?.enableNamedColors!==!1},({ref:m,showColorPicker:a,hideColorPicker:v})=>n.createElement("div",{className:p.spot},n.createElement("div",{className:p.colorPicker},n.createElement(g.q,{ref:m,onClick:a,onMouseLeave:v,color:i?h.visualization.getColorByName(i):h.components.input.borderColor})),d&&n.createElement(n.Fragment,null,i?n.createElement("span",{className:p.colorText,onClick:a},i):n.createElement("span",{className:p.placeholderText,onClick:a},l?.placeholder??"Select color"),l?.isClearable&&i&&n.createElement(r.K,{name:"times",onClick:()=>f(void 0),tooltip:"Clear settings"}))))},c=i=>({spot:(0,t.css)({cursor:"pointer",color:i.colors.text.primary,background:i.components.input.background,padding:"3px",height:i.v1.spacing.formInputHeight,border:`1px solid ${i.components.input.borderColor}`,display:"flex",flexDirection:"row",alignItems:"center",alignContent:"flex-end","&:hover":{border:`1px solid ${i.components.input.borderHover}`}}),colorPicker:(0,t.css)({padding:`0 ${i.spacing(1)}`}),colorText:(0,t.css)({flexGrow:2}),placeholderText:(0,t.css)({flexGrow:2,color:i.colors.text.secondary})})},72626:(Q,A,e)=>{"use strict";e.d(A,{w:()=>o});var t=e(96540),n=e(60188);const o=({value:s,onChange:r,item:g})=>{const{settings:u}=g,c=(0,t.useCallback)(i=>{r(u?.integer&&i!==void 0?Math.floor(i):i)},[r,u?.integer]);return t.createElement(n.Q,{value:s,min:u?.min,max:u?.max,step:u?.step,placeholder:u?.placeholder,onChange:c})}},33919:(Q,A,e)=>{"use strict";e.d(A,{H:()=>xe,u:()=>$e});var t=e(96540),n=e(69550),o=e(27310),s=e(11261),r=e(50082),g=e(15292),u=e(94354),c=e(20333),i=e(76218),l=e(32196),f=e(2543),d=e(47737),h=e(60578),p=e(24284),m=e(10354),a=e(83598),v=e(29158),E=e(55852),D=e(60029),b=e(3911);const C=[{value:r.O.Absolute,label:"Absolute",description:"Pick thresholds based on the absolute values"},{value:r.O.Percentage,label:"Percentage",description:"Pick threshold based on the percent between min/max"}];class y extends t.PureComponent{constructor(Z){super(Z),this.onAddThreshold=()=>{const{steps:de}=this.state;let ve=0;de.length>1&&(ve=de[de.length-1].value+10);let Ue=p.Tj.filter(Ve=>!de.some(Ne=>Ne.color===Ve))[1];Ue||(Ue="#CCCCCC");const _e={value:ve,color:Ue,key:M++},ze=[...de,_e];(0,d.RU)(ze),this.setState({steps:ze},()=>{this.latestThresholdInputRef.current&&this.latestThresholdInputRef.current.focus(),this.onChange()})},this.onRemoveThreshold=de=>{const{steps:ve}=this.state;ve.length&&de.key!==ve[0].key&&this.setState({steps:ve.filter(Ue=>Ue.key!==de.key)},this.onChange)},this.onChangeThresholdValue=(de,ve)=>{const Ue=de.target.value.replace(/,/g,"."),_e=parseFloat(Ue),ze=isNaN(_e)?"":_e,Ve=this.state.steps.map(Ne=>(Ne.key===ve.key&&(Ne={...Ne,value:ze}),Ne));Ve.length&&(Ve[0].value=-1/0),(0,d.RU)(Ve),this.setState({steps:Ve})},this.onChangeThresholdColor=(de,ve)=>{const{steps:Ue}=this.state,_e=Ue.map(ze=>(ze.key===de.key&&(ze={...ze,color:ve}),ze));this.setState({steps:_e},this.onChange)},this.onBlur=()=>{const de=[...this.state.steps];(0,d.RU)(de),this.setState({steps:de},this.onChange)},this.onChange=()=>{this.props.onChange(I(this.props.thresholds,this.state.steps))},this.onModeChanged=de=>{this.props.onChange({...this.props.thresholds,mode:de})};const ae=T(Z.thresholds.steps);ae[0].value=-1/0,this.state={steps:ae},this.latestThresholdInputRef=t.createRef()}renderInput(Z,ae,de){const ve=this.props.thresholds.mode===r.O.Percentage,Ue=`Threshold ${de+1}`;return isFinite(Z.value)?t.createElement(m.p,{type:"number",step:"0.0001",key:ve.toString(),onChange:_e=>this.onChangeThresholdValue(_e,Z),value:Z.value,"aria-label":Ue,ref:de===0?this.latestThresholdInputRef:null,onBlur:this.onBlur,prefix:t.createElement("div",{className:ae.inputPrefix},t.createElement("div",{className:ae.colorPicker},t.createElement(a.sk,{color:Z.color,onChange:_e=>this.onChangeThresholdColor(Z,_e),enableNamedColors:!0})),ve&&t.createElement("div",{className:ae.percentIcon},"%")),suffix:t.createElement(v.K,{className:ae.trashIcon,name:"trash-alt",onClick:()=>this.onRemoveThreshold(Z),tooltip:`Remove ${Ue}`})}):t.createElement(m.p,{type:"text",value:"Base","aria-label":Ue,disabled:!0,prefix:t.createElement("div",{className:ae.colorPicker},t.createElement(a.sk,{color:Z.color,onChange:_e=>this.onChangeThresholdColor(Z,_e),enableNamedColors:!0}))})}render(){const{thresholds:Z}=this.props,{steps:ae}=this.state;return t.createElement(h.D.Consumer,null,de=>{const ve=x(de);return t.createElement("div",{className:ve.wrapper},t.createElement(E.$n,{size:"sm",icon:"plus",onClick:()=>this.onAddThreshold(),variant:"secondary",className:ve.addButton,fullWidth:!0},"Add threshold"),t.createElement("div",{className:ve.thresholds},ae.slice(0).reverse().map((Ue,_e)=>t.createElement("div",{className:ve.item,key:`${Ue.key}`},this.renderInput(Ue,ve,_e)))),t.createElement("div",null,t.createElement(D.J,{description:"Percentage means thresholds relative to min & max"},"Thresholds mode"),t.createElement(u.z,{options:C,onChange:this.onModeChanged,value:Z.mode})))})}}let M=100;function T(be){return(!be||be.length===0)&&(be=[{value:-1/0,color:"green"}]),be.filter((Z,ae)=>(0,f.isNumber)(Z.value)||ae===0).map(Z=>({color:Z.color,value:Z.value===null?-1/0:Z.value,key:M++}))}function I(be,Z){return{mode:be.mode??r.O.Absolute,steps:Z.map(de=>{const{key:ve,...Ue}=de;return Ue})}}const x=(0,b.N)(be=>({wrapper:(0,l.css)` display: flex; flex-direction: column; `,thresholds:(0,l.css)` display: flex; flex-direction: column; margin-bottom: ${be.spacing(2)}; `,item:(0,l.css)` margin-bottom: ${be.spacing(1)}; &:last-child { margin-bottom: 0; } `,colorPicker:(0,l.css)` padding: 0 ${be.spacing(1)}; `,addButton:(0,l.css)` margin-bottom: ${be.spacing(1)}; `,percentIcon:(0,l.css)` font-size: ${be.typography.bodySmall.fontSize}; color: ${be.colors.text.secondary}; `,inputPrefix:(0,l.css)` display: flex; align-items: center; `,trashIcon:(0,l.css)` color: ${be.colors.text.secondary}; cursor: pointer; margin-right: 0; &:hover { color: ${be.colors.text}; } `}));class S extends t.PureComponent{constructor(Z){super(Z)}render(){const{onChange:Z}=this.props;let ae=this.props.value;return ae||(ae={mode:r.O.Percentage,steps:[]}),t.createElement(y,{thresholds:ae,onChange:Z})}}var O=e(25019),P=e(40845),L=e(66864),U=e(14578),R=e(37390),B=e(80744),H=e(25148),w=e(75494),N=e(51986),V=e(88323);function G({mapping:be,index:Z,onChange:ae,onRemove:de,onDuplicate:ve,showIconPicker:Ue}){const{key:_e,result:ze,id:Ve}=be,Ne=(0,P.of)(_),ot=(0,t.useRef)(null),nt=(0,t.useCallback)(ft=>{const yt={...be,result:{...be.result}};ft(yt),ae(Z,yt)},[be,Z,ae]);(0,t.useEffect)(()=>{ot.current&&be.isNew&&(ot.current.focus(),nt(ft=>{ft.isNew=!1}))},[be,ot,nt]);const pt=ft=>{nt(yt=>{yt.result.color=ft})},mt=()=>{nt(ft=>{ft.result.color=void 0})},gt=ft=>{nt(yt=>{yt.result.icon=ft})},Pt=()=>{nt(ft=>{ft.result.icon=void 0})},Mt=ft=>{nt(yt=>{yt.key=ft.currentTarget.value})},Yt=ft=>{nt(yt=>{yt.result.text=ft.currentTarget.value})},zt=ft=>{nt(yt=>{yt.from=parseFloat(ft.currentTarget.value)})},_t=ft=>{nt(yt=>{yt.to=parseFloat(ft.currentTarget.value)})},rt=ft=>{nt(yt=>{yt.pattern=ft.currentTarget.value})},It=ft=>{nt(yt=>{yt.specialMatch=ft.value})},Dn=[{label:"Null",value:O.W.Null,description:"Matches null and undefined values"},{label:"NaN",value:O.W.NaN,description:"Matches against Number.NaN (not a number)"},{label:"Null + NaN",value:O.W.NullAndNaN,description:"Matches null, undefined and NaN"},{label:"True",value:O.W.True,description:"Boolean true values"},{label:"False",value:O.W.False,description:"Boolean false values"},{label:"Empty",value:O.W.Empty,description:"Empty string"}];return t.createElement(w.sx,{key:Ve,draggableId:Ve,index:Z},ft=>t.createElement("tr",{className:Ne.dragRow,ref:ft.innerRef,...ft.draggableProps},t.createElement("td",null,t.createElement("div",{className:Ne.dragHandle,...ft.dragHandleProps},t.createElement(U.I,{name:"draggabledots",size:"lg"}))),t.createElement("td",{className:Ne.typeColumn},be.type),t.createElement("td",null,be.type===O.d.ValueToText&&t.createElement(m.p,{ref:ot,type:"text",value:_e??"",onChange:Mt,placeholder:"Exact value to match"}),be.type===O.d.RangeToText&&t.createElement("div",{className:Ne.rangeInputWrapper},t.createElement(m.p,{type:"number",value:be.from??"",placeholder:"Range start",onChange:zt,prefix:"From"}),t.createElement(m.p,{type:"number",value:be.to??"",placeholder:"Range end",onChange:_t,prefix:"To"})),be.type===O.d.RegexToText&&t.createElement(m.p,{type:"text",value:be.pattern??"",placeholder:"Regular expression",onChange:rt}),be.type===O.d.SpecialValue&&t.createElement(V.l6,{value:Dn.find(yt=>yt.value===be.specialMatch),options:Dn,onChange:It})),t.createElement("td",null,t.createElement(m.p,{type:"text",value:ze.text??"",onChange:Yt,placeholder:"Optional display text"})),t.createElement("td",{className:Ne.textAlignCenter},ze.color&&t.createElement(L.Gy,{spacing:"sm",justify:"center"},t.createElement(a.sk,{color:ze.color,onChange:pt,enableNamedColors:!0}),t.createElement(v.K,{name:"times",onClick:mt,tooltip:"Remove color",tooltipPlacement:"top"})),!ze.color&&t.createElement(a.sk,{color:"gray",onChange:pt,enableNamedColors:!0},yt=>t.createElement(E.$n,{variant:"primary",fill:"text",onClick:yt.showColorPicker,ref:yt.ref,size:"sm"},"Set color"))),Ue&&t.createElement("td",{className:Ne.textAlignCenter},t.createElement(L.Gy,{spacing:"sm",justify:"center"},t.createElement(H.n,{onChange:gt,onClear:Pt,value:ze.icon,size:B.Iy.SMALL,folderName:B.Iu.Icon,mediaType:B.zu.Icon,color:ze.color}),ze.icon&&t.createElement(v.K,{name:"times",onClick:Pt,tooltip:"Remove icon",tooltipPlacement:"top"}))),t.createElement("td",{className:Ne.textAlignCenter},t.createElement(L.Gy,{spacing:"sm"},t.createElement(v.K,{name:"copy",onClick:()=>ve(Z),"data-testid":"duplicate-value-mapping","aria-label":"Duplicate value mapping",tooltip:"Duplicate"}),t.createElement(v.K,{name:"trash-alt",onClick:()=>de(Z),"data-testid":"remove-value-mapping","aria-label":"Delete value mapping",tooltip:"Delete"})))))}const _=be=>({dragRow:(0,l.css)({position:"relative"}),dragHandle:(0,l.css)({cursor:"grab","&:focus-visible&:after":{bottom:0,content:'""',left:0,position:"absolute",right:0,top:0,outline:`2px solid ${be.colors.primary.main}`,outlineOffset:"-2px"}}),rangeInputWrapper:(0,l.css)({display:"flex","> div:first-child":{marginRight:be.spacing(2)}}),regexInputWrapper:(0,l.css)({display:"flex","> div:first-child":{marginRight:be.spacing(2)}}),typeColumn:(0,l.css)({textTransform:"capitalize",textAlign:"center",width:"1%"}),textAlignCenter:(0,l.css)({textAlign:"center"})});function K({value:be,onChange:Z,onClose:ae,showIconPicker:de}){const ve=(0,P.of)(j),[Ue,_e]=(0,t.useState)([]);(0,t.useEffect)(()=>{_e(J(be))},[be]);const ze=gt=>{if(!be||!gt.destination)return;const Pt=[...Ue],Mt=Pt[gt.source.index];Pt.splice(gt.source.index,1),Pt.splice(gt.destination.index,0,Mt),_e(Pt)},Ve=(gt,Pt)=>{const Mt=[...Ue];Mt.splice(gt,1,Pt),_e(Mt)},Ne=gt=>{const Pt=[...Ue];Pt.splice(gt,1),_e(Pt)},ot=[{label:"Value",value:O.d.ValueToText,description:"Match a specific text value"},{label:"Range",value:O.d.RangeToText,description:"Match a numerical range of values"},{label:"Regex",value:O.d.RegexToText,description:"Match a regular expression with replacement"},{label:"Special",value:O.d.SpecialValue,description:"Match on null, NaN, boolean and empty values"}],nt=gt=>{_e([...Ue,Y({type:gt.value,result:{},isNew:!0})])},pt=gt=>{const Pt=ee(Ue[gt]),Mt=[...Ue];Mt.splice(gt,0,{...Pt});for(let Yt=gt;Yt<Ue.length;Yt++)Mt[Yt].result.index=Yt;_e(Mt)},mt=()=>{Z(re(Ue)),ae()};return(0,t.useEffect)(()=>{be?.length||nt({value:O.d.ValueToText})},[]),t.createElement(t.Fragment,null,t.createElement("div",{className:ve.tableWrap},t.createElement("table",{className:ve.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"),de&&t.createElement("th",{style:{width:"10%"}},"Icon"),t.createElement("th",{style:{width:"1%"}}))),t.createElement(w.JY,{onDragEnd:ze},t.createElement(w.gL,{droppableId:"sortable-field-mappings",direction:"vertical"},gt=>t.createElement("tbody",{ref:gt.innerRef,...gt.droppableProps},Ue.map((Pt,Mt)=>t.createElement(G,{key:Pt.id,mapping:Pt,index:Mt,onChange:Ve,onRemove:Ne,onDuplicate:pt,showIconPicker:de})),gt.placeholder))))),t.createElement(R.a.ButtonRow,{leftItems:t.createElement(N.i,{label:"Add a new mapping",variant:"secondary",size:"md",icon:"plus",menuPlacement:"auto",minWidth:40,options:ot,onChange:nt})},t.createElement(E.$n,{variant:"secondary",fill:"outline",onClick:ae},"Cancel"),t.createElement(E.$n,{variant:"primary",onClick:mt},"Update")))}const j=be=>({tableWrap:(0,l.css)` max-height: calc(80vh - 170px); min-height: 40px; overflow: auto; `,editTable:(0,l.css)({width:"100%",marginBottom:be.spacing(2),"thead th":{textAlign:"center"},"tbody tr:hover":{background:be.colors.action.hover}," th, td":{padding:be.spacing(1)}})});function k(){return(0,f.uniqueId)("mapping-")}function Y(be){return{type:O.d.ValueToText,result:{},id:k(),...be}}function ee(be){return{...Y(be),id:k()}}function re(be){const Z=[],ae={type:O.d.ValueToText,options:{}};return be.forEach((de,ve)=>{const Ue={...de.result,index:ve};switch((!Ue.text||Ue.text.trim().length===0)&&(Ue.text=void 0),de.type){case O.d.ValueToText:de.key!=null&&(ae.options[de.key]=Ue);break;case O.d.RangeToText:de.from!=null&&de.to!=null&&Z.push({type:de.type,options:{from:de.from,to:de.to,result:Ue}});break;case O.d.RegexToText:de.pattern!=null&&Z.push({type:de.type,options:{pattern:de.pattern,result:Ue}});break;case O.d.SpecialValue:Z.push({type:de.type,options:{match:de.specialMatch,result:Ue}})}}),Object.keys(ae.options).length>0&&Z.unshift(ae),Z}function J(be){const Z=[];if(be)for(const ae of be)switch(ae.type){case O.d.ValueToText:for(const de of Object.keys(ae.options))Z.push(Y({type:ae.type,result:ae.options[de],key:de}));break;case O.d.RangeToText:Z.push(Y({type:ae.type,result:ae.options.result,from:ae.options.from??0,to:ae.options.to??0}));break;case O.d.RegexToText:Z.push(Y({type:ae.type,result:ae.options.result,pattern:ae.options.pattern}));break;case O.d.SpecialValue:Z.push(Y({type:ae.type,result:ae.options.result,specialMatch:ae.options.match??O.W.Null}))}return Z.sort((ae,de)=>(ae.result.index??0)>(de.result.index??0)?1:-1),Z}const ne=t.memo(be=>{const{value:Z,onChange:ae,item:de}=be,ve=(0,P.of)(q),Ue=de.settings?.icon,[_e,ze]=(0,t.useState)(!1),Ve=(0,t.useCallback)(()=>{ze(!1)},[ze]),Ne=(0,t.useMemo)(()=>J(Z),[Z]),ot=(0,t.useCallback)((pt,mt)=>{Ne[mt].result.color=pt,ae(re(Ne))},[Ne,ae]),nt=(0,t.useCallback)((pt,mt)=>{Ne[mt].result.icon=pt,ae(re(Ne))},[Ne,ae]);return t.createElement(L.gW,null,t.createElement("table",{className:ve.compactTable},t.createElement("tbody",null,Ne.map((pt,mt)=>t.createElement("tr",{key:mt.toString()},t.createElement("td",null,pt.type===O.d.ValueToText&&pt.key,pt.type===O.d.RangeToText&&t.createElement("span",null,"[",pt.from," - ",pt.to,"]"),pt.type===O.d.RegexToText&&pt.pattern,pt.type===O.d.SpecialValue&&pt.specialMatch),t.createElement("td",null,t.createElement(U.I,{name:"arrow-right"})),t.createElement("td",null,pt.result.text),pt.result.color&&t.createElement("td",null,t.createElement(a.sk,{color:pt.result.color,onChange:gt=>ot(gt,mt),enableNamedColors:!0})),Ue&&pt.result.icon&&t.createElement("td",{"data-testid":"iconPicker"},t.createElement(H.n,{onChange:gt=>nt(gt,mt),value:pt.result.icon,size:B.Iy.SMALL,folderName:B.Iu.Icon,mediaType:B.zu.Icon,color:pt.result.color})))))),t.createElement(E.$n,{variant:"secondary",size:"sm",fullWidth:!0,onClick:()=>ze(!0)},Ne.length>0&&t.createElement("span",null,"Edit value mappings"),Ne.length===0&&t.createElement("span",null,"Add value mappings")),t.createElement(R.a,{isOpen:_e,title:"Value mappings",onDismiss:Ve,className:ve.modal,closeOnBackdropClick:!1},t.createElement(K,{value:Z,onChange:ae,onClose:Ve,showIconPicker:Ue})))});ne.displayName="ValueMappingsEditor";const q=be=>({modal:(0,l.css)({width:"980px"}),compactTable:(0,l.css)({width:"100%","tbody td":{padding:be.spacing(.5)}})});var te=e(59429);const oe=({value:be,onChange:Z,item:ae})=>{const{placeholder:de,isClearable:ve}=ae?.settings??{},Ue=(0,t.useCallback)(_e=>{Z(_e?.value?.uid)},[Z]);return t.createElement(te.b,{isClearable:ve,defaultOptions:!0,onChange:Ue,placeholder:de,value:be})};var ue=e(77268),ie=e(8066),ge=e(24293),he=e(88575);const De=({value:be,onChange:Z,item:ae,id:de})=>{const ve=(0,P.$j)(),Ue=(0,P.of)(le),_e=(0,ie.Hs)(be?.mode),Ve=(ae.settings?.byValueSupport?ie.uf.list():ie.uf.list().filter(mt=>!mt.isByValue)).filter(mt=>!mt.excludeFromPicker).map(mt=>{let gt=mt.isByValue?" (by value)":"";return{value:mt.id,label:`${mt.name}${gt}`,description:mt.description,isContinuous:mt.isContinuous,isByValue:mt.isByValue,component(){return t.createElement(pe,{mode:mt,theme:ve})}}}),Ne=mt=>{Z({...be,mode:mt.value})},ot=mt=>{Z({...be,mode:pt,fixedColor:mt})},nt=mt=>{Z({...be,mode:pt,seriesBy:mt})},pt=be?.mode??ge.Y.Thresholds;if(pt===ge.Y.Fixed||pt===ge.Y.Shades)return t.createElement("div",{className:Ue.group},t.createElement(V.l6,{minMenuHeight:200,options:Ve,value:pt,onChange:Ne,className:Ue.select,inputId:de}),t.createElement(ue.a,{value:be?.fixedColor,onChange:ot}));if(ae.settings?.bySeriesSupport&&_e.isByValue){const mt=[{label:"Last",value:"last"},{label:"Min",value:"min"},{label:"Max",value:"max"}];return t.createElement(t.Fragment,null,t.createElement("div",{style:{marginBottom:ve.spacing(2)}},t.createElement(V.l6,{minMenuHeight:200,options:Ve,value:pt,onChange:Ne,inputId:de})),t.createElement(he.D,{label:"Color series by"},t.createElement(u.z,{value:be?.seriesBy??"last",options:mt,onChange:nt})))}return t.createElement(V.l6,{minMenuHeight:200,options:Ve,value:pt,onChange:Ne,inputId:de})},pe=({mode:be,theme:Z})=>{if(!be.getColors)return null;const ae=be.getColors(Z).map(Z.visualization.getColorByName),de={height:"8px",width:"100%",margin:"2px 0",borderRadius:"3px",opacity:1};if(be.isContinuous)de.background=`linear-gradient(90deg, ${ae.join(",")})`;else{let ve="",Ue="";for(let _e=0;_e<ae.length;_e++){const ze=ae[_e];if(ve==="")ve=`linear-gradient(90deg, ${ze} 0%`;else{const Ne=_e/(ae.length-1)*100;ve+=`, ${Ue} ${Ne}%, ${ze} ${Ne}%`}Ue=ze}de.background=ve}return t.createElement("div",{style:de})},le=be=>({group:(0,l.css)({display:"flex"}),select:(0,l.css)({marginRight:be.spacing(1),flexGrow:1})});var Te=e(91890),Ee=e(64919);const Re=({value:be,onChange:Z,context:ae})=>t.createElement(Ee.e,{links:be,onChange:Z,data:ae.data,getSuggestions:()=>ae.getSuggestions?ae.getSuggestions(Te.uP.Values):[]});class me extends t.PureComponent{constructor(){super(...arguments),this.state={isLoading:!0,options:[]},this.updateOptions=async()=>{const{item:Z}=this.props,{settings:ae}=Z;let de=Z.settings?.options||[];ae?.getOptions&&(de=await ae.getOptions(this.props.context)),this.state.options!==de&&this.setState({isLoading:!1,options:de})}}componentDidMount(){this.updateOptions()}componentDidUpdate(Z){const ae=Z.item?.settings,de=this.props.item?.settings;if(ae!==de)this.updateOptions();else if(de?.getOptions){const ve=Z.context?.data,Ue=this.props.context?.data;ve!==Ue&&this.updateOptions()}}render(){const{options:Z,isLoading:ae}=this.state,{value:de,onChange:ve,item:Ue}=this.props,{settings:_e}=Ue;return t.createElement(V.KF,{isLoading:ae,value:de,defaultValue:de,allowCustomValue:_e?.allowCustomValue,onChange:ze=>{ve(ze.map(Ve=>Ve.value).flatMap(Ve=>Ve!==void 0?[Ve]:[]))},options:Z})}}var Me=e(72626);class ye extends t.PureComponent{constructor(){super(...arguments),this.state={isLoading:!0,options:[]},this.updateOptions=async()=>{const{item:Z}=this.props,{settings:ae}=Z;let de=Z.settings?.options||[];ae?.getOptions&&(de=await ae.getOptions(this.props.context)),this.state.options!==de&&this.setState({isLoading:!1,options:de})}}componentDidMount(){this.updateOptions()}componentDidUpdate(Z){const ae=Z.item?.settings,de=this.props.item?.settings;if(ae!==de)this.updateOptions();else if(de?.getOptions){const ve=Z.context?.data,Ue=this.props.context?.data;ve!==Ue&&this.updateOptions()}}render(){const{options:Z,isLoading:ae}=this.state,{value:de,onChange:ve,item:Ue}=this.props,{settings:_e}=Ue;let ze=Z.find(Ve=>Ve.value===de);return!ze&&de&&(ze={label:`${de}`,value:de}),t.createElement(V.l6,{isLoading:ae,value:ze,defaultValue:de,allowCustomValue:_e?.allowCustomValue,isClearable:_e?.isClearable,onChange:Ve=>ve(Ve?.value),options:Z})}}var Le=e(57602),We=e(42734);const Be=({value:be,onChange:Z,item:ae,id:de})=>t.createElement(We.S,{stats:be,onChange:Z,allowMultiple:!!ae.settings?.allowMultiple,defaultStat:ae.settings?.defaultStat,inputId:de});var Ye=e(29286),at=e(32264);class st extends t.PureComponent{constructor(){super(...arguments),this.state={showAdd:!1},this.onRemoveString=Z=>{const{value:ae,onChange:de}=this.props,ve=[...ae];ve.splice(Z,1),de(ve)},this.onValueChange=(Z,ae)=>{if("key"in Z&&Z.key!=="Enter")return;const{value:de,onChange:ve}=this.props,Ue=Z.currentTarget.value.trim();if(ae<0){Ue&&(Z.currentTarget.value="",ve([...de,Ue])),this.setState({showAdd:!1});return}if(!Ue)return this.onRemoveString(ae);const _e=[...de];_e[ae]=Ue,ve(_e)}}render(){const{value:Z,item:ae}=this.props,{showAdd:de}=this.state,ve=Ke(at.$.theme2),Ue=ae.settings?.placeholder||"Add text";return t.createElement("div",null,Z.map((_e,ze)=>t.createElement(m.p,{className:ve.textInput,key:`${ze}/${_e}`,defaultValue:_e||"",onBlur:Ve=>this.onValueChange(Ve,ze),onKeyDown:Ve=>this.onValueChange(Ve,ze),suffix:t.createElement(U.I,{className:ve.trashIcon,name:"trash-alt",onClick:()=>this.onRemoveString(ze)})})),de?t.createElement(m.p,{autoFocus:!0,className:ve.textInput,placeholder:Ue,defaultValue:"",onBlur:_e=>this.onValueChange(_e,-1),onKeyDown:_e=>this.onValueChange(_e,-1),suffix:t.createElement(U.I,{name:"plus-circle"})}):t.createElement(E.$n,{icon:"plus",size:"sm",variant:"secondary",onClick:()=>this.setState({showAdd:!0})},Ue))}}const Ke=(0,b.N)(be=>({textInput:(0,l.css)({marginBottom:"5px","&:hover":{border:`1px solid ${be.components.input.borderHover}`}}),trashIcon:(0,l.css)({color:be.colors.text.secondary,cursor:"pointer","&:hover":{color:be.colors.text.primary}})}));var Xe=e(2056);function He({value:be,onChange:Z,item:ae}){const de=(0,P.of)(Ge);return ae?.settings?.isClearable&&be!=null?t.createElement("div",{className:de.wrapper},t.createElement("span",{className:de.first},t.createElement(Xe.p,{value:be,onChange:Z})),t.createElement(v.K,{name:"times",onClick:()=>Z(void 0),tooltip:"Clear unit selection"})):t.createElement(Xe.p,{value:be,onChange:Z})}const Ge=be=>({wrapper:(0,l.css)({width:"100%",display:"flex",flexDirection:"row",alignItems:"center"}),first:(0,l.css)({marginRight:be.spacing(1),flexGrow:2})}),xe=()=>{const be={id:"number",name:"Number",description:"Allows numeric values input",editor:Me.w},Z={id:"slider",name:"Slider",description:"Allows numeric values input",editor:Le.G},ae={id:"text",name:"Text",description:"Allows string values input",editor:Ye.g},de={id:"strings",name:"String array",description:"An array of strings",editor:st},ve={id:"boolean",name:"Boolean",description:"Allows boolean values input",editor(zt){const{id:_t,...rt}=zt;return t.createElement(g.d,{...rt,onChange:It=>zt.onChange(It.currentTarget.checked)})}},Ue={id:"select",name:"Select",description:"Allows option selection",editor:ye},_e={id:"multi-select",name:"Multi select",description:"Allows for multiple option selection",editor:me},ze={id:"radio",name:"Radio",description:"Allows option selection",editor(zt){return t.createElement(u.z,{...zt,options:zt.item.settings?.options})}},Ve={id:"unit",name:"Unit",description:"Allows unit input",editor:He},Ne={id:"color",name:"Color",description:"Allows color selection",editor(zt){return t.createElement(ue.a,{value:zt.value,onChange:zt.onChange,settings:zt.item.settings,details:!0})}},ot={id:"fieldColor",name:"Field Color",description:"Field color selection",editor:De},nt={id:"links",name:"Links",description:"Allows defining data links",editor:Re},pt={id:"stats-picker",name:"Stats Picker",editor:Be,description:""},mt={id:"timezone",name:"Time zone",description:"Time zone selection",editor:c.U},gt={id:"field-name",name:"Field name",description:"Allows selecting a field name from a data frame",editor:i.O};return[ae,be,Z,ve,ze,Ue,Ve,nt,pt,de,mt,ot,Ne,_e,gt,{id:"dashboard-uid",name:"Dashboard",description:"Select dashboard",editor:oe},{id:"mappings",name:"Mappings",description:"Allows defining value mappings",editor:ne},{id:"thresholds",name:"Thresholds",description:"Allows defining thresholds",editor:S}]},$e=()=>{const be=["Standard options"],Z={id:"displayName",path:"displayName",name:"Display name",description:"Change the field or series name",editor:n.D.get("text").editor,override:n.D.get("text").editor,process:o.AM,settings:{placeholder:"none",expandTemplateVars:!0},shouldApply:()=>!0,category:be},ae={id:"unit",path:"unit",name:"Unit",description:"",editor:n.D.get("unit").editor,override:n.D.get("unit").editor,process:o.OU,settings:{placeholder:"none"},shouldApply:()=>!0,category:be},de={id:"fieldMinMax",path:"fieldMinMax",name:"Field min/max",description:"Calculate min max per field",editor:n.D.get("boolean").editor,override:n.D.get("boolean").editor,process:o.FM,shouldApply:mt=>mt.type===s.PU.number,showIf:mt=>mt.min===void 0||mt.max===void 0,category:be},ve={id:"min",path:"min",name:"Min",description:"Leave empty to calculate based on all values",editor:n.D.get("number").editor,override:n.D.get("number").editor,process:o.m0,settings:{placeholder:"auto"},shouldApply:mt=>mt.type===s.PU.number,category:be},Ue={id:"max",path:"max",name:"Max",description:"Leave empty to calculate based on all values",editor:n.D.get("number").editor,override:n.D.get("number").editor,process:o.m0,settings:{placeholder:"auto"},shouldApply:mt=>mt.type===s.PU.number,category:be},_e={id:"decimals",path:"decimals",name:"Decimals",editor:n.D.get("number").editor,override:n.D.get("number").editor,process:o.m0,settings:{placeholder:"auto",min:0,max:15,integer:!0},shouldApply:mt=>mt.type===s.PU.number,category:be},ze={id:"noValue",path:"noValue",name:"No value",description:"What to show when there is no value",editor:n.D.get("text").editor,override:n.D.get("text").editor,process:o.OU,settings:{placeholder:"-"},shouldApply:()=>!0,category:be},Ve={id:"links",path:"links",name:"Data links",editor:n.D.get("links").editor,override:n.D.get("links").editor,process:o.Ch,settings:{placeholder:"-"},shouldApply:()=>!0,category:["Data links"],getItemsCount:mt=>mt?mt.length:0},Ne={id:"color",path:"color",name:"Color scheme",editor:n.D.get("fieldColor").editor,override:n.D.get("fieldColor").editor,process:o.hS,shouldApply:()=>!0,settings:{byValueSupport:!0,preferThresholdsMode:!0},category:be},ot={id:"mappings",path:"mappings",name:"Value mappings",description:"Modify the display text based on input value",editor:n.D.get("mappings").editor,override:n.D.get("mappings").editor,process:o.xT,settings:{},defaultValue:[],shouldApply:mt=>mt.type!==s.PU.time,category:["Value mappings"],getItemsCount:mt=>mt?mt.length:0},nt={id:"thresholds",path:"thresholds",name:"Thresholds",editor:n.D.get("thresholds").editor,override:n.D.get("thresholds").editor,process:o.N7,settings:{},defaultValue:{mode:r.O.Absolute,steps:[{value:-1/0,color:"green"},{value:80,color:"red"}]},shouldApply:()=>!0,category:["Thresholds"],getItemsCount:mt=>mt?mt.steps.length:0},pt={id:"filterable",path:"filterable",name:"Ad-hoc filterable",hideFromDefaults:!0,editor:n.D.get("boolean").editor,override:n.D.get("boolean").editor,process:o.FM,shouldApply:()=>!0,settings:{},category:be};return[ae,ve,Ue,de,_e,Z,Ne,ze,Ve,ot,nt,pt]}},57602:(Q,A,e)=>{"use strict";e.d(A,{G:()=>c});var t=e(32196),n=e(94659),o=e(9821),s=e(96540),r=e(40845),g=e(24849),u=e(60188);const c=({value:f,onChange:d,item:h})=>{const p=(0,s.useRef)(null),{settings:m}=h,a=m?.min||0,v=m?.max||100,E=m?.step,D=m?.marks||{[a]:a,[v]:v},b=m?.included,C=m?.ariaLabelForHandle,y=75,M=!0,T=(0,r.$j)(),[I,x]=(0,s.useState)(f??a),[S,O]=(0,s.useState)(y);(0,s.useEffect)(()=>{f!=null&&f!==I&&x(f)},[f,I]),(0,s.useEffect)(()=>{const H=getComputedStyle(p.current),w=H.getPropertyValue("font-weight")||"normal",N=H.getPropertyValue("font-size")||"16px",V=H.getPropertyValue("font-family")||"Arial",G="0",_=4,K=8,j=Math.max((v+(E||0)).toString().length,(v-(E||0)).toString().length)+_,k=G.repeat(j),Y=i(k,`${w} ${N} ${V}`);Y&&O(Y+K*2)},[v,E]);const P=(0,s.useCallback)(H=>{const w=typeof H=="number"?H:H[0];x(w),d&&d(w)},[x,d]),L=(0,s.useCallback)(H=>{let w=H;(Number.isNaN(w)||!w)&&(w=0),x(w),d&&d(w)},[d]),U=(0,g.$)(T,M,!!D),R=l(T,S),B=M?[]:[U.sliderInputVertical];return s.createElement("div",{className:(0,t.cx)(U.container,U.slider)},s.createElement(n.Global,{styles:U.slider}),s.createElement("div",{className:(0,t.cx)(U.sliderInput,...B)},s.createElement(o.A,{min:a,max:v,step:E,defaultValue:f,value:I,onChange:P,vertical:!M,reverse:!1,ariaLabelForHandle:C,marks:D,included:b}),s.createElement("span",{className:R.numberInputWrapper,ref:p},s.createElement(u.Q,{value:I,onChange:L,max:v,min:a,step:E}))))};function i(f,d){const p=document.createElement("canvas").getContext("2d");return p?(p.font=d,p.measureText(f).width):null}const l=(f,d)=>({numberInputWrapper:(0,t.css)({marginLeft:f.spacing(3),maxHeight:"32px",maxWidth:d,minWidth:d,overflow:"visible",width:"100%"})})},29286:(Q,A,e)=>{"use strict";e.d(A,{g:()=>s});var t=e(96540),n=e(21744),o=e(10354);const s=({value:r,onChange:g,item:u,suffix:c})=>{const i=u.settings?.useTextarea?n.f:o.p,l=(0,t.useCallback)(f=>{let d=r??"";"key"in f?f.key==="Enter"&&!u.settings?.useTextarea&&(d=f.currentTarget.value.trim()):d=f.currentTarget.value.trim(),d!==r&&g(d===""?void 0:d)},[r,u.settings?.useTextarea,g]);return t.createElement(i,{placeholder:u.settings?.placeholder,defaultValue:r||"",rows:u.settings?.useTextarea&&u.settings.rows||5,onBlur:l,onKeyDown:l,suffix:c})}},36830:(Q,A,e)=>{"use strict";e.d(A,{Y:()=>L});var t=e(32196),n=e(96540),o=e(64388),s=e(40845),r=e(40276),g=e(76888),u=e(39419);const c=({isLoading:R,children:B,className:H})=>{let w=H?n.createElement("div",{className:H},B):B;return n.createElement(n.Fragment,null,R?n.createElement(u.A,null):w)};var i=e(13773),l=e(17172),f=e(94753),d=e(29158),h=e(88575),p=e(10354);const m=({value:R,onEdit:B})=>{const H=(0,s.of)(a),[w,N]=(0,n.useState)(R),[V,G]=(0,n.useState)(!1),[_,K]=(0,n.useState)(!1),[j,k]=(0,n.useState)();(0,n.useEffect)(()=>{N(R)},[R]);const Y=(0,n.useCallback)(async ee=>{const re=ee.currentTarget.value;if(!re)k("Please enter a title");else if(re===R)k(void 0),G(!1);else{K(!0);try{await B(re),k(void 0),G(!1)}catch(J){(0,l.NF)(J)?k(J.data.message):J instanceof Error&&k(J.message)}K(!1)}},[B,R]);return V?n.createElement("div",{className:H.inputContainer},n.createElement(h.D,{className:H.field,loading:_,invalid:!!j,error:j},n.createElement(p.p,{className:H.input,defaultValue:w,onKeyDown:ee=>{ee.key==="Enter"&&Y(ee)},autoFocus:!0,onBlur:Y,onChange:ee=>N(ee.currentTarget.value),onFocus:()=>G(!0)}))):n.createElement("div",{className:H.textContainer},n.createElement("div",{className:H.textWrapper},n.createElement(f.E,{element:"h1",truncate:!0},w),n.createElement(d.K,{name:"pen",size:"lg",tooltip:"Edit title",onClick:()=>G(!0)})))};m.displayName="EditableTitle";const a=R=>({textContainer:(0,t.css)({minWidth:0}),field:(0,t.css)({flex:1,left:`calc(-${R.spacing(1)} - 1px)`,position:"relative",marginBottom:0}),input:(0,t.css)({input:{...R.typography.h1}}),inputContainer:(0,t.css)({display:"flex",flex:1}),textWrapper:(0,t.css)({alignItems:"center",display:"flex",gap:R.spacing(1)})});function v({navItem:R,renderTitle:B,actions:H,info:w,subTitle:N,onEditTitle:V}){const G=(0,s.of)(E),_=N??R.subTitle,K=V?n.createElement(m,{value:R.text,onEdit:V}):n.createElement("div",{className:G.title},R.img&&n.createElement("img",{className:G.img,src:R.img,alt:`logo for ${R.text}`}),B?B(R.text):n.createElement("h1",null,R.text));return n.createElement("div",{className:G.pageHeader},n.createElement("div",{className:G.topRow},n.createElement("div",{className:G.titleInfoContainer},K,w&&n.createElement(i.Q,{info:w})),n.createElement("div",{className:G.actions},H)),_&&n.createElement("div",{className:G.subTitle},_))}const E=R=>({topRow:(0,t.css)({alignItems:"flex-start",display:"flex",flexDirection:"row",flexWrap:"wrap",gap:R.spacing(1,3)}),title:(0,t.css)({display:"flex",flexDirection:"row",maxWidth:"100%",h1:{display:"flex",marginBottom:0}}),actions:(0,t.css)({display:"flex",flexDirection:"row",gap:R.spacing(1)}),titleInfoContainer:(0,t.css)({display:"flex",label:"title-info-container",flex:1,flexWrap:"wrap",gap:R.spacing(1,4),justifyContent:"space-between",maxWidth:"100%",minWidth:"200px"}),pageHeader:(0,t.css)({label:"page-header",display:"flex",flexDirection:"column",gap:R.spacing(1),marginBottom:R.spacing(2)}),subTitle:(0,t.css)({position:"relative",color:R.colors.text.secondary}),img:(0,t.css)({width:"32px",height:"32px",marginRight:R.spacing(2)})});var D=e(63021),b=e(8984),C=e(40675);function y({navItem:R}){const B=(0,s.of)(M);return n.createElement("div",{className:B.tabsWrapper},n.createElement(D.U,null,R.children.map((H,w)=>{const N=H.icon?(0,b.toIconName)(H.icon):void 0;return!H.hideFromTabs&&n.createElement(C.o,{label:H.text,active:H.active,key:`${H.url}-${w}`,icon:N,counter:H.tabCounter,href:H.url,suffix:H.tabSuffix,onChangeTab:H.onClick})})))}const M=R=>({tabsWrapper:(0,t.css)({paddingBottom:R.spacing(3)})});var T=e(77109),I=e(28215),x=e(80348),S=e(19361),O=e(3984);function P(R,B){const H=(0,x.useSelector)(w=>w.navIndex)?.[I.Id];(0,n.useEffect)(()=>{const w=(R?.node!==R?.main?R?.node:R?.main)??{text:"Grafana"},N=(0,O.Z)(w,B,H).map(V=>V.text).reverse();N[N.length-1]=S.M.AppTitle,document.title=N.join(" - ")},[H,R,B])}const L=({navId:R,navModel:B,pageNav:H,renderTitle:w,onEditTitle:N,actions:V,subTitle:G,children:_,className:K,info:j,layout:k=o.k.Standard,scrollTop:Y,scrollRef:ee,...re})=>{const J=(0,s.of)(U),ne=(0,T.i)(R,B),{chrome:q}=(0,g.Il)();P(ne,H);const te=H??ne?.node;return(0,n.useLayoutEffect)(()=>{ne&&q.update({sectionNav:ne,pageNav:H,layout:k})},[ne,H,q,k]),n.createElement("div",{className:(0,t.cx)(J.wrapper,K),...re},k===o.k.Standard&&n.createElement(r.E,{autoHeightMin:"100%",scrollTop:Y,scrollRefCallback:ee},n.createElement("div",{className:J.pageInner},te&&n.createElement(v,{actions:V,onEditTitle:N,navItem:te,renderTitle:w,info:j,subTitle:G}),H&&H.children&&n.createElement(y,{navItem:H}),n.createElement("div",{className:J.pageContent},_))),k===o.k.Canvas&&n.createElement(r.E,{autoHeightMin:"100%",scrollTop:Y,scrollRefCallback:ee},n.createElement("div",{className:J.canvasContent},_)),k===o.k.Custom&&_)};L.Contents=c;const U=R=>({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:R.spacing(2),borderBottom:"none",background:R.colors.background.primary,display:"flex",flexDirection:"column",flexGrow:1,margin:R.spacing(0,0,0,0),[R.breakpoints.up("md")]:{padding:R.spacing(4)}}),canvasContent:(0,t.css)({label:"canvas-content",display:"flex",flexDirection:"column",padding:R.spacing(2),flexBasis:"100%",flexGrow:1})})},77109:(Q,A,e)=>{"use strict";e.d(A,{i:()=>r});var t=e(1081),n=e(17422),o=e(99140),s=e(80348);function r(u,c){if(c)return c;if(u&&o.M_)return(0,s.useSelector)((0,t.Mz)(g,i=>(0,n.tc)(i,u??"home")))}function g(u){return u.navIndex}},13773:(Q,A,e)=>{"use strict";e.d(A,{Q:()=>s});var t=e(32196),n=e(96540),o=e(40845);function s({info:g}){const u=(0,o.of)(r);return n.createElement("div",{className:u.container},g.map((c,i)=>n.createElement(n.Fragment,{key:i},n.createElement("div",{className:u.infoItem},n.createElement("div",{className:u.label},c.label),c.value),i+1<g.length&&n.createElement("div",{"data-testid":"page-info-separator",className:u.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}`})})},39419:(Q,A,e)=>{"use strict";e.d(A,{A:()=>s});var t=e(96540),n=e(39558);const s=({pageName:r=""})=>{const g=`Loading ${r}...`;return t.createElement("div",{className:"page-loader-wrapper"},t.createElement(n._,{text:g}))}},7392:(Q,A,e)=>{"use strict";e.d(A,{L:()=>s});var t=e(32196),n=e(96540),o=e(40845);function s({entity:g="Page"}){const u=(0,o.of)(r),c=(0,o.$j)();return n.createElement("div",{className:u.container},n.createElement("h1",null,g," not found"),n.createElement("div",{className:u.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:u.grot},n.createElement("img",{src:`public/img/grot-404-${c.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"})}}},78361:(Q,A,e)=>{"use strict";e.d(A,{s:()=>r});var t=e(96540),n=e(13544),o=e(10354),s=e(29158);const r=t.forwardRef((g,u)=>{const[c,i]=(0,t.useState)(!1);return t.createElement(o.p,{...g,type:c?"text":"password","data-testid":n.Tp.pages.Login.password,ref:u,suffix:t.createElement(s.K,{name:c?"eye-slash":"eye","aria-controls":g.id,role:"switch","aria-checked":c,onClick:()=>{i(!c)},tooltip:c?"Hide password":"Show password"})})});r.displayName="PasswordField"},22214:(Q,A,e)=>{"use strict";e.d(A,{j:()=>r});var t=e(32196),n=e(96540),o=e(36663),s=e(40845);const r=n.memo(n.forwardRef(({className:c,children:i,markdown:l,styleOverrides:f,onRemove:d,...h},p)=>{const m=(0,s.of)(a=>u(a,f?.borderTop));return n.createElement("div",{className:(0,t.cx)(m.wrapper,c),...h,ref:p},l&&g(l),i)}));function g(c){const i=(0,o.G)(c);return n.createElement("div",{className:"markdown-html",dangerouslySetInnerHTML:{__html:i}})}r.displayName="OperationRowHelp";const u=(c,i)=>{const l=c.shape.radius.default,f=c.colors.background.secondary;return{wrapper:(0,t.css)` padding: ${c.spacing(2)}; border: 2px solid ${f}; border-top: ${i?i+f:"none"}; border-radius: 0 0 ${l} ${l}; position: relative; top: -4px; `}}},10343:(Q,A,e)=>{"use strict";e.d(A,{A:()=>c,q:()=>u});var t=e(32196),n=e(96540),o=e(13544),s=e(40845),r=e(29158);function g(l){const f=(0,s.of)(i);return n.createElement("div",{className:(0,t.cx)(f.icon,"active"in l&&l.active&&f.active)},n.createElement(r.K,{name:l.icon,tooltip:l.title,className:f.icon,disabled:!!l.disabled,onClick:l.onClick,type:"button","data-testid":l.dataTestId??o.Tp.components.QueryEditorRow.actionButton(l.title),..."active"in l&&{"aria-pressed":l.active}}))}function u(l){return n.createElement(g,{...l})}const c=l=>n.createElement(g,{...l}),i=l=>({icon:(0,t.css)({display:"flex",position:"relative",color:l.colors.text.secondary}),active:(0,t.css)({"&:before":{display:"block",content:'" "',position:"absolute",left:-1,right:2,height:3,borderRadius:l.shape.radius.default,bottom:-8,backgroundImage:l.colors.gradients.brandHorizontal}})})},7788:(Q,A,e)=>{"use strict";e.d(A,{u:()=>p});var t=e(32196),n=e(96540),o=e(75494),s=e(22589),r=e(14110),g=e(40845),u=e(67892),c=e(29158),i=e(67061),l=e(14578),f=e(44836);const d=({actionsElement:a,disabled:v,draggable:E,collapsable:D=!0,dragHandleProps:b,headerElement:C,isContentVisible:y,onRowToggle:M,reportDragMousePosition:T,title:I,id:x,expanderMessages:S})=>{const O=(0,g.of)(h);let P=y?(0,f.t)("query-operation.header.collapse-row","Collapse query row"):(0,f.t)("query-operation.header.expand-row","Expand query row");S!==void 0&&y?P=S.close:S!==void 0&&(P=S?.open);const L=(0,f.t)("query-operation.header.drag-and-drop","Drag and drop to reorder");return n.createElement("div",{className:O.header},n.createElement("div",{className:O.column},D&&n.createElement(c.K,{name:y?"angle-down":"angle-right",tooltip:P,className:O.collapseIcon,onClick:M,"aria-expanded":y,"aria-controls":x}),I&&n.createElement("div",{className:O.titleWrapper,onClick:M,"aria-label":"Query operation row title"},n.createElement("div",{className:(0,t.cx)(O.title,v&&O.disabled)},I)),C),n.createElement(i.B,{gap:1,alignItems:"center"},a,E&&n.createElement("div",{onMouseMove:T,...b},n.createElement(l.I,{title:L,name:"draggabledots",size:"lg",className:O.dragIcon}))))},h=a=>({header:(0,t.css)` label: Header; padding: ${a.spacing(.5,.5)}; border-radius: ${a.shape.radius.default}; background: ${a.colors.background.secondary}; min-height: ${a.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: ${a.colors.text.disabled}; margin: ${a.spacing(0,.5)}; &:hover { color: ${a.colors.text}; } `,collapseIcon:(0,t.css)` margin-left: ${a.spacing(.5)}; color: ${a.colors.text.disabled}; } `,titleWrapper:(0,t.css)` display: flex; align-items: center; flex-grow: 1; cursor: pointer; overflow: hidden; margin-right: ${a.spacing(.5)}; `,title:(0,t.css)` font-weight: ${a.typography.fontWeightBold}; color: ${a.colors.text.link}; margin-left: ${a.spacing(.5)}; overflow: hidden; text-overflow: ellipsis; `,disabled:(0,t.css)` color: ${a.colors.text.disabled}; `});d.displayName="QueryOperationRowHeader";function p({children:a,actions:v,title:E,headerElement:D,onClose:b,onOpen:C,isOpen:y,disabled:M,draggable:T,collapsable:I,index:x,id:S,expanderMessages:O}){const[P,L]=(0,n.useState)(y!==void 0?y:!0),U=(0,g.of)(m),R=(0,n.useCallback)(()=>{L(!P)},[P,L]);(0,n.useEffect)(()=>{typeof y=="boolean"&&L(y)},[y]);const B=(0,n.useCallback)(V=>{if(V.defaultPrevented){const G=V.currentTarget.getBoundingClientRect(),_=V.clientX-G.left,K=V.clientY-G.top;(0,r.rR)("query_row_reorder_drag_position",{x:_/G.width,y:K/G.height,width:G.width,height:G.height})}},[]);(0,s.A)(()=>{P?C&&C():b&&b()},[P]);const H={isOpen:P,onOpen:()=>{L(!0)},onClose:()=>{L(!1)}},w=v&&u.renderOrCallToRender(v,H),N=D&&u.renderOrCallToRender(D,H);return T?n.createElement(o.sx,{draggableId:S,index:x},V=>n.createElement(n.Fragment,null,n.createElement("div",{ref:V.innerRef,className:U.wrapper,...V.draggableProps},n.createElement("div",null,n.createElement(d,{id:S,actionsElement:w,disabled:M,draggable:!0,collapsable:I,dragHandleProps:V.dragHandleProps,headerElement:N,isContentVisible:P,onRowToggle:R,reportDragMousePosition:B,title:E,expanderMessages:O})),P&&n.createElement("div",{className:U.content},a)))):n.createElement("div",{className:U.wrapper},n.createElement(d,{id:S,actionsElement:w,disabled:M,draggable:!1,collapsable:I,headerElement:N,isContentVisible:P,onRowToggle:R,reportDragMousePosition:B,title:E,expanderMessages:O}),P&&n.createElement("div",{className:U.content},a))}const m=a=>({wrapper:(0,t.css)` margin-bottom: ${a.spacing(2)}; `,content:(0,t.css)` margin-top: ${a.spacing(.5)}; margin-left: ${a.spacing(3)}; `});p.displayName="QueryOperationRow"},37425:(Q,A,e)=>{"use strict";e.d(A,{n:()=>De});var t=e(96540),n=e(40845),o=e(8866),s=e(17464),r=e(32196),g=e(62930),u=e(14578),c=e(56034),i=e(10354),l=e(87266),f=e(16797),d=e(88824);const h=(0,t.forwardRef)(({children:pe,iconName:le},Te)=>{const Ee=(0,n.of)(p);return t.createElement("div",{className:Ee.container,ref:Te},le&&t.createElement(u.I,{name:le,size:"xs"}),pe)});h.displayName="ValueContainer";const p=pe=>{const{prefix:le}=(0,i.n)({theme:pe}),{multiValueContainer:Te}=(0,d.J)(pe);return{container:(0,r.cx)(le,Te,(0,r.css)` position: relative; padding: ${pe.spacing(.5,1,.5,1)}; svg { margin-right: ${pe.spacing(.5)}; } `)}},m=360,a=300,v=320,E=360,D=320,b=360,C=E+b,y=pe=>pe.stopPropagation(),M=({appliedRoles:pe,basicRole:le,disabled:Te,isFocused:Ee,query:Re,showBasicRole:me,width:Me,isLoading:ye,onOpen:Le,onClose:We,onQueryChange:Be,...Ye})=>{const at=(0,n.of)(I,!1,!!Ee,!!Te,!1,Me),st=(0,t.useRef)(null);(0,t.useEffect)(()=>{Ee&&st.current?.focus()});const Ke=He=>{const Ge=He.target?.value;Be(Ge)},Xe=me&&le!=="None";return Ee?t.createElement("div",{className:at.wrapper},Xe&&t.createElement(h,null,le),pe.map(He=>t.createElement(h,{key:He.uid},He.group+":"+(He.displayName||He.name))),!Te&&t.createElement("input",{...Ye,className:at.input,ref:st,onMouseDown:y,onChange:Ke,"data-testid":"role-picker-input",placeholder:Ee?"Select role":"",value:Re}),t.createElement("div",{className:at.suffix},t.createElement(u.I,{name:"angle-up",className:at.dropdownIndicator,onMouseDown:We}))):t.createElement("div",{className:(0,r.cx)(at.wrapper,at.selectedRoles),onMouseDown:Le},Xe&&t.createElement(h,null,le),t.createElement(T,{appliedRoles:pe,numberOfRoles:pe.length,showBuiltInRole:Xe}),ye&&t.createElement("div",{className:at.spinner},t.createElement(g.y,{size:16,inline:!0})))};M.displayName="RolePickerInput";const T=({showBuiltInRole:pe,numberOfRoles:le,appliedRoles:Te})=>{const Ee=(0,n.of)(Re=>x(Re));return t.createElement(t.Fragment,null,le?t.createElement(c.m,{content:t.createElement("div",{className:Ee.tooltip},Te?.map(Re=>t.createElement("p",{key:Re.uid},Re.group+":"+(Re.displayName||Re.name))))},t.createElement(h,null,`${pe?"+":""}${le} role${le>1?"s":""}`)):!pe&&t.createElement(h,null,"No roles assigned"))},I=(pe,le,Te,Ee,Re,me)=>{const Me=(0,i.n)({theme:pe,invalid:le});return{wrapper:(0,r.cx)(Me.wrapper,(0,l.Xb)(pe,le),Te&&(0,r.css)` ${f.focusCss(pe.v1)} `,Ee&&Me.inputDisabled,(0,r.css)({minWidth:me||m+"px",width:me,minHeight:"32px",height:"auto",flexDirection:"row",paddingRight:pe.spacing(1),maxWidth:"100%",alignItems:"center",display:"flex",flexWrap:"wrap",justifyContent:"flex-start",position:"relative",boxSizing:"border-box",cursor:"default"}),Re&&(0,r.css)` padding-left: 0; `),input:(0,r.cx)((0,l.Xb)(pe,le),(0,r.css)` max-width: 120px; border: none; cursor: ${Te?"default":"pointer"}; `),suffix:Me.suffix,dropdownIndicator:(0,r.css)` cursor: pointer; `,selectedRoles:(0,r.css)` display: flex; align-items: center; cursor: ${Ee?"not-allowed":"pointer"}; `,tooltip:(0,r.css)` p { margin-bottom: ${pe.spacing(.5)}; } `,spinner:(0,r.css)({display:"flex",flexGrow:1,justifyContent:"flex-end"})}},x=pe=>({tooltip:(0,r.css)` p { margin-bottom: ${pe.spacing(.5)}; } `});var S=e(72109),O=e(40276),P=e(66864),L=e(55852),U=e(5173),R=e(80348);const B=pe=>({hideScrollBar:(0,r.css)({".scrollbar-view":{"&::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"}}),menuWrapper:(0,r.css)({display:"flex",maxHeight:"650px",position:"absolute",zIndex:pe.zIndex.dropdown,overflow:"hidden",minWidth:"auto"}),menu:(0,r.css)({minWidth:`${v}px`,maxWidth:`${E}px`,"& > div":{paddingTop:pe.spacing(1)}}),menuLeft:(0,r.css)({flexDirection:"row-reverse"}),subMenu:(0,r.css)({height:"100%",minWidth:`${D}px`,maxWidth:`${b}px`,display:"flex",flexDirection:"column",borderLeft:`1px solid ${pe.components.input.borderColor}`,"& > div":{paddingTop:pe.spacing(1)}}),subMenuLeft:(0,r.css)({borderRight:`1px solid ${pe.components.input.borderColor}`,borderLeft:"unset"}),groupHeader:(0,r.css)({padding:pe.spacing(0,4.5),display:"flex",alignItems:"center",color:pe.colors.text.primary,fontWeight:pe.typography.fontWeightBold}),container:(0,r.css)({padding:pe.spacing(1),border:`1px ${pe.colors.border.weak} solid`,borderRadius:pe.shape.radius.default,backgroundColor:pe.colors.background.primary,zIndex:pe.zIndex.modal}),menuSection:(0,r.css)({marginBottom:pe.spacing(2)}),menuOptionCheckbox:(0,r.css)({display:"flex",margin:pe.spacing(0,1,0,.25)}),menuButtonRow:(0,r.css)({backgroundColor:pe.colors.background.primary,padding:pe.spacing(1)}),menuOptionBody:(0,r.css)({fontWeight:pe.typography.fontWeightRegular,padding:pe.spacing(0,1.5,0,0)}),menuOptionDisabled:(0,r.css)({color:pe.colors.text.disabled,cursor:"not-allowed"}),menuOptionExpand:(0,r.css)({position:"absolute",right:pe.spacing(1.25),color:pe.colors.text.disabled,"&:after":{content:'">"'}}),menuOptionInfoSign:(0,r.css)({color:pe.colors.text.disabled}),basicRoleSelector:(0,r.css)({margin:pe.spacing(1,1.25,1,1.5)}),subMenuPortal:(0,r.css)({height:"100%","> div":{height:"100%"}}),subMenuButtonRow:(0,r.css)({backgroundColor:pe.colors.background.primary,padding:pe.spacing(1)}),checkboxPartiallyChecked:(0,r.css)({input:{"&:checked + span":{"&:after":{borderWidth:"0 3px 0px 0",transform:"rotate(90deg)"}}}}),loadingSpinner:(0,r.css)({marginLeft:pe.spacing(1)})}),H=Object.values(R.OrgRole).map(pe=>({label:pe===R.OrgRole.None?"No basic role":pe,value:pe})),w=({value:pe,onChange:le,disabled:Te,disabledMesssage:Ee,tooltipMessage:Re})=>{const me=(0,n.of)(B),Me=(0,n.$j)();return t.createElement(t.Fragment,null,t.createElement("div",{className:me.groupHeader},t.createElement("span",{style:{marginRight:Me.spacing(1)}},"Basic roles"),Te&&Ee&&t.createElement(c.m,{placement:"right-end",interactive:!0,content:t.createElement("div",null,Ee)},t.createElement(u.I,{name:"question-circle"})),!Te&&Re&&t.createElement(c.m,{placement:"right-end",interactive:!0,content:Re},t.createElement(u.I,{name:"info-circle",size:"xs"}))),t.createElement(U.a,{name:"Basic Role Selector",className:me.basicRoleSelector,options:H,value:pe,onChange:le,disabled:Te}))};var N=e(10880);const V=(0,t.memo)(t.forwardRef(({name:pe,value:le,isFocused:Te,isSelected:Ee,partiallySelected:Re,disabled:me,onChange:Me,onClick:ye,onOpenSubMenu:Le,onCloseSubMenu:We,children:Be,root:Ye},at)=>{const st=(0,n.$j)(),Ke=(0,d.J)(st),Xe=(0,n.of)(B),He=(0,r.cx)(Ke.option,Te&&Ke.optionFocused,me&&Xe.menuOptionDisabled),Ge=Z=>{me||le&&Me(le)},xe=Z=>{ye&&ye(le)},$e=()=>{Le&&Le(le)},be=()=>{We&&We()};return t.createElement("div",{onMouseEnter:$e,onMouseLeave:be},t.createElement("div",{ref:at,className:He,"aria-label":"Role picker option",onClick:xe},t.createElement(N.S,{value:Ee,className:(0,r.cx)(Xe.menuOptionCheckbox,{[Xe.checkboxPartiallyChecked]:Re}),onChange:Ge,disabled:me}),t.createElement("div",{className:(0,r.cx)(Ke.optionBody,Xe.menuOptionBody)},t.createElement("span",null,pe),t.createElement("span",{className:Xe.menuOptionExpand})),Ye&&Be&&t.createElement(s.ZL,{className:Xe.subMenuPortal,root:Ye},Be)))}));V.displayName="RoleMenuGroupOption";const G=t.forwardRef(({data:pe,isFocused:le,isSelected:Te,disabled:Ee,onChange:Re,hideDescription:me},Me)=>{const ye=(0,n.$j)(),Le=(0,d.J)(ye),We=(0,n.of)(B),Be=(0,r.cx)(Le.option,le&&Le.optionFocused,Ee&&We.menuOptionDisabled),Ye=at=>{Ee||(at.preventDefault(),at.stopPropagation(),Re(pe))};return t.createElement("div",{ref:Me,className:Be,"aria-label":"Role picker option",onClick:Ye},t.createElement(N.S,{value:Te,className:We.menuOptionCheckbox,onChange:Ye,disabled:Ee}),t.createElement("div",{className:(0,r.cx)(Le.optionBody,We.menuOptionBody)},t.createElement("span",null,pe.displayName||pe.name),!me&&pe.description&&t.createElement("div",{className:Le.optionDescription},pe.description)),pe.description&&t.createElement(c.m,{content:pe.description},t.createElement(u.I,{name:"info-circle",className:We.menuOptionInfoSign})))});G.displayName="RoleMenuOption";var _=e(3246);const K=({options:pe,selectedOptions:le,disabledOptions:Te,onSelect:Ee,onClear:Re,showOnLeft:me})=>{const Me=(0,n.$j)(),ye=(0,d.J)(Me),Le=(0,n.of)(B),We=async()=>{Re&&Re()};return t.createElement("div",{className:(0,r.cx)(Le.subMenu,{[Le.subMenuLeft]:me}),"aria-label":"Role picker submenu"},t.createElement(O.E,{autoHide:!1,autoHeightMax:`${a}px`,hideHorizontalTrack:!0},t.createElement("div",{className:ye.optionBody},pe.map((Be,Ye)=>t.createElement(G,{data:Be,key:Ye,isSelected:!!(Be.uid&&(le.find(at=>at.uid===Be.uid)||Te?.find(at=>at.uid===Be.uid))),disabled:!!(Be.uid&&Te?.find(at=>at.uid===Be.uid))||(0,_.W)(Be),onChange:Ee,hideDescription:!0})))),t.createElement("div",{className:Le.subMenuButtonRow},t.createElement(P.Gy,{justify:"flex-end"},t.createElement(L.$n,{size:"sm",fill:"text",onClick:We},"Clear"))))},j=t.forwardRef(({roles:pe,renderedName:le,showGroups:Te,optionGroups:Ee,onGroupChange:Re,groupSelected:me,groupPartiallySelected:Me,subMenuNode:ye,selectedOptions:Le,onRoleChange:We,onClearSubMenu:Be,showOnLeftSubMenu:Ye},at)=>{const[st,Ke]=(0,t.useState)(!1),[Xe,He]=(0,t.useState)(""),Ge=(0,n.$j)(),xe=(0,d.J)(Ge),$e=(0,n.of)(B),be=(0,t.useCallback)(ae=>{He(ae),Ke(!0)},[]),Z=(0,t.useCallback)(()=>{Ke(!1),He("")},[]);return t.createElement("div",null,pe.length>0&&t.createElement("div",{className:$e.menuSection},t.createElement("div",{className:$e.groupHeader},le),t.createElement("div",{className:xe.optionBody}),Te&&Ee?.length?Ee.map(ae=>t.createElement(V,{key:ae.value,name:ae.name,value:ae.value,isSelected:me(ae.value)||Me(ae.value),partiallySelected:Me(ae.value),disabled:ae.options?.every(_.W),onChange:Re,onOpenSubMenu:be,onCloseSubMenu:Z,root:ye,isFocused:st&&Xe===ae.value},st&&Xe===ae.value&&t.createElement(K,{options:ae.options,selectedOptions:Le,onSelect:We,onClear:()=>Be(Xe),showOnLeft:Ye}))):pe.map(ae=>t.createElement(G,{data:ae,key:ae.uid,isSelected:!!(ae.uid&&Le.find(de=>de.uid===ae.uid)),disabled:(0,_.W)(ae),onChange:We,hideDescription:!0}))))});j.displayName="RoleMenuGroupsSection";var k=(pe=>(pe.fixed="fixed",pe.custom="custom",pe.plugin="plugin",pe))(k||{});const Y={ldap:"LDAP",current:"Current org"},ee=t.createElement(t.Fragment,null,'You can now select the "No basic role" option and add permissions to your custom needs. You can find more information in\xA0',t.createElement(S.Y,{href:"https://grafana.com/docs/grafana/latest/administration/roles-and-permissions/#organization-roles",variant:"bodySmall",external:!0},"our documentation"),"."),re=({basicRole:pe,options:le,appliedRoles:Te,showGroups:Ee,basicRoleDisabled:Re,disabledMessage:me,showBasicRole:Me,onSelect:ye,onBasicRoleSelect:Le,onUpdate:We,updateDisabled:Be,offset:Ye,menuLeft:at,apply:st})=>{const[Ke,Xe]=(0,t.useState)(Te),[He,Ge]=(0,t.useState)(pe),[xe,$e]=(0,t.useState)({}),be=(0,t.useRef)(null),Z=(0,n.$j)(),ae=(0,d.J)(Z),de=(0,n.of)(B);(0,t.useEffect)(()=>{ye(Ke)},[Ke,ye]),(0,t.useEffect)(()=>{Le&&He&&Le(He)},[He,Le]),(0,t.useEffect)(()=>{const mt=le.filter(J).sort(ge),gt=le.filter(ne).sort(ge),Pt=le.filter(q).sort(ge),Mt={fixed:te(gt).sort((Yt,zt)=>Yt.name.localeCompare(zt.name)),custom:te(mt).sort((Yt,zt)=>Yt.name.localeCompare(zt.name)),plugin:te(Pt).sort((Yt,zt)=>Yt.name.localeCompare(zt.name))};$e({fixed:{groupType:"fixed",optionGroup:Mt.fixed,renderedName:"Fixed roles",roles:gt},custom:{groupType:"custom",optionGroup:Mt.custom,renderedName:"Custom roles",roles:mt},plugin:{groupType:"plugin",optionGroup:Mt.plugin,renderedName:"Plugin roles",roles:Pt}})},[le]);const ve=mt=>{const gt=[];for(const Pt of Ke)oe(Pt)===mt&>.push(Pt);return gt},Ue=(mt,gt)=>{const Pt=ve(gt),Mt=xe[mt]?.optionGroup.find(Yt=>Yt.value===gt);return Pt.length>0&&Pt.length>=Mt.options.length},_e=(mt,gt)=>{const Pt=ve(gt),Mt=xe[mt]?.optionGroup.find(Yt=>Yt.value===gt);return Pt.length>0&&Pt.length<Mt.options.length},ze=mt=>{Ke.find(gt=>gt.uid===mt.uid)?Xe(Ke.filter(gt=>gt.uid!==mt.uid)):Xe([...Ke,mt])},Ve=(mt,gt)=>{const Pt=xe[mt]?.optionGroup.find(Mt=>Mt.value===gt);if(Pt)if(Ue(mt,gt)||_e(mt,gt))Xe(Ke.filter(Mt=>!Pt.options.find(Yt=>Mt.uid===Yt.uid)));else{const Mt=Pt.options.filter(zt=>zt.delegatable),Yt=Ke.filter(zt=>!Pt.options.find(_t=>zt.uid===_t.uid));Xe([...Yt,...Mt])}},Ne=mt=>{Ge(mt)},ot=async()=>{Xe([])},nt=mt=>{const gt=Ke.filter(Pt=>oe(Pt)!==mt);Xe(gt)},pt=()=>{We(Ke,He)};return t.createElement("div",{className:(0,r.cx)(ae.menu,de.menuWrapper,{[de.menuLeft]:at},(0,r.css)({top:`${Ye.vertical}px`,left:at?"unset":`${Ye.horizontal}px`,right:at?`${Ye.horizontal}px`:"unset"}))},t.createElement("div",{className:de.menu,"aria-label":"Role picker menu"},t.createElement(O.E,{autoHide:!1,autoHeightMax:`${a}px`,hideHorizontalTrack:!0,hideVerticalTrack:!0,className:(0,r.cx)(de.hideScrollBar)},Me&&t.createElement("div",{className:de.menuSection},t.createElement(w,{value:He,onChange:Ne,disabled:Re,disabledMesssage:me,tooltipMessage:ee})),Object.entries(xe).map(([mt,gt])=>t.createElement(j,{key:mt,roles:gt.roles,renderedName:gt.renderedName,showGroups:Ee,optionGroups:gt.optionGroup,groupSelected:Pt=>Ue(gt.groupType,Pt),groupPartiallySelected:Pt=>_e(gt.groupType,Pt),onGroupChange:Pt=>Ve(gt.groupType,Pt),subMenuNode:be?.current,selectedOptions:Ke,onRoleChange:ze,onClearSubMenu:nt,showOnLeftSubMenu:at}))),t.createElement("div",{className:de.menuButtonRow},t.createElement(P.Gy,{justify:"flex-end"},t.createElement(L.$n,{size:"sm",fill:"text",onClick:ot,disabled:Be},"Clear all"),t.createElement(L.$n,{size:"sm",onClick:pt,disabled:Be},st?"Apply":"Update")))),t.createElement("div",{ref:be}))},J=pe=>!pe.name?.startsWith("fixed:")&&!pe.name.startsWith("plugins:"),ne=pe=>pe.name?.startsWith("fixed:"),q=pe=>pe.name?.startsWith("plugins:"),te=pe=>{const le={};return pe.forEach(Ee=>{const Re=oe(Ee),me=ue(Ee);le[Re]||(le[Re]={name:me,roles:[]}),le[Re].roles.push(Ee)}),Object.entries(le).map(([Ee,Re])=>({name:Y[Ee]||he(Re.name),value:Ee,options:Re.roles.sort(ge)}))},oe=pe=>{const le=ie(pe),Te=ue(pe);return`${le}:${Te}`},ue=pe=>pe.group||"Other",ie=pe=>{const le=pe.name.indexOf(":");return le<0?"unknown":pe.name.substring(0,le)},ge=(pe,le)=>pe.name.localeCompare(le.name),he=pe=>pe.slice(0,1).toUpperCase()+pe.slice(1),De=({basicRole:pe,appliedRoles:le,roleOptions:Te,disabled:Ee,isLoading:Re,basicRoleDisabled:me,basicRoleDisabledMessage:Me,showBasicRole:ye,onRolesChange:Le,onBasicRoleChange:We,canUpdateRoles:Be=!0,apply:Ye=!1,maxWidth:at=m,width:st})=>{const[Ke,Xe]=(0,t.useState)(!1),[He,Ge]=(0,t.useState)(le),[xe,$e]=(0,t.useState)(pe),[be,Z]=(0,t.useState)(""),[ae,de]=(0,t.useState)({vertical:0,horizontal:0}),[ve,Ue]=(0,t.useState)(!1),_e=(0,t.useRef)(null),ze=(0,n.$j)(),Ve=typeof st=="number"?ze.spacing(st):st;(0,t.useEffect)(()=>{$e(pe),Ge(le)},[le,pe,We]);const Ne=(0,t.useCallback)(()=>{const{horizontal:_t,vertical:rt,menuToLeft:It}=ot();_t&&rt&&(de({horizontal:_t,vertical:rt}),Ue(It))},[]);(0,t.useEffect)(()=>{Ke&&Ne()},[Ke,He,Ne]);const ot=()=>{const _t=_e?.current?.getBoundingClientRect();if(!_t)return{};const{bottom:rt,top:It,left:Dn,right:ft}=_t;let yt=Dn,jt=rt+10,cn=!1;return window.innerHeight-rt<a+20&&(jt=It-a-50),Dn+C>window.innerWidth&&(yt=window.innerWidth-ft,cn=!0),{horizontal:yt,vertical:jt,menuToLeft:cn}},nt=(0,t.useCallback)(_t=>{Ee||(_t.preventDefault(),_t.stopPropagation(),Ne(),Xe(!0))},[Ee,Ne]),pt=(0,t.useCallback)(()=>{Xe(!1),Z(""),Ge(le),$e(pe)},[le,pe]),mt=()=>Ke&&pt(),gt=_t=>{Z(_t||"")},Pt=_t=>{Ge(_t)},Mt=_t=>{$e(_t)},Yt=(_t,rt)=>{We&&rt&&rt!==pe&&We(rt),Be&&Le(_t),Z(""),Xe(!1)},zt=()=>{const _t=Te.map(rt=>({...rt,delegatable:Be&&rt.delegatable}));return be&&be.trim()!==""?_t.filter(rt=>rt.name?.toLowerCase().includes(be.toLowerCase())):_t};return t.createElement("div",{"data-testid":"role-picker",style:{position:"relative",maxWidth:Ve||at,width:Ve},ref:_e},t.createElement(o.N,{onClick:mt,useCapture:!1},t.createElement(M,{basicRole:xe,appliedRoles:He,query:be,onQueryChange:gt,onOpen:nt,onClose:pt,isFocused:Ke,disabled:Ee,showBasicRole:ye,width:Ve,isLoading:Re}),Ke&&t.createElement(s.ZL,null,t.createElement("div",{onClick:_t=>_t.stopPropagation()},t.createElement(re,{options:zt(),basicRole:xe,appliedRoles:le,onBasicRoleSelect:Mt,onSelect:Pt,onUpdate:Yt,showGroups:be.length===0||be.trim()==="",basicRoleDisabled:me,disabledMessage:Me,showBasicRole:ye,updateDisabled:me&&!Be,apply:Ye,offset:ae,menuLeft:ve})))))}},89062:(Q,A,e)=>{"use strict";e.d(A,{y:()=>u});var t=e(96540),n=e(41053),o=e(10096),s=e(80348),r=e(37425),g=e(85927);const u=({basicRole:c,roles:i,userId:l,orgId:f,onBasicRoleChange:d,roleOptions:h,disabled:p,basicRoleDisabled:m,basicRoleDisabledMessage:a,apply:v=!1,onApplyRoles:E,pendingRoles:D,maxWidth:b,width:C,isLoading:y})=>{const[{loading:M,value:T=i||[]},I]=(0,n.A)(async()=>{try{if(i)return i;if(v&&D?.length)return D;if(o.TP.hasPermission(s.AccessControlAction.ActionUserRolesList))return await(0,g.Xh)(l,f)}catch{console.error("Error loading options")}return[]},[f,l,D,i]);(0,t.useEffect)(()=>{f&&I()},[I,f]);const x=async O=>{v?E&&E(O,l,f):(await(0,g.eA)(O,l,f),await I())},S=o.TP.hasPermission(s.AccessControlAction.ActionUserRolesAdd)&&o.TP.hasPermission(s.AccessControlAction.ActionUserRolesRemove);return t.createElement(r.n,{appliedRoles:T,basicRole:c,onRolesChange:x,onBasicRoleChange:d,roleOptions:h,isLoading:M||y,disabled:p,basicRoleDisabled:m,basicRoleDisabledMessage:a,showBasicRole:!0,apply:v,canUpdateRoles:S,maxWidth:b,width:C})}},85927:(Q,A,e)=>{"use strict";e.d(A,{G3:()=>u,RL:()=>o,Xh:()=>s,eA:()=>r,xN:()=>g});var t=e(17172),n=e(3246);const o=async c=>{let i="/api/access-control/roles?delegatable=true";c&&(i+=`&targetOrgId=${c}`);const l=await(0,t.AI)().get(i);return!l||!l.length?[]:l.map(n.c)},s=async(c,i)=>{let l=`/api/access-control/users/${c}/roles`;i&&(l+=`?targetOrgId=${i}`);try{const f=await(0,t.AI)().get(l);return!f||!f.length?[]:f.map(n.c)}catch(f){return(0,t.NF)(f)&&(f.isHandled=!0),[]}},r=(c,i,l)=>{let f=`/api/access-control/users/${i}/roles`;l&&(f+=`?targetOrgId=${l}`);const d=c.flatMap(h=>h.uid);return(0,t.AI)().put(f,{orgId:l,roleUids:d})},g=async(c,i)=>{let l=`/api/access-control/teams/${c}/roles`;i&&(l+=`?targetOrgId=${i}`);try{const f=await(0,t.AI)().get(l);return!f||!f.length?[]:f.map(n.c)}catch(f){return(0,t.NF)(f)&&(f.isHandled=!0),[]}},u=(c,i,l)=>{let f=`/api/access-control/teams/${i}/roles`;l&&(f+=`?targetOrgId=${l}`);const d=c.flatMap(h=>h.uid);return(0,t.AI)().put(f,{orgId:l,roleUids:d})}},3246:(Q,A,e)=>{"use strict";e.d(A,{W:()=>t,c:()=>n});const t=o=>o.delegatable!==void 0&&!o.delegatable,n=o=>{const s="fixed:";if(!o.displayName&&o.name.startsWith(s)){let r="";r=o.name.replace(s,"").replace(/:/g," "),o.displayName=r}return o}},47694:(Q,A,e)=>{"use strict";e.d(A,{y:()=>l});var t=e(96540),n=e(8867),o=e(40672),s=e(62938);const r=2,g=5,u=p=>{const m=p.match(new RegExp('<style type="text/css">([\\s\\S]*?)<\\/style>'));return m?m[0]:null},c=p=>p.match(new RegExp(`<svg.*id\\s*=\\s*(['"])(.*?)\\1`))?.[r],i=p=>{let m=c(p);if(!m){m=`x${(0,s.A)()}`;const v=p.indexOf("<svg")+g;p=p.substring(0,v)+`id="${m}" `+p.substring(v)}let a=u(p);if(a){let v=a.replace(/(#(.*?))?\./g,`#${m} .`);p=p.replace(a,v)}return p},l=p=>{const{cleanStyle:m,...a}=p;return t.createElement(n.default,{...a,cacheRequests:!0,preProcessor:m?h:d})};let f=new Map;function d(p){let m=f.get(p);return m||(m=o.sQ.sanitizeSVGContent(p),f.set(p,m)),m}function h(p){let m=f.get(p);return m||(m=o.sQ.sanitizeSVGContent(p),m.indexOf('<style type="text/css">')>-1&&(m=i(m)),f.set(p,m)),m}},59429:(Q,A,e)=>{"use strict";e.d(A,{b:()=>i});var t=e(76459),n=e.n(t),o=e(96540),s=e(88323),r=e(27677);const g=(l="General",f)=>`${l}/${f}`;async function u(l=""){return r.IB.search({type:"dash-db",query:l,limit:100}).then(f=>f.map(d=>({value:{uid:d.uid,title:d.title,folderTitle:d.folderTitle,folderUid:d.folderUid},label:g(d?.folderTitle,d.title)})))}const c=n()(u,250,{leading:!0}),i=({value:l,onChange:f,placeholder:d="Select dashboard",noOptionsMessage:h="No dashboards found",...p})=>{const[m,a]=(0,o.useState)();(0,o.useEffect)(()=>{!l||l===m?.value?.uid||(async()=>{const E=await r.IB.getDashboardByUid(l);E.dashboard&&a({value:{uid:E.dashboard.uid,title:E.dashboard.title,folderTitle:E.meta.folderTitle,folderUid:E.meta.folderUid},label:g(E.meta?.folderTitle,E.dashboard.title)})})()},[l]);const v=(0,o.useCallback)(E=>{a(E),f?.(E?.value)},[f,a]);return o.createElement(s.DW,{loadOptions:c,onChange:v,placeholder:d,noOptionsMessage:h,value:m,defaultOptions:!0,...p})}},70096:(Q,A,e)=>{"use strict";e.d(A,{d:()=>J});var t=e(96540),n=e(32264),o=e(32196),s=e(18491),r=e(36376),g=e(76459),u=e.n(g),c=e(40845),i=e(10354),l=e(14578),f=e(42418),d=e(57514),h=e(44836),p=e(55314),m=e(92955),a=e(37690),v=e(93519),E=e(24439),D=e(40957),b=e(64756),C=e(70255),y=e(91793),M=e(10022),T=e(29158),I=e(94753),x=e(18759),S=e(80348);const O=40,P="md",L=(q,te)=>`${q}-${te||"root"}`;function U({items:q,focusedItemIndex:te,foldersAreOpenable:oe,idPrefix:ue,selectedFolder:ie,onFolderExpand:ge,onFolderSelect:he,isItemLoaded:De,requestLoadMore:pe}){const le=(0,t.useRef)(null),Te=(0,c.of)(H),Ee=(0,t.useMemo)(()=>({items:q,focusedItemIndex:te,foldersAreOpenable:oe,selectedFolder:ie,onFolderExpand:ge,onFolderSelect:he,idPrefix:ue}),[q,te,oe,ie,ge,he,ue]),Re=(0,t.useCallback)(Me=>De(Me),[De]),me=(0,t.useCallback)((Me,ye)=>{const{parentUID:Le}=q[Me];pe(Le)},[pe,q]);return t.createElement("div",{className:Te.table,role:"tree"},q.length>0?t.createElement(M.A,{ref:le,itemCount:q.length,isItemLoaded:Re,loadMoreItems:me},({onItemsRendered:Me,ref:ye})=>t.createElement(y.Y1,{ref:ye,height:O*Math.min(6.5,q.length),width:"100%",itemData:Ee,itemSize:O,itemCount:q.length,onItemsRendered:Me},B)):t.createElement("div",{className:Te.emptyMessage},t.createElement(h.x6,{i18nKey:"browse-dashboards.folder-picker.empty-message"},"No folders found")))}const R=[100,200,130,160,150];function B({index:q,style:te,data:oe}){const{items:ue,focusedItemIndex:ie,foldersAreOpenable:ge,selectedFolder:he,onFolderExpand:De,onFolderSelect:pe,idPrefix:le}=oe,{item:Te,isOpen:Ee,level:Re,parentUID:me}=ue[q],Me=(0,t.useRef)(null),ye=(0,t.useId)(),Le=(0,S.useSelector)(a.ku),We=(0,S.useSelector)(a.Am),Be=(Te.uid?We[Te.uid]:Le)?.items??[];let Ye=[];Te.uid&&(Ye=(me?We[me]:Le)?.items??[]);const at=(0,c.of)(H),st=(0,t.useCallback)(Xe=>{Xe.preventDefault(),Xe.stopPropagation(),Te.uid&&De(Te.uid,!Ee)},[Te.uid,Ee,De]),Ke=(0,t.useCallback)(()=>{Te.kind==="folder"&&pe(Te)},[Te,pe]);return Te.kind==="ui"&&Te.uiKind==="pagination-placeholder"?t.createElement("span",{style:te,className:at.row},t.createElement(x.T,{level:Re,spacing:2}),t.createElement(C.A,{width:R[q%R.length]})):Te.kind!=="folder"?null:t.createElement("div",{ref:Me,style:te,className:(0,o.cx)(at.row,{[at.rowFocused]:q===ie,[at.rowSelected]:Te.uid===he}),tabIndex:-1,onClick:Ke,"aria-expanded":Ee,"aria-selected":Te.uid===he,"aria-labelledby":ye,"aria-level":Re+1,role:"treeitem","aria-owns":Be.length>0?Be.map(Xe=>L(le,Xe.uid)).join(" "):void 0,"aria-setsize":Be.length,"aria-posinset":Ye.findIndex(Xe=>Xe.uid===Te.uid)+1,id:L(le,Te.uid)},t.createElement("div",{className:at.rowBody},t.createElement(x.T,{level:Re,spacing:2}),ge?t.createElement(T.K,{size:P,onMouseDown:st,tabIndex:-1,"aria-label":Ee?`Collapse folder ${Te.title}`:`Expand folder ${Te.title}`,name:Ee?"angle-down":"angle-right"}):t.createElement("span",{className:at.folderButtonSpacer}),t.createElement("label",{className:at.label,id:ye},t.createElement(I.E,{truncate:!0},Te.title))))}const H=q=>{const te=(0,o.css)({height:O,display:"flex",position:"relative",alignItems:"center",flexGrow:1,gap:q.spacing(.5),overflow:"hidden",padding:q.spacing(0,1)});return{table:(0,o.css)({background:q.components.input.background}),emptyMessage:(0,o.css)({padding:q.spacing(1),textAlign:"center",width:"100%"}),folderButtonSpacer:(0,o.css)({paddingLeft:q.spacing(.5)}),row:(0,o.css)({display:"flex",position:"relative",alignItems:"center",[":not(:first-child)"]:{borderTop:`solid 1px ${q.colors.border.weak}`}}),rowFocused:(0,o.css)({backgroundColor:q.colors.background.secondary}),rowSelected:(0,o.css)({"&::before":{display:"block",content:'""',position:"absolute",left:0,bottom:0,top:0,width:4,borderRadius:q.shape.radius.default,backgroundImage:q.colors.gradients.brandVertical}}),rowBody:te,label:(0,o.css)({lineHeight:O+"px",flexGrow:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap","&:hover":{textDecoration:"underline",cursor:"pointer"}})}};var w=e(16797);function N({handleClearSelection:q,isLoading:te,invalid:oe,label:ue,...ie},ge){const he=(0,c.$j)(),De=G(he,oe),pe=le=>{(le.key==="Enter"||le.key===" ")&&q?.(le)};return t.createElement("div",{className:De.wrapper},t.createElement("div",{className:De.inputWrapper},ue?t.createElement("div",{className:De.prefix},t.createElement(l.I,{name:"folder"})):void 0,t.createElement("button",{type:"button",className:(0,o.cx)(De.fakeInput,ue?De.hasPrefix:void 0),...ie,ref:ge},te?t.createElement(C.A,{width:100}):ue?t.createElement(I.E,{truncate:!0},ue):t.createElement(I.E,{truncate:!0,color:"secondary"},t.createElement(h.x6,{i18nKey:"browse-dashboards.folder-picker.button-label"},"Select folder")),!te&&q&&t.createElement(l.I,{role:"button",tabIndex:0,"aria-label":(0,h.t)("browse-dashboards.folder-picker.clear-selection","Clear selection"),className:De.clearIcon,name:"times",onClick:q,onKeyDown:pe})),t.createElement("div",{className:De.suffix},t.createElement(l.I,{name:"angle-down"}))))}const V=(0,t.forwardRef)(N),G=(q,te=!1)=>{const oe=(0,i.n)({theme:q,invalid:te});return{wrapper:oe.wrapper,inputWrapper:oe.inputWrapper,prefix:(0,o.css)([oe.prefix,{pointerEvents:"none",color:q.colors.text.primary}]),suffix:(0,o.css)([oe.suffix,{pointerEvents:"none"}]),fakeInput:(0,o.css)([oe.input,{textAlign:"left",letterSpacing:"normal","&:focus":{outline:"unset",boxShadow:"unset"},"&:focus-visible":(0,o.css)` ${(0,w.focusCss)(q)} `,alignItems:"center",display:"flex",flexWrap:"nowrap",justifyContent:"space-between",paddingRight:28}]),hasPrefix:(0,o.css)({paddingLeft:28}),clearIcon:(0,o.css)({color:q.colors.text.secondary,cursor:"pointer","&:hover":{color:q.colors.text.primary},"&:focus:not(:focus-visible)":(0,w.getMouseFocusStyles)(q),"&:focus-visible":(0,w.getFocusStyles)(q)})}};function _({tree:q,handleCloseOverlay:te,handleFolderSelect:oe,handleFolderExpand:ue,idPrefix:ie,search:ge,visible:he}){const[De,pe]=(0,t.useState)(-1),le=!!n.$.featureToggles.nestedFolders;(0,t.useEffect)(()=>{he&&pe(-1)},[he]),(0,t.useEffect)(()=>{pe(0)},[ge]),(0,t.useEffect)(()=>{document.getElementById(L(ie,q[De]?.item.uid))?.scrollIntoView({block:"nearest",inline:"nearest"})},[De,ie,q]);const Te=(0,t.useCallback)(Ee=>{const Re=le&&!ge;switch(Ee.key){case"ArrowRight":case"ArrowLeft":Re&&(Ee.preventDefault(),ue(q[De].item.uid,Ee.key==="ArrowRight"));break;case"ArrowUp":De>0&&(Ee.preventDefault(),pe(De-1));break;case"ArrowDown":De<q.length-1&&(Ee.preventDefault(),pe(De+1));break;case"Enter":Ee.preventDefault();const me=q[De].item;me.kind==="folder"&&oe(me);break;case"Tab":Ee.stopPropagation(),te();break;case"Escape":Ee.stopPropagation(),Ee.preventDefault(),te();break}},[De,te,ue,oe,le,ge,q]);return{focusedItemIndex:De,handleKeyDown:Te}}const K=["empty-folder","dashboard"],j=u()(k,300);async function k(q){const te=await(0,E.getGrafanaSearcher)().search({query:q,kind:["folder"],limit:100}),oe=te.view.map(ue=>(0,D.hI)(ue,te.view));return{...te,items:oe}}function Y({value:q,invalid:te,showRootFolder:oe=!0,clearable:ue=!1,excludeUIDs:ie,onChange:ge}){const he=(0,c.of)(ee),De=(0,b.wA)(),pe=(0,p.kH)(q||p.hT),le=(0,a.eC)(void 0),Te=!!n.$.featureToggles.nestedFolders,[Ee,Re]=(0,t.useState)(""),[me,Me]=(0,t.useState)(null),[ye,Le]=(0,t.useState)(!1),[We,Be]=(0,t.useState)(!1),[Ye,at]=(0,t.useState)(!1),[st,Ke]=(0,t.useState)({}),Xe=(0,t.useId)(),[He]=(0,t.useState)(void 0),Ge=(0,t.useRef)(0);(0,t.useEffect)(()=>{if(!Ee){Me(null);return}const It=Date.now();Le(!0),j(Ee).then(Dn=>{if(It>Ge.current){const ft=Dn.view.map(yt=>(0,D.hI)(yt,Dn.view));Me({...Dn,items:ft}),Le(!1),Ge.current=It}})},[Ee]);const xe=(0,b.d4)(a.ku),$e=(0,b.d4)(a.Am),be=[(0,s.UU)({crossAxis:!1,boundary:document.body})],{context:Z,refs:ae,floatingStyles:de,elements:ve}=(0,r.we)({open:Ye,placement:"bottom",onOpenChange:It=>{It&&(Re(""),Be(!0)),at(It)},middleware:be,whileElementsMounted:s.ll}),Ue=(0,r.kp)(Z),_e=(0,r.s9)(Z),{getReferenceProps:ze,getFloatingProps:Ve}=(0,r.bv)([_e,Ue]),Ne=(0,t.useCallback)(async(It,Dn)=>{Ke(ft=>({...ft,[It]:Dn})),Dn&&!st[It]&&De((0,a.Ii)({parentUID:It,pageSize:m.md,excludeKinds:K}))},[De,st]),ot=(0,t.useCallback)(It=>{ge&&ge(It.uid,It.title),at(!1)},[ge]),nt=(0,t.useCallback)(It=>{It.preventDefault(),It.stopPropagation(),ge&&ge(void 0,void 0)},[ge]),pt=(0,t.useCallback)(()=>at(!1),[at]),mt=(0,a.Zg)(K),gt=(0,t.useCallback)(It=>{Ee||mt(It)},[Ee,mt]),Pt=(0,t.useMemo)(()=>{if(Ee&&me){const ft={isFullyLoaded:!0,lastKindHasMoreItems:!1,lastFetchedKind:"folder",lastFetchedPage:1,items:me.items??[]};return(0,a.A4)(void 0,ft,$e,{},0,K,ie)}const It=n.$.sharedWithMeFolderUID?[...ie||[],n.$.sharedWithMeFolderUID]:ie;let Dn=(0,a.A4)(void 0,xe,$e,st,0,K,It);if(oe){for(const ft of Dn)ft.level+=1;Dn.unshift({isOpen:!0,level:0,item:{kind:"folder",title:"Dashboards",uid:""}})}return xe||(Dn=Dn.concat((0,v.T)(m.md,void 0,0))),Dn},[Ee,me,xe,$e,st,ie,oe]),Mt=(0,t.useCallback)(It=>{const Dn=Pt[It];if(!Dn)return!1;const ft=Dn.item;return!(ft.kind==="ui"&&ft.uiKind==="pagination-placeholder")},[Pt]),Yt=le==="pending"||ye,{focusedItemIndex:zt,handleKeyDown:_t}=_({tree:Pt,handleCloseOverlay:pt,handleFolderSelect:ot,handleFolderExpand:Ne,idPrefix:Xe,search:Ee,visible:Ye});let rt=pe.data?.title;return q===""&&(rt="Dashboards"),Ye?t.createElement(t.Fragment,null,t.createElement(i.p,{ref:ae.setReference,autoFocus:!0,prefix:rt?t.createElement(l.I,{name:"folder"}):null,placeholder:rt??(0,h.t)("browse-dashboards.folder-picker.search-placeholder","Search folders"),value:Ee,invalid:te,className:he.search,onChange:It=>Re(It.currentTarget.value),"aria-autocomplete":"list","aria-expanded":!0,"aria-haspopup":!0,"aria-controls":Xe,"aria-owns":Xe,"aria-activedescendant":L(Xe,Pt[zt]?.item.uid),role:"combobox",suffix:t.createElement(l.I,{name:"search"}),...ze(),onKeyDown:_t}),t.createElement("fieldset",{ref:ae.setFloating,id:Xe,className:he.tableWrapper,style:{...de,width:ve.domReference?.clientWidth},...Ve()},He?t.createElement(f.F,{className:he.error,severity:"warning",title:(0,h.t)("browse-dashboards.folder-picker.error-title","Error loading folders")},He.message||He.toString?.()||(0,h.t)("browse-dashboards.folder-picker.unknown-error","Unknown error")):t.createElement("div",null,Yt&&t.createElement("div",{className:he.loader},t.createElement(d.G,{width:600})),t.createElement(U,{items:Pt,selectedFolder:q,focusedItemIndex:zt,onFolderExpand:Ne,onFolderSelect:ot,idPrefix:Xe,foldersAreOpenable:Te&&!(Ee&&me),isItemLoaded:Mt,requestLoadMore:gt})))):t.createElement(V,{label:rt,handleClearSelection:ue&&q!==void 0?nt:void 0,invalid:te,isLoading:pe.isLoading,autoFocus:We,ref:ae.setReference,"aria-label":rt?(0,h.t)("browse-dashboards.folder-picker.accessible-label","Select folder: {{ label }} currently selected",{label:rt}):void 0,...ze()})}const ee=q=>({button:(0,o.css)({maxWidth:"100%"}),error:(0,o.css)({marginBottom:0}),tableWrapper:(0,o.css)({boxShadow:q.shadows.z3,position:"relative",zIndex:q.zIndex.portal}),loader:(0,o.css)({position:"absolute",top:0,left:0,right:0,zIndex:q.zIndex.portal+1,overflow:"hidden"}),search:(0,o.css)({input:{cursor:"default"}})});var re=e(85242);function J(q){const te=n.$.featureToggles.newFolderPicker||n.$.featureToggles.nestedFolders&&n.$.featureToggles.nestedFolderPicker,{initialTitle:oe,dashboardId:ue,enableCreateNew:ie,...ge}=q;return te?t.createElement(Y,{...ge}):t.createElement(ne,{...q})}function ne({value:q,showRootFolder:te,onChange:oe,initialTitle:ue,dashboardId:ie,enableCreateNew:ge,inputId:he,skipInitialLoad:De}){const pe=(0,t.useCallback)(le=>{oe&&oe(le.uid,le.title)},[oe]);return t.createElement(re.sR,{onChange:pe,showRoot:te,initialFolderUid:q,initialTitle:ue,inputId:he,skipInitialLoad:De,dashboardId:ie,enableCreateNew:ge})}},85242:(Q,A,e)=>{"use strict";e.d(A,{sR:()=>D});var t=e(32196),n=e(76459),o=e.n(n),s=e(96540),r=e(16817),g=e(26272),u=e(13544),c=e(14110),i=e(40845),l=e(10354),f=e(88323),d=e(28138),h=e(44836),p=e(16233),m=e(11230),a=e(80348);const v="+ Add new",E="-10";function D(M){const{dashboardId:T,allowEmpty:I,onChange:x,filter:S,enableCreateNew:O,inputId:P,onClear:L,enableReset:U,initialFolderUid:R,initialTitle:B="",permissionLevel:H=a.PermissionLevelString.Edit,rootName:w,showRoot:N=!0,skipInitialLoad:V,searchQueryType:G,customAdd:_,folderWarning:K,invalid:j}=M,k=w??"Dashboards",[Y,ee]=(0,s.useState)(null),[re,J]=(0,s.useState)(!1),[ne,q]=(0,s.useState)(""),[te,oe]=(0,s.useState)(Y?.title??""),ue=(0,i.of)(y),ie=typeof L=="function",ge=(0,s.useCallback)(async Le=>{const We=await(0,m.c0)(Le,H,G),Ye=b(We,S);return(0,c.rR)("grafana_folder_picker_results_loaded",{results:Ye.length,searchTermLength:Le.length,enableCreateNew:!!O}),(p.TP.hasPermission(a.AccessControlAction.DashboardsWrite)||p.TP.hasPermission(a.AccessControlAction.DashboardsCreate))&&k?.toLowerCase().startsWith(Le.toLowerCase())&&N&&Ye.unshift({label:k,value:""}),U&&Le===""&&B!==""&&!Ye.find(st=>st.label===B)&&Ye.unshift({label:B,value:R}),O&&_?[...Ye,{value:E,label:v,title:Le}]:Ye},[U,R,B,H,k,N,G,S,O,_]),he=(0,s.useMemo)(()=>o()(ge,300,{leading:!0}),[ge]),De=async()=>{const Le={label:B,value:void 0},We={label:k,value:""},Be=await ge("");let Ye=null;R!=null?Ye=Be.find(at=>at.value===R)||null:U&&B?Ye=Le:R&&(Ye=Be.find(at=>at.id===R)||null),!Ye&&!I&&(p.TP.isEditor?Ye=We:!!T?Ye=Le:Ye=Be.length>0?Be[0]:Le),!re&&ee(Ye)};(0,s.useEffect)(()=>{Y&&Y.value!==R&&!re&&Y.value&&Y.label&&x({uid:Y.value,title:Y.label})},[Y,R]),(0,r.A)(async()=>{if(V){const Le=await C({getFolder:m.Ql,folderUid:R,folderName:B});ee(Le)}await De()},[V,R,B]),(0,s.useEffect)(()=>{Y&&Y.id===E&&J(!0)},[Y]);const pe=(0,s.useCallback)((Le,We)=>{if(Le?.value===E)ee({id:E,title:ne}),oe(ne);else{if(Le||(Le={value:"",label:k}),We.action==="clear"&&L){L();return}ee(Le),x({uid:Le.value,title:Le.label})}},[x,L,k,ne]),le=(0,s.useCallback)(async Le=>{if(K?.warningCondition(Le))return(0,c.rR)("grafana_folder_picker_folder_created",{status:"failed_condition"}),!1;const We=await(0,m.vV)({title:Le});let Be={value:"",label:"Not created"};return We.uid?((0,c.rR)("grafana_folder_picker_folder_created",{status:"success"}),d.A.emit(g.r1.alertSuccess,["Folder Created","OK"]),Be={value:We.uid,label:We.title},ee(We),pe(Be,{action:"create-option",option:Be})):((0,c.rR)("grafana_folder_picker_folder_created",{status:"failed"}),d.A.emit(g.r1.alertError,["Folder could not be created"])),Be},[K,pe]),Te=(0,s.useCallback)(Le=>{const We=!!_?.disallowValues;if(Le.key==="Enter"&&We&&!_?.isAllowedValue(te)){Le.preventDefault();return}switch(Le.key){case"Enter":{le(Y?.title),J(!1);break}case"Escape":ee({value:"",label:k}),J(!1)}},[_?.disallowValues,_?.isAllowedValue,te,le,Y?.title,k]),Ee=Le=>{const We=Le.currentTarget.value;oe(We),ee({id:void 0,title:We})},Re=()=>{ee({value:"",label:k}),J(!1)},me=(Le,{action:We})=>{We==="input-change"&&q(Be=>Le),We==="menu-close"&&q(Be=>Le)},Me=()=>K?.warningCondition(te)?s.createElement(K.warningComponent,null):null,ye=()=>K?.warningCondition(ne)?s.createElement(K.warningComponent,null):null;return re?s.createElement(s.Fragment,null,s.createElement(Me,null),s.createElement("div",{className:ue.newFolder},"Press enter to create the new folder."),s.createElement(l.p,{width:30,autoFocus:!0,value:te,onChange:Ee,onKeyDown:Te,placeholder:"Press enter to confirm new folder.",onBlur:Re})):s.createElement("div",{"data-testid":u.Tp.components.FolderPicker.containerV2},s.createElement(ye,null),s.createElement(f.gZ,{inputId:P,"data-testid":u.Tp.components.FolderPicker.input,loadingMessage:(0,h.t)("folder-picker.loading","Loading folders..."),defaultOptions:!0,defaultValue:Y,inputValue:ne,onInputChange:me,value:Y,allowCustomValue:O&&!_,loadOptions:he,onChange:pe,onCreateOption:le,invalid:j,isClearable:ie}))}function b(M,T){return(T?T(M):M).map(x=>({label:x.title,value:x.uid}))}async function C({folderName:M,folderUid:T,getFolder:I}){if(T==null)throw new Error("folderUid is not found.");return M?{label:M,value:T}:{label:(await I(T)).title,value:T}}const y=M=>({newFolder:(0,t.css)({color:M.colors.warning.main,fontSize:M.typography.bodySmall.fontSize,paddingBottom:M.spacing(1)})})},46334:(Q,A,e)=>{"use strict";e.d(A,{E:()=>s});var t=e(96540),n=e(69613),o=e(14578);class s extends t.Component{constructor(g){super(g)}render(){const{label:g,removeIcon:u,count:c,onClick:i}=this.props,{color:l}=(0,n.MC)(g),f={backgroundColor:l},d=c!==0&&t.createElement("span",{className:"tag-count-label"},`(${c})`);return t.createElement("span",{className:"label label-tag",style:f},u&&t.createElement(o.I,{onClick:i,name:"times"}),g," ",d)}}},99818:(Q,A,e)=>{"use strict";e.d(A,{$:()=>h});var t=e(32196),n=e(96540),o=e(28581),s=e(54479),r=e(40845),g=e(88323),u=e(14578),c=e(44836),i=e(46334);const l=({data:m,className:a,label:v,isFocused:E,innerProps:D})=>{const b=(0,r.of)(f);return n.createElement("div",{className:(0,t.cx)(b.option,E&&b.optionFocused),"aria-label":"Tag option",...D},n.createElement("div",{className:`tag-filter-option ${a||""}`},typeof v=="string"?n.createElement(i.E,{label:v,removeIcon:!1,count:m.count??0}):v))},f=m=>({option:(0,t.css)` padding: 8px; white-space: nowrap; cursor: pointer; border-left: 2px solid transparent; &:hover { background: ${m.colors.background.secondary}; } `,optionFocused:(0,t.css)` background: ${m.colors.background.secondary}; border-style: solid; border-top: 0; border-right: 0; border-bottom: 0; border-left-width: 2px; `}),d=(m,a)=>RegExp((0,s.jD)(a),"i").test(m.value),h=({allowCustomValue:m=!1,formatCreateLabel:a,hideValues:v,inputId:E,isClearable:D,onChange:b,placeholder:C,tagOptions:y,tags:M,width:T})=>{const I=(0,r.of)(p),x=M.map(K=>({value:K,label:K,count:0})),[S,O]=(0,n.useState)(x),[P,L]=(0,n.useState)(!1),[U,R]=(0,n.useState)(M),[B,H]=(0,n.useState)(x),w=(0,n.useMemo)(()=>M.join(),[M]),N=(0,n.useCallback)(async()=>(await y()).map(j=>M.includes(j.term)?{value:j.term,label:j.term,count:0}:{value:j.term,label:j.term,count:j.count}),[y,M]),V=(0,n.useCallback)(async()=>{L(!0);const K=await N();m&&B.forEach(j=>K.push(j)),O(K),L(!1)},[m,B,N]);(0,n.useEffect)(()=>{M.length>0&&S.length===0&&V()},[V,S.length,M.length]),(0,n.useEffect)(()=>{M!==U&&(R(M),V())},[V,U,M]);const G=K=>{K.forEach(j=>j.count=0),b((K||[]).map(j=>j.value)),m&&H(K.filter(j=>!M.includes(j)))},_={key:w,onFocus:V,isLoading:P,options:S,allowCreateWhileLoading:!0,allowCustomValue:m,formatCreateLabel:a,defaultOptions:!0,filterOption:d,getOptionLabel:K=>K.label,getOptionValue:K=>K.value,inputId:E,isMulti:!0,onChange:G,loadingMessage:(0,c.t)("tag-filter.loading","Loading..."),noOptionsMessage:(0,c.t)("tag-filter.no-tags","No tags found"),placeholder:C||(0,c.t)("tag-filter.placeholder","Filter by tag"),value:x,width:T,components:{Option:l,MultiValueLabel:()=>null,MultiValueRemove(K){const{data:j}=K;return n.createElement(o.c.MultiValueRemove,{...K},n.createElement(i.E,{key:j.label,label:j.label,removeIcon:!0,count:j.count}))},MultiValueContainer:v?()=>null:o.c.MultiValueContainer}};return n.createElement("div",{className:I.tagFilter},D&&M.length>0&&n.createElement("button",{className:I.clear,onClick:()=>G([])},"Clear tags"),n.createElement(g.KF,{..._,prefix:n.createElement(u.I,{name:"tag-alt"}),"aria-label":"Tag filter"}))};h.displayName="TagFilter";const p=m=>({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: ${m.colors.text.secondary}; &:hover { color: ${m.colors.text.primary}; } `})},25573:(Q,A,e)=>{"use strict";e.d(A,{m:()=>d});var t=e(2543),n=e.n(t),o=e(96540),s=e(26272),r=e(65879),g=e(47232),u=e(15666),c=e(76412),i=e(28138),l=e(61680);const f="grafana.dashboard.timepicker.history",d=E=>o.createElement(l.b,{storageKey:f,defaultValue:[]},(D,b)=>{const C=p(D),y=h(C);return o.createElement(u.$6,{...E,history:y,onChange:M=>{m(M,C,b),E.onChange(M)},onError:M=>i.A.emit(s.r1.alertError,[(0,c.t)("time-picker.copy-paste.default-error-title","Invalid time range"),(0,c.t)("time-picker.copy-paste.default-error-message","{{error}} is not a valid time range",{error:M})])})});function h(E){return E.map(D=>r.convertRawToRange(D,"utc",void 0,"YYYY-MM-DD HH:mm:ss"))}function p(E){return E.map(D=>{const b=typeof D.from=="string"?D.from:D.from.toISOString(),C=typeof D.to=="string"?D.to:D.to.toISOString();return{from:b,to:C}})}function m(E,D,b){if(!a(E))return;const C={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()},y=v([C,...D]);b(y)}function a(E){return(0,g.Ar)(E.raw.from)||(0,g.Ar)(E.raw.to)}function v(E){return(0,t.uniqBy)(E,D=>D.from+D.to).slice(0,4)}},82389:(Q,A,e)=>{"use strict";e.d(A,{I:()=>f});var t=e(96540),n=e(24293),o=e(11261),s=e(52622),r=e(67266),g=e(55726),u=e(79041),c=e(30249),i=e(28895);const l=["rowHeight","colWidth","showValue","mergeValues","alignValue","tooltip"];class f extends t.Component{constructor(){super(...arguments),this.getValueColor=(h,p,m)=>{const a=this.props.frames[h].fields[p];if(a.display){const v=a.display(m);if(v.color)return v.color}return n.F},this.prepConfig=(h,p,m)=>{this.panelContext=this.context;const{eventBus:a,sync:v}=this.panelContext;return(0,i.iE)({frame:h,getTimeRange:m,eventBus:a,sync:v,allFrames:this.props.frames,...this.props,timeZones:Array.isArray(this.props.timeZone)?this.props.timeZone:[this.props.timeZone],rowHeight:h.fields.length>2?this.props.rowHeight:1,getValueColor:this.getValueColor,hoverMulti:this.props.tooltip?.mode===s.$N.Multi})},this.renderLegend=h=>{const{legend:p,legendItems:m}=this.props;return!h||!m||!p||p.showLegend===!1?null:t.createElement(r.KU.Legend,{placement:p.placement},t.createElement(g.t,{placement:p.placement,items:m,displayMode:p.displayMode,readonly:!0}))}}render(){return t.createElement(c.o,{...this.props,fields:{x:h=>h.type===o.PU.time,y:h=>h.type===o.PU.number||h.type===o.PU.boolean||h.type===o.PU.string||h.type===o.PU.enum},prepConfig:this.prepConfig,propsToDiff:l,renderLegend:this.renderLegend})}}f.contextType=u.e4},28895:(Q,A,e)=>{"use strict";e.d(A,{pm:()=>U,GY:()=>ee,c5:()=>re,jY:()=>k,EI:()=>K,iE:()=>H,Qe:()=>_,Or:()=>j});var t=e(24293),n=e(28240),o=e(83195),s=e(69129),r=e(94624),g=e(11261),u=e(50082),c=e(58563),i=e(47737),l=e(73060),f=e(46294),d=e(39624),h=e(73134),p=e(52622),m=e(51336),a=e(52811),v=e(16895),E=e(36613),D=e(23596),b=e(39758),C=e(4134);const{round:y,min:M,ceil:T}=Math,I=2;let x=6;const S=b.ur;function O(J,ne,q,te,oe){(0,b.mn)(q,J,S,ne,(ue,ie,ge)=>{let he=te*ie,De=te*ge;oe(ue,he,De)})}function P(J){const{mode:ne,numSeries:q,isDiscrete:te,hasMappedNull:oe,rowHeight:ue=0,colWidth:ie=0,showValue:ge,mergeValues:he=!1,theme:De,label:pe,formatValue:le,alignValue:Te="left",getTimeRange:Ee,getValueColor:Re,getFieldConfig:me,onHover:Me,onLeave:ye,hoverMulti:Le}=J;let We,Be;const Ye=nt=>{Be=Array(q).fill(null).map(pt=>Array(nt).fill(null))},at=`500 ${Math.round(12*devicePixelRatio)}px ${De.typography.fontFamily}`,st=Array(q).fill(null);let Ke=null;const Xe=[ie,1/0],He=1-Xe[0],Ge=(Xe[1]??1/0)*E.A.pxRatio,xe=new Map,$e=new Map;function be(nt){xe.forEach((pt,mt)=>{nt.fillStyle=mt,nt.fill(pt)}),$e.forEach((pt,mt)=>{nt.strokeStyle=mt,nt.stroke(pt)}),xe.clear(),$e.clear()}function Z(nt,pt,mt,gt,Pt,Mt,Yt,zt,_t,rt,It,Dn,ft){Yt=Math.max(1,Yt);const yt=Re(rt+1,Dn),jt=me(rt),cn=L(jt,yt);if(Be[rt][It]={x:y(Pt-mt),y:y(Mt-gt),w:Yt,h:zt,sidx:rt+1,didx:It,fillColor:cn},ft){let pn=cn,on=xe.get(pn);if(on==null&&xe.set(pn,on=new Path2D),pt(on,Pt,Mt,Yt,zt),_t){let Xt=yt,fn=$e.get(Xt);fn==null&&$e.set(Xt,fn=new Path2D),pt(fn,Pt+_t/2,Mt+_t/2,Yt-_t,zt-_t)}}else nt.beginPath(),pt(nt,Pt,Mt,Yt,zt),nt.fillStyle=cn,nt.fill(),_t&&(nt.beginPath(),pt(nt,Pt+_t/2,Mt+_t/2,Yt-_t,zt-_t),nt.strokeStyle=yt,nt.lineWidth=_t,nt.stroke())}const ae=(nt,pt,mt,gt)=>(E.A.orient(nt,pt,(Pt,Mt,Yt,zt,_t,rt,It,Dn,ft,yt,jt,cn,pn,on)=>{let Xt=y((Pt.width||0)*E.A.pxRatio),fn=te(pt),An=fn&&oe(pt);nt.ctx.save(),on(nt.ctx,nt.bbox.left,nt.bbox.top,nt.bbox.width,nt.bbox.height),nt.ctx.clip(),O(ue,pt-1,q,jt,(hn,ca,Rt)=>{if(ne===U.Changes)for(let qt=0;qt<Yt.length;qt++){let gn=Yt[qt];if(gn!=null||An){let Cn=Math.round(rt(Mt[qt],zt,yt,Dn)),mn=qt;for(;++mn<Yt.length&&(Yt[mn]===void 0||he&&Yt[mn]===gn););let Sn=mn===Yt.length?Dn+yt+Xt:Math.round(rt(Mt[mn],zt,yt,Dn));Z(nt.ctx,on,Dn,ft,Cn,y(ft+ca),Sn-Cn,y(Rt),Xt,hn,qt,gn,fn),qt=mn-1}}else if(ne===U.Samples){let qt=rt(Mt[1],zt,yt,Dn)-rt(Mt[0],zt,yt,Dn),gn=qt*He,Cn=y(M(Ge,qt-gn)-Xt),mn=Cn/2;for(let Sn=mt;Sn<=gt;Sn++){let Tn=Yt[Sn];if(Tn!=null||An){let $n=rt(Mt[Sn],zt,yt,Dn);Z(nt.ctx,on,Dn,ft,y($n-mn),y(ft+ca),Cn,y(Rt),Xt,hn,Sn,Tn,fn)}}}}),fn&&(nt.ctx.lineWidth=Xt,be(nt.ctx)),nt.ctx.restore()}),null),de=le==null||ge===p.yL.Never?!1:(nt,pt,mt,gt)=>(nt.ctx.save(),nt.ctx.rect(nt.bbox.left,nt.bbox.top,nt.bbox.width,nt.bbox.height),nt.ctx.clip(),nt.ctx.font=at,nt.ctx.textAlign=ne===U.Changes?Te:"center",nt.ctx.textBaseline="middle",E.A.orient(nt,pt,(Pt,Mt,Yt,zt,_t,rt,It,Dn,ft,yt,jt)=>{let cn=y((Pt.width||0)*E.A.pxRatio),on=te(pt)&&oe(pt),Xt=y(ft+Ve[pt-1]);for(let fn=0;fn<Yt.length;fn++)if(Yt[fn]!=null||on){const An=Be[pt-1][fn];if(!An||An.x>=yt)continue;let hn=Math.floor(An?.w/x);if(ge===p.yL.Auto&&hn<2)continue;let ca=le(pt,Yt[fn]),Rt=y(An.x+Dn+An.w/2);ne===U.Changes&&(Te==="left"?Rt=y(An.x+Dn+cn+I):Te==="right"&&(Rt=y(An.x+Dn+An.w-cn-I))),nt.ctx.fillStyle=De.colors.getContrastText(An.fillColor,3),nt.ctx.fillText(ca.slice(0,hn),Rt,Xt)}}),nt.ctx.restore(),!1),ve=nt=>{let pt="";for(let mt=32;mt<=126;mt++)pt+=String.fromCharCode(mt);x=Math.ceil(nt.ctx.measureText(pt).width/pt.length*E.A.pxRatio),x+=2.5,nt.root.querySelectorAll(".u-cursor-pt").forEach(mt=>{mt.style.borderRadius="0"})},Ue=nt=>{We=We||new C.C$(0,0,nt.bbox.width,nt.bbox.height),We.clear(),Ye(nt.data[0].length),nt.series.forEach(pt=>{pt._paths=null})};function _e(nt,pt,mt){if(st.fill(null),Ke=null,!(nt<0))for(let gt=0;gt<mt.length;gt++){let Pt=mt[gt];We.get(nt,Pt,1,1,Mt=>{(0,C.ur)(nt,Pt,Mt.x,Mt.y,Mt.x+Mt.w,Mt.y+Mt.h)&&(st[Mt.sidx]=Mt,Math.abs(pt-Pt)<=Mt.h/2&&(Ke=Mt))})}}const ze={x:ne===U.Changes,y:!1,dataIdx:(nt,pt)=>{if(pt===1){if(We.o.length===0&&We.q==null)for(const Mt of Be)for(const Yt of Mt)Yt&&We.add(Yt);let mt=nt.cursor.left*E.A.pxRatio,gt=nt.cursor.top*E.A.pxRatio,Pt=Ke;_e(mt,gt,Le?Ve:[gt]),Ke!=null?Ke!==Pt&&Me(Ke.sidx,Ke.didx,Ke):Pt!=null&&ye()}return st[pt]?.didx},focus:{prox:1e3,dist:(nt,pt)=>Ke?.sidx===pt?0:1/0},points:{fill:"rgba(255,255,255,0.2)",bbox:(nt,pt)=>{let mt=st[pt],gt=mt!=null;return{left:gt?mt.x/E.A.pxRatio:-10,top:gt?mt.y/E.A.pxRatio:-10,width:gt?mt.w/E.A.pxRatio:0,height:gt?mt.h/E.A.pxRatio:0}}}},Ve=Array(q).fill(0),Ne=Array(q).fill(0),ot=[0,1];return{cursor:ze,xSplits:ne===U.Samples?(nt,pt,mt,gt,Pt,Mt)=>{let Yt=[],zt=nt.data[0][1]-nt.data[0][0],_t=T(Pt/zt);for(let rt=0;rt<nt.data[0].length;rt+=_t){let It=nt.data[0][rt];It>=mt&&It<=gt&&Yt.push(It)}return Yt}:null,xRange:nt=>{const pt=Ee();let mt=pt.from.valueOf(),gt=pt.to.valueOf();if(ne===U.Samples){let Yt=(nt.data[0][1]-nt.data[0][0])/2;mt<=nt.data[0][0]&&(mt=nt.data[0][0]-Yt);let zt=nt.data[0].length-1;gt>=nt.data[0][zt]&&(gt=nt.data[0][zt]+Yt)}return[mt,gt]},ySplits:nt=>(O(ue,null,q,nt.bbox.height,(pt,mt,gt)=>{Ve[pt]=y(mt+gt/2),Ne[pt]=nt.posToVal(Ve[pt]/E.A.pxRatio,a.s)}),Ne),yValues:(nt,pt)=>pt.map((mt,gt)=>pe(gt+1)),yRange:ot,drawPaths:ae,drawPoints:de,init:ve,drawClear:Ue}}function L(J,ne){if(ne[0]==="#"&&ne.length===9)return ne;const q=(J.fillOpacity??100)/100;return(0,D.alpha)(ne,q)}var U=(J=>(J.Changes="changes",J.Samples="samples",J))(U||{});const R={lineWidth:0,fillOpacity:80};function B(J){return J.ctrlKey||J.metaKey||J.shiftKey?SeriesVisibilityChangeMode.AppendToSelection:SeriesVisibilityChangeMode.ToggleSelection}const H=({frame:J,theme:ne,timeZones:q,getTimeRange:te,mode:oe,eventBus:ue,sync:ie,rowHeight:ge,colWidth:he,showValue:De,alignValue:pe,mergeValues:le,getValueColor:Te,eventsScope:Ee="__global_",hoverMulti:Re})=>{const me=new m.e(q[0]),Me="time",ye="x",Le=Z=>{const ae=Z.config?.color?.mode;return!(ae&&Z.display&&ae.startsWith("continuous-"))},We=Z=>Z.config.mappings?.some(ae=>ae.type===h.dM.SpecialValue&&ae.options.match==="null")||!1,Be=(Z,ae)=>{const de=J.fields[Z];return de.state?.origin?.fieldIndex!==void 0&&de.state?.origin?.frameIndex!==void 0&&Te?Te(de.state?.origin?.frameIndex,de.state?.origin?.fieldIndex,ae):t.F},Ye={mode:oe,numSeries:J.fields.length-1,isDiscrete:Z=>Le(J.fields[Z]),hasMappedNull:Z=>We(J.fields[Z]),mergeValues:le,rowHeight:ge,colWidth:he,showValue:De,alignValue:pe,theme:ne,label:Z=>(0,n.Ct)(J.fields[Z],J),getFieldConfig:Z=>J.fields[Z].config.custom,getValueColor:Be,getTimeRange:te,formatValue:(Z,ae)=>(0,o.cN)(J.fields[Z].display(ae)),onHover:(Z,ae)=>{st=Z,Ke=ae,at=!0},onLeave:()=>{st=null,Ke=null,at=!0},hoverMulti:Re};let at=!1,st=null,Ke=null;const Xe=P(Ye),He={point:{[Me]:null,[a.s]:null},data:J},Ge=new s.b_(He).setTags(["uplot"]),xe=new s.ql().setTags(["uplot"]);me.addHook("init",Xe.init),me.addHook("drawClear",Xe.drawClear);const $e=(Z,ae,de)=>{at&&(st!=null&&(Z(st),ae(Ke)),at=!1),de(st==null)};me.setTooltipInterpolator($e),me.setPrepData(Z=>(0,v.bq)(Z[0],(0,v.ro)(Z[0]))),me.setCursor(Xe.cursor),me.addScale({scaleKey:ye,isTime:!0,orientation:p.Lt.Horizontal,direction:p.ON.Right,range:Xe.xRange}),me.addScale({scaleKey:a.s,isTime:!1,orientation:p.Lt.Vertical,direction:p.ON.Up,range:Xe.yRange}),me.addAxis({scaleKey:ye,isTime:!0,splits:Xe.xSplits,placement:p.vM.Bottom,timeZone:q[0],theme:ne,grid:{show:!0}}),me.addAxis({scaleKey:a.s,isTime:!1,placement:p.vM.Left,splits:Xe.ySplits,values:Xe.yValues,grid:{show:!1},ticks:{show:!1},gap:16,theme:ne});let be=0;for(let Z=0;Z<J.fields.length;Z++){if(Z===0)continue;const ae=J.fields[Z],de=ae.config,ve={...R,...de.custom};ae.state.seriesIndex=be++,me.addSeries({scaleKey:a.s,pathBuilder:Xe.drawPaths,pointsBuilder:Xe.drawPoints,lineWidth:ve.lineWidth,fillOpacity:ve.fillOpacity,theme:ne,show:!ve.hideFrom?.viz,thresholds:de.thresholds,dataFrameFieldIndex:ae.state?.origin})}if(ie&&ie()!==r.y.Off){let Z={};Z.sync={key:Ee,filters:{pub:(ae,de,ve,Ue,_e,ze,Ve)=>ie&&ie()===r.y.Off?!1:(He.rowIndex=Ve,ve<0&&Ue<0?ue.publish(xe):(He.point[Me]=de.posToVal(ve,ye),He.point.panelRelY=Ue>0?Ue/ze:1,He.down=void 0,ue.publish(Ge)),!0)},scales:[ye,null]},me.setSync(),me.setCursor(Z)}return me};function w(J){const ne=new Map;for(let q=0;q<J.fields.length;q++)ne.set(getFieldDisplayName(J.fields[q],J),q);return ne}function N(J){let ne=J[0],q;for(let te=1;te<J.length;te++){let oe=J[te];oe===null?ne=null:oe===ne?(q||(q=[...J]),q[te]=void 0):oe!=null&&(ne=oe)}return q}function V(J){let ne=J.config.custom?.spanNulls;return ne?ne===!0?1/0:ne:-1}function G(J,ne){const q=J.config.thresholds;if(J.type!==g.PU.number||!q||!q.steps.length)return;const te=K(J.config,ne);if(te.length!==q.steps.length)return;const oe=new Map,ue=new Map;for(let he=0;he<te.length;he++)oe.set(q.steps[he],te[he].label),ue.set(te[he].label,te[he].color);let ie=J.values;const ge=new Array(J.values.length);if(q.mode===u.O.Percentage){const{min:he,max:De}=(0,c.xg)(J),pe=De-he;ie=ie.map(le=>le==null?le:(le-he)/pe*100)}for(let he=0;he<ge.length;he++){const De=ie[he];De==null?ge[he]=De:ge[he]=oe.get((0,i.yQ)(De,q.steps))}return{...J,config:{...J.config,custom:{...J.config.custom,spanNulls:V(J)}},type:g.PU.string,values:ge,display:he=>({text:String(he),color:ue.get(String(he)),numeric:NaN})}}function _(J,ne,q,te){if(!J?.length)return{warn:"No data in response"};let oe=!1;const ue=[];for(let ie of J){let ge=!1,he=!1,De=(0,l.Yj)(ie,ie.fields.findIndex(Te=>Te.type===g.PU.time)),pe=(0,f.M)({frame:De,refFieldPseudoMin:q.from.valueOf(),refFieldPseudoMax:q.to.valueOf()});pe!==ie&&(he=!0);const le=[];for(let Te of(0,d.C)(pe).fields)if(!Te.config.custom?.hideFrom?.viz)switch(Te.type){case g.PU.time:ge=!0,oe=!0,le.push(Te);break;case g.PU.enum:case g.PU.number:if(ne&&Te.config.color?.mode===t.Y.Thresholds){const Ee=G(Te,te);if(Ee){le.push(Ee),he=!0;continue}}case g.PU.boolean:case g.PU.string:Te={...Te,config:{...Te.config,custom:{...Te.config.custom,spanNulls:V(Te)}}},le.push(Te);break;default:he=!0}ge&&le.length>1&&(oe=!0,he?ue.push({...De,fields:le}):ue.push(De))}return oe?ue.length?{frames:ue}:{warn:"No graphable fields"}:{warn:"Data does not have a time field"}}function K(J,ne){const q=[],te=J.thresholds;if(!te||!te.steps.length)return q;const oe=te.steps,ue=(0,o.j_)(te.mode===u.O.Percentage?"percent":J.unit??""),ie=ge=>(0,o.cN)(ue(ge,J.decimals??void 0));for(let ge=0;ge<oe.length;ge++){let he=oe[ge],De=he.value,pe="",le="";De===-1/0&&ge<oe.length-1?(De=oe[ge+1].value,pe="< "):le="+",q.push({label:`${pe}${ie(De)}${le}`,color:ne.visualization.getColorByName(he.color),yAxis:1})}return q}function j(J,ne,q){if(!(!J||ne.showLegend===!1))return k(Y(J),q)}function k(J,ne){if(!J.length)return;const q=[],te=J[0].config,oe=te.color?.mode??t.Y.Fixed,ue=te.thresholds;if(oe===t.Y.Thresholds&&ue?.steps&&ue.steps.length>1)return K(te,ne);if(oe.startsWith("continuous"))return;const ie=new Map;return J.forEach(ge=>{ge.config.custom?.hideFrom?.legend||ge.values.forEach(he=>{let De=ge.display(he);De.color&&ie.set(De.text,De.color)})}),ie.forEach((ge,he)=>{he.length>0&&q.push({label:he,color:ne.visualization.getColorByName(ge??t.F),yAxis:1})}),q}function Y(J){const ne=[];for(const q of J)for(const te of q.fields)te.type!==g.PU.time&&ne.push(te);return ne}function ee(J,ne){let q,te=ne+1;if(te>=J.values.length)return null;const oe=J.values[ne];for(;q===void 0;){if(te>=J.values.length)return null;const ue=J.values[te];ue===void 0||ue===oe?te++:q=te}return q}function re(J){if(J<0||Number.isNaN(J))return"";let ne,q,te,oe,ue,ie,ge,he;return ge=Math.floor(J/1e3),ie=Math.floor(ge/60),ge=ge%60,ue=Math.floor(ie/60),ie=ie%60,oe=Math.floor(ue/24),ue=ue%24,ne=Math.floor(oe/365),ne>0&&(oe=oe%365),q=Math.floor(oe/30),q>0&&(oe=oe%30),te=Math.floor(oe/7),te>0&&(oe=oe%7),he=Math.round(J%1e3*1e3)/1e3,(ne>0?ne+"y "+(q>0?q+"mo ":"")+(te>0?te+"w ":"")+(oe>0?oe+"d ":""):q>0?q+"mo "+(te>0?te+"w ":"")+(oe>0?oe+"d ":""):te>0?te+"w "+(oe>0?oe+"d ":""):oe>0?oe+"d "+(ue>0?ue+"h ":""):ue>0?ue+"h "+(ie>0?ie+"m ":""):ie>0?ie+"m "+(ge>0?ge+"s ":""):ge>0?ge+"s "+(he>0?he+"ms ":""):he>0?he+"ms ":"0").trim()}},76323:(Q,A,e)=>{"use strict";e.d(A,{J:()=>r});var t=e(32196),n=e(96540),o=e(14110),s=e(40845);const r=({text:u="PRO",className:c,experimentId:i,eventVariant:l="",...f})=>{const d=(0,s.of)(g);return(0,n.useEffect)(()=>{i&&(0,o.Xp)(i,"test",l)},[i,l]),n.createElement("span",{className:(0,t.cx)(d.badge,c),...f},u)},g=u=>({badge:(0,t.css)` margin-left: ${u.spacing(1.25)}; border-radius: ${u.shape.borderRadius(5)}; background-color: ${u.colors.success.main}; padding: ${u.spacing(.25,.75)}; color: white; // use the same color for both themes font-weight: ${u.typography.fontWeightMedium}; font-size: ${u.typography.pxToRem(10)}; `})},93522:(Q,A,e)=>{"use strict";e.d(A,{N:()=>c});var t=e(32196),n=e(96540),o=e(40845),s=e(37390),r=e(44836),g=e(63917);const u=l=>[{category:(0,r.t)("help-modal.shortcuts-category.global","Global"),shortcuts:[{keys:["g","h"],description:(0,r.t)("help-modal.shortcuts-description.go-to-home-dashboard","Go to Home Dashboard")},{keys:["g","d"],description:(0,r.t)("help-modal.shortcuts-description.go-to-dashboards","Go to Dashboards")},{keys:["g","e"],description:(0,r.t)("help-modal.shortcuts-description.go-to-explore","Go to Explore")},{keys:["g","p"],description:(0,r.t)("help-modal.shortcuts-description.go-to-profile","Go to Profile")},{keys:[`${l} + k`],description:(0,r.t)("help-modal.shortcuts-description.open-search","Open search")},{keys:["esc"],description:(0,r.t)("help-modal.shortcuts-description.exit-edit/setting-views","Exit edit/setting views")},{keys:[`${l} + h`],description:(0,r.t)("help-modal.shortcuts-description.show-all-shortcuts","Show all keyboard shortcuts")},{keys:["c","t"],description:(0,r.t)("help-modal.shortcuts-description.change-theme","Change theme")}]},{category:(0,r.t)("help-modal.shortcuts-category.dashboard","Dashboard"),shortcuts:[{keys:[`${l}+s`],description:(0,r.t)("help-modal.shortcuts-description.save-dashboard","Save dashboard")},{keys:["d","r"],description:(0,r.t)("help-modal.shortcuts-description.refresh-all-panels","Refresh all panels")},{keys:["d","s"],description:(0,r.t)("help-modal.shortcuts-description.dashboard-settings","Dashboard settings")},{keys:["d","v"],description:(0,r.t)("help-modal.shortcuts-description.toggle-active-mode","Toggle in-active / view mode")},{keys:["d","k"],description:(0,r.t)("help-modal.shortcuts-description.toggle-kiosk","Toggle kiosk mode (hides top nav)")},{keys:["d","E"],description:(0,r.t)("help-modal.shortcuts-description.expand-all-rows","Expand all rows")},{keys:["d","C"],description:(0,r.t)("help-modal.shortcuts-description.collapse-all-rows","Collapse all rows")},{keys:["d","a"],description:(0,r.t)("help-modal.shortcuts-description.toggle-auto-fit","Toggle auto fit panels (experimental feature)")},{keys:[`${l} + o`],description:(0,r.t)("help-modal.shortcuts-description.toggle-graph-crosshair","Toggle shared graph crosshair")},{keys:["d","l"],description:(0,r.t)("help-modal.shortcuts-description.toggle-all-panel-legends","Toggle all panel legends")},{keys:["d","x"],description:(0,r.t)("help-modal.shortcuts-description.toggle-exemplars","Toggle exemplars in all panel")}]},{category:(0,r.t)("help-modal.shortcuts-category.focused-panel","Focused Panel"),shortcuts:[{keys:["e"],description:(0,r.t)("help-modal.shortcuts-description.toggle-panel-edit","Toggle panel edit view")},{keys:["v"],description:(0,r.t)("help-modal.shortcuts-description.toggle-panel-fullscreen","Toggle panel fullscreen view")},{keys:["p","s"],description:(0,r.t)("help-modal.shortcuts-description.open-shared-modal","Open Panel Share Modal")},{keys:["p","d"],description:(0,r.t)("help-modal.shortcuts-description.duplicate-panel","Duplicate Panel")},{keys:["p","r"],description:(0,r.t)("help-modal.shortcuts-description.remove-panel","Remove Panel")},{keys:["p","l"],description:(0,r.t)("help-modal.shortcuts-description.toggle-panel-legend","Toggle panel legend")}]},{category:(0,r.t)("help-modal.shortcuts-category.time-range","Time Range"),shortcuts:[{keys:["t","z"],description:(0,r.t)("help-modal.shortcuts-description.zoom-out-time-range","Zoom out time range")},{keys:["t","\u2190"],description:(0,r.t)("help-modal.shortcuts-description.move-time-range-back","Move time range back")},{keys:["t","\u2192"],description:(0,r.t)("help-modal.shortcuts-description.move-time-range-forward","Move time range forward")},{keys:["t","a"],description:(0,r.t)("help-modal.shortcuts-description.make-time-range-permanent","Make time range absolute/permanent")},{keys:["t","c"],description:(0,r.t)("help-modal.shortcuts-description.copy-time-range","Copy time range")},{keys:["t","v"],description:(0,r.t)("help-modal.shortcuts-description.paste-time-range","Paste time range")}]}],c=({onDismiss:l})=>{const f=(0,o.of)(i),d=(0,n.useMemo)(()=>(0,g.gn)(),[]),h=(0,n.useMemo)(()=>u(d),[d]);return n.createElement(s.a,{title:(0,r.t)("help-modal.title","Shortcuts"),isOpen:!0,onDismiss:l,onClickBackdrop:l},n.createElement("div",{className:f.categories},Object.values(h).map(({category:p,shortcuts:m},a)=>n.createElement("div",{className:f.shortcutCategory,key:a},n.createElement("table",{className:f.shortcutTable},n.createElement("tbody",null,n.createElement("tr",null,n.createElement("th",{className:f.shortcutTableCategoryHeader,colSpan:2},p)),m.map((v,E)=>n.createElement("tr",{key:`${a}-${E}`},n.createElement("td",{className:f.shortcutTableKeys},v.keys.map((D,b)=>n.createElement("span",{className:f.shortcutTableKey,key:`${a}-${E}-${b}`},D))),n.createElement("td",{className:f.shortcutTableDescription},v.description)))))))))};function i(l){return{titleDescription:(0,t.css)({fontSize:l.typography.bodySmall.fontSize,fontWeight:l.typography.bodySmall.fontWeight,color:l.colors.text.disabled,paddingBottom:l.spacing(2)}),categories:(0,t.css)({fontSize:l.typography.bodySmall.fontSize,display:"flex",flexFlow:"row wrap",justifyContent:"space-between",alignItems:"flex-start"}),shortcutCategory:(0,t.css)({width:"50%",fontSize:l.typography.bodySmall.fontSize}),shortcutTable:(0,t.css)({marginBottom:l.spacing(2)}),shortcutTableCategoryHeader:(0,t.css)({fontWeight:"normal",fontSize:l.typography.h6.fontSize,textAlign:"left"}),shortcutTableDescription:(0,t.css)({textAlign:"left",color:l.colors.text.disabled,width:"99%",padding:l.spacing(1,2)}),shortcutTableKeys:(0,t.css)({whiteSpace:"nowrap",width:"1%",textAlign:"right",color:l.colors.text.primary}),shortcutTableKey:(0,t.css)({display:"inline-block",textAlign:"center",marginRight:l.spacing(.5),padding:"3px 5px",font:"11px Consolas, 'Liberation Mono', Menlo, Courier, monospace",lineHeight:"10px",verticalAlign:"middle",border:`solid 1px ${l.colors.border.medium}`,borderRadius:l.shape.radius.default,color:l.colors.text.primary,backgroundColor:l.colors.background.secondary})}}},2913:(Q,A,e)=>{"use strict";e.d(A,{$W:()=>n.$,Ay:()=>s,yn:()=>u,zj:()=>r});var t=e(43429),n=e(32264);let o=n.$;const s=o,r=()=>o,g=c=>{o={...o,...c}},u=n.$.panels?.debug?.state===t.pn.alpha},15054:(Q,A,e)=>{"use strict";e.d(A,{FG:()=>d,HG:()=>r,IZ:()=>l,MM:()=>p,Pz:()=>s,bJ:()=>u,cV:()=>o,cx:()=>c,dU:()=>n,o9:()=>g,sD:()=>t,tH:()=>i,wV:()=>h});const t=30,n=8,o=24,s="v",r="h",g=4,u=250,c=t*3,i="panel-copy",l=2,f=23763571993,d=40,h="VisualizationSelectPane.ListMode",p="WidgetSelectPane.ListMode"},76888:(Q,A,e)=>{"use strict";e.d(A,{Il:()=>s,YE:()=>o,ni:()=>r});var t=e(96540),n=e(12131);const o=t.createContext(void 0);function s(){const g=(0,t.useContext)(o);if(!g)throw new Error("No GrafanaContext found");return g}function r(){const{chrome:g}=s();return(0,t.useCallback)((u,c)=>{const{pathname:i,search:l}=n.Ny.getLocation();g.setReturnToPrevious({title:u,href:c??i+l})},[g])}},3169:(Q,A,e)=>{"use strict";e.d(A,{_2:()=>d,gi:()=>l,q8:()=>f,tZ:()=>i});var t=e(96540),n=e(62938),o=e(94954),s=e(80348),r=e(82467);const g={title:"",text:"",severity:s.AppNotificationSeverity.Success,icon:"check"},u={title:"",text:"",severity:s.AppNotificationSeverity.Warning,icon:"exclamation-triangle"},c={title:"",text:"",severity:s.AppNotificationSeverity.Error,icon:"exclamation-triangle"},i=(h,p="",m)=>({...g,title:h,text:p,id:(0,n.A)(),timestamp:Date.now(),showing:!0}),l=(h,p="",m,a)=>({...c,text:(0,o.q)(p),title:h,id:(0,n.A)(),traceId:m,component:a,timestamp:Date.now(),showing:!0}),f=(h,p="",m)=>({...u,title:h,text:p,traceId:m,id:(0,n.A)(),timestamp:Date.now(),showing:!0});function d(){const h=(0,s.useDispatch)();return(0,t.useMemo)(()=>({success:(p,m="")=>{h((0,r.dx)(i(p,m)))},warning:(p,m="",a)=>{h((0,r.dx)(f(p,m,a)))},error:(p,m="",a)=>{h((0,r.dx)(l(p,m,a)))}}),[h])}},10096:(Q,A,e)=>{"use strict";e.d(A,{Ef:()=>n.E,TP:()=>o.TP,lE:()=>t.A,rO:()=>s.r});var t=e(28138),n=e(18898),o=e(16233),s=e(31140)},53919:(Q,A,e)=>{"use strict";e.d(A,{$H:()=>a,Ay:()=>v});var t=e(2543),n=e(33390),o=e(38877),s=e(19347);const r=x=>{const S=(0,s.l)().getInstanceSettings(x.datasourceName);return{id:x.ts.toString(),createdAt:x.ts,datasourceName:x.datasourceName,datasourceUid:S?.uid||"",starred:x.starred,comment:x.comment,queries:x.queries}},g=x=>{if(!(0,s.l)().getInstanceSettings({uid:x.datasourceUid}))throw new Error("Datasource not found.");return{ts:x.createdAt,datasourceName:x.datasourceName,starred:x.starred,comment:x.comment,queries:x.queries}};var u=e(91650);function c(x,S,O,P,L){const U=f(x,O),R=d(U,P),B=L?l(R,L):R;return h(B,S)}const i=(x,S)=>{const O=new Date,P=new Date(O.setDate(O.getDate()-x));return S?P.setHours(24,0,0,0):P.setHours(0,0,0,0)};function l(x,S){const O=i(S[0],!0),P=i(S[1],!1);return x.filter(L=>L.createdAt<O&&L.createdAt>P)}function f(x,S){return S.length>0?x.filter(O=>S.includes(O.datasourceName)):x}function d(x,S){return x.filter(O=>O.comment.includes(S)?!0:O.queries.filter(L=>Object.values((0,t.omit)(L,["datasource","key","refId","hide","queryType"])).some(U=>U?.toString().includes(S))).length>0)}const h=(x,S)=>{let O;return S===u.x.Ascending&&(O=(P,L)=>P.createdAt<L.createdAt?-1:P.createdAt>L.createdAt?1:0),S===u.x.Descending&&(O=(P,L)=>P.createdAt<L.createdAt?1:P.createdAt>L.createdAt?-1:0),S===u.x.DatasourceZA&&(O=(P,L)=>P.datasourceName<L.datasourceName?-1:P.datasourceName>L.datasourceName?1:0),S===u.x.DatasourceAZ&&(O=(P,L)=>P.datasourceName<L.datasourceName?1:P.datasourceName>L.datasourceName?-1:0),x.sort(O)},p={retentionPeriod:"grafana.explore.richHistory.retentionPeriod",starredTabAsFirstTab:"grafana.explore.richHistory.starredTabAsFirstTab",activeDatasourceOnly:"grafana.explore.richHistory.activeDatasourceOnly",datasourceFilters:"grafana.explore.richHistory.datasourceFilters"},m="grafana.explore.richHistory",a=1e4;class v{async getRichHistory(S){const O=C().map(r),P=S.starred?O.filter(U=>U.starred===!0):O,L=c(P,S.sortOrder,S.datasourceFilters,S.search,[S.from,S.to]);return{richHistory:L,total:L.length}}async addToRichHistory(S){const O=Date.now(),P={id:O.toString(),createdAt:O,...S},L=g(P),U=D(C()),R=L.queries.map(V=>(0,t.omit)(V,["key","refId"])),B=U.length>0&&U[0].queries.map(V=>(0,t.omit)(V,["key","refId"]));if((0,t.isEqual)(R,B)){const V=new Error("Entry already exists");throw V.name=o.m.DuplicatedEntry,V}const{queriesToKeep:H,limitExceeded:w}=b(U),N=[L,...H];try{n.A.setObject(m,N)}catch(V){if(V instanceof Error&&V.name==="QuotaExceededError")I(o.m.StorageFull,`Saving rich history failed: ${V.message}`);else throw V}return w?{warning:{type:o.C.LimitExceeded,message:`Query history reached the limit of ${a}. Old, not-starred items have been removed.`},richHistoryQuery:P}:{richHistoryQuery:P}}async deleteAll(){n.A.delete(m)}async deleteRichHistory(S){const O=parseInt(S,10),L=n.A.getObject(m,[]).filter(U=>U.ts!==O);n.A.setObject(m,L)}async updateStarred(S,O){return E(S,P=>P.starred=O)}async updateComment(S,O){return E(S,P=>P.comment=O)}async getSettings(){return{activeDatasourceOnly:n.A.getObject(p.activeDatasourceOnly,!1),retentionPeriod:n.A.getObject(p.retentionPeriod,7),starredTabAsFirstTab:n.A.getBool(p.starredTabAsFirstTab,!1),lastUsedDatasourceFilters:n.A.getObject(p.datasourceFilters,[]).map(S=>S.value)}}async updateSettings(S){n.A.set(p.activeDatasourceOnly,S.activeDatasourceOnly),n.A.set(p.retentionPeriod,S.retentionPeriod),n.A.set(p.starredTabAsFirstTab,S.starredTabAsFirstTab),n.A.setObject(p.datasourceFilters,(S.lastUsedDatasourceFilters||[]).map(O=>({value:O})))}}function E(x,S){const O=parseInt(x,10),P=n.A.getObject(m,[]),L=(0,t.find)(P,{ts:O});if(!L)throw new Error("Rich history item not found.");return S(L),n.A.setObject(m,P),r(L)}function D(x){const S=n.A.getObject(p.retentionPeriod,7),O=i(S,!1);return x.filter(P=>P.ts>O||P.starred===!0)||[]}function b(x){let S=!1,O=x.length-1;for(;O>=0&&x.length>=a;)x[O].starred||(x.splice(O,1),S=!0),O--;return{queriesToKeep:x,limitExceeded:S}}function C(){const x=n.A.getObject(m,[]);return y(x)}function y(x){return x.map(O=>{const P=O.queries.map((L,U)=>M(O,L,U));return{...O,queries:P}})}function M(x,S,O){const P="ABCDEFGHIJKLMNOPQRSTUVXYZ";return typeof S=="object"?S:T(S)?JSON.parse(S):{expr:S,refId:P[O]}}function T(x){try{JSON.parse(x)}catch{return!1}return!0}function I(x,S){const O=new Error(S);throw O.name=x,O}},38877:(Q,A,e)=>{"use strict";e.d(A,{C:()=>n,m:()=>t});var t=(o=>(o.StorageFull="StorageFull",o.DuplicatedEntry="DuplicatedEntry",o))(t||{}),n=(o=>(o.LimitExceeded="LimitExceeded",o))(n||{})},11401:(Q,A,e)=>{"use strict";e.d(A,{a:()=>m,g:()=>a});var t=e(32264),n=e(10096),o=e(91650),s=e(53919),r=e(75505),g=e(17172),u=e(19347),c=e(65615);const i=v=>{const E=(0,u.l)().getInstanceSettings({uid:v.datasourceUid});return{id:v.uid,createdAt:v.createdAt*1e3,datasourceName:E?.name||"",datasourceUid:v.datasourceUid,starred:v.starred,comment:v.comment,queries:v.queries}},l=v=>({uid:v.id,createdAt:Math.floor(v.createdAt/1e3),datasourceUid:v.datasourceUid,starred:v.starred,comment:v.comment,queries:v.queries});class f{constructor(){this.preferenceService=new c.W("user")}async addToRichHistory(E){const{result:D}=await(0,g.AI)().post("/api/query-history",{dataSourceUid:E.datasourceUid,queries:E.queries});return{richHistoryQuery:i(D)}}async deleteAll(){throw new Error("not supported")}async deleteRichHistory(E){(0,g.AI)().delete(`/api/query-history/${E}`)}async getRichHistory(E){const D=d(E);let b="query-history-get-all";E.starred&&(b="query-history-get-starred");const y=(await(0,r.s)((0,g.AI)().fetch({method:"GET",url:`/api/query-history?${D}`,requestId:b}))).data,M=(y.result.queryHistory||[]).map(i),T=y.result.totalCount||0;return{richHistory:M,total:T}}async getSettings(){return{activeDatasourceOnly:!1,lastUsedDatasourceFilters:void 0,retentionPeriod:14,starredTabAsFirstTab:(await this.preferenceService.load()).queryHistory?.homeTab==="starred"}}async updateComment(E,D){const b=await(0,g.AI)().patch(`/api/query-history/${E}`,{comment:D});return i(b.result)}updateSettings(E){return this.preferenceService.patch({queryHistory:{homeTab:E.starredTabAsFirstTab?"starred":"query"}})}async updateStarred(E,D){let b;return D?b=await(0,g.AI)().post(`/api/query-history/star/${E}`):b=await(0,g.AI)().delete(`/api/query-history/star/${E}`),i(b.result)}}function d(v){let E=`${v.datasourceFilters.map(D=>{const b=(0,u.l)().getInstanceSettings(D).uid;return`datasourceUid=${encodeURIComponent(b)}`}).join("&")}`;if(v.search&&(E=E+`&searchString=${v.search}`),v.sortOrder&&(E=E+`&sort=${v.sortOrder===o.x.Ascending?"time-asc":"time-desc"}`),!v.starred){const D=v.from===0?"now":`now-${v.from}d`,b=v.to===0?"now":`now-${v.to}d`;E=E+`&to=${D}`,E=E+`&from=${b}`}return E=E+"&limit=100",E=E+`&page=${v.page||1}`,v.starred&&(E=E+`&onlyStarred=${v.starred}`),E}const h=new s.Ay,p=new f,m=()=>t.$.queryHistoryEnabled?p:h,a=()=>t.$.queryHistoryEnabled?{availableFilters:[o.x.Descending,o.x.Ascending],lastUsedDataSourcesAvailable:!1,clearHistory:!1,onlyActiveDataSource:!1,changeRetention:!1,queryHistoryAvailable:n.TP.isSignedIn}:{availableFilters:[o.x.Descending,o.x.Ascending,o.x.DatasourceAZ,o.x.DatasourceZA],lastUsedDataSourcesAvailable:!0,clearHistory:!0,onlyActiveDataSource:!0,changeRetention:!0,queryHistoryAvailable:!0}},16021:(Q,A,e)=>{"use strict";e.d(A,{u:()=>n});var t=e(96540);function n(o,s){const[r,g]=(0,t.useState)();return(0,t.useEffect)(()=>{const u=o.subscribe(s,g);return()=>u.unsubscribe()},[o,s]),r}},60619:(Q,A,e)=>{"use strict";e.d(A,{Y:()=>n});var t=e(96540);function n({breakpoint:o,onChange:s}){(0,t.useEffect)(()=>{const r=window.matchMedia(`(min-width: ${o}px)`),g=u=>s(u);return r.addEventListener("change",g),()=>r.removeEventListener("change",g)},[o,s])}},25249:(Q,A,e)=>{"use strict";e.d(A,{C:()=>o});var t=e(80348),n=e(17422);const o=s=>{const r=(0,t.useSelector)(g=>g.navIndex);return(0,n.tc)(r,s)}},83277:(Q,A,e)=>{"use strict";e.d(A,{s:()=>s});var t=e(96540),n=e(24180),o=e(12131);function s(){const{search:r}=(0,n.zy)(),g=(0,t.useMemo)(()=>(0,o.SE)(r||""),[r]),u=(0,t.useCallback)((c,i)=>o.Ny.partial(c,i),[]);return[g,u]}},74513:(Q,A,e)=>{"use strict";e.d(A,{Yj:()=>c,rd:()=>i});const t="en-US",n="fr-FR",o="es-ES",s="de-DE",r="zh-Hans",g="pseudo-LOCALE",u=null,c=[{code:t,name:"English",loader:()=>e.e(9521).then(e.t.bind(e,19521,19))},{code:n,name:"Fran\xE7ais",loader:()=>e.e(5648).then(e.t.bind(e,35648,19))},{code:o,name:"Espa\xF1ol",loader:()=>e.e(680).then(e.t.bind(e,70680,19))},{code:s,name:"Deutsch",loader:()=>e.e(3082).then(e.t.bind(e,23082,19))},{code:r,name:"\u4E2D\u6587\uFF08\u7B80\u4F53\uFF09",loader:()=>e.e(9538).then(e.t.bind(e,29538,19))}],i=c.map(l=>l.code)},44836:(Q,A,e)=>{"use strict";e.d(A,{JL:()=>i,Xj:()=>p,t:()=>h,x6:()=>f});var t=e(72635),n=e(94997),o=e(96540),s=e(65414),r=e(52822),g=e(74513);const u=m=>m.split("-")[0].toLowerCase(),c={type:"backend",init(){},async read(m,a,v){let E=g.Yj.find(b=>b.code===m);if(E||(E=g.Yj.find(b=>u(b.code)===u(m))),!E)return v(new Error("No message loader available for "+m),null);const D=await E.loader();v(null,D)}};function i(m){const a={partialBundledLanguages:!0,resources:{},returnEmptyString:!1};let v=t.default;if(m==="detect"){v=v.use(n.A);const E={order:["navigator"],caches:[]};a.detection=E}else a.lng=g.rd.includes(m)?m:void 0;return v.use(c).use(s.r9).init(a)}function l(m){const a=VALID_LANGUAGES.includes(m)?m:void 0;return i18n.changeLanguage(a)}const f=m=>o.createElement(r.x,{shouldUnescape:!0,...m}),d=t.default.t,h=(m,a,v)=>d(m,a,v),p=(m,a={})=>typeof m=="string"?p(new Date(m),a):new Intl.DateTimeFormat(t.default.language,a).format(m)},18898:(Q,A,e)=>{"use strict";e.d(A,{E:()=>n});class t{constructor(){this.panelsRendered=0,this.enabled=void 0}renderingCompleted(){this.panelsRendered+=1,window.panelsRendered=this.panelsRendered}}const n=new t},16001:(Q,A,e)=>{"use strict";e.d(A,{$K:()=>m,Do:()=>l,XC:()=>d,XR:()=>f,dx:()=>i,fX:()=>D,g5:()=>p,oF:()=>h,qN:()=>E});var t=e(30038),n=e(1081),o=e(80348);const s=25,r="notifications",g=`${r}/lastRead`,u={byId:M(),lastRead:Number.parseInt(window.localStorage.getItem(g)??`${Date.now()}`,10)},c=(0,t.Z0)({name:"appNotifications",initialState:u,reducers:{notifyApp:(I,{payload:x})=>{Object.values(I.byId).some(S=>b(x,S)&&S.showing)||(I.byId[x.id]=x,T(I.byId))},hideAppNotification:(I,{payload:x})=>{x in I.byId&&(I.byId[x].showing=!1,T(I.byId))},clearNotification:(I,{payload:x})=>{delete I.byId[x],T(I.byId)},clearAllNotifications:I=>{I.byId={},T(I.byId)},readAllNotifications:(I,{payload:x})=>{I.lastRead=x}}}),{notifyApp:i,hideAppNotification:l,clearNotification:f,clearAllNotifications:d,readAllNotifications:h}=c.actions,p=c.reducer,m=I=>I.lastRead,a=I=>I.byId,v=(0,n.Mz)(a,I=>Object.values(I).sort((x,S)=>S.timestamp-x.timestamp)),E=(0,n.Mz)(v,I=>I.filter(C)),D=(0,n.Mz)(a,I=>Object.values(I).filter(x=>x.showing));function b(I,x){return I.icon===x.icon&&I.severity===x.severity&&I.text===x.text&&I.title===x.title}function C(I){return I.severity===o.AppNotificationSeverity.Warning||I.severity===o.AppNotificationSeverity.Error}function y(I){return typeof I=="object"&&I!==null&&"id"in I&&"icon"in I&&"title"in I&&"text"in I}function M(){const I=window.localStorage.getItem(r);if(!I)return{};const x=JSON.parse(I);return Object.values(x).every(S=>y(S))?x:{}}function T(I){const x=Object.values(I).filter(C).sort((S,O)=>O.timestamp-S.timestamp).slice(0,s).reduce((S,O)=>(S[O.id]={id:O.id,severity:O.severity,icon:O.icon,title:O.title,text:O.text,traceId:O.traceId,timestamp:O.timestamp,showing:!1},S),{});try{window.localStorage.setItem(r,JSON.stringify(x))}catch(S){console.error("Unable to persist notifications to local storage"),console.error(S)}}},91219:(Q,A,e)=>{"use strict";e.d(A,{I_:()=>f,TU:()=>l,ci:()=>c,fc:()=>i});var t=e(30038),n=e(32264),o=e(36689);const s=n.$.bootData?.navTree??[];function r(d){return d.map(h=>{const p=h.children&&r(h.children);return{...h,children:p,text:(0,o.C)(h.id)??h.text,subTitle:(0,o.o)(h.id)??h.subTitle,emptyMessage:(0,o.C)(h.emptyMessageId)}})}const g="starred/",u=(0,t.Z0)({name:"navBarTree",initialState:()=>r(n.$.bootData?.navTree??[]),reducers:{setStarred:(d,h)=>{const p=d.find(D=>D.id==="starred"),{id:m,title:a,url:v,isStarred:E}=h.payload;if(p)if(E){p.children||(p.children=[]);const D={id:g+m,text:a,url:v};p.children.push(D),p.children.sort((b,C)=>b.text.localeCompare(C.text))}else{const D=p.children?.findIndex(b=>b.id===g+m)??-1;D>-1&&p?.children?.splice(D,1)}},updateDashboardName:(d,h)=>{const{id:p,title:m,url:a}=h.payload,v=d.find(E=>E.id==="starred");if(v){const E=v.children?.find(D=>D.id===p);E&&(E.text=m,E.url=a,v.children?.sort((D,b)=>D.text.localeCompare(b.text)))}},removePluginFromNavTree:(d,h)=>{const p="plugin-page-"+h.payload.pluginID,m=d.findIndex(a=>a.id===p);m>-1&&d.splice(m,1)}}}),{setStarred:c,removePluginFromNavTree:i,updateDashboardName:l}=u.actions,f=u.reducer},28215:(Q,A,e)=>{"use strict";e.d(A,{Id:()=>g,Vz:()=>f,YA:()=>d,_h:()=>p,s2:()=>u});var t=e(30038),n=e(2543),o=e.n(n),s=e(2913),r=e(36689);const g="home";function u(){const m={},a=(0,n.cloneDeep)(s.Ay.bootData.navTree),v=a.find(D=>D.id===g),E=a.filter(D=>D.id!==g);return v&&c(m,[v]),c(m,E,m[g]),m}function c(m,a,v){const E=[];for(const D of a){const b={...D,text:(0,r.C)(D.id)??D.text,subTitle:(0,r.o)(D.id)??D.subTitle,emptyMessage:(0,r.C)(D.emptyMessageId),parentItem:v};b.id&&(m[b.id]=b),b.children&&c(m,b.children,b),E.push(b)}v&&(v.children=E),m["not-found"]={...i("Page not found","404 Error").node},m.error={...i("Page error","An unexpected error").node}}function i(m,a){const v={text:m,subTitle:a,icon:"exclamation-triangle"};return{node:v,main:v}}const l={},f=(0,t.VP)("navIndex/updateNavIndex"),d=(0,t.VP)("navIndex/updateConfigurationSubtitle"),h=(m,a)=>({...m,parentItem:{...m.parentItem,text:m.parentItem?.text??"",subTitle:a}}),p=(m=l,a)=>{if(f.match(a)){let E=function(C){if(C.children)for(const y of C.children)D[y.id]={...y,parentItem:C};C.parentItem&&E(C.parentItem)};var v=E;const D={},b=a.payload;return E(b),{...m,...D}}else if(d.match(a)){const E=`Organization: ${a.payload}`;return{...m,cfg:{...m.cfg,subTitle:E},datasources:h(m.datasources,E),correlations:h(m.correlations,E),users:h(m.users,E),teams:h(m.teams,E),plugins:h(m.plugins,E),"org-settings":h(m["org-settings"],E),apikeys:h(m.apikeys,E)}}return m}},17422:(Q,A,e)=>{"use strict";e.d(A,{rH:()=>g,tc:()=>r});var t=e(41811),n=e(71101),o=e(28215);const s=()=>{const i={id:"not-found",text:"Page not found",icon:"exclamation-triangle",subTitle:"404 Error",url:"not-found"};return{node:i,main:i}},r=(0,t.A)((i,l,f,d=!1)=>{if(i[l]){const h=i[l],p=d?h:g(h),m=u(p,l);return{node:h,main:m}}return f||s()});function g(i){return i.id===n.Rj?i:i.parentItem&&i.parentItem.id!==o.Id?g(i.parentItem):i}function u(i,l){return i.id===l?{...i,active:!0}:i.children&&i.children.length>0?{...i,children:i.children.map(f=>u(f,l))}:i}const c=i=>`${i.main.text}${i.node.text?": "+i.node.text:""}`},65615:(Q,A,e)=>{"use strict";e.d(A,{W:()=>n});var t=e(27677);class n{constructor(s){this.resourceUri=s}update(s){return t.IB.put(`/api/${this.resourceUri}/preferences`,s)}patch(s){return t.IB.patch(`/api/${this.resourceUri}/preferences`,s)}load(){return t.IB.get(`/api/${this.resourceUri}/preferences`)}}},2619:(Q,A,e)=>{"use strict";e.d(A,{Q:()=>s});var t=e(96540),n=e(13752),o=e(69731);class s{constructor(u){this._subject=new n.B,this._state=u}useState(){return r(this)}get state(){return this._state}setState(u){this._state={...this._state,...u},this._subject.next(this._state)}subscribeToState(u){return this._subject.subscribe(u)}}function r(g){const u=(0,o.C)();return(0,t.useEffect)(()=>{const c=g.subscribeToState({next:u});return()=>c.unsubscribe()},[g,u]),g.state}},27677:(Q,A,e)=>{"use strict";e.d(A,{Mf:()=>Me,IB:()=>ye,AI:()=>Le});var t=e(56568),n=e(13752),o=e(75505),s=e(88483),r=e(64423),g=e(13288),u=e(65474),c=e(20039),i=e(81160),l=e(69862),f=e(59099),d=e(37748),h=e(66847),p=e(67791),m=e(16126),a=e(41560),v=e(69850),E=e(1005),D=e(62938),b=e(26272),C=e(40187),y=e(32264),M=e(28138),T=e(2913),I=e(92315),x=e(67027),S=e(32196),O=e(96540),P=e(40845),L=e(17464),U=e(37166),R=e(55852),B=e(88448);const H=We=>{const Be=(0,P.of)(w),Ye=(0,P.$j)(),at=(0,B.o)(Ye),st=!!We.maxConcurrentSessions,Ke=()=>{window.location.reload()};return O.createElement(L.ZL,null,O.createElement("div",{className:at.modal},O.createElement(U.w,{title:"You have been automatically signed out",severity:"warning",className:Be.infobox},O.createElement("div",{className:Be.text},O.createElement("p",null,"Your session token was automatically revoked because you have reached",O.createElement("strong",null,` the maximum number of ${st?We.maxConcurrentSessions:""} concurrent sessions `),"for your account."),O.createElement("p",null,O.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.")),O.createElement(R.$n,{size:"md",variant:"primary",onClick:Ke},"Sign in"))),O.createElement("div",{className:(0,S.cx)(at.modalBackdrop,Be.backdrop)}))},w=We=>({infobox:(0,S.css)` margin-bottom: 0; `,text:(0,S.css)` margin: ${We.spacing(1,0,2)}; `,backdrop:(0,S.css)` background-color: ${We.colors.background.canvas}; opacity: 0.8; `});var N=e(28444),V=e(2543),G=e(95344);const _=We=>{const Be=We.method,Ye=J(We),at=ne(Ye),st=q(We,at),Ke=ie(We);return{method:Be,headers:Ye,body:st,credentials:Ke}},K={canParse:()=>!0,parse:We=>(We.get("accept")||We.set("accept","application/json, text/plain, */*"),We)},j=We=>({canParse:Be=>(Be?.method?Be?.method.toLowerCase():"")===We,parse:Be=>(Be.get("content-type")||Be.set("content-type","application/json"),Be)}),k=j("post"),Y=j("put"),ee=j("patch"),re=[k,Y,ee,K],J=We=>{const Be=We?.headers?new Headers(We.headers):new Headers;return re.filter(st=>st.canParse(We)).reduce((st,Ke)=>Ke.parse(st),Be)},ne=We=>{if(!We)return!1;const Be=We.get("content-type");return!!(Be&&Be.toLowerCase()==="application/json")},q=(We,Be)=>We&&(!We.data||typeof We.data=="string"||We.data instanceof Blob?We.data:Be?JSON.stringify(We.data):new URLSearchParams(We.data));async function te(We,Be){if(Be)switch(Be){case"arraybuffer":return We.arrayBuffer();case"blob":return We.blob();case"json":return We.headers.get("Content-Length")==="0"?(console.warn(`${We.url} returned an invalid JSON`),{}):await We.json();case"text":return We.text()}const Ye=await We.text();try{return JSON.parse(Ye)}catch{}return Ye}function oe(We){return Object.keys(We).map(Be=>{const Ye=We[Be];return Array.isArray(Ye)?Ye.map(at=>`${encodeURIComponent(Be)}=${encodeURIComponent(at)}`).join("&"):`${encodeURIComponent(Be)}=${encodeURIComponent(Ye)}`}).join("&")}const ue=We=>{const Be=(0,V.omitBy)(We.params,at=>at===void 0||at&&at.length===0),Ye=oe(Be);return We.params&&Ye.length?`${We.url}?${Ye}`:We.url},ie=We=>We&&(We.credentials?We.credentials:We.withCredentials?((0,G.l)("BackendSrvRequest","withCredentials","credentials"),"include"):"same-origin");var ge=e(21969),he=(We=>(We[We.Pending=0]="Pending",We[We.InProgress=1]="InProgress",We[We.Done=2]="Done",We))(he||{});class De{constructor(Be=!1){this.state={},this.queue=new n.B,this.updates=new n.B,this.add=(Ye,at)=>this.queue.next({id:Ye,options:at,state:0}),this.setInProgress=Ye=>this.queue.next({id:Ye,state:1}),this.setDone=Ye=>this.queue.next({id:Ye,state:2}),this.getUpdates=()=>this.updates.asObservable(),this.getUpdate=Ye=>{const at=Object.keys(Ye).filter(Ke=>Ye[Ke].state===1).length;return{noOfPending:Object.keys(Ye).filter(Ke=>Ye[Ke].state===0).length,noOfInProgress:at,state:Ye}},this.publishUpdate=(Ye,at)=>{this.printState(Ye,at),this.updates.next(Ye)},this.printState=(Ye,at)=>{if(!at)return;const st=Object.keys(Ye.state).reduce((Ke,Xe)=>{const He={id:Xe,state:Ye.state[Xe].state};return Ke.push(He),Ke},[]);console.log("FetchQueue noOfStarted",Ye.noOfInProgress),console.log("FetchQueue noOfNotStarted",Ye.noOfPending),console.log("FetchQueue state",st)},this.queue.subscribe(Ye=>{const{id:at,state:st,options:Ke}=Ye;if(this.state[at]||(this.state[at]={state:0,options:{url:""}}),st===2){delete this.state[at];const He=this.getUpdate(this.state);this.publishUpdate(He,Be);return}this.state[at].state=st,Ke&&(this.state[at].options=Ke);const Xe=this.getUpdate(this.state);this.publishUpdate(Xe,Be)})}}var pe=e(95864);class le{constructor(Be,Ye,at){const st=at?.http2Enabled?1e3:5;Be.getUpdates().pipe((0,m.p)(({noOfPending:Ke})=>Ke>0),(0,pe.H)(({state:Ke,noOfInProgress:Xe})=>{const He=Object.keys(Ke).filter(be=>Ke[be].state===he.Pending&&!(0,ge.dr)(Ke[be].options.url)).reduce((be,Z)=>{const ae={id:Z,options:Ke[Z].options};return be.push(ae),be},[]),Ge=Object.keys(Ke).filter(be=>Ke[be].state===he.Pending&&(0,ge.dr)(Ke[be].options.url)).reduce((be,Z)=>{const ae={id:Z,options:Ke[Z].options};return be.push(ae),be},[]),xe=Math.max(st-Xe-He.length,0),$e=Ge.slice(0,xe);return He.concat($e)})).subscribe(({id:Ke,options:Xe})=>{Ye.add(Ke,Xe)})}}class Te{constructor(Be,Ye){this.queue=new n.B,this.responses=new n.B,this.add=(at,st)=>{this.queue.next({id:at,options:st})},this.getResponses=at=>this.responses.asObservable().pipe((0,m.p)(st=>st.id===at)),this.queue.subscribe(at=>{const{id:st,options:Ke}=at;Be.setInProgress(st),this.responses.next({id:st,observable:Ye(Ke)})})}}var Ee=e(16233);const Re="cancel_all_requests_request_id",me="grafana-trace-id";class Me{constructor(Be){this.inFlightRequests=new n.B,this.HTTP_REQUEST_CANCELED=-1,this.inspectorStream=new n.B,this._tokenRotationInProgress=null,this.deviceID=null,this.dependencies={fromFetch:c.$,appEvents:M.A,contextSrv:Ee.TP,logout:()=>{Ee.TP.setLoggedOut()}},Be&&(this.dependencies={...this.dependencies,...Be}),this.noBackendCache=!1,this.internalFetch=this.internalFetch.bind(this),this.fetchQueue=new De,this.responseQueue=new Te(this.fetchQueue,this.internalFetch),this.initGrafanaDeviceID(),new le(this.fetchQueue,this.responseQueue,(0,T.zj)())}async initGrafanaDeviceID(){try{const Ye=await(await t.Ay.load()).get();this.deviceID=Ye.visitorId}catch(Be){console.error(Be)}}async request(Be){return await(0,o.s)(this.fetch(Be).pipe((0,i.T)(Ye=>Ye.data)))}fetch(Be){const Ye=(0,D.A)(),at=this.fetchQueue;return new s.c(st=>{const Ke=new r.yU;return Ke.add(this.responseQueue.getResponses(Ye).subscribe(Xe=>{Ke.add(Xe.observable.subscribe(st))})),this.fetchQueue.add(Ye,Be),function(){at.setDone(Ye),Ke.unsubscribe()}})}internalFetch(Be){Be.requestId&&this.inFlightRequests.next(Be.requestId),Be=this.parseRequestOptions(Be);const Ye=(0,x.r)();return Ye!==null&&Ye!==""&&y.$.jwtUrlLogin&&y.$.jwtHeaderName&&(Be.headers=Be.headers??{},Be.headers[y.$.jwtHeaderName]=`${Ye}`),this.deviceID&&(Be.headers=Be.headers??{},Be.headers["X-Grafana-Device-Id"]=`${this.deviceID}`),this.getFromFetchStream(Be).pipe(this.handleStreamResponse(Be),this.handleStreamError(Be),this.handleStreamCancellation(Be))}resolveCancelerIfExists(Be){this.inFlightRequests.next(Be)}cancelAllInFlightRequests(){this.inFlightRequests.next(Re)}async datasourceRequest(Be){return(0,o.s)(this.fetch(Be))}parseRequestOptions(Be){const Ye=this.dependencies.contextSrv.user?.orgId;return Be.retry=Be.retry??0,(0,ge.Lr)(Be.url)&&(Ye&&(Be.headers=Be.headers??{},Be.headers["X-Grafana-Org-Id"]=Ye),Be.url.startsWith("/")&&(Be.url=Be.url.substring(1)),Be.headers?.Authorization&&(Be.headers["X-DS-Authorization"]=Be.headers.Authorization,delete Be.headers.Authorization),this.noBackendCache&&(Be.headers=Be.headers??{},Be.headers["X-Grafana-NoCache"]="true")),Be.hideFromInspector===void 0&&(Be.hideFromInspector=(0,ge.Lr)(Be.url)&&!(0,ge.dr)(Be.url)),Be}getFromFetchStream(Be){const Ye=ue(Be),at=_(Be);return this.dependencies.fromFetch(Ye,at).pipe((0,l.Z)(async st=>{const{status:Ke,statusText:Xe,ok:He,headers:Ge,url:xe,type:$e,redirected:be}=st,Z=Be.responseType??(ne(Ge)?"json":void 0),ae=await te(st,Z);return{status:Ke,statusText:Xe,ok:He,data:ae,headers:Ge,url:xe,type:$e,redirected:be,config:Be,traceId:st.headers.get(me)??void 0}}))}showApplicationErrorAlert(Be){}showSuccessAlert(Be){const{config:Ye}=Be;if(Ye.showSuccessAlert===!1||Ye.showSuccessAlert===void 0&&(Ye.method==="GET"||(0,ge.dr)(Ye.url)||!(0,ge.Lr)(Ye.url)))return;const at=Be.data;at?.message&&this.dependencies.appEvents.emit(b.r1.alertSuccess,[at.message])}showErrorAlert(Be,Ye){if((Ye.status<400||Ye.status>=500)&&this.dependencies.contextSrv.isSignedIn&&(this.dependencies.contextSrv.user.authenticatedBy==="apikey"||this.dependencies.contextSrv.user.authenticatedBy==="render")||Be.showErrorAlert===!1||Be.showErrorAlert===void 0&&((0,ge.dr)(Be.url)||!(0,ge.Lr)(Be.url)))return;let at="",st=Ye.data.message;st==="Unexpected error"&&Ye.message&&(st=Ye.message),st.length>80&&(at=st,st="Error"),Ye.status===422&&(at=Ye.data.message,st="Validation failed"),this.dependencies.appEvents.emit(Ye.status<500?b.r1.alertWarning:b.r1.alertError,[st,at,Ye.data.traceID])}processRequestError(Be,Ye){return Ye.data=Ye.data??{message:"Unexpected error"},typeof Ye.data=="string"&&(Ye.data={message:Ye.data,error:Ye.statusText,response:Ye.data}),Ye.data&&!Ye.data.message&&typeof Ye.data.error=="string"&&(Ye.data.message=Ye.data.error),Ye.data.message&&setTimeout(()=>{Ye.isHandled||this.showErrorAlert(Be,Ye)},50),this.inspectorStream.next({response:Ye,requestId:Be.requestId}),Ye}handleStreamResponse(Be){return Ye=>Ye.pipe((0,i.T)(at=>{if(!at.ok){const{status:st,statusText:Ke,data:Xe}=at;throw{status:st,statusText:Ke,data:Xe,config:Be,traceId:at.headers.get(me)??void 0}}return at}),(0,f.M)(at=>{this.showSuccessAlert(at),this.inspectorStream.next({response:at,requestId:Be.requestId})}))}handleStreamError(Be){const{isSignedIn:Ye}=this.dependencies.contextSrv.user;return at=>at.pipe((0,d.l)(st=>st.pipe((0,l.Z)((Ke,Xe)=>{const He=Xe===0&&Be.retry===0;if(Ke.status===401&&(0,ge.Lr)(Be.url)&&He&&Ye){if(Ke.data?.error?.id==="ERR_TOKEN_REVOKED")return this.dependencies.appEvents.publish(new N.S8({component:H,props:{maxConcurrentSessions:Ke.data?.error?.maxConcurrentSessions}})),(0,g.$)(()=>Ke);let Ge=this.loginPing();return(0,I.m)()&&(0,I.W)()*1e3<Date.now()&&(Ge=this.rotateToken()),(0,u.H)(Ge).pipe((0,h.W)(xe=>(xe.status===401&&this.dependencies.logout(),(0,g.$)(xe))))}return(0,g.$)(Ke)}))),(0,h.W)(st=>(0,g.$)(()=>this.processRequestError(Be,st))))}handleStreamCancellation(Be){return Ye=>Ye.pipe((0,p.Q)(this.inFlightRequests.pipe((0,m.p)(at=>{let st=!1;return Be&&Be.requestId&&Be.requestId===at&&(st=!0),at===Re&&(st=!0),st}))),(0,a.v)(()=>({type:C.v2.Cancelled,cancelled:!0,data:null,status:this.HTTP_REQUEST_CANCELED,statusText:"Request was aborted",config:Be})))}getInspectorStream(){return this.inspectorStream}async get(Be,Ye,at,st){return this.request({...st,method:"GET",url:Be,params:Ye,requestId:at})}async delete(Be,Ye,at){return this.request({...at,method:"DELETE",url:Be,data:Ye})}async post(Be,Ye,at){return this.request({...at,method:"POST",url:Be,data:Ye})}async patch(Be,Ye,at){return this.request({...at,method:"PATCH",url:Be,data:Ye})}async put(Be,Ye,at){return this.request({...at,method:"PUT",url:Be,data:Ye})}withNoBackendCache(Be){return this.noBackendCache=!0,Be().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,v.j)(()=>{this._tokenRotationInProgress=null}),(0,E.u)()),this._tokenRotationInProgress)}loginPing(){return this.fetch({url:"/api/login/ping",method:"GET",retry:1})}search(Be){return this.get("/api/search",Be)}getDashboardByUid(Be){return this.get(`/api/dashboards/uid/${Be}`)}validateDashboard(Be){return Promise.resolve({isValid:!1,message:"dashboard validation is supported"})}getPublicDashboardByUid(Be){return this.get(`/api/public/dashboards/${Be}`)}getFolderByUid(Be,Ye={}){const at=new URLSearchParams;return Ye.withAccessControl&&at.set("accesscontrol","true"),this.get(`/api/folders/${Be}?${at.toString()}`,void 0,void 0,{showErrorAlert:!1})}}const ye=new Me,Le=()=>ye},16233:(Q,A,e)=>{"use strict";e.d(A,{SM:()=>i,TP:()=>d});var t=e(2543),n=e.n(t),o=e(65879),s=e(17172),r=e(33378),g=e(92315),u=e(80348),c=e(2913);const i="auto";class l{constructor(){this.id=0,this.uid="",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="",c.Ay.bootData.user&&(0,t.extend)(this,c.Ay.bootData.user)}}class f{constructor(){this.sidemenuSmallBreakpoint=!1,this.tokenRotationJobId=0,c.Ay.bootData||(c.Ay.bootData={user:{},settings:{},navTree:[]}),this.user=new l,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=c.Ay.minRefreshInterval,this.scheduleTokenRotationJob()}async fetchUserPermissions(){try{this.user.permissions=await(0,s.AI)().get("/api/access-control/user/actions",{reloadcache:!0})}catch(m){console.error(m)}}setLoggedOut(){this.cancelTokenRotationJob(),this.user.isSignedIn=!1,this.isSignedIn=!1,window.location.reload()}hasRole(m){return m==="ServerAdmin"?this.isGrafanaAdmin:this.user.orgRole===m}licensedAccessControlEnabled(){return(0,r.a)("accesscontrol")}hasPermissionInMetadata(m,a){return!!a.accessControl?.[m]}hasPermission(m){return!!this.user.permissions?.[m]}isGrafanaVisible(){return document.visibilityState===void 0||document.visibilityState==="visible"}isAllowedInterval(m){return!c.Ay.minRefreshInterval||m===i?!0:o.intervalToMs(m)>=o.intervalToMs(c.Ay.minRefreshInterval)}getValidInterval(m){return this.isAllowedInterval(m)?m:c.Ay.minRefreshInterval}getValidIntervals(m){return this.minRefreshInterval?m.filter(a=>a!=="").filter(this.isAllowedInterval):m}hasAccessToExplore(){return this.hasPermission(u.AccessControlAction.DataSourcesExplore)&&c.Ay.exploreEnabled}evaluatePermission(m){return m.some(a=>this.hasPermission(a))?[]:["Reject"]}scheduleTokenRotationJob(){if(this.canScheduleRotation()){let m=(0,g.W)(),v=(m-Math.floor(Math.random()*(20-1)+1))*1e3-Date.now();this.tokenRotationJobId=setTimeout(()=>{if((0,g.W)()>m){this.scheduleTokenRotationJob();return}this.rotateToken().then()},v)}}canScheduleRotation(){return!(!this.isSignedIn||(0,g.W)()===0)}cancelTokenRotationJob(){this.tokenRotationJobId>0&&clearTimeout(this.tokenRotationJobId)}rotateToken(){return fetch(c.Ay.appSubUrl+"/api/user/auth-tokens/rotate",{method:"POST"}).then(m=>{if(m.status===200){this.scheduleTokenRotationJob();return}if(m.status===401){this.setLoggedOut();return}}).catch(m=>{console.error(m)})}}let d=new f;const h=p=>{throw new Error("contextSrv can be only overridden in test environment")}},62301:(Q,A,e)=>{"use strict";e.d(A,{A:()=>c});var t=e(2543),n=e.n(t),o=e(17172),s=e(2913),r=e(33390);class g{constructor(){}addDashboardImpression(l){const f=this.impressionKey();let d=[];r.A.exists(f)&&(d=JSON.parse(r.A.get(f)),(0,t.isArray)(d)||(d=[])),d=d.filter(h=>l!==h),d.unshift(l),d.length>50&&d.pop(),r.A.set(f,JSON.stringify(d))}async convertToUIDs(){let l=this.getImpressions();const f=(0,t.filter)(l,h=>(0,t.isNumber)(h));if(!f.length)return;const d=await(0,o.AI)().get(`/api/dashboards/ids/${f.join(",")}`);r.A.set(this.impressionKey(),JSON.stringify([...(0,t.filter)(l,h=>(0,t.isString)(h)),...d]))}getImpressions(){const l=r.A.get(this.impressionKey())||"[]";return JSON.parse(l)}async getDashboardOpened(){try{await this.convertToUIDs()}catch{}return(0,t.filter)(this.getImpressions(),f=>(0,t.isString)(f))}impressionKey(){return"dashboard_impressions-"+s.Ay.bootData.user.orgId}}const c=new g},2769:(Q,A,e)=>{"use strict";e.d(A,{K:()=>u,O:()=>c});var t=e(97594),n=e(3591),o=e(28138),s=e(2913),r=e(10096),g=e(65615);async function u(i,l){const f=s.$W.theme2,d=(0,t.g)(i);if(o.A.publish(new n.E8(d)),f.colors.mode!==d.colors.mode){const m=document.createElement("link");m.rel="stylesheet",m.href=s.$W.bootData.assets[d.colors.mode],m.onload=()=>{const a=document.getElementsByTagName("link");for(let v=0;v<a.length;v++){const E=a[v];E.href&&E.href.includes(`build/grafana.${f.colors.mode}`)&&E.remove()}},document.head.insertBefore(m,document.head.firstChild)}if(l||!r.TP.isSignedIn)return;const h=new g.W("user"),p=await h.load();await h.update({...p,theme:d.colors.mode})}async function c(i){const l=s.$W.theme2;u(l.isDark?"light":"dark",i)}},33390:(Q,A,e)=>{"use strict";e.d(A,{A:()=>o});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 u=g;if(this.exists(r)){const c=window.localStorage[r];try{u=JSON.parse(c)}catch(i){console.error(`Error parsing store object: ${r}. Returning default: ${g}. [${i}]`)}}return u}setObject(r,g){let u;try{u=JSON.stringify(g)}catch(c){throw new Error(`Could not stringify object: ${r}. [${c}]`)}try{this.set(r,u)}catch(c){const i=new Error(`Could not save item in localStorage: ${r}. [${c}]`);throw c instanceof Error&&(i.name=c.name),i}return!0}exists(r){return window.localStorage[r]!==void 0}delete(r){window.localStorage.removeItem(r)}}const o=new t},31140:(Q,A,e)=>{"use strict";e.d(A,{A:()=>i,r:()=>c});var t=e(2543),n=e.n(t),o=e(54479),s=e(83195);function r(l,f){if(!l)return!1;if(l[0]==="/"){const d=(0,o.dO)(l);return f.match(d)!=null}return l===f}function g(l){return l===0?.001:l/10}function u(l){return l?{colors:[{opacity:0},{opacity:l/10}]}:null}function c(l,f,d){for(let h=0;h<l.length;h++){const p=l[h],m=f.yaxes,a=p.yaxis||1,v=m[a-1],E=(0,s.j_)(v.format);(0,t.isNumber)(f.decimals)?p.updateLegendValues(E,f.decimals):(0,t.isNumber)(v.decimals)?p.updateLegendValues(E,v.decimals+1):p.updateLegendValues(E,null)}}class i{constructor(f){this.datapoints=f.datapoints,this.label=f.alias,this.id=f.alias,this.alias=f.alias,this.aliasEscaped=(0,t.escape)(f.alias),this.color=f.color,this.bars={fillColor:f.color},this.valueFormater=(0,s.j_)("none"),this.stats={},this.legend=!0,this.unit=f.unit,this.dataFrameIndex=f.dataFrameIndex,this.fieldIndex=f.fieldIndex,this.hasMsResolution=this.isMsResolutionNeeded()}applySeriesOverrides(f){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 d=0;d<f.length;d++){const h=f[d];r(h.alias,this.alias)&&(h.lines!==void 0&&(this.lines.show=h.lines),h.dashes!==void 0&&(this.dashes.show=h.dashes,this.lines.lineWidth=0),h.points!==void 0&&(this.points.show=h.points),h.bars!==void 0&&(this.bars.show=h.bars),h.fill!==void 0&&(this.lines.fill=g(h.fill)),h.fillGradient!==void 0&&(this.lines.fillColor=u(h.fillGradient)),h.stack!==void 0&&(this.stack=h.stack),h.linewidth!==void 0&&(this.lines.lineWidth=this.dashes.show?0:h.linewidth,this.dashes.lineWidth=h.linewidth),h.dashLength!==void 0&&(this.dashes.dashLength[0]=h.dashLength),h.spaceLength!==void 0&&(this.dashes.dashLength[1]=h.spaceLength),h.nullPointMode!==void 0&&(this.nullPointMode=h.nullPointMode),h.pointradius!==void 0&&(this.points.radius=h.pointradius),h.steppedLine!==void 0&&(this.lines.steps=h.steppedLine),h.zindex!==void 0&&(this.zindex=h.zindex),h.fillBelowTo!==void 0&&(this.fillBelowTo=h.fillBelowTo),h.color!==void 0&&this.setColor(h.color),h.transform!==void 0&&(this.transform=h.transform),h.legend!==void 0&&(this.legend=h.legend),h.hideTooltip!==void 0&&(this.hideTooltip=h.hideTooltip),h.yaxis!==void 0&&(this.yaxis=h.yaxis),h.hiddenSeries!==void 0&&(this.hiddenSeries=h.hiddenSeries))}}getFlotPairs(f){const d=[];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 h=f==="connected",p=f==="null as zero";let m,a,v=0,E,D=0,b=!0;for(let C=0;C<this.datapoints.length;C++){if(a=this.datapoints[C][0],m=this.datapoints[C][1],E!==void 0){const y=m-E;y<this.stats.timeStep&&(this.stats.timeStep=y)}if(E=m,a===null){if(h)continue;p&&(a=0)}a!==null&&((0,t.isNumber)(a)&&(this.stats.total+=a,this.allIsNull=!1,v++),a>this.stats.max&&(this.stats.max=a),a<this.stats.min&&(this.stats.min=a),this.stats.first===null?this.stats.first=a:D>a?(b=!1,C===this.datapoints.length-1&&(this.stats.delta+=a)):(b?this.stats.delta+=a-D:this.stats.delta+=a,b=!0),D=a,a<this.stats.logmin&&a>0&&(this.stats.logmin=a),a!==0&&(this.allIsZero=!1)),d.push([m,a])}return this.stats.max===-Number.MAX_VALUE&&(this.stats.max=null),this.stats.min===Number.MAX_VALUE&&(this.stats.min=null),d.length&&!this.allIsNull&&(this.stats.avg=this.stats.total/v,this.stats.current=d[d.length-1][1],this.stats.current===null&&d.length>1&&(this.stats.current=d[d.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=d.length,d}updateLegendValues(f,d){this.valueFormater=f,this.decimals=d}formatValue(f){return(0,t.isFinite)(f)||(f=null),(0,s.cN)(this.valueFormater(f,this.decimals))}isMsResolutionNeeded(){for(let f=0;f<this.datapoints.length;f++)if(this.datapoints[f][1]!==null&&this.datapoints[f][1]!==void 0){const d=this.datapoints[f][1].toString();if(d.length===13&&d%1e3!==0)return!0}return!1}hideFromLegend(f){return!!(f.hideEmpty&&this.allIsNull||!this.legend||f.hideZero&&this.allIsZero)}setColor(f){this.color=f,this.bars.fillColor=f}}},6262:(Q,A,e)=>{"use strict";e.d(A,{G:()=>s});var t=e(40672),n=e(32264);const o=n.$.bootData.settings.cspReportOnlyEnabled,s={createHTML:(r,g,u)=>o?(console.error("[HTML not sanitized with Trusted Types]",r,g,u),r):r.replace(/<script/gi,"<script"),createScript:r=>r,createScriptURL:(r,g,u)=>o?(console.error("[ScriptURL not sanitized with Trusted Types]",r,g,u),r):t.sQ.sanitizeUrl(r)};n.$.bootData.settings.trustedTypesDefaultPolicyEnabled&&window.trustedTypes&&window.trustedTypes.createPolicy&&window.trustedTypes.createPolicy("default",s)},96378:(Q,A,e)=>{"use strict";e.d(A,{N:()=>c,e:()=>i});var t=e(96540),n=e(70255),o=e(60578),s=e(3591),r=e(32264),g=e(10096),u=e(34295);const c=({children:l,value:f})=>{const[d,h]=(0,t.useState)(f);return(0,t.useEffect)(()=>{const p=g.lE.subscribe(s.E8,m=>{r.$.theme2=m.payload,h(m.payload)});return()=>p.unsubscribe()},[]),t.createElement(o.D.Provider,{value:d},t.createElement(n.z,{baseColor:d.colors.emphasize(d.colors.background.secondary),highlightColor:d.colors.emphasize(d.colors.background.secondary,.1),borderRadius:d.shape.radius.default},l))},i=(l,f)=>function(h){return t.createElement(c,{value:f},t.createElement(l,{...h}))}},67278:(Q,A,e)=>{"use strict";e.d(A,{c:()=>t});class t extends window.Worker{constructor(o,s){const r=o.toString(),g=r.split("/");g.pop();const u=`${g.join("/")}/`,c=`importScripts('${r}');`,i=URL.createObjectURL(new Blob([`__webpack_worker_public_path__ = '${u}'; ${c}`],{type:"application/javascript"}));super(i,s),URL.revokeObjectURL(i)}}},80714:(Q,A,e)=>{"use strict";e.d(A,{F:()=>t});function t(n={}){return{...n,accesscontrol:!0}}},94041:(Q,A,e)=>{"use strict";e.d(A,{b:()=>t});const t=(n,o,s)=>(n.splice(s,0,n.splice(o,1)[0]),n)},92315:(Q,A,e)=>{"use strict";e.d(A,{W:()=>t,m:()=>n});function t(){const o=document.cookie.split("; ").find(r=>r.startsWith("grafana_session_expiry="));if(!o)return 0;let s=o.split("=").at(1);return s?parseInt(s,10):0}function n(){return document.cookie.split("; ").findIndex(o=>o.startsWith("grafana_session_expiry="))>-1}},63917:(Q,A,e)=>{"use strict";e.d(A,{gn:()=>o});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,u=/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),c=/Edge\/([0-9.]+)/.exec(navigator.userAgent);return s&&parseFloat(/Trident\/([0-9.]+)/.exec(navigator.userAgent)[1])<=7||r&&(c&&parseFloat(c[1])<=16||parseFloat(/Edg\/([0-9.]+)/.exec(navigator.userAgent)[1])<=16)||g&&parseFloat(/Firefox\/([0-9.]+)/.exec(navigator.userAgent)[1])<=64?!1:!(u&&parseFloat(/Chrome\/([0-9.]+)/.exec(navigator.userAgent)[1])<=54)}function n(){return/(iPhone|iPad|Mac)/.test(navigator.platform)}function o(){return n()?"cmd":"ctrl"}},34525:(Q,A,e)=>{"use strict";e.d(A,{TS:()=>o});class t{_linkTo(u,c){c<=0&&u.inputEdges.push(this),c>=0&&u.outputEdges.push(this),u.edges.push(this)}link(u,c){if(!u)throw Error("inputNode is required");if(!c)throw Error("outputNode is required");return this.unlink(),this.inputNode=u,this.outputNode=c,this._linkTo(u,1),this._linkTo(c,-1),this}unlink(){let u;const c=this.inputNode,i=this.outputNode;c&&i&&(u=c.edges.indexOf(this),u>-1&&c.edges.splice(u,1),u=i.edges.indexOf(this),u>-1&&i.edges.splice(u,1),u=c.outputEdges.indexOf(this),u>-1&&c.outputEdges.splice(u,1),u=i.inputEdges.indexOf(this),u>-1&&i.inputEdges.splice(u,1))}}class n{constructor(u){this.name=u,this.edges=[],this.inputEdges=[],this.outputEdges=[]}getEdgeFrom(u){return u?typeof u=="object"?this.inputEdges.find(c=>c.inputNode?.name===u.name):this.inputEdges.find(c=>c.inputNode?.name===u):null}getEdgeTo(u){return u?typeof u=="object"?this.outputEdges.find(c=>c.outputNode?.name===u.name):this.outputEdges.find(c=>c.outputNode?.name===u):null}getOptimizedInputEdges(){const u=[];return this.inputEdges.forEach(c=>{c.inputNode?.inputEdges.map(l=>l.inputNode)?.forEach(l=>{const f=l?.getEdgeTo(this.name);f&&u.push(f)})}),this.inputEdges.filter(c=>u.indexOf(c)===-1)}}class o{constructor(){this.nodes={}}createNode(u){const c=new n(u);return this.nodes[u]=c,c}createNodes(u){const c=[];return u.forEach(i=>{c.push(this.createNode(i))}),c}link(u,c){let i=[],l=[];const f=[],d=[];u instanceof Array?i=u:i=[u],c instanceof Array?l=c:l=[c];for(let p=0;p<i.length;p++){const m=i[p];if(typeof m=="string"){const a=this.getNode(m);if(!a)throw Error(`cannot link input node named ${m} since it doesn't exist in graph`);f.push(a)}else f.push(m)}for(let p=0;p<l.length;p++){const m=l[p];if(typeof m=="string"){const a=this.getNode(m);if(!a)throw Error(`cannot link output node named ${m} since it doesn't exist in graph`);d.push(a)}else d.push(m)}const h=[];return f.forEach(p=>{d.forEach(m=>{h.push(this.createEdge().link(p,m))})}),h}descendants(u){if(!u.length)return new Set;const c=new Set(r(u)?u.map(i=>this.nodes[i]).filter(i=>i!==void 0):u);return this.descendantsRecursive(c)}descendantsRecursive(u,c=new Set){for(const i of u){const l=new Set;for(const{inputNode:f}of i.inputEdges)f&&!c.has(f)&&(c.add(f),l.add(f));this.descendantsRecursive(l,c)}return c}createEdge(){return new t}getNode(u){return this.nodes[u]}}const s=g=>{Object.keys(g.nodes).forEach(u=>{const c=g.nodes[u];let i=c.outputEdges.map(f=>f.outputNode?.name).join(", ");i||(i="<none>");let l=c.inputEdges.map(f=>f.inputNode?.name).join(", ");l||(l="<none>"),console.log(`${c.name}: - links to: ${i} - links from: ${l}`)})};function r(g){return g.length>0&&typeof g[0]=="string"}},94954:(Q,A,e)=>{"use strict";e.d(A,{q:()=>n});var t=e(17172);function n(o){if(typeof o=="string")return o;if(o){if(o instanceof Error)return o.message;if((0,t.NF)(o)){if(o.data&&o.data.message)return o.data.message;if(o.statusText)return o.statusText}}return JSON.stringify(o)}},87490:(Q,A,e)=>{"use strict";e.d(A,{Al:()=>B,HQ:()=>D,Ll:()=>O,MA:()=>x,WP:()=>p,Xe:()=>y,_u:()=>V,bI:()=>T,dY:()=>H,di:()=>L,dr:()=>b,eF:()=>P,o$:()=>C,uE:()=>N,uJ:()=>_,uq:()=>M,w4:()=>I,zT:()=>R,zq:()=>w});var t=e(44329),n=e(62938),o=e(52622),s=e(76885),r=e(41987),g=e(43127),u=e(65879),c=e(19347),i=e(11134),l=e(33390),f=e(66718),d=e(21969);const h={dedupStrategy:o.fY.none},p="0123456789abcdefghijklmnopqrstuvwxyz",m=(0,t.d_)(p,3),a=100,v="grafana.explore.datasource",E=K=>`${v}.${K}`,D=K=>l.A.getObject(E(K)),b=(K,j)=>l.A.setObject(E(K),j);function C(){for(;;){const K=m(3);if(!/^\d+$/.test(K))return K}}async function y(K){const{queries:j,dsRef:k,timeRange:Y,scopedVars:ee,adhocFilters:re}=K,J=(await Promise.allSettled(j.filter(q=>q.datasource?.uid!==f.Uj).map(async q=>{const te=await(0,c.l)().get(q.datasource||k);return{...te.interpolateVariablesInQueries?.([q],ee??{},re)[0]||q,...!te.meta.mixed&&{datasource:te.getRef()}}}))).filter(q=>q.status==="fulfilled").map(q=>q.value),ne=JSON.stringify({[C()]:{range:(0,s.sQ)(Y.raw),queries:J,datasource:k?.uid}});return s.kM.renderUrl("/explore",{panes:ne,schemaVersion:1})}function M(K){return`explore_${K}`}function T(K,j,k,Y,ee,re,J){const ne=Number.parseInt(K,36),{interval:q,intervalMs:te}=G(Y,k.minInterval,k.maxDataPoints),oe={app:r.Jk.Explore,timezone:re||g.lE,startTime:Date.now(),interval:q,intervalMs:te,panelId:ne,targets:j,range:Y,requestId:M(K),rangeRaw:Y.raw,scopedVars:{__interval:{text:q,value:q},__interval_ms:{text:te,value:te},...J},maxDataPoints:k.maxDataPoints,liveStreaming:k.liveStreaming};return{queries:j,request:oe,scanning:ee,id:S(),done:!1}}const I=({key:K,...j})=>j,x=(K,j)=>{if(K==null)return"";try{return JSON.stringify(K,null,j)}catch(k){console.error(k)}return""};function S(K=0){return`Q-${(0,n.A)()}-${K}`}async function O(K,j=0,k){let Y,ee,re;return k?ee=k:K.length>0&&K[K.length-1].datasource?ee=K[K.length-1].datasource:(Y=await(0,c.l)().get(),re=Y.getDefaultQuery?.(r.Jk.Explore),ee=Y.getRef()),Y||(Y=await(0,c.l)().get(ee),re=Y.getDefaultQuery?.(r.Jk.Explore)),{...re,refId:(0,d.W3)(K),key:S(j),datasource:ee}}const P=(K,j,k=0)=>{const Y=S(k),ee=K.refId||(0,d.W3)(j);return{...K,refId:ee,key:Y}};async function L(K,j){if(K&&typeof K=="object"&&K.length>0){const k=[];for(let Y=0;Y<K.length;Y++){const ee=K[Y],re=S(Y);let J=ee.refId;J||(J=(0,d.W3)(k));let ne=!0;if(ee.datasource)try{await(0,c.l)().get(ee.datasource.uid)}catch{console.error("One of the queries has a datasource that is no longer available and was removed."),ne=!1}ne&&k.push({...ee,refId:J,key:re})}return k}try{const k=j??(await(0,c.l)().get()).getRef();return[await O(K??[],void 0,k)]}catch{return[]}}const U=["refId","key","context","datasource"];function R(K){return K&&K.some(j=>Object.entries(j).filter(([Y,ee])=>U.indexOf(Y)===-1).filter(([Y,ee])=>ee).length>0)}function B(K,j,k){const Y=Date.now();let ee=K;k.forEach(J=>{ee=[{query:J,ts:Y},...ee]}),ee.length>a&&(ee=ee.slice(0,a));const re=`grafana.explore.history.${j}`;try{return l.A.setObject(re,ee),ee}catch(J){return console.error(J),K}}const H=K=>K.reduce((k,Y,ee)=>{const re=Y.datasource?.uid||Y.key;return k.concat(`${re}-${ee}`)},[]),w=(K,j,k)=>u.convertRawToRange(j,K,k),N=K=>i.cC.isLive(K)?o.uH.Ascending:o.uH.Descending,V=K=>{K&&K.unsubscribe()};function G(K,j,k){return k?u.calculateInterval(K,k,j):{interval:"1s",intervalMs:1e3}}const _=K=>{if(navigator.clipboard&&window.isSecureContext)navigator.clipboard.writeText(K);else{const j=document.createElement("textarea");j.value=K,document.body.appendChild(j),j.select(),document.execCommand("copy"),document.body.removeChild(j)}}},78827:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{default:()=>t});function t(n,o){o=o||{};const s=o.delimiter||".";let r=o.maxDepth||3,g=1;const u={};function c(i,l){Object.keys(i).forEach(f=>{const d=i[f],h=o?.safe&&Array.isArray(d),m=Object.prototype.toString.call(d)==="[object Object]",a=l?l+s+f:f;if(o?.maxDepth||(r=g+1),!h&&m&&Object.keys(d).length&&g<r)return++g,c(d,a);u[a]=d})}return c(n,null),u}},68576:(Q,A,e)=>{"use strict";e.d(A,{A:()=>u});var t=e(95344),n=e(54479),o=e(65879),s=e(83195);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:c=>((0,t.l)("kbn.ts","kbn.regexEscape()","escapeRegex from @grafana/data"),(0,n.$f)(c)),roundInterval:c=>((0,t.l)("kbn.ts","kbn.roundInterval()","@grafana/data"),o.roundInterval(c)),secondsToHms:c=>((0,t.l)("kbn.ts","kbn.secondsToHms()","@grafana/data"),o.secondsToHms(c)),secondsToHhmmss:c=>{const i=[],l=Math.floor(c/3600),f=Math.floor(c%3600/60),d=Math.floor(c%3600%60);return l>9?i.push(""+l):i.push("0"+l),f>9?i.push(""+f):i.push("0"+f),d>9?i.push(""+d):i.push("0"+d),i.join(":")},toPercent:(c,i)=>Math.floor(c/i*1e4)/100+"%",addSlashes:c=>c.replace(/[\'\"\\0]/g,"\\$&"),describeInterval:c=>((0,t.l)("kbn.ts","kbn.describeInterval()","@grafana/data"),o.describeInterval(c)),intervalToSeconds:c=>((0,t.l)("kbn.ts","rangeUtil.intervalToSeconds()","@grafana/data"),o.intervalToSeconds(c)),intervalToMs:c=>((0,t.l)("kbn.ts","rangeUtil.intervalToMs()","@grafana/data"),o.intervalToMs(c)),calculateInterval:(c,i,l)=>((0,t.l)("kbn.ts","kbn.calculateInterval()","@grafana/data"),o.calculateInterval(c,i,l)),queryColorDot:(c,i)=>'<div class="icon-circle" style="'+["display:inline-block","color:"+c,"font-size:"+i+"px"].join(";")+'"></div>',slugifyForUrl:c=>c.toLowerCase().replace(/[^\w ]+/g,"").replace(/ +/g,"-"),stringToJsRegex:c=>((0,t.l)("kbn.ts","kbn.stringToJsRegex()","@grafana/data"),(0,n.dO)(c)),toFixed:(c,i)=>{if(c===null)return"";const l=i?Math.pow(10,Math.max(0,i)):1,f=String(Math.round(c*l)/l);if(f.indexOf("e")!==-1||c===0)return f;if(i!=null){const d=f.indexOf("."),h=d===-1?0:f.length-d-1;if(h<i)return(h?f:f+".")+String(l).slice(1,i-h+1)}return f},toFixedScaled:(c,i,l,f,d)=>l===null?g.toFixed(c,i)+d:g.toFixed(c,l+f)+d,roundValue:(c,i)=>{if(c===null)return null;const l=Math.pow(10,i),f=(l*c).toFixed(i);return Math.round(parseFloat(f))/l},getUnitFormats:s.Ke};typeof Proxy<"u"?g.valueFormats=new Proxy(g.valueFormats,{get(c,i,l){if(typeof i!="string")throw{message:`Value format ${String(i)} is not a string`};const f=(0,s.j_)(i);return f?(d,h,p,m)=>(0,s.cN)(f(d,h,p,m?"utc":"browser")):Reflect.get(c,i,l)}}):g.valueFormats=(0,s.uH)();const u=g},36689:(Q,A,e)=>{"use strict";e.d(A,{C:()=>n,o:()=>o});var t=e(44836);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","New 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"alerting-upgrade":return(0,t.t)("nav.alerting-upgrade.title","Alerting upgrade");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"alert-list-legacy":return(0,t.t)("nav.alert-list-legacy.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"cfg/general":return(0,t.t)("nav.config-general.title","General");case"cfg/plugins":return(0,t.t)("nav.config-plugins.title","Plugins and data");case"cfg/access":return(0,t.t)("nav.config-access.title","Users and access");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"infrastructure":return(0,t.t)("nav.infrastructure.title","Infrastructure");case"frontend":return(0,t.t)("nav.frontend.title","Frontend");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"testing-and-synthetics":return(0,t.t)("nav.testing-and-synthetics.title","Testing & synthetics");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.k6.title","Performance");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");case"plugin-page-grafana-pyroscope-app":return(0,t.t)("nav.profiles.title","Profiles");case"plugin-page-grafana-kowalski-app":return(0,t.t)("nav.frontend-app.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"standalone-plugin-page-/connections/collector":return(0,t.t)("nav.collector.title","Collector");case"connections-datasources":return(0,t.t)("nav.data-sources.title","Data sources");case"standalone-plugin-page-/connections/infrastructure":return(0,t.t)("nav.integrations.title","Integrations");case"standalone-plugin-page-/connections/connect-data":return(0,t.t)("nav.connect-data.title","Connect data");case"standalone-plugin-page-/connections/private-data-source-connections":return(0,t.t)("nav.private-data-source-connections.title","Private data source connect");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 o(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"alerting-upgrade":return(0,t.t)("nav.alerting-upgrade.subtitle","Upgrade your existing legacy alerts and notification channels to the new Grafana Alerting");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"cfg/general":return(0,t.t)("nav.config-general.subtitle","Manage default preferences and settings across Grafana");case"cfg/plugins":return(0,t.t)("nav.config-plugins.subtitle","Install plugins and define the relationships between data");case"cfg/access":return(0,t.t)("nav.config-access.subtitle","Configure access for individual users, teams, and service accounts");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","Out-of-the-box observability solutions");case"infrastructure":return(0,t.t)("nav.infrastructure.subtitle","Understand your infrastructure's health");case"frontend":return(0,t.t)("nav.frontend.subtitle","Gain real user monitoring insights");case"alerts-and-incidents":return(0,t.t)("nav.alerts-and-incidents.subtitle","Alerting and incident management apps");case"testing-and-synthetics":return(0,t.t)("nav.testing-and-synthetics.subtitle","Optimize performance with k6 and Synthetic Monitoring insights");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");case"connections-private-data-source-connections":return(0,t.t)("nav.private-data-source-connections.subtitle","Query data that lives within a secured network without opening the network to inbound traffic from Grafana Cloud. Learn more in our docs.");default:return}}},28874:(Q,A,e)=>{"use strict";e.d(A,{v:()=>o});var t=e(2543),n=e.n(t);function o(s){return(0,t.isArray)(s)?s.map(o):(0,t.isPlainObject)(s)?Object.keys(s).sort().reduce((r,g)=>{const u=s[g];return u!=null&&(r[g]=o(u)),r},{}):s}},21969:(Q,A,e)=>{"use strict";e.d(A,{Ih:()=>n,Lr:()=>r,U7:()=>o,W3:()=>t,dr:()=>s,fE:()=>u});const t=c=>{for(let i=0;;i++){const l=g(i);if(!c.some(f=>f.refId===l))return l}};function n(c){const i=["refId","hide","key","queryType","datasource"];for(const l in c)if(l!=="label"&&!i.includes(l))return!1;return!0}function o(c,i,l){const f={...i,refId:t(c),hide:!1};return!f.datasource&&l&&(f.datasource=l),[...c,f]}function s(c){return c.indexOf("api/datasources/proxy")!==-1||c.indexOf("api/ds/query")!==-1}function r(c){return!c.match(/^http/)}function g(c){const i="ABCDEFGHIJKLMNOPQRSTUVWXYZ";return c<i.length?i[c]:g(Math.floor(c/i.length)-1)+i[c%i.length]}function u(c){return c||void 0}},81523:(Q,A,e)=>{"use strict";e.d(A,{Ax:()=>x,DI:()=>p,Gx:()=>a,IA:()=>y,NC:()=>b,TR:()=>O,U3:()=>C,X1:()=>v,cX:()=>D,l0:()=>h,oU:()=>E,rs:()=>m,x8:()=>S,xB:()=>d.x});var t=e(2543),n=e.n(t),o=e(76885),s=e(72724),r=e(19347),g=e(82467),u=e(3169),c=e(44836),i=e(99140),l=e(38877),f=e(11401),d=e(91650);async function h(L,U,R,B,H,w,N){const V=R&&R.filter(G=>P(G));if(V.length>0){let G=!1,_=!1,K;try{K=(await(0,f.a)().addToRichHistory({datasourceUid:L,datasourceName:U??"",queries:V,starred:B,comment:H??""})).warning}catch(j){return j instanceof Error&&(j.name===l.m.StorageFull?(G=!0,w&&(0,i.JD)((0,g.dx)((0,u.gi)(j.message)))):j.name!==l.m.DuplicatedEntry&&(0,i.JD)((0,g.dx)((0,u.gi)((0,c.t)("explore.rich-history-utils-notification.update-failed","Rich History update failed"),j.message)))),{richHistoryStorageFull:G,limitExceeded:_}}return K&&K.type===l.C.LimitExceeded&&(_=!0,N&&(0,i.JD)((0,g.dx)((0,u.q8)(K.message)))),{richHistoryStorageFull:G,limitExceeded:_}}return{}}async function p(L){return await(0,f.a)().getRichHistory(L)}async function m(L){await(0,f.a)().updateSettings(L)}async function a(){return await(0,f.a)().getSettings()}async function v(){return(0,f.a)().deleteAll()}async function E(L,U){try{return await(0,f.a)().updateStarred(L,U)}catch(R){R instanceof Error&&(0,i.JD)((0,g.dx)((0,u.gi)((0,c.t)("explore.rich-history-utils-notification.saving-failed","Saving rich history failed"),R.message)));return}}async function D(L,U){try{return await(0,f.a)().updateComment(L,U)}catch(R){R instanceof Error&&(0,i.JD)((0,g.dx)((0,u.gi)((0,c.t)("explore.rich-history-utils-notification.saving-failed","Saving rich history failed"),R.message)));return}}async function b(L){try{return await(0,f.a)().deleteRichHistory(L),L}catch(U){U instanceof Error&&(0,i.JD)((0,g.dx)((0,u.gi)((0,c.t)("explore.rich-history-utils-notification.saving-failed","Saving rich history failed"),U.message)));return}}const C=L=>{const U={range:{from:(0,c.t)("explore.rich-history-utils.default-from","now-1h"),to:(0,c.t)("explore.rich-history-utils.default-to","now")},datasource:L.datasourceName,queries:L.queries},R=(0,o.Pp)(U),B=/.*(?=\/explore)/.exec(`${window.location.href}`)[0];return o.kM.renderUrl(`${B}/explore`,{left:R})},y=L=>{let U;switch(L){case 0:U=(0,c.t)("explore.rich-history-utils.today","today");break;case 1:U=(0,c.t)("explore.rich-history-utils.yesterday","yesterday");break;case 7:U=(0,c.t)("explore.rich-history-utils.a-week-ago","a week ago");break;case 14:U=(0,c.t)("explore.rich-history-utils.two-weeks-ago","two weeks ago");break;default:U=(0,c.t)("explore.rich-history-utils.days-ago","{{num}} days ago",{num:`${L}`})}return U};function M(L){return(0,s.LE)(L,{format:"MMMM D"})}function T(L){const U=(0,t.omit)(L,["key","refId","datasource"]);return JSON.stringify(U)}function I(L,U){let R="";return U===d.x.DatasourceAZ||U===d.x.DatasourceZA?R=L.datasourceName:R=M(L.createdAt),R}function x(L,U){return U?.getQueryDisplayText?U.getQueryDisplayText(L):T(L)}function S(L,U){let R={};return L.forEach(B=>{let H=I(B,U);H in R?R[H]=[...R[H],B]:R[H]=[B]}),R}function O(){return(0,r.l)().getList({mixed:!0}).map(L=>({name:L.name,uid:L.uid}))}function P(L){const U=(0,t.omit)(L,["key","refId","datasource"]);return Object.keys(U).length>0}},91650:(Q,A,e)=>{"use strict";e.d(A,{x:()=>t});var t=(n=>(n.Descending="Descending",n.Ascending="Ascending",n.DatasourceAZ="Datasource A-Z",n.DatasourceZA="Datasource Z-A",n))(t||{})},7030:(Q,A,e)=>{"use strict";e.d(A,{V:()=>f,f:()=>l});var t=e(41811),n=e(32264),o=e(17172),s=e(82467),r=e(3169),g=e(99140),u=e(87490);function c(){return`${window.location.protocol}//${window.location.host}${n.$.appSubUrl}`}function i(d){let h=d.replace(c(),"");return h.startsWith("/")?h.substring(1,h.length):h}const l=(0,t.A)(async function(d){try{return(await(0,o.AI)().post("/api/short-urls",{path:i(d)})).url}catch(h){console.error("Error when creating shortened link: ",h),(0,g.JD)((0,s.dx)((0,r.gi)("Error generating shortened link")))}}),f=async d=>{const h=await l(d);h?((0,u.uJ)(h),(0,g.JD)((0,s.dx)((0,r.tZ)("Shortened link copied to clipboard")))):(0,g.JD)((0,s.dx)((0,r.gi)("Error generating shortened link")))}},92247:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{getPrecision:()=>r,getScaledDecimals:()=>n,getStringPrecision:()=>g,grafanaTimeFormat:()=>o,logp:()=>s,tickStep:()=>t});function t(u,c,i){const l=Math.sqrt(50),f=Math.sqrt(10),d=Math.sqrt(2),h=Math.abs(c-u)/Math.max(0,i);let p=Math.pow(10,Math.floor(Math.log(h)/Math.LN10));const m=h/p;return m>=l?p*=10:m>=f?p*=5:m>=d&&(p*=2),c<u?-p:p}function n(u,c){return u-Math.floor(Math.log(c)/Math.LN10)}function o(u,c,i){if(c&&i&&u){const l=i-c,f=l/u/1e3,d=864e5,h=31536e6;return f<=45?"HH:mm:ss":f<=7200||l<=d?"HH:mm":f<=8e4?"MM/DD HH:mm":f<=2419200||l<=h?"MM/DD":"YYYY-MM"}return"HH:mm"}function s(u,c){return Math.log(u)/Math.log(c)}function r(u){const c=u.toString();return g(c)}function g(u){if(isNaN(u))return 0;const c=u.indexOf(".");return c===-1?0:u.length-c-1}},80582:(Q,A,e)=>{"use strict";e.d(A,{Wb:()=>n,Zk:()=>o,zG:()=>s});var t=e(47232);const n=(r,g)=>{const u={from:(0,t.yT)(g.from),to:(0,t.yT)(g.to)},c=(u.to.valueOf()-u.from.valueOf())/2;let i,l;return r===-1?(i=u.to.valueOf()-c,l=u.from.valueOf()-c):r===1?(i=u.to.valueOf()+c,l=u.from.valueOf()+c,i>Date.now()&&u.to.valueOf()<Date.now()&&(i=Date.now(),l=u.from.valueOf())):(i=u.to.valueOf(),l=u.from.valueOf()),{from:l,to:i}},o=(r,g)=>{const u=r.to.valueOf()-r.from.valueOf(),c=r.to.valueOf()-u/2,i=u===0?3e4:u*g,l=c+i/2;return{from:c-i/2,to:l}};async function s(){const r=await navigator.clipboard.readText();let g;try{return g=JSON.parse(r),!g.from||!g.to?{range:r,isError:!0}:{range:g,isError:!1}}catch{return{range:r,isError:!0}}}},94515:(Q,A,e)=>{"use strict";e.d(A,{iU:()=>n});var t=e(47232);function n(r,g){if(!(r.fromDayOfWeek||r.from)&&!(r.toDayOfWeek||r.to))return[];const u={...r};u.from&&!u.to&&(u.to=u.from),!u.from&&u.to&&(u.from=u.to);const c={from:o(u.from),to:o(u.to)};if(!u.fromDayOfWeek&&u.toDayOfWeek&&(u.fromDayOfWeek=u.toDayOfWeek),!u.toDayOfWeek&&u.fromDayOfWeek&&(u.toDayOfWeek=u.fromDayOfWeek),u.fromDayOfWeek&&(c.from.dayOfWeek=Number(u.fromDayOfWeek)),u.toDayOfWeek&&(c.to.dayOfWeek=Number(u.toDayOfWeek)),c.from.dayOfWeek&&c.from.h==null&&c.from.m==null&&(c.from.h=0,c.from.m=0,c.from.s=0),c.to.dayOfWeek&&c.to.h==null&&c.to.m==null&&(c.to.h=23,c.to.m=59,c.to.s=59),!c.from||!c.to)return[];c.from.h==null&&(c.from.h=0),c.to.h==null&&(c.to.h=23);const i=[],l=(0,t.KQ)(g.from).utc();for(l.set("hour",0),l.set("minute",0),l.set("second",0),l.set("millisecond",0),l.add(c.from.h,"hours"),l.add(c.from.m,"minutes"),l.add(c.from.s,"seconds");l.unix()<=g.to.unix();){for(;c.from.dayOfWeek&&c.from.dayOfWeek!==l.isoWeekday();)l.add(24,"hours");if(l.unix()>g.to.unix())break;const f=(0,t.KQ)(l).utc();if(f.hour)if(c.from.h<=c.to.h)f.add(c.to.h-c.from.h,"hours");else if(c.from.h>c.to.h)for(;f.hour()!==c.to.h;)f.add(1,"hours");else for(f.add(24-c.from.h,"hours");f.hour()!==c.to.h;)f.add(1,"hours");for(f.set("minute",c.to.m??0),f.set("second",c.to.s??0);c.to.dayOfWeek&&c.to.dayOfWeek!==f.isoWeekday();)f.add(24,"hours");l.unix()<g.from.unix()&&f.unix()<g.from.unix()||l.unix()>g.to.unix()&&f.unix()>g.to.unix()||i.push({from:l.valueOf(),to:f.valueOf()}),l.add(24,"hours")}return i}function o(r){const g={};if(!r?.length)return g;const u=r.split(":");return u?.length&&(g.h=Math.min(23,Math.max(0,Number(u[0]))),u.length>1&&(g.m=Math.min(60,Math.max(0,Number(u[1]))),u.length>2&&(g.s=Math.min(60,Math.max(0,Number(u[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}},67027:(Q,A,e)=>{"use strict";e.d(A,{r:()=>n});let t="";const n=()=>{const s=new URLSearchParams(window.location.search).get("auth_token");return s!==null&&s!==""?(t=s,s):t}},5133:(Q,A,e)=>{"use strict";e.d(A,{r:()=>g});var t=e(96540),n=e(62625),o=e(88323);const r=Object.values(n.X).filter(u=>u!==n.X.None).map(u=>({label:u,value:u}));function g({value:u,onChange:c,"aria-label":i,inputId:l,autoFocus:f,...d}){return t.createElement(o.l6,{inputId:l,value:u,options:r,onChange:h=>c(h.value),placeholder:"Choose role...","aria-label":i,autoFocus:f,...d})}},57334:(Q,A,e)=>{"use strict";e.d(A,{$u:()=>V,A5:()=>Y,Bc:()=>ee,DX:()=>U,JI:()=>P,Jc:()=>R,Kg:()=>L,MV:()=>a,N6:()=>D,P3:()=>y,Pi:()=>M,T$:()=>I,TK:()=>p,VR:()=>x,Vk:()=>_,hG:()=>E,hU:()=>H,is:()=>re,kz:()=>d,ly:()=>m,mI:()=>O,nM:()=>N,nh:()=>C,nr:()=>v,pm:()=>S,xq:()=>j,yd:()=>G});var t=e(2543),n=e.n(t),o=e(72724),s=e(33378),r=e(17172),g=e(12131),u=e(2913),c=e(10096),i=e(80714),l=e(80348),f=e(44672);function d(J){return async ne=>{try{ne((0,f.D1)(!1)),await ne(h(J)),await ne(b(J)),await ne(T(J)),u.Ay.ldapEnabled&&(0,s.a)("ldapsync")&&await ne(S()),ne((0,f.D1)(!0))}catch(q){if(console.error(q),(0,r.NF)(q)){const te={title:q.data.message,body:q.data.error};ne((0,f.PV)(te))}}}}function h(J){return async ne=>{const q=await(0,r.AI)().get(`/api/users/${J}`,(0,i.F)());ne((0,f.G_)(q))}}function p(J){return async ne=>{await(0,r.AI)().put(`/api/users/${J.id}`,J),ne(d(J.id))}}function m(J,ne){return async q=>{const te={password:ne};await(0,r.AI)().put(`/api/admin/users/${J}/password`,te),q(d(J))}}function a(J){return async ne=>{await(0,r.AI)().post(`/api/admin/users/${J}/disable`),g.Ny.push("/admin/users")}}function v(J){return async ne=>{await(0,r.AI)().post(`/api/admin/users/${J}/enable`),ne(d(J))}}function E(J){return async ne=>{await(0,r.AI)().delete(`/api/admin/users/${J}`),g.Ny.push("/admin/users")}}function D(J,ne){return async q=>{const te={isGrafanaAdmin:ne};await(0,r.AI)().put(`/api/admin/users/${J}/permissions`,te),q(d(J))}}function b(J){return async ne=>{const q=await(0,r.AI)().get(`/api/users/${J}/orgs`);ne((0,f.OF)(q))}}function C(J,ne,q){return async te=>{const oe={loginOrEmail:J.login,role:q};await(0,r.AI)().post(`/api/orgs/${ne}/users/`,oe),te(d(J.id))}}function y(J,ne,q){return async te=>{const oe={role:q};await(0,r.AI)().patch(`/api/orgs/${ne}/users/${J}`,oe),te(d(J))}}function M(J,ne){return async q=>{await(0,r.AI)().delete(`/api/orgs/${ne}/users/${J}`),q(d(J))}}function T(J){return async ne=>{if(!c.TP.hasPermission(l.AccessControlAction.UsersAuthTokenList))return;const q=await(0,r.AI)().get(`/api/admin/users/${J}/auth-tokens`);q.reverse();const te=q.map(oe=>({id:oe.id,isActive:oe.isActive,seenAt:(0,o.fq)(oe.seenAt),createdAt:oe.createdAt,clientIp:oe.clientIp,browser:oe.browser,browserVersion:oe.browserVersion,os:oe.os,osVersion:oe.osVersion,device:oe.device}));ne((0,f.ag)(te))}}function I(J,ne){return async q=>{const te={authTokenId:J};await(0,r.AI)().post(`/api/admin/users/${ne}/revoke-auth-token`,te),q(T(ne))}}function x(J){return async ne=>{await(0,r.AI)().post(`/api/admin/users/${J}/logout`),ne(T(J))}}function S(){return async J=>{const ne=c.TP.hasPermission(l.AccessControlAction.LDAPStatusRead);if((0,s.a)("ldapsync")&&ne){const q=await(0,r.AI)().get("/api/admin/ldap-sync-status");J((0,f.OR)(q))}}}function O(J){return async ne=>{await(0,r.AI)().post(`/api/admin/ldap/sync/${J}`),ne(d(J))}}function P(){return async J=>{if(c.TP.hasPermission(l.AccessControlAction.LDAPStatusRead))try{const ne=await(0,r.AI)().get("/api/admin/ldap/status");J((0,f.pH)(ne))}catch(ne){if((0,r.NF)(ne)){ne.isHandled=!0;const q={title:ne.data.message,body:ne.data.error};J((0,f.V$)(q))}}}}function L(J){return async ne=>{try{const q=await(0,r.AI)().get(`/api/admin/ldap/${encodeURIComponent(J)}`),{name:te,surname:oe,email:ue,login:ie,isGrafanaAdmin:ge,isDisabled:he,roles:De,teams:pe}=q,le={info:{name:te,surname:oe,email:ue,login:ie},permissions:{isGrafanaAdmin:ge,isDisabled:he},roles:De,teams:pe};ne((0,f.TW)(le))}catch(q){if((0,r.NF)(q)){q.isHandled=!0;const te={title:q.data.message,body:q.data.error};ne((0,f.Vv)()),ne((0,f.Nf)(te))}}}}function U(){return J=>{J((0,f.zi)())}}function R(){return J=>{J((0,f.zi)()),J((0,f.Vv)())}}const B=J=>J.map(ne=>Array.isArray(ne.value)?ne.value.map(q=>`${ne.name}=${q.value}`).join("&"):`${ne.name}=${ne.value}`).join("&");function H(){return async(J,ne)=>{try{const{perPage:q,page:te,query:oe,filters:ue,sort:ie}=ne().userListAdmin;let ge=`/api/users/search?perpage=${q}&page=${te}&query=${oe}&${B(ue)}`;ie&&(ge+=`&sort=${ie}`);const he=await(0,r.AI)().get(ge);J((0,f.Mb)(he))}catch(q){(0,f.g4)(),console.error(q)}}}const w=(0,t.debounce)(J=>J(H()),500);function N(J){return async ne=>{ne((0,f.Cj)()),ne((0,f.L5)(J)),w(ne)}}function V(J){return async ne=>{ne((0,f.Cj)()),ne((0,f.jX)(J)),w(ne)}}function G(J){return async ne=>{ne((0,f.Cj)()),ne((0,f.EC)(J)),ne(H())}}function _({sortBy:J}){const ne=J.length?`${J[0].id}-${J[0].desc?"desc":"asc"}`:void 0;return async(q,te)=>{te().userListAdmin.sort!==ne&&(q((0,f.Cj)()),q((0,f.$u)(ne)),q(H()))}}const K=J=>J.map(ne=>Array.isArray(ne.value)?ne.value.map(q=>`${ne.name}=${q.value}`).join("&"):`${ne.name}=${ne.value}`).join("&");function j(){return async(J,ne)=>{try{const{perPage:q,page:te,query:oe,filters:ue,sort:ie}=ne().userListAnonymousDevices;let ge=`/api/anonymous/search?perpage=${q}&page=${te}&query=${oe}&${K(ue)}`;ie&&(ge+=`&sort=${ie}`);const he=await(0,r.AI)().get(ge);J((0,f.o3)(he))}catch(q){console.error(q)}}}const k=(0,t.debounce)(J=>J(j()),500);function Y({sortBy:J}){const ne=J.length?`${J[0].id}-${J[0].desc?"desc":"asc"}`:void 0;return async(q,te)=>{te().userListAnonymousDevices.sort!==ne&&(q((0,f.kh)(ne)),q(j()))}}function ee(J){return async ne=>{ne((0,f.xx)(J)),k(ne)}}function re(J){return async ne=>{ne((0,f.iK)(J)),ne(j())}}},44672:(Q,A,e)=>{"use strict";e.d(A,{$u:()=>O,Ay:()=>V,Cj:()=>M,D1:()=>v,EC:()=>x,G_:()=>p,L5:()=>I,Mb:()=>y,Nf:()=>i,OF:()=>m,OR:()=>c,PV:()=>E,TW:()=>l,V$:()=>u,Vv:()=>r,ag:()=>a,g4:()=>T,iK:()=>H,jX:()=>S,kh:()=>B,o3:()=>R,pH:()=>g,xx:()=>w,zi:()=>s});var t=e(30038);const n={connectionInfo:[],syncInfo:void 0,user:void 0,connectionError:void 0,userError:void 0},o=(0,t.Z0)({name:"ldap",initialState:n,reducers:{ldapConnectionInfoLoadedAction:(G,_)=>({...G,ldapError:void 0,connectionInfo:_.payload}),ldapFailedAction:(G,_)=>({...G,ldapError:_.payload}),ldapSyncStatusLoadedAction:(G,_)=>({...G,syncInfo:_.payload}),userMappingInfoLoadedAction:(G,_)=>({...G,user:_.payload,userError:void 0}),userMappingInfoFailedAction:(G,_)=>({...G,user:void 0,userError:_.payload}),clearUserMappingInfoAction:(G,_)=>({...G,user:void 0}),clearUserErrorAction:(G,_)=>({...G,userError:void 0})}}),{clearUserErrorAction:s,clearUserMappingInfoAction:r,ldapConnectionInfoLoadedAction:g,ldapFailedAction:u,ldapSyncStatusLoadedAction:c,userMappingInfoFailedAction:i,userMappingInfoLoadedAction:l}=o.actions,f=o.reducer,d={user:void 0,sessions:[],orgs:[],isLoading:!0,error:void 0},h=(0,t.Z0)({name:"userAdmin",initialState:d,reducers:{userProfileLoadedAction:(G,_)=>({...G,user:_.payload}),userOrgsLoadedAction:(G,_)=>({...G,orgs:_.payload}),userSessionsLoadedAction:(G,_)=>({...G,sessions:_.payload}),userAdminPageLoadedAction:(G,_)=>({...G,isLoading:!_.payload}),userAdminPageFailedAction:(G,_)=>({...G,error:_.payload,isLoading:!1})}}),{userProfileLoadedAction:p,userOrgsLoadedAction:m,userSessionsLoadedAction:a,userAdminPageLoadedAction:v,userAdminPageFailedAction:E}=h.actions,D=h.reducer,b={users:[],query:"",page:0,perPage:50,totalPages:1,showPaging:!1,filters:[{name:"activeLast30Days",value:!1}],isLoading:!0},C=(0,t.Z0)({name:"userListAdmin",initialState:b,reducers:{usersFetched:(G,_)=>{const{totalCount:K,perPage:j,...k}=_.payload,Y=Math.ceil(K/j);return{...G,...k,totalPages:Y,perPage:j,showPaging:Y>1,isLoading:!1}},usersFetchBegin:G=>({...G,isLoading:!0}),usersFetchEnd:G=>({...G,isLoading:!1}),queryChanged:(G,_)=>({...G,query:_.payload,page:0}),pageChanged:(G,_)=>({...G,page:_.payload}),sortChanged:(G,_)=>({...G,page:0,sort:_.payload}),filterChanged:(G,_)=>{const{name:K,value:j}=_.payload;return G.filters.some(k=>k.name===K)?{...G,page:0,filters:G.filters.map(k=>k.name===K?{...k,value:j}:k)}:{...G,page:0,filters:[...G.filters,_.payload]}}}}),{usersFetched:y,usersFetchBegin:M,usersFetchEnd:T,queryChanged:I,pageChanged:x,filterChanged:S,sortChanged:O}=C.actions,P=C.reducer,L={devices:[],query:"",page:0,perPage:50,totalPages:1,showPaging:!1,filters:[{name:"activeLast30Days",value:!0}]},U=(0,t.Z0)({name:"userListAnonymousDevices",initialState:L,reducers:{usersAnonymousDevicesFetched:(G,_)=>{const{totalCount:K,perPage:j,...k}=_.payload,Y=Math.ceil(K/j);return{...G,...k,totalPages:Y,perPage:j,showPaging:Y>1}},anonQueryChanged:(G,_)=>({...G,query:_.payload,page:0}),anonPageChanged:(G,_)=>({...G,page:_.payload}),anonUserSortChanged:(G,_)=>({...G,page:0,sort:_.payload}),filterChanged:(G,_)=>{const{name:K,value:j}=_.payload;return G.filters.some(k=>k.name===K)?{...G,page:0,filters:G.filters.map(k=>k.name===K?{...k,value:j}:k)}:{...G,page:0,filters:[...G.filters,_.payload]}}}}),{usersAnonymousDevicesFetched:R,anonUserSortChanged:B,anonPageChanged:H,anonQueryChanged:w}=U.actions,N=U.reducer,V={ldap:f,userAdmin:D,userListAdmin:P,userListAnonymousDevices:N}},35538:(Q,A,e)=>{"use strict";e.d(A,{pL:()=>n,z5:()=>s});var t=e(32264);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 o(){const r=t.$.licenseInfo?.trialExpiry;return!!(r&&r>0)}const s=()=>o()&&t.$.featureToggles.featureHighlights},55907:(Q,A,e)=>{"use strict";e.d(A,{A:()=>E,p:()=>u});var t=e(2543),n=e.n(t),o=e(1062);const s=new o.tI({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 u=(D=>(D.IsAbove="gt",D.IsBelow="lt",D.IsOutsideRange="outside_range",D.IsWithinRange="within_range",D.HasNoValue="no_value",D))(u||{});const c=[{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"}],i=[{text:"OR",value:"or"},{text:"AND",value:"and"}],l=[{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"}],f=[{text:"Alerting",value:"alerting"},{text:"No Data",value:"no_data"},{text:"Keep Last State",value:"keep_state"},{text:"Ok",value:"ok"}],d=[{text:"Alerting",value:"alerting"},{text:"Keep Last State",value:"keep_state"}];function h(D){const b=new o.tI({type:D.type,defaultParams:[]});return new o.kW(D,b)}function p(D){return D.toLowerCase().replace(/_/g,"").split(" ")[0]}function m(D){switch(p(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 a(D,b){return(0,t.reduce)(D,(C,y)=>(y.metric!==void 0&&y.value!==void 0&&C.push(y.metric+"="+y.value),y.Metric!==void 0&&y.Value!==void 0&&C.push(y.Metric+"="+y.Value),C),[]).join(b)}function v(D){return(0,t.isArray)(D.data)?a(D.data,", "):(0,t.isArray)(D.data.evalMatches)?a(D.data.evalMatches,", "):D.data.error?"Error: "+D.data.error:""}const E={alertQueryDef:s,getStateDisplayModel:m,conditionTypes:r,evalFunctions:c,evalOperators:i,noDataModes:f,executionErrorModes:d,reducerTypes:l,createReducerPart:h,getAlertAnnotationInfo:v,alertStateSortScore:g}},1062:(Q,A,e)=>{"use strict";e.d(A,{Dw:()=>g,Wn:()=>r,kW:()=>s,tI:()=>o});var t=e(2543),n=e.n(t);class o{constructor(l){this.type=l.type,this.params=l.params,this.defaultParams=l.defaultParams,this.renderer=l.renderer,this.category=l.category,this.addStrategy=l.addStrategy}}class s{constructor(l,f){if(this.part=l,this.def=f,!this.def)throw{message:"Could not find query part "+l.type};l.params=l.params||(0,t.clone)(this.def.defaultParams),this.params=l.params,this.text="",this.updateText()}render(l){return this.def.renderer(this,l)}hasMultipleParamsInString(l,f){return l.indexOf(",")===-1?!1:this.def.params[f+1]&&this.def.params[f+1].optional}updateParam(l,f){if(this.hasMultipleParamsInString(l,f)){(0,t.each)(l.split(","),(d,h)=>{this.updateParam(d.trim(),h)});return}l===""&&this.def.params[f].optional?this.params.splice(f,1):this.params[f]=l,this.part.params=this.params,this.updateText()}updateText(){if(this.params.length===0){this.text=this.def.type+"()";return}let l=this.def.type+"(";l+=this.params.join(", "),l+=")",this.text=l}}function r(i,l){const f=i.def.type+"(",d=(0,t.map)(i.params,(h,p)=>{const m=i.def.params[p];return m.type==="time"&&h==="auto"&&(h="$__interval"),m.quote==="single"?"'"+h+"'":m.quote==="double"?'"'+h+'"':h});return l&&d.unshift(l),f+d.join(", ")+")"}function g(i,l){return l+" "+i.params[0]}function u(i,l){return i.params[0]}function c(i,l){return'"'+i.params[0]+'"'}},52806:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>y,lB:()=>l,EF:()=>p,L9:()=>m,cN:()=>E,NR:()=>D,of:()=>v,Ri:()=>a});var t=e(30038),n=e(47232),o=e(82960),s=e(88467),r=e(23770);const u=(0,o.combineReducers)({dataSources:(0,s.Xw)("dataSources",r.DC,({rulesSourceName:I})=>I).reducer,promRules:(0,s.Xw)("promRules",r.mB,({rulesSourceName:I})=>I).reducer,rulerRules:(0,s.Xw)("rulerRules",r.eB,({rulesSourceName:I})=>I).reducer,silences:(0,s.Xw)("silences",r.ly,I=>I).reducer,ruleForm:(0,o.combineReducers)({saveRule:(0,s.J7)("saveRule",r._$).reducer,existingRule:(0,s.J7)("existingRule",r.pT).reducer}),grafanaNotifiers:(0,s.J7)("grafanaNotifiers",r.mF).reducer,saveAMConfig:(0,s.J7)("saveAMConfig",r.RW).reducer,deleteAMConfig:(0,s.J7)("deleteAMConfig",r.nO).reducer,updateSilence:(0,s.J7)("updateSilence",r.a7).reducer,amAlerts:(0,s.Xw)("amAlerts",r.El,I=>I).reducer,folders:(0,s.Xw)("folders",r.Tp,I=>I).reducer,amAlertGroups:(0,s.Xw)("amAlertGroups",r.D3,I=>I).reducer,testReceivers:(0,s.J7)("testReceivers",r.bO).reducer,updateLotexNamespaceAndGroup:(0,s.J7)("updateLotexNamespaceAndGroup",r.LU).reducer,externalAlertmanagers:(0,o.combineReducers)({alertmanagerConfig:(0,s.J7)("alertmanagerConfig",r.ef).reducer,discoveredAlertmanagers:(0,s.J7)("discoveredAlertmanagers",r.IX).reducer}),managedAlertStateHistory:(0,s.J7)("managedAlertStateHistory",r.JH).reducer});var c=e(55907);const i={items:[],searchQuery:"",isLoading:!1},l={notificationChannelTypes:[],notificationChannel:{},notifiers:[]};function f(I,x){const S=c.A.getStateDisplayModel(x),O={...I,stateText:S.text,stateIcon:S.iconClass,stateClass:S.stateClass,stateAge:(0,n.KQ)(I.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 d=(0,t.Z0)({name:"alertRules",initialState:i,reducers:{loadAlertRules:I=>({...I,isLoading:!0}),loadedAlertRules:(I,x)=>{const O=x.payload.map(P=>f(P,P.state));return{...I,items:O,isLoading:!1}},setSearchQuery:(I,x)=>({...I,searchQuery:x.payload})}}),h=(0,t.Z0)({name:"notificationChannel",initialState:l,reducers:{setNotificationChannels:(I,x)=>({...I,notificationChannelTypes:T(x.payload),notifiers:x.payload}),notificationChannelLoaded:(I,x)=>{const S=x.payload,P=I.notifiers.find(L=>L.type===S.type).options.filter(L=>L.secure);return P.length>0&&P.some(L=>S.settings[L.propertyName]!=="")?M(I,x.payload,P):{...I,notificationChannel:S}},resetSecureField:(I,x)=>({...I,notificationChannel:{...I.notificationChannel,secureFields:{...I.notificationChannel.secureFields,[x.payload]:!1}}})}}),{loadAlertRules:p,loadedAlertRules:m,setSearchQuery:a}=d.actions,{setNotificationChannels:v,notificationChannelLoaded:E,resetSecureField:D}=h.actions,b=d.reducer,C=h.reducer,y={alertRules:b,notificationChannel:C,unifiedAlerting:u};function M(I,x,S){const O={},P={};return S.forEach(L=>{P[L.propertyName]=x.settings[L.propertyName],O[L.propertyName]=""}),{...I,notificationChannel:{...x,settings:{...x.settings,...O},secureSettings:{...P}}}}function T(I){return I.map(x=>({value:x.type,label:x.name,...x,typeName:x.type})).sort((x,S)=>x.name>S.name?1:-1)}},25027:(Q,A,e)=>{"use strict";e.d(A,{AK:()=>M,FF:()=>d,Ke:()=>a,QA:()=>h,SN:()=>y,Sq:()=>D,U7:()=>p,fH:()=>l,le:()=>c,vV:()=>f});var t=e(47232),n=e(34867),o=e(17172),s=e(32264),r=e(14110),g=e(10096);const u=7,c={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"},i=(0,n.DW)("features.alerting",{module:"Alerting"});function l(T,I){i.logInfo(T,I)}function f(T,I){i.logError(T,I)}function d(T,I){i.logWarning(T,I)}function h(T,I,x){return async function(...S){const O=performance.now(),P=await T(...S);return l(I,{loadTimeMs:(performance.now()-O).toFixed(0),...x}),P}}function p(T,I,x){return async(...S)=>{const O=performance.now(),P=await T(...S),{namespacesCount:L,groupsCount:U,rulesCount:R}=m(P);return l(I,{loadTimeMs:(performance.now()-O).toFixed(0),namespacesCount:L,groupsCount:U,rulesCount:R,...x}),P}}function m(T){const I=T.length,x=T.flatMap(P=>P.groups).length,S=T.flatMap(P=>P.groups).flatMap(P=>P.rules).length;return{namespacesCount:I.toFixed(0),groupsCount:x.toFixed(0),rulesCount:S.toFixed(0)}}function a(T,I,x){return async(...S)=>{const O=performance.now(),P=await T(...S),{namespacesCount:L,groupsCount:U,rulesCount:R}=v(P);return l(I,{loadTimeMs:(performance.now()-O).toFixed(0),namespacesCount:L,groupsCount:U,rulesCount:R,...x}),P}}function v(T){const I=Object.keys(T).length,x=Object.values(T).flatMap(O=>O),S=x.flatMap(O=>O.rules);return{namespacesCount:I.toFixed(0),groupsCount:x.length.toFixed(0),rulesCount:S.length.toFixed(0)}}async function E(){try{const{createdAt:T}=await(0,o.AI)().get("/api/user"),I=(0,t.KQ)().subtract(u,"days"),x=(0,t.KQ)(T);return I.isBefore(x)}catch{return!0}}const D=async(T={grafana_version:s.$.buildInfo.version,org_id:g.TP.user.orgId,user_id:g.TP.user.id})=>{await E()||(0,r.rR)("grafana_alerting_navigation",T)},b=async T=>{await E()||reportInteraction("grafana_alerting_rule_creation",T)},C=async T=>{await E()||reportInteraction("grafana_alerting_rule_aborted",T)},y=async T=>{await E()||(0,r.rR)("grafana_alerting_rule_form_error",T)},M=async T=>{const I={grafana_version:s.$.buildInfo.version,org_id:g.TP.user.orgId,user_id:g.TP.user.id};(0,r.rR)("grafana_alerting_insights",{...I,...T})}},79741:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{default:()=>C,defaultPageNav:()=>v});var t=e(96540),n=e(32264),o=e(17172),s=e(42418),r=e(66602),g=e(27921),u=e(7392),c=e(33450),i=e(56812),l=e(730),f=e(56361),d=e(18461);const h=(0,g.A)(()=>e.e(21).then(e.bind(e,90021))),p=t.lazy(()=>Promise.resolve().then(e.bind(e,51174))),m=!!n.$.featureToggles?.alertingDetailsViewV2,a=y=>m?t.createElement(D,{...y}):t.createElement(E,{...y}),v={id:"alert-rule-view",text:""},E=y=>t.createElement(h,{...y}),D=y=>{const M=(0,d.uE)(y.match.params),T=t.useMemo(()=>{if(!M)throw new Error("Rule ID is required");return(0,d.qg)(M,!0)},[M]),{loading:I,error:x,result:S}=(0,l.ZU)({ruleIdentifier:T});return x?t.createElement(c.d,{pageNav:v,navId:"alert-list"},t.createElement(b,{error:x})):I?t.createElement(c.d,{pageNav:v,navId:"alert-list",isLoading:!0},t.createElement(t.Fragment,null)):S?t.createElement(i.K,{identifier:T,rule:S},t.createElement(p,null)):null};function b({error:y}){return(0,o.NF)(y)&&y.status===404?t.createElement(u.L,{entity:"Rule"}):t.createElement(s.F,{title:"Something went wrong loading the rule"},(0,f.JZ)(y))}const C=(0,r.Xc)(a,{style:"page"})},79938:(Q,A,e)=>{"use strict";e.d(A,{hK:()=>i});var t=e(57220),n=e(75214),o=e(23662),s=e(49962),r=e(49498),g=e(28220);const u="/api/v1/rule/test/grafana",c="api/prometheus/grafana/api/v1/rules",i=s.H.injectEndpoints({endpoints:l=>({preview:l.mutation({query:({alertQueries:f,condition:d,customLabels:h,folder:p,alertName:m,alertUid:a})=>({url:u,data:{rule:{grafana_alert:{data:f,condition:d,no_data_state:"Alerting",title:m,uid:a??"N/A"},for:"0s",labels:(0,n.x4)(h),annotations:{}},folderUid:p.uid,folderTitle:p.title},method:"POST"})}),prometheusRulesByNamespace:l.query({query:({limitAlerts:f,identifier:d,filter:h,state:p,matcher:m})=>{const a=new URLSearchParams;f&&a.set("limit_alerts",String(f)),d&&((0,o.Mj)(d)||(0,o.X4)(d))&&(a.set("file",d.namespace),a.set("rule_group",d.groupName));const v=(0,r.bZ)(a,h);return{url:c,params:(0,r.Dj)(v,p,m)}},transformResponse:f=>(0,r.lH)(f.data.groups,t.hY)}),prometheusRuleNamespaces:l.query({query:({ruleSourceName:f,namespace:d,groupName:h,ruleName:p,dashboardUid:m})=>{const a={file:d,rule_group:h,rule_name:p,dashboard_uid:m};return{url:`api/prometheus/${(0,t.w5)(f)}/api/v1/rules`,params:a}},transformResponse:(f,d,h)=>(0,r.lH)(f.data.groups,h.ruleSourceName)}),rulerRules:l.query({query:({rulerConfig:f,filter:d})=>{const{path:h,params:p}=(0,g.$o)(f).rules(d);return{url:h,params:p}}}),rulerRuleGroup:l.query({query:({rulerConfig:f,namespace:d,group:h})=>{const{path:p,params:m}=(0,g.$o)(f).namespaceGroup(d,h);return{url:p,params:m}}}),exportRules:l.query({query:({format:f,folderUid:d,group:h,ruleUid:p})=>({url:"/api/ruler/grafana/api/v1/export/rules",params:{format:f,folderUid:d,group:h,ruleUid:p},responseType:"text"}),keepUnusedDataFor:0}),exportReceiver:l.query({query:({receiverName:f,decrypt:d,format:h})=>({url:"/api/v1/provisioning/contact-points/export/",params:{format:h,decrypt:d,name:f},responseType:"text"}),keepUnusedDataFor:0}),exportReceivers:l.query({query:({decrypt:f,format:d})=>({url:"/api/v1/provisioning/contact-points/export/",params:{format:d,decrypt:f},responseType:"text"}),keepUnusedDataFor:0}),exportPolicies:l.query({query:({format:f})=>({url:"/api/v1/provisioning/policies/export/",params:{format:f},responseType:"text"}),keepUnusedDataFor:0}),exportModifiedRuleGroup:l.mutation({query:({payload:f,format:d,nameSpaceUID:h})=>({url:`/api/ruler/grafana/api/v1/rules/${h}/export/`,params:{format:d},responseType:"text",data:f,method:"POST"})}),exportMuteTimings:l.query({query:({format:f})=>({url:"/api/v1/provisioning/mute-timings/export/",params:{format:f},responseType:"text"}),keepUnusedDataFor:0}),exportMuteTiming:l.query({query:({format:f,muteTiming:d})=>({url:`/api/v1/provisioning/mute-timings/${d}/export/`,params:{format:f},responseType:"text"}),keepUnusedDataFor:0})})})},49962:(Q,A,e)=>{"use strict";e.d(A,{H:()=>g});var t=e(93020),n=e(75505),o=e(17172),s=e(25027);const r=()=>async u=>{try{const c=performance.now(),{data:i,...l}=await(0,n.s)((0,o.AI)().fetch(u));return(0,s.fH)("Request finished",{loadTimeMs:(performance.now()-c).toFixed(0),url:u.url,method:u.method??"",responseStatus:l.statusText}),{data:i,meta:l}}catch(c){return{error:c}}},g=(0,t.xP)({reducerPath:"alertingApi",baseQuery:r(),tagTypes:["AlertmanagerChoice","AlertmanagerConfiguration","OnCallIntegrations","OrgMigrationState","DataSourceSettings"],endpoints:()=>({})})},32415:(Q,A,e)=>{"use strict";e.d(A,{By:()=>m,Bz:()=>i,Mn:()=>d,VO:()=>p,Vv:()=>y,WS:()=>g,Wf:()=>C,_P:()=>b,as:()=>l,dk:()=>f,f4:()=>h,nd:()=>c,vk:()=>u});var t=e(75505),n=e(76885),o=e(39070),s=e(17172),r=e(57220);async function g(T){try{const I=await(0,t.s)((0,s.AI)().fetch({url:`/api/alertmanager/${(0,r.w5)(T)}/config/api/v1/alerts`,showErrorAlert:!1,showSuccessAlert:!1}));return{template_files:I.data.template_files??{},template_file_provenances:I.data.template_file_provenances??{},alertmanager_config:I.data.alertmanager_config??{},last_applied:I.data.last_applied,id:I.data.id}}catch(I){if(T===r.hY&&(0,s.NF)(I)&&I.data?.message?.includes("could not find an Alertmanager configuration"))return{template_files:{},alertmanager_config:{}};throw I}}async function u(T,I){await(0,t.s)((0,s.AI)().fetch({method:"POST",url:`/api/alertmanager/${(0,r.w5)(T)}/config/api/v1/alerts`,data:I,showErrorAlert:!1,showSuccessAlert:!1}))}async function c(T){await(0,t.s)((0,s.AI)().fetch({method:"DELETE",url:`/api/alertmanager/${(0,r.w5)(T)}/config/api/v1/alerts`,showErrorAlert:!1,showSuccessAlert:!1}))}async function i(T){return(await(0,t.s)((0,s.AI)().fetch({url:`/api/alertmanager/${(0,r.w5)(T)}/api/v2/silences`,showErrorAlert:!1,showSuccessAlert:!1}))).data}async function l(T,I){return(await(0,t.s)((0,s.AI)().fetch({url:`/api/alertmanager/${(0,r.w5)(T)}/api/v2/silences`,data:I,showErrorAlert:!1,showSuccessAlert:!1,method:"POST"}))).data}async function f(T,I){await(0,s.AI)().delete(`/api/alertmanager/${(0,r.w5)(T)}/api/v2/silence/${encodeURIComponent(I)}`)}async function d(T,I,x=!0,S=!0,O=!0){const P=n.kM.toUrlParams({silenced:x,active:S,inhibited:O})+I?.map(U=>`filter=${encodeURIComponent(`${M(U.name)}=${U.isRegex?"~":""}"${M(U.value)}"`)}`).join("&")||"";return(await(0,t.s)((0,s.AI)().fetch({url:`/api/alertmanager/${(0,r.w5)(T)}/api/v2/alerts`+(P?"?"+P:""),showErrorAlert:!1,showSuccessAlert:!1}))).data}async function h(T){return(await(0,t.s)((0,s.AI)().fetch({url:`/api/alertmanager/${(0,r.w5)(T)}/api/v2/alerts/groups`,showErrorAlert:!1,showSuccessAlert:!1}))).data}async function p(T){return(await(0,t.s)((0,s.AI)().fetch({url:`/api/alertmanager/${(0,r.w5)(T)}/api/v2/status`,showErrorAlert:!1,showSuccessAlert:!1}))).data}async function m(T,I,x){const S={receivers:I,alert:x};try{const O=await(0,t.s)((0,s.AI)().fetch({method:"POST",data:S,url:`/api/alertmanager/${(0,r.w5)(T)}/config/api/v1/receivers/test`,showErrorAlert:!1,showSuccessAlert:!1}));if(a(O.data))throw new Error(D(O.data))}catch(O){throw(0,s.NF)(O)&&v(O.data)&&a(O.data)?new Error(D(O.data)):O}}function a(T){return T.receivers.some(I=>I.grafana_managed_receiver_configs.some(x=>x.status==="failed"))}function v(T){return(0,o.Gv)(T)&&"receivers"in T&&Array.isArray(T.receivers)?T.receivers.every(E):!1}function E(T){return(0,o.Gv)(T)&&"name"in T&&typeof T.name=="string"&&"grafana_managed_receiver_configs"in T&&Array.isArray(T.grafana_managed_receiver_configs)}function D(T){return T.receivers.flatMap(I=>I.grafana_managed_receiver_configs.filter(x=>x.status==="failed").map(x=>x.error??"Unknown error.")).join("; ")}async function b(T){await(0,t.s)((0,s.AI)().fetch({method:"POST",data:T,url:"/api/v1/ngalert/admin_config",showErrorAlert:!1,showSuccessAlert:!1})).then(()=>{y()})}async function C(){return(await(0,t.s)((0,s.AI)().fetch({method:"GET",url:"/api/v1/ngalert/alertmanagers"}))).data}async function y(){return(await(0,t.s)((0,s.AI)().fetch({method:"GET",url:"/api/v1/ngalert/admin_config",showErrorAlert:!1}))).data}function M(T){return T.replace(/"/g,'\\"')}},82843:(Q,A,e)=>{"use strict";e.d(A,{m:()=>p});var t=e(2543),n=e.n(t),o=e(99140),s=e(25027),r=e(98164),g=e(57220),u=e(56361),c=e(88467),i=e(49962),l=e(32415),f=e(77583);const d=10,h=30*1e3,p=i.H.injectEndpoints({endpoints:m=>({getAlertmanagerAlerts:m.query({query:({amSourceName:a,filter:v})=>{const E=v?.matchers?.filter(I=>I.name&&I.value).map(I=>`${I.name}${(0,r.MN)(I)}${(0,u.Y9)(I.value)}`),{silenced:D,inhibited:b,unprocessed:C,active:y}=v||{},M=Object.fromEntries(Object.entries({silenced:D,active:y,inhibited:b,unprocessed:C}).filter(([I,x])=>x!==void 0)),T={filter:E};return M&&Object.keys(M).forEach(I=>{T[I]=M[I]}),{url:`/api/alertmanager/${(0,g.w5)(a)}/api/v2/alerts`,params:T}}}),getAlertmanagerAlertGroups:m.query({query:({amSourceName:a})=>({url:`/api/alertmanager/${(0,g.w5)(a)}/api/v2/alerts/groups`})}),grafanaNotifiers:m.query({query:()=>({url:"/api/alert-notifiers"})}),getAlertmanagerChoiceStatus:m.query({query:()=>({url:"/api/v1/ngalert"}),providesTags:["AlertmanagerChoice"]}),getExternalAlertmanagerConfig:m.query({query:()=>({url:"/api/v1/ngalert/admin_config"}),providesTags:["AlertmanagerChoice"]}),getExternalAlertmanagers:m.query({query:()=>({url:"/api/v1/ngalert/alertmanagers"}),transformResponse:a=>a.data}),saveExternalAlertmanagersConfig:m.mutation({query:a=>({url:"/api/v1/ngalert/admin_config",method:"POST",data:a}),invalidatesTags:["AlertmanagerChoice"]}),getValidAlertManagersConfig:m.query({query:()=>({url:`/api/alertmanager/${(0,g.w5)(g.hY)}/config/history?limit=${d}`})}),resetAlertManagerConfigToOldVersion:m.mutation({query:a=>({url:`/api/alertmanager/${(0,g.w5)(g.hY)}/config/history/${a.id}/_activate`,method:"POST"})}),getAlertmanagerConfiguration:m.query({queryFn:async a=>{const v=a===g.hY;if((0,g.AL)(a))return(0,c.$I)((0,l.VO)(a).then(T=>({data:{alertmanager_config:T.config,template_files:{}}})));const{data:D}=await(0,o.JD)(f.L.endpoints.discoverAmFeatures.initiate({amSourceName:a})),b={alertmanager_config:{},template_files:{},template_file_provenances:{}},C=D?.lazyConfigInit??!1,y=(0,s.QA)(l.WS,`[${a}] Alertmanager config loaded`,{dataSourceName:a,thunk:"unifiedalerting/fetchAmConfig"}),M=(0,u.i9)(()=>y(a),T=>!!(0,c.CZ)(T)?.includes("alertmanager storage object not found")&&!C,h).then(T=>v?T:(0,t.isEmpty)(T.alertmanager_config)&&(0,t.isEmpty)(T.template_files)?(0,l.VO)(a).then(x=>({alertmanager_config:x.config,template_files:{},template_file_provenances:T.template_file_provenances,last_applied:T.last_applied,id:T.id})):T).then(T=>T??b).then(T=>({data:T})).catch(T=>{if(C&&(0,c.CZ)(T)?.includes("alertmanager storage object not found"))return{data:b};throw T});return(0,c.$I)(M).catch(T=>({error:T,data:void 0}))},providesTags:["AlertmanagerConfiguration"]}),updateAlertmanagerConfiguration:m.mutation({query:({selectedAlertmanager:a,config:v,...E})=>({url:`/api/alertmanager/${(0,g.w5)(a)}/config/api/v1/alerts`,method:"POST",data:v,...E}),invalidatesTags:["AlertmanagerConfiguration"]}),getContactPointsStatus:m.query({query:()=>({url:`/api/alertmanager/${(0,g.w5)(g.hY)}/config/api/v1/receivers`}),transformResponse:a=>{const v=E=>E.startsWith("0001-01-01");return a.map(E=>({...E,integrations:E.integrations.map(D=>{const b=v(D.lastNotifyAttempt);return{...D,lastNotifyAttempt:b?"":D.lastNotifyAttempt,lastNotifyAttemptDuration:b?"":D.lastNotifyAttemptDuration}})}))}}),getContactPointsList:m.query({query:()=>({url:"/api/v1/notifications/receivers"})}),getMuteTimingList:m.query({query:()=>({url:"/api/v1/notifications/time-intervals"})})})})},92240:(Q,A,e)=>{"use strict";e.d(A,{O5:()=>f,_y:()=>l,nD:()=>c});var t=e(75505),n=e(17172),o=e(94822),s=e(55740),r=e(57220),g=e(49498),u=e(28220);async function c(v){if(v===r.hY)return{features:{rulerApiEnabled:!0}};const E=(0,r.oh)(v);if(!E)throw new Error(`Cannot find data source configuration for ${v}`);const{url:D,name:b,type:C}=E;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 i({name:b,url:D,type:C})}async function i(v){const{url:E,name:D,type:b}=v,C=b==="loki"?void 0:await h(E);if(!(C!==void 0)){if(!await p(D))throw new Error(`Unable to fetch alert rules. Is the ${D} data source properly configured?`);const I=await m(D);return{application:o.N1.Cortex,features:{rulerApiEnabled:I}}}const{features:M}=C.data;return M?{application:o.N1.Mimir,features:{rulerApiEnabled:M?.ruler_config_api==="true"}}:{application:o.N1.Prometheus,features:{rulerApiEnabled:!1}}}async function l(v){if(v===r.hY)return{lazyConfigInit:!1};const E=d(v),{url:D,type:b}=E;if(!D)throw new Error("The data source url cannot be empty.");if(b!=="alertmanager")throw new Error(`Alertmanager feature discovery is not available for ${b}. Only 'alertmanager' type is supported`);return await f(D)}async function f(v){try{return{lazyConfigInit:(await h(v))?.data?.application==="Grafana Mimir"}}catch{return{lazyConfigInit:!1}}}function d(v){const E=(0,r.oh)(v);if(!E)throw new Error(`Cannot find data source configuration for ${v}`);return E}async function h(v){return(await(0,t.s)((0,n.AI)().fetch({url:`${v}/api/v1/status/buildinfo`,showErrorAlert:!1,showSuccessAlert:!1})).catch(D=>{if(!("status"in D&&D.status===404))throw D}))?.data}async function p(v){try{return await(0,g.sA)(v),!0}catch{return!1}}async function m(v){try{return await(0,u.Zp)(v),!0}catch(E){if(a(E))return!1;throw E}}function a(v){return(0,n.NF)(v)?v.data.message?.includes("GetRuleGroup unsupported in rule local store")||v.data.message?.includes("page not found")||v.data.message?.includes(s.UU):v instanceof Error&&v.message?.includes("404 from rules config endpoint")}},77583:(Q,A,e)=>{"use strict";e.d(A,{L:()=>g});var t=e(94822),n=e(25027),o=e(57220),s=e(49962),r=e(92240);const g=s.H.injectEndpoints({endpoints:u=>({discoverAmFeatures:u.query({queryFn:async({amSourceName:c})=>{try{return{data:await(0,r._y)(c)}}catch(i){return{error:i}}}}),discoverDsFeatures:u.query({queryFn:async({rulesSourceName:c})=>{const i=(0,o.Jz)(c);if(!i)return{error:new Error(`Missing data source configuration for ${c}`)};const f=await(0,n.QA)(r.nD,`[${c}] Rules source features discovered`,{dataSourceName:c,endpoint:"unifiedalerting/featureDiscoveryApi/discoverDsFeatures"})(i.name);return{data:{rulerConfig:f.features.rulerApiEnabled?{dataSourceName:i.name,apiVersion:f.application===t.N1.Cortex?"legacy":"config"}:void 0}}}})})})},68788:(Q,A,e)=>{"use strict";e.d(A,{Es:()=>s,pB:()=>c});var t=e(75505),n=e(17172),o=e(57220);function s(){return(0,n.AI)().get("/api/alert-notifiers")}const r=i=>{const l=i.match(/^(\w+)(\[\d+\])?$/);return l?{type:l[1],index:l[2]}:{type:i,index:void 0}},g=i=>{const l={receivers:{},errorCount:0};i.forEach(d=>{l.receivers[d.name]={active:d.active,notifiers:{},errorCount:0};const h=l.receivers[d.name];d.integrations.forEach(p=>{!!p?.lastNotifyAttemptError&&(h.errorCount+=1);const a=u(p.name);a&&(h.notifiers[a]||(h.notifiers[a]=[]),h.notifiers[a].push(p))})});const f=Object.values(l.receivers).reduce((d,h)=>d+h.errorCount,0);return{...l,errorCount:f}},u=i=>r(i)?.type;async function c(i){try{const l=await(0,t.s)((0,n.AI)().fetch({url:`/api/alertmanager/${(0,o.w5)(i)}/config/api/v1/receivers`,showErrorAlert:!1,showSuccessAlert:!1}));return g(l.data)}catch{return g([])}}},49498:(Q,A,e)=>{"use strict";e.d(A,{Dj:()=>u,bZ:()=>g,lH:()=>c,sA:()=>i});var t=e(75505),n=e(17172),o=e(57220),s=e(23662);function r(l){const{dataSourceName:f,limitAlerts:d,identifier:h}=l;return{rules:(p,m,a)=>{const v=new URLSearchParams;f===o.hY&&d&&v.set("limit_alerts",String(d)),h&&((0,s.Mj)(h)||(0,s.X4)(h))&&(v.set("file",h.namespace),v.set("rule_group",h.groupName));const E=g(v,p);return{url:`/api/prometheus/${(0,o.w5)(f)}/api/v1/rules`,params:u(E,m,a)}}}}function g(l,f){return f?.dashboardUID&&(l.set("dashboard_uid",f.dashboardUID),f?.panelId&&l.set("panel_id",String(f.panelId))),Object.fromEntries(l)}function u(l,f,d){let h={...l};if(f?.length&&(h={...h,state:f}),d?.length){const p=d.map(m=>JSON.stringify(m));h={...h,matcher:p}}return h}const c=(l,f)=>{const d={};return l.forEach(h=>{h.rules.forEach(p=>{p.query=p.query||""}),d[h.file]?d[h.file].groups.push(h):d[h.file]={dataSourceName:f,name:h.file,groups:[h]}}),Object.values(d)};async function i(l,f,d,h,p,m){if(f?.dashboardUID&&l!==o.hY)throw new Error("Filtering by dashboard UID is only supported for Grafana Managed rules.");const{url:a,params:v}=r({dataSourceName:l,limitAlerts:d,identifier:m}).rules(f,p,h),E=await(0,t.s)((0,n.AI)().fetch({url:a,params:v,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 c(E.data.data.groups,l)}},28220:(Q,A,e)=>{"use strict";e.d(A,{$o:()=>u,AJ:()=>h,BK:()=>E,E8:()=>c,HO:()=>d,Zp:()=>f,iy:()=>i});var t=e(75505),n=e(39070),o=e(17172),s=e(55740),r=e(57220),g=e(49498);function u(D){const C=`${`/api/ruler/${(0,r.w5)(D.dataSourceName)}`}/api/v1/rules`,y=new URLSearchParams;return y.set("subtype",D.apiVersion==="legacy"?"cortex":"mimir"),{rules:M=>{const T=(0,g.bZ)(y,M);return{path:`${C}`,params:T}},namespace:M=>({path:`${C}/${encodeURIComponent(M)}`,params:Object.fromEntries(y)}),namespaceGroup:(M,T)=>({path:`${C}/${encodeURIComponent(M)}/${encodeURIComponent(T)}`,params:Object.fromEntries(y)})}}async function c(D,b,C){const{path:y,params:M}=u(D).namespace(b);await(0,t.s)((0,o.AI)().fetch({method:"POST",url:y,data:C,showErrorAlert:!1,showSuccessAlert:!1,params:M}))}async function i(D,b){if(b?.dashboardUID&&D.dataSourceName!==r.hY)throw new Error("Filtering by dashboard UID is only supported by Grafana.");const{path:C,params:y}=u(D).rules(b);return p(C,{},y)}async function l(D,b){const{path:C,params:y}=u(D).namespace(b);return(await p(C,{},y))[b]||[]}async function f(D){return p(`/api/ruler/${(0,r.w5)(D)}/api/v1/rules/test/test`,null)}async function d(D,b,C){const{path:y,params:M}=u(D).namespaceGroup(b,C);return p(y,null,M)}async function h(D,b,C){const{path:y,params:M}=u(D).namespaceGroup(b,C);await(0,t.s)((0,o.AI)().fetch({url:y,method:"DELETE",showSuccessAlert:!1,showErrorAlert:!1,params:M}))}async function p(D,b,C){try{return(await(0,t.s)((0,o.AI)().fetch({url:D,showErrorAlert:!1,showSuccessAlert:!1,params:C}))).data}catch(y){if(!m(y))throw y;if(v(y))return b;throw a(y)?{...y,data:{...y.data,message:s.UU}}:y}}function m(D){if(!(0,n.Gv)(D))return!1;const b="data"in D&&D.data!==null&&D.data!==void 0;return"status"in D&&Number.isFinite(D.status)&&b}function a(D){return D.status===404||D.status===500&&D.data.message?.includes("unexpected content type from upstream. expected YAML, got text/html")}function v(D){return D.status===404&&(D.data.message?.includes("group does not exist")||D.data.message?.includes("no rule groups found"))}async function E(D,b){const{path:C,params:y}=u(D).namespace(b);await(0,t.s)((0,o.AI)().fetch({method:"DELETE",url:C,showErrorAlert:!1,showSuccessAlert:!1,params:y}))}},15458:(Q,A,e)=>{"use strict";e.d(A,{R:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(29158);const r=({labelKey:u,value:c,operator:i="=",onRemoveLabel:l})=>{const f=(0,o.of)(g);return n.createElement("div",{className:f.wrapper},u,i,c,!!l&&n.createElement(s.K,{name:"times",size:"xs",onClick:l,tooltip:"Remove label"}))},g=u=>({wrapper:(0,t.css)` padding: ${u.spacing(.5,1)}; border-radius: ${u.shape.radius.default}; border: solid 1px ${u.colors.border.medium}; font-size: ${u.typography.bodySmall.fontSize}; background-color: ${u.colors.background.secondary}; font-weight: ${u.typography.fontWeightBold}; color: ${u.colors.text.primary}; display: inline-block; line-height: 1.2; `})},69087:(Q,A,e)=>{"use strict";e.d(A,{m:()=>f});var t=e(32196),n=e(2543),o=e.n(n),s=e(55127),r=e.n(s),g=e(96540),u=e(40845),c=e(55852),i=e(69613),l=e(8406);const f=({labels:m,commonLabels:a={},size:v})=>{const E=(0,u.of)(p,v),[D,b]=(0,g.useState)(!1),C=(0,n.chain)(m).toPairs().reject(h).reject(([T])=>D?!1:T in a).value(),y=Object.keys(a).length,M=y>0;return g.createElement("div",{className:E.wrapper,role:"list","aria-label":"Labels"},C.map(([T,I])=>g.createElement(l.J,{key:T+I,size:v,label:T,value:I,color:d(T)})),!D&&M&&g.createElement(c.$n,{variant:"secondary",fill:"text",onClick:()=>b(!0),tooltip:"Show common labels",tooltipPlacement:"top",size:"sm"},"+",y," common ",r()("label",y)),D&&M&&g.createElement(c.$n,{variant:"secondary",fill:"text",onClick:()=>b(!1),tooltipPlacement:"top",size:"sm"},"Hide common labels"))};function d(m){return(0,i.MC)(m).color}const h=([m,a])=>m.startsWith("__")&&m.endsWith("__"),p=(m,a)=>({wrapper:(0,t.css)` display: flex; flex-wrap: wrap; align-items: center; gap: ${a==="md"?m.spacing():m.spacing(.5)}; `})},33450:(Q,A,e)=>{"use strict";e.d(A,{d:()=>S,y:()=>O});var t=e(96540),n=e(87586),o=e(36830),s=e(32264),r=e(72109),g=e(32196),u=e(78685),c=e(40845),i=e(66864),l=e(56034),f=e(55852),d=e(42418);const h=({localStoreKey:U,startClosed:R=!1,severity:B="error",collapseText:H,collapseTooltip:w,collapseJustify:N="flex-end",alertTitle:V,children:G})=>{const _=(0,c.$j)(),K=p(_,B),[j,k]=(0,u.A)(U,R);return t.createElement(t.Fragment,null,j&&t.createElement(i.Gy,{justify:N},t.createElement(l.m,{content:w,placement:"bottom"},t.createElement(f.$n,{fill:"text",variant:"secondary",icon:(0,d.H)(B),className:K.warningButton,onClick:()=>k(!1)},H))),!j&&t.createElement(d.F,{severity:B,title:V,onRemove:()=>k(!0)},G))},p=(U,R)=>{const B=U.colors[R];return{warningButton:(0,g.css)({color:B.text,"&:hover":{background:B.transparent}})}},m="grafana.unifiedalerting.upgrade.previewNotice",a=()=>s.$.unifiedAlertingEnabled||!s.$.featureToggles.alertingPreviewUpgrade?null:t.createElement(h,{localStoreKey:m,alertTitle:"This is a preview of the upgraded Grafana Alerting",collapseText:"Grafana Alerting Preview",collapseTooltip:"Show preview warning",severity:"warning"},t.createElement("p",null,"No rules are being evaluated and legacy alerting is still running.",t.createElement("br",null),"Please contact your administrator to upgrade permanently."),t.createElement(r.Y,{external:!0,href:"https://grafana.com/docs/grafana/latest/alerting/set-up/migrating-alerts/"},"Read about upgrading"));var v=e(70383),E=e(14186),D=e(88323),b=e(57220);function C(U){return U.name===b.hY?"Grafana":U.name.slice(0,37)}const y=({disabled:U=!1})=>{const R=(0,c.of)(M),{selectedAlertmanager:B,availableAlertManagers:H,setSelectedAlertmanager:w}=(0,v.VI)(),N=(0,t.useMemo)(()=>H.map(V=>({label:C(V),value:V.name,imgUrl:V.imgUrl,meta:V.meta})),[H]);return t.createElement(E.I,{className:R.field,label:U?"Alertmanager":"Choose Alertmanager",disabled:U||N.length===1,"data-testid":"alertmanager-picker"},t.createElement(D.l6,{"aria-label":U?"Alertmanager":"Choose Alertmanager",width:29,className:"ds-picker select-container",backspaceRemovesValue:!1,onChange:V=>{V?.value&&w(V.value)},options:N,maxMenuHeight:500,noOptionsMessage:"No datasources found",value:B,getOptionLabel:V=>V.label}))},M=U=>({field:(0,g.css)` margin: 0; `}),T=()=>t.createElement(d.F,{title:"No Alertmanager found",severity:"warning"},"We could not find any external Alertmanagers and you may not have access to the built-in Grafana Alertmanager."),I=()=>t.createElement(d.F,{title:"Selected Alertmanager not found.",severity:"warning"},"The selected Alertmanager no longer exists or you may not have permission to access it. You can select a different Alertmanager from the dropdown."),x=({availableAlertManagers:U})=>{const R=U.length>0;return t.createElement("div",null,R?t.createElement(I,null):t.createElement(T,null))},S=({children:U,isLoading:R,...B})=>t.createElement(o.Y,{...B},t.createElement(o.Y.Contents,{isLoading:R},t.createElement("div",null,t.createElement(a,null),U))),O=({children:U,accessType:R,...B})=>{const H=P();return t.createElement(v.b9,{accessType:R},t.createElement(S,{...B,actions:t.createElement(y,{disabled:H})},t.createElement(L,null,U)))};function P(){const U=(0,n.A)();return["/edit","/new"].some(B=>U?.pathname?.includes(B))}const L=({children:U})=>{const{availableAlertManagers:R,selectedAlertmanager:B}=(0,v.VI)();return B?t.createElement(t.Fragment,null,U):t.createElement(x,{availableAlertManagers:R})}},71223:(Q,A,e)=>{"use strict";e.d(A,{s:()=>f});var t=e(32196),n=e(96540),o=e(56034),s=e(40845),r=e(72109),g=e(55740),u=e(84396),c=e(16577),i=e(73750);const l=["message","description"],f=({annotationKey:p,value:m,valueLink:a})=>{const v=g.J3[p]?n.createElement(o.m,{content:p,placement:"top",theme:"info"},n.createElement("span",null,g.J3[p])):p;return n.createElement(u.X,{label:v,horizontal:!0},n.createElement(d,{annotationKey:p,value:m,valueLink:a}))},d=({annotationKey:p,value:m,valueLink:a})=>{const v=(0,s.of)(h),E=l.includes(p),D=m&&m.startsWith("http"),b=n.createElement(c.Y,{input:m,delimiter:["{{","}}"]});return a?n.createElement(r.Y,{href:a,external:!0},m):E?n.createElement(i.L,{className:v.well},b):D?n.createElement(r.Y,{href:m,external:!0},m):n.createElement(n.Fragment,null,b)},h=p=>({well:(0,t.css)` word-break: break-word; `})},64047:(Q,A,e)=>{"use strict";e.d(A,{e:()=>o});var t=e(96540),n=e(55852);const o=({isCollapsed:s,onToggle:r,idControlled:g,className:u,text:c,size:i="xl",...l})=>t.createElement(n.$n,{type:"button",fill:"text",variant:"secondary","aria-expanded":!s,"aria-controls":g,className:u,icon:s?"angle-right":"angle-down",onClick:()=>r(!s),...l},c)},84396:(Q,A,e)=>{"use strict";e.d(A,{X:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({className:g,label:u,horizontal:c,children:i,childrenWrapperClassName:l})=>{const f=(0,o.of)(r);return n.createElement("div",{className:(0,t.cx)(f.field,c?f.fieldHorizontal:f.fieldVertical,g)},n.createElement("div",null,u),n.createElement("div",{className:l},i))},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}; } `})},75591:(Q,A,e)=>{"use strict";e.d(A,{E:()=>c});var t=e(32196),n=e(96540),o=e(40845),s=e(29158),r=e(19384),g=e(98439),u=e(22620);const c=({cols:l,items:f,isExpandable:d=!1,onCollapse:h,onExpand:p,isExpanded:m,renderExpandedContent:a,testIdGenerator:v,pagination:E,paginationStyles:D,renderPrefixCell:b,renderPrefixHeader:C,footerRow:y,dataTestId:M})=>{const T=(0,o.of)(u.H);if((h||p||m)&&!(h&&p&&m))throw new Error("either all of onCollapse, onExpand, isExpanded must be provided, or none");if((d||a)&&!(d&&a))throw new Error("either both isExpanded and renderExpandedContent must be provided, or neither");const I=(0,o.of)(i(l,d,!!C)),[x,S]=(0,n.useState)([]),O=H=>{m&&h&&p?m(H)?h(H):p(H):S(x.includes(H.id)?x.filter(w=>w!==H.id):[...x,H.id])},P=E?.itemsPerPage??f.length,{page:L,numberOfPages:U,onPageChange:R,pageItems:B}=(0,g.W)(f,1,P);return n.createElement(n.Fragment,null,n.createElement("div",{className:I.container,"data-testid":M??"dynamic-table"},n.createElement("div",{className:I.row,"data-testid":"header"},C&&C(),d&&n.createElement("div",{className:I.cell}),l.map(H=>n.createElement("div",{className:I.cell,key:H.id},H.label))),B.map((H,w)=>{const N=m?m(H):x.includes(H.id);return n.createElement("div",{className:I.row,key:`${H.id}-${w}`,"data-testid":v?.(H,w)??"row"},b&&b(H,w,f),d&&n.createElement("div",{className:(0,t.cx)(I.cell,I.expandCell)},n.createElement(s.K,{tooltip:`${N?"Collapse":"Expand"} row`,"data-testid":"collapse-toggle",name:N?"angle-down":"angle-right",onClick:()=>O(H)})),l.map(V=>n.createElement("div",{className:(0,t.cx)(I.cell,I.bodyCell,V.className),"data-column":V.label,key:`${H.id}-${V.id}`},V.renderCell(H,w))),N&&a&&n.createElement("div",{className:I.expandedContentRow,"data-testid":"expanded-content"},a(H,w,f)))}),y&&n.createElement("div",{className:(0,t.cx)(I.row,I.footerRow)},y)),E&&n.createElement(r.d,{className:(0,t.cx)(T,D),currentPage:L,numberOfPages:U,onNavigate:R,hideWhenSinglePage:!0}))},i=(l,f,d)=>{const h=l.map(p=>p.size?typeof p.size=="number"?`${p.size}fr`:p.size:"auto");return f&&h.unshift("calc(1em + 16px)"),d&&h.unshift("0"),p=>({container:(0,t.css)` border: 1px solid ${p.colors.border.weak}; border-radius: ${p.shape.radius.default}; color: ${p.colors.text.secondary}; `,row:(0,t.css)` display: grid; grid-template-columns: ${h.join(" ")}; grid-template-rows: 1fr auto; &:nth-child(2n + 1) { background-color: ${p.colors.background.secondary}; } &:nth-child(2n) { background-color: ${p.colors.background.primary}; } ${p.breakpoints.down("sm")} { grid-template-columns: auto 1fr; grid-template-areas: 'left right'; padding: 0 ${p.spacing(.5)}; &:first-child { display: none; } ${d?` & > *:first-child { display: none; } `:""} } `,footerRow:(0,t.css)` display: flex; padding: ${p.spacing(1)}; `,cell:(0,t.css)` display: flex; align-items: center; padding: ${p.spacing(1)}; ${p.breakpoints.down("sm")} { padding: ${p.spacing(1)} 0; grid-template-columns: 1fr; } `,bodyCell:(0,t.css)` overflow: hidden; ${p.breakpoints.down("sm")} { grid-column-end: right; grid-column-start: right; &::before { content: attr(data-column); display: block; color: ${p.colors.text.primary}; } } `,expandCell:(0,t.css)` justify-content: center; ${p.breakpoints.down("sm")} { align-items: start; grid-area: left; } `,expandedContentRow:(0,t.css)` grid-column-end: ${h.length+1}; grid-column-start: ${d?3:2}; grid-row: 2; padding: 0 ${p.spacing(3)} 0 ${p.spacing(1)}; position: relative; ${p.breakpoints.down("sm")} { grid-column-start: 2; border-top: 1px solid ${p.colors.border.strong}; grid-row: auto; padding: ${p.spacing(1)} 0 0 0; } `})}},10562:(Q,A,e)=>{"use strict";e.d(A,{B:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(75591);const r=({renderExpandedContent:u,...c})=>{const i=(0,o.of)(g);return n.createElement(s.E,{renderExpandedContent:u?(l,f,d)=>n.createElement(n.Fragment,null,f!==d.length-1&&n.createElement("div",{className:(0,t.cx)(i.contentGuideline,i.guideline)}),u(l,f,d)):void 0,renderPrefixHeader:()=>n.createElement("div",{className:i.relative},n.createElement("div",{className:(0,t.cx)(i.headerGuideline,i.guideline)})),renderPrefixCell:(l,f,d)=>n.createElement("div",{className:i.relative},n.createElement("div",{className:(0,t.cx)(i.topGuideline,i.guideline)}),f!==d.length-1&&n.createElement("div",{className:(0,t.cx)(i.bottomGuideline,i.guideline)})),...c})},g=u=>({relative:(0,t.css)` position: relative; height: 100%; `,guideline:(0,t.css)` left: -19px; border-left: 1px solid ${u.colors.border.weak}; position: absolute; ${u.breakpoints.down("md")} { display: none; } `,topGuideline:(0,t.css)` width: 18px; border-bottom: 1px solid ${u.colors.border.medium}; top: 0; bottom: 50%; `,bottomGuideline:(0,t.css)` top: 50%; bottom: 0; `,contentGuideline:(0,t.css)` top: 0; bottom: 0; left: -49px !important; `,headerGuideline:(0,t.css)` top: -17px; bottom: 0; `})},35108:(Q,A,e)=>{"use strict";e.d(A,{j:()=>i});var t=e(32196),n=e(46942),o=e.n(n),s=e(96540),r=e(40845),g=e(67061),u=e(95868),c=e(13840);const i=({children:f,header:d,content:h,footer:p,arrow:m,showAfter:a=300,wrapperClassName:v,disabled:E=!1,...D})=>{const b=(0,s.useRef)(null),C=(0,r.of)(l);if(E)return f;const y=s.createElement(g.B,{direction:"column",gap:0},d&&s.createElement("div",{className:C.card.header},d),s.createElement("div",{className:C.card.body},h),p&&s.createElement("div",{className:C.card.footer},p));return s.createElement(u.I,{content:y,hideAfter:100},(M,T,I)=>s.createElement(s.Fragment,null,b.current&&s.createElement(c.A,{...I,...D,wrapperClassName:o()(C.popover(m?1.25:0),v),onMouseLeave:T,onMouseEnter:M,onFocus:M,onBlur:T,referenceElement:b.current,renderArrow:m?({arrowProps:x,placement:S})=>s.createElement("div",{className:C.arrow(S),...x}):()=>s.createElement(s.Fragment,null)}),s.cloneElement(f,{ref:b,onMouseEnter:M,onMouseLeave:T,onFocus:M,onBlur:T})))},l=f=>({popover:d=>(0,t.css)` border-radius: ${f.shape.radius.default}; box-shadow: ${f.shadows.z3}; background: ${f.colors.background.primary}; border: 1px solid ${f.colors.border.medium}; margin-bottom: ${f.spacing(d)}; `,card:{body:(0,t.css)` padding: ${f.spacing(1)}; `,header:(0,t.css)` padding: ${f.spacing(1)}; background: ${f.colors.background.secondary}; border-bottom: solid 1px ${f.colors.border.medium}; `,footer:(0,t.css)` padding: ${f.spacing(.5)} ${f.spacing(1)}; background: ${f.colors.background.secondary}; border-top: solid 1px ${f.colors.border.medium}; `},arrow:d=>{const h="9px";return(0,t.css)` width: 0; height: 0; border-left: ${h} solid transparent; border-right: ${h} solid transparent; /* using hex colors here because the border colors use alpha transparency */ border-top: ${h} solid ${f.isLight?"#d2d3d4":"#2d3037"}; &:after { content: ''; position: absolute; border: ${h} solid ${f.colors.background.primary}; border-bottom: 0; border-left-color: transparent; border-right-color: transparent; margin-top: 1px; bottom: 1px; left: -${h}; } `}})},8406:(Q,A,e)=>{"use strict";e.d(A,{J:()=>u});var t=e(32196),n=e(96540),o=e(84140),s=e(40845),r=e(67061),g=e(14578);const u=({label:i,value:l,icon:f,color:d,size:h="md"})=>{const p=(0,s.of)(c,d,h),m=`${i}: ${l}`;return n.createElement("div",{className:p.wrapper,role:"listitem","aria-label":m},n.createElement(r.B,{direction:"row",gap:0,alignItems:"stretch"},n.createElement("div",{className:p.label},n.createElement(r.B,{direction:"row",gap:.5,alignItems:"center"},f&&n.createElement(g.I,{name:f})," ",i??"")),n.createElement("div",{className:p.value},l)))},c=(i,l,f)=>{const d=l??i.colors.secondary.main,h=i.isDark?(0,o.A)(d).lighten(5).toString():(0,o.A)(d).darken(5).toString(),p=i.isDark?(0,o.A)(d).darken(5).toString():(0,o.A)(d).lighten(5).toString(),m=l?o.A.mostReadable(d,["#000","#fff"]).toString():i.colors.text.primary,a=f==="md"?`${i.spacing(.33)} ${i.spacing(1)}`:`${i.spacing(.2)} ${i.spacing(.6)}`;return{wrapper:(0,t.css)` color: ${m}; font-size: ${i.typography.bodySmall.fontSize}; border-radius: ${i.shape.borderRadius(2)}; `,label:(0,t.css)` display: flex; align-items: center; color: inherit; padding: ${a}; background: ${d}; border: solid 1px ${h}; border-top-left-radius: ${i.shape.borderRadius(2)}; border-bottom-left-radius: ${i.shape.borderRadius(2)}; `,value:(0,t.css)` color: inherit; padding: ${a}; background: ${p}; border: solid 1px ${h}; border-left: none; border-top-right-radius: ${i.shape.borderRadius(2)}; border-bottom-right-radius: ${i.shape.borderRadius(2)}; `}}},55196:(Q,A,e)=>{"use strict";e.d(A,{P:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(94753),r=e(67061),g=e(14578);const u=({children:i,icon:l,color:f="secondary",direction:d="row",...h})=>{const p=(0,o.of)(c),m=typeof h.onClick=="function",a=d==="row",v=a?"center":"flex-start",E=a?.5:0;return n.createElement("div",{className:(0,t.cx)({[p.interactive]:m}),...h},n.createElement(s.E,{variant:"bodySmall",color:f},n.createElement(r.B,{direction:d,alignItems:v,gap:E,wrap:"wrap"},l&&n.createElement(g.I,{size:"sm",name:l}),i)))},c=()=>({interactive:(0,t.css)` cursor: pointer; `})},90141:(Q,A,e)=>{"use strict";e.d(A,{A:()=>g});var t=e(96540),n=e(55852),o=e(67061),s=e(14578);const g=(0,t.forwardRef)(function(c,i){return t.createElement(n.$n,{variant:"secondary",size:"sm",type:"button","aria-label":"more-actions","data-testid":"more-actions",ref:i,...c},t.createElement(o.B,{direction:"row",alignItems:"center",gap:0},"More ",t.createElement(s.I,{name:"angle-down"})))})},76156:(Q,A,e)=>{"use strict";e.d(A,{h:()=>s});var t=e(96540),n=e(12210);const o=({children:r,plugin:g,loadingComponent:u,notInstalledFallback:c})=>{const{loading:i,installed:l}=usePluginBridge(g);return i?u??null:l?React.createElement(React.Fragment,null,r):c??null};function s(r,g,u){const c=new URLSearchParams(u).toString();return`/a/${r}${g}`+(c?"?"+c:"")}},48205:(Q,A,e)=>{"use strict";e.d(A,{Yi:()=>r,hk:()=>s,rS:()=>g});var t=e(96540),n=e(42418),o=e(39938),s=(u=>(u.ContactPoint="contact point",u.Template="template",u.MuteTiming="mute timing",u.AlertRule="alert rule",u.RootNotificationPolicy="root notification policy",u))(s||{});const r=({resource:u,...c})=>t.createElement(n.F,{title:`This ${u} cannot be edited through the UI`,severity:"info",...c},"This ",u," has been provisioned, that means it was created by config. Please contact your server admin to update this ",u,"."),g=()=>t.createElement(o.E,{text:"Provisioned",color:"purple"})},82437:(Q,A,e)=>{"use strict";e.d(A,{c:()=>o});var t=e(96540),n=e(14578);const o=({namespace:s,group:r})=>r?t.createElement(t.Fragment,null,s," ",t.createElement(n.I,{name:"angle-right"})," ",r):t.createElement(t.Fragment,null,s)},26058:(Q,A,e)=>{"use strict";e.d(A,{h:()=>o});var t=e(32196),n=e(96540);const o=()=>n.createElement("span",{className:(0,t.css)` flex: 1; `})},65415:(Q,A,e)=>{"use strict";e.d(A,{O:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({children:g,state:u,size:c="md",muted:i=!1})=>{const l=(0,o.of)(r);return n.createElement("span",{className:(0,t.cx)(l.common,l[u],l[c],{[l.muted]:i})},g||u)},r=g=>({common:(0,t.css)` display: inline-block; color: white; border-radius: ${g.shape.radius.default}; 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; `})},16577:(Q,A,e)=>{"use strict";e.d(A,{Y:()=>c});var t=e(32196),n=e(96540),o=e(40845),s=e(39938),r=e(35108),g=e(83225);const u=["$",".",'"'];function c({input:a,delimiter:v=["{{","}}"]}){const E=(0,o.of)(m),[D,b]=v,C=new RegExp(`(?<before>.*?)(${D}(?<token>.*?)${b}|$)`,"gm"),y=a.split(` `),M=[];return y.forEach((T,I)=>{Array.from(T.matchAll(C)).forEach((S,O)=>{const P=S.groups?.before,L=S.groups?.token?.trim();if(P&&M.push(n.createElement("span",{key:`${I}-${O}-before`},P)),L){const U=p(L),R=U==="variable"?L:"",B=`${D} ${L} ${b}`;M.push(n.createElement(l,{key:`${I}-${O}-token`,content:B,type:U,description:R}))}}),M.push(n.createElement("br",{key:`${I}-newline`}))}),n.createElement("span",{className:E.wrapper},M)}var i=(a=>(a.Variable="variable",a.Function="function",a.Keyword="keyword",a.Unknown="unknown",a))(i||{});function l({content:a,description:v,type:E}){const D=(0,o.of)(m),b=!E;return n.createElement(r.j,{placement:"top-start",disabled:b,content:n.createElement("div",{className:D.hoverTokenItem},n.createElement(s.E,{tabIndex:0,text:n.createElement(n.Fragment,null,E),color:"blue"})," ",v&&n.createElement("code",null,v))},n.createElement("span",null,n.createElement(s.E,{tabIndex:0,className:D.token,text:a,color:"blue"})))}function f(a){return u.some(v=>a.startsWith(v))}function d(a){return g.keywords.some(v=>a.startsWith(v))}function h(a){return g.builtinFunctions.some(v=>a.startsWith(v))}function p(a){let v;return f(a)?v="variable":d(a)?v="keyword":h(a)?v="function":v="unknown",v}const m=a=>({wrapper:(0,t.css)` white-space: pre-wrap; `,token:(0,t.css)` cursor: default; font-family: ${a.typography.fontFamilyMonospace}; `,popover:(0,t.css)` border-radius: ${a.shape.radius.default}; box-shadow: ${a.shadows.z3}; background: ${a.colors.background.primary}; border: 1px solid ${a.colors.border.medium}; padding: ${a.spacing(1)}; `,hoverTokenItem:(0,t.css)` display: flex; flex-direction: row; align-items: center; gap: ${a.spacing(1)}; `})},73750:(Q,A,e)=>{"use strict";e.d(A,{L:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({children:g,className:u})=>{const c=(0,o.of)(r);return n.createElement("div",{className:(0,t.cx)(c.wrapper,u)},g)},r=g=>({wrapper:(0,t.css)` background-color: ${g.components.panel.background}; border: solid 1px ${g.components.input.borderColor}; border-radius: ${g.shape.radius.default}; padding: ${g.spacing(.5,1)}; font-family: ${g.typography.fontFamilyMonospace}; `})},96636:(Q,A,e)=>{"use strict";e.d(A,{d:()=>o});var t=e(96540),n=e(14778);const o=({component:s,title:r="previous page"})=>{const g=(0,n.i)(),u=(0,t.useCallback)(()=>{g(r)},[g,r]);return t.cloneElement(s,{onClick:u})}},27962:(Q,A,e)=>{"use strict";e.d(A,{f:()=>g});var t=e(55127),n=e.n(t),o=e(96540),s=e(40845),r=e(38858);const g=({group:u})=>{const c=(0,s.of)(r.q),i=u.alerts.length,l=u.alerts.reduce((f,d)=>(f[d.status.state]?f[d.status.state]+=1:f[d.status.state]=1,f),{});return o.createElement("div",null,`${i} ${n()("alert",i)}: `,Object.entries(l).map(([f,d],h)=>o.createElement("span",{key:`${JSON.stringify(u.labels)}-notifications-${h}`,className:c[f]},h>0&&", ",`${d} ${f}`)))}},53876:(Q,A,e)=>{"use strict";e.d(A,{X:()=>p});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(40845),g=e(14578),u=e(88575),c=e(60029),i=e(67061),l=e(56034),f=e(10354),d=e(25027),h=e(98164);const p=({onFilterChange:a,defaultQueryString:v})=>{const E=(0,r.of)(m),D=(0,s.useMemo)(()=>(0,n.debounce)(y=>{(0,d.fH)(d.le.filterByLabel);const M=y.target;a(M.value)},600),[a]);(0,s.useEffect)(()=>D.cancel(),[D]);const b=s.createElement(g.I,{name:"search"}),C=v?(0,h.J$)(v).length===0:!1;return s.createElement(u.D,{className:E.fixMargin,invalid:C||void 0,error:C?"Query must use valid matcher syntax. See the examples in the help tooltip.":null,label:s.createElement(c.J,null,s.createElement(i.B,{gap:.5},s.createElement("span",null,"Search by label"),s.createElement(l.m,{content:s.createElement("div",null,"Filter alerts using label querying without spaces, ex:",s.createElement("pre",null,'{severity="critical", instance=~"cluster-us-.+"}'),"Invalid use of spaces:",s.createElement("pre",null,'{severity= "critical"}'),s.createElement("pre",null,'{severity ="critical"}'),"Valid use of spaces:",s.createElement("pre",null,'{severity=" critical"}'),"Filter alerts using label querying without braces, ex:",s.createElement("pre",null,'severity="critical", instance=~"cluster-us-.+"'))},s.createElement(g.I,{name:"info-circle",size:"sm"}))))},s.createElement(f.p,{placeholder:"Search",defaultValue:v??"",onChange:D,"data-testid":"search-query-input",prefix:b,className:E.inputWidth}))},m=a=>({fixMargin:(0,t.css)({marginBottom:0}),inputWidth:(0,t.css)({width:340,flexGrow:0})})},68291:(Q,A,e)=>{"use strict";e.d(A,{b:()=>c,d:()=>i});var t=e(96540),n=e(55852),o=e(56034),s=e(38138),r=e(12210),g=e(99494),u=e(76156);const c=({title:l="",severity:f="",url:d=""})=>{const h=(0,u.h)(g.W.Incident,"/incidents/declare",{title:l,severity:f,url:d}),{loading:p,installed:m,settings:a}=(0,r._)(g.W.Incident);return t.createElement(t.Fragment,null,p===!0&&t.createElement(n.$n,{icon:"fire",size:"sm",type:"button",disabled:!0},"Declare Incident"),m===!1&&t.createElement(o.m,{content:"Grafana Incident is not installed or is not configured correctly"},t.createElement(n.$n,{icon:"fire",size:"sm",type:"button",disabled:!0},"Declare Incident")),a&&t.createElement(n.z9,{icon:"fire",size:"sm",type:"button",href:h},"Declare Incident"))},i=({title:l="",severity:f="",url:d=""})=>{const h=(0,u.h)(g.W.Incident,"/incidents/declare",{title:l,severity:f,url:d}),{loading:p,installed:m,settings:a}=(0,r._)(g.W.Incident);return t.createElement(t.Fragment,null,p===!0&&t.createElement(s.W.Item,{label:"Declare incident",icon:"fire",disabled:!0}),m===!1&&t.createElement(o.m,{content:"Grafana Incident is not installed or is not configured correctly"},t.createElement(s.W.Item,{label:"Declare incident",icon:"fire",disabled:!0})),a&&t.createElement(s.W.Item,{label:"Declare incident",url:h,icon:"fire"}))}},56528:(Q,A,e)=>{"use strict";e.d(A,{GX:()=>L,r4:()=>O});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(49785),g=e(39070),u=e(19845),c=e(72724),i=e(40845),l=e(42418),f=e(67061),d=e(55852),h=e(51440),p=e(29158),m=e(98808),a=e(71680),v=e(1712),E=e(34263),D=e(76658),b=e(66718),C=e(94822),y=e(98439),M=e(35108),T=e(26058),I=e(30423),x=e(81875),S=e(99106);const O=({queries:V=[],query:G,data:_,error:K,warning:j,isAlertCondition:k,onSetCondition:Y,onUpdateRefId:ee,onRemoveExpression:re,onUpdateExpressionType:J,onChangeQuery:ne})=>{const q=(0,i.of)(N),te=G?.type,{setError:oe,clearErrors:ue}=(0,r.xW)(),ie=(0,s.useCallback)(Me=>{Me?oe("queries",{type:"custom",message:Me}):ue("queries")},[oe,ue]),ge=_&&Object.values(_).some(Me=>!!Me&&Me.state===g.Gu.Loading),he=Array.isArray(_?.series)&&!ge,De=_?.series??[],pe=k??!1,{seriesCount:le,groupedByState:Te}=R(De),Ee=(0,s.useCallback)(Me=>{const ye=V.filter(Le=>Me.refId!==Le.refId).map(Le=>({value:Le.refId,label:Le.refId}));switch(Me.type){case b.Tz.math:return s.createElement(a.z,{onChange:ne,query:Me,labelWidth:"auto",onRunQuery:()=>{}});case b.Tz.reduce:return s.createElement(v.Z,{onChange:ne,refIds:ye,labelWidth:"auto",query:Me});case b.Tz.resample:return s.createElement(E.C,{onChange:ne,query:Me,labelWidth:"auto",refIds:ye});case b.Tz.classic:return s.createElement(m.z,{onChange:ne,query:Me,refIds:ye});case b.Tz.threshold:return s.createElement(D.O,{onChange:ne,query:Me,labelWidth:"auto",refIds:ye,onError:ie,useHysteresis:!0});default:return s.createElement(s.Fragment,null,"Expression not supported: ",Me.type)}},[ne,V,ie]),me=b.uQ.find(Me=>Me.value===te)?.description??"";return s.createElement("div",{className:(0,t.cx)(q.expression.wrapper,pe&&q.expression.alertCondition,te===b.Tz.classic&&q.expression.classic,te!==b.Tz.classic&&q.expression.nonClassic)},s.createElement("div",{className:q.expression.stack},s.createElement(B,{refId:G.refId,queryType:te,onRemoveExpression:()=>re(G.refId),onUpdateRefId:Me=>ee(G.refId,Me),onUpdateExpressionType:Me=>J(G.refId,Me),onSetCondition:Y,query:G,alertCondition:pe}),s.createElement("div",{className:q.expression.body},K&&s.createElement(l.F,{title:"Expression failed",severity:"error"},K.message),j&&s.createElement(l.F,{title:"Expression warning",severity:"warning"},j.message),s.createElement("div",{className:q.expression.description},me),Ee(G)),he&&s.createElement(s.Fragment,null,s.createElement(L,{series:De,isAlertCondition:k}),s.createElement("div",{className:q.footer},s.createElement(f.B,{direction:"row",alignItems:"center"},s.createElement(T.h,null),s.createElement(U,{isCondition:!!k,firing:Te[C.cF.Firing].length,normal:Te[C.cF.Inactive].length,seriesCount:le}))))))},P=20,L=({series:V,isAlertCondition:G})=>{const{pageItems:_,previousPage:K,nextPage:j,numberOfPages:k,pageStart:Y,pageEnd:ee}=(0,y.W)(V,1,P),re=(0,i.of)(N),J=(0,S.PI)(V),ne=!J&&(0,u.jq)(V),q=k>1;return s.createElement("div",{className:re.expression.results},!J&&ne&&s.createElement("div",null,_.map((te,oe)=>s.createElement(w,{key:(0,n.uniqueId)(),frame:te,index:Y+oe,isAlertCondition:G}))),!J&&!ne&&_.map((te,oe)=>s.createElement(H,{key:(0,n.uniqueId)(),frame:te,index:Y+oe,isAlertCondition:G})),J&&s.createElement("div",{className:(0,t.cx)(re.expression.noData,re.mutedText)},"No data"),q&&s.createElement("div",{className:re.pagination.wrapper,"data-testid":"paginate-expression"},s.createElement(f.B,null,s.createElement(d.$n,{variant:"secondary",fill:"outline",onClick:K,icon:"angle-left",size:"sm","aria-label":"previous-page"}),s.createElement(T.h,null),s.createElement("span",{className:re.mutedText},Y," - ",ee," of ",V.length),s.createElement(T.h,null),s.createElement(d.$n,{variant:"secondary",fill:"outline",onClick:j,icon:"angle-right",size:"sm","aria-label":"next-page"}))))},U=({firing:V,normal:G,isCondition:_,seriesCount:K})=>{const{mutedText:j}=(0,i.of)(N);return K===0?s.createElement("span",{className:j},"No series"):_?s.createElement("span",{className:j},`${K} series: ${V} firing, ${G} normal`):s.createElement("span",{className:j},`${K} series`)};function R(V){const G=V.filter(j=>(0,S.Lm)(j)===void 0).length,_={[C.cF.Firing]:V.filter(j=>(0,S.Lm)(j)!==void 0&&(0,S.Lm)(j)!==0),[C.cF.Inactive]:V.filter(j=>(0,S.Lm)(j)===0)},K=V.length-G;return{groupedByState:_,seriesCount:K}}const B=({refId:V,queryType:G,onUpdateRefId:_,onRemoveExpression:K,onSetCondition:j,alertCondition:k,query:Y})=>{const ee=(0,i.of)(N),re=(0,i.of)(d.my),[J,ne]=(0,s.useState)(!1),te=J!==!1&&J==="refId";return s.createElement("header",{className:ee.header.wrapper},s.createElement(f.B,{direction:"row",gap:.5,alignItems:"center"},s.createElement(f.B,{direction:"row",gap:1,alignItems:"center"},!te&&s.createElement("button",{type:"button",className:(0,t.cx)(re,ee.editable),onClick:()=>ne("refId")},s.createElement("div",{className:ee.expression.refId},V)),te&&s.createElement(h.D,{autoFocus:!0,defaultValue:V,minWidth:5,onChange:oe=>{_(oe.currentTarget.value),ne(!1)},onFocus:oe=>oe.target.select(),onBlur:oe=>{_(oe.currentTarget.value),ne(!1)}}),s.createElement("div",null,(0,b.NI)(G))),s.createElement(T.h,null),s.createElement(x.a,{onSetCondition:()=>j(Y.refId),isCondition:k}),s.createElement(p.K,{name:"trash-alt",variant:"secondary",className:ee.mutedIcon,onClick:K,tooltip:"Remove expression"})))},H=({frame:V,index:G,isAlertCondition:_})=>{const K=(0,i.of)(N),j=(0,S.Jw)(V)||"Series "+G,k=(0,S.Lm)(V),Y=(0,S.JQ)(V),ee=Object.entries(Y),re=ee.length>0,J=_&&k!==0,ne=_&&k===0,q=`${re?"":j}${re?`{${(0,S.h6)(Y)}}`:""}`;return s.createElement("div",{className:K.expression.resultsRow},s.createElement(f.B,{direction:"row",gap:1,alignItems:"center"},s.createElement("div",{className:K.expression.resultLabel,title:q},s.createElement("span",null,re?"":j),re&&s.createElement(s.Fragment,null,s.createElement("span",null,"{"),ee.map(([te,oe],ue)=>s.createElement("span",{key:(0,n.uniqueId)()},s.createElement("span",{className:K.expression.labelKey},te),s.createElement("span",null,"="),s.createElement("span",null,'"'),s.createElement("span",{className:K.expression.labelValue},oe),s.createElement("span",null,'"'),ue<ee.length-1&&s.createElement("span",null,", "))),s.createElement("span",null,"}"))),s.createElement("div",{className:K.expression.resultValue},k),J&&s.createElement(I.C,{state:C.cF.Firing,size:"sm"}),ne&&s.createElement(I.C,{state:C.cF.Inactive,size:"sm"})))},w=({frame:V,index:G})=>{const _=(0,i.of)(N),K=V.fields[1],j=K.labels,Y=K.config?.displayNameFromDS??(j?(0,S.h6)(K.labels??{}):"Series "+G),ee=V.fields[0].values,re=ne=>V.fields[0].values[ne],J=ne=>V.fields[1].values[ne];return s.createElement("div",{className:_.expression.resultsRow},s.createElement(f.B,{direction:"row",alignItems:"center"},s.createElement("span",{className:(0,t.cx)(_.mutedText,_.expression.resultLabel),title:Y},Y),s.createElement("div",{className:_.expression.resultValue},s.createElement(M.j,{placement:"right",wrapperClassName:_.timeseriesTableWrapper,content:s.createElement("table",{className:_.timeseriesTable},s.createElement("thead",null,s.createElement("tr",null,s.createElement("th",null,"Timestamp"),s.createElement("th",null,"Value"))),s.createElement("tbody",null,ee.map((ne,q)=>s.createElement("tr",{key:q},s.createElement("td",{className:_.mutedText},(0,c.LE)(re(q))),s.createElement("td",{className:_.expression.resultValue},J(q))))))},s.createElement("span",null,"Time series data")))))},N=V=>({expression:{wrapper:(0,t.css)` display: flex; border: solid 1px ${V.colors.border.medium}; flex: 1; flex-basis: 400px; border-radius: ${V.shape.radius.default}; `,stack:(0,t.css)` display: flex; flex-direction: column; flex-wrap: nowrap; gap: 0; width: 100%; min-width: 0; // this one is important to prevent text overflow `,classic:(0,t.css)` max-width: 100%; `,nonClassic:(0,t.css)` max-width: 640px; `,alertCondition:(0,t.css)``,body:(0,t.css)` padding: ${V.spacing(1)}; flex: 1; `,description:(0,t.css)` margin-bottom: ${V.spacing(1)}; font-size: ${V.typography.size.xs}; color: ${V.colors.text.secondary}; `,refId:(0,t.css)` font-weight: ${V.typography.fontWeightBold}; color: ${V.colors.primary.text}; `,results:(0,t.css)` display: flex; flex-direction: column; flex-wrap: nowrap; border-top: solid 1px ${V.colors.border.medium}; `,noResults:(0,t.css)` display: flex; align-items: center; justify-content: center; `,resultsRow:(0,t.css)` padding: ${V.spacing(.75)} ${V.spacing(1)}; &:nth-child(odd) { background-color: ${V.colors.background.secondary}; } &:hover { background-color: ${V.colors.background.canvas}; } `,labelKey:(0,t.css)` color: ${V.isDark?"#73bf69":"#56a64b"}; `,labelValue:(0,t.css)` color: ${V.isDark?"#ce9178":"#a31515"}; `,resultValue:(0,t.css)` text-align: right; `,resultLabel:(0,t.css)` flex: 1; overflow-x: auto; display: inline-block; white-space: nowrap; `,noData:(0,t.css)` display: flex; align-items: center; justify-content: center; padding: ${V.spacing()}; `},mutedText:(0,t.css)` color: ${V.colors.text.secondary}; font-size: 0.9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; `,header:{wrapper:(0,t.css)` background: ${V.colors.background.secondary}; padding: ${V.spacing(.5)} ${V.spacing(1)}; border-bottom: solid 1px ${V.colors.border.weak}; `},footer:(0,t.css)` background: ${V.colors.background.secondary}; padding: ${V.spacing(1)}; border-top: solid 1px ${V.colors.border.weak}; `,draggableIcon:(0,t.css)` cursor: grab; `,mutedIcon:(0,t.css)` color: ${V.colors.text.secondary}; `,editable:(0,t.css)` padding: ${V.spacing(.5)} ${V.spacing(1)}; border: solid 1px ${V.colors.border.weak}; border-radius: ${V.shape.radius.default}; display: flex; flex-direction: row; align-items: center; gap: ${V.spacing(1)}; cursor: pointer; `,timeseriesTableWrapper:(0,t.css)` max-height: 500px; overflow-y: scroll; `,timeseriesTable:(0,t.css)` table-layout: auto; width: 100%; height: 100%; td, th { padding: ${V.spacing(1)}; } td { background: ${V.colors.background.primary}; } th { background: ${V.colors.background.secondary}; } tr { border-bottom: 1px solid ${V.colors.border.medium}; &:last-of-type { border-bottom: none; } } `,pagination:{wrapper:(0,t.css)` border-top: 1px solid ${V.colors.border.medium}; padding: ${V.spacing()}; `}})},81875:(Q,A,e)=>{"use strict";e.d(A,{a:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(39938),r=e(55852);const g=({isCondition:c,onSetCondition:i})=>{const l=(0,o.of)(u);return c?n.createElement(s.E,{key:"condition",color:"green",icon:"check",text:"Alert condition"}):n.createElement("button",{key:"make-condition",type:"button",className:l.actionLink,onClick:()=>i&&i()},"Set as alert condition")},u=c=>{const i=(0,r.my)(c);return{actionLink:(0,t.css)` ${i}; color: ${c.colors.text.link}; cursor: pointer; &:hover { text-decoration: underline; } `}}},99106:(Q,A,e)=>{"use strict";e.d(A,{EL:()=>i,JQ:()=>u,Jw:()=>r,Lm:()=>g,PI:()=>f,h6:()=>c,wf:()=>l});var t=e(2543),n=e.n(t),o=e(97706),s=e(57220);const r=d=>{const h=d.fields[0];return h?.config?.displayNameFromDS??d.name??h?.labels?.__name__},g=d=>{const h=d.fields[0]?.values[0];return Number.isFinite(h)?(0,o.h)(h,5):h},u=d=>d.fields[0]?.labels??{},c=d=>Object.entries(d).map(([h,p])=>h+"="+p).join(", "),i=d=>{const h=d.name;if((0,s.Eb)(d.rulesSource))return{name:h,parents:[]};try{const p=JSON.parse(h);if(!Array.isArray(p))throw new Error("not a nested Grafana folder");const m=(0,t.last)(p)??h,a=(0,t.dropRight)(p,1);return{name:m,parents:a}}catch{return{name:d.name,parents:[]}}},l=(d,h=[])=>JSON.stringify(h.concat(d)),f=d=>d.every(p=>p.fields.every(m=>m.values.every(a=>a==null)))},83225:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{AlertmanagerTemplateFunction:()=>n,availableAlertManagerFunctions:()=>o,builtinFunctions:()=>r,conf:()=>c,keywords:()=>g,language:()=>u});var t=(i=>(i.Delimiter="delimiter",i.Keyword="keyword",i.Function="type.identifier",i.String="string",i.Variable="variable.name",i.Number="number",i.Comment="comment",i.Operator="operator",i.Identifier="idenfifier",i))(t||{}),n=(i=>(i.toUpper="toUpper",i.toLower="toLower",i.title="title",i.join="join",i.match="match",i.safeHtml="safeHtml",i.reReplaceAll="reReplaceAll",i.stringSlice="stringSlice",i))(n||{});const o=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"],u={defaultToken:"",keywords:g,functions:[...r,...o],operators:["|"],tokenizer:{root:[[/"/,"string","@string"],[/`/,"string","@rawstring"],[/\d*\d+[eE]([\-+]?\d+)?/,"number.float"],[/\d*\.\d+([eE][\-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F']*[0-9a-fA-F]/,"number.hex"],[/0[0-7']*[0-7]/,"number.octal"],[/0[bB][0-1']*[0-1]/,"number.binary"],[/\d[\d']*/,"number"],[/\d/,"number"],[/[;,.]/,"delimiter"],[/{{-?/,"delimiter"],[/-?}}/,"delimiter"],[/\.([A-Za-z]+)?/,"variable.name"],[/[a-zA-Z_]\w*/,{cases:{"@keywords":{token:"keyword"},"@functions":{token:"type.identifier"},"@default":"idenfifier"}}],[/\/\*.*\*\//,"comment"]],string:[[/[^\\"]+/,"string"],[/\\./,"string.escape.invalid"],[/"/,"string","@pop"]],rawstring:[[/[^\`]/,"string"],[/`/,"string","@pop"]]}},c={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:"'"}]}},74685:(Q,A,e)=>{"use strict";e.d(A,{j:()=>l});var t=e(32196),n=e(96540),o=e(70713),s=e(19845),r=e(40845),g=e(28138),u=e(72519),c=e(56528),i=e(7921);const l=({data:d,thresholds:h,thresholdsType:p})=>{const m=(0,r.of)(f),a=(0,s.jq)(d.series),v=(0,i.yW)(d),E=p?{mode:p}:void 0,D={from:d.timeRange.from.valueOf(),to:d.timeRange.to.valueOf()};return n.createElement("div",{className:m.wrapper},n.createElement(o.Ay,{disableHeight:!0},({width:b})=>n.createElement("div",{style:{width:b}},a?n.createElement(u.y,{statusMessage:v,data:d.series,eventBus:g.A,height:300,width:b,absoluteRange:D,timeZone:"browser",onChangeTime:()=>{},splitOpenFn:()=>{},loadingState:d.state,thresholdsConfig:h,thresholdsStyle:E}):n.createElement("div",{className:m.instantVectorResultWrapper},n.createElement("header",{className:m.title},"Table"),n.createElement(c.GX,{series:d.series})))))},f=d=>({wrapper:(0,t.css)` width: 100%; position: relative; `,instantVectorResultWrapper:(0,t.css)` border: solid 1px ${d.colors.border.medium}; border-radius: ${d.shape.radius.default}; padding: 0; display: flex; flex-direction: column; flex-wrap: nowrap; `,title:(0,t.css)({label:"panel-title",padding:d.spacing(),textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",fontSize:d.typography.h6.fontSize,fontWeight:d.typography.h6.fontWeight})})},7921:(Q,A,e)=>{"use strict";e.d(A,{G0:()=>M,zy:()=>T,lb:()=>I,YG:()=>U,yW:()=>P,an:()=>S,I3:()=>b,xb:()=>y,_u:()=>L,yr:()=>x});var t=e(2543),n=e(19845),o=e(50082),s=e(39070),r=e(52622),g=e(2913),u=e(55907),c=e(69437),i=e(66718),l=e(86590),f=e(41811),d=e(34525);const h=(0,f.A)(p,(R,B)=>D(R[0])===D(B[0]));function p(R){const B=new d.TS,H=R.map(w=>w.refId);return B.createNodes(H),R.forEach(w=>{const N=w.refId;((0,c.f)(w.model)&&w.model.type==="math"?m(w.model.expression??""):[w.model.expression]).forEach(_=>{N&&_&&!(N===_)&&B.link(_,N)})}),B}function m(R){const B=new RegExp(/\$\{(?<var>[a-zA-Z0-9_ ]+?)\}/gm),H=new RegExp(/\$(?<var>[a-zA-Z0-9_]+)/gm),w=Array.from(R.matchAll(B)).map(V=>V.groups?.var),N=Array.from(R.matchAll(H)).map(V=>V.groups?.var);return(0,t.compact)((0,t.uniq)([...w,...N]))}const a=(0,t.memoize)(v,(R,B)=>R+E(B));function v(R,B){const H=B.getNode(R);let w=[];function N(V){const G=V.inputEdges;G.length>0?G.forEach(_=>{_.inputNode&&N(_.inputNode)}):w?.push(V)}return N(H),w.map(V=>V.name)}function E(R){return Object.keys(R.nodes).map(B=>{const H=R.nodes[B];let w=H.outputEdges.map(V=>V.outputNode?.name).join(", "),N=H.inputEdges.map(V=>V.inputNode?.name).join(", ");return`${H.name}:${w}:${N}`}).join(" ")}function D(R){return R.map(B=>{const H=(0,c.f)(B.model)?B.model.type:B.queryType;return B.refId+(B.model.expression??"")+H}).join()}function b(R,B,H){return R.map(w=>{if(B===H||!(0,c.f)(w.model))return w;const N=w.model.type==="math",V=w.model.type==="reduce",G=w.model.type==="resample",_=w.model.type==="classic_conditions",K=w.model.type==="threshold";if(N)return{...w,model:{...w.model,expression:C(w.model.expression??"",B,H)}};if(G||V||K){const j=w.model.expression===B;return{...w,model:{...w.model,expression:j?H:w.model.expression}}}if(_){const j=w.model.conditions?.map(k=>({...k,query:{...k.query,params:k.query.params.map(Y=>Y===B?H:Y)}}));return{...w,model:{...w.model,conditions:j}}}return w})}function C(R,B,H){const w=new RegExp("(\\$"+B+"\\b)|(\\${"+B+"})","gm"),N="${"+H+"}";return R.replace(w,N)}function y(R,B){return R.find(H=>H.refId===B)!==void 0}function M(R){return R.includes("/")||R.includes("\\")?'Cannot contain "/" or "\\" characters':!0}function T(R){if(R.series.length===0)return;const B=(0,n.jq)(R.series);let H;return B&&(H=new Error("You cannot use time series data as an alert condition, consider adding a reduce expression.")),H}function I(R){if(R.errors?.length)return new Error(R.errors[0].message)}function x(R){const H=(R[0]?.meta?.notices??[]).find(w=>w.severity==="warning")?.text;return H?new Error(H):void 0}function S(R,B){const H={},w=[i.Tz.threshold,i.Tz.classic];if(!B)return H;for(const G of R){if(!(0,c.f)(G.model)||!w.includes(G.model.type)||!Array.isArray(G.model.conditions)||G.model.refId!==B)continue;const _=G.model.conditions.some(O);G.model.conditions.forEach(K=>{const j=K.evaluator.params,k=K.query?.params[0]??G.model.expression;if(!k)return;const Y=O(K);try{const ee=h(R),re=a(k,ee);R.filter(ne=>re.includes(ne.refId)).forEach(ne=>{const q=ne.refId,oe=!!(!(0,c.f)(ne?.model)&&q);q&&!H[q]&&(H[q]={config:{mode:o.O.Absolute,steps:[]},mode:r.Ly.Line}),q&&oe&&!Y&&!_?N(q,j[0]):q&&oe&&Y&&(V(q,j,K.evaluator.type),H[q].mode=r.Ly.LineAndArea)})}catch(ee){console.error("Failed to parse thresholds",ee);return}})}function N(G,_){H[G].config.steps.push({value:-1/0,color:"transparent"},{value:_,color:g.$W.theme2.colors.error.main})}function V(G,_,K){K===u.p.IsWithinRange&&H[G].config.steps.push({value:-1/0,color:"transparent"},{value:_[0],color:g.$W.theme2.colors.error.main},{value:_[1],color:g.$W.theme2.colors.error.main},{value:_[1],color:"transparent"}),K===u.p.IsOutsideRange&&H[G].config.steps.push({value:-1/0,color:g.$W.theme2.colors.error.main},{value:_[0],color:g.$W.theme2.colors.error.main},{value:_[0],color:"transparent"},{value:_[1],color:g.$W.theme2.colors.error.main}),H[G].config.steps.sort((j,k)=>j.value-k.value),H[G].config.steps=H[G].config.steps.filter(j=>j.value!==void 0)}return H}function O(R){return R.evaluator.type===u.p.IsWithinRange||R.evaluator.type===u.p.IsOutsideRange}function P(R){const B="Failed to fetch data";if(R.state!==s.Gu.Error)return;const H=R.errors;return H?.length?H.map(w=>w.message??B).join(", "):R.error?.message??B}function L(R=""){return R==="recording"?l.Z.cloudRecording:l.Z.grafana}function U(R,B){const H=B.filter(G=>!(0,c.f)(G.model)).map(G=>G.refId),w=R.filter(G=>!(0,c.f)(G.model)).map(G=>G.refId),[N,V]=(0,t.xor)(w,H);return[N,V]}},47207:(Q,A,e)=>{"use strict";e.d(A,{D:()=>he});var t=e(1932),n=e(96540),o=e(24120),s=e(39070),r=e(32264),g=e(42418),u=e(32196),c=e(20382),i=e(2543),l=e(40845),f=e(67061),d=e(39938),h=e(28716),p=e(69437),m=e(66718),a=e(55907),v=e(56528),E=e(7921),D=e(47232),b=e(76885),C=e(63383),y=e(55852),M=e(10096),T=e(96636),I=e(74685);const x=4;function S({data:pe,model:le,thresholds:Te,dsSettings:Ee,relativeTimeRange:Re,onTimeRangeChange:me,className:Me}){const ye=(0,l.of)(P),Le=(0,p.f)(le),We=(0,n.useCallback)(at=>{const st=(0,D.KQ)().unix()-at.unix();if(Re){const Ke=Re.from-Re.to;me({from:st+Ke,to:st})}},[me,Re]),Be=(0,n.useCallback)(at=>at===0?(0,D.KQ)():(0,D.KQ)().subtract(at,"seconds"),[]);if(!pe)return null;const Ye=M.TP.hasAccessToExplore();return n.createElement("div",{className:Me},n.createElement("div",{className:ye.header},n.createElement("div",{className:ye.actions},!Le&&Re?n.createElement(C.K,{date:Be(Re.to),onChange:We,maxDate:new Date}):null,Ye&&!Le&&n.createElement(T.d,{component:n.createElement(y.z9,{size:"md",variant:"secondary",icon:"compass",href:O(Ee,le)},"View in Explore")}))),n.createElement(I.j,{data:pe,thresholds:Te?.config,thresholdsType:Te?.mode}))}function O(pe,le){const{uid:Te,type:Ee}=pe,{refId:Re,...me}=le;return b.kM.renderUrl(`${r.$.appSubUrl}/explore`,{left:JSON.stringify({datasource:pe.uid,queries:[{refId:"A",...me,datasource:{type:Ee,uid:Te}}],range:{from:"now-1h",to:"now"}})})}const P=pe=>({header:(0,u.css)` height: ${pe.spacing(x)}; display: flex; align-items: center; justify-content: flex-end; white-space: nowrap; margin-bottom: ${pe.spacing(2)}; `,refId:(0,u.css)` font-weight: ${pe.typography.fontWeightMedium}; color: ${pe.colors.text.link}; overflow: hidden; `,dataSource:(0,u.css)` margin-left: ${pe.spacing(1)}; font-style: italic; color: ${pe.colors.text.secondary}; `,actions:(0,u.css)` display: flex; align-items: center; `,errorMessage:(0,u.css)` white-space: pre-wrap; `});function L({queries:pe,condition:le,evalDataByQuery:Te={},evalTimeRanges:Ee={},onTimeRangeChange:Re}){const me=(0,i.keyBy)(Object.values(r.$.datasources),Be=>Be.uid),Me=pe.filter(Be=>!(0,p.f)(Be.model)),ye=pe.filter(Be=>(0,p.f)(Be.model)),Le=(0,l.of)(Y),We=(0,E.an)(pe,le);return n.createElement(f.B,{gap:2,direction:"column"},n.createElement("div",{className:Le.maxWidthContainer},n.createElement(f.B,{gap:2,wrap:"wrap","data-testid":"queries-container"},Me.map(({model:Be,relativeTimeRange:Ye,refId:at,datasourceUid:st},Ke)=>{const Xe=me[st];return n.createElement(U,{key:Ke,refId:at,isAlertCondition:le===at,model:Be,relativeTimeRange:Ye,evalTimeRange:Ee[at],dataSource:Xe,thresholds:We[at],queryData:Te[at],onEvalTimeRangeChange:He=>Re(at,He)})}))),n.createElement("div",{className:Le.maxWidthContainer},n.createElement(f.B,{gap:1,wrap:"wrap","data-testid":"expressions-container"},ye.map(({model:Be,refId:Ye,datasourceUid:at},st)=>{const Ke=me[at];return(0,p.f)(Be)&&n.createElement(B,{key:st,refId:Ye,isAlertCondition:le===Ye,model:Be,dataSource:Ke,evalData:Te[Ye]})}))))}function U({refId:pe,relativeTimeRange:le,thresholds:Te,model:Ee,dataSource:Re,queryData:me,evalTimeRange:Me,onEvalTimeRangeChange:ye}){const Le=(0,l.of)(R),We=[Re?.name??"[[Data source not found]]"];return le&&We.push((0,h.Bw)(le).display),n.createElement(H,{refId:pe,headerItems:We,className:Le.contentBox},n.createElement("pre",{className:Le.code},n.createElement("code",null,(0,c.Bh)(Ee))),Re&&n.createElement(S,{refId:pe,dsSettings:Re,model:Ee,data:me,thresholds:Te,relativeTimeRange:Me,onTimeRangeChange:ye,className:Le.visualization}))}const R=pe=>({code:(0,u.css)` margin: ${pe.spacing(1)}; `,contentBox:(0,u.css)` flex: 1 0 100%; `,visualization:(0,u.css)` padding: ${pe.spacing(1)}; `});function B({refId:pe,model:le,evalData:Te,isAlertCondition:Ee}){function Re(){switch(le.type){case m.Tz.math:return n.createElement(ee,{model:le});case m.Tz.reduce:return n.createElement(G,{model:le});case m.Tz.resample:return n.createElement(K,{model:le});case m.Tz.classic:return n.createElement(N,{model:le});case m.Tz.threshold:return n.createElement(k,{model:le});default:return n.createElement(n.Fragment,null,"Expression not supported: ",le.type)}}return n.createElement(H,{refId:pe,headerItems:[(0,i.startCase)(le.type)],isAlertCondition:Ee},Re(),Te&&n.createElement(v.GX,{series:Te.series,isAlertCondition:Ee}))}function H({refId:pe,headerItems:le=[],children:Te,isAlertCondition:Ee,className:Re}){const me=(0,l.of)(w);return n.createElement("div",{className:(0,u.cx)(me.container,Re)},n.createElement("header",{className:me.header},n.createElement("span",{className:me.refId},pe),le.map((Me,ye)=>n.createElement("span",{key:ye,className:me.textBlock},Me)),Ee&&n.createElement("div",{className:me.conditionIndicator},n.createElement(d.E,{color:"green",icon:"check",text:"Alert condition"}))),Te)}const w=pe=>({container:(0,u.css)` flex: 1 0 25%; border: 1px solid ${pe.colors.border.strong}; max-width: 100%; `,header:(0,u.css)` display: flex; align-items: center; gap: ${pe.spacing(1)}; padding: ${pe.spacing(1)}; background-color: ${pe.colors.background.secondary}; `,textBlock:(0,u.css)` border: 1px solid ${pe.colors.border.weak}; padding: ${pe.spacing(.5,1)}; background-color: ${pe.colors.background.primary}; `,refId:(0,u.css)` color: ${pe.colors.text.link}; padding: ${pe.spacing(.5,1)}; border: 1px solid ${pe.colors.border.weak}; `,conditionIndicator:(0,u.css)` margin-left: auto; `});function N({model:pe}){const le=(0,l.of)(V),Te=(0,i.keyBy)(a.A.reducerTypes,me=>me.value),Ee=(0,i.keyBy)(a.A.evalOperators,me=>me.value),Re=(0,i.keyBy)(a.A.evalFunctions,me=>me.value);return n.createElement("div",{className:le.container},pe.conditions?.map(({query:me,operator:Me,reducer:ye,evaluator:Le},We)=>{const Be=J(Le);return n.createElement(n.Fragment,{key:We},n.createElement("div",{className:le.blue},We===0?"WHEN":!!Me?.type&&Ee[Me?.type]?.text),n.createElement("div",{className:le.bold},ye?.type&&Te[ye.type]?.text),n.createElement("div",{className:le.blue},"OF"),n.createElement("div",{className:le.bold},me.params[0]),n.createElement("div",{className:le.blue},Re[Le.type].text),n.createElement("div",{className:le.bold},Be?`(${Le.params[0]}; ${Le.params[1]})`:Le.params[0]))}))}const V=pe=>({container:(0,u.css)` padding: ${pe.spacing(1)}; display: grid; grid-template-columns: max-content max-content max-content max-content max-content max-content; gap: ${pe.spacing(0,1)}; `,...re(pe)});function G({model:pe}){const le=(0,l.of)(_),{reducer:Te,expression:Ee,settings:Re}=pe,me=m.Cu.find(Le=>Le.value===Te),Me=Re?.mode??m.Mt.Strict,ye=m.HZ.find(Le=>Le.value===Me);return n.createElement("div",{className:le.container},n.createElement("div",{className:le.label},"Function"),n.createElement("div",{className:le.value},me?.label),n.createElement("div",{className:le.label},"Input"),n.createElement("div",{className:le.value},Ee),n.createElement("div",{className:le.label},"Mode"),n.createElement("div",{className:le.value},ye?.label))}const _=pe=>({container:(0,u.css)` padding: ${pe.spacing(1)}; display: grid; gap: ${pe.spacing(1)}; grid-template-rows: 1fr 1fr; grid-template-columns: 1fr 1fr 1fr 1fr; > :nth-child(6) { grid-column: span 3; } `,...re(pe)});function K({model:pe}){const le=(0,l.of)(j),{expression:Te,window:Ee,downsampler:Re,upsampler:me}=pe,Me=m.PN.find(Le=>Le.value===Re),ye=m.iX.find(Le=>Le.value===me);return n.createElement("div",{className:le.container},n.createElement("div",{className:le.label},"Input"),n.createElement("div",{className:le.value},Te),n.createElement("div",{className:le.label},"Resample to"),n.createElement("div",{className:le.value},Ee),n.createElement("div",{className:le.label},"Downsample"),n.createElement("div",{className:le.value},Me?.label),n.createElement("div",{className:le.label},"Upsample"),n.createElement("div",{className:le.value},ye?.label))}const j=pe=>({container:(0,u.css)` padding: ${pe.spacing(1)}; display: grid; gap: ${pe.spacing(1)}; grid-template-columns: 1fr 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; `,...re(pe)});function k({model:pe}){const le=(0,l.of)(Y),{expression:Te,conditions:Ee}=pe,Re=Ee&&Ee[0]?.evaluator,me=m.zd.find(Be=>Be.value===Re?.type),Me=Re?J(Re):!1,ye=Ee&&Ee[0]?.unloadEvaluator,Le=m.zd.find(Be=>Be.value===ye?.type),We=ye?J(ye):!1;return n.createElement(n.Fragment,null,n.createElement("div",{className:le.container},n.createElement("div",{className:le.label},"Input"),n.createElement("div",{className:le.value},Te),Re&&n.createElement(n.Fragment,null,n.createElement("div",{className:le.blue},me?.label),n.createElement("div",{className:le.bold},Me?`(${Re.params[0]}; ${Re.params[1]})`:Re.params[0]))),n.createElement("div",{className:le.container},ye&&n.createElement(n.Fragment,null,n.createElement("div",{className:le.label},"Stop alerting when "),n.createElement("div",{className:le.value},Te),n.createElement(n.Fragment,null,n.createElement("div",{className:le.blue},Le?.label),n.createElement("div",{className:le.bold},We?`(${ye.params[0]}; ${ye.params[1]})`:ye.params[0])))))}const Y=pe=>{const{blue:le,bold:Te,...Ee}=re(pe);return{...Ee,maxWidthContainer:(0,u.css)` max-width: 100%; `,container:(0,u.css)` padding: ${pe.spacing(1)}; display: flex; gap: ${pe.spacing(1)}; `,blue:(0,u.css)` ${le}; margin: auto 0; `,bold:(0,u.css)` ${Te}; margin: auto 0; `}};function ee({model:pe}){const le=(0,l.of)(Y),{expression:Te}=pe;return n.createElement("div",{className:le.container},n.createElement("div",{className:le.label},"Input"),n.createElement("div",{className:le.value},Te))}const re=pe=>({blue:(0,u.css)` color: ${pe.colors.text.link}; `,bold:(0,u.css)` font-weight: ${pe.typography.fontWeightBold}; `,label:(0,u.css)` display: flex; align-items: center; padding: ${pe.spacing(.5,1)}; background-color: ${pe.colors.background.secondary}; font-size: ${pe.typography.bodySmall.fontSize}; line-height: ${pe.typography.bodySmall.lineHeight}; font-weight: ${pe.typography.fontWeightBold}; `,value:(0,u.css)` padding: ${pe.spacing(.5,1)}; border: 1px solid ${pe.colors.border.weak}; `});function J(pe){return pe.type===a.p.IsWithinRange||pe.type===a.p.IsOutsideRange}var ne=e(36135),q=e(28318),te=e(57220),oe=e(23662);function ue(pe){if(!pe)return[];const{namespace:le,rulerRule:Te}=pe,{rulesSource:Ee}=le;if((0,te.z2)(Ee)&&(0,oe.lT)(Te))return Te.grafana_alert.data;if((0,te.Eb)(Ee)){const Re=ge(Ee,pe);return[ie(Re,Ee.uid)]}return[]}function ie(pe,le){return{refId:pe.refId,datasourceUid:le,queryType:"",model:pe,relativeTimeRange:{from:360,to:0}}}function ge(pe,le){const Te="A";switch(pe.type){case"prometheus":return{refId:Te,expr:le.query};case"loki":return{refId:Te,expr:le.query};default:throw new Error(`Query for datasource type ${pe.type} is currently not supported by cloud alert rules.`)}}const he=({rule:pe})=>{const[le,Te]=(0,n.useState)({}),Ee=(0,n.useMemo)(()=>new q.t,[]),Re=(0,o.A)(Ee.get()),me=De(Re),Me=(0,n.useMemo)(()=>ue(pe),[pe]),{allDataSourcesAvailable:ye}=(0,ne.g)(Me),Le=(0,n.useCallback)(()=>{if(Me.length>0&&ye){const Ye=Me.map(st=>({...st,relativeTimeRange:le[st.refId]??st.relativeTimeRange}));let at;pe&&(0,oe.lT)(pe.rulerRule)&&(at=pe.rulerRule.grafana_alert.condition),Ee.run(Ye,at??"A")}},[Me,ye,pe,Ee,le]);(0,n.useEffect)(()=>{const Ye=ue(pe),at=Object.fromEntries(Ye.map(st=>[st.refId,st.relativeTimeRange??{from:0,to:0}]));Te(at)},[pe]),(0,n.useEffect)(()=>{ye&&Le()},[ye,Le]),(0,n.useEffect)(()=>()=>Ee.destroy(),[Ee]);const We=(0,n.useCallback)((Ye,at)=>{const st=(0,t.jM)(le,Ke=>{Ke[Ye]=at});Te(st)},[le,Te]),Be=(0,oe.YN)(pe.group);return n.createElement(n.Fragment,null,me?"Loading...":n.createElement(n.Fragment,null,(0,oe.lT)(pe.rulerRule)&&!Be&&n.createElement(L,{condition:pe.rulerRule.grafana_alert.condition,queries:Me,evalDataByQuery:Re,evalTimeRanges:le,onTimeRangeChange:We}),!(0,oe.lT)(pe.rulerRule)&&!Be&&Re&&Object.keys(Re).length>0&&n.createElement("div",null,Me.map(Ye=>n.createElement(U,{key:Ye.refId,refId:Ye.refId,model:Ye.model,dataSource:Object.values(r.$.datasources).find(at=>at.uid===Ye.datasourceUid),queryData:Re[Ye.refId],relativeTimeRange:Ye.relativeTimeRange,evalTimeRange:le[Ye.refId],onEvalTimeRangeChange:at=>We(Ye.refId,at),isAlertCondition:!1}))),!Be&&!ye&&n.createElement(g.F,{title:"Query not available",severity:"warning"},"Cannot display the query preview. Some of the data sources used in the queries are not available.")))};function De(pe){return pe?!!Object.values(pe).find(le=>le.state===s.Gu.Loading):!0}},56812:(Q,A,e)=>{"use strict";e.d(A,{K:()=>o,k:()=>s});var t=e(96540);const n=t.createContext(void 0),o=({children:r,rule:g,identifier:u})=>{const c={rule:g,identifier:u};return t.createElement(n.Provider,{value:c},r)},s=()=>{const r=t.useContext(n);if(r===void 0)throw new Error("useAlertRule must be used within a AlertRuleContext");return r}},51174:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{Title:()=>Ke,createListFilterLink:()=>st,default:()=>be,isErrorHealth:()=>Xe});var t=e(32196),n=e(2543),o=e(96540),s=e(67061),r=e(42418),g=e(40980),u=e(72109),c=e(94753),i=e(40845),l=e(55852),f=e(83277),d=e(94822),h=e(79741),p=e(55740),m=e(56361),a=e(23662),v=e(3704),E=e(69087),D=e(33450),b=e(48205),C=e(96636),y=e(99106),M=e(51921);function T(){return o.createElement(r.F,{severity:"info",title:"This rule is part of a federated rule group.",bottomSpacing:0,topSpacing:2},o.createElement(s.B,{direction:"column"},"Federated rule groups are currently an experimental feature.",o.createElement(l.$n,{fill:"text",icon:"book"},o.createElement("a",{href:"https://grafana.com/docs/metrics-enterprise/latest/tenant-management/tenant-federation/#cross-tenant-alerting-and-recording-rule-federation"},"Read documentation"))))}var I=e(72095),x=e(10534),S=e(55196),O=e(16577),P=(Z=>(Z.GrafanaManagedAlertRule="Grafana-managed alert rule",Z.CloudAlertRule="Cloud alert rule",Z.CloudRecordingRule="Cloud recording rule",Z))(P||{});const L=({rule:Z})=>{const ae=(0,i.of)(R);let de;(0,a.lT)(Z.rulerRule)?de="Grafana-managed alert rule":(0,a.i7)(Z.rulerRule)?de="Cloud recording rule":de="Cloud alert rule";const ve=Z.promRule?.evaluationTime,Ue=Z.promRule?.lastEvaluation,_e=(0,o.useCallback)(()=>(0,a.lT)(Z.rulerRule)?Z.rulerRule.grafana_alert.uid:"",[Z.rulerRule]),ze=(0,a.i7)(Z.rulerRule)?void 0:Z.annotations??[],Ve=Number.isFinite(ve);return o.createElement(s.B,{direction:"column",gap:3},o.createElement("div",{className:ae.metadataWrapper},o.createElement(S.P,{direction:"column"},"Rule type",o.createElement(c.E,{color:"primary"},de)),o.createElement(S.P,{direction:"column"},(0,a.lT)(Z.rulerRule)&&o.createElement(o.Fragment,null,"Rule Identifier",o.createElement(s.B,{direction:"row",alignItems:"center",gap:.5},o.createElement(c.E,{color:"primary"},Z.rulerRule.grafana_alert.uid,o.createElement(x.b,{fill:"text",variant:"secondary",icon:"copy",size:"sm",getText:_e}))))),o.createElement(S.P,{direction:"column"},Ve&&o.createElement(o.Fragment,null,"Last evaluation",Ue&&ve&&o.createElement("span",null,o.createElement(c.E,{color:"primary"},(0,I.B)(new Date(Ue))," ago"),", took"," ",o.createElement(c.E,{color:"primary"},ve,"ms")))),o.createElement(S.P,{direction:"column"},!(0,a.i7)(Z.rulerRule)&&o.createElement(o.Fragment,null,"Pending period",o.createElement(c.E,{color:"primary"},Z.rulerRule?.for??"0s"))),(0,a.lT)(Z.rulerRule)&&o.createElement(o.Fragment,null,o.createElement(S.P,{direction:"column"},"Alert state if no data or all values are null",o.createElement(c.E,{color:"primary"},Z.rulerRule.grafana_alert.no_data_state)),o.createElement(S.P,{direction:"column"},"Alert state if execution error or timeout",o.createElement(c.E,{color:"primary"},Z.rulerRule.grafana_alert.exec_err_state)))),ze&&o.createElement(o.Fragment,null,o.createElement(c.E,{variant:"h4"},"Annotations"),Object.keys(ze).length===0?o.createElement(c.E,{variant:"bodySmall",color:"secondary",italic:!0},"No annotations"):o.createElement("div",{className:ae.metadataWrapper},Object.entries(ze).map(([Ne,ot])=>o.createElement(S.P,{direction:"column",key:Ne},Ne,o.createElement(U,{value:ot}))))))};function U({value:Z}){const ae=Z&&Z.startsWith("http"),de=o.createElement(O.Y,{input:Z,delimiter:["{{","}}"]});return ae?o.createElement(u.Y,{variant:"bodySmall",href:Z,external:!0},Z):o.createElement(c.E,{color:"primary"},de)}const R=Z=>({metadataWrapper:(0,t.css)({display:"grid",gridTemplateColumns:"auto auto",rowGap:Z.spacing(3),columnGap:Z.spacing(12)})});var B=e(32264),H=e(46013);const w=(0,o.lazy)(()=>e.e(7409).then(e.bind(e,87409))),N=(0,o.lazy)(()=>e.e(1121).then(e.bind(e,31121))),V=({rule:Z})=>{const ae=B.$.unifiedAlerting.alertStateHistoryBackend,de=B.$.unifiedAlerting.alertStateHistoryPrimary,Ue=[ae,de].some(Ve=>Ve===H.Q.Loki)?H.Q.Loki:H.Q.Annotations,_e=Z.grafana_alert.id??"",ze=Z.grafana_alert.uid;return o.createElement(o.Suspense,{fallback:"Loading..."},Ue===H.Q.Loki&&o.createElement(N,{ruleUID:ze}),Ue===H.Q.Annotations&&o.createElement(w,{alertId:_e}))};var G=e(15054),_=e(99938);const K=({rule:Z})=>o.createElement(_.s,{rule:Z,pagination:{itemsPerPage:G.FG},enableFiltering:!0});var j=e(47207);const k=()=>o.createElement(o.Fragment,null,"Routing");var Y=e(26272),ee=e(83122),re=e(38138),J=e(28138),ne=e(19073),q=e(18461),te=e(90141),oe=e(68291),ue=e(56812);const ie=({handleDelete:Z,handleDuplicateRule:ae})=>{const{rule:de,identifier:ve}=(0,ue.k)(),[Ue,_e]=(0,ne.mh)(de,ne.j5.Update),ze=Ue&&_e,[Ve,Ne]=(0,ne.mh)(de,ne.j5.Delete),ot=Ve&&Ne,[nt,pt]=(0,ne.mh)(de,ne.j5.Duplicate),mt=nt&&pt,[gt,Pt]=(0,ne.mh)(de,ne.j5.Silence),Mt=gt&&Pt,[Yt,zt]=(0,ne.mh)(de,ne.j5.ModifyExport),_t=Yt&&zt,rt=!(0,m.y$)()||(0,m.ES)(),It=(0,m.S2)(de.namespace.rulesSource,de);return[ze&&o.createElement(De,{key:"edit-action",identifier:ve}),o.createElement(ee.m,{key:"more-actions",overlay:o.createElement(re.W,null,Mt&&o.createElement(re.W.Item,{label:"Silence",icon:"bell-slash",url:(0,m.t7)(ve.ruleSourceName,de)}),rt&&o.createElement(oe.d,{title:de.name,url:""}),mt&&o.createElement(re.W.Item,{label:"Duplicate",icon:"copy",onClick:()=>ae(ve)}),o.createElement(re.W.Divider,null),o.createElement(re.W.Item,{label:"Copy link",icon:"share-alt",onClick:()=>ge(It)}),_t&&o.createElement(re.W.Item,{label:"Export",icon:"download-alt",childItems:[o.createElement(he,{key:"export-with-modifications",identifier:ve})]}),ot&&o.createElement(o.Fragment,null,o.createElement(re.W.Divider,null),o.createElement(re.W.Item,{label:"Delete",icon:"trash-alt",destructive:!0,onClick:()=>Z(de)})))},o.createElement(te.A,{size:"md"}))]};function ge(Z){navigator.clipboard?.writeText(Z).then(()=>{J.A.emit(Y.r1.alertSuccess,["URL copied to clipboard"])})}const he=({identifier:Z})=>{const ae=location.pathname+location.search,de=(0,v.c)(`/alerting/${encodeURIComponent(q.$9(Z))}/modify-export`,{returnTo:ae});return o.createElement(re.W.Item,{key:"with-modifications",label:"With modifications",icon:"file-edit-alt",url:de})},De=({identifier:Z})=>{const ae=location.pathname+location.search,de=q.$9(Z),ve=(0,v.c)(`/alerting/${encodeURIComponent(de)}/edit`,{returnTo:ae});return o.createElement(l.z9,{variant:"secondary",icon:"pen",href:ve},"Edit")};var pe=e(96374),le=e(99140),Te=e(23770),Ee=e(57220);const Re=()=>{const[Z,ae]=(0,o.useState)(),de=(0,o.useCallback)(()=>{ae(void 0)},[]),ve=(0,o.useCallback)(ze=>{ae(ze)},[]),Ue=(0,o.useCallback)(ze=>{if(ze&&ze.rulerRule){const Ve=(0,q.P1)((0,Ee.EV)(ze.namespace.rulesSource),ze.namespace.name,ze.group.name,ze.rulerRule);(0,le.JD)((0,Te.KH)(Ve,{navigateTo:"/alerting/list"})),de()}},[de]);return[(0,o.useMemo)(()=>o.createElement(pe.u,{isOpen:!!Z,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:()=>Ue(Z),onDismiss:de}),[Ue,de,Z]),ve,de]},me=Z=>{const ae=(0,i.of)(Me,Z);return o.createElement(s.B,{direction:"row",gap:.5},o.createElement("div",{className:ae.dot}))},Me=(Z,ae)=>{const de=Z.spacing(1.25),ve=`calc(${de} / 2.5)`,Ue=ae.color==="error",_e=ae.color==="success",ze=ae.color==="warning";return{dot:(0,t.css)` width: ${de}; height: ${de}; border-radius: 100%; background-color: ${Z.colors.secondary.main}; outline: solid ${ve} ${Z.colors.secondary.transparent}; margin: ${ve}; ${_e&&(0,t.css)({backgroundColor:Z.colors.success.main,outlineColor:Z.colors.success.transparent})} ${ze&&(0,t.css)({backgroundColor:Z.colors.warning.main,outlineColor:Z.colors.warning.transparent})} ${Ue&&(0,t.css)({backgroundColor:Z.colors.error.main,outlineColor:Z.colors.error.transparent})} `}},ye=({health:Z})=>{const ae=Xe(Z),de=ae?"error":"success",ve=ae?"Recording error":"Recording";return o.createElement(We,{color:de,text:ve})},Le=({state:Z,health:ae})=>{let de,ve;switch(Z){case d.cF.Inactive:ve="success",de="Normal";break;case d.cF.Firing:ve="error",de="Firing";break;case d.cF.Pending:ve="warning",de="Pending";break}return Xe(ae)&&(ve="error",de="Error"),ae==="nodata"&&(ve="warning",de="No data"),o.createElement(We,{color:ve,text:de})};function We({color:Z,text:ae}){return o.createElement(s.B,{direction:"row",gap:.5,wrap:"nowrap",flex:"0 0 auto"},o.createElement(me,{color:Z}),o.createElement(c.E,{variant:"bodySmall",color:Z},ae))}var Be=(Z=>(Z.Query="query",Z.Instances="instances",Z.History="history",Z.Routing="routing",Z.Details="details",Z))(Be||{});const Ye=()=>{const{rule:Z}=(0,ue.k)(),{pageNav:ae,activeTab:de}=xe(Z),[ve,Ue]=(0,o.useState)(),[_e,ze]=Re(),Ve=ie({handleDuplicateRule:Ue,handleDelete:ze}),{annotations:Ne,promRule:ot}=Z,nt=Xe(Z.promRule?.health),pt=(0,a.Z8)(ot),mt=(0,a.YN)(Z.group),gt=(0,a.lT)(Z.rulerRule)&&!!Z.rulerRule.grafana_alert.provenance,Pt=Ne[p.YH.summary];return o.createElement(D.d,{pageNav:ae,navId:"alert-list",isLoading:!1,renderTitle:Mt=>o.createElement(Ke,{name:Mt,state:pt?ot.state:void 0,health:Z.promRule?.health,ruleType:Z.promRule?.type}),actions:Ve,info:at(Z),subTitle:o.createElement(s.B,{direction:"column"},Pt,mt&&o.createElement(T,null),gt&&o.createElement(b.Yi,{resource:b.hk.AlertRule,bottomSpacing:0,topSpacing:2}),nt&&o.createElement(r.F,{title:"Something went wrong when evaluating this alert rule",bottomSpacing:0,topSpacing:2},o.createElement("pre",{style:{marginBottom:0}},o.createElement("code",null,Z.promRule?.lastError??"No error message"))))},o.createElement(s.B,{direction:"column",gap:2},o.createElement(g.J,null,de==="query"&&o.createElement(j.D,{rule:Z}),de==="instances"&&o.createElement(K,{rule:Z}),de==="history"&&(0,a.lT)(Z.rulerRule)&&o.createElement(V,{rule:Z.rulerRule}),de==="routing"&&o.createElement(k,null),de==="details"&&o.createElement(L,{rule:Z}))),_e,ve&&o.createElement(M.Z,{redirectTo:!0,identifier:ve,isProvisioned:gt,onDismiss:()=>Ue(void 0)}))},at=Z=>{const{labels:ae,annotations:de,group:ve}=Z,Ue=[],_e=de[p.YH.runbookURL],ze=de[p.YH.dashboardUID],Ve=de[p.YH.panelID],Ne=ze&&Ve,ot=ze,nt=!(0,n.isEmpty)(ae),pt=ve.interval;return _e&&Ue.push({label:"Runbook",value:o.createElement(u.Y,{variant:"bodySmall",href:_e,external:!0},(0,n.truncate)(_e,{length:42}))}),Ne?Ue.push({label:"Dashboard and panel",value:o.createElement(C.d,{title:Z.name,component:o.createElement(u.Y,{variant:"bodySmall",href:(0,m.D2)(ze,Ve)},"View panel")})}):ot&&Ue.push({label:"Dashboard",value:o.createElement(C.d,{title:Z.name,component:o.createElement(u.Y,{title:Z.name,variant:"bodySmall",href:(0,m.JM)(ze)},"View dashboard")})}),pt&&Ue.push({label:"Evaluation interval",value:o.createElement(c.E,{color:"primary"},"Every ",pt)}),nt&&Ue.push({label:"Labels",value:o.createElement(E.m,{labels:ae,size:"sm"})}),Ue},st=Z=>{const ae=new URLSearchParams([["search",Z.map(([de,ve])=>`${de}:"${ve}"`).join(" ")]]);return(0,v.c)("/alerting/list?"+ae.toString())},Ke=({name:Z,state:ae,health:de,ruleType:ve})=>{const Ue=(0,i.of)($e),_e=ve===d.JS.Recording;return o.createElement("div",{className:Ue.title},o.createElement(l.z9,{variant:"secondary",icon:"angle-left",href:"/alerting/list"}),o.createElement(c.E,{variant:"h1",truncate:!0},Z),ae&&o.createElement(Le,{state:ae,health:de}),_e&&o.createElement(ye,{health:de}))},Xe=Z=>Z==="error"||Z==="err";function He(){const[Z,ae]=(0,f.s)(),de=Z.tab;return[Ge(de)?de:"query",_e=>{ae({tab:_e})}]}function Ge(Z){return typeof Z=="string"&&Object.values(Be).includes(Z)}function xe(Z){const[ae,de]=He(),{annotations:ve,promRule:Ue}=Z,_e=ve[p.YH.summary],ze=(0,a.Z8)(Ue),Ve=ze?(Ue.alerts??[]).length:void 0,Ne=(0,y.EL)(Z.namespace).name,ot=Z.group.name,nt=(0,a.lT)(Z.rulerRule)&&ze,pt=(0,a.KB)(Z.promRule);return{pageNav:{...h.defaultPageNav,text:Z.name,subTitle:_e,children:[{text:"Query and conditions",active:ae==="query",onClick:()=>{de("query")}},{text:"Instances",active:ae==="instances",onClick:()=>{de("instances")},tabCounter:Ve,hideFromTabs:pt},{text:"History",active:ae==="history",onClick:()=>{de("history")},hideFromTabs:!nt},{text:"Details",active:ae==="details",onClick:()=>{de("details")}}],parentItem:{text:ot,url:st([["namespace",Ne],["group",ot]]),parentItem:{text:Ne,url:st([["namespace",Ne]])}}},activeTab:ae}}const $e=()=>({title:(0,t.css)({display:"flex",alignItems:"center",gap:8,minWidth:0})}),be=Ye},2426:(Q,A,e)=>{"use strict";e.d(A,{D:()=>b});var t=e(96540),n=e(8249),o=e(47232),s=e(74135),r=e(23662),g=e(69087),u=e(75591),c=e(4402),i=e(83122),l=e(29158),f=e(24401),d=e(30973);const h=({rule:y,instance:M,extensionPointId:T})=>{const[I,x]=(0,t.useState)(),O=p({instance:M,rule:y},T);if(O.length===0)return null;const P=t.createElement(d.w,{extensions:O,onSelect:x});return t.createElement(t.Fragment,null,t.createElement(i.m,{placement:"bottom-start",overlay:P},t.createElement(l.K,{name:"ellipsis-v","aria-label":"Actions",variant:"secondary"})),!!I&&!!I.path&&t.createElement(f.s,{path:I.path,title:I.title,onDismiss:()=>x(void 0)}))};function p(y,M){return(0,t.useMemo)(()=>{const{extensions:T}=(0,c.Kf)({extensionPointId:M,context:y,limitPerPlugin:3});return T},[y,M])}var m=e(33225),a=e(71223),v=e(84396);const E=({instance:y})=>{const M=(0,m.Hx)(y.annotations),T=(0,m.gO)(M);return t.createElement("div",null,y.value&&t.createElement(v.X,{label:"Value",horizontal:!0},y.value),M.map(([I,x])=>t.createElement(a.s,{key:I,annotationKey:I,value:x,valueLink:T.get(I)})))};var D=e(30423);const b=({rule:y,instances:M,pagination:T,footerRow:I})=>{const x=(0,t.useMemo)(()=>M.length>1?(0,n.yO)(M.map(O=>O.labels)):{},[M]),S=(0,t.useMemo)(()=>M.map(O=>({data:{rule:y,alert:{...O,commonLabels:x}},id:(0,r.RI)(O)})),[x,M,y]);return t.createElement(u.E,{cols:C,isExpandable:!0,items:S,renderExpandedContent:({data:O})=>t.createElement(E,{instance:O.alert}),pagination:T,footerRow:I})},C=[{id:"state",label:"State",renderCell:({data:{alert:{state:y}}})=>t.createElement(D.C,{state:y}),size:"80px"},{id:"labels",label:"Labels",renderCell:({data:{alert:{labels:y,commonLabels:M}}})=>t.createElement(g.m,{labels:y,commonLabels:M,size:"sm"})},{id:"created",label:"Created",renderCell:({data:{alert:{activeAt:y}}})=>t.createElement(t.Fragment,null,y.startsWith("0001")?"-":(0,o.KQ)(y).format("YYYY-MM-DD HH:mm:ss")),size:"150px"},{id:"actions",label:"",renderCell:({data:{alert:y,rule:M}})=>t.createElement(h,{rule:M,instance:y,extensionPointId:s.S.AlertInstanceAction,key:"alert-instance-extension-point"}),size:"40px"}]},30423:(Q,A,e)=>{"use strict";e.d(A,{C:()=>s});var t=e(96540),n=e(23662),o=e(65415);const s=t.memo(({state:r,isPaused:g=!1,size:u="md",muted:c=!1})=>t.createElement(o.O,{state:(0,n.Wy)(r),size:u,muted:c},(0,n.XI)(r)," ",g?" (Paused)":""));s.displayName="AlertStateTag"},51921:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>g});var t=e(96540),n=e(24180),o=e(96374),s=e(55852),r=e(18461);function g({identifier:c,isProvisioned:i,redirectTo:l=!1,onDismiss:f}){const d=(0,n.zy)(),[h,p]=(0,t.useState)(i?"confirm":"redirect");if(h==="redirect"){const m=r.$9(c),a=d.pathname+d.search,v=new URLSearchParams({copyFrom:m,returnTo:l?a:""});return t.createElement(n.rd,{to:"/alerting/new?"+v.toString(),push:!0})}return t.createElement(o.u,{isOpen:h==="confirm",title:"Copy provisioned alert rule",body:t.createElement("div",null,t.createElement("p",null,"The new rule will ",t.createElement("strong",null,"not")," be marked as a provisioned rule."),t.createElement("p",null,"You will need to set a new evaluation group for the copied rule because the original one has been provisioned and cannot be used for rules created in the UI.")),confirmText:"Copy",onConfirm:()=>p("redirect"),onDismiss:f})}const u=t.forwardRef(({text:c,ruleIdentifier:i,isProvisioned:l,className:f},d)=>{const[h,p]=(0,t.useState)(!1);return t.createElement(t.Fragment,null,t.createElement(s.$n,{title:"Copy",className:f,size:"sm",key:"clone",variant:"secondary",icon:"copy",onClick:()=>p(!0),ref:d},c),h&&t.createElement(g,{identifier:i,isProvisioned:l,onDismiss:()=>p(!1)}))});u.displayName="CloneRuleButton"},11536:(Q,A,e)=>{"use strict";e.d(A,{DI:()=>D,Ys:()=>E});var t=e(32196),n=e(96540),o=e(72724),s=e(47232),r=e(40845),g=e(56034),u=e(97814),c=e(33225),i=e(23662),l=e(25968),f=e(69087),d=e(84396),h=e(147),p=e(60996),m=e(52788),a=e(43644),v=e(99938);const E=15,D=({rule:y})=>{const M=(0,r.of)(C),{namespace:{rulesSource:T}}=y,I=(0,c.Hx)(y.annotations);return n.createElement("div",null,n.createElement(h.Q,{rule:y,rulesSource:T,isViewMode:!1}),n.createElement("div",{className:M.wrapper},n.createElement("div",{className:M.leftSide},n.createElement(b,{rule:y}),!!y.labels&&!!Object.keys(y.labels).length&&n.createElement(d.X,{label:"Labels",horizontal:!0},n.createElement(f.m,{labels:y.labels})),n.createElement(a.z,{rulesSource:T,rule:y,annotations:I}),n.createElement(p.Z,{annotations:I})),n.createElement("div",{className:M.rightSide},n.createElement(m.Z,{rulesSource:T,rule:y}))),n.createElement(d.X,{label:"Matching instances",horizontal:!0},n.createElement(v.s,{rule:y,itemsDisplayLimit:E})))},b=({rule:y})=>{let M,T=y.group.interval,I=y.promRule?.lastEvaluation,x=y.promRule?.evaluationTime;return(0,i.i7)(y.rulerRule)||(M=y.rulerRule?.for??"0s"),n.createElement(n.Fragment,null,T&&n.createElement(d.X,{label:"Evaluate",horizontal:!0},"Every ",T),n.createElement(d.X,{label:"Pending period",horizontal:!0},M),I&&!(0,l.mo)(I)&&n.createElement(d.X,{label:"Last evaluation",horizontal:!0},n.createElement(g.m,{placement:"top",content:`${(0,o.LE)(I,{format:"YYYY-MM-DD HH:mm:ss"})}`,theme:"info"},n.createElement("span",null,`${(0,s.KQ)(I).locale("en").fromNow(!0)} ago`))),I&&!(0,l.mo)(I)&&x!==void 0&&n.createElement(d.X,{label:"Evaluation time",horizontal:!0},n.createElement(g.m,{placement:"top",content:`${x}s`,theme:"info"},n.createElement("span",null,(0,u.g)({timeInMs:x*1e3,humanize:!0})))))},C=y=>({wrapper:(0,t.css)` display: flex; flex-direction: row; ${y.breakpoints.down("md")} { flex-direction: column; } `,leftSide:(0,t.css)` flex: 1; `,rightSide:(0,t.css)` ${y.breakpoints.up("md")} { padding-left: 90px; width: 300px; } `})},147:(Q,A,e)=>{"use strict";e.d(A,{Q:()=>B});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(24180),g=e(40672),u=e(76885),c=e(14778),i=e(32264),l=e(40845),f=e(55852),d=e(10534),h=e(38138),p=e(66864),m=e(83122),a=e(14578),v=e(96374),E=e(3169),D=e(80348),b=e(94822),C=e(19073),y=e(46013),M=e(23770),T=e(98164),I=e(55740),x=e(57220),S=e(56361),O=e(18461),P=e(23662),L=e(3704),U=e(68291),R=e(51921);const B=({rule:N,rulesSource:V,isViewMode:G})=>{const _=(0,l.of)(w),{namespace:K,group:j,rulerRule:k}=N,{StateHistoryModal:Y,showStateHistoryModal:ee}=(0,y.G)(),re=(0,D.useDispatch)(),J=(0,r.zy)(),ne=(0,E._2)(),q=(0,c.i)(),[te,oe]=(0,s.useState)(),[ue,ie]=(0,s.useState)(void 0),ge=(0,x.z2)(V)?V:(0,T.F9)(V.jsonData.alertmanagerUid)?.name,[he,De]=(0,C.mh)(N,C.j5.Duplicate),[pe,le]=(0,C.mh)(N,C.j5.Silence),[Te,Ee]=(0,C.mh)(N,C.j5.Explore),[Re,me]=(0,C.mh)(N,C.j5.Delete),[Me,ye]=(0,C.mh)(N,C.j5.Update),Le=[],We=[],Be=[],Ye=()=>{if(te&&te.rulerRule){const Z=O.P1((0,x.EV)(te.namespace.rulesSource),te.namespace.name,te.group.name,te.rulerRule);re((0,M.KH)(Z,{navigateTo:G?"/alerting/list":void 0})),oe(void 0)}},at=(0,P.YN)(j),st=(0,P.lT)(N.rulerRule)&&!!N.rulerRule.grafana_alert.provenance,Ke=(0,P.Z8)(N.promRule)&&N.promRule.state===b.cF.Firing,Xe=Re&&me,He=Me&&ye,Ge=pe&&le&&ge,xe=he&&De&&!at,$e=()=>(0,S.S2)(V,N),be=J.pathname+J.search;if((0,x.Eb)(V)&&Te&&Ee&&!at&&Le.push(s.createElement(f.z9,{size:"sm",key:"explore",variant:"primary",icon:"chart-line",target:"_blank",href:(0,S.Yp)(V,N.query)},"See graph")),N.annotations[I.YH.runbookURL]&&Le.push(s.createElement(f.z9,{size:"sm",key:"runbook",variant:"primary",icon:"book",target:"_blank",href:g.sQ.sanitizeUrl(N.annotations[I.YH.runbookURL])},"View runbook")),N.annotations[I.YH.dashboardUID]){const Z=N.annotations[I.YH.dashboardUID];if(Z){Le.push(i.$.featureToggles.returnToPrevious?s.createElement(f.z9,{size:"sm",key:"dashboard",variant:"primary",icon:"apps",href:`d/${encodeURIComponent(Z)}`,onClick:()=>{q(N.name)}},"Go to dashboard"):s.createElement(f.z9,{size:"sm",key:"dashboard",variant:"primary",icon:"apps",target:"_blank",href:`d/${encodeURIComponent(Z)}`},"Go to dashboard"));const ae=N.annotations[I.YH.panelID];ae&&Le.push(s.createElement(f.z9,{size:"sm",key:"panel",variant:"primary",icon:"apps",target:"_blank",href:`d/${encodeURIComponent(Z)}?viewPanel=${encodeURIComponent(ae)}`},"Go to panel"))}}if(Ge&&Le.push(s.createElement(f.z9,{size:"sm",key:"silence",icon:"bell-slash",target:"_blank",href:(0,S.t7)(ge,N)},"Silence")),(0,P.lT)(N.rulerRule)&&Le.push(s.createElement(s.Fragment,{key:"history"},s.createElement(f.$n,{size:"sm",icon:"history",onClick:()=>(0,P.lT)(N.rulerRule)&&ee(N.rulerRule)},"Show state history"),Y)),Ke&&H()&&Le.push(s.createElement(s.Fragment,{key:"declare-incident"},s.createElement(U.b,{title:N.name,url:$e()}))),G&&k){const Z=(0,x.EV)(V),ae=O.P1(Z,K.name,j.name,k);if(He&&(We.push(s.createElement(d.b,{key:"copy",icon:"copy",onClipboardError:de=>{ne.error("Error while copying URL",de)},size:"sm",getText:$e},"Copy link to rule")),!st)){const de=u.kM.renderUrl(`${i.$.appSubUrl}/alerting/${encodeURIComponent(O.$9(ae))}/edit`,{returnTo:be});We.push(s.createElement(f.z9,{size:"sm",key:"edit",variant:"secondary",icon:"pen",href:de},"Edit"))}if((0,P.lT)(k)){const de=(0,L.c)(`/alerting/${encodeURIComponent(O.$9(ae))}/modify-export`);Be.push(s.createElement(h.W.Item,{label:"Modify export",icon:"edit",url:de}))}xe&&Be.push(s.createElement(h.W.Item,{label:"Duplicate",icon:"copy",onClick:()=>ie({identifier:ae,isProvisioned:st})})),Xe&&(Be.push(s.createElement(h.W.Divider,null)),Be.push(s.createElement(h.W.Item,{key:"delete",label:"Delete",icon:"trash-alt",onClick:()=>oe(N)})))}return Le.length||We.length||Be.length?s.createElement(s.Fragment,null,s.createElement("div",{className:_.wrapper},s.createElement(p.Gy,{width:"auto"},Le.length?Le:s.createElement("div",null)),s.createElement(p.Gy,{width:"auto"},We.length&&We,Be.length&&s.createElement(m.m,{overlay:s.createElement(h.W,null,Be.map(Z=>s.createElement(s.Fragment,{key:(0,n.uniqueId)("action_")},Z)))},s.createElement(f.$n,{variant:"secondary",size:"sm"},"More",s.createElement(a.I,{name:"angle-down"}))))),!!te&&s.createElement(v.u,{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:Ye,onDismiss:()=>oe(void 0)}),ue&&s.createElement(R.Z,{identifier:ue.identifier,isProvisioned:ue.isProvisioned,onDismiss:()=>ie(void 0)})):null};function H(){return!(0,S.y$)()||(0,S.ES)()}const w=N=>({wrapper:(0,t.css)` padding: 0 0 ${N.spacing(2)} 0; gap: ${N.spacing(1)}; display: flex; flex-direction: row; justify-content: space-between; flex-wrap: wrap; border-bottom: solid 1px ${N.colors.border.medium}; `})},60996:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(33225),r=e(71223);function g(c){const i=(0,o.of)(u),{annotations:l}=c,f=(0,s.gO)(l);return l.length===0?null:n.createElement("div",{className:i.annotations},l.map(([d,h])=>n.createElement(r.s,{key:d,annotationKey:d,value:h,valueLink:f.get(d)})))}const u=()=>({annotations:(0,t.css)` margin-top: 46px; `})},52788:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>i});var t=e(32196),n=e(96540),o=e(19347),s=e(40845),r=e(66718),g=e(57220),u=e(23662),c=e(84396);function i(f){const{rulesSource:d,rule:h}=f,p=(0,s.of)(l),m=(0,n.useMemo)(()=>{if((0,g.Eb)(d))return[{name:d.name,icon:d.meta.info.logos.small}];if((0,u.lT)(h.rulerRule)){const{data:a}=h.rulerRule.grafana_alert,v=a.reduce((E,D)=>{const b=(0,o.l)().getInstanceSettings(D.datasourceUid);return!b||b.uid===r.Uj||(E[b.name]={name:b.name,icon:b.meta.info.logos.small}),E},{});return Object.values(v)}return[]},[h,d]);return m.length===0?null:n.createElement(c.X,{label:"Data source"},m.map(({name:a,icon:v},E)=>n.createElement("div",{key:a},v&&n.createElement(n.Fragment,null,n.createElement("img",{alt:`${a} datasource logo`,className:p.dataSourceIcon,src:v})," "),a)))}function l(f){const d=f.spacing(2);return{dataSourceIcon:(0,t.css)` width: ${d}; height: ${d}; `}}},43644:(Q,A,e)=>{"use strict";e.d(A,{z:()=>a});var t=e(32196),n=e(96540),o=e(57220),s=e(84396),r=e(28848),g=e(29317),u=e(41781),c=e(72307),i=e(40845),l=e(71713),f=e(69470),d=e(73750);const h=({language:E,expr:D})=>{const b=(0,n.useMemo)(()=>[(0,u.D)({onlyIn:y=>"type"in y&&y.type==="code_block",getSyntax:()=>E},{...r.languages,[E]:E==="logql"?l.Ay:f.Ay})],[E]),C=(0,n.useMemo)(()=>(0,c.mO)(D),[D]);return n.createElement(g.KE,{"data-testid":"expression-editor",plugins:b,value:C})},p=({expression:E,rulesSource:D})=>{const b=(0,i.of)(m);return n.createElement(d.L,{className:(0,t.cx)(b.well,"slate-query-field")},(0,o.Eb)(D)?n.createElement(h,{expr:E,language:D.type===o.ol.Loki?"logql":"promql"}):E)},m=E=>({well:(0,t.css)` font-family: ${E.typography.fontFamilyMonospace}; `});function a(E){const{annotations:D,rulesSource:b,rule:C}=E,y=v();return(0,o.Eb)(b)?n.createElement(s.X,{label:"Expression",horizontal:!0,className:(0,t.cx)({[y.exprRow]:!!D.length})},n.createElement(p,{expression:C.query,rulesSource:b})):null}const v=()=>({exprRow:(0,t.css)` margin-bottom: 46px; `})},99938:(Q,A,e)=>{"use strict";e.d(A,{s:()=>C});var t=e(32196),n=e(2543),o=e(96540),s=e(40845),r=e(55852),g=e(53876),u=e(78369),c=e(60029),i=e(94354),l=e(94822);const f=({className:T,onStateFilterChange:I,stateFilter:x,filterType:S,itemPerStateStats:O})=>{const P=(0,s.of)(d),L=w=>function(){return O&&O[w]?o.createElement(u.v,{name:O[w].toFixed(0),colorIndex:9,className:P.tag}):null},U=Object.values(l.Gi).map(w=>({label:w,value:w,component:L(w)})),B=[l.cF.Firing,l.cF.Pending].map(w=>({label:(0,n.capitalize)(w),value:w,component:L(w)})),H=S==="grafana"?U:B;return o.createElement("div",{className:T,"data-testid":"alert-instance-state-filter"},o.createElement(c.J,null,"State"),o.createElement(i.z,{options:H,value:x,onChange:I,onClick:w=>{w===x&&I(void 0)}}))};function d(T){return{tag:(0,t.css)` font-size: 11px; font-weight: normal; padding: ${T.spacing(.25,.5)}; vertical-align: middle; margin-left: ${T.spacing(.5)}; `}}var h=e(98164),p=e(56361),m=e(64861),a=e(57220),v=e(23662),E=e(2426),D=e(92467);function b({stats:T,onClick:I,href:x}){const S=(0,s.of)(M);return o.createElement("div",{className:S.footerRow},o.createElement("div",null,"Showing ",T.visibleItemsCount," out of ",T.totalItemsCount," instances"),o.createElement(r.z9,{size:"sm",variant:"secondary","data-testid":"show-all",onClick:I,href:x},"Show all ",T.totalItemsCount," alert instances"))}function C(T){const{rule:I,itemsDisplayLimit:x=Number.POSITIVE_INFINITY,pagination:S,enableFiltering:O=!1}=T,{promRule:P,namespace:L,instanceTotals:U}=I,[R,B]=(0,o.useState)(),[H,w]=(0,o.useState)(),[N]=(0,o.useState)(Math.floor(Math.random()*100)),V=`queryString-${N}`,G=(0,s.of)(M),_=(0,a.z2)(L.rulesSource)?a.hY:"prometheus",K=(0,o.useMemo)(()=>(0,v.Z8)(P)&&P.alerts?.length?y(R,H,(0,p.Cp)(m.xB.Importance,P.alerts)):[],[P,H,R]);if(!(0,v.Z8)(P))return null;const j=K.slice(0,x),k=(0,n.countBy)(P.alerts,oe=>(0,l.lh)(oe.state)),Y=(0,n.sum)([U.alerting,U.inactive,U.pending,U.nodata]),ee=Y-j.length,re={totalItemsCount:Y,visibleItemsCount:j.length},J=(0,p.w$)(L.rulesSource,T.rule,location.pathname+location.search),ne=(0,D.kc)(U),q=()=>w(void 0),te=ee?o.createElement(b,{stats:re,onClick:O?q:void 0,href:O?void 0:J}):void 0;return o.createElement(o.Fragment,null,O&&o.createElement("div",{className:(0,t.cx)(G.flexRow,G.spaceBetween)},o.createElement("div",{className:G.flexRow},o.createElement(g.X,{key:V,defaultQueryString:R,onFilterChange:oe=>B(oe)}),o.createElement(f,{filterType:_,stateFilter:H,onStateFilterChange:w,itemPerStateStats:k}))),!O&&o.createElement("div",{className:G.stats},ne),o.createElement(E.D,{rule:I,instances:j,pagination:S,footerRow:te}))}function y(T,I,x){let S=[...x];if(T){const O=(0,h.J$)(T||"");S=S.filter(({labels:P})=>(0,h.Av)(P,O))}return I&&(S=S.filter(O=>(0,l.lh)(O.state)===I)),S}const M=T=>({flexRow:(0,t.css)` display: flex; flex-direction: row; align-items: flex-end; width: 100%; flex-wrap: wrap; margin-bottom: ${T.spacing(1)}; gap: ${T.spacing(1)}; `,spaceBetween:(0,t.css)` justify-content: space-between; `,footerRow:(0,t.css)` display: flex; flex-direction: column; gap: ${T.spacing(1)}; justify-content: space-between; align-items: center; width: 100%; `,instancesContainer:(0,t.css)` margin-bottom: ${T.spacing(2)}; `,stats:(0,t.css)` display: flex; gap: ${T.spacing(1)}; padding: ${T.spacing(1,0)}; `})},41886:(Q,A,e)=>{"use strict";e.d(A,{J:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(56034),r=e(14578),g=e(51174);const u=({rule:i})=>{const l=(0,o.of)(c);return(0,g.isErrorHealth)(i.health)?n.createElement(s.m,{theme:"error",content:i.lastError||"No error message provided."},n.createElement("div",{className:l.warn},n.createElement(r.I,{name:"exclamation-triangle"}),n.createElement("span",null,"error"))):n.createElement(n.Fragment,null,i.health)},c=i=>({warn:(0,t.css)` display: inline-flex; flex-direction: row; align-items: center; gap: ${i.spacing(1)}; color: ${i.colors.warning.text}; `})},16625:(Q,A,e)=>{"use strict";e.d(A,{_:()=>l});var t=e(32196),n=e(96540),o=e(70416),s=e(40845),r=e(67061),g=e(62930),u=e(94822),c=e(23662),i=e(30423);const l=({rule:d,isDeleting:h,isCreating:p,isPaused:m})=>{const a=(0,s.of)(f),{promRule:v}=d,E=(0,n.useMemo)(()=>{if(v&&(0,c.Z8)(v)&&v.alerts?.length&&v.state!==u.cF.Inactive){const D=v.activeAt?new Date(v.activeAt):(0,c.Om)(v);if(D)return n.createElement("span",{title:String(D),className:a.for},"for"," ",(0,o.dU)({start:D,end:new Date},!1))}return null},[v,a]);return h?n.createElement(r.B,{gap:1},n.createElement(g.y,null),"Deleting"):p?n.createElement(r.B,{gap:1},n.createElement(g.y,null),"Creating"):v&&(0,c.Z8)(v)?n.createElement(r.B,{gap:1},n.createElement(i.C,{state:v.state,isPaused:m}),E):v&&(0,c.KB)(v)?n.createElement(n.Fragment,null,"Recording rule"):n.createElement(n.Fragment,null,"n/a")},f=d=>({for:(0,t.css)` font-size: ${d.typography.bodySmall.fontSize}; color: ${d.colors.text.secondary}; white-space: nowrap; padding-top: 2px; `})},92467:(Q,A,e)=>{"use strict";e.d(A,{M_:()=>f,j7:()=>d,kc:()=>h});var t=e(2543),n=e.n(t),o=e(55127),s=e.n(o),r=e(96540),g=e(67061),u=e(39938),c=e(54317),i=e(94822);const l={recording:0,alerting:0,[i.cF.Pending]:0,[i.cF.Inactive]:0,paused:0,error:0,nodata:0},f=({namespaces:p})=>{const m={...l};p.forEach(({groups:D})=>{D.forEach(b=>{const C=(0,t.omitBy)(b.totals,t.isUndefined);for(let y in C)m[y]+=C[y]})});const a=h(m),v=!!a.length,E=(0,t.sum)(Object.values(m));return a.unshift(r.createElement(r.Fragment,{key:"total"},E," ",s()("rule",E))),r.createElement(g.B,{direction:"row"},v&&r.createElement("div",null,r.createElement(g.B,{gap:.5},a)))},d=({group:p})=>{const m=p.totals,a=p?.interval,v=h(m),E=!!v.length;return r.createElement(g.B,{direction:"row"},E&&r.createElement("div",null,r.createElement(g.B,{gap:.5},v)),a&&r.createElement(r.Fragment,null,r.createElement("div",null,"|"),r.createElement(u.E,{text:a,icon:"clock-nine",color:"blue"})))};function h(p){const m=[];return p[c.$.Alerting]&&m.push(r.createElement(u.E,{color:"red",key:"firing",text:`${p[c.$.Alerting]} firing`})),p.error&&m.push(r.createElement(u.E,{color:"red",key:"errors",text:`${p.error} errors`})),p.nodata&&m.push(r.createElement(u.E,{color:"blue",key:"nodata",text:`${p.nodata} no data`})),p[c.$.Pending]&&m.push(r.createElement(u.E,{color:"orange",key:"pending",text:`${p[c.$.Pending]} pending`})),p[c.$.Normal]&&p.paused&&m.push(r.createElement(u.E,{color:"green",key:"paused",text:`${p[c.$.Normal]} normal (${p.paused} paused)`})),p[c.$.Normal]&&!p.paused&&m.push(r.createElement(u.E,{color:"green",key:"inactive",text:`${p[c.$.Normal]} normal`})),p.recording&&m.push(r.createElement(u.E,{color:"purple",key:"recording",text:`${p.recording} recording`})),m}},82422:(Q,A,e)=>{"use strict";e.d(A,{s:()=>q});var t=e(32196),n=e(72880),o=e(91e3),s=e(96540),r=e(70416),g=e(47232),u=e(72724),c=e(40845),i=e(56034),l=e(15054),f=e(83903),d=e(55740),h=e(23662),p=e(75591),m=e(10562),a=e(48205),v=e(82437),E=e(16577),D=e(2543),b=e(24180),C=e(55852),y=e(10534),M=e(38138),T=e(67061),I=e(83122),x=e(14578),S=e(96374),O=e(3169),P=e(80348),L=e(19073),U=e(23770),R=e(57220),B=e(56361),H=e(18461),w=e(3704),N=e(51921);const V=ue=>window.matchMedia(`(max-width: ${ue}px)`).matches,G=({rule:ue,rulesSource:ie})=>{const ge=(0,P.useDispatch)(),he=(0,b.zy)(),De=(0,O._2)(),pe=(0,c.of)(K),[le,Te]=(0,s.useState)(void 0),{namespace:Ee,group:Re,rulerRule:me}=ue,[Me,ye]=(0,s.useState)(),Le=he.pathname+he.search,We=_(he.pathname),Be=(0,h.lT)(ue.rulerRule)&&!!ue.rulerRule.grafana_alert.provenance,[Ye,at]=(0,L.mh)(ue,L.j5.Update),[st,Ke]=(0,L.mh)(ue,L.j5.Delete),[Xe,He]=(0,L.mh)(ue,L.j5.Duplicate),[Ge,xe]=(0,L.mh)(ue,L.j5.ModifyExport),$e=Ye&&at,be=st&&Ke,Z=Xe&&He,ae=Ge&&xe,de=[],ve=[],Ue=()=>{if(Me&&Me.rulerRule){const Ve=H.P1((0,R.EV)(Me.namespace.rulesSource),Me.namespace.name,Me.group.name,Me.rulerRule);ge((0,U.KH)(Ve,{navigateTo:We?"/alerting/list":void 0})),ye(void 0)}},_e=()=>(0,B.S2)(ie,ue),ze=(0,R.EV)(ie);if(We||de.push(s.createElement(i.m,{placement:"top",content:"View"},s.createElement(C.z9,{className:pe.button,title:"View",size:"sm",key:"view",variant:"secondary",icon:"eye",href:(0,B.w$)(ie,ue,Le)}))),me){const Ve=H.P1(ze,Ee.name,Re.name,me);if($e){const Ne=(0,w.c)(`/alerting/${encodeURIComponent(H.$9(Ve))}/edit`,{returnTo:Le});de.push(s.createElement(i.m,{placement:"top",content:"Edit"},s.createElement(C.z9,{title:"Edit",className:pe.button,size:"sm",key:"edit",variant:"secondary",icon:"pen",href:Ne})))}We&&de.push(s.createElement(y.b,{key:"copy",icon:"copy",onClipboardError:Ne=>{De.error("Error while copying URL",Ne)},className:pe.button,size:"sm",getText:_e},"Copy link to rule")),Z&&ve.push(s.createElement(M.W.Item,{label:"Duplicate",icon:"copy",onClick:()=>Te({identifier:Ve,isProvisioned:Be})})),ae&&ve.push(s.createElement(M.W.Item,{label:"Modify export",icon:"edit",url:(0,w.c)(`/alerting/${encodeURIComponent(H.$9(Ve))}/modify-export`,{returnTo:he.pathname+he.search})})),be&&ve.push(s.createElement(M.W.Item,{label:"Delete",icon:"trash-alt",onClick:()=>ye(ue)}))}return de.length||ve.length?s.createElement(s.Fragment,null,s.createElement(T.B,{gap:1},de.map((Ve,Ne)=>s.createElement(s.Fragment,{key:Ne},Ve)),ve.length>0&&s.createElement(I.m,{overlay:s.createElement(M.W,null,ve.map(Ve=>s.createElement(s.Fragment,{key:(0,D.uniqueId)("action_")},Ve)))},s.createElement(C.$n,{variant:"secondary",size:"sm"},"More",s.createElement(x.I,{name:"angle-down"})))),!!Me&&s.createElement(S.u,{isOpen:!0,title:"Delete rule",body:s.createElement("div",null,s.createElement("p",null,'Deleting "',s.createElement("strong",null,Me.name),'" will permanently remove it from your alert rule list.'),s.createElement("p",null,"Are you sure you want to delete this rule?")),confirmText:"Yes, delete",icon:"exclamation-triangle",onConfirm:Ue,onDismiss:()=>ye(void 0)}),le&&s.createElement(N.Z,{identifier:le.identifier,isProvisioned:le.isProvisioned,onDismiss:()=>Te(void 0)})):null};function _(ue){return ue.endsWith("/view")}const K=ue=>({button:(0,t.css)` padding: 0 ${ue.spacing(2)}; `});var j=e(32264),k=e(82775);function Y({rule:ue}){const ie=(0,c.of)(ee),{exceedsLimit:ge}=(0,s.useMemo)(()=>(0,k.q)(ue.group.interval),[ue.group.interval]);return ge?s.createElement(i.m,{theme:"error",content:s.createElement("div",null,"A minimum evaluation interval of"," ",s.createElement("span",{className:ie.globalLimitValue},j.$.unifiedAlerting.minInterval)," has been configured in Grafana and will be used instead of the ",ue.group.interval," interval configured for the Rule Group.")},s.createElement(x.I,{name:"stopwatch-slash",className:ie.icon})):null}function ee(ue){return{globalLimitValue:(0,t.css)` font-weight: ${ue.typography.fontWeightBold}; `,icon:(0,t.css)` fill: ${ue.colors.warning.text}; `}}var re=e(11536),J=e(41886),ne=e(16625);const q=({rules:ue,className:ie,showGuidelines:ge=!1,emptyMessage:he="No rules found.",showGroupColumn:De=!1,showSummaryColumn:pe=!1,showNextEvaluationColumn:le=!1})=>{const Te=(0,c.of)(te),Ee=(0,t.cx)(Te.wrapper,ie,{[Te.wrapperMargin]:ge}),Re=(0,s.useMemo)(()=>ue.map((ye,Le)=>({id:`${ye.namespace.name}-${ye.group.name}-${ye.name}-${Le}`,data:ye})),[ue]),me=oe(pe,De,le);if(!ue.length)return s.createElement("div",{className:(0,t.cx)(Ee,Te.emptyMessage)},he);const Me=ge?m.B:p.E;return s.createElement("div",{className:Ee,"data-testid":"rules-table"},s.createElement(Me,{cols:me,isExpandable:!0,items:Re,renderExpandedContent:({data:ye})=>s.createElement(re.DI,{rule:ye}),pagination:{itemsPerPage:l.FG},paginationStyles:Te.pagination}))},te=ue=>({wrapperMargin:(0,t.css)` ${ue.breakpoints.up("md")} { margin-left: 36px; } `,emptyMessage:(0,t.css)` padding: ${ue.spacing(1)}; `,wrapper:(0,t.css)` width: auto; border-radius: ${ue.shape.radius.default}; `,pagination:(0,t.css)` display: flex; margin: 0; padding-top: ${ue.spacing(1)}; padding-bottom: ${ue.spacing(.25)}; justify-content: center; border-left: 1px solid ${ue.colors.border.medium}; border-right: 1px solid ${ue.colors.border.medium}; border-bottom: 1px solid ${ue.colors.border.medium}; `});function oe(ue,ie,ge){const{hasRuler:he,rulerRulesLoaded:De}=(0,f.y)(),pe=(0,s.useCallback)(le=>{const Te=le.promRule?.lastEvaluation&&(0,r.vd)(le.promRule.lastEvaluation),Ee=le.group.interval&&(0,r.di)(le.group.interval);if(!Te||!Ee||(0,h.HH)(le))return;const Re=(0,r.E9)(le.group.interval),me=Date.parse(le.promRule?.lastEvaluation||""),Me=(0,r.Ri)(me,Re);return(0,n.Y)(Me,new Date)?{humanized:`within ${(0,o.a)(Re)}`,fullDate:`within ${(0,o.a)(Re)}`}:{humanized:`in ${(0,g.KQ)(Me).locale("en").fromNow(!0)}`,fullDate:(0,u.LE)(Me,{format:"YYYY-MM-DD HH:mm:ss"})}},[]);return(0,s.useMemo)(()=>{const le=[{id:"state",label:"State",renderCell:({data:Te})=>{const{namespace:Ee}=Te,{rulesSource:Re}=Ee,{promRule:me,rulerRule:Me}=Te,ye=!!(he(Re)&&De(Re)&&me&&!Me),Le=!!(he(Re)&&De(Re)&&Me&&!me),We=(0,h.HH)(Te);return s.createElement(ne._,{rule:Te,isDeleting:ye,isCreating:Le,isPaused:We})},size:"165px"},{id:"name",label:"Name",renderCell:({data:Te})=>Te.name,size:ge?4:5},{id:"provisioned",label:"",renderCell:({data:Te})=>{const Ee=Te.rulerRule;return(0,h.lT)(Ee)&&Ee.grafana_alert.provenance?s.createElement(a.rS,null):null},size:"100px"},{id:"warnings",label:"",renderCell:({data:Te})=>s.createElement(Y,{rule:Te}),size:"45px"},{id:"health",label:"Health",renderCell:({data:{promRule:Te,group:Ee}})=>Te?s.createElement(J.J,{rule:Te}):null,size:"75px"}];return ue&&le.push({id:"summary",label:"Summary",renderCell:({data:Te})=>s.createElement(E.Y,{input:Te.annotations[d.YH.summary]??""}),size:ge?4:5}),ge&&le.push({id:"nextEvaluation",label:"Next evaluation",renderCell:({data:Te})=>{const Ee=pe(Te);return Ee&&s.createElement(i.m,{placement:"top",content:`${Ee?.fullDate}`,theme:"info"},s.createElement("span",null,Ee?.humanized))},size:2}),ie&&le.push({id:"group",label:"Group",renderCell:({data:Te})=>{const{namespace:Ee,group:Re}=Te;return Re.name==="default"?s.createElement(v.c,{namespace:Ee.name}):s.createElement(v.c,{namespace:Ee.name,group:Re.name})},size:5}),le.push({id:"actions",label:"Actions",renderCell:({data:Te})=>s.createElement(G,{rule:Te,rulesSource:Te.namespace.rulesSource}),size:"200px"}),le},[ue,ie,ge,he,De,pe])}},19073:(Q,A,e)=>{"use strict";e.d(A,{Ej:()=>v,Hl:()=>M,L7:()=>y,QI:()=>f,RY:()=>h,e2:()=>a,iI:()=>C,j5:()=>d,mh:()=>E});var t=e(96540),n=e(16233),o=e(60021),s=e(80348),r=e(82843),g=e(70383),u=e(75471),c=e(57220),i=e(23662),l=e(97009),f=(x=>(x.ViewExternalConfiguration="view-external-configuration",x.UpdateExternalConfiguration="update-external-configuration",x.CreateContactPoint="create-contact-point",x.ViewContactPoint="view-contact-point",x.UpdateContactPoint="edit-contact-points",x.DeleteContactPoint="delete-contact-point",x.ExportContactPoint="export-contact-point",x.CreateNotificationTemplate="create-notification-template",x.ViewNotificationTemplate="view-notification-template",x.UpdateNotificationTemplate="edit-notification-template",x.DeleteNotificationTemplate="delete-notification-template",x.DecryptSecrets="decrypt-secrets",x.CreateNotificationPolicy="create-notification-policy",x.ViewNotificationPolicyTree="view-notification-policy-tree",x.UpdateNotificationPolicyTree="update-notification-policy-tree",x.DeleteNotificationPolicy="delete-notification-policy",x.ExportNotificationPolicies="export-notification-policies",x.ViewAutogeneratedPolicyTree="view-autogenerated-policy-tree",x.CreateSilence="create-silence",x.ViewSilence="view-silence",x.UpdateSilence="update-silence",x.ViewMuteTiming="view-mute-timing",x.CreateMuteTiming="create-mute-timing",x.UpdateMuteTiming="update-mute-timing",x.DeleteMuteTiming="delete-mute-timing",x.ExportMuteTimings="export-mute-timings",x))(f||{}),d=(x=>(x.Duplicate="duplicate-alert-rule",x.View="view-alert-rule",x.Update="update-alert-rule",x.Delete="delete-alert-rule",x.Explore="explore-alert-rule",x.Silence="silence-alert-rule",x.ModifyExport="modify-export-rule",x))(d||{}),h=(x=>(x.CreateAlertRule="create-alert-rule",x.ViewAlertRule="view-alert-rule",x.UpdateAlertRule="update-alert-rule",x.DeleteAlertRule="delete-alert-rule",x.ExportGrafanaManagedRules="export-grafana-managed-rules",x.CreateExternalAlertRule="create-external-alert-rule",x.ViewExternalAlertRule="view-external-alert-rule",x.UpdateExternalAlertRule="update-external-alert-rule",x.DeleteExternalAlertRule="delete-external-alert-rule",x))(h||{});const p=!0,m=!1,a=()=>({["create-alert-rule"]:I(p,s.AccessControlAction.AlertingRuleCreate),["view-alert-rule"]:I(p,s.AccessControlAction.AlertingRuleRead),["update-alert-rule"]:I(p,s.AccessControlAction.AlertingRuleUpdate),["delete-alert-rule"]:I(p,s.AccessControlAction.AlertingRuleDelete),["export-grafana-managed-rules"]:I(p,s.AccessControlAction.AlertingRuleRead),["create-external-alert-rule"]:I(p,s.AccessControlAction.AlertingRuleExternalWrite),["view-external-alert-rule"]:I(p,s.AccessControlAction.AlertingRuleExternalRead),["update-external-alert-rule"]:I(p,s.AccessControlAction.AlertingRuleExternalWrite),["delete-external-alert-rule"]:I(p,s.AccessControlAction.AlertingRuleExternalWrite)}),v=x=>a()[x];function E(x,S){const O=b(x);return(0,t.useMemo)(()=>O[S],[O,S])}function D(x,S){const O=b(x);return useMemo(()=>S.map(P=>O[P]),[O,S])}function b(x){const S=x.namespace.rulesSource,O=typeof S=="string"?S:S.name,P=(0,i.lT)(x.rulerRule)&&!!x.rulerRule.grafana_alert.provenance,L=(0,i.YN)(x.group),U=(0,i.lT)(x.rulerRule),R=P||L,{isEditable:B,isRemovable:H,isRulerAvailable:w=!1,loading:N}=(0,l.g)(O,x.rulerRule),[V,G]=v("export-grafana-managed-rules"),_=N?m:w,K=R?m:_,j=(0,u.Wd)(O),k=T(S);return{["duplicate-alert-rule"]:I(_,j.create),["view-alert-rule"]:I(p,j.read),["update-alert-rule"]:[K,B??!1],["delete-alert-rule"]:[K,H??!1],["explore-alert-rule"]:I(p,s.AccessControlAction.DataSourcesExplore),["silence-alert-rule"]:k,["modify-export-rule"]:[U,G]}}function C(){const{selectedAlertmanager:x,hasConfigurationAPI:S,isGrafanaAlertmanager:O}=(0,g.VI)(),P=(0,u.lV)(x),L=(0,u.jy)(x),U=n.TP.hasRole("Admin")||n.TP.isGrafanaAdmin;return{["view-external-configuration"]:I(p,s.AccessControlAction.AlertingNotificationsExternalRead),["update-external-configuration"]:I(S,s.AccessControlAction.AlertingNotificationsExternalWrite),["create-contact-point"]:I(S,P.create),["view-contact-point"]:I(p,P.read),["edit-contact-points"]:I(S,P.update),["delete-contact-point"]:I(S,P.delete),["export-contact-point"]:I(O,P.read),["create-notification-template"]:I(S,P.create),["view-notification-template"]:I(p,P.read),["edit-notification-template"]:I(S,P.update),["delete-notification-template"]:I(S,P.delete),["create-notification-policy"]:I(S,P.create),["view-notification-policy-tree"]:I(p,P.read),["update-notification-policy-tree"]:I(S,P.update),["delete-notification-policy"]:I(S,P.delete),["export-notification-policies"]:I(O,P.read),["decrypt-secrets"]:I(O,P.provisioning.readSecrets),["view-autogenerated-policy-tree"]:[O,U],["create-silence"]:I(p,L.create),["view-silence"]:I(p,L.read),["update-silence"]:I(p,L.update),["create-mute-timing"]:I(S,P.create),["view-mute-timing"]:I(p,P.read),["update-mute-timing"]:I(S,P.update),["delete-mute-timing"]:I(S,P.delete),["export-mute-timings"]:I(O,P.read)}}function y(x){const S=C();return(0,t.useMemo)(()=>S[x],[S,x])}function M(x){const S=C();return(0,t.useMemo)(()=>x.map(O=>S[O]),[S,x])}function T(x){const S=x===c.hY,{useGetAlertmanagerChoiceStatusQuery:O}=r.m,{currentData:P,isLoading:L}=O(void 0,{skip:!S});if(!S||L)return[!1,!1];const U=P?.alertmanagersChoice===o.nA.External,R=P?.alertmanagersChoice===o.nA.All;return I(!U||R,s.AccessControlAction.AlertingInstanceCreate)}const I=(x,S)=>[x,n.TP.hasPermission(S)]},62190:(Q,A,e)=>{"use strict";e.d(A,{W:()=>o});var t=e(96540),n=e(57220);function o(s){return(0,t.useMemo)(()=>(0,n.sq)(s),[s])}},36135:(Q,A,e)=>{"use strict";e.d(A,{g:()=>s});var t=e(96540),n=e(19347),o=e(26657);function s(r){return{allDataSourcesAvailable:(0,t.useMemo)(()=>r.filter(u=>!(0,o.s9)(u.datasourceUid)).every(u=>!!(0,n.l)().getInstanceSettings(u.datasourceUid)),[r])}}},730:(Q,A,e)=>{"use strict";e.d(A,{O3:()=>b,ZU:()=>v,we:()=>p});var t=e(96540),n=e(16817),o=e(80348),s=e(79938),r=e(77583),g=e(23770),u=e(57220),c=e(88467),i=e(18461),l=e(23662),f=e(9518),d=e(61410);function h(C,y){const M=m(y),T=useCombinedRuleNamespaces(y),I=useMemo(()=>{if(!C||!y||T.length===0)return[];const x=[];for(const S of T)for(const O of S.groups)for(const P of O.rules)P.name===C&&x.push(P);return x},[C,y,T]);return{...M,result:I}}function p(C,y,M){const T=(0,u.oh)(y),{dsFeatures:I,isLoadingDsFeatures:x}=b(y),{currentData:S=[],isLoading:O,error:P}=s.hK.endpoints.prometheusRuleNamespaces.useQuery({ruleSourceName:y,ruleName:C,namespace:M?.namespace,groupName:M?.groupName}),[L]=s.hK.endpoints.rulerRuleGroup.useLazyQuery(),{loading:U,error:R,value:B}=(0,n.A)(async()=>{if(!T)throw new Error("Unable to obtain data source settings");if(P)throw new Error("Unable to obtain Prometheus rules");const H=[];if(I?.rulerConfig){const V=I.rulerConfig,G=S.map(_=>_.groups.map(K=>({namespace:_,group:K}))).flat();await Promise.allSettled(G.map(async _=>{const K=await L({rulerConfig:V,namespace:_.namespace.name,group:_.group.name}).unwrap();H.push(K)}))}return S.map(V=>(0,f.O6)(T,V,H)).flatMap(V=>V.groups.flatMap(G=>G.rules))},[T,I,O,P,S,L]);return{loading:x||U,error:R,rules:B}}function m(C,y){const M=useDispatch(),T=useUnifiedAlertingSelector(P=>P.promRules),I=a(C,T),x=useUnifiedAlertingSelector(P=>P.rulerRules),S=a(C,x),{loading:O}=useAsync(async()=>{C&&await M(fetchPromAndRulerRulesAction({rulesSourceName:C,identifier:y}))},[M,C]);return{loading:O,error:I.error??isRulerNotSupportedResponse(S)?void 0:S.error,dispatched:I.dispatched&&S.dispatched}}function a(C,y){if(!C)return initialAsyncRequestState;const M=y[C];return M||initialAsyncRequestState}function v({ruleIdentifier:C}){const{ruleSourceName:y}=C,M=(0,u.oh)(y),{dsFeatures:T,isLoadingDsFeatures:I}=b(y),{currentData:x,isLoading:S,error:O}=s.hK.endpoints.prometheusRuleNamespaces.useQuery({ruleSourceName:C.ruleSourceName,namespace:(0,l.Mj)(C)||(0,l.X4)(C)?C.namespace:void 0,groupName:(0,l.Mj)(C)||(0,l.X4)(C)?C.groupName:void 0,ruleName:(0,l.Mj)(C)||(0,l.X4)(C)?C.ruleName:void 0}),[P,{currentData:L,isLoading:U,error:R}]=s.hK.endpoints.rulerRuleGroup.useLazyQuery(),[B,{currentData:H,isLoading:w,error:N}]=s.hK.endpoints.rulerRules.useLazyQuery();(0,t.useEffect)(()=>{T?.rulerConfig&&(T.rulerConfig&&(0,l.X4)(C)?P({rulerConfig:T.rulerConfig,namespace:C.namespace,group:C.groupName}):(0,l.A4)(C)&&B({rulerConfig:T.rulerConfig}))},[T,P,B,C]);const V=(0,t.useMemo)(()=>{if(x){if((0,l.A4)(C)){const G=(0,f.Ph)("grafana",x,H);for(const _ of G)for(const K of _.groups)for(const j of K.rules){const k=i.UP(y,j);if(i.LC(k,C))return j}}if(M&&x.length>0&&((0,l.X4)(C)||(0,l.Mj)(C))){const G=x.map(_=>(0,f.O6)(M,_,L?[L]:[]));for(const _ of G)for(const K of _.groups)for(const j of K.rules){const k=i.UP(y,j);if(i.LC(k,C))return j}}}},[C,y,x,L,H,M]);return{loading:I||S||U||w,error:O??R??N,result:V}}const D={rulerConfig:{dataSourceName:u.hY,apiVersion:"legacy"}};function b(C){const y=(0,u.z2)(C),{currentData:M,isLoading:T}=r.L.endpoints.discoverDsFeatures.useQuery({rulesSourceName:C},{skip:y});return y?{isLoadingDsFeatures:!1,dsFeatures:D}:{isLoadingDsFeatures:T,dsFeatures:M}}},9518:(Q,A,e)=>{"use strict";e.d(A,{Jr:()=>h,NW:()=>E,O6:()=>f,Ph:()=>l,Tj:()=>D,Ug:()=>v,dy:()=>i});var t=e(2543),n=e.n(t),o=e(96540),s=e(54317),r=e(94822),g=e(57220),u=e(23662),c=e(61410);function i(x,S){const O=(0,c.$)(R=>R.promRules),P=(0,c.$)(R=>R.rulerRules),L=(0,o.useRef)({}),U=(0,o.useMemo)(()=>{if(x){const R=(0,g.Zw)(x);if(!R)throw new Error(`Unknown rules source: ${x}`);return[R]}return(0,g.lS)()},[x]);return(0,o.useMemo)(()=>U.map(R=>{const B=(0,g.Eb)(R)?R.name:R,H=P[B]?.result;let w=O[B]?.result;B===g.hY&&S&&(w=S);const N=L.current[B];if(N&&N.promRules===w&&N.rulerRules===H)return N.result;const V={};Object.entries(H||{}).forEach(([_,K])=>{const j={rulesSource:R,name:_,groups:[]};(0,u.lT)(K[0].rules[0])&&(j.uid=K[0].rules[0].grafana_alert.namespace_uid),V[_]=j,m(j,K)}),w?.forEach(({name:_,groups:K})=>{const j=V[_]=V[_]||{rulesSource:R,name:_,groups:[]};a(j,K)});const G=Object.values(V);return L.current[B]={promRules:w,rulerRules:H,result:G},G}).flat(),[O,P,U,S])}function l(x,S,O){const P={};return Object.entries(O||{}).forEach(([L,U])=>{const R={rulesSource:x,name:L,groups:[]};P[L]=R,m(R,U)}),S?.forEach(({name:L,groups:U})=>{const R=P[L]=P[L]||{rulesSource:x,name:L,groups:[]};a(R,U)}),Object.values(P)}function f(x,S,O){const P={rulesSource:x,name:S.name,groups:[]};return m(P,O),a(P,S.groups),P.groups.forEach(L=>{L.rules=L.rules.filter(U=>U.promRule)}),P}function d(x,S,O){return m(x,O),a(x,S),x}function h(x){return x.map(S=>{const O={...S,groups:[]};return O.groups.push({name:"default",rules:p(S.groups.flatMap(P=>P.rules)),totals:b(S.groups)}),O})}function p(x){return x.sort((S,O)=>S.name.localeCompare(O.name))}function m(x,S=[]){x.groups=S.map(O=>{const P=O.rules.filter(R=>(0,u.i7)(R)).length,L=O.rules.filter(R=>(0,u.lT)(R)&&R.grafana_alert.is_paused).length,U={name:O.name,interval:O.interval,source_tenants:O.source_tenants,rules:[],totals:{paused:L,recording:P}};return U.rules=O.rules.map(R=>y(R,x,U)),U})}function a(x,S){const O=new Map;x.groups.forEach(P=>O.set(P.name,P)),S.forEach(P=>{let L=O.get(P.name);L||(L={name:P.name,rules:[],totals:D(P)},x.groups.push(L),O.set(P.name,L)),L.totals={...L.totals,...D(P)};const U=new Map;L.rules.forEach(R=>{const B=U.get(R.name);B?B.push(R):U.set(R.name,[R])}),(P.rules??[]).forEach(R=>{const B=M(R,U,x.rulesSource);B?(B.promRule=R,B.instanceTotals=(0,u.Z8)(R)?v(R):{},B.filteredInstanceTotals=(0,u.Z8)(R)?E(R):{}):L.rules.push(C(R,x,L))})})}function v(x){const S=(0,t.countBy)(x.alerts,"state");if(x.totals){const{normal:O,...P}=x.totals;return{...P,inactive:O}}return{alerting:S[s.$.Alerting]||S.firing,pending:S[s.$.Pending],inactive:S[s.$.Normal],nodata:S[s.$.NoData],error:S[s.$.Error]||S.err||void 0}}function E(x){if(x.totalsFiltered){const{normal:S,...O}=x.totalsFiltered;return{...O,inactive:S}}return{}}function D(x){if(x.totals){const{firing:L,...U}=x.totals;return{...U,alerting:L}}const S=(0,t.countBy)(x.rules,L=>(0,u.Z8)(L)&&L.state),O=(0,t.countBy)(x.rules,L=>L.health),P=x.rules.filter(L=>(0,u.KB)(L)).length;return{alerting:S[r.cF.Firing],error:O.error,nodata:O.nodata,inactive:S[r.cF.Inactive],pending:S[r.cF.Pending],recording:P}}function b(x){const S={};return x.forEach(O=>{const P=O.totals;Object.entries(P).forEach(([L,U])=>{S[L]||(S[L]=0),S[L]+=U})}),S}function C(x,S,O){return{name:x.name,query:x.query,labels:x.labels||{},annotations:(0,u.Z8)(x)?x.annotations||{}:{},promRule:x,namespace:S,group:O,instanceTotals:(0,u.Z8)(x)?v(x):{},filteredInstanceTotals:(0,u.Z8)(x)?E(x):{}}}function y(x,S,O){return(0,u.$y)(x)?{name:x.alert,query:x.expr,labels:x.labels||{},annotations:x.annotations||{},rulerRule:x,namespace:S,group:O,instanceTotals:{},filteredInstanceTotals:{}}:(0,u.i7)(x)?{name:x.record,query:x.expr,labels:x.labels||{},annotations:{},rulerRule:x,namespace:S,group:O,instanceTotals:{},filteredInstanceTotals:{}}:{name:x.grafana_alert.title,query:"",labels:x.labels||{},annotations:x.annotations||{},rulerRule:x,namespace:S,group:O,instanceTotals:{},filteredInstanceTotals:{}}}function M(x,S,O){const P=S.get(x.name);if(!P)return;if((0,g.z2)(O))return P[0];const L=P.find(R=>!R.promRule&&T(R,x,!0));if(L)return L;const U=P.find(R=>!R.promRule&&T(R,x,!1));if(U)return U}function T(x,S,O=!0){return x.name===S.name?(0,t.isEqual)([O?I(x.query):"",x.labels,x.annotations],[O?I(S.query):"",S.labels||{},(0,u.Z8)(S)?S.annotations||{}:{}]):!1}function I(x){return x.length>1&&x[0]==="("&&x[x.length-1]===")"&&(x=x.slice(1,-1)),x=x.replace(/\s|\n/g,""),x.split("").sort().join("")}},11167:(Q,A,e)=>{"use strict";e.d(A,{a:()=>g});var t=e(96540),n=e(80348),o=e(23770),s=e(88467),r=e(61410);function g(u){const c=(0,n.useDispatch)(),i=(0,r.$)(l=>l.folders);if((0,t.useEffect)(()=>{u&&c((0,o.Om)(u))},[c,u]),u){const l=i[u]||s.jA;return{folder:l.result,loading:l.loading}}return{loading:!1}}},83903:(Q,A,e)=>{"use strict";e.d(A,{y:()=>s});var t=e(96540),n=e(57220),o=e(61410);function s(){const r=(0,o.$)(c=>c.rulerRules),g=(0,t.useCallback)(c=>{const i=typeof c=="string"?c:c.name;return i===n.hY||!!r[i]?.result},[r]),u=(0,t.useCallback)(c=>{const i=(0,n.EV)(c);return!!r[i]?.result},[r]);return{hasRuler:g,rulerRulesLoaded:u}}},97009:(Q,A,e)=>{"use strict";e.d(A,{g:()=>u});var t=e(16233),n=e(77583),o=e(75471),s=e(23662),r=e(11167),g=e(61410);function u(c,i){const l=(0,g.$)(b=>b.dataSources),{currentData:f,isLoading:d}=n.L.endpoints.discoverDsFeatures.useQuery({rulesSourceName:c}),h=i&&(0,s.lT)(i)?i.grafana_alert.namespace_uid:void 0,p=(0,o.Wd)(c),{folder:m,loading:a}=(0,r.a)(h);if(!i)return{isEditable:!1,isRemovable:!1,loading:!1};if((0,s.lT)(i)){if(!h)throw new Error(`Rule ${i.grafana_alert.title} does not have a folder uid, cannot determine if it is editable.`);if(!m)return{isRulerAvailable:!0,isEditable:!1,isRemovable:!1,loading:a};const b=t.TP.hasPermissionInMetadata(p.update,m),C=t.TP.hasPermissionInMetadata(p.delete,m);return{isRulerAvailable:!0,isEditable:b,isRemovable:C,loading:a||d}}const v=!!l[c]?.result?.rulerConfig||!!f?.rulerConfig,E=t.TP.hasPermission(p.update),D=t.TP.hasPermission(p.delete);return{isRulerAvailable:v,isEditable:E&&v,isRemovable:D&&v,loading:d||l[c]?.loading}}},98439:(Q,A,e)=>{"use strict";e.d(A,{W:()=>s});var t=e(2543),n=e.n(t),o=e(96540);function s(r,g=1,u){const[c,i]=(0,o.useState)(g),l=(0,o.useMemo)(()=>(0,t.chunk)(r,u),[r,u]),f=l.length,d=l[c-1]??[],h=(c-1)*u+1,p=(0,t.clamp)(c*u,r.length),m=(0,o.useCallback)(E=>{i((0,t.clamp)(E,1,l.length))},[i,l]),a=(0,o.useCallback)(()=>m(c+1),[c,m]),v=(0,o.useCallback)(()=>m(c-1),[c,m]);return(0,o.useEffect)(()=>i(1),[f]),{page:c,onPageChange:m,numberOfPages:f,pageItems:d,pageStart:h,pageEnd:p,nextPage:a,previousPage:v}}},27747:(Q,A,e)=>{"use strict";e.d(A,{S:()=>i});var t=e(96540),n=e(80348),o=e(23770),s=e(55740),r=e(57220),g=e(88467),u=e(9518),c=e(61410);function i({dashboardUID:l,panelId:f,poll:d=!1}){const h=(0,n.useDispatch)(),p=(0,c.$)(b=>b.promRules[r.hY])??g.jA,m=(0,c.$)(b=>b.rulerRules[r.hY])??g.jA;(0,t.useEffect)(()=>{const b=()=>{h((0,o.mB)({rulesSourceName:r.hY,filter:{dashboardUID:l,panelId:f}})),h((0,o.eB)({rulesSourceName:r.hY,filter:{dashboardUID:l,panelId:f}}))};if(b(),d){const C=setInterval(b,s.HH);return()=>{clearInterval(C)}}return()=>{}},[h,d,f,l]);const a=p.loading||m.loading,v=[p.error,m.error].filter(b=>!!b),E=(0,u.dy)(r.hY);return{rules:(0,t.useMemo)(()=>E.flatMap(b=>b.groups).flatMap(b=>b.rules).filter(b=>b.annotations[s.YH.dashboardUID]===l&&b.annotations[s.YH.panelID]===String(f)),[E,l,f]),errors:v,loading:a}}},12210:(Q,A,e)=>{"use strict";e.d(A,{_:()=>o});var t=e(16817),n=e(27716);function o(s){const{loading:r,error:g,value:u}=(0,t.A)(()=>(0,n.x)(s,{showErrorAlert:!1})),c=u&&!g&&!r,i=u?.enabled;return r&&!u?{loading:!0}:!c||!i?{loading:!1,installed:!1}:{loading:r,installed:!0,settings:u}}},46013:(Q,A,e)=>{"use strict";e.d(A,{G:()=>i,Q:()=>c});var t=e(32196),n=e(96540),o=e(32264),s=e(40845),r=e(37390);const g=(0,n.lazy)(()=>e.e(7409).then(e.bind(e,87409))),u=(0,n.lazy)(()=>e.e(1121).then(e.bind(e,31121)));var c=(f=>(f.Loki="loki",f.Annotations="annotations",f))(c||{});function i(){const[f,d]=(0,n.useState)(!1),[h,p]=(0,n.useState)(),m=(0,s.of)(l),a=o.$.unifiedAlerting.alertStateHistoryBackend,v=o.$.unifiedAlerting.alertStateHistoryPrimary,D=[a,v].some(M=>M==="loki")?"loki":"annotations",b=(0,n.useCallback)(()=>{p(void 0),d(!1)},[]),C=(0,n.useCallback)(M=>{p(M),d(!0)},[]);return{StateHistoryModal:(0,n.useMemo)(()=>h?n.createElement(r.a,{isOpen:f,onDismiss:b,closeOnBackdropClick:!0,closeOnEscape:!0,title:"State history",className:m.modal,contentClassName:m.modalContent},n.createElement(n.Suspense,{fallback:"Loading..."},D==="loki"&&n.createElement(u,{ruleUID:h.grafana_alert.uid}),D==="annotations"&&n.createElement(g,{alertId:h.grafana_alert.id??""}))):null,[h,f,b,D,m]),showStateHistoryModal:C,hideStateHistoryModal:b}}const l=f=>({modal:(0,t.css)` width: 80%; height: 80%; min-width: 800px; `,modalContent:(0,t.css)` height: 100%; width: 100%; padding: ${f.spacing(2)}; `})},39964:(Q,A,e)=>{"use strict";e.d(A,{l:()=>s});var t=e(96540),n=e(24180),o=e(12131);function s(){const{search:r}=(0,n.zy)(),g=(0,t.useMemo)(()=>new URLSearchParams(r),[r]),u=(0,t.useCallback)((c,i)=>{o.Ny.partial(c,i)},[]);return[g,u]}},61410:(Q,A,e)=>{"use strict";e.d(A,{$:()=>o});var t=e(1081),n=e(80348);function o(s,r){return(0,n.useSelector)((0,t.Mz)(g=>g.unifiedAlerting,g=>s(g)),r)}},81156:(Q,A,e)=>{"use strict";e.d(A,{A:()=>d});var t=e(2543),n=e.n(t),o=e(96540),s=e(42941),r=e(32264),g=e(72109),u=e(42418),c=e(82762),i=e(28389),l=e(56361);const f=!r.$.unifiedAlertingEnabled;function d({dashboard:m}){if(f)return null;const a=h(m);return(0,t.isEmpty)(a)?null:m.uid?o.createElement(p,{dashboardUid:m.uid,panels:a}):null}function h(m){return m.panels?.filter(v=>{const E="alert"in v,D="options"in v&&v.options?"alertThreshold"in v.options:!1;return E||D})??[]}function p({dashboardUid:m,panels:a}){const[v,E]=(0,s.A)(!1),D=[{id:"id",header:"ID"},{id:"title",header:"Title",cell:b=>o.createElement(g.Y,{external:!0,href:(0,l.D2)(m,String(b.row.id),"edit","alert")},b.value)}];return o.createElement(u.F,{severity:"warning",title:"Legacy alert rules are deprecated"},o.createElement("p",null,"You have legacy alert rules in this dashboard that were deprecated in Grafana 11 and are no longer supported."),o.createElement("p",null,"Refer to"," ",o.createElement(g.Y,{href:"https://grafana.com/docs/grafana/latest/alerting/set-up/migrating-alerts/",external:!0},"our documentation")," ","on how to migrate legacy alert rules and how to import and export using Grafana Alerting."),o.createElement(c.S,{label:"List of panels using legacy alerts",collapsible:!0,isOpen:v,onToggle:E},o.createElement(i.j,{columns:D,data:a,getRowId:b=>String(b.id),pageSize:5})))}},28475:(Q,A,e)=>{"use strict";e.d(A,{Jc:()=>V,kL:()=>_,XY:()=>G});var t=e(94822),n=e(23662);const o=1,s=2,r=3,g=4,u=5,c=6,i=7,l=8,f=9,d=10,h=11,p=12,m=13,a=0,v=1,E=2,D=3,b=4,C=5,y=6,M=7,T=8;var I=e(2543),x=e(48820);const S=x.U1.deserialize({version:14,states:"!vOQOPOOOuOPO'#CiOOOO'#Ci'#CiOQOPO'#CmOOOO'#Cj'#CjQQOPOOO!mOQO'#C^O!rOPO'#CkO!wOPO,59TOOOO,59X,59XOOOO-E6h-E6hOOOO,58x,58xOOOO,59V,59VOOOO-E6i-E6i",stateData:"$[~ORUOTUOUUOVUOWUOXUOYUOZUO[UObPOdQO~OcVOR]XT]XU]XV]XW]XX]XY]XZ]X[]Xb]Xd]X~OSZO~Ob[O~OcVOR]aT]aU]aV]aW]aX]aY]aZ]a[]ab]ad]a~OR~T~U~V~W~Y~Z~[~R[ZYXWVUTb~",goto:"{bPPcPPPPPPPPPPchnPtVRORTQTORYTQWPR]WSSOTRXR",nodeNames:"\u26A0 AlertRuleSearch FilterExpression DataSourceToken FilterValue NameSpaceToken LabelToken GroupToken RuleToken StateToken TypeToken HealthToken DashboardToken FreeFormExpression",maxTerm:20,skippedNodes:[0],repeatNodeCount:2,tokenData:"#0PRRqqr#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#[Ia#[#]!$Z#]#`#Y#`#a!.m#a#b#Y#b#c!7g#c#f#Y#f#g!Fe#g#h!Mu#h#i#(o#i$Ch#Y$JU;'S#Y;'S;(d&Y;(d;(e&`<%lO#YR#acSQbPqr#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,O={[r]:"datasource",[u]:"namespace",[c]:"label",[l]:"rule",[i]:"group",[f]:"state",[d]:"type",[h]:"health",[p]:"dashboard"};var P=(j=>(j.dataSource="dataSourceFilter",j.nameSpace="nameSpaceFilter",j.label="labelFilter",j.group="groupFilter",j.rule="ruleFilter",j.state="stateFilter",j.type="typeFilter",j.health="healthFilter",j.dashboard="dashboardFilter",j))(P||{});function L(j,k,Y){H(j,k,ee=>{if(ee.type.id===s){const re=U(j,ee);if(re.type&&re.value){const J=Y[re.type];J&&J(re.value)}}else if(ee.type.id===m){const re=Y[m];re&&re(R(j,ee))}})}function U(j,k){if(k.type.id!==s)throw new Error("Invalid node provided. Only FilterExpression nodes are supported");const Y=k.firstChild;if(!Y)return{type:void 0,value:void 0};const ee=k.getChild(g),re=ee?(0,I.trim)(R(j,ee),'"'):void 0;return{type:Y.type.id,value:re}}function R(j,k){return j.slice(k.from,k.to).trim().replace(/\"/g,"")}function B(j,k,Y){const ee=[];H(j,k,J=>{J.type.id===s&&J.firstChild&&ee.push(J.firstChild),J.type.id===m&&ee.push(J)});let re=[];return ee.forEach(J=>{const ne=Y.findIndex(q=>q.type===J.type.id);if(ne!==-1){if(J.parent?.type.is(s)){const q=O[J.type.id],te=Y.splice(ne,1)[0];re.push(`${q}:${w(te.value)}`)}if(J.type.is(m)){const q=Y.splice(ne,1)[0];re.push(q.value)}}}),Y.forEach(J=>{J.type===m?re.push(J.value):re.push(`${O[J.type]}:${w(J.value)}`)}),re.join(" ")}function H(j,k,Y){const ee=k.join(" ");let J=S.configure({dialect:ee}).parse(j).cursor();do Y(J.node);while(J.next())}function w(j){return/\s/.test(j)?`"${j}"`:j}const N=[P.dataSource,P.nameSpace,P.label,P.group,P.rule,P.state,P.type,P.health,P.dashboard];var V=(j=>(j.Ok="ok",j.Error="error",j.NoData="nodata",j.Unknown="unknown",j))(V||{});function G(j){const k={labels:[],freeFormWords:[],dataSourceNames:[]},Y={[r]:ee=>k.dataSourceNames.push(ee),[u]:ee=>k.namespace=ee,[i]:ee=>k.groupName=ee,[l]:ee=>k.ruleName=ee,[c]:ee=>k.labels.push(ee),[f]:ee=>k.ruleState=K(ee),[d]:ee=>(0,n.nf)(ee)?k.ruleType=ee:void 0,[h]:ee=>k.ruleHealth=(0,n.f6)(ee),[p]:ee=>k.dashboardUid=ee,[m]:ee=>k.freeFormWords.push(ee)};return L(j,N,Y),k}function _(j,k){const Y=[];return k.dataSourceNames&&Y.push(...k.dataSourceNames.map(ee=>({type:r,value:ee}))),k.namespace&&Y.push({type:u,value:k.namespace}),k.groupName&&Y.push({type:i,value:k.groupName}),k.ruleName&&Y.push({type:l,value:k.ruleName}),k.ruleState&&Y.push({type:f,value:k.ruleState}),k.ruleType&&Y.push({type:d,value:k.ruleType}),k.ruleHealth&&Y.push({type:h,value:k.ruleHealth}),k.labels&&Y.push(...k.labels.map(ee=>({type:c,value:ee}))),k.dashboardUid&&Y.push({type:p,value:k.dashboardUid}),k.freeFormWords&&Y.push(...k.freeFormWords.map(ee=>({type:m,value:ee}))),B(j,N,Y)}function K(j){if(j==="normal")return t.cF.Inactive;if((0,t.Si)(j))return j}},28318:(Q,A,e)=>{"use strict";e.d(A,{t:()=>P});var t=e(2543),n=e(39741),o=e(62467),s=e(66847),r=e(1005),g=e(81160),u=e(62938),c=e(39070),i=e(14236),l=e(72495),f=e(65879),d=e(43127),h=e(89667),p=e(19347),m=e(26657),a=e(12091),v=e(27677),E=e(69437),D=e(81583),b=e(72955),C=e(66718);const y={from:21600,to:0},M=(N,V)=>{const G=T(N,V);if(!G)return y;const{from:_,to:K}=x(G,V);return!_.length&&!K.length?y:{from:Math.max(..._),to:Math.min(...K)}},T=(N,V)=>{switch(N.type){case C.Tz.classic:return I(N);case C.Tz.math:return S(N,V);case C.Tz.resample:case C.Tz.reduce:case C.Tz.threshold:return O(N)}},I=N=>N.conditions?.map(V=>V.query.params[0]),x=(N,V)=>{let G=[],_=[y.to];for(const K of N){const j=V.find(k=>k.refId===K);!j||!j.relativeTimeRange||(G.push(j.relativeTimeRange.from),_.push(j.relativeTimeRange.to))}return{from:G,to:_}},S=(N,V)=>V.filter(G=>G.queryType==="query"&&N.expression?.includes(G.refId)).map(G=>G.refId),O=N=>N.expression?[N.expression]:void 0;class P{constructor(V=(0,v.AI)(),G=(0,p.l)()){this.backendSrv=V,this.dataSourceSrv=G,this.subject=new n.m(1),this.lastResult={}}get(){return this.subject.asObservable()}async run(V,G){const _=U(V,c.Gu.Done),K=[];for(const k of V){const Y=k.model.refId;if((0,E.f)(k.model))continue;const ee=await this.dataSourceSrv.get(k.datasourceUid);ee instanceof m.iy&&ee.filterQuery&&!ee.filterQuery(k.model)&&K.push(Y)}const j=(0,t.reject)(V,k=>K.includes(k.model.refId));if(j.length===0)return this.subject.next(_);this.subscription=L(this.backendSrv,j,G).subscribe({next:k=>{const Y=w(k,(ee,re)=>{const J=this.lastResult[ee],ne=(0,i.N$)(re,J);return(0,b.B)(ne,J)});this.lastResult=Y,this.subject.next(this.lastResult)},error:k=>{this.lastResult=H(this.lastResult,k),this.subject.next(this.lastResult)}})}cancel(){if(!this.subscription)return;this.subscription.unsubscribe();let V=!1;const G=w(this.lastResult,(_,K)=>(K.state===c.Gu.Loading&&(V=!0),{...K,state:c.Gu.Done}));V&&this.subject.next(G)}destroy(){this.subject&&this.subject.complete(),this.cancel()}}const L=(N,V,G)=>{const _=U(V,c.Gu.Loading),K={data:{data:V,condition:G},url:"/api/v1/eval",method:"POST",requestId:(0,u.A)()};return(0,l.k)({whileLoading:_,source:N.fetch(K).pipe(B(_),(0,s.W)(j=>(0,o.of)(H(_,j))),(0,D.N)(N,K.requestId),(0,r.u)())})},U=(N,V)=>N.reduce((G,_)=>(G[_.refId]={state:V,series:[],timeRange:R(_,N)},G),{}),R=(N,V)=>{if((0,E.f)(N.model)){const G=M(N.model,V);return f.relativeToTimeRange(G)}return N.relativeTimeRange?f.relativeToTimeRange(N.relativeTimeRange):(console.warn(`Query with refId: ${N.refId} did not have any relative time range, using default.`),(0,d.E2)())},B=N=>(0,g.T)(V=>{const{data:G}=V,_={};for(const[K,j]of Object.entries(G.results)){const{error:k,status:Y,frames:ee=[]}=j,re=k?[{message:k,refId:K,status:Y}]:[];_[K]={errors:re,timeRange:N[K].timeRange,state:c.Gu.Done,series:ee.map(h.or)}}return _}),H=(N,V)=>{const G=(0,a.u)(V);return w(N,(_,K)=>({...K,state:c.Gu.Error,error:G}))},w=(N,V)=>{const G={};for(const[_,K]of Object.entries(N))G[_]=V(_,K);return G}},70383:(Q,A,e)=>{"use strict";e.d(A,{Kh:()=>h,VI:()=>l,b9:()=>i});var t=e(96540),n=e(33390),o=e(60021),s=e(62190),r=e(39964),g=e(55740),u=e(57220);const c=t.createContext(void 0),i=({children:p,accessType:m,alertmanagerSourceName:a})=>{const[v,E]=(0,r.l)(),D=(0,s.W)(m),b=D.availableInternalDataSources.concat(D.availableExternalDataSources),C=t.useCallback(R=>{f(b,R)&&(R===u.hY?(n.A.delete(g.Oq),E({[g.DD]:void 0})):(n.A.set(g.Oq,R),E({[g.DD]:R})))},[b,E]),y=v.get(g.DD),M=n.A.get(g.Oq),T=u.hY;t.useEffect(()=>{y&&y!==M&&n.A.set(g.Oq,y)},[y,M]);const I=a??y??M??T,x=f(b,I)?I:void 0,S=(0,u.r3)(x)?.jsonData,O=x===u.hY,P=S?h(S):!1,U={selectedAlertmanager:x,hasConfigurationAPI:O||P,isGrafanaAlertmanager:O,selectedAlertmanagerConfig:S,availableAlertManagers:b,setSelectedAlertmanager:C};return t.createElement(c.Provider,{value:U},p)};function l(){const p=t.useContext(c);if(p===void 0)throw new Error("useAlertmanager must be used within a AlertmanagerContext");return p}function f(p,m){return p.map(v=>v.name).includes(m)}const d=[o.Oz.mimir,o.Oz.cortex,void 0];function h(p){return d.includes(p.implementation)}},23770:(Q,A,e)=>{"use strict";e.d(A,{a7:()=>oe,nO:()=>pe,$8:()=>le,KH:()=>Y,g6:()=>k,EY:()=>ie,Nj:()=>te,D3:()=>De,yo:()=>_,wE:()=>V,nV:()=>K,El:()=>q,pT:()=>j,IX:()=>U,ef:()=>R,Tp:()=>ge,Om:()=>he,JH:()=>J,mF:()=>re,Lc:()=>H,mB:()=>L,eB:()=>B,HB:()=>N,DC:()=>G,ly:()=>w,uQ:()=>Ee,_$:()=>ee,bO:()=>Te,RW:()=>ne,LU:()=>Re,DN:()=>me});var t=e(30038),n=e(2543),o=e(12131),s=e(94822),r=e(27677),g=e(25027),u=e(32415),c=e(82843),i=e(17172);function l(ye){return(0,i.AI)().get("/api/annotations",{alertId:ye}).then(Le=>Le?.sort(f))}function f(ye,Le){const We=(at,st)=>at>st?-1:st>at?1:0,Be=We(ye.timeEnd,Le.timeEnd);if(Be)return Be;const Ye=We(ye.time,Le.time);return Ye||We(ye.id,Le.id)}var d=e(92240),h=e(68788),p=e(49498),m=e(28220),a=e(99106),v=e(86590),E=e(98164),D=e(57220),b=e(56361),C=e(88467),y=e(18461),M=e(63066),T=e(23662);function I(ye){const Le=async Xe=>{if((0,T.A4)(Xe)){const He=await(0,m.iy)(ye);for(const[Ge,xe]of Object.entries(He))for(const $e of xe){const be=$e.rules.find(Z=>(0,T.lT)(Z)&&Z.grafana_alert?.uid===Xe.uid);if(be)return{group:$e,ruleSourceName:D.hY,namespace:Ge,namespace_uid:(0,T.lT)(be)&&be.grafana_alert.namespace_uid||void 0,rule:be}}}if((0,T.X4)(Xe)){const{ruleSourceName:He,namespace:Ge,groupName:xe}=Xe,$e=await(0,m.HO)(ye,Ge,xe);if(!$e)return null;const be=$e.rules.find(Z=>{const ae=y.P1(He,Ge,$e.name,Z);return y.LC(ae,Xe)});return be?{group:$e,ruleSourceName:He,namespace:Ge,rule:be}:null}if((0,T.Mj)(Xe))throw new Error("Native prometheus rules can not be edited in grafana.");return null},We=async Xe=>{const{namespace:He,group:Ge,rule:xe,namespace_uid:$e}=Xe;if(Ge.rules.length===1){await(0,m.AJ)(ye,$e||He,Ge.name);return}await(0,m.E8)(ye,$e||He,{...Ge,rules:Ge.rules.filter(be=>be!==xe)})},Be=async(Xe,He,Ge)=>{const{dataSourceName:xe,group:$e,namespace:be}=Xe,Z=(0,M.l1)(Xe);if(xe&&$e&&be){if(Ge){const ve=await Le(y.Yd(Ge));if(!ve)throw new Error("Rule not found.");if(ve.namespace!==be||ve.group.name!==$e)await We(ve);else{const Ue={...ve.group,rules:ve.group.rules.map(_e=>_e===ve.rule?Z:_e),evaluateEvery:He};return await(0,m.E8)(ye,be,Ue),y.P1(xe,be,$e,Z)}}const ae=await(0,m.HO)(ye,be,$e),de=ae?{...ae,rules:[...ae.rules,Z]}:{name:$e,rules:[Z]};return await(0,m.E8)(ye,be,de),y.P1(xe,be,$e,Z)}else throw new Error("Data source and location must be specified")},Ye=async(Xe,He,Ge)=>{const{folder:xe,group:$e}=Xe;if(!xe)throw new Error("Folder must be specified");const be=(0,M.Z9)(Xe),Z=xe.uid,ae={name:$e,interval:He};if(!Ge)return at(Z,ae,be);const de=await Le(y.Yd(Ge));if(!de)throw new Error("Rule not found.");const ve=de.namespace_uid===Z,Ue=de.group.name===Xe.group;return ve&&Ue?Ke(de,be,He):st(Z,ae,de,be)},at=async(Xe,He,Ge)=>{const xe=await(0,m.HO)(ye,Xe,He.name);if(!xe)throw new Error(`No group found with name "${He.name}"`);const $e={name:He.name,interval:He.interval,rules:(xe.rules??[]).concat(Ge)};return await(0,m.E8)(ye,Xe,$e),{uid:Ge.grafana_alert.uid??"",ruleSourceName:D.hY}},st=async(Xe,He,Ge,xe)=>(x(Ge,xe),await at(Xe,He,xe)),Ke=async(Xe,He,Ge)=>{x(Xe,He);const xe=Xe.group.rules.map($e=>(0,T.lT)($e)&&$e.grafana_alert.uid===Xe.rule.grafana_alert.uid?He:$e);return await(0,m.E8)(ye,Xe.namespace_uid??"",{name:Xe.group.name,interval:Ge,rules:xe}),{uid:Xe.rule.grafana_alert.uid,ruleSourceName:D.hY}};return{findEditableRule:Le,deleteRule:We,saveLotexRule:Be,saveGrafanaRule:Ye}}function x(ye,Le){if(!(0,T.lT)(ye.rule))throw new Error("The rule is not a Grafana managed rule");const We=ye.rule.grafana_alert.uid;Le.grafana_alert.uid=We}var S=e(25968);function O(ye,Le){const Be=ye().unifiedAlerting.dataSources[Le]?.result;if(!Be)throw new Error(`Data source configuration is not available for "${Le}" data source`);return Be}function P(ye,Le){const We=O(ye,Le);if(!We.rulerConfig)throw new Error(`Ruler API is not available for ${Le}`);return We.rulerConfig}const L=(0,t.zD)("unifiedalerting/fetchPromRules",async({rulesSourceName:ye,filter:Le,limitAlerts:We,matcher:Be,state:Ye,identifier:at},st)=>{await st.dispatch(G({rulesSourceName:ye}));const Ke=(0,g.U7)(p.sA,`[${ye}] Prometheus rules loaded`,{dataSourceName:ye,thunk:"unifiedalerting/fetchPromRules"});return await(0,C.$I)(Ke(ye,Le,We,Be,Ye,at))}),U=(0,t.zD)("unifiedAlerting/fetchExternalAlertmanagers",()=>(0,C.$I)((0,u.Wf)())),R=(0,t.zD)("unifiedAlerting/fetchExternAlertmanagersConfig",()=>(0,C.$I)((0,u.Vv)())),B=(0,t.zD)("unifiedalerting/fetchRulerRules",async({rulesSourceName:ye,filter:Le},{dispatch:We,getState:Be})=>{await We(G({rulesSourceName:ye}));const Ye=P(Be,ye),at=(0,g.Ke)(m.iy,`[${ye}] Ruler rules loaded`,{dataSourceName:ye,thunk:"unifiedalerting/fetchRulerRules"});return await(0,C.$I)(at(Ye,Le))});function H({rulesSourceName:ye,identifier:Le,filter:We,limitAlerts:Be,matcher:Ye,state:at}){return async(st,Ke)=>{await st(G({rulesSourceName:ye}));const Xe=O(Ke,ye);await st(L({rulesSourceName:ye,identifier:Le,filter:We,limitAlerts:Be,matcher:Ye,state:at})),Xe.rulerConfig&&await st(B({rulesSourceName:ye}))}}const w=(0,t.zD)("unifiedalerting/fetchSilences",ye=>{const Le=(0,g.QA)(u.Bz,`[${ye}] Silences loaded`,{dataSourceName:ye,thunk:"unifiedalerting/fetchSilences"});return(0,C.$I)(Le(ye))});function N(ye){return(Le,We)=>{const{rulerRules:Be}=We().unifiedAlerting,Ye=Be[ye];(0,n.isEmpty)(Ye?.result)&&!(Ye&&(0,T.$7)(Ye))&&!Ye?.loading&&Le(B({rulesSourceName:ye}))}}function V(){return async ye=>{const Le=(0,D.gR)().map(We=>ye(G({rulesSourceName:We})));await Promise.allSettled(Le)}}const G=(0,t.zD)("unifiedalerting/fetchPromBuildinfo",async({rulesSourceName:ye})=>(0,C.$I)((async()=>{if(ye===D.hY)return{name:D.hY,id:D.hY,rulerConfig:{dataSourceName:D.hY,apiVersion:"legacy"}};const Le=(0,D.Jz)(ye);if(!Le)throw new Error(`Missing data source configuration for ${ye}`);const{id:We,name:Be}=Le,at=await(0,g.QA)(d.nD,`[${ye}] Rules source features discovered`,{dataSourceName:ye,thunk:"unifiedalerting/fetchPromBuildinfo"})(Be),st=at.features.rulerApiEnabled?{dataSourceName:Be,apiVersion:at.application===s.N1.Cortex?"legacy":"config"}:void 0;return{name:Be,id:We,rulerConfig:st}})()),{condition:({rulesSourceName:ye},{getState:Le})=>{const We=Le().unifiedAlerting.dataSources,Be=!!We[ye]?.result,Ye=!!We[ye]?.error;return!(Be||Ye)}});function _(ye=!1,Le={}){return async(We,Be)=>{const Ye=performance.now();await Promise.allSettled((0,D.gR)().map(async at=>{await We(G({rulesSourceName:at}));const{promRules:st,rulerRules:Ke,dataSources:Xe}=Be().unifiedAlerting,He=Xe[at].result;if(!He)return;const Ge=ye||!st[at]?.loading,xe=(ye||!Ke[at]?.loading)&&!!He.rulerConfig;await Promise.allSettled([Ge&&We(L({rulesSourceName:at,...Le})),xe&&We(B({rulesSourceName:at}))])})),(0,g.fH)("All Prom and Ruler rules loaded",{loadTimeMs:(performance.now()-Ye).toFixed(0)})}}function K(ye=!1){return async(Le,We)=>{const{promRules:Be}=We().unifiedAlerting;(0,D.gR)().map(Ye=>{(ye||!Be[Ye]?.loading)&&Le(L({rulesSourceName:Ye}))})}}const j=(0,t.zD)("unifiedalerting/fetchEditableRule",(ye,Le)=>{const We=P(Le.getState,ye.ruleSourceName);return(0,C.$I)(I(We).findEditableRule(ye))});function k(ye,Le){return async(We,Be)=>{(0,C.v5)((async()=>{const Ye=(0,D.EV)(ye.rulesSource),at=P(Be,Ye);await(0,m.AJ)(at,ye.name,Le.name),await We(H({rulesSourceName:Ye}))})(),{successMessage:"Group deleted"})}}function Y(ye,Le={}){return async(We,Be)=>{await We(G({rulesSourceName:ye.ruleSourceName})),(0,C.v5)((async()=>{const Ye=P(Be,ye.ruleSourceName),at=I(Ye),st=await at.findEditableRule(ye);if(!st)throw new Error("Rule not found.");await at.deleteRule(st),await We(H({rulesSourceName:st.ruleSourceName})),Le.navigateTo&&o.Ny.replace(Le.navigateTo)})(),{successMessage:"Rule deleted."})}}const ee=(0,t.zD)("unifiedalerting/saveRuleForm",({values:ye,existing:Le,redirectOnSave:We,evaluateEvery:Be},Ye)=>(0,C.v5)((0,C.$I)((async()=>{const{type:at}=ye;let st;if(at===v.Z.cloudAlerting||at===v.Z.cloudRecording){if(!ye.dataSourceName)throw new Error("The Data source has not been defined.");const Ke=P(Ye.getState,ye.dataSourceName);st=await I(Ke).saveLotexRule(ye,Be,Le),await Ye.dispatch(B({rulesSourceName:ye.dataSourceName}))}else if(at===v.Z.grafana){const Ke=P(Ye.getState,D.hY);st=await I(Ke).saveGrafanaRule(ye,Be,Le),await Ye.dispatch(B({rulesSourceName:D.hY}))}else throw new Error("Unexpected rule form type");if((0,g.fH)(g.le.successSavingAlertRule,{type:at,isNew:(!Le).toString()}),We)o.Ny.push(We);else{const Ke=y.$9(st);if(!Ke){o.Ny.push("/alerting/list");return}const Xe=`/alerting/${encodeURIComponent(Ke)}/edit`;o.Ny.getLocation().pathname!==Xe?o.Ny.replace(Xe):Ye.dispatch(j(st))}})()),{successMessage:Le?`Rule "${ye.name}" updated.`:`Rule "${ye.name}" saved.`,errorMessage:"Failed to save rule"})),re=(0,t.zD)("unifiedalerting/fetchGrafanaNotifiers",()=>(0,C.$I)((0,h.Es)())),J=(0,t.zD)("unifiedalerting/fetchGrafanaAnnotations",ye=>(0,C.$I)(l(ye))),ne=(0,t.zD)("unifiedalerting/updateAMConfig",({alertManagerSourceName:ye,oldConfig:Le,newConfig:We,successMessage:Be,redirectPath:Ye,redirectSearch:at},st)=>(0,C.v5)((0,C.$I)((async()=>{const Ke=await st.dispatch(c.m.endpoints.getAlertmanagerConfiguration.initiate(ye)).unwrap(),Xe=(0,n.isEmpty)(Ke.alertmanager_config)&&(0,n.isEmpty)(Ke.template_files),He=JSON.stringify(Ke)!==JSON.stringify(Le);if(!Xe&&He)throw new Error("A newer Alertmanager configuration is available. Please reload the page and try again to not overwrite recent changes.");if(await(0,u.vk)(ye,(0,E.MZ)(We)),st.dispatch(c.m.util.invalidateTags(["AlertmanagerConfiguration"])),Ye){const Ge=new URLSearchParams(at??"");o.Ny.push((0,b.nL)(Ye,ye,Ge))}})()),{successMessage:Be})),q=(0,t.zD)("unifiedalerting/fetchAmAlerts",ye=>(0,C.$I)((0,u.Mn)(ye,[],!0,!0,!0))),te=(ye,Le)=>async We=>{await(0,C.v5)((0,u.dk)(ye,Le),{successMessage:"Silence expired."}),We(w(ye)),We(q(ye))},oe=(0,t.zD)("unifiedalerting/updateSilence",({alertManagerSourceName:ye,payload:Le,exitOnSave:We,successMessage:Be})=>(0,C.v5)((0,C.$I)((async()=>{await(0,u.as)(ye,Le),We&&o.Ny.push((0,b.nL)("/alerting/silences",ye))})()),{successMessage:Be})),ue=(ye,Le)=>async We=>{const Be=await We(alertmanagerApi.endpoints.getAlertmanagerConfiguration.initiate(Le)).unwrap();if(!Be)throw new Error(`Config for ${Le} not found`);if(!Be.alertmanager_config.receivers?.find(at=>at.name===ye))throw new Error(`Cannot delete receiver ${ye}: not found in config.`);const Ye={...Be,alertmanager_config:{...Be.alertmanager_config,receivers:Be.alertmanager_config.receivers.filter(at=>at.name!==ye)}};return We(ne({newConfig:Ye,oldConfig:Be,alertManagerSourceName:Le,successMessage:"Contact point deleted."}))},ie=(ye,Le)=>async We=>{const Be=await We(c.m.endpoints.getAlertmanagerConfiguration.initiate(Le)).unwrap();if(!Be)throw new Error(`Config for ${Le} not found`);if(typeof Be.template_files?.[ye]!="string")throw new Error(`Cannot delete template ${ye}: not found in config.`);const Ye={...Be.template_files};delete Ye[ye];const at={...Be,alertmanager_config:{...Be.alertmanager_config,templates:Be.alertmanager_config.templates?.filter(st=>st!==ye)},template_files:Ye};return We(ne({newConfig:at,oldConfig:Be,alertManagerSourceName:Le,successMessage:"Template deleted."}))},ge=(0,t.zD)("unifiedalerting/fetchFolder",ye=>(0,C.$I)(r.IB.getFolderByUid(ye,{withAccessControl:!0}))),he=ye=>(Le,We)=>{We().unifiedAlerting.folders[ye]?.dispatched||Le(ge(ye))},De=(0,t.zD)("unifiedalerting/fetchAlertGroups",ye=>(0,C.$I)((0,u.f4)(ye))),pe=(0,t.zD)("unifiedalerting/deleteAlertManagerConfig",async(ye,Le)=>(0,C.v5)((0,C.$I)((async()=>{await(0,u.nd)(ye),await Le.dispatch(c.m.util.invalidateTags(["AlertmanagerConfiguration"]))})()),{errorMessage:"Failed to reset Alertmanager configuration",successMessage:"Alertmanager configuration reset."})),le=(ye,Le)=>async We=>{const Be=await We(c.m.endpoints.getAlertmanagerConfiguration.initiate(ye)).unwrap(),Ye=Be?.alertmanager_config?.mute_time_intervals?.filter(({name:at})=>at!==Le)??[];Be&&(0,C.v5)(We(ne({alertManagerSourceName:ye,oldConfig:Be,newConfig:{...Be,alertmanager_config:{...Be.alertmanager_config,route:Be.alertmanager_config.route?(0,E.Dk)(Le,Be.alertmanager_config?.route):void 0,mute_time_intervals:Ye}}})),{successMessage:`Deleted "${Le}" from Alertmanager configuration`,errorMessage:"Failed to delete mute timing"})},Te=(0,t.zD)("unifiedalerting/testReceivers",({alertManagerSourceName:ye,receivers:Le,alert:We})=>(0,C.v5)((0,C.$I)((0,u.By)(ye,Le,We)),{errorMessage:"Failed to send test alert.",successMessage:"Test alert sent."})),Ee=(ye,Le)=>ye.filter(We=>{const{forDuration:Be}=(0,T.jg)(We,Le),Ye=(0,S.ge)(Be),at=(0,S.ge)(Le);return Ye!==0&&Ye<at}),Re=(0,t.zD)("unifiedalerting/updateLotexNamespaceAndGroup",async(ye,Le)=>(0,C.v5)((0,C.$I)((async()=>{const{rulesSourceName:We,namespaceName:Be,groupName:Ye,newNamespaceName:at,newGroupName:st,groupInterval:Ke,folderUid:Xe}=ye,He=P(Le.getState,We),Ge=await(0,m.iy)(He);if(!!!Ge[Be])throw new Error(`Namespace "${Be}" not found.`);const $e=Ge[Be].find(ve=>ve.name===Ye);if(!$e)throw new Error(`Group "${Ye}" not found.`);const be=!!Ge[Be].find(ve=>ve.name===st);if(st!==Ye&&be)throw new Error(`Group "${st}" already exists in namespace "${Be}".`);const Z=!!Ge[at],de=We===D.hY?(0,a.wf)(Be):Be;if(at!==de&&Z)throw new Error(`Namespace "${at}" already exists.`);if(at===de&&Ye===st&&Ke===$e.interval)throw new Error("Nothing changed.");if(Ke!==$e.interval){const ve=Ee($e.rules,Ke??"1m");if(ve.length>0)throw new Error(`These alerts belonging to this group will have an invalid 'For' value: ${ve.map(Ue=>{const{alertName:_e}=(0,T.jg)(Ue,Ke??"");return _e}).join(",")}`)}if(at!==de){for(const ve of Ge[Be])await(0,m.E8)(He,at,ve.name===Ye?{...ve,name:st,interval:Ke}:ve);await(0,m.BK)(He,Xe||Be)}else await(0,m.E8)(He,Xe||Be,{...$e,name:st,interval:Ke}),st!==Ye&&await(0,m.AJ)(He,Xe||Be,Ye);await Le.dispatch(B({rulesSourceName:We}))})()),{errorMessage:"Failed to update namespace / group",successMessage:"Update successful"})),me=(0,t.zD)("unifiedalerting/updateRulesOrderForGroup",async(ye,Le)=>(0,C.v5)((0,C.$I)((async()=>{const{rulesSourceName:We,namespaceName:Be,groupName:Ye,newRules:at,folderUid:st}=ye,Ke=P(Le.getState,We),He=(await(0,m.iy)(Ke))[Be].find(xe=>xe.name===Ye);if(!He)throw new Error(`Group "${Ye}" not found.`);const Ge={name:He.name,interval:He.interval,rules:at};await(0,m.E8)(Ke,st??Be,Ge),await Le.dispatch(B({rulesSourceName:We}))})()),{errorMessage:"Failed to update namespace / group",successMessage:"Update successful"})),Me=(0,t.zD)("unifiedAlerting/addExternalAlertmanagers",async(ye,Le)=>(0,C.v5)((0,C.$I)((async()=>{await(0,u._P)(ye),Le.dispatch(R())})()),{errorMessage:"Failed adding alertmanagers",successMessage:"Alertmanagers updated"}))},38858:(Q,A,e)=>{"use strict";e.d(A,{q:()=>o});var t=e(32196),n=e(60021);const o=s=>({[n.Or.Active]:(0,t.css)` color: ${s.colors.error.text}; `,[n.Or.Suppressed]:(0,t.css)` color: ${s.colors.primary.text}; `,[n.Or.Unprocessed]:(0,t.css)` color: ${s.colors.secondary.text}; `})},22620:(Q,A,e)=>{"use strict";e.d(A,{H:()=>n});var t=e(32196);const n=o=>(0,t.css)` float: none; display: flex; justify-content: flex-start; margin: ${o.spacing(2,0)}; `},99494:(Q,A,e)=>{"use strict";e.d(A,{W:()=>t});var t=(n=>(n.Incident="grafana-incident-app",n.OnCall="grafana-oncall-app",n.MachineLearning="grafana-ml-app",n))(t||{})},86590:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>t});var t=(n=>(n.grafana="grafana",n.cloudAlerting="cloud-alerting",n.cloudRecording="cloud-recording",n))(t||{})},41068:(Q,A,e)=>{"use strict";e.d(A,{y:()=>t});var t=(n=>(n.seconds="s",n.minutes="m",n.hours="h",n.days="d",n.weeks="w",n))(t||{})},75471:(Q,A,e)=>{"use strict";e.d(A,{C0:()=>h,HL:()=>g,Q9:()=>p,VQ:()=>u,Wd:()=>d,jy:()=>l,lV:()=>f,q0:()=>m});var t=e(2913),n=e(16233),o=e(80348),s=e(57220);function r(a){return(0,s.z2)(a)?"grafana":"external"}const g={read:{grafana:o.AccessControlAction.AlertingInstanceRead,external:o.AccessControlAction.AlertingInstancesExternalRead},create:{grafana:o.AccessControlAction.AlertingInstanceCreate,external:o.AccessControlAction.AlertingInstancesExternalWrite},update:{grafana:o.AccessControlAction.AlertingInstanceUpdate,external:o.AccessControlAction.AlertingInstancesExternalWrite},delete:{grafana:o.AccessControlAction.AlertingInstanceUpdate,external:o.AccessControlAction.AlertingInstancesExternalWrite}},u={read:{grafana:o.AccessControlAction.AlertingNotificationsRead,external:o.AccessControlAction.AlertingNotificationsExternalRead},create:{grafana:o.AccessControlAction.AlertingNotificationsWrite,external:o.AccessControlAction.AlertingNotificationsExternalWrite},update:{grafana:o.AccessControlAction.AlertingNotificationsWrite,external:o.AccessControlAction.AlertingNotificationsExternalWrite},delete:{grafana:o.AccessControlAction.AlertingNotificationsWrite,external:o.AccessControlAction.AlertingNotificationsExternalWrite}},c={read:o.AccessControlAction.AlertingProvisioningRead,readSecrets:o.AccessControlAction.AlertingProvisioningReadSecrets,write:o.AccessControlAction.AlertingProvisioningWrite},i={read:{grafana:o.AccessControlAction.AlertingRuleRead,external:o.AccessControlAction.AlertingRuleExternalRead},create:{grafana:o.AccessControlAction.AlertingRuleCreate,external:o.AccessControlAction.AlertingRuleExternalWrite},update:{grafana:o.AccessControlAction.AlertingRuleUpdate,external:o.AccessControlAction.AlertingRuleExternalWrite},delete:{grafana:o.AccessControlAction.AlertingRuleDelete,external:o.AccessControlAction.AlertingRuleExternalWrite}};function l(a){const v=r(a);return{read:g.read[v],create:g.create[v],update:g.update[v],delete:g.delete[v]}}function f(a){const v=r(a);return{read:u.read[v],create:u.create[v],update:u.update[v],delete:u.delete[v],provisioning:c}}function d(a){const v=r(a);return{read:i.read[v],create:i.create[v],update:i.update[v],delete:i.delete[v]}}function h(a){return()=>n.TP.evaluatePermission(a)}function p(){return{canCreateGrafanaRules:n.TP.hasPermission(o.AccessControlAction.FoldersRead)&&n.TP.hasPermission(i.create.grafana),canCreateCloudRules:n.TP.hasPermission(o.AccessControlAction.DataSourcesRead)&&n.TP.hasPermission(i.create.external),canEditRules:a=>n.TP.hasPermission(d(a).update)}}function m(){const{unifiedAlertingEnabled:a}=(0,t.zj)(),v=n.TP.hasPermission(d(s.hY).read),E=n.TP.hasPermission(d(s.hY).update);return a&&v&&E}},98164:(Q,A,e)=>{"use strict";e.d(A,{$P:()=>P,Av:()=>b,Dk:()=>c,Dm:()=>x,EU:()=>C,F9:()=>T,J$:()=>E,LF:()=>I,Lt:()=>i,MN:()=>f,MU:()=>h,MZ:()=>u,NL:()=>v,UL:()=>O,VE:()=>y,Wc:()=>p,mP:()=>L,uH:()=>S,xH:()=>a});var t=e(2543),n=e.n(t),o=e(60021),s=e(82775),r=e(57220),g=e(32642);function u(U){return U.alertmanager_config.receivers||(U.alertmanager_config.receivers=[{name:"default "}]),U.alertmanager_config.route||(U.alertmanager_config.route={receiver:U.alertmanager_config.receivers[0].name}),U.template_files||(U.template_files={}),U}function c(U,R){return{...R,mute_time_intervals:R.mute_time_intervals?.filter(H=>H!==U)??[],routes:R.routes?.map(H=>c(U,H))}}function i(U,R,B){return{...B,mute_time_intervals:B.mute_time_intervals?.map(H=>H===R?U:H),routes:B.routes?.map(H=>i(U,R,H))}}function l(U){return U.map(([R,B,H])=>[R,B,unquoteWithUnescape(H)])}function f(U){return U.isEqual?U.isRegex?o.ho.regex:o.ho.equal:U.isRegex?o.ho.notRegex:o.ho.notEqual}function d(U){switch(U){case o.ho.equal:return{isEqual:!0,isRegex:!1};case o.ho.notEqual:return{isEqual:!1,isRegex:!1};case o.ho.regex:return{isEqual:!0,isRegex:!0};case o.ho.notRegex:return{isEqual:!1,isRegex:!0}}}function h(U){return{name:U.name,value:U.value,operator:f(U)}}function p(U){return{name:U.name,value:U.value,...d(U.operator)}}function m(U){return`{${U.map(h).reduce((H,w)=>{const N=`${w.name}${w.operator}"${w.value}"`;return H?`${H},${N}`:N},"")}}`}const a=[{label:o.ho.equal,description:"Equals",value:o.ho.equal},{label:o.ho.notEqual,description:"Does not equal",value:o.ho.notEqual},{label:o.ho.regex,description:"Matches regex",value:o.ho.regex},{label:o.ho.notRegex,description:"Does not match regex",value:o.ho.notRegex}];function v(U){const R=f(U);return[U.name,R,U.value]}function E(U){const R=/\b([\w.-]+)(=~|!=|!~|=(?="?\w))"?([^"\n,}]*)"?/g,B=[];return U.replace(R,(H,w,N,V)=>{const G=N===o.ho.equal||N===o.ho.regex,_=N===o.ho.regex||N===o.ho.notRegex;return B.push({name:w,value:_?D(V.trim()):V.trim(),isEqual:G,isRegex:_}),""}),B}function D(U){try{return new RegExp(U),U}catch{return""}}function b(U,R){return R.every(({name:B,value:H,isRegex:w,isEqual:N})=>Object.entries(U).some(([V,G])=>{const _=B===V;let K;return N&&!w&&(K=H===G),!N&&!w&&(K=H!==G),N&&w&&(K=new RegExp(H).test(G)),!N&&w&&(K=!new RegExp(H).test(G)),_&&K}))}function C(...U){const R=U.map(E).flat(),B=(0,t.uniqWith)(R,t.isEqual);return m(B)}function y(U){return U===r.hY?"default":"unquote"}function M(){return(0,s.k)().filter(U=>U.type===r.ol.Alertmanager)}function T(U){return M().find(R=>U===R.uid)}function I(U){const{times:R,weekdays:B,days_of_month:H,months:w,years:N,location:V}=U,G=x(R,V),_=S(B),K=O(H),j=P(w),k=L(N);return[G,_,K,j,k].join(", ")}function x(U,R){return"Times: "+(U?U?.map(({start_time:B,end_time:H})=>`${B} - ${H} [${R??"UTC"}]`).join(" and "):"All")}function S(U){return"Weekdays: "+(U?.map(R=>{if(R.includes(":"))return R.split(":").map(B=>{const H=B.slice(0,3);return H[0].toLocaleUpperCase()+H.slice(1)}).join("-");{const B=R.slice(0,3);return B[0].toLocaleUpperCase()+B.slice(1)}}).join(", ")??"All")}function O(U){return"Days of the month: "+(U?.join(", ")??"All")}function P(U){return"Months: "+(U?.join(", ")??"All")}function L(U){return"Years: "+(U?.join(", ")??"All")}},33225:(Q,A,e)=>{"use strict";e.d(A,{Hx:()=>r,gO:()=>g});var t=e(96540),n=e(55740),o=e(56361);function s(u){return{dashboardUID:u.find(([c])=>c===n.YH.dashboardUID)?.[1],panelId:u.find(([c])=>c===n.YH.panelID)?.[1]}}function r(u){return(0,t.useMemo)(()=>Object.entries(u||{}).filter(([c,i])=>!!i.trim()),[u])}function g(u){const c=new Map,{panelId:i,dashboardUID:l}=s(u);return l&&c.set(n.YH.dashboardUID,(0,o.JM)(l)),l&&i&&c.set(n.YH.panelID,(0,o.D2)(l,i)),c}},82775:(Q,A,e)=>{"use strict";e.d(A,{k:()=>o,q:()=>s});var t=e(32264),n=e(25968);function o(){return Object.values(t.$.datasources)}function s(r){if(!(0,n.TN)(t.$.unifiedAlerting.minInterval))return{globalLimit:0,exceedsLimit:!1};const g=(0,n.M9)(t.$.unifiedAlerting.minInterval);if(!r||!(0,n.TN)(r))return{globalLimit:g,exceedsLimit:!1};const u=(0,n.M9)(r),c=g>u&&u>0;return{globalLimit:g,exceedsLimit:c}}},55740:(Q,A,e)=>{"use strict";e.d(A,{DD:()=>o,H8:()=>h,HH:()=>n,J3:()=>d,Oq:()=>s,U3:()=>g,UU:()=>t,YH:()=>f,cB:()=>u,kl:()=>p,wG:()=>r});const t="ruler not supported",n=2e4,o="alertmanager",s="alerting-alertmanager",r=2e4,g=2e4,u=2e4,c="timeseries",i="table",l="stat";var f=(m=>(m.description="description",m.summary="summary",m.runbookURL="runbook_url",m.alertId="__alertId__",m.dashboardUID="__dashboardUid__",m.panelID="__panelId__",m))(f||{});const d={description:"Description",summary:"Summary",runbook_url:"Runbook URL",__dashboardUid__:"Dashboard UID",__panelId__:"Panel ID",__alertId__:"Alert ID"},h={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__:""},p=[{key:"summary",value:""},{key:"description",value:""},{key:"runbook_url",value:""}]},57220:(Q,A,e)=>{"use strict";e.d(A,{AL:()=>L,EV:()=>S,Eb:()=>P,Jz:()=>m,Zw:()=>H,bD:()=>E,cy:()=>y,gR:()=>I,hP:()=>_,hY:()=>l,lS:()=>x,oh:()=>R,ol:()=>d,qi:()=>p,r3:()=>B,r8:()=>C,sq:()=>M,v0:()=>O,vv:()=>f,w5:()=>N,y9:()=>G,z2:()=>U});var t=e(19347),n=e(16233),o=e(60021),s=e(80348),r=e(82843),g=e(62190),u=e(70383),c=e(75471),i=e(82775);const l="grafana",f="-- Grafana --";var d=(K=>(K.Alertmanager="alertmanager",K.Loki="loki",K.Prometheus="prometheus",K))(d||{});const h=["loki","prometheus"];function p(){return n.TP.hasPermission(s.AccessControlAction.AlertingRuleExternalRead)?(0,i.k)().filter(K=>h.includes(K.type)&&K.jsonData.manageAlerts!==!1).sort((K,j)=>K.name.localeCompare(j.name)):[]}function m(K){return p().find(j=>j.name===K)}function a(){return(0,i.k)().filter(v).sort((K,j)=>K.name.localeCompare(j.name))}function v(K){return K.type==="alertmanager"}function E(K){return K.type==="alertmanager"}function D(){return a().filter(K=>K.jsonData.handleGrafanaManagedAlerts)}const b={name:l,imgUrl:"public/img/grafana_icon.svg",hasConfigurationAPI:!0};function C(){return[b,...a().map(K=>({name:K.name,displayName:K.name,imgUrl:K.meta.info.logos.small,meta:K.meta}))]}function y(K){const j=(0,g.W)(K),k=j.availableExternalDataSources.filter(J=>J.handleGrafanaManagedAlerts),Y=j.availableInternalDataSources,{currentData:ee}=r.m.useGetAlertmanagerChoiceStatusQuery(void 0);switch(ee?.alertmanagersChoice){case o.nA.Internal:return Y;case o.nA.External:return k;default:return[...Y,...k]}}function M(K){const j=[],k=[],Y={instance:c.HL.read,notification:c.VQ.read};if(n.TP.hasPermission(Y[K].grafana)&&j.push(b),n.TP.hasPermission(Y[K].external)){const ee=a().map(re=>({name:re.name,displayName:re.name,imgUrl:re.meta.info.logos.small,meta:re.meta,hasConfigurationAPI:(0,u.Kh)(re.jsonData),handleGrafanaManagedAlerts:re.jsonData.handleGrafanaManagedAlerts}));k.push(...ee)}return{availableInternalDataSources:j,availableExternalDataSources:k}}function T(K){const j=R(K);if(!j)throw new Error(`Data source ${K} not found`);if(j.type!=="loki"&&j.type!=="prometheus")throw new Error(`Unexpected data source type ${j.type}`);return j}function I(){const K=p().map(j=>j.name);return n.TP.hasPermission(s.AccessControlAction.AlertingRuleRead)&&K.push(l),K}function x(){const K=p();return n.TP.hasPermission(s.AccessControlAction.AlertingRuleRead)&&K.push(l),K}function S(K){return P(K)?K.name:K}function O(K){return P(K)?K.uid:l}function P(K){return K!==l}function L(K){return K!==l&&B(K)?.jsonData?.implementation===o.Oz.prometheus}function U(K){return K===l}function R(K){return(0,i.k)().find(j=>j.name===K)}function B(K){return(0,i.k)().filter(v).find(j=>j.name===K)}function H(K){return K===l?l:R(K)}function w(K){if(K===l)return l;const j=R(K);if(!j)throw new Error(`Datasource "${K}" not found`);return String(j.id)}function N(K){if(K===l)return l;const j=R(K);if(!j)throw new Error(`Datasource "${K}" not found`);return j.uid}function V(){return(0,t.l)().getList({alerting:!0})[0]}function G(){const K=(0,t.l)().getInstanceSettings("default");return K?.meta.alerting??!1?K:V()}function _(K){return K.jsonData.manageAlerts!==!1}},75214:(Q,A,e)=>{"use strict";e.d(A,{Dd:()=>n,M4:()=>t,x4:()=>s,zm:()=>o});function t(r){return Object.entries(r).map(([g,u])=>`${g}=${u}`).sort()}function n(r){return Object.entries(r).map(([g,u])=>[g,u])}function o(r){const g={};return r.forEach(u=>{g[u[0]]=u[1]}),g}function s(r){const g={};return r.forEach(u=>{u.key&&(g[u.key]=u.value)}),g}},32642:(Q,A,e)=>{"use strict";e.d(A,{Ig:()=>l,J$:()=>c,J9:()=>u,ot:()=>i,ou:()=>g,qR:()=>r,t8:()=>f});var t=e(2543),n=e.n(t),o=e(60021);const s=[o.ho.regex,o.ho.notRegex,o.ho.notEqual,o.ho.equal];function r(d){if(d.startsWith("{")&&d.endsWith("}"))throw new Error(`PromQL matchers not supported yet, sorry! PromQL matcher found: ${d}`);const h=s.map(E=>[E,d.indexOf(E)]).filter(([E,D])=>D>-1).sort((E,D)=>E[1]-D[1]);if(!h.length)throw new Error(`Invalid matcher: ${d}`);const[p,m]=h[0],a=d.slice(0,m).trim(),v=d.slice(m+p.length);if(!a)throw new Error(`Invalid matcher: ${d}`);return{name:a,value:v,isRegex:p===o.ho.regex||p===o.ho.notRegex,isEqual:p===o.ho.equal||p===o.ho.regex}}function g(d){const h=d.filter(p=>!!p.trim()).map(p=>r(p));return(0,t.uniqBy)(h,p=>p.name)}const u=d=>{const h=Object.entries(d).filter(([m])=>!(m.startsWith("__")&&m.endsWith("__"))),p=new URLSearchParams;return h.forEach(([m,a])=>p.append("matcher",`${m}=${a}`)),p},c=d=>{const h=[];return d.matchers&&d.matchers.forEach(p=>{const{name:m,value:a,isEqual:v,isRegex:E}=r(p);let D=o.ho.equal;v&&E&&(D=o.ho.regex),!v&&E&&(D=o.ho.notRegex),v&&!E&&(D=o.ho.equal),!v&&!E&&(D=o.ho.notEqual),h.push([m,D,a])}),d.object_matchers&&h.push(...d.object_matchers),d.match_re&&Object.entries(d.match_re).forEach(([p,m])=>{h.push([p,o.ho.regex,m])}),d.match&&Object.entries(d.match).forEach(([p,m])=>{h.push([p,o.ho.equal,m])}),h};function i(d){return`"${d.replace(/[\\"]/g,p=>`\\${p}`)}"`}function l(d){return/^"(.*)"$/.test(d)?d.replace(/^"(.*)"$/,"$1").replace(/\\"/g,'"').replace(/\\\\/g,"\\"):d}const f={default:([d,h,p])=>`${d} ${h} ${p||""}`,unquote:([d,h,p])=>{const m=l(p)||'""';return`${d} ${h} ${m}`}}},56361:(Q,A,e)=>{"use strict";e.d(A,{BK:()=>O,Cp:()=>V,D2:()=>H,ES:()=>_,GD:()=>P,Ht:()=>b,JM:()=>B,JZ:()=>j,KT:()=>M,NH:()=>L,S2:()=>E,Sl:()=>D,Y9:()=>x,Yp:()=>m,bg:()=>a,c$:()=>U,i7:()=>v,i9:()=>w,nL:()=>T,qN:()=>R,qy:()=>y,t7:()=>S,w$:()=>p,y$:()=>G});var t=e(2543),n=e.n(t),o=e(61268),s=e(32264),r=e(17172),g=e(18461),u=e(23662),c=e(64861),i=e(94822),l=e(55740),f=e(57220),d=e(32642),h=e(3704);function p(k,Y,ee){const re=(0,f.EV)(k),J=g.UP(re,Y),ne=encodeURIComponent(g.$9(J)),q=encodeURIComponent(re);return(0,h.c)(`/alerting/${q}/${ne}/view`,{returnTo:ee})}function m(k,Y){const{uid:ee,type:re}=k;return(0,h.c)("/explore",{left:JSON.stringify({datasource:k.uid,queries:[{refId:"A",datasource:{uid:ee,type:re},expr:Y}],range:{from:"now-1h",to:"now"}})})}function a(k,Y=""){return(0,h.c)(`/alerting/notifications/receivers/${encodeURIComponent(k)}/edit`,{alertmanager:Y})}function v(k,Y=""){return(0,h.c)("/alerting/routes/mute-timing/edit",{muteName:k,alertmanager:Y})}function E(k,Y){return(0,f.Eb)(k)?(0,h.z)(`/alerting/${encodeURIComponent(k.name)}/${encodeURIComponent((0,g.PH)(Y.name))}/find`):window.location.href.split("?")[0]}function D(k){return k.reduce((Y,{key:ee,value:re})=>(Y[ee]=re,Y),{})}const b=k=>{const Y=k.queryString===void 0?void 0:String(k.queryString),ee=k.alertState===void 0?void 0:String(k.alertState),re=k.dataSource===void 0?void 0:String(k.dataSource),J=k.ruleType===void 0?void 0:String(k.ruleType),ne=k.groupBy===void 0?void 0:String(k.groupBy).split(",");return{queryString:Y,alertState:ee,dataSource:re,groupBy:ne,ruleType:J}},C=k=>({queryString:k.get("queryString")??void 0,contactPoint:k.get("contactPoint")??void 0}),y=k=>{const Y=k.queryString===void 0?void 0:String(k.queryString),ee=k.silenceState===void 0?void 0:String(k.silenceState);return{queryString:Y,silenceState:ee}};function M(k){return Object.entries(k).map(([Y,ee])=>({key:Y,value:ee}))}function T(k,Y,ee){const re=new URLSearchParams(ee);return Y&&re.set(l.DD,Y),`${k}?${re.toString()}`}const I=k=>k.replace(/\"/g,'\\"');function x(k){return k.startsWith('"')&&k.endsWith('"')?I(k):`"${I(k)}"`}function S(k,Y){const ee={alertname:Y.name,...Y.labels};return O(k,ee)}function O(k,Y){const ee=new URLSearchParams;return ee.append("alertmanager",k),(0,d.J9)(Y).forEach((J,ne)=>ee.append(ne,J)),(0,h.c)("/alerting/silence/new",ee)}function P(k){return(0,h.c)(`/datasources/edit/${k}`)}function L(k){return(0,h.c)(`/dashboards/f/${k}`)}function U(k,Y){return(0,h.c)(`/dashboards/f/${k}/${Y}/alerting`)}function R(k){return(0,h.c)(`/dashboards/f/${k}/settings`)}function B(k){return(0,h.c)(`/d/${encodeURIComponent(k)}`)}function H(k,Y,ee="view",re){const J=ee==="edit"?"editPanel":"viewPanel",ne=new URLSearchParams({[J]:Y});return re&&ne.set("tab",re),(0,h.c)(`/d/${encodeURIComponent(k)}`,ne)}function w(k,Y,ee,re=1e3){const J=new Date().getTime(),ne=()=>k().catch(q=>{if(Y(q)&&new Date().getTime()-J<ee)return new Promise(te=>setTimeout(te,re)).then(ne);throw q});return ne()}const N={[i.Gi.Alerting]:1,[i.cF.Firing]:1,[i.Gi.Error]:1,[i.Gi.Pending]:2,[i.cF.Pending]:2,[i.cF.Inactive]:2,[i.Gi.NoData]:3,[i.Gi.Normal]:4};function V(k,Y){if(k===c.xB.Importance)return(0,t.sortBy)(Y,re=>[N[(0,i.lh)(re.state)],(0,u.RI)(re).toLocaleLowerCase()]);if(k===c.xB.TimeAsc)return(0,t.sortBy)(Y,re=>[new Date(re.activeAt)||new Date,(0,u.RI)(re).toLocaleLowerCase()]);if(k===c.xB.TimeDesc)return(0,t.sortBy)(Y,re=>[new Date(re.activeAt)||new Date,(0,u.RI)(re).toLocaleLowerCase()]).reverse();const ee=(0,t.sortBy)(Y,re=>(0,u.RI)(re).toLocaleLowerCase());return k===c.xB.AlphaDesc&&ee.reverse(),ee}function G(){return s.$.buildInfo.edition===o.r.OpenSource}function _(){return s.$.buildInfo.env==="development"}function K(k){return"message"in k}function j(k){return(0,r.NF)(k)?k.data.message:K(k)?k.message:String(k)}},88467:(Q,A,e)=>{"use strict";e.d(A,{$I:()=>l,BU:()=>b,CZ:()=>h,J7:()=>c,ML:()=>C,Vf:()=>E,Xw:()=>i,jA:()=>g,p0:()=>p,t4:()=>D,v5:()=>f});var t=e(30038),n=e(26272),o=e(17172),s=e(10096),r=e(25027);const g=Object.freeze({loading:!1,result:void 0,error:void 0,dispatched:!1});function u(y,M=g,T){if(y.pending.match(T))return{result:M.result,loading:!0,error:M.error,dispatched:!0,requestId:T.meta.requestId};if(y.fulfilled.match(T)){if(M.requestId===void 0||M.requestId===T.meta.requestId)return{...M,result:T.payload,loading:!1,error:void 0}}else if(y.rejected.match(T)&&M.requestId===T.meta.requestId)return{...M,loading:!1,error:T.error};return M}function c(y,M){return(0,t.Z0)({name:y,initialState:g,reducers:{},extraReducers:T=>T.addDefaultCase((I,x)=>u(M,I,x))})}function i(y,M,T){return(0,t.Z0)({name:y,initialState:{},reducers:{},extraReducers:I=>I.addDefaultCase((x,S)=>{if((0,t.$S)(M)(S)){const O=S,P=T(O.meta.arg);return{...x,[P]:u(M,x[P],O)}}return x})})}function l(y){return y.catch(M=>{throw{message:h(M),code:M.statusCode}})}function f(y,M){return y.then(T=>(M.successMessage&&s.lE.emit(n.r1.alertSuccess,[M.successMessage]),T)).catch(T=>{const I=h(T);throw s.lE.emit(n.r1.alertError,[`${M.errorMessage??"Error"}: ${I}`]),T})}const d="Unknown Error";function h(y){if((0,o.NF)(y))if(y.data?.message){let T=y.data?.message;return typeof y.data?.error=="string"&&(T+=`; ${y.data.error}`),T}else{if(Array.isArray(y.data)&&y.data.length&&y.data[0]?.message)return y.data.map(T=>T?.message).filter(T=>!!T).join(" ");if(y.statusText)return y.statusText}const M=y?.message;return M||((0,r.fH)(r.le.unknownMessageFromError,{error:JSON.stringify(y)}),d)}function p(y){return Object.values(y).every(m)}function m(y){return y.dispatched&&!y.loading}function a(y){return Object.values(y).every(v)}function v(y){return y.dispatched&&!y.loading&&!y.error}function E(y){return Object.values(y).some(C)}function D(y){return Object.values(y).some(M=>M.dispatched)}function b(y){return Object.values(y).some(v)}function C(y){return y?y.dispatched&&y.loading:!1}},63066:(Q,A,e)=>{"use strict";e.d(A,{Bu:()=>Y,IJ:()=>M,J6:()=>_,JE:()=>S,Q8:()=>y,QX:()=>U,Qk:()=>R,Rk:()=>ee,XI:()=>B,Z9:()=>P,ir:()=>re,l1:()=>I,mp:()=>G,pY:()=>C,qO:()=>H});var t=e(2543),n=e.n(t),o=e(43127),s=e(65879),r=e(32264),g=e(19347),u=e(26657),c=e(79065),i=e(21969),l=e(74730),f=e(66718),d=e(94822),h=e(55907),p=e(86590),m=e(75471),a=e(55740),v=e(57220),E=e(56361),D=e(23662),b=e(25968);const C="1m",y="grafana.alerting.manualRouting",M=()=>{const{canCreateGrafanaRules:J,canCreateCloudRules:ne}=(0,m.Q9)();return Object.freeze({name:"",uid:"",labels:[{key:"",value:""}],annotations:a.kl,dataSourceName:null,type:J?p.Z.grafana:ne?p.Z.cloudAlerting:void 0,group:"",folder:null,queries:[],recordingRulesQueries:[],condition:"",noDataState:d.Q8.NoData,execErrState:d.Q8.Error,evaluateFor:"5m",evaluateEvery:C,manualRouting:T(),contactPoints:{},overrideGrouping:!1,overrideTimings:!1,muteTimeIntervals:[],namespace:"",expression:"",forTime:1,forTimeUnit:"m"})},T=()=>r.$.featureToggles.alertingSimplifiedRouting??!1?localStorage.getItem(y)!=="false":!1;function I(J){const{name:ne,expression:q,forTime:te,forTimeUnit:oe,keepFiringForTime:ue,keepFiringForTimeUnit:ie,type:ge}=J;if(ge===p.Z.cloudAlerting){let he;return ue&&ie&&(he=`${ue}${ie}`),{alert:ne,for:`${te}${oe}`,keep_firing_for:he,annotations:(0,E.Sl)(J.annotations||[]),labels:(0,E.Sl)(J.labels||[]),expr:q}}else if(ge===p.Z.cloudRecording)return{record:ne,labels:(0,E.Sl)(J.labels||[]),expr:q};throw new Error(`unexpected rule type: ${ge}`)}function x(J,ne){const q=[...(0,E.KT)(J||{})];return ne&&q.push({key:"",value:""}),q}function S(J){const ne=[...J];return a.kl.map(te=>te.key).forEach((te,oe)=>{const ue=ne.findIndex(ie=>ie.key===te);if(ue===-1){const ie={key:te,value:""};ne.splice(oe,0,ie)}else ue!==oe&&ne.splice(oe,0,ne.splice(ue,1)[0])}),ne}function O(J,ne){if(ne?.grafana?.selectedContactPoint&&J)return{receiver:ne?.grafana?.selectedContactPoint,mute_time_intervals:ne?.grafana?.muteTimeIntervals,group_by:ne?.grafana?.overrideGrouping?ne?.grafana?.groupBy:void 0,group_wait:ne?.grafana?.overrideTimings&&ne?.grafana?.groupWaitValue?ne?.grafana?.groupWaitValue:void 0,group_interval:ne?.grafana?.overrideTimings&&ne?.grafana?.groupIntervalValue?ne?.grafana?.groupIntervalValue:void 0,repeat_interval:ne?.grafana?.overrideTimings&&ne?.grafana?.repeatIntervalValue?ne?.grafana?.repeatIntervalValue:void 0}}function P(J){const{name:ne,condition:q,noDataState:te,execErrState:oe,evaluateFor:ue,queries:ie,isPaused:ge,contactPoints:he,manualRouting:De}=J;if(q){const pe=O(De,he);return{grafana_alert:{title:ne,condition:q,no_data_state:te,exec_err_state:oe,data:ie.map(j),is_paused:!!ge,notification_settings:pe},for:ue,annotations:(0,E.Sl)(J.annotations||[]),labels:(0,E.Sl)(J.labels||[])}}throw new Error("Cannot create rule without specifying alert condition")}function L(J){const ne=J.notification_settings?{selectedContactPoint:J.notification_settings.receiver,muteTimeIntervals:J.notification_settings.mute_time_intervals??[],overrideGrouping:Array.isArray(J.notification_settings.group_by)&&J.notification_settings.group_by.length>0,overrideTimings:[J.notification_settings.group_wait,J.notification_settings.group_interval,J.notification_settings.repeat_interval].some(Boolean),groupBy:J.notification_settings.group_by||[],groupWaitValue:J.notification_settings.group_wait||"",groupIntervalValue:J.notification_settings.group_interval||"",repeatIntervalValue:J.notification_settings.repeat_interval||""}:void 0;return ne?{[v.hY]:ne}:void 0}function U(J){const{ruleSourceName:ne,namespace:q,group:te,rule:oe}=J,ue=M();if((0,v.z2)(ne))if((0,D.lT)(oe)){const ie=oe.grafana_alert,ge=L(ie);return{...ue,name:ie.title,type:p.Z.grafana,group:te.name,evaluateEvery:te.interval||ue.evaluateEvery,evaluateFor:oe.for||"0",noDataState:ie.no_data_state,execErrState:ie.exec_err_state,queries:ie.data,condition:ie.condition,annotations:S(x(oe.annotations,!1)),labels:x(oe.labels,!0),folder:{title:q,uid:ie.namespace_uid},isPaused:ie.is_paused,contactPoints:ge,manualRouting:!!ge}}else throw new Error("Unexpected type of rule for grafana rules source");else if((0,D.$y)(oe)){const ge={refId:"A",datasourceUid:(0,g.l)().getInstanceSettings(ne)?.uid??"",queryType:"",relativeTimeRange:(0,o.Cn)(),expr:oe.expr,model:{refId:"A",hide:!1,expr:oe.expr}},he=R(oe);return{...ue,...he,queries:[ge],annotations:S(x(oe.annotations,!1)),type:p.Z.cloudAlerting,dataSourceName:ne,namespace:q,group:te.name}}else if((0,D.i7)(oe)){const ie=B(oe);return{...ue,...ie,type:p.Z.cloudRecording,dataSourceName:ne,namespace:q,group:te.name}}else throw new Error("Unexpected type of rule for cloud rules source")}function R(J){const ne=M(),[q,te]=J.for?(0,b.P1)(J.for):[0,"s"],[oe,ue]=J.keep_firing_for?(0,b.P1)(J.keep_firing_for):[ne.keepFiringForTime,ne.keepFiringForTimeUnit];return{name:J.alert,expression:J.expr,forTime:q,forTimeUnit:te,keepFiringForTime:oe,keepFiringForTimeUnit:ue,annotations:x(J.annotations,!1),labels:x(J.labels,!0)}}function B(J){return{name:J.record,expression:J.expr,labels:x(J.labels,!0)}}const H=()=>{const J=(0,v.y9)();if(!J)return[...N("A","B")];const ne=(0,o.Cn)();return[{refId:"A",datasourceUid:J.uid,queryType:"",relativeTimeRange:ne,model:{refId:"A"}},...N("B","C")]},w=J=>{const ne=getDefaultRelativeTimeRange();return[{refId:"A",datasourceUid:J[0]?.uid||"",queryType:"",relativeTimeRange:ne,model:{refId:"A"}}]},N=(...J)=>{const ne=J[0],q=J[1],te={refId:J[0],type:f.Tz.reduce,datasource:{uid:f.Uj,type:u.dR.type},conditions:[{type:"query",evaluator:{params:[],type:h.p.IsAbove},operator:{type:"and"},query:{params:[ne]},reducer:{params:[],type:"last"}}],reducer:"last",expression:"A"},oe={refId:q,type:f.Tz.threshold,datasource:{uid:f.Uj,type:u.dR.type},conditions:[{type:"query",evaluator:{params:[0],type:h.p.IsAbove},operator:{type:"and"},query:{params:[q]},reducer:{params:[],type:"last"}}],expression:ne};return[{refId:ne,datasourceUid:f.Uj,queryType:"",model:te},{refId:q,datasourceUid:f.Uj,queryType:"",model:oe}]},V=async(J,ne,q,te,oe,ue)=>{const ie=[];for(const ge of J){const he=await(0,g.l)().get(ge.datasource?.uid?ge.datasource:te),De={uid:he.uid,type:he.type},pe=s.relativeToTimeRange(ne),{interval:le,intervalMs:Te}=K(pe,ue??he.interval,oe),Ee={__interval:{text:le,value:le},__interval_ms:{text:Te,value:Te},...q},Re=he.interpolateVariablesInQueries?he.interpolateVariablesInQueries([ge],Ee)[0]:ge;if(De.uid===f.Uj){const me={refId:Re.refId,queryType:"",relativeTimeRange:ne,datasourceUid:f.Uj,model:Re};ie.push(me)}else{const me=(0,g.l)().getInstanceSettings(De);if(me&&me.meta.alerting){const Me={refId:Re.refId,queryType:Re.queryType??"",relativeTimeRange:ne,datasourceUid:me.uid,model:{...Re,maxDataPoints:oe,intervalMs:Te}};ie.push(Me)}}}return ie},G=async(J,ne)=>{const{targets:q}=J;if(!J.id||!ne.uid)return;const te=s.timeRangeToRelative(s.convertRawToRange(ne.time)),oe=await V(q,te,J.scopedVars||{},J.datasource??void 0,J.maxDataPoints??void 0,J.interval??void 0);if(!oe.length||!oe.find(he=>he.datasourceUid!==f.Uj))return;if(!oe.find(he=>he.datasourceUid===f.Uj)){const[he,De]=N((0,i.W3)(oe),"-");oe.push(he);const[pe,le]=N(he.refId,(0,i.W3)(oe));oe.push(le)}const{folderTitle:ue,folderUid:ie}=ne.meta;return{type:p.Z.grafana,folder:ie&&ue?{uid:ie,title:ue}:void 0,queries:oe,name:J.title,condition:oe[oe.length-1].refId,annotations:[{key:a.YH.dashboardUID,value:ne.uid},{key:a.YH.panelID,value:String(J.id)}]}},_=async J=>{if(!J.state.key)return;const ne=c.jh.getTimeRange(J),q=(0,l.un)(J);if(!q)return;const{queries:te,datasource:oe,maxDataPoints:ue,minInterval:ie}=q.state,ge=(0,l.YQ)(J);if(!ge||!ge.state.uid)return;const he=await V(te,s.timeRangeToRelative(s.convertRawToRange(ne.state.value.raw)),{__sceneObject:{value:J}},oe,ue,ie);if(!he.length||!he.find(Te=>Te.datasourceUid!==f.Uj))return;if(!he.find(Te=>Te.datasourceUid===f.Uj)){const[Te,Ee]=N((0,i.W3)(he),"-");he.push(Te);const[Re,me]=N(Te.refId,(0,i.W3)(he));he.push(me)}const{folderTitle:De,folderUid:pe}=ge.state.meta;return{type:p.Z.grafana,folder:pe&&De?{uid:pe,title:De}:void 0,queries:he,name:J.state.title,condition:he[he.length-1].refId,annotations:[{key:a.YH.dashboardUID,value:ge.state.uid},{key:a.YH.panelID,value:String((0,l.Cs)(J))}]}};function K(J,ne,q){return q?s.calculateInterval(J,q,ne):ne&&s.intervalToMs(ne)>1e3?{interval:ne,intervalMs:s.intervalToMs(ne)}:{interval:"1s",intervalMs:1e3}}function j(J){const ne=J.model;return k(ne)&&ne.instant&&ne.range?{...J,model:{...ne,range:!0,instant:!1}}:J}function k(J){return"expr"in J&&"instant"in J&&"range"in J}function Y(J){return"expr"in J}const ee=J=>({...J,queries:J.queries?.map(ne=>(0,t.omit)(ne,"model.hide"))});function re(J){return ee(U(J))}},18461:(Q,A,e)=>{"use strict";e.d(A,{$9:()=>D,LC:()=>l,Ns:()=>C,P1:()=>g,PH:()=>m,UP:()=>c,VY:()=>T,Yd:()=>i,c:()=>a,qg:()=>v,uE:()=>I,x6:()=>E});var t=e(2543),n=e.n(t),o=e(12131),s=e(57220),r=e(23662);function g(x,S,O,P){return(0,r.lT)(P)?{uid:P.grafana_alert.uid,ruleSourceName:"grafana"}:{ruleSourceName:x,namespace:S,groupName:O,ruleName:(0,r.$y)(P)?P.alert:P.record,rulerRuleHash:C(P)}}function u(x,S,O,P){return{ruleSourceName:x,namespace:S,groupName:O,ruleName:P.name,ruleHash:y(P)}}function c(x,S){const O=S.namespace.name,P=S.group.name;if(S.rulerRule)return g(x,O,P,S.rulerRule);if(S.promRule)return u(x,O,P,S.promRule);throw new Error("Could not create an id for a rule that is missing both `rulerRule` and `promRule`.")}function i(x){return g(x.ruleSourceName,x.namespace,x.group.name,x.rule)}function l(x,S){return(0,r.A4)(x)&&(0,r.A4)(S)?x.uid===S.uid:(0,r.X4)(x)&&(0,r.X4)(S)?x.groupName===S.groupName&&x.namespace===S.namespace&&x.ruleName===S.ruleName&&x.rulerRuleHash===S.rulerRuleHash&&x.ruleSourceName===S.ruleSourceName:(0,r.Mj)(x)&&(0,r.Mj)(S)?x.groupName===S.groupName&&x.namespace===S.namespace&&x.ruleName===S.ruleName&&x.ruleHash===S.ruleHash&&x.ruleSourceName===S.ruleSourceName:!1}const f="cri",d="pri";function h(x){return x.replace(/\$/g,"_DOLLAR_")}function p(x){return x.replace(/\_DOLLAR\_/g,"$")}function m(x){return x.replace(/\//g,"").replace(/\\/g,"")}function a(x){return x.replace(/\x1f/g,"/").replace(/\x1e/g,"\\")}function v(x,S=!1){const P=(S?decodeURIComponent(x):x).split("$");if(P.length===1)return{uid:x,ruleSourceName:"grafana"};if(P.length===6){const[L,U,R,B,H,w]=P.map(p).map(a);if(L===f)return{ruleSourceName:U,namespace:R,groupName:B,ruleName:H,rulerRuleHash:w};if(L===d)return{ruleSourceName:U,namespace:R,groupName:B,ruleName:H,ruleHash:w}}throw new Error(`Failed to parse rule location: ${x}`)}function E(x,S=!1){if(x)try{return v(x,S)}catch{return}}function D(x){return(0,r.A4)(x)?x.uid:(0,r.X4)(x)?[f,x.ruleSourceName,x.namespace,x.groupName,x.ruleName,x.rulerRuleHash].map(String).map(h).map(m).join("$"):[d,x.ruleSourceName,x.namespace,x.groupName,x.ruleName,x.ruleHash].map(String).map(h).map(m).join("$")}function b(x){let S=0;if(x.length===0)return S;for(let O=0;O<x.length;O++){const P=x.charCodeAt(O);S=(S<<5)-S+P,S=S&S}return S}function C(x){if((0,r.i7)(x))return b(JSON.stringify([x.record,x.expr,M(x.labels)])).toString();if((0,r.$y)(x))return b(JSON.stringify([x.alert,x.expr,M(x.annotations),M(x.labels)])).toString();if((0,r.lT)(x))return x.grafana_alert.uid;throw new Error("only recording and alerting ruler rules can be hashed")}function y(x){if((0,r.KB)(x))return b(JSON.stringify([x.type,x.query,M(x.labels)])).toString();if((0,r.Z8)(x))return b(JSON.stringify([x.type,x.query,M(x.annotations),M(x.labels)])).toString();throw new Error("only recording and alerting rules can be hashed")}function M(x){return JSON.stringify(Object.entries(x||{}).sort((S,O)=>S[0].localeCompare(O[0])))}function T(x){return(0,r.A4)(x)?s.hY:x.ruleSourceName}function I(x){const{pathname:S=""}=o.Ny.getLocation(),{id:O}=x;return O?(0,t.nth)(S.split("/"),-2):void 0}},23662:(Q,A,e)=>{"use strict";e.d(A,{$7:()=>a,$y:()=>f,A4:()=>v,HH:()=>p,KB:()=>l,Mj:()=>b,Om:()=>O,RI:()=>m,TU:()=>T,Wy:()=>x,X4:()=>E,XI:()=>y,YN:()=>P,Z8:()=>i,dS:()=>I,f6:()=>C,i7:()=>d,jg:()=>U,lT:()=>h,nf:()=>D,qz:()=>L});var t=e(2543),n=e.n(t),o=e(43585),s=e(94822),r=e(28475),g=e(55740),u=e(57220),c=e(25968);function i(B){return typeof B=="object"&&B.type===s.JS.Alerting}function l(B){return typeof B=="object"&&B.type===s.JS.Recording}function f(B){return typeof B=="object"&&"alert"in B}function d(B){return typeof B=="object"&&"record"in B}function h(B){return typeof B=="object"&&"grafana_alert"in B}function p(B){return B.rulerRule&&h(B.rulerRule)&&!!B.rulerRule.grafana_alert.is_paused}function m(B){return JSON.stringify(B.labels)}function a(B){return B.error&&B.error?.message?.includes(g.UU)}function v(B){return"uid"in B}function E(B){return"rulerRuleHash"in B}function D(B){return Object.values(s.JS).includes(B)}function b(B){return"ruleHash"in B}function C(B){switch(B){case"ok":return r.Jc.Ok;case"nodata":return r.Jc.NoData;case"error":case"err":return r.Jc.Error;case"unknown":return r.Jc.Unknown;default:return}}function y(B){return B===s.cF.Inactive?"Normal":(0,t.capitalize)(B)}const M=B=>B.reduce((H,{dataSourceName:w,name:N,groups:V})=>(V.forEach(({name:G,rules:_})=>{_.forEach(K=>{i(K)&&H.push({dataSourceName:w,namespaceName:N,groupName:G,rule:K})})}),H),[]),T=B=>i(B.promRule)?B.promRule:null,I=B=>B.reduce((H,{rulesSource:w,name:N,groups:V})=>(V.forEach(({name:G,rules:_})=>{_.forEach(K=>{K.promRule&&i(K.promRule)&&H.push({dataSourceName:(0,u.EV)(w),namespaceName:N,groupName:G,...K})})}),H),[]);function x(B){let H;return Object.values(o.O).includes(B)?H=B:H=(0,s.lh)(B),S[H]}const S={[s.cF.Inactive]:"good",[s.cF.Firing]:"bad",[s.cF.Pending]:"warning",[s.Gi.Alerting]:"bad",[s.Gi.Error]:"bad",[s.Gi.NoData]:"info",[s.Gi.Normal]:"good",[s.Gi.Pending]:"warning",[o.O.NoData]:"info",[o.O.Paused]:"warning",[o.O.Alerting]:"bad",[o.O.OK]:"good",[o.O.Unknown]:"info"};function O(B){return B?.alerts?B.alerts.reduce((H,w)=>{const N=(0,s.lh)(w.state)!==s.Gi.Normal;if(w.activeAt&&N){const V=new Date(w.activeAt);if(H===null||H.getTime()>V.getTime())return V}return H},null):null}function P(B){return Array.isArray(B.source_tenants)}function L(B){return h(B)?B.grafana_alert.title:f(B)?B.alert:d(B)?B.record:""}const U=(B,H)=>{const w={alertName:"",forDuration:"0s",evaluationsToFire:0};return h(B)?{alertName:B.grafana_alert.title,forDuration:B.for,evaluationsToFire:R(B.for,H)}:f(B)?{alertName:B.alert,forDuration:B.for??"0s",evaluationsToFire:R(B.for??"0s",H)}:w},R=(B,H)=>{const w=(0,c.ge)(H),N=(0,c.ge)(B);return N===0&&w!==0?1:w===0||N/w<1?0:Math.ceil(N/w)+1}},25968:(Q,A,e)=>{"use strict";e.d(A,{M9:()=>i,P1:()=>n,TN:()=>r,ge:()=>l,mo:()=>f,sc:()=>s,yl:()=>d});var t=e(41068);function n(h){const p=h.match(/(\d+)(\w+)/);if(p)return[Number(p[1]),p[2]];throw new Error(`Invalid interval description: ${h}`)}function o(h){const{sec:p,count:m}=describeInterval(h);return p*m}const s=Object.entries(t.y).map(([h,p])=>({label:h[0].toUpperCase()+h.slice(1),value:p}));function r(h){try{return i(h),!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},u=new RegExp(/^(?:(?<value>\d+)(?<type>ms|s|m|h|d|w|y))|0$/),c=new Error(`Must be of format "(number)(unit)", for example "1m", or just "0". Available units: ${Object.values(t.y).join(", ")}`);function i(h){let p=h,m=[];function a(E){const D=u.exec(E),b=D?.groups?.value&&D?.groups?.type;if(!D||!b)throw c;D&&D.groups?.value&&D.groups?.type&&(p=p.replace(D[0],""),m.push([Number(D.groups.value),D.groups.type])),p&&a(p)}if(a(h),!m.length)throw c;return m.reduce((E,[D,b])=>{const C=D*g[b];return E+C},0)}const l=h=>{try{return i(h)}catch{return 0}},f=h=>h.includes("0001-01-01T00");function d(h){return h%(1e3*60*60)===0?h/(1e3*60*60)+"h":h%(1e3*60)===0?h/(1e3*60)+"m":h%1e3===0?h/1e3+"s":h.toFixed()+"ms"}},3704:(Q,A,e)=>{"use strict";e.d(A,{c:()=>n,z:()=>o});var t=e(32264);function n(s,r){const u=new URLSearchParams(r).toString();return`${t.$.appSubUrl}${s}${u?`?${u}`:""}`}function o(s,r){const u=new URLSearchParams(r).toString();try{const c=new URL(t.$.appSubUrl,t.$.appUrl);return c.pathname=s,`${c.href}${u?`?${u}`:""}`}catch{return n(s,r)}}},10154:(Q,A,e)=>{"use strict";e.d(A,{Xm:()=>s,rJ:()=>o,vJ:()=>n,vy:()=>r});var t=e(17172);function n(g){return(0,t.AI)().post("/api/annotations",g)}function o(g){return(0,t.AI)().put(`/api/annotations/${g.id}`,g)}function s(g){return(0,t.AI)().delete(`/api/annotations/${g.id}`)}async function r(){return(await(0,t.AI)().get("/api/annotations/tags")).result.tags.map(({tag:u,count:c})=>({term:u,count:c}))}},82241:(Q,A,e)=>{"use strict";e.d(A,{A:()=>b});var t=e(32196),n=e(96540),o=e(75505),s=e(39070),r=e(76287),g=e(14578),u=e(62930),c=e(55852),i=e(14792),l=e(74856),f=e(34214),d=e(27302),h=e(42493),p=e(28240),m=e(8790),a=e(83195),v=e(56034),E=e(88323);class D extends n.PureComponent{constructor(y){super(y),this.updateFields=()=>{const M=this.props.response?.panelData,T=M?.series?.[0]??M?.annotations?.[0];if(T&&T.fields){const I=T.fields.map(x=>{const S=(0,p.Ct)(x,T);let O="";for(let P=0;P<T.length;P++){if(P>0&&(O+=", "),P>2){O+="...";break}O+=x.values[P]}return O.length>50&&(O=O.substring(0,50)+"..."),{label:`${S} (${x.type})`,value:S,description:O}});this.setState({fieldNames:I})}},this.onFieldSourceChange=(M,T)=>{const I=this.props.mappings||{},x=I[M]||{};this.props.change({...I,[M]:{...x,source:T.value||m.V.Field}})},this.onFieldNameChange=(M,T)=>{const I=this.props.mappings||{};if(!T){const S={...this.props.mappings};delete S[M],this.props.change(S);return}const x=I[M]||{};this.props.change({...I,[M]:{...x,value:T.value,source:m.V.Field}})},this.state={fieldNames:[]}}componentDidMount(){this.updateFields()}componentDidUpdate(y){y.response!==this.props.response&&this.updateFields()}renderRow(y,M,T){const{fieldNames:I}=this.state;let x=[...I];const S=M.value;let O=I.find(L=>S===L.value);S&&!O&&x.push({label:S,value:S});let P=T?T[y.key]:"";if(P&&y.key.startsWith("time")){const L=(0,a.j_)("dateTimeAsIso");P=(0,a.cN)(L(P))}return P==null&&(P=""),n.createElement("tr",{key:y.key},n.createElement("td",null,y.label||y.key," ",y.help&&n.createElement(v.m,{content:y.help},n.createElement(g.I,{name:"info-circle"}))),n.createElement("td",null,n.createElement(E.l6,{value:O,options:x,placeholder:y.placeholder||y.key,onChange:L=>{this.onFieldNameChange(y.key,L)},noOptionsMessage:"Unknown field names",allowCustomValue:!0,isClearable:!0})),n.createElement("td",null,`${P}`))}render(){const y=this.props.response?.events?.[0],M=this.props.mappings||{};return n.createElement("table",{className:"filter-table"},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",null,"Annotation"),n.createElement("th",null,"From"),n.createElement("th",null,"First Value"))),n.createElement("tbody",null,h.kj.map(T=>this.renderRow(T,M[T.key]||{},y))))}}class b extends n.PureComponent{constructor(){super(...arguments),this.state={},this.onRunQuery=async()=>{const{datasource:y,annotation:M}=this.props;if((0,h.E7)(y))return;const T=(0,i.UA)().getCurrent();if(!T)return;this.setState({running:!0});const I=await(0,o.s)((0,d.b)({range:(0,l.jG)().timeRange(),panel:new f.a({}),dashboard:T},y,M));this.setState({running:!1,response:I})},this.onQueryChange=y=>{this.props.onChange({...this.props.annotation,target:y})},this.onMappingChange=y=>{this.props.onChange({...this.props.annotation,mappings:y})},this.onAnnotationChange=y=>{this.props.onChange(y)}}componentDidMount(){this.verifyDataSource()}componentDidUpdate(y){this.props.annotation!==y.annotation&&!(0,h.E7)(this.props.datasource)&&this.verifyDataSource()}verifyDataSource(){const{datasource:y,annotation:M}=this.props,I={...h.CU,...y.annotations}.prepareAnnotation(M);I!==M?this.props.onChange(I):this.onRunQuery()}renderStatus(){const{response:y,running:M}=this.state;let T="alert-info",I="...",x;if(M||y?.panelData?.state===s.Gu.Loading||!y)I="loading...";else{const{events:S,panelData:O}=y;if(O?.error)T="alert-error",x="exclamation-triangle",I=O.error.message??"error";else if(!S?.length)T="alert-warning",x="exclamation-triangle",I="No events found";else{const P=O?.series?.[0]??O?.annotations?.[0];I=`${S.length} events (from ${P?.fields.length} fields)`}}return n.createElement("div",{className:(0,t.cx)(T,(0,t.css)` margin: 4px 0px; padding: 4px; display: flex; justify-content: space-between; align-items: center; `)},n.createElement("div",null,x&&n.createElement(n.Fragment,null,n.createElement(g.I,{name:x}),"\xA0"),I),n.createElement("div",null,M?n.createElement(u.y,null):n.createElement(c.$n,{variant:"secondary",size:"xs",onClick:this.onRunQuery},"TEST")))}render(){const{datasource:y,annotation:M,datasourceInstanceSettings:T}=this.props,{response:I}=this.state;let x=y.annotations?.QueryEditor||y.components?.QueryEditor;if(!x)return n.createElement("div",null,"Annotations are not supported. This datasource needs to export a QueryEditor");const S={...y.annotations?.getDefaultQuery?.(),...M.target??{refId:"Anno"}};return n.createElement(n.Fragment,null,n.createElement(r.p,{instanceSettings:T},n.createElement(x,{key:y?.name,query:S,datasource:y,onChange:this.onQueryChange,onRunQuery:this.onRunQuery,data:I?.panelData,range:(0,l.jG)().timeRange(),annotation:M,onAnnotationChange:this.onAnnotationChange})),(0,h.JX)(y)&&n.createElement(n.Fragment,null,this.renderStatus(),n.createElement(D,{response:I,mappings:M.mappings,change:this.onMappingChange})))}}},27302:(Q,A,e)=>{"use strict";e.d(A,{b:()=>l});var t=e(62467),n=e(69862),o=e(81160),s=e(65879),r=e(41987),g=e(39374),u=e(42493);let c=100;function i(){return"AQ"+c++}function l(f,d,h){const p={...u.CU,...d.annotations},m={...p.getDefaultQuery?.(),...h},a=p.prepareAnnotation(m);if(!a)return(0,t.of)({});const v=p.prepareQuery(a);if(!v)return(0,t.of)({});const E=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,D=s.calculateInterval(f.range,E,d.interval),b={__interval:{text:D.interval,value:D.interval},__interval_ms:{text:D.intervalMs.toString(),value:D.intervalMs},__annotation:{text:a.name,value:a}},C={startTime:Date.now(),requestId:i(),range:f.range,maxDataPoints:E,scopedVars:b,...D,app:r.Jk.Dashboard,timezone:f.dashboard.timezone,targets:[{...v,refId:"Anno"}]};return(0,g.BN)(d,C).pipe((0,n.Z)(y=>{const M=y?.series.length?y.series:y.annotations;return M?.length?p.processEvents(a,M).pipe((0,o.T)(T=>({panelData:y,events:T}))):(0,t.of)({panelData:y,events:[]})}))}},42493:(Q,A,e)=>{"use strict";e.d(A,{CU:()=>f,E7:()=>D,JX:()=>E,kj:()=>h});var t=e(2543),n=e.n(t),o=e(62467),s=e(69862),r=e(81160),g=e(57934),u=e(11261),c=e(28240),i=e(8790),l=e(2913);const f={prepareAnnotation:b=>{if((0,t.isString)(b?.query)){const{query:C,...y}=b;return{...y,target:{refId:"annotation_query",query:C},mappings:{}}}return b},prepareQuery:b=>b.target,processEvents:(b,C)=>a(C,b.mappings)};function d(){return b=>b.pipe((0,s.Z)(C=>{if(!C?.length)return(0,o.of)(void 0);if(C.length===1)return(0,o.of)(C[0]);const y={interpolate:M=>M};return(0,o.of)(C).pipe(g.c.mergeTransformer.operator({},y),(0,r.T)(M=>M[0]))}))}const h=[{key:"time",field:b=>b.fields.find(C=>C.type===u.PU.time),placeholder:"time, or the first time field"},{key:"timeEnd",label:"end time",help:"When this field is defined, the annotation will be treated as a range"},{key:"title"},{key:"text",field:b=>b.fields.find(C=>C.type===u.PU.string),placeholder:"text, or the first text field"},{key:"tags",split:",",help:"The results will be split on comma (,)"},{key:"id"}],p=[{key:"color"},{key:"isRegion"},{key:"source"}],m=[...l.$W.publicDashboardAccessToken?p:[],...h,{key:"userId"},{key:"login"},{key:"email"},{key:"prevState"},{key:"newState"},{key:"data"},{key:"panelId"},{key:"alertId"},{key:"dashboardId"},{key:"dashboardUID"}];function a(b,C){return(0,o.of)(b).pipe(d(),(0,r.T)(y=>{if(!y?.length)return[];let M=!1,T=!1;const I={};for(const O of y.fields){const P=(0,c.Ct)(O,y);I[P.toLowerCase()]=O}C||(C={});const x=[];for(const O of m){const P=C[O.key]||{};if(P.source===i.V.Skip)continue;const L={key:O.key,split:O.split};if(P.source===i.V.Text)L.text=P.value;else{const U=(P.value||O.key).toLowerCase();L.field=I[U],!L.field&&O.field&&(L.field=O.field(y))}(L.field||L.text)&&(x.push(L),L.key==="time"?M=!0:L.key==="text"&&(T=!0))}if(!M||!T)return console.error("Cannot process annotation fields. No time or text present."),[];const S=[];for(let O=0;O<y.length;O++){const P={type:"default",color:"red"};for(const L of x){let U;if(L.text)U=L.text;else if(L.field&&(U=L.field.values[O],U!==void 0&&L.regex)){const R=L.regex.exec(U);R&&(U=R[1]?R[1]:R[0])}U!=null&&(L.split&&typeof U=="string"&&(U=U.split(",")),P[L.key]=U)}S.push(P)}return S}))}const v=["prometheus","loki","elasticsearch","grafana-opensearch-datasource"];function E(b){const{type:C}=b;return!(C==="datasource"||v.includes(C))}function D(b){const{type:C}=b;return v.includes(C)}},93584:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>l,QB:()=>c,Ri:()=>u,Sf:()=>s,cV:()=>r,h8:()=>g});var t=e(30038);const n={hasFetched:!1,includeExpired:!1,keys:[],keysIncludingExpired:[],searchQuery:"",migrationResult:{total:0,migrated:0,failed:0,failedApikeyIDs:[0],failedDetails:[]}},o=(0,t.Z0)({name:"apiKeys",initialState:n,reducers:{apiKeysLoaded:(f,d)=>{const{keys:h,keysIncludingExpired:p}=d.payload,m=d.payload.keys.length===0&&d.payload.keysIncludingExpired.length>0?!0:f.includeExpired;return{...f,hasFetched:!0,keys:h,keysIncludingExpired:p,includeExpired:m}},setSearchQuery:(f,d)=>({...f,searchQuery:d.payload}),includeExpiredToggled:f=>({...f,includeExpired:!f.includeExpired}),isFetching:f=>({...f,hasFetched:!1}),setMigrationResult:(f,d)=>({...f,migrationResult:d.payload})}}),{apiKeysLoaded:s,includeExpiredToggled:r,isFetching:g,setSearchQuery:u,setMigrationResult:c}=o.actions,l={apiKeys:o.reducer}},73399:(Q,A,e)=>{"use strict";e.d(A,{getAuthProviderStatus:()=>l,getRegisteredAuthProviders:()=>u,initAuthConfig:()=>f});var t=e(10096),n=e(27677),o=e(80348);const s=[],r={};function g(h,p){s.find(m=>m.id===h.id)||(s.push(h),p&&(r[h.id]=p))}function u(){return s}function c(h){return s.find(p=>p.id===h)}function i(h){const p=[];for(const[m,a]of Object.entries(h)){const v=s.find(E=>`auth.${E.id}`===m);if(v){const E={...a,providerId:v.id,displayName:a.name||v.displayName};p.push(E)}}return p}async function l(h){if(r[h]){const p=r[h];return p()}return{configured:!1,enabled:!1}}function f(){g({id:"ldap",type:"LDAP",protocol:"LDAP",displayName:"LDAP",configPath:"ldap"},d)}async function d(){if(t.TP.hasPermission(o.AccessControlAction.SettingsRead)){const p=(await(0,n.AI)().get("/api/admin/settings"))["auth.ldap"]||{};return{configured:p.enabled==="true",enabled:p.enabled==="true",hide:p.enabled!=="true"}}return{configured:!1,enabled:!1}}},20604:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>p,MH:()=>u,Oy:()=>d,TO:()=>r,jA:()=>s,sr:()=>g});var t=e(30038);const n={settings:{},providerStatuses:{},isLoading:!1,providers:[]},o=(0,t.Z0)({name:"authConfig",initialState:n,reducers:{settingsUpdated:(m,a)=>({...m,settings:a.payload}),providerStatusesLoaded:(m,a)=>({...m,providerStatuses:a.payload}),loadingBegin:m=>({...m,isLoading:!0}),loadingEnd:m=>({...m,isLoading:!1}),setError:(m,a)=>({...m,updateError:a.payload}),resetError:m=>({...m,updateError:void 0}),setWarning:(m,a)=>({...m,warning:a.payload}),resetWarning:m=>({...m,warning:void 0}),providersLoaded:(m,a)=>({...m,providers:a.payload})}}),{settingsUpdated:s,providerStatusesLoaded:r,loadingBegin:g,loadingEnd:u,setError:c,resetError:i,setWarning:l,resetWarning:f,providersLoaded:d}=o.actions,p={authConfig:o.reducer}},55314:(Q,A,e)=>{"use strict";e.d(A,{G2:()=>D,Ko:()=>v,Vc:()=>M,aF:()=>C,cU:()=>m,e8:()=>T,hT:()=>h.hT,iB:()=>I,kH:()=>b,uz:()=>E,vZ:()=>a,wt:()=>y});var t=e(93020),n=e(75505),o=e(71733),s=e(39070),r=e(17172),g=e(12131),u=e(82467),c=e(3169),i=e(10096),l=e(6473),f=e(37690),d=e(92955),h=e(51066);function p({baseURL:x}){async function S(O){try{const{data:P,...L}=await(0,n.s)((0,r.AI)().fetch({...O,url:x+O.url,showErrorAlert:O.showErrorAlert}));return{data:P,meta:L}}catch(P){return O.manageError?O.manageError(P):{error:P}}}return S}const m=(0,t.xP)({tagTypes:["getFolder"],reducerPath:"browseDashboardsAPI",baseQuery:p({baseURL:"/api"}),endpoints:x=>({getFolder:x.query({providesTags:(S,O,P)=>[{type:"getFolder",id:P}],query:S=>({url:`/folders/${S}`,params:{accesscontrol:!0}})}),newFolder:x.mutation({query:({title:S,parentUid:O})=>({method:"POST",url:"/folders",data:{title:S,parentUid:O}}),onQueryStarted:({parentUid:S},{queryFulfilled:O,dispatch:P})=>{O.then(async({data:L})=>{await i.TP.fetchUserPermissions(),P((0,u.dx)((0,c.tZ)("Folder created"))),P((0,f.bw)({parentUID:S,pageSize:d.md})),g.Ny.push(o.I.stripBaseFromUrl(L.url))})}}),saveFolder:x.mutation({invalidatesTags:["getFolder"],query:({uid:S,title:O,version:P})=>({method:"PUT",url:`/folders/${S}`,data:{title:O,version:P}}),onQueryStarted:({parentUid:S},{queryFulfilled:O,dispatch:P})=>{O.then(()=>{P((0,f.bw)({parentUID:S,pageSize:d.md}))})}}),moveFolder:x.mutation({invalidatesTags:["getFolder"],query:({folder:S,destinationUID:O})=>({url:`/folders/${S.uid}/move`,method:"POST",data:{parentUID:O}}),onQueryStarted:({folder:S,destinationUID:O},{queryFulfilled:P,dispatch:L})=>{const{parentUid:U}=S;P.then(()=>{L((0,f.bw)({parentUID:U,pageSize:d.md})),L((0,f.bw)({parentUID:O,pageSize:d.md}))})}}),deleteFolder:x.mutation({query:({uid:S})=>({url:`/folders/${S}`,method:"DELETE",params:{forceDeleteRules:!1}}),onQueryStarted:({parentUid:S},{queryFulfilled:O,dispatch:P})=>{O.then(()=>{P((0,f.bw)({parentUID:S,pageSize:d.md}))})}}),getAffectedItems:x.query({queryFn:async S=>{const P=Object.keys(S.folder).filter(R=>S.folder[R]).map(R=>(0,r.AI)().get(`/api/folders/${R}/counts`)),L=await Promise.all(P),U={folder:Object.values(S.folder).filter(s.zz).length,dashboard:Object.values(S.dashboard).filter(s.zz).length,libraryPanel:0,alertRule:0};for(const R of L)U.folder+=R.folder??0,U.dashboard+=R.dashboard,U.alertRule+=R.alertrule,U.libraryPanel+=R.librarypanel;return{data:U}}}),moveItems:x.mutation({invalidatesTags:["getFolder"],queryFn:async({selectedItems:S,destinationUID:O},P,L,U)=>{const R=Object.keys(S.dashboard).filter(H=>S.dashboard[H]),B=Object.keys(S.folder).filter(H=>S.folder[H]);for(const H of B)await U({url:`/folders/${H}/move`,method:"POST",data:{parentUID:O}});for(const H of R){const N={dashboard:(await(0,r.AI)().get(`/api/dashboards/uid/${H}`)).dashboard,folderUid:O,overwrite:!1,message:""};await U({url:"/dashboards/db",method:"POST",data:N})}return{data:void 0}},onQueryStarted:({destinationUID:S,selectedItems:O},{queryFulfilled:P,dispatch:L})=>{const U=Object.keys(O.dashboard).filter(B=>O.dashboard[B]),R=Object.keys(O.folder).filter(B=>O.folder[B]);P.then(()=>{L((0,f.bw)({parentUID:S,pageSize:d.md})),L((0,f.Zw)([...R,...U]))})}}),deleteItems:x.mutation({queryFn:async({selectedItems:S},O,P,L)=>{const U=Object.keys(S.dashboard).filter(B=>S.dashboard[B]),R=Object.keys(S.folder).filter(B=>S.folder[B]);for(const B of R)await L({url:`/folders/${B}`,method:"DELETE",params:{forceDeleteRules:!1}});for(const B of U)await L({url:`/dashboards/uid/${B}`,method:"DELETE"});return{data:void 0}},onQueryStarted:({selectedItems:S},{queryFulfilled:O,dispatch:P})=>{const L=Object.keys(S.dashboard).filter(R=>S.dashboard[R]),U=Object.keys(S.folder).filter(R=>S.folder[R]);O.then(()=>{P((0,f.Zw)([...U,...L]))})}}),saveDashboard:x.mutation({query:({dashboard:S,folderUid:O,message:P,overwrite:L,showErrorAlert:U})=>({url:"/dashboards/db",method:"POST",showErrorAlert:U,data:{dashboard:S,folderUid:O,message:P??"",overwrite:!!L}}),onQueryStarted:({folderUid:S},{queryFulfilled:O,dispatch:P})=>{l.t.ignoreNextSave(),O.then(async()=>{await i.TP.fetchUserPermissions(),P((0,f.bw)({parentUID:S,pageSize:d.md}))})}}),importDashboard:x.mutation({query:({dashboard:S,overwrite:O,inputs:P,folderUid:L})=>({method:"POST",url:"/dashboards/import",data:{dashboard:S,overwrite:O,inputs:P,folderUid:L}}),onQueryStarted:({folderUid:S},{queryFulfilled:O,dispatch:P})=>{O.then(async L=>{P((0,f.bw)({parentUID:S,pageSize:d.md}));const U=o.I.stripBaseFromUrl(L.data.importedUrl);g.Ny.push(U)})}})})}),{endpoints:a,useDeleteFolderMutation:v,useDeleteItemsMutation:E,useGetAffectedItemsQuery:D,useGetFolderQuery:b,useMoveFolderMutation:C,useMoveItemsMutation:y,useNewFolderMutation:M,useSaveDashboardMutation:T,useSaveFolderMutation:I}=m},92955:(Q,A,e)=>{"use strict";e.d(A,{aw:()=>f,md:()=>i,uT:()=>l});var t=e(32264),n=e(17172),o=e(53477),s=e(24439),r=e(40957),g=e(10096),u=e(80348),c=e(49952);const i=50;async function l(d,h,p=1,m=i){if(d&&!t.$.featureToggles.nestedFolders)return[];const a=(0,n.AI)();let v=[];return g.TP.hasPermission(u.AccessControlAction.FoldersRead)&&(v=await a.get("/api/folders",{parentUid:d,page:p,limit:m})),v.map(E=>({kind:"folder",uid:E.uid,title:E.title,parentTitle:h,parentUID:d,url:(0,c.I)(E.uid)?void 0:`/dashboards/f/${E.uid}/`}))}async function f(d,h=1,p=i){const a=await(0,s.getGrafanaSearcher)().search({kind:["dashboard"],query:"*",location:d||"general",from:(h-1)*p,limit:p});return a.view.map(v=>{const E=(0,r.hI)(v,a.view);return E.parentUID===o.TF&&(E.parentUID=void 0),E})}},43907:(Q,A,e)=>{"use strict";e.d(A,{x:()=>c});var t=e(96540),n=e(70255),o=e(94753),s=e(42418),r=e(55314),g=e(44836);function u(i,l,f,d){const h=i+l+f+d,p=[];i&&p.push((0,g.t)("browse-dashboards.counts.folder","{{count}} folder",{count:i})),l&&p.push((0,g.t)("browse-dashboards.counts.dashboard","{{count}} dashboard",{count:l})),f&&p.push((0,g.t)("browse-dashboards.counts.libraryPanel","{{count}} library panel",{count:f})),d&&p.push((0,g.t)("browse-dashboards.counts.alertRule","{{count}} alert rule",{count:d}));let m=(0,g.t)("browse-dashboards.counts.total","{{count}} item",{count:h});return p.length>0&&(m+=`: ${p.join(", ")}`),m}const c=({selectedItems:i})=>{const{data:l,isFetching:f,isLoading:d,error:h}=(0,r.G2)(i);return t.createElement(t.Fragment,null,t.createElement(o.E,{element:"p",color:"secondary"},l&&u(l.folder,l.dashboard,l.libraryPanel,l.alertRule),(f||d)&&t.createElement(n.A,{width:200})),h&&t.createElement(s.F,{severity:"error",title:"Unable to retrieve descendant information"}))}},49952:(Q,A,e)=>{"use strict";e.d(A,{I:()=>o,e:()=>n});var t=e(32264);function n(s,r){return s+r.uid}function o(s){return s===t.$.sharedWithMeFolderUID}},36141:(Q,A,e)=>{"use strict";e.d(A,{Ii:()=>u,Zw:()=>r,bw:()=>g});var t=e(53477),n=e(80348),o=e(92955),s=e(93519);const r=(0,n.createAsyncThunk)("browseDashboards/refreshParents",async(c,{getState:i,dispatch:l})=>{const{browseDashboards:f}=i(),{rootItems:d,childrenByParentUID:h}=f,p=new Set;for(const m of c){const a=(0,s.R)(d?.items??[],h,m);p.add(a?.parentUID)}for(const m of p)l(g({parentUID:m,pageSize:o.md}))}),g=(0,n.createAsyncThunk)("browseDashboards/refetchChildren",async({parentUID:c,pageSize:i})=>{const l=c===t.TF?void 0:c;let f=1,d="folder",h=await(0,o.uT)(l,void 0,f,i),p=h.length<i;if(d==="folder"&&p){d="dashboard",f=1;const m=await(0,o.aw)(l,f,i);p=m.length<i,h=h.concat(m)}return{children:h,lastPageOfKind:p,page:f,kind:d}}),u=(0,n.createAsyncThunk)("browseDashboards/fetchNextChildrenPage",async({parentUID:c,excludeKinds:i=[],pageSize:l},f)=>{const d=!i.includes("dashboard"),h=c===t.TF?void 0:c,p=f.getState().browseDashboards,m=h?p.childrenByParentUID[h]:p.rootItems;let a=1,v;if(m?m.lastFetchedKind==="dashboard"&&!m.lastKindHasMoreItems?console.warn(`fetchNextChildrenPage called for ${h} but that collection is fully loaded`):m.lastFetchedKind==="folder"&&m.lastKindHasMoreItems?(a=m.lastFetchedPage+1,v="folder"):d&&(a=m.lastFetchedKind==="folder"?1:m.lastFetchedPage+1,v="dashboard"):(a=1,v="folder"),!v)return;let E=v==="folder"?await(0,o.uT)(h,void 0,a,l):await(0,o.aw)(h,a,l),D=E.length<l;if(v==="folder"&&D&&d){v="dashboard",a=1;const b=await(0,o.aw)(h,a,l);D=b.length<l,E=E.concat(b)}return{children:E,lastPageOfKind:D,page:a,kind:v}})},37690:(Q,A,e)=>{"use strict";e.d(A,{Am:()=>l,A4:()=>M,Ii:()=>n.Ii,bw:()=>n.bw,Zw:()=>n.Zw,ku:()=>i,cT:()=>t.cT,wn:()=>t.wn,t$:()=>t.t$,xK:()=>C,eC:()=>a,Ms:()=>D,V6:()=>b,q0:()=>v,QE:()=>E,Zg:()=>y});var t=e(79763),n=e(36141),o=e(96540),s=e(1081),r=e(80348),g=e(92955),u=e(49952),c=e(93519);const i=T=>T.browseDashboards.rootItems,l=T=>T.browseDashboards.childrenByParentUID,f=T=>T.browseDashboards.openFolders,d=T=>T.browseDashboards.selectedItems,h=(0,s.Mz)(i,l,f,(T,I)=>I,(T,I,x,S)=>M(S,T,I,x)),p=(0,s.Mz)(d,T=>Object.values(T).some(I=>Object.values(I).some(x=>x))),m=(0,s.Mz)(d,l,(T,I)=>{const x={dashboard:{...T.dashboard},folder:{...T.folder}};for(const S of Object.keys(T.folder))if(T.folder[S]){const P=I[S];if(P)for(const L of P.items)L.kind==="dashboard"&&(x.dashboard[L.uid]=!1),L.kind==="folder"&&(x.folder[L.uid]=!1)}return x});function a(T){return(0,r.useSelector)(I=>(T?I.browseDashboards.childrenByParentUID[T]:I.browseDashboards.rootItems)?"fulfilled":"pending")}function v(T){return(0,r.useSelector)(I=>h(I,T))}function E(){return(0,r.useSelector)(T=>p(T))}function D(){return(0,r.useSelector)(d)}function b(){return(0,r.useSelector)(T=>T.browseDashboards.childrenByParentUID)}function C(){return(0,r.useSelector)(T=>m(T))}function y(T=[]){const I=(0,r.useDispatch)(),x=(0,o.useRef)(!1);return(0,o.useCallback)(O=>{if(x.current)return Promise.resolve();x.current=!0;const P=I((0,n.Ii)({parentUID:O,excludeKinds:T,pageSize:g.md}));return P.finally(()=>x.current=!1),P},[I,T])}function M(T,I,x,S,O=0,P=[],L=[]){function U(G,_,K){if(P.includes(G.kind)||L.includes(G.uid))return[];const j=M(G.uid,I,x,S,K+1,P,L),k=!!S[G.uid],Y=x[G.uid]?.items.length===0;k&&Y&&!P.includes("empty-folder")&&j.push({isOpen:!1,level:K+1,item:{kind:"ui",uiKind:"empty-folder",uid:G.uid+"empty-folder"},parentUID:_});const ee={item:G,parentUID:_,level:K,isOpen:k},re=[ee,...j];return(0,u.I)(ee.item.uid)&&re.push({item:{kind:"ui",uiKind:"divider",uid:"shared-with-me-divider"},parentUID:_,level:K+1,isOpen:!1}),re}const R=T&&S[T]||O===0,B=T?x[T]:I;let w=((T?R&&B?.items:B?.items)||[]).flatMap(G=>U(G,T,O));const N=P.includes("dashboard")&&B?.lastFetchedKind==="dashboard";return(O===0&&!B||R&&B&&!(B.isFullyLoaded||N))&&(w=w.concat((0,c.T)(g.md,T,O))),w}},79763:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>b,cT:()=>D,wn:()=>v,t$:()=>E});var t={};e.r(t),e.d(t,{fetchNextChildrenPageFulfilled:()=>u,refetchChildrenFulfilled:()=>g,setAllSelection:()=>l,setFolderOpenState:()=>c,setItemSelectionState:()=>i});var n=e(30038),o=e(36141),s=e(49952),r=e(93519);function g(C,y){const{children:M,page:T,kind:I,lastPageOfKind:x}=y.payload,{parentUID:S}=y.meta.arg,O={items:M,lastFetchedKind:I,lastFetchedPage:T,lastKindHasMoreItems:!x,isFullyLoaded:I==="dashboard"&&x};S?C.childrenByParentUID[S]=O:C.rootItems=O}function u(C,y){const M=y.payload;if(!M)return;const{children:T,page:I,kind:x,lastPageOfKind:S}=M,{parentUID:O,excludeKinds:P=[]}=y.meta.arg,R={items:((O?C.childrenByParentUID[O]:C.rootItems)?.items??[]).concat(T),lastFetchedKind:x,lastFetchedPage:I,lastKindHasMoreItems:!S,isFullyLoaded:(P.includes("dashboard")||x==="dashboard")&&S};if(!O){C.rootItems=R;return}if(C.childrenByParentUID[O]=R,C.selectedItems.folder[O])for(const H of T)C.selectedItems[H.kind][H.uid]=!0}function c(C,y){const{folderUID:M,isOpen:T}=y.payload;C.openFolders[M]=T}function i(C,y){const{item:M,isSelected:T}=y.payload;if((0,s.I)(M.uid))return;function I(x,S){if(C.selectedItems[x][S]=T,x!=="folder")return;let O=C.childrenByParentUID[S];for(const P of O?.items??[])I(P.kind,P.uid)}if(I(M.kind,M.uid),!T){let x=M.parentUID;for(;x;){const S=(0,r.R)(C.rootItems?.items??[],C.childrenByParentUID,x);if(!S)break;C.selectedItems[S.kind][S.uid]=!1,x=S.parentUID}}C.selectedItems.$all=C.rootItems?.items?.every(x=>C.selectedItems[x.kind][x.uid])??!1}function l(C,y){const{isSelected:M,folderUID:T}=y.payload;if(!(T&&(0,s.I)(T)))if(C.selectedItems.$all=M,M){let x=function(S){if(S&&(0,s.I)(S))return;const O=S?C.childrenByParentUID[S]:C.rootItems;if(O)for(const P of O.items)(0,s.I)(P.uid)||(C.selectedItems[P.kind][P.uid]=M,P.kind==="folder"&&x(P.uid))};var I=x;x(T)}else for(const x in C.selectedItems){if(!(x==="dashboard"||x==="panel"||x==="folder"))continue;const S=C.selectedItems[x];for(const O in S)S[O]=M}}const{fetchNextChildrenPageFulfilled:f,refetchChildrenFulfilled:d,...h}=t,p={rootItems:void 0,childrenByParentUID:{},openFolders:{},selectedItems:{dashboard:{},folder:{},panel:{},$all:!1}},m=(0,n.Z0)({name:"browseDashboards",initialState:p,reducers:h,extraReducers:C=>{C.addCase(o.Ii.fulfilled,f),C.addCase(o.bw.fulfilled,d)}}),a=m.reducer,{setFolderOpenState:v,setItemSelectionState:E,setAllSelection:D}=m.actions,b={browseDashboards:a}},93519:(Q,A,e)=>{"use strict";e.d(A,{R:()=>t,T:()=>n});function t(o,s,r){for(const g of o)if(g.uid===r)return g;for(const g in s){const u=s[g];if(u){for(const c of u.items)if(c.uid===r)return c}}}function n(o,s,r){return new Array(o).fill(null).map((g,u)=>({parentUID:s,level:r,isOpen:!1,item:{kind:"ui",uiKind:"pagination-placeholder",uid:`${s}-pagination-${u}`}}))}},6320:(Q,A,e)=>{"use strict";e.d(A,{b:()=>n,q:()=>t});const t="connections",n={Base:`/${t}`,DataSources:`/${t}/datasources`,DataSourcesNew:`/${t}/datasources/new`,DataSourcesEdit:`/${t}/datasources/edit/:uid`,DataSourcesDashboards:`/${t}/datasources/edit/:uid/dashboards`,AddNewConnection:`/${t}/add-new-connection`,DataSourcesDetails:`/${t}/datasources/:id`,ConnectDataOutdated:`/${t}/connect-data`,YourConnectionsOutdated:`/${t}/your-connections`}},67023:(Q,A,e)=>{"use strict";e.d(A,{k:()=>r});var t=e(60455),n=e.n(t),o=e(91890),s=e(87490);const r=(g,u,c)=>{let i={},l={};if(g.type===o.CC.Regex&&g.expression){const f=new RegExp(g.expression,"gi"),h=(typeof u=="string"?u:(0,s.MA)(u)).matchAll(f);for(const p of h)p.groups?l=p.groups:l[g.mapValue||c]=p[1]||p[0]}else g.type===o.CC.Logfmt&&(l=n().parse(u));return Object.keys(l).forEach(f=>{const d=typeof l[f]=="string"?l[f]:(0,s.MA)(l[f]);i[f]={value:d}}),i}},40511:(Q,A,e)=>{"use strict";e.d(A,{F0:()=>c,bQ:()=>i,lW:()=>l});var t=e(41053),n=e(75505),o=e(19347),s=e(76888),r=e(18380);const g=({sourceUID:f,targetUID:d,...h})=>{const p=(0,o.l)().getInstanceSettings(f),m=(0,o.l)().getInstanceSettings(d);if((h?.orgId===void 0||h?.orgId===null||h?.orgId===0)&&r.kb.logWarning("Invalid correlation config: Missing org id."),p&&p?.uid!==void 0&&m&&m.uid!==void 0)return{...h,source:p,target:m};r.kb.logWarning("Invalid correlation config: Missing source or target.",{source:JSON.stringify(p),target:JSON.stringify(m)})},u=f=>!!f,c=f=>({...f,correlations:f.correlations.map(g).filter(u)});function i(f){return f.data}const l=()=>{const{backend:f}=(0,s.Il)(),[d,h]=(0,t.A)(b=>(0,n.s)(f.fetch({url:"/api/datasources/correlations",params:{page:b.page},method:"GET",showErrorAlert:!1})).then(i).then(c),[f]),[p,m]=(0,t.A)(({sourceUID:b,...C})=>f.post(`/api/datasources/uid/${b}/correlations`,C).then(y=>{const M=g(y.result);if(M!==void 0)return M;throw new Error("invalid sourceUID")}),[f]),[a,v]=(0,t.A)(({sourceUID:b,uid:C})=>f.delete(`/api/datasources/uid/${b}/correlations/${C}`),[f]),[E,D]=(0,t.A)(({sourceUID:b,uid:C,...y})=>f.patch(`/api/datasources/uid/${b}/correlations/${C}`,y).then(M=>{const T=g(M.result);if(T!==void 0)return T;throw new Error("invalid sourceUID")}),[f]);return{create:{execute:m,...p},update:{execute:D,...E},get:{execute:h,...d},remove:{execute:v,...a}}}},18380:(Q,A,e)=>{"use strict";e.d(A,{$q:()=>f,J6:()=>l,cA:()=>c,kb:()=>p,tZ:()=>h});var t=e(75505),n=e(91890),o=e(17172),s=e(19347),r=e(34867),g=e(9651),u=e(40511);const c=(m,a,v)=>(m.forEach(E=>{const D=E.refId;if(!D)return;let b=v[D];if(b===void 0&&E.meta?.preferredVisualisationType==="rawPrometheus"){const y=(0,g.a)(D);b=v[y]}const C=a.filter(y=>y.source.uid===b);i(E,C)}),m),i=(m,a)=>{m.fields.forEach(v=>{v.config.links=v.config.links?.filter(E=>E.origin!==n.x0.Correlations)||[],a.map(E=>{if(E.config?.field===v.name){const D=E.config?.target||{};v.config.links.push({internal:{query:{...D,datasource:{uid:E.target.uid}},datasourceUid:E.target.uid,datasourceName:E.target.name,transformations:E.config?.transformations},url:"",title:E.label||E.target.name,origin:n.x0.Correlations})}})})},l=async m=>(0,t.s)((0,o.AI)().fetch({url:"/api/datasources/correlations",method:"GET",showErrorAlert:!1,params:{sourceUID:m}})).then(u.bQ).then(u.F0),f=async(m,a)=>(0,o.AI)().post(`/api/datasources/uid/${m}/correlations`,a),d=async m=>m.datasourceInstance?.meta.mixed?await(0,s.l)().get(m.queries[0].datasource):m.datasourceInstance,h=async(m,a)=>Promise.all([d(m),d(a)]).then(v=>v[0]?.name!==void 0&&v[1]?.name!==void 0?`${v[0]?.name} to ${v[1]?.name}`:""),p=(0,r.DW)("features.correlations")},41524:(Q,A,e)=>{"use strict";e.d(A,{W:()=>o});var t=e(11261);function n(){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZ",r="abcdefghijklmnopqrstuvwxyz",g=s.length,u=new Map;return c=>{const i=u.get(c);if(i!=null)return i;const l=[...c].map(f=>f.toLowerCase()&&f!==f.toUpperCase()?r.charAt(Math.floor(Math.random()*g)):f.toUpperCase()&&f!==f.toUpperCase()?s.charAt(Math.floor(Math.random()*g)):f).join("");return u.set(c,l),l}}function o(s,r){if(!(r.labels||r.names||r.values))return s;const g=new Set(["time","value","exemplar","traceid","id","uid","uuid","__name__","le","name"]),u=n();return s.map(c=>{let{schema:i,data:l}=c;if(i&&l){if(r.labels){for(const f of i.fields)if(f.labels){const d={};for(const[h,p]of Object.entries(f.labels))d[h]=u(p);f.labels=d}}if(r.names)for(const f of i.fields)f.name?.length&&!g.has(f.name.toLowerCase())&&(f.name=u(f.name));r.values&&i.fields.forEach((f,d)=>{if(f.type===t.PU.string&&l){const h=l.values[d].map(p=>u(String(p)));l.values[d]=h}})}return{schema:i,data:l}})}},72255:(Q,A,e)=>{"use strict";e.d(A,{m6:()=>m,sP:()=>E});var t=e(71733),n=e(17172),o=e(12131),s=e(82467),r=e(2619),g=e(27677),u=e(17493),c=e(14792),i=e(71101),l=e(99140),f=e(80348),d=e(71176),h=e(64468);const p=500,m="__grafana_home_uid__";class a extends r.Q{constructor(){super(...arguments),this.cache={}}async fetchDashboard({uid:b,route:C,urlFolderUid:y}){const M=C===f.DashboardRoutes.Home?m:b,T=this.getFromCache(M);if(T)return T;let I;try{switch(C){case f.DashboardRoutes.New:I=(0,d.X)(y);break;case f.DashboardRoutes.Home:if(I=await(0,n.AI)().get("/api/dashboards/home"),I?.redirectUri){const x=t.I.stripBaseFromUrl(I.redirectUri);return o.Ny.replace(x),null}I?.meta&&(I.meta.canSave=!1,I.meta.canShare=!1,I.meta.canStar=!1);break;default:I=await u.np.loadDashboard("db","",b),C===f.DashboardRoutes.Embedded&&(I.meta.isEmbedded=!0)}if(I.meta.url&&C!==f.DashboardRoutes.Embedded){const x=t.I.stripBaseFromUrl(I.meta.url),S=o.Ny.getLocation().pathname;x!==S&&(o.Ny.replace({...o.Ny.getLocation(),pathname:x}),console.log("not correct url correcting",x,S))}await this.initNavModel(I),this.dashboardCache={dashboard:I,ts:Date.now(),cacheKey:M}}catch(x){if((0,n.NF)(x)&&x.cancelled)return null;throw console.error(x),x}return I}async loadSnapshot(b){try{const C=await this.loadSnapshotScene(b);this.setState({dashboard:C,isLoading:!1})}catch(C){this.setState({isLoading:!1,loadError:String(C)})}}async loadSnapshotScene(b){const C=await u.np.loadDashboard("snapshot",b,"");if(C?.dashboard)return(0,h.wM)(C);throw new Error("Snapshot not found")}async loadDashboard(b){try{const C=await this.loadScene(b);C.startUrlSync(),this.setState({dashboard:C,isLoading:!1})}catch(C){this.setState({isLoading:!1,loadError:String(C)})}}async loadScene(b){const C=await this.fetchDashboard(b),y=this.cache[b.uid];if(y&&y.state.version===C?.dashboard.version)return y;if(this.setState({isLoading:!0}),C?.dashboard){const M=(0,h.wM)(C);return b.uid&&(this.cache[b.uid]=M),M}throw new Error("Dashboard not found")}getFromCache(b){const C=this.dashboardCache;return C&&C.cacheKey===b&&Date.now()-C?.ts<p?C.dashboard:null}async initNavModel(b){if(b.meta.folderUid)try{const C=await g.IB.getFolderByUid(b.meta.folderUid);l.M_.dispatch((0,s.Vz)((0,i.R4)(C)))}catch(C){console.warn("Error fetching parent folder",b.meta.folderUid,"for dashboard",C)}}clearState(){(0,c.UA)().setCurrent(void 0),this.setState({dashboard:void 0,loadError:void 0,isLoading:!1,panelEditor:void 0})}setDashboardCache(b,C){this.dashboardCache={dashboard:C,ts:Date.now(),cacheKey:b}}clearDashboardCache(){this.dashboardCache=void 0}}let v=null;function E(){return v||(v=new a({})),v}},79280:(Q,A,e)=>{"use strict";e.d(A,{p:()=>c});var t=e(96540),n=e(13544),o=e(90613),s=e(67061),r=e(94753),g=e(55852),u=e(44836);function c(i){return t.createElement(o.a,{alignItems:"center",padding:4},t.createElement(s.B,{direction:"column",alignItems:"center",gap:2},t.createElement(r.E,{element:"h3",textAlignment:"center"},t.createElement(u.x6,{key:"transformations.empty.add-transformation-header"},"Start transforming data")),t.createElement(r.E,{element:"p",textAlignment:"center","data-testid":n.Tp.components.Transforms.noTransformationsMessage},t.createElement(u.x6,{key:"transformations.empty.add-transformation-body"},"Transformations allow data to be changed in various ways before your visualization is shown.",t.createElement("br",null),"This includes joining data together, renaming fields, making calculations, formatting data for display, and more.")),t.createElement(g.$n,{icon:"plus",variant:"primary",size:"md",onClick:i.onShowPicker,"data-testid":n.Tp.components.Transforms.addTransformationButton},"Add transformation")))}},91309:(Q,A,e)=>{"use strict";e.d(A,{C:()=>b,S:()=>C});var t=e(65474),n=e(81160),o=e(52622),s=e(43585),r=e(39070),g=e(14236),u=e(17172),c=e(32264),i=e(79065),l=e(82467),f=e(3169),d=e(10096),h=e(94954),p=e(55740),m=e(23662),a=e(99140),v=e(80348),E=e(94822),D=e(74730);class b extends i.VE{constructor(M){super({isEnabled:!0,...M,isHidden:!0}),this.hasAlertRules=!0,this.topic=o.QR.AlertStates,this.handleError=T=>{const I=(0,f.gi)("AlertStatesDataLayer",(0,h.q)(T));(0,a.JD)((0,l.dx)(I))}}onEnable(){const M=i.jh.getTimeRange(this);this._timeRangeSub=M.subscribeToState(()=>{this.runWithTimeRange(M)})}onDisable(){this._timeRangeSub?.unsubscribe()}runLayer(){const M=i.jh.getTimeRange(this);this.runWithTimeRange(M)}async runWithTimeRange(M){const T=(0,D.YQ)(this),{uid:I,id:x}=T.state;if(this.querySub&&this.querySub.unsubscribe(),!this.canWork(M))return;let S;this.isUsingLegacyAlerting()?S=(0,t.H)((0,u.AI)().get("/api/alerts/states-for-dashboard",{dashboardId:x},`dashboard-query-runner-alert-states-${x}`)).pipe((0,n.T)(O=>O)):S=(0,t.H)((0,u.AI)().get("/api/prometheus/grafana/api/v1/rules",{dashboard_uid:I},`dashboard-query-runner-unified-alert-states-${x}`)).pipe((0,n.T)(O=>{if(O.status==="success"){this.hasAlertRules=!1;const P={};return O.data.groups.forEach(L=>L.rules.forEach(U=>{if((0,m.Z8)(U)&&U.annotations&&U.annotations[p.YH.panelID]){this.hasAlertRules=!0;const R=Number(U.annotations[p.YH.panelID]),B=C(U.state);P[R]?B===s.O.Alerting&&P[R].state!==s.O.Alerting?P[R].state=s.O.Alerting:B===s.O.Pending&&P[R].state!==s.O.Alerting&&P[R].state!==s.O.Pending&&(P[R].state=s.O.Pending):P[R]={state:B,id:Object.keys(P).length,panelId:R,dashboardId:x}}})),Object.values(P)}throw new Error("Unexpected alert rules response.")})),this.querySub=S.subscribe({next:O=>{this.publishResults({state:r.Gu.Done,series:[(0,g.Vc)(O)],timeRange:M.state.value},o.QR.AlertStates)},error:O=>{this.handleError(O),this.publishResults({state:r.Gu.Error,series:[],errors:[{message:(0,h.q)(O)}],timeRange:M.state.value},o.QR.AlertStates)}})}canWork(M){const T=(0,D.YQ)(this),{uid:I,id:x}=T.state;return this.isUsingLegacyAlerting()?!(!x||M.state.value.raw.to!=="now"):!(!I||c.$.publicDashboardAccessToken||M.state.value.raw.to!=="now"||this.hasAlertRules===!1||!(d.TP.hasPermission(v.AccessControlAction.AlertingRuleRead)&&d.TP.hasPermission(v.AccessControlAction.AlertingRuleExternalRead)))}isUsingLegacyAlerting(){return!c.$.unifiedAlertingEnabled}}function C(y){return y===E.cF.Firing?s.O.Alerting:y===E.cF.Pending?s.O.Pending:s.O.OK}},38477:(Q,A,e)=>{"use strict";e.d(A,{g:()=>u});var t=e(43127),n=e(33948),o=e(52622),s=e(32264),r=e(79065),g=e(90569);class u extends r.tV.g{async resolveDataSource(i){return s.$.publicDashboardAccessToken?new g.X:super.resolveDataSource(i)}processEvents(i,l){if(s.$.publicDashboardAccessToken){const f={series:[],timeRange:(0,t.E2)(),state:l.state},d=(0,n.I)(l.events);return d.meta={...d.meta,dataTopic:o.QR.Annotations},f.annotations=[d],f}else return super.processEvents(i,l)}}},48548:(Q,A,e)=>{"use strict";e.d(A,{x:()=>r});var t=e(96540),n=e(79065),o=e(67061),s=e(90613);class r extends n.Bs{}r.Component=g;function g({model:u}){const{variableControls:c,linkControls:i,timeControls:l,hideTimeControls:f}=u.useState();return t.createElement(o.B,{grow:1,direction:{md:"row",xs:"column"}},t.createElement(o.B,{grow:1,wrap:"wrap"},c.map(d=>t.createElement(d.Component,{model:d,key:d.state.key})),t.createElement(s.a,{grow:1}),t.createElement(i.Component,{model:i})),t.createElement(o.B,{justifyContent:"flex-end"},!f&&l.map(d=>t.createElement(d.Component,{model:d,key:d.state.key}))))}},36043:(Q,A,e)=>{"use strict";e.d(A,{H$:()=>Ti});var t=e(71733),n=e(26272),o=e(41987),s=e(12131),r=e(79065),g=e(28138),u=e(15054),c=e(17422),i=e(33390),l=e(14792),f=e(34214),d=e(6473),h=e(80484),p=e(28444),m=e(96540),a=e(63021),v=e(40675),E=e(87978),D=e(54943),b=e(49785),C=e(55852),y=e(42418),M=e(67061),T=e(88575),I=e(10354),x=e(21744),S=e(15292),O=e(90613),P=e(60029),L=e(70096),U=e(71500),R=e(13544),B=e(17172);function H(Oe){return(0,B.NF)(Oe)&&Oe.data&&Oe.data.status==="version-mismatch"}function w(Oe){return(0,B.NF)(Oe)&&Oe.data&&Oe.data.status==="name-exists"}function N(Oe){return(0,B.NF)(Oe)&&Oe.data&&Oe.data.status==="plugin-dashboard"}function V({cancelButton:Oe,saveButton:Ie}){return m.createElement(y.F,{title:"Name already exists",severity:"error"},m.createElement("p",null,"A dashboard with the same name in selected folder already exists. Would you still like to save this dashboard?"),m.createElement(O.a,{paddingTop:2},m.createElement(M.B,{alignItems:"center"},Oe,Ie(!0))))}function G({overwrite:Oe,isLoading:Ie,isValid:je,onSave:lt}){return m.createElement(C.$n,{disabled:!je||Ie,icon:Ie?"spinner":void 0,"aria-label":R.Tp.pages.SaveDashboardModal.save,onClick:()=>lt(Oe),variant:Oe?"destructive":"primary"},Ie?"Saving...":Oe?"Save and overwrite":"Save")}var _=e(41053),K=e(14110),j=e(3169),k=e(91219),Y=e(55314),ee=e(80348),re=e(36974);function J(Oe=!1){const Ie=(0,ee.useDispatch)(),je=(0,j._2)(),[lt]=(0,Y.e8)(),[bt,Ft]=(0,_.A)(async(Kt,ln,an)=>{{const Ut=await lt({dashboard:ln,folderUid:an.folderUid,message:an.message,overwrite:an.overwrite,showErrorAlert:!1});if("error"in Ut)throw Ut.error;const Un=Ut.data;Kt.saveCompleted(ln,Un,an.folderUid),g.A.publish(new p.Eu),je.success("Dashboard saved"),(0,re.ko)(Un.uid),Oe?(0,K.rR)("grafana_dashboard_copied",{name:ln.title,url:Un.url}):(0,K.rR)(`grafana_dashboard_${Un.uid?"saved":"created"}`,{name:ln.title,url:Un.url});const Nn=s.Ny.getLocation(),Pa=t.I.stripBaseFromUrl(Un.url);return Pa!==Nn.pathname&&setTimeout(()=>{Kt.stopUrlSync(),s.Ny.push({pathname:Pa,search:Nn.search}),Kt.startUrlSync()}),Kt.state.meta.isStarred&&Ie((0,k.TU)({id:Un.uid,title:Kt.state.title,url:Pa})),Ut.data}},[Ie,je]);return{state:bt,onSaveDashboard:Ft}}function ne({dashboard:Oe,drawer:Ie,changeInfo:je}){const{changedSaveModel:lt}=je,{register:bt,handleSubmit:Ft,setValue:Kt,formState:ln,getValues:an,watch:Ut}=(0,b.mN)({mode:"onBlur",defaultValues:{title:je.isNew?lt.title:`${lt.title} Copy`,description:lt.description??"",folder:{uid:Oe.state.meta.folderUid,title:Oe.state.meta.folderTitle},copyTags:!1}}),{errors:Un,isValid:Nn,defaultValues:Pa}=ln,qn=Ut(),{state:Wa,onSaveDashboard:ls}=J(!1),fs=async La=>{const js=an(),rl=ue(lt,js,je.isNew);(await ls(Oe,rl,{overwrite:La,folderUid:js.folder.uid})).status==="success"&&Oe.closeModal()},ms=m.createElement(C.$n,{variant:"secondary",onClick:()=>Oe.closeModal(),fill:"outline"},"Cancel"),tr=La=>m.createElement(G,{isValid:Nn,isLoading:Wa.loading,onSave:fs,overwrite:La});function Bs(La){return w(La)?m.createElement(V,{cancelButton:ms,saveButton:tr}):m.createElement(m.Fragment,null,La&&m.createElement(y.F,{title:"Failed to save dashboard",severity:"error"},m.createElement("p",null,La.message)),m.createElement(M.B,{alignItems:"center"},ms,tr(!1)))}return m.createElement("form",{onSubmit:Ft(()=>fs(!1))},m.createElement(T.D,{label:m.createElement(q,{dashboard:lt,onChange:Kt}),invalid:!!Un.title,error:Un.title?.message},m.createElement(I.p,{...bt("title",{required:"Required",validate:oe}),"aria-label":"Save dashboard title field",autoFocus:!0})),m.createElement(T.D,{label:m.createElement(te,{dashboard:lt,onChange:Kt}),invalid:!!Un.description,error:Un.description?.message},m.createElement(x.f,{...bt("description",{required:!1}),"aria-label":"Save dashboard description field",autoFocus:!0})),m.createElement(T.D,{label:"Folder"},m.createElement(L.d,{onChange:(La,js)=>Kt("folder",{uid:La,title:js}),value:qn.folder?.uid,initialTitle:Pa.folder.title,dashboardId:lt.id??void 0,enableCreateNew:!0})),!je.isNew&&m.createElement(T.D,{label:"Copy tags"},m.createElement(S.d,{...bt("copyTags")})),m.createElement(O.a,{paddingTop:2},Bs(Wa.error)))}function q(Oe){return m.createElement(M.B,{justifyContent:"space-between"},m.createElement(P.J,{htmlFor:"description"},"Title"))}function te(Oe){return m.createElement(M.B,{justifyContent:"space-between"},m.createElement(P.J,{htmlFor:"description"},"Description"))}async function oe(Oe,Ie){if(Oe===Ie.folder.title?.trim())return"Dashboard name cannot be the same as folder name";try{return await U.P.validateNewDashboardName(Ie.folder.uid??"general",Oe),!0}catch(je){return je instanceof Error?je.message:"Dashboard name is invalid"}}function ue(Oe,Ie,je){return{...Oe,id:null,uid:"",title:Ie.title,description:Ie.description,tags:je||Ie.copyTags?Oe.tags:[]}}var ie=e(10880);function ge({dashboard:Oe,drawer:Ie,changeInfo:je}){const{changedSaveModel:lt,hasChanges:bt}=je,{state:Ft,onSaveDashboard:Kt}=J(!1),[ln,an]=(0,m.useState)({folderUid:Oe.state.meta.folderUid}),Ut=async qn=>{(await Kt(Oe,lt,{...ln,overwrite:qn})).status==="success"&&Oe.closeModal()},Un=m.createElement(C.$n,{variant:"secondary",onClick:()=>Oe.closeModal(),fill:"outline"},"Cancel"),Nn=qn=>m.createElement(G,{isValid:bt,isLoading:Ft.loading,onSave:Ut,overwrite:qn});function Pa(qn){return H(qn)?m.createElement(y.F,{title:"Someone else has updated this dashboard",severity:"error"},m.createElement("p",null,"Would you still like to save this dashboard?"),m.createElement(O.a,{paddingTop:2},m.createElement(M.B,{alignItems:"center"},Un,Nn(!0)))):w(qn)?m.createElement(V,{cancelButton:Un,saveButton:Nn}):N(qn)?m.createElement(y.F,{title:"Plugin dashboard",severity:"error"},m.createElement("p",null,"Your changes will be lost when you update the plugin. Use ",m.createElement("strong",null,"Save As")," to create custom version."),m.createElement(O.a,{paddingTop:2},m.createElement(M.B,{alignItems:"center"},Un,Nn(!0)))):m.createElement(m.Fragment,null,qn&&m.createElement(y.F,{title:"Failed to save dashboard",severity:"error"},m.createElement("p",null,qn.message)),m.createElement(M.B,{alignItems:"center"},Un,Nn(!1),!bt&&m.createElement("div",null,"No changes to save")))}return m.createElement(M.B,{gap:0,direction:"column"},m.createElement(he,{drawer:Ie,changeInfo:je}),m.createElement(T.D,{label:"Message"},m.createElement(x.f,{"aria-label":"message",value:ln.message??"",onChange:qn=>{an({...ln,message:qn.currentTarget.value})},placeholder:"Add a note to describe your changes (optional).",autoFocus:!0,rows:5})),m.createElement(O.a,{paddingTop:2},Pa(Ft.error)))}function he({drawer:Oe,changeInfo:Ie}){const{saveVariables:je=!1,saveTimeRange:lt=!1}=Oe.useState(),{hasTimeChanges:bt,hasVariableValueChanges:Ft}=Ie;return m.createElement(m.Fragment,null,bt&&m.createElement(T.D,{label:"Update default time range",description:"Will make current time range the new default"},m.createElement(ie.S,{id:"save-timerange",checked:lt,onChange:Oe.onToggleSaveTimeRange,"aria-label":R.Tp.pages.SaveDashboardModal.saveTimerange})),Ft&&m.createElement(T.D,{label:"Update default variable values",description:"Will make the current values the new default"},m.createElement(ie.S,{id:"save-variables",checked:je,onChange:Oe.onToggleSaveVariables,"aria-label":R.Tp.pages.SaveDashboardModal.saveVariables})))}var De=e(32196),pe=e(4213),le=e.n(pe),Te=e(70713),Ee=e(32372),Re=e(10534);function me({dashboard:Oe,drawer:Ie,changeInfo:je}){const lt=(0,m.useMemo)(()=>JSON.stringify(je.changedSaveModel,null,2),[je]),bt=(0,m.useCallback)(()=>{const Ft=new Blob([lt],{type:"application/json;charset=utf-8"});(0,pe.saveAs)(Ft,je.changedSaveModel.title+"-"+new Date().getTime()+".json")},[je.changedSaveModel,lt]);return m.createElement("div",{className:Me.container},m.createElement(M.B,{direction:"column",gap:2,grow:1},m.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.",m.createElement("br",null),m.createElement("i",null,"See"," ",m.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."),m.createElement("br",null)," ",m.createElement("br",null),m.createElement("strong",null,"File path: ")," ",Oe.state.meta.provisionedExternalId),m.createElement(M.B,{direction:"column",gap:0},m.createElement(he,{drawer:Ie,changeInfo:je})),m.createElement("div",{className:Me.json},m.createElement(Te.Ay,{disableWidth:!0},({height:Ft})=>m.createElement(Ee.B,{width:"100%",height:Ft,language:"json",showLineNumbers:!0,showMiniMap:lt.length>100,value:lt,readOnly:!0}))),m.createElement(O.a,{paddingTop:2},m.createElement(M.B,{gap:2},m.createElement(C.$n,{variant:"secondary",onClick:Ie.onClose,fill:"outline"},"Cancel"),m.createElement(Re.b,{icon:"copy",getText:()=>lt},"Copy JSON to clipboard"),m.createElement(C.$n,{type:"submit",onClick:bt},"Save JSON to file")))))}const Me={container:(0,De.css)({height:"100%",display:"flex"}),json:(0,De.css)({flexGrow:1,maxHeight:"800px"})};var ye=e(2543),Le=e(56555),We=e(56596);function Be(Oe,Ie,je){const lt=Oe.getInitialSaveModel();Oe.state.editPanel&&Oe.state.editPanel.commitChanges();const bt=(0,Le.Uy)(Oe),Ft=Ye(bt,lt),Kt=at(bt,lt,je);Ie||(bt.time=lt.time);const ln=(0,We.G4)(lt,bt);let an=0;for(const Ut of Object.values(ln))an+=Ut.length;return{changedSaveModel:bt,initialSaveModel:lt,diffs:ln,diffCount:an,hasChanges:an>0,hasTimeChanges:Ft,isNew:bt.version===0,hasVariableValueChanges:Kt}}function Ye(Oe,Ie){return Oe.time?.from!==Ie.time?.from||Oe.time?.to!==Ie.time?.to}function at(Oe,Ie,je){const lt=Ie.templating?.list??[],bt=Oe.templating?.list??[];let Ft=!1;for(const Kt of bt){const ln=lt.find(({name:an,type:Ut})=>an===Kt.name&&Ut===Kt.type);if(ln&&(ln.current&&Object.hasOwn(ln.current,"selected")&&delete ln.current.selected,(0,ye.isEqual)(Kt.current,ln.current)||(Ft=!0),!je)){const an=Kt;an.type==="adhoc"?an.filters=ln.filters:(Kt.current=ln.current,Kt.options=ln.options)}}return Ft}class st extends r.Bs{constructor(){super(...arguments),this.onClose=()=>{this.state.dashboardRef.resolve().setState({overlay:void 0})},this.onToggleSaveTimeRange=()=>{this.setState({saveTimeRange:!this.state.saveTimeRange})},this.onToggleSaveVariables=()=>{this.setState({saveVariables:!this.state.saveVariables})}}}st.Component=({model:Oe})=>{const{showDiff:Ie,saveAsCopy:je,saveTimeRange:lt,saveVariables:bt}=Oe.useState(),Ft=Be(Oe.state.dashboardRef.resolve(),lt,bt),{changedSaveModel:Kt,initialSaveModel:ln,diffs:an,diffCount:Ut}=Ft,Un=Oe.state.dashboardRef.resolve(),Nn=Un.state.meta.provisioned,Pa=m.createElement(a.U,null,m.createElement(v.o,{label:"Details",active:!Ie,onChangeTab:()=>Oe.setState({showDiff:!1})}),Ut>0&&m.createElement(v.o,{label:"Changes",active:Ie,onChangeTab:()=>Oe.setState({showDiff:!0}),counter:Ut}));let qn="Save dashboard";je?qn="Save dashboard copy":Nn&&(qn="Provisioned dashboard");const Wa=()=>Ie?m.createElement(D.l,{diff:an,oldValue:ln,newValue:Kt}):je||Ft.isNew?m.createElement(ne,{dashboard:Un,changeInfo:Ft,drawer:Oe}):Nn?m.createElement(me,{dashboard:Un,changeInfo:Ft,drawer:Oe}):m.createElement(ge,{dashboard:Un,changeInfo:Ft,drawer:Oe});return m.createElement(E._,{title:qn,subtitle:Un.state.title,onClose:Oe.onClose,tabs:Pa},Wa())};var Ke=e(24180),Xe=e(64388),He=e(40845),Ge=e(40276),xe=e(36830),$e=e(68064),be=e(15068),Z=e(27746),ae=e(14578),de=e(38138),ve=e(19727),Ue=e(83122),_e=e(75269),ze=e(10804),Ve=e(10096),Ne=e(44836),ot=e(58441),nt=e(7758),pt=e(99246),mt=e(40672),gt=e(32264),Pt=e(96374);function Mt(Oe){return m.createElement(Z.I,{key:"button-snapshot","data-testid":"button-snapshot",tooltip:(0,Ne.t)("dashboard.toolbar.open-original","Open original dashboard"),icon:"link",onClick:()=>Yt(Oe.originalURL)})}const Yt=Oe=>{const Ie=Oe??"",je=mt.sQ.sanitizeUrl(Ie);try{const lt=new URL(je,gt.$.appUrl),bt=new URL(gt.$.appUrl);lt.host!==bt.host?g.A.publish(new p.S8({component:Pt.u,props:{title:"Proceed to external site?",modalClass:(0,De.css)({width:"max-content",maxWidth:"80vw"}),body:m.createElement(m.Fragment,null,m.createElement("p",null,"This link connects to an external website at"," ",m.createElement("code",null,Ie)),m.createElement("p",null,"Are you sure you'd like to proceed?")),confirmVariant:"primary",confirmText:"Proceed",onConfirm:()=>{window.location.href=lt.href}}})):s.Ny.push(je)}catch(lt){console.error("Failed to open original dashboard",lt)}},zt=m.memo(({dashboard:Oe})=>{const Ie=m.createElement(be.U,{alignment:"right"},m.createElement(_t,{dashboard:Oe}));return m.createElement(_e.H,{actions:Ie})});zt.displayName="NavToolbarActions";function _t({dashboard:Oe}){const{isEditing:Ie,viewPanelScene:je,isDirty:lt,uid:bt,meta:Ft,editview:Kt,editPanel:ln}=Oe.useState(),an=Ve.TP.hasEditPermissionInFolders,Ut=[],Un=(0,He.of)(rt),Nn=!!ln,Pa=!!je;Ut.push({group:"icon-actions",condition:bt&&!Kt&&!!Ft.canStar&&!Nn,render:()=>{let ls=Ft.isStarred?(0,Ne.t)("dashboard.toolbar.unmark-favorite","Unmark as favorite"):(0,Ne.t)("dashboard.toolbar.mark-favorite","Mark as favorite");return m.createElement(Z.I,{tooltip:ls,icon:m.createElement(ae.I,{name:Ft.isStarred?"favorite":"star",size:"lg",type:Ft.isStarred?"mono":"default"}),key:"star-dashboard-button",onClick:()=>{nt.c.toolbarFavoritesClick(),Oe.onStarDashboard()}})}}),Ut.push({group:"icon-actions",condition:bt&&!Kt&&!Nn,render:()=>m.createElement(Z.I,{key:"view-in-old-dashboard-button",tooltip:"Switch to old dashboard page",icon:"apps",onClick:()=>{Ft.isSnapshot?s.Ny.partial({scenes:null}):s.Ny.push(`/d/${bt}`)}})}),Ut.push({group:"icon-actions",condition:Ft.isSnapshot&&!Ie,render:()=>m.createElement(Mt,{originalURL:Oe.getInitialSaveModel()?.snapshot?.originalUrl??""})}),pt.C.left.length>0&&!Nn&&pt.C.left.map((ls,fs)=>{const ms={dashboard:(0,l.UA)().getCurrent()};if(ls.show(ms)){const tr=ls.component;Ut.push({group:"icon-actions",condition:!0,render:()=>m.createElement(tr,{...ms})})}}),Ut.push({group:"back-button",condition:Pa||Nn,render:()=>m.createElement(C.$n,{onClick:()=>{s.Ny.partial({viewPanel:null,editPanel:null})},tooltip:"",key:"back",variant:"secondary",size:"sm",icon:"arrow-left"},"Back to dashboard")}),Ut.push({group:"back-button",condition:!!Kt,render:()=>m.createElement(C.$n,{onClick:()=>{s.Ny.partial({editview:null})},tooltip:"",key:"back",fill:"text",variant:"secondary",size:"sm",icon:"arrow-left"},"Back to dashboard")}),Ut.push({group:"main-buttons",condition:bt&&!Ie&&!Ft.isSnapshot,render:()=>m.createElement(C.$n,{key:"share-dashboard-button",tooltip:(0,Ne.t)("dashboard.toolbar.share","Share dashboard"),size:"sm",className:Un,fill:"outline",onClick:()=>{nt.c.toolbarShareClick(),Oe.showModal(new ot.Z({dashboardRef:Oe.getRef()}))}},"Share")}),Ut.push({group:"main-buttons",condition:!Ie&&Oe.canEditDashboard()&&!Pa&&!Nn,render:()=>m.createElement(C.$n,{onClick:()=>{Oe.onEnterEditMode()},tooltip:"Enter edit mode",key:"edit",className:Un,variant:"primary",size:"sm"},"Edit")}),Ut.push({group:"settings",condition:Ie&&Oe.canEditDashboard()&&!Pa&&!Nn&&!Kt,render:()=>m.createElement(C.$n,{onClick:()=>{Oe.onOpenSettings()},tooltip:"Dashboard settings",fill:"text",size:"sm",key:"settings",variant:"secondary"},"Settings")}),Ut.push({group:"main-buttons",condition:Ie&&!Kt&&!Ft.isNew&&!Pa&&!Nn,render:()=>m.createElement(C.$n,{onClick:()=>Oe.exitEditMode({skipConfirm:!1}),tooltip:"Exits edit mode and discards unsaved changes",size:"sm",key:"discard",fill:"text",variant:"primary"},"Exit edit")}),Ut.push({group:"main-buttons",condition:Nn&&!Kt&&!Ft.isNew&&!Pa,render:()=>m.createElement(C.$n,{onClick:ln?.onDiscard,tooltip:"Discard panel changes",size:"sm",key:"discard",fill:"outline",variant:"destructive"},"Discard panel changes")}),Ut.push({group:"main-buttons",condition:Ie&&(Ft.canSave||an),render:()=>{if(Ft.isNew)return m.createElement(C.$n,{onClick:()=>{nt.c.toolbarSaveClick(),Oe.openSaveDrawer({})},className:Un,tooltip:"Save changes",key:"save",size:"sm",variant:"primary"},"Save dashboard");if(an&&!Ft.canSave)return m.createElement(C.$n,{onClick:()=>{nt.c.toolbarSaveClick(),Oe.openSaveDrawer({saveAsCopy:!0})},className:Un,tooltip:"Save as copy",key:"save",size:"sm",variant:lt?"primary":"secondary"},"Save as copy");const ls=m.createElement(de.W,null,m.createElement(de.W.Item,{label:"Save",icon:"save",onClick:()=>{nt.c.toolbarSaveClick(),Oe.openSaveDrawer({})}}),m.createElement(de.W.Item,{label:"Save as copy",icon:"copy",onClick:()=>{nt.c.toolbarSaveAsClick(),Oe.openSaveDrawer({saveAsCopy:!0})}}));return m.createElement(ve.e,{className:Un,key:"save"},m.createElement(C.$n,{onClick:()=>{nt.c.toolbarSaveClick(),Oe.openSaveDrawer({})},tooltip:"Save changes",size:"sm",variant:lt?"primary":"secondary"},"Save dashboard"),m.createElement(Ue.m,{overlay:ls},m.createElement(C.$n,{icon:"angle-down",variant:lt?"primary":"secondary",size:"sm"})))}});const qn=[];let Wa="";for(const ls of Ut)ls.condition&&(Wa&&Wa!==ls.group&&Wa&&qn.push(m.createElement(ze.K,{key:`${ls.group}-separator`})),qn.push(ls.render()),Wa=ls.group);return qn}function rt(Oe){return(0,De.css)({margin:Oe.spacing(0,.5)})}function It({model:Oe}){const{controls:Ie,overlay:je,editview:lt,editPanel:bt}=Oe.useState(),Ft=(0,He.of)(Dn),Kt=(0,Ke.zy)(),ln=(0,ee.useSelector)(Wa=>Wa.navIndex),an=Oe.getPageNav(Kt,ln),Ut=Oe.getBodyToRender(),Un=(0,c.tc)(ln,"dashboards/browse"),Nn=Kt.search.includes("scene-debugger");if(lt)return m.createElement(m.Fragment,null,m.createElement(lt.Component,{model:lt}),je&&m.createElement(je.Component,{model:je}));const Pa=m.createElement(m.Fragment,null,m.createElement("div",{className:Ft.controls},Nn&&m.createElement(r.or,{scene:Oe,key:"scene-debugger"})),m.createElement($e.A,{dashboard:Oe,canCreate:!!Oe.state.meta.canEdit})),qn=m.createElement(m.Fragment,null,Ie&&m.createElement("div",{className:Ft.controls},Ie.map(Wa=>m.createElement(Wa.Component,{key:Wa.state.key,model:Wa})),Nn&&m.createElement(r.or,{scene:Oe,key:"scene-debugger"})),m.createElement("div",{className:(0,De.cx)(Ft.body)},m.createElement(Ut.Component,{model:Ut})));return m.createElement(xe.Y,{navModel:Un,pageNav:an,layout:Xe.k.Custom},bt&&m.createElement(bt.Component,{model:bt}),!bt&&m.createElement(Ge.E,{autoHeightMin:"100%"},m.createElement("div",{className:Ft.canvasContent},m.createElement(zt,{dashboard:Oe}),Oe.isEmpty()?Pa:qn)),je&&m.createElement(je.Component,{model:je}))}function Dn(Oe){return{canvasContent:(0,De.css)({label:"canvas-content",display:"flex",flexDirection:"column",padding:Oe.spacing(0,2),flexBasis:"100%",flexGrow:1}),body:(0,De.css)({label:"body",flexGrow:1,display:"flex",gap:"8px",marginBottom:Oe.spacing(2)}),controls:(0,De.css)({display:"flex",flexWrap:"wrap",alignItems:"center",gap:Oe.spacing(1),position:"sticky",top:0,background:Oe.colors.background.canvas,zIndex:Oe.zIndex.activePanel,padding:Oe.spacing(2,0),marginLeft:"auto"})}}var ft=e(64468),yt=e(57714),jt=e(64423),cn=e(18226),pn=e(94624),on=e(72724),Xt=e(3591),fn=e(13989),An=e(60656),hn=e(74730);class ca{constructor(Ie){this._vizPanel=Ie}get id(){const Ie=(0,hn.Cs)(this._vizPanel.parent instanceof An.F?this._vizPanel.parent:this._vizPanel);return isNaN(Ie)?(console.error("VizPanel key could not be translated to a legacy numeric panel id",this._vizPanel),0):Ie}get description(){return this._vizPanel.state.description}get type(){return this._vizPanel.state.pluginId}get title(){return this._vizPanel.state.title}get transformations(){return this._vizPanel.state.$data instanceof r.Es?this._vizPanel.state.$data.state.transformations:[]}get targets(){const Ie=(0,hn.un)(this._vizPanel);return Ie?Ie.state.queries:[]}get datasource(){return(0,hn.un)(this._vizPanel)?.state.datasource}get options(){return this._vizPanel.state.options}get fieldConfig(){return this._vizPanel.state.fieldConfig}get pluginVersion(){return this._vizPanel.state.pluginVersion}}var Rt=e(32023);class qt{constructor(Ie){this._scene=Ie,this.events=new cn.o,this._subs=new jt.yU;const je=r.jh.getTimeRange(Ie);this.formatDate=this.formatDate.bind(this),this._subs.add(je.subscribeToState((lt,bt)=>{lt.value!==bt.value&&this.events.publish(new Xt.sR(lt.value))}))}get id(){return this._scene.state.id??null}get uid(){return this._scene.state.uid??null}get title(){return this._scene.state.title}get description(){return this._scene.state.description}get editable(){return this._scene.state.editable}get graphTooltip(){return this._getSyncMode()}get timepicker(){return{refresh_intervals:Rt.b.getRefreshPicker(this._scene)?.state.intervals,hidden:Rt.b.getDashboardControls(this._scene)?.state.hideTimeControls??!1}}get timezone(){return this.getTimezone()}get weekStart(){return r.jh.getTimeRange(this._scene).state.weekStart}get tags(){return this._scene.state.tags}get links(){return this._scene.state.links}get meta(){return this._scene.state.meta}get time(){const Ie=r.jh.getTimeRange(this._scene);return{from:Ie.state.from,to:Ie.state.to}}get panels(){return gn(this._scene,je=>je instanceof r.Eb).map(je=>new ca(je))}get annotations(){const Ie={list:[]};return this._scene.state.$data instanceof r.zr&&(Ie.list=(0,fn.O)(this._scene.state.$data.state.layers)),Ie}getTimezone(){return r.jh.getTimeRange(this._scene).getTimeZone()}sharedTooltipModeEnabled(){return this._getSyncMode()>0}sharedCrosshairModeOnly(){return this._getSyncMode()===1}_getSyncMode(){if(this._scene.state.$behaviors){for(const Ie of this._scene.state.$behaviors)if(Ie instanceof r.Gg.K2)return Ie.state.sync}return pn.y.Off}otherPanelInFullscreen(Ie){return!1}formatDate(Ie,je){return(0,on.LE)(Ie,{format:je,timeZone:this.getTimezone()})}getPanelById(Ie){const je=(0,hn.vL)(this._scene,(0,hn.XA)(Ie));return je?new ca(je):null}removePanel(Ie){const je=(0,hn.vL)(this._scene,(0,hn.XA)(Ie.id));if(!je){console.error("Trying to remove a panel that was not found in scene",Ie);return}const lt=je.parent;if(!(lt instanceof r.M$)){console.error("Trying to remove a panel that is not wrapped in SceneGridItem");return}const bt=r.jh.getLayout(je);if(!(bt instanceof r.hy)){console.error("Trying to remove a panel in a layout that is not SceneGridLayout ");return}if(bt===lt.parent&&bt.setState({children:bt.state.children.filter(Ft=>Ft!==lt)}),lt.parent instanceof r.tI){const Ft=bt.clone({children:bt.state.children.filter(Kt=>Kt!==lt)});bt.parent instanceof r.hy&&bt.parent.setState({children:bt.parent.state.children.map(Kt=>Kt===bt?Ft:Kt)})}}canEditAnnotations(Ie){return this._scene.canEditDashboard()?Ie?!!this._scene.state.meta.annotationsPermissions?.dashboard.canEdit:!!this._scene.state.meta.annotationsPermissions?.organization.canEdit:!1}panelInitialized(){}destroy(){this.events.removeAllListeners(),this._subs.unsubscribe()}hasUnsavedChanges(){return this._scene.state.isDirty}}function gn(Oe,Ie){let je=[];return Oe.forEachChild(lt=>{Ie(lt)?je.push(lt):je=je.concat(gn(lt,Ie))}),je}function Cn(Oe){let Ie=5381;for(let je=0;je<Oe.length;je++)Ie=Ie*33^Oe.charCodeAt(je);return Ie>>>0}var mn=e(11982),Sn=e(48548),Tn=e(65123),$n=e(54612),Mn=e(16560),Ln=e(86460),na=e(62930),pa=e(88323),ia=e(66864),Xn=e(16233),Da=e(83195),ba=e(2619),Oa=e(89667),sa=e(52622),Jn=e(39070),Va=e(68706),ts=e(41524);function Ds(Oe){const Ie=[];if(Oe?.series)for(const je of Oe.series)Ie.push((0,Oa.Nw)(je));if(Oe?.annotations)for(const je of Oe.annotations){const lt=(0,Oa.Nw)(je);lt.schema?.meta||(lt.schema.meta={}),lt.schema.meta.dataTopic=sa.QR.Annotations,Ie.push(lt)}return Ie}function Ms(Oe,Ie){const je={panelType:Oe.state.pluginId,datasource:"??"},lt=`${gt.$.buildInfo.version} (${gt.$.buildInfo.commit})`;let bt=`| Key | Value | |--|--| | Panel | ${je.panelType} @ ${Oe.state.pluginVersion??lt} | | Grafana | ${lt} // ${gt.$.buildInfo.edition} | `;return Ie&&(bt+="<details><summary>Panel debug snapshot dashboard</summary>\n\n```json\n"+Ie+"\n```\n</details>"),bt}async function Ns(Oe,Ie,je){const lt=(0,Le.ZB)(Oe.parent),bt=(0,ye.cloneDeep)(Cs),Ft={panelType:lt.type,datasource:"??"},Kt=(0,hn.un)(Oe);if(!Kt.state.data)return;const ln=Kt.state.data,an=Kt?.state.datasource,Ut=(0,ts.W)(Ds(ln),Ie),Un=`${gt.$.buildInfo.version} (${gt.$.buildInfo.commit})`,Nn=Kt.state.queries??[],Pa=`<table width="100%"> <tr> <th width="2%">Panel</th> <td >${Ft.panelType} @ ${lt.pluginVersion??Un}</td> </tr> <tr> <th>Queries</th> <td>${Nn.map(qn=>{const Wa=qn.datasource??an;return`${qn.refId}[${Wa?.type}]`}).join(", ")}</td> </tr> ${cs(lt)} ${Ps(ln,Ut)} ${ir(ln)} <tr> <th>Grafana</th> <td>${Un} // ${gt.$.buildInfo.edition}</td> </tr> </table>`.trim();if(bt.panels[0]={...lt,...bt.panels[0],targets:[{refId:"A",datasource:{type:"grafana",uid:"grafana"},queryType:Va.nj.Snapshot,snapshot:Ut}]},lt.transformations?.length){const qn=bt.panels[bt.panels.length-1];qn.title=qn.title+" (after transformations)";const Wa=(0,ye.cloneDeep)(qn);Wa.id=100,Wa.title="Data (before transformations)",Wa.gridPos.w=24,Wa.targets[0].withTransforms=!1,bt.panels.push(Wa)}return ln.annotations?.length&&bt.panels.push({id:7,gridPos:{h:6,w:24,x:0,y:20},type:"table",title:"Annotations",datasource:{type:"datasource",uid:"-- Dashboard --"},options:{showTypeIcons:!0},targets:[{datasource:{type:"datasource",uid:"-- Dashboard --"},panelId:2,withTransforms:!0,topic:sa.QR.Annotations,refId:"A"}]}),bt.panels[1].options.content=Pa,bt.panels[2].options.content=JSON.stringify(lt,null,2),bt.title=`Debug: ${lt.title} // ${(0,on.LE)(new Date)}`,bt.tags=["debug",`debug-${Ft.panelType}`],bt.time={from:je.from.toISOString(),to:je.to.toISOString()},bt}function cs(Oe){return Oe.transformations?`<tr> <th>Transform</th> <td>${Oe.transformations.map(Ie=>Ie.id).join(", ")}</td> </tr>`:""}function Ps(Oe,Ie){let je=Oe.series.length??0,lt=0,bt=0;for(const Ft of Oe.series)lt+=Ft.fields.length,bt+=Ft.length;return`<tr><th>Data</th><td>${Oe.state!==Jn.Gu.Done?Oe.state:""} ${je} frames, ${lt} fields, ${bt} rows </td></tr>`}function ir(Oe){return Oe.annotations?.length?`<tr> <th>Annotations</th> <td>${Oe.annotations.map((Ie,je)=>`<span>${Ie.length}</span>`)}</td> </tr>`:""}const Cs={panels:[{id:2,title:"Reproduced with embedded data",datasource:{type:"grafana",uid:"grafana"},gridPos:{h:13,w:15,x:0,y:0}},{gridPos:{h:7,w:9,x:15,y:0},id:5,options:{content:"...",mode:"html"},title:"Debug info",type:"text"},{id:6,title:"Original Panel JSON",type:"text",gridPos:{h:13,w:9,x:15,y:7},options:{content:"...",mode:"code",code:{language:"json",showLineNumbers:!0,showMiniMap:!0}}},{id:3,title:"Data from panel above",type:"table",datasource:{type:"datasource",uid:"-- Dashboard --"},gridPos:{h:7,w:15,x:0,y:13},options:{showTypeIcons:!0},targets:[{datasource:{type:"datasource",uid:"-- Dashboard --"},panelId:2,withTransforms:!0,refId:"A"}]}],schemaVersion:37};var as=(Oe=>(Oe[Oe.Support=0]="Support",Oe[Oe.Data=1]="Data",Oe))(as||{}),ar=(Oe=>(Oe[Oe.PanelSnapshot=0]="PanelSnapshot",Oe[Oe.GithubComment=1]="GithubComment",Oe))(ar||{});class lr extends ba.Q{constructor(Ie){super({panel:Ie,panelTitle:r.jh.interpolate(Ie,Ie.state.title,{},"text"),currentTab:0,showMessage:1,snapshotText:"",markdownText:"",randomize:{},snapshotUpdate:0,options:[{label:"GitHub comment",description:"Copy and paste this message into a GitHub issue or comment",value:1},{label:"Panel support snapshot",description:"Dashboard JSON used to help troubleshoot visualization issues",value:0}]}),this.onCurrentTabChange=je=>{this.setState({currentTab:je})},this.onShowMessageChange=je=>{this.setState({showMessage:je.value})},this.onGetMarkdownForClipboard=()=>{const{markdownText:je}=this.state,lt=Math.pow(1024,2)*1.5;return je.length>lt?(this.setState({error:{title:"Copy to clipboard failed",message:"Snapshot is too large, consider download and attaching a file instead"}}),""):je},this.onDownloadDashboard=()=>{const{snapshotText:je,panelTitle:lt}=this.state,bt=new Blob([je],{type:"text/plain"}),Ft=`debug-${lt}-${(0,on.LE)(new Date)}.json.txt`;le()(bt,Ft)},this.onSetSnapshotText=je=>{this.setState({snapshotText:je})},this.onToggleRandomize=je=>{const{randomize:lt}=this.state;this.setState({randomize:{...lt,[je]:!lt[je]}})}}async buildDebugDashboard(){const{panel:Ie,randomize:je,snapshotUpdate:lt}=this.state,bt=await Ns(Ie,je,r.jh.getTimeRange(Ie).state.value),Ft=JSON.stringify(bt,null,2),Kt=Ms(Ie,Ft),ln=(0,Da.cN)((0,Da.j_)("bytes")(Ft?.length??0));let an;try{an=(0,ft.wM)({dashboard:bt,meta:{isEmbedded:!0}}).state.body}catch(Ut){console.log("Error creating scene:",Ut)}this.setState({snapshot:bt,snapshotText:Ft,markdownText:Kt,snapshotSize:ln,snapshotUpdate:lt+1,scene:an})}}function Is({panel:Oe,onClose:Ie}){const je=(0,He.of)(cr),lt=(0,m.useMemo)(()=>new lr(Oe),[Oe]),bt=Oe.getPlugin(),{currentTab:Ft,loading:Kt,error:ln,options:an,showMessage:Ut,snapshotSize:Un,markdownText:Nn,snapshotText:Pa,randomize:qn,panelTitle:Wa,scene:ls}=lt.useState();if((0,m.useEffect)(()=>{lt.buildDebugDashboard()},[lt,bt,qn]),!bt)return null;const fs=[{label:"Snapshot",value:as.Support},{label:"Data",value:as.Data}],ms=gt.$.supportBundlesEnabled&&Xn.TP.hasPermission(ee.AccessControlAction.ActionSupportBundlesCreate);return m.createElement(E._,{title:"Get help with this panel",size:"lg",onClose:Ie,subtitle:m.createElement(M.B,{direction:"column",gap:1},m.createElement(M.B,{direction:"row",gap:1},m.createElement(Ln.y,{featureState:o.Ay.beta}),m.createElement("a",{href:"https://grafana.com/docs/grafana/latest/troubleshooting/",target:"blank",className:"external-link",rel:"noopener noreferrer"},"Troubleshooting docs ",m.createElement(ae.I,{name:"external-link-alt"}))),m.createElement("span",{className:"muted"},"To request troubleshooting help, send a snapshot of this panel to Grafana Labs Technical Support. The snapshot contains query response data and panel settings."),ms&&m.createElement("span",{className:"muted"},"You can also retrieve a support bundle containing information concerning your Grafana instance and configured datasources in the ",m.createElement("a",{href:"/support-bundles"},"support bundles section"),".")),tabs:m.createElement(a.U,null,fs.map((tr,Bs)=>m.createElement(v.o,{key:`${tr.value}-${Bs}`,label:tr.label,active:tr.value===Ft,onChangeTab:()=>lt.onCurrentTabChange(tr.value)})))},Kt&&m.createElement(na.y,null),ln&&m.createElement(y.F,{title:ln.title},ln.message),Ft===as.Data&&m.createElement("div",{className:je.code},m.createElement("div",{className:je.opts},m.createElement(T.D,{label:"Template",className:je.field},m.createElement(pa.l6,{options:an,value:Ut,onChange:lt.onShowMessageChange})),Ut===ar.GithubComment?m.createElement(Re.b,{icon:"copy",getText:lt.onGetMarkdownForClipboard},"Copy to clipboard"):m.createElement(C.$n,{icon:"download-alt",onClick:lt.onDownloadDashboard},"Download (",Un,")")),m.createElement(Te.Ay,{disableWidth:!0},({height:tr})=>m.createElement(Ee.B,{width:"100%",height:tr,language:Ut===ar.GithubComment?"markdown":"json",showLineNumbers:!0,showMiniMap:!0,value:Ut===ar.GithubComment?Nn:Pa,readOnly:!1,onBlur:lt.onSetSnapshotText}))),Ft===as.Support&&m.createElement(m.Fragment,null,m.createElement(T.D,{label:"Randomize data",description:"Modify the original data to hide sensitve information. Note the lengths will stay the same, and duplicate values will be equal."},m.createElement(ia.Gy,null,m.createElement(S.K,{label:"Labels",id:"randomize-labels",showLabel:!0,value:!!qn.labels,onChange:()=>lt.onToggleRandomize("labels")}),m.createElement(S.K,{label:"Field names",id:"randomize-field-names",showLabel:!0,value:!!qn.names,onChange:()=>lt.onToggleRandomize("names")}),m.createElement(S.K,{label:"String values",id:"randomize-string-values",showLabel:!0,value:!!qn.values,onChange:()=>lt.onToggleRandomize("values")}))),m.createElement(T.D,{label:"Support snapshot",description:`Panel: ${Wa}`},m.createElement(M.B,null,m.createElement(C.$n,{icon:"download-alt",onClick:lt.onDownloadDashboard},"Dashboard (",Un,")"),m.createElement(Re.b,{icon:"github",getText:lt.onGetMarkdownForClipboard,title:"Copy a complete GitHub comment to the clipboard"},"Copy to clipboard"))),m.createElement(Te.Ay,{disableWidth:!0},({height:tr})=>m.createElement("div",{style:{height:tr,overflow:"auto"}},ls&&m.createElement(ls.Component,{model:ls})))))}const cr=Oe=>({code:(0,De.css)({flexGrow:1,height:"100%",overflow:"scroll"}),field:(0,De.css)({width:"100%"}),opts:(0,De.css)({display:"flex",width:"100%",flexGrow:0,alignItems:"center",justifyContent:"flex-end","& button":{marginLeft:Oe.spacing(1)}})});var Zs=e(61453);class os extends r.Bs{constructor(Ie){super({...Ie,options:{withTransforms:!0,withFieldConfig:!0}}),this.onOptionsChange=je=>{this.setState({options:je})}}getTabLabel(){return(0,Ne.t)("dashboard.inspect.data-tab","Data")}getTabValue(){return Mn.q.Data}}os.Component=({model:Oe})=>{const{options:Ie}=Oe.useState(),je=Oe.state.panelRef.resolve(),lt=r.jh.getData(je),{data:bt}=Ls(lt,Ie.withTransforms).useState(),Ft=r.jh.getTimeRange(je);return m.createElement(Zs.q,{isLoading:bt?.state===Jn.Gu.Loading,data:bt?.series,options:Ie,hasTransformations:is(lt),timeZone:Ft.getTimeZone(),panelPluginId:je.state.pluginId,dataName:je.state.title,fieldConfig:je.state.fieldConfig,onOptionsChange:Oe.onOptionsChange})};function is(Oe){return Oe instanceof r.Es?Oe.state.transformations.length>0:!1}function Ls(Oe,Ie){return Ie&&Oe instanceof r.Es?Oe.state.$data:Oe}var ks=e(18803),Pr=e(26323),qs=e(77938),Cr=e(6204),Ir=e(11497);class Lo extends r.Bs{constructor(Ie){super({...Ie,source:"panel-json",jsonText:br("panel-json",Ie.panelRef.resolve())}),this.onChangeSource=je=>{this.setState({source:je.value,jsonText:br(je.value,this.state.panelRef.resolve())})},this.onApplyChange=()=>{const je=this.state.panelRef.resolve(),lt=(0,hn.YQ)(je),bt=JSON.parse(this.state.jsonText),Ft=new f.a(bt),Kt=(0,ft.tt)(Ft),ln=r.Go.cloneSceneObjectState(Kt.state);if(!(je.parent instanceof r.M$)||!(Kt instanceof r.M$)){console.error("Cannot update state of panel",je,Kt);return}this.state.onClose(),lt.state.isEditing||lt.onEnterEditMode(),je.parent.setState(ln),(0,Cr.B9)(Mn.q.JSON,"apply",{panel_type_changed:je.state.pluginId!==Ft.type,panel_id_changed:(0,hn.Cs)(je)!==Ft.id,panel_grid_pos_changed:so(je.parent.state,ln),panel_targets_changed:hs((0,hn.un)(je),(0,hn.un)(ln.$data))})},this.onCodeEditorBlur=je=>{this.setState({jsonText:je})}}getTabLabel(){return(0,Ne.t)("dashboard.inspect.json-tab","JSON")}getTabValue(){return Mn.q.JSON}getOptions(){const je=this.state.panelRef.resolve().state.$data,lt=[{label:(0,Ne.t)("dashboard.inspect-json.panel-json-label","Panel JSON"),description:(0,Ne.t)("dashboard.inspect-json.panel-json-description","The model saved in the dashboard JSON that configures how everything works."),value:"panel-json"}];return je&&(lt.push({label:(0,Ne.t)("dashboard.inspect-json.panel-data-label","Panel data"),description:(0,Ne.t)("dashboard.inspect-json.panel-data-description","The raw model passed to the panel visualization"),value:"panel-data"}),lt.push({label:(0,Ne.t)("dashboard.inspect-json.dataframe-label","DataFrame JSON (from Query)"),description:(0,Ne.t)("dashboard.inspect-json.dataframe-description","Raw data without transformations and field config applied. "),value:"data-frames"})),lt}isEditable(){if(this.state.source!=="panel-json")return!1;const Ie=this.state.panelRef.resolve();return Ie.parent instanceof r.M$?(0,hn.YQ)(Ie).state.meta.canEdit:!1}}Lo.Component=({model:Oe})=>{const{source:Ie,jsonText:je}=Oe.useState(),lt=(0,He.of)(Pr.A),bt=Oe.getOptions();return m.createElement("div",{className:lt.wrap},m.createElement("div",{className:lt.toolbar,"aria-label":R.Tp.components.PanelInspector.Json.content},m.createElement(T.D,{label:(0,Ne.t)("dashboard.inspect-json.select-source","Select source"),className:"flex-grow-1"},m.createElement(pa.l6,{inputId:"select-source-dropdown",options:bt,value:bt.find(Ft=>Ft.value===Ie)??bt[0].value,onChange:Oe.onChangeSource})),Oe.isEditable()&&m.createElement(C.$n,{className:lt.toolbarItem,onClick:Oe.onApplyChange},"Apply")),m.createElement("div",{className:lt.content},m.createElement(Te.Ay,{disableWidth:!0},({height:Ft})=>m.createElement(Ee.B,{width:"100%",height:Ft,language:"json",showLineNumbers:!0,showMiniMap:je.length>100,value:je,readOnly:!Oe.isEditable(),onBlur:Oe.onCodeEditorBlur}))))};function br(Oe,Ie){let je={};switch(Oe){case"panel-json":{(0,Cr.B9)(Mn.q.JSON,"panelData"),(Ie.parent instanceof r.M$||Ie.parent instanceof Ir.w)&&(je=(0,Le.ZB)(Ie.parent));break}case"panel-data":{(0,Cr.B9)(Mn.q.JSON,"panelJSON");const lt=r.jh.getData(Ie);lt.state.data&&(je=Ie.applyFieldConfig(lt.state.data));break}case"data-frames":{(0,Cr.B9)(Mn.q.JSON,"dataFrame");const lt=r.jh.getData(Ie);lt.state.data&&(lt instanceof r.Es&<.state.$data?.state.data?je=(0,ks.B6)(lt.state.$data.state.data):je=(0,ks.B6)(lt.state.data))}}return(0,qs.p)(je)}function so(Oe,Ie){return Oe.x!==Ie.x||Oe.y!==Ie.y||Oe.width!==Ie.width||Oe.height!==Ie.height}function hs(Oe,Ie){return Oe===void 0||Ie===void 0?!1:!(0,ye.isEqual)(Oe.state.queries,Ie.state.queries)}class Nr extends r.Bs{getTabLabel(){return(0,Ne.t)("dashboard.inspect.meta-tab","Meta data")}getTabValue(){return Mn.q.Meta}}Nr.Component=({model:Oe})=>{const{panelRef:Ie,dataSource:je}=Oe.state,lt=r.jh.getData(Ie.resolve()),bt=je.components?.MetadataInspector;return!lt.state.data||!bt?null:m.createElement(bt,{datasource:je,data:lt.state.data.series})};var wr=e(90820);class Zr extends r.Bs{constructor(){super(...arguments),this.onRefreshQuery=()=>{const Ie=(0,hn.un)(this.state.panelRef.resolve());Ie&&Ie.runQueries()}}getTabLabel(){return(0,Ne.t)("dashboard.inspect.query-tab","Query")}getTabValue(){return Mn.q.Query}}Zr.Component=({model:Oe})=>{const Ie=r.jh.getData(Oe.state.panelRef.resolve()).useState();return Ie.data?m.createElement(wr.e,{data:Ie.data,onRefreshQuery:Oe.onRefreshQuery}):null};var Ar=e(32067);class zo extends r.Bs{getTabLabel(){return(0,Ne.t)("dashboard.inspect.stats-tab","Stats")}getTabValue(){return Mn.q.Stats}}zo.Component=({model:Oe})=>{const Ie=r.jh.getData(Oe.state.panelRef.resolve()).useState(),je=r.jh.getTimeRange(Oe.state.panelRef.resolve());return Ie.data?m.createElement(Ar.N,{data:Ie.data,timeZone:je.getTimeZone()}):null};class $s extends r.Bs{constructor(Ie){super(Ie),this.onClose=()=>{const je=(0,hn.YQ)(this);s.Ny.push((0,mn.uZ)({uid:je.state.uid,slug:je.state.meta.slug,currentQueryParams:s.Ny.getLocation().search,updateQuery:{inspect:null,inspectTab:null}}))},this.addActivationHandler(()=>this._activationHandler())}_activationHandler(){this.buildTabs(0)}async buildTabs(Ie){const je=this.state.panelRef,lt=je?.resolve()?.getPlugin(),bt=[];if(lt||(Ie<2e3?setTimeout(()=>this.buildTabs(Ie+100),100):this.setState({pluginNotLoaded:!0})),je){if((0,$n.$)(lt)){const Ft=r.jh.getData(je.resolve());bt.push(new os({panelRef:je})),bt.push(new zo({panelRef:je})),bt.push(new Zr({panelRef:je}));const Kt=await(0,Tn.BN)(Ft.state.data);Kt&&bt.push(new Nr({panelRef:je,dataSource:Kt}))}bt.push(new Lo({panelRef:je,onClose:this.onClose}))}this.setState({tabs:bt})}getDrawerTitle(){const Ie=this.state.panelRef?.resolve();return Ie?r.jh.interpolate(Ie,`Inspect: ${Ie.state.title}`):"Inspect panel"}}$s.Component=Ss;function Ss({model:Oe}){const{tabs:Ie,pluginNotLoaded:je,panelRef:lt}=Oe.useState(),bt=(0,Ke.zy)(),Ft=new URLSearchParams(bt.search);if(!Ie)return null;const Kt=Ft.get("inspectTab"),ln=Ie.find(Ut=>Ut.getTabValue()===Kt)??Ie[0],an=lt.resolve();return Kt===Mn.q.Help?m.createElement(Is,{panel:an,onClose:Oe.onClose}):m.createElement(E._,{title:Oe.getDrawerTitle(),onClose:Oe.onClose,size:"md",tabs:m.createElement(a.U,null,Ie.map(Ut=>m.createElement(v.o,{key:Ut.state.key,label:Ut.getTabLabel(),active:Ut===ln,href:t.I.getUrlForPartial(bt,{inspectTab:Ut.getTabValue()})})))},je&&m.createElement(y.F,{title:"Panel plugin not loaded"},"Make sure the panel you want to inspect is visible and has been displayed before opening inspect."),ln&&ln.Component&&m.createElement(ln.Component,{model:ln}))}var ro=e(40980),Za=e(95689),bs=e(39558),Yn=e(82422),St=e(27747),oo=e(75471),vo=e(16817),io=e(76885),ur=e(34867),Fr=e(25027),Co=e(63066);const bo=({panel:Oe,className:Ie})=>{const je=(0,Ke.zy)(),{loading:lt,value:bt}=(0,vo.A)(()=>(0,Co.J6)(Oe),[Oe]);if(lt)return m.createElement(C.$n,{disabled:!0},"New alert rule");if(!bt)return m.createElement(y.F,{severity:"info",title:"No alerting capable query found"},"Cannot create alerts from this panel because no query to an alerting capable datasource is found.");const Ft=async()=>{(0,ur.fH)(Fr.le.alertRuleFromPanel);const Kt=await(0,Co.J6)(Oe),ln=io.kM.renderUrl("/alerting/new",{defaults:JSON.stringify(Kt),returnTo:je.pathname+je.search});s.Ny.push(ln)};return m.createElement(C.$n,{icon:"bell",onClick:Ft,className:Ie,"data-testid":"create-alert-rule-button"},"New alert rule")};var Ot=(Oe=>(Oe.Queries="queries",Oe.Transformations="transformations",Oe.Alert="alert",Oe))(Ot||{});class $t extends r.Bs{constructor(Ie){super({}),this.tabId=Ot.Alert,this.TabComponent=je=>vn({...je,model:this}),this._panelManager=Ie}getTabLabel(){return"Alert"}getDashboardUID(){return this.getDashboard().state.uid}getDashboard(){return(0,hn.YQ)(this._panelManager)}getLegacyPanelId(){return(0,hn.Cs)(this._panelManager.state.panel)}getCanCreateRules(){const Ie=(0,oo.Wd)("grafana");return this.getDashboard().state.meta.canSave&&Ve.TP.hasPermission(Ie.create)}get panelManager(){return this._panelManager}get panel(){return this._panelManager.state.panel}}$t.Component=sn;function sn(Oe){const{model:Ie}=Oe,je=(0,He.of)(Zt),{errors:lt,loading:bt,rules:Ft}=(0,St.S)({dashboardUID:Ie.getDashboardUID(),panelId:Ie.getLegacyPanelId()}),Kt=lt.length?m.createElement(y.F,{title:"Errors loading rules",severity:"error"},lt.map((Ut,Un)=>m.createElement("div",{key:Un},"Failed to load Grafana rules state: ",Ut.message||"Unknown error."))):null;if(bt&&!Ft.length)return m.createElement(m.Fragment,null,Kt,m.createElement(bs._,{text:"Loading rules..."}));const{panel:ln}=Ie,an=Ie.getCanCreateRules();return Ft.length?m.createElement(m.Fragment,null,m.createElement(Yn.s,{rules:Ft}),an&&m.createElement(bo,{className:je.newButton,panel:ln})):m.createElement("div",{className:je.noRulesWrapper},m.createElement("p",null,"There are no alert rules linked to this panel."),an&&m.createElement(bo,{panel:ln}))}const Zt=Oe=>({newButton:(0,De.css)({marginTop:Oe.spacing(3)}),noRulesWrapper:(0,De.css)({margin:Oe.spacing(2),backgroundColor:Oe.colors.background.secondary,padding:Oe.spacing(3)})});function vn(Oe){const{model:Ie}=Oe,{rules:je}=(0,St.S)({dashboardUID:Ie.getDashboardUID(),panelId:Ie.getLegacyPanelId(),poll:!1});return m.createElement(v.o,{key:Oe.key,label:Ie.getTabLabel(),icon:"bell",counter:je.length,active:Oe.active,onChangeTab:Oe.onChangeTab})}var wn=e(21969),kn=e(53478),ua=e(64152),ma=e(44932),Qa=e(37464),za=e(14348),Ia=e(7928);class Ha extends r.Bs{constructor(Ie){super({}),this.tabId=Ot.Queries,this.icon="database",this.onOpenInspector=()=>{this._panelManager.inspectPanel()},this.onChangeDataSource=async(je,lt)=>{this._panelManager.changePanelDataSource(je,lt)},this.onQueryOptionsChange=je=>{this._panelManager.changeQueryOptions(je)},this.onQueriesChange=je=>{this._panelManager.changeQueries(je)},this.onRunQueries=()=>{this._panelManager.queryRunner.runQueries()},this.addQueryClick=()=>{const je=this.getQueries();this.onQueriesChange((0,wn.U7)(je,this.newQuery()))},this.onAddQuery=je=>{const lt=this.getQueries(),bt=this._panelManager.state.dsSettings;this.onQueriesChange((0,wn.U7)(lt,je,{type:bt?.type,uid:bt?.uid}))},this.onAddExpressionClick=()=>{const je=this.getQueries();this.onQueriesChange((0,wn.U7)(je,kn.Ex.newQuery()))},this.TabComponent=je=>sr({...je,model:this}),this._panelManager=Ie}getTabLabel(){return"Queries"}getItemsCount(){return this.getQueries().length}buildQueryOptions(){const Ie=this._panelManager,je=this._panelManager.state.panel,lt=this._panelManager.queryRunner,bt=r.jh.getTimeRange(je);let Ft={from:void 0,shift:void 0,hide:void 0};bt instanceof Ia.v&&(Ft={from:bt.state.timeFrom,shift:bt.state.timeShift,hide:bt.state.hideTimeOverride});let Kt=lt.state.queries;return{cacheTimeout:Ie.state.dsSettings?.meta.queryOptions?.cacheTimeout?lt.state.cacheTimeout:void 0,queryCachingTTL:Ie.state.dsSettings?.cachingConfig?.enabled?lt.state.queryCachingTTL:void 0,dataSource:{default:Ie.state.dsSettings?.isDefault,type:Ie.state.dsSettings?.type,uid:Ie.state.dsSettings?.uid},queries:Kt,maxDataPoints:lt.state.maxDataPoints,minInterval:lt.state.minInterval,timeRange:Ft}}getQueries(){return this._panelManager.queryRunner.state.queries}newQuery(){const{dsSettings:Ie,datasource:je}=this._panelManager.state,lt=Ie?.meta.mixed?je:Ie;return{...je?.getDefaultQuery?.(o.Jk.PanelEditor),datasource:{uid:lt?.uid,type:lt?.type}}}isExpressionsSupported(Ie){return(Ie.meta.alerting||Ie.meta.mixed)===!0}renderExtraActions(){return ua.m.getAllExtraRenderAction().map((Ie,je)=>Ie({onAddQuery:this.onAddQuery,onChangeDataSource:this.onChangeDataSource,key:je})).filter(Boolean)}get queryRunner(){return this._panelManager.queryRunner}get panelManager(){return this._panelManager}}Ha.Component=Ys;function Ys({model:Oe}){const{datasource:Ie,dsSettings:je}=Oe.panelManager.useState(),{data:lt}=Oe.panelManager.queryRunner.useState();if(!Ie||!je||!lt)return null;const bt=!(0,za.kN)(je.name);return m.createElement(m.Fragment,null,m.createElement(Qa.K,{data:lt,dsSettings:je,dataSource:Ie,options:Oe.buildQueryOptions(),onDataSourceChange:Oe.onChangeDataSource,onOptionsChange:Oe.onQueryOptionsChange,onOpenQueryInspector:Oe.onOpenInspector}),m.createElement(ma.L,{data:lt,queries:Oe.getQueries(),dsSettings:je,onAddQuery:Oe.onAddQuery,onQueriesChange:Oe.onQueriesChange,onRunQueries:Oe.onRunQueries}),m.createElement(ia.Gy,{spacing:"md",align:"flex-start"},bt&&m.createElement(C.$n,{icon:"plus",onClick:Oe.addQueryClick,variant:"secondary","data-testid":R.Tp.components.QueryTab.addQuery},"Add query"),gt.$.expressionsEnabled&&Oe.isExpressionsSupported(je)&&m.createElement(C.$n,{icon:"plus",onClick:Oe.onAddExpressionClick,variant:"secondary","data-testid":"query-tab-add-expression"},m.createElement("span",null,"Expression\xA0")),Oe.renderExtraActions()))}function sr(Oe){const{model:Ie}=Oe,je=Ie.queryRunner.useState();return m.createElement(v.o,{key:Oe.key,label:Ie.getTabLabel(),icon:"database",counter:je.queries.length,active:Oe.active,onChangeTab:Oe.onChangeTab})}var vs=e(75494),zr=e(57650),ws=e(79280),ds=e(97497),Vs=e(29158),kr=e(21427),ha=e(57120);function xs(Oe){const{isOpen:Ie,series:je,onClose:lt,onTransformationAdd:bt}=Oe,[Ft,Kt]=(0,m.useState)({search:"",showIllustrations:!0}),ln=qn=>Kt({...Ft,search:qn.currentTarget.value}),an=qn=>Kt({...Ft,showIllustrations:qn}),Ut=qn=>Kt({...Ft,selectedFilter:qn}),Un=(0,m.useMemo)(()=>ds.h.list().sort((qn,Wa)=>qn.name>Wa.name?1:Wa.name>qn.name?-1:0),[]),Nn=Un.filter(qn=>Ft.selectedFilter&&Ft.selectedFilter!==ha.e&&!qn.categories?.has(Ft.selectedFilter)?!1:qn.name.toLocaleLowerCase().includes(Ft.search.toLocaleLowerCase())),Pa=m.createElement(m.Fragment,null,Nn.length," / ",Un.length," \xA0\xA0",m.createElement(Vs.K,{name:"times",onClick:()=>{Kt({...Ft,search:""})},tooltip:"Clear search"}));if(Ie)return m.createElement(kr.R,{data:je,onTransformationAdd:bt,xforms:Nn,search:Ft.search,noTransforms:!1,suffix:Ft.search!==""?Pa:m.createElement(m.Fragment,null),selectedFilter:Ft.selectedFilter,onSearchChange:ln,onSearchKeyDown:()=>{},showIllustrations:Ft.showIllustrations,onShowIllustrationsChange:an,onSelectedFilterChange:Ut,onClose:lt})}class lo extends r.Bs{constructor(Ie){super({}),this.tabId=Ot.Transformations,this.icon="process",this.TabComponent=je=>co({...je,model:this}),this._panelManager=Ie}getTabLabel(){return"Transformations"}getQueryRunner(){return this._panelManager.queryRunner}getDataTransformer(){return this._panelManager.dataTransformer}onChangeTransformations(Ie){this._panelManager.changeTransformations(Ie)}get panelManager(){return this._panelManager}}lo.Component=qa;function qa({model:Oe}){const Ie=(0,He.of)(Wr),je=Oe.getQueryRunner().useState(),{data:lt,transformations:bt}=Oe.getDataTransformer().useState(),Ft=bt,[Kt,ln]=(0,m.useState)(!1),[an,Ut]=(0,m.useState)(!1),Un=()=>ln(!0),Nn=()=>ln(!1);if(!lt||!je.data)return;const Pa=m.createElement(xs,{onClose:Nn,onTransformationAdd:qn=>{qn.value!==void 0&&(Oe.onChangeTransformations([...Ft,{id:qn.value,options:{}}]),Nn())},isOpen:Kt,series:lt.series});return Ft.length<1?m.createElement(m.Fragment,null,m.createElement(ws.p,{onShowPicker:Un}),Pa):m.createElement(m.Fragment,null,m.createElement(Qs,{data:je.data,transformations:Ft,model:Oe}),m.createElement(ve.e,null,m.createElement(C.$n,{icon:"plus",variant:"secondary",onClick:Un,"data-testid":R.Tp.components.Transforms.addTransformationButton},"Add another transformation"),m.createElement(C.$n,{"data-testid":R.Tp.components.Transforms.removeAllTransformationsButton,className:Ie.removeAll,icon:"times",variant:"secondary",onClick:()=>Ut(!0)},"Delete all transformations")),m.createElement(Pt.u,{isOpen:an,title:"Delete all transformations?",body:"By deleting all transformations, you will go back to the main selection screen.",confirmText:"Delete all",onConfirm:()=>{Oe.onChangeTransformations([]),Ut(!1)},onDismiss:()=>Ut(!1)}),Pa)}function Qs({transformations:Oe,model:Ie,data:je}){const lt=Oe.map((Ft,Kt)=>({id:`${Kt} - ${Ft.id}`,transformation:Ft})),bt=Ft=>{if(!Ft||!Ft.destination)return;const Kt=Ft.source.index,ln=Ft.destination.index;if(Kt===ln)return;const an=Array.from(lt),[Ut]=an.splice(Kt,1);an.splice(ln,0,Ut),Ie.onChangeTransformations(an.map(Un=>Un.transformation))};return m.createElement(vs.JY,{onDragEnd:bt},m.createElement(vs.gL,{droppableId:"transformations-list",direction:"vertical"},Ft=>m.createElement("div",{ref:Ft.innerRef,...Ft.droppableProps},m.createElement(zr.A,{onChange:(Kt,ln)=>{const an=Oe.slice();an[Kt]=ln,Ie.onChangeTransformations(an)},onRemove:Kt=>{const ln=Oe.slice();ln.splice(Kt,1),Ie.onChangeTransformations(ln)},configs:lt,data:je}),Ft.placeholder)))}const Wr=Oe=>({removeAll:(0,De.css)({marginLeft:Oe.spacing(2)})});function co(Oe){const{model:Ie}=Oe,je=Ie.getDataTransformer().useState();return m.createElement(v.o,{key:Oe.key,label:Ie.getTabLabel(),icon:"process",counter:je.transformations.length,active:Oe.active,onChangeTab:Oe.onChangeTab})}class To extends r.Bs{constructor(Ie){super({tab:Ot.Queries,tabs:[]}),this._urlSync=new r.So(this,{keys:["tab"]}),this._initialTabsBuilt=!1,this.onChangeTab=je=>{this.setState({tab:je.tabId})},this.panelManager=Ie,this.addActivationHandler(()=>this.onActivate())}getUrlState(){return{tab:this.state.tab}}updateFromUrl(Ie){Ie.tab&&typeof Ie.tab=="string"&&this.setState({tab:Ie.tab})}onActivate(){const Ie=this.panelManager.state.panel;return this.setupPanelSubscription(Ie),this.buildTabs(),this._subs.add(this.panelManager.subscribeToState((je,lt)=>{je.panel!==lt.panel&&(this.buildTabs(),this.setupPanelSubscription(je.panel))})),()=>{this.panelSubscription&&(this.panelSubscription.unsubscribe(),this.panelSubscription=void 0)}}setupPanelSubscription(Ie){this.panelSubscription&&(this._initialTabsBuilt=!1,this.panelSubscription.unsubscribe()),this.panelSubscription=Ie.subscribeToState(()=>{Ie.getPlugin()&&!this._initialTabsBuilt&&(this.buildTabs(),this._initialTabsBuilt=!0)})}buildTabs(){const je=this.panelManager.state.panel,lt=this.panelManager.queryRunner,bt=[];if(je){const Ft=je.getPlugin();if(!Ft)return;if(Ft.meta.skipDataQuery){this.setState({tabs:bt});return}else lt&&bt.push(new Ha(this.panelManager)),bt.push(new lo(this.panelManager)),(0,Za.e)(Ft)&&bt.push(new $t(this.panelManager))}this.setState({tabs:bt})}}To.Component=Mo;function Mo({model:Oe}){const{tab:Ie,tabs:je}=Oe.useState(),lt=(0,He.of)(vi);if(!je)return;const bt=je.find(Ft=>Ft.tabId===Ie);return m.createElement("div",{className:lt.dataPane},m.createElement(a.U,{hideBorder:!0,className:lt.tabsBar},je.map((Ft,Kt)=>m.createElement(Ft.TabComponent,{key:`${Ft.getTabLabel()}-${Kt}`,active:Ft.tabId===Ie,onChangeTab:()=>Oe.onChangeTab(Ft)}))),m.createElement(Ge.E,{className:lt.scroll},m.createElement(ro.J,{className:lt.tabContent},m.createElement(ia.mc,null,bt&&m.createElement(bt.Component,{model:bt})))))}function vi(Oe){return{dataPane:(0,De.css)({display:"flex",flexDirection:"column",flexGrow:1,minHeight:0,height:"100%"}),tabContent:(0,De.css)({padding:Oe.spacing(2),border:`1px solid ${Oe.colors.border.weak}`,borderLeft:"none",borderBottom:"none",borderTopRightRadius:Oe.shape.radius.default,flexGrow:1}),tabsBar:(0,De.css)({flexShrink:0,paddingLeft:Oe.spacing(2)}),scroll:(0,De.css)({background:Oe.colors.background.primary})}}var ti=e(34722);function ko({model:Oe}){const Ie=(0,hn.YQ)(Oe),{optionsPane:je,vizManager:lt,dataPane:bt,optionsPaneSize:Ft}=Oe.useState(),{controls:Kt}=Ie.useState(),ln=(0,He.of)(Ho),[an,Ut]=(0,m.useMemo)(()=>Ft>0?[{flexGrow:1-Ft},{minWidth:"unset",overflow:"hidden",flexGrow:Ft}]:[{flexGrow:1},{minWidth:"unset",flexGrow:0}],[Ft]);return m.createElement(m.Fragment,null,m.createElement(zt,{dashboard:Ie}),m.createElement(ti.O,{direction:"row",dragPosition:"end",initialSize:.75,primaryPaneStyles:an,secondaryPaneStyles:Ut,onResizing:Oe.onOptionsPaneResizing,onSizeChanged:Oe.onOptionsPaneSizeChanged},m.createElement("div",{className:ln.body},m.createElement("div",{className:ln.canvasContent},Kt&&m.createElement("div",{className:ln.controls},Kt.map(Un=>m.createElement(Un.Component,{key:Un.state.key,model:Un}))),m.createElement(ti.O,{direction:"column",primaryPaneStyles:{minHeight:0,paddingBottom:bt?0:16},secondaryPaneStyles:{minHeight:0,overflow:"hidden"},dragPosition:"start"},m.createElement(lt.Component,{model:lt}),bt&&m.createElement(bt.Component,{model:bt})))),je&&m.createElement(je.Component,{model:je})))}function Ho(Oe){return{canvasContent:(0,De.css)({label:"canvas-content",display:"flex",flexDirection:"column",flexBasis:"100%",flexGrow:1,minHeight:0,width:"100%"}),body:(0,De.css)({label:"body",flexGrow:1,display:"flex",position:"relative",minHeight:0,gap:"8px"}),controls:(0,De.css)({display:"flex",flexWrap:"wrap",alignItems:"center",gap:Oe.spacing(1),padding:Oe.spacing(2,0,2,2)})}}var Gi=e(67647),mr=e(14183),ji=e(17706),Yi=e(22290),Qi=e(50632),ni=e(7600);const ai=m.memo(({vizManager:Oe,searchQuery:Ie,listMode:je})=>{const{panel:lt}=Oe.state,{data:bt}=r.jh.getData(lt).useState(),{options:Ft,fieldConfig:Kt}=lt.useState(),ln=(0,m.useMemo)(()=>(0,Qi.I)(lt),[lt]),an=(0,m.useMemo)(()=>{const Pa=lt.getPlugin();if(Pa)return(0,ni.Z4)({panel:lt,plugin:Pa,eventBus:lt.getPanelContext().eventBus,instanceState:lt.getPanelContext().instanceState})},[lt,Ft,Kt]),Ut=(0,m.useMemo)(()=>(0,Yi.v)(Kt,lt.getPlugin()?.fieldConfigRegistry,bt?.series??[],Ie,Pa=>{lt.setState({fieldConfig:Pa})}),[Ie,lt,Kt]),Un=Ie.length>0,Nn=[];if(Un)Nn.push((0,mr.Po)([ln,...an??[]],Ut,Ie));else switch(je){case mr.gs.All:Nn.push(ln.render());for(const Pa of an??[])Nn.push(Pa.render());for(const Pa of Ut)Nn.push(Pa.render());break;case mr.gs.Overrides:for(const Pa of Ut)Nn.push(Pa.render());default:break}return Nn});ai.displayName="PanelOptions";var Hr=e(78685),Gr=e(94354),So=e(32696),si=e(56707),Tr=e(86292);function Ji({vizManager:Oe,data:Ie,onChange:je}){const{panel:lt}=Oe.useState(),bt=(0,He.of)(Xi),[Ft,Kt]=(0,m.useState)(""),ln=!1,an=ln?u.MM:u.wV,Ut=ln?So.__.Widgets:So.__.Visualizations,Un=(0,m.useMemo)(()=>new ca(lt),[lt]),[Nn,Pa]=(0,Hr.A)(an,Ut),qn=[{label:"Visualizations",value:So.__.Visualizations},{label:"Suggestions",value:So.__.Suggestions}],Wa=ls=>{Oe.changePluginType(ls.pluginId),je()};return m.createElement("div",{className:bt.wrapper},m.createElement(Gi.Z,{className:bt.filter,value:Ft,onChange:Kt,autoFocus:!0,placeholder:"Search for..."}),m.createElement(T.D,{className:bt.customFieldMargin},m.createElement(Gr.z,{options:qn,value:Nn,onChange:Pa,fullWidth:!0})),m.createElement(Ge.E,{autoHeightMin:"100%"},Nn===So.__.Visualizations&&m.createElement(Tr.G,{pluginId:lt.state.pluginId,searchQuery:Ft,onChange:Wa}),Nn===So.__.Suggestions&&m.createElement(si.a,{onChange:Wa,searchQuery:Ft,panel:Un,data:Ie})))}const Xi=Oe=>({wrapper:(0,De.css)({display:"flex",flexDirection:"column",flexGrow:1,padding:Oe.spacing(2,1),height:"100%",gap:Oe.spacing(2),border:`1px solid ${Oe.colors.border.weak}`,borderRight:"none",borderBottom:"none",borderTopLeftRadius:Oe.shape.radius.default}),customFieldMargin:(0,De.css)({marginBottom:Oe.spacing(1)}),filter:(0,De.css)({minHeight:Oe.spacing(4)})});class Ni extends r.Bs{constructor(Ie){super({searchQuery:"",listMode:mr.gs.All,...Ie}),this.onToggleVizPicker=()=>{this.setState({isVizPickerOpen:!this.state.isVizPickerOpen})},this.onSetSearchQuery=je=>{this.setState({searchQuery:je})},this.onSetListMode=je=>{this.setState({listMode:je})},this.onCollapsePane=()=>{r.jh.getAncestor(this,Bo).toggleOptionsPane()}}}Ni.Component=({model:Oe})=>{const{isVizPickerOpen:Ie,searchQuery:je,listMode:lt}=Oe.useState(),bt=r.jh.getAncestor(Oe,Bo),{optionsCollapsed:Ft,vizManager:Kt}=bt.useState(),{pluginId:ln}=Kt.state.panel.useState(),an=(0,He.of)(Zi);return Ft?m.createElement("div",{className:an.pane},m.createElement("div",{className:an.top},m.createElement(Z.I,{tooltip:"Open options pane",icon:"arrow-to-right",onClick:Oe.onCollapsePane,variant:"canvas",className:an.rotateIcon,"data-testid":R.Tp.components.PanelEditor.toggleVizOptions,"aria-label":"Open options pane"}))):m.createElement("div",{className:an.pane},!Ie&&m.createElement(m.Fragment,null,m.createElement("div",{className:an.top},m.createElement(yl,{pluginId:ln,onOpen:Oe.onToggleVizPicker,isOpen:Ie,onTogglePane:Oe.onCollapsePane}),m.createElement(Gi.Z,{className:an.searchOptions,value:je,placeholder:"Search options",onChange:Oe.onSetSearchQuery})),m.createElement("div",{className:an.listOfOptions},m.createElement(ai,{vizManager:Kt,searchQuery:je,listMode:lt}))),Ie&&m.createElement(Ji,{vizManager:Kt,onChange:Oe.onToggleVizPicker}))};function Zi(Oe){return{pane:(0,De.css)({display:"flex",flexDirection:"column",flexGrow:"1",borderLeft:`1px solid ${Oe.colors.border.weak}`,background:Oe.colors.background.primary}),top:(0,De.css)({display:"flex",flexDirection:"column",padding:Oe.spacing(2,1),gap:Oe.spacing(2)}),listOfOptions:(0,De.css)({display:"flex",flexDirection:"column",flexGrow:"1",overflow:"auto"}),searchOptions:(0,De.css)({minHeight:Oe.spacing(4)}),searchWrapper:(0,De.css)({padding:Oe.spacing(2,2,2,0)}),vizField:(0,De.css)({marginBottom:Oe.spacing(1)}),rotateIcon:(0,De.css)({rotate:"180deg"})}}function yl({pluginId:Oe,onOpen:Ie,isOpen:je,onTogglePane:lt}){const bt=(0,He.of)(Dl),Ft=(0,m.useMemo)(()=>(0,ji.A4)().filter(Kt=>Kt.id===Oe)[0],[Oe]);return m.createElement(M.B,{gap:1},m.createElement(Z.I,{className:bt.vizButton,tooltip:"Click to change visualization",imgSrc:Ft.info.logos.small,onClick:Ie,"data-testid":R.Tp.components.PanelEditor.toggleVizPicker,"aria-label":"Change Visualization",variant:"canvas",isOpen:!1,fullWidth:!0},Ft.name))}function Dl(Oe){return{vizButton:(0,De.css)({textAlign:"left"})}}var qr=e(581),vr=e(19347),wi=e(84423),Ei=e(47311),Pl=e(93117);class es extends r.Bs{constructor(Ie){super({panel:Ie}),this._cachedPluginOptions={},this.addActivationHandler(()=>this._onActivate())}_onActivate(){this.loadDataSource()}async loadDataSource(){if(!this.state.panel.state.$data)return;let je=this.queryRunner.state.datasource;if(je)try{const lt=await(0,vr.l)().get(je),bt=(0,vr.l)().getInstanceSettings(je);lt&&bt&&(this.setState({datasource:lt,dsSettings:bt}),(0,Ei.tw)({type:bt.type,uid:bt.uid}))}catch(lt){console.error(lt)}}changePluginType(Ie){const{options:je,fieldConfig:lt,pluginId:bt,...Ft}=r.Go.cloneSceneObjectState(this.state.panel.state);let Kt={...lt};Kt.defaults={...Kt.defaults,custom:{}},Kt.overrides=(0,qr.aW)(Kt.overrides,qr.nx),this._cachedPluginOptions[bt]={options:je,fieldConfig:lt};const ln=this._cachedPluginOptions[Ie]?.options,an=this._cachedPluginOptions[Ie]?.fieldConfig;an&&(Kt=(0,qr.H9)(Kt,an));const Ut=new r.Eb({options:ln??{},fieldConfig:Kt,pluginId:Ie,...Ft});if(!Ft.$data&&!gt.$.panels[Ie].skipDataQuery){let qn=(0,re.CW)((0,hn.YQ)(this).state.uid)?.datasourceUid;qn||(qn=gt.$.defaultDatasource),Ut.setState({$data:new r.Es({$data:new r.dt({datasource:{uid:qn},queries:[{refId:"A"}]}),transformations:[]})})}const Un=Ut.getPlugin(),Nn={title:Ut.state.title,options:Ut.state.options,fieldConfig:Ut.state.fieldConfig,id:1,type:Ie},Pa=Un?.onPanelTypeChanged?.(Nn,bt,je,lt);Pa&&Ut.onOptionsChange(Pa,!0),Un?.onPanelMigration&&Ut.setState({pluginVersion:(0,wi.Ar)(Un)}),this.setState({panel:Ut}),this.loadDataSource()}async changePanelDataSource(Ie,je){const{dsSettings:lt}=this.state,bt=this.queryRunner,Ft=lt?await(0,vr.l)().get({uid:lt.uid}):void 0,Kt=await(0,vr.l)().get({uid:Ie.uid}),ln=bt.state.queries,an=je||await(0,Pl.y)(Kt,Ie.uid,ln,Ft);bt.setState({datasource:{type:Ie.type,uid:Ie.uid},queries:an}),je&&bt.runQueries(),this.loadDataSource()}changeQueryOptions(Ie){const je=this.state.panel,lt=this.queryRunner;let bt=r.jh.getTimeRange(je);const Ft={},Kt={};Ie.maxDataPoints!==lt.state.maxDataPoints&&(Ft.maxDataPoints=Ie.maxDataPoints??void 0),Ie.minInterval!==lt.state.minInterval&&Ie.minInterval!==null&&(Ft.minInterval=Ie.minInterval),Ie.timeRange&&(Kt.timeFrom=Ie.timeRange.from??void 0,Kt.timeShift=Ie.timeRange.shift??void 0,Kt.hideTimeOverride=Ie.timeRange.hide),bt instanceof Ia.v?Kt.timeFrom!==void 0||Kt.timeShift!==void 0?bt.setState(Kt):je.setState({$timeRange:void 0}):je.setState({$timeRange:new Ia.v(Kt)}),Ie.cacheTimeout!==lt?.state.cacheTimeout&&(Ft.cacheTimeout=Ie.cacheTimeout),Ie.queryCachingTTL!==lt?.state.queryCachingTTL&&(Ft.queryCachingTTL=Ie.queryCachingTTL),lt.setState(Ft),lt.runQueries()}changeQueries(Ie){this.queryRunner.setState({queries:Ie})}changeTransformations(Ie){const je=this.dataTransformer;je.setState({transformations:Ie}),je.reprocessTransformations()}inspectPanel(){const Ie=this.state.panel,je=(0,hn.Cs)(Ie);s.Ny.partial({inspect:je,inspectTab:"query"})}get queryRunner(){const Ie=(0,hn.un)(this.state.panel);if(!Ie)throw new Error("Query runner not found");return Ie}get dataTransformer(){const Ie=this.state.panel.state.$data;if(!Ie||!(Ie instanceof r.Es))throw new Error("Could not find SceneDataTransformer for panel");return Ie}get panelData(){return this.state.panel.state.$data}}es.Component=({model:Oe})=>{const{panel:Ie}=Oe.useState(),je=(0,He.of)(Go);return m.createElement("div",{className:je.wrapper},m.createElement(Ie.Component,{model:Ie}))};function Go(Oe){return{wrapper:(0,De.css)({height:"100%",width:"100%",paddingLeft:Oe.spacing(2)})}}class Bo extends r.Bs{constructor(Ie){super(Ie),this._discardChanges=!1,this.onDiscard=()=>{this._discardChanges=!0,s.Ny.partial({editPanel:null})},this.onOptionsPaneResizing=(je,lt)=>{if(je<=0&<<=0)return;const bt=lt/je*(1-je);this.state.optionsCollapsed&&bt>qi&&this.setState({optionsCollapsed:!1}),!this.state.optionsCollapsed&&bt<qi&&this.setState({optionsCollapsed:!0})},this.onOptionsPaneSizeChanged=(je,lt)=>{if(je<=0&<<=0)return;const bt=1-je,Ft=this.state.optionsPaneSize===0,Kt=lt/je,ln=el/Kt;this.state.optionsCollapsed?Ft?this.setState({optionsPaneSize:Math.max(bt,ln),optionsCollapsed:!1}):this.setState({optionsPaneSize:0}):Ft&&this.setState({optionsPaneSize:bt})},this.addActivationHandler(this._activationHandler.bind(this))}_activationHandler(){const Ie=this.state.vizManager,je=Ie.state.panel;return this._subs.add(Ie.subscribeToState((lt,bt)=>{lt.panel.state.pluginId!==bt.panel.state.pluginId&&this._initDataPane(lt.panel.state.pluginId)})),this._initDataPane(je.state.pluginId),()=>{this._discardChanges||this.commitChanges()}}_initDataPane(Ie){const je=gt.$.panels[Ie].skipDataQuery;je&&this.state.dataPane&&(s.Ny.partial({tab:null},!0),this.setState({dataPane:void 0})),!je&&!this.state.dataPane&&this.setState({dataPane:new To(this.state.vizManager)})}getUrlKey(){return this.state.panelId.toString()}getPageNav(Ie,je){return{text:"Edit panel",parentItem:(0,hn.YQ)(this).getPageNav(Ie,je)}}commitChanges(){const Ie=(0,hn.YQ)(this),je=(0,hn.vL)(Ie.state.body,(0,hn.XA)(this.state.panelId));Ie.state.isEditing||Ie.onEnterEditMode(),je.parent instanceof r.M$&&je.parent.setState({body:this.state.vizManager.state.panel.clone()})}toggleOptionsPane(){this.setState({optionsCollapsed:!this.state.optionsCollapsed,optionsPaneSize:jo})}}Bo.Component=ko;const qi=300,el=400,jo=.25;function Cl(Oe){const Ie=Oe.clone(),je=new es(Ie);return new Bo({panelId:(0,hn.Cs)(Oe),optionsPane:new Ni({}),vizManager:je,optionsPaneSize:jo})}var yi=e(22391),uo=e(38477);class Fi{constructor(Ie){this._scene=Ie}getKeys(){return["editIndex"]}getUrlState(){const Ie=this._scene.state;return{editIndex:Ie.editIndex!==void 0?String(Ie.editIndex):void 0}}updateFromUrl(Ie){let je={};typeof Ie.editIndex=="string"?je={editIndex:Number(Ie.editIndex)}:je={editIndex:void 0},Object.keys(je).length>0&&this._scene.setState(je)}}var tl=e(84167),mo=e(77268),Wi=e(82241),fr=e(51612),Eo=e(46502);const eo="New annotation",xo=({annotation:Oe,editIndex:Ie,panels:je,onUpdate:lt,onBackToList:bt,onDelete:Ft})=>{const Kt=(0,He.of)(fo),ln=(0,m.useMemo)(()=>Oe.filter?Oe.filter.exclude?2:1:0,[Oe.filter]),{value:an}=(0,vo.A)(()=>(0,vr.l)().get(Oe.datasource),[Oe.datasource]),Ut=(0,vr.l)().getInstanceSettings(Oe.datasource),Un=La=>{lt({...Oe,name:La.currentTarget.value},Ie)},Nn=La=>{const js=(0,yi.p$)(La);Oe.datasource?.type!==js.type?lt({datasource:js,builtIn:Oe.builtIn,enable:Oe.enable,iconColor:Oe.iconColor,name:Oe.name,hide:Oe.hide,filter:Oe.filter,mappings:Oe.mappings,type:Oe.type},Ie):lt({...Oe,datasource:js},Ie)},Pa=La=>{const js=La.currentTarget;lt({...Oe,[js.name]:js.type==="checkbox"?js.checked:js.value},Ie)},qn=La=>{lt({...Oe,iconColor:La},Ie)},Wa=La=>{let js=La.value===0?void 0:{exclude:La.value===2,ids:Oe.filter?.ids??[]};lt({...Oe,filter:js},Ie)},ls=La=>{if(!Array.isArray(La))return;const js={exclude:ln===2,ids:[]};La.forEach(rl=>rl.value&&js.ids.push(rl.value)),lt({...Oe,filter:js},Ie)},fs=()=>{Ft(Ie),bt()},ms=Oe.name===eo,tr=(La,js)=>La.label&&js.label?La.label.toLowerCase().localeCompare(js.label.toLowerCase()):-1,Bs=(0,m.useMemo)(()=>je.filter(La=>gt.$.panels[La.state.pluginId]).map(La=>({value:(0,hn.Cs)(La),label:La.state.title??`Panel ${(0,hn.Cs)(La)}`,description:La.state.description,imgUrl:gt.$.panels[La.state.pluginId].info.logos.small})).sort(tr)??[],[je]);return m.createElement("div",null,m.createElement(tl.n,{className:Kt.settingsForm},m.createElement(T.D,{label:"Name"},m.createElement(I.p,{"data-testid":R.Tp.pages.Dashboard.Settings.Annotations.Settings.name,name:"name",id:"name",autoFocus:ms,value:Oe.name,onChange:Un})),m.createElement(T.D,{label:"Data source",htmlFor:"data-source-picker"},m.createElement(fr.s,{annotations:!0,variables:!0,current:Oe.datasource,onChange:Nn})),m.createElement(T.D,{label:"Enabled",description:"When enabled the annotation query is issued every dashboard refresh"},m.createElement(ie.S,{name:"enable",id:"enable",value:Oe.enable,onChange:Pa,"data-testid":R.Tp.pages.Dashboard.Settings.Annotations.NewAnnotation.enable})),m.createElement(T.D,{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."},m.createElement(ie.S,{name:"hide",id:"hide",value:Oe.hide,onChange:Pa,"data-testid":R.Tp.pages.Dashboard.Settings.Annotations.NewAnnotation.hide})),m.createElement(T.D,{label:"Color",description:"Color to use for the annotation event markers"},m.createElement(ia.Gy,null,m.createElement(mo.a,{value:Oe?.iconColor,onChange:qn}))),m.createElement(T.D,{label:"Show in","data-testid":R.Tp.pages.Dashboard.Settings.Annotations.NewAnnotation.showInLabel},m.createElement(m.Fragment,null,m.createElement(pa.l6,{options:bl,value:ln,onChange:Wa,"data-testid":R.Tp.components.Annotations.annotationsTypeInput}),ln!==0&&m.createElement(pa.KF,{options:Bs,value:Bs.filter(La=>Oe.filter?.ids.includes(La.value)),onChange:ls,isClearable:!0,placeholder:"Choose panels",width:100,closeMenuOnSelect:!1,className:Kt.select,"data-testid":R.Tp.components.Annotations.annotationsChoosePanelInput})))),m.createElement(tl.n,null,m.createElement("h3",{className:"page-heading"},"Query"),an?.annotations&&Ut&&m.createElement(Wi.A,{datasource:an,datasourceInstanceSettings:Ut,annotation:Oe,onChange:La=>lt(La,Ie)}),an&&!an.annotations&&m.createElement(Eo.F,{datasource:an,annotation:Oe,onChange:La=>lt(La,Ie)})),m.createElement(M.B,null,!Oe.builtIn&&m.createElement(C.$n,{variant:"destructive",onClick:fs,"data-testid":R.Tp.pages.Dashboard.Settings.Annotations.NewAnnotation.delete},"Delete"),m.createElement(C.$n,{variant:"secondary",onClick:bt,"data-testid":R.Tp.pages.Dashboard.Settings.Annotations.NewAnnotation.apply},"Back to list")))},fo=Oe=>({settingsForm:(0,De.css)({maxWidth:Oe.spacing(60),marginBottom:Oe.spacing(2)}),select:(0,De.css)({marginTop:"8px"})});var Ki=(Oe=>(Oe[Oe.AllPanels=0]="AllPanels",Oe[Oe.IncludePanels=1]="IncludePanels",Oe[Oe.ExcludePanels=2]="ExcludePanels",Oe))(Ki||{});const bl=[{label:"All panels",value:0,description:"Send the annotation data to all panels that support annotations"},{label:"Selected panels",value:1,description:"Send the annotations to the explicitly listed panels"},{label:"All panels except",value:2,description:"Do not send annotation data to the following panels"}];var ri=e(91605),Uo=e(7521),$i=e(46991);const Tl="Add annotation query",nl=({annotations:Oe,onNew:Ie,onEdit:je,onMove:lt,onDelete:bt})=>{const Ft=(0,He.of)(Di),Kt=Oe.length===0||Oe.length===1&&Oe[0].builtIn,ln=Ut=>Ut.enable===!1?m.createElement("em",{className:"muted"},"(Disabled) \xA0 ",Ut.name):Ut.builtIn?m.createElement("em",{className:"muted"},Ut.name," \xA0 (Built-in)"):m.createElement(m.Fragment,null,Ut.name),an=(0,vr.l)();return m.createElement(ia.gW,null,Oe.length>0&&m.createElement("div",{className:Ft.table},m.createElement("table",{role:"grid",className:"filter-table filter-table--hover"},m.createElement("thead",null,m.createElement("tr",null,m.createElement("th",null,"Query name"),m.createElement("th",null,"Data source"),m.createElement("th",{colSpan:3}))),m.createElement("tbody",{"data-testid":R.Tp.pages.Dashboard.Settings.Annotations.List.annotations},Oe.map((Ut,Un)=>m.createElement("tr",{key:`${Ut.name}-${Un}`},Ut.builtIn?m.createElement("td",{role:"gridcell",style:{width:"90%"},className:"pointer",onClick:()=>je(Un)},m.createElement(C.$n,{size:"sm",fill:"text",variant:"secondary"},ln(Ut))):m.createElement("td",{role:"gridcell",className:"pointer",onClick:()=>je(Un)},m.createElement(C.$n,{size:"sm",fill:"text",variant:"secondary"},ln(Ut))),m.createElement("td",{role:"gridcell",className:"pointer",onClick:()=>je(Un)},an.getInstanceSettings(Ut.datasource)?.name||Ut.datasource?.uid),m.createElement("td",{role:"gridcell",style:{width:"1%"}},Un!==0&&m.createElement(Vs.K,{name:"arrow-up",onClick:()=>lt(Un,No.UP),tooltip:"Move up"})),m.createElement("td",{role:"gridcell",style:{width:"1%"}},Oe.length>1&&Un!==Oe.length-1?m.createElement(Vs.K,{name:"arrow-down",onClick:()=>lt(Un,No.DOWN),tooltip:"Move down"}):null),m.createElement("td",{role:"gridcell",style:{width:"1%"}},!Ut.builtIn&&m.createElement(ri.e,{size:"sm",onConfirm:()=>bt(Un),"aria-label":`Delete query with title "${Ut.name}"`}))))))),Kt&&m.createElement(Uo.A,{onClick:Ie,title:"There are no custom annotation queries added yet",buttonIcon:"comment-alt",buttonTitle:Tl,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.`}}),!Kt&&m.createElement($i.d,{onClick:Ie},"New query"))},Di=()=>({table:(0,De.css)({width:"100%",overflowX:"scroll"})});var No=(Oe=>(Oe[Oe.UP=-1]="UP",Oe[Oe.DOWN=1]="DOWN",Oe))(No||{});class Vi extends r.Bs{constructor(){super(...arguments),this._urlSync=new Fi(this),this.onNew=()=>{const Ie={name:eo,enable:!0,datasource:(0,yi.p$)((0,vr.l)().getInstanceSettings(null)),iconColor:"red"},je=new uo.g({key:`annotations-${Ie.name}`,query:Ie,name:Ie.name,isEnabled:!!Ie.enable,isHidden:!!Ie.hide}),lt=Rt.b.getDataLayers(this._dashboard),bt=[...lt.state.layers];bt.splice(this.getAnnotationsLength(),0,je),lt.setState({layers:bt}),je.activate(),this.setState({editIndex:this.getAnnotationsLength()-1})},this.onEdit=Ie=>{this.setState({editIndex:Ie})},this.onBackToList=()=>{this.setState({editIndex:void 0})},this.onMove=(Ie,je)=>{const lt=Rt.b.getDataLayers(this._dashboard),bt=[...lt.state.layers],[Ft]=bt.splice(Ie,1);bt.splice(Ie+je,0,Ft),lt.setState({layers:bt})},this.onDelete=Ie=>{const je=Rt.b.getDataLayers(this._dashboard),lt=[...je.state.layers];lt.splice(Ie,1),je.setState({layers:lt})},this.onUpdate=(Ie,je)=>{const lt=this.getDataLayer(je);lt.setState({key:`annotations-${Ie.name}`,name:Ie.name,isEnabled:!!Ie.enable,isHidden:!!Ie.hide,query:Ie}),lt.runLayer()}}getUrlKey(){return"annotations"}get _dashboard(){return(0,hn.YQ)(this)}getDataLayer(Ie){const lt=Rt.b.getDataLayers(this._dashboard).state.layers[Ie];if(!(lt instanceof r.tV.g))throw new Error("AnnotationsDataLayer not found at index "+Ie);return lt}getAnnotationsLength(){return Rt.b.getDataLayers(this._dashboard).state.layers.filter(Ie=>Ie.topic===sa.QR.Annotations).length}getDashboard(){return this._dashboard}}Vi.Component=Yo;function Yo({model:Oe}){const Ie=Oe.getDashboard(),{layers:je}=Rt.b.getDataLayers(Ie).useState(),{navModel:lt,pageNav:bt}=Jo(Ie,Oe.getUrlKey()),{editIndex:Ft}=Oe.useState(),Kt=Rt.b.getVizPanels(Ie),ln=(0,fn.O)(je);return Ft!=null&&Ft<Oe.getAnnotationsLength()?m.createElement(Ze,{annotationLayer:Oe.getDataLayer(Ft),pageNav:bt,panels:Kt,editIndex:Ft,navModel:lt,dashboard:Ie,onUpdate:Oe.onUpdate,onBackToList:Oe.onBackToList,onDelete:Oe.onDelete}):m.createElement(xe.Y,{navModel:lt,pageNav:bt,layout:Xe.k.Standard},m.createElement(zt,{dashboard:Ie}),m.createElement(nl,{annotations:ln,onNew:Oe.onNew,onEdit:Oe.onEdit,onDelete:Oe.onDelete,onMove:Oe.onMove}))}function Ze({annotationLayer:Oe,pageNav:Ie,navModel:je,panels:lt,editIndex:bt,dashboard:Ft,onUpdate:Kt,onBackToList:ln,onDelete:an}){const Ut=Ie.children.find(qn=>qn.active);Ut.parentItem=Ie;const{name:Un,query:Nn}=Oe.useState(),Pa={text:Un,parentItem:Ut};return m.createElement(xe.Y,{navModel:je,pageNav:Pa,layout:Xe.k.Standard},m.createElement(zt,{dashboard:Ft}),m.createElement(xo,{annotation:Nn,editIndex:bt,panels:lt,onUpdate:Kt,onBackToList:ln,onDelete:an}))}var et=e(14588),tt=e(65857),dt=e(6199),xt=e(4588);class Wt extends r.Bs{constructor(){super(...arguments),this._urlSync=new Fi(this),this.onNewLink=()=>{this.links=[...this.links,xt.q],this.setState({editIndex:this.links.length-1})},this.onDelete=Ie=>{this.links=[...this.links.slice(0,Ie),...this.links.slice(Ie+1)],this.setState({editIndex:void 0})},this.onDuplicate=Ie=>{this.links=[...this.links,{...Ie}]},this.onOrderChange=(Ie,je)=>{this.links=et.moveItemImmutably(this.links,Ie,Ie+je)},this.onEdit=Ie=>{this.setState({editIndex:Ie})},this.onUpdateLink=Ie=>{const je=this.state.editIndex;je!==void 0&&(this.links=[...this.links.slice(0,je),Ie,...this.links.slice(je+1)])},this.onGoBack=()=>{this.setState({editIndex:void 0})}}getUrlKey(){return"links"}get dashboard(){return(0,hn.YQ)(this)}get links(){return this.dashboard.state.links}set links(Ie){this.dashboard.setState({links:Ie})}}Wt.Component=Vt;function Vt({model:Oe}){const{editIndex:Ie}=Oe.useState(),je=(0,hn.YQ)(Oe),{links:lt,overlay:bt}=je.useState(),{navModel:Ft,pageNav:Kt}=Jo(je,Oe.getUrlKey()),ln=Ie!==void 0?lt[Ie]:void 0;return ln?m.createElement(en,{pageNav:Kt,navModel:Ft,link:ln,dashboard:je,onChange:Oe.onUpdateLink,onGoBack:Oe.onGoBack}):m.createElement(xe.Y,{navModel:Ft,pageNav:Kt,layout:Xe.k.Standard},m.createElement(zt,{dashboard:je}),m.createElement(dt.X,{links:lt,onNew:Oe.onNewLink,onEdit:Oe.onEdit,onDelete:Oe.onDelete,onDuplicate:Oe.onDuplicate,onOrderChange:Oe.onOrderChange}),bt&&m.createElement(bt.Component,{model:bt}))}function en({pageNav:Oe,link:Ie,navModel:je,dashboard:lt,onChange:bt,onGoBack:Ft}){const Kt=Oe.children.find(an=>an.active);Kt.parentItem=Oe;const ln={text:"Edit link",parentItem:Kt};return m.createElement(xe.Y,{navModel:je,pageNav:ln,layout:Xe.k.Standard},m.createElement(zt,{dashboard:lt}),m.createElement(tt.d,{link:Ie,onUpdate:bt,onGoBack:Ft}))}var dn=e(79924),yn=e(57418),Vn=e(75590),aa=e(39712);const Gn=[{label:"Editable",value:!0},{label:"Read-only",value:!1}],ta=[{value:0,label:"Default"},{value:1,label:"Shared crosshair"},{value:2,label:"Shared Tooltip"}];class Sa extends r.Bs{constructor(){super(...arguments),this.onTitleChange=Ie=>{this._dashboard.setState({title:Ie})},this.onDescriptionChange=Ie=>{this._dashboard.setState({description:Ie})},this.onTagsChange=Ie=>{this._dashboard.setState({tags:Ie})},this.onFolderChange=(Ie,je)=>{const lt={...this._dashboard.state.meta,folderUid:Ie||this._dashboard.state.meta.folderUid,folderTitle:je||this._dashboard.state.meta.folderTitle,hasUnsavedFolderChange:!0};this._dashboard.setState({meta:lt})},this.onEditableChange=Ie=>{this._dashboard.setState({editable:Ie})},this.onTimeZoneChange=Ie=>{this.getTimeRange().setState({timeZone:Ie})},this.onWeekStartChange=Ie=>{this.getTimeRange().setState({weekStart:Ie})},this.onRefreshIntervalChange=Ie=>{this.getRefreshPicker()?.setState({intervals:Ie})},this.onNowDelayChange=Ie=>{this.getTimeRange()?.setState({UNSAFE_nowDelay:Ie})},this.onHideTimePickerChange=Ie=>{this.getDashboardControls()?.setState({hideTimeControls:Ie})},this.onLiveNowChange=Ie=>{},this.onTooltipChange=Ie=>{this.getCursorSync()?.setState({sync:Ie})}}get _dashboard(){return(0,hn.YQ)(this)}getUrlKey(){return"settings"}getDashboard(){return this._dashboard}getTimeRange(){return r.jh.getTimeRange(this._dashboard)}getRefreshPicker(){return Rt.b.getRefreshPicker(this._dashboard)}getCursorSync(){const Ie=this._dashboard.state.$behaviors?.find(je=>je instanceof r.Gg.K2);if(Ie instanceof r.Gg.K2)return Ie}getDashboardControls(){return Rt.b.getDashboardControls(this._dashboard)}}Sa.Component=({model:Oe})=>{const{navModel:Ie,pageNav:je}=Jo(Oe.getDashboard(),Oe.getUrlKey()),{title:lt,description:bt,tags:Ft,meta:Kt,editable:ln}=Oe.getDashboard().useState(),{sync:an}=Oe.getCursorSync()?.useState()||{},{timeZone:Ut,weekStart:Un,UNSAFE_nowDelay:Nn}=Oe.getTimeRange().useState(),{intervals:Pa}=Oe.getRefreshPicker()?.useState()||{},{hideTimeControls:qn}=Oe.getDashboardControls()?.useState()||{};return m.createElement(xe.Y,{navModel:Ie,pageNav:je,layout:Xe.k.Standard},m.createElement(zt,{dashboard:Oe.getDashboard()}),m.createElement("div",{style:{maxWidth:"600px"}},m.createElement(O.a,{marginBottom:5},m.createElement(T.D,{label:m.createElement(ia.Gy,{justify:"space-between"},m.createElement(P.J,{htmlFor:"title-input"},m.createElement(Ne.x6,{i18nKey:"dashboard-settings.general.title-label"},"Title")))},m.createElement(I.p,{id:"title-input",name:"title",defaultValue:lt,onBlur:Wa=>Oe.onTitleChange(Wa.target.value)})),m.createElement(T.D,{label:m.createElement(ia.Gy,{justify:"space-between"},m.createElement(P.J,{htmlFor:"description-input"},(0,Ne.t)("dashboard-settings.general.description-label","Description")))},m.createElement(x.f,{id:"description-input",name:"description",defaultValue:bt,onBlur:Wa=>Oe.onDescriptionChange(Wa.target.value)})),m.createElement(T.D,{label:(0,Ne.t)("dashboard-settings.general.tags-label","Tags")},m.createElement(dn.u,{id:"tags-input",tags:Ft,onChange:Oe.onTagsChange,width:40})),m.createElement(T.D,{label:(0,Ne.t)("dashboard-settings.general.folder-label","Folder")},m.createElement(L.d,{value:Kt.folderUid,onChange:Oe.onFolderChange,initialTitle:Kt.folderTitle,inputId:"dashboard-folder-input",enableCreateNew:!0,skipInitialLoad:!0})),m.createElement(T.D,{label:(0,Ne.t)("dashboard-settings.general.editable-label","Editable"),description:(0,Ne.t)("dashboard-settings.general.editable-description","Set to read-only to disable all editing. Reload the dashboard for changes to take effect")},m.createElement(Gr.z,{value:ln,options:Gn,onChange:Oe.onEditableChange}))),m.createElement(Vn.p,{onTimeZoneChange:Oe.onTimeZoneChange,onWeekStartChange:Oe.onWeekStartChange,onRefreshIntervalChange:Oe.onRefreshIntervalChange,onNowDelayChange:Oe.onNowDelayChange,onHideTimePickerChange:Oe.onHideTimePickerChange,onLiveNowChange:Oe.onLiveNowChange,refreshIntervals:Pa,timePickerHidden:qn,nowDelay:Nn||"",liveNow:!1,timezone:Ut||"",weekStart:Un||""}),m.createElement(yn.M,{label:(0,Ne.t)("dashboard-settings.general.panel-options-label","Panel options"),isOpen:!0},m.createElement(T.D,{label:(0,Ne.t)("dashboard-settings.general.panel-options-graph-tooltip-label","Graph tooltip"),description:(0,Ne.t)("dashboard-settings.general.panel-options-graph-tooltip-description","Controls tooltip and hover highlight behavior across different panels. Reload the dashboard for changes to take effect")},m.createElement(Gr.z,{onChange:Oe.onTooltipChange,options:ta,value:an}))),m.createElement(O.a,{marginTop:3},Kt.canDelete&&m.createElement(aa.c,null))))};var ga=e(81156);class Fa extends r.Bs{constructor(Ie){super({...Ie,jsonText:""}),this.onCodeEditorBlur=je=>{this.setState({jsonText:je})},this.onApplyChange=()=>{const je=JSON.parse(this.state.jsonText),lt=this.getDashboard(),bt={dashboard:je,meta:lt.state.meta},Ft=(0,ft.wM)(bt),Kt=r.Go.cloneSceneObjectState(Ft.state);lt.setState(Kt)},this.addActivationHandler(()=>this.setState({jsonText:this.getJsonText()}))}getUrlKey(){return"json-model"}getDashboard(){return(0,hn.YQ)(this)}getSaveModel(){const Ie=this.getDashboard();return(0,Le.Uy)(Ie)}getJsonText(){const Ie=this.getSaveModel();return(0,qs.p)(Ie)}}Fa.Component=({model:Oe})=>{const Ie=Oe.getDashboard(),{navModel:je,pageNav:lt}=Jo(Ie,Oe.getUrlKey()),bt=Ie.useState().meta.canSave,{jsonText:Ft}=Oe.useState(),Kt=(0,He.of)(da),ln=Oe.getSaveModel();return m.createElement(xe.Y,{navModel:je,pageNav:lt,layout:Xe.k.Standard},m.createElement(zt,{dashboard:Ie}),m.createElement("div",{className:Kt.wrapper},m.createElement(Ne.x6,{i18nKey:"dashboard-settings.json-editor.subtitle"},"The JSON model below is the data structure that defines the dashboard. This includes dashboard settings, panel settings, layout, queries, and so on."),m.createElement(ga.A,{dashboard:ln}),m.createElement(Ee.B,{width:"100%",value:Ft,language:"json",showLineNumbers:!0,showMiniMap:!0,containerStyles:Kt.codeEditor,onBlur:Oe.onCodeEditorBlur}),bt&&m.createElement("div",null,m.createElement(C.$n,{type:"submit",onClick:Oe.onApplyChange},m.createElement(Ne.x6,{i18nKey:"dashboard-settings.json-editor.apply-button"},"Apply changes")))))};const da=Oe=>({wrapper:(0,De.css)({display:"flex",height:"100%",flexDirection:"column",gap:Oe.spacing(2)}),codeEditor:(0,De.css)({flexGrow:1})});var Ua=e(5108);class wa extends r.Bs{get _dashboard(){return(0,hn.YQ)(this)}getUrlKey(){return"permissions"}getDashboard(){return this._dashboard}}wa.Component=va;function va({model:Oe}){const Ie=Oe.getDashboard(),{uid:je}=Ie.useState(),{navModel:lt,pageNav:bt}=Jo(Ie,Oe.getUrlKey()),Ft=Ve.TP.hasPermission(ee.AccessControlAction.DashboardsPermissionsWrite);return m.createElement(xe.Y,{navModel:lt,pageNav:bt,layout:Xe.k.Standard},m.createElement(zt,{dashboard:Ie}),m.createElement(Ua.x,{resource:"dashboards",resourceId:je??"",canSetPermissions:Ft}))}var Ja=e(75505),Xa=e(79422),ys=e(71678),Hs=e(8964),Gs=e(58975),As=e(85140),Er=e(14329),Mr=e(41820),_s=e(85830),er=e(89458),Kr=e(27803);function $r(Oe){const{variable:Ie}=Oe,je=Ie.useState().datasource??void 0,{value:lt}=(0,vo.A)(async()=>await(0,vr.l)().get(je),[je]),bt=lt?.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.",Ft=Kt=>{const ln={uid:Kt.uid,type:Kt.type};Ie.setState({datasource:ln})};return m.createElement(Kr.Q,{datasource:je,infoText:bt,onDataSourceChange:Ft})}var Sr=e(95802);function us({variable:Oe}){const{value:Ie}=Oe.useState(),je=lt=>{Oe.setState({value:lt.currentTarget.value})};return m.createElement(Sr.d,{constantValue:String(Ie),onChange:je})}var Zn=e(58711);function fa({variable:Oe,onRunQuery:Ie}){const{query:je,isMulti:lt,allValue:bt,includeAll:Ft}=Oe.useState(),Kt=Un=>{Oe.setState({isMulti:Un.currentTarget.checked})},ln=Un=>{Oe.setState({includeAll:Un.currentTarget.checked})},an=Un=>{Oe.setState({query:Un.currentTarget.value}),Ie()},Ut=Un=>{Oe.setState({allValue:Un.currentTarget.value})};return m.createElement(Zn.w,{query:je??"",multi:!!lt,allValue:bt??"",includeAll:!!Ft,onMultiChange:Kt,onIncludeAllChange:ln,onQueryChange:an,onAllValueChange:Ut})}var ka=e(98917);function ss({variable:Oe,onRunQuery:Ie}){const{pluginId:je,regex:lt,isMulti:bt,allValue:Ft,includeAll:Kt}=Oe.useState(),ln=kl(),an=qn=>{Oe.setState({pluginId:qn.value}),Ie()},Ut=qn=>{Oe.setState({regex:qn.currentTarget.value}),Ie()},Un=qn=>{Oe.setState({isMulti:qn.currentTarget.checked})},Nn=qn=>{Oe.setState({includeAll:qn.currentTarget.checked})},Pa=qn=>{Oe.setState({allValue:qn.currentTarget.value})};return m.createElement(ka.y,{query:je,regex:lt,multi:bt||!1,allValue:Ft,includeAll:Kt||!1,optionTypes:ln,onChange:an,onRegExBlur:Ut,onMultiChange:Un,onIncludeAllChange:Nn,onAllValueChange:Pa})}var Rr=e(72436);function Js({datasource:Oe,defaultOptions:Ie,infoText:je,onDataSourceChange:lt,onDefaultOptionsChange:bt}){const Ft=(0,m.useCallback)(Kt=>{const ln=(0,Rr.Jh)(`key,value `+Kt)[0],an=[];for(let Ut=0;Ut<ln.length;Ut++)an.push({text:ln.fields[0].values[Ut],value:ln.fields[1].values[Ut]});bt(an)},[bt]);return m.createElement(m.Fragment,null,m.createElement(Gs.Y,null,"Group by options"),m.createElement(T.D,{label:"Data source",htmlFor:"data-source-picker"},m.createElement(fr.s,{current:Oe,onChange:lt,width:30,variables:!0,noDefault:!0})),je?m.createElement(y.F,{title:je,severity:"info","data-testid":R.Tp.pages.Dashboard.Settings.Variables.Edit.GroupByVariable.infoText}):null,m.createElement(T.D,{label:"Use static Group By dimensions",description:"Provide dimensions as CSV: dimensionId, dimensionName "},m.createElement(S.d,{"data-testid":R.Tp.pages.Dashboard.Settings.Variables.Edit.GroupByVariable.modeToggle,value:Ie!==void 0,onChange:Kt=>{bt(Ie===void 0?[]:void 0)}})),Ie!==void 0&&m.createElement(Ee.B,{height:300,language:"csv",value:Ie.map(Kt=>`${Kt.text},${Kt.value}`).join(` `),onBlur:Ft,onSave:Ft,showMiniMap:!1,showLineNumbers:!0}))}function gr(Oe){const{variable:Ie,onRunQuery:je}=Oe,{datasource:lt,defaultOptions:bt}=Ie.useState(),{value:Ft}=(0,vo.A)(async()=>await(0,vr.l)().get(lt),[Ie.state]),Kt=Ft?.getTagKeys?"Group by dimensions are applied automatically to all queries that target this data source":"This data source does not support group by variable yet.",ln=async Ut=>{const Un={uid:Ut.uid,type:Ut.type};Ie.setState({datasource:Un}),je()},an=async Ut=>{Ie.setState({defaultOptions:Ut}),je()};return m.createElement(Js,{defaultOptions:bt,datasource:lt??void 0,infoText:lt?Kt:void 0,onDataSourceChange:ln,onDefaultOptionsChange:an})}var rs=e(49317);function Fs({variable:Oe,onRunQuery:Ie}){const{intervals:je,autoStepCount:lt,autoEnabled:bt,autoMinInterval:Ft}=Oe.useState(),Kt=(0,hn.bx)(je),ln=Nn=>{const Pa=(0,hn.Sm)(Nn.currentTarget.value);Oe.setState({intervals:Pa}),Ie()},an=Nn=>{Oe.setState({autoStepCount:Nn.value})},Ut=Nn=>{Oe.setState({autoEnabled:Nn.target.checked})},Un=Nn=>{Oe.setState({autoMinInterval:Nn.currentTarget.value})};return m.createElement(rs.s,{intervals:Kt,autoStepCount:lt,autoEnabled:bt,onAutoCountChanged:an,onIntervalsChange:ln,onAutoEnabledChange:Ut,onAutoMinIntervalChanged:Un,autoMinInterval:Ft})}var Oo=e(44890);function Qo({variable:Oe,onRunQuery:Ie}){const{datasource:je,regex:lt,sort:bt,refresh:Ft,isMulti:Kt,includeAll:ln,allValue:an,query:Ut}=Oe.useState(),{value:Un}=r.jh.getTimeRange(Oe).useState(),Nn=Bs=>{Oe.setState({regex:Bs.currentTarget.value})},Pa=Bs=>{Oe.setState({sort:Bs.value})},qn=Bs=>{Oe.setState({refresh:Bs})},Wa=Bs=>{Oe.setState({isMulti:Bs.currentTarget.checked})},ls=Bs=>{Oe.setState({includeAll:Bs.currentTarget.checked})},fs=Bs=>{Oe.setState({allValue:Bs.currentTarget.value})},ms=Bs=>{const La={uid:Bs.uid,type:Bs.type};Oe.setState({datasource:La})},tr=Bs=>{Oe.setState({query:Bs}),Ie()};return m.createElement(Oo.u,{datasource:je??void 0,onDataSourceChange:ms,query:Ut,onQueryChange:tr,onLegacyQueryChange:tr,timeRange:Un,regex:lt,onRegExChange:Nn,sort:bt,onSortChange:Pa,refresh:Ft,onRefreshChange:qn,isMulti:!!Kt,onMultiChange:Wa,includeAll:!!ln,onIncludeAllChange:ls,allValue:an??"",onAllValueChange:fs})}function Pi({defaultValue:Oe,value:Ie,onChange:je,onBlur:lt}){return m.createElement(m.Fragment,null,m.createElement(Gs.Y,null,"Text options"),m.createElement(Er._,{value:Ie,defaultValue:Oe,name:"Default value",placeholder:"default value, if any",onChange:je,onBlur:lt,width:30,testId:R.Tp.pages.Dashboard.Settings.Variables.Edit.TextBoxVariable.textBoxOptionsQueryInputV2}))}function Es({variable:Oe}){const{value:Ie}=Oe.useState(),je=lt=>{Oe.setState({value:lt.currentTarget.value})};return m.createElement(Pi,{defaultValue:Ie,onBlur:je})}function Lr(Oe){return Oe!=="system"}const yo={custom:{name:"Custom",description:"Define variable values manually",editor:fa},query:{name:"Query",description:"Variable values are fetched from a datasource query",editor:Qo},constant:{name:"Constant",description:"Define a hidden constant variable, useful for metric prefixes in dashboards you want to share",editor:us},interval:{name:"Interval",description:"Define a timespan interval (ex 1m, 1h, 1d)",editor:Fs},datasource:{name:"Data source",description:"Enables you to dynamically switch the data source for multiple panels",editor:ss},adhoc:{name:"Ad hoc filters",description:"Add key/value filters on the fly",editor:$r},groupby:{name:"Group by",description:"Add keys to group by on the fly",editor:gr},textbox:{name:"Textbox",description:"Define a textbox variable, where users can enter any arbitrary string",editor:Es}},Do=["query","custom","textbox","constant","datasource","interval","adhoc","groupby"];function al(){const Oe=Do.map(Ie=>({label:yo[Ie].name,value:Ie,description:yo[Ie].description}));return gt.$.featureToggles.groupByVariable?Oe:Oe.filter(Ie=>Ie.value!=="groupby")}function cc(Oe){return yo[Oe].editor}function dc(Oe,Ie){switch(Oe){case"custom":return new r.yP(Ie);case"query":return new r.fS(Ie);case"constant":return new r.x0(Ie);case"interval":return new r.Yj(Ie);case"datasource":return new r.mI(Ie);case"adhoc":return new r.H9(Ie);case"groupby":return new r.ZG(Ie);case"textbox":return new r.TS(Ie)}}function _i(Oe){const je=oi("query",Oe);return new r.fS({name:je})}function oi(Oe,Ie){let je=0,lt=`${Oe}${je}`;for(;Ie.find(bt=>bt.state.name===lt);)lt=`${Oe}${++je}`;return lt}function zl(Oe){return"options"in Oe.state||"intervals"in Oe.state}function Ml(Oe){let Ie="";return Oe instanceof r.fS?Ie=Oe.state.definition||(typeof Oe.state.query=="string"?Oe.state.query:""):Oe instanceof r.mI?Ie=String(Oe.state.pluginId):Oe instanceof r.yP?Ie=Oe.state.query:Oe instanceof r.Yj?Ie=(0,hn.bx)(Oe.state.intervals):(Oe instanceof r.TS||Oe instanceof r.x0)&&(Ie=String(Oe.state.value)),Ie}function kl(){const Oe=(0,vr.l)().getList({metrics:!0,variables:!0}),Ie=(0,ye.chain)(Oe).uniqBy("meta.id").map(je=>({label:je.meta.name,value:je.meta.id})).value();return Ie.unshift({label:"",value:""}),Ie}function uc({onChange:Oe,type:Ie}){const je=(0,m.useMemo)(()=>al(),[]),lt=(0,m.useMemo)(()=>je.find(bt=>bt.value===Ie)??je[0],[je,Ie]);return m.createElement(er.v,{name:"Select variable type",value:lt,options:je,onChange:Oe,testId:R.Tp.pages.Dashboard.Settings.Variables.Edit.General.generalTypeSelectV2})}function mc({variable:Oe,onTypeChange:Ie,onGoBack:je,onDelete:lt}){const bt=(0,He.of)(Sl),{name:Ft,type:Kt,label:ln,description:an,hide:Ut}=Oe.useState(),Un=Lr(Kt)?cc(Kt):void 0,[Nn,Pa]=(0,_.A)(async()=>{await(0,Ja.s)(Oe.validateAndUpdate())},[Oe]),qn=La=>{La.value&&Ie(La.value)},Wa=La=>Oe.setState({name:La.currentTarget.value}),ls=La=>Oe.setState({label:La.currentTarget.value}),fs=La=>Oe.setState({description:La.currentTarget.value}),ms=La=>Oe.setState({hide:La}),tr=zl(Oe),Bs=La=>()=>{(0,K.rR)("Delete variable"),lt(Ft),La()};return m.createElement("form",{"aria-label":"Variable editor Form"},m.createElement(uc,{onChange:qn,type:Kt}),m.createElement(Gs.Y,null,"General"),m.createElement(Er._,{name:"Name",description:"The name of the template variable. (Max. 50 characters)",placeholder:"Variable name",defaultValue:Ft??"",onBlur:Wa,testId:R.Tp.pages.Dashboard.Settings.Variables.Edit.General.generalNameInputV2,maxLength:_s.M.MaxSize,required:!0}),m.createElement(Er._,{name:"Label",description:"Optional display name",placeholder:"Label name",defaultValue:ln??"",onBlur:ls,testId:R.Tp.pages.Dashboard.Settings.Variables.Edit.General.generalLabelInputV2}),m.createElement(As.Z,{name:"Description",defaultValue:an??"",placeholder:"Descriptive text",onBlur:fs,width:52}),m.createElement(Hs.D,{onChange:ms,hide:Ut||Xa.rw.hide,type:Kt}),Un&&m.createElement(Un,{variable:Oe,onRunQuery:Pa}),tr&&m.createElement(Mr.j,{options:Oe.getOptionsForSelect()}),m.createElement("div",{className:bt.buttonContainer},m.createElement(M.B,{gap:2},m.createElement(ys.$s,null,({showModal:La,hideModal:js})=>m.createElement(C.$n,{variant:"destructive",fill:"outline",onClick:()=>{La(Pt.u,{title:"Delete variable",body:`Are you sure you want to delete: ${Ft}?`,confirmText:"Delete variable",onConfirm:Bs(js),onDismiss:js,isOpen:!0})}},"Delete")),m.createElement(C.$n,{variant:"secondary","data-testid":R.Tp.pages.Dashboard.Settings.Variables.Edit.General.applyButton,onClick:je},"Back to list"),tr&&m.createElement(C.$n,{disabled:Nn.loading,variant:"secondary","data-testid":R.Tp.pages.Dashboard.Settings.Variables.Edit.General.submitButton,onClick:Pa},Nn.loading?m.createElement(bs._,{text:"Running query..."}):"Run query"))))}const Sl=Oe=>({buttonContainer:(0,De.css)({marginTop:Oe.spacing(2)})});function fc({index:Oe,variable:Ie,onEdit:je,onDuplicate:lt,onDelete:bt}){const Ft=(0,He.$j)(),Kt=(0,He.of)(gc),ln=Ml(Ie),an=Ie.state,Ut=an.name,[Un,Nn]=(0,m.useState)(!1),Pa=Wa=>()=>{Nn(Wa)},qn=()=>{(0,K.rR)("Delete variable"),bt(Ut)};return m.createElement(vs.sx,{draggableId:JSON.stringify(Ut),index:Oe},(Wa,ls)=>m.createElement("tr",{ref:Wa.innerRef,...Wa.draggableProps,style:{userSelect:ls.isDragging?"none":"auto",background:ls.isDragging?Ft.colors.background.secondary:void 0,...Wa.draggableProps.style}},m.createElement("td",{role:"gridcell",className:Kt.column},m.createElement(C.$n,{size:"xs",fill:"text",onClick:fs=>{fs.preventDefault(),je(Ut)},className:Kt.nameLink,"data-testid":R.Tp.pages.Dashboard.Settings.Variables.List.tableRowNameFields(an.name)},an.name)),m.createElement("td",{role:"gridcell",className:Kt.definitionColumn,onClick:fs=>{fs.preventDefault(),je(Ut)},"data-testid":R.Tp.pages.Dashboard.Settings.Variables.List.tableRowDefinitionFields(an.name)},ln),m.createElement("td",{role:"gridcell",className:Kt.column},m.createElement("div",{className:Kt.icons},m.createElement(Vs.K,{onClick:fs=>{fs.preventDefault(),(0,K.rR)("Duplicate variable"),lt(Ut)},name:"copy",tooltip:"Duplicate variable","data-testid":R.Tp.pages.Dashboard.Settings.Variables.List.tableRowDuplicateButtons(an.name)}),m.createElement(Vs.K,{onClick:fs=>{fs.preventDefault(),Nn(!0)},name:"trash-alt",tooltip:"Remove variable","data-testid":R.Tp.pages.Dashboard.Settings.Variables.List.tableRowRemoveButtons(an.name)}),m.createElement(Pt.u,{isOpen:Un,title:"Delete variable",body:`Are you sure you want to delete: ${an.name}?`,confirmText:"Delete variable",onConfirm:qn,onDismiss:Pa(!1)}),m.createElement("div",{...Wa.dragHandleProps,className:Kt.dragHandle},m.createElement(ae.I,{name:"draggabledots",size:"lg"}))))))}function gc(Oe){return{dragHandle:(0,De.css)({cursor:"grab",marginLeft:Oe.spacing(1)}),column:(0,De.css)({width:"1%"}),nameLink:(0,De.css)({cursor:"pointer",color:Oe.colors.primary.text}),definitionColumn:(0,De.css)({width:"100%",maxWidth:"200px",cursor:"pointer",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),iconPassed:(0,De.css)({color:Oe.v1.palette.greenBase,marginRight:Oe.spacing(2)}),iconFailed:(0,De.css)({color:Oe.v1.palette.orange,marginRight:Oe.spacing(2)}),icons:(0,De.css)({display:"flex",gap:Oe.spacing(2),alignItems:"center"})}}function rr({variables:Oe,onChangeOrder:Ie,onDelete:je,onDuplicate:lt,onAdd:bt,onEdit:Ft}){const Kt=(0,He.of)(Ws),ln=an=>{!an.destination||!an.source||((0,K.rR)("Variable drag and drop"),Ie(an.source.index,an.destination.index))};return m.createElement("div",null,m.createElement("div",null,Oe.length===0&&m.createElement(go,{onAdd:bt}),Oe.length>0&&m.createElement(M.B,{direction:"column",gap:3},m.createElement("div",{className:Kt.tableContainer},m.createElement("table",{className:"filter-table filter-table--hover","data-testid":R.Tp.pages.Dashboard.Settings.Variables.List.table,role:"grid"},m.createElement("thead",null,m.createElement("tr",null,m.createElement("th",null,"Variable"),m.createElement("th",null,"Definition"),m.createElement("th",{colSpan:5}))),m.createElement(vs.JY,{onDragEnd:ln},m.createElement(vs.gL,{droppableId:"variables-list",direction:"vertical"},an=>m.createElement("tbody",{ref:an.innerRef,...an.droppableProps},Oe.map((Ut,Un)=>{const Nn=Ut.state;return m.createElement(fc,{index:Un,key:`${Nn.name}-${Un}`,variable:Ut,onDelete:je,onDuplicate:lt,onEdit:Ft})}),an.placeholder))))),m.createElement(M.B,null,m.createElement(C.$n,{"data-testid":R.Tp.pages.Dashboard.Settings.Variables.List.newButton,onClick:bt,icon:"plus"},"New variable")))))}function go({onAdd:Oe}){return m.createElement("div",null,m.createElement(Uo.A,{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:Ie=>{Ie.preventDefault(),Oe()}}))}const Ws=()=>({tableContainer:(0,De.css)({overflow:"scroll",width:"100%"})});class Br extends r.Bs{constructor(){super(...arguments),this._urlSync=new Fi(this),this.getVariableIndex=Ie=>this.getVariables().findIndex(lt=>lt.state.name===Ie),this.replaceEditVariable=Ie=>{const je=this.state.editIndex??-1,{variables:lt}=this.getVariableSet().state;if(!lt[je]){console.error("Variable not found");return}const Ft=[...lt.slice(0,je),Ie,...lt.slice(je+1)];this.getVariableSet().setState({variables:Ft})},this.onDelete=Ie=>{const je=this.getVariableIndex(Ie),{variables:lt}=this.getVariableSet().state;if(je===-1){console.error("Variable not found");return}const bt=[...lt.slice(0,je),...lt.slice(je+1)];this.getVariableSet().setState({variables:bt})},this.onDuplicated=Ie=>{const je=this.getVariableIndex(Ie),lt=this.getVariableSet().state.variables;if(je===-1){console.error("Variable not found");return}const bt=lt[je];let Ft=0,Kt=`copy_of_${bt.state.name}`;for(;lt.some(Ut=>Ut.state.name===Kt);)Ft++,Kt=`copy_of_${bt.state.name}_${Ft}`;const ln=bt.clone(bt.state);ln.setState({name:Kt});const an=[...lt.slice(0,je+1),ln,...lt.slice(je+1)];this.getVariableSet().setState({variables:an})},this.onOrderChanged=(Ie,je)=>{const lt=this.getVariableSet().state.variables;if(!this.getVariableSet())return;if(Ie<0||Ie>=lt.length||je<0||je>=lt.length){console.error("Invalid index");return}const bt=[...lt],Ft=bt.splice(Ie,1);bt.splice(je,0,Ft[0]),this.getVariableSet().setState({variables:bt})},this.onEdit=Ie=>{const je=this.getVariableIndex(Ie);if(je===-1){console.error("Variable not found");return}this.setState({editIndex:je})},this.onAdd=()=>{const Ie=this.getVariables(),je=Ie.length,lt=_i(Ie);this.getVariableSet().setState({variables:[...this.getVariables(),lt]}),this.setState({editIndex:je})},this.onTypeChange=Ie=>{const je=this.state.editIndex??-1,{variables:lt}=this.getVariableSet().state,bt=lt[je];if(!bt){console.error("Variable not found");return}const{name:Ft,label:Kt}=bt.state,ln=dc(Ie,{name:Ft,label:Kt});this.replaceEditVariable(ln)},this.onGoBack=()=>{this.setState({editIndex:void 0})}}getUrlKey(){return"variables"}getDashboard(){return(0,hn.YQ)(this)}getVariableSet(){return r.jh.getVariables(this.getDashboard())}getVariables(){return this.getVariableSet().state.variables}}Br.Component=yr;function yr({model:Oe}){const Ie=Oe.getDashboard(),{navModel:je,pageNav:lt}=Jo(Ie,Oe.getUrlKey()),{onDelete:bt,onDuplicated:Ft,onOrderChanged:Kt,onEdit:ln,onTypeChange:an,onGoBack:Ut,onAdd:Un}=Oe,{variables:Nn}=Oe.getVariableSet().useState(),{editIndex:Pa}=Oe.useState();if(Pa!==void 0&&Nn[Pa]){const qn=Nn[Pa];if(qn)return m.createElement(wo,{variable:qn,onTypeChange:an,onGoBack:Ut,pageNav:lt,navModel:je,dashboard:Ie,onDelete:bt})}return m.createElement(xe.Y,{navModel:je,pageNav:lt,layout:Xe.k.Standard},m.createElement(zt,{dashboard:Ie}),m.createElement(rr,{variables:Nn,onDelete:bt,onDuplicate:Ft,onChangeOrder:Kt,onAdd:Un,onEdit:ln}))}function wo({variable:Oe,pageNav:Ie,navModel:je,dashboard:lt,onTypeChange:bt,onGoBack:Ft,onDelete:Kt}){const ln=Ie.children.find(Un=>Un.active);ln.parentItem=Ie;const{name:an}=Oe.useState(),Ut={text:an,parentItem:ln};return m.createElement(xe.Y,{navModel:je,pageNav:Ut,layout:Xe.k.Standard},m.createElement(zt,{dashboard:lt}),m.createElement(mc,{variable:Oe,onTypeChange:bt,onGoBack:Ft,onDelete:Kt}))}const Ci=10;class pc extends r.Bs{constructor(Ie){super({...Ie,versions:[],isLoading:!0,isAppending:!0,viewMode:"list",isNewLatest:!1,diffData:{lhs:"",rhs:""}}),this._limit=Ci,this._start=0,this.fetchVersions=(je=!1)=>{const lt=this._dashboard.state.uid;lt&&(this.setState({isAppending:je}),yt.wL.getHistoryList(lt,{limit:this._limit,start:this._start}).then(bt=>{this.setState({isLoading:!1,versions:[...this.state.versions??[],...this.decorateVersions(bt)]}),this._start+=this._limit}).catch(bt=>console.log(bt)).finally(()=>this.setState({isAppending:!1})))},this.getDiff=async()=>{const je=this.versions.filter(an=>an.checked),[lt,bt]=je,Ft=lt.version===this._dashboard.state.version;if(this.setState({isLoading:!0}),!this._dashboard.state.uid)return;const Kt=await yt.wL.getDashboardVersion(this._dashboard.state.uid,bt.version),ln=await yt.wL.getDashboardVersion(this._dashboard.state.uid,lt.version);this.setState({baseInfo:bt,isLoading:!1,isNewLatest:Ft,newInfo:lt,viewMode:"compare",diffData:{lhs:Kt.data,rhs:ln.data}})},this.reset=()=>{this.setState({baseInfo:void 0,diffData:{lhs:"",rhs:""},isNewLatest:!1,newInfo:void 0,versions:this.versions.map(je=>({...je,checked:!1})),viewMode:"list"})},this.onCheck=(je,lt)=>{this.setState({versions:this.versions.map(bt=>bt.id===lt?{...bt,checked:je.currentTarget.checked}:bt)})},this.addActivationHandler(()=>{this.fetchVersions()})}get _dashboard(){return(0,hn.YQ)(this)}get diffData(){return this.state.diffData??{lhs:"",rhs:""}}get versions(){return this.state.versions??[]}get limit(){return this._limit}get start(){return this._start}getUrlKey(){return"versions"}getDashboard(){return this._dashboard}getTimeRange(){return r.jh.getTimeRange(this._dashboard)}decorateVersions(Ie){const je=this.getTimeRange().getTimeZone();return Ie.map(lt=>({...lt,createdDateString:(0,on.LE)(lt.created,{timeZone:je}),ageString:(0,on.fq)(lt.created,{timeZone:je}),checked:!1}))}}pc.Component=ii;function ii({model:Oe}){const Ie=Oe.getDashboard(),{isLoading:je,isAppending:lt,viewMode:bt,baseInfo:Ft,newInfo:Kt,isNewLatest:ln}=Oe.useState(),{navModel:an,pageNav:Ut}=Jo(Ie,Oe.getUrlKey()),Un=Oe.versions.filter(fs=>fs.checked).length===2,Nn=Oe.versions.length>1,Pa=Oe.versions.length>=Oe.limit,qn=Oe.versions.find(fs=>fs.version===1),Wa=m.createElement(m.Fragment,null,m.createElement(yt.me,{onClick:Oe.reset,baseVersion:Ft?.version,newVersion:Kt?.version,isNewLatest:ln}),je?m.createElement(zs,{msg:"Fetching changes\u2026"}):m.createElement(yt.Cc,{newInfo:Kt,baseInfo:Ft,isNewLatest:ln,diffData:Oe.diffData,onRestore:Ie.onRestore})),ls=m.createElement(m.Fragment,null,je?m.createElement(zs,{msg:"Fetching history list\u2026"}):m.createElement(yt.bS,{versions:Oe.versions,onCheck:Oe.onCheck,canCompare:Un,onRestore:Ie.onRestore}),lt&&m.createElement(zs,{msg:"Fetching more entries\u2026"}),Nn&&m.createElement(yt.rJ,{hasMore:Pa,canCompare:Un,getVersions:Oe.fetchVersions,getDiff:Oe.getDiff,isLastPage:!!qn}));return m.createElement(xe.Y,{navModel:an,pageNav:Ut,layout:Xe.k.Standard},m.createElement(zt,{dashboard:Ie}),bt==="compare"?Wa:ls)}const zs=({msg:Oe})=>m.createElement(ia.Gy,null,m.createElement(na.y,null),m.createElement("em",null,Oe));function Jo(Oe,Ie){const je=(0,Ke.zy)(),lt=(0,ee.useSelector)(ln=>ln.navIndex),bt=(0,c.tc)(lt,"dashboards/browse"),Ft=Oe.getPageNav(je,lt),Kt={text:"Settings",url:t.I.getUrlForPartial(je,{editview:"settings",editIndex:null}),children:[{text:(0,Ne.t)("dashboard-settings.general.title","General"),url:t.I.getUrlForPartial(je,{editview:"settings",editIndex:null}),active:Ie==="settings"},{text:(0,Ne.t)("dashboard-settings.annotations.title","Annotations"),url:t.I.getUrlForPartial(je,{editview:"annotations",editIndex:null}),active:Ie==="annotations"},{text:(0,Ne.t)("dashboard-settings.variables.title","Variables"),url:t.I.getUrlForPartial(je,{editview:"variables",editIndex:null}),active:Ie==="variables"},{text:(0,Ne.t)("dashboard-settings.links.title","Links"),url:t.I.getUrlForPartial(je,{editview:"links",editIndex:null}),active:Ie==="links"},{text:(0,Ne.t)("dashboard-settings.versions.title","Versions"),url:t.I.getUrlForPartial(je,{editview:"versions",editIndex:null}),active:Ie==="versions"},{text:(0,Ne.t)("dashboard-settings.permissions.title","Permissions"),url:t.I.getUrlForPartial(je,{editview:"permissions",editIndex:null}),active:Ie==="permissions"},{text:(0,Ne.t)("dashboard-settings.json-editor.title","JSON Model"),url:t.I.getUrlForPartial(je,{editview:"json-model",editIndex:null}),active:Ie==="json-model"}],parentItem:Ft};return{navModel:bt,pageNav:Kt}}function Ga(Oe){switch(Oe){case"annotations":return new Vi({});case"variables":return new Br({});case"links":return new Wt({});case"versions":return new pc({});case"json-model":return new Fa({});case"permissions":return new wa({});case"settings":default:return new Sa({})}}class zi extends r.Bs{constructor(Ie){super(Ie),this.addActivationHandler(this._activationHandler.bind(this))}_activationHandler(){const Ie=this.state.panelRef.resolve(),je=r.Go.cloneSceneObjectState(Ie.state,{key:Ie.state.key+"-view",$variables:this.getScopedVariables(Ie)}),lt=new r.Eb(je);return this.setState({body:lt}),()=>{lt.state.$data&&Ie.setState({$data:lt.state.$data.clone()})}}getScopedVariables(Ie){const je=hc(Ie),lt=[];if(je&&je.state.$variables)for(const bt of je.state.$variables.state.variables)lt.push(bt.clone());if(Ie.state.$variables)for(const bt of Ie.state.$variables.state.variables)lt.push(bt.clone());if(lt.length>0)return new r.Pj({variables:lt})}getUrlKey(){return this.state.panelRef.resolve().state.key}}zi.Component=({model:Oe})=>{const{body:Ie}=Oe.useState();return Ie?m.createElement(Ie.Component,{model:Ie}):null};function hc(Oe){try{return r.jh.getAncestor(Oe,r.tI)}catch{return}}var vc=e(30195);class xl{constructor(Ie){this._scene=Ie}getKeys(){return["inspect","viewPanel","editPanel","editview"]}getUrlState(){const Ie=this._scene.state;return{inspect:Ie.inspectPanelKey,viewPanel:Ie.viewPanelScene?.getUrlKey(),editview:Ie.editview?.getUrlKey(),editPanel:Ie.editPanel?.getUrlKey()||void 0}}updateFromUrl(Ie){const{inspectPanelKey:je,viewPanelScene:lt,isEditing:bt,editPanel:Ft}=this._scene.state,Kt={};if(typeof Ie.editview=="string"&&this._scene.canEditDashboard()?(Kt.editview=Ga(Ie.editview),bt||setTimeout(()=>this._scene.onEnterEditMode())):Ie.hasOwnProperty("editview")&&(Kt.editview=void 0),typeof Ie.inspect=="string"){if(!(0,hn.vL)(this._scene,Ie.inspect)){g.A.emit(n.r1.alertError,["Panel not found"]),s.Ny.partial({inspect:null});return}Kt.inspectPanelKey=Ie.inspect,Kt.overlay=new $s({$behaviors:[new Ec({panelKey:Ie.inspect})]})}else je&&(Kt.inspectPanelKey=void 0,Kt.overlay=void 0);if(typeof Ie.viewPanel=="string"){const ln=(0,hn.vL)(this._scene,Ie.viewPanel);if(!ln){if((0,hn.SN)(Ie.viewPanel)){this._handleViewRepeatClone(Ie.viewPanel);return}g.A.emit(n.r1.alertError,["Panel not found"]),s.Ny.partial({viewPanel:null});return}Kt.viewPanelScene=new zi({panelRef:ln.getRef()})}else lt&&Ie.viewPanel===null&&(Kt.viewPanelScene=void 0);if(typeof Ie.editPanel=="string"){const ln=(0,hn.vL)(this._scene,Ie.editPanel);if(!ln)return;bt||this._scene.onEnterEditMode(),Kt.editPanel=Cl(ln)}else Ft&&Ie.editPanel===null&&(Kt.editPanel=void 0);Object.keys(Kt).length>0&&this._scene.setState(Kt)}_handleViewRepeatClone(Ie){this._eventSub||(this._eventSub=this._scene.subscribeToEvent(vc.d,()=>{const je=(0,hn.vL)(this._scene,Ie);je&&(this._eventSub?.unsubscribe(),this._scene.setState({viewPanelScene:new zi({panelRef:je.getRef()})}))}))}}class Ec extends r.Bs{constructor(Ie){super(Ie),this._onActivate=()=>{const je=this.parent;if(!je||!(je instanceof $s))throw new Error("ResolveInspectPanelByKey must be attached to a PanelInspectDrawer");const lt=(0,hn.YQ)(je);if(!lt)return;const bt=this.state.panelKey;let Ft=(0,hn.vL)(lt,bt);lt.state.editPanel&&(Ft=lt.state.editPanel.state.vizManager.state.panel),lt.state.viewPanelScene&<.state.viewPanelScene.state.body&&(Ft=lt.state.viewPanelScene.state.body),Ft&&je.setState({panelRef:Ft.getRef()})},this.addActivationHandler(this._onActivate)}}var yc=e(6411),Ol=e.n(yc);class Dc{constructor(){this._binds=[]}addBinding(Ie){Ol().bind(Ie.key,je=>{je.preventDefault(),je.stopPropagation(),je.returnValue=!1,Ie.onTrigger()},"keydown"),this._binds.push(Ie)}removeAll(){this._binds.forEach(Ie=>{Ol().unbind(Ie.key,Ie.type)}),this._binds=[]}}var bi=e(98184);function Pc(Oe){const Ie=new Dc;return Ie.addBinding({key:"v",onTrigger:Xo(Oe,je=>{Oe.state.viewPanelScene||s.Ny.push((0,mn.r7)(je))})}),Ie.addBinding({key:"e",onTrigger:Xo(Oe,async je=>{if(je.getRoot()instanceof Ti){const bt=(0,hn.Cs)(je);Oe.state.editPanel||s.Ny.push((0,mn.e0)(bt))}})}),Ie.addBinding({key:"p s",onTrigger:Xo(Oe,async je=>{Oe.showModal(new ot.Z({panelRef:je.getRef(),dashboardRef:Oe.getRef()}))})}),Ie.addBinding({key:"i",onTrigger:Xo(Oe,async je=>{s.Ny.push((0,mn.Uu)(je))})}),Ie.addBinding({key:"p x",onTrigger:Xo(Oe,async je=>{const lt=await(0,mn.Lp)(je);lt&&s.Ny.push(lt)})}),Ie.addBinding({key:"p l",onTrigger:Xo(Oe,bi.vR)}),Ie.addBinding({key:"d r",onTrigger:()=>r.jh.getTimeRange(Oe).onRefresh()}),Ie.addBinding({key:"t z",onTrigger:()=>{sl(Oe)}}),Ie.addBinding({key:"ctrl+z",onTrigger:()=>{sl(Oe)}}),Ie.addBinding({key:"t left",onTrigger:()=>{Il(Oe,"left")}}),Ie.addBinding({key:"t right",onTrigger:()=>{Il(Oe,"right")}}),Ie.addBinding({key:"d s",onTrigger:Oe.onOpenSettings}),Ie.addBinding({key:"mod+s",onTrigger:()=>Oe.openSaveDrawer({})}),Ie.addBinding({key:"p r",onTrigger:Xo(Oe,je=>{(0,bi.FC)(Oe,je,!0)})}),Ie.addBinding({key:"p d",onTrigger:Xo(Oe,je=>{Oe.duplicatePanel(je)})}),()=>Ie.removeAll}function Xo(Oe,Ie){return()=>{const je=document.querySelectorAll(":hover");for(let lt=je.length-1;lt>0;lt--){const bt=je[lt];if(bt instanceof HTMLElement&&bt.dataset?.vizPanelKey){const Ft=bt.dataset?.vizPanelKey,Kt=r.jh.findObject(Oe,ln=>ln.state.key===Ft);if(Kt&&Kt instanceof r.Eb){Ie(Kt);return}}}}}function sl(Oe){Rt.b.getTimePicker(Oe)?.onZoom()}function Il(Oe,Ie){const je=Rt.b.getTimePicker(Oe);je&&(Ie==="left"&&je.onMoveBackward(),Ie==="right"&&je.onMoveForward())}const dr=["title","description","tags","editable","graphTooltip","links"],Hl=class extends r.Bs{constructor(Oe){super({title:"Dashboard",meta:{},editable:!0,body:Oe.body??new r.G1({children:[]}),links:Oe.links??[],...Oe}),this._urlSync=new xl(this),this._variableDependency=new Zo,this.onEnterEditMode=()=>{this._initialState=r.Go.cloneSceneObjectState(this.state),this._initialUrlState=s.Ny.getLocation(),this.setState({isEditing:!0}),this.propagateEditModeChange(),this.startTrackingChanges()},this.onRestore=async Ie=>{const je=await yt.wL.restoreDashboard(Ie.uid,Ie.version);if(!Number.isInteger(je.version))return!1;const lt={dashboard:new f.G(Ie.data),meta:this.state.meta},bt=(0,ft.wM)(lt),Ft=r.Go.cloneSceneObjectState(bt.state);return Ft.version=je.version,this._initialState=Ft,this.exitEditMode({skipConfirm:!1}),!0},this.onOpenSettings=()=>{s.Ny.partial({editview:"settings"})},this.isEmpty=()=>{const{body:Ie,viewPanelScene:je}=this.state;if(je)return!!je.state.body;if(Ie instanceof r.G1||Ie instanceof r.hy)return Ie.state.children.length===0;throw new Error("Invalid body type")},this.addActivationHandler(()=>this._activationHandler())}_activationHandler(){let Oe=window.__grafanaSceneContext;window.__grafanaSceneContext=this,this.state.isEditing&&this.startTrackingChanges(),!this.state.meta.isEmbedded&&this.state.uid&&d.t.watch(this.state.uid);const Ie=Pc(this),je=new qt(this);return(0,l.UA)().setCurrent(je),()=>{window.__grafanaSceneContext=Oe,Ie(),this.stopTrackingChanges(),this.stopUrlSync(),je.destroy(),d.t.leave()}}startUrlSync(){this.state.meta.isEmbedded||(0,r.Is)().initSync(this)}stopUrlSync(){(0,r.Is)().cleanUp(this)}saveCompleted(Oe,Ie,je){this._initialSaveModel={...Oe,id:Ie.id,uid:Ie.uid,version:Ie.version},this.stopTrackingChanges(),this.setState({version:Ie.version,isDirty:!1,uid:Ie.uid,id:Ie.id,meta:{...this.state.meta,uid:Ie.uid,url:Ie.url,slug:Ie.slug,folderUid:je}}),this.startTrackingChanges()}propagateEditModeChange(){this.state.body instanceof r.hy&&(this.state.body.setState({isDraggable:this.state.isEditing,isResizable:this.state.isEditing}),(0,hn.X0)(this.state.body,!0))}exitEditMode({skipConfirm:Oe}){if(!this.canDiscard()){console.error("Trying to discard back to a state that does not exist, initialState undefined");return}if(!this.state.isDirty||Oe){this.exitEditModeConfirmed();return}g.A.publish(new p.bY({title:"Discard changes to dashboard?",text:"You have unsaved changes to this dashboard. Are you sure you want to discard them?",icon:"trash-alt",yesText:"Discard",onConfirm:this.exitEditModeConfirmed.bind(this)}))}exitEditModeConfirmed(){this.stopTrackingChanges(),this.stopUrlSync(),s.Ny.replace(t.I.getUrlForPartial(this._initialUrlState,{editPanel:null,editview:null,inspect:null,inspectTab:null})),this.setState({...this._initialState,isEditing:!1}),this.startUrlSync(),this.propagateEditModeChange()}canDiscard(){return this._initialState!==void 0}openSaveDrawer({saveAsCopy:Oe}){this.state.isEditing&&this.setState({overlay:new st({dashboardRef:this.getRef(),saveAsCopy:Oe})})}getPageNav(Oe,Ie){const{meta:je,viewPanelScene:lt,editPanel:bt}=this.state;let Ft={text:this.state.title,url:(0,mn.uZ)({uid:this.state.uid,slug:je.slug,currentQueryParams:Oe.search,updateQuery:{viewPanel:null,inspect:null,editview:null,editPanel:null,tab:null}})};const{folderUid:Kt}=je;if(Kt){const ln=(0,c.tc)(Ie,`folder-dashboards-${Kt}`).main;ln.id!=="not-found"&&(Ft={...Ft,parentItem:ln})}return lt&&(Ft={text:"View panel",parentItem:Ft}),bt&&(Ft={text:"Edit panel",parentItem:Ft}),Ft}getBodyToRender(){return this.state.viewPanelScene??this.state.body}startTrackingChanges(){this._changeTrackerSub=this.subscribeToEvent(r.bZ,Oe=>{Oe.payload.changedObject instanceof r.WM&&Object.prototype.hasOwnProperty.call(Oe.payload.partialUpdate,"intervals")&&this.setIsDirty(),Oe.payload.changedObject instanceof r.zr&&this.setIsDirty(),Oe.payload.changedObject instanceof r.tV.g&&(Object.prototype.hasOwnProperty.call(Oe.payload.partialUpdate,"data")||this.setIsDirty()),Oe.payload.changedObject instanceof r.M$&&this.setIsDirty(),Oe.payload.changedObject instanceof Hl&&Object.keys(Oe.payload.partialUpdate).some(Ie=>dr.includes(Ie))&&this.setIsDirty(),Oe.payload.changedObject instanceof r.JZ&&this.setIsDirty(),Oe.payload.changedObject instanceof Sn.x&&Object.prototype.hasOwnProperty.call(Oe.payload.partialUpdate,"hideTimeControls")&&this.setIsDirty()})}setIsDirty(){this.state.isDirty||this.setState({isDirty:!0})}stopTrackingChanges(){this._changeTrackerSub?.unsubscribe()}getInitialState(){return this._initialState}addPanel(Oe){this.setState({body:new r.hy({children:[new r.M$({height:10,width:10,x:.2,y:0,body:Oe})]})})}duplicatePanel(Oe){if(!Oe.parent)return;const Ie=Oe.parent;if(!(Ie instanceof r.M$||Ir.w)){console.error("Trying to duplicate a panel in a layout that is not SceneGridItem or PanelRepeaterGridItem");return}let je,lt;if(Ie instanceof Ir.w){const{key:an,...Ut}=r.Go.cloneSceneObjectState(Ie.state.source.state);je={...Ut},lt=r.jh.getData(Ie.state.source).clone()}else{const{key:an,...Ut}=r.Go.cloneSceneObjectState(Oe.state);je={...Ut},lt=r.jh.getData(Oe).clone()}delete lt.state.data?.alertState;const{key:bt,...Ft}=r.Go.cloneSceneObjectState(Ie.state),Kt=new r.M$({...Ft,body:new r.Eb({...je,$data:lt})});if(!(this.state.body instanceof r.hy)){console.error("Trying to duplicate a panel in a layout that is not SceneGridLayout ");return}const ln=this.state.body;ln.setState({children:[...ln.state.children,Kt]})}copyPanel(Oe){if(!Oe.parent)return;const Ie=Oe.parent,je=(0,Le.ZB)(Ie);i.A.set(u.tH,JSON.stringify(je)),g.A.emit(n.r1.alertSuccess,["Panel copied. Click **Add panel** icon to paste."])}showModal(Oe){this.setState({overlay:Oe})}closeModal(){this.setState({overlay:void 0})}async onStarDashboard(){const{meta:Oe,uid:Ie}=this.state;if(Ie)try{const je=await(0,l.UA)().starDashboard(Ie,!!Oe.isStarred);this.setState({meta:{...Oe,isStarred:je}})}catch(je){console.error("Failed to star dashboard",je)}}enrichDataRequest(Oe){const Ie=(0,hn.xz)(Oe);let je=0;return Ie&&Ie.state.key&&((0,hn.SN)(Ie.state.key)?je=Cn(Ie?.state.key):je=(0,hn.Cs)(Ie)),{app:o.Jk.Dashboard,dashboardUID:this.state.uid,panelId:je,panelPluginId:Ie?.state.pluginId}}canEditDashboard(){const{meta:Oe}=this.state;return!!(Oe.canEdit||Oe.canMakeEditable)}getInitialSaveModel(){return this._initialSaveModel}setInitialSaveModel(Oe){this._initialSaveModel=Oe}};let Ti=Hl;Ti.listenToChangesInProps=dr,Ti.Component=It;class Zo{constructor(){this._emptySet=new Set}getNames(){return this._emptySet}hasDependencyOn(){return!1}variableUpdateCompleted(Ie,je){je&&g.A.publish(new h.og({refreshAll:!0,panelIds:[]}))}}},60656:(Q,A,e)=>{"use strict";e.d(A,{F:()=>u});var t=e(96540),n=e(79065),o=e(34214),s=e(57767),r=e(96556),g=e(98184);class u extends n.Bs{constructor({uid:l,title:f,key:d,name:h}){super({uid:l,title:f,key:d,name:h,panel:new n.Eb({title:f,menu:new n.Lw({$behaviors:[g._i]})})}),this._onActivate=()=>{this.loadLibraryPanelFromPanelModel()},this.addActivationHandler(this._onActivate)}async loadLibraryPanelFromPanelModel(){let l=this.state.panel;try{const f=await(0,s.Yr)(this.state.uid,!0),d=new o.a(f.model);l=l.clone({options:d.options??{},fieldConfig:d.fieldConfig,pluginVersion:d.pluginVersion,displayMode:d.transparent?"transparent":void 0,description:d.description,pluginId:f.type,$data:(0,r.w)(d)})}catch{l.setState({_pluginLoadError:"Unable to load library panel: "+this.state.uid})}this.setState({panel:l})}}u.Component=c;function c({model:i}){const{panel:l}=i.useState();return l?t.createElement(l.Component,{model:l}):null}},42397:(Q,A,e)=>{"use strict";e.d(A,{$:()=>i,m:()=>f});var t=e(96540),n=e(79065),o=e(91052),s=e(14578),r=e(83122),g=e(27746),u=e(38138),c=e(98184);class i extends n.Bs{}i.Component=l;function l({model:h}){const{menu:p,rawLinks:m}=h.useState();if(!(h.parent instanceof n.Eb))throw new Error("VizPanelLinks must be a child of VizPanel");if(!m||m.length===0)return null;if(m.length===1){const a=(0,c.eQ)(h.parent)[0];return t.createElement(o.NR.TitleItem,{href:a.href,onClick:a.onClick,target:a.target,title:a.title},t.createElement(s.I,{name:"external-link-alt",size:"md"}))}return t.createElement(r.m,{overlay:()=>t.createElement(p.Component,{model:p,key:p.state.key})},t.createElement(g.I,{icon:"external-link-alt",iconSize:"md","aria-label":"panel links"}))}class f extends n.Bs{}f.Component=d;function d({model:h}){const{links:p}=h.useState();return p?t.createElement(u.W,null,p?.map((m,a)=>t.createElement(u.W.Item,{key:a,label:m.title,url:m.href,target:m.target,onClick:m.onClick}))):null}},98184:(Q,A,e)=>{"use strict";e.d(A,{eQ:()=>G,oV:()=>V,_i:()=>H,FC:()=>K,vR:()=>k});var t=e(74135),n=e(1933),o=e(76885),s=e(32264),r=e(4402),g=e(12131),u=e(79065),c=e(28138),i=e(44836),l=e(63066),f=e(22699),d=e(16560),h=e(32349),p=e(75462),m=e(19347),a=e(65405),v=e(74730),E=e(96540),D=e(87978),b=e(18919),C=e(1997),y=e(4200);class M extends u.Bs{constructor(J){super(J),this.onOpenTrail=()=>{(0,C.l)().goToUrlForTrail(this.trail.clone({embedded:!1}))},this.onClose=()=>{(0,v.YQ)(this).closeModal()},this.trail=I(J),this.trail.addActivationHandler(()=>{this.trail.subscribeToEvent(y.PK,this.onOpenTrail)})}}M.Component=T;function T({model:re}){return E.createElement(D._,{title:"Data trail",onClose:re.onClose,size:"lg"},E.createElement("div",{style:{display:"flex",height:"100%"}},E.createElement(re.trail.Component,{model:re.trail})))}function I({query:re,dsRef:J,timeRange:ne}){const q=re.labels.map(oe=>({key:oe.label,value:oe.value,operator:oe.op})),te=(0,m.l)().getInstanceSettings(J);return new b.b({$timeRange:ne,metric:re.metric,initialDS:te?.uid,initialFilters:q,embedded:!0})}function x(re,J,ne){const q=(0,v.un)(J);if(!q)return;const te=(0,m.l)().getInstanceSettings(q.state.datasource);if(!te||te.meta.id!=="prometheus"||q.state.queries.length>1)return;const oe=q.state.queries[0],ue=(0,a.u)(oe.expr);ue.errors.length>0||ne.push({text:"Data trail",iconClassName:"code-branch",onClick:()=>{re.showModal(new M({query:ue.query,dsRef:te,timeRange:re.state.$timeRange.clone()}))},shortcut:"p s"})}var S=e(28444),O=e(58441),P=e(7758),L=e(11982),U=e(36043),R=e(60656),B=e(42397);function H(re){(async()=>{const ne=re.parent,q=ne.getPlugin(),te=[],oe=[],ue=(0,v.Cs)(ne),ie=(0,v.YQ)(ne),{isEmbedded:ge}=ie.state.meta,he=await w(ne);if(ge){he&&re.setState({items:[he]});return}te.push({text:(0,i.t)("panel.header-menu.view","View"),iconClassName:"eye",shortcut:"v",onClick:()=>P.c.panelMenuItemClicked("view"),href:(0,L.r7)(ne)}),ie.canEditDashboard()&&te.push({text:(0,i.t)("panel.header-menu.edit","Edit"),iconClassName:"eye",shortcut:"e",onClick:()=>P.c.panelMenuItemClicked("edit"),href:(0,L.e0)(ue)}),te.push({text:(0,i.t)("panel.header-menu.share","Share"),iconClassName:"share-alt",onClick:()=>{P.c.panelMenuItemClicked("share"),ie.showModal(new O.Z({panelRef:ne.getRef(),dashboardRef:ie.getRef()}))},shortcut:"p s"}),oe.push({text:(0,i.t)("panel.header-menu.duplicate","Duplicate"),onClick:()=>{P.c.panelMenuItemClicked("duplicate"),ie.duplicatePanel(ne)},shortcut:"p d"}),oe.push({text:(0,i.t)("panel.header-menu.copy","Copy"),onClick:()=>{P.c.panelMenuItemClicked("copy"),ie.copyPanel(ne)}}),ne.parent instanceof R.F||oe.push({text:(0,i.t)("panel.header-menu.create-library-panel","Create library panel"),onClick:()=>{P.c.panelMenuItemClicked("createLibraryPanel"),ie.showModal(new O.Z({panelRef:ne.getRef(),dashboardRef:ie.getRef(),activeTab:f.wr.libraryPanel}))}}),oe.push({text:(0,i.t)("panel.header-menu.new-alert-rule","New alert rule"),onClick:pe=>j(ne)}),Y(ne.state.options)&&oe.push({text:ne.state.options.legend.showLegend?(0,i.t)("panel.header-menu.hide-legend","Hide legend"):(0,i.t)("panel.header-menu.show-legend","Show legend"),onClick:pe=>{pe.preventDefault(),k(ne)},shortcut:"p l"}),ie.canEditDashboard()&&q&&!q.meta.skipDataQuery&&oe.push({text:(0,i.t)("panel.header-menu.get-help","Get help"),onClick:pe=>{pe.preventDefault(),ee(ne,d.q.Help)}}),s.$.featureToggles.datatrails&&x(ie,ne,te),he&&te.push(he),te.push(N(q,ne,ie));const{extensions:De}=(0,r.Kf)({extensionPointId:t.S.DashboardPanelMenu,context:_(ne,ie),limitPerPlugin:3});De.length>0&&!ie.state.isEditing&&te.push({text:"Extensions",iconClassName:"plug",type:"submenu",subMenu:(0,p.N9)(De)}),oe.length&&te.push({type:"submenu",text:(0,i.t)("panel.header-menu.more","More..."),iconClassName:"cube",subMenu:oe,onClick:pe=>{pe.preventDefault()}}),te.push({text:"",type:"divider"}),te.push({text:(0,i.t)("panel.header-menu.remove","Remove"),iconClassName:"trash-alt",onClick:()=>{P.c.panelMenuItemClicked("remove"),K(ie,ne,!0)},shortcut:"p r"}),re.setState({items:te})})()}async function w(re){const J=await(0,L.Lp)(re);if(J)return{text:(0,i.t)("panel.header-menu.explore","Explore"),iconClassName:"compass",shortcut:"p x",onClick:()=>P.c.panelMenuItemClicked("explore"),href:J}}function N(re,J,ne){const q=[];return re&&!re.meta.skipDataQuery&&(q.push({text:(0,i.t)("panel.header-menu.inspect-data","Data"),href:(0,L.Uu)(J,d.q.Data),onClick:te=>{te.preventDefault(),g.Ny.partial({inspect:J.state.key,inspectTab:d.q.Data}),P.c.panelMenuInspectClicked(d.q.Data)}}),ne instanceof U.H$&&ne.state.meta.canEdit&&q.push({text:(0,i.t)("panel.header-menu.query","Query"),href:(0,L.Uu)(J,d.q.Query),onClick:te=>{te.preventDefault(),g.Ny.partial({inspect:J.state.key,inspectTab:d.q.Query}),P.c.panelMenuInspectClicked(d.q.Query)}})),q.push({text:(0,i.t)("panel.header-menu.inspect-json","Panel JSON"),href:(0,L.Uu)(J,d.q.JSON),onClick:te=>{te.preventDefault(),g.Ny.partial({inspect:J.state.key,inspectTab:d.q.JSON}),P.c.panelMenuInspectClicked(d.q.JSON)}}),{text:(0,i.t)("panel.header-menu.inspect","Inspect"),iconClassName:"info-circle",shortcut:"i",href:(0,L.Uu)(J),onClick:te=>{te.isDefaultPrevented()||(g.Ny.partial({inspect:J.state.key,inspectTab:d.q.Data}),P.c.panelMenuInspectClicked(d.q.Data))},subMenu:q.length>0?q:void 0}}function V(re){if(!(re.parent instanceof B.$))throw new Error("parent of VizPanelLinksMenu must be VizPanelLinks");const J=re.parent.parent;if(!(J instanceof u.Eb))throw new Error("parent of VizPanelLinks must be VizPanel");re.setState({links:G(J)})}function G(re){const J=(te,oe)=>u.jh.interpolate(re,te,oe),ne=(0,h.CH)(re,J);if(!ne)return[];const q=ne.getLinks(J);return q.map(te=>({...te,onClick:(oe,ue)=>{P.c.panelLinkClicked({has_multiple_links:q.length>1}),te.onClick?.(oe,ue)}}))}function _(re,J){const ne=u.jh.getTimeRange(re);let q=(0,v.un)(re);const te=q?.state.queries,oe=(0,v.Cs)(re);let ue={};if(re.state.$variables&&re.state.$variables.state.variables.forEach(ie=>{ie instanceof u.xc&&(ue={...ue,[ie.state.name]:{value:ie.getValue(),text:ie.getValueText()}})}),re.parent?.parent instanceof u.tI){const ie=re.parent.parent;ie.state.$variables&&ie.state.$variables.state.variables.forEach(ge=>{ge instanceof u.xc&&(ue={...ue,[ge.state.name]:{value:ge.getValue(),text:ge.getValueText()}})})}return{id:oe,pluginId:re.state.pluginId,title:re.state.title,timeRange:ne.state.value.raw,timeZone:(0,n.O)({timeZone:ne.getTimeZone()}),dashboard:{uid:J.state.uid,title:J.state.title,tags:J.state.tags||[]},targets:te,scopedVars:ue,data:q?.state.data}}function K(re,J,ne){const q=u.jh.getData(J);let te=!1;if(q.state.data?.alertState&&(te=!0),ne!==!1){const ie=te&&!s.$.unifiedAlertingEnabled?"Panel includes an alert rule. removing the panel will also remove the alert rule":void 0,ge=te?"YES":void 0;c.A.publish(new S.bY({title:"Remove panel",text:"Are you sure you want to remove this panel?",text2:ie,icon:"trash-alt",confirmText:ge,yesText:"Remove",onConfirm:()=>K(re,J,!1)}));return}const oe=[];re.state.body.forEachChild(ie=>{ie.state.key!==J.parent?.state.key&&oe.push(ie)});const ue=re.state.body;(ue instanceof u.hy||u.G1)&&ue.setState({children:oe})}const j=async re=>{P.c.panelMenuItemClicked("create-alert");const J=await(0,l.J6)(re),ne=o.kM.renderUrl("/alerting/new",{defaults:JSON.stringify(J),returnTo:location.pathname+location.search});g.Ny.push(ne),P.c.panelMenuItemClicked("create-alert")};function k(re){const J=re.state.options;Y(J)&&typeof J.legend.showLegend=="boolean"&&re.onOptionsChange({legend:{showLegend:!J.legend.showLegend}}),P.c.panelMenuItemClicked("toggleLegend")}function Y(re){return re!=null&&typeof re=="object"&&"legend"in re}const ee=(re,J)=>{g.Ny.partial({inspect:re.state.key,inspectTab:J}),P.c.panelMenuInspectClicked(J??d.q.Data)}},11497:(Q,A,e)=>{"use strict";e.d(A,{w:()=>c});var t=e(32196),n=e(96540),o=e(32264),s=e(79065),r=e(15054),g=e(74730),u=e(30195);class c extends s.Bs{constructor(d){super(d),this._variableDependency=new s.Sh(this,{variableNames:[this.state.variableName],onVariableUpdateCompleted:this._onVariableUpdateCompleted.bind(this)}),this.addActivationHandler(()=>this._activationHandler())}_activationHandler(){this._subs.add(this.subscribeToState((d,h)=>this._handleGridResize(d,h))),this._performRepeat()}_onVariableUpdateCompleted(){this._performRepeat()}_handleGridResize(d,h){const p=this.state.repeatedPanels?.length??1,m={};if(d.height!==h.height){if(this.getRepeatDirection()==="v"){const a=Math.ceil(d.height/p);m.itemHeight=a}else{const a=Math.ceil(p/this.getMaxPerRow());m.itemHeight=Math.ceil(d.height/a)}m.itemHeight!==this.state.itemHeight&&this.setState(m)}}_performRepeat(){if(this._variableDependency.hasDependencyInLoadingState())return;const d=s.jh.lookupVariable(this.state.variableName,this);if(!d){console.error("SceneGridItemRepeater: Variable not found");return}if(!(d instanceof s.n8)){console.error("PanelRepeaterGridItem: Variable is not a MultiValueVariable");return}const h=this.state.source,{values:p,texts:m}=(0,g.a7)(d),a=[];for(let y=0;y<p.length;y++){const M=h.clone({$variables:new s.Pj({variables:[new s.xc({name:d.state.name,value:p[y],text:String(m[y])})]}),key:`${h.state.key}-clone-${y}`});a.push(M)}const v=this.getRepeatDirection(),E={repeatedPanels:a},D=this.state.itemHeight??10,b=this.state.height,C=this.getMaxPerRow();if(v==="h"){const y=Math.ceil(a.length/C);E.height=y*D}else E.height=a.length*D;if(this.setState(E),b!==this.state.height){const y=s.jh.getLayout(this);y instanceof s.hy&&y.forceRender()}this.publishEvent(new u.d({source:this}),!0)}getMaxPerRow(){return this.state.maxPerRow??4}getRepeatDirection(){return this.state.repeatDirection==="v"?"v":"h"}getClassName(){return"panel-repeater-grid-item"}}c.Component=({model:f})=>{const{repeatedPanels:d,itemHeight:h}=f.useState(),p=d?.length??0,m=i(f.getRepeatDirection(),p,f.getMaxPerRow(),h??10);return d?n.createElement("div",{className:m},d.map(a=>n.createElement("div",{className:l,key:a.state.key},n.createElement(a.Component,{model:a,key:a.state.key})))):null};function i(f,d,h,p){return(0,n.useMemo)(()=>{const m=o.$.theme2,a=p*r.sD*d+(d-1)*r.dU;if(f==="h"){const v=Math.ceil(d/h),E=Math.ceil(d/v);return(0,t.css)({display:"grid",height:"100%",width:"100%",gridTemplateColumns:`repeat(${E}, 1fr)`,gridTemplateRows:`repeat(${v}, 1fr)`,gridColumnGap:m.spacing(1),gridRowGap:m.spacing(1),[m.breakpoints.down("md")]:{display:"flex",flexDirection:"column",height:a}})}return(0,t.css)({display:"flex",height:"100%",width:"100%",flexDirection:"column",gap:m.spacing(1),[m.breakpoints.down("md")]:{height:a}})},[f,d,h,p])}const l=(0,t.css)({display:"flex",flexGrow:1,position:"relative"})},7928:(Q,A,e)=>{"use strict";e.d(A,{v:()=>d});var t=e(32196),n=e(96540),o=e(43127),s=e(65879),r=e(85858),g=e(79065),u=e(40845),c=e(56034),i=e(15666),l=e(91052),f=e(14578);class d extends g.XQ{constructor(a={}){super({...a,from:"now-6h",to:"now",value:(0,o.E2)()}),this.addActivationHandler(()=>this._onActivate())}_onActivate(){this._subs.add(this.subscribeToState((a,v)=>{if(a.timeFrom!==v.timeFrom||a.timeShift!==v.timeShift){const{timeInfo:E}=this.getTimeOverride(this.getAncestorTimeRange().state.value);this.setState({timeInfo:E})}}))}ancestorTimeRangeChanged(a){const v=this.getTimeOverride(a.value);this.setState({value:v.timeRange,timeInfo:v.timeInfo})}getTimeOverride(a){const{timeFrom:v,timeShift:E}=this.state,D={timeInfo:"",timeRange:a};if(v){const b=g.jh.interpolate(this,this.state.timeFrom),C=s.describeTextRange(b);if(C.invalid)return D.timeInfo="invalid time override",D;s.isRelativeTimeRange(a.raw)&&(D.timeInfo=C.display,D.timeRange={from:r.parse(C.from),to:r.parse(C.to),raw:{from:C.from,to:C.to}})}if(E){const b=g.jh.interpolate(this,this.state.timeShift);if(s.describeTextRange(b).invalid)return D.timeInfo="invalid timeshift",D;const y="-"+b;D.timeInfo+=" timeshift "+y;const M=r.parseDateMath(y,D.timeRange.from,!1),T=r.parseDateMath(y,D.timeRange.to,!0);D.timeRange={from:M,to:T,raw:{from:M,to:T}}}return D}}d.Component=h;function h({model:m}){const{timeInfo:a,hideTimeOverride:v}=m.useState(),E=(0,u.of)(p);return!a||v?null:n.createElement(c.m,{content:n.createElement(i.xS,{timeRange:m.state.value,timeZone:m.getTimeZone()})},n.createElement(l.NR.TitleItem,{className:E.timeshift},n.createElement(f.I,{name:"clock-nine",size:"sm"})," ",a))}const p=m=>({timeshift:(0,t.css)({color:m.colors.text.link,gap:m.spacing(.5),whiteSpace:"nowrap"})})},79284:(Q,A,e)=>{"use strict";e.d(A,{L:()=>s});var t=e(79065),n=e(74730),o=e(30195);class s extends t.Bs{constructor(l){super(l),this._variableDependency=new t.Sh(this,{variableNames:[this.state.variableName],onVariableUpdateCompleted:this._onVariableUpdateCompleted.bind(this)}),this.addActivationHandler(()=>this._activationHandler())}_activationHandler(){this._performRepeat()}_onVariableUpdateCompleted(){this._performRepeat()}_performRepeat(){if(this._variableDependency.hasDependencyInLoadingState())return;const l=t.jh.lookupVariable(this.state.variableName,this.parent?.parent);if(!l){console.error("RepeatedRowBehavior: Variable not found");return}if(!(l instanceof t.n8)){console.error("RepeatedRowBehavior: Variable is not a MultiValueVariable");return}if(!(this.parent instanceof t.tI)){console.error("RepeatedRowBehavior: Parent is not a SceneGridRow");return}const f=t.jh.getLayout(this);if(!(f instanceof t.hy)){console.error("RepeatedRowBehavior: Layout is not a SceneGridLayout");return}const d=this.parent,{values:h,texts:p}=(0,n.a7)(l),m=[],a=r(this.state.sources);let v=0;for(let E=0;E<h.length;E++){const D=[];for(const C of this.state.sources){const M=(C.state.y??0)+(a+1)*E,T=C.clone({key:`${C.state.key}-clone-${E}`,y:M});c(T,E),D.push(T),v<M+T.state.height&&(v=M+T.state.height)}const b=this.getRowClone(d,E,h[E],p[E],a,D);m.push(b)}g(f,m,v,d),this.publishEvent(new o.d({source:this}),!0)}getRowClone(l,f,d,h,p,m){if(f===0)return l.setState({$variables:new t.Pj({variables:[new t.xc({name:this.state.variableName,value:d,text:String(h)})]}),children:m}),l;const a=l.state.y??0;return l.clone({key:`${l.state.key}-clone-${f}`,$variables:new t.Pj({variables:[new t.xc({name:this.state.variableName,value:d,text:String(h)})]}),$behaviors:[],children:m,y:a+p*f+f})}}function r(i){let l=0,f=Number.MAX_VALUE;for(const d of i)d.state.y+d.state.height>l&&(l=d.state.y+d.state.height),d.state.y<f&&(f=d.state.y);return l-f}function g(i,l,f,d){const h=u(i,d),p=h.indexOf(d);if(p===-1)throw new Error("RowRepeaterBehavior: Parent row not found in layout children");const m=[...h.slice(0,p),...l,...h.slice(p+1)];if(h.length>p+1){const a=h.slice(p+1),v=a[0].state.y,E=f-v;for(const D of a)D.state.y<f&&D.setState({y:D.state.y+E})}i.setState({children:m})}function u(i,l){return i.state.children.filter(f=>!f.state.key?.startsWith(`${l.state.key}-clone-`))}function c(i,l){i.forEachChild(f=>{f.setState({key:`${f.state.key}-row-${l}`}),c(f,l)})}},30195:(Q,A,e)=>{"use strict";e.d(A,{d:()=>n});var t=e(65463);class n extends t.x{}n.type="dashboard-repeats-processed"},71176:(Q,A,e)=>{"use strict";e.d(A,{X:()=>n});var t=e(79422);function n(o){const s={meta:{canStar:!1,canShare:!1,canDelete:!1,isNew:!0,folderUid:""},dashboard:{...t.Ye,uid:"",title:"New dashboard",panels:[]}};return o&&(s.meta.folderUid=o),s}},13989:(Q,A,e)=>{"use strict";e.d(A,{O:()=>n});var t=e(79065);function n(o){const s=[];for(const r of o){if(!(r instanceof t.tV.g))continue;const g={...r.state.query,enable:!!r.state.isEnabled,hide:!!r.state.isHidden};s.push(g)}return s}},53287:(Q,A,e)=>{"use strict";e.d(A,{C:()=>g});var t=e(32264),n=e(79065),o=e(79422),s=e(73134),r=e(74730);function g(u){const c=[];for(const i of u.state.variables){const l={name:i.state.name,label:i.state.label,description:i.state.description??void 0,skipUrlSync:!!i.state.skipUrlSync,hide:i.state.hide||o.zL.dontHide,type:i.state.type};if(n.Go.isQueryVariable(i))c.push({...l,current:{value:i.state.value,text:i.state.text},options:[],query:i.state.query,definition:i.state.definition,datasource:i.state.datasource,sort:i.state.sort,refresh:i.state.refresh,regex:i.state.regex,allValue:i.state.allValue,includeAll:i.state.includeAll,multi:i.state.isMulti,skipUrlSync:i.state.skipUrlSync});else if(n.Go.isCustomVariable(i))c.push({...l,current:{text:i.state.value,value:i.state.value},options:[],query:i.state.query,multi:i.state.isMulti,allValue:i.state.allValue,includeAll:i.state.includeAll});else if(n.Go.isDataSourceVariable(i))c.push({...l,current:{value:i.state.value,text:i.state.text},options:[],regex:i.state.regex,refresh:s.CO.onDashboardLoad,query:i.state.pluginId,multi:i.state.isMulti,allValue:i.state.allValue,includeAll:i.state.includeAll});else if(n.Go.isConstantVariable(i))c.push({...l,current:{value:i.state.value,text:i.state.value},query:i.state.value,hide:o.zL.hideVariable});else if(n.Go.isIntervalVariable(i)){const f=(0,r.bx)(i.state.intervals);c.push({...l,current:{text:i.state.value,value:i.state.value},query:f,refresh:i.state.refresh,auto:i.state.autoEnabled,auto_min:i.state.autoMinInterval,auto_count:i.state.autoStepCount})}else if(n.Go.isTextBoxVariable(i))c.push({...l,current:{text:i.state.value,value:i.state.value},query:i.state.value});else if(n.Go.isGroupByVariable(i)&&t.$.featureToggles.groupByVariable)c.push({...l,datasource:i.state.datasource,options:i.state.defaultOptions?.map(f=>({text:f.text,value:String(f.value)})),current:{text:i.state.text,value:i.state.value}});else if(n.Go.isAdHocVariable(i))c.push({...l,name:i.state.name,type:"adhoc",datasource:i.state.datasource,baseFilters:i.state.baseFilters,filters:i.state.filters});else throw new Error("Unsupported variable type")}for(const i of c)i.hide===o.zL.dontHide&&delete i.hide,i.skipUrlSync||delete i.skipUrlSync,i.label===""&&delete i.label,i.multi||delete i.multi,i.sort===s.ZG.disabled&&delete i.sort;return c}},64468:(Q,A,e)=>{"use strict";e.d(A,{tt:()=>q,EH:()=>re,wM:()=>k});var t=e(32264),n=e(79065),o=e(34214),s=e(16833),r=e(91309),g=e(38477),u=e(48548),c=e(96540),i=e(80997),l=e(13544),f=e(56034),d=e(52424),h=e(6923),p=e(4588),m=e(74730);class a extends n.Bs{}a.Component=v;function v({model:ie}){const{links:ge,uid:he}=(0,m.YQ)(ie).useState();return!ge||!he?null:c.createElement(c.Fragment,null,ge.map((De,pe)=>{const le=(0,h.mQ)().getAnchorInfo(De),Te=`${De.title}-$${pe}`;if(De.type==="dashboards")return c.createElement(d.aK,{key:Te,link:De,linkInfo:le,dashboardUID:he});const Ee=p.G[De.icon],Re=c.createElement(d.Zx,{icon:Ee,href:(0,i.Jf)(le.href),target:De.targetBlank?"_blank":void 0,rel:"noreferrer","data-testid":l.Tp.components.DashboardLinks.link},le.title);return c.createElement("div",{key:Te,"data-testid":l.Tp.components.DashboardLinks.container},De.tooltip?c.createElement(f.m,{content:le.tooltip},Re):Re)}))}class E{constructor(ge,he){this._sceneObject=he,this.state={name:ge,type:"dashboard_macro"}}getValue(ge){const he=(0,m.YQ)(this._sceneObject);switch(ge){case"uid":return he.state.uid||"";case"title":case"name":case"id":default:return he.state.title}}getValueText(){return""}}function D(){const ie=n.Go.registerVariableMacro("__dashboard",E);return()=>ie()}var b=e(36043),C=e(60656),y=e(42397),M=e(98184),T=e(2038);class I extends n.Bs{constructor(){super({}),this.onActivate=()=>{const ge=this.parent;if(!ge||!(ge instanceof n.Eb))throw new Error("PanelNotices can be used only as title items for VizPanel")},this.addActivationHandler(this.onActivate)}getPanel(){const ge=this.parent;return ge&&ge instanceof n.Eb?ge:null}}I.Component=x;function x({model:ie}){const ge=ie.getPanel(),De=n.jh.getData(ie).useState();if(!ge)return null;const pe=(0,m.Cs)(ge);return De.data?.series?c.createElement(T.Z,{frames:De.data?.series,panelId:pe}):null}var S=e(11497),O=e(7928),P=e(79284),L=e(41987),U=e(69129),R=e(10154);function B(ie,ge){ge.app=L.Jk.Dashboard,ge.canAddAnnotations=()=>{const he=(0,m.YQ)(ie);return!H(he)||!he.canEditDashboard()?!1:!!he.state.meta.annotationsPermissions?.dashboard.canAdd},ge.canEditAnnotations=he=>{const De=(0,m.YQ)(ie);return De.canEditDashboard()?he?!!De.state.meta.annotationsPermissions?.dashboard.canEdit:!!De.state.meta.annotationsPermissions?.organization.canEdit:!1},ge.canDeleteAnnotations=he=>{const De=(0,m.YQ)(ie);return De.canEditDashboard()?he?!!De.state.meta.annotationsPermissions?.dashboard.canDelete:!!De.state.meta.annotationsPermissions?.organization.canDelete:!1},ge.onAnnotationCreate=async he=>{const De=(0,m.YQ)(ie),pe=he.from!==he.to,le={dashboardUID:De.state.uid,panelId:(0,m.Cs)(ie),isRegion:pe,time:he.from,timeEnd:pe?he.to:0,tags:he.tags,text:he.description};await(0,R.vJ)(le),w(De),ge.eventBus.publish(new U.We(le))},ge.onAnnotationUpdate=async he=>{const De=(0,m.YQ)(ie),pe=he.from!==he.to,le={id:he.id,dashboardUID:De.state.uid,panelId:(0,m.Cs)(ie),isRegion:pe,time:he.from,timeEnd:pe?he.to:0,tags:he.tags,text:he.description};await(0,R.rJ)(le),w(De),ge.eventBus.publish(new U.We(le))},ge.onAnnotationDelete=async he=>{await(0,R.Xm)({id:he}),w((0,m.YQ)(ie)),ge.eventBus.publish(new U.We({id:he}))},ge.onAddAdHocFilter=he=>{const De=(0,m.YQ)(ie),pe=(0,m.un)(ie);if(!pe)return;const le=N(De,pe.state.datasource);V(le,he)},ge.onUpdateData=he=>Promise.resolve(!0),ge.instanceState={legacyPanelId:(0,m.Cs)(ie)}}function H(ie){if(ie.state.$data instanceof n.zr){for(const ge of ie.state.$data.state.layers)if(ge instanceof n.tV.g&&ge.state.isEnabled&&ge.state.query.builtIn)return ge}}function w(ie){const ge=H(ie);ge&&ge.runLayer()}function N(ie,ge){const he=n.jh.getVariables(ie);for(const pe of he.state.variables)if(n.Go.isAdHocVariable(pe)){const le=pe.state.datasource;if(le===ge||le?.uid===ge?.uid)return pe}const De=new n.H9({name:"Filters",datasource:ge});return he.setState({variables:[...he.state.variables,De]}),De}function V(ie,ge){for(const he of ie.state.filters)if(he.key===ge.key){ie.setState({filters:ie.state.filters.map(De=>De.key===ge.key?ge:De)});return}ie.setState({filters:[...ie.state.filters,ge]})}var G=e(96556),_=e(7758),K=e(84423);function j(ie){return function(he,De){if(De.angularPanelCtrl){he.options={angularOptions:ie.getOptionsToRemember()};return}if(ie.autoMigrateFrom){const pe=K.NB[ie.autoMigrateFrom]!=null,le=ie.getOptionsToRemember(),Te=ie.autoMigrateFrom;if(De.onPanelTypeChanged){const Ee=pe?{angular:le}:le.options;Object.assign(he.options,De.onPanelTypeChanged(he,Te,Ee,he.fieldConfig))}}}}function k(ie){const ge=new o.G(ie.dashboard,ie.meta,{autoMigrateOldPanels:!1}),he=re(ge);return he.setInitialSaveModel(ie.dashboard),he}function Y(ie){const ge=[];let he=null,De=[];for(const pe of ie)if(pe.type==="row")he?he.id!==pe.id&&(ge.push(ee(he,De)),he=pe,De=[]):pe.collapsed?ge.push(ee(pe,[])):he=pe;else if(pe.libraryPanel?.uid&&!("model"in pe.libraryPanel)){const le=ne(pe);le&&ge.push(le)}else{const le=q(pe);he?De.push(le):ge.push(le)}return he&&ge.push(ee(he,De)),ge}function ee(ie,ge){ie.collapsed&&ie.panels&&(ge=ie.panels.map(pe=>(pe instanceof o.a||(pe=new o.a(pe)),q(pe))));let he,De=ge;return ie.repeat&&(De=[],he=[new P.L({variableName:ie.repeat,sources:ge})]),new n.tI({key:(0,m.XA)(ie.id),title:ie.title,y:ie.gridPos.y,isCollapsed:ie.collapsed,children:De,$behaviors:he})}function re(ie){let ge,he=[];if(ie.templating?.list?.length){const le=ie.templating.list.map(Te=>{try{return J(Te)}catch(Ee){return console.error(Ee),null}}).filter(Te=>!!Te);ge=new n.Pj({variables:le})}else ge=new n.Pj({variables:[]});ie.annotations?.list?.length&&!ie.isSnapshot()&&(he=ie.annotations?.list.map(le=>new g.g({key:`annotations-${le.name}`,query:le,name:le.name,isEnabled:!!le.enable,isHidden:!!le.hide})));let De=t.$.unifiedAlertingEnabled;return De||ie.panels.find(le=>!!le.alert)&&(De=!0),De&&he.push(new r.C({key:"alert-states",name:"Alert States"})),new b.H$({title:ie.title,tags:ie.tags||[],links:ie.links||[],uid:ie.uid,id:ie.id,description:ie.description,editable:ie.editable,isDirty:ie.meta.isNew,isEditing:ie.meta.isNew,meta:ie.meta,version:ie.version,body:new n.hy({isLazy:!0,children:Y(ie.panels)}),$timeRange:new n.JZ({from:ie.time.from,to:ie.time.to,fiscalYearStartMonth:ie.fiscalYearStartMonth,timeZone:ie.timezone,weekStart:ie.weekStart,UNSAFE_nowDelay:ie.timepicker?.nowDelay}),$variables:ge,$behaviors:[new n.Gg.K2({sync:ie.graphTooltip}),new n.Gg.Hf,D,oe(ie),ue],$data:he.length>0?new n.zr({layers:he}):void 0,controls:[new u.x({variableControls:[new n.K8({}),new n.i7],timeControls:[new n.KE({}),new n.WM({refresh:ie.refresh,intervals:ie.timepicker.refresh_intervals,withText:!0})],linkControls:new a({}),hideTimeControls:ie.timepicker.hidden})]})}function J(ie){const ge={name:ie.name,label:ie.label,description:ie.description};if(ie.type==="adhoc")return new n.H9({...ge,description:ie.description,skipUrlSync:ie.skipUrlSync,hide:ie.hide,datasource:ie.datasource,applyMode:"auto",filters:ie.filters??[],baseFilters:ie.baseFilters??[]});if(ie.type==="custom")return new n.yP({...ge,value:ie.current?.value??"",text:ie.current?.text??"",query:ie.query,isMulti:ie.multi,allValue:ie.allValue||void 0,includeAll:ie.includeAll,defaultToAll:!!ie.includeAll,skipUrlSync:ie.skipUrlSync,hide:ie.hide});if(ie.type==="query")return new n.fS({...ge,value:ie.current?.value??"",text:ie.current?.text??"",query:ie.query,datasource:ie.datasource,sort:ie.sort,refresh:ie.refresh,regex:ie.regex,allValue:ie.allValue||void 0,includeAll:ie.includeAll,defaultToAll:!!ie.includeAll,isMulti:ie.multi,skipUrlSync:ie.skipUrlSync,hide:ie.hide,definition:ie.definition});if(ie.type==="datasource")return new n.mI({...ge,value:ie.current?.value??"",text:ie.current?.text??"",regex:ie.regex,pluginId:ie.query,allValue:ie.allValue||void 0,includeAll:ie.includeAll,defaultToAll:!!ie.includeAll,skipUrlSync:ie.skipUrlSync,isMulti:ie.multi,hide:ie.hide});if(ie.type==="interval"){const he=(0,m.Sm)(ie.query),De=(0,m.pk)(ie,he);return new n.Yj({...ge,value:De,intervals:he,autoEnabled:ie.auto,autoStepCount:ie.auto_count,autoMinInterval:ie.auto_min,refresh:ie.refresh,skipUrlSync:ie.skipUrlSync,hide:ie.hide})}else{if(ie.type==="constant")return new n.x0({...ge,value:ie.query,skipUrlSync:ie.skipUrlSync,hide:ie.hide});if(ie.type==="textbox")return new n.TS({...ge,value:ie.query,skipUrlSync:ie.skipUrlSync,hide:ie.hide});if(t.$.featureToggles.groupByVariable&&ie.type==="groupby")return new n.ZG({...ge,datasource:ie.datasource,value:ie.current?.value||[],text:ie.current?.text||[],skipUrlSync:ie.skipUrlSync,hide:ie.hide,defaultOptions:ie.options});throw new Error(`Scenes: Unsupported variable type ${ie.type}`)}}function ne(ie){if(!ie.libraryPanel)return null;const ge=new C.F({title:ie.title,uid:ie.libraryPanel.uid,name:ie.libraryPanel.name,key:(0,m.XA)(ie.id)});return new n.M$({body:ge,y:ie.gridPos.y,x:ie.gridPos.x,width:ie.gridPos.w,height:ie.gridPos.h})}function q(ie){const ge=[];ge.push(new y.$({rawLinks:ie.links,menu:new y.m({$behaviors:[M.oV]})})),ge.push(new I);const he={key:(0,m.XA)(ie.id),title:ie.title?.substring(0,5e3),description:ie.description,pluginId:ie.type,options:ie.options??{},fieldConfig:ie.fieldConfig,pluginVersion:ie.pluginVersion,displayMode:ie.transparent?"transparent":void 0,hoverHeader:!ie.title&&!ie.timeFrom&&!ie.timeShift,$data:(0,G.w)(ie),menu:new n.Lw({$behaviors:[M._i]}),titleItems:ge,extendPanelContext:B,_UNSAFE_customMigrationHandler:j(ie)};if((ie.timeFrom||ie.timeShift)&&(he.$timeRange=new O.v({timeFrom:ie.timeFrom,timeShift:ie.timeShift,hideTimeOverride:ie.hideTimeOverride})),ie.repeat){const pe=ie.repeatDirection??"h";return new S.w({key:`grid-item-${ie.id}`,x:ie.gridPos.x,y:ie.gridPos.y,width:pe==="h"?24:ie.gridPos.w,height:ie.gridPos.h,itemHeight:ie.gridPos.h,source:new n.Eb(he),variableName:ie.repeat,repeatedPanels:[],repeatDirection:ie.repeatDirection,maxPerRow:ie.maxPerRow})}const De=new n.Eb(he);return new n.M$({key:`grid-item-${ie.id}`,x:ie.gridPos.x,y:ie.gridPos.y,width:ie.gridPos.w,height:ie.gridPos.h,body:De})}const te=()=>{const ie=[];return ge=>{ie.includes(ge)||(ie.push(ge),_.c.panelDescriptionShown())}};function oe(ie){return()=>{const ge=_.c.setScenesContext();return(0,s.d)(ie,ie.version),()=>{ge()}}}function ue(ie){const ge=te();ie.subscribeToEvent(n.Kw,he=>{const{interaction:De}=he.payload;switch(De){case"panel-description-shown":ge(he.payload.origin.state.key||"");break;case"panel-status-message-clicked":_.c.panelStatusMessageClicked();break;case"panel-cancel-query-clicked":_.c.panelCancelQueryClicked();break;case"panel-menu-shown":_.c.panelMenuShown();break}})}},56555:(Q,A,e)=>{"use strict";e.d(A,{ZB:()=>C,Uy:()=>b,c:()=>I});var t=e(2543),n=e(92041),o=e(79065),s=e(79422),r=e(73134),g=e(28874),u=e(18803),c=e(79056),i=e(68706),l=e(48548),f=e(60656),d=e(11497),h=e(7928),p=e(79284),m=e(32023),a=e(74730);const v={name:"grafana",uid:"grafana"};var E=e(13989),D=e(53287);function b(S,O=!1){const P=S.state,L=P.$timeRange.state,U=P.$data,R=P.$variables,B=P.body;let H,w,N=[],V=s.Ye.graphTooltip,G=[];if(B instanceof o.hy){for(const k of B.state.children)if(k instanceof o.M$&&N.push(C(k,O)),k instanceof d.w&&(N=N.concat(M(k,O))),k instanceof o.tI){if(k.state.key.indexOf("-clone-")>0&&!O)continue;T(k,N,O)}}let _=[];if(U instanceof o.zr){const k=U.state.layers;_=(0,E.O)(k)}if(R instanceof o.Pj&&(G=(0,D.C)(R)),P.controls&&P.controls[0]instanceof l.x){w=P.controls[0].state.hideTimeControls;const k=P.controls[0].state.timeControls;for(const Y of k)Y instanceof o.WM&&Y.state.intervals&&(H=Y.state.intervals)}if(P.$behaviors)for(const k of P.$behaviors)k instanceof o.Gg.K2&&(V=k.state.sync);const K=x({refresh_intervals:H,hidden:w,nowDelay:L.UNSAFE_nowDelay},s.lt),j={...s.Ye,title:P.title,description:P.description||void 0,uid:P.uid,id:P.id,editable:P.editable,time:{from:L.from,to:L.to},timepicker:K,panels:N,annotations:{list:_},templating:{list:G},version:P.version,timezone:L.timeZone,fiscalYearStartMonth:L.fiscalYearStartMonth,weekStart:L.weekStart,tags:P.tags,links:P.links,graphTooltip:V,schemaVersion:c.O2};return(0,g.v)(j)}function C(S,O=!1){let P,L=0,U=0,R=0,B=0;if(S instanceof o.M$){if(S.state.body instanceof f.F)return L=S.state.x??0,U=S.state.y??0,R=S.state.width??0,B=S.state.height??0,{id:(0,a.Cs)(S.state.body),title:S.state.body.state.title,gridPos:{x:L,y:U,w:R,h:B},libraryPanel:{name:S.state.body.state.name,uid:S.state.body.state.uid}};if(!(S.state.body instanceof o.Eb))throw new Error("SceneGridItem body expected to be VizPanel");P=S.state.body,L=S.state.x??0,U=S.state.y??0,R=S.state.width??0,B=S.state.height??0}if(S instanceof d.w&&(P=S.state.source,L=S.state.x??0,U=S.state.y??0,R=S.state.width??0,B=S.state.height??0),!P)throw new Error("Unsupported grid item type");const H={id:(0,a.Cs)(P),type:P.state.pluginId,title:P.state.title,gridPos:{x:L,y:U,w:R,h:B},options:P.state.options,fieldConfig:P.state.fieldConfig??{defaults:{},overrides:[]},transformations:[],transparent:P.state.displayMode==="transparent",pluginVersion:P.state.pluginVersion,...y(P,O)},w=P.state.$timeRange;w instanceof h.v&&(H.timeFrom=w.state.timeFrom,H.timeShift=w.state.timeShift,H.hideTimeOverride=w.state.hideTimeOverride),S instanceof d.w&&(H.repeat=S.state.variableName,H.maxPerRow=S.state.maxPerRow,H.repeatDirection=S.getRepeatDirection());const N=m.b.getPanelLinks(P);return H.links=N.state.rawLinks??[],H.links.length===0&&delete H.links,H.transformations?.length===0&&delete H.transformations,H.transparent||delete H.transparent,H}function y(S,O=!1){const P=S.state.$data,L={},U=(0,a.un)(S);if(U&&(L.targets=U.state.queries,L.maxDataPoints=U.state.maxDataPoints,L.datasource=U.state.datasource,U.state.cacheTimeout&&(L.cacheTimeout=U.state.cacheTimeout),U.state.queryCachingTTL&&(L.queryCachingTTL=U.state.queryCachingTTL)),P instanceof o.Es&&(L.transformations=P.state.transformations),P&&O){L.datasource=v;let R=(0,u.B6)(P.state.data);P instanceof o.Es&&(R=(0,u.B6)(P.state.$data.state.data)),L.targets=[{refId:"A",datasource:L.datasource,queryType:i.nj.Snapshot,snapshot:R}]}return L}function M(S,O=!1){if(O){if(S.state.repeatedPanels){const P=S.state.itemHeight??10,L=Math.ceil(S.state.repeatedPanels.length/S.getMaxPerRow()),U=Math.ceil(S.state.repeatedPanels.length/L),R=24/U,B=P;return S.state.repeatedPanels.map((w,N)=>{let V=0,G=0;S.state.repeatDirection==="v"?(V=S.state.x,G=N*B):(V=N%U*R,G=S.state.y+Math.floor(N/U)*B);const _={x:V,y:G,w:R,h:B},K=w.state.$variables.getByName(S.state.variableName);return{id:(0,a.Cs)(w),type:w.state.pluginId,title:w.state.title,gridPos:_,options:w.state.options,fieldConfig:w.state.fieldConfig??{defaults:{},overrides:[]},transformations:[],transparent:w.state.displayMode==="transparent",scopedVars:{[S.state.variableName]:{text:K?.state.text,value:K?.state.value}},...y(w,O)}})}return[]}else return[C(S)]}function T(S,O,P=!1){const L=!!S.state.isCollapsed,U={type:"row",id:(0,a.Cs)(S),title:S.state.title,gridPos:{x:S.state.x??0,y:S.state.y??0,w:S.state.width??24,h:S.state.height??1},collapsed:L,panels:[]};if(S.state.$behaviors?.length){const B=S.state.$behaviors[0];B instanceof p.L&&(U.repeat=B.state.variableName)}if(P&&S.state.$variables){const H=S.state.$variables.state.variables.reduce((w,N)=>({...w,[N.state.name]:{text:N.state.text,value:N.state.value}}),{});U.scopedVars=H}O.push(U);let R=[];P?S.state.children.forEach(B=>{B instanceof d.w?R=R.concat(M(B,!L)):R.push(C(B,!L))}):R=S.state.children.map(B=>C(B)),S.state.isCollapsed?U.panels=R:O.push(...R)}function I(S,O,P,L){let U={...P,title:S,time:{from:O.from.toISOString(),to:O.to.toISOString()},links:[]};if(L){const R=P.panels?.find(B=>B.id===(0,a.Cs)(L));R&&(R.gridPos={w:24,x:0,y:0,h:20},U={...U,panels:[R]})}if(U.panels?.forEach(R=>{"links"in R&&(R.links=[])}),U.annotations){const B=(U.annotations.list?.filter(H=>H.enable)||[]).map(H=>({name:H.name,enable:H.enable,iconColor:H.iconColor,type:H.type,builtIn:H.builtIn,hide:H.hide,snapshotData:[]}));U.annotations.list=B}return U.templating&&U.templating.list?.forEach(R=>{"query"in R&&(R.query=""),"options"in R&&(R.options=R.current&&!(0,n.R)(R.current)?[R.current]:[]),"refresh"in R&&(R.refresh=r.CO.never)}),U}function x(S,O){const P={...S};for(const L in O)(0,t.isEqual)(P[L],O[L])&&delete P[L];return P}},46502:(Q,A,e)=>{"use strict";e.d(A,{F:()=>o});var t=e(96540),n=e(7376);class o extends t.PureComponent{constructor(){super(...arguments),this.ref=null}componentWillUnmount(){this.angularComponent&&this.angularComponent.destroy()}componentDidMount(){this.ref&&this.loadAngular()}componentDidUpdate(r){r.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 r=(0,n.E)(),g='<plugin-component type="annotations-query-ctrl"> </plugin-component>',u={ctrl:{currentDatasource:this.props.datasource,currentAnnotation:this.props.annotation,ignoreNextWatcherFiring:!1}};this.angularComponent=r.load(this.ref,u,g),this.angularComponent.digest(),this.angularComponent.getScope().$watch(()=>{if(u.ctrl.ignoreNextWatcherFiring){u.ctrl.ignoreNextWatcherFiring=!1;return}this.props.onChange(u.ctrl.currentAnnotation)}),this.scopeProps=u}render(){return t.createElement("div",{ref:r=>this.ref=r})}}},65857:(Q,A,e)=>{"use strict";e.d(A,{d:()=>d});var t=e(96540),n=e(88575),o=e(10354),s=e(88323),r=e(79924),g=e(57418),u=e(10880),c=e(55852),i=e(4588);const l=[{value:"dashboards",label:"Dashboards"},{value:"link",label:"Link"}],f=Object.keys(i.G).map(h=>({label:h,value:h}));function d({link:h,onUpdate:p,onGoBack:m}){const a=C=>{p({...h,tags:C})},v=C=>{const y={...h,type:C.value};y.type==="dashboards"?(y.url="",y.tooltip=""):y.tags=[],p(y)},E=C=>{p({...h,icon:C.value})},D=C=>{const y=C.currentTarget;p({...h,[y.name]:y.type==="checkbox"?y.checked:y.value})},b=h.title===i.q.title;return t.createElement("div",{style:{maxWidth:"600px"}},t.createElement(n.D,{label:"Title"},t.createElement(o.p,{name:"title",id:"title",value:h.title,onChange:D,autoFocus:b})),t.createElement(n.D,{label:"Type"},t.createElement(s.l6,{inputId:"link-type-input",value:h.type,options:l,onChange:v})),h.type==="dashboards"&&t.createElement(t.Fragment,null,t.createElement(n.D,{label:"With tags"},t.createElement(r.u,{tags:h.tags,onChange:a}))),h.type==="link"&&t.createElement(t.Fragment,null,t.createElement(n.D,{label:"URL"},t.createElement(o.p,{name:"url",value:h.url,onChange:D})),t.createElement(n.D,{label:"Tooltip"},t.createElement(o.p,{name:"tooltip",value:h.tooltip,onChange:D,placeholder:"Open dashboard"})),t.createElement(n.D,{label:"Icon"},t.createElement(s.l6,{value:h.icon,options:f,onChange:E}))),t.createElement(g.M,{label:"Options",isOpen:!0},h.type==="dashboards"&&t.createElement(n.D,null,t.createElement(u.S,{label:"Show as dropdown",name:"asDropdown",value:h.asDropdown,onChange:D})),t.createElement(n.D,null,t.createElement(u.S,{label:"Include current time range",name:"keepTime",value:h.keepTime,onChange:D})),t.createElement(n.D,null,t.createElement(u.S,{label:"Include current template variable values",name:"includeVars",value:h.includeVars,onChange:D})),t.createElement(n.D,null,t.createElement(u.S,{label:"Open link in new tab",name:"targetBlank",value:h.targetBlank,onChange:D}))),t.createElement(c.$n,{variant:"secondary",onClick:m},"Back to list"))}},6199:(Q,A,e)=>{"use strict";e.d(A,{X:()=>f});var t=e(32196),n=e(96540),o=e(40845),s=e(14578),r=e(66864),g=e(64149),u=e(29158),c=e(91605),i=e(55852),l=e(7521);function f({links:h,onNew:p,onOrderChange:m,onEdit:a,onDuplicate:v,onDelete:E}){const D=(0,o.of)(d);return h.length===0?n.createElement("div",null,n.createElement(l.A,{onClick:p,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>"}})):n.createElement(n.Fragment,null,n.createElement("table",{role:"grid",className:"filter-table filter-table--hover"},n.createElement("thead",null,n.createElement("tr",null,n.createElement("th",null,"Type"),n.createElement("th",null,"Info"),n.createElement("th",{colSpan:3}))),n.createElement("tbody",null,h.map((C,y)=>n.createElement("tr",{key:`${C.title}-${y}`},n.createElement("td",{role:"gridcell",className:"pointer",onClick:()=>a(y)},n.createElement(s.I,{name:"external-link-alt"})," \xA0 ",C.type),n.createElement("td",{role:"gridcell"},n.createElement(r.Gy,null,C.title&&n.createElement("span",{className:D.titleWrapper},C.title),C.type==="link"&&n.createElement("span",{className:D.urlWrapper},C.url),C.type==="dashboards"&&n.createElement(g.L,{tags:C.tags??[]}))),n.createElement("td",{style:{width:"1%"},role:"gridcell"},y!==0&&n.createElement(u.K,{name:"arrow-up",onClick:()=>m(y,-1),tooltip:"Move link up"})),n.createElement("td",{style:{width:"1%"},role:"gridcell"},h.length>1&&y!==h.length-1?n.createElement(u.K,{name:"arrow-down",onClick:()=>m(y,1),tooltip:"Move link down"}):null),n.createElement("td",{style:{width:"1%"},role:"gridcell"},n.createElement(u.K,{name:"copy",onClick:()=>v(C),tooltip:"Copy link"})),n.createElement("td",{style:{width:"1%"},role:"gridcell"},n.createElement(c.e,{"aria-label":`Delete link with title "${C.title}"`,size:"sm",onConfirm:()=>E(y)})))))),n.createElement(i.$n,{className:D.newLinkButton,icon:"plus",onClick:p},"New link"))}const d=h=>({titleWrapper:(0,t.css)({width:"20vw",textOverflow:"ellipsis",overflow:"hidden"}),urlWrapper:(0,t.css)({width:"40vw",textOverflow:"ellipsis",overflow:"hidden"}),newLinkButton:(0,t.css)({marginTop:h.spacing(3)})})},4588:(Q,A,e)=>{"use strict";e.d(A,{G:()=>n,q:()=>t});const t={icon:"external link",title:"New link",tooltip:"",type:"dashboards",url:"",asDropdown:!1,tags:[],targetBlank:!1,keepTime:!1,includeVars:!1},n={"external link":"external-link-alt",dashboard:"apps",question:"question-circle",info:"info-circle",bolt:"bolt",doc:"file-alt",cloud:"cloud"}},27803:(Q,A,e)=>{"use strict";e.d(A,{Q:()=>u});var t=e(96540),n=e(13544),o=e(88575),s=e(42418),r=e(51612),g=e(58975);function u({datasource:c,infoText:i,onDataSourceChange:l}){return t.createElement(t.Fragment,null,t.createElement(g.Y,null,"Ad-hoc options"),t.createElement(o.D,{label:"Data source",htmlFor:"data-source-picker"},t.createElement(r.s,{current:c,onChange:l,width:30,variables:!0,noDefault:!0})),i?t.createElement(s.F,{title:i,severity:"info","data-testid":n.Tp.pages.Dashboard.Settings.Variables.Edit.AdHocFiltersVariable.infoText}):null)}},95802:(Q,A,e)=>{"use strict";e.d(A,{d:()=>r});var t=e(96540),n=e(13544),o=e(58975),s=e(14329);function r({onChange:g,constantValue:u}){return t.createElement(t.Fragment,null,t.createElement(o.Y,null,"Constant options"),t.createElement(s._,{defaultValue:u,name:"Value",placeholder:"your metric prefix",onBlur:g,testId:n.Tp.pages.Dashboard.Settings.Variables.Edit.ConstantVariable.constantOptionsQueryInputV2,width:30}))}},58711:(Q,A,e)=>{"use strict";e.d(A,{w:()=>g});var t=e(96540),n=e(13544),o=e(58975),s=e(85140),r=e(94618);function g({query:u,multi:c,allValue:i,includeAll:l,onQueryChange:f,onMultiChange:d,onIncludeAllChange:h,onAllValueChange:p}){return t.createElement(t.Fragment,null,t.createElement(o.Y,null,"Custom options"),t.createElement(s.Z,{name:"Values separated by comma",defaultValue:u,placeholder:"1, 10, mykey : myvalue, myvalue, escaped\\,value",onBlur:f,required:!0,width:52,testId:n.Tp.pages.Dashboard.Settings.Variables.Edit.CustomVariable.customValueInput}),t.createElement(o.Y,null,"Selection options"),t.createElement(r.B,{multi:c,includeAll:l,allValue:i,onMultiChange:d,onIncludeAllChange:h,onAllValueChange:p}))}},98917:(Q,A,e)=>{"use strict";e.d(A,{y:()=>u});var t=e(96540),n=e(13544),o=e(94618),s=e(58975),r=e(89458),g=e(14329);function u({query:c,regex:i,optionTypes:l,onChange:f,onRegExBlur:d,multi:h,includeAll:p,allValue:m,onMultiChange:a,onIncludeAllChange:v,onAllValueChange:E}){const D=l.find(b=>b.value===c)??l[0];return t.createElement(t.Fragment,null,t.createElement(s.Y,null,"Data source options"),t.createElement(r.v,{name:"Type",value:D,options:l,onChange:f,testId:n.Tp.pages.Dashboard.Settings.Variables.Edit.DatasourceVariable.datasourceSelect}),t.createElement(g._,{defaultValue:i,name:"Instance name filter",placeholder:"/.*-(.*)-.*/",onBlur:d,description:t.createElement("div",null,"Regex filter for which data source instances to choose from in the variable value list. Leave empty for all.",t.createElement("br",null),t.createElement("br",null),"Example: ",t.createElement("code",null,"/^prod/"))}),t.createElement(s.Y,null,"Selection options"),t.createElement(o.B,{multi:h,includeAll:p,allValue:m,onMultiChange:a,onIncludeAllChange:v,onAllValueChange:E}))}},49317:(Q,A,e)=>{"use strict";e.d(A,{s:()=>i});var t=e(32196),n=e(96540),o=e(13544),s=e(40845),r=e(99615),g=e(58975),u=e(89458),c=e(14329);function i({intervals:f,onIntervalsChange:d,onAutoEnabledChange:h,onAutoMinIntervalChanged:p,onAutoCountChanged:m,autoEnabled:a,autoMinInterval:v,autoStepCount:E}){const D=[1,2,3,4,5,10,20,30,40,50,100,200,300,400,500].map(y=>({label:`${y}`,value:y})),b=(0,s.of)(l),C=D.find(y=>y.value===E)??D[0];return n.createElement(n.Fragment,null,n.createElement(g.Y,null,"Interval options"),n.createElement(c._,{defaultValue:f,name:"Values",placeholder:"1m,10m,1h,6h,1d,7d",onBlur:d,testId:o.Tp.pages.Dashboard.Settings.Variables.Edit.IntervalVariable.intervalsValueInput,width:32,required:!0}),n.createElement(r.c,{value:a,name:"Auto option",description:"Dynamically calculates interval by dividing time range by the count specified",onChange:h,testId:o.Tp.pages.Dashboard.Settings.Variables.Edit.IntervalVariable.autoEnabledCheckbox}),a&&n.createElement("div",{className:b.autoFields},n.createElement(u.v,{name:"Step count",description:"How many times the current time range should be divided to calculate the value",value:C,options:D,onChange:m,width:9,testId:o.Tp.pages.Dashboard.Settings.Variables.Edit.IntervalVariable.stepCountIntervalSelect}),n.createElement(c._,{value:v,name:"Min interval",description:"The calculated value will not go below this threshold",placeholder:"10s",onChange:p,width:11,testId:o.Tp.pages.Dashboard.Settings.Variables.Edit.IntervalVariable.minIntervalInput})))}const l=f=>({autoFields:(0,t.css)({marginTop:f.spacing(2),display:"flex",flexDirection:"column"})})},44890:(Q,A,e)=>{"use strict";e.d(A,{u:()=>S});var t=e(96540),n=e(16817),o=e(13544),s=e(19347),r=e(88575),g=e(39070),u=e(72574),c=e(90613),i=e(94753),l=e(24240);function f({query:O,datasource:P,VariableQueryEditor:L,onLegacyQueryChange:U,onQueryChange:R,timeRange:B}){let H;return typeof O=="string"?H=O||(P.variables?.getDefaultQuery?.()??""):H={...P.variables?.getDefaultQuery?.(),...O},L&&(0,l.VN)(L,P)?t.createElement(c.a,{marginBottom:2},t.createElement(i.E,{element:"h4"},"Query"),t.createElement(c.a,{marginTop:1},t.createElement(L,{key:P.uid,datasource:P,query:H,templateSrv:(0,u.w)(),onChange:U}))):L&&(0,l.CH)(L,P)?t.createElement(c.a,{marginBottom:2},t.createElement(i.E,{element:"h4"},"Query"),t.createElement(c.a,{marginTop:1},t.createElement(L,{key:P.uid,datasource:P,query:H,onChange:R,onRunQuery:()=>{},data:{series:[],state:g.Gu.Done,timeRange:B},range:B,onBlur:()=>{},history:[]}))):null}var d=e(94618),h=e(51612),p=e(70766),m=e(12470),a=e(40845),v=e(94354),E=e(60619);const D=[{label:"On dashboard load",value:m.CO.onDashboardLoad},{label:"On time range change",value:m.CO.onTimeRangeChanged}];function b({onChange:O,refresh:P,testId:L}){const U=(0,a.$j)(),[R,B]=(0,t.useState)(!1);(0,E.Y)({breakpoint:U.breakpoints.values.sm,onChange:w=>{B(!w.matches)}});const H=(0,t.useMemo)(()=>D.find(w=>w.value===P)?.value??D[0].value,[P]);return t.createElement(r.D,{label:"Refresh",description:"When to update the values of this variable","data-testid":L},t.createElement(v.z,{options:D,onChange:O,value:H,size:R?"sm":"md"}))}var C=e(89458),y=e(80484);const M=[{label:"Disabled",value:y.ZG.disabled},{label:"Alphabetical (asc)",value:y.ZG.alphabeticalAsc},{label:"Alphabetical (desc)",value:y.ZG.alphabeticalDesc},{label:"Numerical (asc)",value:y.ZG.numericalAsc},{label:"Numerical (desc)",value:y.ZG.numericalDesc},{label:"Alphabetical (case-insensitive, asc)",value:y.ZG.alphabeticalCaseInsensitiveAsc},{label:"Alphabetical (case-insensitive, desc)",value:y.ZG.alphabeticalCaseInsensitiveDesc},{label:"Natural (asc)",value:y.ZG.naturalAsc},{label:"Natural (desc)",value:y.ZG.naturalDesc}];function T({onChange:O,sort:P,testId:L}){const U=(0,t.useMemo)(()=>M.find(R=>R.value===P)??M[0],[P]);return t.createElement(C.v,{name:"Sort",description:"How to sort the values of this variable",value:U,options:M,onChange:O,testId:L,width:25})}var I=e(58975),x=e(85140);function S({datasource:O,onDataSourceChange:P,query:L,onQueryChange:U,onLegacyQueryChange:R,timeRange:B,regex:H,onRegExChange:w,sort:N,onSortChange:V,refresh:G,onRefreshChange:_,isMulti:K,onMultiChange:j,includeAll:k,onIncludeAllChange:Y,allValue:ee,onAllValueChange:re}){const{value:J}=(0,n.A)(async()=>{const te=await(0,s.l)().get(O??""),oe=await(0,p.y)(te);return{datasource:te,VariableQueryEditor:oe}},[O]),{datasource:ne,VariableQueryEditor:q}=J??{};return t.createElement(t.Fragment,null,t.createElement(I.Y,null,"Query options"),t.createElement(r.D,{label:"Data source",htmlFor:"data-source-picker"},t.createElement(h.s,{current:O,onChange:P,variables:!0,width:30})),ne&&q&&t.createElement(f,{onQueryChange:U,onLegacyQueryChange:R,datasource:ne,query:L,VariableQueryEditor:q,timeRange:B}),t.createElement(x.Z,{defaultValue:H??"",name:"Regex",description:t.createElement("div",null,"Optional, if you want to extract part of a series name or metric node segment.",t.createElement("br",null),"Named capture groups can be used to separate the display text and value (",t.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>.*)-.*/",onBlur:w,testId:o.Tp.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRegExInputV2,width:52}),t.createElement(T,{testId:o.Tp.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsSortSelectV2,onChange:V,sort:N}),t.createElement(b,{testId:o.Tp.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsRefreshSelectV2,onChange:_,refresh:G}),t.createElement(I.Y,null,"Selection options"),t.createElement(d.B,{multi:!!K,includeAll:!!k,allValue:ee,onMultiChange:j,onIncludeAllChange:Y,onAllValueChange:re}))}},94618:(Q,A,e)=>{"use strict";e.d(A,{B:()=>g});var t=e(96540),n=e(13544),o=e(66864),s=e(99615),r=e(14329);function g({multi:u,includeAll:c,allValue:i,onMultiChange:l,onIncludeAllChange:f,onAllValueChange:d}){return t.createElement(o.gW,{spacing:"md",height:"inherit"},t.createElement(s.c,{value:u,name:"Multi-value",description:"Enables multiple values to be selected at the same time",onChange:l,testId:n.Tp.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsMultiSwitch}),t.createElement(s.c,{value:c,name:"Include All option",description:"Enables an option to include all variables",onChange:f,testId:n.Tp.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsIncludeAllSwitch}),c&&t.createElement(r._,{defaultValue:i??"",onBlur:d,name:"Custom all value",placeholder:"blank = auto",testId:n.Tp.pages.Dashboard.Settings.Variables.Edit.General.selectionOptionsCustomAllInput}))}},99615:(Q,A,e)=>{"use strict";e.d(A,{c:()=>s});var t=e(16792),n=e(96540),o=e(10880);function s({value:r,name:g,description:u,onChange:c,ariaLabel:i,testId:l}){const f=(0,t.Bi)();return n.createElement(o.S,{id:f,label:g,description:u,value:r,onChange:c,"aria-label":i,"data-testid":l})}},8964:(Q,A,e)=>{"use strict";e.d(A,{D:()=>g});var t=e(96540),n=e(12470),o=e(88575),s=e(94354);const r=[{label:"Label and value",value:n.zL.dontHide},{label:"Value",value:n.zL.hideLabel},{label:"Nothing",value:n.zL.hideVariable}];function g({onChange:u,hide:c,type:i}){const l=(0,t.useMemo)(()=>r.find(f=>f.value===c)?.value??r[0].value,[c]);return i==="constant"?null:t.createElement(o.D,{label:"Show on dashboard"},t.createElement(s.z,{options:r,onChange:u,value:l}))}},58975:(Q,A,e)=>{"use strict";e.d(A,{Y:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(17408);function r({className:u,...c}){const i=(0,o.of)(g);return n.createElement(s.s,{...c,className:(0,t.cx)(i.legend,u)})}function g(u){return{legend:(0,t.css)({marginTop:u.spacing(3),marginBottom:u.spacing(1)})}}},89458:(Q,A,e)=>{"use strict";e.d(A,{v:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(88575),r=e(88323);function g({name:c,description:i,value:l,options:f,onChange:d,testId:h,width:p}){const m=(0,o.of)(u),a=(0,n.useId)(),v=`variable-select-input-${c}-${a}`;return n.createElement(s.D,{label:c,description:i,htmlFor:v},n.createElement(r.l6,{"data-testid":h,inputId:v,onChange:d,value:l,width:p??30,options:f,className:m.selectContainer}))}function u(c){return{selectContainer:(0,t.css)({marginRight:c.spacing(.5)})}}},85140:(Q,A,e)=>{"use strict";e.d(A,{$:()=>c,Z:()=>u});var t=e(32196),n=e(16792),o=e(96540),s=e(40845),r=e(88575),g=e(21744);function u({value:i,defaultValue:l,name:f,description:d,placeholder:h,onChange:p,onBlur:m,ariaLabel:a,required:v,width:E,testId:D}){const b=(0,s.of)(c),C=(0,n.Bi)();return o.createElement(r.D,{label:f,description:d,htmlFor:C},o.createElement(g.f,{id:C,rows:2,value:i,defaultValue:l,onChange:p,onBlur:m,placeholder:h,required:v,"aria-label":a,cols:E,className:b.textarea,"data-testid":D}))}function c(i){return{textarea:(0,t.css)({whiteSpace:"pre-wrap",minHeight:i.spacing(4),height:"auto",overflow:"auto",padding:`${i.spacing(.75)} ${i.spacing(1)}`,width:"inherit",[i.breakpoints.down("sm")]:{width:"100%"}})}}},14329:(Q,A,e)=>{"use strict";e.d(A,{_:()=>r});var t=e(16792),n=e(96540),o=e(88575),s=e(10354);function r({value:g,defaultValue:u,name:c,placeholder:i="",onChange:l,testId:f,width:d,required:h,onBlur:p,grow:m,description:a,invalid:v,error:E,maxLength:D}){const b=(0,t.Bi)(c);return n.createElement(o.D,{label:c,description:a,invalid:v,error:E,htmlFor:b},n.createElement(s.p,{type:"text",id:b,placeholder:i,value:g,defaultValue:u,onChange:l,onBlur:p,width:m?void 0:d??30,"data-testid":f,maxLength:D,required:h}))}},41820:(Q,A,e)=>{"use strict";e.d(A,{j:()=>c});var t=e(32196),n=e(96540),o=e(13544),s=e(40845),r=e(39268),g=e(76892),u=e(55852);const c=({options:l})=>{const[f,d]=(0,n.useState)(20),[h,p]=(0,n.useState)([]),m=(0,n.useCallback)(v=>{v.preventDefault(),d(f+20)},[f,d]),a=(0,s.of)(i);return(0,n.useEffect)(()=>p(l.slice(0,f)),[f,l]),h.length?n.createElement("div",{style:{display:"flex",flexDirection:"column",marginTop:"16px"}},n.createElement("h5",null,"Preview of values"),n.createElement(r.C,null,h.map((v,E)=>n.createElement(r.C,{key:`${v.value}-${E}`,className:a.optionContainer},n.createElement(g.c,{"data-testid":o.Tp.pages.Dashboard.Settings.Variables.Edit.General.previewOfValuesOption},n.createElement("div",{className:a.label},v.label))))),l.length>f&&n.createElement(r.C,{className:a.optionContainer},n.createElement(u.$n,{onClick:m,variant:"secondary",size:"sm","aria-label":"Variable editor Preview of Values Show More link"},"Show more"))):null};c.displayName="VariableValuesPreview";function i(l){return{wrapper:(0,t.css)({display:"flex",flexDirection:"column",marginTop:l.spacing(2)}),optionContainer:(0,t.css)({marginLeft:l.spacing(.5),marginBottom:l.spacing(.5)}),label:(0,t.css)({whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:"50vw"})}}},19626:(Q,A,e)=>{"use strict";e.d(A,{D:()=>d});var t=e(32196),n=e(2543),o=e(96540),s=e(40845),r=e(14578);const g=({diff:p})=>{const m=(0,s.of)(u),a=!(0,n.isUndefined)(p.originalValue)&&!(0,n.isArray)(p.originalValue)&&!(0,n.isObject)(p.originalValue),v=!(0,n.isUndefined)(p.value)&&!(0,n.isArray)(p.value)&&!(0,n.isObject)(p.value);return o.createElement(o.Fragment,null,a&&o.createElement("span",{className:m},String(p.originalValue)),a&&v?o.createElement(r.I,{name:"arrow-right"}):null,v&&o.createElement("span",{className:m},String(p.value)))},u=p=>(0,t.css)({backgroundColor:p.colors.action.hover,borderRadius:p.shape.radius.default,color:p.colors.text.primary,fontSize:p.typography.body.fontSize,margin:p.spacing(0,.5),padding:p.spacing(.25,.5)});var c=e(56596);const i={op:"replace",originalValue:void 0,path:[""],value:void 0,startLineNumber:0},l=({diff:p,title:m})=>{const a=(0,s.of)(f);return p?o.createElement(o.Fragment,null,o.createElement(r.I,{type:"mono",name:"circle",className:a[p.op],size:"xs"})," ",o.createElement("span",{className:a.embolden},m)," ",o.createElement("span",null,(0,c.Fl)(p,p.path.length>1))," ",o.createElement(g,{diff:p})):o.createElement("div",{className:a.withoutDiff},o.createElement(r.I,{type:"mono",name:"circle",className:a.replace,size:"xs"})," ",o.createElement("span",{className:a.embolden},m)," ",o.createElement("span",null,(0,c.Fl)(i,!1)))},f=p=>({embolden:(0,t.css)({fontWeight:p.typography.fontWeightBold}),add:(0,t.css)({color:p.colors.success.main}),replace:(0,t.css)({color:p.colors.success.main}),move:(0,t.css)({color:p.colors.success.main}),copy:(0,t.css)({color:p.colors.success.main}),_get:(0,t.css)({color:p.colors.success.main}),test:(0,t.css)({color:p.colors.success.main}),remove:(0,t.css)({color:p.colors.success.main}),withoutDiff:(0,t.css)({marginBottom:p.spacing(1)})}),d=({diffs:p,title:m})=>{const a=(0,s.of)(h);return p.length===1?o.createElement("div",{className:a.container,"data-testid":"diffGroup"},o.createElement(l,{title:m,diff:p[0]})):o.createElement("div",{className:a.container,"data-testid":"diffGroup"},o.createElement(l,{title:m}),o.createElement("ul",{className:a.list},p.map((v,E)=>o.createElement("li",{className:a.listItem,key:`${(0,n.last)(v.path)}__${E}`},o.createElement("span",null,(0,c.Fl)(v))," ",o.createElement(g,{diff:v})))))},h=p=>({container:(0,t.css)({}),list:(0,t.css)({marginLeft:p.spacing(4)}),listItem:(0,t.css)({marginBottom:p.spacing(1),"&:last-child":{marginBottom:0}})})},22764:(Q,A,e)=>{"use strict";e.d(A,{M:()=>u});var t=e(32196),n=e(96540),o=e(24773),s=e.n(o),r=e(84140),g=e(40845);const u=({oldValue:c,newValue:i})=>{const l=(0,g.$j)(),f={variables:{dark:{diffViewerBackground:l.colors.background.canvas,diffViewerColor:l.colors.text.primary,addedBackground:(0,r.A)(l.v1.palette.greenShade).setAlpha(.3).toString(),addedColor:"white",removedBackground:(0,r.A)(l.v1.palette.redShade).setAlpha(.3).toString(),removedColor:"white",wordAddedBackground:(0,r.A)(l.v1.palette.greenBase).setAlpha(.4).toString(),wordRemovedBackground:(0,r.A)(l.v1.palette.redBase).setAlpha(.4).toString(),addedGutterBackground:(0,r.A)(l.v1.palette.greenShade).setAlpha(.2).toString(),removedGutterBackground:(0,r.A)(l.v1.palette.redShade).setAlpha(.2).toString(),gutterBackground:l.colors.background.primary,gutterBackgroundDark:l.colors.background.primary,highlightBackground:(0,r.A)(l.colors.primary.main).setAlpha(.4).toString(),highlightGutterBackground:(0,r.A)(l.colors.primary.shade).setAlpha(.2).toString(),codeFoldGutterBackground:l.colors.background.secondary,codeFoldBackground:l.colors.background.secondary,emptyLineBackground:l.colors.background.secondary,gutterColor:l.colors.text.disabled,addedGutterColor:l.colors.text.primary,removedGutterColor:l.colors.text.primary,codeFoldContentColor:l.colors.text.disabled,diffViewerTitleBackground:l.colors.background.secondary,diffViewerTitleColor:l.colors.text.disabled,diffViewerTitleBorderColor:l.colors.border.strong}},codeFold:{fontSize:l.typography.bodySmall.fontSize},gutter:{pre:{color:(0,r.A)(l.colors.text.disabled).setAlpha(1).toString(),opacity:.61}}};return n.createElement("div",{className:(0,t.css)({fontSize:l.typography.bodySmall.fontSize,pre:{all:"revert"}})},n.createElement(s(),{styles:f,oldValue:c,newValue:i,splitView:!1,compareMethod:o.DiffMethod.CSS,useDarkTheme:l.isDark}))}},57714:(Q,A,e)=>{"use strict";e.d(A,{Cc:()=>P,me:()=>D,bS:()=>p,rJ:()=>M,wL:()=>o});var t=e(17172);class n{getHistoryList(R,B){return typeof R!="string"?Promise.resolve([]):(0,t.AI)().get(`api/dashboards/uid/${R}/versions`,B)}getDashboardVersion(R,B){return typeof R!="string"?Promise.resolve({}):(0,t.AI)().get(`api/dashboards/uid/${R}/versions/${B}`)}restoreDashboard(R,B){if(typeof R!="string")return Promise.resolve({});const H=`api/dashboards/uid/${R}/restore`;return(0,t.AI)().post(H,{version:B})}}const o=new n;var s=e(32196),r=e(96540),g=e(40845),u=e(10880),c=e(78369),i=e(71678),l=e(55852),f=e(96374),d=e(3169);const h=({hideModal:U,onRestore:R,version:B})=>{const H=(0,d._2)(),w=async()=>{await R(B)?H.success("Dashboard restored",`Restored from version ${B.version}`):H.error("Dashboard restore failed",`Failed to restore from version ${B.version}`),U()};return r.createElement(f.u,{isOpen:!0,title:"Restore Version",icon:"history",onDismiss:U,onConfirm:w,body:r.createElement("p",null,"Are you sure you want to restore the dashboard to version ",B.version,"? All unsaved changes will be lost."),confirmText:`Yes, restore to version ${B.version}`})},p=({versions:U,canCompare:R,onCheck:B,onRestore:H})=>{const w=(0,g.of)(m);return r.createElement("div",{className:w.margin},r.createElement("table",{className:"filter-table"},r.createElement("thead",null,r.createElement("tr",null,r.createElement("th",{className:"width-4"}),r.createElement("th",{className:"width-4"},"Version"),r.createElement("th",{className:"width-14"},"Date"),r.createElement("th",{className:"width-10"},"Updated by"),r.createElement("th",null,"Notes"),r.createElement("th",null))),r.createElement("tbody",null,U.map((N,V)=>r.createElement("tr",{key:N.id},r.createElement("td",null,r.createElement(u.S,{"aria-label":`Toggle selection of version ${N.version}`,className:(0,s.css)({display:"inline"}),checked:N.checked,onChange:G=>B(G,N.id),disabled:!N.checked&&R})),r.createElement("td",null,N.version),r.createElement("td",null,N.createdDateString),r.createElement("td",null,N.createdBy),r.createElement("td",null,N.message),r.createElement("td",{className:"text-right"},V===0?r.createElement(c.v,{name:"Latest",colorIndex:17}):r.createElement(i.$s,null,({showModal:G,hideModal:_})=>r.createElement(l.$n,{variant:"secondary",size:"sm",icon:"history",onClick:()=>{G(h,{version:N,hideModal:_,onRestore:H})}},"Restore"))))))))};function m(U){return{margin:(0,s.css)({marginBottom:U.spacing(4)})}}var a=e(2543),v=e(29158),E=e(14578);const D=({onClick:U=a.noop,baseVersion:R=0,newVersion:B=0,isNewLatest:H=!1})=>{const w=(0,g.of)(b);return r.createElement("h3",{className:w.header},r.createElement(v.K,{name:"arrow-left",size:"xl",onClick:U,tooltip:"Reset version"}),r.createElement("span",null,"Comparing ",R," ",r.createElement(E.I,{name:"arrows-h"})," ",B," ",H&&r.createElement("cite",{className:"muted"},"(Latest)")))},b=U=>({header:(0,s.css)({fontSize:U.typography.h3.fontSize,display:"flex",gap:U.spacing(2),marginBottom:U.spacing(2)})});var C=e(67061),y=e(56034);const M=({hasMore:U,canCompare:R,getVersions:B,getDiff:H,isLastPage:w})=>r.createElement(C.B,null,U&&r.createElement(l.$n,{type:"button",onClick:()=>B(!0),variant:"secondary",disabled:w},"Show more versions"),r.createElement(y.m,{content:"Select two versions to start comparing",placement:"bottom"},r.createElement(l.$n,{type:"button",disabled:!R,onClick:H,icon:"code-branch"},"Compare versions")));var T=e(90613),I=e(57418),x=e(19626),S=e(22764),O=e(56596);const P=({baseInfo:U,newInfo:R,diffData:B,isNewLatest:H,onRestore:w})=>{const N=(0,O.G4)(B.lhs,B.rhs),V=(0,g.of)(L);return r.createElement(C.B,{direction:"column",gap:1},r.createElement(C.B,{justifyContent:"space-between",alignItems:"center"},r.createElement(C.B,{alignItems:"center"},r.createElement("span",{className:(0,s.cx)(V.versionInfo,V.noMarginBottom)},r.createElement("strong",null,"Version ",U.version)," updated by ",U.createdBy," ",U.ageString,U.message),r.createElement(E.I,{name:"arrow-right",size:"sm"}),r.createElement("span",{className:V.versionInfo},r.createElement("strong",null,"Version ",R.version)," updated by ",R.createdBy," ",R.ageString,R.message)),H&&r.createElement(i.$s,null,({showModal:G,hideModal:_})=>r.createElement(l.$n,{variant:"destructive",icon:"history",onClick:()=>{G(h,{version:U,onRestore:w,hideModal:_})}},"Restore to version ",U.version))),Object.entries(N).map(([G,_])=>r.createElement(x.D,{diffs:_,key:G,title:G})),r.createElement(T.a,{paddingTop:2},r.createElement(I.M,{isOpen:!1,label:"View JSON Diff"},r.createElement(S.M,{oldValue:JSON.stringify(B.lhs,null,2),newValue:JSON.stringify(B.rhs,null,2)}))))},L=U=>({versionInfo:(0,s.css)({color:U.colors.text.secondary,fontSize:U.typography.bodySmall.fontSize}),noMarginBottom:(0,s.css)({marginBottom:0})})},56596:(Q,A,e)=>{"use strict";e.d(A,{Fl:()=>g,G4:()=>r});var t=e(54949),n=e(25504),o=e(2543),s=e.n(o);const r=(i,l)=>{const f=(0,t.UD)(i,l),d=n.stringify(i,null,2),h=n.stringify(l,null,2),p=v=>v.map(E=>{let D,b,C=0;const y=(0,o.tail)(E.path.split("/"));return E.op==="replace"&&h.pointers[E.path]&&(D=(0,o.get)(i,y),b=E.value,C=h.pointers[E.path].value.line),E.op==="add"&&h.pointers[E.path]&&(b=E.value,C=h.pointers[E.path].value.line),E.op==="remove"&&d.pointers[E.path]&&(D=(0,o.get)(i,y),C=d.pointers[E.path].value.line),{op:E.op,value:b,path:y,originalValue:D,startLineNumber:C}}),m=v=>(0,o.sortBy)(v,"startLineNumber"),a=v=>v.reduce((E,D)=>{const b=D.path[0];return E[b]||(E[b]=[]),E[b].push(D),E},{});return(0,o.flow)([p,m,a])(f)},g=(i,l=!0)=>{const f=(0,o.last)(i.path),d=u(f),h=i.op==="remove"?i.originalValue:i.value;let p=c(i.op);return l&&(d?p+=` item ${f}`:(0,o.isArray)(h)&&!(0,o.isEmpty)(h)?p+=` ${h.length} ${f}`:p+=` ${f}`),p},u=i=>!(0,o.isNaN)((0,o.toNumber)(i)),c=i=>i==="add"?"added":i==="remove"?"deleted":"changed"},58441:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>_e});var t=e(96540),n=e(32264),o=e(79065),s=e(25897),r=e(37390),g=e(40980),u=e(10096),c=e(44836),i=e(72254),l=e(7758),f=e(74730),d=e(4213),h=e.n(d),p=e(16817),m=e(70713),a=e(66864),v=e(88575),E=e(15292),D=e(55852),b=e(32372),C=e(10534),y=e(15858),M=e(22699),T=e(34214),I=e(56555);const x=(0,c.t)("share-modal.export.share-externally-label","Export for sharing externally");class S extends o.Bs{constructor(Ne){super({isSharingExternally:!1,isViewingJSON:!1,...Ne}),this.tabId=M.wr.export,this._exporter=new y.M,this.onShareExternallyChange=()=>{this.setState({isSharingExternally:!this.state.isSharingExternally})},this.onViewJSON=()=>{this.setState({isViewingJSON:!this.state.isViewingJSON})}}getTabLabel(){return(0,c.t)("share-modal.tab-title.export","Export")}getClipboardText(){}async getExportableDashboardJson(){const{dashboardRef:Ne,isSharingExternally:ot}=this.state,nt=(0,I.Uy)(Ne.resolve());return ot?await this._exporter.makeExportable(new T.G(nt)):nt}async onSaveAsFile(){const Ne=await this.getExportableDashboardJson(),ot=JSON.stringify(Ne,null,2),{isSharingExternally:nt}=this.state,pt=new Blob([ot],{type:"application/json;charset=utf-8"}),mt=new Date().getTime();let gt="dashboard";"title"in Ne&&Ne.title&&(gt=Ne.title),h()(pt,`${gt}-${mt}.json`),l.c.exportDownloadJsonClicked({externally:nt})}}S.Component=O;function O({model:Ve}){const{isSharingExternally:Ne,isViewingJSON:ot,modalRef:nt}=Ve.useState(),pt=(0,p.A)(async()=>{if(ot){const mt=await Ve.getExportableDashboardJson();return JSON.stringify(mt,null,2)}return""},[ot]);return t.createElement(t.Fragment,null,!ot&&t.createElement(t.Fragment,null,t.createElement("p",{className:"share-modal-info-text"},t.createElement(c.x6,{i18nKey:"share-modal.export.info-text"},"Export this dashboard.")),t.createElement(a.gW,{spacing:"md"},t.createElement(v.D,{label:x},t.createElement(E.d,{id:"share-externally-toggle",value:Ne,onChange:Ve.onShareExternallyChange}))),t.createElement(r.a.ButtonRow,null,t.createElement(D.$n,{variant:"secondary",onClick:()=>{nt?.resolve().onDismiss()},fill:"outline"},t.createElement(c.x6,{i18nKey:"share-modal.export.cancel-button"},"Cancel")),t.createElement(D.$n,{variant:"secondary",icon:"brackets-curly",onClick:Ve.onViewJSON},t.createElement(c.x6,{i18nKey:"share-modal.export.view-button"},"View JSON")),t.createElement(D.$n,{variant:"primary",icon:"save",onClick:()=>Ve.onSaveAsFile()},t.createElement(c.x6,{i18nKey:"share-modal.export.save-button"},"Save to file")))),ot&&t.createElement(t.Fragment,null,t.createElement(m.Ay,{disableHeight:!0},({width:mt})=>pt.value?t.createElement(b.B,{value:pt.value??"",language:"json",showMiniMap:!1,height:"500px",width:mt}):pt.loading?t.createElement("div",null,"Loading..."):null),t.createElement(r.a.ButtonRow,null,t.createElement(D.$n,{variant:"secondary",fill:"outline",onClick:Ve.onViewJSON,icon:"arrow-left"},t.createElement(c.x6,{i18nKey:"share-modal.export.back-button"},"Back to export config")),t.createElement(C.b,{variant:"secondary",icon:"copy",disabled:pt.loading,getText:()=>pt.value??""},t.createElement(c.x6,{i18nKey:"share-modal.view-json.copy-button"},"Copy to Clipboard")),t.createElement(D.$n,{variant:"primary",icon:"save",disabled:pt.loading,onClick:()=>Ve.onSaveAsFile()},t.createElement(c.x6,{i18nKey:"share-modal.export.save-button"},"Save to file")))))}var P=e(86394),L=e(11497);class U extends o.Bs{constructor(){super(...arguments),this.tabId=M.wr.libraryPanel}getTabLabel(){return(0,c.t)("share-modal.tab-title.library-panel","Library panel")}}U.Component=R;function R({model:Ve}){const{panelRef:Ne,dashboardRef:ot,modalRef:nt}=Ve.useState();if(!Ne)return null;const pt=Ne.resolve();if(pt.parent instanceof o.M$||pt.parent instanceof L.w){const mt=ot.resolve(),gt=(0,I.ZB)(pt.parent),Pt=new T.a(gt),Mt=(0,I.Uy)(mt),Yt=new T.G(Mt);return t.createElement(P.j,{initialFolderUid:mt.state.meta.folderUid,dashboard:Yt,panel:Pt,onDismiss:()=>{nt?.resolve().onDismiss()}})}return null}var B=e(47232),H=e(13544),w=e(12131),N=e(84167),V=e(10354),G=e(14578),_=e(42418),K=e(7030),j=e(87895),k=e(11982);class Y extends o.Bs{constructor(Ne){super({...Ne,useLockedTime:!0,useShortUrl:!1,selectedTheme:"current",shareUrl:"",imageUrl:""}),this.tabId=M.wr.link,this.onToggleLockedTime=()=>{this.setState({useLockedTime:!this.state.useLockedTime}),this.buildUrl()},this.onUrlShorten=()=>{this.setState({useShortUrl:!this.state.useShortUrl}),this.buildUrl()},this.onThemeChange=ot=>{this.setState({selectedTheme:ot}),this.buildUrl()},this.getShareUrl=()=>this.state.shareUrl,this.addActivationHandler(()=>{this.buildUrl()})}async buildUrl(){const{panelRef:Ne,dashboardRef:ot,useLockedTime:nt,useShortUrl:pt,selectedTheme:mt}=this.state,gt=ot.resolve(),Pt=Ne?.resolve(),Mt=w.Ny.getLocation(),Yt=o.jh.getTimeRange(Pt??gt),zt={};Pt&&(zt.viewPanel=Pt.state.key),nt&&(zt.from=Yt.state.value.from.toISOString(),zt.to=Yt.state.value.to.toISOString()),mt!=="current"&&(zt.theme=mt);let _t=(0,k.uZ)({uid:gt.state.uid,slug:gt.state.meta.slug,currentQueryParams:Mt.search,updateQuery:zt,absolute:!0});pt&&(_t=await(0,K.f)(_t));let rt=zt;Pt&&(delete rt.viewPanel,rt.panelId=Pt.state.key,rt["__feature.dashboardSceneSolo"]=!0);const It=(0,k.uZ)({uid:gt.state.uid,currentQueryParams:Mt.search,updateQuery:{...zt,panelId:Pt?.state.key},absolute:!0,soloRoute:!0,render:!0,timeZone:re(Yt.getTimeZone())});this.setState({shareUrl:_t,imageUrl:It})}getTabLabel(){return(0,c.t)("share-modal.tab-title.link","Link")}onCopy(){l.c.shareLinkCopied({currentTimeRange:this.state.useLockedTime,theme:this.state.selectedTheme,shortenURL:this.state.useShortUrl})}}Y.Component=ee;function ee({model:Ve}){const Ne=Ve.useState(),{panelRef:ot,dashboardRef:nt}=Ne,pt=nt.resolve(),mt=ot?.resolve(),Pt=o.jh.getTimeRange(mt??pt).state.to==="now",{useLockedTime:Mt,useShortUrl:Yt,selectedTheme:zt,shareUrl:_t,imageUrl:rt}=Ne,It=H.Tp.pages.SharePanelModal,Dn=!!pt.state.uid,ft=(0,c.t)("share-modal.link.time-range-label","Lock time range"),yt=(0,c.t)("share-modal.link.time-range-description","Transforms the current relative time range to an absolute time range"),jt=(0,c.t)("share-modal.link.shorten-url","Shorten URL"),cn=(0,c.t)("share-modal.link.link-url","Link URL");return t.createElement(t.Fragment,null,t.createElement("p",{className:"share-modal-info-text"},t.createElement(c.x6,{i18nKey:"share-modal.link.info-text"},"Create a direct link to this dashboard or panel, customized with the options below.")),t.createElement(N.n,null,t.createElement(v.D,{label:ft,description:Pt?yt:""},t.createElement(E.d,{id:"share-current-time-range",value:Mt,onChange:Ve.onToggleLockedTime})),t.createElement(j.w,{selectedTheme:zt,onChange:Ve.onThemeChange}),t.createElement(v.D,{label:jt},t.createElement(E.d,{id:"share-shorten-url",value:Yt,onChange:Ve.onUrlShorten})),t.createElement(v.D,{label:cn},t.createElement(V.p,{id:"link-url-input",value:_t,readOnly:!0,addonAfter:t.createElement(C.b,{icon:"copy",variant:"primary",getText:Ve.getShareUrl,onClipboardCopy:Ve.onCopy},t.createElement(c.x6,{i18nKey:"share-modal.link.copy-link-button"},"Copy"))}))),mt&&n.$.rendererAvailable&&t.createElement(t.Fragment,null,Dn&&t.createElement("div",{className:"gf-form"},t.createElement("a",{href:rt,target:"_blank",rel:"noreferrer","aria-label":It.linkToRenderedImage},t.createElement(G.I,{name:"camera"}),"\xA0",t.createElement(c.x6,{i18nKey:"share-modal.link.rendered-image"},"Direct link rendered image"))),!Dn&&t.createElement(_.F,{severity:"info",title:(0,c.t)("share-modal.link.save-alert","Dashboard is not saved"),bottomSpacing:0},t.createElement(c.x6,{i18nKey:"share-modal.link.save-dashboard"},"To render a panel image, you must save the dashboard first."))),mt&&!n.$.rendererAvailable&&t.createElement(_.F,{severity:"info",title:(0,c.t)("share-modal.link.render-alert","Image renderer plugin not installed"),bottomSpacing:0},t.createElement(c.x6,{i18nKey:"share-modal.link.render-instructions"},"To render a panel image, you must install the",t.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.")))}function re(Ve){const Ne="UTC"+encodeURIComponent((0,B.KQ)().format("Z"));if(Ve==="utc")return"UTC";if(Ve==="browser"){if(!window.Intl)return Ne;const nt=window.Intl.DateTimeFormat().resolvedOptions();return nt.timeZone?nt.timeZone:Ne}return Ve}var J=e(35280),ne=e(7928);class q extends o.Bs{constructor(Ne){super(Ne),this.tabId=M.wr.embed}getTabLabel(){return(0,c.t)("share-modal.tab-title.panel-embed","Embed")}}q.Component=te;function te({model:Ve}){const{panelRef:Ne,dashboardRef:ot}=Ve.useState(),nt=Ne.resolve(),pt=ot.resolve(),{uid:mt}=pt.useState(),gt=(0,f.Cs)(nt),Pt=o.jh.getTimeRange(nt),Mt=Pt instanceof ne.v?Pt.state.timeFrom:void 0;return t.createElement(J.D,{panel:{id:gt,timeFrom:Mt},range:Pt.state.value,dashboard:{uid:mt??"",time:Pt.state.value},buildIframe:oe(pt)})}const oe=Ve=>(Ne,ot,nt,pt,mt)=>{const gt=(0,M.XV)({useCurrentTimeRange:Ne,selectedTheme:nt,panel:pt,range:mt}),Pt=gt.get("editPanel")??gt.get("viewPanel")??"";return gt.set("panelId",Pt),gt.delete("editPanel"),gt.delete("viewPanel"),gt.set("__feature.dashboardSceneSolo","true"),`<iframe src="${(0,k.uZ)({absolute:!0,soloRoute:!0,uid:Ve.state.uid,slug:Ve.state.meta.slug,currentQueryParams:gt.toString()})}" width="450" height="200" frameborder="0"></iframe>`};var ue=e(5805),ie=e(17172),ge=e(94354),he=e(69064);const De=()=>[{label:(0,c.t)("share-modal.snapshot.expire-never","Never"),value:0},{label:(0,c.t)("share-modal.snapshot.expire-hour","1 Hour"),value:60*60},{label:(0,c.t)("share-modal.snapshot.expire-day","1 Day"),value:60*60*24},{label:(0,c.t)("share-modal.snapshot.expire-week","7 Days"),value:60*60*24*7}];class pe extends o.Bs{constructor(Ne){super({...Ne,snapshotName:Ne.dashboardRef.resolve().state.title,selectedExpireOption:De()[0]}),this.tabId=M.wr.snapshot,this.onSnasphotNameChange=ot=>{this.setState({snapshotName:ot.trim()})},this.onExpireChange=ot=>{this.setState({selectedExpireOption:De().find(nt=>nt.value===ot)})},this.onSnapshotCreate=async(ot=!1)=>{const{selectedExpireOption:nt}=this.state,pt=this.prepareSnapshot(),mt={dashboard:pt,name:pt.title,expires:nt?.value,external:ot};try{return await(0,he.s)().create(mt)}finally{ot?l.c.publishSnapshotClicked({expires:mt.expires}):l.c.publishSnapshotLocalClicked({expires:mt.expires})}},this.addActivationHandler(()=>{this._onActivate()})}_onActivate(){(0,he.s)().getSharingOptions().then(Ne=>{this.isActive&&this.setState({snapshotSharingOptions:Ne})})}getTabLabel(){return(0,c.t)("share-modal.tab-title.snapshot","Snapshot")}prepareSnapshot(){const Ne=o.jh.getTimeRange(this),{dashboardRef:ot,panelRef:nt}=this.state,pt=(0,I.Uy)(ot.resolve(),!0);return(0,I.c)(this.state.snapshotName||"",Ne.state.value,pt,nt?.resolve())}}pe.Component=le;function le({model:Ve}){const{snapshotName:Ne,selectedExpireOption:ot,modalRef:nt,snapshotSharingOptions:pt}=Ve.useState(),[mt,gt]=(0,ue.default)(async(Yt=!1)=>Ve.onSnapshotCreate(Yt)),[Pt,Mt]=(0,ue.default)(async Yt=>await(0,ie.AI)().get(Yt));return Pt.value?t.createElement(c.x6,{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."):t.createElement(t.Fragment,null,!mt.value&&t.createElement(t.Fragment,null,t.createElement("div",null,t.createElement("p",{className:"share-modal-info-text"},t.createElement(c.x6,{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.")),t.createElement("p",{className:"share-modal-info-text"},t.createElement(c.x6,{i18nKey:"share-modal.snapshot.info-text-2"},"Keep in mind, your snapshot ",t.createElement("em",null,"can be viewed by anyone")," that has the link and can access the URL. Share wisely."))),t.createElement(v.D,{label:(0,c.t)("share-modal.snapshot.name","Snapshot name")},t.createElement(V.p,{id:"snapshot-name-input",width:30,defaultValue:Ne,onBlur:Yt=>Ve.onSnasphotNameChange(Yt.target.value)})),t.createElement(v.D,{label:(0,c.t)("share-modal.snapshot.expire","Expire")},t.createElement(ge.z,{id:"expire-select-input",options:De(),value:ot?.value,onChange:Ve.onExpireChange})),t.createElement(r.a.ButtonRow,null,t.createElement(D.$n,{variant:"secondary",onClick:()=>{nt?.resolve().onDismiss()},fill:"outline"},t.createElement(c.x6,{i18nKey:"share-modal.snapshot.cancel-button"},"Cancel")),pt?.externalEnabled&&t.createElement(D.$n,{variant:"secondary",disabled:mt.loading,onClick:()=>gt(!0)},pt?.externalSnapshotName),t.createElement(D.$n,{variant:"primary",disabled:mt.loading,onClick:()=>gt()},t.createElement(c.x6,{i18nKey:"share-modal.snapshot.local-button"},"Local Snapshot")))),mt.value&&t.createElement(t.Fragment,null,t.createElement(v.D,{label:(0,c.t)("share-modal.snapshot.url-label","Snapshot URL")},t.createElement(V.p,{id:"snapshot-url-input",value:mt.value.url,readOnly:!0,addonAfter:t.createElement(C.b,{icon:"copy",variant:"primary",getText:()=>mt.value.url},t.createElement(c.x6,{i18nKey:"share-modal.snapshot.copy-link-button"},"Copy"))})),t.createElement("div",{className:"pull-right",style:{padding:"5px"}},t.createElement(c.x6,{i18nKey:"share-modal.snapshot.mistake-message"},"Did you make a mistake? "),"\xA0",t.createElement(D.$n,{fill:"outline",size:"md",variant:"destructive",onClick:()=>{Mt(mt.value.deleteUrl)}},t.createElement(c.x6,{i18nKey:"share-modal.snapshot.delete-button"},"Delete snapshot.")))))}var Te=e(72686),Ee=e(4785),Re=e(32196),me=e(40845),Me=e(59037),ye=e(80348),Le=e(96374);class We extends o.Bs{constructor(Ne){super({confirmVariant:"destructive",dismissText:"Cancel",dismissVariant:"secondary",icon:"exclamation-triangle",confirmButtonVariant:"destructive",...Ne})}onDismiss(){}}We.Component=Be;function Be({model:Ve}){const Ne=Ve.useState();return t.createElement(Le.u,{...Ne})}var Ye=e(26657),at=e(31204),st=e(31193),Ke=e(60656);const Xe=async Ve=>{let Ne=new Set;for(const ot of Ve)at.z.has(ot)&&await(0,st.tR)().get(ot)instanceof Ye.iy||Ne.add(ot);return Array.from(Ne)};function He(Ve){const Ne=new Set,ot=Ve.state.body;if(!(ot instanceof o.hy))return[];for(const nt of ot.state.children){if(nt instanceof o.M$){const pt=xe(nt);for(const mt of pt)Ne.add(mt)}if(nt instanceof o.tI){const pt=Ge(nt);for(const mt of pt)Ne.add(mt)}}return Array.from(Ne).sort()}function Ge(Ve){return new Set(Ve.state.children.map(ot=>xe(ot)).flat())}function xe(Ve){let Ne;if(Ve instanceof o.M$)if(Ve.state.body instanceof Ke.F)Ne=Ve.state.body.state.panel;else if(Ve.state.body instanceof o.Eb)Ne=Ve.state.body;else throw new Error("SceneGridItem body expected to be VizPanel");else Ve instanceof L.w&&(Ne=Ve.state.source);if(!Ne)throw new Error("Unsupported grid item type");const ot=Ne.state.$data,nt=new Set;if(ot instanceof o.dt)for(const pt of ot.state.queries)nt.add(pt.datasource?.type??"");if(ot instanceof o.Es){const pt=ot.state.$data;if(pt instanceof o.dt)for(const mt of pt.state.queries)nt.add(mt.datasource?.type??"")}return Array.from(nt)}function $e(Ve){const{value:Ne}=(0,p.A)(async()=>{const ot=He(Ve);return Xe(ot)},[]);return Ne}function be({model:Ve,publicDashboard:Ne,isGetLoading:ot}){const nt=(0,me.of)(Z),pt=u.TP.hasPermission(ye.AccessControlAction.DashboardsPublicWrite),{dashboardRef:mt}=Ve.useState(),gt=mt.resolve(),{isDirty:Pt}=gt.useState(),[Mt]=(0,Te.bN)(),Yt=(gt.state.$variables?.state.variables.length??0)>0,zt=$e(gt),rt=o.jh.getTimeRange(Ve).useState();return t.createElement(Me.b,{dashboard:gt,publicDashboard:Ne,unsupportedDatasources:zt,onRevoke:()=>{gt.showModal(new We({isOpen:!0,title:"Revoke public URL",icon:"trash-alt",confirmText:"Revoke public URL",body:t.createElement("p",{className:nt.description},"Are you sure you want to revoke this URL? The dashboard will no longer be public."),onDismiss:()=>{gt.showModal(new _e({dashboardRef:mt,activeTab:"Public Dashboard"}))},onConfirm:()=>{Mt({dashboard:gt,dashboardUid:gt.state.uid,uid:Ne.uid}),gt.closeModal()}}))},timeRange:rt.value,showSaveChangesAlert:pt&&Pt,hasTemplateVariables:Yt})}const Z=Ve=>({description:(0,Re.css)({fontSize:Ve.typography.body.fontSize})});var ae=e(22234);function de({model:Ve}){const{dashboardRef:Ne}=Ve.useState(),ot=Ne.resolve(),nt=$e(ot),pt=(ot.state.$variables?.state.variables.length??0)>0;return t.createElement(ae.D,{dashboard:ot,unsupportedDatasources:nt,unsupportedTemplateVariables:pt})}class ve extends o.Bs{constructor(){super(...arguments),this.tabId=M.wr.publicDashboard}getTabLabel(){return(0,c.t)("share-modal.tab-title.public-dashboard","Public Dashboard")}}ve.Component=Ue;function Ue({model:Ve}){const{data:Ne,isLoading:ot}=(0,Te.Bs)(Ve.state.dashboardRef.resolve().state.uid);return t.createElement(t.Fragment,null,ot?t.createElement(Ee.a,null):(0,i.lI)(Ne)?t.createElement(be,{model:Ve,publicDashboard:Ne,isGetLoading:ot}):t.createElement(de,{model:Ve}))}class _e extends o.Bs{constructor(Ne){super({activeTab:"link",...Ne}),this.onDismiss=()=>{(0,f.YQ)(this).closeModal()},this.onChangeTab=ot=>{l.c.sharingTabChanged({item:ot.value}),this.setState({activeTab:ot.value})},this.addActivationHandler(()=>this.buildTabs())}buildTabs(){const{dashboardRef:Ne,panelRef:ot}=this.state,nt=[new Y({dashboardRef:Ne,panelRef:ot,modalRef:this.getRef()})];ot||nt.push(new S({dashboardRef:Ne,modalRef:this.getRef()})),u.TP.isSignedIn&&n.$.snapshotEnabled&&nt.push(new pe({panelRef:ot,dashboardRef:Ne,modalRef:this.getRef()})),ot&&(nt.push(new q({panelRef:ot,dashboardRef:Ne})),ot.resolve()instanceof o.Eb&&nt.push(new U({panelRef:ot,dashboardRef:Ne,modalRef:this.getRef()}))),(0,i.iR)()&&nt.push(new ve({dashboardRef:Ne,modalRef:this.getRef()})),this.setState({tabs:nt})}}_e.Component=ze;function ze({model:Ve}){const{panelRef:Ne,tabs:ot,activeTab:nt}=Ve.useState(),pt=Ne?(0,c.t)("share-modal.panel.title","Share Panel"):(0,c.t)("share-modal.dashboard.title","Share");if(!ot)return;const mt=ot?.map(Mt=>({label:Mt.getTabLabel(),value:Mt.tabId})),gt=t.createElement(s.J,{title:pt,icon:"share-alt",tabs:mt,activeTab:nt,onChangeTab:Ve.onChangeTab}),Pt=ot.find(Mt=>Mt.tabId===nt);return t.createElement(r.a,{isOpen:!0,title:gt,onDismiss:Ve.onDismiss},t.createElement(g.J,null,Pt&&t.createElement(Pt.Component,{model:Pt})))}},96556:(Q,A,e)=>{"use strict";e.d(A,{w:()=>o});var t=e(32264),n=e(79065);function o(s){if(!s.targets?.length||t.$.panels[s.type]?.skipDataQuery)return;let r;return r=new n.dt({datasource:s.datasource??void 0,queries:s.targets,maxDataPoints:s.maxDataPoints??void 0,maxDataPointsFromWidth:!0,cacheTimeout:s.cacheTimeout,queryCachingTTL:s.queryCachingTTL,dataLayerFilter:{panelId:s.id}}),new n.Es({$data:r,transformations:s.transformations||[]})}},32023:(Q,A,e)=>{"use strict";e.d(A,{b:()=>l});var t=e(79065),n=e(48548),o=e(42397);function s(f){const d=g(f);if(d){const h=d.state.timeControls.find(p=>p instanceof t.KE);if(h&&h instanceof t.KE)return h}return null}function r(f){const d=g(f);if(d){for(const h of d.state.timeControls)if(h instanceof t.WM)return h}return null}function g(f){return f.state.controls?.[0]instanceof n.x?f.state.controls[0]:null}function u(f){if(f.state.titleItems&&Array.isArray(f.state.titleItems)&&f.state.titleItems[0]instanceof o.$)return f.state.titleItems[0];throw new Error("VizPanelLinks links not found")}function c(f){const d=[];return f.state.body.forEachChild(h=>{h instanceof t.M$?h.state.body instanceof t.Eb&&d.push(h.state.body):h instanceof t.tI&&h.forEachChild(p=>{p instanceof t.M$&&p.state.body instanceof t.Eb&&d.push(p.state.body)})}),d}function i(f){const d=t.jh.getData(f);if(!(d instanceof t.zr))throw new Error("SceneDataLayers not found");return d}const l={getTimePicker:s,getRefreshPicker:r,getDashboardControls:g,getPanelLinks:u,getVizPanels:c,getDataLayers:i}},7758:(Q,A,e)=>{"use strict";e.d(A,{c:()=>o});var t=e(14110);let n=!1;const o={dashboardInitialized:r=>{s("init_dashboard_completed",{...r})},panelMenuShown:r=>{s("panelheader_menu",{...r,item:"menu"})},panelMenuItemClicked:r=>{s("panelheader_menu",{item:r})},panelMenuInspectClicked(r){s("panelheader_menu",{item:"inspect",tab:r})},panelLinkClicked:r=>{s("panelheader_datalink_clicked",r)},panelStatusMessageClicked:r=>{s("panelheader_statusmessage_clicked",r)},panelCancelQueryClicked:r=>{s("panelheader_cancelquery_clicked",r)},panelDescriptionShown:r=>{s("panelheader_description_displayed",r)},sharingTabChanged:r=>{s("sharing_category_clicked",r)},shareLinkCopied:r=>{s("sharing_link_copy_clicked",r)},embedSnippetCopy:r=>{s("sharing_embed_copy_clicked",r)},publishSnapshotClicked:r=>{s("sharing_snapshot_publish_clicked",r)},publishSnapshotLocalClicked:r=>{s("sharing_snapshot_local_clicked",r)},exportDownloadJsonClicked:r=>{s("sharing_export_download_json_clicked",r)},exportCopyJsonClicked:r=>{s("sharing_export_copy_json_clicked",r)},exportSaveJsonClicked:r=>{s("sharing_export_save_json_clicked",r)},exportViewJsonClicked:r=>{s("sharing_export_view_json_clicked",r)},generatePublicDashboardUrlClicked:r=>{s("sharing_public_generate_url_clicked",r)},revokePublicDashboardEmailClicked:r=>{s("sharing_public_email_revoke_clicked",r)},resendPublicDashboardEmailClicked:r=>{s("sharing_public_email_resend_clicked",r)},publicDashboardEmailInviteClicked:r=>{s("sharing_public_email_invite_clicked",r)},publicDashboardShareTypeChange:r=>{s("sharing_public_can_view_clicked",r)},publicDashboardTimeSelectionChanged:r=>{s("sharing_public_time_picker_clicked",r)},publicDashboardAnnotationsSelectionChanged:r=>{s("sharing_public_annotations_clicked",r)},publicDashboardUrlCopied:r=>{s("sharing_public_copy_url_clicked",r)},publicDashboardPauseSharingClicked:r=>{s("sharing_public_pause_clicked",r)},revokePublicDashboardClicked:r=>{s("sharing_public_revoke_clicked",r)},emptyDashboardButtonClicked:r=>{s("emptydashboard_clicked",r)},toolbarAddButtonClicked:r=>{s("toolbar_add_clicked",r)},toolbarFavoritesClick:()=>{s("toolbar_actions_clicked",{item:"favorites"})},toolbarSettingsClick:()=>{s("toolbar_actions_clicked",{item:"settings"})},toolbarRefreshClick:()=>{s("toolbar_actions_clicked",{item:"refresh"})},toolbarTimePickerClick:()=>{s("toolbar_actions_clicked",{item:"time_picker"})},toolbarZoomClick:()=>{s("toolbar_actions_clicked",{item:"zoom_out_time_range"})},toolbarShareClick:()=>{s("toolbar_actions_clicked",{item:"share"})},toolbarSaveClick:()=>{s("toolbar_actions_clicked",{item:"save"})},toolbarSaveAsClick:()=>{s("toolbar_actions_clicked",{item:"save_as"})},toolbarAddClick:()=>{s("toolbar_actions_clicked",{item:"add"})},setScenesContext:()=>(n=!0,()=>{n=!1})},s=(r,g)=>{const u=n?{scenesView:!0}:{};g?(0,t.rR)(`dashboards_${r}`,{...g,...u}):(0,t.rR)(`dashboards_${r}`)}},99246:(Q,A,e)=>{"use strict";e.d(A,{C:()=>t,Y:()=>n});const t={left:[],right:[]};function n(o,s){t[o].push(s)}},11982:(Q,A,e)=>{"use strict";e.d(A,{Lp:()=>h,Uu:()=>d,e0:()=>f,r7:()=>l,uZ:()=>i});var t=e(76885),n=e(71733),o=e(12131),s=e(32264),r=e(79065),g=e(10096),u=e(87490),c=e(74730);function i(p){let m=`/d/${p.uid}`;p.uid||(m="/dashboard/new"),p.soloRoute&&(m=`/d-solo/${p.uid}`),p.slug&&(m+=`/${p.slug}`),p.subPath&&(m+=p.subPath),p.render&&(m="/render"+m,p.updateQuery={...p.updateQuery,width:1e3,height:500,tz:p.timeZone});const a=p.currentQueryParams?(0,o.SE)(p.currentQueryParams):{};if(p.updateQuery)for(const E of Object.keys(p.updateQuery))p.updateQuery[E]===null||p.updateQuery[E]===void 0?delete a[E]:a[E]=p.updateQuery[E];const v=t.kM.renderUrl(m,a);return p.absolute?s.$.appUrl+v.slice(1):v}function l(p){return n.I.getUrlForPartial(o.Ny.getLocation(),{viewPanel:p.state.key})}function f(p){return n.I.getUrlForPartial(o.Ny.getLocation(),{editPanel:p})}function d(p,m){const a=p.state.key?.replace("-view","");return n.I.getUrlForPartial(o.Ny.getLocation(),{inspect:a,inspectTab:m})}function h(p){const m=p.getPlugin(),a=(0,c.un)(p);if(!g.TP.hasAccessToExplore()||m?.meta.skipDataQuery||!a)return Promise.resolve(void 0);const v=r.jh.getTimeRange(p);return(0,u.Xe)({queries:a.state.queries,dsRef:a.state.datasource,timeRange:v.state.value,scopedVars:{__sceneObject:{value:p}},adhocFilters:a.state.data?.request?.filters})}},74730:(Q,A,e)=>{"use strict";e.d(A,{Cs:()=>i,OK:()=>C,SN:()=>b,Sm:()=>p,X0:()=>d,XA:()=>c,YQ:()=>E,a7:()=>h,bx:()=>m,pk:()=>a,un:()=>v,vL:()=>l,xz:()=>D});var t=e(22391),n=e(19347),o=e(79065),s=e(81515),r=e(36043),g=e(42397),u=e(98184);function c(y){return`panel-${y}`}function i(y){return parseInt(y.state.key.replace("panel-",""),10)}function l(y,M){if(!M)return null;const T=f(y,M);if(T)return T;const I=parseInt(M,10);return isNaN(I)?null:f(y,c(I))}function f(y,M){if(!M)return null;const T=o.jh.findObject(y,I=>I.state.key===M);if(T){if(T instanceof o.Eb)return T;throw new Error(`Found panel with key ${M} but it was not a VizPanel`)}return null}function d(y,M){y.forEachChild(T=>{T.isActive&&(T.forceRender(),d(T,M))})}function h(y){const{value:M,text:T,options:I}=y.state;return y.hasAllValue()?{values:I.map(x=>x.value),texts:I.map(x=>x.label)}:{values:Array.isArray(M)?M:[M],texts:Array.isArray(T)?T:[T]}}function p(y){const M=y.match(/(["'])(.*?)\1|\w+/g);if(!M)return s.Ez.query?.split(",")??[];const T=new Set,I=M.reduce((x,S)=>{const O=S.replace(/["']+/g,"");return O.startsWith("$__auto_interval_")||x.add(O),x},T);return Array.from(I)}function m(y){return Array.isArray(y)?y.join(","):""}function a(y,M){const T=Array.isArray(y.current.value)?y.current.value[0]:y.current.value;return T.startsWith("$__auto_interval_")?"$__auto":M.includes(T)?T:M[0]}function v(y){if(y){if(y.state.$data instanceof o.dt)return y.state.$data;if(y.state.$data instanceof o.Es)return v(y.state.$data)}}function E(y){const M=y.getRoot();if(M instanceof r.H$)return M;throw new Error("SceneObject root is not a DashboardScene")}function D(y){return y instanceof o.Eb?y:y.parent?D(y.parent):null}function b(y){return y.includes("clone")}function C(y){const M=new o.Eb({title:"Panel Title",key:"panel-1",pluginId:"timeseries",titleItems:[new g.$({menu:new g.m({})})],menu:new o.Lw({$behaviors:[u._i]}),$data:new o.Es({$data:new o.dt({queries:[{refId:"A"}],datasource:(0,t.p$)((0,n.l)().getInstanceSettings(null))}),transformations:[]})});return y.addPanel(M),i(M)}},72686:(Q,A,e)=>{"use strict";e.d(A,{$L:()=>v,AK:()=>D,Bs:()=>f,NA:()=>E,NY:()=>a,Sm:()=>l,T2:()=>h,U9:()=>d,_e:()=>m,bN:()=>p,g9:()=>C,kd:()=>b});var t=e(93020),n=e(75505),o=e(17172),s=e(82467),r=e(3169),g=e(36043);function u(y){return typeof y=="object"&&y!=null&&"error"in y}const c=({baseUrl:y})=>async M=>{try{const{data:T,...I}=await(0,n.s)((0,o.AI)().fetch({...M,url:y+M.url,showErrorAlert:M.showErrorAlert}));return{data:T,meta:I}}catch(T){return M.manageError?M.manageError(T):{error:T}}},i=y=>({error:(0,o.NF)(y)&&y.status!==404?y:null}),l=(0,t.xP)({reducerPath:"publicDashboardApi",baseQuery:c({baseUrl:"/api"}),tagTypes:["PublicDashboard","AuditTablePublicDashboard","UsersWithActiveSessions","ActiveUserDashboards"],refetchOnMountOrArgChange:!0,endpoints:y=>({getPublicDashboard:y.query({query:M=>({url:`/dashboards/uid/${M}/public-dashboards`,manageError:i,showErrorAlert:!1}),async onQueryStarted(M,{dispatch:T,queryFulfilled:I}){try{await I}catch(x){u(x)&&(0,o.NF)(x.error)&&T((0,s.dx)((0,r.gi)(x.error.data.message)))}},providesTags:(M,T,I)=>[{type:"PublicDashboard",id:I}]}),createPublicDashboard:y.mutation({query:M=>({url:`/dashboards/uid/${M.dashboard instanceof g.H$?M.dashboard.state.uid:M.dashboard.uid}/public-dashboards`,method:"POST",data:M.payload}),async onQueryStarted({dashboard:M,payload:T},{dispatch:I,queryFulfilled:x}){const{data:S}=await x;I((0,s.dx)((0,r.tZ)("Dashboard is public!"))),M instanceof g.H$?M.setState({meta:{...M.state.meta,publicDashboardEnabled:S.isEnabled,publicDashboardUid:S.uid}}):M.updateMeta({publicDashboardUid:S.uid,publicDashboardEnabled:S.isEnabled})},invalidatesTags:(M,T,{dashboard:I})=>[{type:"PublicDashboard",id:I instanceof g.H$?I.state.uid:I.uid}]}),updatePublicDashboard:y.mutation({query:({payload:M,dashboard:T})=>({url:`/dashboards/uid/${T instanceof g.H$?T.state.uid:T.uid}/public-dashboards/${M.uid}`,method:"PATCH",data:M}),async onQueryStarted({dashboard:M},{dispatch:T,queryFulfilled:I}){const{data:x}=await I;T((0,s.dx)((0,r.tZ)("Public dashboard updated!"))),M instanceof g.H$?M.setState({meta:{...M.state.meta,publicDashboardEnabled:x.isEnabled,publicDashboardUid:x.uid}}):M.updateMeta?.({publicDashboardUid:x.uid,publicDashboardEnabled:x.isEnabled})},invalidatesTags:(M,T,{payload:I})=>[{type:"PublicDashboard",id:I.dashboardUid},"AuditTablePublicDashboard"]}),addRecipient:y.mutation({query:()=>({url:""})}),deleteRecipient:y.mutation({query:()=>({url:""})}),reshareAccessToRecipient:y.mutation({query:()=>({url:""})}),getActiveUsers:y.query({query:()=>({url:"/"}),providesTags:["UsersWithActiveSessions"]}),getActiveUserDashboards:y.query({query:()=>({url:""}),providesTags:(M,T,I)=>[{type:"ActiveUserDashboards",id:I}]}),listPublicDashboards:y.query({query:(M=1)=>({url:`/dashboards/public-dashboards?page=${M}&perpage=8`}),transformResponse:M=>({...M,totalPages:Math.ceil(M.totalCount/M.perPage)}),providesTags:["AuditTablePublicDashboard"]}),deletePublicDashboard:y.mutation({query:M=>({url:`/dashboards/uid/${M.dashboardUid}/public-dashboards/${M.uid}`,method:"DELETE"}),async onQueryStarted({dashboard:M,uid:T},{dispatch:I,queryFulfilled:x}){await x,I((0,s.dx)((0,r.tZ)("Public dashboard deleted!"))),M instanceof g.H$?M.setState({meta:{...M.state.meta,publicDashboardUid:T,publicDashboardEnabled:!1}}):M?.updateMeta({publicDashboardUid:T,publicDashboardEnabled:!1})},invalidatesTags:(M,T,{dashboardUid:I})=>[{type:"PublicDashboard",id:I},"AuditTablePublicDashboard","UsersWithActiveSessions","ActiveUserDashboards"]}),revokeAllAccess:y.mutation({query:()=>({url:""})})})}),{useGetPublicDashboardQuery:f,useCreatePublicDashboardMutation:d,useUpdatePublicDashboardMutation:h,useDeletePublicDashboardMutation:p,useListPublicDashboardsQuery:m,useAddRecipientMutation:a,useDeleteRecipientMutation:v,useReshareAccessToRecipientMutation:E,useGetActiveUsersQuery:D,useGetActiveUserDashboardsQuery:b,useRevokeAllAccessMutation:C}=l},15858:(Q,A,e)=>{"use strict";e.d(A,{M:()=>l});var t=e(2543),n=e(19347),o=e(2913),s=e(57767),r=e(82792),g=e(98796),u=e(24240),c=e(80484);function i(f){return!!(f.libraryPanel?.name&&f.libraryPanel?.uid)}class l{async makeExportable(d){d.cleanUpRepeats();const h=d.getSaveModelCloneOld();h.id=null,d.processRepeats();const p=[],m={},a={},v={},E=new Map;for(const y of h.getVariables())v[y.name]=y;const D=(y,M)=>{if(y.datasource===void 0){y.datasource=M;return}let T=y.datasource,I=null;const x=T?.uid;return x&&x.indexOf("$")===0&&(I=v[x.substring(1)],I&&I.current&&(T=I.current.value)),(0,n.l)().get(T).then(S=>{if(S.meta?.builtIn||(m["datasource"+S.meta?.id]={type:"datasource",id:S.meta.id,name:S.meta.name,version:S.meta.info.version||"1.0.0"},I))return;const O=y.libraryPanel,P=O?"-for-library-panel":"";let L="DS_"+S.name.replace(" ","_").toUpperCase()+P.toUpperCase();if(a[L]={name:L,label:S.name,description:"",type:"datasource",pluginId:S.meta?.id,pluginName:S.meta?.name,usage:a[L]?.usage},O){const U=a[L]?.usage?.libraryPanels||[];U.push({name:O.name,uid:O.uid}),a[L].usage={libraryPanels:U}}y.datasource={type:S.meta.id,uid:"${"+L+"}"}})},b=async y=>{if(y.type!=="row"){if(await D(y),y.targets)for(const T of y.targets)await D(T,y.datasource);const M=o.Ay.panels[y.type];M&&(m["panel"+M.id]={type:"panel",id:M.id,name:M.name,version:M.info.version})}},C=async y=>{if((0,r.X)(y)){const{name:M,uid:T}=y.libraryPanel;let I=y.libraryPanel.model;I||(I=(await(0,s.Yr)(T,!0)).model),await D(I);const{gridPos:x,id:S,...O}=I;E.has(T)||E.set(T,{name:M,uid:T,kind:g.i.Panel,model:O})}};try{for(const T of h.panels)if(await b(T),T.collapsed!==void 0&&T.collapsed===!0&&T.panels)for(const I of T.panels)await b(I);for(const T of h.getVariables())(0,u.P4)(T)&&(await D(T),T.options=[],T.current={},T.refresh=T.refresh!==c.CO.never?T.refresh:c.CO.onDashboardLoad);for(const T of h.annotations.list)await D(T);m.grafana={type:"grafana",id:"grafana",name:"Grafana",version:o.Ay.buildInfo.version};for(const T of h.panels)if(await C(T),T.collapsed!==void 0&&T.collapsed===!0&&T.panels)for(const I of T.panels)await C(I);(0,t.each)(a,T=>{p.push(T)});for(const T of h.getVariables())if((0,u.VO)(T)){const I="VAR_"+T.name.replace(" ","_").toUpperCase();p.push({name:I,type:"constant",label:T.label||T.name,value:T.query,description:""}),T.query="${"+I+"}",T.current={value:T.query,text:T.query,selected:!1},T.options=[T.current]}const y=[...E.entries()].reduce((T,[I,x])=>(T[I]=x,T),{}),M=(0,t.defaults)({__inputs:p,__elements:y,__requires:(0,t.sortBy)(m,["id"])},h);for(let T=0;T<M.panels.length;T++){const I=M.panels[T];i(I)&&(M.panels[T]={gridPos:I.gridPos,id:I.id,libraryPanel:{uid:I.libraryPanel.uid,name:I.libraryPanel.name}})}return M}catch(y){return console.error("Export failed:",y),{error:y}}}}},20120:(Q,A,e)=>{"use strict";e.d(A,{fP:()=>he,Ay:()=>pe,EU:()=>te});var t=e(32196),n=e(96540),o=e(69733),s=e(24180),r=e(42303),g=e(40672),u=e(13544),c=e(12131),i=e(69731),l=e(96374),f=e(39938),d=e(19727),h=e(27746),p=e(71678),m=e(15068),a=e(75269),v=e(10804),E=e(2913),D=e(3169),b=e(10096),C=e(16021),y=e(44836),M=e(91219),T=e(83122),I=e(55852),x=e(14578),S=e(32264),O=e(38138),P=e(36974),L=e(7758),U=e(80348),R=e(28601);const H=({dashboard:Ee})=>{const Re=(0,n.useMemo)(()=>(0,P._u)(),[]),me=(0,U.useDispatch)(),Me=(0,U.useSelector)(ye=>ye.dashboard.initialDatasource);return n.createElement(O.W,null,n.createElement(O.W.Item,{key:"add-visualisation",testId:u.Tp.pages.AddDashboard.itemButton("Add new visualization menu item"),label:(0,y.t)("dashboard.add-menu.visualization","Visualization"),onClick:()=>{const ye=(0,P.OK)(Ee,Me);L.c.toolbarAddButtonClicked({item:"add_visualization"}),c.Ny.partial({editPanel:ye}),me((0,R.Ub)(void 0))}}),S.$.featureToggles.vizAndWidgetSplit&&n.createElement(O.W.Item,{key:"add-widget",testId:u.Tp.pages.AddDashboard.itemButton("Add new widget menu item"),label:(0,y.t)("dashboard.add-menu.widget","Widget"),onClick:()=>{L.c.toolbarAddButtonClicked({item:"add_widget"}),c.Ny.partial({addWidget:!0})}}),n.createElement(O.W.Item,{key:"add-row",testId:u.Tp.pages.AddDashboard.itemButton("Add new row menu item"),label:(0,y.t)("dashboard.add-menu.row","Row"),onClick:()=>{L.c.toolbarAddButtonClicked({item:"add_row"}),(0,P.SD)(Ee)}}),n.createElement(O.W.Item,{key:"add-panel-lib",testId:u.Tp.pages.AddDashboard.itemButton("Add new panel from panel library menu item"),label:(0,y.t)("dashboard.add-menu.import","Import from library"),onClick:()=>{L.c.toolbarAddButtonClicked({item:"import_from_library"}),(0,P.s3)(Ee)}}),n.createElement(O.W.Item,{key:"add-panel-clipboard",testId:u.Tp.pages.AddDashboard.itemButton("Add new panel from clipboard menu item"),label:(0,y.t)("dashboard.add-menu.paste-panel","Paste panel"),onClick:()=>{L.c.toolbarAddButtonClicked({item:"paste_panel"}),(0,P.no)(Ee,Re)},disabled:!Re}))},N=({dashboard:Ee,onToolbarAddMenuOpen:Re})=>{const[me,Me]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{me&&Re&&Re()},[me,Re]),n.createElement(T.m,{overlay:()=>n.createElement(H,{dashboard:Ee}),placement:"bottom",offset:[0,6],onVisibleChange:Me},n.createElement(I.$n,{variant:"secondary",size:"sm",fill:"outline","data-testid":u.Tp.components.PageToolbar.itemButton("Add button")},n.createElement(y.x6,{i18nKey:"dashboard.toolbar.add"},"Add"),n.createElement(x.I,{name:me?"angle-up":"angle-down",size:"lg"})))};var V=e(70497),G=e(14792),_=e(2609),K=e(81862),j=e(28444),k=e(99246),Y=e(93030),ee=e(62367);const re=({dashboard:Ee})=>n.createElement(I.$n,{"data-testid":u.Tp.pages.Dashboard.DashNav.shareButton,variant:"primary",size:"sm",onClick:()=>{L.c.toolbarShareClick(),c.Ny.partial({shareView:"link"})}},n.createElement(y.x6,{i18nKey:"dashboard.toolbar.share-button"},"Share")),J={setStarred:M.ci,updateTimeZoneForSession:K.Cj},[ne,q]=(0,r.A)({component:null});function te(){const[Ee,Re]=ne();return{showModal:me=>Re({component:me}),hideModal:()=>Re({component:null})}}function oe(){const[Ee]=ne();return n.createElement(n.Fragment,null,Ee.component)}const ue=(0,o.connect)(null,J),ie=u.Tp.pages.Dashboard.DashNav;function ge(Ee){registerDynamicDashNavAction("left",Ee)}function he(Ee){(0,k.Y)("right",Ee)}const De=n.memo(Ee=>{(0,s.zy)();const Re=(0,i.C)();(0,C.u)(Ee.dashboard.events,j.Cf);const me=Ee.dashboard.snapshot?.originalUrl??"",Me=()=>{window.location.href=g.sQ.sanitizeUrl(Ee.dashboard.snapshot.originalUrl)},ye=(0,D._2)(),Le=()=>{try{const be=new URL(g.sQ.sanitizeUrl(me),E.Ay.appUrl),Z=new URL(E.Ay.appUrl);be.host!==Z.host?b.lE.publish(new j.S8({component:l.u,props:{title:"Proceed to external site?",modalClass:le,body:n.createElement(n.Fragment,null,n.createElement("p",null,"This link connects to an external website at"," ",n.createElement("code",null,me)),n.createElement("p",null,"Are you sure you'd like to proceed?")),confirmVariant:"primary",confirmText:"Proceed",onConfirm:Me}})):Me()}catch(be){ye.error("Invalid URL",be instanceof Error?be.message:void 0)}},We=()=>{L.c.toolbarFavoritesClick();const be=(0,G.UA)(),{dashboard:Z,setStarred:ae}=Ee;be.starDashboard(Z.uid,!!Z.meta.isStarred).then(de=>{ae({id:Z.uid,title:Z.title,url:Z.meta.url??"",isStarred:de}),Z.meta.isStarred=de,Re()})},Be=()=>{L.c.toolbarSettingsClick(),c.Ny.partial({editview:"settings"})},Ye=()=>{_._o.prev()},at=()=>{_._o.next()},st=()=>{_._o.stop(),Re()},Ke=(be,Z)=>{be.map((ae,de)=>{const ve=ae.component,Ue=n.createElement(ve,{...Ee,key:`button-custom-${de}`});typeof ae.index=="number"?Z.splice(ae.index,0,Ue):Z.push(Ue)})},Xe=()=>_._o.isPlaying,He=()=>{const{dashboard:be,kioskMode:Z}=Ee,{canStar:ae,isStarred:de}=be.meta,ve=[];if(Z||Xe())return[];if(ae){let Ue=de?(0,y.t)("dashboard.toolbar.unmark-favorite","Unmark as favorite"):(0,y.t)("dashboard.toolbar.mark-favorite","Mark as favorite");ve.push(n.createElement(Y._,{tooltip:Ue,icon:de?"favorite":"star",iconType:de?"mono":"default",iconSize:"lg",onClick:We,key:"button-star"}))}return be.meta.publicDashboardEnabled&&ve.push(n.createElement(f.E,{color:"blue",text:"Public",key:"public-dashboard-button-badge",className:Te,"data-testid":ie.publicDashboardTag})),E.Ay.featureToggles.scenes&&ve.push(n.createElement(Y._,{key:"button-scenes",tooltip:"View as Scene",icon:"apps",onClick:()=>{c.Ny.partial({scenes:!0})}})),Ke(k.C.left,ve),ve},Ge=()=>n.createElement(d.e,{key:"playlist-buttons"},n.createElement(h.I,{tooltip:(0,y.t)("dashboard.toolbar.playlist-previous","Go to previous dashboard"),icon:"backward",onClick:Ye,narrow:!0}),n.createElement(h.I,{onClick:st},n.createElement(y.x6,{i18nKey:"dashboard.toolbar.playlist-stop"},"Stop playlist")),n.createElement(h.I,{tooltip:(0,y.t)("dashboard.toolbar.playlist-next","Go to next dashboard"),icon:"forward",onClick:at,narrow:!0})),xe=()=>{const{dashboard:be,updateTimeZoneForSession:Z,hideTimePicker:ae}=Ee;return ae?null:n.createElement(ee.$,{dashboard:be,onChangeTimeZone:Z,onToolbarRefreshClick:L.c.toolbarRefreshClick,onToolbarZoomClick:L.c.toolbarZoomClick,onToolbarTimePickerClick:L.c.toolbarTimePickerClick,key:"time-controls"})},$e=()=>{const{dashboard:be,isFullscreen:Z,kioskMode:ae,hideTimePicker:de}=Ee,{canSave:ve,canEdit:Ue,showSettings:_e,canShare:ze}=be.meta,{snapshot:Ve}=be,Ne=Ve&&Ve.originalUrl,ot=[];return Xe()?[Ge(),xe()]:ae===U.KioskMode.TV?[xe()]:(Ne&&ot.push(n.createElement(h.I,{tooltip:(0,y.t)("dashboard.toolbar.open-original","Open original dashboard"),onClick:Le,icon:"link",key:"button-snapshot"})),ve&&!Z&&ot.push(n.createElement(p.$s,{key:"button-save"},({showModal:nt,hideModal:pt})=>n.createElement(h.I,{tooltip:(0,y.t)("dashboard.toolbar.save","Save dashboard"),icon:"save",onClick:()=>{L.c.toolbarSaveClick(),nt(V.$,{dashboard:be,onDismiss:pt})}}))),Ke(k.C.right,ot),_e&&ot.push(n.createElement(h.I,{tooltip:(0,y.t)("dashboard.toolbar.settings","Dashboard settings"),icon:"cog",onClick:Be,key:"button-settings"})),Ue&&!Z&&ot.push(n.createElement(N,{dashboard:be,onToolbarAddMenuOpen:L.c.toolbarAddClick,key:"panel-add-dropdown"})),ze&&ot.push(n.createElement(re,{key:"button-share",dashboard:be})),de||ot.push(n.createElement(v.K,{key:"toolbar-separator"})),ot.push(xe()),ot)};return n.createElement(a.H,{actions:n.createElement(q,null,He(),n.createElement(v.K,{leftActionsSeparator:!0}),n.createElement(m.U,{alignment:"right"},$e()),n.createElement(oe,null))})});De.displayName="DashNav";const pe=ue(De),le=(0,t.css)({width:"max-content",maxWidth:"80vw"}),Te=(0,t.css)({color:"grey",backgroundColor:"transparent",border:"1px solid"})},93030:(Q,A,e)=>{"use strict";e.d(A,{_:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(29158);const r=({icon:u,iconType:c,iconSize:i,tooltip:l,onClick:f,children:d})=>{const h=(0,o.of)(g);return n.createElement("div",{className:h.noBorderContainer},u&&n.createElement(s.K,{name:u,size:i,iconType:c,tooltip:l,tooltipPlacement:"bottom",onClick:f}),d)},g=u=>({noBorderContainer:(0,t.css)` padding: 0 ${u.spacing(.5)}; display: flex; `})},62367:(Q,A,e)=>{"use strict";e.d(A,{$:()=>f});var t=e(96540),n=e(85858),o=e(3591),s=e(11134),r=e(25573),g=e(10096),u=e(44836),c=e(16233),i=e(74856),l=e(28444);class f extends t.Component{constructor(){super(...arguments),this.onChangeRefreshInterval=h=>{(0,i.jG)().setAutoRefresh(h),this.forceUpdate()},this.onRefresh=()=>((0,i.jG)().refreshTimeModel(),Promise.resolve()),this.onMoveBack=()=>{g.lE.publish(new l.Io({direction:l.xL.Left}))},this.onMoveForward=()=>{g.lE.publish(new l.Io({direction:l.xL.Right}))},this.onChangeTimePicker=h=>{const{dashboard:p}=this.props,m=p.timepicker,a=m.nowDelay&&h.raw.to==="now",v=n.isMathString(h.raw.from)?h.raw.from:h.from,E=n.isMathString(h.raw.to)?h.raw.to:h.to,D={from:v,to:a?"now-"+m.nowDelay:E};(0,i.jG)().setTime(D)},this.onChangeTimeZone=h=>{this.props.dashboard.timezone=h,this.props.onChangeTimeZone(h),this.onRefresh()},this.onChangeFiscalYearStartMonth=h=>{this.props.dashboard.fiscalYearStartMonth=h,this.onRefresh()},this.onZoom=()=>{this.props.onToolbarZoomClick&&this.props.onToolbarZoomClick(),g.lE.publish(new l.U0({scale:2}))},this.onRefreshClick=()=>{this.props.onToolbarRefreshClick&&this.props.onToolbarRefreshClick(),this.onRefresh()}}componentDidMount(){this.sub=this.props.dashboard.events.subscribe(o.sR,()=>this.forceUpdate())}componentWillUnmount(){this.sub?.unsubscribe()}render(){const{dashboard:h,isOnCanvas:p}=this.props,{refresh_intervals:m}=h.timepicker,a=(0,i.jG)().getValidIntervals(m||s.cb),v=(0,i.jG)().timeRange(),E=h.getTimezone(),D=h.fiscalYearStartMonth,b=h.panelInEdit?.isEditing;let C;return h.refresh===c.SM&&(C=(0,i.jG)().getAutoRefreshInteval().interval),t.createElement(t.Fragment,null,t.createElement(r.m,{value:v,onChange:this.onChangeTimePicker,timeZone:E,fiscalYearStartMonth:D,onMoveBackward:this.onMoveBack,onMoveForward:this.onMoveForward,onZoom:this.onZoom,onChangeTimeZone:this.onChangeTimeZone,onChangeFiscalYearStartMonth:this.onChangeFiscalYearStartMonth,isOnCanvas:p,onToolbarTimePickerClick:this.props.onToolbarTimePickerClick}),t.createElement(s.cC,{onIntervalChanged:this.onChangeRefreshInterval,onRefresh:this.onRefreshClick,value:h.refresh,intervals:a,isOnCanvas:p,tooltip:(0,u.t)("dashboard.toolbar.refresh","Refresh dashboard"),noIntervalPicker:b,showAutoInterval:!0,text:C}))}}},16495:(Q,A,e)=>{"use strict";e.d(A,{U:()=>t.Ay});var t=e(20120)},46991:(Q,A,e)=>{"use strict";e.d(A,{d:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(55852);const r=({children:u,...c})=>{const i=(0,o.of)(g);return n.createElement("div",{className:i.buttonWrapper},n.createElement(s.$n,{icon:"plus",...c},u))},g=u=>({buttonWrapper:(0,t.css)` padding: ${u.spacing(3)} 0; `})},75590:(Q,A,e)=>{"use strict";e.d(A,{p:()=>v});var t=e(2543),n=e(96540),o=e(65879),s=e(13544),r=e(57418),g=e(88575),u=e(20333),c=e(15648),i=e(10354),l=e(15292),f=e(44836),d=e(11134),h=e(74856);const p=({refreshIntervals:E,onRefreshIntervalChange:D,getIntervalsFunc:b=a,validateIntervalsFunc:C=m})=>{const[y,M]=(0,n.useState)(b(E??d.cb)),[T,I]=(0,n.useState)(null);(0,n.useEffect)(()=>{const P=b(E??d.cb);M(P)},[b,E]);const x=(0,n.useMemo)(()=>Array.isArray(y)?y.join(","):"",[y]),S=(0,n.useCallback)(P=>{const L=P.currentTarget.value?P.currentTarget.value.split(","):[];M(L)},[M]),O=(0,n.useCallback)(P=>{const L=C(y);L===null&&D(b(y)),I(L)},[b,y,D,C]);return n.createElement(g.D,{label:(0,f.t)("dashboard-settings.general.auto-refresh-label","Auto refresh"),description:(0,f.t)("dashboard-settings.general.auto-refresh-description","Define the auto refresh intervals that should be available in the auto refresh list."),error:T,invalid:!!T},n.createElement(i.p,{id:"auto-refresh-input",invalid:!!T,value:x,onChange:S,onBlur:O}))},m=(E,D={getTimeSrv:h.jG})=>{try{return a(E,D),null}catch(b){return b instanceof Error?b.message:"Invalid intervals"}},a=(E,D={getTimeSrv:h.jG})=>{const b=E.filter(C=>C.trim()!=="").map(C=>C.replace(/\s+/g,""));return[...new Set(D.getTimeSrv().getValidIntervals(b))]};class v extends n.PureComponent{constructor(){super(...arguments),this.state={isNowDelayValid:!0},this.onNowDelayChange=D=>{const b=D.currentTarget.value;if((0,t.isEmpty)(b))return this.setState({isNowDelayValid:!0}),this.props.onNowDelayChange(b);if(o.isValidTimeSpan(b))return this.setState({isNowDelayValid:!0}),this.props.onNowDelayChange(b);this.setState({isNowDelayValid:!1})},this.onHideTimePickerChange=()=>{this.props.onHideTimePickerChange(!this.props.timePickerHidden)},this.onLiveNowChange=()=>{this.props.onLiveNowChange(!this.props.liveNow)},this.onTimeZoneChange=D=>{typeof D=="string"&&this.props.onTimeZoneChange(D)},this.onWeekStartChange=D=>{this.props.onWeekStartChange(D)}}render(){return n.createElement(r.M,{label:(0,f.t)("dashboard-settings.time-picker.time-options-label","Time options"),isOpen:!0},n.createElement(g.D,{label:(0,f.t)("dashboard-settings.time-picker.time-zone-label","Time zone"),"data-testid":s.Tp.components.TimeZonePicker.containerV2},n.createElement(u.U,{inputId:"time-options-input",includeInternal:!0,value:this.props.timezone,onChange:this.onTimeZoneChange,width:40})),n.createElement(g.D,{label:(0,f.t)("dashboard-settings.time-picker.week-start-label","Week start"),"data-testid":s.Tp.components.WeekStartPicker.containerV2},n.createElement(c.l,{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.D,{label:(0,f.t)("dashboard-settings.time-picker.now-delay-label","Now delay"),description:(0,f.t)("dashboard-settings.time-picker.now-delay-description","Exclude recent data that may be incomplete.")},n.createElement(i.p,{id:"now-delay-input",invalid:!this.state.isNowDelayValid,placeholder:"0m",onChange:this.onNowDelayChange,defaultValue:this.props.nowDelay})),n.createElement(g.D,{label:(0,f.t)("dashboard-settings.time-picker.hide-time-picker","Hide time picker")},n.createElement(l.d,{id:"hide-time-picker-toggle",value:!!this.props.timePickerHidden,onChange:this.onHideTimePickerChange})),n.createElement(g.D,{label:(0,f.t)("dashboard-settings.time-picker.refresh-live-dashboards-label","Refresh live dashboards"),description:(0,f.t)("dashboard-settings.time-picker.refresh-live-dashboards-description","Continuously re-draw panels where the time range references 'now'")},n.createElement(l.d,{id:"refresh-live-dashboards-toggle",value:!!this.props.liveNow,onChange:this.onLiveNowChange})))}}},92107:(Q,A,e)=>{"use strict";e.d(A,{s:()=>vo});var t=e(96540),n=e(24180),o=e(71733),s=e(13544),r=e(12131),g=e(55852),u=e(15068),c=e(75269),i=e(36830),l=e(44836),f=e(16233),d=e(80348),h=e(28444),p=e(69733),m=e(82960),a=e(32196),v=e(16817),E=e(14110),D=e(40845),b=e(57418),C=e(66864),y=e(62930),M=e(56034),T=e(14578),I=e(29158),x=e(37390);const S=({nodes:Ot,edges:$t,direction:sn,width:Zt,height:vn,onDoubleClick:wn})=>{const kn=(0,t.useRef)(null),ua=(0,t.useRef)(null),ma=(0,t.useCallback)(Qa=>{wn&&wn(Qa.nodes[0])},[wn]);return(0,t.useEffect)(()=>((async()=>{const za=await e.e(5083).then(e.t.bind(e,83416,23)),Ia={nodes:O(za,Ot),edges:P(za,$t)},Ha={width:"100%",height:"100%",autoResize:!0,layout:{improvedLayout:!0,hierarchical:{enabled:!0,direction:sn??"DU",sortMethod:"directed"}},interaction:{navigationButtons:!0,dragNodes:!1}};kn.current=new za.Network(ua.current,Ia,Ha),kn.current?.on("doubleClick",ma)})(),()=>{kn.current&&kn.current.off("doubleClick")}),[sn,$t,Ot,ma]),t.createElement("div",null,t.createElement("div",{ref:ua,style:{width:Zt??"100%",height:vn??"60vh"}}))};function O(Ot,$t){const sn=$t.map(Zt=>({...Zt,shape:"box"}));return new Ot.DataSet(sn)}function P(Ot,$t){const sn=$t.map(Zt=>({...Zt,arrows:"to",dashes:!0}));return new Ot.DataSet(sn)}function L({edges:Ot,nodes:$t,show:sn,title:Zt,children:vn}){const[wn,kn]=(0,t.useState)(sn),ua=(0,t.useCallback)(()=>kn(!0),[kn]),ma=(0,t.useCallback)(()=>kn(!1),[kn]);return t.createElement(t.Fragment,null,t.createElement(x.a,{isOpen:wn,title:Zt,icon:"info-circle",iconTooltip:"The graph can be moved, zoomed in, and zoomed out.",onClickBackdrop:ma,onDismiss:ma},t.createElement(S,{nodes:$t,edges:Ot})),vn({showModal:ua}))}const U=({id:Ot,usages:$t})=>{const sn=(0,t.useMemo)(()=>$t.find(vn=>vn.variable.id===Ot),[Ot,$t]);if(!sn)return null;const Zt=sn.nodes.map(vn=>vn.label.includes(`$${Ot}`)?{...vn,color:"#FB7E81"}:vn);return t.createElement(L,{show:!1,title:`Showing usages for: $${Ot}`,nodes:Zt,edges:sn.edges},({showModal:vn})=>t.createElement(I.K,{onClick:()=>vn(),name:"code-branch",tooltip:"Show usages","data-testid":"VariablesUnknownButton"}))};var R=e(12846);const B=1e3;function H({variables:Ot,dashboard:$t}){const[sn,Zt]=(0,t.useState)(!1),[vn,wn]=(0,t.useState)(0),[kn,ua]=(0,t.useState)([]),ma=(0,D.of)(G);(0,t.useEffect)(()=>wn(Ia=>Ia+1),[Ot,$t]);const{loading:Qa}=(0,v.A)(async()=>{if(sn&&vn>0){const Ia=Date.now(),Ha=await(0,R.g0)(Ot,$t),sr=Date.now()-Ia;return sr>=B&&(0,E.rR)("Slow unknown variables expansion",{elapsed:sr}),wn(0),ua(Ha),Ha}return[]},[Ot,$t,sn,vn]),za=Ia=>{Ia&&(0,E.rR)("Unknown variables section expanded"),Zt(Ia)};return t.createElement("div",{className:ma.container},t.createElement(b.M,{label:t.createElement(w,null),isOpen:sn,onToggle:za},Qa&&t.createElement(C.gW,{justify:"center"},t.createElement(C.Gy,{justify:"center"},t.createElement("span",null,"Loading..."),t.createElement(y.y,null))),!Qa&&kn&&t.createElement(t.Fragment,null,kn.length===0&&t.createElement(N,null),kn.length>0&&t.createElement(V,{usages:kn}))))}function w(){const Ot=(0,D.of)(G);return t.createElement("h5",null,"Renamed or missing variables",t.createElement(M.m,{content:"Click to expand a list with all variable references that have been renamed or are missing from the dashboard."},t.createElement(T.I,{name:"info-circle",className:Ot.infoIcon})))}function N(){return t.createElement("span",null,"No renamed or missing variables found.")}function V({usages:Ot}){const $t=(0,D.of)(G);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,Ot.map(sn=>{const{variable:Zt}=sn,{id:vn,name:wn}=Zt;return t.createElement("tr",{key:vn},t.createElement("td",{className:$t.firstColumn},t.createElement("span",null,wn)),t.createElement("td",{className:$t.defaultColumn}),t.createElement("td",{className:$t.defaultColumn}),t.createElement("td",{className:$t.defaultColumn}),t.createElement("td",{className:$t.lastColumn},t.createElement(U,{id:Zt.id,usages:Ot})))})))}const G=Ot=>({container:(0,a.css)` margin-top: ${Ot.spacing(4)}; padding-top: ${Ot.spacing(4)}; `,infoIcon:(0,a.css)` margin-left: ${Ot.spacing(1)}; `,defaultColumn:(0,a.css)` width: 1%; `,firstColumn:(0,a.css)` width: 1%; vertical-align: top; color: ${Ot.colors.text.maxContrast}; `,lastColumn:(0,a.css)` overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; text-align: right; `});var _=e(48594),K=e(87421),j=e(56968),k=e(75096),Y=e(96374);function ee({varName:Ot,isOpen:$t=!1,onConfirm:sn,onDismiss:Zt}){return t.createElement(Y.u,{title:"Delete variable",isOpen:$t,onConfirm:sn,onDismiss:Zt,body:` Are you sure you want to delete variable "${Ot}"? `,modalClass:re.modal,confirmText:"Delete"})}const re={modal:(0,a.css)({width:"max-content",maxWidth:"80vw"})};var J=e(39070),ne=e(8964),q=e(58975),te=e(85140),oe=e(14329),ue=e(41820),ie=e(20601),ge=e(24240),he=e(72401),De=e(89458);function pe({onChange:Ot,type:$t}){const sn=(0,t.useMemo)(()=>(0,k.AX)(),[]),Zt=(0,t.useMemo)(()=>sn.find(vn=>vn.value===$t)??sn[0],[sn,$t]);return t.createElement(De.v,{name:"Select variable type",value:Zt,options:sn,onChange:Ot,testId:s.Tp.pages.Dashboard.Settings.Variables.Edit.General.generalTypeSelectV2})}var le=e(2543),Te=e(27238),Ee=e(3843);const Re=Ot=>async $t=>{const{rootStateKey:sn}=Ot;$t((0,_.kb)(sn,(0,Ee.sJ)({name:(0,K.dn)(Ot).name,id:Ot.id})))},me=Ot=>async($t,sn)=>{const{rootStateKey:Zt}=Ot;$t((0,_.kb)(Zt,(0,Ee.T7)((0,k.qD)(Ot))))},Me=(Ot,$t)=>(sn,Zt)=>{const{id:vn,rootStateKey:wn}=Ot;let kn=null;if($t.match(/^(?!__).*$/)||(kn="Template names cannot begin with '__', that's reserved for Grafana's global variables"),$t.match(/^\w+$/)||(kn="Only word characters are allowed in variable names"),(0,K.SS)(wn,Zt()).filter(Qa=>Qa.name===$t&&Qa.id!==vn).length&&(kn="Variable with the same name already exists"),kn){sn((0,_.kb)(wn,(0,Ee.DW)({newName:$t,errorText:kn})));return}sn(ye(Ot,$t))},ye=(Ot,$t)=>(sn,Zt)=>{const{rootStateKey:vn}=Ot,wn=(0,K.dn)(Ot,Zt());if(wn.name===$t){sn((0,_.kb)(vn,(0,Ee.FN)((0,k.qD)(Ot,{newName:$t}))));return}const kn={...(0,le.cloneDeep)(wn),name:$t,id:$t},ua=wn.global,ma=wn.index,Qa=(0,k.jX)(kn);sn((0,_.kb)(vn,(0,j.QV)((0,k.qD)(Qa,{global:ua,index:ma,model:kn})))),sn((0,_.kb)(vn,(0,Ee.FN)((0,k.qD)(Qa,{newName:$t})))),sn((0,_.kb)(vn,(0,j.Hr)((0,k.qD)(Ot,{reIndex:!1}))))},Le=(Ot,$t="query")=>(sn,Zt)=>{const vn=(0,k.q4)(Ot),wn=(0,K.SS)(vn,Zt()),kn=Be($t,wn),ua={type:$t,id:kn},ma=!1,Qa=(0,K.hk)(vn,Zt()),za=(0,le.cloneDeep)(ie.B.get($t).initialState);za.id=kn,za.name=kn,za.rootStateKey=vn,sn((0,_.kb)(vn,(0,j.QV)((0,k.qD)(ua,{global:ma,model:za,index:Qa})))),r.Ny.partial({editIndex:wn.length})},We=Ot=>($t,sn)=>{const Zt=(0,k.q4)(Ot),vn=sn(),wn=(0,K.nS)(Zt,vn),kn=vn.dashboard.getModel(),{usages:ua}=(0,R.hM)(wn,kn),ma=(0,R.Ow)(ua);$t((0,_.kb)(Zt,(0,Te.bX)({usages:ua,usagesNetwork:ma})))};function Be(Ot,$t){let sn=0,Zt=`${Ot}${sn}`;for(;$t.find(vn=>vn.id===Zt);)Zt=`${Ot}${++sn}`;return Zt}var Ye=e(85830);const at=(Ot,$t)=>({editor:(0,K.nx)($t.identifier.rootStateKey,Ot).editor,variable:(0,K.dn)($t.identifier,Ot)}),st=Ot=>({...(0,m.bindActionCreators)({variableEditorMount:Re,variableEditorUnMount:me,changeVariableName:Me,updateOptions:he.mZ},Ot),changeVariableProp:($t,sn,Zt)=>Ot((0,_.kb)($t.rootStateKey,(0,j.QP)((0,k.qD)($t,{propName:sn,propValue:Zt})))),changeVariableType:($t,sn)=>Ot((0,_.kb)($t.rootStateKey,(0,j.l_)((0,k.qD)($t,{newType:sn})))),removeVariable:$t=>{Ot((0,_.kb)($t.rootStateKey,(0,j.Hr)((0,k.qD)($t,{reIndex:!0}))))}}),Ke=(0,p.connect)(at,st);class Xe extends t.PureComponent{constructor(){super(...arguments),this.state={showDeleteModal:!1},this.onNameChange=$t=>{$t.preventDefault(),this.props.changeVariableName(this.props.identifier,$t.currentTarget.value)},this.onTypeChange=$t=>{$t.value&&this.props.changeVariableType(this.props.identifier,$t.value)},this.onLabelChange=$t=>{$t.preventDefault(),this.props.changeVariableProp(this.props.identifier,"label",$t.currentTarget.value)},this.onDescriptionChange=$t=>{this.props.changeVariableProp(this.props.identifier,"description",$t.currentTarget.value)},this.onHideChange=$t=>{this.props.changeVariableProp(this.props.identifier,"hide",$t)},this.onPropChanged=({propName:$t,propValue:sn,updateOptions:Zt=!1})=>{this.props.changeVariableProp(this.props.identifier,$t,sn),Zt&&this.props.updateOptions((0,k.jX)(this.props.variable))},this.onHandleSubmit=async $t=>{$t.preventDefault(),this.props.editor.isValid&&this.props.updateOptions((0,k.jX)(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.Ny.partial({editIndex:null})},this.onApply=()=>{r.Ny.partial({editIndex:null})},this.getVariableOptions=()=>{const{variable:$t}=this.props;return(0,ge.SP)($t)?$t.options.map(sn=>({label:String(sn.text),value:String(sn.value)})):[]}}componentDidMount(){this.props.variableEditorMount(this.props.identifier)}componentWillUnmount(){this.props.variableEditorUnMount(this.props.identifier)}render(){const{variable:$t}=this.props,sn=ie.B.get(this.props.variable.type).editor;if(!sn)return null;const Zt=$t.state===J.Gu.Loading;return t.createElement(t.Fragment,null,t.createElement("form",{"aria-label":"Variable editor Form",onSubmit:this.onHandleSubmit},t.createElement(pe,{onChange:this.onTypeChange,type:this.props.variable.type}),t.createElement(q.Y,null,"General"),t.createElement(oe._,{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.Tp.pages.Dashboard.Settings.Variables.Edit.General.generalNameInputV2,maxLength:Ye.M.MaxSize,required:!0}),t.createElement(oe._,{name:"Label",description:"Optional display name",value:this.props.variable.label??"",placeholder:"Label name",onChange:this.onLabelChange,testId:s.Tp.pages.Dashboard.Settings.Variables.Edit.General.generalLabelInputV2}),t.createElement(te.Z,{name:"Description",value:$t.description??"",placeholder:"Descriptive text",onChange:this.onDescriptionChange,width:52}),t.createElement(ne.D,{onChange:this.onHideChange,hide:this.props.variable.hide,type:this.props.variable.type}),sn&&t.createElement(sn,{variable:this.props.variable,onPropChange:this.onPropChanged}),(0,ge.SP)(this.props.variable)?t.createElement(ue.j,{options:this.getVariableOptions()}):null,t.createElement("div",{style:{marginTop:"16px"}},t.createElement(C.Gy,{spacing:"md",height:"inherit"},t.createElement(g.$n,{variant:"destructive",fill:"outline",onClick:this.onModalOpen},"Delete"),t.createElement(g.$n,{type:"submit","data-testid":s.Tp.pages.Dashboard.Settings.Variables.Edit.General.submitButton,disabled:Zt,variant:"secondary"},"Run query",Zt&&t.createElement(T.I,{className:"spin-clockwise",name:"sync",size:"sm",style:{marginLeft:"2px"}})),t.createElement(g.$n,{variant:"primary",onClick:this.onApply,"data-testid":s.Tp.pages.Dashboard.Settings.Variables.Edit.General.applyButton},"Apply")))),t.createElement(ee,{isOpen:this.state.showDeleteModal,varName:this.props.editor.name,onConfirm:this.onDelete,onDismiss:this.onModalClose}))}}const He=Ke(Xe);var Ge=e(75494),xe=e(67061),$e=e(7521),be=e(99140);const Z=({variables:Ot})=>{const $t=(0,t.useMemo)(()=>(0,R.hI)(Ot),[Ot]),sn=(0,t.useMemo)(()=>(0,R.qJ)(Ot),[Ot]);return sn.length?t.createElement(L,{show:!1,title:"Dependencies",nodes:(0,R.H7)($t,sn),edges:sn},({showModal:Zt})=>t.createElement(g.$n,{onClick:()=>{(0,E.rR)("Show variable dependencies"),Zt()},icon:"channel-add",variant:"secondary"},"Show dependencies")):null},ae=Ot=>t.createElement(p.Provider,{store:be.M_},t.createElement(Z,{...Ot})),de=({id:Ot,usages:$t,isAdhoc:sn})=>{const Zt=(0,t.useMemo)(()=>$t.find(wn=>wn.variable.id===Ot),[$t,Ot]);if($t.length===0||sn||!Zt)return null;const vn=Zt.nodes.map(wn=>wn.label.includes(`$${Ot}`)?{...wn,color:"#FB7E81"}:wn);return t.createElement(L,{show:!1,title:`Showing usages for: $${Ot}`,nodes:vn,edges:Zt.edges},({showModal:wn})=>t.createElement(I.K,{onClick:()=>{(0,E.rR)("Show variable usages"),wn()},name:"code-branch",tooltip:"Show usages"}))};function ve({index:Ot,variable:$t,usageTree:sn,usagesNetwork:Zt,onEdit:vn,onDuplicate:wn,onDelete:kn}){const ua=(0,D.$j)(),ma=(0,D.of)(ze),Qa=Ue($t),Ia=(0,R.PK)($t.id,sn)>0||$t.type==="adhoc",Ha=(0,k.jX)($t);return t.createElement(Ge.sx,{draggableId:JSON.stringify(Ha),index:Ot},(Ys,sr)=>t.createElement("tr",{ref:Ys.innerRef,...Ys.draggableProps,style:{userSelect:sr.isDragging?"none":"auto",background:sr.isDragging?ua.colors.background.secondary:void 0,...Ys.draggableProps.style}},t.createElement("td",{role:"gridcell",className:ma.column},t.createElement(g.$n,{size:"xs",fill:"text",onClick:vs=>{vs.preventDefault(),vn(Ha)},className:ma.nameLink,"aria-label":s.Tp.pages.Dashboard.Settings.Variables.List.tableRowNameFields($t.name)},$t.name)),t.createElement("td",{role:"gridcell",className:ma.definitionColumn,onClick:vs=>{vs.preventDefault(),vn(Ha)},"aria-label":s.Tp.pages.Dashboard.Settings.Variables.List.tableRowDefinitionFields($t.name)},Qa),t.createElement("td",{role:"gridcell",className:ma.column},t.createElement("div",{className:ma.icons},t.createElement(_e,{passed:Ia}),t.createElement(de,{id:$t.id,isAdhoc:$t.type==="adhoc",usages:Zt}),t.createElement(I.K,{onClick:vs=>{vs.preventDefault(),(0,E.rR)("Duplicate variable"),wn(Ha)},name:"copy",tooltip:"Duplicate variable","aria-label":s.Tp.pages.Dashboard.Settings.Variables.List.tableRowDuplicateButtons($t.name)}),t.createElement(I.K,{onClick:vs=>{vs.preventDefault(),(0,E.rR)("Delete variable"),kn(Ha)},name:"trash-alt",tooltip:"Remove variable","aria-label":s.Tp.pages.Dashboard.Settings.Variables.List.tableRowRemoveButtons($t.name)}),t.createElement("div",{...Ys.dragHandleProps,className:ma.dragHandle},t.createElement(T.I,{name:"draggabledots",size:"lg"}))))))}function Ue(Ot){let $t="";return Ot.type==="query"?Ot.definition?$t=Ot.definition:typeof Ot.query=="string"&&($t=Ot.query):(0,ge.SP)(Ot)&&($t=Ot.query),$t}function _e({passed:Ot}){const $t=(0,D.of)(ze);return Ot?t.createElement(T.I,{name:"check",className:$t.iconPassed,title:"This variable is referenced by other variables or dashboard."}):t.createElement(T.I,{name:"exclamation-triangle",className:$t.iconFailed,title:"This variable is not referenced by any variable or dashboard."})}function ze(Ot){return{dragHandle:(0,a.css)` cursor: grab; margin-left: ${Ot.spacing(1)}; `,column:(0,a.css)` width: 1%; `,nameLink:(0,a.css)` cursor: pointer; color: ${Ot.colors.primary.text}; `,definitionColumn:(0,a.css)` width: 100%; max-width: 200px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; -o-text-overflow: ellipsis; white-space: nowrap; `,iconPassed:(0,a.css)` color: ${Ot.v1.palette.greenBase}; margin-right: ${Ot.spacing(2)}; `,iconFailed:(0,a.css)` color: ${Ot.v1.palette.orange}; margin-right: ${Ot.spacing(2)}; `,icons:(0,a.css)` display: flex; gap: ${Ot.spacing(2)}; align-items: center; `}}function Ve({variables:Ot,usages:$t,usagesNetwork:sn,onChangeOrder:Zt,onAdd:vn,onEdit:wn,onDelete:kn,onDuplicate:ua}){const ma=(0,D.of)(ot),Qa=za=>{if(!za.destination||!za.source)return;(0,E.rR)("Variable drag and drop");const Ia=JSON.parse(za.draggableId);Zt(Ia,Ot[za.source.index].index,Ot[za.destination.index].index)};return t.createElement("div",null,t.createElement("div",null,Ot.length===0&&t.createElement(Ne,{onAdd:vn}),Ot.length>0&&t.createElement(xe.B,{direction:"column",gap:4},t.createElement("div",{className:ma.tableContainer},t.createElement("table",{className:"filter-table filter-table--hover","aria-label":s.Tp.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(Ge.JY,{onDragEnd:Qa},t.createElement(Ge.gL,{droppableId:"variables-list",direction:"vertical"},za=>t.createElement("tbody",{ref:za.innerRef,...za.droppableProps},Ot.map((Ia,Ha)=>t.createElement(ve,{index:Ha,key:`${Ia.name}-${Ha}`,variable:Ia,usageTree:$t,usagesNetwork:sn,onDelete:kn,onDuplicate:ua,onEdit:wn})),za.placeholder))))),t.createElement(xe.B,null,t.createElement(ae,{variables:Ot}),t.createElement(g.$n,{"aria-label":s.Tp.pages.Dashboard.Settings.Variables.List.newButton,onClick:vn,icon:"plus"},"New variable")))))}function Ne({onAdd:Ot}){return t.createElement("div",null,t.createElement($e.A,{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:$t=>{$t.preventDefault(),Ot()}}))}const ot=()=>({tableContainer:(0,a.css)` overflow: scroll; width: 100%; `}),nt=(Ot,$t)=>{const{uid:sn}=$t.dashboard,Zt=(0,K.nx)(sn,Ot);return{variables:(0,K.nS)(sn,Ot),idInEditor:Zt.editor.id,usagesNetwork:Zt.inspect.usagesNetwork,usages:Zt.inspect.usages}},pt=Ot=>({...(0,m.bindActionCreators)({createNewVariable:Le,initListMode:We},Ot),changeVariableOrder:($t,sn,Zt)=>Ot((0,_.kb)($t.rootStateKey,(0,j.hj)((0,k.qD)($t,{fromIndex:sn,toIndex:Zt})))),duplicateVariable:$t=>Ot((0,_.kb)($t.rootStateKey,(0,j.ut)((0,k.qD)($t,{newId:void 0})))),removeVariable:$t=>{Ot((0,_.kb)($t.rootStateKey,(0,j.Hr)((0,k.qD)($t,{reIndex:!0}))))}}),mt=(0,p.connect)(nt,pt);class gt extends t.PureComponent{constructor(){super(...arguments),this.state={variableId:void 0},this.onEditVariable=$t=>{const sn=this.props.variables.findIndex(Zt=>Zt.id===$t.id);r.Ny.partial({editIndex:sn})},this.onNewVariable=()=>{this.props.createNewVariable(this.props.dashboard.uid)},this.onChangeVariableOrder=($t,sn,Zt)=>{this.props.changeVariableOrder($t,sn,Zt)},this.onDuplicateVariable=$t=>{this.props.duplicateVariable($t)},this.onModalOpen=$t=>{this.setState({variableId:$t})},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:$t,variables:sn,sectionNav:Zt}=this.props,vn=$t!=null?sn[$t]:void 0,wn=Zt.node,kn=wn.parentItem?{...wn.parentItem,url:wn.url}:void 0,ua=vn?{text:vn.name,parentItem:kn}:kn;return t.createElement(i.Y,{navModel:this.props.sectionNav,pageNav:ua},!vn&&t.createElement(Ve,{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}),!vn&&this.props.variables.length>0&&t.createElement(H,{variables:this.props.variables,dashboard:this.props.dashboard}),vn&&t.createElement(He,{identifier:(0,k.jX)(vn)}),t.createElement(ee,{isOpen:this.state.variableId!==void 0,varName:this.state.variableId?.id??"",onConfirm:this.onRemoveVariable,onDismiss:this.onModalClose}))}}const Pt=mt(gt);var Mt=e(5108),Yt=e(10096);const zt=({dashboard:Ot,sectionNav:$t})=>{const sn=Yt.TP.hasPermission(d.AccessControlAction.DashboardsPermissionsWrite),Zt=$t.node.parentItem;return t.createElement(i.Y,{navModel:$t,pageNav:Zt},t.createElement(Mt.x,{resource:"dashboards",resourceId:Ot.uid,canSetPermissions:sn}))};var _t=e(78050),rt=e(22391),It=e(19347),Dn=e(84167),ft=e(88575),yt=e(10354),jt=e(10880),cn=e(88323),pn=e(77268),on=e(2913),Xt=e(82241),fn=e(46502),An=e(51612);const hn="New annotation",ca=({editIdx:Ot,dashboard:$t})=>{const sn=(0,D.of)(Rt),[Zt,vn]=(0,t.useState)($t.annotations.list[Ot]),wn=(0,t.useMemo)(()=>Zt.filter?Zt.filter.exclude?2:1:0,[Zt.filter]),{value:kn}=(0,v.A)(()=>(0,It.l)().get(Zt.datasource),[Zt.datasource]),ua=(0,It.l)().getInstanceSettings(Zt.datasource),ma=ha=>{const xs=[...$t.annotations.list];xs.splice(Ot,1,ha),vn(ha),$t.annotations.list=xs},Qa=ha=>{ma({...Zt,name:ha.currentTarget.value})},za=ha=>{const xs=(0,rt.p$)(ha);Zt.datasource?.type!==xs.type?ma({datasource:xs,builtIn:Zt.builtIn,enable:Zt.enable,iconColor:Zt.iconColor,name:Zt.name,hide:Zt.hide,filter:Zt.filter,mappings:Zt.mappings,type:Zt.type}):ma({...Zt,datasource:xs})},Ia=ha=>{const xs=ha.currentTarget;ma({...Zt,[xs.name]:xs.type==="checkbox"?xs.checked:xs.value})},Ha=ha=>{ma({...Zt,iconColor:ha})},Ys=ha=>{let xs=ha.value===0?void 0:{exclude:ha.value===2,ids:Zt.filter?.ids??[]};ma({...Zt,filter:xs})},sr=ha=>{if(!Array.isArray(ha))return;const xs={exclude:wn===2,ids:[]};ha.forEach(lo=>lo.value&&xs.ids.push(lo.value)),ma({...Zt,filter:xs})},vs=qt,zr=()=>{r.Ny.partial({editview:null,editIndex:null})},ws=()=>{const ha=$t.annotations.list;$t.annotations.list=[...ha.slice(0,Ot),...ha.slice(Ot+1)],qt()},ds=Zt.name===hn,Vs=(ha,xs)=>ha.label&&xs.label?ha.label.toLowerCase().localeCompare(xs.label.toLowerCase()):-1,kr=(0,t.useMemo)(()=>$t?.panels.filter(ha=>on.Ay.panels[ha.type]).map(ha=>({value:ha.id,label:ha.title??`Panel ${ha.id}`,description:ha.description,imgUrl:on.Ay.panels[ha.type].info.logos.small})).sort(Vs)??[],[$t]);return t.createElement("div",null,t.createElement(Dn.n,{className:sn.settingsForm},t.createElement(ft.D,{label:"Name"},t.createElement(yt.p,{"aria-label":s.Tp.pages.Dashboard.Settings.Annotations.Settings.name,name:"name",id:"name",autoFocus:ds,value:Zt.name,onChange:Qa})),t.createElement(ft.D,{label:"Data source",htmlFor:"data-source-picker"},t.createElement(An.s,{annotations:!0,variables:!0,current:Zt.datasource,onChange:za})),t.createElement(ft.D,{label:"Enabled",description:"When enabled the annotation query is issued every dashboard refresh"},t.createElement(jt.S,{name:"enable",id:"enable",value:Zt.enable,onChange:Ia})),t.createElement(ft.D,{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(jt.S,{name:"hide",id:"hide",value:Zt.hide,onChange:Ia})),t.createElement(ft.D,{label:"Color",description:"Color to use for the annotation event markers"},t.createElement(C.Gy,null,t.createElement(pn.a,{value:Zt?.iconColor,onChange:Ha}))),t.createElement(ft.D,{label:"Show in","aria-label":s.Tp.pages.Dashboard.Settings.Annotations.NewAnnotation.showInLabel},t.createElement(t.Fragment,null,t.createElement(cn.l6,{options:Cn,value:wn,onChange:Ys,"aria-label":s.Tp.components.Annotations.annotationsTypeInput}),wn!==0&&t.createElement(cn.KF,{options:kr,value:kr.filter(ha=>Zt.filter?.ids.includes(ha.value)),onChange:sr,isClearable:!0,placeholder:"Choose panels",width:100,closeMenuOnSelect:!1,className:sn.select,"aria-label":s.Tp.components.Annotations.annotationsChoosePanelInput})))),t.createElement(Dn.n,null,t.createElement("h3",{className:"page-heading"},"Query"),kn?.annotations&&ua&&t.createElement(Xt.A,{datasource:kn,datasourceInstanceSettings:ua,annotation:Zt,onChange:ma}),kn&&!kn.annotations&&t.createElement(fn.F,{datasource:kn,annotation:Zt,onChange:ma})),t.createElement(xe.B,null,!Zt.builtIn&&t.createElement(g.$n,{variant:"destructive",onClick:ws},"Delete"),t.createElement(g.$n,{variant:"secondary",onClick:zr,"data-testid":s.Tp.pages.Dashboard.Settings.Annotations.NewAnnotation.previewInDashboard},"Preview in dashboard"),t.createElement(g.$n,{variant:"primary",onClick:vs},"Apply")))},Rt=Ot=>({settingsForm:(0,a.css)({maxWidth:Ot.spacing(60),marginBottom:Ot.spacing(2)}),select:(0,a.css)` margin-top: 8px; `});function qt(){r.Ny.partial({editIndex:null})}var gn=(Ot=>(Ot[Ot.AllPanels=0]="AllPanels",Ot[Ot.IncludePanels=1]="IncludePanels",Ot[Ot.ExcludePanels=2]="ExcludePanels",Ot))(gn||{});const Cn=[{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 mn=e(14588),Sn=e(91605),Tn=e(46991);const $n=({dashboard:Ot,onNew:$t,onEdit:sn})=>{const Zt=(0,D.of)(Mn),[vn,wn]=(0,t.useState)(Ot.annotations.list),kn=(Ia,Ha)=>{Ot.annotations.list=mn.moveItemImmutably(vn,Ia,Ia+Ha),wn(Ot.annotations.list)},ua=Ia=>{Ot.annotations.list=[...vn.slice(0,Ia),...vn.slice(Ia+1)],wn(Ot.annotations.list)},ma=vn.length===0||vn.length===1&&vn[0].builtIn,Qa=Ia=>Ia.enable===!1?t.createElement(t.Fragment,null,t.createElement("em",{className:"muted"},"(Disabled) \xA0 ",Ia.name)):Ia.builtIn?t.createElement(t.Fragment,null,t.createElement("em",{className:"muted"},Ia.name," \xA0 (Built-in)")):t.createElement(t.Fragment,null,Ia.name),za=(0,It.l)();return t.createElement(C.gW,null,vn.length>0&&t.createElement("div",{className:Zt.table},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,Ot.annotations.list.map((Ia,Ha)=>t.createElement("tr",{key:`${Ia.name}-${Ha}`},Ia.builtIn?t.createElement("td",{role:"gridcell",style:{width:"90%"},className:"pointer",onClick:()=>sn(Ha)},t.createElement(g.$n,{size:"sm",fill:"text",variant:"secondary"},Qa(Ia))):t.createElement("td",{role:"gridcell",className:"pointer",onClick:()=>sn(Ha)},t.createElement(g.$n,{size:"sm",fill:"text",variant:"secondary"},Qa(Ia))),t.createElement("td",{role:"gridcell",className:"pointer",onClick:()=>sn(Ha)},za.getInstanceSettings(Ia.datasource)?.name||Ia.datasource?.uid),t.createElement("td",{role:"gridcell",style:{width:"1%"}},Ha!==0&&t.createElement(I.K,{name:"arrow-up",onClick:()=>kn(Ha,-1),tooltip:"Move up"})),t.createElement("td",{role:"gridcell",style:{width:"1%"}},Ot.annotations.list.length>1&&Ha!==Ot.annotations.list.length-1?t.createElement(I.K,{name:"arrow-down",onClick:()=>kn(Ha,1),tooltip:"Move down"}):null),t.createElement("td",{role:"gridcell",style:{width:"1%"}},!Ia.builtIn&&t.createElement(Sn.e,{size:"sm",onConfirm:()=>ua(Ha),"aria-label":`Delete query with title "${Ia.name}"`}))))))),ma&&t.createElement($e.A,{onClick:$t,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.`}}),!ma&&t.createElement(Tn.d,{onClick:$t},"New query"))},Mn=()=>({table:(0,a.css)` width: 100%; overflow-x: scroll; `});function Ln({dashboard:Ot,editIndex:$t,sectionNav:sn}){const Zt=()=>{const kn={name:hn,enable:!0,datasource:(0,rt.p$)((0,It.l)().getInstanceSettings(null)),iconColor:"red"};Ot.annotations.list=[...Ot.annotations.list,{...kn}],r.Ny.partial({editIndex:Ot.annotations.list.length-1})},vn=kn=>{r.Ny.partial({editIndex:kn})},wn=$t!=null&&$t<Ot.annotations.list.length;return t.createElement(i.Y,{navModel:sn,pageNav:na(Ot,$t,sn.node)},!wn&&t.createElement($n,{dashboard:Ot,onNew:Zt,onEdit:vn}),wn&&t.createElement(ca,{dashboard:Ot,editIdx:$t}))}function na(Ot,$t,sn){const Zt=sn.parentItem;if($t==null)return Zt;const vn=Ot.annotations.list[$t];if(vn)return{text:vn.name,parentItem:Zt&&{...Zt,url:sn.url}}}var pa=e(32264),ia=e(90613),Xn=e(60029),Da=e(21744),ba=e(79924),Oa=e(94354),sa=e(70096),Jn=e(3673),Va=e(39712),ts=e(81394),Ds=e(27966),Ms=e(75590);const Ns=[{value:0,label:"Default"},{value:1,label:"Shared crosshair"},{value:2,label:"Shared Tooltip"}];function cs({dashboard:Ot,updateTimeZone:$t,updateWeekStart:sn,sectionNav:Zt}){const[vn,wn]=(0,t.useState)(0),[kn,ua]=(0,t.useState)(Ot.title),[ma,Qa]=(0,t.useState)(Ot.description),za=Zt.node.parentItem,Ia=(qa,Qs)=>{Ot.meta.folderUid=qa,Ot.meta.folderTitle=Qs,Ot.meta.hasUnsavedFolderChange=!0,wn(vn+1)},Ha=t.useCallback(qa=>{Ot.title=qa,ua(qa)},[ua,Ot]),Ys=t.useCallback(qa=>{Ot.description=qa,Qa(qa)},[Qa,Ot]),sr=qa=>{Ot.graphTooltip=qa,wn(vn+1)},vs=qa=>{Ot.timepicker.refresh_intervals=qa.filter(Qs=>Qs.trim()!=="")},zr=qa=>{Ot.timepicker.nowDelay=qa},ws=qa=>{Ot.timepicker.hidden=qa,wn(vn+1)},ds=qa=>{Ot.liveNow=qa,wn(vn+1)},Vs=qa=>{Ot.timezone=qa,wn(vn+1),$t(qa)},kr=qa=>{Ot.weekStart=qa,wn(vn+1),sn(qa)},ha=qa=>{Ot.tags=qa,wn(vn+1)},xs=qa=>{Ot.editable=qa,wn(vn+1)},lo=[{label:"Editable",value:!0},{label:"Read-only",value:!1}];return t.createElement(i.Y,{navModel:Zt,pageNav:za},t.createElement("div",{style:{maxWidth:"600px"}},t.createElement(ia.a,{marginBottom:5},t.createElement(ft.D,{label:t.createElement(C.Gy,{justify:"space-between"},t.createElement(Xn.J,{htmlFor:"title-input"},t.createElement(l.x6,{i18nKey:"dashboard-settings.general.title-label"},"Title")),pa.$.featureToggles.dashgpt&&t.createElement(Ds.Z,{onGenerate:Ha,dashboard:Ot}))},t.createElement(yt.p,{id:"title-input",name:"title",value:kn,onChange:qa=>Ha(qa.target.value)})),t.createElement(ft.D,{label:t.createElement(C.Gy,{justify:"space-between"},t.createElement(Xn.J,{htmlFor:"description-input"},(0,l.t)("dashboard-settings.general.description-label","Description")),pa.$.featureToggles.dashgpt&&t.createElement(ts.V,{onGenerate:Ys,dashboard:Ot}))},t.createElement(Da.f,{id:"description-input",name:"description",value:ma,onChange:qa=>Ys(qa.target.value)})),t.createElement(ft.D,{label:(0,l.t)("dashboard-settings.general.tags-label","Tags")},t.createElement(ba.u,{id:"tags-input",tags:Ot.tags,onChange:ha,width:40})),t.createElement(ft.D,{label:(0,l.t)("dashboard-settings.general.folder-label","Folder")},t.createElement(sa.d,{value:Ot.meta.folderUid,onChange:Ia,initialTitle:Ot.meta.folderTitle,inputId:"dashboard-folder-input",enableCreateNew:!0,dashboardId:Ot.id,skipInitialLoad:!0})),t.createElement(ft.D,{label:(0,l.t)("dashboard-settings.general.editable-label","Editable"),description:(0,l.t)("dashboard-settings.general.editable-description","Set to read-only to disable all editing. Reload the dashboard for changes to take effect")},t.createElement(Oa.z,{value:Ot.editable,options:lo,onChange:xs}))),t.createElement(Ms.p,{onTimeZoneChange:Vs,onWeekStartChange:kr,onRefreshIntervalChange:vs,onNowDelayChange:zr,onHideTimePickerChange:ws,onLiveNowChange:ds,refreshIntervals:Ot.timepicker.refresh_intervals,timePickerHidden:Ot.timepicker.hidden,nowDelay:Ot.timepicker.nowDelay,timezone:Ot.timezone,weekStart:Ot.weekStart,liveNow:Ot.liveNow}),t.createElement(b.M,{label:(0,l.t)("dashboard-settings.general.panel-options-label","Panel options"),isOpen:!0},t.createElement(ft.D,{label:(0,l.t)("dashboard-settings.general.panel-options-graph-tooltip-label","Graph tooltip"),description:(0,l.t)("dashboard-settings.general.panel-options-graph-tooltip-description","Controls tooltip and hover highlight behavior across different panels. Reload the dashboard for changes to take effect")},t.createElement(Oa.z,{onChange:sr,options:Ns,value:Ot.graphTooltip}))),t.createElement(ia.a,{marginTop:3},Ot.meta.canDelete&&t.createElement(Va.c,null))))}const Ps={updateTimeZone:Jn.lC,updateWeekStart:Jn.Ss},Cs=(0,p.connect)(null,Ps)(cs);var as=e(32372),ar=e(81156),lr=e(6473),Is=e(14792);function cr({dashboard:Ot,sectionNav:$t}){const sn=Ot.getSaveModelClone(),[Zt,vn]=(0,t.useState)(JSON.stringify(sn,null,2)),wn=$t.node.parentItem,kn=async()=>{await(0,Is.UA)().saveJSONDashboard(Zt),lr.t.reloadPage()},ua=(0,D.of)(Zs);return t.createElement(i.Y,{navModel:$t,pageNav:wn},t.createElement("div",{className:ua.wrapper},t.createElement(l.x6,{i18nKey:"dashboard-settings.json-editor.subtitle"},"The JSON model below is the data structure that defines the dashboard. This includes dashboard settings, panel settings, layout, queries, and so on."),t.createElement(ar.A,{dashboard:sn}),t.createElement(as.B,{value:Zt,language:"json",showMiniMap:!0,showLineNumbers:!0,onBlur:vn,containerStyles:ua.codeEditor}),Ot.meta.canSave&&t.createElement("div",null,t.createElement(g.$n,{type:"submit",onClick:kn},t.createElement(l.x6,{i18nKey:"dashboard-settings.json-editor.save-button"},"Save changes")))))}const Zs=Ot=>({wrapper:(0,a.css)({display:"flex",height:"100%",flexDirection:"column",gap:Ot.spacing(2)}),codeEditor:(0,a.css)({flexGrow:1})});var os=e(4588),is=e(65857);const Ls=({editLinkIdx:Ot,dashboard:$t,onGoBack:sn})=>{const[Zt,vn]=(0,t.useState)(Ot!==null?$t.links[Ot]:os.q),wn=kn=>{const ua=[...$t.links];ua.splice(Ot,1,kn),$t.links=ua,vn(kn)};return t.createElement(is.d,{link:Zt,onUpdate:wn,onGoBack:sn})};var ks=e(6199);const Pr=({dashboard:Ot,onNew:$t,onEdit:sn})=>{const[Zt,vn]=(0,t.useState)(Ot.links),wn=(ma,Qa)=>{Ot.links=mn.moveItemImmutably(Zt,ma,ma+Qa),vn(Ot.links)},kn=ma=>{Ot.links=[...Zt,{...ma}],vn(Ot.links)},ua=ma=>{Ot.links=[...Zt.slice(0,ma),...Zt.slice(ma+1)],vn(Ot.links)};return t.createElement(ks.X,{links:Zt,onNew:$t,onEdit:sn,onDuplicate:kn,onDelete:ua,onOrderChange:wn})};function qs({dashboard:Ot,sectionNav:$t,editIndex:sn}){const[Zt,vn]=(0,t.useState)(!1),wn=()=>{vn(!1),r.Ny.partial({editIndex:void 0})},kn=()=>{Ot.links=[...Ot.links,{...os.q}],vn(!0),r.Ny.partial({editIndex:Ot.links.length-1})},ua=za=>{vn(!1),r.Ny.partial({editIndex:za})},ma=sn!==void 0;let Qa=$t.node.parentItem;if(ma){Qa={text:Zt?"New link":"Edit link",subTitle:Zt?"Create a new link on your dashboard":"Edit a specific link of your dashboard"};const Ha=$t.node.url;Qa.parentItem=$t.node.parentItem&&{...$t.node.parentItem,url:Ha}}return t.createElement(i.Y,{navModel:$t,pageNav:Qa},!ma&&t.createElement(Pr,{dashboard:Ot,onNew:kn,onEdit:ua}),ma&&t.createElement(Ls,{dashboard:Ot,editLinkIdx:sn,onGoBack:wn}))}var Cr=e(57714),Ir=e(71678),Lo=e(19626),br=e(22764),so=e(56596),hs=e(41053),Nr=e(3169);const wr=async(Ot,$t)=>(lr.t.ignoreNextSave(),await Cr.wL.restoreDashboard($t.uid,Ot)),Zr=Ot=>{const $t=(0,d.useSelector)(wn=>wn.dashboard.getModel()),[sn,Zt]=(0,hs.A)(async()=>await wr(Ot,$t),[]),vn=(0,Nr._2)();return(0,t.useEffect)(()=>{if(sn.value){const wn=r.Ny.getLocation(),kn=o.I.stripBaseFromUrl(sn.value.url),ua=wn.state?.routeReloadCounter;r.Ny.replace({...wn,pathname:kn,state:{routeReloadCounter:ua?ua+1:1}}),vn.success("Dashboard restored",`Restored from version ${Ot}`)}},[sn,Ot,vn]),{state:sn,onRestoreDashboard:Zt}},Ar=({hideModal:Ot,version:$t})=>{const{state:sn,onRestoreDashboard:Zt}=Zr($t);return(0,t.useEffect)(()=>{!sn.loading&&sn.value&&Ot()},[sn,Ot]),t.createElement(Y.u,{isOpen:!0,title:"Restore Version",icon:"history",onDismiss:Ot,onConfirm:Zt,body:t.createElement("p",null,"Are you sure you want to restore the dashboard to version ",$t,"? All unsaved changes will be lost."),confirmText:`Yes, restore to version ${$t}`})},zo=({baseInfo:Ot,newInfo:$t,diffData:sn,isNewLatest:Zt})=>{const vn=(0,so.G4)(sn.lhs,sn.rhs),wn=(0,D.of)($s);return t.createElement(xe.B,{direction:"column",gap:1},t.createElement(xe.B,{justifyContent:"space-between",alignItems:"center"},t.createElement(xe.B,{alignItems:"center"},t.createElement("span",{className:(0,a.cx)(wn.versionInfo,wn.noMarginBottom)},t.createElement("strong",null,"Version ",Ot.version)," updated by ",Ot.createdBy," ",Ot.ageString,Ot.message),t.createElement(T.I,{name:"arrow-right",size:"sm"}),t.createElement("span",{className:wn.versionInfo},t.createElement("strong",null,"Version ",$t.version)," updated by ",$t.createdBy," ",$t.ageString,$t.message)),Zt&&t.createElement(Ir.$s,null,({showModal:kn,hideModal:ua})=>t.createElement(g.$n,{variant:"destructive",icon:"history",onClick:()=>{kn(Ar,{version:Ot.version,hideModal:ua})}},"Restore to version ",Ot.version))),Object.entries(vn).map(([kn,ua])=>t.createElement(Lo.D,{diffs:ua,key:kn,title:kn})),t.createElement(ia.a,{paddingTop:2},t.createElement(b.M,{isOpen:!1,label:"View JSON Diff"},t.createElement(br.M,{oldValue:JSON.stringify(sn.lhs,null,2),newValue:JSON.stringify(sn.rhs,null,2)}))))},$s=Ot=>({versionInfo:(0,a.css)({color:Ot.colors.text.secondary,fontSize:Ot.typography.bodySmall.fontSize}),noMarginBottom:(0,a.css)({marginBottom:0})});var Ss=e(78369);const ro=({versions:Ot,canCompare:$t,onCheck:sn})=>{const Zt=(0,D.of)(Za);return t.createElement("div",{className:Zt.margin},t.createElement("table",{className:"filter-table"},t.createElement("thead",null,t.createElement("tr",null,t.createElement("th",{className:"width-4"}),t.createElement("th",{className:"width-4"},"Version"),t.createElement("th",{className:"width-14"},"Date"),t.createElement("th",{className:"width-10"},"Updated by"),t.createElement("th",null,"Notes"),t.createElement("th",null))),t.createElement("tbody",null,Ot.map((vn,wn)=>t.createElement("tr",{key:vn.id},t.createElement("td",null,t.createElement(jt.S,{"aria-label":`Toggle selection of version ${vn.version}`,className:(0,a.css)({display:"inline"}),checked:vn.checked,onChange:kn=>sn(kn,vn.id),disabled:!vn.checked&&$t})),t.createElement("td",null,vn.version),t.createElement("td",null,vn.createdDateString),t.createElement("td",null,vn.createdBy),t.createElement("td",null,vn.message),t.createElement("td",{className:"text-right"},wn===0?t.createElement(Ss.v,{name:"Latest",colorIndex:17}):t.createElement(Ir.$s,null,({showModal:kn,hideModal:ua})=>t.createElement(g.$n,{variant:"secondary",size:"sm",icon:"history",onClick:()=>{kn(Ar,{version:vn.version,hideModal:ua})}},"Restore"))))))))};function Za(Ot){return{margin:(0,a.css)({marginBottom:Ot.spacing(4)})}}const bs=10;class Yn extends t.PureComponent{constructor($t){super($t),this.getVersions=(sn=!1)=>{this.setState({isAppending:sn}),Cr.wL.getHistoryList(this.props.dashboard.uid,{limit:this.limit,start:this.start}).then(Zt=>{this.setState({isLoading:!1,versions:[...this.state.versions,...this.decorateVersions(Zt)]}),this.start+=this.limit}).catch(Zt=>console.log(Zt)).finally(()=>this.setState({isAppending:!1}))},this.getDiff=async()=>{const sn=this.state.versions.filter(ma=>ma.checked),[Zt,vn]=sn,wn=Zt.version===this.props.dashboard.version;this.setState({isLoading:!0});const kn=await Cr.wL.getDashboardVersion(this.props.dashboard.uid,vn.version),ua=await Cr.wL.getDashboardVersion(this.props.dashboard.uid,Zt.version);this.setState({baseInfo:vn,isLoading:!1,isNewLatest:wn,newInfo:Zt,viewMode:"compare",diffData:{lhs:kn.data,rhs:ua.data}})},this.decorateVersions=sn=>sn.map(Zt=>({...Zt,createdDateString:this.props.dashboard.formatDate(Zt.created),ageString:this.props.dashboard.getRelativeTime(Zt.created),checked:!1})),this.onCheck=(sn,Zt)=>{this.setState({versions:this.state.versions.map(vn=>vn.id===Zt?{...vn,checked:sn.currentTarget.checked}:vn)})},this.reset=()=>{this.setState({baseInfo:void 0,diffData:{lhs:"",rhs:""},isNewLatest:!1,newInfo:void 0,versions:this.state.versions.map(sn=>({...sn,checked:!1})),viewMode:"list"})},this.limit=bs,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($t=>$t.version===1)}render(){const{versions:$t,viewMode:sn,baseInfo:Zt,newInfo:vn,isNewLatest:wn,isLoading:kn,diffData:ua}=this.state,ma=$t.filter(Ha=>Ha.checked).length===2,Qa=$t.length>1,za=$t.length>=this.limit,Ia=this.props.sectionNav.node.parentItem;return sn==="compare"?t.createElement(i.Y,{navModel:this.props.sectionNav,pageNav:Ia},t.createElement(Cr.me,{onClick:this.reset,baseVersion:Zt?.version,newVersion:vn?.version,isNewLatest:wn}),kn?t.createElement(St,{msg:"Fetching changes\u2026"}):t.createElement(zo,{newInfo:vn,baseInfo:Zt,isNewLatest:wn,diffData:ua})):t.createElement(i.Y,{navModel:this.props.sectionNav,pageNav:Ia},kn?t.createElement(St,{msg:"Fetching history list\u2026"}):t.createElement(ro,{versions:$t,onCheck:this.onCheck,canCompare:ma}),this.state.isAppending&&t.createElement(St,{msg:"Fetching more entries\u2026"}),Qa&&t.createElement(Cr.rJ,{hasMore:za,canCompare:ma,getVersions:this.getVersions,getDiff:this.getDiff,isLastPage:!!this.isLastPage()}))}}const St=({msg:Ot})=>t.createElement(C.Gy,null,t.createElement(y.y,null),t.createElement("em",null,Ot)),oo=()=>r.Ny.partial({editview:null,editIndex:null});function vo({dashboard:Ot,editview:$t,pageNav:sn,sectionNav:Zt}){const[vn,wn]=(0,t.useState)(0);(0,t.useEffect)(()=>{Ot.events.subscribe(h.Cf,()=>wn(zr=>zr+1))},[Ot]);const kn=(0,t.useMemo)(()=>io(Ot),[Ot,vn]),ua=()=>{Ot.meta.hasUnsavedFolderChange=!1},ma=kn.find(zr=>zr.id===$t)??kn[0],Qa=f.TP.hasEditPermissionInFolders,za=Ot.meta.canSave,Ia=(0,n.zy)(),Ha=bo(Ia),Ys=Fr(sn,Zt,kn,ma,Ia),sr="sm",vs=[t.createElement(g.$n,{"data-testid":s.Tp.pages.Dashboard.Settings.Actions.close,variant:"secondary",key:"close",fill:"outline",size:sr,onClick:oo},"Close"),Qa&&t.createElement(_t.m,{dashboard:Ot,onSaveSuccess:ua,variant:"secondary",key:"save as",size:sr}),za&&t.createElement(_t.C,{dashboard:Ot,onSaveSuccess:ua,key:"Save",size:sr})];return t.createElement(t.Fragment,null,t.createElement(c.H,{actions:t.createElement(u.U,{alignment:"right"},vs)}),t.createElement(ma.component,{sectionNav:Ys,dashboard:Ot,editIndex:Ha}))}function io(Ot){const $t=[],sn=(0,l.t)("dashboard-settings.general.title","General");Ot.meta.canEdit&&($t.push({title:sn,id:"settings",icon:"sliders-v-alt",component:Cs}),$t.push({title:(0,l.t)("dashboard-settings.annotations.title","Annotations"),id:"annotations",icon:"comment-alt",component:Ln,subTitle:"Annotation queries return events that can be visualized as event markers in graphs across the dashboard."}),$t.push({title:(0,l.t)("dashboard-settings.variables.title","Variables"),id:"templating",icon:"calculator-alt",component:Pt,subTitle:"Variables can make your dashboard more dynamic and act as global filters."}),$t.push({title:(0,l.t)("dashboard-settings.links.title","Links"),id:"links",icon:"link",component:qs})),Ot.meta.canMakeEditable&&$t.push({title:sn,icon:"sliders-v-alt",id:"settings",component:Co}),Ot.id&&Ot.meta.canSave&&$t.push({title:(0,l.t)("dashboard-settings.versions.title","Versions"),id:"versions",icon:"history",component:Yn});const Zt=(0,l.t)("dashboard-settings.permissions.title","Permissions");return Ot.id&&Ot.meta.canAdmin&&f.TP.hasPermission(d.AccessControlAction.DashboardsPermissionsRead)&&$t.push({title:Zt,id:"permissions",icon:"lock",component:zt}),$t.push({title:(0,l.t)("dashboard-settings.json-editor.title","JSON Model"),id:"dashboard_json",icon:"arrow",component:cr}),$t}function ur(Ot,$t){return{...Ot,parentItem:Ot.parentItem?ur(Ot.parentItem,$t):$t}}function Fr(Ot,$t,sn,Zt,vn){const wn={text:(0,l.t)("dashboard-settings.settings.title","Settings"),children:[],icon:"apps",hideFromBreadcrumbs:!1,url:o.I.getUrlForPartial(vn,{editview:"settings",editIndex:null})};wn.children=sn.map(ua=>({text:ua.title,icon:ua.icon,id:ua.id,url:o.I.getUrlForPartial(vn,{editview:ua.id,editIndex:null}),active:ua===Zt,parentItem:wn,subTitle:ua.subTitle}));const kn=ur(Ot,$t.node);return wn.parentItem=kn,{main:wn,node:wn.children.find(ua=>ua.active)}}function Co({dashboard:Ot,sectionNav:$t}){return t.createElement(i.Y,{navModel:$t},t.createElement("div",{className:"dashboard-settings__header"},"Dashboard not editable"),t.createElement(g.$n,{type:"submit",onClick:()=>Ot.makeEditable()},"Make editable"))}function bo(Ot){const $t=new URLSearchParams(Ot.search).get("editIndex");if($t!=null)return parseInt($t,10)}},39712:(Q,A,e)=>{"use strict";e.d(A,{c:()=>y});var t=e(96540),n=e(71678),o=e(55852),s=e(44836),r=e(14792),g=e(32196),u=e(2543),c=e(69733),i=e(5805),l=e(12131),f=e(96374),d=e(37390),h=e(2913),p=e(3673),m=e(11230);const a={cleanUpDashboardAndVariables:p.Bz},v=(0,c.connect)(null,a),E=({hideModal:M,cleanUpDashboardAndVariables:T,dashboard:I})=>{const x=I.meta.provisioned,[,S]=(0,i.default)(async()=>{await(0,m.A_)(I.uid,!0),T(),M(),l.Ny.replace("/")},[M]),O=D(I.panels,I.title);return x?t.createElement(b,{hideModal:M,provisionedId:I.meta.provisionedExternalId}):t.createElement(f.u,{isOpen:!0,body:O,onConfirm:S,onDismiss:M,title:"Delete",icon:"trash-alt",confirmText:"Delete"})},D=(M,T)=>{const I=(0,u.sumBy)(M,x=>x.alert?1:0);return I>0&&!h.$W.unifiedAlertingEnabled?t.createElement(t.Fragment,null,t.createElement("p",null,"Do you want to delete this dashboard?"),t.createElement("p",null,"This dashboard contains ",I," alert",I>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,T))},b=({hideModal:M,provisionedId:T})=>t.createElement(d.a,{isOpen:!0,title:"Cannot delete provisioned dashboard",icon:"trash-alt",onDismiss:M,className:(0,g.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: ",T),t.createElement(d.a.ButtonRow,null,t.createElement(o.$n,{variant:"primary",onClick:M},"OK"))),C=v(E),y=()=>{const M=(0,r.UA)().getCurrent();return t.createElement(n.$s,null,({showModal:T,hideModal:I})=>t.createElement(o.$n,{variant:"destructive",onClick:()=>{T(C,{dashboard:M,hideModal:I})},"aria-label":"Dashboard settings page delete dashboard button"},t.createElement(s.x6,{i18nKey:"dashboard-settings.dashboard-delete-button"},"Delete Dashboard")))}},10740:(Q,A,e)=>{"use strict";e.d(A,{n:()=>w,C:()=>H});var t=e(32196),n=e(96540),o=e(40845),s=e(55852),r=e(94753),g=e(60782),u=e(62930),c=e(56034),i=e(42418),l=e(67061),f=e(10354),d=e(29158),h=e(14578),p=e(72109);const m=({currentPage:V,numberOfPages:G,onNavigate:_,hideWhenSinglePage:K,className:j})=>{const k=(0,o.of)(a);return K&&G<=1?null:n.createElement("div",{className:(0,t.cx)(k.wrapper,j)},n.createElement(d.K,{name:"angle-left",size:"md",tooltip:"Previous",onClick:()=>_(V-1),disabled:V===1}),V," of ",G,n.createElement(d.K,{name:"angle-right",size:"md",tooltip:"Next",onClick:()=>_(V+1),disabled:V===G}))},a=V=>({wrapper:(0,t.css)({display:"flex",flexDirection:"row",gap:16,userSelect:"none"})});var v=e(16817),E=e(65418),D=e(34867),b=e(3169),C=e(3363);const y=(0,D.DW)("features.dashboards.genai");var M=(V=>(V.IDLE="idle",V.GENERATING="generating",V.COMPLETED="completed",V))(M||{});const T=1e4;function I(V=C.C4,G=1){const[_,K]=(0,n.useState)([]),[j,k]=(0,n.useState)(!1),[Y,ee]=(0,n.useState)(""),[re,J]=(0,n.useState)("idle"),[ne,q]=(0,n.useState)(),{error:te}=(0,b._2)();let oe="";const ue=(0,n.useCallback)(pe=>{J("idle"),K([]),k(!1),q(pe),te("Failed to generate content using OpenAI","Please try again or if the problem persists, contact your organization admin."),console.error(pe),y.logError(pe,{messages:JSON.stringify(_),model:V,temperature:String(G)})},[_,V,G,te]);(0,n.useEffect)(()=>{_.length>0&&ee("")},[_]);const{error:ie,value:ge}=(0,v.A)(async()=>await(0,C.QX)(),[C.QX]),{error:he,value:De}=(0,v.A)(async()=>{if(!ge||!_.length)return{enabled:ge};J("generating"),q(void 0);const pe=E.qH({model:V,temperature:G,messages:_}).pipe(E.qA());return{enabled:ge,stream:pe.subscribe({next:le=>{oe=le},error:ue,complete:()=>{ee(oe),J("completed"),setTimeout(()=>{J("idle")}),K([]),k(!1),q(void 0)}})}},[_,ge]);return(0,n.useEffect)(()=>()=>{De?.stream&&De.stream.unsubscribe()},[De]),(0,n.useEffect)(()=>{j&&(De?.stream?.unsubscribe(),J("idle"),k(!1),q(void 0),K([]))},[j,De?.stream]),(0,n.useEffect)(()=>{let pe;return re==="generating"&&Y===""&&(pe=setTimeout(()=>{ue(new Error(`OpenAI stream timed out after ${T}ms`))},T)),()=>{pe&&clearTimeout(pe)}},[re,Y,ue]),(he||ie)&&q(he||ie),{setMessages:K,setStopGeneration:k,messages:_,reply:Y,streamStatus:re,error:ne,value:De}}const x=({history:V,index:G,reply:_,streamStatus:K,onNavigate:j})=>{const k=(0,o.of)(S),Y=V.length,ee=()=>_&&K!==M.IDLE?_:V[G-1];return n.createElement(n.Fragment,null,n.createElement(m,{currentPage:G,numberOfPages:Y,onNavigate:j,hideWhenSinglePage:!0,className:k.paginationWrapper}),n.createElement("div",{className:k.contentWrapper},n.createElement(r.E,{element:"p",color:"secondary"},ee())))},S=V=>({paginationWrapper:(0,t.css)({display:"flex",flexDirection:"row",justifyContent:"flex-end",marginTop:15}),contentWrapper:(0,t.css)({display:"flex",flexBasis:"100%",flexGrow:3,whiteSpace:"pre-wrap",marginTop:20,height:110,overflowY:"scroll"})}),O=({onSuggestionClick:V,isGenerating:G})=>{const _=(0,o.of)(P);return n.createElement("div",{className:_.quickSuggestionsWrapper},n.createElement(s.$n,{onClick:()=>V(C.HG.Shorter),size:"sm",variant:"secondary",disabled:G},C.HG.Shorter),n.createElement(s.$n,{onClick:()=>V(C.HG.MoreDescriptive),size:"sm",variant:"secondary",disabled:G},C.HG.MoreDescriptive),n.createElement(s.$n,{onClick:()=>V(C.HG.Regenerate),size:"sm",variant:"secondary",disabled:G},C.HG.Regenerate))},P=V=>({quickSuggestionsWrapper:(0,t.css)({display:"flex",flexDirection:"row",alignItems:"center",flexWrap:"wrap",flexGrow:1,gap:8,paddingTop:10})});var L=e(57725);const U=.5,R=({eventTrackingSrc:V,history:G,messages:_,onApplySuggestion:K,updateHistory:j})=>{const k=(0,o.of)(B),[Y,ee]=(0,n.useState)(1),[re,J]=(0,n.useState)(!1),[ne,q]=(0,n.useState)(""),{setMessages:te,setStopGeneration:oe,reply:ue,streamStatus:ie,error:ge}=I(C.C4,U),he=ie===M.GENERATING,De=(Le,We)=>(0,L.XX)(V,Le,We);(0,n.useEffect)(()=>{!he&&ue!==""&&ee(1)},[he,ue]),(0,n.useEffect)(()=>{ie===M.COMPLETED&&j((0,C.Kb)(ue))},[ie,ue,j]),(0,n.useEffect)(()=>{ge&&J(!0),ie===M.GENERATING&&J(!1)},[ge,ie]);const pe=Le=>{Ee(Le),De(L.KR.customFeedback,{customFeedback:Le})},le=()=>{he?(oe(!0),ue!==""&&j((0,C.Kb)(ue))):K(G[Y-1])},Te=Le=>{ee(Le),De(Le>Y?L.KR.backHistoryItem:L.KR.forwardHistoryItem)},Ee=Le=>{Le!==C.HG.Regenerate?_=[..._,...(0,C.To)(G[Y-1],Le)]:_=[..._,...(0,C.To)(G[Y-1],"Please, regenerate")],te(_),Le in C.HG&&De(L.KR.quickFeedback,{quickFeedbackItem:Le})},Re=Le=>Le.key==="Enter"&&pe(ne),me=Le=>q(Le.currentTarget.value),Me=()=>pe(ne),ye=()=>De(L.KR.linkToDocs);return n.createElement("div",{className:k.container},re&&n.createElement(i.F,{title:""},n.createElement(l.B,{direction:"column"},n.createElement("p",null,"Sorry, I was unable to complete your request. Please try again."))),n.createElement(f.p,{placeholder:"Tell AI what to do next...",suffix:n.createElement(d.K,{name:"corner-down-right-alt",variant:"secondary","aria-label":"Send custom feedback",onClick:Me,disabled:ne===""}),value:ne,onChange:me,onKeyDown:Re}),n.createElement("div",{className:k.actions},n.createElement(O,{onSuggestionClick:Ee,isGenerating:he}),n.createElement(x,{history:G,index:Y,onNavigate:Te,reply:(0,C.Kb)(ue),streamStatus:ie})),n.createElement("div",{className:k.applySuggestion},n.createElement(l.B,{justifyContent:"flex-end",direction:"row"},n.createElement(s.$n,{icon:he?"fa fa-spinner":"check",onClick:le},he?H:"Apply"))),n.createElement("div",{className:k.footer},n.createElement(h.I,{name:"exclamation-circle","aria-label":"exclamation-circle",className:k.infoColor}),n.createElement(r.E,{variant:"bodySmall",color:"secondary"},"This content is AI-generated using the"," ",n.createElement(p.Y,{variant:"bodySmall",href:"https://grafana.com/docs/grafana-cloud/alerting-and-irm/machine-learning/llm-plugin/",external:!0,onClick:ye},"Grafana LLM plugin"))))},B=V=>({container:(0,t.css)({display:"flex",flexDirection:"column",width:520,maxHeight:350,paddingBottom:35}),applySuggestion:(0,t.css)({marginTop:V.spacing(1)}),actions:(0,t.css)({display:"flex",flexDirection:"row",flexWrap:"wrap"}),footer:(0,t.css)({position:"absolute",bottom:0,left:0,width:"100%",display:"flex",flexDirection:"row",margin:0,padding:V.spacing(1),paddingLeft:V.spacing(2),alignItems:"center",gap:V.spacing(1),borderTop:`1px solid ${V.colors.border.weak}`,marginTop:V.spacing(2)}),infoColor:(0,t.css)({color:V.colors.info.main})}),H="Stop generating",w=({text:V="Auto-generate",toggleTipTitle:G="",onClick:_,model:K=C.C4,messages:j,onGenerate:k,temperature:Y=1,eventTrackingSrc:ee,disabled:re})=>{const J=(0,o.of)(N),{messages:ne,setMessages:q,setStopGeneration:te,reply:oe,value:ue,error:ie,streamStatus:ge}=I(K,Y),[he,De]=(0,n.useState)([]),[pe,le]=(0,n.useState)(!1),Te=he.length>0,Ee=ge===M.GENERATING,Re=!Te,me=re||ue&&!ue.enabled&&!ie,Me=Ke=>(0,L.XX)(ee,Ke),ye=Ke=>{ge===M.GENERATING?te(!0):Te?le(!0):(_?.(Ke),q(typeof j=="function"?j():j));const Xe=ie?L.KR.erroredRetryButton:Ee?L.KR.stopGenerationButton:Re?L.KR.autoGenerateButton:L.KR.improveButton;Me(Xe)},Le=(0,n.useCallback)(Ke=>{he.indexOf(Ke)===-1&&De([Ke,...he])},[he]);if((0,n.useEffect)(()=>{ge===M.COMPLETED&&oe&&k((0,C.Kb)(oe))},[ge,oe,k]),(0,n.useEffect)(()=>{ge===M.COMPLETED&&Le((0,C.Kb)(oe))},[he,ge,oe,Le]),!ue?.enabled)return null;const We=Ke=>{Me(L.KR.applySuggestion),k(Ke),le(!1)},Be=()=>{if(!Ee)return ie||ue&&!ue?.enabled?"exclamation-circle":"ai"},Ye=()=>{let Ke=V;return ie&&(Ke="Retry"),Ee&&(Ke=H),Te&&(Ke="Improve"),Ke},at=n.createElement(s.$n,{icon:Be(),onClick:ye,fill:"text",size:"sm",disabled:me,variant:ie?"destructive":"primary"},Ye()),st=()=>{if(Te){const Ke=n.createElement(r.E,{element:"p"},G);return n.createElement(g.G,{title:Ke,content:n.createElement(R,{history:he,messages:ne,onApplySuggestion:We,updateHistory:Le,eventTrackingSrc:ee}),placement:"left-start",fitContent:!0,show:pe,onClose:()=>le(!1),onOpen:()=>le(!0)},at)}return at};return n.createElement("div",{className:J.wrapper},Ee&&n.createElement(u.y,{size:"sm",className:J.spinner}),Re?n.createElement(c.m,{show:ie?void 0:!1,interactive:!0,content:"Failed to generate content using OpenAI. Please try again or if the problem persist, contact your organization admin."},at):st())},N=V=>({wrapper:(0,t.css)({display:"flex"}),spinner:(0,t.css)({color:V.colors.text.link})})},81394:(Q,A,e)=>{"use strict";e.d(A,{V:()=>u});var t=e(96540),n=e(10740),o=e(57725),s=e(3363);const g=`You are an expert in creating Grafana Dashboards. Your goal is to write a descriptive and concise dashboard description. You will be given the title and description of the dashboard's panels. The dashboard description is meant to explain the purpose of the dashboard and what its panels show. If the dashboard has no panels, the description should be "Empty dashboard" There should be no numbers in the description except where they are important. The dashboard description should not have the dashboard title or any quotation marks in it. The description should be, at most, 300 characters. Respond with only the description of the dashboard.`,u=({onGenerate:i,dashboard:l})=>{const f=t.useMemo(()=>c(l),[l]);return t.createElement(n.n,{messages:f,onGenerate:i,eventTrackingSrc:o.ec.dashboardDescription,toggleTipTitle:"Improve your dashboard description"})};function c(i){const l=(0,s.BB)(i);return[{content:g,role:s.Xh.system},{content:`The title of the dashboard is "${i.title}" ${l}`,role:s.Xh.system}]}},27966:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>u});var t=e(96540),n=e(10740),o=e(57725),s=e(3363);const g=`You are an expert in creating Grafana Dashboards. Your goal is to write a concise dashboard title. You will be given the title and description of the dashboard's panels. The dashboard title is meant to say what it shows on one line for users to navigate to it. If the dashboard has no panels, the title should be "Empty dashboard" There should be no numbers in the title. The dashboard title should not have quotation marks in it. The title should be, at most, 50 characters. Respond with only the title of the dashboard.`,u=({onGenerate:i,dashboard:l})=>{const f=t.useMemo(()=>c(l),[l]);return t.createElement(n.n,{messages:f,onGenerate:i,eventTrackingSrc:o.ec.dashboardTitle,toggleTipTitle:"Improve your dashboard title"})};function c(i){return[{content:g,role:s.Xh.system},{content:`The panels in the dashboard are: ${(0,s.BB)(i)}`,role:s.Xh.system}]}},57725:(Q,A,e)=>{"use strict";e.d(A,{KR:()=>s,XX:()=>r,ec:()=>o});var t=e(14110);const n="dashboards_autogenerate_clicked";var o=(g=>(g.panelDescription="panel-description",g.panelTitle="panel-title",g.dashboardChanges="dashboard-changes",g.dashboardTitle="dashboard-title",g.dashboardDescription="dashboard-description",g.unknown="unknown",g))(o||{}),s=(g=>(g.autoGenerateButton="auto-generate-button",g.erroredRetryButton="errored-retry-button",g.stopGenerationButton="stop-generating-button",g.improveButton="improve-button",g.backHistoryItem="back-history-item",g.forwardHistoryItem="forward-history-item",g.quickFeedback="quick-feedback",g.linkToDocs="link-to-docs",g.customFeedback="custom-feedback",g.applySuggestion="apply-suggestion",g))(s||{});function r(g,u,c){(0,t.rR)(n,{src:g,item:u,...c})}},3363:(Q,A,e)=>{"use strict";e.d(A,{C4:()=>m,HG:()=>p,Xh:()=>h,Yy:()=>v,BB:()=>b,To:()=>D,hn:()=>C,QX:()=>E,Kb:()=>a});var t=e(65418),n=e(90254),o=e(34214);function s(y,M){return y===M?M:Array.isArray(y)&&Array.isArray(M)?u(y,M):r(y)&&r(M)?g(y,M):M}function r(y){return typeof y=="object"&&!Array.isArray(y)&&y!==null}function g(y,M){const T=Object.keys(y),I={};for(const x of T)M.hasOwnProperty(x)&&(Array.isArray(y[x])&&Array.isArray(M[x])||typeof y[x]=="object"&&typeof M[x]=="object"?I[x]=s(y[x],M[x]):I[x]=M[x]);return I}function u(y,M){const T=new Array(y.length).fill(void 0),I=new Set([...Array(y.length).keys()]),x=new Set([...Array(M.length).keys()]);for(let S=0;S<y.length&&x.size!==0;S++){let O=y[S];for(let P=0;P<M.length;P++){if(!x.has(P))continue;let L=M[P];L=s(O,L),JSON.stringify(O)===JSON.stringify(L)&&(I.delete(S),x.delete(P),T[S]=L)}}return c(y,M,T,I,x),T.filter(S=>S!==void 0)}function c(y,M,T,I,x){let S={};x.forEach(P=>{let L=M[P];if(typeof L!="object"||Array.isArray(L)){T.push(L),x.delete(P);return}I.forEach(U=>{let R=y[U];if(typeof R!="object"||Array.isArray(R)){I.delete(U);return}let B=0;for(const H in R){let w=R[H];if(!L.hasOwnProperty(H))continue;let N=L[H];typeof w!="string"&&typeof w!="number"||typeof w!=typeof N||w===N&&(H==="id"&&(B+=1e3),B++)}B!==0&&(S[B]===void 0&&(S[B]=[]),S[B].push([U,P]))})});const O=Object.keys(S).map(Number);O.sort((P,L)=>L-P);for(const P of O){let L=S[P];for(const U of L){const[R,B]=U;I.has(R)&&x.has(B)&&(T[R]=M[B],I.delete(R),x.delete(B))}}for(const P of x)T.push(M[P])}function i(y){const M=y.split(` `);let T=y[0].startsWith("Index")?4:3,I=M.slice(0,T);const x=/("title"|Title|\{|\}|\[|\])/i;for(let S=T;S<M.length;S++){let O=M[S];(x.test(O)||O.startsWith("+")||O.startsWith("-"))&&I.push(O)}return I.join(` `)+` `}function l(y){if(y===null||y==="")return null;if(Array.isArray(y)){const T=y.map(I=>l(I)).filter(I=>I!==null);return T.length>0?T:null}if(typeof y!="object")return y;const M={};for(const T in y){const I=l(y[T]);if(I!==null){if(Array.isArray(I)&&I.length===0||typeof I=="object"&&Object.keys(I).length===0)continue;M[T]=I}}return Object.keys(M).length>0?M:null}function f(y){return JSON.parse(JSON.stringify(y,null,2))}function d(y){let M=f(y.getOriginalDashboard()),T=f(new o.G(M).getSaveModelClone()),I=f(y.getSaveModelClone());T=l(s(M,T)),I=l(s(T,I)),M=l(M);let x=(0,n.ss)("Before migration changes","After migration changes",JSON.stringify(M,null,2),JSON.stringify(T,null,2),"","",{context:20}),S=(0,n.ss)("Before user changes","After user changes",JSON.stringify(T,null,2),JSON.stringify(I,null,2),"","",{context:20});return x=i(x),S=i(S),{migrationDiff:x,userDiff:S}}var h=(y=>(y.system="system",y.user="user",y))(h||{}),p=(y=>(y.Shorter="Even shorter",y.MoreDescriptive="More descriptive",y.Regenerate="Regenerate",y))(p||{});const m="gpt-4",a=y=>y.replace(/^"|"$/g,"");function v(y){const{migrationDiff:M,userDiff:T}=d(y);return{userChanges:T,migrationChanges:M}}async function E(){return t.vK().then(y=>y.ok)}const D=(y,M)=>[{role:"system",content:`Your previous response was: ${y}. The user has provided the following feedback: ${M}. Re-generate your response according to the provided feedback.`}];function b(y){const M=(x,S)=>`- Panel ${S} - Title: ${x.title}${x.description?` - Description: ${x.description}`:""}`,T=y.panels.map(M);let I;if(T.length<=10)I=`The panels in the dashboard are: ${T.join(` `)}`;else{const x=y.panels.filter(P=>P.description),S=y.panels.filter(P=>!P.description);let O;x.length>=10?O=x.slice(10).map(M).join(` `):(O=x.map(M).join(` `),O+=` `,O+=S.slice(10-x.length).map(M).join("n")),I=`There are ${T.length} panels. Due to space constraints, only the information for ten of them is presented. These ten are not necessarily the first ten, but prioritized to those with descriptions. The panels in the dashboard are: ${O}`}return I}function C(y){const M=y.getSaveModel(),T=new Set(["id","datasource","title","description","targets","thresholds","type","xaxis","yaxes"]),I=Object.keys(M).reduce((x,S)=>(T.has(S)&&(x[S]=M[S]),x),{});return JSON.stringify(I,null,2)}},18803:(Q,A,e)=>{"use strict";e.d(A,{B6:()=>f,E_:()=>h,jD:()=>d});var t=e(2543),n=e.n(t),o=e(72985),s=e(89667),r=e(52622),g=e(72724),u=e(39070),c=e(32264),i=e(41524),l=e(68706);function f(E){const D=[];if(E?.series)for(const b of E.series)D.push((0,s.Nw)(b));if(E?.annotations)for(const b of E.annotations){const C=(0,s.Nw)(b);C.schema?.meta||(C.schema.meta={}),C.schema.meta.dataTopic=r.QR.Annotations,D.push(C)}return D}function d(E,D){const b=E.getSaveModel(),C={panelType:b.type,datasource:"??"},y=`${c.$.buildInfo.version} (${c.$.buildInfo.commit})`;let M=`| Key | Value | |--|--| | Panel | ${C.panelType} @ ${b.pluginVersion??y} | | Grafana | ${y} // ${c.$.buildInfo.edition} | `;return D&&(M+="<details><summary>Panel debug snapshot dashboard</summary>\n\n```json\n"+D+"\n```\n</details>"),M}async function h(E,D,b){const C=E.getSaveModel(),y=(0,t.cloneDeep)(v),M={panelType:C.type,datasource:"??"},T=await(0,o._)(E.getQueryRunner().getData({withFieldConfig:!1,withTransforms:!1})),I=E.datasource,x=(0,i.W)(f(T),D),S=`${c.$.buildInfo.version} (${c.$.buildInfo.commit})`,O=C?.targets??[],P=`<table width="100%"> <tr> <th width="2%">Panel</th> <td >${M.panelType} @ ${C.pluginVersion??S}</td> </tr> <tr> <th>Queries</th> <td>${O.map(L=>{const U=L.datasource??I;return`${L.refId}[${U?.type}]`}).join(", ")}</td> </tr> ${p(C)} ${m(T,x)} ${a(T)} <tr> <th>Grafana</th> <td>${S} // ${c.$.buildInfo.edition}</td> </tr> </table>`.trim();if(y.panels[0]={...C,...y.panels[0],targets:[{refId:"A",datasource:{type:"grafana",uid:"grafana"},queryType:l.nj.Snapshot,snapshot:x}]},C.transformations?.length){const L=y.panels[y.panels.length-1];L.title=L.title+" (after transformations)";const U=(0,t.cloneDeep)(L);U.id=100,U.title="Data (before transformations)",U.gridPos.w=24,U.targets[0].withTransforms=!1,y.panels.push(U)}return T.annotations?.length&&y.panels.push({id:7,gridPos:{h:6,w:24,x:0,y:20},type:"table",title:"Annotations",datasource:{type:"datasource",uid:"-- Dashboard --"},options:{showTypeIcons:!0},targets:[{datasource:{type:"datasource",uid:"-- Dashboard --"},panelId:2,withTransforms:!0,topic:r.QR.Annotations,refId:"A"}]}),y.panels[1].options.content=P,y.panels[2].options.content=JSON.stringify(C,null,2),y.title=`Debug: ${C.title} // ${(0,g.LE)(new Date)}`,y.tags=["debug",`debug-${M.panelType}`],y.time={from:b.from.toISOString(),to:b.to.toISOString()},y}function p(E){return E.transformations?`<tr> <th>Transform</th> <td>${E.transformations.map(D=>D.id).join(", ")}</td> </tr>`:""}function m(E,D){let b=E.series.length??0,C=0,y=0;for(const M of E.series)C+=M.fields.length,y+=M.length;return`<tr><th>Data</th><td>${E.state!==u.Gu.Done?E.state:""} ${b} frames, ${C} fields, ${y} rows </td></tr>`}function a(E){return E.annotations?.length?`<tr> <th>Annotations</th> <td>${E.annotations.map((D,b)=>`<span>${D.length}</span>`)}</td> </tr>`:""}const v={panels:[{id:2,title:"Reproduced with embedded data",datasource:{type:"grafana",uid:"grafana"},gridPos:{h:13,w:15,x:0,y:0}},{gridPos:{h:7,w:9,x:15,y:0},id:5,options:{content:"...",mode:"html"},title:"Debug info",type:"text"},{id:6,title:"Original Panel JSON",type:"text",gridPos:{h:13,w:9,x:15,y:7},options:{content:"...",mode:"code",code:{language:"json",showLineNumbers:!0,showMiniMap:!0}}},{id:3,title:"Data from panel above",type:"table",datasource:{type:"datasource",uid:"-- Dashboard --"},gridPos:{h:7,w:15,x:0,y:13},options:{showTypeIcons:!0},targets:[{datasource:{type:"datasource",uid:"-- Dashboard --"},panelId:2,withTransforms:!0,refId:"A"}]}],schemaVersion:37}},65123:(Q,A,e)=>{"use strict";e.d(A,{BN:()=>c,kx:()=>i,sd:()=>u});var t=e(96540),n=e(24705),o=e(19347),s=e(44836),r=e(16560),g=e(54612);const u=l=>(0,n.A)(async()=>c(l),[l]).value;async function c(l){const f=l?.request?.targets||[];if(l&&l.series&&f.length){for(const d of l.series)if(d.meta&&d.meta.custom){const h=await(0,o.l)().get(f[0].datasource);if(h&&h.components?.MetadataInspector)return h}}}const i=(l,f,d,h,p)=>(0,t.useMemo)(()=>{const m=[];return(0,g.$)(d)&&(m.push({label:(0,s.t)("dashboard.inspect.data-tab","Data"),value:r.q.Data}),m.push({label:(0,s.t)("dashboard.inspect.stats-tab","Stats"),value:r.q.Stats})),p&&m.push({label:(0,s.t)("dashboard.inspect.meta-tab","Meta data"),value:r.q.Meta}),m.push({label:(0,s.t)("dashboard.inspect.json-tab","JSON"),value:r.q.JSON}),h&&m.push({label:(0,s.t)("dashboard.inspect.error-tab","Error"),value:r.q.Error}),f.meta.canEdit&&(0,g.$)(d)&&m.push({label:(0,s.t)("dashboard.inspect.query-tab","Query"),value:r.q.Query}),m},[d,p,f,h])},57755:(Q,A,e)=>{"use strict";e.d(A,{D:()=>f});var t=e(32196),n=e(96540),o=e(78685),s=e(13544),r=e(53402),g=e(40845),u=e(55852),c=e(83277),i=e(53466);const l="showCategory",f=n.memo(({id:p,title:m,children:a,forceOpen:v,isOpenDefault:E=!0,renderTitle:D,className:b,itemsCount:C,isNested:y=!1,sandboxId:M})=>{const[T,I]=(0,o.A)(h(p),{isExpanded:E}),[x,S]=(0,n.useState)(T?.isExpanded??E),O=(0,n.useRef)(0),P=(0,n.useRef)(null),[L,U]=(0,c.s)(),R=L[l]===p;(0,n.useEffect)(()=>{O.current&&Date.now()-O.current<200||(R||v)&&(x||S(!0),R&&P.current?.scrollIntoView())},[v,x,R]);const B=(0,n.useCallback)(()=>{O.current=Date.now(),U({[l]:x?void 0:p},!0),I({isExpanded:!x}),S(!x)},[I,S,U,x,p]);D||(D=function(_){return _||C===void 0||C===0?m:n.createElement("span",null,m," ",n.createElement(r.p,{value:C}))});const H=(0,g.of)(d),w=(0,t.cx)({[H.box]:!0,[H.boxNestedExpanded]:y&&x},b),N=(0,t.cx)(H.header,{[H.headerExpanded]:x,[H.headerNested]:y}),V=(0,t.cx)(H.body,{[H.bodyNested]:y});return n.createElement("div",{className:w,"data-testid":"options-category","data-plugin-sandbox":M,"aria-label":s.Tp.components.OptionsGroup.group(p),ref:P},n.createElement("div",{className:N,onClick:B},n.createElement(u.$n,{"aria-label":s.Tp.components.OptionsGroup.toggle(p),type:"button",fill:"text",size:"sm",variant:"secondary","aria-expanded":x,className:H.toggleButton,icon:x?"angle-down":"angle-right",onClick:B}),n.createElement("h6",{id:`button-${p}`,className:H.title},D(x))),x&&n.createElement("div",{className:V,id:p,"aria-labelledby":`button-${p}`},a))});f.displayName="OptionsPaneCategory";const d=p=>({box:(0,t.css)({borderTop:`1px solid ${p.colors.border.weak}`}),boxNestedExpanded:(0,t.css)({marginBottom:p.spacing(2)}),title:(0,t.css)({flexGrow:1,overflow:"hidden",lineHeight:1.5,fontSize:"1rem",paddingLeft:"6px",fontWeight:p.typography.fontWeightMedium,margin:0}),header:(0,t.css)({display:"flex",cursor:"pointer",alignItems:"center",padding:p.spacing(.5),color:p.colors.text.primary,fontWeight:p.typography.fontWeightMedium,"&:hover":{background:p.colors.emphasize(p.colors.background.primary,.03)}}),toggleButton:(0,t.css)({alignSelf:"baseline"}),headerExpanded:(0,t.css)({color:p.colors.text.primary}),headerNested:(0,t.css)({padding:p.spacing(.5,0,.5,0)}),body:(0,t.css)({padding:p.spacing(1,2,1,4)}),bodyNested:(0,t.css)({position:"relative",paddingRight:0,"&:before":{content:"''",position:"absolute",top:0,left:"8px",width:"1px",height:"100%",background:p.colors.border.weak}})}),h=p=>`${i.wi}.optionGroup[${p}]`},48192:(Q,A,e)=>{"use strict";e.d(A,{C:()=>o});var t=e(96540),n=e(57755);class o{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(u=>u.props.id===r);return g||(g=new o({title:r,id:r}),this.addCategory(g)),g}render(r){return this.props.customRender?this.props.customRender():t.createElement(n.D,{key:this.props.title,...this.props},this.items.map(g=>g.render(r)),this.categories.map(g=>g.render(r)))}}},74097:(Q,A,e)=>{"use strict";e.d(A,{v:()=>d});var t=e(32196),n=e(96540),o=e(23257),s=e.n(o),r=e(13544),g=e(60029),u=e(88575),c=e(40845),i=e(56034);function l({overrides:m}){const a=(0,c.of)(f);return n.createElement("div",{className:a.wrapper},m.map((v,E)=>n.createElement(i.m,{content:v.tooltip,key:E.toString(),placement:"top"},n.createElement("div",{"aria-label":v.description,className:a[v.type]}))))}const f=m=>{const a={width:8,height:8,borderRadius:m.shape.radius.circle,marginLeft:m.spacing(1),top:"-1px"};return{wrapper:(0,t.css)({display:"flex"}),rule:(0,t.css)({...a,position:"relative",backgroundColor:m.colors.primary.main}),data:(0,t.css)({...a,position:"relative",backgroundColor:m.colors.warning.main})}};class d{constructor(a){this.props=a}getLabel(a){const{title:v,description:E,overrides:D,addon:b}=this.props;if(!a)return this.parent.props.title===v&&!D?.length?null:n.createElement(h,{title:v,description:E,overrides:D,addon:b});const C=[];return this.parent.parent&&C.push(this.highlightWord(this.parent.parent.props.title,a)),this.parent.props.title!==v&&C.push(this.highlightWord(this.parent.props.title,a)),n.createElement(g.J,{description:E&&this.highlightWord(E,a),category:C},this.highlightWord(v,a),D&&D.length>0&&n.createElement(l,{overrides:D}))}highlightWord(a,v){return n.createElement(s(),{textToHighlight:a,searchWords:[v],highlightClassName:"search-fragment-highlight"})}renderOverrides(){const{overrides:a}=this.props;!a||a.length}render(a){const{title:v,description:E,render:D,showIf:b,skipField:C}=this.props,y=`${this.parent.props.id} ${v}`;return b&&!b()?null:C?D():n.createElement(u.D,{label:this.getLabel(a),description:E,key:y,"aria-label":r.Tp.components.PanelEditor.OptionsPane.fieldLabel(y)},D())}}function h({title:m,description:a,overrides:v,addon:E}){const D=(0,c.of)(p);return n.createElement("div",{className:D.container},n.createElement(g.J,{description:a},m,v&&v.length>0&&n.createElement(l,{overrides:v})),E)}function p(m){return{container:(0,t.css)` display: flex; justify-content: space-between; `}}},14183:(Q,A,e)=>{"use strict";e.d(A,{gs:()=>V,Ff:()=>w,Po:()=>G});var t=e(32196),n=e(96540),o=e(32264),s=e(40845),r=e(67647),g=e(94354),u=e(40276),c=e(74106),i=e(82792),l=e(69733),f=e(7376),d=e(79971),h=e(40334),p=e(33390);function m(K,j){p.A.set(`panel-edit-section-${K}`,j?"true":"false")}function a(K,j){return p.A.getBool(`panel-edit-section-${K}`,j)}const v=(K,j)=>({angularPanelComponent:(0,h.U)(K,j.panel)?.angularComponent}),E={changePanelPlugin:d.gW},D=(0,l.connect)(v,E);class b extends n.PureComponent{constructor(j){super(j)}componentDidMount(){this.loadAngularOptions()}componentDidUpdate(j){(this.props.plugin!==j.plugin||this.props.angularPanelComponent!==j.angularPanelComponent)&&this.cleanUpAngularOptions(),this.loadAngularOptions()}componentWillUnmount(){this.cleanUpAngularOptions()}cleanUpAngularOptions(){this.angularOptions&&(this.angularOptions.destroy(),this.angularOptions=null)}loadAngularOptions(){const{panel:j,angularPanelComponent:k,changePanelPlugin:Y}=this.props;if(!this.element||!k||this.angularOptions)return;const ee=k.getScope();if(!ee.$$childHead){setTimeout(()=>{this.forceUpdate()});return}const re=ee.$$childHead.ctrl;re.initEditMode(),re.onPluginTypeChange=te=>{Y({panel:j,pluginId:te.id})};let J="";for(let te=0;te<re.editorTabs.length;te++){const oe=re.editorTabs[te];oe.isOpen=a(oe.title,te===0),J+=` <div class="panel-options-group" ng-cloak> <div class="panel-options-group__header" ng-click="toggleOptionGroup(${te})" aria-label="${oe.title} section"> <div class="panel-options-group__icon"> <icon name="ctrl.editorTabs[${te}].isOpen ? 'angle-down' : 'angle-right'"></icon> </div> <div class="panel-options-group__title">${oe.title}</div> </div> <div class="panel-options-group__body" ng-if="ctrl.editorTabs[${te}].isOpen"> <panel-editor-tab editor-tab="ctrl.editorTabs[${te}]" ctrl="ctrl"></panel-editor-tab> </div> </div> `}const ne=(0,f.E)(),q={ctrl:re,toggleOptionGroup:te=>{const oe=re.editorTabs[te];oe.isOpen=!oe.isOpen,m(oe.title,!!oe.isOpen)}};this.angularOptions=ne.load(this.element,q,J),this.angularOptions.digest()}render(){return n.createElement("div",{ref:j=>this.element=j})}}const C=(0,l.connect)(v,E)(b);var y=e(57755),M=e(22290),T=e(10354);const I=({panel:K,formatDate:j})=>{const k=(0,s.of)(x),Y=K.libraryPanel?.meta;return Y?n.createElement("div",{className:k.info},n.createElement("div",{className:k.libraryPanelInfo},`Used on ${Y.connectedDashboards} `,Y.connectedDashboards===1?"dashboard":"dashboards"),n.createElement("div",{className:k.libraryPanelInfo},"Last edited on ",j?.(Y.updated,"L")??Y.updated," by",Y.updatedBy.avatarUrl&&n.createElement("img",{width:"22",height:"22",className:k.userAvatar,src:Y.updatedBy.avatarUrl,alt:`Avatar for ${Y.updatedBy.name}`}),Y.updatedBy.name)):null},x=K=>({info:(0,t.css)` line-height: 1; `,libraryPanelInfo:(0,t.css)` color: ${K.colors.text.secondary}; font-size: ${K.typography.bodySmall.fontSize}; `,userAvatar:(0,t.css)` border-radius: ${K.shape.radius.circle}; box-sizing: content-box; width: 22px; height: 22px; padding-left: ${K.spacing(1)}; padding-right: ${K.spacing(1)}; `});var S=e(48192),O=e(74097);function P(K){const{panel:j,onPanelConfigChange:k,dashboard:Y}=K,ee=new S.C({title:"Library panel options",id:"Library panel options",isOpenDefault:!0});return(0,i.X)(j)&&ee.addItem(new O.v({title:"Name",value:j.libraryPanel.name,popularRank:1,render:function(){return n.createElement(T.p,{id:"LibraryPanelFrameName",defaultValue:j.libraryPanel.name,onBlur:J=>k("libraryPanel",{...j.libraryPanel,name:J.currentTarget.value})})}})).addItem(new O.v({title:"Information",render:function(){return n.createElement(I,{panel:j,formatDate:Y.formatDate})}})),ee}var L=e(50632),U=e(7600);class R{constructor(j,k){this.categories=j,this.overrides=k}search(j){const k=new RegExp(j,"i"),ee=this.collectHits(this.categories,k,[]).sort(B).map(ne=>ne.item),J=this.collectHits(this.overrides,k,[]).sort(B).map(ne=>ne.item);return{optionHits:ee,overrideHits:this.buildOverrideHitCategories(J),totalCount:this.getAllOptionsCount(this.categories)}}collectHits(j,k,Y){for(const ee of j){const re=k.test(ee.props.title);for(const J of ee.items){if(k.test(J.props.title)){Y.push({item:J,rank:1});continue}if(J.props.description&&k.test(J.props.description)){Y.push({item:J,rank:2});continue}re&&Y.push({item:J,rank:3})}ee.categories.length>0&&this.collectHits(ee.categories,k,Y)}return Y}getAllOptionsCount(j){let k=0;for(const Y of j)k+=Y.items.length,Y.categories.length>0&&(k+=this.getAllOptionsCount(Y.categories));return k}buildOverrideHitCategories(j){const k={};for(const Y of j){let ee=k[Y.parent.props.title];ee||(ee=k[Y.parent.props.title]=new S.C(Y.parent.props),ee.addItem(Y.parent.items[0])),ee.items[0].props.title!==Y.props.title&&ee.addItem(Y)}return Object.values(k)}}function B(K,j){return K.rank-j.rank}function H(K){const j=[];for(const k of K)for(const Y of k.items)Y.props.title==="Unit"&&(Y.props.popularRank=2),Y.props.title==="Min"&&(Y.props.popularRank=3),Y.props.title==="Max"&&(Y.props.popularRank=4),Y.props.title==="Display name"&&(Y.props.popularRank=5),Y.props.popularRank&&j.push(Y);return j.sort((k,Y)=>k.props.popularRank-Y.props.popularRank)}const w=K=>{const{plugin:j,dashboard:k,panel:Y}=K,[ee,re]=(0,n.useState)(""),[J,ne]=(0,n.useState)("All"),q=(0,s.of)(_),[te,oe,ue]=(0,n.useMemo)(()=>[(0,L.q)(K),(0,U.Zm)(K),P(K)],[Y.configRev,K.data,K.instanceState,ee]),ie=(0,n.useMemo)(()=>(0,M.v)(K.panel.fieldConfig,K.plugin.fieldConfigRegistry,K.data?.series??[],ee,K.onFieldConfigsChange),[Y.configRev,K.data,K.instanceState,ee]),ge=[],he=ee.length>0,De=(0,n.useMemo)(N,[]),pe=(0,i.X)(Y)?[ue,te,...oe]:[te,...oe];if(he)ge.push(G(pe,ie,ee)),K.plugin.angularPanelCtrl&&ge.push(n.createElement("div",{className:q.searchNotice,key:"Search notice"},"This is an old visualization type that does not support searching all options."));else switch(J){case"All":(0,i.X)(Y)&&ge.push(ue.render()),ge.push(te.render()),K.plugin.angularPanelCtrl&&ge.push(n.createElement(C,{plugin:j,dashboard:k,panel:Y,key:"AngularOptions"}));for(const Te of oe)ge.push(Te.render());for(const Te of ie)ge.push(Te.render());break;case"Overrides":for(const Te of ie)ge.push(Te.render());break;case"Recent":ge.push(n.createElement(y.D,{id:"Recent options",title:"Recent options",key:"Recent options",forceOpen:1},H(pe).map(Te=>Te.render())));break}const le=!he&&!j.fieldConfigRegistry.isEmpty();return n.createElement("div",{className:q.wrapper},n.createElement("div",{className:q.formBox},Y.isAngularPlugin()&&!j.meta.angular?.hideDeprecation&&n.createElement(c.c,{className:q.angularDeprecationWrapper,showPluginDetailsLink:!0,pluginId:j.meta.id,pluginType:j.meta.type,angularSupportEnabled:o.$?.angularSupportEnabled,interactionElementId:"panel-options"}),n.createElement("div",{className:q.formRow},n.createElement(r.Z,{width:0,value:ee,onChange:re,placeholder:"Search options"})),le&&n.createElement("div",{className:q.formRow},n.createElement(g.z,{options:De,value:J,fullWidth:!0,onChange:ne}))),n.createElement("div",{className:q.scrollWrapper},n.createElement(u.E,{autoHeightMin:"100%"},n.createElement("div",{className:q.mainBox},ge))))};function N(){return[{label:"All",value:"All"},{label:"Overrides",value:"Overrides"}]}var V=(K=>(K.All="All",K.Overrides="Overrides",K.Recent="Recent",K))(V||{});function G(K,j,k){const Y=new R(K,j),{optionHits:ee,totalCount:re,overrideHits:J}=Y.search(k);return n.createElement("div",{key:"search results"},n.createElement(y.D,{id:"Found options",title:`Matched ${ee.length}/${re} options`,key:"Normal options",forceOpen:1},ee.map(ne=>ne.render(k))),J.map(ne=>ne.render(k)))}const _=K=>({wrapper:(0,t.css)` height: 100%; display: flex; flex-direction: column; flex: 1 1 0; .search-fragment-highlight { color: ${K.colors.warning.text}; background: transparent; } `,searchBox:(0,t.css)` display: flex; flex-direction: column; min-height: 0; `,formRow:(0,t.css)` margin-bottom: ${K.spacing(1)}; `,formBox:(0,t.css)` padding: ${K.spacing(1)}; background: ${K.colors.background.primary}; border: 1px solid ${K.components.panel.borderColor}; border-top-left-radius: ${K.shape.borderRadius(1.5)}; border-bottom: none; `,closeButton:(0,t.css)` margin-left: ${K.spacing(1)}; `,searchHits:(0,t.css)` padding: ${K.spacing(1,1,0,1)}; `,scrollWrapper:(0,t.css)` flex-grow: 1; min-height: 0; `,searchNotice:(0,t.css)` font-size: ${K.typography.size.sm}; color: ${K.colors.text.secondary}; padding: ${K.spacing(1)}; text-align: center; `,mainBox:(0,t.css)` background: ${K.colors.background.primary}; border: 1px solid ${K.components.panel.borderColor}; border-top: none; flex-grow: 1; `,angularDeprecationWrapper:(0,t.css)` padding: ${K.spacing(1)}; `})},16930:(Q,A,e)=>{"use strict";e.d(A,{c:()=>g});var t=e(96540),n=e(12131),o=e(66864),s=e(55852),r=e(32696);function g({message:u}){const c=(0,t.useCallback)(()=>{n.Ny.partial({tab:r.M8.Query})},[]);return t.createElement(o.PE,{justify:"center",style:{marginTop:"100px"}},t.createElement(o.gW,{spacing:"md"},t.createElement("h2",null,u),t.createElement("div",null,t.createElement(s.$n,{size:"md",variant:"secondary",icon:"arrow-left",onClick:c},"Go back to Queries"))))}},22290:(Q,A,e)=>{"use strict";e.d(A,{v:()=>I});var t=e(32196),n=e(2543),o=e(96540),s=e(85200),r=e(37055),g=e(84349),u=e(51986),c=e(40845),i=e(6923),l=e(23257),f=e.n(l),d=e(66864),h=e(60029),p=e(53402),m=e(29158),a=e(88575),v=e(57755);const E=({property:P,context:L,registry:U,onChange:R,onRemove:B,isSystemOverride:H,searchQuery:w})=>{const N=(0,c.of)(D),V=U?.getIfExists(P.id),G=(0,o.useId)();if(!V)return null;const _=Array.isArray(P.value)||P.id===r.uo.Thresholds||P.id===r.uo.Links||P.id===r.uo.Mappings,K=V.category?.filter(Y=>Y!==V.name);let j;const k=(Y=!0,ee=!1)=>(re=!1)=>o.createElement(d.Gy,{justify:"space-between"},o.createElement(h.J,{category:K,description:Y?V.description:void 0,htmlFor:G},o.createElement(f(),{textToHighlight:V.name,searchWords:[w],highlightClassName:"search-fragment-highlight"}),!re&&ee&&V.getItemsCount&&o.createElement(p.p,{value:V.getItemsCount(P.value)})),!H&&o.createElement("div",null,o.createElement(m.K,{name:"times",onClick:B,tooltip:"Remove label"})));return _?j=o.createElement(v.D,{id:V.name,renderTitle:k(!1,!0),className:(0,t.css)` padding-left: 0; padding-right: 0; `,isNested:!0,isOpenDefault:P.value!==void 0},o.createElement(V.override,{value:P.value,onChange:Y=>{R(Y)},item:V,context:L})):j=o.createElement("div",null,o.createElement(a.D,{label:k()(),description:V.description},o.createElement(V.override,{value:P.value,onChange:Y=>{R(Y)},item:V,context:L,id:G}))),o.createElement("div",{className:(0,t.cx)(_&&N.collapsibleOverrideEditor,!_&&"dynamicConfigValueEditor--nonCollapsible")},j)},D=P=>({collapsibleOverrideEditor:(0,t.css)` label: collapsibleOverrideEditor; & + .dynamicConfigValueEditor--nonCollapsible { margin-top: ${P.spacing(1)}; } `});var b=e(48192),C=e(74097),y=e(14578);const M=({isExpanded:P,registry:L,matcherUi:U,overrideName:R,override:B,onOverrideRemove:H})=>{const w=(0,c.of)(T),V=B.properties.map(_=>L.getIfExists(_.id)).filter(_=>!!_).map(_=>_?.name).join(", "),G=U.optionsToLabel(B.matcher.options);return o.createElement("div",null,o.createElement(d.Gy,{justify:"space-between"},o.createElement("div",null,R),o.createElement(m.K,{name:"trash-alt",onClick:H,tooltip:"Remove override"})),!P&&o.createElement("div",{className:w.overrideDetails},o.createElement("div",{className:w.options,title:G},G," ",o.createElement(y.I,{name:"angle-right"})," ",V)))};M.displayName="OverrideTitle";const T=P=>({matcherUi:(0,t.css)` padding: ${P.spacing(1)}; `,propertyPickerWrapper:(0,t.css)` margin-top: ${P.spacing(2)}; `,overrideDetails:(0,t.css)` font-size: ${P.typography.bodySmall.fontSize}; color: ${P.colors.text.secondary}; font-weight: ${P.typography.fontWeightRegular}; `,options:(0,t.css)` overflow: hidden; padding-right: ${P.spacing(4)}; `,unknownLabel:(0,t.css)` margin-bottom: 0; `});function I(P,L,U,R,B){const H=[],w=P;if(!L||L.isEmpty())return[];const N=(K,j)=>{let k=(0,n.cloneDeep)(w.overrides);k[K]=j,B({...w,overrides:k})},V=K=>{let j=(0,n.cloneDeep)(w.overrides);j.splice(K,1),B({...w,overrides:j})},G=K=>{const j=s.sJ.get(K.value);j&&B({...w,overrides:[...w.overrides,{matcher:{id:j.id,options:j.defaultOptions},properties:[]}]})},_={data:U,getSuggestions:K=>(0,i.Hf)(U,K),isOverride:!0};for(let K=0;K<w.overrides.length;K++){const j=w.overrides[K],k=`Override ${K+1}`,Y=g.g.get(j.matcher.id),ee=x(L),re=(0,r.Ow)(j),J=j.properties.length===0?1:0,ne=new b.C({title:k,id:k,forceOpen:J,renderTitle:function(ue){return o.createElement(M,{override:j,isExpanded:ue,registry:L,overrideName:k,matcherUi:Y,onOverrideRemove:()=>V(K)})}}),q=oe=>{j.matcher.options=oe,N(K,j)},te=(oe,ue)=>{const ie=L.get(ue.value),ge={id:ie.id,value:ie.defaultValue};j.properties?oe.properties.push(ge):oe.properties=[ge],N(K,oe)};ne.addItem(new C.v({title:Y.name,render:function(){return o.createElement(Y.component,{id:`${Y.matcher.id}-${K}`,matcher:Y.matcher,data:U??[],options:j.matcher.options,onChange:q})}}));for(let oe=0;oe<j.properties.length;oe++){const ue=j.properties[oe],ie=L.getIfExists(ue.id);if(!ie)continue;const ge=De=>{j.properties[oe].value=De,N(K,j)},he=()=>{j.properties.splice(oe,1),N(K,j)};ne.addItem(new C.v({title:ie.name,skipField:!0,render:function(){return o.createElement(E,{key:`${ue.id}/${oe}`,isSystemOverride:re,onChange:ge,onRemove:he,property:ue,registry:L,context:_,searchQuery:R})}}))}!re&&j.matcher.options&&ne.addItem(new C.v({title:"----------",skipField:!0,render:function(){return o.createElement(u.i,{key:"Add override property",label:"Add override property",variant:"secondary",isFullWidth:!0,icon:"plus",menuPlacement:"auto",options:ee,onChange:ue=>te(j,ue)})}})),H.push(ne)}return H.push(new b.C({title:"add button",id:"add button",customRender:function(){return o.createElement(S,{key:"Add override"},o.createElement(u.i,{icon:"plus",label:"Add field override",variant:"secondary",menuPlacement:"auto",isFullWidth:!0,size:"md",options:g.g.list().filter(j=>!j.excludeFromPicker).map(j=>({label:j.name,value:j.id,description:j.description})),onChange:j=>G(j)}))}})),H}function x(P){return P.list().filter(L=>!L.hideFromOverrides).map(L=>{let U=L.name;return L.category&&(U=[...L.category,L.name].join(" > ")),{label:U,value:L.id,description:L.description}})}function S({children:P}){const L=(0,c.of)(O);return o.createElement("div",{className:L},P)}function O(P){return(0,t.css)({borderTop:`1px solid ${P.colors.border.weak}`,padding:`${P.spacing(2)}`,display:"flex"})}},50632:(Q,A,e)=>{"use strict";e.d(A,{q:()=>x,I:()=>S});var t=e(96540),n=e(32264),o=e(10354),s=e(21744),r=e(15292),g=e(64919),u=e(94354),c=e(88323),i=e(32023),l=e(6923),f=e(14792),d=e(10740),h=e(57725),p=e(3363);const a=`You are an expert in creating Grafana Panels. You will be given the title and description of the dashboard the panel is in as well as the JSON for the panel. Your goal is to write a descriptive and concise panel description. The panel description is meant to explain the purpose of the panel, not just its attributes. Do not refer to the panel; simply describe its purpose. There should be no numbers in the description except for thresholds. The description should be, at most, 200 characters.`,v=({onGenerate:P,panel:L})=>{const U=t.useMemo(()=>E(L),[L]);return t.createElement(d.n,{messages:U,onGenerate:P,eventTrackingSrc:h.ec.panelDescription,toggleTipTitle:"Improve your panel description"})};function E(P){const L=(0,f.UA)().getCurrent(),U=(0,p.hn)(P);return[{content:a,role:p.Xh.system},{content:`The panel is part of a dashboard with the title: ${L.title}`,role:p.Xh.system},{content:`The panel is part of a dashboard with the description: ${L.description}`,role:p.Xh.system},{content:`This is the JSON which defines the panel: ${U}`,role:p.Xh.user}]}const b="You are an expert in creating Grafana Panels.Your goal is to write short, descriptive, and concise panel title.The title should be shorter than 50 characters.",C=({onGenerate:P,panel:L})=>{const U=t.useMemo(()=>y(L),[L]);return t.createElement(d.n,{messages:U,onGenerate:P,eventTrackingSrc:h.ec.panelTitle,toggleTipTitle:"Improve your panel title"})};function y(P){const L=(0,f.UA)().getCurrent(),U=(0,p.hn)(P);return[{content:b,role:p.Xh.system},{content:`The panel is part of a dashboard with the title: ${L.title}`,role:p.Xh.system},{content:`The panel is part of a dashboard with the description: ${L.description}`,role:p.Xh.system},{content:`Use this JSON object which defines the panel: ${U}`,role:p.Xh.system}]}var M=e(92378),T=e(48192),I=e(74097);function x(P){const{panel:L,onPanelConfigChange:U}=P,R=new T.C({title:"Panel options",id:"Panel options",isOpenDefault:!0}),B=w=>{const N=document.getElementById("PanelFrameTitle");N instanceof HTMLInputElement&&(N.value=w,U("title",w))},H=w=>{const N=document.getElementById("description-text-area");N instanceof HTMLTextAreaElement&&(N.value=w,U("description",w))};return R.addItem(new I.v({title:"Title",value:L.title,popularRank:1,render:function(){return t.createElement(o.p,{id:"PanelFrameTitle",defaultValue:L.title,onBlur:N=>U("title",N.currentTarget.value)})},addon:n.$.featureToggles.dashgpt&&t.createElement(C,{onGenerate:B,panel:L})})).addItem(new I.v({title:"Description",description:L.description,value:L.description,render:function(){return t.createElement(s.f,{id:"description-text-area",defaultValue:L.description,onBlur:N=>U("description",N.currentTarget.value)})},addon:n.$.featureToggles.dashgpt&&t.createElement(v,{onGenerate:H,panel:L})})).addItem(new I.v({title:"Transparent background",render:function(){return t.createElement(r.d,{value:L.transparent,id:"transparent-background",onChange:N=>U("transparent",N.currentTarget.checked)})}})).addCategory(new T.C({title:"Panel links",id:"Panel links",isOpenDefault:!1,itemsCount:L.links?.length}).addItem(new I.v({title:"Panel links",render:function(){return t.createElement(g.e,{links:L.links,onChange:N=>U("links",N),getSuggestions:l.Fq,data:[]})}}))).addCategory(new T.C({title:"Repeat options",id:"Repeat options",isOpenDefault:!1}).addItem(new I.v({title:"Repeat by variable",description:"Repeat this panel for each value in the selected variable. This is not visible while in edit mode. You need to go back to dashboard and then update the variable or reload the dashboard.",render:function(){return t.createElement(M.G,{id:"repeat-by-variable-select",repeat:L.repeat,onChange:N=>{U("repeat",N)}})}})).addItem(new I.v({title:"Repeat direction",showIf:()=>!!L.repeat,render:function(){const N=[{label:"Horizontal",value:"h"},{label:"Vertical",value:"v"}];return t.createElement(u.z,{options:N,value:L.repeatDirection||"h",onChange:V=>U("repeatDirection",V)})}})).addItem(new I.v({title:"Max per row",showIf:()=>!!(L.repeat&&L.repeatDirection==="h"),render:function(){const N=[2,3,4,6,8,12].map(V=>({label:V.toString(),value:V}));return t.createElement(c.l6,{options:N,value:L.maxPerRow,onChange:V=>U("maxPerRow",V.value)})}})))}function S(P){const L=new T.C({title:"Panel options",id:"Panel options",isOpenDefault:!0}),U=i.b.getPanelLinks(P),R=U.state.rawLinks;return L.addItem(new I.v({title:"Title",value:P.state.title,popularRank:1,render:function(){return t.createElement(o.p,{id:"PanelFrameTitle",defaultValue:P.state.title,onBlur:H=>P.setState({title:H.currentTarget.value})})}})).addItem(new I.v({title:"Description",description:P.state.description,value:P.state.description,render:function(){return t.createElement(s.f,{id:"description-text-area",defaultValue:P.state.description,onBlur:H=>P.setState({description:H.currentTarget.value})})}})).addItem(new I.v({title:"Transparent background",render:function(){return t.createElement(r.d,{value:P.state.displayMode==="transparent",id:"transparent-background",onChange:()=>{P.setState({displayMode:P.state.displayMode==="transparent"?"default":"transparent"})}})}})).addCategory(new T.C({title:"Panel links",id:"Panel links",isOpenDefault:!1,itemsCount:R?.length}).addItem(new I.v({title:"Panel links",render:()=>t.createElement(O,{panelLinks:U})})))}function O({panelLinks:P}){const{rawLinks:L}=P.useState();return t.createElement(g.e,{links:L,onChange:U=>P.setState({rawLinks:U}),getSuggestions:l.Fq,data:[]})}},7600:(Q,A,e)=>{"use strict";e.d(A,{g5:()=>p,Zm:()=>d,Z4:()=>h});var t=e(2543),n=e(96540),o=e(60264),s=e(6923),r=e(48192),g=e(74097);const u="Some data fields have this option pre-configured. Add a field override rule to override the pre-configured value.",c="An override rule exists for this property";function i(m,a,v){const E=[];if(v){for(const b of v)for(const C of b.fields)if((0,t.get)(C.config,m.path)!=null){E.push({type:"data",description:u,tooltip:u});break}}return a.overrides.some(b=>b.properties.some(C=>C.id===m.id))&&E.push({type:"rule",description:c,tooltip:c}),E}var l=e(54612);function f({data:m,replaceVariables:a,options:v,eventBus:E,instanceState:D}){const b=m?.series??[];return{data:b,replaceVariables:a,options:v,eventBus:E,getSuggestions:y=>(0,s.Hf)(b,y),instanceState:D}}function d(m){const{plugin:a,panel:v,onPanelOptionsChanged:E,onFieldConfigsChange:D,data:b,dashboard:C,instanceState:y}=m,M=v.getOptions(),T=v.fieldConfig,I={},x=f({data:b,replaceVariables:v.replaceVariables,options:M,eventBus:C.events,instanceState:y}),S=P=>{const L=(P&&P[0])??`${a.meta.name}`,U=I[L];return U||(I[L]=new r.C({title:L,id:L,sandboxId:a.meta.id}))},O={getValue:P=>(0,t.get)(M,P),onChange:(P,L)=>{const U=(0,l.Sf)(M,P,L);E(U)}};p(a.getPanelOptionsSupplier(),O,S,x);for(const P of a.fieldConfigRegistry.list()){if(P.isCustom){if(P.showIf&&!P.showIf(T.defaults.custom,b?.series))continue}else if(P.showIf&&!P.showIf(T.defaults,b?.series))continue;if(P.hideFromDefaults)continue;const L=S(P.category),U=P.editor,R=T.defaults,B=P.isCustom?R.custom?(0,t.get)(R.custom,P.path):void 0:(0,t.get)(R,P.path);P.getItemsCount&&(L.props.itemsCount=P.getItemsCount(B)),L.addItem(new g.v({title:P.name,description:P.description,overrides:i(P,T,b?.series),render:function(){const w=N=>{D((0,l.EQ)(T,P.path,N,P.isCustom))};return n.createElement(U,{value:B,onChange:w,item:P,context:x,id:P.id})}}))}return Object.values(I)}function h(m){const{plugin:a,panel:v,data:E,eventBus:D,instanceState:b}=m,C={},y=S=>{const O=S?.[0]??a.meta.name,P=C[O];return P||(C[O]=new r.C({title:O,id:O,sandboxId:a.meta.id}))},M=v.state.options,T={getValue:S=>(0,t.get)(M,S),onChange:(S,O)=>{const P=(0,l.Sf)(M,S,O);v.onOptionsChange(P)}},I=f({data:E,replaceVariables:v.interpolate,options:M,eventBus:D,instanceState:b});p(a.getPanelOptionsSupplier(),T,y,I);const x=v.state.fieldConfig;for(const S of a.fieldConfigRegistry.list()){const O=S.showIf&&(S.isCustom?!S.showIf(x.defaults.custom,E?.series):!S.showIf(x.defaults,E?.series));if(S.hideFromDefaults||O)continue;const P=y(S.category),L=S.editor,U=x.defaults,R=S.isCustom?U.custom?(0,t.get)(U.custom,S.path):void 0:(0,t.get)(U,S.path);S.getItemsCount&&(P.props.itemsCount=S.getItemsCount(R)),P.addItem(new g.v({title:S.name,description:S.description,overrides:i(S,x,E?.series),render:function(){const H=w=>{v.onFieldConfigChange((0,l.EQ)(x,S.path,w,S.isCustom),!0)};return n.createElement(L,{value:R,onChange:H,item:S,context:I,id:S.id})}}))}return Object.values(C)}function p(m,a,v,E,D){const b=new o.pv;m(b,E);for(const C of b.getItems()){if(C.showIf&&!C.showIf(E.options,E.data))continue;let y=D;if(y?C.category?.[0]?.length&&(y=y.getCategory(C.category[0])):y=v(C.category),(0,o.iF)(C)){const T=C.getNestedValueAccess(a),I=T.getContext?T.getContext(E):{...E,options:a.getValue(C.path)};p(C.getBuilder(),T,v,I,y);continue}const M=C.editor;y.addItem(new g.v({title:C.name,description:C.description,render:function(){return n.createElement(M,{value:a.getValue(C.path),onChange:I=>{a.onChange(C.path,I)},item:C,context:E,id:C.id})}}))}}},53466:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>D,GU:()=>f,MJ:()=>h,Ox:()=>p,eK:()=>a,fR:()=>m,kw:()=>v,wi:()=>u});var t=e(30038),n=e(39070),o=e(43127),s=e(33390),r=e(84423),g=e(32696);const u="grafana.dashboard.editor.ui",c={isPanelOptionsVisible:!0,rightPaneSize:400,topPaneSize:.45,mode:g.q5.Fill},i=()=>{const b=s.A.getObject(u,c);let C={...b};return typeof b.topPaneSize=="string"&&(C={...b,topPaneSize:parseFloat(b.topPaneSize)/100}),{getPanel:()=>new r.a9({}),getSourcePanel:()=>new r.a9({}),getData:()=>({state:n.Gu.NotStarted,series:[],timeRange:(0,o.E2)()}),initDone:!1,shouldDiscardChanges:!1,isOpen:!1,isVizPickerOpen:!1,tableViewEnabled:!1,ui:{...c,...C}}},l=(0,t.Z0)({name:"panelEditor",initialState:i(),reducers:{updateEditorInitState:(b,C)=>{b.getPanel=()=>C.payload.panel,b.getSourcePanel=()=>C.payload.sourcePanel,b.initDone=!0,b.isOpen=!0,b.shouldDiscardChanges=!1},setEditorPanelData:(b,C)=>{b.getData=()=>C.payload},setDiscardChanges:(b,C)=>{b.shouldDiscardChanges=C.payload},setPanelEditorUIState:(b,C)=>{b.ui={...b.ui,...C.payload},!b.ui.isPanelOptionsVisible&&b.isVizPickerOpen&&(b.isVizPickerOpen=!1)},toggleVizPicker:(b,C)=>{b.isVizPickerOpen=C.payload,b.isVizPickerOpen&&(b.ui.isPanelOptionsVisible=!0)},toggleTableView(b){b.tableViewEnabled=!b.tableViewEnabled},closeEditor:b=>{b.getPanel=()=>new r.a9({}),b.getSourcePanel=()=>new r.a9({}),b.isOpen=!1,b.initDone=!1,b.isVizPickerOpen=!1,b.tableViewEnabled=!1}}}),{updateEditorInitState:f,setEditorPanelData:d,setDiscardChanges:h,closeEditor:p,setPanelEditorUIState:m,toggleVizPicker:a,toggleTableView:v}=l.actions,D={panelEditor:l.reducer}},95689:(Q,A,e)=>{"use strict";e.d(A,{a:()=>u,e:()=>c});var t=e(41811),n=e(2913),o=e(16233),s=e(75471),r=e(57220),g=e(32696);const u=(0,t.A)((i,l)=>{const f=[];if(!l)return f;let d=g.M8.Visualize;if(l.meta.skipDataQuery)return[];l.meta.skipDataQuery||(d=g.M8.Query,f.push({id:g.M8.Query,text:"Query",icon:"database",active:!1}),f.push({id:g.M8.Transform,text:"Transform data",icon:"process",active:!1})),c(l)&&f.push({id:g.M8.Alert,text:"Alert",icon:"bell",active:!1});const h=f.find(p=>p.id===(i||d))??f[0];return h.active=!0,f});function c(i){const{alertingEnabled:l,unifiedAlertingEnabled:f}=(0,n.zj)(),d=o.TP.hasPermission((0,s.Wd)(r.hY).read),h=l||f&&d,p=i.meta.id==="graph",m=i.meta.id==="timeseries";return h&&p||m}},32696:(Q,A,e)=>{"use strict";e.d(A,{M8:()=>t,Nt:()=>s,__:()=>g,q5:()=>n});var t=(u=>(u.Query="query",u.Transform="transform",u.Visualize="visualize",u.Alert="alert",u))(t||{}),n=(u=>(u[u.Fill=0]="Fill",u[u.Fit=1]="Fit",u[u.Exact=2]="Exact",u))(n||{}),o=(u=>(u[u.Off=0]="Off",u[u.Table=1]="Table",u))(o||{});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=(u=>(u[u.Visualizations=0]="Visualizations",u[u.LibraryPanels=1]="LibraryPanels",u[u.Suggestions=2]="Suggestions",u[u.Widgets=3]="Widgets",u))(g||{})},54612:(Q,A,e)=>{"use strict";e.d(A,{$:()=>g,A:()=>r,EQ:()=>u,Sf:()=>c});var t=e(2543),n=e.n(t),o=e(15054),s=e(32696);function r(i,l,f,d){if(i===s.q5.Fill)return{width:l,height:f};const h=8*6,p=60,a=(window.innerWidth-p-o.dU*4)/o.cV*d.gridPos.w,v=o.sD*d.gridPos.h+h,E=Math.min(l/a,f/v);return a<=l&&v<=f?{width:a,height:v}:{width:a*E,height:v*E}}function g(i){return i?.meta.skipDataQuery===!1}const u=(i,l,f,d)=>{let h={...i.defaults};const p=f==null||f==="";return d?h.custom?p?h.custom=(0,t.omit)(h.custom,l):h.custom=c(h.custom,l,f):p||(h.custom=c(h.custom,l,f)):p?h=(0,t.omit)(h,l):h=c(h,l,f),{...i,defaults:h}};function c(i,l,f){const d=Array.isArray(l)?l:l.split("."),h=d.shift();if(h.endsWith("]")){const m=h.lastIndexOf("["),a=+h.substring(m+1,h.length-1),v=h.substring(0,m);let E=i[v];const D=Array.isArray(E)?[...E]:[];return d.length&&(E=D[a],(E==null||typeof E!="object")&&(E={}),f=c(E,d,f)),D[a]=f,{...i,[v]:D}}if(!d.length)return{...i,[h]:f};let p=i[h];return(p==null||typeof p!="object")&&(p={}),{...i,[h]:c(p,d,f)}}},92378:(Q,A,e)=>{"use strict";e.d(A,{G:()=>r});var t=e(96540),n=e(88323),o=e(80348),s=e(87421);const r=({repeat:g,onChange:u,id:c})=>{const i=(0,o.useSelector)(d=>(0,s.SS)((0,s.y7)(d),d)),l=(0,t.useMemo)(()=>{const d=i.map(h=>({label:h.name,value:h.name}));return d.length===0&&d.unshift({label:"No template variables found",value:null}),d.unshift({label:"Disable repeating",value:null}),d},[i]),f=(0,t.useCallback)(d=>u(d.value),[u]);return t.createElement(n.l6,{inputId:c,value:g,onChange:f,options:l})}},78050:(Q,A,e)=>{"use strict";e.d(A,{C:()=>u,m:()=>c});var t=e(96540),n=e(13544),o=e(14110),s=e(71678),r=e(55852),g=e(70497);const u=({dashboard:i,onSaveSuccess:l,size:f})=>t.createElement(s.$s,null,({showModal:d,hideModal:h})=>t.createElement(r.$n,{size:f,onClick:()=>{d(g.$,{dashboard:i,onSaveSuccess:l,onDismiss:h})},"aria-label":n.Tp.pages.Dashboard.Settings.General.saveDashBoard},"Save dashboard")),c=({dashboard:i,onClick:l,onSaveSuccess:f,variant:d,size:h})=>t.createElement(s.$s,null,({showModal:p,hideModal:m})=>t.createElement(r.$n,{size:h,onClick:()=>{(0,o.rR)("grafana_dashboard_save_as_clicked"),l?.(),p(g.$,{dashboard:i,onSaveSuccess:f,onDismiss:m,isCopy:!0})},variant:d,"aria-label":n.Tp.pages.Dashboard.Settings.General.saveAsDashBoard},"Save as"))},54943:(Q,A,e)=>{"use strict";e.d(A,{l:()=>c});var t=e(96540),n=e(16817),o=e(62930),s=e(67061),r=e(90613),g=e(19626),u=e(22764);const c=({diff:i,oldValue:l,newValue:f})=>{const d=(0,n.A)(async()=>{const p=JSON.stringify(l??{},null,2),m=JSON.stringify(f??{},null,2);let a;const v=[];let E=0;if(i)for(const[D,b]of Object.entries(i)){const C=t.createElement(g.D,{diffs:b,key:D,title:D});D==="schemaVersion"?a=C:v.push(C),E+=b.length}return{schemaChange:a,diffs:v,count:E,showDiffs:E<15,jsonView:t.createElement(u.M,{oldValue:p,newValue:m})}},[i,l,f]),{value:h}=d;return!h||!l?t.createElement(o.y,null):h.count<1?t.createElement("div",null,"No changes in this dashboard"):t.createElement(s.B,{direction:"column",gap:1},h.schemaChange&&h.schemaChange,h.showDiffs&&h.diffs,t.createElement(r.a,{paddingTop:2},t.createElement("h4",null,"Full JSON diff"),h.jsonView))}},70497:(Q,A,e)=>{"use strict";e.d(A,{$:()=>st});var t=e(96540),n=e(17172),o=e(32264),s=e(87978),r=e(63021),g=e(40675),u=e(56596),c=e(32196),i=e(16817),l=e(40845),f=e(42418),d=e(27677);function h({dashboard:Ke}){const Xe=(0,l.of)(p),{loading:He,value:Ge,error:xe}=(0,i.A)(async()=>{const be=Ke.getSaveModelCloneOld();return d.IB.validateDashboard(be).catch(ae=>{if(ae.status>=500)throw ae;return ae.data})},[Ke]);let $e;if(He)$e=t.createElement(f.F,{severity:"info",title:"Checking dashboard validity"});else if(Ge)Ge.isValid||($e=t.createElement(f.F,{severity:"warning",title:"Dashboard failed schema validation"},t.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"),t.createElement("div",{className:Xe.error},Ge.message)));else{const be=xe?.message??"Unknown error";$e=t.createElement(f.F,{severity:"info",title:"Error checking dashboard validity"},t.createElement("p",{className:Xe.error},be))}return $e?t.createElement("div",{className:Xe.root},$e):null}const p=Ke=>({root:(0,c.css)({marginTop:Ke.spacing(1)}),error:(0,c.css)({fontFamily:Ke.typography.fontFamilyMonospace,whiteSpace:"pre-wrap",overflowX:"auto",maxWidth:"100%"})}),m=h;var a=e(54943),v=e(96374),E=e(37390),D=e(55852),b=e(78050),C=e(2543),y=e(41053),M=e(71733),T=e(14110),I=e(12131),x=e(28138),S=e(3169),O=e(91219),P=e(55314),L=e(80348),U=e(28444),R=e(36974);const B=async(Ke,Xe,He,Ge)=>{const xe=await Ge({dashboard:Ke,folderUid:Xe.folderUid??He.meta.folderUid??Ke.meta?.folderUid,message:Xe.message,overwrite:Xe.overwrite});if("error"in xe)throw xe.error;return xe.data},H=(Ke=!1)=>{const Xe=(0,L.useDispatch)(),He=(0,S._2)(),[Ge]=(0,P.e8)(),[xe,$e]=(0,y.A)(async(be,Z,ae)=>{try{const de=await B(be,Z,ae,Ge);ae.version=de.version,be=(0,C.cloneDeep)(be),be.version=de.version,ae.clearUnsavedChanges(be,Z),x.A.publish(new U.Eu),He.success("Dashboard saved"),(0,R.ko)(de.uid),Ke?(0,T.rR)("grafana_dashboard_copied",{name:ae.title,url:de.url}):(0,T.rR)(`grafana_dashboard_${ae.id?"saved":"created"}`,{name:ae.title,url:de.url});const ve=I.Ny.getLocation().pathname,Ue=M.I.stripBaseFromUrl(de.url);return Ue!==ve&&setTimeout(()=>I.Ny.replace(Ue)),ae.meta.isStarred&&Xe((0,O.TU)({id:ae.uid,title:ae.title,url:Ue})),de}catch(de){throw de instanceof Error&&He.error(de.message??"Error saving dashboard"),de}},[Xe,He]);return{state:xe,onDashboardSave:$e}},w=({dashboard:Ke,dashboardSaveModel:Xe,error:He,onDismiss:Ge,setErrorIsHandled:xe})=>{const{onDashboardSave:$e}=H();return t.createElement(t.Fragment,null,He.data&&He.data.status==="version-mismatch"&&t.createElement(v.u,{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 $e(Xe,{overwrite:!0},Ke),Ge()},onDismiss:Ge}),He.data&&He.data.status==="name-exists"&&t.createElement(v.u,{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 $e(Xe,{overwrite:!0},Ke),Ge()},onDismiss:Ge}),He.data&&He.data.status==="plugin-dashboard"&&t.createElement(N,{dashboard:Ke,onDismiss:()=>{xe(!0),Ge()}}))},N=({onDismiss:Ke,dashboard:Xe})=>{const{onDashboardSave:He}=H(),Ge=(0,l.of)(G);return t.createElement(E.a,{className:Ge.modal,title:"Plugin dashboard",icon:"copy",isOpen:!0,onDismiss:Ke},t.createElement("div",{className:Ge.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.a.ButtonRow,null,t.createElement(D.$n,{variant:"secondary",onClick:Ke,fill:"outline"},"Cancel"),t.createElement(b.m,{onClick:Ke,dashboard:Xe,onSaveSuccess:Ke}),t.createElement(D.$n,{variant:"destructive",onClick:async()=>{await He(Xe.getSaveModelClone(),{overwrite:!0},Xe),Ke()}},"Overwrite")))},V=Ke=>{switch(Ke){case"version-mismatch":case"name-exists":case"plugin-dashboard":return!0;default:return!1}},G=Ke=>({modal:(0,c.css)` width: 500px; `,modalText:(0,c.css)` font-size: ${Ke.typography.h4.fontSize}; color: ${Ke.colors.text.primary}; margin-bottom: ${Ke.spacing(4)} padding-top: ${Ke.spacing(2)}; `,modalButtonRow:(0,c.css)` margin-bottom: 14px; a, button { margin-right: ${Ke.spacing(2)}; } `});var _=e(51253),K=e(16504),j=e(88575),k=e(66864),Y=e(60029),ee=e(10354),re=e(21744),J=e(15292),ne=e(70096),q=e(71500),te=e(81394),oe=e(27966);const ue=Ke=>{const Xe=Ke.getSaveModelClone();return Xe.id=null,Xe.uid="",Xe.title+=" Copy",Xe.editable=!0,Ke.id>0&&Xe.panels&&Xe.panels.forEach(He=>{He.type==="graph"&&He.alert&&delete He.thresholds,delete He.alert}),Xe},ie=({dashboard:Ke,isLoading:Xe,isNew:He,onSubmit:Ge,onCancel:xe,onSuccess:$e})=>{const be={title:He?Ke.title:`${Ke.title} Copy`,description:Ke.description,$folder:{uid:Ke.meta.folderUid,title:Ke.meta.folderTitle},copyTags:!1},Z=ae=>async de=>{if(de&&de===ae().$folder.title?.trim())return"Dashboard name cannot be the same as folder name";try{return await q.P.validateNewDashboardName(ae().$folder.uid??"general",de),!0}catch(ve){return ve instanceof Error?ve.message:"Dashboard name is invalid"}};return t.createElement(_.l,{defaultValues:be,onSubmit:async ae=>{if(!Ge)return;const de=ue(Ke);de.title=ae.title,de.description=ae.description,!He&&!ae.copyTags&&(de.tags=[]),(await Ge(de,{folderUid:ae.$folder.uid},Ke)).status==="success"&&$e()}},({register:ae,control:de,errors:ve,getValues:Ue})=>t.createElement(t.Fragment,null,t.createElement(K.e,{render:({field:{ref:_e,...ze}})=>t.createElement(j.D,{label:t.createElement(k.Gy,{justify:"space-between"},t.createElement(Y.J,{htmlFor:"title"},"Title"),o.$.featureToggles.dashgpt&&He&&t.createElement(oe.Z,{onGenerate:Ve=>ze.onChange(Ve),dashboard:Ke})),invalid:!!ve.title,error:ve.title?.message},t.createElement(ee.p,{...ze,onChange:Ve=>ze.onChange(Ve.target.value),"aria-label":"Save dashboard title field",autoFocus:!0})),control:de,name:"title",rules:{validate:Z(Ue)}}),t.createElement(K.e,{render:({field:{ref:_e,...ze}})=>t.createElement(j.D,{label:t.createElement(k.Gy,{justify:"space-between"},t.createElement(Y.J,{htmlFor:"description"},"Description"),o.$.featureToggles.dashgpt&&He&&t.createElement(te.V,{onGenerate:Ve=>ze.onChange(Ve),dashboard:Ke})),invalid:!!ve.description,error:ve.description?.message},t.createElement(re.f,{...ze,onChange:Ve=>ze.onChange(Ve.target.value),"aria-label":"Save dashboard description field",autoFocus:!0})),control:de,name:"description"}),t.createElement(j.D,{label:"Folder"},t.createElement(K.e,{render:({field:{ref:_e,...ze}})=>t.createElement(ne.d,{...ze,onChange:(Ve,Ne)=>ze.onChange({uid:Ve,title:Ne}),value:ze.value?.uid,initialTitle:Ke.meta.folderTitle,dashboardId:Ke.id,enableCreateNew:!0}),control:de,name:"$folder"})),!He&&t.createElement(j.D,{label:"Copy tags"},t.createElement(J.d,{...ae("copyTags")})),t.createElement(k.Gy,null,t.createElement(D.$n,{type:"button",variant:"secondary",onClick:xe,fill:"outline"},"Cancel"),t.createElement(D.$n,{disabled:Xe,type:"submit","aria-label":"Save dashboard button"},Xe?"Saving...":"Save"))))};var ge=e(13544),he=e(67061),De=e(10880),pe=e(10740),le=e(57725),Te=e(3363);const Ee=["You are an expert in Grafana Dashboards","Your goal is to write a description of the changes for a dashboard to display to the user","You will be given human-readable diffs with most irrelevant lines filtered out"].join(`. `),Re=["Respond only with the diff description, which is meant to be loaded directly into the application for the user.",'If there are no substantial user or migration changes, the correct description is "Minor changes only"',`If there are too many changes of either kind, and those changes have a message saying 'too long', the correct response for that section is "Too many changes to auto-summarize"`,"In a diff, lines beginning with - are removed, and lines beginning with + are added.","Lines with neither + nor - are included for context. Be careful not to mark them as added or removed if they do not start with + or -.","If a line is changed, it will show a previous version removed and a new version added","When referring to panel changes, use the panel title","When using panel title, wrap it with double quotes","When the panel changes position, just mention that the panel has changed position","When an entire panel is added or removed, use the panel title and only say it was added or removed and disregard the rest of the changes for that panel","Group together similar changes into one line when multiple panels are affected","Refer to templating elements as variables","Try to make the response as short as possible"].join(`. `),me=({dashboard:Ke,onGenerate:Xe,disabled:He})=>{const Ge=(0,t.useCallback)(()=>Me(Ke),[Ke]);return t.createElement(pe.n,{messages:Ge,onGenerate:Xe,temperature:0,model:"gpt-3.5-turbo-16k",eventTrackingSrc:le.ec.dashboardChanges,toggleTipTitle:"Improve your dashboard changes summary",disabled:He})};function Me(Ke){let{userChanges:Xe,migrationChanges:He}=(0,Te.Yy)(Ke);return Xe.length>8e3&&(Xe="User changes were too long, fill in the user changes section with 'User changes too long to auto-summarize'"),He.split(` `).length<10?He="No significant migration changes":He.length>8e3&&(He="Migration changes were too long, fill in the migration changes section with 'Migration changes too long to auto-summarize'"),[{content:Ee,role:Te.Xh.system},{content:`Summarize the following user changes diff under "User changes": ${Xe}`,role:Te.Xh.system},{content:`Be sure to only include substantial user changes, such as adding or removing entire panels, changing panel titles or descriptions, etc. Do not include "User Changes" section if there are no substantial user changes to report.`,role:Te.Xh.system},{content:`Summarize the following migration changes diff under "Migration changes": ${He}`,role:Te.Xh.system},{content:`Be sure to only include substantial migration changes, such as adding or removing entire panels, changing panel titles or descriptions, etc. Ignore any threshold step changes or templating list changes. Ignore other changes and do not include them in the summary. Do not include "Migration Changes" section if there are no substantial migration changes to report. If there are substantial migration changes, add "Some autogenerated changes are included to update the dashboard to the latest valid schema version" at the end.`,role:Te.Xh.system},{content:Re,role:Te.Xh.system}]}const ye=({dashboard:Ke,isLoading:Xe,saveModel:He,options:Ge,onSubmit:xe,onCancel:$e,onSuccess:be,onOptionsChange:Z})=>{const ae=(0,t.useMemo)(()=>Ke.hasTimeChanged(),[Ke]),de=(0,t.useMemo)(()=>Ke.hasVariablesChanged(),[Ke]),[ve,Ue]=(0,t.useState)(!1),[_e,ze]=(0,t.useState)(Ge.message),Ve=(0,l.of)(Le);return t.createElement(_.l,{onSubmit:async Ne=>{if(!xe)return;Ue(!0),Ge={...Ge,message:_e},(await xe(He.clone,Ge,Ke)).status==="success"?be():Ue(!1)}},({register:Ne,errors:ot})=>t.createElement(he.B,{gap:2,direction:"column",alignItems:"flex-start"},ae&&t.createElement(De.S,{checked:!!Ge.saveTimerange,onChange:()=>Z({...Ge,saveTimerange:!Ge.saveTimerange}),label:"Save current time range as dashboard default","aria-label":ge.Tp.pages.SaveDashboardModal.saveTimerange}),de&&t.createElement(De.S,{checked:!!Ge.saveVariables,onChange:()=>Z({...Ge,saveVariables:!Ge.saveVariables}),label:"Save current variable values as dashboard default","aria-label":ge.Tp.pages.SaveDashboardModal.saveVariables}),t.createElement("div",{className:Ve.message},o.$.featureToggles.dashgpt&&t.createElement(me,{dashboard:Ke,onGenerate:nt=>{Z({...Ge,message:nt}),ze(nt)},disabled:!He.hasChanges}),t.createElement(re.f,{"aria-label":"message",value:_e,onChange:nt=>{Z({...Ge,message:nt.currentTarget.value}),ze(nt.currentTarget.value)},placeholder:"Add a note to describe your changes.",autoFocus:!0,rows:5})),t.createElement(he.B,{alignItems:"center"},t.createElement(D.$n,{variant:"secondary",onClick:$e,fill:"outline"},"Cancel"),t.createElement(D.$n,{type:"submit",disabled:!He.hasChanges||Xe,icon:ve?"spinner":void 0,"aria-label":ge.Tp.pages.SaveDashboardModal.save},Xe?"Saving...":"Save"),!He.hasChanges&&t.createElement("div",null,"No changes to save"))))};function Le(Ke){return{message:(0,c.css)` display: flex; align-items: end; flex-direction: column; width: 100%; `}}var We=e(4213),Be=e(10534);const Ye=({dashboard:Ke,onCancel:Xe})=>{const[He,Ge]=(0,t.useState)(()=>{const $e=Ke.getSaveModelClone();return delete $e.id,JSON.stringify($e,null,2)}),xe=(0,t.useCallback)(()=>{const $e=new Blob([He],{type:"application/json;charset=utf-8"});(0,We.saveAs)($e,Ke.title+"-"+new Date().getTime()+".json")},[Ke.title,He]);return t.createElement(t.Fragment,null,t.createElement(he.B,{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: ")," ",Ke.meta.provisionedExternalId),t.createElement(re.f,{spellCheck:!1,value:He,onChange:$e=>{Ge($e.currentTarget.value)},className:at.json}),t.createElement(k.Gy,null,t.createElement(D.$n,{variant:"secondary",onClick:Xe,fill:"outline"},"Cancel"),t.createElement(Be.b,{icon:"copy",getText:()=>He},"Copy JSON to clipboard"),t.createElement(D.$n,{type:"submit",onClick:xe},"Save JSON to file"))))},at={json:(0,c.css)` height: 400px; width: 100%; overflow: auto; resize: none; font-family: monospace; `},st=({dashboard:Ke,onDismiss:Xe,onSaveSuccess:He,isCopy:Ge})=>{const[xe,$e]=(0,t.useState)({}),be=Ke.getOriginalDashboard(),Z=Ke.meta.provisioned,ae=Ke.version===0,[de,ve]=(0,t.useState)(!1),Ue=(0,t.useMemo)(()=>{const mt=Ke.getSaveModelClone({saveTimerange:!!xe.saveTimerange,saveVariables:!!xe.saveVariables});if(!be)return{clone:mt,diff:{},diffCount:0,hasChanges:!1};const gt=(0,u.G4)(be,mt);let Pt=0;for(const Mt of Object.values(gt))Pt+=Mt.length;return{clone:mt,diff:gt,diffCount:Pt,hasChanges:Pt>0&&!ae}},[Ke,be,xe,ae]),[_e,ze]=(0,t.useState)(!1),{state:Ve,onDashboardSave:Ne}=H(Ge),ot=He?()=>{Xe(),He()}:Xe,nt=()=>_e?t.createElement(a.l,{diff:Ue.diff,oldValue:be,newValue:Ue.clone}):ae||Ge?t.createElement(ie,{dashboard:Ke,isLoading:Ve.loading,onCancel:Xe,onSuccess:ot,onSubmit:Ne,isNew:ae}):Z?t.createElement(Ye,{dashboard:Ke,onCancel:Xe,onSuccess:ot}):t.createElement(ye,{dashboard:Ke,isLoading:Ve.loading,saveModel:Ue,onCancel:Xe,onSuccess:ot,onSubmit:Ne,options:xe,onOptionsChange:$e});if(Ve.error&&!de&&(0,n.NF)(Ve.error)&&V(Ve.error.data.status))return t.createElement(w,{error:Ve.error,dashboard:Ke,dashboardSaveModel:Ue.clone,onDismiss:Xe,setErrorIsHandled:ve});let pt="Save dashboard";return Ge?pt="Save dashboard copy":Z&&(pt="Provisioned dashboard"),t.createElement(s._,{title:pt,onClose:Xe,subtitle:Ke.title,tabs:t.createElement(r.U,null,t.createElement(g.o,{label:"Details",active:!_e,onChangeTab:()=>ze(!1)}),Ue.hasChanges&&t.createElement(g.o,{label:"Changes",active:_e,onChangeTab:()=>ze(!0),counter:Ue.diffCount}))},nt(),o.$.featureToggles.showDashboardValidationWarnings&&t.createElement(m,{dashboard:Ke}))}},35280:(Q,A,e)=>{"use strict";e.d(A,{D:()=>h});var t=e(96540),n=e(94701),o=e(14110),s=e(88575),r=e(15292),g=e(21744),u=e(37390),c=e(10534),i=e(44836),l=e(7758),f=e(87895),d=e(22699);function h({panel:p,dashboard:m,range:a,buildIframe:v=d.CF}){const[E,D]=(0,t.useState)(!0),[b,C]=(0,t.useState)("current"),[y,M]=(0,t.useState)("");(0,n.A)(()=>{(0,o.rR)("grafana_dashboards_embed_share_viewed")}),(0,t.useEffect)(()=>{const P=v(E,m.uid,b,p,a);M(P)},[b,E,m,p,a,v]);const T=P=>{M(P.currentTarget.value)},I=()=>{D(P=>!P)},x=P=>{C(P)},O=m.time.to==="now"?(0,i.t)("share-modal.embed.time-range-description","Transforms the current relative time range to an absolute time range"):"";return t.createElement(t.Fragment,null,t.createElement("p",{className:"share-modal-info-text"},t.createElement(i.x6,{i18nKey:"share-modal.embed.info"},"Generate HTML for embedding an iframe with this panel.")),t.createElement(s.D,{label:(0,i.t)("share-modal.embed.time-range","Current time range"),description:O},t.createElement(r.d,{id:"share-current-time-range",value:E,onChange:I})),t.createElement(f.w,{selectedTheme:b,onChange:x}),t.createElement(s.D,{label:(0,i.t)("share-modal.embed.html","Embed HTML"),description:(0,i.t)("share-modal.embed.html-description","The HTML code below can be pasted and included in another web page. Unless anonymous access is enabled, the user viewing that page need to be signed into Grafana for the graph to load.")},t.createElement(g.f,{"data-testid":"share-embed-html",id:"share-panel-embed-embed-html-textarea",rows:5,value:y,onChange:T})),t.createElement(u.a.ButtonRow,null,t.createElement(c.b,{icon:"copy",variant:"primary",getText:()=>y,onClipboardCopy:()=>{l.c.embedSnippetCopy({currentTimeRange:E,theme:b})}},t.createElement(i.x6,{i18nKey:"share-modal.embed.copy"},"Copy to clipboard"))))}},86394:(Q,A,e)=>{"use strict";e.d(A,{j:()=>r});var t=e(96540),n=e(14110),o=e(44836),s=e(96227);const r=({panel:g,initialFolderUid:u,onDismiss:c})=>((0,t.useEffect)(()=>{(0,n.rR)("grafana_dashboards_library_panel_share_viewed")},[]),g?t.createElement(t.Fragment,null,t.createElement("p",{className:"share-modal-info-text"},t.createElement(o.x6,{i18nKey:"share-modal.library.info"},"Create library panel.")),t.createElement(s.b,{panel:g,initialFolderUid:u,onDismiss:c})):null)},7686:(Q,A,e)=>{"use strict";e.d(A,{Zy:()=>te});var t=e(96540),n=e(25897),o=e(37390),s=e(40980),r=e(40845),g=e(2913),u=e(10096),c=e(44836),i=e(4785),l=e(72254),f=e(7758),d=e(82792),h=e(35280),p=e(4213),m=e(88575),a=e(15292),v=e(55852),E=e(15858),D=e(28444),b=e(70713),C=e(32372),y=e(10534);function M({json:oe,onDismiss:ue}){const ie=(0,t.useCallback)(()=>oe,[oe]);return t.createElement(o.a,{title:"JSON",onDismiss:ue,onClickBackdrop:ue,isOpen:!0},t.createElement(b.Ay,{disableHeight:!0},({width:ge})=>t.createElement(C.B,{value:oe,language:"json",showMiniMap:!1,height:"500px",width:ge})),t.createElement(o.a.ButtonRow,null,t.createElement(y.b,{icon:"copy",getText:ie,onClipboardCopy:()=>{f.c.exportCopyJsonClicked()}},t.createElement(c.x6,{i18nKey:"share-modal.view-json.copy-button"},"Copy to Clipboard"))))}class T extends t.PureComponent{constructor(ue){super(ue),this.onShareExternallyChange=()=>{this.setState({shareExternally:!this.state.shareExternally})},this.onSaveAsFile=()=>{const{dashboard:ie}=this.props,{shareExternally:ge}=this.state;f.c.exportSaveJsonClicked({externally:ge}),ge?this.exporter.makeExportable(ie).then(he=>{this.openSaveAsDialog(he)}):this.openSaveAsDialog(ie.getSaveModelClone())},this.onViewJson=()=>{const{dashboard:ie}=this.props,{shareExternally:ge}=this.state;f.c.exportViewJsonClicked({externally:ge}),ge?this.exporter.makeExportable(ie).then(he=>{this.openJsonModal(he)}):this.openJsonModal(ie.getSaveModelClone())},this.openSaveAsDialog=ie=>{const ge=JSON.stringify(ie,null,2),he=new Blob([ge],{type:"application/json;charset=utf-8"}),De=new Date().getTime();(0,p.saveAs)(he,`${ie.title}-${De}.json`)},this.openJsonModal=ie=>{u.lE.publish(new D.S8({props:{json:JSON.stringify(ie,null,2)},component:M})),this.props.onDismiss?.()},this.state={shareExternally:!1},this.exporter=new E.M}render(){const{onDismiss:ue}=this.props,{shareExternally:ie}=this.state,ge=(0,c.t)("share-modal.export.share-externally-label","Export for sharing externally");return t.createElement(t.Fragment,null,t.createElement("p",{className:"share-modal-info-text"},t.createElement(c.x6,{i18nKey:"share-modal.export.info-text"},"Export this dashboard.")),t.createElement(m.D,{label:ge},t.createElement(a.d,{id:"share-externally-toggle",value:ie,onChange:this.onShareExternallyChange})),t.createElement(o.a.ButtonRow,null,t.createElement(v.$n,{variant:"secondary",onClick:ue,fill:"outline"},t.createElement(c.x6,{i18nKey:"share-modal.export.cancel-button"},"Cancel")),t.createElement(v.$n,{variant:"secondary",onClick:this.onViewJson},t.createElement(c.x6,{i18nKey:"share-modal.export.view-button"},"View JSON")),t.createElement(v.$n,{variant:"primary",onClick:this.onSaveAsFile},t.createElement(c.x6,{i18nKey:"share-modal.export.save-button"},"Save to file"))))}}var I=e(86394),x=e(13544),S=e(84167),O=e(10354),P=e(72109),L=e(42418),U=e(87895),R=e(22699);class B extends t.PureComponent{constructor(ue){super(ue),this.buildUrl=async()=>{const{panel:ie,dashboard:ge}=this.props,{useCurrentTimeRange:he,useShortUrl:De,selectedTheme:pe}=this.state,le=await(0,R.Xe)(he,pe,ie,De),Te=(0,R.Lb)(he,ge.uid,pe,ie);this.setState({shareUrl:le,imageUrl:Te})},this.onUseCurrentTimeRangeChange=()=>{this.setState({useCurrentTimeRange:!this.state.useCurrentTimeRange})},this.onUrlShorten=()=>{this.setState({useShortUrl:!this.state.useShortUrl})},this.onThemeChange=ie=>{this.setState({selectedTheme:ie})},this.getShareUrl=()=>this.state.shareUrl,this.state={useCurrentTimeRange:!0,useShortUrl:!1,selectedTheme:"current",shareUrl:"",imageUrl:""},this.onCopy=this.onCopy.bind(this)}componentDidMount(){this.buildUrl()}componentDidUpdate(ue,ie){const{useCurrentTimeRange:ge,useShortUrl:he,selectedTheme:De}=this.state;(ie.useCurrentTimeRange!==ge||ie.selectedTheme!==De||ie.useShortUrl!==he)&&this.buildUrl()}onCopy(){f.c.shareLinkCopied({currentTimeRange:this.state.useCurrentTimeRange,theme:this.state.selectedTheme,shortenURL:this.state.useShortUrl})}render(){const{panel:ue,dashboard:ie}=this.props,ge=ie?ie.time.to==="now":!1,{useCurrentTimeRange:he,useShortUrl:De,selectedTheme:pe,shareUrl:le,imageUrl:Te}=this.state,Ee=x.Tp.pages.SharePanelModal,Re=!!ie.id,me=(0,c.t)("share-modal.link.time-range-label","Lock time range"),Me=(0,c.t)("share-modal.link.time-range-description","Transforms the current relative time range to an absolute time range"),ye=(0,c.t)("share-modal.link.shorten-url","Shorten URL"),Le=(0,c.t)("share-modal.link.link-url","Link URL");return t.createElement(t.Fragment,null,t.createElement("p",{className:"share-modal-info-text"},t.createElement(c.x6,{i18nKey:"share-modal.link.info-text"},"Create a direct link to this dashboard or panel, customized with the options below.")),t.createElement(S.n,null,t.createElement(m.D,{label:me,description:ge?Me:""},t.createElement(a.d,{id:"share-current-time-range",value:he,onChange:this.onUseCurrentTimeRangeChange})),t.createElement(U.w,{selectedTheme:pe,onChange:this.onThemeChange}),t.createElement(m.D,{label:ye},t.createElement(a.d,{id:"share-shorten-url",value:De,onChange:this.onUrlShorten})),t.createElement(m.D,{label:Le},t.createElement(O.p,{id:"link-url-input",value:le,readOnly:!0,addonAfter:t.createElement(y.b,{icon:"copy",variant:"primary",getText:this.getShareUrl,onClipboardCopy:this.onCopy},t.createElement(c.x6,{i18nKey:"share-modal.link.copy-link-button"},"Copy"))}))),ue&&g.Ay.rendererAvailable&&t.createElement(t.Fragment,null,Re&&t.createElement(P.Y,{href:Te,external:!0,icon:"camera","aria-label":Ee.linkToRenderedImage},(0,c.t)("share-modal.link.rendered-image","Direct link rendered image")),!Re&&t.createElement(L.F,{severity:"info",title:(0,c.t)("share-modal.link.save-alert","Dashboard is not saved"),bottomSpacing:0},t.createElement(c.x6,{i18nKey:"share-modal.link.save-dashboard"},"To render a panel image, you must save the dashboard first."))),ue&&!g.Ay.rendererAvailable&&t.createElement(L.F,{severity:"info",title:(0,c.t)("share-modal.link.render-alert","Image renderer plugin not installed"),bottomSpacing:0},t.createElement(c.x6,{i18nKey:"share-modal.link.render-instructions"},"To render a panel image, you must install the",t.createElement(P.Y,{href:"https://grafana.com/grafana/plugins/grafana-image-renderer",external:!0},"Grafana image renderer plugin"),". Please contact your Grafana administrator to install the plugin.")))}}var H=e(92041),w=e(17172),N=e(88323),V=e(62930),G=e(74856),_=e(80484),K=e(69064);class j extends t.PureComponent{constructor(ue){super(ue),this.createSnapshot=ie=>()=>{const{timeoutSeconds:ge}=this.state;this.dashboard.snapshot={timestamp:new Date},this.setState({isLoading:!0}),this.dashboard.startRefresh(),setTimeout(()=>{this.saveSnapshot(this.dashboard,ie)},ge*1e3)},this.saveSnapshot=async(ie,ge)=>{const{snapshotExpires:he,timeoutSeconds:De}=this.state,pe=this.dashboard.getSaveModelCloneOld();this.scrubDashboard(pe);const le={dashboard:pe,name:pe.title,expires:he,external:ge};try{const Te=await(0,K.s)().create(le);this.setState({deleteUrl:Te.deleteUrl,snapshotUrl:Te.url,step:2})}finally{ge?f.c.publishSnapshotClicked({expires:he,timeout:De}):f.c.publishSnapshotLocalClicked({expires:he,timeout:De}),this.setState({isLoading:!1})}},this.scrubDashboard=ie=>{const{panel:ge}=this.props,{snapshotName:he}=this.state;ie.title=he,ie.time=(0,G.jG)().timeRange(),ie.links=[],ie.panels.forEach(pe=>{pe.targets=[],pe.links=[],pe.datasource=null});const De=ie.annotations.list.filter(pe=>pe.enable);if(ie.annotations.list=De.map(pe=>({name:pe.name,enable:pe.enable,iconColor:pe.iconColor,snapshotData:pe.snapshotData,type:pe.type,builtIn:pe.builtIn,hide:pe.hide})),ie.getVariables().forEach(pe=>{"query"in pe&&(pe.query=""),"options"in pe&&(pe.options=pe.current&&!(0,H.R)(pe.current)?[pe.current]:[]),"refresh"in pe&&(pe.refresh=_.CO.never)}),ge){const pe=ge.getSaveModel();pe.gridPos.w=24,pe.gridPos.x=0,pe.gridPos.y=0,pe.gridPos.h=20,ie.panels=[pe]}delete this.dashboard.snapshot,this.dashboard.forEachPanel(pe=>{delete pe.snapshotData}),this.dashboard.annotations.list.forEach(pe=>{delete pe.snapshotData})},this.deleteSnapshot=async()=>{const{deleteUrl:ie}=this.state;await(0,w.AI)().get(ie),this.setState({step:3})},this.getSnapshotUrl=()=>this.state.snapshotUrl,this.onSnapshotNameChange=ie=>{this.setState({snapshotName:ie.target.value})},this.onTimeoutChange=ie=>{this.setState({timeoutSeconds:Number(ie.target.value)})},this.onExpireChange=ie=>{this.setState({selectedExpireOption:ie,snapshotExpires:ie.value})},this.dashboard=ue.dashboard,this.expireOptions=[{label:(0,c.t)("share-modal.snapshot.expire-never","Never"),value:0},{label:(0,c.t)("share-modal.snapshot.expire-hour","1 Hour"),value:60*60},{label:(0,c.t)("share-modal.snapshot.expire-day","1 Day"),value:60*60*24},{label:(0,c.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:ue.dashboard.title,timeoutSeconds:4,snapshotUrl:"",deleteUrl:"",externalEnabled:!1,sharingButtonText:""}}componentDidMount(){this.getSnaphotShareOptions()}async getSnaphotShareOptions(){const ue=await(0,K.s)().getSharingOptions();this.setState({sharingButtonText:ue.externalSnapshotName,externalEnabled:ue.externalEnabled})}renderStep1(){const{onDismiss:ue}=this.props,{snapshotName:ie,selectedExpireOption:ge,timeoutSeconds:he,isLoading:De,sharingButtonText:pe,externalEnabled:le}=this.state,Te=(0,c.t)("share-modal.snapshot.name","Snapshot name"),Ee=(0,c.t)("share-modal.snapshot.expire","Expire"),Re=(0,c.t)("share-modal.snapshot.timeout","Timeout (seconds)"),me=(0,c.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 t.createElement(t.Fragment,null,t.createElement("div",null,t.createElement("p",{className:"share-modal-info-text"},t.createElement(c.x6,{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.")),t.createElement("p",{className:"share-modal-info-text"},t.createElement(c.x6,{i18nKey:"share-modal.snapshot.info-text-2"},"Keep in mind, your snapshot ",t.createElement("em",null,"can be viewed by anyone")," that has the link and can access the URL. Share wisely."))),t.createElement(m.D,{label:Te},t.createElement(O.p,{id:"snapshot-name-input",width:30,value:ie,onChange:this.onSnapshotNameChange})),t.createElement(m.D,{label:Ee},t.createElement(N.l6,{inputId:"expire-select-input",width:30,options:this.expireOptions,value:ge,onChange:this.onExpireChange})),t.createElement(m.D,{label:Re,description:me},t.createElement(O.p,{id:"timeout-input",type:"number",width:21,value:he,onChange:this.onTimeoutChange})),t.createElement(o.a.ButtonRow,null,t.createElement(v.$n,{variant:"secondary",onClick:ue,fill:"outline"},t.createElement(c.x6,{i18nKey:"share-modal.snapshot.cancel-button"},"Cancel")),le&&t.createElement(v.$n,{variant:"secondary",disabled:De,onClick:this.createSnapshot(!0)},pe),t.createElement(v.$n,{variant:"primary",disabled:De,onClick:this.createSnapshot()},t.createElement(c.x6,{i18nKey:"share-modal.snapshot.local-button"},"Local Snapshot"))))}renderStep2(){const{snapshotUrl:ue}=this.state;return t.createElement(t.Fragment,null,t.createElement(m.D,{label:(0,c.t)("share-modal.snapshot.url-label","Snapshot URL")},t.createElement(O.p,{id:"snapshot-url-input",value:ue,readOnly:!0,addonAfter:t.createElement(y.b,{icon:"copy",variant:"primary",getText:this.getSnapshotUrl},t.createElement(c.x6,{i18nKey:"share-modal.snapshot.copy-link-button"},"Copy"))})),t.createElement("div",{className:"pull-right",style:{padding:"5px"}},t.createElement(c.x6,{i18nKey:"share-modal.snapshot.mistake-message"},"Did you make a mistake? "),"\xA0",t.createElement(v.z9,{fill:"text",target:"_blank",onClick:this.deleteSnapshot},t.createElement(c.x6,{i18nKey:"share-modal.snapshot.delete-button"},"Delete snapshot."))))}renderStep3(){return t.createElement("div",{className:"share-modal-header"},t.createElement("p",{className:"share-modal-info-text"},t.createElement(c.x6,{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:ue,step:ie}=this.state;return t.createElement(t.Fragment,null,ie===1&&this.renderStep1(),ie===2&&this.renderStep2(),ie===3&&this.renderStep3(),ue&&t.createElement(V.y,{inline:!0}))}}const k=[],Y=[];function ee(oe){k.push(oe)}function re(oe){Y.push(oe)}function J(oe,ue){const ge=[{label:(0,c.t)("share-modal.tab-title.link","Link"),value:R.wr.link,component:B}];if(u.TP.isSignedIn&&g.$W.snapshotEnabled){const De=(0,c.t)("share-modal.tab-title.snapshot","Snapshot");ge.push({label:De,value:R.wr.snapshot,component:j})}if(oe){const De=(0,c.t)("share-modal.tab-title.embed","Embed");if(ge.push({label:De,value:R.wr.embed,component:h.D}),!(0,d.X)(oe)){const pe=(0,c.t)("share-modal.tab-title.library-panel","Library panel");ge.push({label:pe,value:R.wr.libraryPanel,component:I.j})}ge.push(...Y)}else{const De=(0,c.t)("share-modal.tab-title.export","Export");ge.push({label:De,value:R.wr.export,component:T}),ge.push(...k)}(0,l.iR)()&&ge.push({label:(0,c.t)("share-modal.tab-title.public-dashboard-title","Public dashboard"),value:R.wr.publicDashboard,component:i.b});const he=ge.find(De=>De.value===ue);return{tabs:ge,activeTab:he?.value??ge[0].value}}function ne(oe){const{tabs:ue,activeTab:ie}=J(oe.panel,oe.activeTab);return{tabs:ue,activeTab:ie}}class q extends t.Component{constructor(ue){super(ue),this.onSelectTab=ie=>{this.setState(ge=>({...ge,activeTab:ie.value})),f.c.sharingTabChanged({item:ie.value})},this.state=ne(ue)}getActiveTab(){const{tabs:ue,activeTab:ie}=this.state;return ue.find(ge=>ge.value===ie)}renderTitle(){const{panel:ue}=this.props,{activeTab:ie}=this.state,ge=ue?(0,c.t)("share-modal.panel.title","Share Panel"):(0,c.t)("share-modal.dashboard.title","Share"),he=J(this.props.panel,this.state.activeTab).tabs;return t.createElement(n.J,{title:ge,icon:"share-alt",tabs:he,activeTab:ie,onChangeTab:this.onSelectTab})}render(){const{dashboard:ue,panel:ie}=this.props,he=this.getActiveTab().component;return t.createElement(o.a,{isOpen:!0,title:this.renderTitle(),onDismiss:this.props.onDismiss},t.createElement(s.J,null,t.createElement(he,{dashboard:ue,panel:ie,onDismiss:this.props.onDismiss})))}}const te=(0,r.cV)(q)},59037:(Q,A,e)=>{"use strict";e.d(A,{K:()=>pe,b:()=>De});var t=e(32196),n=e(96540),o=e(49785),s=e(13544),r=e(32264),g=e(33378),u=e(40845),c=e(88575),i=e(10354),l=e(10534),f=e(15292),d=e(60029),h=e(66864),p=e(55852),m=e(71678),a=e(44836),v=e(72686),E=e(21380),D=e(7758),b=e(90591),C=e(16233),y=e(80348),M=e(52908);const T=()=>{const{width:Te}=(0,M.A)();return Te>1024};var I=e(7686),x=e(22699),S=e(29304),O=e(42418);const P=()=>n.createElement(O.F,{title:(0,a.t)("public-dashboard.modal-alerts.save-dashboard-changes-alert-title","Please save your dashboard changes before updating the public configuration"),severity:"warning",bottomSpacing:0});var L=e(12257),U=e(10872),R=e(72254),B=e(84167),H=e(54230);const w=s.Tp.pages.ShareDashboardModal.PublicDashboard,N=({disabled:Te,onChange:Ee,register:Re,timeRange:me})=>n.createElement(n.Fragment,null,n.createElement(B.n,{disabled:Te},n.createElement(h.gW,{spacing:"md"},n.createElement(h.PE,{orientation:1,spacing:"xs",justify:"space-between"},n.createElement(d.J,{description:(0,a.t)("public-dashboard.settings-configuration.default-time-range-label-desc","The public dashboard uses the default time range settings of the dashboard")},n.createElement(a.x6,{i18nKey:"public-dashboard.settings-configuration.default-time-range-label"},"Default time range")),n.createElement(H.b,{value:me,disabled:!0,onChange:()=>{}})),n.createElement(h.PE,{orientation:0,spacing:"sm"},n.createElement(f.d,{...Re("isTimeSelectionEnabled"),"data-testid":w.EnableTimeRangeSwitch,onChange:Me=>{Ee("isTimeSelectionEnabled",Me.currentTarget.checked),D.c.publicDashboardTimeSelectionChanged({enabled:Me.currentTarget.checked})}}),n.createElement(d.J,{description:(0,a.t)("public-dashboard.settings-configuration.time-range-picker-label-desc","Allow viewers to change time range")},n.createElement(a.x6,{i18nKey:"public-dashboard.settings-configuration.time-range-picker-label"},"Time range picker enabled"))),n.createElement(h.PE,{orientation:0,spacing:"sm"},n.createElement(f.d,{...Re("isAnnotationsEnabled"),onChange:Me=>{Ee("isAnnotationsEnabled",Me.currentTarget.checked),D.c.publicDashboardAnnotationsSelectionChanged({enabled:Me.currentTarget.checked})},"data-testid":w.EnableAnnotationsSwitch}),n.createElement(d.J,{description:(0,a.t)("public-dashboard.settings-configuration.show-annotations-label-desc","Show annotations on public dashboard")},n.createElement(a.x6,{i18nKey:"public-dashboard.settings-configuration.show-annotations-label"},"Show annotations"))))));var V=e(19727),G=e(16504),_=e(94354),K=e(62930);const j=s.Tp.pages.ShareDashboardModal.PublicDashboard.EmailSharingConfiguration,k=({recipients:Te,dashboardUid:Ee,publicDashboardUid:Re})=>{const me=(0,u.of)(ee),[Me,{isLoading:ye}]=(0,v.$L)(),[Le,{isLoading:We}]=(0,v.NA)(),Be=ye||We,Ye=(st,Ke)=>{D.c.revokePublicDashboardEmailClicked(),Me({recipientUid:st,recipientEmail:Ke,dashboardUid:Ee,uid:Re})},at=st=>{D.c.resendPublicDashboardEmailClicked(),Le({recipientUid:st,uid:Re})};return n.createElement("table",{className:me.table,"data-testid":j.EmailSharingList},n.createElement("tbody",null,Te.map((st,Ke)=>n.createElement("tr",{key:st.uid},n.createElement("td",null,st.recipient),n.createElement("td",null,n.createElement(V.e,{className:me.tableButtonsContainer},n.createElement(p.$n,{type:"button",variant:"destructive",fill:"text",title:(0,a.t)("public-dashboard.email-sharing.revoke-button-title","Revoke"),size:"sm",disabled:Be,onClick:()=>Ye(st.uid,st.recipient),"data-testid":`${j.DeleteEmail}-${Ke}`},n.createElement(a.x6,{i18nKey:"public-dashboard.email-sharing.revoke-button"},"Revoke")),n.createElement(p.$n,{type:"button",variant:"primary",fill:"text",title:(0,a.t)("public-dashboard.email-sharing.resend-button-title","Resend"),size:"sm",disabled:Be,onClick:()=>at(st.uid),"data-testid":`${j.ReshareLink}-${Ke}`},n.createElement(a.x6,{i18nKey:"public-dashboard.email-sharing.resend-button"},"Resend"))))))))},Y=()=>{const{width:Te}=(0,M.A)(),Ee=(0,u.of)(ee),me=(0,y.useSelector)(be=>be.dashboard).getModel(),{data:Me}=(0,v.Bs)(me.uid),[ye]=(0,v.T2)(),[Le,{isLoading:We}]=(0,v.NY)(),Be=C.TP.hasPermission(y.AccessControlAction.DashboardsPublicWrite),{register:Ye,setValue:at,control:st,watch:Ke,handleSubmit:Xe,formState:{errors:He},reset:Ge}=(0,o.mN)({defaultValues:{shareType:Me?.share||R.Xo.PUBLIC,email:""},mode:"onSubmit"}),xe=be=>{const Z={dashboard:me,payload:{...Me,share:be}};ye(Z)},$e=async be=>{D.c.publicDashboardEmailInviteClicked(),await Le({recipient:be.email,uid:Me.uid,dashboardUid:me.uid}).unwrap(),Ge({email:"",shareType:R.Xo.EMAIL})};return n.createElement("form",{onSubmit:Xe($e)},n.createElement(B.n,{disabled:!Be,"data-testid":j.Container,className:Ee.container},n.createElement(c.D,{label:(0,a.t)("public-dashboard.config.can-view-dashboard-radio-button-label","Can view dashboard"),className:Ee.field},n.createElement(G.e,{name:"shareType",control:st,render:({field:be})=>{const{ref:Z,...ae}=be,de=[{label:(0,a.t)("public-dashboard.config.public-share-type-option-label","Anyone with a link"),value:R.Xo.PUBLIC},{label:(0,a.t)("public-dashboard.config.email-share-type-option-label","Only specified people"),value:R.Xo.EMAIL}];return n.createElement(_.z,{...ae,size:Te<480?"sm":"md",options:de,onChange:ve=>{D.c.publicDashboardShareTypeChange({shareType:ve===R.Xo.EMAIL?"email":"public"}),at("shareType",ve),xe(ve)}})}})),Ke("shareType")===R.Xo.EMAIL&&n.createElement(n.Fragment,null,n.createElement(c.D,{label:(0,a.t)("public-dashboard.email-sharing.invite-field-label","Invite"),description:(0,a.t)("public-dashboard.email-sharing.invite-field-desc","Invite people by email"),error:He.email?.message,invalid:!!He.email?.message||void 0,className:Ee.field},n.createElement("div",{className:Ee.emailContainer},n.createElement(i.p,{className:Ee.emailInput,placeholder:"email",autoCapitalize:"none",...Ye("email",{required:(0,a.t)("public-dashboard.email-sharing.input-required-email-text","Email is required"),pattern:{value:R._l,message:(0,a.t)("public-dashboard.email-sharing.input-invalid-email-text","Invalid email")}}),"data-testid":j.EmailSharingInput}),n.createElement(p.$n,{type:"submit",variant:"primary",disabled:We,"data-testid":j.EmailSharingInviteButton},n.createElement(a.x6,{i18nKey:"public-dashboard.email-sharing.invite-button"},"Invite"),We&&n.createElement(K.y,null)))),!!Me?.recipients?.length&&n.createElement(k,{recipients:Me.recipients,dashboardUid:me.uid,publicDashboardUid:Me.uid}))))},ee=Te=>({container:(0,t.css)` label: emailConfigContainer; display: flex; flex-direction: column; flex-wrap: wrap; gap: ${Te.spacing(3)}; `,field:(0,t.css)` label: field-noMargin; margin-bottom: 0; `,emailContainer:(0,t.css)` label: emailContainer; display: flex; gap: ${Te.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: ${Te.spacing(.5,1)}; :nth-child(odd) { background: ${Te.colors.background.secondary}; } } `,tableButtonsContainer:(0,t.css)` display: flex; justify-content: end; `});var re=e(67892),J=e(29158);function ne({headerElement:Te,isContentVisible:Ee=!1,onRowToggle:Re,title:me,...Me}){const ye=(0,u.of)(q),Le=Te&&re.renderOrCallToRender(Te,{className:ye.summaryWrapper});return n.createElement("div",{className:ye.wrapper},n.createElement("div",{className:ye.header},n.createElement(J.K,{name:Ee?"angle-down":"angle-right",tooltip:Ee?(0,a.t)("public-dashboard.settings-bar-header.collapse-settings-tooltip","Collapse settings"):(0,a.t)("public-dashboard.settings-bar-header.expand-settings-tooltip","Expand settings"),className:ye.collapseIcon,onClick:Re,"aria-expanded":Ee,...Me}),me&&n.createElement("div",{className:ye.titleWrapper,onClick:Re},n.createElement("span",{className:ye.title},me)),Le))}ne.displayName="SettingsBarHeader";function q(Te){return{wrapper:(0,t.css)({label:"header",padding:Te.spacing(.5,.5),borderRadius:Te.shape.radius.default,background:Te.colors.background.secondary,minHeight:Te.spacing(4),"&:focus":{outline:"none"}}),header:(0,t.css)({label:"column",display:"flex",alignItems:"center",whiteSpace:"nowrap"}),collapseIcon:(0,t.css)({marginLeft:Te.spacing(.5),color:Te.colors.text.disabled}),titleWrapper:(0,t.css)({display:"flex",alignItems:"center",cursor:"pointer",overflow:"hidden",marginRight:`${Te.spacing(.5)}`,[Te.breakpoints.down("sm")]:{flex:"1 1"}}),title:(0,t.css)({fontWeight:Te.typography.fontWeightBold,marginLeft:Te.spacing(.5),overflow:"hidden",textOverflow:"ellipsis"}),summaryWrapper:(0,t.css)({display:"flex",flexWrap:"wrap",[Te.breakpoints.down("sm")]:{flex:"2 2"}})}}function te({children:Te,title:Ee,headerElement:Re,...me}){const Me=(0,u.of)(oe),[ye,Le]=(0,n.useState)(!1);function We(){Le(Be=>!Be)}return n.createElement(n.Fragment,null,n.createElement(ne,{onRowToggle:We,isContentVisible:ye,title:Ee,headerElement:Re,...me}),ye&&n.createElement("div",{className:Me.content},Te))}te.displayName="SettingsBar";const oe=Te=>({content:(0,t.css)({marginTop:Te.spacing(1),marginLeft:Te.spacing(4)})});var ue=e(3799);function ie({className:Te,isDataLoading:Ee=!1,timeRange:Re,timeSelectionEnabled:me,annotationsEnabled:Me}){const ye=(0,u.of)(ge),Le=(0,a.t)("public-dashboard.settings-summary.time-range-picker-enabled-text","Time range picker = enabled"),We=(0,a.t)("public-dashboard.settings-summary.time-range-picker-disabled-text","Time range picker = disabled"),Be=(0,a.t)("public-dashboard.settings-summary.annotations-show-text","Annotations = show"),Ye=(0,a.t)("public-dashboard.settings-summary.annotations-hide-text","Annotations = hide");return Ee?n.createElement("div",{className:(0,t.cx)(ye.summaryWrapper,Te)},n.createElement(K.y,{className:ye.summary,inline:!0,size:"sm"})):n.createElement("div",{className:(0,t.cx)(ye.summaryWrapper,Te)},n.createElement("span",{className:ye.summary},n.createElement(a.x6,{i18nKey:"public-dashboard.settings-summary.time-range-text"},"Time range = "),n.createElement(ue.f,{className:ye.timeRange,value:Re})),n.createElement("span",{className:ye.summary},me?Le:We),n.createElement("span",{className:ye.summary},Me?Be:Ye))}ie.displayName="SettingsSummary";const ge=Te=>({summaryWrapper:(0,t.css)({display:"flex"}),summary:(0,t.css)` label: collapsedText; margin-left: ${Te.spacing.gridSize*2}px; font-size: ${Te.typography.bodySmall.fontSize}; color: ${Te.colors.text.secondary}; `,timeRange:(0,t.css)({display:"inline-block"})}),he=s.Tp.pages.ShareDashboardModal.PublicDashboard;function De({onRevoke:Te,timeRange:Ee,hasTemplateVariables:Re=!1,showSaveChangesAlert:me=!1,unsupportedDatasources:Me=[],publicDashboard:ye,dashboard:Le}){const We=(0,u.of)(le),Be=T(),[Ye,{isLoading:at}]=(0,v.T2)(),st=C.TP.hasPermission(y.AccessControlAction.DashboardsPublicWrite),Ke=!st||at,Xe=!!r.$.featureToggles.publicDashboardsEmailSharing&&(0,g.a)("publicDashboardsEmailSharing"),{handleSubmit:He,setValue:Ge,register:xe}=(0,o.mN)({defaultValues:{isAnnotationsEnabled:ye?.annotationsEnabled,isTimeSelectionEnabled:ye?.timeSelectionEnabled,isPaused:!ye?.isEnabled}}),$e=async ae=>{const{isAnnotationsEnabled:de,isTimeSelectionEnabled:ve,isPaused:Ue}=ae;Ye({dashboard:Le,payload:{...ye,annotationsEnabled:de,timeSelectionEnabled:ve,isEnabled:!Ue}})},be=async(ae,de)=>{Ge(ae,de),await He(ve=>$e(ve))()};function Z(){D.c.publicDashboardUrlCopied()}return n.createElement("div",{className:We.configContainer},me&&n.createElement(P,null),!st&&n.createElement(S.t,{mode:"edit"}),Re&&n.createElement(U.D,null),Me.length>0&&n.createElement(L.s,{unsupportedDataSources:Me.join(", ")}),Xe&&n.createElement(Y,null),n.createElement(c.D,{label:(0,a.t)("public-dashboard.config.dashboard-url-field-label","Dashboard URL"),className:We.fieldSpace},n.createElement(i.p,{value:(0,R.mL)(ye.accessToken),readOnly:!0,disabled:!ye?.isEnabled,"data-testid":he.CopyUrlInput,addonAfter:n.createElement(l.b,{"data-testid":he.CopyUrlButton,variant:"primary",disabled:!ye?.isEnabled,getText:()=>(0,R.mL)(ye.accessToken),onClipboardCopy:Z},n.createElement(a.x6,{i18nKey:"public-dashboard.config.copy-button"},"Copy"))})),n.createElement(c.D,{className:We.fieldSpace},n.createElement(h.PE,null,n.createElement(f.d,{...xe("isPaused"),disabled:Ke,onChange:ae=>{D.c.publicDashboardPauseSharingClicked({paused:ae.currentTarget.checked}),be("isPaused",ae.currentTarget.checked)},"data-testid":he.PauseSwitch}),n.createElement(d.J,{className:(0,t.css)` margin-bottom: 0; `},n.createElement(a.x6,{i18nKey:"public-dashboard.config.pause-sharing-dashboard-label"},"Pause sharing dashboard")))),n.createElement(c.D,{className:We.fieldSpace},n.createElement(te,{title:(0,a.t)("public-dashboard.config.settings-title","Settings"),headerElement:({className:ae})=>n.createElement(ie,{className:ae,isDataLoading:at,timeRange:Ee,timeSelectionEnabled:ye?.timeSelectionEnabled,annotationsEnabled:ye?.annotationsEnabled}),"data-testid":he.SettingsDropdown},n.createElement(N,{disabled:Ke,onChange:be,register:xe,timeRange:Ee}))),n.createElement(h.PE,{orientation:Be?0:1,justify:Be?"flex-end":"flex-start",align:Be?"center":"normal"},n.createElement(h.Gy,{justify:"flex-end"},n.createElement(p.$n,{title:(0,a.t)("public-dashboard.config.revoke-public-URL-button-title","Revoke public URL"),onClick:Te,type:"button",disabled:Ke,"data-testid":he.DeleteButton,variant:"destructive",fill:"outline"},n.createElement(a.x6,{i18nKey:"public-dashboard.config.revoke-public-URL-button"},"Revoke public URL")))))}function pe({publicDashboard:Te,unsupportedDatasources:Ee}){const me=(0,y.useSelector)(Ye=>Ye.dashboard).getModel(),Me=(0,E.z)(me.getDefaultTime(),me),ye=C.TP.hasPermission(y.AccessControlAction.DashboardsPublicWrite),Le=(0,R.kD)(me.getVariables()),[We]=(0,v.bN)(),Be=Ye=>{We({dashboard:me,uid:Te.uid,dashboardUid:me.uid}),Ye()};return n.createElement(m.$s,null,({showModal:Ye,hideModal:at})=>n.createElement(De,{publicDashboard:Te,dashboard:me,unsupportedDatasources:Ee,timeRange:Me,showSaveChangesAlert:ye&&me.hasUnsavedChanges(),hasTemplateVariables:Le,onRevoke:()=>{D.c.revokePublicDashboardClicked(),Ye(b.m,{dashboardTitle:me.title,onConfirm:()=>Be(at),onDismiss:()=>{Ye(I.Zy,{dashboard:me,onDismiss:at,activeTab:x.wr.publicDashboard})}})}}))}const le=Te=>({configContainer:(0,t.css)` label: config container; display: flex; flex-direction: column; flex-wrap: wrap; gap: ${Te.spacing(3)}; `,fieldSpace:(0,t.css)` label: field space; width: 100%; margin-bottom: 0; `,timeRange:(0,t.css)({display:"inline-block"})})},22234:(Q,A,e)=>{"use strict";e.d(A,{M:()=>x,D:()=>I});var t=e(32196),n=e(96540),o=e(13544),s=e(40845),r=e(51253),g=e(55852),u=e(62930),c=e(44836),i=e(72686),l=e(7758),f=e(16233),d=e(80348),h=e(29304),p=e(12257),m=e(10872),a=e(72254),v=e(71415),E=e(84167),D=e(66864),b=e(10880);const C=o.Tp.pages.ShareDashboardModal.PublicDashboard,y=({disabled:O,register:P})=>{const L=(0,s.of)(M),U=[{type:"publicAcknowledgment",description:(0,c.t)("public-dashboard.acknowledgment-checkboxes.public-ack-desc","Your entire dashboard will be public*"),testId:C.WillBePublicCheckbox,info:{href:"https://grafana.com/docs/grafana/latest/dashboards/dashboard-public/",tooltip:(0,c.t)("public-dashboard.acknowledgment-checkboxes.public-ack-tooltip","Learn more about public dashboards")}},{type:"dataSourcesAcknowledgment",description:(0,c.t)("public-dashboard.acknowledgment-checkboxes.data-src-ack-desc","Publishing currently only works with a subset of data sources*"),testId:C.LimitedDSCheckbox,info:{href:"https://grafana.com/docs/grafana/latest/datasources/",tooltip:(0,c.t)("public-dashboard.acknowledgment-checkboxes.data-src-ack-tooltip","Learn more about public datasources")}},{type:"usageAcknowledgment",description:(0,c.t)("public-dashboard.acknowledgment-checkboxes.usage-ack-desc","Making a dashboard public will cause queries to run each time it is viewed, which may increase costs*"),testId:C.CostIncreaseCheckbox,info:{href:"https://grafana.com/docs/grafana/latest/enterprise/query-caching/",tooltip:(0,c.t)("public-dashboard.acknowledgment-checkboxes.usage-ack-desc-tooltip","Learn more about query caching")}}];return n.createElement(n.Fragment,null,n.createElement("p",{className:L.title},n.createElement(c.x6,{i18nKey:"public-dashboard.acknowledgment-checkboxes.ack-title"},"Before you make the dashboard public, acknowledge the following:")),n.createElement(E.n,{disabled:O},n.createElement(D.gW,{spacing:"md"},U.map(R=>n.createElement(D.Gy,{key:R.type,spacing:"none",align:"center"},n.createElement(b.S,{...P(R.type,{required:!0}),label:R.description,"data-testid":R.testId}),n.createElement(g.z9,{variant:"primary",href:R.info.href,target:"_blank",fill:"text",icon:"info-circle",rel:"noopener noreferrer",tooltip:R.info.tooltip}))))))},M=O=>({title:(0,t.css)` font-weight: ${O.typography.fontWeightBold}; `}),T=o.Tp.pages.ShareDashboardModal.PublicDashboard,I=({unsupportedDatasources:O=[],unsupportedTemplateVariables:P=!1,dashboard:L,hasError:U=!1})=>{const R=(0,s.of)(S),B=f.TP.hasPermission(d.AccessControlAction.DashboardsPublicWrite),[H,{isLoading:w,isError:N}]=(0,i.U9)(),V=()=>{H({dashboard:L,payload:{isEnabled:!0}}),l.c.generatePublicDashboardUrlClicked({})},G=!B||w||N||U;return n.createElement("div",{className:R.container},n.createElement("div",null,n.createElement("p",{className:R.title},n.createElement(c.x6,{i18nKey:"public-dashboard.create-page.welcome-title"},"Welcome to public dashboards!")),n.createElement("p",{className:R.description},n.createElement(c.x6,{i18nKey:"public-dashboard.create-page.unsupported-features-desc"},"Currently, we don\u2019t support template variables or frontend data sources"))),!B&&n.createElement(h.t,{mode:"create"}),P&&n.createElement(m.D,null),O.length>0&&n.createElement(p.s,{unsupportedDataSources:O.join(", ")}),n.createElement(r.l,{onSubmit:V,validateOn:"onChange",maxWidth:"none"},({register:_,formState:{isValid:K}})=>n.createElement(n.Fragment,null,n.createElement("div",{className:R.checkboxes},n.createElement(y,{disabled:G,register:_})),n.createElement("div",{className:R.buttonContainer},n.createElement(g.$n,{type:"submit",disabled:G||!K,"data-testid":T.CreateButton},n.createElement(c.x6,{i18nKey:"public-dashboard.create-page.generate-public-url-button"},"Generate public URL"),w&&n.createElement(u.y,{className:R.loadingSpinner}))))))};function x({hasError:O}){const L=(0,d.useSelector)(B=>B.dashboard).getModel(),{unsupportedDataSources:U}=(0,v.Z)(L),R=(0,a.kD)(L.getVariables());return n.createElement(I,{dashboard:L,unsupportedDatasources:U,unsupportedTemplateVariables:R,hasError:O})}const S=O=>({container:(0,t.css)` display: flex; flex-direction: column; gap: ${O.spacing(4)}; `,title:(0,t.css)` font-size: ${O.typography.h4.fontSize}; margin: ${O.spacing(0,0,2)}; `,description:(0,t.css)` color: ${O.colors.text.secondary}; margin-bottom: ${O.spacing(0)}; `,checkboxes:(0,t.css)` margin: ${O.spacing(0,0,4)}; `,buttonContainer:(0,t.css)` display: flex; justify-content: end; `,loadingSpinner:(0,t.css)` margin-left: ${O.spacing(1)}; `})},29304:(Q,A,e)=>{"use strict";e.d(A,{t:()=>g});var t=e(96540),n=e(13544),o=e(42418),s=e(44836);const r=n.Tp.pages.ShareDashboardModal.PublicDashboard,g=({mode:u})=>t.createElement(o.F,{severity:"info",title:(0,s.t)("public-dashboard.modal-alerts.no-upsert-perm-alert-title","You don\u2019t have permission to {{ mode }} a public dashboard",{mode:u}),"data-testid":r.NoUpsertPermissionsWarningAlert,bottomSpacing:0},t.createElement(s.x6,{i18nKey:"public-dashboard.modal-alerts.no-upsert-perm-alert-desc"},"Contact your admin to get permission to ",{mode:u}," public dashboards"))},12257:(Q,A,e)=>{"use strict";e.d(A,{s:()=>l});var t=e(32196),n=e(46942),o=e.n(n),s=e(96540),r=e(13544),g=e(40845),u=e(42418),c=e(44836);const i=r.Tp.pages.ShareDashboardModal.PublicDashboard,l=({unsupportedDataSources:d})=>{const h=(0,g.of)(f);return s.createElement(u.F,{severity:"warning",title:(0,c.t)("public-dashboard.modal-alerts.unsupported-data-source-alert-title","Unsupported data sources"),"data-testid":i.UnsupportedDataSourcesWarningAlert,bottomSpacing:0},s.createElement("p",{className:h.unsupportedDataSourceDescription},s.createElement(c.x6,{i18nKey:"public-dashboard.modal-alerts.unsupported-data-source-alert-desc"},"There are data sources in this dashboard that are unsupported for public dashboards. Panels that use these data sources may not function properly: ",{unsupportedDataSources:d},".")),s.createElement("a",{href:"https://grafana.com/docs/grafana/next/dashboards/dashboard-public/",className:o()("text-link",h.unsupportedDataSourceDescription)},s.createElement(c.x6,{i18nKey:"public-dashboard.modal-alerts.unsupport-data-source-alert-readmore-link"},"Read more about supported data sources")))},f=d=>({unsupportedDataSourceDescription:(0,t.css)` color: ${d.colors.text.secondary}; margin-bottom: ${d.spacing(1)}; `})},10872:(Q,A,e)=>{"use strict";e.d(A,{D:()=>g});var t=e(96540),n=e(13544),o=e(42418),s=e(44836);const r=n.Tp.pages.ShareDashboardModal.PublicDashboard,g=()=>t.createElement(o.F,{severity:"warning",title:(0,s.t)("public-dashboard.modal-alerts.unsupported-template-variable-alert-title","Template variables are not supported"),"data-testid":r.TemplateVariablesWarningAlert,bottomSpacing:0},t.createElement(s.x6,{i18nKey:"public-dashboard.modal-alerts.unsupported-template-variable-alert-desc"},"This public dashboard may not work since it uses template variables"))},4785:(Q,A,e)=>{"use strict";e.d(A,{a:()=>d,b:()=>h});var t=e(32196),n=e(96540),o=e(40845),s=e(62930),r=e(72686),g=e(72254),u=e(80348),c=e(42930),i=e(59037),l=e(22234),f=e(71415);const d=()=>{const m=(0,o.of)(p);return n.createElement(c.G,{className:m.loadingContainer},n.createElement(n.Fragment,null,"Loading configuration",n.createElement(s.y,{size:"lg",className:m.spinner})))},h=m=>{const{data:a,isLoading:v,isError:E}=(0,r.Bs)(m.dashboard.uid),b=(0,u.useSelector)(y=>y.dashboard).getModel(),{unsupportedDataSources:C}=(0,f.Z)(b);return n.createElement(n.Fragment,null,v?n.createElement(d,null):(0,g.lI)(a)?n.createElement(i.K,{publicDashboard:a,unsupportedDatasources:C}):n.createElement(l.M,{hasError:E}))},p=m=>({loadingContainer:(0,t.css)({height:"280px",alignItems:"center",justifyContent:"center",gap:m.spacing(1)}),spinner:(0,t.css)({marginBottom:m.spacing(0)})})},72254:(Q,A,e)=>{"use strict";e.d(A,{Xo:()=>u,_A:()=>l,_l:()=>h,gN:()=>d,iR:()=>p,kD:()=>c,lI:()=>i,mL:()=>f});var t=e(26657),n=e(32264),o=e(2913),s=e(31193),r=e(22699),g=e(31204),u=(m=>(m.PUBLIC="public",m.EMAIL="email",m))(u||{});const c=m=>m.length>0,i=m=>m?.uid!==""&&m?.uid!==void 0,l=async m=>{let a=new Set;for(const v of m)for(const E of v.targets){const D=E?.datasource?.type;D&&(g.z.has(D)&&await(0,s.tR)().get(E.datasource)instanceof t.iy||a.add(D))}return Array.from(a).sort()},f=m=>`${(0,o.zj)().appUrl}public-dashboards/${m}`,d=(m,a)=>`/d/${m}/${a}?shareView=${r.wr.publicDashboard}`,h=/^[A-Z\d._%+-]+@[A-Z\d.-]+\.[A-Z]{2,}$/i,p=()=>!!n.$.featureToggles.publicDashboards&&n.$.publicDashboardsEnabled},31204:(Q,A,e)=>{"use strict";e.d(A,{z:()=>t});const t=new Set(["__expr__","aggregations-io-datasource","apache-iotdb-datasource","aquaqanalytics-kdbbackend-datasource","axiomhq-axiom-datasource","cloudwatch","cnos-cnosdb-datasource","datasource","dlopes7-appdynamics-datasource","dvelop-odata-datasource","elasticsearch","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-dynatrace-datasource","grafana-es-open-distro-datasource","grafana-falconlogscale-datasource","grafana-github-datasource","grafana-gitlab-datasource","grafana-honeycomb-datasource","grafana-iot-sitewise-datasource","grafana-jira-datasource","grafana-looker-datasource","grafana-mock-datasource","grafana-mongodb-datasource","grafana-newrelic-datasource","grafana-odbc-datasource","grafana-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-sumologic-datasource","grafana-testdata-datasource","grafana-timestream-datasource","grafana-wavefront-datasource","grafana-x-ray-datasource","graphite","hadesarchitect-cassandra-datasource","influxdata-flightsql-datasource","influxdb","innius-grpc-datasource","kniepdennis-neo4j-datasource","loki","manassehzhou-maxcompute-datasource","marcusolsson-csv-datasource","mssql","mysql","nagasudhirpulla-api-datasource","needleinajaystack-haystack-datasource","opentsdb","postgres","prometheus","quickwit-quickwit-datasource","redis-datasource","sentinelone-dataset-datasource","sneller-sneller-datasource","spiceai-spicexyz-datasource","stackdriver","tdengine-datasource","trino-datasource","vertamedia-clickhouse-datasource","vertica-grafana-datasource","ydbtech-ydb-datasource","yesoreyeram-infinity-datasource"])},71415:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>o});var t=e(96540),n=e(72254);const o=s=>{const[r,g]=(0,t.useState)([]);return(0,t.useEffect)(()=>{(async()=>await(0,n._A)(s.panels))().then(c=>{g(c)})},[s.panels]),{unsupportedDataSources:r}}},87895:(Q,A,e)=>{"use strict";e.d(A,{w:()=>r});var t=e(96540),n=e(88575),o=e(94354),s=e(44836);const r=({selectedTheme:g="current",onChange:u})=>{const c=[{label:(0,s.t)("share-modal.theme-picker.current","Current"),value:"current"},{label:(0,s.t)("share-modal.theme-picker.dark","Dark"),value:"dark"},{label:(0,s.t)("share-modal.theme-picker.light","Light"),value:"light"}];return t.createElement(n.D,{label:(0,s.t)("share-modal.theme-picker.field-name","Theme")},t.createElement(o.z,{options:c,value:g,onChange:u}))}},1702:(Q,A,e)=>{"use strict";e.d(A,{ShareModal:()=>t.Zy});var t=e(7686)},22699:(Q,A,e)=>{"use strict";e.d(A,{CF:()=>h,Lb:()=>d,P_:()=>i,XV:()=>c,Xe:()=>l,wr:()=>m});var t=e(65879),n=e(76885),o=e(71733),s=e(47232),r=e(32264),g=e(7030),u=e(74856);function c({useCurrentTimeRange:a,selectedTheme:v,panel:E,search:D=window.location.search,range:b=(0,u.jG)().timeRange(),orgId:C=r.$.bootData.user.orgId}){const y=new URLSearchParams(D),M=E?.timeFrom;if(M){const{from:T,to:I}=t.describeTextRange(M);y.set("from",T),y.set("to",I)}else y.set("from",String(b.from.valueOf())),y.set("to",String(b.to.valueOf()));return y.set("orgId",String(C)),a||(y.delete("from"),y.delete("to")),v!=="current"&&y.set("theme",v),E&&!y.has("editPanel")&&y.set("viewPanel",String(E.id)),y.delete("auth_token"),y.delete("shareView"),y}function i(){let a=window.location.href;const v=a.indexOf("?");return v!==-1&&(a=a.substring(0,v)),a}async function l(a,v,E,D){const b=i(),C=c({useCurrentTimeRange:a,selectedTheme:v,panel:E}),y=n.kM.appendQueryToUrl(b,C.toString());return D?await(0,g.f)(y):y}function f(a,v,E,D,b){const C=i(),y=c({useCurrentTimeRange:a,selectedTheme:E,panel:D,range:b});let M=C.replace(r.$.appSubUrl+"/dashboard/",r.$.appSubUrl+"/dashboard-solo/");M=M.replace(r.$.appSubUrl+"/d/",r.$.appSubUrl+"/d-solo/"),o.I.stripBaseFromUrl(C)==="/"&&(M=`${r.$.appUrl}d-solo/${v}`);const I=y.get("editPanel")??y.get("viewPanel")??"";return y.set("panelId",I),y.delete("editPanel"),y.delete("viewPanel"),n.kM.appendQueryToUrl(M,y.toString())}function d(a,v,E,D){let C=f(a,v,E,D).replace(r.$.appSubUrl+"/dashboard-solo/",r.$.appSubUrl+"/render/dashboard-solo/");return C=C.replace(r.$.appSubUrl+"/d-solo/",r.$.appSubUrl+"/render/d-solo/"),C+="&width=1000&height=500"+p(),C}function h(a,v,E,D,b){return`<iframe src="${f(a,v,E,D,b)}" width="450" height="200" frameborder="0"></iframe>`}function p(){const a="&tz=UTC"+encodeURIComponent((0,s.KQ)().format("Z"));if(!window.Intl)return a;const v=window.Intl.DateTimeFormat();if(!v.resolvedOptions)return a;const E=v.resolvedOptions();return E.timeZone?"&tz="+encodeURIComponent(E.timeZone):a}const m={link:"link",snapshot:"snapshot",export:"export",embed:"embed",libraryPanel:"library_panel",pdf:"pdf",report:"report",publicDashboard:"public_dashboard"}},52424:(Q,A,e)=>{"use strict";e.d(A,{Zx:()=>b,aK:()=>m});var t=e(32196),n=e(96540),o=e(16817),s=e(80997),r=e(13544),g=e(40845),u=e(38138),c=e(40276),i=e(83122),l=e(14578),f=e(55852),d=e(27677),h=e(6923);function p({dashboardUID:C,link:y}){const M=(0,g.of)(D),T=a({dashboardUID:C,link:y});return!T||E.length===0?null:n.createElement(u.W,null,n.createElement("div",{className:M.dropdown},n.createElement(c.E,null,T.map((I,x)=>n.createElement(u.W.Item,{url:I.url,target:y.targetBlank?"_blank":void 0,key:`dashlinks-dropdown-item-${I.uid}-${x}`,label:I.title,testId:r.Tp.components.DashboardLinks.link,"aria-label":`${I.title} dashboard`})))))}const m=C=>{const{link:y,linkInfo:M,dashboardUID:T}=C,I=a(C),x=(0,g.of)(D);return y.asDropdown?n.createElement(i.m,{overlay:n.createElement(p,{link:y,dashboardUID:T})},n.createElement(b,{"data-placement":"bottom","data-toggle":"dropdown","aria-controls":"dropdown-list","aria-haspopup":"menu",fill:"outline",variant:"secondary","data-testid":r.Tp.components.DashboardLinks.dropDown},n.createElement(l.I,{"aria-hidden":!0,name:"bars",className:x.iconMargin}),n.createElement("span",null,M.title))):n.createElement(n.Fragment,null,I.length>0&&I.map((S,O)=>n.createElement(b,{key:`dashlinks-list-item-${S.uid}-${O}`,icon:"apps",variant:"secondary",fill:"outline",href:S.url,target:y.targetBlank?"_blank":void 0,rel:"noreferrer","data-testid":r.Tp.components.DashboardLinks.link},S.title)))},a=({link:C,dashboardUID:y})=>{const{tags:M}=C,T=(0,o.A)(()=>v(M),[M]);return T.value?E(y,C,T.value):[]};async function v(C,y={getBackendSrv:d.AI}){return await y.getBackendSrv().search({tag:C,limit:100})}function E(C,y,M,T={getLinkSrv:h.mQ,sanitize:s.aj,sanitizeUrl:s.Jf}){return M.filter(I=>I.uid!==C).map(I=>{const x=I.uid,S=T.sanitize(I.title),O=T.getLinkSrv().getLinkUrl({...y,url:I.url}),P=T.sanitizeUrl(O);return{uid:x,title:S,url:P}})}function D(C){return{iconMargin:(0,t.css)({marginRight:C.spacing(.5)}),dropdown:(0,t.css)({maxWidth:"max(30vw, 300px)",maxHeight:"70vh",overflowY:"auto"}),button:(0,t.css)({color:C.colors.text.primary}),dashButton:(0,t.css)({fontSize:C.typography.bodySmall.fontSize,paddingLeft:C.spacing(1),paddingRight:C.spacing(1)})}}const b=n.forwardRef(({className:C,...y},M)=>{const T=(0,g.of)(D),I=y.href?f.z9:f.$n;return n.createElement(I,{...y,variant:"secondary",fill:"outline",className:(0,t.cx)(C,T.dashButton),ref:M})});b.displayName="DashboardLinkButton"},57650:(Q,A,e)=>{"use strict";e.d(A,{A:()=>B});var t=e(96540),n=e(97497),o=e(42941),s=e(1173),r=e(52622),g=e(13544),u=e(14110),c=e(96374),i=e(10343),l=e(7788),f=e(2913),d=e(10803),h=e(32196),p=e(69862),m=e(85200),a=e(2514),v=e(72574),E=e(40845),D=e(87978),b=e(24022),C=e(14578);const y=({debugMode:H,index:w,data:N,uiConfig:V,configs:G,onChange:_,toggleShowDebug:K})=>{const j=(0,E.of)(M),[k,Y]=(0,t.useState)([]),[ee,re]=(0,t.useState)([]),J=(0,t.useMemo)(()=>G[w],[G,w]);(0,t.useEffect)(()=>{const q=G[w].transformation,te=q.filter?.options?(0,m.Dq)(q.filter):void 0,oe=G.slice(0,w).map(De=>De.transformation),ue=G.slice(w,w+1).map(De=>De.transformation),ie={interpolate:De=>(0,v.w)().replace(De)},ge=(0,a.m)(oe,N,ie).subscribe(De=>{te&&(De=N.filter(pe=>te(pe))),Y(De)}),he=(0,a.m)(oe,N,ie).pipe((0,p.Z)(De=>(0,a.m)(ue,De,ie))).subscribe(re);return function(){ge.unsubscribe(),he.unsubscribe()}},[w,N,G]);const ne=(0,t.useMemo)(()=>t.createElement(V.editor,{options:{...V.transformation.defaultOptions,...J.transformation.options},input:k,onChange:q=>{_(w,{...J.transformation,options:q})}}),[V.editor,V.transformation.defaultOptions,J.transformation,k,_,w]);return t.createElement("div",{className:j.editor,"data-testid":g.Tp.components.TransformTab.transformationEditor(V.name)},ne,H&&t.createElement(D._,{title:"Debug transformation",subtitle:V.name,onClose:K},t.createElement("div",{className:j.debugWrapper,"data-testid":g.Tp.components.TransformTab.transformationEditorDebugger(V.name)},t.createElement("div",{className:j.debug},t.createElement("div",{className:j.debugTitle},"Input data"),t.createElement("div",{className:j.debugJson},t.createElement(b.B,{json:k}))),t.createElement("div",{className:j.debugSeparator},t.createElement(C.I,{name:"arrow-right"})),t.createElement("div",{className:j.debug},t.createElement("div",{className:j.debugTitle},"Output data"),t.createElement("div",{className:j.debugJson},ee&&t.createElement(b.B,{json:ee}))))))},M=H=>({title:(0,h.css)` display: flex; padding: 4px 8px 4px 8px; position: relative; height: 35px; border-radius: 4px 4px 0 0; flex-wrap: nowrap; justify-content: space-between; align-items: center; `,name:(0,h.css)` font-weight: ${H.typography.fontWeightMedium}; color: ${H.colors.primary.text}; `,iconRow:(0,h.css)` display: flex; `,icon:(0,h.css)` background: transparent; border: none; box-shadow: none; cursor: pointer; color: ${H.colors.text.secondary}; margin-left: ${H.spacing(1)}; &:hover { color: ${H.colors.text}; } `,editor:(0,h.css)``,debugWrapper:(0,h.css)` display: flex; flex-direction: row; `,debugSeparator:(0,h.css)` width: 48px; min-height: 300px; display: flex; align-items: center; align-self: stretch; justify-content: center; margin: 0 ${H.spacing(.5)}; color: ${H.colors.primary.text}; `,debugTitle:(0,h.css)` padding: ${H.spacing(1)} ${H.spacing(.25)}; font-family: ${H.typography.fontFamilyMonospace}; font-size: ${H.typography.bodySmall.fontSize}; color: ${H.colors.text}; border-bottom: 1px solid ${H.colors.border.weak}; flex-grow: 0; flex-shrink: 1; `,debug:(0,h.css)` margin-top: ${H.spacing(1)}; padding: 0 ${H.spacing(1,1,1)}; border: 1px solid ${H.colors.border.weak}; background: ${H.isLight?H.v1.palette.white:H.v1.palette.gray05}; border-radius: ${H.shape.radius.default}; width: 100%; min-height: 300px; display: flex; flex-direction: column; align-self: stretch; `,debugJson:(0,h.css)` flex-grow: 1; height: 100%; overflow: hidden; padding: ${H.spacing(.5)}; `});var T=e(22214),I=e(91847);const x=({isOpen:H,onCloseClick:w,transformer:N})=>{const{transformation:{name:V},help:G}=N,_=G||(0,I.$n)(),K=t.createElement(D._,{title:V,subtitle:"Transformation help",onClose:()=>w(!1)},t.createElement(T.j,{markdown:_,styleOverrides:{borderTop:"2px solid"}}));return H?K:null};var S=e(88575),O=e(88323),P=e(19743);const L=({index:H,data:w,config:N,onChange:V})=>{const G=(0,E.of)(U),_=(0,t.useMemo)(()=>({context:{data:w.series},showTopic:!0,showFilter:N.topic!==r.QR.Annotations,source:[{value:r.QR.Series,label:"Query results"},{value:r.QR.Annotations,label:"Annotation data"}]}),[w,N.topic]);return t.createElement("div",{className:G.wrapper},t.createElement(S.D,{label:"Apply transformation to"},t.createElement(t.Fragment,null,_.showTopic&&t.createElement(O.l6,{isClearable:!0,options:_.source,value:_.source.find(K=>K.value===N.topic),placeholder:_.source[0].label,className:G.padded,onChange:K=>{V(H,{...N,topic:K?.value})}}),_.showFilter&&t.createElement(P.x,{value:N.filter,context:_.context,item:{},onChange:K=>V(H,{...N,filter:K})}))))},U=H=>{const w=H.shape.radius.default;return{wrapper:(0,h.css)({padding:H.spacing(2),border:`2px solid ${H.colors.background.secondary}`,borderTop:"none",borderRadius:`0 0 ${w} ${w}`,position:"relative",top:"-4px"}),padded:(0,h.css)({marginBottom:H.spacing(1)})}},R=({onRemove:H,index:w,id:N,data:V,configs:G,uiConfig:_,onChange:K})=>{const[j,k]=(0,o.A)(!1),[Y,ee]=(0,o.A)(!1),[re,J]=(0,o.A)(!1),ne=!!G[w].transformation.disabled,q=G[w].transformation.topic,te=G[w].transformation.filter!=null||q!=null,oe=te||V.series.length>1||(V.annotations?.length??0)>0,ue=(0,t.useCallback)(De=>{const pe=G[De].transformation;K(De,{...pe,disabled:pe.disabled?void 0:!0})},[K,G]),ie=(0,t.useCallback)(()=>{let De={...G[w].transformation};De.filter?delete De.filter:De.filter={id:s.jR.byRefId,options:""},K(w,De)},[K,w,G]),ge=(0,t.useCallback)((De,pe,le)=>Te=>{let Ee="panel_editor_tabs_transformations_toggle";f.Ay.featureToggles.transformationsRedesign&&(Ee="transformations_redesign_"+Ee),(0,u.rR)(Ee,{action:le?"off":"on",toggleId:pe,transformationId:G[w].transformation.id}),De(Te)},[G,w]),he=()=>t.createElement(t.Fragment,null,_.state&&t.createElement(d.p,{state:_.state}),t.createElement(i.A,{title:"Show transform help",icon:"info-circle",onClick:ge(J,"help",re),active:re}),oe&&t.createElement(i.A,{title:"Filter",icon:"filter",onClick:ge(ie,"filter",te),active:te}),t.createElement(i.A,{title:"Debug",icon:"bug",onClick:ge(ee,"debug",Y),active:Y}),t.createElement(i.A,{title:"Disable transformation",icon:ne?"eye-slash":"eye",onClick:ge(()=>ue(w),"disabled",ne),active:ne,dataTestId:g.Tp.components.Transforms.disableTransformationButton}),t.createElement(i.q,{title:"Remove",icon:"trash-alt",onClick:()=>f.Ay.featureToggles.transformationsRedesign?k(!0):H(w)}),f.Ay.featureToggles.transformationsRedesign&&t.createElement(c.u,{isOpen:j,title:`Delete ${_.name}?`,body:"Note that removing one transformation may break others. If there is only a single transformation, you will go back to the main selection screen.",confirmText:"Delete",onConfirm:()=>{k(!1),H(w)},onDismiss:()=>k(!1)}));return t.createElement(t.Fragment,null,t.createElement(l.u,{id:N,index:w,title:`${w+1} - ${_.name}`,draggable:!0,actions:he,disabled:ne,expanderMessages:{close:"Collapse transformation row",open:"Expand transformation row"}},te&&t.createElement(L,{index:w,config:G[w].transformation,data:V,onChange:K}),t.createElement(y,{debugMode:Y,index:w,data:q===r.QR.Annotations?V.annotations??[]:V.series,configs:G,uiConfig:_,onChange:K,toggleShowDebug:ee})),t.createElement(x,{transformer:_,isOpen:re,onCloseClick:J}))},B=({data:H,onChange:w,onRemove:N,configs:V})=>t.createElement(t.Fragment,null,V.map((G,_)=>{const K=n.h.getIfExists(G.transformation.id);return K?t.createElement(R,{index:_,id:`${G.id}`,key:`${G.id}`,data:H,configs:V,uiConfig:K,onRemove:N,onChange:w}):null}))},21427:(Q,A,e)=>{"use strict";e.d(A,{R:()=>b});var t=e(32196),n=e(96540),o=e(81010),s=e(18282),r=e(97497),g=e(13544),u=e(40845),c=e(87978),i=e(10354),l=e(15292),f=e(92174),d=e(10860),h=e(29158),p=e(2913),m=e(10803),a=e(94397);const D=[["viewAll","View all"],...Object.entries(a.eJ)];function b(S){const O=(0,u.of)(C),{suffix:P,xforms:L,search:U,onSearchChange:R,onSearchKeyDown:B,showIllustrations:H,onTransformationAdd:w,selectedFilter:N,data:V,onClose:G,onShowIllustrationsChange:_,onSelectedFilterChange:K}=S,j=(0,n.useCallback)(k=>{k?.click()},[]);return n.createElement(c._,{size:"md",onClose:()=>{G&&G()},title:"Add another transformation"},n.createElement("div",{className:O.searchWrapper},n.createElement(i.p,{"data-testid":g.Tp.components.Transforms.searchInput,className:O.searchInput,value:U??"",placeholder:"Search for transformation",onChange:R,onKeyDown:B,suffix:P,ref:j}),n.createElement("div",{className:O.showImages},n.createElement("span",{className:O.illustationSwitchLabel},"Show images")," ",n.createElement(l.d,{value:H,onChange:()=>_&&_(!H)}))),n.createElement("div",{className:O.filterWrapper},D.map(([k,Y])=>n.createElement(f.m,{key:k,onClick:()=>K&&K(k),label:Y,selected:N===k}))),n.createElement(y,{showIllustrations:H,transformations:L,data:V,onClick:k=>{w({value:k})}}))}function C(S){return{showImages:(0,t.css)({flexBasis:"0",display:"flex",gap:"8px",alignItems:"center"}),pickerInformationLine:(0,t.css)({fontSize:"16px",marginBottom:`${S.spacing(2)}`}),pickerInformationLineHighlight:(0,t.css)({verticalAlign:"middle"}),searchWrapper:(0,t.css)({display:"flex",flexWrap:"wrap",columnGap:"27px",rowGap:"16px",width:"100%"}),searchInput:(0,t.css)({flexGrow:"1",width:"initial"}),illustationSwitchLabel:(0,t.css)({whiteSpace:"nowrap"}),filterWrapper:(0,t.css)({padding:`${S.spacing(1)} 0`,display:"flex",flexWrap:"wrap",rowGap:`${S.spacing(1)}`,columnGap:`${S.spacing(.5)}`})}}function y({showIllustrations:S,transformations:O,onClick:P,data:L}){const U=(0,u.of)(M);return n.createElement("div",{className:U.grid},O.map(R=>{let B=o.M.Applicable;R.transformation.isApplicable!==void 0&&(B=R.transformation.isApplicable(L));const H=B>0;let w=null;R.transformation.isApplicableDescription!==void 0&&(typeof R.transformation.isApplicableDescription=="function"?w=R.transformation.isApplicableDescription(L):w=R.transformation.isApplicableDescription);let N=U.newCard;return H||(N=(0,t.cx)(U.newCard,U.cardDisabled)),n.createElement(d.Z,{className:N,"data-testid":g.Tp.components.TransformTab.newTransform(R.name),onClick:()=>P(R.id),key:R.id},n.createElement(d.Z.Heading,{className:U.heading},n.createElement("span",null,R.name),n.createElement("span",{className:U.pluginStateInfoWrapper},n.createElement(m.p,{state:R.state}))),n.createElement(d.Z.Description,{className:U.description},n.createElement("span",null,x(R.id)),S&&n.createElement("span",null,n.createElement("img",{className:U.image,src:T(R.id,!H),alt:R.name})),!H&&w!==null&&n.createElement(h.K,{className:U.cardApplicableInfo,name:"info-circle",tooltip:w})))}))}function M(S){return{heading:(0,t.css)` font-weight: 400, > button: { width: '100%', display: 'flex', justify-content: 'space-between', align-items: 'center', flex-wrap: 'no-wrap', },`,description:(0,t.css)({fontSize:"12px",display:"flex",flexDirection:"column",justifyContent:"space-between"}),image:(0,t.css)({display:"block",maxEidth:"100%`",marginTop:`${S.spacing(2)}`}),grid:(0,t.css)({display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gridAutoRows:"1fr",gap:`${S.spacing(2)} ${S.spacing(1)}`,width:"100%"}),cardDisabled:(0,t.css)({backgroundColor:"rgb(204, 204, 220, 0.045)",color:`${S.colors.text.disabled} !important`}),cardApplicableInfo:(0,t.css)({position:"absolute",bottom:`${S.spacing(1)}`,right:`${S.spacing(1)}`}),newCard:(0,t.css)({gridTemplateRows:"min-content 0 1fr 0"}),pluginStateInfoWrapper:(0,t.css)({marginLeft:"5px"})}}const T=(S,O)=>{let P=null;return O?P="disabled":P=p.Ay.theme2.isDark?"dark":"light",`public/img/transformations/${P}/${S}.svg`},I={[s.F.concatenate]:"Combine all fields into a single frame.",[s.F.configFromData]:"Set unit, min, max and more.",[s.F.fieldLookup]:"Use a field value to lookup countries, states, or airports.",[s.F.filterFieldsByName]:"Remove parts of the query results using a regex pattern.",[s.F.filterByRefId]:"Remove rows from the data based on origin query",[s.F.filterByValue]:"Remove rows from the query results using user-defined filters.",[s.F.groupBy]:"Group data by a field value and create aggregate data.",[s.F.groupingToMatrix]:"Summarize and reorganize data based on three fields.",[s.F.joinByField]:"Combine rows from 2+ tables, based on a related field.",[s.F.labelsToFields]:"Group series by time and return labels or tags as fields.",[s.F.merge]:"Merge multiple series. Values will be combined into one row.",[s.F.organize]:"Re-order, hide, or rename fields.",[s.F.partitionByValues]:"Split a one-frame dataset into multiple series.",[s.F.prepareTimeSeries]:"Stretch data frames from the wide format into the long format.",[s.F.reduce]:"Reduce all rows or data points to a single value (ex. max, mean).",[s.F.renameByRegex]:"Rename parts of the query results using a regular expression and replacement pattern.",[s.F.seriesToRows]:"Merge multiple series. Return time, metric and values as a row."},x=S=>I[S]||r.h.getIfExists(S)?.description||""},57120:(Q,A,e)=>{"use strict";e.d(A,{o:()=>B,e:()=>U});var t=e(96540),n=e(75494),o=e(97497),s=e(13544),r=e(14110),g=e(29158),u=e(55852),c=e(96374),i=e(19727),l=e(40276),f=e(66864),d=e(40845),h=e(2913),p=e(79280),m=e(16930),a=e(57650),v=e(32196),E=e(87885),D=e(42418),b=e(10354),C=e(10860),y=e(61680);const M={[E.f.Transformations]:"https://grafana.com/docs/grafana/latest/panels/transformations",[E.f.FieldConfig]:"https://grafana.com/docs/grafana/latest/panels/field-configuration-options/",[E.f.FieldConfigOverrides]:"https://grafana.com/docs/grafana/latest/panels/field-configuration-options/#override-a-field"},T=H=>M[H];var I=e(10803);const x="dashboard.components.TransformationEditor.featureInfoBox.isDismissed";function S(H){const{noTransforms:w,search:N,xforms:V,onSearchChange:G,onSearchKeyDown:_,onTransformationAdd:K,suffix:j}=H;return t.createElement(f.gW,null,w&&t.createElement(f.mc,{grow:1},t.createElement(y.b,{storageKey:x,defaultValue:!1},(k,Y)=>k?null:t.createElement(D.F,{title:"Transformations",severity:"info",onRemove:()=>{Y(!0)}},t.createElement("p",null,"Transformations allow you to join, calculate, re-order, hide, and rename your query results before they are visualized. ",t.createElement("br",null),"Many transforms are not suitable if you're using the Graph visualization, as it currently only supports time series data. ",t.createElement("br",null),"It can help to switch to the Table visualization to understand what a transformation is doing."," "),t.createElement("a",{href:T(E.f.Transformations),className:"external-link",target:"_blank",rel:"noreferrer"},"Read more")))),t.createElement(b.p,{"data-testid":s.Tp.components.Transforms.searchInput,value:N??"",autoFocus:!w,placeholder:"Search for transformation",onChange:G,onKeyDown:_,suffix:j}),V.map(k=>t.createElement(O,{key:k.name,transform:k,onClick:()=>{K({value:k.id})}})))}function O({transform:H,onClick:w}){const N=(0,d.of)(P);return t.createElement(C.Z,{className:N.card,"data-testid":s.Tp.components.TransformTab.newTransform(H.name),onClick:w},t.createElement(C.Z.Heading,null,H.name),t.createElement(C.Z.Description,null,H.description),H.state&&t.createElement(C.Z.Tags,null,t.createElement(I.p,{state:H.state})))}function P(H){return{card:(0,v.css)({margin:"0",padding:`${H.spacing(1)}`})}}var L=e(21427);const U="viewAll";class R extends t.PureComponent{constructor(w){super(w),this.onSearchChange=G=>{this.setState({search:G.target.value})},this.onSearchKeyDown=G=>{if(G.key==="Enter"){const{search:_}=this.state;if(_){const K=_.toLowerCase(),j=o.h.list().filter(k=>(k.name+k.description).toLowerCase().indexOf(K)>=0);j.length>0&&this.onTransformationAdd({value:j[0].id})}}else G.keyCode===27&&(this.setState({search:"",showPicker:!1}),G.stopPropagation())},this.getTransformationNextId=G=>{const{transformations:_}=this.state;let K=0;const j=_.filter(k=>k.id.startsWith(G)).map(k=>k.id);return j.length!==0&&(K=Math.max(...j.map(k=>parseInt(k.match(/\d+/)[0],10)))+1),`${G}-${K}`},this.onTransformationAdd=G=>{let _="panel_editor_tabs_transformations_management";h.Ay.featureToggles.transformationsRedesign&&(_="transformations_redesign_"+_),(0,r.rR)(_,{action:"add",transformationId:G.value});const{transformations:K}=this.state,j=this.getTransformationNextId(G.value);this.setState({search:"",showPicker:!1}),this.onChange([...K,{id:j,transformation:{id:G.value,options:{}}}])},this.onTransformationChange=(G,_)=>{const{transformations:K}=this.state,j=Array.from(K);let k="panel_editor_tabs_transformations_management";h.Ay.featureToggles.transformationsRedesign&&(k="transformations_redesign_"+k),(0,r.rR)(k,{action:"change",transformationId:j[G].transformation.id}),j[G].transformation=_,this.onChange(j)},this.onTransformationRemove=G=>{const{transformations:_}=this.state,K=Array.from(_);let j="panel_editor_tabs_transformations_management";h.Ay.featureToggles.transformationsRedesign&&(j="transformations_redesign_"+j),(0,r.rR)(j,{action:"remove",transformationId:K[G].transformation.id}),K.splice(G,1),this.onChange(K)},this.onTransformationRemoveAll=()=>{this.onChange([]),this.setState({showRemoveAllModal:!1})},this.onDragEnd=G=>{const{transformations:_}=this.state;if(!G||!G.destination)return;const K=G.source.index,j=G.destination.index;if(K===j)return;const k=Array.from(_),[Y]=k.splice(K,1);k.splice(j,0,Y),this.onChange(k)},this.renderEmptyMessage=()=>t.createElement(p.p,{onShowPicker:()=>{this.setState({showPicker:!0})}}),this.renderTransformationEditors=()=>{const{data:G,transformations:_}=this.state;return t.createElement(n.JY,{onDragEnd:this.onDragEnd},t.createElement(n.gL,{droppableId:"transformations-list",direction:"vertical"},K=>t.createElement("div",{ref:K.innerRef,...K.droppableProps},t.createElement(a.A,{configs:_,data:G,onRemove:this.onTransformationRemove,onChange:this.onTransformationChange}),K.placeholder)))};const N=w.panel.transformations||[],V=this.buildTransformationIds(N);this.state={transformations:N.map((G,_)=>({transformation:G,id:V[_]})),data:{series:[]},search:"",selectedFilter:U,showIllustrations:!0}}buildTransformationIds(w){const N={},V=[];for(let G=0;G<w.length;G++){const _=w[G];N[_.id]===void 0?N[_.id]=0:N[_.id]+=1,V.push(`${w[G].id}-${N[w[G].id]}`)}return V}componentDidMount(){this.subscription=this.props.panel.getQueryRunner().getData({withTransforms:!1,withFieldConfig:!1}).subscribe({next:w=>this.setState({data:w})})}componentWillUnmount(){this.subscription&&this.subscription.unsubscribe()}componentDidUpdate(w,N){if(h.Ay.featureToggles.transformationsRedesign){const G=!(N.transformations.length>0)||N.showPicker,K=!(this.state.transformations.length>0)||this.state.showPicker;if(G!==K){const j=Math.random()/2;this.setState({scrollTop:K?j:Number.MAX_SAFE_INTEGER})}}}onChange(w){this.setState({transformations:w}),this.props.panel.setTransformations(w.map(N=>N.transformation))}renderTransformsPicker(){let{showPicker:w}=this.state;const{transformations:N,search:V}=this.state,{transformationsRedesign:G}=h.Ay.featureToggles,_=!N?.length,K=N.length>0;let j=null,k=o.h.list().sort((J,ne)=>J.name>ne.name?1:ne.name>J.name?-1:0);if(!G&&_&&(w=!0),this.state.selectedFilter!==U&&(k=k.filter(J=>J.categories&&this.state.selectedFilter&&J.categories.has(this.state.selectedFilter))),V){const J=V.toLowerCase(),ne=k.filter(q=>(q.name+q.description).toLowerCase().indexOf(J)>=0);j=t.createElement(t.Fragment,null,ne.length," / ",k.length," \xA0\xA0",t.createElement(g.K,{name:"times",onClick:()=>{this.setState({search:""})},tooltip:"Clear search"})),k=ne}!j&&w&&!_&&(j=t.createElement(g.K,{name:"times",onClick:()=>{this.setState({showPicker:!1})},tooltip:"Close picker"}));let Y=null,ee=null;G?(Y=t.createElement(L.R,{noTransforms:_,search:V,suffix:j,xforms:k,onClose:()=>this.setState({showPicker:!1}),onSelectedFilterChange:J=>this.setState({selectedFilter:J}),onShowIllustrationsChange:J=>this.setState({showIllustrations:J}),onSearchChange:this.onSearchChange,onSearchKeyDown:this.onSearchKeyDown,onTransformationAdd:this.onTransformationAdd,data:this.state.data.series,selectedFilter:this.state.selectedFilter,showIllustrations:this.state.showIllustrations}),ee=t.createElement(t.Fragment,null,t.createElement(u.$n,{icon:"times",variant:"secondary",onClick:()=>this.setState({showRemoveAllModal:!0}),style:{marginLeft:this.props.theme.spacing.md}},"Delete all transformations"),t.createElement(c.u,{isOpen:!!this.state.showRemoveAllModal,title:"Delete all transformations?",body:"By deleting all transformations, you will go back to the main selection screen.",confirmText:"Delete all",onConfirm:()=>this.onTransformationRemoveAll(),onDismiss:()=>this.setState({showRemoveAllModal:!1})}))):Y=t.createElement(S,{noTransforms:_,search:V,suffix:j,xforms:k,onSearchChange:this.onSearchChange,onSearchKeyDown:this.onSearchKeyDown,onTransformationAdd:this.onTransformationAdd});const re=t.createElement(i.e,null,t.createElement(u.$n,{icon:"plus",variant:"secondary",onClick:()=>{this.setState({showPicker:!0})},"data-testid":s.Tp.components.Transforms.addTransformationButton},"Add another transformation"),ee);return t.createElement(t.Fragment,null,w&&Y,G&&K&&re||!G&&!w&&K&&re)}render(){const{panel:{alert:w}}=this.props,{transformations:N}=this.state,V=N.length>0;if(w){const G=V?"Transformations can't be used on a panel with alerts":"Transformations can't be used on a panel with existing alerts";return t.createElement(m.c,{message:G})}return t.createElement(l.E,{scrollTop:this.state.scrollTop,autoHeightMin:"100%"},t.createElement(f.mc,{padding:"lg"},t.createElement("div",{"data-testid":s.Tp.components.TransformTab.content},!V&&h.Ay.featureToggles.transformationsRedesign&&this.renderEmptyMessage(),V&&this.renderTransformationEditors(),this.renderTransformsPicker())))}}const B=(0,d.SL)(R)},68064:(Q,A,e)=>{"use strict";e.d(A,{A:()=>D});var t=e(32196),n=e(96540),o=e(13544),s=e(12131),r=e(32264),g=e(40845),u=e(67061),c=e(90613),i=e(94753),l=e(55852),f=e(44836),d=e(36974),h=e(36043),p=e(7758),m=e(74730),a=e(80348),v=e(28601);const D=({dashboard:C,canCreate:y})=>{const M=(0,g.of)(b),T=(0,a.useDispatch)(),I=(0,a.useSelector)(O=>O.dashboard.initialDatasource),x=C instanceof h.H$,S=()=>{let O;x?O=(0,m.OK)(C):(O=(0,d.OK)(C,I),T((0,v.Ub)(void 0))),s.Ny.partial({editPanel:O,firstPanel:!0}),p.c.emptyDashboardButtonClicked({item:"add_visualization"})};return n.createElement(u.B,{alignItems:"center",justifyContent:"center"},n.createElement("div",{className:M.wrapper},n.createElement(u.B,{alignItems:"stretch",justifyContent:"center",gap:4,direction:"column"},n.createElement(c.a,{borderColor:"strong",borderStyle:"dashed",padding:4},n.createElement(u.B,{direction:"column",alignItems:"center",gap:2},n.createElement(i.E,{element:"h1",textAlignment:"center",weight:"medium"},n.createElement(f.x6,{i18nKey:"dashboard.empty.add-visualization-header"},"Start your new dashboard by adding a visualization")),n.createElement(c.a,{marginBottom:2,paddingX:4},n.createElement(i.E,{element:"p",textAlignment:"center",color:"secondary"},n.createElement(f.x6,{i18nKey:"dashboard.empty.add-visualization-body"},"Select a data source and then query and visualize your data with charts, stats and tables or create lists, markdowns and other widgets."))),n.createElement(l.$n,{size:"lg",icon:"plus","data-testid":o.Tp.pages.AddDashboard.itemButton("Create new panel button"),onClick:S,disabled:!y},n.createElement(f.x6,{i18nKey:"dashboard.empty.add-visualization-button"},"Add visualization")))),n.createElement(u.B,{direction:{xs:"column",md:"row"},wrap:"wrap",gap:4},r.$.featureToggles.vizAndWidgetSplit&&n.createElement(c.a,{borderColor:"strong",borderStyle:"dashed",padding:3,flex:1},n.createElement(u.B,{direction:"column",alignItems:"center",gap:1},n.createElement(i.E,{element:"h3",textAlignment:"center",weight:"medium"},n.createElement(f.x6,{i18nKey:"dashboard.empty.add-widget-header"},"Add a widget")),n.createElement(c.a,{marginBottom:2},n.createElement(i.E,{element:"p",textAlignment:"center",color:"secondary"},n.createElement(f.x6,{i18nKey:"dashboard.empty.add-widget-body"},"Create lists, markdowns and other widgets"))),n.createElement(l.$n,{icon:"plus",fill:"outline","data-testid":o.Tp.pages.AddDashboard.itemButton("Create new widget button"),onClick:()=>{p.c.emptyDashboardButtonClicked({item:"add_widget"}),s.Ny.partial({addWidget:!0})},disabled:!y},n.createElement(f.x6,{i18nKey:"dashboard.empty.add-widget-button"},"Add widget")))),n.createElement(c.a,{borderColor:"strong",borderStyle:"dashed",padding:3,flex:1},n.createElement(u.B,{direction:"column",alignItems:"center",gap:1},n.createElement(i.E,{element:"h3",textAlignment:"center",weight:"medium"},n.createElement(f.x6,{i18nKey:"dashboard.empty.add-library-panel-header"},"Import panel")),n.createElement(c.a,{marginBottom:2},n.createElement(i.E,{element:"p",textAlignment:"center",color:"secondary"},n.createElement(f.x6,{i18nKey:"dashboard.empty.add-library-panel-body"},"Add visualizations that are shared with other dashboards."))),n.createElement(l.$n,{icon:"plus",fill:"outline","data-testid":o.Tp.pages.AddDashboard.itemButton("Add a panel from the panel library button"),onClick:()=>{p.c.emptyDashboardButtonClicked({item:"import_from_library"}),x||(0,d.s3)(C)},disabled:!y},n.createElement(f.x6,{i18nKey:"dashboard.empty.add-library-panel-button"},"Add library panel")))),n.createElement(c.a,{borderColor:"strong",borderStyle:"dashed",padding:3,flex:1},n.createElement(u.B,{direction:"column",alignItems:"center",gap:1},n.createElement(i.E,{element:"h3",textAlignment:"center",weight:"medium"},n.createElement(f.x6,{i18nKey:"dashboard.empty.import-a-dashboard-header"},"Import a dashboard")),n.createElement(c.a,{marginBottom:2},n.createElement(i.E,{element:"p",textAlignment:"center",color:"secondary"},n.createElement(f.x6,{i18nKey:"dashboard.empty.import-a-dashboard-body"},"Import dashboards from files or",n.createElement("a",{href:"https://grafana.com/grafana/dashboards/"},"grafana.com"),"."))),n.createElement(l.$n,{icon:"upload",fill:"outline","data-testid":o.Tp.pages.AddDashboard.itemButton("Import dashboard button"),onClick:()=>{p.c.emptyDashboardButtonClicked({item:"import_dashboard"}),(0,d.VF)()},disabled:!y},n.createElement(f.x6,{i18nKey:"dashboard.empty.import-dashboard-button"},"Import dashboard"))))))))};function b(C){return{wrapper:(0,t.css)({label:"dashboard-empty-wrapper",flexDirection:"column",maxWidth:"890px",gap:C.spacing.gridSize*4,paddingTop:C.spacing(2),[C.breakpoints.up("sm")]:{paddingTop:C.spacing(12)}})}}},2038:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>f});var t=e(96540),n=e(12131),o=e(32196),s=e(40845),r=e(27746),g=e(14578),u=e(56034),c=e(16797);const i=({notice:d,onClick:h})=>{const p=(0,s.of)(l),m=d.severity==="error"||d.severity==="warning"?"exclamation-triangle":"file-landscape-alt";return d.inspect&&h?t.createElement(r.I,{className:p.notice,icon:m,iconSize:"md",key:d.severity,tooltip:d.text,onClick:a=>h(a,d.inspect)}):d.link?t.createElement("a",{className:p.notice,"aria-label":d.text,href:d.link,target:"_blank",rel:"noreferrer"},t.createElement(g.I,{name:m,style:{marginRight:"8px"},size:"md"})):t.createElement(u.m,{key:d.severity,content:d.text},t.createElement("span",{className:p.iconTooltip},t.createElement(g.I,{name:m,size:"md"})))},l=d=>({notice:(0,o.css)({background:"inherit",border:"none",borderRadius:d.shape.radius.default}),iconTooltip:(0,o.css)({color:`${d.colors.text.secondary}`,backgroundColor:"inherit",cursor:"auto",border:"none",borderRadius:`${d.shape.radius.default}`,padding:`${d.spacing(0,1)}`,height:` ${d.spacing(d.components.height.md)}`,display:"flex",alignItems:"center",justifyContent:"center","&:focus, &:focus-visible":{...(0,c.getFocusStyles)(d),zIndex:1},"&: focus:not(:focus-visible)":(0,c.getMouseFocusStyles)(d),"&:hover ":{boxShadow:`${d.shadows.z1}`,color:`${d.colors.text.primary}`,background:`${d.colors.background.secondary}`}})}),f=({frames:d,panelId:h})=>{const p=(0,t.useCallback)((a,v)=>{a.stopPropagation(),n.Ny.partial({inspect:h,inspectTab:v})},[h]),m={};for(const a of d)if(!(!a.meta||!a.meta.notices))for(const v of a.meta.notices)m[v.severity]=v;return t.createElement(t.Fragment,null,Object.values(m).map(a=>t.createElement(i,{notice:a,onClick:p,key:a.severity})))}},91126:(Q,A,e)=>{"use strict";e.d(A,{M:()=>l});var t=e(37055),n=e(58972),o=e(1173),s=e(11261),r=e(28240),g=e(85200),u=e(88895);const c="hideSeriesFrom",i=(0,t.ZW)(c);function l(v,E,D,b){const{overrides:C}=D,y=v,M=C.findIndex(i);if(M<0){if(E===u.B.ToggleSelection){const P=f([y,...a(C,b)]);return{...D,overrides:[...D.overrides,P]}}const S=m(b,y),O=f(S);return{...D,overrides:[...D.overrides,O]}}const T=Array.from(C),[I]=T.splice(M,1);if(E===u.B.ToggleSelection){let S=h(I);const O=a(T,b);if(O.length>0&&(S=S.filter(L=>O.indexOf(L)<0)),S[0]===y&&S.length===1)return{...D,overrides:T};const P=f([y,...O]);return{...D,overrides:[...T,P]}}const x=d(I,y);return p(x,b)?{...D,overrides:T}:{...D,overrides:[...T,x]}}function f(v,E=n.PP.exclude,D){return D=D??{id:"custom.hideFrom",value:{viz:!0,legend:!1,tooltip:!1}},{__systemRef:c,matcher:{id:o.Ct.byNames,options:{mode:E,names:v,prefix:E===n.PP.exclude?"All except:":void 0,readOnly:!0}},properties:[{...D,value:{viz:!0,legend:!1,tooltip:!1}}]}}const d=(v,E,D=n.PP.exclude)=>{const b=v.properties.find(M=>M.id==="custom.hideFrom"),C=h(v),y=C.findIndex(M=>M===E);return y<0?C.push(E):C.splice(y,1),f(C,D,b)},h=v=>{const E=v.matcher.options?.names;return Array.isArray(E)?[...E]:[]},p=(v,E)=>h(v).length===m(E).length,m=(v,E)=>{const D=new Set;for(const b of v)for(const C of b.fields){if(C.type!==s.PU.number)continue;const y=(0,r.Ct)(C,b,v);y!==E&&D.add(y)}return Array.from(D)},a=(v,E)=>{let D=[];for(const b of v){const C=b.properties.find(y=>y.id==="custom.hideFrom");if(C!==void 0&&C.value?.legend===!0){const M=g.sJ.get(b.matcher.id).get(b.matcher.options);for(const T of E)for(const I of T.fields){if(I.type!==s.PU.number)continue;const x=(0,r.Ct)(I,T,E);M(I,T,E)&&D.push(x)}}}return D}},61582:(Q,A,e)=>{"use strict";e.d(A,{a:()=>c});var t=e(49426),n=e(47232),o=e(85858);const s=100;class r{constructor(){this.listeners=[],this.budget=1,this.threshold=1.5,this.ok=new t.t(!0),this.lastUpdate=Date.now(),this.isLive=!1,this.liveTimeOffset=0,this.measure=()=>{const l=Date.now();this.budget=(l-this.lastUpdate)/s;const f=this.ok.getValue(),d=this.budget<=this.threshold;if(f!==d&&this.ok.next(d),this.lastUpdate=l,this.isLive&&this.ok.getValue()&&this.timeRange){let h;for(const p of this.listeners){if(!p.panel.props.isInView)continue;if(l-p.last>=p.intervalMs){if(!h){const{raw:a}=this.timeRange;h={raw:a,from:(0,n.KQ)(l-this.liveTimeOffset),to:(0,n.KQ)(l)}}p.panel.liveTimeChanged(h),p.last=l}}}}}setLiveTimeRange(l){if(this.timeRange=l,this.isLive=l?.raw?.to==="now",this.isLive){const f=o.parse(l.raw.from,!1)?.valueOf(),d=o.parse(l.raw.to,!0)?.valueOf();this.liveTimeOffset=d-f;for(const h of this.listeners)h.intervalMs=u(this.liveTimeOffset,h.panel.props.width)}}listen(l){this.listeners.push({last:this.lastUpdate,panel:l,intervalMs:u(6e4,l.props.width)})}remove(l){this.listeners=this.listeners.filter(f=>f.panel!==l)}updateInterval(l){if(!(!this.timeRange||!this.isLive)){for(const f of this.listeners)if(f.panel===l){f.intervalMs=u(this.liveTimeOffset,f.panel.props.width);return}}}}const g=5*60*1e3;function u(i,l){const f=Math.ceil(i/l/100)*100;return f>g?g:f}const c=new r;setInterval(c.measure,s)},17493:(Q,A,e)=>{"use strict";e.d(A,{Fu:()=>D,np:()=>b});var t=e(34796),n=e.n(t),o=e(2543),s=e.n(o),r=e(95093),g=e.n(r),u=e(26272),c=e(85858),i=e(17172),l=e(12131),f=e(27677),d=e(62301),h=e(68576),p=e(72255),m=e(31193),a=e(10096),v=e(14792),E=e(69064);class D{constructor(){}_dashboardLoadFailed(M,T){return T=T||!1,{meta:{canStar:!1,isSnapshot:T,canDelete:!1,canSave:!1,canEdit:!1,canShare:!1,dashboardNotFound:!0},dashboard:{title:M,uid:M,schemaVersion:0}}}loadDashboard(M,T,I){const x=(0,p.sP)();let S;if(M==="script"&&T)S=this._loadScriptedDashboard(T);else if(M==="snapshot"&&T)S=(0,E.s)().getSnapshot(T).catch(()=>this._dashboardLoadFailed("Snapshot not found",!0));else if(M==="ds"&&T)S=this._loadFromDatasource(T);else if(M==="public"&&I)S=f.IB.getPublicDashboardByUid(I).then(O=>O).catch(O=>{const P=O.data.statusCode===403&&O.data.messageId==="publicdashboards.notEnabled",L=O.data.statusCode===404&&O.data.messageId==="publicdashboards.notFound",U=O.data.statusCode===404&&O.data.messageId==="publicdashboards.dashboardNotFound",R=this._dashboardLoadFailed(P?"Public Dashboard paused":"Public Dashboard Not found",!0);return{...R,meta:{...R.meta,publicDashboardEnabled:L?void 0:!P,dashboardNotFound:L||U}}});else if(I){const O=x.getFromCache(I);if(O)return Promise.resolve(O);S=f.IB.getDashboardByUid(I).then(P=>{if(P.meta.isFolder)throw a.lE.emit(u.r1.alertError,["Dashboard not found"]),new Error("Dashboard not found");return P}).catch(()=>this._dashboardLoadFailed("Not found",!0))}else throw new Error("Dashboard uid or slug required");return S.then(O=>(O.meta.dashboardNotFound!==!0&&d.A.addDashboardImpression(O.dashboard.uid),O)),S}_loadScriptedDashboard(M){const T="public/dashboards/"+M.replace(/\.(?!js)/,"/")+"?"+new Date().getTime();return(0,i.AI)().get(T).then(this._executeScript.bind(this)).then(I=>({meta:{fromScript:!0,canDelete:!1,canSave:!1,canStar:!1},dashboard:I.data}),I=>(console.error("Script dashboard error "+I),a.lE.emit(u.r1.alertError,["Script Error","Please make sure it exists and returns a valid dashboard"]),this._dashboardLoadFailed("Scripted dashboard")))}async _loadFromDatasource(M){const T=await(0,m.tR)().get(M);if(!T)return Promise.reject("can not find datasource: "+M);const I=new URLSearchParams(window.location.search),x=I.get("path");if(!x)return Promise.reject("expecting path parameter");const S={};return I.forEach((O,P)=>{S[P]=O}),(0,i.AI)().get(`/api/datasources/uid/${T.uid}/resources/${x}`,S).then(O=>({meta:{fromScript:!0,canDelete:!1,canSave:!1,canStar:!1},dashboard:O}))}_executeScript(M){const T={dashboardSrv:(0,v.UA)(),datasourceSrv:(0,m.tR)()},x=new Function("ARGS","kbn","dateMath","_","moment","window","document","$","jQuery","services",M)(l.Ny.getSearchObject(),h.A,c,s(),g(),window,document,n(),n(),T);return(0,o.isFunction)(x)?new Promise(S=>{x(O=>{S({data:O})})}):{data:x}}}let b=new D;const C=y=>{throw new Error("dashboardLoaderSrv can be only overriden in test environment")}},14792:(Q,A,e)=>{"use strict";e.d(A,{UA:()=>h});var t=e(75505),n=e(26272),o=e(28138),s=e(44836),r=e(27677),g=e(11230),u=e(28444),c=e(98365),i=e(19752);class l{constructor(){this.onRemovePanel=m=>{const a=this.getCurrent();a&&(0,i.FC)(a,a.getPanelById(m),!0)},o.l.subscribe(u.Vz,m=>this.onRemovePanel(m.payload))}create(m,a){return new c.G(m,a)}setCurrent(m){this.dashboard=m}getCurrent(){return this.dashboard}saveJSONDashboard(m){const a=JSON.parse(m);return(0,g.kV)({dashboard:a,folderUid:this.dashboard?.meta.folderUid||a.folderUid})}saveDashboard(m,a){return(0,t.s)((0,r.AI)().fetch({url:"/api/dashboards/db/",method:"POST",data:{...m,dashboard:m.dashboard.getSaveModelClone()},...a}))}starDashboard(m,a){const v=(0,r.AI)(),E={showSuccessAlert:!1,url:"/api/user/stars/dashboard/uid/"+m,method:a?"DELETE":"POST"};return v.request(E).then(()=>{const D=!a;this.dashboard?.uid===m&&(this.dashboard.meta.isStarred=D);const b=D?(0,s.t)("notifications.starred-dashboard","Dashboard starred"):(0,s.t)("notifications.unstarred-dashboard","Dashboard unstarred");return o.l.emit(n.r1.alertSuccess,[b]),D})}}let f;function d(p){f=p}function h(){return f||(f=new l),f}},69064:(Q,A,e)=>{"use strict";e.d(A,{s:()=>c});var t=e(75505),n=e(81160),o=e(17172),s=e(32264),r=e(10096);const g={create:i=>(0,o.AI)().post("/api/snapshots",i),getSnapshots:()=>(0,o.AI)().get("/api/dashboard/snapshots"),getSharingOptions:()=>(0,o.AI)().get("/api/snapshot/shared-options"),deleteSnapshot:i=>(0,o.AI)().delete("/api/snapshots/"+i),getSnapshot:async i=>{const l=await(0,o.AI)().get("/api/snapshots/"+i);return l.meta.canShare=!1,l}};class u{constructor(){this.apiVersion="dashboardsnapshot.grafana.app/v0alpha1",this.url=`/apis/${this.apiVersion}/namespaces/${s.$.namespace}/dashboardsnapshots`}async create(l){return(0,o.AI)().post(this.url+"/create",l)}async getSnapshots(){return(await(0,o.AI)().get(this.url)).items.map(f=>({key:f.metadata.name,name:f.spec.title,external:f.spec.externalUrl!=null,externalUrl:f.spec.externalUrl}))}deleteSnapshot(l){return(0,o.AI)().delete(this.url+"/"+l)}async getSharingOptions(){return(0,o.AI)().get("/api/snapshot/shared-options")}async getSnapshot(l){const f={};if(!r.TP.isSignedIn){alert("TODO... need a barer token for anonymous use case");const d=`??? TODO, get anon token for snapshots (${r.TP.user?.name}) ???`;f.Authorization=`Bearer ${d}`}return(0,t.s)((0,o.AI)().fetch({url:this.url+"/"+l+"/body",method:"GET",headers:f}).pipe((0,n.T)(d=>({dashboard:d.data.dashboard,meta:{isSnapshot:!0,canSave:!1,canEdit:!1,canAdmin:!1,canStar:!1,canShare:!1,canDelete:!1,isFolder:!1,provisioned:!1}}))))}}function c(){return s.$.featureToggles.kubernetesSnapshots?new u:g}},74856:(Q,A,e)=>{"use strict";e.d(A,{jG:()=>C});var t=e(2543),n=e(47232),o=e(43127),s=e(65879),r=e(26272),g=e(85858),u=e(12131),c=e(79065),i=e(76412),l=e(28138),f=e(2913),d=e(16233),h=e(80582),p=e(21380),m=e(28444),a=e(11134);function v({urlRefresh:y,currentRefresh:M,isAllowedIntervalFn:T,minRefreshInterval:I,refreshIntervals:x=a.cb}){if(!y)return M;const S=T(y),O=x.find(P=>P===y);if(!S||!O){const P=I?x.find(U=>U===I):void 0,L=x?.length?x[0]:void 0;return P??L??M}return y||M}class E{constructor(M){this.contextSrv=M,this.timeRangeForUrl=()=>{const T=this.timeRange().raw;return(0,n.Ar)(T.from)&&(T.from=T.from.valueOf().toString()),(0,n.Ar)(T.to)&&(T.to=T.to.valueOf().toString()),T},this.time=(0,o.E2)().raw,this.timeAtLoad=(0,o.E2)().raw,this.refreshTimeModel=this.refreshTimeModel.bind(this),l.A.subscribe(m.U0,T=>{this.zoomOut(T.payload.scale,T.payload.updateUrl)}),l.A.subscribe(m.Io,T=>{this.shiftTime(T.payload.direction,T.payload.updateUrl)}),l.A.subscribe(m.Rh,T=>{this.makeAbsoluteTime(T.payload.updateUrl)}),l.A.subscribe(m.Bt,()=>{this.copyTimeRangeToClipboard()}),l.A.subscribe(m.VZ,T=>{this.pasteTimeRangeFromClipboard(T.payload.updateUrl)}),document.addEventListener("visibilitychange",()=>{this.autoRefreshBlocked&&document.visibilityState==="visible"&&(this.autoRefreshBlocked=!1,this.refreshTimeModel())})}init(M){this.timeModel=M,this.time=M.time,this.refresh=M.refresh,this.initTimeFromUrl(),this.parseTime(),this.timeAtLoad=(0,t.cloneDeep)(this.time),this.refresh&&this.setAutoRefresh(this.refresh)}getValidIntervals(M){return this.contextSrv.getValidIntervals(M)}parseTime(){(0,t.isString)(this.time.from)&&this.time.from.indexOf("Z")>=0&&(this.time.from=(0,n.KQ)(this.time.from).utc()),(0,t.isString)(this.time.to)&&this.time.to.indexOf("Z")>=0&&(this.time.to=(0,n.KQ)(this.time.to).utc())}parseUrlParam(M){if(M.indexOf("now")!==-1)return M;if(M.length===8){const T=(0,n.yT)(M,"YYYYMMDD");if(T.isValid())return T}else if(M.length===15){const T=(0,n.yT)(M,"YYYYMMDDTHHmmss");if(T.isValid())return T}if(!isNaN(Number(M))){const T=parseInt(M,10);return(0,n.yT)(T)}return null}getTimeWindow(M,T){const I=parseInt(M,10);let x;return T.match(/^\d+$/)&&parseInt(T,10)?x=parseInt(T,10):x=s.intervalToMs(T),{from:(0,n.yT)(I-x/2),to:(0,n.yT)(I+x/2)}}initTimeFromUrl(){if(f.$W.publicDashboardAccessToken&&this.timeModel?.timepicker?.hidden)return;const M=u.Ny.getSearch();M.get("time")&&M.get("time.window")&&(this.time=this.getTimeWindow(M.get("time"),M.get("time.window"))),M.get("from")&&(this.time.from=this.parseUrlParam(M.get("from"))||this.time.from),M.get("to")&&(this.time.to=this.parseUrlParam(M.get("to"))||this.time.to),M.get("to")&&M.get("to").indexOf("now")===-1&&(this.refresh=!1,this.timeModel&&(this.timeModel.refresh=void 0)),this.refresh=v({urlRefresh:M.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:f.$W.minRefreshInterval})}updateTimeRangeFromUrl(){const M=u.Ny.getSearch();if(M.get("left"))return;const T=this.timeRangeForUrl(),I=M.get("from"),x=M.get("to");I&&x?(I!==T.from||x!==T.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(M){this.timeModel&&(this.timeModel.refresh=M),this.stopAutoRefresh();const T=u.Ny.getSearchObject();if(!M){T.refresh&&u.Ny.partial({refresh:null},!0);return}let I=M,x=60*1e3;M===d.SM?x=this.getAutoRefreshInteval().intervalMs:(I=this.contextSrv.getValidInterval(M),x=s.intervalToMs(I)),this.refreshMS=x,this.refreshTimer=window.setTimeout(()=>{this.startNextRefreshTimer(x),this.refreshTimeModel()},x),T.refresh!==I&&u.Ny.partial({refresh:I},!0)}getAutoRefreshInteval(){const M=window?.innerWidth??2e3;return s.calculateInterval(this.timeRange(),M,f.$W.minRefreshInterval)}refreshTimeModel(){this.timeModel?.timeRangeUpdated(this.timeRange())}startNextRefreshTimer(M){this.refreshTimer=window.setTimeout(()=>{this.startNextRefreshTimer(M),this.contextSrv.isGrafanaVisible()?this.refreshTimeModel():this.autoRefreshBlocked=!0},M)}stopAutoRefresh(){clearTimeout(this.refreshTimer),this.refreshTimer=void 0,this.refreshMS=void 0}resumeAutoRefresh(){this.timeModel?.refresh&&this.setAutoRefresh(this.timeModel.refresh)}setTime(M,T=!0){if((0,t.extend)(this.time,M),(0,n.Ar)(M.to)?(this.oldRefresh=this.timeModel?.refresh||this.oldRefresh,this.setAutoRefresh("")):this.oldRefresh&&this.oldRefresh!==this.timeModel?.refresh&&(this.setAutoRefresh(this.oldRefresh),this.oldRefresh=void 0),T===!0){const I=this.timeRangeForUrl(),x=u.Ny.getSearchObject();if(x.from===I.from.toString()&&x.to===I.to.toString())return;x.from=I.from.toString(),x.to=I.to.toString(),u.Ny.partial(x)}this.timeModel?.refresh===d.SM&&this.getAutoRefreshInteval().intervalMs!==this.refreshMS&&this.setAutoRefresh(d.SM),this.refreshTimeModel()}timeRange(){return window.__grafanaSceneContext&&window.__grafanaSceneContext.isActive?c.jh.getTimeRange(window.__grafanaSceneContext).state.value:(0,p.z)(this.time,this.timeModel)}zoomOut(M,T=!0){const I=this.timeRange(),{from:x,to:S}=(0,h.Zk)(I,M);this.setTime({from:(0,n.yT)(x),to:(0,n.yT)(S)},T)}shiftTime(M,T=!0){const I=this.timeRange(),{from:x,to:S}=(0,h.Wb)(M,I);this.setTime({from:(0,n.yT)(x),to:(0,n.yT)(S)},T)}makeAbsoluteTime(M){const{from:T,to:I}=this.timeRange();this.setTime({from:T,to:I},M)}copyTimeRangeToClipboard(){const{raw:M}=this.timeRange();navigator.clipboard.writeText(JSON.stringify({from:M.from,to:M.to})),l.A.emit(r.r1.alertSuccess,[(0,i.t)("time-picker.copy-paste.copy-success-message","Time range copied to clipboard")])}async pasteTimeRangeFromClipboard(M=!0){const{range:T,isError:I}=await(0,h.zG)();if(I===!0){l.A.emit(r.r1.alertError,[(0,i.t)("time-picker.copy-paste.default-error-title","Invalid time range"),(0,i.t)("time-picker.copy-paste.default-error-message","{{error}} is not a valid time range",{error:T})]);return}const{from:x,to:S}=T;this.setTime({from:x,to:S},M)}isRefreshOutsideThreshold(M,T=.05){const I=this.timeRange();if(g.isMathString(I.raw.from)){const x=I.to.diff(I.from),S=Date.now()-M,O=x*T;return S>=O}return!1}}let D;function b(y){D=y}function C(){return D||(D=new E(d.TP)),D}},79056:(Q,A,e)=>{"use strict";e.d(A,{O2:()=>H,SW:()=>w,og:()=>j});var t=e(2543),n=e(69550),o=e(92041),s=e(22391),r=e(76885),g=e(6709),u=e(25019),c=e(47737),i=e(1173),l=e(11261),f=e(6829),d=e(58140),h=e(19347),p=e(52622),m=e(77659),a=e(33919),v=e(2913),E=e(15054);function D(te){return Array.from(new Array(te+1),(oe,ue)=>ue).filter(oe=>te%oe===0)}var b=e(68576),C=e(31193),y=e(24240),M=e(86886),T=e(14678),I=e(14738),x=e(36373),S=e(77789),O=e(25640);function P(te,oe){const ue=[];if(te?.statistics&&te?.statistics.length){te.statistic=te.statistics[0];for(const ie of te.statistics.splice(1))ue.push({...te,statistic:ie})}for(const ie of ue)ie.refId=(0,S.M)(oe),delete ie.statistics,oe.push(ie);return delete te.statistics,ue}function L(te){const oe=[];if(te&&"statistics"in te&&te?.statistics?.length){for(const ue of te.statistics.splice(1)){const{statistics:ie,name:ge,...he}=te;oe.push({...he,statistic:ue,name:`${ge} - ${ue}`})}te.statistic=te.statistics[0],oe.length!==0&&(te.name=`${te.name} - ${te.statistic}`),delete te.statistics}return oe}function U(te){te.hasOwnProperty("metricQueryType")||(te.metricQueryType=O.d$.Search),te.hasOwnProperty("metricEditorMode")||(te.metricQueryType===O.d$.Query?te.metricEditorMode=O.Rx.Code:te.metricEditorMode=te.expression?O.Rx.Code:O.Rx.Builder)}var R=e(80484),B=e(84423);n.D.setInit(a.H),n.G.setInit(a.u);const H=39;class w{constructor(oe){this.dashboard=oe,(0,h.l)()||(0,h.h)(new C.xq)}updateSchema(oe){let ue,ie,ge,he;const De=this.dashboard.schemaVersion,pe=[];if(this.dashboard.schemaVersion=H,De!==this.dashboard.schemaVersion){if(De<2&&(oe.services&&oe.services.filter&&(this.dashboard.time=oe.services.filter.time,this.dashboard.templating.list=oe.services.filter.list||[]),pe.push(le=>(le.type==="graphite"&&(le.type="graph"),le.type!=="graph"||((0,t.isBoolean)(le.legend)&&(le.legend={show:le.legend}),le.grid&&(le.grid.min&&(le.grid.leftMin=le.grid.min,delete le.grid.min),le.grid.max&&(le.grid.leftMax=le.grid.max,delete le.grid.max)),le.y_format&&(le.y_formats||(le.y_formats=[]),le.y_formats[0]=le.y_format,delete le.y_format),le.y2_format&&(le.y_formats||(le.y_formats=[]),le.y_formats[1]=le.y2_format,delete le.y2_format)),le))),De<3){let le=this.dashboard.getNextPanelId();pe.push(Te=>(Te.id||(Te.id=le,le+=1),Te))}if(De<4&&pe.push(le=>(le.type!=="graph"||((0,t.each)(le.aliasYAxis,(Te,Ee)=>{le.seriesOverrides=[{alias:Ee,yaxis:Te}]}),delete le.aliasYAxis),le)),De<6){const le=(0,t.find)(oe.pulldowns,{type:"annotations"});for(le&&(this.dashboard.annotations={list:le.annotations||[]}),ue=0;ue<this.dashboard.templating.list.length;ue++){const Te=this.dashboard.templating.list[ue];Te.datasource===void 0&&(Te.datasource=null),Te.type==="filter"&&(Te.type="query"),Te.type===void 0&&(Te.type="query"),Te.allFormat===void 0&&delete Te.allFormat}}if(De<7&&(oe.nav&&oe.nav.length&&(this.dashboard.timepicker=oe.nav[0]),pe.push(le=>((0,t.each)(le.targets,Te=>{Te.refId||(Te.refId=le.getNextQueryLetter&&le.getNextQueryLetter())}),le))),De<8&&pe.push(le=>((0,t.each)(le.targets,Te=>{Te.fields&&Te.tags&&Te.groupBy&&(Te.rawQuery?(delete Te.fields,delete Te.fill):(Te.select=(0,t.map)(Te.fields,Ee=>{const Re=[];return Re.push({type:"field",params:[Ee.name]}),Re.push({type:Ee.func,params:[]}),Ee.mathExpr&&Re.push({type:"math",params:[Ee.mathExpr]}),Ee.asExpr&&Re.push({type:"alias",params:[Ee.asExpr]}),Re}),delete Te.fields,(0,t.each)(Te.groupBy,Ee=>{Ee.type==="time"&&Ee.interval&&(Ee.params=[Ee.interval],delete Ee.interval),Ee.type==="tag"&&Ee.key&&(Ee.params=[Ee.key],delete Ee.key)}),Te.fill&&(Te.groupBy.push({type:"fill",params:[Te.fill]}),delete Te.fill)))}),le)),De<9&&pe.push(le=>{if(le.type!=="singlestat"&&le.thresholds!=="")return le;if(le.thresholds){const Te=le.thresholds.split(",");Te.length>=3&&(Te.shift(),le.thresholds=Te.join(","))}return le}),De<10&&pe.push(le=>(le.type!=="table"||(0,t.each)(le.styles,Te=>{if(Te.thresholds&&Te.thresholds.length>=3){const Ee=Te.thresholds;Ee.shift(),Te.thresholds=Ee}}),le)),De<12&&(0,t.each)(this.dashboard.getVariables(),le=>{"refresh"in le&&(le.refresh&&(le.refresh=1),le.refresh||(le.refresh=0)),"hideVariable"in le&&le.hideVariable?le.hide=2:"hideLabel"in le&&le.hideLabel&&(le.hide=1)}),De<12&&pe.push(le=>(le.type!=="graph"||!le.grid||le.yaxes||(le.yaxes=[{show:le["y-axis"],min:le.grid.leftMin,max:le.grid.leftMax,logBase:le.grid.leftLogBase,format:le.y_formats[0],label:le.leftYAxisLabel},{show:le["y-axis"],min:le.grid.rightMin,max:le.grid.rightMax,logBase:le.grid.rightLogBase,format:le.y_formats[1],label:le.rightYAxisLabel}],le.xaxis={show:le["x-axis"]},delete le.grid.leftMin,delete le.grid.leftMax,delete le.grid.leftLogBase,delete le.grid.rightMin,delete le.grid.rightMax,delete le.grid.rightLogBase,delete le.y_formats,delete le.leftYAxisLabel,delete le.rightYAxisLabel,delete le["y-axis"],delete le["x-axis"]),le)),De<13&&pe.push(le=>{if(le.type!=="graph"||!le.grid)return le;le.thresholds||(le.thresholds=[]);const Te={},Ee={};return le.grid.threshold1!==null&&(Te.value=le.grid.threshold1,le.grid.thresholdLine?(Te.line=!0,Te.lineColor=le.grid.threshold1Color,Te.colorMode="custom"):(Te.fill=!0,Te.fillColor=le.grid.threshold1Color,Te.colorMode="custom")),le.grid.threshold2!==null&&(Ee.value=le.grid.threshold2,le.grid.thresholdLine?(Ee.line=!0,Ee.lineColor=le.grid.threshold2Color,Ee.colorMode="custom"):(Ee.fill=!0,Ee.fillColor=le.grid.threshold2Color,Ee.colorMode="custom")),(0,t.isNumber)(Te.value)&&((0,t.isNumber)(Ee.value)?Te.value>Ee.value?(Te.op=Ee.op="lt",le.thresholds.push(Te),le.thresholds.push(Ee)):(Te.op=Ee.op="gt",le.thresholds.push(Te),le.thresholds.push(Ee)):(Te.op="gt",le.thresholds.push(Te))),delete le.grid.threshold1,delete le.grid.threshold1Color,delete le.grid.threshold2,delete le.grid.threshold2Color,delete le.grid.thresholdLine,le}),De<14&&(this.dashboard.graphTooltip=oe.sharedCrosshair?1:0),De<16&&this.upgradeToGridLayout(oe),De<17&&pe.push(le=>{if(le.minSpan){const Te=E.cV/le.minSpan,Ee=D(E.cV);le.maxPerRow=Ee[(0,t.findIndex)(Ee,Re=>Re>Te)-1]}return delete le.minSpan,le}),De<18&&pe.push(le=>(le["options-gauge"]&&(le.options=le["options-gauge"],le.options.valueOptions={unit:le.options.unit,stat:le.options.stat,decimals:le.options.decimals,prefix:le.options.prefix,suffix:le.options.suffix},le.options.thresholds&&le.options.thresholds.reverse(),delete le.options.options,delete le.options.unit,delete le.options.stat,delete le.options.decimals,delete le.options.prefix,delete le.options.suffix,delete le["options-gauge"]),le)),De<19&&pe.push(le=>(le.links&&(0,t.isArray)(le.links)&&(le.links=le.links.map(G)),le)),De<20){const le=Te=>({...Te,url:_(Te.url)});pe.push(Te=>(Te.options&&Te.options.dataLinks&&(0,t.isArray)(Te.options.dataLinks)&&(Te.options.dataLinks=Te.options.dataLinks.map(le)),Te.options&&Te.options.fieldOptions&&Te.options.fieldOptions.defaults&&(Te.options.fieldOptions.defaults.links&&(0,t.isArray)(Te.options.fieldOptions.defaults.links)&&(Te.options.fieldOptions.defaults.links=Te.options.fieldOptions.defaults.links.map(le)),Te.options.fieldOptions.defaults.title&&(Te.options.fieldOptions.defaults.title=_(Te.options.fieldOptions.defaults.title))),Te))}if(De<21){const le=Te=>({...Te,url:Te.url.replace(/__series.labels/g,"__field.labels")});pe.push(Te=>(Te.options&&Te.options.dataLinks&&(0,t.isArray)(Te.options.dataLinks)&&(Te.options.dataLinks=Te.options.dataLinks.map(le)),Te.options&&Te.options.fieldOptions&&Te.options.fieldOptions.defaults&&Te.options.fieldOptions.defaults.links&&(0,t.isArray)(Te.options.fieldOptions.defaults.links)&&(Te.options.fieldOptions.defaults.links=Te.options.fieldOptions.defaults.links.map(le)),Te))}if(De<22&&pe.push(le=>(le.type!=="table"||(0,t.each)(le.styles,Te=>{Te.align="auto"}),le)),De<23)for(const le of this.dashboard.templating.list){if(!(0,y.iv)(le))continue;const{multi:Te,current:Ee}=le;(0,o.R)(Ee)||(le.current=(0,M.C)(Ee,Te))}if(De<24&&pe.push(le=>{const Te=le.type==="table";if(Te&&!le.styles)return le;const Ee=le.table==="table2";return!Te||Ee||(le.type=Te?"table-old":"table"),le}),De<25,De<26&&pe.push(le=>(le.type==="text2"&&(le.type="text",delete le.options.angular),le)),De<27&&(this.removeRepeatedPanels(),this.dashboard.templating.list=this.dashboard.templating.list.map(le=>{if(!(0,y.VO)(le))return le;const Te={...le};return Te.current={selected:!0,text:Te.query??"",value:Te.query??""},Te.options=[Te.current],Te.hide===R.zL.dontHide||Te.hide===R.zL.hideLabel?{...Te,type:"textbox"}:Te})),De<28){pe.push(le=>le.type==="singlestat"?K(le):le);for(const le of this.dashboard.templating.list)le.tags&&delete le.tags,le.tagsQuery&&delete le.tagsQuery,le.tagValuesQuery&&delete le.tagValuesQuery,le.useTags&&delete le.useTags}if(De<29)for(const le of this.dashboard.templating.list)le.type==="query"&&(le.refresh!==1&&le.refresh!==2&&(le.refresh=1),le.options?.length&&(le.options=[]));if(De<30&&(pe.push(Y),pe.push(ne)),De<31&&pe.push(le=>{if(le.transformations){for(const Te of le.transformations)if(Te.id===f.V.id)return k(le,f.V.id,{id:d.o.id,options:{}})}return le}),De<32,De<33&&pe.push(le=>{if(le.datasource=j(le.datasource,{returnDefaultAsNull:!0}),!le.targets)return le;for(const Te of le.targets){const Ee=j(Te.datasource,{returnDefaultAsNull:!0});Ee!=null&&(Te.datasource=Ee)}return le}),De<34&&(pe.push(le=>(this.migrateCloudWatchQueries(le),le)),this.migrateCloudWatchAnnotationQuery()),De<35&&pe.push(q),De<36){for(const Te of this.dashboard.annotations.list)Te.datasource=j(Te.datasource,{returnDefaultAsNull:!1});const le=(0,h.l)().getInstanceSettings(null);if(le){for(const Te of this.dashboard.templating.list)Te.type==="query"&&Te.datasource===null&&(Te.datasource=(0,s.p$)(le));pe.push(Te=>{if(Te.targets){let Ee=!1;Te.datasource==null&&Te.targets.length>0&&(Te.datasource=(0,s.p$)(le),Ee=!0);for(const Re of Te.targets)(Re.datasource==null||Re.datasource.uid==null)&&(Te.datasource?.uid!==T.uv?Re.datasource={...Te.datasource}:Re.datasource=j(Re.datasource,{returnDefaultAsNull:!1})),Ee&&Re.datasource?.uid!=="__expr__"&&(Te.datasource=Re.datasource)}return Te})}}if(De<37&&pe.push(le=>(le.options?.legend&&(le.options.legend.displayMode==="hidden"||le.options.legend.showLegend===!1)?(le.options.legend.displayMode="list",le.options.legend.showLegend=!1):le.options?.legend&&(le.options.legend={...le.options?.legend,showLegend:!0}),le)),De<38&&pe.push(le=>{if(le.type==="table"&&le.fieldConfig!==void 0){const Te=le.fieldConfig.defaults?.custom?.displayMode;if(Te!==void 0&&(le.fieldConfig.defaults.custom.cellOptions=(0,m.o7)(Te),delete le.fieldConfig.defaults.custom.displayMode),le.fieldConfig?.overrides)for(const Ee of le.fieldConfig.overrides)for(let Re=0;Re<Ee.properties?.length;Re++){let me=Ee.properties[Re].value;Ee.properties[Re].id==="custom.displayMode"&&(Ee.properties[Re].id="custom.cellOptions",Ee.properties[Re].value=(0,m.o7)(me))}}return le}),De<39&&pe.push(le=>(le.transformations?.forEach(Te=>{if(Te.id==="timeSeriesTable"&&Te.options!==void 0&&Te.options.refIdToStat!==void 0){let Ee={};for(const[Re,me]of Object.entries(Te.options.refIdToStat)){let Me={};Me.stat=me,Ee[Re]=Me}Te.options=Ee}}),le)),pe.length!==0)for(ie=0;ie<this.dashboard.panels.length;ie++)for(ge=0;ge<pe.length;ge++){this.dashboard.panels[ie]=pe[ge].call(this,this.dashboard.panels[ie]);const le=this.dashboard.panels[ie].panels;if(le)for(he=0;he<le.length;he++)le[he]=pe[ge].call(this,le[he])}}}removeRepeatedPanels(){const oe=[];for(const ue of this.dashboard.panels)ue.repeatPanelId||ue.repeatByRow||(ue.type==="row"&&Array.isArray(ue.panels)&&(ue.panels=ue.panels.filter(ie=>!ie.repeatPanelId)),oe.push(ue));this.dashboard.panels=oe}migrateCloudWatchQueries(oe){for(const ue of oe.targets||[])if(ee(ue)&&(U(ue),ue.hasOwnProperty("statistics"))){const ie=P(ue,[...oe.targets]);for(const ge of ie)oe.targets.push(ge)}}migrateCloudWatchAnnotationQuery(){for(const oe of this.dashboard.annotations.list)if(re(oe)){const ue=L(oe);for(const ie of ue)this.dashboard.annotations.list.push(ie)}}upgradeToGridLayout(oe){let ue=0;const ie=E.cV/12;let he=(0,t.max)((0,t.flattenDeep)((0,t.map)(oe.rows,pe=>(0,t.map)(pe.panels,"id"))))+1;if(!oe.rows)return;const De=(0,t.some)(oe.rows,pe=>pe.collapse||pe.showTitle||pe.repeat);for(const pe of oe.rows){if(pe.repeatIteration)continue;const le=pe.height||E.bJ,Te=N(le),Ee={};let Re;De&&(Ee.id=he,Ee.type="row",Ee.title=pe.title,Ee.collapsed=pe.collapse,Ee.repeat=pe.repeat,Ee.panels=[],Ee.gridPos={x:0,y:ue,w:E.cV,h:Te},Re=new B.a9(Ee),he++,ue++);const me=new V(Te,E.cV,ue);for(const Me of pe.panels){Me.span=Me.span||E.o9,Me.minSpan&&(Me.minSpan=Math.min(E.cV,E.cV/12*Me.minSpan));const ye=Math.floor(Me.span)*ie,Le=Me.height?N(Me.height):Te,We=me.getPanelPosition(Le,ye);ue=me.yPos,Me.gridPos={x:We.x,y:ue+We.y,w:ye,h:Le},me.addPanel(Me.gridPos),delete Me.span,Re&&Ee.collapsed?Re.panels?.push(Me):this.dashboard.panels.push(new B.a9(Me))}Re&&this.dashboard.panels.push(Re),Re&&Ee.collapsed||(ue+=Te)}}}function N(te){return(0,t.isString)(te)&&(te=parseInt(te.replace("px",""),10)),te<E.cx&&(te=E.cx),Math.ceil(te/(E.sD+E.dU))}class V{constructor(oe,ue=E.cV,ie=0){this.area=new Array(ue).fill(0),this.yPos=ie,this.height=oe}reset(){this.area.fill(0)}addPanel(oe){for(let ue=oe.x;ue<oe.x+oe.w;ue++)(!this.area[ue]||oe.y+oe.h-this.yPos>this.area[ue])&&(this.area[ue]=oe.y+oe.h-this.yPos);return this.area}getPanelPosition(oe,ue,ie=!1){let ge,he,De;for(let pe=this.area.length-1;pe>=0&&this.height-this.area[pe]>0;pe--)if(he===void 0)he=pe;else if(pe<this.area.length-1&&this.area[pe]<=this.area[pe+1])ge=pe;else break;if(ge!==void 0&&he!==void 0&&he-ge>=ue-1){const pe=(0,t.max)(this.area.slice(ge));De={x:ge,y:pe}}else return ie?null:(this.yPos+=this.height,this.reset(),this.getPanelPosition(oe,ue,!0));return De}}function G(te){let oe=te.url;return!oe&&te.dashboard&&(oe=`dashboard/db/${b.A.slugifyForUrl(te.dashboard)}`),!oe&&te.dashUri&&(oe=`dashboard/${te.dashUri}`),oe||(oe="/"),te.keepTime&&(oe=r.kM.appendQueryToUrl(oe,`$${g.c.keepTime}`)),te.includeVars&&(oe=r.kM.appendQueryToUrl(oe,`$${g.c.includeVars}`)),te.params&&(oe=r.kM.appendQueryToUrl(oe,te.params)),{url:oe,title:te.title,targetBlank:te.targetBlank}}function _(te){const oe=/(__series_name)|(\$__series_name)|(__value_time)|(__field_name)|(\$__field_name)/g;return te.replace(oe,(ue,ie,ge,he,De,pe)=>ie?"__series.name":ge?"${__series.name}":he?"__value.time":De?"__field.name":pe?"${__field.name}":ue)}function K(te){if(v.$W.panels["grafana-singlestat-panel"])return te.type="grafana-singlestat-panel",te;let oe=!1;return te.changePlugin||(oe=!0,te=new B.a9(te)),te.plugin={angularPanelCtrl:{}},te.gauge?.show?(I.plugin.meta=v.$W.panels.gauge,te.changePlugin(I.plugin)):(x.plugin.meta=v.$W.panels.stat,te.changePlugin(x.plugin)),oe?te.getSaveModel():te}function j(te,oe){if(oe.returnDefaultAsNull&&(te==null||te==="default"))return null;if((0,s.fN)(te))return te;const ue=(0,h.l)().getInstanceSettings(te);return ue?(0,s.p$)(ue):{uid:te||void 0}}function k(te,oe,ue){if(te.transformations){const ie=[];for(const ge of te.transformations)ie.push(ge),ge.id===oe&&ie.push({...ue});te.transformations=ie}return te}function Y(te){const oe=te.fieldConfig;if(!oe)return te;if(oe.defaults&&oe.defaults.mappings&&(oe.defaults.mappings=J(oe.defaults.mappings,oe.defaults.thresholds)),Array.isArray(oe.overrides))for(const ue of oe.overrides)for(const ie of ue.properties)ie.id==="mappings"&&(ie.value=J(ie.value));return te}function ee(te){return te.hasOwnProperty("dimensions")&&te.hasOwnProperty("namespace")&&te.hasOwnProperty("region")&&te.hasOwnProperty("metricName")}function re(te){return te.hasOwnProperty("dimensions")&&te.hasOwnProperty("namespace")&&te.hasOwnProperty("region")&&te.hasOwnProperty("prefixMatching")&&te.hasOwnProperty("statistics")}function J(te,oe){if(!te)return;const ue={type:u.d.ValueToText,options:{}},ie=[];for(const ge of te){if(ge.type&&ge.options){ge.type===u.d.ValueToText?ue.options={...ue.options,...ge.options}:ie.push(ge);continue}let he;const De=parseFloat(ge.text);if(oe&&!isNaN(De)){const pe=(0,c.yQ)(De,oe.steps);pe&&pe.color&&(he=pe.color)}switch(ge.type){case 1:ge.value!=null&&(ge.value==="null"?ie.push({type:u.d.SpecialValue,options:{match:u.W.Null,result:{text:ge.text,color:he}}}):ue.options[String(ge.value)]={text:ge.text,color:he});break;case 2:ie.push({type:u.d.RangeToText,options:{from:+ge.from,to:+ge.to,result:{text:ge.text,color:he}}});break}}return Object.keys(ue.options).length>0&&ie.unshift(ue),ie}function ne(te){return(te.type==="timeseries"||te.type==="xychart")&&te.options.tooltipOptions&&(te.options={...te.options,tooltip:te.options.tooltipOptions},delete te.options.tooltipOptions),te}function q(te){return te.type==="timeseries"&&te.fieldConfig?.defaults.custom?.axisPlacement===p.vM.Hidden&&(te.fieldConfig={...te.fieldConfig,overrides:[...te.fieldConfig.overrides,{matcher:{id:i.Ct.byType,options:l.PU.time},properties:[{id:"custom.axisPlacement",value:p.vM.Auto}]}]}),te}},98365:(Q,A,e)=>{"use strict";e.d(A,{G:()=>B});var t=e(2543),n=e(64423),o=e(18226),s=e(72724),r=e(47232),g=e(32264),u=e(3591),c=e(24284),i=e(15054),l=e(16233),f=e(28874),d=e(8480),h=e(20601),p=e(72401),m=e(87421),a=e(80348),v=e(28444),E=e(10096),D=e(99140),b=e(80484),C=e(75096),y=e(74856),M=e(34214);const T=new Set(["gridPos","title","description","transparent"]);function I(N,V){const G=[],_={changed:!1,actions:{add:[],remove:[],replace:[],update:[],noop:[]},panels:G};let K=0;const j=new Map;for(let k of V){let{id:Y}=k;Y||(K||(K=S([N,V])),Y=K++,k={...k,id:Y}),j.set(Y,k)}for(const k of N){const Y=j.get(k.id);if(!Y){_.changed=!0,_.actions.remove.push(k.id),k.destroy();continue}if(j.delete(k.id),Y===k){G.push(k),_.actions.noop.push(k.id);continue}if(k.type===Y.type){const re=k.getSaveModel();let J=!0,ne=!1;for(const[q,te]of Object.entries(Y))if(!(0,t.isEqualWith)(te,re[q],x))if(_.changed=!0,J=!1,T.has(q))k[q]=te,ne=!0;else{ne=!1;break}if(J){G.push(k),_.actions.noop.push(k.id);continue}if(ne){G.push(k),_.actions.update.push(k.id);continue}}k.destroy();const ee=new M.a(Y);ee.key=`${ee.id}-update-${Date.now()}`,G.push(ee),_.changed=!0,_.actions.replace.push(k.id)}for(const k of j.values())G.push(new M.a(k)),_.changed=!0,_.actions.add.push(k.id);return _}function x(N,V){if(N==null&&(V===1/0||V===-1/0||V==null)||V==null&&(N===1/0||N===-1/0||N==null))return!0}function S(N){let V=0;for(const G of N)for(const _ of G)_.id>V&&(V=_.id);return V+1}var O=e(79056),P=e(84423);function L(N,V){return N.repeatDirection===i.HG?!1:V.gridPos.x>=N.gridPos.x+N.gridPos.w&&V.gridPos.y===N.gridPos.y}function U(N){for(const V of N)if(delete V.scopedVars,V.panels?.length)for(const G of V.panels)delete G.scopedVars}const R=class{constructor(N,V,G){this.timeRangeUpdatedDuringEdit=!1,this.originalDashboard=null,this.getVariablesFromState=G?.getVariablesFromState??m.SS,this.events=new o.o,this.id=N.id||null,this.uid=N.uid||null,this.revision=N.revision??void 0,this.title=N.title??"No Title",this.description=N.description,this.tags=N.tags??[],this.timezone=N.timezone??"",this.weekStart=N.weekStart??"",this.editable=N.editable!==!1,this.graphTooltip=N.graphTooltip||0,this.time=N.time??{from:"now-6h",to:"now"},this.timepicker=N.timepicker??{},this.liveNow=N.liveNow,this.templating=this.ensureListExist(N.templating),this.annotations=this.ensureListExist(N.annotations),this.refresh=N.refresh,this.snapshot=N.snapshot,this.schemaVersion=N.schemaVersion??0,this.fiscalYearStartMonth=N.fiscalYearStartMonth??0,this.version=N.version??0,this.links=N.links??[],this.gnetId=N.gnetId||null,this.panels=(0,t.map)(N.panels??[],j=>new P.a9(j)),this.originalDashboard=(0,t.cloneDeep)(N),this.originalTemplating=(0,t.cloneDeep)(this.templating),this.originalTime=(0,t.cloneDeep)(this.time),this.ensurePanelsHaveUniqueIds(),this.formatDate=this.formatDate.bind(this),this.initMeta(V),this.updateSchema(N);const _=G?.autoMigrateOldPanels||!g.$.angularSupportEnabled||g.$.featureToggles.autoMigrateOldPanels,K=g.$.featureToggles.autoMigrateGraphPanel||g.$.featureToggles.autoMigrateTablePanel||g.$.featureToggles.autoMigratePiechartPanel||g.$.featureToggles.autoMigrateWorldmapPanel||g.$.featureToggles.autoMigrateStatPanel;if(_||K)for(const j of this.panelIterator())!j.autoMigrateFrom&&j.type==="graph"&&(g.$.featureToggles.autoMigrateGraphPanel||_)?(j.autoMigrateFrom=j.type,j.type="timeseries"):!j.autoMigrateFrom&&j.type==="table-old"&&(g.$.featureToggles.autoMigrateTablePanel||_)?(j.autoMigrateFrom=j.type,j.type="table"):!j.autoMigrateFrom&&j.type==="grafana-piechart-panel"&&(g.$.featureToggles.autoMigratePiechartPanel||_)?(j.autoMigrateFrom=j.type,j.type="piechart"):!j.autoMigrateFrom&&j.type==="grafana-worldmap-panel"&&(g.$.featureToggles.autoMigrateWorldmapPanel||_)?(j.autoMigrateFrom=j.type,j.type="geomap"):!j.autoMigrateFrom&&(j.type==="singlestat"||j.type==="grafana-singlestat-panel")&&(g.$.featureToggles.autoMigrateStatPanel||_)&&(j.autoMigrateFrom=j.type,j.type="stat");this.addBuiltInAnnotationQuery(),this.sortPanelsByGridPos(),this.panelsAffectedByVariableChange=null,this.appEventsSubscription=new n.yU,this.lastRefresh=Date.now(),this.appEventsSubscription.add(E.lE.subscribe(b.og,this.variablesChangedHandler.bind(this))),this.appEventsSubscription.add(E.lE.subscribe(b.BS,this.variablesTimeRangeProcessDoneHandler.bind(this))),this.appEventsSubscription.add(E.lE.subscribe(b.eF,this.variablesChangedInUrlHandler.bind(this)))}addBuiltInAnnotationQuery(){this.annotations.list.some(V=>V.builtIn===1)||this.annotations.list.unshift({datasource:{uid:"-- Grafana --",type:"grafana"},name:"Annotations & Alerts",type:"dashboard",iconColor:c.Mk,enable:!0,hide:!0,builtIn:1})}initMeta(N){N=N||{},N.canShare=N.canShare!==!1,N.canSave=N.canSave!==!1,N.canStar=N.canStar!==!1,N.canEdit=N.canEdit!==!1,N.canDelete=N.canDelete!==!1,N.showSettings=N.canEdit,N.canMakeEditable=N.canSave&&!this.editable,N.hasUnsavedFolderChange=!1,this.editable||(N.canEdit=!1,N.canDelete=!1,N.canSave=!1),this.meta=N}getSaveModelCloneOld(N){const V=(0,t.defaults)(N||{},{saveVariables:!0,saveTimerange:!0});let G={};for(const _ in this)R.nonPersistedProperties[_]||!this.hasOwnProperty(_)||(G[_]=(0,t.cloneDeep)(this[_]));return G.templating=this.getTemplatingSaveModel(V),V.saveTimerange||(G.time=this.originalTime),G.panels=this.getPanelSaveModels(),G=(0,f.v)(G),G.getVariables=()=>G.templating.list,G}getSaveModelClone(N){const V=this.getSaveModelCloneOld(N),G=JSON.stringify(V);return JSON.parse(G)}updatePanels(N){const V=I(this.panels,N??[]);return V.changed&&(this.panels=V.panels??[],this.sortPanelsByGridPos(),this.events.publish(new v.Q$)),V}getPanelSaveModels(){return this.panels.filter(N=>this.isSnapshotTruthy()||!(N.repeatPanelId||N.repeatedByRow)).map(N=>{if(N.libraryPanel){const{id:V,title:G,libraryPanel:_,gridPos:K}=N;return{id:V,title:G,gridPos:K,libraryPanel:{uid:_.uid,name:_.name}}}return this.panelInEdit&&this.panelInEdit.id===N.id?this.panelInEdit.getSaveModel():N.getSaveModel()}).map(N=>(this.isSnapshotTruthy()||(delete N.scopedVars,N.type==="row"&&N.panels&&N.panels.length>0&&(N.panels=N.panels.filter(V=>!V.repeatPanelId).map(V=>(delete V.scopedVars,V)))),N))}getTemplatingSaveModel(N){const V=this.originalTemplating?.list??[],_=this.getVariablesFromState(this.uid).map(j=>{const k=h.B.get(j.type).getSaveModel(j,N.saveVariables);if(!N.saveVariables){const Y=V.find(({name:ee,type:re})=>ee===j.name&&re===j.type);if(!Y)return k;j.type==="adhoc"?k.filters=Y.filters:(k.current=Y.current,k.options=Y.options)}return k});return{list:(0,f.v)(_)}}timeRangeUpdated(N){this.events.publish(new u.sR(N)),(0,D.JD)((0,p.RK)(this.uid,N)),this.panelInEdit&&(this.timeRangeUpdatedDuringEdit=!0)}startRefresh(N={refreshAll:!0,panelIds:[]}){if(this.events.publish(new u._),this.lastRefresh=Date.now(),this.panelInEdit&&(N.refreshAll||N.panelIds.includes(this.panelInEdit.id))){this.panelInEdit.refresh();return}const V=this.panels.filter(G=>!this.otherPanelInFullscreen(G)&&(N.refreshAll||N.panelIds.includes(G.id)));if(!this.isSnapshot())for(const G of V)G.refreshWhenInView=!0;for(const G of V)G.refresh()}render(){this.events.publish(new v.XM);for(const N of this.panels)N.render()}panelInitialized(N){const V=N.getQueryRunner().getLastResult();!this.otherPanelInFullscreen(N)&&!V&&N.refresh()}otherPanelInFullscreen(N){return(this.panelInEdit||this.panelInView)&&!(N.isViewing||N.isEditing)}initEditPanel(N){return(0,y.jG)().stopAutoRefresh(),this.panelInEdit=N.getEditClone(),this.timeRangeUpdatedDuringEdit=!1,this.panelInEdit}exitPanelEditor(){this.panelInEdit.destroy(),this.panelInEdit=void 0,(0,y.jG)().resumeAutoRefresh(),(this.panelsAffectedByVariableChange||this.timeRangeUpdatedDuringEdit)&&(this.startRefresh({panelIds:this.panelsAffectedByVariableChange??[],refreshAll:this.timeRangeUpdatedDuringEdit}),this.panelsAffectedByVariableChange=null,this.timeRangeUpdatedDuringEdit=!1)}initViewPanel(N){this.panelInView=N,N.setIsViewing(!0)}exitViewPanel(N){this.panelInView=void 0,N.setIsViewing(!1),this.refreshIfPanelsAffectedByVariableChange()}refreshIfPanelsAffectedByVariableChange(){this.panelsAffectedByVariableChange&&(this.startRefresh({panelIds:this.panelsAffectedByVariableChange,refreshAll:!1}),this.panelsAffectedByVariableChange=null)}ensurePanelsHaveUniqueIds(){const N=new Set;let V=this.getNextPanelId();for(const G of this.panelIterator())(!G.id||N.has(G.id))&&(G.id=V++),N.add(G.id)}ensureListExist(N={}){return N.list??=[],N}getNextPanelId(){let N=0;for(const V of this.panelIterator())V.id>N&&(N=V.id);return N+1}*panelIterator(){for(const N of this.panels){yield N;const V=N.panels??[];for(const G of V)yield G}}forEachPanel(N){for(let V=0;V<this.panels.length;V++)N(this.panels[V],V)}getPanelById(N,V=!1){if(this.panelInEdit&&this.panelInEdit.id===N)return this.panelInEdit;if(V){for(const G of this.panelIterator())if(G.id===N)return G;return null}else return this.panels.find(G=>G.id===N)??null}canEditPanel(N){return!!(this.meta.canEdit&&N&&!N.repeatPanelId&&N.type!=="row")}canEditPanelById(N){return this.canEditPanel(this.getPanelById(N))}addPanel(N){N.id=this.getNextPanelId(),this.panels.unshift(new P.a9(N)),this.sortPanelsByGridPos(),this.events.publish(new v.Q$)}updateMeta(N){this.meta={...this.meta,...N},this.events.publish(new v.Cf)}makeEditable(){this.editable=!0,this.updateMeta({canMakeEditable:!1,canEdit:!0,canSave:!0})}sortPanelsByGridPos(){this.panels.sort((N,V)=>N.gridPos.y===V.gridPos.y?N.gridPos.x-V.gridPos.x:N.gridPos.y-V.gridPos.y)}clearUnsavedChanges(N,V){for(const G of this.panels)G.configRev=0;this.panelInEdit&&(this.panelInEdit.hasSavedPanelEditChange=this.panelInEdit.configRev>0,this.panelInEdit.configRev=0),this.originalDashboard=N,this.originalTemplating=N.templating,V.saveTimerange&&(this.originalTime=N.time)}hasUnsavedChanges(){return!!this.panels.find(V=>V.hasChanged)}cleanUpRepeats(){if(this.isSnapshotTruthy()||!this.hasVariables())return;U(this.panels);const N=this.panels.filter(V=>(!V.repeat||V.repeatedByRow)&&V.repeatPanelId);(0,t.pull)(this.panels,...N),N.map(V=>V.destroy()),this.sortPanelsByGridPos()}processRepeats(){if(!(this.isSnapshotTruthy()||!this.hasVariables()||this.panelInView)){this.cleanUpRepeats();for(let N=0;N<this.panels.length;N++){const V=this.panels[N];V.repeat&&this.repeatPanel(V,N)}this.sortPanelsByGridPos(),this.events.publish(new v.Q$)}}cleanUpRowRepeats(N){const V=N.map(_=>_.id),G=N.filter(_=>!_.repeat&&_.repeatPanelId&&V.includes(_.repeatPanelId));(0,t.pull)(N,...G),(0,t.pull)(this.panels,...G)}processRowRepeats(N){if(this.isSnapshotTruthy()||!this.hasVariables())return;let V=N.panels??[];if(!N.collapsed){const G=this.panels.findIndex(_=>_.id===N.id);V=this.getRowPanels(G)}this.cleanUpRowRepeats(V);for(const G of V)if(G.repeat){const _=this.panels.findIndex(K=>K.id===G.id);this.repeatPanel(G,_)}}getPanelRepeatClone(N,V,G){if(V===0)return N;const _=N.getSaveModel();_.id=this.getNextPanelId();const K=new P.a9(_);return this.panels.splice(G+V,0,K),K.repeatPanelId=N.id,K.repeat=void 0,this.panelInView?.id===K.id&&(K.setIsViewing(!0),this.panelInView=K),K}getRowRepeatClone(N,V,G){if(V===0){if(!N.collapsed){const k=this.getRowPanels(G);N.panels=k}return N}const _=new P.a9(N.getSaveModel());let K,j;return N.collapsed?(K=(0,t.cloneDeep)(N.panels)??[],_.panels=K,j=G+V):(K=this.getRowPanels(G),_.panels=K.map(k=>k.getSaveModel()),j=G+(K.length+1)*V),this.panels.splice(j,0,_),this.updateRepeatedPanelIds(_),_}repeatPanel(N,V){const G=this.getPanelRepeatVariable(N);if(!G)return;if(N.type==="row"){this.repeatRow(N,V,G);return}const _=this.getSelectedVariableOptions(G),K=N.maxPerRow||4;let j=0,k=N.gridPos.y;for(let ee=0;ee<_.length;ee++){const re=_[ee];let J;J=this.getPanelRepeatClone(N,ee,V),J.scopedVars??={},J.scopedVars[G.name]=re,N.repeatDirection===i.Pz?(ee>0&&(k+=J.gridPos.h),J.gridPos.y=k):(J.gridPos.w=Math.max(i.cV/_.length,i.cV/K),J.gridPos.x=j,J.gridPos.y=k,j+=J.gridPos.w,j+J.gridPos.w>i.cV&&(j=0,k+=J.gridPos.h))}const Y=k-N.gridPos.y;if(Y>0){const ee=V+_.length;for(const re of this.panels.slice(ee))L(N,re)||(re.gridPos.y+=Y)}}repeatRow(N,V,G){const _=this.getSelectedVariableOptions(G);for(let K=0;K<_.length;K++){const j=_[K],k=this.getRowRepeatClone(N,K,V);w(k,G,j);const Y=this.getRowHeight(k),ee=k.panels||[];let re;if(N.collapsed){for(const J of ee)w(J,G,j),K>0&&this.updateRepeatedPanelIds(J,!0);k.gridPos.y+=K,re=V+K+1}else{const J=V+(ee.length+1)*K+1;ee.forEach((ne,q)=>{if(w(ne,G,j),K>0){const te=new P.a9(ne);this.updateRepeatedPanelIds(te,!0),te.gridPos.y+=Y*K,this.panels.splice(J+q,0,te)}}),k.panels=[],k.gridPos.y+=Y*K,re=J+ee.length}if(_.length>1)for(const J of this.panels.slice(re))J.gridPos.y+=Y}}updateRepeatedPanelIds(N,V){return N.repeatPanelId=N.id,N.id=this.getNextPanelId(),V?N.repeatedByRow=!0:N.repeat=void 0,N}getSelectedVariableOptions(N){let V;return(0,C.ML)(N)?V=N.options.slice(1,N.options.length):V=(0,t.filter)(N.options,{selected:!0}),V}getRowHeight(N){if(!N.panels||N.panels.length===0)return 0;if(N.collapsed)return 1;const V=(0,t.maxBy)(N.panels,({gridPos:G})=>G.y+G.h).gridPos;return V.y+V.h-N.gridPos.y}removePanel(N){this.panels=this.panels.filter(V=>V!==N),N.destroy(),this.events.publish(new v.Q$)}removeRow(N,V){(!V&&N.collapsed||V&&!N.collapsed)&&this.toggleRow(N),this.removePanel(N)}expandRows(){const N=this.panels.filter(V=>V.type==="row"&&V.collapsed);for(const V of N)this.toggleRow(V)}collapseRows(){const N=this.panels.filter(V=>V.type==="row"&&!V.collapsed);for(const V of N)this.toggleRow(V)}isSubMenuVisible(){return this.links.length>0||this.getVariables().some(N=>N.hide!==2)||this.annotations.list.some(N=>!N.hide)}getPanelInfoById(N){const V=this.panels.findIndex(G=>G.id===N);return V>=0?{panel:this.panels[V],index:V}:null}duplicatePanel(N){const V=N.getSaveModel();return V.id=this.getNextPanelId(),delete V.repeat,delete V.repeatIteration,delete V.repeatPanelId,delete V.scopedVars,V.alert&&delete V.thresholds,delete V.alert,N.gridPos.x+N.gridPos.w*2<=i.cV?V.gridPos.x+=N.gridPos.w:V.gridPos.y+=N.gridPos.h,this.addPanel(V),V}formatDate(N,V){return(0,s.LE)(N,{format:V,timeZone:this.getTimezone()})}destroy(){this.appEventsSubscription.unsubscribe(),this.events.removeAllListeners();for(const N of this.panels)N.destroy()}toggleRow(N){const V=(0,t.indexOf)(this.panels,N);if(!N.collapsed){const j=this.getRowPanels(V);(0,t.pull)(this.panels,...j),N.panels=j.map(k=>k.getSaveModel()),N.collapsed=!0,j.some(k=>k.hasChanged)&&N.configRev++,this.events.publish(new v.Q$);return}N.collapsed=!1;const G=N.panels??[],_=G.some(j=>j.repeat),K=N.repeat;if(G.length>0){const k=(G[0].gridPos.y??N.gridPos.y)-(N.gridPos.y+N.gridPos.h);let Y=V+1,ee=N.gridPos.y;for(const J of G){if(K){const ne=this.getPanelRepeatVariable(N);if(J.scopedVars??={},ne){const q=this.getSelectedVariableOptions(ne);J.scopedVars={...J.scopedVars,[ne.name]:q[0]}}}J.gridPos.y??(J.gridPos.y=N.gridPos.y),J.gridPos.y-=k,this.panels.splice(Y,0,new P.a9(J)),Y+=1,ee=Math.max(ee,J.gridPos.y+J.gridPos.h)}const re=ee-N.gridPos.y-1;for(const J of this.panels.slice(Y))J.gridPos.y+=re;N.panels=[],_&&this.processRowRepeats(N)}this.sortPanelsByGridPos(),this.events.publish(new v.Q$)}getRowPanels(N){const V=this.panels.slice(N+1),G=V.findIndex(K=>K.type==="row");return V.slice(0,G>=0?G:this.panels.length)}on(N,V){console.log("DashboardModel.on is deprecated use events.subscribe"),this.events.on(N,V)}off(N,V){console.log("DashboardModel.off is deprecated"),this.events.off(N,V)}cycleGraphTooltip(){this.graphTooltip=(this.graphTooltip+1)%3}sharedTooltipModeEnabled(){return this.graphTooltip>0}sharedCrosshairModeOnly(){return this.graphTooltip===1}getRelativeTime(N){return(0,s.fq)(N,{timeZone:this.getTimezone()})}isSnapshot(){return this.snapshot!==void 0}getTimezone(){return this.timezone?this.timezone:l.TP?.user?.timezone}updateSchema(N){new O.SW(this).updateSchema(N)}hasTimeChanged(){const{time:N,originalTime:V}=this;return!((0,t.isEqual)(N,V)||(0,t.isEqual)((0,r.KQ)(N?.from),(0,r.KQ)(V?.from))&&(0,t.isEqual)((0,r.KQ)(N?.to),(0,r.KQ)(V?.to)))}autoFitPanels(N,V){const G=Math.max(...this.panels.map(ee=>ee.gridPos.h+ee.gridPos.y)),_=55,K=20;let j=N-_-K;V&&V!==a.KioskMode.TV&&(j+=_);const k=Math.floor(j/(i.sD+i.dU)),Y=G/k;for(const ee of this.panels)ee.gridPos.y=Math.round(ee.gridPos.y/Y)||1,ee.gridPos.h=Math.round(ee.gridPos.h/Y)||1}templateVariableValueUpdated(){this.processRepeats(),this.events.emit(a.CoreEvents.bG)}getPanelByUrlId(N){const V=parseInt(N??"0",10),G=this.panels.filter(_=>_.collapsed);for(const _ of G)_.panels?.some(j=>j.id===V)&&this.toggleRow(_);return this.getPanelById(V)}toggleLegendsForAll(){const N=this.panels.filter(H),V=N.filter(K=>K.legend.show).length,G=N.length-V,_=V>=G;for(const K of N)K.legend.show=!_,K.render()}toggleExemplarsForAll(){for(const N of this.panels)for(const V of N.targets){if(!(V.datasource&&V.datasource.type==="prometheus"))continue;const G=V;G.exemplar=!G.exemplar}this.startRefresh()}getVariables(){return this.getVariablesFromState(this.uid)}canEditAnnotations(N){let V=!0;return N?V=!!this.meta.annotationsPermissions?.dashboard.canEdit:V=!!this.meta.annotationsPermissions?.organization.canEdit,(g.$.featureToggles.annotationPermissionUpdate||this.canEditDashboard())&&V}canDeleteAnnotations(N){let V=!0;return N?V=!!this.meta.annotationsPermissions?.dashboard.canDelete:V=!!this.meta.annotationsPermissions?.organization.canDelete,g.$.featureToggles.annotationPermissionUpdate?V:V&&this.canEditDashboard()}canAddAnnotations(){return this.annotations.list.find(V=>V.builtIn===1)?.enable===!1?!1:g.$.featureToggles.annotationPermissionUpdate?!!this.meta.annotationsPermissions?.dashboard.canAdd:!!this.meta.annotationsPermissions?.dashboard.canAdd&&this.canEditDashboard()}canEditDashboard(){return!!(this.meta.canEdit||this.meta.canMakeEditable)}shouldUpdateDashboardPanelFromJSON(N,V){!(0,t.isEqual)(N?.gridPos,V?.gridPos)&&this.events.publish(new v.Q$)}getDefaultTime(){return this.originalTime}getPanelRepeatVariable(N){return this.getVariablesFromState(this.uid).find(V=>V.name===N.repeat)}isSnapshotTruthy(){return this.snapshot}hasVariables(){return this.getVariablesFromState(this.uid).length>0}hasVariablesChanged(){const N=this.originalTemplating?.list??[],V=this.getTemplatingSaveModel({saveVariables:!0}).list;return N.length!==V.length?!1:!(0,t.isEqual)(V,N)}variablesTimeRangeProcessDoneHandler(N){const V=N.payload.variableIds.length>0;this.variablesChangedHandler(new b.og({panelIds:[],refreshAll:!0}),V)}variablesChangedHandler(N,V=!0){if(V&&this.processRepeats(),N.payload.refreshAll||(0,y.jG)().isRefreshOutsideThreshold(this.lastRefresh)){this.startRefresh({refreshAll:!0,panelIds:[]});return}(this.panelInEdit||this.panelInView)&&(this.panelsAffectedByVariableChange=N.payload.panelIds.filter(G=>G!==(this.panelInEdit?.id??this.panelInView?.id))),this.startRefresh(N.payload)}variablesChangedInUrlHandler(N){this.templateVariableValueUpdated(),this.startRefresh(N.payload)}getOriginalDashboard(){return this.originalDashboard}hasAngularPlugins(){return this.panels.some(N=>{const V=g.$.panels[N.type]?.angular?.detected&&!g.$.panels[N.type]?.angular?.hideDeprecation;let G=!1;return N.datasource?.uid&&(G=(0,d.H)(N.datasource?.uid)),V||G})}};let B=R;B.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,originalDashboard:!0};function H(N){return!!N.legend}function w(N,V,G){N.scopedVars??={},N.scopedVars[V.name]=G}},84423:(Q,A,e)=>{"use strict";e.d(A,{Ar:()=>C,NB:()=>E,a9:()=>b,tw:()=>y});var t=e(2543),n=e.n(t),o=e(62938),s=e(18226),r=e(41987),g=e(581),u=e(3591),c=e(72574),i=e(2913),l=e(87490),f=e(21969),d=e(28444),h=e(80924);const p={events:!0,isViewing:!0,isEditing:!0,isInView:!0,hasRefreshed:!0,cachedPluginOptions:!0,plugin:!0,queryRunner:!0,replaceVariables:!0,configRev:!0,hasSavedPanelEditChange:!0,getDisplayTitle:!0,dataSupport:!0,key:!0,isNew:!0,refreshWhenInView:!0},m={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},a={gridPos:{x:0,y:0,h:3,w:6},targets:[{refId:"A"}],cachedPluginOptions:{},transparent:!1,options:{},links:[],transformations:[],fieldConfig:{defaults:{},overrides:[]},title:""},v=null,E={graph:"timeseries","table-old":"table",singlestat:"stat","grafana-singlestat-panel":"stat","grafana-piechart-panel":"piechart","grafana-worldmap-panel":"geomap"},D={"heatmap-new":"heatmap"};class b{constructor(T){this.datasource=null,this.isViewing=!1,this.isEditing=!1,this.isInView=!1,this.configRev=0,this.refreshWhenInView=!0,this.cachedPluginOptions={},this.events=new s.o,this.restoreModel(T),this.replaceVariables=this.replaceVariables.bind(this),this.key=(0,o.A)()}restoreModel(T){for(const x in this)p[x]||!this.hasOwnProperty(x)||T[x]||typeof this[x]!="function"&&typeof this[x]!="symbol"&&delete this[x];for(const x in T)this[x]=T[x];const I=D[this.type];I&&(this.autoMigrateFrom=this.type,this.type=I),(0,t.defaultsDeep)(this,(0,t.cloneDeep)(a)),this.ensureQueryIds()}generateNewKey(){this.key=(0,o.A)()}ensureQueryIds(){if(this.targets&&(0,t.isArray)(this.targets))for(const T of this.targets)T.refId||(T.refId=(0,f.W3)(this.targets))}getOptions(){return this.options}get hasChanged(){return this.configRev>0}updateOptions(T){this.options=T,this.configRev++,this.events.publish(new d.PR),this.render()}updateFieldConfig(T){this.fieldConfig=T,this.configRev++,this.events.publish(new d.PR),this.resendLastResult(),this.render()}getSaveModel(){const T={};for(const I in this)p[I]||!this.hasOwnProperty(I)||(0,t.isEqual)(this[I],a[I])||(T[I]=(0,t.cloneDeep)(this[I]));return this.type==="row"&&this.panels&&this.panels.length>0&&(T.panels=this.panels.map(I=>{if(I.libraryPanel){const{id:x,title:S,libraryPanel:O,gridPos:P}=I;return{id:x,title:S,gridPos:P,libraryPanel:{uid:O.uid,name:O.name}}}return I})),T}setIsViewing(T){this.isViewing=T}updateGridPos(T,I=!0){T.x===this.gridPos.x&&T.y===this.gridPos.y&&T.h===this.gridPos.h&&T.w===this.gridPos.w||(this.gridPos.x=T.x,this.gridPos.y=T.y,this.gridPos.w=T.w,this.gridPos.h=T.h,I&&this.configRev++,this.render())}runAllPanelQueries({dashboardUID:T,dashboardTimezone:I,timeData:x,width:S}){this.getQueryRunner().run({datasource:this.datasource,queries:this.targets,panelId:this.id,panelPluginId:this.type,dashboardUID:T,timezone:I,timeRange:x.timeRange,timeInfo:x.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.Jk.PanelEditor:this.isViewing?r.Jk.PanelViewer:r.Jk.Dashboard})}refresh(){this.hasRefreshed=!0,this.events.publish(new u._)}render(){this.hasRefreshed?this.events.publish(new d.XM):this.refresh()}getOptionsToRemember(){return Object.keys(this).reduce((T,I)=>p[I]||m[I]?T:{...T,[I]:this[I]},{})}restorePanelOptions(T){const I=this.cachedPluginOptions[T];I&&(Object.keys(I.properties).map(x=>{this[x]=I.properties[x]}),this.fieldConfig=(0,g.H9)(this.fieldConfig,I.fieldConfig))}applyPluginOptionDefaults(T,I){const x=(0,g.F)({plugin:T,currentOptions:this.options,currentFieldConfig:this.fieldConfig,isAfterPluginChange:I});this.fieldConfig=x.fieldConfig,this.options=x.options}async pluginLoaded(T){this.plugin=T;const I=C(T);if(this.autoMigrateFrom){const x=E[this.autoMigrateFrom]!=null,S=this.getOptionsToRemember(),O=this.autoMigrateFrom,P=this.type;this.clearPropertiesBeforePluginChange(),this.type=P,this.plugin=T,this.callPanelTypeChangeHandler(T,O,S,x)}if(T.onPanelMigration&&I!==this.pluginVersion){const x=T.onPanelMigration(this);this.options=await x,this.pluginVersion=I}this.applyPluginOptionDefaults(T,!1),this.resendLastResult()}clearPropertiesBeforePluginChange(){for(const T in this)m[T]||delete this[T];this.options={},this.fieldConfig={defaults:{...this.fieldConfig.defaults,custom:{}},overrides:(0,g.aW)(this.fieldConfig.overrides,g.nx)}}callPanelTypeChangeHandler(T,I,x,S){if(T.onPanelTypeChanged){const O=S?{angular:x}:x.options;Object.assign(this.options,T.onPanelTypeChanged(this,I,O,this.fieldConfig))}}changePlugin(T){const I=T.meta.id,x=this.getOptionsToRemember(),S=this.fieldConfig,O=this.type,P=this.isAngularPlugin()||!!E[O];this.cachedPluginOptions[O]={properties:x,fieldConfig:S},this.clearPropertiesBeforePluginChange(),this.restorePanelOptions(I),this.callPanelTypeChangeHandler(T,O,x,P),this.type=I,this.plugin=T,this.configRev++,this.applyPluginOptionDefaults(T,!0),T.onPanelMigration&&(this.pluginVersion=C(T))}updateQueries(T){const{dataSource:I}=T;this.datasource={uid:I.uid,type:I.type},this.cacheTimeout=T.cacheTimeout,this.queryCachingTTL=T.queryCachingTTL,this.timeFrom=T.timeRange?.from,this.timeShift=T.timeRange?.shift,this.hideTimeOverride=T.timeRange?.hide,this.interval=T.minInterval,this.maxDataPoints=T.maxDataPoints,this.targets=T.queries,this.configRev++,this.events.publish(new d.zq)}addQuery(T){T=T||{refId:"A"},T.refId=(0,f.W3)(this.targets),this.targets.push(T),this.configRev++}changeQuery(T,I){T.refId=this.targets[I].refId,this.configRev++,this.targets=this.targets.map((x,S)=>S===I?T:x)}getEditClone(){const T=this.getSaveModel(),I=new b(T);I.isEditing=!0,I.plugin=this.plugin;const x=this.getQueryRunner();return I.getQueryRunner().useLastResultFrom(x),I}getTransformations(){return this.transformations}getFieldOverrideOptions(){if(this.plugin)return{fieldConfig:this.fieldConfig,replaceVariables:this.replaceVariables,fieldConfigRegistry:this.plugin.fieldConfigRegistry,theme:i.Ay.theme2}}getDataSupport(){return this.plugin?.dataSupport??{annotations:!1,alertStates:!1}}getQueryRunner(){return this.queryRunner||(this.queryRunner=new h.Z(this)),this.queryRunner}hasTitle(){return this.title&&this.title.length>0}isAngularPlugin(){return(this.plugin&&this.plugin.angularPanelCtrl)!==void 0||(this.plugin?.meta?.angular?.detected??!1)}destroy(){this.events.removeAllListeners(),this.queryRunner&&this.queryRunner.destroy()}setTransformations(T){this.transformations=T,this.resendLastResult(),this.configRev++,this.events.publish(new d.JI)}setProperty(T,I){this[T]=I,this.configRev++,T==="repeat"&&(this.repeat&&!this.repeatDirection?this.repeatDirection="h":this.repeat||(delete this.repeatDirection,delete this.maxPerRow))}replaceVariables(T,I,x){const S=this.getQueryRunner().getLastRequest(),O=Object.assign({},this.scopedVars,S?.scopedVars,I);return(0,c.w)().replace(T,O,x)}resendLastResult(){this.plugin&&this.getQueryRunner().resendLastResult()}getDisplayTitle(){return this.replaceVariables(this.title,void 0,"text")}initLibraryPanel(T){for(const[I,x]of Object.entries(T.model)){switch(I){case"id":case"gridPos":case"libraryPanel":continue}this[I]=x}this.libraryPanel=T}unlinkLibraryPanel(){delete this.libraryPanel,this.configRev++,this.render()}}function C(M){return M&&M.meta.info.version?M.meta.info.version:i.Ay.buildInfo.version}function y(M){const T={};return Object.entries(M).filter(([I,x])=>!p[I]&&M.hasOwnProperty(I)&&!(0,t.isEqual)(x,a[I])).forEach(([I,x])=>{T[I]=x}),(0,l.MA)(T)}},3673:(Q,A,e)=>{"use strict";e.d(A,{Bz:()=>p,Q9:()=>d,Ss:()=>a,TA:()=>h,lC:()=>m});var t=e(17172),n=e(82467),o=e(3169),s=e(6473),r=e(80095),g=e(81862),u=e(20701),c=e(72401),i=e(14792),l=e(74856),f=e(28601);function d(v,E){return async D=>{await(0,t.AI)().post("/api/dashboards/import",v),D((0,n.dx)((0,o.tZ)("Dashboard Imported",E))),D((0,u.h9)())}}function h(v){return async E=>{await(0,t.AI)().delete(`/api/dashboards/uid/${v}`),E((0,u.h9)())}}const p=()=>(v,E)=>{const b=E().dashboard.getModel();b&&(b.destroy(),v((0,c.Y7)(b.uid))),(0,l.jG)().stopAutoRefresh(),v((0,f.p0)()),v((0,r.rG)()),s.t.leave(),(0,i.UA)().setCurrent(void 0)},m=v=>E=>{E((0,g.Cj)(v)),(0,l.jG)().refreshTimeModel()},a=v=>E=>{E((0,g.xu)(v)),(0,l.jG)().refreshTimeModel()}},34214:(Q,A,e)=>{"use strict";e.d(A,{G:()=>t.G,a:()=>n.a9});var t=e(98365),n=e(84423)},79999:(Q,A,e)=>{"use strict";e.d(A,{vR:()=>w,yZ:()=>G,OI:()=>V});var t=e(71733),n=e(47232),o=e(69129),s=e(12131),r=e(17172),g=e(32264),u=e(82467),c=e(28138),i=e(3169),l=e(27677),f=e(33390),d=e(17493),h=e(14792),p=e(74856),m=e(72255),a=e(71176),v=e(71101),E=e(54650);function D(_){return async K=>{const j=await l.IB.getFolderByUid(_);return K((0,E.jl)(j)),K((0,u.Vz)((0,v.R4)(j))),j}}var b=e(6473),C=e(2609),y=e(75096),M=e(80348),T=e(37168),I=e(72401),x=e(87421),S=e(16833),O=e(98365),P=e(61298),L=e(14110);function U(_){const K={dashboardId:_.id,dashboardName:_.title,dashboardUid:_.uid,folderName:_.meta.folderTitle,eventName:P.n_.DashboardView};(0,L.G$)(K)}var R=e(28601);async function B(_,K,j){const k=f.A.getObject(N);if(k)return G(),k;try{switch(_.routeName){case M.DashboardRoutes.Home:{const ee=(0,m.sP)().getFromCache(m.m6);if(ee)return ee;const re=await l.IB.get("/api/dashboards/home");if(re.redirectUri){const J=t.I.stripBaseFromUrl(re.redirectUri);return s.Ny.replace(J),null}return re.meta.canSave=!1,re.meta.canShare=!1,re.meta.canStar=!1,re}case M.DashboardRoutes.Public:return await d.np.loadDashboard("public",_.urlSlug,_.accessToken);case M.DashboardRoutes.Normal:{const Y=await d.np.loadDashboard(_.urlType,_.urlSlug,_.urlUid);if(Y.meta.folderUid)try{await K(D(Y.meta.folderUid))}catch(ee){console.warn("Error fetching parent folder",Y.meta.folderUid,"for dashboard",ee)}if(_.fixUrl&&Y.meta.url&&!C._o.isPlaying){const ee=t.I.stripBaseFromUrl(Y.meta.url),re=s.Ny.getLocation().pathname;ee!==re&&(s.Ny.replace({...s.Ny.getLocation(),pathname:ee}),console.log("not correct url correcting",ee,re))}return Y}case M.DashboardRoutes.New:return _.urlFolderUid&&await K(D(_.urlFolderUid)),(0,a.X)(_.urlFolderUid);case M.DashboardRoutes.Path:{const Y=_.urlSlug??"";return await d.np.loadDashboard(M.DashboardRoutes.Path,Y,Y)}default:throw{message:"Unknown route "+_.routeName}}}catch(Y){return(0,r.NF)(Y)&&Y.cancelled||(K((0,R.ig)({message:"Failed to fetch dashboard",error:Y})),console.error(Y)),null}}const H=(_,K={})=>(_.forEach(j=>{j.panels?H(j.panels,K):j.targets&&j.targets.forEach(k=>{k.datasource?.type&&(K[k.datasource.type]?K[k.datasource.type].push(k):K[k.datasource.type]=[k])})}),K);function w(_){return async(K,j)=>{const k=performance.now();K((0,R.xS)());const Y=await B(_,K,j),ee=Y?.dashboard?.version;if(!Y)return;K((0,R.X1)());let re;try{re=new O.G(Y.dashboard,Y.meta)}catch(ge){K((0,R.ig)({message:"Failed create dashboard model",error:ge})),console.error(ge);return}const J=j(),ne=s.Ny.getSearchObject();ne.orgId||s.Ny.partial({orgId:J.user.orgId},!0);const q=(0,p.jG)();(0,h.UA)().setCurrent(re),q.init(re);const oe=(0,y.q4)(_.urlUid??re.uid);if(await K((0,I._q)(oe,re)),(0,T.nm)({dashboard:re,timeSrv:q}).run({dashboard:re,range:q.timeRange()}),(0,x.Tk)(j())!==oe||j().dashboard.initPhase!==M.DashboardInitPhase.Services)return;try{re.processRepeats(),ne.autofitpanels&&re.autoFitPanels(window.innerHeight,ne.kiosk),_.keybindingSrv.setupDashboardBindings(re)}catch(ge){ge instanceof Error&&K((0,u.dx)((0,i.gi)("Dashboard init failed",ge))),console.error(ge)}_.routeName!==M.DashboardRoutes.New?(U(re),b.t.watch(re.uid)):b.t.leave(),re.weekStart!==""?(0,n.$D)(re.weekStart):(0,n.$D)(g.$.bootData.user.weekStart),c.A.publish(new o.gc({dashboardId:re.uid,orgId:J.user.orgId,userId:J.user.user?.id,grafanaVersion:g.$.buildInfo.version,queries:H(re.panels)}));const ie=performance.now()-k;(0,S.d)(re,ie,ee),K((0,R.O9)(re))}}const N="DASHBOARD_FROM_LS_KEY";function V(_){f.A.setObject(N,_)}function G(){f.A.delete(N)}},28601:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>m,O9:()=>i,Ub:()=>h,X1:()=>l,ig:()=>c,p0:()=>f,xS:()=>u});var t=e(30038),n=e(79422),o=e(80348),s=e(98365);const r={initPhase:o.DashboardInitPhase.NotStarted,getModel:()=>null,initError:null,initialDatasource:void 0},g=(0,t.Z0)({name:"dashboard",initialState:r,reducers:{dashboardInitFetching:a=>{a.initPhase=o.DashboardInitPhase.Fetching},dashboardInitServices:a=>{a.initPhase=o.DashboardInitPhase.Services},dashboardInitCompleted:(a,v)=>{a.getModel=()=>v.payload,a.initPhase=o.DashboardInitPhase.Completed},dashboardInitFailed:(a,v)=>{a.initPhase=o.DashboardInitPhase.Failed,a.initError=v.payload,a.getModel=()=>new s.G({...n.Ye,title:"Dashboard init failed"},{canSave:!1,canEdit:!1})},cleanUpDashboard:a=>{a.initPhase=o.DashboardInitPhase.NotStarted,a.initError=null,a.getModel=()=>null},addPanel:(a,v)=>{},setInitialDatasource:(a,v)=>{a.initialDatasource=v.payload}}}),{dashboardInitFetching:u,dashboardInitFailed:c,dashboardInitCompleted:i,dashboardInitServices:l,cleanUpDashboard:f,addPanel:d,setInitialDatasource:h}=g.actions,m={dashboard:g.reducer}},36974:(Q,A,e)=>{"use strict";e.d(A,{B1:()=>E,CW:()=>a,OK:()=>c,SD:()=>l,VF:()=>f,_u:()=>p,dH:()=>D,ko:()=>v,no:()=>h,ob:()=>i,s3:()=>d});var t=e(2543),n=e.n(t),o=e(12131),s=e(2913),r=e(15054),g=e(33390),u=e(19752);function c(C,y){const M={type:"timeseries",title:"Panel Title",gridPos:(0,u.Ft)(C),datasource:y?{uid:y}:null,isNew:!0};return C.addPanel(M),M.id}function i(C,y){const M={type:y,title:"Widget title",gridPos:(0,u.Ft)(C),datasource:null,isNew:!0};return C.addPanel(M),M.id}function l(C){const y={type:"row",title:"Row title",gridPos:{x:0,y:0}};C.addPanel(y)}function f(){o.Ny.push("/dashboard/import")}function d(C){const y={type:"add-library-panel",gridPos:(0,u.Ft)(C)};C.addPanel(y)}function h(C,y){if(!y)return;const M=(0,u.Ft)(C),T={type:y.id,title:"Panel Title",gridPos:{x:M.x,y:M.y,w:y.defaults.gridPos.w,h:y.defaults.gridPos.h}};y.defaults&&((0,t.defaults)(T,y.defaults),T.title=y.defaults.title,g.A.delete(r.tH)),C.addPanel(T)}function p(){const C=(0,t.chain)(s.Ay.panels).filter({hideFromList:!1}).map(M=>M).value(),y=g.A.get(r.tH);if(y){const M=JSON.parse(y),T=(0,t.find)(C,{id:M.type});if(T){const I=(0,t.cloneDeep)(T);return I.name=M.title,I.sort=-1,{...I,defaults:{...M}}}}}const m="grafana.dashboards.panelEdit.lastUsedDatasource";function a(C){if(g.A.exists(m)){const y=g.A.getObject(m);if(y?.dashboardUid===C)return y}}function v(C){if(!g.A.exists(m))return;const M=g.A.getObject(m)?.datasourceUid??"";b(C,M)}function E(C){g.A.setObject(m,{dashboardUid:C,datasourceUid:""})}function D(C,y){const M=a(C);if(!M)b(C,y);else{const T=M?.dashboardUid??"";b(T,y)}}function b(C,y){g.A.setObject(m,{dashboardUid:C,datasourceUid:y})}},19752:(Q,A,e)=>{"use strict";e.d(A,{ET:()=>x,FC:()=>D,Ft:()=>L,KJ:()=>C,Mc:()=>y,ZY:()=>T,d7:()=>M,iU:()=>b,nk:()=>S});var t=e(2543),n=e.n(t),o=e(26272),s=e(65879),r=e(47232),g=e(85858),u=e(72574),c=e(28138),i=e(2913),l=e(15054),f=e(33390),d=e(1702),h=e(84423),p=e(96227),m=e(58807),a=e(79971),v=e(99140),E=e(28444);const D=(U,R,B)=>{if(B!==!1){const H=R.alert&&!i.Ay.unifiedAlertingEnabled?"Panel includes an alert rule. removing the panel will also remove the alert rule":void 0,w=R.alert?"YES":void 0;c.A.publish(new E.bY({title:"Remove panel",text:"Are you sure you want to remove this panel?",text2:H,icon:"trash-alt",confirmText:w,yesText:"Remove",onConfirm:()=>D(U,R,!1)}));return}U.removePanel(R),(0,v.JD)((0,a.O6)(R.key))},b=(U,R)=>{U.duplicatePanel(R)},C=U=>{let R=U;U instanceof h.a9&&(R=U.getSaveModel()),f.A.set(l.tH,JSON.stringify(R)),c.A.emit(o.r1.alertSuccess,["Panel copied. Click **Add panel** icon to paste."])},y=(U,R)=>{c.A.publish(new E.S8({component:d.ShareModal,props:{dashboard:U,panel:R}}))},M=(U,R)=>{c.A.publish(new E.S8({component:p.o,props:{panel:R,initialFolderUid:U.meta.folderUid,isOpen:!0}}))},T=U=>{c.A.publish(new E.S8({component:m.l,props:{onConfirm:()=>U.unlinkLibraryPanel(),isOpen:!0}}))},I=U=>{U.refresh()},x=U=>{const R={...U.options};R.legend.showLegend===!0?R.legend.showLegend=!1:R.legend.showLegend=!0,U.updateOptions(R)};function S(U,R){const B={timeInfo:"",timeRange:R};if(U.timeFrom){const H=(0,u.w)().replace(U.timeFrom,U.scopedVars),w=s.describeTextRange(H);if(w.invalid)return B.timeInfo="invalid time override",B;if((0,t.isString)(R.raw.from)){const N=(0,r.AN)(R.from).tz(),V=(0,r.AN)(R.to).tz(),G=g.parse(w.from,void 0,N);B.timeInfo=w.display,B.timeRange={from:G,to:g.parse(w.to,void 0,V),raw:{from:w.from,to:w.to}}}}if(U.timeShift){const H=(0,u.w)().replace(U.timeShift,U.scopedVars);if(s.describeTextRange(H).invalid)return B.timeInfo="invalid timeshift",B;const N="-"+H;B.timeInfo+=" timeshift "+N;const V=g.parseDateMath(N,B.timeRange.from,!1),G=g.parseDateMath(N,B.timeRange.to,!0);B.timeRange={from:V,to:G,raw:{from:V,to:G}}}return U.hideTimeOverride&&(B.timeInfo=""),B}function O(U){const B=document.getElementsByTagName("html")[0].getBoundingClientRect().width;return U.maxDataPoints?U.maxDataPoints:Math.ceil(B*(U.gridPos.w/24))}function P(U,R){const B=U.plugin&&U.plugin.noPadding?0:config.theme.panelPadding*2,H=U.hasTitle()?config.theme.panelHeaderHeight:0;return R-H-B-PANEL_BORDER}function L(U){for(const B of U.panelIterator())B.gridPos.y+=8;return{x:0,y:0,w:12,h:8}}},21380:(Q,A,e)=>{"use strict";e.d(A,{z:()=>o});var t=e(47232),n=e(85858);const o=(s,r)=>{const g={from:(0,t.Ar)(s.from)?(0,t.KQ)(s.from):s.from,to:(0,t.Ar)(s.to)?(0,t.KQ)(s.to):s.to},u=r?r.getTimezone():void 0;return{from:n.parse(g.from,!1,u,r?.fiscalYearStartMonth),to:n.parse(g.to,!0,u,r?.fiscalYearStartMonth),raw:g}}},16833:(Q,A,e)=>{"use strict";e.d(A,{d:()=>n});var t=e(7758);function n(r,g,u){const c=r.templating.list.map(l=>l.type).reduce((l,f)=>(l[o(f)]=1+l[o(f)]||1,l),{}),i=r.panels.map(l=>l.type).reduce((l,f)=>(l[s(f)]=1+l[s(f)]||1,l),{});t.c.dashboardInitialized({uid:r.uid,title:r.title,theme:r.style,schemaVersion:r.schemaVersion,version_before_migration:u,panels_count:r.panels.length,...i,...c,settings_nowdelay:r.timepicker.nowDelay,settings_livenow:!!r.liveNow,duration:g})}const o=r=>`variable_type_${r}_count`,s=r=>`panel_type_${r}_count`},40489:(Q,A,e)=>{"use strict";e.d(A,{ZF:()=>g,vI:()=>r,o2:()=>u});var t=e(88483),n=e(14236);function o(c){const i=new Set;return Object.keys(c).forEach(l=>{c[l].forEach(f=>{i.add(f)})}),i}function s(c){const i=Array.from(o(c));return i.length===1?i[0]:`${i.slice(0,-1).join(", ")} or ${i.slice(-1)}`}function r(c){return new t.c(i=>{let l=0;Promise.all([e.e(2136),e.e(3686)]).then(e.bind(e,22136)).then(f=>{c.forEach(d=>{const h=new FileReader;h.readAsArrayBuffer(d),h.onload=()=>{const p=h.result;if(p&&p instanceof ArrayBuffer){if(d.type==="application/json"){const m=new TextDecoder("utf-8"),a=JSON.parse(m.decode(p));i.next({dataFrames:[(0,n.Vc)(a)],file:d})}else i.next({dataFrames:f.readSpreadsheet(p),file:d});++l>=c.length&&i.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"]},u=5e5},32738:(Q,A,e)=>{"use strict";e.d(A,{r:()=>u});var t=e(96540),n=e(55852),o=e(10096),s=e(44836),r=e(6320),g=e(80348);function u({variant:c,onClick:i}){const l=o.TP.hasPermission(g.AccessControlAction.DataSourcesCreate),f=r.b.DataSourcesNew;return t.createElement(n.z9,{variant:c||"primary",href:f,disabled:!l,tooltip:l?void 0:"You do not have permission to configure new data sources",onClick:i,target:"_blank"},t.createElement(s.x6,{i18nKey:"data-source-picker.add-new-data-source"},"Configure a new data source"))}},2221:(Q,A,e)=>{"use strict";e.d(A,{A:()=>g});var t=e(32196),n=e(96540),o=e(40845),s=e(10860),r=e(64149);function g({ds:c,onClick:i,selected:l,description:f,...d}){const h=(0,o.$j)(),p=u(h,c.meta.builtIn);return n.createElement(s.Z,{key:c.uid,onClick:i,className:(0,t.cx)(p.card,l?p.selected:void 0),...d},n.createElement(s.Z.Heading,{className:p.heading},n.createElement("div",{className:p.headingContent},n.createElement("span",{className:p.name},c.name," ",c.isDefault?n.createElement(r.L,{tags:["default"]}):null),n.createElement("small",{className:p.type},f||c.meta.name))),n.createElement(s.Z.Figure,{className:p.logo},n.createElement("img",{src:c.meta.info.logos.small,alt:`${c.meta.name} Logo`})))}function u(c,i=!1){return{card:(0,t.css)` cursor: pointer; background-color: ${c.colors.background.primary}; border-bottom: 1px solid ${c.colors.border.weak}; // Move to list component margin-bottom: 0; border-radius: 0; padding: ${c.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: ${c.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: ${c.spacing(0,1)}; display: flex; align-items: center; > img { max-height: 100%; min-width: 24px; filter: invert(${i&&c.isLight?1:0}); } `,name:(0,t.css)` color: ${c.colors.text.primary}; display: flex; gap: ${c.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 ${c.spacing(1)}; color: ${c.colors.border.weak}; `,selected:(0,t.css)` background-color: ${c.colors.background.secondary}; `,meta:(0,t.css)` display: block; overflow-wrap: unset; white-space: nowrap; width: 100%; overflow: hidden; text-overflow: ellipsis; `}}},11219:(Q,A,e)=>{"use strict";e.d(A,{S:()=>f});var t=e(32196),n=e(96540),o=e(13544),s=e(72574),r=e(40845),g=e(44836),u=e(87282),c=e(32738),i=e(2221),l=e(47311);function f(a){const v=(0,n.useRef)(null),[E,D]=(0,u.dR)({keyboardEvents:a.keyboardEvents,containerRef:v}),b=(0,r.$j)(),C=m(b,D),{className:y,current:M,onChange:T,enableKeyboardNavigation:I,onClickEmptyStateCTA:x}=a,S=(0,u.Kr)({alerting:a.alerting,annotations:a.annotations,dashboard:a.dashboard,logs:a.logs,metrics:a.metrics,mixed:a.mixed,pluginId:a.pluginId,tracing:a.tracing,type:a.type,variables:a.variables}),[O,P]=(0,u.TX)(),L=a.filter?S.filter(a.filter):S;return n.createElement("div",{ref:v,className:(0,t.cx)(y,C.container),"data-testid":o.Tp.components.DataSourcePicker.dataSourceList},L.length===0&&n.createElement(d,{className:C.emptyState,onClickCTA:x}),L.sort((0,l.Tj)(M,O,p())).map(U=>n.createElement(i.A,{"data-testid":"data-source-card",key:U.uid,ds:U,onClick:()=>{P(U),T(U)},selected:(0,l.Df)(U,M),...I?E:{}})))}function d({className:a,onClickCTA:v}){const E=(0,r.of)(h);return n.createElement("div",{className:(0,t.cx)(a,E.container)},n.createElement("p",{className:E.message},n.createElement(g.x6,{i18nKey:"data-source-picker.list.no-data-source-message"},"No data sources found")),n.createElement(c.r,{onClick:v}))}function h(a){return{container:(0,t.css)` display: flex; flex-direction: column; justify-content: center; align-items: center; `,message:(0,t.css)` margin-bottom: ${a.spacing(3)}; `}}function p(){return(0,s.w)().getVariables().filter(v=>v.type==="datasource").map(v=>`\${${v.id}}`)}function m(a,v){return{container:(0,t.css)` display: flex; flex-direction: column; ${v} { background-color: ${a.colors.background.secondary}; } `,emptyState:(0,t.css)` height: 100%; flex: 1; `}}},50481:(Q,A,e)=>{"use strict";e.d(A,{p:()=>I});var t=e(32196),n=e(2543),o=e(96540),s=e(14110),r=e(32264),g=e(40845),u=e(37390),c=e(10354),i=e(14578),l=e(40276),f=e(37270),d=e(44836),h=e(40489),p=e(90478),m=e(87282),a=e(32738),v=e(13544),E=e(2221),D=e(47311);const b={grafana:(0,d.t)("data-source-picker.built-in-list.description-grafana","Discover visualizations using mock data"),"-- Mixed --":(0,d.t)("data-source-picker.built-in-list.description-mixed","Use multiple data sources"),"-- Dashboard --":(0,d.t)("data-source-picker.built-in-list.description-dashboard","Reuse query results from other visualizations")};function C({className:S,current:O,onChange:P,tracing:L,dashboard:U,mixed:R,metrics:B,type:H,annotations:w,variables:N,alerting:V,pluginId:G,logs:_,filter:K}){const k=(0,m.Kr)({tracing:L,dashboard:U,mixed:R,metrics:B,type:H,annotations:w,variables:N,alerting:V,pluginId:G,logs:_}).filter(Y=>(K?K?.(Y):!0)&&!!Y.meta.builtIn);return o.createElement("div",{className:S,"data-testid":v.Tp.components.DataSourcePicker.advancedModal.builtInDataSourceList},k.map(Y=>o.createElement(E.A,{key:Y.uid,ds:Y,description:b[Y.uid],selected:(0,D.Df)(Y,O),onClick:()=>P(Y)})))}var y=e(11219);const M="dashboards_dspickermodal_clicked",T={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 I({tracing:S,dashboard:O,mixed:P,metrics:L,type:U,annotations:R,variables:B,alerting:H,pluginId:w,logs:N,uploadFile:V,filter:G,onChange:_,current:K,onDismiss:j,reportedInteractionFrom:k}){const Y=(0,g.of)(x),[ee,re]=(0,o.useState)(""),J=k||"modal",ne=()=>{j(),(0,s.rR)(M,{item:T.DISMISS,src:J})},q=ge=>{_(ge),(0,s.rR)(M,{item:T.SELECT_DS,ds_type:ge.type,src:J})},te=o.useMemo(()=>(0,n.once)(()=>{(0,s.rR)(M,{item:"search",src:J})}),[J]),oe=(0,m.ps)("-- Grafana --"),ue=(0,p.j)((ge,he)=>{oe&&(_(oe,[ge]),(0,s.rR)(M,{item:T.UPLOAD_FILE,src:J}),he.length<1&&j())}),ie=({className:ge})=>o.createElement(C,{className:ge,onChange:q,current:K,filter:G,variables:B,tracing:S,metrics:L,type:U,annotations:R,alerting:H,pluginId:w,logs:N,dashboard:O,mixed:P});return o.createElement(u.a,{title:(0,d.t)("data-source-picker.modal.title","Select data source"),closeOnEscape:!0,closeOnBackdropClick:!0,isOpen:!0,className:Y.modal,contentClassName:Y.modalContent,onClickBackdrop:ne,onDismiss:ne},o.createElement("div",{className:Y.leftColumn},o.createElement(c.p,{type:"search",autoFocus:!0,className:Y.searchInput,value:ee,prefix:o.createElement(i.I,{name:"search"}),placeholder:(0,d.t)("data-source-picker.modal.input-placeholder","Select data source"),onChange:ge=>{re(ge.currentTarget.value),te()}}),o.createElement(l.E,null,o.createElement(y.S,{onChange:q,current:K,onClickEmptyStateCTA:()=>(0,s.rR)(M,{item:T.CONFIG_NEW_DS_EMPTY_STATE,src:J}),filter:ge=>(G?G?.(ge):!0)&&(0,D.Zn)(ge,ee)&&!ge.meta.builtIn,variables:B,tracing:S,metrics:L,type:U,annotations:R,alerting:H,pluginId:w,logs:N,dashboard:O,mixed:P}),o.createElement(ie,{className:Y.appendBuiltInDataSourcesList}))),o.createElement("div",{className:Y.rightColumn},o.createElement("div",{className:Y.builtInDataSources},o.createElement(l.E,{className:Y.builtInDataSourcesList},o.createElement(ie,null)),V&&r.$.featureToggles.editPanelCSVDragAndDrop&&o.createElement(f.gH,{readAs:"readAsArrayBuffer",fileListRenderer:()=>{},options:{maxSize:h.o2,multiple:!1,accept:h.ZF,onDrop:ue}},o.createElement(f.wI,null))),o.createElement("div",{className:Y.newDSSection},o.createElement("span",{className:Y.newDSDescription},o.createElement(d.x6,{i18nKey:"data-source-picker.modal.configure-new-data-source"},"Open a new tab and configure a data source")),o.createElement(a.r,{variant:"secondary",onClick:()=>{(0,s.rR)(M,{item:T.CONFIG_NEW_DS,src:J}),j()}}))))}function x(S){return{modal:(0,t.css)` width: 80%; height: 80%; max-width: 1200px; max-height: 900px; ${S.breakpoints.down("md")} { width: 100%; } `,modalContent:(0,t.css)` display: flex; flex-direction: row; height: 100%; ${S.breakpoints.down("md")} { flex-direction: column; } `,leftColumn:(0,t.css)` display: flex; flex-direction: column; width: 50%; height: 100%; padding-right: ${S.spacing(4)}; border-right: 1px solid ${S.colors.border.weak}; ${S.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: ${S.spacing(4)}; ${S.breakpoints.down("md")} { width: 100%; padding-left: 0; flex: 0; } `,builtInDataSources:(0,t.css)` flex: 1 1; margin-bottom: ${S.spacing(4)}; ${S.breakpoints.down("md")} { flex: 0; } `,builtInDataSourcesList:(0,t.css)` ${S.breakpoints.down("md")} { display: none; margin-bottom: 0; } margin-bottom: ${S.spacing(4)}; `,appendBuiltInDataSourcesList:(0,t.css)` ${S.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: ${S.colors.text.secondary}; `,searchInput:(0,t.css)` width: 100%; min-height: 32px; margin-bottom: ${S.spacing(1)}; `}}},51612:(Q,A,e)=>{"use strict";e.d(A,{s:()=>U});var t=e(32196),n=e(95361),o=e(18491),s=e(36376),r=e(80279),g=e(7887),u=e(82148),c=e(96540),i=e(13544),l=e(14110),f=e(40845),d=e(10354),h=e(14578),p=e(17464),m=e(40276),a=e(71678),v=e(55852),E=e(2913),D=e(44836),b=e(97427),C=e(68706),y=e(87282),M=e(11219);function T(V){const{dataSource:G}=V,_=(0,f.$j)(),K=x(_,G?.meta.builtIn);return G?c.createElement("img",{className:K.pickerDSLogo,alt:`${G.meta.name} logo`,src:G.meta.info.logos.small}):I()}function I(){const V=(0,f.of)(x);return c.createElement("div",{className:V.pickerDSLogo})}function x(V,G=!1){return{pickerDSLogo:(0,t.css)` height: 20px; width: 20px; filter: invert(${G&&V.isLight?1:0}); `}}var S=e(50481),O=e(47311);const P="dashboards_dspicker_clicked",L={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 U(V){const{current:G,onChange:_,hideTextValue:K=!1,width:j,inputId:k,noDefault:Y=!1,disabled:ee=!1,placeholder:re="Select data source",...J}=V,ne=(0,f.of)(R,V),[q,te]=(0,c.useState)(!1),[oe,ue]=(0,c.useState)(!1),[ie,ge]=(0,c.useState)(""),{onKeyDown:he,keyboardEvents:De}=(0,b.d)(),pe=(0,c.useRef)(null),[le,Te]=(0,c.useState)(),[Ee,Re]=(0,c.useState)(),me=(0,y.ps)(G),Me=(0,y.ps)("-- Grafana --"),ye=!G&&Y?void 0:me,Le=ie&&q?c.createElement(I,null):c.createElement(T,{dataSource:ye}),We=[(0,n.cY)(4),(0,o.Ej)({apply({availableHeight:Z,elements:ae}){ae.floating.style.maxHeight=`${Math.max(200,Z-20)}px`,ae.floating.style.minHeight="200px"}}),(0,o.UU)({fallbackStrategy:"initialPlacement",crossAxis:!1,boundary:document.body}),(0,o.BN)()],{refs:Be,floatingStyles:Ye}=(0,s.we)({open:q,placement:"bottom-start",onOpenChange:te,middleware:We,whileElementsMounted:o.ll,strategy:"fixed"}),at=(0,c.useCallback)(Z=>{Be.setReference(Z),Te(Z)},[Be]),st=(0,c.useCallback)(()=>{ge(""),te(!1),le?.focus()},[te,le]),{overlayProps:Ke,underlayProps:Xe}=(0,u.e)({onClose:st,isDismissable:!0,isOpen:q,shouldCloseOnInteractOutside:Z=>le?!le.isSameNode(Z):!1},pe),{dialogProps:He}=(0,r.s)({"aria-label":"Opened data source picker list"},pe);function Ge(){(0,l.rR)(P,{item:L.OPEN_DROPDOWN}),te(!0),le?.focus()}function xe(){Me&&_(Me,[C.dx])}function $e(Z){Z.key==="Tab"&&!Z.shiftKey&&q&&(Z.preventDefault(),Ee?.focus()),Z.key==="Tab"&&Z.shiftKey&&q&&st(),he(Z)}function be(Z){Z.shiftKey?(Z.preventDefault(),le?.focus()):st()}return(0,c.useEffect)(()=>{const Z=De.subscribe({next:ae=>{switch(ae?.code){case"ArrowDown":Ge(),ae.preventDefault();break;case"ArrowUp":Ge(),ae.preventDefault();break;case"Escape":st(),ae.preventDefault();break}}});return()=>Z.unsubscribe()}),c.createElement("div",{className:ne.container,"data-testid":i.Tp.components.DataSourcePicker.container},c.createElement("div",{className:ne.trigger,onClick:Ge},c.createElement(d.p,{id:k||"data-source-picker",className:oe?void 0:ne.input,"data-testid":i.Tp.components.DataSourcePicker.inputV2,"aria-label":"Select a data source",autoComplete:"off",prefix:ye?Le:void 0,suffix:c.createElement(h.I,{name:q?"search":"angle-down"}),placeholder:K?"":(0,O.q7)(ye)||re,onFocus:()=>{ue(!0)},onBlur:()=>{ue(!1)},onKeyDown:$e,value:ie,onChange:Z=>{Ge(),ge(Z.currentTarget.value)},ref:at,disabled:ee})),q?c.createElement(p.ZL,null,c.createElement("div",{...Xe}),c.createElement("div",{ref:pe,...Ke,...He},c.createElement(B,{...J,style:Ye,ref:Be.setFloating,footerRef:Re,current:ye,filterTerm:ie,keyboardEvents:De,onChange:(Z,ae)=>{st(),Z.uid!==ye?.uid&&(_(Z,ae),(0,l.rR)(P,{item:L.SELECT_DS,ds_type:Z.type}))},onClose:st,onClickAddCSV:xe,onDismiss:st,onNavigateOutsiteFooter:be}))):null)}function R(V,G){return{container:(0,t.css)({position:"relative",cursor:G.disabled?"not-allowed":"pointer",width:V.spacing(G.width||"auto")}),trigger:(0,t.css)({cursor:"pointer",pointerEvents:G.disabled?"none":"auto"}),input:(0,t.css)({"input::placeholder":{color:G.disabled?V.colors.action.disabledText:V.colors.text.primary}})}}const B=c.forwardRef((V,G)=>{const{filterTerm:_,onChange:K,onClose:j,onClickAddCSV:k,current:Y,filter:ee}=V,re=(0,c.useCallback)(q=>{K(q)},[K]),J=(0,c.useCallback)(()=>{k?.(),j(),(0,l.rR)(P,{item:L.ADD_FILE})},[k,j]),ne=(0,f.of)(H);return c.createElement("div",{style:V.style,ref:G,className:ne.container},c.createElement(m.E,null,c.createElement(M.S,{...V,enableKeyboardNavigation:!0,className:ne.dataSourceList,current:Y,onChange:re,filter:q=>(ee?ee?.(q):!0)&&(0,O.Zn)(q,_),onClickEmptyStateCTA:()=>(0,l.rR)(P,{item:L.CONFIG_NEW_DS_EMPTY_STATE})})),c.createElement(g.n1,null,c.createElement(w,{...V,onClickAddCSV:J,onChange:re,onNavigateOutsiteFooter:V.onNavigateOutsiteFooter})))});B.displayName="PickerContent";function H(V){return{container:(0,t.css)({display:"flex",flexDirection:"column",background:V.colors.background.primary,boxShadow:V.shadows.z3}),picker:(0,t.css)({background:V.colors.background.secondary}),dataSourceList:(0,t.css)({flex:1}),footer:(0,t.css)({flex:0,display:"flex",flexDirection:"row-reverse",justifyContent:"space-between",padding:V.spacing(1.5),borderTop:`1px solid ${V.colors.border.weak}`,backgroundColor:V.colors.background.secondary})}}function w({onClose:V,onChange:G,onClickAddCSV:_,...K}){const j=(0,f.of)(N),k=K.uploadFile&&E.Ay.featureToggles.editPanelCSVDragAndDrop,Y=re=>{re.key==="Tab"&&K.onNavigateOutsiteFooter(re)},ee=re=>{re.key==="Tab"&&re.shiftKey&&K.onNavigateOutsiteFooter(re)};return c.createElement("div",{className:j.footer},c.createElement(a.$s,null,({showModal:re,hideModal:J})=>c.createElement(v.$n,{size:"sm",variant:"secondary",fill:"text",onClick:()=>{V(),re(S.p,{reportedInteractionFrom:"ds_picker",tracing:K.tracing,dashboard:K.dashboard,mixed:K.mixed,metrics:K.metrics,type:K.type,annotations:K.annotations,variables:K.variables,alerting:K.alerting,pluginId:K.pluginId,logs:K.logs,filter:K.filter,uploadFile:K.uploadFile,current:K.current,onDismiss:J,onChange:(ne,q)=>{G(ne,q),J()}}),(0,l.rR)(P,{item:L.OPEN_ADVANCED_DS_PICKER})},ref:K.footerRef,onKeyDown:k?ee:Y},c.createElement(D.x6,{i18nKey:"data-source-picker.open-advanced-button"},"Open advanced data source picker"),c.createElement(h.I,{name:"arrow-right"}))),k&&c.createElement(v.$n,{variant:"secondary",size:"sm",onClick:_,onKeyDown:Y},"Add csv or spreadsheet"))}function N(V){return{footer:(0,t.css)({flex:0,display:"flex",flexDirection:"row-reverse",justifyContent:"space-between",padding:V.spacing(1.5),borderTop:`1px solid ${V.colors.border.weak}`,backgroundColor:V.colors.background.secondary})}}},47311:(Q,A,e)=>{"use strict";e.d(A,{Df:()=>s,Tj:()=>g,Zn:()=>u,q7:()=>r,tw:()=>c});var t=e(14792),n=e(36974),o=e(14678);function s(i,l){return!i||!l?!1:typeof l=="string"?i.uid===l:i.uid===l.uid}function r(i){if(i){if(typeof i=="string")return`${i} - not found`;if("name"in i)return i.name;if(i.uid)return`${i.uid} - not found`}}function g(i,l,f){return(h,p)=>{const m=h.name.toUpperCase(),a=p.name.toUpperCase();if(i&&s(h,i))return-1;if(i&&s(p,i))return 1;const v=l.indexOf(h.uid),E=l.indexOf(p.uid);if(v>-1&&v>E)return-1;if(E>-1&&E>v)return 1;const D=f.includes(h.uid),b=f.includes(p.uid);return D&&!b?-1:b&&!D||h.meta.builtIn&&!p.meta.builtIn?1:p.meta.builtIn&&!h.meta.builtIn||m<a?-1:1}}function u(i,l=""){return i.name.toLowerCase().includes(l.toLowerCase())}function c(i){if(!i.uid)return;const l=(0,t.UA)().getCurrent()?.uid??"";if(i.uid===o.uv)return(0,n.B1)(l);(0,n.dH)(l,i.uid)}},83883:(Q,A,e)=>{"use strict";e.d(A,{I:()=>t});const t={List:"/datasources",Edit:"/datasources/edit/:uid",Dashboards:"/datasources/edit/:uid/dashboards",New:"/datasources/new"}},87282:(Q,A,e)=>{"use strict";e.d(A,{Kr:()=>g,TX:()=>r,dR:()=>c,ps:()=>u});var t=e(96540),n=e(78685),o=e(19347);const s="grafana.features.datasources.components.picker.DataSourceDropDown.history";function r(){const[i=[],l]=(0,n.A)(s,[]),f=(0,t.useCallback)(d=>{d.meta.builtIn||(i.includes(d.uid)?(i.splice(i.findIndex(h=>d.uid===h),1),l([...i,d.uid])):l([...i,d.uid].slice(1,6)))},[i,l]);return[i,f]}function g(i){return(0,o.l)().getList(i)}function u(i){const l=(0,o.l)();return l.getInstanceSettings(i)}function c(i){const{keyboardEvents:l,containerRef:f}=i,d=(0,t.useRef)(0),h="data-role",p="keyboardSelectableItem",m={[h]:p},a=`[${h}="${p}"`,v="data-selectedItem",E=`[${v}="true"]`,D=(0,t.useCallback)(C=>{const y=f?.current?.querySelectorAll(a),M=y?.item(C%y?.length);y?.forEach(T=>T.setAttribute(v,"false")),M&&(M.scrollIntoView({block:"center"}),M.setAttribute(v,"true"))},[f,a]),b=(0,t.useCallback)(()=>{f?.current?.querySelector(E)?.querySelector("button")?.click()},[f,E]);return(0,t.useEffect)(()=>{if(!l)return;const C=l.subscribe({next:y=>{switch(y?.code){case"ArrowDown":{D(++d.current),y.preventDefault();break}case"ArrowUp":d.current=d.current>0?d.current-1:d.current,D(d.current),y.preventDefault();break;case"Enter":b();break}}});return()=>C.unsubscribe()},[l,D,b]),(0,t.useEffect)(()=>{const C=new MutationObserver(y=>{y.some(T=>T.addedNodes&&T.addedNodes.length>0||T.removedNodes&&T.removedNodes.length>0)&&D(0)});return f.current&&C.observe(f.current,{childList:!0}),()=>{C.disconnect()}},[f,a,D]),[m,E]}},34258:(Q,A,e)=>{"use strict";e.d(A,{du:()=>ee,Qq:()=>ne,PK:()=>_,G2:()=>re,bn:()=>j,Ge:()=>K,jB:()=>J});var t=e(69129),n=e(71733),o=e(26657),s=e(17172),r=e(32264),g=e(12131),u=e(82467),c=e(10096),i=e(27677),l=e(6320),f=e(31193),d=e(27716),h=e(91629),p=e(80348),m=e(75505),a=e(80714);const v=async()=>await(0,i.AI)().get("/api/datasources"),E=async q=>{const te=await(0,m.s)((0,i.AI)().fetch({method:"GET",url:`/api/datasources/${q}`,params:(0,a.F)(),showErrorAlert:!1}));if(te.ok)return te.data;throw Error(`Could not find data source by ID: "${q}"`)},D=async q=>{const te=await(0,m.s)((0,i.AI)().fetch({method:"GET",url:`/api/datasources/uid/${q}`,params:(0,a.F)(),showErrorAlert:!1}));if(te.ok)return te.data;throw Error(`Could not find data source by UID: "${q}"`)},b=async q=>{try{return await D(q)}catch{console.log(`Failed to lookup data source using UID "${q}"`)}try{return await E(q)}catch{console.log(`Failed to lookup data source using ID "${q}"`)}throw Error("Could not find data source")},C=q=>(0,i.AI)().post("/api/datasources",q),y=()=>(0,i.AI)().get("/api/plugins",{enabled:1,type:"datasource"}),M=q=>(0,i.AI)().put(`/api/datasources/uid/${q.uid}`,q,{showErrorAlert:!1,showSuccessAlert:!1}),T=q=>(0,i.AI)().delete(`/api/datasources/uid/${q}`);var I=e(83883),x=e(4589),S=e(43429),O=e(33378);function P(q){const te=[{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(ge=>ge),oe={},ue={},ie=U();for(const ge of te)oe[ge.id]=ge;for(const ge of q){const he=ie.find(pe=>pe.id===ge.id);if((ge.enterprise||he)&&(ge.category="enterprise",ge.unlicensed=!(0,O.a)("enterprise.plugins"),ge.info.links=he?.info?.links||ge.info.links),ge.info.links)for(const pe of ge.info.links)pe.name="Learn more";(te.find(pe=>pe.id===ge.category)||oe.other).plugins.push(ge),ue[ge.id]=ge}for(const ge of te){if(ge.id==="cloud"&&ge.plugins.push(R()),ge.id==="enterprise")for(const he of ie)ue[he.id]||ge.plugins.push(he);L(ge.plugins)}return te.filter(ge=>ge.plugins.length>0)}function L(q){const te={prometheus:100,graphite:95,loki:90,mysql:80,jaeger:100,postgres:79,gcloud:-1};q.sort((oe,ue)=>{const ie=te[oe.id]||0,ge=te[ue.id]||0;return ie>ge?-1:ie<ge||oe.name>ue.name?1:-1})}function U(){return[B({id:"grafana-splunk-datasource",name:"Splunk",description:"Visualize and explore Splunk logs",imgUrl:"public/img/plugins/splunk_logo_128.png"}),B({id:"grafana-oracle-datasource",name:"Oracle",description:"Visualize and explore Oracle SQL",imgUrl:"public/img/plugins/oracle.png"}),B({id:"grafana-dynatrace-datasource",name:"Dynatrace",description:"Visualize and explore Dynatrace data",imgUrl:"public/img/plugins/dynatrace.png"}),B({id:"grafana-servicenow-datasource",description:"ServiceNow integration and data source",name:"ServiceNow",imgUrl:"public/img/plugins/servicenow.svg"}),B({id:"grafana-datadog-datasource",description:"DataDog integration and data source",name:"DataDog",imgUrl:"public/img/plugins/datadog.png"}),B({id:"grafana-newrelic-datasource",description:"New Relic integration and data source",name:"New Relic",imgUrl:"public/img/plugins/newrelic.svg"}),B({id:"grafana-mongodb-datasource",description:"MongoDB integration and data source",name:"MongoDB",imgUrl:"public/img/plugins/mongodb.svg"}),B({id:"grafana-snowflake-datasource",description:"Snowflake integration and data source",name:"Snowflake",imgUrl:"public/img/plugins/snowflake.svg"}),B({id:"grafana-wavefront-datasource",description:"Wavefront integration and data source",name:"Wavefront",imgUrl:"public/img/plugins/wavefront.svg"}),B({id:"dlopes7-appdynamics-datasource",description:"AppDynamics integration and data source",name:"AppDynamics",imgUrl:"public/img/plugins/appdynamics.svg"}),B({id:"grafana-saphana-datasource",description:"SAP HANA\xAE integration and data source",name:"SAP HANA\xAE",imgUrl:"public/img/plugins/sap_hana.png"}),B({id:"grafana-honeycomb-datasource",description:"Honeycomb integration and datasource",name:"Honeycomb",imgUrl:"public/img/plugins/honeycomb.png"}),B({id:"grafana-salesforce-datasource",description:"Salesforce integration and datasource",name:"Salesforce",imgUrl:"public/img/plugins/salesforce.svg"}),B({id:"grafana-jira-datasource",description:"Jira integration and datasource",name:"Jira",imgUrl:"public/img/plugins/jira_logo.png"}),B({id:"grafana-gitlab-datasource",description:"GitLab integration and datasource",name:"GitLab",imgUrl:"public/img/plugins/gitlab.svg"}),B({id:"grafana-splunk-monitoring-datasource",description:"SignalFx integration and datasource",name:"Splunk Infrastructure Monitoring",imgUrl:"public/img/plugins/signalfx-logo.svg"}),B({id:"grafana-azuredevops-datasource",description:"Azure Devops datasource",name:"Azure Devops",imgUrl:"public/img/plugins/azure-devops.png"}),B({id:"grafana-sumologic-datasource",description:"SumoLogic integration and datasource",name:"SumoLogic",imgUrl:"public/img/plugins/sumo.svg"}),B({id:"grafana-pagerduty-datasource",description:"PagerDuty datasource",name:"PagerDuty",imgUrl:"public/img/plugins/pagerduty.svg"})]}function R(){return{id:"gcloud",name:"Grafana Cloud",type:S.QE.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 B(q){return{id:q.id,name:q.name,type:S.QE.datasource,module:"phantom",baseUrl:"",info:{description:q.description,logos:{small:q.imgUrl,large:q.imgUrl},author:{name:"Grafana Labs"},links:[{url:"/plugins/"+q.id,name:"Install now",target:"_self"}],screenshots:[],updated:"2019-05-10",version:"1.0.0"}}}var H=e(74984),w=e(36227),N=e(54226);const V=q=>{let te,oe;return q.error&&q.error instanceof o.b1?(te=q.error.message,oe=q.error.details):(0,s.NF)(q)?te=q.data.message??`HTTP error ${q.statusText}`:q instanceof Error&&(te=q.message),{message:te,details:oe}},G=q=>{const{details:te,message:oe,status:ue}=q;return{status:ue,message:oe,details:te}},_=(q,te={loadDataSource:k,loadDataSourceMeta:Y,getDataSource:N.U4,getDataSourceMeta:N.Fj,importDataSourcePlugin:h.cS})=>async(oe,ue)=>{if(!q){oe((0,w.qR)(new Error("Invalid UID")));return}try{const ie=await oe(te.loadDataSource(q));await oe(te.loadDataSourceMeta(ie));const ge=te.getDataSource(ue().dataSources,q),he=te.getDataSourceMeta(ue().dataSources,ge.type),De=await te.importDataSourcePlugin(he);oe((0,w.Ks)(De))}catch(ie){ie instanceof Error&&oe((0,w.qR)(ie))}},K=(q,te=I.I.Edit,oe={getDatasourceSrv:f.tR,getBackendSrv:i.AI})=>async(ue,ie)=>{const ge=await oe.getDatasourceSrv().get(q),he=te.replace(/:uid/gi,q);ge.testDatasource&&(ue((0,w.QZ)()),oe.getBackendSrv().withNoBackendCache(async()=>{try{const De=await ge.testDatasource(),pe=G({...De,details:{...De.details}});ue((0,w.lg)(pe)),(0,x.Mh)({grafana_version:r.$.buildInfo.version,plugin_id:ge.type,datasource_uid:ge.uid,success:!0,path:he}),c.lE.publish(new t.NI)}catch(De){const pe=V(De);ue((0,w.UP)({...pe})),(0,x.Mh)({grafana_version:r.$.buildInfo.version,plugin_id:ge.type,datasource_uid:ge.uid,success:!1,path:he}),c.lE.publish(new t.LL)}}))};function j(){return async q=>{if(!c.TP.hasPermission(p.AccessControlAction.DataSourcesRead))return;q((0,w.TN)());const te=await v();q((0,w.E1)(te))}}function k(q){return async te=>{let oe=await b(q);return q!==oe.uid&&(window.location.href=n.I.assureBaseUrl(`/datasources/edit/${oe.uid}`),oe={}),te((0,w.jz)(oe)),oe}}function Y(q){return async te=>{const oe=await(0,d.x)(q.type),ue=await(0,h.cS)(oe),ie=ue.DataSourceClass.prototype instanceof o.iy,ge={...oe,isBackend:oe.backend||ie};te((0,w.gZ)(ge)),ue.meta=ge,te((0,u.Vz)((0,H.R4)(q,ue)))}}function ee(q,te=I.I.Edit){return async()=>{const oe={type:q.id,access:"proxy"},ue=await C(oe),ie=te.replace(/:uid/gi,ue.datasource.uid);await(0,f.tR)().reload(),await c.TP.fetchUserPermissions(),(0,x.V9)({grafana_version:r.$.buildInfo.version,plugin_id:q.id,datasource_uid:ue.datasource.uid,plugin_version:ue.meta?.info?.version,path:ie}),g.Ny.push(ie)}}function re(){return async q=>{q((0,w.Gc)());const te=await y(),oe=P(te);q((0,w.f$)({plugins:te,categories:oe}))}}function J(q){return async te=>{try{await M(q)}catch(oe){const ue=V(oe);return te((0,w.UP)(ue)),Promise.reject(q)}return await(0,f.tR)().reload(),te(k(q.uid))}}function ne(){return async(q,te)=>{const{uid:oe}=te().dataSources.dataSource;try{await T(oe),await(0,f.tR)().reload();const ue=l.b.DataSources;g.Ny.push(ue)}catch(ue){const ie=V(ue);q((0,w.UP)(ie))}}}},458:(Q,A,e)=>{"use strict";e.d(A,{C:()=>o});var t=e(96540),n=e(83883);const o=(0,t.createContext)(n.I)},11084:(Q,A,e)=>{"use strict";e.d(A,{$k:()=>D,BY:()=>h,S4:()=>y,Tn:()=>C,US:()=>p,Um:()=>v,_e:()=>M,aM:()=>I,hx:()=>a,k9:()=>E,oU:()=>d,u1:()=>T,xw:()=>b});var t=e(96540),n=e(97007),o=e(28138),s=e(10096),r=e(80348),g=e(28444),u=e(11959),c=e(34258),i=e(458),l=e(36227),f=e(54226);const d=x=>{const S=(0,r.useDispatch)();(0,t.useEffect)(()=>(S((0,c.PK)(x)),function(){S((0,n.N)({cleanupAction:P=>P.dataSourceSettings=l.IJ}))}),[x,S])},h=x=>{const S=(0,r.useDispatch)(),O=I();return()=>S((0,c.Ge)(x,O.Edit))},p=()=>{const x=(0,r.useDispatch)(),S=(0,r.useSelector)(P=>P.dataSources.isLoadingDataSources),O=(0,r.useSelector)(P=>P.dataSources.dataSources);return(0,t.useEffect)(()=>{x((0,c.bn)())},[x]),{isLoading:S,dataSources:O}},m=x=>{const S=useDispatch();useEffect(()=>{S(loadDataSource(x))},[S,x])},a=()=>{const x=(0,r.useDispatch)();(0,t.useEffect)(()=>{x((0,c.G2)())},[x])},v=()=>{const x=(0,r.useDispatch)(),S=I();return O=>{x((0,c.du)(O,S.Edit))}},E=()=>{const x=(0,r.useDispatch)();return async S=>x((0,c.jB)(S))},D=()=>{const x=(0,r.useDispatch)(),{name:S}=(0,r.useSelector)(O=>O.dataSources.dataSource);return()=>{o.A.publish(new g.bY({title:"Delete",text:`Are you sure you want to delete the "${S}" data source?`,yesText:"Delete",icon:"trash-alt",onConfirm:()=>x((0,c.Qq)())}))}},b=x=>(0,r.useSelector)(S=>(0,f.U4)(S.dataSources,x)),C=x=>{const S=b(x);return(0,u.h)(S)},y=x=>(0,r.useSelector)(S=>(0,f.Fj)(S.dataSources,x)),M=()=>(0,r.useSelector)(x=>x.dataSourceSettings),T=x=>{const S=b(x),O=S.readOnly===!0,P=s.TP.hasPermissionInMetadata(r.AccessControlAction.DataSourcesWrite,S),L=s.TP.hasPermissionInMetadata(r.AccessControlAction.DataSourcesDelete,S);return{readOnly:O,hasWriteRights:P,hasDeleteRights:L}},I=()=>(0,t.useContext)(i.C)},85464:(Q,A,e)=>{"use strict";e.d(A,{$k:()=>o.$k,BY:()=>o.BY,Bs:()=>r.Bs,CR:()=>n.C,C_:()=>r.C_,S4:()=>o.S4,Tk:()=>r.Tk,Tn:()=>o.Tn,US:()=>o.US,Um:()=>o.Um,_e:()=>o._e,aM:()=>o.aM,du:()=>t.du,eB:()=>r.eB,hp:()=>g.hp,hx:()=>o.hx,jz:()=>r.jz,k9:()=>o.k9,lv:()=>g.lv,oU:()=>o.oU,rb:()=>r.rb,u1:()=>o.u1,wC:()=>g.wC,xs:()=>g.xs,xw:()=>o.xw,zC:()=>g.zC});var t=e(34258),n=e(458),o=e(11084),s=e(74984),r=e(36227),g=e(54226)},74984:(Q,A,e)=>{"use strict";e.d(A,{$m:()=>f,R4:()=>i,Vh:()=>l});var t=e(43429),n=e(33378),o=e(76323),s=e(2913),r=e(10096),g=e(35538),u=e(80348);const c="Loading";function i(h,p){const m=p.meta,a=s.Ay.featureToggles.featureHighlights,v={img:m.info.logos.large,id:"datasource-"+h.uid,url:"",text:h.name,children:[{active:!1,icon:"sliders-v-alt",id:`datasource-settings-${h.uid}`,text:"Settings",url:`datasources/edit/${h.uid}/`}]};if(p.configPages)for(const M of p.configPages)v.children.push({active:!1,text:M.title,icon:M.icon,url:`datasources/edit/${h.uid}/?page=${M.id}`,id:`datasource-page-${M.id}`});m.includes&&d(m.includes)&&r.TP.hasRole("Admin")&&v.children.push({active:!1,icon:"apps",id:`datasource-dashboards-${h.uid}`,text:"Dashboards",url:`datasources/edit/${h.uid}/dashboards`});const E=h.type===c,D="feature-highlights-data-source-permissions-badge",b={active:!1,icon:"lock",id:`datasource-permissions-${h.uid}`,text:"Permissions",url:`datasources/edit/${h.uid}/permissions`};if((0,g.z5)()&&!E&&(b.tabSuffix=()=>(0,o.J)({experimentId:D,eventVariant:"trial"})),(0,n.a)("dspermissions.enforcement")?r.TP.hasPermissionInMetadata(u.AccessControlAction.DataSourcesPermissionsRead,h)&&v.children.push(b):a&&!E&&v.children.push({...b,url:b.url+"/upgrade",tabSuffix:()=>(0,o.J)({experimentId:D})}),s.Ay.analytics?.enabled){const M="feature-highlights-data-source-insights-badge",T={active:!1,icon:"info-circle",id:`datasource-insights-${h.uid}`,text:"Insights",url:`datasources/edit/${h.uid}/insights`};(0,g.z5)()&&!E&&(T.tabSuffix=()=>(0,o.J)({experimentId:M,eventVariant:"trial"})),(0,n.a)("analytics")?r.TP.hasPermission(u.AccessControlAction.DataSourcesInsightsRead)&&v.children.push(T):a&&!E&&v.children.push({...T,url:T.url+"/upgrade",tabSuffix:()=>(0,o.J)({experimentId:M})})}const C="feature-highlights-query-caching-badge",y={active:!1,icon:"database",id:`datasource-cache-${h.uid}`,text:"Cache",url:`datasources/edit/${h.uid}/cache`,hideFromTabs:!m.isBackend||!s.Ay.caching.enabled};return(0,g.z5)()&&!E&&(y.tabSuffix=()=>(0,o.J)({experimentId:C,eventVariant:"trial"})),(0,n.a)("caching")?r.TP.hasPermissionInMetadata(u.AccessControlAction.DataSourcesCachingRead,h)&&v.children.push(y):a&&!E&&v.children.push({...y,url:y.url+"/upgrade",tabSuffix:()=>(0,o.J)({experimentId:C})}),v}function l(h,p){let m={text:""};for(const a of h.children)if(a.id.indexOf(p)>0){a.active=!0,m=a;break}return{main:h,node:m}}function f(h){const p=i({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:c,typeName:c,typeLogoUrl:"public/img/icn-datasource.svg",url:"",user:"",secureJsonFields:{}},{meta:{id:"1",type:t.QE.datasource,name:"",info:{author:{name:"",url:""},description:"",links:[{name:"",url:""}],logos:{large:"",small:""},screenshots:[],updated:"",version:""},includes:[],module:"",baseUrl:""}});return l(p,h)}function d(h){return h.find(p=>p.type==="dashboard")!==void 0}},36227:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>T,Bs:()=>l,C_:()=>p,E1:()=>g,Gc:()=>c,IJ:()=>v,Ks:()=>E,QZ:()=>b,TN:()=>r,Tk:()=>m,UP:()=>y,eB:()=>d,f$:()=>i,gZ:()=>u,jz:()=>s,lg:()=>C,qR:()=>D,rb:()=>h});var t=e(30038),n=e(19484);const o={dataSources:[],plugins:[],categories:[],dataSource:{},layoutMode:n.R.List,searchQuery:"",dataSourcesCount:0,dataSourceTypeSearchQuery:"",isLoadingDataSources:!1,isLoadingDataSourcePlugins:!1,dataSourceMeta:{},isSortAscending:!0},s=(0,t.VP)("dataSources/dataSourceLoaded"),r=(0,t.VP)("dataSources/dataSourcesLoad"),g=(0,t.VP)("dataSources/dataSourcesLoaded"),u=(0,t.VP)("dataSources/dataSourceMetaLoaded"),c=(0,t.VP)("dataSources/dataSourcePluginsLoad"),i=(0,t.VP)("dataSources/dataSourcePluginsLoaded"),l=(0,t.VP)("dataSources/setDataSourcesSearchQuery"),f=(0,t.VP)("dataSources/setDataSourcesLayoutMode"),d=(0,t.VP)("dataSources/setDataSourceTypeSearchQuery"),h=(0,t.VP)("dataSources/setDataSourceName"),p=(0,t.VP)("dataSources/setIsDefault"),m=(0,t.VP)("dataSources/setIsSortAscending"),a=(I=o,x)=>r.match(x)?{...I,isLoadingDataSources:!0}:g.match(x)?{...I,isLoadingDataSources:!1,dataSources:x.payload,dataSourcesCount:x.payload.length}:s.match(x)?{...I,dataSource:x.payload}:l.match(x)?{...I,searchQuery:x.payload}:f.match(x)?{...I,layoutMode:x.payload}:c.match(x)?{...I,plugins:[],isLoadingDataSourcePlugins:!0}:i.match(x)?{...I,plugins:x.payload.plugins,categories:x.payload.categories,isLoadingDataSourcePlugins:!1}:d.match(x)?{...I,dataSourceTypeSearchQuery:x.payload}:u.match(x)?{...I,dataSourceMeta:x.payload}:h.match(x)?{...I,dataSource:{...I.dataSource,name:x.payload}}:p.match(x)?{...I,dataSource:{...I.dataSource,isDefault:x.payload}}:m.match(x)?{...I,isSortAscending:x.payload}:I,v={testingStatus:{},loadError:null,loading:!0,plugin:null},E=(0,t.VP)("dataSourceSettings/initDataSourceSettingsSucceeded"),D=(0,t.VP)("dataSourceSettings/initDataSourceSettingsFailed"),b=(0,t.VP)("dataSourceSettings/testDataSourceStarting"),C=(0,t.VP)("dataSourceSettings/testDataSourceSucceeded"),y=(0,t.VP)("dataSourceSettings/testDataSourceFailed"),T={dataSources:a,dataSourceSettings:(I=v,x)=>E.match(x)?{...I,plugin:x.payload,loadError:null,loading:!1}:D.match(x)?{...I,plugin:null,loadError:x.payload.message,loading:!1}:b.match(x)?{...I,testingStatus:{message:"Testing... this could take up to a couple of minutes",status:"info"}}:C.match(x)?{...I,testingStatus:{status:x.payload?.status,message:x.payload?.message,details:x.payload?.details}}:y.match(x)?{...I,testingStatus:{status:"error",message:x.payload?.message,details:x.payload?.details}}:I}},54226:(Q,A,e)=>{"use strict";e.d(A,{Fj:()=>r,U4:()=>s,hp:()=>o,lv:()=>i,wC:()=>c,xs:()=>g,zC:()=>n});var t=e(41811);const n=(0,t.A)(l=>{const f=new RegExp(l.searchQuery,"i");return l.dataSources.filter(h=>f.test(h.name)||f.test(h.database)||f.test(h.type)).sort((h,p)=>l.isSortAscending?h.name.localeCompare(p.name):p.name.localeCompare(h.name))}),o=(0,t.A)(l=>{const f=new RegExp(l.dataSourceTypeSearchQuery,"i");return l.plugins.filter(d=>f.test(d.name))}),s=(l,f)=>l.dataSource.uid===f?l.dataSource:{},r=(l,f)=>l.dataSourceMeta.id===f?l.dataSourceMeta:{},g=l=>l.searchQuery,u=l=>l.layoutMode,c=l=>l.dataSourcesCount,i=l=>l.isSortAscending},4589:(Q,A,e)=>{"use strict";e.d(A,{M1:()=>s,Mh:()=>o,TR:()=>r,V9:()=>n,_i:()=>u,kg:()=>g,m3:()=>c});var t=e(14110);const n=i=>{(0,t.rR)("grafana_ds_add_datasource_clicked",i)},o=i=>{(0,t.rR)("grafana_ds_test_datasource_clicked",i)},s=i=>{(0,t.rR)("grafana_ds_explore_datasource_clicked",i)},r=i=>{(0,t.rR)("grafana_ds_create_dashboard_clicked",i)},g=i=>{(0,t.rR)("grafana_ds_datasources_list_viewed",i)},u=i=>{(0,t.rR)("connections_datasources_settings_clicked",{item:i})},c=i=>{(0,t.rR)("connections_datasources_ds_configured",i)}},11959:(Q,A,e)=>{"use strict";e.d(A,{h:()=>o});var t=e(76885),n=e(71733);const o=s=>{const r=JSON.stringify({datasource:s.name,context:"explore"});return t.kM.renderUrl(n.I.assureBaseUrl("/explore"),{left:r})}},38074:()=>{"use strict"},21934:(Q,A,e)=>{"use strict";e.d(A,{N:()=>c});var t=e(32196),n=e(96540),o=e(40845),s=e(88323),r=e(83598),g=e(64278);const u={label:"Fixed color",value:"_____fixed_____"},c=l=>{const{value:f,context:d,onChange:h,item:p}=l,m="dark-green",a=(0,o.of)(i),v=f?.field,E=f&&!v&&f?.fixed,D=(0,g.sE)(d.data),b=(0,g.m3)(D,v,u,void 0,p.settings?.baseNameMode),C=(0,n.useCallback)(T=>{if(!T){h(void 0);return}const I=T.value;if(I&&I!==u.value)h({...f,field:I});else{const x=f?.fixed??m;h({...f,field:void 0,fixed:x})}},[h,f]),y=(0,n.useCallback)(T=>{h({field:void 0,fixed:T??m})},[h]),M=E?u:b.find(T=>T.value===v);return n.createElement(n.Fragment,null,n.createElement("div",{className:a.container},n.createElement(s.l6,{value:M,options:b,onChange:C,noOptionsMessage:"No fields found",isClearable:p.settings?.isClearable,placeholder:p.settings?.placeholder}),E&&n.createElement("div",{className:a.picker},n.createElement(r.sk,{color:f?.fixed,onChange:y,enableNamedColors:!0}))))},i=l=>({container:(0,t.css)` display: flex; flex-wrap: nowrap; justify-content: flex-end; align-items: center; `,picker:(0,t.css)` padding-left: 8px; `})},25148:(Q,A,e)=>{"use strict";e.d(A,{n:()=>m});var t=e(32196),n=e(96540),o=e(40845),s=e(55852),r=e(39268),g=e(14186),u=e(10354),c=e(95868),i=e(13840),l=e(40321),f=e(47694),d=e(21813),h=e(80744),p=e(19448);const m=E=>{const{value:D,src:b,name:C,placeholder:y,onChange:M,onClear:T,mediaType:I,folderName:x,size:S,color:O,maxFiles:P}=E,L=(0,o.of)(v),U=(0,o.$j)(),R=(0,n.createRef)(),B=n.createElement(p.i,{onChange:M,value:D,mediaType:I,folderName:x,maxFiles:P});let H=b;!H&&D&&(H=(0,d.D)(D));const w=O&&{fill:U.visualization.getColorByName(O)},N=()=>D&&H?n.createElement(f.y,{src:H,className:L.icon,style:{...w}}):n.createElement(s.z9,{variant:"primary",fill:"text",size:"sm"},"Set icon"),V=()=>n.createElement(r.C,null,n.createElement(g.I,{label:null,grow:!0},n.createElement(u.p,{value:a(b,C),placeholder:y,readOnly:!0,prefix:H&&n.createElement(f.y,{src:H,className:L.icon,style:{...w}}),suffix:n.createElement(s.$n,{icon:"times",variant:"secondary",fill:"text",size:"sm",onClick:T})})));return n.createElement(c.I,{content:B},(G,_,K)=>n.createElement(n.Fragment,null,R.current&&n.createElement(i.A,{...K,referenceElement:R.current,onMouseEnter:G,onKeyDown:j=>{(0,l.Q)(j,_)}}),n.createElement("div",{ref:R,className:L.pointer,onClick:G,onKeyDown:j=>{j.key==="Enter"&&G()},role:"button",tabIndex:0},S===h.Iy.SMALL&&N(),S===h.Iy.NORMAL&&V())))};function a(E,D){if(E?.startsWith("public/img/icons")){const b=D?.lastIndexOf(".svg")??0;if(b>0)return D.substring(0,b)}return D}const v=E=>({pointer:(0,t.css)` cursor: pointer; input[readonly] { cursor: pointer; } `,icon:(0,t.css)` vertical-align: middle; display: inline-block; fill: currentColor; width: 25px; `})},19448:(Q,A,e)=>{"use strict";e.d(A,{i:()=>H});var t=e(32196),n=e(80279),o=e(7887),s=e(82148),r=e(96540),g=e(17172),u=e(40845),c=e(55852),i=e(2913),l=e(80744),f=e(88575),d=e(37270),h=e(47694);function p({secondaryText:N="Drag and drop here or browse"}){const V=(0,u.of)(a);return r.createElement("div",{className:V.iconWrapper},r.createElement("small",{className:V.small},N),r.createElement(c.$n,{type:"button",icon:"upload"},"Upload"))}const m=({mediaType:N,setFormData:V,setUpload:G,error:_})=>{const K=(0,u.of)(a),[j,k]=(0,r.useState)(!1),[Y,ee]=(0,r.useState)(""),re=()=>r.createElement(f.D,{label:"Preview"},r.createElement("div",{className:K.iconPreview},N===l.zu.Icon&&r.createElement(h.y,{src:Y,className:K.img}),N===l.zu.Image&&r.createElement("img",{src:Y,alt:"Preview of the uploaded file",className:K.img}))),J=q=>{fetch(`/api/storage/delete/upload/${q.file.name}`,{method:"DELETE"}).catch(te=>console.error("cannot delete file",te))},ne=N==="icon"?{"image/*":[".svg",".xml"]}:{"image/*":[".jpeg",".png",".gif",".webp"]};return r.createElement(d.gH,{readAs:"readAsBinaryString",onFileRemove:J,options:{accept:ne,multiple:!1,onDrop:q=>{let te=new FormData;te.append("file",q[0]),ee(URL.createObjectURL(q[0])),k(!0),V(te),G(!0)}}},_.message!==""&&j?r.createElement("p",null,_.message):j?r.createElement(re,null):r.createElement(p,null))};function a(N,V){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: ${N.spacing(6)}; border-radius: 2px; border: 2px dashed ${N.colors.border.medium}; background-color: ${V?N.colors.background.secondary:N.colors.background.primary}; cursor: pointer; `,iconWrapper:(0,t.css)` display: flex; flex-direction: column; align-items: center; `,acceptMargin:(0,t.css)` margin: ${N.spacing(2,0,1)}; `,small:(0,t.css)` color: ${N.colors.text.secondary}; margin-bottom: ${N.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 ${N.colors.border.medium}; display: flex; align-items: center; justify-content: center; `,img:(0,t.css)` width: 147px; height: 147px; fill: ${N.colors.text.primary}; `}}var v=e(88323),E=e(67647),D=e(31193),b=e(70713),C=e(91793);const y=(0,r.memo)(function(V){const{columnIndex:G,rowIndex:_,style:K,data:j}=V,{cards:k,columnCount:Y,onChange:ee,selected:re}=j,J=G+_*Y,ne=k[J],q=(0,u.of)(T);return r.createElement("div",{style:K},ne&&r.createElement("div",{key:ne.value,className:re===ne.value?(0,t.cx)(q.card,q.selected):q.card,onClick:()=>ee(ne.value),onKeyDown:te=>{te.key==="Enter"&&ee(ne.value)},role:"button",tabIndex:0},ne.imgUrl.endsWith(".svg")?r.createElement(h.y,{src:ne.imgUrl,className:q.img}):r.createElement("img",{src:ne.imgUrl,alt:"",className:q.img}),r.createElement("h6",{className:q.text},ne.label.slice(0,-4))))},C.t7),M=N=>{const{onChange:V,cards:G,value:_}=N,K=(0,u.of)(T);return r.createElement(b.Ay,{defaultWidth:680},({width:j,height:k})=>{const re=Math.floor(j/90),J=Math.ceil(G.length/re);return r.createElement(C.yi,{width:j,height:k,columnCount:re,columnWidth:90,rowCount:J,rowHeight:90,itemData:{cards:G,columnCount:re,onChange:V,selected:_},className:K.grid},y)})},T=N=>({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: ${N.colors.action.hover}; box-shadow: ${N.shadows.z2}; } `,selected:(0,t.css)` border: 2px solid ${N.colors.primary.main}; :hover { border-color: ${N.colors.primary.main}; } `,img:(0,t.css)` width: 40px; height: 40px; object-fit: cover; vertical-align: middle; fill: ${N.colors.text.primary}; `,text:(0,t.css)` color: ${N.colors.text.primary}; white-space: nowrap; font-size: 12px; text-overflow: ellipsis; display: block; overflow: hidden; `,grid:(0,t.css)` border: 1px solid ${N.colors.border.medium}; `}),I=N=>N===l.zu.Icon?[l.Iu.Icon,l.Iu.IOT,l.Iu.Marker]:[l.Iu.BG],x=(N,V)=>N.find(G=>V.startsWith(G.value))??N[0],S=N=>{const{value:V,mediaType:G,folderName:_,newValue:K,setNewValue:j,maxFiles:k}=N,Y=(0,u.of)(O),ee=I(G).map(he=>({label:he,value:he})),[re,J]=(0,r.useState)(),[ne,q]=(0,r.useState)(x(ee,V?.length?V:_)),[te,oe]=(0,r.useState)([]),[ue,ie]=(0,r.useState)([]),ge=he=>{he?(he=he.toLowerCase(),ie(te.filter(De=>De.search.includes(he)))):ie(te)};return(0,r.useEffect)(()=>{const he=ne?.value;if(he){const De=G===l.zu.Icon?pe=>pe.name.endsWith(".svg"):pe=>pe.name.endsWith(".png")||pe.name.endsWith(".gif");(0,D.tR)().get("-- Grafana --").then(pe=>{pe.listFiles(he,k).subscribe({next:le=>{const Te=[];le.forEach(Ee=>{if(De(Ee)){const Re=Ee.name.lastIndexOf(".");Te.push({value:`${he}/${Ee.name}`,label:Ee.name,search:(Re?Ee.name.substring(0,Re):Ee.name).toLowerCase(),imgUrl:`public/${he}/${Ee.name}`})}}),oe(Te),ie(Te)}})})}},[G,ne,k]),r.createElement(r.Fragment,null,r.createElement(f.D,null,r.createElement(v.l6,{options:ee,onChange:q,value:ne,menuShouldPortal:!1})),r.createElement(f.D,null,r.createElement(E.Z,{value:re??"",placeholder:"Search",onChange:he=>{ge(he),J(he)}})),ue&&r.createElement("div",{className:Y.cardsWrapper},r.createElement(M,{cards:ue,onChange:he=>j(he),value:K})))},O=N=>({cardsWrapper:(0,t.css)` height: 30vh; min-height: 50px; margin-top: 5px; max-width: 680px; `});var P=e(10354),L=e(60029),U=e(21813);const R=N=>{const{newValue:V,setNewValue:G,mediaType:_}=N,K=(0,u.of)(B),j=(0,U.D)(V);let k=V?.substring(V.lastIndexOf("/")+1,V.lastIndexOf("."));return k.length>20&&(k=k.substring(0,20)+"..."),r.createElement(r.Fragment,null,r.createElement(f.D,null,r.createElement(P.p,{onChange:Y=>G(Y.currentTarget.value),value:V})),r.createElement("div",{className:K.iconContainer},r.createElement(f.D,{label:"Preview"},r.createElement("div",{className:K.iconPreview},_===l.zu.Icon&&r.createElement(h.y,{src:j,className:K.img}),_===l.zu.Image&&V&&r.createElement("img",{src:j,alt:"Preview of the selected URL",className:K.img}))),r.createElement(L.J,null,k)))},B=N=>({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 ${N.colors.border.medium}; display: flex; align-items: center; justify-content: center; `,img:(0,t.css)` width: 147px; height: 147px; fill: ${N.colors.text.primary}; `}),H=N=>{const{value:V,onChange:G,mediaType:_,folderName:K,maxFiles:j}=N,k=(0,u.of)(w),Y=()=>{G(V)},ee=(0,r.createRef)(),{dialogProps:re}=(0,n.s)({},ee),{overlayProps:J}=(0,s.e)({onClose:Y,isDismissable:!0,isOpen:!0},ee),ne=V&&V.includes("://"),[q,te]=(0,r.useState)(V??""),[oe,ue]=(0,r.useState)(ne?l.QC.URL:l.QC.Folder),[ie,ge]=(0,r.useState)(new FormData),[he,De]=(0,r.useState)(!1),[pe,le]=(0,r.useState)({message:""}),Te=ye=>`${k.resourcePickerPopoverTab} ${oe===ye&&k.resourcePickerPopoverActiveTab}`,Ee=()=>r.createElement(S,{value:V,mediaType:_,folderName:K,newValue:q,setNewValue:te,maxFiles:j}),Re=()=>r.createElement(R,{newValue:q,setNewValue:te,mediaType:_}),me=()=>r.createElement(m,{mediaType:_,setFormData:ge,setUpload:De,newValue:q,error:pe}),Me=()=>{switch(oe){case l.QC.Folder:return Ee();case l.QC.URL:return Re();case l.QC.Upload:return me();default:return Ee()}};return r.createElement(o.n1,{contain:!0,autoFocus:!0,restoreFocus:!0},r.createElement("section",{ref:ee,...J,...re},r.createElement("div",{className:k.resourcePickerPopover},r.createElement("div",{className:k.resourcePickerPopoverTabs},r.createElement("button",{className:Te(l.QC.Folder),onClick:()=>ue(l.QC.Folder)},"Folder"),r.createElement("button",{className:Te(l.QC.URL),onClick:()=>ue(l.QC.URL)},"URL")),r.createElement("div",{className:k.resourcePickerPopoverContent},Me(),r.createElement("div",{className:k.buttonRow},r.createElement(c.$n,{variant:"secondary",onClick:()=>Y(),fill:"outline"},"Cancel"),r.createElement(c.$n,{variant:q&&q!==V?"primary":"secondary",onClick:()=>{he?fetch("/api/storage/upload",{method:"POST",body:ie}).then(ye=>{if(ye.status>=400){ye.json().then(Le=>le(Le));return}else return ye.json()}).then(ye=>{(0,g.AI)().get(`api/storage/read/${ye.path}`).then(()=>te(`${i.$W.appUrl}api/storage/read/${ye.path}`)).then(()=>G(`${i.$W.appUrl}api/storage/read/${ye.path}`))}).catch(ye=>console.error(ye)):G(q)}},"Select"))))))},w=N=>({resourcePickerPopover:(0,t.css)` border-radius: ${N.shape.radius.default}; box-shadow: ${N.shadows.z3}; background: ${N.colors.background.primary}; border: 1px solid ${N.colors.border.weak}; `,resourcePickerPopoverTab:(0,t.css)` width: 50%; text-align: center; padding: ${N.spacing(1,0)}; background: ${N.colors.background.secondary}; color: ${N.colors.text.secondary}; font-size: ${N.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: ${N.colors.text.primary}; font-weight: ${N.typography.fontWeightMedium}; background: ${N.colors.background.primary}; `,resourcePickerPopoverContent:(0,t.css)` width: 315px; font-size: ${N.typography.bodySmall.fontSize}; min-height: 184px; padding: ${N.spacing(1)}; display: flex; flex-direction: column; `,resourcePickerPopoverTabs:(0,t.css)` display: flex; width: 100%; border-radius: ${N.shape.radius.default} ${N.shape.radius.default} 0 0; `,buttonRow:(0,t.css)({display:"flex",justifyContent:"center",gap:N.spacing(2),padding:N.spacing(1)})})},86640:(Q,A,e)=>{"use strict";e.d(A,{h:()=>d});var t=e(96540),n=e(52622),o=e(39268),s=e(14186),r=e(94354),g=e(55852),u=e(76218),c=e(29286);const i=[{label:"Fixed",value:n.RU.Fixed,description:"Fixed value"},{label:"Field",value:n.RU.Field,description:"Display field value"}],l={settings:{}},f={settings:{}},d=({value:h,context:p,onChange:m})=>{const v=(0,t.useCallback)(y=>{m({...h,mode:y})},[m,h]),E=(0,t.useCallback)(y=>{m({...h,field:y})},[m,h]),D=(0,t.useCallback)((y="")=>{m({...h,fixed:y})},[m,h]),b=()=>{D("")},C=h?.mode??n.RU.Fixed;return t.createElement(t.Fragment,null,t.createElement(o.C,null,t.createElement(s.I,{label:"Source",labelWidth:9,grow:!0},t.createElement(r.z,{value:C,options:i,onChange:v,fullWidth:!0}))),C!==n.RU.Fixed&&t.createElement(o.C,null,t.createElement(s.I,{label:"Field",labelWidth:9,grow:!0},t.createElement(u.O,{context:p,value:h.field??"",onChange:E,item:l}))),C===n.RU.Fixed&&t.createElement(o.C,{key:h?.fixed},t.createElement(s.I,{label:"Value",labelWidth:9,grow:!0},t.createElement(c.g,{context:p,value:h?.fixed,onChange:D,item:f,suffix:h?.fixed&&t.createElement(g.$n,{icon:"times",variant:"secondary",fill:"text",size:"sm",onClick:b})}))),C===n.RU.Template&&t.createElement(o.C,null,t.createElement(s.I,{label:"Template",labelWidth:9,grow:!0},t.createElement(c.g,{context:p,value:h?.fixed,onChange:D,item:f}))))}},78437:(Q,A,e)=>{"use strict";e.d(A,{NO:()=>t.N,mj:()=>m,AW:()=>P,gm:()=>T,hj:()=>U.h});var t=e(21934),n=e(96540);const o=({value:R,onChange:B})=>{const[H,w]=useState(R?[{value:R,label:R}]:[]),[N,V]=useState(),G=window.__grafana_public_path__+"img/icons/unicons/",_=K=>{B(K),V(K)};return useEffect(()=>{getBackendSrv().get(`${G}/index.json`).then(K=>{w(K.files.map(j=>({value:j,label:j})))})},[G]),React.createElement(Select,{options:H,value:N,onChange:K=>{_(K.value)}})},s=null;var r=e(52622),g=e(39268),u=e(14186),c=e(94354),i=e(76218),l=e(63577),f=e(80744),d=e(25148);const h=[{label:"Fixed",value:r.q_.Fixed,description:"Fixed value"},{label:"Field",value:r.q_.Field,description:"Use a string field result"}],p={settings:{}},m=R=>{const{value:B,context:H,onChange:w,item:N}=R,V=9,G=(0,n.useCallback)(q=>{w({...B,mode:q})},[w,B]),_=(0,n.useCallback)((q="")=>{w({...B,field:q})},[w,B]),K=(0,n.useCallback)(q=>{w({...B,fixed:q??""})},[w,B]),j=q=>{q.stopPropagation(),w({mode:r.q_.Fixed,fixed:"",field:""})},k=B?.mode??r.q_.Fixed,Y=N.settings?.showSourceRadio??!0,ee=N.settings?.resourceType??f.zu.Icon,re=N.settings?.folderName??l.ResourceFolderName.Icon,J=N.settings?.maxFiles;let ne="";return ee===f.zu.Icon&&(B?.fixed?ne=(0,l.getPublicOrAbsoluteUrl)(B.fixed):N.settings?.placeholderValue&&(ne=(0,l.getPublicOrAbsoluteUrl)(N.settings.placeholderValue))),n.createElement(n.Fragment,null,Y&&n.createElement(g.C,null,n.createElement(u.I,{label:"Source",labelWidth:V,grow:!0},n.createElement(c.z,{value:k,options:h,onChange:G,fullWidth:!0}))),k!==r.q_.Fixed&&n.createElement(g.C,null,n.createElement(u.I,{label:"Field",labelWidth:V,grow:!0},n.createElement(i.O,{context:H,value:B.field??"",onChange:_,item:p}))),k===r.q_.Fixed&&n.createElement(d.n,{onChange:K,onClear:j,value:B?.fixed,src:ne,placeholder:N.settings?.placeholderText??"Select a value",name:a(B?.fixed)??"",mediaType:ee,folderName:re,size:f.Iy.NORMAL,maxFiles:J}),k===r.q_.Mapping&&n.createElement(g.C,null,n.createElement(u.I,{label:"Mappings",labelWidth:V,grow:!0},n.createElement("div",null,"TODO mappings editor!"))))};function a(R){if(!R)return;const B=R.lastIndexOf("/");return B>0?R.substring(B+1):R}var v=e(32196),E=e(40845),D=e(88323),b=e(64278),C=e(60188),y=e(18379);const M={label:"Fixed value",value:"_____fixed_____"},T=R=>{const{value:B,context:H,onChange:w,item:N}=R,{settings:V}=N,G=(0,E.of)(I),_=B?.field,K=!_,j=(0,b.sE)(H.data),k=(0,b.m3)(j,_,M),Y=(0,n.useMemo)(()=>(0,y.Nn)(V),[V]),ee=(0,n.useCallback)(ue=>{w((0,y.Ru)(ue,Y))},[w,Y]),re=(0,n.useCallback)(ue=>{const ie=ue.value;ie&&ie!==M.value?ee({...B,field:ie}):ee({...B,field:void 0})},[ee,B]),J=(0,n.useCallback)(ue=>{ue!==void 0&&ee({...B,min:ue})},[ee,B]),ne=(0,n.useCallback)(ue=>{ue!==void 0&&ee({...B,max:ue})},[ee,B]),q=(0,n.useCallback)(ue=>{ue!==void 0&&ee({...B,fixed:ue})},[ee,B]),te=B??{},oe=K?M:k.find(ue=>ue.value===_);return n.createElement(n.Fragment,null,n.createElement("div",null,n.createElement(D.l6,{value:oe,options:k,onChange:re,noOptionsMessage:"No fields found"})),n.createElement("div",{className:G.range},K&&n.createElement(g.C,null,n.createElement(u.I,{label:"Value",labelWidth:8,grow:!0},n.createElement(C.Q,{value:te.fixed,...Y,onChange:q}))),!K&&!Y.hideRange&&n.createElement(n.Fragment,null,n.createElement(g.C,null,n.createElement(u.I,{label:"Min",labelWidth:8,grow:!0},n.createElement(C.Q,{value:te.min,...Y,onChange:J}))),n.createElement(g.C,null,n.createElement(u.I,{label:"Max",labelWidth:8,grow:!0},n.createElement(C.Q,{value:te.max,...Y,onChange:ne}))))))},I=R=>({range:(0,v.css)` padding-top: 8px; `});var x=e(11261);const S={label:"Fixed value",value:"_____fixed_____"},O=[{label:"Mod",value:r.WQ.Mod,description:"Use field values, mod from max"},{label:"Clamped",value:r.WQ.Clamped,description:"Use field values, clamped to max and min"}],P=({value:R,context:B,onChange:H,item:w})=>{const{settings:N}=w,V=0,G=R?.field,_=!G,K=(0,b.sE)(B.data),j=(0,b.m3)(K,G,S,x.PU.number),k=(0,E.of)(L),Y=(0,n.useCallback)(te=>{const oe=te.value;if(oe&&oe!==S.value)H({...R,field:oe});else{const ue=R.fixed??V;H({...R,field:void 0,fixed:ue})}},[H,R]),ee=(0,n.useCallback)(te=>{H({...R,mode:te})},[H,R]),re=(0,n.useCallback)(te=>{H({...R,field:void 0,fixed:te??V})},[H,R]),J=R??{},ne=R?.mode??r.WQ.Mod,q=_?S:j.find(te=>te.value===G);return n.createElement(n.Fragment,null,n.createElement("div",null,n.createElement(g.C,null,n.createElement(u.I,{label:"Limit",labelWidth:8,grow:!0},n.createElement(c.z,{value:ne,options:O,onChange:ee,fullWidth:!0}))),n.createElement(D.l6,{value:q,options:j,onChange:Y,noOptionsMessage:"No fields found"})),n.createElement("div",{className:k.range},_&&n.createElement(g.C,null,n.createElement(u.I,{label:"Value",labelWidth:8,grow:!0},n.createElement(C.Q,{value:J?.fixed??V,onChange:re,max:N?.max,min:N?.min})))))},L=R=>({range:(0,v.css)` padding-top: 8px; `});var U=e(86640)},63577:(Q,A,e)=>{"use strict";e.d(A,{MediaType:()=>t.zu,ResourceFolderName:()=>t.Iu,findField:()=>r.UI,findFieldIndex:()=>r.gG,getColorDimension:()=>g,getPublicOrAbsoluteUrl:()=>p.D,getResourceDimension:()=>p.$,getScalarDimension:()=>a.H,getScaledDimension:()=>c.hX,getScaledDimensionForField:()=>c.qx,getTextDimension:()=>d});var t=e(80744),n=e(8066),o=e(58563),s=e(57875),r=e(33924);function g(v,E,D){return u((0,r.UI)(v,E.field),E,D)}function u(v,E,D){if(!v){const y=D.visualization.getColorByName(E.fixed??"grey");return{isAssumed:!!E.field?.length||!E.fixed,fixed:y,value:()=>y,get:M=>y}}const b=(0,n.Qi)(v);if(b.isByValue||v.config.mappings?.length){const y=(0,o.xg)(v,!0);y!==v.config&&(v={...v,config:y},v.state=void 0);const M=(0,s.J)({field:v,theme:D}),T=I=>M(I).color??"#ccc";return{field:v,get:I=>T(v.values[I]),value:()=>T((0,r.sB)(v))}}const C=b.getCalculator(v,D)(0,0);return{fixed:C,value:()=>C,get:y=>C,field:v}}var c=e(18379),i=e(11261),l=e(83195),f=e(52622);function d(v,E){const D=E.field?(0,r.UI)(v,E.field):v?.fields.find(b=>b.type===i.PU.string);return h(D,E)}function h(v,E){let D=E.fixed;const b=E.mode??f.RU.Fixed;if(b===f.RU.Fixed)return{isAssumed:!D,fixed:D,value:()=>D,get:y=>D};if(b===f.RU.Template){const y=M=>`TEMPLATE[${E.fixed} // ${M}]`;return v?{field:v,get:M=>y(v.values[M]),value:()=>y((0,r.sB)(v))}:(D=y(""),{isAssumed:!0,fixed:D,value:()=>D,get:M=>D})}if(!v)return{isAssumed:!0,fixed:D,value:()=>D,get:y=>D};let C=y=>(0,l.cN)(v.display(y));return{field:v,get:y=>C(v.values[y]),value:()=>C((0,r.sB)(v))}}var p=e(21813),m=e(38074),a=e(26781)},21813:(Q,A,e)=>{"use strict";e.d(A,{$:()=>s,D:()=>o});var t=e(52622),n=e(33924);function o(r){return r?r.indexOf(":/")>0?r:window.__grafana_public_path__+r:""}function s(r,g){const u=g.mode??t.q_.Fixed;if(u===t.q_.Fixed){const l=o(g.fixed);return{isAssumed:!l,fixed:l,value:()=>l,get:f=>l}}const c=(0,n.UI)(r,g.field);if(!c){const l="";return{isAssumed:!0,fixed:l,value:()=>l,get:f=>l}}if(u===t.q_.Mapping){const l=f=>o(`${f}`);return{field:c,get:f=>l(c.values[f]),value:()=>l((0,n.sB)(c))}}const i=l=>{if(c&&c.display){const f=c.display(l).icon;return o(f??"")}return""};return{field:c,get:l=>i(c.values[l]),value:()=>i((0,n.sB)(c))}}},26781:(Q,A,e)=>{"use strict";e.d(A,{H:()=>o});var t=e(52622),n=e(33924);function o(r,g){return s((0,n.UI)(r,g?.field),g)}function s(r,g){if(!r){const i=g.fixed??0;return{isAssumed:!!g.field?.length||!g.fixed,fixed:i,value:()=>i,get:()=>i}}let u=i=>i%g.max;return g.mode===t.WQ.Clamped&&(u=i=>i<g.min?g.min:i>g.max?g.max:i),{field:r,get:i=>{const l=r.values[i];return l===null||typeof l!="number"?0:u(l)},value:()=>(0,n.sB)(r)}}},18379:(Q,A,e)=>{"use strict";e.d(A,{Nn:()=>g,Ru:()=>u,hX:()=>s,qx:()=>r});var t=e(58563),n=e(52622),o=e(33924);function s(c,i){return r((0,o.UI)(c,i?.field),i)}function r(c,i,l){if(!c){const a=i.fixed??0;return{isAssumed:!!i.field?.length||!i.fixed,fixed:a,value:()=>a,get:()=>a}}const f=(0,t.AP)(c),d=i.max-i.min;if(c.values.length<1||d<=0||f.delta<=0)return{fixed:i.min,value:()=>i.min,get:()=>i.min};let p=a=>i.min+a*d;if(l===n.QH.Quad){const a=Math.PI*(i.max/2)**2,v=Math.PI*(i.min/2)**2,E=a-v;p=D=>{let b=v+E*D;return Math.sqrt(b/Math.PI)*2}}const m=a=>{const v=c.values[a];let E=0;return v!==-1/0&&(E=(v-f.min)/f.delta),E>1?E=1:E<0&&(E=0),p(E)};return{get:m,value:()=>m((0,o.sB)(c)),field:c}}function g(c){return c||(c={min:0,max:1}),c.min==null&&(c.min=0),c.max==null&&(c.max=1),c}function u(c,i){let{min:l,max:f}=g(i);if(c||(c={}),c.max==null&&(c.max=f),c.min==null&&(c.min=l),c.min>c.max){const d=c.max;c.max=c.min,c.min=d}return c.min<l&&(c.min=l),c.max>f&&(c.max=f),c.fixed==null&&(c.fixed=c.min+(c.max-c.min)/2),c.field||(c.fixed>f?c.fixed=f:c.fixed<l&&(c.fixed=l)),c}},80744:(Q,A,e)=>{"use strict";e.d(A,{Iu:()=>o,Iy:()=>g,QC:()=>r,nG:()=>n,zu:()=>s});var t=e(52622);const n=Object.freeze({fixed:"",mode:t.RU.Field,field:""});var o=(u=>(u.Icon="img/icons/unicons",u.IOT="img/icons/iot",u.Marker="img/icons/marker",u.BG="img/bg",u))(o||{}),s=(u=>(u.Icon="icon",u.Image="image",u))(s||{}),r=(u=>(u.Folder="folder",u.URL="url",u.Upload="upload",u))(r||{}),g=(u=>(u.SMALL="small",u.NORMAL="normal",u))(g||{})},33924:(Q,A,e)=>{"use strict";e.d(A,{B_:()=>i,UI:()=>f,Wb:()=>g,XV:()=>u,b5:()=>c,gG:()=>d,sB:()=>h,wv:()=>l});var t=e(28240),n=e(75059),o=e(32264),s=e(63577),r=e(26781);function g(p,m){if(p?.series&&m.field)for(const a of p.series){const v=(0,s.getColorDimension)(a,m,o.$.theme2);if(!v.isAssumed||p.series.length===1)return v}return(0,s.getColorDimension)(void 0,m,o.$.theme2)}function u(p,m){if(p?.series&&m.field)for(const a of p.series){const v=(0,s.getScaledDimension)(a,m);if(!v.isAssumed||p.series.length===1)return v}return(0,s.getScaledDimension)(void 0,m)}function c(p,m){if(p?.series&&m.field)for(const a of p.series){const v=(0,r.H)(a,m);if(!v.isAssumed||p.series.length===1)return v}return(0,r.H)(void 0,m)}function i(p,m){if(p?.series&&m.field)for(const a of p.series){const v=(0,s.getResourceDimension)(a,m);if(!v.isAssumed||p.series.length===1)return v}return(0,s.getResourceDimension)(void 0,m)}function l(p,m){if(p?.series&&m.field)for(const a of p.series){const v=(0,s.getTextDimension)(a,m);if(!v.isAssumed||p.series.length===1)return v}return(0,s.getTextDimension)(void 0,m)}function f(p,m){const a=d(m,p);return a==null?void 0:p.fields[a]}function d(p,m,a){if(!(!m||!p?.length))for(let v=0;v<m.fields.length;v++){const E=m.fields[v];if(p===E.name)return v;const D=(0,t.Ct)(E,m,a);if(p===D)return v}}function h(p){const m=p.state?.calcs;if(m){const E=m[n.gy.lastNotNull];if(E!=null)return E}const a=p.values;let v=a.length-1;for(;v>=0;){const E=a[v--];if(E!=null)return E}}},9791:(Q,A,e)=>{"use strict";e.d(A,{k:()=>T});var t=e(2543),n=e(96540),o=e(84596),s=e(39070),r=e(47232),g=e(28528),u=e(24293),c=e(90708),i=e(28240),l=e(94624),f=e(24308),d=e(52622),h=e(40845),p=e(79041),m=e(41706),a=e(91126),v=e(33368),E=e(1932);function D(I,x,S){return(0,E.jM)(I,O=>{O.defaults.custom===void 0&&(O.defaults.custom={}),O.defaults.max=S;const{custom:P}=O.defaults;switch(P.stacking===void 0&&(P.stacking={group:"A"}),x){case"lines":P.drawStyle=d.GR.Line,P.stacking.mode=d.gs.None,P.fillOpacity=0;break;case"bars":P.drawStyle=d.GR.Bars,P.stacking.mode=d.gs.None,P.fillOpacity=100;break;case"points":P.drawStyle=d.GR.Points,P.stacking.mode=d.gs.None,P.fillOpacity=0;break;case"stacked_lines":P.drawStyle=d.GR.Line,P.stacking.mode=d.gs.Normal,P.fillOpacity=100,P.axisSoftMin=0;break;case"stacked_bars":P.drawStyle=d.GR.Bars,P.stacking.mode=d.gs.Normal,P.fillOpacity=100,P.axisSoftMin=0;break;default:{const L=x;throw new Error(`Invalid graph-style: ${L}`)}}})}function b(I,x,S){return(0,E.jM)(I,O=>{O.defaults.thresholds=S,O.defaults.custom=O.defaults.custom??{},O.defaults.custom.thresholdsStyle=x})}var C=e(56737),y=e(21423);function M(I){const[x,{inc:S}]=(0,C.A)(1),O=(0,o.A)(I);return(0,n.useMemo)(()=>{O&&!(0,y.J3)(I,O,y.bW)&&S()},[I,O,S]),x}function T({data:I,height:x,width:S,timeZone:O,absoluteRange:P,onChangeTime:L,loadingState:U,annotations:R,onHiddenSeriesChanged:B,splitOpenFn:H,graphStyle:w,tooltipDisplayMode:N=d.$N.Single,anchorToZero:V=!1,yAxisMaximum:G,thresholdsConfig:_,thresholdsStyle:K,eventBus:j,vizLegendOverrides:k}){const Y=(0,h.$j)(),ee=(0,o.A)(P),re=U===s.Gu.Loading&&ee?ee:P,J=(0,n.useMemo)(()=>({from:(0,r.KQ)(re.from),to:(0,r.KQ)(re.to),raw:{from:(0,r.KQ)(re.from),to:(0,r.KQ)(re.to)}}),[re.from,re.to]),ne=(0,n.useMemo)(()=>(0,g.O)((0,m.V)(m.S),"Explore"),[]),[q,te]=(0,n.useState)({defaults:{min:V?0:void 0,max:G||void 0,unit:"short",color:{mode:u.Y.PaletteClassic},custom:{drawStyle:d.GR.Line,fillOpacity:0,pointSize:5}},overrides:[]}),oe=(0,n.useMemo)(()=>{const le=D(q,w,G);return b(le,K,_)},[q,w,G,_,K]),ue=(0,v.h)(H,J),ie=(0,n.useMemo)(()=>(0,c.we)({fieldConfig:oe,data:I,timeZone:O,replaceVariables:le=>le,theme:Y,fieldConfigRegistry:ne,dataLinkPostProcessor:ue}),[ne,I,O,Y,oe,ue]),ge=(0,n.useMemo)(()=>(0,c.we)({fieldConfig:{defaults:{},overrides:[]},data:R,timeZone:O,replaceVariables:le=>le,theme:Y,dataLinkPostProcessor:ue}),[R,O,Y,ue]),he=M(ie);(0,n.useEffect)(()=>{if(B){const le=[];ie.forEach(Te=>{Te.fields.map(Re=>Re.config?.custom?.hideFrom?.viz).every(t.identity)&&le.push((0,i.Ri)(Te))}),B(le)}},[ie,B]);const De={eventsScope:"explore",eventBus:j,sync:()=>l.y.Off,onToggleSeriesVisibility(le,Te){te((0,a.M)(le,Te,q,I))},dataLinkPostProcessor:ue},pe=(0,n.useMemo)(()=>({tooltip:{mode:N,sort:d.xB.None},legend:{displayMode:d.lm.List,showLegend:!0,placement:"bottom",calcs:[],...k}}),[N,k]);return n.createElement(p.XF,{value:De},n.createElement(f.m,{data:{series:ie,timeRange:J,state:U,annotations:ge,structureRev:he},pluginId:"timeseries",title:"",width:S,height:x,onChangeTimeRange:L,timeZone:O,options:pe}))}},72519:(Q,A,e)=>{"use strict";e.d(A,{y:()=>M});var t=e(32196),n=e(96540),o=e(42941),s=e(40845),r=e(91052),g=e(14578),u=e(56034),c=e(55852),i=e(44836),l=e(34028),f=e(9791),d=e(94354),h=e(80348);const p=h.EXPLORE_GRAPH_STYLES.map(I=>({value:I,label:I[0].toUpperCase()+I.slice(1).replace(/_/," ")}));function m(I){const{graphStyle:x,onChangeGraphStyle:S}=I;return n.createElement(d.z,{size:"sm",options:p,value:x,onChange:S})}var a=e(33390);const v="grafana.explore.style.graph",E=I=>{store.set(v,I)},D=()=>C(a.A.get(v)),b="lines",C=I=>h.EXPLORE_GRAPH_STYLES.find(S=>S===I)??b,y=20,M=({data:I,eventBus:x,height:S,width:O,absoluteRange:P,timeZone:L,annotations:U,onChangeTime:R,splitOpenFn:B,thresholdsConfig:H,thresholdsStyle:w,loadingState:N,statusMessage:V})=>{const[G,_]=(0,o.A)(!1),[K,j]=(0,n.useState)(D),k=(0,s.of)(T),Y=(0,n.useCallback)(re=>{(0,l.ng)(re),j(re)},[]),ee=(0,n.useMemo)(()=>G?I:I.slice(0,y),[I,G]);return n.createElement(r.NR,{title:(0,i.t)("graph.container.title","Graph"),titleItems:[!G&&y<I.length&&n.createElement("div",{key:"disclaimer",className:k.timeSeriesDisclaimer},n.createElement("span",{className:k.warningMessage},n.createElement(g.I,{name:"exclamation-triangle","aria-hidden":"true"}),n.createElement(i.x6,{i18nKey:"graph.container.show-only-series"},"Showing only ",{MAX_NUMBER_OF_TIME_SERIES:y}," series")),n.createElement(u.m,{content:(0,i.t)("graph.container.content","Rendering too many series in a single panel may impact performance and make data harder to read. Consider refining your queries.")},n.createElement(c.$n,{variant:"secondary",size:"sm",onClick:_},n.createElement(i.x6,{i18nKey:"graph.container.show-all-series"},"Show all ",{length:I.length}))))].filter(Boolean),width:O,height:S,loadingState:N,statusMessage:V,actions:n.createElement(m,{graphStyle:K,onChangeGraphStyle:Y})},(re,J)=>n.createElement(f.k,{graphStyle:K,data:ee,height:J,width:re,absoluteRange:P,onChangeTime:R,timeZone:L,annotations:U,splitOpenFn:B,loadingState:N,thresholdsConfig:H,thresholdsStyle:w,eventBus:x}))},T=I=>({timeSeriesDisclaimer:(0,t.css)({label:"time-series-disclaimer",display:"flex",alignItems:"center",gap:I.spacing(1)}),warningMessage:(0,t.css)({display:"flex",alignItems:"center",gap:I.spacing(.5),color:I.colors.warning.main,fontSize:I.typography.bodySmall.fontSize})})},97186:(Q,A,e)=>{"use strict";e.d(A,{$:()=>t,r:()=>n});const t={showLabels:"grafana.explore.logs.showLabels",showTime:"grafana.explore.logs.showTime",wrapLogMessage:"grafana.explore.logs.wrapLogMessage",prettifyLogMessage:"grafana.explore.logs.prettifyLogMessage",logsSortOrder:"grafana.explore.logs.sortOrder",logContextWrapLogMessage:"grafana.explore.logs.logContext.wrapLogMessage"},n="grafana.explore.logs.visualisationType"},9651:(Q,A,e)=>{"use strict";e.d(A,{a:()=>u,d:()=>c});var t=e(32196),n=e(96540),o=e(40845),s=e(87066),r=e(9663);const g=(i,l)=>({valueNavigation:(0,t.css)` width: ${r.QH}; font-weight: bold; `,valueNavigationWrapper:(0,t.css)` display: flex; justify-content: flex-end; `,itemLabelsWrap:(0,t.css)` ${l?"":`border-bottom: 1px solid ${i.colors.border.medium}`}; `}),u=i=>i.includes(s.gs)?i.replace(s.gs,""):i,c=({valueLabels:i,expanded:l})=>{const f=(0,o.of)(g,l);return n.createElement("div",{className:f.itemLabelsWrap},n.createElement("div",{className:f.valueNavigationWrapper},i.map((d,h)=>n.createElement("span",{className:f.valueNavigation,key:d.name},u(d.name)))))}},9663:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>b,QH:()=>m,Jd:()=>a});var t=e(32196),n=e(96540),o=e(73287),s=e(14110),r=e(40845),g=e(29158),u=e(9651),c=e(57408);const i=(C,y)=>({rowWrapper:(0,t.css)` position: relative; min-width: ${m}; 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: ${a}; width: calc(${y} * ${m}); display: flex; `}),l=({totalNumberOfValues:C,values:y,hideFieldsWithoutValues:M})=>{const T=(0,r.of)(i,C);return n.createElement("div",{role:"cell",className:T.rowValuesWrap},y?.map(I=>M&&(I.value===void 0||I.value===c.M)?null:n.createElement("span",{key:I.key,className:T.rowWrapper},n.createElement("span",{className:T.rowValue},I.value))))},f=C=>{const y=C.isDark?"#ce9178":"#a31515",M=C.isDark?"#73bf69":"#56a64b";return{metricName:(0,t.css)` color: ${M}; `,metricValue:(0,t.css)` color: ${y}; `,expanded:(0,t.css)` display: block; text-indent: 1em; `}},h=({value:C,index:y,length:M,isExpandedView:T})=>{const I=(0,r.of)(f),x=C.key,S=C.value;return n.createElement("span",{className:T?I.expanded:"",key:y},n.createElement("span",{className:I.metricName},x),n.createElement("span",null,"="),n.createElement("span",null,'"'),n.createElement("span",{className:I.metricValue},S),n.createElement("span",null,'"'),y<M-1&&n.createElement("span",null,", "))},p="20px",m="80px",a="25px",v=(C,y,M)=>({rowWrapper:(0,t.css)` border-bottom: 1px solid ${C.colors.border.medium}; display: flex; position: relative; padding-left: 22px; ${M?"":"align-items: center;"} ${M?"":"height: 100%;"} `,copyToClipboardWrapper:(0,t.css)` position: absolute; left: 0; ${M?"":"bottom: 0;"} ${M?"top: 4px;":"top: 0;"} margin: auto; z-index: 1; height: 16px; width: 16px; `,rowLabelWrapWrap:(0,t.css)` position: relative; width: calc(100% - (${y} * ${m}) - ${a}); `,rowLabelWrap:(0,t.css)` white-space: nowrap; overflow-x: auto; -ms-overflow-style: none; /* IE and Edge */ scrollbar-width: none; /* Firefox */ padding-right: ${p}; &::-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% - ${p}), ${C.colors.background.primary} ); } `});function E(C){let y=[],M=[];for(const T in C)T in C&&C[T]&&!T.includes("Value")?y.push({key:T,value:C[T]}):T in C&&C[T]&&T.includes("Value")&&M.push({key:T,value:C[T]});return{values:M,attributeValues:y}}const b=({listItemData:C,listKey:y,totalNumberOfValues:M,valueLabels:T,isExpandedView:I})=>{const{__name__:x,...S}=C,[O,P]=(0,o.A)(),L=T?.length??M,U=(0,r.of)(v,L,I),{values:R,attributeValues:B}=E(S),H=V=>V==="\u221E"||V==="Infinity"?"+Inf":V,w=`${x}{${B.map(V=>`${V.key}="${H(V.value)}"`)}}`,N=!!(T&&T?.length);return n.createElement(n.Fragment,null,T!==void 0&&I&&n.createElement(u.d,{valueLabels:T,expanded:I}),n.createElement("div",{key:y,className:U.rowWrapper},n.createElement("span",{className:U.copyToClipboardWrapper},n.createElement(g.K,{tooltip:"Copy to clipboard",onClick:()=>{(0,s.rR)("grafana_explore_prometheus_instant_query_ui_raw_toggle_expand"),P(w)},name:"copy"})),n.createElement("span",{role:"cell",className:U.rowLabelWrapWrap},n.createElement("div",{className:U.rowLabelWrap},n.createElement("span",null,x),n.createElement("span",null,"{"),n.createElement("span",null,B.map((V,G)=>n.createElement(h,{isExpandedView:I,value:V,key:G,index:G,length:B.length}))),n.createElement("span",null,"}"))),n.createElement(l,{hideFieldsWithoutValues:N,totalNumberOfValues:L,values:R})))}},57408:(Q,A,e)=>{"use strict";e.d(A,{E:()=>o,M:()=>n});var t=e(83195);const n=" ",o=s=>{const r={},g=[],u=s.fields.filter(l=>!["Time"].includes(l.name));let c=u.find(l=>l.name==="__name__")?.values??[];!c.length&&u.length&&u[0].values.length&&(c=Array(u[0].values.length).fill(""));const i=s.fields.filter(l=>!["__name__"].includes(l.name));return c.forEach(function(l,f){r[l]={};const d=r[l][f]??{};for(const h of i){const p=h.name;if(p!=="Time")if(typeof h?.display=="function"){const m=h?.display(h.values[f]);if(!isNaN(m.numeric))d[p]=m.numeric.toString(10);else{const a=(0,t.cN)(m);a?d[p]=a:p.includes("Value #")&&(d[p]=n)}}else console.warn("Field display method is missing!")}g.push({...d,__name__:l})}),g}},97814:(Q,A,e)=>{"use strict";e.d(A,{g:()=>o});var t=e(96540),n=e(47232);const o=({timeInMs:r,className:g,humanize:u})=>t.createElement("span",{className:g},s(r,u)),s=(r,g=!1)=>{const u=r/1e3;if(!g)return`${u.toFixed(1)}s`;const c=(0,n.Ah)(u,"seconds"),i=c.hours(),l=c.minutes(),f=c.seconds();return i?`${i}h ${l}m ${f}s`:l?`${l}m ${f}s`:`${f}s`}},46923:(Q,A,e)=>{"use strict";e.d(A,{V:()=>Ke});var t=e(32196),n=e(96540),o=e(42941),s=e(41987),r=e(6709),g=e(43549),u=e(72574),c=e(40845),i=e(31193),l=e(32901),f=e(80348),d=e(62256),h=e(50248),p=e(41811);const a=(He,Ge,xe)=>{let $e;return xe?$e=Ge?.childSpanIds.find(be=>He.has(be)&&He.get(be).startTime+He.get(be).duration<xe):$e=Ge.childSpanIds[0],$e?He.get($e):void 0},E=He=>{const Ge=[],xe=[];He.forEach(Z=>{if(Z.references[0]?.refType==="FOLLOWS_FROM"){Ge.push(Z.spanID);const ae=He.get(Z.references[0].spanID);ae.childSpanIds=ae.childSpanIds.filter(de=>de!==Z.spanID),He.set(ae.spanID,{...ae})}});const $e=Z=>{Z.forEach(ae=>{const de=He.get(ae);de.hasChildren&&(xe.push(...de.childSpanIds),$e(de.childSpanIds))})};return $e(Ge),[...Ge,...xe].forEach(Z=>He.delete(Z)),He},b=He=>{let Ge=[...He.keys()];return Ge.forEach(xe=>{const $e=He.get(xe);if(!($e&&$e.references.length&&$e.depth))return;const be=He.get($e.references[0].spanID);if(!be){He.delete($e.spanID);return}const Z=$e.startTime+$e.duration,ae=be.startTime+be.duration;if($e.startTime>=be.startTime){if($e.startTime>=ae){He.delete($e.spanID),be.childSpanIds=be.childSpanIds.filter(de=>de!==$e.spanID);return}if(Z>ae){He.set($e.spanID,{...$e,duration:ae-$e.startTime});return}return}Z<=be.startTime?(He.delete($e.spanID),be.childSpanIds=be.childSpanIds.filter(de=>de!==$e.spanID)):Z<=ae?He.set($e.spanID,{...$e,startTime:be.startTime,duration:Z-be.startTime}):He.set($e.spanID,{...$e,startTime:be.startTime,duration:ae-be.startTime})}),Ge=[...He.keys()],Ge.forEach(xe=>{const $e=He.get(xe);if($e.references.length){const be=He.get($e.references[0].spanID);$e.references[0].span=be,He.set(xe,{...$e})}}),He},C=(He,Ge,xe,$e)=>{const be=He.get(Ge);if(!be)return xe;const Z=a(He,be,$e);let ae;if(Z)ae={spanId:be.spanID,section_start:Z.startTime+Z.duration,section_end:$e||be.startTime+be.duration},ae.section_start!==ae.section_end&&xe.push(ae),C(He,Z.spanID,xe);else if(ae={spanId:be.spanID,section_start:be.startTime,section_end:$e||be.startTime+be.duration},ae.section_start!==ae.section_end&&xe.push(ae),be.references.length){const de=be.references.filter(ve=>ve.refType==="CHILD_OF")[0].spanID;C(He,de,xe,be.startTime)}return xe};function y(He){let Ge=[];const xe=He?.spans[0].spanID;if(xe){const $e=He.spans.reduce((be,Z)=>(be.set(Z.spanID,Z),be),new Map);try{const be=E($e),Z=b(be);Ge=C(Z,xe,Ge)}catch(be){console.log("error while computing critical path for a trace",be)}}return Ge}const T=(0,p.A)(y);var I=e(3911),x=e(71656),S=e(30700);const O=.8,P=2,L=200,U=10,R=60,B=6;function H(He,Ge,xe,$e,be){const Z=new Map,ae=Ge.length<R?R:Math.min(Ge.length,L),de=window.innerWidth*2;He.width=de,He.height=ae;const ve=Math.min(B,Math.max(P,ae/Ge.length)),Ue=ae/Ge.length,_e=He.getContext("2d",{alpha:!1});if(_e){_e.fillStyle=be,_e.fillRect(0,0,de,ae);for(let ze=0;ze<Ge.length;ze++){const{valueWidth:Ve,valueOffset:Ne,serviceName:ot}=Ge[ze],nt=Ne/xe*de;let pt=Ve/xe*de;pt<U&&(pt=U);let mt=Z.get(ot);mt||(mt=`rgba(${$e(ot).concat(O).join()})`,Z.set(ot,mt)),_e.fillStyle=mt,_e.fillRect(nt,ze*Ue,pt,ve)}}}const w=(0,I.N)(He=>({CanvasSpanGraph:(0,t.css)` label: CanvasSpanGraph; background: ${(0,x.R)(He,"#fafafa")}; height: 60px; position: absolute; width: 100%; `}));class N extends n.PureComponent{constructor(Ge){super(Ge),this.getColor=xe=>(0,S.rY)(xe,this.props.theme),this._setCanvasRef=xe=>{this._canvasElm=xe},this._canvasElm=void 0}componentDidMount(){this._draw()}componentDidUpdate(){this._draw()}_draw(){if(this._canvasElm){const{valueWidth:Ge,items:xe}=this.props;H(this._canvasElm,xe,Ge,this.getColor,(0,x.R)(this.props.theme,"#fff"))}}render(){return n.createElement("canvas",{className:w(this.props.theme).CanvasSpanGraph,ref:this._setCanvasRef,"data-testid":"CanvasSpanGraph"})}}const V=(0,c.cV)(N);var G=e(6389);const _=()=>({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 K(He){const{numTicks:Ge,duration:xe}=He,$e=(0,c.of)(_),be=[];for(let Z=0;Z<Ge+1;Z++){const ae=Z/Ge,de=ae===1?{right:"0%"}:{left:`${ae*100}%`};be.push(n.createElement("div",{key:ae,className:$e.TickLabelsLabel,style:de,"data-testid":"tick"},(0,G.a3)(xe*ae)))}return n.createElement("div",{className:$e.TickLabels,"data-testid":"TickLabels"},be)}var j=e(46942),k=e.n(j),Y=e(55852),ee=e(92151);const re=()=>({GraphTick:(0,t.css)` label: GraphTick; stroke: #aaa; stroke-width: 1px; `});function J(He){const{numTicks:Ge}=He,xe=(0,c.of)(re),$e=[];for(let be=1;be<Ge;be++){const Z=`${be/Ge*100}%`;$e.push(n.createElement("line",{className:xe.GraphTick,x1:Z,y1:"0%",x2:Z,y2:"100%",key:be/Ge}))}return n.createElement("g",{"data-testid":"ticks","aria-hidden":"true"},$e)}const ne=()=>({ScrubberHandleExpansion:k()((0,t.css)` label: ScrubberHandleExpansion; cursor: col-resize; fill-opacity: 0; fill: #44f; `,"scrubber-handle-expansion"),ScrubberHandle:k()((0,t.css)` label: ScrubberHandle; cursor: col-resize; fill: #555; `,"scrubber-handle"),ScrubberLine:k()((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 q({isDragging:He,onMouseDown:Ge,onMouseEnter:xe,onMouseLeave:$e,position:be}){const Z=`${be*100}%`,ae=(0,c.of)(ne),de=k()({[ae.ScrubberDragging]:He});return n.createElement("g",{className:de,"data-testid":"scrubber-component"},n.createElement("g",{"data-testid":"scrubber-component-g",className:ae.ScrubberHandles,onMouseDown:Ge,onMouseEnter:xe,onMouseLeave:$e},n.createElement("rect",{"data-testid":"scrubber-component-rect-1",x:Z,className:ae.ScrubberHandleExpansion,style:{transform:"translate(-4.5px)"},width:"9",height:"20"}),n.createElement("rect",{"data-testid":"scrubber-component-rect-2",x:Z,className:ae.ScrubberHandle,style:{transform:"translate(-1.5px)"},width:"3",height:"20"})),n.createElement("line",{className:ae.ScrubberLine,y2:"100%",x1:Z,x2:Z,"data-testid":"scrubber-component-line"}))}const te=(0,I.N)(He=>{const Ge="JaegerUiComponents__ViewingLayerResetZoomHoverClassName",xe=(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 > .${Ge} { display: unset; } `,ViewingLayerGraph:(0,t.css)` label: ViewingLayerGraph; border: 1px solid ${(0,x.R)(He,"#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,x.R)(He,"rgba(214, 214, 214, 0.5)")}; `,ViewingLayerCursorGuide:(0,t.css)` label: ViewingLayerCursorGuide; stroke: ${(0,x.R)(He,"#f44")}; stroke-width: 1; `,ViewingLayerDraggedShift:(0,t.css)` label: ViewingLayerDraggedShift; fill-opacity: 0.2; `,ViewingLayerDrag:(0,t.css)` label: ViewingLayerDrag; fill: ${(0,x.R)(He,"#44f")}; `,ViewingLayerFullOverlay:(0,t.css)` label: ViewingLayerFullOverlay; bottom: 0; cursor: col-resize; left: 0; position: fixed; right: 0; top: 0; user-select: none; `,ViewingLayerResetZoom:xe,ViewingLayerResetZoomHoverClassName:Ge}}),oe={SHIFT_END:"SHIFT_END",SHIFT_START:"SHIFT_START",REFRAME:"REFRAME"};function ue(He,Ge){const[xe,$e]=He<Ge?[He,Ge]:[Ge,He];return{x:`${xe*100}%`,width:`${($e-xe)*100}%`,leadingX:`${Ge*100}%`}}class ie extends n.PureComponent{constructor(Ge){super(Ge),this._setRoot=xe=>{this._root=xe},this._getDraggingBounds=xe=>{if(!this._root)throw new Error("invalid state");const{left:$e,width:be}=this._root.getBoundingClientRect(),[Z,ae]=this.props.viewRange.time.current;let de=1,ve=0;return xe===oe.SHIFT_START?de=ae:xe===oe.SHIFT_END&&(ve=Z),{clientXLeft:$e,maxValue:de,minValue:ve,width:be}},this._handleReframeMouseMove=({value:xe})=>{this.props.updateNextViewRangeTime({cursor:xe})},this._handleReframeMouseLeave=()=>{this._draggerReframe.resetBounds(),this.props.updateNextViewRangeTime({cursor:null})},this._handleReframeDragUpdate=({value:xe})=>{const $e=xe,{time:be}=this.props.viewRange,ae={reframe:{anchor:be.reframe?be.reframe.anchor:$e,shift:$e}};this.props.updateNextViewRangeTime(ae)},this._handleReframeDragEnd=({manager:xe,value:$e})=>{const{time:be}=this.props.viewRange,Z=be.reframe?be.reframe.anchor:$e,[ae,de]=$e<Z?[$e,Z]:[Z,$e];xe.resetBounds(),this.props.updateViewRangeTime(ae,de,"minimap")},this._handleScrubberEnterLeave=({type:xe})=>{const $e=xe===ee.EUpdateTypes.MouseEnter;this.setState({preventCursorLine:$e})},this._handleScrubberDragUpdate=({event:xe,tag:$e,type:be,value:Z})=>{be===ee.EUpdateTypes.DragStart&&xe.stopPropagation(),$e===oe.SHIFT_START?this.props.updateNextViewRangeTime({shiftStart:Z}):$e===oe.SHIFT_END&&this.props.updateNextViewRangeTime({shiftEnd:Z})},this._handleScrubberDragEnd=({manager:xe,tag:$e,value:be})=>{const[Z,ae]=this.props.viewRange.time.current;let de;if($e===oe.SHIFT_START)de=[be,ae];else if($e===oe.SHIFT_END)de=[Z,be];else throw new Error("bad state");xe.resetBounds(),this.setState({preventCursorLine:!1}),this.props.updateViewRangeTime(de[0],de[1],"minimap")},this._resetTimeZoomClickHandler=()=>{this.props.updateViewRangeTime(0,1)},this._draggerReframe=new ee.default({getBounds:this._getDraggingBounds,onDragEnd:this._handleReframeDragEnd,onDragMove:this._handleReframeDragUpdate,onDragStart:this._handleReframeDragUpdate,onMouseMove:this._handleReframeMouseMove,onMouseLeave:this._handleReframeMouseLeave,tag:oe.REFRAME}),this._draggerStart=new ee.default({getBounds:this._getDraggingBounds,onDragEnd:this._handleScrubberDragEnd,onDragMove:this._handleScrubberDragUpdate,onDragStart:this._handleScrubberDragUpdate,onMouseEnter:this._handleScrubberEnterLeave,onMouseLeave:this._handleScrubberEnterLeave,tag:oe.SHIFT_START}),this._draggerEnd=new ee.default({getBounds:this._getDraggingBounds,onDragEnd:this._handleScrubberDragEnd,onDragMove:this._handleScrubberDragUpdate,onDragStart:this._handleScrubberDragUpdate,onMouseEnter:this._handleScrubberEnterLeave,onMouseLeave:this._handleScrubberEnterLeave,tag:oe.SHIFT_END}),this._root=void 0,this.state={preventCursorLine:!1}}componentWillUnmount(){this._draggerReframe.dispose(),this._draggerEnd.dispose(),this._draggerStart.dispose()}_getMarkers(Ge,xe){const $e=te(this.props.theme),be=ue(Ge,xe);return[n.createElement("rect",{key:"fill",className:k()($e.ViewingLayerDraggedShift,$e.ViewingLayerDrag),x:be.x,y:"0",width:be.width,height:this.props.height-2}),n.createElement("rect",{key:"edge",className:k()($e.ViewingLayerDrag),x:be.leadingX,y:"0",width:"1",height:this.props.height-2})]}render(){const{height:Ge,viewRange:xe,numTicks:$e,theme:be}=this.props,{preventCursorLine:Z}=this.state,{current:ae,cursor:de,shiftStart:ve,shiftEnd:Ue,reframe:_e}=xe.time,ze=ve!=null||Ue!=null||_e!=null,[Ve,Ne]=ae;let ot=0;Ve&&(ot=Ve*100);let nt=100;Ne&&(nt=100-Ne*100);let pt;!ze&&de!=null&&!Z&&(pt=`${de*100}%`);const mt=te(be);return n.createElement("div",{"aria-hidden":!0,className:mt.ViewingLayer,style:{height:Ge}},(Ve!==0||Ne!==1)&&n.createElement(Y.$n,{onClick:this._resetTimeZoomClickHandler,className:k()(mt.ViewingLayerResetZoom,mt.ViewingLayerResetZoomHoverClassName),type:"button",variant:"secondary"},"Reset Selection"),n.createElement("svg",{height:Ge,className:mt.ViewingLayerGraph,ref:this._setRoot,onMouseDown:this._draggerReframe.handleMouseDown,onMouseLeave:this._draggerReframe.handleMouseLeave,onMouseMove:this._draggerReframe.handleMouseMove},ot>0&&n.createElement("rect",{x:0,y:0,height:"100%",width:`${ot}%`,className:mt.ViewingLayerInactive,"data-testid":"left-ViewingLayerInactive"}),nt>0&&n.createElement("rect",{x:`${100-nt}%`,y:0,height:"100%",width:`${nt}%`,className:mt.ViewingLayerInactive,"data-testid":"right-ViewingLayerInactive"}),n.createElement(J,{numTicks:$e}),pt&&n.createElement("line",{className:mt.ViewingLayerCursorGuide,x1:pt,y1:"0",x2:pt,y2:Ge-2,strokeWidth:"1","data-testid":"ViewingLayerCursorGuide"}),ve!=null&&this._getMarkers(Ve,ve),Ue!=null&&this._getMarkers(Ne,Ue),n.createElement(q,{isDragging:ve!=null,onMouseDown:this._draggerStart.handleMouseDown,onMouseEnter:this._draggerStart.handleMouseEnter,onMouseLeave:this._draggerStart.handleMouseLeave,position:Ve||0}),n.createElement(q,{isDragging:Ue!=null,position:Ne||1,onMouseDown:this._draggerEnd.handleMouseDown,onMouseEnter:this._draggerEnd.handleMouseEnter,onMouseLeave:this._draggerEnd.handleMouseLeave}),_e!=null&&this._getMarkers(_e.anchor,_e.shift)),ze&&n.createElement("div",{className:mt.ViewingLayerFullOverlay}))}}const ge=(0,c.cV)(ie),he=()=>({container:(0,t.css)({padding:"0 0.5rem 0.5rem 0.5rem"}),canvasContainer:(0,t.css)({position:"relative"})}),De=60,pe=4;function le(He){return{valueOffset:He.relativeStartTime,valueWidth:He.duration,serviceName:He.process.serviceName}}function Te(He){return He.spans.map(le)}const Ee=(0,p.A)(Te);class Re extends n.PureComponent{render(){const{height:Ge,trace:xe,viewRange:$e,updateNextViewRangeTime:be,updateViewRangeTime:Z}=this.props,ae=he();if(!xe)return n.createElement("div",null);const de=Ee(xe);return n.createElement("div",{className:ae.container},n.createElement(K,{numTicks:pe,duration:xe.duration}),n.createElement("div",{className:ae.canvasContainer},n.createElement(V,{valueWidth:xe.duration,items:de}),n.createElement(ge,{viewRange:$e,numTicks:pe,height:Ge||De,updateViewRangeTime:Z,updateNextViewRangeTime:be})))}}Re.defaultProps={height:De};var me=e(28114);function Me(){const[He,Ge]=(0,n.useState)(new Set),xe=(0,n.useCallback)(function(ve){if(He.size===0)return;let Ue=-1,_e=!0;const ze=ve.reduce((Ve,Ne)=>(Ne.depth<=Ue&&(_e=!0),_e&&Ve.has(Ne.spanID)&&(Ve.delete(Ne.spanID),_e=!1,Ue=Ne.depth),Ve),new Set(He));Ge(ze)},[He]),$e=(0,n.useCallback)(function(ve){if(ye(ve,He))return;let Ue;const _e=ve.reduce((ze,Ve)=>(Ue&&Ve.depth<=Ue.depth?(ze.add(Ue.spanID),Ve.hasChildren&&(Ue=Ve)):Ve.hasChildren&&!ze.has(Ve.spanID)&&(Ue=Ve),ze),new Set(He));Ue&&_e.add(Ue.spanID),Ge(_e)},[He]),be=(0,n.useCallback)(function(){Ge(new Set)},[]),Z=(0,n.useCallback)(function(ve){if(ye(ve,He))return;const Ue=ve.reduce((_e,ze)=>(ze.hasChildren&&_e.add(ze.spanID),_e),new Set);Ge(Ue)},[He]),ae=(0,n.useCallback)(function(ve){const Ue=new Set(He);He.has(ve)?Ue.delete(ve):Ue.add(ve),Ge(Ue)},[He]);return{childrenHiddenIDs:He,expandOne:xe,collapseOne:$e,expandAll:be,collapseAll:Z,childrenToggle:ae}}function ye(He,Ge){return He.filter($e=>$e.hasChildren).length===Ge.size}function Le(He){const[Ge,xe]=(0,n.useState)(new Map);(0,n.useEffect)(()=>{xe(new Map)},[He,xe]);const $e=(0,n.useCallback)(function(de){const ve=new Map(Ge);ve.has(de)?ve.delete(de):ve.set(de,new h.DetailState),xe(ve)},[Ge]),be=(0,n.useCallback)(function(de,ve){const Ue=Ge.get(de);if(!Ue)return;const _e=Ue.toggleLogItem(ve),ze=new Map(Ge);return ze.set(de,_e),xe(ze)},[Ge]),Z=(0,n.useCallback)(function(de,ve){const Ue=Ge.get(de);if(!Ue)return;const _e=Ue.toggleReferenceItem(ve),ze=new Map(Ge);return ze.set(de,_e),xe(ze)},[Ge]);return{detailStates:Ge,toggleDetail:$e,detailLogItemToggle:be,detailLogsToggle:(0,n.useCallback)(ae=>We("logs",Ge,xe)(ae),[Ge]),detailWarningsToggle:(0,n.useCallback)(ae=>We("warnings",Ge,xe)(ae),[Ge]),detailStackTracesToggle:(0,n.useCallback)(ae=>We("stackTraces",Ge,xe)(ae),[Ge]),detailReferenceItemToggle:Z,detailReferencesToggle:(0,n.useCallback)(ae=>We("references",Ge,xe)(ae),[Ge]),detailProcessToggle:(0,n.useCallback)(ae=>We("process",Ge,xe)(ae),[Ge]),detailTagsToggle:(0,n.useCallback)(ae=>We("tags",Ge,xe)(ae),[Ge])}}function We(He,Ge,xe){return $e=>{const be=Ge.get($e);if(!be)return;let Z;He==="tags"?Z=be.toggleTags():He==="process"?Z=be.toggleProcess():He==="warnings"?Z=be.toggleWarnings():He==="references"?Z=be.toggleReferences():He==="stackTraces"?Z=be.toggleStackTraces():Z=be.toggleLogs();const ae=new Map(Ge);ae.set($e,Z),xe(ae)}}function Be(){const[He,Ge]=(0,n.useState)(new Set),xe=(0,n.useCallback)(function(Z){Ge(ae=>{const de=new Set(ae);return de.add(Z),de})},[]),$e=(0,n.useCallback)(function(Z){Ge(ae=>{const de=new Set(ae);return de.delete(Z),de})},[]);return{hoverIndentGuideIds:He,addHoverIndentGuideId:xe,removeHoverIndentGuideId:$e}}var Ye=e(15583);function at(){const[He,Ge]=(0,n.useState)({time:{current:[0,1]}}),xe=(0,n.useCallback)(function(Z){Ge(ae=>{const de={...ae.time,...Z};return{...ae,time:de}})},[]),$e=(0,n.useCallback)(function(Z,ae){const ve={current:[Z,ae]};Ge(Ue=>({...Ue,time:ve}))},[]);return{viewRange:He,updateViewRangeTime:$e,updateNextViewRangeTime:xe}}const st=He=>({noDataMsg:(0,t.css)` height: 100%; width: 100%; display: grid; place-items: center; font-size: ${He.typography.h4.fontSize}; color: ${He.colors.text.secondary}; `});function Ke(He){const{traceProp:Ge,datasource:xe,topOfViewRef:$e,exploreId:be,createSpanLink:Z}=He,{detailStates:ae,toggleDetail:de,detailLogItemToggle:ve,detailLogsToggle:Ue,detailProcessToggle:_e,detailReferencesToggle:ze,detailReferenceItemToggle:Ve,detailTagsToggle:Ne,detailWarningsToggle:ot,detailStackTracesToggle:nt}=Le(He.dataFrames[0]),{removeHoverIndentGuideId:pt,addHoverIndentGuideId:mt,hoverIndentGuideIds:gt}=Be(),{viewRange:Pt,updateViewRangeTime:Mt,updateNextViewRangeTime:Yt}=at(),{expandOne:zt,collapseOne:_t,childrenToggle:rt,collapseAll:It,childrenHiddenIDs:Dn,expandAll:ft}=Me(),{search:yt,setSearch:jt,spanFilterMatches:cn}=(0,Ye.SQ)(Ge?.spans),[pn,on]=(0,n.useState)(""),[Xt,fn]=(0,o.A)(!1),[An,hn]=(0,n.useState)(!1),[ca,Rt]=(0,n.useState)(!1),[qt,gn]=(0,n.useState)(100),[Cn,mn]=(0,n.useState)({}),[Sn,Tn]=(0,n.useState)({}),$n=(0,c.of)(st),[Mn,Ln]=(0,n.useState)(.4),[na,pa]=Xe({refId:He.dataFrames[0]?.refId,exploreId:He.exploreId,datasource:xe,splitOpenFn:He.splitOpenFn}),ia=(0,n.useMemo)(()=>({childrenHiddenIDs:Dn,detailStates:ae,hoverIndentGuideIds:gt,spanNameColumnWidth:Mn,traceID:He.traceProp?.traceID}),[Dn,ae,gt,Mn,He.traceProp?.traceID]),Xn=(0,i.tR)().getInstanceSettings(xe?.name),Da=(0,g.sn)(Xn?.jsonData),Oa=Xn?.jsonData?.tracesToMetrics,Jn=Xn?.jsonData?.tracesToProfiles,Va=Xn?.jsonData,ts=(0,n.useMemo)(()=>Z??(0,me.lU)({splitOpenFn:He.splitOpenFn,traceToLogsOptions:Da,traceToMetricsOptions:Oa,traceToProfilesOptions:Jn,dataFrame:He.dataFrames[0],createFocusSpanLink:pa,trace:Ge}),[He.splitOpenFn,Da,Oa,Jn,He.dataFrames,pa,Ge,Z]),Ds=(0,f.useSelector)(Ps=>(0,l.O)(Ps.user)),Ms=xe?xe?.type:"unknown",Ns=He.scrollElement?He.scrollElement:document.getElementsByClassName(He.scrollElementClass??"")[0],cs=T(Ge);return n.createElement(n.Fragment,null,He.dataFrames?.length&&Ge?n.createElement(n.Fragment,null,n.createElement(h.TracePageHeader,{trace:Ge,data:He.dataFrames[0],timeZone:Ds,search:yt,setSearch:jt,showSpanFilters:Xt,setShowSpanFilters:fn,showSpanFilterMatchesOnly:An,setShowSpanFilterMatchesOnly:hn,showCriticalPathSpansOnly:ca,setShowCriticalPathSpansOnly:Rt,setFocusedSpanIdForSearch:on,spanFilterMatches:cn,datasourceType:Ms,setHeaderHeight:gn,app:be?s.Jk.Explore:s.Jk.Unknown}),n.createElement(Re,{trace:Ge,viewRange:Pt,updateNextViewRangeTime:Yt,updateViewRangeTime:Mt}),n.createElement(h.TraceTimelineViewer,{findMatchesIDs:cn,trace:Ge,traceToProfilesOptions:Jn,datasourceType:Ms,spanBarOptions:Va?.spanBar,traceTimeline:ia,updateNextViewRangeTime:Yt,updateViewRangeTime:Mt,viewRange:Pt,timeZone:Ds,setSpanNameColumnWidth:Ln,collapseAll:It,collapseOne:_t,expandAll:ft,expandOne:zt,childrenToggle:rt,detailLogItemToggle:ve,detailLogsToggle:Ue,detailWarningsToggle:ot,detailStackTracesToggle:nt,detailReferencesToggle:ze,detailReferenceItemToggle:Ve,detailProcessToggle:_e,detailTagsToggle:Ne,detailToggle:de,addHoverIndentGuideId:mt,removeHoverIndentGuideId:pt,linksGetter:()=>[],createSpanLink:ts,scrollElement:Ns,focusedSpanId:na,focusedSpanIdForSearch:pn,showSpanFilterMatchesOnly:An,showCriticalPathSpansOnly:ca,createFocusSpanLink:pa,topOfViewRef:$e,headerHeight:qt,criticalPath:cs,traceFlameGraphs:Cn,setTraceFlameGraphs:mn,redrawListView:Sn,setRedrawListView:Tn})):n.createElement("div",{className:$n.noDataMsg},"No data"))}function Xe(He){const Ge=(0,f.useSelector)(de=>de.explore.panes[He.exploreId]?.panelsState.trace),xe=Ge?.spanId,$e=(0,f.useDispatch)(),be=de=>$e((0,d.EA)(He.exploreId,"trace",{...Ge,spanId:de})),Z=(0,f.useSelector)(de=>de.explore.panes[He.exploreId]?.queries.find(ve=>ve.refId===He.refId));return[xe,(de,ve)=>{const Ue={title:"Deep link to this span",url:"",internal:{datasourceUid:He.datasource?.uid,datasourceName:He.datasource?.name,query:{...Z,query:de},panelsState:{trace:{spanId:ve}}}},_e=Z?.queryType==="traceql"&&Z.query===de;return(0,r.u)({link:Ue,internalLink:Ue.internal,scopedVars:{},field:{},onClickFn:_e?()=>be(xe===ve?void 0:ve):He.splitOpenFn?()=>He.splitOpenFn({datasourceUid:He.datasource?.uid,queries:[{...Z,query:de}],panelsState:{trace:{spanId:ve}}}):void 0,replaceVariables:(0,u.w)().replace.bind((0,u.w)())})}]}},71656:(Q,A,e)=>{"use strict";e.d(A,{R:()=>n});var t=e(84140);function n(o,s,r){if(o.isLight)return s;{if(r){const c=(0,t.A)(s);return t.A.mostReadable(r,[c.clone().lighten(25),c.clone().lighten(10),c,c.clone().darken(10),c.clone().darken(25)],{includeFallbackColors:!1}).toHex8String()}const g=(0,t.A)(s).toHsl();g.l=1-g.l;const u=(0,t.A)(g);return u.isLight()?u.darken(5).toHex8String():u.lighten(5).toHex8String()}}},50248:(Q,A,e)=>{"use strict";e.d(A,{DetailState:()=>eo,TracePageHeader:()=>yi,TraceTimelineViewer:()=>Fr,filterSpans:()=>Zi,transformTraceData:()=>Yo});var t=e(32196),n=e(96540),o=e(14110),s=e(32264),r=e(3911),g=e(40845),u=e(71656),c=e(75888),i=e.n(c);const f={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 d;function h(){if(d)return d;const Ze=new(i())(document.body);return d=Ze,Ze}function p(Ze){const et=h();Object.keys(Ze).forEach(tt=>{const dt=Ze[tt];dt&&et.bind(f[tt].binding,dt)})}function m(){h().reset()}var a=e(46942),v=e.n(a),E=e(6389);function D(Ze){const{min:et,max:tt,viewStart:dt,viewEnd:xt}=Ze,Wt=tt-et,Vt=et+dt*Wt,dn=tt-(1-xt)*Wt-Vt;return(yn,Vn)=>({start:(yn-Vt)/dn,end:(Vn-Vt)/dn})}function b(Ze,et,tt){return!Array.isArray(tt.tags)||!tt.tags.length?!1:tt.tags.some(dt=>dt.key===Ze&&dt.value===et)}const C=Ze=>Ze.kind==="client",y=b.bind(null,"span.kind","client"),M=Ze=>C(Ze)||y(Ze),T=Ze=>Ze.kind==="server",I=b.bind(null,"span.kind","server"),x=Ze=>T(Ze)||I(Ze),S=Ze=>Ze.statusCode===2,O=b.bind(null,"error",!0),P=b.bind(null,"error","true"),L=Ze=>S(Ze)||O(Ze)||P(Ze);function U(Ze,et){const{depth:tt}=Ze[et];let dt=et+1;for(;dt<Ze.length&&Ze[dt].depth>tt;dt++)if(L(Ze[dt]))return!0;return!1}function R(Ze){if(Ze.length<=1||!M(Ze[0]))return!1;const tt=Ze[0].depth+1;let dt=1;for(;dt<Ze.length&&Ze[dt].depth===tt;){if(x(Ze[dt]))return Ze[dt];dt++}return null}const B=Ze=>Ze.kind?Ze.kind==="client":Ze.tags.some(({key:et,value:tt})=>et==="span.kind"&&tt==="client"),H=Ze=>({Ticks:(0,t.css)` label: Ticks; pointer-events: none; `,TicksTick:(0,t.css)` label: TicksTick; position: absolute; height: 100%; width: 1px; background: ${(0,u.R)(Ze,"#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 w(Ze){const{endTime:et,numTicks:tt,showLabels:dt,startTime:xt}=Ze;let Wt;if(dt){Wt=[];const dn=(et||0)-(xt||0);for(let yn=0;yn<tt;yn++){const Vn=(xt||0)+yn/(tt-1)*dn;Wt.push((0,E.a3)(Vn))}}const Vt=(0,g.of)(H),en=[];for(let dn=0;dn<tt;dn++){const yn=dn/(tt-1);en.push(n.createElement("div",{"data-testid":"TicksID",key:yn,className:Vt.TicksTick,style:{left:`${yn*100}%`}},Wt&&n.createElement("span",{className:v()(Vt.TicksTickLabel,{[Vt.TicksTickLabelEndAnchor]:yn>=1})},Wt[dn])))}return n.createElement("div",{className:Vt.Ticks},en)}w.defaultProps={endTime:null,showLabels:null,startTime:null};const N=()=>({row:(0,t.css)({display:"flex",flex:"0 1 auto",flexDirection:"row"}),rowCell:(0,t.css)({position:"relative"})});function V(Ze){const{children:et,className:tt="",...dt}=Ze,xt=(0,g.of)(N);return n.createElement("div",{className:v()(xt.row,tt),...dt},et)}V.defaultProps={className:""};function G(Ze){const{children:et,className:tt="",width:dt,style:xt,...Wt}=Ze,Vt=`${dt*100}%`,en={...xt,flexBasis:Vt,maxWidth:Vt},dn=(0,g.of)(N);return n.createElement("div",{className:v()(dn.rowCell,tt),style:en,"data-testid":"TimelineRowCell",...Wt},et)}G.defaultProps={className:"",style:{}},V.Cell=G;var _=e(29158);const K=()=>({TimelineCollapser:(0,t.css)` align-items: center; display: flex; flex: none; justify-content: center; margin-right: 0.5rem; `});function j(Ze){const{onExpandAll:et,onExpandOne:tt,onCollapseAll:dt,onCollapseOne:xt}=Ze,Wt=(0,g.of)(K);return n.createElement("div",{className:Wt.TimelineCollapser,"data-testid":"TimelineCollapser"},n.createElement(_.K,{tooltip:"Expand +1",size:"xl",tooltipPlacement:"top",name:"angle-down",onClick:tt}),n.createElement(_.K,{tooltip:"Collapse +1",size:"xl",tooltipPlacement:"top",name:"angle-right",onClick:xt}),n.createElement(_.K,{tooltip:"Expand All",size:"xl",tooltipPlacement:"top",name:"angle-double-down",onClick:et}),n.createElement(_.K,{tooltip:"Collapse All",size:"xl",tooltipPlacement:"top",name:"angle-double-right",onClick:dt}))}var k=e(92151);const Y=()=>({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 ee extends n.PureComponent{constructor(et){super(et),this._setRootElm=tt=>{this._rootElm=tt},this._getDraggingBounds=()=>{if(!this._rootElm)throw new Error("invalid state");const{left:tt,width:dt}=this._rootElm.getBoundingClientRect(),{min:xt,max:Wt}=this.props;return{clientXLeft:tt,width:dt,maxValue:Wt,minValue:xt}},this._handleDragUpdate=({value:tt})=>{this.setState({dragPosition:tt})},this._handleDragEnd=({manager:tt,value:dt})=>{tt.resetBounds(),this.setState({dragPosition:null}),this.props.onChange(dt)},this._dragManager=new k.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 et,tt;const{position:dt,columnResizeHandleHeight:xt}=this.props,{dragPosition:Wt}=this.state;et=`${dt*100}%`;const Vt={left:et};let en=!1,dn=!1;const yn=Y();if(this._dragManager.isDragging()&&this._rootElm&&Wt!=null){en=Wt<dt,dn=Wt>dt;const aa=`${Math.min(dt,Wt)*100}%`,Gn=`calc(${(1-Math.max(dt,Wt))*100}% - 1px)`;tt={left:aa,right:Gn}}else tt=Vt;tt.height=xt;const Vn=en||dn;return n.createElement("div",{className:yn.TimelineColumnResizer,ref:this._setRootElm,"data-testid":"TimelineColumnResizer"},n.createElement("div",{className:v()(yn.gripIcon,Vn&&yn.gripIconDragging),style:Vt,"data-testid":"TimelineColumnResizer--gripIcon"}),n.createElement("div",{"aria-hidden":!0,className:v()(yn.dragger,Vn&&yn.draggerDragging,dn&&yn.draggerDraggingRight,en&&yn.draggerDraggingLeft),onMouseDown:this._dragManager.handleMouseDown,style:tt,"data-testid":"TimelineColumnResizer--dragger"}))}}const re=(0,r.N)(()=>({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 J(Ze){return Reflect.has(Ze,"isOutOfView")}function ne(Ze,et,tt){return Ze+tt*(et-Ze)}function q(Ze,et,tt){return(tt-Ze)/(et-Ze)}function te(Ze,et){let[tt,dt]=Ze<et?[Ze,et]:[et,Ze];return tt>=1||dt<=0?{isOutOfView:!0}:(tt<0&&(tt=0),dt>1&&(dt=1),{isDraggingLeft:Ze>et,left:`${tt*100}%`,width:`${(dt-tt)*100}%`})}function oe(Ze,et,tt,dt,xt){const Wt=q(Ze,et,tt),Vt=q(Ze,et,dt),en=te(Wt,Vt);if(J(en))return null;const{isDraggingLeft:dn,left:yn,width:Vn}=en,aa=re(),Gn=(0,t.cx)({[aa.TimelineViewingLayerDraggedDraggingRight]:!dn,[aa.TimelineViewingLayerDraggedReframeDrag]:!xt,[aa.TimelineViewingLayerDraggedShiftDrag]:xt});return n.createElement("div",{className:(0,t.cx)(aa.TimelineViewingLayerDragged,aa.TimelineViewingLayerDraggedDraggingLeft,Gn),style:{left:yn,width:Vn},"data-testid":"Dragged"})}class ue extends n.PureComponent{constructor(et){super(et),this._setRoot=tt=>{this._root=tt},this._getDraggingBounds=()=>{if(!this._root)throw new Error("invalid state");const{left:tt,width:dt}=this._root.getBoundingClientRect();return{clientXLeft:tt,width:dt}},this._handleReframeMouseMove=({value:tt})=>{const[dt,xt]=this.props.viewRangeTime.current,Wt=ne(dt,xt,tt);this.props.updateNextViewRangeTime({cursor:Wt})},this._handleReframeMouseLeave=()=>{this.props.updateNextViewRangeTime({cursor:void 0})},this._handleReframeDragUpdate=({value:tt})=>{const{current:dt,reframe:xt}=this.props.viewRangeTime,[Wt,Vt]=dt,en=ne(Wt,Vt,tt),yn={reframe:{anchor:xt?xt.anchor:en,shift:en}};this.props.updateNextViewRangeTime(yn)},this._handleReframeDragEnd=({manager:tt,value:dt})=>{const{current:xt,reframe:Wt}=this.props.viewRangeTime,[Vt,en]=xt,dn=ne(Vt,en,dt),yn=Wt?Wt.anchor:dn,[Vn,aa]=dn<yn?[dn,yn]:[yn,dn];tt.resetBounds(),this.props.updateViewRangeTime(Vn,aa,"timeline-header")},this._draggerReframe=new k.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(et){const{boundsInvalidator:tt}=this.props;tt!==et.boundsInvalidator&&this._draggerReframe.resetBounds()}componentWillUnmount(){this._draggerReframe.dispose()}render(){const{viewRangeTime:et}=this.props,{current:tt,cursor:dt,reframe:xt,shiftEnd:Wt,shiftStart:Vt}=et,[en,dn]=tt,yn=xt!=null||Wt!=null||Vt!=null;let Vn;!yn&&dt!=null&&dt>=en&&dt<=dn&&(Vn=`${q(en,dn,dt)*100}%`);const aa=re();return n.createElement("div",{"aria-hidden":!0,className:aa.TimelineViewingLayer,ref:this._setRoot,onMouseDown:this._draggerReframe.handleMouseDown,onMouseLeave:this._draggerReframe.handleMouseLeave,onMouseMove:this._draggerReframe.handleMouseMove,"data-testid":"TimelineViewingLayer"},Vn!=null&&n.createElement("div",{className:aa.TimelineViewingLayerCursorGuide,style:{left:Vn},"data-testid":"TimelineViewingLayer--cursorGuide"}),xt!=null&&oe(en,dn,xt.anchor,xt.shift,!1),Wt!=null&&oe(en,dn,dn,Wt,!0),Vt!=null&&oe(en,dn,en,Vt,!0))}}const ie=Ze=>({TimelineHeaderRow:(0,t.css)` label: TimelineHeaderRow; background: ${(0,u.R)(Ze,"#ececec")}; border-bottom: 1px solid ${(0,u.R)(Ze,"#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; display: flex; padding-left: ${Ze.spacing(1)}; padding-right: ${Ze.spacing(1)}; `});function ge(Ze){const{duration:et,nameColumnWidth:tt,numTicks:dt,onCollapseAll:xt,onCollapseOne:Wt,onColummWidthChange:Vt,onExpandAll:en,onExpandOne:dn,updateViewRangeTime:yn,updateNextViewRangeTime:Vn,viewRangeTime:aa,columnResizeHandleHeight:Gn}=Ze,[ta,Sa]=aa.current,ga=(0,g.of)(ie);return n.createElement(V,{className:ga.TimelineHeaderRow,"data-testid":"TimelineHeaderRow"},n.createElement(V.Cell,{className:ga.TimelineHeaderWrapper,width:tt},n.createElement("h4",{className:ga.TimelineHeaderRowTitle},"Service & Operation"),n.createElement(j,{onCollapseAll:xt,onExpandAll:en,onCollapseOne:Wt,onExpandOne:dn})),n.createElement(V.Cell,{width:1-tt},n.createElement(ue,{boundsInvalidator:tt,updateNextViewRangeTime:Vn,updateViewRangeTime:yn,viewRangeTime:aa}),n.createElement(w,{numTicks:dt,startTime:ta*et,endTime:Sa*et,showLabels:!0})),n.createElement(ee,{columnResizeHandleHeight:Gn,position:tt,onChange:Vt,min:.2,max:.85}))}var he=e(2543),De=e(41811),pe=e(27746);const le="peer.service";var Te=e(30700);class Ee{constructor(et){this.ys=[],this.heights=[],this.bufferLen=et,this.dataLen=-1,this.lastI=-1}profileData(et){et!==this.dataLen&&(this.dataLen=et,this.ys.length=et,this.heights.length=et,this.lastI>=et&&(this.lastI=et-1))}calcHeights(et,tt,dt){dt!=null&&(this.lastI=dt);let xt=et+this.bufferLen;if(xt<=this.lastI)return;xt>=this.heights.length&&(xt=this.heights.length-1);let Wt=this.lastI;for(this.lastI===-1&&(Wt=0,this.ys[0]=0);Wt<=xt;){const Vt=this.heights[Wt]=tt(Wt);this.ys[Wt+1]=this.ys[Wt]+Vt,Wt++}this.lastI=xt}calcYs(et,tt){for(;(this.ys[this.lastI]==null||et>this.ys[this.lastI])&&this.lastI<this.dataLen-1;)this.calcHeights(this.lastI,tt)}confirmHeight(et,tt){let dt=et;if(dt>this.lastI){this.calcHeights(dt,tt);return}const xt=tt(dt);if(xt===this.heights[dt])return;const Wt=xt-this.heights[dt];for(this.heights[dt]=xt;++dt<=this.lastI;)this.ys[dt]+=Wt;this.ys[this.lastI+1]!=null&&(this.ys[this.lastI+1]+=Wt)}findFloorIndex(et,tt){this.calcYs(et,tt);let dt=0,xt=this.lastI;if(this.ys.length<2||et<this.ys[1])return 0;if(et>this.ys[xt])return xt;let Wt;for(;dt<xt;)if(Wt=dt+.5*(xt-dt)|0,et>this.ys[Wt]){if(et<=this.ys[Wt+1])return Wt;dt=Wt}else if(et<this.ys[Wt]){if(et>=this.ys[Wt-1])return Wt-1;xt=Wt}else return Wt;throw new Error(`unable to find floor index for y=${et}`)}getRowPosition(et,tt){return this.confirmHeight(et,tt),{height:this.heights[et],y:this.ys[et]}}getEstimatedHeight(){const et=this.ys[this.lastI]+this.heights[this.lastI];return this.lastI>=this.dataLen-1?et|0:et/(this.lastI+1)*this.heights.length|0}}const Re=100;class me extends n.Component{constructor(et){super(et),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,dt)=>{const{scrollElement:xt}=this.props,Wt=xt?.getBoundingClientRect().top||0,en=(xt?.scrollTop||0)+(this._itemHolderElm?.getBoundingClientRect().top||0)-Wt,dn=this.getRowPosition(tt).y;this.props.scrollElement?.scrollTo({top:dn+en-dt-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,dt=this.props.viewBufferMin<this.props.dataLength-this._endIndex?this._endIndex+this.props.viewBufferMin:this.props.dataLength-1;(tt<this._startIndexDrawn||dt>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 dt=null,xt=null,Wt=!1;const Vt=this._itemHolderElm.childNodes,en=Vt.length;for(let dn=0;dn<en;dn++){const yn=Vt[dn];if(yn instanceof HTMLElement){const Vn=yn.getAttribute("data-item-key");if(!Vn){console.warn("itemKey not found");continue}const Gn=(yn.firstElementChild||yn).clientHeight,ta=this._knownHeights.get(Vn);Gn!==ta&&(this._knownHeights.set(Vn,Gn),Wt?xt=Vn:(Wt=!0,dt=xt=Vn))}}if(dt!=null&&xt!=null){const dn=tt(dt),yn=xt===dt?dn:tt(xt);this._yPositions.calcHeights(yn,this._getHeight,dn),this.forceUpdate()}},this._getHeight=tt=>{const dt=this.props.getKeyFromIndex(tt),xt=this._knownHeights.get(dt);return xt!=null&&xt===xt?xt:this.props.itemHeightGetter(tt,dt)},this._yPositions=new Ee(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:et}=this._wrapperElm.getBoundingClientRect();this._htmlTopOffset=et+this._htmlElm.scrollTop}window.addEventListener("scroll",this._onScroll),this._windowScrollListenerAdded=!0}else this._wrapperElm=this.props.scrollElement,this._wrapperElm?.addEventListener("scroll",this._onScroll)}componentDidUpdate(et){this._itemHolderElm&&this._scanItemHeights(),!this.props.windowScroller&&et.scrollElement!==this.props.scrollElement&&(et.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 et=this.props.windowScroller,tt=et?this._htmlElm.clientHeight:this._wrapperElm.clientHeight,dt=et?this._htmlElm.scrollTop:this._wrapperElm.scrollTop;return tt!==this._viewHeight||dt!==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,dt=this._scrollTop+this._viewHeight;this._startIndex=this._yPositions.findFloorIndex(tt,this._getHeight),this._endIndex=this._yPositions.findFloorIndex(dt,this._getHeight)}render(){const{dataLength:et,getKeyFromIndex:tt,initialDraw:dt=Re,itemRenderer:xt,viewBuffer:Wt,viewBufferMin:Vt}=this.props,en=this._getHeight,dn=[];let yn,Vn;if(this._yPositions.profileData(et),!this._wrapperElm)yn=0,Vn=(dt<et?dt:et)-1;else{this._isViewChanged()&&this._calcViewIndexes();const ta=Vt>this._startIndex?0:this._startIndex-Vt,Sa=Vt<et-this._endIndex?this._endIndex+Vt:et-1;ta<this._startIndexDrawn||Sa>this._endIndexDrawn?(yn=Wt>this._startIndex?0:this._startIndex-Wt,Vn=this._endIndex+Wt,Vn>=et&&(Vn=et-1)):(yn=this._startIndexDrawn>et-1?0:this._startIndexDrawn,Vn=this._endIndexDrawn>et-1?et-1:this._endIndexDrawn)}this._yPositions.calcHeights(Vn,en,yn||-1),this._startIndexDrawn=yn,this._endIndexDrawn=Vn,dn.length=Vn-yn+1;for(let ta=yn;ta<=Vn;ta++){const{y:Sa,height:ga}=this._yPositions.getRowPosition(ta,en),Fa={height:ga,top:Sa,position:"absolute"},da=tt(ta),Ua={"data-item-key":da};dn.push(xt(da,Fa,ta,Ua))}const aa={style:{position:"relative"},ref:this._initWrapper};this.props.windowScroller||(aa.onScroll=this._onScroll,aa.style.height="100%",aa.style.overflowY="auto");const Gn={position:"relative",height:this._yPositions.getEstimatedHeight()};return n.createElement("div",{...aa,"data-testid":"ListView"},n.createElement("div",{style:Gn},n.createElement("div",{style:{position:"absolute",top:0,margin:0,padding:0},className:this.props.itemsWrapperClassName,ref:this._initItemHolder},dn)))}}me.defaultProps={initialDraw:Re,itemsWrapperClassName:"",windowScroller:!1};var Me=e(61653),ye=e(14578),Le=e(13544),We=e(56034),Be=e(95868),Ye=e(13840);function at({children:Ze,content:et,overlayClassName:tt}){const dt=(0,n.useRef)(null);return n.createElement(Be.I,{content:et,hideAfter:300},(xt,Wt,Vt)=>n.createElement(n.Fragment,null,dt.current&&n.createElement(Ye.A,{...Vt,referenceElement:dt.current,wrapperClassName:tt,onMouseLeave:Wt,onMouseEnter:xt}),n.cloneElement(Ze,{ref:dt,onMouseEnter:xt,onMouseLeave:Wt})))}const st="label";var Ke=e(55852);const Xe=()=>({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 He(Ze){const et=(0,g.of)(Xe),[tt,dt]=(0,n.useState)(!1),xt=()=>{navigator.clipboard.writeText(Ze.copyText),dt(!0)};return n.createElement(We.m,{content:tt?"Copied":Ze.tooltipTitle},n.createElement(Ke.$n,{className:v()(et.CopyIcon),type:"button",icon:Ze.icon,onClick:xt}))}He.defaultProps={icon:"copy",className:void 0};var Ge=e(72834),xe=e.n(Ge);const $e="copyIcon",be=Ze=>({KeyValueTable:(0,t.css)` label: KeyValueTable; background: ${(0,u.R)(Ze,"#fff")}; border: 1px solid ${(0,u.R)(Ze,"#ddd")}; margin-bottom: 0.5rem; max-height: 450px; overflow: auto; `,table:(0,t.css)({width:"100%"}),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,u.R)(Ze,"#f5f5f5")}; } &:not(:hover) .${$e} { visibility: hidden; } `,keyColumn:(0,t.css)` label: keyColumn; color: ${(0,u.R)(Ze,"#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; `,jsonTable:(0,t.css)({display:"inline-block"})}),Z=/^(\[|\{)/;function ae(Ze){if(typeof Ze=="string"&&Z.test(Ze))try{return JSON.parse(Ze)}catch{}return Ze}const de=Ze=>n.createElement("a",{href:Ze.href,title:Ze.title,target:"_blank",rel:"noopener noreferrer"},Ze.children," ",n.createElement(ye.I,{name:"external-link-alt"}));de.defaultProps={title:""};function ve(Ze){const{data:et,linksGetter:tt}=Ze,dt=(0,g.of)(be);return n.createElement("div",{className:v()(dt.KeyValueTable),"data-testid":"KeyValueTable"},n.createElement("table",{className:dt.table},n.createElement("tbody",{className:dt.body},et.map((xt,Wt)=>{const Vt={__html:xe()(ae(xt.value))},en=n.createElement("div",{className:dt.jsonTable,dangerouslySetInnerHTML:Vt}),dn=tt?tt(et,Wt):null;let yn;return dn&&dn.length?yn=n.createElement("div",null,n.createElement(de,{href:dn[0].url,title:dn[0].text},en)):yn=en,n.createElement("tr",{className:dt.row,key:`${xt.key}-${Wt}`},n.createElement("td",{className:dt.keyColumn,"data-testid":"KeyValueTable--keyColumn"},xt.key),n.createElement("td",null,yn),n.createElement("td",{className:dt.copyColumn},n.createElement(He,{className:$e,copyText:JSON.stringify(xt,null,2),tooltipTitle:"Copy JSON"})))}))))}var Ue=e(11908),_e=e(72724),ze=e(12131),Ve=e(14689),Ne=e(25994),ot=e(21744),nt=e(98216),pt=e(28114);const mt=Ze=>et=>({LabeledList:(0,t.css)` label: LabeledList; list-style: none; margin: 0; padding: 0; ${Ze&&` margin-right: -8px; display: flex; flex-wrap: wrap; justify-content: flex-end; `} `,LabeledListItem:(0,t.css)` label: LabeledListItem; display: inline-block; ${Ze&&` border-right: 1px solid ${(0,u.R)(et,"#ddd")}; padding: 0 8px; `} `,LabeledListLabel:(0,t.css)` label: LabeledListLabel; color: ${et.isLight?"#999":"#666"}; margin-right: 0.25rem; `,LabeledListValue:(0,t.css)` label: LabeledListValue; ${!Ze&&"margin-right: 0.55rem;"} `});function gt(Ze){const{className:et,divider:tt=!1,items:dt}=Ze,xt=(0,g.of)(mt(tt));return n.createElement("ul",{className:v()(xt.LabeledList,et)},dt.map(({key:Wt,label:Vt,value:en})=>n.createElement("li",{className:xt.LabeledListItem,key:`${Wt}`},n.createElement("span",{className:xt.LabeledListLabel},Vt),n.createElement("strong",{className:xt.LabeledListValue},en))))}const Pt="kind",Mt="status",Yt="status.message",zt="library.name",_t="library.version",rt="trace.state",It="id";var Dn=e(92102);function ft(Ze){const{reference:et,children:tt,createFocusSpanLink:dt}=Ze,xt=dt(et.traceID,et.spanID);return n.createElement("a",{href:xt.href,target:xt.target,rel:"noopener noreferrer",onClick:xt.onClick?Wt=>{Wt.preventDefault(),xt.onClick(Wt)}:void 0},tt)}const yt=Ze=>({AccordianReferenceItem:(0,t.css)` border-bottom: 1px solid ${(0,u.R)(Ze,"#d8d8d8")}; `,AccordianKeyValues:(0,t.css)` margin-left: 10px; `,AccordianReferences:(0,t.css)` label: AccordianReferences; border: 1px solid ${(0,u.R)(Ze,"#d8d8d8")}; position: relative; margin-bottom: 0.25rem; `,AccordianReferencesHeader:(0,t.css)` label: AccordianReferencesHeader; background: ${(0,u.R)(Ze,"#e4e4e4")}; color: inherit; display: block; padding: 0.25rem 0.5rem; &:hover { background: ${(0,u.R)(Ze,"#dadada")}; } `,AccordianReferencesContent:(0,t.css)` label: AccordianReferencesContent; background: ${(0,u.R)(Ze,"#f0f0f0")}; border-top: 1px solid ${(0,u.R)(Ze,"#d8d8d8")}; padding: 0.5rem 0.5rem 0.25rem 0.5rem; `,AccordianReferencesFooter:(0,t.css)` label: AccordianReferencesFooter; color: ${(0,u.R)(Ze,"#999")}; `,AccordianKeyValuesItem:(0,t.css)({marginBottom:Ze.spacing(.5)}),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 jt(Ze){const{data:et,createFocusSpanLink:tt,openedItems:dt,onItemToggle:xt,interactive:Wt}=Ze,Vt=(0,g.of)(yt);return n.createElement("div",{className:Vt.AccordianReferencesContent},et.map((en,dn)=>n.createElement("div",{className:dn<et.length-1?Vt.AccordianReferenceItem:void 0,key:dn},n.createElement("div",{className:Vt.item,key:`${en.spanID}`},n.createElement(ft,{reference:en,createFocusSpanLink:tt},n.createElement("span",{className:Vt.itemContent},en.span?n.createElement("span",null,n.createElement("span",{className:(0,t.cx)("span-svc-name",Vt.serviceName)},en.span.process.serviceName),n.createElement("small",{className:"endpoint-name"},en.span.operationName)):n.createElement("span",{className:(0,t.cx)("span-svc-name",Vt.title)},"View Linked Span ",n.createElement(ye.I,{name:"external-link-alt"})),n.createElement("small",{className:Vt.debugInfo},n.createElement("span",{className:Vt.debugLabel,"data-label":"TraceID:"},en.traceID),n.createElement("span",{className:Vt.debugLabel,"data-label":"SpanID:"},en.spanID))))),!!en.tags?.length&&n.createElement("div",{className:Vt.AccordianKeyValues},n.createElement(ba,{className:dn<et.length-1?Vt.AccordianKeyValuesItem:null,data:en.tags||[],highContrast:!0,interactive:Wt,isOpen:dt?dt.has(en):!1,label:"attributes",linksGetter:null,onToggle:Wt&&xt?()=>xt(en):null})))))}const cn=({data:Ze,interactive:et=!0,isOpen:tt,onToggle:dt,onItemToggle:xt,openedItems:Wt,createFocusSpanLink:Vt})=>{const en=!Array.isArray(Ze)||!Ze.length;let dn=null,yn="span",Vn=null;et&&(dn=tt?n.createElement(ye.I,{name:"angle-down",className:na}):n.createElement(ye.I,{name:"angle-right",className:na}),yn="a",Vn={"aria-checked":tt,onClick:en?null:dt,role:"switch"});const aa=(0,g.of)(yt);return n.createElement("div",{className:aa.AccordianReferences},n.createElement(yn,{className:aa.AccordianReferencesHeader,...Vn},dn,n.createElement("strong",null,n.createElement("span",null,"References"))," ","(",Ze.length,")"),tt&&n.createElement(jt,{data:Ze,openedItems:Wt,createFocusSpanLink:Vt,onItemToggle:xt,interactive:et}))},pn=n.memo(cn),on=()=>({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 Xt(Ze){const{data:et}=Ze,tt=(0,g.of)(on);return n.createElement("div",{className:v()(tt.TextList),"data-testid":"TextList"},n.createElement("ul",{className:tt.List},et.map((dt,xt)=>n.createElement("li",{className:tt.item,key:`${xt}`},dt))))}const fn=Ze=>({header:(0,t.css)` cursor: pointer; overflow: hidden; padding: 0.25em 0.1em; text-overflow: ellipsis; white-space: nowrap; &:hover { background: ${(0,u.R)(Ze,"#e8e8e8")}; } `});function An({data:Ze}){return n.createElement(Xt,{data:Ze})}function hn(Ze){const{className:et,data:tt,headerClassName:dt,interactive:xt,isOpen:Wt,label:Vt,onToggle:en,TextComponent:dn=An}=Ze,yn=!Array.isArray(tt)||!tt.length,Vn=(0,g.of)(Xn),aa=v()(na,{[Vn.emptyIcon]:yn});let Gn=null,ta=null;xt&&(Gn=Wt?n.createElement(ye.I,{name:"angle-down",className:aa}):n.createElement(ye.I,{name:"angle-right",className:aa}),ta={"aria-checked":Wt,onClick:yn?null:en,role:"switch"});const Sa=(0,g.of)(fn);return n.createElement("div",{className:et||""},n.createElement("div",{className:v()(Sa.header,dt),...ta,"data-testid":"AccordianText--header"},Gn,n.createElement("strong",null,Vt)," (",tt.length,")"),Wt&&n.createElement(dn,{data:tt}))}hn.defaultProps={className:null,highContrast:!1,interactive:!0,onToggle:null};var ca=e(49185),Rt=e(75505),qt=e(47232),gn=e(41987),Cn=e(85194),mn=e(26657),Sn=e(72574),Tn=e(31193);function $n(Ze){const{span:et,traceToProfilesOptions:tt,timeZone:dt,traceFlameGraphs:xt,setTraceFlameGraphs:Wt,setRedrawListView:Vt,traceDuration:en,traceName:dn}=Ze,[yn,{height:Vn}]=(0,ca.A)(),aa=(0,g.of)(Mn),Gn=et.tags.filter(da=>da.key===pt.QW),ta=Gn.length>0?Gn[0].value:void 0,Sa=(0,n.useCallback)(()=>{const da=Math.floor(et.startTime/1e3)-3e4,Ua=(et.startTime+et.duration)/1e3+3e4,wa=(0,qt.KQ)(Ua),va=(0,qt.KQ)(da);return{from:va,to:wa,raw:{from:va,to:wa}}},[et.duration,et.startTime]),ga=async(da,Ua)=>{const wa=await(0,Tn.tR)().get(Ua);if(wa instanceof mn.iy){const Ja=(await(0,Rt.s)(wa.query(da))).data.find(Xa=>Xa.name==="response");if(Ja&&Ja.length>1)return Ja}},Fa=(0,n.useCallback)(async(da,Ua,wa)=>{let va="{}";if(Ua.customQuery&&Ua.query){const ys={...(0,pt.gt)(en,dn,wa.traceID),...(0,pt.hv)(wa),...(0,pt.Cr)(wa,Ua)};va=(0,Sn.w)().replace(Ua.query,ys)}else{const ys=Ua.tags&&Ua.tags.length>0?Ua.tags:pt.i0;va=`{${(0,pt._o)(wa,ys)}}`}const Ja={requestId:"span-flamegraph-requestId",interval:"2s",intervalMs:2e3,range:Sa(),scopedVars:{},app:gn.Jk.Unknown,timezone:dt,startTime:wa.startTime,targets:[{labelSelector:va,groupBy:[],profileTypeId:Ua.profileTypeId??"",queryType:"profile",spanSelector:[ta],refId:"span-flamegraph-refId",datasource:{type:da.type,uid:da.uid}}]},Xa=await ga(Ja,da.uid);Xa&&Xa.length>0&&Wt({...xt,[ta]:Xa})},[Sa,ta,Wt,dt,en,xt,dn]);return(0,n.useEffect)(()=>{if(!Object.keys(xt).includes(ta)){let da;tt&&tt?.datasourceUid&&(da=(0,Tn.tR)().getInstanceSettings(tt.datasourceUid)),tt&&da&&Fa(da,tt,et)}},[Wt,et,xt,tt,Sa,dt,Fa,ta]),(0,n.useEffect)(()=>{Vt({})},[Vn,Vt]),xt[ta]?n.createElement("div",{className:aa.flameGraph,ref:yn},n.createElement("div",{className:aa.flameGraphTitle},"Flame graph"),n.createElement(Cn.A,{data:xt[ta],getTheme:()=>s.$.theme2,showFlameGraphOnly:!0,disableCollapsing:!0})):n.createElement(n.Fragment,null)}const Mn=()=>({flameGraph:(0,t.css)({label:"flameGraphInSpan",margin:"5px"}),flameGraphTitle:(0,t.css)({label:"flameGraphTitleInSpan",marginBottom:"5px",fontWeight:"bold"})}),Ln=Ze=>({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; `,list:(0,t.css)({textAlign:"right"}),operationName:(0,t.css)({margin:0}),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,u.R)(Ze,"#bbb")}; content: attr(data-label); } `,debugValue:(0,t.css)` label: debugValue; background-color: inherit; border: none; color: ${(0,u.R)(Ze,"#888")}; cursor: pointer; &:hover { color: ${(0,u.R)(Ze,"#333")}; } `,AccordianWarnings:(0,t.css)` label: AccordianWarnings; background: ${(0,u.R)(Ze,"#fafafa")}; border: 1px solid ${(0,u.R)(Ze,"#e4e4e4")}; margin-bottom: 0.25rem; `,AccordianWarningsHeader:(0,t.css)` label: AccordianWarningsHeader; background: ${(0,u.R)(Ze,"#fff7e6")}; padding: 0.25rem 0.5rem; &:hover { background: ${(0,u.R)(Ze,"#ffe7ba")}; } `,AccordianWarningsHeaderOpen:(0,t.css)` label: AccordianWarningsHeaderOpen; border-bottom: 1px solid ${(0,u.R)(Ze,"#e8e8e8")}; `,AccordianWarningsLabel:(0,t.css)` label: AccordianWarningsLabel; color: ${(0,u.R)(Ze,"#d36c08")}; `,AccordianKeyValuesItem:(0,t.css)({marginBottom:Ze.spacing(.5)}),Textarea:(0,t.css)` word-break: break-all; white-space: pre; `,LinkIcon:(0,t.css)` font-size: 1.5em; `}),na=(0,t.css)({margin:"-0.2rem 0.25rem 0 0"});function pa(Ze){const{detailState:et,linksGetter:tt,logItemToggle:dt,logsToggle:xt,processToggle:Wt,span:Vt,tagsToggle:en,traceStartTime:dn,traceDuration:yn,traceName:Vn,warningsToggle:aa,stackTracesToggle:Gn,referencesToggle:ta,referenceItemToggle:Sa,createSpanLink:ga,createFocusSpanLink:Fa,datasourceType:da,traceFlameGraphs:Ua,setTraceFlameGraphs:wa,traceToProfilesOptions:va,setRedrawListView:Ja}=Ze,{isTagsOpen:Xa,isProcessOpen:ys,logs:Hs,isWarningsOpen:Gs,references:As,isStackTracesOpen:Er}=et,{operationName:Mr,process:_s,duration:er,relativeStartTime:Kr,startTime:$r,traceID:Sr,spanID:us,logs:Zn,tags:fa,warnings:ka,references:ss,stackTraces:Rr}=Vt,{timeZone:Js}=Ze;let gr=[{key:"svc",label:"Service:",value:_s.serviceName},{key:"duration",label:"Duration:",value:(0,E.a3)(er)},{key:"start",label:"Start Time:",value:(0,E.a3)(Kr)+ia($r,Js)},...Vt.childSpanCount>0?[{key:"child_count",label:"Child Count:",value:Vt.childSpanCount}]:[]];const rs=(0,g.of)(Ln);Vt.kind&&gr.push({key:Pt,label:"Kind:",value:Vt.kind}),Vt.statusCode!==void 0&&gr.push({key:Mt,label:"Status:",value:Ue.s[Vt.statusCode].toLowerCase()}),Vt.statusMessage&&gr.push({key:Yt,label:"Status Message:",value:Vt.statusMessage}),Vt.instrumentationLibraryName&&gr.push({key:zt,label:"Library Name:",value:Vt.instrumentationLibraryName}),Vt.instrumentationLibraryVersion&&gr.push({key:_t,label:"Library Version:",value:Vt.instrumentationLibraryVersion}),Vt.traceState&&gr.push({key:rt,label:"Trace State:",value:Vt.traceState});const Fs=(Es,Lr,yo,Do)=>n.createElement(Ve.R,{link:{...Es,title:yo,target:"_blank",origin:Es.field,onClick:al=>{(0,o.rR)("grafana_traces_trace_view_span_link_clicked",{datasourceType:da,grafana_version:s.$.buildInfo.version,type:Lr,location:"spanDetails"}),Es.onClick?Es.onClick?.(al):ze.Ny.push(Es.href)}},buttonProps:{icon:Do}});let Oo=null,Qo=null;if(ga){const Es=ga(Vt),Lr=Es?.filter(Do=>Do.type===Dn.N.Logs);Es&&Lr&&Lr.length>0&&(Oo=Fs(Lr[0],Dn.N.Logs,"Logs for this span","gf-logs"));const yo=Es?.filter(Do=>Do.type===Dn.N.Profiles&&Do.title===nt.cd);Es&&yo&&yo.length>0&&(Qo=Fs(yo[0],Dn.N.Profiles,"Profiles for this span","link"))}const Pi=Fa(Sr,us);return n.createElement("div",{"data-testid":"span-detail-component"},n.createElement("div",{className:rs.header},n.createElement("h2",{className:rs.operationName},Mr),n.createElement("div",{className:rs.listWrapper},n.createElement(gt,{className:rs.list,divider:!0,items:gr}))),n.createElement("span",{style:{marginRight:"10px"}},Oo),Qo,n.createElement(Ne.c,{spacing:1}),n.createElement("div",null,n.createElement("div",null,n.createElement(ba,{data:fa,label:"Span Attributes",linksGetter:tt,isOpen:Xa,onToggle:()=>en(us)}),_s.tags&&n.createElement(ba,{className:rs.AccordianKeyValuesItem,data:_s.tags,label:"Resource Attributes",linksGetter:tt,isOpen:ys,onToggle:()=>Wt(us)})),Zn&&Zn.length>0&&n.createElement(sa,{linksGetter:tt,logs:Zn,isOpen:Hs.isOpen,openedItems:Hs.openedItems,onToggle:()=>xt(us),onItemToggle:Es=>dt(us,Es),timestamp:dn}),ka&&ka.length>0&&n.createElement(hn,{className:rs.AccordianWarnings,headerClassName:rs.AccordianWarningsHeader,label:n.createElement("span",{className:rs.AccordianWarningsLabel},"Warnings"),data:ka,isOpen:Gs,onToggle:()=>aa(us)}),Rr?.length?n.createElement(hn,{label:"Stack trace",data:Rr,isOpen:Er,TextComponent:Es=>{let Lr;return Es.data?.length>1?Lr=Es.data.map((yo,Do)=>`StackTrace ${Do+1}: ${yo}`).join(` `):Lr=Es.data?.[0],n.createElement(ot.f,{className:rs.Textarea,style:{cursor:"unset"},readOnly:!0,cols:10,rows:10,value:Lr})},onToggle:()=>Gn(us)}):null,ss&&ss.length>0&&(ss.length>1||ss[0].refType!=="CHILD_OF")&&n.createElement(pn,{data:ss,isOpen:As.isOpen,openedItems:As.openedItems,onToggle:()=>ta(us),onItemToggle:Es=>Sa(us,Es),createFocusSpanLink:Fa}),Vt.tags.some(Es=>Es.key===pt.QW)&&n.createElement($n,{span:Vt,timeZone:Js,traceFlameGraphs:Ua,setTraceFlameGraphs:wa,traceToProfilesOptions:va,setRedrawListView:Ja,traceDuration:yn,traceName:Vn}),n.createElement("small",{className:rs.debugInfo},n.createElement("a",{...Pi,onClick:Es=>{Pi.onClick&&Es.button===0&&(!Es.currentTarget.target||Es.currentTarget.target==="_self")&&!(Es.metaKey||Es.altKey||Es.ctrlKey||Es.shiftKey)&&(Es.preventDefault(),Pi.onClick(Es))}},n.createElement(ye.I,{name:"link",className:v()(na,rs.LinkIcon)})),n.createElement("span",{className:rs.debugLabel,"data-label":"SpanID:"})," ",us)))}const ia=(Ze,et)=>{const tt=(0,_e.LE)(Ze/1e3,{timeZone:et,defaultWithMS:!0}),dt=tt.split(" ");return` (${dt[1]?dt[1]:tt})`},Xn=Ze=>({container:(0,t.css)({textOverflow:"ellipsis"}),header:(0,t.css)` label: header; cursor: pointer; overflow: hidden; padding: 0.25em 0.1em; text-overflow: ellipsis; white-space: nowrap; &:hover { background: ${(0,u.R)(Ze,"#e8e8e8")}; } `,headerEmpty:(0,t.css)` label: headerEmpty; background: none; cursor: initial; `,headerHighContrast:(0,t.css)` label: headerHighContrast; &:hover { background: ${(0,u.R)(Ze,"#ddd")}; } `,emptyIcon:(0,t.css)` label: emptyIcon; color: ${(0,u.R)(Ze,"#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,u.R)(Ze,"#ddd")}; &:last-child { padding-right: 0; border-right: none; } `,summaryLabel:(0,t.css)` label: summaryLabel; color: ${(0,u.R)(Ze,"#777")}; `,summaryDelim:(0,t.css)` label: summaryDelim; color: ${(0,u.R)(Ze,"#bbb")}; padding: 0 0.2em; `});function Da(Ze){const{data:et}=Ze,tt=(0,g.of)(Xn);return!Array.isArray(et)||!et.length?null:n.createElement("ul",{className:tt.summary},et.map((dt,xt)=>n.createElement("li",{className:tt.summaryItem,key:`${dt.key}-${xt}`},n.createElement("span",{className:tt.summaryLabel},dt.key),n.createElement("span",{className:tt.summaryDelim},"="),String(dt.value))))}Da.defaultProps={data:null};function ba(Ze){const{className:et,data:tt,highContrast:dt,interactive:xt,isOpen:Wt,label:Vt,linksGetter:en,onToggle:dn}=Ze,yn=!Array.isArray(tt)||!tt.length,Vn=(0,g.of)(Xn),aa=v()(na,{[Vn.emptyIcon]:yn});let Gn=null,ta=null;return xt&&(Gn=Wt?n.createElement(ye.I,{name:"angle-down",className:aa}):n.createElement(ye.I,{name:"angle-right",className:aa}),ta={"aria-checked":Wt,onClick:yn?null:dn,role:"switch"}),n.createElement("div",{className:v()(et,Vn.container)},n.createElement("div",{className:v()(Vn.header,{[Vn.headerEmpty]:yn,[Vn.headerHighContrast]:dt&&!yn}),...ta,"data-testid":"AccordianKeyValues--header"},Gn,n.createElement("strong",{"data-test":st},Vt,Wt||":"),!Wt&&n.createElement(Da,{data:tt})),Wt&&n.createElement(ve,{data:tt,linksGetter:en}))}ba.defaultProps={className:null,highContrast:!1,interactive:!0,onToggle:null};const Oa=Ze=>({AccordianLogs:(0,t.css)` label: AccordianLogs; border: 1px solid ${(0,u.R)(Ze,"#d8d8d8")}; position: relative; margin-bottom: 0.25rem; `,AccordianLogsHeader:(0,t.css)` label: AccordianLogsHeader; background: ${(0,u.R)(Ze,"#e4e4e4")}; color: inherit; display: block; padding: 0.25rem 0.5rem; &:hover { background: ${(0,u.R)(Ze,"#dadada")}; } `,AccordianLogsContent:(0,t.css)` label: AccordianLogsContent; background: ${(0,u.R)(Ze,"#f0f0f0")}; border-top: 1px solid ${(0,u.R)(Ze,"#d8d8d8")}; padding: 0.5rem 0.5rem 0.25rem 0.5rem; `,AccordianLogsFooter:(0,t.css)` label: AccordianLogsFooter; color: ${(0,u.R)(Ze,"#999")}; `,AccordianKeyValuesItem:(0,t.css)({marginBottom:Ze.spacing(.5)})});function sa(Ze){const{interactive:et,isOpen:tt,linksGetter:dt,logs:xt,openedItems:Wt,onItemToggle:Vt,onToggle:en,timestamp:dn}=Ze;let yn=null,Vn="span",aa=null;et&&(yn=tt?n.createElement(ye.I,{name:"angle-down",className:na}):n.createElement(ye.I,{name:"angle-right",className:"u-align-icon"}),Vn="a",aa={"aria-checked":tt,onClick:en,role:"switch"});const Gn=(0,g.of)(Oa);return n.createElement("div",{className:Gn.AccordianLogs},n.createElement(Vn,{className:Gn.AccordianLogsHeader,...aa},yn," ",n.createElement("strong",null,"Events")," (",xt.length,")"),tt&&n.createElement("div",{className:Gn.AccordianLogsContent},(0,he.sortBy)(xt,"timestamp").map((ta,Sa)=>n.createElement(ba,{key:`${ta.timestamp}-${Sa}`,className:Sa<xt.length-1?Gn.AccordianKeyValuesItem:null,data:ta.fields||[],highContrast:!0,interactive:et,isOpen:Wt?Wt.has(ta):!1,label:`${(0,E.a3)(ta.timestamp-dn)}`,linksGetter:dt,onToggle:et&&Vt?()=>Vt(ta):null})),n.createElement("small",{className:Gn.AccordianLogsFooter},"Log timestamps are relative to the start time of the full trace.")))}sa.defaultProps={interactive:!0,linksGetter:void 0,onItemToggle:void 0,onToggle:void 0,openedItems:void 0};const Jn=Ze=>({wrapper:(0,t.css)({label:"wrapper",bottom:0,left:0,position:"absolute",right:0,top:0,overflow:"hidden",zIndex:0}),bar:(0,t.css)({label:"bar",borderRadius:Ze.shape.radius.default,minWidth:"2px",position:"absolute",height:"36%",top:"32%"}),rpc:(0,t.css)({label:"rpc",position:"absolute",top:"35%",bottom:"35%",zIndex:1}),label:(0,t.css)({label:"label",color:"#aaa",fontSize:"12px",fontFamily:"'Helvetica Neue', Helvetica, Arial, sans - serif",lineHeight:"1em",whiteSpace:"nowrap",padding:"0 0.5em",position:"absolute"}),logMarker:(0,t.css)({label:"logMarker",backgroundColor:(0,u.R)(Ze,"#2c3235"),cursor:"pointer",height:"60%",minWidth:"1px",position:"absolute",top:"20%","&:hover":{backgroundColor:(0,u.R)(Ze,"#464c54")},"&::before, &::after":{content:"''",position:"absolute",top:0,bottom:0,right:0,border:"1px solid transparent"},"&::after":{left:0}}),criticalPath:(0,t.css)({position:"absolute",top:"45%",height:"11%",zIndex:2,overflow:"hidden",background:(0,u.R)(Ze,"#f1f1f1"),borderLeft:`1px solid ${(0,u.R)(Ze,"#2c3235")}`,borderRight:`1px solid ${(0,u.R)(Ze,"#2c3235")}`})});function Va(Ze){return`${(Ze*100).toFixed(1)}%`}function ts(Ze){return`${Ze*100}%`}function Ds({criticalPath:Ze,viewEnd:et,viewStart:tt,getViewedBounds:dt,color:xt,shortLabel:Wt,longLabel:Vt,onClick:en,rpc:dn,traceStartTime:yn,span:Vn,className:aa,labelClassName:Gn}){const[ta,Sa]=(0,n.useState)(Wt),ga=()=>Sa(Wt),Fa=()=>Sa(Vt),da=(0,he.groupBy)(Vn.logs,wa=>{const va=dt(wa.timestamp,wa.timestamp).start;return Va(Math.round(va*500)/500)}),Ua=(0,g.of)(Jn);return n.createElement("div",{className:v()(Ua.wrapper,aa),onBlur:ga,onClick:en,onFocus:Fa,onMouseOut:ga,onMouseOver:Fa,"aria-hidden":!0,"data-testid":Le.Tp.components.TraceViewer.spanBar},n.createElement("div",{"aria-label":ta,className:v()(Ua.bar),style:{background:xt,left:Va(tt),width:Va(et-tt)}},n.createElement("div",{className:v()(Ua.label,Gn),"data-testid":"SpanBar--label"},ta)),n.createElement("div",null,Object.keys(da).map(wa=>n.createElement(at,{key:wa,content:n.createElement(sa,{interactive:!1,isOpen:!0,logs:da[wa],timestamp:yn})},n.createElement("div",{"data-testid":"SpanBar--logMarker",className:v()(Ua.logMarker),style:{left:wa}})))),dn&&n.createElement("div",{className:v()(Ua.rpc),style:{background:dn.color,left:Va(dn.viewStart),width:Va(dn.viewEnd-dn.viewStart)}}),Ze?.map((wa,va)=>{const Ja=dt(wa.section_start,wa.section_end),Xa=Ja.start,ys=Ja.end,Hs=`${wa.spanId}-${va}`;return n.createElement(We.m,{key:Hs,placement:"top",content:n.createElement("div",null,"A segment on the ",n.createElement("em",null,"critical path")," of the overall trace / request / workflow.")},n.createElement("div",{"data-testid":"SpanBar--criticalPath",className:Ua.criticalPath,style:{left:ts(Xa),width:ts(ys-Xa)}}))}))}const Ms=n.memo(Ds);var Ns=e(64539),cs=e(28122);const Ps=(Ze,et,tt,dt)=>(Ze.sort(function(xt,Wt){return(xt.title||"link").toLowerCase().localeCompare((Wt.title||"link").toLowerCase())}),Ze.map((xt,Wt)=>n.createElement(Ns.D,{key:Wt,label:xt.title||"Link",onClick:xt.onClick?Vt=>{(0,o.rR)("grafana_traces_trace_view_span_link_clicked",{datasourceType:dt,grafana_version:s.$.buildInfo.version,type:xt.type,location:"menu"}),Vt?.preventDefault(),xt.onClick(Vt),tt()}:void 0,url:xt.href,className:et.menuItem}))),ir=({links:Ze,datasourceType:et,color:tt})=>{const dt=(0,g.of)(()=>Cs(tt)),[xt,Wt]=(0,n.useState)(!1),[Vt,en]=(0,n.useState)({x:0,y:0}),dn=()=>Wt(!1);return n.createElement("div",{"data-testid":"SpanLinksMenu",className:dt.wrapper},n.createElement("button",{onClick:yn=>{Wt(!0),en({x:yn.pageX,y:yn.pageY})},className:dt.button},n.createElement(ye.I,{name:"link",className:dt.icon})),xt?n.createElement(cs.t,{onClose:()=>Wt(!1),renderMenuItems:()=>Ps(Ze,dt,dn,et),focusOnOpen:!1,x:Vt.x,y:Vt.y}):null)},Cs=Ze=>({wrapper:(0,t.css)` border: none; background: ${Ze}10; border-bottom: 1px solid ${Ze}CF; padding-right: 4px; `,button:(0,t.css)` background: transparent; border: none; padding: 0; `,icon:(0,t.css)` background: transparent; border: none; padding: 0; `,menuItem:(0,t.css)` max-width: 60ch; overflow: hidden; `});function as(Ze){return(0,he.get)((0,he.find)(Ze.references,({span:et,refType:tt})=>et&&et.spanID&&(tt==="CHILD_OF"||tt==="FOLLOWS_FROM")),"span")}function ar(Ze){const et=[];if(!Ze)return et;let tt=as(Ze);for(;tt;)et.push(tt.spanID),tt=as(tt);return et}const lr=(0,r.N)(Ze=>({SpanTreeOffset:(0,t.css)` label: SpanTreeOffset; color: ${(0,u.R)(Ze,"#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: 1rem; height: 100%; display: inline-flex; transition: padding 300ms ease-out; &::before { content: ''; padding-left: 1px; background-color: ${(0,u.R)(Ze,"lightgrey")}; } `,indentGuideActive:(0,t.css)` label: indentGuideActive; &::before { background-color: ${(0,u.R)(Ze,"#777")}; } `,indentGuideThin:(0,t.css)` padding-right: 0.3rem; `,iconWrapper:(0,t.css)` label: iconWrapper; position: absolute; right: 0; `}));class Is extends n.PureComponent{constructor(et){super(et),this.handleMouseLeave=(tt,dt)=>{(!(tt.relatedTarget instanceof HTMLSpanElement)||(0,he.get)(tt,"relatedTarget.dataset.ancestorId")!==dt)&&this.props.removeHoverIndentGuideId(dt)},this.handleMouseEnter=(tt,dt)=>{(!(tt.relatedTarget instanceof HTMLSpanElement)||(0,he.get)(tt,"relatedTarget.dataset.ancestorId")!==dt)&&this.props.addHoverIndentGuideId(dt)},this.ancestorIds=ar(et.span),this.ancestorIds.push("root"),this.ancestorIds.reverse()}render(){const{childrenVisible:et,onClick:tt,showChildrenIcon:dt,span:xt,theme:Wt,visibleSpanIds:Vt}=this.props,{hasChildren:en,spanID:dn}=xt,yn=en?{onClick:tt,role:"switch","aria-checked":et}:null,Vn=dt&&en&&(et?n.createElement(ye.I,{name:"angle-down","data-testid":"icon-arrow-down",size:"sm"}):n.createElement(ye.I,{name:"angle-right","data-testid":"icon-arrow-right",size:"sm"})),aa=lr(Wt);return n.createElement("span",{className:v()(aa.SpanTreeOffset,{[aa.SpanTreeOffsetParent]:en}),...yn},this.ancestorIds.map((Gn,ta)=>n.createElement("span",{key:Gn,className:v()(aa.indentGuide,{[aa.indentGuideActive]:this.props.hoverIndentGuideIds.has(Gn),[aa.indentGuideThin]:ta!==this.ancestorIds.length-1&&Gn!=="root"&&!Vt.includes(Gn)}),"data-ancestor-id":Gn,"data-testid":"SpanTreeOffset--indentGuide",onMouseEnter:Sa=>this.handleMouseEnter(Sa,Gn),onMouseLeave:Sa=>this.handleMouseLeave(Sa,Gn)})),Vn&&n.createElement("span",{className:aa.iconWrapper,onMouseEnter:Gn=>this.handleMouseEnter(Gn,dn),onMouseLeave:Gn=>this.handleMouseLeave(Gn,dn),"data-testid":"icon-wrapper"},Vn))}}Is.displayName="UnthemedSpanTreeOffset",Is.defaultProps={childrenVisible:!1,showChildrenIcon:!0};const cr=(0,g.cV)(Is),Zs="spanBar",os="spanBarLabel",is="nameWrapper",Ls="nameWrapperMatchingFilter",ks="jaegerView",Pr="nameColumn",qs=(0,r.N)((Ze,et)=>{const tt={label:"flash",flash:(0,t.keyframes)` from { background-color: ${(0,u.R)(Ze,"#68b9ff")}; } to { background-color: 'default'; } `},dt=et?"":(0,u.R)(Ze,"#fffce4");return{nameWrapper:(0,t.css)` label: nameWrapper; line-height: 27px; overflow: hidden; display: flex; `,nameWrapperMatchingFilter:(0,t.css)` label: nameWrapperMatchingFilter; background-color: ${dt}; `,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,u.R)(Ze,"#484848")}; font-size: 0.9em; `,view:(0,t.css)` label: view; position: relative; `,viewExpanded:(0,t.css)` label: viewExpanded; background: ${(0,u.R)(Ze,"#f8f8f8")}; outline: 1px solid ${(0,u.R)(Ze,"#ddd")}; `,viewExpandedAndMatchingFilter:(0,t.css)` label: viewExpandedAndMatchingFilter; background: ${(0,u.R)(Ze,"#fff3d7")}; outline: 1px solid ${(0,u.R)(Ze,"#ddd")}; `,row:(0,t.css)` label: row; font-size: 0.9em; &:hover .${Zs} { opacity: 1; } &:hover .${os} { color: ${(0,u.R)(Ze,"#000")}; } &:hover .${is} { background: #f8f8f8; background: linear-gradient( 90deg, ${(0,u.R)(Ze,"#fafafa")}, ${(0,u.R)(Ze,"#f8f8f8")} 75%, ${(0,u.R)(Ze,"#eee")} ); } &:hover .${ks} { background-color: ${(0,u.R)(Ze,"#f5f5f5")}; outline: 1px solid ${(0,u.R)(Ze,"#ddd")}; } `,rowClippingLeft:(0,t.css)` label: rowClippingLeft; & .${Pr}::before { content: ' '; height: 100%; position: absolute; width: 6px; background-image: linear-gradient( to right, ${(0,u.R)(Ze,"rgba(25, 25, 25, 0.25)")}, ${(0,u.R)(Ze,"rgba(32, 32, 32, 0)")} ); left: 100%; z-index: -1; } `,rowClippingRight:(0,t.css)` label: rowClippingRight; & .${ks}::before { content: ' '; height: 100%; position: absolute; width: 6px; background-image: linear-gradient( to left, ${(0,u.R)(Ze,"rgba(25, 25, 25, 0.25)")}, ${(0,u.R)(Ze,"rgba(25, 25, 25, 0.25)")} ); right: 0%; z-index: 1; } `,rowExpanded:(0,t.css)` label: rowExpanded; & .${Zs} { opacity: 1; } & .${os} { color: ${(0,u.R)(Ze,"#000")}; } & .${is}, &:hover .${is} { background: ${(0,u.R)(Ze,"#f0f0f0")}; box-shadow: 0 1px 0 ${(0,u.R)(Ze,"#ddd")}; } & .${Ls} { background: ${(0,u.R)(Ze,"#fff3d7")}; } &:hover .${ks} { background: ${(0,u.R)(Ze,"#eee")}; } `,rowMatchingFilter:(0,t.css)` label: rowMatchingFilter; // background-color: ${(0,u.R)(Ze,"#fffbde")}; &:hover .${is} { background: linear-gradient( 90deg, ${(0,u.R)(Ze,"#fffbde")}, ${(0,u.R)(Ze,"#fffbde")} 75%, ${(0,u.R)(Ze,"#f7f1c6")} ); } &:hover .${ks} { background-color: ${(0,u.R)(Ze,"#f7f1c6")}; outline: 1px solid ${(0,u.R)(Ze,"#ddd")}; } `,rowFocused:(0,t.css)` label: rowFocused; background-color: ${(0,u.R)(Ze,"#cbe7ff")}; animation: ${tt.flash} 1s cubic-bezier(0.12, 0, 0.39, 0); & .${is}, .${ks}, .${Ls} { background-color: ${(0,u.R)(Ze,"#cbe7ff")}; animation: ${tt.flash} 1s cubic-bezier(0.12, 0, 0.39, 0); } & .${Zs} { opacity: 1; } & .${os} { color: ${(0,u.R)(Ze,"#000")}; } &:hover .${is}, :hover .${ks} { background: ${(0,u.R)(Ze,"#d5ebff")}; box-shadow: 0 1px 0 ${(0,u.R)(Ze,"#ddd")}; } `,rowExpandedAndMatchingFilter:(0,t.css)` label: rowExpandedAndMatchingFilter; &:hover .${ks} { background: ${(0,u.R)(Ze,"#ffeccf")}; } `,name:(0,t.css)` label: name; color: ${(0,u.R)(Ze,"#000")}; cursor: pointer; flex: 1 1 auto; outline: none; overflow-y: hidden; overflow-x: auto; padding-left: 4px; padding-right: 0.25em; position: relative; -ms-overflow-style: none; scrollbar-width: none; &::-webkit-scrollbar { display: none; } &:focus { text-decoration: none; } &:hover > span { color: ${(0,u.R)(Ze,"#000")}; } text-align: left; background: transparent; border: none; border-bottom-width: 1px; border-bottom-style: solid; `,nameDetailExpanded:(0,t.css)` label: nameDetailExpanded; &::before { bottom: 0; } `,svcName:(0,t.css)` label: svcName; font-size: 0.9em; font-weight: bold; margin-right: 0.25rem; `,svcNameChildrenCollapsed:(0,t.css)` label: svcNameChildrenCollapsed; font-weight: bold; font-style: italic; `,errorIcon:(0,t.css)` label: errorIcon; border-radius: 6.5px; color: ${(0,u.R)(Ze,"#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 Cr extends n.PureComponent{constructor(){super(...arguments),this._detailToggle=()=>{this.props.onDetailToggled(this.props.span.spanID)},this._childrenToggle=()=>{this.props.onChildrenToggled(this.props.span.spanID)},this.getSpanBarLabel=(et,tt,dt)=>{const xt=tt?.type??"";if(xt===Me.x3)return"";if(xt===""||xt===Me.ft)return`(${dt})`;if(xt===Me.Dk){const Wt=tt?.tag?.trim()??"";if(Wt!==""&&et.tags){const Vt=et.tags?.find(dn=>dn.key===Wt);if(Vt)return`(${Vt.value})`;const en=et.process?.tags?.find(dn=>dn.key===Wt);if(en)return`(${en.value})`}}return""}}render(){const{className:et,color:tt,spanBarOptions:dt,columnDivision:xt,isChildrenExpanded:Wt,isDetailExpanded:Vt,isMatchingFilter:en,showSpanFilterMatchesOnly:dn,isFocused:yn,numTicks:Vn,rpc:aa,noInstrumentedServer:Gn,showErrorIcon:ta,getViewedBounds:Sa,traceStartTime:ga,span:Fa,hoverIndentGuideIds:da,addHoverIndentGuideId:Ua,removeHoverIndentGuideId:wa,clippingLeft:va,clippingRight:Ja,theme:Xa,createSpanLink:ys,datasourceType:Hs,showServiceName:Gs,visibleSpanIds:As,criticalPath:Er}=this.props,{duration:Mr,hasChildren:_s,operationName:er,process:{serviceName:Kr}}=Fa,$r=(0,E.a3)(Mr),Sr=Sa(Fa.startTime,Fa.startTime+Fa.duration),us=Sr.start,Zn=Sr.end,fa=qs(Xa,dn),ka=`${Kr}::${er}`;let ss,Rr;return us>1-Zn?(ss=`${ka} | ${$r}`,Rr=fa.labelLeft):(ss=`${$r} | ${ka}`,Rr=fa.labelRight),n.createElement(V,{className:v()(fa.row,{[fa.rowExpanded]:Vt,[fa.rowMatchingFilter]:en,[fa.rowExpandedAndMatchingFilter]:en&&Vt,[fa.rowFocused]:yn,[fa.rowClippingLeft]:va,[fa.rowClippingRight]:Ja},et)},n.createElement(V.Cell,{className:v()(fa.nameColumn,Pr),width:xt},n.createElement("div",{className:v()(fa.nameWrapper,is,{[fa.nameWrapperMatchingFilter]:en,nameWrapperMatchingFilter:en})},n.createElement(cr,{onClick:_s?this._childrenToggle:void 0,childrenVisible:Wt,span:Fa,hoverIndentGuideIds:da,addHoverIndentGuideId:Ua,removeHoverIndentGuideId:wa,visibleSpanIds:As}),n.createElement("button",{type:"button",className:v()(fa.name,{[fa.nameDetailExpanded]:Vt}),"aria-checked":Vt,title:ka,onClick:this._detailToggle,role:"switch",style:{background:`${tt}10`,borderBottomColor:`${tt}CF`},tabIndex:0},ta&&n.createElement(ye.I,{name:"exclamation-circle",style:{backgroundColor:Fa.errorIconColor?(0,u.R)(Xa,Fa.errorIconColor):(0,u.R)(Xa,"#db2828")},className:fa.errorIcon}),Gs&&n.createElement("span",{className:v()(fa.svcName,{[fa.svcNameChildrenCollapsed]:_s&&!Wt})},`${Kr} `),aa&&n.createElement("span",null,n.createElement(ye.I,{name:"arrow-right"})," ",n.createElement("i",{className:fa.rpcColorMarker,style:{background:aa.color}}),aa.serviceName),Gn&&n.createElement("span",null,n.createElement(ye.I,{name:"arrow-right"})," ",n.createElement("i",{className:fa.rpcColorMarker,style:{background:Gn.color}}),Gn.serviceName),n.createElement("span",{className:fa.endpointName},aa?aa.operationName:er),n.createElement("span",{className:fa.endpointName}," ",this.getSpanBarLabel(Fa,dt,$r))),ys&&(()=>{const Js=ys(Fa),gr=Js?.length||0;return Js&&gr===1?Js[0]?n.createElement("a",{href:Js[0].href,target:"_blank",style:{background:`${tt}10`,borderBottom:`1px solid ${tt}CF`,paddingRight:"4px"},rel:"noopener noreferrer",onClick:Js[0].onClick?rs=>{!(rs.ctrlKey||rs.metaKey||rs.shiftKey)&&Js[0].onClick&&(rs.preventDefault(),Js[0].onClick(rs))}:void 0},Js[0].content):null:Js&&gr>1?n.createElement(ir,{links:Js,datasourceType:Hs,color:tt}):null})())),n.createElement(V.Cell,{className:v()(fa.view,ks,{[fa.viewExpanded]:Vt,[fa.viewExpandedAndMatchingFilter]:en&&Vt}),"data-testid":"span-view",style:{cursor:"pointer"},width:1-xt,onClick:this._detailToggle},n.createElement(w,{numTicks:Vn}),n.createElement(Ms,{criticalPath:Er,rpc:aa,viewStart:us,viewEnd:Zn,getViewedBounds:Sa,color:tt,shortLabel:$r,longLabel:ss,traceStartTime:ga,span:Fa,labelClassName:`${os} ${Rr}`,className:Zs})))}}Cr.displayName="UnthemedSpanBarRow",Cr.defaultProps={className:"",rpc:null};const Ir=(0,g.cV)(Cr),Lo=(0,r.N)(Ze=>({expandedAccent:(0,t.css)` cursor: pointer; height: 100%; overflow: hidden; position: absolute; width: 100%; &::before { border-left: 1px 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,u.R)(Ze,"#d3d3d3")}; border-top: 3px solid; padding: 0.75rem; `}));class br extends n.PureComponent{constructor(){super(...arguments),this._detailToggle=()=>{this.props.onDetailToggled(this.props.span.spanID)},this._linksGetter=(et,tt)=>{const{linksGetter:dt,span:xt}=this.props;return dt(xt,et,tt)}}render(){const{color:et,columnDivision:tt,detailState:dt,logItemToggle:xt,logsToggle:Wt,processToggle:Vt,referenceItemToggle:en,referencesToggle:dn,warningsToggle:yn,stackTracesToggle:Vn,span:aa,traceToProfilesOptions:Gn,timeZone:ta,tagsToggle:Sa,traceStartTime:ga,traceDuration:Fa,traceName:da,hoverIndentGuideIds:Ua,addHoverIndentGuideId:wa,removeHoverIndentGuideId:va,theme:Ja,createSpanLink:Xa,focusedSpanId:ys,createFocusSpanLink:Hs,datasourceType:Gs,visibleSpanIds:As,traceFlameGraphs:Er,setTraceFlameGraphs:Mr,setRedrawListView:_s}=this.props,er=Lo(Ja);return n.createElement(V,null,n.createElement(V.Cell,{width:tt,style:{overflow:"hidden"}},n.createElement(cr,{span:aa,showChildrenIcon:!1,hoverIndentGuideIds:Ua,addHoverIndentGuideId:wa,removeHoverIndentGuideId:va,visibleSpanIds:As}),n.createElement(Ke.$n,{fill:"text",onClick:this._detailToggle,className:v()(er.expandedAccent,(0,Ke.my)(Ja)),style:{borderColor:et},"data-testid":"detail-row-expanded-accent"})),n.createElement(V.Cell,{width:1-tt},n.createElement("div",{className:er.infoWrapper,style:{borderTopColor:et}},n.createElement(pa,{detailState:dt,linksGetter:this._linksGetter,logItemToggle:xt,logsToggle:Wt,processToggle:Vt,referenceItemToggle:en,referencesToggle:dn,warningsToggle:yn,stackTracesToggle:Vn,span:aa,traceToProfilesOptions:Gn,timeZone:ta,tagsToggle:Sa,traceStartTime:ga,traceDuration:Fa,traceName:da,createSpanLink:Xa,focusedSpanId:ys,createFocusSpanLink:Hs,datasourceType:Gs,traceFlameGraphs:Er,setTraceFlameGraphs:Mr,setRedrawListView:_s}))))}}const so=(0,g.cV)(br),hs=(0,r.N)(()=>({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: absolute; bottom: 30px; right: 30px; z-index: 1; `})),Nr={bar:28,detail:161,detailWithLogs:197},wr=5,Zr=33;function Ar(Ze,et,tt,dt,xt,Wt,Vt){if(!Ze)return[];xt&&dt&&(Ze=Ze.filter(yn=>dt.has(yn.spanID))),Wt&&Vt&&(Ze=Ze.filter(yn=>Vt.find(Vn=>Vn.spanId===yn.spanID)));let en=null;const dn=[];for(let yn=0;yn<Ze.length;yn++){const Vn=Ze[yn],{spanID:aa,depth:Gn}=Vn;let ta=!1;en!=null&&(Gn>=en?ta=!0:en=null),!ta&&(et.has(aa)&&(en=Gn+1),dn.push({span:Vn,isDetail:!1,spanIndex:yn}),tt.has(aa)&&dn.push({span:Vn,isDetail:!0,spanIndex:yn}))}return dn}function zo(Ze){const[et,tt]=Ze;return{left:et>0,right:tt<1}}function $s(Ze,et,tt,dt,xt,Wt,Vt){return Ze?Ar(Ze.spans,et,tt,dt,xt,Wt,Vt):[]}function Ss(Ze){const et=new Map;return Ze&&Ze.spans.forEach(tt=>{tt.childSpanIds.length&&et.set(tt.spanID,tt.childSpanIds)}),et}const ro=(0,De.A)($s),Za=(0,De.A)(D,he.isEqual),bs=(0,De.A)(zo,he.isEqual),Yn=(0,De.A)(Ss);class St extends n.Component{constructor(){super(...arguments),this.hasScrolledToSpan=!1,this.getViewRange=()=>this.props.currentViewRangeTime,this.getSearchedSpanIDs=()=>this.props.findMatchesIDs,this.getCollapsedChildren=()=>this.props.childrenHiddenIDs,this.mapRowIndexToSpanIndex=et=>this.getRowStates()[et].spanIndex,this.mapSpanIndexToRowIndex=et=>{const tt=this.getRowStates().length;for(let dt=0;dt<tt;dt++){const{spanIndex:xt}=this.getRowStates()[dt];if(xt===et)return dt}throw new Error(`unable to find row for span index: ${et}`)},this.setListView=et=>{this.listView=et},this.getKeyFromIndex=et=>{const{isDetail:tt,span:dt}=this.getRowStates()[et];return`${dt.traceID}--${dt.spanID}--${tt?"detail":"bar"}`},this.getIndexFromKey=et=>{const tt=et.split("--"),dt=tt[0],xt=tt[1],Wt=tt[2]==="detail",Vt=this.getRowStates().length;for(let en=0;en<Vt;en++){const{span:dn,isDetail:yn}=this.getRowStates()[en];if(dn.spanID===xt&&dn.traceID===dt&&yn===Wt)return en}return-1},this.getRowHeight=et=>{const{span:tt,isDetail:dt}=this.getRowStates()[et];return dt?Array.isArray(tt.logs)&&tt.logs.length?Nr.detailWithLogs:Nr.detail:Nr.bar},this.renderRow=(et,tt,dt,xt)=>{const{isDetail:Wt,span:Vt,spanIndex:en}=this.getRowStates()[dt],dn=Math.max((this.listView?.getTopVisibleIndex()||0)-Zr,0),yn=(this.listView?.getBottomVisibleIndex()||0)+Zr,Vn=this.getVisibleSpanIds(dn,yn);return Wt?this.renderSpanDetailRow(Vt,et,tt,xt,Vn):this.renderSpanBarRow(Vt,en,et,tt,xt,Vn)},this.scrollToSpan=(et,tt)=>{if(tt==null)return;const dt=this.getRowStates().findIndex(xt=>xt.span.spanID===tt);dt>=0&&this.listView?.scrollToIndex(dt,et)},this.scrollToTop=()=>{const{topOfViewRef:et,datasourceType:tt,trace:dt}=this.props;et?.current?.scrollIntoView({behavior:"smooth"}),(0,o.rR)("grafana_traces_trace_view_scroll_to_top_clicked",{datasourceType:tt,grafana_version:s.$.buildInfo.version,numServices:dt.services.length,numSpans:dt.spans.length})},this.getVisibleSpanIds=(0,De.A)((et,tt)=>{const dt=[];for(let xt=et;xt<tt;xt++){const Wt=this.getRowStates()[xt];Wt?.span&&dt.push(Wt.span.spanID)}return dt})}componentDidMount(){this.scrollToSpan(this.props.headerHeight,this.props.focusedSpanId)}shouldComponentUpdate(et){let tt;for(tt in et)if(et[tt]!==this.props[tt])return!0;return!1}componentDidUpdate(et){const{headerHeight:tt,focusedSpanId:dt,focusedSpanIdForSearch:xt}=this.props;this.hasScrolledToSpan||(this.scrollToSpan(tt,dt),this.hasScrolledToSpan=!0),dt!==et.focusedSpanId&&this.scrollToSpan(tt,dt),xt!==et.focusedSpanIdForSearch&&this.scrollToSpan(tt,xt)}getRowStates(){const{childrenHiddenIDs:et,detailStates:tt,trace:dt,findMatchesIDs:xt,showSpanFilterMatchesOnly:Wt,showCriticalPathSpansOnly:Vt,criticalPath:en}=this.props;return ro(dt,et,tt,xt,Wt,Vt,en)}getClipping(){const{currentViewRangeTime:et}=this.props;return bs(et)}getViewedBounds(){const{currentViewRangeTime:et,trace:tt}=this.props,[dt,xt]=et;return Za({min:tt.startTime,max:tt.endTime,viewStart:dt,viewEnd:xt})}getChildSpansMap(){return Yn(this.props.trace)}getAccessors(){const et=this.listView;if(!et)throw new Error("ListView unavailable");return{getViewRange:this.getViewRange,getSearchedSpanIDs:this.getSearchedSpanIDs,getCollapsedChildren:this.getCollapsedChildren,getViewHeight:et.getViewHeight,getBottomRowIndexVisible:et.getBottomVisibleIndex,getTopRowIndexVisible:et.getTopVisibleIndex,getRowPosition:et.getRowPosition,mapRowIndexToSpanIndex:this.mapRowIndexToSpanIndex,mapSpanIndexToRowIndex:this.mapSpanIndexToRowIndex}}renderSpanBarRow(et,tt,dt,xt,Wt,Vt){const{spanID:en,childSpanIds:dn}=et,{serviceName:yn}=et.process,{childrenHiddenIDs:Vn,childrenToggle:aa,detailStates:Gn,detailToggle:ta,findMatchesIDs:Sa,spanNameColumnWidth:ga,trace:Fa,spanBarOptions:da,hoverIndentGuideIds:Ua,addHoverIndentGuideId:wa,removeHoverIndentGuideId:va,createSpanLink:Ja,focusedSpanId:Xa,focusedSpanIdForSearch:ys,showSpanFilterMatchesOnly:Hs,theme:Gs,datasourceType:As,criticalPath:Er}=this.props;if(!Fa)return null;const Mr=(0,Te.Kv)(yn,Gs),_s=Vn.has(en),er=Gn.has(en),Kr=Sa?Sa.has(en):!1,$r=en===Xa||en===ys,Sr=L(et)||_s&&U(Fa.spans,tt);let us=null;if(_s){const rs=R(Fa.spans.slice(tt));if(rs){const Fs=this.getViewedBounds()(rs.startTime,rs.startTime+rs.duration);us={color:(0,Te.Kv)(rs.process.serviceName,Gs),operationName:rs.operationName,serviceName:rs.process.serviceName,viewEnd:Fs.end,viewStart:Fs.start}}}const Zn=et.tags.find(rs=>rs.key===le);let fa=null;!et.hasChildren&&Zn&&B(et)&&(fa={serviceName:Zn.value,color:(0,Te.Kv)(Zn.value,Gs)});const ka=tt>0?Fa.spans[tt-1]:null,ss=[en,...dn],Rr=rs=>{rs.forEach(Fs=>{const Oo=this.getChildSpansMap().get(Fs);Oo?.length&&(ss.push(...Oo),Rr(Oo))})};Rr(dn);const Js=Er?.filter(rs=>_s?ss.includes(rs.spanId):rs.spanId===en),gr=hs();return n.createElement("div",{className:gr.row,key:dt,style:xt,...Wt},n.createElement(Ir,{clippingLeft:this.getClipping().left,clippingRight:this.getClipping().right,color:Mr,spanBarOptions:da,columnDivision:ga,isChildrenExpanded:!_s,isDetailExpanded:er,isMatchingFilter:Kr,isFocused:$r,showSpanFilterMatchesOnly:Hs,numTicks:wr,onDetailToggled:ta,onChildrenToggled:aa,rpc:us,noInstrumentedServer:fa,showErrorIcon:Sr,getViewedBounds:this.getViewedBounds(),traceStartTime:Fa.startTime,span:et,hoverIndentGuideIds:Ua,addHoverIndentGuideId:wa,removeHoverIndentGuideId:va,createSpanLink:Ja,datasourceType:As,showServiceName:ka===null||ka.process.serviceName!==et.process.serviceName,visibleSpanIds:Vt,criticalPath:Js}))}renderSpanDetailRow(et,tt,dt,xt,Wt){const{spanID:Vt}=et,{serviceName:en}=et.process,{detailLogItemToggle:dn,detailLogsToggle:yn,detailProcessToggle:Vn,detailReferencesToggle:aa,detailReferenceItemToggle:Gn,detailWarningsToggle:ta,detailStackTracesToggle:Sa,detailStates:ga,detailTagsToggle:Fa,detailToggle:da,spanNameColumnWidth:Ua,trace:wa,traceToProfilesOptions:va,timeZone:Ja,hoverIndentGuideIds:Xa,addHoverIndentGuideId:ys,removeHoverIndentGuideId:Hs,linksGetter:Gs,createSpanLink:As,focusedSpanId:Er,createFocusSpanLink:Mr,theme:_s,datasourceType:er,traceFlameGraphs:Kr,setTraceFlameGraphs:$r,setRedrawListView:Sr}=this.props,us=ga.get(Vt);if(!wa||!us)return null;const Zn=(0,Te.Kv)(en,_s),fa=hs();return n.createElement("div",{className:fa.row,key:tt,style:{...dt,zIndex:1},...xt},n.createElement(so,{color:Zn,columnDivision:Ua,onDetailToggled:da,detailState:us,linksGetter:Gs,logItemToggle:dn,logsToggle:yn,processToggle:Vn,referenceItemToggle:Gn,referencesToggle:aa,warningsToggle:ta,stackTracesToggle:Sa,span:et,traceToProfilesOptions:va,timeZone:Ja,tagsToggle:Fa,traceStartTime:wa.startTime,traceDuration:wa.duration,traceName:wa.traceName,hoverIndentGuideIds:Xa,addHoverIndentGuideId:ys,removeHoverIndentGuideId:Hs,createSpanLink:As,focusedSpanId:Er,createFocusSpanLink:Mr,datasourceType:er,visibleSpanIds:Wt,traceFlameGraphs:Kr,setTraceFlameGraphs:$r,setRedrawListView:Sr}))}render(){const et=hs(),{scrollElement:tt,redrawListView:dt}=this.props;return n.createElement(n.Fragment,null,n.createElement(me,{ref:this.setListView,dataLength:this.getRowStates().length,itemHeightGetter:this.getRowHeight,itemRenderer:this.renderRow,viewBuffer:Zr,viewBufferMin:Zr,itemsWrapperClassName:et.rowsWrapper,getKeyFromIndex:this.getKeyFromIndex,getIndexFromKey:this.getIndexFromKey,windowScroller:!1,scrollElement:tt,redraw:dt}),this.props.topOfViewRef&&n.createElement(pe.I,{className:et.scrollToTopButton,onClick:this.scrollToTop,title:"Scroll to top",icon:"arrow-up"}))}}const oo=(0,g.cV)(St),vo=(0,r.N)(Ze=>({TraceTimelineViewer:(0,t.css)` label: TraceTimelineViewer; border-bottom: 1px solid ${(0,u.R)(Ze,"#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,u.R)(Ze,"firebrick")}; } & .json-markup-string { color: ${(0,u.R)(Ze,"teal")}; } & .json-markup-null { color: ${(0,u.R)(Ze,"teal")}; } & .json-markup-number { color: ${(0,u.R)(Ze,"blue","black")}; } `})),io=5;class ur extends n.PureComponent{constructor(et){super(et),this.collapseAll=()=>{this.props.collapseAll(this.props.trace.spans),(0,o.rR)("grafana_traces_traceID_expand_collapse_clicked",{datasourceType:this.props.datasourceType,grafana_version:s.$.buildInfo.version,type:"collapseAll"})},this.collapseOne=()=>{this.props.collapseOne(this.props.trace.spans),(0,o.rR)("grafana_traces_traceID_expand_collapse_clicked",{datasourceType:this.props.datasourceType,grafana_version:s.$.buildInfo.version,type:"collapseOne"})},this.expandAll=()=>{this.props.expandAll(),(0,o.rR)("grafana_traces_traceID_expand_collapse_clicked",{datasourceType:this.props.datasourceType,grafana_version:s.$.buildInfo.version,type:"expandAll"})},this.expandOne=()=>{this.props.expandOne(this.props.trace.spans),(0,o.rR)("grafana_traces_traceID_expand_collapse_clicked",{datasourceType:this.props.datasourceType,grafana_version:s.$.buildInfo.version,type:"expandOne"})},this.state={height:0}}componentDidMount(){p({collapseAll:this.collapseAll,expandAll:this.expandAll,collapseOne:this.collapseOne,expandOne:this.expandOne})}render(){const{setSpanNameColumnWidth:et,updateNextViewRangeTime:tt,updateViewRangeTime:dt,viewRange:xt,traceTimeline:Wt,theme:Vt,topOfViewRef:en,focusedSpanIdForSearch:dn,...yn}=this.props,{trace:Vn}=yn,aa=vo(Vt);return n.createElement("div",{className:aa.TraceTimelineViewer,ref:Gn=>Gn&&this.setState({height:Gn.getBoundingClientRect().height})},n.createElement(ge,{duration:Vn.duration,nameColumnWidth:Wt.spanNameColumnWidth,numTicks:io,onCollapseAll:this.collapseAll,onCollapseOne:this.collapseOne,onColummWidthChange:et,onExpandAll:this.expandAll,onExpandOne:this.expandOne,viewRangeTime:xt.time,updateNextViewRangeTime:tt,updateViewRangeTime:dt,columnResizeHandleHeight:this.state.height}),n.createElement(oo,{...yn,...Wt,setSpanNameColumnWidth:et,currentViewRangeTime:xt.time.current,topOfViewRef:en,focusedSpanIdForSearch:dn,datasourceType:this.props.datasourceType}))}}const Fr=(0,g.cV)(ur);var Co=e(39938);const bo=()=>({NewWindowIconLarge:(0,t.css)` label: NewWindowIconLarge; font-size: 1.5em; `});function Ot(Ze){const{isLarge:et,className:tt,...dt}=Ze,xt=(0,g.of)(bo),Wt=v()({[xt.NewWindowIconLarge]:et},tt);return n.createElement(ye.I,{className:Wt,name:"anchor",...dt})}Ot.defaultProps={isLarge:!1};const $t=Ze=>n.createElement("a",{href:Ze.href,title:Ze.title,target:"_blank",rel:"noopener noreferrer",className:Ze.className},Ze.children," ",n.createElement(Ot,null));function sn(Ze){const{links:et}=Ze;return n.createElement($t,{href:et[0].url,title:et[0].text,className:Ze.className})}const Zt=100,vn="<trace-without-root-span>",wn=()=>({BreakableText:(0,t.css)` label: BreakableText; display: inline-block; white-space: pre; `}),kn=/\W*\w+\W*/g;function ua(Ze){const{className:et,text:tt,wordRegexp:dt=kn}=Ze,xt=(0,g.of)(wn);if(!tt)return null;const Wt=[];dt.exec("");let Vt=dt.exec(tt)||[tt];for(;Vt;)Wt.push(n.createElement("span",{key:`${tt}-${Wt.length}`,className:et||xt.BreakableText},Vt[0])),Vt=dt.exec(tt);return n.createElement(n.Fragment,null,Wt)}ua.defaultProps={wordRegexp:kn};const ma=Ze=>({TraceName:(0,t.css)` label: TraceName; font-size: ${Ze.typography.size.lg}; `});function Qa(Ze){const{className:et,traceName:tt}=Ze,dt=(0,g.of)(ma),xt=String(tt||vn),Wt=n.createElement(ua,{text:xt});return n.createElement("span",{className:v()(dt.TraceName,et)},Wt)}var za=e(40784);const Ia=Object.defineProperty({archiveEnabled:!1,dependencies:{dagMaxNumServices:Zt,menuEnabled:!0},linkPatterns:[],search:{maxLookback:{label:"2 Days",value:"2d"},maxLimit:1500},tracking:{gaID:null,trackErrors:!0}},"__mergeFields",{value:["dependencies","search","tracking"]});function Ha(){return Ia}function Ys(Ze){return(0,he.get)(Ha(),Ze)}const sr=/#\{([^{}]*)\}/g;function vs(Ze){const et=new Set;return Ze.replace(sr,(tt,dt)=>(et.add(dt),tt)),Array.from(et)}function zr(Ze,et,tt){return Ze.replace(sr,(dt,xt)=>{const Wt=tt[xt];return Wt==null?"":et(Wt)})}function ws(Ze,et){if(typeof Ze!="string")throw new Error("Invalid template");return{parameters:vs(Ze),template:zr.bind(null,Ze,et)}}function ds(Ze){if(typeof Ze=="string")return et=>et===Ze;if(Array.isArray(Ze))return et=>Ze.indexOf(et)>-1;if(Ze==null)return()=>!0;throw new Error(`Invalid value: ${Ze}`)}const Vs=Ze=>Ze;function kr(Ze){try{const et=ws(Ze.url,encodeURIComponent),tt=ws(Ze.text,Vs);return{object:Ze,type:ds(Ze.type),key:ds(Ze.key),value:ds(Ze.value),url:et,text:tt,parameters:(0,he.uniq)(et.parameters.concat(tt.parameters))}}catch(et){return console.error(`Ignoring invalid link pattern: ${et}`,Ze),null}}function ha(Ze,et){return Ze.template(et)}function xs(Ze,et){const tt=[],dt=Object.keys(et).filter(xt=>typeof et[xt]=="string"||et[xt]==="number");return Ze?.filter(xt=>xt?.type("traces")).forEach(xt=>{const Wt={};xt?.parameters.every(en=>{const dn=en;return dt.includes(dn)?(Wt[en]=et[dn],!0):!1})&&tt.push({url:ha(xt.url,Wt),text:ha(xt.text,Wt)})}),tt}const lo=(Ys("linkPatterns")||[]).map(kr).filter(Ze=>!!Ze),qa=(0,za.A)(10)(Ze=>{const et=[];return Ze?xs(lo,Ze):et});function Qs(Ze){let et;const tt=new Set(Ze.map(({spanID:dt})=>dt));for(let dt=0;dt<Ze.length;dt++){if(Ze[dt].references&&Ze[dt].references.some(({traceID:en,spanID:dn})=>en===Ze[dt].traceID&&tt.has(dn)))continue;if(!et){et=Ze[dt];continue}const Wt=Ze[dt].references&&Ze[dt].references.length||0,Vt=et.references&&et.references.length||0;(Wt<Vt||Wt===Vt&&Ze[dt].startTime<et.startTime)&&(et=Ze[dt])}return et?`${et.process.serviceName}: ${et.operationName}`:""}const Wr=(0,he.memoize)(Qs,Ze=>Ze.length?Ze[0].traceID:0);function co(Ze){for(let et=0;et<Ze.length;et++){const tt=Ze[et].tags.filter(Wt=>Wt.key==="http.method"),dt=Ze[et].tags.filter(Wt=>Wt.key==="http.status_code"),xt=Ze[et].tags.filter(Wt=>Wt.key==="http.url"||Wt.key==="http.target"||Wt.key==="http.path");if(tt.length>0||dt.length>0||xt.length>0)return{method:tt,status:dt,url:xt}}return{}}const To=(0,he.memoize)(co,Ze=>Ze.length?Ze[0].traceID:0);var Mo=e(2913),vi=e(80287);const ti=Ze=>({ActionButton:(0,t.css)` label: ActionButton; overflow: hidden; position: relative; &:after { content: ''; background: ${Ze.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 ko(Ze){const{onClick:et,ariaLabel:tt,label:dt,icon:xt}=Ze,Wt=(0,g.of)(ti);return n.createElement(Ke.$n,{className:Wt.ActionButton,size:"sm",variant:"secondary",fill:"outline",type:"button",icon:xt,"aria-label":tt,onClick:et},dt)}const Ho=Ze=>({TracePageActions:(0,t.css)` label: TracePageActions; display: flex; align-items: center; justify-content: center; gap: 4px; `,feedback:(0,t.css)` margin: 6px; color: ${Ze.colors.text.secondary}; font-size: ${Ze.typography.bodySmall.fontSize}; &:hover { color: ${Ze.colors.text.link}; } `});function Gi(Ze){const{traceId:et,data:tt,app:dt}=Ze,xt=(0,g.$j)(),Wt=Ho(xt),[Vt,en]=(0,n.useState)(!1),dn=()=>{navigator.clipboard.writeText(et),en(!0),setTimeout(()=>{en(!1)},5e3)},yn=()=>{const Vn=(0,vi.ek)(tt,"Trace-"+et.substring(et.length-6));(0,o.rR)("grafana_traces_download_traces_clicked",{app:dt,grafana_version:Mo.$W.buildInfo.version,trace_format:Vn,location:"trace-view"})};return n.createElement("div",{className:Wt.TracePageActions},n.createElement("a",{href:"https://forms.gle/RZDEx8ScyZNguDoC8",className:Wt.feedback,title:"Share your thoughts about tracing in Grafana.",target:"_blank",rel:"noreferrer noopener"},n.createElement(ye.I,{name:"comment-alt-message"})," Give feedback"),n.createElement(ko,{onClick:dn,ariaLabel:"Copy Trace ID",label:Vt?"Copied!":"Trace ID",icon:"copy"}),n.createElement(ko,{onClick:yn,ariaLabel:"Export Trace",label:"Export",icon:"save"}))}var mr=e(50877),ji=e(3721),Yi=e(20323),Qi=e(82762),ni=e(39268),ai=e(14186),Hr=e(66864),Gr=e(88323),So=e(15583),si=e(10354);class Tr extends n.PureComponent{constructor(){super(...arguments),this.clearUiFind=()=>{this.props.onChange("")}}render(){const{value:et}=this.props,tt=n.createElement(n.Fragment,null,et&&et.length&&n.createElement(_.K,{name:"times",onClick:this.clearUiFind,tooltip:"Clear input"}));return n.createElement("div",{style:{width:"200px"}},n.createElement(si.p,{placeholder:"Find...",onChange:dt=>this.props.onChange(dt.currentTarget.value),suffix:tt,value:et}))}}Tr.defaultProps={value:void 0};const Ji=(0,n.memo)(function(et){const{trace:tt,spanFilterMatches:dt,setFocusedSpanIdForSearch:xt,focusedSpanIndexForSearch:Wt,setFocusedSpanIndexForSearch:Vt,datasourceType:en,showSpanFilters:dn}=et,yn=Xi((0,g.$j)(),dn);(0,n.useEffect)(()=>{if(dt&&Wt!==-1){const va=Array.from(dt);xt(va[Wt])}},[Wt,xt,dt]);const Vn=(va,Ja)=>{if(va.preventDefault(),va.stopPropagation(),Ja){if((0,o.rR)("grafana_traces_trace_view_find_next_prev_clicked",{datasourceType:en,grafana_version:s.$.buildInfo.version,direction:"next"}),Wt===-1||dt&&Wt===dt.size-1){Vt(0);return}Vt(Wt+1)}},aa=(va,Ja)=>{if(va.preventDefault(),va.stopPropagation(),Ja){if((0,o.rR)("grafana_traces_trace_view_find_next_prev_clicked",{datasourceType:en,grafana_version:s.$.buildInfo.version,direction:"prev"}),dt&&(Wt===-1||Wt===0)){Vt(dt.size-1);return}Vt(Wt-1)}},Gn=(va,Ja)=>{va.key==="Enter"&&Vn(va,Ja)},ta=(va,Ja)=>{va.key==="Enter"&&aa(va,Ja)},Sa=(dt&&dt?.size>0)??!1,ga=Sa?yn.button:(0,t.cx)(yn.button,yn.buttonDisabled),Fa=(0,n.useCallback)(va=>n.createElement(We.m,{content:va,placement:"top"},n.createElement("span",{className:yn.tooltip},n.createElement(ye.I,{name:"info-circle",size:"md"}))),[yn.tooltip]),da=(0,n.useCallback)((va,Ja)=>{let Xa=n.createElement(n.Fragment,null,n.createElement("span",null,`${tt.spans.length} spans`),Fa(n.createElement(n.Fragment,null,n.createElement("div",null,"Services: ",Ja),n.createElement("div",null,"Depth: ",va))));if(dt)if(dt.size===0)Xa=n.createElement(n.Fragment,null,n.createElement("span",null,"0 matches"),Fa("There are 0 span matches for the filters selected. Please try removing some of the selected filters."));else{const ys=dt.size===1?"match":"matches",Hs=Wt!==-1?`${Wt+1}/${dt.size} ${ys}`:`${dt.size} ${ys}`,Gs=[];dt.forEach(As=>{tt.processes[As]&&Gs.push(tt.processes[As].serviceName)}),Xa=n.createElement(n.Fragment,null,n.createElement("span",null,Hs),Fa(n.createElement(n.Fragment,null,n.createElement("div",null,"Services: ",new Set(Gs).size,"/",Ja),n.createElement("div",null,"Depth: ",va))))}return Xa},[Wt,Fa,dt,tt.processes,tt.spans]),Ua=new Set((0,he.values)(tt.processes).map(va=>va.serviceName)).size,wa=(0,he.get)((0,he.maxBy)(tt.spans,"depth"),"depth",0)+1;return n.createElement(n.Fragment,null,n.createElement("span",{className:yn.matches},da(wa,Ua)),n.createElement("div",{className:Sa?yn.buttons:(0,t.cx)(yn.buttons,yn.buttonsDisabled)},n.createElement("div",{"aria-label":"Prev result button",className:ga,onClick:va=>aa(va,Sa),onKeyDown:va=>ta(va,Sa),role:"button",tabIndex:Sa?0:-1},"Prev"),n.createElement("div",{"aria-label":"Next result button",className:ga,onClick:va=>Vn(va,Sa),onKeyDown:va=>Gn(va,Sa),role:"button",tabIndex:Sa?0:-1},"Next")))}),Xi=(Ze,et)=>{const tt=(0,Ke.hs)({theme:Ze,variant:"secondary",size:et?"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)` ${tt.button}; `,buttonDisabled:(0,t.css)` ${tt.disabled}; pointer-events: none; `,matches:(0,t.css)` margin-right: ${Ze.spacing(2)}; text-wrap: nowrap; `,tooltip:(0,t.css)` color: #aaa; margin: 0 0 0 5px; `}};var Ni=e(15292);function Zi(Ze,et){if(!et)return;let tt=!1;Ze.serviceName&&(et=Pl(et,Ze),tt=!0),Ze.spanName&&(et=es(et,Ze),tt=!0),(Ze.from||Ze.to)&&(et=Go(et,Ze),tt=!0);const dt=Dl(et,Ze.tags);if(dt&&(et=dt,tt=!0),Ze.query){const xt=yl(Ze.query,et);xt&&(et=xt,tt=!0)}return tt?new Set(et.map(xt=>xt.spanID)):void 0}function yl(Ze,et){if(!et)return;const tt=[];Ze.split(/\s+/).filter(Boolean).forEach(Vt=>{tt.push(Vt.toLowerCase())});const dt=(Vt,en)=>Vt.some(dn=>en.toLowerCase().includes(dn)),xt=Vt=>Vt?Vt.some(en=>dt(tt,en.key)||dt(tt,Ei(en.value))):!1,Wt=Vt=>dt(tt,Vt.operationName)||dt(tt,Vt.process.serviceName)||xt(Vt.tags)||Vt.kind&&dt(tt,Vt.kind)||Vt.statusCode!==void 0&&dt(tt,Ue.s[Vt.statusCode])||Vt.statusMessage&&dt(tt,Vt.statusMessage)||Vt.instrumentationLibraryName&&dt(tt,Vt.instrumentationLibraryName)||Vt.instrumentationLibraryVersion&&dt(tt,Vt.instrumentationLibraryVersion)||Vt.traceState&&dt(tt,Vt.traceState)||Vt.logs!==null&&Vt.logs.some(en=>xt(en.fields))||xt(Vt.process.tags)||tt.some(en=>en===Vt.spanID);return et.filter(Wt)}const Dl=(Ze,et)=>{if(et=et.filter(tt=>tt.key&&tt.key!==""||tt.value),et.length>0)return Ze.filter(tt=>et.every(dt=>{if(dt.key&&dt.value){if(tt.tags.some(xt=>vr(dt,xt))||tt.process.tags.some(xt=>vr(dt,xt))||tt.logs&&tt.logs.some(xt=>xt.fields.some(Wt=>vr(dt,Wt)))||tt.kind&&dt.key===Pt&&dt.value===tt.kind||tt.statusCode!==void 0&&dt.key===Mt&&dt.value===Ue.s[tt.statusCode].toLowerCase()||tt.statusMessage&&dt.key===Yt&&dt.value===tt.statusMessage||tt.instrumentationLibraryName&&dt.key===zt&&dt.value===tt.instrumentationLibraryName||tt.instrumentationLibraryVersion&&dt.key===_t&&dt.value===tt.instrumentationLibraryVersion||tt.traceState&&dt.key===rt&&dt.value===tt.traceState||dt.key===It&&dt.value===tt.spanID)return wi(dt.operator,!0)}else if(dt.key&&(tt.tags.some(xt=>qr(dt.key,xt.key))||tt.process.tags.some(xt=>qr(dt.key,xt.key))||tt.logs&&tt.logs.some(xt=>xt.fields.some(Wt=>qr(dt.key,Wt.key)))||tt.kind&&dt.key===Pt||tt.statusCode!==void 0&&dt.key===Mt||tt.statusMessage&&dt.key===Yt||tt.instrumentationLibraryName&&dt.key===zt||tt.instrumentationLibraryVersion&&dt.key===_t||tt.traceState&&dt.key===rt||dt.key===It))return wi(dt.operator,!0);return wi(dt.operator,!1)}))},qr=(Ze,et)=>Ze===et.toString(),vr=(Ze,et)=>Ze.key===et.key&&Ze.value===Ei(et.value),wi=(Ze,et)=>Ze==="="?et:!et,Ei=Ze=>Ze?Ze.toString():"",Pl=(Ze,et)=>Ze.filter(tt=>et.serviceNameOperator==="="?tt.process.serviceName===et.serviceName:tt.process.serviceName!==et.serviceName),es=(Ze,et)=>Ze.filter(tt=>et.spanNameOperator==="="?tt.operationName===et.spanName:tt.operationName!==et.spanName),Go=(Ze,et)=>{const tt=Bo(et?.from||""),dt=Bo(et?.to||"");let xt=[];if(tt&&(xt=Ze.filter(Wt=>et.fromOperator===">"?Wt.duration>tt:Wt.duration>=tt)),dt){const Wt=Vt=>et.toOperator==="<"?Vt.duration<dt:Vt.duration<=dt;xt=xt.length>0?xt.filter(Vt=>Wt(Vt)):Ze.filter(Vt=>Wt(Vt))}return xt},Bo=Ze=>{if(Ze.includes("ns"))return parseFloat(Ze.split("ns")[0])/1e3;if(Ze.includes("us"))return parseFloat(Ze.split("us")[0]);if(Ze.includes("\xB5s"))return parseFloat(Ze.split("\xB5s")[0]);if(Ze.includes("ms"))return parseFloat(Ze.split("ms")[0])*1e3;if(Ze.includes("s"))return parseFloat(Ze.split("s")[0])*1e3*1e3;if(Ze.includes("m"))return parseFloat(Ze.split("m")[0])*1e3*1e3*60;if(Ze.includes("h"))return parseFloat(Ze.split("h")[0])*1e3*1e3*60*60},qi=(0,n.memo)(function(et){const{trace:tt,search:dt,spanFilterMatches:xt,showSpanFilterMatchesOnly:Wt,setShowSpanFilterMatchesOnly:Vt,showCriticalPathSpansOnly:en,setShowCriticalPathSpansOnly:dn,focusedSpanIndexForSearch:yn,setFocusedSpanIndexForSearch:Vn,setFocusedSpanIdForSearch:aa,datasourceType:Gn,clear:ta,showSpanFilters:Sa}=et,ga=(0,g.of)(el),Fa=(0,n.useMemo)(()=>dt.serviceName&&dt.serviceName!==""||dt.spanName&&dt.spanName!==""||Bo(dt.from||"")||Bo(dt.to||"")||dt.tags.length>1||dt.tags.some(da=>da.key)||dt.query&&dt.query!==""||Wt,[dt.serviceName,dt.spanName,dt.from,dt.to,dt.tags,dt.query,Wt]);return n.createElement("div",{className:ga.container},n.createElement("div",{className:ga.controls},n.createElement(n.Fragment,null,n.createElement("div",null,n.createElement(Ke.$n,{variant:"destructive",disabled:!Fa,type:"button",fill:"outline","aria-label":"Clear filters button",onClick:ta},"Clear"),n.createElement("div",{className:ga.matchesOnly},n.createElement(Ni.d,{value:Wt,onChange:da=>Vt(da.currentTarget.checked??!1),label:"Show matches only switch",disabled:!xt?.size}),n.createElement(Ke.$n,{onClick:()=>Vt(!Wt),className:ga.clearMatchesButton,variant:"secondary",fill:"text",disabled:!xt?.size},"Show matches only")),n.createElement("div",{className:ga.matchesOnly},n.createElement(Ni.d,{value:en,onChange:da=>dn(da.currentTarget.checked??!1),label:"Show critical path only switch"}),n.createElement(Ke.$n,{onClick:()=>dn(!en),className:ga.clearMatchesButton,variant:"secondary",fill:"text"},"Show critical path only"))),n.createElement("div",{className:ga.nextPrevResult},n.createElement(Ji,{trace:tt,spanFilterMatches:xt,setFocusedSpanIdForSearch:aa,focusedSpanIndexForSearch:yn,setFocusedSpanIndexForSearch:Vn,datasourceType:Gn,showSpanFilters:Sa})))))}),el=Ze=>{const et=(0,Ke.hs)({theme:Ze,variant:"secondary",size:"md",iconOnly:!1,fill:"outline"});return{button:(0,t.css)(et.button),buttonDisabled:(0,t.css)(et.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; `,matchesOnly:(0,t.css)` display: inline-flex; margin: 0 0 0 25px; vertical-align: middle; align-items: center; `,clearMatchesButton:(0,t.css)` color: ${Ze.colors.text.primary}; &:hover { background: inherit; } `,nextPrevResult:(0,t.css)` margin-left: auto; display: flex; align-items: center; `}},jo=(0,n.memo)(Ze=>{const{trace:et,search:tt,setSearch:dt,showSpanFilters:xt,setShowSpanFilters:Wt,showSpanFilterMatchesOnly:Vt,setShowSpanFilterMatchesOnly:en,showCriticalPathSpansOnly:dn,setShowCriticalPathSpansOnly:yn,setFocusedSpanIdForSearch:Vn,spanFilterMatches:aa,datasourceType:Gn}=Ze,ta={...(0,g.of)(Cl)},[Sa,ga]=(0,n.useState)(),[Fa,da]=(0,n.useState)(),[Ua,wa]=(0,n.useState)(),[va,Ja]=(0,n.useState)({}),[Xa,ys]=(0,n.useState)(-1),Hs=/^\d+(?:\.\d)?\d*(?:ns|us|µs|ms|s|m|h)$/,Gs=(0,n.useCallback)(()=>{ga(void 0),da(void 0),wa(void 0),Ja({}),dt(So.Ji),en(!1)},[dt,en]);if((0,n.useEffect)(()=>{Gs()},[Gs,et]),!et)return null;const As=Zn=>{ys(-1),Vn(""),dt(Zn)},Er=()=>{if(!Sa){const Zn=et.spans.map(fa=>fa.process.serviceName);ga((0,he.uniq)(Zn).sort().map(mr.z))}},Mr=()=>{if(!Fa){const Zn=et.spans.map(fa=>fa.operationName);da((0,he.uniq)(Zn).sort().map(mr.z))}},_s=()=>{if(!Ua){let Zn=[],fa=[];et.spans.forEach(ka=>{ka.tags.forEach(ss=>{Zn.push(ss.key)}),ka.process.tags.forEach(ss=>{Zn.push(ss.key)}),ka.logs!==null&&ka.logs.forEach(ss=>{ss.fields.forEach(Rr=>{fa.push(Rr.key)})}),ka.kind&&Zn.push(Pt),ka.statusCode!==void 0&&Zn.push(Mt),ka.statusMessage&&Zn.push(Yt),ka.instrumentationLibraryName&&Zn.push(zt),ka.instrumentationLibraryVersion&&Zn.push(_t),ka.traceState&&Zn.push(rt),Zn.push(It)}),Zn=(0,he.uniq)(Zn).sort(),fa=(0,he.uniq)(fa).sort(),wa([...Zn,...fa].map(mr.z))}},er=async Zn=>{const fa=[];return et.spans.forEach(ka=>{const ss=ka.tags.find(Js=>Js.key===Zn)?.value;ss&&fa.push(ss.toString());const Rr=ka.process.tags.find(Js=>Js.key===Zn)?.value;switch(Rr&&fa.push(Rr.toString()),ka.logs!==null&&ka.logs.forEach(Js=>{const gr=Js.fields.find(rs=>rs.key===Zn)?.value;gr&&fa.push(gr.toString())}),Zn){case Pt:ka.kind&&fa.push(ka.kind);break;case Mt:ka.statusCode!==void 0&&fa.push(Ue.s[ka.statusCode].toLowerCase());break;case Yt:ka.statusMessage&&fa.push(ka.statusMessage);break;case zt:ka.instrumentationLibraryName&&fa.push(ka.instrumentationLibraryName);break;case _t:ka.instrumentationLibraryVersion&&fa.push(ka.instrumentationLibraryVersion);break;case rt:ka.traceState&&fa.push(ka.traceState);break;case It:fa.push(ka.spanID);break;default:break}}),(0,he.uniq)(fa).sort().map(mr.z)},Kr=(Zn,fa)=>{dt({...tt,tags:tt.tags?.map(ss=>ss.id===Zn.id?{...ss,key:fa?.value||"",value:void 0}:ss)}),(async()=>{if(fa?.value)Ja({...va,[Zn.id]:await er(fa.value)});else{const ss={...va};ss[Zn.id]&&delete ss[Zn.id],Ja(ss)}})()},$r=()=>{const Zn={id:(0,So.zE)(),operator:"="};dt({...tt,tags:[...tt.tags,Zn]})},Sr=Zn=>{let fa=tt.tags.filter(ka=>ka.id!==Zn);fa.length===0&&(fa=[{id:(0,So.zE)(),operator:"="}]),dt({...tt,tags:fa})},us=n.createElement(n.Fragment,null,n.createElement(We.m,{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:ta.collapseLabel},"Span Filters",n.createElement(ye.I,{size:"md",name:"info-circle"}))),!xt&&n.createElement("div",{className:ta.nextPrevResult},n.createElement(Ji,{trace:et,spanFilterMatches:aa,setFocusedSpanIdForSearch:Vn,focusedSpanIndexForSearch:Xa,setFocusedSpanIndexForSearch:ys,datasourceType:Gn,showSpanFilters:xt})));return n.createElement("div",{className:ta.container},n.createElement(Qi.S,{label:us,collapsible:!0,isOpen:xt,onToggle:Wt},n.createElement(ni.C,{className:ta.flexContainer},n.createElement(ai.I,{label:"Service Name",labelWidth:16},n.createElement(Hr.Gy,{spacing:"xs"},n.createElement(Gr.l6,{"aria-label":"Select service name operator",onChange:Zn=>As({...tt,serviceNameOperator:Zn.value}),options:[(0,mr.z)("="),(0,mr.z)("!=")],value:tt.serviceNameOperator}),n.createElement(Gr.l6,{"aria-label":"Select service name",isClearable:!0,onChange:Zn=>As({...tt,serviceName:Zn?.value||""}),onOpenMenu:Er,options:Sa,placeholder:"All service names",value:tt.serviceName||null}))),n.createElement(Tr,{onChange:Zn=>{As({...tt,query:Zn}),Zn===""&&en(!1)},value:tt.query||""})),n.createElement(ni.C,null,n.createElement(ai.I,{label:"Span Name",labelWidth:16},n.createElement(Hr.Gy,{spacing:"xs"},n.createElement(Gr.l6,{"aria-label":"Select span name operator",onChange:Zn=>As({...tt,spanNameOperator:Zn.value}),options:[(0,mr.z)("="),(0,mr.z)("!=")],value:tt.spanNameOperator}),n.createElement(Gr.l6,{"aria-label":"Select span name",isClearable:!0,onChange:Zn=>As({...tt,spanName:Zn?.value||""}),onOpenMenu:Mr,options:Fa,placeholder:"All span names",value:tt.spanName||null})))),n.createElement(ni.C,null,n.createElement(ai.I,{label:"Duration",labelWidth:16,tooltip:"Filter by duration. Accepted units are ns, us, ms, s, m, h"},n.createElement(Hr.Gy,{spacing:"xs",align:"flex-start"},n.createElement(Gr.l6,{"aria-label":"Select min span operator",onChange:Zn=>As({...tt,fromOperator:Zn.value}),options:[(0,mr.z)(">"),(0,mr.z)(">=")],value:tt.fromOperator}),n.createElement("div",{className:ta.intervalInput},n.createElement(Yi.e,{ariaLabel:"Select min span duration",onChange:Zn=>As({...tt,from:Zn}),isInvalidError:"Invalid duration",placeholder:"e.g. 100ms, 1.2s",width:18,value:tt.from||"",validationRegex:Hs})),n.createElement(Gr.l6,{"aria-label":"Select max span operator",onChange:Zn=>As({...tt,toOperator:Zn.value}),options:[(0,mr.z)("<"),(0,mr.z)("<=")],value:tt.toOperator}),n.createElement(Yi.e,{ariaLabel:"Select max span duration",onChange:Zn=>As({...tt,to:Zn}),isInvalidError:"Invalid duration",placeholder:"e.g. 100ms, 1.2s",width:18,value:tt.to||"",validationRegex:Hs})))),n.createElement(ni.C,{className:ta.tagsRow},n.createElement(ai.I,{label:"Tags",labelWidth:16,tooltip:"Filter by tags, process tags or log fields in your spans."},n.createElement("div",null,tt.tags.map((Zn,fa)=>n.createElement("div",{key:fa},n.createElement(Hr.Gy,{spacing:"xs",width:"auto"},n.createElement(Gr.l6,{"aria-label":"Select tag key",isClearable:!0,key:Zn.key,onChange:ka=>Kr(Zn,ka),onOpenMenu:_s,options:Ua,placeholder:"Select tag",value:Zn.key||null}),n.createElement(Gr.l6,{"aria-label":"Select tag operator",onChange:ka=>{As({...tt,tags:tt.tags?.map(ss=>ss.id===Zn.id?{...ss,operator:ka.value}:ss)})},options:[(0,mr.z)("="),(0,mr.z)("!=")],value:Zn.operator}),n.createElement("span",{className:ta.tagValues},n.createElement(Gr.l6,{"aria-label":"Select tag value",isClearable:!0,key:Zn.value,onChange:ka=>{As({...tt,tags:tt.tags?.map(ss=>ss.id===Zn.id?{...ss,value:ka?.value||""}:ss)})},options:va[Zn.id]?va[Zn.id]:[],placeholder:"Select value",value:Zn.value})),(Zn.key||Zn.value||tt.tags.length>1)&&n.createElement(ji.Z,{"aria-label":"Remove tag",variant:"secondary",icon:"times",onClick:()=>Sr(Zn.id),tooltip:"Remove tag"}),(Zn.key||Zn.value)&&fa===tt.tags.length-1&&n.createElement("span",{className:ta.addTag},n.createElement(ji.Z,{"aria-label":"Add tag",variant:"secondary",icon:"plus",onClick:$r,tooltip:"Add tag"})))))))),n.createElement(qi,{trace:et,search:tt,spanFilterMatches:aa,showSpanFilterMatchesOnly:Vt,setShowSpanFilterMatchesOnly:en,showCriticalPathSpansOnly:dn,setShowCriticalPathSpansOnly:yn,setFocusedSpanIdForSearch:Vn,focusedSpanIndexForSearch:Xa,setFocusedSpanIndexForSearch:ys,datasourceType:Gn,clear:Gs,showSpanFilters:xt})))});jo.displayName="SpanFilters";const Cl=Ze=>({container:(0,t.css)` label: SpanFilters; margin: 0.5em 0 -${Ze.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; } `,flexContainer:(0,t.css)({display:"flex",justifyContent:"space-between"}),addTag:(0,t.css)({marginLeft:Ze.spacing(1)}),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: ${Ze.spacing(1)}; `}),yi=(0,n.memo)(Ze=>{const{trace:et,data:tt,app:dt,timeZone:xt,search:Wt,setSearch:Vt,showSpanFilters:en,setShowSpanFilters:dn,showSpanFilterMatchesOnly:yn,setShowSpanFilterMatchesOnly:Vn,showCriticalPathSpansOnly:aa,setShowCriticalPathSpansOnly:Gn,setFocusedSpanIdForSearch:ta,spanFilterMatches:Sa,datasourceType:ga,setHeaderHeight:Fa}=Ze,da=(0,g.of)(uo);(0,n.useEffect)(()=>{Fa(document.querySelector("."+da.header)?.scrollHeight??0)},[Fa,en,da.header]);const Ua=(0,n.useMemo)(()=>et?qa(et):[],[et]);if(!et)return null;const wa=(Gs,As)=>{const Er=(0,_e.LE)(Gs.startTime/1e3,{timeZone:As,defaultWithMS:!0}),Mr=Er.match(/^(.+)(:\d\d\.\d+)$/);return Mr?n.createElement("span",{className:da.TracePageHeaderOverviewItemValue},Mr[1],n.createElement("span",{className:da.TracePageHeaderOverviewItemValueDetail},Mr[2])):Er},va=n.createElement("h1",{className:v()(da.title)},n.createElement(Qa,{traceName:Wr(et.spans)}),n.createElement("small",{className:da.duration},(0,E.a3)(et.duration))),{method:Ja,status:Xa,url:ys}=To(et.spans);let Hs="green";return Xa&&Xa.length>0&&(Xa[0].value.toString().charAt(0)==="4"?Hs="orange":Xa[0].value.toString().charAt(0)==="5"&&(Hs="red")),n.createElement("header",{className:da.header},n.createElement("div",{className:da.titleRow},Ua&&Ua.length>0&&n.createElement(sn,{links:Ua,className:da.TracePageHeaderBack}),va,n.createElement(Gi,{traceId:et.traceID,data:tt,app:dt})),n.createElement("div",{className:da.subtitle},n.createElement("span",{className:da.timestamp},wa(et,xt)),n.createElement("span",{className:da.tagMeta},Ja&&Ja.length>0&&n.createElement(We.m,{content:"http.method",interactive:!0},n.createElement("span",{className:da.tag},n.createElement(Co.E,{text:Ja[0].value,color:"blue"}))),Xa&&Xa.length>0&&n.createElement(We.m,{content:"http.status_code",interactive:!0},n.createElement("span",{className:da.tag},n.createElement(Co.E,{text:Xa[0].value,color:Hs}))),ys&&ys.length>0&&n.createElement(We.m,{content:"http.url or http.target or http.path",interactive:!0},n.createElement("span",{className:da.url},ys[0].value)))),n.createElement(jo,{trace:et,showSpanFilters:en,setShowSpanFilters:dn,showSpanFilterMatchesOnly:yn,setShowSpanFilterMatchesOnly:Vn,showCriticalPathSpansOnly:aa,setShowCriticalPathSpansOnly:Gn,search:Wt,setSearch:Vt,spanFilterMatches:Sa,setFocusedSpanIdForSearch:ta,datasourceType:ga}))});yi.displayName="TracePageHeader";const uo=Ze=>({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:v()((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: ${Ze.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; `}),Fi="None",tl="Duration",mo="Tag";function Wi({options:Ze,onOptionsChange:et}){const tt=useStyles2(Eo),dt=[Fi,tl,mo].map(toOption);return React.createElement("div",{className:css({width:"100%"})},React.createElement(InlineFieldRow,{className:tt.row},React.createElement(InlineField,{label:"Label",labelWidth:26,tooltip:"Default: duration",grow:!0},React.createElement(Select,{inputId:"label",options:dt,value:Ze.jsonData.spanBar?.type||"",onChange:xt=>{updateDatasourcePluginJsonDataOption({onOptionsChange:et,options:Ze},"spanBar",{...Ze.jsonData.spanBar,type:xt?.value??""})},placeholder:"Duration",isClearable:!0,"aria-label":"select-label-name",width:40}))),Ze.jsonData.spanBar?.type===mo&&React.createElement(InlineFieldRow,{className:tt.row},React.createElement(InlineField,{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"},React.createElement(Input,{type:"text",placeholder:"Enter tag key",onChange:xt=>updateDatasourcePluginJsonDataOption({onOptionsChange:et,options:Ze},"spanBar",{...Ze.jsonData.spanBar,tag:xt.currentTarget.value}),value:Ze.jsonData.spanBar?.tag||"",width:40}))))}const fr=({options:Ze,onOptionsChange:et})=>{let tt=Ze.type;return tt+=Ze.type==="tempo"?"/configure-tempo-data-source/#span-bar":"/#span-bar",React.createElement(ConfigSubSection,{title:"Span bar",description:React.createElement(ConfigDescriptionLink,{description:"Add additional info next to the service and operation on a span bar row in the trace view.",suffix:tt,feature:"the span bar"})},React.createElement(Wi,{options:Ze,onOptionsChange:et}))},Eo=Ze=>({infoText:css` label: infoText; padding-bottom: ${Ze.spacing(2)}; color: ${Ze.colors.text.secondary}; `,row:css` label: row; align-items: baseline; `});class eo{constructor(et){const{isTagsOpen:tt,isProcessOpen:dt,isReferencesOpen:xt,isWarningsOpen:Wt,isStackTracesOpen:Vt,logs:en,references:dn}=et||{};this.isTagsOpen=!!tt,this.isProcessOpen=!!dt,this.isReferencesOpen=!!xt,this.isWarningsOpen=!!Wt,this.isStackTracesOpen=!!Vt,this.logs={isOpen:!!(en&&en.isOpen),openedItems:en&&en.openedItems?new Set(en.openedItems):new Set},this.references={isOpen:!!(dn&&dn.isOpen),openedItems:dn&&dn.openedItems?new Set(dn.openedItems):new Set}}toggleTags(){const et=new eo(this);return et.isTagsOpen=!this.isTagsOpen,et}toggleProcess(){const et=new eo(this);return et.isProcessOpen=!this.isProcessOpen,et}toggleReferences(){const et=new eo(this);return et.references.isOpen=!this.references.isOpen,et}toggleReferenceItem(et){const tt=new eo(this);return tt.references.openedItems.has(et)?tt.references.openedItems.delete(et):tt.references.openedItems.add(et),tt}toggleWarnings(){const et=new eo(this);return et.isWarningsOpen=!this.isWarningsOpen,et}toggleStackTraces(){const et=new eo(this);return et.isStackTracesOpen=!this.isStackTracesOpen,et}toggleLogs(){const et=new eo(this);return et.logs.isOpen=!this.logs.isOpen,et}toggleLogItem(et){const tt=new eo(this);return tt.logs.openedItems.has(et)?tt.logs.openedItems.delete(et):tt.logs.openedItems.add(et),tt}}var xo=e(1081);class fo{static iterFunction(et,tt=0){return dt=>et(dt.value,dt,tt)}static searchFunction(et){return typeof et=="function"?et:(tt,dt)=>et instanceof fo?dt===et:tt===et}constructor(et,tt=[]){this.value=et,this.children=tt}get depth(){return this.children.reduce((et,tt)=>Math.max(tt.depth+1,et),1)}get size(){let et=0;return this.walk(()=>et++),et}addChild(et){return this.children.push(et instanceof fo?et:new fo(et)),this}find(et){if(fo.iterFunction(fo.searchFunction(et))(this))return this;for(let dt=0;dt<this.children.length;dt++){const xt=this.children[dt].find(et);if(xt)return xt}return null}getPath(et){const tt=fo.iterFunction(fo.searchFunction(et)),dt=(xt,Wt)=>{const Vt=Wt.concat([xt]);if(tt(xt))return Vt;for(let en=0;en<xt.children.length;en++){const dn=xt.children[en],yn=dt(dn,Vt);if(yn)return yn}return null};return dt(this,[])}walk(et,tt=0){const dt=[];let xt=tt;for(dt.push({node:this,depth:xt});dt.length;){const Wt=dt[dt.length-1];dt.pop();const{node:Vt,depth:en}=Wt;et(Vt.value,Vt,en),xt=en+1;let dn=Vt.children.length-1;for(;dn>=0;)dt.push({node:Vt.children[dn],depth:xt}),dn--}}paths(et){const tt=[];tt.push({node:this,childIndex:0});const dt=[];for(;tt.length;){const{node:xt,childIndex:Wt}=tt[tt.length-1];if(xt.children.length>=Wt+1)tt[tt.length-1].childIndex++,tt.push({node:xt.children[Wt],childIndex:0});else{if(xt.children.length===0){const Vt=tt.map(en=>en.node.value);et(Vt)}tt.pop()}}return dt}}const Ki=Ze=>Ze.spanID,bl=Ze=>Ze.references||[],ri=(0,xo.Mz)((0,xo.Mz)(({span:Ze})=>Ze,bl),({type:Ze})=>Ze,(Ze,et)=>Ze.find(tt=>tt.refType===et)),Uo=(0,xo.Mz)(Ze=>ri({span:Ze,type:"CHILD_OF"}),Ze=>Ze?Ze.spanID:null),$i=Ze=>Ze.spans,Tl=(0,xo.Mz)($i,Ze=>Ze.reduce((et,tt)=>et.set(Ki(tt),tt),new Map)),nl="__root__";function Di(Ze,et=null){const tt=new Map(Ze.spans.map(Vt=>[Vt.spanID,new fo(Vt.spanID)])),dt=et??new Map(Ze.spans.map(Vt=>[Vt.spanID,Vt])),xt=new fo(nl);Ze.spans.forEach(Vt=>{const en=tt.get(Vt.spanID);if(Array.isArray(Vt.references)&&Vt.references.length){const{refType:dn,spanID:yn}=Vt.references[0];if(dn==="CHILD_OF"||dn==="FOLLOWS_FROM")(tt.get(yn)||xt).children?.push(en);else throw new Error(`Unrecognized ref type: ${dn}`)}else xt.children.push(en)});const Wt=(Vt,en)=>{const dn=Vt?.value?dt.get(Vt.value.toString()):void 0,yn=en?.value?dt.get(en.value.toString()):void 0;return+(dn?.startTime>yn?.startTime)||+(dn?.startTime===yn?.startTime)-1};return Ze.spans.forEach(Vt=>{const en=tt.get(Vt.spanID);en.children.length>1&&en?.children.sort(Wt)}),xt.children.sort(Wt),xt}function No(Ze){const et=new Map,tt=Ze.reduce((xt,Wt)=>(xt.some(Vt=>Vt.key===Wt.key&&Vt.value===Wt.value)?et.set(`${Wt.key}:${Wt.value}`,`Duplicate tag "${Wt.key}:${Wt.value}"`):xt.push(Wt),xt),[]),dt=Array.from(et.values());return{dedupedTags:tt,warnings:dt}}function Vi(Ze,et){const tt=Ze?.slice()??[],dt=(et||[]).map(xt=>xt.toLowerCase());return tt.sort((xt,Wt)=>{const Vt=xt.key.toLowerCase(),en=Wt.key.toLowerCase();for(let dn=0;dn<dt.length;dn++){const yn=dt[dn];if(Vt.startsWith(yn)&&!en.startsWith(yn))return-1;if(!Vt.startsWith(yn)&&en.startsWith(yn))return 1}return Vt>en?1:Vt<en?-1:0}),tt}function Yo(Ze){if(!Ze?.traceID)return null;const et=Ze.traceID.toLowerCase();let tt=0,dt=Number.MAX_SAFE_INTEGER;const xt=new Map,Wt=new Map;Ze.spans=Ze.spans.filter(Gn=>!!Gn.startTime),Ze.processes=Object.entries(Ze.processes).reduce((Gn,[ta,Sa])=>(Gn[ta]={...Sa,tags:Vi(Sa.tags)},Gn),{});const Vt=Ze.spans.length;for(let Gn=0;Gn<Vt;Gn++){const ta=Ze.spans[Gn],{startTime:Sa,duration:ga,processID:Fa}=ta;let da=ta.spanID;Sa<dt&&(dt=Sa),Sa+ga>tt&&(tt=Sa+ga);const Ua=xt.get(da);Ua!=null?(console.warn(`Dupe spanID, ${Ua+1} x ${da}`,ta,Wt.get(da)),(0,he.isEqual)(ta,Wt.get(da))&&console.warn(" two spans with same ID have `isEqual(...) === true`"),xt.set(da,Ua+1),da=`${da}_${Ua}`,ta.spanID=da):xt.set(da,1),ta.process=Ze.processes[Fa],Wt.set(da,ta)}const en=Di(Ze,Wt),dn=[],yn={};en.walk((Gn,ta,Sa=0)=>{if(Gn==="__root__"||typeof Gn!="string")return;const ga=Wt.get(Gn);if(!ga)return;const{serviceName:Fa}=ga.process;yn[Fa]=(yn[Fa]||0)+1,ga.relativeStartTime=ga.startTime-dt,ga.depth=Sa-1,ga.hasChildren=ta.children.length>0,ga.childSpanCount=ta.children.length,ga.warnings=ga.warnings||[],ga.tags=ga.tags||[],ga.references=ga.references||[],ga.childSpanIds=ta.children.slice().sort((Ua,wa)=>{const va=Wt.get(Ua.value),Ja=Wt.get(wa.value);return Ja.startTime+Ja.duration-(va.startTime+va.duration)}).map(Ua=>Ua.value);const da=No(ga.tags);ga.tags=Vi(da.dedupedTags,Ys("topTagPrefixes")),ga.warnings=ga.warnings.concat(da.warnings),ga.references.forEach((Ua,wa)=>{const va=Wt.get(Ua.spanID);va&&(Ua.span=va,wa>0&&(va.subsidiarilyReferencedBy=va.subsidiarilyReferencedBy||[],va.subsidiarilyReferencedBy.push({spanID:Gn,traceID:et,span:ga,refType:Ua.refType})))}),dn.push(ga)});const Vn=Wr(dn);return{services:Object.keys(yn).map(Gn=>({name:Gn,numberOfSpans:yn[Gn]})),spans:dn,traceID:et,traceName:Vn,processes:Ze.processes,duration:tt-dt,startTime:dt,endTime:tt}}},92102:(Q,A,e)=>{"use strict";e.d(A,{N:()=>t});var t=(n=>(n.Logs="log",n.Traces="trace",n.Metrics="metric",n.Profiles="profile",n.Unknown="unknown",n))(t||{})},92151:(Q,A,e)=>{"use strict";e.d(A,{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 o=e(2543);const s=0;class r{constructor({getBounds:u,tag:c,resetBoundsOnResize:i=!0,...l}){this.resetBounds=()=>{this._bounds=void 0},this._handleMinorMouseEvent=f=>{const{button:d,clientX:h,type:p}=f;if(this._isDragging||d!==s)return;let m=null,a;if(p==="mouseenter")m=n.MouseEnter,a=this._onMouseEnter;else if(p==="mouseleave")m=n.MouseLeave,a=this._onMouseLeave;else if(p==="mousemove")m=n.MouseMove,a=this._onMouseMove;else throw new Error(`invalid event type: ${p}`);if(!a)return;const{value:v,x:E}=this._getPosition(h);a({event:f,type:m,value:v,x:E,manager:this,tag:this.tag})},this._handleDragEvent=f=>{const{button:d,clientX:h,type:p}=f;let m=null,a;if(p==="mousedown"){if(this._isDragging||d!==s)return;window.addEventListener("mousemove",this._handleDragEvent),window.addEventListener("mouseup",this._handleDragEvent);const D=(0,o.get)(document,"body.style");D&&(D.userSelect="none"),this._isDragging=!0,m=n.DragStart,a=this._onDragStart}else if(p==="mousemove"){if(!this._isDragging)return;m=n.DragMove,a=this._onDragMove}else if(p==="mouseup"){if(!this._isDragging)return;this._stopDragging(),m=n.DragEnd,a=this._onDragEnd}else throw new Error(`invalid event type: ${p}`);if(!a)return;const{value:v,x:E}=this._getPosition(h);a({event:f,type:m,value:v,x:E,manager:this,tag:this.tag})},this.handleMouseDown=this._handleDragEvent,this.handleMouseEnter=this._handleMinorMouseEvent,this.handleMouseMove=this._handleMinorMouseEvent,this.handleMouseLeave=this._handleMinorMouseEvent,this.getBounds=u,this.tag=c,this._isDragging=!1,this._bounds=void 0,this._resetBoundsOnResize=!!i,this._resetBoundsOnResize&&window.addEventListener("resize",this.resetBounds),this._onMouseEnter=l.onMouseEnter,this._onMouseLeave=l.onMouseLeave,this._onMouseMove=l.onMouseMove,this._onDragStart=l.onDragStart,this._onDragMove=l.onDragMove,this._onDragEnd=l.onDragEnd}_getBounds(){return this._bounds||(this._bounds=this.getBounds(this.tag)),this._bounds}_getPosition(u){const{clientXLeft:c,maxValue:i,minValue:l,width:f}=this._getBounds();let d=u-c,h=d/f;return l!=null&&h<l?(h=l,d=l*f):i!=null&&h>i&&(h=i,d=i*f),{value:h,x:d}}_stopDragging(){window.removeEventListener("mousemove",this._handleDragEvent),window.removeEventListener("mouseup",this._handleDragEvent);const u=(0,o.get)(document,"body.style");u&&(u.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}}},30700:(Q,A,e)=>{"use strict";e.d(A,{Kv:()=>c,rY:()=>i});var t=e(41811),n=e(84140),o=e(24284);function s(f){if(f.length!==7)return[0,0,0];const d=f.slice(1,3),h=f.slice(3,5),p=f.slice(5);return[parseInt(d,16),parseInt(h,16),parseInt(p,16)]}class r{constructor(d,h){const p=l(d,h);this.colorsHex=p,this.colorsRgb=p.map(s),this.cache=new Map,this.prevColorIndex=void 0}_getColorIndex(d){let h=this.cache.get(d);if(h==null){const p=this.hashCode(d?d.toLowerCase():"");if(h=Math.abs(p%this.colorsHex.length),this.prevColorIndex!==void 0){this.prevColorIndex===h&&(h=this.getNextIndex(h));const m=this.colorsHex[this.prevColorIndex];if(n.A.readability(m,this.colorsHex[h])<1.5){let a=h;for(let v=0;v<this.colorsHex.length;v++)if(a=this.getNextIndex(a),n.A.readability(m,this.colorsHex[a])>1.5){h=a;break}}}this.cache.set(d,h),this.prevColorIndex=h}return h}getNextIndex(d){return d+1<this.colorsHex.length?d+1:0}hashCode(d){let h=0,p,m;for(p=0;p<d.length;p++)m=d.charCodeAt(p),h=(h<<5)-h+m;return h}getColorByKey(d){const h=this._getColorIndex(d);return this.colorsHex[h]}getRgbColorByKey(d){const h=this._getColorIndex(d);return this.colorsRgb[h]}clear(){this.cache.clear()}}const g=(0,t.A)((f,d)=>new r(f,d));function u(f){g([],f)}function c(f,d){return g(o.Tj,d).getColorByKey(f)}function i(f,d){return g(o.Tj,d).getRgbColorByKey(f)}function l(f,d){const h=[...f],p=h.indexOf("#E24D42");p>-1&&h.splice(p,1);const m=f.indexOf("#BF1B00");m>-1&&h.splice(m,1);let a=[];for(const v of h)n.A.readability(d.colors.background.primary,v)>=3&&a.push(v);return a}},6389:(Q,A,e)=>{"use strict";e.d(A,{a3:()=>D});var t=e(2543),n=e.n(t),o=e(84743),s=e.n(o);const r="YYYY-MM-DD",g="HH:mm",u=1e3,c=1e3*u,i=60*c,l=60*i,f=24*l,d=Math.log10(u),h=[{unit:"d",microseconds:f,ofPrevious:24},{unit:"h",microseconds:l,ofPrevious:60},{unit:"m",microseconds:i,ofPrevious:60},{unit:"s",microseconds:c,ofPrevious:1e3},{unit:"ms",microseconds:u,ofPrevious:1e3},{unit:"\u03BCs",microseconds:1,ofPrevious:1e3}],p=(b,C,y)=>toFloatPrecision(b/y,C)*y;function m(b){return moment(b/u).format(r)}function a(b){return moment(b/u).format(g)}function v(b){const C=p(b,d,u);return`${moment.duration(C/u).asMilliseconds()}ms`}function E(b){const C=p(b,d,c);return`${moment.duration(C/u).asSeconds()}s`}function D(b){const[C,y]=(0,t.dropWhile)(h,({microseconds:S},O)=>O<h.length-1&&S>b);if(C.ofPrevious===1e3)return`${(0,t.round)(b/C.microseconds,2)}${C.unit}`;const T=`${Math.floor(b/C.microseconds)}${C.unit}`,I=Math.round(b/y.microseconds%C.ofPrevious),x=`${I}${y.unit}`;return I===0?T:`${T} ${x}`}},28114:(Q,A,e)=>{"use strict";e.d(A,{Cr:()=>I,QW:()=>p,_o:()=>C,gt:()=>M,hv:()=>T,i0:()=>h,lU:()=>l});var t=e(96540),n=e(6709),o=e(65879),s=e(47232),r=e(72574),g=e(14578),u=e(31193),c=e(96192),i=e(92102);function l({splitOpenFn:x,traceToLogsOptions:S,traceToMetricsOptions:O,traceToProfilesOptions:P,dataFrame:L,createFocusSpanLink:U,trace:R}){if(!L)return;let B=M(R.duration,R.traceName,R.traceID);const H=L.fields.some(N=>!!N.config.links?.length),w=m(x,L.fields[0],S,O,U,B);return function(V){let G=w(V);if(H){B={...B,...T(V),...I(V,P)};const _=L.fields.filter(K=>!!K.config.links?.length);try{let K;P?.datasourceUid&&(K=(0,u.tR)().getInstanceSettings(P.datasourceUid));const j=K?.type==="grafana-pyroscope-datasource",k=V.tags.some(J=>J.key===p),Y=j&&k;let ee=[];_.forEach(J=>{const ne=(0,c.QL)({field:J,rowIndex:V.dataFrameRowIndex,splitOpenFn:x,range:y(V,void 0,void 0,Y),dataFrame:L,vars:B});ee=ee.concat(ne)});const re=ee.map(J=>({title:J.title,href:J.href,onClick:J.onClick,content:t.createElement(g.I,{name:"link",title:J.title||"Link"}),field:J.origin,type:Y?i.N.Profiles:i.N.Unknown}));G.push.apply(G,re)}catch(K){return console.error(K),G}}return G}}const f=x=>x.map(S=>({key:S,value:S.includes(".")?S.replace(".","_"):void 0})),d=f(["cluster","hostname","namespace","pod","service.name","service.namespace"]),h=f(["service.name","service.namespace"]),p="pyroscope.profile.id";function m(x,S,O,P,L,U){let R;O?.datasourceUid&&(R=(0,u.tR)().getInstanceSettings(O.datasourceUid));const B=R?.type==="grafana-splunk-datasource";let H;return P?.datasourceUid&&(H=(0,u.tR)().getInstanceSettings(P.datasourceUid)),function(N){U={...U,...T(N)};const V=[];let G,_="";if(R&&O){const K=O.customQuery?O.query:void 0,j=O.tags&&O.tags.length>0?O.tags:d;switch(R?.type){case"loki":_=C(N,j),G=a(N,O,_,K);break;case"grafana-splunk-datasource":_=C(N,j,{joinBy:" "}),G=E(N,O,_,K);break;case"elasticsearch":case"grafana-opensearch-datasource":_=C(N,j,{labelValueSign:":",joinBy:" AND "}),G=v(N,O,_,K);break;case"grafana-falconlogscale-datasource":_=C(N,j,{joinBy:" OR "}),G=b(N,O,_,K);break;case"googlecloud-logging-datasource":_=C(N,j,{joinBy:" AND "}),G=D(N,O,_,K)}if(G){const k={title:R.name,url:"",internal:{datasourceUid:R.uid,datasourceName:R.name,query:G}};if(U={...U,__tags:{text:"Tags",value:_}},(0,c.O1)(k.internal.query,U).allVariablesDefined){const Y=(0,n.u)({link:k,internalLink:k.internal,scopedVars:U,range:y(N,{startMs:O.spanStartTimeShift?o.intervalToMs(O.spanStartTimeShift):0,endMs:O.spanEndTimeShift?o.intervalToMs(O.spanEndTimeShift):0},B),field:{},onClickFn:x,replaceVariables:(0,r.w)().replace.bind((0,r.w)())});V.push({href:Y.href,title:"Related logs",onClick:Y.onClick,content:t.createElement(g.I,{name:"gf-logs",title:"Explore the logs for this in split view"}),field:S,type:i.N.Logs})}}}if(H&&P?.queries)for(const K of P.queries){const j=K.query||`histogram_quantile(0.5, sum(rate(traces_spanmetrics_latency_bucket{service="${N.process.serviceName}"}[5m])) by (le))`,k={title:H.name,url:"",internal:{datasourceUid:H.uid,datasourceName:H.name,query:{expr:j,refId:"A"}}},Y=P.tags&&P.tags.length>0?P.tags:d;U={...U,__tags:{text:"Tags",value:C(N,Y)}};const ee=(0,n.u)({link:k,internalLink:k.internal,scopedVars:U,range:y(N,{startMs:P.spanStartTimeShift?o.intervalToMs(P.spanStartTimeShift):-12e4,endMs:P.spanEndTimeShift?o.intervalToMs(P.spanEndTimeShift):12e4}),field:{},onClickFn:x,replaceVariables:(0,r.w)().replace.bind((0,r.w)())});V.push({title:K?.name,href:ee.href,onClick:ee.onClick,content:t.createElement(g.I,{name:"chart-line",title:"Explore metrics for this span"}),field:S,type:i.N.Metrics})}if(N.references&&L)for(const K of N.references){if(K.refType==="CHILD_OF")continue;const j=L(K.traceID,K.spanID);V.push({href:j.href,title:K.span?K.span.operationName:"View linked span",content:t.createElement(g.I,{name:"link",title:"View linked span"}),onClick:j.onClick,field:j.origin,type:i.N.Traces})}if(N.subsidiarilyReferencedBy&&L)for(const K of N.subsidiarilyReferencedBy){const j=L(K.traceID,K.spanID);V.push({href:j.href,title:K.span?K.span.operationName:"View linked span",content:t.createElement(g.I,{name:"link",title:"View linked span"}),onClick:j.onClick,field:j.origin,type:i.N.Traces})}return V}}function a(x,S,O,P){const{filterByTraceID:L,filterBySpanID:U}=S;if(P)return{expr:P,refId:""};if(!O)return;let R="{${__tags}}";return L&&x.traceID&&(R+=' |="${__span.traceId}"'),U&&x.spanID&&(R+=' |="${__span.spanId}"'),{expr:R,refId:""}}function v(x,S,O,P){const{filterByTraceID:L,filterBySpanID:U}=S;if(P)return{query:P,refId:"",metrics:[{id:"1",type:"logs"}]};let R=[];return U&&x.spanID&&R.push('"${__span.spanId}"'),L&&x.traceID&&R.push('"${__span.traceId}"'),O&&R.push("${__tags}"),{query:R.join(" AND "),refId:"",metrics:[{id:"1",type:"logs"}]}}function E(x,S,O,P){const{filterByTraceID:L,filterBySpanID:U}=S;if(P)return{query:P,refId:""};let R="";return O&&(R+="${__tags}"),L&&x.traceID&&(R+=' "${__span.traceId}"'),U&&x.spanID&&(R+=' "${__span.spanId}"'),{query:R,refId:""}}function D(x,S,O,P){const{filterByTraceID:L,filterBySpanID:U}=S;if(P)return{query:P,refId:""};let R=[];return U&&x.spanID&&R.push('"${__span.spanId}"'),L&&x.traceID&&R.push('"${__span.traceId}"'),O&&R.push("${__tags}"),{query:R.join(" AND "),refId:""}}function b(x,S,O,P){const{filterByTraceID:L,filterBySpanID:U}=S;if(P)return{lsql:P,refId:""};if(!O)return;let R="${__tags}";return L&&x.traceID&&(R+=' or "${__span.traceId}"'),U&&x.spanID&&(R+=' or "${__span.spanId}"'),{lsql:R,refId:""}}function C(x,S,{labelValueSign:O="=",joinBy:P=", "}={}){return[...x.process.tags,...x.tags,{key:"spanId",value:x.spanID},{key:"traceId",value:x.traceID},{key:"name",value:x.operationName},{key:"duration",value:x.duration}].map(L=>{const U=S.find(R=>R.key===L.key);if(U)return`${U.value?U.value:U.key}${O}"${L.value}"`}).filter(L=>!!L).join(P)}function y(x,S={startMs:0,endMs:0},O=!1,P=!1){let L=Math.floor(x.startTime/1e3+S.startMs);const U=(x.startTime+x.duration)/1e3;let R=Math.floor(U+S.endMs);O&&R-L<1e3?R=L+1e3:P?(L=L-6e4,R=R+6e4):L===R&&R++;const B=(0,s.KQ)(R),H=(0,s.KQ)(L);return{from:H,to:B,raw:{from:H,to:B}}}function M(x,S,O){return{__trace:{text:"Trace",value:{duration:x,name:S,traceId:O}}}}function T(x){const S={};for(const O of x.process.tags)S[O.key]=O.value;for(const O of x.tags)S[O.key]=O.value;return{__span:{text:"Span",value:{spanId:x.spanID,traceId:x.traceID,duration:x.duration,name:x.operationName,tags:S}}}}function I(x,S){let O={};if(S){const P=S.tags&&S.tags.length>0?S.tags:h;O={__tags:{text:"Tags",value:C(x,P)}}}return O}},15583:(Q,A,e)=>{"use strict";e.d(A,{Ji:()=>g,SQ:()=>u,zE:()=>s});var t=e(96540),n=e(62938),o=e(50248);const s=()=>(0,n.A)().slice(0,12),g={spanNameOperator:"=",serviceNameOperator:"=",fromOperator:">",toOperator:"<",tags:[{id:s(),operator:"="}]};function u(c){const[i,l]=(0,t.useState)(g),f=(0,t.useMemo)(()=>c&&(0,o.filterSpans)(i,c),[i,c]);return{search:i,setSearch:l,spanFilterMatches:f}}},35090:(Q,A,e)=>{"use strict";e.d(A,{L:()=>o});var t=e(78368),n=e(50248);function o(r){if(!r)return null;let g=r.fields.length===1?r.fields[0].values[0]:s(r);return g?(0,n.transformTraceData)(g):null}function s(r){const g=new t.R(r),u={};for(let c=0;c<g.length;c++){const i=g.get(c);if(!i.spanID)return null;u[i.spanID]||(u[i.spanID]={serviceName:i.serviceName,tags:i.serviceTags})}return{traceID:g.get(0).traceID,processes:u,spans:g.toArray().map((c,i)=>{const l=[];return c.parentSpanID&&l.push({refType:"CHILD_OF",spanID:c.parentSpanID,traceID:c.traceID}),c.references&&l.push(...c.references.map(f=>({refType:"FOLLOWS_FROM",...f}))),{...c,duration:c.duration*1e3,startTime:c.startTime*1e3,processID:c.spanID,flags:0,references:l,logs:c.logs?.map(f=>({...f,timestamp:f.timestamp*1e3}))||[],dataFrameRowIndex:i}})}}},11140:(Q,A,e)=>{"use strict";e.d(A,{v:()=>U});var t=e(2543),n=e(96540),o=e(49785),s=e(71733),r=e(14110),g=e(12131),u=e(32264),c=e(16504),i=e(88575),l=e(94354),f=e(42418),d=e(37390),h=e(55852),p=e(59429),m=e(16233),a=e(79999),v=e(80348),E=e(9955),D=e(27677),b=e(71176),C=(R=>(R.FETCH_DASHBOARD="fetch-dashboard",R.SET_DASHBOARD_LS="set-dashboard-ls-error",R))(C||{});function y(R,B){let H=[];return R==="table"&&B.panelState?.logs?.columns&&(B.panelState.logs?.labelFieldName&&H.push({id:"extractFields",options:{source:B.panelState.logs.labelFieldName}}),H.push({id:"organize",options:{indexByName:Object.values(B.panelState.logs.columns).reduce((w,N,V)=>({...w,[N]:V}),{}),includeByName:Object.values(B.panelState.logs.columns).reduce((w,N)=>({...w,[N]:!0}),{})}})),H}async function M(R){const B=x(R.queries,R.queryResponse,R?.panelState),H={targets:R.queries,type:B,title:"New Panel",gridPos:{x:0,y:0,w:12,h:8},datasource:R.datasource,transformations:y(B,R)};let w;if(R.dashboardUid)try{w=await D.IB.getDashboardByUid(R.dashboardUid)}catch{throw"fetch-dashboard"}else w=(0,b.X)();w.dashboard.panels=[H,...w.dashboard.panels??[]],w.dashboard.time=R.time;try{(0,a.OI)(w)}catch{throw"set-dashboard-ls-error"}}const T=R=>!R.hide,I=R=>B=>B.refId===R;function x(R,B,H){for(const{refId:w}of R.filter(T)){const N=I(w);if(B.flameGraphFrames.some(N))return"flamegraph";if(B.graphFrames.some(N))return"timeseries";if(B.logsFrames.some(N))return H?.logs?.visualisationType?H.logs.visualisationType:"logs";if(B.nodeGraphFrames.some(N))return"nodeGraph";if(B.traceFrames.some(N))return"traces";if(B.customFrames.some(N))return B.customFrames.find(N)?.meta?.preferredVisualisationPluginId??"table"}return"table"}var S=(R=>(R.NewDashboard="new-dashboard",R.ExistingDashboard="existing-dashboard",R))(S||{});function O(R){}function P(R){return R?`d/${R}`:"dashboard/new"}var L=(R=>(R.UNKNOWN="unknown-error",R.NAVIGATION="navigation-error",R))(L||{});function U(R){const{exploreId:B,onClose:H}=R,w=(0,v.useSelector)((0,E.qq)(B)),[N,V]=(0,n.useState)(),{handleSubmit:G,control:_,formState:{errors:K},watch:j}=(0,o.mN)({defaultValues:{saveTarget:"new-dashboard"}}),k=m.TP.hasPermission(v.AccessControlAction.DashboardsCreate),Y=m.TP.hasPermission(v.AccessControlAction.DashboardsWrite),ee=[];k&&ee.push({label:"New dashboard",value:"new-dashboard"}),Y&&ee.push({label:"Existing dashboard",value:"existing-dashboard"});const re=ee.length>1?j("saveTarget"):ee[0].value,J=async(ne,q)=>{V(void 0);const te=q.saveTarget==="existing-dashboard"?q.dashboardUid:void 0;(0,r.rR)("e_2_d_submit",{newTab:ne,saveTarget:q.saveTarget,queries:w.queries.length});const{from:oe,to:ue}=w.range.raw;try{await M({dashboardUid:te,datasource:w.datasourceInstance?.getRef(),queries:w.queries,queryResponse:w.queryResponse,panelState:w?.panelsState,time:{from:typeof oe=="string"?oe:oe.toISOString(),to:typeof ue=="string"?ue:ue.toISOString()}})}catch(he){switch(he){case C.FETCH_DASHBOARD:V({error:he,message:"Could not fetch dashboard information. Please try again."});break;case C.SET_DASHBOARD_LS:V({error:he,message:"Could not add panel to dashboard. Please try again."});break;default:V({error:"unknown-error",message:"Something went wrong. Please try again."})}return}const ie=P(te);if(!ne){H(),g.Ny.push(s.I.stripBaseFromUrl(ie));return}if(!!!e.g.open(u.$.appUrl+ie,"_blank")){V({error:"navigation-error",message:"Could not navigate to the selected dashboard. Please try again."}),(0,a.yZ)();return}H()};return(0,n.useEffect)(()=>{(0,r.rR)("e_2_d_open")},[]),n.createElement("form",null,ee.length>1&&n.createElement(c.e,{control:_,render:({field:{ref:ne,...q}})=>n.createElement(i.D,{label:"Target dashboard",description:"Choose where to add the panel."},n.createElement(l.z,{options:ee,...q,id:"e2d-save-target"})),name:"saveTarget"}),re==="existing-dashboard"&&(()=>n.createElement(c.e,{render:({field:{ref:ne,value:q,onChange:te,...oe}})=>n.createElement(i.D,{label:"Dashboard",description:"Select in which dashboard the panel will be created.",error:K.dashboardUid?.message,invalid:!!K.dashboardUid},n.createElement(p.b,{...oe,inputId:"e2d-dashboard-picker",defaultOptions:!0,onChange:ue=>te(ue?.uid)})),control:_,name:"dashboardUid",shouldUnregister:!0,rules:{required:{value:!0,message:"This field is required."}}}))(),N&&n.createElement(f.F,{severity:"error",title:"Error adding the panel"},N.message),n.createElement(d.a.ButtonRow,null,n.createElement(h.$n,{type:"reset",onClick:H,fill:"outline",variant:"secondary"},"Cancel"),n.createElement(h.$n,{type:"submit",variant:"secondary",onClick:G((0,t.partial)(J,!0)),icon:"external-link-alt"},"Open in new tab"),n.createElement(h.$n,{type:"submit",variant:"primary",onClick:G((0,t.partial)(J,!1)),icon:"apps"},"Open dashboard")))}},12881:(Q,A,e)=>{"use strict";e.d(A,{t:()=>o});var t=e(16233),n=e(80348);function o(){const s=t.TP.hasPermission(n.AccessControlAction.DashboardsCreate),r=t.TP.hasPermission(n.AccessControlAction.DashboardsWrite);return s&&!r?"Add panel to new dashboard":r&&!s?"Add panel to existing dashboard":"Add panel to dashboard"}},24401:(Q,A,e)=>{"use strict";e.d(A,{s:()=>u});var t=e(96540),n=e(71733),o=e(12131),s=e(37390),r=e(66864),g=e(55852);function u(c){const{onDismiss:i,path:l,title:f}=c,d=()=>{e.g.open(n.I.assureBaseUrl(l),"_blank"),i()},h=()=>o.Ny.push(l);return t.createElement(s.a,{title:f,isOpen:!0,onDismiss:i},t.createElement(r.gW,{spacing:"sm"},t.createElement("p",null,"Do you want to proceed in the current tab or open a new tab?")),t.createElement(s.a.ButtonRow,null,t.createElement(g.$n,{onClick:i,fill:"outline",variant:"secondary"},"Cancel"),t.createElement(g.$n,{type:"submit",variant:"secondary",onClick:d,icon:"external-link-alt"},"Open in new tab"),t.createElement(g.$n,{type:"submit",variant:"primary",onClick:h,icon:"apps"},"Open")))}},30973:(Q,A,e)=>{"use strict";e.d(A,{w:()=>s});var t=e(96540),n=e(38138),o=e(75462);function s({extensions:u,onSelect:c}){const{categorised:i,uncategorised:l}=g(u),f=l.length>0&&Object.keys(i).length>0;return t.createElement(n.W,null,t.createElement(t.Fragment,null,Object.keys(i).map(d=>t.createElement(n.W.Group,{key:d,label:(0,o.pL)(d,25)},r(i[d],c))),f&&t.createElement(n.W.Divider,{key:"divider"}),r(l,c)))}function r(u,c){return u.map(i=>t.createElement(n.W.Item,{ariaLabel:i.title,icon:i?.icon||"plug",key:i.id,label:(0,o.pL)(i.title,25),onClick:l=>{if(i.path)return c(i);i.onClick?.(l)}}))}function g(u){return(0,t.useMemo)(()=>{const c=[],i={};for(const l of u){if(!l.category){c.push(l);continue}Array.isArray(i[l.category])||(i[l.category]=[]),i[l.category].push(l)}return{uncategorised:c,categorised:i}},[u])}},33368:(Q,A,e)=>{"use strict";e.d(A,{h:()=>o});var t=e(96540),n=e(96192);const o=(s,r)=>(0,t.useMemo)(()=>(0,n.YV)(s,r),[s,r])},80252:(Q,A,e)=>{"use strict";e.d(A,{m:()=>j,s:()=>H});var t=e(2543),n=e(96540),o=e(18226),s=e(41987),r=e(39070),g=e(76885),u=e(76888),c=e(3169),i=e(87490),l=e(31193),f=e(14678),d=e(80348),h=e(62860),p=e(62256),m=e(29436),a=e(23994),v=e(9955),E=e(89224),D=e(34028),b=e(27649),C=e(15961);const y={parse:Y=>{if(!Y.left&&!Y.right)return{to:{left:{datasource:null,queries:[],range:{from:D.kn.from,to:D.kn.to}},schemaVersion:0},error:!1};let ee,re,J,ne;return typeof Y.left=="string"&&([ee,J]=x(Y.left)),typeof Y.right=="string"?[re,ne]=x(Y.right):Y.right&&(re=I,ne=!0),ee||(ee=I),{to:{schemaVersion:0,left:ee,...re&&{right:re}},error:!!J||!!ne}}},M=(Y,...ee)=>ee.some(re=>Y.hasOwnProperty(re));var T=(Y=>(Y[Y.RangeFrom=0]="RangeFrom",Y[Y.RangeTo=1]="RangeTo",Y[Y.Datasource=2]="Datasource",Y[Y.SegmentsStart=3]="SegmentsStart",Y))(T||{});const I={datasource:null,queries:[],range:D.kn};function x(Y){let ee;try{ee=JSON.parse(Y)}catch{return[I,!0]}if(!Array.isArray(ee))return[{queries:[],range:D.kn,...ee},!1];if(ee.length<=3)return[I,!0];const re={from:ee[0],to:ee[1]},J=ee[2],ne=ee.slice(3),q=ne.filter(oe=>!M(oe,"ui","mode","__panelsState")),te=ne.find(oe=>M(oe,"__panelsState"))?.__panelsState;return[{datasource:J,queries:q,range:re,panelsState:te},!1]}const S={parse:Y=>{if(!Y||!Y.panes||typeof Y.panes!="string")return{to:{schemaVersion:1,panes:{[(0,i.o$)()]:O}},error:!1};let ee;try{ee=JSON.parse(Y.panes)}catch{}if(ee==null||typeof ee!="object")return{to:{schemaVersion:1,panes:{[(0,i.o$)()]:O}},error:!0};const re=Object.entries(ee).map(([J,ne])=>[J,P(ne)]).reduce((J,[ne,q])=>{let te=ne;return(te.length!==3||/^\d+$/.test(te)||te.split("").some(oe=>i.WP.indexOf(oe)===-1))&&(te=(0,i.o$)()),{...J,[te]:q}},{});return Object.keys(re).length||(re[(0,i.o$)()]=O),{to:{schemaVersion:1,panes:re},error:!1}},migrate:Y=>({schemaVersion:1,panes:{[(0,i.o$)()]:Y.left,...Y.right&&{[(0,i.o$)()]:Y.right}}})},O={datasource:null,queries:[],range:D.kn};function P(Y){return!Y||typeof Y!="object"?O:{...O,...(0,C.C)("queries",Y)&&Array.isArray(Y.queries)&&{queries:Y.queries},...(0,C.C)("datasource",Y)&&typeof Y.datasource=="string"&&{datasource:Y.datasource},...(0,C.C)("panelsState",Y)&&!!Y.panelsState&&typeof Y.panelsState=="object"&&{panelsState:Y.panelsState},...(0,C.C)("range",Y)&&!!Y.range&&typeof Y.range=="object"&&(0,C.C)("from",Y.range)&&(0,C.C)("to",Y.range)&&typeof Y.range.from=="string"&&typeof Y.range.to=="string"&&{range:{from:Y.range.from,to:Y.range.to}}}}const L=Y=>R(Y),U=[y,S],R=Y=>{const ee=B(Y),[re,...J]=U.slice(ee),{error:ne,to:q}=re.parse(Y);return[J.reduce((oe,ue)=>ue.migrate?ue.migrate(oe):oe,q),ne]};function B(Y){return!Y||!("schemaVersion"in Y)||!Y.schemaVersion?0:typeof Y.schemaVersion=="number"?Y.schemaVersion:typeof Y.schemaVersion=="string"?Number.parseInt(Y.schemaVersion,10):0}function H(Y){const{location:ee}=(0,u.Il)(),re=(0,d.useDispatch)(),J=(0,d.useSelector)(v.Qb),ne=(0,d.useSelector)(ie=>ie.user.orgId),q=(0,n.useRef)(Y),te=(0,n.useRef)("notstarted"),oe=(0,n.useRef)(!1),{warning:ue}=(0,c._2)();(0,n.useEffect)(()=>{Y.panes||(te.current="notstarted",q.current=Y)},[Y]),(0,n.useEffect)(()=>{const ie=re((0,d.addListener)({predicate:ge=>(oe.current=h.wh.pending.type===ge.type,[m.J8.type,m.ve.fulfilled.type,a.Od.pending.type,E.eM.type,p.fx.type,h.wh.fulfilled.type].includes(ge.type)&&!oe.current),effect:async(ge,{cancelActiveListeners:he,delay:De,getState:pe})=>{he(),await De(200);const le=Object.entries(pe().explore.panes).reduce((Te,[Ee,Re])=>Re?{...Te,[Ee]:j(Re)}:Te,{});if(!(0,t.isEqual)(q.current.panes,JSON.stringify(le))){const Te=!!q.current.panes&&Object.values(q.current.panes).filter(Boolean).length===0||te.current==="pending";q.current={panes:JSON.stringify(le)},ee.partial({panes:q.current.panes},Te)}}}));return()=>ie()},[re,ee]),(0,n.useEffect)(()=>{const ie=q.current?.panes!==Y.panes,[ge,he]=L(Y);he&&ue("Could not parse Explore URL","The requested URL contains invalid parameters, a default Explore state has been loaded.");async function De(){const pe=Object.values(ge.panes);if(pe.length>1){const le=pe.some(({range:Te},Ee,[{range:Re}])=>!(0,t.isEqual)(Te,Re));re((0,m.qz)({syncedTimes:!le}))}Object.entries(ge.panes).forEach(async([le,Te],Ee)=>{const{datasource:Re,queries:me,range:Me,panelsState:ye}=Te,Le=J[le];if(Le!==void 0){const We=K(Te,j(Le));Promise.resolve().then(async()=>{We.datasource&&Re&&await re((0,h.wh)({exploreId:le,datasource:Re}))}).then(async()=>{We.range&&re((0,E.JA)({exploreId:le,rawRange:(0,D.Z9)(Me)})),We.queries&&re((0,a.h9)({exploreId:le,queries:(0,b.v)(me)})),(We.queries||We.range)&&(await re((0,a.hS)(le)),re((0,a.Od)({exploreId:le}))),We.panelsState&&ye&&re((0,p.fx)({exploreId:le,panelsState:ye}))})}else re((0,p.Gd)({exploreId:le,datasource:Re||"",queries:(0,b.v)(me),range:(0,D.Z9)(Me),panelsState:ye,position:Ee,eventBridge:new o.o}))}),Object.keys(J).filter(le=>!Object.keys(ge.panes).includes(le)).forEach(le=>re((0,m.J8)(le)))}!ie&&te.current==="notstarted"&&(te.current="pending",re((0,m.Ve)()),Promise.all(Object.entries(ge.panes).map(([pe,{datasource:le,queries:Te,range:Ee,panelsState:Re}])=>_(le,Te,ne).then(me=>Promise.resolve(me?Te.length?(0,b.v)(Te).filter(V(me)).map(N(me)?t.identity:Me=>({...Me,datasource:me.getRef()})):(0,l.tR)().get(N(me)?void 0:me.getRef()).then(Me=>[w(Me)]):[]).then(async Me=>{let ye=await G(Me);return!ye.length&&me&&(ye=[w(N(me)?await(0,l.tR)().get():me)]),{exploreId:pe,range:Ee,panelsState:Re,queries:ye,datasource:me}})))).then(async pe=>{const le=await Promise.all(pe.map(({exploreId:Me,range:ye,panelsState:Le,queries:We,datasource:Be})=>re((0,p.Gd)({exploreId:Me,datasource:Be,queries:We,range:(0,D.Z9)(ye),panelsState:Le,eventBridge:new o.o})).unwrap()));if(le.length>1){const Me=le.some(({state:ye},Le,[{state:We}])=>!(0,t.isEqual)(ye.range.raw,We.range.raw));re((0,m.qz)({syncedTimes:!Me}))}const Te=le.reduce((Me,{exploreId:ye,state:Le})=>({...Me,[ye]:j(Le)}),{}),Ee=ee.getSearchObject();let Re={};for(const[Me,ye]of Object.entries(Ee).filter(([Le])=>!["schemaVersion","panes","orgId","left","right"].includes(Le)))Re[Me]=ye;const me=new URLSearchParams({schemaVersion:`${ge.schemaVersion}`,panes:JSON.stringify(Te),orgId:`${ne}`,...Re});ee.replace({pathname:ee.getLocation().pathname,search:me.toString()}),te.current="done"})),q.current=Y,ie&&te.current==="done"&&De()},[re,J,ne,ee,Y,ue])}function w(Y){return{...Y.getDefaultQuery?.(s.Jk.Explore),refId:"A",datasource:Y.getRef()}}function N(Y){return Y.name===f.uv}function V(Y){return Y&&N(Y)?ee=>!!ee.datasource:ee=>ee.datasource?typeof ee.datasource=="string"?ee.datasource===Y?.uid||ee.datasource===Y?.name:ee.datasource.uid===Y?.uid:!0}async function G(Y){return(await Promise.allSettled(Y.map(re=>(0,l.tR)().get(re.datasource).then(J=>({query:re,ds:J}))))).filter(C.s).map(({value:re})=>re.query)}async function _(Y,ee,re){if(Y)try{return await(0,l.tR)().get(Y)}catch{}const J=[...new Set(ee.map(ne=>ne.datasource).filter(r.zz).map(ne=>typeof ne=="string"?ne:ne.uid))];try{if(J.length>=1){const ne=(await Promise.allSettled(J.map(q=>(0,l.tR)().get(q)))).filter(C.s);if(ne.length>1)return await(0,l.tR)().get(f.uv);if(ne.length===1)return await(0,l.tR)().get(J[0])}}catch{}return(0,l.tR)().get((0,i.HQ)(re)).catch(()=>(0,l.tR)().get()).catch(()=>{})}const K=(Y,ee)=>{const re=!(0,t.isEqual)(ee?.datasource,Y?.datasource),J=!(0,t.isEqual)(ee?.queries,Y?.queries),ne=!(0,t.isEqual)(ee?.range||D.kn,Y?.range||D.kn),q=!(0,t.isEqual)(ee?.panelsState,Y?.panelsState);return{datasource:re,queries:J,range:ne,panelsState:q}};function j(Y){return{datasource:Y.datasourceInstance?.uid||"",queries:Y.queries.map(i.w4),range:(0,g.sQ)(Y.range.raw),panelsState:k(Y.panelsState)}}function k(Y){let ee=(0,t.mapValues)(Y,re=>(0,t.isObject)(re)?k(re):re);if(ee=(0,t.omitBy)(ee,t.isEmpty),!(0,t.isEmpty)(ee))return ee}},15961:(Q,A,e)=>{"use strict";e.d(A,{C:()=>n,s:()=>t});const t=o=>o.status==="fulfilled";function n(o,s){return o in s}},324:(Q,A,e)=>{"use strict";e.d(A,{M:()=>f,v:()=>h});var t=e(88483),n=e(19347),o=e(14110),s=e(82467),r=e(3169),g=e(18380),u=e(99140),c=e(62256),i=e(29436),l=e(23994);const f=p=>new t.c(m=>{const a=u.M_.getState().explore.panes[p]?.correlations;if(a)m.next(a),m.complete();else{const v=u.M_.subscribe(()=>{const E=u.M_.getState().explore.panes[p]?.correlations;E&&(v(),m.next(E),m.complete())})}});function d(p){return async(m,a)=>{const v=a().explore.panes[p];if(v.datasourceInstance?.uid!==void 0){let E=v.datasourceInstance.meta.mixed?v.queries.map(b=>b.datasource?.uid).filter(b=>b!==null):[v.datasourceInstance.uid];const D=await(0,g.J6)(E);m((0,c.Fb)({exploreId:p,correlations:D.correlations||[]}))}}}function h(p,m,a){return async(v,E)=>{const D=Object.keys(E().explore?.panes),b=E().explore?.panes[D[0]],C=E().explore?.panes[D[1]];if(!b||!C)return;const y=b.datasourceInstance?.meta.mixed?b.queries[0].datasource:b.datasourceInstance?.getRef(),M=C.datasourceInstance?.meta.mixed?C.queries[0].datasource:C.datasourceInstance?.getRef(),[T,I]=await Promise.all([(0,n.l)().get(y),(0,n.l)().get(M)]);if(T?.uid&&I?.uid&&C.correlationEditorHelperData?.resultField){const x={sourceUID:T.uid,targetUID:I.uid,label:p||await(0,g.tZ)(b,C),description:m,config:{field:C.correlationEditorHelperData.resultField,target:C.queries[0],type:"query",transformations:a}};await(0,g.$q)(T.uid,x).then(async()=>{v((0,i.J8)(D[1])),await v(d(D[0])),await v((0,l.Od)({exploreId:D[0]})),(0,o.rR)("grafana_explore_correlation_editor_saved",{sourceDatasourceType:T.type,targetDataSourceType:I.type})}).catch(S=>{v((0,s.dx)((0,r.gi)("Error creating correlation",S))),console.error(S)})}}}},62860:(Q,A,e)=>{"use strict";e.d(A,{YR:()=>p,wh:()=>h});var t=e(30038),n=e(14110),o=e(11134),s=e(87490),r=e(18380),g=e(80348),u=e(57288),c=e(62256),i=e(23994),l=e(89224),f=e(34028);const d=(0,t.VP)("explore/updateDatasourceInstance"),h=(0,g.createAsyncThunk)("explore/changeDatasource",async({datasource:m,exploreId:a,options:v},{getState:E,dispatch:D})=>{const b=E().user.orgId,{history:C,instance:y}=await(0,f.BE)(b,m),M=E().explore.panes[a].datasourceInstance;(0,n.rR)("explore_change_ds",{from:(M?.meta?.mixed?"mixed":M?.type)||"unknown",to:y.meta.mixed?"mixed":y.type,exploreId:a}),D(d({exploreId:a,datasourceInstance:y,history:C}));const T=E().explore.panes[a].queries,I=(0,f.dq)(y.uid,T),x=await(0,r.J6)(I);D((0,c.Fb)({exploreId:a,correlations:x.correlations||[]})),v?.importQueries&&await D((0,i.y2)(a,T,M,y)),E().explore.panes[a].isLive&&D((0,l.hO)({exploreId:a,refreshInterval:o.cC.offOption.value})),v?.importQueries&&D((0,i.Od)({exploreId:a}))}),p=(m,a)=>{if(d.match(a)){const{datasourceInstance:v,history:E}=a.payload;return(0,s._u)(m.querySubscription),{...m,datasourceInstance:v,graphResult:null,tableResult:null,logsResult:null,supplementaryQueries:(0,u.Ez)(),queryResponse:(0,f.RA)(),queryKeys:[],history:E}}return m}},62256:(Q,A,e)=>{"use strict";e.d(A,{EA:()=>p,Fb:()=>E,Gd:()=>b,LJ:()=>C,QZ:()=>D,fx:()=>h,nE:()=>m});var t=e(30038),n=e(87490),o=e(18380),s=e(32901),r=e(80348),g=e(62860),u=e(72433),c=e(29436),i=e(23994),l=e(89224),f=e(34028);const d=(0,t.VP)("explore/changeSize"),h=(0,t.VP)("explore/changePanels");function p(y,M,T){return async(I,x)=>{const S=x().explore.panes[y];if(S===void 0)return;const{panelsState:O}=S;I(h({exploreId:y,panelsState:{...O,[M]:T}}))}}const m=(0,t.VP)("explore/changeCorrelationHelperData"),a=(0,t.VP)("explore/initializeExploreAction"),v=(0,t.VP)("explore/setUrlReplaced"),E=(0,t.VP)("explore/saveCorrelationsAction");function D(y,{width:M}){return d({exploreId:y,width:M})}const b=(0,r.createAsyncThunk)("explore/initializeExplore",async({exploreId:y,datasource:M,queries:T,range:I,panelsState:x,correlationHelperData:S,eventBridge:O},{dispatch:P,getState:L,fulfillWithValue:U})=>{let R,B=[];if(M){const H=L().user.orgId,w=await(0,f.BE)(H,M);R=w.instance,B=w.history}if(P(a({exploreId:y,queries:T,range:(0,f.eO)(I,(0,s.O)(L().user)),datasourceInstance:R,history:B,eventBridge:O})),x!==void 0&&P(h({exploreId:y,panelsState:x})),P((0,l.JA)({exploreId:y})),R){const H=(0,f.dq)(R.uid,T),w=await(0,o.J6)(H);P(E({exploreId:y,correlations:w.correlations||[]})),P((0,i.Od)({exploreId:y}))}return S!==void 0&&L().explore.correlationEditorDetails?.editorMode&&P(m({exploreId:y,correlationEditorHelperData:S})),U({exploreId:y,state:L().explore.panes[y]})}),C=(y=(0,f.HZ)(),M)=>{if(y=(0,i.JQ)(y,M),y=(0,g.YR)(y,M),y=(0,l.QP)(y,M),y=(0,u.t0)(y,M),c.U2.match(M)){const{richHistory:T,total:I}=M.payload.richHistoryResults;return{...y,richHistory:T,richHistoryTotal:I}}if(c.Ju.match(M)){const T=M.payload.filters;return{...y,richHistorySearchFilters:T}}if(d.match(M)){const T=M.payload.width;return{...y,containerWidth:T}}if(h.match(M)){const{panelsState:T}=M.payload;return{...y,panelsState:T}}if(m.match(M)){const{correlationEditorHelperData:T}=M.payload;return{...y,correlationEditorHelperData:T}}if(E.match(M))return{...y,correlations:M.payload.correlations};if(a.match(M)){const{queries:T,range:I,datasourceInstance:x,history:S,eventBridge:O}=M.payload;return{...y,range:I,queries:T,initialized:!0,eventBridge:O,queryKeys:(0,n.dY)(T),datasourceInstance:x,history:S,queryResponse:(0,f.RA)(),cache:[],correlations:[]}}return y}},72433:(Q,A,e)=>{"use strict";e.d(A,{Bj:()=>D,H9:()=>f,PA:()=>v,Uu:()=>m,VM:()=>d,fP:()=>E,jX:()=>p,mG:()=>g,ri:()=>i,s1:()=>h,sh:()=>l,t0:()=>b,wk:()=>a});var t=e(30038),n=e(81523),o=e(11401),s=e(29436),r=e(9955);const g=(0,t.VP)("explore/historyUpdated"),u=({updatedQuery:C,deletedId:y})=>async(M,T)=>{c(T().explore,(I,x)=>{const S=I.richHistory.map(P=>P.id===C?.id?C:P).filter(P=>P.id!==y),O=I.richHistory.length-S.length;M((0,s.U2)({richHistoryResults:{richHistory:S,total:I.richHistoryTotal-O},exploreId:x}))})},c=(C,y)=>{Object.entries(C.panes).forEach(([M,T])=>{T&&y(T,M)})},i=(C,y,M)=>async(T,I)=>{const{richHistoryStorageFull:x,limitExceeded:S}=await(0,n.l0)(C,y,M,!1,"",!I().explore.richHistoryStorageFull,!I().explore.richHistoryLimitExceededWarningShown);x&&T((0,s.fj)()),S&&T((0,s.D)())},l=(C,y)=>async(M,T)=>{const I=await(0,n.oU)(C,y);M(u({updatedQuery:I}))},f=(C,y)=>async M=>{const T=await(0,n.cX)(C,y);M(u({updatedQuery:T}))},d=C=>async y=>{const M=await(0,n.NC)(C);y(u({deletedId:M}))},h=()=>async(C,y)=>{await(0,n.X1)(),(0,r.K6)(y()).forEach(([M])=>{C((0,s.U2)({richHistoryResults:{richHistory:[],total:0},exploreId:M})),C((0,s.U2)({richHistoryResults:{richHistory:[],total:0},exploreId:M}))})},p=C=>async(y,M)=>{const T=M().explore.panes[C].richHistorySearchFilters;if(T){const I=await(0,n.DI)(T);y((0,s.U2)({richHistoryResults:I,exploreId:C}))}},m=C=>async(y,M)=>{const T=M().explore.panes[C]?.richHistorySearchFilters,I=M().explore.panes[C]?.richHistory;if(T&&I){const x={...T,page:(T?.page||1)+1},S=await(0,n.DI)(x),O=[...I,...S.richHistory];y((0,s.Ju)({filters:x,exploreId:C})),y((0,s.U2)({richHistoryResults:{richHistory:O,total:S.total},exploreId:C}))}},a=C=>async y=>{y((0,s.Ju)({filters:void 0,exploreId:C})),y((0,s.U2)({richHistoryResults:{richHistory:[],total:0},exploreId:C}))},v=()=>async(C,y)=>{let M=y().explore.richHistorySettings;M||(M=await(0,n.Gx)(),C((0,s.bZ)(M)))},E=C=>async y=>{y((0,s.bZ)(C)),await(0,n.rs)(C)},D=(C,y)=>async(M,T)=>{await M((0,s.Ju)({exploreId:C,filters:{...y}}));const I=T().explore.richHistorySettings;(0,o.g)().lastUsedDataSourcesAvailable&&await M(E({...I,lastUsedDatasourceFilters:y.datasourceFilters}))},b=(C,y)=>g.match(y)?{...C,history:y.payload.history}:C},29436:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>U,D:()=>m,J8:()=>C,JA:()=>b,Ju:()=>v,U2:()=>h,Ve:()=>M,am:()=>x,bZ:()=>a,fj:()=>p,nD:()=>E,ow:()=>S,qz:()=>d,tP:()=>D,ve:()=>T});var t=e(30038),n=e(2543),o=e.n(n),s=e(18226),r=e(12131),g=e(87490),u=e(87986),c=e(80348),i=e(27649),l=e(62256),f=e(34028);const d=(0,t.VP)("explore/syncTimes"),h=(0,t.VP)("explore/richHistoryUpdated"),p=(0,t.VP)("explore/richHistoryStorageFullAction"),m=(0,t.VP)("explore/richHistoryLimitExceededAction"),a=(0,t.VP)("explore/richHistorySettingsUpdated"),v=(0,t.VP)("explore/richHistorySearchFiltersUpdatedAction"),E=(0,t.VP)("explore/splitSizeUpdateAction"),D=(0,t.VP)("explore/maximizePaneAction"),b=(0,t.VP)("explore/evenPaneResizeAction"),C=(0,t.VP)("explore/splitClose"),y=(0,t.VP)("explore/setPaneState"),M=(0,t.VP)("explore/clearPanes"),T=(0,c.createAsyncThunk)("explore/splitOpen",async(R,{getState:B,dispatch:H})=>{const w=Object.values(B().explore.panes)[0],N=R?.queries??(R?.query?[R?.query]:w?.queries||[]);Object.keys(B().explore.panes).forEach((_,K)=>{K>=1&&H(C(_))});const V=R?.range||w?.range.raw||f.kn;let G=(0,g.o$)();for(;B().explore.panes[G];)G=(0,g.o$)();await H(I({exploreId:G,datasource:R?.datasourceUid||w?.datasourceInstance?.getRef(),queries:(0,i.v)(N),range:V,panelsState:R?.panelsState||w?.panelsState,correlationHelperData:R?.correlationHelperData,eventBridge:new s.o})),w?.range&&await H(d({syncedTimes:(0,n.isEqual)(w.range.raw,V)}))}),I=(0,c.createAsyncThunk)("explore/createNewSplitOpen",async(R,{dispatch:B})=>{await B((0,l.Gd)(R))}),x=(0,t.VP)("explore/changeCorrelationEditorDetails"),S=(R,B)=>async H=>{const{timeRange:w,getExploreUrl:N,openInNewWindow:V}=B,G=await N({queries:R.targets,dsRef:R.datasource,scopedVars:R.scopedVars,timeRange:w,adhocFilters:(0,u.w)().getAdhocFilters(R.datasource?.uid??"",!0)});if(V&&G){V(G);return}r.Ny.push(G)},O=(0,f.HZ)(),P={syncedTimes:!1,panes:{},correlationEditorDetails:{editorMode:!1,correlationDirty:!1,queryEditorDirty:!1,isExiting:!1},richHistoryStorageFull:!1,richHistoryLimitExceededWarningShown:!1,largerExploreId:void 0,maxedExploreId:void 0,evenSplitPanes:!0},U={explore:(R=P,B)=>{if(C.match(B)){const{[B.payload]:w,...N}={...R.panes};return{...R,panes:N,largerExploreId:void 0,maxedExploreId:void 0,evenSplitPanes:!0,syncedTimes:!1}}if(E.match(B)){const{largerExploreId:w}=B.payload;return{...R,largerExploreId:w,maxedExploreId:void 0,evenSplitPanes:w===void 0}}if(D.match(B)){const{exploreId:w}=B.payload;return{...R,largerExploreId:w,maxedExploreId:w,evenSplitPanes:!1}}if(b.match(B))return{...R,largerExploreId:void 0,maxedExploreId:void 0,evenSplitPanes:!0};if(d.match(B))return{...R,syncedTimes:B.payload.syncedTimes};if(p.match(B))return{...R,richHistoryStorageFull:!0};if(m.match(B))return{...R,richHistoryLimitExceededWarningShown:!0};if(a.match(B)){const w=B.payload;return{...R,richHistorySettings:w}}if(I.pending.match(B))return{...R,panes:{...R.panes,[B.meta.arg.exploreId]:O}};if(l.Gd.pending.match(B)){const w=Object.entries(R.panes),N=w.slice(0,B.meta.arg.position),V=w.slice(N.length),G=[...N,[B.meta.arg.exploreId,O],...V].reduce((_,[K,j])=>({..._,[K]:j}),{});return{...R,panes:G}}if(M.match(B))return{...R,panes:{}};if(x.match(B)){const{editorMode:w,label:N,description:V,canSave:G,correlationDirty:_,queryEditorDirty:K,isExiting:j,postConfirmAction:k,transformations:Y}=B.payload;return{...R,correlationEditorDetails:{editorMode:!!(w??R.correlationEditorDetails?.editorMode),canSave:!!(G??R.correlationEditorDetails?.canSave),label:N??R.correlationEditorDetails?.label,description:V??R.correlationEditorDetails?.description,transformations:Y??R.correlationEditorDetails?.transformations,correlationDirty:!!(_??R.correlationEditorDetails?.correlationDirty),queryEditorDirty:!!(K??R.correlationEditorDetails?.queryEditorDirty),isExiting:!!(j??R.correlationEditorDetails?.isExiting),postConfirmAction:k}}}const H=B.payload?.exploreId;return typeof H=="string"?{...R,panes:Object.entries(R.panes).reduce((w,[N,V])=>({...w,[N]:N===H?(0,l.LJ)(V,B):V}),{})}:R}}},23994:(Q,A,e)=>{"use strict";e.d(A,{_0:()=>ae,He:()=>Yt,hS:()=>de,bO:()=>_e,IL:()=>zt,rR:()=>Ge,y2:()=>ze,Az:()=>_t,PD:()=>Ve,JQ:()=>It,S6:()=>nt,Od:()=>ot,GI:()=>Mt,q9:()=>$e,h1:()=>le,qk:()=>He,Rk:()=>Pt,h9:()=>Ke,TO:()=>rt});var t=e(30038),n=e(32017),o=e.n(n),s=e(2543),r=e(49510),g=e(62467),u=e(58307),c=e(69862),i=e(99165),l=e(39070),f=e(73372),d=e(47232),h=e(9557),p=e(40187),m=e(26272),a=e(14236),v=e(80822),E=e(19347),D=e(14110),b=e(32264),C=e(33390),y=e(87490),M=e(80582),T=e(18380),I=e(69147),x=e(32901),S=e(43269),O=e(14678),P=e(80348),L=e(82467),U=e(3169),R=e(39374),B=e(97186),H=e(81160),w=e(57875),N=e(91890),V=e(57934),G=e(11261),_=e(91002),K=e(15162);const j=ft=>{const yt=[],jt=[],cn=[],pn=[],on=[],Xt=[],fn=[],An=[];for(const hn of ft.series){if(te(hn)){An.push(hn);continue}switch(hn.meta?.preferredVisualisationType){case"logs":pn.push(hn);break;case"graph":yt.push(hn);break;case"trace":on.push(hn);break;case"table":jt.push(hn);break;case"rawPrometheus":cn.push(hn);break;case"nodeGraph":Xt.push(hn);break;case"flamegraph":fn.push(hn);break;default:q(hn)&&yt.push(hn),jt.push(hn)}}return{...ft,graphFrames:yt,tableFrames:jt,logsFrames:pn,traceFrames:on,nodeGraphFrames:Xt,customFrames:An,flameGraphFrames:fn,rawPrometheusFrames:cn,graphResult:null,tableResult:null,logsResult:null,rawPrometheusResult:null}},k=({showCorrelationEditorLinks:ft,queries:yt,correlations:jt,defaultTargetDatasource:cn})=>pn=>{if(ft&&cn)for(const on of pn.series)for(const Xt of on.fields){Xt.config.links=[],Xt.display=Xt.display||(0,w.H)();const fn={};on.fields.map(An=>{fn[`${An.name}`]=`\${__data.fields.['${An.name}']}`}),Xt.config.links.push({url:"",origin:N.x0.ExploreCorrelationsEditor,title:`Correlate with ${Xt.name}`,internal:{datasourceUid:cn.uid,datasourceName:cn.name,query:{datasource:{uid:cn.uid}},meta:{correlationData:{resultField:Xt.name,vars:fn,origVars:fn}}}})}else if(yt?.length&&jt?.length){const on=(0,s.mapValues)((0,s.groupBy)(yt,"refId"),"0.datasource.uid");(0,T.cA)(pn.series,jt,on)}return pn},Y=ft=>ft.graphFrames.length?{...ft,graphResult:ft.graphFrames}:{...ft,graphResult:null},ee=ft=>{if(ft.tableFrames.length===0)return(0,g.of)({...ft,tableResult:null});ft.tableFrames.sort((pn,on)=>{const Xt=pn.refId,fn=on.refId;return Xt>fn?1:Xt<fn?-1:0});const yt=ft.tableFrames.every(pn=>q(pn)),jt={interpolate:pn=>pn};return(yt?(0,g.of)(ft.tableFrames).pipe(V.c.joinByFieldTransformer.operator({},jt)):(0,g.of)(ft.tableFrames).pipe(V.c.mergeTransformer.operator({},jt))).pipe((0,H.T)(pn=>{for(const on of pn)for(const Xt of on.fields)Xt.display=Xt.display??(0,w.J)({field:Xt,theme:b.$.theme2,timeZone:ft.request?.timezone??"browser"});return{...ft,tableResult:pn}}))},re=ft=>{const yt=ft.rawPrometheusFrames;if(!yt||yt.length===0)return(0,g.of)({...ft,tableResult:null});yt.sort((on,Xt)=>{const fn=on.refId,An=Xt.refId;return fn>An?1:fn<An?-1:0});const jt=yt.every(on=>q(on)),cn={interpolate:on=>on};return(jt?(0,g.of)(yt).pipe(V.c.joinByFieldTransformer.operator({},cn)):(0,g.of)(yt).pipe(V.c.mergeTransformer.operator({},cn))).pipe((0,H.T)(on=>{const Xt=on[0];for(const fn of Xt.fields)fn.display=fn.display??(0,w.J)({field:fn,theme:b.$.theme2,timeZone:ft.request?.timezone??"browser"});return{...ft,rawPrometheusResult:Xt}}))},J=(ft={})=>yt=>{if(yt.logsFrames.length===0)return{...yt,logsResult:null};const jt=yt.request?.intervalMs,cn=(0,I.HT)(yt.logsFrames,jt,ft.absoluteRange,ft.queries),pn=(0,y.uE)(ft.refreshInterval),on=(0,_.zy)(cn,pn),Xt=on.rows,fn=on.series,An={...on,rows:Xt,series:fn};return{...yt,logsResult:An}};function ne(ft,yt,jt,cn,pn,on,Xt,fn){return(0,g.of)(ft).pipe((0,H.T)(An=>(0,a.N$)(An,yt)),(0,H.T)(k({defaultTargetDatasource:fn,showCorrelationEditorLinks:Xt,queries:pn,correlations:on})),(0,H.T)(j),(0,H.T)(Y),(0,H.T)(J({absoluteRange:jt,refreshInterval:cn,queries:pn})),(0,c.Z)(re),(0,c.Z)(ee))}function q(ft){const yt=(0,s.groupBy)(ft.fields,jt=>jt.type);return!!(Object.keys(yt).length===2&&yt[G.PU.time]?.length===1&&yt[G.PU.number])}function te(ft){return ft.meta?.preferredVisualisationPluginId?(0,K.oZ)(ft.meta?.preferredVisualisationPluginId):!1}var oe=e(57288),ue=e(324),ie=e(62256),ge=e(72433),he=e(29436),De=e(89224),pe=e(34028);const le=ft=>yt=>{const jt=yt.explore.panes[ft];return jt&&jt.queryResponse?jt.queryResponse.state===l.Gu.Loading||jt.queryResponse.state===l.Gu.Streaming:!1},Te=(0,t.VP)("explore/addQueryRow"),Ee=(0,t.VP)("explore/changeQueries"),Re=(0,t.VP)("explore/cancelQueries"),me=(0,t.VP)("explore/queriesImported"),Me=(0,t.VP)("explore/queryStoreSubscription"),ye=(0,t.VP)("explore/setSupplementaryQueryEnabledAction"),Le=(0,t.VP)("explore/storeSupplementaryQueryDataProviderAction"),We=(0,t.VP)("explore/cleanSupplementaryQueryDataProviderAction"),Be=(0,t.VP)("explore/cleanSupplementaryQueryAction"),Ye=(0,t.VP)("explore/storeSupplementaryQueryDataSubscriptionAction"),at=(0,t.VP)("explore/updateSupplementaryQueryDataAction"),st=(0,t.VP)("explore/queryStreamUpdated"),Ke=(0,t.VP)("explore/setQueries"),Xe=(0,t.VP)("changeLoadingState"),He=(0,t.VP)("explore/setPausedState"),Ge=(0,t.VP)("explore/clearLogs"),xe=(0,t.VP)("explore/scanStart"),$e=(0,t.VP)("explore/scanStop"),be=(0,t.VP)("explore/addResultsToCache"),Z=(0,t.VP)("explore/clearCache");function ae(ft,yt){return async(jt,cn)=>{const pn=cn().explore.panes[ft];let on;pn.datasourceInstance?.meta.mixed?on=(0,s.findLast)(pn.queries,fn=>!!fn.datasource)?.datasource||void 0:on=pn.datasourceInstance?.getRef();const Xt=await(0,y.Ll)(pn.queries,yt,on);jt(Te({exploreId:ft,index:yt,query:Xt}))}}function de(ft){return(yt,jt)=>{yt($e({exploreId:ft})),yt(Re({exploreId:ft}));const cn=jt().explore.panes[ft].supplementaryQueries;for(const pn of oe.VW)yt(We({exploreId:ft,type:pn})),cn[pn]?.data?.state!==l.Gu.Done&&yt(Be({exploreId:ft,type:pn}))}}const ve=(ft,yt)=>{const jt=ft.getRef();return yt.map(cn=>({...cn,datasource:jt}))},Ue=async(ft,yt,jt)=>{let cn=[];if(yt.meta?.id===ft.meta?.id)cn=jt;else if((0,f.Ee)(yt)&&(0,f.FL)(ft)){const pn=await yt.exportToAbstractQueries(jt);cn=await ft.importFromAbstractQueries(pn)}else ft.importQueries&&(cn=await ft.importQueries(jt,yt));return ve(ft,cn)},_e=(0,P.createAsyncThunk)("explore/changeQueries",async({queries:ft,exploreId:yt},{getState:jt,dispatch:cn})=>{let pn=!1;const on=jt().explore.panes[yt].queries,Xt=jt().explore.panes[yt].datasourceInstance?.uid,fn=jt().explore.correlationEditorDetails,An=fn?.editorMode||!1;!(Object.keys(jt().explore.panes)[0]===yt)&&An&&!fn?.queryEditorDirty&&cn((0,he.am)({queryEditorDirty:!0}));for(const ca of ft)for(const Rt of on){if(ca.refId===Rt.refId&&ca.datasource?.type!==Rt.datasource?.type){const qt=await(0,E.l)().get(Rt.datasource),gn=await(0,E.l)().get({uid:ca.datasource?.uid});await cn(ze(yt,on,qt,gn,ca.refId)),pn=!0}if(Xt===O.uv&&ca.refId===Rt.refId&&ca.datasource?.uid!==Rt.datasource?.uid){const qt=(0,pe.dq)(O.uv,ft),gn=await(0,T.J6)(qt);cn((0,ie.Fb)({exploreId:yt,correlations:gn.correlations||[]}))}}pn||cn(Ee({queries:ft,exploreId:yt})),ft.length<on.length&&cn(ot({exploreId:yt}))}),ze=(ft,yt,jt,cn,pn)=>async on=>{if(!jt){on(me({exploreId:ft,queries:yt}));return}let Xt=yt;if(cn.uid===O.uv)Xt=yt.map(An=>({...An,datasource:jt.getRef()}));else if(jt.uid===O.uv){const An=(0,s.groupBy)(yt,ca=>ca.datasource?.uid),hn=await Promise.all(Object.keys(An).map(async ca=>{const Rt=await(0,E.l)().get({uid:ca});return await Ue(cn,Rt,An[ca])}));Xt=(0,s.flatten)(hn.filter(ca=>ca.length>0))}else{let An=yt;if(pn!==void 0){const hn=yt.find(ca=>ca.refId===pn);hn&&(An=[hn])}Xt=await Ue(cn,jt,An)}let fn=await(0,y.di)(Xt,cn.getRef());if(pn!==void 0){Xt.length===0&&(Xt=[await(0,y.Ll)([],void 0,cn.getRef())]);const An=yt.findIndex(ca=>ca.refId===pn),hn={...fn[0],refId:yt[An].refId};fn=[...yt],fn[An]=hn}return on(me({exploreId:ft,queries:fn})),fn};function Ve(ft,yt,jt){return async(cn,pn)=>{const on=pn().explore.panes[ft],{queries:Xt}=on,An=(await Promise.all(Xt.map(hn=>jt({...hn},yt)))).map((hn,ca)=>(0,y.eF)(hn,Xt,ca));cn(Ke({exploreId:ft,queries:An})),yt.preventSubmit||cn(ot({exploreId:ft}))}}async function Ne(ft,yt,jt,cn,pn,on){const Xt=cn.meta.id,fn=(0,y.Al)(jt,Xt,pn);ft((0,ge.mG)({exploreId:on,history:fn})),ft((0,ge.ri)(cn.uid,cn.name,pn));for(const An in yt.panes)await ft((0,ge.jX)(An))}const ot=(0,P.createAsyncThunk)("explore/runQueries",async({exploreId:ft,preserveCache:yt},{dispatch:jt,getState:cn})=>{jt(de(ft));const{defaultCorrelationEditorDatasource:pn,scopedVars:on,showCorrelationEditorLinks:Xt}=await(0,pe.aj)(cn(),ft),fn=(0,ue.M)(ft);jt((0,De.JA)({exploreId:ft})),yt!==!0&&jt(zt(ft));const hn=cn().explore.panes[ft],{datasourceInstance:ca,containerWidth:Rt,isLive:qt,range:gn,scanning:Cn,queryResponse:mn,querySubscription:Sn,refreshInterval:Tn,absoluteRange:$n,cache:Mn,supplementaryQueries:Ln}=hn;let na,pa;const ia=hn.queries.map(Da=>({...Da,datasource:Da.datasource||ca?.getRef()}));ca!=null&&Ne(jt,cn().explore,hn.history,ca,ia,ft);const Xn=(0,pe.rk)(Mn,$n);if(Xn)na=(0,r.z)([(0,g.of)(Xn),fn]).pipe((0,c.Z)(([Da,ba])=>ne(Da,mn,$n,Tn,ia,ba,Xt,pn))),pa=na.subscribe(Da=>{jt(st({exploreId:ft,response:Da}))});else{if(!(0,y.zT)(ia)||!ca)return;const Da=ca?.interval;(0,y._u)(Sn);const ba={minInterval:Da,maxDataPoints:Rt,liveStreaming:qt},Oa=(0,x.O)(cn().user),sa=(0,y.bI)(ft,ia,ba,gn,Cn,Oa,on);if(jt(Xe({exploreId:ft,loadingState:l.Gu.Loading})),na=(0,r.z)([(0,R.BN)(ca,sa.request).pipe(qt?(0,i.c)(500):u.D),fn]).pipe((0,c.Z)(([Jn,Va])=>ne(Jn,mn,$n,Tn,ia,Va,Xt,pn))),pa=na.subscribe({next(Jn){const Va=cn().explore.panes[ft];if(Jn.logsResult!==null&&Jn.state===l.Gu.Done&&(0,D.rR)("grafana_explore_logs_result_displayed",{datasourceType:ca.type,visualisationType:Va?.panelsState?.logs?.visualisationType??C.A.get(B.r)??"N/A",length:Jn.logsResult.rows.length}),jt(st({exploreId:ft,response:Jn})),Va.scanning)if(Jn.state===l.Gu.Done&&Jn.series.length===0){const ts=(0,M.Wb)(-1,Va.range);jt((0,De.JA)({exploreId:ft,absoluteRange:ts})),jt(ot({exploreId:ft}))}else jt($e({exploreId:ft}))},error(Jn){jt((0,L.dx)((0,U.gi)("Query processing error",Jn))),jt(Xe({exploreId:ft,loadingState:l.Gu.Error})),console.error(Jn)},complete(){cn().explore.panes[ft].queryResponse.state===l.Gu.Loading&&jt(Xe({exploreId:ft,loadingState:l.Gu.Done}))}}),qt)for(const Jn of oe.VW)jt(We({exploreId:ft,type:Jn})),jt(Be({exploreId:ft,type:Jn}));else jt(mt({exploreId:ft,datasourceInstance:ca,transaction:sa,newQuerySource:na,supplementaryQueries:Ln,queries:ia,absoluteRange:$n}))}jt(Me({exploreId:ft,querySubscription:pa}))}),nt=(0,P.createAsyncThunk)("explore/runLoadMoreQueries",async({exploreId:ft,absoluteRange:yt},{dispatch:jt,getState:cn})=>{jt(de(ft));const{datasourceInstance:pn,containerWidth:on,queryResponse:Xt}=cn().explore.panes[ft],{defaultCorrelationEditorDatasource:fn,scopedVars:An,showCorrelationEditorLinks:hn}=await(0,pe.aj)(cn(),ft),ca=(0,ue.M)(ft);let Rt;const qt=Xt.logsResult?.queries||[],gn=Xt.logsFrames.map(Mn=>Mn.refId),Cn=qt.filter(Mn=>gn.includes(Mn.refId)).map(Mn=>({...Mn,datasource:Mn.datasource||pn?.getRef(),refId:`${I.O6}${Mn.refId}`,supportingQueryType:S.Q$.InfiniteScroll}));if(!(0,y.zT)(Cn)||!pn)return;const mn={minInterval:pn?.interval,maxDataPoints:on},Sn=(0,x.O)(cn().user),Tn=(0,y.zq)(Sn,{from:(0,d.oZ)(Sn,yt.from),to:(0,d.oZ)(Sn,yt.to)},(0,x.q)(cn().user)),$n=(0,y.bI)(ft,Cn,mn,Tn,!1,Sn,An);jt(Xe({exploreId:ft,loadingState:l.Gu.Loading})),Rt=(0,r.z)([(0,R.BN)(pn,$n.request),ca]).pipe((0,c.Z)(([Mn,Ln])=>Mn.state!==l.Gu.Done?(0,g.of)({...Xt,state:l.Gu.Loading}):ne((0,v._k)(Xt,Mn),Xt,yt,void 0,Cn,Ln,hn,fn))),Rt.subscribe({next(Mn){jt(st({exploreId:ft,response:Mn}))},error(Mn){jt((0,L.dx)((0,U.gi)("Query processing error",Mn))),jt(Xe({exploreId:ft,loadingState:l.Gu.Error})),console.error(Mn)},complete(){jt(Xe({exploreId:ft,loadingState:l.Gu.Done}))}})}),pt=async(ft,yt)=>{const jt=ft.filter(pn=>pn.datasource?.uid!==O.uv),cn=(0,s.groupBy)(jt,"datasource.uid");return await Promise.all(Object.values(cn).map(async pn=>({datasource:await(0,E.l)().get(pn[0].datasource,yt),targets:pn})))},mt=(0,P.createAsyncThunk)("explore/handleSupplementaryQueries",async({datasourceInstance:ft,exploreId:yt,transaction:jt,newQuerySource:cn,supplementaryQueries:pn,queries:on,absoluteRange:Xt},{dispatch:fn})=>{let An;ft.meta.mixed?An=await pt(jt.request.targets,jt.request.scopedVars):An=[{datasource:ft,targets:jt.request.targets}];for(const hn of oe.VW){const ca=(0,oe.Pm)(An,hn,{...jt.request,requestId:`${jt.request.requestId}_${(0,s.snakeCase)(hn)}`},cn);ca?(fn(Le({exploreId:yt,type:hn,dataProvider:ca})),gt(pn[hn].data,on,Xt)||(fn(Be({exploreId:yt,type:hn})),pn[hn].enabled&&fn(_t(yt,hn)))):fn(We({exploreId:yt,type:hn}))}});function gt(ft,yt,jt){if(!ft)return!1;const cn=(0,s.zipObject)((0,s.map)(yt,"refId"),yt),pn=(0,s.mapValues)((0,s.groupBy)(ft.data.map(An=>An.meta?.custom?.sourceQuery),"refId"),s.head),on=ft.data.every(An=>An.meta?.custom?.logsVolumeType===h.Aj.FullRange),Xt=o()(cn,pn),fn=ft.data.every(An=>{const hn=An.meta?.custom?.absoluteRange;return hn?hn&&hn.from<=jt.from&&jt.to<=hn.to:!0});return on&&Xt&&fn}function Pt(ft,yt){return(jt,cn)=>{const pn=cn().explore.panes[ft].queries,on=yt.map((Xt,fn)=>(0,y.eF)(Xt,pn,fn));jt(Ke({exploreId:ft,queries:on})),jt(ot({exploreId:ft}))}}function Mt(ft){return(yt,jt)=>{yt(xe({exploreId:ft}));const cn=(0,M.Wb)(-1,jt().explore.panes[ft].range);yt((0,De.JA)({exploreId:ft,absoluteRange:cn})),yt(ot({exploreId:ft}))}}function Yt(ft){return(yt,jt)=>{const cn=jt().explore.panes[ft].queryResponse,pn=jt().explore.panes[ft].absoluteRange,on=(0,pe.O2)(pn);cn.state===l.Gu.Done&&yt(be({exploreId:ft,cacheKey:on,queryResponse:cn}))}}function zt(ft){return(yt,jt)=>{yt(Z({exploreId:ft}))}}function _t(ft,yt){return(jt,cn)=>{const{supplementaryQueries:pn}=cn().explore.panes[ft],on=pn[yt].dataProvider;if(on){const Xt=on.subscribe({next:fn=>{jt(at({exploreId:ft,type:yt,data:fn}))}});jt(Ye({exploreId:ft,type:yt,dataSubscription:Xt}))}}}function rt(ft,yt,jt){return(cn,pn)=>{cn(ye({exploreId:ft,enabled:yt,type:jt})),(0,oe.Oi)(yt,jt),yt&&cn(_t(ft,jt))}}const It=(ft,yt)=>{if(Te.match(yt)){const{queries:jt}=ft,{index:cn,query:pn}=yt.payload,on=[...jt.slice(0,cn+1),{...pn},...jt.slice(cn+1)];return{...ft,queries:on,queryKeys:(0,y.dY)(on)}}if(Ee.match(yt)){const{queries:jt}=yt.payload;return{...ft,queries:jt}}if(Re.match(yt))return(0,y._u)(ft.querySubscription),{...ft,...ft.queryResponse?{queryResponse:{...ft.queryResponse,state:l.Gu.Done}}:{}};if(Ke.match(yt)){const{queries:jt}=yt.payload;return{...ft,queries:jt.slice(),queryKeys:(0,y.dY)(jt)}}if(Me.match(yt)){const{querySubscription:jt}=yt.payload;return{...ft,querySubscription:jt}}if(ye.match(yt)){const{enabled:jt,type:cn}=yt.payload,{supplementaryQueries:pn}=ft,on=pn[cn].dataSubscription;!jt&&on&&on.unsubscribe();const Xt={...pn,[cn]:{...pn[cn],enabled:jt,data:void 0}};return{...ft,supplementaryQueries:Xt}}if(Le.match(yt)){const{dataProvider:jt,type:cn}=yt.payload,{supplementaryQueries:pn}=ft,on=pn[cn];on?.dataSubscription&&on.dataSubscription.unsubscribe();const Xt={...pn,[cn]:{...on,dataProvider:jt,dataSubscription:void 0}};return{...ft,supplementaryQueries:Xt}}if(We.match(yt)){const{type:jt}=yt.payload,{supplementaryQueries:cn}=ft,pn=cn[jt];pn?.dataSubscription&&pn.dataSubscription.unsubscribe();const on={...cn,[jt]:{...pn,dataProvider:void 0,dataSubscription:void 0}};return{...ft,supplementaryQueries:on}}if(Be.match(yt)){const{type:jt}=yt.payload,{supplementaryQueries:cn}=ft,pn={...cn,[jt]:{...cn[jt],data:void 0}};return{...ft,supplementaryQueries:pn}}if(Ye.match(yt)){const{dataSubscription:jt,type:cn}=yt.payload,{supplementaryQueries:pn}=ft,on={...pn,[cn]:{...pn[cn],dataSubscription:jt}};return{...ft,supplementaryQueries:on}}if(at.match(yt)){let{data:jt,type:cn}=yt.payload;const{supplementaryQueries:pn}=ft,on={...pn,[cn]:{...pn[cn],data:jt}};return{...ft,supplementaryQueries:on}}if(st.match(yt))return Dn(ft,yt);if(me.match(yt)){const{queries:jt}=yt.payload;return{...ft,queries:jt,queryKeys:(0,y.dY)(jt)}}if(Xe.match(yt)){const{loadingState:jt}=yt.payload;return{...ft,queryResponse:{...ft.queryResponse,state:jt}}}if(He.match(yt)){const{isPaused:jt}=yt.payload;return{...ft,isPaused:jt}}if(xe.match(yt))return{...ft,scanning:!0};if($e.match(yt))return{...ft,scanning:!1,scanRange:void 0};if(be.match(yt)){const{cache:cn}=ft,{queryResponse:pn,cacheKey:on}=yt.payload;let Xt=[...cn];return Xt.some(An=>An.key===on)||(Xt=[{key:on,value:pn},...Xt].slice(0,5)),{...ft,cache:Xt}}if(Z.match(yt))return{...ft,cache:[]};if(Ge.match(yt)){if(!ft.logsResult)return{...ft,clearedAtIndex:null};if(ft.queryResponse.state===l.Gu.Loading)return{...ft,clearedAtIndex:null,logsResult:{...ft.logsResult,rows:[]}};const jt=ft.clearedAtIndex?ft.clearedAtIndex+ft.logsResult.rows.length:ft.logsResult.rows.length-1;return{...ft,clearedAtIndex:jt,logsResult:{...ft.logsResult,rows:[]}}}return ft},Dn=(ft,yt)=>{const{response:jt}=yt.payload,{request:cn,series:pn,error:on,graphResult:Xt,logsResult:fn,tableResult:An,rawPrometheusResult:hn,traceFrames:ca,nodeGraphFrames:Rt,flameGraphFrames:qt,rawPrometheusFrames:gn,customFrames:Cn}=jt;if(on){if(on.type===p.v2.Timeout||on.type===p.v2.Cancelled)return{...ft};b.$.angularSupportEnabled&&ft.datasourceInstance?.components?.QueryCtrl&&ft.eventBridge.emit(m.ee.dataError,on)}if(!cn)return{...ft};if(b.$.angularSupportEnabled&&ft.datasourceInstance?.components?.QueryCtrl){const mn=pn.map(Sn=>(0,a.w3)(Sn));ft.eventBridge.emit(m.ee.dataReceived,mn)}return{...ft,queryResponse:jt,graphResult:Xt,tableResult:An,rawPrometheusResult:hn,logsResult:ft.isLive&&fn?{...fn,rows:(0,pe.pg)(ft.clearedAtIndex,fn.rows)}:fn,showLogs:!!fn,showMetrics:!!Xt,showTable:!!An?.length,showTrace:!!ca.length,showNodeGraph:!!Rt.length,showRawPrometheus:!!gn.length,showFlameGraph:!!qt.length,showCustom:!!Cn?.length,clearedAtIndex:ft.isLive?ft.clearedAtIndex:null}}},9955:(Q,A,e)=>{"use strict";e.d(A,{Jr:()=>u,K6:()=>s,Qb:()=>n,pF:()=>r,qq:()=>c,st:()=>g,vC:()=>i});var t=e(1081);const n=l=>l.explore.panes,o=l=>l.explore,s=(0,t.Mz)(n,Object.entries),r=(0,t.Mz)(s,l=>l.length>1),g=(0,t.Mz)(s,l=>l.some(f=>f[1].correlationEditorHelperData!==void 0)),u=l=>(0,t.Mz)(n,f=>Object.keys(f)[0]===l),c=l=>(0,t.Mz)(n,f=>f[l]),i=(0,t.Mz)(o,l=>l.correlationEditorDetails)},89224:(Q,A,e)=>{"use strict";e.d(A,{$_:()=>M,GA:()=>S,GH:()=>E,Iy:()=>T,JA:()=>b,QP:()=>O,Xk:()=>x,eM:()=>a,hO:()=>v,iO:()=>C,ke:()=>I,zY:()=>D});var t=e(30038),n=e(47232),o=e(26272),s=e(39070),r=e(72574),g=e(11134),u=e(76412),c=e(28138),i=e(87490),l=e(80582),f=e(74856),d=e(91002),h=e(32901),p=e(29436),m=e(23994);const a=(0,t.VP)("explore/changeRange"),v=(0,t.VP)("explore/changeRefreshInterval"),E=P=>(L,U)=>{const{syncedTimes:R}=U().explore;R?Object.keys(U().explore.panes).forEach(B=>{L(b({...P,exploreId:B})),L((0,m.Od)({exploreId:B,preserveCache:!0}))}):(L(b({...P})),L((0,m.Od)({exploreId:P.exploreId,preserveCache:!0})))},D=P=>L=>{L((0,m.S6)({...P}))},b=P=>(L,U)=>{const{exploreId:R,absoluteRange:B,rawRange:H}=P,w=U().explore.panes[R],N=(0,h.O)(U().user),V=(0,h.q)(U().user),{range:G}=w;let _=G.raw;B&&(_={from:(0,n.oZ)(N,B.from),to:(0,n.oZ)(N,B.to)}),H&&(_=H);const K=(0,i.zq)(N,_,V),j={from:K.from.valueOf(),to:K.to.valueOf()};(0,f.jG)().init({timepicker:{},getTimezone:()=>N,timeRangeUpdated(k){},time:K.raw}),(0,r.w)().updateTimeRange(K),L(a({exploreId:R,range:K,absoluteRange:j}))};function C(P){return(L,U)=>{const R=U().explore.panes[P].range.raw;Object.keys(U().explore.panes).filter(H=>H!==P).forEach(H=>{L(E({exploreId:H,rawRange:R}))});const B=U().explore.syncedTimes;L((0,p.qz)({syncedTimes:!B}))}}function y(P){return(L,U)=>{const R=(0,h.O)(U().user),B=(0,h.q)(U().user);Object.entries(U().explore.panes).forEach(([H,w])=>{const N=(0,i.zq)(R,w.range.raw,B);P(H,w,N,L)})}}function M(){return y((P,L,U,R)=>{const B={from:U.from.valueOf(),to:U.to.valueOf()};R(E({exploreId:P,absoluteRange:B}))})}function T(P){return y((L,U,R,B)=>{const H=(0,l.Wb)(P,R);B(E({exploreId:L,absoluteRange:H}))})}function I(P){return y((L,U,R,B)=>{const H=(0,l.Zk)(R,P);B(E({exploreId:L,absoluteRange:H}))})}function x(){return(P,L)=>{const U=L().explore.panes[Object.keys(L().explore.panes)[0]].range.raw;navigator.clipboard.writeText(JSON.stringify(U)),c.A.emit(o.r1.alertSuccess,[(0,u.t)("time-picker.copy-paste.copy-success-message","Time range copied to clipboard")])}}function S(){return async(P,L)=>{const{range:U,isError:R}=await(0,l.zG)();if(R===!0){c.A.emit(o.r1.alertError,[(0,u.t)("time-picker.copy-paste.default-error-title","Invalid time range"),(0,u.t)("time-picker.copy-paste.default-error-message","{{error}} is not a valid time range",{error:U})]);return}if(L().explore.syncedTimes){P(E({exploreId:Object.keys(L().explore.panes)[0],rawRange:U})),P(E({exploreId:Object.keys(L().explore.panes)[1],rawRange:U}));return}P(E({exploreId:Object.keys(L().explore.panes)[0],rawRange:U}))}}const O=(P,L)=>{if(v.match(L)){const{refreshInterval:U}=L.payload,R=g.cC.isLive(U),B=(0,i.uE)(U),H=(0,d.zy)(P.logsResult,B);return g.cC.isLive(P.refreshInterval)&&!R&&(0,i._u)(P.querySubscription),{...P,refreshInterval:U,queryResponse:{...P.queryResponse,state:R?s.Gu.Streaming:s.Gu.Done},isLive:R,isPaused:R?!1:P.isPaused,logsResult:H}}if(a.match(L)){const{range:U,absoluteRange:R}=L.payload;return{...P,range:U,absoluteRange:R}}return P}},34028:(Q,A,e)=>{"use strict";e.d(A,{BE:()=>E,HZ:()=>a,O2:()=>D,RA:()=>v,Z9:()=>y,aj:()=>x,dq:()=>I,eO:()=>C,kn:()=>h,ng:()=>m,pg:()=>T,rk:()=>b});var t=e(2543),n=e.n(t),o=e(39070),s=e(43127),r=e(85858),g=e(47232),u=e(19347),c=e(14678),i=e(33390),l=e(87490),f=e(31193),d=e(57288);const h={from:"now-1h",to:"now"},p="grafana.explore.style.graph",m=S=>{i.A.set(p,S)},a=S=>({containerWidth:0,datasourceInstance:null,history:[],queries:[],initialized:!1,range:{from:null,to:null,raw:h},absoluteRange:{from:null,to:null},scanning:!1,queryKeys:[],isLive:!1,isPaused:!1,queryResponse:v(),tableResult:null,graphResult:null,logsResult:null,clearedAtIndex:null,rawPrometheusResult:null,eventBridge:null,cache:[],richHistory:[],supplementaryQueries:(0,d.Ez)(),panelsState:{},correlations:void 0,...S}),v=()=>({state:o.Gu.NotStarted,series:[],timeRange:(0,s.E2)(),graphFrames:[],logsFrames:[],traceFrames:[],nodeGraphFrames:[],flameGraphFrames:[],customFrames:[],tableFrames:[],rawPrometheusFrames:[],rawPrometheusResult:null,graphResult:null,logsResult:null,tableResult:null});async function E(S,O){let P;try{P=await(0,f.tR)().get(O)}catch{P=await(0,f.tR)().get()}if(P.init)try{P.init()}catch(R){console.error(R)}const L=`grafana.explore.history.${P.meta?.id}`,U=i.A.getObject(L,[]);return(0,l.dr)(S,P.uid),{history:U,instance:P}}function D(S){const O={from:S.from,to:S.to};return Object.entries(O).map(([L,U])=>`${encodeURIComponent(L)}=${encodeURIComponent(U.toString())}`).join("&")}function b(S,O){const P=D(O),L=S.findIndex(R=>R.key===P);return L>=0?S[L].value:void 0}function C(S,O){return{from:r.parse(S.from,!1,O),to:r.parse(S.to,!0,O),raw:S}}function y(S){let O=h,P={from:M(S.from),to:M(S.to)};return P.from!==null&&P.to!==null&&(O={from:P.from,to:P.to}),O}function M(S){if(S===null)return null;if((0,g.Ar)(S))return S;if(typeof S!="string")return null;const O=S;if(O.indexOf("now")!==-1)return O;if(O.length===8)return(0,g.yT)(O,"YYYYMMDD");if(O.length===15)return(0,g.yT)(O,"YYYYMMDDTHHmmss");if(O.length===19)return(0,g.yT)(O,"YYYY-MM-DD HH:mm:ss");if(O.match(/^\d+$/)){const L=parseInt(O,10);return(0,g.yT)(L)}const P=(0,g.yT)(O);return P.isValid()?P:null}const T=(S,O)=>O?S?O.slice(S+1):O:[],I=(S,O)=>S===c.uv?(0,t.uniq)(O.map(P=>P.datasource?.uid).filter(P=>!!P)):[S];async function x(S,O){const P=S.explore.panes[O].correlationEditorHelperData,L=S.explore.correlationEditorDetails?.editorMode||!1,U=Object.keys(S.explore.panes)[0]===O,R=L&&U,B=R?await(0,u.l)().get():void 0,H=L&&!U&&P!==void 0;let w={};return H&&P!==void 0&&Object.entries(P?.vars).forEach(N=>{w[N[0]]={value:N[1]}}),{defaultCorrelationEditorDatasource:B,scopedVars:w,showCorrelationEditorLinks:R}}},96192:(Q,A,e)=>{"use strict";e.d(A,{JQ:()=>C,O1:()=>M,QL:()=>D,YV:()=>E,_O:()=>x,eT:()=>b});var t=e(2543),n=e.n(t),o=e(96540),s=e(92461),r=e(91890),g=e(41987),u=e(6709),c=e(76885),i=e(72574),l=e(14110),f=e(16233),d=e(67023),h=e(6923),p=e(80252);const a=[S=>!S.internal||f.TP.hasAccessToExplore()],v="grafana_data_link_clicked",E=(S,O)=>L=>{const{field:U,dataLinkScopedVars:R,frame:B,link:H,linkModel:w}=L,{valueRowIndex:N}=L.config;if(!H.internal||N===void 0)return w;const V=D({field:U,rowIndex:N,splitOpenFn:S,range:O,vars:R,dataFrame:B,linksToProcess:[H]});return V.length?(0,t.first)(V):void 0},D=S=>{const{field:O,vars:P,splitOpenFn:L,range:U,rowIndex:R,dataFrame:B}=S,H={...P||{}};H.__value={value:{raw:O.values[R]},text:"Raw value"};let w;B&&(w=(0,s.F)({frame:B,rowIndex:R}),H.__data={value:{name:B.name,refId:B.refId,fields:w},text:"Data"},B.fields.forEach(V=>{w&&w[V.name]&&(H[V.name]={value:w[V.name]})}),H.__targetField={value:w[O.name]});const N=S.linksToProcess||O.config.links;return N?N.filter(_=>a.every(K=>K(_,H))).map(_=>{if(_.internal){let K={};_.internal?.transformations&&_.internal?.transformations.forEach(re=>{let J;re.field?J=B?.fields.find(q=>q.name===re.field)?.values[R]:J=O.values[R],K={...K,...(0,d.k)(re,J,O.name)}});const j={...H,...K},k=M(_,j);let Y=[];if(k.variables.length===0){const re=O.name.toString();Y.push({variableName:re,value:"",match:""})}else Y=k.variables;const ee=re=>{(0,l.rR)(v,{origin:_.origin||r.x0.Datasource,app:g.Jk.Explore,internal:!0}),L?.(re)};return k.allVariablesDefined?{...(0,u.u)({link:_,internalLink:_.internal,scopedVars:j,range:U,field:O,onClickFn:S.splitOpenFn?J=>ee(J):void 0,replaceVariables:(0,i.w)().replace.bind((0,i.w)())}),variables:Y}:void 0}else{const K=(k,Y)=>(0,i.w)().replace(k,{...Y,...H}),j=(0,h.mQ)().getDataLinkUIModel(_,K,O);return j.title||(j.title=b(j.href)),j}}).filter(_=>!!_):[]};function b(S){S.indexOf("://")<0&&(S=`http://${S}`);let O;try{O=new URL(S).hostname}catch{O=S}return O}function C(S,O){return(0,o.useCallback)((P,L)=>P.fields.flatMap(U=>U.config?.links&&U.config?.links.length?D({field:U,rowIndex:L,range:S,dataFrame:P,splitOpenFn:O}):[]),[S,O])}const y=["__from","__to","__interval","__interval_ms","__org","__user","__range","__rate_interval","__timeFilter","timeFilter"];function M(S,O){let P=[];return(0,i.w)().replace.bind((0,i.w)())(T(S),O,void 0,P),P=(0,t.uniqBy)(P,"variableName"),{variables:P,allVariablesDefined:P.filter(U=>!y.includes(U.variableName)).every(U=>U.found)}}function T(S){let O="",P;for(P in S)typeof S[P]=="string"?O+=" "+S[P]:typeof S[P]=="object"&&(O+=" "+T(S[P]));return O}const I=S=>S[1]!==void 0,x=S=>{const O=Object.entries(S).filter(I).map(([P,L])=>{const U=(0,p.m)(L);return U.range={to:L.range.to.valueOf().toString(),from:L.range.from.valueOf().toString()},[P,U]}).reduce((P,[L,U])=>({...P,[L]:U}),{});return c.kM.renderUrl("/explore",{schemaVersion:1,panes:JSON.stringify(O)})}},27649:(Q,A,e)=>{"use strict";e.d(A,{v:()=>n});var t=e(21969);function n(o){const s=new Set(o.map(r=>r.refId).filter(Boolean));return s.size===o.length?o:(s.clear(),o.map(r=>{if(r.refId&&!s.has(r.refId))return s.add(r.refId),r;const g=(0,t.W3)(o);return s.add(g),{...r,refId:g}}))}},57288:(Q,A,e)=>{"use strict";e.d(A,{Ez:()=>p,Oi:()=>h,Pm:()=>v,VW:()=>f});var t=e(2543),n=e.n(t),o=e(88483),s=e(44240),r=e(6276),g=e(29405),u=e(9557),c=e(39070),i=e(33390),l=e(69147);const f=[u.cF.LogsVolume,u.cF.LogsSample],d=E=>`grafana.explore.logs.enable${E}`,h=(E,D)=>{i.A.set(d(D),E?"true":"false")},p=()=>{let E={[u.cF.LogsVolume]:{enabled:!0},[u.cF.LogsSample]:{enabled:!1}};for(const D of f){if(D===u.cF.LogsSample)continue;i.A.get(d(D))==="false"&&(E[D]={enabled:!1})}return E},m=(E,D,b)=>new o.c(C=>E.subscribe(y=>{if(y.logsResult&&y.logsResult.rows&&y.logsResult.visibleRange&&y.logsResult.bucketSize!==void 0&&y.state===c.Gu.Done){const M=y.logsResult.bucketSize,T=D.map(S=>S.refId),I=(0,t.groupBy)(y.logsResult.rows,"dataFrame.refId");let x=[];T.forEach(S=>{if(I[S]?.length){const O=(0,l.J9)(I[S],M);x=[...x,...O];const P={logsVolumeType:u.Aj.Limited,absoluteRange:y.logsResult?.visibleRange,datasourceName:b,sourceQuery:D.find(L=>L.refId===S)};C.next({data:x.map(L=>{const U=L.meta?.custom||{};return{...L,meta:{custom:{...U,...P}}}}),state:y.state})}}),C.complete()}})),a=(E,D,b,C)=>{if(E===u.cF.LogsVolume)return m(D,b,C)},v=(E,D,b,C)=>{const M=E.map(({datasource:T,targets:I},x)=>{const S=(0,t.cloneDeep)(b);if(S.requestId=`${S.requestId||""}_${x}`,S.targets=I,(0,u.Nc)(T,D)){if(T.getDataProvider)return T.getDataProvider(D,S);if(T.getSupplementaryRequest){const O=T.getSupplementaryRequest(D,S);return O?D===u.cF.LogsVolume?(0,l.sg)(T,O,{targets:S.targets}):(0,l.Wr)(T,O):void 0}else return}else return a(D,C,I,T.name)}).filter(c.zz);if(M.length!==0)return M.length===1?M[0]:(0,s.h)(...M).pipe((0,g.S)((T,I)=>T.errors&&T.errors.length||I.state===c.Gu.NotStarted?T:I.state===c.Gu.Loading&&T.state===c.Gu.NotStarted?{...T,state:c.Gu.Loading}:I.state&&I.state!==c.Gu.Done?T:{...T,data:[...T.data,...I.data],state:c.Gu.Done},{data:[],state:c.Gu.NotStarted}),(0,r.d)())}},53478:(Q,A,e)=>{"use strict";e.d(A,{Ex:()=>y,$i:()=>C});var t=e(65474),n=e(69862),o=e(43429),s=e(26657),r=e(72574),g=e(19347),u=e(96540),c=e(14186),i=e(88323),l=e(98808),f=e(71680),d=e(1712),h=e(34263),p=e(76658),m=e(66718),a=e(76942);const v=15;function E(){const M=(0,u.useRef)({}),T=(0,u.useCallback)(x=>{switch(x){case m.Tz.math:case m.Tz.reduce:case m.Tz.resample:case m.Tz.threshold:return M.current[x];case m.Tz.classic:return}},[]),I=(0,u.useCallback)((x,S)=>{switch(x){case m.Tz.math:M.current.math=S;break;case m.Tz.reduce:case m.Tz.resample:case m.Tz.resample:M.current.reduce=S,M.current.resample=S,M.current.threshold=S;break}},[]);return{getCachedExpression:T,setCachedExpression:I}}function D(M){const{query:T,queries:I,onRunQuery:x,onChange:S}=M,{getCachedExpression:O,setCachedExpression:P}=E();(0,u.useEffect)(()=>{P(T.type,T.expression)},[T.expression,T.type,P]);const L=(0,u.useCallback)(B=>{const H=O(B.value),w=(0,a.r)({...T,type:B.value});S({...w,expression:H??w.expression})},[T,S,O]),U=()=>{const B=I.filter(H=>T.refId!==H.refId).map(H=>({value:H.refId,label:H.refId}));switch(T.type){case m.Tz.math:return u.createElement(f.z,{onChange:S,query:T,labelWidth:v,onRunQuery:x});case m.Tz.reduce:return u.createElement(d.Z,{refIds:B,onChange:S,labelWidth:v,query:T});case m.Tz.resample:return u.createElement(h.C,{query:T,labelWidth:v,onChange:S,refIds:B});case m.Tz.classic:return u.createElement(l.z,{onChange:S,query:T,refIds:B});case m.Tz.threshold:return u.createElement(p.O,{onChange:S,query:T,labelWidth:v,refIds:B})}},R=m.uQ.find(B=>B.value===T.type);return u.createElement("div",null,u.createElement(c.I,{label:"Operation",labelWidth:v},u.createElement(i.l6,{options:m.uQ,value:R,onChange:L,width:25})),U())}class b extends s.iy{constructor(T){super(T),this.instanceSettings=T}applyTemplateVariables(T,I){const x=(0,r.w)();return{...T,expression:x.replace(T.expression,I),window:x.replace(T.window,I)}}getCollapsedText(T){return`Expression: ${T.type}`}query(T){let I=T.targets.map(async S=>{const O=await(0,g.l)().get(S.datasource);return O.interpolateVariablesInQueries?O?.interpolateVariablesInQueries([S],T.scopedVars,T.filters)[0]:S});return(0,t.H)(Promise.all(I)).pipe((0,n.Z)(S=>super.query({...T,targets:S})))}newQuery(T){return{refId:"--",datasource:s.dR,type:T?.type??m.Tz.math,...T}}}const C={id:-100,uid:m.Uj,name:s.dR.name,type:s.dR.type,access:"proxy",meta:{baseUrl:"",module:"",type:o.QE.datasource,name:s.dR.type,id:s.dR.type,info:{author:{name:"Grafana Labs"},logos:{small:"public/img/icn-datasource.svg",large:"public/img/icn-datasource.svg"},description:"Adds expression support to Grafana",screenshots:[],links:[],updated:"",version:""}},jsonData:{},readOnly:!0},y=new b(C);y.meta={id:s.dR.type,info:{logos:{small:"public/img/icn-datasource.svg",large:"public/img/icn-datasource.svg"}}},y.components={QueryEditor:D}},98808:(Q,A,e)=>{"use strict";e.d(A,{z:()=>D});var t=e(96540),n=e(39268),o=e(14186),s=e(55852),r=e(14578),g=e(76942),u=e(32196),c=e(40845),i=e(67061),l=e(9261),f=e(88323),d=e(10354),h=e(55907);const p=h.A.reducerTypes.map(b=>({label:b.text,value:b.value})),m=h.A.evalOperators.map(b=>({label:b.text,value:b.value})),a=h.A.evalFunctions.map(b=>({label:b.text,value:b.value})),v=({condition:b,index:C,onChange:y,onRemoveCondition:M,refIds:T})=>{const I=(0,c.of)(E),x=B=>{y({...b,operator:{type:B.value}})},S=B=>{y({...b,reducer:{type:B.value,params:[]}})},O=B=>{y({...b,query:{params:[B.value]}})},P=B=>{y({...b,evaluator:{params:b.evaluator.params,type:B.value}})},L=(B,H)=>{const w=parseFloat(B.currentTarget.value),N=[...b.evaluator.params];N[H]=w,y({...b,evaluator:{...b.evaluator,params:N}})},U=(0,u.css)` width: 60px; `,R=b.evaluator.type===h.p.IsWithinRange||b.evaluator.type===h.p.IsOutsideRange;return t.createElement(i.B,null,t.createElement("div",{style:{flex:1}},t.createElement(n.C,null,C===0?t.createElement("div",{className:(0,u.cx)(I.button,U)},"WHEN"):t.createElement(l.f,{className:(0,u.cx)(I.buttonSelectText,U),options:m,onChange:x,value:m.find(B=>B.value===b.operator.type)}),t.createElement(f.l6,{options:p,onChange:S,width:20,value:p.find(B=>B.value===b.reducer.type)}),t.createElement("div",{className:I.button},"OF"),t.createElement(f.l6,{onChange:O,options:T,width:"auto",value:T.find(B=>B.value===b.query.params[0])})),t.createElement(n.C,null,t.createElement(l.f,{className:I.buttonSelectText,options:a,onChange:P,value:a.find(B=>B.value===b.evaluator.type)}),R?t.createElement(t.Fragment,null,t.createElement(d.p,{type:"number",width:10,onChange:B=>L(B,0),value:b.evaluator.params[0]}),t.createElement("div",{className:I.button},"TO"),t.createElement(d.p,{type:"number",width:10,onChange:B=>L(B,1),value:b.evaluator.params[1]})):b.evaluator.type!==h.p.HasNoValue?t.createElement(d.p,{type:"number",width:10,onChange:B=>L(B,0),value:b.evaluator.params[0]}):null)),t.createElement(s.$n,{variant:"secondary",type:"button",onClick:()=>M(C)},t.createElement(r.I,{name:"trash-alt"})))},E=b=>{const C=(0,u.css)` color: ${b.colors.primary.text}; font-size: ${b.typography.bodySmall.fontSize}; `;return{buttonSelectText:C,button:(0,u.cx)((0,u.css)` display: flex; align-items: center; border-radius: ${b.shape.radius.default}; font-weight: ${b.typography.fontWeightMedium}; border: 1px solid ${b.colors.border.weak}; white-space: nowrap; padding: 0 ${b.spacing(1)}; background-color: ${b.colors.background.canvas}; `,C)}},D=({onChange:b,query:C,refIds:y})=>{const M=(x,S)=>{C.conditions&&b({...C,conditions:[...C.conditions.slice(0,S),x,...C.conditions.slice(S+1)]})},T=()=>{if(C.conditions){const x=C.conditions.at(-1)?.query?.params??[],S={...g.P,query:{params:x}};b({...C,conditions:C.conditions.length>0?[...C.conditions,S]:[S]})}},I=x=>{if(C.conditions){const S=C.conditions[x],O=C.conditions.filter(P=>P!==S).map((P,L)=>L===0?{...P,operator:{type:"when"}}:P);b({...C,conditions:O})}};return t.createElement("div",null,t.createElement(n.C,null,t.createElement(o.I,{label:"Conditions",labelWidth:14},t.createElement("div",null,C.conditions?.map((x,S)=>{if(x)return t.createElement(v,{key:S,index:S,condition:x,onChange:O=>M(O,S),onRemoveCondition:I,refIds:y})})))),t.createElement(s.$n,{variant:"secondary",type:"button",onClick:T},t.createElement(r.I,{name:"plus-circle"})))}},71680:(Q,A,e)=>{"use strict";e.d(A,{z:()=>f});var t=e(32196),n=e(96540),o=e(40845),s=e(67061),r=e(14186),g=e(76892),u=e(60782),c=e(14578),i=e(21744);const l="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",f=({labelWidth:m,onChange:a,query:v,onRunQuery:E})=>{const D=y=>{a({...v,expression:y.target.value})},b=(0,o.of)(h),C=()=>{v.expression&&E()};return n.createElement(s.B,null,n.createElement(r.I,{label:n.createElement(g.c,{width:"auto"},n.createElement(u.G,{fitContent:!0,content:n.createElement("div",{className:b.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:b.documentationHeader},"Available Math functions"),n.createElement("div",{className:b.documentationFunctions},n.createElement(d,{name:"abs",description:"returns the absolute value of its argument which can be a number or a series"}),n.createElement(d,{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(d,{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(d,{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(d,{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(d,{name:"log",description:"returns the natural logarithm of its argument, which can be a number or a series"}),n.createElement(d,{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(d,{name:"round",description:"returns a rounded integer value. It's able to operate on series or escalar values."}),n.createElement(d,{name:"ceil",description:"rounds the number up to the nearest integer value. It's able to operate on series or escalar values."}),n.createElement(d,{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(s.B,{gap:1,direction:"row"},n.createElement(c.I,{name:"book-open"})," Math operator"),footer:n.createElement("div",null,"See our additional documentation on"," ",n.createElement("a",{className:b.documentationLink,target:"_blank",href:"https://grafana.com/docs/grafana/latest/panels/query-a-data-source/use-expressions-to-manipulate-data/about-expressions/#math",rel:"noreferrer"},n.createElement(c.I,{size:"xs",name:"external-link-alt"})," Math expressions"),"."),closeButton:!0,placement:"bottom-start"},n.createElement("div",{className:b.info},"Expression ",n.createElement(c.I,{name:"info-circle"})))),labelWidth:m,grow:!0,shrink:!0},n.createElement(i.f,{value:v.expression,onChange:D,rows:1,placeholder:l,onBlur:C,style:{minWidth:250,lineHeight:"26px",minHeight:32}})))},d=({name:m,description:a})=>{const v=(0,o.of)(p);return n.createElement(n.Fragment,null,n.createElement("span",{className:v.name},m),n.createElement("span",{className:v.description},a))},h=m=>({documentationHeader:(0,t.css)` font-size: ${m.typography.h5.fontSize}; font-weight: ${m.typography.h5.fontWeight}; `,documentationLink:(0,t.css)` color: ${m.colors.text.link}; `,documentationContainer:(0,t.css)` display: flex; flex: 1; flex-direction: column; gap: ${m.spacing(2)}; padding: ${m.spacing(1)} ${m.spacing(2)}; `,documentationFunctions:(0,t.css)` display: grid; grid-template-columns: max-content auto; column-gap: ${m.spacing(2)}; `,info:(0,t.css)` display: flex; flex-direction: row; align-items: center; cursor: pointer; gap: ${m.spacing(1)}; `}),p=m=>({name:(0,t.css)` font-weight: ${m.typography.fontWeightBold}; `,description:(0,t.css)` font-size: ${m.typography.bodySmall.fontSize}; color: ${m.colors.text.disabled}; `})},1712:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>u});var t=e(96540),n=e(14186),o=e(10354),s=e(39268),r=e(88323),g=e(66718);const u=({labelWidth:c="auto",onChange:i,refIds:l,query:f})=>{const d=g.Cu.find(b=>b.value===f.reducer),h=b=>{i({...f,expression:b.value})},p=b=>{i({...f,reducer:b.value})},m=b=>{i({...f,settings:b})},a=b=>{let C;switch(b.value){case g.Mt.ReplaceNonNumbers:let y=0;f.settings?.mode===g.Mt.ReplaceNonNumbers&&(y=f.settings?.replaceWithValue??0),C={mode:g.Mt.ReplaceNonNumbers,replaceWithValue:y};break;default:C={mode:b.value}}m(C)},v=b=>{const C=b.currentTarget.valueAsNumber;m({mode:g.Mt.ReplaceNonNumbers,replaceWithValue:C??0})},E=f.settings?.mode??g.Mt.Strict,D=()=>{if(E===g.Mt.ReplaceNonNumbers)return t.createElement(n.I,{label:"Replace With",labelWidth:c},t.createElement(o.p,{type:"number",width:10,onChange:v,value:f.settings?.replaceWithValue??0}))};return t.createElement(t.Fragment,null,t.createElement(s.C,null,t.createElement(n.I,{label:"Input",labelWidth:c},t.createElement(r.l6,{onChange:h,options:l,value:f.expression,width:"auto"}))),t.createElement(s.C,null,t.createElement(n.I,{label:"Function",labelWidth:c},t.createElement(r.l6,{options:g.Cu,value:d,onChange:p,width:20})),t.createElement(n.I,{label:"Mode",labelWidth:c},t.createElement(r.l6,{onChange:a,options:g.HZ,value:E,width:25})),D()))}},34263:(Q,A,e)=>{"use strict";e.d(A,{C:()=>u});var t=e(96540),n=e(39268),o=e(14186),s=e(88323),r=e(10354),g=e(66718);const u=({labelWidth:c="auto",onChange:i,refIds:l,query:f})=>{const d=g.PN.find(E=>E.value===f.downsampler),h=g.iX.find(E=>E.value===f.upsampler),p=E=>{i({...f,window:E.target.value})},m=E=>{i({...f,expression:E.value})},a=E=>{i({...f,downsampler:E.value})},v=E=>{i({...f,upsampler:E.value})};return t.createElement(t.Fragment,null,t.createElement(n.C,null,t.createElement(o.I,{label:"Input",labelWidth:c},t.createElement(s.l6,{onChange:m,options:l,value:f.expression,width:20}))),t.createElement(n.C,null,t.createElement(o.I,{label:"Resample to",labelWidth:c,tooltip:"10s, 1m, 30m, 1h"},t.createElement(r.p,{onChange:p,value:f.window,width:15})),t.createElement(o.I,{label:"Downsample"},t.createElement(s.l6,{options:g.PN,value:d,onChange:a,width:25})),t.createElement(o.I,{label:"Upsample"},t.createElement(s.l6,{options:g.iX,value:h,onChange:v,width:25}))))}},76658:(Q,A,e)=>{"use strict";e.d(A,{O:()=>I});var t=e(32196),n=e(96540),o=e(46819),s=e(40845),r=e(39268),g=e(14186),u=e(88323),c=e(9261),i=e(10354),l=e(15292),f=e(2913),d=e(55907),h=e(66718),p=e(30038);const m=(0,p.VP)("thresold/updateRefId"),a=(0,p.VP)("thresold/updateThresholdType"),v=(0,p.VP)("thresold/updateThresholdParams"),E=(0,p.VP)("thresold/updateHysteresis"),D=(0,p.VP)("thresold/updateUnloadParams"),b=(0,p.vy)({type:h.Tz.threshold,refId:"",conditions:[]},O=>{O.addCase(m,(P,L)=>{P.expression=L.payload}),O.addCase(a,(P,L)=>{const U=L.payload.evalFunction,R=L.payload.onError;if(P.conditions[0].evaluator.type=U,!!P.conditions[0].unloadEvaluator){const H=C(P.conditions[0].evaluator.type);R&&R(void 0),P.conditions[0].evaluator.type=U;const w={type:H,params:P.conditions[0].evaluator?.params??[0,0]};P.conditions[0].unloadEvaluator=w}}),O.addCase(v,(P,L)=>{const{param:U,index:R}=L.payload;P.conditions[0].evaluator.params[R]=U}),O.addCase(E,(P,L)=>{const{hysteresisChecked:U,onError:R}=L.payload;U?P.conditions[0].unloadEvaluator={type:C(P.conditions[0].evaluator.type),params:P.conditions[0].evaluator?.params??[0,0]}:(P.conditions[0].unloadEvaluator=void 0,R&&R(void 0))}),O.addCase(D,(P,L)=>{const{param:U,index:R,onError:B}=L.payload;P.conditions[0].unloadEvaluator?P.conditions[0].unloadEvaluator.params[R]=U:P.conditions[0].unloadEvaluator={type:C(P.conditions[0].evaluator.type),params:P.conditions[0].evaluator?.params??[0,0]};const H=y(P.conditions[0]),{errorMsg:w,errorMsgFrom:N,errorMsgTo:V}=H??{};B&&B(w||N||V)})});function C(O){return O===d.p.IsAbove?d.p.IsBelow:O===d.p.IsBelow?d.p.IsAbove:O===d.p.IsWithinRange?d.p.IsOutsideRange:O===d.p.IsOutsideRange?d.p.IsWithinRange:d.p.IsBelow}function y(O){const{unloadEvaluator:P,evaluator:L}=O;if(!L)return;if(P?.params[0]===void 0||Number.isNaN(P?.params[0]))return{errorMsg:"This value cannot be empty"};const{type:U,params:R}=L,{params:B}=P;if(U===d.p.IsWithinRange||U===d.p.IsOutsideRange){if(B[0]===void 0||Number.isNaN(B[0]))return{errorMsgFrom:"This value cannot be empty"};if(B[1]===void 0||Number.isNaN(B[1]))return{errorMsgTo:"This value cannot be empty"}}const[H,w]=P.params,[N,V]=R;switch(U){case d.p.IsAbove:if(H>N)return{errorMsg:`Enter a number less than or equal to ${N}`};break;case d.p.IsBelow:if(H<N)return{errorMsg:`Enter a number more than or equal to ${N}`};break;case d.p.IsOutsideRange:if(H<N)return{errorMsgFrom:`Enter a number more than or equal to ${N}`};if(w>V)return{errorMsgTo:`Enter a number less than or equal to ${V}`};break;case d.p.IsWithinRange:if(H>N)return{errorMsgFrom:`Enter a number less than or equal to ${N}`};if(w<V)return{errorMsgTo:`Enter a number be more than or equal to ${V}`};break;default:throw new Error(`evaluator function type ${U} not supported.`)}}const M=d.p.IsAbove,T={type:"query",evaluator:{type:M,params:[0,0]},query:{params:[]},reducer:{params:[],type:"last"}},I=({labelWidth:O,onChange:P,refIds:L,query:U,onError:R,useHysteresis:B=!1})=>{const H=(0,s.of)(S),w={...U,conditions:U.conditions?.length?U.conditions:[T]},[N,V]=(0,n.useReducer)(b,w),G=N.conditions[0],_=h.zd.find(J=>J.value===N.conditions[0].evaluator?.type),K=J=>{V(m(J.value))};(0,n.useEffect)(()=>{N&&P(N)},[N]);const j=J=>{V(a({evalFunction:J.value??M,onError:R}))},k=(J,ne)=>{V(v({param:parseFloat(J.currentTarget.value),index:ne}))},Y=G.evaluator.type===d.p.IsWithinRange||G.evaluator.type===d.p.IsOutsideRange,ee=!!f.$W.featureToggles?.recoveryThreshold&&B;return n.createElement(n.Fragment,null,n.createElement(r.C,null,n.createElement(g.I,{label:"Input",labelWidth:O},n.createElement(u.l6,{onChange:K,options:L,value:U.expression,width:20}))),n.createElement(r.C,null,n.createElement(c.f,{className:H.buttonSelectText,options:h.zd,onChange:j,value:_}),Y?n.createElement(n.Fragment,null,n.createElement(i.p,{type:"number",width:10,onChange:J=>k(J,0),defaultValue:G.evaluator.params[0]}),n.createElement("div",{className:H.button},"TO"),n.createElement(i.p,{type:"number",width:10,onChange:J=>k(J,1),defaultValue:G.evaluator.params[1]})):n.createElement(i.p,{type:"number",width:10,onChange:J=>k(J,0),defaultValue:G.evaluator.params[0]||0})),ee&&n.createElement(re,{isRange:Y,onError:R}));function re({isRange:J,onError:ne}){const q=!!G.unloadEvaluator,te=ie=>{V(E({hysteresisChecked:ie.currentTarget.checked,onError:ne})),oe.current=!0},oe=n.useRef(!0),ue=()=>{oe.current=!1};return n.createElement("div",{className:H.hysteresis},n.createElement("div",{onMouseDown:ue},n.createElement(l.K,{showLabel:!0,label:"Custom recovery threshold",value:q,onChange:te,className:H.switch})),q&&n.createElement(x,{isRange:J,condition:G,onError:ne,dispatch:V,allowOnblur:oe}))}};function x({isRange:O,condition:P,onError:L,dispatch:U,allowOnblur:R}){const B=(0,s.of)(S),H=(j,k)=>{const Y=parseFloat(j.currentTarget.value);U(D({param:Y,index:k,onError:L}))},w=y(P),{errorMsg:N,errorMsgFrom:V,errorMsgTo:G}=w??{};if(O)return n.createElement(_,{allowOnblur:R});return n.createElement(K,{allowOnblur:R});function _({allowOnblur:j}){return P.evaluator.type===d.p.IsWithinRange?n.createElement(r.C,{className:B.hysteresis},n.createElement(g.I,{label:"Stop alerting when outside range",labelWidth:"auto"},n.createElement(o.B,{direction:"row",gap:0},n.createElement("div",{className:B.range},n.createElement(g.I,{invalid:!!V,error:V,className:B.noMargin},n.createElement(i.p,{type:"number",width:10,onBlur:k=>j.current&&H(k,0),defaultValue:P.unloadEvaluator?.params[0]}))),n.createElement("div",{className:B.button},"TO"),n.createElement("div",{className:B.range},n.createElement(g.I,{invalid:!!G,error:G},n.createElement(i.p,{type:"number",width:10,onBlur:k=>j.current&&H(k,1),defaultValue:P.unloadEvaluator?.params[1]})))))):n.createElement(r.C,{className:B.hysteresis},n.createElement(g.I,{label:"Stop alerting when inside range",labelWidth:"auto"},n.createElement(o.B,{direction:"row",gap:0},n.createElement("div",{className:B.range},n.createElement(g.I,{invalid:!!V,error:V},n.createElement(i.p,{type:"number",width:10,onBlur:k=>j.current&&H(k,0),defaultValue:P.unloadEvaluator?.params[0]}))),n.createElement("div",{className:B.button},"TO"),n.createElement("div",{className:B.range},n.createElement(g.I,{invalid:!!G,error:G},n.createElement(i.p,{type:"number",width:10,onBlur:k=>j.current&&H(k,1),defaultValue:P.unloadEvaluator?.params[1]}))))))}function K({allowOnblur:j}){return P.evaluator.type===d.p.IsAbove?n.createElement(r.C,{className:B.hysteresis},n.createElement(g.I,{label:"Stop alerting when below",labelWidth:"auto",invalid:!!N,error:N},n.createElement(i.p,{type:"number",width:10,onBlur:k=>{j.current&&H(k,0)},defaultValue:P.unloadEvaluator?.params[0]}))):n.createElement(r.C,{className:B.hysteresis},n.createElement(g.I,{label:"Stop alerting when above",labelWidth:"auto",invalid:!!N,error:N},n.createElement(i.p,{type:"number",width:10,onBlur:k=>{j.current&&H(k,0)},defaultValue:P.unloadEvaluator?.params[0]})))}}const S=O=>({buttonSelectText:(0,t.css)({color:O.colors.primary.text,fontSize:O.typography.bodySmall.fontSize,textTransform:"uppercase",padding:`0 ${O.spacing(1)}`}),button:(0,t.css)({height:"32px",color:O.colors.primary.text,fontSize:O.typography.bodySmall.fontSize,textTransform:"uppercase",display:"flex",alignItems:"center",borderRadius:O.shape.radius.default,fontWeight:O.typography.fontWeightBold,border:`1px solid ${O.colors.border.medium}`,whiteSpace:"nowrap",padding:`0 ${O.spacing(1)}`,backgroundColor:O.colors.background.primary}),range:(0,t.css)({width:"min-content"}),hysteresis:(0,t.css)({marginTop:O.spacing(2)}),switch:(0,t.css)({paddingLeft:O.spacing(1)}),noMargin:(0,t.css)({margin:0})})},69437:(Q,A,e)=>{"use strict";e.d(A,{f:()=>o});var t=e(26657),n=e(66718);const o=s=>{if(!s)return!1;if((0,t.s9)(s.datasource))return!0;const r=s;return typeof r.type!="string"?!1:Object.values(n.Tz).includes(r.type)}},66718:(Q,A,e)=>{"use strict";e.d(A,{Cu:()=>u,HZ:()=>i,Mt:()=>c,NI:()=>r,PN:()=>l,Tz:()=>s,Uj:()=>o,iX:()=>f,uQ:()=>g,zd:()=>d});var t=e(75059),n=e(55907);const o="__expr__";var s=(h=>(h.math="math",h.reduce="reduce",h.resample="resample",h.classic="classic_conditions",h.threshold="threshold",h))(s||{});const r=h=>{switch(h){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."}],u=[{value:t.gy.min,label:"Min",description:"Get the minimum value"},{value:t.gy.max,label:"Max",description:"Get the maximum value"},{value:t.gy.mean,label:"Mean",description:"Get the average value"},{value:t.gy.sum,label:"Sum",description:"Get the sum of all values"},{value:t.gy.count,label:"Count",description:"Get the number of values"},{value:t.gy.last,label:"Last",description:"Get the last value"}];var c=(h=>(h.Strict="",h.ReplaceNonNumbers="replaceNN",h.DropNonNumbers="dropNN",h))(c||{});const i=[{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"}],l=[{value:t.gy.last,label:"Last",description:"Fill with the last value"},{value:t.gy.min,label:"Min",description:"Fill with the minimum value"},{value:t.gy.max,label:"Max",description:"Fill with the maximum value"},{value:t.gy.mean,label:"Mean",description:"Fill with the average value"},{value:t.gy.sum,label:"Sum",description:"Fill with the sum of all values"}],f=[{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"}],d=[{value:n.p.IsAbove,label:"Is above"},{value:n.p.IsBelow,label:"Is below"},{value:n.p.IsWithinRange,label:"Is within range"},{value:n.p.IsOutsideRange,label:"Is outside range"}]},76942:(Q,A,e)=>{"use strict";e.d(A,{P:()=>r,r:()=>s});var t=e(75059),n=e(55907),o=e(66718);const s=g=>{switch(g.type){case o.Tz.reduce:g.reducer||(g.reducer=t.gy.mean);break;case o.Tz.resample:g.downsampler||(g.downsampler=t.gy.mean),g.upsampler||(g.upsampler="fillna"),g.reducer=void 0;break;case o.Tz.math:g.expression=void 0;break;case o.Tz.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.p.IsAbove}}},71101:(Q,A,e)=>{"use strict";e.d(A,{Cg:()=>u,Fk:()=>i,R4:()=>d,Rj:()=>g,pq:()=>c});var t=e(32264),n=e(44836),o=e(16233),s=e(36689),r=e(80348);const g="manage-folder",u=p=>`folder-dashboards-${p}`,c=p=>`folder-library-panels-${p}`,i=p=>`folder-alerting-${p}`,l=p=>`folder-permissions-${p}`,f=p=>`folder-settings-${p}`;function d(p,m=p.parents){const a={icon:"folder",id:g,subTitle:(0,s.o)("manage-folder"),url:p.url,text:p.title,children:[{active:!1,icon:"apps",id:u(p.uid),text:(0,n.t)("browse-dashboards.manage-folder-nav.dashboards","Dashboards"),url:p.url}]};if(m&&m.length>0){const v=m[m.length-1],E=m.slice(0,m.length-1);a.parentItem=d(v,E)}return a.children.push({active:!1,icon:"library-panel",id:c(p.uid),text:(0,n.t)("browse-dashboards.manage-folder-nav.panels","Panels"),url:`${p.url}/library-panels`}),o.TP.hasPermission(r.AccessControlAction.AlertingRuleRead)&&(t.$.unifiedAlertingEnabled||t.$.featureToggles.alertingPreviewUpgrade)&&a.children.push({active:!1,icon:"bell",id:i(p.uid),text:(0,n.t)("browse-dashboards.manage-folder-nav.alert-rules","Alert rules"),url:`${p.url}/alerting`}),a}function h(p){const m=d({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 m.children[p].active=!0,{main:m,node:m.children[p]}}},54650:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>i,jl:()=>g});var t=e(30038),n=e(55314);const o={id:0,uid:"loading",title:"loading",url:"",canSave:!1,canDelete:!1,hasChanged:!1,version:1},s=(l,f)=>({...l,...f.payload,hasChanged:!1}),r=(0,t.Z0)({name:"folder",initialState:o,reducers:{loadFolder:s,setFolderTitle:(l,f)=>({...l,title:f.payload,hasChanged:f.payload.trim().length>0})},extraReducers:l=>{l.addMatcher(n.vZ.getFolder.matchFulfilled,s)}}),{loadFolder:g,setFolderTitle:u}=r.actions,i={folder:r.reducer}},84350:(Q,A,e)=>{"use strict";e.d(A,{G:()=>c});var t=e(32196),n=e(96540),o=e(40845),s=e(88323),r=e(42418),g=e(67140);const u=[{label:"Countries",description:"Lookup countries by name, two letter code, or three letter code",value:g.fx},{label:"USA States",description:"Lookup states by name or 2 ",value:"public/gazetteer/usa-states.json"},{label:"Airports",description:"Lookup airports by id or code",value:"public/gazetteer/airports.geojson"}],c=({value:l,onChange:f,context:d,item:h})=>{const p=(0,o.of)(i),[m,a]=(0,n.useState)(),v=h.settings;(0,n.useEffect)(()=>{async function b(){const C=await(0,g.q3)(l);a(C)}b()},[l,a]);const{current:E,options:D}=(0,n.useMemo)(()=>{let b=v?.options?[...v.options]:[...u],C=b?.find(y=>y.value===m?.path);return!C&&m&&(C={label:m.path,value:m.path},b.push(C)),{options:b,current:C}},[m,v?.options]);return n.createElement(n.Fragment,null,n.createElement(s.l6,{value:E,options:D,onChange:b=>f(b.value),allowCustomValue:!0,formatCreateLabel:b=>`Load from URL: ${b}`}),m&&n.createElement(n.Fragment,null,m.error&&n.createElement(r.F,{title:m.error,severity:"warning"}),m.count&&n.createElement("div",{className:p.keys},n.createElement("b",null,"(",m.count,")"),m.examples(10).map(b=>n.createElement("span",{key:b},b,",")),m.count>10&&" ...")))},i=()=>({keys:(0,t.css)` margin-top: 4px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; > span { margin-left: 4px; } `})},61983:(Q,A,e)=>{"use strict";e.d(A,{G:()=>v});var t=e(11261),n=e(52622),o=e(84350),s=e(32196),r=e(96540),g=e(13544),u=e(40845),c=e(42418),i=e(14578),l=e(88323),f=e(66864),d=e(31484);const h=[{value:n.aG.Auto,label:"Auto",ariaLabel:g.Tp.components.Transforms.SpatialOperations.location.autoOption,description:"Automatically identify location data based on default field names"},{value:n.aG.Coords,label:"Coords",ariaLabel:g.Tp.components.Transforms.SpatialOperations.location.coords.option,description:"Specify latitude and longitude fields"},{value:n.aG.Geohash,label:"Geohash",ariaLabel:g.Tp.components.Transforms.SpatialOperations.location.geohash.option,description:"Specify geohash field"},{value:n.aG.Lookup,label:"Lookup",ariaLabel:g.Tp.components.Transforms.SpatialOperations.location.lookup.option,description:"Specify Gazetteer and lookup field"}],p="https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/geomap/#location",m=({value:E,onChange:D,context:b,item:C})=>{const[y,M]=(0,r.useState)();(0,r.useEffect)(()=>{C.settings?.source&&C.settings?.data?.length&&C.settings.data[0]&&(0,d.nE)(C.settings.source).then(x=>{C.settings&&C.settings.data&&M((0,d.FM)(C.settings.data[0],x))})},[C.settings]);const T=(0,u.of)(a),I=()=>{if(y){if(y.warning)return r.createElement(c.F,{title:y.warning,severity:"warning",buttonContent:r.createElement(i.I,{name:"question-circle",size:"xl"}),className:T.alert,onRemove:()=>{const x=window.open(p,"_blank","noopener,noreferrer");x&&(x.opener=null)}});if(E===n.aG.Auto&&y.description)return r.createElement("span",null,y.description)}return null};return r.createElement(r.Fragment,null,r.createElement(l.l6,{options:h,value:E,onChange:x=>{D(x.value)}}),r.createElement(f.Gy,{className:T.hGroup},I()))},a=E=>({alert:(0,s.css)` & div { padding: 4px; } margin-bottom: 0px; margin-top: 5px; padding: 2px; `,hGroup:(0,s.css)` & div { width: 100%; } `});function v(E,D,b,C,y){switch(b.addCustomEditor({id:"modeEditor",path:`${D}mode`,name:"Location Mode",editor:m,settings:{data:y,source:C}}),C?.mode){case n.aG.Coords:b.addFieldNamePicker({path:`${D}latitude`,name:"Latitude field",settings:{filter:M=>M.type===t.PU.number,noFieldsMessage:"No numeric fields found"}}).addFieldNamePicker({path:`${D}longitude`,name:"Longitude field",settings:{filter:M=>M.type===t.PU.number,noFieldsMessage:"No numeric fields found"}});break;case n.aG.Geohash:b.addFieldNamePicker({path:`${D}geohash`,name:"Geohash field",settings:{filter:M=>M.type===t.PU.string,noFieldsMessage:"No strings fields found"}});break;case n.aG.Lookup:b.addFieldNamePicker({path:`${D}lookup`,name:"Lookup field",settings:{filter:M=>M.type===t.PU.string,noFieldsMessage:"No strings fields found"}}).addCustomEditor({id:"gazetteer",path:`${D}gazetteer`,name:"Gazetteer",editor:o.G})}}},96606:(Q,A,e)=>{"use strict";e.d(A,{RA:()=>d,XR:()=>h,Dc:()=>f,qy:()=>i,Pz:()=>l});var t=e(44294),n=e(34338),o=e(11217),s=e(22796),r=e(11261),g=e(78134);function u(m){if(!m?.length)return;const a=[16,8,4,2,1],v="0123456789bcdefghjkmnpqrstuvwxyz";let E=!0;const D=[],b=[];D[0]=-90,D[1]=90,b[0]=-180,b[1]=180;let C;m.split("").forEach(T=>{C=v.indexOf(T),a.forEach(I=>{c(E?b:D,C,I),E=!E})});const y=(D[0]+D[1])/2;return[(b[0]+b[1])/2,y]}function c(m,a,v){a&v?m[0]=(m[0]+m[1])/2:m[1]=(m[0]+m[1])/2}function i(m){return{name:m.name??"Point",type:r.PU.geo,values:m.values.map(a=>{const v=u(a);if(v)return new t.A((0,s.Rb)(v))}),config:p}}function l(m,a){const v=new Array(m.values.length);for(let E=0;E<m.values.length;E++){const D=m.values[E],b=a.values[E];D===null||b===null||(v[E]=new t.A((0,s.Rb)([D,b])))}return{name:"Point",type:r.PU.geo,values:v,config:p}}function f(m,a){const v=a.values.length,E=new Array(v);for(let D=0;D<v;D++)E[D]=m.find(a.values[D])?.geometry();return{name:"Geometry",type:r.PU.geo,values:E,config:p}}function d(m,a){const v=m.values,E=a.values;if(!v||!E)throw"missing src/dest";if(v.length!==E.length)throw"Source and destination field lengths do not match";const D=m.values.length,b=new Array(D);for(let C=0;C<D;C++){const y=v[C],M=E[C];y&&M?b[C]=new n.A([y,M]):y?b[C]=y:M&&(b[C]=M)}return{name:"Geometry",type:r.PU.geo,values:b,config:p}}function h(m,a){const v=m.values,E=a.values;if(!v||!E)throw"missing src/dest";if(v.length!==E.length)throw"Source and destination field lengths do not match";const D=m.values.length,b=new Array(D);for(let C=0;C<D;C++){const y=v[C],M=E[C];y&&M&&(b[C]=new o.A([(0,g.EX)(y),(0,g.EX)(M)]))}return{name:"Geometry",type:r.PU.geo,values:b,config:p}}const p=Object.freeze({custom:{hideFrom:{tooltip:!0}}})},67140:(Q,A,e)=>{"use strict";e.d(A,{fx:()=>m,q3:()=>a});var t=e(70915),n=e(44294),o=e(14236),s=e(11261),r=e(17172),g=e(11365);function u(v){const E=new g.A().readFeatures(v,{featureProjection:"EPSG:3857"}),D=E.length,b=new Array(D).fill(null),C=[],y=new Map,M=S=>{let O=y.get(S);return O||(O={types:new Set,values:new Array(D).fill(null),count:0},C.push(S),y.set(S,O)),O},T=(...S)=>{for(const O of S)if(!y.has(O))return O;return"___"+S[0]},I={types:new Set,values:new Array(D).fill(null),count:0};for(let S=0;S<D;S++){const O=E[S];b[S]=O.getGeometry();const P=O.getId();P!=null&&(I.values[S]=P,I.types.add((0,o.oE)(P)),I.count++);for(const L of O.getKeys()){const U=O.get(L);if(U===b[S]||U==null)continue;const R=M(L);R.values[S]=U,R.types.add((0,o.oE)(U)),R.count++}}const x=[];if(I.count>0){const S=c(I);x.push({name:T("id","_id","__id"),type:S,values:I.values,config:{}})}x.push({name:T("geo","geometry"),type:s.PU.geo,values:b,config:{}});for(const S of C){const O=y.get(S);if(!O)continue;const P=c(O);x.push({name:S,type:P,values:O.values,config:{}})}return{fields:x,length:D}}function c(v){return v.count<1?s.PU.other:v.types.size>1?(v.values=v.values.map(E=>E!=null?`${E}`:E),s.PU.string):v.types.values().next().value}var i=e(96606),l=e(22796);function f(v,E){let D=0;const b=new Map;for(const C of E){const y=new n.A((0,l.Rb)([C.longitude,C.latitude])),M={point:()=>y,geometry:()=>y};if(C.name&&(b.set(C.name,M),b.set(C.name.toUpperCase(),M)),C.key&&(b.set(C.key,M),b.set(C.key.toUpperCase(),M)),C.keys)for(const T of C.keys)b.set(T,M),b.set(T.toUpperCase(),M);D++}return{path:v,find:C=>{let y=b.get(C);return!y&&typeof C=="string"&&(y=b.get(C.toUpperCase())),y},count:D,examples:C=>{const y=[];if(b.size<1)y.push("no values found");else for(const M of b.keys())if(y.push(M),y.length>=C)break;return y}}}function d(v,E){let D;if(Array.isArray(E)){const b=E[0];if(b.latitude&&b.longitude&&(b.key||b.keys))return f(v,E)}else Array.isArray(E?.features)&&E?.type==="FeatureCollection"&&(D=u(E));if(!D)try{D=(0,o.Vc)(E)}catch(b){return{path:v,error:`${b}`,find:C=>{},examples:C=>[]}}return h(D,{path:v})}function h(v,E){const D=[];let b,C,y,M,T;for(const S of v.fields)if(S.type===s.PU.geo&&(b=S),!T&&S.type===s.PU.string&&(T=S),S.name){E.keys&&E.keys.includes(S.name)&&D.push(S);const O=S.name.toUpperCase();switch(O){case"LAT":case"LATITUTE":C=S;break;case"LON":case"LNG":case"LONG":case"LONGITUE":y=S;break;case"GEOHASH":M=S;break;case"ID":case"UID":case"KEY":case"CODE":E.keys||D.push(S);break;default:E.keys||(O.endsWith("_ID")||O.endsWith("_CODE"))&&D.push(S)}}!D.length&&T&&D.push(T);let I=!1;b?I=b.values[0]?.getType()==="Point":M?(b=(0,i.qy)(M),I=!0):C&&y&&(b=(0,i.Pz)(y,C),I=!0);const x=new Map;return D.forEach(S=>{S.values.forEach((O,P)=>{const L=`${O}`;x.set(L.toUpperCase(),P),x.set(L,P)})}),{path:E.path,find:S=>{const O=x.get(S);if(O!=null){const P=b?.values[O];return{frame:v,index:O,point:()=>!P||I?P:new n.A((0,t.q1)(P.getExtent())),geometry:()=>P}}},examples:S=>{const O=[];for(let P of x.keys())if(O.push(P),O.length>S)break;return O},frame:()=>v,count:v.length}}const p={},m="public/gazetteer/countries.json";async function a(v){v||(v=m);let E=p[v];if(!E){try{const D=await(0,r.AI)().get(v);E=d(v,D)}catch(D){console.warn("Error loading placename lookup",v,D),E={path:v,error:"Error loading URL",find:b=>{},examples:b=>[]}}p[v]=E}return E}},31484:(Q,A,e)=>{"use strict";e.d(A,{FM:()=>h,nE:()=>f});var t=e(28240),n=e(11261),o=e(85200),s=e(1173),r=e(52622),g=e(96606),u=e(67140);function c(p){return m=>{for(const a of m.fields)if(p(a,m,[]))return a}}function i(p){return m=>{for(const a of m.fields){if(p.has(a.name.toLowerCase()))return a;const v=(0,t.Ct)(a,m);if(p.has(v))return a}}}const l={mode:r.aG.Auto,geohash:i(new Set(["geohash"])),latitude:i(new Set(["latitude","lat"])),longitude:i(new Set(["longitude","lon","lng"])),h3:i(new Set(["h3"])),wkt:i(new Set(["wkt"])),lookup:i(new Set(["lookup"])),geo:p=>p.fields.find(m=>m.type===n.PU.geo)};async function f(p){const m={...l,mode:p?.mode??r.aG.Auto};switch(m.gazetteer=await(0,u.q3)(p?.gazetteer),m.mode){case r.aG.Geohash:p?.geohash?m.geohash=c((0,o.NS)({id:s.Ct.byName,options:p.geohash})):m.geohash=()=>{};break;case r.aG.Lookup:const a=p?.lookup?.length?(0,o.NS)({id:s.Ct.byName,options:p.lookup}):(0,o.NS)({id:s.Ct.byType,options:n.PU.string});m.lookup=c(a);break;case r.aG.Coords:p?.latitude?m.latitude=c((0,o.NS)({id:s.Ct.byName,options:p.latitude})):m.latitude=()=>{},p?.longitude?m.longitude=c((0,o.NS)({id:s.Ct.byName,options:p.longitude})):m.longitude=()=>{};break}return m}function d(p,m){const a={mode:m.mode??r.aG.Auto};if(a.mode===r.aG.Auto){if(a.geo=m.geo(p),a.geo)return a;if(a.latitude=m.latitude(p),a.longitude=m.longitude(p),a.latitude&&a.longitude)return a.mode=r.aG.Coords,a;if(a.geohash=m.geohash(p),a.geohash)return a.mode=r.aG.Geohash,a;if(a.lookup=m.lookup(p),a.lookup)return a.mode=r.aG.Lookup,a}switch(a.mode){case r.aG.Coords:a.latitude=m.latitude(p),a.longitude=m.longitude(p);break;case r.aG.Geohash:a.geohash=m.geohash(p);break;case r.aG.Lookup:a.lookup=m.lookup(p);break}return a}function h(p,m){const a=d(p,m);switch(a.mode){case r.aG.Auto:return a.geo?{field:a.geo}:{warning:"Unable to find location fields"};case r.aG.Coords:return a.latitude&&a.longitude?{field:(0,g.Pz)(a.longitude,a.latitude),derived:!0,description:`${a.mode}: ${a.latitude.name}, ${a.longitude.name}`}:{warning:"Select latitude/longitude fields"};case r.aG.Geohash:return a.geohash?{field:(0,g.qy)(a.geohash),derived:!0,description:`${a.mode}`}:{warning:"Select geohash field"};case r.aG.Lookup:return a.lookup?m.gazetteer?{field:(0,g.Dc)(m.gazetteer,a.lookup),derived:!0,description:`${a.mode}: ${m.gazetteer.path}`}:{warning:"Gazetteer not found"}:{warning:"Select lookup field"}}return{warning:"unable to find geometry"}}},61453:(Q,A,e)=>{"use strict";e.d(A,{q:()=>P});var t=e(2543),n=e(96540),o=e(70713),s=e(18282),r=e(2514),g=e(90708),u=e(13544),c=e(14110),i=e(72574),l=e(55852),f=e(62930),d=e(77093),h=e(2913),p=e(44836),m=e(69147),a=e(28240),v=e(40845),E=e(66864),D=e(88575),b=e(88323),C=e(15292),y=e(7788),M=e(32196);const T=U=>(0,M.css)` padding: ${U.spacing(0,2)}; font-size: ${U.typography.bodySmall.fontSize}; color: ${U.colors.text.secondary}; overflow: hidden; text-overflow: ellipsis; `,I=({children:U})=>{const R=(0,v.of)(T);return n.createElement("div",{className:R},U)};var x=e(26323);const S=({options:U,actions:R,formattedDataDescription:B,onOptionsChange:H,hasTransformations:w,data:N,dataFrames:V,transformationOptions:G,selectedDataFrame:_,onDataFrameChange:K,downloadForExcel:j,toggleDownloadForExcel:k})=>{const Y=(0,v.of)(x.A);let ee=V;_===s.F.joinByField&&(ee=N);const re=ee.map((q,te)=>({value:te,label:`${(0,a.Ri)(q)} (${te})`})),J=[...G,...re];function ne(){let q="";if(!N)return q;const te=[];return _===s.F.joinByField?te.push((0,p.t)("dashboard.inspect-data.series-to-columns","Series joined by time")):N.length>1&&te.push((0,a.Ri)(N[_])),(U.withTransforms||U.withFieldConfig)&&(U.withTransforms&&te.push((0,p.t)("dashboard.inspect-data.panel-transforms","Panel transforms")),U.withTransforms&&U.withFieldConfig,U.withFieldConfig&&te.push((0,p.t)("dashboard.inspect-data.formatted","Formatted data"))),j&&te.push((0,p.t)("dashboard.inspect-data.excel-header","Excel header")),te.join(", ")}return n.createElement("div",{className:Y.dataDisplayOptions},n.createElement(y.u,{id:"Data options",index:0,title:(0,p.t)("dashboard.inspect-data.data-options","Data options"),headerElement:n.createElement(I,null,ne()),isOpen:!1,actions:R},n.createElement("div",{className:Y.options,"data-testid":"dataOptions"},n.createElement(E.gW,{spacing:"none"},N.length>1&&n.createElement(D.D,{label:(0,p.t)("dashboard.inspect-data.dataframe-label","Show data frame")},n.createElement(b.l6,{options:J,value:_,onChange:K,width:30,"aria-label":(0,p.t)("dashboard.inspect-data.dataframe-aria-label","Select dataframe")})),n.createElement(E.Gy,null,w&&H&&n.createElement(D.D,{label:(0,p.t)("dashboard.inspect-data.transformations-label","Apply panel transformations"),description:(0,p.t)("dashboard.inspect-data.transformations-description","Table data is displayed with transformations defined in the panel Transform tab.")},n.createElement(C.d,{value:!!U.withTransforms,onChange:()=>H({...U,withTransforms:!U.withTransforms})})),H&&n.createElement(D.D,{label:(0,p.t)("dashboard.inspect-data.formatted-data-label","Formatted data"),description:B||(0,p.t)("dashboard.inspect-data.formatted-data-description","Table data is formatted with options defined in the Field and Override tabs.")},n.createElement(C.d,{id:"formatted-data-toggle",value:!!U.withFieldConfig,onChange:()=>H({...U,withFieldConfig:!U.withFieldConfig})})),n.createElement(D.D,{label:(0,p.t)("dashboard.inspect-data.download-excel-label","Download for Excel"),description:(0,p.t)("dashboard.inspect-data.download-excel-description","Adds header to CSV for use with Excel")},n.createElement(C.d,{id:"excel-toggle",value:j,onChange:k})))))))};var O=e(80287);class P extends n.PureComponent{constructor(R){super(R),this.onExportLogsAsTxt=()=>{const{data:B,dataName:H,app:w}=this.props;(0,c.rR)("grafana_logs_download_logs_clicked",{app:w,format:"logs",area:"inspector"});const N=(0,m.HT)(B||[]);(0,O.Zy)(N,H)},this.onExportTracesAsJson=()=>{const{data:B,dataName:H,app:w}=this.props;if(B)for(const N of B){if(N.meta?.preferredVisualisationType!=="trace")continue;const V=(0,O.ek)(N,H+"-traces");(0,c.rR)("grafana_traces_download_traces_clicked",{app:w,grafana_version:h.$W.buildInfo.version,trace_format:V,location:"inspector"})}},this.onExportServiceGraph=()=>{const{data:B,dataName:H,app:w}=this.props;(0,c.rR)("grafana_traces_download_service_graph_clicked",{app:w,grafana_version:h.$W.buildInfo.version,location:"inspector"}),B&&(0,O.ny)(B,H)},this.onDataFrameChange=B=>{this.setState({transformId:B.value===s.F.joinByField?s.F.joinByField:s.F.noop,dataFrameIndex:typeof B.value=="number"?B.value:0,selectedDataFrame:B.value})},this.onToggleDownloadForExcel=()=>{this.setState(B=>({downloadForExcel:!B.downloadForExcel}))},this.state={selectedDataFrame:0,dataFrameIndex:0,transformId:s.F.noop,transformationOptions:L(),transformedData:R.data??[],downloadForExcel:!1}}componentDidUpdate(R,B){if(!this.props.data){this.setState({transformedData:[]});return}if(this.props.options.withTransforms){this.setState({transformedData:this.props.data});return}if(R.data!==this.props.data||B.transformId!==this.state.transformId){const H=this.state.transformationOptions.find(w=>w.value===this.state.transformId);if(H&&H.transformer.id!==s.F.noop){const w=this.state.selectedDataFrame,N=this.state.dataFrameIndex,V=(0,r.m)([H.transformer],this.props.data).subscribe(G=>{this.setState({transformedData:G,selectedDataFrame:w,dataFrameIndex:N},()=>V.unsubscribe())});return}this.setState({transformedData:this.props.data});return}}exportCsv(R,B){const{dataName:H}=this.props,{transformId:w}=this.state,N=R[this.state.dataFrameIndex];B&&(0,c.rR)("grafana_logs_download_clicked",{app:this.props.app,format:"csv"}),(0,O.EM)(N,H,{useExcelHeader:this.state.downloadForExcel},w)}getProcessedData(){const{options:R,panelPluginId:B,fieldConfig:H,timeZone:w}=this.props,N=this.state.transformedData;if(!R.withFieldConfig)return(0,g.K3)(N);let V=H??{defaults:{},overrides:[]};return B==="table"&&H&&(V=this.cleanTableConfigFromFieldConfig(H)),(0,g.we)({data:N,theme:h.$W.theme2,fieldConfig:V,timeZone:w,replaceVariables:(G,_,K)=>(0,i.w)().replace(G,_,K)})}cleanTableConfigFromFieldConfig(R){R=(0,t.cloneDeep)(R),R.defaults.custom={};for(const B of R.overrides)for(const H of B.properties)if(H.id.startsWith("custom.")){const w=B.properties.indexOf(H);B.properties.slice(w,1)}return R}renderActions(R,B,H,w){return n.createElement(n.Fragment,null,n.createElement(l.$n,{variant:"primary",onClick:()=>this.exportCsv(R,B),size:"sm"},n.createElement(p.x6,{i18nKey:"dashboard.inspect-data.download-csv"},"Download CSV")),B&&n.createElement(l.$n,{variant:"primary",onClick:this.onExportLogsAsTxt,size:"sm"},n.createElement(p.x6,{i18nKey:"dashboard.inspect-data.download-logs"},"Download logs")),H&&n.createElement(l.$n,{variant:"primary",onClick:this.onExportTracesAsJson,size:"sm"},n.createElement(p.x6,{i18nKey:"dashboard.inspect-data.download-traces"},"Download traces")),w&&n.createElement(l.$n,{variant:"primary",onClick:this.onExportServiceGraph,size:"sm"},n.createElement(p.x6,{i18nKey:"dashboard.inspect-data.download-service"},"Download service graph")))}render(){const{isLoading:R,options:B,data:H,formattedDataDescription:w,onOptionsChange:N,hasTransformations:V}=this.props,{dataFrameIndex:G,transformationOptions:_,selectedDataFrame:K,downloadForExcel:j}=this.state,k=(0,x.c)();if(R)return n.createElement("div",null,n.createElement(f.y,{inline:!0})," Loading");const Y=this.getProcessedData();if(!Y||!Y.length)return n.createElement("div",null,"No Data");const ee=Y[G]?G:0,re=Y[ee],J=Y.some(te=>te?.meta?.preferredVisualisationType==="logs"),ne=Y.some(te=>te?.meta?.preferredVisualisationType==="trace"),q=Y.some(te=>te?.meta?.preferredVisualisationType==="nodeGraph");return n.createElement("div",{className:k.wrap,"aria-label":u.Tp.components.PanelInspector.Data.content},n.createElement("div",{className:k.toolbar},n.createElement(S,{data:H,hasTransformations:V,options:B,dataFrames:Y,transformationOptions:_,selectedDataFrame:K,downloadForExcel:j,formattedDataDescription:w,onOptionsChange:N,onDataFrameChange:this.onDataFrameChange,toggleDownloadForExcel:this.onToggleDownloadForExcel,actions:this.renderActions(Y,J,ne,q)})),n.createElement("div",{className:k.content},n.createElement(o.Ay,null,({width:te,height:oe})=>te===0?null:n.createElement(d.X,{width:te,height:oe,data:re,showTypeIcons:!0}))))}}function L(){return[{value:s.F.joinByField,label:(0,p.t)("dashboard.inspect-data.transformation","Series joined by time"),transformer:{id:s.F.joinByField,options:{byField:void 0}}}]}},32067:(Q,A,e)=>{"use strict";e.d(A,{N:()=>p});var t=e(32196),n=e(96540),o=e(13544),s=e(44836),r=e(57875),g=e(11261),u=e(83195),c=e(40845);const i=({timeZone:a,name:v,stats:E})=>{const D=(0,c.$j)(),b=(0,c.of)(f);return!E||!E.length?null:n.createElement("div",{className:b.wrapper},n.createElement("div",{className:"section-heading"},v),n.createElement("table",{className:"filter-table width-30"},n.createElement("tbody",null,E.map((C,y)=>n.createElement("tr",{key:`${C.displayName}-${y}`},n.createElement("td",null,C.displayName),n.createElement("td",{className:b.cell},l(C,a,D)))))))};function l(a,v,E){const D=(0,r.J)({field:{type:g.PU.number,config:a},theme:E,timeZone:v});return(0,u.cN)(D(a.value))}const f=a=>({wrapper:(0,t.css)` padding-bottom: ${a.spacing(2)}; `,cell:(0,t.css)` text-align: right; `}),d=({name:a,traceIds:v})=>{const E=(0,c.of)(h);return v.length===0?null:n.createElement("div",{className:E.wrapper},n.createElement("div",{className:"section-heading"},a),n.createElement("table",{className:"filter-table width-30"},n.createElement("tbody",null,v.map((D,b)=>n.createElement("tr",{key:`${D}-${b}`},n.createElement("td",null,D))))))},h=a=>({wrapper:(0,t.css)` padding-bottom: ${a.spacing(2)}; `,cell:(0,t.css)` text-align: right; `}),p=({data:a,timeZone:v})=>{if(!a.request)return null;let E=[];const D=a.request.endTime?a.request.endTime-a.request.startTime:-1,b=a.timings?.dataProcessingTime||-1;let C=0;for(const x of a.series)C+=x.length;D>0&&E.push({displayName:(0,s.t)("dashboard.inspect-stats.request-time","Total request time"),value:D,unit:"ms"}),b>0&&E.push({displayName:(0,s.t)("dashboard.inspect-stats.processing-time","Data processing time"),value:b,unit:"ms"}),E.push({displayName:(0,s.t)("dashboard.inspect-stats.queries","Number of queries"),value:a.request.targets?.length??0}),E.push({displayName:(0,s.t)("dashboard.inspect-stats.rows","Total number rows"),value:C});let y=[];for(const x of a.series)x.meta&&x.meta.stats&&(y=y.concat(x.meta.stats));const M=(0,s.t)("dashboard.inspect-stats.table-title","Stats"),T=(0,s.t)("dashboard.inspect-stats.data-title","Data source stats"),I=(0,s.t)("dashboard.inspect-stats.data-traceids","Trace IDs");return n.createElement("div",{"aria-label":o.Tp.components.PanelInspector.Stats.content,className:m},n.createElement(i,{timeZone:v,name:M,stats:E}),n.createElement(i,{timeZone:v,name:T,stats:y}),n.createElement(d,{name:I,traceIds:a.traceIds??[]}))},m=(0,t.css)` height: 100%; overflow-y: scroll; `},90820:(Q,A,e)=>{"use strict";e.d(A,{e:()=>m});var t=e(32196),n=e(96540),o=e(64423),s=e(39070),r=e(13544),g=e(32264),u=e(67061),c=e(55852),i=e(10534),l=e(39558),f=e(24022),d=e(44836),h=e(27677),p=e(26323);class m extends n.PureComponent{constructor(v){super(v),this.subs=new o.yU,this.setFormattedJson=E=>{this.formattedJson=E},this.getTextForClipboard=()=>JSON.stringify(this.formattedJson,null,2),this.onToggleExpand=()=>{this.setState(E=>({...E,allNodesExpanded:!this.state.allNodesExpanded}))},this.onToggleMocking=()=>{this.setState(E=>({...E,isMocking:!this.state.isMocking}))},this.getNrOfOpenNodes=()=>this.state.allNodesExpanded===null?3:this.state.allNodesExpanded?20:1,this.state={executedQueries:[],allNodesExpanded:null,isMocking:!1,mockedResponse:"",response:{}}}componentDidMount(){this.subs.add(h.IB.getInspectorStream().subscribe({next:v=>{let E=!0;if(this.props.instanceId&&v?.requestId&&(E=v.requestId.startsWith(this.props.instanceId)),E)return this.onDataSourceResponse(v.response)}}))}componentDidUpdate(v){this.props.data!==v.data&&this.updateQueryList()}updateQueryList(){const{data:v}=this.props,E=v.series,D=[];if(E?.length){let b;E.forEach((C,y)=>{const M=C.meta?.executedQueryString;if(M){const T=C.refId||"?";b?.refId===T?(b.frames++,b.rows+=C.length):(b={refId:T,frames:0,rows:C.length,query:M},D.push(b))}})}this.setState({executedQueries:D})}componentWillUnmount(){this.subs.unsubscribe()}onDataSourceResponse(v){v.config?.hideFromInspector||(v={...v},v.headers&&delete v.headers,v.config&&(v.request=v.config,delete v.config,delete v.request.transformRequest,delete v.request.transformResponse,delete v.request.paramSerializer,delete v.request.jsonpCallbackParam,delete v.request.headers,delete v.request.requestId,delete v.request.inspect,delete v.request.retry,delete v.request.timeout),v.data&&(v.response=v.data,delete v.config,delete v.data,delete v.status,delete v.statusText,delete v.ok,delete v.url,delete v.redirected,delete v.type,delete v.$$config),this.setState({response:v}))}renderExecutedQueries(v){if(!v.length)return null;const E={refId:(0,t.css)` font-weight: ${g.$.theme.typography.weight.semibold}; color: ${g.$.theme.colors.textBlue}; margin-right: 8px; `};return n.createElement("div",null,v.map(D=>n.createElement(u.B,{key:D.refId,gap:1,direction:"column"},n.createElement("div",null,n.createElement("span",{className:E.refId},D.refId,":"),D.frames>1&&n.createElement("span",null,D.frames," frames, "),n.createElement("span",null,D.rows," rows")),n.createElement("pre",null,D.query))))}render(){const{allNodesExpanded:v,executedQueries:E,response:D}=this.state,{onRefreshQuery:b,data:C}=this.props,y=this.getNrOfOpenNodes(),M=(0,p.A)(g.$.theme2),T=Object.keys(D).length>0,I=C.state===s.Gu.Loading;return n.createElement("div",{className:M.wrap},n.createElement("div",{"aria-label":r.Tp.components.PanelInspector.Query.content},n.createElement("h3",{className:"section-heading"},"Query inspector"),n.createElement("p",{className:"small muted"},n.createElement(d.x6,{i18nKey:"inspector.query.description"},"Query inspector allows you to view raw request and response. To collect this data Grafana needs to issue a new query. Click refresh button below to trigger a new query."))),this.renderExecutedQueries(E),n.createElement("div",{className:M.toolbar},n.createElement(c.$n,{icon:"sync",onClick:b,"aria-label":r.Tp.components.PanelInspector.Query.refreshButton},n.createElement(d.x6,{i18nKey:"inspector.query.refresh"},"Refresh")),T&&v&&n.createElement(c.$n,{icon:"minus",variant:"secondary",className:M.toolbarItem,onClick:this.onToggleExpand},n.createElement(d.x6,{i18nKey:"inspector.query.collapse-all"},"Collapse all")),T&&!v&&n.createElement(c.$n,{icon:"plus",variant:"secondary",className:M.toolbarItem,onClick:this.onToggleExpand},n.createElement(d.x6,{i18nKey:"inspector.query.expand-all"},"Expand all")),T&&n.createElement(i.b,{getText:this.getTextForClipboard,className:M.toolbarItem,icon:"copy",variant:"secondary"},n.createElement(d.x6,{i18nKey:"inspector.query.copy-to-clipboard"},"Copy to clipboard")),n.createElement("div",{className:"flex-grow-1"})),n.createElement("div",{className:M.content},I&&n.createElement(l._,{text:"Loading query inspector..."}),!I&&T&&n.createElement(f.B,{json:D,open:y,onDidRender:this.setFormattedJson}),!I&&!T&&n.createElement("p",{className:"muted"},n.createElement(d.x6,{i18nKey:"inspector.query.no-data"},"No request and response collected yet. Hit refresh button"))))}}},26323:(Q,A,e)=>{"use strict";e.d(A,{A:()=>r,c:()=>s});var t=e(32196),n=e(3911),o=e(2913);const s=(0,n.N)(()=>r(o.$W.theme2)),r=g=>({wrap:(0,t.css)` display: flex; flex-direction: column; height: 100%; width: 100%; flex: 1 1 0; min-height: 0; `,toolbar:(0,t.css)` display: flex; width: 100%; flex-grow: 0; align-items: center; justify-content: flex-end; margin-bottom: ${g.v1.spacing.sm}; `,toolbarItem:(0,t.css)` margin-left: ${g.v1.spacing.md}; `,content:(0,t.css)` flex-grow: 1; height: 100%; `,editor:(0,t.css)` font-family: monospace; height: 100%; flex-grow: 1; `,viewer:(0,t.css)` overflow: scroll; `,dataFrameSelect:(0,t.css)` flex-grow: 2; `,leftActions:(0,t.css)` display: flex; flex-grow: 1; max-width: 85%; @media (max-width: 1345px) { max-width: 75%; } `,options:(0,t.css)` padding-top: ${g.v1.spacing.sm}; `,dataDisplayOptions:(0,t.css)` flex-grow: 1; min-width: 300px; margin-right: ${g.v1.spacing.sm}; `,selects:(0,t.css)` display: flex; > * { margin-right: ${g.v1.spacing.sm}; } `})},16560:(Q,A,e)=>{"use strict";e.d(A,{q:()=>t});var t=(n=>(n.Data="data",n.Meta="meta",n.Error="error",n.Stats="stats",n.JSON="json",n.Query="query",n.Help="help",n))(t||{})},80287:(Q,A,e)=>{"use strict";e.d(A,{EM:()=>f,Zy:()=>l,ek:()=>h,ny:()=>d});var t=e(4213),n=e.n(t),o=e(72724),s=e(18282),r=e(72436),g=e(37471),u=e(98216),c=e(7810),i=e(54807);function l(p,m){let a="";p.meta?.forEach(D=>{const b=`${D.label}: ${JSON.stringify(D.value)} `;a=a+b}),a=a+` `,p.rows.forEach(D=>{const b=(0,o.LE)(D.timeEpochMs,{defaultWithMS:!0})+" "+D.entry+` `;a=a+b});const v=new Blob([a],{type:"text/plain;charset=utf-8"}),E=`${m}-logs-${(0,o.LE)(new Date)}.txt`;n()(v,E)}function f(p,m,a,v=s.F.noop){const E=(0,r._O)([p],a),D=new Blob([String.fromCharCode(65279),E],{type:"text/csv;charset=utf-8"}),b=v!==s.F.noop?"-as-"+v.toLocaleLowerCase():"",C=`${m}-data${b}-${(0,o.LE)(new Date)}.csv`;n()(D,C)}function d(p,m){const a=new Blob([JSON.stringify(p)],{type:"application/json"}),v=`${m}-${(0,o.LE)(new Date)}.json`;n()(a,v)}function h(p,m){let a="otlp";switch(p.meta?.custom?.traceFormat){case"jaeger":{let v=(0,c.K_)(new g.k(p));d(v,m),a="jaeger";break}case"zipkin":{let v=(0,i.T)(new g.k(p));d(v,m),a="zipkin";break}case"otlp":default:{let v=(0,u.xw)(new g.k(p));d(v,m);break}}return a}},77938:(Q,A,e)=>{"use strict";e.d(A,{p:()=>o});var t=e(26272),n=e(28138);function o(r){let g="";try{g=JSON.stringify(r,s(),2)}catch(u){u instanceof Error&&(u.toString().includes("RangeError")||u.toString().includes("allocation size overflow"))?n.A.emit(t.r1.alertError,[u.toString(),"Cannot display JSON, the object is too big."]):n.A.emit(t.r1.alertError,[u instanceof Error?u.toString():u])}return g}function s(){const r=new WeakSet;return(g,u)=>{if(g==="__dataContext"||g==="__sceneObject")return"Filtered out in JSON serialization";if(typeof u=="object"&&u!==null){if(r.has(u))return;r.add(u)}return u}}},47259:(Q,A,e)=>{"use strict";e.d(A,{G7:()=>s,KU:()=>r,eb:()=>g});var t=e(17172),n=e(10096),o=e(80348);const s=(0,o.createAsyncThunk)("users/fetchInvitees",async()=>n.TP.hasPermission(o.AccessControlAction.OrgUsersAdd)?await(0,t.AI)().get("/api/org/invites"):[]),r=(0,o.createAsyncThunk)("users/addInvitee",async(u,{dispatch:c})=>{await(0,t.AI)().post("/api/org/invites",u),await c(s())}),g=(0,o.createAsyncThunk)("users/revokeInvite",async u=>(await(0,t.AI)().patch(`/api/org/invites/${u}/revoke`,{}),u))},40823:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>c,Tp:()=>s});var t=e(30038),n=e(47259);const o=(0,t.pU)({selectId:i=>i.code}),s=o.getSelectors(),r=o.getInitialState({status:"idle"}),c={invites:(0,t.Z0)({name:"invites",initialState:r,reducers:{},extraReducers:i=>{i.addCase(n.G7.pending,l=>{l.status="loading"}).addCase(n.G7.fulfilled,(l,{payload:f})=>{o.setAll(l,f),l.status="succeeded"}).addCase(n.G7.rejected,l=>{l.status="failed"}).addCase(n.eb.fulfilled,(l,{payload:f})=>{o.removeOne(l,f),l.status="succeeded"})}}).reducer}},96227:(Q,A,e)=>{"use strict";e.d(A,{b:()=>h,o:()=>p});var t=e(96540),n=e(40996),o=e(16817),s=e(17172),r=e(88575),g=e(10354),u=e(37390),c=e(55852),i=e(85242),l=e(44836),f=e(57767),d=e(88861);const h=({panel:m,initialFolderUid:a,onDismiss:v})=>{const[E,D]=(0,t.useState)(a),[b,C]=(0,t.useState)(m.title),[y,M]=(0,t.useState)(m.title),[T,I]=(0,t.useState)(!1);console.log("folderUid",E),(0,t.useEffect)(()=>I(!0),[b]),(0,n.A)(()=>M(b),350,[b]);const{saveLibraryPanel:x}=(0,d.b)(),S=(0,t.useCallback)(()=>{m.libraryPanel={uid:"",name:b},x(m,E).then(L=>{(0,s.NF)(L)?m.libraryPanel=void 0:v?.()})},[m,b,E,v,x]),O=(0,o.A)(async()=>{try{return!(await(0,f.e9)(b)).some(L=>L.folderUid===E)}catch(L){return(0,s.NF)(L)&&(L.isHandled=!0),!0}finally{I(!1)}},[y,E]);console.log("isValidName:",O);const P=!O?.value&&O.value!==void 0&&b===y&&!T;return t.createElement(t.Fragment,null,t.createElement(r.D,{label:(0,l.t)("library-panel.add-modal.name","Library panel name"),invalid:P,error:P?(0,l.t)("library-panel.add-modal.error","Library panel with this name already exists"):""},t.createElement(g.p,{id:"share-panel-library-panel-name-input",name:"name",value:b,onChange:L=>C(L.currentTarget.value)})),t.createElement(r.D,{label:(0,l.t)("library-panel.add-modal.folder","Save in folder"),description:(0,l.t)("library-panel.add-modal.folder-description","Library panel permissions are derived from the folder permissions")},t.createElement(i.sR,{onChange:({uid:L})=>D(L),initialFolderUid:a,inputId:"share-panel-library-panel-folder-picker"})),t.createElement(u.a.ButtonRow,null,t.createElement(c.$n,{variant:"secondary",onClick:v,fill:"outline"},t.createElement(l.x6,{i18nKey:"library-panel.add-modal.cancel"},"Cancel")),t.createElement(c.$n,{onClick:S,disabled:P},t.createElement(l.x6,{i18nKey:"library-panel.add-modal.create"},"Create library panel"))))},p=({isOpen:m=!1,panel:a,initialFolderUid:v,...E})=>t.createElement(u.a,{title:"Create library panel",isOpen:m,onDismiss:E.onDismiss},t.createElement(h,{panel:a,initialFolderUid:v,onDismiss:E.onDismiss}))},58807:(Q,A,e)=>{"use strict";e.d(A,{l:()=>o});var t=e(96540),n=e(96374);const o=({isOpen:s,onConfirm:r,onDismiss:g})=>t.createElement(n.u,{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})},82792:(Q,A,e)=>{"use strict";e.d(A,{X:()=>t});function t(n){return!!n.libraryPanel?.uid}},57767:(Q,A,e)=>{"use strict";e.d(A,{GN:()=>d,Yr:()=>u,d7:()=>i,dq:()=>g,e9:()=>c,h4:()=>f,jc:()=>l,xV:()=>h});var t=e(75505),n=e(79422),o=e(34214),s=e(27677),r=e(98796);async function g({searchString:p="",perPage:m=100,page:a=1,excludeUid:v="",sortDirection:E="",typeFilter:D=[],folderFilterUIDs:b=[]}={}){const C=new URLSearchParams;C.append("searchString",p),C.append("sortDirection",E),C.append("typeFilter",D.join(",")),C.append("folderFilterUIDs",b.join(",")),C.append("excludeUid",v),C.append("perPage",m.toString(10)),C.append("page",a.toString(10)),C.append("kind",r.i.Panel.toString(10));const{result:y}=await(0,s.AI)().get(`/api/library-elements?${C.toString()}`);return y}async function u(p,m=!1){const a=await(0,t.s)((0,s.AI)().fetch({method:"GET",url:`/api/library-elements/${p}`,showSuccessAlert:!m,showErrorAlert:!m})),{result:v}=a.data,E=new o.G({...n.Ye,schemaVersion:35,panels:[v.model]}),{scopedVars:D,...b}=E.panels[0].getSaveModel();return E.destroy(),{...v,model:b}}async function c(p){const{result:m}=await(0,s.AI)().get(`/api/library-elements/name/${p}`);return m}async function i(p,m){const{result:a}=await(0,s.AI)().post("/api/library-elements",{folderUid:m,name:p.libraryPanel.name,model:p,kind:r.i.Panel});return a}async function l(p){const{libraryPanel:m,...a}=p,{uid:v,name:E,version:D,folderUid:b}=m,C=r.i.Panel,{result:y}=await(0,s.AI)().patch(`/api/library-elements/${v}`,{folderUid:b,name:E,model:a,version:D,kind:C});return y}function f(p){return(0,s.AI)().delete(`/api/library-elements/${p}`)}async function d(p){const{result:m}=await(0,s.AI)().get(`/api/library-elements/${p}/connections`);return m}async function h(p){const m=await d(p);return m.length===0?[]:await(0,s.AI)().search({dashboardUIDs:m.map(v=>v.connectionUid)})}},98796:(Q,A,e)=>{"use strict";e.d(A,{i:()=>t});var t=(o=>(o[o.Panel=1]="Panel",o))(t||{}),n=(o=>(o[o.Dashboard=1]="Dashboard",o))(n||{})},88861:(Q,A,e)=>{"use strict";e.d(A,{b:()=>l});var t=e(5805),n=e(17172),o=e(3169),s=e(44836),r=e(57767);async function g(f,d){const h=u(f),p=await i(h,d);return c(f,p),p}function u(f){let{scopedVars:d,...h}=f.getSaveModel();return h={libraryPanel:{name:f.title,uid:void 0},...h},h}function c(f,d){f.restoreModel({...d.model,configRev:0,libraryPanel:d,title:f.title}),f.hasSavedPanelEditChange=!0,f.refresh()}function i(f,d){return f.libraryPanel?f.libraryPanel&&f.libraryPanel.uid===""?(0,r.d7)(f,d):(0,r.jc)(f):Promise.reject()}const l=()=>{const f=(0,o._2)(),[d,h]=(0,t.default)(async(p,m)=>{try{const a=await g(p,m);return f.success((0,s.t)("library-panels.save.success","Library panel saved")),a}catch(a){throw(0,n.NF)(a)&&(a.isHandled=!0,f.error((0,s.t)("library-panels.save.error",'Error saving library panel: "{{errorMsg}}"',{errorMsg:a.message??a.data.message}))),a}},[]);return{state:d,saveLibraryPanel:h}}},6473:(Q,A,e)=>{"use strict";e.d(A,{t:()=>D});var t=e(62938),n=e(55004),o=e(26272),s=e(78731),r=e(12131),g=e(10096),u=e(28444),c=e(14792),i=e(32196),l=e(96540),f=e(40845),d=e(37390),h=e(55852),p=(b=>(b.Saved="saved",b.EditingStarted="editing-started",b.EditingCanceled="editing-cancelled",b.Deleted="deleted",b))(p||{});function m({onDismiss:b,event:C}){const y=(0,f.of)(a),M=()=>{if(C?.action===p.Deleted){r.Ny.push("/");return}D.reloadPage(),b()};return l.createElement(d.a,{isOpen:!0,title:"Dashboard changed",icon:"copy",onDismiss:b,onClickBackdrop:()=>{},className:y.modal},l.createElement("div",{className:y.description},"The dashboad has been updated by another session. Do you want to continue editing or discard your local changes?"),l.createElement(d.a.ButtonRow,null,l.createElement(h.$n,{onClick:b,variant:"secondary",fill:"outline"},"Continue editing"),l.createElement(h.$n,{onClick:M,variant:"destructive"},"Discard local changes")))}const a=b=>({modal:(0,i.css)({width:"600px"}),description:(0,i.css)({color:b.colors.text.secondary,paddingBottom:b.spacing(1)})}),v=(0,t.A)();class E{constructor(){this.editing=!1,this.observer={next:C=>{if((0,n.ew)(C)&&this.editing&&C.state===n.ZF.Connected&&this.sendEditingState(),(0,n.Z7)(C)){if(C.message.sessionId===v)return;const{action:y}=C.message;switch(y){case p.EditingStarted:case p.Saved:{if(this.ignoreSave){this.ignoreSave=!1;return}const M=(0,c.UA)().getCurrent();if(M?.uid!==C.message.uid){console.log("dashboard event for different dashboard?",C,M);return}const T=this.editing||M.hasUnsavedChanges();if(y===p.Saved)T?g.lE.publish(new u.S8({component:m,props:{event:C}})):(g.lE.emit(o.r1.alertSuccess,["Dashboard updated"]),this.reloadPage());else if(T&&y===p.EditingStarted&&!this.hasSeenNotice){const I=C.message,x=this.getRecentEditingEvent();(!x||x.message!==I.message)&&(this.hasSeenNotice=!0,g.lE.emit(o.r1.alertWarning,["Another session is editing this dashboard",I.message])),this.lastEditing=I}return}}}}}}setEditingState(C){const y=this.editing=C;this.editing=C,this.hasSeenNotice=!1,y&&g.TP.isEditor&&this.sendEditingState()}sendEditingState(){const{channel:C,uid:y}=this;C&&y&&(0,s.oF)().publish(C,{sessionId:v,uid:y,action:this.editing?p.EditingStarted:p.EditingCanceled,timestamp:Date.now()})}watch(C){const y=(0,s.oF)();y&&C!==this.uid&&(this.channel={scope:n.qD.Grafana,namespace:"dashboard",path:`uid/${C}`},this.leave(),C&&(this.subscription=y.getStream(this.channel).subscribe(this.observer)),this.uid=C)}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.Ny.reload()}}const D=new E},47118:(Q,A,e)=>{"use strict";e.d(A,{_w:()=>n,o$:()=>g,ot:()=>o});var t=e(14236),n=(u=>(u.NewValuesSameSchema="NewValuesSameSchema",u.FullFrame="FullFrame",u))(n||{});const o=(u,c)=>"type"in u&&u.type===c,s=Object.values(n),r=u=>"type"in u&&s.includes(u.type),g=u=>(0,t.ci)(u)&&"packetInfo"in u},81073:(Q,A,e)=>{"use strict";e.d(A,{I:()=>s});var t=e(32196),n=e(96540),o=e(62930);const s=({adjective:g="newer"})=>{const u=`Loading ${g} logs...`;return n.createElement("div",{className:r},n.createElement("div",null,u," ",n.createElement(o.y,{inline:!0})))},r=(0,t.css)` display: flex; justify-content: center; `},93463:(Q,A,e)=>{"use strict";e.d(A,{A:()=>r});var t=e(32196),n=e(96540),o=e(40845);const s=["level","lvl","filename"],r=({labels:u})=>{const c=(0,o.of)(g),i=Object.keys(u).filter(l=>!l.startsWith("_")&&!s.includes(l));return i.length===0?n.createElement("span",{className:(0,t.cx)([c.logsLabels])},n.createElement("span",{className:(0,t.cx)([c.logsLabel])},"(no unique labels)")):n.createElement("span",{className:(0,t.cx)([c.logsLabels])},i.sort().map(l=>{const f=u[l];if(!f)return;const d=`${l}: ${f}`;return n.createElement("span",{key:l,className:(0,t.cx)([c.logsLabel])},n.createElement("span",{className:(0,t.cx)([c.logsLabelValue]),title:d},f))}))},g=u=>({logsLabels:(0,t.css)` display: flex; flex-wrap: wrap; font-size: ${u.typography.size.xs}; `,logsLabel:(0,t.css)` label: logs-label; display: flex; padding: ${u.spacing(0,.25)}; background-color: ${u.colors.background.secondary}; border-radius: ${u.shape.radius.default}; margin: ${u.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: ${u.spacing(25)}; text-overflow: ellipsis; overflow: hidden; `})},85492:(Q,A,e)=>{"use strict";e.d(A,{$:()=>i});var t=e(88838),n=e(96540),o=e(23257),s=e.n(o),r=e(21),g=e(40845);function u(l,f){return f.split(/;\s*/).reduce((d,h)=>{if(h==="color:rgba(0,0,0,0.5)")return{color:l.colors.text.secondary};const p=h.match(/([^:\s]+)\s*:\s*(.+)/);if(p&&p[1]&&p[2]){const m=p[1].replace(/-([a-z])/g,(a,v)=>v.toUpperCase());d[m]=p[2]}return d},{})}class c extends n.PureComponent{constructor(){super(...arguments),this.state={chunks:[],prevValue:""}}static getDerivedStateFromProps(f,d){return f.value===d.prevValue?null:{chunks:t.Ay.parse(f.value).spans.map(p=>p.css?{style:u(f.theme,p.css),text:p.text}:{text:p.text}),prevValue:f.value}}render(){const{chunks:f}=this.state;return f.map((d,h)=>{const p=this.props.highlight?.searchWords?n.createElement(s(),{key:h,textToHighlight:d.text,searchWords:this.props.highlight.searchWords,findChunks:r.Oq,highlightClassName:this.props.highlight.highlightClassName}):d.text;return d.style?n.createElement("span",{key:h,style:d.style,"data-testid":"ansiLogLine"},p):p})}}const i=(0,g.cV)(c);i.displayName="LogMessageAnsi"},42785:(Q,A,e)=>{"use strict";e.d(A,{Q:()=>c});var t=e(96540),n=e(76885),o=e(71733),s=e(43127),r=e(29158),g=e(10534),u=e(2913);const c=t.memo(({logText:i,onOpenContext:l,onPermalinkClick:f,onPinLine:d,onUnpinLine:h,pinned:p,row:m,showContextToggle:a,styles:v,mouseIsOver:E,onBlur:D,getRowContextQuery:b})=>{const C=a?a(m):!1,y=(0,t.useCallback)(x=>{x.stopPropagation()},[]),M=(0,t.useCallback)(async x=>{if(x.stopPropagation(),b&&(x.nativeEvent.ctrlKey||x.nativeEvent.metaKey||x.nativeEvent.shiftKey)){const S=window.open("about:blank"),O=await b(m,void 0,!1);if(O&&S){const P=n.kM.renderUrl(o.I.assureBaseUrl(`${(0,u.zj)().appSubUrl}explore`),{left:JSON.stringify({datasource:O.datasource,queries:[O],range:(0,s.E2)()})});S.location=P;return}S?.close()}l(m)},[l,b,m]),T=(0,t.useCallback)(x=>{!x.currentTarget.contains(x.relatedTarget)&&D&&D()},[D]),I=(0,t.useCallback)(()=>i,[i]);return t.createElement("span",{className:`log-row-menu ${v.rowMenu}`,onClick:y,onBlur:T},p&&!E&&t.createElement(r.K,{className:v.unPinButton,size:"md",name:"gf-pin",onClick:()=>h&&h(m),tooltip:"Unpin line",tooltipPlacement:"top","aria-label":"Unpin line",tabIndex:0}),E&&t.createElement(t.Fragment,null,C&&t.createElement(r.K,{size:"md",name:"gf-show-context",onClick:M,tooltip:"Show context",tooltipPlacement:"top","aria-label":"Show context",tabIndex:0}),t.createElement(g.b,{className:v.copyLogButton,icon:"copy",variant:"secondary",fill:"text",size:"md",getText:I,tooltip:"Copy to clipboard",tooltipPlacement:"top",tabIndex:0}),p&&h&&t.createElement(r.K,{className:v.unPinButton,size:"md",name:"gf-pin",onClick:()=>h&&h(m),tooltip:"Unpin line",tooltipPlacement:"top","aria-label":"Unpin line",tabIndex:0}),!p&&d&&t.createElement(r.K,{className:v.unPinButton,size:"md",name:"gf-pin",onClick:()=>d&&d(m),tooltip:"Pin line",tooltipPlacement:"top","aria-label":"Pin line",tabIndex:0}),f&&m.rowId!==void 0&&m.uid&&t.createElement(r.K,{tooltip:"Copy shortlink","aria-label":"Copy shortlink",tooltipPlacement:"top",size:"md",name:"share-alt",onClick:()=>f(m),tabIndex:0})))});c.displayName="LogRowMenuCell"},40455:(Q,A,e)=>{"use strict";e.d(A,{S:()=>u,a:()=>l});var t=e(96540),n=e(23257),o=e.n(n),s=e(21),r=e(85492),g=e(42785);const u=1e5,c=({hasAnsi:f,entry:d,highlights:h,styles:p})=>{const m=h&&h.length>0&&h[0]&&h[0].length>0&&d.length<u,a=h??[];if(f){const v=m?{searchWords:a,highlightClassName:p.logsRowMatchHighLight}:void 0;return t.createElement(r.$,{value:d,highlight:v})}else if(m)return t.createElement(o(),{textToHighlight:d,searchWords:a,findChunks:s.Oq,highlightClassName:p.logsRowMatchHighLight});return t.createElement(t.Fragment,null,d)},i=(f,d)=>{if(d)try{return JSON.stringify(JSON.parse(f),void 0,2)}catch{return f}return f},l=t.memo(f=>{const{row:d,wrapLogMessage:h,prettifyLogMessage:p,showContextToggle:m,styles:a,onOpenContext:v,onPermalinkClick:E,onUnpinLine:D,onPinLine:b,pinned:C,mouseIsOver:y,onBlur:M,getRowContextQuery:T}=f,{hasAnsi:I,raw:x}=d,S=(0,t.useMemo)(()=>i(x,p),[x,p]),O=(0,t.useMemo)(()=>y||C,[y,C]);return t.createElement(t.Fragment,null,t.createElement("td",{className:a.logsRowMessage},t.createElement("div",{className:h?a.positionRelative:a.horizontalScroll},t.createElement("button",{className:`${a.logLine} ${a.positionRelative}`},t.createElement(c,{hasAnsi:I,entry:S,highlights:d.searchWords,styles:a})))),t.createElement("td",{className:`log-row-menu-cell ${a.logRowMenuCell}`},O&&t.createElement(g.Q,{logText:S,row:d,showContextToggle:m,getRowContextQuery:T,onOpenContext:v,onPermalinkClick:E,onPinLine:b,onUnpinLine:D,pinned:C,styles:a,mouseIsOver:y,onBlur:M})))});l.displayName="LogRowMessage"},14647:(Q,A,e)=>{"use strict";e.d(A,{k:()=>q});var t=e(32196),n=e(41811),o=e(96540),s=e(41987),r=e(52622),g=e(32264),u=e(40845),c=e(14110),i=e(38138),l=e(91002);const f=({x:te,y:oe,onClickFilterValue:ue,onClickFilterOutValue:ie,selection:ge,row:he,close:De})=>{const pe=(0,o.useRef)(null),le=(0,u.of)(h);return(0,o.useEffect)(()=>{function Ee(Re){Re.key==="Escape"&&De()}return document.addEventListener("keyup",Ee),()=>{document.removeEventListener("keyup",Ee)}},[De]),ue||ie?o.createElement("div",{className:le.menu,style:{top:oe,left:te}},o.createElement(i.W,{ref:pe},o.createElement(i.W.Item,{label:"Copy selection",onClick:()=>{(0,l.Dk)(ge,pe),De(),d("copy",ge.length,he.datasourceType)}}),ue&&o.createElement(i.W.Item,{label:"Add as line contains filter",onClick:()=>{ue(ge,he.dataFrame.refId),De(),d("line_contains",ge.length,he.datasourceType)}}),ie&&o.createElement(i.W.Item,{label:"Add as line does not contain filter",onClick:()=>{ie(ge,he.dataFrame.refId),De(),d("line_does_not_contain",ge.length,he.datasourceType)}}))):null};function d(te,oe,ue){(0,c.rR)("grafana_explore_logs_popover_menu",{action:te,selectionLength:oe,datasourceType:ue||"unknown"})}const h=te=>({menu:(0,t.css)({position:"absolute",zIndex:te.zIndex.modal})});class p{constructor(){this.seen=new Set,this.count=0}getKey(oe){this.count+=1;const ue=`k_${oe}`;return this.seen.has(ue)?`i_${this.count}`:(this.seen.add(ue),ue)}}var m=e(2543),a=e(72724),v=e(56034),E=e(14578),D=e(41260),b=e(10534),C=e(29158),y=e(14689),M=e(69147),T=e(3911);const I=te=>({logsStatsRow:(0,t.css)` label: logs-stats-row; margin: ${parseInt(te.spacing(2),10)/1.75}px 0; `,logsStatsRowActive:(0,t.css)` label: logs-stats-row--active; color: ${te.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: ${te.spacing(.75)}; `,logsStatsRowPercent:(0,t.css)` label: logs-stats-row__percent; text-align: right; margin-left: ${te.spacing(.75)}; width: ${te.spacing(4.5)}; `,logsStatsRowBar:(0,t.css)` label: logs-stats-row__bar; height: ${te.spacing(.5)}; overflow: hidden; background: ${te.colors.text.disabled}; `,logsStatsRowInnerBar:(0,t.css)` label: logs-stats-row__innerbar; height: ${te.spacing(.5)}; overflow: hidden; background: ${te.colors.primary.main}; `}),x=({active:te,count:oe,proportion:ue,value:ie})=>{const ge=(0,u.of)(I),he=`${Math.round(ue*100)}%`,De={width:he},pe=te?(0,t.cx)([ge.logsStatsRow,ge.logsStatsRowActive]):(0,t.cx)([ge.logsStatsRow]);return o.createElement("div",{className:pe},o.createElement("div",{className:(0,t.cx)([ge.logsStatsRowLabel])},o.createElement("div",{className:(0,t.cx)([ge.logsStatsRowValue]),title:ie},ie),o.createElement("div",{className:(0,t.cx)([ge.logsStatsRowCount])},oe),o.createElement("div",{className:(0,t.cx)([ge.logsStatsRowPercent])},he)),o.createElement("div",{className:(0,t.cx)([ge.logsStatsRowBar])},o.createElement("div",{className:(0,t.cx)([ge.logsStatsRowInnerBar]),style:De})))};x.displayName="LogLabelStatsRow";const S=5,O=(0,T.N)(te=>({logsStats:(0,t.css)` label: logs-stats; background: inherit; color: ${te.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 ${te.colors.border.medium}; display: flex; `,logsStatsTitle:(0,t.css)` label: logs-stats__title; font-weight: ${te.typography.fontWeightMedium}; padding-right: ${te.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 o.PureComponent{render(){const{label:oe,rowCount:ue,stats:ie,value:ge,theme:he,isLabel:De}=this.props,pe=O(he),le=ie.slice(0,S);let Te=le.find(We=>We.value===ge),Ee=ie.slice(S);const Re=!Te;Re&&(Te=Ee.find(We=>We.value===ge),Ee=Ee.filter(We=>We.value!==ge));const me=Ee.reduce((We,Be)=>We+Be.count,0),ye=le.reduce((We,Be)=>We+Be.count,0)+me,Le=me/ye;return o.createElement("div",{className:pe.logsStats,"data-testid":"logLabelStats"},o.createElement("div",{className:pe.logsStatsHeader},o.createElement("div",{className:pe.logsStatsTitle},oe,": ",ye," of ",ue," rows have that ",De?"label":"field")),o.createElement("div",{className:pe.logsStatsBody},le.map(We=>o.createElement(x,{key:We.value,...We,active:We.value===ge})),Re&&Te&&o.createElement(x,{key:Te.value,...Te,active:!0}),me>0&&o.createElement(x,{key:"__OTHERS__",count:me,value:"Other",proportion:Le})))}}const L=(0,u.cV)(P);L.displayName="LogLabelStats";var U=e(77020);const R=(0,n.A)(te=>({wordBreakAll:(0,t.css)` label: wordBreakAll; word-break: break-all; `,copyButton:(0,t.css)` & > button { color: ${te.colors.text.secondary}; padding: 0; justify-content: center; border-radius: ${te.shape.radius.circle}; height: ${te.spacing(te.components.height.sm)}; width: ${te.spacing(te.components.height.sm)}; svg { margin: 0; } span > div { top: -5px; & button { color: ${te.colors.success.main}; } } } `,adjoiningLinkButton:(0,t.css)` margin-left: ${te.spacing(1)}; `,wrapLine:(0,t.css)` label: wrapLine; white-space: pre-wrap; `,logDetailsStats:(0,t.css)` padding: 0 ${te.spacing(1)}; `,logDetailsValue:(0,t.css)` display: flex; align-items: center; line-height: 22px; .log-details-value-copy { visibility: hidden; } &:hover { .log-details-value-copy { visibility: visible; } } `,buttonRow:(0,t.css)` display: flex; flex-direction: row; gap: ${te.spacing(.5)}; margin-left: ${te.spacing(.5)}; `}));class B extends o.PureComponent{constructor(){super(...arguments),this.state={showFieldsStats:!1,fieldCount:0,fieldStats:null},this.showField=()=>{const{onClickShowField:oe,parsedKeys:ue,row:ie}=this.props;oe&&oe(ue[0]),(0,c.rR)("grafana_explore_logs_log_details_replace_line_clicked",{datasourceType:ie.datasourceType,logRowUid:ie.uid,type:"enable"})},this.hideField=()=>{const{onClickHideField:oe,parsedKeys:ue,row:ie}=this.props;oe&&oe(ue[0]),(0,c.rR)("grafana_explore_logs_log_details_replace_line_clicked",{datasourceType:ie.datasourceType,logRowUid:ie.uid,type:"disable"})},this.isFilterLabelActive=async()=>{const{isFilterLabelActive:oe,parsedKeys:ue,parsedValues:ie,row:ge}=this.props;return oe?await oe(ue[0],ie[0],ge.dataFrame?.refId):!1},this.filterLabel=()=>{const{onClickFilterLabel:oe,parsedKeys:ue,parsedValues:ie,row:ge}=this.props;oe&&oe(ue[0],ie[0],(0,M.f8)(ge)||void 0),(0,c.rR)("grafana_explore_logs_log_details_filter_clicked",{datasourceType:ge.datasourceType,filterType:"include",logRowUid:ge.uid})},this.filterOutLabel=()=>{const{onClickFilterOutLabel:oe,parsedKeys:ue,parsedValues:ie,row:ge}=this.props;oe&&oe(ue[0],ie[0],(0,M.f8)(ge)||void 0),(0,c.rR)("grafana_explore_logs_log_details_filter_clicked",{datasourceType:ge.datasourceType,filterType:"exclude",logRowUid:ge.uid})},this.updateStats=()=>{const{getStats:oe}=this.props,ue=oe(),ie=ue?ue.reduce((ge,he)=>ge+he.count,0):0;(!(0,m.isEqual)(this.state.fieldStats,ue)||ie!==this.state.fieldCount)&&this.setState({fieldStats:ue,fieldCount:ie})},this.showStats=()=>{const{isLabel:oe,row:ue,app:ie}=this.props,{showFieldsStats:ge}=this.state;ge||this.updateStats(),this.toggleFieldsStats(),(0,c.rR)("grafana_explore_logs_log_details_stats_clicked",{dataSourceType:ue.datasourceType,fieldType:oe?"label":"detectedField",type:ge?"close":"open",logRowUid:ue.uid,app:ie})}}componentDidUpdate(){this.state.showFieldsStats&&this.updateStats()}toggleFieldsStats(){this.setState(oe=>({showFieldsStats:!oe.showFieldsStats}))}generateClipboardButton(oe){const{theme:ue}=this.props,ie=R(ue);return o.createElement("div",{className:`log-details-value-copy ${ie.copyButton}`},o.createElement(b.b,{getText:()=>oe,title:"Copy value to clipboard",fill:"text",variant:"secondary",icon:"copy",size:"md"}))}generateMultiVal(oe,ue){return o.createElement("table",null,o.createElement("tbody",null,oe?.map((ie,ge)=>o.createElement("tr",{key:`${ie}-${ge}`},o.createElement("td",null,ie,ue&&ie!==""&&this.generateClipboardButton(ie))))))}render(){const{theme:oe,parsedKeys:ue,parsedValues:ie,isLabel:ge,links:he,displayedFields:De,wrapLogMessage:pe,onClickFilterLabel:le,onClickFilterOutLabel:Te,disableActions:Ee,row:Re}=this.props,{showFieldsStats:me,fieldStats:Me,fieldCount:ye}=this.state,Le=R(oe),We=(0,U.D)(oe),Be=ue==null?!1:ue.length===1,Ye=ie==null?!1:ie.length===1,at=!Ee&&le&&Te,st=Re.dataFrame?.refId?` in query ${Re.dataFrame?.refId}`:"",Ke=!Ye&&ie!=null&&!ie.every(He=>He===""),Xe=De&&ue!=null&&De.includes(ue[0])?o.createElement(C.K,{variant:"primary",tooltip:"Hide this field",name:"eye",onClick:this.hideField}):o.createElement(C.K,{tooltip:"Show this field instead of the message",name:"eye",onClick:this.showField});return o.createElement(o.Fragment,null,o.createElement("tr",{className:We.logDetailsValue},o.createElement("td",{className:We.logsDetailsIcon},o.createElement("div",{className:Le.buttonRow},at&&o.createElement(o.Fragment,null,o.createElement(H,{name:"search-plus",onClick:this.filterLabel,isActive:this.isFilterLabelActive,tooltipSuffix:st}),o.createElement(C.K,{name:"search-minus",tooltip:`Filter out value${st}`,onClick:this.filterOutLabel})),!Ee&&De&&Xe,!Ee&&o.createElement(C.K,{variant:me?"primary":"secondary",name:"signal",tooltip:"Ad-hoc statistics",className:"stats-button",disabled:!Be,onClick:this.showStats}))),o.createElement("td",{className:We.logDetailsLabel},Be?ue[0]:this.generateMultiVal(ue)),o.createElement("td",{className:(0,t.cx)(Le.wordBreakAll,pe&&Le.wrapLine)},o.createElement("div",{className:Le.logDetailsValue},Ye?ie[0]:this.generateMultiVal(ie,!0),Ye&&this.generateClipboardButton(ie[0]),o.createElement("div",{className:(0,t.cx)((Ye||Ke)&&Le.adjoiningLinkButton)},he?.map((He,Ge)=>o.createElement("span",{key:`${He.title}-${Ge}`},o.createElement(y.R,{link:He}))))))),me&&Be&&Ye&&o.createElement("tr",null,o.createElement("td",null,o.createElement(C.K,{variant:me?"primary":"secondary",name:"signal",tooltip:"Hide ad-hoc statistics",onClick:this.showStats})),o.createElement("td",{colSpan:2},o.createElement("div",{className:Le.logDetailsStats},o.createElement(L,{stats:Me,label:ue[0],value:ie[0],rowCount:ye,isLabel:ge})))))}}const H=({isActive:te,tooltipSuffix:oe,...ue})=>{const[ie,ge]=(0,o.useState)(!1),he=ie?"Remove filter":"Filter for value";return te().then(ge),o.createElement(C.K,{...ue,variant:ie?"primary":void 0,tooltip:he+oe})},w=(0,u.cV)(B);w.displayName="LogDetailsRow";var N=e(70377);class V extends o.PureComponent{render(){const{app:oe,row:ue,theme:ie,hasError:ge,onClickFilterOutLabel:he,onClickFilterLabel:De,getRows:pe,showDuplicates:le,className:Te,onClickShowField:Ee,onClickHideField:Re,displayedFields:me,getFieldLinks:Me,wrapLogMessage:ye,styles:Le}=this.props,We=(0,U.L)(ie,ue.logLevel),Be=ue.labels?ue.labels:{},Ye=Object.keys(Be).length>0,at=(0,N.jE)(ue,Me);let st=at.filter(Z=>Z.links?.length);const Ke=st.filter(Z=>Z.fieldIndex!==ue.entryFieldIndex).sort(),Xe=st.filter(Z=>Z.fieldIndex===ue.entryFieldIndex).sort(),He=(0,N.qE)(Xe),Ge=Ke&&Ke.length>0||He&&He.length>0,xe=ue.dataFrame.meta?.type===D.m.LogLines?[]:at.filter(Z=>Z.links?.length===0&&Z.fieldIndex!==ue.entryFieldIndex).sort(),$e=xe&&xe.length>0,be=ge?"":`${We.logsRowLevelColor} ${Le.logsRowLevel} ${Le.logsRowLevelDetails}`;return o.createElement("tr",{className:(0,t.cx)(Te,Le.logDetails)},le&&o.createElement("td",null),o.createElement("td",{className:be,"aria-label":"Log level"}),o.createElement("td",{colSpan:4},o.createElement("div",{className:Le.logDetailsContainer},o.createElement("table",{className:Le.logDetailsTable},o.createElement("tbody",null,(Ye||$e)&&o.createElement("tr",null,o.createElement("td",{colSpan:100,className:Le.logDetailsHeading,"aria-label":"Fields"},"Fields")),Object.keys(Be).sort().map((Z,ae)=>{const de=Be[Z];return o.createElement(w,{key:`${Z}=${de}-${ae}`,parsedKeys:[Z],parsedValues:[de],isLabel:!0,getStats:()=>(0,l.Tj)(pe(),Z),onClickFilterOutLabel:he,onClickFilterLabel:De,onClickShowField:Ee,onClickHideField:Re,row:ue,app:oe,wrapLogMessage:ye,displayedFields:me,disableActions:!1,isFilterLabelActive:this.props.isFilterLabelActive})}),xe.map((Z,ae)=>{const{keys:de,values:ve,fieldIndex:Ue}=Z;return o.createElement(w,{key:`${de[0]}=${ve[0]}-${ae}`,parsedKeys:de,parsedValues:ve,onClickShowField:Ee,onClickHideField:Re,onClickFilterOutLabel:he,onClickFilterLabel:De,getStats:()=>(0,l.s2)(ue.dataFrame.fields[Ue].values),displayedFields:me,wrapLogMessage:ye,row:ue,app:oe,disableActions:!1,isFilterLabelActive:this.props.isFilterLabelActive})}),Ge&&o.createElement("tr",null,o.createElement("td",{colSpan:100,className:Le.logDetailsHeading,"aria-label":"Data Links"},"Links")),Ke.map((Z,ae)=>{const{keys:de,values:ve,links:Ue,fieldIndex:_e}=Z;return o.createElement(w,{key:`${de[0]}=${ve[0]}-${ae}`,parsedKeys:de,parsedValues:ve,links:Ue,onClickShowField:Ee,onClickHideField:Re,getStats:()=>(0,l.s2)(ue.dataFrame.fields[_e].values),displayedFields:me,wrapLogMessage:ye,row:ue,app:oe,disableActions:!1})}),He?.map((Z,ae)=>{const{keys:de,values:ve,links:Ue,fieldIndex:_e}=Z;return o.createElement(w,{key:`${de[0]}=${ve[0]}-${ae}`,parsedKeys:de,parsedValues:ve,links:Ue,onClickShowField:Ee,onClickHideField:Re,getStats:()=>(0,l.s2)(ue.dataFrame.fields[_e].values),displayedFields:me,wrapLogMessage:ye,row:ue,app:oe,disableActions:!0})}),!$e&&!Ye&&!Ge&&o.createElement("tr",null,o.createElement("td",{colSpan:100,"aria-label":"No details"},"No details available")))))))}}const G=(0,u.cV)(V);G.displayName="LogDetails";var _=e(93463),K=e(40455),j=e(42785);const k=o.memo(te=>{const{row:oe,detectedFields:ue,getFieldLinks:ie,wrapLogMessage:ge,styles:he,mouseIsOver:De,pinned:pe,...le}=te,Te=(0,N.jE)(oe,ie),Ee=ge?"":Y.noWrap,Re=(0,o.useMemo)(()=>ue.map(Me=>{const ye=Te.find(Le=>{const{keys:We}=Le;return We[0]===Me});return ye!=null?`${Me}=${ye.values}`:oe.labels[Me]!==void 0&&oe.labels[Me]!==null?`${Me}=${oe.labels[Me]}`:null}).filter(Me=>Me!==null).join(" "),[ue,Te,oe.labels]),me=(0,o.useMemo)(()=>De||pe,[De,pe]);return o.createElement(o.Fragment,null,o.createElement("td",{className:he.logsRowMessage},o.createElement("div",{className:Ee},Re)),o.createElement("td",{className:`log-row-menu-cell ${he.logRowMenuCell}`},me&&o.createElement(j.Q,{logText:Re,row:oe,styles:he,pinned:pe,mouseIsOver:De,...le})))}),Y={noWrap:(0,t.css)` white-space: nowrap; `};k.displayName="LogRowMessageDisplayedFields";class ee extends o.PureComponent{constructor(oe){super(oe),this.state={permalinked:!1,showingContext:!1,showDetails:!1,mouseIsOver:!1},this.debouncedContextClose=(0,m.debounce)(()=>{this.setState({showingContext:!1})},3e3),this.onOpenContext=ue=>{this.setState({showingContext:!0}),this.props.onOpenContext(ue,this.debouncedContextClose)},this.onRowClick=ue=>{this.props.handleTextSelection?.(ue,this.props.row)||this.props.enableLogDetails&&((0,c.rR)("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(ie=>({showDetails:!ie.showDetails})))},this.onMouseEnter=()=>{this.setState({mouseIsOver:!0}),this.props.onLogRowHover&&this.props.onLogRowHover(this.props.row)},this.onMouseMove=ue=>{this.props.handleTextSelection&&document.getSelection()?.toString()&&ue.buttons>0&&this.setState({mouseIsOver:!1})},this.onMouseLeave=()=>{this.setState({mouseIsOver:!1}),this.props.onLogRowHover&&this.props.onLogRowHover(void 0)},this.scrollToLogRow=(ue,ie=!1)=>{const{row:ge,permalinkedRowId:he,scrollIntoView:De,containerRendered:pe}=this.props;if(he!==ge.uid){(ue.permalinked||ie)&&this.setState({permalinked:!1});return}!this.state.permalinked&&pe&&this.logLineRef.current&&De&&(De(this.logLineRef.current),(0,c.rR)("grafana_explore_logs_permalink_opened",{datasourceType:ge.datasourceType??"unknown",logRowUid:ge.uid}),this.setState({permalinked:!0}))},this.escapeRow=(0,n.A)((ue,ie)=>ue.hasUnescapedContent&&ie?{...ue,entry:(0,l.Hw)(ue.entry),raw:(0,l.Hw)(ue.raw)}:ue),this.logLineRef=o.createRef()}renderTimeStamp(oe){return(0,a.LE)(oe,{timeZone:this.props.timeZone,defaultWithMS:!0})}componentDidMount(){this.scrollToLogRow(this.state,!0)}componentDidUpdate(oe,ue){this.scrollToLogRow(ue)}render(){const{getRows:oe,onClickFilterLabel:ue,onClickFilterOutLabel:ie,onClickShowField:ge,onClickHideField:he,enableLogDetails:De,row:pe,showDuplicates:le,showContextToggle:Te,showLabels:Ee,showTime:Re,displayedFields:me,wrapLogMessage:Me,prettifyLogMessage:ye,theme:Le,getFieldLinks:We,forceEscape:Be,app:Ye,styles:at,getRowContextQuery:st}=this.props,{showDetails:Ke,showingContext:Xe,permalinked:He}=this.state,Ge=(0,U.L)(Le,pe.logLevel),{errorMessage:xe,hasError:$e}=(0,l.Ei)(pe),be=(0,t.cx)(at.logsRow,{[at.errorLogRow]:$e,[at.highlightBackground]:Xe||He}),Z=(0,t.cx)(at.logsRow,{[at.errorLogRow]:$e,[at.highlightBackground]:He&&!this.state.showDetails}),ae=this.escapeRow(pe,Be);return o.createElement(o.Fragment,null,o.createElement("tr",{ref:this.logLineRef,className:be,onClick:this.onRowClick,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseMove:this.onMouseMove,onFocus:this.onMouseEnter},le&&o.createElement("td",{className:at.logsRowDuplicates},ae.duplicates&&ae.duplicates>0?`${ae.duplicates+1}x`:null),o.createElement("td",{className:$e?"":`${Ge.logsRowLevelColor} ${at.logsRowLevel}`},$e&&o.createElement(v.m,{content:`Error: ${xe}`,placement:"right",theme:"error"},o.createElement(E.I,{className:at.logIconError,name:"exclamation-triangle",size:"xs"}))),De&&o.createElement("td",{title:Ke?"Hide log details":"See log details",className:at.logsRowToggleDetails},o.createElement(E.I,{className:at.topVerticalAlign,name:Ke?"angle-down":"angle-right"})),Re&&o.createElement("td",{className:at.logsRowLocalTime},this.renderTimeStamp(pe.timeEpochMs)),Ee&&ae.uniqueLabels&&o.createElement("td",{className:at.logsRowLabels},o.createElement(_.A,{labels:ae.uniqueLabels})),me&&me.length>0?o.createElement(k,{row:ae,showContextToggle:Te,detectedFields:me,getFieldLinks:We,wrapLogMessage:Me,onOpenContext:this.onOpenContext,onPermalinkClick:this.props.onPermalinkClick,styles:at,onPinLine:this.props.onPinLine,onUnpinLine:this.props.onUnpinLine,pinned:this.props.pinned,mouseIsOver:this.state.mouseIsOver,onBlur:this.onMouseLeave}):o.createElement(K.a,{row:ae,showContextToggle:Te,getRowContextQuery:st,wrapLogMessage:Me,prettifyLogMessage:ye,onOpenContext:this.onOpenContext,onPermalinkClick:this.props.onPermalinkClick,app:Ye,styles:at,onPinLine:this.props.onPinLine,onUnpinLine:this.props.onUnpinLine,pinned:this.props.pinned,mouseIsOver:this.state.mouseIsOver,onBlur:this.onMouseLeave})),this.state.showDetails&&o.createElement(G,{className:Z,showDuplicates:le,getFieldLinks:We,onClickFilterLabel:ue,onClickFilterOutLabel:ie,onClickShowField:ge,onClickHideField:he,getRows:oe,row:ae,wrapLogMessage:Me,hasError:$e,displayedFields:me,app:Ye,styles:at,isFilterLabelActive:this.props.isFilterLabelActive}))}}const re=(0,u.cV)(ee);re.displayName="LogRow";const J=100;class ne extends o.PureComponent{constructor(){super(...arguments),this.renderAllTimer=null,this.logRowsRef=(0,o.createRef)(),this.state={renderAll:!1,selection:"",selectedRow:null,popoverMenuCoordinates:{x:0,y:0}},this.openContext=(oe,ue)=>{this.props.onOpenContext&&this.props.onOpenContext(oe,ue)},this.handleSelection=(oe,ue)=>{if(this.popoverMenuSupported()===!1)return!1;const ie=document.getSelection()?.toString();if(!ie||!this.logRowsRef.current)return!1;const ge=this.logRowsRef.current?.getBoundingClientRect();return this.setState({selection:ie,popoverMenuCoordinates:{x:oe.clientX-ge.left,y:oe.clientY-ge.top},selectedRow:ue}),document.addEventListener("click",this.handleDeselection),document.addEventListener("contextmenu",this.handleDeselection),!0},this.handleDeselection=oe=>{if((0,l.a8)(oe.target)&&!this.logRowsRef.current?.contains(oe.target)){this.closePopoverMenu();return}document.getSelection()?.toString()||this.closePopoverMenu()},this.closePopoverMenu=()=>{document.removeEventListener("click",this.handleDeselection),document.removeEventListener("contextmenu",this.handleDeselection),this.setState({selection:"",popoverMenuCoordinates:{x:0,y:0},selectedRow:null})},this.makeGetRows=(0,n.A)(oe=>()=>oe),this.sortLogs=(0,n.A)((oe,ue)=>(0,l.oR)(oe,ue))}popoverMenuSupported(){return!g.$.featureToggles.logRowsPopoverMenu||this.props.app!==s.Jk.Explore?!1:!!(this.props.onClickFilterOutValue||this.props.onClickFilterValue)}componentDidMount(){const{logRows:oe,previewLimit:ue}=this.props,ge=(oe?oe.length:0)<=ue*2;ge?this.setState({renderAll:ge}):this.renderAllTimer=window.setTimeout(()=>this.setState({renderAll:!0}),2e3)}componentWillUnmount(){document.removeEventListener("click",this.handleDeselection),document.removeEventListener("contextmenu",this.handleDeselection),this.renderAllTimer&&clearTimeout(this.renderAllTimer)}render(){const{deduplicatedRows:oe,logRows:ue,dedupStrategy:ie,theme:ge,logsSortOrder:he,previewLimit:De,...pe}=this.props,{renderAll:le}=this.state,Te=(0,U.D)(ge),Ee=oe||ue,Re=ue&&ue.length>0,me=Ee?Ee.reduce((st,Ke)=>Ke.duplicates?st+Ke.duplicates:st,0):0,Me=ie!==r.fY.none&&me>0,ye=Ee||[],Le=he?this.sortLogs(ye,he):ye,We=Le.slice(0,De),Be=Le.slice(De,Le.length),Ye=this.makeGetRows(Le),at=new p;return o.createElement("div",{className:Te.logRows,ref:this.logRowsRef},this.state.selection&&this.state.selectedRow&&o.createElement(f,{close:this.closePopoverMenu,row:this.state.selectedRow,selection:this.state.selection,...this.state.popoverMenuCoordinates,onClickFilterValue:pe.onClickFilterValue,onClickFilterOutValue:pe.onClickFilterOutValue}),o.createElement("table",{className:(0,t.cx)(Te.logsRowsTable,this.props.overflowingContent?"":Te.logsRowsTableContain)},o.createElement("tbody",null,Re&&We.map(st=>o.createElement(re,{key:at.getKey(st.uid),getRows:Ye,row:st,showDuplicates:Me,logsSortOrder:he,onOpenContext:this.openContext,styles:Te,onPermalinkClick:this.props.onPermalinkClick,scrollIntoView:this.props.scrollIntoView,permalinkedRowId:this.props.permalinkedRowId,onPinLine:this.props.onPinLine,onUnpinLine:this.props.onUnpinLine,pinned:this.props.pinnedRowId===st.uid,isFilterLabelActive:this.props.isFilterLabelActive,handleTextSelection:this.popoverMenuSupported()?this.handleSelection:void 0,...pe})),Re&&le&&Be.map(st=>o.createElement(re,{key:at.getKey(st.uid),getRows:Ye,row:st,showDuplicates:Me,logsSortOrder:he,onOpenContext:this.openContext,styles:Te,onPermalinkClick:this.props.onPermalinkClick,scrollIntoView:this.props.scrollIntoView,permalinkedRowId:this.props.permalinkedRowId,onPinLine:this.props.onPinLine,onUnpinLine:this.props.onUnpinLine,pinned:this.props.pinnedRowId===st.uid,isFilterLabelActive:this.props.isFilterLabelActive,handleTextSelection:this.popoverMenuSupported()?this.handleSelection:void 0,...pe})),Re&&!le&&o.createElement("tr",null,o.createElement("td",{colSpan:5},"Rendering ",Le.length-De," rows...")))))}}ne.defaultProps={previewLimit:J};const q=(0,u.cV)(ne);q.displayName="LogsRows"},77020:(Q,A,e)=>{"use strict";e.d(A,{D:()=>c,L:()=>u});var t=e(32196),n=e(41811),o=e(84140),s=e(9557),r=e(23596),g=e(16797);const u=(i,l)=>{let f=i.isLight?i.v1.palette.gray5:i.v1.palette.gray2;switch(l){case s.$b.crit:case s.$b.critical:f="#705da0";break;case s.$b.error:case s.$b.err:f="#e24d42";break;case s.$b.warning:case s.$b.warn:f=i.colors.warning.main;break;case s.$b.info:f="#7eb26d";break;case s.$b.debug:f="#1f78c1";break;case s.$b.trace:f="#6ed0e0";break}return{logsRowLevelColor:(0,t.css)` &::after { background-color: ${f}; } `}},c=(0,n.A)(i=>{const l=g.hoverColor(i.colors.background.secondary,i),f=(0,o.A)(i.components.dashboard.background).setAlpha(.7).toRgbString();return{logsRowLevel:(0,t.css)` label: logs-row__level; max-width: ${i.spacing(1.25)}; cursor: default; &::after { content: ''; display: block; position: absolute; top: 1px; bottom: 1px; width: 3px; left: ${i.spacing(.5)}; } `,logsRowMatchHighLight:(0,t.css)` label: logs-row__match-highlight; background: inherit; padding: inherit; color: ${i.components.textHighlight.text} background-color: ${i.components.textHighlight}; `,logRows:(0,t.css)({position:"relative"}),logsRowsTable:(0,t.css)` label: logs-rows; font-family: ${i.typography.fontFamilyMonospace}; font-size: ${i.typography.bodySmall.fontSize}; width: 100%; position: relative; `,logsRowsTableContain:(0,t.css)` contain: strict; `,highlightBackground:(0,t.css)` background-color: ${(0,o.A)(i.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: ${l}; } td:not(.log-row-menu-cell):last-child { width: 100%; } > td:not(.log-row-menu-cell) { position: relative; padding-right: ${i.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: ${i.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 ${i.spacing(.5)}; height: ${i.spacing(3)}; width: ${i.spacing(3.25)}; line-height: ${i.spacing(2.5)}; overflow: hidden; &:hover { background-color: ${r.alpha(i.colors.text.primary,.12)}; } } `,logDetailsContainer:(0,t.css)` label: logs-row-details-table; border: 1px solid ${i.colors.border.medium}; padding: 0 ${i.spacing(1)} ${i.spacing(1)}; border-radius: ${i.shape.radius.default}; margin: ${i.spacing(2.5)} ${i.spacing(1)} ${i.spacing(2.5)} ${i.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: ${i.v1.palette.gray3}; padding-top: 1px; padding-bottom: 1px; padding-right: ${i.spacing(.75)}; `,logDetailsLabel:(0,t.css)` label: logs-row-details__label; max-width: 30em; min-width: 20em; padding: 0 ${i.spacing(1)}; overflow-wrap: break-word; `,logDetailsHeading:(0,t.css)` label: logs-row-details__heading; font-weight: ${i.typography.fontWeightBold}; padding: ${i.spacing(1)} 0 ${i.spacing(.5)}; `,logDetailsValue:(0,t.css)` label: logs-row-details__row; position: relative; vertical-align: middle; cursor: default; &:hover { background-color: ${l}; } `,topVerticalAlign:(0,t.css)` label: topVerticalAlign; margin-top: -${i.spacing(.9)}; margin-left: -${i.spacing(.25)}; `,detailsOpen:(0,t.css)` &:hover { background-color: ${g.hoverColor(i.colors.background.primary,i)}; } `,errorLogRow:(0,t.css)` label: erroredLogRow; color: ${i.colors.text.secondary}; `,positionRelative:(0,t.css)` label: positionRelative; position: relative; `,rowWithContext:(0,t.css)` label: rowWithContext; z-index: 1; outline: 9999px solid ${f}; 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: ${i.colors.background.primary}; box-shadow: ${i.shadows.z3}; padding: ${i.spacing(.5,1,.5,1)}; z-index: 100; gap: ${i.spacing(.5)}; & > button { margin: 0; } `,logRowMenuCell:(0,t.css)` position: sticky; z-index: ${i.zIndex.dropdown}; margin-top: -${i.spacing(.125)}; right: 0px; & > span { transform: translateX(-100%); } `,logLine:(0,t.css)` background-color: transparent; border: none; diplay: inline; font-family: ${i.typography.fontFamilyMonospace}; font-size: ${i.typography.bodySmall.fontSize}; letter-spacing: ${i.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: ${i.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: ${i.spacing(.5)}; } `,hidden:(0,t.css)` label: hidden; visibility: hidden; `,unPinButton:(0,t.css)` height: ${i.spacing(3)}; line-height: ${i.spacing(2.5)}; `}})},81166:(Q,A,e)=>{"use strict";e.d(A,{V:()=>U});var t=e(32196),n=e(2543),o=e(96540),s=e(16817),r=e(39070),g=e(52622),u=e(9557),c=e(47232),i=e(14110),l=e(32264),f=e(40845),d=e(37390),h=e(55852),p=e(33390),m=e(97186),a=e(29436),v=e(80348),E=e(69147),D=e(91002),b=e(81073),C=e(14647),y=e(15292);function M(R){return{buttons:(0,t.css)({display:"flex",gap:R.spacing(1)})}}const T=R=>{const B=(0,f.of)(M),{wrapLines:H,onChangeWrapLines:w,onScrollCenterClick:N}=R,V=(0,o.useCallback)(G=>{const _=G.currentTarget.checked;(0,i.rR)("grafana_explore_logs_log_context_toggle_lines_clicked",{state:_}),w(_)},[w]);return o.createElement("div",{className:B.buttons},o.createElement(y.K,{showLabel:!0,value:H,onChange:V,label:"Wrap lines"}),o.createElement(h.$n,{variant:"secondary",onClick:N},"Center matched line"))},I=R=>({modal:(0,t.css)` width: 85vw; ${R.breakpoints.down("md")} { width: 100%; } top: 50%; left: 50%; transform: translate(-50%, -50%); `,sticky:(0,t.css)` position: sticky; z-index: 1; top: -1px; bottom: -1px; `,entry:(0,t.css)` & > td { padding: ${R.spacing(1)} 0 ${R.spacing(1)} 0; } background: ${R.colors.emphasize(R.colors.background.secondary)}; & > table { margin-bottom: 0; } & .log-row-menu { margin-top: -6px; } `,datasourceUi:(0,t.css)` padding-bottom: ${R.spacing(1.25)}; display: flex; align-items: center; `,logRowGroups:(0,t.css)` overflow: auto; max-height: 75%; align-self: stretch; display: inline-block; border: 1px solid ${R.colors.border.weak}; border-radius: ${R.shape.radius.default}; & > table { min-width: 100%; } `,flexColumn:(0,t.css)` display: flex; flex-direction: column; padding: 0 ${R.spacing(3)} ${R.spacing(3)} ${R.spacing(3)}; `,flexRow:(0,t.css)` display: flex; flex-direction: row; align-items: center; & > div:last-child { margin-left: auto; } `,noMarginBottom:(0,t.css)` & > table { margin-bottom: 0; } `,hidden:(0,t.css)` display: none; `,paddingTop:(0,t.css)` padding-top: ${R.spacing(1)}; `,paddingBottom:(0,t.css)` padding-bottom: ${R.spacing(1)}; `,link:(0,t.css)` color: ${R.colors.text.secondary}; font-size: ${R.typography.bodySmall.fontSize}; :hover { color: ${R.colors.text.link}; } `,loadingCell:(0,t.css)` position: sticky; left: 50%; display: inline-block; transform: translateX(-50%); `}),x=()=>({above:{loadingState:r.Gu.NotStarted,rows:[]},below:{loadingState:r.Gu.NotStarted,rows:[]}}),S=(R,B)=>R==="above"&&B===g.uH.Descending||R==="below"&&B===g.uH.Ascending?u.ZF.Forward:u.ZF.Backward,O=(R,B)=>({...R,dataFrame:{...R.dataFrame,refId:`context_${B.above}_${B.below}`}}),P=(R,B)=>R.some(H=>H.entry===B.entry&&H.timeEpochNs===B.timeEpochNs),L=100,U=({row:R,open:B,logsSortOrder:H,timeZone:w,getLogRowContextUi:N,getRowContextQuery:V,onClose:G,getRowContext:_})=>{const K=(0,o.useRef)(null),j=(0,o.useRef)(null),k=(0,o.useRef)(null),Y=(0,o.useRef)(null),ee=(0,o.useRef)(null),re=(0,o.useRef)(null),J=(0,o.useRef)(null),ne=(0,o.useRef)({above:0,below:0}),q=(0,v.useDispatch)(),te=(0,f.$j)(),oe=I(te),[ue,ie]=(0,o.useState)(!0),[ge,he]=(0,o.useState)(x()),De=(xe,$e)=>{he(be=>{const Z={...be};return Z[xe]=$e(be[xe]),Z})},pe=(0,o.useRef)(1),[le,Te]=(0,o.useState)(null),[Ee,Re]=(0,o.useState)(p.A.getBool(m.$.logContextWrapLogMessage,p.A.getBool(m.$.wrapLogMessage,!0))),me=(0,o.useCallback)(()=>{const{below:xe,above:$e}=ge,be=(0,D.oR)([...xe.rows,R,...$e.rows],g.uH.Ascending),Z=be[0].timeEpochMs;let ae=be[be.length-1].timeEpochMs;Z===ae&&(ae+=1);const de=(0,c.KQ)(Z),ve=(0,c.KQ)(ae);return{from:de,to:ve,raw:{from:de,to:ve}}},[ge,R]),Me=(0,o.useCallback)(async()=>{const xe=V?await V(R):null;Te(xe)},[R,V]),ye=async()=>{await Me(),he(x()),ne.current={above:0,below:0},pe.current+=1},Le=async(xe,$e)=>{ne.current[xe]+=1;const be=$e.at(xe==="above"?0:-1);if(be==null)throw new Error("should never happen. the array always contains at least 1 item (the middle row)");(0,i.rR)("grafana_explore_logs_log_context_load_more_called",{datasourceType:be.datasourceType,above:ne.current.above,below:ne.current.below});const Z=S(xe,H),ae=await _(O(be,ne.current),{limit:L,direction:Z}),de=(0,E.HT)(ae.data).rows;return H===g.uH.Ascending&&de.reverse(),de.filter(Ue=>!P($e,Ue))};(0,o.useEffect)(()=>{B&&Me()},[Me,B]);const[We,Be]=(0,o.useState)([]),Ye=xe=>{We.indexOf(xe)===-1&&Be([...We,xe])},at=xe=>{const $e=We.indexOf(xe);$e>-1&&(We.splice($e,1),Be([...We]))},st=async xe=>{const{below:$e,above:be}=ge;if(ge[xe].loadingState===r.Gu.Loading)return;De(xe,de=>({...de,loadingState:r.Gu.Loading}));const ae=pe.current;try{const de=[...be.rows,R,...$e.rows],ve=(await Le(xe,de)).map(Ne=>!Ne.searchWords||!Ne.searchWords?.length?{...Ne,searchWords:R.searchWords}:Ne),[Ue,_e]=(0,n.partition)(ve,Ne=>Ne.timeEpochNs>R.timeEpochNs),ze=H===g.uH.Ascending?_e:Ue,Ve=H===g.uH.Ascending?Ue:_e;ae===pe.current&&he(Ne=>{const ot=ze.length>0?(0,D.oR)([...ze,...Ne.above.rows],H):Ne.above.rows,nt=Ve.length>0?(0,D.oR)([...Ne.below.rows,...Ve],H):Ne.below.rows;return{above:{rows:ot,loadingState:xe==="above"?ve.length===0?r.Gu.Done:r.Gu.NotStarted:Ne.above.loadingState},below:{rows:nt,loadingState:xe==="below"?ve.length===0?r.Gu.Done:r.Gu.NotStarted:Ne.below.loadingState}}})}catch{De(xe,de=>({rows:de.rows,loadingState:r.Gu.Error}))}},Ke=async(xe,$e)=>{for(const be of xe){if(!be.isIntersecting)continue;const Z=be.target;Z===re.current?st("above"):Z===J.current&&st("below")}};(0,o.useEffect)(()=>{const xe=K.current,$e=re.current,be=J.current;if(xe==null)return;const Z=new IntersectionObserver(Ke,{root:xe});return $e!=null&&Z.observe($e),be!=null&&Z.observe(be),()=>{Z.disconnect()}});const Xe=(0,o.useCallback)(()=>{k.current?.scrollIntoView({block:"center"}),j.current?.scrollIntoView({block:"center"})},[k,j]);(0,o.useLayoutEffect)(()=>{const xe=K.current;if(xe==null)return;const $e=ee.current,be=xe.clientHeight;if(ee.current=be,$e!==be){Xe();return}if(ne.current.above<=1&&ne.current.below<=1){Xe();return}const Z=Y.current,ae=xe.scrollHeight;if(Y.current=ae,Z!=null){const de=xe.scrollTop+(ae-Z);xe.scrollTop=de}},[ge.above.rows,Xe]),(0,s.A)(Me,[V,R]);const He=ge.above.loadingState,Ge=ge.below.loadingState;return o.createElement(d.a,{isOpen:B,title:"Log context",contentClassName:oe.flexColumn,className:oe.modal,onDismiss:G},l.$.featureToggles.logsContextDatasourceUi&&N&&o.createElement("div",{className:oe.datasourceUi},N(R,ye)),o.createElement("div",{className:(0,t.cx)(oe.flexRow,oe.paddingBottom)},o.createElement("div",null,o.createElement(T,{wrapLines:Ee,onChangeWrapLines:Re,onScrollCenterClick:Xe}))),o.createElement("div",{ref:K,className:oe.logRowGroups},o.createElement("table",null,o.createElement("tbody",null,o.createElement("tr",null,o.createElement("td",{className:oe.loadingCell},He!==r.Gu.Done&&He!==r.Gu.Error&&o.createElement("div",{ref:re},o.createElement(b.I,{adjective:"newer"})),He===r.Gu.Error&&o.createElement("div",null,"Error loading log more logs."),He===r.Gu.Done&&o.createElement("div",null,"No more logs available."))),o.createElement("tr",null,o.createElement("td",{className:oe.noMarginBottom},o.createElement(C.k,{logRows:ge.above.rows,dedupStrategy:g.fY.none,showLabels:p.A.getBool(m.$.showLabels,!1),showTime:p.A.getBool(m.$.showTime,!0),wrapLogMessage:Ee,prettifyLogMessage:p.A.getBool(m.$.prettifyLogMessage,!1),enableLogDetails:!0,timeZone:w,displayedFields:We,onClickShowField:Ye,onClickHideField:at}))),o.createElement("tr",{ref:k}),o.createElement("tr",{ref:j,className:(0,t.cx)(oe.entry,ue?oe.sticky:null),"data-testid":"entry-row"},o.createElement("td",{className:oe.noMarginBottom},o.createElement(C.k,{logRows:[R],dedupStrategy:g.fY.none,showLabels:p.A.getBool(m.$.showLabels,!1),showTime:p.A.getBool(m.$.showTime,!0),wrapLogMessage:Ee,prettifyLogMessage:p.A.getBool(m.$.prettifyLogMessage,!1),enableLogDetails:!0,timeZone:w,displayedFields:We,onClickShowField:Ye,onClickHideField:at,onUnpinLine:()=>ie(!1),onPinLine:()=>ie(!0),pinnedRowId:ue?R.uid:void 0,overflowingContent:!0}))),o.createElement("tr",null,o.createElement("td",null,o.createElement(o.Fragment,null,o.createElement(C.k,{logRows:ge.below.rows,dedupStrategy:g.fY.none,showLabels:p.A.getBool(m.$.showLabels,!1),showTime:p.A.getBool(m.$.showTime,!0),wrapLogMessage:Ee,prettifyLogMessage:p.A.getBool(m.$.prettifyLogMessage,!1),enableLogDetails:!0,timeZone:w,displayedFields:We,onClickShowField:Ye,onClickHideField:at})))),o.createElement("tr",null,o.createElement("td",{className:oe.loadingCell},Ge!==r.Gu.Done&&Ge!==r.Gu.Error&&o.createElement("div",{ref:J},o.createElement(b.I,{adjective:"older"})),Ge===r.Gu.Error&&o.createElement("div",null,"Error loading log more logs."),Ge===r.Gu.Done&&o.createElement("div",null,"No more logs available.")))))),o.createElement(d.a.ButtonRow,null,le?.datasource?.uid&&o.createElement(h.$n,{variant:"secondary",onClick:async()=>{let xe=R.uid;R.dataFrame.refId&&(xe=R.uid.replace(R.dataFrame.refId,le.refId)),q((0,a.ve)({queries:[le],range:me(),datasourceUid:le.datasource.uid,panelsState:{logs:{id:xe}}})),G(),(0,i.rR)("grafana_explore_logs_log_context_open_split_view_clicked",{datasourceType:R.datasourceType,logRowUid:R.uid})}},"Open in split view")))}},70377:(Q,A,e)=>{"use strict";e.d(A,{FE:()=>c,jE:()=>g,qE:()=>u});var t=e(2543),n=e.n(t),o=e(41811),s=e(87490),r=e(98101);const g=(0,o.A)((f,d)=>{const h=c(f,d);return Object.values(h)}),u=(0,o.A)(f=>{let d=[];return f.forEach(h=>{h.links?.forEach(p=>{if(p.variables){const m=p.variables.map(v=>{const E=v.variableName,D=v.fieldPath?`.${v.fieldPath}`:"";return`${E}${D}`}),a=p.variables.map(v=>v.found?v.value:"");d.push({keys:m,values:a,links:[p],fieldIndex:h.fieldIndex})}})}),d}),c=(0,o.A)((f,d)=>l(f.dataFrame).visible.filter(m=>m.values[f.rowIndex]!=null).map(m=>{const a=d?d(m,f.rowIndex,f.dataFrame):[],v=m.values[f.rowIndex],E=typeof v=="string"||typeof v=="number"?v.toString():(0,s.MA)(v);return{keys:[m.name],values:[E],links:a,fieldIndex:m.index}}));function i(f,d){const h=(0,r.O)(f);if(h===null)return new Set;const p=new Set(h.extraFields.map(m=>m.index));return h.severityField!==null&&p.add(h.severityField.index),d.keepBody&&p.add(h.bodyField.index),d.keepTimestamp&&p.add(h.timeField.index),p}function l(f,d){const h=f.fields.map((v,E)=>({...v,index:E})),p=i(f,d??{}),[m,a]=(0,t.partition)(h,v=>v.config.custom?.hidden?!1:(v.config.links??[]).length>0?!0:p.has(v.index));return{visible:m,hidden:a}}},98101:(Q,A,e)=>{"use strict";e.d(A,{n:()=>h,O:()=>m});var t=e(85404),n=e(11261),o=e(41260);function s(a,v){const E=a.labels;if(E!==void 0){const D=new Array(v);return D.fill(E),D}else return null}function r(a,v,E){const D=a.getFieldByName("labels");if(D!==void 0&&D.type===n.PU.other){const b=D.values.map(h);return[D,()=>b]}else return[null,()=>s(v,E.length)]}function g(a){const v=new t.L(a),E=v.getFirstFieldOfType(n.PU.time),D=v.getFirstFieldOfType(n.PU.string);if(E===void 0||D===void 0)return null;const b=v.getFieldByName("tsNs")??null,C=v.getFieldByName("level")??null,y=v.getFieldByName("id")??null,[M,T]=r(v,D,a),I=v.fields.filter((x,S)=>S!==E.index&&S!==D.index&&S!==b?.index&&S!==C?.index&&S!==y?.index&&S!==M?.index);return{timeField:E,bodyField:D,timeNanosecondField:b,severityField:C,idField:y,getLogFrameLabels:T,getLogFrameLabelsAsLabels:T,getLabelFieldName:()=>M?.name??null,extraFields:I}}function u(a,v,E){const D=a.getFieldByName(v);if(D!==void 0)return D.type===E?D:void 0}const c="timestamp",i="body",l="severity",f="id",d="labels";function h(a){const v={};return Object.entries(a).forEach(([E,D])=>{v[E]=typeof D=="string"?D:JSON.stringify(D)}),v}function p(a){const v=new t.L(a),E=u(v,c,n.PU.time),D=u(v,i,n.PU.string);if(E===void 0||D===void 0)return null;const b=u(v,l,n.PU.string)??null,C=u(v,f,n.PU.string)??null,y=u(v,d,n.PU.other)??null,M=y===null?null:y.values,T=v.fields.filter((I,x)=>x!==E.index&&x!==D.index&&x!==b?.index&&x!==C?.index&&x!==y?.index);return{timeField:E,bodyField:D,severityField:b,idField:C,getLogFrameLabels:()=>M,timeNanosecondField:null,getLogFrameLabelsAsLabels:()=>M!==null?M.map(h):null,getLabelFieldName:()=>y!==null?y.name:null,extraFields:T}}function m(a){return a.meta?.type===o.m.LogLines?p(a):g(a)}},69147:(Q,A,e)=>{"use strict";e.d(A,{yR:()=>x,HT:()=>K,M0:()=>w,ct:()=>N,O6:()=>_,f8:()=>ge,J9:()=>V,Wr:()=>ue,sg:()=>oe});var t=e(2543),n=e(88483),o=e(50832),s=e(65474),r=e(9557),g=e(52622),u=e(14236),c=e(85404),i=e(11261),l=e(24293),f=e(47232),d=e(8249),h=e(40672),p=e(72724),m=e(65879),a=e(39070),v=e(26517),E=e(32264),D=e(24284),b=e(88838),C=e(2913);function y(he,De){return C.Ay.bootData?.user?.lightTheme?De:he}var M=e(98101),T=e(91002);const I="Line limit",x="Common labels",S={[r.$b.critical]:D.Tj[7],[r.$b.warning]:D.Tj[1],[r.$b.error]:D.Tj[4],[r.$b.info]:D.Tj[0],[r.$b.debug]:D.Tj[5],[r.$b.trace]:D.Tj[2],[r.$b.unknown]:y("#8e8e8e","#bdc4cd")},O=1,P=1e3*O,L=60*P,U=60*L,R=24*U,B=/\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 H(he,De,pe){switch(pe){case g.fY.exact:return he.entry.replace(B,"")===De.entry.replace(B,"");case g.fY.numbers:return he.entry.replace(/\d/g,"")===De.entry.replace(/\d/g,"");case g.fY.signature:return he.entry.replace(/\w/g,"")===De.entry.replace(/\w/g,"");default:return!1}}function w(he,De){return De===g.fY.none?he:he.reduce((pe,le,Te)=>{const Ee={...le},Re=pe[pe.length-1];return Te>0&&H(le,Re,De)?Re.duplicates++:(Ee.duplicates=0,pe.push(Ee)),pe},[])}function N(he,De){return De.size===0?he:he.filter(pe=>!De.has(pe.logLevel))}function V(he,De){const pe={},le=[];for(const Te of he){let Ee=pe[Te.logLevel];Ee||(pe[Te.logLevel]=Ee={lastTs:null,datapoints:[],target:Te.logLevel,color:S[Te.logLevel]},le.push(Ee));const Re=Math.floor(Te.timeEpochMs/De)*De;Re===Ee.lastTs?Ee.datapoints[Ee.datapoints.length-1][0]++:(Ee.datapoints.push([1,Re]),Ee.lastTs=Re);for(const me of le)me!==Ee&&me.lastTs!==Re&&(me.datapoints.push([0,Re]),me.lastTs=Re)}return le.map((Te,Ee)=>{Te.datapoints.sort((ye,Le)=>ye[1]-Le[1]);const Re=(0,u.Vc)(Te),Me=new c.L(Re).getFirstFieldOfType(i.PU.number);return Re.fields[Me.index].config.min=0,Re.fields[Me.index].config.decimals=0,Re.fields[Me.index].config.color={mode:l.Y.Fixed,fixedColor:Te.color},Re.fields[Me.index].config.custom={drawStyle:g.GR.Bars,barAlignment:g.Nj.Center,barWidthFactor:.9,barMaxWidth:5,lineColor:Te.color,pointColor:Te.color,fillColor:Te.color,lineWidth:0,fillOpacity:100,stacking:{mode:g.gs.Normal,group:"A"}},Re})}function G(he){return he.fields.some(De=>De.type===i.PU.time)&&he.fields.some(De=>De.type===i.PU.string)}const _="infinite-scroll-";function K(he,De,pe,le){let Te=!1;le=le?.map(me=>me.refId.includes(_)?(Te=!0,{...me,refId:me.refId.replace(_,"")}):me),Te&&(he=he.map(me=>({...me,refId:me.refId?.replace(_,"")})));const{logSeries:Ee}=k(he),Re=ee(Ee,le,Te);if(Re){if(De&&Re.rows.length>0){const me=Re.rows.sort(T.M1),{visibleRange:Me,bucketSize:ye,visibleRangeMs:Le,requestedRangeMs:We}=j(me,De,pe);Re.visibleRange=Me,Re.bucketSize=ye,Re.series=V(me,ye),Re.meta&&(Re.meta=re(Re,Le,We))}else Re.series=[];return Re.queries=le,Re}return{hasUniqueLabels:!1,rows:[],meta:[],series:[],queries:le}}function j(he,De,pe,le=20,Te=1e3){let Ee=pe,Re=De,me=Math.max(Re*le,Te),Me,ye;if(pe){const Le=he[0].timeEpochMs;if(ye=pe.to-pe.from,Me=pe.to-Le,Me>0){const We=Me/ye;Re*=We,me=Math.max(Math.ceil(Re*le),Te),Ee={from:Math.floor(Le/me)*me,to:pe.to}}else Me=1}return{bucketSize:me,visibleRange:Ee,visibleRangeMs:Me,requestedRangeMs:ye}}function k(he){const De=[],pe=[];for(const le of he){if(G(le)||!le.fields.length){pe.push(le);continue}le.length>0&&De.push(le)}return{logSeries:pe,metricSeries:De}}function Y(he,De,pe){const le=he.values[pe],Ee=(0,f.yT)(le).valueOf();if(De)return{ts:le,timeEpochMs:Ee,timeEpochNs:De.values[pe]};if(he.nanos!==void 0){const Re=he.nanos[pe].toString().padStart(6,"0"),me=`${Ee}${Re}`;return{ts:le,timeEpochMs:Ee,timeEpochNs:me}}return{ts:le,timeEpochMs:Ee,timeEpochNs:Ee+"000000"}}function ee(he,De=[],pe=!1){if(he.length===0)return;const le=[];let Te=[];const Ee=he.filter(He=>He.fields.length);Ee.length&&Ee.forEach(He=>{const Ge=(0,M.O)(He);if(Ge!=null){const xe=Ge.getLogFrameLabelsAsLabels()??void 0,$e={rawFrame:He,logsFrame:Ge,frameLabels:xe};Te.push($e),xe&&xe.length>0&&le.push(xe)}});const Re=le.flat(),me=Re.length>0?(0,d.yO)(Re):{};let Me=[],ye=!1;const Le=(0,T.kA)();for(const He of Te){const{logsFrame:Ge,rawFrame:xe,frameLabels:$e}=He,{timeField:be,timeNanosecondField:Z,bodyField:ae,severityField:de,idField:ve}=Ge;for(let Ue=0;Ue<xe.length;Ue++){const{ts:_e,timeEpochMs:ze,timeEpochNs:Ve}=Y(be,Z??void 0,Ue),Ne=ae.values[Ue]??"",ot=typeof Ne=="string"?Ne:JSON.stringify(Ne),nt=h.sQ.hasAnsiCodes(ot),pt=!!ot.match(/\\n|\\t|\\r/),mt=xe.meta?.custom?.searchWords??xe.meta?.searchWords??[],gt=nt?b.DB.strip(ot):ot,Pt=$e?.[Ue],Mt=(0,d.s6)(Pt,me);Object.keys(Mt).length>0&&(ye=!0);let Yt=r.$b.unknown;const zt=de&&de.values[Ue]||Pt&&Pt.level;zt?Yt=(0,T.EK)(zt):Yt=(0,T.XM)(gt);const _t=De.find(It=>It.refId===xe.refId)?.datasource?.type,rt={entryFieldIndex:ae.index,rowIndex:Ue,dataFrame:xe,logLevel:Yt,timeFromNow:(0,p.fq)(_e),timeEpochMs:ze,timeEpochNs:Ve,timeLocal:(0,p.LE)(_e,{timeZone:"browser"}),timeUtc:(0,p.LE)(_e,{timeZone:"utc"}),uniqueLabels:Mt,hasAnsi:nt,hasUnescapedContent:pt,searchWords:mt,entry:gt,raw:ot,labels:Pt||{},uid:`${xe.refId}_${ve?ve.values[Ue]:Ue.toString()}`,datasourceType:_t};ve!==null&&(rt.rowId=ve.values[Ue]),!(pe&&Le(rt))&&Me.push(rt)}}const We=[];(0,t.size)(me)>0&&We.push({label:x,value:me,kind:r.tG.LabelsMap});const Ye=he.filter(He=>He?.meta?.custom?.limit??He?.meta?.limit).reduce((He,Ge)=>(He[Ge.refId??""]=Ge.meta?.custom?.limit??Ge.meta?.limit??0,He),{}),at=Object.values(Ye).reduce((He,Ge)=>He+=Ge,0);at>0&&We.push({label:I,value:at,kind:r.tG.Number});let st=0;const Ke={};let Xe=!1;for(const He of he){const Ge=He.meta?.custom?.lokiQueryStatKey,{refId:xe}=He;if(!Xe&&He.meta?.custom?.error&&(We.push({label:"",value:He.meta?.custom.error,kind:r.tG.Error}),Xe=!0),xe&&!Ke[xe]){if(Ge&&He.meta?.stats){const $e=He.meta.stats.find(be=>be.displayName===Ge);$e&&(st+=$e.value)}Ke[xe]=!0}}if(st>0){const{text:He,suffix:Ge}=(0,v.rT)("B")(st);We.push({label:"Total bytes processed",value:`${He} ${Ge}`,kind:r.tG.String})}return{hasUniqueLabels:ye,meta:We,rows:Me}}function re(he,De,pe){if(!he.meta)return[];let le=[...he.meta];const Te=le.findIndex(Re=>Re.label===I),Ee=Te>=0&&le[Te]?.value;if(Ee&&typeof Ee=="number"&&Ee>0){let Re;if(Ee===he.rows.length&&De&&pe){const me=(De/pe*100).toFixed(2);Re=`${Ee} reached, received logs cover ${me}% (${m.msRangeToTimeString(De)}) of your selected time range (${m.msRangeToTimeString(pe)})`}else{const me=E.$.featureToggles.logsInfiniteScrolling?"displayed":"returned";Re=`${Ee} (${he.rows.length} ${me})`}le[Te]={label:I,value:Re,kind:r.tG.String}}return le}function J(he,De){const pe=De&&he===r.$b.unknown?"logs":he,le=S[he];return{displayNameFromDS:pe,color:{mode:l.Y.Fixed,fixedColor:le},custom:{drawStyle:g.GR.Bars,barAlignment:g.Nj.Center,lineColor:le,pointColor:le,fillColor:le,lineWidth:1,fillOpacity:100,stacking:{mode:g.gs.Normal,group:"A"}}}}const ne=(he,De,pe)=>(he.fields=he.fields.map(le=>(le.type===i.PU.number&&(le.config={...le.config,...J(De(he),pe)}),le)),he);function q(he){let De;try{De=new c.L(he).getFirstFieldOfType(i.PU.number)}catch{}return De?.labels?te(De.labels):r.$b.unknown}function te(he){const De=he.level??he.lvl??he.loglevel??"";return De?(0,T.EK)(De):r.$b.unknown}function oe(he,De,pe){const le=De.range,Te=pe.targets,Ee=q,Re=le.to.valueOf()-le.from.valueOf(),me=ie(De.scopedVars,Re);return De.interval=me.interval,De.scopedVars.__interval={value:me.interval,text:me.interval},me.intervalMs!==void 0&&(De.intervalMs=me.intervalMs,De.scopedVars.__interval_ms={value:me.intervalMs,text:me.intervalMs}),De.hideFromInspector=!0,new n.c(Me=>{let ye=[];Me.next({state:a.Gu.Loading,error:void 0,data:[]});const Le=he.query(De),Be=((0,o.A)(Le)?Le:(0,s.H)(Le)).subscribe({complete:()=>{Me.complete()},next:Ye=>{const{error:at}=Ye;if(at!==void 0)Me.next({state:a.Gu.Error,error:at,data:[]}),Me.error(at);else{const st=(0,t.groupBy)(Ye.data,"refId");ye=Ye.data.map(Ke=>{if(Ke.meta?.dataTopic===g.QR.Annotations)return Ke;let Xe=Ke.refId||"";Xe.startsWith("log-volume-")&&(Xe=Xe.substr(11));const He={logsVolumeType:r.Aj.FullRange,absoluteRange:{from:le.from.valueOf(),to:le.to.valueOf()},datasourceName:he.name,sourceQuery:Te.find(Ge=>Ge.refId===Xe)};return Ke.meta={...Ke.meta,custom:{...Ke.meta?.custom,...He}},ne(Ke,Ee,st[Ke.refId].length===1)}),Me.next({state:Ye.state,error:void 0,data:ye})}},error:Ye=>{Me.next({state:a.Gu.Error,error:Ye,data:[]}),Me.error(Ye)}});return()=>{Be?.unsubscribe()}})}function ue(he,De){return De.hideFromInspector=!0,new n.c(pe=>{let le=[];pe.next({state:a.Gu.Loading,error:void 0,data:[]});const Te=he.query(De),Re=((0,o.A)(Te)?Te:(0,s.H)(Te)).subscribe({complete:()=>{pe.next({state:a.Gu.Done,error:void 0,data:le}),pe.complete()},next:me=>{const{error:Me}=me;Me!==void 0?(pe.next({state:a.Gu.Error,error:Me,data:[]}),pe.error(Me)):le=me.data.map(ye=>{const Le=(0,u.Vc)(ye),{timeIndex:We}=(0,u.KR)(Le);return(0,u.ES)(Le,We)})},error:me=>{pe.next({state:a.Gu.Error,error:me,data:[]}),pe.error(me)}});return()=>{Re?.unsubscribe()}})}function ie(he,De){if(he.__interval_ms){let pe=he.__interval_ms.value,le="";return De<P*5?(pe=O,le="1ms"):pe>U?(pe=R,le="1d"):pe>L?(pe=U,le="1h"):pe>P?(pe=L,le="1m"):(pe=P,le="1s"),{interval:le,intervalMs:pe}}else return{interval:"$__interval"}}function ge(he){const De=he.dataFrame;return De.length===0||De.length<=he.rowIndex?null:(0,u.EI)({fields:De.fields.map(le=>({...le,values:[le.values[he.rowIndex]]})),refId:De.refId})}},91002:(Q,A,e)=>{"use strict";e.d(A,{Dg:()=>b,Dk:()=>I,Dm:()=>M,Dx:()=>C,EK:()=>l,Ei:()=>E,Hw:()=>D,M1:()=>p,Tj:()=>f,XM:()=>i,a8:()=>x,e3:()=>T,kA:()=>S,oR:()=>v,oT:()=>y,s2:()=>d,zy:()=>a});var t=e(2543),n=e.n(t),o=e(9557),s=e(52622),r=e(85404),g=e(11261),u=e(37471),c=e(70377);function i(O){if(!O)return o.$b.unknown;let P=o.$b.unknown,L;for(const[U,R]of Object.entries(o.$b)){const H=new RegExp(`\\b${U}\\b`,"i").exec(O);H&&(L===void 0||H.index<L)&&(P=R,L=H.index)}return P}function l(O){const P=o.$b[O.toString().toLowerCase()];return P||o.$b.unknown}function f(O,P){const L=O.filter(B=>B.labels[P]!==void 0),U=L.length,R=(0,t.countBy)(L,B=>B.labels[P]);return h(R,U)}function d(O){const P=O.filter(U=>U!=null),L=(0,t.countBy)(P);return h(L,P.length)}const h=(O,P)=>(0,t.chain)(O).map((L,U)=>({count:L,value:U,proportion:L/P})).sortBy("count").reverse().value(),p=(O,P)=>O.timeEpochMs<P.timeEpochMs?-1:O.timeEpochMs>P.timeEpochMs?1:O.timeEpochNs<P.timeEpochNs?-1:O.timeEpochNs>P.timeEpochNs?1:0,m=(O,P)=>O.timeEpochMs>P.timeEpochMs?-1:O.timeEpochMs<P.timeEpochMs?1:O.timeEpochNs>P.timeEpochNs?-1:O.timeEpochNs<P.timeEpochNs?1:0,a=(O,P)=>{const L=O?v(O.rows,P):[];return O?{...O,rows:L}:{hasUniqueLabels:!1,rows:L}},v=(O,P)=>P===s.uH.Ascending?O.sort(p):O.sort(m),E=O=>O.labels.__error__?{hasError:!0,errorMessage:O.labels.__error__}:{hasError:!1},D=O=>O.replace(/\\r\\n|\\n|\\t|\\r/g,P=>P.slice(1)==="t"?" ":` `);function b(O){return O.map(P=>{const L=(0,c.FE)(P).reduce((U,R)=>{const B=R.keys[0];return U[B]=R.values[0],U},{});return{line:P.entry,timestamp:P.timeEpochNs,fields:{...L,...P.labels}}})}const C=O=>{let P={from:1/0,to:-1/0};return O.forEach(L=>{const U=L.meta?.custom||{};U.absoluteRange?.from&&U.absoluteRange?.to&&(P={from:Math.min(P.from,U.absoluteRange.from),to:Math.max(P.to,U.absoluteRange.to)})}),P},y=O=>{if(O.length===0)throw new Error("Cannot aggregate data frames: there must be at least one data frame to aggregate");const P={},L={};let U=-1/0;const R={};let B=[];return O.forEach(H=>{const w=new r.L(H),N=w.getFirstFieldOfType(g.PU.time),V=w.getFirstFieldOfType(g.PU.number);if(!N)throw new Error("Missing time field");if(!V)throw new Error("Missing value field");const G=V.config.displayNameFromDS||H.name||"logs",_=V.values.length;R[G]={meta:H.meta,valueFieldConfig:V.config,timeFieldConfig:N.config};for(let K=0;K<_;K++){const j=N.values[K],k=V.values[K];P[G]??={},P[G][j]=(P[G][j]||0)+k,L[j]=(L[j]||0)+k,U=Math.max(L[j],U)}}),Object.keys(P).forEach(H=>{const w=new u.k,{meta:N,timeFieldConfig:V,valueFieldConfig:G}=R[H];w.name=H,w.meta=N,w.addField({name:"Time",type:g.PU.time,config:V}),w.addField({name:"Value",type:g.PU.number,config:G}),Object.entries(P[H]).sort((_,K)=>Number(_[0])-Number(K[0])).forEach(([_,K])=>{w.add({Time:Number(_),Value:K})}),B.push(w)}),{dataFrames:B,maximum:U}},M=O=>{const P=O[0]?.meta?.custom;return P&&P.datasourceName?{name:P.datasourceName}:null},T=O=>O[0]?.meta?.custom?.logsVolumeType===o.Aj.Limited,I=async(O,P)=>{if(navigator.clipboard&&window.isSecureContext)return navigator.clipboard.writeText(O);{const L=document.createElement("textarea");P.current?.appendChild(L),L.value=O,L.focus(),L.select(),document.execCommand("copy"),L.remove()}};function x(O){return O instanceof Element}function S(){const O=new Set;return function(P){let L=`${P.dataFrame.refId}_${P.rowId?P.rowId:`${P.timeEpochNs}_${P.entry}`}`;return O.has(L)?!0:(O.add(L),!1)}}},90591:(Q,A,e)=>{"use strict";e.d(A,{m:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(96374),r=e(44836);const g=({title:i})=>{const l=(0,o.of)(c);return n.createElement("p",{className:l.description},i?(0,r.t)("public-dashboard.delete-modal.revoke-nonorphaned-body-text","Are you sure you want to revoke this URL? The dashboard will no longer be public."):(0,r.t)("public-dashboard.delete-modal.revoke-orphaned-body-text","Orphaned public dashboard will no longer be public."))},u=({dashboardTitle:i,onConfirm:l,onDismiss:f})=>{const d=(0,r.t)("public-dashboard.delete-modal.revoke-title","Revoke public URL");return n.createElement(s.u,{isOpen:!0,body:n.createElement(g,{title:i}),onConfirm:l,onDismiss:f,title:d,icon:"trash-alt",confirmText:d})},c=i=>({title:(0,t.css)` margin-bottom: ${i.spacing(1)}; `,description:(0,t.css)` font-size: ${i.typography.body.fontSize}; `})},71500:(Q,A,e)=>{"use strict";e.d(A,{P:()=>s});var t=e(24439);class n extends Error{constructor(g,u){super(u),this.type=g}}class o{constructor(){this.rootName="general"}validateNewDashboardName(g,u){return this.validate(g,u,"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,u,c){u=(u||"").trim();const i=u.toLowerCase();if(u.length===0)throw new n("REQUIRED","Name is required");if(i===this.rootName)throw new n("EXISTING","This is a reserved name and cannot be used for a folder.");const f=await(0,t.getGrafanaSearcher)().search({kind:["dashboard"],query:u,location:g||"general"});for(const d of f.view)if(i===d.name.toLowerCase())throw new n("EXISTING",c)}}const s=new o},11230:(Q,A,e)=>{"use strict";e.d(A,{A_:()=>w,FG:()=>b,Q9:()=>C,Ql:()=>B,c0:()=>R,dz:()=>H,iP:()=>d,kV:()=>S,rw:()=>f,vV:()=>P});var t=e(17172),n=e(19347),o=e(82467),s=e(3169),r=e(55314),g=e(6473),u=e(80348),c=e(57767),i=e(98796),l=e(88264);function f(V){return async G=>{try{G((0,l.f7)());const _=await(0,t.AI)().get(`/api/gnet/dashboards/${V}`);await G(E(_.json)),await G(m(_)),G(v())}catch(_){G((0,l.oQ)()),(0,t.NF)(_)&&G((0,o.dx)((0,s.gi)(_.data.message||_)))}}}function d(V){return async G=>{await G(E(V)),await G(a(V)),G(v())}}const h=(V,G)=>V?.usage?.libraryPanels?.filter(_=>G.inputs.libraryPanels.some(K=>K.state!==l.J7.Exists&&K.model.uid===_.uid));function p(V,G){let _=V.__inputs;if(G.inputs.libraryPanels?.length){const K=[];V.__inputs?.forEach(j=>{if(!j?.usage?.libraryPanels){K.push(j);return}const k=h(j,G);j.usage={libraryPanels:k},!!k?.length&&K.push(j)}),_=K}return{...V,__inputs:_}}function m(V){return(G,_)=>{const K=_().importDashboard,j=p(V.json,K);G((0,l.Rp)({...V,json:j}))}}function a(V){return(G,_)=>{const K=_().importDashboard,j=p(V,K);G((0,l.dd)(j))}}function v(){return(V,G)=>{const _=G().importDashboard.dashboard;if(_&&_.__inputs){const K=[];_.__inputs.forEach(j=>{const k={name:j.name,label:j.label,info:j.description,value:j.value,type:j.type,pluginId:j.pluginId,options:[]};k.description=M(j),j.type===l.NZ.DataSource?y(j,k):k.info||(k.info="Specify a string constant"),K.push(k)}),V((0,l.y3)(K))}}}function E(V){return async function(G){const _=await D(V);G((0,l.dW)(_))}}async function D(V){if(!V||!V.__elements)return[];const G=[];for(const _ of Object.values(V.__elements)){if(_.kind!==i.i.Panel)continue;const K=_.model,{type:j,description:k}=K,{uid:Y,name:ee}=_,re={model:{model:K,uid:Y,name:ee,version:0,type:j,kind:i.i.Panel,description:k},state:l.J7.New};try{const J=await(0,c.Yr)(Y,!0);re.state=l.J7.Exists,re.model=J}catch(J){if(J.status!==404)throw J}G.push(re)}return G}function b(){return V=>{V((0,l.SN)())}}function C(V){return async(G,_)=>{const K=_().importDashboard.dashboard,j=_().importDashboard.inputs,k=[];V.dataSources?.forEach((Y,ee)=>{const re=j.dataSources[ee];k.push({name:re.name,type:re.type,pluginId:re.pluginId,value:Y.uid})}),V.constants?.forEach((Y,ee)=>{const re=j.constants[ee];k.push({value:Y,name:re.name,type:re.type})}),G(r.cU.endpoints.importDashboard.initiate({dashboard:{...K,title:V.title,uid:V.uid||K.uid},overwrite:!0,inputs:k,folderUid:V.folder.uid}))}}const y=(V,G)=>{(0,n.l)().getList({pluginId:V.pluginId}).length===0?G.info="No data sources of type "+V.pluginName+" found":G.info||(G.info="Select a "+V.pluginName+" data source")},M=V=>{if(V.usage&&V.usage.libraryPanels)return`List of affected library panels: ${V.usage.libraryPanels.reduce((_,K,j)=>j===0?K.name:`${_}, ${K.name}`,"")}`};async function T(V,G){const _={totalCount:V.length,successCount:0};for(const K of V)try{await L(K,G)!==null&&(_.successCount+=1)}catch(j){console.error("Failed to move a folder",j)}return _}function I(V,G,..._){return async K=>{try{const j=await V(..._);return Array.prototype.concat(K,[j])}catch(j){if(G)return K;throw j}}}function x(V,G){const _=[];for(const K of V)_.push(I(O,!0,K,!0));for(const K of G)_.push(I(w,!0,K,!0));return N(_)}function S(V){return g.t.ignoreNextSave(),(0,t.AI)().post("/api/dashboards/db/",{dashboard:V.dashboard,message:V.message??"",overwrite:V.overwrite??!1,folderUid:V.folderUid})}function O(V,G){return getBackendSrv().delete(`/api/folders/${V}?forceDeleteRules=false`,void 0,{showSuccessAlert:G})}function P(V){return(0,t.AI)().post("/api/folders",V)}function L(V,G){const _={parentUid:G.uid};return getBackendSrv().post(`/api/folders/${V}/move`,_,{showErrorAlert:!1})}const U=1e3;function R(V,G,_=u.SearchQueryType.Folder){return(0,t.AI)().get("/api/search",{query:V,type:_,permission:G,limit:U})}function B(V){return(0,t.AI)().get(`/api/folders/${V}`)}function H(V){return(0,t.AI)().get(`/api/folders/id/${V}`)}function w(V,G){return(0,t.AI)().delete(`/api/dashboards/uid/${V}`,{showSuccessAlert:G})}function N(V){return V.reduce((G,_)=>Promise.resolve(G).then(_),[])}},88264:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>a,J7:()=>r,NZ:()=>s,Rp:()=>l,SN:()=>c,V9:()=>g,dW:()=>d,dd:()=>f,f7:()=>p,oQ:()=>h,qx:()=>o,y3:()=>i});var t=e(30038),n=e(39070),o=(v=>(v[v.Gcom=0]="Gcom",v[v.Json=1]="Json",v))(o||{}),s=(v=>(v.DataSource="datasource",v.Constant="constant",v.LibraryPanel="libraryPanel",v))(s||{}),r=(v=>(v.New="new",v.Exists="exists",v.Different="different",v))(r||{});const g={meta:{updatedAt:"",orgName:""},dashboard:{},source:1,inputs:{},state:n.Gu.NotStarted},u=(0,t.Z0)({name:"manageDashboards",initialState:g,reducers:{setGcomDashboard:(v,E)=>{v.dashboard={...E.payload.json,id:null},v.meta={updatedAt:E.payload.updatedAt,orgName:E.payload.orgName},v.source=0,v.state=n.Gu.Done},setJsonDashboard:(v,E)=>{v.dashboard={...E.payload,id:null},v.meta=g.meta,v.source=1,v.state=n.Gu.Done},clearDashboard:v=>{v.dashboard={},v.state=n.Gu.NotStarted},setInputs:(v,E)=>{v.inputs={dataSources:E.payload.filter(D=>D.type==="datasource"),constants:E.payload.filter(D=>D.type==="constant"),libraryPanels:v.inputs.libraryPanels||[]}},setLibraryPanelInputs:(v,E)=>{v.inputs.libraryPanels=E.payload},fetchFailed:v=>{v.dashboard={},v.state=n.Gu.Error},fetchDashboard:v=>{v.state=n.Gu.Loading}}}),{clearDashboard:c,setInputs:i,setGcomDashboard:l,setJsonDashboard:f,setLibraryPanelInputs:d,fetchFailed:h,fetchDashboard:p}=u.actions,a={importDashboard:u.reducer}},32931:(Q,A,e)=>{"use strict";e.d(A,{EC:()=>u,L_:()=>r,YS:()=>s,bA:()=>g,wV:()=>c});var t=e(17172),n=e(82467),o=e(10943);function s(i={getBackendSrv:t.AI}){return async l=>{const f=await i.getBackendSrv().get("/api/org");return l((0,o.bK)(f)),f}}function r(i={getBackendSrv:t.AI}){return async(l,f)=>{const d=f().organization.organization;await i.getBackendSrv().put("/api/org",{name:d.name}),l((0,n.YA)(d.name)),l(s(i))}}function g(i,l={getBackendSrv:t.AI}){return async f=>{const d=await l.getBackendSrv().post("/api/user/using/"+i);f((0,n.YA)(d.name))}}function u(i,l={getBackendSrv:t.AI}){return async f=>{const d=await l.getBackendSrv().post("/api/orgs/",i);f(g(d.orgId))}}function c(i={getBackendSrv:t.AI}){return async l=>{const f=await i.getBackendSrv().get("/api/user/orgs");return l((0,o.Bz)(f)),f}}},10943:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>c,Bz:()=>g,bK:()=>r,n:()=>s});var t=e(30038);const n={organization:{},userOrgs:[]},o=(0,t.Z0)({name:"organization",initialState:n,reducers:{organizationLoaded:(i,l)=>({...i,organization:l.payload}),setOrganizationName:(i,l)=>({...i,organization:{...i.organization,name:l.payload}}),userOrganizationsLoaded:(i,l)=>({...i,userOrgs:l.payload})}}),{setOrganizationName:s,organizationLoaded:r,userOrganizationsLoaded:g}=o.actions,c={organization:o.reducer}},17888:(Q,A,e)=>{"use strict";e.d(A,{a:()=>D});var t=e(32196),n=e(96540),o=e(47070),s=e(41987),r=e(13544),g=e(12131),u=e(40845),c=e(79041),i=e(14578);const l=n.forwardRef(({icon:y,children:M,onClick:T,...I},x)=>{const S=(0,u.of)(f);return n.createElement("button",{...I,className:S.action,onClick:T},n.createElement(i.I,{name:y,size:"xl"}),M)});l.displayName="CardButton";const f=y=>({action:(0,t.css)({display:"flex",flexDirection:"column",height:"100%",justifySelf:"center",cursor:"pointer",background:y.colors.background.secondary,borderRadius:y.shape.radius.default,color:y.colors.text.primary,border:"unset",width:"100%",justifyContent:"center",alignItems:"center",textAlign:"center","&:hover":{background:y.colors.emphasize(y.colors.background.secondary)}})});var d=e(15054),h=e(33390),p=e(53466),m=e(32696),a=e(14792),v=e(80348),E=e(79971);function D(y){const M=(0,u.of)(C),T=(0,c.d2)(),I=new o.v2(y.data),{dataSummary:x}=I,S=b(y,x),O=(0,v.useDispatch)(),P=(0,a.UA)().getCurrent()?.getPanelById(y.panelId),L=()=>{h.A.setObject(d.wV,m.__.Suggestions),O((0,p.eK)(!0))},U=()=>{P&&O((0,E.gW)({panel:P,pluginId:"table"}))},R=B=>{P&&(O((0,E.gW)({...B,panel:P})),B.transformations&&setTimeout(()=>{g.Ny.partial({tab:"transform"})},100))};return n.createElement("div",{className:M.wrapper},n.createElement("div",{className:M.message,"data-testid":r.Tp.components.Panels.Panel.PanelDataErrorMessage},S),T.app===s.Jk.PanelEditor&&x.hasData&&P&&n.createElement("div",{className:M.actions},y.suggestions&&n.createElement(n.Fragment,null,y.suggestions.map(B=>n.createElement(l,{key:B.name,icon:"process",onClick:()=>R(B)},B.name))),n.createElement(l,{icon:"table",onClick:U},"Switch to table"),n.createElement(l,{icon:"chart-line",onClick:L},"Open visualization suggestions")))}function b({data:y,fieldConfig:M,message:T,needsNumberField:I,needsTimeField:x,needsStringField:S},O){return T||(!y.series||y.series.length===0||y.series.every(P=>P.length===0)?M?.defaults.noValue??"No data":S&&!O.hasStringField?"Data is missing a string field":I&&!O.hasNumberField?"Data is missing a number field":x&&!O.hasTimeField?"Data is missing a time field":"Cannot visualize data")}const C=y=>({wrapper:(0,t.css)({display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",height:"100%",width:"100%"}),message:(0,t.css)({textAlign:"center",color:y.colors.text.secondary,fontSize:y.typography.size.lg,width:"100%"}),actions:(0,t.css)({marginTop:y.spacing(2),display:"flex",height:"50%",maxHeight:"150px",columnGap:y.spacing(1),rowGap:y.spacing(1),width:"100%",maxWidth:"600px"})})},41394:(Q,A,e)=>{"use strict";e.d(A,{$:()=>c,W:()=>u});var t=e(96540),n=e(65158),o=e(43429),s=e(42418),r=e(80348);class g extends t.PureComponent{constructor(l){super(l)}render(){const l={display:"flex",alignItems:"center",justifyContent:"center",height:"100%"};return t.createElement("div",{style:l},t.createElement(s.F,{severity:r.AppNotificationSeverity.Error,...this.props}))}}function u(i,l){const f=class extends t.PureComponent{render(){const p=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: ${i.id}`,text:p})}},d=new n.m(f);return d.meta=i,d.loadError=!0,d}function c(i,l){const f=class extends t.PureComponent{render(){return t.createElement(g,{title:`Panel plugin not found: ${i}`})}},d=new n.m(l?()=>null:f);return d.meta={id:i,name:i,sort:100,type:o.QE.panel,module:"",baseUrl:"",info:{author:{name:""},description:"",links:[],logos:{large:"",small:"public/img/grafana_icon.svg"},screenshots:[],updated:"",version:""}},d}},20726:(Q,A,e)=>{"use strict";e.d(A,{m:()=>h});var t=e(96540),n=e(1933),o=e(90708),s=e(13834),r=e(581),g=e(72574),u=e(40845),c=e(79041),i=e(66602),l=e(10096),f=e(15162);const d={defaults:{},overrides:[]};function h(m){const{pluginId:a,data:v,timeZone:E=(0,n.O)(),options:D={},width:b,height:C,title:y,onOptionsChange:M=()=>{},onChangeTimeRange:T=()=>{},onFieldConfigChange:I=()=>{},fieldConfig:x=d}=m,S=(0,u.$j)(),O=(0,g.w)(),P=(0,t.useMemo)(()=>O.replace.bind(O),[O]),[L,U]=(0,t.useState)((0,f.PY)(a)),[R,B]=(0,t.useState)(),H=p(L,D,x),{dataLinkPostProcessor:w}=(0,c.d2)(),N=(0,o.rJ)(L,H?.fieldConfig,v,E,S,P,w);if((0,t.useEffect)(()=>{L&&L.hasPluginId(a)||(0,f.TV)(a).then(G=>U(G)).catch(G=>{B(G.message)})},[a,L]),R)return t.createElement("div",null,"Failed to load plugin: ",R);if(!L||!L.hasPluginId(a))return t.createElement("div",null,"Loading plugin panel...");if(!L.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 V=L.panel;return t.createElement(i.Xw,{dependencies:[L,v]},t.createElement(s.a,{meta:L.meta},t.createElement(V,{id:1,data:N,title:y,timeRange:N.timeRange,timeZone:E,options:H.options,fieldConfig:x,transparent:!1,width:b,height:C,renderCounter:0,replaceVariables:G=>G,onOptionsChange:M,onFieldConfigChange:I,onChangeTimeRange:T,eventBus:l.lE})))}function p(m,a,v){return(0,t.useMemo)(()=>{if(m)return(0,r.F)({plugin:m,currentOptions:a,currentFieldConfig:v,isAfterPluginChange:!1})},[m,v,a])}},25701:(Q,A,e)=>{"use strict";e.d(A,{b:()=>m});var t=e(32196),n=e(96540),o=e(70255),s=e(43429),r=e(51527),g=e(13544),u=e(40845),c=e(29158),i=e(98624),l=e(72129),f=e(10803);const d=38,h=({isCurrent:D,title:b,plugin:C,onClick:y,onDelete:M,disabled:T,showBadge:I,description:x,children:S})=>{const O=(0,u.of)(v),P=T||C.state===s.pn.deprecated,L=(0,t.cx)({[O.item]:!0,[O.itemDisabled]:P,[O.current]:D});return n.createElement("div",{className:L,"aria-label":g.Tp.components.PluginVisualization.item(C.name),"data-testid":g.Tp.components.PluginVisualization.item(C.name),onClick:P?void 0:y,title:D?"Click again to close this section":C.name},n.createElement("img",{className:(0,t.cx)(O.img,{[O.disabled]:P}),src:C.info.logos.small,alt:""}),n.createElement("div",{className:(0,t.cx)(O.itemContent,{[O.disabled]:P})},n.createElement("div",{className:O.name},b),x?n.createElement("span",{className:O.description},x):null,S),I&&n.createElement("div",{className:(0,t.cx)(O.badge,{[O.disabled]:P})},n.createElement(E,{plugin:C})),M&&n.createElement(c.K,{name:"trash-alt",onClick:U=>{U.stopPropagation(),M()},className:O.deleteButton,"aria-label":"Delete button on panel type card",tooltip:"Delete"}))};h.displayName="PanelTypeCard";const p=({children:D,hasDescription:b,hasDelete:C,rootProps:y})=>{const M=(0,u.of)(v),T=(0,u.of)(a);return n.createElement("div",{className:M.item,...y},n.createElement(o.A,{className:(0,t.cx)(M.img,T.image),width:d,height:d}),n.createElement("div",{className:M.itemContent},n.createElement("div",{className:M.name},n.createElement(o.A,{width:160})),b?n.createElement(o.A,{containerClassName:M.description,width:80}):null,D),C&&n.createElement(o.A,{containerClassName:(0,t.cx)(M.deleteButton,T.deleteButton),width:16,height:16}))},m=(0,l.j)(h,p),a=()=>({deleteButton:(0,t.css)({lineHeight:1}),image:(0,t.css)({lineHeight:1})}),v=D=>({item:(0,t.css)({position:"relative",display:"flex",flexShrink:0,cursor:"pointer",background:D.colors.background.secondary,borderRadius:D.shape.radius.default,boxShadow:D.shadows.z1,border:`1px solid ${D.colors.background.secondary}`,alignItems:"center",padding:D.spacing(1),width:"100%",overflow:"hidden",transition:D.transitions.create(["background"],{duration:D.transitions.duration.short}),"&:hover":{background:D.colors.emphasize(D.colors.background.secondary,.03)}}),itemContent:(0,t.css)({overflow:"hidden",position:"relative",padding:D.spacing(0,1)}),itemDisabled:(0,t.css)({cursor:"default","&, &:hover":{background:D.colors.action.disabledBackground}}),current:(0,t.css)({label:"currentVisualizationItem",border:`1px solid ${D.colors.primary.border}`,background:D.colors.action.selected}),disabled:(0,t.css)({opacity:.6,filter:"grayscale(1)",cursor:"default",pointerEvents:"none"}),name:(0,t.css)({textOverflow:"ellipsis",overflow:"hidden",fontSize:D.typography.size.sm,fontWeight:D.typography.fontWeightMedium,width:"100%"}),description:(0,t.css)({display:"block",textOverflow:"ellipsis",overflow:"hidden",color:D.colors.text.secondary,fontSize:D.typography.bodySmall.fontSize,fontWeight:D.typography.fontWeightLight,width:"100%",maxHeight:"4.5em"}),img:(0,t.css)({maxHeight:d,width:d,display:"flex",alignItems:"center"}),badge:(0,t.css)({background:D.colors.background.primary}),deleteButton:(0,t.css)({cursor:"pointer",marginLeft:"auto"})}),E=({plugin:D})=>(0,r.x)(D.signature)?n.createElement(i.B,{status:D.signature}):n.createElement(f.p,{state:D.state});E.displayName="PanelPluginBadge"},56707:(Q,A,e)=>{"use strict";e.d(A,{a:()=>E});var t=e(32196),n=e(96540),o=e(16817),s=e(70713),r=e(40845),g=e(47070),u=e(32264),c=e(15162);const i=["timeseries","barchart","gauge","stat","piechart","bargauge","table","state-timeline","status-history","logs","candlestick","flamegraph"];async function l(C,y){const M=new g.v2(C,y);for(const I of i){const S=(await(0,c.TV)(I)).getSuggestionsSupplier();S&&S.getSuggestionsForData(M)}const T=M.getList();if(!u.$.featureToggles.vizAndWidgetSplit&&M.dataSummary.fieldCount===0)for(const I of Object.values(u.$.panels))!I.skipDataQuery||I.hideFromList||T.push({name:I.name,pluginId:I.id,description:I.info.description,cardOptions:{imgSrc:I.info.logos.small}});return T.sort((I,x)=>{if(M.dataSummary.preferredVisualisationType){if(I.pluginId===M.dataSummary.preferredVisualisationType)return-1;if(x.pluginId===M.dataSummary.preferredVisualisationType)return 1}return(x.score??g.nQ.OK)-(I.score??g.nQ.OK)})}var f=e(2543),d=e(13544),h=e(56034),p=e(20726);function m({data:C,suggestion:y,onChange:M,width:T}){const I=(0,r.of)(a),{innerStyles:x,outerStyles:S,renderWidth:O,renderHeight:P}=v(T),L=y.cardOptions??{},U={"aria-label":y.name,className:I.vizBox,"data-testid":d.Tp.components.VisualizationPreview.card(y.name),style:S,onClick:()=>{M({pluginId:y.pluginId,options:y.options,fieldConfig:y.fieldConfig})}};if(L.imgSrc)return n.createElement(h.m,{content:y.description??y.name},n.createElement("button",{...U,className:(0,t.cx)(I.vizBox,I.imgBox)},n.createElement("div",{className:I.name},y.name),n.createElement("img",{className:I.img,src:L.imgSrc,alt:y.name})));let R=y;return y.cardOptions?.previewModifier&&(R=(0,f.cloneDeep)(y),y.cardOptions.previewModifier(R)),n.createElement("button",{...U},n.createElement(h.m,{content:y.name},n.createElement("div",{style:x,className:I.renderContainer},n.createElement(p.m,{title:"",data:C,pluginId:y.pluginId,width:O,height:P,options:R.options,fieldConfig:R.fieldConfig}),n.createElement("div",{className:I.hoverPane}))))}const a=C=>({hoverPane:(0,t.css)({position:"absolute",top:0,right:0,left:0,borderRadius:C.spacing(2),bottom:0}),vizBox:(0,t.css)` position: relative; background: none; border-radius: ${C.shape.radius.default}; cursor: pointer; border: 1px solid ${C.colors.border.medium}; transition: ${C.transitions.create(["background"],{duration:C.transitions.duration.short})}; &:hover { background: ${C.colors.background.secondary}; } `,imgBox:(0,t.css)` display: flex; flex-direction: column; height: 100%; justify-self: center; color: ${C.colors.text.primary}; width: 100%; display: flex; justify-content: center; align-items: center; text-align: center; `,name:(0,t.css)` padding-bottom: ${C.spacing(.5)}; margin-top: ${C.spacing(-1)}; font-size: ${C.typography.bodySmall.fontSize}; white-space: nowrap; overflow: hidden; color: ${C.colors.text.secondary}; font-weight: ${C.typography.fontWeightMedium}; text-overflow: ellipsis; `,img:(0,t.css)` max-width: ${C.spacing(8)}; max-height: ${C.spacing(8)}; `,renderContainer:(0,t.css)` position: absolute; transform-origin: left top; top: 6px; left: 6px; `});function v(C){const M=C,T=C*(1/1.6),I=350,x=I*(1/1.6),S=6,O=(M-S*2)/I,P=(T-S*2)/x;return{renderHeight:x,renderWidth:I,outerStyles:{width:M,height:T},innerStyles:{width:I,height:x,transform:`scale(${O}, ${P})`}}}function E({searchQuery:C,onChange:y,data:M,panel:T}){const I=(0,r.of)(b),{value:x}=(0,o.A)(()=>l(M,T),[M,T]),S=D(C,x);return n.createElement("div",null,n.createElement(s.Ay,{disableHeight:!0,style:{width:"100%",height:"100%"}},({width:O})=>{if(!O)return null;O=O-1;const P=Math.floor(O/200),L=8*(P-1),U=Math.floor((O-L)/P);return n.createElement("div",null,n.createElement("div",{className:I.filterRow},n.createElement("div",{className:I.infoText},"Based on current data")),n.createElement("div",{className:I.grid,style:{gridTemplateColumns:`repeat(auto-fill, ${U}px)`}},S.map((R,B)=>n.createElement(m,{key:B,data:M,suggestion:R,onChange:y,width:U-1})),C&&S.length===0&&n.createElement("div",{className:I.infoText},"No results matched your query")))}))}function D(C,y){if(!C||!y)return y||[];const M=new RegExp(C,"i");return y.filter(T=>M.test(T.name)||M.test(T.pluginId))}const b=C=>({heading:(0,t.css)({...C.typography.h5,margin:C.spacing(0,.5,1)}),filterRow:(0,t.css)({display:"flex",flexDirection:"row",justifyContent:"space-around",alignItems:"center",paddingBottom:"8px"}),infoText:(0,t.css)({fontSize:C.typography.bodySmall.fontSize,color:C.colors.text.secondary,fontStyle:"italic"}),grid:(0,t.css)({display:"grid",gridGap:C.spacing(1),gridTemplateColumns:"repeat(auto-fill, 144px)",marginBottom:C.spacing(1),justifyContent:"space-evenly"})})},86292:(Q,A,e)=>{"use strict";e.d(A,{G:()=>c});var t=e(32196),n=e(96540),o=e(32264),s=e(40845),r=e(41670),g=e(17706),u=e(48889);function c({pluginId:l,searchQuery:f,onChange:d,isWidget:h=!1}){const p=(0,s.of)(i),m=(0,n.useMemo)(()=>o.$.featureToggles.vizAndWidgetSplit?h?(0,g.nr)():(0,g.if)():(0,g.A4)(),[h]),a=(0,n.useMemo)(()=>(0,g.CO)(m,f,l),[m,f,l]);return a.length===0?n.createElement(r.Z,null,"Could not find anything matching your query"):n.createElement("div",{className:p.grid},a.map(v=>n.createElement(u.f,{disabled:!1,key:v.id,isCurrent:v.id===l,plugin:v,onClick:E=>d({pluginId:v.id,withModKey:E.metaKey||E.ctrlKey||E.altKey})})))}const i=l=>({grid:(0,t.css)({maxWidth:"100%",display:"grid",gridGap:l.spacing(.5)}),heading:(0,t.css)({...l.typography.h5,margin:l.spacing(0,.5,1)})})},48889:(Q,A,e)=>{"use strict";e.d(A,{f:()=>o});var t=e(96540),n=e(25701);const o=({isCurrent:s,plugin:r,onClick:g,disabled:u})=>t.createElement(n.b,{title:r.name,plugin:r,description:r.info.description,onClick:g,isCurrent:s,disabled:u,showBadge:!0});o.displayName="VizTypePickerPlugin"},32349:(Q,A,e)=>{"use strict";e.d(A,{CH:()=>c,E7:()=>u,EO:()=>g});var t=e(14236),n=e(83195),o=e(92461),s=e(32023),r=e(6923);const g=i=>{const l=i.field.links;if(!(!l||l.length===0))return{getLinks:f=>{const d={};if(i.view){const{dataFrame:p}=i.view;d.__series={value:{name:p.name,refId:p.refId},text:"Series"};const m=i.colIndex!==void 0?p.fields[i.colIndex]:void 0;if(m){if(d.__field={value:{name:m.name,labels:m.labels},text:"Field"},i.rowIndex!==void 0&&i.rowIndex>=0){const{timeField:a}=(0,t.KR)(p);d.__value={value:{raw:m.values[i.rowIndex],numeric:i.display.numeric,text:(0,n.cN)(i.display),time:a?a.values[i.rowIndex]:void 0},text:"Value"}}i.view&&(d.__data={value:{name:p.name,refId:p.refId,fields:(0,o.F)({frame:p,rowIndex:i.rowIndex})},text:"Data"})}else d.__value={value:{raw:i.display.numeric,numeric:i.display.numeric,text:(0,n.cN)(i.display),calc:i.name},text:"Value"}}else console.log("VALUE",i);const h=(p,m,a)=>{const v={...d,...m};return f(p,v,a)};return l.map(p=>(0,r.mQ)().getDataLinkUIModel(p,h,i))}}},u=(i,l)=>{const f=i.links;if(!(!f||f.length===0))return{getLinks:()=>f.map(d=>(0,r.mQ)().getDataLinkUIModel(d,l||i.replaceVariables,i))}},c=(i,l)=>{const f=s.b.getPanelLinks(i).state.rawLinks;if(!(!f||f.length===0))return{getLinks:()=>f.map(d=>(0,r.mQ)().getDataLinkUIModel(d,l,i))}}},6923:(Q,A,e)=>{"use strict";e.d(A,{Fq:()=>E,Hf:()=>C,mQ:()=>x});var t=e(2543),n=e.n(t),o=e(6709),s=e(91890),r=e(28240),g=e(11261),u=e(71733),c=e(40672),i=e(76885),l=e(95344),f=e(72574),d=e(52622),h=e(2913);const p=[{value:`${o.c.keepTime}`,label:"Time range",documentation:"Adds current time range",origin:s.$0.BuiltIn},{value:`${o.c.timeRangeFrom}`,label:"Time range: from",documentation:"Adds current time range's from value",origin:s.$0.BuiltIn},{value:`${o.c.timeRangeTo}`,label:"Time range: to",documentation:"Adds current time range's to value",origin:s.$0.BuiltIn}],m=[{value:`${o.c.seriesName}`,label:"Name",documentation:"Name of the series",origin:s.$0.Series}],a=[{value:`${o.c.valueNumeric}`,label:"Numeric",documentation:"Numeric representation of selected value",origin:s.$0.Value},{value:`${o.c.valueText}`,label:"Text",documentation:"Text representation of selected value",origin:s.$0.Value},{value:`${o.c.valueRaw}`,label:"Raw",documentation:"Raw value",origin:s.$0.Value}],v=S=>S.includes(".")||S.trim().includes(" ")?`["${S}"]`:`.${S}`,E=()=>[...(0,f.w)().getVariables().map(S=>({value:S.name,label:S.name,origin:s.$0.Template})),{value:`${o.c.includeVars}`,label:"All variables",documentation:"Adds current variables",origin:s.$0.Template},...p],D=S=>{const O=[];for(const L of S)for(const U of L.fields)if(U.labels)for(const R of Object.keys(U.labels))O.push(R);const P=(0,t.chain)(O).flatten().uniq().value();return[{value:`${o.c.fieldName}`,label:"Name",documentation:"Field name of the clicked datapoint (in ms epoch)",origin:s.$0.Field},...P.map(L=>({value:`__field.labels${v(L)}`,label:`labels.${L}`,documentation:`${L} label value`,origin:s.$0.Field}))]},b=S=>{let O,P;const L=[],U={};if(S.length!==1)return[];const R=S[0];for(const B of R.fields){const H=(0,r.Ct)(B,R,S);U[H]||(L.push({value:`__data.fields${v(H)}`,label:`${H}`,documentation:`Formatted value for ${H} on the same row`,origin:s.$0.Fields}),U[H]=!0,!O&&B.type===g.PU.number&&(O={...B,name:H}),!P&&B.config.displayName&&B.config.displayName!==B.name&&(P={...B,name:H}))}return L.length&&L.push({value:"__data.fields[0]",label:"Select by index",documentation:"Enter the field order",origin:s.$0.Fields}),O&&(L.push({value:`__data.fields${v(O.name)}.numeric`,label:"Show numeric value",documentation:"the numeric field value",origin:s.$0.Fields}),L.push({value:`__data.fields${v(O.name)}.text`,label:"Show text value",documentation:"the text value",origin:s.$0.Fields})),P&&L.push({value:`__data.fields${v(P.name)}`,label:"Select by title",documentation:"Use the title to pick the field",origin:s.$0.Fields}),L},C=(S,O)=>{const P={value:`${o.c.valueTime}`,label:"Time",documentation:"Time value of the clicked datapoint (in ms epoch)",origin:s.$0.Value};return O===s.uP.Values?[...m,...D(S),...a,P,...b(S),...E()]:[...m,...D(S),...b(S),...E()]},y=S=>{const O=D(S),P={value:`${DataLinkBuiltInVars.valueCalc}`,label:"Calculation name",documentation:"Name of the calculation the value is a result of",origin:VariableOrigin.Value};return[...m,...O,...a,P,...E()]};class M{constructor(){this.getDataLinkUIModel=(O,P,L)=>{let U=O.url;O.onBuildUrl&&(U=O.onBuildUrl({origin:L,replaceVariables:P}));const R={href:u.I.assureBaseUrl(U.replace(/\n/g,"")),title:O.title??"",target:O.targetBlank?"_blank":void 0,origin:L};return P&&(R.href=P(R.href,void 0,d.$m.UriEncode),R.title=P(O.title)),O.onClick&&(R.onClick=B=>{O.onClick({origin:L,replaceVariables:P,e:B})}),R.href=(0,h.zj)().disableSanitizeHtml?R.href:c.sQ.sanitizeUrl(R.href),R}}getLinkUrl(O){let P={};O.keepTime&&(P[`$${o.c.keepTime}`]=!0),O.includeVars&&(P[`$${o.c.includeVars}`]=!0);let L=u.I.assureBaseUrl(i.kM.appendQueryToUrl(O.url||"",i.kM.toUrlParams(P)));return L=(0,f.w)().replace(L),(0,h.zj)().disableSanitizeHtml?L:c.sQ.sanitizeUrl(L)}getAnchorInfo(O){const P=(0,f.w)();return{href:this.getLinkUrl(O),title:P.replace(O.title||""),tooltip:P.replace(O.tooltip||"")}}getPanelLinkAnchorInfo(O,P){(0,l.l)("link_srv.ts","getPanelLinkAnchorInfo","getDataLinkUIModel");const L=(U,R,B)=>(0,f.w)().replace(U,{...P,...R},B);return this.getDataLinkUIModel(O,L,{})}}let T;function I(S){T=S}function x(){return T||(T=new M),T}},79971:(Q,A,e)=>{"use strict";e.d(A,{Ap:()=>u,O6:()=>c,Xk:()=>l,gW:()=>i});var t=e(581),n=e(57767),o=e(41394),s=e(20701),r=e(28444),g=e(80095);function u(d){return async(h,p)=>{if(d.libraryPanel?.uid&&!("model"in d.libraryPanel)){h(f(d));return}let m=d.type,a=p().plugins.panels[m];if(!a)try{a=await h((0,s.y7)(m))}catch{a=(0,o.$)(m,m==="row")}d.plugin||await d.pluginLoaded(a),h((0,g.XM)({key:d.key,plugin:a}))}}function c(d){return h=>{h((0,g.FC)({key:d}))}}function i({panel:d,pluginId:h,options:p,fieldConfig:m,transformations:a}){return async(v,E)=>{if(d.type===h&&!p&&!m&&!a)return;let b=E().plugins.panels[h];if(b||(b=await v((0,s.y7)(h))),d.type!==h&&d.changePlugin(b),p||m||a){const C=(0,t.F)({plugin:b,currentOptions:p||d.options,currentFieldConfig:m||d.fieldConfig,isAfterPluginChange:!1});d.options=C.options,d.fieldConfig=C.fieldConfig,d.transformations=a||d.transformations,d.configRev++}d.generateNewKey(),v((0,g.XM)({key:d.key,plugin:b}))}}function l(d,h){return async(p,m)=>{const a=h.model.type,v=d.type;if(d.restoreModel({...h.model,gridPos:d.gridPos,id:d.id,libraryPanel:h}),d.getQueryRunner().clearLastResult(),v!==a){let D=m().plugins.panels[a];D||(D=await p((0,s.y7)(a))),await d.pluginLoaded(D),d.generateNewKey(),await p((0,g.XM)({key:d.key,plugin:D}))}else{const E=d.key;d.generateNewKey(),p((0,g.io)({oldKey:E,newKey:d.key}))}d.configRev=0,d.hasSavedPanelEditChange=!0,d.refresh(),d.events.publish(r.zq),d.events.publish(r.PR)}}function f(d){return async(h,p)=>{const m=d.libraryPanel.uid;try{const a=await(0,n.Yr)(m,!0);d.initLibraryPanel(a);const v=p().dashboard.getModel();if(d.repeat&&v){const E=v.panels.findIndex(D=>D.id===d.id);v.repeatPanel(d,E),v.sortPanelsByGridPos(),v.events.publish(new r.Q$)}await h(u(d))}catch(a){console.log("ERROR: ",a),h((0,g.XM)({key:d.key,plugin:(0,o.$)("Unable to load library panel: "+m,!1)}))}}}},80095:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>f,FC:()=>c,S3:()=>r,XM:()=>s,io:()=>u,nF:()=>g,rG:()=>i});var t=e(30038);const n={},o=(0,t.Z0)({name:"panels",initialState:n,reducers:{panelModelAndPluginReady:(d,h)=>{d[h.payload.key]={plugin:h.payload.plugin}},changePanelKey:(d,h)=>{d[h.payload.newKey]=d[h.payload.oldKey],delete d[h.payload.oldKey]},removePanel:(d,h)=>{delete d[h.payload.key]},removeAllPanels:d=>{Object.keys(d).forEach(h=>delete d[h])},setPanelInstanceState:(d,h)=>{d[h.payload.key].instanceState=h.payload.value},setPanelAngularComponent:(d,h)=>{const p=d[h.payload.key];p.angularComponent=h.payload.angularComponent}}}),{panelModelAndPluginReady:s,setPanelAngularComponent:r,setPanelInstanceState:g,changePanelKey:u,removePanel:c,removeAllPanels:i}=o.actions,f={panels:o.reducer}},40334:(Q,A,e)=>{"use strict";e.d(A,{U:()=>t});function t(n,o){return n.panels[o.key]}},17706:(Q,A,e)=>{"use strict";e.d(A,{A4:()=>s,CO:()=>u,if:()=>g,nr:()=>r});var t=e(43429),n=e(54479),o=e(2913);function s(){const c=o.$W.panels;return Object.keys(c).filter(i=>c[i].hideFromList===!1).map(i=>c[i]).sort((i,l)=>i.sort-l.sort)}function r(){return s().filter(c=>!!c.skipDataQuery)}function g(){return s().filter(c=>!c.skipDataQuery)}function u(c,i,l){if(!i.length)return c.filter(m=>m.state===t.pn.deprecated?l===m.id:!0);const f=(0,n.xb)(i).toLowerCase(),d=[],h=[],p="graph".startsWith(f);for(const m of c){if(m.state===t.pn.deprecated&&l!==m.id)continue;const v=m.name.toLowerCase().indexOf(f);v===0?d.push(m):v>0?h.push(m):p&&m.id==="timeseries"&&d.push(m)}return d.concat(h)}},2609:(Q,A,e)=>{"use strict";e.d(A,{_o:()=>l});var t=e(2543),n=e.n(t),o=e(71733),s=e(76885),r=e(65879),g=e(12131),u=e(86022);const c={kiosk:!0,autofitpanels:!0,orgId:!0};class i{constructor(){this.urls=[],this.index=0,this.numberOfLoops=0,this.isPlaying=!1,this.locationUpdated=this.locationUpdated.bind(this),this.api=(0,u.NF)()}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 h=this.urls[this.index],p=g.Ny.getSearchObject(),m=(0,t.pickBy)(p,(v,E)=>c[E]),a=o.I.stripBaseFromUrl(h);this.index++,this.validPlaylistUrl=a,this.nextTimeoutId=setTimeout(()=>this.next(),this.interval),g.Ny.push(a+"?"+s.kM.toUrlParams(m))}prev(){this.index=Math.max(this.index-2,0),this.next()}locationUpdated(d){d.pathname!==this.validPlaylistUrl&&this.stop()}async start(d){this.stop(),this.startUrl=window.location.href,this.index=0,this.isPlaying=!0,this.locationListenerUnsub=g.Ny.getHistory().listen(this.locationUpdated);const h=[];let p=await this.api.getPlaylist(d);if(!p.items?.length)return;this.interval=r.intervalToMs(p.interval);const m=await(0,u.qY)(p.items);for(const a of m)if(a.dashboards)for(const v of a.dashboards)h.push(v.url);h.length&&(this.urls=h,this.isPlaying=!0,this.next())}stop(){this.isPlaying&&(this.index=0,this.isPlaying=!1,this.locationListenerUnsub&&this.locationListenerUnsub(),this.nextTimeoutId&&clearTimeout(this.nextTimeoutId),g.Ny.getSearchObject().kiosk&&g.Ny.partial({kiosk:null}))}}const l=new i},86022:(Q,A,e)=>{"use strict";e.d(A,{GM:()=>E,NF:()=>D,aV:()=>v,qY:()=>a});var t=e(75505),n=e(78368),o=e(17172),s=e(32264),r=e(82467),g=e(3169),u=e(90183),c=e(68706),i=e(99140),l=e(24439);class f{async getAllPlaylist(){return(0,o.AI)().get("/api/playlists/")}async getPlaylist(C){const y=await(0,o.AI)().get(`/api/playlists/${C}`);return await p(y),y}async createPlaylist(C){await m(()=>(0,o.AI)().post("/api/playlists",C))}async updatePlaylist(C){await m(()=>(0,o.AI)().put(`/api/playlists/${C.uid}`,C))}async deletePlaylist(C){await m(()=>(0,o.AI)().delete(`/api/playlists/${C}`),"Playlist deleted")}}class d{constructor(){this.apiVersion="playlist.grafana.app/v0alpha1",this.playlistAsK8sResource=C=>({apiVersion:this.apiVersion,kind:"Playlist",metadata:{name:C.uid},spec:{title:C.name,interval:C.interval,items:C.items??[]}}),this.url=`/apis/${this.apiVersion}/namespaces/${s.$.namespace}/playlists`}async getAllPlaylist(){return(await(0,o.AI)().get(this.url)).items.map(h)}async getPlaylist(C){const y=await(0,o.AI)().get(this.url+"/"+C),M=h(y);return await p(M),M}async createPlaylist(C){const y=this.playlistAsK8sResource(C);await m(()=>(0,o.AI)().post(this.url,y))}async updatePlaylist(C){const y=this.playlistAsK8sResource(C);await m(()=>(0,o.AI)().put(`${this.url}/${C.uid}`,y))}async deletePlaylist(C){await m(()=>(0,o.AI)().delete(`${this.url}/${C}`),"Playlist deleted")}}function h(b){const{spec:C,metadata:y}=b;return{uid:y.name,name:C.title,interval:C.interval,items:C.items}}async function p(b){if(b?.items){for(const C of b.items)if(C.type==="dashboard_by_id"){C.type="dashboard_by_uid";const y=await(0,o.AI)().get(`/api/dashboards/ids/${C.value}`);y?.length&&(C.value=y[0])}}}async function m(b,C="Playlist saved"){try{await b(),(0,i.JD)((0,r.dx)((0,g.tZ)(C)))}catch(y){y instanceof Error&&(0,i.JD)((0,r.dx)((0,g.gi)("Unable to save playlist",y)))}}async function a(b){let C=0;if(!b?.length)return[];const y=[];for(const I of b){const x={query:"*",kind:["dashboard"],limit:1e3};switch(I.type){case"dashboard_by_id":throw new Error("invalid item (with id)");case"dashboard_by_uid":x.uid=[I.value];break;case"dashboard_by_tag":x.tags=[I.value];break}y.push({refId:`${C++}`,queryType:c.nj.Search,search:x})}if(!s.$.featureToggles.panelTitleSearch){const I=(0,l.getGrafanaSearcher)(),x=[];for(let S=0;S<y.length;S++){const O=(await I.search(y[S].search)).view;x.push({...b[S],dashboards:O.map(P=>({...P}))})}return x}const M=await(0,u.o)(),T=await(0,t.s)(M.query({targets:y}));if(T.data.length!==b.length)throw new Error("unexpected result size");return b.map((I,x)=>{const S=new n.R(T.data[x]);return{...I,dashboards:S.map(O=>({...O}))}})}function v(){return{items:[],interval:"5m",name:"",uid:""}}function E(b,C){return C?.length?(C=C.toLowerCase(),b.filter(y=>y.name.toLowerCase().includes(C))):b}function D(){return s.$.featureToggles.kubernetesPlaylists?new d:new f}},84684:(Q,A,e)=>{"use strict";e.d(A,{Ap:()=>h,Bj:()=>c,CB:()=>g,Gd:()=>d,T_:()=>u,cu:()=>m,ij:()=>a,xZ:()=>p});var t=e(36663),n=e(17172),o=e(80714),s=e(6745),r=e(5129);async function g(E){const D=await i(E),b=!!D,[C,y,M]=await Promise.all([d(),l(E,b),f(E)]),T=C.find(x=>x.id===E),I=T?.dependencies||D?.json?.dependencies;return{grafanaDependency:I?.grafanaDependency??I?.grafanaVersion??"",pluginDependencies:I?.plugins||[],links:T?.info.links||D?.json?.info.links||[],readme:M||D?.readme,versions:y,statusContext:D?.statusContext??"",iam:D?.json?.iam}}async function u(){try{const{items:E}=await(0,n.AI)().get(`${s.P5}/plugins`,{includeDeprecated:!0});return E.filter(r.hY)}catch(E){if((0,n.NF)(E))return E.isHandled=!0,console.error("Failed to fetch plugins from catalog (default https://grafana.com/api/plugins)"),[];throw E}}async function c(){try{return await(0,n.AI)().get(`${s.Sw}/errors`)}catch{return[]}}async function i(E){try{return await(0,n.AI)().get(`${s.P5}/plugins/${E}`,{})}catch(D){(0,n.NF)(D)&&(D.isHandled=!0);return}}async function l(E,D){try{return D?((await(0,n.AI)().get(`${s.P5}/plugins/${E}/versions`)).items||[]).map(C=>({version:C.version,createdAt:C.createdAt,isCompatible:C.isCompatible,grafanaDependency:C.grafanaDependency})):[]}catch(b){return(0,n.NF)(b)&&(b.isHandled=!0),[]}}async function f(E){try{const D=await(0,n.AI)().get(`${s.Sw}/${E}/markdown/README`);return D?(0,t.G)(D):""}catch(D){return(0,n.NF)(D)&&(D.isHandled=!0),""}}async function d(){return(await(0,n.AI)().get(`${s.Sw}`,(0,o.F)({embedded:0}))).filter(r.Sq)}async function h(){const{items:E}=await(0,n.AI)().get(`${s.Mi}/plugins`);return E}async function p(E){return await(0,n.AI)().post(`${s.Sw}/${E}/install`,void 0,{showErrorAlert:!1})}async function m(E){return await(0,n.AI)().post(`${s.Sw}/${E}/uninstall`)}async function a(E,D){return(await(0,n.AI)().datasourceRequest({url:`/api/plugins/${E}/settings`,method:"POST",data:D}))?.data}const v={getRemotePlugins:u,getInstalledPlugins:d,installPlugin:p,uninstallPlugin:m}},42930:(Q,A,e)=>{"use strict";e.d(A,{G:()=>s});var t=e(32196),n=e(96540),o=e(40845);const s=({children:g,wrap:u,className:c})=>{const i=(0,o.$j)(),l=r(i,u);return n.createElement("div",{className:(0,t.cx)(l.container,c)},g)},r=(g,u)=>({container:(0,t.css)` display: flex; flex-direction: row; flex-wrap: ${u?"wrap":"no-wrap"}; & > * { margin-bottom: ${g.spacing()}; margin-right: ${g.spacing()}; } & > *:last-child { margin-right: 0; } `})},6745:(Q,A,e)=>{"use strict";e.d(A,{Mi:()=>n,P5:()=>o,Sw:()=>t,fu:()=>s});const t="/api/plugins",n="/api/instance",o="/api/gnet",s="plugins"},5129:(Q,A,e)=>{"use strict";e.d(A,{Gl:()=>y,H2:()=>a,N6:()=>T,Sq:()=>I,TD:()=>R,Xc:()=>E,by:()=>v,hY:()=>x,j_:()=>M,kH:()=>p,td:()=>f,tr:()=>C});var t=e(53076),n=e(43429),o=e(53531),s=e(32264),r=e(33378),g=e(2913),u=e(10096),c=e(27677),i=e(80348),l=e(66253);function f({local:B=[],remote:H=[],instance:w=[],pluginErrors:N}){const V=[],G=D(N),_=w.reduce((K,j)=>(K.add(j.pluginSlug),K),new Set);return B.forEach(K=>{const j=H.find(Y=>Y.slug===K.id),k=G[K.id];j||V.push(d(K,void 0,k))}),H.forEach(K=>{const j=B.find(ee=>ee.id===K.slug),k=G[K.slug];if(!(K.status===l.Uy.Deprecated&&!j)){const ee=d(j,K,k);g.Ay.featureToggles.managedPluginsInstall&&s.$.pluginAdminExternalManageEnabled&&(ee.isFullyInstalled=ee.isCore?!0:_.has(K.slug)&&ee.isInstalled,ee.isInstalled=_.has(K.slug)||ee.isInstalled),V.push(ee)}}),V}function d(B,H,w){return!B&&H?h(H,w):B&&!H?p(B,w):m(B,H,w)}function h(B,H){const{name:w,slug:N,description:V,version:G,orgName:_,popularity:K,downloads:j,typeCode:k,updatedAt:Y,createdAt:ee,status:re,angularDetected:J,keywords:ne}=B,q=!!H||O(k);return{description:V,downloads:j,id:N,info:{logos:{small:`https://grafana.com/api/plugins/${N}/versions/${G}/logos/small`,large:`https://grafana.com/api/plugins/${N}/versions/${G}/logos/large`},keywords:ne},name:w,orgName:_,popularity:K,publishedAt:ee,signature:b({remote:B,error:H}),updatedAt:Y,hasUpdate:!1,isPublished:!0,isInstalled:q,isDisabled:q,isDeprecated:re===l.Uy.Deprecated,isCore:B.internal,isDev:!1,isEnterprise:re===l.Uy.Enterprise,type:k,error:H?.errorCode,angularDetected:J,isFullyInstalled:q}}function p(B,H){const{name:w,info:{description:N,version:V,logos:G,updated:_,author:K,keywords:j},id:k,dev:Y,type:ee,signature:re,signatureOrg:J,signatureType:ne,hasUpdate:q,accessControl:te,angularDetected:oe}=B,ue=!!H||O(ee);return{description:N,downloads:0,id:k,info:{logos:G,keywords:j},name:w,orgName:K.name,popularity:0,publishedAt:"",signature:b({local:B,error:H}),signatureOrg:J,signatureType:ne,updatedAt:_,installedVersion:V,hasUpdate:q,isInstalled:!0,isDisabled:ue,isCore:re==="internal",isPublished:!1,isDeprecated:!1,isDev:!!Y,isEnterprise:!1,type:ee,error:H?.errorCode,accessControl:te,angularDetected:oe,isFullyInstalled:!0,iam:B.iam}}function m(B,H,w){const N=B?.info.version,V=H?.slug||B?.id||"",G=B?.type||H?.typeCode,_=!!w||O(G),K=H?.keywords||B?.info.keywords||[];let j={small:`/public/img/icn-${G}.svg`,large:`/public/img/icn-${G}.svg`};return H?j={small:`https://grafana.com/api/plugins/${V}/versions/${H.version}/logos/small`,large:`https://grafana.com/api/plugins/${V}/versions/${H.version}/logos/large`}:B&&B.info.logos&&(j=B.info.logos),{description:B?.info.description||H?.description||"",downloads:H?.downloads||0,hasUpdate:B?.hasUpdate||!1,id:V,info:{logos:j,keywords:K},isCore:!!(H?.internal||B?.signature===n.Ac.internal),isDev:!!B?.dev,isEnterprise:H?.status===l.Uy.Enterprise,isInstalled:!!B||_,isDisabled:_,isDeprecated:H?.status===l.Uy.Deprecated,isPublished:!0,name:H?.name||B?.name||"",orgName:H?.orgName||B?.info.author.name||"",popularity:H?.popularity||0,publishedAt:H?.createdAt||"",type:G,signature:b({local:B,remote:H,error:w}),signatureOrg:B?.signatureOrg||H?.versionSignedByOrgName,signatureType:B?.signatureType||H?.versionSignatureType||H?.signatureType||void 0,updatedAt:H?.updatedAt||B?.info.updated||"",installedVersion:N,error:w?.errorCode,accessControl:B?.accessControl,angularDetected:B?.angularDetected??H?.angularDetected,isFullyInstalled:!!B||_,iam:B?.iam}}const a=B=>`${s.$.pluginCatalogURL}${B}`;var v=(B=>(B.nameAsc="nameAsc",B.nameDesc="nameDesc",B.updated="updated",B.published="published",B.downloads="downloads",B))(v||{});const E=(B,H)=>{const w={nameAsc:(N,V)=>N.name.localeCompare(V.name),nameDesc:(N,V)=>V.name.localeCompare(N.name),updated:(N,V)=>(0,o.b)(V.updatedAt).valueOf()-(0,o.b)(N.updatedAt).valueOf(),published:(N,V)=>(0,o.b)(V.publishedAt).valueOf()-(0,o.b)(N.publishedAt).valueOf(),downloads:(N,V)=>V.downloads-N.downloads};return w[H]?B.sort(w[H]):B};function D(B=[]){return B.reduce((H,w)=>(H[w.pluginId]=w,H),{})}function b(B){const{error:H,local:w,remote:N}=B;if(H)switch(H.errorCode){case n.ZK.invalidSignature:return n.Ac.invalid;case n.ZK.missingSignature:return n.Ac.missing;case n.ZK.modifiedSignature:return n.Ac.modified}return w?.signature?w.signature:N?.signatureType&&N?.versionSignatureType?n.Ac.valid:n.Ac.missing}const C=()=>(0,c.AI)().get("/api/frontend/settings").then(B=>{s.$.panels=B.panels});function y(B){if(!B)return;const[H]=B.filter(w=>!!w.isCompatible);return H}const M=()=>s.$.pluginAdminEnabled,T=(B,H,w)=>{const N=s.$.pluginAdminExternalManageEnabled,V=u.TP.hasPermission(i.AccessControlAction.PluginsInstall),G=!!w;return B.type===n.QE.renderer||B.type===n.QE.secretsmanager||B.isEnterprise&&!(0,r.a)("enterprise.plugins")||B.isDev||!V&&!N||!B.isPublished||!G||!H},I=B=>S(B.id),x=B=>S(B.slug);function S(B){const{pluginCatalogHiddenPlugins:H}=s.$;return!H.includes(B)}function O(B){return B===n.QE.secretsmanager&&!s.$.secretsManagerPluginEnabled}function P(B){return B?.signature==="internal"}function L(B){return B.split(" - ")[0]}function U(B){return B.reduce((H,{id:w,name:N,type:V,orgName:G,info:_})=>{const K=_.keywords?.join(" ").toLowerCase(),j=`${w} - ${N} - ${V} - ${G} - ${K}`;return H.push(j),H},[])}function R(B,H){const w=U(B);let V=new t.A({}).filter(w,H);return V===null?null:V.map(G=>L(w[G]))}},20701:(Q,A,e)=>{"use strict";e.d(A,{JC:()=>x,JJ:()=>E,LR:()=>v,NJ:()=>O,aU:()=>b,ai:()=>T,h9:()=>S,mj:()=>a,nT:()=>I,t5:()=>D,y7:()=>P});var t=e(30038),n=e(65474),o=e(62467),s=e(66847),r=e(45650),g=e(90593),u=e(75505),c=e(32264),i=e(17172),l=e(2913),f=e(15162),d=e(81900),h=e(84684),p=e(6745),m=e(5129);const a=(0,t.zD)(`${p.fu}/fetchAll`,async(L,U)=>{try{U.dispatch({type:`${p.fu}/fetchLocal/pending`}),U.dispatch({type:`${p.fu}/fetchRemote/pending`});const R=c.$.pluginAdminExternalManageEnabled&&l.Ay.featureToggles.managedPluginsInstall?(0,n.H)((0,h.Ap)()):(0,o.of)(void 0),B=500,H=(0,n.H)((0,h.Bj)()),w=(0,n.H)((0,h.Gd)()),N=(0,n.H)((0,h.T_)()).pipe((0,s.W)(V=>(U.dispatch({type:`${p.fu}/fetchRemote/rejected`}),console.error(V),(0,o.of)([]))));return(0,r.p)({local:w,remote:N,instance:R,pluginErrors:H}).pipe((0,g.w)({each:B,with:()=>(N.subscribe(async V=>{if(U.dispatch({type:`${p.fu}/fetchRemote/fulfilled`}),V.length>0){const G=await(0,u.s)(w),_=await(0,u.s)(R),K=await(0,u.s)(H);U.dispatch(b((0,m.td)({local:G,remote:V,instance:_,pluginErrors:K})))}}),(0,r.p)({local:w,instance:R,pluginErrors:H}))})).subscribe(({local:V,remote:G,instance:_,pluginErrors:K})=>{V&&G?(U.dispatch({type:`${p.fu}/fetchLocal/fulfilled`}),U.dispatch({type:`${p.fu}/fetchRemote/fulfilled`}),U.dispatch(b((0,m.td)({local:V,remote:G,instance:_,pluginErrors:K})))):V&&(U.dispatch({type:`${p.fu}/fetchLocal/fulfilled`}),U.dispatch(b((0,m.td)({local:V,pluginErrors:K}))))},V=>(console.log(V),U.dispatch({type:`${p.fu}/fetchLocal/rejected`}),U.dispatch({type:`${p.fu}/fetchRemote/rejected`}),U.rejectWithValue("Unknown error."))),null}catch{return U.rejectWithValue("Unknown error.")}}),v=(0,t.zD)(`${p.fu}/fetchAllLocal`,async(L,U)=>{try{return(await(0,h.Gd)()).map(B=>(0,m.kH)(B))}catch{return U.rejectWithValue("Unknown error.")}}),E=(0,t.zD)(`${p.fu}/fetchRemotePlugins`,async(L,U)=>{try{return await(0,h.T_)()}catch(R){return(0,i.NF)(R)&&(R.isHandled=!0),U.rejectWithValue([])}}),D=(0,t.zD)(`${p.fu}/fetchDetails`,async(L,U)=>{try{const R=await(0,h.CB)(L);return{id:L,changes:{details:R}}}catch{return U.rejectWithValue("Unknown error.")}}),b=(0,t.VP)(`${p.fu}/addPlugins`),C=(0,t.VP)(`${p.fu}/addLocalPlugins`),y=(0,t.VP)(`${p.fu}/addLocalPlugins`),M=(0,t.VP)(`${p.fu}/addLocalPlugins`),T=(0,t.zD)(`${p.fu}/install`,async({id:L,version:U,isUpdating:R=!1},B)=>{const H=R?{isInstalled:!0,installedVersion:U,hasUpdate:!1}:{isInstalled:!0,installedVersion:U};try{return await(0,h.xZ)(L),await(0,m.tr)(),R&&(0,d.sk)(L),{id:L,changes:H}}catch(w){return console.error(w),(0,i.NF)(w)?B.rejectWithValue(w.data):B.rejectWithValue("Unknown error.")}}),I=(0,t.zD)(`${p.fu}/install`,async()=>({})),x=(0,t.zD)(`${p.fu}/uninstall`,async(L,U)=>{try{return await(0,h.cu)(L),await(0,m.tr)(),(0,d.sk)(L),{id:L,changes:{isInstalled:!1,installedVersion:void 0}}}catch(R){return console.error(R),U.rejectWithValue("Unknown error.")}}),S=(0,t.zD)(`${p.fu}/loadPluginDashboards`,async(L,U)=>{const H=`api/plugins/${U.getState().dataSources.dataSource.type}/dashboards`;return(0,i.AI)().get(H)}),O=(0,t.VP)(`${p.fu}/panelPluginLoaded`),P=L=>async(U,R)=>{let B=R().plugins.panels[L];return B||(B=await(0,f.TV)(L),R().plugins.panels[L]||U(O(B))),B}},31326:(Q,A,e)=>{"use strict";e.d(A,{AI:()=>r,Ff:()=>h,qo:()=>d});var t=e(30038),n=e(6745),o=e(66253),s=e(20701);const r=(0,t.pU)(),g=p=>new RegExp(`${n.fu}/(.*)/pending`).test(p.type),u=p=>new RegExp(`${n.fu}/(.*)/fulfilled`).test(p.type),c=p=>new RegExp(`${n.fu}/(.*)/rejected`).test(p.type),i=p=>{const m=p.lastIndexOf("/");return p.substring(0,m)},l={items:r.getInitialState(),requests:{},settings:{displayMode:o.fy.Grid},plugins:[],errors:[],searchQuery:"",hasFetched:!1,dashboards:[],isLoadingPluginDashboards:!1,panels:{}},f=(0,t.Z0)({name:"plugins",initialState:l,reducers:{setDisplayMode(p,m){p.settings.displayMode=m.payload}},extraReducers:p=>p.addCase(s.aU,(m,a)=>{r.upsertMany(m.items,a.payload)}).addCase(s.LR.fulfilled,(m,a)=>{r.upsertMany(m.items,a.payload)}).addCase(s.t5.fulfilled,(m,a)=>{r.updateOne(m.items,a.payload)}).addCase(s.ai.fulfilled,(m,a)=>{r.updateOne(m.items,a.payload)}).addCase(s.JC.fulfilled,(m,a)=>{r.updateOne(m.items,a.payload)}).addCase(s.NJ,(m,a)=>{m.panels[a.payload.meta.id]=a.payload}).addCase(s.h9.pending,(m,a)=>{m.isLoadingPluginDashboards=!0,m.dashboards=[]}).addCase(s.h9.fulfilled,(m,a)=>{m.isLoadingPluginDashboards=!1,m.dashboards=a.payload}).addMatcher(g,(m,a)=>{m.requests[i(a.type)]={status:o.IZ.Pending}}).addMatcher(u,(m,a)=>{m.requests[i(a.type)]={status:o.IZ.Fulfilled}}).addMatcher(c,(m,a)=>{m.requests[i(a.type)]={status:o.IZ.Rejected,error:a.payload}})}),{setDisplayMode:d}=f.actions,h=f.reducer},66253:(Q,A,e)=>{"use strict";e.d(A,{IZ:()=>c,Ip:()=>o,LZ:()=>u,Uy:()=>s,fy:()=>t,og:()=>g,u8:()=>r,vk:()=>n});var t=(i=>(i.Grid="grid",i.List="list",i))(t||{}),n=(i=>(i.Home="plugins-home",i.Browse="plugins-browse",i.Details="plugins-details",i))(n||{}),o=(i=>(i.app="apps",i.datasource="database",i.panel="credit-card",i.renderer="capture",i.secretsmanager="key-skeleton-alt",i))(o||{}),s=(i=>(i.Deleted="deleted",i.Active="active",i.Pending="pending",i.Deprecated="deprecated",i.Enterprise="enterprise",i))(s||{}),r=(i=>(i.INSTALL="INSTALL",i.UNINSTALL="UNINSTALL",i.UPDATE="UPDATE",i.REINSTALL="REINSTALL",i))(r||{}),g=(i=>(i.OVERVIEW="Overview",i.VERSIONS="Version history",i.CONFIG="Config",i.DASHBOARDS="Dashboards",i.USAGE="Usage",i.IAM="IAM",i))(g||{}),u=(i=>(i.OVERVIEW="overview",i.VERSIONS="version-history",i.CONFIG="config",i.DASHBOARDS="dashboards",i.USAGE="usage",i.IAM="iam",i))(u||{}),c=(i=>(i.Pending="Pending",i.Fulfilled="Fulfilled",i.Rejected="Rejected",i))(c||{})},74106:(Q,A,e)=>{"use strict";e.d(A,{c:()=>g});var t=e(96540),n=e(43429),o=e(14110),s=e(42418);function r(u,c){let i;switch(u){case n.QE.app:i="app plugin";break;case n.QE.panel:i="panel plugin";break;case n.QE.datasource:i="data source plugin";break;default:i="plugin"}let l=`This ${i} uses a deprecated, legacy platform based on AngularJS and `;return c===void 0?l+" may be incompatible depending on your Grafana configuration.":c?l+" will stop working in future releases of Grafana.":l+" is incompatible with your current Grafana configuration."}function g(u){const{className:c,angularSupportEnabled:i,pluginId:l,pluginType:f,showPluginDetailsLink:d,interactionElementId:h}=u,[p,m]=(0,t.useState)(!1),a={};return l&&(a.pluginId=l),h&&(a.elementId=h),p?null:t.createElement(s.F,{severity:"warning",title:"Angular plugin",className:c,onRemove:()=>m(!0)},t.createElement("p",null,r(f,i)),t.createElement("div",{className:"markdown-html"},t.createElement("ul",null,t.createElement("li",null,t.createElement("a",{href:"https://grafana.com/docs/grafana/latest/developers/angular_deprecation/",className:"external-link",target:"_blank",rel:"noreferrer",onClick:()=>{(0,o.rR)("angular_deprecation_docs_clicked",a)}},"Read our deprecation notice and migration advice.")),d&&l?t.createElement("li",null,t.createElement("a",{href:`plugins/${encodeURIComponent(l)}`,className:"external-link",target:"_blank",rel:"noreferrer"},"View plugin details")):null)))}},8480:(Q,A,e)=>{"use strict";e.d(A,{H:()=>s});var t=e(32264);function n(r){return Object.values(t.$.datasources).find(g=>g.uid===r)??null}function o(r){return n(r)?.meta.angular?.detected??!1}function s(r){const g=n(r);return(g?.meta.angular?.detected&&!g?.meta.angular.hideDeprecation)??!1}},72798:(Q,A,e)=>{"use strict";e.d(A,{A:()=>n,S:()=>s});var t=e(96540);const n=t.createContext(o());n.displayName="PluginPageContext";function o(){return{sectionNav:{main:{text:"Plugin page"},node:{text:"Plugin page"}}}}function s(r){return{sectionNav:r??o().sectionNav}}},10803:(Q,A,e)=>{"use strict";e.d(A,{p:()=>s});var t=e(96540),n=e(43429),o=e(39938);const s=g=>{const u=r(g.state);return u?t.createElement(o.E,{className:g.className,color:u.color,title:u.tooltip,text:u.text,icon:u.icon}):null};function r(g){switch(g){case n.pn.deprecated:return{text:"Deprecated",color:"red",tooltip:"This feature is deprecated and will be removed in a future release"};case n.pn.alpha:return{text:"Alpha",color:"blue",tooltip:"This feature is experimental and future updates might not be backward compatible"};case n.pn.beta:return{text:"Beta",color:"blue",tooltip:"This feature is close to complete but not fully tested"};default:return null}}},31193:(Q,A,e)=>{"use strict";e.d(A,{tR:()=>v,xq:()=>p});var t=e(40187),n=e(26272),o=e(80147),s=e(72574),r=e(81634),g=e(17172),u=e(19347),c=e(26657),i=e(28138),l=e(2913),f=e(53478),d=e(66718),h=e(91629);class p{constructor(D=(0,s.w)()){this.templateSrv=D,this.datasources={},this.settingsMapByName={},this.settingsMapByUid={},this.settingsMapById={},this.defaultName=""}init(D,b){this.datasources={},this.settingsMapByUid={},this.settingsMapByName=D,this.defaultName=b;for(const C of Object.values(D))C.uid||(C.uid=C.name),this.settingsMapByUid[C.uid]=C,this.settingsMapById[C.id]=C;this.datasources[c.dR.type]=f.Ex,this.datasources[d.Uj]=f.Ex,this.settingsMapByUid[c.dR.uid]=f.$i,this.settingsMapByUid[d.Uj]=f.$i}getDataSourceSettingsByUid(D){return this.settingsMapByUid[D]}getInstanceSettings(D,b){let C=m(D);if((0,c.s9)(C))return f.$i;if(C==="default"||C==null)return this.settingsMapByUid[this.defaultName]??this.settingsMapByName[this.defaultName];if(C[0]==="$"){const y=this.templateSrv.replace(C,b,a);let M;return y==="default"?M=this.settingsMapByName[this.defaultName]:M=this.settingsMapByUid[y]??this.settingsMapByName[y],M?{...M,isDefault:!1,name:C,uid:C,rawRef:{type:M.type,uid:M.uid}}:void 0}return this.settingsMapByUid[C]??this.settingsMapByName[C]??this.settingsMapById[C]}get(D,b){let C=m(D);if(!C)return this.get(this.defaultName);if((0,c.s9)(D))return Promise.resolve(this.datasources[d.Uj]);const y=this.settingsMapByName[C];return y&&(C=y.uid),this.datasources[C]?Promise.resolve(this.datasources[C]):(C=this.templateSrv.replace(C,b,a),C==="default"&&this.defaultName!=="default"?this.get(this.defaultName):this.datasources[C]?Promise.resolve(this.datasources[C]):this.loadDatasource(C))}async loadDatasource(D){if(this.datasources[D])return Promise.resolve(this.datasources[D]);const b=this.getInstanceSettings(D);if(!b)return Promise.reject({message:`Datasource ${D} was not found`});try{const C=await(0,h.cS)(b.meta);if(this.datasources[D])return this.datasources[D];const y=C.DataSourceClass.length!==1;let M;if(y?M=(0,r.C)().instantiate(C.DataSourceClass,{instanceSettings:b}):M=new C.DataSourceClass(b),M.components=C.components,!(M instanceof t.mA)){const T=M;T.name=b.name,T.id=b.id,T.type=b.type,T.meta=b.meta,T.uid=b.uid,M.getRef=t.mA.prototype.getRef}return this.datasources[D]=M,this.datasources[M.uid]=M,M}catch(C){return C instanceof Error&&i.A.emit(n.r1.alertError,[b.name+" plugin failed",C.toString()]),Promise.reject({message:`Datasource: ${D} was not found`})}}getAll(){return Object.values(this.settingsMapByName)}getList(D={}){const b=Object.values(this.settingsMapByName).filter(y=>!(y.meta.id==="grafana"||y.meta.id==="mixed"||y.meta.id==="dashboard"||D.metrics&&!y.meta.metrics||D.tracing&&!y.meta.tracing||D.logs&&y.meta.category!=="logging"&&!y.meta.logs||D.annotations&&!y.meta.annotations||D.alerting&&!y.meta.alerting||D.pluginId&&!(0,o._)(D.pluginId,y.meta)||D.filter&&!D.filter(y)||D.type&&(Array.isArray(D.type)?!D.type.includes(y.type):D.type!==y.type)||!D.all&&y.meta.metrics!==!0&&y.meta.annotations!==!0&&y.meta.tracing!==!0&&y.meta.logs!==!0&&y.meta.alerting!==!0));if(D.variables)for(const y of this.templateSrv.getVariables()){if(y.type!=="datasource")continue;let M=y.current.value==="default"?this.defaultName:y.current.value;Array.isArray(M)&&M.length===1&&(M=M[0]);const T=!Array.isArray(M)&&(this.settingsMapByName[M]||this.settingsMapByUid[M]);if(T){const I=`\${${y.name}}`;b.push({...T,isDefault:!1,name:I,uid:I})}}const C=b.sort((y,M)=>y.name.toLowerCase()>M.name.toLowerCase()?1:y.name.toLowerCase()<M.name.toLowerCase()?-1:0);if(!D.pluginId&&!D.alerting){if(D.mixed){const y=this.getInstanceSettings("-- Mixed --");y&&b.push(y)}if(D.dashboard){const y=this.getInstanceSettings("-- Dashboard --");y&&b.push(y)}if(!D.tracing){const y=this.getInstanceSettings("-- Grafana --");y&&b.push(y)}}return C}getExternal(){return this.getList()}getAnnotationSources(){return this.getList({annotations:!0,variables:!0}).map(D=>({name:D.name,value:D.name,meta:D.meta}))}getMetricSources(D){return this.getList({metrics:!0,variables:!D?.skipVariables}).map(b=>({name:b.name,value:b.name,meta:b.meta}))}async reload(){const D=await(0,g.AI)().get("/api/frontend/settings");l.Ay.datasources=D.datasources,l.Ay.defaultDatasource=D.defaultDatasource,this.init(D.datasources,D.defaultDatasource)}}function m(E){return(0,c.s9)(E)?c.dR.uid:typeof E=="string"?E:E?.uid}function a(E){return Array.isArray(E)?E[0]:E}const v=()=>(0,u.l)()},75462:(Q,A,e)=>{"use strict";e.d(A,{$Y:()=>M,FF:()=>h,N9:()=>P,io:()=>x,nv:()=>E,ol:()=>b,pL:()=>O,yS:()=>m,yb:()=>v,yt:()=>C,z1:()=>p});var t=e(32196),n=e(2543),o=e.n(n),s=e(96540),r=e(16817),g=e(74135),u=e(13834),c=e(47232),i=e(37390),l=e(28138),f=e(27716),d=e(28444);function h(L){console.warn(`[Plugin Extensions] ${L}`)}function p(L){return typeof L=="object"&&"type"in L&&L.type===g.u.link}function m(L){return typeof L=="object"&&"type"in L&&L.type===g.u.component}function a(L,U=""){return(...R)=>{try{return L(...R)}catch(B){B instanceof Error&&console.warn(`${U}${B.message}`)}}}function v(L,U){return{openModal:async B=>{const{title:H,body:w,width:N,height:V}=B;l.A.publish(new d.S8({component:E(L,D({title:H,body:w,width:N,height:V}))}))},context:U}}const E=(L,U)=>B=>{const{error:H,loading:w,value:N}=(0,r.A)(()=>(0,f.x)(L,{showErrorAlert:!1}));return w?null:H?(h(`Could not fetch plugin meta information for "${L}", aborting. (${H.message})`),null):N?s.createElement(u.a,{meta:N},s.createElement(U,{...B})):(h(`Fetched plugin meta information is empty for "${L}", aborting.`),null)},D=({title:L,body:U,width:R,height:B})=>{const H=(0,t.css)({width:R,height:B});return({onDismiss:N})=>s.createElement(i.a,{title:L,className:H,isOpen:!0,onDismiss:N,onClickBackdrop:N},s.createElement(U,{onDismiss:N}))};function b(L,U=new Map){if(!L||typeof L!="object"||Object.isFrozen(L))return L;const R=Array.isArray(L)?[...L]:{...L};if(U.has(L))return U.get(L);U.set(L,R);const B=Reflect.ownKeys(R);for(const H of B){const w=Array.isArray(R)?R[Number(H)]:R[H];w&&(typeof w=="object"||typeof w=="function")&&(Array.isArray(R)?R[Number(H)]=b(w,U):R[H]=b(w,U))}return Object.freeze(R)}function C(L,U){const R=`${L}${U.extensionPointId}${U.title}`;return Array.from(R).reduce((B,H)=>Math.imul(31,B)+H.charCodeAt(0)|0,0).toString()}const y=Symbol("isReadOnlyProxy");function M(L){if(!L||typeof L!="object"||I(L))return L;const U=new WeakMap;return new Proxy(L,{defineProperty:()=>!1,deleteProperty:()=>!1,isExtensible:()=>!1,set:()=>!1,get(R,B,H){if(B===y)return!0;const w=Reflect.get(R,B,H);return(0,c.Ar)(w)?(0,c.KQ)(w):(0,n.isObject)(w)||(0,n.isArray)(w)?(U.has(w)||U.set(w,M(w)),U.get(w)):w}})}function T(L){return typeof L=="object"&&L!==null}function I(L){return T(L)&&L[y]===!0}function x(L){const U={type:g.u.link,...L};return S(U),U}function S(L){if(L.type!==g.u.link)throw Error("config is not a extension link")}function O(L,U){return L.length<U?L:`${L.slice(0,U-3).trimEnd()}...`}function P(L){const U={},R=[];for(const H of L){const w=H.category;if(!w){R.push({text:O(H.title,25),href:H.path,onClick:H.onClick});continue}Array.isArray(U[w])||(U[w]=[]),U[w].push({text:O(H.title,25),href:H.path,onClick:H.onClick})}const B=Object.keys(U).reduce((H,w)=>(H.push({text:O(w,25),type:"group",subMenu:U[w]}),H),[]);return R.length>0&&(B.length>0&&B.push({text:"divider",type:"divider"}),Array.prototype.push.apply(B,R)),B}},15162:(Q,A,e)=>{"use strict";e.d(A,{Kk:()=>l,PY:()=>f,TV:()=>u,d4:()=>i,f7:()=>p,oZ:()=>c});var t=e(65158),n=e(2913),o=e(41394),s=e(91629);const r={},g={};function u(m){const a=r[m];if(a)return a;const v=i(m);if(!v)throw new Error(`Plugin ${m} not found`);return r[m]=d(v),m!==v.type&&(r[v.type]=r[m]),r[m]}function c(m){return!!i(m)}function i(m){const a=n.Ay.panels[m];if(!a){for(const v of Object.values(n.Ay.panels))if(v.aliasIDs?.includes(m))return v}return a}function l(m){return d(m)}function f(m){return g[m]}function d(m){return(0,s.j4)({path:m.module,version:m.info?.version,isAngular:m.angular?.detected,pluginId:m.id}).then(a=>{if(a.plugin)return a.plugin;if(a.PanelCtrl){const v=new t.m(null);return v.angularPanelCtrl=a.PanelCtrl,v}throw new Error("missing export: plugin or PanelCtrl")}).then(a=>(a.meta=m,g[m.id]=a,!a.panel&&a.angularPanelCtrl&&(a.panel=h(a)),a)).catch(a=>(console.warn("Error loading panel plugin: "+m.id,a),(0,o.W)(m,a)))}let h=m=>null;function p(m){h=m}},81900:(Q,A,e)=>{"use strict";e.d(A,{GD:()=>s,ni:()=>g,sk:()=>r});var t=e(27716);const n={},o=Date.now();function s({path:c,version:i}){const l=u(c);l&&!n[l]&&(n[l]=encodeURI(i))}function r(c){const i=`plugins/${c}/module`;n[i]&&delete n[i],(0,t.o)(c)}function g(c,i=o){const l=u(c);if(!l)return`${c}?_cache=${i}`;const d=n[l]||i;return`${c}?_cache=${d}`}function u(c){const i=/\/?.+\/(plugins\/.+\/module)\.js/i.exec(c);if(!i)return;const[l,f]=i;if(f)return f}},45179:(Q,A,e)=>{"use strict";e.d(A,{$b:()=>n,Bu:()=>o,Cf:()=>s,XV:()=>t});const t="package",n=/^plugins.+\.css$/i,o=/^(text|application)\/(x-)?javascript(;|$)/,s=/(?:^\uFEFF?|[^$_a-zA-Z\xA0-\uFFFF.])define\s*\(\s*("[^"]+"\s*,\s*|'[^']+'\s*,\s*)?\s*(\[(\s*(("[^"]+"|'[^']+')\s*,|\/\/.*\r?\n))*(\s*("[^"]+"|'[^']+')\s*,?)?(\s*(\/\/.*\r?\n|\/\*\/))*\s*\]|function\s*|{|[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*\))/},94429:(Q,A,e)=>{"use strict";e.d(A,{kB:()=>f,OD:()=>d,Av:()=>h});var t=e(32264),n=e(89191),o=e(66161),s=e(45179),r=e(34867);const g=new WeakMap,u={};function c(p,m,a){const v={get(E,D){if(document.currentScript===null&&typeof D!="symbol"&&D.toString()!=="__useDefault"){const C=`${m}.${String(D)}`,y=`${C}`;u[y]||(u[y]=!0,(0,r.fH)(`Plugin using ${C}`,{key:String(D),parent:m,packageName:a}))}let b=Reflect.get(E,D);return b!==null&&typeof b=="object"&&!(b instanceof RegExp)?(g.has(b)||g.set(b,c(b,`${m}.${String(D)}`,a)),g.get(b)):(typeof b=="function"&&(b=b.bind(E)),b)}};return typeof p=="object"&&p!==null?new Proxy(p,v):p}const i=/^(@grafana|app\/)/;function l(p,m){return i.test(m)?c(p,m,m):p}function f(p){return Object.keys(p).reduce((m,a)=>{const v=`${s.XV}:${a}`,E=t.$.featureToggles.pluginsAPIMetrics?l(p[a],a):p[a];return n.zO.set(v,E),o.s.set(a,p[a]),m[a]=v,m},{})}function d(p){return!!t.$.pluginsCDNBaseURL&&p.startsWith(t.$.pluginsCDNBaseURL)}function h(p){return p.startsWith("http")||p.startsWith("/")?p:`${t.$.appSubUrl??""}/${p}`}},27716:(Q,A,e)=>{"use strict";e.d(A,{o:()=>s,x:()=>o});var t=e(17172);const n={};function o(r,g){const u=n[r];return u?Promise.resolve(u):(0,t.AI)().get(`/api/plugins/${r}/settings`,void 0,void 0,g).then(c=>(n[r]=c,c)).catch(c=>typeof c=="object"&&c!==null&&"status"in c&&c.status===403?(c.isHandled=!0,Promise.reject(c)):Promise.reject(new Error("Unknown Plugin")))}const s=r=>r?delete n[r]:Object.keys(n).forEach(g=>delete n[g])},91629:(Q,A,e)=>{"use strict";e.d(A,{ui:()=>om,cS:()=>rm,j4:()=>hl});var t={};e.r(t),e.d(t,{plugin:()=>le});var n={};e.r(n),e.d(n,{plugin:()=>Is});var o={};e.r(o),e.d(o,{plugin:()=>zo});var s={};e.r(s),e.d(s,{plugin:()=>Bo});var r={};e.r(r),e.d(r,{plugin:()=>tl});var g={};e.r(g),e.d(g,{plugin:()=>Pc});var u={};e.r(u),e.d(u,{plugin:()=>Ut});var c={};e.r(c),e.d(c,{plugin:()=>Mm});var i={};e.r(i),e.d(i,{plugin:()=>fh});var l={};e.r(l),e.d(l,{plugin:()=>Mc});var f={};e.r(f),e.d(f,{plugin:()=>Rd});var d={};e.r(d),e.d(d,{plugin:()=>Hm});var h={};e.r(h),e.d(h,{plugin:()=>Xm});var p={};e.r(p),e.d(p,{plugin:()=>of});var m={};e.r(m),e.d(m,{plugin:()=>Hd});var a={};e.r(a),e.d(a,{plugin:()=>lu});var v={};e.r(v),e.d(v,{plugin:()=>Tf});var E={};e.r(E),e.d(E,{plugin:()=>kc});var D={};e.r(D),e.d(D,{plugin:()=>Yc});var b={};e.r(b),e.d(b,{plugin:()=>Qf});var C={};e.r(C),e.d(C,{plugin:()=>Ru});var y={};e.r(y),e.d(y,{plugin:()=>Bu});var M={};e.r(M),e.d(M,{plugin:()=>Nu});var T={};e.r(T),e.d(T,{plugin:()=>gg});var I={};e.r(I),e.d(I,{plugin:()=>Ng});var x=e(40187),S=e(41987),O=e(89191),P=e(96540),L=e(65158),U=e(57220),R=e(32264),B=e(40276),H=e(61410),w=e(23770),N=e(98164),V=e(55740),G=e(88467),_=e(80348),K=e(32196),j=e(70416),k=e(40845),Y=e(55852),ee=e(69087),re=e(64047),J=e(27962),ne=e(38858),q=e(56361),te=e(60021);const oe=({alertManagerSourceName:W,group:se,expandAll:fe})=>{const[Pe,Se]=(0,P.useState)(fe),we=(0,k.of)(ue),ke=(0,k.of)(ne.q);return(0,P.useEffect)(()=>Se(fe),[fe]),P.createElement("div",{className:we.group,"data-testid":"alert-group"},Object.keys(se.labels).length>0?P.createElement(ee.m,{labels:se.labels,size:"sm"}):P.createElement("div",{className:we.noGroupingText},"No grouping"),P.createElement("div",{className:we.row},P.createElement(re.e,{isCollapsed:!Pe,onToggle:()=>Se(!Pe)})," ",P.createElement(J.f,{group:se})),Pe&&P.createElement("div",{className:we.alerts},se.alerts.map((Je,it)=>{const ct=Je.status.state.toUpperCase(),ht=(0,j.dU)({start:new Date(Je.startsAt),end:Date.now()});return P.createElement("div",{"data-testid":"alert-group-alert",className:we.alert,key:`${Je.fingerprint}-${it}`},P.createElement("div",null,P.createElement("span",{className:ke[Je.status.state]},ct," "),"for ",ht),P.createElement("div",null,P.createElement(ee.m,{labels:Je.labels,size:"sm"})),P.createElement("div",{className:we.actionsRow},Je.status.state===te.Or.Suppressed&&P.createElement(Y.z9,{href:`${(0,q.nL)("/alerting/silences",W)}&silenceIds=${Je.status.silencedBy.join(",")}`,className:we.button,icon:"bell",size:"sm"},"Manage silences"),Je.status.state===te.Or.Active&&P.createElement(Y.z9,{href:(0,q.BK)(W,Je.labels),className:we.button,icon:"bell-slash",size:"sm"},"Silence"),Je.generatorURL&&P.createElement(Y.z9,{className:we.button,href:Je.generatorURL,icon:"chart-line",size:"sm"},"See source")))})))},ue=W=>({noGroupingText:(0,K.css)` height: ${W.spacing(4)}; `,group:(0,K.css)` background-color: ${W.colors.background.secondary}; margin: ${W.spacing(.5,1,.5,1)}; padding: ${W.spacing(1)}; `,row:(0,K.css)` display: flex; flex-direction: row; align-items: center; gap: ${W.spacing(1)}; `,alerts:(0,K.css)` margin: ${W.spacing(0,2,0,4)}; `,alert:(0,K.css)` padding: ${W.spacing(1,0)}; & + & { border-top: 1px solid ${W.colors.border.medium}; } `,button:(0,K.css)` & + & { margin-left: ${W.spacing(1)}; } `,actionsRow:(0,K.css)` padding: ${W.spacing(1,0)}; `}),ie=(W,se)=>(0,P.useMemo)(()=>W.filter(fe=>(0,N.Av)(fe.labels,se)||fe.alerts.some(Pe=>(0,N.Av)(Pe.labels,se))),[W,se]),ge=W=>{const se=(0,_.useDispatch)(),fe=R.$.unifiedAlertingEnabled,Pe=W.options.expandAll,Se=W.options.alertmanager,ke=((0,H.$)(ht=>ht.amAlertGroups)||G.jA)[Se||""]?.result||[],Je=W.options.labels?(0,N.J$)(W.options.labels):[],it=ie(ke,Je);(0,P.useEffect)(()=>{function ht(){Se&&se((0,w.D3)(Se))}ht();const Et=setInterval(ht,V.U3);return()=>{clearInterval(Et)}},[se,Se]);const ct=it.length>0;return P.createElement(B.E,{autoHeightMax:"100%",autoHeightMin:"100%"},fe&&P.createElement("div",null,ct&&it.map(ht=>P.createElement(oe,{alertManagerSourceName:Se,key:JSON.stringify(ht.labels),group:ht,expandAll:Pe})),!ct&&"No alerts"))};var he=e(88323);function De(W){return W.name===U.hY?"Grafana":W.name.slice(0,37)}const pe=({onChange:W,current:se,dataSources:fe})=>{const Pe=(0,P.useMemo)(()=>fe.map(Se=>({label:De(Se),value:Se.name,imgUrl:Se.imgUrl,meta:Se.meta})),[fe]);return P.createElement(he.l6,{"aria-label":"Choose Alertmanager",width:29,backspaceRemovesValue:!1,onChange:Se=>Se.value&&W(Se.value),options:Pe,maxMenuHeight:500,noOptionsMessage:"No datasources found",value:se,getOptionLabel:Se=>Se.label})},le=new L.m(ge).setPanelOptions(W=>W.addCustomEditor({name:"Alertmanager",path:"alertmanager",id:"alertmanager",defaultValue:U.hY,category:["Options"],editor:function(fe){const Pe=(0,P.useMemo)(U.r8,[]);return P.createElement(pe,{current:fe.value,onChange:Se=>fe.onChange(Se),dataSources:Pe})}}).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 Te=e(79924),Ee=e(67061),Re=e(85242),me=e(76459),Me=e.n(me),ye=e(13544),Le=e(53477),We=e(11230);async function Be({query:W,permissionLevel:se}){return(await(0,We.c0)(W,se)).map(Se=>({id:Se.id,title:Se.title,url:Se.url}))}async function Ye({query:W,permissionLevel:se,extraFolders:fe}){const Pe=await Be({query:W,permissionLevel:se}),Se=fe??[],we=W?Se.filter(ke=>ke.title?.toLowerCase().includes(W.toLowerCase())):Se;return Pe?we.concat(Pe):we}async function at({query:W,permissionLevel:se=_.PermissionLevelString.View,extraFolders:fe=[]}){return(await Ye({query:W,permissionLevel:se,extraFolders:fe})).map(Se=>({value:Se,label:Se.title}))}function st(W,se){return W?.find(fe=>fe.value?.id===se)}async function Ke(W){if(W!=null)try{const{id:se,title:fe}=await(0,We.dz)(W);return{value:{id:se,title:fe},label:fe}}catch{console.error(`Could not find folder with id:${W}`)}}const Xe={id:void 0,title:"All"},He={id:Le.s1,title:Le.JC};function Ge({onChange:W,extraFolders:se=[],initialFolderId:fe,permissionLevel:Pe=_.PermissionLevelString.View}){const[Se,we]=(0,P.useState)(!1),[ke,Je]=(0,P.useState)(void 0),[it,ct]=(0,P.useState)(void 0),ht=(0,P.useCallback)(async Bt=>{let Gt=st(Bt,fe);Gt||(Gt=await Ke(fe)??Bt[0],W(Gt.value)),we(!0),ct(Bt),Je(Gt)},[fe,W]),Et=(0,P.useCallback)(async Bt=>{const Gt=await at({query:Bt,permissionLevel:Pe,extraFolders:se});return Se||await ht(Gt),Gt},[Pe,se,Se,ht]),Tt=Me()(Et,300,{leading:!0}),Dt=(0,P.useCallback)(({value:Bt})=>{const Gt=st(it,Bt?.id);Je(Gt),W(Bt)},[it,W]);return P.createElement("div",{"data-testid":ye.Tp.components.ReadonlyFolderPicker.container},P.createElement(he.DW,{loadingMessage:"Loading folders...",defaultOptions:!0,defaultValue:ke,value:ke,loadOptions:Tt,onChange:Dt}))}var xe=e(51612),$e=e(2543),be=e.n($e),Z=e(16817),ae=e(47232),de=e(85858),ve=e(17172),Ue=e(10860),_e=e(14578),ze=e(55907),Ve=e(14792),Ne=e(64861);function ot(W){const[se,fe]=(0,P.useState)(""),Pe=(0,Z.A)(async()=>{if(W.options.showOptions!==Ne.zX.Current)return;const ke={state:pt(W.options.stateFilter)};W.options.alertName&&(ke.query=W.replaceVariables(W.options.alertName)),W.options.folderId>=0&&(ke.folderId=W.options.folderId),W.options.dashboardTitle&&(ke.dashboardQuery=W.options.dashboardTitle),W.options.dashboardAlerts&&(ke.dashboardId=(0,Ve.UA)().getCurrent()?.id),W.options.tags&&(ke.dashboardTag=W.options.tags);const Je=await(0,ve.AI)().get("/api/alerts",ke,`alert-list-get-current-alert-state-${W.id}`);let it=nt(W.options.sortOrder,Je.map(ct=>({...ct,stateModel:ze.A.getStateDisplayModel(ct.state),newStateDateAgo:(0,ae.KQ)(ct.newStateDate).locale("en").fromNow(!0)})));return it.length>W.options.maxItems&&(it=it.slice(0,W.options.maxItems)),fe(it.length===0?"No alerts":""),it},[W.options.showOptions,W.options.stateFilter.alerting,W.options.stateFilter.execution_error,W.options.stateFilter.no_data,W.options.stateFilter.ok,W.options.stateFilter.paused,W.options.stateFilter.pending,W.options.maxItems,W.options.tags,W.options.dashboardAlerts,W.options.dashboardTitle,W.options.folderId,W.options.alertName,W.options.sortOrder,W.timeRange]),Se=(0,Z.A)(async()=>{if(W.options.showOptions!==Ne.zX.RecentChanges)return;const ke={limit:W.options.maxItems,type:"alert",newState:pt(W.options.stateFilter)},Je=(0,Ve.UA)().getCurrent();W.options.dashboardAlerts&&(ke.dashboardId=Je?.id),ke.from=de.parse(Je?.time.from).unix()*1e3,ke.to=de.parse(Je?.time.to).unix()*1e3;const it=await(0,ve.AI)().get("/api/annotations",ke,`alert-list-get-state-changes-${W.id}`),ct=nt(W.options.sortOrder,it.map(ht=>({...ht,time:Je?.formatDate(ht.time,"MMM D, YYYY HH:mm:ss"),stateModel:ze.A.getStateDisplayModel(ht.newState),info:ze.A.getAlertAnnotationInfo(ht)})));return fe(ct.length===0?"No alerts in current time range":""),ct},[W.options.showOptions,W.options.maxItems,W.options.stateFilter.alerting,W.options.stateFilter.execution_error,W.options.stateFilter.no_data,W.options.stateFilter.ok,W.options.stateFilter.paused,W.options.stateFilter.pending,W.options.dashboardAlerts,W.options.sortOrder]),we=(0,k.of)(mt);return P.createElement(B.E,{autoHeightMin:"100%",autoHeightMax:"100%"},P.createElement("div",{className:we.container},se&&P.createElement("div",{className:we.noAlertsMessage},se),P.createElement("section",null,P.createElement("ol",{className:we.alertRuleList},W.options.showOptions===Ne.zX.Current?!Pe.loading&&Pe.value&&Pe.value.map(ke=>P.createElement("li",{className:we.alertRuleItem,key:`alert-${ke.id}`},P.createElement(Ue.Z,{href:`${ke.url}?viewPanel=${ke.panelId}`,className:we.cardContainer},P.createElement(Ue.Z.Heading,null,ke.name),P.createElement(Ue.Z.Figure,{className:(0,K.cx)(we.alertRuleItemIcon,ke.stateModel.stateClass)},P.createElement(_e.I,{name:ke.stateModel.iconClass,size:"xl",className:we.alertIcon})),P.createElement(Ue.Z.Meta,null,P.createElement("div",{className:we.alertRuleItemText},P.createElement("span",{className:ke.stateModel.stateClass},ke.stateModel.text),P.createElement("span",{className:we.alertRuleItemTime}," for ",ke.newStateDateAgo)))))):!Se.loading&&Se.value&&Se.value.map(ke=>P.createElement("li",{className:we.alertRuleItem,key:`alert-${ke.id}`},P.createElement(Ue.Z,{className:we.cardContainer},P.createElement(Ue.Z.Heading,null,ke.alertName),P.createElement(Ue.Z.Figure,{className:(0,K.cx)(we.alertRuleItemIcon,ke.stateModel.stateClass)},P.createElement(_e.I,{name:ke.stateModel.iconClass,size:"xl"})),P.createElement(Ue.Z.Meta,null,P.createElement("span",{className:(0,K.cx)(we.alertRuleItemText,ke.stateModel.stateClass)},ke.stateModel.text),P.createElement("span",null,ke.time),ke.info&&P.createElement("span",{className:we.alertRuleItemInfo},ke.info)))))))))}function nt(W,se){if(W===Ne.xB.Importance)return(0,$e.sortBy)(se,Pe=>ze.A.alertStateSortScore[Pe.state||Pe.newState]);if(W===Ne.xB.TimeAsc)return(0,$e.sortBy)(se,Pe=>new Date(Pe.newStateDate||Pe.time));if(W===Ne.xB.TimeDesc)return(0,$e.sortBy)(se,Pe=>new Date(Pe.newStateDate||Pe.time)).reverse();const fe=(0,$e.sortBy)(se,Pe=>(Pe.name||Pe.alertName).toLowerCase());return W===Ne.xB.AlphaDesc&&fe.reverse(),fe}function pt(W){return Object.entries(W).filter(([se,fe])=>fe).map(([se,fe])=>se)}const mt=W=>({cardContainer:(0,K.css)` padding: ${W.spacing(.5)} 0 ${W.spacing(.25)} 0; line-height: ${W.typography.body.lineHeight}; margin-bottom: 0px; `,container:(0,K.css)` overflow-y: auto; height: 100%; `,alertRuleList:(0,K.css)` display: flex; flex-wrap: wrap; justify-content: space-between; list-style-type: none; `,alertRuleItem:(0,K.css)` display: flex; align-items: center; width: 100%; height: 100%; background: ${W.colors.background.secondary}; padding: ${W.spacing(.5)} ${W.spacing(1)}; border-radius: ${W.shape.radius.default}; margin-bottom: ${W.spacing(.5)}; `,alertRuleItemIcon:(0,K.css)` display: flex; justify-content: center; align-items: center; width: ${W.spacing(4)}; padding: 0 ${W.spacing(.5)} 0 ${W.spacing(.25)}; margin-right: 0px; `,alertRuleItemText:(0,K.css)` font-weight: ${W.typography.fontWeightBold}; font-size: ${W.typography.size.sm}; margin: 0; `,alertRuleItemTime:(0,K.css)` color: ${W.colors.text.secondary}; font-weight: normal; white-space: nowrap; `,alertRuleItemInfo:(0,K.css)` font-weight: normal; flex-grow: 2; display: flex; align-items: flex-end; `,noAlertsMessage:(0,K.css)` display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; `,alertIcon:(0,K.css)` margin-right: ${W.spacing(.5)}; `}),gt=W=>{const se={showOptions:W.options.showOptions??W.show??Ne.zX.Current,maxItems:W.options.maxItems??W.limit??10,sortOrder:W.options.sortOrder??W.sortOrder??Ne.xB.AlphaAsc,dashboardAlerts:W.options.dashboardAlerts??W.onlyAlertsOnDashboard??!1,alertName:W.options.alertName??W.nameFilter??"",dashboardTitle:W.options.dashboardTitle??W.dashboardFilter??"",folderId:W.options.folderId??W.folderId,tags:W.options.tags??W.dashboardTags??[],stateFilter:W.options.stateFilter??W.stateFilter?.reduce((Pe,Se)=>({...Pe,[Se]:!0}),{})??{}};return parseFloat(W.pluginVersion||"7.4")<7.5&&["show","limit","sortOrder","onlyAlertsOnDashboard","nameFilter","dashboardFilter","folderId","dashboardTags","stateFilter"].forEach(Se=>delete W[Se]),se};var Pt=e(94822),Mt=e(54317);function Yt(W,se){const fe=(0,N.J$)(W);return(0,N.Av)(se,fe)}function zt(W,se){const{stateFilter:fe,alertInstanceLabelFilter:Pe}=W;return(0,$e.isEmpty)(fe)?se:se.filter(Se=>(fe.firing&&((0,Mt.S)(Se,Pt.Gi.Alerting)||(0,Mt.S)(Se,Pt.cF.Firing))||fe.pending&&((0,Mt.S)(Se,Pt.Gi.Pending)||(0,Mt.S)(Se,Pt.cF.Pending))||fe.noData&&(0,Mt.S)(Se,Pt.Gi.NoData)||fe.normal&&(0,Mt.S)(Se,Pt.Gi.Normal)||fe.error&&(0,Mt.S)(Se,Pt.Gi.Error)||fe.inactive&&(0,Mt.S)(Se,Pt.cF.Inactive))&&(Pe?Yt(W.alertInstanceLabelFilter,Se.labels):!0))}function _t(W){return!(W.startsWith("__")&&W.endsWith("__"))}const rt=W=>{const{onChange:se,id:fe,defaultValue:Pe,dataSource:Se}=W,we=(0,_.useDispatch)();(0,P.useEffect)(()=>{Se?Se&&we((0,w.mB)({rulesSourceName:Se})):we((0,w.nV)())},[we,Se]);const ke=(0,H.$)(ht=>ht.promRules),Je=(0,G.p0)(ke),it=(0,G.Vf)(ke),ct=(0,P.useMemo)(()=>{if((0,$e.isEmpty)(ke))return[];if(!Je)return[];const ht=Object.keys(ke).flatMap(Et=>ke[Et].result??[]).flatMap(Et=>Et.groups).flatMap(Et=>Et.rules.filter(Tt=>Tt.type===Pt.JS.Alerting)).flatMap(Et=>Et.alerts??[]).map(Et=>Object.keys(Et.labels??{})).flatMap(Et=>Et.filter(_t));return(0,$e.uniq)(ht)},[Je,ke]);return P.createElement(he.KF,{id:fe,isLoading:it,defaultValue:Pe,"aria-label":"group by label keys",placeholder:"Group by",prefix:P.createElement(_e.I,{name:"tag-alt"}),onChange:ht=>{se(ht.map(Et=>Et.value??""))},options:ct.map(ht=>({label:ht,value:ht}))})};var It=e(42941),Dn=e(94701),ft=e(3591),yt=e(37494),jt=e(39558),cn=e(42418),pn=e(2913),on=e(79938),Xt=e(11536),fn=e(9518),An=e(23662),hn=e(19073),ca=e(15458),Rt=e(55127),qt=e.n(Rt),gn=e(2426),Cn=e(15054);const mn=({rule:W,alerts:se,options:fe,grafanaTotalInstances:Pe,handleInstancesLimit:Se,limitInstances:we,grafanaFilteredInstancesTotal:ke})=>{const Je=fe.groupMode===Ne.r6.Custom?!0:fe.showInstances,[it,ct]=(0,P.useState)(Je),ht=(0,k.of)(Sn),Et=(0,k.of)(Y.my),Tt=(0,P.useCallback)(()=>{ct(ea=>!ea)},[]),Dt=(0,P.useMemo)(()=>zt(fe,(0,q.Cp)(fe.sortOrder,se))??[],[se,fe]),Bt=Pe!==void 0,Gt=Pe&&ke?Pe-ke:0,Lt=se.length-Dt.length,wt=Bt?Gt:Lt,Qt=Dt.length>0,nn=Qt?Tt:$e.noop;(0,P.useEffect)(()=>{Dt.length===0&&ct(!1)},[Dt]);const Jt=async()=>{Se&&(Se(!1),ct(!0))},In=async()=>{Se&&(Se(!0),ct(!0))},rn=we?ke:Dt.length,bn=Dt.length,Bn=Bt?rn:bn,Fn=we?`Showing ${Xt.Ys} of ${Pe} instances`:`Showing all ${Pe} instances`,xn=we?"View all instances":`Limit the result to ${Xt.Ys} instances`,un=Pe&&Xt.Ys===Dt.length&&Pe>Dt.length,Rn=Pe&&Xt.Ys<Dt.length&&!we,Pn=un||Rn?P.createElement("div",{className:ht.footerRow},P.createElement("div",null,Fn),P.createElement(Y.$n,{size:"sm",variant:"secondary",onClick:we?Jt:In},xn)):void 0;return P.createElement("div",null,fe.groupMode===Ne.r6.Default&&P.createElement("button",{className:(0,K.cx)(Et,Qt?ht.clickable:""),onClick:()=>nn()},Qt&&P.createElement(_e.I,{name:it?"angle-down":"angle-right",size:"md"}),P.createElement("span",null,`${Bn} ${qt()("instance",Bn)}`),wt>0&&P.createElement("span",null,", ",`${wt} hidden by filters`)),it&&P.createElement(gn.D,{rule:W,instances:Dt,pagination:{itemsPerPage:2*Cn.FG},footerRow:Pn}))},Sn=W=>({clickable:(0,K.css)` cursor: pointer; `,footerRow:(0,K.css)` display: flex; flex-direction: column; gap: ${W.spacing(1)}; justify-content: space-between; align-items: center; width: 100%; `}),Tn="__ungrouped__",$n=({rules:W,options:se})=>{const fe=(0,k.of)(Ps),Pe=se.groupBy,Se=(0,P.useMemo)(()=>{const we=new Map,ke=ct=>Pe?na(ct,Pe):!0;W.forEach(ct=>{const ht=(0,An.TU)(ct),Et=ke(ct);(ht?.alerts??[]).forEach(Tt=>{const Dt=Et?Mn(Pe,Tt.labels):Tn,Bt=we.get(Dt)?.alerts??[];we.set(Dt,{rule:ct,alerts:[...Bt,Tt]})})});const Je=we.get(Tn)?.alerts??[];return we.delete(Tn),we.set(Tn,{alerts:Je}),Array.from(we.entries()).reduce((ct,[ht,{rule:Et,alerts:Tt}])=>{const Dt=zt(se,Tt);return Dt.length>0&&ct.set(ht,{rule:Et,alerts:Dt}),ct},new Map)},[Pe,W,se]);return P.createElement(P.Fragment,null,Array.from(Se).map(([we,{rule:ke,alerts:Je}])=>P.createElement("li",{className:fe.alertRuleItem,key:we,"data-testid":we},P.createElement("div",null,P.createElement("div",{className:fe.customGroupDetails},P.createElement("div",{className:fe.alertLabels},we!==Tn&&Ln(we).map(([it,ct])=>P.createElement(ca.R,{key:it,labelKey:it,value:ct})),we===Tn&&"No grouping")),P.createElement(mn,{rule:ke,alerts:Je,options:se})))))};function Mn(W,se){return new URLSearchParams(W.map(fe=>[fe,se[fe]])).toString()}function Ln(W){return[...new URLSearchParams(W)]}function na(W,se){const fe=(0,An.TU)(W);return se.every(Pe=>(fe?.alerts??[]).some(Se=>Se.labels[Pe]))}const pa=$n;var ia=e(87586),Xn=e(26058),Da=e(18461),ba=e(3704);function Oa(W){return Object.values(W).filter(se=>se!==void 0).reduce((se,fe)=>se+fe,0)}const sa=({rules:W,options:se,handleInstancesLimit:fe,limitInstances:Pe,hideViewRuleLinkText:Se})=>{const we=(0,k.of)(Ps),ke=(0,k.of)(Jn),{href:Je}=(0,ia.A)(),it=W.length<=se.maxItems?W:W.slice(0,se.maxItems);return P.createElement(P.Fragment,null,P.createElement("ol",{className:we.alertRuleList},it.map((ct,ht)=>{const{namespaceName:Et,groupName:Tt,dataSourceName:Dt}=ct,Bt=(0,An.Z8)(ct.promRule)?ct.promRule:void 0,Gt=(0,An.Om)(Bt),Lt=(0,Da.UP)(ct.dataSourceName,ct),wt=(0,Da.$9)(Lt),Qt=ct.dataSourceName===U.hY?Oa(ct.instanceTotals):void 0,nn=ct.dataSourceName===U.hY?Oa(ct.filteredInstanceTotals):void 0,Jt=(0,ba.c)(`/alerting/${encodeURIComponent(Dt)}/${encodeURIComponent(wt)}/view`,{returnTo:Je??""});return Bt?P.createElement("li",{className:we.alertRuleItem,key:`alert-${Et}-${Tt}-${ct.name}-${ht}`},P.createElement("div",{className:ke.icon},P.createElement(_e.I,{name:ze.A.getStateDisplayModel(Bt.state).iconClass,className:ke[(0,An.Wy)(Bt.state)],size:"lg"})),P.createElement("div",{className:we.alertNameWrapper},P.createElement("div",{className:we.instanceDetails},P.createElement(Ee.B,{direction:"row",gap:1},P.createElement("div",{className:we.alertName,title:ct.name},ct.name),P.createElement(Xn.h,null),Jt&&P.createElement("a",{href:Jt,target:"__blank",className:we.link,rel:"noopener","aria-label":"View alert rule"},P.createElement("span",{className:(0,K.cx)({[we.hidden]:Se})},"View alert rule"),P.createElement(_e.I,{name:"external-link-alt",size:"sm"}))),P.createElement("div",{className:we.alertDuration},P.createElement("span",{className:ke[(0,An.Wy)(Bt.state)]},(0,An.XI)(Bt.state))," ",Gt&&Bt.state!==Pt.cF.Inactive&&P.createElement(P.Fragment,null,"for"," ",P.createElement("span",null,(0,j.dU)({start:Gt,end:Date.now()}))))),P.createElement(mn,{rule:ct,alerts:Bt.alerts??[],options:se,grafanaTotalInstances:Qt,grafanaFilteredInstancesTotal:nn,handleInstancesLimit:fe,limitInstances:Pe}))):null})))},Jn=W=>({common:(0,K.css)` width: 70px; text-align: center; align-self: stretch; display: inline-block; color: white; border-radius: ${W.shape.radius.default}; font-size: ${W.typography.bodySmall.fontSize}; text-transform: capitalize; line-height: 1.2; flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; `,icon:(0,K.css)` margin-top: ${W.spacing(2.5)}; align-self: flex-start; `,good:(0,K.css)` color: ${W.colors.success.main}; `,bad:(0,K.css)` color: ${W.colors.error.main}; `,warning:(0,K.css)` color: ${W.colors.warning.main}; `,neutral:(0,K.css)` color: ${W.colors.secondary.main}; `,info:(0,K.css)` color: ${W.colors.primary.main}; `}),Va=sa;function ts(W){const se=(fe,[Pe,Se])=>Se?[...fe,Pe]:fe;return Object.entries(W).reduce(se,[])}const Ds=({dispatch:W,limitInstances:se,matcherList:fe,dataSourceName:Pe,stateList:Se})=>{W(Pe?(0,w.Lc)({rulesSourceName:Pe,limitAlerts:se?Xt.Ys:void 0,matcher:fe,state:Se}):(0,w.yo)(!1,{limitAlerts:se?Xt.Ys:void 0,matcher:fe,state:Se}))};function Ms(W){const se=(0,_.useDispatch)(),[fe,Pe]=(0,It.A)(!0),[,Se]=(0,hn.Ej)(hn.RY.ViewAlertRule),{usePrometheusRulesByNamespaceQuery:we}=on.hK,ke=(0,H.$)(Ea=>Ea.promRules),Je=(0,H.$)(Ea=>Ea.rulerRules),it=(0,G.t4)(ke),ct=W.width<320;(0,P.useEffect)(()=>{W.options.stateFilter.inactive===!0&&(W.options.stateFilter.normal=!0),W.options.stateFilter.inactive=void 0},[W.options.stateFilter]);let ht;(0,Dn.A)(()=>{ht=(0,Ve.UA)().getCurrent()});const Et=(0,P.useMemo)(()=>ts(W.options.stateFilter),[W.options.stateFilter]),{options:Tt,replaceVariables:Dt}=W,Bt=Tt.datasource===U.vv?U.hY:Tt.datasource,Gt={...W.options,alertName:Dt(Tt.alertName),alertInstanceLabelFilter:Dt(Tt.alertInstanceLabelFilter)},Lt=(0,P.useMemo)(()=>(0,N.J$)(Gt.alertInstanceLabelFilter),[Gt.alertInstanceLabelFilter]),wt=(!Bt||Bt===U.hY)&&Se,{currentData:Qt=[],isLoading:nn,refetch:Jt}=we({limitAlerts:fe?Xt.Ys:void 0,matcher:Lt,state:Et},{skip:!wt});(0,P.useEffect)(()=>{ke.loading||Ds({dispatch:se,limitInstances:fe,matcherList:Lt,dataSourceName:Bt,stateList:Et});const Ea=ht?.events.subscribe(ft.sR,()=>{wt&&Jt(),(!Bt||Bt!==U.hY)&&Ds({dispatch:se,limitInstances:fe,matcherList:Lt,dataSourceName:Bt,stateList:Et})});return()=>{Ea?.unsubscribe()}},[se,ht,Lt,Et,fe,Bt,Jt,wt,ke.loading]);const In=Ea=>{Ea?(Ds({dispatch:se,limitInstances:fe,matcherList:Lt,dataSourceName:Bt,stateList:Et}),Pe(!0)):(Ds({dispatch:se,limitInstances:!1,matcherList:Lt,dataSourceName:Bt,stateList:Et}),Pe(!1))},rn=(0,fn.dy)(void 0,Qt),bn=(0,G.t4)(Je),Bn=(0,G.BU)(ke),Fn=it||bn,xn=(0,G.Vf)(ke),un=(0,k.of)(Ps),Rn=(0,An.dS)(rn),Pn=W.options.sortOrder,ea=(0,P.useMemo)(()=>cs(W,Ns(Pn,Rn)),[Rn,Pn,W]),jn=ea.length===0?"No alerts matching filters":void 0,la=nn||Fn&&xn&&!Bn,Ya=Object.values(ke).some(Ea=>Ea.result);return P.createElement(B.E,{autoHeightMin:"100%",autoHeightMax:"100%"},P.createElement("div",{className:un.container},Ya&&jn&&P.createElement("div",{className:un.noAlertsMessage},jn),Ya&&P.createElement("section",null,W.options.viewMode===Ne.nE.Stat&&P.createElement(yt.yV,{width:W.width,height:W.height,graphMode:yt.$p.None,textMode:yt.SV.Auto,justifyMode:yt.F8.Auto,theme:pn.$W.theme2,value:{text:`${ea.length}`,numeric:ea.length}}),W.options.viewMode===Ne.nE.List&&W.options.groupMode===Ne.r6.Custom&&P.createElement(pa,{rules:ea,options:Gt}),W.options.viewMode===Ne.nE.List&&W.options.groupMode===Ne.r6.Default&&P.createElement(Va,{rules:ea,options:Gt,handleInstancesLimit:In,limitInstances:fe,hideViewRuleLinkText:ct})),la&&P.createElement(jt._,{text:"Loading..."})))}function Ns(W,se){if(W===Ne.xB.Importance)return(0,$e.sortBy)(se,Pe=>ze.A.alertStateSortScore[Pe.state]);if(W===Ne.xB.TimeAsc)return(0,$e.sortBy)(se,Pe=>{const Se=(0,An.TU)(Pe)??void 0;return(0,An.Om)(Se)||new Date});if(W===Ne.xB.TimeDesc)return(0,$e.sortBy)(se,Pe=>{const Se=(0,An.TU)(Pe)??void 0;return(0,An.Om)(Se)||new Date}).reverse();const fe=(0,$e.sortBy)(se,Pe=>Pe.name.toLowerCase());return W===Ne.xB.AlphaDesc&&fe.reverse(),fe}function cs(W,se){const{options:fe,replaceVariables:Pe}=W;let Se=[...se];if(fe.dashboardAlerts){const we=(0,Ve.UA)().getCurrent()?.uid;Se=Se.filter(({annotations:ke={}})=>Object.entries(ke).some(([Je,it])=>Je===V.YH.dashboardUID&&it===we))}if(fe.alertName){const we=Pe(fe.alertName);Se=Se.filter(({name:ke})=>ke.toLocaleLowerCase().includes(we.toLocaleLowerCase()))}if(Se=Se.filter(we=>{const ke=(0,An.TU)(we);return ke?fe.stateFilter.firing&&ke.state===Pt.cF.Firing||fe.stateFilter.pending&&ke.state===Pt.cF.Pending||fe.stateFilter.normal&&ke.state===Pt.cF.Inactive:!1}),fe.folder&&(Se=Se.filter(we=>we.namespaceName===fe.folder.title)),fe.datasource){const we=fe.datasource===U.vv;Se=Se.filter(we?({dataSourceName:ke})=>ke===U.hY:({dataSourceName:ke})=>ke===fe.datasource)}return Se=Se.reduce((we,ke)=>{const Je=(0,An.TU)(ke);return(Je?zt({stateFilter:fe.stateFilter,alertInstanceLabelFilter:Pe(fe.alertInstanceLabelFilter)},Je.alerts??[]):[]).length&&we.push(ke),we},[]),Se}const Ps=W=>({cardContainer:(0,K.css)` padding: ${W.spacing(.5)} 0 ${W.spacing(.25)} 0; line-height: ${W.typography.body.lineHeight}; margin-bottom: 0px; `,container:(0,K.css)` overflow-y: auto; height: 100%; `,alertRuleList:(0,K.css)` display: flex; flex-wrap: wrap; justify-content: space-between; list-style-type: none; `,alertRuleItem:(0,K.css)` display: flex; align-items: center; width: 100%; height: 100%; background: ${W.colors.background.secondary}; padding: ${W.spacing(.5)} ${W.spacing(1)}; border-radius: ${W.shape.radius.default}; margin-bottom: ${W.spacing(.5)}; gap: ${W.spacing(2)}; `,alertName:(0,K.css)` font-size: ${W.typography.h6.fontSize}; font-weight: ${W.typography.fontWeightBold}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; `,alertNameWrapper:(0,K.css)` display: flex; flex: 1; flex-wrap: nowrap; flex-direction: column; min-width: 100px; `,alertLabels:(0,K.css)` > * { margin-right: ${W.spacing(.5)}; } `,alertDuration:(0,K.css)` font-size: ${W.typography.bodySmall.fontSize}; `,alertRuleItemText:(0,K.css)` font-weight: ${W.typography.fontWeightBold}; font-size: ${W.typography.bodySmall.fontSize}; margin: 0; `,alertRuleItemTime:(0,K.css)` color: ${W.colors.text.secondary}; font-weight: normal; white-space: nowrap; `,alertRuleItemInfo:(0,K.css)` font-weight: normal; flex-grow: 2; display: flex; align-items: flex-end; `,noAlertsMessage:(0,K.css)` display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; `,alertIcon:(0,K.css)` margin-right: ${W.spacing(.5)}; `,instanceDetails:(0,K.css)` min-width: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; `,customGroupDetails:(0,K.css)` margin-bottom: ${W.spacing(.5)}; `,link:(0,K.css)` word-break: break-all; color: ${W.colors.primary.text}; display: flex; align-items: center; gap: ${W.spacing(1)}; `,hidden:(0,K.css)` display: none; `});function ir(W){const[,se]=(0,hn.Ej)(hn.RY.ViewAlertRule),[,fe]=(0,hn.Ej)(hn.RY.ViewExternalAlertRule);return!se&&!fe?P.createElement(cn.F,{title:"Permission required"},"Sorry, you do not have the required permissions to read alert rules"):P.createElement(Ms,{...W})}class Cs{getSuggestionsForData(se){const{dataSummary:fe}=se;if(fe.hasData)return;se.getListAppender({name:"Dashboard list",pluginId:"dashlist",options:{}}).append({})}}function as(W){return W.showOptions===Ne.zX.Current}const ar=new L.m(ot).setPanelOptions(W=>{W.addSelect({name:"Show",path:"showOptions",settings:{options:[{label:"Current state",value:Ne.zX.Current},{label:"Recent state changes",value:Ne.zX.RecentChanges}]},defaultValue:Ne.zX.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:Ne.xB.AlphaAsc},{label:"Alphabetical (desc)",value:Ne.xB.AlphaDesc},{label:"Importance",value:Ne.xB.Importance},{label:"Time (asc)",value:Ne.xB.TimeAsc},{label:"Time (desc)",value:Ne.xB.TimeDesc}]},defaultValue:Ne.xB.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:as}).addTextInput({path:"dashboardTitle",name:"Dashboard title",defaultValue:"",category:["Filter"],showIf:as}).addCustomEditor({path:"folderId",name:"Folder",id:"folderId",defaultValue:null,editor:function({value:fe,onChange:Pe}){return P.createElement(Ge,{initialFolderId:fe,onChange:Se=>Pe(Se?.id),extraFolders:[Xe,He]})},category:["Filter"],showIf:as}).addCustomEditor({id:"tags",path:"tags",name:"Tags",description:"",defaultValue:[],editor(se){return P.createElement(Te.u,{tags:se.value,onChange:se.onChange})},category:["Filter"],showIf:as}).addBooleanSwitch({path:"stateFilter.ok",name:"Ok",defaultValue:!1,category:["State filter"],showIf:as}).addBooleanSwitch({path:"stateFilter.paused",name:"Paused",defaultValue:!1,category:["State filter"],showIf:as}).addBooleanSwitch({path:"stateFilter.no_data",name:"No data",defaultValue:!1,category:["State filter"],showIf:as}).addBooleanSwitch({path:"stateFilter.execution_error",name:"Execution error",defaultValue:!1,category:["State filter"],showIf:as}).addBooleanSwitch({path:"stateFilter.alerting",name:"Alerting",defaultValue:!1,category:["State filter"],showIf:as}).addBooleanSwitch({path:"stateFilter.pending",name:"Pending",defaultValue:!1,category:["State filter"],showIf:as})}).setMigrationHandler(gt).setSuggestionsSupplier(new Cs),lr=new L.m(ir).setPanelOptions(W=>{W.addRadio({path:"viewMode",name:"View mode",description:"Toggle between list view and stat view",defaultValue:Ne.nE.List,settings:{options:[{label:"List",value:Ne.nE.List},{label:"Stat",value:Ne.nE.Stat}]},category:["Options"]}).addRadio({path:"groupMode",name:"Group mode",description:"How alert instances should be grouped",defaultValue:Ne.r6.Default,settings:{options:[{value:Ne.r6.Default,label:"Default grouping"},{value:Ne.r6.Custom,label:"Custom grouping"}]},category:["Options"]}).addCustomEditor({path:"groupBy",name:"Group by",description:"Filter alerts using label querying",id:"groupBy",defaultValue:[],showIf:se=>se.groupMode===Ne.r6.Custom,category:["Options"],editor:se=>P.createElement(rt,{id:se.id??"groupBy",defaultValue:se.value.map(fe=>({label:fe,value:fe})),onChange:se.onChange,dataSource:se.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:Ne.xB.AlphaAsc},{label:"Alphabetical (desc)",value:Ne.xB.AlphaDesc},{label:"Importance",value:Ne.xB.Importance},{label:"Time (asc)",value:Ne.xB.TimeAsc},{label:"Time (desc)",value:Ne.xB.TimeDesc}]},defaultValue:Ne.xB.AlphaAsc,category:["Options"]}).addBooleanSwitch({path:"dashboardAlerts",name:"Alerts linked to this dashboard",description:"Only show alerts linked to 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 from alert source",id:"datasource",defaultValue:null,editor:function(fe){return P.createElement(Ee.B,{gap:1},P.createElement(xe.s,{...fe,type:["prometheus","loki","grafana"],noDefault:!0,current:fe.value,onChange:Pe=>fe.onChange(Pe.name)}),P.createElement(Y.$n,{variant:"secondary",onClick:()=>fe.onChange(null)},"Clear"))},category:["Filter"]}).addCustomEditor({showIf:se=>se.datasource===U.vv||!se.datasource,path:"folder",name:"Folder",description:"Filter for alerts in the selected folder (only for Grafana alerts)",id:"folder",defaultValue:null,editor:function(fe){return P.createElement(Re.sR,{enableReset:!0,showRoot:!1,allowEmpty:!0,initialTitle:fe.value?.title,initialFolderUid:fe.value?.uid,permissionLevel:_.PermissionLevelString.View,onClear:()=>fe.onChange(""),...fe})},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"]})}),Is=R.$.unifiedAlertingEnabled?lr:ar;var cr=e(64423),Zs=e(71733),os=e(26272),is=e(69129),Ls=e(12131),ks=e(64149),Pr=e(3911),qs=e(85918),Cr=e(28138),Ir=e(44522),Lo=e(56034);const br=({options:W,annotation:se,formatDate:fe,onClick:Pe,onAvatarClick:Se,onTagClick:we})=>{const ke=(0,k.of)(Nr),{showUser:Je,showTags:it,showTime:ct}=W,{text:ht="",login:Et,email:Tt,avatarUrl:Dt,tags:Bt,time:Gt,timeEnd:Lt}=se,wt=()=>{Pe(se)},Qt=()=>{Se(se)},nn=Et&&Je,Jt=Gt&&ct,In=Lt&&Lt!==Gt&&ct;return P.createElement(Ue.Z,{className:ke.card,onClick:wt},P.createElement(Ue.Z.Heading,null,P.createElement(Ir.I,{className:ke.heading,onClick:rn=>{rn.stopPropagation()},content:ht})),Jt&&P.createElement(Ue.Z.Description,{className:ke.timestamp},P.createElement(hs,{formatDate:fe,time:Gt}),In&&P.createElement(P.Fragment,null,P.createElement("span",{className:ke.time},"-"),P.createElement(hs,{formatDate:fe,time:Lt})," ")),nn&&P.createElement(Ue.Z.Meta,{className:ke.meta},P.createElement(so,{email:Tt,login:Et,avatarUrl:Dt,onClick:Qt})),it&&Bt&&P.createElement(Ue.Z.Tags,null,P.createElement(ks.L,{tags:Bt,onClick:rn=>we(rn,!1)})))},so=({onClick:W,avatarUrl:se,login:fe,email:Pe})=>{const Se=(0,k.of)(Nr),we=Je=>{Je.stopPropagation(),W()},ke=P.createElement("span",null,"Created by:",P.createElement("br",null)," ",Pe);return P.createElement(Lo.m,{content:ke,theme:"info",placement:"top"},P.createElement("button",{onClick:we,className:Se.avatar},P.createElement("img",{src:se,alt:"avatar icon"})))},hs=({time:W,formatDate:se})=>{const fe=(0,k.of)(Nr);return P.createElement("span",{className:fe.time},P.createElement("span",null,se(W)))};function Nr(W){return{card:(0,K.css)({gridTemplateAreas:'"Heading Description Meta Tags"',gridTemplateColumns:"auto 1fr auto auto",padding:W.spacing(1),margin:W.spacing(.5),width:"inherit"}),heading:(0,K.css)({a:{zIndex:1,position:"relative",color:W.colors.text.link,"&:hover":{textDecoration:"underline"}}}),meta:(0,K.css)({margin:0,position:"relative",justifyContent:"end"}),timestamp:(0,K.css)({margin:0,alignSelf:"center"}),time:(0,K.css)({marginLeft:W.spacing(1),marginRight:W.spacing(1),fontSize:W.typography.bodySmall.fontSize,color:W.colors.text.secondary}),avatar:(0,K.css)({border:"none",background:"inherit",margin:0,padding:W.spacing(.5),img:{borderRadius:W.shape.radius.circle,width:W.spacing(2),height:W.spacing(2)}})}}class wr extends P.PureComponent{constructor(se){super(se),this.style=Zr(R.$.theme2),this.subs=new cr.yU,this.tagListRef=P.createRef(),this.onAnnoClick=async fe=>{if(!fe.time)return;const{options:Pe}=this.props,we=(0,Ve.UA)().getCurrent(),ke={from:this._timeOffset(fe.time,Pe.navigateBefore,!0),to:this._timeOffset(fe.timeEnd??fe.time,Pe.navigateAfter,!1),viewPanel:Pe.navigateToPanel?fe.panelId:void 0};if(we?.uid===fe.dashboardUID){Ls.Ny.partial(ke);return}const Je=await(0,ve.AI)().get("/api/search",{dashboardUIDs:fe.dashboardUID});if(Je&&Je.length&&Je[0].uid===fe.dashboardUID){const it=Je[0],ct=new URL(it.url,window.location.origin);ct.searchParams.set("from",String(ke.from)),ct.searchParams.set("to",String(ke.to)),Ls.Ny.push(Zs.I.stripBaseFromUrl(ct.toString()));return}Cr.A.emit(os.r1.alertWarning,["Unknown Dashboard: "+fe.dashboardUID])},this.onTagClick=(fe,Pe)=>{if(!Pe&&this.state.queryTags.includes(fe))return;const Se=Pe?this.state.queryTags.filter(ke=>ke!==fe):[...this.state.queryTags,fe];let we;if(Pe){const ke=document.activeElement,Je=ke?.getAttribute("data-tag-id");if(this.tagListRef.current?.contains(ke)&&Je){const it=Number.parseInt(Je,10),ct=this.tagListRef.current.querySelector(`[data-tag-id="${it+1}"]`)??this.tagListRef.current.querySelector(`[data-tag-id="${it-1}"]`);ct instanceof HTMLElement&&(we=ct)}}this.setState({queryTags:Se},()=>we?.focus())},this.onUserClick=fe=>{this.setState({queryUser:{id:fe.userId,login:fe.login,email:fe.email}})},this.onClearUser=()=>{this.setState({queryUser:void 0})},this.renderItem=(fe,Pe)=>{const{options:Se}=this.props,we=(0,Ve.UA)().getCurrent();return we?P.createElement(br,{annotation:fe,formatDate:we.formatDate,onClick:this.onAnnoClick,onAvatarClick:this.onUserClick,onTagClick:this.onTagClick,options:Se}):P.createElement(P.Fragment,null)},this.state={annotations:[],timeInfo:"",loaded:!1,queryTags:[]}}componentDidMount(){this.doSearch(),this.subs.add(this.props.eventBus.getStream(is.We).subscribe({next:()=>{this.doSearch()}}))}componentWillUnmount(){this.subs.unsubscribe()}componentDidUpdate(se,fe){const{options:Pe,timeRange:Se}=this.props;(Pe!==se.options||this.state.queryTags!==fe.queryTags||this.state.queryUser!==fe.queryUser||se.renderCounter!==this.props.renderCounter||Pe.onlyInTimeRange&&Se!==se.timeRange)&&this.doSearch()}async doSearch(){const{options:se}=this.props,{queryUser:fe,queryTags:Pe}=this.state,Se={tags:se.tags,limit:se.limit,type:"annotation"};se.onlyFromThisDashboard&&(Se.dashboardUID=(0,Ve.UA)().getCurrent()?.uid);let we="";if(se.onlyInTimeRange){const{timeRange:Je}=this.props;Se.from=Je.from.valueOf(),Se.to=Je.to.valueOf()}else we="All Time";fe&&(Se.userId=fe.id),se.tags&&se.tags.length&&(Se.tags=se.tags.map(Je=>this.props.replaceVariables(Je))),Pe.length&&(Se.tags=Se.tags?[...Se.tags,...Pe]:Pe);const ke=await(0,ve.AI)().get("/api/annotations",Se,`anno-list-panel-${this.props.id}`);this.setState({annotations:ke,timeInfo:we,loaded:!0})}_timeOffset(se,fe,Pe=!1){let Se=5,we="m";const ke=/^(\d+)(\w)/.exec(fe);ke&&ke.length===3&&(Se=parseInt(ke[1],10),we=ke[2]);const Je=(0,ae.KQ)(se);return Pe&&(Se*=-1),Je.add(Se,we).valueOf()}render(){const{loaded:se,annotations:fe,queryUser:Pe,queryTags:Se}=this.state;if(!se)return P.createElement("div",null,"loading...");const we=Pe||Se.length>0;return P.createElement(B.E,{autoHeightMin:"100%"},we&&P.createElement("div",{className:this.style.filter},P.createElement("b",null,"Filter:"),Pe&&P.createElement(Y.$n,{size:"sm",variant:"secondary",fill:"text",onClick:this.onClearUser,"aria-label":`Remove filter: ${Pe.email}`},Pe.email),Se.length>0&&P.createElement(ks.L,{icon:"times",tags:Se,onClick:ke=>this.onTagClick(ke,!0),getAriaLabel:ke=>`Remove ${ke} tag`,className:this.style.tagList,ref:this.tagListRef})),fe.length<1&&P.createElement("div",{className:this.style.noneFound},"No Annotations Found"),P.createElement(qs.p,{items:fe,renderItem:this.renderItem,getItemKey:ke=>`${ke.id}`}))}}const Zr=(0,Pr.N)(W=>({noneFound:(0,K.css)` display: flex; align-items: center; justify-content: center; width: 100%; height: calc(100% - 30px); `,filter:(0,K.css)({alignItems:"center",display:"flex",flexWrap:"wrap",gap:W.spacing(.5),padding:W.spacing(.5)}),tagList:(0,K.css)({justifyContent:"flex-start","li > button":{paddingLeft:"3px"}})})),Ar={limit:10,navigateAfter:"10m",navigateBefore:"10m",navigateToPanel:!0,onlyFromThisDashboard:!1,onlyInTimeRange:!1,showTags:!0,showTime:!0,showUser:!0,tags:[]},zo=new L.m(wr).setPanelOptions(W=>{W.addRadio({category:["Annotation query"],path:"onlyFromThisDashboard",name:"Query filter",defaultValue:Ar.onlyFromThisDashboard,settings:{options:[{value:!1,label:"All dashboards"},{value:!0,label:"This dashboard"}]}}).addRadio({category:["Annotation query"],path:"onlyInTimeRange",name:"Time range",defaultValue:Ar.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(se){return P.createElement(Te.u,{tags:se.value,onChange:se.onChange})}}).addNumberInput({category:["Annotation query"],path:"limit",name:"Limit",defaultValue:Ar.limit}).addBooleanSwitch({category:["Display"],path:"showUser",name:"Show user",defaultValue:Ar.showUser}).addBooleanSwitch({category:["Display"],path:"showTime",name:"Show time",defaultValue:Ar.showTime}).addBooleanSwitch({category:["Display"],path:"showTags",name:"Show tags",defaultValue:Ar.showTags}).addRadio({category:["Link behavior"],path:"navigateToPanel",name:"Link target",defaultValue:Ar.navigateToPanel,settings:{options:[{value:!0,label:"Panel"},{value:!1,label:"Dashboard"}]}}).addTextInput({category:["Link behavior"],path:"navigateBefore",name:"Time before",defaultValue:Ar.navigateBefore,description:""}).addTextInput({category:["Link behavior"],path:"navigateAfter",name:"Time after",defaultValue:Ar.navigateAfter,description:""})}).setPanelChangeHandler((W,se,fe)=>se==="ryantxu-annolist-panel"?fe:W.options);var $s=e(37055),Ss=e(24293),ro=e(27310),Za=e(28240),bs=e(47070),Yn=e(11261),St=e(52622),oo=e(52198),vo=e(38248),io=e(11404),ur=e(89654),Fr=e(22680),Co=e(71242),bo=e(24882),Ot=e(21423),$t=e(97152),sn=e(79041),Zt=e(29413),vn=e(30501),wn=e(67266),kn=e(55726),ua=e(24182),ma=e(17464),Qa=e(69503),za=e(94624),Ia=e(16615);const Ha=({config:W,onUPlotClick:se,setFocusedSeriesIdx:fe,setFocusedPointIdx:Pe,setCoords:Se,setHover:we,isToolTipOpen:ke,isActive:Je,setIsActive:it,sync:ct})=>{ke.current=!1;const ht=()=>{it&&it(!0)},Et=()=>{ke.current||(Se(null),it&&it(!1))};let Tt=null,Dt=null;W.addHook("init",wt=>{Tt=wt.root.parentElement,Dt=wt.over,Tt?.addEventListener("click",se),Dt.addEventListener("mouseleave",Et),Dt.addEventListener("mouseenter",ht),ct&&ct()===za.y.Crosshair&&wt.root.classList.add("shared-crosshair")});const Bt=()=>{ke.current&&(Se(null),se())};W.addHook("drawClear",Bt),W.addHook("destroy",()=>{Tt?.removeEventListener("click",se),Dt?.removeEventListener("mouseleave",Et),Dt?.removeEventListener("mouseenter",ht),Bt()});let Gt;W.addHook("syncRect",(wt,Qt)=>{Gt=Qt});const Lt=W.getTooltipInterpolator();return Lt&&W.addHook("setCursor",wt=>{ke.current||Lt(fe,Pe,Qt=>{if(Qt){Se(null);return}if(!Gt)return;const{x:nn,y:Jt}=(0,Ia.n)(wt,Gt);nn!==void 0&&Jt!==void 0&&Se({canvas:{x:wt.cursor.left,y:wt.cursor.top},viewport:{x:nn,y:Jt}})},wt)}),W.addHook("setLegend",wt=>{if(!ke.current&&!Lt&&Pe(wt.legend.idx),wt.cursor.idxs!=null)for(let Qt=0;Qt<wt.cursor.idxs.length;Qt++){const nn=wt.cursor.idxs[Qt];if(nn!=null){const Jt={xIndex:nn,yIndex:0,pageX:Gt.left+wt.cursor.left,pageY:Gt.top+wt.cursor.top};(!ke.current||!Jt)&&we(Jt);return}}}),W.addHook("setSeries",(wt,Qt)=>{ke.current||fe(Qt)}),W};var Ys=e(25469),sr=e(30249),vs=e(28895),zr=e(1819),ws=e(36613),ds=e(83195),Vs=e(8066),kr=e(73060),ha=e(57875),xs=e(51336),lo=e(52811),qa=e(16895),Qs=e(63577),Wr=e(23596),co=e(39758),To=e(4134);const Mo=co.ur,vi=co.ur,ti=8,ko=30,Ho=.65,Gi=.1,mr=.15,ji=5,Yi=10,Qi=.1;function ni(W,se,fe,Pe,Se){const we=(0,Zt.kD)(W,14),ke=se/(we.width+2)*14,Je=fe/Pe,it=Math.min(Je,ke);return{fontSize:Math.min(it,Se??it),textMetrics:we}}function ai(W,se){const{xOri:fe,xDir:Pe,rawValue:Se,getColor:we,formatValue:ke,formatShortValue:Je,fillOpacity:it=1,showValue:ct,xSpacing:ht=0}=W,Et=fe===St.Lt.Horizontal,Tt=!W.text?.valueSize,Dt=W.stacking!==St.gs.None,Bt=W.stacking===St.gs.Percent;let{groupWidth:Gt,barWidth:Lt,barRadius:wt=0}=W;Dt&&([Gt,Lt]=[Lt,Gt]);let Qt,nn;const Jt=On=>Array.from(On.data[0].map((zn,Qn)=>Qn)),In=ht===0?void 0:(On,zn)=>{const Qn=On.bbox.width,Ka=Pe*(Et?1:-1);let Ra=zn.length,ns=Ra-1,ja=0,Os=Qn/ws.A.pxRatio,Xs=Math.abs(Math.floor(Os/ht));ja=Ra<Xs?0:Math.ceil(Ra/Xs);let no=zn.map((Ks,Jr)=>ja!==0&&(ht>0?Jr:ns-Jr)%ja>0?null:Ks);return Ka===1?no:no.reverse()},rn=(On,zn,Qn,Ka,Ra)=>{if(W.xTimeAuto){let ns=On.scales.x,ja=ns.min,Os=ns.max;ns.min=On.data[0][0],ns.max=On.data[0][On.data[0].length-1];let Xs=(0,vn.fU)(On,zn,Qn,Ka,Ra);return ns.min=ja,ns.max=Os,Xs}return zn.map(ns=>Et?Je(0,ns):ke(0,ns))},bn=(On,zn,Qn)=>{zn=0,Qn=Math.max(1,On.data[0].length-1);let Ka=0;(0,co.mn)(On.data[0].length,Gt,Mo,0,(ns,ja,Os)=>{Ka=ja+Os/2});let Ra=Qn-zn;if(Ka===.5)zn-=Ra;else{let ja=(1/(1-Ka*2)*Ra-Ra)/2;zn-=ja,Qn+=ja}return[zn,Qn]};let Bn=(On,zn)=>{let Qn=Array.from({length:zn},()=>({offs:Array(On).fill(0),size:Array(On).fill(0)}));return(0,co.mn)(On,Gt,Mo,null,(Ka,Ra,ns)=>{(0,co.mn)(zn,Lt,vi,null,(ja,Os,Xs)=>{Qn[ja].offs[Ka]=Ra+ns*Os,Qn[ja].size[Ka]=ns*Xs})}),Qn},Fn=(On,zn)=>{let Qn=Array.from({length:zn},()=>({offs:Array(On).fill(0),size:Array(On).fill(0)}));return(0,co.mn)(On,Gt,Mo,null,(Ka,Ra,ns)=>{(0,co.mn)(zn,Lt,vi,null,(ja,Os,Xs)=>{Qn[ja].offs[Ka]=Ra,Qn[ja].size[Ka]=ns})}),Qn};const xn=Et?Gi:mr,un=Et?ji:Yi;let Rn=[],Pn=[],ea=1,jn,la=W.text?.valueSize??ko,Ya=un,Ea=1/0,gs=1/0,ya=we!=null,_a=ya?{fill:{unit:3,values:(On,zn)=>Pn[zn].fill},stroke:{unit:3,values:(On,zn)=>Pn[zn].stroke}}:{},ra=ws.A.paths.bars({radius:Bt?0:Dt?(On,zn)=>zn===On.data.length-1?[wt,0]:[0,0]:wt,disp:{x0:{unit:2,values:(On,zn)=>Rn[zn].offs},size:{unit:2,values:(On,zn)=>Rn[zn].size},..._a},each:(On,zn,Qn,Ka,Ra,ns,ja)=>{Ka-=On.bbox.left,Ra-=On.bbox.top;let Os=On.data[zn][Qn];Et?(Ea=Math.min(Ea,Os<0?On.bbox.height-(Ra+ja):Ra),gs=ns):(Ea=ja,gs=Math.min(gs,Os<0?Ka:On.bbox.width-(Ka+ns)));let Xs={x:Ka,y:Ra,w:ns,h:ja,sidx:zn,didx:Qn};if(W.fullHighlight&&(W.xOri===St.Lt.Horizontal?(Xs.y=0,Xs.h=On.bbox.height):(Xs.x=0,Xs.w=On.bbox.width)),Qt.add(Xs),ct!==St.yL.Never){const no=Se(zn,Qn);let Ks=1;Bt&&Ca[zn][Qn]&&(Ks=Ca[zn][Qn]);const Jr=Ks===0?0:no/Ks,Bi=ke(zn,Jr);if(Ya=Math.min(Ya,Math.round(xn*(Et?ns:ja))),jn[Qn]===void 0&&(jn[Qn]={}),jn[Qn][zn]={text:Bi,value:Se(zn,Qn),hidden:!1},Tt){const{fontSize:Ro,textMetrics:ps}=ni(jn[Qn][zn].text,gs*(Et?Ho:1)-(Et?0:Ya),Ea*(Et?1:Ho)-(Et?Ya:0),1);jn[Qn][zn].textMetrics=ps;let nr=Math.round(Math.min(la,ko,Ro));ea=nr/la*(nr/14),la=nr}else jn[Qn][zn].textMetrics=(0,Zt.kD)(jn[Qn][zn].text,la);let Vl=Et?0:-Math.round(Qi*la),ho=Se(zn,Qn);if(W.negY?.[zn]&&ho!=null&&(ho*=-1),ho!=null){const Ro=On.bbox.left+(Et?Ka+ns/2:ho<0?Ka-Ya:Ka+ns+Ya),ps=On.bbox.top+(Et?ho<0?Ra+ja+Ya:Ra-Ya:Ra+ja/2-Vl),{textMetrics:nr={width:1,actualBoundingBoxAscent:1,actualBoundingBoxDescent:1}}=jn[Qn][zn];let Ui=0,Vo=0;Et?(Ui=nr.width*ea/2,Vo=ho>0?(nr.actualBoundingBoxAscent+nr.actualBoundingBoxDescent)*ea:0):(Vo=(nr.actualBoundingBoxAscent+nr.actualBoundingBoxDescent)*ea/2,Ui=ho<0?nr.width*ea:0),jn[Qn][zn].x=Ro,jn[Qn][zn].y=ps,jn[Qn][zn].bbox={x:Ro-Ui,y:ps-Vo,w:nr.width*ea,h:(nr.actualBoundingBoxAscent+nr.actualBoundingBoxDescent)*ea}}}}});const Hn=On=>{let zn=On.over;zn.style.overflow="hidden",On.root.querySelectorAll(".u-cursor-pt").forEach(Qn=>{Qn.style.borderRadius="0",W.fullHighlight&&(Qn.style.zIndex="-1")})},Wn={x:!1,y:!1,drag:{x:!1,y:!1},dataIdx:(On,zn)=>{if(zn===1){nn=null;let Qn=On.cursor.left*ws.A.pxRatio,Ka=On.cursor.top*ws.A.pxRatio;Qt.get(Qn,Ka,1,1,Ra=>{(0,To.ur)(Qn,Ka,Ra.x,Ra.y,Ra.x+Ra.w,Ra.y+Ra.h)&&(nn=Ra)})}return nn&&zn===nn.sidx?nn.didx:null},points:{fill:"rgba(255,255,255,0.4)",bbox:(On,zn)=>{let Qn=nn&&zn===nn.sidx;return{left:Qn?nn.x/ws.A.pxRatio:-10,top:Qn?nn.y/ws.A.pxRatio:-10,width:Qn?nn.w/ws.A.pxRatio:0,height:Qn?nn.h/ws.A.pxRatio:0}}}},_n=On=>{if(Qt=Qt||new To.C$(0,0,On.bbox.width,On.bbox.height),Qt.clear(),On.series.forEach(zn=>{zn._paths=null}),Dt?Rn=[null,...Fn(On.data[0].length,On.data.length-1)]:Rn=[null,...Bn(On.data[0].length,On.data.length-1)],ya){Pn=[null];for(let zn=1;zn<On.data.length;zn++){let Qn=On.data[zn].map((Ka,Ra)=>Ka!=null?we(zn,Ra,Ka):null);Pn.push({fill:it<1?Qn.map(Ka=>Ka!=null?(0,Wr.alpha)(Ka,it):null):Qn,stroke:Qn})}}jn={},la=W.text?.valueSize??ko,Ya=un,Ea=gs=1/0},oa=On=>{if(ct===St.yL.Never||la<ti)return;On.ctx.save(),On.ctx.fillStyle=se.colors.text.primary,On.ctx.font=`${la}px ${se.typography.fontFamily}`;let zn,Qn;for(const Ka in jn){let Ra=!0;for(const ns in jn[Ka]){const ja=jn[Ka][ns],{text:Os,x:Xs=0,y:no=0}=ja;let{value:Ks}=ja;W.negY?.[ns]&&Ks!=null&&(Ks*=-1);let Jr=Et?"center":Ks!==null&&Ks<0?"right":"left",Bi=Et?Ks!==null&&Ks<0?"top":"alphabetic":"middle";if(Jr!==zn&&(On.ctx.textAlign=zn=Jr),Bi!==Qn&&(On.ctx.textBaseline=Qn=Bi),ct===St.yL.Always)On.ctx.fillText(Os,Xs,no);else if(ct===St.yL.Auto){let{bbox:Vl}=ja,ho=!1;if(Vl==null)ho=!0,ja.hidden=!0;else if(!Ra)for(const Ro in jn[Ka]){if(Ro===ns)continue;const ps=jn[Ka][Ro],{bbox:nr,hidden:Ui}=ps;if(!Ui&&nr&&(0,To.HY)(Vl,nr)){ho=!0,ja.hidden=!0;break}}Ra=!1,!ho&&On.ctx.fillText(Os,Xs,no)}}}On.ctx.restore()},Ta=(On,zn,Qn,Ka)=>{nn?(On(nn.sidx),zn(nn.didx),Qn()):Qn(!0)};let Ca=null;function Aa(On,zn){return Ca=null,(0,qa.bq)(On[0],zn,({totals:Qn})=>{Ca=Qn})}return{cursor:Wn,xRange:bn,xValues:rn,xSplits:Jt,hFilter:In,barsBuilder:ra,init:Hn,drawClear:_n,draw:oa,interpolateTooltip:Ta,prepData:Aa}}const Hr={barRadius:0,barWidth:.97,fullHighlight:!1,groupWidth:.7,orientation:St.wV.Auto,showValue:St.yL.Auto,stacking:St.gs.None,xTickLabelRotation:0,xTickLabelSpacing:0},Gr={fillOpacity:80,gradientMode:St.on.None,lineWidth:1};function So(W){return W===bs.wV.Vertical?{xOri:St.Lt.Horizontal,xDir:St.ON.Right,yOri:St.Lt.Vertical,yDir:St.ON.Up}:{xOri:St.Lt.Vertical,xDir:St.ON.Down,yOri:St.Lt.Horizontal,yDir:St.ON.Right}}const si=({frame:W,theme:se,orientation:fe,showValue:Pe,groupWidth:Se,barWidth:we,barRadius:ke=0,stacking:Je,text:it,rawValue:ct,getColor:ht,fillOpacity:Et,allFrames:Tt,xTickLabelRotation:Dt,xTickLabelMaxLength:Bt,xTickLabelSpacing:Gt=0,legend:Lt,timeZone:wt,fullHighlight:Qt})=>{const nn=new xs.e,Jt=(ea,jn)=>(0,ds.cN)(W.fields[ea].display(jn)),In=(ea,jn)=>Tr(Jt(ea,jn),Bt),rn=So(fe);W.fields.length===2&&(Se=we,we=1);const bn={xOri:rn.xOri,xDir:rn.xDir,groupWidth:Se,barWidth:we,barRadius:ke,stacking:Je,rawValue:ct,getColor:ht,fillOpacity:Et,formatValue:Jt,formatShortValue:In,timeZone:wt,text:it,showValue:Pe,legend:Lt,xSpacing:Gt,xTimeAuto:W.fields[0]?.type===Yn.PU.time&&!W.fields[0].config.unit?.startsWith("time:"),negY:W.fields.map(ea=>ea.config.custom?.transform===St.NU.NegativeY),fullHighlight:Qt},Bn=ai(bn,se);if(nn.setCursor(Bn.cursor),nn.addHook("init",Bn.init),nn.addHook("drawClear",Bn.drawClear),nn.addHook("draw",Bn.draw),nn.setTooltipInterpolator(Bn.interpolateTooltip),Dt!==0){let ea=50,jn=rn.xOri===St.Lt.Horizontal?14:5;nn.setPadding(Ji(W,Dt,Bt,ea,jn))}nn.setPrepData(Bn.prepData),nn.addScale({scaleKey:"x",isTime:!1,range:Bn.xRange,distribution:St.L4.Ordinal,orientation:rn.xOri,direction:rn.xDir});const Fn=W.fields[0].config.custom?.axisPlacement!==St.vM.Hidden?rn.xOri===St.Lt.Horizontal?St.vM.Bottom:St.vM.Left:St.vM.Hidden,xn=W.fields[0].config.custom?.axisPlacement!==St.vM.Hidden;nn.addAxis({scaleKey:"x",isTime:!1,placement:Fn,label:W.fields[0].config.custom?.axisLabel,splits:Bn.xSplits,filter:rn.xOri===0?Bn.hFilter:void 0,values:Bn.xValues,timeZone:wt,grid:{show:!1},ticks:{show:!1},gap:15,tickLabelRotation:rn.xOri===0?Dt*-1:0,theme:se,show:xn});let un=0;const Rn=Ni(Lt);for(let ea=1;ea<W.fields.length;ea++){const jn=W.fields[ea];un++;const la={...Gr,...jn.config.custom},Ya=jn.config.unit||lo.s,Ea=(0,Vs.Qi)(jn),ya=(0,Vs.lz)(jn,se).color;let _a=la.axisSoftMin,ra=la.axisSoftMax;if(_a==null&&jn.config.min==null&&(_a=0),ra==null&&jn.config.max==null&&(ra=0),la.thresholdsStyle&&jn.config.thresholds&&(la.thresholdsStyle.mode??St.Ly.Off)!==St.Ly.Off&&nn.addThresholds({config:la.thresholdsStyle,thresholds:jn.config.thresholds,scaleKey:Ya,theme:se,hardMin:jn.config.min,hardMax:jn.config.max,softMin:la.axisSoftMin,softMax:la.axisSoftMax}),nn.addSeries({scaleKey:Ya,pxAlign:!0,lineWidth:la.lineWidth,lineColor:ya,fillOpacity:la.fillOpacity,theme:se,colorMode:Ea,pathBuilder:Bn.barsBuilder,show:!la.hideFrom?.viz,gradientMode:la.gradientMode,thresholds:jn.config.thresholds,hardMin:jn.config.min,hardMax:jn.config.max,softMin:la.axisSoftMin,softMax:la.axisSoftMax,dataFrameFieldIndex:{fieldIndex:Rn?ea:Tt[0].fields.findIndex(Hn=>Hn.type===Yn.PU.number&&Hn.state?.seriesIndex===un-1),frameIndex:0}}),nn.addScale({scaleKey:Ya,min:jn.config.min,max:jn.config.max,softMin:_a,softMax:ra,centeredZero:la.axisCenteredZero,orientation:rn.yOri,direction:rn.yDir,distribution:la.scaleDistribution?.type,log:la.scaleDistribution?.log}),la.axisPlacement!==St.vM.Hidden){let Hn=la.axisPlacement;(!Hn||Hn===St.vM.Auto)&&(Hn=St.vM.Left),rn.xOri===1&&(Hn===St.vM.Left&&(Hn=St.vM.Bottom),Hn===St.vM.Right&&(Hn=St.vM.Top));let Wn={scaleKey:Ya,label:la.axisLabel,size:la.axisWidth,placement:Hn,formatValue:(_n,oa)=>(0,ds.cN)(jn.display(_n,oa)),filter:rn.yOri===0?Bn.hFilter:void 0,tickLabelRotation:rn.xOri===1?Dt*-1:0,theme:se,grid:{show:la.axisGridShow}};la.axisBorderShow&&(Wn.border={show:!0}),la.axisColorMode===St.Y$.Series&&(Wn.color=ya),nn.addAxis(Wn)}}let Pn=(0,qa.ro)(W);return nn.setStackingGroups(Pn),nn};function Tr(W,se){return W.length>se?W.substring(0,se).concat("..."):W}function Ji(W,se,fe,Pe=0,Se=0){const we=W.fields[0].values,ke=vn.pi,Je=W.fields[0].display,it=Dt=>Je?Je(we[Dt]):we[Dt];let ct=0;for(let Dt=0;Dt<we.length;Dt++){let Bt=(0,Zt.kD)(Tr((0,ds.cN)(it(Dt)),fe),ke);ct=Bt.width>ct?Bt.width:ct}const ht=se>0?Math.cos(se*Math.PI/180)*(0,Zt.kD)(Tr((0,ds.cN)(it(we.length-1)),fe),ke).width:0,Et=se<0?Math.cos(se*-1*Math.PI/180)*(0,Zt.kD)(Tr((0,ds.cN)(it(0)),fe),ke).width:0,Tt=Math.sin((se>=0?se:se*-1)*Math.PI/180)*ct-Se;return[Math.round(vn.pi*ws.A.pxRatio),ht,Tt,Math.max(0,Et-Pe)]}function Xi(W,se,fe){if(!W.length||W.every(Et=>Et.length===0))return{warn:"No data in response"};(0,Za.Fm)(W);const Pe=W.length===1?(0,kr.Yj)(W[0],W[0].fields.findIndex(Et=>Et.type===Yn.PU.time)):(0,kr.Fd)({frames:W});if(!Pe)return{warn:"Unable to join data"};let Se;if(fe.colorByField&&(Se=(0,Qs.findField)(Pe,fe.colorByField),!Se))return{warn:"Color field not found"};let we;if(fe.xField&&(we=(0,Qs.findField)(Pe,fe.xField),!we))return{warn:"Configured x field not found"};let ke,Je,it=[];for(const Et of Pe.fields)if(Et!==we)switch(Et.type){case Yn.PU.string:ke||(ke=Et);break;case Yn.PU.time:Je||(Je=Et);break;case Yn.PU.number:{const Tt={...Et,state:{...Et.state,seriesIndex:it.length},config:{...Et.config,custom:{...Et.config.custom,stacking:{group:"_",mode:fe.stacking}}},values:Et.values.map(Dt=>Number.isFinite(Dt)||Dt==null?Dt:null)};fe.stacking===St.gs.Percent&&(Tt.config.unit="percentunit",Tt.display=(0,ha.J)({field:Tt,theme:se})),it.push(Tt)}}let ct=we;if(ct||(ct=ke||Je),!ct)return{warn:"Bar charts requires a string or time field"};if(!it.length)return{warn:"No numeric fields found"};if(Se&&it.length>1){const Et=it.find(Tt=>Tt!==Se);Et&&(it=[Et])}let ht=(0,$e.cloneDeep)(it);return fe.stacking===St.gs.Percent&&ht.map(Et=>{const Tt=Pe.fields.find(Dt=>(0,Za.Ct)(Dt,Pe)===(0,Za.Ct)(Dt,Pe));Et.config.unit=Tt?.config?.unit??void 0,Et.display=(0,ha.J)({field:Et,theme:se})}),it.unshift(ct),ht.unshift(ct),{aligned:Pe,colorByField:Se,viz:[{fields:it,length:ct.values.length}],legend:{fields:ht,length:ct.values.length}}}const Ni=W=>!!(W?.sortBy&&W.sortDesc!==null),Zi=10,yl=["orientation","barWidth","barRadius","xTickLabelRotation","xTickLabelMaxLength","xTickLabelSpacing","groupWidth","stacking","showValue","xField","colorField","legend",(W,se)=>se.text?.valueSize===W.text?.valueSize],Dl=({data:W,options:se,fieldConfig:fe,width:Pe,height:Se,timeZone:we,id:ke})=>{const Je=(0,k.$j)(),{eventBus:it}=(0,sn.d2)(),ct=(0,P.useRef)(void 0),ht=(0,P.useRef)(!1),[Et,Tt]=(0,P.useState)(void 0),[Dt,Bt]=(0,P.useState)(null),[Gt,Lt]=(0,P.useState)(null),[wt,Qt]=(0,P.useState)(null),[nn,Jt]=(0,P.useState)(!1),[In,rn]=(0,P.useState)(!1),bn=()=>{ht.current=!1,Bt(null),rn(!1)},Bn=()=>{ht.current=!ht.current,rn(ht.current)},Fn=(0,P.useRef)(),xn=(0,P.useRef)(),un=(0,P.useMemo)(()=>Xi(W.series,Je,se),[W.series,Je,se]),Rn="viz"in un?un:null;xn.current=Rn?.colorByField;const Pn=(0,P.useRef)(1e4);(0,P.useMemo)(()=>{Pn.current++},[se]);const ea=(0,P.useMemo)(()=>{const Hn=Rn?.viz[0],Wn=Fn.current;return Hn&&Wn&&(0,Ot.bW)(Hn,Wn,!0)||Pn.current++,Fn.current=Hn,(W.structureRev??0)+Pn.current},[Rn,W.structureRev]),jn=(0,P.useMemo)(()=>!se.orientation||se.orientation===bs.wV.Auto?Pe<Se?bs.wV.Horizontal:bs.wV.Vertical:se.orientation,[Pe,Se,se.orientation]),la=(0,P.useMemo)(()=>{if(se.xTickLabelMaxLength)return se.xTickLabelMaxLength;{const Hn=se.xTickLabelRotation,Wn=(0,Zt.kD)("M",vn.pi).width;return Se/2/(Math.sin((Hn>=0?Hn:Hn*-1)*Math.PI/180)*Wn)-3}},[Se,se.xTickLabelRotation,se.xTickLabelMaxLength]);if("warn"in un)return P.createElement($t.a,{panelId:ke,fieldConfig:fe,data:W,message:un.warn,needsNumberField:!0});const Ya=(Hn,Wn,_n)=>{const oa=Wn==null?null:Hn.fields[Wn];if(oa){const Aa=(0,Za.Ct)(oa,Hn);Wn=un.aligned.fields.findIndex(On=>Aa===(0,Za.Ct)(On,un.aligned))}const Ta=se.fullHighlight&&se.stacking!==St.gs.None?St.$N.Multi:se.tooltip.mode,Ca=se.tooltip.mode===St.$N.Multi?se.tooltip.sort:St.xB.None;return P.createElement(P.Fragment,null,In&&P.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},P.createElement(Ys.J,{onClick:bn,style:{position:"relative",top:"auto",right:"auto",marginRight:0}})),P.createElement(zr.e,{data:un.aligned,rowIndex:_n,columnIndex:Wn,sortOrder:Ca,mode:Ta}))},Ea=Hn=>{const{legend:Wn}=se;if(!Hn||Wn.showLegend===!1)return null;if(un.colorByField){const _n=(0,vs.jY)([un.colorByField],Je);if(_n?.length)return P.createElement(wn.KU.Legend,{placement:Wn.placement},P.createElement(kn.t,{placement:Wn.placement,items:_n,displayMode:Wn.displayMode}))}return P.createElement(ua.$,{data:[un.legend],config:Hn,maxHeight:"35%",maxWidth:"60%",...se.legend})},gs=(Hn,Wn)=>Fn.current.fields[Hn].values[Wn];let ya,_a=1;if(un.colorByField){const Hn=un.colorByField,Wn=Hn.display;_a=(Hn.config.custom.fillOpacity??100)/100,ya=(_n,oa)=>Wn(xn.current?.values[oa]).color}else Fn.current.fields.some(Wn=>Wn.config.custom?.gradientMode===St.on.Scheme&&Wn.config.color?.mode===Ss.Y.Thresholds||Wn.config.mappings?.some(oa=>oa.type==="value"?Object.values(oa.options).some(Ta=>Ta.color!=null):oa.options.result.color!=null))&&(_a=(Fn.current.fields.find(_n=>_n.type===Yn.PU.number).config.custom.fillOpacity??100)/100,ya=(_n,oa)=>{let Ta=Fn.current.fields[_n];return Ta.display(Ta.values[oa]).color});const ra=(Hn,Wn,_n)=>{const{barWidth:oa,barRadius:Ta=0,showValue:Ca,groupWidth:Aa,stacking:On,legend:zn,tooltip:Qn,text:Ka,xTickLabelRotation:Ra,xTickLabelSpacing:ns,fullHighlight:ja}=se;return si({frame:Hn,getTimeRange:_n,timeZone:we,theme:Je,timeZones:[we],eventBus:it,orientation:jn,barWidth:oa,barRadius:Ta,showValue:Ca,groupWidth:Aa,xTickLabelRotation:Ra,xTickLabelMaxLength:la,xTickLabelSpacing:ns,stacking:On,legend:zn,tooltip:Qn,text:Ka,rawValue:gs,getColor:ya,fillOpacity:_a,allFrames:un.viz,fullHighlight:ja})};return P.createElement(sr.o,{theme:Je,frames:un.viz,prepConfig:ra,propsToDiff:yl,preparePlotFrame:Hn=>Hn[0],renderLegend:Ea,legend:se.legend,timeZone:we,timeRange:{from:1,to:1},structureRev:ea,width:Pe,height:Se},Hn=>(ct.current!==Hn&&(ct.current=Ha({config:Hn,onUPlotClick:Bn,setFocusedSeriesIdx:Lt,setFocusedPointIdx:Qt,setCoords:Bt,setHover:Tt,isToolTipOpen:ht,isActive:nn,setIsActive:Jt})),se.tooltip.mode===St.$N.None?null:P.createElement(ma.ZL,null,Et&&Dt&&Gt&&P.createElement(Qa.o,{position:{x:Dt.viewport.x,y:Dt.viewport.y},offset:{x:Zi,y:Zi},allowPointerEvents:ht.current},Ya(un.viz[0],Gt,wt)))))};var qr=e(66864),vr=e(94354),wi=e(10880);const Ei=[{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"}],Pl=W=>{let se=W.value??0;const fe=se<0;fe&&(se*=-1);let Pe=Ei[0];for(const ke of Ei)if(Pe=ke,se<=Pe.value)break;const Se=ke=>{W.onChange(ke*(fe?-1:1))},we=()=>{W.onChange(W.value*-1)};return P.createElement(qr.Gy,null,P.createElement(vr.z,{value:Pe.value,options:Ei,onChange:Se}),se!==0&&P.createElement(Lo.m,{content:"Require space from the right side",placement:"top"},P.createElement("div",null,P.createElement(wi.S,{value:fe,onChange:we,label:"RTL"}))))};var es=e(38824);class Go{getListWithDefaults(se){return se.getListAppender({name:es.m.BarChart,pluginId:"barchart",options:{showValue:St.yL.Never,legend:{calcs:[],displayMode:St.lm.List,showLegend:!0,placement:"right"}},fieldConfig:{defaults:{unit:"short",custom:{}},overrides:[]},cardOptions:{previewModifier:fe=>{fe.options.barWidth=.8}}})}getSuggestionsForData(se){const fe=this.getListWithDefaults(se),{dataSummary:Pe}=se;Pe.frameCount===1&&(!Pe.hasNumberField||!Pe.hasStringField||Pe.rowCountTotal>50||(fe.append({name:es.m.BarChart}),Pe.numberFieldCount>1&&(fe.append({name:es.m.BarChartStacked,options:{stacking:St.gs.Normal}}),fe.append({name:es.m.BarChartStackedPercent,options:{stacking:St.gs.Percent}})),fe.append({name:es.m.BarChartHorizontal,options:{orientation:bs.wV.Horizontal}}),Pe.numberFieldCount>1&&(fe.append({name:es.m.BarChartHorizontalStacked,options:{stacking:St.gs.Normal,orientation:bs.wV.Horizontal}}),fe.append({name:es.m.BarChartHorizontalStackedPercent,options:{orientation:bs.wV.Horizontal,stacking:St.gs.Percent}}))))}}const Bo=new L.m(Dl).useFieldConfig({standardOptions:{[$s.uo.Color]:{settings:{byValueSupport:!0,preferThresholdsMode:!1},defaultValue:{mode:Ss.Y.PaletteClassic}}},useCustomConfig:W=>{const se=Gr;W.addSliderInput({path:"lineWidth",name:"Line width",defaultValue:se.lineWidth,settings:{min:0,max:10,step:1}}).addSliderInput({path:"fillOpacity",name:"Fill opacity",defaultValue:se.fillOpacity,settings:{min:0,max:100,step:1}}).addRadio({path:"gradientMode",name:"Gradient mode",defaultValue:oo.t.fillGradient[0].value,settings:{options:oo.t.fillGradient}}),W.addSelect({category:["Graph styles"],name:"Transform",path:"transform",settings:{options:[{label:"Constant",value:St.NU.Constant,description:"The first value will be shown as a constant line"},{label:"Negative Y",value:St.NU.NegativeY,description:"Flip the results to negative values on the y axis"}],isClearable:!0},hideFromDefaults:!0}),W.addCustomEditor({id:"thresholdsStyle",path:"thresholdsStyle",name:"Show thresholds",category:["Thresholds"],defaultValue:{mode:St.Ly.Off},settings:{options:oo.t.thresholdsDisplayModes},editor:bo.D,override:bo.D,process:ro.hS,shouldApply:()=>!0}),vo.r(W,se,!1),io.e(W)}}).setPanelOptions((W,se)=>{const fe=Xi(se.data,R.$.theme2,se.options??{});let Pe="First string or time field";const Se="viz"in fe?fe.viz[0]:void 0;if(Se?.fields?.length){const we=Se.fields[0];Pe+=` (${(0,Za.Ct)(we,Se)})`}W.addFieldNamePicker({path:"xField",name:"X Axis",settings:{placeholderText:Pe}}).addRadio({path:"orientation",name:"Orientation",settings:{options:[{value:bs.wV.Auto,label:"Auto"},{value:bs.wV.Horizontal,label:"Horizontal"},{value:bs.wV.Vertical,label:"Vertical"}]},defaultValue:Hr.orientation}).addSliderInput({path:"xTickLabelRotation",name:"Rotate x-axis tick labels",defaultValue:Hr.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:we=>we.xTickLabelRotation!==0}).addCustomEditor({id:"xTickLabelSpacing",path:"xTickLabelSpacing",name:"X-axis labels minimum spacing",defaultValue:Hr.xTickLabelSpacing,editor:Pl}).addRadio({path:"showValue",name:"Show values",settings:{options:[{value:St.yL.Auto,label:"Auto"},{value:St.yL.Always,label:"Always"},{value:St.yL.Never,label:"Never"}]},defaultValue:Hr.showValue}).addRadio({path:"stacking",name:"Stacking",settings:{options:oo.t.stacking},defaultValue:Hr.stacking}).addSliderInput({path:"groupWidth",name:"Group width",defaultValue:Hr.groupWidth,settings:{min:0,max:1,step:.01},showIf:(we,ke)=>we.stacking&&we.stacking!==St.gs.None?!1:qi(ke)!==1}).addSliderInput({path:"barWidth",name:"Bar width",defaultValue:Hr.barWidth,settings:{min:0,max:1,step:.01}}).addSliderInput({path:"barRadius",name:"Bar radius",defaultValue:Hr.barRadius,settings:{min:0,max:.5,step:.05}}).addBooleanSwitch({path:"fullHighlight",name:"Highlight full area on hover",defaultValue:Hr.fullHighlight}),W.addFieldNamePicker({path:"colorByField",name:"Color by field",description:"Use the color value for a sibling field to color each bar value."}),(!se.options?.fullHighlight||se.options?.stacking===St.gs.None)&&ur.D(W),Fr.H(W),Co.I(W,!1)}).setSuggestionsSupplier(new Go);function qi(W){let se=0;if(W)for(const fe of W)for(const Pe of fe.fields)Pe.type===Yn.PU.number&&se++;return se}var el=e(63250),jo=e(23799);const Cl=W=>(0,el._$)(W);var yi=e(58384),uo=e(17516);class Fi{getSuggestionsForData(se){const{dataSummary:fe}=se;if(!fe.hasData||!fe.hasNumberField)return;const Pe=se.getListAppender({name:"",pluginId:"bargauge",options:{},fieldConfig:{defaults:{custom:{}},overrides:[]}});fe.numberFieldCount>50||(fe.hasStringField&&fe.frameCount===1&&fe.rowCountTotal<30?(Pe.append({name:es.m.BarGaugeBasic,options:{reduceOptions:{values:!0,calcs:[]},displayMode:St.eX.Basic,orientation:bs.wV.Horizontal},fieldConfig:{defaults:{color:{mode:"continuous-GrYlRd"}},overrides:[]}}),Pe.append({name:es.m.BarGaugeLCD,options:{reduceOptions:{values:!0,calcs:[]},displayMode:St.eX.Lcd,orientation:bs.wV.Horizontal},fieldConfig:{defaults:{color:{mode:"continuous-GrYlRd"}},overrides:[]}})):(Pe.append({name:es.m.BarGaugeBasic,options:{displayMode:St.eX.Basic,orientation:bs.wV.Horizontal,reduceOptions:{values:!1,calcs:["lastNotNull"]}},fieldConfig:{defaults:{color:{mode:"continuous-GrYlRd"}},overrides:[]}}),Pe.append({name:es.m.BarGaugeLCD,options:{displayMode:St.eX.Lcd,orientation:bs.wV.Horizontal,reduceOptions:{values:!1,calcs:["lastNotNull"]}},fieldConfig:{defaults:{color:{mode:"continuous-GrYlRd"}},overrides:[]}})))}}const tl=new L.m(yi.d).useFieldConfig().setPanelOptions(W=>{(0,jo.L)(W),(0,jo.h)(W),Co.I(W),W.addRadio({path:"displayMode",name:"Display mode",settings:{options:[{value:St.eX.Gradient,label:"Gradient"},{value:St.eX.Lcd,label:"Retro LCD"},{value:St.eX.Basic,label:"Basic"}]},defaultValue:uo.K.displayMode}).addRadio({path:"valueMode",name:"Value display",settings:{options:[{value:St.$l.Color,label:"Value color"},{value:St.$l.Text,label:"Text color"},{value:St.$l.Hidden,label:"Hidden"}]},defaultValue:uo.K.valueMode}).addRadio({path:"namePlacement",name:"Name placement",settings:{options:[{value:St.TZ.Auto,label:"Auto"},{value:St.TZ.Top,label:"Top"},{value:St.TZ.Left,label:"Left"}]},defaultValue:uo.K.namePlacement,showIf:se=>se.orientation!==bs.wV.Vertical}).addBooleanSwitch({path:"showUnfilled",name:"Show unfilled area",description:"When enabled renders the unfilled region as gray",defaultValue:uo.K.showUnfilled,showIf:se=>se.displayMode!=="lcd"}).addRadio({path:"sizing",name:"Bar size",settings:{options:[{value:St.T6.Auto,label:"Auto"},{value:St.T6.Manual,label:"Manual"}]},defaultValue:uo.K.sizing}).addSliderInput({path:"minVizWidth",name:"Min width",description:"Minimum column width (vertical orientation)",defaultValue:uo.K.minVizWidth,settings:{min:0,max:300,step:1},showIf:se=>se.sizing===St.T6.Manual&&(se.orientation===bs.wV.Auto||se.orientation===bs.wV.Vertical)}).addSliderInput({path:"minVizHeight",name:"Min height",description:"Minimum row height (horizontal orientation)",defaultValue:uo.K.minVizHeight,settings:{min:0,max:300,step:1},showIf:se=>se.sizing===St.T6.Manual&&(se.orientation===bs.wV.Auto||se.orientation===bs.wV.Horizontal)}).addSliderInput({path:"maxVizHeight",name:"Max height",description:"Maximum row height (horizontal orientation)",defaultValue:uo.K.maxVizHeight,settings:{min:0,max:300,step:1},showIf:se=>se.sizing===St.T6.Manual&&(se.orientation===bs.wV.Auto||se.orientation===bs.wV.Horizontal)})}).setPanelChangeHandler(el.gl).setMigrationHandler(Cl).setSuggestionsSupplier(new Fi);var mo=e(41706),Wi=e(90708),fr=e(77455),Eo=e(10175),eo=e(74863),xo=e(55129);const fo=new Set(["bytes","bits","kbytes","mbytes","gbytes","tbytes","pbytes","binBps","binbps","KiBs","Kibits","MiBs","Mibits","GiBs","Gibits","TiBs","Tibits","PiBs","Pibits"]),Ki=Array(53);for(let W=0;W<Ki.length;W++)Ki[W]=2**W;const bl=(W,se=1)=>W==null?"-":W.toFixed(se),ri={drawStyle:St.GR.Line,showPoints:St.yL.Auto,axisPlacement:St.vM.Auto},Uo=({frame:W,theme:se,timeZones:fe,getTimeRange:Pe,eventBus:Se,sync:we,allFrames:ke,renderers:Je,tweakScale:it=Tt=>Tt,tweakAxis:ct=Tt=>Tt,eventsScope:ht="__global_",hoverProximity:Et})=>{const Tt=new xs.e(fe[0]);let Dt;Tt.setPrepData(xn=>(Dt=xn[0],(0,qa.bq)(xn[0],Tt.getStackingGroups())));const Bt=W.fields[0];if(!Bt)return Tt;const Gt="x";let Lt="_x",wt="";const Qt=Bt.config.custom?.axisPlacement!==St.vM.Hidden?St.vM.Bottom:St.vM.Hidden,nn=Bt.config.custom?.axisPlacement!==St.vM.Hidden;if(Bt.type===Yn.PU.time){Lt="time",Tt.addScale({scaleKey:Gt,orientation:St.Lt.Horizontal,direction:St.ON.Right,isTime:!0,range:()=>{const un=Pe();return[un.from.valueOf(),un.to.valueOf()]}});const xn=fe.length>1?(un,Rn)=>Rn.map((Pn,ea)=>ea<2?null:Pn):void 0;for(let un=0;un<fe.length;un++){const Rn=fe[un];Tt.addAxis({scaleKey:Gt,isTime:!0,placement:Qt,show:nn,label:Bt.config.custom?.axisLabel,timeZone:Rn,theme:se,grid:{show:un===0&&Bt.config.custom?.axisGridShow},filter:xn})}fe.length>1&&Tt.addHook("drawAxes",un=>{un.ctx.save(),un.ctx.fillStyle=se.colors.text.primary,un.ctx.textAlign="left",un.ctx.textBaseline="bottom";let Rn=0;un.axes.forEach(Pn=>{if(Pn.side===2){let ea=Pn._pos+Pn._size;un.ctx.fillText(fe[Rn],un.bbox.left,ea*ws.A.pxRatio),Rn++}}),un.ctx.restore()})}else Bt.config.unit&&(Lt=Bt.config.unit),Tt.addScale({scaleKey:Gt,orientation:St.Lt.Horizontal,direction:St.ON.Right,range:(xn,un,Rn)=>[Bt.config.min??un,Bt.config.max??Rn]}),Tt.addAxis({scaleKey:Gt,placement:Qt,show:nn,label:Bt.config.custom?.axisLabel,theme:se,grid:{show:Bt.config.custom?.axisGridShow},formatValue:(xn,un)=>(0,ds.cN)(Bt.display(xn,un))});let Jt=Je?.flatMap(xn=>Object.values(xn.fieldMap).filter(un=>xn.indicesOnly.indexOf(un)===-1))??[],In;for(let xn=1;xn<W.fields.length;xn++){const un=W.fields[xn],Rn={...un.config,custom:{...ri,...un.config.custom}},Pn=Rn.custom;if(un===Bt||un.type!==Yn.PU.number&&un.type!==Yn.PU.enum)continue;let ea=un.display??bl;un.config.custom?.stacking?.mode===St.gs.Percent&&(ea=(0,ha.J)({field:{...un,config:{...un.config,unit:"percentunit"}},theme:se}));const jn=(0,xo.M)(Rn,un.type),la=(0,Vs.Qi)(un),Ea=(0,Vs.lz)(un,se).color;if(Tt.addScale(it({scaleKey:jn,orientation:St.Lt.Vertical,direction:St.ON.Up,distribution:Pn.scaleDistribution?.type,log:Pn.scaleDistribution?.log,linearThreshold:Pn.scaleDistribution?.linearThreshold,min:un.config.min,max:un.config.max,softMin:Pn.axisSoftMin,softMax:Pn.axisSoftMax,centeredZero:Pn.axisCenteredZero,range:Pn.stacking?.mode===St.gs.Percent?(_n,oa,Ta)=>(oa=oa<0?-1:0,Ta=Ta>0?1:0,[oa,Ta]):un.type===Yn.PU.enum?(_n,oa,Ta)=>[-1,un.config.type.enum.text.length]:void 0,decimals:un.config.decimals},un)),wt||(wt=jn),Pn.axisPlacement!==St.vM.Hidden){let _n;Pn.axisColorMode===St.Y$.Series&&(la.isByValue&&un.config.custom?.gradientMode===St.on.Scheme&&la.id===Ss.Y.Thresholds?_n=(0,eo.pl)(1,se,la,un.config.thresholds):_n=Ea);const oa={border:{show:Pn.axisBorderShow||!1,width:1/devicePixelRatio,stroke:_n||se.colors.text.primary},ticks:{show:Pn.axisBorderShow||!1,stroke:_n||se.colors.text.primary},color:_n||se.colors.text.primary};let Ta,Ca,Aa;if(fo.has(Rn.unit))Ta=Ki;else if(un.type===Yn.PU.enum){let On=un.config.type.enum.text;Aa=On.map((zn,Qn)=>Qn),Ca=On}Tt.addAxis(ct({scaleKey:jn,label:Pn.axisLabel,size:Pn.axisWidth,placement:Pn.axisPlacement??St.vM.Auto,formatValue:(On,zn)=>(0,ds.cN)(ea(On,zn)),theme:se,grid:{show:Pn.axisGridShow},decimals:un.config.decimals,distr:Pn.scaleDistribution?.type,splits:Aa,values:Ca,incrs:Ta,...oa},un))}const gs=Pn.drawStyle===St.GR.Points?St.yL.Always:Pn.showPoints;let ya=()=>null;Pn.spanNulls!==!0&&(ya=(_n,oa,Ta,Ca)=>{let Aa=[],On=_n.series[oa];if(!Ta&&Ca&&Ca.length){const[zn,Qn]=On.idxs,Ka=_n.data[0],Ra=_n.data[oa],ns=Math.round(_n.valToPos(Ka[zn],"x",!0)),ja=Math.round(_n.valToPos(Ka[Qn],"x",!0));Ca[0][0]===ns&&Aa.push(zn);for(let Os=0;Os<Ca.length;Os++){let Xs=Ca[Os],no=Ca[Os+1];if(no&&Xs[1]===no[0]){let Ks=_n.posToIdx(Xs[1],!0);if(Ra[Ks]==null)for(let Jr=1;Jr<100;Jr++){if(Ra[Ks+Jr]!=null){Ks+=Jr;break}if(Ra[Ks-Jr]!=null){Ks-=Jr;break}}Aa.push(Ks)}}Ca[Ca.length-1][1]===ja&&Aa.push(Qn)}return Aa.length?Aa:null});let{fillOpacity:_a}=Pn,ra=null,Hn=null;if(un.state?.origin){In||(In=$i(W,ke));const _n=ke[un.state.origin.frameIndex],oa=_n?.fields[un.state.origin.fieldIndex],Ta=(0,Za.Ct)(oa??un,_n,ke);if(Jt.indexOf(Ta)>=0)ra=()=>null,Hn=()=>{};else if(Pn.transform===St.NU.Constant){const Ca=ws.A.paths.linear();ra=(Aa,On)=>{const zn=Aa._data,Qn=Pe();let Ka=[Qn.from.valueOf(),Qn.to.valueOf()],Ra=zn[On].find(Os=>Os!=null),ns=[Ra,Ra],ja=zn.slice();return ja[0]=Ka,ja[On]=ns,Ca({...Aa,_data:ja},On,0,1)}}if(Pn.fillBelowTo){const Ca=W.fields.find(Qn=>Pn.fillBelowTo===Qn.name||Pn.fillBelowTo===Qn.config?.displayNameFromDS||Pn.fillBelowTo===(0,Za.Ct)(Qn,W,ke)),Aa=Ca?(0,Za.Ct)(Ca,W,ke):Pn.fillBelowTo,On=In.get(Ta),zn=In.get(Aa);(0,$e.isNumber)(zn)&&(0,$e.isNumber)(On)?(Tt.addBand({series:[On,zn],fill:void 0}),_a||(_a=35)):_a=0}}let Wn;la.id===Ss.Y.Thresholds&&(Wn=_n=>(0,Vs.lz)(Dt.fields[_n],se).color),Tt.addSeries({pathBuilder:ra,pointsBuilder:Hn,scaleKey:jn,showPoints:gs,pointsFilter:ya,colorMode:la,fillOpacity:_a,theme:se,dynamicSeriesColor:Wn,drawStyle:Pn.drawStyle,lineColor:Pn.lineColor??Ea,lineWidth:Pn.lineWidth,lineInterpolation:Pn.lineInterpolation,lineStyle:Pn.lineStyle,barAlignment:Pn.barAlignment,barWidthFactor:Pn.barWidthFactor,barMaxWidth:Pn.barMaxWidth,pointSize:Pn.pointSize,spanNulls:Pn.spanNulls||!1,show:!Pn.hideFrom?.viz,gradientMode:Pn.gradientMode,thresholds:Rn.thresholds,hardMin:un.config.min,hardMax:un.config.max,softMin:Pn.axisSoftMin,softMax:Pn.axisSoftMax,dataFrameFieldIndex:un.state?.origin}),Pn.thresholdsStyle&&Rn.thresholds&&(Pn.thresholdsStyle.mode??St.Ly.Off)!==St.Ly.Off&&Tt.addThresholds({config:Pn.thresholdsStyle,thresholds:Rn.thresholds,scaleKey:jn,theme:se,hardMin:un.config.min,hardMax:un.config.max,softMin:Pn.axisSoftMin,softMax:Pn.axisSoftMax})}let rn=(0,qa.ro)(W);Tt.setStackingGroups(rn),Je?.forEach(xn=>{In||(In=$i(W,ke));let un={};for(let Rn in xn.fieldMap){let Pn=xn.fieldMap[Rn];un[Rn]=In.get(Pn)}xn.init(Tt,un)}),Tt.scaleKeys=[Gt,wt];const bn=15;let Fn={hover:{prox:(xn,un,Rn)=>Et??(xn.data[un][Rn]===null?bn:null),skip:[null]},focus:{prox:Et??30}};if(we&&we()!==za.y.Off&&Bt.type===Yn.PU.time){const xn={point:{[Gt]:null,[wt]:null},data:W},un=new is.b_(xn).setTags(["uplot"]),Rn=new is.ql().setTags(["uplot"]);Fn.sync={key:ht,filters:{pub:(Pn,ea,jn,la,Ya,Ea,gs)=>we&&we()===za.y.Off?!1:(xn.rowIndex=gs,jn<0&&la<0?Se.publish(Rn):(xn.point[Lt]=ea.posToVal(jn,Gt),xn.point[wt]=ea.posToVal(la,wt),xn.point.panelRelY=la>0?la/Ea:1,Se.publish(un),un.payload.down=void 0),!0)},scales:[Gt,null]}}return Tt.setSync(),Tt.setCursor(Fn),Tt};function $i(W,se){const fe=new Map;return W.fields.forEach((Pe,Se)=>{const we=Pe.state?.origin;if(we){const ke=se[we.frameIndex]?.fields[we.fieldIndex];ke&&fe.set((0,Za.Ct)(ke,se[we.frameIndex],se),Se)}}),fe}const Tl=["legend","options","theme"];class nl extends P.Component{constructor(){super(...arguments),this.prepConfig=(se,fe,Pe)=>{const{eventBus:Se,eventsScope:we,sync:ke}=this.context,{theme:Je,timeZone:it,options:ct,renderers:ht,tweakAxis:Et,tweakScale:Tt}=this.props;return Uo({frame:se,theme:Je,timeZones:Array.isArray(it)?it:[it],getTimeRange:Pe,eventBus:Se,sync:ke,allFrames:fe,renderers:ht,tweakScale:Tt,tweakAxis:Et,eventsScope:we,hoverProximity:ct?.tooltip?.hoverProximity})},this.renderLegend=se=>{const{legend:fe,frames:Pe}=this.props;return!se||fe&&!fe.showLegend||!(0,ua.t)(se,Pe)?null:P.createElement(ua.$,{data:Pe,config:se,...fe})}}render(){return P.createElement(sr.o,{...this.props,prepConfig:this.prepConfig,propsToDiff:Tl,renderLegend:this.renderLegend})}}nl.contextType=sn.e4;const Di=(0,k.cV)(nl);Di.displayName="TimeSeries";var No=e(22731),Vi=e(1604),Yo=e(18491),Ze=e(36376),et=e(24284);const tt=W=>se=>{const fe=W.visualization.getColorByName(se?.color||et.Mk);return{markerTriangle:(0,K.css)` width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 4px solid ${fe}; `,markerBar:(0,K.css)` display: block; width: calc(100%); height: 5px; background: ${fe}; `}};var dt=e(5805),xt=e(37151),Wt=e(51253),Vt=e(88575),en=e(21744),dn=e(16504),yn=e(99818),Vn=e(10154);const aa=P.forwardRef(({annotation:W,onSave:se,onDismiss:fe,timeFormatter:Pe,className:Se,...we},ke)=>{const Je=(0,k.of)(Gn),it=(0,sn.d2)(),ct=(0,P.useRef)(null);(0,xt.A)(ct,()=>{fe()});const[ht,Et]=(0,dt.default)(async In=>{const rn=await it.onAnnotationCreate(In);return se&&se(),rn}),[Tt,Dt]=(0,dt.default)(async In=>{const rn=await it.onAnnotationUpdate(In);return se&&se(),rn}),Bt=W.id!==void 0,Gt=W.time!==W.timeEnd,Lt=Bt?Dt:Et,wt=Bt?Tt:ht,Qt=Gt?`${Pe(W.time)} - ${Pe(W.timeEnd)}`:Pe(W.time),nn=({tags:In,description:rn})=>{Lt({id:W.id,tags:In,description:rn,from:Math.round(W.time),to:Math.round(W.timeEnd)})},Jt=P.createElement("div",{ref:ke,className:(0,K.cx)(Je.editor,Se),...we},P.createElement("div",{className:Je.header},P.createElement(qr.Gy,{justify:"space-between",align:"center"},P.createElement("div",{className:Je.title},"Add annotation"),P.createElement("div",{className:Je.ts},Qt))),P.createElement("div",{className:Je.editorForm},P.createElement(Wt.l,{onSubmit:nn,defaultValues:{description:W?.text,tags:W?.tags||[]}},({register:In,errors:rn,control:bn})=>P.createElement(P.Fragment,null,P.createElement(Vt.D,{label:"Description",invalid:!!rn.description,error:rn?.description?.message},P.createElement(en.f,{...In("description",{required:"Annotation description is required"})})),P.createElement(Vt.D,{label:"Tags"},P.createElement(dn.e,{control:bn,name:"tags",render:({field:{ref:Bn,onChange:Fn,...xn}})=>P.createElement(yn.$,{allowCustomValue:!0,placeholder:"Add tags",onChange:Fn,tagOptions:Vn.vy,tags:xn.value})})),P.createElement(qr.Gy,{justify:"flex-end"},P.createElement(Y.$n,{size:"sm",variant:"secondary",onClick:fe,fill:"outline"},"Cancel"),P.createElement(Y.$n,{size:"sm",type:"submit",disabled:wt?.loading},wt?.loading?"Saving":"Save"))))));return P.createElement(P.Fragment,null,P.createElement("div",{className:Je.backdrop}),P.createElement("div",{ref:ct},Jt))});aa.displayName="AnnotationEditorForm";const Gn=W=>({backdrop:(0,K.css)` label: backdrop; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; overflow: hidden; z-index: ${W.zIndex.navbarFixed}; `,editorContainer:(0,K.css)` position: absolute; top: calc(100% + 10px); transform: translate3d(-50%, 0, 0); `,editor:(0,K.css)` background: ${W.colors.background.primary}; box-shadow: ${W.shadows.z3}; z-index: ${W.zIndex.dropdown}; border: 1px solid ${W.colors.border.weak}; border-radius: ${W.shape.radius.default}; width: 460px; `,editorForm:(0,K.css)` padding: ${W.spacing(1)}; `,header:(0,K.css)` border-bottom: 1px solid ${W.colors.border.weak}; padding: ${W.spacing(1.5,1)}; `,title:(0,K.css)` font-weight: ${W.typography.fontWeightMedium}; `,ts:(0,K.css)` font-size: ${W.typography.bodySmall.fontSize}; color: ${W.colors.text.secondary}; `}),ta=({onDismiss:W,onSave:se,timeZone:fe,data:Pe,selection:Se,annotation:we,style:ke})=>{const Je=(0,k.$j)(),it=(0,k.of)(Sa),ct=(0,k.of)(tt),ht=[(0,Yo.UU)({fallbackAxisSideDirection:"end",crossAxis:!1,boundary:document.body}),(0,Yo.BN)()],{context:Et,refs:Tt,floatingStyles:Dt}=(0,Ze.we)({open:!0,placement:"bottom",onOpenChange:Jt=>{Jt||W()},middleware:ht,whileElementsMounted:Yo.ll,strategy:"fixed"}),Bt=(0,Ze.s9)(Et),{getReferenceProps:Gt,getFloatingProps:Lt}=(0,Ze.bv)([Bt]);let wt=Pe.fields[0];if(!wt)return null;const Qt=wt.display||(0,ha.J)({field:wt,timeZone:fe,theme:Je}),nn=Se.min!==Se.max;return P.createElement(ma.ZL,null,P.createElement(P.Fragment,null,P.createElement("div",{style:ke},P.createElement("div",{className:(0,K.cx)((0,K.css)({position:"absolute",top:Se.bbox.top,left:Se.bbox.left,width:Se.bbox.width,height:Se.bbox.height}),nn?it.overlayRange(we):it.overlay(we))},P.createElement("div",{ref:Tt.setReference,className:nn?(0,K.cx)(ct(we).markerBar,it.markerBar):(0,K.cx)(ct(we).markerTriangle,it.markerTriangle),...Gt()}))),P.createElement(aa,{annotation:we||{time:Se.min,timeEnd:Se.max},timeFormatter:Jt=>Qt(Jt).text,onSave:se,onDismiss:W,ref:Tt.setFloating,style:Dt,...Lt()})))},Sa=W=>({overlay:se=>{const fe=W.visualization.getColorByName(se?.color||et.Mk);return(0,K.css)({borderLeft:`1px dashed ${fe}`})},overlayRange:se=>{const fe=W.visualization.getColorByName(se?.color||et.Mk);return(0,K.css)({background:Wr.alpha(fe,.1),borderLeft:`1px dashed ${fe}`,borderRight:`1px dashed ${fe}`})},markerTriangle:(0,K.css)({top:"calc(100% + 2px)",left:"-4px",position:"absolute"}),markerBar:(0,K.css)({top:"100%",left:0,position:"absolute"})}),ga=({data:W,timeZone:se,config:fe,children:Pe})=>{const Se=(0,P.useRef)(),[we,ke]=(0,P.useState)(),[Je,it]=(0,P.useState)(!1),[ct,ht]=(0,P.useState)(null),Et=(0,Vi.A)(),Tt=(0,P.useCallback)(()=>{ht(null),Se.current&&Se.current.setSelect({top:0,left:0,width:0,height:0}),it(!1)},[it,ht]);(0,P.useLayoutEffect)(()=>{let Bt=!1;fe.addHook("init",Lt=>{Se.current=Lt;const wt=Lt.hooks.setSelect;if(wt)for(let Qt=0;Qt<wt.length;Qt++){const nn=wt[Qt];nn!==Gt&&(wt[Qt]=(...Jt)=>{!Bt&&nn(...Jt)})}}),fe.addHook("syncRect",(Lt,wt)=>{Et()&&ke(wt)});const Gt=Lt=>{Bt&&(it(!0),ht({min:Lt.posToVal(Lt.select.left,"x"),max:Lt.posToVal(Lt.select.left+Lt.select.width,"x"),bbox:{left:Lt.select.left,top:0,height:Lt.select.height,width:Lt.select.width}}),Bt=!1)};fe.addHook("setSelect",Gt),fe.setCursor({bind:{mousedown:(Lt,wt,Qt)=>nn=>(Bt=nn.button===0&&(nn.metaKey||nn.ctrlKey),Qt(nn),null),mouseup:(Lt,wt,Qt)=>nn=>(Bt&&Lt.select.width===0&&(Lt.select.left=Lt.cursor.left,Lt.select.height=Lt.bbox.height/window.devicePixelRatio),Qt(nn),null)}})},[fe,ke,Et]);const Dt=(0,P.useCallback)(({coords:Bt})=>{if(!Se.current||!we||!Bt)return;const Gt=Se.current.posToVal(Bt.plotCanvas.x,"x");Gt&&(ht({min:Gt,max:Gt,bbox:{left:Bt.plotCanvas.x,top:0,height:we.height,width:0}}),it(!0))},[we]);return P.createElement(P.Fragment,null,Je&&ct&&we&&P.createElement(ta,{selection:ct,onDismiss:Tt,onSave:Tt,data:W,timeZone:se,style:{position:"absolute",top:`${we.top}px`,left:`${we.left}px`,width:`${we.width}px`,height:`${we.height}px`}}),Pe?Pe({startAnnotating:Dt}):null)};var Fa=e(78368),da=e(78226),Ua=e(72724),wa=e(42994),va=e(16797),Ja=e(40672),Xa=e(29158),ys=e(78369);const Hs=({annotation:W,timeFormatter:se,canEdit:fe,canDelete:Pe,onEdit:Se,onDelete:we})=>{const ke=(0,k.of)(Gs),Je=se(W.time),it=se(W.timeEnd);let ct=W.text;const ht=W.tags;let Et="",Tt,Dt,Bt=null;const Gt=P.createElement("span",{className:ke.time},W.isRegion?`${Je} - ${it}`:Je);if(W.login&&W.avatarUrl&&(Tt=P.createElement("img",{className:ke.avatar,alt:"Annotation avatar",src:W.avatarUrl})),W.alertId!==void 0&&W.newState){const Lt=ze.A.getStateDisplayModel(W.newState);Bt=P.createElement("div",{className:ke.alertState},P.createElement("i",{className:Lt.stateClass},Lt.text)),Et=ze.A.getAlertAnnotationInfo(W)}else W.title&&(ct=W.title+"<br />"+(typeof ct=="string"?ct:""));return(fe||Pe)&&(Dt=P.createElement("div",{className:ke.editControls},fe&&P.createElement(Xa.K,{name:"pen",size:"sm",onClick:Se,tooltip:"Edit"}),Pe&&P.createElement(Xa.K,{name:"trash-alt",size:"sm",onClick:we,tooltip:"Delete"}))),P.createElement("div",{className:ke.wrapper},P.createElement("div",{className:ke.header},P.createElement(qr.Gy,{justify:"space-between",align:"center",spacing:"md"},P.createElement("div",{className:ke.meta},P.createElement("span",null,Tt,Bt),Gt),Dt)),P.createElement("div",{className:ke.body},ct&&P.createElement("div",{dangerouslySetInnerHTML:{__html:Ja.sQ.sanitize(ct)}}),Et,P.createElement(P.Fragment,null,P.createElement(qr.Gy,{spacing:"xs",wrap:!0},ht?.map((Lt,wt)=>P.createElement(ys.v,{name:Lt,key:`${Lt}-${wt}`}))))))};Hs.displayName="AnnotationTooltip";const Gs=W=>({wrapper:(0,K.css)` max-width: 400px; `,commentWrapper:(0,K.css)` margin-top: 10px; border-top: 2px solid #2d2b34; height: 30vh; overflow-y: scroll; padding: 0 3px; `,header:(0,K.css)` padding: ${W.spacing(.5,1)}; border-bottom: 1px solid ${W.colors.border.weak}; font-size: ${W.typography.bodySmall.fontSize}; display: flex; `,meta:(0,K.css)` display: flex; justify-content: space-between; `,editControls:(0,K.css)` display: flex; align-items: center; > :last-child { margin-right: 0; } `,avatar:(0,K.css)` border-radius: ${W.shape.radius.circle}; width: 16px; height: 16px; margin-right: ${W.spacing(1)}; `,alertState:(0,K.css)` padding-right: ${W.spacing(1)}; font-weight: ${W.typography.fontWeightMedium}; `,time:(0,K.css)` color: ${W.colors.text.secondary}; font-weight: normal; display: inline-block; position: relative; top: 1px; `,body:(0,K.css)` padding: ${W.spacing(1)}; a { color: ${W.colors.text.link}; &:hover { text-decoration: underline; } } `}),As=6;function Er({annotation:W,timeZone:se,width:fe}){const{canEditAnnotations:Pe,canDeleteAnnotations:Se,...we}=(0,sn.d2)(),ke=(0,k.of)(tt),Je=(0,k.of)(Mr),[it,ct]=(0,P.useState)(!1),[ht,Et]=(0,P.useState)(!1),Tt=[(0,Yo.UU)({fallbackAxisSideDirection:"end",crossAxis:!1,boundary:document.body}),(0,Yo.BN)()],{context:Dt,refs:Bt,floatingStyles:Gt}=(0,Ze.we)({open:it,placement:"bottom",onOpenChange:ct,middleware:Tt,whileElementsMounted:Yo.ll,strategy:"fixed"}),Lt=(0,Ze.Mk)(Dt,{handleClose:(0,Ze.iB)()}),wt=(0,Ze.s9)(Dt),{getReferenceProps:Qt,getFloatingProps:nn}=(0,Ze.bv)([wt,Lt]),Jt=(0,P.useCallback)(()=>{Et(!0),ct(!1)},[Et,ct]),In=(0,P.useCallback)(()=>{we.onAnnotationDelete&&we.onAnnotationDelete(W.id)},[W,we]),rn=(0,P.useCallback)(un=>(0,Ua.LE)(un,{format:wa.WC.fullDate,timeZone:se}),[se]),bn=(0,P.useCallback)(()=>P.createElement(Hs,{annotation:W,timeFormatter:rn,onEdit:Jt,onDelete:In,canEdit:Pe?Pe(W.dashboardUID):!1,canDelete:Se?Se(W.dashboardUID):!1}),[Pe,Se,In,Jt,rn,W]),Bn=!!W.isRegion&&fe>As;let Fn=`${fe/2}px`,xn=P.createElement("div",{className:ke(W).markerTriangle,style:{left:Fn,position:"relative",transform:"translate3d(-100%,-50%, 0)"}});return Bn&&(xn=P.createElement("div",{className:ke(W).markerBar,style:{width:`${fe}px`,transform:"translate3d(0,-50%, 0)"}})),P.createElement(P.Fragment,null,P.createElement("div",{ref:Bt.setReference,className:Bn?void 0:Je.markerWrapper,"data-testid":ye.Tp.pages.Dashboard.Annotations.marker,...Qt()},xn),it&&P.createElement(ma.ZL,null,P.createElement("div",{className:Je.tooltip,ref:Bt.setFloating,style:Gt,...nn()},bn())),ht&&P.createElement(ma.ZL,null,P.createElement(aa,{onDismiss:()=>Et(!1),onSave:()=>Et(!1),timeFormatter:rn,annotation:W,ref:Bt.setFloating,style:Gt,...nn()})))}const Mr=W=>({markerWrapper:(0,K.css)({label:"markerWrapper",padding:W.spacing(0,.5,.5,.5)}),tooltip:(0,K.css)({...(0,va.getTooltipContainerStyles)(W),padding:0})}),_s=({annotations:W,timeZone:se,config:fe,disableCanvasRendering:Pe=!1})=>{const Se=(0,k.$j)(),we=(0,P.useRef)(),ke=(0,P.useRef)();(0,P.useEffect)(()=>{const ct=[];for(const ht of W)ct.push(new Fa.R(ht));return ke.current=ct,()=>{ke.current=[]}},[W]),(0,P.useLayoutEffect)(()=>{fe.addHook("init",ct=>{we.current=ct}),fe.addHook("draw",ct=>{if(!ke.current)return null;const ht=ct.ctx;if(!ht)return;ht.save(),ht.beginPath(),ht.rect(ct.bbox.left,ct.bbox.top,ct.bbox.width,ct.bbox.height),ht.clip();const Et=(Tt,Dt)=>{ht.beginPath(),ht.lineWidth=2,ht.strokeStyle=Dt,ht.setLineDash([5,5]),ht.moveTo(Tt,ct.bbox.top),ht.lineTo(Tt,ct.bbox.top+ct.bbox.height),ht.stroke(),ht.closePath()};if(!Pe)for(let Tt=0;Tt<ke.current.length;Tt++){const Dt=ke.current[Tt];for(let Bt=0;Bt<Dt.length;Bt++){const Gt=Dt.get(Bt);if(!Gt.time)continue;let Lt=ct.valToPos(Gt.time,"x",!0);const wt=Se.visualization.getColorByName(Gt.color);if(Et(Lt,wt),Gt.isRegion&&Gt.timeEnd){let Qt=ct.valToPos(Gt.timeEnd,"x",!0);Et(Qt,wt),ht.fillStyle=Wr.alpha(wt,.1),ht.rect(Lt,ct.bbox.top,Qt-Lt,ct.bbox.height),ht.fill()}}}ht.restore()})},[fe,Se,Pe]);const Je=(0,P.useCallback)((ct,ht)=>{const Tt=new Fa.R(ct).get(ht.fieldIndex);if(!Tt.time||!we.current)return;let Dt=we.current.valToPos(Tt.time,"x");return Dt<0&&(Dt=0),{x:Dt,y:we.current.bbox.height/window.devicePixelRatio+4}},[]),it=(0,P.useCallback)((ct,ht)=>{let Et=0;const Dt=new Fa.R(ct).get(ht.fieldIndex);if(!!Dt.isRegion&&we.current){let Gt=we.current.valToPos(Dt.time,"x"),Lt=we.current.valToPos(Dt.timeEnd,"x");Gt<0&&(Gt=0),Lt>we.current.bbox.width/window.devicePixelRatio&&(Lt=we.current.bbox.width/window.devicePixelRatio),Et=Lt-Gt}return P.createElement(Er,{annotation:Dt,timeZone:se,width:Et})},[se]);return P.createElement(da.a,{id:"annotations",config:fe,events:W,renderEventMarker:it,mapEventToXYCoords:Je})};var er=e(62567),Kr=e(29647),$r=e(33083),Sr=e(59093),us=e(64539),Zn=e(28122);const fa=({data:W,config:se,onClose:fe,timeZone:Pe,replaceVariables:Se,...we})=>{const[ke,Je]=(0,P.useState)(null),[it,ct]=(0,P.useState)(null),[ht,Et]=(0,P.useState)(!1);(0,P.useLayoutEffect)(()=>{let Dt=null;se.addHook("init",Bt=>{Bt.over.addEventListener("click",Gt=>{Dt!=null&&!Gt.metaKey&&!Gt.ctrlKey&&!Gt.shiftKey&&(Je({viewport:{x:Gt.clientX,y:Gt.clientY},plotCanvas:{x:Gt.clientX-Bt.rect.left,y:Gt.clientY-Bt.rect.top}}),ct({seriesIdx:Dt,dataIdx:Bt.cursor.idxs[Dt]}),Et(!0))})}),se.addHook("setSeries",(Bt,Gt)=>{Dt=Gt})},[se]);const Tt=(0,P.useMemo)(()=>we.defaultItems?we.defaultItems.map(Dt=>({...Dt,items:Dt.items.map(Bt=>({...Bt,onClick:Gt=>{ke&&Bt.onClick?.(Gt,{coords:ke})}}))})):[],[ke,we.defaultItems]);return P.createElement(P.Fragment,null,ht&&ke&&P.createElement(ka,{data:W,frames:we.frames,defaultItems:Tt,timeZone:Pe,selection:{point:it,coords:ke},replaceVariables:Se,onClose:()=>{ct(null),Et(!1),fe&&fe()}}))},ka=({selection:W,timeZone:se,defaultItems:fe,replaceVariables:Pe,data:Se,...we})=>{const ke=(0,P.useRef)(null),Je=()=>{we.onClose&&we.onClose()};(0,Kr.A)(ke,()=>{Je()});const it=Se.fields[0];if(!it)return null;const ct=fe?[...fe]:[];let ht=()=>null;if(W.point){const{seriesIdx:Tt,dataIdx:Dt}=W.point,Bt=it.display;if(Tt&&Dt!==null){const Gt=Se.fields[Tt],Lt=Gt.display(Gt.values[Dt]);Gt.config.links&&Gt.config.links.length>0&&Gt.getLinks&&ct.push({items:Gt.getLinks({valueRowIndex:Dt}).map(Qt=>({label:Qt.title,ariaLabel:Qt.title,url:Qt.href,target:Qt.target,icon:Qt.target==="_self"?"link":"external-link-alt",onClick:Qt.onClick}))}),ht=()=>P.createElement($r.i,{timestamp:Bt(it.values[Dt]).text,displayValue:Lt,seriesColor:Lt.color,displayName:(0,Za.Ct)(Gt,Se,we.frames)})}}const Et=()=>ct?.map((Tt,Dt)=>P.createElement(Sr.r,{key:`${Tt.label}${Dt}`,label:Tt.label},(Tt.items||[]).map(Bt=>P.createElement(us.D,{key:Bt.url,url:Bt.url,label:Bt.label,target:Bt.target,icon:Bt.icon,active:Bt.active,onClick:Bt.onClick}))));return P.createElement(Zn.t,{renderMenuItems:Et,renderHeader:ht,x:W.coords.viewport.x,y:W.coords.viewport.y,onClose:Je})};var ss=e(39522),Rr=e(79961),Js=e(74007),gr=e(86106);const rs=({timeZone:W,dataFrame:se,dataFrameFieldIndex:fe,config:Pe,exemplarColor:Se,clickedExemplarFieldIndex:we,setClickedExemplarFieldIndex:ke})=>{const Je=(0,k.of)(Fs),[it,ct]=(0,P.useState)(!1),[ht,Et]=(0,P.useState)(!1),[Tt,Dt]=P.useState(null),[Bt,Gt]=P.useState(null),{styles:Lt,attributes:wt}=(0,ss.E)(Tt,Bt,{modifiers:[{name:"preventOverflow",options:{altAxis:!0}},{name:"flip",options:{fallbackPlacements:["top","left-start"]}}]}),Qt=(0,P.useRef)();(0,P.useEffect)(()=>{we?.fieldIndex===fe.fieldIndex&&we?.frameIndex===fe.frameIndex||Et(!1)},[we,fe]);const nn=()=>{const xn=[P.createElement("rect",{fill:Se,key:"diamond",x:"3.38672",width:"4.78985",height:"4.78985",transform:"rotate(45 3.38672 0)"}),P.createElement("path",{fill:Se,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"}),P.createElement("path",{fill:Se,key:"triangle",d:"M4 0L7.4641 6H0.535898L4 0Z"}),P.createElement("rect",{fill:Se,key:"rectangle",width:"5",height:"5"}),P.createElement("path",{fill:Se,key:"pentagon",d:"M3 0.5L5.85317 2.57295L4.76336 5.92705H1.23664L0.146831 2.57295L3 0.5Z"}),P.createElement("path",{fill:Se,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 xn[fe.frameIndex%xn.length]},Jt=(0,P.useCallback)(()=>{we===void 0&&(Qt.current&&clearTimeout(Qt.current),ct(!0))},[ct,we]),In=()=>{Et(!0)},rn=(0,P.useCallback)(()=>{Qt.current=setTimeout(()=>{ct(!1)},150)},[ct]),bn=(0,P.useCallback)(()=>{const xn=se.fields.filter(Ea=>Ea.config.links?.length&&Ea.config.links?.length>0)||[],un=[...xn,...se.fields.filter(Ea=>!xn.includes(Ea))],Rn=Ea=>(0,Ua.LE)(Ea,{format:wa.WC.fullDate,timeZone:W}),Pn=()=>{Et(!1),ct(!1),ke(void 0)};let ea=[],jn=[];un.map((Ea,gs)=>{const ya=Ea.values[fe.fieldIndex];Ea.config.links?.length&&jn?.push(...Ea.getLinks?.({valueRowIndex:fe.fieldIndex})||[]);const _a=Ea.display?Ea.display(ya):{text:`${ya}`,numeric:+ya};ea.push({name:Ea.name,value:ya,valueString:(0,ds.cN)(_a),highlight:!1})});const la={position:"relative",top:"35px",right:"5px",marginRight:0},Ya=()=>R.$.featureToggles.newVizTooltips?P.createElement(P.Fragment,null,ht&&P.createElement(gr.d,{onClick:Pn,style:la}),P.createElement(Js.i,{displayValues:ea,links:jn})):P.createElement("div",{className:Je.wrapper},ht&&P.createElement(gr.d,{onClick:Pn}),P.createElement("div",{className:Je.body},P.createElement("div",{className:Je.header},P.createElement("span",{className:Je.title},"Exemplars")),P.createElement("div",null,P.createElement("table",{className:Je.exemplarsTable},P.createElement("tbody",null,un.map((Ea,gs)=>{const ya=Ea.values[fe.fieldIndex],_a=Ea.config.links?.length?Ea.getLinks?.({valueRowIndex:fe.fieldIndex}):void 0;return P.createElement("tr",{key:gs},P.createElement("td",{valign:"top"},Ea.name),P.createElement("td",null,P.createElement("div",{className:Je.valueWrapper},P.createElement("span",null,Ea.type===Yn.PU.time?Rn(ya):ya),_a&&P.createElement(Rr.n,{links:_a}))))}))))));return P.createElement("div",{onMouseEnter:Jt,onMouseLeave:rn,className:Je.tooltip,ref:Gt,style:Lt.popper,...wt.popper},Ya())},[wt.popper,se.fields,fe,Jt,rn,Lt.popper,Je,W,ht,ke]),Bn=Pe.getSeries().find(xn=>xn.props.dataFrameFieldIndex?.frameIndex===fe.frameIndex)?.props.lineColor,Fn=()=>{ke(fe),In()};return P.createElement(P.Fragment,null,P.createElement("div",{ref:Dt,onClick:Fn,onKeyDown:xn=>{xn.key==="Enter"&&Fn()},onMouseEnter:Jt,onMouseLeave:rn,className:Je.markerWrapper,"data-testid":ye.Tp.components.DataSource.Prometheus.exemplarMarker,role:"button",tabIndex:0},P.createElement("svg",{viewBox:"0 0 7 7",width:"7",height:"7",style:{fill:Bn},className:(0,K.cx)(Je.marble,(it||ht)&&Je.activeMarble)},nn())),(it||ht)&&P.createElement(ma.ZL,null,bn()))},Fs=W=>{const se=W.isDark?W.v1.palette.dark2:W.v1.palette.white,fe=W.isDark?W.v1.palette.dark9:W.v1.palette.gray5,Pe=W.isDark?W.v1.palette.black:W.v1.palette.white,Se=W.isDark?W.v1.palette.dark3:W.v1.palette.gray6;return{markerWrapper:(0,K.css)({padding:"0 4px 4px 4px",width:"8px",height:"8px",boxSizing:"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,K.css)({width:0,height:0,borderLeft:"4px solid transparent",borderRight:"4px solid transparent",borderBottom:`4px solid ${W.v1.palette.red}`,pointerEvents:"none"}),wrapper:(0,K.css)({background:se,border:`1px solid ${fe}`,borderRadius:W.shape.borderRadius(2),boxShadow:`0 0 20px ${Pe}`,padding:W.spacing(1)}),exemplarsTable:(0,K.css)({width:"100%","tr td":{padding:"5px 10px",whiteSpace:"nowrap",borderBottom:`4px solid ${W.components.panel.background}`},tr:{backgroundColor:W.colors.background.primary,"&:nth-child(even)":{backgroundColor:Se}}}),valueWrapper:(0,K.css)({display:"flex",flexDirection:"row",flexWrap:"wrap",columnGap:W.spacing(1),"> span":{flexGrow:0},"> *":{flex:"1 1",alignSelf:"center"}}),tooltip:(0,K.css)({background:"none",padding:0,overflowY:"auto",maxHeight:"95vh"}),header:(0,K.css)({background:fe,padding:"6px 10px",display:"flex"}),title:(0,K.css)({fontWeight:W.typography.fontWeightMedium,paddingRight:W.spacing(2),overflow:"hidden",display:"inline-block",whiteSpace:"nowrap",textOverflow:"ellipsis",flexGrow:1}),body:(0,K.css)({fontWeight:W.typography.fontWeightMedium,borderRadius:W.shape.borderRadius(2),overflow:"hidden"}),marble:(0,K.css)({display:"block",opacity:.5,transition:"transform 0.15s ease-out"}),activeMarble:(0,K.css)({transform:"scale(1.3)",opacity:1,filter:"drop-shadow(0 0 8px rgba(0, 0, 0, 0.5))"})}},Oo=({exemplars:W,timeZone:se,config:fe,visibleSeries:Pe})=>{const Se=(0,P.useRef)(),[we,ke]=(0,P.useState)();(0,P.useLayoutEffect)(()=>{fe.addHook("init",ct=>{Se.current=ct})},[fe]);const Je=(0,P.useCallback)((ct,ht)=>{const Et=ct.fields.find(wt=>wt.name===Yn.LE),Tt=ct.fields.find(wt=>wt.name===Yn.Bc);if(!Et||!Tt||!Se.current)return;const Dt=Object.keys(Se.current.scales).find(wt=>!["x","y"].some(Qt=>Qt===wt))??lo.s,Bt=Se.current.scales[Dt].min,Gt=Se.current.scales[Dt].max;let Lt=Tt.values[ht.fieldIndex];return Bt!=null&&Lt<Bt&&(Lt=Bt),Gt!=null&&Lt>Gt&&(Lt=Gt),{x:Se.current.valToPos(Et.values[ht.fieldIndex],"x"),y:Se.current.valToPos(Lt,Dt)}},[]),it=(0,P.useCallback)((ct,ht)=>{const Et=Pe!==void 0?Es(Pe,ct,ht):!0,Tt=Pe!==void 0?Pi(ct,ht,Pe):void 0;return Et?P.createElement(rs,{setClickedExemplarFieldIndex:ke,clickedExemplarFieldIndex:we,timeZone:se,dataFrame:ct,dataFrameFieldIndex:ht,config:fe,exemplarColor:Tt}):P.createElement(P.Fragment,null)},[fe,se,Pe,ke,we]);return P.createElement(da.a,{config:fe,id:"exemplars",events:W,renderEventMarker:it,mapEventToXYCoords:Je})},Qo=(W,se)=>{const fe=W.series.filter(Se=>Se.props.show),Pe=[];return se?.length&&fe.forEach(Se=>{const we=Se.props?.dataFrameFieldIndex?.frameIndex,ke=Se.props?.dataFrameFieldIndex?.fieldIndex;if(we!==void 0&&ke!==void 0){const Je=se[we]?.fields[ke];Je?.labels&&Pe.push({labels:Je.labels,color:Se.props?.lineColor??""})}}),{labels:Pe,totalSeriesCount:W.series.length}},Pi=(W,se,fe)=>{let Pe;return fe.labels.some(Se=>{const we=Object.keys(Se.labels),ke=W.fields.filter(Je=>we.find(it=>it===Je.name));return ke.length&&ke.every((it,ct,ht)=>{const Et=it.values[se.fieldIndex];return Se.labels[it.name]===Et})?(Pe=Se.color,!0):!1}),Pe},Es=(W,se,fe)=>{let Pe=!1;return W.labels.length===W.totalSeriesCount?Pe=!0:W.labels.some(Se=>{const we=Object.keys(Se.labels);if(Object.keys(Se.labels).length===0)Pe=!0;else{const ke=se.fields.filter(Je=>we.find(it=>it===Je.name));ke.length&&(Pe=W.labels.some(Je=>Object.keys(Je.labels).every(it=>{const ct=Je.labels[it];return ke.find(ht=>ht.values[fe.fieldIndex]===ct)})))}return Pe}),Pe},Lr=({config:W,onChangeTimeRange:se})=>{const fe=(0,P.useRef)(),[Pe,Se]=(0,P.useState)([]),[we,ke]=(0,P.useState)();if((0,P.useLayoutEffect)(()=>{W.addHook("init",Dt=>{fe.current=Dt}),W.addHook("setScale",Dt=>{Se(Dt.data?.[0]??[]),ke(Dt.scales.x??void 0)})},[W]),Pe.length<2||!se||!we||!we.time||!we.min||!we.max)return null;let Je=0,it=Pe.length-1;for(;Je<=it&&Pe[Je]==null;)Je++;for(;it>=0&&Pe[it]==null;)it--;const ct=Pe[Je],ht=Pe[it],Et=we.min,Tt=we.max;return ct==null||ht==null||ct<=Tt&&ht>=Et?null:P.createElement("div",{style:{position:"absolute",top:"50%",transform:"translateY(-50%)",width:"100%",textAlign:"center"}},P.createElement("div",null,P.createElement("div",null,"Data outside time range"),P.createElement(Y.$n,{onClick:Dt=>se({from:ct,to:ht}),variant:"secondary","data-testid":"time-series-zoom-to-data"},"Zoom to data")))};Lr.displayName="OutsideRangePlugin";var yo=e(55794),Do=e.n(yo);const al=({step:W,y:se,dragBounds:fe,mapPositionToValue:Pe,formatValue:Se,onChange:we})=>{const ke=(0,k.$j)();let Je=se,it="none";se<(fe.top??0)&&(it="top"),se>(fe.bottom??0)+22&&(it="bottom"),it==="bottom"&&(Je=fe.bottom??se),it==="top"&&(Je=fe.top??se);const ct=typeof we!="function",ht=(0,k.of)(cc,W,it,ct),[Et,Tt]=(0,P.useState)(W.value),Dt=(0,P.useMemo)(()=>ke.colors.getContrastText(ke.visualization.getColorByName(W.color)),[W.color,ke]);return P.createElement(Do(),{axis:"y",grid:[1,1],disabled:ct,onStop:ct?$e.noop:(Bt,Gt)=>(we(Pe(Gt.lastY)),!1),onDrag:(Bt,Gt)=>Tt(Pe(Gt.lastY)),position:{x:0,y:Je},bounds:fe},P.createElement("div",{className:ht.handle,style:{color:Dt}},P.createElement("span",{className:ht.handleText},Se(Et))))};al.displayName="ThresholdDragHandle";const cc=(W,se,fe,Pe)=>{const Se=W.visualization.getColorByName(se.color),we=dc(fe),ke=fe!=="none";return{handle:(0,K.css)` display: flex; align-items: center; position: absolute; left: 0; width: calc(100% - 9px); height: 18px; margin-top: -9px; border-color: ${Se}; cursor: ${Pe?"initial":"grab"}; border-top-right-radius: ${W.shape.radius.default}; border-bottom-right-radius: ${W.shape.radius.default}; ${ke&&(0,K.css)` margin-top: 0; border-radius: ${W.shape.radius.default}; `} background: ${Se}; font-size: ${W.typography.bodySmall.fontSize}; &:before { ${we}; } `,handleText:(0,K.css)` text-align: center; width: 100%; display: block; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; `}};function dc(W){const se=W==="none",fe=Pe=>(0,K.css)` content: ''; position: absolute; bottom: 0; top: 0; width: 0; height: 0; left: 0; border-right-style: solid; border-right-width: ${Pe}px; border-right-color: inherit; border-top: ${Pe}px solid transparent; border-bottom: ${Pe}px solid transparent; `;return se?(0,K.css)` ${fe(9)}; left: -9px; `:W==="top"?(0,K.css)` ${fe(5)}; left: calc(50% - 2.5px); top: -7px; transform: rotate(90deg); `:W==="bottom"?(0,K.css)` ${fe(5)}; left: calc(50% - 2.5px); top: calc(100% - 2.5px); transform: rotate(-90deg); `:""}const _i=60,oi=({config:W,fieldConfig:se,onThresholdsChange:fe})=>{const Pe=(0,P.useRef)(),[Se,we]=(0,P.useState)(0);(0,P.useLayoutEffect)(()=>{W.setPadding([0,_i,0,0]),W.addHook("init",Je=>{Pe.current=Je}),W.addHook("draw",()=>{we(Je=>Je+1)})},[W]);const ke=(0,P.useMemo)(()=>{const Je=Pe.current;if(!Je)return null;const it=se.defaults.thresholds;if(!it)return null;const ct=(0,xo.M)(se.defaults,Yn.PU.number),ht=se.defaults.decimals,Et=[];for(let Tt=0;Tt<it.steps.length;Tt++){const Dt=it.steps[Tt],Bt=Je.valToPos(Dt.value,ct);if(Number.isNaN(Bt)||!Number.isFinite(Bt))continue;const Gt=Je.bbox.height/window.devicePixelRatio,wt=typeof fe=="function"?nn=>{const Jt=[...it.steps.slice(0,Tt),...it.steps.slice(Tt+1),{...it.steps[Tt],value:nn}].sort((In,rn)=>In.value-rn.value);fe({...it,steps:Jt})}:void 0,Qt=P.createElement(al,{key:`${Dt.value}-${Tt}`,step:Dt,y:Bt,dragBounds:{top:0,bottom:Gt},mapPositionToValue:nn=>Je.posToVal(nn,ct),formatValue:nn=>(0,ds.j_)(ct)(nn,ht).text,onChange:wt});Et.push(Qt)}return Et},[Se,se,fe]);return Pe.current?P.createElement("div",{style:{position:"absolute",overflow:"visible",left:`${(Pe.current.bbox.left+Pe.current.bbox.width)/window.devicePixelRatio}px`,top:`${Pe.current.bbox.top/window.devicePixelRatio}px`,width:`${_i}px`,height:`${Pe.current.bbox.height/window.devicePixelRatio}px`}},ke):null};oi.displayName="ThresholdControlsPlugin";var zl=e(43548),Ml=e(50311),kl=e(46294),uc=e(39624);function mc(W){let se=new Map;return W.map(Pe=>({...Pe,fields:Pe.fields.map(Se=>{if(Se.type===Yn.PU.enum){let we=(0,xo.M)(Se.config,Se.type),ke=se.get(we);ke||(ke=[],se.set(we,ke));let Je=Se.values.toArray().slice(),it=Se.config.type.enum.text;if(ke.length>0)for(let ct=0;ct<Je.length;ct++)Je[ct]+=ke.length;return ke.push(...it),Se.config.type.enum.text=ke,{...Se,values:Je}}return Se})}))}function Sl(W,se,fe,Pe){if(!W?.length)return null;let Se=Pe!=null;Pe!=null&&Pe>0&&(W=[{...W[0],fields:[W[0].fields[Pe],...W[0].fields.filter((it,ct)=>ct!==Pe)]}]);for(let it of W)for(let ct of it.fields)ct.type===Yn.PU.time&&typeof ct.values[0]!="number"&&(ct.values=(0,Ml.s7)(ct,{destinationType:Yn.PU.time}).values);let we=0;e:for(let it of W)for(let ct of it.fields)if(ct.type===Yn.PU.enum&&++we>1){W=mc(W);break e}let ke;const Je=[];for(let it of W){const ct=[];let ht=!1,Et=!1,Tt=Se?it:(0,kl.M)({frame:it,refFieldPseudoMin:fe?.from.valueOf(),refFieldPseudoMax:fe?.to.valueOf()});const Dt=(0,uc.C)(Tt).fields;for(let Bt=0;Bt<Dt?.length;Bt++){const Gt=Dt[Bt];switch(Gt.type){case Yn.PU.time:ht=!0,ct.push(Gt);break;case Yn.PU.number:Et=Se?Bt>0:!0,ke={...Gt,values:Gt.values.map(Qt=>Number.isFinite(Qt)||Qt==null?Qt:null)},ct.push(ke);break;case Yn.PU.enum:Et=!0;case Yn.PU.string:ke={...Gt,values:Gt.values},ct.push(ke);break;case Yn.PU.boolean:Et=!0;const Lt=Gt.config?.custom??{},wt={...Gt.config,max:1,min:0,custom:Lt};Lt.lineInterpolation!==St.dx.StepBefore&&(Lt.lineInterpolation=St.dx.StepAfter),ke={...Gt,config:wt,type:Yn.PU.number,values:Gt.values.map(Qt=>Qt==null?Qt:Qt?1:0)},(0,ds.j9)(wt.unit)||(wt.unit="bool",ke.display=(0,ha.J)({field:ke,theme:se})),ct.push(ke);break}}(Se||ht)&&Et&&Je.push({...it,length:Tt.length,fields:ct})}return Je.length?(gc(Je,se,0),fc(Je,se),Je):null}const fc=(W,se)=>{const{palette:fe}=se.visualization;for(const Pe of W)for(const Se of Pe.fields)if(Se.type===Yn.PU.enum){const we=fe[Se.state?.seriesIndex%fe.length],ke=se.visualization.getColorByName(we),Je=Se.config.type.enum;Je.color=Array(Je.text.length).fill(ke),Se.display=(0,ha.J)({field:Se,theme:se})}},gc=(W,se,fe)=>{let Pe=0;W.forEach(Se=>{Se.fields.forEach((we,ke)=>{ke!==fe&&(we.type===Yn.PU.number||we.type===Yn.PU.boolean||we.type===Yn.PU.enum)&&(we.state={...we.state,seriesIndex:Pe++},we.display=(0,ha.J)({field:we,theme:se}))})})};function rr(W,se){return!W||!W.length?[se]:W.map(fe=>fe?.length?fe:se)}function go(W,se,fe,Pe,Se){return W.fields.forEach(we=>{if(we.state?.origin?.frameIndex===void 0||se[we.state?.origin?.frameIndex]===void 0)return;const ke=[];for(const it of se[we.state?.origin?.frameIndex].fields)if(it.type===Yn.PU.string)if(we.values instanceof zl.F){const ct={...it};ct.values=new zl.F(it.values,we.values.getOrderArray()),ke.push(ct)}else ke.push(it);const Je={fields:[...W.fields,...ke],length:W.fields.length+ke.length};we.getLinks=(0,Wi._M)(Je,we,we.state.scopedVars,fe,Pe,Se)}),W}const Ws=W=>W.mode===St.$N.Multi&&W.maxHeight!=null;var Br=(W=>(W.Candles="candles",W.CandlesVolume="candles+volume",W.Volume="volume",W))(Br||{}),yr=(W=>(W.Candles="candles",W.OHLCBars="ohlcbars",W))(yr||{}),wo=(W=>(W.CloseClose="close-close",W.OpenClose="open-close",W))(wo||{});const Ci={down:"red",flat:"gray",up:"green"},ii={...{candleStyle:"candles",colorStrategy:"open-close",colors:{down:"red",up:"green",flat:"gray"},fields:{},includeAllFields:!1,mode:"candles+volume"},legend:{displayMode:St.lm.List,showLegend:!0,placement:"bottom",calcs:[]},tooltip:{mode:St.$N.Multi,sort:St.xB.None}},zs={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 Jo(W,se,fe){const Pe=(0,Qs.findField)(W,fe[se.key]);if(!Pe)for(const Se of W.fields){const we=(0,Za.Ct)(Se,W).toLowerCase();if(se.defaults.includes(we)||se.defaults.includes(Se.name))return Se}return Pe}function Ga(W,se,fe,Pe){if(!W?.length)return null;const Se=se.fields??{},we=W.length===1?(0,kr.Yj)(W[0],W[0].fields.findIndex(Dt=>Dt.type===Yn.PU.time)):(0,kr.Fd)({frames:W});if(!we?.length)return null;const ke={aligned:we,frame:we,names:{}},Je=Sl([we],fe,Pe);if(!Je)return null;const it=ke.frame=Je[0],ct=it.fields.findIndex(Dt=>Dt.type===Yn.PU.time);if(ct<0)return null;const ht=new Set;for(const Dt of Object.values(zs)){const Bt=Jo(it,Dt,Se);Bt&&(ke[Dt.key]=Bt,ht.add(Bt))}if(!ke.open&&!ke.close&&(ke.open=it.fields.find(Dt=>Dt.type===Yn.PU.number),ke.open&&ht.add(ke.open)),ke.open&&!ke.close&&!Se.close){const Dt=ke.open.values.slice(1);Dt.push(Dt[Dt.length-1]),ke.close={...ke.open,values:Dt,name:"Next open",state:void 0},ht.add(ke.close),it.fields.push(ke.close),ke.autoOpenClose=!0}if(ke.close&&!ke.open&&!Se.open){const Dt=ke.close.values.slice();Dt.unshift(Dt[0]),Dt.length=it.length,ke.open={...ke.close,values:Dt,name:"Previous close",state:void 0},ht.add(ke.open),it.fields.push(ke.open),ke.autoOpenClose=!0}!ke.high&&!Se.high&&(ke.high=ke.open),!ke.low&&!Se.low&&(ke.low=ke.open),se.mode===Br.Volume?(ke.high&&(ke.high!==ke.open&&ht.delete(ke.high),ke.high=void 0),ke.low&&(ke.low!==ke.open&&ht.delete(ke.low),ke.low=void 0)):se.mode===Br.Candles&&ke.volume&&(ht.delete(ke.volume),ke.volume=void 0);for(const Dt of Object.values(zs)){const Bt=ke[Dt.key];Bt&&(ke.names[Dt.key]=(0,Za.Ct)(Bt,ke.frame))}const Et=it.fields[ct],Tt=[Et];se.includeAllFields?Tt.push(...it.fields.filter(Dt=>Dt!==Et)):Tt.push(...ht),ke.frame={...ke.frame,fields:Tt};for(let Dt=0;Dt<ke.frame.fields.length;Dt++){const Bt=ke.frame.fields[Dt];Bt.state={...Bt.state,seriesIndex:Dt-1,origin:{fieldIndex:Dt,frameIndex:0}}}return ke}const{alpha:zi}=Wr;function hc(W){let{mode:se,candleStyle:fe,fields:Pe,colorStrategy:Se,upColor:we,downColor:ke,flatColor:Je,volumeAlpha:it,flatAsUp:ct=!0}=W;const ht=se!==Br.Volume&&Pe.high!=null&&Pe.low!=null,Et=ht&&fe===yr.Candles,Tt=se!==Br.Candles&&Pe.volume!=null;function Dt(Jt,In,rn,bn,Bn){return Jt>0?rn:Jt<0?bn:Bn?rn:In}let Bt=0,Gt=Pe.open,Lt=Pe.high,wt=Pe.low,Qt=Pe.close,nn=Pe.volume;return Jt=>{let In,rn,bn,Bn,Fn,xn;ht&&(bn=new Path2D,rn=new Path2D,In=new Path2D),Tt&&(Bn=new Path2D,Fn=new Path2D,xn=new Path2D);let un=new Path2D,Rn=Jt.ctx,Pn=Jt.data[Bt],ea=Jt.data[Gt],jn=Jt.data[Qt],la=ht?Jt.data[Lt]:null,Ya=ht?Jt.data[wt]:null,Ea=Tt?Jt.data[nn]:null,gs=nn!=null?Math.round(Jt.valToPos(0,Jt.series[nn].scale,!0)):null,[ya,_a]=Jt.series[0].idxs,ra=Jt.data[0],Hn=ea,Wn=Jt.bbox.width;if(ra.length>1){let Aa=null;for(let On=0,zn=1/0;On<ra.length;On++)if(Hn[On]!==void 0){if(Aa!=null){let Qn=Math.abs(ra[On]-ra[Aa]);Qn<zn&&(zn=Qn,Wn=Math.abs(Jt.valToPos(ra[On],"x",!0)-Jt.valToPos(ra[Aa],"x",!0)))}Aa=On}}let _n=Math.round(.6*Wn),oa=2,Ta=2;_n<=12&&(oa=Ta=1);let Ca=Math.floor(_n/2);for(let Aa=ya;Aa<=_a;Aa++){let On=Math.round(Jt.valToPos(Pn[Aa],"x",!0)),zn=Aa===ya?0:Math.sign(jn[Aa]-jn[Aa-1]),Qn=Math.sign(jn[Aa]-ea[Aa]);if(Tt&&xn&&Fn&&Bn){let Ka=Dt(Se===wo.CloseClose?zn:Qn,xn,Fn,Bn,Aa===ya&&wo.CloseClose?!1:ct),Ra=Math.round(Jt.valToPos(Ea[Aa],Jt.series[nn].scale,!0));Ka.rect(On-Ca,Ra,_n,gs-Ra)}if(ht&&bn&&rn&&In){let Ka=Dt(Se===wo.CloseClose?zn:Qn,bn,rn,In,Aa===ya&&wo.CloseClose?!1:ct),Ra=Math.round(Jt.valToPos(la[Aa],Jt.series[Lt].scale,!0)),ns=Math.round(Jt.valToPos(Ya[Aa],Jt.series[wt].scale,!0));Ka.rect(On-Math.floor(oa/2),Ra,oa,ns-Ra);let ja=Math.round(Jt.valToPos(ea[Aa],Jt.series[Gt].scale,!0)),Os=Math.round(Jt.valToPos(jn[Aa],Jt.series[Qt].scale,!0));if(Et){let Xs=Math.min(ja,Os),no=Math.max(ja,Os),Ks=Math.max(1,no-Xs);Ka.rect(On-Ca,Xs,_n,Ks),Se===wo.CloseClose&&Qn>=0&&Ks>Ta*2&&un.rect(On-Ca+Ta,Xs+Ta,_n-Ta*2,Ks-Ta*2)}else Ka.rect(On-Ca,ja,Ca,oa),Ka.rect(On,Os,Ca,oa)}}Rn.save(),Rn.rect(Jt.bbox.left,Jt.bbox.top,Jt.bbox.width,Jt.bbox.height),Rn.clip(),Tt&&xn&&Fn&&Bn&&(Rn.fillStyle=zi(we,it),Rn.fill(Fn),Rn.fillStyle=zi(ke,it),Rn.fill(Bn),Rn.fillStyle=zi(Je,it),Rn.fill(xn)),ht&&bn&&rn&&In&&(Rn.fillStyle=we,Rn.fill(rn),Rn.fillStyle=ke,Rn.fill(In),Rn.fillStyle=Je,Rn.fill(bn),Rn.globalCompositeOperation="destination-out",Rn.fill(un)),Rn.restore()}}const vc=({data:W,id:se,timeRange:fe,timeZone:Pe,width:Se,height:we,options:ke,fieldConfig:Je,onChangeTimeRange:it,replaceVariables:ct})=>{const{sync:ht,canAddAnnotations:Et,onThresholdsChange:Tt,canEditThresholds:Dt,showThresholds:Bt}=(0,sn.d2)(),Gt=(0,k.$j)(),Lt=(0,P.useMemo)(()=>Ga(W.series,ke,Gt,fe),[W.series,ke,Gt,fe]),[wt,Qt]=(0,P.useState)(null),{renderers:nn,tweakScale:Jt,tweakAxis:In,shouldRenderPrice:rn}=(0,P.useMemo)(()=>{let Fn=(Ca,Aa)=>Ca,xn=(Ca,Aa)=>Ca,un={renderers:[],tweakScale:Fn,tweakAxis:xn,shouldRenderPrice:!1};if(!Lt)return un;const Rn=Lt.names;if(!Object.keys(Rn).length)return un;const{mode:Pn,candleStyle:ea,colorStrategy:jn}=ke,la={...Ci,...ke.colors};let{open:Ya,high:Ea,low:gs,close:ya,volume:_a}=Rn;if(Ya==null||ya==null)return un;let ra=.5,Hn=-1,Wn=!1;if(_a!=null&&Pn!==Br.Candles){let Ca=Lt.volume;if(Ca!=null){Wn=!0;let{fillOpacity:Aa}=Ca.config.custom;Aa&&(ra=Aa/100),Pn!==Br.Volume&&(Ca.config={...Ca.config},Ca.config.unit="short",Ca.display=(0,ha.J)({field:Ca,theme:pn.$W.theme2}),xn=(On,zn)=>{if(zn.name===Lt.volume?.name){let Qn=(Ka,Ra)=>{let ns=[],ja=Ka.series[Hn].max;for(let Os=0;Os<Ra.length&&(ns.push(Ra[Os]),!(ja&&Ra[Os]>ja));Os++);return ns};On.space=20,On.filter=Qn,On.ticks={...On.ticks,filter:Qn}}return On},Fn=(On,zn)=>(zn.name===Lt.volume?.name&&(On.range=(Qn,Ka,Ra)=>[0,Ra*7]),On))}}let _n=Pn!==Br.Volume&&Ea!=null&&gs!=null;if(!_n&&!Wn)return un;let oa={},Ta=[];return _n?oa={open:Ya,high:Ea,low:gs,close:ya}:Ta.push(Ya,ya),Wn&&(oa.volume=_a,oa.open=Ya,oa.close=ya),{shouldRenderPrice:_n,renderers:[{fieldMap:oa,indicesOnly:Ta,init:(Ca,Aa)=>{Hn=Aa.volume,Ca.addHook("drawAxes",hc({mode:Pn,fields:Aa,upColor:pn.$W.theme2.visualization.getColorByName(la.up),downColor:pn.$W.theme2.visualization.getColorByName(la.down),flatColor:pn.$W.theme2.visualization.getColorByName(la.flat),volumeAlpha:ra,colorStrategy:jn,candleStyle:ea,flatAsUp:!0}))}}],tweakScale:Fn,tweakAxis:xn}},[ke,W.structureRev,W.series.length]);if(!Lt)return P.createElement($t.a,{panelId:se,fieldConfig:Je,data:W,needsTimeField:!0,needsNumberField:!0});if(rn)for(let Fn in nn[0].fieldMap){let xn=Lt[Fn];xn.config={...xn.config,custom:{...xn.config.custom,hideFrom:{legend:!0,tooltip:!1,viz:!1}}}}const bn=!!(Et&&Et()),Bn=pn.$W.featureToggles.newVizTooltips&&(ht==null||ht()!==za.y.Tooltip);return P.createElement(Di,{frames:[Lt.frame],structureRev:W.structureRev,timeRange:fe,timeZone:Pe,width:Se,height:we,legend:ke.legend,renderers:nn,tweakAxis:In,tweakScale:Jt,options:ke},(Fn,xn)=>(xn.fields.forEach(un=>{un.getLinks=(0,Wi._M)(xn,un,un.state.scopedVars,ct,Pe)}),P.createElement(P.Fragment,null,Bn?P.createElement(fr.xl,{config:Fn,hoverMode:ke.tooltip.mode===St.$N.Single?fr.b3.xOne:fr.b3.xAll,queryZoom:it,clientZoom:!0,render:(un,Rn,Pn,ea=!1,jn,la,Ya)=>{if(Ya)return null;if(bn&&la!=null){Qt(la),jn();return}const Ea=()=>{let gs=un.posToVal(un.cursor.left,"x");Qt({from:gs,to:gs}),jn()};return P.createElement(No.k,{frames:[Lt.frame],seriesFrame:xn,dataIdxs:Rn,seriesIdx:Pn,mode:ke.tooltip.mode,sortOrder:ke.tooltip.sort,isPinned:ea,annotate:bn?Ea:void 0,scrollable:Ws(ke.tooltip)})},maxWidth:ke.tooltip.maxWidth,maxHeight:ke.tooltip.maxHeight}):P.createElement(P.Fragment,null,P.createElement(Eo.j,{config:Fn,onZoom:it,withZoomY:!0}),P.createElement(Ia.T,{data:xn,config:Fn,mode:St.$N.Multi,sync:ht,timeZone:Pe})),Bn?P.createElement(er.W,{annotations:W.annotations??[],config:Fn,timeZone:Pe,newRange:wt,setNewRange:Qt}):W.annotations&&P.createElement(_s,{annotations:W.annotations,config:Fn,timeZone:Pe}),Bn?void 0:bn?P.createElement(ga,{data:xn,timeZone:Pe,config:Fn},({startAnnotating:un})=>P.createElement(fa,{data:xn,config:Fn,timeZone:Pe,replaceVariables:ct,defaultItems:bn?[{items:[{label:"Add annotation",ariaLabel:"Add annotation",icon:"comment-alt",onClick:(Rn,Pn)=>{Pn&&un({coords:Pn.coords})}}]}]:[]})):P.createElement(fa,{data:xn,config:Fn,timeZone:Pe,replaceVariables:ct,defaultItems:[]}),W.annotations&&P.createElement(Oo,{config:Fn,exemplars:W.annotations,timeZone:Pe}),(Dt&&Tt||Bt)&&P.createElement(oi,{config:Fn,fieldConfig:Je,onThresholdsChange:Dt?Tt:void 0}),P.createElement(Lr,{config:Fn,onChangeTimeRange:it}))))};class xl{getSuggestionsForData(se){const{dataSummary:fe}=se;if(!se.data?.series||!fe.hasData||fe.timeFieldCount<1||fe.numberFieldCount<2||fe.numberFieldCount>10)return;const Pe=Ga(se.data.series,ii,R.$.theme2);if(!Pe||Pe.open===Pe.high&&Pe.open===Pe.low)return;se.getListAppender({name:"",pluginId:"candlestick",options:{},fieldConfig:{defaults:{custom:{}},overrides:[]}}).append({name:es.m.Candlestick,options:ii,fieldConfig:{defaults:{},overrides:[]},score:Pe.autoOpenClose?bs.nQ.Good:bs.nQ.Best})}}const Ec=[{label:"Candles",value:Br.Candles},{label:"Volume",value:Br.Volume},{label:"Both",value:Br.CandlesVolume}],yc=[{label:"Candles",value:yr.Candles},{label:"OHLC Bars",value:yr.OHLCBars}],Ol=[{label:"Since Open",value:wo.OpenClose},{label:"Since Prior Close",value:wo.CloseClose}],Dc=W=>W.type===Yn.PU.number;function bi(W,se,fe){let Pe="Auto ";if(fe){const Se=fe[se.key];Se?.config?(Pe+="= "+(0,Za.Ct)(Se),Se===fe?.open&&se.key!=="open"&&(Pe+=` (${se.defaults.join(",")})`)):Pe+=`(${se.defaults.join(",")})`}W.addFieldNamePicker({path:`fields.${se.key}`,name:se.name,description:se.description,settings:{filter:Dc,placeholderText:Pe}})}const Pc=new L.m(vc).useFieldConfig((0,mo.V)(mo.S)).setPanelOptions((W,se)=>{const fe=se.options??ii,Pe=Ga(se.data,fe,R.$.theme2);W.addRadio({path:"mode",name:"Mode",description:"",defaultValue:ii.mode,settings:{options:Ec}}).addRadio({path:"candleStyle",name:"Candle style",description:"",defaultValue:ii.candleStyle,settings:{options:yc},showIf:Se=>Se.mode!==Br.Volume}).addRadio({path:"colorStrategy",name:"Color strategy",description:"",defaultValue:ii.colorStrategy,settings:{options:Ol}}).addColorPicker({path:"colors.up",name:"Up color",defaultValue:Ci.up}).addColorPicker({path:"colors.down",name:"Down color",defaultValue:Ci.down}),bi(W,zs.open,Pe),fe.mode!==Br.Volume&&(bi(W,zs.high,Pe),bi(W,zs.low,Pe)),bi(W,zs.close,Pe),fe.mode!==Br.Candles&&bi(W,zs.volume,Pe),W.addRadio({path:"includeAllFields",name:"Additional fields",description:"Use standard timeseries options to configure any fields not mapped above",defaultValue:ii.includeAllFields,settings:{options:[{label:"Ignore",value:!1},{label:"Include",value:!0}]}}),R.$.featureToggles.newVizTooltips&&ur.D(W,!1,!0,fe),Fr.H(W)}).setDataSupport({annotations:!0,alertStates:!0}).setSuggestionsSupplier(new xl);var Xo=e(70096),sl=e(76885),Il=e(6709),dr=e(10096),Hl=e(16021),Ti=e(91219),Zo=e(27677),Oe=e(62301),Ie=e(80484);const je=W=>({dashlistSectionHeader:(0,K.css)` padding: ${W.spacing(.25,1)}; margin-right: ${W.spacing(1)}; `,dashlistSection:(0,K.css)` margin-bottom: ${W.spacing(2)}; padding-top: 3px; `,dashlistLink:(0,K.css)` display: flex; cursor: pointer; border-bottom: 1px solid ${W.colors.border.weak}; margin-right: ${W.spacing(1)}; padding: ${W.spacing(1)}; align-items: center; &:hover { a { color: ${W.colors.text.link}; text-decoration: underline; } } `,dashlistFolder:(0,K.css)` color: ${W.colors.text.secondary}; font-size: ${W.typography.bodySmall.fontSize}; line-height: ${W.typography.body.lineHeight}; `,dashlistTitle:(0,K.css)` &::after { position: absolute; content: ''; left: 0; top: 0; bottom: 0; right: 0; } `,dashlistLinkBody:(0,K.css)` flex-grow: 1; overflow: hidden; text-overflow: ellipsis; `,dashlistItem:(0,K.css)` position: relative; list-style: none; `});async function lt(W,se){let fe=Promise.resolve([]);if(W.showStarred){const ht={limit:W.maxItems,starred:"true"};fe=(0,Zo.AI)().search(ht)}let Pe=Promise.resolve([]),Se=[];if(W.showRecentlyViewed){let ht=await Oe.A.getDashboardOpened();Se=(0,$e.take)(ht,W.maxItems),Pe=(0,Zo.AI)().search({dashboardUIDs:Se,limit:W.maxItems})}let we=Promise.resolve([]);if(W.showSearch){const ht=W.folderUID===""?"general":W.folderUID,Et={limit:W.maxItems,query:se(W.query,{},"text"),folderUIDs:ht,tag:W.tags.map(Tt=>se(Tt,{},"text")),type:"dash-db"};we=(0,Zo.AI)().search(Et)}const[ke,Je,it]=await Promise.all([fe,we,Pe]);let ct=new Map;for(const ht of Se){const Et=it.find(Tt=>Tt.uid===ht);Et&&ct.set(ht,{...Et,isRecent:!0})}return Je.forEach(ht=>{ht.uid&&(ct.has(ht.uid)?ct.get(ht.uid).isSearchResult=!0:ct.set(ht.uid,{...ht,isSearchResult:!0}))}),ke.forEach(ht=>{ht.uid&&(ct.has(ht.uid)?ct.get(ht.uid).isStarred=!0:ct.set(ht.uid,{...ht,isStarred:!0}))}),ct}function bt(W){const[se,fe]=(0,P.useState)(new Map),Pe=(0,_.useDispatch)();(0,P.useEffect)(()=>{lt(W.options,W.replaceVariables).then(Lt=>{fe(Lt)})},[W.options,W.replaceVariables,W.renderCounter]);const Se=async(Lt,wt)=>{const{uid:Qt,title:nn,url:Jt}=wt;Lt.preventDefault(),Lt.stopPropagation();const In=await(0,Ve.UA)().starDashboard(wt.uid,wt.isStarred),rn=new Map(se);rn.set(wt?.uid??"",{...wt,isStarred:In}),fe(rn),Pe((0,Ti.ci)({id:Qt??"",title:nn,url:Jt,isStarred:In}))},[we,ke,Je]=(0,P.useMemo)(()=>{const Lt=[...se.values()];return[Lt.filter(wt=>wt.isStarred).sort((wt,Qt)=>wt.title.localeCompare(Qt.title)),Lt.filter(wt=>wt.isRecent),Lt.filter(wt=>wt.isSearchResult).sort((wt,Qt)=>wt.title.localeCompare(Qt.title))]},[se]),{showStarred:it,showRecentlyViewed:ct,showHeadings:ht,showSearch:Et}=W.options,Tt=[{header:"Starred dashboards",dashboards:we,show:it},{header:"Recently viewed dashboards",dashboards:ke,show:ct},{header:"Search",dashboards:Je,show:Et}],Dt=(0,k.of)(je),Bt=Ft(W),Gt=Lt=>P.createElement("ul",null,Lt.map(wt=>{let Qt=wt.url;return Qt=sl.kM.appendQueryToUrl(Qt,Bt),Qt=(0,pn.zj)().disableSanitizeHtml?Qt:Ja.sQ.sanitizeUrl(Qt),P.createElement("li",{className:Dt.dashlistItem,key:`dash-${wt.uid}`},P.createElement("div",{className:Dt.dashlistLink},P.createElement("div",{className:Dt.dashlistLinkBody},P.createElement("a",{className:Dt.dashlistTitle,href:Qt},wt.title),wt.folderTitle&&P.createElement("div",{className:Dt.dashlistFolder},wt.folderTitle)),P.createElement(Xa.K,{tooltip:wt.isStarred?`Unmark "${wt.title}" as favorite`:`Mark "${wt.title}" as favorite`,name:wt.isStarred?"favorite":"star",iconType:wt.isStarred?"mono":"default",onClick:nn=>Se(nn,wt)})))}));return P.createElement(B.E,{autoHeightMin:"100%",autoHeightMax:"100%"},Tt.map(({show:Lt,header:wt,dashboards:Qt},nn)=>Lt&&P.createElement("div",{className:Dt.dashlistSection,key:`dash-group-${nn}`},ht&&P.createElement("h6",{className:Dt.dashlistSectionHeader},wt),Gt(Qt))))}function Ft(W){(0,Hl.u)(dr.lE,Ie.og);let se={};return W.options.keepTime&&(se[`$${Il.c.keepTime}`]=!0),W.options.includeVars&&(se[`$${Il.c.includeVars}`]=!0),W.replaceVariables(sl.kM.toUrlParams(se))}async function Kt(W){return W===0?"":(await(0,ve.AI)().get(`/api/folders/id/${W}`,void 0,void 0,{showErrorAlert:!1})).uid}async function ln(W){const se={...W.options,showStarred:W.options.showStarred??W.starred,showRecentlyViewed:W.options.showRecentlyViewed??W.recent,showSearch:W.options.showSearch??W.search,showHeadings:W.options.showHeadings??W.headings,maxItems:W.options.maxItems??W.limit,query:W.options.query??W.query,folderId:W.options.folderId??W.folderId,tags:W.options.tags??W.tags};if(parseFloat(W.pluginVersion||"6.1")<6.3&&["starred","recent","search","headings","limit","query","folderId"].forEach(Se=>delete W[Se]),se.folderId!==void 0){const Pe=se.folderId;try{const Se=await Kt(Pe);se.folderUID=Se,delete se.folderId}catch(Se){console.warn("Dashlist: Error migrating folder ID to UID",Se)}}return se}const an={includeVars:!1,keepTime:!1,maxItems:10,query:"",showHeadings:!0,showRecentlyViewed:!1,showSearch:!1,showStarred:!0,tags:[]},Ut=new L.m(bt).setPanelOptions(W=>{W.addBooleanSwitch({path:"keepTime",name:"Include current time range",defaultValue:an.keepTime}).addBooleanSwitch({path:"includeVars",name:"Include current template variable values",defaultValue:an.includeVars}).addBooleanSwitch({path:"showStarred",name:"Starred",defaultValue:an.showStarred}).addBooleanSwitch({path:"showRecentlyViewed",name:"Recently viewed",defaultValue:an.showRecentlyViewed}).addBooleanSwitch({path:"showSearch",name:"Search",defaultValue:an.showSearch}).addBooleanSwitch({path:"showHeadings",name:"Show headings",defaultValue:an.showHeadings}).addNumberInput({path:"maxItems",name:"Max items",defaultValue:an.maxItems}).addTextInput({path:"query",name:"Query",defaultValue:an.query}).addCustomEditor({path:"folderUID",name:"Folder",id:"folderUID",defaultValue:void 0,editor:function({value:fe,onChange:Pe}){return P.createElement(Xo.d,{clearable:!0,value:fe,onChange:Se=>Pe(Se)})}}).addCustomEditor({id:"tags",path:"tags",name:"Tags",description:"",defaultValue:an.tags,editor(se){return P.createElement(Te.u,{tags:se.value,onChange:se.onChange})}})}).setMigrationHandler(ln);var Un=e(47187),Nn=e(14110),Pa=e(11503);const qn=({onBlur:W,placeholder:se})=>{const fe=(0,P.useRef)(null);(0,P.useEffect)(()=>{fe.current&&fe.current.focus()});const Pe=Se=>{Se.key==="Enter"&&Se.currentTarget.blur()};return P.createElement("input",{type:"text",placeholder:se,onBlur:W,ref:fe,onKeyDown:Pe,"data-testid":"column-input"})},Wa=({divStyle:W,onColumnInputBlur:se})=>{const[fe,Pe]=(0,P.useState)(!1),Se=()=>{Pe(!0)},we=ke=>{const Je=ke.target.value;Je&&se(Je),Pe(!1)};return P.createElement("div",{className:W},fe?P.createElement(qn,{placeholder:"Column Name",onBlur:we}):P.createElement("button",{onClick:Se},"+"))};var ls=e(27183),fs=e(69321);const ms=()=>R.$.featureToggles.enableDatagridEditing,tr="600 13px Inter",Bs="400 13px Inter",La=document.createElement("canvas"),js=20,rl=300,Pd=65,mm="both",fm="number",gm={isContextMenuOpen:!1},pm={isInputOpen:!1},pr="datagrid_panel",hr={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"},hm={name:"A",fields:[],length:0},Cd={kind:fs.dd.Text,data:"",allowOverlay:!0,readonly:!1,displayData:""},bd={columns:fs.I1.empty(),rows:fs.I1.empty()},vm={sticky:!1,tint:!0},Em={fill:!0,sticky:!1};async function qo(W,se){if(se&&ms()){for(let fe=0;fe<W.fields.length;fe++)delete W.fields[fe].config.displayName,delete W.fields[fe].config.displayNameFromDS;return await se([W])}return!1}const Al=(W,se=!1)=>{const fe=La.getContext("2d");return fe.font=se?tr:Bs,fe.measureText(W).width},Td=W=>Math.max(Al(W.name,!0)+Pd,Math.min(rl,W.values.toArray().reduce((se,fe)=>{const Pe=Al(fe?.toString()??"");return Pe>se?Pe:se},0)+js)),Gl=(W,se,fe=!1)=>{const Pe={...W,fields:W.fields.map(Se=>({...Se,values:Se.values.slice()}))};for(const Se of Pe.fields){const we=Se.values.toArray();for(let ke=se.length-1;ke>=0;ke--)fe?we.splice(se[ke],1):we.splice(se[ke],1,null);Se.values=[...we]}return{...Pe,length:Pe.fields[0]?.values.length??0}},Rl=(W,se)=>{const fe=se.x,Pe=se.y,Se=se.x+se.width-1,we={...W,fields:W.fields.map(ke=>({...ke,values:ke.values.slice()}))};for(let ke=fe;ke<=Se;ke++){const Je=we.fields[ke],it=Je.values.toArray();it.splice(Pe,se.height,...new Array(se.height).fill(null)),Je.values=[...it]}return{...we,length:we.fields[0]?.values.length??0}},ym=W=>{const se=W.values.toArray();W.values=se.map(fe=>fe==="undefined"||fe==="null"?null:fe)};function Dm(W){return{accentColor:W.colors.primary.main,accentFg:W.colors.secondary.main,textDark:W.colors.text.primary,textMedium:W.colors.text.secondary,textLight:W.colors.text.secondary,textBubble:W.colors.text.primary,textHeader:W.colors.text.primary,bgCell:W.colors.background.primary,bgCellMedium:W.colors.background.primary,bgHeader:W.colors.background.primary,bgHeaderHasFocus:W.colors.background.secondary,bgHeaderHovered:W.colors.background.secondary,linkColor:W.colors.text.link,fontFamily:W.typography.fontFamily,headerFontStyle:`${W.typography.fontWeightMedium} ${W.typography.fontSize}px`,fgIconHeader:W.colors.secondary.contrastText,bgIconHeader:W.colors.secondary.main}}const Pm=(W,se,fe=!1)=>{const Pe=W.values.get(se);switch(W.type){case Yn.PU.boolean:return{kind:fs.dd.Boolean,data:Pe||!1,allowOverlay:!1,readonly:!1};case Yn.PU.number:return{kind:fs.dd.Number,data:Pe||0,allowOverlay:ms()&&!fe,readonly:!1,displayData:Pe!=null?Pe.toString():""};case Yn.PU.string:return{kind:fs.dd.Text,data:Pe||"",allowOverlay:ms()&&!fe,readonly:!1,displayData:Pe!=null?Pe.toString():""};default:return{kind:fs.dd.Text,data:Pe||"",allowOverlay:ms()&&!fe,readonly:!1,displayData:Pe!=null?Pe.toString():""}}},Ur=(W,se)=>({dataEditor:(0,K.css)` .dvn-scroll-inner > div:nth-child(2) { pointer-events: none !important; } scrollbar-color: ${W.colors.background.secondary} ${W.colors.background.primary}; ::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-track { background: ${W.colors.background.primary}; } ::-webkit-scrollbar-thumb { border-radius: 10px; } ::-webkit-scrollbar-corner { display: none; } `,addColumnDiv:(0,K.css)` width: 120px; display: flex; flex-direction: column; background-color: ${W.colors.background.primary}; button { pointer-events: ${se?"none":"auto"}; border: none; outline: none; height: 37px; font-size: 20px; background-color: ${W.colors.background.primary}; color: ${W.colors.text.primary}; border-right: 1px solid ${W.components.panel.borderColor}; border-bottom: 1px solid ${W.components.panel.borderColor}; transition: background-color 200ms; cursor: pointer; :hover { background-color: ${W.colors.background.secondary}; } } input { height: 37px; border: 1px solid ${W.colors.primary.main}; :focus { outline: none; } } `,renameColumnInput:(0,K.css)` height: 37px; border: 1px solid ${W.colors.primary.main}; :focus { outline: none; } `}),Md=W=>W.rows.length||W.columns.length?!0:W.current===void 0?!1:W.current.range&&!(W.current.range.height===1&&W.current.range.width===1);var xr=(W=>(W.columnResizeStart="columnResizeStart",W.columnResizeEnd="columnResizeEnd",W.columnMove="columnMove",W.updateColumns="updateColumns",W.showColumnRenameInput="showColumnRenameInput",W.hideColumnRenameInput="hideColumnRenameInput",W.openCellContextMenu="openCellContextMenu",W.openHeaderContextMenu="openHeaderContextMenu",W.openHeaderDropdownMenu="openHeaderDropdownMenu",W.closeContextMenu="closeContextMenu",W.multipleCellsSelected="multipleCellsSelected",W.gridSelectionCleared="gridSelectionCleared",W.columnFreezeReset="columnFreezeReset",W.columnFreezeChanged="columnFreezeChanged",W.openSearch="openSearch",W.closeSearch="closeSearch",W))(xr||{});const Cm={columns:[],contextMenuData:gm,renameColumnInputData:pm,gridSelection:bd,columnFreezeIndex:0,toggleSearch:!1,isResizeInProgress:!1},mh=new Map([[Yn.PU.number,fs.Gf.HeaderNumber],[Yn.PU.string,fs.Gf.HeaderTextTemplate],[Yn.PU.boolean,fs.Gf.HeaderBoolean],[Yn.PU.time,fs.Gf.HeaderDate],[Yn.PU.other,fs.Gf.HeaderReference]]),bm=(W,se)=>{let fe=[];switch(se.type){case"columnResizeStart":fe=[...W.columns];const Pe=se.payload;return fe[Pe.columnIndex]={...W.columns[Pe.columnIndex],width:Pe.width},{...W,columns:fe,isResizeInProgress:!0};case"columnMove":fe=[...W.columns];const Se=se.payload,we=W.columns[Se.from].width;let ke=fe.splice(Se.from,1)[0];return ke={...ke,width:we},fe.splice(Se.to,0,ke),{...W,columns:fe};case"columnResizeEnd":return{...W,isResizeInProgress:!1};case"updateColumns":const Je=se.payload;return fe=[...Je.frame.fields.map((wt,Qt)=>{const nn=W.columns.find(In=>In.title===wt.name)?.width;return{title:(0,Za.Ct)(wt,Je.frame),width:nn??Td(wt),icon:mh.get(wt.type),hasMenu:ms(),trailingRowOptions:{targetColumn:--Qt}}})],{...W,columns:fe};case"showColumnRenameInput":return{...W,renameColumnInputData:{...W.renameColumnInputData,isInputOpen:!0}};case"hideColumnRenameInput":return{...W,renameColumnInputData:{...W.renameColumnInputData,isInputOpen:!1}};case"openCellContextMenu":const it=se.payload,ct=it.event,ht=it.cell;return{...W,contextMenuData:{x:ct.bounds.x+ct.localEventX,y:ct.bounds.y+ct.localEventY,column:ht[0]===-1?void 0:ht[0],row:ht[1],isContextMenuOpen:!0,isHeaderMenu:!1}};case"openHeaderContextMenu":const Et=se.payload,Tt=Et.event;return{...W,contextMenuData:{x:Tt.bounds.x+Tt.localEventX,y:Tt.bounds.y+Tt.localEventY,column:Et.columnIndex,row:void 0,isContextMenuOpen:!0,isHeaderMenu:!1}};case"openHeaderDropdownMenu":const Dt=se.payload,Bt=Dt.screenPosition;return{...W,contextMenuData:{x:Bt.x+Bt.width,y:Bt.y+Bt.height,column:Dt.columnIndex,row:void 0,isContextMenuOpen:!0,isHeaderMenu:!0},renameColumnInputData:{x:Bt.x,y:Bt.y,width:Bt.width,height:Bt.height,columnIdx:Dt.columnIndex,isInputOpen:!1,inputValue:Dt.value}};case"closeContextMenu":return{...W,contextMenuData:{isContextMenuOpen:!1}};case"closeSearch":return{...W,toggleSearch:!1};case"openSearch":return{...W,toggleSearch:!0};case"multipleCellsSelected":const Gt=se.payload;return{...W,gridSelection:Gt.selection};case"gridSelectionCleared":return{...W,gridSelection:bd};case"columnFreezeReset":return{...W,columnFreezeIndex:0};case"columnFreezeChanged":const Lt=se.payload;return{...W,columnFreezeIndex:Lt.columnIndex};default:return W}},Tm=({menuData:W,data:se,saveData:fe,closeContextMenu:Pe,dispatch:Se,gridSelection:we,columnFreezeIndex:ke,renameColumnClicked:Je})=>{let it=[],ct=[];const{row:ht,column:Et,x:Tt,y:Dt,isHeaderMenu:Bt}=W;we.rows&&(it=we.rows.toArray()),we.columns&&(ct=we.columns.toArray());let Gt="Delete row";it.length&&it.length>1&&(Gt=`Delete ${it.length} rows`);let Lt="Delete column";ct.length&&ct.length>1&&(Lt=`Delete ${ct.length} columns`);const wt=ht!==void 0&&ht>=0||it.length,Qt=Et!==void 0&&Et>=0&&ht!==void 0||ct.length,nn=ht!==void 0&&ht>=0&&!it.length,Jt=Et!==void 0&&Et>=0&&ht!==void 0&&!ct.length,In=()=>P.createElement(P.Fragment,null,wt?P.createElement(us.D,{label:Gt,onClick:()=>{if(it.length){fe(Gl(se,it,!0)),Se({type:xr.gridSelectionCleared});return}ht!==void 0&&ht>=0&&((0,Nn.rR)(pr,{item:hr.CONTEXT_MENU_ACTION,menu_action:"row_delete"}),fe(Gl(se,[ht],!0)))}}):null,Qt?P.createElement(us.D,{label:Lt,onClick:()=>{if(ct.length){fe({...se,fields:se.fields.filter((bn,Bn)=>!ct.includes(Bn))}),Se({type:xr.gridSelectionCleared});return}Et!==void 0&&Et>=0&&((0,Nn.rR)(pr,{item:hr.CONTEXT_MENU_ACTION,menu_action:"column_delete"}),fe({...se,fields:se.fields.filter((bn,Bn)=>Bn!==Et)}))}}):null,Qt||wt?P.createElement(ls.N,null):null,nn?P.createElement(us.D,{label:"Clear row",onClick:()=>{(0,Nn.rR)(pr,{item:hr.CONTEXT_MENU_ACTION,menu_action:"row_clear"}),fe(Gl(se,[ht]))}}):null,Jt?P.createElement(us.D,{label:"Clear column",onClick:()=>{const bn=se.fields[Et];bn.values=bn.values.map(()=>null),(0,Nn.rR)(pr,{item:hr.CONTEXT_MENU_ACTION,menu_action:"column_clear"}),fe({...se})}}):null,nn||Jt?P.createElement(ls.N,null):null,P.createElement(us.D,{label:"Remove all data",onClick:()=>{(0,Nn.rR)(pr,{item:hr.CONTEXT_MENU_ACTION,menu_action:"remove_all"}),fe(hm)}}),P.createElement(us.D,{label:"Search...",onClick:()=>{(0,Nn.rR)(pr,{item:hr.CONTEXT_MENU_ACTION,menu_action:"open_search"}),Se({type:xr.openSearch})}})),rn=()=>{if(Et==null)return null;const bn=se.fields[Et].type,Bn=[],Fn=Rn=>{Bn.push({label:(0,$e.capitalize)(Rn),options:{targetField:se.fields[Et].name,destinationType:Rn}})};bn===Yn.PU.string?(Fn(Yn.PU.number),Fn(Yn.PU.boolean)):bn===Yn.PU.number?(Fn(Yn.PU.string),Fn(Yn.PU.boolean)):bn===Yn.PU.boolean?(Fn(Yn.PU.number),Fn(Yn.PU.string)):(Fn(Yn.PU.string),Fn(Yn.PU.number),Fn(Yn.PU.boolean));let xn="Set column freeze position";const un=Et+1;return ke===un&&(xn="Unset column freeze"),P.createElement(P.Fragment,null,Bn.length?P.createElement(Sr.r,{label:"Set field type"},Bn.map((Rn,Pn)=>P.createElement(us.D,{key:Pn,label:Rn.label,onClick:()=>{const ea=(0,Ml.s7)(se.fields[Et],Rn.options);Rn.options.destinationType===Yn.PU.string&&ym(ea);const jn={name:se.name,fields:[...se.fields],length:se.length};jn.fields[Et]=ea,(0,Nn.rR)(pr,{item:hr.HEADER_MENU_ACTION,menu_action:"convert_field"}),fe(jn)}}))):null,P.createElement(ls.N,null),P.createElement(us.D,{label:xn,onClick:()=>{(0,Nn.rR)(pr,{item:hr.HEADER_MENU_ACTION,menu_action:"column_freeze"}),Se(ke===un?{type:xr.columnFreezeReset}:{type:xr.columnFreezeChanged,payload:{columnIndex:un}})}}),P.createElement(us.D,{label:"Rename column",onClick:Je}),P.createElement(ls.N,null),P.createElement(us.D,{label:"Delete column",onClick:()=>{(0,Nn.rR)(pr,{item:hr.HEADER_MENU_ACTION,menu_action:"delete_column"}),fe({...se,fields:se.fields.filter((Rn,Pn)=>Pn!==Et)}),Se({type:xr.gridSelectionCleared})}}),P.createElement(us.D,{label:"Clear column",onClick:()=>{const Rn=se.fields[Et];Rn.values=Rn.values.map(()=>null),(0,Nn.rR)(pr,{item:hr.HEADER_MENU_ACTION,menu_action:"clear_column"}),fe({...se})}}))};return P.createElement(Zn.t,{renderMenuItems:Bt?rn:In,x:Tt,y:Dt,onClose:Pe})},ol=({renameColumnData:W,onColumnInputBlur:se,classStyle:fe})=>{const{x:Pe,y:Se,width:we,height:ke,inputValue:Je,columnIdx:it}=W,[ct,ht]=(0,P.useState)({}),[Et,Tt]=(0,P.useState)(Je),Dt=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>{Dt.current?.focus();const wt=Dt.current?.getBoundingClientRect();if(wt){const Qt={right:window.innerWidth<Pe+wt.width,bottom:window.innerHeight<Se+wt.height};ht({position:"fixed",left:Qt.right?Pe-wt.width:Pe,top:Qt.bottom?Se-wt.height:Se,width:we,height:ke})}},[ke,we,Pe,Se]);const Bt=wt=>{const Qt=wt.target.value;Qt&&se(Qt,it)},Gt=wt=>{Tt(wt.target.value)},Lt=wt=>{wt.key==="Enter"&&wt.currentTarget.blur()};return P.createElement(ma.ZL,null,P.createElement("input",{type:"text",className:fe,value:Et,onBlur:Bt,ref:Dt,style:ct,onChange:Gt,onKeyDown:Lt}))};function il({options:W,data:se,id:fe,fieldConfig:Pe,width:Se,height:we}){const[ke,Je]=(0,P.useReducer)(bm,Cm),{onUpdateData:it}=(0,sn.d2)(),{columns:ct,contextMenuData:ht,renameColumnInputData:Et,gridSelection:Tt,columnFreezeIndex:Dt,toggleSearch:Bt,isResizeInProgress:Gt}=ke,Lt=se.series[W.selectedSeries??0],wt=(0,k.$j)(),Qt=Dm(wt);(0,P.useEffect)(()=>{Lt&&Je({type:xr.updateColumns,payload:{frame:Lt}})},[Lt]);const nn=([ra,Hn])=>{const Wn=Lt.fields[ra];return!Wn||Hn>Lt.length?Cd:Pm(Wn,Hn,Md(Tt))},Jt=(ra,Hn)=>{if(Md(Tt))return;const[Wn,_n]=ra,oa={...Lt,fields:Lt.fields.map(Aa=>({...Aa,values:[...Aa.values]}))},Ta=oa.fields[Wn];if(!Ta)return;const Ca=Ta.values.toArray();Ca[_n]=Hn.data,Ta.values=[...Ca],(0,Nn.rR)(pr,{item:hr.EDIT_CELL}),qo(oa,it)},In=ra=>{const Hn=Lt.length??0;(0,Nn.rR)(pr,{item:hr.APPEND_COLUMN}),qo({...Lt,fields:[...Lt.fields,{name:ra,type:Yn.PU.string,config:{},values:new Array(Hn).fill("")}]},it)},rn=()=>{const ra=Lt.fields.map(Hn=>{const Wn=Hn.values.slice();return Wn.push(null),{...Hn,values:Wn}});(0,Nn.rR)(pr,{item:hr.APPEND_ROW}),qo({...Lt,fields:ra,length:Lt.length+1},it)},bn=(ra,Hn,Wn,_n)=>{(0,Nn.rR)(pr,{item:hr.COLUMN_RESIZE}),Je({type:xr.columnResizeStart,payload:{columnIndex:Wn,width:Hn}})},Bn=(ra,Hn,Wn,_n)=>{Je({type:xr.columnResizeEnd})},Fn=()=>{Je({type:xr.closeContextMenu})},xn=ra=>{if(ra.current&&ra.current.range)return(0,Nn.rR)(pr,{item:hr.DELETE_BTN_PRESSED,selection:"grid-cell"}),qo(Rl(Lt,ra.current.range),it),!0;const Hn=ra.rows.toArray(),Wn=ra.columns.toArray();if(Hn.length)return(0,Nn.rR)(pr,{item:hr.DELETE_BTN_PRESSED,selection:"rows"}),qo(Gl(Lt,Hn),it),!0;if(Wn.length){const _n={...Lt,fields:Lt.fields.map((oa,Ta)=>Wn.includes(Ta)?{...oa,values:new Array(Lt.length).fill(null)}:oa)};return(0,Nn.rR)(pr,{item:hr.DELETE_BTN_PRESSED,selection:"columns"}),qo(_n,it),!0}return!1},un=(ra,Hn)=>{Hn.preventDefault(),Je({type:xr.openCellContextMenu,payload:{event:Hn,cell:ra}})},Rn=(ra,Hn)=>{Hn.preventDefault(),Je({type:xr.openHeaderContextMenu,payload:{event:Hn,columnIndex:ra}})},Pn=(ra,Hn)=>{Je({type:xr.openHeaderDropdownMenu,payload:{screenPosition:Hn,columnIndex:ra,value:ke.columns[ra].title}})},ea=async(ra,Hn)=>{const Wn=Lt.fields.map(Ta=>Ta),_n=Wn[ra];Wn.splice(ra,1),Wn.splice(Hn,0,_n),await qo({...Lt,fields:Wn},it)&&((0,Nn.rR)(pr,{item:hr.COLUMN_REORDER}),Je({type:xr.columnMove,payload:{from:ra,to:Hn}}))},jn=(ra,Hn)=>{const Wn=Lt.fields.map(_n=>({..._n,values:_n.values.slice()}));for(const _n of Wn){const oa=_n.values[ra];_n.values.splice(ra,1),_n.values.splice(Hn,0,oa)}(0,Nn.rR)(pr,{item:hr.ROW_REORDER}),qo({...Lt,fields:Wn},it)},la=()=>{(0,Nn.rR)(pr,{item:hr.HEADER_MENU_ACTION,menu_action:"rename_column"}),Je({type:xr.showColumnRenameInput})},Ya=(ra,Hn)=>{const Wn=Lt.fields.map(_n=>_n);Wn[Hn].name=ra,Je({type:xr.hideColumnRenameInput}),qo({...Lt,fields:Wn},it)},Ea=()=>{Je({type:xr.closeSearch})},gs=ra=>{(0,Nn.rR)(pr,{item:hr.GRID_SELECTED}),Je({type:xr.multipleCellsSelected,payload:{selection:ra}})},ya=ra=>{qo(ra,it)};if(!Lt)return P.createElement($t.a,{panelId:fe,fieldConfig:Pe,data:se});if(!ms())return P.createElement($t.a,{panelId:fe,message:"Datagrid is not enabled",fieldConfig:Pe,data:se});if(!document.getElementById("portal")){const ra=document.createElement("div");ra.id="portal",document.body.appendChild(ra)}const _a=Ur(wt,Gt);return P.createElement(P.Fragment,null,P.createElement(Un.D,{className:_a.dataEditor,getCellContent:nn,columns:ct,rows:Lt.length,width:Se,height:we,initialSize:[Se,we],theme:Qt,smoothScrollX:!0,smoothScrollY:!0,overscrollY:50,onCellEdited:ms()?Jt:void 0,getCellsForSelection:ms()?!0:void 0,showSearch:ms()?Bt:!1,onSearchClose:Ea,gridSelection:Tt,onGridSelectionChange:ms()?gs:void 0,onRowAppended:ms()?rn:void 0,onDelete:ms()?xn:void 0,rowMarkers:ms()?mm:fm,onColumnResize:bn,onColumnResizeEnd:Bn,onCellContextMenu:ms()?un:void 0,onHeaderContextMenu:ms()?Rn:void 0,onHeaderMenuClick:ms()?Pn:void 0,trailingRowOptions:vm,rightElement:ms()?P.createElement(Wa,{onColumnInputBlur:In,divStyle:_a.addColumnDiv}):null,rightElementProps:Em,freezeColumns:Dt,onRowMoved:ms()?jn:void 0,onColumnMoved:ms()?ea:void 0}),ht.isContextMenuOpen&&P.createElement(Tm,{menuData:ht,data:Lt,saveData:ya,closeContextMenu:Fn,dispatch:Je,gridSelection:Tt,columnFreezeIndex:Dt,renameColumnClicked:la}),Et.isInputOpen?P.createElement(ol,{onColumnInputBlur:Ya,renameColumnData:Et,classStyle:_a.renameColumnInput}):null)}const Sd={selectedSeries:0},Mm=new L.m(il).setPanelOptions((W,se)=>{const fe=se.data.map((Pe,Se)=>({value:Se,label:Pe.refId}));return se.options&&!fe.map(Pe=>Pe.value).includes(se.options.selectedSeries??0)&&(se.options.selectedSeries=Sd.selectedSeries),W.addSelect({path:"selectedSeries",name:"Select series",defaultValue:Sd.selectedSeries,settings:{options:fe}})});class Sm extends P.Component{constructor(){super(...arguments),this.subscription=new cr.yU,this.state={}}componentDidMount(){const{eventBus:se}=this.props;this.subscription.add(se.subscribe(is.b_,fe=>{this.setState({event:fe})})),this.subscription.add(se.subscribe(is.ql,fe=>{this.setState({event:fe})})),this.subscription.add(se.subscribe(os.kb,fe=>{this.setState({event:fe})})),this.subscription.add(se.subscribe(os.Tq,fe=>{this.setState({event:fe})}))}componentWillUnmount(){this.subscription.unsubscribe()}render(){const{event:se}=this.state;if(!se)return P.createElement("div",null,"no events yet");const{type:fe,payload:Pe,origin:Se}=se;return P.createElement(B.E,{autoHeightMin:"100%",autoHeightMax:"100%"},P.createElement("h3",null,"Origin: ",Se?.path),P.createElement("span",null,"Type: ",fe),!!Pe&&P.createElement(P.Fragment,null,P.createElement("pre",null,JSON.stringify(Pe.point,null," ")),Pe.data&&P.createElement(zr.e,{data:Pe.data,rowIndex:Pe.rowIndex,columnIndex:Pe.columnIndex})))}}var xm=e(36120);let Cc=100;class Om extends P.PureComponent{constructor(se){super(se),this.history=new xm.$({capacity:40,append:"head"}),this.eventObserver={next:Pe=>{const Se=Pe.origin;this.history.add({key:Cc++,type:Pe.type,path:Se?.path,payload:Pe.payload}),this.setState({counter:Cc})}},this.state={counter:Cc};const fe=[];fe.push(se.eventBus.getStream(is.b_).subscribe(this.eventObserver)),fe.push(se.eventBus.getStream(is.ql).subscribe(this.eventObserver)),fe.push(se.eventBus.getStream(is.LO).subscribe(this.eventObserver)),this.subs=fe}componentWillUnmount(){for(const se of this.subs)se.unsubscribe()}render(){return P.createElement(B.E,{autoHeightMin:"100%",autoHeightMax:"100%"},this.history.map((se,fe)=>P.createElement("div",{key:se.key},JSON.stringify(se.path)," ",se.type," / X:",JSON.stringify(se.payload.x)," / Y:",JSON.stringify(se.payload.y))))}}var po=e(75059);class Im extends P.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(se){const{data:fe,options:Pe}=this.props;if(se.data!==fe&&(this.counters.dataChanged++,Pe.counters?.schemaChanged)){const Se=se.data?.series,we=fe.series;we&&Se&&((0,Ot.J3)(we,Se,Ot.bW)||this.counters.schemaChanged++)}return!0}render(){const{data:se,options:fe}=this.props,Pe=fe.counters??{render:!1,dataChanged:!1,schemaChanged:!1};this.counters.render++;const Se=Date.now(),we=Se-this.lastRender;this.lastRender=Se;const ke=po.AS.get(po.gy.lastNotNull);return P.createElement("div",null,P.createElement("div",null,P.createElement(Xa.K,{name:"step-backward",title:"reset counters",onClick:this.resetCounters,tooltip:"Step back"}),P.createElement("span",null,Pe.render&&P.createElement("span",null,"Render: ",this.counters.render,"\xA0"),Pe.dataChanged&&P.createElement("span",null,"Data: ",this.counters.dataChanged,"\xA0"),Pe.schemaChanged&&P.createElement("span",null,"Schema: ",this.counters.schemaChanged,"\xA0"),P.createElement("span",null,"TIME: ",we,"ms"))),se.series&&se.series.map((Je,it)=>P.createElement("div",{key:`${it}/${Je.refId}`},P.createElement("h4",null,(0,Za.Ri)(Je,it)," (",Je.length,")"),P.createElement("table",{className:"filter-table"},P.createElement("thead",null,P.createElement("tr",null,P.createElement("td",null,"Field"),P.createElement("td",null,"Type"),P.createElement("td",null,"Last"))),P.createElement("tbody",null,Je.fields.map((ct,ht)=>{const Et=ke.reduce(ct,!1,!1)[ke.id];return P.createElement("tr",{key:`${ht}/${ct.name}`},P.createElement("td",null,(0,Za.Ct)(ct,Je,se.series)),P.createElement("td",null,ct.type),P.createElement("td",null,`${Et}`))}))))))}}var Am=e(10354);function Rm(W){const se=(0,sn.d2)(),fe=Pe=>{se.onInstanceStateChange({name:Pe.currentTarget.value})};return P.createElement(P.Fragment,null,P.createElement(Vt.D,{label:"State name"},P.createElement(Am.p,{value:se.instanceState?.name??"",onChange:fe})))}function Lm({value:W,context:se,onChange:fe,item:Pe}){return P.createElement("div",null,"Current value: ",se.instanceState?.name," ")}var jr=(W=>(W.Cursor="cursor",W.Events="events",W.Render="render",W.State="State",W.ThrowError="ThrowError",W))(jr||{});class Bm extends P.Component{render(){const{options:se}=this.props;switch(se.mode){case jr.Events:return P.createElement(Om,{eventBus:this.props.eventBus});case jr.Cursor:return P.createElement(Sm,{eventBus:this.props.eventBus});case jr.State:return P.createElement(Rm,{...this.props});case jr.ThrowError:throw new Error("I failed you and for that i am deeply sorry");default:return P.createElement(Im,{...this.props})}}}const fh=new L.m(Bm).useFieldConfig().setPanelOptions(W=>{W.addSelect({path:"mode",name:"Mode",defaultValue:jr.Render,settings:{options:[{label:"Render",value:jr.Render},{label:"Events",value:jr.Events},{label:"Cursor",value:jr.Cursor},{label:"Cursor",value:jr.Cursor},{label:"Share state",value:jr.State},{label:"Throw error",value:jr.ThrowError}]}}).addCustomEditor({id:"stateView",path:"stateView",name:"State view",defaultValue:"",showIf:({mode:se})=>se===jr.State,editor:Lm}).addBooleanSwitch({path:"counters.render",name:"Render Count",defaultValue:!0,showIf:({mode:se})=>se===jr.Render}).addBooleanSwitch({path:"counters.dataChanged",name:"Data Changed Count",defaultValue:!0,showIf:({mode:se})=>se===jr.Render}).addBooleanSwitch({path:"counters.schemaChanged",name:"Schema Changed Count",defaultValue:!0,showIf:({mode:se})=>se===jr.Render}).addDashboardPicker({path:"dashboardUID",name:"Dashboard",settings:{placeholder:"Select dashboard",isClearable:!0}})});var bc=e(76365),Kn=e(85194);function or(W,se={}){(0,Nn.rR)(`grafana_flamegraph_${W}`,{app:S.Jk.Unknown,grafana_version:R.$.buildInfo.version,...se})}const xd=W=>{const se=(0,bc.oA)(W.data.series[0]);return se?P.createElement($t.a,{panelId:W.id,data:W.data,message:(0,bc.Ik)(se)}):P.createElement(Kn.A,{data:W.data.series[0],stickyHeader:!1,getTheme:()=>R.$.theme2,showFlameGraphOnly:W.options?.showFlameGraphOnly??!1,onTableSymbolClick:()=>or("table_item_selected"),onViewSelected:fe=>or("view_selected",{view:fe}),onTextAlignSelected:fe=>or("text_align_selected",{align:fe}),onTableSort:fe=>or("table_sort_selected",{sort:fe}),disableCollapsing:!R.$.featureToggles.flameGraphItemCollapsing})};class Tc{getListWithDefaults(se){return se.getListAppender({name:es.m.FlameGraph,pluginId:"flamegraph"})}getSuggestionsForData(se){if(!se.data)return;const fe=se.data.series[0];!fe||(0,bc.oA)(fe)||this.getListWithDefaults(se).append({name:es.m.FlameGraph})}}const Mc=new L.m(xd).setSuggestionsSupplier(new Tc);var Um=e(14738),ll=e(62930);const Od=(W,se)=>{const fe="linear-gradient(to right, #5182CC 0%, #245BAF 100%)",Pe=se?fe:"linear-gradient(to right, #f05a28 0%, #fbca0a 100%)",Se=se?fe:"linear-gradient(to right, #FBCA0A 0%, #F05A28 100%)",we=W.isDark?Pe:Se;return` background-color: ${W.colors.background.secondary}; margin-right: ${W.spacing(4)}; border: 1px solid ${W.colors.border.weak}; border-bottom-left-radius: ${W.shape.borderRadius(2)}; border-bottom-right-radius: ${W.shape.borderRadius(2)}; position: relative; max-height: 230px; ${W.breakpoints.down("xxl")} { margin-right: ${W.spacing(2)}; } &::before { display: block; content: ' '; position: absolute; left: 0; right: 0; height: 2px; top: 0; background-image: ${we}; } `},Id=(0,K.css)` padding: 16px; `,Nm=({card:W})=>{const se=(0,k.of)(jl,W.done);return P.createElement("div",{className:se.card},P.createElement("div",{className:Id},P.createElement("a",{href:`${W.href}?utm_source=grafana_gettingstarted`,className:se.url,onClick:()=>(0,Nn.rR)("grafana_getting_started_docs",{title:W.title,link:W.href})},P.createElement("div",{className:se.heading},W.done?"complete":W.heading),P.createElement("h4",{className:se.title},W.title))),P.createElement("a",{href:`${W.learnHref}?utm_source=grafana_gettingstarted`,className:se.learnUrl,target:"_blank",rel:"noreferrer",onClick:()=>(0,Nn.rR)("grafana_getting_started_docs",{title:W.title,link:W.learnHref})},"Learn how in the docs ",P.createElement(_e.I,{name:"external-link-alt"})))},jl=(W,se)=>({card:(0,K.css)` ${Od(W,se)} min-width: 230px; ${W.breakpoints.down("md")} { min-width: 192px; } `,heading:(0,K.css)` text-transform: uppercase; color: ${se?W.v1.palette.blue95:"#FFB357"}; margin-bottom: ${W.spacing(2)}; `,title:(0,K.css)` margin-bottom: ${W.spacing(2)}; `,url:(0,K.css)` display: inline-block; `,learnUrl:(0,K.css)` border-top: 1px solid ${W.colors.border.weak}; position: absolute; bottom: 0; padding: 8px 16px; width: 100%; `});var cl=e(33390);const wm=({card:W})=>{const se=(0,k.of)(Fm,W.done);return P.createElement("a",{className:se.card,target:"_blank",rel:"noreferrer",href:`${W.href}?utm_source=grafana_gettingstarted`,onClick:fe=>Sc(fe,W)},P.createElement("div",{className:Id},P.createElement("div",{className:se.type},W.type),P.createElement("div",{className:se.heading},W.done?"complete":W.heading),P.createElement("h4",{className:se.cardTitle},W.title),P.createElement("div",{className:se.info},W.info)))},Sc=(W,se)=>{W.preventDefault(),cl.A.get(se.key)||cl.A.set(se.key,!0),(0,Nn.rR)("grafana_getting_started_tutorial",{title:se.title})},Fm=(W,se)=>({card:(0,K.css)` ${Od(W,se)} width: 460px; min-width: 460px; ${W.breakpoints.down("xl")} { min-width: 368px; } ${W.breakpoints.down("lg")} { min-width: 272px; } `,type:(0,K.css)` color: ${W.colors.primary.text}; text-transform: uppercase; `,heading:(0,K.css)` text-transform: uppercase; color: ${W.colors.primary.text}; margin-bottom: ${W.spacing(1)}; `,cardTitle:(0,K.css)` margin-bottom: ${W.spacing(2)}; `,info:(0,K.css)` margin-bottom: ${W.spacing(2)}; `,status:(0,K.css)` display: flex; justify-content: flex-end; `}),Wm=({step:W})=>{const se=(0,k.of)(Mi);return P.createElement("div",{className:se.setup},P.createElement("div",{className:se.info},P.createElement("h2",{className:se.title},W.title),P.createElement("p",null,W.info)),P.createElement("div",{className:se.cards},W.cards.map((fe,Pe)=>{const Se=`${fe.title}-${Pe}`;return fe.type==="tutorial"?P.createElement(wm,{key:Se,card:fe}):P.createElement(Nm,{key:Se,card:fe})})))},Mi=W=>({setup:(0,K.css)` display: flex; width: 95%; `,info:(0,K.css)` width: 172px; margin-right: 5%; ${W.breakpoints.down("xxl")} { margin-right: ${W.spacing(4)}; } ${W.breakpoints.down("sm")} { display: none; } `,title:(0,K.css)` color: ${W.v1.palette.blue95}; `,cards:(0,K.css)` overflow-x: scroll; overflow-y: hidden; width: 100%; display: flex; justify-content: flex-start; `});var Km=e(31193);const Yl="Grafana fundamentals",dl="Create users and teams",Ad="getting.started.",Fo=`${Ad}${Yl.replace(" ","-").trim().toLowerCase()}`,$m=`${Ad}${dl.replace(" ","-").trim().toLowerCase()}`,Vm=()=>[{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:Yl,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(cl.A.get(Fo)),key:Fo,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(W=>{W((0,Km.tR)().getMetricSources().filter(se=>se.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,Zo.AI)().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:$m,check:()=>Promise.resolve(cl.A.get($m)),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 W=await(0,Zo.AI)().get("/api/plugins",{embedded:0,core:0});return Promise.resolve(W.length>0)},done:!1}]}];class Ql extends P.PureComponent{constructor(){super(...arguments),this.state={checksDone:!1,currentStep:0,steps:Vm()},this.onForwardClick=()=>{(0,Nn.rR)("grafana_getting_started_button_to_advanced_tutorials"),this.setState(se=>({currentStep:se.currentStep+1}))},this.onPreviousClick=()=>{(0,Nn.rR)("grafana_getting_started_button_to_basic_tutorials"),this.setState(se=>({currentStep:se.currentStep-1}))},this.dismiss=()=>{const{id:se}=this.props,fe=(0,Ve.UA)().getCurrent(),Pe=fe?.getPanelById(se);(0,Nn.rR)("grafana_getting_started_remove_panel"),fe?.removePanel(Pe),Zo.IB.put("/api/user/helpflags/1",void 0,{showSuccessAlert:!1}).then(Se=>{dr.TP.user.helpFlags1=Se.helpFlags1})}}async componentDidMount(){const{steps:se}=this.state,fe=se.map(async Se=>{const we=Se.cards.map(async Je=>Je.check().then(it=>({...Je,done:it}))),ke=await Promise.all(we);return{...Se,done:ke.every(Je=>Je.done),cards:ke}}),Pe=await Promise.all(fe);this.setState({currentStep:Pe[0].done?1:0,steps:Pe,checksDone:!0})}render(){const{checksDone:se,currentStep:fe,steps:Pe}=this.state,Se=_m(),we=Pe[fe];return P.createElement("div",{className:Se.container},se?P.createElement(P.Fragment,null,P.createElement(Y.$n,{variant:"secondary",fill:"text",className:Se.dismiss,onClick:this.dismiss},"Remove this panel"),fe===Pe.length-1&&P.createElement(Y.$n,{className:(0,K.cx)(Se.backForwardButtons,Se.previous),onClick:this.onPreviousClick,"aria-label":"To basic tutorials",icon:"angle-left",variant:"secondary"}),P.createElement("div",{className:Se.content},P.createElement(Wm,{step:we})),fe<Pe.length-1&&P.createElement(Y.$n,{className:(0,K.cx)(Se.backForwardButtons,Se.forward),onClick:this.onForwardClick,"aria-label":"To advanced tutorials",icon:"angle-right",variant:"secondary"})):P.createElement("div",{className:Se.loading},P.createElement("div",{className:Se.loadingText},"Checking completed setup steps"),P.createElement(ll.y,{size:"xl",inline:!0})))}}const _m=(0,Pr.N)(()=>{const W=R.$.theme2;return{container:(0,K.css)({display:"flex",flexDirection:"column",height:"100%",backgroundSize:"cover",padding:`${W.spacing(4)} ${W.spacing(2)} 0`}),content:(0,K.css)({label:"content",display:"flex",justifyContent:"center",[W.breakpoints.down("xxl")]:{marginLeft:W.spacing(3),justifyContent:"flex-start"}}),header:(0,K.css)({label:"header",marginBottom:W.spacing(3),display:"flex",flexDirection:"column",[W.breakpoints.down("lg")]:{flexDirection:"row"}}),headerLogo:(0,K.css)({height:"58px",paddingRight:W.spacing(2),display:"none",[W.breakpoints.up("md")]:{display:"block"}}),heading:(0,K.css)({label:"heading",marginRight:W.spacing(3),marginBottom:W.spacing(3),flexGrow:1,display:"flex",[W.breakpoints.up("md")]:{marginBottom:0}}),backForwardButtons:(0,K.css)({position:"absolute",top:"50%",transform:"translateY(-50%)"}),previous:(0,K.css)({left:"10px",[W.breakpoints.down("md")]:{left:0}}),forward:(0,K.css)({right:"10px",[W.breakpoints.down("md")]:{right:0}}),dismiss:(0,K.css)({alignSelf:"flex-end",textDecoration:"underline",marginBottom:W.spacing(1)}),loading:(0,K.css)({display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}),loadingText:(0,K.css)({marginRight:W.spacing(1)})}}),Rd=new L.m(Ql).setNoPadding();var Vr=e(77678),xc=e(81297);const ul={bucketCount:30,bucketOffset:0},Oc={fillOpacity:80,gradientMode:St.on.None,lineWidth:1};function Ld(W,se){return Math.floor(W/se)*se}function ml(W,se){return Math.ceil(W/se)*se}function Bd(W){return W.fields[0].type===Yn.PU.string?1:W.fields[1].values[0]-W.fields[0].values[0]}function zm(W){return W.fields[0].type===Yn.PU.string?1:W.fields[1].values[1]-W.fields[0].values[1]}const Ic=(W,se)=>{let{min:fe,max:Pe}=W.fields[2].config,Se=new xs.e,we=W.fields[0].type===Yn.PU.string,ke=Bd(W),Je=zm(W),it=Je/ke,ct=Je!==ke,ht=(wt,Qt,nn,Jt,In,rn)=>{let bn=wt.axes[Qt]._space,Bn=wt.valToPos(wt.data[0][0]+ke,"x")-wt.valToPos(wt.data[0][0],"x"),Fn=Ld(fe??wt.data[0][0],ke),xn=ml(Pe??wt.data[0][wt.data[0].length-1]+ke,ke),un=[],Rn=Math.ceil(bn/Bn);for(let Pn=0,ea=Fn;ea<=xn;Pn++,ea+=ke)!(Pn%Rn)&&un.push(ea);return un};Se.addScale({scaleKey:"x",isTime:!1,distribution:we?St.L4.Ordinal:ct?St.L4.Log:St.L4.Linear,log:2,orientation:St.Lt.Horizontal,direction:St.ON.Right,range:ct?(wt,Qt,nn)=>ws.A.rangeLog(Qt,nn*it,2,!0):(wt,Qt,nn)=>{fe!=null&&(Qt=fe),Pe!=null&&(nn=Pe);let Jt=wt.data[0][wt.data[0].length-1];return Qt=ml(Qt,ke),nn=!we&&nn===Jt?nn+ke:Ld(nn,ke),[Qt,nn]}}),Se.addScale({scaleKey:"y",isTime:!1,distribution:St.L4.Linear,orientation:St.Lt.Vertical,direction:St.ON.Up,softMin:0});const Et=W.fields[0].display,Tt=wt=>(0,ds.cN)(Et(wt));Se.addAxis({scaleKey:"x",isTime:!1,placement:St.vM.Bottom,incrs:we?[1]:ct?void 0:Vr.rW,splits:ct||we?void 0:ht,values:we?(wt,Qt)=>Qt:(wt,Qt)=>{const nn=Qt.map(Tt),Jt=nn.reduce((Bn,Fn)=>Math.max((0,Zt.kD)(Fn,vn.pi).width,Bn),0),In=10,rn=wt.bbox.width/((Jt+In)*devicePixelRatio),bn=Math.ceil(nn.length/rn);return nn.map((Bn,Fn)=>Fn%bn===0?Bn:null)},theme:se});let Bt=W.fields[2].display;Se.addAxis({scaleKey:"y",isTime:!1,placement:St.vM.Left,formatValue:(wt,Qt)=>(0,ds.cN)(Bt(wt,Qt)),theme:se}),Se.setCursor({points:{show:!1},drag:{x:!0,y:!1,setScale:!0}});let Gt=ws.A.paths.bars({align:1,size:[1,1/0]}),Lt=0;for(let wt=2;wt<W.fields.length;wt++){const Qt=W.fields[wt];Qt.state=Qt.state??{},Qt.state.seriesIndex=Lt++;const nn={...Oc,...Qt.config.custom},Jt="y",In=(0,Vs.Qi)(Qt),bn=(0,Vs.lz)(Qt,se).color;Se.addSeries({scaleKey:Jt,lineWidth:nn.lineWidth,lineColor:bn,fillOpacity:nn.fillOpacity,theme:se,colorMode:In,pathBuilder:Gt,show:!nn.hideFrom?.viz,gradientMode:nn.gradientMode,thresholds:Qt.config.thresholds,hardMin:Qt.config.min,hardMax:Qt.config.max,softMin:nn.axisSoftMin,softMax:nn.axisSoftMax,dataFrameFieldIndex:Qt.state.origin})}return Se},Rs=W=>{let se=[];for(const fe of W.fields)fe.name!==Vr.dA&&se.push(fe.values);for(let fe=1;fe<se.length;fe++){let Pe=se[fe];for(let Se=0;Se<Pe.length;Se++)Pe[Se]===0&&(Pe[Se]=null)}return se};class km extends P.Component{constructor(se){super(se),this.state=this.prepState(se)}prepState(se,fe=!0){let Pe={alignedData:[]};const{alignedFrame:Se}=se;return Se&&(Pe={alignedData:Rs(Se)},fe&&(Pe.config=Ic(Se,this.props.theme))),Pe}renderLegend(se){const{legend:fe}=this.props;return!se||fe.showLegend===!1?null:P.createElement(ua.$,{data:this.props.rawSeries,config:se,maxHeight:"35%",maxWidth:"60%",...fe})}componentDidUpdate(se){const{structureRev:fe,alignedFrame:Pe,bucketSize:Se,bucketCount:we}=this.props;if(Pe!==se.alignedFrame){let ke=this.prepState(this.props,!1);ke&&(we!==se.bucketCount||Se!==se.bucketSize||this.props.options!==se.options||this.state.config===void 0||fe!==se.structureRev||!fe)&&(ke.config=Ic(Pe,this.props.theme)),ke&&this.setState(ke)}}render(){const{width:se,height:fe,children:Pe,alignedFrame:Se}=this.props,{config:we}=this.state;return we?P.createElement(wn.KU,{width:se,height:fe,legend:this.renderLegend(we)},(ke,Je)=>P.createElement(xc.Z,{config:this.state.config,data:this.state.alignedData,width:ke,height:Je},Pe?Pe(we,Se):null)):null}}const Ud=({data:W,options:se,width:fe,height:Pe})=>{const Se=(0,k.$j)(),we=(0,P.useMemo)(()=>{if(!W.series.length)return;if(W.series.forEach((it,ct)=>{it.fields.forEach((ht,Et)=>{ht.state={...ht.state,origin:{frameIndex:ct,fieldIndex:Et}}})}),W.series.length===1){const it=(0,Vr.ix)(W.series[0]);if(it)return(0,Vr.cg)(it)}const Je=(0,Vr.p3)(W.series,se);if(Je)return(0,Vr.cg)(Je,Se)},[W.series,se,Se]);if(!we||!we.fields.length)return P.createElement("div",{className:"panel-empty"},P.createElement("p",null,"No histogram found in response"));const ke=Bd(we);return P.createElement(km,{options:se,theme:Se,legend:se.legend,rawSeries:W.series,structureRev:W.structureRev,width:fe,height:Pe,alignedFrame:we,bucketSize:ke,bucketCount:se.bucketCount},(Je,it)=>null)};function Ll(W){if(W?.length!==1)return!1;const se=W[0];if(se.fields.length<3||!(0,Vr.NX)(se.fields[0].name)||!(0,Vr.H1)(se.fields[1].name))return!1;for(const fe of se.fields)if(fe.type!==Yn.PU.number)return!1;return!0}const Hm=new L.m(Ud).setPanelOptions(W=>{W.addCustomEditor({id:"__calc__",path:"__calc__",name:"Values",description:"Showing frequencies that are calculated in the query",editor:()=>null,showIf:(se,fe)=>Ll(fe)}).addNumberInput({path:"bucketCount",name:Vr.Rt.bucketCount.name,description:Vr.Rt.bucketCount.description,settings:{placeholder:`Default: ${ul.bucketCount}`,min:0},showIf:(se,fe)=>!Ll(fe)}).addNumberInput({path:"bucketSize",name:Vr.Rt.bucketSize.name,description:Vr.Rt.bucketSize.description,settings:{placeholder:"Auto",min:0},defaultValue:ul.bucketSize,showIf:(se,fe)=>!Ll(fe)}).addNumberInput({path:"bucketOffset",name:Vr.Rt.bucketOffset.name,description:Vr.Rt.bucketOffset.description,settings:{placeholder:`Default: ${ul.bucketOffset}`,min:0},showIf:(se,fe)=>!Ll(fe)}).addBooleanSwitch({path:"combine",name:Vr.Rt.combine.name,description:Vr.Rt.combine.description,defaultValue:ul.combine,showIf:(se,fe)=>!Ll(fe)}),Fr.H(W)}).useFieldConfig({standardOptions:{[$s.uo.Color]:{settings:{byValueSupport:!1,bySeriesSupport:!0,preferThresholdsMode:!1},defaultValue:{mode:Ss.Y.PaletteClassic}}},useCustomConfig:W=>{const se=Oc;W.addSliderInput({path:"lineWidth",name:"Line width",defaultValue:se.lineWidth,settings:{min:0,max:10,step:1}}).addSliderInput({path:"fillOpacity",name:"Fill opacity",defaultValue:se.fillOpacity,settings:{min:0,max:100,step:1}}).addRadio({path:"gradientMode",name:"Gradient mode",defaultValue:oo.t.fillGradient[0].value,settings:{options:oo.t.fillGradient}}),io.e(W)}});var Po=e(55004),Ac=e(60029);const Nd=[{label:"Grafana",value:Po.qD.Grafana,description:"Core grafana live features"},{label:"Data Sources",value:Po.qD.DataSource,description:"Data sources with live support"},{label:"Plugins",value:Po.qD.Plugin,description:"Plugins with live support"}];class wd extends P.PureComponent{constructor(){super(...arguments),this.state={namespaces:[],paths:[]},this.onScopeChanged=se=>{se.value&&this.props.onChange({scope:se.value,namespace:void 0,path:void 0})},this.onNamespaceChanged=se=>{this.props.onChange({scope:this.props.value?.scope,namespace:se.value,path:void 0})},this.onPathChanged=se=>{const{value:fe,onChange:Pe}=this.props;Pe({scope:fe.scope,namespace:fe.namespace,path:se.value})}}async componentDidMount(){this.updateSelectOptions()}async componentDidUpdate(se){this.props.value!==se.value&&this.updateSelectOptions()}async updateSelectOptions(){this.setState({namespaces:[],paths:[]})}render(){const{namespaces:se,paths:fe}=this.state,{scope:Pe,namespace:Se,path:we}=this.props.value,ke=Gm(pn.$W.theme2);return P.createElement(P.Fragment,null,P.createElement(cn.F,{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."),P.createElement("div",null,P.createElement("div",{className:ke.dropWrap},P.createElement(Ac.J,null,"Scope"),P.createElement(he.l6,{options:Nd,value:Nd.find(Je=>Je.value===Pe),onChange:this.onScopeChanged})),Pe&&P.createElement("div",{className:ke.dropWrap},P.createElement(Ac.J,null,"Namespace"),P.createElement(he.l6,{options:se,value:se.find(Je=>Je.value===Se)??(Se?{label:Se,value:Se}:void 0),onChange:this.onNamespaceChanged,allowCustomValue:!0,backspaceRemovesValue:!0})),Pe&&Se&&P.createElement("div",{className:ke.dropWrap},P.createElement(Ac.J,null,"Path"),P.createElement(he.l6,{options:fe,value:Si(fe,we),onChange:this.onPathChanged,allowCustomValue:!0,backspaceRemovesValue:!0}))))}}function Si(W,se){const fe=W.find(Pe=>Pe.value===se);if(fe)return fe;if(se)return{label:se,value:se}}const Gm=(0,Pr.N)(W=>({dropWrap:(0,K.css)` margin-bottom: ${W.spacing(1)}; `}));var Fd=e(9631),li=e(39070),Rc=e(78731),jm=e(24022),Lc=e(32372),xi=e(1173),Ym=e(77093),Oi=e(65885);function ci(W){const{data:se,height:fe,width:Pe,options:Se,fieldConfig:we,id:ke,timeRange:Je}=W,it=(0,k.$j)(),ct=(0,sn.d2)(),ht=(0,Oi.gy)(se.series)?(0,Oi.S5)(se.series):se.series,Et=ht?.length,Tt=ht[0]?.fields.length,Dt=Wd(ht,Se),Bt=ht[Dt];let Gt=fe;if(!Et||!Tt)return P.createElement($t.a,{panelId:ke,fieldConfig:we,data:se});if(Et>1){const nn=it.spacing.gridSize*it.components.height.md,Jt=it.spacing.gridSize;Gt=fe-nn-Jt}const Lt=ct.sync&&ct.sync()!==za.y.Off,wt=P.createElement(Ym.X,{height:Gt,width:Pe,data:Bt,noHeader:!Se.showHeader,showTypeIcons:Se.showTypeIcons,resizable:!0,initialSortBy:Se.sortBy,onSortByChange:nn=>Bc(nn,W),onColumnResize:(nn,Jt)=>Kd(nn,Jt,W),onCellFilterAdded:ct.onAddAdHocFilter,footerOptions:Se.footer,enablePagination:Se.footer?.enablePagination,cellHeight:Se.cellHeight,timeRange:Je,enableSharedCrosshair:R.$.featureToggles.tableSharedCrosshair&&Lt});if(Et===1)return wt;const Qt=ht.map((nn,Jt)=>({label:(0,Za.Ri)(nn),value:Jt}));return P.createElement("div",{className:Uc.wrapper},wt,P.createElement("div",{className:Uc.selectWrapper},P.createElement(he.l6,{options:Qt,value:Qt[Dt],onChange:nn=>Qm(nn,W)})))}function Wd(W,se){return se.frameIndex>0&&se.frameIndex<W.length?se.frameIndex:0}function Kd(W,se,fe){const{fieldConfig:Pe}=fe,{overrides:Se}=Pe,we=xi.Ct.byName,ke="custom.width",Je=Se.find(it=>it.matcher.id===we&&it.matcher.options===W);if(Je){const it=Je.properties.find(ct=>ct.id===ke);it?it.value=se:Je.properties.push({id:ke,value:se})}else Se.push({matcher:{id:we,options:W},properties:[{id:ke,value:se}]});fe.onFieldConfigChange({...Pe,overrides:Se})}function Bc(W,se){se.onOptionsChange({...se.options,sortBy:W})}function Qm(W,se){se.onOptionsChange({...se.options,frameIndex:W.value||0})}const Uc={wrapper:(0,K.css)` display: flex; flex-direction: column; justify-content: space-between; height: 100%; `,selectWrapper:(0,K.css)` padding: 8px 8px 0px 8px; `};var Wo=(W=>(W.Raw="raw",W.JSON="json",W.Auto="auto",W.None="none",W))(Wo||{});class Jm extends P.PureComponent{constructor(se){super(se),this.styles=Jl(R.$.theme2),this.streamObserver={next:fe=>{(0,Po.ew)(fe)?this.setState({status:fe,changed:Date.now()}):(0,Po.Z7)(fe)?this.setState({message:fe.message,changed:Date.now()}):console.log("ignore",fe)}},this.unsubscribe=()=>{this.subscription&&(this.subscription.unsubscribe(),this.subscription=void 0)},this.onSaveJSON=fe=>{const{options:Pe,onOptionsChange:Se}=this.props;try{const we=JSON.parse(fe);Se({...Pe,json:we})}catch(we){console.log("Error reading JSON",we)}},this.onPublishClicked=async()=>{const{addr:fe}=this.state;if(!fe){console.log("invalid address");return}const Pe=this.props.options?.json;if(!Pe){console.log("nothing to publish");return}const Se=await(0,Rc.oF)().publish(fe,Pe);console.log("onPublishClicked (response from publish)",Se)},this.isValid=!!(0,Rc.oF)(),this.state={changed:0}}async componentDidMount(){this.loadChannel()}componentWillUnmount(){this.subscription&&this.subscription.unsubscribe()}componentDidUpdate(se){this.props.options?.channel!==se.options?.channel&&this.loadChannel()}async loadChannel(){const se=this.props.options?.channel;if(!(0,Po.aj)(se)){console.log("INVALID",se),this.unsubscribe(),this.setState({addr:void 0});return}if((0,$e.isEqual)(se,this.state.addr)){console.log("Same channel",this.state.addr);return}const fe=(0,Rc.oF)();if(!fe){console.log("INVALID",se),this.unsubscribe(),this.setState({addr:void 0});return}this.unsubscribe(),console.log("LOAD",se);try{this.subscription=fe.getStream(se).subscribe(this.streamObserver),this.setState({addr:se,error:void 0})}catch(Pe){this.setState({addr:void 0,error:Pe})}}renderNotEnabled(){const se=`[feature_toggles] enable = live`;return P.createElement(cn.F,{title:"Grafana Live",severity:"info"},P.createElement("p",null,"Grafana live requires a feature flag to run"),P.createElement("b",null,"custom.ini:"),P.createElement("pre",null,se))}renderMessage(se){const{options:fe}=this.props,{message:Pe}=this.state;if(!Pe)return P.createElement("div",null,P.createElement("h4",null,"Waiting for data:"),fe.channel?.scope,"/",fe.channel?.namespace,"/",fe.channel?.path);if(fe.message===Wo.JSON)return P.createElement(jm.B,{json:Pe,open:5});if(fe.message===Wo.Auto&&Pe instanceof Fd.k9){const Se={series:(0,Wi.we)({data:[Pe],theme:R.$.theme2,replaceVariables:ke=>ke,fieldConfig:{defaults:{},overrides:[]}}),state:li.Gu.Streaming},we={...this.props,options:{frameIndex:0,showHeader:!0}};return P.createElement(ci,{...we,data:Se,height:se})}return P.createElement("pre",null,JSON.stringify(Pe))}renderPublish(se){const{options:fe}=this.props;return P.createElement(P.Fragment,null,P.createElement(Lc.B,{height:se-32,language:"json",value:fe.json?JSON.stringify(fe.json,null,2):"{ }",onBlur:this.onSaveJSON,onSave:this.onSaveJSON,showMiniMap:!1,showLineNumbers:!0}),P.createElement("div",{style:{height:32}},P.createElement(Y.$n,{onClick:this.onPublishClicked},"Publish")))}renderStatus(){const{status:se}=this.state;if(se?.state===Po.ZF.Connected)return;let fe="";return se&&(fe=this.styles.status[se.state]),P.createElement("div",{className:(0,K.cx)(fe,this.styles.statusWrap)},se?.state)}renderBody(){const{status:se}=this.state,{options:fe,height:Pe}=this.props;if(fe.publish){if(fe.message===Wo.None)return P.createElement("div",null,this.renderPublish(Pe));const Se=Pe/2;return P.createElement("div",null,P.createElement("div",{style:{height:Se,overflow:"hidden"}},P.createElement(B.E,{autoHeightMin:"100%",autoHeightMax:"100%"},this.renderMessage(Se))),P.createElement("div",null,this.renderPublish(Se)))}return fe.message===Wo.None?P.createElement("pre",null,JSON.stringify(se)):P.createElement("div",{style:{overflow:"hidden",height:Pe}},P.createElement(B.E,{autoHeightMin:"100%",autoHeightMax:"100%"},this.renderMessage(Pe)))}render(){if(!this.isValid)return this.renderNotEnabled();const{addr:se,error:fe}=this.state;return se?fe?P.createElement("div",null,P.createElement("h2",null,"ERROR"),P.createElement("div",null,JSON.stringify(fe))):P.createElement(P.Fragment,null,this.renderStatus(),this.renderBody()):P.createElement(cn.F,{title:"Grafana Live",severity:"info"},"Use the panel editor to pick a channel")}}const Jl=(0,Pr.N)(W=>({statusWrap:(0,K.css)` margin: auto; position: absolute; top: 0; right: 0; background: ${W.components.panel.background}; padding: 10px; z-index: ${W.zIndex.modal}; `,status:{[Po.ZF.Pending]:(0,K.css)` border: 1px solid ${W.v1.palette.orange}; `,[Po.ZF.Connected]:(0,K.css)` border: 1px solid ${W.colors.success.main}; `,[Po.ZF.Connecting]:(0,K.css)` border: 1px solid ${W.v1.palette.brandWarning}; `,[Po.ZF.Disconnected]:(0,K.css)` border: 1px solid ${W.colors.warning.main}; `,[Po.ZF.Shutdown]:(0,K.css)` border: 1px solid ${W.colors.error.main}; `,[Po.ZF.Invalid]:(0,K.css)` border: 1px solid red; `}})),Xm=new L.m(Jm).setPanelOptions(W=>{W.addCustomEditor({category:["Channel"],id:"channel",path:"channel",name:"Channel",editor:wd,defaultValue:{}}),W.addRadio({path:"message",name:"Show Message",description:"Display the last message received on this channel",settings:{options:[{value:Wo.Raw,label:"Raw Text"},{value:Wo.JSON,label:"JSON"},{value:Wo.Auto,label:"Auto"},{value:Wo.None,label:"None"}]},defaultValue:Wo.JSON}).addBooleanSwitch({path:"publish",name:"Show Publish",description:"Display a form to publish values",defaultValue:!1})});var Ii=e(9557),Nc=e(96192),Zm=e(81166),qm=e(17888),ef=e(7030),$d=e(93463),tf=e(14647),wc=e(69147),Vd=e(19347);const Fc=W=>{const[se,fe]=(0,P.useState)(new Map);return(0,Z.A)(async()=>{if(!W){fe(new Map);return}const Pe=await Promise.all(W.filter(Se=>!!Se.datasource?.uid).map(Se=>(0,Vd.l)().get(Se.datasource?.uid).then(we=>({key:Se.refId,ds:we}))));fe(new Map(Pe.map(({key:Se,ds:we})=>[Se,we])))},[W]),se},nf=({data:W,timeZone:se,fieldConfig:fe,options:{showLabels:Pe,showTime:Se,wrapLogMessage:we,showCommonLabels:ke,prettifyLogMessage:Je,sortOrder:it,dedupStrategy:ct,enableLogDetails:ht,showLogContextToggle:Et},id:Tt})=>{const Dt=it===St.uH.Ascending,Bt=(0,k.of)(af),[Gt,Lt]=(0,P.useState)(0),wt=(0,P.useRef)(null),[Qt,nn]=(0,P.useState)(null),Jt=W.timeRange,In=Fc(W.request?.targets),[rn,bn]=(0,P.useState)(null);let Bn=(0,P.useRef)();const{eventBus:Fn}=(0,sn.d2)(),xn=(0,P.useCallback)(Wn=>{Wn?Fn.publish(new is.b_({point:{time:Wn.timeEpochMs}})):Fn.publish(new is.ql)},[Fn]),un=(0,P.useCallback)(()=>{nn(null),Bn.current&&Bn.current()},[Bn]),Rn=(0,P.useCallback)((Wn,_n)=>{nn(Wn),Bn.current=_n},[Bn]),Pn=(0,P.useCallback)(async Wn=>await _d(Wn,Jt),[Jt]),ea=(0,P.useCallback)(Wn=>{if(!Wn.dataFrame.refId||!In||!Et&&W.request?.app!==S.Jk.Dashboard&&W.request?.app!==S.Jk.PanelEditor&&W.request?.app!==S.Jk.PanelViewer)return!1;const _n=In.get(Wn.dataFrame.refId);return(0,Ii.Ol)(_n)},[In,Et,W.request?.app]),jn=(0,P.useCallback)(()=>!(W.request?.app!==S.Jk.Dashboard&&W.request?.app!==S.Jk.PanelEditor&&W.request?.app!==S.Jk.PanelViewer),[W.request?.app]),la=(0,P.useCallback)(async(Wn,_n,oa)=>{if(!_n.dataFrame.refId||!In)return Promise.resolve({data:[]});const Ta=W.request?.targets[0];if(!Ta)return Promise.resolve({data:[]});const Ca=In.get(_n.dataFrame.refId);return(0,Ii.Ol)(Ca)?Ca.getLogRowContext(Wn,oa,Ta):Promise.resolve({data:[]})},[W.request?.targets,In]),Ya=(0,P.useCallback)((Wn,_n)=>{if(!Wn.dataFrame.refId||!In)return P.createElement(P.Fragment,null);const oa=W.request?.targets[0];if(!oa)return P.createElement(P.Fragment,null);const Ta=In.get(Wn.dataFrame.refId);return!(0,Ii.wj)(Ta)||!Ta.getLogRowContextUi?P.createElement(P.Fragment,null):Ta.getLogRowContextUi(Wn,_n,oa)},[W.request?.targets,In]),[Ea,gs,ya]=(0,P.useMemo)(()=>{const Wn=W?(0,wc.HT)(W.series,W.request?.intervalMs,void 0,W.request?.targets):null,_n=Wn?.rows||[],oa=Wn?.meta?.find(Ca=>Ca.label===wc.yR),Ta=(0,wc.M0)(_n,ct);return[_n,Ta,oa]},[W,ct]);(0,P.useLayoutEffect)(()=>{Dt&&wt.current?Lt(wt.current.offsetHeight):Lt(0)},[Dt,Ea]);const _a=(0,P.useCallback)((Wn,_n)=>(0,Nc.QL)({field:Wn,rowIndex:_n,range:W.timeRange}),[W]),ra=(0,P.useCallback)(Wn=>{rn?.scrollTo({top:Wn.offsetTop,behavior:"smooth"})},[rn]);if(!W||Ea.length===0)return P.createElement(qm.a,{fieldConfig:fe,panelId:Tt,data:W,needsStringField:!0});const Hn=()=>P.createElement("div",{className:(0,K.cx)(Bt.labelContainer,Dt&&Bt.labelContainerAscending)},P.createElement("span",{className:Bt.label},"Common labels:"),P.createElement($d.A,{labels:ya?ya.value:{labels:"(no common labels)"}}));return P.createElement(P.Fragment,null,Qt&&P.createElement(Zm.V,{open:Qt!==null,row:Qt,onClose:un,getRowContext:(Wn,_n)=>la(Wn,Qt,_n),logsSortOrder:it,timeZone:se,getLogRowContextUi:Ya}),P.createElement(B.E,{autoHide:!0,scrollTop:Gt,scrollRefCallback:Wn=>bn(Wn)},P.createElement("div",{className:Bt.container,ref:wt},ke&&!Dt&&Hn(),P.createElement(tf.k,{containerRendered:wt.current!==null,scrollIntoView:ra,permalinkedRowId:sf()?.logs?.id??void 0,onPermalinkClick:jn()?Pn:void 0,logRows:Ea,showContextToggle:ea,deduplicatedRows:gs,dedupStrategy:ct,showLabels:Pe,showTime:Se,wrapLogMessage:we,prettifyLogMessage:Je,timeZone:se,getFieldLinks:_a,logsSortOrder:it,enableLogDetails:ht,previewLimit:Dt?Ea.length:void 0,onLogRowHover:xn,app:S.Jk.Dashboard,onOpenContext:Rn}),ke&&Dt&&Hn())))},af=W=>({container:(0,K.css)({marginBottom:W.spacing(1.5)}),labelContainer:(0,K.css)({margin:W.spacing(0,0,.5,.5),display:"flex",alignItems:"center"}),labelContainerAscending:(0,K.css)({margin:W.spacing(.5,0,.5,0)}),label:(0,K.css)({marginRight:W.spacing(.5),fontSize:W.typography.bodySmall.fontSize,fontWeight:W.typography.fontWeightMedium})});function sf(){const se=sl.kM.getUrlSearchParams()?.panelState;if(se&&Array.isArray(se)&&se?.length>0&&typeof se[0]=="string")try{return JSON.parse(se[0])}catch(fe){console.error("error parsing logsPanelState",fe)}}async function _d(W,se){if(W.rowId===void 0||!W.dataFrame.refId)return;const fe={logs:{id:W.uid}},Pe=new URL(window.location.href);return Pe.searchParams.set("panelState",JSON.stringify(fe)),Pe.searchParams.set("from",(0,ae.yT)(se.from).valueOf().toString(10)),Pe.searchParams.set("to",(0,ae.yT)(se.to).valueOf().toString(10)),await(0,ef.V)(Pe.toString()),Promise.resolve()}class rf{getSuggestionsForData(se){const fe=se.getListAppender({name:"",pluginId:"logs",options:{},fieldConfig:{defaults:{custom:{}},overrides:[]}}),{dataSummary:Pe}=se;!Pe.hasData||!Pe.hasTimeField||!Pe.hasStringField||(Pe.preferredVisualisationType==="logs"?fe.append({name:es.m.Logs,score:bs.nQ.Best}):fe.append({name:es.m.Logs}))}}const of=new L.m(nf).setPanelOptions(W=>{W.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:St.fY.none,label:"None",description:Ii._C[St.fY.none]},{value:St.fY.exact,label:"Exact",description:Ii._C[St.fY.exact]},{value:St.fY.numbers,label:"Numbers",description:Ii._C[St.fY.numbers]},{value:St.fY.signature,label:"Signature",description:Ii._C[St.fY.signature]}]},defaultValue:St.fY.none}).addRadio({path:"sortOrder",name:"Order",description:"",settings:{options:[{value:St.uH.Descending,label:"Newest first"},{value:St.uH.Ascending,label:"Oldest first"}]},defaultValue:St.uH.Descending})}).setSuggestionsSupplier(new rf);var lf=e(69386),zd=e(62372),Yr=e(4172);function Dr(W){const{width:se,options:{feedUrl:fe=zd.$,showImage:Pe}}=W,{state:Se,getNews:we}=(0,Yr.n)(fe);return(0,P.useEffect)(()=>{const ke=W.eventBus.subscribe(ft._,we);return()=>{ke.unsubscribe()}},[we,W.eventBus]),(0,P.useEffect)(()=>{we()},[we]),Se.error?P.createElement(cn.F,{title:"Error loading RSS feed"},"Make sure that the feed URL is correct and that CORS is configured correctly on the server. See"," ",P.createElement("a",{style:{textDecoration:"underline"},href:"https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/news/"},"News panel documentation. ",P.createElement(_e.I,{name:"external-link-alt"}))):Se.loading?P.createElement("div",null,"Loading..."):Se.value?P.createElement(B.E,{autoHeightMin:"100%",autoHeightMax:"100%"},Se.value.map((ke,Je)=>P.createElement(lf.K,{key:Je,index:Je,width:se,showImage:Pe,data:Se.value}))):null}const kd={showImage:!0},Hd=new L.m(Dr).setPanelOptions(W=>{W.addTextInput({path:"feedUrl",name:"URL",description:"Supports RSS and Atom feeds",settings:{placeholder:zd.$},defaultValue:kd.feedUrl}).addBooleanSwitch({path:"showImage",name:"Show image",description:"Controls if the news item social (og:image) image is shown above text content",defaultValue:kd.showImage})});var Gd=e(56323),Wc=e(29995),gh=e(89227),Kc=e(98361),Xl=e(33434),jd=e(44916),Yd=e(4118),cf=e(35472),fl=e(84140),Bl=e(59796),$c=e(3139);let Qd=0;const Jd=()=>Qd++;function df(W){const se=(0,P.useRef)(null);return se.current===null&&(se.current=W+Jd()),se.current.toString()}var di=(W=>(W.Donut="donut",W.Pie="pie",W))(di||{}),Io=(W=>(W.Name="name",W.Percent="percent",W.Value="value",W))(Io||{}),ui=(W=>(W.Percent="percent",W.Value="value",W))(ui||{});const Xd={values:[]},ph={displayLabels:[]};function Zd(W){return!W.field.custom?.hideFrom?.viz&&!isNaN(W.display.numeric)}function qd(W,se){return se.display.numeric+W}const uf=({fieldDisplayValues:W,pieType:se,width:fe,height:Pe,highlightedTitle:Se,displayLabels:we=[],tooltipOptions:ke})=>{const Je=(0,k.$j)(),it=df("PieChart"),ct=(0,k.of)(Vc),ht=(0,Yd.A)(),{containerRef:Et,TooltipInPortal:Tt}=(0,cf.A)({detectBounds:!0,scroll:!0}),Dt=W.filter(Zd),Bt=rn=>rn.display.numeric,Gt=rn=>`${it}-${(0,fl.A)(rn).toHex()}`,Lt=rn=>`url(#${Gt(rn)})`,wt=we.length>0,Qt=ke.mode!=="none"&&ht.tooltipOpen,nn=Dt.reduce(qd,0),Jt=pf(fe,Pe,se),In=[...new Set(Dt.map(rn=>rn.display.color??Ss.F))];return P.createElement("div",{className:ct.container},P.createElement("svg",{width:Jt.size,height:Jt.size,ref:Et,style:{overflow:"visible"}},P.createElement(Xl.A,{top:Jt.position,left:Jt.position},In.map(rn=>P.createElement(Kc.A,{key:rn,id:Gt(rn),from:ff(rn,Je),to:gf(rn,Je),fromOffset:Jt.gradientFromOffset,toOffset:"1",gradientUnits:"userSpaceOnUse",cx:0,cy:0,radius:Jt.outerRadius})),P.createElement(jd.A,{data:Dt,pieValue:Bt,outerRadius:Jt.outerRadius,innerRadius:Jt.innerRadius,cornerRadius:3,padAngle:.005},rn=>P.createElement(P.Fragment,null,rn.arcs.map(bn=>{const Bn=bn.data.display.color??Ss.F,Fn=au(Se,bn);return bn.data.hasLinks&&bn.data.getLinks?P.createElement(Bl.e,{key:bn.index,links:bn.data.getLinks},xn=>P.createElement(eu,{tooltip:ht,highlightState:Fn,arc:bn,pie:rn,fill:Lt(Bn),openMenu:xn.openMenu,tooltipOptions:ke})):P.createElement(eu,{key:bn.index,highlightState:Fn,tooltip:ht,arc:bn,pie:rn,fill:Lt(Bn),tooltipOptions:ke})}),wt&&rn.arcs.map(bn=>{const Bn=au(Se,bn);return P.createElement(mf,{arc:bn,key:bn.index,highlightState:Bn,outerRadius:Jt.outerRadius,innerRadius:Jt.innerRadius,displayLabels:we,total:nn,color:Je.colors.text.primary})}))))),Qt?P.createElement(Tt,{key:Math.random(),top:ht.tooltipTop,className:ct.tooltipPortal,left:ht.tooltipLeft,unstyled:!0,applyPositionStyle:!0},P.createElement($c.o,{series:ht.tooltipData})):null)};function eu({arc:W,pie:se,highlightState:fe,openMenu:Pe,fill:Se,tooltip:we,tooltipOptions:ke}){const Je=(0,k.$j)(),it=(0,k.of)(Vc),{eventBus:ct}=(0,sn.d2)(),ht=(0,P.useCallback)(Dt=>{ct?.publish({type:is.ql.type,payload:{raw:Dt,x:0,y:0,dataId:W.data.display.title}}),we.hideTooltip()},[ct,W,we]),Et=(0,P.useCallback)(Dt=>{ct?.publish({type:is.b_.type,payload:{raw:Dt,x:0,y:0,dataId:W.data.display.title}});const Bt=Dt.currentTarget.ownerSVGElement;if(Bt){const Gt=(0,gh.A)(Bt,Dt);we.showTooltip({tooltipLeft:Gt.x,tooltipTop:Gt.y,tooltipData:tu(se,W,ke)})}},[ct,W,we,se,ke]),Tt=su(fe,it);return P.createElement("g",{key:W.data.display.title,className:Tt,onMouseMove:ke.mode!=="none"?Et:void 0,onMouseOut:ht,onClick:Pe,"data-testid":ye.Tp.components.Panels.Visualization.PieChart.svgSlice},P.createElement("path",{d:se.path({...W}),fill:Se,stroke:Je.colors.background.primary,strokeWidth:1}))}function mf({arc:W,outerRadius:se,innerRadius:fe,displayLabels:Pe,total:Se,color:we,highlightState:ke}){const Je=(0,k.of)(Vc),it=fe===0?se/6:fe,[ct,ht]=nu(W,se,it);if(!(W.endAngle-W.startAngle>=.3))return null;let Tt=Pe.includes(Io.Name)?Math.min(Math.max(se/150*14,12),30):Math.min(Math.max(se/100*14,12),36);return P.createElement("g",{className:su(ke,Je)},P.createElement("text",{fill:we,x:ct,y:ht,dy:".33em",fontSize:Tt,fontWeight:500,textAnchor:"middle",pointerEvents:"none"},Pe.includes(Io.Name)&&P.createElement("tspan",{x:ct,dy:"1.2em"},W.data.display.title),Pe.includes(Io.Value)&&P.createElement("tspan",{x:ct,dy:"1.2em"},(0,ds.cN)(W.data.display)),Pe.includes(Io.Percent)&&P.createElement("tspan",{x:ct,dy:"1.2em"},(W.data.display.numeric/Se*100).toFixed(W.data.field.decimals??0)+"%")))}function tu(W,se,fe){return fe.mode==="multi"?W.arcs.filter(Pe=>{const Se=Pe.data.field;return Se&&!Se.custom?.hideFrom?.tooltip&&!Se.custom?.hideFrom?.viz}).map(Pe=>({color:Pe.data.display.color??Ss.F,label:Pe.data.display.title,value:(0,ds.cN)(Pe.data.display),isActive:Pe.index===se.index})):[{color:se.data.display.color??Ss.F,label:se.data.display.title,value:(0,ds.cN)(se.data.display)}]}function nu(W,se,fe){const Pe=(se+fe)/2,Se=(+W.startAngle+ +W.endAngle)/2-Math.PI/2;return[Math.cos(Se)*Pe,Math.sin(Se)*Pe]}function ff(W,se){return(0,fl.A)(W).darken(20*(se.isDark?1:-.7)).spin(4).toRgbString()}function gf(W,se){return(0,fl.A)(W).darken(10*(se.isDark?1:-.7)).spin(-4).toRgbString()}function pf(W,se,fe,Pe=16){const Se=Math.min(se,W),we=(Se-Pe*2)/2,ke=fe===di.Pie?we:Math.max(we/3,20),Je=we-ke,it=(Se-Pe*2)/2,ct=1-(we-Je)/we;return{position:it+Pe,size:Se,outerRadius:we,innerRadius:Je,gradientFromOffset:ct}}var hf=(W=>(W[W.Highlighted=0]="Highlighted",W[W.Deemphasized=1]="Deemphasized",W[W.Normal=2]="Normal",W))(hf||{});function au(W,se){return W?W===se.data.display.title?0:1:2}function su(W,se){switch(W){case 0:return se.svgArg.highlighted;case 1:return se.svgArg.deemphasized;case 2:default:return se.svgArg.normal}}const Vc=W=>({container:(0,K.css)` width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; `,svgArg:{normal:(0,K.css)` transition: all 200ms ease-in-out; `,highlighted:(0,K.css)` transition: all 200ms ease-in-out; transform: scale3d(1.03, 1.03, 1); `,deemphasized:(0,K.css)` transition: all 200ms ease-in-out; fill-opacity: 0.5; `},tooltipPortal:(0,K.css)` ${(0,va.getTooltipContainerStyles)(W)} `}),ru={displayMode:St.lm.List,showLegend:!0,placement:"right",calcs:[],values:[ui.Percent]};function vf(W){const{data:se,timeZone:fe,fieldConfig:Pe,replaceVariables:Se,width:we,height:ke,options:Je,id:it}=W,ct=(0,k.$j)(),ht=Ef(),Et=(0,Gd.PI)({fieldConfig:Pe,reduceOptions:Je.reduceOptions,data:se.series,theme:ct,replaceVariables:Se,timeZone:fe});return ou(Et)?P.createElement(wn.KU,{width:we,height:ke,legend:Zl(W,Et)},(Tt,Dt)=>P.createElement(uf,{width:Tt,height:Dt,highlightedTitle:ht,fieldDisplayValues:Et,tooltipOptions:Je.tooltip,pieType:Je.pieType,displayLabels:Je.displayLabels})):P.createElement($t.a,{panelId:it,fieldConfig:Pe,data:se})}function Zl(W,se){const fe=W.options.legend??ru;if(fe.showLegend===!1)return;const Pe=se.filter(Zd).reduce(qd,0),Se=se.sort((we,ke)=>isNaN(we.display.numeric)?1:isNaN(ke.display.numeric)?-1:ke.display.numeric-we.display.numeric).map((we,ke)=>{const Je=we.field.custom?.hideFrom??{};if(Je.legend)return;const it=!!Je.viz,ct=we.display;return{label:ct.title??"",color:ct.color??Ss.F,yAxis:1,disabled:it,getItemKey:()=>(ct.title??"")+ke,getDisplayValues:()=>{const ht=fe.values??[];let Et=[];if(ht.includes(ui.Value)&&Et.push({numeric:ct.numeric,text:(0,ds.cN)(ct),title:"Value"}),ht.includes(ui.Percent)){const Tt=it?0:ct.numeric/Pe,Dt=Tt*100;Et.push({numeric:Tt,percent:Dt,text:it||isNaN(Tt)?W.fieldConfig.defaults.noValue??"-":Dt.toFixed(we.field.decimals??0)+"%",title:ht.length>1?"Percent":""})}return Et}}}).filter(we=>!!we);return P.createElement(wn.KU.Legend,{placement:fe.placement,width:fe.width},P.createElement(kn.t,{items:Se,seriesVisibilityChangeBehavior:Wc.K.Hide,placement:fe.placement,displayMode:fe.displayMode}))}function ou(W){return W.some(se=>se.view?.dataFrame.length)}function Ef(){const[W,se]=(0,P.useState)(),{eventBus:fe}=(0,sn.d2)();return(0,P.useEffect)(()=>{const Pe=ke=>{se(ke.payload.dataId)},Se=ke=>{se(void 0)},we=new cr.yU;return we.add(fe.getStream(is.b_).subscribe({next:Pe})),we.add(fe.getStream(is.ql).subscribe({next:Se})),()=>{we.unsubscribe()}},[se,fe]),W}const iu=(W,se,fe)=>{if(se==="grafana-piechart-panel"&&fe.angular){const Pe=fe.angular,Se=[];let we=W.options;if(Pe.aliasColors)for(const ke of Object.keys(Pe.aliasColors)){const Je=Pe.aliasColors[ke];Je&&Se.push({matcher:{id:xi.Ct.byName,options:ke},properties:[{id:$s.uo.Color,value:{mode:Ss.Y.Fixed,fixedColor:Je}}]})}if(W.fieldConfig={overrides:Se,defaults:{unit:Pe.format,decimals:Pe.decimals?Pe.decimals:0}},we.legend={placement:"right",values:[],displayMode:St.lm.Table,showLegend:!0,calcs:[]},Pe.valueName)switch(we.reduceOptions={calcs:[]},Pe.valueName){case"current":we.reduceOptions.calcs=["lastNotNull"];break;case"min":we.reduceOptions.calcs=["min"];break;case"max":we.reduceOptions.calcs=["max"];break;case"avg":we.reduceOptions.calcs=["mean"];break;case"total":we.reduceOptions.calcs=["sum"];break}switch(Pe.legendType){case"Under graph":we.legend.placement="bottom";break;case"Right side":we.legend.placement="right";break}switch(Pe.pieType){case"pie":we.pieType=di.Pie;break;case"donut":we.pieType=di.Donut;break}return Pe.legend&&(Pe.legend.show||(we.legend.showLegend=!1),Pe.legend.values&&we.legend.values.push(ui.Value),Pe.legend.percentage&&we.legend.values.push(ui.Percent)),Pe.legendType==="On graph"&&(we.legend.showLegend=!1,we.displayLabels=[Io.Name],Pe.legend.values&&we.displayLabels.push(Io.Value),Pe.legend.percentage&&we.displayLabels.push(Io.Percent)),we}return{}};class yf{getSuggestionsForData(se){const fe=se.getListAppender({name:es.m.PieChart,pluginId:"piechart",options:{reduceOptions:{values:!1,calcs:["lastNotNull"]},displayLabels:[Io.Percent],legend:{calcs:[],displayMode:St.lm.Hidden,placement:"right",values:[],showLegend:!1}}}),{dataSummary:Pe}=se;if(Pe.hasNumberField){if(Pe.hasStringField&&Pe.frameCount===1){if(Pe.rowCountTotal>30||Pe.rowCountTotal<2)return;fe.append({name:es.m.PieChart,options:{reduceOptions:{values:!0,calcs:[]}}}),fe.append({name:es.m.PieChartDonut,options:{reduceOptions:{values:!0,calcs:[]},pieType:di.Donut}});return}Pe.numberFieldCount>30||Pe.numberFieldCount<2||(fe.append({name:es.m.PieChart}),fe.append({name:es.m.PieChartDonut,options:{pieType:di.Donut}}))}}}const lu=new L.m(vf).setPanelChangeHandler(iu).useFieldConfig({disableStandardOptions:[$s.uo.Thresholds],standardOptions:{[$s.uo.Color]:{settings:{byValueSupport:!1,bySeriesSupport:!0,preferThresholdsMode:!1},defaultValue:{mode:Ss.Y.PaletteClassic}}},useCustomConfig:W=>{io.e(W)}}).setPanelOptions(W=>{(0,jo.L)(W),W.addRadio({name:"Piechart type",description:"How the piechart should be rendered",path:"pieType",settings:{options:[{value:di.Pie,label:"Pie"},{value:di.Donut,label:"Donut"}]},defaultValue:di.Pie}).addMultiSelect({name:"Labels",path:"displayLabels",description:"Select the labels to be displayed in the pie chart",settings:{options:[{value:Io.Percent,label:"Percent"},{value:Io.Name,label:"Name"},{value:Io.Value,label:"Value"}]}}),ur.D(W),Fr.H(W,!1),W.addMultiSelect({name:"Legend values",path:"legend.values",category:["Legend"],settings:{options:[{value:ui.Percent,label:"Percent"},{value:ui.Value,label:"Value"}]},showIf:se=>se.legend.showLegend!==!1})}).setSuggestionsSupplier(new yf);var _c=e(36373),cu=e(11082),Ul=e(34163),Ai=e(82389);const ql=({data:W,alignedData:se,seriesIdx:fe,datapointIdx:Pe,timeZone:Se,onAnnotationAdd:we})=>{const ke=(0,k.$j)();if(!W||Pe==null)return null;const Je=se.fields[fe],it=[],ct=new Set;if(Je.getLinks){const rn=Je.values[Pe],bn=Je.display?Je.display(rn):{text:`${rn}`,numeric:+rn};Je.getLinks({calculatedValue:bn,valueRowIndex:Pe}).forEach(Bn=>{const Fn=`${Bn.title}/${Bn.href}`;ct.has(Fn)||(it.push(Bn),ct.add(Fn))})}const ht=se.fields[0],Et=ht.display||(0,ha.J)({field:ht,timeZone:Se,theme:ke}),Tt=Je.state?.origin,Dt=Je.display||(0,ha.J)({field:Je,timeZone:Se,theme:ke}),Bt=Je.values[Pe],Gt=Dt(Bt),Lt=Tt?(0,Za.Ct)(W[Tt.frameIndex].fields[Tt.fieldIndex],W[Tt.frameIndex],W):null,wt=(0,vs.GY)(Je,Pe);let Qt;wt&&(Qt=ht.values[wt]);const nn=ht.values[Pe];let Jt=null,In=null;if(Qt){const rn=Qt&&(0,vs.c5)(Qt-nn);In=P.createElement(P.Fragment,null,P.createElement("br",null),P.createElement("strong",null,"Duration:")," ",rn),Jt=P.createElement(P.Fragment,null," to"," ",P.createElement("strong",null,Et(ht.values[wt]).text))}return P.createElement("div",null,P.createElement("div",{style:{fontSize:ke.typography.bodySmall.fontSize}},Lt,P.createElement("br",null),P.createElement($c.g,{label:Gt.text,color:Gt.color||Ss.F,isActive:!0}),"From ",P.createElement("strong",null,Et(ht.values[Pe]).text),Jt,In),P.createElement("div",{style:{margin:ke.spacing(1,-1,-1,-1),borderTop:`1px solid ${ke.colors.border.weak}`}},we&&P.createElement(us.D,{label:"Add annotation",icon:"comment-alt",onClick:we}),it.length>0&&it.map((rn,bn)=>P.createElement(us.D,{key:bn,icon:"external-link-alt",target:rn.target,label:rn.title,url:rn.href,onClick:rn.onClick}))))};ql.displayName="StateTimelineTooltip";var du=e(11389),uu=e(58749),mu=e(92663),Df=e(10875),Pf=e(21164);const fu=({frames:W,seriesFrame:se,dataIdxs:fe,seriesIdx:Pe,mode:Se=St.$N.Single,sortOrder:we=St.xB.None,scrollable:ke=!1,isPinned:Je,annotate:it,timeRange:ct,withDuration:ht})=>{const Et=(0,k.of)(No.$),Tt=se.fields[0],Dt=Pe!=null?fe[Pe]:fe.find(Qt=>Qt!=null),Bt=Tt.display(Tt.values[Dt]).text;Se=Je?St.$N.Single:Se;const Gt=(0,Df.cp)(se.fields,Tt,fe,Pe,Se,we);if(ht&&Se===St.$N.Single){const Qt=se.fields[Pe],nn=(0,vs.GY)(Qt,Dt);let Jt;nn&&(Jt=Tt.values[nn]);const In=Tt.values[Dt];let rn;if(Jt)rn=Jt&&(0,vs.c5)(Jt-In);else{const bn=ct.to.valueOf();rn=(0,vs.c5)(bn-In)}Gt.push({label:"Duration",value:rn})}let Lt=[];if(Pe!=null){const Qt=se.fields[Pe],nn=fe[Pe];Lt=(0,Pf.u)(Qt,nn)}const wt={label:Tt.type===Yn.PU.time?"":(0,Za.Ct)(Tt,se,W),value:Bt};return P.createElement("div",null,P.createElement("div",{className:Et.wrapper},P.createElement(mu.A,{headerLabel:wt,isPinned:Je}),P.createElement(du.o,{contentLabelValue:Gt,isPinned:Je,scrollable:ke}),Je&&P.createElement(uu.S,{dataLinks:Lt,annotate:it})))},Ko=10,gu=({data:W,timeRange:se,timeZone:fe,options:Pe,width:Se,height:we,replaceVariables:ke,onChangeTimeRange:Je})=>{const it=(0,k.$j)(),ct=(0,P.useRef)(void 0),ht=(0,P.useRef)(!1),[Et,Tt]=(0,P.useState)(void 0),[Dt,Bt]=(0,P.useState)(null),[Gt,Lt]=(0,P.useState)(null),[wt,Qt]=(0,P.useState)(null),[nn,Jt]=(0,P.useState)(!1),[In,rn]=(0,P.useState)(!1),[bn,Bn]=(0,P.useState)(null),{sync:Fn,canAddAnnotations:xn}=(0,sn.d2)(),un=()=>{ht.current=!1,Bt(null),rn(!1)},Rn=()=>{ht.current=!ht.current,rn(ht.current)},{frames:Pn,warn:ea}=(0,P.useMemo)(()=>(0,vs.Qe)(W.series,Pe.mergeValues??!0,se,it),[W.series,Pe.mergeValues,se,it]),jn=(0,P.useMemo)(()=>(0,vs.Or)(Pn,Pe.legend,it),[Pn,Pe.legend,it]),la=(0,P.useMemo)(()=>rr(Pe.timezone,fe),[Pe.timezone,fe]),Ya=(0,P.useCallback)((ya,_a,ra,Hn)=>{const Wn=Pn??[],_n=Wn.reduce((oa,Ta)=>oa+Ta.fields.filter(Ca=>Ca.type!==Yn.PU.time).length,0);return _a===null||ra===null||ya.fields.length-1!==_n||!ya.fields[_a]?null:P.createElement(P.Fragment,null,In&&P.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},P.createElement(Ys.J,{onClick:un,style:{position:"relative",top:"auto",right:"auto",marginRight:0}})),P.createElement(ql,{data:Wn,alignedData:ya,seriesIdx:_a,datapointIdx:ra,timeZone:fe,onAnnotationAdd:Hn}))},[fe,Pn,In]);if(!Pn||ea)return P.createElement("div",{className:"panel-empty"},P.createElement("p",null,ea??"No data found in response"));if(Pn.length===1){const ya=(0,Fd.wC)(Pn[0])}const Ea=!!(xn&&xn()),gs=R.$.featureToggles.newVizTooltips&&(Fn==null||Fn()!==za.y.Tooltip);return P.createElement(Ai.I,{theme:it,frames:Pn,structureRev:W.structureRev,timeRange:se,timeZone:la,width:Se,height:we,legendItems:jn,...Pe,mode:vs.pm.Changes},(ya,_a)=>(ct.current!==ya&&!gs&&(ct.current=Ha({config:ya,onUPlotClick:Rn,setFocusedSeriesIdx:Lt,setFocusedPointIdx:Qt,setCoords:Bt,setHover:Tt,isToolTipOpen:ht,isActive:nn,setIsActive:Jt,sync:Fn})),P.createElement(P.Fragment,null,gs?P.createElement(P.Fragment,null,Pe.tooltip.mode!==St.$N.None&&P.createElement(fr.xl,{config:ya,hoverMode:fr.b3.xOne,queryZoom:Je,render:(ra,Hn,Wn,_n,oa,Ta,Ca)=>{if(Ca)return null;if(Ea&&Ta!=null){Bn(Ta),oa();return}const Aa=()=>{let On=ra.posToVal(ra.cursor.left,"x");Bn({from:On,to:On}),oa()};return P.createElement(fu,{frames:Pn??[],seriesFrame:_a,dataIdxs:Hn,seriesIdx:Wn,mode:Pe.tooltip.mode,sortOrder:Pe.tooltip.sort,isPinned:_n,timeRange:se,annotate:Ea?Aa:void 0,withDuration:!0})},maxWidth:Pe.tooltip.maxWidth,maxHeight:Pe.tooltip.maxHeight}),P.createElement(er.W,{annotations:W.annotations??[],config:ya,timeZone:fe,newRange:bn,setNewRange:Bn,canvasRegionRendering:!1})):P.createElement(P.Fragment,null,P.createElement(Eo.j,{config:ya,onZoom:Je}),P.createElement(Lr,{config:ya,onChangeTimeRange:Je}),W.annotations&&P.createElement(_s,{annotations:W.annotations,config:ya,timeZone:fe}),Ea?P.createElement(ga,{data:_a,timeZone:fe,config:ya},({startAnnotating:ra})=>Pe.tooltip.mode===St.$N.None||wt===null||!nn&&Fn&&Fn()===za.y.Crosshair?null:P.createElement(ma.ZL,null,Et&&Dt&&Gt&&P.createElement(Qa.o,{position:{x:Dt.viewport.x,y:Dt.viewport.y},offset:{x:Ko,y:Ko},allowPointerEvents:ht.current},Ya(_a,Gt,wt,()=>{ra({coords:{plotCanvas:Dt.canvas,viewport:Dt.viewport}}),un()})))):P.createElement(ma.ZL,null,Pe.tooltip.mode!==St.$N.None&&Et&&Dt&&P.createElement(Qa.o,{position:{x:Dt.viewport.x,y:Dt.viewport.y},offset:{x:Ko,y:Ko},allowPointerEvents:ht.current},Ya(_a,Gt,wt)))))))};var zc=e(25019);const Cf=(W,se,fe)=>{let Pe=W.options??{};if(se==="natel-discrete-panel"&&fe.angular){const Se=fe.angular,we=W.fieldConfig??{defaults:{},overrides:[]};Se.units&&(we.defaults.unit=Se.units);const ke={fillOpacity:100,lineWidth:0};we.defaults.custom=ke,Pe.mergeValues=!0;const Je={type:zc.d.ValueToText,options:{}};if(we.defaults.mappings=[Je],(0,$e.isArray)(Se.colorMaps))for(const it of Se.colorMaps){const ct=it.color;ct&&(Je.options[it.text]={color:ct})}if((0,$e.isArray)(Se.valueMaps))for(const it of Se.valueMaps){const ct=it.text,ht=it.value;if(ct&&ht){let Et=Je.options[ht];Et?Et.text=ct:Je.options[ht]={text:ct}}}if((0,$e.isArray)(Se.rangeMaps))for(const it of Se.rangeMaps){let ct=+it.from,ht=+it.to;const Et=it.text;Et&&we.defaults.mappings.push({type:zc.d.RangeToText,options:{from:ct,to:ht,result:{text:Et}}})}W.fieldConfig=we}return Pe},ec={alignValue:"left",mergeValues:!0,rowHeight:.9,showValue:St.yL.Auto},pu={fillOpacity:70,lineWidth:0};class bf{getSuggestionsForData(se){const{dataSummary:fe}=se;if(!fe.hasData||!fe.hasTimeField||!fe.hasStringField&&!fe.hasNumberField||fe.numberFieldCount>=30||fe.preferredVisualisationType==="logs")return;se.getListAppender({name:"",pluginId:"state-timeline",options:{},fieldConfig:{defaults:{custom:{}},overrides:[]}}).append({name:es.m.StateTimeline})}}const Tf=new L.m(gu).setPanelChangeHandler(Cf).useFieldConfig({standardOptions:{[$s.uo.Color]:{settings:{byValueSupport:!0},defaultValue:{mode:Ss.Y.ContinuousGrYlRd}}},useCustomConfig:W=>{W.addSliderInput({path:"lineWidth",name:"Line width",defaultValue:pu.lineWidth,settings:{min:0,max:10,step:1}}).addSliderInput({path:"fillOpacity",name:"Fill opacity",defaultValue:pu.fillOpacity,settings:{min:0,max:100,step:1}}).addCustomEditor({id:"spanNulls",path:"spanNulls",name:"Connect null values",defaultValue:!1,editor:Ul.e,override:Ul.e,shouldApply:se=>se.type!==Yn.PU.time,process:ro.hS,settings:{isTime:!0}}).addCustomEditor({id:"insertNulls",path:"insertNulls",name:"Disconnect values",defaultValue:!1,editor:cu.Z,override:cu.Z,shouldApply:se=>se.type!==Yn.PU.time,process:ro.hS,settings:{isTime:!0}}),io.e(W)}}).setPanelOptions(W=>{W.addBooleanSwitch({path:"mergeValues",name:"Merge equal consecutive values",defaultValue:ec.mergeValues}).addRadio({path:"showValue",name:"Show values",settings:{options:[{value:St.yL.Auto,label:"Auto"},{value:St.yL.Always,label:"Always"},{value:St.yL.Never,label:"Never"}]},defaultValue:ec.showValue}).addRadio({path:"alignValue",name:"Align values",settings:{options:[{value:"left",label:"Left"},{value:"center",label:"Center"},{value:"right",label:"Right"}]},defaultValue:ec.alignValue}).addSliderInput({path:"rowHeight",name:"Row height",settings:{min:0,max:1,step:.01},defaultValue:ec.rowHeight}),Fr.H(W,!1),ur.D(W,!R.$.featureToggles.newVizTooltips)}).setSuggestionsSupplier(new bf).setDataSupport({annotations:!0}),hu=({data:W,alignedData:se,seriesIdx:fe,datapointIdx:Pe,timeZone:Se})=>{const we=(0,k.$j)();if(!W||Pe==null)return null;const ke=se.fields[fe],Je=[],it=new Set;if(ke.getLinks){const Lt=ke.values[Pe],wt=ke.display?ke.display(Lt):{text:`${Lt}`,numeric:+Lt};ke.getLinks({calculatedValue:wt,valueRowIndex:Pe}).forEach(Qt=>{const nn=`${Qt.title}/${Qt.href}`;it.has(nn)||(Je.push(Qt),it.add(nn))})}const ct=se.fields[0],ht=ct.display||(0,ha.J)({field:ct,timeZone:Se,theme:we}),Et=ke.state?.origin,Tt=ke.display||(0,ha.J)({field:ke,timeZone:Se,theme:we}),Dt=ke.values[Pe],Bt=Tt(Dt),Gt=Et?(0,Za.Ct)(W[Et.frameIndex].fields[Et.fieldIndex],W[Et.frameIndex],W):null;return P.createElement("div",null,P.createElement("div",{style:{fontSize:we.typography.bodySmall.fontSize}},P.createElement("strong",null,ht(ct.values[Pe]).text),P.createElement("br",null),P.createElement($c.g,{label:Bt.text,color:Bt.color||Ss.F,isActive:!0}),Gt),Je.length>0&&P.createElement("div",{style:{margin:we.spacing(1,-1,-1,-1),borderTop:`1px solid ${we.colors.border.weak}`}},Je.map((Lt,wt)=>P.createElement(us.D,{key:wt,icon:"external-link-alt",target:Lt.target,label:Lt.title,url:Lt.href,onClick:Lt.onClick}))))};hu.displayName="StatusHistoryTooltip";const vu=10,Mf=({data:W,timeRange:se,timeZone:fe,options:Pe,width:Se,height:we,onChangeTimeRange:ke})=>{const Je=(0,k.$j)(),it=(0,P.useRef)(void 0),ct=(0,P.useRef)(!1),[ht,Et]=(0,P.useState)(void 0),[Tt,Dt]=(0,P.useState)(null),[Bt,Gt]=(0,P.useState)(null),[Lt,wt]=(0,P.useState)(null),[Qt,nn]=(0,P.useState)(!1),[Jt,In]=(0,P.useState)(!1),[rn,bn]=(0,P.useState)(null),{sync:Bn,canAddAnnotations:Fn}=(0,sn.d2)(),xn=!!(Fn&&Fn()),un=()=>{ct.current=!1,Dt(null),In(!1)},Rn=()=>{ct.current=!ct.current,In(ct.current)},{frames:Pn,warn:ea}=(0,P.useMemo)(()=>(0,vs.Qe)(W.series,!1,se,Je),[W.series,se,Je]),jn=(0,P.useMemo)(()=>(0,vs.Or)(Pn,Pe.legend,Je),[Pn,Pe.legend,Je]),la=(0,P.useCallback)((ya,_a,ra)=>{const Hn=Pn??[],Wn=Hn.reduce((_n,oa)=>_n+oa.fields.filter(Ta=>Ta.type!==Yn.PU.time).length,0);return _a===null||ra===null||ya.fields.length-1!==Wn||!ya.fields[_a]?null:P.createElement(P.Fragment,null,Jt&&P.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},P.createElement(Ys.J,{onClick:un,style:{position:"relative",top:"auto",right:"auto",marginRight:0}})),P.createElement(hu,{data:Hn,alignedData:ya,seriesIdx:_a,datapointIdx:ra,timeZone:fe}))},[fe,Pn,Jt]),Ya=ya=>Pe.tooltip.mode===St.$N.None||Lt===null||!Qt&&Bn&&Bn()===za.y.Crosshair?null:P.createElement(ma.ZL,null,ht&&Tt&&Bt&&P.createElement(Qa.o,{position:{x:Tt.viewport.x,y:Tt.viewport.y},offset:{x:vu,y:vu},allowPointerEvents:ct.current},la(ya,Bt,Lt))),Ea=(0,P.useMemo)(()=>rr(Pe.timezone,fe),[Pe.timezone,fe]);if(!Pn||ea)return P.createElement("div",{className:"panel-empty"},P.createElement("p",null,ea??"No data found in response"));if(Pn[0].length>Se/2)return P.createElement("div",{className:"panel-empty"},P.createElement("p",null,"Too many points to visualize properly. ",P.createElement("br",null),"Update the query to return fewer points. ",P.createElement("br",null),"(",Pn[0].length," points received)"));const gs=R.$.featureToggles.newVizTooltips&&(Bn==null||Bn()!==za.y.Tooltip);return P.createElement(Ai.I,{theme:Je,frames:Pn,structureRev:W.structureRev,timeRange:se,timeZone:Ea,width:Se,height:we,legendItems:jn,...Pe,mode:vs.pm.Samples},(ya,_a)=>(it.current!==ya&&!gs&&(it.current=Ha({config:ya,onUPlotClick:Rn,setFocusedSeriesIdx:Gt,setFocusedPointIdx:wt,setCoords:Dt,setHover:Et,isToolTipOpen:ct,isActive:Qt,setIsActive:nn})),P.createElement(P.Fragment,null,gs?P.createElement(P.Fragment,null,Pe.tooltip.mode!==St.$N.None&&P.createElement(fr.xl,{config:ya,hoverMode:fr.b3.xyOne,queryZoom:ke,render:(ra,Hn,Wn,_n,oa,Ta,Ca)=>{if(Ca)return null;if(xn&&Ta!=null){bn(Ta),oa();return}const Aa=()=>{let On=ra.posToVal(ra.cursor.left,"x");bn({from:On,to:On}),oa()};return P.createElement(fu,{frames:Pn??[],seriesFrame:_a,dataIdxs:Hn,seriesIdx:Wn,mode:Pe.tooltip.mode,sortOrder:Pe.tooltip.sort,isPinned:_n,timeRange:se,annotate:xn?Aa:void 0,withDuration:!1})},maxWidth:Pe.tooltip.maxWidth,maxHeight:Pe.tooltip.maxHeight}),P.createElement(er.W,{annotations:W.annotations??[],config:ya,timeZone:fe,newRange:rn,setNewRange:bn,canvasRegionRendering:!1})):P.createElement(P.Fragment,null,P.createElement(Eo.j,{config:ya,onZoom:ke}),Ya(_a),P.createElement(Lr,{config:ya,onChangeTimeRange:ke}),W.annotations&&P.createElement(_s,{annotations:W.annotations,config:ya,timeZone:fe,disableCanvasRendering:!0})))))},Eu={colWidth:.9,rowHeight:.9,showValue:St.yL.Auto},tc={fillOpacity:70,lineWidth:1};class Sf{getSuggestionsForData(se){const{dataSummary:fe}=se;if(!fe.hasData||!fe.hasTimeField||!fe.hasStringField&&!fe.hasNumberField||fe.numberFieldCount>=30||fe.rowCountMax>100||fe.preferredVisualisationType==="logs")return;se.getListAppender({name:"",pluginId:"status-history",options:{},fieldConfig:{defaults:{color:{mode:Ss.Y.ContinuousGrYlRd},custom:{}},overrides:[]},cardOptions:{previewModifier:Se=>{Se.options.colWidth=.7}}}).append({name:es.m.StatusHistory})}}const kc=new L.m(Mf).useFieldConfig({standardOptions:{[$s.uo.Color]:{settings:{byValueSupport:!0},defaultValue:{mode:Ss.Y.Thresholds}}},useCustomConfig:W=>{W.addSliderInput({path:"lineWidth",name:"Line width",defaultValue:tc.lineWidth,settings:{min:0,max:10,step:1}}).addSliderInput({path:"fillOpacity",name:"Fill opacity",defaultValue:tc.fillOpacity,settings:{min:0,max:100,step:1}}),io.e(W)}}).setPanelOptions(W=>{W.addRadio({path:"showValue",name:"Show values",settings:{options:[{value:St.yL.Auto,label:"Auto"},{value:St.yL.Always,label:"Always"},{value:St.yL.Never,label:"Never"}]},defaultValue:St.yL.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}}),Fr.H(W,!1),ur.D(W,!R.$.featureToggles.newVizTooltips)}).setSuggestionsSupplier(new Sf).setDataSupport({annotations:!0});var xf=e(69550),gl=e(39651),Of=e(15292);function yu({onChange:W,value:se,context:fe}){const Pe=Se=>{Se?.currentTarget.checked&&(fe.options.footer.show=!1),W(Se?.currentTarget.checked)};return P.createElement(Of.d,{value:!!se,onChange:Pe})}function If({cellOptions:W,onChange:se}){const fe=Se=>{W.mode=Se,se(W)},Pe=Se=>{W.valueDisplayMode=Se,se(W)};return P.createElement(Ee.B,{direction:"column",gap:0},P.createElement(Vt.D,{label:"Gauge display mode"},P.createElement(vr.z,{value:W?.mode??St.eX.Gradient,onChange:fe,options:Hc})),P.createElement(Vt.D,{label:"Value display"},P.createElement(vr.z,{value:W?.valueDisplayMode??St.$l.Text,onChange:Pe,options:Gc})))}const Hc=[{value:St.eX.Basic,label:"Basic"},{value:St.eX.Gradient,label:"Gradient"},{value:St.eX.Lcd,label:"Retro LCD"}],Gc=[{value:St.$l.Color,label:"Value color"},{value:St.$l.Text,label:"Text color"},{value:St.$l.Hidden,label:"Hidden"}],Af=[{value:St.Wq.Basic,label:"Basic"},{value:St.Wq.Gradient,label:"Gradient"}],Rf=({cellOptions:W,onChange:se})=>{const fe=Pe=>{W.mode=Pe,se(W)};return P.createElement(Vt.D,{label:"Background display mode"},P.createElement(vr.z,{value:W?.mode??St.Wq.Gradient,onChange:fe,options:Af}))};var Lf=e(28528),Du=e(30355);const pl=["hideValue","drawStyle","lineInterpolation","barAlignment","lineWidth","fillOpacity","gradientMode","lineStyle","spanNulls","showPoints","pointSize"];function Bf(W){const se=(0,mo.V)(W);return{...se,useCustomConfig:fe=>{se.useCustomConfig?.(fe),fe.addBooleanSwitch({path:"hideValue",name:"Hide value"})}}}const Uf=W=>{const{cellOptions:se,onChange:fe}=W,Pe=(0,P.useMemo)(()=>{const ke=Bf(Du.t);return(0,Lf.O)(ke,"ChartCell")},[]),Se=(0,k.of)(wf),we={...Du.t,...se};return P.createElement(qr.gW,null,Pe.list(pl.map(ke=>`custom.${ke}`)).map(ke=>{if(ke.showIf&&!ke.showIf(we))return null;const Je=ke.editor,it=ke.path;return P.createElement(Vt.D,{label:ke.name,key:ke.id,className:Se.field},P.createElement(Je,{onChange:ct=>fe({...se,[it]:ct}),value:(Nf(it,we)?we[it]:void 0)??ke.defaultValue,item:ke,context:{data:[]}}))}))};function Nf(W,se){return W in se}const wf=()=>({field:(0,K.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; } `}),Pu=({value:W,onChange:se})=>{const fe=W.type,Pe=(0,k.of)(Ff),Se=jc.find(ct=>ct.value.type===fe);let[we,ke]=(0,P.useState)({});const Je=ct=>{ct.value!==void 0&&(W=ct.value,we[W.type]!==void 0&&Object.keys(we[W.type]).length>1&&(W=(0,$e.merge)(W,we[W.type])),se(W))},it=ct=>{we[W.type]=(0,$e.merge)(W,ct),ke(we),se(we[W.type])};return P.createElement("div",{className:Pe.fixBottomMargin},P.createElement(Vt.D,null,P.createElement(he.l6,{options:jc,value:Se,onChange:Je})),fe===St.ob.Gauge&&P.createElement(If,{cellOptions:W,onChange:it}),fe===St.ob.ColorBackground&&P.createElement(Rf,{cellOptions:W,onChange:it}),fe===St.ob.Sparkline&&P.createElement(Uf,{cellOptions:W,onChange:it}))},jc=[{value:{type:St.ob.Auto},label:"Auto"},{value:{type:St.ob.Sparkline},label:"Sparkline"},{value:{type:St.ob.ColorText},label:"Colored text"},{value:{type:St.ob.ColorBackground},label:"Colored background"},{value:{type:St.ob.Gauge},label:"Gauge"},{value:{type:St.ob.DataLinks},label:"Data links"},{value:{type:St.ob.JSONView},label:"JSON View"},{value:{type:St.ob.Image},label:"Image"}],Ff=W=>({fixBottomMargin:(0,K.css)({marginBottom:W.spacing(-2)})}),nc={cellHeight:St.qM.Sm,footer:{show:!1,countRows:!1,reducer:[]},frameIndex:0,showHeader:!0,showTypeIcons:!1,sortBy:[]};class Wf{getSuggestionsForData(se){const fe=se.getListAppender({name:es.m.Table,pluginId:"table",options:{},fieldConfig:{defaults:{custom:{}},overrides:[]},cardOptions:{previewModifier:Pe=>{Pe.fieldConfig.defaults.custom.minWidth=50}}});se.dataSummary.fieldCount===0?fe.append({cardOptions:{imgSrc:"public/app/plugins/panel/table/img/icn-table-panel.svg"}}):fe.append({})}}const ac="Table footer",Cu=["Cell options"],Yc=new L.m(ci).setPanelChangeHandler(Oi.l1).setMigrationHandler(Oi.fq).useFieldConfig({useCustomConfig:W=>{W.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:gl.gB.minWidth}).addNumberInput({path:"width",name:"Column width",settings:{placeholder:"auto",min:20,max:300},shouldApply:()=>!0,defaultValue:gl.gB.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:gl.gB.align}).addCustomEditor({id:"cellOptions",path:"cellOptions",name:"Cell type",editor:Pu,override:Pu,defaultValue:gl.gB.cellOptions,process:ro.hS,category:Cu,shouldApply:()=>!0}).addBooleanSwitch({path:"inspect",name:"Cell value inspect",description:"Enable cell value inspection in a modal window",defaultValue:!1,category:Cu,showIf:se=>se.cellOptions.type===St.ob.Auto||se.cellOptions.type===St.ob.JSONView||se.cellOptions.type===St.ob.ColorText||se.cellOptions.type===St.ob.ColorBackground}).addBooleanSwitch({path:"filterable",name:"Column filter",description:"Enables/disables field filters in table",defaultValue:gl.gB.filterable}).addBooleanSwitch({path:"hidden",name:"Hide in table",defaultValue:void 0,hideFromDefaults:!0})}}).setPanelOptions(W=>{W.addBooleanSwitch({path:"showHeader",name:"Show table header",defaultValue:nc.showHeader}).addRadio({path:"cellHeight",name:"Cell height",defaultValue:nc.cellHeight,settings:{options:[{value:St.qM.Sm,label:"Small"},{value:St.qM.Md,label:"Medium"},{value:St.qM.Lg,label:"Large"}]}}).addBooleanSwitch({path:"footer.show",category:[ac],name:"Show table footer",defaultValue:nc.footer?.show}).addCustomEditor({id:"footer.reducer",category:[ac],path:"footer.reducer",name:"Calculation",description:"Choose a reducer function / calculation",editor:xf.D.get("stats-picker").editor,defaultValue:[po.gy.sum],showIf:se=>se.footer?.show}).addBooleanSwitch({path:"footer.countRows",category:[ac],name:"Count rows",description:"Display a single count for all data rows",defaultValue:nc.footer?.countRows,showIf:se=>se.footer?.reducer?.length===1&&se.footer?.reducer[0]===po.gy.count}).addMultiSelect({path:"footer.fields",category:[ac],name:"Fields",description:"Select the fields that should be calculated",settings:{allowCustomValue:!1,options:[],placeholder:"All Numeric Fields",getOptions:async se=>{const fe=[];if(se&&se.data&&se.data.length>0){const Pe=se.data[0];for(const Se of Pe.fields)if(Se.type===Yn.PU.number){const we=(0,Za.Ct)(Se,Pe,se.data),ke=Se.name;fe.push({value:ke,label:we})}}return fe}},defaultValue:"",showIf:se=>se.footer?.show&&!se.footer?.countRows||se.footer?.reducer?.length===1&&se.footer?.reducer[0]!==po.gy.count}).addCustomEditor({id:"footer.enablePagination",path:"footer.enablePagination",name:"Enable pagination",editor:yu})}).setSuggestionsSupplier(new Wf);var bu=e(49880),Kf=e.n(bu),$f=e(40996),Vf=e(36663),Qr=(W=>(W.Code="code",W.HTML="html",W.Markdown="markdown",W))(Qr||{}),Qc=(W=>(W.Go="go",W.Html="html",W.Json="json",W.Markdown="markdown",W.Plaintext="plaintext",W.Sql="sql",W.Typescript="typescript",W.Xml="xml",W.Yaml="yaml",W))(Qc||{});const _f="plaintext",Nl={language:"plaintext",showLineNumbers:!1,showMiniMap:!1},Tu={content:`# Title For markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)`,mode:"markdown"};function zf(W){const se=(0,k.of)(kf),[fe,Pe]=(0,P.useState)({mode:W.options.mode,content:Mu(W.options,W.replaceVariables,pn.Ay.disableSanitizeHtml)});if((0,$f.A)(()=>{const{options:Se,replaceVariables:we}=W,ke=Mu(Se,we,pn.Ay.disableSanitizeHtml);(ke!==fe.content||Se.mode!==fe.mode)&&Pe({mode:Se.mode,content:ke})},100,[W]),fe.mode===Qr.Code){const Se=W.options.code??Nl;return P.createElement(Lc.B,{key:`${Se.showLineNumbers}/${Se.showMiniMap}`,value:fe.content,language:Se.language??Nl.language,width:W.width,height:W.height,containerStyles:se.codeEditorContainer,showMiniMap:Se.showMiniMap,showLineNumbers:Se.showLineNumbers,readOnly:!0})}return P.createElement(B.E,{autoHeightMin:"100%",className:se.containStrict},P.createElement(Kf(),{allowRerender:!0,html:fe.content,className:se.markdown,"data-testid":"TextPanel-converted-content"}))}function Mu(W,se,fe){let{mode:Pe,content:Se}=W;if(!Se)return" ";switch(Se=se(Se,{},W.code?.language==="json"?"json":"html"),Pe){case Qr.Code:break;case Qr.HTML:fe||(Se=Ja.sQ.sanitizeTextPanelContent(Se));break;case Qr.Markdown:default:Se=(0,Vf.P)(Se,{noSanitize:fe})}return Se}const kf=W=>({codeEditorContainer:(0,K.css)` .monaco-editor .margin, .monaco-editor-background { background-color: ${W.colors.background.primary}; } `,markdown:(0,K.cx)("markdown-html",(0,K.css)` height: 100%; `),containStrict:(0,K.css)({contain:"strict"})});var Hf=e(70713),Jc=e(99544);const Gf=({value:W,onChange:se,context:fe})=>{const Pe=(0,P.useMemo)(()=>fe.options?.mode??Qr.Markdown,[fe]),Se=(0,k.of)(jf),we=()=>fe.getSuggestions?fe.getSuggestions().map(ke=>(0,Jc.O)(ke)):[];return P.createElement("div",{className:(0,K.cx)(Se.editorBox)},P.createElement(Hf.Ay,{disableHeight:!0},({width:ke})=>ke===0?null:P.createElement(Lc.B,{value:W,onBlur:se,onSave:se,language:Pe,width:ke,showMiniMap:!1,showLineNumbers:!1,height:"500px",getSuggestions:we})))},jf=W=>({editorBox:(0,K.css)` label: editorBox; border: 1px solid ${W.colors.border.medium}; border-radius: ${W.shape.radius.default}; margin: ${W.spacing(.5)} 0; width: 100%; `}),Yf=W=>{const se=parseFloat(W.pluginVersion||"6.1");let fe=W.options;if(W.hasOwnProperty("content")&&W.hasOwnProperty("mode")){const Se=W,we=Se.content,ke=Se.mode;delete Se.content,delete Se.mode,se<7.1&&(fe={content:we,mode:ke})}return[Qr.Code,Qr.HTML,Qr.Markdown].find(Se=>Se===fe.mode)||(fe={...fe,mode:Qr.Markdown}),fe},Qf=new L.m(zf).setPanelOptions(W=>{W.addRadio({path:"mode",name:"Mode",settings:{options:[{value:Qr.Markdown,label:"Markdown"},{value:Qr.HTML,label:"HTML"},{value:Qr.Code,label:"Code"}]},defaultValue:Tu.mode}).addSelect({path:"code.language",name:"Language",settings:{options:Object.values(Qc).map(se=>({value:se,label:se}))},defaultValue:Nl.language,showIf:se=>se.mode===Qr.Code}).addBooleanSwitch({path:"code.showLineNumbers",name:"Show line numbers",defaultValue:Nl.showLineNumbers,showIf:se=>se.mode===Qr.Code}).addBooleanSwitch({path:"code.showMiniMap",name:"Show mini map",defaultValue:Nl.showMiniMap,showIf:se=>se.mode===Qr.Code}).addCustomEditor({id:"content",path:"content",name:"Content",editor:Gf,defaultValue:Tu.content})}).setMigrationHandler(Yf);var Jf=e(41260),wl=e(23117),Su=e(18282);class Xc{getSuggestionsForData(se){const{dataSummary:fe}=se;if(!fe.hasTimeField||!fe.hasNumberField||fe.rowCountTotal<2)return;const Pe=se.getListAppender({name:es.m.LineChart,pluginId:"timeseries",options:{legend:{calcs:[],displayMode:St.lm.Hidden,placement:"right",showLegend:!1}},fieldConfig:{defaults:{custom:{}},overrides:[]},cardOptions:{previewModifier:we=>{we.fieldConfig?.defaults.custom?.drawStyle!==St.GR.Bars&&(we.fieldConfig.defaults.custom.lineWidth=Math.max(we.fieldConfig.defaults.custom.lineWidth??1,2))}}}),Se=100;if(Pe.append({name:es.m.LineChart}),fe.rowCountMax<200&&Pe.append({name:es.m.LineChartSmooth,fieldConfig:{defaults:{custom:{lineInterpolation:St.dx.Smooth}},overrides:[]}}),fe.numberFieldCount===1){Pe.append({name:es.m.AreaChart,fieldConfig:{defaults:{custom:{fillOpacity:25}},overrides:[]}}),Pe.append({name:es.m.LineChartGradientColorScheme,fieldConfig:{defaults:{color:{mode:Ss.Y.ContinuousGrYlRd},custom:{gradientMode:St.on.Scheme,lineInterpolation:St.dx.Smooth,lineWidth:3,fillOpacity:20}},overrides:[]}}),fe.rowCountMax<Se&&(Pe.append({name:es.m.BarChart,fieldConfig:{defaults:{custom:{drawStyle:St.GR.Bars,fillOpacity:100,lineWidth:1,gradientMode:St.on.Hue}},overrides:[]}}),Pe.append({name:es.m.BarChartGradientColorScheme,fieldConfig:{defaults:{color:{mode:Ss.Y.ContinuousGrYlRd},custom:{drawStyle:St.GR.Bars,fillOpacity:90,lineWidth:1,gradientMode:St.on.Scheme}},overrides:[]}}));return}Pe.append({name:es.m.AreaChartStacked,fieldConfig:{defaults:{custom:{fillOpacity:25,stacking:{mode:St.gs.Normal,group:"A"}}},overrides:[]}}),Pe.append({name:es.m.AreaChartStackedPercent,fieldConfig:{defaults:{custom:{fillOpacity:25,stacking:{mode:St.gs.Percent,group:"A"}}},overrides:[]}}),fe.rowCountTotal/fe.numberFieldCount<Se&&(Pe.append({name:es.m.BarChartStacked,fieldConfig:{defaults:{custom:{drawStyle:St.GR.Bars,fillOpacity:100,lineWidth:1,gradientMode:St.on.Hue,stacking:{mode:St.gs.Normal,group:"A"}}},overrides:[]}}),Pe.append({name:es.m.BarChartStackedPercent,fieldConfig:{defaults:{custom:{drawStyle:St.GR.Bars,fillOpacity:100,lineWidth:1,gradientMode:St.on.Hue,stacking:{mode:St.gs.Percent,group:"A"}}},overrides:[]}}))}}function Xf(W){const se=(0,Ve.UA)().getCurrent()?.getPanelById(W);if(se){const fe=se.transformations?[...se.transformations]:[];return fe.push({id:Su.F.prepareTimeSeries,options:{format:"wide"}}),{name:"Transform to wide time series format",pluginId:"timeseries",transformations:fe}}}const Zf=({data:W,timeRange:se,timeZone:fe,width:Pe,height:Se,options:we,fieldConfig:ke,onChangeTimeRange:Je,replaceVariables:it,id:ct})=>{const{sync:ht,canAddAnnotations:Et,onThresholdsChange:Tt,canEditThresholds:Dt,showThresholds:Bt,dataLinkPostProcessor:Gt}=(0,sn.d2)(),Lt=(0,P.useMemo)(()=>Sl(W.series,pn.$W.theme2,se),[W.series,se]),wt=(0,P.useMemo)(()=>rr(we.timezone,fe),[we.timezone,fe]),Qt=(0,P.useMemo)(()=>{if(Lt?.length&&Lt.every(bn=>bn.meta?.type===Jf.m.TimeSeriesLong)){const bn=Xf(ct);return{message:"Long data must be converted to wide",suggestions:bn?[bn]:void 0}}},[Lt,ct]),nn=!!(Et&&Et()),Jt=pn.$W.featureToggles.newVizTooltips&&(ht==null||ht()!==za.y.Tooltip),[In,rn]=(0,P.useState)(null);return!Lt||Qt?P.createElement($t.a,{panelId:ct,message:Qt?.message,fieldConfig:ke,data:W,needsTimeField:!0,needsNumberField:!0,suggestions:Qt?.suggestions}):P.createElement(Di,{frames:Lt,structureRev:W.structureRev,timeRange:se,timeZone:wt,width:Pe,height:Se,legend:we.legend,options:we},(bn,Bn)=>(Bn.fields.some(Fn=>!!Fn.config.links?.length)&&(Bn=go(Bn,Lt,it,fe,Gt)),P.createElement(P.Fragment,null,!Jt&&P.createElement(wl.Z,{config:bn}),we.tooltip.mode===St.$N.None||P.createElement(P.Fragment,null,Jt?P.createElement(fr.xl,{config:bn,hoverMode:we.tooltip.mode===St.$N.Single?fr.b3.xOne:fr.b3.xAll,queryZoom:Je,clientZoom:!0,render:(Fn,xn,un,Rn=!1,Pn,ea,jn)=>{if(jn)return null;if(nn&&ea!=null){rn(ea),Pn();return}const la=()=>{let Ya=Fn.posToVal(Fn.cursor.left,"x");rn({from:Ya,to:Ya}),Pn()};return P.createElement(No.k,{frames:Lt,seriesFrame:Bn,dataIdxs:xn,seriesIdx:un,mode:we.tooltip.mode,sortOrder:we.tooltip.sort,isPinned:Rn,annotate:nn?la:void 0,scrollable:Ws(we.tooltip)})},maxWidth:we.tooltip.maxWidth,maxHeight:we.tooltip.maxHeight}):P.createElement(P.Fragment,null,P.createElement(Eo.j,{config:bn,onZoom:Je,withZoomY:!0}),P.createElement(Ia.T,{frames:Lt,data:Bn,config:bn,mode:we.tooltip.mode,sortOrder:we.tooltip.sort,sync:ht,timeZone:fe}))),Jt?P.createElement(er.W,{annotations:W.annotations??[],config:bn,timeZone:fe,newRange:In,setNewRange:rn}):W.annotations&&P.createElement(_s,{annotations:W.annotations,config:bn,timeZone:fe}),Jt?void 0:nn?P.createElement(ga,{data:Bn,timeZone:fe,config:bn},({startAnnotating:Fn})=>P.createElement(fa,{data:Bn,config:bn,timeZone:fe,replaceVariables:it,defaultItems:[{items:[{label:"Add annotation",ariaLabel:"Add annotation",icon:"comment-alt",onClick:(xn,un)=>{un&&Fn({coords:un.coords})}}]}]})):P.createElement(fa,{data:Bn,frames:Lt,config:bn,timeZone:fe,replaceVariables:it,defaultItems:[]}),W.annotations&&P.createElement(Oo,{visibleSeries:Qo(bn,Lt),config:bn,exemplars:W.annotations,timeZone:fe}),(Dt&&Tt||Bt)&&P.createElement(oi,{config:bn,fieldConfig:ke,onThresholdsChange:Dt?Tt:void 0}),P.createElement(Lr,{config:bn,onChangeTimeRange:Je}))))};var Zc=e(91410),qf=e(20333);const eg=({value:W,onChange:se})=>{const fe=(0,k.of)(tg);(!W||W.length<1)&&(W=[""]);const Pe=()=>{se([...W,Zc.g$.default])},Se=ke=>{const Je=W.slice();Je.splice(ke,1),se(Je)},we=(ke,Je)=>{const it=W.slice();it[ke]=Je??Zc.g$.default,it.length===0||it.length===1&&it[0]===""?se(void 0):se(it)};return P.createElement("div",null,W.map((ke,Je)=>P.createElement("div",{className:fe.wrapper,key:`${Je}.${ke}`},P.createElement("span",{className:fe.first},P.createElement(qf.U,{onChange:it=>we(Je,it),includeInternal:!0,value:ke??Zc.g$.default})),Je===W.length-1?P.createElement(Xa.K,{name:"plus",onClick:Pe,tooltip:"Add timezone"}):P.createElement(Xa.K,{name:"times",onClick:()=>Se(Je),tooltip:"Remove timezone"}))))},tg=W=>({wrapper:(0,K.css)` width: 100%; display: flex; flex-direction: rows; align-items: center; `,first:(0,K.css)` margin-right: 8px; flex-grow: 2; `});var ng=e(50082),xu=e(74856),ag=e(68706);let qc=null;const sg=(W,se,fe,Pe)=>{if(se==="graph"&&fe.angular){const{fieldConfig:Se,options:we,annotations:ke}=rg({...fe.angular,fieldConfig:Pe,panel:W}),Je=(0,Ve.UA)().getCurrent();return Je&&ke?.length>0&&(Je.annotations.list=[...Je.annotations.list,...ke],qc==null&&(qc=setTimeout(()=>{qc=null,(0,xu.jG)().refreshTimeModel()}))),W.fieldConfig=Se,W.alert=fe.angular.alert,we}return lg(W),{}};function rg(W){let se=[];const fe=W.fieldConfig?.overrides??[],Pe=W.yaxes??[];let Se=Ou(Pe[0]);W.fieldConfig?.defaults&&(Se={...W.fieldConfig?.defaults,...Se});const we={fill:W.dashes?"dash":"solid",dash:[W.dashLength??10,W.spaceLength??10]};if(W.aliasColors)for(const Et of Object.keys(W.aliasColors)){const Tt=W.aliasColors[Et];Tt&&fe.push({matcher:{id:xi.Ct.byName,options:Et},properties:[{id:$s.uo.Color,value:{mode:Ss.Y.Fixed,fixedColor:Tt}}]})}let ke=!1;if(W.seriesOverrides?.length)for(const Et of W.seriesOverrides){if(!Et.alias)continue;const Dt={matcher:{id:/^([/~@;%#'])(.*?)\1([gimsuy]*)$/.test(Et.alias)?xi.Ct.byRegexp:xi.Ct.byName,options:Et.alias},properties:[]};let Bt;for(const Gt of Object.keys(Et)){const Lt=Et[Gt];switch(Gt){case"alias":case"$$hashKey":break;case"yaxis":if(Lt===2){const wt=Ou(Pe[1]);og(Se,wt,Dt.properties)}break;case"fill":Dt.properties.push({id:"custom.fillOpacity",value:Lt*10});break;case"fillBelowTo":ke=!0,Dt.properties.push({id:"custom.fillBelowTo",value:Lt});break;case"fillGradient":Lt&&(Dt.properties.push({id:"custom.fillGradient",value:"opacity"}),Dt.properties.push({id:"custom.fillOpacity",value:Lt*10}));break;case"points":Dt.properties.push({id:"custom.showPoints",value:Lt?St.yL.Always:St.yL.Never});break;case"bars":Lt?(Dt.properties.push({id:"custom.drawStyle",value:St.GR.Bars}),Dt.properties.push({id:"custom.fillOpacity",value:100})):Dt.properties.push({id:"custom.drawStyle",value:St.GR.Line});break;case"lines":Lt?Dt.properties.push({id:"custom.drawStyle",value:"line"}):Dt.properties.push({id:"custom.lineWidth",value:0});break;case"linewidth":Dt.properties.push({id:"custom.lineWidth",value:Lt});break;case"pointradius":Dt.properties.push({id:"custom.pointSize",value:2+Lt*2});break;case"dashLength":case"spaceLength":case"dashes":switch(Bt||(Bt={fill:we.fill,dash:[...we.dash]}),Gt){case"dashLength":Bt.dash[0]=Lt;break;case"spaceLength":Bt.dash[1]=Lt;break;case"dashes":Bt.fill=Lt?"dash":"solid";break}break;case"stack":Dt.properties.push({id:"custom.stacking",value:Au(Lt)});break;case"color":Dt.properties.push({id:"color",value:{fixedColor:Lt,mode:Ss.Y.Fixed}});break;case"transform":Dt.properties.push({id:"custom.transform",value:Lt==="negative-Y"?St.NU.NegativeY:St.NU.Constant});break;default:console.log("Ignore override migration:",Et.alias,Gt,Lt)}}Bt&&Dt.properties.push({id:"custom.lineStyle",value:Bt}),Dt.properties.length&&fe.push(Dt)}const Je=Se.custom??{};Je.drawStyle=W.bars?St.GR.Bars:W.lines?St.GR.Line:St.GR.Points,W.points?(Je.showPoints=St.yL.Always,(0,$e.isNumber)(W.pointradius)&&(Je.pointSize=2+W.pointradius*2)):Je.drawStyle!==St.GR.Points&&(Je.showPoints=St.yL.Never),Je.lineWidth=W.linewidth,we.fill!=="solid"&&(Je.lineStyle=we),ke?Je.fillOpacity=35:(0,$e.isNumber)(W.fill)&&(Je.fillOpacity=W.fill*10),(0,$e.isNumber)(W.fillGradient)&&W.fillGradient>0&&(Je.gradientMode=St.on.Opacity,Je.fillOpacity=W.fillGradient*10),Je.spanNulls=W.nullPointMode===li.UW.Ignore,W.steppedLine&&(Je.lineInterpolation=St.dx.StepAfter),Je.drawStyle===St.GR.Bars&&(Je.fillOpacity=100),W.stack&&(Je.stacking={mode:St.gs.Normal,group:mo.S.stacking.group}),Se.custom=(0,$e.omitBy)(Je,$e.isNil),Se.nullValueMode=W.nullPointMode;const it={legend:{displayMode:St.lm.List,showLegend:!0,placement:"bottom",calcs:[]},tooltip:{mode:St.$N.Single,sort:St.xB.None}},ct=W.legend;if(ct){if(ct.show?it.legend.displayMode=ct.alignAsTable?St.lm.Table:St.lm.List:it.legend.showLegend=!1,ct.rightSide&&(it.legend.placement="right"),W.legend.values){const Et=(0,$e.pickBy)(W.legend);it.legend.calcs=ig(Et)}W.legend.sideWidth&&(it.legend.width=W.legend.sideWidth),ct.hideZero&&fe.push(Iu(po.gy.allIsZero)),ct.hideEmpty&&fe.push(Iu(po.gy.allIsNull))}W.timeRegions?.length&&W.timeRegions.map((Tt,Dt)=>({name:`T${Dt+1}`,color:Tt.colorMode!=="custom"?Tt.colorMode:Tt.fillColor,line:Tt.line,fill:Tt.fill,fromDayOfWeek:Tt.fromDayOfWeek,toDayOfWeek:Tt.toDayOfWeek,from:Tt.from,to:Tt.to})).forEach((Tt,Dt)=>{const Bt={datasource:{type:"datasource",uid:"grafana"},enable:!0,hide:!0,filter:{exclude:!1,ids:[W.panel.id]},iconColor:Tt.fillColor??Tt.color,name:`T${Dt+1}`,target:{queryType:ag.nj.TimeRegions,refId:"Anno",timeRegion:{fromDayOfWeek:Tt.fromDayOfWeek,toDayOfWeek:Tt.toDayOfWeek,from:Tt.from,to:Tt.to,timezone:"utc"}}};Tt.fill?se.push(Bt):Tt.line&&(Bt.iconColor=Tt.lineColor??"white",se.push(Bt))});const ht=W.tooltip;if(ht&&(ht.shared!==void 0&&(it.tooltip.mode=ht.shared?St.$N.Multi:St.$N.Single),ht.sort!==void 0&&ht.shared))switch(ht.sort){case 1:it.tooltip.sort=St.xB.Ascending;break;case 2:it.tooltip.sort=St.xB.Descending;break;default:it.tooltip.sort=St.xB.None}if(W.thresholds&&W.thresholds.length>0){let Et=[],Tt=!1,Dt=!1;const Bt=W.thresholds.sort((Lt,wt)=>Lt.value>wt.value?1:-1);for(let Lt=0;Lt<Bt.length;Lt++){const wt=Bt[Lt],Qt=Bt.length>Lt+1?Bt[Lt+1]:null;wt.fill&&(Tt=!0),wt.line&&(Dt=!0),wt.op==="gt"&&Et.push({value:wt.value,color:ed(wt)}),wt.op==="lt"&&(Et.length===0&&Et.push({value:-1/0,color:ed(wt)}),Qt&&Qt.op==="gt"&&Qt.value>wt.value?Et.push({value:wt.value,color:"transparent"}):Qt&&Qt.op==="lt"?Et.push({value:wt.value,color:ed(Qt)}):Et.push({value:wt.value,color:"transparent"}))}Et.length>0&&Et[0].value!==-1/0&&Et.unshift({color:"transparent",value:-1/0});let Gt=Tt?St.Ly.Area:St.Ly.Line;Dt&&Tt&&(Gt=St.Ly.LineAndArea),Se.custom.thresholdsStyle={mode:Gt},Se.thresholds={mode:ng.O.Absolute,steps:Et}}return W.xaxis&&W.xaxis.show===!1&&W.xaxis.mode==="time"&&fe.push({matcher:{id:xi.Ct.byType,options:Yn.PU.time},properties:[{id:"custom.axisPlacement",value:St.vM.Hidden}]}),{fieldConfig:{defaults:(0,$e.omitBy)(Se,$e.isNil),overrides:fe},options:it,annotations:se}}function ed(W){return W.colorMode==="critical"?"red":W.colorMode==="warning"?"orange":W.colorMode==="custom"?W.fillColor||W.lineColor:"red"}function Ou(W){if(!W)return{};const se={axisPlacement:W.show?St.vM.Auto:St.vM.Hidden};if(W.label&&(se.axisLabel=W.label),W.logBase){const fe=W.logBase;(fe===2||fe===10)&&(se.scaleDistribution={type:St.L4.Log,log:fe})}return(0,$e.omitBy)({unit:W.format,decimals:td(W.decimals),min:td(W.min),max:td(W.max),custom:se},$e.isNil)}function og(W,se,fe){for(const[we,ke]of Object.entries(se))we!=="custom"&&ke!==W[we]&&fe.push({id:we,value:ke});const Pe=W.custom??{},Se=se.custom??{};for(const[we,ke]of Object.entries(Se))ke!==Pe[we]&&fe.push({id:`custom.${we}`,value:ke})}function td(W){if((0,$e.isNumber)(W))return W;if((0,$e.isString)(W)){const se=Number(W);if(!isNaN(se))return se}}function ig(W){const se=[];for(const fe of Object.keys(W)){const Pe=po.AS.getIfExists(fe);Pe&&se.push(Pe.id)}return se}function lg(W){W.fieldConfig?.defaults?.custom?.hideFrom?.graph!==void 0&&(W.fieldConfig.defaults.custom.hideFrom.viz=W.fieldConfig.defaults.custom.hideFrom.graph,delete W.fieldConfig.defaults.custom.hideFrom.graph),W.fieldConfig?.overrides&&(W.fieldConfig.overrides=W.fieldConfig.overrides.map(se=>(se.properties=se.properties.map(fe=>(fe.id==="custom.hideFrom"&&fe.value.graph&&(fe.value.viz=fe.value.graph,delete fe.value.graph),fe)),se)))}function Iu(W){return{matcher:{id:xi.Ct.byValue,options:{reducer:W,op:St.zT.GTE,value:0}},properties:[{id:"custom.hideFrom",value:{tooltip:!0,viz:!1,legend:!0}}]}}function Au(W){const se=mo.S.stacking?.group;return{mode:W?St.gs.Normal:St.gs.None,group:(0,$e.isString)(W)?W:se}}const Ru=new L.m(Zf).setPanelChangeHandler(sg).useFieldConfig((0,mo.V)(mo.S)).setPanelOptions(W=>{ur.D(W,!1,!0),Fr.H(W),W.addCustomEditor({id:"timezone",name:"Time zone",path:"timezone",category:["Axis"],editor:eg,defaultValue:void 0})}).setSuggestionsSupplier(new Xc).setDataSupport({annotations:!0,alertStates:!0});var nd=e(46923),ad=e(35090);const Lu={wrapper:(0,K.css)` height: 100%; overflow: scroll; `},cg=({data:W,options:se})=>{const fe=(0,P.createRef)(),Pe=(0,P.useMemo)(()=>(0,ad.L)(W.series[0]),[W.series]),Se=(0,Z.A)(async()=>await(0,Vd.l)().get(W.request?.targets[0].datasource?.uid));return!W||!W.series.length||!Pe?P.createElement("div",{className:"panel-empty"},P.createElement("p",null,"No data found in response")):P.createElement("div",{className:Lu.wrapper},P.createElement("div",{ref:fe}),P.createElement(nd.V,{dataFrames:W.series,scrollElementClass:Lu.wrapper,traceProp:Pe,datasource:Se.value,topOfViewRef:fe,createSpanLink:se.createSpanLink}))},Bu=new L.m(cg);var Uu=e(85200),hh=e(40458);const vh=({data:W,timeRange:se,timeZone:fe,width:Pe,height:Se,options:we,fieldConfig:ke,replaceVariables:Je,id:it})=>{const ct=!!R.$.featureToggles.newVizTooltips,{dataLinkPostProcessor:ht}=(0,sn.d2)(),Et=we.xField??W.series[0].fields.find(Bt=>Bt.type===Yn.PU.number)?.name,Tt=(Bt,Gt,Lt)=>(Gt={...Gt,x:Uu.sJ.get(xi.Ct.byName).get(Et)},(0,hh.m)(Bt,Gt)),Dt=(0,P.useMemo)(()=>{if(W.series.length>1)return{warning:"Only one frame is supported, consider adding a join transformation",frames:W.series};let Bt=W.series,Gt;if(we.xField){if(Gt=(0,Qs.findFieldIndex)(we.xField,Bt[0]),Gt==null)return{warning:"Unable to find field: "+we.xField,frames:W.series}}else if(Gt=Bt[0].fields.findIndex(Lt=>Lt.type===Yn.PU.number),Gt===-1)return{warning:"No numeric fields found for X axis",frames:Bt};if(Gt!=null){const Lt=Bt[0].fields[Gt];if(Lt.type===Yn.PU.number&&!(0,kr.g2)(Lt.values))return{warning:"Values must be in ascending order",frames:Bt}}return{frames:Sl(Bt,R.$.theme2,void 0,Gt)}},[W.series,we.xField]);return Dt.warning||!Dt.frames?P.createElement($t.a,{panelId:it,fieldConfig:ke,data:W,message:Dt.warning,needsNumberField:!0}):P.createElement(Di,{frames:Dt.frames,structureRev:W.structureRev,timeRange:se,timeZone:fe,width:Pe,height:Se,legend:we.legend,options:we,preparePlotFrame:Tt},(Bt,Gt)=>(Gt.fields.some(Lt=>!!Lt.config.links?.length)&&(Gt=go(Gt,Dt.frames,Je,fe,ht)),P.createElement(P.Fragment,null,P.createElement(wl.Z,{config:Bt}),we.tooltip.mode!==St.$N.None&&P.createElement(P.Fragment,null,ct?P.createElement(fr.xl,{config:Bt,hoverMode:we.tooltip.mode===St.$N.Single?fr.b3.xOne:fr.b3.xAll,render:(Lt,wt,Qt,nn=!1)=>P.createElement(No.k,{frames:Dt.frames,seriesFrame:Gt,dataIdxs:wt,seriesIdx:Qt,mode:we.tooltip.mode,sortOrder:we.tooltip.sort,isPinned:nn,scrollable:Ws(we.tooltip)}),maxWidth:we.tooltip.maxWidth,maxHeight:we.tooltip.maxHeight}):P.createElement(Ia.T,{frames:Dt.frames,data:Gt,config:Bt,mode:we.tooltip.mode,sortOrder:we.tooltip.sort,timeZone:fe})))))};class dg{getSuggestionsForData(se){const{dataSummary:fe}=se;return fe.numberFieldCount<2||fe.rowCountTotal<2||fe.rowCountTotal<2?void 0:se.getListAppender({name:es.m.LineChart,pluginId:"trend",options:{legend:{calcs:[],displayMode:St.lm.Hidden,placement:"right",showLegend:!1}},fieldConfig:{defaults:{custom:{}},overrides:[]},cardOptions:{previewModifier:Se=>{Se.fieldConfig?.defaults.custom?.drawStyle!==St.GR.Bars&&(Se.fieldConfig.defaults.custom.lineWidth=Math.max(Se.fieldConfig.defaults.custom.lineWidth??1,2))}}})}}const Nu=new L.m(vh).useFieldConfig((0,mo.V)(mo.S,!1)).setPanelOptions(W=>{const se=["X Axis"];W.addFieldNamePicker({path:"xField",name:"X Field",description:"An increasing numeric value",category:se,defaultValue:void 0,settings:{isClearable:!0,placeholderText:"First numeric value",filter:fe=>fe.type===Yn.PU.number}}),ur.D(W,!1,!0),Fr.H(W)}).setSuggestionsSupplier(new dg),ug=[{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"}],mg=()=>{const W=(0,k.of)(fg);return P.createElement("div",{className:W.container},P.createElement("h1",{className:W.title},"Welcome to Grafana"),P.createElement("div",{className:W.help},P.createElement("h3",{className:W.helpText},"Need help?"),P.createElement("div",{className:W.helpLinks},ug.map((se,fe)=>P.createElement("a",{key:`${se.label}-${fe}`,className:W.helpLink,href:`${se.href}?utm_source=grafana_gettingstarted`},se.label)))))},fg=W=>({container:(0,K.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 ${W.spacing(3)}; ${W.breakpoints.down("lg")} { background-position: 0px; flex-direction: column; align-items: flex-start; justify-content: center; } ${W.breakpoints.down("sm")} { padding: 0 ${W.spacing(1)}; } `,title:(0,K.css)` margin-bottom: 0; ${W.breakpoints.down("lg")} { margin-bottom: ${W.spacing(1)}; } ${W.breakpoints.down("md")} { font-size: ${W.typography.h2.fontSize}; } ${W.breakpoints.down("sm")} { font-size: ${W.typography.h3.fontSize}; } `,help:(0,K.css)` display: flex; align-items: baseline; `,helpText:(0,K.css)` margin-right: ${W.spacing(2)}; margin-bottom: 0; ${W.breakpoints.down("md")} { font-size: ${W.typography.h4.fontSize}; } ${W.breakpoints.down("sm")} { display: none; } `,helpLinks:(0,K.css)` display: flex; flex-wrap: wrap; `,helpLink:(0,K.css)` margin-right: ${W.spacing(2)}; text-decoration: underline; text-wrap: no-wrap; ${W.breakpoints.down("sm")} { margin-right: 8px; } `}),gg=new L.m(mg).setNoPadding();var pg=(W=>(W[W.NoData=0]="NoData",W[W.BadFrameSelection=1]="BadFrameSelection",W[W.XNotFound=2]="XNotFound",W))(pg||{});function sc(W){return W.type===Yn.PU.number}function hg(W,se){if(!se||!se.length)return{error:0};W||(W={frame:0});let fe=se[W.frame??0];if(!fe)return{error:1};let Pe=-1;for(let Je=0;Je<fe.fields.length;Je++){const it=fe.fields[Je];if(W.x&&W.x===(0,Za.Ct)(it,fe,se)){Pe=Je;break}if(sc(it)&&!W.x){Pe=Je;break}}let Se=!1;const we=fe.fields[Pe],ke=[we];for(const Je of fe.fields)if(Je.type===Yn.PU.time&&(Se=!0),!(Je===we||!sc(Je))){if(W.exclude){const it=(0,Za.Ct)(Je,fe,se);if(W.exclude.includes(it))continue}ke.push(Je)}return{x:we,fields:{x:wu(we),y:vg(we)},frame:{...fe,fields:ke},hasData:fe.fields.length>0,hasTime:Se}}function wu(W){return W?se=>W===se||!!(W.state&&W.state===se.state):()=>!1}function vg(W){if(!W)return()=>!1;const se=wu(W);return fe=>!se(fe,{fields:[],length:0},[])}const Eg=({value:W,onChange:se,context:fe})=>{const Pe=(0,P.useMemo)(()=>fe?.data?.length?fe.data.map((Je,it)=>({value:it,label:`${(0,Za.Ri)(Je,it)} (index: ${it}, rows: ${Je.length})`})):[{value:0,label:"First result"}],[fe.data]),Se=(0,P.useMemo)(()=>hg(W,fe.data),[fe.data,W]),we=(0,P.useMemo)(()=>{const Je={numberFields:[],yFields:[],xAxis:W?.x?{label:`${W.x} (Not found)`,value:W.x}:void 0},it=fe.data?fe.data[W?.frame??0]:void 0;if(it){const ct="x"in Se?(0,Za.Ct)(Se.x,Se.frame,fe.data):void 0;for(let ht of it.fields)if(sc(ht)){const Et=(0,Za.Ct)(ht,it,fe.data),Tt={label:Et,value:Et};Je.numberFields.push(Tt),W?.x&&Et===W.x&&(Je.xAxis=Tt),ct!==Et&&Je.yFields.push({label:Et,value:W?.exclude?.includes(Et)})}Je.xAxis||(Je.xAxis={label:ct,value:ct})}return Je},[Se,fe.data,W]),ke=(0,k.of)(yg);return fe.data?.length?P.createElement("div",null,P.createElement(Vt.D,{label:"Data"},P.createElement(he.l6,{isClearable:!0,options:Pe,placeholder:"Change filter",value:Pe.find(Je=>Je.value===W?.frame),onChange:Je=>{se({...W,frame:Je?.value,x:void 0})}})),P.createElement(Vt.D,{label:"X Field"},P.createElement(he.l6,{isClearable:!0,options:we.numberFields,value:we.xAxis,placeholder:`${we.numberFields?.[0].label} (First numeric)`,onChange:Je=>{se({...W,x:Je?.value})}})),P.createElement(Vt.D,{label:"Y Fields"},P.createElement("div",null,we.yFields.map(Je=>P.createElement("div",{key:Je.label,className:ke.row},P.createElement(Xa.K,{name:Je.value?"eye-slash":"eye",onClick:()=>{const it=W?.exclude?[...W.exclude]:[];let ct=it.indexOf(Je.label);ct<0?it.push(Je.label):it.splice(ct,1),se({...W,exclude:it})},tooltip:Je.value?"Disable":"Enable"}),Je.label))))):P.createElement("div",null,"No data...")},yg=W=>({sorter:(0,K.css)` margin-top: 10px; display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; cursor: pointer; `,row:(0,K.css)` padding: ${W.spacing(.5,1)}; border-radius: ${W.shape.radius.default}; background: ${W.colors.background.secondary}; min-height: ${W.spacing(4)}; display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; margin-bottom: 3px; border: 1px solid ${W.components.input.borderColor}; `});var Dg=e(54391),Fu=e(76218),Wu=e(78437);const Pg=({value:W,onChange:se,context:fe,baseNameMode:Pe,frameFilter:Se=-1})=>{const we=(Je,it)=>{se({...W,[it]:Je})},ke=fe.data&&Se>-1?fe.data[Se]:void 0;return P.createElement("div",null,P.createElement(Vt.D,{label:"X Field"},P.createElement(Fu.O,{value:W.x??"",context:fe,onChange:Je=>we(Je,"x"),item:{id:"x",name:"x",settings:{filter:Je=>ke?.fields.some(it=>it.state?.displayName===Je.state?.displayName)??!0,baseNameMode:Pe,placeholderText:"select X field"}}})),P.createElement(Vt.D,{label:"Y Field"},P.createElement(Fu.O,{value:W.y??"",context:fe,onChange:Je=>we(Je,"y"),item:{id:"y",name:"y",settings:{filter:Je=>ke?.fields.some(it=>it.state?.displayName===Je.state?.displayName)??!0,baseNameMode:Pe,placeholderText:"select Y field"}}})),P.createElement(Vt.D,{label:"Point color"},P.createElement(Wu.NO,{value:W.pointColor,context:fe,onChange:Je=>we(Je,"pointColor"),item:{id:"x",name:"x",settings:{baseNameMode:Pe,isClearable:!0,placeholder:"Use standard color scheme"}}})),P.createElement(Vt.D,{label:"Point size"},P.createElement(Wu.gm,{value:W.pointSize,context:fe,onChange:Je=>we(Je,"pointSize"),item:{id:"x",name:"x",settings:{min:1,max:100}}})))};var sd=(W=>(W.Auto="auto",W.Manual="manual",W))(sd||{}),mi=(W=>(W.Lines="lines",W.Points="points",W.PointsAndLines="points+lines",W))(mi||{});const Eh={exclude:[]},rd={label:St.yL.Auto,show:"points"},yh={series:[]},Cg=({value:W,onChange:se,context:fe})=>{const Pe=(0,P.useMemo)(()=>fe?.data?.length?fe.data.map((Et,Tt)=>({value:Tt,label:`${(0,Za.Ri)(Et,Tt)} (index: ${Tt}, rows: ${Et.length})`})):[{value:0,label:"First result"}],[fe.data]),[Se,we]=(0,P.useState)(0),ke=(0,k.of)(bg),Je=(Et,Tt,Dt)=>{se(W.map((Bt,Gt)=>Gt===Tt?{...Bt,[Dt]:Et}:Bt))},it=()=>{se([...W,{pointColor:void 0,pointSize:rd.pointSize}]),we(W.length)};(0,P.useEffect)(()=>{W?.length||it()},[]);const ct=Et=>{se(W.filter((Tt,Dt)=>Dt!==Et))},ht=Et=>Et===Se?`${ke.row} ${ke.sel}`:ke.row;return P.createElement(P.Fragment,null,P.createElement(Y.$n,{icon:"plus",size:"sm",variant:"secondary",onClick:it,className:ke.marginBot},"Add series"),P.createElement("div",{className:ke.marginBot},W.map((Et,Tt)=>P.createElement("div",{key:`series/${Tt}`,className:ht(Tt),onClick:()=>we(Tt),role:"button","aria-label":`Select series ${Tt+1}`,tabIndex:0,onKeyPress:Dt=>{Dt.key==="Enter"&&we(Tt)}},P.createElement(Dg.R,{name:Et.name??`Series ${Tt+1}`,onChange:Dt=>Je(Dt,Tt,"name")}),P.createElement(Xa.K,{name:"trash-alt",title:"remove",className:(0,K.cx)(ke.actionIcon),onClick:()=>ct(Tt),tooltip:"Delete series"})))),Se>=0&&W[Se]&&P.createElement(P.Fragment,null,Pe.length>1&&P.createElement(Vt.D,{label:"Data"},P.createElement(he.l6,{isClearable:!1,options:Pe,placeholder:"Change filter",value:Pe.find(Et=>Et.value===W[Se].frame)??0,onChange:Et=>{se(W.map((Tt,Dt)=>Dt===Se?Et===null?{...W[Dt],frame:void 0}:{...W[Dt],frame:Et?.value,x:void 0,y:void 0}:Tt))}})),P.createElement(Pg,{key:`series/${Se}`,baseNameMode:ro.X4.ExcludeBaseNames,item:{},context:fe,value:W[Se],onChange:Et=>{se(W.map((Tt,Dt)=>Dt===Se?Et:Tt))},frameFilter:W[Se].frame??void 0})))},bg=W=>({marginBot:(0,K.css)({marginBottom:"20px"}),row:(0,K.css)({padding:`${W.spacing(.5,1)}`,borderRadius:`${W.shape.radius.default}`,background:`${W.colors.background.secondary}`,minHeight:`${W.spacing(4)}`,display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"3px",cursor:"pointer",border:`1px solid ${W.components.input.borderColor}`,"&:hover":{border:`1px solid ${W.components.input.borderHover}`}}),sel:(0,K.css)({border:`1px solid ${W.colors.primary.border}`,"&:hover":{border:`1px solid ${W.colors.primary.border}`}}),actionIcon:(0,K.css)({color:`${W.colors.text.secondary}`,"&:hover":{color:`${W.colors.text}`}})});var Ku=e(84596);const Tg=({allSeries:W,data:se,manualSeriesConfigs:fe,seriesMapping:Pe,rowIndex:Se,hoveredPointIndex:we,options:ke})=>{const Je=(0,k.of)(Mg);if(!W||Se==null)return null;const it=W[we],ct=it.frame(se),ht=it.x(ct),Et=it.y(ct);let Tt;if(Et.getLinks){const Lt=Et.values[Se],wt=Et.display?Et.display(Lt):{text:`${Lt}`,numeric:+Lt};Tt=Et.getLinks({calculatedValue:wt,valueRowIndex:Se}).map(Qt=>(Qt.title||(Qt.title=(0,Nc.eT)(Qt.href)),Qt))}let Dt=ct.fields.filter(Lt=>Lt!==ht&&Lt!==Et),Bt=null,Gt=null;if(Pe===sd.Manual&&fe){const Lt=fe[we]?.pointColor?.field??"",wt=fe[we]?.pointSize?.field??"",Qt=Lt?(0,Qs.findField)(ct,Lt):void 0,nn=wt?(0,Qs.findField)(ct,wt):void 0;Gt={colorFacetFieldName:Lt,sizeFacetFieldName:wt,colorFacetValue:Qt?.values[Se],sizeFacetValue:nn?.values[Se]},Dt=Dt.filter(Jt=>Jt!==Qt&&Jt!==nn)}return Bt={name:(0,Za.Ct)(Et,ct),val:Et.values[Se],field:Et,color:it.pointColor(ct)},P.createElement(P.Fragment,null,P.createElement("table",{className:Je.infoWrap},P.createElement("tr",null,P.createElement("th",{colSpan:2,style:{backgroundColor:Bt.color}})),P.createElement("tbody",null,P.createElement("tr",null,P.createElement("th",null,(0,Za.Ct)(ht,ct)),P.createElement("td",null,od(ht,ht.values[Se]))),P.createElement("tr",null,P.createElement("th",null,Bt.name,":"),P.createElement("td",null,od(Bt.field,Bt.val))),Gt!==null&&Gt.colorFacetFieldName&&P.createElement("tr",null,P.createElement("th",null,Gt.colorFacetFieldName,":"),P.createElement("td",null,Gt.colorFacetValue)),Gt!==null&&Gt.sizeFacetFieldName&&P.createElement("tr",null,P.createElement("th",null,Gt.sizeFacetFieldName,":"),P.createElement("td",null,Gt.sizeFacetValue)),Dt.map((Lt,wt)=>P.createElement("tr",{key:wt},P.createElement("th",null,(0,Za.Ct)(Lt,ct),":"),P.createElement("td",null,od(Lt,Lt.values[Se])))),Tt&&Tt.length>0&&P.createElement("tr",null,P.createElement("td",{colSpan:2},P.createElement(qr.gW,null,Tt.map((Lt,wt)=>P.createElement(Y.z9,{key:wt,icon:"external-link-alt",target:Lt.target,href:Lt.href,onClick:Lt.onClick,fill:"text",style:{width:"100%"}},Lt.title))))))))};function od(W,se){return W.display?(0,ds.cN)(W.display(se)):`${se}`}const Mg=W=>({infoWrap:(0,K.css)({padding:"8px",width:"100%",th:{fontWeight:W.typography.fontWeightMedium,padding:W.spacing(.25,2)}}),highlight:(0,K.css)({background:W.colors.action.hover}),xVal:(0,K.css)({fontWeight:W.typography.fontWeightBold}),icon:(0,K.css)({marginRight:W.spacing(1),verticalAlign:"middle"})});var Sg=e(79871);function id(W,se){return W.display?(0,ds.cN)(W.display(se)):`${se}`}const xg=({dataIdxs:W,seriesIdx:se,data:fe,allSeries:Pe,dismiss:Se,options:we,isPinned:ke})=>{const Je=(0,k.of)(No.$),it=W.find(Jt=>Jt!==null),ct=se-1;if(!Pe||it==null)return null;const ht=Pe[ct],Et=ht.frame(fe),Tt=ht.x(Et),Dt=ht.y(Et);let Bt=ht.name;we.seriesMapping==="manual"&&(Bt=we.series?.[ct]?.name??`Series ${ct+1}`);let Gt=ht.pointColor(Et);Array.isArray(Gt)&&(Gt=Gt[it]);const Lt={label:Bt,value:"",color:(0,Wr.alpha)(Gt,.5),colorIndicator:Sg.fX.marker_md},wt=[{label:(0,Za.Ct)(Tt,Et),value:id(Tt,Tt.values[it])},{label:(0,Za.Ct)(Dt,Et),value:id(Dt,Dt.values[it])}],Qt=Et.fields.filter(Jt=>Jt!==Tt&&Jt!==Dt);Qt&&Qt.forEach(Jt=>{wt.push({label:Jt.name,value:id(Jt,Jt.values[it])})});const nn=()=>{let Jt=[];if(Dt.getLinks){const In=Dt.values[it],rn=Dt.display?Dt.display(In):{text:`${In}`,numeric:+In};Jt=Dt.getLinks({calculatedValue:rn,valueRowIndex:it}).map(bn=>(bn.title||(bn.title=(0,Nc.eT)(bn.href)),bn))}return Jt};return P.createElement("div",{className:Je.wrapper},P.createElement(mu.A,{headerLabel:Lt,isPinned:ke}),P.createElement(du.o,{contentLabelValue:wt,isPinned:ke}),ke&&P.createElement(uu.S,{dataLinks:nn()}))};var $u=e(43228);const Vu=5;function Og(W){return{standardOptions:{[$s.uo.Min]:{hideFromDefaults:!0},[$s.uo.Max]:{hideFromDefaults:!0},[$s.uo.Unit]:{hideFromDefaults:!0},[$s.uo.Decimals]:{hideFromDefaults:!0},[$s.uo.NoValue]:{hideFromDefaults:!0},[$s.uo.DisplayName]:{hideFromDefaults:!0},[$s.uo.Thresholds]:{hideFromDefaults:!0},[$s.uo.Mappings]:{hideFromDefaults:!0},[$s.uo.Color]:{settings:{byValueSupport:!0,bySeriesSupport:!0,preferThresholdsMode:!1},defaultValue:{mode:Ss.Y.PaletteClassic}}},useCustomConfig:se=>{se.addRadio({path:"show",name:"Show",defaultValue:W.show,settings:{options:[{label:"Points",value:mi.Points},{label:"Lines",value:mi.Lines},{label:"Both",value:mi.PointsAndLines}]}}).addSliderInput({path:"pointSize.fixed",name:"Point size",defaultValue:W.pointSize?.fixed??Vu,settings:{min:1,max:100,step:1},showIf:fe=>fe.show!==mi.Lines}).addCustomEditor({id:"lineStyle",path:"lineStyle",name:"Line style",showIf:fe=>fe.show!==mi.Points,editor:$u.F,override:$u.F,process:ro.hS,shouldApply:fe=>fe.type===Yn.PU.number}).addSliderInput({path:"lineWidth",name:"Line width",defaultValue:W.lineWidth,settings:{min:0,max:10,step:1},showIf:fe=>fe.show!==mi.Points}),vo.r(se,W),io.e(se)}}}function Ig(W,se,fe,Pe,Se,we){let ke,Je;try{ke=Ag(W,se()),Je=Rg(se,ke,fe,Pe,Se,we)}catch(it){let ct="Unknown error in prepScatter";return typeof it=="string"?ct=it:it instanceof Error&&(ct=it.message),{error:ct,series:[]}}return{series:ke,builder:Je}}function _u(W,se,fe,Pe,Se,we){const ke=se[fe],Je=ke.fields[Se];let it=Je.state??{};it.seriesIndex=W,Je.state=it;let ct=we.pointColorFixed?R.$.theme2.visualization.getColorByName(we.pointColorFixed):(0,Vs.lz)(Je,R.$.theme2).color,ht=()=>ct;const Et={...rd,...Je.config.custom};let Tt=Vs.uf.get(Ss.Y.PaletteClassic);if(we.pointColorIndex){const wt=se[fe].fields[we.pointColorIndex];if(wt)if(Tt=(0,Vs.Qi)(Je),Tt.isByValue){const Qt=we.pointColorIndex;ht=nn=>{const Jt=nn.fields[Qt];return Jt.state?.range&&(Jt.state.range=void 0),Jt.display=(0,ha.J)({field:Jt,theme:R.$.theme2}),Jt.values.map(In=>Jt.display(In).color)}}else ct=Tt.getCalculator(wt,R.$.theme2)(wt.values[0],1),ht=()=>ct}let Dt=we.pointSizeConfig,Bt=we.pointSizeConfig?.fixed??Je.config.custom?.pointSize?.fixed??Vu,Gt=()=>Bt;we.pointSizeIndex?Gt=wt=>{const Qt=(0,Qs.getScaledDimensionForField)(wt.fields[we.pointSizeIndex],we.pointSizeConfig,St.QH.Quad),nn=Array(wt.length);for(let Jt=0;Jt<wt.length;Jt++)nn[Jt]=Qt.get(Jt);return nn}:Dt={fixed:Bt,min:Bt,max:Bt};const Lt=(0,Za.Ct)(Je,ke,se);return{name:Lt,frame:wt=>wt[fe],x:wt=>wt.fields[Pe],y:wt=>wt.fields[Se],legend:()=>[{label:Lt,color:ct,getItemKey:()=>Lt,yAxis:Se}],showLine:Et.show!==mi.Points,lineWidth:Et.lineWidth??2,lineStyle:Et.lineStyle,lineColor:()=>ct,showPoints:Et.show!==mi.Lines?St.yL.Always:St.yL.Never,pointSize:Gt,pointColor:ht,pointSymbol:(wt,Qt)=>"circle",label:St.yL.Never,labelValue:()=>"",show:!ke.fields[Se].config.custom.hideFrom?.viz,hints:{pointSize:Dt,pointColor:{mode:Tt}}}}function Ag(W,se){let fe=0;if(!se.length)throw"Missing data";if(W.seriesMapping==="manual"){if(!W.series?.length)throw"Missing series config";const it=[];for(const ct of W.series){if(!ct?.x)throw"Select X dimension";if(!ct?.y)throw"Select Y dimension";for(let ht=0;ht<se.length;ht++){if(ct.frame!==void 0&&ct.frame!==ht)continue;const Et=se[ht],Tt=(0,Qs.findFieldIndex)(ct.x,Et,se);if(Tt!=null){const Dt=(0,Qs.findFieldIndex)(ct.y,Et,se);if(Dt==null)throw"Y must be in the same frame as X";const Bt={pointColorFixed:ct.pointColor?.fixed,pointColorIndex:(0,Qs.findFieldIndex)(ct.pointColor?.field,Et,se),pointSizeConfig:ct.pointSize,pointSizeIndex:(0,Qs.findFieldIndex)(ct.pointSize?.field,Et,se)};it.push(_u(fe++,se,ht,Tt,Dt,Bt))}}}return it}const Pe=W.dims??{},Se=Pe.frame??0,we=se[Se],ke=[];let Je=(0,Qs.findFieldIndex)(Pe.x,we,se);for(let it=0;it<we.fields.length;it++)if(sc(we.fields[it])){if(Je==null||it===Je){Je=it;continue}if(Pe.exclude&&Pe.exclude.includes((0,Za.Ct)(we.fields[it],we,se)))continue;ke.push(it)}if(Je==null)throw"Missing X dimension";if(!ke.length)throw"No Y values";return ke.map(it=>_u(fe++,se,Se,Je,it,{}))}const Rg=(W,se,fe,Pe,Se,we)=>{let ke,Je;function it(Jt){return(rn,bn,Bn,Fn)=>(ws.A.orient(rn,bn,(xn,un,Rn,Pn,ea,jn,la,Ya,Ea,gs,ya,_a,ra,Hn,Wn)=>{const _n=ws.A.pxRatio,oa=se[bn-1];let Ta=rn.data[bn],Ca=oa.showLine,Aa=oa.showPoints===St.yL.Always;!Aa&&oa.showPoints===St.yL.Auto&&(Aa=Ta[0].length<1e3),!Aa&&!Ca&&(Ca=!0);let On=1;rn.ctx.save(),rn.ctx.rect(rn.bbox.left,rn.bbox.top,rn.bbox.width,rn.bbox.height),rn.ctx.clip(),rn.ctx.fillStyle=xn.fill(),rn.ctx.strokeStyle=xn.stroke(),rn.ctx.lineWidth=On;let zn=2*Math.PI,Qn=Pn.key,Ka=ea.key,Ra=oa.hints.pointSize;const ns=oa.hints.pointColor.mode.isByValue;let ja=(Ra.max??Ra.fixed)*_n,Os=rn.posToVal(-ja/2,Qn),Xs=rn.posToVal(rn.bbox.width/_n+ja/2,Qn),no=rn.posToVal(rn.bbox.height/_n+ja/2,Ka),Ks=rn.posToVal(-ja/2,Ka),Jr=Jt.disp.size.values(rn,bn),Bi=Jt.disp.color.values(rn,bn),Vl=Jt.disp.color.alpha,ho=Ca?new Path2D:null,Ro=null;for(let ps=0;ps<Ta[0].length;ps++){let nr=Ta[0][ps],Ui=Ta[1][ps],Vo=Jr[ps]*_n;if(nr>=Os&&nr<=Xs&&Ui>=no&&Ui<=Ks){let _l=jn(nr,Pn,gs,Ya),lc=la(Ui,ea,ya,Ea);Ca&&ho.lineTo(_l,lc),Aa&&(rn.ctx.moveTo(_l+Vo/2,lc),rn.ctx.beginPath(),rn.ctx.arc(_l,lc,Vo/2,0,zn),ns&&Bi[ps]!==Ro&&(Ro=Bi[ps],rn.ctx.fillStyle=(0,Wr.alpha)(Ro,Vl),rn.ctx.strokeStyle=Ro),rn.ctx.fill(),rn.ctx.stroke(),Jt.each(rn,bn,ps,_l-Vo/2-On/2,lc-Vo/2-On/2,Vo+On,Vo+On))}}if(Ca){let ps=oa.frame(W());rn.ctx.strokeStyle=oa.lineColor(ps),rn.ctx.lineWidth=oa.lineWidth*_n;const{lineStyle:nr}=oa;nr&&nr.fill!=="solid"&&(nr.fill==="dot"&&(rn.ctx.lineCap="round"),rn.ctx.setLineDash(nr.dash??[10,10])),rn.ctx.stroke(ho)}rn.ctx.restore()}),null)}let ct=it({disp:{size:{values:(Jt,In)=>Jt.data[In][2]},color:{values:(Jt,In)=>Jt.data[In][3],alpha:.5}},each:(Jt,In,rn,bn,Bn,Fn,xn)=>{bn-=Jt.bbox.left,Bn-=Jt.bbox.top,ke.add({x:bn,y:Bn,w:Fn,h:xn,sidx:In,didx:rn})}});const ht=new xs.e;ht.setCursor({drag:{setScale:!0},dataIdx:(Jt,In)=>{if(In===1){const rn=ws.A.pxRatio;Je=null;let bn=1/0,Bn=Jt.cursor.left*rn,Fn=Jt.cursor.top*rn;ke.get(Bn,Fn,1,1,xn=>{if((0,To.ur)(Bn,Fn,xn.x,xn.y,xn.x+xn.w,xn.y+xn.h)){let un=xn.x+xn.w/2,Rn=xn.y+xn.h/2,Pn=un-Bn,ea=Rn-Fn,jn=Math.sqrt(Pn**2+ea**2);jn<=xn.w/2&&jn<=bn&&(bn=jn,Je=xn)}})}return Je&&In===Je.sidx?Je.didx:null},points:{size:(Jt,In)=>Je&&In===Je.sidx?Je.w/ws.A.pxRatio:0,fill:(Jt,In)=>"rgba(255,255,255,0.4)"}});const Et=()=>{we?.current&&(Pe&&Pe(void 0),Se&&Se())};let Tt=null;ht.addHook("init",(Jt,In)=>{!!R.$.featureToggles.newVizTooltips||(Jt.over.style.overflow="hidden"),Tt=Jt.root.parentElement,Se&&Tt?.addEventListener("click",Se)}),ht.addHook("destroy",Jt=>{Se&&(Tt?.removeEventListener("click",Se),Et())});let Dt;ht.addHook("syncRect",(Jt,In)=>{Dt=In}),Pe&&ht.addHook("setLegend",Jt=>{if(Jt.cursor.idxs!=null)for(let In=0;In<Jt.cursor.idxs.length;In++){const rn=Jt.cursor.idxs[In];if(rn!=null&&!we?.current){Pe({scatterIndex:In-1,xIndex:rn,pageX:Dt.left+Jt.cursor.left,pageY:Dt.top+Jt.cursor.top});return}}we?.current||Pe(void 0)}),ht.addHook("drawClear",Jt=>{Et(),ke=ke||new To.C$(0,0,Jt.bbox.width,Jt.bbox.height),ke.clear(),Jt.series.forEach((In,rn)=>{rn>0&&(In._paths=null)})}),ht.setMode(2);const Bt=W();let Gt=se[0].x(se[0].frame(Bt)),Lt=Gt.config,wt=Lt.custom,Qt=wt?.scaleDistribution;ht.addScale({scaleKey:"x",isTime:!1,orientation:St.Lt.Horizontal,direction:St.ON.Right,distribution:Qt?.type,log:Qt?.log,linearThreshold:Qt?.linearThreshold,min:Lt.min,max:Lt.max,softMin:wt?.axisSoftMin,softMax:wt?.axisSoftMax,centeredZero:wt?.axisCenteredZero,decimals:Lt.decimals});let nn=wt.axisLabel;return ht.addAxis({scaleKey:"x",placement:wt?.axisPlacement!==St.vM.Hidden?St.vM.Bottom:St.vM.Hidden,show:wt?.axisPlacement!==St.vM.Hidden,grid:{show:wt?.axisGridShow},border:{show:wt?.axisBorderShow},theme:fe,label:nn==null||nn===""?(0,Za.Ct)(Gt,se[0].frame(Bt),Bt):nn,formatValue:(Jt,In)=>(0,ds.cN)(Gt.display(Jt,In))}),se.forEach((Jt,In)=>{let rn=Jt.frame(Bt),bn=Jt.y(rn);const Bn=Jt.lineColor(rn),Fn=Bg(rn,Jt.pointColor);let xn=bn.config.unit??"y",un=bn.config,Rn=un.custom,Pn=Rn?.scaleDistribution;ht.addScale({scaleKey:xn,orientation:St.Lt.Vertical,direction:St.ON.Up,distribution:Pn?.type,log:Pn?.log,linearThreshold:Pn?.linearThreshold,min:un.min,max:un.max,softMin:Rn?.axisSoftMin,softMax:Rn?.axisSoftMax,centeredZero:Rn?.axisCenteredZero,decimals:un.decimals});let ea=Rn?.axisLabel;ht.addAxis({scaleKey:xn,theme:fe,placement:Rn?.axisPlacement===St.vM.Auto?St.vM.Left:Rn?.axisPlacement,show:Rn?.axisPlacement!==St.vM.Hidden,grid:{show:Rn?.axisGridShow},border:{show:Rn?.axisBorderShow},size:Rn?.axisWidth,label:ea==null||ea===""?(0,Za.Ct)(bn,se[In].frame(Bt),Bt):ea,formatValue:(jn,la)=>(0,ds.cN)(bn.display(jn,la))}),ht.addSeries({facets:[{scale:"x",auto:!0},{scale:xn,auto:!0}],pathBuilder:ct,theme:fe,scaleKey:"",lineColor:(0,Wr.alpha)(""+Bn,1),fillColor:(0,Wr.alpha)(Fn,.5),show:!Rn.hideFrom?.viz})}),ht};function zu(W,se,fe){return W.error||!se.length?[null]:[null,...W.series.map((Pe,Se)=>{const we=Pe.frame(se);let ke;const Je=Pe.pointColor(we);return Array.isArray(Je)?ke=Je:ke=Array(we.length).fill(Je),[Pe.x(we).values,Pe.y(we).values,Lg(we,Pe.pointSize),ke]})]}function Lg(W,se){const fe=se(W);return Array.isArray(fe)?fe:Array(W.length).fill(fe)}function Bg(W,se){const fe=se(W);return Array.isArray(fe)?fe[0]:fe}const ku=10,Ug=W=>{const[se,fe]=(0,P.useState)(),[Pe,Se]=(0,P.useState)([]),[we,ke]=(0,P.useState)(),[Je,it]=(0,P.useState)(),[ct,ht]=(0,P.useState)(),[Et,Tt]=(0,P.useState)(!1),Dt=!!R.$.featureToggles.newVizTooltips,Bt=(0,P.useRef)(!1),Gt=(0,Ku.A)(W.options),Lt=(0,Ku.A)(W.data),wt=()=>{Bt.current=!1,Tt(!1),nn(void 0)},Qt=()=>{Bt.current=!Bt.current,Tt(Bt.current)},nn=bn=>{ht(bn)},Jt=(0,P.useCallback)(()=>{const bn=()=>W.data.series,Bn=Ig(W.options,bn,R.$.theme2,Dt?null:nn,Dt?null:Qt,Dt?null:Bt);Bn.error?fe(Bn.error):Bn.series.length&&W.data.series&&(ke(Bn.builder),Se(Bn.series),it(()=>zu(Bn,W.data.series)),fe(void 0))},[W.data.series,W.options,Dt]),In=(0,P.useCallback)(()=>{it(()=>zu({error:se,series:Pe},W.data.series))},[W.data.series,se,Pe]);(0,P.useEffect)(()=>{Gt!==W.options||Lt?.structureRev!==W.data.structureRev?Jt():Lt?.series!==W.data.series&&In()},[W]);const rn=()=>{const bn=[],Bn=un=>un==null?"-":un.toFixed(1),Fn=R.$.theme2;for(let un=0;un<Pe.length;un++){const Rn=Pe[un],Pn=Rn.frame(W.data.series);if(Pn)for(const ea of Rn.legend())ea.getDisplayValues=()=>{const jn=W.options.legend.calcs;if(!jn?.length)return[];const la=Rn.y(Pn),Ya=la.display??Bn;let Ea=null;const gs=(0,po.Nw)({field:la,reducers:jn});return jn.map(ya=>{const _a=po.AS.get(ya);let ra=Ya;return _a.id===po.gy.diffperc&&(ra=(0,ha.J)({field:{...la,config:{...la.config,unit:"percent"}},theme:Fn})),(_a.id===po.gy.count||_a.id===po.gy.changeCount||_a.id===po.gy.distinctCount)&&(Ea||(Ea=(0,ha.J)({field:{...la,config:{...la.config,unit:"none"}},theme:Fn})),ra=Ea),{...ra(gs[ya]),title:_a.name,description:_a.description}})},ea.disabled=!(Rn.show??!0),W.options.seriesMapping===sd.Manual&&(ea.label=W.options.series?.[un]?.name??`Series ${un+1}`),ea.color=(0,Wr.alpha)(Rn.lineColor(Pn),1),bn.push(ea)}if(!W.options.legend.showLegend)return null;const xn={flexStart:(0,K.css)({div:{justifyContent:"flex-start"}})};return P.createElement(wn.KU.Legend,{placement:W.options.legend.placement,width:W.options.legend.width},P.createElement(kn.t,{className:xn.flexStart,placement:W.options.legend.placement,items:bn,displayMode:W.options.legend.displayMode}))};return se||!we||!Je?P.createElement("div",{className:"panel-empty"},P.createElement("p",null,se)):P.createElement(P.Fragment,null,P.createElement(wn.KU,{width:W.width,height:W.height,legend:rn()},(bn,Bn)=>P.createElement(xc.Z,{config:we,data:Je,width:bn,height:Bn},Dt&&W.options.tooltip.mode!==St.$N.None&&P.createElement(fr.xl,{config:we,hoverMode:fr.b3.xyOne,render:(Fn,xn,un,Rn,Pn)=>P.createElement(xg,{data:W.data.series,dataIdxs:xn,allSeries:Pe,dismiss:Pn,isPinned:Rn,options:W.options,seriesIdx:un}),maxWidth:W.options.tooltip.maxWidth,maxHeight:W.options.tooltip.maxHeight}))),!Dt&&P.createElement(ma.ZL,null,ct&&W.options.tooltip.mode!==St.$N.None&&P.createElement(Qa.o,{position:{x:ct.pageX,y:ct.pageY},offset:{x:ku,y:ku},allowPointerEvents:Bt.current},Et&&P.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end"}},P.createElement(Ys.J,{onClick:wt,style:{position:"relative",top:"auto",right:"auto",marginRight:0}})),P.createElement(Tg,{options:W.options.tooltip,allSeries:Pe,manualSeriesConfigs:W.options.series,seriesMapping:W.options.seriesMapping,rowIndex:ct.xIndex,hoveredPointIndex:ct.scatterIndex,data:W.data.series}))))},Ng=new L.m(Ug).useFieldConfig(Og(rd)).setPanelOptions(W=>{W.addRadio({path:"seriesMapping",name:"Series mapping",defaultValue:"auto",settings:{options:[{value:"auto",label:"Table",description:"Plot values within a single table result"},{value:"manual",label:"Manual",description:"Construct values from any result"}]}}).addCustomEditor({id:"xyPlotConfig",path:"dims",name:"",editor:Eg,showIf:se=>se.seriesMapping==="auto"}).addCustomEditor({id:"series",path:"series",name:"",defaultValue:[],editor:Cg,showIf:se=>se.seriesMapping==="manual"}),ur.D(W,!0),Fr.H(W)}),wg={"core:plugin/graphite":async()=>await e.e(6134).then(e.bind(e,8652)),"core:plugin/cloudwatch":async()=>await Promise.all([e.e(2571),e.e(3766)]).then(e.bind(e,52571)),"core:plugin/dashboard":async()=>await e.e(2058).then(e.bind(e,92058)),"core:plugin/elasticsearch":async()=>await Promise.all([e.e(2261),e.e(1717)]).then(e.bind(e,82261)),"core:plugin/opentsdb":async()=>await e.e(747).then(e.bind(e,24989)),"core:plugin/grafana":async()=>await e.e(3648).then(e.bind(e,62391)),"core:plugin/influxdb":async()=>await Promise.all([e.e(7166),e.e(9404)]).then(e.bind(e,23912)),"core:plugin/loki":async()=>await Promise.all([e.e(1216),e.e(6587),e.e(6499),e.e(1477)]).then(e.bind(e,16499)),"core:plugin/jaeger":async()=>await e.e(2032).then(e.bind(e,2255)),"core:plugin/zipkin":async()=>await e.e(2963).then(e.bind(e,95616)),"core:plugin/mixed":async()=>await e.e(2513).then(e.bind(e,12870)),"core:plugin/mysql":async()=>await Promise.all([e.e(7166),e.e(6918)]).then(e.bind(e,18715)),"core:plugin/grafana-postgresql-datasource":async()=>await Promise.all([e.e(7166),e.e(8651)]).then(e.bind(e,38254)),"core:plugin/mssql":async()=>await Promise.all([e.e(7166),e.e(9040)]).then(e.bind(e,47371)),"core:plugin/prometheus":async()=>await Promise.all([e.e(1216),e.e(4254),e.e(9546)]).then(e.bind(e,94254)),"core:plugin/grafana-testdata-datasource":async()=>await e.e(9513).then(e.bind(e,35990)),"core:plugin/cloud-monitoring":async()=>await Promise.all([e.e(8054),e.e(1347),e.e(9681)]).then(e.bind(e,11347)),"core:plugin/azuremonitor":async()=>await Promise.all([e.e(6934),e.e(8115)]).then(e.bind(e,76934)),"core:plugin/tempo":async()=>await Promise.all([e.e(3543),e.e(1841)]).then(e.bind(e,63543)),"core:plugin/alertmanager":async()=>await e.e(4737).then(e.bind(e,27013)),"core:plugin/grafana-pyroscope-datasource":async()=>await e.e(6312).then(e.bind(e,68929)),"core:plugin/parca":async()=>await e.e(6329).then(e.bind(e,51971)),"core:plugin/text":b,"core:plugin/timeseries":C,"core:plugin/trend":M,"core:plugin/state-timeline":v,"core:plugin/status-history":E,"core:plugin/candlestick":g,"core:plugin/graph":async()=>await Promise.all([e.e(7982),e.e(8068)]).then(e.bind(e,94656)),"core:plugin/xychart":I,"core:plugin/geomap":async()=>await Promise.all([e.e(1698),e.e(9320),e.e(190)]).then(e.bind(e,63928)),"core:plugin/canvas":async()=>await e.e(7523).then(e.bind(e,68432)),"core:plugin/dashlist":u,"core:plugin/alertlist":n,"core:plugin/annolist":o,"core:plugin/heatmap":async()=>await e.e(5857).then(e.bind(e,46761)),"core:plugin/table":D,"core:plugin/table-old":async()=>await e.e(8777).then(e.bind(e,78491)),"core:plugin/news":m,"core:plugin/live":h,"core:plugin/stat":_c,"core:plugin/datagrid":c,"core:plugin/debug":i,"core:plugin/flamegraph":l,"core:plugin/gettingstarted":f,"core:plugin/gauge":Um,"core:plugin/piechart":a,"core:plugin/bargauge":r,"core:plugin/barchart":s,"core:plugin/logs":p,"core:plugin/traces":y,"core:plugin/welcome":T,"core:plugin/nodeGraph":async()=>await Promise.all([e.e(1698),e.e(5511),e.e(7317)]).then(e.bind(e,86703)),"core:plugin/histogram":d,"core:plugin/alertGroups":t};var ld=e(81900),Fg=e(52762),Wg=e(44115),Kg=e(72635),$g=e(34796),Vg=e.n($g),_g=e(95093),zg=e.n(_g),kg=e(28848),Hu=e.n(kg),Hg=e(40961),Gg=e(8867),jg=e(69733),Yg=e(54625),Qg=e(24160),Jg=e(82960),Xg=e(75091),Zg=e(32975),qg=e(82611),ep=e(75226),Gu=e(29317),Qh=e(54087),Jh=e(80851),Xh=e(32176),Zh=e(31221),qh=e(91520),e0=e(92275),t0=e(82013),n0=e(2341),a0=e(19538),tp=e(39954),np=e(13303),ap=e(8984),sp=e(91950),ju=e(31140),rp=e(78827),op=e(68576),ip=e(92247);const Fl=ap;Fl.PanelPlugin=L.m,Fl.DataSourcePlugin=x.tD,Fl.AppPlugin=S.hX,Fl.DataSourceApi=x.mA;const lp=["jquery.flot.crosshair","jquery.flot.events","jquery.flot.fillbelow","jquery.flot.gauge","jquery.flot.pie","jquery.flot.selection","jquery.flot.stack","jquery.flot.stackpercent","jquery.flot.time","jquery.flot"].reduce((W,se)=>({...W,[se]:{fakeDep:1}}),{}),cp={"@emotion/css":K,"@emotion/react":Fg,"@grafana/data":tp,"@grafana/runtime":np,"@grafana/slate-react":Gu.Ay,"@grafana/ui":Fl,"app/core/app_events":{default:dr.lE,__useDefault:!0},"app/core/config":{default:pn.Ay,__useDefault:!0},"app/core/core":{appEvents:dr.lE,contextSrv:dr.TP},"app/core/services/backend_srv":{BackendSrv:Zo.Mf,getBackendSrv:Zo.AI},"app/core/table_model":{default:sp.A,__useDefault:!0},"app/core/time_series":{default:ju.A,__useDefault:!0},"app/core/time_series2":{default:ju.A,__useDefault:!0},"app/core/utils/datemath":de,"app/core/utils/flatten":rp,"app/core/utils/kbn":{default:op.A,__useDefault:!0},"app/core/utils/ticks":ip,"app/features/dashboard/impression_store":{impressions:Oe.A},d3:Wg,emotion:K,i18next:Kg,jquery:{default:Vg(),__useDefault:!0},...lp,lodash:{default:be(),__useDefault:!0},moment:{default:zg(),__useDefault:!0},prismjs:Hu(),react:P,"react-dom":Hg,"react-inlinesvg":Gg,"react-redux":jg,"react-router-dom":Yg,"react-router":Qg,redux:Jg,rxjs:Xg,"rxjs/operators":Zg,slate:qg.Ay,"slate-plain-serializer":ep.A,"slate-react":Gu.Ay};function Wl({url:W,source:se,transformSourceMapURL:fe=!1,transformAssets:Pe=!0}){const Se=W.split("/public/plugins/"),we=Se[0],ke=Se[1].split("/")[0];let Je=se;return Pe&&(Je=Je.replace(/(\/?)(public\/plugins)/g,`${we}/$2`),Je=Je.replace(/(["|'])(plugins\/.+?.css)(["|'])/g,`$1${we}/public/$2$3`)),fe&&(Je=Je.replace(/(\/\/#\ssourceMappingURL=)(.+)\.map/g,`$1${we}/public/plugins/${ke}/$2.map`)),Je}var rc=e(45179),ki=e(94429);async function dp(W,se,fe){const Pe=await W(se,fe),Se=Pe.headers.get("content-type")||"";if(rc.Bu.test(Se)){const we=await Pe.text();let ke=we;if(rc.Cf.test(ke)&&(ke=gp(we)),(0,ki.OD)(Pe.url)){const Je=Wl({url:Pe.url,source:ke});return new Response(new Blob([Je],{type:"text/javascript"}))}return new Response(new Blob([ke],{type:"text/javascript"}))}return Pe}function up(W,se,fe){const Pe=se.endsWith("module.js")&&!(0,ki.OD)(se);try{const Se=W.apply(this,[se,fe]),we=fp(Se);return Pe?(0,ld.ni)(we):we}catch{return rc.$b.test(se)?`${R.$.appSubUrl??""}/public/${se}`:(console.log(`SystemJS: failed to resolve '${se}'`),se)}}function mp(W,se){if(se.endsWith(".css")&&!W){const Pe=O.zO.get(se)?.default;Pe&&(document.adoptedStyleSheets=[...document.adoptedStyleSheets,Pe])}}function fp(W){return W.startsWith(`${rc.XV}:`)?W:(W.endsWith("!")&&(W=W.slice(0,-1)),["css","js","json","wasm"].some(Pe=>W.endsWith(Pe))?W:W+".js")}function gp(W){return`(function(define) { ${W} })(window.__grafana_amd_define);`}var pp=e(22055),hp=e(6262),Yu=e(27716),Qu=e(35853);function vp(W){const se=new URL(window.location.href),fe=new URL(W);return se.host===fe.host}async function Ep(W,se,fe){let Pe="";if(vp(W)?(Pe=await(await fetch(W)).text(),Pe=Wl({url:W,source:Pe,transformSourceMapURL:!0,transformAssets:!1})):(0,ki.OD)(W)&&(Pe=await(await fetch(W)).text(),Pe=Wl({url:W,source:Pe,transformSourceMapURL:!0,transformAssets:!0})),Pe.length===0)throw new Error("Only same domain scripts are allowed in sandboxed plugins");Pe=Ju(Pe),fe.evaluate(Pe)}async function yp(W){if((0,ki.OD)(W.module)){const se=W.module;let Pe=await(await fetch(se)).text();return Pe=Wl({url:se,source:Pe,transformSourceMapURL:!0,transformAssets:!0}),Pe}else{let se=(0,ki.Av)(W.module);const fe=(0,ld.ni)(se);let Se=await(await fetch(fe)).text();return Se=Wl({url:fe,source:Se,transformSourceMapURL:!0,transformAssets:!1}),Se=Ju(Se),Se}}function Ju(W){return W.replace(/window\.location/gi,"window.locationSandbox")}function Dp(W){W.evaluate(`${Qu.V.toString()};${Qu.V.name}()`)}const Ri=["iframe"];var Xu=e(7077),oc=e(43429),Pp=e(34867);const Cp=!!R.$.featureToggles.frontendSandboxMonitorOnly;function bp(W){return!!W&&typeof W=="object"&&W?.hasOwnProperty("plugin")}function s0(W){throw new Error(`Unexpected object: ${W}. This should never happen.`)}const cd=(0,Pp.DW)("sandbox",{monitorOnly:String(Cp)});function Tp(W){return W instanceof P.Component}function $o(W,se){cd.logWarning(W,se)}function Kl(W,se){cd.logError(W,se)}function Zu(W,se){cd.logInfo(W,se)}async function Mp({isAngular:W,pluginId:se}){if(!R.$.featureToggles.pluginsFrontendSandbox||W||location.search.includes("nosandbox")&&R.$.buildInfo.env==="development"||R.$.disableFrontendSandboxForPlugins.includes(se))return!1;const Se=await(0,Yu.x)(se);return!(Se.type===oc.QE.app&&Se.signatureType===oc.kv.grafana)}function Sp(W){return W?.constructor?.name==="RegExp"}function dd(W){return W&&(Sp(W)&&(0,Xu.U)(W)?new RegExp(W):Array.isArray(W)?W.map(dd):typeof W=="object"?Object.keys(W).reduce((se,fe)=>(Reflect.set(se,fe,dd(Reflect.get(W,fe))),se),{}):W)}const Li=Symbol.for("@@SANDBOX_LIVE_VALUE"),qu=!!R.$.featureToggles.frontendSandboxMonitorOnly;function xp(W,se){const fe=Reflect.get(W,"nodeName");if(fe==="body"||W===document.body)return document.body;if(fe==="head"||W===document.head||W===document.documentElement)return W;if(Ri.includes(fe)&&($o("<"+fe+"> is not allowed in sandboxed plugins",{pluginId:se,param:fe}),!qu))throw new Error("<"+fe+"> is not allowed in sandboxed plugins");if(Lp(W,se)||W.parentNode===document.body||W.closest("#reactRoot")===null||qu)return W;{const Pe=document.createElement(fe);return Pe.dataset.grafanaPluginSandboxElement="true",Pe}}function Op(W){if(typeof W=="object"&&W instanceof Element)try{return W.nodeName!==void 0}catch{return!1}return!1}function Ip(W){const se=Reflect.get(W,"style");Object.hasOwn(se,Li)||Reflect.defineProperty(se,Li,{})}function ud(W){W&&(Array.isArray(W)?(W.forEach(ud),em(W)):typeof W=="object"&&(Object.values(W).forEach(ud),em(W)))}function em(W){if(W)return Object.hasOwn(W,Li)||Reflect.defineProperty(W,Li,{}),W}function Ap(W){W&&(Object.hasOwn(W,Li)||((0,Xu.U)(W)&&!(W instanceof Function)&&(Tp(W)||W instanceof x.mA)?Reflect.defineProperty(W,Li,{}):W===Hu().languages&&Object.defineProperty(W,Li,{})))}function Rp(W){return Object.hasOwn(W,Li)}function Lp(W,se){return!document.contains(W)||W.closest(`[data-plugin-sandbox=${se}]`)!==null}let Ao;function r0(){return Ao||(Ao=document.createElement("div"),Ao.setAttribute("id","grafana-plugin-sandbox-body"),Ao.setAttribute("data-plugin-sandbox","true"),Ao.dataset.pluginSandbox="sandboxed-plugin",Ao.style.width="100%",Ao.style.height="0%",Ao.style.overflow="hidden",Ao.style.top="0",Ao.style.left="0",document.body.appendChild(Ao)),Ao}let tm=!1;function Bp(){tm||(tm=!0,Up())}function Up(){const W=window.history.replaceState;Object.defineProperty(window.history,"replaceState",{value:function(...se){let fe=se;try{fe=(0,$e.cloneDeep)(se)}catch(Pe){$o("Error cloning args in window.history.replaceState",{error:String(Pe)})}return Reflect.apply(W,this,fe)},writable:!0,configurable:!0,enumerable:!1})}const to=new Map,ei=!!R.$.featureToggles.frontendSandboxMonitorOnly,nm=Symbol.for("@SANDBOX_LIVE_API_PATCHED");function Np(){return to.size===0&&(wp(to),Fp(to),Wp(to),_p(to),Vp(to),Kp(to),$p(to),zp(to),kp(to),md(to),tn(to),Gp(to)),to}function ic(W,se){return $o(`Plugin ${se.id} tried to set a sandboxed property`,{pluginId:se.id,attrOrMethod:String(W),entity:"window"}),ei?W:()=>{throw new Error("Plugins are not allowed to set sandboxed properties")}}function wp(W){const se=["contentDocument","contentWindow","src","srcdoc","srcObject","srcset"];for(const Pe of se){const Se=Object.getOwnPropertyDescriptor(HTMLIFrameElement.prototype,Pe);if(Se){let we=function(ke,Je){const it=Je.id;return $o(`Plugin ${it} tried to access iframe.${Pe}`,{pluginId:it,attrOrMethod:Pe,entity:"iframe"}),ei?ke:()=>{throw new Error("iframe."+Pe+" is not allowed in sandboxed plugins")}};var fe=we;Se.value&&W.set(Se.value,we),Se.set&&W.set(Se.set,we),Se.get&&W.set(Se.get,we)}}}function Fp(W){const se=Object.getOwnPropertyDescriptor(window,"console");if(se?.value){let Pe=function(Se,we){const ke=we.id;if(ei)return Se;function Je(...it){console.log(`[plugin ${ke}]`,...it)}return{log:Je,warn:Je,error:Je,info:Je,debug:Je,table:Je}};var fe=Pe;W.set(se.value,Pe)}se?.set&&W.set(se.set,ic)}function Wp(W){function se(Pe,Se){const we=Se.id;return $o(`Plugin ${we} accessed window.alert`,{pluginId:we,attrOrMethod:"alert",entity:"window"}),ei?Pe:function(...ke){console.log(`[plugin ${we}]`,...ke)}}const fe=Object.getOwnPropertyDescriptor(window,"alert");fe?.value&&W.set(fe.value,se),fe?.set&&W.set(fe.set,ic)}function Kp(W){function se(Pe,Se){const we=Se.id;return function(...Je){for(const it of Je){const ct=it?.toLowerCase()||"";for(const ht of Ri)if(ct.includes("<"+ht)){if($o(`Plugin ${we} tried to set ${ht} in innerHTML`,{pluginId:we,attrOrMethod:"innerHTML",param:ht,entity:"HTMLElement"}),ei)continue;throw new Error("<"+ht+"> is not allowed in sandboxed plugins")}}(0,$e.isFunction)(Pe)&&Pe.apply(this,Je)}}const fe=[Object.getOwnPropertyDescriptor(Element.prototype,"innerHTML"),Object.getOwnPropertyDescriptor(Element.prototype,"outerHTML"),Object.getOwnPropertyDescriptor(Element.prototype,"insertAdjacentHTML"),Object.getOwnPropertyDescriptor(DOMParser.prototype,"parseFromString")];for(const Pe of fe)Pe?.set&&W.set(Pe.set,se),Pe?.value&&W.set(Pe.value,se)}function $p(W){function se(Pe,Se){const we=Se.id;return function(Je,it){if(Je&&Ri.includes(Je)&&($o(`Plugin ${we} tried to create ${Je}`,{pluginId:we,attrOrMethod:"createElement",param:Je,entity:"document"}),!ei))return document.createDocumentFragment();if((0,$e.isFunction)(Pe))return Pe.apply(this,[Je,it])}}const fe=Object.getOwnPropertyDescriptor(Document.prototype,"createElement");fe?.value&&W.set(fe.value,se)}function Vp(W){function se(we,ke){const Je=ke.id;return function(ct,ht){const Et=ct?.nodeName?.toLowerCase()||"";if(ct&&Ri.includes(Et)&&($o(`Plugin ${Je} tried to insert ${Et}`,{pluginId:Je,attrOrMethod:"insertChild",param:Et,entity:"HTMLElement"}),!ei))return document.createDocumentFragment();if((0,$e.isFunction)(we))return we.call(this,ct,ht)}}function fe(we,ke){const Je=ke.id;return function(ct,ht){const Et=ht?.nodeName?.toLowerCase()||"";if(ht&&Ri.includes(Et)&&($o(`Plugin ${Je} tried to insert ${Et}`,{pluginId:Je,attrOrMethod:"insertAdjacentElement",param:Et,entity:"HTMLElement"}),!ei))return document.createDocumentFragment();if((0,$e.isFunction)(we))return we.call(this,ct,ht)}}const Pe=[Object.getOwnPropertyDescriptor(Node.prototype,"insertBefore"),Object.getOwnPropertyDescriptor(Node.prototype,"replaceChild")];for(const we of Pe)we?.value&&W.set(we.set,se);const Se=Object.getOwnPropertyDescriptor(Element.prototype,"insertAdjacentElement");Se?.value&&W.set(Se.set,fe)}function _p(W){function se(we,ke){const Je=ke.id;return function(...ct){let ht=ct;const Et=ct?.filter(Tt=>!Ri.includes(Tt.nodeName.toLowerCase()));ei||(ht=Et),ht.length!==Et.length&&$o(`Plugin ${Je} tried to append fobiddenElements`,{pluginId:Je,attrOrMethod:"append",param:ct?.filter(Tt=>Ri.includes(Tt.nodeName.toLowerCase()))?.join(",")||"",entity:"HTMLElement"}),(0,$e.isFunction)(we)&&we.apply(this,ht)}}function fe(we,ke,Je){const it=ke.id;return function(ht){const Et=ht?.nodeName?.toLowerCase()||"";if(ht&&Ri.includes(Et)&&($o(`Plugin ${it} tried to append ${Et}`,{pluginId:it,attrOrMethod:"appendChild",param:Et,entity:"HTMLElement"}),!ei))return document.createDocumentFragment();if(Je&&ht&&Et==="script"&&ht instanceof HTMLScriptElement){Ep(ht.src,ke,Je).then(()=>{ht.onload?.call(ht,new Event("load"))}).catch(Tt=>{ht.onerror?.call(ht,new ErrorEvent("error",{error:Tt}))});return}if((0,$e.isFunction)(we))return we.call(this,ht)}}const Pe=[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 we of Pe)we?.value&&W.set(we.value,se);const Se=Object.getOwnPropertyDescriptor(Node.prototype,"appendChild");Se?.value&&W.set(Se.value,fe)}function zp(W){const se=Object.getOwnPropertyDescriptor(Worker.prototype,"postMessage");function fe(Pe){return function(...we){try{const ke=(0,$e.cloneDeep)(we);(0,$e.isFunction)(Pe)&&Pe.apply(this,ke)}catch{throw new Error("postMessage arguments are invalid objects")}}}se?.value&&W.set(se.value,fe)}function kp(W){const se=Object.getOwnPropertyDescriptor(Document.prototype,"defaultView");se?.get&&W.set(se.get,()=>()=>window);const fe=["write"];for(const Pe of fe){const Se=Object.getOwnPropertyDescriptor(Document.prototype,Pe);Se?.set&&W.set(Se.set,ic),Se?.value&&W.set(Se.value,ic)}}async function md(W){const se=Reflect.get(window,"monaco");if(!se||Object.hasOwn(se,nm))return;const fe=se.languages.setMonarchTokensProvider;function Pe(){return function(...Se){return Se.length!==2?fe.apply(se,Se):fe.call(se,Se[0],dd(Se[1]))}}W.set(se.languages.setMonarchTokensProvider,Pe),Reflect.set(se,nm,{})}async function tn(W){const se=Object.getOwnPropertyDescriptor(window,"postMessage");function fe(Pe){return function(...we){try{const ke=(0,$e.cloneDeep)(we);(0,$e.isFunction)(Pe)&&Pe.apply(this,ke)}catch{throw new Error("postMessage arguments are invalid objects")}}}se?.value&&W.set(se.value,fe)}function Hp(W){md(to)}function Gp(W){function se(fe){return(0,$e.isFunction)(fe)?function(...Pe){const Se=fe.apply(this,Pe);return ud(Se),Se}:fe}W.set($e.cloneDeep,se)}var fd=e(66161);async function jp(W,se){if(!bp(W))return W;const fe=await Promise.resolve(W.plugin);if(Reflect.has(fe,"panel")&&Reflect.set(fe,"panel",$l(Reflect.get(fe,"panel"),se)),Reflect.has(fe,"components")){const Pe=Reflect.get(fe,"components");Object.entries(Pe).forEach(([Se,we])=>{Reflect.set(Pe,Se,$l(we,se))}),Reflect.set(fe,"components",Pe)}if(Reflect.has(fe,"root")&&Reflect.set(fe,"root",$l(Reflect.get(fe,"root"),se)),Reflect.has(fe,"extensionConfigs")){const Pe=Reflect.get(fe,"extensionConfigs");for(const Se of Pe)Reflect.has(Se,"component")&&Reflect.set(Se,"component",$l(Reflect.get(Se,"component"),se));Reflect.set(fe,"extensionConfigs",Pe)}if(Reflect.has(fe,"configPages")){const Pe=Reflect.get(fe,"configPages")??[];for(const[Se,we]of Object.entries(Pe))!we.body||!(0,$e.isFunction)(we.body)||Reflect.set(Pe,Se,{...we,body:$l(we.body,se)});Reflect.set(fe,"configPages",Pe)}return W}const $l=(W,se)=>{const fe=P.memo(Pe=>P.createElement("div",{"data-plugin-sandbox":se.id,style:{height:se.type===oc.QE.app||se.type===oc.QE.panel?"100%":"auto"}},P.createElement(W,{...Pe})));return fe.displayName=`GrafanaSandbox(${W.displayName||W.name||"Component"})`,fe},gd=new Map,am={};async function Yp({pluginId:W}){Bp();try{const se=await(0,Yu.x)(W);return gd.has(W)||gd.set(W,sm(se)),gd.get(W)}catch(se){const fe=new Error(`Could not import plugin ${W} inside sandbox: `+se);throw Kl(fe,{pluginId:W,error:String(se)}),fe}}async function sm(W){return Zu("Loading with sandbox",{pluginId:W.id}),new Promise(async(se,fe)=>{const Pe=Np();let Se;function we(Je){if(Op(Je)){const ht=xp(Je,W.id);return Ip(ht),ht}else Ap(Je);const it=Pe.get(Je);if(it)return it(Je,W,Se);const ct=Hp(Je);return ct||Je}Se=(0,pp.A)(window,{distortionCallback:we,defaultPolicy:hp.G,liveTargetCallback:Rp,endowments:Object.getOwnPropertyDescriptors({locationSandbox:window.location,setImmediate:function(Je,...it){return setTimeout(Je,0,...it)},get monaco(){return Reflect.get(window,"monaco")},get Prism(){return Reflect.get(window,"Prism")},get jQuery(){return Reflect.get(window,"jQuery")},get $(){return Reflect.get(window,"jQuery")},get grafanaBootData(){if(am[W.id+"-grafanaBootData"]||(am[W.id+"-grafanaBootData"]=!0,Zu("Plugin using window.grafanaBootData",{sandbox:"true",pluginId:W.id,guessedPluginName:W.id,parent:"window",packageName:"window",key:"grafanaBootData"})),R.$.buildInfo.env==="development")throw new Error(`Error in ${W.id}: Plugins should not use window.grafanaBootData. Use "config" from "@grafana/runtime" instead.`);return console.error(`${W.id.toUpperCase()}: Plugins should not use window.grafanaBootData. Use "config" from "@grafana/runtime" instead.`),R.$.bootData},async define(Je,it,ct){let ht,Et;Array.isArray(Je)?(ht=Je,Et=it):(ht=it,Et=ct);try{const Tt=Qp(ht,W.id),Dt=Et.apply(null,Tt),Bt=await jp(Dt,W);se(Bt)}catch(Tt){const Dt=new Error(`Could not execute plugin's define ${W.id}: `+Tt);Kl(Dt,{pluginId:W.id,error:String(Tt)}),fe(Dt)}}})}),Dp(Se);let ke="";try{ke=await yp(W)}catch(Je){const it=new Error(`Could not load plugin code ${W.id}: `+Je);Kl(it,{pluginId:W.id,error:String(Je)}),fe(it)}try{Se.evaluate(ke)}catch(Je){const it=new Error(`Could not run plugin ${W.id} inside sandbox: `+Je);Kl(it,{pluginId:W.id,error:String(Je)}),fe(it)}})}function Qp(W,se){const fe=[];for(const Pe of W){let Se=fd.s.get(Pe);if(Se?.__useDefault&&(Se=Se.default),!Se){const we=new Error(`[sandbox] Could not resolve dependency ${Pe}`);throw Kl(we,{pluginId:se,dependency:Pe,error:String(we)}),we}fe.push(Se)}return fe}const Jp=(0,ki.kB)(cp);O.zO.addImportMap({imports:Jp});const fi=O.zO.constructor.prototype;fi.shouldFetch=()=>!0;const Xp=fi.fetch;fi.fetch=function(W,se){return dp(Xp,W,se)};const Zp=fi.resolve;fi.resolve=up.bind(fi,Zp),fi.onload=mp;async function hl({path:W,version:se,isAngular:fe,pluginId:Pe}){se&&(0,ld.GD)({path:W,version:se});const Se=wg[W];if(Se)return typeof Se=="function"?await Se():Se;let we=(0,ki.Av)(W);return await Mp({isAngular:fe,pluginId:Pe})?Yp({pluginId:Pe}):O.zO.import(we)}function rm(W){return hl({path:W.module,version:W.info?.version,isAngular:W.angular?.detected,pluginId:W.id}).then(se=>{if(se.plugin){const fe=se.plugin;return fe.meta=W,fe}if(se.Datasource){const fe=new x.tD(se.Datasource);return fe.setComponentsFromLegacyExports(se),fe.meta=W,fe}throw new Error("Plugin module is missing DataSourcePlugin or Datasource constructor export")})}function om(W){return hl({path:W.module,version:W.info?.version,isAngular:W.angular?.detected,pluginId:W.id}).then(se=>{const fe=se.plugin?se.plugin:new S.hX;return fe.init(W),fe.meta=W,fe.setComponentsFromLegacyExports(se),fe})}},66161:(Q,A,e)=>{"use strict";e.d(A,{s:()=>t});const t=new Map([])},60677:(Q,A,e)=>{"use strict";e.d(A,{W3:()=>g,Wy:()=>u,z4:()=>c});var t=e(43429),n=e(34867),o=e(15162),s=e(27716),r=e(91629);async function g(i){const l=await(0,s.x)(i);let f;if(l.type===t.QE.app&&(f=await(0,r.ui)(l)),l.type===t.QE.datasource&&(f=await(0,r.cS)(l)),l.type===t.QE.panel&&(f=await(0,o.Kk)(l)),l.type===t.QE.renderer&&(f={meta:l}),!f)throw new Error("Unknown Plugin type: "+l.type);return f}function u(i,l,f){let h={...i},p;function m(v,E){return!E.startsWith(v.url??"")||p&&(p.url?.length??0)>(v.url?.length??0)?v:(p&&(p.active=!1),p={...v,active:!0},p)}function a(v,E=0){if(E>10)return v;if(v.children){const D=v.children.map(b=>a(b,E+1));return{...m(v,f),children:D}}return m(v,f)}return h.children=(h?.children??[]).map(a),{main:h,node:p??h}}const c=(0,n.DW)("features.plugins")},81862:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>x,Cj:()=>f,HO:()=>E,Mj:()=>p,Nm:()=>h,Q9:()=>v,RS:()=>C,c1:()=>l,g$:()=>D,ny:()=>m,ri:()=>a,uh:()=>b,xu:()=>d});var t=e(30038),n=e(2543),o=e.n(n),s=e(72724),r=e(47232),g=e(2913),u=e(10096);const c={orgId:g.Ay.bootData.user.orgId,timeZone:g.Ay.bootData.user.timezone,weekStart:g.Ay.bootData.user.weekStart,fiscalYearStartMonth:0,orgsAreLoading:!1,sessionsAreLoading:!1,teamsAreLoading:!1,isUpdating:!1,orgs:[],sessions:[],teams:[],user:null},i=(0,t.Z0)({name:"user/profile",initialState:c,reducers:{updateTimeZone:(S,O)=>{S.timeZone=O.payload.timeZone},updateWeekStart:(S,O)=>{S.weekStart=O.payload.weekStart},updateFiscalYearStartMonth:(S,O)=>{S.fiscalYearStartMonth=O.payload.fiscalYearStartMonth},setUpdating:(S,O)=>{S.isUpdating=O.payload.updating},userLoaded:(S,O)=>{S.user=O.payload.user},initLoadTeams:(S,O)=>{S.teamsAreLoading=!0},teamsLoaded:(S,O)=>{S.teams=O.payload.teams,S.teamsAreLoading=!1},initLoadOrgs:(S,O)=>{S.orgsAreLoading=!0},orgsLoaded:(S,O)=>{S.orgs=O.payload.orgs,S.orgsAreLoading=!1},initLoadSessions:(S,O)=>{S.sessionsAreLoading=!0},sessionsLoaded:(S,O)=>{const P=O.payload.sessions.sort((L,U)=>Number(U.isActive)-Number(L.isActive));S.sessions=P.map(L=>({id:L.id,isActive:L.isActive,seenAt:(0,s.fq)(L.seenAt),createdAt:L.createdAt,clientIp:L.clientIp,browser:L.browser,browserVersion:L.browserVersion,os:L.os,osVersion:L.osVersion,device:L.device})),S.sessionsAreLoading=!1},userSessionRevoked:(S,O)=>{S.sessions=S.sessions.filter(P=>P.id!==O.payload.tokenId),S.isUpdating=!1}}}),l=S=>async O=>{(0,n.set)(u.TP,"user.fiscalYearStartMonth",S),O(T({fiscalYearStartMonth:S}))},f=S=>async O=>{(!(0,n.isString)(S)||(0,n.isEmpty)(S))&&(S=g.Ay?.bootData?.user?.timezone),(0,n.set)(u.TP,"user.timezone",S),O(y({timeZone:S}))},d=S=>async O=>{(!(0,n.isString)(S)||(0,n.isEmpty)(S))&&(S=g.Ay?.bootData?.user?.weekStart),(0,n.set)(u.TP,"user.weekStart",S),O(M({weekStart:S})),(0,r.$D)(S)},{setUpdating:h,initLoadOrgs:p,orgsLoaded:m,initLoadTeams:a,teamsLoaded:v,userLoaded:E,userSessionRevoked:D,initLoadSessions:b,sessionsLoaded:C,updateTimeZone:y,updateWeekStart:M,updateFiscalYearStartMonth:T}=i.actions,I=i.reducer,x={user:i.reducer}},32901:(Q,A,e)=>{"use strict";e.d(A,{O:()=>t,q:()=>n});const t=o=>o.timeZone,n=o=>o.fiscalYearStartMonth},64152:(Q,A,e)=>{"use strict";e.d(A,{d:()=>o,m:()=>n});class t{constructor(){this.extraRenderActions=[]}addExtraRenderAction(r){this.extraRenderActions=this.extraRenderActions.concat(r)}getAllExtraRenderAction(){return this.extraRenderActions}}const n=new t,o=new t},65160:(Q,A,e)=>{"use strict";e.d(A,{c:()=>N,E:()=>G});var t=e(46942),n=e.n(t),o=e(2543),s=e(55127),r=e.n(s),g=e(96540),u=e(41987),c=e(76287),i=e(18226),l=e(39070),f=e(14236),d=e(26272),h=e(13544),p=e(19347),m=e(7376),a=e(39938),v=e(66602),E=e(22214),D=e(10343),b=e(7788),C=e(44836),y=e(74856),M=e(84423),T=e(64152),I=e(32196),x=e(40845),S=e(14578),O=e(10354),P=e(72093),L=e(51612);const U=_=>{const{query:K,queries:j,onChange:k,collapsedText:Y,renderExtras:ee,disabled:re}=_,J=(0,x.of)(B),[ne,q]=(0,g.useState)(!1),[te,oe]=(0,g.useState)(null),ue=le=>{q(!0)},ie=le=>{if(q(!1),te){oe(null);return}K.refId!==le&&k({...K,refId:le})},ge=le=>{const Te=le.currentTarget.value.trim();if(Te.length===0){oe("An empty query name is not allowed");return}for(const Ee of j)if(Ee!==K&&Te===Ee.refId){oe("Query name already exists");return}te&&oe(null)},he=le=>{ie(le.currentTarget.value.trim())},De=le=>{le.key==="Enter"&&ie(le.currentTarget.value)},pe=le=>{le.target.select()};return g.createElement(g.Fragment,null,g.createElement("div",{className:J.wrapper},!ne&&g.createElement("button",{className:J.queryNameWrapper,"aria-label":h.Tp.components.QueryEditorRow.title(K.refId),title:"Edit query name",onClick:ue,"data-testid":"query-name-div",type:"button"},g.createElement("span",{className:J.queryName},K.refId),g.createElement(S.I,{name:"pen",className:J.queryEditIcon,size:"sm"})),ne&&g.createElement(g.Fragment,null,g.createElement(O.p,{type:"text",defaultValue:K.refId,onBlur:he,autoFocus:!0,onKeyDown:De,onFocus:pe,invalid:te!==null,onChange:ge,className:J.queryNameInput,"data-testid":"query-name-input"}),te&&g.createElement(P.P,{horizontal:!0},te)),R(_,J),ee&&g.createElement("div",{className:J.itemWrapper},ee()),re&&g.createElement("em",{className:J.contextInfo},"Disabled")),Y&&g.createElement("div",{className:J.collapsedText},Y))},R=(_,K)=>{const{alerting:j,dataSource:k,onChangeDataSource:Y}=_;return Y?g.createElement("div",{className:K.itemWrapper},g.createElement(L.s,{variables:!0,alerting:j,current:k.name,onChange:Y})):g.createElement("em",{className:K.contextInfo},"(",k.name,")")},B=_=>({wrapper:(0,I.css)` label: Wrapper; display: flex; align-items: center; margin-left: ${_.spacing(.5)}; overflow: hidden; `,queryNameWrapper:(0,I.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,I.css)` font-weight: ${_.typography.fontWeightMedium}; color: ${_.colors.primary.text}; cursor: pointer; overflow: hidden; margin-left: ${_.spacing(.5)}; `,queryEditIcon:(0,I.cx)((0,I.css)` margin-left: ${_.spacing(2)}; visibility: hidden; `,"query-name-edit-icon"),queryNameInput:(0,I.css)` max-width: 300px; margin: -4px 0; `,collapsedText:(0,I.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,I.css)` font-size: ${_.typography.bodySmall.fontSize}; font-style: italic; color: ${_.colors.text.secondary}; padding-left: 10px; padding-right: 10px; `,itemWrapper:(0,I.css)` display: flex; margin-left: 4px; `});function H({error:_}){const K=(0,x.of)(w),j=_?.message??_?.data?.message??"Query error";return g.createElement("div",{className:K.wrapper},g.createElement("div",{className:K.icon},g.createElement(S.I,{name:"exclamation-triangle"})),g.createElement("div",{className:K.message},j,_.traceId!=null&&g.createElement(g.Fragment,null,g.createElement("br",null)," ",g.createElement("span",null,"(Trace ID: ",_.traceId,")"))))}const w=_=>({wrapper:(0,I.css)({marginTop:_.spacing(.5),background:_.colors.background.secondary,display:"flex"}),icon:(0,I.css)({background:_.colors.error.main,color:_.colors.error.contrastText,padding:_.spacing(1)}),message:(0,I.css)({fontSize:_.typography.bodySmall.fontSize,fontFamily:_.typography.fontFamilyMonospace,padding:_.spacing(1)})});class N extends g.PureComponent{constructor(){super(...arguments),this.element=null,this.angularScope=null,this.angularQueryEditor=null,this.dataSourceSrv=(0,p.l)(),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 K=(0,m.E)(),j='<plugin-component type="query-ctrl" />',k={ctrl:this.getAngularQueryComponentScope()};this.angularQueryEditor=K.load(this.element,k,j),this.angularScope=k.ctrl},this.onOpen=()=>{this.renderAngularQueryEditor()},this.renderPluginEditor=()=>{const{query:K,onChange:j,queries:k,onRunQuery:Y,onAddQuery:ee,app:re=u.Jk.PanelEditor,history:J}=this.props,{datasource:ne,data:q}=this.state;if(this.isWaitingForDatasourceToLoad())return null;if(ne?.components?.QueryCtrl)return g.createElement("div",{ref:te=>this.element=te});if(ne){let te=this.getReactQueryEditor(ne);if(te)return g.createElement(c.p,{instanceSettings:this.props.dataSource},g.createElement(te,{key:ne?.name,query:K,datasource:ne,onChange:j,onRunQuery:Y,onAddQuery:ee,data:q,range:(0,y.jG)().timeRange(),queries:k,app:re,history:J}))}return g.createElement("div",null,g.createElement(C.x6,{i18nKey:"query-operation.query-editor-not-exported"},"Data source plugin does not export any Query Editor component"))},this.onToggleEditMode=(K,j)=>{K.stopPropagation(),this.angularScope&&this.angularScope.toggleEditorMode&&(this.angularScope.toggleEditorMode(),this.angularQueryEditor?.digest(),j.isOpen||j.onOpen())},this.onRemoveQuery=()=>{const{onRemoveQuery:K,query:j,onQueryRemoved:k}=this.props;K(j),k&&k()},this.onCopyQuery=()=>{const{query:K,onAddQuery:j,onQueryCopied:k}=this.props,Y=(0,o.cloneDeep)(K);j(Y),k&&k()},this.onDisableQuery=()=>{const{query:K,onChange:j,onRunQuery:k,onQueryToggled:Y}=this.props;j({...K,hide:!K.hide}),k(),Y&&Y(K.hide)},this.onToggleHelp=()=>{this.setState(K=>({showingHelp:!K.showingHelp}))},this.onClickExample=K=>{K.datasource===void 0&&(K.datasource={type:this.props.dataSource.type,uid:this.props.dataSource.uid}),this.props.onChange({...K,refId:this.props.query.refId}),this.onToggleHelp()},this.renderWarnings=()=>{const{data:K,query:j}=this.props,Y=(G(K,j.refId)?.series??[]).reduce((ne,q)=>{if(!q.meta?.notices)return ne;const te=(0,o.filter)(q.meta.notices,{severity:"warning"})??[];return ne.concat(te)},[]),ee=(0,o.uniqBy)(Y,"text");if(!(ee.length>0))return null;const J=ee.map(ne=>ne.text).join(` `);return g.createElement(a.E,{color:"orange",icon:"exclamation-triangle",text:g.createElement(g.Fragment,null,ee.length," ",r()("warning",ee.length)),tooltip:J})},this.renderExtraActions=()=>{const{query:K,queries:j,data:k,onAddQuery:Y,dataSource:ee}=this.props,re=T.d.getAllExtraRenderAction().map((J,ne)=>J({query:K,queries:j,timeRange:k.timeRange,onAddQuery:Y,dataSource:ee,key:ne})).filter(Boolean);return re.push(this.renderWarnings()),re},this.renderActions=K=>{const{query:j,hideDisableQuery:k=!1}=this.props,{hasTextEditMode:Y,datasource:ee,showingHelp:re}=this.state,J=!!j.hide,ne=ee?.components?.QueryEditorHelp;return g.createElement(g.Fragment,null,ne&&g.createElement(D.A,{title:(0,C.t)("query-operation.header.datasource-help","Show data source help"),icon:"question-circle",onClick:this.onToggleHelp,active:re}),Y&&g.createElement(D.q,{title:(0,C.t)("query-operation.header.toggle-edit-mode","Toggle text edit mode"),icon:"pen",onClick:q=>{this.onToggleEditMode(q,K)}}),this.renderExtraActions(),g.createElement(D.q,{title:(0,C.t)("query-operation.header.duplicate-query","Duplicate query"),icon:"copy",onClick:this.onCopyQuery}),k?null:g.createElement(D.A,{title:(0,C.t)("query-operation.header.disable-query","Disable query"),icon:J?"eye-slash":"eye",active:J,onClick:this.onDisableQuery}),g.createElement(D.q,{title:(0,C.t)("query-operation.header.remove-query","Remove query"),icon:"trash-alt",onClick:this.onRemoveQuery}))},this.renderHeader=K=>{const{alerting:j,query:k,dataSource:Y,onChangeDataSource:ee,onChange:re,queries:J,renderHeaderExtras:ne}=this.props;return g.createElement(U,{query:k,queries:J,onChangeDataSource:ee,dataSource:Y,disabled:k.hide,onClick:q=>this.onToggleEditMode(q,K),onChange:re,collapsedText:K.isOpen?null:this.renderCollapsedText(),renderExtras:ne,alerting:j})}}componentDidMount(){const{data:K,query:j,id:k}=this.props,Y=G(K,j.refId);this.id=(0,o.uniqueId)(k+"_"),this.setState({data:Y}),this.loadDatasource()}componentWillUnmount(){this.angularQueryEditor&&this.angularQueryEditor.destroy()}getAngularQueryComponentScope(){const{query:K,queries:j}=this.props,{datasource:k}=this.state,Y=new M.a9({targets:j}),ee={},re=this;return{datasource:k,target:K,panel:Y,dashboard:ee,refresh:()=>{K.hide!==re.props.query.hide&&(K.hide=re.props.query.hide),this.props.onChange(K),this.props.onRunQuery()},render:()=>()=>console.log("legacy render function called, it does nothing"),events:this.props.eventBus||new i.o,range:(0,y.jG)().timeRange()}}getInterpolatedDataSourceUID(){if(this.props.query.datasource){const K=this.dataSourceSrv.getInstanceSettings(this.props.query.datasource);return K?.rawRef?.uid??K?.uid}return this.props.dataSource.rawRef?.uid??this.props.dataSource.uid}async loadDatasource(){let K;const j=this.getInterpolatedDataSourceUID();try{K=await this.dataSourceSrv.get(j)}catch{K=await this.dataSourceSrv.get()}typeof this.props.onDataSourceLoaded=="function"&&this.props.onDataSourceLoaded(K),this.setState({datasource:K,queriedDataSourceIdentifier:j,hasTextEditMode:(0,o.has)(K,"components.QueryCtrl.prototype.toggleEditorMode")})}componentDidUpdate(K){const{datasource:j,queriedDataSourceIdentifier:k}=this.state,{data:Y,query:ee}=this.props;if(K.id!==this.props.id&&(this.id=(0,o.uniqueId)(this.props.id+"_")),Y!==K.data){const re=G(Y,ee.refId);this.setState({data:re}),this.angularScope&&(this.angularScope.range=(0,y.jG)().timeRange()),this.angularQueryEditor&&re&&V(this.angularScope,re,this.angularQueryEditor)}if(j&&k!==this.getInterpolatedDataSourceUID()){this.angularQueryEditor&&(this.angularQueryEditor.destroy(),this.angularQueryEditor=null),this.loadDatasource();return}!this.element||this.angularQueryEditor||this.renderAngularQueryEditor()}getReactQueryEditor(K){if(K)switch(this.props.app){case u.Jk.Explore:return K.components?.ExploreMetricsQueryField||K.components?.ExploreLogsQueryField||K.components?.ExploreQueryField||K.components?.QueryEditor;case u.Jk.PanelEditor:case u.Jk.Dashboard:default:return K.components?.QueryEditor}}isWaitingForDatasourceToLoad(){return this.getInterpolatedDataSourceUID()!==this.state.queriedDataSourceIdentifier}renderCollapsedText(){const{datasource:K}=this.state;return K?.getQueryDisplayText?K.getQueryDisplayText(this.props.query):this.angularScope&&this.angularScope.getCollapsedText?this.angularScope.getCollapsedText():null}render(){const{query:K,index:j,visualization:k,collapsable:Y}=this.props,{datasource:ee,showingHelp:re,data:J}=this.state,ne=K.hide,q=J?.error&&J.error.refId===K.refId?J.error:J?.errors?.find(ie=>ie.refId===K.refId),te=n()("query-editor-row",{"query-editor-row--disabled":ne,"gf-form-disabled":ne});if(!ee)return null;const oe=this.renderPluginEditor(),ue=ee.components?.QueryEditorHelp;return g.createElement("div",{"data-testid":"query-editor-row","aria-label":h.Tp.components.QueryEditorRows.rows},g.createElement(b.u,{id:this.id,draggable:!0,collapsable:Y,index:j,headerElement:this.renderHeader,actions:this.renderActions,onOpen:this.onOpen},g.createElement("div",{className:te,id:this.id},g.createElement(v.Xw,null,re&&ue&&g.createElement(E.j,null,g.createElement(ue,{onClickExample:ie=>this.onClickExample(ie),query:this.props.query,datasource:ee})),oe),q&&g.createElement(H,{error:q}),k)))}}function V(_,K,j){if(K.state===l.Gu.Done){const k=K.series.map(Y=>(0,f.w3)(Y));_.events.emit(d.ee.dataReceived,k)}else K.state===l.Gu.Error&&_.events.emit(d.ee.dataError,K.error);setTimeout(j.digest)}function G(_,K){const j=_.series.filter(re=>re.refId===K);if(_.state!==l.Gu.Loading&&(_.error||_.errors?.length)&&!_.series.length)return{..._,state:l.Gu.Error};let k=_.state,Y=_.errors?.find(re=>re.refId===K);!Y&&_.error&&(Y=_.error.refId===K?_.error:void 0),k!==l.Gu.Loading&&(Y?k=l.Gu.Error:_.state===l.Gu.Error&&(k=l.Gu.Done));const ee=_.timeRange;return{..._,state:k,series:j,error:Y,errors:Y?[Y]:void 0,timeRange:ee}}},44932:(Q,A,e)=>{"use strict";e.d(A,{L:()=>g});var t=e(96540),n=e(75494),o=e(14110),s=e(19347),r=e(65160);class g extends t.PureComponent{constructor(){super(...arguments),this.onRemoveQuery=i=>{this.props.onQueriesChange(this.props.queries.filter(l=>l!==i))},this.onDragStart=i=>{const{queries:l,dsSettings:f}=this.props;(0,o.rR)("query_row_reorder_started",{startIndex:i.source.index,numberOfQueries:l.length,datasourceType:f.type})},this.onDragEnd=i=>{const{queries:l,onQueriesChange:f,dsSettings:d}=this.props;if(!i||!i.destination)return;const h=i.source.index,p=i.destination.index;if(h===p){(0,o.rR)("query_row_reorder_canceled",{startIndex:h,endIndex:p,numberOfQueries:l.length,datasourceType:d.type});return}const m=Array.from(l),[a]=m.splice(h,1);m.splice(p,0,a),f(m),(0,o.rR)("query_row_reorder_ended",{startIndex:h,endIndex:p,numberOfQueries:l.length,datasourceType:d.type})}}onChangeQuery(i,l){const{queries:f,onQueriesChange:d}=this.props;d(f.map((h,p)=>p===l?i:h))}onDataSourceChange(i,l){const{queries:f,onQueriesChange:d}=this.props;d(f.map((h,p)=>{if(p!==l)return h;const m={type:i.type,uid:i.uid};return h.datasource&&(0,s.l)().getInstanceSettings(h.datasource)?.type===i.type?{...h,datasource:m}:{refId:h.refId,hide:h.hide,datasource:m}}))}render(){const{dsSettings:i,data:l,queries:f,app:d,history:h,eventBus:p,onAddQuery:m,onRunQueries:a,onQueryCopied:v,onQueryRemoved:E,onQueryToggled:D}=this.props;return t.createElement(n.JY,{onDragStart:this.onDragStart,onDragEnd:this.onDragEnd},t.createElement(n.gL,{droppableId:"transformations-list",direction:"vertical"},b=>t.createElement("div",{"data-testid":"query-editor-rows",ref:b.innerRef,...b.droppableProps},f.map((C,y)=>{const M=u(C,i),T=i.meta.mixed?I=>this.onDataSourceChange(I,y):void 0;return t.createElement(r.c,{id:C.refId,index:y,key:C.refId,data:l,query:C,dataSource:M,onChangeDataSource:T,onChange:I=>this.onChangeQuery(I,y),onRemoveQuery:this.onRemoveQuery,onAddQuery:m,onRunQuery:a,onQueryCopied:v,onQueryRemoved:E,onQueryToggled:D,queries:f,app:d,history:h,eventBus:p})}),b.placeholder)))}}const u=(c,i)=>c.datasource&&(0,s.l)().getInstanceSettings(c.datasource)||i},37464:(Q,A,e)=>{"use strict";e.d(A,{g:()=>j,K:()=>Y});var t=e(32196),n=e(96540),o=e(39070),s=e(43127),r=e(41987),g=e(43429),u=e(13544),c=e(19347),i=e(12131),l=e(66864),f=e(55852),d=e(40276),h=e(37390),p=e(3911),m=e(38894),a=e(16817),v=e(36663),E=e(17172),D=e(39558);function b({pluginId:re}){const{value:J,loading:ne,error:q}=(0,a.A)(async()=>(0,E.AI)().get(`/api/plugins/${re}/markdown/query_help`),[]),te=(0,v.G)(J);return ne?n.createElement(D._,{text:"Loading help..."}):q?n.createElement("h3",null,"An error occurred when loading help."):J===""?n.createElement("h3",null,"No query help could be found."):n.createElement("div",{className:"markdown-html",dangerouslySetInnerHTML:{__html:te}})}var C=e(2913),y=e(27677),M=e(21969),T=e(50481),I=e(51612),x=e(53478),S=e(74106),O=e(14348),P=e(8480),L=e(93117),U=e(64152),R=e(44932),B=e(65879),H=e(10354),w=e(15292),N=e(7788);class V extends n.PureComponent{constructor(J){super(J),this.onRelativeTimeChange=q=>{this.setState({timeRangeFrom:q.target.value})},this.onTimeShiftChange=q=>{this.setState({timeRangeShift:q.target.value})},this.onOverrideTime=q=>{const{options:te,onChange:oe}=this.props,ue=_(q.target.value),ie=G(ue);ie&&te.timeRange?.from!==ue&&oe({...te,timeRange:{...te.timeRange??{},from:ue}}),this.setState({relativeTimeIsValid:ie})},this.onTimeShift=q=>{const{options:te,onChange:oe}=this.props,ue=_(q.target.value),ie=G(ue);ie&&te.timeRange?.shift!==ue&&oe({...te,timeRange:{...te.timeRange??{},shift:ue}}),this.setState({timeShiftIsValid:ie})},this.onToggleTimeOverride=()=>{const{onChange:q,options:te}=this.props;this.setState({timeRangeHide:!this.state.timeRangeHide},()=>{q({...te,timeRange:{...te.timeRange??{},hide:this.state.timeRangeHide}})})},this.onCacheTimeoutBlur=q=>{const{options:te,onChange:oe}=this.props;oe({...te,cacheTimeout:_(q.target.value)})},this.onQueryCachingTTLBlur=q=>{const{options:te,onChange:oe}=this.props;let ue=parseInt(q.target.value,10);(isNaN(ue)||ue===0)&&(ue=null),oe({...te,queryCachingTTL:ue})},this.onMaxDataPointsBlur=q=>{const{options:te,onChange:oe}=this.props;let ue=parseInt(q.currentTarget.value,10);(isNaN(ue)||ue===0)&&(ue=null),ue!==te.maxDataPoints&&oe({...te,maxDataPoints:ue})},this.onMinIntervalBlur=q=>{const{options:te,onChange:oe}=this.props,ue=_(q.target.value);ue!==te.minInterval&&oe({...te,minInterval:ue})},this.onOpenOptions=()=>{this.setState({isOpen:!0})},this.onCloseOptions=()=>{this.setState({isOpen:!1})};const{options:ne}=J;this.state={timeRangeFrom:ne.timeRange?.from||"",timeRangeShift:ne.timeRange?.shift||"",timeRangeHide:ne.timeRange?.hide??!1,isOpen:!1,relativeTimeIsValid:!0,timeShiftIsValid:!0}}renderCacheTimeoutOption(){const{dataSource:J,options:ne}=this.props,q=`If your time series store has a query cache this option can override the default cache timeout. Specify a numeric value in seconds.`;return J.meta.queryOptions?.cacheTimeout?n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(m.I,{width:9,tooltip:q},"Cache timeout"),n.createElement(H.p,{type:"text",className:"width-6",placeholder:"60",spellCheck:!1,onBlur:this.onCacheTimeoutBlur,defaultValue:ne.cacheTimeout??""}))):null}renderQueryCachingTTLOption(){const{dataSource:J,options:ne}=this.props,q="Cache time-to-live: How long results from this queries in this panel will be cached, in milliseconds. Defaults to the TTL in the caching configuration for this datasource.";return J.cachingConfig?.enabled?n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(m.I,{width:9,tooltip:q},"Cache TTL"),n.createElement(H.p,{type:"number",className:"width-6",placeholder:`${J.cachingConfig.TTLMs}`,spellCheck:!1,onBlur:this.onQueryCachingTTLBlur,defaultValue:ne.queryCachingTTL??void 0}))):null}renderMaxDataPointsOption(){const{data:J,options:ne}=this.props,q=J.request?.maxDataPoints,te=ne.maxDataPoints??"",oe=te==="";return n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(m.I,{width:9,tooltip:n.createElement(n.Fragment,null,"The maximum data points per series. Used directly by some data sources and used in calculation of auto interval. With streaming data this value is used for the rolling buffer.")},"Max data points"),n.createElement(H.p,{type:"number",className:"width-6",placeholder:`${q}`,spellCheck:!1,onBlur:this.onMaxDataPointsBlur,defaultValue:te}),oe&&n.createElement(n.Fragment,null,n.createElement("div",{className:"gf-form-label query-segment-operator"},"="),n.createElement("div",{className:"gf-form-label"},"Width of panel"))))}renderIntervalOption(){const{data:J,dataSource:ne,options:q}=this.props,te=J.request?.interval,oe=ne.interval??"No limit";return n.createElement(n.Fragment,null,n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(m.I,{width:9,tooltip:n.createElement(n.Fragment,null,"A lower limit for the interval. Recommended to be set to write frequency, for example ",n.createElement("code",null,"1m")," ","if your data is written every minute. Default value can be set in data source settings for most data sources.")},"Min interval"),n.createElement(H.p,{type:"text",className:"width-6",placeholder:`${oe}`,spellCheck:!1,onBlur:this.onMinIntervalBlur,defaultValue:q.minInterval??""}))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(m.I,{width:9,tooltip:n.createElement(n.Fragment,null,"The evaluated interval that is sent to data source and is used in ",n.createElement("code",null,"$__interval")," and"," ",n.createElement("code",null,"$__interval_ms"),". This value is not exactly equal to"," ",n.createElement("code",null,"Time range / max data points"),", it will approximate a series of magic number.")},"Interval"),n.createElement(m.I,{width:6},te),n.createElement("div",{className:"gf-form-label query-segment-operator"},"="),n.createElement("div",{className:"gf-form-label"},"Time range / max data points"))))}renderCollapsedText(J){const{data:ne,options:q}=this.props,{isOpen:te}=this.state;if(te)return;let oe=q.maxDataPoints??"";oe===""&&ne.request&&(oe=`auto = ${ne.request.maxDataPoints}`);let ue=q.minInterval;return ne.request&&(ue=`${ne.request.interval}`),n.createElement(n.Fragment,null,n.createElement("div",{className:J.collapsedText},"MD = ",oe),n.createElement("div",{className:J.collapsedText},"Interval = ",ue))}render(){const{timeRangeHide:J,relativeTimeIsValid:ne,timeShiftIsValid:q}=this.state,{timeRangeFrom:te,timeRangeShift:oe,isOpen:ue}=this.state,ie=K();return n.createElement(N.u,{id:"Query options",index:0,title:"Query options",headerElement:this.renderCollapsedText(ie),isOpen:ue,onOpen:this.onOpenOptions,onClose:this.onCloseOptions},this.renderMaxDataPointsOption(),this.renderIntervalOption(),this.renderCacheTimeoutOption(),this.renderQueryCachingTTLOption(),n.createElement("div",{className:"gf-form"},n.createElement(m.I,{width:9,tooltip:n.createElement(n.Fragment,null,"Overrides the relative time range for individual panels, which causes them to be different than what is selected in the dashboard time picker in the top-right corner of the dashboard. For example to configure the Last 5 minutes the Relative time should be ",n.createElement("code",null,"now-5m")," and ",n.createElement("code",null,"5m"),", or variables like ",n.createElement("code",null,"$_relativeTime"),".")},"Relative time"),n.createElement(H.p,{type:"text",className:"width-6",placeholder:"1h",onChange:this.onRelativeTimeChange,onBlur:this.onOverrideTime,invalid:!ne,value:te})),n.createElement("div",{className:"gf-form"},n.createElement(m.I,{width:9,tooltip:n.createElement(n.Fragment,null,"Overrides the time range for individual panels by shifting its start and end relative to the time picker. For example to configure the Last 1h the Time shift should be ",n.createElement("code",null,"now-1h")," and"," ",n.createElement("code",null,"1h"),", or variables like ",n.createElement("code",null,"$_timeShift"),".")},"Time shift"),n.createElement(H.p,{type:"text",className:"width-6",placeholder:"1h",onChange:this.onTimeShiftChange,onBlur:this.onTimeShift,invalid:!q,value:oe})),(oe||te)&&n.createElement("div",{className:"gf-form-inline align-items-center"},n.createElement(m.I,{width:9},"Hide time info"),n.createElement(w.d,{value:J,onChange:this.onToggleTimeOverride})))}}const G=re=>re?B.isValidTimeSpan(re):!0,_=re=>re===""?null:re,K=(0,p.N)(()=>{const{theme:re}=C.$W;return{collapsedText:(0,t.css)` margin-left: ${re.spacing.md}; font-size: ${re.typography.size.sm}; color: ${re.colors.textWeak}; `}});class j extends n.PureComponent{constructor(){super(...arguments),this.backendSrv=y.IB,this.dataSourceSrv=(0,c.l)(),this.querySubscription=null,this.state={isDataSourceModalOpen:!!i.Ny.getSearchObject().firstPanel,isLoadingHelp:!1,helpContent:null,isPickerOpen:!1,isHelpOpen:!1,queries:[],data:{state:o.Gu.NotStarted,series:[],timeRange:(0,s.E2)()}},this.onChangeDataSource=async(J,ne)=>{const{dsSettings:q}=this.state,te=q?await(0,c.l)().get(q.uid):void 0,oe=await(0,c.l)().get(J.uid),ue=ne||await(0,L.y)(oe,J.uid,this.state.queries,te),ie=await this.dataSourceSrv.get(J.name);this.onChange({queries:ue,dataSource:{name:J.name,uid:J.uid,type:J.meta.id,default:J.isDefault}}),this.setState({queries:ue,dataSource:ie,dsSettings:J}),ne&&this.props.onRunQueries()},this.onAddQueryClick=()=>{const{queries:J}=this.state;this.onQueriesChange((0,M.U7)(J,this.newQuery())),this.onScrollBottom()},this.onAddExpressionClick=()=>{this.onQueriesChange((0,M.U7)(this.state.queries,x.Ex.newQuery())),this.onScrollBottom()},this.onScrollBottom=()=>{setTimeout(()=>{this.state.scrollElement&&this.state.scrollElement.scrollTo({top:1e4})},20)},this.onUpdateAndRun=J=>{this.props.onOptionsChange(J),this.props.onRunQueries()},this.onOpenHelp=()=>{this.setState({isHelpOpen:!0})},this.onCloseHelp=()=>{this.setState({isHelpOpen:!1})},this.onCloseDataSourceModal=()=>{this.setState({isDataSourceModalOpen:!1})},this.onAddQuery=J=>{const{dsSettings:ne,queries:q}=this.state;this.onQueriesChange((0,M.U7)(q,J,{type:ne?.type,uid:ne?.uid})),this.onScrollBottom()},this.onQueriesChange=J=>{this.onChange({queries:J}),this.setState({queries:J})},this.setScrollRef=J=>{this.setState({scrollElement:J})}}async componentDidMount(){const{options:J,queryRunner:ne}=this.props;this.querySubscription=ne.getData({withTransforms:!1,withFieldConfig:!1}).subscribe({next:q=>this.onPanelDataUpdate(q)}),this.setNewQueriesAndDatasource(J)}componentWillUnmount(){this.querySubscription&&(this.querySubscription.unsubscribe(),this.querySubscription=null)}async componentDidUpdate(){const{options:J}=this.props,ne=await(0,c.l)().get(J.dataSource);this.state.dataSource&&ne.uid!==this.state.dataSource?.uid&&this.setNewQueriesAndDatasource(J)}async setNewQueriesAndDatasource(J){try{const ne=await this.dataSourceSrv.get(J.dataSource),q=this.dataSourceSrv.getInstanceSettings(J.dataSource),te=await this.dataSourceSrv.get(),oe=ne.getRef(),ue=J.queries.map(ie=>({...(0,M.Ih)(ie)&&ne?.getDefaultQuery?.(r.Jk.PanelEditor),datasource:oe,...ie}));this.setState({queries:ue,dataSource:ne,dsSettings:q,defaultDataSource:te})}catch(ne){console.error("failed to load data source",ne)}}onPanelDataUpdate(J){this.setState({data:J})}newQuery(){const{dsSettings:J,defaultDataSource:ne}=this.state,q=J?.meta.mixed?ne:J;return{...this.state.dataSource?.getDefaultQuery?.(r.Jk.PanelEditor),datasource:{uid:q?.uid,type:q?.type}}}onChange(J){this.props.onOptionsChange({...this.props.options,...J})}renderTopSection(J){const{onOpenQueryInspector:ne,options:q}=this.props,{dataSource:te,data:oe,dsSettings:ue}=this.state;return!ue||!te?null:n.createElement(Y,{data:oe,dataSource:te,options:q,dsSettings:ue,onOptionsChange:this.onUpdateAndRun,onDataSourceChange:this.onChangeDataSource,onOpenQueryInspector:ne})}renderQueries(J){const{onRunQueries:ne}=this.props,{data:q,queries:te}=this.state;return n.createElement("div",{"aria-label":u.Tp.components.QueryTab.content},n.createElement(R.L,{queries:te,dsSettings:J,onQueriesChange:this.onQueriesChange,onAddQuery:this.onAddQuery,onRunQueries:ne,data:q}))}isExpressionsSupported(J){return(J.meta.alerting||J.meta.mixed)===!0}renderExtraActions(){return U.m.getAllExtraRenderAction().map((J,ne)=>J({onAddQuery:this.onAddQuery,onChangeDataSource:this.onChangeDataSource,key:ne})).filter(Boolean)}renderAddQueryRow(J,ne){const q=!(0,O.kN)(J.name);return n.createElement(l.Gy,{spacing:"md",align:"flex-start"},q&&n.createElement(f.$n,{icon:"plus",onClick:this.onAddQueryClick,variant:"secondary","data-testid":u.Tp.components.QueryTab.addQuery},"Add query"),C.Ay.expressionsEnabled&&this.isExpressionsSupported(J)&&n.createElement(f.$n,{icon:"plus",onClick:this.onAddExpressionClick,variant:"secondary",className:ne.expressionButton,"data-testid":"query-tab-add-expression"},n.createElement("span",null,"Expression\xA0")),this.renderExtraActions())}render(){const{isHelpOpen:J,dsSettings:ne}=this.state,q=k();return n.createElement(d.E,{autoHeightMin:"100%",scrollRefCallback:this.setScrollRef},n.createElement("div",{className:q.innerWrapper},this.renderTopSection(q),ne&&n.createElement(n.Fragment,null,n.createElement("div",{className:q.queriesWrapper},this.renderQueries(ne)),this.renderAddQueryRow(ne,q),J&&n.createElement(h.a,{title:"Data source help",isOpen:!0,onDismiss:this.onCloseHelp},n.createElement(b,{pluginId:ne.meta.id})))))}}const k=(0,p.N)(()=>{const{theme:re}=C.Ay;return{innerWrapper:(0,t.css)` display: flex; flex-direction: column; padding: ${re.spacing.md}; `,dataSourceRow:(0,t.css)` display: flex; margin-bottom: ${re.spacing.md}; `,dataSourceRowItem:(0,t.css)` margin-right: ${re.spacing.inlineFormMargin}; `,dataSourceRowItemOptions:(0,t.css)` flex-grow: 1; margin-right: ${re.spacing.inlineFormMargin}; `,queriesWrapper:(0,t.css)` padding-bottom: 16px; `,expressionWrapper:(0,t.css)``,expressionButton:(0,t.css)` margin-right: ${re.spacing.sm}; `}});function Y({dataSource:re,options:J,data:ne,dsSettings:q,onDataSourceChange:te,onOptionsChange:oe,onOpenQueryInspector:ue}){const ie=k(),[ge,he]=(0,n.useState)(!1);return n.createElement(n.Fragment,null,n.createElement("div",null,n.createElement("div",{className:ie.dataSourceRow},n.createElement(m.I,{htmlFor:"data-source-picker",width:"auto"},"Data source"),n.createElement("div",{className:ie.dataSourceRowItem},n.createElement(ee,{options:J,onChange:async(De,pe)=>await te?.(De,pe),isDataSourceModalOpen:!!i.Ny.getSearchObject().firstPanel})),re&&n.createElement(n.Fragment,null,n.createElement("div",{className:ie.dataSourceRowItem},n.createElement(f.$n,{variant:"secondary",icon:"question-circle",title:"Open data source help",onClick:()=>he(!0),"data-testid":"query-tab-help-button"})),n.createElement("div",{className:ie.dataSourceRowItemOptions},n.createElement(V,{options:J,dataSource:re,data:ne,onChange:De=>{oe?.(De)}})),ue&&n.createElement("div",{className:ie.dataSourceRowItem},n.createElement(f.$n,{variant:"secondary",onClick:ue,"aria-label":u.Tp.components.QueryTab.queryInspectorButton},"Query inspector")))),re&&(0,P.H)(re.uid)&&n.createElement(S.c,{pluginId:re.type,pluginType:g.QE.datasource,angularSupportEnabled:C.Ay?.angularSupportEnabled,showPluginDetailsLink:!0,interactionElementId:"datasource-query"})),ge&&n.createElement(h.a,{title:"Data source help",isOpen:!0,onDismiss:()=>he(!1)},n.createElement(b,{pluginId:q.meta.id})))}function ee({options:re,onChange:J,...ne}){const[q,te]=(0,n.useState)(!!ne.isDataSourceModalOpen);(0,n.useEffect)(()=>{i.Ny.getSearchObject().firstPanel&&i.Ny.partial({firstPanel:null},!0)},[]);const oe={metrics:!0,mixed:!0,dashboard:!0,variables:!0,current:re.dataSource,uploadFile:!0,onChange:async(ue,ie)=>{await J(ue,ie),te(!1)}};return n.createElement(n.Fragment,null,q&&n.createElement(T.p,{...oe,onDismiss:()=>te(!1)}),n.createElement(I.s,{...oe}))}},37168:(Q,A,e)=>{"use strict";e.d(A,{nm:()=>oe,Dh:()=>ne});var t=e(39741),n=e(13752),o=e(64423),s=e(44240),r=e(39697),g=e(81160),u=e(67791),c=e(93031),i=e(71030),l=e(69850),f=e(1005),d=e(65961),h=e(3591),p=e(2913),m=e(2543);function a(ue){let ie=[];const ge=(0,m.partition)(ue,"id"),he=(0,m.groupBy)(ge[0],"id");return ie=(0,m.map)(he,De=>De.length>1&&!(0,m.every)(De,v)?(0,m.find)(De,pe=>pe.eventType!=="panel-alert"):(0,m.head)(De)),ie=(0,m.concat)(ie,ge[1]),ie}function v(ue){return ue.eventType==="panel-alert"}var E=e(74856),D=e(65474),b=e(66847),C=e(17172),y=e(7436);class M{canWork({dashboard:ie,range:ge}){return!(!ie.id||ge.raw.to!=="now"||!ie.panels.find(he=>!!he.alert))}work(ie){if(!this.canWork(ie))return(0,y.$)();const{dashboard:ge}=ie;return(0,D.H)((0,C.AI)().get("/api/alerts/states-for-dashboard",{dashboardId:ge.id},`dashboard-query-runner-alert-states-${ge.id}`)).pipe((0,g.T)(he=>({alertStates:he,annotations:[]})),(0,b.W)(y.Zr))}}var T=e(62467),I=e(69862),x=e(16126),S=e(32264),O=e(19347),P=e(90569),L=e(28444),U=e(27302);class R{canRun(ie){return ie?!!(!ie.annotationQuery||ie.annotations):!1}run({annotation:ie,datasource:ge,dashboard:he,range:De}){if(!this.canRun(ge))return(0,T.of)([]);const pe={};return(0,U.b)({dashboard:he,range:De,panel:pe},ge,ie).pipe((0,g.T)(le=>le.events??[]),(0,b.W)(y.SD))}}var B=e(42493);class H{canRun(ie){return ie?(0,B.E7)(ie)?!0:!!(ie.annotationQuery&&!ie.annotations):!1}run({annotation:ie,datasource:ge,dashboard:he,range:De}){return this.canRun(ge)?(0,D.H)(ge.annotationQuery({range:De,rangeRaw:De.raw,annotation:ie,dashboard:he})).pipe((0,b.W)(y.SD)):(0,T.of)([])}}class w{constructor(ie=[new H,new R]){this.runners=ie}canWork({dashboard:ie}){return!!ie.annotations.list.find(w.getAnnotationsToProcessFilter)}work(ie){if(!this.canWork(ie))return(0,y.$)();const{dashboard:ge,range:he}=ie;let De=ge.annotations.list.filter(w.getAnnotationsToProcessFilter);S.$.publicDashboardAccessToken&&De.length>0&&(De=[De[0]]);const pe=De.map(le=>{let Te;if(S.$.publicDashboardAccessToken){const Ee=new P.X;Te=(0,T.of)(Ee).pipe((0,b.W)(y.H0))}else Te=(0,D.H)((0,O.l)().get(le.datasource)).pipe((0,b.W)(y.H0));return Te.pipe((0,I.Z)(Ee=>{const Re=this.runners.find(me=>me.canRun(Ee));return Re?(ge.events.publish(new L.xc(le)),Re.run({annotation:le,datasource:Ee,dashboard:ge,range:he}).pipe((0,u.Q)(ne().cancellations().pipe((0,x.p)(me=>me===le))),(0,g.T)(me=>(ge.snapshot&&(le.snapshotData=(0,m.cloneDeep)(me)),S.$.publicDashboardAccessToken?me:(0,y.G9)(le,me))),(0,l.j)(()=>{ge.events.publish(new L.yj(le))}))):(0,T.of)([])}))});return(0,s.h)(pe).pipe((0,c.U)(),(0,i.T)((le,Te)=>le.concat(Te)),(0,g.T)(le=>({annotations:le,alertStates:[]})))}static getAnnotationsToProcessFilter(ie){return ie.enable&&!ie.snapshotData}}var N=e(85595),V=e(43585),G=e(16233),_=e(55740),K=e(23662),j=e(91309),k=e(80348);class Y{constructor(){this.hasAlertRules={}}canWork({dashboard:ie,range:ge}){return!(!ie.uid||S.$.publicDashboardAccessToken||ge.raw.to!=="now"||this.hasAlertRules[ie.uid]===!1||!(G.TP.hasPermission(k.AccessControlAction.AlertingRuleRead)&&G.TP.hasPermission(k.AccessControlAction.AlertingRuleExternalRead)))}work(ie){if(!this.canWork(ie))return(0,y.$)();const{dashboard:ge}=ie;return(0,D.H)((0,C.AI)().get("/api/prometheus/grafana/api/v1/rules",{dashboard_uid:ge.uid},`dashboard-query-runner-unified-alert-states-${ge.id}`)).pipe((0,g.T)(he=>{if(he.status==="success"){this.hasAlertRules[ge.uid]=!1;const De={};return he.data.groups.forEach(pe=>pe.rules.forEach(le=>{if((0,K.Z8)(le)&&le.annotations&&le.annotations[_.YH.panelID]){this.hasAlertRules[ge.uid]=!0;const Te=Number(le.annotations[_.YH.panelID]),Ee=(0,j.S)(le.state);De[Te]?Ee===V.O.Alerting&&De[Te].state!==V.O.Alerting?De[Te].state=V.O.Alerting:Ee===V.O.Pending&&De[Te].state!==V.O.Alerting&&De[Te].state!==V.O.Pending&&(De[Te].state=V.O.Pending):De[Te]={state:Ee,id:Object.keys(De).length,panelId:Te,dashboardId:ge.id}}})),{alertStates:Object.values(De),annotations:[]}}throw new Error("Unexpected alert rules response.")}),(0,b.W)(y.Zr))}}class ee{constructor(ie,ge=(0,E.jG)(),he=[p.$W.unifiedAlertingEnabled?new Y:new M,new N.F,new w]){this.dashboard=ie,this.timeSrv=ge,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.m(1),this.runs=new n.B,this.cancellationStream=new n.B,this.runsSubscription=this.runs.subscribe(De=>this.executeRun(De)),this.eventsSubscription=ie.events.subscribe(h._,De=>{this.run({dashboard:this.dashboard,range:this.timeSrv.timeRange()})})}run(ie){this.runs.next(ie)}getResult(ie){return this.results.asObservable().pipe((0,g.T)(ge=>{const he=(0,y.FK)(ge.annotations,ie),De=ge.alertStates.find(pe=>!!ie&&pe.panelId===ie);return{annotations:a(he),alertState:De}}))}executeRun(ie){const he=this.workers.filter(Ee=>Ee.canWork(ie)).map(Ee=>Ee.work(ie)),De=new o.yU,pe=(0,s.h)(he).pipe((0,u.Q)(this.runs.asObservable()),(0,c.U)(),(0,i.T)((Ee,Re)=>(Ee.annotations=Ee.annotations.concat(Re.annotations),Ee.alertStates=Ee.alertStates.concat(Re.alertStates),Ee)),(0,l.j)(()=>{De.unsubscribe()}),(0,f.u)()),le=new o.yU,Te=(0,r.O)(200).pipe((0,d.u)({annotations:[],alertStates:[]}),(0,u.Q)(pe),(0,l.j)(()=>{le.unsubscribe()}));le.add(Te.subscribe(Ee=>{this.results.next(Ee)})),De.add(pe.subscribe(Ee=>{this.results.next(Ee)}))}cancel(ie){this.cancellationStream.next(ie)}cancellations(){return this.cancellationStream.asObservable().pipe((0,f.u)())}destroy(){this.results.complete(),this.runs.complete(),this.cancellationStream.complete(),this.runsSubscription.unsubscribe(),this.eventsSubscription.unsubscribe()}}let re;function J(ue){re&&re.destroy(),re=ue}function ne(){if(!re)throw new Error("getDashboardQueryRunner can only be used after Grafana instance has started.");return re}let q;function te(ue){q=ue}function oe(ue){q||(q=({dashboard:ge,timeSrv:he,workers:De})=>new ee(ge,he,De));const ie=q(ue);return J(ie),ie}},90569:(Q,A,e)=>{"use strict";e.d(A,{X:()=>l});var t=e(62467),n=e(65474),o=e(40187),s=e(14236),r=e(17172),g=e(32264),u=e(57220),c=e(68706);const i="-- Public --";class l extends o.mA{constructor(){let d={};super({name:"public-ds",id:0,type:"public-ds",meta:d,uid:i,jsonData:{},access:"proxy",readOnly:!0}),this.annotations={prepareQuery(h){return{...h,queryType:c.nj.Annotations,refId:"anno"}}}}query(d){return d.targets.length?d.targets[0]?.datasource?.uid===u.vv?(0,n.H)(this.getAnnotations(d)):(0,t.of)({data:[]}):(0,t.of)({data:[]})}async getAnnotations(d){const{range:{to:h,from:p}}=d,m={from:p.valueOf(),to:h.valueOf()},a=await(0,r.AI)().get(`/api/public/dashboards/${g.$.publicDashboardAccessToken}/annotations`,m);return{data:[(0,s.Vc)(a)]}}testDatasource(){return Promise.resolve({message:"",status:""})}}},85595:(Q,A,e)=>{"use strict";e.d(A,{F:()=>o});var t=e(62467),n=e(7436);class o{canWork({dashboard:r}){return r?.annotations?.list?.some(g=>g.enable&&!!g.snapshotData)}work(r){if(!this.canWork(r))return(0,n.$)();const g=this.getAnnotationsFromSnapshot(r.dashboard);return(0,t.of)({annotations:g,alertStates:[]})}getAnnotationsFromSnapshot(r){return(r?.annotations?.list?.filter(i=>i.enable)).filter(i=>!!i.snapshotData).reduce((i,l)=>i.concat((0,n.G9)(l,l.snapshotData)),[])}getAnnotationsInSnapshot(r,g){const u=this.getAnnotationsFromSnapshot(r);return(0,n.FK)(u,g)}}},7436:(Q,A,e)=>{"use strict";e.d(A,{$:()=>d,FK:()=>m,G9:()=>a,H:()=>v,H0:()=>f,SD:()=>l,Zr:()=>h});var t=e(2543),n=e.n(t),o=e(62467),s=e(78368),r=e(12091),g=e(32264),u=e(99140),c=e(3169),i=e(16001);function l(E){return E.cancelled?(0,o.of)([]):(p("AnnotationQueryRunner failed",E),(0,o.of)([]))}function f(E){return p("Failed to retrieve datasource",E),(0,o.of)(void 0)}const d=()=>(0,o.of)({annotations:[],alertStates:[]});function h(E){return E.cancelled||p("DashboardQueryRunner failed",E),d()}function p(E,D){const b=(0,r.u)(D);console.error("handleAnnotationQueryRunnerError",b);const C=(0,c.gi)(E,b.message);(0,u.JD)((0,i.dx)(C))}function m(E,D){return D==null?E:E.filter(b=>{let C;if(C=b.source,!C)return!0;if(C.filter){const y=(C.filter.ids??[]).includes(D);if(C.filter.exclude){if(y)return!1}else if(!y)return!1}return b.panelId&&b.source.type==="dashboard"?b.panelId===D:!0})}function a(E,D){E.snapshotData&&(E=(0,t.cloneDeep)(E),delete E.snapshotData);for(const b of D)switch(b.source=E,b.color=g.$.theme2.visualization.getColorByName(E.iconColor),b.type=E.name,b.isRegion=!!(b.timeEnd&&b.time!==b.timeEnd),b.newState?.toLowerCase()){case"pending":b.color="yellow";break;case"alerting":b.color="red";break;case"ok":b.color="green";break;case"normal":b.color="green";break;case"no_data":b.color="gray";break;case"nodata":b.color="gray";break}return D}function v(E){if(!E||!E.length)return[];const D=[];for(const b of E){const C=new s.R(b);for(let y=0;y<b.length;y++){const M=(0,t.cloneDeep)(C.get(y));D.push(M)}}return D}},80924:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>L,S:()=>P});var t=e(2543),n=e(39741),o=e(62467),s=e(69862),r=e(81160),g=e(66847),u=e(39070),c=e(14236),i=e(43127),l=e(90708),f=e(21423),d=e(52622),h=e(2514),p=e(41987),m=e(65879),a=e(12091),v=e(26657),E=e(47118),D=e(31193),b=e(87986),C=e(14348),y=e(37168),M=e(49510),T=e(33948);function I(R=[]){R.forEach(B=>{B.meta={...B.meta,dataTopic:d.QR.Annotations}})}function x(R,B){return(0,M.z)([R,B]).pipe((0,s.Z)(H=>{const[w,N]=H;if(N.annotations?.length||N.alertState){w.annotations||(w.annotations=[]);const V=w.annotations.concat((0,T.I)(N.annotations));I(V);const G=N.alertState;return(0,o.of)({...w,annotations:V,alertState:G})}return I(w.annotations),(0,o.of)(w)}))}var S=e(39374);let O=100;function P(){return"Q"+O++}class L{constructor(B){this.templateSrv=(0,b.w)(),this.resendLastResult=()=>{this.lastResult&&this.subject.next(this.lastResult)},this.subject=new n.m(1),this.dataConfigSource=B}getData(B){const{withFieldConfig:H,withTransforms:w}=B;let N=1,V,G=[],_=[],K,j=!0,k=-1;if(this.dataConfigSource.snapshotData){const Y={state:u.Gu.Done,series:this.dataConfigSource.snapshotData.map(ee=>(0,c.Vc)(ee)),timeRange:(0,i.E2)(),structureRev:N};return(0,o.of)(Y)}return this.subject.pipe((0,s.Z)(Y=>{let ee=this.dataConfigSource.getFieldOverrideOptions(),re=this.dataConfigSource.getTransformations();if(Y.series===_&&V?.fieldConfig===ee?.fieldConfig&&K===re)return(0,o.of)({...Y,structureRev:N,series:G});V=ee,K=re,_=Y.series;let J=(0,o.of)(Y);return w&&(J=this.applyTransformations(Y)),J.pipe((0,r.T)(ne=>{let q=ne,te=!1;if(H&&ne.series?.length){if(k===this.dataConfigSource.configRev){let oe;for(const ue of ne.series)if((0,E.o$)(ue)){oe=ue;break}oe&&!oe.packetInfo.schemaChanged&&G[0].fields.length===oe.fields.length&&(q={...q,series:G.map((ue,ie)=>({...ue,length:ne.series[ie].length,fields:ue.fields.map((ge,he)=>({...ge,values:ne.series[ie].fields[he].values,state:{...ge.state,calcs:void 0,range:void 0}}))}))},te=!0)}ee!=null&&(j||!te)&&(k=this.dataConfigSource.configRev,q={...q,series:(0,l.we)({timeZone:ne.request?.timezone??"browser",data:q.series,...ee})},q.annotations&&(q.annotations=(0,l.we)({data:q.annotations,...ee,fieldConfig:{defaults:{},overrides:[]}})),j=!1)}return!te&&!(0,f.J3)(G,q.series,f.bW)&&N++,G=q.series,{...q,structureRev:N}}))}))}applyTransformations(B){const H=this.dataConfigSource.getTransformations();if(H&&H.every(j=>j.disabled)||!H||H.length===0)return(0,o.of)(B);const N={interpolate:j=>this.templateSrv.replace(j,B?.request?.scopedVars)};let V=H.filter(j=>j.topic==null||j.topic===d.QR.Series),G=H.filter(j=>j.topic===d.QR.Annotations),_=(0,h.m)(V,B.series,N),K=(0,h.m)(G,B.annotations??[],N);return(0,t.merge)(_,K).pipe((0,r.T)(j=>{let Y=j.some(ee=>ee.meta?.dataTopic===d.QR.Annotations)?{annotations:j}:{series:j};return{...B,...Y}}),(0,g.W)(j=>(console.warn("Error running transformation:",j),(0,o.of)({...B,state:u.Gu.Error,errors:[(0,a.u)(j)]}))))}async run(B){const{queries:H,timezone:w,datasource:N,panelId:V,panelPluginId:G,dashboardUID:_,timeRange:K,timeInfo:j,cacheTimeout:k,queryCachingTTL:Y,maxDataPoints:ee,scopedVars:re,minInterval:J,app:ne}=B;if((0,C.kN)(N)){this.pipeToSubject((0,C.mw)(B,H[0]),V,!0);return}const q={app:ne??p.Jk.Dashboard,requestId:P(),timezone:w,panelId:V,panelPluginId:G,dashboardUID:_,range:K,timeInfo:j,interval:"",intervalMs:0,targets:(0,t.cloneDeep)(H),maxDataPoints:ee,scopedVars:re||{},cacheTimeout:k,queryCachingTTL:Y,startTime:Date.now(),rangeRaw:K.raw};try{const te=await U(N,q.scopedVars),oe=te.meta?.mixed;q.targets=q.targets.map(ge=>{const he=ge.datasource?.type===v.dR.type;return(!ge.datasource||ge.datasource.uid!==te.uid&&!oe&&!he)&&(ge.datasource=te.getRef()),ge});const ue=J?this.templateSrv.replace(J,q.scopedVars):te.interval,ie=m.calculateInterval(K,ee,ue);q.scopedVars=Object.assign({},q.scopedVars,{__interval:{text:ie.interval,value:ie.interval},__interval_ms:{text:ie.intervalMs.toString(),value:ie.intervalMs}}),q.interval=ie.interval,q.intervalMs=ie.intervalMs,q.filters=this.templateSrv.getAdhocFilters(te.name,!0),this.lastRequest=q,this.pipeToSubject((0,S.BN)(te,q),V)}catch(te){this.pipeToSubject((0,o.of)({state:u.Gu.Error,error:(0,a.u)(te),series:[],timeRange:q.range}),V)}}pipeToSubject(B,H,w=!1){this.subscription&&this.subscription.unsubscribe();let N=B;const V=this.dataConfigSource.getDataSupport();if(V.alertStates||V.annotations){const G=this.dataConfigSource;N=x(B,(0,y.Dh)().getResult(G.id))}this.subscription=N.subscribe({next:G=>{const _=this.lastResult,K=w?G:(0,c.N$)(G,_);if(_!=null&&K.state!==u.Gu.Streaming){let j=(0,f.J3)(_.series??[],K.series??[],(ee,re)=>ee===re),k=(0,f.J3)(_.annotations??[],K.annotations??[],(ee,re)=>ee===re),Y=_.state===K.state;if(j&&(K.series=_.series),k&&(K.annotations=_.annotations),j&&k&&Y)return}this.lastResult=K,this.subject.next(K)}})}cancelQuery(){this.subscription&&(this.subscription.unsubscribe(),this.lastResult&&(this.lastResult.state===u.Gu.Loading||this.lastResult.state===u.Gu.Streaming)&&this.subject.next({...this.lastResult,state:u.Gu.Done}))}clearLastResult(){this.lastResult=void 0,this.subject=new n.m(1)}destroy(){this.subject&&this.subject.complete(),this.subscription&&this.subscription.unsubscribe()}useLastResultFrom(B){this.lastResult=B.getLastResult(),this.lastResult&&this.subject.next(this.lastResult)}setLastResult(B){this.lastResult=B}getLastResult(){return this.lastResult}getLastRequest(){return this.lastRequest}}async function U(R,B){return R&&typeof R=="object"&&"query"in R?R:await(0,D.tR)().get(R,B)}},81583:(Q,A,e)=>{"use strict";e.d(A,{N:()=>n});var t=e(69850);function n(o,s){return(0,t.j)(()=>{s&&o.resolveCancelerIfExists(s)})}},72955:(Q,A,e)=>{"use strict";e.d(A,{B:()=>n});var t=e(21423);const n=(o,s)=>{let r=1;return s?.structureRev&&s.series&&(r=s.structureRev,(0,t.J3)(o.series,s.series,t.bW)||r++),o.structureRev=r,o}},39374:(Q,A,e)=>{"use strict";e.d(A,{BN:()=>B});var t=e(2543),n=e(62467),o=e(44240),s=e(39697),r=e(65474),g=e(81160),u=e(66847),c=e(59099),i=e(1005),l=e(65961),f=e(67791),d=e(39070),h=e(52622),p=e(85858),m=e(41987),a=e(12091),v=e(32264),E=e(26657),D=e(27677),b=e(21969),C=e(53478),y=e(34867);const M=(0,y.DW)("features.query");var T=e(81583),I=e(76885),x=e(61298),S=e(14110),O=e(14792);function P(w){let N=!1;return G=>{if(!G.request||N||I.kM.getUrlSearchParams().editPanel!=null||G.state!==d.Gu.Done&&G.state!==d.Gu.Error)return;const K={eventName:x.n_.DataRequest,source:G.request.app,datasourceName:w.name,datasourceId:w.id,datasourceUid:w.uid,datasourceType:w.type,dataSize:0,panelId:0,panelPluginId:G.request?.panelPluginId,duration:G.request.endTime-G.request.startTime};V(K,G),G.request.app!==m.Jk.Explore&&G.request.app!==m.Jk.Correlations&&L(K,G),G.series&&G.series.length>0&&(K.dataSize=G.series.length),(0,S.G$)(K),N=!0};function V(G,_){const K={};for(let k=0;k<_.series.length;k++){const Y=_.series[k].refId;Y&&!K[Y]&&(K[Y]=_.series[k].meta?.isCachedResponse??!1)}G.totalQueries=Object.keys(K).length,G.cachedQueries=Object.values(K).filter(k=>k===!0).length,_.request&&Number.isInteger(_.request.panelId)&&(G.panelId=_.request.panelId);const j=(0,O.UA)().getCurrent();j&&(G.dashboardId=j.id,G.dashboardName=j.title,G.dashboardUid=j.uid,G.folderName=j.meta.folderTitle)}}function L(w,N){N.errors?.length?w.error=N.errors.join(", "):N.error&&(w.error=N.error.message)}function U(w,N){const V=N.panelData.request,G={...N.packets},_=w.key??w.data?.[0]?.refId??"A";G[_]=w;let K=w.state||d.Gu.Done,j,k;const Y=[],ee=[];for(const q in G){const te=G[q];if((te.error||te.errors?.length)&&(K=d.Gu.Error,j=te.error,k=te.errors),te.data&&te.data.length)for(const oe of te.data){if(oe.meta?.dataTopic===h.QR.Annotations){ee.push(oe);continue}Y.push(oe)}}const re=R(V,K),J={state:K,series:Y,annotations:ee,error:j,errors:k,request:V,timeRange:re},ne=new Set([...N.panelData.traceIds??[],...w.traceIds??[]]);return ne.size>0&&(J.traceIds=Array.from(ne)),{packets:G,panelData:J}}function R(w,N){const V=w.range;return!(0,t.isString)(V.raw.from)||N!==d.Gu.Streaming?V:{...V,from:p.parse(V.raw.from,!1),to:p.parse(V.raw.to,!0)}}function B(w,N,V){let G={panelData:{state:d.Gu.Loading,series:[],request:N,timeRange:N.range},packets:{}};if(!N.targets.length)return N.endTime=Date.now(),G.panelData.state=d.Gu.Done,(0,n.of)(G.panelData);const _=H(w,N,V).pipe((0,g.T)(K=>{if(!(0,t.map)(K.data))throw new Error(`Expected response data to be array, got ${typeof K.data}.`);return N.endTime=Date.now(),G=U(K,G),G.panelData}),(0,u.W)(K=>(console.error("runRequest.catchError",K),M.logError(K),(0,n.of)({...G.panelData,state:d.Gu.Error,error:(0,a.u)(K)}))),(0,c.M)(P(w)),(0,T.N)(D.IB,N.requestId),(0,i.u)());return(0,o.h)((0,s.O)(200).pipe((0,l.u)(G.panelData),(0,f.Q)(_)),_)}function H(w,N,V){if(N.targets=N.targets.map(_=>(0,b.Ih)(_)?{...w?.getDefaultQuery?.(m.Jk.PanelEditor),..._}:_),v.$.publicDashboardAccessToken)return(0,r.H)(w.query(N));for(const _ of N.targets)if((0,E.s9)(_.datasource))return C.Ex.query(N);const G=V?V(N):w.query(N);return(0,r.H)(G)}},93117:(Q,A,e)=>{"use strict";e.d(A,{y:()=>g});var t=e(41987),n=e(73372),o=e(72574),s=e(26657),r=e(21969);async function g(u,c,i,l){let f=i;const d={type:u.type,uid:c},h={...u?.getDefaultQuery?.(t.Jk.PanelEditor),datasource:d,refId:"A"};if(l?.meta.id!==u.meta.id){if(u.meta.mixed)return i;if((0,n.Ee)(l)&&(0,n.FL)(u)){const p=await l.exportToAbstractQueries(i);f=await u.importFromAbstractQueries(p)}else if(l&&u.importQueries)f=await u.importQueries(i,l);else{if(l){const p=(0,o.w)(),m=[];let a=u.uid;const v=p.containsTemplate(c);v&&(a=p.replace(u.uid));const E=i.reduce((D,b)=>{if(b.datasource){let C=b.datasource.uid;const y=p.containsTemplate(C);if(y&&(C=p.replace(b.datasource.uid)),C===a&&y===v)return b.refId=(0,r.W3)(D),D.concat([b])}return D},m);if(E.length>0)return E}return[h]}}return f.length===0?[h]:f.map(p=>(!(0,s.s9)(p.datasource)&&!u.meta.mixed&&(p.datasource=d),p))}},53477:(Q,A,e)=>{"use strict";e.d(A,{G3:()=>g,JC:()=>l,TF:()=>i,XJ:()=>p,YU:()=>d,d7:()=>f,if:()=>m,r4:()=>r,s1:()=>c,w7:()=>h});var t=e(64161);const n=null,o=58,s=8,r={label:"A\u2013Z",value:"alpha-asc"},g="search.sections",u="grafana.search.expanded-folder",c=0,i="general",l="General",f="grafana.search.include.panels",d="grafana.search.layout",h="grafana.search.sort",p={dashboard:t.G.DashDB,folder:t.G.DashFolder,home:t.G.DashHome},m=1e3},97427:(Q,A,e)=>{"use strict";e.d(A,{d:()=>r,n:()=>g});var t=e(96540),n=e(13752),o=e(71733),s=e(12131);function r(){const u=(0,t.useRef)(new n.B);return{keyboardEvents:u.current,onKeyDown:c=>{switch(c.code){case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":case"Enter":u.current.next(c);default:}}}}function g(u,c,i){const l=(0,t.useRef)({x:0,y:-1}),[f,d]=(0,t.useState)({x:0,y:-1}),h=(0,t.useRef)();return(0,t.useEffect)(()=>{h.current=i.view.fields.url,l.current.x=0,l.current.y=-1,d({...l.current})},[i]),(0,t.useEffect)(()=>{const p=u.subscribe({next:m=>{switch(m?.code){case"ArrowDown":{l.current.y++,d({...l.current});break}case"ArrowUp":l.current.y=Math.max(0,l.current.y-1),d({...l.current});break;case"ArrowRight":{c>0&&(l.current.x=Math.min(c,l.current.x+1),d({...l.current}));break}case"ArrowLeft":{c>0&&(l.current.x=Math.max(0,l.current.x-1),d({...l.current}));break}case"Enter":if(!h.current)break;const a=l.current.x*c+l.current.y;if(a<0){l.current.x=0,l.current.y=0,d({...l.current});break}const v=h.current.values?.[a];typeof v=="string"&&s.Ny.push(o.I.stripBaseFromUrl(v))}}});return()=>p.unsubscribe()},[u,c]),f}},6204:(Q,A,e)=>{"use strict";e.d(A,{B9:()=>g,J$:()=>s,KZ:()=>r,MK:()=>o,Pf:()=>n});var t=e(14110);const n=(c,i)=>{(0,t.rR)(`${c}_viewed`,u(i))},o=(c,i)=>{(0,t.rR)(`${c}_result_clicked`,u(i))},s=(c,i)=>{(0,t.rR)(`${c}_query_submitted`,u(i))},r=(c,{error:i,...l})=>{(0,t.rR)(`${c}_query_failed`,{...u(l),error:i})},g=(c,i,l)=>{(0,t.rR)(`grafana_panel_inspect_${c}_${i}_clicked`,l)},u=c=>({layout:c.layout,starredFilter:c.starred??!1,sort:c.sortValue??"",tagCount:c.tagCount??0,queryLength:c.query?.length??0,includePanels:c.includePanels??!1})},24439:(Q,A,e)=>{"use strict";e.d(A,{getGrafanaSearcher:()=>I});var t=e(32264),n=e(78368),o=e(14236),s=e(57875),r=e(17172),g=e(40957);const u="Loading",c="api/search-v2",i="name_sort";class l{constructor(S){this.fallbackSearcher=S}async search(S){if(S.facet?.length)throw new Error("facets not supported!");return this.doSearchQuery(S)}async starred(S){if(S.facet?.length)throw new Error("facets not supported!");const O=await(0,r.AI)().get("api/user/stars");return O?.length?this.doSearchQuery({uid:O,query:S.query??"*"}):{view:new n.R({length:0,fields:[]}),totalRows:0,loadMoreItems:async(P,L)=>{},isItemLoaded:P=>!0}}async tags(S){const O={...S,query:S.query??"*",sort:void 0,facet:[{field:"tag"}],limit:1},L=(await(0,r.AI)().post(c,O)).frames.map(U=>(0,o.Vc)(U));if(L[0]?.name===u)return this.fallbackSearcher.tags(S);for(const U of L)if(U.fields[0].name==="tag")return h(U);return[]}getSortOptions(){const S=[{value:i,label:"Alphabetically (A-Z)"},{value:"-name_sort",label:"Alphabetically (Z-A)"}];if(t.$.licenseInfo.enabledFeatures.analytics){for(const O of p)S.push({value:`-${O.name}`,label:`${O.display} (most)`}),S.push({value:`${O.name}`,label:`${O.display} (least)`});for(const O of m)S.push({value:`-${O.name}`,label:`${O.display} (recent)`}),S.push({value:`${O.name}`,label:`${O.display} (oldest)`})}return Promise.resolve(S)}async doSearchQuery(S){S=await(0,g.u4)(S);const O={...S,query:S.query??"*",limit:S.limit??f},L=(await(0,r.AI)().post(c,O)).frames.map(V=>(0,o.Vc)(V)),U=L.length?(0,o.Vc)(L[0]):{fields:[],length:0};if(U.name===u)return this.fallbackSearcher.search(S);for(const V of U.fields)V.display=(0,s.J)({field:V,theme:t.$.theme2});U.meta?.custom||(U.meta={...U.meta,custom:{count:U.length,max_score:1}});const R=U.meta.custom;if(R.locationInfo||(R.locationInfo={}),R.sortBy?.length){const V=U.fields.find(G=>G.name===R.sortBy);if(V){const G=a(V.name);R.sortBy=G,V.name=G}}let B=0,H;const w=async()=>{for(;B>N.dataFrame.length;){const V=N.dataFrame.length;if(V>=R.count)return;const G=await(0,r.AI)().post(c,{...O??{},from:V,limit:d}),_=(0,o.Vc)(G.frames[0]);if(!_){console.log("no results",_);return}if(_.fields.length!==N.dataFrame.fields.length){console.log("invalid shape",_,N.dataFrame);return}const K=_.length+N.dataFrame.length;for(let k=0;k<_.fields.length;k++)N.dataFrame.fields[k].values.push(..._.fields[k].values);N.dataFrame.length=K;const j=_.meta?.custom;if(j?.locationInfo&&R)for(const[k,Y]of Object.entries(j.locationInfo))R.locationInfo[k]=Y}H=void 0},N=new n.R(U);return{totalRows:R.count??U.length,view:N,loadMoreItems:async(V,G)=>(B=Math.max(B,G),H||(H=w()),H),isItemLoaded:V=>V<N.dataFrame.length}}getFolderViewSort(){return"name_sort"}}const f=50,d=100;function h(x){const S=x.fields[0].values,O=x.fields[1].values,P=[];for(let L=0;L<x.length;L++)P.push({term:S[L],count:O[L]});return P}const p=[{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"}],m=[{name:"created_at",display:"Created time"},{name:"updated_at",display:"Updated time"}];function a(x){for(const S of p)if(S.name===x)return S.display;for(const S of m)if(S.name===x)return S.display;return x}var v=e(53076);class E{constructor(S){this.parent=S,this.cache=new Map,this.sortPlaceholder="Default (Relevance)"}async search(S){if(S.facet?.length)throw new Error("facets not supported!");if(S.sort!=null)throw new Error("custom sorting is not supported yet");if(S.tags?.length||S.ds_uid?.length)return this.parent.search(S);const P=(await this.getCache(S.kind)).search(S.query);return{isItemLoaded:()=>!0,loadMoreItems:async(L,U)=>{},totalRows:P.length,view:P}}async getCache(S){const O=S?S.sort().join(","):"*",P=this.cache.get(O);if(P)try{return await P}catch{return this.cache.delete(O),new D(new n.R({name:"error",fields:[],length:0}))}const L=this.parent.search({kind:S,limit:5e3}).then(U=>new D(U.view));return this.cache.set(O,L),L}async starred(S){return this.parent.starred(S)}async getSortOptions(){return this.parent.getSortOptions()}async tags(S){return this.parent.tags(S)}getFolderViewSort(){return this.parent.getFolderViewSort()}}class D{constructor(S){this.full=S,this.ufuzzy=new v.A({intraMode:1,intraIns:1,intraSub:1,intraTrn:1,intraDel:1}),this.names=this.full.fields.name.values,this.empty=new n.R({...this.full.dataFrame,fields:this.full.dataFrame.fields.map(O=>({...O,values:[]})),length:0})}search(S){if(!S?.length||S==="*")return this.full;const O=this.full.dataFrame.fields,P=this.names,L=O.map(H=>[]);let[U,R,B]=this.ufuzzy.search(P,S,5);for(let H=0;H<O.length;H++){let w=O[H].values,N=L[H];if(R&&B)for(let V=0;V<B.length;V++){let G=R.idx[B[V]];N.push(w[G])}else if(U)for(let V=0;V<U.length;V++){let G=U[V];N.push(w[G])}}return this.empty.dataFrame.fields.forEach((H,w)=>{H.values=L[w]}),this.empty.dataFrame.length=this.empty.dataFrame.fields[0].values.length,this.empty}}var b=e(11261),C=e(27677),y=e(53477);class M{constructor(){this.locationInfo={general:{kind:"folder",name:"General",url:"/dashboards"}},this.getFolderViewSort=()=>""}async composeQuery(S,O){const P=await(0,g.u4)(O);return P.query?.length&&P.query!=="*"&&(S.query=P.query),P.kind?.length===1&&y.XJ[P.kind[0]]&&(S.type=y.XJ[P.kind[0]]),P.uid?S.dashboardUID=P.uid:P.location?.length&&(S.folderUIDs=[P.location]),S}async search(S){if(S.facet?.length)throw new Error("facets not supported!");if(S.from!==void 0){if(!S.limit)throw new Error("Must specify non-zero limit parameter when using from");if(S.from/S.limit%1!==0)throw new Error("From parameter must be a multiple of limit")}const O=S.limit??(S.from!==void 0?1:y.if),P=S.from!==void 0?S.from/O+1:void 0,L=await this.composeQuery({limit:O,tag:S.tags,sort:S.sort,page:P},S);return this.doAPIQuery(L)}async starred(S){if(S.facet?.length)throw new Error("facets not supported!");const O=await this.composeQuery({limit:S.limit??y.if,tag:S.tags,sort:S.sort,starred:S.starred},S);return this.doAPIQuery(O)}async getSortOptions(){return(await C.IB.get("/api/search/sorting")).sortOptions.map(O=>({value:O.name,label:O.displayName}))}async tags(S){return(await C.IB.get("/api/dashboards/tags")).sort((P,L)=>L.count-P.count)}async doAPIQuery(S){const O=await C.IB.get("/api/search",S),P=[],L=[],U=[],R=[],B=[],H=[],w=[];let N;for(let _ of O){const K=_.type==="dash-folder"?"folder":"dashboard";P.push(K),L.push(_.title),U.push(_.uid),R.push(_.url),B.push(_.tags),w.push(_.sortMeta);let j=_.folderUid;!j&&K==="dashboard"&&(j="general"),H.push(j),_.sortMetaName?.length&&(N=_.sortMetaName),_.folderUid&&_.folderTitle?this.locationInfo[_.folderUid]={kind:"folder",name:_.folderTitle,url:_.folderUrl,folderUid:_.folderUid}:K==="folder"&&(this.locationInfo[_.uid]={kind:K,name:_.title,url:_.url,folderUid:_.folderUid})}const V={fields:[{name:"kind",type:b.PU.string,config:{},values:P},{name:"name",type:b.PU.string,config:{},values:L},{name:"uid",type:b.PU.string,config:{},values:U},{name:"url",type:b.PU.string,config:{},values:R},{name:"tags",type:b.PU.other,config:{},values:B},{name:"location",type:b.PU.string,config:{},values:H}],length:L.length,meta:{custom:{count:L.length,max_score:1,locationInfo:this.locationInfo}}};N?.length&&w.length&&(V.meta.custom.sortBy=N,V.fields.push({name:N,type:b.PU.number,config:{},values:w}));for(const _ of V.fields)_.display=(0,s.J)({field:_,theme:t.$.theme2});const G=new n.R(V);return{totalRows:V.length,view:G,loadMoreItems:async(_,K)=>{},isItemLoaded:_=>!0}}}let T;function I(){if(!T){const x=new M,S=t.$.featureToggles.panelTitleSearch;T=S?new l(x):x,S&&location.search.includes("do-frontend-query")&&(T=new E(T))}return T}},40957:(Q,A,e)=>{"use strict";e.d(A,{TM:()=>g,cu:()=>u,hI:()=>i,u4:()=>o});var t=e(49952),n=e(14792);async function o(l){return l.query&&l.query.indexOf("folder:current")>=0&&(l={...l,location:await s(),query:l.query.replace("folder:current","").trim()},l.query?.length||(l.query="*")),Promise.resolve(l)}async function s(){try{let l=(0,n.UA)().getCurrent();return l||(await r(500),l=(0,n.UA)().getCurrent()),Promise.resolve(l?.meta?.folderUid)}catch(l){console.error(l)}}function r(l){return new Promise(f=>setTimeout(f,l))}function g(l,f){return l==="dashboard"?"apps":l==="folder"?f?"folder-open":"folder":"question-circle"}function u(l,f){return l&&(0,t.I)(l.uid)?"users-alt":g(l.kind,f)}function c(l){switch(l){case"dashboard":case"folder":case"panel":return l;default:return"dashboard"}}function i(l,f){const d=f?.dataFrame.meta?.custom,h={kind:c(l.kind),uid:l.uid,title:l.name,url:l.url,tags:l.tags??[]},p=d?.sortBy;if(p){const m=l[p];(typeof m=="string"||typeof m=="number")&&(h.sortMetaName=p,h.sortMeta=m)}if(l.location){const m=l.location.split("/"),a=m[m.length-1],v=d?.locationInfo[a];v&&(h.parentTitle=v.name,h.parentKind=v.kind,h.parentUID=a)}return h}},64161:(Q,A,e)=>{"use strict";e.d(A,{G:()=>t,P:()=>n});var t=(o=>(o.DashDB="dash-db",o.DashHome="dash-home",o.DashFolder="dash-folder",o))(t||{}),n=(o=>(o.List="list",o.Folders="folders",o))(n||{})},16757:(Q,A,e)=>{"use strict";e.d(A,{N1:()=>r,W1:()=>o});var t=e(53477);const n=g=>g?!!(g.query||g.tag?.length>0||g.starred||g.sort):!1,o=()=>{const g=t.G3+".";for(let u=0;u<window.localStorage.length;u++){const c=window.localStorage.key(u);c?.startsWith(g)&&window.localStorage.removeItem(c)}},s=(g="General")=>`${SECTION_STORAGE_KEY}.${g.toLowerCase()}`,r=g=>{const u=Object.entries(g).reduce((c,[i,l])=>{if(l){if(i==="tag"&&!Array.isArray(l))return{...c,tag:[l]}}else return c;return{...c,[i]:l}},{});if(g.folder){const c=`folder:${g.folder}`;return{...u,query:`${c} ${(u.query??"").replace(c,"")}`}}return{...u}}},1936:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>y,EC:()=>D,FW:()=>m,G3:()=>c,L5:()=>C,QM:()=>g,Yh:()=>a,aD:()=>i,c3:()=>b,ch:()=>u,dJ:()=>l,ew:()=>E,jE:()=>f,zh:()=>v});var t=e(30038),n=e(80348);const o={serviceAccount:{},isLoading:!0,tokens:[]},s=(0,t.Z0)({name:"serviceaccount",initialState:o,reducers:{serviceAccountFetchBegin:M=>({...M,isLoading:!0}),serviceAccountFetchEnd:M=>({...M,isLoading:!1}),serviceAccountLoaded:(M,T)=>({...M,serviceAccount:T.payload,isLoading:!1}),serviceAccountTokensLoaded:(M,T)=>({...M,tokens:T.payload,isLoading:!1}),rolesFetchBegin:M=>({...M,rolesLoading:!0}),rolesFetchEnd:M=>({...M,rolesLoading:!1})}}),r=s.reducer,{serviceAccountLoaded:g,serviceAccountTokensLoaded:u,serviceAccountFetchBegin:c,serviceAccountFetchEnd:i,rolesFetchBegin:l,rolesFetchEnd:f}=s.actions,d={serviceAccounts:[],isLoading:!0,roleOptions:[],query:"",page:0,perPage:50,totalPages:1,showPaging:!1,serviceAccountStateFilter:n.ServiceAccountStateFilter.All},h=(0,t.Z0)({name:"serviceaccounts",initialState:d,reducers:{serviceAccountsFetched:(M,T)=>{const{totalCount:I,perPage:x,...S}=T.payload,O=Math.ceil(I/x);return{...M,...S,totalPages:O,perPage:x,showPaging:O>1,isLoading:!1}},serviceAccountsFetchBegin:M=>({...M,isLoading:!0}),serviceAccountsFetchEnd:M=>({...M,isLoading:!1}),acOptionsLoaded:(M,T)=>({...M,roleOptions:T.payload}),queryChanged:(M,T)=>({...M,query:T.payload,page:0}),pageChanged:(M,T)=>({...M,page:T.payload}),stateFilterChanged:(M,T)=>({...M,serviceAccountStateFilter:T.payload})}}),p=h.reducer,{serviceAccountsFetchBegin:m,serviceAccountsFetchEnd:a,serviceAccountsFetched:v,acOptionsLoaded:E,pageChanged:D,stateFilterChanged:b,queryChanged:C}=h.actions,y={serviceAccountProfile:r,serviceAccounts:p}},8212:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>h,NV:()=>f,Y1:()=>c,j7:()=>u,kH:()=>g,pB:()=>l,s7:()=>i,sF:()=>r,sJ:()=>s});var t=e(30038);const n={supportBundles:[],isLoading:!1,supportBundleCollectors:[],createBundlePageLoading:!1,loadBundlesError:"",createBundleError:""},o=(0,t.Z0)({name:"supportBundles",initialState:n,reducers:{supportBundlesLoaded:(p,m)=>({...p,supportBundles:m.payload,isLoading:!1}),fetchBegin:p=>({...p,isLoading:!0}),fetchEnd:p=>({...p,isLoading:!1}),collectorsFetchBegin:p=>({...p,createBundlePageLoading:!0}),collectorsFetchEnd:p=>({...p,createBundlePageLoading:!1}),supportBundleCollectorsLoaded:(p,m)=>({...p,supportBundleCollectors:m.payload,createBundlePageLoading:!1}),setLoadBundleError:(p,m)=>({...p,loadBundlesError:m.payload,supportBundleCollectors:[]}),setCreateBundleError:(p,m)=>({...p,createBundleError:m.payload})}}),{supportBundlesLoaded:s,fetchBegin:r,fetchEnd:g,supportBundleCollectorsLoaded:u,collectorsFetchBegin:c,collectorsFetchEnd:i,setLoadBundleError:l,setCreateBundleError:f}=o.actions,h={supportBundles:o.reducer}},34655:(Q,A,e)=>{"use strict";e.d(A,{$T:()=>h,$u:()=>u,Ay:()=>E,EC:()=>g,L5:()=>r,Q9:()=>s,dJ:()=>c,jE:()=>i,tC:()=>p});var t=e(30038);const n={teams:[],page:1,query:"",perPage:30,totalPages:0,noTeams:!1,hasFetched:!1},o=(0,t.Z0)({name:"teams",initialState:n,reducers:{teamsLoaded:(D,b)=>{const{totalCount:C,perPage:y,...M}=b.payload,T=Math.ceil(C/y);return{...D,...M,totalPages:T,perPage:y,hasFetched:!0}},queryChanged:(D,b)=>({...D,page:1,query:b.payload}),pageChanged:(D,b)=>({...D,page:b.payload}),sortChanged:(D,b)=>({...D,sort:b.payload,page:1}),rolesFetchBegin:D=>({...D,rolesLoading:!0}),rolesFetchEnd:D=>({...D,rolesLoading:!1})}}),{teamsLoaded:s,queryChanged:r,pageChanged:g,sortChanged:u,rolesFetchBegin:c,rolesFetchEnd:i}=o.actions,l=o.reducer,f={team:{},members:[],groups:[],searchMemberQuery:""},d=(0,t.Z0)({name:"team",initialState:f,reducers:{teamLoaded:(D,b)=>({...D,team:b.payload}),teamMembersLoaded:(D,b)=>({...D,members:b.payload}),setSearchMemberQuery:(D,b)=>({...D,searchMemberQuery:b.payload}),teamGroupsLoaded:(D,b)=>({...D,groups:b.payload})}}),{teamLoaded:h,teamGroupsLoaded:p,teamMembersLoaded:m,setSearchMemberQuery:a}=d.actions,v=d.reducer,E={teams:l,team:v}},87986:(Q,A,e)=>{"use strict";e.d(A,{w:()=>q});var t=e(2543),n=e(95344),o=e(19347),s=e(72574),r=e(79065),g=e(52622),u=e(53287);function c(te){const oe=r.jh.getVariables(te);return(0,u.C)(oe)}var i=e(20601),l=e(13344),f=e(24240),d=e(87421),h=e(75096);let p={};function m(te){const oe=p[te];return oe||(p[te]=(0,t.property)(te))}class a{constructor(oe,ue,ie){this.state={name:oe.name,value:ue,text:ie,type:oe.type}}getValue(oe){let{value:ue}=this.state;return ue==="string"||ue==="number"||ue==="boolean"?ue:String(ue)}getValueText(){const{value:oe,text:ue}=this.state;return typeof ue=="string"?oe===l.To?l.Zm:ue:Array.isArray(ue)?ue.join(" + "):(console.log("value",ue),String(ue))}}let v;function E(te,oe,ue){return v?(v.state.name=te.name,v.state.type=te.type,v.state.value=oe,v.state.text=ue):v=new a(te,oe,ue),v}function D(te,oe,ue,ie){if(ue=ue||{},te==null||(0,f.EW)(ue)&&oe!==g.$m.QueryParam)return"";if(!Array.isArray(te)&&typeof te=="object"&&(te=`${te}`),typeof oe=="function")return oe(te,ue,D);oe||(oe=g.$m.Glob);let ge=oe.split(":");ge.length>1?(oe=ge[0],ge=ge.slice(1)):ge=[];let he=r.vz.getIfExists(oe);he||(console.error(`Variable format ${oe} not found. Using glob format as fallback.`),he=r.vz.get(g.$m.Glob));const De=E(ue,te,ie??te);return he.formatter(te,ge,De)}var b=e(84743),C=e.n(b),y=e(6709),M=e(76885),T=e(1933),I=e(74856),x=e(25304),S=e(83195),O=e(11261),P=e(92461),L=e(57875),U=e(28240),R=e(8249);function B(te,oe,ue){return new Proxy({},{get:(ie,ge)=>{if(ge==="name")return te.name;if(ge==="displayName")return(0,U.Ct)(te,oe,ue);if(ge==="labels"||ge==="formattedLabels")return te.labels?{...te.labels,__values:Object.values(te.labels).sort().join(", "),toString:()=>(0,R.h6)(te.labels,"",!0)}:""}})}function H(te,oe,ue,ie){const ge=w(te,oe,ue);return D(ge,ie)}function w(te,oe,ue){const ie=ue?.__dataContext;if(!ie)return te;const{frame:ge,rowIndex:he,field:De,calculatedValue:pe}=ie.value;if(pe)switch(oe){case"numeric":return pe.numeric.toString();case"raw":return pe.numeric;case"time":return"";case"text":default:return(0,S.cN)(pe)}if(he===void 0)return te;if(oe==="time"){const Re=ge.fields.find(me=>me.type===O.PU.time);return Re?Re.values[he]:void 0}const le=De.values[he];if(oe==="raw")return le;const Ee=(De.display??G())(le);switch(oe){case"numeric":return Ee.numeric;case"text":return Ee.text;default:return(0,S.cN)(Ee)}}function N(te,oe,ue,ie){const ge=ue?.__dataContext;if(!ge||!oe)return te;const{frame:he,rowIndex:De}=ge.value;if(De===void 0||oe===void 0)return te;const pe={name:he.name,refId:he.refId,fields:(0,P.F)({frame:he,rowIndex:De})},le=m(oe)(pe)??"";return D(le,ie)}let V;function G(){return V||(V=(0,L.J)()),V}function _(te,oe,ue,ie){const ge=ue?.__dataContext;if(!ge||oe!=="name")return te;const{frame:he,frameIndex:De}=ge.value,pe=(0,U.Ri)(he,De);return D(pe,ie)}function K(te,oe,ue,ie){const ge=ue?.__dataContext;if(!ge||oe===void 0||oe==="")return te;const{frame:he,field:De,data:pe}=ge.value,le=B(De,he,pe),Te=m(oe)(le)??"";return D(Te,ie)}const j={__value:H,__data:N,__series:_,__field:K,[y.c.includeVars]:k,[y.c.keepTime]:Y,__timezone:ee};function k(te,oe,ue){const ie=(0,x.z)(ue);return M.kM.toUrlParams(ie)}function Y(){return M.kM.toUrlParams((0,I.jG)().timeRangeForUrl())}function ee(){const te=(0,T.O)({timeZone:(0,I.jG)().timeModel?.getTimezone()});return te==="browser"?C().tz.guess():te}const re={getFilteredVariables:d.bZ,getVariables:d.UN,getVariableWithName:d._2};class J{constructor(oe=re){this.dependencies=oe,this.regex=h.SY,this.index={},this.grafanaVariables=new Map,this.timeRange=null,this._adhocFiltersDeprecationWarningLogged=new Map,this._variables=[]}init(oe,ue){this._variables=oe,this.timeRange=ue,this.updateIndex()}get variables(){return(0,n.l)("template_srv.ts","variables","getVariables"),this.getVariables()}getVariables(){return window.__grafanaSceneContext?c(window.__grafanaSceneContext):this.dependencies.getVariables()}updateIndex(){const oe=ue=>ue||ue==="";if(this.index=this._variables.reduce((ue,ie)=>(ie.current&&(ie.current.isNone||oe(ie.current.value))&&(ue[ie.name]=ie),ue),{}),this.timeRange){const ue=this.timeRange.from.valueOf().toString(),ie=this.timeRange.to.valueOf().toString();this.index={...this.index,__from:{current:{value:ue,text:ue}},__to:{current:{value:ie,text:ie}}}}}updateTimeRange(oe){this.timeRange=oe,this.updateIndex()}variableInitialized(oe){this.index[oe.name]=oe}getAdhocFilters(oe,ue){let ie=[],ge=(0,o.l)().getInstanceSettings(oe);if(!ge)return[];!ue&&!this._adhocFiltersDeprecationWarningLogged.get(ge.type)&&((0,n.l)(`DataSource ${ge.type}`,"templateSrv.getAdhocFilters","filters property on the request (DataQueryRequest). Or if this is called from interpolateVariablesInQueries or applyTemplateVariables it is passed as a new argument"),this._adhocFiltersDeprecationWarningLogged.set(ge.type,!0));for(const he of this.getAdHocVariables()){const De=he.datasource?.uid;(De===ge.uid||De?.indexOf("$")===0&&this.replace(De)===ge.uid)&&(ie=ie.concat(he.filters))}return ie}setGrafanaVariable(oe,ue){this.grafanaVariables.set(oe,ue)}setGlobalVariable(oe,ue){(0,n.l)("template_srv.ts","setGlobalVariable",""),this.index={...this.index,[oe]:{current:ue}}}getVariableName(oe){this.regex.lastIndex=0;const ue=this.regex.exec(oe);return ue?ue.slice(1).find(ge=>ge!==void 0):null}containsTemplate(oe){if(!oe)return!1;const ue=this.getVariableName(oe),ie=ue&&this.getVariableAtIndex(ue);return ie!=null}variableExists(oe){return(0,n.l)("template_srv.ts","variableExists","containsTemplate"),this.containsTemplate(oe)}highlightVariablesAsHtml(oe){return!oe||!(0,t.isString)(oe)?oe:(oe=(0,t.escape)(oe),this._replaceWithVariableRegex(oe,void 0,(ue,ie)=>this.getVariableAtIndex(ie)?'<span class="template-variable">'+ue+"</span>":ue))}getAllValue(oe){if(oe.allValue)return oe.allValue;const ue=[];for(let ie=1;ie<oe.options.length;ie++)ue.push(oe.options[ie].value);return ue}getVariableValue(oe,ue){return ue?m(ue)(oe.value):oe.value}getVariableText(oe,ue){return oe.value===ue||typeof ue!="string"?oe.text:ue}replace(oe,ue,ie,ge){if(ue&&ue.__sceneObject){const he=ue.__sceneObject.value.valueOf();return r.jh.interpolate(he,oe,ue,ie)}return window.__grafanaSceneContext&&window.__grafanaSceneContext.isActive?r.jh.interpolate(window.__grafanaSceneContext,oe,ue,ie):oe?(this.regex.lastIndex=0,this._replaceWithVariableRegex(oe,ie,(he,De,pe,le)=>{const Te=this._evaluateVariableExpression(he,De,pe,le,ue);return ge&&ge.push({match:he,variableName:De,fieldPath:pe,format:le,value:Te,found:Te!==he}),Te})):oe??""}_evaluateVariableExpression(oe,ue,ie,ge,he){const De=this.getVariableAtIndex(ue),pe=he?.[ue];if(pe){const Re=this.getVariableValue(pe,ie),me=this.getVariableText(pe,Re);if(Re!=null)return D(Re,ge,De,me)}if(!De){const Re=j[ue];return Re?Re(oe,ie,he,ge):oe}if(ge===g.$m.QueryParam||(0,f.EW)(De)){const Re=i.B.get(De.type).getValueForUrl(De),me=(0,f.EW)(De)?De.id:De.current.text;return D(Re,ge,De,me)}const le=this.grafanaVariables.get(De.current.value);if(le)return D(le,ge,De);let Te=De.current.value,Ee=De.current.text;if(this.isAllValue(Te)&&(Te=this.getAllValue(De),Ee=l.Zm,De.allValue&&ge!==g.$m.Text&&ge!==g.$m.PercentEncode))return this.replace(Te);if(ie){const Re=this.getVariableValue({value:Te,text:Ee},ie);if(Re!=null)return D(Re,ge,De,Ee)}return D(Te,ge,De,Ee)}_replaceWithVariableRegex(oe,ue,ie){return this.regex.lastIndex=0,oe.replace(this.regex,(ge,he,De,pe,le,Te,Ee)=>ie(ge,he||De||le,Te,pe||Ee||ue))}isAllValue(oe){return oe===l.To||Array.isArray(oe)&&oe[0]===l.To}replaceWithText(oe,ue){return(0,n.l)("template_srv.ts","replaceWithText()","replace(), and specify the :text format"),this.replace(oe,ue,"text")}getVariableAtIndex(oe){if(oe)return this.index[oe]?this.index[oe]:this.dependencies.getVariableWithName(oe)}getAdHocVariables(){return this.dependencies.getFilteredVariables(f.EW)}}const ne=new J;(0,s.d)(ne);const q=()=>ne},33449:(Q,A,e)=>{"use strict";e.d(A,{v:()=>H});var t=e(4200),n=e(79065),o=e(52995);function s({title:w,unit:N}){return n.d0.heatmap().setTitle(w).setUnit(N).setOption("calculate",!1).setOption("color",{mode:o.P7.Scheme,exponent:.5,scheme:"Spectral",steps:32,reverse:!1})}function r({title:w,unit:N}){return n.d0.timeseries().setTitle(w).setUnit(N).setCustomFieldConfig("fillOpacity",9)}function g({title:w,unit:N}){return n.d0.timeseries().setTitle(w).setUnit(N).setOption("legend",{showLegend:!1}).setCustomFieldConfig("fillOpacity",9)}const u="short";function c(w){return w&&i[w]||u}const i={bytes:"bytes",seconds:"s"},l={bytes:"Bps",seconds:"short"},f="cps";function d(w){return w&&l[w]||f}function h(w){const N=`${t.Rp}`,V=w.at(-2),G=c(V),_={title:N,unit:G},K={..._,variant:"p50",queries:[D(50)],vizBuilder:()=>g(K)},j={..._,variant:"p50",queries:[D(50,[t.aZ])],vizBuilder:()=>g(j)},k={..._,variant:"percentiles",queries:[99,90,50].map(ee=>D(ee)).map(p),vizBuilder:()=>r(k)},Y={..._,variant:"heatmap",queries:[E()],vizBuilder:()=>s(Y)};return{preview:K,main:k,variants:[k,Y],breakdown:j}}function p(w,N){return{...w,refId:String.fromCharCode("A".charCodeAt(0)+N)}}const m={generator:h},a=`rate(${t.Rp}${t.ui}[$__rate_interval])`;function v(w=[]){return`sum by(${["le",...w].join(", ")}) (${a})`}function E(w=[]){return{refId:"A",expr:v(w),format:"heatmap"}}function D(w,N=[]){return{refId:"A",expr:`histogram_quantile(${w/100}, ${v(N)})`,legendFormat:`${w}th Percentile`}}const b=`${t.Rp}${t.ui}`,C=`rate(${b}[$__rate_interval])`;function y(w){return w?C:b}const M={avg:"average",sum:"sum"};function T(w){return M[w]||w}function I({agg:w,rate:N,unit:V}){const G=y(N),_=N?`${T(w)} of rates per second`:`${T(w)}`,K={title:`${t.Rp}`,unit:V,variant:_},j={refId:"A",expr:`${w}(${G})`,legendFormat:`${t.Rp} (${_})`},k={...K,title:`${t.Rp} (${_})`,queries:[j],vizBuilder:()=>g({...k})},Y={...k,title:`${t.Rp}`,queries:[{...j,legendFormat:_}],vizBuilder:()=>g(Y)},ee={...K,queries:[{refId:"A",expr:`${w}(${G}) by(${t.aZ})`,legendFormat:`{{${t.aZ}}}`}],vizBuilder:()=>g(ee)};return{preview:Y,main:k,breakdown:ee,variants:[]}}const x=new Set(["count","total","sum"]),S={count:"sum",total:"sum",sum:"avg"};function O(w){return w==="total"||w==="sum"}function P(w){const N=w.at(-1);if(N==null)throw new Error("Invalid metric parameter");const V=x.has(N),G=O(N)?w.at(-2):N,_=V?d(G):c(G);return{agg:S[N]||"avg",unit:_,rate:V}}function L(w){const N=P(w);return I(N)}const U={generator:L},R={bucket:m.generator};function B(w){return w&&R[w]||U.generator}function H(w){const N=w.split("_"),V=N.at(-1),G=B(V);if(!G)throw new Error(`Unable to generate queries for metric "${w}" due to issues with derived suffix "${V}"`);return G(N)}},18919:(Q,A,e)=>{"use strict";e.d(A,{b:()=>M});var t=e(32196),n=e(96540),o=e(12131),s=e(79065),r=e(40845),g=e(15292),u=e(83122),c=e(27746);class i extends s.Bs{constructor(P){super({showQuery:P.showQuery??!1,showAdvanced:P.showAdvanced??!1,isOpen:P.isOpen??!1}),this.onToggleShowQuery=()=>{this.setState({showQuery:!this.state.showQuery})},this.onToggleAdvanced=()=>{this.setState({showAdvanced:!this.state.showAdvanced})},this.onToggleMultiValue=()=>{this.setState({multiValueVars:!this.state.multiValueVars})},this.onToggleOpen=L=>{this.setState({isOpen:L})}}}i.Component=({model:O})=>{const{showQuery:P,showAdvanced:L,multiValueVars:U,isOpen:R}=O.useState(),B=(0,r.of)(l),H=()=>n.createElement("div",{className:B.popover,onClick:w=>w.stopPropagation()},n.createElement("div",{className:B.heading},"Settings"),n.createElement("div",{className:B.options},n.createElement("div",null,"Multi value variables"),n.createElement(g.d,{value:U,onChange:O.onToggleMultiValue}),n.createElement("div",null,"Advanced options"),n.createElement(g.d,{value:L,onChange:O.onToggleAdvanced}),n.createElement("div",null,"Show query"),n.createElement(g.d,{value:P,onChange:O.onToggleShowQuery})));return n.createElement(u.m,{overlay:H,placement:"bottom",onVisibleChange:O.onToggleOpen},n.createElement(c.I,{icon:"cog",variant:"canvas",isOpen:R}))};function l(O){return{popover:(0,t.css)({display:"flex",padding:O.spacing(2),flexDirection:"column",background:O.colors.background.primary,boxShadow:O.shadows.z3,borderRadius:O.shape.borderRadius(),border:`1px solid ${O.colors.border.weak}`,zIndex:1,marginRight:O.spacing(2)}),heading:(0,t.css)({fontWeight:O.typography.fontWeightMedium,paddingBottom:O.spacing(2)}),options:(0,t.css)({display:"grid",gridTemplateColumns:"1fr 50px",rowGap:O.spacing(1),columnGap:O.spacing(2)})}}var f=e(67061),d=e(56034),h=e(4200),p=e(51080);class m extends s.Bs{constructor(P){super({steps:P.steps??[],currentStep:P.currentStep??0}),this.stepTransitionInProgress=!1,this.addActivationHandler(this._onActivate.bind(this))}_onActivate(){const P=(0,p.kj)(this);this.state.steps.length===0&&this.addTrailStep(P,"start"),P.subscribeToState((L,U)=>{L.metric!==U.metric&&(this.state.steps.length===1&&(this.state.steps[0].trailState=s.Go.cloneSceneObjectState(U,{history:this})),L.metric&&this.addTrailStep(P,"metric"))}),P.subscribeToEvent(s.oh,L=>{L.payload.state.name===h.Ao&&this.addTrailStep(P,"filters")}),P.subscribeToEvent(s.bZ,L=>{if(L.payload.changedObject instanceof s.JZ){const{prevState:U,newState:R}=L.payload;if((0,p.iG)(U)&&(0,p.iG)(R)&&U.from===R.from&&U.to===R.to)return;this.addTrailStep(P,"time")}})}addTrailStep(P,L){if(this.stepTransitionInProgress)return;const U=this.state.steps.length,R=L==="start"?-1:this.state.currentStep;this.setState({currentStep:U,steps:[...this.state.steps,{description:"Test",type:L,trailState:s.Go.cloneSceneObjectState(P.state,{history:this}),parentIndex:R}]})}goBackToStep(P){this.stepTransitionInProgress=!0,this.setState({currentStep:P}),this.stepTransitionInProgress=!1}renderStepTooltip(P){return n.createElement(f.B,{direction:"column"},n.createElement("div",null,P.type),P.type==="metric"&&n.createElement("div",null,P.trailState.metric))}}m.Component=({model:O})=>{const{steps:P,currentStep:L}=O.useState(),U=(0,r.of)(a),{ancestry:R,alternatePredecessorStyle:B}=(0,n.useMemo)(()=>{const H=new Set;let w=L;for(;w>=0;)H.add(w),w=P[w].parentIndex;const N=new Map;return H.forEach(V=>{const G=P[V].parentIndex;G+1!==V&&N.set(V,E(V,G))}),{ancestry:H,alternatePredecessorStyle:N}},[L,P]);return n.createElement("div",{className:U.container},n.createElement("div",{className:U.heading},"History"),P.map((H,w)=>n.createElement(d.m,{content:()=>O.renderStepTooltip(H),key:w},n.createElement("button",{className:(0,t.cx)(U.step,U.stepTypes[H.type],O.state.currentStep===w?U.stepSelected:"",B.get(w)??"",w!==H.parentIndex+1?U.stepOmitsDirectLeftLink:"",w===0?U.stepOmitsDirectLeftLink:"",R.has(w)?"":U.stepIsNotAncestorOfCurrent),onClick:()=>O.goBackToStep(w)}))))};function a(O){const P=O.visualization;return{container:(0,t.css)({display:"flex",gap:10,alignItems:"center"}),heading:(0,t.css)({}),step:(0,t.css)({flexGrow:0,cursor:"pointer",border:"none",boxShadow:"none",padding:0,margin:0,width:8,height:8,opacity:.7,borderRadius:O.shape.radius.circle,background:O.colors.primary.main,position:"relative","&:hover":{opacity:1},"&:hover:before":{opacity:.7},"&:before":{content:'""',position:"absolute",width:10,height:2,left:-10,top:3,background:O.colors.primary.border,pointerEvents:"none"}}),stepSelected:(0,t.css)({"&:after":{content:'""',borderStyle:"solid",borderWidth:2,borderRadius:"50%",position:"absolute",width:16,height:16,left:-4,top:-4,boxShadow:`0px 0px 0px 2px inset ${O.colors.background.canvas}`}}),stepOmitsDirectLeftLink:(0,t.css)({"&:before":{background:"none"}}),stepIsNotAncestorOfCurrent:(0,t.css)({opacity:.2,"&:hover:before":{opacity:.2}}),stepTypes:{start:v(P.getColorByName("green")),filters:v(P.getColorByName("purple")),metric:v(P.getColorByName("orange")),time:v(O.colors.primary.main)}}}function v(O){return(0,t.css)({background:O,"&:before":{background:O,borderColor:O},"&:after":{borderColor:O}})}function E(O,P){const R=(O-P)*18;return(0,t.css)({"&:before":{content:'""',width:R+2,height:10,borderStyle:"solid",borderWidth:2,borderBottom:"none",borderTopLeftRadius:8,borderTopRightRadius:8,top:-10,left:3-R,background:"none"}})}var D=e(24440),b=e(32284),C=e(90623),y=e(4222);class M extends s.Bs{constructor(P){super({$timeRange:P.$timeRange??new s.JZ({}),$variables:P.$variables??I(P.initialDS,P.metric,P.initialFilters),controls:P.controls??[new s.K8({layout:"vertical"}),new s.N0,new s.KE({}),new s.WM({})],history:P.history??new m({}),settings:P.settings??new i({}),createdAt:P.createdAt??new Date().getTime(),...P}),this._urlSync=new s.So(this,{keys:["metric"]}),this.addActivationHandler(this._onActivate.bind(this))}_onActivate(){return this.state.topScene||this.setState({topScene:T(this.state.metric)}),this.subscribeToEvent(h.OO,this._handleMetricSelectedEvent.bind(this)),this.state.history.subscribeToState((P,L)=>{const U=L.steps.length;if(P.steps.length>U||L.currentStep===P.currentStep)return;const H=P.steps[P.currentStep];this.goBackToStep(H)}),()=>{this.state.embedded||((0,s.Is)().cleanUp(this),(0,y._)().setRecentTrail(this))}}goBackToStep(P){this.state.embedded||(0,s.Is)().cleanUp(this),P.trailState.metric||(P.trailState.metric=void 0),this.setState(P.trailState),this.state.embedded||(o.Ny.replace((0,p.xi)(this)),(0,s.Is)().initSync(this))}_handleMetricSelectedEvent(P){this.state.embedded?this.setState(this.getSceneUpdatesForNewMetricValue(P.payload)):o.Ny.partial({metric:P.payload,actionView:null});const L=s.jh.lookupVariable(h.Ao,this);L instanceof s.H9&&L.setState({baseFilters:S(P.payload)})}getSceneUpdatesForNewMetricValue(P){const L={};return L.metric=P,L.topScene=T(P),L}getUrlState(){return{metric:this.state.metric}}updateFromUrl(P){const L={};typeof P.metric=="string"?this.state.metric!==P.metric&&Object.assign(L,this.getSceneUpdatesForNewMetricValue(P.metric)):P.metric===null&&(L.metric=void 0,L.topScene=new b.t({})),this.setState(L)}}M.Component=({model:O})=>{const{controls:P,topScene:L,history:U}=O.useState(),R=(0,r.of)(x),B=(0,y._)().recent.length<2;return n.createElement("div",{className:R.container},B&&n.createElement(C.p,null),n.createElement(U.Component,{model:U}),P&&n.createElement("div",{className:R.controls},P.map(H=>n.createElement(H.Component,{key:H.state.key,model:H}))),n.createElement("div",{className:R.body},L&&n.createElement(L.Component,{model:L})))};function T(O){return O?new D.R({metric:O}):new b.t({})}function I(O,P,L){return new s.Pj({variables:[new s.mI({name:h.EY,label:"Data source",value:O,pluginId:P===h.td?"loki":"prometheus"}),new s.H9({name:h.Ao,datasource:h.GH,layout:"vertical",filters:L??[],baseFilters:S(P)})]})}function x(O){return{container:(0,t.css)({flexGrow:1,display:"flex",gap:O.spacing(1),minHeight:"100%",flexDirection:"column"}),body:(0,t.css)({flexGrow:1,display:"flex",flexDirection:"column",gap:O.spacing(1)}),controls:(0,t.css)({display:"flex",gap:O.spacing(1),alignItems:"flex-end",flexWrap:"wrap"})}}function S(O){return O?[{key:"__name__",operator:"=",value:O}]:[]}},1997:(Q,A,e)=>{"use strict";e.d(A,{V:()=>I,l:()=>O});var t=e(32196),n=e(96540),o=e(24180),s=e(64388),r=e(12131),g=e(79065),u=e(40845),c=e(36830),i=e(67061),l=e(55852),f=e(94753),d=e(72724),h=e(10860),p=e(39938),m=e(29158),a=e(4200),v=e(51080);function E({trail:L,onSelect:U,onDelete:R}){const B=(0,u.of)(D),H=g.jh.lookupVariable(a.Ao,L);if(!(H instanceof g.H9))return null;const w=H.state.filters,N=(0,v.U4)(L);return n.createElement(h.Z,{onClick:()=>U(L),className:B.card},n.createElement(h.Z.Heading,null,(0,v.aO)(L.state.metric)),n.createElement("div",{className:B.description},n.createElement(i.B,{gap:1.5},w.map(V=>n.createElement(p.E,{key:V.key,text:`${V.key}: ${V.value}`,color:"blue",className:B.tag})))),n.createElement(h.Z.Actions,{className:B.actions},n.createElement(i.B,{gap:1,justifyContent:"space-between",grow:1},n.createElement("div",{className:B.secondary},n.createElement("b",null,"Datasource:")," ",(0,v.nH)(N)),L.state.createdAt&&n.createElement("i",{className:B.secondary},n.createElement("b",null,"Created:")," ",(0,d.LE)(L.state.createdAt,{format:"LL"})))),R&&n.createElement(h.Z.SecondaryActions,null,n.createElement(m.K,{key:"delete",name:"trash-alt",className:B.secondary,tooltip:"Remove bookmark",onClick:R})))}function D(L){return{tag:(0,t.css)({maxWidth:"260px",overflow:"hidden",textOverflow:"ellipsis"}),card:(0,t.css)({padding:L.spacing(1)}),secondary:(0,t.css)({color:L.colors.text.secondary,fontSize:"12px"}),description:(0,t.css)({width:"100%",gridArea:"Description",margin:L.spacing(1,0,0),color:L.colors.text.secondary,lineHeight:L.typography.body.lineHeight}),actions:(0,t.css)({marginRight:L.spacing(1)})}}var b=e(90623),C=e(4222);class y extends g.Bs{constructor(U){super(U),this.onNewMetricsTrail=()=>{const R=M(this),B=(0,v.ef)((0,v.hR)());(0,C._)().setRecentTrail(B),R.goToUrlForTrail(B)},this.onSelectTrail=R=>{const B=M(this);(0,C._)().setRecentTrail(R),B.goToUrlForTrail(R)}}}y.Component=({model:L})=>{const[U,R]=(0,n.useState)(Date.now()),B=(0,u.of)(T),H=w=>{(0,C._)().removeBookmark(w),R(Date.now())};if(!(0,C._)().recent.length){const w=(0,v.ef)((0,v.hR)());return n.createElement(o.rd,{to:(0,v.xi)(w)})}return n.createElement("div",{className:B.container},n.createElement(i.B,{gap:2,justifyContent:"space-between",alignItems:"center"},n.createElement(b.p,null),n.createElement(l.$n,{icon:"plus",size:"md",variant:"primary",onClick:L.onNewMetricsTrail},"New metric exploration")),n.createElement(i.B,{gap:5},n.createElement("div",{className:B.column},n.createElement(f.E,{variant:"h4"},"Recent metrics"),n.createElement("div",{className:B.trailList},(0,C._)().recent.map((w,N)=>{const V=w.resolve();return n.createElement(E,{key:(V.state.key||"")+N,trail:V,onSelect:L.onSelectTrail})}))),n.createElement("div",{className:B.verticalLine}),n.createElement("div",{className:B.column},n.createElement(f.E,{variant:"h4"},"Bookmarks"),n.createElement("div",{className:B.trailList},(0,C._)().bookmarks.map((w,N)=>{const V=w.resolve();return n.createElement(E,{key:(V.state.key||"")+N,trail:V,onSelect:L.onSelectTrail,onDelete:()=>H(N)})})))))};function M(L){return g.jh.getAncestor(L,I)}function T(L){return{container:(0,t.css)({padding:L.spacing(2),flexGrow:1,display:"flex",flexDirection:"column",gap:L.spacing(3)}),column:(0,t.css)({display:"flex",flexGrow:1,flexDirection:"column",gap:L.spacing(2)}),newTrail:(0,t.css)({height:"auto",justifyContent:"center",fontSize:L.typography.h5.fontSize}),trailCard:(0,t.css)({}),trailList:(0,t.css)({display:"flex",flexDirection:"column",gap:L.spacing(2)}),verticalLine:(0,t.css)({borderLeft:`1px solid ${L.colors.border.weak}`})}}class I extends g.Bs{constructor(U){super(U)}goToUrlForTrail(U){this.setState({trail:U}),r.Ny.push((0,v.xi)(U))}}I.Component=({model:L})=>{const{trail:U,home:R}=L.useState(),B=(0,u.of)(P);return n.createElement(o.dO,null,n.createElement(o.qh,{exact:!0,path:"/explore/metrics",render:()=>n.createElement(c.Y,{navId:"explore/metrics",layout:s.k.Custom},n.createElement("div",{className:B.customPage},n.createElement(R.Component,{model:R})))}),n.createElement(o.qh,{exact:!0,path:"/explore/metrics/trail",render:()=>n.createElement(c.Y,{navId:"explore/metrics",pageNav:{text:(0,v.aO)(U.state.metric)},layout:s.k.Custom},n.createElement("div",{className:B.customPage},n.createElement(x,{trail:U})))}))};function x({trail:L}){const[U,R]=n.useState(!1);return(0,n.useEffect)(()=>{U||((0,g.Is)().initSync(L),(0,C._)().setRecentTrail(L),R(!0))},[L,U]),U?n.createElement(L.Component,{model:L}):null}let S;function O(){return S||(S=new I({trail:(0,v.ef)(),home:new y({})})),S}function P(L){return{customPage:(0,t.css)({padding:L.spacing(2,3,2,3),background:L.isLight?L.colors.background.primary:L.colors.background.canvas,flexGrow:1,display:"flex",flexDirection:"column"})}}},24440:(Q,A,e)=>{"use strict";e.d(A,{R:()=>ue});var t=e(32196),n=e(96540),o=e(94624),s=e(79065),r=e(40845),g=e(90613),u=e(67061),c=e(27746),i=e(14578),l=e(63021),f=e(40675),d=e(87490),h=e(88575),p=e(55852),m=e(13344),a=e(33449),v=e(16792),E=e(29413),D=e(94354),b=e(88323);function C({options:Ee,value:Re,onChange:me}){const Me=(0,r.of)(y),ye=(0,r.$j)(),[Le,We]=(0,n.useState)(0),[Be,Ye]=(0,n.useState)(0),at=Be>Le,st=(0,n.useRef)(null);return(0,v.wY)({ref:st,onResize:()=>{const Ke=st.current;Ke&&Ye(Ke.clientWidth)}}),(0,n.useEffect)(()=>{const{fontSize:Ke}=ye.typography,Xe=Ee.map(xe=>xe.label||xe.value||"").join(" "),He=(0,E.kD)(Xe,Ke).width;We(He+32*Ee.length)},[Ee,ye]),n.createElement("div",{ref:st},at?n.createElement(D.z,{options:Ee,value:Re,onChange:me}):n.createElement(b.l6,{options:Ee,value:Re,onChange:Ke=>me(Ke.value),className:Me.select}))}function y(Ee){return{select:(0,t.css)({maxWidth:Ee.spacing(16)})}}var M=e(4200),T=e(51080);class I extends s.Bs{constructor(){super(...arguments),this.onClick=()=>{const Re=s.jh.lookupVariable("filters",this);if(!(Re instanceof s.H9))return;const me=this.state.frame.fields[1]?.labels??{};if(Object.keys(me).length!==1)return;const Me=Object.keys(me)[0];Re.setState({filters:[...Re.state.filters,{key:Me,operator:"=",value:me[Me]}]})}}}I.Component=({model:Ee})=>n.createElement(p.$n,{variant:"primary",size:"sm",fill:"text",onClick:Ee.onClick},"Add to filters");var x=e(39070);class S extends s.Bs{constructor(Re){super(Re),this.addActivationHandler(()=>{const me=s.jh.getData(this);this._subs.add(me.subscribeToState(Me=>{Me.data?.state===x.Gu.Done&&this.performRepeat(Me.data)})),me.state.data&&this.performRepeat(me.state.data)})}performRepeat(Re){const me=[];for(let Me=0;Me<Re.series.length;Me++){const ye=this.state.getLayoutChild(Re,Re.series[Me],Me);me.push(ye)}this.state.body.setState({children:me})}}S.Component=({model:Ee})=>{const{body:Re}=Ee.useState();return n.createElement(Re.Component,{model:Re})};class O extends s.Bs{constructor(){super(...arguments),this.onLayoutChange=Re=>{this.setState({active:Re})}}Selector({model:Re}){const{active:me,options:Me}=Re.useState();return n.createElement(h.D,{label:"View"},n.createElement(D.z,{options:Me,value:me,onChange:Re.onLayoutChange}))}}O.Component=({model:Ee})=>{const{layouts:Re,options:me,active:Me}=Ee.useState(),ye=me.findIndex(We=>We.value===Me);if(ye===-1)return null;const Le=Re[ye];return n.createElement(Le.Component,{model:Le})};function P(Ee,Re){const me=s.jh.lookupVariable(M.Ao,Ee),Me=[];if(!(me instanceof s.H9))return[];const ye=me.state.filters;for(const Le of Re.getOptionsForSelect())ye.find(Be=>Be.key===Le.value)||Me.push({label:Le.label,value:String(Le.value)});return Me}class L extends s.Bs{constructor(Re){super({labels:Re.labels??[],...Re}),this._variableDependency=new s.Sh(this,{variableNames:[M.Ao],onReferencedVariableValueChanged:this.onReferencedVariableValueChanged.bind(this)}),this.onChange=me=>{if(!me)return;const Me=this.getVariable();me===m.To?this.setState({body:R(this.state.labels,this._query)}):Me.hasAllValue()&&this.setState({body:H(this._query)}),Me.changeValueTo(me)},this.addActivationHandler(this._onActivate.bind(this))}_onActivate(){const Re=this.getVariable();Re.subscribeToState((Me,ye)=>{(Me.options!==ye.options||Me.value!==ye.value||Me.loading!==ye.loading)&&this.updateBody(Re)});const me=s.jh.getAncestor(this,ue).state.metric;this._query=(0,a.v)(me).breakdown,this.updateBody(Re)}getVariable(){const Re=s.jh.lookupVariable(M.yr,this);if(!(Re instanceof s.fS))throw new Error("Group by variable not found");return Re}onReferencedVariableValueChanged(){const Re=this.getVariable();Re.changeValueTo(m.To),this.updateBody(Re)}updateBody(Re){const me=P(this,Re),Me={loading:Re.state.loading,value:String(Re.state.value),labels:me};Re.state.loading||(Me.body=Re.hasAllValue()?R(me,this._query):H(this._query)),this.setState(Me)}}L.Component=({model:Ee})=>{const{labels:Re,body:me,loading:Me,value:ye}=Ee.useState(),Le=(0,r.of)(U);return n.createElement("div",{className:Le.container},Me&&n.createElement("div",null,"Loading..."),n.createElement("div",{className:Le.controls},!Me&&n.createElement("div",{className:Le.controlsLeft},n.createElement(h.D,{label:"By label"},n.createElement(C,{options:Re,value:ye,onChange:Ee.onChange}))),me instanceof O&&n.createElement("div",{className:Le.controlsRight},n.createElement(me.Selector,{model:me}))),n.createElement("div",{className:Le.content},me&&n.createElement(me.Component,{model:me})))};function U(Ee){return{container:(0,t.css)({flexGrow:1,display:"flex",minHeight:"100%",flexDirection:"column"}),content:(0,t.css)({flexGrow:1,display:"flex",paddingTop:Ee.spacing(0)}),controls:(0,t.css)({flexGrow:0,display:"flex",alignItems:"top",gap:Ee.spacing(2)}),controlsRight:(0,t.css)({flexGrow:0,display:"flex",justifyContent:"flex-end"}),controlsLeft:(0,t.css)({display:"flex",justifyContent:"flex-left",justifyItems:"left",width:"100%",flexDirection:"column"})}}function R(Ee,Re){const me=[];for(const Me of Ee){if(Me.value===m.To)continue;const ye=Re.queries[0].expr.replace(M.aZ,String(Me.value)),Le=Re.unit;me.push(new s.xK({body:s.d0.timeseries().setTitle(Me.label).setData(new s.dt({maxDataPoints:300,datasource:M.GH,queries:[{refId:"A",expr:ye,legendFormat:`{{${Me.label}}}`}]})).setHeaderActions(new V({labelName:String(Me.value)})).setUnit(Le).build()}))}return new O({options:[{value:"grid",label:"Grid"},{value:"rows",label:"Rows"}],active:"grid",layouts:[new s.gF({templateColumns:B,autoRows:"200px",children:me}),new s.gF({templateColumns:"1fr",autoRows:"200px",children:me})]})}const B="repeat(auto-fit, minmax(400px, 1fr))";function H(Ee){return new O({$data:new s.dt({datasource:M.GH,maxDataPoints:300,queries:Ee.queries}),options:[{value:"single",label:"Single"},{value:"grid",label:"Grid"},{value:"rows",label:"Rows"}],active:"grid",layouts:[new s.G1({direction:"column",children:[new s.vA({minHeight:300,body:s.d0.timeseries().setTitle("$metric").build()})]}),new S({body:new s.gF({templateColumns:B,autoRows:"200px",children:[]}),getLayoutChild:(Re,me,Me)=>new s.xK({body:Ee.vizBuilder().setTitle(w(me)).setData(new s.Zv({data:{...Re,series:[me]}})).setColor({mode:"fixed",fixedColor:(0,T.Vy)(Me)}).setHeaderActions(new I({frame:me})).build()})}),new S({body:new s.gF({templateColumns:"1fr",autoRows:"200px",children:[]}),getLayoutChild:(Re,me,Me)=>new s.xK({body:Ee.vizBuilder().setTitle(w(me)).setData(new s.Zv({data:{...Re,series:[me]}})).setColor({mode:"fixed",fixedColor:(0,T.Vy)(Me)}).setHeaderActions(new I({frame:me})).build()})})]})}function w(Ee){const Re=Ee.fields[1]?.labels;if(!Re)return"No labels";const me=Object.keys(Re);return me.length===0?"No labels":Re[me[0]]}function N(){return new s.vA({body:new L({})})}class V extends s.Bs{constructor(){super(...arguments),this.onClick=()=>{G(this).onChange(this.state.labelName)}}}V.Component=({model:Ee})=>n.createElement(p.$n,{variant:"primary",size:"sm",fill:"text",onClick:Ee.onClick},"Select");function G(Ee){if(Ee instanceof L)return Ee;if(Ee.parent)return G(Ee.parent);throw new Error("Unable to find breakdown scene")}var _=e(94753),K=e(72109),j=e(31193);class k extends s.Bs{constructor(Re){super({...Re}),this._variableDependency=new s.Sh(this,{variableNames:[M.gR],onReferencedVariableValueChanged:this.onReferencedVariableValueChanged.bind(this)}),this.addActivationHandler(this._onActivate.bind(this))}getVariable(){const Re=s.jh.lookupVariable(M.yr,this);if(!(Re instanceof s.fS))throw new Error("Group by variable not found");return Re}_onActivate(){this.updateMetadata()}onReferencedVariableValueChanged(){this.updateMetadata()}async updateMetadata(){const me=(await(0,j.tR)().get(M.gR,{__sceneObject:{value:this}})).languageProvider;if(!me)return;const ye=(0,T.aM)(this).state.metric;if(me.metricsMetadata){this.setState({metadata:me.metricsMetadata[ye]});return}await me.start(),this.setState({metadata:me.metricsMetadata?.[ye]})}}k.Component=({model:Ee})=>{const{metadata:Re}=Ee.useState(),me=Ee.getVariable(),{loading:Me}=me.useState(),ye=P(Ee,me).filter(Le=>Le.value!==m.To);return n.createElement(u.B,{gap:6},Me?n.createElement("div",null,"Loading..."):n.createElement(n.Fragment,null,n.createElement(u.B,{direction:"column",gap:.5},n.createElement(_.E,{weight:"medium"},"Description"),n.createElement("div",{style:{maxWidth:360}},Re?.help?n.createElement("div",null,Re?.help):n.createElement("i",null,"No description available"))),n.createElement(u.B,{direction:"column",gap:.5},n.createElement(_.E,{weight:"medium"},"Type"),Re?.type?n.createElement("div",null,Re?.type):n.createElement("i",null,"Unknown")),n.createElement(u.B,{direction:"column",gap:.5},n.createElement(_.E,{weight:"medium"},"Unit"),Re?.unit?n.createElement("div",null,Re?.unit):n.createElement("i",null,"Unknown")),n.createElement(u.B,{direction:"column",gap:.5},n.createElement(_.E,{weight:"medium"},"Labels"),ye.map(Le=>n.createElement(K.Y,{key:Le.label,href:s.jh.interpolate(Ee,`${M.km}\${__url.params:exclude:actionView,var-groupby}&actionView=breakdown&var-groupby=${encodeURIComponent(Le.value)}`),title:"View breakdown"},Le.label)))))};function Y(){return new s.vA({body:new k({})})}var ee=e(32284);function re(){return new s.vA({body:new ee.t({})})}class J extends s.Bs{constructor(Re){super(Re),this.onChangeQuery=me=>{const Me=(0,T.aM)(this),ye=Me.state.autoQuery.variants.find(Le=>Le.variant===me);this.setState({panel:this.getVizPanelFor(ye)}),Me.setState({queryDef:ye})},this.addActivationHandler(this.onActivate.bind(this))}onActivate(){const{autoQuery:Re}=(0,T.aM)(this).state;this.setState({panel:this.getVizPanelFor(Re.main)})}getQuerySelector(Re){const{autoQuery:me}=(0,T.aM)(this).state;if(me.variants.length===0)return;const Me=me.variants.map(ye=>({label:ye.variant,value:ye.variant}));return n.createElement(D.z,{size:"sm",options:Me,value:Re.variant,onChange:this.onChangeQuery})}getVizPanelFor(Re){return Re.vizBuilder().setData(new s.dt({datasource:M.GH,maxDataPoints:500,queries:Re.queries})).setHeaderActions(this.getQuerySelector(Re)).build()}}J.Component=({model:Ee})=>{const{panel:Re}=Ee.useState(),{queryDef:me}=(0,T.aM)(Ee).state,{showQuery:Me}=(0,T.KE)(Ee).useState(),ye=(0,r.of)(ne);if(Re)return Me?n.createElement("div",{className:ye.wrapper},n.createElement(u.B,{gap:2},n.createElement(h.D,{label:"Query"},n.createElement("div",null,me&&me.queries.map((Le,We)=>n.createElement("div",{key:We},Le.expr))))),n.createElement("div",{className:ye.panel},n.createElement(Re.Component,{model:Re}))):n.createElement(Re.Component,{model:Re})};function ne(){return{wrapper:(0,t.css)({display:"flex",flexDirection:"column",flexGrow:1}),panel:(0,t.css)({position:"relative",flexGrow:1})}}var q=e(87586);const te=({trail:Ee})=>{const{origin:Re}=(0,q.A)(),[me,Me]=(0,n.useState)("Copy url"),ye=()=>{navigator.clipboard&&(navigator.clipboard.writeText(Re+(0,T.xi)(Ee)),Me("Copied!"),setTimeout(()=>{Me("Copy url")},2e3))};return n.createElement(c.I,{variant:"canvas",icon:"share-alt",tooltip:me,onClick:ye})};var oe=e(4222);class ue extends s.Bs{constructor(Re){const me=Re.autoQuery??(0,a.v)(Re.metric);super({$variables:Re.$variables??De(Re.metric),body:Re.body??Te(),autoQuery:me,queryDef:Re.queryDef??me.main,...Re}),this._urlSync=new s.So(this,{keys:["actionView"]}),this.addActivationHandler(this._onActivate.bind(this))}_onActivate(){this.state.actionView===void 0&&this.setActionView("overview")}getUrlState(){return{actionView:this.state.actionView}}updateFromUrl(Re){if(typeof Re.actionView=="string"){if(this.state.actionView!==Re.actionView){const me=ie.find(Me=>Me.value===Re.actionView);me&&this.setActionView(me.value)}}else Re.actionView===null&&this.setActionView(void 0)}setActionView(Re){const{body:me}=this.state,Me=ie.find(ye=>ye.value===Re);Me&&Me.value!==this.state.actionView?(me.state.children[0].setState({maxHeight:pe}),me.setState({children:[...me.state.children.slice(0,2),Me.getScene()]}),this.setState({actionView:Me.value})):(me.state.children[0].setState({maxHeight:le}),me.setState({children:me.state.children.slice(0,2)}),this.setState({actionView:void 0}))}}ue.Component=({model:Ee})=>{const{body:Re}=Ee.useState();return n.createElement(Re.Component,{model:Re})};const ie=[{displayName:"Overview",value:"overview",getScene:Y},{displayName:"Breakdown",value:"breakdown",getScene:N},{displayName:"Related metrics",value:"related",getScene:re}];class ge extends s.Bs{constructor(){super(...arguments),this.onOpenTrail=()=>{this.publishEvent(new M.PK,!0)},this.getLinkToExplore=async()=>{const Re=s.jh.getAncestor(this,ue),me=(0,T.kj)(this),Me=(0,T.U4)(me),ye=Re.state.queryDef?.queries||[],Le=s.jh.getTimeRange(this);return(0,d.Xe)({queries:ye,dsRef:{uid:Me},timeRange:Le.state.value,scopedVars:{__sceneObject:{value:Re}}})},this.openExploreLink=async()=>{this.getLinkToExplore().then(Re=>{window.open(Re,"_blank")})}}}ge.Component=({model:Ee})=>{const Re=s.jh.getAncestor(Ee,ue),me=(0,r.of)(he),Me=(0,T.kj)(Ee),[ye,Le]=(0,n.useState)(!1),{actionView:We}=Re.useState(),Be=()=>{(0,oe._)().addBookmark(Me),Le(!ye)};return n.createElement(g.a,{paddingY:1},n.createElement("div",{className:me.actions},n.createElement(u.B,{gap:1},n.createElement(c.I,{variant:"canvas",icon:"compass",tooltip:"Open in explore",onClick:Ee.openExploreLink}),n.createElement(te,{trail:Me}),n.createElement(c.I,{variant:"canvas",icon:ye?n.createElement(i.I,{name:"favorite",type:"mono",size:"lg"}):n.createElement(i.I,{name:"star",type:"default",size:"lg"}),tooltip:"Bookmark",onClick:Be}),Me.state.embedded&&n.createElement(c.I,{variant:"canvas",onClick:Ee.onOpenTrail},"Open"))),n.createElement(l.U,null,ie.map((Ye,at)=>n.createElement(f.o,{key:at,label:Ye.displayName,active:We===Ye.value,onChangeTab:()=>Re.setActionView(Ye.value)}))))};function he(Ee){return{actions:(0,t.css)({[Ee.breakpoints.up(Ee.breakpoints.values.md)]:{position:"absolute",right:0,zIndex:2}})}}function De(Ee){return new s.Pj({variables:[...(0,M.ym)(Ee),new s.fS({name:M.yr,label:"Group by",datasource:M.GH,includeAll:!0,defaultToAll:!0,query:{query:`label_names(${M.Rp})`,refId:"A"},value:"",text:""})]})}const pe=280,le="40%";function Te(){const Ee=new J({});return new s.G1({direction:"column",$behaviors:[new s.Gg.K2({key:"metricCrosshairSync",sync:o.y.Crosshair})],children:[new s.vA({minHeight:pe,maxHeight:le,body:Ee}),new s.vA({ySizing:"content",body:new ge({})})]})}},32284:(Q,A,e)=>{"use strict";e.d(A,{t:()=>w});var t=e(32196),n=e(2543),o=e(96540),s=e(12470),r=e(79065),g=e(79422),u=e(40845),c=e(39558),i=e(88575),l=e(10354),f=e(14578),d=e(15292),h=e(42418),p=e(33449),m=e(66864),a=e(3988),v=e(55852);function E(Y){return(0,o.useMemo)(()=>D(Y),[Y])}function D(Y){const ee={children:{}};function re(J){if(J.indexOf(":")!==-1)return;const ne=J.split("_");let q=ee;for(const te of ne){let oe=q.children[te];oe||(oe={children:{}},q.children[te]=oe),q=oe}q.isMetric=!0}return Y.forEach(J=>re(J)),ee}function b({metricNames:Y,onSelect:ee,disabled:re,initialValue:J}){const ne=E(Y),q=(0,o.useMemo)(()=>C(ne),[ne]),[te,oe]=(0,o.useState)(J==null),[ue,ie]=(0,o.useReducer)(he=>he+1,0),ge=()=>{ie(),oe(!0),ee(void 0)};return o.createElement(m.Gy,null,o.createElement(a.v,{key:ue,displayAllSelectedLevels:!0,width:40,separator:"_",hideActiveLevelLabel:!1,placeholder:"No filter",onSelect:he=>{oe(!he),ee(he)},options:q,disabled:re,initialValue:J}),o.createElement(v.$n,{disabled:te||re,onClick:ge,variant:"secondary"},"Clear"))}function C(Y,ee=""){return Object.entries(Y.children).map(([ne,q])=>{let te=Object.entries(q.children);for(;te.length===1&&!q.isMetric;){const[ge,he]=te[0];ne=`${ne}_${ge}`,q=he,te=Object.entries(q.children)}const oe=ee+ne,ue=C(q,oe+"_");return{value:oe,label:ne,items:ue}})}var y=e(24440),M=e(4200);class T extends r.Bs{constructor(){super(...arguments),this.onClick=()=>{this.publishEvent(new M.OO(this.state.metric),!0)}}}T.Component=({model:Y})=>o.createElement(v.$n,{variant:"primary",size:"sm",fill:"text",onClick:Y.onClick},Y.state.title);var I=e(39070),x=e(11261);function S(Y){return ee=>{const re=r.jh.getData(ee);re&&re.subscribeToState(J=>{if(J.data?.state===I.Gu.Loading||J.data?.state===I.Gu.Error)return;const ne=r.jh.getAncestor(ee,w);if(!J.data?.series.length){ne.updateMetricPanel(Y,!0,!0);return}let q=!1;for(const te of J.data.series){for(const oe of te.fields)if(oe.type===x.PU.number&&(q=oe.values.some(ue=>ue!=null&&!isNaN(ue)&&ue!==0),q))break;if(q)break}ne.updateMetricPanel(Y,!0,!q)})}}var O=e(51088);function P(Y,ee){return Y.sort((re,J)=>{const ne=U(re,ee),q=U(J,ee);return ne.halfLeven+ne.wholeLeven-(q.halfLeven+q.wholeLeven)})}const L=new Map;function U(Y,ee){let re=L.get(Y);re||(re=new Map,L.set(Y,re));let J=re.get(ee);if(!J){const ne=Y.split("_"),q=ne.slice(0,ne.length/2).join("_"),te=(0,O.A)(q,ee)||0,oe=(0,O.A)(Y,ee)||0;J={halfLeven:te,wholeLeven:oe},re.set(ee,J)}return J}var R=e(51080);const B="175px",H="64px";class w extends r.Bs{constructor(ee){super({$variables:ee.$variables??N(),body:ee.body??new r.gF({children:[],templateColumns:"repeat(auto-fill, minmax(450px, 1fr))",autoRows:B,isLazy:!0}),showPreviews:!0,...ee}),this.previewCache={},this.ignoreNextUpdate=!1,this._variableDependency=new r.Sh(this,{variableNames:[M.MN,M.EY],onReferencedVariableValueChanged:re=>{const{name:J}=re.state;J===M.EY?this.state.body.setState({children:[]}):J===M.MN&&(this.onMetricNamesChange(),this.updateMetrics(),this.buildLayout())}}),this.currentMetricNames=new Set,this.updateMetricPanel=(re,J,ne)=>{const q=this.previewCache[re];q&&(q.isEmpty=ne,q.loaded=J,this.previewCache[re]=q,this.buildLayout())},this.onSearchQueryChange=re=>{this.setState({searchQuery:re.currentTarget.value}),this.searchQueryChangedDebounced()},this.searchQueryChangedDebounced=(0,n.debounce)(()=>{this.updateMetrics(),this.buildLayout()},500),this.onPrefixFilterChange=re=>{this.setState({prefixFilter:re}),this.prefixFilterChangedDebounced()},this.prefixFilterChangedDebounced=(0,n.debounce)(()=>{this.applyMetricPrefixFilter(),this.updateMetrics(!1),this.buildLayout()},1e3),this.onTogglePreviews=()=>{this.setState({showPreviews:!this.state.showPreviews}),this.buildLayout()},this.addActivationHandler(this._onActivate.bind(this))}_onActivate(){this.state.body.state.children.length===0?this.buildLayout():this.ignoreNextUpdate=!0}sortedPreviewMetrics(){return Object.values(this.previewCache).sort((ee,re)=>ee.isEmpty&&re.isEmpty?ee.index-re.index:ee.isEmpty?1:re.isEmpty?-1:ee.index-re.index)}onMetricNamesChange(){const ee=r.jh.lookupVariable(M.MN,this);if(!(ee instanceof r.fS)||ee.state.loading)return;const re=ee.state.options.map(ne=>ne.value.toString()),J=new Set(re);Object.values(this.previewCache).forEach(ne=>{J.has(ne.name)||(ne.isEmpty=!0)}),this.currentMetricNames=J,this.buildLayout()}applyMetricSearch(){const ee=Array.from(this.currentMetricNames);if(ee==null)return;const re=j(this.state.searchQuery);if(!re)this.setState({metricsAfterSearch:ee});else{const J=ee.filter(ne=>!re||re.test(ne));this.setState({metricsAfterSearch:J})}}applyMetricPrefixFilter(){const{metricsAfterSearch:ee,prefixFilter:re}=this.state;if(!re||!ee)this.setState({metricsAfterFilter:ee});else{const J=ee.filter(ne=>ne.startsWith(re));this.setState({metricsAfterFilter:J})}}updateMetrics(ee=!0){ee&&(this.applyMetricSearch(),this.applyMetricPrefixFilter());const{metricsAfterFilter:re}=this.state;if(!re)return;const J=re,ne=(0,R.kj)(this),q=ne.state.metric!==void 0?P(J,ne.state.metric):J,te={},oe=120;Object.keys(this.previewCache).forEach(ue=>{this.currentMetricNames.has(ue)||delete this.previewCache[ue]});for(let ue=0;ue<q.length;ue++){const ie=q[ue];if(Object.keys(te).length>oe)break;const he=this.previewCache[ie]||{name:ie,index:ue,loaded:!1};te[ie]=he}try{const ue=r.jh.getAncestor(this,y.R).state.metric;delete te[ue]}catch{}this.previewCache=te}buildLayout(){if(this.ignoreNextUpdate){this.ignoreNextUpdate=!1;return}const ee=r.jh.lookupVariable(M.MN,this);if(!(ee instanceof r.fS)||ee.state.loading)return;Object.keys(this.previewCache).length||this.updateMetrics();const re=[],J=this.sortedPreviewMetrics();//!this.justChangedTimeRange ? this.sortedPreviewMetrics() : Object.values(this.previewCache); for(let q=0;q<J.length;q++){const te=J[q];if(this.state.showPreviews){if(te.itemRef&&te.isPanel){re.push(te.itemRef.resolve());continue}const oe=V(te.name,q);te.itemRef=oe.getRef(),te.isPanel=!0,re.push(oe)}else{const oe=new r.xK({$variables:new r.Pj({variables:(0,M.ym)(te.name)}),body:G(te.name)});te.itemRef=oe.getRef(),te.isPanel=!1,re.push(oe)}}const ne=this.state.showPreviews?B:H;this.state.body.setState({children:re,autoRows:ne})}}w.Component=({model:Y})=>{const{searchQuery:ee,showPreviews:re,body:J,metricsAfterSearch:ne,metricsAfterFilter:q,prefixFilter:te}=Y.useState(),{children:oe}=J.useState(),ue=(0,u.of)(_),ie=k(M.MN,Y),ge=oe.length===0&&(ee||te),he=!ie.isLoading&&Y.currentMetricNames.size===0,De=ie.isLoading&&oe.length===0&&o.createElement(c._,{className:ue.statusMessage,text:"Loading..."})||he&&"There are no results found. Try a different time range or a different data source."||ge&&"There are no results found. Try adjusting your search or filters.",pe=De&&o.createElement("div",{className:ue.statusMessage},De),le=te&&ne!=null&&!q?.length?"The current prefix filter is not available with the current search terms.":void 0,Te=ie.error||ie.isLoading;return o.createElement("div",{className:ue.container},o.createElement("div",{className:ue.header},o.createElement(i.D,{label:"Search metrics",className:ue.searchField},o.createElement(l.p,{placeholder:"Search metrics",prefix:o.createElement(f.I,{name:"search"}),value:ee,onChange:Y.onSearchQueryChange,disabled:Te})),o.createElement(d.K,{showLabel:!0,label:"Show previews",value:re,onChange:Y.onTogglePreviews,disabled:Te})),o.createElement("div",{className:ue.header},o.createElement(i.D,{label:"Filter by prefix",error:le,invalid:!!le},o.createElement(b,{metricNames:ne||[],onSelect:Y.onPrefixFilterChange,disabled:Te,initialValue:te}))),ie.error&&o.createElement(h.F,{title:"Unable to retrieve metric names",severity:"error"},o.createElement("div",null,"We are unable to connect to your data source. Double check your data source URL and credentials."),o.createElement("div",null,"(",ie.error,")")),pe,o.createElement(Y.state.body.Component,{model:Y.state.body}))};function N(){return new r.Pj({variables:[new r.fS({name:M.MN,datasource:M.GH,hide:g.zL.hideVariable,includeAll:!0,defaultToAll:!0,skipUrlSync:!0,refresh:s.CO.onTimeRangeChanged,query:{query:`label_values(${M.ui},__name__)`,refId:"A"}})]})}function V(Y,ee){const re=(0,p.v)(Y),J=re.preview.vizBuilder().setColor({mode:"fixed",fixedColor:(0,R.Vy)(ee)}).setHeaderActions(new T({metric:Y,title:"Select"})).build();return new r.xK({$variables:new r.Pj({variables:(0,M.ym)(Y)}),$behaviors:[S(Y)],$data:new r.dt({datasource:M.GH,maxDataPoints:200,queries:re.preview.queries}),body:J})}function G(Y){return r.d0.text().setTitle(Y).setHeaderActions(new T({metric:Y,title:"Select"})).setOption("content","").build()}function _(Y){return{container:(0,t.css)({display:"flex",flexDirection:"column",flexGrow:1}),headingWrapper:(0,t.css)({marginBottom:Y.spacing(.5)}),header:(0,t.css)({flexGrow:0,display:"flex",gap:Y.spacing(2),marginBottom:Y.spacing(1),alignItems:"flex-end"}),statusMessage:(0,t.css)({fontStyle:"italic",marginTop:Y.spacing(7),textAlign:"center"}),searchField:(0,t.css)({flexGrow:1,marginBottom:0})}}const K=/[^a-z0-9_:]+/;function j(Y){if(!Y)return null;const ee=Y?.toLowerCase().split(K).filter(J=>J.length>0).map(J=>`(?=(.*${J}.*))`);if(ee.length===0)return null;const re=ee.join("");return new RegExp(re,"igy")}function k(Y,ee){const re=r.jh.lookupVariable(M.MN,ee),J=(0,o.useCallback)(()=>{if(re)return re.useState()},[re]),{error:ne,loading:q}=J()||{};return{isLoading:!!q,error:ne}}},90623:(Q,A,e)=>{"use strict";e.d(A,{p:()=>s});var t=e(96540),n=e(67061),o=e(94753);const s=()=>t.createElement(n.B,{direction:"column",gap:1},t.createElement(o.E,{variant:"h1"},"Metrics"),t.createElement(o.E,{color:"secondary"},"Explore your Prometheus-compatible metrics without writing a query"))},4222:(Q,A,e)=>{"use strict";e.d(A,{_:()=>i});var t=e(2543),n=e.n(t),o=e(79065),s=e(18919),r=e(4200);const g=20;class u{constructor(){this._recent=[],this._bookmarks=[],this.load(),this._save=(0,t.debounce)(()=>{const d=this._recent.slice(0,g).map(p=>this._serializeTrail(p.resolve()));localStorage.setItem(r.sQ,JSON.stringify(d));const h=this._bookmarks.map(p=>this._serializeTrail(p.resolve()));localStorage.setItem(r.me,JSON.stringify(h))},1e3)}_loadFromStorage(d){const h=[],p=localStorage.getItem(d);if(p){const m=JSON.parse(p);for(const a of m){const v=this._deserializeTrail(a);h.push(v.getRef())}}return h}_deserializeTrail(d){const h=new s.b({createdAt:d.createdAt});d.history.map(m=>{this._loadFromUrl(h,m.urlValues);const a=m.parentIndex??h.state.history.state.steps.length-1;h.state.history.setState({currentStep:a}),h.state.history.addTrailStep(h,m.type)});const p=d.currentStep??h.state.history.state.steps.length-1;return h.state.history.setState({currentStep:p}),h}_serializeTrail(d){return{history:d.state.history.state.steps.map(p=>{const m=new s.b(o.Go.cloneSceneObjectState(p.trailState));return{urlValues:(0,o.Is)().getUrlState(m),type:p.type,description:p.description,parentIndex:p.parentIndex}}),currentStep:d.state.history.state.currentStep,createdAt:d.state.createdAt}}_loadFromUrl(d,h){d.urlSync?.updateFromUrl(h),d.forEachChild(p=>this._loadFromUrl(p,h))}get recent(){return this._recent}load(){this._recent=this._loadFromStorage(r.sQ),this._bookmarks=this._loadFromStorage(r.me)}setRecentTrail(d){this._recent=this._recent.filter(p=>p!==d.getRef());const h=l(this._serializeTrail(d))||{};this._recent=this._recent.filter(p=>{const m=l(this._serializeTrail(p.resolve()));return!(0,t.isEqual)(h,m)}),this._recent.unshift(d.getRef()),this._save()}get bookmarks(){return this._bookmarks}addBookmark(d){this._bookmarks.unshift(d.getRef()),this._save()}removeBookmark(d){d<this._bookmarks.length&&(this._bookmarks.splice(d,1),this._save())}}let c;function i(){return c||(c=new u),c}function l({history:f,currentStep:d}){return f[d]?.urlValues||f.at(-1)?.urlValues}},4200:(Q,A,e)=>{"use strict";e.d(A,{Ao:()=>g,EY:()=>d,GH:()=>E,MN:()=>r,OO:()=>y,PK:()=>M,Rp:()=>i,aZ:()=>f,gR:()=>h,km:()=>s,me:()=>b,sQ:()=>D,td:()=>a,ui:()=>u,ym:()=>C,yr:()=>l});var t=e(65463),n=e(79065),o=e(79422);const s="/explore/metrics/trail",r="metricNames",g="filters",u="{${filters}}",c="metric",i="${metric}",l="groupby",f="${groupby}",d="ds",h="${ds}",p="logsDs",m="${logsDs}",a="$__logs__",v="sqr-metric-viz-query",E={uid:h},D="grafana.trails.recent",b="grafana.trails.bookmarks";function C(T){return[new n.x0({name:c,value:T,hide:o.zL.hideVariable})]}class y extends t.x{}y.type="metric-selected-event";class M extends t.a{}M.type="open-embedded-trail-event"},51080:(Q,A,e)=>{"use strict";e.d(A,{KE:()=>f,U4:()=>a,Vy:()=>b,aM:()=>m,aO:()=>E,ef:()=>d,hR:()=>D,iG:()=>C,kj:()=>l,nH:()=>v,xi:()=>h});var t=e(76885),n=e(19347),o=e(32264),s=e(79065),r=e(31193),g=e(18919),u=e(24440),c=e(4222),i=e(4200);function l(y){return s.jh.getAncestor(y,g.b)}function f(y){return s.jh.getAncestor(y,g.b).state.settings}function d(y){return new g.b({initialDS:y,$timeRange:new s.JZ({from:"now-1h",to:"now"}),embedded:!1})}function h(y){const M=(0,s.Is)().getUrlState(y);return p(M)}function p(y){return t.kM.renderUrl(i.km,y)}function m(y){if(y instanceof u.R)return y;if(y.parent)return m(y.parent);throw console.error("Unable to find graph view for",y),new Error("Unable to find trail")}function a(y){return s.jh.interpolate(y,i.gR)}function v(y){return(0,n.l)().getInstanceSettings(y)?.name||y}function E(y){return y?y===i.td?"Logs":y:"Select metric"}function D(){const y=(0,c._)().recent[0];if(y){const T=s.jh.interpolate(y.resolve(),i.gR);if(typeof T=="string"&&T.length>0)return T}const M=(0,r.tR)().getList({type:"prometheus"});if(M.length>0)return M.find(T=>T.uid===o.$.defaultDatasource)?.uid??M[0].uid}function b(y){const M=o.$.theme2.visualization;return M.getColorByName(M.palette[y%8])}function C(y){const M=Object.keys(y);return M.includes("from")&&M.includes("to")}},27825:(Q,A,e)=>{"use strict";e.d(A,{J:()=>m});var t=e(52622),n=e(38248),o=e(96540),s=e(91890),r=e(72574),g=e(32264),u=e(66864),c=e(94354),i=e(10354),l=e(88841),f=e(94397);const d=[{label:"Size",value:t.J1.Size,description:"Split the buckets based on size"},{label:"Count",value:t.J1.Count,description:"Split the buckets based on count"}],h=[{label:"Split",value:t.J1.Size,description:"Split the buckets based on size"}],p=({value:a,onChange:v,item:E})=>{const[D,b]=(0,o.useState)(!1),C=T=>{b(!(0,f.N_)(T)),v({...a,value:T})},M=(0,r.w)().getVariables().map(T=>({value:T.name,label:T.label||T.name,origin:s.$0.Template}));return o.createElement(u.Gy,null,o.createElement(c.z,{value:a?.mode||t.J1.Size,options:a?.scale?.type===t.L4.Log?h:d,onChange:T=>{v({...a,mode:T})}}),g.$.featureToggles.transformationsVariableSupport?o.createElement(l.y,{invalid:D,error:"Value needs to be an integer or a variable",value:a?.value??"",placeholder:"Auto",onChange:C,suggestions:M}):o.createElement(i.p,{value:a?.value??"",placeholder:"Auto",onChange:T=>{v({...a,value:T.currentTarget.value})}}))};function m(a,v,E,D){v.addCustomEditor({id:"xBuckets",path:`${a}xBuckets`,name:"X Bucket",editor:p,category:D,defaultValue:{mode:t.J1.Size}}),v.addCustomEditor({id:"yBuckets",path:`${a}yBuckets`,name:"Y Bucket",editor:p,category:D,defaultValue:{mode:t.J1.Size}}),v.addCustomEditor({id:"yBuckets-scale",path:`${a}yBuckets.scale`,name:"Y Bucket scale",category:D,editor:n.W,defaultValue:{type:t.L4.Linear}})}},3290:(Q,A,e)=>{"use strict";e.d(A,{VQ:()=>G,wY:()=>U,Nb:()=>w,eE:()=>H,yJ:()=>N});var t=e(81160),n=e(18282),o=e(81010),s=e(11261),r=e(28240),g=e(83195),u=e(41260),c=e(70416),i=e(77678),l=e(73060),f=e(32264),d=e(52622),h=e(97706);const{abs:p,pow:m}=Math,a=new Map;function v(k,Y,ee,re){let J=[],ne=re.map(h.E);for(let q=Y;q<ee;q++){let te=p(q),oe=(0,h.h)(m(k,q),te);for(let ue=0;ue<re.length;ue++){let ie=re[ue]*oe,ge=(ie>=0&&q>=0?0:te)+(q>=ne[ue]?0:ne[ue]),he=(0,h.h)(ie,ge);J.push(he),a.set(he,ge)}}return J}const E=k=>k%1===0,D=[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],b=v(10,-16,0,D),C=v(10,0,16,D),y=C.filter(E),M=b.concat(C),T=b.concat(y),I=1*1e3,x=60*I,S=60*x,O=24*S,P=365*O,L=[1,2,4,5,10,20,25,40,50,100,200,250,400,500,I,2*I,4*I,5*I,10*I,15*I,20*I,30*I,x,2*x,4*x,5*x,10*x,15*x,20*x,30*x,S,2*S,4*S,6*S,8*S,12*S,18*S,O,2*O,3*O,4*O,5*O,6*O,7*O,10*O,15*O,30*O,45*O,60*O,90*O,180*O,P,2*P,3*P,4*P,5*P,6*P,7*P,8*P,9*P,10*P],U={id:n.F.heatmap,name:"Create heatmap",description:"Generate heatmap data from source data.",defaultOptions:{},isApplicable:k=>{const{xField:Y,yField:ee,xs:re,ys:J}=_(k);return Y||ee||!re.length||!J.length?o.M.NotPossible:o.M.Applicable},isApplicableDescription:"The Heatmap transformation requires fields with Heatmap compatible data. No fields with Heatmap data could be found.",operator:(k,Y)=>ee=>ee.pipe((0,t.T)(re=>{if(f.$.featureToggles.transformationsVariableSupport){const J={...k,xBuckets:{...k.xBuckets},yBuckets:{...k.yBuckets}};return J.xBuckets?.value&&(J.xBuckets.value=Y.interpolate(J.xBuckets.value)),J.yBuckets?.value&&(J.yBuckets.value=Y.interpolate(J.yBuckets.value)),U.transformer(J,Y)(re)}else return U.transformer(k,Y)(re)})),transformer:k=>Y=>{const ee=G(Y,k);return k.keepOriginalData?[ee,...Y]:[ee]}};function R(k){return k==="+Inf"?1/0:k==="-Inf"?-1/0:+(k??0)}function B(k,Y){return R(k)-R(Y)}function H(k){return k?.meta?.custom??{}}function w(k){let Y=!1;for(let ee of k.fields)switch(ee.name){case"y":case"yMin":case"yMax":if(Y)return!1;Y=!0}return Y}function N(k){const Y=k.frame.fields[0],ee=Y.values,re=k.frame.fields.filter((De,pe)=>De.type===s.PU.number&&pe>0),J=ee.length*re.length,ne=new Array(J),q=new Array(J),te=new Array(J),oe=re.map(De=>De.values.slice());oe.forEach((De,pe)=>{for(let le=0;le<De.length;le++)te[oe.length*le+pe]=De[le]});const ue=Array.from({length:re.length},(De,pe)=>pe);for(let De=0,pe=0,le=0;De<J;pe=++De%ue.length)q[De]=ue[pe],pe===0&&De>=ue.length&&le++,ne[De]=ee[le];let ie=re[0].labels?.le!=null?"yMax":"y";switch(k.layout){case d.D7.le:ie="yMax";break;case d.D7.ge:ie="yMin";break;case d.D7.unknown:ie="y";break}const ge={yOrdinalDisplay:re.map(De=>(0,r.Ct)(De,k.frame)),yMatchWithLabel:Object.keys(re[0].labels??{})[0]};if(ge.yMatchWithLabel&&(ge.yOrdinalLabel=re.map(De=>De.labels?.[ge.yMatchWithLabel]??""),ge.yMatchWithLabel==="le"&&(ge.yMinDisplay="0.0")),k.unit?.length||k.decimals!=null){const De=(0,g.j_)(k.unit??"short");ge.yMinDisplay&&(ge.yMinDisplay=(0,g.cN)(De(0,k.decimals))),ge.yOrdinalDisplay=ge.yOrdinalDisplay.map(pe=>{let le=+pe;return Number.isNaN(le)?pe:(0,g.cN)(De(le,k.decimals))})}const he={...re[0].config};return he.displayNameFromDS&&delete he.displayNameFromDS,{length:ne.length,refId:k.frame.refId,meta:{type:u.m.HeatmapCells,custom:ge},fields:[{name:Y.type===s.PU.time?"xMax":"x",type:Y.type,values:ne,config:Y.config},{name:ie,type:s.PU.number,values:q,config:{unit:"short"}},{name:k.value?.length?k.value:"Value",type:s.PU.number,values:te,config:he,display:re[0].display}]}}function V(k){k=k.slice(),k.sort((ee,re)=>B(ee.name,re.name));const Y=k.map(ee=>ee.fields[1].values.slice());return Y.reverse(),Y.forEach((ee,re)=>{if(re<Y.length-1)for(let J=0;J<ee.length;J++)ee[J]-=Y[re+1][J]}),Y.reverse(),k.map((ee,re)=>({...ee,fields:[ee.fields[0],{...ee.fields[1],values:Y[re]}]}))}function G(k,Y){const{xField:ee,yField:re,xs:J,ys:ne}=_(k);if(!ee||!re)throw"no heatmap fields found";if(!J.length||!ne.length)throw"no values found";const q=Y.xBuckets??{},te=Y.yBuckets??{};if(q.scale?.type===d.L4.Log)throw"X axis only supports linear buckets";const oe=Y.yBuckets?.scale??{type:d.L4.Linear},ue=K(J,ne,{xSorted:(0,l.g2)(J),xTime:ee.type===s.PU.time,xMode:q.mode,xSize:q.mode===d.J1.Size?(0,c.WT)((0,c.E9)(q.value??"")):q.value?+q.value:void 0,yMode:te.mode,ySize:te.value?+te.value:void 0,yLog:oe?.type===d.L4.Log?oe?.log:void 0});return{length:ue.x.length,name:(0,r.Ct)(re),meta:{type:u.m.HeatmapCells},fields:[{name:"xMin",type:ee.type,values:ue.x,config:ee.config},{name:"yMin",type:s.PU.number,values:ue.y,config:{...re.config,custom:{scaleDistribution:oe}}},{name:"Count",type:s.PU.number,values:ue.count,config:{unit:"short"}}]}}function _(k){let Y,ee,re=0;for(let te of k)te.fields.find(ue=>ue.type===s.PU.time)&&(re+=te.length);let J=Array(re),ne=Array(re),q=0;for(let te of k){const oe=te.fields.find(ie=>ie.type===s.PU.time);if(!oe)continue;Y||(Y=oe);const ue=oe.values;for(let ie of te.fields)if(ie!==oe&&ie.type===s.PU.number){const ge=ie.values;for(let he=0;he<ue.length;he++,q++)J[q]=ue[he],ne[q]=ge[he];ee||(ee=ie)}}return{xField:Y,yField:ee,xs:J,ys:ne}}function K(k,Y,ee){let re=k.length,J=ee?.xSorted??!1,ne=ee?.ySorted??!1,q=J?k[0]:1/0,te=ne?Y[0]:1/0,oe=J?k[re-1]:-1/0,ue=ne?Y[re-1]:-1/0,ie=ee?.yLog;for(let at=0;at<re;at++)J||(q=Math.min(q,k[at]),oe=Math.max(oe,k[at])),ne||(!ie||Y[at]>0)&&(te=Math.min(te,Y[at]),ue=Math.max(ue,Y[at]));let ge=ee?.xSize??0,he=ee?.ySize??0,De=ee?.xMode,pe=ee?.yMode;if((!Number.isFinite(ge)||ge<=0)&&(De=d.J1.Count,ge=20),(!Number.isFinite(he)||he<=0)&&(pe=d.J1.Count,he=10),De===d.J1.Count){let at=(oe-q)/Math.max(ge-1,1),st=ee?.xTime?L:T,Ke=st.findIndex(Xe=>Xe>at)-1;ge=st[Math.max(Ke,0)]}if(pe===d.J1.Count){let at=(ue-te)/Math.max(he-1,1),st=ee?.yTime?L:T,Ke=st.findIndex(Xe=>Xe>at)-1;he=st[Math.max(Ke,0)]}let le=ee?.xCeil?at=>(0,i.Uh)(at,ge):at=>(0,i.rs)(at,ge),Te=ee?.yCeil?at=>(0,i.Uh)(at,he):at=>(0,i.rs)(at,he);if(ie){he=1/(ee?.ySize??1);let at=ie===2?Math.log2:Math.log10;Te=ee?.yCeil?st=>(0,i.Uh)(at(st),he):st=>(0,i.rs)(at(st),he)}let Ee=le(q),Re=le(oe),me=Te(te),Me=Te(ue),ye=Math.round((Re-Ee)/ge)+1,Le=Math.round((Me-me)/he)+1,[We,Be,Ye]=j(ye,Le,Ee,ge,me,he,ie);for(let at=0;at<re;at++){if(ie&&Y[at]<=0)continue;const st=(le(k[at])-Ee)/ge,Ke=(Te(Y[at])-me)/he,Xe=st*Le+Ke;Ye[Xe]++}return{x:We,y:Be,count:Ye}}function j(k,Y,ee,re,J,ne,q){const te=k*Y,oe=new Array(te),ue=new Array(te),ie=new Array(te);for(let ge=0,he=0,De=ee;ge<te;he=++ge%Y)ie[ge]=0,q?ue[ge]=q**(J+he*ne):ue[ge]=J+he*ne,he===0&&ge>=Y&&(De+=re),oe[ge]=De;return[oe,ue,ie]}},91847:(Q,A,e)=>{"use strict";e.d(A,{$n:()=>o,g_:()=>t,uk:()=>n});var t=(r=>(r.ShortcodeFigure="shortcodeFigure",r.UIImage="uiImage",r))(t||{});const n={calculateField:{name:"Add field from calculation",getHelperDocs:function(r="shortcodeFigure"){return` Use this transformation to add a new field calculated from two other fields. Each transformation allows you to add one new field. - **Mode** - Select a mode: - **Reduce row** - Apply selected calculation on each row of selected fields independently. - **Binary operation** - Apply basic binary operations (for example, sum or multiply) on values in a single row from two selected fields. - **Unary operation** - Apply basic unary operations on values in a single row from a selected field. The available operations are: - **Absolute value (abs)** - Returns the absolute value of a given expression. It represents its distance from zero as a positive number. - **Natural exponential (exp)** - Returns _e_ raised to the power of a given expression. - **Natural logarithm (ln)** - Returns the natural logarithm of a given expression. - **Floor (floor)** - Returns the largest integer less than or equal to a given expression. - **Ceiling (ceil)** - Returns the smallest integer greater than or equal to a given expression. - **Cumulative functions** - Apply functions on the current row and all preceding rows. - **Total** - Calculates the cumulative total up to and including the current row. - **Mean** - Calculates the mean up to and including the current row. - **Window functions** - Apply window functions. The window can either be **trailing** or **centered**. With a trailing window the current row will be the last row in the window. With a centered window the window will be centered on the current row. For even window sizes, the window will be centered between the current row, and the previous row. - **Mean** - Calculates the moving mean or running average. - **Stddev** - Calculates the moving standard deviation. - **Variance** - Calculates the moving variance. - **Row index** - Insert a field with the row index. - **Field name** - Select the names of fields you want to use in the calculation for the new field. - **Calculation** - If you select **Reduce row** mode, then the **Calculation** field appears. Click in the field to see a list of calculation choices you can use to create the new field. For information about available calculations, refer to [Calculation types][]. - **Operation** - If you select **Binary operation** or **Unary operation** mode, then the **Operation** fields appear. These fields allow you to apply basic math operations on values in a single row from selected fields. You can also use numerical values for binary operations. - **As percentile** - If you select **Row index** mode, then the **As percentile** switch appears. This switch allows you to transform the row index as a percentage of the total number of rows. - **Alias** - (Optional) Enter the name of your new field. If you leave this blank, then the field will be named to match the calculation. - **Replace all fields** - (Optional) Select this option if you want to hide all other fields and display only your calculated field in the visualization. > **Note:** **Cumulative functions** and **Window functions** modes are currently in public preview. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available. Enable the \`addFieldFromCalculationStatFunctions\` feature toggle in Grafana to use this feature. Contact Grafana Support to enable this feature in Grafana Cloud. In the example below, we added two fields together and named them Sum. ${s("/static/img/docs/transformations/add-field-from-calc-stat-example-7-0.png",r,"A stat visualization including one field called Sum")} `},links:[{title:"Calculation types",url:"https://grafana.com/docs/grafana/latest/panels-visualizations/calculation-types/"}]},concatenate:{name:"Concatenate fields",getHelperDocs:function(){return` Use this transformation to combine all fields from all frames into one result. For example, if you have separate queries retrieving temperature and uptime data (Query A) and air quality index and error information (Query B), applying the concatenate transformation yields a consolidated data frame with all relevant information in one view. Consider the following: **Query A:** | Temp | Uptime | | ----- | --------- | | 15.4 | 1230233 | **Query B:** | AQI | Errors | | ----- | ------ | | 3.2 | 5 | After you concatenate the fields, the data frame would be: | Temp | Uptime | AQI | Errors | | ----- | -------- | ----- | ------ | | 15.4 | 1230233 | 3.2 | 5 | This transformation simplifies the process of merging data from different sources, providing a comprehensive view for analysis and visualization. `}},configFromData:{name:"Config from query results",getHelperDocs:function(){return` Use this transformation to select a query and extract standard options, such as **Min**, **Max**, **Unit**, and **Thresholds**, and apply them to other query results. This feature enables dynamic visualization configuration based on the data returned by a specific query. #### Options - **Config query** - Select the query that returns the data you want to use as configuration. - **Apply to** - Select the fields or series to which the configuration should be applied. - **Apply to options** - Specify a field type or use a field name regex, depending on your selection in **Apply to**. #### Field mapping table Below the configuration options, you'll find the field mapping table. This table lists all fields found in the data returned by the config query, along with **Use as** and **Select** options. It provides control over mapping fields to config properties, and for multiple rows, it allows you to choose which value to select. #### 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 has a maximum configuration option set. Options such as **Min**, **Max**, **Unit**, and **Thresholds** are part of the field configuration. If set, they are used by the visualization instead of any options manually configured in the panel editor options pane. #### Value mappings You can also transform a query result into value mappings. With this option, every row in the configuration query result defines a single value mapping row. See the following example. 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 builds value mappings from your query result and applies them to the real data query results. You should see values being mapped and colored according to the config query results. `}},convertFieldType:{name:"Convert field type",getHelperDocs:function(){return` Use this transformation to modify the field type of a specified field. This transformation has the following options: - **Field** - Select from available fields - **as** - Select the FieldType to convert to - **Numeric** - attempts to make the values numbers - **String** - will make the values strings - **Time** - attempts to parse the values as time - The input will be parsed according to the [Moment.js parsing format](https://momentjs.com/docs/#/parsing/) - It will parse the numeric input as a Unix epoch timestamp in milliseconds. You must multiply your input by 1000 if it's in seconds. - Will show an option to specify a DateFormat as input by a string like yyyy-mm-dd or DD MM YYYY hh:mm:ss - **Boolean** - will make the values booleans - **Enum** - will make the values enums - Will show a table to manage the enums - **Other** - attempts to parse the values as JSON For example, consider the following query that could be modified by selecting the time field as Time and specifying Date Format as YYYY. #### Sample Query | Time | Mark | Value | |------------|-----------|-------| | 2017-07-01 | above | 25 | | 2018-08-02 | below | 22 | | 2019-09-02 | below | 29 | | 2020-10-04 | above | 22 | The result: #### Transformed Query | Time | Mark | Value | |---------------------|-----------|-------| | 2017-01-01 00:00:00 | above | 25 | | 2018-01-01 00:00:00 | below | 22 | | 2019-01-01 00:00:00 | below | 29 | | 2020-01-01 00:00:00 | above | 22 | This transformation allows you to flexibly adapt your data types, ensuring compatibility and consistency in your visualizations. `}},extractFields:{name:"Extract fields",getHelperDocs:function(){return` Use this transformation to select a source of data and extract content from it in different formats. This transformation has the following fields: - **Source** - Select the field for the source of data. - **Format** - Choose one of the following: - **JSON** - Parse JSON content from the source. - **Key+value pairs** - Parse content in the format 'a=b' or 'c:d' from the source. - **Auto** - Discover fields automatically. - **Replace All Fields** - (Optional) Select this option to hide all other fields and display only your calculated field in the visualization. - **Keep Time** - (Optional) Available only if **Replace All Fields** is true. Keeps the time field in the output. Consider the following dataset: #### Dataset Example | Timestamp | json_data | |-------------------|-----------| | 1636678740000000000 | {"value": 1} | | 1636678680000000000 | {"value": 5} | | 1636678620000000000 | {"value": 12} | You could prepare the data to be used by a [Time series panel][] with this configuration: - Source: json_data - Format: JSON - Field: value - Alias: my_value - Replace all fields: true - Keep time: true This will generate the following output: #### Transformed Data | Timestamp | my_value | |-------------------|----------| | 1636678740000000000 | 1 | | 1636678680000000000 | 5 | | 1636678620000000000 | 12 | This transformation allows you to extract and format data in various ways. You can customize the extraction format based on your specific data needs. `},links:[{title:"Time series panel",url:"https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/time-series/"}]},fieldLookup:{name:"Lookup fields from resource",getHelperDocs:function(){return` Use this transformation to enrich a field value by looking up additional fields from an external source. This transformation has the following fields: - **Field** - Select a text field from your dataset. - **Lookup** - Choose from **Countries**, **USA States**, and **Airports**. This transformation currently supports spatial data. For example, if you have this data: #### Dataset Example | Location | Values | |-----------|--------| | AL | 0 | | AK | 10 | | Arizona | 5 | | Arkansas | 1 | | Somewhere | 5 | With this configuration: - Field: location - Lookup: USA States You'll get the following output: #### Transformed Data | Location | ID | Name | Lng | Lat | Values | |-----------|----|-----------|------------|------------|--------| | AL | AL | Alabama | -80.891064 | 12.448457 | 0 | | AK | AK | Arkansas | -100.891064| 24.448457 | 10 | | Arizona | | | | | 5 | | Arkansas | | | | | 1 | | Somewhere | | | | | 5 | This transformation lets you augment your data by fetching additional information from external sources, providing a more comprehensive dataset for analysis and visualization. `}},filterByRefId:{name:"Filter data by query refId",getHelperDocs:function(r="shortcodeFigure"){return` Use this transformation to hide one or more queries in panels that have multiple queries. Grafana displays the query identification letters in dark gray text. Click a query identifier to toggle filtering. If the query letter is white, then the results are displayed. If the query letter is dark, then the results are hidden. > **Note:** This transformation is not available for Graphite because this data source does not support correlating returned data with queries. In the example below, the panel has three queries (A, B, C). We removed the B query from the visualization. ${s("/static/img/docs/transformations/filter-by-query-stat-example-7-0.png",r,"A stat visualization with results from two queries, A and C")} `}},filterByValue:{name:"Filter data by values",getHelperDocs:function(){return` Use this transformation to selectively filter data points directly within your visualization. This transformation provides options to include or exclude data based on one or more conditions applied to a selected field. This transformation is very useful if your data source does not natively filter by values. You might also use this to narrow values to display if you are using a shared query. The available conditions for all fields are: - **Regex** - Match a regex expression. - **Is Null** - Match if the value is null. - **Is Not Null** - Match if the value is not null. - **Equal** - Match if the value is equal to the specified value. - **Different** - Match if the value is different than the specified value. The available conditions for number fields are: - **Greater** - Match if the value is greater than the specified value. - **Lower** - Match if the value is lower than the specified value. - **Greater or equal** - Match if the value is greater or equal. - **Lower or equal** - Match if the value is lower or equal. - **Range** - Match a range between a specified minimum and maximum, min and max included. Consider the following dataset: #### Dataset Example | Time | Temperature | Altitude | |---------------------|-------------|----------| | 2020-07-07 11:34:23 | 32 | 101 | | 2020-07-07 11:34:22 | 28 | 125 | | 2020-07-07 11:34:21 | 26 | 110 | | 2020-07-07 11:34:20 | 23 | 98 | | 2020-07-07 10:32:24 | 31 | 95 | | 2020-07-07 10:31:22 | 20 | 85 | | 2020-07-07 09:30:57 | 19 | 101 | If you **Include** the data points that have a temperature below 30\xB0C, the configuration will look as follows: - Filter Type: 'Include' - Condition: Rows where 'Temperature' matches 'Lower Than' '30' And you will get the following result, where only the temperatures below 30\xB0C are included: #### Transformed Data | Time | Temperature | Altitude | |---------------------|-------------|----------| | 2020-07-07 11:34:22 | 28 | 125 | | 2020-07-07 11:34:21 | 26 | 110 | | 2020-07-07 11:34:20 | 23 | 98 | | 2020-07-07 10:31:22 | 20 | 85 | | 2020-07-07 09:30:57 | 19 | 101 | You can add more than one condition to the filter. For example, you might want to include the data only if the altitude is greater than 100. To do so, add that condition to the following configuration: - Filter type: 'Include' rows that 'Match All' conditions - Condition 1: Rows where 'Temperature' matches 'Lower' than '30' - Condition 2: Rows where 'Altitude' matches 'Greater' than '100' When you have more than one condition, you can choose if you want the action (include/exclude) to be applied on rows that **Match all** conditions or **Match any** of the conditions you added. In the example above, we chose **Match all** because we wanted to include the rows that have a temperature lower than 30\xB0C *AND* an altitude higher than 100. If we wanted to include the rows that have a temperature lower than 30\xB0C *OR* an altitude higher than 100 instead, then we would select **Match any**. This would include the first row in the original data, which has a temperature of 32\xB0C (does not match the first condition) but an altitude of 101 (which matches the second condition), so it is included. Conditions that are invalid or incompletely configured are ignored. This versatile data filtering transformation lets you to selectively include or exclude data points based on specific conditions. Customize the criteria to tailor your data presentation to meet your unique analytical needs. `}},filterFieldsByName:{name:"Filter fields by name",getHelperDocs:function(r="shortcodeFigure"){return` Use this transformation to selectively remove parts of your query results. There are three ways to filter field names: - [Using a regular expression](#use-a-regular-expression) - [Manually selecting included fields](#manually-select-included-fields) - [Using a dashboard variable](#use-a-dashboard-variable) #### Use a regular expression When you filter using a regular expression, field names that match the regular expression are included. For example, from the input data: | Time | dev-eu-west | dev-eu-north | prod-eu-west | prod-eu-north | | ------------------- | ----------- | ------------ | ------------ | ------------- | | 2023-03-04 23:56:23 | 23.5 | 24.5 | 22.2 | 20.2 | | 2023-03-04 23:56:23 | 23.6 | 24.4 | 22.1 | 20.1 | The result from using the regular expression 'prod.*' would be: | Time | prod-eu-west | prod-eu-north | | ------------------- | ------------ | ------------- | | 2023-03-04 23:56:23 | 22.2 | 20.2 | | 2023-03-04 23:56:23 | 22.1 | 20.1 | The regular expression can include an interpolated dashboard variable by using the \${variableName} syntax. #### Manually select included fields Click and uncheck the field names to remove them from the result. Fields that are matched by the regular expression are still included, even if they're unchecked. #### Use a dashboard variable Enable 'From variable' to let you select a dashboard variable that's used to include fields. By setting up a [dashboard variable][] with multiple choices, the same fields can be displayed across multiple visualizations. ${s("/static/img/docs/transformations/filter-name-table-before-7-0.png",r,"A table visualization with time, value, Min, and Max columns")} Here's the table after we applied the transformation to remove the Min field. ${s("/static/img/docs/transformations/filter-name-table-after-7-0.png",r,"A table visualization with time, value, and Max columns")} Here is the same query using a Stat visualization. ${s("/static/img/docs/transformations/filter-name-stat-after-7-0.png",r,"A stat visualization with value and Max fields")} This transformation provides flexibility in tailoring your query results to focus on the specific fields you need for effective analysis and visualization. `}},formatString:{name:"Format string",getHelperDocs:function(){return` Use this transformation to customize the output of a string field. This transformation has the following fields: - **Upper case** - Formats the entire string in uppercase characters. - **Lower case** - Formats the entire string in lowercase characters. - **Sentence case** - Formats the first character of the string in uppercase. - **Title case** - Formats the first character of each word in the string in uppercase. - **Pascal case** - Formats the first character of each word in the string in uppercase and doesn't include spaces between words. - **Camel case** - Formats the first character of each word in the string in uppercase, except the first word, and doesn't include spaces between words. - **Snake case** - Formats all characters in the string in lowercase and uses underscores instead of spaces between words. - **Kebab case** - Formats all characters in the string in lowercase and uses dashes instead of spaces between words. - **Trim** - Removes all leading and trailing spaces from the string. - **Substring** - Returns a substring of the string, using the specified start and end positions. This transformation provides a convenient way to standardize and tailor the presentation of string data for better visualization and analysis. > **Note:** This transformation is currently in public preview. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available. Enable the \`formatString\` feature toggle in Grafana to use this feature. Contact Grafana Support to enable this feature in Grafana Cloud.`}},formatTime:{name:"Format time",getHelperDocs:function(){return` Use this transformation to customize the output of a time field. Output can be formatted using [Moment.js format strings](https://momentjs.com/docs/#/displaying/). For example, if you want to display only the year of a time field, the format string 'YYYY' can be used to show the calendar year (for example, 1999 or 2012). **Before Transformation:** | Timestamp | Event | | ------------------- | -------------- | | 1636678740000000000 | System Start | | 1636678680000000000 | User Login | | 1636678620000000000 | Data Updated | **After applying 'YYYY-MM-DD HH:mm:ss':** | Timestamp | Event | | ------------------- | -------------- | | 2021-11-12 14:25:40 | System Start | | 2021-11-12 14:24:40 | User Login | | 2021-11-12 14:23:40 | Data Updated | This transformation lets you tailor the time representation in your visualizations, providing flexibility and precision in displaying temporal data. > **Note:** This transformation is available in Grafana 10.1+ as an alpha feature. `}},groupBy:{name:"Group by",getHelperDocs:function(){return` Use this transformation to group the data by a specified field (column) value and process calculations on each group. Click to see a list of calculation choices. For information about available calculations, refer to [Calculation types][]. Here's an example of original data. | Time | Server ID | CPU Temperature | Server Status | | ------------------- | --------- | --------------- | ------------- | | 2020-07-07 11:34:20 | server 1 | 80 | Shutdown | | 2020-07-07 11:34:20 | server 3 | 62 | OK | | 2020-07-07 10:32:20 | server 2 | 90 | Overload | | 2020-07-07 10:31:22 | server 3 | 55 | OK | | 2020-07-07 09:30:57 | server 3 | 62 | Rebooting | | 2020-07-07 09:30:05 | server 2 | 88 | OK | | 2020-07-07 09:28:06 | server 1 | 80 | OK | | 2020-07-07 09:25:05 | server 2 | 88 | OK | | 2020-07-07 09:23:07 | server 1 | 86 | OK | This transformation goes in two steps. First you specify one or multiple fields to group the data by. This will group all the same values of those fields together, as if you sorted them. For instance if we group by the Server ID field, then it would group the data this way: | Time | Server ID | CPU Temperature | Server Status | | ------------------- | -------------- | --------------- | ------------- | | 2020-07-07 11:34:20 | **server 1** | 80 | Shutdown | | 2020-07-07 09:28:06 | **server 1** | 80 | OK | | 2020-07-07 09:23:07 | **server 1** | 86 | OK | | 2020-07-07 10:32:20 | server 2 | 90 | Overload | | 2020-07-07 09:30:05 | server 2 | 88 | OK | | 2020-07-07 09:25:05 | server 2 | 88 | OK | | 2020-07-07 11:34:20 | **_server 3_** | 62 | OK | | 2020-07-07 10:31:22 | **_server 3_** | 55 | OK | | 2020-07-07 09:30:57 | **_server 3_** | 62 | Rebooting | All rows with the same value of Server ID are grouped together. After choosing which field you want to group your data by, you can add various calculations on the other fields, and apply the calculation to each group of rows. For instance, we could want to calculate the average CPU temperature for each of those servers. So we can add the _mean_ calculation applied on the CPU Temperature field to get the following: | Server ID | CPU Temperature (mean) | | --------- | ---------------------- | | server 1 | 82 | | server 2 | 88.6 | | server 3 | 59.6 | And we can add more than one calculation. For instance: - For field Time, we can calculate the _Last_ value, to know when the last data point was received for each server - For field Server Status, we can calculate the _Last_ value to know what is the last state value for each server - For field Temperature, we can also calculate the _Last_ value to know what is the latest monitored temperature for each server We would then get: | Server ID | CPU Temperature (mean) | CPU Temperature (last) | Time (last) | Server Status (last) | | --------- | ---------------------- | ---------------------- | ------------------- | -------------------- | | server 1 | 82 | 80 | 2020-07-07 11:34:20 | Shutdown | | server 2 | 88.6 | 90 | 2020-07-07 10:32:20 | Overload | | server 3 | 59.6 | 62 | 2020-07-07 11:34:20 | OK | This transformation allows you to extract essential information from your time series and present it conveniently. `},links:[{title:"Calculation types",url:"https://grafana.com/docs/grafana/latest/panels-visualizations/calculation-types/"}]},groupingToMatrix:{name:"Grouping to matrix",getHelperDocs:function(){return` Use this transformation to combine three fields\u2014which are used as input for the **Column**, **Row**, and **Cell value** fields from the query output\u2014and generate a matrix. The matrix is calculated as follows: **Original data** | Server ID | CPU Temperature | Server Status | | --------- | --------------- | ------------- | | server 1 | 82 | OK | | server 2 | 88.6 | OK | | server 3 | 59.6 | Shutdown | We can generate a matrix using the values of 'Server Status' as column names, the 'Server ID' values as row names, and the 'CPU Temperature' as content of each cell. The content of each cell will appear for the existing column ('Server Status') and row combination ('Server ID'). For the rest of the cells, you can select which value to display between: **Null**, **True**, **False**, or **Empty**. **Output** | Server IDServer Status | OK | Shutdown | | ----------------------- | ---- | -------- | | server 1 | 82 | | | server 2 | 88.6 | | | server 3 | | 59.6 | Use this transformation to construct a matrix by specifying fields from your query results. The matrix output reflects the relationships between the unique values in these fields. This helps you present complex relationships in a clear and structured matrix format. `}},heatmap:{name:"Create heatmap",getHelperDocs:function(){return` Use this transformation to prepare histogram data for visualizing trends over time. Similar to the heatmap visualization, this transformation converts histogram metrics into temporal buckets. #### X Bucket This setting determines how the x-axis is split into buckets. - **Size** - Specify a time interval in the input field. For example, a time range of '1h' creates cells one hour wide on the x-axis. - **Count** - For non-time-related series, use this option to define the number of elements in a bucket. #### Y Bucket This setting determines how the y-axis is split into buckets. - **Linear** - **Logarithmic** - Choose between log base 2 or log base 10. - **Symlog** - Uses a symmetrical logarithmic scale. Choose between log base 2 or log base 10, allowing for negative values. Assume you have the following dataset: | Timestamp | Value | |-------------------- |-------| | 2023-01-01 12:00:00 | 5 | | 2023-01-01 12:15:00 | 10 | | 2023-01-01 12:30:00 | 15 | | 2023-01-01 12:45:00 | 8 | - With X Bucket set to 'Size: 15m' and Y Bucket as 'Linear', the histogram organizes values into time intervals of 15 minutes on the x-axis and linearly on the y-axis. - For X Bucket as 'Count: 2' and Y Bucket as 'Logarithmic (base 10)', the histogram groups values into buckets of two on the x-axis and use a logarithmic scale on the y-axis. `}},histogram:{name:"Histogram",getHelperDocs:function(){return` Use this transformation to generate a histogram based on input data, allowing you to visualize the distribution of values. - **Bucket size** - The range between the lowest and highest items in a bucket (xMin to xMax). - **Bucket offset** - The offset for non-zero-based buckets. - **Combine series** - Create a unified histogram using all available series. **Original data** Series 1: | A | B | C | | --- | --- | --- | | 1 | 3 | 5 | | 2 | 4 | 6 | | 3 | 5 | 7 | | 4 | 6 | 8 | | 5 | 7 | 9 | Series 2: | C | | --- | | 5 | | 6 | | 7 | | 8 | | 9 | **Output** | xMin | xMax | A | B | C | C | | ---- | ---- | --- | --- | --- | --- | | 1 | 2 | 1 | 0 | 0 | 0 | | 2 | 3 | 1 | 0 | 0 | 0 | | 3 | 4 | 1 | 1 | 0 | 0 | | 4 | 5 | 1 | 1 | 0 | 0 | | 5 | 6 | 1 | 1 | 1 | 1 | | 6 | 7 | 0 | 1 | 1 | 1 | | 7 | 8 | 0 | 1 | 1 | 1 | | 8 | 9 | 0 | 0 | 1 | 1 | | 9 | 10 | 0 | 0 | 1 | 1 | Visualize the distribution of values using the generated histogram, providing insights into the data's spread and density. `}},joinByField:{name:"Join by field",getHelperDocs:function(r="shortcodeFigure"){return` Use this transformation to merge multiple results into a single table, enabling the consolidation of data from different queries. This is especially useful for converting multiple time series results into a single wide table with a shared time field. #### Inner join An inner join merges data from multiple tables where all tables share the same value from the selected field. This type of join excludes data where values do not match in every result. Use this transformation to combine the results from multiple queries (combining on a passed join field or the first time column) into one result, and drop rows where a successful join cannot occur. In the following example, two queries return table data. It is visualized as two separate tables before applying the inner join transformation. **Query A:** | Time | Job | Uptime | | ------------------- | ------- | --------- | | 2020-07-07 11:34:20 | node | 25260122 | | 2020-07-07 11:24:20 | postgre | 123001233 | | 2020-07-07 11:14:20 | postgre | 345001233 | **Query B:** | Time | Server | Errors | | ------------------- | -------- | ------ | | 2020-07-07 11:34:20 | server 1 | 15 | | 2020-07-07 11:24:20 | server 2 | 5 | | 2020-07-07 11:04:20 | server 3 | 10 | The result after applying the inner join transformation looks like the following: | Time | Job | Uptime | Server | Errors | | ------------------- | ------- | --------- | -------- | ------ | | 2020-07-07 11:34:20 | node | 25260122 | server 1 | 15 | | 2020-07-07 11:24:20 | postgre | 123001233 | server 2 | 5 | #### Outer join An outer join includes all data from an inner join and rows where values do not match in every input. While the inner join joins Query A and Query B on the time field, the outer join includes all rows that don't match on the time field. In the following example, two queries return table data. It is visualized as two tables before applying the outer join transformation. **Query A:** | Time | Job | Uptime | | ------------------- | ------- | --------- | | 2020-07-07 11:34:20 | node | 25260122 | | 2020-07-07 11:24:20 | postgre | 123001233 | | 2020-07-07 11:14:20 | postgre | 345001233 | **Query B:** | Time | Server | Errors | | ------------------- | -------- | ------ | | 2020-07-07 11:34:20 | server 1 | 15 | | 2020-07-07 11:24:20 | server 2 | 5 | | 2020-07-07 11:04:20 | server 3 | 10 | The result after applying the outer join transformation looks like the following: | Time | Job | Uptime | Server | Errors | | ------------------- | ------- | --------- | -------- | ------ | | 2020-07-07 11:04:20 | | | server 3 | 10 | | 2020-07-07 11:14:20 | postgre | 345001233 | | | | 2020-07-07 11:34:20 | node | 25260122 | server 1 | 15 | | 2020-07-07 11:24:20 | postgre | 123001233 | server 2 | 5 | In the following example, a template query displays time series data from multiple servers in a table visualization. The results of only one query can be viewed at a time. ${s("/static/img/docs/transformations/join-fields-before-7-0.png",r,"A table visualization showing results for one server")} I applied a transformation to join the query results using the time field. Now I can run calculations, combine, and organize the results in this new table. ${s("/static/img/docs/transformations/join-fields-after-7-0.png",r,"A table visualization showing results for multiple servers")} Combine and analyze data from various queries with table joining for a comprehensive view of your information. `}},joinByLabels:{name:"Join by labels",getHelperDocs:function(){return` Use this transformation to join multiple results into a single table. This is especially useful for converting multiple time series results into a single wide table with a shared **Label** field. - **Join** - Select the label to join by between the labels available or common across all time series. - **Value** - The name for the output result. #### Example ##### Input series1{what="Temp", cluster="A", job="J1"} | Time | Value | | ---- | ----- | | 1 | 10 | | 2 | 200 | series2{what="Temp", cluster="B", job="J1"} | Time | Value | | ---- | ----- | | 1 | 10 | | 2 | 200 | series3{what="Speed", cluster="B", job="J1"} | Time | Value | | ---- | ----- | | 22 | 22 | | 28 | 77 | ##### Config value: "what" ##### Output | cluster | job | Temp | Speed | | ------- | --- | ---- | ----- | | A | J1 | 10 | | | A | J1 | 200 | | | B | J1 | 10 | 22 | | B | J1 | 200 | 77 | Combine and organize time series data effectively with this transformation for comprehensive insights. `}},labelsToFields:{name:"Labels to fields",getHelperDocs:function(){return` Use this transformation to convert time series results with labels or tags into a table, including each label's keys and values in the result. Display labels as either columns or row values for enhanced data visualization. Given a query result of two time series: - Series 1: labels Server=Server A, Datacenter=EU - Series 2: labels Server=Server B, Datacenter=EU In "Columns" mode, the result looks like this: | Time | Server | Datacenter | Value | | ------------------- | -------- | ---------- | ----- | | 2020-07-07 11:34:20 | Server A | EU | 1 | | 2020-07-07 11:34:20 | Server B | EU | 2 | In "Rows" mode, the result has a table for each series and show each label value like this: | label | value | | ---------- | -------- | | Server | Server A | | Datacenter | EU | | label | value | | ---------- | -------- | | Server | Server B | | Datacenter | EU | #### Value field name If you selected Server as the **Value field name**, then you would get one field for every value of the Server label. | Time | Datacenter | Server A | Server B | | ------------------- | ---------- | -------- | -------- | | 2020-07-07 11:34:20 | EU | 1 | 2 | #### Merging behavior The labels to fields transformer is internally two separate transformations. The first acts on single series and extracts labels to fields. The second is the [merge](#merge) transformation that joins all the results into a single table. The merge transformation tries to join on all matching fields. This merge step is required and cannot be turned off. To illustrate this, here is an example where you have two queries that return time series with no overlapping labels. - Series 1: labels Server=ServerA - Series 2: labels Datacenter=EU This will first result in these two tables: | Time | Server | Value | | ------------------- | ------- | ----- | | 2020-07-07 11:34:20 | ServerA | 10 | | Time | Datacenter | Value | | ------------------- | ---------- | ----- | | 2020-07-07 11:34:20 | EU | 20 | After merge: | Time | Server | Value | Datacenter | | ------------------- | ------- | ----- | ---------- | | 2020-07-07 11:34:20 | ServerA | 10 | | | 2020-07-07 11:34:20 | | 20 | EU | Convert your time series data into a structured table format for a clearer and more organized representation. `}},limit:{name:"Limit",getHelperDocs:function(){return` Use this transformation to restrict the number of rows displayed, providing a more focused view of your data. This is particularly useful when dealing with large datasets. Below is an example illustrating the impact of the **Limit** transformation on a response from a data source: | Time | Metric | Value | | ------------------- | ----------- | ----- | | 2020-07-07 11:34:20 | Temperature | 25 | | 2020-07-07 11:34:20 | Humidity | 22 | | 2020-07-07 10:32:20 | Humidity | 29 | | 2020-07-07 10:31:22 | Temperature | 22 | | 2020-07-07 09:30:57 | Humidity | 33 | | 2020-07-07 09:30:05 | Temperature | 19 | Here is the result after adding a Limit transformation with a value of '3': | Time | Metric | Value | | ------------------- | ----------- | ----- | | 2020-07-07 11:34:20 | Temperature | 25 | | 2020-07-07 11:34:20 | Humidity | 22 | | 2020-07-07 10:32:20 | Humidity | 29 | This transformation helps you tailor the visual presentation of your data to focus on the most relevant information. `}},merge:{name:"Merge series/tables",getHelperDocs:function(){return` Use this transformation to combine the results from multiple queries into a single result, which is particularly useful when using the table panel visualization. This transformation merges values into the same row if the shared fields contain the same data. Here's an example illustrating the impact of the **Merge series/tables** transformation on two queries returning table data: **Query A:** | Time | Job | Uptime | | ------------------- | ------- | --------- | | 2020-07-07 11:34:20 | node | 25260122 | | 2020-07-07 11:24:20 | postgre | 123001233 | **Query B:** | Time | Job | Errors | | ------------------- | ------- | ------ | | 2020-07-07 11:34:20 | node | 15 | | 2020-07-07 11:24:20 | postgre | 5 | Here is the result after applying the Merge transformation. | Time | Job | Errors | Uptime | | ------------------- | ------- | ------ | --------- | | 2020-07-07 11:34:20 | node | 15 | 25260122 | | 2020-07-07 11:24:20 | postgre | 5 | 123001233 | This transformation combines values from Query A and Query B into a unified table, enhancing the presentation of data for better insights. `},links:[{title:"Table panel",url:"https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/table/"}]},organize:{name:"Organize fields by name",getHelperDocs:function(){return` Use this transformation to provide the flexibility to rename, reorder, or hide fields returned by a single query in your panel. This transformation is applicable only to panels with a single query. If your panel has multiple queries, consider using an "Outer join" transformation or removing extra queries. #### Transforming fields Grafana displays a list of fields returned by the query, allowing you to perform the following actions: - **Change field order** - Hover over a field, and when your cursor turns into a hand, drag the field to its new position. - **Hide or show a field** - Use the eye icon next to the field name to toggle the visibility of a specific field. - **Rename fields** - Type a new name in the "Rename <field>" box to customize field names. #### Example: ##### Original Query Result | Time | Metric | Value | | ------------------- | ----------- | ----- | | 2020-07-07 11:34:20 | Temperature | 25 | | 2020-07-07 11:34:20 | Humidity | 22 | | 2020-07-07 10:32:20 | Humidity | 29 | ##### After Applying Field Overrides | Time | Sensor | Reading | | ------------------- | ----------- | ------- | | 2020-07-07 11:34:20 | Temperature | 25 | | 2020-07-07 11:34:20 | Humidity | 22 | | 2020-07-07 10:32:20 | Humidity | 29 | This transformation lets you to tailor the display of query results, ensuring a clear and insightful representation of your data in Grafana. `}},partitionByValues:{name:"Partition by values",getHelperDocs:function(){return` Use this transformation to streamline the process of graphing multiple series without the need for multiple queries with different 'WHERE' clauses. This is particularly useful when dealing with a metrics SQL table, as illustrated below: | Time | Region | Value | | ------------------- | ------ | ----- | | 2022-10-20 12:00:00 | US | 1520 | | 2022-10-20 12:00:00 | EU | 2936 | | 2022-10-20 01:00:00 | US | 1327 | | 2022-10-20 01:00:00 | EU | 912 | With the **Partition by values** transformation, you can issue a single query and split the results by unique values in one or more columns (fields) of your choosing. The following example uses 'Region': 'SELECT Time, Region, Value FROM metrics WHERE Time > "2022-10-20"' | Time | Region | Value | | ------------------- | ------ | ----- | | 2022-10-20 12:00:00 | US | 1520 | | 2022-10-20 01:00:00 | US | 1327 | | Time | Region | Value | | ------------------- | ------ | ----- | | 2022-10-20 12:00:00 | EU | 2936 | | 2022-10-20 01:00:00 | EU | 912 | This transformation simplifies the process and enhances the flexibility of visualizing multiple series within the same time series visualization. `}},prepareTimeSeries:{name:"Prepare time series",getHelperDocs:function(){return` Use this transformation to address issues when a data source returns time series data in a format that isn't compatible with the desired visualization. This transformation allows you to convert time series data between wide and long formats, providing flexibility in data frame structures. #### Available options ##### Multi-frame time series Use this option to transform the time series data frame from the wide format to the long format. This is particularly helpful when your data source delivers time series information in a format that needs to be reshaped for optimal compatibility with your visualization. **Example: Converting from wide to long format** | Timestamp | Value1 | Value2 | |---------------------|--------|--------| | 2023-01-01 00:00:00 | 10 | 20 | | 2023-01-01 01:00:00 | 15 | 25 | **Transformed to:** | Timestamp | Variable | Value | |---------------------|----------|-------| | 2023-01-01 00:00:00 | Value1 | 10 | | 2023-01-01 00:00:00 | Value2 | 20 | | 2023-01-01 01:00:00 | Value1 | 15 | | 2023-01-01 01:00:00 | Value2 | 25 | ##### Wide time series Select this option to transform the time series data frame from the long format to the wide format. If your data source returns time series data in a long format and your visualization requires a wide format, this transformation simplifies the process. **Example: Converting from long to wide format** | Timestamp | Variable | Value | |---------------------|----------|-------| | 2023-01-01 00:00:00 | Value1 | 10 | | 2023-01-01 00:00:00 | Value2 | 20 | | 2023-01-01 01:00:00 | Value1 | 15 | | 2023-01-01 01:00:00 | Value2 | 25 | **Transformed to:** | Timestamp | Value1 | Value2 | |---------------------|--------|--------| | 2023-01-01 00:00:00 | 10 | 20 | | 2023-01-01 01:00:00 | 15 | 25 | > **Note:** This transformation is available in Grafana 7.5.10+ and Grafana 8.0.6+. `},links:[{title:"Data frames",url:"https://grafana.com/docs/grafana/latest/developers/plugins/introduction-to-plugin-development/data-frames/"}]},reduce:{name:"Reduce",getHelperDocs:function(){return` Use this transformation to apply a calculation to each field in the data frame and return a single value. This transformation is particularly useful for consolidating multiple time series data into a more compact, summarized format. Time fields are removed when applying this transformation. Consider the input: **Query A:** | Time | Temp | Uptime | | ------------------- | ---- | ------- | | 2020-07-07 11:34:20 | 12.3 | 256122 | | 2020-07-07 11:24:20 | 15.4 | 1230233 | **Query B:** | Time | AQI | Errors | | ------------------- | --- | ------ | | 2020-07-07 11:34:20 | 6.5 | 15 | | 2020-07-07 11:24:20 | 3.2 | 5 | The reduce transformer has two modes: - **Series to rows** - Creates a row for each field and a column for each calculation. - **Reduce fields** - Keeps the existing frame structure, but collapses each field into a single value. For example, if you used the **First** and **Last** calculation with a **Series to rows** transformation, then the result would be: | Field | First | Last | | ------ | ------ | ------- | | Temp | 12.3 | 15.4 | | Uptime | 256122 | 1230233 | | AQI | 6.5 | 3.2 | | Errors | 15 | 5 | The **Reduce fields** with the **Last** calculation, results in two frames, each with one row: **Query A:** | Temp | Uptime | | ---- | ------- | | 15.4 | 1230233 | **Query B:** | AQI | Errors | | --- | ------ | | 3.2 | 5 | This flexible transformation simplifies the process of consolidating and summarizing data from multiple time series into a more manageable and organized format. `}},renameByRegex:{name:"Rename by regex",getHelperDocs:function(r="shortcodeFigure"){return` Use this transformation to rename parts of the query results using a regular expression and replacement pattern. You can specify a regular expression, which is only applied to matches, along with a replacement pattern that support back references. For example, let's imagine you're visualizing CPU usage per host and you want to remove the domain name. You could set the regex to '/^([^.]+).*/' and the replacement pattern to '$1', 'web-01.example.com' would become 'web-01'. > **Note:** The Rename by regex transformation was improved in Grafana v9.0.0 to allow global patterns of the form '/<stringToReplace>/g'. Depending on the regex match used, this may cause some transformations to behave slightly differently. You can guarantee the same behavior as before by wrapping the match string in forward slashes '(/)', e.g. '(.*)' would become '/(.*)/'. In the following example, we are stripping the 'A-' prefix from field names. In the before image, you can see everything is prefixed with 'A-': ${s("/media/docs/grafana/panels-visualizations/screenshot-rename-by-regex-before-v11.0.png",r,"A time series with full series names")} With the transformation applied, you can see we are left with just the remainder of the string. ${s("/media/docs/grafana/panels-visualizations/screenshot-rename-by-regex-after-v11.0.png",r,"A time series with shortened series names")} This transformation lets you to tailor your data to meet your visualization needs, making your dashboards more informative and user-friendly. `}},rowsToFields:{name:"Rows to fields",getHelperDocs:function(){return` Use this transformation to convert rows into separate fields. This can be useful because fields can be styled and configured individually. It can also use additional fields as sources for dynamic field configuration or map them to field labels. The additional labels can then be used to define better display names for the resulting fields. This transformation includes a field table which lists all fields in the data returned by the configuration query. This table gives you control over what field should be mapped to each configuration property (the **Use as** option). You can also choose which value to select if there are multiple rows in the returned data. This transformation requires: - One field to use as the source of field names. By default, the transform uses the first string field as the source. You can override this default setting by selecting **Field name** in the **Use as** column for the field you want to use instead. - One field to use as the source of values. By default, the transform uses the first number field as the source. But you can override this default setting by selecting **Field value** in the **Use as** column for the field you want to use instead. Useful when visualizing data in: - Gauge - Stat - Pie chart #### Map extra fields to labels If a field does not map to config property Grafana will automatically use it as source for a label on the output field- **Example:** | Name | DataCenter | Value | | ------- | ---------- | ----- | | ServerA | US | 100 | | ServerB | EU | 200 | **Output:** | ServerA (labels: DataCenter: US) | ServerB (labels: DataCenter: EU) | | -------------------------------- | -------------------------------- | | 10 | 20 | The extra labels can now be used in the field display name provide more complete field names. If you want to extract config from one query and apply it to another you should use the config from query results transformation. #### 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. This transformation enables the conversion of rows into individual fields, facilitates dynamic field configuration, and maps additional fields to labels. `}},seriesToRows:{name:"Series to rows",getHelperDocs:function(){return` Use this transformation to combine the result from multiple time series data queries into one single result. This is helpful when using the table panel visualization. The result from this transformation will contain three columns: Time, Metric, and Value. The Metric column is added so you easily can see from which query the metric originates from. Customize this value by defining Label on the source query. In the example below, we have two queries returning time series data. It is visualized as two separate tables before applying the transformation. **Query A:** | Time | Temperature | | ------------------- | ----------- | | 2020-07-07 11:34:20 | 25 | | 2020-07-07 10:31:22 | 22 | | 2020-07-07 09:30:05 | 19 | **Query B:** | Time | Humidity | | ------------------- | -------- | | 2020-07-07 11:34:20 | 24 | | 2020-07-07 10:32:20 | 29 | | 2020-07-07 09:30:57 | 33 | Here is the result after applying the Series to rows transformation. | Time | Metric | Value | | ------------------- | ----------- | ----- | | 2020-07-07 11:34:20 | Temperature | 25 | | 2020-07-07 11:34:20 | Humidity | 22 | | 2020-07-07 10:32:20 | Humidity | 29 | | 2020-07-07 10:31:22 | Temperature | 22 | | 2020-07-07 09:30:57 | Humidity | 33 | | 2020-07-07 09:30:05 | Temperature | 19 | This transformation facilitates the consolidation of results from multiple time series queries, providing a streamlined and unified dataset for efficient analysis and visualization in a tabular format. > **Note:** This transformation is available in Grafana 7.1+. `}},sortBy:{name:"Sort by",getHelperDocs:function(){return` Use this transformation to sort each frame within a query result based on a specified field, making your data easier to understand and analyze. By configuring the desired field for sorting, you can control the order in which the data is presented in the table or visualization. Use the **Reverse** switch to inversely order the values within the specified field. This functionality is particularly useful when you want to quickly toggle between ascending and descending order to suit your analytical needs. For example, in a scenario where time-series data is retrieved from a data source, the **Sort by** transformation can be applied to arrange the data frames based on the timestamp, either in ascending or descending order, depending on the analytical requirements. This capability ensures that you can easily navigate and interpret time-series data, gaining valuable insights from the organized and visually coherent presentation. `}},spatial:{name:"Spatial",getHelperDocs:function(){return` Use this transformation to apply spatial operations to query results. - **Action** - Select an action: - **Prepare spatial field** - Set a geometry field based on the results of other fields. - **Location mode** - Select a location mode (these options are shared by the **Calculate value** and **Transform** modes): - **Auto** - Automatically identify location data based on default field names. - **Coords** - Specify latitude and longitude fields. - **Geohash** - Specify a geohash field. - **Lookup** - Specify Gazetteer location fields. - **Calculate value** - Use the geometry to define a new field (heading/distance/area). - **Function** - Choose a mathematical operation to apply to the geometry: - **Heading** - Calculate the heading (direction) between two points. - **Area** - Calculate the area enclosed by a polygon defined by the geometry. - **Distance** - Calculate the distance between two points. - **Transform** - Apply spatial operations to the geometry. - **Operation** - Choose an operation to apply to the geometry: - **As line** - Create a single line feature with a vertex at each row. - **Line builder** - Create a line between two points. This transformation allows you to manipulate and analyze geospatial data, enabling operations such as creating lines between points, calculating spatial properties, and more. `}},timeSeriesTable:{name:"Time series to table transform",getHelperDocs:function(){return` Use this transformation to convert time series results into a table, transforming a time series data frame into a **Trend** field. The **Trend** field can then be rendered using the [sparkline cell type][], generating an inline sparkline for each table row. If there are multiple time series queries, each will result in a separate table data frame. These can be joined using join or merge transforms to produce a single table with multiple sparklines per row. For each generated **Trend** field value, a calculation function can be selected. The default is **Last non-null value**. This value is displayed next to the sparkline and used for sorting table rows. > **Note:** This transformation is available in Grafana 9.5+ as an opt-in beta feature. Modify the Grafana [configuration file][] to use it. `},links:[{title:"sparkline cell type",url:"https://grafana.com/docs/grafana/latest/panels-visualizations/visualizations/table/#sparkline"},{title:"configuration file",url:"https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/"}]},regression:{name:"Regression analysis",getHelperDocs:function(r="shortcodeFigure"){return` Use this transformation to create a new data frame containing values predicted by a statistical model. This is useful for finding a trend in chaotic data. It works by fitting a mathematical function to the data, using either linear or polynomial regression. The data frame can then be used in a visualization to display a trendline. There are two different models: - **Linear regression** - Fits a linear function to the data. ${s("/static/img/docs/transformations/linear-regression.png",r,"A time series visualization with a straight line representing the linear function")} - **Polynomial regression** - Fits a polynomial function to the data. ${s("/static/img/docs/transformations/polynomial-regression.png",r,"A time series visualization with a curved line representing the polynomial function")} > **Note:** This transformation is currently in public preview. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available. Enable the \`regressionTransformation\` feature toggle in Grafana to use this feature. Contact Grafana Support to enable this feature in Grafana Cloud. `}}};function o(){return` Go to the <a href="https://grafana.com/docs/grafana/latest/panels/transformations/?utm_source=grafana" target="_blank" rel="noreferrer"> transformation documentation </a> for more general documentation. `}function s(r,g,u){return g==="shortcodeFigure"?`{{< figure src="${r}" class="docs-image--no-shadow" max-width= "1100px" alt="${u}" >}}`:``}},9581:(Q,A,e)=>{"use strict";e.d(A,{YD:()=>s,dy:()=>n,kD:()=>o});var t=e(52622),n=(g=>(g.Prepare="prepare",g.Calculate="calculate",g.Modify="modify",g))(n||{}),o=(g=>(g.Heading="heading",g.Distance="distance",g.Area="area",g))(o||{}),s=(g=>(g.AsLine="asLine",g.LineBuilder="lineBuilder",g))(s||{});const r={action:"prepare",source:{mode:t.aG.Auto}}},78134:(Q,A,e)=>{"use strict";e.d(A,{EX:()=>l,pp:()=>d,tt:()=>c});var t=e(70915),n=e(11217),o=e(44294),s=e(22796),r=e(52490),g=e(11261),u=e(9581);function c(h){const p=[];for(const m of h.values)m&&p.push(l(m));return new n.A(p)}function i(h){const p=new Array(h.length);if(h.length>1){let m=f(h[0]);for(let a=1;a<h.length;a++){let v=f(h[a]);if(m&&v){let E=Math.atan2(v[0]-m[0],v[1]-m[1])*180/Math.PI;E<0&&(E+=360),p[a-1]=p[a]=E}}}else p.fill(0);return p}function l(h){return h instanceof o.A?h.getCoordinates():(0,t.q1)(h.getExtent())}function f(h){if(h)return(0,s.WP)(l(h))}function d(h,p){const m=h.values,a=new Array(h.values.length),v=p.calc??u.kD.Heading,E=p.field??v;switch(v){case u.kD.Area:{for(let D=0;D<m.length;D++){const b=m[D];b&&(a[D]=(0,r.UG)(b))}return{name:E,type:g.PU.number,config:{unit:"areaM2"},values:a}}case u.kD.Distance:{for(let D=0;D<m.length;D++){const b=m[D];b&&(a[D]=(0,r.R3)(b))}return{name:E,type:g.PU.number,config:{unit:"lengthm"},values:a}}case u.kD.Heading:default:return{name:E,type:g.PU.number,config:{unit:"degree"},values:i(m)}}}},88841:(Q,A,e)=>{"use strict";e.d(A,{y:()=>p});var t=e(32196),n=e(18491),o=e(36376),s=e(96540),r=e(40845),g=e(17464),u=e(40276),c=e(72093),i=e(10354),l=e(43538);const f=(a,v)=>a-v*Math.floor(a/v),d=8,h=(a,v)=>({suggestionsWrapper:(0,t.css)({boxShadow:a.shadows.z2}),errorTooltip:(0,t.css)({position:"absolute",top:v+d+"px",zIndex:a.zIndex.tooltip}),inputWrapper:(0,t.css)({position:"relative"})}),p=({value:a="",onChange:v,suggestions:E,placeholder:D,error:b,invalid:C})=>{const[y,M]=(0,s.useState)(!1),[T,I]=(0,s.useState)(0),[x,S]=(0,s.useState)(a.toString()),[O,P]=(0,s.useState)(0),[L,U]=(0,s.useState)(0),[R,B]=(0,s.useState)(0),H=(0,r.$j)(),w=h(H,L),N=(0,s.useRef)(),V=[(0,n.UU)({fallbackAxisSideDirection:"start",crossAxis:!1,boundary:document.body}),(0,n.BN)()],{refs:G,floatingStyles:_}=(0,o.we)({open:y,placement:"bottom-start",onOpenChange:M,middleware:V,whileElementsMounted:n.ll,strategy:"fixed"}),K=(0,s.useCallback)(J=>{G.setReference(J),N.current=J},[G]),j=(0,s.useRef)(null);(0,s.useEffect)(()=>{P(m(j.current,T))},[T]);const k=s.useCallback((J,ne=N.current)=>{const q=ne.selectionStart,te=ne.value;te[R-1]==="$"?ne.value=te.slice(0,R)+J.value+te.slice(q):ne.value=te.slice(0,R)+"$"+J.value+te.slice(q),S(ne.value),M(!1),I(0),v(ne.value)},[v,R]),Y=s.useCallback(J=>{if(!y){if(J.key==="$"||J.key===" "&&J.ctrlKey){B(N.current.selectionStart||0),M(!0);return}return}switch(J.key){case"Backspace":case"Escape":case"ArrowLeft":case"ArrowRight":return M(!1),I(0);case"Enter":return J.preventDefault(),k(E[T]);case"ArrowDown":case"ArrowUp":J.preventDefault();const ne=J.key==="ArrowDown"?1:-1;return I(q=>f(q+ne,E.length));default:return}},[y,E,T,k]),ee=s.useCallback(J=>{S(J.currentTarget.value)},[]),re=s.useCallback(J=>{v(J.currentTarget.value)},[v]);return(0,s.useEffect)(()=>{U(N.current.clientHeight)},[]),s.createElement("div",{className:w.inputWrapper},y&&s.createElement(g.ZL,null,s.createElement("div",{ref:G.setFloating,style:_,className:w.suggestionsWrapper},s.createElement(u.E,{scrollTop:O,autoHeightMax:"300px",setScrollTop:({scrollTop:J})=>P(J)},s.createElement(l.k,{activeRef:j,suggestions:E,onSuggestionSelect:k,onClose:()=>M(!1),activeIndex:T})))),C&&b&&s.createElement("div",{className:w.errorTooltip},s.createElement(c.P,null,b)),s.createElement(i.p,{placeholder:D,invalid:C,ref:K,value:x,onChange:ee,onBlur:re,onKeyDown:Y}))};p.displayName="SuggestionsInput";function m(a,v){return(a?.clientHeight??0)*v}},94397:(Q,A,e)=>{"use strict";e.d(A,{N_:()=>c,ZI:()=>r,aG:()=>g,eJ:()=>u,qt:()=>i});var t=e(96540),n=e(28240),o=e(91410),s=e(32264);function r(l){return(0,t.useMemo)(()=>Array.isArray(l)?Object.keys(l.reduce((f,d)=>!d||!Array.isArray(d.fields)?f:d.fields.reduce((h,p)=>{const m=(0,n.Ct)(p,d,l);return h[m]=!0,h},f),{})):[],[l])}function g(l){const f=new Set;for(const d of l)for(const h of d.fields)if(h.labels)for(const p of Object.keys(h.labels))f.add(p);return f}const u={combine:"Combine",calculateNewFields:"Calculate new fields",createNewVisualization:"Create new visualization",filter:"Filter",performSpatialOperations:"Perform spatial operations",reformat:"Reformat",reorderAndRename:"Reorder and rename"},c=l=>!!(typeof l=="number"||!Number.isNaN(Number(l))||/^\$[A-Za-z0-9_]+$/.test(l)&&s.$.featureToggles.transformationsVariableSupport);function i(l){const f=[];l&&(f.push({label:"Browser",value:"browser"}),f.push({label:"UTC",value:"utc"}));const d=(0,o.P3)();for(const h of d)f.push({label:h,value:h});return f}},87617:(Q,A,e)=>{"use strict";e.d(A,{$u:()=>f,Ay:()=>m,Cj:()=>c,EC:()=>l,Y_:()=>u,dJ:()=>d,g4:()=>i,jE:()=>h,t_:()=>r});var t=e(30038),n=e(2913);const o={users:[],searchQuery:"",page:0,perPage:30,totalPages:1,externalUserMngInfo:n.Ay.externalUserMngInfo,externalUserMngLinkName:n.Ay.externalUserMngLinkName,externalUserMngLinkUrl:n.Ay.externalUserMngLinkUrl,isLoading:!1,rolesLoading:!1},s=(0,t.Z0)({name:"users",initialState:o,reducers:{usersLoaded:(a,v)=>{const{totalCount:E,perPage:D,page:b,orgUsers:C}=v.payload,y=Math.ceil(E/D);return{...a,isLoading:!0,users:C,perPage:D,page:b,totalPages:y}},searchQueryChanged:(a,v)=>({...a,searchQuery:v.payload,page:o.page}),setUsersSearchPage:(a,v)=>({...a,page:v.payload}),pageChanged:(a,v)=>({...a,page:v.payload}),sortChanged:(a,v)=>({...a,sort:v.payload}),usersFetchBegin:a=>({...a,isLoading:!0}),usersFetchEnd:a=>({...a,isLoading:!1}),rolesFetchBegin:a=>({...a,rolesLoading:!0}),rolesFetchEnd:a=>({...a,rolesLoading:!1})}}),{searchQueryChanged:r,setUsersSearchPage:g,usersLoaded:u,usersFetchBegin:c,usersFetchEnd:i,pageChanged:l,sortChanged:f,rolesFetchBegin:d,rolesFetchEnd:h}=s.actions,m={users:s.reducer}},20601:(Q,A,e)=>{"use strict";e.d(A,{B:()=>n});var t=e(83077);const n=new t.O},26260:(Q,A,e)=>{"use strict";e.d(A,{$u:()=>p,D4:()=>v,Iv:()=>E,U2:()=>a,VT:()=>m,z_:()=>h});var t=e(2543),n=e.n(t),o=e(31193),s=e(3843),r=e(24240),g=e(72401),u=e(48594),c=e(87421),i=e(56968),l=e(75096),f=e(53699);const d="Filters",h=C=>async(y,M)=>{let T=b(C,M());if(!T&&(y(D(C)),T=b(C,M()),!T))return;const I=T.filters.findIndex(S=>S.key===C.key&&S.value===C.value);if(I===-1){const{value:S,key:O,operator:P}=C,L={value:S,key:O,operator:P};return await y(a((0,l.jX)(T),L))}const x={...T.filters[I],operator:C.operator};return await y(p((0,l.jX)(T),{index:I,filter:x}))},p=(C,y)=>async(M,T)=>{const I=(0,c.dn)(C,T());M((0,u.kb)(C.rootStateKey,(0,f.E2)((0,l.qD)(I,y)))),await M((0,g.us)((0,l.jX)(I),!0))},m=(C,y)=>async(M,T)=>{const I=(0,c.dn)(C,T());M((0,u.kb)(C.rootStateKey,(0,f.D$)((0,l.qD)(I,y)))),await M((0,g.us)((0,l.jX)(I),!0))},a=(C,y)=>async(M,T)=>{const I=(0,c.dn)(C,T());M((0,u.kb)(C.rootStateKey,(0,f.xt)((0,l.qD)(I,y)))),await M((0,g.us)((0,l.jX)(I),!0))},v=(C,y)=>async(M,T)=>{const I=(0,c.dn)(C,T());M((0,u.kb)(C.rootStateKey,(0,f.qZ)((0,l.qD)(I,y)))),await M((0,g.us)((0,l.jX)(I),!0))},E=(C,y)=>async(M,T)=>{const I=(0,c.dn)(C,T());M((0,u.kb)(C.rootStateKey,(0,i.QP)((0,l.qD)(I,{propName:"datasource",propValue:y}))));const S=(await(0,o.tR)().get(y))?.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.";M((0,u.kb)(C.rootStateKey,(0,s.BC)({infoText:S})))},D=C=>(y,M)=>{const T=(0,c.y7)(M()),I={...(0,t.cloneDeep)(f.MK),datasource:C.datasource,name:d,id:d,rootStateKey:T},x=!1,S=(0,c.hk)(T,M()),O={type:"adhoc",id:I.id,rootStateKey:T};y((0,u.kb)(T,(0,i.QV)((0,l.qD)(O,{global:x,model:I,index:S}))))},b=(C,y)=>{const M=(0,c.y7)(y),T=(0,c.nx)(M,y);let I;for(const x of Object.values(T.variables))if((0,r.EW)(x)&&x.datasource?.uid===C.datasource.uid){I=x;break}return I}},53699:(Q,A,e)=>{"use strict";e.d(A,{AA:()=>f,D$:()=>c,E2:()=>i,MK:()=>r,qZ:()=>l,xt:()=>u});var t=e(30038),n=e(80484),o=e(87421),s=e(83370);const r={...n.Vg,type:"adhoc",datasource:null,filters:[]},g=(0,t.Z0)({name:"templating/adhoc",initialState:s.j,reducers:{filterAdded:(d,h)=>{const p=(0,o.Fs)(d,h.payload.id);p.type==="adhoc"&&p.filters.push(h.payload.data)},filterRemoved:(d,h)=>{const p=(0,o.Fs)(d,h.payload.id);if(p.type!=="adhoc")return;const m=h.payload.data;p.filters.splice(m,1)},filterUpdated:(d,h)=>{const p=(0,o.Fs)(d,h.payload.id);if(p.type!=="adhoc")return;const{filter:m,index:a}=h.payload.data;p.filters[a]=m},filtersRestored:(d,h)=>{const p=(0,o.Fs)(d,h.payload.id);p.type==="adhoc"&&(p.filters=h.payload.data)}}}),{filterAdded:u,filterRemoved:c,filterUpdated:i,filtersRestored:l}=g.actions,f=g.reducer},13344:(Q,A,e)=>{"use strict";e.d(A,{Ek:()=>r,To:()=>o,Zm:()=>n,ou:()=>s,qF:()=>t,qz:()=>g});const t="00000000-0000-0000-0000-000000000000",n="All",o="$__all",s="None",r="",g="var-"},35589:(Q,A,e)=>{"use strict";e.d(A,{c:()=>u,z:()=>c});var t=e(16792),n=e(96540),o=e(13544),s=e(40845),r=e(21744),g=e(85140);const u="Grafana-LegacyVariableQueryEditor",c=({onChange:i,query:l})=>{const f=(0,s.of)(g.$),[d,h]=(0,n.useState)(l),p=v=>{h(v.currentTarget.value)},m=(0,n.useCallback)(v=>{i(v.currentTarget.value,v.currentTarget.value)},[i]),a=(0,t.Bi)();return n.createElement(r.f,{id:a,rows:2,value:d,onChange:p,onBlur:m,placeholder:"Metric name or tags query",required:!0,"data-testid":o.Tp.pages.Dashboard.Settings.Variables.Edit.QueryVariable.queryOptionsQueryInput,cols:52,className:f.textarea})};c.displayName=u},70766:(Q,A,e)=>{"use strict";e.d(A,{y:()=>g});var t=e(96540),n=e(72574),o=e(91629),s=e(24240),r=e(35589);async function g(c,i=o.cS){if((0,s.zs)(c))return c.variables.editor;if((0,s.X3)(c)){const l=await i(c.meta);if(!l.components.QueryEditor)throw new Error("Missing QueryEditor in plugin definition.");return l.components.QueryEditor??null}return(0,s.Hf)(c)?u:(0,s.d5)(c)?(await i(c.meta)).components.VariableQueryEditor??r.z:null}function u({datasource:c,query:i,onChange:l}){const f=(0,t.useCallback)(d=>{l({refId:"StandardVariableQuery",query:d})},[l]);return t.createElement(r.z,{query:i.query,onChange:f,datasource:c,templateSrv:(0,n.w)()})}},3843:(Q,A,e)=>{"use strict";e.d(A,{BC:()=>i,DW:()=>g,Eo:()=>f,FN:()=>r,NY:()=>l,T7:()=>c,nS:()=>n,sJ:()=>u,wf:()=>s,y8:()=>d});var t=e(30038);const n={id:"",isValid:!0,errors:{},name:"",extended:null},o=(0,t.Z0)({name:"templating/editor",initialState:n,reducers:{variableEditorMounted:(h,p)=>{h.name=p.payload.name,h.id=p.payload.id},variableEditorUnMounted:(h,p)=>n,changeVariableNameSucceeded:(h,p)=>{h.name=p.payload.data.newName,delete h.errors.name,h.isValid=Object.keys(h.errors).length===0},changeVariableNameFailed:(h,p)=>{h.name=p.payload.newName,h.errors.name=p.payload.errorText,h.isValid=Object.keys(h.errors).length===0},addVariableEditorError:(h,p)=>{h.errors[p.payload.errorProp]=p.payload.errorText,h.isValid=Object.keys(h.errors).length===0},removeVariableEditorError:(h,p)=>{delete h.errors[p.payload.errorProp],h.isValid=Object.keys(h.errors).length===0},changeVariableEditorExtended:(h,p)=>{h.extended={...h.extended,...p.payload}},cleanEditorState:()=>n}}),s=o.reducer,{changeVariableNameSucceeded:r,changeVariableNameFailed:g,variableEditorMounted:u,variableEditorUnMounted:c,changeVariableEditorExtended:i,addVariableEditorError:l,removeVariableEditorError:f,cleanEditorState:d}=o.actions},85830:(Q,A,e)=>{"use strict";e.d(A,{M:()=>t});var t=(n=>(n[n.MaxSize=50]="MaxSize",n))(t||{})},25304:(Q,A,e)=>{"use strict";e.d(A,{z:()=>s});var t=e(72574),n=e(20601),o=e(13344);function s(r){const g={},u=(0,t.w)().getVariables();for(let c=0;c<u.length;c++){const i=u[c],l=r&&r[i.name];i.skipUrlSync||(l?g[o.qz+i.name]=l.value:g[o.qz+i.name]=n.B.get(i.type).getValueForUrl(i))}return g}},24240:(Q,A,e)=>{"use strict";e.d(A,{CH:()=>m,EW:()=>s,Hf:()=>f,P4:()=>o,SP:()=>u,VN:()=>p,VO:()=>r,X3:()=>h,d5:()=>l,iv:()=>g,m8:()=>c,zs:()=>d});var t=e(29505),n=e(35589);const o=a=>a.type==="query",s=a=>a.type==="adhoc",r=a=>a.type==="constant",g=a=>"multi"in a,u=a=>"options"in a,c=a=>"current"in a;function i(a){return a===null?!1:typeof a=="string"}const l=a=>!!a.metricFindQuery&&!a.variables,f=a=>{if(!a.variables||a.variables.getType()!==t.Qz.Standard)return!1;const v=a.variables;return"toDataQuery"in v&&!!v.toDataQuery},d=a=>{if(!a.variables||a.variables.getType()!==t.Qz.Custom)return!1;const v=a.variables;return"query"in v&&"editor"in v&&!!v.query&&!!v.editor},h=a=>a.variables?a.variables.getType()===t.Qz.Datasource:!1;function p(a,v){return a?a.displayName===n.c||l(v):!1}function m(a,v){return a?a.displayName!==n.c&&(h(v)||f(v)||d(v)):!1}},27238:(Q,A,e)=>{"use strict";e.d(A,{WT:()=>n,bX:()=>r,t4:()=>s});var t=e(30038);const n={usages:[],usagesNetwork:[]},o=(0,t.Z0)({name:"templating/inspect",initialState:n,reducers:{initInspect:(g,u)=>{const{usages:c,usagesNetwork:i}=u.payload;g.usages=c,g.usagesNetwork=i}}}),s=o.reducer,{initInspect:r}=o.actions},12846:(Q,A,e)=>{"use strict";e.d(A,{qJ:()=>f,hI:()=>i,hM:()=>a,H7:()=>l,xU:()=>D,P5:()=>x,g0:()=>v,PK:()=>T,Ow:()=>y});var t=e(6709);function n(S,O){const P=new Set;for(const L of S)P.add(O(L));return P}var o=e(84423),s=e(87490),r=e(34214),g=e(20601),u=e(24240),c=e(75096);const i=S=>{const O=[];for(const P of S)O.push({id:P.id,label:`${P.id}`});return O},l=(S,O)=>S.filter(P=>O.some(L=>L.from===P.id||L.to===P.id)),f=S=>{const O=[];for(const P of S)for(const L of S){if(P===L)continue;g.B.get(P.type).dependsOn(P,L)&&O.push({from:P.id,to:L.id})}return O};function d(S){const O=(0,c.t4)(S);if(!O)return;const P=O.slice(1).find(L=>L!==void 0);if(!(P in{}))return P}const h=(S,O)=>{c.SY.lastIndex=0;const P=[],U=(0,s.MA)(O,2).match(c.SY);if(!U)return P;for(const R of U){if(!R||R.indexOf("$__")!==-1||R.indexOf("${__")!==-1||R.indexOf("$hashKey")!==-1)continue;const B=d(R);S.some(H=>H.id===B)||P.find(H=>H===B)||B&&P.push(B)}return P},p={alias:[/^m$/,/^measurement$/,/^col$/,/^tag_(\w+|\d+)$/],query:[/^timeFilter$/]},m=(S,O,P)=>{const L=Object.keys(O.value).reduce((R,B)=>{const H=O.value[B];if(!H||typeof H!="string")return R;const w=p[B]?p[B].find(V=>V.test(S)):void 0;let N=(0,c.wJ)(H,S);return B==="repeat"&&H===S&&(N=!0),!w&&N&&(R={...R,[B]:H}),R},{}),U=Object.keys(O.value).reduce((R,B)=>{const H=O.value[B];if(H&&typeof H=="object"&&Object.keys(H).length){let w=H.title||H.name||H.id||B;Array.isArray(O.value)&&O.key==="panels"&&(w=`${w}[${H.id}]`);const N=m(S,{key:B,value:H},{});Object.keys(N).length&&(R={...R,[w]:N})}return R},{});return(Object.keys(L).length||Object.keys(U).length)&&(P={...P,...L,...U}),P},a=(S,O)=>{if(!O)return{unUsed:[],usages:[]};const P=[];let L=[];const U=O.getSaveModelCloneOld();for(const R of S){const B=R.id,H=m(B,{key:"model",value:U},{});!Object.keys(H).length&&!(0,u.EW)(R)&&P.push(R),Object.keys(H).length&&L.push({variable:R,tree:H})}return{unUsed:P,usages:L}};async function v(S,O){return new Promise((P,L)=>{setTimeout(()=>{try{const U=E(S,O);P(y(U))}catch(U){L(U)}},200)})}function E(S,O){if(!O)return[];let P=[];const L=O.getSaveModelCloneOld(),U=h(S,L);for(const R of U){const B=m(R,{key:"model",value:L},{});if(Object.keys(B).length){const H={id:R,name:R};P.push({variable:H,tree:B})}}return P}function D(S,O,P){const L=n(O.descendants(S),R=>R.name);L.add(t.c.includeVars);for(const R of S)L.add(R);return b([...L],P)}function b(S,O){const P=[];for(const L of S)O[L]&&P.push(...O[L]);return new Set(P)}const C=(S,O)=>{const{id:P,value:L}=O,{nodes:U,edges:R}=S;if(L&&typeof L=="string"){const B=`${O.id}-${L}`;return U.push({id:B,label:L}),R.push({from:B,to:P}),S}if(L&&typeof L=="object"){const B=Object.keys(L);for(const H of B){const w=`${O.id}-${H}`;U.push({id:w,label:H}),R.push({from:w,to:P}),S=C(S,{id:w,value:L[H]})}return S}return S},y=S=>{const O=[];for(const P of S){const{variable:L,tree:U}=P,R={variable:L,nodes:[{id:"dashboard",label:"dashboard"}],edges:[],showGraph:!1};O.push(C(R,{id:"dashboard",value:U}))}return O},M=S=>Object.values(S).reduce((P,L)=>typeof L=="object"?P+M(L):P+1,0),T=(S,O)=>{const P=O.find(L=>L.variable.id===S);return P?M(P.tree):0};function I(S){const O=[];for(const P of S)O.push(P),P.panels?.length&&O.push(...I(P.panels.map(L=>new PanelModel(L))));return O}function x(S){const O={};for(const P of S){const L=(0,o.tw)(P),U=[...L.matchAll(/"repeat":"([^"]+)"/g)].map(H=>H[1]),R=L.match(c.SY)?.map(H=>d(H))??[],B=[...U,...R];for(const H of B)H in O?O[H].add(P.id):O[H]=new Set([P.id])}return O}},81515:(Q,A,e)=>{"use strict";e.d(A,{E5:()=>i,Ez:()=>u,mn:()=>l});var t=e(30038),n=e(2543),o=e.n(n),s=e(87421),r=e(83370),g=e(80484);const u={...g.Vg,type:"interval",auto_count:30,auto_min:"10s",options:[],auto:!1,query:"1m,10m,30m,1h,6h,12h,1d,7d,14d,30d",refresh:g.CO.onTimeRangeChanged,current:{}},c=(0,t.Z0)({name:"templating/interval",initialState:r.j,reducers:{createIntervalOptions:(f,d)=>{const h=(0,s.Fs)(f,d.payload.id);if(h.type!=="interval")return;const p=(0,n.map)(h.query.match(/(["'])(.*?)\1|\w+/g),m=>(m=m.replace(/["']+/g,""),{text:m.trim(),value:m.trim(),selected:!1}));h.auto&&p.length&&p[0].text!=="auto"&&p.unshift({text:"auto",value:"$__auto_interval_"+h.name,selected:!1}),h.options=p}}}),i=c.reducer,{createIntervalOptions:l}=c.actions},24300:(Q,A,e)=>{"use strict";e.d(A,{jR:()=>x,Fu:()=>b,$z:()=>c,O$:()=>C,ho:()=>S,MO:()=>D,an:()=>y,U9:()=>E,fx:()=>T,qh:()=>I,S8:()=>M});var t=e(53076),n=e(30038),o=e(2543),s=e(92053);const r=(O,...P)=>P.reduce((L,U)=>U(L),O);var g=e(13344),u=e(24240);const c={id:"",highlightIndex:-1,queryValue:"",selectedValues:[],options:[],multi:!1},i=1e3,l=new t.A({intraMode:1,intraIns:1,intraSub:1,intraTrn:1,intraDel:1}),f=O=>Array.isArray(O)?O.reduce((P,L)=>((0,o.isString)(L.value)&&(P[L.value]=L),P),{}):{},d=O=>{if(!Array.isArray(O.options))return O.options=[],O;const P=f(O.selectedValues);return O.selectedValues=Object.values(P),O.options=O.options.map(L=>{if(!(0,o.isString)(L.value))return L;const U=!!P[L.value];return L.selected===U?L:{...L,selected:U}}),O.options=h(O.options),O},h=O=>Array.isArray(O)?O.length<=i?O:O.slice(0,i):[],p=O=>{const{options:P,selectedValues:L}=O;return P.length===0||L.length>0||!P[0]||P[0].value!==g.To||(O.selectedValues=[{...P[0],selected:!0}]),O},m=O=>{const{selectedValues:P}=O;return P.length>1&&(O.selectedValues=P.filter(L=>L.value!==g.To)),O},a=O=>O.filter(P=>P.value!==g.To).map(P=>({...P,selected:!0})),v=(0,n.Z0)({name:"templating/optionsPicker",initialState:c,reducers:{showOptions:(O,P)=>{const{query:L,options:U}=P.payload;if(O.highlightIndex=-1,O.options=(0,o.cloneDeep)(U),O.id=P.payload.id,O.queryValue="",O.multi=!1,(0,u.iv)(P.payload)&&(O.multi=P.payload.multi??!1),(0,u.P4)(P.payload)){const{queryValue:R}=P.payload,B=(0,s.E)(L);O.queryValue=B&&R?R:""}return O.selectedValues=O.options.filter(R=>R.selected),r(O,p,d)},hideOptions:(O,P)=>({...c}),toggleOption:(O,P)=>{const{option:L,clearOthers:U,forceSelect:R}=P.payload,{multi:B,selectedValues:H}=O;if(L){const w=!H.find(N=>N.value===L.value&&N.text===L.text);if(L.value===g.To||!B||U)return w||R?O.selectedValues=[{...L,selected:!0}]:O.selectedValues=[],r(O,p,m,d);if(R||w)return O.selectedValues.push({...L,selected:!0}),r(O,p,m,d);O.selectedValues=H.filter(N=>N.value!==L.value&&N.text!==L.text)}else O.selectedValues=[];return r(O,p,m,d)},moveOptionsHighlight:(O,P)=>{let L=O.highlightIndex+P.payload;return L<0?L=-1:L>=O.options.length&&(L=O.options.length-1),{...O,highlightIndex:L}},toggleAllOptions:(O,P)=>{const L=O.selectedValues.find(R=>R.value===g.To),U=O.options.find(R=>R.value===g.To);return O.selectedValues.length>0&&U&&!L?(O.selectedValues=[],O.selectedValues.push({text:U.text??"All",value:U.value,selected:!0}),r(O,d)):L&&O.selectedValues.length===1?(O.selectedValues=a(O.options),r(O,d)):O.selectedValues.length>0&&!U?(O.selectedValues=[],r(O,d)):(O.selectedValues=a(O.options),r(O,d))},updateSearchQuery:(O,P)=>(O.queryValue=P.payload,O),updateOptionsAndFilter:(O,P)=>{const L=O.queryValue.trim();let U=[];if(L==="")U=P.payload;else{const R=P.payload.map(({text:N})=>Array.isArray(N)?N.toString():N),[B,H,w]=l.search(R,L,5);B?.length&&(H&&w?U=w.map(N=>P.payload[H.idx[N]]):U=B.map(N=>P.payload[N]),U.sort((N,V)=>(N.value===g.To?-1:0)-(V.value===g.To?-1:0)))}if(O.highlightIndex=0,L!==""){let R=U.findIndex(B=>B.value!==g.To);(R===-1||U[R].value!==L)&&(U.unshift({selected:!1,text:"> "+L,value:L}),O.highlightIndex=R===-1?0:R+1)}return O.options=U,r(O,p,d)},updateOptionsFromSearch:(O,P)=>(O.options=P.payload,O.highlightIndex=0,r(O,p,d)),cleanPickerState:()=>c}}),{toggleOption:E,showOptions:D,hideOptions:b,moveOptionsHighlight:C,toggleAllOptions:y,updateSearchQuery:M,updateOptionsAndFilter:T,updateOptionsFromSearch:I,cleanPickerState:x}=v.actions,S=v.reducer},86886:(Q,A,e)=>{"use strict";e.d(A,{C:()=>t});const t=(s,r)=>s&&(r&&!Array.isArray(s.value)?{...s,value:o(s.value),text:o(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,o=s=>Array.isArray(s)?s:[s]},72401:(Q,A,e)=>{"use strict";e.d(A,{Y7:()=>Ke,TI:()=>re,_q:()=>Ye,RK:()=>Me,t9:()=>De,x7:()=>ie,Hn:()=>Le,mZ:()=>Xe,kl:()=>he,us:()=>le});var t=e(2543),n=e(12470),o=e(92041),s=e(39070),r=e(22391),g=e(12131),u=e(32264),c=e(82467),i=e(16233),l=e(74856),f=e(99140),d=e(3169),h=e(10096),p=e(27677),m=e(34525),a=e(31193),v=e(87986),E=e(20601),D=e(13344),b=e(3843),C=e(24240),y=e(12846),M=e(24300),T=e(86886),I=e(80484),x=e(75096),S=e(73134),O=e(28601),P=e(48594),L=e(84014);const U=(be,Z=-1,ae=!1,de=!1)=>{const ve={};if(de){const Ue={...initialVariableModelState,id:"__dashboard",name:"__dashboard",type:"system",index:-3,skipUrlSync:!0,hide:VariableHide.hideVariable,current:{value:{name:"A dashboard title",uid:"An dashboard UID",toString:()=>"A dashboard title"}}},_e={...initialVariableModelState,id:"__org",name:"__org",type:"system",index:-2,skipUrlSync:!0,hide:VariableHide.hideVariable,current:{value:{name:"An org name",id:1,toString:()=>"1"}}},ze={...initialVariableModelState,id:"__user",name:"__user",type:"system",index:-1,skipUrlSync:!0,hide:VariableHide.hideVariable,current:{value:{login:"admin",id:1,email:"admin@test",toString:()=>"1"}}};ve[Ue.id]=Ue,ve[_e.id]=_e,ve[ze.id]=ze}for(let Ue=0;Ue<be;Ue++)ve[Ue]=createQueryVariable({id:Ue.toString(),name:`Name-${Ue}`,label:`Label-${Ue}`,index:Ue});return ae&&(ve[NEW_VARIABLE_ID]=createQueryVariable({id:NEW_VARIABLE_ID,name:`Name-${NEW_VARIABLE_ID}`,label:`Label-${NEW_VARIABLE_ID}`,index:be})),ve},R=(be,Z={})=>{const ae={id:"0",rootStateKey:"key",index:0,name:"0"};return{initialState:{0:{...{...be.initialState,...ae},...Z}}}},B=()=>combineReducers({dashboard:dashboardReducer,templating:keyedVariablesReducer}),H=()=>combineReducers({templating:keyedVariablesReducer});function w(be,Z){return{templating:{lastKey:be,keys:{[be]:{...getInitialTemplatingState(),...Z}}}}}function N(be,Z){return be.find(de=>de.name===Z)}function V(be){return(be.type==="query"||be.type==="datasource"||be.type==="interval")&&be.refresh===S.CO.onTimeRangeChanged}var G=e(87421),_=e(56968),K=e(85675),j=e(15120);const k=(be,Z)=>(ae,de)=>{let ve=0;const Ue=Z.templating.list;for(let ze=0;ze<Ue.length;ze++){const Ve=Y(Ue[ze]);Ve.rootStateKey=be,E.B.getIfExists(Ve.type)&&ae((0,P.kb)(be,(0,_.QV)((0,x.qD)(Ve,{global:!1,index:ve++,model:Ve}))))}(0,v.w)().updateTimeRange((0,l.jG)().timeRange());const _e=(0,G.SS)(be,de());for(const ze of _e)ae((0,P.kb)(be,(0,_.wB)((0,x.qD)(ze))))};function Y(be){if(!(0,C.SP)(be))return be;let Z=!1;for(const ae of be.options)if(ae.selected=!1,Array.isArray(be.current.value))for(const de of be.current.value)ae.value===de&&(ae.selected=Z=!0);else ae.value===be.current.value&&(ae.selected=Z=!0);return!Z&&be.options.length&&(be.options[0].selected=!0),be}const ee=(be,Z)=>ae=>{const de={...I.Vg,id:"__dashboard",name:"__dashboard",type:"system",index:-3,skipUrlSync:!0,hide:n.zL.hideVariable,current:{value:{name:Z.title,uid:Z.uid,toString:()=>Z.title}}};ae((0,P.kb)(be,(0,_.QV)((0,x.qD)(de,{global:de.global,index:de.index,model:de}))));const ve={...I.Vg,id:"__org",name:"__org",type:"system",index:-2,skipUrlSync:!0,hide:n.zL.hideVariable,current:{value:{name:i.TP.user.orgName,id:i.TP.user.orgId,toString:()=>i.TP.user.orgId.toString()}}};ae((0,P.kb)(be,(0,_.QV)((0,x.qD)(ve,{global:ve.global,index:ve.index,model:ve}))));const Ue={...I.Vg,id:"__user",name:"__user",type:"system",index:-1,skipUrlSync:!0,hide:n.zL.hideVariable,current:{value:{login:i.TP.user.login,id:i.TP.user.id,email:i.TP.user.email,toString:()=>i.TP.user.id.toString()}}};ae((0,P.kb)(be,(0,_.QV)((0,x.qD)(Ue,{global:Ue.global,index:Ue.index,model:Ue}))))},re=(be,Z)=>(ae,de)=>{const{rootStateKey:ve}=be,Ue=(0,G.dn)(be,de());if(!(0,C.iv)(Ue)||(0,o.R)(Ue.current))return;const _e=(0,T.C)(Ue.current,Z);ae((0,P.kb)(ve,(0,_.QP)((0,x.qD)(be,{propName:"multi",propValue:Z})))),ae((0,P.kb)(ve,(0,_.QP)((0,x.qD)(be,{propName:"current",propValue:_e}))))},J=async(be,Z)=>{if(!be.rootStateKey)throw new Error(`rootStateKey not found for variable with id:${be.id}`);if(ne(be,Z))throw new Error("Circular dependency in dashboard variables detected. Dashboard may not work as expected.");const ae=q(be,Z);te(be.rootStateKey,ae,Z)&&await new Promise(de=>{const ve=f.M_.subscribe(()=>{if(!be.rootStateKey)throw new Error(`rootStateKey not found for variable with id:${be.id}`);te(be.rootStateKey,ae,f.M_.getState())||(ve(),de())})})},ne=(be,Z,ae=new Set)=>ae.has(be.id)?!0:(ae=new Set([...ae,be.id]),q(be,Z).some(de=>ne(de,Z,ae))),q=(be,Z)=>{if(!be.rootStateKey)return[];const ae=[];for(const de of(0,G.SS)(be.rootStateKey,Z))be!==de&&E.B.getIfExists(be.type)&&E.B.get(be.type).dependsOn(be,de)&&ae.push(de);return ae},te=(be,Z,ae)=>{if(Z.length===0)return!1;const de=(0,G.SS)(be,ae);return Z.filter(Ue=>de.some(_e=>_e.id===Ue.id&&(_e.state===s.Gu.NotStarted||_e.state===s.Gu.Loading))).length>0},oe=(be,Z)=>async(ae,de)=>{const ve=(0,G.dn)(be,de());await J(ve,de());const Ue=Z[D.qz+ve.name];if(Ue!==void 0){const _e=(0,x.QT)(Ue);await E.B.get(ve.type).setValueFromUrl(ve,_e);return}if(ve.hasOwnProperty("refresh")){const _e=ve;if(_e.refresh===n.CO.onDashboardLoad||_e.refresh===n.CO.onTimeRangeChanged){await ae(Xe((0,x.jX)(_e)));return}}if(ve.type==="custom"){await ae(Xe((0,x.jX)(ve)));return}ae(Ge(be))},ue=be=>async(Z,ae)=>{const de=g.Ny.getSearchObject(),ve=(0,G.SS)(be,ae()).map(async Ue=>await Z(oe((0,x.jX)(Ue),de)));await Promise.all(ve)},ie=(be,Z)=>async(ae,de)=>{const ve=(0,x.QT)(Z),Ue=(0,G.dn)(be,de());(0,x.q$)(Ue)!==n.CO.never&&await ae(Xe((0,x.jX)(Ue)));const _e=(0,G.dn)((0,x.jX)(Ue),de());if(!(0,C.SP)(_e))return;if(!_e)throw new Error(`Couldn't find variable with name: ${Ue.name}`);let ze=_e.options.find(Ve=>Ve.text===ve||Ve.value===ve);if(!ze&&(0,C.iv)(_e)&&_e.allValue&&ve===_e.allValue&&(ze={text:D.Zm,value:D.To,selected:!1}),!ze){let Ve=ve;const Ne=ve;Array.isArray(ve)&&(Ve=ve.reduce((ot,nt)=>{const pt=_e.options.find(mt=>mt.value===nt);return pt?[].concat(ot,[pt.text]):[].concat(ot,[nt])},[])),ze={text:Ve,value:Ne,selected:!1}}(0,C.iv)(_e)&&(ze=(0,T.C)({text:(0,t.castArray)(ze.text),value:(0,t.castArray)(ze.value),selected:!1},_e.multi)),await E.B.get(Ue.type).setValue(_e,ze)},ge=be=>{let Z,ae,de,ve;const Ue=[];for(Z=0;Z<be.options.length;Z++)if(ve={...be.options[Z]},ve.selected=!1,Array.isArray(be.current.value))for(ae=0;ae<be.current.value.length;ae++)de=be.current.value[ae],ve.value===de&&(ve.selected=!0,Ue.push(ve));else ve.value===be.current.value&&(ve.selected=!0,Ue.push(ve));return Ue},he=(be,Z)=>(ae,de)=>{const ve=(0,G.dn)(be,de());if(!(0,C.SP)(ve))return Promise.resolve();const Ue=ve.current||{},_e=E.B.get(ve.type).setValue;if(Array.isArray(Ue.value)){const ot=ge(ve);if(ot.length===0){const pt=ve.options[0];return _e(ve,{value:typeof pt.value=="string"?[pt.value]:pt.value,text:typeof pt.text=="string"?[pt.text]:pt.text,selected:!0})}const nt={value:ot.map(pt=>pt.value),text:ot.map(pt=>pt.text),selected:!0};return _e(ve,nt)}let ze=null;const Ve=(0,x.Nz)(ve),Ne=(0,x.Lz)(ve);if(ze=ve.options?.find(ot=>ot.text===Ve||ot.value===Ne),ze||Z&&(ze=ve.options?.find(ot=>ot.text===Z||ot.value===Z),ze))return _e(ve,ze);if(ve.options){const ot=ve.options[0];if(ot)return _e(ve,ot)}return Promise.resolve()},De=(be,Z,ae)=>async de=>{const{rootStateKey:ve}=be;return de((0,P.kb)(ve,(0,_.dE)((0,x.qD)(be,{option:Z})))),await de(le(be,ae))},pe=be=>{const Z=new m.TS;return be.forEach(ae=>{Z.createNode(ae.name)}),be.forEach(ae=>{be.forEach(de=>{ae!==de&&E.B.get(ae.type).dependsOn(ae,de)&&Z.link(ae.name,de.name)})}),Z},le=(be,Z,ae=h.lE)=>async(de,ve)=>{const Ue=ve(),{rootStateKey:_e}=be,ze=(0,G.dn)(be,Ue);if((0,G.nx)(_e,Ue).transaction.status===I.x8.Fetching)return(0,x.q$)(ze)===n.CO.never&&(await de(xe((0,x.jX)(ze))),de(Ge(be))),Promise.resolve();const Ve=(0,G.SS)(_e,Ue),Ne=pe(Ve),ot=Ue.dashboard?.getModel()?.panels??[],nt=(0,y.P5)(ot),pt=ze.type==="adhoc"?{refreshAll:!0,panelIds:[]}:{refreshAll:!1,panelIds:Array.from((0,y.xU)([ze.id],Ne,nt)),variable:(0,G.dn)(be,Ue)},mt=Ne.getNode(ze.name);let gt=[];return mt&&(gt=mt.getOptimizedInputEdges().map(Pt=>{const Mt=Ve.find(Yt=>Yt.name===Pt.inputNode?.name);return Mt?de(Xe((0,x.jX)(Mt))):Promise.resolve()})),Promise.all(gt).then(()=>{Z&&(ae.publish(new I.og(pt)),g.Ny.partial(Be(_e,ve)))})},Te=(be,Z,ae,de)=>(Z.includes(be.name)||Z.push(be.name),be.outputEdges.forEach(ve=>{const Ue=ve.outputNode;if(Ue&&!Z.includes(Ue.name)){const _e=ae.find(ze=>ze.name===Ue.name);_e&&_e.refresh===n.CO.onTimeRangeChanged&&de.indexOf(_e)===-1?(de.push(_e),Z.push(Ue.name)):Te(Ue,Z,ae,de)}}),de),Ee=(be,Z)=>be.outputEdges.every(ae=>{const de=ae.outputNode;if(de){const ve=N(Z,de.name);if(ve&&ve.type==="query")return ve.refresh!==n.CO.onTimeRangeChanged}return!0}),Re=(be,Z)=>{const ae=(0,G.SS)(be,Z),de=pe(ae),ve=[],Ue=[];return ae.forEach(_e=>{const ze=de.getNode(_e.name);if(!ve.includes(_e.name)&&ze){const Ve=N(ae,ze.name);if(!Ve)return;const Ne=V(Ve);Ne&&ze.outputEdges.length===0&&Ue.push(Ve),Ne&&Ue.includes(Ve)&&ze.outputEdges.length>0&&(Ue.push(Ve),Te(ze,ve,ae,Ue)),Ne&&ze.outputEdges.length>0&&Ee(ze,ae)&&(Ue.includes(Ve)||Ue.push(Ve)),!Ne&&ze.outputEdges.length>0&&Te(ze,ve,ae,Ue)}}),Ue},me=(be,Z)=>(0,G.SS)(be,Z).filter(ve=>"refresh"in ve&&"options"in ve?ve.refresh===n.CO.onTimeRangeChanged:!1),Me=(be,Z,ae={templateSrv:(0,v.w)(),events:h.lE})=>async(de,ve)=>{ae.templateSrv.updateTimeRange(Z);let Ue=[];u.$.featureToggles.refactorVariablesTimeRange?Ue=Re(be,ve()):Ue=me(be,ve());const _e=Ue.map(Ve=>Ve.id),ze=Ue.map(Ve=>de(ye((0,x.jX)(Ve))));try{await Promise.all(ze),ae.events.publish(new I.BS({variableIds:_e}))}catch(Ve){console.error(Ve),de((0,c.dx)(He("Template variable service failed",Ve)))}},ye=be=>async(Z,ae)=>{const de=(0,G.dn)(be,ae());if(!(0,C.SP)(de))return;const ve=de.options.slice();await Z(Xe((0,x.jX)(de),!0));const Ue=(0,G.dn)(be,ae());if(!(0,C.SP)(Ue))return;const _e=Ue.options;JSON.stringify(ve)!==JSON.stringify(_e)&&ae().dashboard.getModel()?.templateVariableValueUpdated()},Le=(be,Z,ae=h.lE)=>async(de,ve)=>{const Ue=[],_e=ve().dashboard.getModel(),ze=(0,G.SS)(be,ve());for(const pt of ze){const mt=D.qz+pt.name;if(!Z.hasOwnProperty(mt)||!We(pt,Z[mt].value))continue;let gt=Z[mt].value;if(Z[mt].removed){const Mt=_e?.templating.list.find(Yt=>Yt.name===pt.name);Mt&&(0,C.m8)(Mt)&&(gt=Mt.current.value),Mt&&Mt.type==="constant"&&(gt=Mt.query)}const Pt=E.B.get(pt.type).setValueFromUrl(pt,gt);Ue.push(Pt)}const Ve=ze.filter(pt=>{const mt=D.qz+pt.name;return Z.hasOwnProperty(mt)&&We(pt,Z[mt].value)&&pt.type!=="adhoc"}),Ne=pe(ze),ot=(0,y.P5)(_e?.panels??[]),nt=(0,y.xU)(Ve.map(pt=>pt.id),Ne,ot);Ue.length&&(await Promise.all(Ue),ae.publish(new I.eF({refreshAll:nt.size===0,panelIds:Array.from(nt)})))};function We(be,Z){const ae=E.B.get(be.type).getValueForUrl(be);let de=(0,x.QT)(Z);return Array.isArray(ae)&&!Array.isArray(de)&&(de=[de]),!(0,t.isEqual)(ae,de)}const Be=(be,Z)=>{const ae=g.Ny.getSearchObject(),de=Object.keys(ae).filter(ve=>ve.indexOf(D.qz)===-1).reduce((ve,Ue)=>(ve[Ue]=ae[Ue],ve),{});for(const ve of(0,G.SS)(be,Z())){if(ve.skipUrlSync)continue;const Ue=E.B.get(ve.type);de[D.qz+ve.name]=Ue.getValueForUrl(ve)}return de},Ye=(be,Z)=>async(ae,de)=>{try{const ve=(0,x.q4)(be),Ue=de(),_e=(0,G.Tk)(Ue);_e&&(0,G.nx)(_e,Ue).transaction.status===I.x8.Fetching&&ae(Ke(_e)),ae((0,P.kb)(ve,(0,K.kH)({uid:ve}))),ae(ee(ve,Z)),ae(k(ve,Z)),ae(at(ve)),await ae(ue(ve)),ae((0,P.kb)(ve,(0,K.$O)({uid:ve})))}catch(ve){ae((0,c.dx)(He("Templating init failed",ve))),console.error(ve)}};function at(be,Z=a.tR){return(ae,de)=>{const ve=(0,G.SS)(be,de());for(const Ue of ve){if(Ue.type!=="adhoc"&&Ue.type!=="query")continue;const{datasource:_e}=Ue;if((0,r.fN)(_e))continue;const ze=Z().getInstanceSettings(_e),Ve=ze?(0,r.p$)(ze):{uid:_e};ae((0,P.kb)(be,(0,_.QP)((0,x.qD)(Ue,{propName:"datasource",propValue:Ve}))))}}}const st=be=>Z=>{Z((0,P.kb)(be,(0,j.v)())),Z((0,P.kb)(be,(0,b.y8)())),Z((0,P.kb)(be,(0,M.jR)())),Z((0,P.kb)(be,(0,K.pu)()))},Ke=(be,Z={getBackendSrv:p.AI})=>ae=>{Z.getBackendSrv().cancelAllInFlightRequests(),ae(st(be))},Xe=(be,Z=!1)=>async(ae,de)=>{const{rootStateKey:ve}=be;try{if(!(0,x.sN)(ve,de()))return;const Ue=(0,G.dn)(be,de());ae((0,P.kb)(ve,(0,_.a7)((0,x.qD)(Ue)))),await ae(xe((0,x.jX)(Ue))),await E.B.get(Ue.type).updateOptions(Ue),ae(Ge(be))}catch(Ue){if(ae((0,P.kb)(ve,(0,_.Te)((0,x.qD)(be,{error:Ue})))),Z||(console.error(Ue),ae((0,c.dx)(He("Error updating options:",Ue,be)))),Z)throw Ue}},He=(be,Z,ae)=>(0,d.gi)(`${ae?`Templating [${ae.id}]`:"Templating"}`,Z instanceof Error?`${be} ${Z.message}`:`${be}`),Ge=be=>(Z,ae)=>{const{rootStateKey:de}=be;if(!(0,x.sN)(de,ae()))return;const ve=(0,G.dn)(be,ae());ve.state!==s.Gu.Done&&Z((0,P.kb)(be.rootStateKey,(0,_.Pu)((0,x.qD)(ve))))};function xe(be,Z=a.tR){return async function(ae,de){const{id:ve,rootStateKey:Ue}=be;if(!(0,x.sN)(Ue,de()))return;const _e=(0,G.dn)(be,de());if(_e.type==="query")try{const ze=await Z().get(_e.datasource??"");if((0,C.d5)(ze)||!(0,C.Hf)(ze)||$e(_e.query))return;const Ve={refId:`${ze.name}-${ve}-Variable-Query`,query:_e.query};ae((0,P.kb)(Ue,(0,_.QP)((0,x.qD)(be,{propName:"query",propValue:Ve}))))}catch(ze){ae((0,c.dx)(He("Failed to upgrade legacy queries",ze))),console.error(ze)}}}function $e(be){return(0,s.Gv)(be)&&"refId"in be&&typeof be.refId=="string"}},48594:(Q,A,e)=>{"use strict";e.d(A,{Ay:()=>i,L1:()=>s,kb:()=>g});var t=e(75096),n=e(84014),o=e(85675);const s={keys:{}},r=l=>({type:`templating/keyed/${l.action.type.replace(/^templating\//,"")}`,payload:l});function g(l,f){const d=(0,t.q4)(l);return r({key:d,action:f})}const u=l=>typeof l.type=="string"&&l.type.startsWith("templating/keyed")&&"payload"in l&&typeof l.payload.key=="string";function c(l=s,f){if(u(f)){const{key:d,action:h}=f.payload,p=(0,t.q4)(d),m=o.kH.match(h)?p:l.lastKey,a=(0,n.H)(),v=l.keys[p],E=a(v,h);return{...l,lastKey:m,keys:{...l.keys,[p]:E}}}return l}const i={templating:c}},84014:(Q,A,e)=>{"use strict";e.d(A,{H:()=>i,x:()=>l});var t=e(82960),n=e(3843),o=e(27238),s=e(24300),r=e(85675),g=e(83370),u=e(15120);let c;function i(){return c||(c=(0,t.combineReducers)({editor:n.wf,variables:u.Y,optionsPicker:s.ho,transaction:r.Dd,inspect:o.t4})),c}function l(){return{editor:n.nS,variables:g.j,optionsPicker:s.$z,transaction:r.i3,inspect:o.WT}}},87421:(Q,A,e)=>{"use strict";e.d(A,{Fs:()=>b,SS:()=>c,Tk:()=>m,UN:()=>E,_2:()=>D,bZ:()=>v,dn:()=>r,hk:()=>d,nS:()=>f,nx:()=>u,pi:()=>l,wk:()=>h,y7:()=>a});var t=e(41811),n=e(99140),o=e(75096),s=e(84014);function r(C,y=(0,n.Gu)(),M=!0){const{id:T,rootStateKey:I}=C,S=u(I,y).variables[T];if(!S){if(M)throw new Error(`Couldn't find variable with id:${T}`);return}return S}function g(C,y,M=(0,n.Gu)()){return Object.values(u(y,M).variables).filter(C).sort((T,I)=>T.index-I.index)}function u(C,y=(0,n.Gu)()){return y.templating.keys[(0,o.q4)(C)]??(0,s.x)()}function c(C,y=(0,n.Gu)()){return g(i,C,y)}function i(C){return C.type!=="system"}const l=(0,t.A)((C,y)=>c(C,(0,n.Gu)())),f=(C,y)=>c(C,y);function d(C,y=(0,n.Gu)()){return h(Object.values(u(C,y).variables))}function h(C){const y=C.filter(i).sort((M,T)=>M.index-T.index);return y.length>0?y[y.length-1].index+1:0}function p(C,y=getState()){return u(C,y).transaction.isDirty}function m(C=(0,n.Gu)()){return C.templating?.lastKey}function a(C=(0,n.Gu)()){if(!C.templating?.lastKey)throw new Error("Accessing lastKey without initializing it variables");return C.templating.lastKey}function v(C,y=(0,n.Gu)()){const M=m(y);return M?g(C,M,y):[]}function E(C=(0,n.Gu)()){const y=m(C);return y?c(y,C):[]}function D(C,y=(0,n.Gu)()){const M=m(y);if(M)return r({id:C,rootStateKey:M,type:"query"},y,!1)}function b(C,y){return C[y]}},56968:(Q,A,e)=>{"use strict";e.d(A,{Hr:()=>h,Pu:()=>y,QP:()=>m,QV:()=>p,Te:()=>M,a7:()=>C,dE:()=>E,hj:()=>a,l_:()=>D,qi:()=>d,ut:()=>v,wB:()=>b});var t=e(30038),n=e(2543),o=e.n(n),s=e(39070),r=e(20601),g=e(3843),u=e(24240),c=e(75096),i=e(87421),l=e(83370);const f=(0,t.Z0)({name:"templating/shared",initialState:l.j,reducers:{addVariable:(T,I)=>{const x=I.payload.id??I.payload.data.model.name,S=r.B.get(I.payload.type),O=(0,n.cloneDeep)(S.initialState),P=S.beforeAdding?S.beforeAdding(I.payload.data.model):(0,n.cloneDeep)(I.payload.data.model),L={...(0,n.defaults)({},P,O),id:x,index:I.payload.data.index,global:I.payload.data.global};T[x]=L},variableStateNotStarted:(T,I)=>{const x=(0,i.Fs)(T,I.payload.id);x.state=s.Gu.NotStarted,x.error=null},variableStateFetching:(T,I)=>{const x=(0,i.Fs)(T,I.payload.id);x.state=s.Gu.Loading,x.error=null},variableStateCompleted:(T,I)=>{const x=(0,i.Fs)(T,I.payload.id);x&&(x.state=s.Gu.Done,x.error=null)},variableStateFailed:(T,I)=>{const x=(0,i.Fs)(T,I.payload.id);x&&(x.state=s.Gu.Error,x.error=I.payload.data.error)},removeVariable:(T,I)=>{if(delete T[I.payload.id],!I.payload.data.reIndex)return;const x=Object.values(T).sort((S,O)=>S.index-O.index);for(let S=0;S<x.length;S++)x[S].index=S},duplicateVariable:(T,I)=>{function x(w){return w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const S=(0,n.cloneDeep)(T[I.payload.id]),O=new RegExp(`^copy_of_${x(S.name)}(_(\\d+))?$`),P=Object.values(T).map(({name:w})=>w.match(O)).filter(w=>w!=null),L=P.map(w=>w[2]).filter(w=>w!=null),U=(()=>P.length===0?null:L.length===0?1:L.map(w=>+w).sort((w,N)=>N-w)[0]+1)(),R=`copy_of_${S.name}${U?`_${U}`:""}`,B=I.payload.data?.newId??R,H=(0,i.wk)(Object.values(T));T[B]={...(0,n.cloneDeep)(r.B.get(I.payload.type).initialState),...S,id:B,name:R,index:H}},changeVariableOrder:(T,I)=>{const{toIndex:x,fromIndex:S}=I.payload.data,O=Object.values(T);for(let P=0;P<O.length;P++){const L=O[P];L.index===S?L.index=x:L.index>S&&L.index<=x?L.index--:L.index<S&&L.index>=x&&L.index++}},changeVariableType:(T,I)=>{const{id:x}=I.payload,{label:S,name:O,index:P,description:L,rootStateKey:U}=T[x];T[x]={...(0,n.cloneDeep)(r.B.get(I.payload.data.newType).initialState),id:x,rootStateKey:U,label:S,name:O,index:P,description:L}},setCurrentVariableValue:(T,I)=>{if(!I.payload.data.option)return;const x=(0,i.Fs)(T,I.payload.id);if(!(0,u.SP)(x))return;const{option:S}=I.payload.data,O={...S,text:(0,c.QT)(S?.text),value:(0,c.QT)(S?.value)};x.current=O,x.options=x.options.map(P=>{P.value=(0,c.QT)(P.value),P.text=(0,c.QT)(P.text);let L=!1;if(Array.isArray(O.value))for(let U=0;U<O.value.length;U++){const R=O.value[U];if(P.value===R){L=!0;break}}else P.value===O.value&&(L=!0);return P.selected=L,P})},changeVariableProp:(T,I)=>{const x=(0,i.Fs)(T,I.payload.id);x[I.payload.data.propName]=I.payload.data.propValue}},extraReducers:T=>T.addCase(g.FN,(I,x)=>{const S=(0,i.Fs)(I,x.payload.id);S.name=x.payload.data.newName})}),d=f.reducer,{removeVariable:h,addVariable:p,changeVariableProp:m,changeVariableOrder:a,duplicateVariable:v,setCurrentVariableValue:E,changeVariableType:D,variableStateNotStarted:b,variableStateFetching:C,variableStateCompleted:y,variableStateFailed:M}=f.actions},85675:(Q,A,e)=>{"use strict";e.d(A,{$O:()=>i,Dd:()=>l,i3:()=>s,kH:()=>u,pu:()=>c});var t=e(30038),n=e(80484),o=e(56968);const s={uid:null,status:n.x8.NotStarted,isDirty:!1},r=(0,t.Z0)({name:"templating/transaction",initialState:s,reducers:{variablesInitTransaction:(f,d)=>{f.uid=d.payload.uid,f.status=n.x8.Fetching},variablesCompleteTransaction:(f,d)=>{f.uid===d.payload.uid&&(f.status=n.x8.Completed)},variablesClearTransaction:(f,d)=>{f.uid=null,f.status=n.x8.NotStarted,f.isDirty=!1}},extraReducers:f=>f.addMatcher(g,(d,h)=>{d.status===n.x8.Completed&&(d.isDirty=!0)})});function g(f){return o.Hr.match(f)||o.QV.match(f)||o.QP.match(f)||o.hj.match(f)||o.ut.match(f)||o.l_.match(f)}const{variablesInitTransaction:u,variablesClearTransaction:c,variablesCompleteTransaction:i}=r.actions,l=r.reducer},83370:(Q,A,e)=>{"use strict";e.d(A,{j:()=>t});const t={}},15120:(Q,A,e)=>{"use strict";e.d(A,{Y:()=>g,v:()=>r});var t=e(30038),n=e(20601),o=e(56968),s=e(83370);const r=(0,t.VP)("templating/cleanVariables"),g=(u=s.j,c)=>{if(r.match(c)){const i=Object.values(u).filter(f=>f.global);return i?i.reduce((f,d)=>(f[d.id]=d,f),{}):s.j}return c?.payload?.type&&n.B.getIfExists(c?.payload?.type)?n.B.get(c.payload.type).reducer((0,o.qi)(u,c),c):u}},80484:(Q,A,e)=>{"use strict";e.d(A,{BS:()=>c,CO:()=>t.CO,Vg:()=>g,ZG:()=>t.ZG,eF:()=>i,og:()=>u,x8:()=>r,zL:()=>t.zL});var t=e(12470),n=e(39070),o=e(65463),s=e(13344),r=(l=>(l.NotStarted="Not started",l.Fetching="Fetching",l.Completed="Completed",l))(r||{});const g={id:s.qF,rootStateKey:null,name:"",type:"query",global:!1,index:-1,hide:t.zL.dontHide,skipUrlSync:!1,state:n.Gu.NotStarted,error:null,description:null};class u extends o.x{}u.type="variables-changed";class c extends o.x{}c.type="variables-time-range-process-done";class i extends o.x{}i.type="variables-changed-in-url"},75096:(Q,A,e)=>{"use strict";e.d(A,{AX:()=>b,Lz:()=>a,ML:()=>p,Nz:()=>m,QT:()=>M,SY:()=>f,Wz:()=>y,iP:()=>E,jX:()=>x,q$:()=>D,q4:()=>I,qD:()=>S,sN:()=>T,t4:()=>d,u7:()=>v,wJ:()=>h});var t=e(2543),n=e.n(t),o=e(12470),s=e(72574),r=e(87490),g=e(99140),u=e(20601),c=e(13344),i=e(87421),l=e(80484);const f=/\$(\w+)|\[\[(\w+?)(?::(\w+))?\]\]|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/g,d=O=>(f.lastIndex=0,f.exec(O));function h(...O){const P=O[O.length-1];O[0]=typeof O[0]=="string"?O[0]:(0,r.MA)(O[0]);const U=O.slice(0,-1).join(" ").match(f);return!!(U!==null?U.find(B=>{const H=d(B);return H!==null&&H.indexOf(P)>-1}):!1)}const p=O=>{if(!O||!O.current)return!1;if(O.current.value){const P=Array.isArray(O.current.value);if(P&&O.current.value.length&&O.current.value[0]===c.To||!P&&O.current.value===c.To)return!0}if(O.current.text){const P=Array.isArray(O.current.text);if(P&&O.current.text.length&&O.current.text[0]===c.Zm||!P&&O.current.text===c.Zm)return!0}return!1},m=O=>!O||!O.current||!O.current.text?"":Array.isArray(O.current.text)?O.current.text.toString():typeof O.current.text!="string"?"":O.current.text,a=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 v(O,P=(0,s.w)()){return!O||!O.regex?"":P.replace(O.regex,{},"regex")}function E(O,P,L,U){const R={range:void 0,variable:O,searchFilter:P,scopedVars:U};return(O.refresh===o.CO.onTimeRangeChanged||O.refresh===o.CO.onDashboardLoad)&&(R.range=L.timeRange()),R}function D(O){return O?.type==="custom"?o.CO.onDashboardLoad:!O||!("refresh"in O)||O.refresh!==o.CO.onTimeRangeChanged&&O.refresh!==o.CO.onDashboardLoad?o.CO.never:O.refresh}function b(){return u.B.list().filter(O=>O.id!=="system").map(({id:O,name:P,description:L})=>({label:P,value:O,description:L}))}function C(O){return(0,t.isArray)(O)&&(O.length===0?O=void 0:O.length===1&&(O=O[0])),O}function y(O,P){let L=0;const U={};for(const R in O){if(!R.startsWith(c.qz))continue;let B=C(P[R]),H=C(O[R]);(0,t.isEqual)(H,B)||(U[R]={value:O[R]},L++)}for(const R in P){if(!R.startsWith(c.qz))continue;const B=P[R];(0,t.isArray)(B)&&B.length===0||O.hasOwnProperty(R)||(U[R]={value:"",removed:!0},L++)}return L?U:void 0}function M(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 T(O,P=(0,g.Gu)()){return(0,i.nx)(O,P).transaction.status!==l.x8.NotStarted}function I(O){return String(O)}const x=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 S(O,P){return{type:O.type,id:O.id,data:P}}},1819:(Q,A,e)=>{"use strict";e.d(A,{e:()=>h});var t=e(32196),n=e(96540),o=e(28240),s=e(83195),r=e(14588),g=e(32264),u=e(52622),c=e(40845),i=e(72109),l=e(61994),f=e(74007);function d(m,a,v,E,D){const b=m.fields,C=v!=null?b[v]:null,y=b.filter(O=>!O.config.custom?.hideFrom?.tooltip),M=y.find(O=>O.name==="traceID")||b[0],T=[];if(y.filter(O=>M===O).length>0&&T.push(M),T.push(...y.filter(O=>M!==O)),T.length===0)return null;const I=[],x=[],S=new Set;for(const O of T){if(D===u.$N.Single&&O!==C)continue;const P=O.values[a],L=O.display?O.display(P):{text:`${P}`,numeric:+P};O.getLinks&&O.getLinks({calculatedValue:L,valueRowIndex:a}).forEach(U=>{const R=`${U.title}/${U.href}`;S.has(R)||(x.push(U),S.add(R))}),I.push({name:(0,o.Ct)(O,m),value:P,valueString:(0,s.cN)(L),highlight:O===C})}return E&&E!==u.xB.None&&I.sort((O,P)=>r.sortValues(E)(O.value,P.value)),{displayValues:I,links:x}}const h=({data:m,rowIndex:a,columnIndex:v,sortOrder:E,mode:D,header:b,padding:C=0})=>{const y=(0,c.of)(p,C);if(!m||a==null)return null;const M=d(m,a,v,E,D);if(M==null)return null;const{displayValues:T,links:I}=M;return g.$.featureToggles.newVizTooltips&&b==="Exemplar"?n.createElement(f.i,{displayValues:T,links:I,header:b}):n.createElement("div",{className:y.wrapper},b&&n.createElement("div",{className:y.header},n.createElement("span",{className:y.title},b)),n.createElement("table",{className:y.infoWrap},n.createElement("tbody",null,T.map((x,S)=>n.createElement("tr",{key:`${S}/${a}`},n.createElement("th",null,x.name),n.createElement("td",null,(0,l.A)(x.valueString)))),I.map((x,S)=>n.createElement("tr",{key:S},n.createElement("th",null,"Link"),n.createElement("td",{colSpan:2},n.createElement(i.Y,{href:x.href,external:x.target==="_blank",weight:"medium",inline:!1},x.title)))))))},p=(m,a=0)=>({wrapper:(0,t.css)({padding:`${a}px`,background:m.components.tooltip.background,borderRadius:m.shape.borderRadius(2)}),header:(0,t.css)({background:m.colors.background.secondary,alignItems:"center",alignContent:"center",display:"flex",paddingBottom:m.spacing(1)}),title:(0,t.css)({fontWeight:m.typography.fontWeightMedium,overflow:"hidden",display:"inline-block",whiteSpace:"nowrap",textOverflow:"ellipsis",flexGrow:1}),infoWrap:(0,t.css)({padding:m.spacing(1),background:"transparent",border:"none",th:{fontWeight:m.typography.fontWeightMedium,padding:m.spacing(.25,2,.25,0)},tr:{borderBottom:`1px solid ${m.colors.border.weak}`,"&:last-child":{borderBottom:"none"}}}),link:(0,t.css)({color:m.colors.text.link})})},74007:(Q,A,e)=>{"use strict";e.d(A,{i:()=>u});var t=e(32196),n=e(96540),o=e(40845),s=e(55852),r=e(13471),g=e(61994);const u=({displayValues:i,links:l,header:f="Exemplar"})=>{const d=(0,o.of)(c),h=i.find(p=>p.name==="Time");return i=i.filter(p=>p.name!=="Time"),n.createElement("div",{className:d.exemplarWrapper},n.createElement("div",{className:d.exemplarHeader},n.createElement("span",{className:d.title},f),h&&n.createElement("span",{className:d.time},(0,g.A)(h.valueString))),n.createElement("div",{className:d.exemplarContent},i.map((p,m)=>n.createElement(r.B,{key:m,label:p.name,value:(0,g.A)(p.valueString),justify:"space-between",isPinned:!1}))),l&&n.createElement("div",{className:d.exemplarFooter},l.map((p,m)=>n.createElement(s.z9,{key:m,href:p.href,className:d.linkButton},p.title))))},c=(i,l=0)=>({exemplarWrapper:(0,t.css)({display:"flex",flexDirection:"column",flex:1,gap:4,whiteSpace:"pre",borderRadius:i.shape.radius.default,background:i.colors.background.primary,border:`1px solid ${i.colors.border.weak}`,boxShadow:`0 4px 8px ${i.colors.background.primary}`}),exemplarHeader:(0,t.css)({display:"flex",flexDirection:"column",alignItems:"flex-start",gap:i.spacing(.5),color:i.colors.text.secondary,padding:i.spacing(1)}),time:(0,t.css)({color:i.colors.text.primary}),exemplarContent:(0,t.css)({display:"flex",flexDirection:"column",flex:1,gap:4,borderTop:`1px solid ${i.colors.border.medium}`,padding:i.spacing(1)}),exemplarFooter:(0,t.css)({display:"flex",flexDirection:"column",flex:1,borderTop:`1px solid ${i.colors.border.medium}`,padding:i.spacing(1),overflowX:"auto",overflowY:"hidden",whiteSpace:"nowrap"}),linkButton:(0,t.css)({width:"fit-content"}),label:(0,t.css)({color:i.colors.text.secondary,fontWeight:400,textOverflow:"ellipsis",overflow:"hidden",marginRight:i.spacing(.5)}),value:(0,t.css)({fontWeight:500,textOverflow:"ellipsis",overflow:"hidden"}),title:(0,t.css)({fontWeight:i.typography.fontWeightMedium,overflow:"hidden",display:"inline-block",whiteSpace:"nowrap",textOverflow:"ellipsis",flexGrow:1})})},9301:(Q,A,e)=>{"use strict";var t=e(6262),n=e(9423),o=e(7452),s=e(78624),r=e(4213),g=e(34796),u=e(13609),c=e(31193),i=e(17493),l=e(14792),f=e(15858),d=e(16495),h=e(92107),p=e(2543),m=e.n(p),a=e(96540),v=e(5338),E=e(47232),D=e(1933),b=e(69550),C=e(97497),y=e(96915),M=e(71733),T=e(17172),I=e(23509),x=e(12131),S=e(96937),O=e(3591),P=e(63639),L=e(89191),U=e(19347),R=e(4402),B=e(14778),H=e(63415),w=e(97152),N=e(24308),V=e(46235),G=e(5260),_=e(2913),K=e(94041),j=e(32264),k=e(11261),Y=e(85200),ee=e(1173),re=e(28240),J=e(18282),ne=e(57934),q=e(73376),te=e(14186),oe=e(94354),ue=e(90613),ie=e(55852),ge=e(91847);function he(F){if(F in ge.uk){const{name:z,getHelperDocs:X,links:ce}=ge.uk[F],Ce=X(ge.g_.UIImage),Ae=De(Ce);if(ce?.length){const Fe=ce.map(Qe=>` Or visit <a href="${Qe.url}" target="_blank">${Qe.title}</a> `).join("");return{name:z,helperDocs:` ${Ae} ${(0,ge.$n)()} ${Fe} `}}return{name:z,helperDocs:` ${Ae} ${(0,ge.$n)()} `}}return{name:"No documentation found",helperDocs:(0,ge.$n)()}}const De=F=>F.replace(/\[(.*?)\]\(#.*?\)/g,"$1").replace(/\[[^\]]*\]\[\]/g,"");var pe=e(39268),le=e(88323),Te=e(83077),Ee=e(91890),Re=e(72574),me=e(10354),Me=e(88841),ye=e(94397);function Le(F,z){switch(z.type){case k.PU.boolean:return(0,p.isUndefined)(F)?!1:We(F);case k.PU.number:return isNaN(F)?0:parseFloat(F);case k.PU.string:return F?String(F):"";default:return F}}const We=F=>(0,p.isString)(F)?!(F[0]==="F"||F[0]==="f"||F[0]==="0"):!!F;function Be(F){return function({options:X,onChange:ce,field:Ce}){const{validator:Ae,converter:Fe=Le}=F,{value:Qe}=X,[qe,ut]=(0,a.useState)(!Ae(Qe)),Ct=(0,Re.w)().getVariables().map(kt=>({value:kt.name,label:kt.label||kt.name,origin:Ee.$0.Template})),Ht=(0,a.useCallback)(kt=>{ut(!Ae(kt.currentTarget.value))},[ut,Ae]),Nt=(0,a.useCallback)(kt=>{if(qe)return;const{value:En}=kt.currentTarget;ce({...X,value:Fe(En,Ce)})},[X,ce,qe,Ce,Fe]),At=(0,a.useCallback)(kt=>{ut(!Ae(kt)),ce({...X,value:kt})},[ut,Ae,ce,X]);return j.$.featureToggles.transformationsVariableSupport?a.createElement(Me.y,{invalid:qe,value:Qe,error:"Value needs to be an integer or a variable",onChange:At,placeholder:"Value or variable",suggestions:Ct}):a.createElement(me.p,{className:"flex-grow-1",invalid:qe,defaultValue:String(X.value),placeholder:"Value",onChange:Ht,onBlur:Nt})}}const Ye=()=>[{name:"Is greater",id:ee.Js.greater,component:Be({validator:ye.N_})},{name:"Is greater or equal",id:ee.Js.greaterOrEqual,component:Be({validator:ye.N_})},{name:"Is lower",id:ee.Js.lower,component:Be({validator:ye.N_})},{name:"Is lower or equal",id:ee.Js.lowerOrEqual,component:Be({validator:ye.N_})},{name:"Is equal",id:ee.Js.equal,component:Be({validator:()=>!0})},{name:"Is not equal",id:ee.Js.notEqual,component:Be({validator:()=>!0})}],at=()=>null,st=()=>[{name:"Is null",id:ee.Js.isNull,component:at},{name:"Is not null",id:ee.Js.isNotNull,component:at}];function Ke(F){return function({options:X,onChange:ce,field:Ce}){const{validator:Ae}=F,[Fe,Qe]=(0,a.useState)({from:!Ae(X.from),to:!Ae(X.to)}),ut=(0,Re.w)().getVariables().map(Nt=>({value:Nt.name,label:Nt.label||Nt.name,origin:Ee.$0.Template})),vt=(0,a.useCallback)((Nt,At)=>{Qe({...Fe,[At]:!Ae(Nt.currentTarget.value)})},[Qe,Ae,Fe]),Ct=(0,a.useCallback)((Nt,At)=>{if(Fe[At])return;const{value:kt}=Nt.currentTarget;ce({...X,[At]:Le(kt,Ce)})},[X,ce,Fe,Ce]),Ht=(0,a.useCallback)((Nt,At)=>{const kt=!Ae(Nt);Qe({...Fe,[At]:kt}),!kt&&ce({...X,[At]:Nt})},[X,ce,Fe,Qe,Ae]);return j.$.featureToggles.transformationsVariableSupport?a.createElement(a.Fragment,null,a.createElement(Me.y,{value:String(X.from),invalid:Fe.from,error:"Value needs to be an integer or a variable",placeholder:"From",onChange:Nt=>Ht(Nt,"from"),suggestions:ut}),a.createElement("div",{className:"gf-form-label"},"and"),a.createElement(Me.y,{invalid:Fe.to,error:"Value needs to be an integer or a variable",value:String(X.to),placeholder:"To",suggestions:ut,onChange:Nt=>Ht(Nt,"to")})):a.createElement(a.Fragment,null,a.createElement(me.p,{className:"flex-grow-1 gf-form-spacing",invalid:Fe.from,defaultValue:String(X.from),placeholder:"From",onChange:Nt=>vt(Nt,"from"),onBlur:Nt=>Ct(Nt,"from")}),a.createElement("div",{className:"gf-form-label"},"and"),a.createElement(me.p,{className:"flex-grow-1",invalid:Fe.to,defaultValue:String(X.to),placeholder:"To",onChange:Nt=>vt(Nt,"to"),onBlur:Nt=>Ct(Nt,"to")}))}}const Xe=()=>[{name:"Is between",id:ee.Js.between,component:Ke({validator:ye.N_})}];function He(F){return function({options:X,onChange:ce,field:Ce}){const{validator:Ae,converter:Fe=Le}=F,{value:Qe}=X,[qe,ut]=(0,a.useState)(!Ae(Qe)),vt=(0,a.useCallback)(Ht=>{ut(!Ae(Ht.currentTarget.value))},[ut,Ae]),Ct=(0,a.useCallback)(Ht=>{if(qe)return;const{value:Nt}=Ht.currentTarget;ce({...X,value:Fe(Nt,Ce)})},[X,ce,qe,Ce,Fe]);return a.createElement(me.p,{className:"flex-grow-1",invalid:qe,defaultValue:String(X.value),placeholder:"Value",onChange:vt,onBlur:Ct})}}const Ge=()=>[{name:"Regex",id:ee.Js.regex,component:He({validator:()=>!0,converter:F=>String(F)})}],xe=new Te.O(()=>[...Ye(),...st(),...Xe(),...Ge()]),$e=F=>{const{onDelete:z,onChange:X,filter:ce,fieldsInfo:Ce}=F,{fieldsAsOptions:Ae,fieldByDisplayName:Fe}=Ce,Qe=ae(ce,Ae)??"",qe=Fe[Qe],ut=qe?be(qe):[],vt=Z(ce,ut),Ct=xe.getIfExists(vt),Ht=(0,a.useCallback)(kt=>{kt?.value&&X({...ce,fieldName:kt.value})},[X,ce]),Nt=(0,a.useCallback)(kt=>{if(!kt?.value)return;const En=kt.value,Ma=Y.hI.get(En).getDefaultOptions(qe);X({...ce,config:{id:En,options:Ma}})},[X,ce,qe]),At=(0,a.useCallback)(kt=>{X({...ce,config:{...ce.config,options:kt}})},[X,ce]);return!qe||!Ct||!Ct.component?null:a.createElement(pe.C,null,a.createElement(te.I,{label:"Field",labelWidth:14},a.createElement(le.l6,{className:"min-width-15 max-width-24",placeholder:"Field Name",options:Ae,value:ce.fieldName,onChange:Ht})),a.createElement(te.I,{label:"Match"},a.createElement(le.l6,{className:"width-12",placeholder:"Select test",options:ut,value:vt,onChange:Nt})),a.createElement(te.I,{label:"Value",grow:!0},a.createElement(Ct.component,{field:qe,options:ce.config.options??{},onChange:At})),a.createElement(ue.a,{marginBottom:.5},a.createElement(ie.$n,{icon:"times",onClick:z,variant:"secondary"})))},be=F=>{const z=[];for(const X of Y.hI.list())!X.isApplicable(F)||!xe.getIfExists(X.id)||z.push({value:X.id,label:X.name,description:X.description});return z},Z=(F,z)=>{const X=z.find(ce=>ce.value===F.config.id);if(X&&X.value)return X.value;if(z[0]?.value)return z[0]?.value},ae=(F,z)=>{const X=z.find(ce=>ce.value===F.fieldName);if(X&&X.value)return X.value;if(z[0]?.value)return z[0]?.value},de=[{label:"Include",value:q.j4.include},{label:"Exclude",value:q.j4.exclude}],ve=[{label:"Match all",value:q.Sm.all},{label:"Match any",value:q.Sm.any}],Ue=F=>{const{input:z,options:X,onChange:ce}=F,Ce=ze(z),Ae=(0,a.useCallback)(()=>{const vt=z[0],Ct=vt.fields.find(At=>At.type!==k.PU.time);if(!Ct)return;const Ht=(0,p.cloneDeep)(X.filters),Nt=Y.hI.get(ee.Js.greater);Ht.push({fieldName:(0,re.Ct)(Ct,vt,z),config:{id:Nt.id,options:Nt.getDefaultOptions(Ct)}}),ce({...X,filters:Ht})},[ce,X,z]),Fe=(0,a.useCallback)(vt=>{let Ct=(0,p.cloneDeep)(X.filters);Ct.splice(vt,1),ce({...X,filters:Ct})},[X,ce]),Qe=(0,a.useCallback)((vt,Ct)=>{let Ht=(0,p.cloneDeep)(X.filters);Ht[Ct]=vt,ce({...X,filters:Ht})},[X,ce]),qe=(0,a.useCallback)(vt=>{ce({...X,type:vt??q.j4.include})},[X,ce]),ut=(0,a.useCallback)(vt=>{ce({...X,match:vt??q.Sm.all})},[X,ce]);return a.createElement("div",null,a.createElement(te.I,{label:"Filter type",labelWidth:16},a.createElement("div",{className:"width-15"},a.createElement(oe.z,{options:de,value:X.type,onChange:qe,fullWidth:!0}))),a.createElement(te.I,{label:"Conditions",labelWidth:16},a.createElement("div",{className:"width-15"},a.createElement(oe.z,{options:ve,value:X.match,onChange:ut,fullWidth:!0}))),a.createElement(ue.a,{paddingLeft:2},X.filters.map((vt,Ct)=>a.createElement($e,{key:Ct,filter:vt,fieldsInfo:Ce,onChange:Ht=>Qe(Ht,Ct),onDelete:()=>Fe(Ct)})),a.createElement(ie.$n,{icon:"plus",size:"sm",onClick:Ae,variant:"secondary"},"Add condition")))},_e={id:J.F.filterByValue,editor:Ue,transformation:ne.c.filterByValueTransformer,name:ne.c.filterByValueTransformer.name,description:"Removes rows of the query results using user-defined filters. This is useful if you can not filter your data in the data source.",categories:new Set([C.m.Filter]),help:he(J.F.filterByValue).helperDocs},ze=F=>(0,a.useMemo)(()=>{const z={fieldsAsOptions:[],fieldByDisplayName:{}};return Array.isArray(F)?F.reduce((X,ce)=>ce.fields.reduce((Ce,Ae)=>{const Fe=(0,re.Ct)(Ae,ce,F);return Ce.fieldByDisplayName[Fe]||(Ce.fieldsAsOptions.push({label:Fe,value:Fe,type:Ae.type}),Ce.fieldByDisplayName[Fe]=Ae),Ce},X),z):z},[F]);var Ve=e(43429),Ne=e(60264),ot=e(48192),nt=e(7600),pt=e(54612);function mt(F,z){const X={data:F.input,options:F.options},ce=new ot.C({id:"root",title:"root"}),Ce=Fe=>{if(Fe?.length){const Qe=Fe[0];let qe=ce.categories.find(ut=>ut.props.id===Qe);return qe||(qe=new ot.C({id:Qe,title:Qe}),ce.categories.push(qe)),qe}return ce},Ae={getValue:Fe=>(0,p.get)(F.options,Fe),onChange:(Fe,Qe)=>{F.onChange((0,pt.Sf)(F.options,Fe,Qe))}};return(0,nt.g5)(z,Ae,Ce,X),ce}function gt(F){const z={data:[],options:{}},X={},ce=new Ne.pv;F(ce,z);for(const Ce of ce.getItems())Ce.defaultValue!=null&&(0,p.set)(X,Ce.path,Ce.defaultValue);return X}var Pt=e(27825),Mt=e(3290);const Yt=(F,z)=>{const X=z.options??{};(0,Pt.J)("",F,X)},zt=F=>{(0,a.useEffect)(()=>{if(!F.options.xBuckets?.mode){const X=gt(Yt);F.onChange({...X,...F.options})}});const z=mt(F,Yt);return a.createElement("div",null,a.createElement("div",null,z.items.map(X=>X.render())))},_t={id:Mt.wY.id,editor:zt,transformation:Mt.wY,name:Mt.wY.name,description:Mt.wY.description,state:Ve.pn.alpha,categories:new Set([C.m.CreateNewVisualization]),help:he(Mt.wY.id).helperDocs};var rt=e(32196),It=e(40845),Dn=e(84349),ft=e(75059),yt=e(42734),jt=e(24293),cn=e(28802),pn=e(50082),on=e(25019);function Xt(F,z,X){const ce={},Ce={};for(const Ae of F.fields){const Fe=(0,re.Ct)(Ae,F),qe=X.index[Fe].handler;if(!qe)continue;const ut=Ae.values[z];if(ut==null)continue;const vt=qe.processor(ut,ce,Ce);vt!=null&&(ce[qe.targetProperty??qe.key]=vt)}return Ce.mappingValues&&(ce.mappings=hn(Ce)),ce}var fn=(F=>(F.Name="field.name",F.Value="field.value",F.Label="field.label",F.Ignore="__ignore",F))(fn||{});const An=[{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:qt},{key:"min",processor:qt},{key:"unit",processor:F=>F.toString()},{key:"decimals",processor:qt},{key:"displayName",name:"Display name",processor:F=>F.toString()},{key:"color",processor:F=>({fixedColor:F,mode:jt.Y.Fixed})},{key:"threshold1",targetProperty:"thresholds",processor:(F,z)=>{const X=(0,cn.t)(F);if(!isNaN(X))return z.thresholds||(z.thresholds={mode:pn.O.Absolute,steps:[{value:-1/0,color:"green"}]}),z.thresholds.steps.push({value:X,color:"red"}),z.thresholds}},{key:"mappings.value",name:"Value mappings / Value",targetProperty:"mappings",defaultReducer:ft.gy.allValues,processor:(F,z,X)=>{if((0,p.isArray)(F))return X.mappingValues=F,z.mappings}},{key:"mappings.color",name:"Value mappings / Color",targetProperty:"mappings",defaultReducer:ft.gy.allValues,processor:(F,z,X)=>{if((0,p.isArray)(F))return X.mappingColors=F,z.mappings}},{key:"mappings.text",name:"Value mappings / Display text",targetProperty:"mappings",defaultReducer:ft.gy.allValues,processor:(F,z,X)=>{if((0,p.isArray)(F))return X.mappingTexts=F,z.mappings}}];function hn(F){const z={type:on.d.ValueToText,options:{}};if(!F.mappingValues)return[];for(let X=0;X<F.mappingValues.length;X++){const ce=F.mappingValues[X];ce!=null&&(z.options[ce.toString()]={color:F.mappingColors&&F.mappingColors[X],text:F.mappingTexts&&F.mappingTexts[X],index:X})}return[z]}let ca=null;function Rt(){if(ca===null){ca={};for(const F of An)ca[F.key]=F}return ca}function qt(F){const z=(0,cn.t)(F);if(!isNaN(z))return z}function gn(F,z){for(const X of z)if(F===X.fieldName)return X.handlerKey;return F.toLowerCase()}function Cn(F){return F?Rt()[F]:null}function mn(F,z,X){const ce={index:{}};let Ce=z.find(Fe=>Fe.handlerKey==="field.name"),Ae=z.find(Fe=>Fe.handlerKey==="field.value");for(const Fe of F.fields){const Qe=(0,re.Ct)(Fe,F),qe=z.find(Ct=>Ct.fieldName===Qe),ut=qe?qe.handlerKey:Qe.toLowerCase();let vt=Cn(ut);X&&(vt?(vt.key==="field.name"&&(ce.nameField=Fe),vt.key==="field.value"&&(ce.valueField=Fe)):qe||(!ce.nameField&&!Ce&&Fe.type===k.PU.string&&(ce.nameField=Fe,vt=Cn("field.name")),!ce.valueField&&!Ae&&Fe.type===k.PU.number&&(ce.valueField=Fe,vt=Cn("field.value")))),!vt&&X&&(vt=Cn("field.label")),ce.index[Qe]={automatic:!qe,handler:vt,reducerId:qe?.reducerId??vt?.defaultReducer??ft.gy.lastNotNull}}return ce}function Sn({frame:F,mappings:z,onChange:X,withReducers:ce,withNameAndValue:Ce}){const Ae=(0,It.of)(Mn),Fe=Tn(F,z,Ce),Qe=An.map(vt=>$n(vt,!1)),qe=(vt,Ct)=>{const Ht=z.findIndex(Nt=>Nt.fieldName===vt.fieldName);if(Ct)if(Ht!==-1){const Nt=[...z];Nt.splice(Ht,1,{...z[Ht],handlerKey:Ct.value}),X(Nt)}else X([...z,{fieldName:vt.fieldName,handlerKey:Ct.value}]);else X(Ht!==-1?z.filter((Nt,At)=>At!==Ht):[...z,{fieldName:vt.fieldName,handlerKey:"__ignore"}])},ut=(vt,Ct)=>{const Ht=z.findIndex(Nt=>Nt.fieldName===vt.fieldName);if(Ht!==-1){const Nt=[...z];Nt.splice(Ht,1,{...z[Ht],reducerId:Ct}),X(Nt)}else X([...z,{fieldName:vt.fieldName,handlerKey:vt.handlerKey,reducerId:Ct}])};return a.createElement("table",{className:Ae.table},a.createElement("thead",null,a.createElement("tr",null,a.createElement("th",null,"Field"),a.createElement("th",null,"Use as"),ce&&a.createElement("th",null,"Select"))),a.createElement("tbody",null,Fe.map(vt=>a.createElement("tr",{key:vt.fieldName},a.createElement("td",{className:Ae.labelCell},vt.fieldName),a.createElement("td",{className:Ae.selectCell,"data-testid":`${vt.fieldName}-config-key`},a.createElement(le.l6,{options:Qe,value:vt.configOption,placeholder:vt.placeholder,isClearable:!0,onChange:Ct=>qe(vt,Ct)})),ce&&a.createElement("td",{"data-testid":`${vt.fieldName}-reducer`,className:Ae.selectCell},a.createElement(yt.S,{stats:[vt.reducerId],defaultStat:vt.reducerId,onChange:Ct=>ut(vt,Ct[0])}))))))}function Tn(F,z,X){const ce=[],Ce=mn(F,z??[],X);for(const Ae of F.fields){const Fe=(0,re.Ct)(Ae,F),Qe=Ce.index[Fe],qe=$n(Qe.handler,Qe.automatic);ce.push({fieldName:Fe,configOption:Qe.automatic?null:qe,placeholder:Qe.automatic?qe?.label:"Choose",handlerKey:Qe.handler?.key??null,reducerId:Qe.reducerId})}for(const Ae of z)if(!ce.find(Fe=>Fe.fieldName===Ae.fieldName)){const Fe=Cn(Ae.handlerKey);ce.push({fieldName:Ae.fieldName,handlerKey:Ae.handlerKey,configOption:$n(Fe,!1),missingInFrame:!0,reducerId:Ae.reducerId??ft.gy.lastNotNull})}return Object.values(ce)}function $n(F,z){if(!F)return null;let X=F.name??(0,p.capitalize)(F.key);return z&&(X=`${X} (auto)`),{label:X,value:F.key}}const Mn=F=>({table:(0,rt.css)` margin-top: ${F.spacing(1)}; td, th { border-right: 4px solid ${F.colors.background.primary}; border-bottom: 4px solid ${F.colors.background.primary}; white-space: nowrap; } th { font-size: ${F.typography.bodySmall.fontSize}; line-height: ${F.spacing(4)}; padding: ${F.spacing(0,1)}; } `,labelCell:(0,rt.css)` font-size: ${F.typography.bodySmall.fontSize}; background: ${F.colors.background.secondary}; padding: ${F.spacing(0,1)}; max-width: 400px; overflow: hidden; text-overflow: ellipsis; min-width: 140px; `,selectCell:(0,rt.css)` padding: 0; min-width: 161px; `});var Ln=e(81160);function na(F,z){let X=null;for(const Qe of z)if(Qe.refId===F.configRefId){X=Qe;break}if(!X)return z;const ce={fields:[],length:1},Ce=mn(X,F.mappings??[],!1);for(const Qe of X.fields){const qe={...Qe},ut=(0,re.Ct)(Qe,X),vt=Ce.index[ut],Ct=(0,ft.Nw)({field:Qe,reducers:[vt.reducerId]});qe.values=[Ct[vt.reducerId]],ce.fields.push(qe)}const Ae=[],Fe=(0,Y.NS)(F.applyTo||{id:ee.Ct.numeric});for(const Qe of z){if(Qe===X&&z.length>1)continue;const qe={fields:[],length:Qe.length,refId:Qe.refId};for(const ut of Qe.fields)if(Fe(ut,Qe,z)){const vt=Xt(ce,0,Ce);qe.fields.push({...ut,config:{...ut.config,...vt}})}else qe.fields.push(ut);Ae.push(qe)}return Ae}const pa={id:J.F.configFromData,name:"Config from query results",description:"Set unit, min, max and more from data.",defaultOptions:{configRefId:"config",mappings:[]},operator:F=>z=>z.pipe((0,Ln.T)(X=>na(F,X)))};function ia({input:F,onChange:z,options:X}){const ce=(0,It.of)(Da),Ce=F.map(Nt=>Nt.refId).filter(Nt=>Nt!=null).map(Nt=>({label:Nt,value:Nt})),Ae=X.configRefId||"config",Fe=X.applyTo??{id:ee.Ct.byType,options:"number"},Qe=Dn.g.get(Fe.id),qe=F.find(Nt=>Nt.refId===Ae),ut=Nt=>{z({...X,configRefId:Nt.value||"config"})},vt=Nt=>{z({...X,applyTo:{id:Nt.value}})},Ct=Nt=>{z({...X,applyTo:{id:Fe.id,options:Nt}})},Ht=Dn.g.list().filter(Nt=>!Nt.excludeFromPicker).map(Nt=>({label:Nt.name,value:Nt.id,description:Nt.description}));return a.createElement(a.Fragment,null,a.createElement(pe.C,null,a.createElement(te.I,{label:"Config query",labelWidth:20},a.createElement(le.l6,{onChange:ut,options:Ce,value:Ae,width:30}))),a.createElement(pe.C,null,a.createElement(te.I,{label:"Apply to",labelWidth:20},a.createElement(le.l6,{onChange:vt,options:Ht,value:Fe.id,width:30}))),a.createElement(pe.C,null,a.createElement(te.I,{label:"Apply to options",labelWidth:20,className:ce.matcherOptions},a.createElement(Qe.component,{matcher:Qe.matcher,data:F,options:Fe.options,onChange:Ct}))),a.createElement(pe.C,null,qe&&a.createElement(Sn,{frame:qe,mappings:X.mappings,onChange:Nt=>z({...X,mappings:Nt}),withReducers:!0})))}const Xn={id:pa.id,editor:ia,transformation:pa,name:pa.name,description:pa.description,state:Ve.pn.beta,categories:new Set([C.m.CalculateNewFields]),help:he(pa.id).helperDocs},Da=F=>({matcherOptions:(0,rt.css)` min-width: 404px; `});var ba=e(62467),Oa=e(58307),sa=e(66350),Jn=e(15292),Va=e(11710);const ts=16,Ds=F=>{const{options:z,onChange:X}=F,{binary:ce}=z;let Ce=!ce?.left,Ae=!ce?.right;const Fe=F.names.map(At=>(At===ce?.left&&(Ce=!0),At===ce?.right&&(Ae=!0),{label:At,value:At})),Qe=Ce?Fe:[...Fe,{label:ce?.left,value:ce?.left}],qe=Ae?Fe:[...Fe,{label:ce?.right,value:ce?.right}],ut=Va.b.list().map(At=>({label:At.binaryOperationID,value:At.binaryOperationID})),vt=At=>{X({...z,mode:sa.UY.BinaryOperation,binary:At})},Ct=At=>{vt({...ce,left:At.value})},Ht=At=>{vt({...ce,right:At.value})},Nt=At=>{vt({...ce,operator:At.value})};return a.createElement(a.Fragment,null,a.createElement(pe.C,null,a.createElement(te.I,{label:"Operation",labelWidth:ts},a.createElement(le.l6,{allowCustomValue:!0,placeholder:"Field or number",options:Qe,className:"min-width-18",value:ce?.left,onChange:Ct})),a.createElement(te.I,null,a.createElement(le.l6,{className:"width-4",options:ut,value:ce?.operator??ut[0].value,onChange:Nt})),a.createElement(te.I,null,a.createElement(le.l6,{allowCustomValue:!0,placeholder:"Field or number",className:"min-width-10",options:qe,value:ce?.right,onChange:Ht}))))},Ms=F=>{const{names:z,onChange:X,options:ce}=F,{cumulative:Ce}=ce,Ae=z.map(ut=>({label:ut,value:ut})),Fe=ut=>{const vt=ut.length?ut[0]:ft.gy.sum;Qe({...Ce,reducer:vt})},Qe=ut=>{X({...ce,mode:sa.UY.CumulativeFunctions,cumulative:ut})},qe=ut=>{Qe({...Ce,field:ut.value})};return a.createElement(a.Fragment,null,a.createElement(te.I,{label:"Field",labelWidth:ts},a.createElement(le.l6,{placeholder:"Field",options:Ae,className:"min-width-18",value:Ce?.field,onChange:qe})),a.createElement(te.I,{label:"Calculation",labelWidth:ts},a.createElement(yt.S,{allowMultiple:!1,className:"width-18",stats:[Ce?.reducer||ft.gy.sum],onChange:Fe,defaultStat:ft.gy.sum,filterOptions:ut=>ut.id===ft.gy.sum||ut.id===ft.gy.mean})))},Ns=F=>{const{options:z,onChange:X}=F,{index:ce}=z,Ce=Ae=>{X({...z,index:{asPercentile:Ae.currentTarget.checked}})};return a.createElement(a.Fragment,null,a.createElement(te.I,{labelWidth:ts,label:"As percentile",tooltip:"Transform the row index as a percentile."},a.createElement(Jn.K,{value:!!ce?.asPercentile,onChange:Ce})))};var cs=e(66864),Ps=e(92174);const ir=F=>{const{names:z,selected:X,onChange:ce,options:Ce}=F,{reduce:Ae}=Ce,Fe=vt=>{ce({...Ce,reduce:vt})},Qe=vt=>{X.indexOf(vt)>-1?qe(X.filter(Ct=>Ct!==vt)):qe([...X,vt])},qe=vt=>{Fe({...Ae,include:vt})},ut=vt=>{const Ct=vt.length?vt[0]:ft.gy.sum,{reduce:Ht}=Ce;Fe({...Ht,reducer:Ct})};return a.createElement(a.Fragment,null,a.createElement(te.I,{label:"Operation",labelWidth:ts,grow:!0},a.createElement(cs.Gy,{spacing:"xs",align:"flex-start",wrap:!0},z.map((vt,Ct)=>a.createElement(Ps.m,{key:`${vt}/${Ct}`,onClick:()=>{Qe(vt)},label:vt,selected:X.indexOf(vt)>-1})))),a.createElement(te.I,{label:"Calculation",labelWidth:ts},a.createElement(yt.S,{allowMultiple:!1,className:"width-18",stats:[Ae?.reducer||ft.gy.sum],onChange:ut,defaultStat:ft.gy.sum})))};var Cs=e(27618),as=e(76892);const ar=F=>{const{options:z,onChange:X}=F,{unary:ce}=z,Ce=Ct=>{X({...z,mode:sa.UY.UnaryOperation,unary:Ct})},Ae=Ct=>{Ce({...ce,operator:Ct.value})},Fe=Ct=>{Ce({...ce,fieldName:Ct.value})};let Qe=!ce?.fieldName;const qe=F.names.map(Ct=>(Ct===ce?.fieldName&&(Qe=!0),{label:Ct,value:Ct})),ut=Cs.j.list().map(Ct=>({label:Ct.unaryOperationID,value:Ct.unaryOperationID})),vt=Qe?qe:[...qe,{label:ce?.fieldName,value:ce?.fieldName}];return a.createElement(a.Fragment,null,a.createElement(pe.C,null,a.createElement(te.I,{label:"Operation",labelWidth:ts},a.createElement(le.l6,{options:ut,value:ce?.operator??ut[0].value,onChange:Ae})),a.createElement(te.I,{label:"(",labelWidth:2},a.createElement(le.l6,{placeholder:"Field",className:"min-width-11",options:vt,value:ce?.fieldName,onChange:Fe})),a.createElement(as.c,{width:2},")")))};var lr=e(60188);const Is=F=>{const{options:z,names:X,onChange:ce}=F,{window:Ce}=z,Ae=X.map(At=>({label:At,value:At})),Fe=[{label:"Trailing",value:sa.ip.Trailing},{label:"Centered",value:sa.ip.Centered}],Qe=[{label:"Percentage",value:sa.Bp.Percentage},{label:"Fixed",value:sa.Bp.Fixed}],qe=At=>{ce({...z,mode:sa.UY.WindowFunctions,window:At})},ut=At=>{qe({...Ce,field:At.value})},vt=At=>{qe({...Ce,windowSize:At&&Ce?.windowSizeMode===sa.Bp.Percentage?At/100:At})},Ct=At=>{qe({...Ce,windowSize:Ce?.windowSize?At===sa.Bp.Percentage?Ce.windowSize/100:Ce.windowSize*100:void 0,windowSizeMode:At})},Ht=At=>{const kt=At.length?At[0]:ft.gy.sum;qe({...Ce,reducer:kt})},Nt=At=>{qe({...Ce,windowAlignment:At})};return a.createElement(a.Fragment,null,a.createElement(te.I,{label:"Field",labelWidth:ts},a.createElement(le.l6,{placeholder:"Field",options:Ae,className:"min-width-18",value:Ce?.field,onChange:ut})),a.createElement(te.I,{label:"Calculation",labelWidth:ts},a.createElement(yt.S,{allowMultiple:!1,className:"width-18",stats:[Ce?.reducer||ft.gy.mean],onChange:Ht,defaultStat:ft.gy.mean,filterOptions:At=>At.id===ft.gy.mean||At.id===ft.gy.variance||At.id===ft.gy.stdDev})),a.createElement(te.I,{label:"Type",labelWidth:ts},a.createElement(oe.z,{value:Ce?.windowAlignment??sa.ip.Trailing,options:Fe,onChange:Nt})),a.createElement(te.I,{label:"Window size mode"},a.createElement(oe.z,{value:Ce?.windowSizeMode??sa.Bp.Percentage,options:Qe,onChange:Ct})),a.createElement(te.I,{label:Ce?.windowSizeMode===sa.Bp.Percentage?"Window size %":"Window size",labelWidth:ts,tooltip:Ce?.windowSizeMode===sa.Bp.Percentage?"Set the window size as a percentage of the total data":"Window size"},a.createElement(lr.Q,{placeholder:"Auto",min:.1,value:Ce?.windowSize&&Ce.windowSizeMode===sa.Bp.Percentage?Ce.windowSize*100:Ce?.windowSize,onChange:vt})))},cr=[{value:sa.UY.BinaryOperation,label:"Binary operation"},{value:sa.UY.UnaryOperation,label:"Unary operation"},{value:sa.UY.ReduceRow,label:"Reduce row"},{value:sa.UY.Index,label:"Row index"}];j.$.featureToggles.addFieldFromCalculationStatFunctions&&cr.push({value:sa.UY.CumulativeFunctions,label:"Cumulative functions"},{value:sa.UY.WindowFunctions,label:"Window functions"});const Zs=new Set([k.PU.time,k.PU.number,k.PU.string]),os=F=>{const{options:z,onChange:X,input:ce}=F,Ce=z?.reduce?.include,[Ae,Fe]=(0,a.useState)({names:[],selected:[]});(0,a.useEffect)(()=>{const At={interpolate:En=>En},kt=(0,ba.of)(ce).pipe(ne.c.ensureColumnsTransformer.operator(null,At),qe(),Qe(),ut(Ce||[])).subscribe(({selected:En,names:Ma})=>{Fe({names:Ma,selected:En})});return()=>{kt.unsubscribe()}},[ce,Ce]);const Qe=()=>{if(!j.$.featureToggles.transformationsVariableSupport)return Oa.D;const At=(0,Re.w)();return kt=>kt.pipe((0,Ln.T)(En=>(En.push(...At.getVariables().map(Ma=>"$"+Ma.name)),En)))},qe=()=>At=>At.pipe((0,Ln.T)(kt=>{const En=[],Ma={};for(const $a of kt)for(const Na of $a.fields){if(!Zs.has(Na.type))continue;const Ba=(0,re.Ct)(Na,$a,kt);Ma[Ba]||(Ma[Ba]=!0,En.push(Ba))}return En})),ut=At=>kt=>kt.pipe((0,Ln.T)(En=>{if(!At.length)return{names:En,selected:[]};const Ma=[],$a=[];for(const Na of En)At.includes(Na)&&$a.push(Na),Ma.push(Na);return{names:Ma,selected:$a}})),vt=At=>{X({...z,replaceFields:At.currentTarget.checked})},Ct=At=>{const kt=At.value??sa.UY.BinaryOperation;kt===sa.UY.WindowFunctions&&(z.window=z.window??sa.Uj),X({...z,mode:kt})},Ht=At=>{X({...z,alias:At.target.value})},Nt=z.mode??sa.UY.BinaryOperation;return a.createElement(a.Fragment,null,a.createElement(te.I,{labelWidth:ts,label:"Mode"},a.createElement(le.l6,{className:"width-18",options:cr,value:cr.find(At=>At.value===Nt),onChange:Ct})),Nt===sa.UY.BinaryOperation&&a.createElement(Ds,{options:z,names:Ae.names,onChange:F.onChange}),Nt===sa.UY.UnaryOperation&&a.createElement(ar,{names:Ae.names,options:z,onChange:F.onChange}),Nt===sa.UY.ReduceRow&&a.createElement(ir,{names:Ae.names,selected:Ae.selected,options:z,onChange:F.onChange}),Nt===sa.UY.CumulativeFunctions&&a.createElement(Ms,{names:Ae.names,options:z,onChange:F.onChange}),Nt===sa.UY.WindowFunctions&&a.createElement(Is,{names:Ae.names,options:z,onChange:F.onChange}),Nt===sa.UY.Index&&a.createElement(Ns,{options:z,onChange:F.onChange}),a.createElement(te.I,{labelWidth:ts,label:"Alias"},a.createElement(me.p,{className:"width-18",value:z.alias??"",placeholder:(0,sa.sw)(z),onChange:Ht})),a.createElement(te.I,{labelWidth:ts,label:"Replace all fields"},a.createElement(Jn.K,{value:!!z.replaceFields,onChange:vt})))},is={id:J.F.calculateField,editor:os,transformation:ne.c.calculateFieldTransformer,name:ne.c.calculateFieldTransformer.name,description:"Use the row values to calculate a new field.",categories:new Set([C.m.CalculateNewFields]),help:he(J.F.calculateField).helperDocs};var Ls=e(82150);const ks=[{value:Ls.x1.FieldName,label:"Copy frame name to field name"},{value:Ls.x1.Label,label:"Add a label with the frame name"},{value:Ls.x1.Drop,label:"Ignore the frame name"}];class Pr extends a.PureComponent{constructor(z){super(z),this.onModeChanged=X=>{const{options:ce,onChange:Ce}=this.props,Ae=X.value??Ls.x1.FieldName;Ce({...ce,frameNameMode:Ae})},this.onLabelChanged=X=>{const{options:ce}=this.props;this.props.onChange({...ce,frameNameLabel:X.target.value})}}render(){const{options:z}=this.props,X=z.frameNameMode??Ls.x1.FieldName;return a.createElement("div",null,a.createElement(te.I,{label:"Name",labelWidth:16,grow:!0},a.createElement(le.l6,{width:36,options:ks,value:ks.find(ce=>ce.value===X),onChange:this.onModeChanged})),X===Ls.x1.Label&&a.createElement(te.I,{label:"Label",labelWidth:16,grow:!0},a.createElement(me.p,{width:36,value:z.frameNameLabel??"",placeholder:"frame",onChange:this.onLabelChanged})))}}const qs={id:J.F.concatenate,editor:Pr,transformation:ne.c.concatenateTransformer,name:ne.c.concatenateTransformer.name,description:"Combine all fields into a single frame. Values will be appended with undefined values if not the same length.",categories:new Set([C.m.Combine]),help:he(J.F.concatenate).helperDocs};var Cr=e(91410),Ir=e(76218),Lo=e(9988),br=e(63577),so=e(75494),hs=e(14578),Nr=e(72093),wr=e(29158);const Zr=({transformIndex:F,value:z,index:X,mappedIndex:ce,onChangeEnumValue:Ce,onRemoveEnumRow:Ae,checkIsEnumUniqueValue:Fe})=>{const Qe=(0,It.of)(Ar),[qe,ut]=(0,a.useState)(z),[vt,Ct]=(0,a.useState)(qe===""),[Ht,Nt]=(0,a.useState)(null),At=(0,a.useRef)(null);(0,a.useEffect)(()=>{At.current&&At.current.focus()},[At]);const kt=Ba=>{Ba.currentTarget.value!==""&&Fe(Ba.currentTarget.value)&&Ba.currentTarget.value!==z?Nt("Enum value already exists"):Nt(null),ut(Ba.currentTarget.value)},En=()=>{if(Ct(!1),Nt(null),qe===""||Ht!==null){Ae(ce);return}Ce(ce,qe)},Ma=Ba=>{Ba.key==="Enter"&&(Ba.preventDefault(),En())},$a=()=>{Ct(!0)},Na=()=>{Ae(ce)};return a.createElement(so.sx,{key:`${F}/${z}`,draggableId:`${F}/${z}`,index:X},Ba=>a.createElement("tr",{key:X,ref:Ba.innerRef,...Ba.draggableProps},a.createElement("td",null,a.createElement("div",{className:Qe.dragHandle,...Ba.dragHandleProps},a.createElement(hs.I,{name:"draggabledots",size:"lg"}))),vt?a.createElement("td",null,a.createElement(me.p,{ref:At,type:"text",value:qe,onChange:kt,onBlur:En,onKeyDown:Ma}),Ht&&a.createElement(Nr.P,null,Ht)):a.createElement("td",{onClick:$a,className:Qe.clickableTableCell},z&&z!==""?z:"Click to edit"),a.createElement("td",{className:Qe.textAlignCenter},a.createElement(cs.Gy,{spacing:"sm"},a.createElement(wr.K,{name:"trash-alt",onClick:Na,"data-testid":"remove-enum-row","aria-label":"Delete enum row",tooltip:"Delete"})))))},Ar=F=>({dragHandle:(0,rt.css)({cursor:"grab"}),textAlignCenter:(0,rt.css)({textAlign:"center"}),clickableTableCell:(0,rt.css)({cursor:"pointer",width:"100px","&:hover":{color:F.colors.text.maxContrast}})}),zo=Zr,$s=({input:F,options:z,transformIndex:X,onChange:ce})=>{const Ce=(0,It.of)(Ss),[Ae,Fe]=(0,a.useState)(z.conversions[X].enumConfig?.text??[]);(0,a.useEffect)(()=>{!z.conversions[X].enumConfig?.text?.length&&F.length&&Qe()},[F]),(0,a.useEffect)(()=>{(()=>{const kt=Ae.map($a=>$a),En=z.conversions,Ma={text:kt};En[X]={...En[X],enumConfig:Ma},ce({...z,conversions:En})})()},[X,Ae]);const Qe=()=>{const At=F.flatMap(En=>En?.fields??[]).find(En=>En.name===z.conversions[X].targetField);if(!At)return;const kt=new Set(At?.values);Ae.length>0&&!(0,p.isEqual)(Ae,Array.from(kt))&&!window.confirm("This action will overwrite the existing configuration. Are you sure you want to continue?")||Fe([...kt])},qe=(At,kt)=>{const En=[...Ae];En.splice(At,1,kt),Fe(En)},ut=At=>{const kt=[...Ae];kt.splice(At,1),Fe(kt)},vt=()=>{Fe(["",...Ae])},Ct=(At,kt)=>{Ae.includes(kt)||qe(At,kt)},Ht=At=>Ae.includes(At),Nt=At=>{if(!At.destination)return;const kt=Ae.length-At.source.index-1,En=Ae.length-At.destination.index-1,Ma=[...Ae],$a=Ma[kt];Ma.splice(kt,1),Ma.splice(En,0,$a),Fe(Ma)};return a.createElement(pe.C,null,a.createElement(cs.Gy,null,a.createElement(ie.$n,{size:"sm",icon:"plus",onClick:()=>Qe(),className:Ce.button},"Generate enum values from data"),a.createElement(ie.$n,{size:"sm",icon:"plus",onClick:()=>vt(),className:Ce.button},"Add enum value")),a.createElement(cs.gW,null,a.createElement("table",{className:Ce.compactTable},a.createElement(so.JY,{onDragEnd:Nt},a.createElement(so.gL,{droppableId:"sortable-enum-config-mappings",direction:"vertical"},At=>a.createElement("tbody",{ref:At.innerRef,...At.droppableProps},[...Ae].reverse().map((kt,En)=>{const Ma=Ae.length-En-1;return a.createElement(zo,{key:`${X}/${kt}`,transformIndex:X,value:kt,index:En,mappedIndex:Ma,onChangeEnumValue:Ct,onRemoveEnumRow:ut,checkIsEnumUniqueValue:Ht})}),At.placeholder))))))},Ss=F=>({compactTable:(0,rt.css)({"tbody td":{padding:F.spacing(.5)},marginTop:F.spacing(1),marginBottom:F.spacing(2)}),button:(0,rt.css)({marginTop:F.spacing(1)})}),ro={settings:{width:24,isClearable:!1}},Za=({input:F,options:z,onChange:X})=>{const ce=Lo.bx.filter(Nt=>Nt.value!==k.PU.trace),Ce=(0,ye.qt)(!0),Ae=(0,Cr.P3)();Ce.push({label:"Browser",value:"browser"}),Ce.push({label:"UTC",value:"utc"});for(const Nt of Ae)Ce.push({label:Nt,value:Nt});const Fe=(0,a.useCallback)(Nt=>At=>{const kt=z.conversions;kt[Nt]={...kt[Nt],targetField:At??"",dateFormat:void 0},X({...z,conversions:kt})},[X,z]),Qe=(0,a.useCallback)(Nt=>At=>{const kt=z.conversions;kt[Nt]={...kt[Nt],destinationType:At.value},X({...z,conversions:kt})},[X,z]),qe=(0,a.useCallback)(Nt=>At=>{const kt=z.conversions;kt[Nt]={...kt[Nt],dateFormat:At.currentTarget.value},X({...z,conversions:kt})},[X,z]),ut=(0,a.useCallback)(Nt=>At=>{const kt=z.conversions;kt[Nt]={...kt[Nt],joinWith:At.currentTarget.value},X({...z,conversions:kt})},[X,z]),vt=(0,a.useCallback)(()=>{X({...z,conversions:[...z.conversions,{targetField:void 0,destinationType:void 0,dateFormat:void 0}]})},[X,z]),Ct=(0,a.useCallback)(Nt=>{const At=z.conversions;At.splice(Nt,1),X({...z,conversions:At})},[X,z]),Ht=(0,a.useCallback)(Nt=>At=>{const kt=z.conversions;kt[Nt]={...kt[Nt],timezone:At?.value},X({...z,conversions:kt})},[X,z]);return a.createElement(a.Fragment,null,z.conversions.map((Nt,At)=>{const kt=(0,br.findField)(F?.[0],Nt.targetField);return a.createElement("div",{key:`${Nt.targetField}-${At}`},a.createElement(pe.C,null,a.createElement(te.I,{label:"Field"},a.createElement(Ir.O,{context:{data:F},value:Nt.targetField??"",onChange:Fe(At),item:ro})),a.createElement(te.I,{label:"as"},a.createElement(le.l6,{options:ce,value:Nt.destinationType,placeholder:"Type",onChange:Qe(At),width:18})),Nt.destinationType===k.PU.time&&a.createElement(te.I,{label:"Input format",tooltip:"Specify the format of the input field so Grafana can parse the date string correctly."},a.createElement(me.p,{value:Nt.dateFormat,placeholder:"e.g. YYYY-MM-DD",onChange:qe(At),width:24})),Nt.destinationType===k.PU.string&&a.createElement(a.Fragment,null,(Nt.joinWith?.length||kt?.type===k.PU.other)&&a.createElement(te.I,{label:"Join with",tooltip:"Use an explicit separator when joining array values"},a.createElement(me.p,{value:Nt.joinWith,placeholder:"JSON",onChange:ut(At),width:9})),Nt.dateFormat||kt?.type===k.PU.time&&a.createElement(a.Fragment,null,a.createElement(te.I,{label:"Date format",tooltip:"Specify the output format."},a.createElement(me.p,{value:Nt.dateFormat,placeholder:"e.g. YYYY-MM-DD",onChange:qe(At),width:24})),a.createElement(te.I,{label:"Set timezone",tooltip:"Set the timezone of the date manually"},a.createElement(le.l6,{options:Ce,value:Nt.timezone,onChange:Ht(At),isClearable:!0})))),a.createElement(ie.$n,{size:"md",icon:"trash-alt",variant:"secondary",onClick:()=>Ct(At),"aria-label":"Remove convert field type transformer"})),Nt.destinationType===k.PU.enum&&a.createElement($s,{input:F,options:z,transformIndex:At,onChange:X}))}),a.createElement(ie.$n,{size:"sm",icon:"plus",onClick:vt,variant:"secondary","aria-label":"Add a convert field type transformer"},"Convert field type"))},bs={id:J.F.convertFieldType,editor:Za,transformation:ne.c.convertFieldTypeTransformer,name:ne.c.convertFieldTypeTransformer.name,description:ne.c.convertFieldTypeTransformer.description,categories:new Set([C.m.Reformat]),help:he(J.F.convertFieldType).helperDocs};var Yn=e(54479);class St extends a.PureComponent{constructor(z){super(z),this.onFieldToggle=X=>{const{selected:ce}=this.state;ce.indexOf(X)>-1?this.onChange(ce.filter(Ce=>Ce!==X)):this.onChange([...ce,X])},this.onChange=X=>{const{regex:ce,isRegexValid:Ce}=this.state,Ae={...this.props.options,include:{names:X}};ce&&Ce&&(Ae.include=Ae.include??{},Ae.include.pattern=ce),this.setState({selected:X},()=>{this.props.onChange(Ae)})},this.onInputBlur=X=>{const{selected:ce,regex:Ce}=this.state;let Ae=!0;try{Ce&&(0,Yn.dO)(Ce)}catch{Ae=!1}Ae?this.props.onChange({...this.props.options,include:{pattern:Ce}}):this.props.onChange({...this.props.options,include:{names:ce}}),this.setState({isRegexValid:Ae})},this.onVariableChange=X=>{this.props.onChange({...this.props.options,include:{variable:X.value}}),this.setState({variable:X.value})},this.onFromVariableChange=X=>{const ce=X.currentTarget.checked;this.props.onChange({...this.props.options,byVariable:ce}),this.setState({byVariable:ce})},this.state={include:z.options.include?.names||[],regex:z.options.include?.pattern,variable:z.options.include?.variable,byVariable:z.options.byVariable||!1,options:[],variables:[],selected:[],isRegexValid:!0}}componentDidMount(){this.initOptions()}componentDidUpdate(z){this.props.input!==z.input&&this.initOptions()}initOptions(){const{input:z,options:X}=this.props,ce=Array.from(X.include?.names??[]),Ce=(0,Re.w)().getVariables().map(Qe=>({label:"$"+Qe.name,value:"$"+Qe.name})),Ae=[],Fe={};for(const Qe of z)for(const qe of Qe.fields){const ut=(0,re.Ct)(qe,Qe,z);let vt=Fe[ut];vt||(vt=Fe[ut]={name:ut,count:0},Ae.push(vt)),vt.count++}if(X.include?.pattern)try{const Qe=(0,Yn.dO)(X.include.pattern);for(const qe of Ae)Qe.test(qe.name)&&ce.push(qe.name)}catch(Qe){console.error(Qe)}if(ce.length){const Qe=Ae.filter(qe=>ce.includes(qe.name));this.setState({options:Ae,selected:Qe.map(qe=>qe.name),variables:Ce,byVariable:X.byVariable||!1,variable:X.include?.variable,regex:X.include?.pattern})}else this.setState({options:Ae,selected:Ae.map(Qe=>Qe.name),variables:Ce,byVariable:X.byVariable||!1,variable:X.include?.variable,regex:X.include?.pattern})}render(){const{options:z,selected:X,isRegexValid:ce}=this.state;return a.createElement("div",null,a.createElement(pe.C,{label:"Use variable"},a.createElement(te.I,{label:"From variable"},a.createElement(Jn.K,{value:this.state.byVariable,onChange:this.onFromVariableChange}))),this.state.byVariable?a.createElement(pe.C,null,a.createElement(te.I,{label:"Variable"},a.createElement(le.l6,{value:this.state.variable,onChange:this.onVariableChange,options:this.state.variables||[]}))):a.createElement(pe.C,{label:"Identifier"},a.createElement(te.I,{label:"Identifier",invalid:!ce,error:ce?void 0:"Invalid pattern"},a.createElement(me.p,{placeholder:"Regular expression pattern",value:this.state.regex||"",onChange:Ce=>this.setState({regex:Ce.currentTarget.value}),onBlur:this.onInputBlur,width:25})),z.map((Ce,Ae)=>{const Fe=`${Ce.name}${Ce.count>1?" ("+Ce.count+")":""}`,Qe=X.indexOf(Ce.name)>-1;return a.createElement(Ps.m,{key:`${Ce.name}/${Ae}`,onClick:()=>{this.onFieldToggle(Ce.name)},label:Fe,selected:Qe})})))}}const oo={id:J.F.filterFieldsByName,editor:St,transformation:ne.c.filterFieldsByNameTransformer,name:ne.c.filterFieldsByNameTransformer.name,description:"Removes part of the query results using a regex pattern. The pattern can be inclusive or exclusive.",categories:new Set([C.m.Filter]),help:he(J.F.filterFieldsByName).helperDocs};class vo extends a.PureComponent{constructor(z){super(z),this.onFieldToggle=X=>{const{selected:ce}=this.state;ce.indexOf(X)>-1?this.onChange(ce.filter(Ce=>Ce!==X)):this.onChange([...ce,X])},this.onChange=X=>{this.setState({selected:X}),this.props.onChange({...this.props.options,include:X.join("|")})},this.state={include:z.options.include||"",options:[],selected:[]}}componentDidMount(){this.initOptions()}componentDidUpdate(z){this.props.input!==z.input&&this.initOptions()}initOptions(){const{input:z,options:X}=this.props,ce=X.include?X.include.split("|"):[],Ce=[],Ae={};for(const Fe of z)if(Fe.refId){let Qe=Ae[Fe.refId];Qe||(Qe=Ae[Fe.refId]={refId:Fe.refId,count:0},Ce.push(Qe)),Qe.count++}if(ce.length){const Fe=[],Qe=[];for(const qe of Ce)ce.includes(qe.refId)&&Qe.push(qe),Fe.push(qe);this.setState({options:Fe,selected:Qe.map(qe=>qe.refId)})}else this.setState({options:Ce,selected:[]})}render(){const{options:z,selected:X}=this.state,{input:ce}=this.props;return a.createElement(a.Fragment,null,ce.length<=1&&a.createElement("div",null,a.createElement(Nr.P,null,"Filter data by query expects multiple queries in the input.")),a.createElement(te.I,{label:"Series refId",labelWidth:16,shrink:!0},a.createElement(cs.Gy,{spacing:"xs",align:"flex-start",wrap:!0},z.map((Ce,Ae)=>{const Fe=`${Ce.refId}${Ce.count>1?" ("+Ce.count+")":""}`,Qe=X.indexOf(Ce.refId)>-1;return a.createElement(Ps.m,{key:`${Ce.refId}/${Ae}`,onClick:()=>{this.onFieldToggle(Ce.refId)},label:Fe,selected:Qe})}))))}}const io={id:J.F.filterByRefId,editor:vo,transformation:ne.c.filterFramesByRefIdTransformer,name:ne.c.filterFramesByRefIdTransformer.name,description:"Filter data by query. This is useful if you are sharing the results from a different panel that has many queries and you want to only visualize a subset of that in this panel.",categories:new Set([C.m.Filter]),help:he(J.F.filterByRefId).helperDocs};var ur=e(15400);const Fr={settings:{width:30,filter:F=>F.type===k.PU.string,placeholderText:"Select text field",noFieldsMessage:"No text fields found"},name:"",id:"",editor:()=>null};function Co({input:F,options:z,onChange:X}){const ce=(0,a.useCallback)(qe=>{X({...z,stringField:qe??""})},[X,z]),Ce=(0,a.useCallback)(qe=>{const ut=qe.value??ur.gs.UpperCase;X({...z,outputFormat:ut})},[X,z]),Ae=(0,a.useCallback)(qe=>{X({...z,substringStart:qe??0})},[X,z]),Fe=(0,a.useCallback)(qe=>{X({...z,substringEnd:qe??0})},[X,z]),Qe=Object.values(ur.gs).map(qe=>({label:qe,value:qe}));return a.createElement(a.Fragment,null,a.createElement(pe.C,null,a.createElement(te.I,{label:"Field",labelWidth:10},a.createElement(Ir.O,{context:{data:F},value:z.stringField??"",onChange:ce,item:Fr})),a.createElement(te.I,{label:"Format",labelWidth:10},a.createElement(le.l6,{options:Qe,value:z.outputFormat,onChange:Ce,width:20}))),z.outputFormat===ur.gs.Substring&&a.createElement(pe.C,null,a.createElement(te.I,{label:"Substring range",labelWidth:15},a.createElement(lr.Q,{min:0,value:z.substringStart??0,onChange:Ae,width:7})),a.createElement(te.I,null,a.createElement(lr.Q,{min:0,value:z.substringEnd??0,onChange:Fe,width:7}))))}const bo={id:J.F.formatString,editor:Co,transformation:ne.c.formatStringTransformer,name:ne.c.formatStringTransformer.name,state:Ve.pn.beta,description:ne.c.formatStringTransformer.description,categories:new Set([C.m.Reformat])};function Ot({input:F,options:z,onChange:X}){const ce=[],Ce=(0,ye.qt)(!0);for(const qe of F)for(const ut of qe.fields)if(ut.type==="time"){const vt=(0,re.Ct)(ut,qe,F);ce.push({label:vt,value:vt})}const Ae=(0,a.useCallback)(qe=>{const ut=qe?.value!==void 0?qe.value:"";X({...z,timeField:ut})},[X,z]),Fe=(0,a.useCallback)(qe=>{const ut=qe.target.value;X({...z,outputFormat:ut})},[X,z]),Qe=(0,a.useCallback)(qe=>{const ut=qe?.value!==void 0?qe.value:"";X({...z,timezone:ut})},[X,z]);return a.createElement(a.Fragment,null,a.createElement(pe.C,null,a.createElement(te.I,{label:"Time Field",labelWidth:15,grow:!0},a.createElement(le.l6,{options:ce,value:z.timeField,onChange:Ae,placeholder:"time",isClearable:!0})),a.createElement(te.I,{label:"Format",labelWidth:10,tooltip:a.createElement(a.Fragment,null,"The output format for the field specified as a"," ",a.createElement("a",{href:"https://momentjs.com/docs/#/displaying/",target:"_blank",rel:"noopener noreferrer"},"Moment.js format string"),"."),interactive:!0},a.createElement(me.p,{onChange:Fe,value:z.outputFormat})),a.createElement(te.I,{label:"Set Timezone",tooltip:"Set the timezone of the date manually",labelWidth:20},a.createElement(le.l6,{options:Ce,value:z.timezone,onChange:Qe,isClearable:!0}))))}const $t={id:J.F.formatTime,editor:Ot,transformation:ne.c.formatTimeTransformer,name:ne.c.formatTimeTransformer.name,state:Ve.pn.alpha,description:ne.c.formatTimeTransformer.description,help:he(J.F.formatTime).helperDocs};var sn=e(25094),Zt=e(67061),vn=e(42418);const wn=({input:F,options:z,onChange:X})=>{const ce=(0,ye.ZI)(F),Ce=(0,a.useCallback)(qe=>ut=>{X({...z,fields:{...z.fields,[qe]:ut}})},[X]);let Ae,Fe=!1;for(const qe of Object.values(z.fields))qe.aggregations.length>0&&qe.operation!==null&&(Fe=!0),qe.operation===sn.R3.groupBy&&(Ae=!0);const Qe=Fe&&!Ae;return a.createElement(Zt.B,{direction:"column"},Qe&&a.createElement(vn.F,{title:"Calculations will not have an effect if no fields are being grouped on.",severity:"warning"}),ce.map(qe=>a.createElement(ua,{onConfigChange:Ce(qe),fieldName:qe,config:z.fields[qe],key:qe})))},kn=[{label:"Group by",value:sn.R3.groupBy},{label:"Calculate",value:sn.R3.aggregate}],ua=({fieldName:F,config:z,onConfigChange:X})=>{const ce=(0,It.$j)(),Ce=ma(ce),Ae=(0,a.useCallback)(Fe=>{X({aggregations:z?.aggregations??[],operation:Fe?.value??null})},[z,X]);return a.createElement(te.I,{className:Ce.label,label:F,grow:!0,shrink:!0},a.createElement(Zt.B,{gap:.5,direction:"row"},a.createElement("div",{className:Ce.operation},a.createElement(le.l6,{options:kn,value:z?.operation,placeholder:"Ignored",onChange:Ae,isClearable:!0})),z?.operation===sn.R3.aggregate&&a.createElement(yt.S,{className:Ce.aggregations,placeholder:"Select Stats",allowMultiple:!0,stats:z.aggregations,onChange:Fe=>{X({...z,aggregations:Fe})}})))},ma=F=>({label:(0,rt.css)` label { min-width: ${F.spacing(32)}; } `,operation:(0,rt.css)` flex-shrink: 0; height: 100%; width: ${F.spacing(24)}; `,aggregations:(0,rt.css)` flex-grow: 1; `}),Qa={id:J.F.groupBy,editor:wn,transformation:ne.c.groupByTransformer,name:ne.c.groupByTransformer.name,description:ne.c.groupByTransformer.description,categories:new Set([C.m.Combine,C.m.CalculateNewFields,C.m.Reformat]),help:he(J.F.groupBy).helperDocs};var za=e(68133),Ia=e(46819),Ha=e(88575);const Ys=({input:F,options:z,onChange:X})=>{const ce=(0,ye.ZI)(F),Ce=z.showSubframeHeaders===void 0?za.lu:z.showSubframeHeaders,Ae=(0,a.useCallback)(vt=>Ct=>{X({...z,fields:{...z.fields,[vt]:Ct}})},[X]),Fe=(0,a.useCallback)(()=>{const vt=z.showSubframeHeaders===void 0?!za.lu:!z.showSubframeHeaders;X({showSubframeHeaders:vt,fields:{...z.fields}})},[X]);let Qe,qe=!1;for(const vt of Object.values(z.fields))vt.aggregations.length>0&&vt.operation!==null&&(qe=!0),vt.operation===sn.R3.groupBy&&(Qe=!0);const ut=qe&&!Qe;return a.createElement(Ia.B,{direction:"column"},ut&&a.createElement(vn.F,{title:"Calculations will not have an effect if no fields are being grouped on.",severity:"warning"}),a.createElement("div",null,ce.map(vt=>a.createElement(vs,{onConfigChange:Ae(vt),fieldName:vt,config:z.fields[vt],key:vt}))),a.createElement(Ha.D,{label:"Show field names in nested tables",description:"If enabled nested tables will show field names as a table header"},a.createElement(Jn.d,{value:Ce,onChange:Fe})))},sr=[{label:"Group by",value:sn.R3.groupBy},{label:"Calculate",value:sn.R3.aggregate}],vs=({fieldName:F,config:z,onConfigChange:X})=>{const ce=(0,It.$j)(),Ce=zr(ce),Ae=(0,a.useCallback)(Fe=>{X({aggregations:z?.aggregations??[],operation:Fe?.value??null})},[z,X]);return a.createElement(te.I,{className:Ce.label,label:F,grow:!0,shrink:!0},a.createElement(Ia.B,{gap:.5,direction:"row",wrap:!1},a.createElement("div",{className:Ce.operation},a.createElement(le.l6,{options:sr,value:z?.operation,placeholder:"Ignored",onChange:Ae,isClearable:!0})),z?.operation===sn.R3.aggregate&&a.createElement(yt.S,{className:Ce.aggregations,placeholder:"Select Stats",allowMultiple:!0,stats:z.aggregations,onChange:Fe=>{X({...z,aggregations:Fe})}})))},zr=F=>({label:(0,rt.css)({minWidth:F.spacing(32)}),operation:(0,rt.css)({flexShrink:0,height:"100%",width:F.spacing(24)}),aggregations:(0,rt.css)({flexGrow:1})}),ws={id:J.F.groupToNestedTable,editor:Ys,transformation:ne.c.groupToNestedTable,name:ne.c.groupToNestedTable.name,description:ne.c.groupToNestedTable.description,categories:new Set([C.m.Combine,C.m.CalculateNewFields,C.m.Reformat])};var ds=e(81010);const Vs=({input:F,options:z,onChange:X})=>{const ce=(0,ye.ZI)(F).map(ut=>({label:ut,value:ut})),Ce=(0,a.useCallback)(ut=>{X({...z,columnField:ut?.value})},[X,z]),Ae=(0,a.useCallback)(ut=>{X({...z,rowField:ut?.value})},[X,z]),Fe=(0,a.useCallback)(ut=>{X({...z,valueField:ut?.value})},[X,z]),Qe=[{label:"Null",value:ds.N.Null,description:"Null value"},{label:"True",value:ds.N.True,description:"Boolean true value"},{label:"False",value:ds.N.False,description:"Boolean false value"},{label:"Empty",value:ds.N.Empty,description:"Empty string"}],qe=(0,a.useCallback)(ut=>{X({...z,emptyValue:ut?.value})},[X,z]);return a.createElement(a.Fragment,null,a.createElement(pe.C,null,a.createElement(te.I,{label:"Column",labelWidth:8},a.createElement(le.l6,{options:ce,value:z.columnField,onChange:Ce,isClearable:!0})),a.createElement(te.I,{label:"Row",labelWidth:8},a.createElement(le.l6,{options:ce,value:z.rowField,onChange:Ae,isClearable:!0})),a.createElement(te.I,{label:"Cell Value",labelWidth:10},a.createElement(le.l6,{options:ce,value:z.valueField,onChange:Fe,isClearable:!0})),a.createElement(te.I,{label:"Empty Value"},a.createElement(le.l6,{options:Qe,value:z.emptyValue,onChange:qe,isClearable:!0}))))},kr={id:J.F.groupingToMatrix,editor:Vs,transformation:ne.c.groupingToMatrixTransformer,name:ne.c.groupingToMatrixTransformer.name,description:"Takes a three fields combination and produces a Matrix.",categories:new Set([C.m.Combine,C.m.Reformat]),help:he(J.F.groupingToMatrix).helperDocs};var ha=e(77678);const xs=({input:F,options:z,onChange:X})=>{const[Ce,Ae]=(0,a.useState)({bucketCount:!(0,ye.N_)(z.bucketCount||""),bucketSize:!(0,ye.N_)(z.bucketSize||""),bucketOffset:!(0,ye.N_)(z.bucketOffset||"")}),Fe=(0,a.useCallback)(kt=>{X({...z,bucketCount:kt})},[X,z]),Qe=(0,a.useCallback)(kt=>{X({...z,bucketSize:kt})},[X,z]),qe=(0,a.useCallback)(kt=>{X({...z,bucketOffset:kt})},[X,z]),ut=(0,a.useCallback)(kt=>{Ae({...Ce,bucketCount:!(0,ye.N_)(kt)}),X({...z,bucketCount:Number(kt)===0?void 0:Number(kt)})},[X,z,Ce]),vt=(0,a.useCallback)(kt=>{Ae({...Ce,bucketSize:!(0,ye.N_)(kt)}),X({...z,bucketSize:kt})},[X,z,Ce,Ae]),Ct=(0,a.useCallback)(kt=>{Ae({...Ce,bucketOffset:!(0,ye.N_)(kt)}),X({...z,bucketOffset:kt})},[X,z,Ce,Ae]),Ht=(0,a.useCallback)(()=>{X({...z,combine:!z.combine})},[X,z]),At=(0,Re.w)().getVariables().map(kt=>({value:kt.name,label:kt.label||kt.name,origin:Ee.$0.Template}));if(!j.$.featureToggles.transformationsVariableSupport){let kt;typeof z.bucketSize=="string"?kt=parseInt(z.bucketSize,10):kt=z.bucketSize;let En;return typeof z.bucketOffset=="string"?En=parseInt(z.bucketOffset,10):En=z.bucketOffset,a.createElement("div",null,a.createElement(pe.C,null,a.createElement(te.I,{labelWidth:18,label:ha.Rt.bucketCount.name,tooltip:ha.Rt.bucketCount.description},a.createElement(lr.Q,{value:z.bucketCount,placeholder:"Default: 30",onChange:Fe,min:0}))),a.createElement(pe.C,null,a.createElement(te.I,{labelWidth:18,label:ha.Rt.bucketSize.name,tooltip:ha.Rt.bucketSize.description},a.createElement(lr.Q,{value:kt,placeholder:"auto",onChange:Qe,min:0}))),a.createElement(pe.C,null,a.createElement(te.I,{labelWidth:18,label:ha.Rt.bucketOffset.name,tooltip:ha.Rt.bucketOffset.description},a.createElement(lr.Q,{value:En,placeholder:"none",onChange:qe,min:0}))),a.createElement(pe.C,null,a.createElement(te.I,{labelWidth:18,label:ha.Rt.combine.name,tooltip:ha.Rt.combine.description},a.createElement(Jn.K,{value:z.combine??!1,onChange:Ht}))))}return a.createElement("div",null,a.createElement(pe.C,null,a.createElement(te.I,{invalid:Ce.bucketCount,error:"Value needs to be an integer or a variable",labelWidth:18,label:ha.Rt.bucketCount.name,tooltip:ha.Rt.bucketCount.description},a.createElement(Me.y,{suggestions:At,value:z.bucketCount,placeholder:"Default: 30",onChange:ut}))),a.createElement(pe.C,null,a.createElement(te.I,{invalid:Ce.bucketSize,error:"Value needs to be an integer or a variable",labelWidth:18,label:ha.Rt.bucketSize.name,tooltip:ha.Rt.bucketSize.description},a.createElement(Me.y,{suggestions:At,value:z.bucketSize,placeholder:"auto",onChange:vt}))),a.createElement(pe.C,null,a.createElement(te.I,{labelWidth:18,label:ha.Rt.bucketOffset.name,tooltip:ha.Rt.bucketOffset.description,invalid:Ce.bucketOffset,error:"Value needs to be an integer or a variable"},a.createElement(Me.y,{suggestions:At,value:z.bucketOffset,placeholder:"none",onChange:Ct}))),a.createElement(pe.C,null,a.createElement(te.I,{labelWidth:18,label:ha.Rt.combine.name,tooltip:ha.Rt.combine.description},a.createElement(Jn.K,{value:z.combine??!1,onChange:Ht}))))},lo={id:J.F.histogram,editor:xs,transformation:ne.c.histogramTransformer,name:ne.c.histogramTransformer.name,description:ne.c.histogramTransformer.description,categories:new Set([C.m.CreateNewVisualization]),help:he(J.F.histogram).helperDocs};var qa=e(41511),Qs=e(64278);const Wr=[{value:qa.W.outer,label:"OUTER (TIME SERIES)",description:"Keep all rows from any table with a value. Join on distinct field values. Performant and best used for time series."},{value:qa.W.outerTabular,label:"OUTER (TABULAR)",description:"Join on a field value with duplicated values. Non performant outer join best used for tabular(SQL like) data."},{value:qa.W.inner,label:"INNER",description:"Drop rows that do not match a value in all tables."}];function co({input:F,options:z,onChange:X}){const ce=(0,Qs.sE)(F),Ce=(0,Qs.m3)(ce),Ae=(0,Re.w)().getVariables().map(qe=>({value:"$"+qe.name,label:"$"+qe.name})),Fe=(0,a.useCallback)(qe=>{X({...z,byField:qe?.value})},[X,z]),Qe=(0,a.useCallback)(qe=>{X({...z,mode:qe?.value})},[X,z]);return a.createElement(a.Fragment,null,a.createElement(pe.C,null,a.createElement(te.I,{label:"Mode",labelWidth:8,grow:!0},a.createElement(le.l6,{options:Wr,value:z.mode??qa.W.outer,onChange:Qe}))),a.createElement(pe.C,null,a.createElement(te.I,{label:"Field",labelWidth:8,grow:!0},a.createElement(le.l6,{options:[...Ce,...Ae],value:z.byField,onChange:Fe,placeholder:"time",isClearable:!0}))))}const To={id:J.F.joinByField,aliasIds:[J.F.seriesToColumns],editor:co,transformation:ne.c.joinByFieldTransformer,name:ne.c.joinByFieldTransformer.name,description:ne.c.joinByFieldTransformer.description,categories:new Set([C.m.Combine]),help:he(J.F.joinByField).helperDocs};var Mo=e(6829);const vi=[{value:Mo.n.Columns,label:"Columns"},{value:Mo.n.Rows,label:"Rows"}],ti=({input:F,options:z,onChange:X})=>{const{labelNames:Ce,selected:Ae}=(0,a.useMemo)(()=>{let qe=[],ut={};for(const Ct of F)for(const Ht of Ct.fields)if(Ht.labels)for(const Nt of Object.keys(Ht.labels))ut[Nt]||(qe.push({value:Nt,label:Nt}),ut[Nt]=!0);const vt=new Set(z.keepLabels?.length?z.keepLabels:Object.keys(ut));return{labelNames:qe,selected:vt}},[z.keepLabels,F]),Fe=qe=>{X({...z,valueLabel:qe?.value})},Qe=qe=>{if(Ae.has(qe)?Ae.delete(qe):Ae.add(qe),Ae.size===Ce.length||!Ae.size){const{keepLabels:ut,...vt}=z;X(vt)}else X({...z,keepLabels:[...Ae]})};return a.createElement("div",null,a.createElement(pe.C,null,a.createElement(te.I,{label:"Mode",labelWidth:20},a.createElement(oe.z,{options:vi,value:z.mode??Mo.n.Columns,onChange:qe=>X({...z,mode:qe})}))),a.createElement(pe.C,null,a.createElement(te.I,{label:"Labels",labelWidth:20},a.createElement(Zt.B,{gap:1,wrap:"wrap"},Ce.map((qe,ut)=>{const vt=qe.label;return a.createElement(Ps.m,{key:`${vt}/${ut}`,onClick:()=>Qe(vt),label:vt,selected:Ae.has(vt)})})))),z.mode!==Mo.n.Rows&&a.createElement(pe.C,null,a.createElement(te.I,{label:"Value field name",labelWidth:20,tooltip:"Replace the value field name with a label",htmlFor:"labels-to-fields-as-name"},a.createElement(le.l6,{inputId:"labels-to-fields-as-name",isClearable:!0,allowCustomValue:!1,placeholder:"(Optional) Select label",options:Ce,value:z?.valueLabel,onChange:Fe,className:"min-width-16"}))))},ko={id:J.F.labelsToFields,editor:ti,transformation:ne.c.labelsToFieldsTransformer,name:ne.c.labelsToFieldsTransformer.name,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([C.m.Reformat]),help:he(J.F.labelsToFields).helperDocs},Ho=({options:F,onChange:z})=>{const[X,ce]=(0,a.useState)(!1),Ce=(0,a.useCallback)(qe=>{z({...F,limitField:Number(qe.currentTarget.value)})},[z,F]),Ae=(0,a.useCallback)(qe=>{ce(!(0,ye.N_)(qe)),z({...F,limitField:qe})},[z,F]),Qe=(0,Re.w)().getVariables().map(qe=>({value:qe.name,label:qe.label||qe.name,origin:Ee.$0.Template}));return j.$.featureToggles.transformationsVariableSupport?a.createElement(a.Fragment,null,a.createElement(pe.C,null,a.createElement(Me.y,{invalid:X,error:"Value needs to be an integer or a variable",value:String(F.limitField),onChange:Ae,placeholder:"Value or variable",suggestions:Qe}))):a.createElement(a.Fragment,null,a.createElement(pe.C,null,a.createElement(te.I,{label:"Limit",labelWidth:8},a.createElement(me.p,{placeholder:"Limit count",pattern:"[0-9]*",value:F.limitField,onChange:Ce,width:25}))))},Gi={id:J.F.limit,editor:Ho,transformation:ne.c.limitTransformer,name:ne.c.limitTransformer.name,description:"Limit the number of items displayed.",categories:new Set([C.m.Filter]),help:he(J.F.limit).helperDocs},mr=({input:F,options:z,onChange:X})=>F.length<=1?a.createElement(Nr.P,null,"Merge has no effect when applied on a single frame."):null,ji={id:J.F.merge,editor:mr,transformation:ne.c.mergeTransformer,name:ne.c.mergeTransformer.name,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([C.m.Combine]),help:he(J.F.merge).helperDocs};var Yi=e(82280);const Qi=({options:F,input:z,onChange:X})=>{const{indexByName:ce,excludeByName:Ce,renameByName:Ae,includeByName:Fe}=F,Qe=(0,ye.ZI)(z),qe=(0,a.useMemo)(()=>Gr(Qe,ce),[Qe,ce]),ut=Fe&&Object.keys(Fe).length>0?"include":"exclude",vt=(0,a.useCallback)((At,kt)=>{X({...F,excludeByName:{...Ce,[At]:kt}})},[X,F,Ce]),Ct=(0,a.useCallback)((At,kt)=>{const En={...F,includeByName:{...Fe,[At]:!kt}};X(En)},[X,F,Fe]),Ht=(0,a.useCallback)(At=>{if(!At||!At.destination)return;const kt=At.source.index,En=At.destination.index;kt!==En&&X({...F,indexByName:Hr(Qe,kt,En)})},[X,F,Qe]),Nt=(0,a.useCallback)((At,kt)=>{X({...F,renameByName:{...F.renameByName,[At]:kt}})},[X,F]);return z.length>1?a.createElement(Nr.P,null,"Organize fields only works with a single frame. Consider applying a join transformation or filtering the input first."):a.createElement(so.JY,{onDragEnd:Ht},a.createElement(so.gL,{droppableId:"sortable-fields-transformer",direction:"vertical"},At=>a.createElement("div",{ref:At.innerRef,...At.droppableProps},qe.map((kt,En)=>{const Ma=Fe&&kt in Fe?Fe[kt]:!1,$a=ut==="include"?Ma:!Ce[kt],Na=ut==="include"?Ct:vt;return a.createElement(ni,{fieldName:kt,renamedFieldName:Ae[kt],index:En,onToggleVisibility:Na,onRenameField:Nt,visible:$a,key:kt})}),At.placeholder)))};Qi.displayName="OrganizeFieldsTransformerEditor";const ni=({fieldName:F,renamedFieldName:z,index:X,visible:ce,onToggleVisibility:Ce,onRenameField:Ae})=>{const Fe=(0,It.of)(ai);return a.createElement(so.sx,{draggableId:F,index:X},Qe=>a.createElement("div",{className:"gf-form-inline",ref:Qe.innerRef,...Qe.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("span",{...Qe.dragHandleProps},a.createElement(hs.I,{name:"draggabledots",title:"Drag and drop to reorder",size:"lg",className:Fe.draggable})),a.createElement(wr.K,{className:Fe.toggle,size:"md",name:ce?"eye":"eye-slash",onClick:()=>Ce(F,ce),tooltip:ce?"Disable":"Enable"}),a.createElement("span",{className:Fe.name,title:F},F)),a.createElement(me.p,{className:"flex-grow-1",defaultValue:z||"",placeholder:`Rename ${F}`,onBlur:qe=>Ae(F,qe.currentTarget.value)}))))};ni.displayName="DraggableFieldName";const ai=F=>({toggle:(0,rt.css)` margin: 0 8px; color: ${F.colors.text.secondary}; `,draggable:(0,rt.css)` opacity: 0.4; &:hover { color: ${F.colors.text.maxContrast}; } `,name:(0,rt.css)` overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: ${F.typography.bodySmall.fontSize}; font-weight: ${F.typography.fontWeightMedium}; `}),Hr=(F,z,X)=>{const ce=Array.from(F),[Ce]=ce.splice(z,1);return ce.splice(X,0,Ce),ce.reduce((Ae,Fe,Qe)=>(Ae[Fe]=Qe,Ae),{})},Gr=(F,z={})=>{if(!z||Object.keys(z).length===0)return F;const X=(0,Yi.X)(z);return F.sort(X)},So={id:J.F.organize,editor:Qi,transformation:ne.c.organizeFieldsTransformer,name:ne.c.organizeFieldsTransformer.name,description:"Allows the user to re-order, hide, or rename fields / columns. Useful when data source doesn't allow overrides for visualizing data.",categories:new Set([C.m.ReorderAndRename]),help:he(J.F.organize).helperDocs};var si=e(21128),Tr=e(13544);const Ji=({options:F,onChange:z})=>{const X=[{label:"Series to rows",value:si.rV.SeriesToRows,description:"Create a table with one row for each series value"},{label:"Reduce fields",value:si.rV.ReduceFields,description:"Collapse each field into a single value"}],ce=(0,a.useCallback)(Fe=>{const Qe=Fe.value;z({...F,mode:Qe,includeTimeField:Qe===si.rV.ReduceFields?!!F.includeTimeField:!1})},[z,F]),Ce=(0,a.useCallback)(()=>{z({...F,includeTimeField:!F.includeTimeField})},[z,F]),Ae=(0,a.useCallback)(()=>{z({...F,labelsToFields:!F.labelsToFields})},[z,F]);return a.createElement(a.Fragment,null,a.createElement(te.I,{label:"Mode","data-testid":Tr.Tp.components.Transforms.Reduce.modeLabel,grow:!0,labelWidth:16},a.createElement(le.l6,{options:X,value:X.find(Fe=>Fe.value===F.mode)||X[0],onChange:ce})),a.createElement(te.I,{label:"Calculations","data-testid":Tr.Tp.components.Transforms.Reduce.calculationsLabel,grow:!0,labelWidth:16},a.createElement(yt.S,{placeholder:"Choose Stat",allowMultiple:!0,stats:F.reducers||[],onChange:Fe=>{z({...F,reducers:Fe})}})),F.mode===si.rV.ReduceFields&&a.createElement(te.I,{htmlFor:"include-time-field",labelWidth:16,label:"Include time"},a.createElement(Jn.K,{id:"include-time-field",value:!!F.includeTimeField,onChange:Ce})),F.mode!==si.rV.ReduceFields&&a.createElement(te.I,{htmlFor:"labels-to-fields",labelWidth:16,label:"Labels to fields"},a.createElement(Jn.K,{id:"labels-to-fields",value:!!F.labelsToFields,onChange:Ae})))},Xi={id:J.F.reduce,editor:Ji,transformation:ne.c.reduceTransformer,name:ne.c.reduceTransformer.name,description:ne.c.reduceTransformer.description,categories:new Set([C.m.CalculateNewFields]),help:he(J.F.reduce).helperDocs};class Ni extends a.PureComponent{constructor(z){super(z),this.handleRegexChange=X=>{const ce=X.currentTarget.value;let Ce=!0;if(ce)try{ce&&(0,Yn.dO)(ce)}catch{Ce=!1}this.setState(Ae=>({...Ae,regex:ce,isRegexValid:Ce}))},this.handleRenameChange=X=>{const ce=X.currentTarget.value;this.setState(Ce=>({...Ce,renamePattern:ce}))},this.handleRegexBlur=X=>{const ce=X.currentTarget.value;let Ce=!0;try{ce&&(0,Yn.dO)(ce)}catch{Ce=!1}this.setState({isRegexValid:Ce},()=>{Ce&&this.props.onChange({...this.props.options,regex:ce})})},this.handleRenameBlur=X=>{const ce=X.currentTarget.value;this.setState({renamePattern:ce},()=>this.props.onChange({...this.props.options,renamePattern:ce}))},this.state={regex:z.options.regex,renamePattern:z.options.renamePattern,isRegexValid:!0}}render(){const{regex:z,renamePattern:X,isRegexValid:ce}=this.state;return a.createElement(a.Fragment,null,a.createElement(te.I,{label:"Match",labelWidth:16,invalid:!ce,error:ce?void 0:"Invalid pattern"},a.createElement(me.p,{placeholder:"Regular expression pattern",value:z||"",onChange:this.handleRegexChange,onBlur:this.handleRegexBlur,width:25})),a.createElement(te.I,{label:"Replace",labelWidth:16},a.createElement(me.p,{placeholder:"Replacement pattern",value:X||"",onChange:this.handleRenameChange,onBlur:this.handleRenameBlur,width:25})))}}const Zi={id:J.F.renameByRegex,editor:Ni,transformation:ne.c.renameByRegexTransformer,name:ne.c.renameByRegexTransformer.name,description:"Renames part of the query result by using regular expression with placeholders.",categories:new Set([C.m.ReorderAndRename]),help:he(J.F.renameByRegex).helperDocs},yl=({input:F,options:z,onChange:X})=>null,Dl={id:J.F.seriesToRows,editor:yl,transformation:ne.c.seriesToRowsTransformer,name:ne.c.seriesToRowsTransformer.name,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([C.m.Combine,C.m.Reformat]),help:he(J.F.seriesToRows).helperDocs},qr=({input:F,options:z,onChange:X})=>{const ce=(0,ye.ZI)(F).map(qe=>({label:qe,value:qe})),Ae=(0,Re.w)().getVariables().map(qe=>({label:"$"+qe.name,value:"$"+qe.name})),Fe=(0,a.useCallback)((qe,ut)=>{X({...z,sort:[ut]})},[X,z]),Qe=z.sort?.length?z.sort:[{}];return a.createElement("div",null,Qe.map((qe,ut)=>a.createElement(pe.C,{key:`${qe.field}/${ut}`},a.createElement(te.I,{label:"Field",labelWidth:10,grow:!0},a.createElement(le.l6,{options:j.$.featureToggles.transformationsVariableSupport?[...ce,...Ae]:ce,value:qe.field,placeholder:"Select field",onChange:vt=>{Fe(ut,{...qe,field:vt.value})}})),a.createElement(te.I,{label:"Reverse"},a.createElement(Jn.K,{value:!!qe.desc,onChange:()=>{Fe(ut,{...qe,desc:!qe.desc})}})))))},vr={id:J.F.sortBy,editor:qr,transformation:ne.c.sortByTransformer,name:ne.c.sortByTransformer.name,description:ne.c.sortByTransformer.description,categories:new Set([C.m.ReorderAndRename]),help:he(J.F.sortBy).helperDocs};function wi({options:F,onChange:z}){const[X,ce]=(0,a.useState)(F),Ce=Ei(),Ae=Pl(),Fe=()=>{X.push({path:""}),ce([...X]),ut()},Qe=vt=>{X&&(X.splice(vt,1),ce([...X]),ut())},qe=(vt,Ct,Ht)=>{X&&(Ht==="alias"?X[Ct].alias=vt.currentTarget.value??"":X[Ct].path=vt.currentTarget.value??"",ce([...X]))},ut=()=>{z(X)};return a.createElement("ol",{className:(0,rt.cx)(Ae.list)},X&&X.map((vt,Ct)=>a.createElement("li",{key:Ct},a.createElement(pe.C,null,a.createElement(te.I,{label:"Field",tooltip:Ce.field,grow:!0},a.createElement(me.p,{onBlur:ut,onChange:Ht=>qe(Ht,Ct,"path"),value:vt.path,placeholder:'A valid json path, e.g. "object.value1" or "object.value2[0]"'})),a.createElement(te.I,{label:"Alias",tooltip:Ce.alias},a.createElement(me.p,{width:12,value:vt.alias,onBlur:ut,onChange:Ht=>qe(Ht,Ct,"alias")})),a.createElement(te.I,{className:(0,rt.cx)(Ae.removeIcon)},a.createElement(wr.K,{onClick:()=>Qe(Ct),name:"trash-alt",tooltip:"Remove path"}))))),a.createElement(te.I,null,a.createElement(ie.$n,{icon:"plus",onClick:()=>Fe(),variant:"secondary"},"Add path")))}const Ei=()=>{const F=[{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:"),F.map((z,X)=>a.createElement("p",{key:X},a.createElement("code",null,z.path),a.createElement("i",null,z.description)))),alias:"An alias name for the variable in the dashboard. If left blank the given path will be used."}};function Pl(){return{list:(0,rt.css)` margin-left: 20px; `,removeIcon:(0,rt.css)` margin: 0 0 0 4px; align-items: center; `}}var es=e(14236),Go=(F=>(F.JSON="json",F.KeyValues="kvp",F.Auto="auto",F))(Go||{});const Bo={id:Go.JSON,name:"JSON",description:"Parse JSON string",parse:F=>JSON.parse(F)};function qi(F){const z=[];let X="",ce="";const Ce={};for(let Ae=0;Ae<F.length;Ae++){let Fe=F[Ae];Fe===X&&(X="",Fe=F[++Ae]);const Qe=Fe==="\\";if(Qe&&(Fe=F[++Ae]),Qe||X.length){z.push(Fe);continue}switch((Fe==='"'||Fe==="'")&&(X=Fe),Fe){case":":case"=":z.length&&(ce&&(Ce[ce]=""),ce=z.join(""),z.length=0);break;case'"':case"'":case" ":case` `:case" ":case"\r":case` `:z.length&&ce===""&&(Ce[z.join("")]="",z.length=0);case",":case";":case"&":case"{":case"}":if(z.length){const qe=z.join("");ce.length?(Ce[ce]=qe,ce=""):ce=qe,z.length=0}break;default:z.push(Fe),Ae===F.length-1&&ce===""&&z.length&&(Ce[z.join("")]="",z.length=0)}}return ce.length&&(Ce[ce]=z.join("")),Ce}const el={id:Go.KeyValues,name:"Key+value pairs",description:"Look for a=b, c: d values in the line",parse:qi},jo=[Bo,el],Cl={id:Go.Auto,name:"Auto",description:"parse new fields automatically",parse:F=>{for(const z of jo)try{const X=z.parse(F);if(X!=null)return X}catch{}}},yi=new Te.O(()=>[...jo,Cl]),uo={id:J.F.extractFields,name:"Extract fields",description:"Parse fields from the contends of another",defaultOptions:{},operator:(F,z)=>X=>X.pipe((0,Ln.T)(ce=>uo.transformer(F,z)(ce))),transformer:F=>z=>z.map(X=>Fi(X,F))};function Fi(F,z){if(!z.source)return F;const X=(0,br.findField)(F,z.source);if(!X)return F;const ce=yi.getIfExists(z.format??Go.Auto);if(!ce)throw new Error("unkonwn extractor");const Ce=F.length,Ae=[],Fe=new Map;for(let qe=0;qe<Ce;qe++){let ut=X.values[qe];if((0,p.isString)(ut))try{ut=ce.parse(ut)}catch{ut={}}if(ut!=null){if(z.format===Go.JSON&&z.jsonPaths&&z.jsonPaths?.length>0){const vt={},Ct=z.jsonPaths.filter(Ht=>Ht.path);Ct.length>0&&(Ct.forEach(Ht=>{const Nt=Ht.alias&&Ht.alias.length>0?Ht.alias:Ht.path;vt[Nt]=(0,p.get)(ut,Ht.path)??"Not Found"}),ut=vt)}for(const[vt,Ct]of Object.entries(ut)){let Ht=Fe.get(vt);Ht==null&&(Ht=new Array(Ce).fill(void 0),Fe.set(vt,Ht),Ae.push(vt)),Ht[qe]=Ct}}}const Qe=Ae.map(qe=>{const ut=Fe.get(qe),vt={name:qe,values:ut,type:ut?(0,es.oE)(ut.find(Ct=>Ct!=null)):k.PU.other,config:{}};return j.$.featureToggles.extractFieldsNameDeduplication&&(vt.name=(0,re.fk)(vt,F)),vt});if(z.keepTime){const qe=(0,br.findField)(F,"Time")||(0,br.findField)(F,"time");qe&&Qe.unshift(qe)}return z.replace||Qe.unshift(...F.fields),{...F,fields:Qe}}const tl={settings:{width:30,placeholderText:"Select field"},name:"",id:"",editor:()=>null},mo=({input:F,options:z,onChange:X})=>{const ce=ut=>{X({...z,source:ut})},Ce=ut=>{X({...z,format:ut?.value})},Ae=ut=>{X({...z,jsonPaths:ut})},Fe=()=>{z.replace&&(z.keepTime=!1),X({...z,replace:!z.replace})},Qe=()=>{X({...z,keepTime:!z.keepTime})},qe=yi.selectOptions(z.format?[z.format]:void 0);return a.createElement("div",null,a.createElement(pe.C,null,a.createElement(te.I,{label:"Source",labelWidth:16},a.createElement(Ir.O,{context:{data:F},value:z.source??"",onChange:ce,item:tl}))),a.createElement(pe.C,null,a.createElement(te.I,{label:"Format",labelWidth:16},a.createElement(le.l6,{value:qe.current[0],options:qe.options,onChange:Ce,width:24,placeholder:"Auto"}))),z.format==="json"&&a.createElement(wi,{options:z.jsonPaths??[],onChange:Ae}),a.createElement(pe.C,null,a.createElement(te.I,{label:"Replace all fields",labelWidth:16},a.createElement(Jn.K,{value:z.replace??!1,onChange:Fe}))),z.replace&&a.createElement(pe.C,null,a.createElement(te.I,{label:"Keep time",labelWidth:16},a.createElement(Jn.K,{value:z.keepTime??!1,onChange:Qe}))))},Wi={id:J.F.extractFields,editor:mo,transformation:uo,name:uo.name,description:"Parse fields from content (JSON, labels, etc).",categories:new Set([C.m.Reformat]),help:he(J.F.extractFields).helperDocs};var fr=e(51986);const Eo={id:J.F.joinByLabels,name:"Join by labels",description:"Flatten labeled results into a table joined by labels.",defaultOptions:{},operator:(F,z)=>X=>X.pipe((0,Ln.T)(ce=>Eo.transformer(F,z)(ce))),transformer:F=>z=>!z||!z.length?z:[eo(F,z)]};function eo(F,z){if(!F.value?.length)return xo("No value labele configured");const X=(0,ye.aG)(z);if(X.size<1)return xo("No labels in result");if(!X.has(F.value))return xo("Value label not found");let ce=F.join?.length?F.join:Array.from(X);ce=ce.filter(Ct=>Ct!==F.value);const Ce=new Set,Ae=new Map,Fe={};for(const Ct of z)for(const Ht of Ct.fields)if(Ht.labels&&Ht.type!==k.PU.time){const Nt=ce.map(Na=>Ht.labels[Na]),At=Nt.join(",");let kt=Ae.get(At);kt||(kt={keys:Nt,values:{}},Ae.set(At,kt));const En=Ht.labels[F.value],Ma=Ht.values,$a=kt.values[En];$a?kt.values[En]=$a.concat(Ma):kt.values[En]=Ma,Fe[En]||(Fe[En]=Ht),Ce.add(En)}const Qe=Array.from(Ce),qe=ce.map(()=>[]),ut=Qe.map(()=>[]);for(const Ct of Ae.values()){let Ht=-1,Nt=!1;for(;!Nt;){Ht++,Nt=!0;for(let At=0;At<ce.length;At++)qe[At].push(Ct.keys[At]);for(let At=0;At<Qe.length;At++){const kt=Qe[At],En=Ct.values[kt]??[];ut[At].push(En[Ht]),En.length>Ht+1&&(Nt=!1)}}}const vt={fields:[],length:ut[0].length};for(let Ct=0;Ct<ce.length;Ct++)vt.fields.push({name:ce[Ct],config:{},type:k.PU.string,values:qe[Ct]});for(let Ct=0;Ct<Qe.length;Ct++){const Ht=Fe[Qe[Ct]];vt.fields.push({name:Qe[Ct],config:{},type:Ht.type??k.PU.number,values:ut[Ct]})}return vt}function xo(F){return{meta:{notices:[{severity:"error",text:F}]},fields:[{name:"Error",type:k.PU.string,config:{},values:[F]}],length:0}}function fo({input:F,options:z,onChange:X}){const ce=(0,a.useMemo)(()=>{let qe;const ut=(0,ye.aG)(F),vt=Array.from(ut).map(En=>({label:En,value:En}));let Ct=vt.find(En=>En.value===z.value);!Ct&&z.value&&(Ct={label:`${z.value} (not found)`,value:z.value},vt.push(Ct)),F.length?ut.size===0&&(qe=a.createElement(vn.F,{title:"No labels found"},"The input does not contain any labels")):qe=a.createElement(vn.F,{title:"No input found"},"No input (or labels) found"),ut.delete(z.value);const Ht=Array.from(ut).map(En=>({label:En,value:En}));let Nt=Ht;const At=!!z.join?.length;let kt="Join";return At?Nt=Ht.filter(En=>!z.join.includes(En.value)):kt=Ht.map(En=>En.value).join(", "),{warn:qe,valueOptions:vt,valueOption:Ct,joinOptions:Ht,addOptions:Nt,addText:kt,hasJoin:At,key:Date.now()}},[z,F]),Ce=(qe,ut)=>{if(!z.join)return;const vt=z.join.slice();if(ut)vt[qe]=ut;else if(vt.splice(qe,1),!vt.length){X({...z,join:void 0});return}const Ct=new Set(vt);z.value&&Ct.delete(z.value),X({...z,join:Array.from(Ct)})},Ae=qe=>{const ut=qe?.value;if(!ut)return;const vt=z.join?z.join.slice():[];vt.push(ut),X({...z,join:vt})},Fe=10,Qe="No labels found";return a.createElement("div",null,ce.warn,a.createElement(pe.C,null,a.createElement(te.I,{error:"required",invalid:!z.value?.length,label:"Value",labelWidth:Fe,tooltip:"Select the label indicating the values name"},a.createElement(le.l6,{options:ce.valueOptions,value:ce.valueOption,onChange:qe=>X({...z,value:qe.value}),noOptionsMessage:Qe}))),ce.hasJoin?z.join.map((qe,ut)=>a.createElement(pe.C,{key:qe+ut},a.createElement(te.I,{label:"Join",labelWidth:Fe,error:"Unable to join by the value label",invalid:qe===z.value},a.createElement(cs.Gy,null,a.createElement(le.l6,{options:ce.joinOptions,value:ce.joinOptions.find(vt=>vt.value===qe),isClearable:!0,onChange:vt=>Ce(ut,vt?.value),noOptionsMessage:Qe}),!!(ce.addOptions.length&&ut===z.join.length-1)&&a.createElement(fr.i,{icon:"plus",label:"",options:ce.addOptions,onChange:Ae,variant:"secondary"}))))):a.createElement(a.Fragment,null,!!ce.addOptions.length&&a.createElement(pe.C,null,a.createElement(te.I,{label:"Join",labelWidth:Fe},a.createElement(le.l6,{options:ce.addOptions,placeholder:ce.addText,onChange:Ae,noOptionsMessage:Qe})))))}const Ki={id:Eo.id,editor:fo,transformation:Eo,name:Eo.name,description:Eo.description,state:Ve.pn.beta,categories:new Set([C.m.Combine]),help:he(Eo.id).helperDocs};var bl=e(84350),ri=e(69862),Uo=e(65474),$i=e(67140);const Tl={id:J.F.fieldLookup,name:"Lookup fields from resource",description:"Retrieve matching data based on specified field",defaultOptions:{},operator:F=>z=>z.pipe((0,ri.Z)(X=>(0,Uo.H)(nl(X,F))))};async function nl(F,z){const X=Y.sJ.get(ee.Ct.byName).get(z?.lookupField),ce=await(0,$i.q3)(z?.gazetteer??$i.fx);return ce.frame?Di(F,ce,X):Promise.reject("missing frame in gazetteer")}function Di(F,z,X){const ce=z.frame()?.fields;return ce?F.map(Ce=>{const Ae=Ce.length,Fe=[];for(const Qe of Ce.fields)if(Fe.push(Qe),X(Qe,Ce,F)){const qe=Qe.values,ut=[];for(const vt of ce){const Ct=new Array(Ae);ut.push(Ct),Fe.push({...vt,values:Ct})}for(let vt=0;vt<z.count;vt++){const Ct=z.find(qe[vt]);if(Ct?.index!=null)for(let Ht=0;Ht<ce.length;Ht++)ut[Ht][vt]=ce[Ht].values[Ct.index]}}return{...Ce,fields:Fe}}):F}const No={settings:{width:30,filter:F=>F.type===k.PU.string,placeholderText:"Select text field",noFieldsMessage:"No text fields found"},name:"",id:"",editor:()=>null},Vi={settings:{}},Yo=({input:F,options:z,onChange:X})=>{const ce=(0,a.useCallback)(Ae=>{X({...z,lookupField:Ae})},[X,z]),Ce=(0,a.useCallback)(Ae=>{X({...z,gazetteer:Ae})},[X,z]);return a.createElement("div",null,a.createElement(pe.C,null,a.createElement(te.I,{label:"Field",labelWidth:12},a.createElement(Ir.O,{context:{data:F},value:z?.lookupField??"",onChange:ce,item:No}))),a.createElement(pe.C,null,a.createElement(te.I,{label:"Lookup",labelWidth:12},a.createElement(bl.G,{value:z?.gazetteer??"",context:{data:F},item:Vi,onChange:Ce}))))},Ze={id:J.F.fieldLookup,editor:Yo,transformation:Tl,name:Tl.name,description:"Use a field value to lookup additional fields from an external source. This currently supports spatial data, but will eventually support more formats.",state:Ve.pn.alpha,categories:new Set([C.m.PerformSpatialOperations]),help:he(J.F.fieldLookup).helperDocs};var et=e(35602),tt=e(64586);const dt=(F,z,X=[])=>(z===0?X.push(F):F.forEach(ce=>{dt(ce,z-1,X)}),X);function xt(F){const z=F[0].length,X=F.length,ce=new Map;for(let Ce=0;Ce<z;Ce++){let Ae=ce;for(let Fe=0;Fe<X;Fe++){let Qe=F[Fe][Ce],qe=Ae.get(Qe);qe==null&&(qe=Fe===X-1?[]:new Map,Ae.set(Qe,qe)),Ae=qe}Ae.push(Ce)}return dt(ce,X)}const Wt={asLabels:!0,append:!1,withNames:!1,separator1:"=",separator2:" "};function Vt(F,z,X){return z.map((ce,Ce)=>F.withNames?`${ce}${F.separator1}${X[Ce]}`:X[Ce]).join(F.separator2)}function en(F,z){const X={};return F.forEach((ce,Ce)=>{X[ce]=String(z[Ce])}),X}const dn={id:J.F.partitionByValues,name:"Partition by values",description:"Splits a one-frame dataset into multiple series discriminated by unique/enum values in one or more fields.",defaultOptions:{keepFields:!1},operator:(F,z)=>X=>X.pipe((0,Ln.T)(ce=>dn.transformer(F,z)(ce))),transformer:(F,z)=>{const X=(0,et.R)(z,{names:F.fields});if(!X)return tt.W.transformer({},z);const ce=(0,Y.NS)(X);return Ce=>Ce.length?yn(Ce[0],ce,F):Ce}};function yn(F,z,X){const ce=F.fields.filter(Qe=>z(Qe,F,[F]));if(!ce.length)return[F];const Ce=ce.map(Qe=>Qe.values),Ae=ce.map(Qe=>Qe.name),Fe={...Wt,...X?.naming};return xt(Ce).map(Qe=>{let qe=F.name,ut={};if(Fe.asLabels)ut=en(Ae,ce.map((Ct,Ht)=>Ce[Ht][Qe[0]]));else{let Ct=Vt(Fe,Ae,ce.map((Ht,Nt)=>Ce[Nt][Qe[0]]));Fe?.append&&F.name&&(Ct=`${F.name} ${Ct}`),qe=Ct}let vt=F.fields;if(!X?.keepFields){const Ct=new Set(Ae);vt=F.fields.filter(Ht=>!Ct.has(Ht.name))}return{name:qe,meta:F.meta,length:Qe.length,fields:vt.map(Ct=>{const Ht=Ct.values,Nt=Array(Qe.length);for(let At=0;At<Qe.length;At++)Nt[At]=Ht[Qe[At]];return{name:Ct.name,type:Ct.type,config:Ct.config,labels:{...Ct.labels,...ut},values:Nt}})}})}function Vn({input:F,options:z,onChange:X}){const ce=(0,Qs.sE)(F),Ce=(0,Qs.m3)(ce),Ae=(0,a.useMemo)(()=>{const Ht=new Set(z.fields);return Ht.size<1?Ce:Ce.filter(Nt=>!Ht.has(Nt.value))},[Ce,z]),Fe=(0,a.useCallback)(Ht=>{if(!Ht.value)return;const Nt=new Set(z.fields);Nt.add(Ht.value),X({...z,fields:[...Nt]})},[X,z]);let Qe;(Ht=>{Ht[Ht.asLabels=0]="asLabels",Ht[Ht.frameName=1]="frameName"})(Qe||(Qe={}));const qe=[{label:"As label",value:0},{label:"As frame name",value:1}],ut=[{label:"Yes",value:!0},{label:"No",value:!1}],vt=(0,a.useCallback)(Ht=>{if(!Ht)return;const Nt=new Set(z.fields);Nt.delete(Ht),X({...z,fields:[...Nt]})},[X,z]);if(F.length>1)return a.createElement(Nr.P,null,"Partition by values only works with a single frame.");const Ct=[...new Set(z.fields)];return a.createElement("div",null,a.createElement(pe.C,null,a.createElement(te.I,{label:"Field",labelWidth:10,grow:!0},a.createElement(cs.Gy,null,Ct.map(Ht=>a.createElement(ie.$n,{key:Ht,icon:"times",variant:"secondary",size:"md",onClick:()=>vt(Ht)},Ht)),Ae.length&&a.createElement(fr.i,{variant:"secondary",size:"md",options:Ae,onChange:Fe,label:"Select field",icon:"plus"})))),a.createElement(pe.C,null,a.createElement(te.I,{tooltip:"Sets how the names of the selected fields are displayed. As frame name is usually better for tabular data",label:"Naming",labelWidth:10},a.createElement(oe.z,{options:qe,value:z.naming?.asLabels===void 0||z.naming.asLabels?0:1,onChange:Ht=>X({...z,naming:{...z.naming,asLabels:Ht===0}})}))),a.createElement(pe.C,null,a.createElement(te.I,{tooltip:"Keeps the partition fields in the frames.",label:"Keep fields",labelWidth:16},a.createElement(oe.z,{options:ut,value:z.keepFields,onChange:Ht=>X({...z,keepFields:Ht})}))))}const aa={id:J.F.partitionByValues,editor:Vn,transformation:dn,name:dn.name,description:dn.description,state:Ve.pn.alpha,categories:new Set([C.m.Reformat]),help:he(J.F.partitionByValues).helperDocs};var Gn=e(41260),ta=e(37471),Sa=e(73060),ga=(F=>(F.TimeSeriesWide="wide",F.TimeSeriesLong="long",F.TimeSeriesMulti="multi",F.TimeSeriesMany="many",F))(ga||{});function Fa(F){if(!Array.isArray(F)||F.length===0)return F;const z=[];for(const X of da(F)){const ce=X.fields[0];if(!ce||ce.type!==k.PU.time)continue;const Ce=[],Ae=[];for(const Fe of X.fields)switch(Fe.type){case k.PU.number:case k.PU.boolean:Ce.push(Fe);break;case k.PU.string:Ae.push(Fe);break}for(const Fe of Ce)if(Ae.length){const Qe=new Map;for(let qe=0;qe<X.length;qe++){const ut=ce.values[qe],vt=Fe.values[qe];if(vt===void 0||ut==null)continue;const Ct=Ae.map(Nt=>Nt.values[qe]).join("/");let Ht=Qe.get(Ct);if(!Ht){Ht={key:Ct,time:[],value:[],labels:{}};for(const Nt of Ae)Ht.labels[Nt.name]=Nt.values[qe];Qe.set(Ct,Ht)}Ht.time.push(ut),Ht.value.push(vt)}for(const qe of Qe.values())z.push({name:X.name,refId:X.refId,meta:{...X.meta,type:Gn.m.TimeSeriesMulti},fields:[{...ce,values:qe.time},{...Fe,values:qe.value,labels:qe.labels}],length:qe.time.length})}else z.push({name:X.name,refId:X.refId,meta:{...X.meta,type:Gn.m.TimeSeriesMulti},fields:[ce,Fe],length:X.length})}return z}function da(F){if(!Array.isArray(F)||F.length===0)return F;const z=[];for(const X of F){let ce;const Ce=[],Ae={},Fe={},Qe={},qe={};for(let At=0;At<X.fields.length;At++){const kt=X.fields[At];switch(kt.type){case k.PU.string:case k.PU.boolean:kt.name in qe||(qe[kt.name]=At,Fe[kt.name]=!0);break;case k.PU.time:if(!ce){ce=kt;break}default:if(kt.name in Ae){const $a=Ae[kt.name];if(kt.type!==$a)continue}else Ae[kt.name]=kt.type,Ce.push(kt.name);const En=JSON.stringify(kt.labels),Ma=Qe[En];if(Ma!==void 0?Ma.push(At):Qe[En]=[At],kt.labels!=null)for(const $a in kt.labels)Fe[$a]=!0}}if(!ce)continue;const ut=[],vt=[],Ct=[],Ht=[];for(let At=0;At<X.length;At++)ut.push({time:ce.values[At],wideRowIndex:At});for(const At in Qe)vt.push(At);for(const At in Fe)Ct.push(At);for(const At in qe)Ht.push(At);ut.sort((At,kt)=>At.time-kt.time),vt.sort(),Ct.sort(),Ce.sort();const Nt=new ta.k({...X,meta:{...X.meta,type:Gn.m.TimeSeriesLong},fields:[{name:ce.name,type:ce.type}]});for(const At of Ce)Nt.addField({name:At,type:Ae[At]});for(const At of Ct)Nt.addField({name:At,type:k.PU.string});for(const At of ut){const{time:kt,wideRowIndex:En}=At;for(const Ma of vt){const $a={};for(const Ba of Ht)$a[Ba]=X.fields[qe[Ba]].values[En];let Na=0;for(const Ba of Qe[Ma]){const _r=X.fields[Ba];if(Na++===0&&_r.labels!=null)for(const pi in _r.labels)$a[pi]=_r.labels[pi];$a[_r.name]=_r.values[En]}$a[ce.name]=kt,Nt.add($a)}}z.push(Nt)}return z}function Ua(F){return yn(F,X=>X.type===k.PU.string).map(X=>(X.meta||(X.meta={}),X.meta.type=Gn.m.TimeSeriesMulti,X))}const wa={id:J.F.prepareTimeSeries,name:"Prepare time series",description:"Will stretch data frames from the wide format into the long format. This is really helpful to be able to keep backwards compatibility for panels not supporting the new wide format.",defaultOptions:{},operator:(F,z)=>X=>X.pipe((0,Ln.T)(ce=>wa.transformer(F,z)(ce))),transformer:F=>{const z=F?.format??"wide";if(z==="many"||z==="multi")return Fa;if(z==="long")return da;const X=Y.sJ.get(ee.Ct.firstTimeField).get({});return ce=>{if(!ce.length)return[];const Ce=[];for(const Fe of ce)Fe.meta?.type===Gn.m.TimeSeriesLong?Ua(Fe).forEach(Qe=>Ce.push(Qe)):Ce.push(Fe);const Ae=(0,Sa.Fd)({frames:Ce,joinBy:X,keepOriginIndices:!0});return Ae?(Ae.meta||(Ae.meta={}),Ae.meta.type=Gn.m.TimeSeriesWide,[Ae]):[]}}},va={label:"Wide time series",value:ga.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"))},Ja={label:"Multi-frame time series",value:ga.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"))},Xa={label:"Long time series",value:ga.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"))},ys=[va,Ja,Xa];function Hs(F){const{options:z,onChange:X}=F,ce=(0,It.of)(Gs),Ce=(0,a.useCallback)(Ae=>{X({...z,format:Ae.value})},[X,z]);return a.createElement(a.Fragment,null,a.createElement(pe.C,null,a.createElement(te.I,{label:"Format",labelWidth:12},a.createElement(le.l6,{width:35,options:ys,value:ys.find(Ae=>Ae.value===ga.TimeSeriesMulti&&z.format===ga.TimeSeriesMany?!0:Ae.value===z.format)||ys[0],onChange:Ce,className:"flex-grow-1"}))),a.createElement(pe.C,null,a.createElement(te.I,{label:"Info",labelWidth:12},a.createElement("div",{className:ce.info},(ys.find(Ae=>Ae.value===z.format)||ys[0]).info))))}const Gs=F=>({info:(0,rt.css)` margin-left: 20px; `}),As={id:wa.id,editor:Hs,transformation:wa,name:wa.name,description:wa.description,categories:new Set([C.m.Reformat]),help:he(wa.id).helperDocs};var Er=e(66648),Mr=e(48817),_s=(F=>(F.linear="linear",F.polynomial="polynomial",F))(_s||{});const er={predictionCount:100,modelType:"linear",degree:2},Kr={id:J.F.regression,name:"Regression analysis",operator:(F,z)=>X=>X.pipe((0,Ln.T)(ce=>Kr.transformer(F,z)(ce))),transformer:(F,z)=>X=>{const{predictionCount:ce,modelType:Ce,degree:Ae}={...er,...F};if(X.length===0)return X;const Fe=Y.sJ.get(ee.Ct.byName).get(F.yFieldName),Qe=Y.sJ.get(ee.Ct.byName).get(F.xFieldName);let qe,ut,vt;for(const Ba of X){const _r=Ba.fields.find(pi=>Fe(pi,Ba,X));if(_r){ut=_r;const pi=Ba.fields.find(uh=>Qe(uh,Ba,X));if(pi){qe=pi,vt=Ba;break}else throw"X and Y fields must be part of the same frame"}}if(!qe||!ut)return X;let Ct=qe.values[0],Ht=qe.values[0];for(let Ba=1;Ba<qe.values.length;Ba++)qe.values[Ba]<Ct&&(Ct=qe.values[Ba]),qe.values[Ba]>Ht&&(Ht=qe.values[Ba]);const Nt=(Ht-Ct)/(ce-1),At=[...[...Array(ce-1).keys()].map((Ba,_r)=>_r*Nt+Ct),Ht],kt=qe.type===k.PU.time?Ct:0,En=[],Ma=[];for(let Ba=0;Ba<qe.values.length;Ba++)ut.values[Ba]!==null&&!isNaN(ut.values[Ba])&&(Ma.push(qe.values[Ba]-kt),En.push(ut.values[Ba]));let $a;switch(Ce){case"linear":$a=new Mr.X(Ma,En);break;case"polynomial":$a=new Er.Y(Ma,En,Ae);break;default:return X}const Na={name:`${Ce} regression`,length:At.length,fields:[{name:qe.name,type:qe.type,values:At,config:{}},{name:`${(0,re.Ct)(ut,vt,X)} predicted`,type:ut.type,values:At.map(Ba=>$a.predict(Ba-kt)),config:{}}]};return[...X,Na]}},$r={editor:Ir.O,id:"",name:"",settings:{width:24,isClearable:!1}},Sr=20,us=({input:F,options:z,onChange:X})=>{const ce=[{label:"Linear",value:_s.linear},{label:"Polynomial",value:_s.polynomial}];return(0,a.useEffect)(()=>{let Ce,Ae;if(!z.xFieldName){const Fe=Y.sJ.get(ee.Ct.firstTimeField).get({});for(const Qe of F)if(Ce=Qe.fields.find(qe=>Fe(qe,Qe,F)),Ce)break;if(!Ce){const Qe=Y.sJ.get(ee.Ct.numeric).get({});for(const qe of F)if(Ce=qe.fields.find(ut=>Qe(ut,qe,F)),Ce)break}}if(!z.yFieldName){const Fe=Y.sJ.get(ee.Ct.numeric).get({});for(const Qe of F)if(Ae=Qe.fields.find(qe=>Fe(qe,Qe,F)&&qe!==Ce),Ae)break}Ce&&Ae&&X({...z,xFieldName:Ce.name,yFieldName:Ae.name})}),a.createElement(a.Fragment,null,a.createElement(te.I,{labelWidth:Sr,label:"X field"},a.createElement(Ir.O,{context:{data:F},value:z.xFieldName??"",item:$r,onChange:Ce=>{X({...z,xFieldName:Ce})}})),a.createElement(te.I,{labelWidth:Sr,label:"Y field"},a.createElement(Ir.O,{context:{data:F},value:z.yFieldName??"",item:$r,onChange:Ce=>{X({...z,yFieldName:Ce})}})),a.createElement(te.I,{labelWidth:Sr,label:"Model type"},a.createElement(le.l6,{value:z.modelType??er.modelType,onChange:Ce=>{X({...z,modelType:Ce.value??er.modelType})},options:ce})),a.createElement(te.I,{labelWidth:Sr,label:"Predicted points",tooltip:"Number of X,Y points to predict"},a.createElement(lr.Q,{value:z.predictionCount??er.predictionCount,onChange:Ce=>{X({...z,predictionCount:Ce})}})),z.modelType===_s.polynomial&&a.createElement(te.I,{labelWidth:Sr,label:"Degree"},a.createElement(le.l6,{value:z.degree??er.degree,options:[{label:"Quadratic",value:2},{label:"Cubic",value:3},{label:"Quartic",value:4},{label:"Quintic",value:5}],onChange:Ce=>{X({...z,degree:Ce.value})}})))},Zn={id:J.F.regression,editor:us,transformation:Kr,name:Kr.name,description:Kr.description,categories:new Set([C.m.CalculateNewFields]),help:he(J.F.regression).helperDocs},fa={id:J.F.rowsToFields,name:"Rows to fields",description:"Convert each row into a field with dynamic config.",defaultOptions:{},operator:F=>z=>z.pipe((0,Ln.T)(X=>X.map(ce=>ka(F,ce))))};function ka(F,z){const X=mn(z,F.mappings??[],!0),{nameField:ce,valueField:Ce}=X;if(!ce||!Ce)return z;const Ae=[];for(let Fe=0;Fe<ce.values.length;Fe++){const Qe=ce.values[Fe],qe=Ce.values[Fe],ut=Xt(z,Fe,X),vt=ss(z,Fe,X),Ct={name:`${Qe}`,type:Ce.type,values:[qe],config:ut,labels:vt};Ae.push(Ct)}return{fields:Ae,length:1}}function ss(F,z,X){const ce={...X.nameField.labels};for(let Ce=0;Ce<F.fields.length;Ce++){const Ae=F.fields[Ce],Fe=(0,re.Ct)(Ae,F),Qe=X.index[Fe];if(Qe.handler&&Qe.handler.key!==fn.Label)continue;const qe=Ae.values[z];qe!=null&&(ce[Fe]=qe)}return ce}function Rr({input:F,options:z,onChange:X}){return F.length===0?null:a.createElement("div",null,a.createElement(Sn,{frame:F[0],mappings:z.mappings??[],onChange:ce=>X({...z,mappings:ce}),withNameAndValue:!0}))}const Js={id:fa.id,editor:Rr,transformation:fa,name:fa.name,description:fa.description,state:Ve.pn.beta,categories:new Set([C.m.Reformat]),help:he(fa.id).helperDocs};var gr=e(52622),rs=e(61983),Fs=e(9581),Oo=e(96606),Qo=e(31484),Pi=e(78134);const Es={id:J.F.spatial,name:"Spatial operations",description:"Apply spatial operations to query results.",defaultOptions:{},operator:F=>z=>z.pipe((0,ri.Z)(X=>(0,Uo.H)(yo(X,F))))};function Lr(F){return F.action===Fs.dy.Modify&&F.modify?.op===Fs.YD.LineBuilder}async function yo(F,z){const X=await(0,Qo.nE)(z.source);if(Lr(z)){const ce=await(0,Qo.nE)(z.modify?.target);return F.map(Ce=>{const Ae=(0,Qo.FM)(Ce,X),Fe=(0,Qo.FM)(Ce,ce);if(Ae.field&&Fe.field){const Qe=[...Ce.fields],qe=(0,Oo.XR)(Ae.field,Fe.field),ut=Qe[0];return ut.type===k.PU.geo&&ut!==Ae.field&&ut!==Fe.field?Qe[0]=(0,Oo.RA)(ut,qe):Qe.unshift(qe),{...Ce,fields:Qe}}return Ce})}return F.map(ce=>{let Ce=(0,Qo.FM)(ce,X);if(Ce.field){if(z.action===Fs.dy.Modify){switch(z.modify?.op){case Fs.YD.AsLine:let Fe=Ce.field.name;return(!Fe||Fe==="Point")&&(Fe="Line"),{...ce,length:1,fields:[{...Ce.field,name:Fe,type:k.PU.geo,values:[(0,Pi.tt)(Ce.field)]}]}}return ce}const Ae=Ce.derived?[Ce.field,...ce.fields]:ce.fields.slice(0);if(z.action===Fs.dy.Calculate&&(Ae.push((0,Pi.pp)(Ce.field,z.calculate??{})),Ce.derived=!0),Ce.derived)return{...ce,fields:Ae}}return ce})}const Do=(F,z)=>{const X=z.options??{};F.addSelect({path:"action",name:"Action",description:"",defaultValue:Fs.dy.Prepare,settings:{options:[{value:Fs.dy.Prepare,label:"Prepare spatial field",description:"Set a geometry field based on the results of other fields"},{value:Fs.dy.Calculate,label:"Calculate value",description:"Use the geometry to define a new field (heading/distance/area)"},{value:Fs.dy.Modify,label:"Transform",description:"Apply spatial operations to the geometry"}]}}),X.action===Fs.dy.Calculate?F.addSelect({path:"calculate.calc",name:"Function",description:"",defaultValue:Fs.kD.Heading,settings:{options:[{value:Fs.kD.Heading,label:"Heading"},{value:Fs.kD.Area,label:"Area"},{value:Fs.kD.Distance,label:"Distance"}]}}):X.action===Fs.dy.Modify&&F.addSelect({path:"modify.op",name:"Operation",description:"",defaultValue:Fs.YD.AsLine,settings:{options:[{value:Fs.YD.AsLine,label:"As line",description:"Create a single line feature with a vertex at each row"},{value:Fs.YD.LineBuilder,label:"Line builder",description:"Create a line between two points"}]}}),Lr(X)?(F.addNestedOptions({category:["Source"],path:"source",build:(ce,Ce)=>{const Ae=X.source??{mode:gr.aG.Auto};(0,rs.G)("Point","",ce,Ae)}}),F.addNestedOptions({category:["Target"],path:"modify",build:(ce,Ce)=>{const Ae=X.modify?.target??{mode:gr.aG.Auto};(0,rs.G)("Point","target.",ce,Ae)}})):(0,rs.G)("Location","source.",F,X.source)},al=F=>{(0,a.useEffect)(()=>{if(!F.options.source?.mode){const ce=gt(Do);F.onChange({...ce,...F.options}),console.log("geometry useEffect",ce)}},[]);const z=cc((0,It.$j)()),X=mt(F,Do);return a.createElement("div",null,a.createElement("div",null,X.items.map(ce=>ce.render())),a.createElement("div",null,X.categories.map(ce=>a.createElement("div",{key:ce.props.id,className:z.wrap},a.createElement("h5",null,ce.props.title),a.createElement("div",{className:z.item},ce.items.map(Ce=>Ce.render()))))))},cc=F=>({wrap:(0,rt.css)` margin-bottom: 20px; `,item:(0,rt.css)` border-left: 4px solid ${F.colors.border.strong}; padding-left: 10px; `}),dc={id:J.F.spatial,editor:al,transformation:Es,name:Es.name,description:Es.description,state:Ve.pn.alpha,categories:new Set([C.m.PerformSpatialOperations]),help:he(J.F.spatial).helperDocs};var _i=e(19845);const oi={id:J.F.timeSeriesTable,name:"Time series to table",description:"Convert time series data to table rows so that they can be viewed in tabular or sparkline format.",defaultOptions:{},isApplicable:F=>{for(const z of F)if((0,_i.aH)(z))return ds.M.Applicable;return ds.M.NotApplicable},isApplicableDescription:"The Time series to table transformation requires at least one time series frame to function. You currently have none.",operator:F=>z=>z.pipe((0,Ln.T)(X=>zl(F,X)))};function zl(F,z){const X={},ce={},Ce=[];let Ae=kl(z);for(const Fe of Object.keys(Ae)){const Qe=z.filter(ut=>ut.refId===Fe);X[Fe]={},ce[Fe]={};const qe=[];Qe.forEach(ut=>{ut.fields.forEach(vt=>{vt.type===k.PU.number&&vt.labels&&Object.keys(vt.labels).forEach(Ct=>{qe.includes(Ct)||(ce[Fe][Ct]=Ml(Ct,k.PU.string),qe.push(Ct))})})});for(let ut=0;ut<Qe.length;ut++){const vt=Qe[ut];let Ct=null,Ht=F[Fe]?.timeField;if(Ht&&Ht.length>0?Ct=vt.fields.find(Nt=>Nt.name===Ht):Ct=vt.fields.find(Nt=>(0,_i.hF)(Nt)),!(0,_i.aH)(vt)){Ce.push(vt);continue}for(const Nt of vt.fields){if(Nt.type!==k.PU.number)continue;const At=F[Fe]?.stat??ft.gy.lastNotNull,kt=(0,ft.Nw)({field:Nt,reducers:[At]})[At]??null,En=new ta.k;Ct!==void 0&&(En.addField(Ct),En.addField(Nt),X[Fe][`Trend #${Fe}`]===void 0&&(X[Fe][`Trend #${Fe}`]=Ml(`Trend #${Fe}`,k.PU.frame)),X[Fe][`Trend #${Fe}`].values.push({...En,value:kt,length:Nt.values.length})),qe.forEach(Ma=>{ce[Fe][Ma].values.push(Nt.labels?.[Ma]??"")})}}}for(const Fe of Object.keys(Ae)){const Qe={},qe=new ta.k;qe.refId=Fe;const ut=ce[Fe];if(ut!==void 0)for(const[Ct,Ht]of Object.entries(ut))Qe[Ct]===void 0&&(Qe[Ct]=Ht);for(const Ct of Object.values(Qe))qe.addField(Ct);const vt=X[Fe];for(const Ct of Object.values(vt))qe.addField(Ct);qe.fields.length>0&&Ce.push(qe)}return Ce}function Ml(F,z){return{name:F,type:z,config:{},values:[]}}function kl(F){let z={};for(const X of F)X.refId!==void 0&&(z[X.refId]===void 0?z[X.refId]=1:z[X.refId]++);return z}function uc({input:F,options:z,onChange:X}){const ce=kl(F),Ce=(0,a.useCallback)((Qe,qe)=>{const ut=qe?.value!==void 0?qe.value:"";X({...z,[Qe]:{...z[Qe],timeField:ut}})},[X,z]),Ae=(0,a.useCallback)((Qe,qe)=>{const ut=qe[0];ut&&(0,ft.Em)(ut)&&X({...z,[Qe]:{...z[Qe],stat:ut}})},[X,z]);let Fe=[];for(const Qe of Object.keys(ce)){const qe={},ut=[];for(const vt of F)if(vt.refId===Qe)for(const Ct of vt.fields)(0,_i.hF)(Ct)&&(qe[Ct.name]=Ct);for(const vt of Object.values(qe)){const{name:Ct}=vt;ut.push({label:Ct,value:Ct})}Fe.push(a.createElement(pe.C,{key:Qe},a.createElement(te.I,null,a.createElement(as.c,null,`Trend #${Qe}`)),a.createElement(te.I,{label:"Time field",tooltip:"The time field that will be used for the time series. If not selected the first found will be used."},a.createElement(le.l6,{onChange:Ce.bind(null,Qe),options:ut,value:z[Qe]?.timeField,isClearable:!0})),a.createElement(te.I,{label:"Stat",tooltip:"The statistic that should be calculated for this time series."},a.createElement(yt.S,{stats:[z[Qe]?.stat??ft.gy.lastNotNull],onChange:Ae.bind(null,Qe),filterOptions:vt=>vt.id!==ft.gy.allValues&&vt.id!==ft.gy.uniqueValues}))))}return a.createElement(a.Fragment,null,Fe)}const mc={id:oi.id,editor:uc,transformation:oi,name:oi.name,description:oi.description,state:Ve.pn.beta,help:he(oi.id).helperDocs},Sl=()=>[Xi,oo,Zi,io,_e,So,To,Dl,qs,is,ko,Qa,vr,ji,lo,Js,Xn,As,bs,dc,Ze,Wi,_t,kr,Gi,Ki,aa,...j.$.featureToggles.formatString?[bo]:[],...j.$.featureToggles.regressionTransformation?[Zn]:[],...j.$.featureToggles.groupToNestedTableTransformation?[ws]:[],$t,mc];function fc(){return new Promise(F=>require(["vs/language/kusto/monaco.contribution"],()=>F()))}function gc(){return[{id:"kusto",name:"kusto",init:fc}]}var rr=e(1503),go=e(69733),Ws=e(24180),Br=e(24160),yr=e(14110),wo=e(66602),Ci=e(71678),pc=e(93218),ii=e(17464),zs=e(39070),Jo=e(19361),Ga=e(44836),zi=e(53153),hc=e(87570),vc=e(4691),xl=e(20851),Ec=e(58649);const yc=()=>{const F=!!_.Ay.oauth;return{saml:{bgColor:"#464646",enabled:_.Ay.samlEnabled,name:_.Ay.samlName||Ec.En,icon:"key-skeleton-alt"},google:{bgColor:"#e84d3c",enabled:F&&!!_.Ay.oauth.google,name:_.Ay.oauth?.google?.name||"Google",icon:_.Ay.oauth?.google?.icon||"google"},azuread:{bgColor:"#2f2f2f",enabled:F&&!!_.Ay.oauth.azuread,name:_.Ay.oauth?.azuread?.name||"Microsoft",icon:_.Ay.oauth?.azuread?.icon||"microsoft"},github:{bgColor:"#464646",enabled:F&&!!_.Ay.oauth.github,name:_.Ay.oauth?.github?.name||"GitHub",icon:_.Ay.oauth?.github?.icon||"github"},gitlab:{bgColor:"#fc6d26",enabled:F&&!!_.Ay.oauth.gitlab,name:_.Ay.oauth?.gitlab?.name||"GitLab",icon:_.Ay.oauth?.gitlab?.icon||"gitlab"},grafanacom:{bgColor:"#262628",enabled:F&&!!_.Ay.oauth.grafana_com,name:_.Ay.oauth?.grafana_com?.name||"Grafana.com",icon:_.Ay.oauth?.grafana_com?.icon||"grafana",hrefName:"grafana_com"},okta:{bgColor:"#2f2f2f",enabled:F&&!!_.Ay.oauth.okta,name:_.Ay.oauth?.okta?.name||"Okta",icon:_.Ay.oauth?.okta?.icon||"okta"},oauth:{bgColor:"#262628",enabled:F&&!!_.Ay.oauth.generic_oauth,name:_.Ay.oauth?.generic_oauth?.name||"OAuth",icon:_.Ay.oauth?.generic_oauth?.icon||"signin",hrefName:"generic_oauth"}}},Ol=F=>({button:(0,rt.css)({color:"#d8d9da",position:"relative"}),buttonIcon:(0,rt.css)({position:"absolute",left:F.spacing(1),top:"50%",transform:"translateY(-50%)"}),divider:{base:(0,rt.css)({color:F.colors.text.primary,display:"flex",marginBottom:F.spacing(1),justifyContent:"space-between",textAlign:"center",width:"100%"}),line:(0,rt.css)({width:100,height:10,borderBottom:`1px solid ${F.colors.text}`})}}),Dc=()=>{const F=(0,It.of)(Ol);return a.createElement(a.Fragment,null,a.createElement("div",{className:F.divider.base},a.createElement("div",null,a.createElement("div",{className:F.divider.line})),a.createElement("div",null,a.createElement("span",null,!_.Ay.disableLoginForm&&a.createElement("span",null,"or"))),a.createElement("div",null,a.createElement("div",{className:F.divider.line}))),a.createElement("div",{className:"clearfix"}))};function bi(F,z,X){return(0,rt.cx)(z.button,(0,rt.css)({backgroundColor:F.bgColor,color:X.colors.getContrastText(F.bgColor),["&:hover"]:{backgroundColor:X.colors.emphasize(F.bgColor,.15),boxShadow:X.shadows.z1}}))}const Pc=()=>{const F=(0,p.pickBy)(yc(),Ce=>Ce.enabled),z=Object.keys(F).length>0,X=(0,It.$j)(),ce=(0,It.of)(Ol);return z?a.createElement(cs.gW,null,a.createElement(Dc,null),Object.entries(F).map(([Ce,Ae])=>{const Fe=Ae.name;return a.createElement(ie.z9,{key:Ce,className:bi(Ae,ce,X),href:`login/${Ae.hrefName?Ae.hrefName:Ce}`,target:"_self",fullWidth:!0},a.createElement(hs.I,{className:ce.buttonIcon,name:Ae.icon}),a.createElement(Ga.x6,{i18nKey:"login.services.sing-in-with-prefix"},"Sign in with ",{serviceName:Fe}))})):null},Xo=()=>{const F=(0,_.zj)().verifyEmailEnabled?`${(0,_.zj)().appSubUrl}/verify`:`${(0,_.zj)().appSubUrl}/signup`,z=(0,rt.css)({paddingTop:"16px"});return a.createElement(cs.gW,null,a.createElement("div",{className:z},a.createElement(Ga.x6,{i18nKey:"login.signup.new-to-question"},"New to Grafana?")),a.createElement(ie.z9,{className:(0,rt.css)({width:"100%",justifyContent:"center"}),href:F,variant:"secondary",fill:"outline"},a.createElement(Ga.x6,{i18nKey:"login.signup.button-label"},"Sign up")))},sl=()=>{const F=(0,It.of)(Il);return document.title=Jo.M.AppTitle,a.createElement(hc.A,null,({loginHint:z,passwordHint:X,disableLoginForm:ce,disableUserSignUp:Ce,login:Ae,isLoggingIn:Fe,changePassword:Qe,skipPasswordChange:qe,isChangingPassword:ut,showDefaultPasswordWarning:vt,loginErrorMessage:Ct})=>a.createElement(xl.GU,{isChangingPassword:ut},!ut&&a.createElement(xl.qm,null,Ct&&a.createElement(vn.F,{className:F.alert,severity:"error",title:(0,Ga.t)("login.error.title","Login failed")},Ct),!ce&&a.createElement(vc.Q,{onSubmit:Ae,loginHint:z,passwordHint:X,isLoggingIn:Fe},a.createElement(cs.Gy,{justify:"flex-end"},!j.$.auth.disableLogin&&a.createElement(ie.z9,{className:F.forgottenPassword,fill:"text",href:`${j.$.appSubUrl}/user/password/send-reset-email`},a.createElement(Ga.x6,{i18nKey:"login.forgot-password"},"Forgot your password?")))),a.createElement(Pc,null),!Ce&&a.createElement(Xo,null)),ut&&a.createElement(xl.qm,null,a.createElement(zi.S,{showDefaultPasswordWarning:vt,onSubmit:Qe,onSkip:()=>qe()}))))},Il=F=>({forgottenPassword:(0,rt.css)({padding:0,marginTop:F.spacing(.5)}),alert:(0,rt.css)({width:"100%"})});var dr=e(36830),Hl=e(25249),Ti=e(10860);function Zo({description:F,text:z,url:X}){const ce=(0,It.of)(Oe);return a.createElement(Ti.Z,{className:ce.card,href:X},a.createElement(Ti.Z.Heading,null,z),a.createElement(Ti.Z.Description,{className:ce.description},F))}const Oe=F=>({card:(0,rt.css)({marginBottom:0,gridTemplateRows:"1fr 0 2fr"}),description:(0,rt.css)({WebkitLineClamp:3,WebkitBoxOrient:"vertical",display:"-webkit-box",overflow:"hidden"})});function Ie({navId:F,header:z}){const{node:X}=(0,Hl.C)(F),ce=(0,It.of)(je),Ce=X.children?.filter(Ae=>!Ae.hideFromTabs);return a.createElement(dr.Y,{navId:X.id},a.createElement(dr.Y.Contents,null,a.createElement("div",{className:ce.content},z,Ce&&Ce.length>0&&a.createElement("section",{className:ce.grid},Ce?.map(Ae=>a.createElement(Zo,{key:Ae.id,description:Ae.subTitle,text:Ae.text,url:Ae.url??""}))))))}const je=F=>({content:(0,rt.css)({display:"flex",flexDirection:"column",gap:F.spacing(2)}),grid:(0,rt.css)({display:"grid",gap:F.spacing(3),gridTemplateColumns:"repeat(auto-fill, minmax(300px, 1fr))",gridAutoRows:"138px",padding:F.spacing(2,0)})});var lt=e(64388),bt=e(7392);function Ft(){return a.createElement(dr.Y,{navId:"home",layout:lt.k.Canvas,pageNav:{text:"Page not found"}},a.createElement(bt.L,{entity:"Page"}))}var Kt=e(16233),ln=e(33378),an=e(10096),Ut=e(80348),Un=e(72724);const Nn="dddd YYYY-MM-DD HH:mm zz",Pa="/admin/authentication/ldap";class qn extends a.PureComponent{constructor(){super(...arguments),this.onUserSync=()=>{this.props.onUserSync()}}render(){const{ldapSyncInfo:z,user:X}=this.props,Ce=z&&z.nextSync?(0,Un.LE)(z.nextSync,{format:Nn}):"",Ae=`${Pa}?user=${X&&X.login}`,Fe=an.TP.hasPermission(Ut.AccessControlAction.LDAPUsersRead),Qe=an.TP.hasPermission(Ut.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,z.enabled?a.createElement(a.Fragment,null,a.createElement("td",null,"Next scheduled synchronization"),a.createElement("td",{colSpan:2},Ce)):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"},Qe&&a.createElement(ie.$n,{variant:"secondary",onClick:this.onUserSync},"Sync user"),Fe&&a.createElement(ie.z9,{variant:"secondary",href:Ae},"Debug LDAP Mapping"))))}}var Wa=e(3911),ls=e(82702),fs=e(37390),ms=e(56034),tr=e(89062),Bs=e(85927),La=e(41053);function js({onSelected:F,className:z,inputId:X,autoFocus:ce,excludeOrgs:Ce}){(0,a.useEffect)(()=>{ce&&X&&document.getElementById(X)?.focus()},[ce,X]);const[Ae,Fe]=(0,La.A)(async()=>{const qe=(await(0,T.AI)().get("/api/orgs")).map(ut=>({value:{id:ut.id,name:ut.name},label:ut.name}));if(Ce){let ut=Ce.map(Ct=>Ct.orgId);return qe.filter(Ct=>!ut.includes(Ct.value.id))}else return qe});return a.createElement(le.DW,{inputId:X,className:z,isLoading:Ae.loading,defaultOptions:!0,isSearchable:!1,loadOptions:Fe,onChange:F,placeholder:"Select organization",noOptionsMessage:"No organizations found"})}var rl=e(5133);class Pd 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:z,orgs:X,isExternalUser:ce,onOrgRoleChange:Ce,onOrgRemove:Ae,onOrgAdd:Fe}=this.props,{showAddOrgModal:Qe}=this.state,qe=an.TP.hasPermission(Ut.AccessControlAction.OrgUsersAdd)&&!ce;return a.createElement("div",null,a.createElement("h3",{className:"page-heading"},"Organizations"),a.createElement(Zt.B,{gap:1.5,direction:"column"},a.createElement("table",{className:"filter-table form-inline"},a.createElement("tbody",null,X.map((ut,vt)=>a.createElement(gm,{key:`${ut.orgId}-${vt}`,isExternalUser:ce,user:z,org:ut,onOrgRoleChange:Ce,onOrgRemove:Ae})))),a.createElement("div",null,qe&&a.createElement(ie.$n,{variant:"secondary",onClick:this.showOrgAddModal,ref:this.addToOrgButtonRef},"Add user to organization")),a.createElement(pr,{user:z,userOrgs:X,isOpen:Qe,onOrgAdd:Fe,onDismiss:this.dismissOrgAddModal})))}}const mm=(0,Wa.N)(F=>({removeButton:(0,rt.css)` margin-right: 0.6rem; text-decoration: underline; color: ${F.v1.palette.blue95}; `,label:(0,rt.css)` font-weight: 500; `,disabledTooltip:(0,rt.css)` display: flex; `,tooltipItem:(0,rt.css)` margin-left: 5px; `,tooltipItemLink:(0,rt.css)` color: ${F.v1.palette.blue95}; `,rolePickerWrapper:(0,rt.css)` display: flex; `,rolePicker:(0,rt.css)` flex: auto; margin-right: ${F.spacing(1)}; `}));class fm extends a.PureComponent{constructor(){super(...arguments),this.state={currentRole:this.props.org.role,isChangingRole:!1,roleOptions:[]},this.onOrgRemove=async()=>{const{org:z}=this.props;this.props.onOrgRemove(z.orgId)},this.onChangeRoleClick=()=>{const{org:z}=this.props;this.setState({isChangingRole:!0,currentRole:z.role})},this.onOrgRoleChange=z=>{this.setState({currentRole:z})},this.onOrgRoleSave=()=>{this.props.onOrgRoleChange(this.props.org.orgId,this.state.currentRole)},this.onCancelClick=()=>{this.setState({isChangingRole:!1})},this.onBasicRoleChange=z=>{this.props.onOrgRoleChange(this.props.org.orgId,z)}}componentDidMount(){an.TP.licensedAccessControlEnabled()&&an.TP.hasPermission(Ut.AccessControlAction.ActionRolesList)&&(0,Bs.RL)(this.props.org.orgId).then(z=>this.setState({roleOptions:z})).catch(z=>console.error(z))}render(){const{user:z,org:X,isExternalUser:ce,theme:Ce}=this.props,Ae=z?.authLabels?.length&&z?.authLabels[0],Fe=Ae?`Synced via ${Ae}`:"",{currentRole:Qe,isChangingRole:qe}=this.state,ut=mm(Ce),vt=(0,rt.cx)("width-16",ut.label),Ct=an.TP.hasPermission(Ut.AccessControlAction.OrgUsersWrite),Ht=an.TP.hasPermission(Ut.AccessControlAction.OrgUsersRemove)&&!ce,Nt=ce||!Ct,At=`${X.name}-input`;return a.createElement("tr",null,a.createElement("td",{className:vt},a.createElement("label",{htmlFor:At},X.name)),an.TP.licensedAccessControlEnabled()?a.createElement("td",null,a.createElement("div",{className:ut.rolePickerWrapper},a.createElement("div",{className:ut.rolePicker},a.createElement(tr.y,{userId:z?.id||0,orgId:X.orgId,basicRole:X.role,roleOptions:this.state.roleOptions,onBasicRoleChange:this.onBasicRoleChange,basicRoleDisabled:Nt,basicRoleDisabledMessage:`This user's role is not editable because it is synchronized from your auth provider. Refer to the Grafana authentication docs for details.`})),ce&&a.createElement(Cd,{lockMessage:Fe}))):a.createElement(a.Fragment,null,qe?a.createElement("td",null,a.createElement(rl.r,{inputId:At,value:Qe,onChange:this.onOrgRoleChange,autoFocus:!0})):a.createElement("td",{className:"width-25"},X.role),a.createElement("td",{colSpan:1},a.createElement("div",{className:"pull-right"},Ct&&a.createElement(hm,{lockMessage:Fe,isExternalUser:ce,onChangeRoleClick:this.onChangeRoleClick,onCancelClick:this.onCancelClick,onOrgRoleSave:this.onOrgRoleSave})))),a.createElement("td",{colSpan:1},a.createElement("div",{className:"pull-right"},Ht&&a.createElement(ls.Z,{confirmText:"Confirm removal",confirmVariant:"destructive",onCancel:this.onCancelClick,onConfirm:this.onOrgRemove,autoFocus:!0},"Remove from organization"))))}}const gm=(0,It.cV)(fm),pm=(0,Wa.N)(()=>({modal:(0,rt.css)` width: 500px; `,buttonRow:(0,rt.css)` text-align: center; `,modalContent:(0,rt.css)` overflow: visible; `}));class pr extends a.PureComponent{constructor(){super(...arguments),this.state={selectedOrg:null,role:Ut.OrgRole.Viewer,roleOptions:[],pendingOrgId:null,pendingUserId:null,pendingRoles:[]},this.onOrgSelect=z=>{const X=this.props.userOrgs.find(ce=>ce.orgId===z.value?.id);this.setState({selectedOrg:z.value,role:X?.role||Ut.OrgRole.Viewer}),an.TP.licensedAccessControlEnabled()&&an.TP.hasPermission(Ut.AccessControlAction.ActionRolesList)&&(0,Bs.RL)(z.value?.id).then(ce=>this.setState({roleOptions:ce})).catch(ce=>console.error(ce))},this.onOrgRoleChange=z=>{this.setState({role:z})},this.onAddUserToOrg=async()=>{const{selectedOrg:z,role:X}=this.state;this.props.onOrgAdd(z.id,X),an.TP.licensedAccessControlEnabled()&&an.TP.hasPermission(Ut.AccessControlAction.ActionUserRolesAdd)&&this.state.pendingUserId&&(await(0,Bs.eA)(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(z,X,ce)=>{this.setState({pendingRoles:z,pendingOrgId:ce,pendingUserId:X})}}render(){const{isOpen:z,user:X,userOrgs:ce}=this.props,{role:Ce,roleOptions:Ae,selectedOrg:Fe}=this.state,Qe=pm();return a.createElement(fs.a,{className:Qe.modal,contentClassName:Qe.modalContent,title:"Add to an organization",isOpen:z,onDismiss:this.onCancel},a.createElement(Ha.D,{label:"Organization"},a.createElement(js,{inputId:"new-org-input",onSelected:this.onOrgSelect,excludeOrgs:ce,autoFocus:!0})),a.createElement(Ha.D,{label:"Role",disabled:Fe===null},a.createElement(tr.y,{userId:X?.id||0,orgId:Fe?.id,basicRole:Ce,onBasicRoleChange:this.onOrgRoleChange,basicRoleDisabled:!1,roleOptions:Ae,apply:!0,onApplyRoles:this.onRoleUpdate,pendingRoles:this.state.pendingRoles})),a.createElement(fs.a.ButtonRow,null,a.createElement(cs.Gy,{spacing:"md",justify:"center"},a.createElement(ie.$n,{variant:"secondary",fill:"outline",onClick:this.onCancel},"Cancel"),a.createElement(ie.$n,{variant:"primary",disabled:Fe===null,onClick:this.onAddUserToOrg},"Add to organization"))))}}const hr=F=>({disabledTooltip:(0,rt.css)` display: flex; `,tooltipItemLink:(0,rt.css)` color: ${F.v1.palette.blue95}; `,lockMessageClass:(0,rt.css)` font-style: italic; margin-left: 1.8rem; margin-right: 0.6rem; `,icon:(0,rt.css)` line-height: 2; `});function hm({lockMessage:F,onChangeRoleClick:z,isExternalUser:X,onOrgRoleSave:ce,onCancelClick:Ce}){const Ae=(0,It.of)(hr);return a.createElement("div",{className:Ae.disabledTooltip},X?a.createElement(a.Fragment,null,a.createElement("span",{className:Ae.lockMessageClass},F),a.createElement(ms.m,{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:Ae.tooltipItemLink,href:"https://grafana.com/docs/grafana/latest/auth",rel:"noreferrer",target:"_blank"},"Grafana authentication docs"),"\xA0for details.")},a.createElement("div",{className:Ae.icon},a.createElement(hs.I,{name:"question-circle"})))):a.createElement(ls.Z,{confirmText:"Save",onClick:z,onCancel:Ce,onConfirm:ce,disabled:X},"Change role"))}const Cd=({lockMessage:F})=>{const z=(0,It.of)(bd);return a.createElement("div",{className:z.disabledTooltip},a.createElement("span",{className:z.lockMessageClass},F),a.createElement(ms.m,{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:z.tooltipItemLink,href:"https://grafana.com/docs/grafana/latest/auth",rel:"noreferrer noopener",target:"_blank"},"Grafana authentication docs"),"\xA0for details.")},a.createElement(hs.I,{name:"question-circle"})))},bd=F=>({disabledTooltip:(0,rt.css)` display: flex; `,tooltipItemLink:(0,rt.css)` color: ${F.v1.palette.blue95}; `,lockMessageClass:(0,rt.css)` font-style: italic; margin-left: 1.8rem; margin-right: 0.6rem; `}),vm=[{label:"Yes",value:!0},{label:"No",value:!1}];function Em({isGrafanaAdmin:F,isExternalUser:z,lockMessage:X,onGrafanaAdminChange:ce}){const[Ce,Ae]=(0,a.useState)(!1),[Fe,Qe]=(0,a.useState)(F),qe=()=>Ae(!0),ut=()=>{Ae(!1),Qe(F)},vt=()=>ce(Fe),Ct=an.TP.hasPermission(Ut.AccessControlAction.UsersPermissionsUpdate)&&!z,Ht=(0,It.of)(qo);return a.createElement("div",null,a.createElement("h3",{className:"page-heading"},"Permissions"),a.createElement("table",{className:"filter-table form-inline"},a.createElement("tbody",null,a.createElement("tr",null,a.createElement("td",{className:"width-16"},"Grafana Admin"),Ce?a.createElement("td",{colSpan:2},a.createElement(oe.z,{options:vm,value:Fe,onChange:Qe,autoFocus:!0})):a.createElement("td",{colSpan:2},F?a.createElement(a.Fragment,null,a.createElement(hs.I,{name:"shield"})," Yes"):a.createElement(a.Fragment,null,"No")),a.createElement("td",null,Ct&&a.createElement(ls.Z,{onClick:qe,onConfirm:vt,onCancel:ut,confirmText:"Change"},"Change"),z&&a.createElement("div",{className:Ht.lockMessageClass},a.createElement(Cd,{lockMessage:X})))))))}const qo=F=>({lockMessageClass:(0,rt.css)` display: flex; justify-content: flex-end; font-style: italic; margin-right: ${F.spacing(.6)}; `});var Al=e(96374),Td=e(91634);function Gl({user:F,onUserUpdate:z,onUserDelete:X,onUserDisable:ce,onUserEnable:Ce,onPasswordChange:Ae}){const[Fe,Qe]=(0,a.useState)(!1),[qe,ut]=(0,a.useState)(!1),vt=(0,a.useRef)(null),Ct=hi=>()=>{Qe(hi),!hi&&vt.current&&vt.current.focus()},Ht=(0,a.useRef)(null),Nt=hi=>()=>{ut(hi),!hi&&Ht.current&&Ht.current.focus()},At=()=>X(F.id),kt=()=>ce(F.id),En=()=>Ce(F.id),Ma=hi=>{z({...F,name:hi})},$a=hi=>{z({...F,email:hi})},Na=hi=>{z({...F,login:hi})},Ba=F.authLabels?.length&&F.authLabels[0],_r=Ba?`Synced via ${Ba}`:"",pi=F.isExternal||!an.TP.hasPermissionInMetadata(Ut.AccessControlAction.UsersWrite,F),uh=F.isExternal||!an.TP.hasPermissionInMetadata(Ut.AccessControlAction.UsersPasswordUpdate,F),hD=an.TP.hasPermissionInMetadata(Ut.AccessControlAction.UsersDelete,F),vD=an.TP.hasPermissionInMetadata(Ut.AccessControlAction.UsersDisable,F),ED=an.TP.hasPermissionInMetadata(Ut.AccessControlAction.UsersEnable,F);return a.createElement("div",null,a.createElement("h3",{className:"page-heading"},"User information"),a.createElement(Zt.B,{direction:"column",gap:1.5},a.createElement("div",null,a.createElement("table",{className:"filter-table form-inline"},a.createElement("tbody",null,a.createElement(Rl,{label:"Name",value:F.name,locked:pi,lockMessage:_r,onChange:Ma}),a.createElement(Rl,{label:"Email",value:F.email,locked:pi,lockMessage:_r,onChange:$a}),a.createElement(Rl,{label:"Username",value:F.login,locked:pi,lockMessage:_r,onChange:Na}),a.createElement(Rl,{label:"Password",value:"********",inputType:"password",locked:uh,lockMessage:_r,onChange:Ae})))),a.createElement(Zt.B,{gap:2},hD&&a.createElement(a.Fragment,null,a.createElement(ie.$n,{variant:"destructive",onClick:Ct(!0),ref:vt},"Delete user"),a.createElement(Al.u,{isOpen:Fe,title:"Delete user",body:"Are you sure you want to delete this user?",confirmText:"Delete user",onConfirm:At,onDismiss:Ct(!1)})),F.isDisabled&&ED&&a.createElement(ie.$n,{variant:"secondary",onClick:En},"Enable user"),!F.isDisabled&&vD&&a.createElement(a.Fragment,null,a.createElement(ie.$n,{variant:"secondary",onClick:Nt(!0),ref:Ht},"Disable user"),a.createElement(Al.u,{isOpen:qe,title:"Disable user",body:"Are you sure you want to disable this user?",confirmText:"Disable user",onConfirm:kt,onDismiss:Nt(!1)})))))}class Rl extends a.PureComponent{constructor(){super(...arguments),this.state={editing:!1,value:this.props.value||""},this.setInputElem=z=>{this.inputElem=z},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=(z,X)=>{X!==Td.O.Invalid&&this.setState({value:z.target.value})},this.onInputBlur=(z,X)=>{X!==Td.O.Invalid&&this.setState({value:z.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:z,locked:X,lockMessage:ce,inputType:Ce}=this.props,{value:Ae}=this.state,Fe=(0,rt.cx)("width-16",(0,rt.css)` font-weight: 500; `);if(X)return a.createElement(ym,{label:z,value:Ae,lockMessage:ce});const Qe=`${z}-input`;return a.createElement("tr",null,a.createElement("td",{className:Fe},a.createElement("label",{htmlFor:Qe},z)),a.createElement("td",{className:"width-25",colSpan:2},this.state.editing?a.createElement(me.p,{id:Qe,type:Ce,defaultValue:Ae,onBlur:this.onInputBlur,onChange:this.onInputChange,ref:this.setInputElem,width:30}):a.createElement("span",null,this.props.value)),a.createElement("td",null,a.createElement(ls.Z,{confirmText:"Save",onClick:this.onEditClick,onConfirm:this.onSave,onCancel:this.onCancelClick},"Edit")))}}Rl.defaultProps={value:"",locked:!1,lockMessage:"",inputType:"text"};const ym=({label:F,value:z,lockMessage:X})=>{const ce=(0,rt.css)` font-style: italic; margin-right: 0.6rem; `,Ce=(0,rt.cx)("width-16",(0,rt.css)` font-weight: 500; `);return a.createElement("tr",null,a.createElement("td",{className:Ce},F),a.createElement("td",{className:"width-25",colSpan:2},z),a.createElement("td",null,a.createElement("span",{className:ce},X)))};class Dm 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=z=>()=>{this.props.onSessionRevoke(z)},this.onAllSessionsRevoke=()=>{this.setState({showLogoutModal:!1}),this.props.onAllSessionsRevoke()}}render(){const{sessions:z}=this.props,{showLogoutModal:X}=this.state,ce=an.TP.hasPermission(Ut.AccessControlAction.UsersLogout);return a.createElement("div",null,a.createElement("h3",{className:"page-heading"},"Sessions"),a.createElement(Zt.B,{direction:"column",gap:1.5},a.createElement("div",null,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,z&&z.map((Ce,Ae)=>a.createElement("tr",{key:`${Ce.id}-${Ae}`},a.createElement("td",null,Ce.isActive?"Now":Ce.seenAt),a.createElement("td",null,(0,Ga.Xj)(Ce.createdAt,{dateStyle:"long"})),a.createElement("td",null,Ce.clientIp),a.createElement("td",null,`${Ce.browser} on ${Ce.os} ${Ce.osVersion}`),a.createElement("td",null,a.createElement("div",{className:"pull-right"},ce&&a.createElement(ls.Z,{confirmText:"Confirm logout",confirmVariant:"destructive",onConfirm:this.onSessionRevoke(Ce.id),autoFocus:!0},"Force logout")))))))),a.createElement("div",null,ce&&z.length>0&&a.createElement(ie.$n,{variant:"secondary",onClick:this.showLogoutConfirmationModal,ref:this.forceAllLogoutButton},"Force logout from all devices"),a.createElement(Al.u,{isOpen:X,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 Pm=Dm;var Ur=e(57334);class Md extends a.PureComponent{constructor(){super(...arguments),this.onUserUpdate=z=>{this.props.updateUser(z)},this.onPasswordChange=z=>{const{user:X,setUserPassword:ce}=this.props;X&&ce(X.id,z)},this.onUserDelete=z=>{this.props.deleteUser(z)},this.onUserDisable=z=>{this.props.disableUser(z)},this.onUserEnable=z=>{this.props.enableUser(z)},this.onGrafanaAdminChange=z=>{const{user:X,updateUserPermissions:ce}=this.props;X&&ce(X.id,z)},this.onOrgRemove=z=>{const{user:X,deleteOrgUser:ce}=this.props;X&&ce(X.id,z)},this.onOrgRoleChange=(z,X)=>{const{user:ce,updateOrgUserRole:Ce}=this.props;ce&&Ce(ce.id,z,X)},this.onOrgAdd=(z,X)=>{const{user:ce,addOrgUser:Ce}=this.props;ce&&Ce(ce,z,X)},this.onSessionRevoke=z=>{const{user:X,revokeSession:ce}=this.props;X&&ce(z,X.id)},this.onAllSessionsRevoke=()=>{const{user:z,revokeAllSessions:X}=this.props;z&&X(z.id)},this.onUserSync=()=>{const{user:z,syncLdapUser:X}=this.props;z&&X(z.id)}}async componentDidMount(){const{match:z,loadAdminUserPage:X}=this.props;X(parseInt(z.params.id,10))}render(){const{user:z,orgs:X,sessions:ce,ldapSyncInfo:Ce,isLoading:Ae}=this.props,Fe=z?.isExternal&&z?.authLabels?.includes("LDAP"),Qe=an.TP.hasPermission(Ut.AccessControlAction.UsersAuthTokenList),qe=an.TP.hasPermission(Ut.AccessControlAction.LDAPStatusRead),ut=z?.authLabels?.[0],vt=ut?`Synced via ${ut}`:"",Ct={text:z?.login??"",icon:"shield",subTitle:"Manage settings for an individual user."};return a.createElement(dr.Y,{navId:"global-users",pageNav:Ct},a.createElement(dr.Y.Contents,{isLoading:Ae},a.createElement(Zt.B,{gap:5,direction:"column"},z&&a.createElement(a.Fragment,null,a.createElement(Gl,{user:z,onUserUpdate:this.onUserUpdate,onUserDelete:this.onUserDelete,onUserDisable:this.onUserDisable,onUserEnable:this.onUserEnable,onPasswordChange:this.onPasswordChange}),Fe&&z?.isExternallySynced&&(0,ln.a)("ldapsync")&&Ce&&qe&&a.createElement(qn,{ldapSyncInfo:Ce,user:z,onUserSync:this.onUserSync}),a.createElement(Em,{isGrafanaAdmin:z.isGrafanaAdmin,isExternalUser:z?.isGrafanaAdminExternallySynced,lockMessage:vt,onGrafanaAdminChange:this.onGrafanaAdminChange})),X&&a.createElement(Pd,{user:z,orgs:X,isExternalUser:z?.isExternallySynced,onOrgRemove:this.onOrgRemove,onOrgRoleChange:this.onOrgRoleChange,onOrgAdd:this.onOrgAdd}),ce&&Qe&&a.createElement(Pm,{sessions:ce,onSessionRevoke:this.onSessionRevoke,onAllSessionsRevoke:this.onAllSessionsRevoke}))))}}const xr=F=>({user:F.userAdmin.user,sessions:F.userAdmin.sessions,orgs:F.userAdmin.orgs,ldapSyncInfo:F.ldap.syncInfo,isLoading:F.userAdmin.isLoading,error:F.userAdmin.error}),Cm={loadAdminUserPage:Ur.kz,updateUser:Ur.TK,setUserPassword:Ur.ly,disableUser:Ur.MV,enableUser:Ur.nr,deleteUser:Ur.hG,updateUserPermissions:Ur.N6,addOrgUser:Ur.nh,updateOrgUserRole:Ur.P3,deleteOrgUser:Ur.Pi,revokeSession:Ur.T$,revokeAllSessions:Ur.VR,syncLdapUser:Ur.mI},bm=(0,go.connect)(xr,Cm)(Md);var Tm=e(49785),ol=e(94753),il=e(28389);const Sd=({ldapConnectionInfo:F})=>{const z=(0,a.useMemo)(()=>[{id:"host",header:"Host",disableGrow:!0},{id:"port",header:"Port",disableGrow:!0},{id:"available",cell:ce=>ce.cell.value?a.createElement(Zt.B,{justifyContent:"end"},a.createElement(ms.m,{content:"Connection is available"},a.createElement(hs.I,{name:"check",className:"pull-right"}))):a.createElement(Zt.B,{justifyContent:"end"},a.createElement(ms.m,{content:"Connection is not available"},a.createElement(hs.I,{name:"exclamation-triangle"})))}],[]),X=(0,a.useMemo)(()=>F,[F]);return a.createElement("section",null,a.createElement(Zt.B,{direction:"column",gap:2},a.createElement(ol.E,{color:"primary",element:"h3"},"LDAP Connection"),a.createElement(il.j,{data:X,columns:z,getRowId:ce=>ce.host+ce.port}),a.createElement(Mm,{ldapConnectionInfo:F})))},Mm=({ldapConnectionInfo:F})=>{if(!F.some(Ce=>Ce.error))return null;const X=[];F.forEach(Ce=>{Ce.error&&X.push(Ce)});const ce=X.map((Ce,Ae)=>a.createElement("div",{key:Ae},a.createElement("span",{style:{fontWeight:500}},Ce.host,":",Ce.port,a.createElement("br",null)),a.createElement("span",null,Ce.error),Ae!==X.length-1&&a.createElement(a.Fragment,null,a.createElement("br",null),a.createElement("br",null))));return a.createElement(vn.F,{title:"Connection error",severity:Ut.AppNotificationSeverity.Error},ce)},Sm="dddd YYYY-MM-DD HH:mm zz",xm=({ldapSyncInfo:F})=>{const z=(0,Un.LE)(F.nextSync,{format:Sm}),X=[{id:"syncAttribute"},{id:"syncValue"}],ce=[{syncAttribute:"Active synchronization",syncValue:F.enabled?"Enabled":"Disabled"},{syncAttribute:"Scheduled",syncValue:F.schedule},{syncAttribute:"Next synchronization",syncValue:z}];return a.createElement("section",null,a.createElement(ol.E,{element:"h3"},"LDAP Synchronization"),a.createElement(il.j,{data:ce,columns:X,getRowId:Ce=>Ce.syncAttribute}))},Cc=({groups:F})=>{const z=(0,a.useMemo)(()=>F,[F]),X=(0,a.useMemo)(()=>[{id:"groupDN",header:"LDAP Group"},{id:"orgName",header:"Organization",cell:ce=>ce.value&&ce.row.original.orgRole?ce.value:""},{id:"orgRole",header:"Role",cell:ce=>ce.value||a.createElement(a.Fragment,null,"No match"," ",a.createElement(ms.m,{content:"No matching organizations found"},a.createElement(hs.I,{name:"info-circle"})))}],[]);return a.createElement(il.j,{headerTooltips:{orgName:{content:"Only the first match for an Organization will be used",iconName:"info-circle"}},columns:X,data:z,getRowId:ce=>ce.orgId+ce.orgRole+ce.groupDN})},Om=({info:F})=>{const z=(0,a.useMemo)(()=>[{id:"userInfo",header:"User Information",disableGrow:!0},{id:"ldapValue"},{id:"cfgAttrValue",header:"LDAP attribute"}],[]),X=(0,a.useMemo)(()=>[{userInfo:"First name",ldapValue:F.name.ldapValue,cfgAttrValue:F.name.cfgAttrValue},{userInfo:"Surname",ldapValue:F.surname.ldapValue,cfgAttrValue:F.surname.cfgAttrValue},{userInfo:"Username",ldapValue:F.login.ldapValue,cfgAttrValue:F.login.cfgAttrValue},{userInfo:"Email",ldapValue:F.email.ldapValue,cfgAttrValue:F.email.cfgAttrValue}],[F]);return a.createElement(il.j,{columns:z,data:X,getRowId:ce=>ce.userInfo})},po=({permissions:F})=>{const z=(0,a.useMemo)(()=>[{id:"permission",header:"Permissions",disableGrow:!0},{id:"value"}],[]),X=(0,a.useMemo)(()=>[{permission:"Grafana admin",value:F.isGrafanaAdmin?a.createElement(a.Fragment,null,a.createElement(hs.I,{name:"shield"})," Yes"):"No"},{permission:"Status",value:F.isDisabled?a.createElement(a.Fragment,null,a.createElement(hs.I,{name:"times"})," Inactive"):a.createElement(a.Fragment,null,a.createElement(hs.I,{name:"check"})," Active")}],[F]);return a.createElement(il.j,{data:X,columns:z,getRowId:ce=>ce.permission})},Im=({teams:F})=>{const z=(0,a.useMemo)(()=>[{id:"groupDN",header:"LDAP Group"},{id:"orgName",header:"Organization",cell:({row:{original:{orgName:X}}})=>a.createElement(a.Fragment,null,X||"No matching teams found")},{id:"teamName",header:"Team",cell:({row:{original:{teamName:X,orgName:ce}}})=>X&&ce?X:""}],[]);return a.createElement(il.j,{data:F,columns:z,getRowId:X=>X.teamName})},Am=({ldapUser:F})=>a.createElement(Zt.B,{direction:"column",gap:4},a.createElement(Om,{info:F.info}),a.createElement(po,{permissions:F.permissions}),F.roles&&F.roles.length>0&&a.createElement(Cc,{groups:F.roles}),F.teams&&F.teams.length>0?a.createElement(Im,{teams:F.teams}):a.createElement(ue.a,null,a.createElement(ol.E,null,"No teams found via LDAP"))),Rm={text:"LDAP",subTitle:"Verify your LDAP and user mapping configuration.",icon:"book",id:"LDAP"},Lm=({clearUserMappingInfo:F,queryParams:z,loadLdapState:X,loadLdapSyncStatus:ce,loadUserMapping:Ce,clearUserError:Ae,ldapUser:Fe,userError:Qe,ldapError:qe,ldapSyncInfo:ut,ldapConnectionInfo:vt})=>{const[Ct,Ht]=(0,a.useState)(!0),{register:Nt,handleSubmit:At}=(0,Tm.mN)(),kt=(0,a.useCallback)(async Na=>Ce(Na),[Ce]);(0,a.useEffect)(()=>{const Na=async()=>Promise.all([X(),ce()]);async function Ba(){await F(),await Na(),z.username&&await kt(z.username),Ht(!1)}Ba()},[F,kt,X,ce,z]);const En=({username:Na})=>{Na&&kt(Na)},Ma=()=>{Ae()},$a=an.TP.hasPermission(Ut.AccessControlAction.LDAPUsersRead);return a.createElement(dr.Y,{navId:"authentication",pageNav:Rm},a.createElement(dr.Y.Contents,{isLoading:Ct},a.createElement(Zt.B,{direction:"column",gap:4},qe&&qe.title&&a.createElement(vn.F,{title:qe.title,severity:Ut.AppNotificationSeverity.Error},qe.body),a.createElement(Sd,{ldapConnectionInfo:vt}),(0,ln.a)("ldapsync")&&ut&&a.createElement(xm,{ldapSyncInfo:ut}),$a&&a.createElement("section",null,a.createElement("h3",null,"Test user mapping"),a.createElement("form",{onSubmit:At(En)},a.createElement(Ha.D,{label:"Username"},a.createElement(me.p,{...Nt("username",{required:!0}),width:34,id:"username",type:"text",defaultValue:z.username,addonAfter:a.createElement(ie.$n,{variant:"primary",type:"submit"},"Run")}))),Qe&&Qe.title&&a.createElement(vn.F,{title:Qe.title,severity:Ut.AppNotificationSeverity.Error,onRemove:Ma},Qe.body),Fe&&a.createElement(Am,{ldapUser:Fe})))))},jr=F=>({ldapConnectionInfo:F.ldap.connectionInfo,ldapUser:F.ldap.user,ldapSyncInfo:F.ldap.syncInfo,userError:F.ldap.userError,ldapError:F.ldap.ldapError}),Bm={loadLdapState:Ur.JI,loadLdapSyncStatus:Ur.pm,loadUserMapping:Ur.Kg,clearUserError:Ur.DX,clearUserMappingInfo:Ur.Jc},bc=(0,go.connect)(jr,Bm)(Lm);var Kn=e(27921),or=e(75471);const xd=[],Tc=[...xd,{path:"/alerting-legacy",component:()=>a.createElement(Ie,{navId:"alerting-legacy"})},{path:"/alerting-legacy/list",component:(0,Kn.A)(()=>e.e(9312).then(e.bind(e,71826)))},{path:"/alerting-legacy/ng/list",component:(0,Kn.A)(()=>e.e(9312).then(e.bind(e,71826)))},{path:"/alerting-legacy/notifications",roles:_.$W.unifiedAlertingEnabled?()=>["Editor","Admin"]:void 0,component:(0,Kn.A)(()=>e.e(545).then(e.bind(e,22099)))},{path:"/alerting-legacy/notifications/templates/new",roles:()=>["Editor","Admin"],component:(0,Kn.A)(()=>e.e(545).then(e.bind(e,22099)))},{path:"/alerting-legacy/notifications/templates/:id/edit",roles:()=>["Editor","Admin"],component:(0,Kn.A)(()=>e.e(545).then(e.bind(e,22099)))},{path:"/alerting-legacy/notifications/receivers/new",roles:()=>["Editor","Admin"],component:(0,Kn.A)(()=>e.e(545).then(e.bind(e,22099)))},{path:"/alerting-legacy/notifications/receivers/:id/edit",roles:()=>["Editor","Admin"],component:(0,Kn.A)(()=>e.e(545).then(e.bind(e,22099)))},{path:"/alerting-legacy/notifications/global-config",roles:()=>["Admin","Editor"],component:(0,Kn.A)(()=>e.e(545).then(e.bind(e,22099)))},{path:"/alerting-legacy/notification/new",component:(0,Kn.A)(()=>e.e(2370).then(e.bind(e,47265)))},{path:"/alerting-legacy/notification/:id/edit",component:(0,Kn.A)(()=>e.e(5890).then(e.bind(e,19051)))},{path:"/alerting-legacy/upgrade",roles:()=>["Admin"],component:(0,Kn.A)(()=>e.e(7391).then(e.bind(e,57957)))}],Mc=[...xd,{path:"/alerting",component:(0,Kn.A)(()=>e.e(3236).then(e.bind(e,58164)))},{path:"/alerting/home",exact:!1,component:(0,Kn.A)(()=>e.e(3236).then(e.bind(e,58164)))},{path:"/alerting/list",roles:(0,or.C0)([Ut.AccessControlAction.AlertingRuleRead,Ut.AccessControlAction.AlertingRuleExternalRead]),component:(0,Kn.A)(()=>Promise.all([e.e(3541),e.e(3511)]).then(e.bind(e,31987)))},{path:"/alerting/routes",roles:(0,or.C0)([Ut.AccessControlAction.AlertingNotificationsRead,Ut.AccessControlAction.AlertingNotificationsExternalRead]),component:(0,Kn.A)(()=>Promise.all([e.e(0),e.e(6719)]).then(e.bind(e,34708)))},{path:"/alerting/routes/mute-timing/new",roles:(0,or.C0)([Ut.AccessControlAction.AlertingNotificationsWrite,Ut.AccessControlAction.AlertingNotificationsExternalWrite]),component:(0,Kn.A)(()=>e.e(4501).then(e.bind(e,36333)))},{path:"/alerting/routes/mute-timing/edit",roles:(0,or.C0)([Ut.AccessControlAction.AlertingNotificationsWrite,Ut.AccessControlAction.AlertingNotificationsExternalWrite]),component:(0,Kn.A)(()=>e.e(4501).then(e.bind(e,36333)))},{path:"/alerting/silences",roles:(0,or.C0)([Ut.AccessControlAction.AlertingInstanceRead,Ut.AccessControlAction.AlertingInstancesExternalRead]),component:(0,Kn.A)(()=>e.e(9347).then(e.bind(e,24480)))},{path:"/alerting/silence/new",roles:(0,or.C0)([Ut.AccessControlAction.AlertingInstanceCreate,Ut.AccessControlAction.AlertingInstancesExternalWrite]),component:(0,Kn.A)(()=>e.e(9347).then(e.bind(e,24480)))},{path:"/alerting/silence/:id/edit",roles:(0,or.C0)([Ut.AccessControlAction.AlertingInstanceUpdate,Ut.AccessControlAction.AlertingInstancesExternalWrite]),component:(0,Kn.A)(()=>e.e(9347).then(e.bind(e,24480)))},{path:"/alerting/notifications",roles:(0,or.C0)([Ut.AccessControlAction.AlertingNotificationsRead,Ut.AccessControlAction.AlertingNotificationsExternalRead]),component:(0,Kn.A)(()=>e.e(4772).then(e.bind(e,78199)))},{path:"/alerting/notifications/:type/new",roles:(0,or.C0)([Ut.AccessControlAction.AlertingNotificationsWrite,Ut.AccessControlAction.AlertingNotificationsExternalWrite]),component:(0,Kn.A)(()=>e.e(4772).then(e.bind(e,78199)))},{path:"/alerting/notifications/receivers/:id/edit",roles:(0,or.C0)([Ut.AccessControlAction.AlertingNotificationsWrite,Ut.AccessControlAction.AlertingNotificationsExternalWrite,Ut.AccessControlAction.AlertingNotificationsRead,Ut.AccessControlAction.AlertingNotificationsExternalRead]),component:(0,Kn.A)(()=>e.e(4772).then(e.bind(e,78199)))},{path:"/alerting/notifications/:type/:id/edit",roles:(0,or.C0)([Ut.AccessControlAction.AlertingNotificationsWrite,Ut.AccessControlAction.AlertingNotificationsExternalWrite]),component:(0,Kn.A)(()=>e.e(4772).then(e.bind(e,78199)))},{path:"/alerting/notifications/:type/:id/duplicate",roles:(0,or.C0)([Ut.AccessControlAction.AlertingNotificationsWrite,Ut.AccessControlAction.AlertingNotificationsExternalWrite]),component:(0,Kn.A)(()=>e.e(4772).then(e.bind(e,78199)))},{path:"/alerting/notifications/:type",roles:(0,or.C0)([Ut.AccessControlAction.AlertingNotificationsWrite,Ut.AccessControlAction.AlertingNotificationsExternalWrite]),component:(0,Kn.A)(()=>e.e(4772).then(e.bind(e,78199)))},{path:"/alerting/groups/",roles:(0,or.C0)([Ut.AccessControlAction.AlertingInstanceRead,Ut.AccessControlAction.AlertingInstancesExternalRead]),component:(0,Kn.A)(()=>e.e(8427).then(e.bind(e,12564)))},{path:"/alerting/new/:type?",pageClass:"page-alerting",roles:(0,or.C0)([Ut.AccessControlAction.AlertingRuleCreate,Ut.AccessControlAction.AlertingRuleExternalWrite]),component:(0,Kn.A)(()=>Promise.all([e.e(1660),e.e(0),e.e(3726),e.e(3541),e.e(4009)]).then(e.bind(e,50166)))},{path:"/alerting/:id/edit",pageClass:"page-alerting",roles:(0,or.C0)([Ut.AccessControlAction.AlertingRuleUpdate,Ut.AccessControlAction.AlertingRuleExternalWrite]),component:(0,Kn.A)(()=>Promise.all([e.e(1660),e.e(0),e.e(3726),e.e(3541),e.e(4009)]).then(e.bind(e,50166)))},{path:"/alerting/:id/modify-export",pageClass:"page-alerting",roles:(0,or.C0)([Ut.AccessControlAction.AlertingRuleRead]),component:(0,Kn.A)(()=>Promise.all([e.e(1660),e.e(0),e.e(3726),e.e(3541),e.e(4009)]).then(e.bind(e,69179)))},{path:"/alerting/:sourceName/:id/view",pageClass:"page-alerting",roles:(0,or.C0)([Ut.AccessControlAction.AlertingRuleRead,Ut.AccessControlAction.AlertingRuleExternalRead]),component:(0,Kn.A)(()=>Promise.resolve().then(e.bind(e,79741)))},{path:"/alerting/:sourceName/:name/find",pageClass:"page-alerting",roles:(0,or.C0)([Ut.AccessControlAction.AlertingRuleRead,Ut.AccessControlAction.AlertingRuleExternalRead]),component:(0,Kn.A)(()=>e.e(5516).then(e.bind(e,10042)))},{path:"/alerting/admin",roles:()=>["Admin"],component:(0,Kn.A)(()=>e.e(6130).then(e.bind(e,24513)))}];function Um(F=_.$W){if(F.unifiedAlertingEnabled)return Mc;if(F.alertingEnabled){if(_.$W.featureToggles.alertingPreviewUpgrade)return[...Tc,...Mc];const X=[{path:"/alerting",component:()=>a.createElement(Ws.rd,{to:"/alerting-legacy"})},{path:"/alerting/list",component:()=>a.createElement(Ws.rd,{to:"/alerting-legacy/list"})},{path:"/alerting/notifications",component:()=>a.createElement(Ws.rd,{to:"/alerting-legacy/notifications"})},{path:"/alerting/notification/new",component:()=>a.createElement(Ws.rd,{to:"/alerting-legacy/notification/new"})},{path:"/alerting/notification/:id/edit",component:ce=>a.createElement(Ws.rd,{to:"/alerting-legacy/notification/:id/edit".replace(":id",ce.match.params.id)})}];return[...Tc,...X]}return(0,p.uniq)([...Tc,...Mc].map(X=>X.path)).map(X=>({path:X,component:(0,Kn.A)(()=>e.e(5292).then(e.bind(e,28785)))}))}var ll=e(6320);const Od=F=>({alertContent:(0,rt.css)` display: flex; flex-direction: row; padding: 0; justify-content: space-between; align-items: center; `,alertParagraph:(0,rt.css)` margin: 0 ${F.spacing(1)} 0 0; line-height: ${F.spacing(F.components.height.sm)}; `});function Id(){const F=(0,It.of)(Od),[z,X]=(0,a.useState)(!0);return z?a.createElement(vn.F,{severity:"info",title:"",onRemove:()=>X(!1)},a.createElement("div",{className:F.alertContent},a.createElement("p",{className:F.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(ie.z9,{"aria-label":"Link to Connections",icon:"arrow-right",href:ll.b.DataSources,fill:"text"},"Go to connections"))):a.createElement(a.Fragment,null)}function Nm(){return[{path:`/${ll.q}`,exact:!1,component:(0,Kn.A)(()=>Promise.all([e.e(6359),e.e(3418),e.e(2154)]).then(e.bind(e,39774)))}]}var jl=e(83883),cl=e(66253);const wm=[{path:"/plugins",navId:"plugins",roles:Sc([Ut.AccessControlAction.PluginsInstall,Ut.AccessControlAction.PluginsWrite],["Admin","ServerAdmin"]),routeName:cl.vk.Home,component:(0,Kn.A)(()=>e.e(4519).then(e.bind(e,65965)))},{path:"/plugins/browse",navId:"plugins",roles:Sc([Ut.AccessControlAction.PluginsInstall,Ut.AccessControlAction.PluginsWrite],["Admin","ServerAdmin"]),routeName:cl.vk.Browse,component:(0,Kn.A)(()=>e.e(4519).then(e.bind(e,65965)))},{path:"/plugins/:pluginId/",navId:"plugins",roles:Sc([Ut.AccessControlAction.PluginsInstall,Ut.AccessControlAction.PluginsWrite],["Admin","ServerAdmin"]),routeName:cl.vk.Details,component:(0,Kn.A)(()=>Promise.all([e.e(6359),e.e(3418),e.e(7891)]).then(e.bind(e,86400)))}];function Sc(F,z){return()=>F.some(X=>an.TP.hasPermission(X))?[]:z}function Fm(){return wm}var Wm=e(17422),Mi=e(30038),Km=e(13834),Yl=e(62625),dl=e(26272),Ad=e(39419),Fo=e(76888);function $m(F){return console.error(F),Ql("Exception thrown","See console for details")}function Vm(){return Ql("Page not found","404 Error")}function Ql(F,z){const X={text:F,subTitle:z,icon:"exclamation-triangle"};return{node:X,main:X}}var _m=e(94954),Rd=e(27716),Vr=e(91629),xc=e(60677),ul=e(72798);const Oc={loading:!0,loadingError:!1,pluginNav:null,plugin:null};function Ld({pluginId:F,pluginNavSection:z}){const X=(0,Ws.W5)(),ce=(0,Ws.zy)(),[Ce,Ae]=(0,a.useReducer)(ml.reducer,Oc),Fe=j.$.appSubUrl+ce.pathname+ce.search,{plugin:Qe,loading:qe,loadingError:ut,pluginNav:vt}=Ce,Ct=(0,xc.Wy)(z,vt,Fe),Ht=(0,a.useMemo)(()=>(0,x.SE)(ce.search),[ce.search]),Nt=(0,a.useMemo)(()=>(0,ul.S)(Ct),[Ct]),At=(0,Fo.Il)();(0,a.useEffect)(()=>{Bd(F,Ae)},[F]);const kt=(0,a.useCallback)(Na=>Ae(ml.actions.changeNav(Na)),[]);if(!Qe||F!==Qe.meta.id){const Na=At.chrome.state.getValue().layout;return a.createElement(dr.Y,{navModel:Ct,pageNav:{text:""},layout:Na},qe&&a.createElement(Ad.A,null),!qe&&ut&&a.createElement(bt.L,{entity:"App"}))}if(!Qe.root)return a.createElement(dr.Y,{navModel:Ct??Ql("Plugin load error")},a.createElement("div",null,"No root app page component found"));const En=Qe.root&&a.createElement(Km.a,{meta:Qe.meta},a.createElement(Qe.root,{meta:Qe.meta,basename:X.url,onNavChanged:kt,query:Ht,path:ce.pathname})),Ma=()=>{if(!Qe.meta?.includes)return!0;const Na=Qe.meta?.includes.find(_r=>_r.path===ce.pathname);if(!Na)return!0;if(Na?.action&&j.$.featureToggles.accessControlOnCall)return an.TP.hasPermission(Na.action);if(an.TP.isGrafanaAdmin||an.TP.user.orgRole===Yl.X.Admin)return!0;const Ba=Na?.role||"";return!Ba||an.TP.isEditor&&Ba===Yl.X.Viewer?!0:an.TP.hasRole(Ba)},$a=()=>a.createElement(vn.F,{severity:"warning",title:"Access denied"},"You do not have permission to see this page.");return Ma()?vt?a.createElement(a.Fragment,null,Ct?a.createElement(dr.Y,{navModel:Ct,pageNav:vt?.node},a.createElement(dr.Y.Contents,{isLoading:qe},En)):a.createElement(dr.Y,null,En)):a.createElement(ul.A.Provider,{value:Nt},En):a.createElement($a,null)}const ml=(0,Mi.Z0)({name:"prom-builder-container",initialState:Oc,reducers:{setState:(F,z)=>{Object.assign(F,z.payload)},changeNav:(F,z)=>{let X=z.payload;X&&X.node.children&&(X={...X,node:{...X.main,hideFromBreadcrumbs:!0}}),F.pluginNav=X}}});async function Bd(F,z){try{const X=await(0,Rd.x)(F).then(ce=>{const Ce=zm(ce);return Ce?(an.lE.emit(dl.r1.alertError,[Ce]),z(ml.actions.setState({pluginNav:Ql(Ce)})),null):(0,Vr.ui)(ce)});z(ml.actions.setState({plugin:X,loading:!1,loadingError:!1,pluginNav:null}))}catch(X){z(ml.actions.setState({plugin:null,loading:!1,loadingError:!0,pluginNav:Vm()}));const ce=X instanceof Error?X:new Error((0,_m.q)(X));xc.z4.logError(ce),console.error(ce)}}function zm(F){return F?F.type!==Ve.QE.app?"Plugin must be an app":F.enabled?null:"Application Not Enabled":"Unknown Plugin"}const Ic=Ld;var Rs=e(99140);function km(){const F=(0,Rs.Gu)(),{navIndex:z}=F,X=Ae=>Ae.startsWith("standalone-plugin-page-/"),ce=Ae=>"pluginId"in Ae&&"id"in Ae;return[...Object.values(z).filter(ce).map(Ae=>{const Fe=(0,Wm.rH)(Ae),Qe=`/a/${Ae.pluginId}`,qe=X(Ae.id)&&Ae.url||Qe,ut=X(Ae.id)&&!Ae.url?.startsWith("/a/");return{path:qe,exact:!1,sensitive:ut,component:()=>a.createElement(Ic,{pluginId:Ae.pluginId,pluginNavSection:Fe})}}),{path:"/a/:pluginId",exact:!1,component:({match:Ae})=>a.createElement(Ic,{pluginId:Ae.params.pluginId,pluginNavSection:z.home})}]}const Ud=[{path:"/profile",component:(0,Kn.A)(()=>e.e(2472).then(e.bind(e,48357)))},{path:"/profile/password",component:(0,Kn.A)(()=>e.e(8107).then(e.bind(e,28107)))},{path:"/profile/select-org",component:(0,Kn.A)(()=>e.e(7430).then(e.bind(e,44613)))},{path:"/profile/notifications",component:(0,Kn.A)(()=>e.e(4140).then(e.bind(e,78015)))}];function Ll(F=_.$W){return F.profileEnabled?Ud:(0,p.uniq)(Ud.map(X=>X.path)).map(X=>({path:X,component:(0,Kn.A)(()=>e.e(5173).then(e.bind(e,35208)))}))}const Hm=()=>!_.$W.publicDashboardsEnabled||!_.$W.featureToggles.publicDashboards?[]:[{path:"/dashboard/public",pageClass:"page-dashboard",routeName:Ut.DashboardRoutes.Public,component:(0,Kn.A)(()=>e.e(5761).then(e.bind(e,53371)))},{path:"/public-dashboards/:accessToken",pageClass:"page-dashboard",routeName:Ut.DashboardRoutes.Public,chromeless:!0,component:(0,Kn.A)(()=>Promise.all([e.e(9569),e.e(6678),e.e(6263),e.e(7197)]).then(e.bind(e,9187)))}],Po=[];function Ac(){return[...km(),{path:"/",pageClass:"page-dashboard",routeName:Ut.DashboardRoutes.Home,component:(0,Kn.A)(()=>Promise.all([e.e(9569),e.e(6678),e.e(6263),e.e(660),e.e(9136)]).then(e.bind(e,24669)))},{path:"/d/:uid/:slug?",pageClass:"page-dashboard",routeName:Ut.DashboardRoutes.Normal,component:(0,Kn.A)(()=>Promise.all([e.e(9569),e.e(6678),e.e(6263),e.e(660),e.e(9136)]).then(e.bind(e,24669)))},{path:"/dashboard/new",roles:()=>Kt.TP.evaluatePermission([Ut.AccessControlAction.DashboardsCreate]),pageClass:"page-dashboard",routeName:Ut.DashboardRoutes.New,component:(0,Kn.A)(()=>Promise.all([e.e(9569),e.e(6678),e.e(6263),e.e(660),e.e(9136),e.e(2976)]).then(e.bind(e,24669)))},{path:"/dashboard/new-with-ds/:datasourceUid",roles:()=>Kt.TP.evaluatePermission([Ut.AccessControlAction.DashboardsCreate]),component:(0,Kn.A)(()=>Promise.all([e.e(9569),e.e(6678),e.e(6263),e.e(660),e.e(9136),e.e(2976)]).then(e.bind(e,30798)))},{path:"/dashboard/:type/:slug",pageClass:"page-dashboard",routeName:Ut.DashboardRoutes.Normal,component:(0,Kn.A)(()=>Promise.all([e.e(9569),e.e(6678),e.e(6263),e.e(660),e.e(9136),e.e(2976)]).then(e.bind(e,24669)))},{path:"/dashboards/embedding-test",component:(0,Kn.A)(()=>Promise.all([e.e(9569),e.e(6678),e.e(6263),e.e(660),e.e(9136),e.e(2976)]).then(e.bind(e,14962)))},{path:"/d-solo/:uid/:slug?",pageClass:"dashboard-solo",routeName:Ut.DashboardRoutes.Normal,chromeless:!0,component:(0,Kn.A)(()=>_.Ay.featureToggles.dashboardSceneSolo?Promise.all([e.e(9569),e.e(7849)]).then(e.bind(e,24880)):Promise.all([e.e(9569),e.e(4492)]).then(e.bind(e,55087)))},{path:"/dashboard-solo/:type/:slug",pageClass:"dashboard-solo",routeName:Ut.DashboardRoutes.Normal,chromeless:!0,component:(0,Kn.A)(()=>Promise.all([e.e(9569),e.e(7849)]).then(e.bind(e,55087)))},{path:"/dashboard/import",component:(0,Kn.A)(()=>e.e(2550).then(e.bind(e,23390)))},{path:jl.I.List,component:()=>a.createElement(Ws.rd,{to:ll.b.DataSources})},{path:jl.I.Edit,component:F=>a.createElement(Ws.rd,{to:ll.b.DataSourcesEdit.replace(":uid",F.match.params.uid)})},{path:jl.I.Dashboards,component:F=>a.createElement(Ws.rd,{to:ll.b.DataSourcesDashboards.replace(":uid",F.match.params.uid)})},{path:jl.I.New,component:()=>a.createElement(Ws.rd,{to:ll.b.DataSourcesNew})},{path:"/datasources/correlations",component:(0,Kn.A)(()=>_.Ay.featureToggles.correlations?e.e(9981).then(e.bind(e,32429)):e.e(8014).then(e.bind(e,55244)))},{path:"/dashboards",component:(0,Kn.A)(()=>Promise.all([e.e(6359),e.e(152)]).then(e.bind(e,32538)))},{path:"/dashboards/f/:uid/:slug",component:(0,Kn.A)(()=>Promise.all([e.e(6359),e.e(152)]).then(e.bind(e,32538)))},{path:"/dashboards/f/:uid",component:(0,Kn.A)(()=>Promise.all([e.e(6359),e.e(152)]).then(e.bind(e,32538)))},{path:"/explore",pageClass:"page-explore",roles:()=>Kt.TP.evaluatePermission([Ut.AccessControlAction.DataSourcesExplore]),component:(0,Kn.A)(()=>_.Ay.exploreEnabled?Promise.all([e.e(660),e.e(1698),e.e(5511),e.e(9604)]).then(e.bind(e,88322)):e.e(4422).then(e.bind(e,53518)))},{path:"/apps",component:()=>a.createElement(Ie,{navId:"apps"})},{path:"/alerts-and-incidents",component:()=>a.createElement(Ie,{navId:"alerts-and-incidents"})},{path:"/testing-and-synthetics",component:()=>a.createElement(Ie,{navId:"testing-and-synthetics"})},{path:"/monitoring",component:()=>a.createElement(Ie,{navId:"monitoring"})},{path:"/infrastructure",component:()=>a.createElement(Ie,{navId:"infrastructure"})},{path:"/frontend",component:()=>a.createElement(Ie,{navId:"frontend"})},{path:"/admin/general",component:()=>a.createElement(Ie,{navId:"cfg/general"})},{path:"/admin/plugins",component:()=>a.createElement(Ie,{navId:"cfg/plugins"})},{path:"/admin/access",component:()=>a.createElement(Ie,{navId:"cfg/access"})},{path:"/org",component:(0,Kn.A)(()=>e.e(1510).then(e.bind(e,69047)))},{path:"/org/new",component:(0,Kn.A)(()=>e.e(7930).then(e.bind(e,25913)))},{path:"/org/users",component:(0,Kn.A)(()=>e.e(9856).then(e.bind(e,31083)))},{path:"/org/users/invite",component:(0,Kn.A)(()=>e.e(7720).then(e.bind(e,91230)))},{path:"/org/apikeys",roles:()=>Kt.TP.evaluatePermission([Ut.AccessControlAction.ActionAPIKeysRead]),component:(0,Kn.A)(()=>e.e(4196).then(e.bind(e,9699)))},{path:"/org/serviceaccounts",roles:()=>Kt.TP.evaluatePermission([Ut.AccessControlAction.ServiceAccountsRead,Ut.AccessControlAction.ServiceAccountsCreate]),component:(0,Kn.A)(()=>e.e(6777).then(e.bind(e,74409)))},{path:"/org/serviceaccounts/create",component:(0,Kn.A)(()=>e.e(4176).then(e.bind(e,63606)))},{path:"/org/serviceaccounts/:id",component:(0,Kn.A)(()=>e.e(6576).then(e.bind(e,82936)))},{path:"/org/teams",roles:()=>Kt.TP.evaluatePermission([Ut.AccessControlAction.ActionTeamsRead,Ut.AccessControlAction.ActionTeamsCreate]),component:(0,Kn.A)(()=>e.e(1036).then(e.bind(e,52576)))},{path:"/org/teams/new",roles:()=>Kt.TP.evaluatePermission([Ut.AccessControlAction.ActionTeamsCreate]),component:(0,Kn.A)(()=>e.e(5436).then(e.bind(e,80011)))},{path:"/org/teams/edit/:id/:page?",roles:()=>Kt.TP.evaluatePermission([Ut.AccessControlAction.ActionTeamsRead,Ut.AccessControlAction.ActionTeamsCreate]),component:(0,Kn.A)(()=>e.e(2212).then(e.bind(e,92886)))},{path:"/admin",component:()=>a.createElement(Ie,{navId:"cfg",header:a.createElement(Id,null)})},{path:"/admin/authentication",roles:()=>Kt.TP.evaluatePermission([Ut.AccessControlAction.SettingsWrite]),component:_.Ay.licenseInfo.enabledFeatures?.saml||_.Ay.ldapEnabled||_.Ay.featureToggles.ssoSettingsApi?(0,Kn.A)(()=>e.e(5592).then(e.bind(e,10437))):()=>a.createElement(Ws.rd,{to:"/admin"})},{path:"/admin/authentication/ldap",component:bc},{path:"/admin/authentication/:provider",roles:()=>Kt.TP.evaluatePermission([Ut.AccessControlAction.SettingsWrite]),component:_.Ay.featureToggles.ssoSettingsApi?(0,Kn.A)(()=>e.e(5592).then(e.bind(e,22468))):()=>a.createElement(Ws.rd,{to:"/admin"})},{path:"/admin/settings",component:(0,Kn.A)(()=>e.e(7659).then(e.bind(e,98493)))},{path:"/admin/upgrading",component:(0,Kn.A)(()=>e.e(5356).then(e.bind(e,55356)))},{path:"/admin/users",component:(0,Kn.A)(()=>e.e(1743).then(e.bind(e,20972)))},{path:"/admin/users/create",component:(0,Kn.A)(()=>e.e(9239).then(e.bind(e,64665)))},{path:"/admin/users/edit/:id",component:bm},{path:"/admin/orgs",component:(0,Kn.A)(()=>e.e(9736).then(e.bind(e,24870)))},{path:"/admin/orgs/edit/:id",component:(0,Kn.A)(()=>e.e(9119).then(e.bind(e,57582)))},{path:"/admin/featuretoggles",component:_.Ay.featureToggles.featureToggleAdminPage?(0,Kn.A)(()=>e.e(7024).then(e.bind(e,47295))):()=>a.createElement(Ws.rd,{to:"/admin"})},{path:"/admin/storage/:path*",roles:()=>["Admin"],component:(0,Kn.A)(()=>e.e(1927).then(e.bind(e,68932)))},{path:"/admin/stats",component:(0,Kn.A)(()=>e.e(9299).then(e.bind(e,51372)))},{path:"/login",component:sl,pageClass:"login-page",chromeless:!0},{path:"/invite/:code",component:(0,Kn.A)(()=>e.e(8576).then(e.bind(e,14383))),chromeless:!0},{path:"/verify",component:_.Ay.verifyEmailEnabled?(0,Kn.A)(()=>e.e(8786).then(e.bind(e,78786))):()=>a.createElement(Ws.rd,{to:"/signup"}),pageClass:"login-page",chromeless:!0},{path:"/signup",component:_.Ay.disableUserSignUp?()=>a.createElement(Ws.rd,{to:"/login"}):(0,Kn.A)(()=>e.e(7914).then(e.bind(e,27914))),pageClass:"login-page",chromeless:!0},{path:"/user/password/send-reset-email",chromeless:!0,component:(0,Kn.A)(()=>e.e(3818).then(e.bind(e,2713)))},{path:"/user/password/reset",component:(0,Kn.A)(()=>e.e(641).then(e.bind(e,37344))),pageClass:"login-page",chromeless:!0},{path:"/dashboard/snapshots",component:(0,Kn.A)(()=>e.e(6590).then(e.bind(e,72602)))},{path:"/playlists",component:(0,Kn.A)(()=>e.e(1168).then(e.bind(e,43719)))},{path:"/playlists/play/:uid",component:(0,Kn.A)(()=>e.e(1374).then(e.bind(e,93129)))},{path:"/playlists/new",component:(0,Kn.A)(()=>e.e(7616).then(e.bind(e,62579)))},{path:"/playlists/edit/:uid",component:(0,Kn.A)(()=>e.e(7620).then(e.bind(e,84535)))},{path:"/sandbox/benchmarks",component:(0,Kn.A)(()=>e.e(9354).then(e.bind(e,98351)))},{path:"/sandbox/test",component:(0,Kn.A)(()=>e.e(5354).then(e.bind(e,65802)))},{path:"/dashboards/f/:uid/:slug/library-panels",component:(0,Kn.A)(()=>Promise.all([e.e(6678),e.e(5804)]).then(e.bind(e,15111)))},{path:"/dashboards/f/:uid/:slug/alerting",roles:()=>Kt.TP.evaluatePermission([Ut.AccessControlAction.AlertingRuleRead]),component:(0,Kn.A)(()=>e.e(4333).then(e.bind(e,30027)))},{path:"/library-panels",component:(0,Kn.A)(()=>Promise.all([e.e(6678),e.e(8516)]).then(e.bind(e,45434)))},{path:"/notifications",component:(0,Kn.A)(()=>e.e(4140).then(e.bind(e,78015)))},{path:"/explore/metrics",chromeless:!1,exact:!1,component:(0,Kn.A)(()=>e.e(4785).then(e.bind(e,88353)))},...Fm(),...Nd(),...Um(),...Ll(),...Po,...Hm(),...Nm(),{path:"/*",component:Ft}].filter(zs.zz)}function Nd(F=_.Ay){return F.supportBundlesEnabled?[{path:"/support-bundles",component:(0,Kn.A)(()=>e.e(123).then(e.bind(e,21821)))},{path:"/support-bundles/create",component:(0,Kn.A)(()=>e.e(1515).then(e.bind(e,33809)))}]:[]}const wd=a.forwardRef((F,z)=>a.createElement("div",{id:"ngRoot",ref:z,dangerouslySetInnerHTML:{__html:"<grafana-app ng-cloak></grafana-app>"}}));wd.displayName="AngularRoot";var Si=e(95344),Gm=e(7376),Fd=e(81634),li=e(74856),Rc=e(71500),jm=e(6923);async function Lc(){if(j.$.angularSupportEnabled){const{AngularApp:F}=await Promise.all([e.e(7982),e.e(8054),e.e(1133),e.e(8888)]).then(e.bind(e,31133)),z=new F;z.init(),z.bootstrap()}else(0,Gm.w)({load:(F,z,X)=>({destroy:()=>{},digest:()=>{},getScope:()=>({})})}),(0,Fd.j)({get:F=>{switch(F){case"backendSrv":return(0,Si.l)("getLegacyAngularInjector","backendSrv","use getBackendSrv() in @grafana/runtime"),(0,T.AI)();case"contextSrv":return(0,Si.l)("getLegacyAngularInjector","contextSrv"),an.TP;case"dashboardSrv":return(0,Si.l)("getLegacyAngularInjector","getDashboardSrv"),(0,l.UA)();case"datasourceSrv":return(0,Si.l)("getLegacyAngularInjector","datasourceSrv","use getDataSourceSrv() in @grafana/runtime"),(0,U.l)();case"linkSrv":return(0,Si.l)("getLegacyAngularInjector","linkSrv"),(0,jm.mQ)();case"validationSrv":return(0,Si.l)("getLegacyAngularInjector","validationSrv"),Rc.P;case"timeSrv":return(0,Si.l)("getLegacyAngularInjector","timeSrv"),(0,li.jG)();case"templateSrv":return(0,Si.l)("getLegacyAngularInjector","templateSrv","use getTemplateSrv() in @grafana/runtime"),(0,Re.w)()}throw"Angular is disabled. Unable to expose: "+F}})}var xi=e(46942),Ym=e.n(xi),Oi=e(60619),ci=e(33390),Wd=e(80279),Kd=e(7887),Bc=e(82148),Qm=e(57514);const Uc=({})=>a.createElement(ue.a,{paddingY:8},a.createElement(Zt.B,{direction:"column",alignItems:"center"},a.createElement("img",{src:"public/img/grot-not-found.svg",width:"200px",alt:"grot"}),a.createElement(ol.E,{variant:"h5"},a.createElement(Ga.x6,{i18nKey:"command-palette.empty-state.title"},"No results found"))));Uc.displayName="EmptyState";var Wo=e(65178),Jm=e(35822);const Jl=0,Xm=F=>{const z=a.useRef(null),X=a.useRef(null),ce=a.useRef(F.items);ce.current=F.items;const Ce=(0,Jm.useVirtual)({size:ce.current.length,parentRef:X}),{query:Ae,search:Fe,currentRootActionId:Qe,activeIndex:qe,options:ut}=(0,rr.useKBar)(Nt=>({search:Nt.searchQuery,currentRootActionId:Nt.currentRootActionId,activeIndex:Nt.activeIndex}));a.useEffect(()=>{const Nt=At=>{At.key==="ArrowUp"||At.ctrlKey&&At.key==="p"?(At.preventDefault(),Ae.setActiveIndex(kt=>{let En=kt>Jl?kt-1:kt;if(typeof ce.current[En]=="string"){if(En===0)return kt;En-=1}return En})):At.key==="ArrowDown"||At.ctrlKey&&At.key==="n"?(At.preventDefault(),Ae.setActiveIndex(kt=>{let En=kt<ce.current.length-1?kt+1:kt;if(typeof ce.current[En]=="string"){if(En===ce.current.length-1)return kt;En+=1}return En})):At.key==="Enter"&&(At.preventDefault(),z.current?.click())};return window.addEventListener("keydown",Nt),()=>window.removeEventListener("keydown",Nt)},[Ae]);const{scrollToIndex:vt}=Ce;a.useEffect(()=>{vt(qe,{align:qe<=1?"end":"auto"})},[qe,vt]),a.useEffect(()=>{Ae.setActiveIndex(typeof F.items[Jl]=="string"?Jl+1:Jl)},[Fe,Qe,F.items,Ae]);const Ct=a.useCallback((Nt,At)=>{if(typeof At=="string")return;const kt=At.url;At.command?(At.command.perform(At),Ae.toggle()):kt?Nt.ctrlKey||Nt.metaKey||Nt.shiftKey||Ae.toggle():(Ae.setSearch(""),Ae.setCurrentRootAction(At.id)),ut.callbacks?.onSelectAction?.(At)},[Ae,ut]),Ht=(0,Wo.usePointerMovedSinceMount)();return a.createElement("div",{ref:X,style:{maxHeight:F.maxHeight||400,position:"relative",overflow:"auto"}},a.createElement("div",{role:"listbox",id:rr.KBAR_LISTBOX,style:{height:`${Ce.totalSize}px`,width:"100%"}},Ce.virtualItems.map(Nt=>{const At=ce.current[Nt.index],{target:kt,url:En}=At,Ma=typeof At!="string"&&{onPointerMove:()=>Ht&&qe!==Nt.index&&Ae.setActiveIndex(Nt.index),onPointerDown:()=>Ae.setActiveIndex(Nt.index),onClick:_r=>Ct(_r,At)},$a=Nt.index===qe,Na={id:(0,rr.getListboxItemId)(Nt.index),role:"option","aria-selected":$a,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${Nt.start}px)`},...Ma},Ba=a.cloneElement(F.onRender({item:At,active:$a}),{ref:Nt.measureRef});return En?a.createElement("a",{key:Nt.index,href:typeof En=="function"?En(Fe):En,target:kt,ref:$a?z:null,...Na},Ba):a.createElement("div",{key:Nt.index,ref:$a?z:null,...Na},Ba)})))},Ii=a.forwardRef(({action:F,active:z,currentRootActionId:X},ce)=>{const Ce=a.useMemo(()=>{if(!X)return F.ancestors;const qe=F.ancestors.findIndex(ut=>ut.id===X);return F.ancestors.slice(qe+1)},[F.ancestors,X]),Ae=(0,It.of)(Nc);let Fe=F.name;const Qe=qe=>!!(qe.command?.perform||qe.url);return F.children.length&&!Qe(F)&&!Fe.endsWith("...")&&(Fe+="..."),a.createElement("div",{ref:ce,className:(0,rt.cx)(Ae.row,z&&Ae.activeRow)},a.createElement("div",{className:Ae.actionContainer},F.icon,a.createElement("div",{className:Ae.textContainer},Ce.map(qe=>a.createElement(a.Fragment,{key:qe.id},!Qe(qe)&&a.createElement(a.Fragment,null,a.createElement("span",{className:Ae.breadcrumbAncestor},qe.name),a.createElement("span",{className:Ae.breadcrumbSeparator},"\u203A")))),a.createElement("span",null,Fe)),F.subtitle&&a.createElement("span",{className:Ae.subtitleText},F.subtitle)))});Ii.displayName="ResultItem";const Nc=F=>({row:(0,rt.css)({padding:F.spacing(1,2),display:"flex",alightItems:"center",justifyContent:"space-between",cursor:"pointer",position:"relative",borderRadius:F.shape.radius.default,margin:F.spacing(0,1)}),activeRow:(0,rt.css)({color:F.colors.text.maxContrast,background:F.colors.emphasize(F.colors.background.primary,.03),"&:before":{display:"block",content:'" "',position:"absolute",left:0,top:0,bottom:0,width:F.spacing(.5),borderRadius:F.shape.radius.default,backgroundImage:F.colors.gradients.brandVertical}}),actionContainer:(0,rt.css)({display:"flex",gap:F.spacing(1),alignItems:"baseline",fontSize:F.typography.fontSize,width:"100%"}),textContainer:(0,rt.css)({display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),breadcrumbAncestor:(0,rt.css)({color:F.colors.text.secondary}),breadcrumbSeparator:(0,rt.css)({color:F.colors.text.secondary,marginLeft:F.spacing(1),marginRight:F.spacing(1)}),subtitleText:(0,rt.css)({...F.typography.bodySmall,color:F.colors.text.secondary,display:"block",flexBasis:"20%",flexGrow:1,flexShrink:0,maxWidth:"fit-content",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})});var Zm=e(76459),qm=e.n(Zm),ef=e(62301),$d=e(24439);const tf=6,wc=5,Vd=4,Fc=3,nf=2,af=1,sf=100,_d=5,rf=qm()(lf,200);async function of(){if(!Kt.TP.user.isSignedIn)return[];const F=(await ef.A.getDashboardOpened()).slice(0,_d),X=(await(0,$d.getGrafanaSearcher)().search({kind:["dashboard"],limit:_d,uid:F})).view.toArray();return X.sort((Ce,Ae)=>{const Fe=F.indexOf(Ce.uid),Qe=F.indexOf(Ae.uid);return Fe-Qe}),X.map(Ce=>{const{url:Ae,name:Fe}=Ce;return{id:`recent-dashboards${Ae}`,name:`${Fe}`,section:(0,Ga.t)("command-palette.section.recent-dashboards","Recent dashboards"),priority:tf,url:Ae}})}async function lf(F){if(F.length===0||!Kt.TP.user.isSignedIn&&!j.$.bootData.settings.anonymousEnabled)return[];const z=await(0,$d.getGrafanaSearcher)().search({kind:["dashboard","folder"],query:F,limit:sf});return z.view.map(ce=>{const{url:Ce,name:Ae,kind:Fe,location:Qe}=ce;return{id:`go/${Fe}${Ce}`,name:`${Ae}`,section:Fe==="dashboard"?(0,Ga.t)("command-palette.section.dashboard-search-results","Dashboards"):(0,Ga.t)("command-palette.section.folder-search-results","Folders"),priority:af,url:Ce,subtitle:z.view.dataFrame.meta?.custom?.locationInfo[Qe]?.name}})}function zd(F,z){const[X,ce]=(0,a.useState)([]),[Ce,Ae]=(0,a.useState)(!1),Fe=(0,a.useRef)(0);return(0,a.useEffect)(()=>{const Qe=Date.now();z&&F.length>0?(Ae(!0),rf(F).then(qe=>{Qe>Fe.current&&(ce(qe),Ae(!1),Fe.current=Qe)})):(ce([]),Ae(!1),Fe.current=Qe)},[z,F]),{searchResults:X,isFetchingSearchResults:Ce}}var Yr=e(28444),Dr=e(28138),kd=e(38645),Hd=e(93522);const Gd=F=>{let z=F.children||[];if(F.id==="help"){const X=()=>{Dr.A.publish(new Yr.S8({component:Hd.N}))};F.children=[...z,...(0,kd.Dd)(),...cf(),{id:"keyboard-shortcuts",text:(0,Ga.t)("nav.help/keyboard-shortcuts","Keyboard shortcuts"),icon:"keyboard",onClick:X}]}return F},Wc=(F,z)=>{const X={...F},ce=X.onClick;return X.onClick=()=>{(0,yr.rR)("grafana_navigation_item_clicked",{path:X.url??X.id,menuIsDocked:z}),ce?.()},X.children&&(X.children=X.children.map(Ce=>Wc(Ce,z))),X},gh=(F,z)=>!!(F===z||Kc(F,z)),Kc=(F,z)=>!!F.children?.some(X=>X===z?!0:Kc(X,z)),Xl=F=>F?.split("?")[0]??"",jd=(F,z)=>{const X=Xl(z?.url),ce=Xl(F.url);return ce&&ce.length>X?.length},Yd=(F,z,X)=>{const ce="/dashboards";for(const Ce of F){const Ae=Xl(Ce.url),Fe=M.I.stripBaseFromUrl(Ae);if(Fe&&Ce.id!=="starred")if(Fe===z){X=Ce;break}else if(Fe!=="/"&&z.startsWith(Fe))jd(Ce,X)&&(X=Ce);else if(Fe==="/alerting/list"&&z.startsWith("/alerting/notification/")){X=Ce;break}else Fe===ce&&z.startsWith("/d/")&&jd(Ce,X)&&(X=Ce);if(Ce.children&&(X=Yd(Ce.children,z,X)),Xl(X?.url)===z)return X}return X};function cf(){const{buildInfo:F,licenseInfo:z}=j.$,X=z.stateInfo?` (${z.stateInfo})`:"",ce=[];return ce.push({target:"_blank",id:"version",text:`${F.edition}${X}`,url:z.licenseUrl,icon:"external-link-alt"}),F.hasUpdate&&ce.push({target:"_blank",id:"updateVersion",text:"New version available!",icon:"download-alt",url:"https://grafana.com/grafana/download?utm_source=grafana_footer"}),ce}var fl=e(2769),Bl=e(74135);function $c(){const F={},{extensions:z}=(0,R.Kf)({extensionPointId:Bl.S.CommandPalette,context:F,limitPerPlugin:3});return z.map(X=>({section:X.category??"Extensions",priority:nf,id:X.id,name:X.title,target:X.path,perform:()=>X.onClick&&X.onClick()}))}function Qd(F){return"navModel."+F.id}function Jd(F,z=[]){const X=[];for(let ce of F){ce.id==="help"&&(ce=Gd({...ce}),delete ce.url);const{url:Ce,target:Ae,text:Fe,isCreateAction:Qe,children:qe,onClick:ut,keywords:vt}=ce,Ct=!!qe?.length;if(!(Ce||ut||Ct))continue;let Ht=Ce;Ce&&(ce.id==="connections-add-new-connection"||ce.id==="standalone-plugin-page-/connections/add-new-connection")&&(Ht=Ma=>{const $a=vt?.find(Na=>Na.toLowerCase().includes(Ma.toLowerCase()));return $a?`${Ce}?search=${$a}`:Ce});const Nt=Qe?(0,Ga.t)("command-palette.section.actions","Actions"):(0,Ga.t)("command-palette.section.pages","Pages"),At=Qe?wc:Vd,kt=z.map(Ma=>Ma.text).join(" > "),En={id:Qd(ce),name:Fe,section:Nt,url:Ht,target:Ae,parent:z.length>0&&!Qe?Qd(z[z.length-1]):void 0,perform:ut,keywords:vt?.join(" "),priority:At,subtitle:Qe?void 0:kt};if(X.push(En),qe?.length){const Ma=Jd(qe,[...z,ce]);X.push(...Ma)}}return X}const df=F=>{const z=[{id:"preferences/theme",name:(0,Ga.t)("command-palette.action.change-theme","Change theme..."),keywords:"interface color dark light",section:(0,Ga.t)("command-palette.section.preferences","Preferences"),priority:Fc},{id:"preferences/dark-theme",name:(0,Ga.t)("command-palette.action.dark-theme","Dark"),keywords:"dark theme",perform:()=>(0,fl.K)("dark"),parent:"preferences/theme",priority:Fc},{id:"preferences/light-theme",name:(0,Ga.t)("command-palette.action.light-theme","Light"),keywords:"light theme",perform:()=>(0,fl.K)("light"),parent:"preferences/theme",priority:Fc}],X=$c(),ce=Jd(F);return[...z,...X,...ce]};function di(F){const[z,X]=(0,a.useState)([]),[ce,Ce]=(0,a.useState)([]),Ae=(0,Ut.useSelector)(Fe=>Fe.navBarTree);return(0,a.useEffect)(()=>{const Fe=df(Ae);X(Fe)},[Ae]),(0,a.useEffect)(()=>{F||of().then(Fe=>Ce(Fe)).catch(Fe=>{console.error("Error loading recent dashboard actions",Fe)})},[F]),F?z:[...ce,...z]}var Io=e(53076);const ui={name:"none",priority:rr.Priority.NORMAL};function Xd(F,z){return z.priority-F.priority}function ph(){const{search:F,actions:z,rootActionId:X}=(0,rr.useKBar)(vt=>({search:vt.searchQuery,actions:vt.actions,rootActionId:vt.currentRootActionId})),ce=a.useMemo(()=>Object.keys(z).reduce((vt,Ct)=>{const Ht=z[Ct];if(!Ht.parent&&!X&&vt.push(Ht),Ht.id===X)for(let Nt=0;Nt<Ht.children.length;Nt++)vt.push(Ht.children[Nt]);return vt},[]).sort(Xd),[z,X]),Ce=a.useCallback(vt=>{let Ct=[];for(let Ht=0;Ht<vt.length;Ht++)Ct.push(vt[Ht]);return function Ht(Nt,At=Ct){for(let kt=0;kt<Nt.length;kt++)if(Nt[kt].children.length>0){let En=Nt[kt].children;for(let Ma=0;Ma<En.length;Ma++)At.push(En[Ma]);Ht(Nt[kt].children,At)}return At}(vt)},[]),Ae=!F,Fe=a.useMemo(()=>Ae?ce:Ce(ce),[Ce,ce,Ae]),Qe=Zd(Fe,F),qe=a.useMemo(()=>{let vt={},Ct=[],Ht=[];for(let At=0;At<Qe.length;At++){const kt=Qe[At],En=kt.action,Ma=kt.score||rr.Priority.NORMAL,$a={name:typeof En.section=="string"?En.section:En.section?.name||ui.name,priority:typeof En.section=="string"?Ma:En.section?.priority||0+Ma};vt[$a.name]||(vt[$a.name]=[],Ct.push($a)),vt[$a.name].push({priority:En.priority+Ma,action:En})}Ht=Ct.sort(Xd).map(At=>({name:At.name,actions:vt[At.name].sort(Xd).map(kt=>kt.action)}));let Nt=[];for(let At=0;At<Ht.length;At++){let kt=Ht[At];kt.name!==ui.name&&Nt.push(kt.name);for(let En=0;En<kt.actions.length;En++)Nt.push(kt.actions[En])}return Nt},[Qe]),ut=a.useMemo(()=>X,[qe]);return a.useMemo(()=>({results:qe,rootActionId:ut}),[ut,qe])}function Zd(F,z){const X=uf(),ce=a.useMemo(()=>({filtered:F,search:z}),[F,z]),{filtered:Ce,search:Ae}=(0,Wo.useThrottledValue)(ce);return a.useMemo(()=>{if(Ae.trim()==="")return Ce.map(qe=>({score:0,action:qe}));const Fe=Ce.map(({name:qe,keywords:ut})=>`${qe} ${ut??""}`.toLowerCase()),Qe=[];if(Ae.length>qd){const qe=Ae.toLowerCase();for(let ut=0;ut<Fe.length;ut++){const Ct=Fe[ut].indexOf(qe);if(Ct>-1){const Ht=Ct*-1,Nt=Ce[ut];Qe.push({score:Ht,action:Nt})}}}else{const qe=X.split(Ae).length,ut=1/0,vt=qe<5?4:0,[,Ct,Ht]=X.search(Fe,Ae,vt,ut);if(Ct&&Ht)for(let Nt=0;Nt<Ht.length;Nt++){const At=Ht[Nt],kt=Ht.length-Nt,En=Ce[Ct.idx[At]];Qe.push({score:kt,action:En})}}return Qe},[Ce,Ae,X])}const qd=25;function uf(){const F=a.useRef();return F.current||(F.current=new Io.A({intraMode:0,intraIns:0})),F.current}function eu(){const F=(0,It.of)(tu),{query:z,showing:X,searchQuery:ce}=(0,rr.useKBar)(vt=>({showing:vt.visualState===rr.VisualState.showing,searchQuery:vt.searchQuery})),Ce=di(ce);(0,rr.useRegisterActions)(Ce,[Ce]);const{searchResults:Ae,isFetchingSearchResults:Fe}=zd(ce,X),Qe=(0,a.useRef)(null),{overlayProps:qe}=(0,Bc.e)({isOpen:X,onClose:()=>z.setVisualState(rr.VisualState.animatingOut)},Qe),{dialogProps:ut}=(0,Wd.s)({},Qe);return(0,a.useEffect)(()=>{X&&(0,yr.rR)("command_palette_opened")},[X]),Ce.length>0?a.createElement(rr.KBarPortal,null,a.createElement(rr.KBarPositioner,{className:F.positioner},a.createElement(rr.KBarAnimator,{className:F.animator},a.createElement(Kd.n1,{contain:!0,autoFocus:!0,restoreFocus:!0},a.createElement("div",{...qe,...ut},a.createElement("div",{className:F.searchContainer},a.createElement(hs.I,{name:"search",size:"md"}),a.createElement(rr.KBarSearch,{defaultPlaceholder:(0,Ga.t)("command-palette.search-box.placeholder","Search or jump to..."),className:F.search}),a.createElement("div",{className:F.loadingBarContainer},Fe&&a.createElement(Qm.G,{width:500,delay:0}))),a.createElement("div",{className:F.resultsContainer},a.createElement(mf,{isFetchingSearchResults:Fe,searchResults:Ae}))))))):null}const mf=({isFetchingSearchResults:F,searchResults:z})=>{const{results:X,rootActionId:ce}=ph(),Ce=(0,It.of)(tu),Ae=(0,Ga.t)("command-palette.section.dashboard-search-results","Dashboards"),Fe=(0,Ga.t)("command-palette.section.folder-search-results","Folders"),Qe=(0,a.useMemo)(()=>z.filter(Ct=>Ct.id.startsWith("go/dashboard")).map(Ct=>new rr.ActionImpl(Ct,{store:{}})),[z]),qe=(0,a.useMemo)(()=>z.filter(Ct=>Ct.id.startsWith("go/folder")).map(Ct=>new rr.ActionImpl(Ct,{store:{}})),[z]),ut=(0,a.useMemo)(()=>{const Ct=[...X];return qe.length>0&&(Ct.push(Fe),Ct.push(...qe)),Qe.length>0&&(Ct.push(Ae),Ct.push(...Qe)),Ct},[X,Ae,Qe,Fe,qe]);return!F&&ut.length===0?a.createElement(Uc,null):a.createElement(Xm,{items:ut,maxHeight:650,onRender:({item:Ct,active:Ht})=>{const Nt=ut[0]===Ct;return typeof Ct=="string"?a.createElement("div",{className:(0,rt.cx)(Ce.sectionHeader,Nt&&Ce.sectionHeaderFirst)},Ct):a.createElement(Ii,{action:Ct,active:Ht,currentRootActionId:ce})}})},tu=F=>({positioner:(0,rt.css)({zIndex:F.zIndex.portal,marginTop:"0px",paddingTop:"4px !important","&::before":{content:'""',position:"fixed",top:0,right:0,bottom:0,left:0,background:F.components.overlay.background,backdropFilter:"blur(1px)"}}),animator:(0,rt.css)({maxWidth:F.breakpoints.values.md,width:"100%",background:F.colors.background.primary,color:F.colors.text.primary,borderRadius:F.shape.radius.default,border:`1px solid ${F.colors.border.weak}`,overflow:"hidden",boxShadow:F.shadows.z3}),loadingBarContainer:(0,rt.css)({position:"absolute",left:0,right:0,bottom:0}),searchContainer:(0,rt.css)({alignItems:"center",background:F.components.input.background,borderBottom:`1px solid ${F.colors.border.weak}`,display:"flex",gap:F.spacing(1),padding:F.spacing(1,2),position:"relative"}),search:(0,rt.css)({fontSize:F.typography.fontSize,width:"100%",boxSizing:"border-box",outline:"none",border:"none",color:F.components.input.text}),spinner:(0,rt.css)({height:"22px"}),resultsContainer:(0,rt.css)({paddingBottom:F.spacing(1)}),sectionHeader:(0,rt.css)({padding:F.spacing(1.5,2,2,2),fontSize:F.typography.bodySmall.fontSize,fontWeight:F.typography.fontWeightMedium,color:F.colors.text.secondary,borderTop:`1px solid ${F.colors.border.weak}`,marginTop:F.spacing(1)}),sectionHeaderFirst:(0,rt.css)({paddingBottom:F.spacing(1),borderTop:"none",marginTop:0})});var nu=e(86634),ff=e(40276),gf=e(78685),pf=e(8887),hf=e(18759);const au=({children:F})=>{const z=(0,It.of)(su);return a.createElement(a.Fragment,null,F,a.createElement("span",{className:z.highlight}))},su=F=>({highlight:(0,rt.css)({backgroundColor:F.colors.success.main,borderRadius:F.shape.radius.circle,width:"6px",height:"6px",display:"inline-block;",position:"absolute",top:"50%",transform:"translateY(-50%)"})});var Vc=e(50720);function ru({children:F,isActive:z,onClick:X,target:ce,url:Ce}){const Ae=(0,It.$j)(),Fe=vf(Ae,z),Qe=!ce&&Ce.startsWith("/")?Vc.N:"a",qe=a.createElement("div",{className:Fe.linkContent},F,ce==="_blank"&&a.createElement(hs.I,{"data-testid":"external-link-icon",name:"external-link-alt"}));return a.createElement(Qe,{"data-testid":Tr.Tp.components.NavMenu.item,className:(0,rt.cx)(Fe.container,{[Fe.containerActive]:z}),href:Ce,target:ce,onClick:X},qe)}ru.displayName="MegaMenuItemText";const vf=(F,z)=>({container:(0,rt.css)({alignItems:"center",color:z?F.colors.text.primary:F.colors.text.secondary,height:"100%",position:"relative",width:"100%","&:hover, &:focus-visible":{color:F.colors.text.primary,textDecoration:"underline"},"&:focus-visible":{boxShadow:"none",outline:`2px solid ${F.colors.primary.main}`,outlineOffset:"-2px",transition:"none"}}),containerActive:(0,rt.css)({backgroundColor:F.colors.background.secondary,borderTopRightRadius:F.shape.radius.default,borderBottomRightRadius:F.shape.radius.default,position:"relative","&::before":{backgroundImage:F.colors.gradients.brandVertical,borderRadius:F.shape.radius.default,content:'" "',display:"block",height:"100%",position:"absolute",transform:"translateX(-50%)",width:F.spacing(.5)}}),linkContent:(0,rt.css)({alignItems:"center",display:"flex",gap:"0.5rem",height:"100%",width:"100%"})}),Zl=2;function ou({link:F,activeItem:z,level:X=0,onClick:ce}){const{chrome:Ce}=(0,Fo.Il)(),Fe=Ce.useState().megaMenuDocked,Qe=(0,Ws.zy)(),qe=F.highlightText?au:a.Fragment,ut=Kc(F,z),vt=F===z||X===Zl&&ut,[Ct,Ht]=(0,gf.A)(`grafana.navigation.expanded[${F.text}]`,!!ut),Nt=X<Zl&&!!(iu(F)||F.emptyMessage),At=(0,a.useRef)(null),kt=(0,It.of)(Ef);return(0,a.useEffect)(()=>{ut&&Ht(!0)},[ut,Qe,Fe,Ht]),(0,a.useEffect)(()=>{Fe&&vt&&At.current&&yf(At.current)&&At.current.scrollIntoView({block:"center"})},[vt,Fe]),F.url?a.createElement("li",{ref:At,className:kt.listItem},a.createElement("div",{className:(0,rt.cx)(kt.menuItem,{[kt.menuItemWithIcon]:!!(X===0&&F.icon)})},X!==0&&a.createElement(hf.T,{level:X===Zl?X-1:X,spacing:3}),X===Zl&&a.createElement("div",{className:kt.itemConnector}),a.createElement("div",{className:kt.collapseButtonWrapper},Nt&&a.createElement(wr.K,{"aria-label":`${Ct?"Collapse":"Expand"} section ${F.text}`,className:kt.collapseButton,onClick:()=>Ht(!Ct),name:Ct?"angle-down":"angle-right",size:"md",variant:"secondary"})),a.createElement("div",{className:kt.collapsibleSectionWrapper},a.createElement(ru,{isActive:vt,onClick:()=>{F.onClick?.(),ce?.()},target:F.target,url:F.url},a.createElement("div",{className:(0,rt.cx)(kt.labelWrapper,{[kt.hasActiveChild]:ut,[kt.labelWrapperWithIcon]:!!(X===0&&F.icon)})},X===0&&F.icon&&a.createElement(qe,null,a.createElement(hs.I,{className:kt.icon,name:(0,pf.Uo)(F.icon)??"link",size:"lg"})),a.createElement(ol.E,{truncate:!0},F.text))))),Nt&&Ct&&a.createElement("ul",{className:kt.children},iu(F)?F.children.filter(En=>!En.isCreateAction).map(En=>a.createElement(ou,{key:`${F.text}-${En.text}`,link:En,activeItem:z,onClick:ce,level:X+1})):a.createElement("div",{className:kt.emptyMessage,"aria-live":"polite"},F.emptyMessage))):null}const Ef=F=>({icon:(0,rt.css)({width:F.spacing(3)}),listItem:(0,rt.css)({flex:1,maxWidth:"100%"}),menuItem:(0,rt.css)({display:"flex",alignItems:"center",gap:F.spacing(1),height:F.spacing(4),paddingLeft:F.spacing(.5),position:"relative"}),menuItemWithIcon:(0,rt.css)({paddingLeft:F.spacing(0)}),collapseButtonWrapper:(0,rt.css)({display:"flex",justifyContent:"center",width:F.spacing(3),flexShrink:0}),itemConnector:(0,rt.css)({position:"relative",height:"100%",width:F.spacing(1.5),"&::before":{borderLeft:`1px solid ${F.colors.border.medium}`,content:'""',height:"100%",right:0,position:"absolute",transform:"translateX(50%)"}}),collapseButton:(0,rt.css)({margin:0}),collapsibleSectionWrapper:(0,rt.css)({alignItems:"center",display:"flex",flex:1,height:"100%",minWidth:0}),labelWrapper:(0,rt.css)({display:"flex",alignItems:"center",gap:F.spacing(2),minWidth:0,paddingLeft:F.spacing(1)}),labelWrapperWithIcon:(0,rt.css)({paddingLeft:F.spacing(.5)}),hasActiveChild:(0,rt.css)({color:F.colors.text.primary}),children:(0,rt.css)({display:"flex",listStyleType:"none",flexDirection:"column"}),emptyMessage:(0,rt.css)({color:F.colors.text.secondary,fontStyle:"italic",padding:F.spacing(1,1.5,1,7)})});function iu(F){return!!(F.children&&F.children.length>0)}function yf(F){const z=F.getBoundingClientRect();return z.bottom<0||z.top>=window.innerHeight}const lu="300px",_c=a.memo((0,a.forwardRef)(({onClose:F,...z},X)=>{const ce=(0,Ut.useSelector)(Ct=>Ct.navBarTree),Ce=(0,It.of)(cu),Ae=(0,Ws.zy)(),{chrome:Fe}=(0,Fo.Il)(),Qe=Fe.useState(),qe=ce.filter(Ct=>Ct.id!=="profile"&&Ct.id!=="help").map(Ct=>Wc(Ct,Qe.megaMenuDocked)),ut=Yd(qe,Ae.pathname),vt=()=>{Fe.setMegaMenuDocked(!Qe.megaMenuDocked),Qe.megaMenuDocked&&Fe.setMegaMenuOpen(!1),setTimeout(()=>{document.getElementById(Qe.megaMenuDocked?"mega-menu-toggle":"dock-menu-button")?.focus()})};return a.createElement("div",{"data-testid":Tr.Tp.components.NavMenu.Menu,ref:X,...z},a.createElement("div",{className:Ce.mobileHeader},a.createElement(hs.I,{name:"bars",size:"xl"}),a.createElement(wr.K,{tooltip:(0,Ga.t)("navigation.megamenu.close","Close menu"),name:"times",onClick:F,size:"xl",variant:"secondary"})),a.createElement("nav",{className:Ce.content},a.createElement(ff.E,{showScrollIndicators:!0,hideHorizontalTrack:!0},a.createElement("ul",{className:Ce.itemList,"aria-label":(0,Ga.t)("navigation.megamenu.list-label","Navigation")},qe.map((Ct,Ht)=>a.createElement(Zt.B,{key:Ct.text,direction:Ht===0?"row-reverse":"row",alignItems:"center"},Ht===0&&a.createElement(wr.K,{id:"dock-menu-button",className:Ce.dockMenuButton,tooltip:Qe.megaMenuDocked?(0,Ga.t)("navigation.megamenu.undock","Undock menu"):(0,Ga.t)("navigation.megamenu.dock","Dock menu"),name:"web-section-alt",onClick:vt,variant:"secondary"}),a.createElement(ou,{link:Ct,onClick:Qe.megaMenuDocked?void 0:F,activeItem:ut})))))))}));_c.displayName="MegaMenu";const cu=F=>({content:(0,rt.css)({display:"flex",flexDirection:"column",height:"100%",minHeight:0,position:"relative"}),mobileHeader:(0,rt.css)({display:"flex",justifyContent:"space-between",padding:F.spacing(1,1,1,2),borderBottom:`1px solid ${F.colors.border.weak}`,[F.breakpoints.up("md")]:{display:"none"}}),itemList:(0,rt.css)({boxSizing:"border-box",display:"flex",flexDirection:"column",listStyleType:"none",padding:F.spacing(1,1,2,1),[F.breakpoints.up("md")]:{width:lu}}),dockMenuButton:(0,rt.css)({display:"none",[F.breakpoints.up("xl")]:{display:"inline-flex"}})});var Ul=e(13390),Ai=e(27746),ql=e(28215);function du({href:F,isCurrent:z,text:X,index:ce,flexGrow:Ce}){const Ae=(0,It.of)(uu),Fe=()=>{(0,yr.rR)("grafana_breadcrumb_clicked",{url:F})};return a.createElement("li",{className:Ae.breadcrumbWrapper,style:{flexGrow:Ce}},z?a.createElement("span",{"data-testid":Ul.X.Breadcrumbs.breadcrumb(X),className:Ae.breadcrumb,"aria-current":"page",title:X},X):a.createElement(a.Fragment,null,a.createElement("a",{onClick:Fe,"data-testid":Ul.X.Breadcrumbs.breadcrumb(X),className:(0,rt.cx)(Ae.breadcrumb,Ae.breadcrumbLink),title:X,href:F},X),a.createElement("div",{className:Ae.separator,"aria-hidden":!0},a.createElement(hs.I,{name:"angle-right"}))))}const uu=F=>({breadcrumb:(0,rt.css)({display:"block",textOverflow:"ellipsis",overflow:"hidden",padding:F.spacing(0,.5),whiteSpace:"nowrap",color:F.colors.text.secondary}),breadcrumbLink:(0,rt.css)({color:F.colors.text.primary,"&:hover":{textDecoration:"underline"}}),breadcrumbWrapper:(0,rt.css)({alignItems:"center",color:F.colors.text.primary,display:"flex",flex:1,minWidth:0,maxWidth:"max-content",[F.breakpoints.down("sm")]:{display:"none","&:nth-last-child(2)":{display:"flex",minWidth:"40px"},"&:last-child":{display:"flex"}}}),separator:(0,rt.css)({color:F.colors.text.secondary})});function mu({breadcrumbs:F,className:z}){const X=(0,It.of)(Pf);return a.createElement("nav",{"aria-label":"Breadcrumbs",className:z},a.createElement("ol",{className:X.breadcrumbs},F.map((ce,Ce)=>a.createElement(du,{...ce,isCurrent:Ce===F.length-1,key:Ce,index:Ce,flexGrow:Df(Ce,F.length)}))))}function Df(F,z){return z<5&&F>0&&F<z-2||z>6&&F>1&&F<z-3?4:10}const Pf=F=>({breadcrumbs:(0,rt.css)({display:"flex",alignItems:"center",flexWrap:"nowrap",overflow:"hidden"})});var fu=e(3984),Ko=e(57571),gu=e(10804);const zc="mega-menu-toggle";function Cf({actions:F,searchBarHidden:z,sectionNav:X,pageNav:ce,onToggleMegaMenu:Ce,onToggleSearchBar:Ae,onToggleKioskMode:Fe}){const{chrome:Qe}=(0,Fo.Il)(),qe=Qe.useState(),ut=(0,Ut.useSelector)(Ht=>Ht.navIndex)[ql.Id],vt=(0,It.of)(ec),Ct=(0,fu.Z)(X,ce,ut);return a.createElement("div",{"data-testid":Ul.X.NavToolbar.container,className:vt.pageToolbar},a.createElement("div",{className:vt.menuButton},a.createElement(wr.K,{id:zc,name:"bars",tooltip:qe.megaMenuOpen?(0,Ga.t)("navigation.toolbar.close-menu","Close menu"):(0,Ga.t)("navigation.toolbar.open-menu","Open menu"),tooltipPlacement:"bottom",size:"xl",onClick:Ce,"data-testid":Ul.X.NavBar.Toggle.button})),a.createElement(mu,{breadcrumbs:Ct,className:vt.breadcrumbsWrapper}),a.createElement("div",{className:vt.actions},F,z&&a.createElement(Ai.I,{onClick:Fe,narrow:!0,title:(0,Ga.t)("navigation.toolbar.enable-kiosk","Enable kiosk mode"),icon:"monitor"}),F&&a.createElement(gu.K,null),a.createElement(Ai.I,{onClick:Ae,narrow:!0,title:(0,Ga.t)("navigation.toolbar.toggle-search-bar","Toggle top search bar")},a.createElement(hs.I,{name:z?"angle-down":"angle-up",size:"xl"}))))}const ec=F=>({breadcrumbsWrapper:(0,rt.css)({display:"flex",overflow:"hidden",[F.breakpoints.down("sm")]:{minWidth:"50%"}}),pageToolbar:(0,rt.css)({height:Ko.l,display:"flex",padding:F.spacing(0,1,0,2),alignItems:"center",borderBottom:`1px solid ${F.colors.border.weak}`}),menuButton:(0,rt.css)({display:"flex",alignItems:"center",marginRight:F.spacing(1)}),actions:(0,rt.css)({label:"NavToolbar-actions",display:"flex",alignItems:"center",flexWrap:"nowrap",justifyContent:"flex-end",paddingLeft:F.spacing(1),flexGrow:1,gap:F.spacing(1),minWidth:0,".body-drawer-open &":{display:"none"}})});function pu({}){const F=(0,It.$j)(),{chrome:z}=(0,Fo.Il)(),X=z.useState(),ce=X.searchBarHidden||X.kioskMode===Ut.KioskMode.TV,Ce=(0,a.useRef)(null),Ae=(0,a.useRef)(null),Fe=F.transitions.duration.shortest,Qe=(0,It.of)(Tf,Fe),qe=X.megaMenuOpen&&!X.megaMenuDocked,ut=()=>z.setMegaMenuOpen(!1),{overlayProps:vt,underlayProps:Ct}=(0,Bc.e)({isDismissable:!0,isOpen:!0,onClose:ut,shouldCloseOnInteractOutside:At=>!document.getElementById(zc)?.contains(At)},Ce),{dialogProps:Ht}=(0,Wd.s)({},Ce),Nt=(0,It.of)(bf,ce);return a.createElement("div",{className:Nt.wrapper},a.createElement(Bc.Sf,null,a.createElement(nu.A,{nodeRef:Ce,in:qe,unmountOnExit:!0,classNames:Qe.overlay,timeout:{enter:Fe,exit:0}},a.createElement(Kd.n1,{contain:!0,autoFocus:!0,restoreFocus:!0},a.createElement(_c,{className:Nt.menu,onClose:ut,ref:Ce,...vt,...Ht}))),a.createElement(nu.A,{nodeRef:Ae,in:qe,unmountOnExit:!0,classNames:Qe.backdrop,timeout:{enter:Fe,exit:0}},a.createElement("div",{ref:Ae,className:Nt.backdrop,...Ct}))))}const bf=(F,z)=>{const X=z?Ko.l:Ko.l*2;return{backdrop:(0,rt.css)({backdropFilter:"blur(1px)",backgroundColor:F.components.overlay.background,bottom:0,left:0,position:"fixed",right:0,top:z?0:Ko.l,zIndex:F.zIndex.modalBackdrop,[F.breakpoints.up("md")]:{top:X}}),menu:(0,rt.css)({display:"flex",bottom:0,flexDirection:"column",left:0,right:0,zIndex:F.zIndex.modal,position:"fixed",top:z?0:Ko.l,backgroundColor:F.colors.background.primary,boxSizing:"content-box",flex:"1 1 0",[F.breakpoints.up("md")]:{right:"unset",borderRight:`1px solid ${F.colors.border.weak}`,top:X}}),wrapper:(0,rt.css)({position:"fixed",display:"grid",gridAutoFlow:"column",height:"100%",zIndex:F.zIndex.sidemenu})}},Tf=(F,z)=>{const X={transitionDuration:`${z}ms`,transitionTimingFunction:F.transitions.easing.easeInOut,[F.breakpoints.down("md")]:{overflow:"hidden"}},ce={...X,transitionProperty:"box-shadow, width",".scrollbar-view":{overflow:"hidden !important"}},Ce={...X,transitionProperty:"opacity"},Ae={width:"100%",[F.breakpoints.up("md")]:{boxShadow:F.shadows.z3,width:lu}},Fe={boxShadow:"none",width:0},Qe={opacity:1},qe={opacity:0};return{backdrop:{enter:(0,rt.css)(qe),enterActive:(0,rt.css)(Ce,Qe),enterDone:(0,rt.css)(Qe)},overlay:{enter:(0,rt.css)(Fe),enterActive:(0,rt.css)(ce,Ae),enterDone:(0,rt.css)(Ae)}}};var hu=e(24120),vu=e(49426);function Mf(F,z){if(F===z)return!0;if(!(F instanceof Object)||!(z instanceof Object))return!1;const X=Object.keys(F),ce=X.length;for(let Ce=0;Ce<ce;Ce++)if(!(X[Ce]in z))return!1;for(let Ce=0;Ce<ce;Ce++)if(F[X[Ce]]!==z[X[Ce]])return!1;return ce===Object.keys(z).length}const Eu="grafana.navigation.docked",tc="grafana.navigation.open";class Sf{constructor(){this.searchBarStorageKey="SearchBar_Hidden",this.routeChangeHandled=!0,this.megaMenuDocked=!!(window.innerWidth>=j.$.theme2.breakpoints.values.xl&&ci.A.getBool(Eu,window.innerWidth>=j.$.theme2.breakpoints.values.xxl)),this.sessionStorageData=window.sessionStorage.getItem("returnToPrevious"),this.returnToPreviousData=this.sessionStorageData?JSON.parse(this.sessionStorageData):void 0,this.state=new vu.t({chromeless:!0,sectionNav:{node:{text:(0,Ga.t)("nav.home.title","Home")},main:{text:""}},searchBarHidden:ci.A.getBool(this.searchBarStorageKey,!1),megaMenuOpen:this.megaMenuDocked&&ci.A.getBool(tc,!0),megaMenuDocked:this.megaMenuDocked,kioskMode:null,layout:lt.k.Canvas,returnToPrevious:this.returnToPreviousData}),this.setReturnToPrevious=z=>{const X=this.state.getValue().returnToPrevious;(0,yr.rR)("grafana_return_to_previous_button_created",{page:z.href,previousPage:X?.href}),this.update({returnToPrevious:z}),window.sessionStorage.setItem("returnToPrevious",JSON.stringify(z))},this.clearReturnToPrevious=z=>{const X=this.state.getValue().returnToPrevious;X&&(0,yr.rR)("grafana_return_to_previous_button_dismissed",{action:z,page:X.href}),this.update({returnToPrevious:void 0}),window.sessionStorage.removeItem("returnToPrevious")},this.setMegaMenuOpen=z=>{const{megaMenuDocked:X}=this.state.getValue();X&&ci.A.set(tc,z),(0,yr.rR)("grafana_mega_menu_open",{state:z}),this.update({megaMenuOpen:z})},this.setMegaMenuDocked=(z,X=!0)=>{X&&ci.A.set(Eu,z),(0,yr.rR)("grafana_mega_menu_docked",{state:z}),this.update({megaMenuDocked:z})},this.onToggleSearchBar=()=>{const{searchBarHidden:z,kioskMode:X}=this.state.getValue(),ce=!z;ci.A.set(this.searchBarStorageKey,ce),X&&x.Ny.partial({kiosk:null}),this.update({searchBarHidden:ce,kioskMode:null})},this.onToggleKioskMode=()=>{const z=this.getNextKioskMode();this.update({kioskMode:z}),x.Ny.partial({kiosk:this.getKioskUrlValue(z)})}}setMatchedRoute(z){this.currentRoute!==z&&(this.currentRoute=z,this.routeChangeHandled=!1)}update(z){const X=this.state.getValue(),ce={...X};this.routeChangeHandled||(ce.actions=void 0,ce.pageNav=void 0,ce.sectionNav={node:{text:(0,Ga.t)("nav.home.title","Home")},main:{text:""}},ce.chromeless=this.currentRoute?.chromeless,ce.layout=lt.k.Standard,this.routeChangeHandled=!0),Object.assign(ce,z),ce.chromeless=ce.kioskMode===Ut.KioskMode.Full||this.currentRoute?.chromeless,this.ignoreStateUpdate(ce,X)||this.state.next(ce)}ignoreStateUpdate(z,X){return!!(Mf(z,X)||(z.sectionNav!==X.sectionNav||z.pageNav!==X.pageNav)&&z.actions===X.actions&&z.layout===X.layout&&kc(z.sectionNav.node,X.sectionNav.node)&&kc(z.pageNav,X.pageNav))}useState(){return(0,hu.A)(this.state,this.state.getValue())}exitKioskMode(){this.update({kioskMode:void 0}),x.Ny.partial({kiosk:null})}setKioskModeFromUrl(z){switch(z){case"tv":this.update({kioskMode:Ut.KioskMode.TV});break;case"1":case!0:this.update({kioskMode:Ut.KioskMode.Full})}}getKioskUrlValue(z){switch(z){case Ut.KioskMode.TV:return"tv";case Ut.KioskMode.Full:return!0;default:return null}}getNextKioskMode(){const{kioskMode:z,searchBarHidden:X}=this.state.getValue();return X||z===Ut.KioskMode.TV?(Dr.A.emit(dl.r1.alertSuccess,[(0,Ga.t)("navigation.kiosk.tv-alert","Press ESC to exit kiosk mode")]),Ut.KioskMode.Full):z?null:Ut.KioskMode.TV}}function kc(F,z){if(F===z)return!0;const X=F?.children?.find(Ce=>Ce.active),ce=z?.children?.find(Ce=>Ce.active);return F?.text===z?.text&&F?.url===z?.url&&X?.url===ce?.url&&kc(F?.parentItem,z?.parentItem)}var xf=e(19727);const gl=({label:F,onClick:z,onDismiss:X})=>{const ce=(0,It.of)(Of);return a.createElement(xf.e,{className:ce.buttonGroup},a.createElement(ie.$n,{icon:"angle-left",size:"sm",variant:"primary",fill:"outline",onClick:z,title:F,className:ce.mainDismissableButton},F),a.createElement(ie.$n,{icon:"times","aria-label":(0,Ga.t)("return-to-previous.dismissable-button","Close"),variant:"primary",fill:"outline",size:"sm",onClick:X}))},Of=F=>({mainDismissableButton:(0,rt.css)({width:"100%",["> span"]:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"270px",display:"inline-block"}}),buttonGroup:(0,rt.css)({width:"fit-content",backgroundColor:F.colors.background.secondary})});gl.displayName="DismissableButton";const yu=({href:F,title:z})=>{const X=(0,It.of)(If),{chrome:ce}=(0,Fo.Il)(),Ce=(0,a.useCallback)(()=>{x.Ny.push(F),ce.clearReturnToPrevious("clicked")},[F,ce]),Ae=(0,a.useCallback)(()=>{(0,yr.rR)("grafana_return_to_previous_button_dismissed",{action:"dismissed",page:F}),ce.clearReturnToPrevious("dismissed")},[F,ce]);return a.createElement("div",{className:X.returnToPrevious},a.createElement(gl,{label:(0,Ga.t)("return-to-previous.button.label","Back to {{title}}",{title:z}),onClick:Ce,onDismiss:Ae}))},If=F=>({returnToPrevious:(0,rt.css)({label:"return-to-previous",display:"flex",justifyContent:"center",left:"50%",transform:"translateX(-50%)",zIndex:F.zIndex.tooltip,position:"fixed",bottom:F.spacing.x4,boxShadow:F.shadows.z3})});yu.displayName="ReturnToPrevious";var Hc=e(40672),Gc=e(83122),Af=e(42941),Rf=e(87978),Lf=e(62372),Du=e(49185),pl=e(69386),Bf=e(4172);function Uf({feedUrl:F}){const z=(0,It.of)(Nf),{state:X,getNews:ce}=(0,Bf.n)(F),[Ce,Ae]=(0,Du.A)();return(0,a.useEffect)(()=>{ce()},[ce]),X.error?a.createElement("div",{className:z.innerWrapper},X.error&&X.error.message):a.createElement("div",{ref:Ce},X.loading?a.createElement(a.Fragment,null,a.createElement(pl.K.Skeleton,{showImage:!0,width:Ae.width}),a.createElement(pl.K.Skeleton,{showImage:!0,width:Ae.width}),a.createElement(pl.K.Skeleton,{showImage:!0,width:Ae.width}),a.createElement(pl.K.Skeleton,{showImage:!0,width:Ae.width}),a.createElement(pl.K.Skeleton,{showImage:!0,width:Ae.width})):a.createElement(a.Fragment,null,Ae.width>0&&X.value?.map((Fe,Qe)=>a.createElement(pl.K,{key:Qe,index:Qe,showImage:!0,width:Ae.width,data:X.value}))),a.createElement("div",{className:z.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"}))))}const Nf=F=>({innerWrapper:(0,rt.css)({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}),grot:(0,rt.css)({display:"flex",alignItems:"center",justifyContent:"center",padding:F.spacing(5,0),img:{width:"186px",height:"186px"}})});function wf({className:F}){const[z,X]=(0,Af.A)(!1),ce=(0,It.of)(Pu);return a.createElement(a.Fragment,null,a.createElement(Ai.I,{className:F,onClick:X,iconOnly:!0,icon:"rss","aria-label":"News"}),z&&a.createElement(Rf._,{title:a.createElement("div",{className:ce.title},a.createElement(ol.E,{element:"h3"},(0,Ga.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:ce.grot},a.createElement("img",{src:"public/img/grot-news.svg",alt:"Grot reading news"})),a.createElement("div",{className:ce.actions},a.createElement(wr.K,{name:"times",variant:"secondary",onClick:X,"data-testid":Tr.Tp.components.Drawer.General.close,tooltip:(0,Ga.t)("news.drawer.close","Close Drawer")}))),onClose:X,size:"md"},a.createElement(Uf,{feedUrl:Lf.$})))}const Pu=F=>({title:(0,rt.css)({display:"flex",alignItems:"center",justifyContent:"center",gap:F.spacing(2),borderBottom:`1px solid ${F.colors.border.weak}`}),grot:(0,rt.css)({display:"flex",alignItems:"center",justifyContent:"center",padding:F.spacing(2,0),img:{width:"75px",height:"75px"}}),actions:(0,rt.css)({position:"absolute",right:F.spacing(1),top:F.spacing(2)})});var jc=e(32931);function Ff({orgs:F,onSelectChange:z}){const X=(0,It.of)(nc);return a.createElement(fr.i,{"aria-label":"Change organization",variant:"secondary",buttonCss:X.buttonCss,size:"md",label:"",fill:"text",isFullWidth:!1,options:F.map(ce=>({label:ce.name,description:ce.role,value:ce})),onChange:z,icon:"building"})}const nc=F=>({buttonCss:(0,rt.css)({color:F.colors.text.secondary,"&:hover":{color:F.colors.text.primary}})});function Wf({orgs:F,onSelectChange:z}){const X=(0,It.of)(ac),{orgName:ce,orgId:Ce,orgRole:Ae}=Kt.TP.user,[Fe,Qe]=(0,a.useState)(()=>({label:ce,value:{role:Ae,orgId:Ce,name:ce},description:Ae})),qe=ut=>{Qe(ut),z(ut)};return a.createElement(le.l6,{"aria-label":"Change organization",width:"auto",value:Fe,prefix:a.createElement(hs.I,{className:"prefix-icon",name:"building"}),className:X.select,options:F.map(ut=>({label:ut.name,description:ut.role,value:ut})),onChange:qe})}const ac=F=>({select:(0,rt.css)({border:"none",background:"none",color:F.colors.text.secondary,"&:hover":{color:F.colors.text.primary,"& .prefix-icon":(0,rt.css)({color:F.colors.text.primary})}})});function Cu(){const F=(0,It.$j)(),z=(0,Ut.useDispatch)(),X=(0,Ut.useSelector)(qe=>qe.organization.userOrgs),ce=qe=>{qe.value&&((0,jc.bA)(qe.value.orgId),x.Ny.push(`/?orgId=${qe.value.orgId}`),window.location.reload())};(0,a.useEffect)(()=>{Kt.TP.isSignedIn&&!(Kt.TP.user.authenticatedBy==="apikey"||Kt.TP.user.authenticatedBy==="render")&&z((0,jc.wV)())},[z]);const Ce=F.breakpoints.values.sm,[Ae,Fe]=(0,a.useState)(!window.matchMedia(`(min-width: ${Ce}px)`).matches);if((0,Oi.Y)({breakpoint:Ce,onChange:qe=>{Fe(!qe.matches)}}),X?.length<=1)return null;const Qe=Ae?Ff:Wf;return a.createElement(Qe,{orgs:X,onSelectChange:ce})}var Yc=e(38138);function bu(F){const z=[];for(const X of F)X.isCreateAction&&z.push(X),X.children&&z.push(...bu(X.children));return z}const Kf=({})=>{const F=(0,It.of)($f),z=(0,It.$j)(),X=(0,Ut.useSelector)(vt=>vt.navBarTree),ce=z.breakpoints.values.sm,[Ce,Ae]=(0,a.useState)(!1),[Fe,Qe]=(0,a.useState)(!window.matchMedia(`(min-width: ${ce}px)`).matches),qe=(0,a.useMemo)(()=>bu(X),[X]);(0,Oi.Y)({breakpoint:ce,onChange:vt=>{Qe(!vt.matches)}});const ut=()=>a.createElement(Yc.W,null,qe.map((vt,Ct)=>a.createElement(Yc.W.Item,{key:Ct,url:vt.url,label:vt.text,onClick:()=>(0,yr.rR)("grafana_menu_item_clicked",{url:vt.url,from:"quickadd"})})));return qe.length>0?a.createElement(a.Fragment,null,a.createElement(Gc.m,{overlay:ut,placement:"bottom-end",onVisibleChange:Ae},a.createElement(Ai.I,{iconOnly:!0,icon:Fe?"plus-circle":"plus",isOpen:Fe?void 0:Ce,"aria-label":"New"})),a.createElement(gu.K,{className:F.separator})):null},$f=F=>({buttonContent:(0,rt.css)({alignItems:"center",display:"flex"}),buttonText:(0,rt.css)({[F.breakpoints.down("md")]:{display:"none"}}),separator:(0,rt.css)({[F.breakpoints.down("sm")]:{display:"none"}})});function Vf(){const F=(0,Ws.zy)(),z=(0,It.of)(Qr);let X=Hc.sQ.sanitizeUrl(M.I.getUrlForPartial(F,{forceLogin:"true"}));return X.startsWith("//")&&(X=X.replace(/\/+/g,"/")),a.createElement("a",{className:z.link,href:X,target:"_self"},"Sign in")}const Qr=F=>({link:(0,rt.css)({paddingRight:F.spacing(1),whiteSpace:"nowrap","&:hover":{textDecoration:"underline"}})});var Qc=e(64539);function _f({node:F}){const z=(0,It.of)(Nl),X=Wc((0,p.cloneDeep)(F),!1);return X?a.createElement(Yc.W,{header:a.createElement("div",{onClick:ce=>ce.stopPropagation(),className:z.header},a.createElement("div",null,X.text),X.subTitle&&a.createElement("div",{className:z.subTitle},X.subTitle))},X.children?.map(ce=>ce.url?a.createElement(Qc.D,{url:ce.url,label:ce.text,icon:ce.icon,target:ce.target,key:ce.id}):a.createElement(Qc.D,{icon:ce.icon,onClick:ce.onClick,label:ce.text,key:ce.id}))):null}const Nl=F=>({header:(0,rt.css)({fontSize:F.typography.h5.fontSize,fontWeight:F.typography.h5.fontWeight,padding:F.spacing(.5,1),whiteSpace:"nowrap"}),subTitle:(0,rt.css)({color:F.colors.text.secondary,fontSize:F.typography.bodySmall.fontSize})});var Tu=e(16797),zf=e(63917);function Mu(){const F=(0,It.$j)(),{query:z}=(0,rr.useKBar)(Fe=>({kbarSearchQuery:Fe.searchQuery,kbarIsOpen:Fe.visualState===rr.VisualState.showing})),X=F.breakpoints.values.sm,[ce,Ce]=(0,a.useState)(!window.matchMedia(`(min-width: ${X}px)`).matches);(0,Oi.Y)({breakpoint:X,onChange:Fe=>{Ce(!Fe.matches)}});const Ae=()=>{z.toggle()};return ce?a.createElement(Ai.I,{iconOnly:!0,icon:"search","aria-label":(0,Ga.t)("nav.search.placeholderCommandPalette","Search or jump to..."),onClick:Ae}):a.createElement(kf,{onClick:Ae})}function kf({onClick:F}){const z=(0,It.of)(Hf),X=(0,a.useMemo)(()=>(0,zf.gn)(),[]);return a.createElement("div",{className:z.wrapper},a.createElement("div",{className:z.inputWrapper},a.createElement("div",{className:z.prefix},a.createElement(hs.I,{name:"search"})),a.createElement("button",{className:z.fakeInput,onClick:F},(0,Ga.t)("nav.search.placeholderCommandPalette","Search or jump to...")),a.createElement("div",{className:z.suffix},a.createElement(hs.I,{name:"keyboard"}),a.createElement("span",{className:z.shortcut},X,"+k"))))}const Hf=F=>{const z=(0,me.n)({theme:F});return{wrapper:z.wrapper,inputWrapper:z.inputWrapper,prefix:z.prefix,suffix:(0,rt.css)([z.suffix,{display:"flex",gap:F.spacing(.5)}]),shortcut:(0,rt.css)({fontSize:F.typography.bodySmall.fontSize}),fakeInput:(0,rt.css)([z.input,{textAlign:"left",paddingLeft:28,color:F.colors.text.disabled,"&:focus":{outline:"unset",boxShadow:"unset"},"&:focus-visible":(0,rt.css)` ${(0,Tu.focusCss)(F)} `}]),button:(0,rt.css)({width:"100%",textAlign:"center","> *":{width:"100%",textAlign:"center",justifyContent:"center",gap:"1ch"}})}};function Jc({children:F,align:z="left"}){const X=(0,It.of)(Gf),Ce=(0,It.$j)().breakpoints.values.sm,[Ae,Fe]=(0,a.useState)(!window.matchMedia(`(min-width: ${Ce}px)`).matches);return(0,Oi.Y)({breakpoint:Ce,onChange:Qe=>{Fe(!Qe.matches)}}),Ae?a.createElement(a.Fragment,null,F):a.createElement("div",{"data-testid":"wrapper",className:(0,rt.cx)(X.wrapper,{[X[z]]:z==="right"})},F)}const Gf=F=>({wrapper:(0,rt.css)({display:"flex",gap:F.spacing(.5),alignItems:"center"}),right:(0,rt.css)({justifyContent:"flex-end"}),left:(0,rt.css)({}),center:(0,rt.css)({})}),jf=a.memo(function(){const z=(0,It.of)(Yf),X=(0,Ut.useSelector)(qe=>qe.navIndex),ce=(0,Ws.zy)(),Ce=(0,p.cloneDeep)(X.help),Ae=Ce?Gd(Ce):void 0,Fe=X.profile;let Qe=_.$W.appSubUrl||"/";return!_.$W.bootData.user.isSignedIn&&!_.$W.anonymousEnabled&&(Qe=Hc.sQ.sanitizeUrl(M.I.getUrlForPartial(ce,{forceLogin:"true"}))),a.createElement("div",{className:z.layout},a.createElement(Jc,null,a.createElement("a",{className:z.logo,href:Qe,title:"Go to home"},a.createElement(Jo.M.MenuLogo,{className:z.img})),a.createElement(Cu,null)),a.createElement(Jc,null,a.createElement(Mu,null)),a.createElement(Jc,{align:"right"},a.createElement(Kf,null),Ae&&a.createElement(Gc.m,{overlay:()=>a.createElement(_f,{node:Ae}),placement:"bottom-end"},a.createElement(Ai.I,{iconOnly:!0,icon:"question-circle","aria-label":"Help"})),_.$W.newsFeedEnabled&&a.createElement(wf,null),!an.TP.user.isSignedIn&&a.createElement(Vf,null),Fe&&a.createElement(Gc.m,{overlay:()=>a.createElement(_f,{node:Fe}),placement:"bottom-end"},a.createElement(Ai.I,{className:z.profileButton,imgSrc:an.TP.user.gravatarUrl,imgAlt:"User avatar","aria-label":"Profile"}))))}),Yf=F=>({layout:(0,rt.css)({height:Ko.l,display:"flex",gap:F.spacing(1),alignItems:"center",padding:F.spacing(0,1,0,2),borderBottom:`1px solid ${F.colors.border.weak}`,justifyContent:"space-between",[F.breakpoints.up("sm")]:{gridTemplateColumns:"1.5fr minmax(240px, 1fr) 1.5fr",display:"grid",justifyContent:"flex-start"}}),img:(0,rt.css)({height:F.spacing(3),width:F.spacing(3)}),logo:(0,rt.css)({display:"flex"}),profileButton:(0,rt.css)({padding:F.spacing(0,.25),img:{borderRadius:F.shape.radius.circle,height:"24px",marginRight:0,width:"24px"}})});function Qf({children:F}){const{chrome:z}=(0,Fo.Il)(),X=z.useState(),ce=X.searchBarHidden||X.kioskMode===Ut.KioskMode.TV,Ce=(0,It.$j)(),Ae=(0,It.of)(Jf),Fe=Ce.breakpoints.values.xl,Qe=ci.A.getBool(Eu,!0);(0,Oi.Y)({breakpoint:Fe,onChange:At=>{Qe&&(z.setMegaMenuDocked(At.matches,!1),z.setMegaMenuOpen(At.matches?ci.A.getBool(tc,X.megaMenuOpen):!1))}});const qe=(0,rt.cx)({[Ae.content]:!0,[Ae.contentNoSearchBar]:ce,[Ae.contentChromeless]:X.chromeless}),ut=()=>{z.setMegaMenuOpen(!X.megaMenuOpen)},{pathname:vt,search:Ct}=x.Ny.getLocation(),Ht=vt+Ct,Nt=_.Ay.featureToggles.returnToPrevious&&X.returnToPrevious&&Ht!==X.returnToPrevious.href;return(0,a.useEffect)(()=>{X.returnToPrevious&&Ht===X.returnToPrevious.href&&z.clearReturnToPrevious("auto_dismissed")},[z,Ht]),a.createElement("div",{className:Ym()("main-view",{"main-view--search-bar-hidden":ce&&!X.chromeless,"main-view--chrome-hidden":X.chromeless})},!X.chromeless&&a.createElement(a.Fragment,null,a.createElement(ie.z9,{className:Ae.skipLink,href:"#pageContent"},"Skip to main content"),a.createElement("div",{className:(0,rt.cx)(Ae.topNav)},!ce&&a.createElement(jf,null),a.createElement(Cf,{searchBarHidden:ce,sectionNav:X.sectionNav.node,pageNav:X.pageNav,actions:X.actions,onToggleSearchBar:z.onToggleSearchBar,onToggleMegaMenu:ut,onToggleKioskMode:z.onToggleKioskMode}))),a.createElement("main",{className:qe},a.createElement("div",{className:Ae.panes},!X.chromeless&&X.megaMenuDocked&&X.megaMenuOpen&&a.createElement(_c,{className:Ae.dockedMegaMenu,onClose:()=>z.setMegaMenuOpen(!1)}),a.createElement("div",{className:Ae.pageContainer,id:"pageContent"},F))),!X.chromeless&&!X.megaMenuDocked&&a.createElement(pu,null),!X.chromeless&&a.createElement(eu,null),Nt&&X.returnToPrevious&&a.createElement(yu,{href:X.returnToPrevious.href,title:X.returnToPrevious.title}))}const Jf=F=>({content:(0,rt.css)({display:"flex",flexDirection:"column",paddingTop:Ko.l*2,flexGrow:1,height:"100%"}),contentNoSearchBar:(0,rt.css)({paddingTop:Ko.l}),contentChromeless:(0,rt.css)({paddingTop:0}),dockedMegaMenu:(0,rt.css)({background:F.colors.background.primary,borderRight:`1px solid ${F.colors.border.weak}`,display:"none",zIndex:F.zIndex.navbarFixed,[F.breakpoints.up("xl")]:{display:"block"}}),topNav:(0,rt.css)({display:"flex",position:"fixed",zIndex:F.zIndex.navbarFixed,left:0,right:0,background:F.colors.background.primary,flexDirection:"column"}),panes:(0,rt.css)({label:"page-panes",display:"flex",height:"100%",width:"100%",flexGrow:1,minHeight:0,flexDirection:"column",[F.breakpoints.up("md")]:{flexDirection:"row"}}),pageContainer:(0,rt.css)({label:"page-container",flexGrow:1,minHeight:0,minWidth:0,overflow:"auto","@media print":{overflow:"visible"},"@page":{margin:0,size:"auto",padding:0}}),skipLink:(0,rt.css)({position:"absolute",top:-1e3,":focus":{left:F.spacing(1),top:F.spacing(1),zIndex:F.zIndex.portal}})});var wl=e(82467),Su=e(16001),Xc=e(3169),Xf=e(94701);function Zf({appNotification:F,onClearNotification:z}){const X=(0,It.of)(Zc);(0,Xf.A)(()=>{setTimeout(()=>{z(F.id)},Ut.timeoutMap[F.severity])});const ce=F.component||F.text||F.traceId;return a.createElement(vn.F,{severity:F.severity,title:F.title,onRemove:()=>z(F.id),elevated:!0},ce&&a.createElement("div",{className:X.wrapper},a.createElement("span",null,F.component||F.text),F.traceId&&a.createElement("span",{className:X.trace},"Trace ID: ",F.traceId)))}function Zc(F){return{wrapper:(0,rt.css)({display:"flex",flexDirection:"column"}),trace:(0,rt.css)({fontSize:F.typography.pxToRem(10)})}}function qf(){const F=(0,Ut.useSelector)(Ce=>(0,Su.fX)(Ce.appNotifications)),z=(0,Ut.useDispatch)(),X=(0,It.of)(eg);(0,a.useEffect)(()=>{Dr.A.on(dl.r1.alertWarning,Ce=>z((0,wl.dx)((0,Xc.q8)(...Ce)))),Dr.A.on(dl.r1.alertSuccess,Ce=>z((0,wl.dx)((0,Xc.tZ)(...Ce)))),Dr.A.on(dl.r1.alertError,Ce=>z((0,wl.dx)((0,Xc.gi)(...Ce))))},[z]);const ce=Ce=>{z((0,wl.Do)(Ce))};return a.createElement("div",{className:X.wrapper},a.createElement(cs.gW,null,F.map((Ce,Ae)=>a.createElement(Zf,{key:`${Ce.id}-${Ae}`,appNotification:Ce,onClearNotification:ce}))))}function eg(F){return{wrapper:(0,rt.css)({label:"app-notifications-list",zIndex:F.zIndex.portal,minWidth:400,maxWidth:600,position:"fixed",right:6,top:88})}}var tg=e(66899),ng=e.n(tg),xu=e(52446);function ag({error:F,errorInfo:z}){const X=(0,Ws.zy)(),ce=F?.name==="ChunkLoadError",Ce=(0,It.of)(qc);return(0,a.useEffect)(()=>{ce&&X.search.indexOf("chunkNotFound")===-1&&(window.location.href=M.I.getUrlForPartial(X,{chunkNotFound:!0}))},[X,ce]),a.createElement(dr.Y,{navId:"error",layout:lt.k.Canvas},a.createElement("div",{className:Ce.container},ce&&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(ie.$n,{size:"md",variant:"secondary",icon:"repeat",onClick:()=>window.location.reload()},"Reload"),a.createElement(xu.D,{title:"Error details",error:F,errorInfo:z})),!ce&&a.createElement(xu.D,{title:"An unexpected error happened",error:F,errorInfo:z})))}const qc=F=>({container:(0,rt.css)({width:"500px",margin:F.spacing(8,"auto")})});function sg(){const F=(0,It.of)(og);return a.createElement("div",{className:F.container,"aria-live":"polite",role:"status","aria-label":(0,Ga.t)("bouncing-loader.label","Loading")},a.createElement("div",{className:F.bounce},a.createElement("img",{alt:"",src:"public/img/grafana_icon.svg",className:F.logo})))}const rg=(0,rt.keyframes)({"0%":{opacity:0,animationTimingFunction:"cubic-bezier(0, 0, 0.5, 1)"},"100%":{opacity:1}}),ed=(0,rt.keyframes)({"from, to":{transform:"translateY(0px)",animationTimingFunction:"cubic-bezier(0.3, 0, 0.1, 1)"},"50%":{transform:"translateY(-50px)",animationTimingFunction:"cubic-bezier(0.9, 0, 0.7, 1)"}}),Ou=(0,rt.keyframes)({"0%":{transform:"scaleX(1.3) scaleY(0.8)",animationTimingFunction:"cubic-bezier(0.3, 0, 0.1, 1)"},"15%":{transform:"scaleX(0.75) scaleY(1.25)",animationTimingFunction:"cubic-bezier(0, 0, 0.7, 0.75)"},"55%":{transform:"scaleX(1.05) scaleY(0.95)",animationTimingFunction:"cubic-bezier(0.9, 0, 1, 1)"},"95%":{transform:"scaleX(0.75) scaleY(1.25)",animationTimingFunction:"cubic-bezier(0, 0, 0, 1)"},"100%":{transform:"scaleX(1.3) scaleY(0.8)",animationTimingFunction:"cubic-bezier(0, 0, 0.7, 1)"}}),og=F=>({container:(0,rt.css)({opacity:0,animationName:rg,animationIterationCount:1,animationDuration:"0.9s",animationDelay:"0.5s",animationFillMode:"forwards"}),bounce:(0,rt.css)({textAlign:"center",animationName:ed,animationDuration:"0.9s",animationIterationCount:"infinite"}),logo:(0,rt.css)({display:"inline-block",animationName:Ou,animationDuration:"0.9s",animationIterationCount:"infinite",width:"60px",height:"60px"})});function td(){const F=(0,It.of)(ig);return a.createElement("div",{className:F.loadingPage},a.createElement(sg,null))}const ig=F=>({loadingPage:(0,rt.css)({backgroundColor:F.colors.background.primary,height:"100%",flexDrection:"column",display:"flex",justifyContent:"center",alignItems:"center"})});function lg(F){const{chrome:z,keybindings:X}=(0,Fo.Il)();return z.setMatchedRoute(F.route),(0,a.useLayoutEffect)(()=>{X.clearAndInitGlobalBindings(F.route)},[X,F.route]),(0,a.useEffect)(()=>(Au(F.route),Ru(),(0,x.Lc)("GrafanaRoute",!1,"Mounted",F.match),()=>{(0,x.Lc)("GrafanaRoute",!1,"Unmounted",F.route),Au(F.route,!0)}),[]),(0,a.useEffect)(()=>{Ru(),(0,yr.Jy)(),(0,x.Lc)("GrafanaRoute",!1,"Updated",F)}),(0,x.Lc)("GrafanaRoute",!1,"Rendered",F.route),a.createElement(wo.tH,null,({error:ce,errorInfo:Ce})=>ce?a.createElement(ag,{error:ce,errorInfo:Ce}):a.createElement(a.Suspense,{fallback:a.createElement(td,null)},a.createElement(F.route.component,{...F,queryParams:(0,x.SE)(F.location.search)})))}function Iu(F){return F.pageClass?F.pageClass.split(" "):[]}function Au(F,z=!1){for(const X of Iu(F))z?document.body.classList.remove(X):document.body.classList.add(X)}function Ru(){document.body.classList.remove("sidemenu-open--xs");const F=document.getElementById("tooltip");F?.parentElement?.removeChild(F);const z=document.querySelectorAll(".tooltip");for(let X=0;X<z.length;X++){const ce=z[X];ce.parentElement?.removeChild(ce)}for(const X of ng().drops)X.destroy()}var nd=e(96378),ad=e(78731);class Lu extends a.PureComponent{constructor(){super(...arguments),this.styles=cg(j.$.theme2),this.state={},this.initListener=()=>{const z=(0,ad.oF)();z&&(this.subscription=z.getConnectionState().subscribe({next:X=>{this.setState({show:!X})}}))}}componentDidMount(){}componentWillUnmount(){this.subscription&&this.subscription.unsubscribe()}render(){const{show:z}=this.state;return z?!Kt.TP.isSignedIn||!j.$.liveEnabled||Kt.TP.user.orgRole===Yl.X.None?null:a.createElement("div",{className:this.styles.foot},a.createElement(vn.F,{severity:"warning",className:this.styles.warn,title:"connection to server is lost..."})):null}}const cg=(0,Wa.N)(F=>({foot:(0,rt.css)` position: absolute; bottom: 0px; left: 0px; right: 0px; z-index: 10000; cursor: wait; margin: 16px; `,warn:(0,rt.css)` max-width: 400px; margin: auto; `}));let Bu=[],Uu=[];function hh(F){Bu.push(F)}function vh(F){Uu.push(F)}class dg extends a.Component{constructor(z){super(z),this.renderRoute=X=>{const ce=X.roles?X.roles():[];return a.createElement(Br.CompatRoute,{exact:X.exact===void 0?!0:X.exact,sensitive:X.sensitive===void 0?!1:X.sensitive,path:X.path,key:X.path,render:Ce=>ce?.length&&!ce.some(Ae=>Kt.TP.hasRole(Ae))?a.createElement(Ws.rd,{to:"/"}):a.createElement(lg,{...Ce,route:X})})},this.state={}}async componentDidMount(){await Lc(),this.setState({ready:!0}),$(".preloader").remove()}renderRoutes(){return a.createElement(Ws.dO,null,Ac().map(z=>this.renderRoute(z)))}render(){const{app:z}=this.props,{ready:X}=this.state;(0,x.Lc)("AppWrapper",!1,"rendering");const ce=Ce=>{(0,yr.rR)("command_palette_action_selected",{actionId:Ce.id,actionName:Ce.name})};return a.createElement(go.Provider,{store:Rs.M_},a.createElement(wo.Xw,{style:"page"},a.createElement(Fo.YE.Provider,{value:z.context},a.createElement(nd.N,{value:j.$.theme2},a.createElement(rr.KBarProvider,{actions:[],options:{enableHistory:!0,callbacks:{onSelectAction:ce}}},a.createElement(Ci.YO,null,a.createElement(pc.k,null),a.createElement("div",{className:"grafana-app"},a.createElement(Ws.Ix,{history:x.Ny.getHistory()},a.createElement(Br.CompatRouter,null,a.createElement(Qf,null,Uu.map((Ce,Ae)=>a.createElement(Ce,{key:Ae.toString()})),a.createElement(wd,null),a.createElement(qf,null),X&&this.renderRoutes(),Bu.map((Ce,Ae)=>a.createElement(Ce,{key:Ae.toString()})))))),a.createElement(Lu,null),a.createElement(Ci.EO,null),a.createElement(ii.qB,null)))))))}}var Nu=e(33919);function ug({actions:F,children:z,info:X,pageNav:ce,layout:Ce,renderTitle:Ae,subTitle:Fe}){const Qe=(0,a.useContext)(ul.A);return a.createElement(dr.Y,{navModel:Qe.sectionNav,pageNav:ce,layout:Ce,actions:F,renderTitle:Ae,info:X,subTitle:Fe},a.createElement(dr.Y.Contents,null,z))}var mg=e(8867),fg=e(91324),gg=e(23227),pg=e(83712),sc=e(93455),hg=e(99443),wu=e(70699),vg=e(63997),Eg=e(5798),yg=e(61061),Dg=e(85346),Fu=e(41731),Wu=e(36294),Pg=e(62575),sd=e(27798),mi=e(53392),Eh=e(17694),rd=e(27743),yh=e(66509),Cg=e(98368),bg=e(67341),Ku=e(51472),Tg=e(90517),od=e(78412),Mg=e(24548),Sg=e(41366),id=e(63892),xg=e(22965),$u=e(19336),Vu=e(66163),Og=e(30259),Ig=e(96725),_u=e(30283),Ag=e(53141),Rg=e(69382),zu=e(88790),Lg=e(388),Bg=e(58689),ku=e(29342),Ug=e(27583),Ng=e(34153),Dh=e(13852),Ph=e(5614),Ch=e(34715),bh=e(25853),Th=e(98020),Mh=e(90088),Sh=e(79764),xh=e(5422),Oh=e(61987),Ih=e(88225),Ah=e(13896),Rh=e(68018),Lh=e(63023),Bh=e(32437),Uh=e(99996),Nh=e(99641),wh=e(70649),Fh=e(98828),Wh=e(79151),Kh=e(53663),$h=e(27193),Vh=e(53123),_h=e(4458),zh=e(28643),kh=e(33311),Hh=e(90841),Gh=e(49018),jh=e(63738),Yh=e(63263),wg=e(29340),ld=e(45937),Fg=e(29339),Wg=e(6820),Kg=e(77444),$g=e(3327),Vg=e(70794),_g=e(11273),zg=e(80641),kg=e(28867),Hu=e(11220),Hg=e(23544),Gg=e(48339),jg=e(4240),Yg=e(95224),Qg=e(82382),Jg=e(87048),Xg=e(53007),Zg=e(12179),qg=e(17226),ep=e(42982),Gu=e(42806),Qh=e(50459),Jh=e(84879),Xh=e(52664),Zh=e(26868),qh=e(72805),e0=e(73575),t0=e(56811),n0=e(53896),a0=e(97918),tp=e(81422),np=e(29130),ap=e(45376),sp=e(73642),ju=e(83267),rp=e(80021),op=e(41684),ip=e(72215),Fl=e(81656),lp=e(29424),cp=e(7682),Wl=e(51764),rc=e(76151),ki=e(30781),dp=e(65972),up=e(90756),mp=e(24289),fp=e(84472),gp=e(71533),pp=e(45298),hp=e(96906),Yu=e(95311),Qu=e(82349),vp=e(43482),Ep=e(49935),yp=e(48761),Ju=e(97231),Dp=e(13835),Ri=e(91381),Xu=e(52859),oc=e(25928),Pp=e(36714),Cp=e(30815),bp=e(3465),s0=e(39012),cd=e(94675),Tp=e(40051),$o=e(4543),Kl=e(89579),Zu=e(82524),Mp=e(31115),Sp=e(99003),dd=e(95684),Li=e(1624),qu=e(93644),xp=e(96619),Op=e(61748),Ip=e(57169),ud=e(11769),em=e(26551),Ap=e(40295),Rp=e(38514),Lp=e(81312),Ao=e(64298),r0=e(70866),tm=e(30587),Bp=e(44850),Up=e(54556),to=e(81615),ei=e(82798),nm=e(8687),Np=e(77270),ic=e(10742),wp=e(41404),Fp=e(72579),Wp=e(39973),Kp=e(56963),$p=e(8807),Vp=e(24109),_p=e(46255),zp=e(68636),kp=e(74305);let md=!1;function tn(F,z){mg.cacheStore[z]={content:F,status:"loaded"}}function Hp(){let F="public/img/icons/";const z=typeof window<"u"&&window.__grafana_public_path__;return z&&(F=z+"img/icons/"),X=>F+X}function Gp(){if(md)return;md=!0;const F=Hp();tn(fg,F("unicons/at.svg")),tn(gg,F("unicons/adjust-circle.svg")),tn(pg,F("unicons/align-left.svg")),tn(sc,F("unicons/align-right.svg")),tn(hg,F("unicons/angle-double-down.svg")),tn(wu,F("unicons/angle-double-right.svg")),tn(vg,F("unicons/angle-down.svg")),tn(Eg,F("unicons/angle-left.svg")),tn(yg,F("unicons/angle-right.svg")),tn(Dg,F("unicons/angle-up.svg")),tn(Fu,F("unicons/apps.svg")),tn(Wu,F("unicons/arrow.svg")),tn(Pg,F("unicons/arrow-down.svg")),tn(sd,F("unicons/arrow-from-right.svg")),tn(mi,F("unicons/arrow-left.svg")),tn(Eh,F("unicons/arrow-random.svg")),tn(rd,F("unicons/arrow-right.svg")),tn(yh,F("unicons/arrow-to-right.svg")),tn(Cg,F("unicons/arrow-up.svg")),tn(bg,F("unicons/arrows-h.svg")),tn(Ku,F("unicons/backward.svg")),tn(Tg,F("unicons/bars.svg")),tn(od,F("unicons/bell.svg")),tn(Mg,F("unicons/bell-slash.svg")),tn(Sg,F("unicons/bolt.svg")),tn(id,F("unicons/book.svg")),tn(xg,F("unicons/book-open.svg")),tn($u,F("unicons/brackets-curly.svg")),tn(Vu,F("unicons/bug.svg")),tn(Og,F("unicons/building.svg")),tn(Ig,F("unicons/calculator-alt.svg")),tn(_u,F("unicons/calendar-alt.svg")),tn(Ag,F("unicons/calendar-slash.svg")),tn(Rg,F("unicons/camera.svg")),tn(zu,F("unicons/channel-add.svg")),tn(Lg,F("unicons/chart-line.svg")),tn(Bg,F("unicons/check.svg")),tn(ku,F("unicons/check-circle.svg")),tn(Ug,F("unicons/circle.svg")),tn(Ng,F("unicons/clipboard-alt.svg")),tn(Dh,F("unicons/clock-nine.svg")),tn(Ph,F("unicons/cloud.svg")),tn(Ch,F("unicons/cloud-download.svg")),tn(bh,F("unicons/code-branch.svg")),tn(Th,F("unicons/cog.svg")),tn(Mh,F("unicons/columns.svg")),tn(Sh,F("unicons/comment-alt.svg")),tn(xh,F("unicons/comment-alt-share.svg")),tn(Oh,F("unicons/comments-alt.svg")),tn(Ih,F("unicons/compass.svg")),tn(Ah,F("unicons/copy.svg")),tn(Rh,F("unicons/corner-down-right-alt.svg")),tn(Lh,F("unicons/cube.svg")),tn(Bh,F("unicons/dashboard.svg")),tn(Uh,F("unicons/database.svg")),tn(Nh,F("unicons/document-info.svg")),tn(wh,F("unicons/download-alt.svg")),tn(Fh,F("unicons/draggabledots.svg")),tn(Wh,F("unicons/edit.svg")),tn(Kh,F("unicons/ellipsis-v.svg")),tn($h,F("unicons/ellipsis-h.svg")),tn(Vh,F("unicons/envelope.svg")),tn(_h,F("unicons/exchange-alt.svg")),tn(zh,F("unicons/exclamation-circle.svg")),tn(kh,F("unicons/exclamation-triangle.svg")),tn(Hh,F("unicons/external-link-alt.svg")),tn(Gh,F("unicons/eye.svg")),tn(jh,F("unicons/eye-slash.svg")),tn(Yh,F("unicons/file-alt.svg")),tn(wg,F("unicons/file-blank.svg")),tn(ld,F("unicons/filter.svg")),tn(Fg,F("unicons/folder.svg")),tn(Wg,F("unicons/folder-open.svg")),tn(Kg,F("unicons/folder-plus.svg")),tn($g,F("unicons/folder-upload.svg")),tn(Vg,F("unicons/forward.svg")),tn(_g,F("unicons/graph-bar.svg")),tn(zg,F("unicons/history.svg")),tn(kg,F("unicons/history-alt.svg")),tn(Hu,F("unicons/home-alt.svg")),tn(Hg,F("unicons/import.svg")),tn(Gg,F("unicons/info.svg")),tn(jg,F("unicons/info-circle.svg")),tn(Yg,F("unicons/k6.svg")),tn(Qg,F("unicons/key-skeleton-alt.svg")),tn(Jg,F("unicons/keyboard.svg")),tn(Xg,F("unicons/link.svg")),tn(Zg,F("unicons/list-ul.svg")),tn(qg,F("unicons/lock.svg")),tn(ep,F("unicons/minus.svg")),tn(Gu,F("unicons/minus-circle.svg")),tn(Qh,F("unicons/mobile-android.svg")),tn(Jh,F("unicons/monitor.svg")),tn(Xh,F("unicons/pause.svg")),tn(Zh,F("unicons/pen.svg")),tn(qh,F("unicons/play.svg")),tn(e0,F("unicons/plug.svg")),tn(t0,F("unicons/plus.svg")),tn(n0,F("unicons/plus-circle.svg")),tn(a0,F("unicons/power.svg")),tn(tp,F("unicons/presentation-play.svg")),tn(np,F("unicons/process.svg")),tn(ap,F("unicons/question-circle.svg")),tn(sp,F("unicons/repeat.svg")),tn(ju,F("unicons/rocket.svg")),tn(rp,F("unicons/rss.svg")),tn(op,F("unicons/save.svg")),tn(ip,F("unicons/search.svg")),tn(Fl,F("unicons/search-minus.svg")),tn(lp,F("unicons/search-plus.svg")),tn(cp,F("unicons/share-alt.svg")),tn(Wl,F("unicons/shield.svg")),tn(rc,F("unicons/signal.svg")),tn(ki,F("unicons/signin.svg")),tn(dp,F("unicons/signout.svg")),tn(up,F("unicons/sitemap.svg")),tn(mp,F("unicons/slack.svg")),tn(fp,F("unicons/sliders-v-alt.svg")),tn(gp,F("unicons/sort-amount-down.svg")),tn(pp,F("unicons/sort-amount-up.svg")),tn(hp,F("unicons/square-shape.svg")),tn(Yu,F("unicons/star.svg")),tn(Qu,F("unicons/step-backward.svg")),tn(vp,F("unicons/sync.svg")),tn(Ep,F("unicons/stopwatch.svg")),tn(yp,F("unicons/table.svg")),tn(Ju,F("unicons/tag-alt.svg")),tn(Dp,F("unicons/times.svg")),tn(Ri,F("unicons/trash-alt.svg")),tn(Xu,F("unicons/unlock.svg")),tn(oc,F("unicons/upload.svg")),tn(Pp,F("unicons/user.svg")),tn(Cp,F("unicons/users-alt.svg")),tn(bp,F("unicons/wrap-text.svg")),tn(s0,F("unicons/cloud-upload.svg")),tn(cd,F("unicons/credit-card.svg")),tn(Tp,F("unicons/file-copy-alt.svg")),tn($o,F("unicons/fire.svg")),tn(Kl,F("unicons/hourglass.svg")),tn(Zu,F("unicons/layer-group.svg")),tn(Mp,F("unicons/layers-alt.svg")),tn(Sp,F("unicons/line-alt.svg")),tn(dd,F("unicons/list-ui-alt.svg")),tn(Li,F("unicons/message.svg")),tn(qu,F("unicons/palette.svg")),tn(xp,F("unicons/percentage.svg")),tn(Op,F("unicons/shield-exclamation.svg")),tn(Ip,F("unicons/plus-square.svg")),tn(ud,F("unicons/x.svg")),tn(em,F("unicons/capture.svg")),tn(Ap,F("custom/gf-grid.svg")),tn(Rp,F("custom/gf-landscape.svg")),tn(Lp,F("custom/gf-layout-simple.svg")),tn(Ao,F("custom/gf-portrait.svg")),tn(r0,F("custom/gf-show-context.svg")),tn(tm,F("custom/gf-bar-alignment-after.svg")),tn(Bp,F("custom/gf-bar-alignment-before.svg")),tn(Up,F("custom/gf-bar-alignment-center.svg")),tn(to,F("custom/gf-interpolation-linear.svg")),tn(ei,F("custom/gf-interpolation-smooth.svg")),tn(nm,F("custom/gf-interpolation-step-after.svg")),tn(Np,F("custom/gf-interpolation-step-before.svg")),tn(ic,F("custom/gf-logs.svg")),tn(wp,F("custom/gf-movepane-left.svg")),tn(Fp,F("custom/gf-movepane-right.svg")),tn(Wp,F("mono/favorite.svg")),tn(Kp,F("mono/grafana.svg")),tn($p,F("mono/heart.svg")),tn(Vp,F("mono/heart-break.svg")),tn(_p,F("mono/panel-add.svg")),tn(zp,F("mono/library-panel.svg")),tn(kp,F("unicons/record-audio.svg"))}var fd=e(76885);function jp(F){const z=F.target instanceof Element&&$l(F.target);if(!(F.ctrlKey||F.metaKey||F.defaultPrevented)&&z){let X=z.getAttribute("href");const ce=z.getAttribute("target");if(X&&!ce){const Ce=fd.kM.parseKeyValue(X.split("?")[1]),Ae=Ce.orgId&&Number(Ce.orgId)!==_.$W.bootData.user.orgId;if((0,x.Lc)("utils",!1,"intercepting link click",F),F.preventDefault(),X=M.I.stripBaseFromUrl(X),X[0]!=="/"||Ae)if(X.indexOf("://")>0||X.indexOf("mailto:")===0||Ae){window.location.href=X;return}else if(X.indexOf("#")===0){window.location.hash=X;return}else X=`/${X}`;x.Ny.push(X)}}}function $l(F){for(;F!==null&&F.tagName;){if(F.tagName.toUpperCase()==="A")return F;F=F.parentElement}return null}var gd=e(19752);function am(F,...z){const X=(0,go.connect)(...z)(F);return ce=>a.createElement(X,{...ce,store:Rs.M_})}function Yp(F,...z){const X=(0,go.connect)(...z)(F);return ce=>a.createElement(go.Provider,{store:Rs.M_},a.createElement(X,{...ce,store:Rs.M_}))}const sm=Yp(F=>a.createElement(a.Fragment,null,a.createElement(Ci.YO,{...F},a.createElement(Ci.EO,null))));class Qp{constructor(){this.reactModalRoot=document.body,this.reactModalNode=document.createElement("div"),this.root=(0,v.H)(this.reactModalNode),this.onReactModalDismiss=()=>{this.root.render(null),this.reactModalRoot.removeChild(this.reactModalNode)}}init(){Dr.A.subscribe(Yr.bY,z=>this.showConfirmModal(z.payload)),Dr.A.subscribe(Yr.S8,z=>this.showModalReact(z.payload)),Dr.A.subscribe(O.ah,z=>(0,gd.KJ)(z.payload))}showModalReact(z){const{component:X,props:ce}=z,Ce={component:X,props:{...ce,isOpen:!0,onDismiss:this.onReactModalDismiss}},Ae=a.createElement((0,nd.e)(sm,j.$.theme2),Ce);this.reactModalRoot.appendChild(this.reactModalNode),this.root.render(Ae)}showConfirmModal(z){const{confirmText:X,onConfirm:ce=()=>{},onDismiss:Ce,text2:Ae,altActionText:Fe,onAltAction:Qe,noText:qe,text:ut,text2htmlBind:vt,yesText:Ct="Yes",icon:Ht,title:Nt="Confirm",yesButtonVariant:At}=z,kt={confirmText:Ct,confirmButtonVariant:At,confirmationText:X,icon:Ht,title:Nt,body:ut,description:Ae&&vt?Hc.sQ.sanitize(Ae):Ae,isOpen:!0,dismissText:qe,onConfirm:()=>{ce(),this.onReactModalDismiss()},onDismiss:()=>{Ce?.(),this.onReactModalDismiss()},onAlternative:Qe?()=>{Qe(),this.onReactModalDismiss()}:void 0,alternativeText:Fe},En={component:Al.u,props:kt},Ma=a.createElement((0,nd.e)(sm,j.$.theme2),En);this.reactModalRoot.appendChild(this.reactModalNode),this.root.render(Ma)}}class Jp{constructor(z){this.hasUpdates=!1,this.checked=Date.now(),this.prevLocationPath="",this.interval=z??1e3*60*5}start(){const z=(0,ad.oF)();z&&z.getConnectionState().subscribe(X=>{X&&this._checkForUpdates()}),x.Ny.getHistory().listen(this.locationUpdated.bind(this)),this.prevLocationPath=x.Ny.getLocation().pathname}locationUpdated(z){if(this.prevLocationPath===z.pathname)return;const X=z.pathname.split("/");X[1]==="/"&&this.prevLocationPath!=="/"?this.reloadIfUpdateDetected():X[1]==="d"?this.reloadIfUpdateDetected():this.hasUpdates&&(0,yr.rR)("new_frontend_assets_reload_ignored",{newLocation:z.pathname,prevLocation:this.prevLocationPath}),this.prevLocationPath=z.pathname}async _checkForUpdates(){if(this.hasUpdates||Date.now()-this.checked<this.interval)return;this.checked=Date.now();const z=this.previous,X=await(0,T.AI)().get("/api/frontend/assets");z&&!(0,p.isEqual)(z,X)&&(this.hasUpdates=!0,(0,yr.rR)("new_frontend_assets_detected",{assets:z.assets!==X.assets,plugins:z.plugins!==X.plugins,version:z.version!==X.version,flags:z.flags!==X.flags})),this.previous=X}reloadIfUpdateDetected(){this.hasUpdates&&((0,yr.rR)("new_frontend_assets_reload",{}),window.location.reload()),this._checkForUpdates()}}var fi=e(27677),Xp=e(91040),Zp=e(40621);function hl(F,z=!1){return new Promise(X=>{const ce=document.createElement("script");ce.onload=X,ce.src=F,ce.async=z,document.head.appendChild(ce)})}const rm=(0,Xp.h)("EchoSrv"),om=rm.logger;(0,Zp.h)("echo",void 0,rm);class W{constructor(z){this.config={flushInterval:1e4,debug:!1},this.backends=[],this.flush=()=>{for(const X of this.backends)X.flush()},this.addBackend=X=>{om("Adding backend",!1,X),this.backends.push(X)},this.addEvent=(X,ce)=>{const Ce=this.getMeta(),Ae={...X,meta:{...Ce,...ce}};for(const Fe of this.backends)(Fe.supportedEvents.length===0||Fe.supportedEvents.indexOf(Ae.type)>-1)&&Fe.addEvent(Ae);om(`${X.type} event`,!1,{...X.payload,meta:Ae.meta})},this.getMeta=()=>({sessionId:"",userId:Kt.TP.user.id,userLogin:Kt.TP.user.login,userSignedIn:Kt.TP.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,...z},setInterval(this.flush,this.config.flushInterval)}}const se=(F,z)=>{(0,H.x$)().addEvent({type:H.on.Performance,payload:{name:F,value:z}})},fe=F=>faro?.api?.pushError(F);class Pe{constructor(z){this.options=z,this.buffer=[],this.supportedEvents=[H.on.Performance],this.addEvent=X=>{this.buffer.push(X.payload)},this.flush=()=>{this.buffer.length!==0&&(fi.IB.post("/api/frontend-metrics",{events:this.buffer},{showErrorAlert:!1}).catch(()=>{}),this.buffer=[])}}}var Se=e(61298);class we{constructor(z){this.options=z,this.supportedEvents=[H.on.Pageview,H.on.Interaction],this.addEvent=Ce=>{window.applicationInsights&&((0,Se.nB)(Ce)&&window.applicationInsights.trackPageView?.(),(0,Se.fX)(Ce)&&window.applicationInsights.trackEvent?.({name:Ce.payload.interactionName,properties:Ce.payload.properties}))},this.flush=()=>{};const X={config:{connectionString:z.connectionString,endpointUrl:z.endpointUrl}};hl("https://js.monitor.azure.com/scripts/b/ai.2.min.js").then(()=>{const Ce=new window.Microsoft.ApplicationInsights.ApplicationInsights(X);window.applicationInsights=Ce.loadAppInsights()})}}class ke{constructor(z){this.options=z,this.supportedEvents=[H.on.Pageview],this.googleAnalytics4SendManualPageViews=!1,this.addEvent=Ce=>{window.gtag&&this.googleAnalytics4SendManualPageViews&&window.gtag("event","page_view",{page_path:Ce.payload.page})},this.flush=()=>{};const X=`https://www.googletagmanager.com/gtag/js?id=${z.googleAnalyticsId}`;hl(X,!0),window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date);const ce={page_path:window.location.pathname};z.user&&(ce.user_id=z.user.analytics.identifier),this.googleAnalytics4SendManualPageViews=z.googleAnalytics4SendManualPageViews,window.gtag("config",z.googleAnalyticsId,ce)}}class Je{constructor(z){this.options=z,this.supportedEvents=[H.on.Pageview],this.trackedUserId=null,this.addEvent=Ce=>{if(!window.ga)return;window.ga("set",{page:Ce.payload.page}),window.ga("send","pageview");const{userSignedIn:Ae,userId:Fe}=Ce.meta;Ae&&Fe!==this.trackedUserId&&(this.trackedUserId=Fe,window.ga("set","userId",Fe))},this.flush=()=>{};const X=`https://www.google-analytics.com/analytics${z.debug?"_debug":""}.js`;hl(X);const ce=window.ga=window.ga||function(){(ce.q=ce.q||[]).push(arguments)};ce.l=+new Date,ce("create",z.googleAnalyticsId,"auto"),ce("set","anonymizeIp",!0)}}class it{constructor(z){this.options=z,this.supportedEvents=[H.on.Pageview,H.on.Interaction,H.on.ExperimentView],this.addEvent=Ae=>{window.rudderanalytics&&((0,Se.nB)(Ae)&&window.rudderanalytics.page?.(),(0,Se.fX)(Ae)&&window.rudderanalytics.track?.(Ae.payload.interactionName,Ae.payload.properties),(0,Se.p6)(Ae)&&window.rudderanalytics.track?.("experiment_viewed",{experiment_id:Ae.payload.experimentId,experiment_group:Ae.payload.experimentGroup,experiment_variant:Ae.payload.experimentVariant}))},this.flush=()=>{};const X=z.sdkUrl||"https://cdn.rudderlabs.com/v1/rudder-analytics.min.js";hl(X);const ce=window.rudderanalytics=[],Ce=["load","page","track","identify","alias","group","ready","reset","getAnonymousId","setAnonymousId"];for(let Ae=0;Ae<Ce.length;Ae++){const Fe=Ce[Ae];ce[Fe]=function(Qe){return function(){ce.push([Qe].concat(Array.prototype.slice.call(arguments)))}}(Fe)}if(window.rudderanalytics?.load?.(z.writeKey,z.dataPlaneUrl,{configUrl:z.configUrl,destSDKBaseURL:z.integrationsUrl}),z.user){const{identifier:Ae,intercomIdentifier:Fe}=z.user.analytics,Qe={};Fe&&(Qe.Intercom={user_hash:Fe}),window.rudderanalytics?.identify?.(Ae,{email:z.user.email,orgId:z.user.orgId,language:z.user.language,version:z.buildInfo.version,edition:z.buildInfo.edition},Qe)}}}var ct=e(35896),ht=e(88285),Et=e(74940),Tt=e(58424),Dt=e(8593),Bt=e(26539),Gt=e(89713),Lt=e(20467);class wt extends Lt.j{constructor(){super(...arguments),this.name="EchoSrvTransport",this.version=j.$.buildInfo.version}send(z){(0,H.x$)().addEvent({type:H.on.GrafanaJavascriptAgent,payload:z})}isBatched(){return!0}getIgnoreUrls(){return[]}}class Qt{constructor(z){this.options=z,this.supportedEvents=[H.on.GrafanaJavascriptAgent],this.addEvent=Ae=>{},this.flush=()=>{};const X=[],ce=[new wt];z.customEndpoint&&ce.push(new ht.m({url:z.customEndpoint,apiKey:z.apiKey})),z.errorInstrumentalizationEnabled&&X.push(new Et.W),z.consoleInstrumentalizationEnabled&&X.push(new Tt._),z.webVitalsInstrumentalizationEnabled&&X.push(new Dt.I),X.push(new Bt.D);const Ce={globalObjectKey:z.globalObjectKey||"faro",preventGlobalExposure:z.preventGlobalExposure||!1,app:{version:z.buildInfo.version,environment:z.buildInfo.env},instrumentations:X,transports:ce,ignoreErrors:["ResizeObserver loop limit exceeded","ResizeObserver loop completed","Non-Error exception captured with keys"],sessionTracking:{persistent:!0},batching:{sendTimeout:1e3},internalLoggerLevel:z.internalLoggerLevel||ct.vI};this.faroInstance=(0,Gt.p)(Ce),z.user&&this.faroInstance.api.setUser({id:z.user.id,attributes:{orgId:String(z.user.orgId)||""}})}}var nn=e(6411),Jt=e.n(nn),In=e(45731),rn=e(9610),bn=e(87490),Bn=e(70497),Fn=e(1702);function xn(F){return()=>{const z=document.querySelectorAll(":hover");for(let X=z.length-1;X>0;X--){const ce=z[X];ce instanceof HTMLElement&&ce.dataset?.panelid&&F(parseInt(ce.dataset?.panelid,10))}}}class un{constructor(z,X){this.locationService=z,this.chromeService=X}clearAndInitGlobalBindings(z){Jt().reset(),z.chromeless||(this.bind(["?","mod+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,fl.O)(!1)),this.bind("c r",()=>(0,fl.O)(!0))}bindGlobalEsc(){this.bindGlobal("esc",this.globalEsc)}globalEsc(){const X=document.activeElement;if(!(document.querySelectorAll(".slate-typeahead--open").length>0)){if(X&&X instanceof HTMLElement&&(X.nodeName==="INPUT"||X.nodeName==="TEXTAREA"||X.hasAttribute("data-slate-editor"))){X.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(){Dr.A.publish(new Yr.S8({component:Hd.N}))}exit(){const z=this.locationService.getSearchObject();if(z.editview){this.locationService.partial({editview:null,editIndex:null});return}if(z.inspect){this.locationService.partial({inspect:null,inspectTab:null});return}if(z.editPanel){this.locationService.partial({editPanel:null,tab:null});return}if(z.viewPanel){this.locationService.partial({viewPanel:null,tab:null});return}const{kioskMode:X}=this.chromeService.state.getValue();X&&this.chromeService.exitKioskMode(),z.search&&this.closeSearch()}showDashEditView(){this.locationService.partial({editview:"settings"})}bind(z,X){Jt().bind(z,ce=>{ce.preventDefault(),ce.stopPropagation(),ce.returnValue=!1,X.call(this)},"keydown")}bindGlobal(z,X){Jt().bindGlobal(z,ce=>{ce.preventDefault(),ce.stopPropagation(),ce.returnValue=!1,X.call(this)},"keydown")}unbind(z,X){Jt().unbind(z,X)}bindWithPanelId(z,X){this.bind(z,xn(X))}setupTimeRangeBindings(z=!0){this.bind("t a",()=>{Dr.A.publish(new Yr.Rh({updateUrl:z}))}),this.bind("t z",()=>{Dr.A.publish(new Yr.U0({scale:2,updateUrl:z}))}),this.bind("ctrl+z",()=>{Dr.A.publish(new Yr.U0({scale:2,updateUrl:z}))}),this.bind("t left",()=>{Dr.A.publish(new Yr.Io({direction:Yr.xL.Left,updateUrl:z}))}),this.bind("t right",()=>{Dr.A.publish(new Yr.Io({direction:Yr.xL.Right,updateUrl:z}))}),this.bind("t c",()=>{Dr.A.publish(new Yr.Bt)}),this.bind("t v",()=>{Dr.A.publish(new Yr.VZ({updateUrl:z}))})}setupDashboardBindings(z){this.bind("mod+o",()=>{z.graphTooltip=(z.graphTooltip+1)%3,z.events.publish(new dl.Tq),z.startRefresh()}),this.bind("mod+s",()=>{z.meta.canSave&&Dr.A.publish(new Yr.S8({component:Bn.$,props:{dashboard:z}}))}),this.setupTimeRangeBindings(),this.bindWithPanelId("e",X=>{if(z.canEditPanelById(X)){const ce=this.locationService.getSearchObject().editPanel!==void 0;this.locationService.partial({editPanel:ce?null:X})}}),this.bindWithPanelId("v",X=>{const ce=this.locationService.getSearchObject().viewPanel!==void 0;this.locationService.partial({viewPanel:ce?null:X})}),this.bindWithPanelId("p l",X=>{const ce=z.getPanelById(X),Ce={...ce.options};Ce.legend.showLegend?Ce.legend.showLegend=!1:Ce.legend.showLegend=!0,ce.updateOptions(Ce)}),this.bindWithPanelId("i",X=>{this.locationService.partial({inspect:X})}),an.TP.hasAccessToExplore()&&this.bindWithPanelId("p x",async X=>{const ce=z.getPanelById(X),Ce=await(0,bn.Xe)({queries:ce.targets,dsRef:ce.datasource,scopedVars:ce.scopedVars,timeRange:(0,li.jG)().timeRange()});if(Ce){const Ae=M.I.stripBaseFromUrl(Ce);Ae&&this.locationService.push(Ae)}}),this.bindWithPanelId("p r",X=>{z.canEditPanelById(X)&&!(z.panelInView||z.panelInEdit)&&Dr.A.publish(new Yr.Vz(X))}),this.bindWithPanelId("p d",X=>{if(z.canEditPanelById(X)){const ce=z.getPanelInfoById(X).index;z.duplicatePanel(z.panels[ce])}}),this.bindWithPanelId("p s",X=>{const ce=z.getPanelInfoById(X);Dr.A.publish(new Yr.S8({component:Fn.ShareModal,props:{dashboard:z,panel:ce?.panel}}))}),this.bind("d l",()=>{z.toggleLegendsForAll()}),this.bind("d x",()=>{z.toggleExemplarsForAll()}),this.bind("d shift+c",()=>{z.collapseRows()}),this.bind("d shift+e",()=>{z.expandRows()}),this.bind("d n",()=>{this.locationService.push("/dashboard/new")}),this.bind("d r",()=>{z.startRefresh()}),this.bind("d s",()=>{this.showDashEditView()}),this.bind("d k",()=>{this.chromeService.onToggleKioskMode()}),this.bind("d a",()=>{const ce=this.locationService.getSearchObject().autofitpanels?"":"&autofitpanels";window.location.href=window.location.href+ce})}}function Rn(F){if(performance)try{performance.mark(`${F}_started`)}catch(z){console.error(`[Metrics] Failed to startMeasure ${F}`,z)}}function Pn(F){if(performance)try{const z=`${F}_started`,X=`${F}_completed`,ce=`${F}_measured`;performance.mark(X);const Ce=performance.measure(ce,z,X);se(`${F}_ms`,Ce.duration),performance.clearMarks(z),performance.clearMarks(X),performance.clearMeasures(ce)}catch(z){console.error(`[Metrics] Failed to stopMeasure ${F}`,z)}}async function ea(){if(window.location.search.indexOf("why-render")!==-1){const{default:F}=await e.e(3718).then(e.t.bind(e,13718,23));F(React,{trackAllPureComponents:!0})}}var jn=e(20120),la=e(57220);const Ya=a.lazy(()=>e.e(192).then(e.bind(e,57029)));function Ea(){const F=(0,or.Wd)(la.hY),z=j.$.unifiedAlertingEnabled||(j.$.featureToggles.alertingPreviewUpgrade??!1);Kt.TP.hasPermission(F.read)&&(0,jn.fP)({show:()=>z,component:({dashboard:X})=>z?a.createElement(a.Suspense,{fallback:null,key:"alert-rules-button"},X&&a.createElement(Ya,{dashboardUid:X.uid})):null,index:-2})}var gs=e(73399);function ya(F){return a.createElement(_a,{...F})}const _a=a.lazy(async()=>{const{EmbeddedDashboard:F}=await e.e(2859).then(e.bind(e,13251));return{default:F}});var ra=e(61582),Hn=e(67027),Wn=e(97527),_n=e(99355),oa=e(14590),Ta=e(19895),Ca=e(44838),Aa=e(67278);const On=()=>new Aa.c(new URL(e.p+e.u(5358),e.b));var zn=e(88483),Qn=e(63720);const Ka=F=>new zn.c(z=>{const X=F.subscribe(oa.BX(ce=>{z.next(ce)}),oa.BX(ce=>{z.error(ce)}),oa.BX(()=>{z.complete()}));return{unsubscribe:()=>{X.then(ce=>ce.unsubscribe())}}}),Ra=F=>(0,Uo.H)(F).pipe((0,Qn.n)(z=>Ka(z)));class ns{constructor(z){this.getConnectionState=()=>Ra(this.centrifugeWorker.getConnectionState()),this.getDataStream=X=>Ra(this.centrifugeWorker.getDataStream(X)).pipe((0,Ta.Q)(Ca.E)),this.getQueryData=async X=>{const ce=JSON.parse(JSON.stringify(X));return this.centrifugeWorker.getQueryData(ce)},this.getPresence=X=>this.centrifugeWorker.getPresence(X),this.getStream=X=>Ra(this.centrifugeWorker.getStream(X)),this.centrifugeWorker=oa.LV(On()),this.centrifugeWorker.initialize(z,oa.BX(z.dataStreamSubscriberReadiness))}}var ja=e(9631),Os=e(55004),Xs=e(47773),no=e(26657),Ks=e(47118);class Jr{constructor(z){this.deps=z,this.getConnectionState=()=>this.deps.centrifugeSrv.getConnectionState(),this.getDataStream=X=>{let ce;const Ce=Ae=>{const Fe=Ae.data[0];if(!ce&&!(0,Ks.ot)(Fe,Ks._w.FullFrame)){console.warn(`expected first packet to contain a full frame, received ${Fe?.type}`);return}switch(Fe.type){case Ks._w.FullFrame:{ce=ja.k9.deserialize(Fe.frame);return}case Ks._w.NewValuesSameSchema:{ce.pushNewValues(Fe.values);return}}};return this.deps.centrifugeSrv.getDataStream(X).pipe((0,Ln.T)(Ae=>(Ce(Ae),{...Ae,data:[ce??ja.k9.empty()]})))},this.getStream=X=>this.deps.centrifugeSrv.getStream(X),this.getQueryData=X=>(0,Uo.H)(this.deps.centrifugeSrv.getQueryData(X)).pipe((0,Qn.n)(ce=>{const Ce=(0,Xs.bE)(ce,X.request.targets);return Ce.data?.length&&Ce.data.find(Fe=>Fe.meta?.channel)?(0,no.x7)(Ce,X.request,no.ph):(0,ba.of)(Ce)})),this.publish=async(X,ce)=>this.deps.backendSrv.post("api/live/publish",{channel:(0,Os.Qp)(X),data:ce}),this.getPresence=X=>this.deps.centrifugeSrv.getPresence(X)}}function Bi(){const F={appUrl:`${window.location.origin}${j.$.appSubUrl}`,orgId:Kt.TP.user.orgId,orgRole:Kt.TP.user.orgRole,liveEnabled:j.$.liveEnabled,dataStreamSubscriberReadiness:ra.a.ok.asObservable(),grafanaAuthToken:(0,Hn.r)()},z=j.$.featureToggles["live-service-web-worker"]?new ns(F):new Wn.w(F);(0,ad.S8)(new Jr({centrifugeSrv:z,backendSrv:(0,T.AI)()}))}function Vl(){return getGrafanaLiveSrv()}var ho=e(17888),Ro=e(20726),ps=e(75462);function nr(F,z="extension is not a link extension"){if(!isPluginExtensionLink(F))throw new Error(z)}function Ui(F,z="extension is not a command extension config"){if(!isPluginExtensionLinkConfig(F))throw new Error(z)}function Vo(F,z){if(!z0(F,z))throw new Error(`Invalid link extension. The "path" is required and should start with "/a/${F}/" (currently: "${z}"). Skipping the extension.`)}function _l(F){if(!Y0(F))throw new Error('Invalid component extension, the "component" property needs to be a valid React component.')}function lc(F){if(!k0(F))throw new Error(`Invalid extension "${F.title}". The extensionPointId should start with either "grafana/" or "plugins/" (currently: "${F.extensionPointId}"). Skipping the extension.`)}function V0(F){if(!H0(F))throw new Error(`Invalid extension "${F.title}". The "configure" property must be a function. Skipping the extension.`)}function o0(F,z){for(const X of z)if(!G0(F[X]))throw new Error(`Invalid extension "${F.title}". Property "${X}" must be a string and cannot be empty. Skipping the extension.`)}function _0(F,z="The provided value is a Promise."){if(i0(F))throw new Error(z)}function z0(F,z){return!!(typeof z=="string"&&z.length>0&&z.startsWith(`/a/${F}/`))}function k0(F){return!!(F.extensionPointId?.startsWith("grafana/")||F.extensionPointId?.startsWith("plugins/"))}function H0(F){return F.configure?typeof F.configure=="function":!0}function G0(F){return typeof F=="string"&&F.length>0}function j0(F,z){try{if(o0(z,["title","description","extensionPointId"]),lc(z),(0,ps.z1)(z)){if(V0(z),!z.path&&!z.onClick)return(0,ps.FF)(`Invalid extension "${z.title}". Either "path" or "onClick" is required.`),!1;z.path&&Vo(F,z.path)}return(0,ps.yS)(z)&&_l(z.component),!0}catch(X){return X instanceof Error&&(0,ps.FF)(X.message),!1}}function i0(F){return F instanceof Promise||typeof F=="object"&&F!==null&&"then"in F&&"catch"in F}function Y0(F){const z=ce=>typeof ce=="object"&&ce!==null&&"$$typeof"in ce;return typeof F=="function"||(ce=>z(ce)&&ce.$$typeof===Symbol.for("react.memo"))(F)}function Q0(F){const z={};for(const{pluginId:X,extensionConfigs:ce,error:Ce}of F){if(Ce){(0,ps.FF)(`"${X}" plugin failed to load, skip registering its extensions.`);continue}for(const Ae of ce){const{extensionPointId:Fe}=Ae;if(!Ae||!j0(X,Ae))continue;let Qe={config:Ae,pluginId:X};Array.isArray(z[Fe])?z[Fe].push(Qe):z[Fe]=[Qe]}}return(0,ps.ol)(z)}var l0=e(29436),J0=e(23994),X0=e(11140),Z0=e(12881);function q0(){try{return[(0,ps.io)({title:"Add to dashboard",description:"Use the query and panel from explore and create/add it to a dashboard",extensionPointId:Bl.S.ExploreToolbarAction,icon:"apps",category:"Dashboards",configure:()=>{if(an.TP.hasPermission(Ut.AccessControlAction.DashboardsCreate)||an.TP.hasPermission(Ut.AccessControlAction.DashboardsWrite))return{}},onClick:(F,{context:z,openModal:X})=>{X({title:(0,Z0.t)(),body:({onDismiss:ce})=>a.createElement(X0.v,{onClose:ce,exploreId:z?.exploreId})})}}),(0,ps.io)({title:"Add correlation",description:"Create a correlation from this query",extensionPointId:Bl.S.ExploreToolbarAction,icon:"link",configure:F=>F?.shouldShowAddCorrelation?{}:void 0,onClick:(F,{context:z})=>{(0,Rs.JD)((0,l0.am)({editorMode:!0})),(0,Rs.JD)((0,J0.Od)({exploreId:z.exploreId}))}})]}catch(F){return(0,ps.FF)(`Could not configure extensions for Explore due to: "${F}"`),[]}}function ev(){return[...q0()]}const tv=({context:F,extensionPointId:z,limitPerPlugin:X,registry:ce})=>{const Ce=F?(0,ps.$Y)(F):{},Ae=ce[z]??[],Fe=[],Qe={};for(const qe of Ae)try{const ut=qe.config,{pluginId:vt}=qe;if(X&&Qe[vt]>=X)continue;if(Qe[vt]===void 0&&(Qe[vt]=0),(0,ps.z1)(ut)){const Ct=nv(vt,ut,Ce);if(ut.configure&&Ct===void 0)continue;const Ht=Ct?.path||ut.path,Nt={id:(0,ps.yt)(vt,ut),type:Bl.u.link,pluginId:vt,onClick:av(vt,ut,Ce),icon:Ct?.icon||ut.icon,title:Ct?.title||ut.title,description:Ct?.description||ut.description,path:(0,p.isString)(Ht)?sv(vt,Ht,ut):void 0,category:Ct?.category||ut.category};Fe.push(Nt),Qe[vt]+=1}if((0,ps.yS)(ut)){_l(ut.component);const Ct={id:(0,ps.yt)(qe.pluginId,ut),type:Bl.u.component,pluginId:qe.pluginId,title:ut.title,description:ut.description,component:(0,ps.nv)(vt,ut.component)};Fe.push(Ct),Qe[vt]+=1}}catch(ut){ut instanceof Error&&(0,ps.FF)(ut.message)}return{extensions:Fe}};function nv(F,z,X){try{const ce=z.configure?.(X);if(ce===void 0)return;let{title:Ce=z.title,description:Ae=z.description,path:Fe=z.path,icon:Qe=z.icon,category:qe=z.category,...ut}=ce;return _0(ce,`The configure() function for "${z.title}" returned a promise, skipping updates.`),Fe&&Vo(F,Fe),o0({title:Ce,description:Ae},["title","description"]),Object.keys(ut).length>0&&(0,ps.FF)(`Extension "${z.title}", is trying to override restricted properties: ${Object.keys(ut).join(", ")} which will be ignored.`),{title:Ce,description:Ae,path:Fe,icon:Qe,category:qe}}catch(ce){ce instanceof Error&&(0,ps.FF)(ce.message);return}}function av(F,z,X){const{onClick:ce}=z;if(ce)return function(Ae){try{(0,yr.rR)("ui_extension_link_clicked",{pluginId:F,extensionPointId:z.extensionPointId,title:z.title,category:z.category});const Fe=ce(Ae,(0,ps.yb)(F,X));i0(Fe)&&Fe.catch(Qe=>{Qe instanceof Error&&(0,ps.FF)(Qe.message)})}catch(Fe){Fe instanceof Error&&(0,ps.FF)(Fe.message)}}}function sv(F,z,X){return fd.kM.appendQueryToUrl(z,fd.kM.toUrlParams({uel_pid:F,uel_epid:X.extensionPointId}))}var c0=e(15162);async function rv(F={}){Rn("frontend_plugins_preload");const z=Object.values(F).filter(ce=>ce.preload),X=await Promise.all(z.map(ov));return Pn("frontend_plugins_preload"),X}async function ov(F){const{path:z,version:X,id:ce}=F;try{Rn(`frontend_plugin_preload_${ce}`);const{plugin:Ce}=await Vr.j4({path:z,version:X,isAngular:F.angular.detected,pluginId:ce}),{extensionConfigs:Ae=[]}=Ce;return(0,Rd.x)(ce),{pluginId:ce,extensionConfigs:Ae}}catch(Ce){return console.error(`[Plugins] Failed to preload plugin: ${z} (version: ${X})`,Ce),{pluginId:ce,extensionConfigs:[],error:Ce}}finally{Pn(`frontend_plugin_preload_${ce}`)}}var iv=e(39741),lv=e(57532),d0=e(41987),u0=e(65879),cv=e(80924),dv=e(72955),qp=e(39374);class uv{constructor(){this.subject=new iv.m(1)}get(){return this.subject.asObservable()}run(z){const{queries:X,timezone:ce,datasource:Ce,panelId:Ae,app:Fe,dashboardUID:Qe,timeRange:qe,timeInfo:ut,cacheTimeout:vt,queryCachingTTL:Ct,maxDataPoints:Ht,scopedVars:Nt,minInterval:At}=z;this.subscription&&this.subscription.unsubscribe();const kt={app:Fe??d0.Jk.Unknown,requestId:(0,cv.S)(),timezone:ce,panelId:Ae,dashboardUID:Qe,range:qe,timeInfo:ut,interval:"",intervalMs:0,targets:(0,p.cloneDeep)(X),maxDataPoints:Ht,scopedVars:Nt||{},cacheTimeout:vt,queryCachingTTL:Ct,startTime:Date.now()};kt.rangeRaw=qe.raw,(0,Uo.H)(mv(Ce,kt.scopedVars)).pipe((0,lv.$)()).subscribe({next:En=>{kt.targets=kt.targets.map(Na=>(Na.datasource||(Na.datasource=En.getRef()),Na));const Ma=At?(0,Re.w)().replace(At,kt.scopedVars):En.interval,$a=u0.calculateInterval(qe,Ht,Ma);kt.scopedVars=Object.assign({},kt.scopedVars,{__interval:{text:$a.interval,value:$a.interval},__interval_ms:{text:$a.intervalMs.toString(),value:$a.intervalMs}}),kt.interval=$a.interval,kt.intervalMs=$a.intervalMs,this.subscription=(0,qp.BN)(En,kt).subscribe({next:Na=>{const Ba=(0,es.N$)(Na,this.lastResult);this.lastResult=(0,dv.B)(Ba,this.lastResult),this.subject.next(this.lastResult)}})},error:En=>console.error("PanelQueryRunner Error",En)})}cancel(){this.subscription&&(this.subscription.unsubscribe(),this.lastResult&&this.lastResult.state===zs.Gu.Loading&&this.subject.next({...this.lastResult,state:zs.Gu.Done}))}destroy(){this.subject&&this.subject.complete(),this.subscription&&this.subscription.unsubscribe()}}async function mv(F,z){return F&&"query"in F?F:(0,c.tR)().get(F,z)}function fv(){window.grafanaRuntime={getDashboardSaveModel:()=>{const F=(0,l.UA)().getCurrent();if(F)return F.getSaveModelCloneOld()},getDashboardTimeRange:()=>{const F=(0,li.jG)().timeRange();return{from:F.from.valueOf(),to:F.to.valueOf(),raw:F.raw}},getPanelData:()=>{const F=(0,l.UA)().getCurrent();if(F)return F.panels.reduce((z,X)=>(z[X.id]=X.getQueryRunner().getLastResult(),z),{})}}}var gv=e(16757),pd=e(20601),xa=e(75096),m0=e(22391),pv=e(27803),Hi=e(3843);function f0(F){return F.extended&&"infoText"in F.extended?F.extended:null}function g0(F){return F.extended&&"dataSourceTypes"in F.extended?F.extended:null}function eh(F){return F.extended&&"dataSource"in F.extended?F.extended:null}var Ts=e(87421),hd=e(26260);const hv=(F,z)=>{const{rootStateKey:X}=z.variable;if(!X)return console.error("AdHocVariableEditor: variable has no rootStateKey"),{extended:f0(Hi.nS)};const{editor:ce}=(0,Ts.nx)(X,F);return{extended:f0(ce)}},vv={changeVariableDatasource:hd.Iv},Ev=(0,go.connect)(hv,vv);class yv extends a.PureComponent{constructor(){super(...arguments),this.onDatasourceChanged=z=>{this.props.changeVariableDatasource((0,xa.jX)(this.props.variable),(0,m0.p$)(z))}}componentDidMount(){const{rootStateKey:z}=this.props.variable;if(!z){console.error("AdHocVariableEditor: variable has no rootStateKey");return}}render(){const{variable:z,extended:X}=this.props;return a.createElement(pv.Q,{datasource:z.datasource??void 0,onDataSourceChange:this.onDatasourceChanged,infoText:X?.infoText})}}const Dv=Ev(yv);var p0=e(38401),th=e(83684);const h0=90,v0=({datasource:F,onChange:z,disabled:X,filterKey:ce,allFilters:Ce})=>{const Ae=()=>E0(F,ce,Ce),Fe=()=>bv(F,ce,Ce);return ce===null?a.createElement("div",{className:"gf-form","data-testid":"AdHocFilterKey-add-key-wrapper"},a.createElement(th.s,{disabled:X,className:"query-segment-key",Component:Cv,value:ce,onChange:z,loadOptions:Ae,inputMinWidth:h0})):a.createElement("div",{className:"gf-form","data-testid":"AdHocFilterKey-key-wrapper"},a.createElement(th.s,{disabled:X,className:"query-segment-key",value:ce,onChange:z,loadOptions:Fe,inputMinWidth:h0}))},im="-- remove filter --",Pv={label:im,value:im},Cv=a.createElement("span",{className:"gf-form-label query-part","aria-label":"Add Filter"},a.createElement(hs.I,{name:"plus"})),E0=async(F,z,X)=>{const ce=await(0,c.tR)().get(F);if(!ce||!ce.getTagKeys)return[];const Ce=X.filter(Fe=>Fe.key!==z);return(await ce.getTagKeys({filters:Ce})).map(Fe=>({label:Fe.text,value:Fe.text}))},bv=async(F,z,X)=>{const ce=await E0(F,z,X);return[Pv,...ce]},Tv=({datasource:F,disabled:z,onChange:X,filterKey:ce,filterValue:Ce,placeHolder:Ae,allFilters:Fe})=>{const Qe=()=>Mv(F,ce,Fe);return a.createElement("div",{className:"gf-form","data-testid":"AdHocFilterValue-value-wrapper"},a.createElement(th.s,{className:"query-segment-value",disabled:z,placeholder:Ae,value:Ce,onChange:X,loadOptions:Qe}))},Mv=async(F,z,X)=>{const ce=await(0,c.tR)().get(F);if(!ce||!ce.getTagValues)return[];const Ce=(0,li.jG)().timeRange(),Ae=X.filter(Qe=>Qe.key!==z);return(await ce.getTagValues({key:z,filters:Ae,timeRange:Ce})).map(Qe=>({label:Qe.text,value:Qe.text}))},Sv=["=","!=","<",">","=~","!~"].map(F=>({label:F,value:F})),xv=({value:F,disabled:z,onChange:X})=>a.createElement(p0.Y,{className:"query-segment-operator",value:F,disabled:z,options:Sv,onChange:X}),y0=({datasource:F,filter:{key:z,operator:X,value:ce},onKeyChange:Ce,onOperatorChange:Ae,onValueChange:Fe,placeHolder:Qe,allFilters:qe,disabled:ut})=>a.createElement(a.Fragment,null,a.createElement(v0,{disabled:ut,datasource:F,filterKey:z,onChange:Ce,allFilters:qe}),a.createElement("div",{className:"gf-form"},a.createElement(xv,{disabled:ut,value:X,onChange:Ae})),a.createElement(Tv,{disabled:ut,datasource:F,filterKey:z,filterValue:ce,allFilters:qe,onChange:Fe,placeHolder:Qe})),Ov=({datasource:F,appendBefore:z,onCompleted:X,allFilters:ce})=>{const[Ce,Ae]=(0,a.useState)(null),[Fe,Qe]=(0,a.useState)("="),qe=(0,a.useCallback)(Ct=>{if(Ct.value!==im){Ae(Ct.value??"");return}Ae(null)},[Ae]),ut=(0,a.useCallback)(Ct=>Qe(Ct.value??""),[Qe]),vt=(0,a.useCallback)(Ct=>{X({value:Ct.value??"",operator:Fe,key:Ce}),Ae(null),Qe("=")},[X,Fe,Ce]);return Ce===null?a.createElement(v0,{datasource:F,filterKey:Ce,onChange:qe,allFilters:ce}):a.createElement(a.Fragment,{key:"filter-builder"},z,a.createElement(y0,{datasource:F,filter:{key:Ce,value:"",operator:Fe},placeHolder:(0,Ga.t)("variable.adhoc.placeholder","Select value"),onKeyChange:qe,onOperatorChange:ut,onValueChange:vt,allFilters:ce}))},D0=({label:F})=>a.createElement("div",{className:"gf-form"},a.createElement("span",{className:"gf-form-label query-keyword"},F));class Iv extends a.PureComponent{constructor(){super(...arguments),this.onChange=(z,X)=>ce=>{const{filters:Ce}=this.props,{value:Ae}=ce;return ce.value===im?this.props.removeFilter(z):this.props.changeFilter(z,{...Ce[z],[X]:Ae})},this.appendFilterToVariable=z=>{this.props.addFilter(z)}}render(){const{filters:z,disabled:X}=this.props;return a.createElement("div",{className:"gf-form-inline"},this.renderFilters(z,X),!X&&a.createElement(Ov,{datasource:this.props.datasource,appendBefore:z.length>0?a.createElement(D0,{label:"AND"}):null,onCompleted:this.appendFilterToVariable,allFilters:this.getAllFilters()}))}getAllFilters(){return this.props.baseFilters?this.props.baseFilters.concat(this.props.filters):this.props.filters}renderFilters(z,X){return z.length===0&&X?a.createElement(p0.Y,{disabled:X,value:"No filters",options:[],onChange:()=>{}}):z.reduce((ce,Ce,Ae)=>(ce.length>0&&ce.push(a.createElement(D0,{label:"AND",key:`condition-${Ae}`})),ce.push(this.renderFilterSegments(Ce,Ae,X)),ce),[])}renderFilterSegments(z,X,ce){return a.createElement(a.Fragment,{key:`filter-${X}`},a.createElement(y0,{disabled:ce,datasource:this.props.datasource,filter:z,onKeyChange:this.onChange(X,"key"),onOperatorChange:this.onChange(X,"operator"),onValueChange:this.onChange(X,"value"),allFilters:this.getAllFilters()}))}}const Av={addFilter:hd.U2,removeFilter:hd.VT,changeFilter:hd.$u},Rv=(0,go.connect)(null,Av);class Lv extends a.PureComponent{constructor(){super(...arguments),this.addFilter=z=>{this.props.addFilter((0,xa.jX)(this.props.variable),z)},this.removeFilter=z=>{this.props.removeFilter((0,xa.jX)(this.props.variable),z)},this.changeFilter=(z,X)=>{this.props.changeFilter((0,xa.jX)(this.props.variable),{index:z,filter:X})}}render(){const{filters:z,datasource:X,baseFilters:ce}=this.props.variable;return a.createElement(Iv,{datasource:X,filters:z,baseFilters:ce,disabled:this.props.readOnly,addFilter:this.addFilter,removeFilter:this.removeFilter,changeFilter:this.changeFilter})}}const P0=Rv(Lv);P0.displayName="AdHocPicker";var C0=e(53699);const Bv=F=>F.map(z=>Fv(z).map(Nv).join("|")),Uv=F=>{if((0,p.isArray)(F))return F.map(b0).filter(Wv);const z=b0(F);return z===null?[]:[z]};function Nv(F){return F==null?"":/\|/g[Symbol.replace](F,"__gfp__")}function wv(F){return F==null?"":/__gfp__/g[Symbol.replace](F,"|")}function Fv(F){return[F.key,F.operator,F.value]}function b0(F){if(!(0,p.isString)(F)||F.length===0)return null;const z=F.split("|").map(wv);return{key:z[0],operator:z[1],value:z[2]}}function Wv(F){return F!==null&&(0,p.isString)(F.value)}const T0=async()=>{},Kv=()=>({id:"adhoc",description:"Add key/value filters on the fly.",name:"Ad hoc filters",initialState:C0.MK,reducer:C0.AA,picker:P0,editor:Dv,dependsOn:()=>!1,setValue:T0,setValueFromUrl:async(F,z)=>{const X=Uv(z);await(0,Rs.JD)((0,hd.D4)((0,xa.jX)(F),X))},updateOptions:T0,getSaveModel:F=>{const{index:z,id:X,state:ce,global:Ce,rootStateKey:Ae,...Fe}=(0,p.cloneDeep)(F);return Fe},getValueForUrl:F=>{const z=F?.filters??[];return Bv(z)}});var M0=e(82960),$v=e(8866),ao=e(13344),Xr=e(24240),nh=e(13752),S0=e(13288),Vv=e(44240),lm=e(16126),_v=e(38975),zv=e(67791),kv=e(66847),Hv=e(69850),Gv=e(62938),Or=e(72401),Us=e(48594),vd=e(83370),_o=e(80484);const jv={..._o.Vg,type:"query",datasource:null,query:"",regex:"",sort:_o.ZG.disabled,refresh:_o.CO.onDashboardLoad,multi:!1,includeAll:!1,allValue:null,options:[],current:{},definition:""},Yv=(F,z)=>{if(z===_o.ZG.disabled)return F;const X=Math.ceil(z/2),ce=z%2===0;return X===1?F=(0,p.sortBy)(F,"text"):X===2?F=(0,p.sortBy)(F,Ce=>{if(!Ce.text)return-1;const Ae=Ce.text.match(/.*?(\d+).*/);return!Ae||Ae.length<2?-1:parseInt(Ae[1],10)}):X===3?F=(0,p.sortBy)(F,Ce=>(0,p.toLower)(Ce.text)):X===4&&F.sort((Ce,Ae)=>Ce.text?Ae.text?Ce.text.localeCompare(Ae.text,void 0,{numeric:!0}):1:-1),ce&&(F=F.reverse()),F},Qv=(F,z)=>{const X=[];let ce=null;z.lastIndex=0;do ce=z.exec(F),ce&&X.push(ce);while(z.global&&ce&&ce[0]!==""&&ce[0]!==void 0);return X},Jv=(F,z,X)=>{let ce,Ce=[];F&&(ce=(0,Yn.dO)(F));for(let Ae=0;Ae<X.length;Ae++){const Fe=X[Ae];let Qe=Fe.text===void 0||Fe.text===null?Fe.value:Fe.text,qe=Fe.value===void 0||Fe.value===null?Fe.text:Fe.value;if((0,p.isNumber)(qe)&&(qe=qe.toString()),(0,p.isNumber)(Qe)&&(Qe=Qe.toString()),ce){const ut=Qv(qe,ce);if(!ut.length)continue;const vt=ut.find(At=>At.groups&&At.groups.value),Ct=ut.find(At=>At.groups&&At.groups.text),Ht=ut.find(At=>At.length>1),Nt=ut.length>1&&Ht;if(vt||Ct)qe=vt?.groups?.value??Ct?.groups?.text,Qe=Ct?.groups?.text??vt?.groups?.value;else if(Nt){for(let At=0;At<ut.length;At++){const kt=ut[At];Ce.push({text:kt[1],value:kt[1],selected:!1})}continue}else Ht&&(Qe=Ht[1],qe=Ht[1])}Ce.push({text:Qe,value:qe,selected:!1})}return Ce=(0,p.uniqBy)(Ce,"value"),Yv(Ce,z)},x0=(0,Mi.Z0)({name:"templating/query",initialState:vd.j,reducers:{updateVariableOptions:(F,z)=>{const{results:X,templatedRegex:ce}=z.payload.data,Ce=(0,Ts.Fs)(F,z.payload.id);if(Ce.type!=="query")return;const{includeAll:Ae,sort:Fe}=Ce,Qe=Jv(ce,Fe,X);Ae&&Qe.unshift({text:ao.Zm,value:ao.To,selected:!1}),Qe.length||Qe.push({text:ao.ou,value:ao.Ek,isNone:!0,selected:!1}),Ce.options=Qe}}}),Xv=x0.reducer,{updateVariableOptions:Zv}=x0.actions;function qv(){return F=>F.pipe((0,Ln.T)(eE))}function eE(F){const z=F.series;if(!z||!z.length)return[];if(aE(z))return z;const X=(0,es.Bt)(z),ce=[];let Ce=-1,Ae=-1,Fe=-1,Qe=-1;for(const qe of X)for(let ut=0;ut<qe.fields.length;ut++){const vt=qe.fields[ut],Ct=(0,re.Ct)(vt,qe,z).toLowerCase();vt.type===k.PU.string&&Fe===-1&&(Fe=ut),Ct==="text"&&vt.type===k.PU.string&&Ae===-1&&(Ae=ut),Ct==="value"&&vt.type===k.PU.string&&Ce===-1&&(Ce=ut),Ct==="expandable"&&(vt.type===k.PU.boolean||vt.type===k.PU.number)&&Qe===-1&&(Qe=ut)}if(Fe===-1)throw new Error("Couldn't find any field of type string in the results.");for(const qe of X)for(let ut=0;ut<qe.length;ut++){const vt=Qe!==-1?qe.fields[Qe].values[ut]:void 0,Ct=qe.fields[Fe].values[ut],Ht=Ae!==-1?qe.fields[Ae].values[ut]:null,Nt=Ce!==-1?qe.fields[Ce].values[ut]:null;if(Ce===-1&&Ae===-1){ce.push({text:Ct,value:Ct,expandable:vt});continue}if(Ce===-1&&Ae!==-1){ce.push({text:Ht,value:Ht,expandable:vt});continue}if(Ce!==-1&&Ae===-1){ce.push({text:Nt,value:Nt,expandable:vt});continue}ce.push({text:Ht,value:Nt,expandable:vt})}return ce}function tE(F){return z=>z.pipe((0,Ln.T)(X=>{const{variable:ce,dispatch:Ce,getTemplatedRegexFunc:Ae}=F;if(!ce.rootStateKey){console.error("updateOptionsState: variable.rootStateKey is not defined");return}const Fe=Ae(ce),Qe=(0,xa.qD)(ce,{results:X,templatedRegex:Fe});Ce((0,Us.kb)(ce.rootStateKey,Zv(Qe)))}))}function nE(F){return z=>z.pipe((0,ri.Z)(()=>{const{dispatch:X,variable:ce,searchFilter:Ce}=F;return Ce?(0,ba.of)():(0,Uo.H)(X((0,Or.kl)((0,xa.jX)(ce))))}))}function aE(F){if(!F)return!1;if(!F.length)return!0;const z=F[0];if((0,es.ci)(z))return!1;for(const X in z){if(!z.hasOwnProperty(X)||z[X]!==null&&typeof z[X]!="string"&&typeof z[X]!="number")continue;const ce=X.toLowerCase();if(ce==="text"||ce==="value")return!0}return!1}var cm=e(29505),sE=e(43127);class rE{constructor(){this.runners=[new oE,new iE,new lE,new dE]}getRunnerForDatasource(z){const X=this.runners.find(ce=>ce.canRun(z));if(X)return X;throw new Error("Couldn't find a query runner that matches supplied arguments.")}}class oE{constructor(){this.type=cm.Qz.Legacy}canRun(z){return(0,Xr.d5)(z)}getTarget({datasource:z,variable:X}){if((0,Xr.d5)(z))return X.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest({datasource:z,variable:X,searchFilter:ce,timeSrv:Ce},Ae){if(!(0,Xr.d5)(z))return Ed();const Fe=(0,xa.iP)(X,ce,Ce,Ae.scopedVars);return(0,Uo.H)(z.metricFindQuery(X.query,Fe)).pipe((0,ri.Z)(Qe=>{if(!Qe||!Qe.length)return Ed();const qe=Qe;return(0,ba.of)({series:qe,state:zs.Gu.Done,timeRange:Fe.range})}))}}class iE{constructor(){this.type=cm.Qz.Standard}canRun(z){return(0,Xr.Hf)(z)}getTarget({datasource:z,variable:X}){if((0,Xr.Hf)(z))return z.variables.toDataQuery(X.query);throw new Error("Couldn't create a target with supplied arguments.")}runRequest({datasource:z,runRequest:X},ce){return(0,Xr.Hf)(z)?z.variables.query?X(z,ce,z.variables.query.bind(z.variables)):X(z,ce):Ed()}}class lE{constructor(){this.type=cm.Qz.Custom}canRun(z){return(0,Xr.zs)(z)}getTarget({datasource:z,variable:X}){if((0,Xr.zs)(z))return X.query;throw new Error("Couldn't create a target with supplied arguments.")}runRequest({datasource:z,runRequest:X},ce){return(0,Xr.zs)(z)?X(z,ce,z.variables.query.bind(z.variables)):Ed()}}const cE="variable-query";class dE{constructor(){this.type=cm.Qz.Datasource}canRun(z){return(0,Xr.X3)(z)}getTarget({datasource:z,variable:X}){if((0,Xr.X3)(z))return{...X.query,refId:X.query.refId??cE};throw new Error("Couldn't create a target with supplied arguments.")}runRequest({datasource:z,runRequest:X},ce){return(0,Xr.X3)(z)?X(z,ce):Ed()}}function Ed(){return(0,ba.of)({state:zs.Gu.Done,series:[],timeRange:(0,sE.E2)()})}class uE{constructor(z={dispatch:Rs.JD,getState:Rs.Gu,getVariable:Ts.dn,getTemplatedRegex:xa.u7,getTimeSrv:li.jG,queryRunners:new rE,runRequest:qp.BN}){this.dependencies=z,this.updateOptionsRequests=new nh.B,this.updateOptionsResults=new nh.B,this.cancelRequests=new nh.B,this.onNewRequest=this.onNewRequest.bind(this),this.subscription=this.updateOptionsRequests.subscribe(this.onNewRequest)}queueRequest(z){this.updateOptionsRequests.next(z)}getResponse(z){return this.updateOptionsResults.asObservable().pipe((0,lm.p)(X=>X.identifier===z))}cancelRequest(z){this.cancelRequests.next({identifier:z})}destroy(){this.subscription.unsubscribe()}onNewRequest(z){const{datasource:X,identifier:ce,searchFilter:Ce}=z;try{const{dispatch:Ae,runRequest:Fe,getTemplatedRegex:Qe,getVariable:qe,queryRunners:ut,getTimeSrv:vt,getState:Ct}=this.dependencies,Ht=(0,Ts.y7)(Ct());this.updateOptionsResults.next({identifier:ce,state:zs.Gu.Loading});const Nt=qe(ce,Ct());if(Nt.type!=="query")return;const At=vt(),kt={variable:Nt,datasource:X,searchFilter:Ce,timeSrv:At,runRequest:Fe},En=ut.getRunnerForDatasource(X),Ma=En.getTarget({datasource:X,variable:Nt}),$a=this.getRequest(Nt,z,Ma);En.runRequest(kt,$a).pipe((0,lm.p)(()=>{const Na=(0,Ts.y7)(Ct());return Ht===Na}),(0,lm.p)(Na=>Na.state===zs.Gu.Done||Na.state===zs.Gu.Error),(0,_v.s)(1),(0,ri.Z)(Na=>Na.state===zs.Gu.Error?(0,S0.$)(()=>Na.error):(0,ba.of)(Na)),qv(),tE({variable:Nt,dispatch:Ae,getTemplatedRegexFunc:Qe}),nE({variable:Nt,dispatch:Ae,searchFilter:Ce}),(0,zv.Q)((0,Vv.h)(this.updateOptionsRequests,this.cancelRequests).pipe((0,lm.p)(Na=>{let Ba=!1;return Na.identifier.id===ce.id&&(Ba=!0,this.updateOptionsResults.next({identifier:ce,state:zs.Gu.Loading,cancelled:Ba})),Ba}))),(0,kv.W)(Na=>Na.cancelled?(0,ba.of)({}):(this.updateOptionsResults.next({identifier:ce,state:zs.Gu.Error,error:Na}),(0,S0.$)(()=>Na))),(0,Hv.j)(()=>{this.updateOptionsResults.next({identifier:ce,state:zs.Gu.Done})})).subscribe()}catch(Ae){this.updateOptionsResults.next({identifier:ce,state:zs.Gu.Error,error:Ae})}}getRequest(z,X,ce){const{searchFilter:Ce}=X,Ae={variable:{text:z.current.text,value:z.current.value}},qe={...Ce?{searchFilter:{text:Ce,value:Ce}}:{},...Ae},ut=this.dependencies.getTimeSrv().timeRange();return{app:d0.Jk.Dashboard,requestId:(0,Gv.A)(),timezone:"",range:ut,interval:"",intervalMs:0,targets:[ce],scopedVars:qe,startTime:Date.now()}}}let O0;function mE(F){O0=F}function ah(){return O0}const fE=F=>{if(!gE(F))return F.name;const{current:z}=F;return Array.isArray(z.text)?z.text.join(" + "):z.text},gE=F=>Array.isArray(F?.options)||typeof F?.current=="object";var vl=(F=>(F[F.moveUp=38]="moveUp",F[F.moveDown=40]="moveDown",F[F.select=32]="select",F[F.cancel=27]="cancel",F[F.selectAndClose=13]="selectAndClose",F))(vl||{});class pE extends a.PureComponent{constructor(){super(...arguments),this.onKeyDown=z=>{if(vl[z.keyCode]&&z.keyCode!==vl.select){const X=z.ctrlKey||z.metaKey||z.shiftKey;this.props.onNavigate(z.keyCode,X),z.preventDefault()}},this.onChange=z=>{this.props.onChange(z.target.value)}}render(){const{value:z,id:X,onNavigate:ce,...Ce}=this.props;return a.createElement("input",{...Ce,ref:Ae=>{Ae&&(Ae.focus(),Ae.setAttribute("style",`width:${Math.max(Ae.width,150)}px`))},type:"text",className:"gf-form-input",value:z??"",onChange:this.onChange,onKeyDown:this.onKeyDown,placeholder:(0,Ga.t)("variable.dropdown.placeholder","Enter variable value")})}}var hE=e(89963);const vE=({loading:F,disabled:z,onClick:X,text:ce,onCancel:Ce,id:Ae})=>{const Fe=(0,It.of)(A0),Qe=(0,a.useCallback)(qe=>{qe.stopPropagation(),qe.preventDefault(),X()},[X]);return F?a.createElement("div",{className:Fe.container,"data-testid":Tr.Tp.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${ce}`),title:ce,id:Ae},a.createElement(I0,{text:ce}),a.createElement(hE.I,{loading:!0,onCancel:Ce})):a.createElement("button",{onClick:Qe,className:Fe.container,"data-testid":Tr.Tp.pages.Dashboard.SubMenu.submenuItemValueDropDownValueLinkTexts(`${ce}`),"aria-expanded":!1,"aria-controls":`options-${Ae}`,id:Ae,title:ce,disabled:z},a.createElement(I0,{text:ce}),a.createElement(hs.I,{"aria-hidden":!0,name:"angle-down",size:"sm"}))},I0=({text:F})=>{const z=(0,It.of)(A0);return a.createElement("span",{className:z.textAndTags},F===ao.Zm?(0,Ga.t)("variable.picker.link-all","All"):F)},A0=F=>({container:(0,rt.css)` max-width: 500px; padding-right: 10px; padding: 0 ${F.spacing(1)}; background-color: ${F.components.input.background}; border: 1px solid ${F.components.input.borderColor}; border-radius: ${F.shape.radius.default}; display: flex; align-items: center; color: ${F.colors.text}; height: ${F.spacing(F.components.height.md)}; .label-tag { margin: 0 5px; } &:disabled { background-color: ${F.colors.action.disabledBackground}; color: ${F.colors.action.disabledText}; border: 1px solid ${F.colors.action.disabledBackground}; } `,textAndTags:(0,rt.css)` overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: ${F.spacing(.25)}; user-select: none; `});class EE extends a.PureComponent{constructor(){super(...arguments),this.onToggle=z=>X=>{const ce=X.shiftKey||X.ctrlKey||X.metaKey;this.handleEvent(X),this.props.onToggle(z,ce)},this.onToggleAll=z=>{this.handleEvent(z),this.props.onToggleAll()}}handleEvent(z){z.preventDefault(),z.stopPropagation()}render(){const{multi:z,values:X,highlightIndex:ce,selectedValues:Ce,onToggle:Ae,onToggleAll:Fe,theme:Qe,...qe}=this.props,ut=sh(Qe);return a.createElement("div",{className:ut.variableValueDropdown},a.createElement("div",{className:ut.variableOptionsWrapper},a.createElement("ul",{className:ut.variableOptionsColumn,"aria-label":Tr.Tp.pages.Dashboard.SubMenu.submenuItemValueDropDownDropDown,...qe},this.renderMultiToggle(),X.map((vt,Ct)=>this.renderOption(vt,Ct)))))}renderOption(z,X){const{highlightIndex:ce,multi:Ce,theme:Ae}=this.props,Fe=sh(Ae),Qe=z.value===ao.To;return a.createElement("li",{key:`${z.value}`},a.createElement("button",{"data-testid":Tr.Tp.components.Variables.variableOption,role:"checkbox",type:"button","aria-checked":z.selected,className:(0,rt.cx)((0,ie.my)(Ae),Fe.variableOption,{[Fe.highlighted]:X===ce,[Fe.variableAllOption]:Qe},Fe.noStyledButton),onClick:this.onToggle(z)},a.createElement("span",{className:(0,rt.cx)(Fe.variableOptionIcon,{[Fe.variableOptionIconSelected]:z.selected,[Fe.hideVariableOptionIcon]:!Ce})}),a.createElement("span",{"data-testid":Tr.Tp.pages.Dashboard.SubMenu.submenuItemValueDropDownOptionTexts(`${z.text}`)},Qe?(0,Ga.t)("variable.picker.option-all","All"):z.text)))}renderMultiToggle(){const{multi:z,selectedValues:X,theme:ce,values:Ce}=this.props,Ae=sh(ce),Fe=Ce.some(qe=>qe.value===ao.To);if(!z)return null;const Qe=()=>a.createElement(Ga.x6,{i18nKey:"variable.picker.option-tooltip"},"Clear selections");return a.createElement(ms.m,{content:Qe,placement:"top"},a.createElement("button",{className:(0,rt.cx)((0,ie.my)(ce),Ae.variableOption,Ae.variableOptionColumnHeader,Ae.noStyledButton,{[Ae.noPaddingBotton]:Fe}),role:"checkbox","aria-checked":X.length>1?"mixed":"false",onClick:this.onToggleAll,"aria-label":"Toggle all values","data-placement":"top"},a.createElement("span",{className:(0,rt.cx)(Ae.variableOptionIcon,{[Ae.variableOptionIconManySelected]:X.length>1})}),a.createElement(Ga.x6,{i18nKey:"variable.picker.option-selected-values"},"Selected")," (",X.length,")"))}}const sh=(0,Wa.N)(F=>{const z=F.isDark?"public/img/checkbox.png":"public/img/checkbox_white.png";return{hideVariableOptionIcon:(0,rt.css)({display:"none"}),highlighted:(0,rt.css)({backgroundColor:F.colors.action.hover}),noStyledButton:(0,rt.css)({width:"100%",textAlign:"left"}),variableOption:(0,rt.css)({display:"block",padding:"2px 27px 0 8px",position:"relative",whiteSpace:"nowrap",minWidth:"115px",["&:hover"]:{backgroundColor:F.colors.action.hover}}),variableOptionColumnHeader:(0,rt.css)({paddingTop:"5px",paddingBottom:"5px",marginBottom:"5px"}),variableOptionIcon:(0,rt.css)({display:"inline-block",width:"24px",height:"18px",position:"relative",top:"4px",background:`url(${z}) left top no-repeat`}),variableOptionIconManySelected:(0,rt.css)({background:`url(${z}) 0px -36px no-repeat`}),variableOptionIconSelected:(0,rt.css)({background:`url(${z}) 0px -18px no-repeat`}),variableValueDropdown:(0,rt.css)({backgroundColor:F.colors.background.primary,border:`1px solid ${F.colors.border.weak}`,borderRadius:F.shape.borderRadius(2),boxShadow:F.shadows.z2,position:"absolute",top:F.spacing(F.components.height.md),maxHeight:"400px",minHeight:"150px",minWidth:"150px",overflowY:"auto",overflowX:"hidden",zIndex:F.zIndex.typeahead}),variableOptionsColumn:(0,rt.css)({maxHeight:"350px",display:"table-cell",lineHeight:"26px",listStyleType:"none"}),variableOptionsWrapper:(0,rt.css)({display:"table",width:"100%"}),variableAllOption:(0,rt.css)({borderBottom:`1px solid ${F.colors.border.weak}`,paddingBottom:F.spacing(1)}),noPaddingBotton:(0,rt.css)({paddingBottom:0})}}),yE=(0,It.cV)(EE);var DE=e(92053),R0=e(92041),El=e(56968),gi=e(24300);const PE=(F,z,X)=>async(ce,Ce)=>{if(z===vl.cancel)return await ce(dm(F));if(z===vl.select)return ce(rh(F,X));if(z===vl.selectAndClose)return(0,Ts.nx)(F,Ce()).optionsPicker.multi?ce(rh(F,X)):(ce(rh(F,X,!0)),ce(dm(F)));if(z===vl.moveDown)return ce((0,Us.kb)(F,(0,gi.O$)(1)));if(z===vl.moveUp)return ce((0,Us.kb)(F,(0,gi.O$)(-1)))},CE=(F,z="")=>async(X,ce)=>{const{rootStateKey:Ce}=F,{id:Ae,queryValue:Fe}=(0,Ts.nx)(Ce,ce()).optionsPicker,Qe={id:Ae,rootStateKey:Ce,type:"query"},qe=(0,Ts.dn)(Qe,ce());if(!("options"in qe)||(X((0,Us.kb)(Ce,(0,gi.S8)(z))),(0,p.trim)(Fe)===(0,p.trim)(z)))return;const{query:ut,options:vt}=qe,Ct=typeof ut=="string"?ut:ut.target;return(0,DE.E)(Ct)?SE(X,ce,z,Ce):X((0,Us.kb)(Ce,(0,gi.fx)(vt)))},bE=async F=>{if((0,R0.R)(F.current))return;await pd.B.get(F.type).setValue(F,F.current,!0)},dm=(F,z)=>async(X,ce)=>{const Ce=(0,Ts.nx)(F,ce()).optionsPicker,Ae={id:Ce.id,rootStateKey:F,type:"query"},Fe=(0,Ts.dn)(Ae,ce());if(!(0,Xr.SP)(Fe))return;const Qe={option:xE(Ce)},qe={propName:"queryValue",propValue:Ce.queryValue};X((0,Us.kb)(F,(0,El.dE)((0,xa.qD)(Fe,Qe)))),X((0,Us.kb)(F,(0,El.QP)((0,xa.qD)(Fe,qe))));const ut=(0,Ts.dn)(Ae,ce());if((0,Xr.SP)(ut)&&(X((0,Us.kb)(F,(0,gi.Fu)())),(0,xa.Lz)(Fe)!==(0,xa.Lz)(ut)))return z?z(ut):await bE(ut)},TE=(F,z)=>async(X,ce)=>{const{id:Ce,rootStateKey:Ae}=F,Fe=(0,Ts.nx)(Ae,ce()).optionsPicker;Fe.id&&Fe.id!==Ce&&await X(dm(Ae,z));const Qe=(0,Ts.dn)(F,ce());(0,Xr.SP)(Qe)&&X((0,Us.kb)(Ae,(0,gi.MO)(Qe)))},rh=(F,z,X=!1)=>(ce,Ce)=>{const{highlightIndex:Ae,options:Fe}=(0,Ts.nx)(F,Ce()).optionsPicker,Qe=Fe[Ae];ce((0,Us.kb)(F,(0,gi.U9)({option:Qe,forceSelect:X,clearOthers:z})))},ME=async(F,z,X,ce)=>{try{const{id:Ce}=(0,Ts.nx)(ce,z()).optionsPicker,Ae={id:Ce,rootStateKey:ce,type:"query"},Fe=(0,Ts.dn)(Ae,z());if(!(0,Xr.SP)(Fe))return;await pd.B.get(Fe.type).updateOptions(Fe,X);const qe=(0,Ts.dn)(Ae,z());if(!(0,Xr.SP)(qe))return;F((0,Us.kb)(ce,(0,gi.qh)(qe.options)))}catch(Ce){console.error(Ce)}},SE=(0,p.debounce)(ME,500);function xE(F){const{options:z,selectedValues:X,queryValue:ce,multi:Ce}=F;if(z.length===0&&ce&&ce.length>0)return{text:ce,value:ce,selected:!1};if(!Ce)return X.find(Qe=>Qe.selected);const Ae=[],Fe=[];for(const Qe of X)Qe.selected&&(Ae.push(Qe.text.toString()),Fe.push(Qe.value.toString()));return{value:Fe,text:Ae,selected:!0}}const yd=()=>{const F=Ae=>({...(0,M0.bindActionCreators)({openOptions:TE,commitChangesToVariable:dm,navigateOptions:PE},Ae),filterOrSearchOptions:(Fe,Qe="")=>{Ae(CE(Fe,Qe))},toggleAllOptions:Fe=>Ae((0,Us.kb)(Fe.rootStateKey,(0,gi.an)())),toggleOption:(Fe,Qe,qe,ut)=>Ae((0,Us.kb)(Fe.rootStateKey,(0,gi.U9)({option:Qe,clearOthers:qe,forceSelect:ut})))}),z=(Ae,Fe)=>{const{rootStateKey:Qe}=Fe.variable;return Qe?{picker:(0,Ts.nx)(Qe,Ae).optionsPicker}:(console.error("OptionPickerFactory: variable has no rootStateKey"),{picker:gi.$z})},X=(0,go.connect)(z,F);class ce extends a.PureComponent{constructor(){super(...arguments),this.onShowOptions=()=>this.props.openOptions((0,xa.jX)(this.props.variable),this.props.onVariableChange),this.onHideOptions=()=>{if(!this.props.variable.rootStateKey){console.error("Variable has no rootStateKey");return}this.props.commitChangesToVariable(this.props.variable.rootStateKey,this.props.onVariableChange)},this.onToggleOption=(Fe,Qe)=>{((0,Xr.iv)(this.props.variable)&&this.props.variable.multi?this.onToggleMultiValueVariable:this.onToggleSingleValueVariable)(Fe,Qe)},this.onToggleSingleValueVariable=(Fe,Qe)=>{this.props.toggleOption((0,xa.jX)(this.props.variable),Fe,Qe,!1),this.onHideOptions()},this.onToggleMultiValueVariable=(Fe,Qe)=>{this.props.toggleOption((0,xa.jX)(this.props.variable),Fe,Qe,!1)},this.onToggleAllOptions=()=>{this.props.toggleAllOptions((0,xa.jX)(this.props.variable))},this.onFilterOrSearchOptions=Fe=>{this.props.filterOrSearchOptions((0,xa.jX)(this.props.variable),Fe)},this.onNavigate=(Fe,Qe)=>{if(!this.props.variable.rootStateKey){console.error("Variable has no rootStateKey");return}this.props.navigateOptions(this.props.variable.rootStateKey,Fe,Qe)},this.onCancel=()=>{ah().cancelRequest((0,xa.jX)(this.props.variable))}}render(){const{variable:Fe,picker:Qe}=this.props,qe=Qe.id===Fe.id;return a.createElement("div",{className:"variable-link-wrapper"},qe?this.renderOptions(Qe):this.renderLink(Fe))}renderLink(Fe){const Qe=fE(Fe),qe=Fe.state===zs.Gu.Loading;return a.createElement(vE,{id:ao.qz+Fe.id,text:Qe,onClick:this.onShowOptions,loading:qe,onCancel:this.onCancel,disabled:this.props.readOnly})}renderOptions(Fe){const{id:Qe}=this.props.variable;return a.createElement($v.N,{onClick:this.onHideOptions},a.createElement(pE,{id:ao.qz+Qe,value:Fe.queryValue,onChange:this.onFilterOrSearchOptions,onNavigate:this.onNavigate,"aria-expanded":!0,"aria-controls":`options-${Qe}`}),a.createElement(yE,{values:Fe.options,onToggle:this.onToggleOption,onToggleAll:this.onToggleAllOptions,highlightIndex:Fe.highlightIndex,multi:Fe.multi,selectedValues:Fe.selectedValues,id:`options-${Qe}`}))}}const Ce=X(ce);return Ce.displayName="OptionsPicker",Ce};var OE=e(95802);class IE extends a.PureComponent{constructor(){super(...arguments),this.onChange=z=>{this.props.onPropChange({propName:"query",propValue:z.currentTarget.value,updateOptions:!0})}}render(){return a.createElement(OE.d,{constantValue:this.props.variable.query,onChange:this.onChange})}}const AE={..._o.Vg,type:"constant",hide:_o.zL.hideVariable,query:"",current:{},options:[]},L0=(0,Mi.Z0)({name:"templating/constant",initialState:vd.j,reducers:{createConstantOptionsFromQuery:(F,z)=>{const X=(0,Ts.Fs)(F,z.payload.id);X.type==="constant"&&(X.options=[{text:X.query.trim(),value:X.query.trim(),selected:!1}])}}}),RE=L0.reducer,{createConstantOptionsFromQuery:LE}=L0.actions,BE=F=>async z=>{const{rootStateKey:X}=F;await z((0,Us.kb)(X,LE((0,xa.qD)(F)))),await z((0,Or.kl)(F))},UE=()=>({id:"constant",description:"Define a hidden constant variable, useful for metric prefixes in dashboards you want to share.",name:"Constant",initialState:AE,reducer:RE,picker:yd(),editor:IE,dependsOn:()=>!1,setValue:async(F,z,X=!1)=>{await(0,Rs.JD)((0,Or.t9)((0,xa.jX)(F),z,X))},setValueFromUrl:async(F,z)=>{await(0,Rs.JD)((0,Or.x7)((0,xa.jX)(F),z))},updateOptions:async F=>{await(0,Rs.JD)(BE((0,xa.jX)(F)))},getSaveModel:F=>{const{index:z,id:X,state:ce,global:Ce,current:Ae,options:Fe,rootStateKey:Qe,...qe}=(0,p.cloneDeep)(F);return qe},getValueForUrl:F=>F.current.value,beforeAdding:F=>{const{current:z,options:X,query:ce,...Ce}=(0,p.cloneDeep)(F),Ae={selected:!0,text:ce,value:ce};return{...Ce,current:Ae,options:[Ae],query:ce}}});var NE=e(58711);class wE extends a.PureComponent{constructor(){super(...arguments),this.onSelectionOptionsChange=async({propName:z,propValue:X})=>{this.props.onPropChange({propName:z,propValue:X,updateOptions:!0})},this.onQueryChange=z=>{this.props.onPropChange({propName:"query",propValue:z.currentTarget.value,updateOptions:!0})}}render(){return a.createElement(NE.w,{query:this.props.variable.query,multi:this.props.variable.multi,allValue:this.props.variable.allValue,includeAll:this.props.variable.includeAll,onQueryChange:this.onQueryChange,onMultiChange:z=>this.onSelectionOptionsChange({propName:"multi",propValue:z.currentTarget.checked}),onIncludeAllChange:z=>this.onSelectionOptionsChange({propName:"includeAll",propValue:z.currentTarget.checked}),onAllValueChange:z=>this.onSelectionOptionsChange({propName:"allValue",propValue:z.currentTarget.value})})}}const FE=(F,z)=>({}),WE={changeVariableMultiValue:Or.TI},KE=am(wE,FE,WE),$E={..._o.Vg,type:"custom",multi:!1,includeAll:!1,allValue:null,query:"",options:[],current:{}},B0=(0,Mi.Z0)({name:"templating/custom",initialState:vd.j,reducers:{createCustomOptionsFromQuery:(F,z)=>{const X=(0,Ts.Fs)(F,z.payload.id);if(X.type!=="custom")return;const{includeAll:ce}=X,Fe=(z.payload.data.match(/(?:\\,|[^,])+/g)??[]).map(Qe=>{Qe=Qe.replace(/\\,/g,",");const qe=/^(.+)\s:\s(.+)$/g.exec(Qe)??[];if(qe.length===3){const[,ut,vt]=qe;return{text:ut.trim(),value:vt.trim(),selected:!1}}else return{text:Qe.trim(),value:Qe.trim(),selected:!1}});ce&&Fe.unshift({text:ao.Zm,value:ao.To,selected:!1}),X.options=Fe}}}),VE=B0.reducer,{createCustomOptionsFromQuery:_E}=B0.actions,zE=F=>async(z,X)=>{const{rootStateKey:ce}=F,Ce=(0,Ts.dn)(F,X());if(Ce.type!=="custom")return;const Ae=(0,Re.w)().replace(Ce.query);await z((0,Us.kb)(ce,_E((0,xa.qD)(F,Ae)))),await z((0,Or.kl)(F))},kE=()=>({id:"custom",description:"Define variable values manually",name:"Custom",initialState:$E,reducer:VE,picker:yd(),editor:KE,dependsOn:(F,z)=>(0,xa.wJ)(F.query,z.name),setValue:async(F,z,X=!1)=>{await(0,Rs.JD)((0,Or.t9)((0,xa.jX)(F),z,X))},setValueFromUrl:async(F,z)=>{await(0,Rs.JD)((0,Or.x7)((0,xa.jX)(F),z))},updateOptions:async F=>{await(0,Rs.JD)(zE((0,xa.jX)(F)))},getSaveModel:F=>{const{index:z,id:X,state:ce,global:Ce,rootStateKey:Ae,...Fe}=(0,p.cloneDeep)(F);return Fe},getValueForUrl:F=>(0,xa.ML)(F)?ao.Zm:F.current.value});var HE=e(98917),GE=e(80147);const jE={..._o.Vg,type:"datasource",current:{},regex:"",options:[],query:"",multi:!1,includeAll:!1,refresh:_o.CO.onDashboardLoad},U0=(0,Mi.Z0)({name:"templating/datasource",initialState:vd.j,reducers:{createDataSourceOptions:(F,z)=>{const{sources:X,regex:ce}=z.payload.data,Ce=[],Ae=(0,Ts.Fs)(F,z.payload.id);if(Ae.type==="datasource"){for(let Fe=0;Fe<X.length;Fe++){const Qe=X[Fe];(0,GE._)(Ae.query,Qe.meta)&&(YE(Qe,ce)&&Ce.push({text:Qe.name,value:Qe.uid,selected:!1}),QE(Qe,ce)&&Ce.push({text:"default",value:"default",selected:!1}))}Ce.length===0&&Ce.push({text:"No data sources found",value:"",selected:!1}),Ae.includeAll&&Ce.unshift({text:ao.Zm,value:ao.To,selected:!1}),Ae.options=Ce}}}});function YE(F,z){return z?z.exec(F.name):!0}function QE(F,z){return F.isDefault?z?z.exec("default"):!0:!1}const JE=U0.reducer,{createDataSourceOptions:XE}=U0.actions,ZE=(F,z={getDatasourceSrv:c.tR})=>async(X,ce)=>{const{rootStateKey:Ce}=F,Ae=z.getDatasourceSrv().getList({metrics:!0,variables:!1}),Fe=(0,Ts.dn)(F,ce());if(Fe.type!=="datasource")return;let Qe;Fe.regex&&(Qe=(0,Re.w)().replace(Fe.regex,void 0,"regex"),Qe=(0,Yn.dO)(Qe)),X((0,Us.kb)(Ce,XE((0,xa.qD)(F,{sources:Ae,regex:Qe})))),await X((0,Or.kl)(F))},qE=(F,z={getDatasourceSrv:c.tR})=>X=>{const ce=z.getDatasourceSrv().getList({metrics:!0,variables:!0}),Ce=(0,p.chain)(ce).uniqBy("meta.id").map(Ae=>({text:Ae.meta.name,value:Ae.meta.id})).value();Ce.unshift({text:"",value:""}),X((0,Us.kb)(F,(0,Hi.BC)({dataSourceTypes:Ce})))},ey=(F,z)=>{const{variable:{rootStateKey:X}}=z;if(!X)return console.error("DataSourceVariableEditor: variable has no rootStateKey"),{extended:g0(Hi.nS)};const{editor:ce}=(0,Ts.nx)(X,F);return{extended:g0(ce)}},ty={initDataSourceVariableEditor:qE,changeVariableMultiValue:Or.TI},ny=(0,go.connect)(ey,ty);class ay extends a.PureComponent{constructor(){super(...arguments),this.onRegExBlur=z=>{this.props.onPropChange({propName:"regex",propValue:z.currentTarget.value,updateOptions:!0})},this.onSelectionOptionsChange=async({propValue:z,propName:X})=>{this.props.onPropChange({propName:X,propValue:z,updateOptions:!0})},this.onMultiChanged=z=>{this.props.changeVariableMultiValue((0,xa.jX)(this.props.variable),z.currentTarget.checked)},this.onIncludeAllChanged=z=>{this.onSelectionOptionsChange({propName:"includeAll",propValue:z.currentTarget.checked})},this.onAllValueChanged=z=>{this.onSelectionOptionsChange({propName:"allValue",propValue:z.currentTarget.value})},this.getSelectedDataSourceTypeValue=()=>{const{extended:z}=this.props;if(!z?.dataSourceTypes.length)return"";const X=z.dataSourceTypes.find(Ce=>Ce.value===this.props.variable.query);return(X?X.value:z.dataSourceTypes[0].value)??""},this.onDataSourceTypeChanged=z=>{this.props.onPropChange({propName:"query",propValue:z.value,updateOptions:!0})}}componentDidMount(){const{rootStateKey:z}=this.props.variable;if(!z){console.error("DataSourceVariableEditor: variable has no rootStateKey");return}this.props.initDataSourceVariableEditor(z)}render(){const{variable:z,extended:X}=this.props,ce=X?.dataSourceTypes?.length?X.dataSourceTypes?.map(Ce=>({value:Ce.value??"",label:Ce.text})):[];return a.createElement(HE.y,{query:z.query,regex:z.regex,multi:z.multi,includeAll:z.includeAll,optionTypes:ce,onChange:this.onDataSourceTypeChanged,onRegExBlur:this.onRegExBlur,onMultiChange:this.onMultiChanged,onIncludeAllChange:this.onIncludeAllChanged,onAllValueChange:this.onAllValueChanged})}}const sy=ny(ay),ry=()=>({id:"datasource",description:"Enables you to dynamically switch the data source for multiple panels.",name:"Data source",initialState:jE,reducer:JE,picker:yd(),editor:sy,dependsOn:(F,z)=>F.regex?(0,xa.wJ)(F.regex,z.name):!1,setValue:async(F,z,X=!1)=>{await(0,Rs.JD)((0,Or.t9)((0,xa.jX)(F),z,X))},setValueFromUrl:async(F,z)=>{await(0,Rs.JD)((0,Or.x7)((0,xa.jX)(F),z))},updateOptions:async F=>{await(0,Rs.JD)(ZE((0,xa.jX)(F)))},getSaveModel:F=>{const{index:z,id:X,state:ce,global:Ce,rootStateKey:Ae,...Fe}=(0,p.cloneDeep)(F);return{...Fe,options:[]}},getValueForUrl:F=>(0,xa.ML)(F)?ao.Zm:F.current.value});var oy=e(25304),iy=e(49317);const N0=a.memo(({onPropChange:F,variable:z})=>{const X=Fe=>{F({propName:"auto",propValue:Fe.target.checked,updateOptions:!0})},ce=Fe=>{F({propName:"query",propValue:Fe.currentTarget.value,updateOptions:!0})},Ce=Fe=>{F({propName:"auto_count",propValue:Fe.value,updateOptions:!0})},Ae=Fe=>{F({propName:"auto_min",propValue:Fe.currentTarget.value,updateOptions:!0})};return a.createElement(iy.s,{intervals:z.query,autoStepCount:z.auto_count,autoEnabled:z.auto,onAutoCountChanged:Ce,onIntervalsChange:ce,onAutoEnabledChange:X,onAutoMinIntervalChanged:Ae,autoMinInterval:z.auto_min})});N0.displayName="IntervalVariableEditor";var ly=e(87986),oh=e(81515);const cy=F=>async z=>{const{rootStateKey:X}=F;await z((0,Us.kb)(X,(0,oh.mn)((0,xa.qD)(F)))),await z(ih(F)),await z((0,Or.kl)(F))},ih=(F,z={calculateInterval:u0.calculateInterval,getTimeSrv:li.jG,templateSrv:(0,ly.w)()})=>(X,ce)=>{const Ce=(0,Ts.dn)(F,ce());if(Ce.type==="interval"&&Ce.auto){const Ae=z.calculateInterval(z.getTimeSrv().timeRange(),Ce.auto_count,Ce.auto_min);z.templateSrv.setGrafanaVariable("$__auto_interval_"+Ce.name,Ae.interval),z.templateSrv.setGrafanaVariable("$__auto_interval",Ae.interval)}},dy=()=>({id:"interval",description:"Define a timespan interval (ex 1m, 1h, 1d)",name:"Interval",initialState:oh.Ez,reducer:oh.E5,picker:yd(),editor:N0,dependsOn:()=>!1,setValue:async(F,z,X=!1)=>{await(0,Rs.JD)(ih((0,xa.jX)(F))),await(0,Rs.JD)((0,Or.t9)((0,xa.jX)(F),z,X))},setValueFromUrl:async(F,z)=>{await(0,Rs.JD)(ih((0,xa.jX)(F))),await(0,Rs.JD)((0,Or.x7)((0,xa.jX)(F),z))},updateOptions:async F=>{await(0,Rs.JD)(cy((0,xa.jX)(F)))},getSaveModel:F=>{const{index:z,id:X,state:ce,global:Ce,rootStateKey:Ae,...Fe}=(0,p.cloneDeep)(F);return Fe},getValueForUrl:F=>F.current.value});var uy=e(44890),my=e(64423),fy=e(12091),gy=e(70766);function py(F,z,X){return{next:Ce=>{if(Ce.state===zs.Gu.Error){X.unsubscribe(),z(Ce.error);return}if(Ce.state===zs.Gu.Done){X.unsubscribe(),F();return}},error:Ce=>{X.unsubscribe(),z(Ce)},complete:()=>{X.unsubscribe(),F()}}}const hy=(F,z)=>async(X,ce)=>{try{const{rootStateKey:Ce}=F;if(!(0,xa.sN)(Ce,ce()))return;const Ae=(0,Ts.dn)(F,ce());if(Ae.type!=="query")return;(0,Ts.nx)(Ce,ce()).editor.id===Ae.id&&X((0,Us.kb)(Ce,(0,Hi.Eo)({errorProp:"update"})));const Fe=await(0,U.l)().get(Ae.datasource??"");await new Promise((Qe,qe)=>{const ut=new my.yU,vt=py(Qe,qe,ut),Ct=ah().getResponse(F).subscribe(vt);ut.add(Ct),ah().queueRequest({identifier:F,datasource:Fe,searchFilter:z})})}catch(Ce){if(Ce instanceof Error){const Ae=(0,fy.u)(Ce),{rootStateKey:Fe}=F;throw(0,Ts.nx)(Fe,ce()).editor.id===F.id&&X((0,Us.kb)(Fe,(0,Hi.NY)({errorProp:"update",errorText:Ae.message}))),Ae}}},vy=F=>async(z,X)=>{const ce=(0,Ts.dn)(F,X());ce.type==="query"&&await z(w0((0,xa.jX)(ce),ce.datasource))},w0=(F,z)=>async(X,ce)=>{try{const{rootStateKey:Ce}=F,{editor:Ae}=(0,Ts.nx)(Ce,ce()),Qe=eh(Ae)?.dataSource,qe=await(0,U.l)().get(z??"");Qe&&Qe.type!==qe?.type&&X((0,Us.kb)(Ce,(0,El.QP)((0,xa.qD)(F,{propName:"query",propValue:""}))));const ut=await(0,gy.y)(qe);X((0,Us.kb)(Ce,(0,Hi.BC)({dataSource:qe,VariableQueryEditor:ut})))}catch(Ce){console.error(Ce)}},Ey=(F,z,X)=>async(ce,Ce)=>{const{rootStateKey:Ae}=F,Fe=(0,Ts.dn)(F,Ce());if(Fe.type==="query"){if(yy(Fe.name,z)){const Qe="Query cannot contain a reference to itself. Variable: $"+Fe.name;ce((0,Us.kb)(Ae,(0,Hi.NY)({errorProp:"query",errorText:Qe})));return}ce((0,Us.kb)(Ae,(0,Hi.Eo)({errorProp:"query"}))),ce((0,Us.kb)(Ae,(0,El.QP)((0,xa.qD)(F,{propName:"query",propValue:z})))),X!==void 0?ce((0,Us.kb)(Ae,(0,El.QP)((0,xa.qD)(F,{propName:"definition",propValue:X})))):typeof z=="string"&&ce((0,Us.kb)(Ae,(0,El.QP)((0,xa.qD)(F,{propName:"definition",propValue:z})))),await ce((0,Or.mZ)(F))}};function yy(F,z){if(typeof z=="string"&&z.match(new RegExp("\\$"+F+"(/| |$)")))return!0;const X=F0(z);for(let ce in X)if(X.hasOwnProperty(ce)){const Ce=X[ce];if(typeof Ce=="string"&&Ce.match(new RegExp("\\$"+F+"(/| |$)")))return!0}return!1}function F0(F){return typeof F!="object"||F===null?{query:F}:Object.keys(F).reduce((ce,Ce)=>{const Ae=F[Ce];if(typeof Ae!="object"||Ae===null)return ce[Ce]=Ae,ce;const Fe=F0(Ae);for(let Qe in Fe)Fe.hasOwnProperty(Qe)&&(ce[`${Ce}_${Qe}`]=Fe[Qe]);return ce},{})}const Dy=(F,z)=>{const{rootStateKey:X}=z.variable;if(!X)return console.error("QueryVariableEditor: variable has no rootStateKey"),{extended:eh(Hi.nS)};const{editor:ce}=(0,Ts.nx)(X,F);return{extended:eh(ce)}},Py={initQueryVariableEditor:vy,changeQueryVariableDataSource:w0,changeQueryVariableQuery:Ey,changeVariableMultiValue:Or.TI},Cy=(0,go.connect)(Dy,Py);class by extends a.PureComponent{constructor(){super(...arguments),this.state={regex:null,tagsQuery:null,tagValuesQuery:null},this.onDataSourceChange=z=>{this.props.onPropChange({propName:"datasource",propValue:z.isDefault?null:(0,m0.p$)(z)})},this.onLegacyQueryChange=async(z,X)=>{this.props.variable.query!==z&&this.props.changeQueryVariableQuery((0,xa.jX)(this.props.variable),z,X)},this.onQueryChange=async z=>{if(this.props.variable.query!==z){let X="";z&&z.hasOwnProperty("query")&&typeof z.query=="string"&&(X=z.query),this.props.changeQueryVariableQuery((0,xa.jX)(this.props.variable),z,X)}},this.onRegExBlur=async z=>{const X=z.currentTarget.value;this.props.variable.regex!==X&&this.props.onPropChange({propName:"regex",propValue:X,updateOptions:!0})},this.onRefreshChange=z=>{this.props.onPropChange({propName:"refresh",propValue:z})},this.onSortChange=async z=>{this.props.onPropChange({propName:"sort",propValue:z.value,updateOptions:!0})},this.onMultiChange=z=>{this.props.onPropChange({propName:"multi",propValue:z.currentTarget.checked})},this.onIncludeAllChange=z=>{this.props.onPropChange({propName:"includeAll",propValue:z.currentTarget.checked})},this.onAllValueChange=z=>{this.props.onPropChange({propName:"allValue",propValue:z.currentTarget.value})}}async componentDidMount(){await this.props.initQueryVariableEditor((0,xa.jX)(this.props.variable))}componentDidUpdate(z){z.variable.datasource!==this.props.variable.datasource&&this.props.changeQueryVariableDataSource((0,xa.jX)(this.props.variable),this.props.variable.datasource)}render(){const{extended:z,variable:X}=this.props;if(!z||!z.dataSource||!z.VariableQueryEditor)return null;const ce=(0,li.jG)().timeRange();return a.createElement(uy.u,{datasource:X.datasource??void 0,onDataSourceChange:this.onDataSourceChange,query:X.query,onQueryChange:this.onQueryChange,onLegacyQueryChange:this.onLegacyQueryChange,timeRange:ce,regex:X.regex,onRegExChange:this.onRegExBlur,sort:X.sort,onSortChange:this.onSortChange,refresh:X.refresh,onRefreshChange:this.onRefreshChange,isMulti:X.multi,includeAll:X.includeAll,allValue:X.allValue??"",onMultiChange:this.onMultiChange,onIncludeAllChange:this.onIncludeAllChange,onAllValueChange:this.onAllValueChange})}}const Ty=Cy(by),My=()=>({id:"query",description:"Variable values are fetched from a datasource query",name:"Query",initialState:jv,reducer:Xv,picker:yd(),editor:Ty,dependsOn:(F,z)=>(0,xa.wJ)(F.query,F.datasource?.uid,F.regex,z.name),setValue:async(F,z,X=!1)=>{await(0,Rs.JD)((0,Or.t9)((0,xa.jX)(F),z,X))},setValueFromUrl:async(F,z)=>{await(0,Rs.JD)((0,Or.x7)((0,xa.jX)(F),z))},updateOptions:async(F,z)=>{await(0,Rs.JD)(hy((0,xa.jX)(F),z))},getSaveModel:F=>{const{index:z,id:X,state:ce,global:Ce,queryValue:Ae,rootStateKey:Fe,...Qe}=(0,p.cloneDeep)(F);return F.refresh!==_o.CO.never?{...Qe,options:[]}:Qe},getValueForUrl:F=>(0,xa.ML)(F)?ao.Zm:F.current.value}),Sy=()=>({id:"system",description:"",name:"system",initialState:{..._o.Vg,type:"system",hide:_o.zL.hideVariable,skipUrlSync:!0,current:{value:{toString:()=>""}},state:zs.Gu.Done},reducer:F=>F,picker:null,editor:null,dependsOn:()=>!1,setValue:async(F,z,X=!1)=>{},setValueFromUrl:async(F,z)=>{},updateOptions:async F=>{},getSaveModel:F=>({}),getValueForUrl:F=>""});var xy=e(58975),Oy=e(14329);function Iy({onPropChange:F,variable:{query:z}}){const X=(0,a.useCallback)((Ae,Fe)=>{Ae.preventDefault(),F({propName:"originalQuery",propValue:Ae.currentTarget.value,updateOptions:!1}),F({propName:"query",propValue:Ae.currentTarget.value,updateOptions:Fe})},[F]),ce=(0,a.useCallback)(Ae=>X(Ae,!1),[X]),Ce=(0,a.useCallback)(Ae=>X(Ae,!0),[X]);return a.createElement(a.Fragment,null,a.createElement(xy.Y,null,"Text options"),a.createElement(Oy._,{value:z,name:"Default value",placeholder:"default value, if any",onChange:ce,onBlur:Ce,width:30,testId:Tr.Tp.pages.Dashboard.Settings.Variables.Edit.TextBoxVariable.textBoxOptionsQueryInputV2}))}function Ay({variable:F,onVariableChange:z,readOnly:X}){const ce=(0,Ut.useDispatch)(),[Ce,Ae]=(0,a.useState)(F.current.value);(0,a.useEffect)(()=>{Ae(F.current.value)},[F]);const Fe=(0,a.useCallback)(()=>{if(!F.rootStateKey){console.error("Cannot update variable without rootStateKey");return}if(F.current.value!==Ce){if(ce((0,Us.kb)(F.rootStateKey,(0,El.QP)((0,xa.qD)({id:F.id,type:F.type},{propName:"query",propValue:Ce})))),z){z({...F,current:(0,R0.R)(F.current)?{}:{...F.current,value:Ce}});return}pd.B.get(F.type).updateOptions(F)}},[F,Ce,ce,z]),Qe=(0,a.useCallback)(vt=>Ae(vt.target.value),[Ae]),qe=vt=>Fe(),ut=vt=>{vt.keyCode===13&&(vt.preventDefault(),Fe())};return a.createElement(me.p,{type:"text",value:Ce,onChange:Qe,onBlur:qe,disabled:X,onKeyDown:ut,placeholder:(0,Ga.t)("variable.textbox.placeholder","Enter variable value"),id:ao.qz+F.id})}const Ry={..._o.Vg,type:"textbox",query:"",current:{},options:[],originalQuery:null},W0=(0,Mi.Z0)({name:"templating/textbox",initialState:vd.j,reducers:{createTextBoxOptions:(F,z)=>{const X=(0,Ts.Fs)(F,z.payload.id);if(X.type!=="textbox")return;const ce={text:X.query.trim(),value:X.query.trim(),selected:!1};X.options=[ce],X.current=ce}}}),Ly=W0.reducer,{createTextBoxOptions:By}=W0.actions,Uy=F=>async(z,X)=>{const{rootStateKey:ce,type:Ce}=F;z((0,Us.kb)(ce,By((0,xa.qD)(F))));const Ae=(0,Ts.dn)(F,X());Ae.type==="textbox"&&await pd.B.get(Ce).setValue(Ae,Ae.options[0],!0)},Ny=(F,z)=>async(X,ce)=>{const{rootStateKey:Ce}=F,Ae=(0,Ts.dn)(F,ce());if(Ae.type!=="textbox")return;const Fe=(0,xa.QT)(z);X((0,Us.kb)(Ce,(0,El.QP)((0,xa.qD)(Ae,{propName:"query",propValue:Fe})))),await X((0,Or.x7)((0,xa.jX)(Ae),Fe))},wy=()=>({id:"textbox",description:"Define a textbox variable, where users can enter any arbitrary string",name:"Text box",initialState:Ry,reducer:Ly,picker:Ay,editor:Iy,dependsOn:(F,z)=>!1,setValue:async(F,z,X=!1)=>{await(0,Rs.JD)((0,Or.t9)((0,xa.jX)(F),z,X))},setValueFromUrl:async(F,z)=>{await(0,Rs.JD)(Ny((0,xa.jX)(F),z))},updateOptions:async F=>{await(0,Rs.JD)(Uy((0,xa.jX)(F)))},getSaveModel:(F,z)=>{const{index:X,id:ce,state:Ce,global:Ae,originalQuery:Fe,rootStateKey:Qe,...qe}=(0,p.cloneDeep)(F);if(F.query!==Fe&&!z){const ut=Fe??"",vt={selected:!1,text:ut,value:ut};return{...qe,query:ut,current:vt,options:[vt]}}return qe},getValueForUrl:F=>F.current.value,beforeAdding:F=>({...(0,p.cloneDeep)(F),originalQuery:F.query})});var Fy=e(51066),lh=e(55314),ch=e(72686),Wy=e(91219);const Ky={navBarTree:Wy.I_,navIndex:ql._h,appNotifications:Su.g5};var $y=e(44672),Vy=e(52806),_y=e(93584),zy=e(20604),ky=e(79763),Hy=e(53466),Gy=e(28601),jy=e(36227),Yy=e(54650),Qy=e(40823),Jy=e(88264),Xy=e(10943),Zy=e(80095),qy=e(31326),eD=e(81862),tD=e(1936),nD=e(8212),aD=e(34655),sD=e(87617),dh=e(49962),rD=e(97007);const oD={...Ky,...Vy.Ay,...aD.Ay,..._y.Ay,...Yy.Ay,...Gy.Ay,...l0.Ay,...jy.Ay,...sD.Ay,...tD.Ay,...eD.Ay,...Qy.Ay,...Xy.Ay,...ky.Ay,...$y.Ay,...Jy.Ay,...Hy.Ay,...Zy.Ay,...Us.Ay,...nD.Ay,...zy.Ay,plugins:qy.Ff,[dh.H.reducerPath]:dh.H.reducer,[ch.Sm.reducerPath]:ch.Sm.reducer,[lh.cU.reducerPath]:lh.cU.reducer},K0={},yD=F=>{Object.assign(K0,F)},iD=()=>{const F=(0,M0.combineReducers)({...oD,...K0});return(z,X)=>{if(X.type!==rD.N.type)return F(z,X);const{cleanupAction:ce}=X.payload;return ce(z),F(z,X)}};function DD(F){addReducer(F)}const lD=(0,Mi.Nc)();function cD(F){const z=(0,Mi.U1)({reducer:iD(),middleware:X=>X({thunk:!0,serializableCheck:!1,immutableCheck:!1}).concat(lD.middleware,dh.H.middleware,ch.Sm.middleware,lh.cU.middleware),devTools:!1,preloadedState:{navIndex:(0,ql.s2)(),...F}});return(0,Fy.$k)(z.dispatch),(0,Rs.k3)(z),z}m().move=K.b;const $0=e(39572),um=$0.keys().map(F=>$0(F));class dD{async init(){try{parent.postMessage("GrafanaAppInit","*");const z=(0,Ga.JL)(_.Ay.bootData.user.language);(0,T.u5)(fi.IB),fD(),Gp(),Rn("frontend_app_init"),gD(),(0,E.xS)(_.Ay.bootData.user.locale),(0,E.$D)(_.Ay.bootData.user.weekStart),(0,N.Y)(Ro.m),(0,V.l)(ug),(0,w.e)(ho.a),(0,I.T)(x.Ny),(0,S.p)(ya),(0,D.G)(()=>_.Ay.bootData.user.timezone),Bi(),(0,gs.initAuthConfig)(),(0,O.H8)(Dr.A),await z,uD(),cD(),mD(),Ea(),b.D.setInit(Nu.H),b.G.setInit(Nu.u),C.h.setInit(Sl),pd.B.setInit(()=>[My(),kE(),wy(),UE(),ry(),dy(),Kv(),Sy()]),y.l.setInit(gc),(0,P.HC)(()=>new uv),mE(new uE),(0,P.pC)(qp.BN),(0,L.se)({importPanelPlugin:c0.TV,getPanelPluginFromCache:c0.PY}),M.I.initialize({config:_.Ay,getTimeRangeForUrl:(0,li.jG)().timeRangeForUrl,getVariablesUrlParams:oy.z}),document.addEventListener("click",jp);const X=new c.xq;X.init(_.Ay.datasources,_.Ay.defaultDatasource),(0,U.h)(X),fv(),new Qp().init();let Ce=[];Kt.TP.user.orgRole!==""&&(Ce=await rv(_.Ay.apps));const Ae=Q0([{pluginId:"grafana",extensionConfigs:ev()},...Ce]),Fe=Ht=>tv({...Ht,registry:Ae});(0,R.cE)(Fe);const Qe=x.Ny.getSearchObject(),qe=new Sf,ut=new un(x.Ny,qe),vt=new Jp;vt.start(),qe.setKioskModeFromUrl(Qe.kiosk);try{(0,gv.W1)()}catch(Ht){console.warn("Failed to clean up old expanded folders",Ht)}this.context={backend:fi.IB,location:x.Ny,chrome:qe,keybindings:ut,newAssetsChecker:vt,config:_.Ay},(0,B._)(Fo.ni),(0,v.H)(document.getElementById("reactRoot")).render(a.createElement(dg,{app:this}))}catch(z){console.error("Failed to start Grafana",z),window.__grafana_load_failed()}finally{Pn("frontend_app_init")}}}function uD(){um.length>0&&um[0].addExtensionReducers()}function mD(){um.length>0&&um[0].init()}function fD(){(0,H.H2)(new W({debug:!1})),window.addEventListener("load",F=>{const z="frontend_boot_load_time_seconds",X="frontend_boot_js_done_time_seconds",ce="frontend_boot_css_time_seconds";performance&&(performance.mark(z),Dd("first-paint","frontend_boot_","_time_seconds"),Dd("first-contentful-paint","frontend_boot_","_time_seconds"),Dd(z),Dd(X),Dd(ce))}),Kt.TP.user.orgRole!==""&&(0,H.pl)(new Pe({})),_.Ay.grafanaJavascriptAgent.enabled&&(0,H.pl)(new Qt({..._.Ay.grafanaJavascriptAgent,app:{version:_.Ay.buildInfo.version,environment:_.Ay.buildInfo.env},buildInfo:_.Ay.buildInfo,user:{id:String(_.Ay.bootData.user?.id),email:_.Ay.bootData.user?.email}})),_.Ay.googleAnalyticsId&&(0,H.pl)(new Je({googleAnalyticsId:_.Ay.googleAnalyticsId})),_.Ay.googleAnalytics4Id&&(0,H.pl)(new ke({googleAnalyticsId:_.Ay.googleAnalytics4Id,googleAnalytics4SendManualPageViews:_.Ay.googleAnalytics4SendManualPageViews})),_.Ay.rudderstackWriteKey&&_.Ay.rudderstackDataPlaneUrl&&(0,H.pl)(new it({writeKey:_.Ay.rudderstackWriteKey,dataPlaneUrl:_.Ay.rudderstackDataPlaneUrl,user:_.Ay.bootData.user,sdkUrl:_.Ay.rudderstackSdkUrl,configUrl:_.Ay.rudderstackConfigUrl,integrationsUrl:_.Ay.rudderstackIntegrationsUrl,buildInfo:_.Ay.buildInfo})),_.Ay.applicationInsightsConnectionString&&(0,H.pl)(new we({connectionString:_.Ay.applicationInsightsConnectionString,endpointUrl:_.Ay.applicationInsightsEndpointUrl}))}function gD(){(0,G.X)()>0&&document.body.classList.add("no-overlay-scrollbar")}function Dd(F,z="",X=""){const ce=m().first(performance.getEntriesByName(F));if(ce){const Ce=ce.name.replace(/-/g,"_");se(`${z}${Ce}${X}`,Math.round(ce.startTime)/1e3)}}const pD=new dD;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,pD.init()},60021:(Q,A,e)=>{"use strict";e.d(A,{Or:()=>n,Oz:()=>r,RC:()=>t,ho:()=>o,nA:()=>s});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||{}),o=(g=>(g.equal="=",g.notEqual="!=",g.regex="=~",g.notRegex="!~",g))(o||{}),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||{})},91621:(Q,A,e)=>{"use strict";e.d(A,{Dw:()=>g,Rx:()=>o,_W:()=>r,d$:()=>n});const t={statistics:[]};var n=(c=>(c[c.Query=1]="Query",c[c.Search=0]="Search",c))(n||{}),o=(c=>(c[c.Builder=0]="Builder",c[c.Code=1]="Code",c))(o||{});const s={parameters:[]};var r=(c=>(c.And="and",c.Function="function",c.FunctionParameter="functionParameter",c.GroupBy="groupBy",c.Operator="operator",c.Or="or",c.Property="property",c))(r||{}),g=(c=>(c.String="string",c))(g||{});const u={logGroupNames:[],logGroups:[],statsGroups:[]}},25640:(Q,A,e)=>{"use strict";e.d(A,{Rx:()=>t.Rx,YZ:()=>n,b4:()=>o,d$:()=>t.d$});var t=e(91621),n=(s=>(s.Scheduled="Scheduled",s.Running="Running",s.Complete="Complete",s.Failed="Failed",s.Cancelled="Cancelled",s.Timeout="Timeout",s))(n||{}),o=(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))(o||{})},36666:(Q,A,e)=>{"use strict";e.d(A,{A:()=>M});var t=e(32196),n=e(16792),o=e(55127),s=e.n(o),r=e(96540),g=e(16817),u=e(52622),c=e(40845),i=e(67061),l=e(88575),f=e(88323),d=e(94354),h=e(15292),p=e(62930),m=e(2913),a=e(14792),v=e(31193),E=e(65160),D=e(43854),b=e(45994);function C(I){return JSON.stringify(I)}const y=[{label:"All data",value:!1},{label:"Annotations",value:!0,description:"Include annotations as regular data"}];function M({data:I,query:x,onChange:S,onRunQuery:O}){const{value:P}=(0,g.A)(()=>(0,v.tR)().get()),L=(0,r.useMemo)(()=>(0,a.UA)().getCurrent()?.getPanelById(x.panelId??-124134),[x.panelId]),{value:U,loading:R}=(0,g.A)(async()=>{if(!L||!I)return[];const ee=await(0,v.tR)().get(L.datasource);return Promise.all(L.targets.map(async re=>{const J=re.datasource?await(0,v.tR)().get(re.datasource):ee,ne=J.getQueryDisplayText||C,q=(0,E.E)(I,re.refId)??I;return{refId:re.refId,query:ne(re),name:J.name,img:J.meta.info.logos.small,data:q.series,error:q.error}}))},[I,L]),B=(0,r.useCallback)(ee=>{S(ee),O()},[S,O]),H=(0,r.useCallback)(ee=>{B({...x,panelId:ee})},[x,B]),w=(0,r.useCallback)(()=>{B({...x,withTransforms:!x.withTransforms})},[x,B]),N=(0,r.useCallback)(ee=>{B({...x,topic:ee?u.QR.Annotations:void 0})},[x,B]),V=(0,r.useCallback)(ee=>{const re=ee.datasource??P,J=(0,v.tR)().getInstanceSettings(re)?.name,ne=ee.targets.length;return`${ne} ${s()("query",ne)} to ${J}`},[P]),G=(0,a.UA)().getCurrent(),_=!!(x.withTransforms||L?.transformations?.length),K=(0,r.useMemo)(()=>G?.panels.filter(ee=>m.Ay.panels[ee.type]&&ee.targets&&ee.id!==G.panelInEdit?.id&&ee.datasource?.uid!==b.K).map(ee=>({value:ee.id,label:ee.title??"Panel "+ee.id,description:V(ee),imgUrl:m.Ay.panels[ee.type].info.logos.small}))??[],[G,V]),j=(0,c.of)(T),k=(0,n.Bi)();if(!G)return null;if(K.length<1)return r.createElement("p",{className:j.noQueriesText},"This dashboard does not have any other panels. Add queries to other panels and try again.");const Y=K.find(ee=>ee.value===x.panelId);return r.createElement(D.i,null,r.createElement(i.B,{direction:"column"},r.createElement(i.B,{gap:3},r.createElement(l.D,{label:"Source panel",description:"Use query results from another panel"},r.createElement(f.l6,{inputId:k,placeholder:"Choose panel",isSearchable:!0,options:K,value:Y,onChange:ee=>H(ee.value)})),r.createElement(l.D,{label:"Data",description:"Use data or annotations from the panel"},r.createElement(d.z,{options:y,value:x.topic===u.QR.Annotations,onChange:N})),_&&r.createElement(l.D,{label:"Transform",description:"Apply transformations from the source panel"},r.createElement(h.K,{value:!!x.withTransforms,onChange:w}))),R?r.createElement(p.y,null):r.createElement(r.Fragment,null,U&&!!U.length&&r.createElement(l.D,{label:"Queries from panel"},r.createElement(i.B,{direction:"column"},U.map((ee,re)=>r.createElement(i.B,{key:re,alignItems:"center",gap:1},r.createElement("div",null,ee.refId),r.createElement("img",{src:ee.img,alt:ee.name,title:ee.name,width:16}),r.createElement("div",null,ee.query))))))))}function T(I){return{noQueriesText:(0,t.css)({padding:I.spacing(1.25)})}}},14348:(Q,A,e)=>{"use strict";e.d(A,{K:()=>u.K,kN:()=>c,mw:()=>i});var t=e(88483),n=e(52622),o=e(39070),s=e(43127),r=e(14792),g=e(34214),u=e(45994);function c(h){return h?typeof h=="string"?h===u.K:"meta"in h&&h.meta.name===u.K||h.uid===u.K:!1}function i(h,p){return new t.c(m=>{const a=(0,r.UA)().getCurrent(),v=l(h.queries);if(!v){m.next(f("Missing panel reference ID"));return}let E=a?.getPanelById(v,!0);if(E instanceof g.a||(E=new g.a(E)),!E){m.next(f("Unknown Panel: "+v));return}const D=E.getQueryRunner(),b=D.getData({withTransforms:!!p?.withTransforms,withFieldConfig:!1}).subscribe({next:C=>{p?.topic===n.QR.Annotations&&(C={...C,series:C.annotations??[],annotations:void 0}),m.next(C)}});if(!E.isInView&&E.refreshWhenInView||a?.otherPanelInFullscreen(E)){const{datasource:C,targets:y}=E,M={...h,datasource:C,panelId:v,queries:y};E.refreshWhenInView=!1,D.run(M)}return()=>{b.unsubscribe()}})}function l(h){if(!(!h||!h.length))return h[0].panelId}function f(h){return{state:o.Gu.Error,series:[],request:{},error:{message:h},timeRange:(0,s.E2)()}}var d=e(36666)},45994:(Q,A,e)=>{"use strict";e.d(A,{K:()=>t});const t="-- Dashboard --",n="dashboard"},90183:(Q,A,e)=>{"use strict";e.d(A,{i:()=>Ee,o:()=>Re});var t=e(2543),n=e(65474),o=e(62467),s=e(44240),r=e(81160),g=e(89667),u=e(39070),c=e(55004),i=e(37471),l=e(78368),f=e(14236),d=e(26657),h=e(72574),p=e(78731),m=e(17172),a=e(19347),v=e(79056),E=e(14792),D=e(32196),b=e(96540),C=e(40845),y=e(84167),M=e(88575),T=e(88323),I=e(15292),x=e(99818),S=e(10154),O=e(68706),P=e(95093),L=e.n(P),U=e(91410),R=e(20333),B=e(55852),H=e(66864),w=e(17624),N=e(67459),V=e(57389),G=e(14578),_=e(87266),K=e(16797);const j="time-of-day-picker-panel",k=({minuteStep:me=1,showHour:Me=!0,showSeconds:ye=!1,onChange:Le,value:We,size:Be="auto",disabled:Ye,disabledHours:at,disabledMinutes:st,disabledSeconds:Ke,placeholder:Xe,format:He="HH:mm",defaultValue:Ge=void 0,allowEmpty:xe=!1,width:$e})=>{const be=(0,C.of)(ee),Z=()=>$e?(0,D.css)` width: ${$e}px; `:(0,_.lH)()[Be];return b.createElement(V.A,{value:We,defaultValue:Ge,onChange:ae=>Le(ae),showHour:Me,showSecond:ye,format:He,allowEmpty:xe,className:(0,D.cx)(Z(),be.input),popupClassName:(0,D.cx)(be.picker,j),minuteStep:me,inputIcon:b.createElement(Y,{wrapperStyle:be.caretWrapper}),disabled:Ye,disabledHours:at,disabledMinutes:st,disabledSeconds:Ke,placeholder:Xe})},Y=({wrapperStyle:me=""})=>b.createElement("div",{className:me},b.createElement(G.I,{name:"angle-down"})),ee=me=>{const Me=me.components.input.background,ye=me.v1.palette.black,Le=me.colors.background.secondary,We=me.shape.radius.default,Be=me.components.input.borderColor;return{caretWrapper:(0,D.css)` position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: inline-block; text-align: right; color: ${me.colors.text.secondary}; `,picker:(0,D.css)` .rc-time-picker-panel-select { font-size: 14px; background-color: ${Me}; border-color: ${Be}; li { outline-width: 2px; &.rc-time-picker-panel-select-option-selected { background-color: inherit; border: 1px solid ${me.v1.palette.orange}; border-radius: ${We}; } &:hover { background: ${Le}; } &.rc-time-picker-panel-select-option-disabled { color: ${me.colors.action.disabledText}; } } } .rc-time-picker-panel-inner { box-shadow: 0px 4px 4px ${ye}; background-color: ${Me}; border-color: ${Be}; border-radius: ${We}; margin-top: 3px; .rc-time-picker-panel-input-wrap { margin-right: 2px; &, .rc-time-picker-panel-input { background-color: ${Me}; padding-top: 2px; } } .rc-time-picker-panel-combobox { display: flex; } } `,input:(0,D.css)` .rc-time-picker-input { background-color: ${Me}; border-radius: ${We}; border-color: ${Be}; height: ${me.spacing(4)}; &:focus { ${(0,K.focusCss)(me)} } &:disabled { background-color: ${me.colors.action.disabledBackground}; color: ${me.colors.action.disabledText}; border: 1px solid ${me.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: ${me.colors.text.secondary}; } `}},re=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"].map((me,Me)=>({label:me,value:Me+1})),J=({value:me,onChange:Me})=>{const ye=(0,C.of)(ne),Le=Date.now(),We=(0,U.QZ)(me.timezone??"utc",Le),Be=(0,E.UA)().getCurrent()?.getTimezone()===me.timezone,[Ye,at]=(0,b.useState)(!1),st=()=>{at(!Ye)},Ke=ae=>{if(!ae)return;const de=L()();if(ae){const ve=ae.split(":");de.set("hour",parseInt(ve[0],10)),de.set("minute",parseInt(ve[1],10))}return de},Xe=()=>{let ae="Everyday";return me.fromDayOfWeek&&!me.toDayOfWeek&&(ae=re[me.fromDayOfWeek-1].label),ae},He=()=>{const ae=b.createElement(b.Fragment,null,b.createElement(N.U,{title:We?.name}),b.createElement(w.X,{timeZone:me.timezone,timestamp:Le}));return Be?b.createElement(b.Fragment,null,"Dashboard timezone (",ae,")"):ae},Ge=(ae,de)=>{const ve=ae?ae.format("HH:mm"):void 0;Me(de==="from"?{...me,from:ve}:{...me,to:ve})},xe=ae=>{Me({...me,timezone:ae})},$e=ae=>{const de=ae?ae.value:void 0,ve=ae?me.toDayOfWeek:void 0;Me({...me,fromDayOfWeek:de,toDayOfWeek:ve})},be=ae=>{Me({...me,toDayOfWeek:ae?ae.value:void 0})},Z=()=>Ye?b.createElement(R.U,{value:me.timezone,includeInternal:!0,onChange:ae=>xe(ae),onBlur:()=>at(!1),openMenuOnFocus:!1,width:100,autoFocus:!0}):b.createElement("div",{className:ye.timezoneContainer},b.createElement("div",{className:ye.timezone},He()),b.createElement(B.$n,{variant:"secondary",onClick:st,size:"sm"},"Change timezone"));return b.createElement(y.n,{className:ye.wrapper},b.createElement(M.D,{label:"From"},b.createElement(H.Gy,{spacing:"xs"},b.createElement(T.l6,{options:re,isClearable:!0,placeholder:"Everyday",value:me.fromDayOfWeek??null,onChange:ae=>$e(ae),width:20}),b.createElement(k,{value:Ke(me.from),onChange:ae=>Ge(ae,"from"),allowEmpty:!0,placeholder:"HH:mm",width:100}))),b.createElement(M.D,{label:"To"},b.createElement(H.Gy,{spacing:"xs"},(me.fromDayOfWeek||me.toDayOfWeek)&&b.createElement(T.l6,{options:re,isClearable:!0,placeholder:Xe(),value:me.toDayOfWeek??null,onChange:ae=>be(ae),width:20}),b.createElement(k,{value:Ke(me.to),onChange:ae=>Ge(ae,"to"),allowEmpty:!0,placeholder:"HH:mm",width:100}))),b.createElement(M.D,{label:"Timezone"},Z()))},ne=me=>({wrapper:(0,D.css)({maxWidth:me.spacing(60),marginBottom:me.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",te=b.createElement("div",null,"Specify a list of tags to match. To specify a key and value tag use `key:value` syntax."),oe=[{label:"Dashboard",value:O.St.Dashboard,description:"Query for events created on this dashboard and show them in the panels where they where created"},{label:"Tags",value:O.St.Tags,description:"This will fetch any annotation events that match the tags filter"}],ue=[{label:"Annotations & Alerts",value:O.nj.Annotations,description:"Show annotations or alerts managed by grafana"},{label:"Time regions",value:O.nj.TimeRegions,description:"Configure a repeating time region"}],ie=[10,50,100,200,300,500,1e3,2e3].map(me=>({label:String(me),value:me}));function ge({query:me,onChange:Me}){const ye=me,{limit:Le,matchAny:We,tags:Be,type:Ye,queryType:at}=ye;let st=at??O.nj.Annotations;const Ke=(0,b.useMemo)(()=>(0,E.UA)().dashboard?.getTimezone(),[]),Xe=(0,C.of)(he),He=ae=>Me({...ye,type:ae.value}),Ge=ae=>Me({...ye,limit:ae.value}),xe=ae=>Me({...ye,matchAny:ae.target.checked}),$e=ae=>Me({...ye,tags:ae}),be=ae=>{const de={...ye,queryType:ae.value};de.queryType===O.nj.TimeRegions?de.timeRegion||(de.timeRegion={timezone:Ke}):delete de.timeRegion,Me(de)},Z=ae=>{Me({...ye,timeRegion:ae})};return b.createElement(y.n,{className:Xe.container},b.createElement(M.D,{label:"Query type"},b.createElement(T.l6,{inputId:"grafana-annotations__query-type",options:ue,value:st,onChange:be})),st===O.nj.Annotations&&b.createElement(b.Fragment,null,b.createElement(M.D,{label:"Filter by"},b.createElement(T.l6,{inputId:"grafana-annotations__filter-by",options:oe,value:Ye,onChange:He})),b.createElement(M.D,{label:"Max limit"},b.createElement(T.l6,{inputId:"grafana-annotations__limit",width:16,options:ie,value:Le,onChange:Ge})),Ye===O.St.Tags&&b.createElement(b.Fragment,null,b.createElement(M.D,{label:"Match any",description:q},b.createElement(I.d,{id:"grafana-annotations__match-any",value:We,onChange:xe})),b.createElement(M.D,{label:"Tags",description:te},b.createElement(x.$,{allowCustomValue:!0,inputId:"grafana-annotations__tags",onChange:$e,tagOptions:S.vy,tags:Be??[]})))),st===O.nj.TimeRegions&&ye.timeRegion&&b.createElement(J,{value:ye.timeRegion,onChange:Z}))}const he=me=>({container:(0,D.css)({maxWidth:me.spacing(60),marginBottom:me.spacing(2)})});var De=e(11261),pe=e(94515);function le(me,Me,ye,Le){if(!Me)return;const We=(0,pe.iU)(Me,ye);if(!We.length)return;const Be=[],Ye=[],at=[],st=Me.timezone??Le;for(const Ke of We){let Xe=Ke.from,He=Ke.to;const Ge=(0,U.QZ)(st,Xe);if(Ge){const xe=Ge.offsetInMins*60*1e3;Xe+=xe,He+=xe}Be.push(Xe),Ye.push(He),at.push(me)}return{fields:[{name:"time",type:De.PU.time,values:Be,config:{}},{name:"timeEnd",type:De.PU.time,values:Ye,config:{}},{name:"text",type:De.PU.string,values:at,config:{}}],length:Be.length}}let Te=100;class Ee extends d.iy{constructor(Me){super(Me),this.annotations={QueryEditor:ge,prepareAnnotation(ye){return ye.target=ye.target??{type:ye.type??O.St.Dashboard,limit:ye.limit??100,tags:ye.tags??[],matchAny:ye.matchAny??!1},ye},prepareQuery(ye){let Le;if((0,t.isString)(ye.datasource)){const Ye=(0,v.og)(ye.datasource,{returnDefaultAsNull:!1});Ye&&(Le=Ye)}else Le=ye.datasource;const{filter:We,...Be}=ye;return{...Be,refId:ye.name,queryType:O.nj.Annotations,datasource:Le}}}}getDefaultQuery(){return{queryType:O.nj.RandomWalk}}query(Me){const ye=[],Le=[],We=(0,h.w)();for(const Be of Me.targets){if(Be.queryType===O.nj.Annotations)return(0,n.H)(this.getAnnotations({range:Me.range,rangeRaw:Me.range.raw,annotation:Be,dashboard:(0,E.UA)().getCurrent()}));if(!Be.hide){if(Be.queryType===O.nj.Snapshot){ye.push((0,o.of)({data:(Be.snapshot??[]).map(Ye=>(0,g.or)(Ye)),state:u.Gu.Done}));continue}if(Be.queryType===O.nj.TimeRegions){const Ye=le("",Be.timeRegion,Me.range,Me.timezone);ye.push((0,o.of)({data:Ye?[Ye]:[],state:u.Gu.Done}));continue}if(Be.queryType===O.nj.LiveMeasurements){let Ye=We.replace(Be.channel,Me.scopedVars);const{filter:at}=Be,st=(0,c.DG)(Ye);if(!(0,c.aj)(st))continue;const Ke={maxLength:Me.maxDataPoints??500};Be.buffer?(Ke.maxDelta=Be.buffer,Ke.maxLength=Ke.maxLength*2):Me.rangeRaw?.to==="now"&&(Ke.maxDelta=Me.range.to.valueOf()-Me.range.from.valueOf()),ye.push((0,p.oF)().getDataStream({key:`${Me.requestId}.${Te++}`,addr:st,filter:at,buffer:Ke}))}else Be.queryType||(Be.queryType=O.nj.RandomWalk),Le.push(Be)}}return Le.length&&ye.push(super.query({...Me,targets:Le})),ye.length?ye.length===1?ye[0]:(0,s.h)(...ye):(0,o.of)()}listFiles(Me,ye){return this.query({targets:[{refId:"A",queryType:O.nj.List,path:Me}],maxDataPoints:ye}).pipe((0,r.T)(Le=>{const We=Le.data[0]??new i.k;return new l.R(We)}))}metricFindQuery(){return Promise.resolve([])}async getAnnotations(Me){const ye=Me.annotation.target;if(ye?.queryType===O.nj.TimeRegions){const at=le(Me.annotation.name,ye.timeRegion,Me.range,(0,E.UA)().getCurrent()?.timezone);return Promise.resolve({data:at?[at]:[]})}const Le=Me.annotation,We=Le.target,Be={from:Me.range.from.valueOf(),to:Me.range.to.valueOf(),limit:We.limit,tags:We.tags,matchAny:We.matchAny};if(We.type===O.St.Dashboard){if(!Me.dashboard?.uid)return Promise.resolve({data:[]});Be.dashboardUID=Me.dashboard.uid,delete Be.tags}else{if(!Array.isArray(We.tags)||We.tags.length===0)return Promise.resolve({data:[]});const at=(0,h.w)(),st="__delimiter__",Ke=[];for(const Xe of Be.tags){const He=at.replace(Xe,{},Ge=>typeof Ge=="string"?Ge:Ge.join(st));for(const Ge of He.split(st))Ke.push(Ge)}Be.tags=Ke}const Ye=await(0,m.AI)().get("/api/annotations",Be,`grafana-data-source-annotations-${Le.name}-${Me.dashboard?.uid}`);return{data:[(0,f.Vc)(Ye)]}}testDatasource(){return Promise.resolve({message:"",status:""})}}async function Re(){return await(0,a.l)().get("-- Grafana --")}},68706:(Q,A,e)=>{"use strict";e.d(A,{St:()=>s,dx:()=>o,nj:()=>t,uJ:()=>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"},o={refId:"A",datasource:{type:"grafana",uid:"grafana"},queryType:"snapshot",snapshot:[]};var s=(r=>(r.Dashboard="dashboard",r.Tags="tags",r))(s||{})},90478:(Q,A,e)=>{"use strict";e.d(A,{H:()=>u,j:()=>i});var t=e(89667),n=e(28138),o=e(57220),s=e(40489),r=e(28444),g=e(68706);function u(l,f){return new Promise(d=>{if(l.datasource?.uid===o.vv){c(f,l),d(!0);return}n.A.publish(new r.bY({title:"Change to panel embedded data",text:"If you want to change the data shown in this panel Grafana will need to remove the panels current query and replace it with a snapshot of the current data. This enables you to edit the data.",yesText:"Continue",icon:"pen",onConfirm:()=>{c(f,l),d(!0)},onDismiss:()=>{d(!1)}}))})}function c(l,f){const d=l.map(p=>(0,t.Nw)(p)),h={refId:"A",queryType:g.nj.Snapshot,snapshot:d,datasource:{uid:o.vv}};f.updateQueries({dataSource:{uid:o.vv},queries:[h]}),f.refresh()}function i(l){return(f,d,h)=>{s.vI(f).subscribe(async p=>{const m=[];p.dataFrames.forEach(a=>{const v=(0,t.Nw)(a);m.push(v)}),l({...g.dx,snapshot:m,file:p.file},d)})}}},7810:(Q,A,e)=>{"use strict";e.d(A,{Fb:()=>s,K_:()=>c,_i:()=>g});var t=e(37471),n=e(11261),o=e(50248);function s(i){const l=i.spans.map(d=>r(d,i.processes)),f=new t.k({fields:[{name:"traceID",type:n.PU.string},{name:"spanID",type:n.PU.string},{name:"parentSpanID",type:n.PU.string},{name:"operationName",type:n.PU.string},{name:"serviceName",type:n.PU.string},{name:"serviceTags",type:n.PU.other},{name:"startTime",type:n.PU.number},{name:"duration",type:n.PU.number},{name:"logs",type:n.PU.other},{name:"tags",type:n.PU.other},{name:"warnings",type:n.PU.other},{name:"stackTraces",type:n.PU.other}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"jaeger"}}});for(const d of l)f.add(d);return f}function r(i,l){return{spanID:i.spanID,traceID:i.traceID,parentSpanID:i.references?.find(f=>f.refType==="CHILD_OF")?.spanID,operationName:i.operationName,startTime:i.startTime/1e3,duration:i.duration/1e3,logs:i.logs.map(f=>({...f,timestamp:f.timestamp/1e3})),tags:i.tags,warnings:i.warnings??void 0,stackTraces:i.stackTraces,serviceName:l[i.processID].serviceName,serviceTags:l[i.processID].tags}}function g(i,l){const f=new t.k({fields:[{name:"traceID",type:n.PU.string,config:{unit:"string",displayNameFromDS:"Trace ID",links:[{title:"Trace: ${__value.raw}",url:"",internal:{datasourceUid:l.uid,datasourceName:l.name,query:{query:"${__value.raw}"}}}]}},{name:"traceName",type:n.PU.string,config:{displayNameFromDS:"Trace name"}},{name:"startTime",type:n.PU.time,config:{displayNameFromDS:"Start time"}},{name:"duration",type:n.PU.number,config:{displayNameFromDS:"Duration",unit:"\xB5s"}}],meta:{preferredVisualisationType:"table"}}),d=i.map(u).sort((h,p)=>p?.startTime-h?.startTime);for(const h of d)f.add(h);return f}function u(i){const l=(0,o.transformTraceData)(i);if(l)return{traceID:l.traceID,startTime:l.startTime/1e3,duration:l.duration,traceName:l.traceName}}function c(i){let l={traceID:"",spans:[],processes:{},warnings:null},f=[];for(let d=0;d<i.length;d++){const h=i.get(d);l.traceID||(l.traceID=h.traceID),f.find(p=>p===h.serviceName)||(f.push(h.serviceName),l.processes[`p${f.length}`]={serviceName:h.serviceName,tags:h.serviceTags}),l.spans.push({traceID:h.traceID,spanID:h.spanID,duration:h.duration*1e3,references:h.parentSpanID?[{refType:"CHILD_OF",spanID:h.parentSpanID,traceID:h.traceID}]:[],flags:0,logs:h.logs.map(p=>({...p,timestamp:p.timestamp*1e3})),operationName:h.operationName,processID:Object.keys(l.processes).find(p=>l.processes[p].serviceName===h.serviceName)||"",startTime:h.startTime*1e3,tags:h.tags,warnings:h.warnings?h.warnings:null})}return{data:[l],total:0,limit:0,offset:0,errors:null}}},71713:(Q,A,e)=>{"use strict";e.d(A,{AW:()=>g,Ay:()=>c,RQ:()=>s,dZ:()=>t,fV:()=>r,vB:()=>u});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+.'}],o=[{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],u={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,...o].map(i=>i.label).join("|")}`,"i"),alias:"keyword"}}},function:new RegExp(`\\b(?:${g.map(i=>i.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:/[{}(),.]/},c=u},43269:(Q,A,e)=>{"use strict";e.d(A,{HD:()=>g,ti:()=>s,U3:()=>n,ie:()=>u,Q$:()=>o});var t=(c=>(c.Builder="builder",c.Code="code",c))(t||{}),n=(c=>(c.Instant="instant",c.Range="range",c.Stream="stream",c))(n||{}),o=(c=>(c.DataSample="dataSample",c.InfiniteScroll="infiniteScroll",c.LogsSample="logsSample",c.LogsVolume="logsVolume",c))(o||{}),s=(c=>(c.Backward="backward",c.Forward="forward",c))(s||{}),r=(c=>(c.Stream="streams",c.Vector="vector",c.Matrix="matrix",c))(r||{}),g=(c=>(c.Indexed="I",c.StructuredMetadata="S",c.Parsed="P",c))(g||{}),u=(c=>(c[c.LabelNames=0]="LabelNames",c[c.LabelValues=1]="LabelValues",c))(u||{})},14678:(Q,A,e)=>{"use strict";e.d(A,{N8:()=>E,qM:()=>v,uv:()=>a});var t=e(2543),n=e.n(t),o=e(62467),s=e(65474),r=e(45650),g=e(69862),u=e(81160),c=e(9084),i=e(66847),l=e(93031),f=e(71030),d=e(40187),h=e(39070),p=e(19347),m=e(12091);const a="-- Mixed --",v=(b,C)=>`mixed-${b}-${C||""}`;class E extends d.mA{constructor(C){super(C)}query(C){const y=C.targets.filter(I=>I.datasource?.uid!==a);if(!y.length)return(0,o.of)({data:[]});const M=(0,t.groupBy)(y,"datasource.uid"),T=[];for(const I in M){const x=M[I];T.push({datasource:(0,p.l)().get(x[0].datasource,C.scopedVars),targets:x})}return T.length?this.batchQueries(T,C):(0,o.of)({data:[]})}batchQueries(C,y){const M=C.filter(this.isQueryable).map((T,I)=>(0,s.H)(T.datasource).pipe((0,g.Z)(x=>{const S=(0,t.cloneDeep)(y);return S.requestId=v(I,S.requestId),S.targets=T.targets,(0,s.H)(x.query(S)).pipe((0,u.T)(O=>({...O,data:O.data||[],state:h.Gu.Loading,key:v(I,O.key)})),(0,c.$)(),(0,i.W)(O=>(O=(0,m.u)(O),O.message=`${x.name}: ${O.message}`,(0,o.of)([{data:[],state:h.Gu.Error,error:O,key:v(I,S.requestId)}]))))})));return(0,r.p)(M).pipe(D(),(0,u.T)(this.finalizeResponses),(0,l.U)())}testDatasource(){return Promise.resolve({message:"",status:""})}isQueryable(C){return C&&Array.isArray(C.targets)&&C.targets.length>0}finalizeResponses(C){const{length:y}=C;if(y===0)return C;const M=C.find(T=>T.state===h.Gu.Error);return M?C.push(M):C[y-1].state=h.Gu.Done,C}}function D(){return(0,f.T)((b,C)=>C.reduce((y,M)=>(y.push.apply(y,M),y),b),[])}},87324:(Q,A,e)=>{"use strict";e.d(A,{t:()=>s});var t=e(21489),n=e(47891),o=e(65405);function s(i,l,f,d="="){if(!l||!f)throw new Error("Need label to add to query.");const h=r(i);if(!h.length)return i;const p=g(l,f,d);return u(i,h,p)}function r(i){const l=t.K3.parse(i),f=[];return l.iterate({enter:({to:d,from:h,type:p})=>{if(p.id===t.Fb){const m=(0,o.u)(i.substring(h,d));return f.push({query:m.query,from:h,to:d}),!1}}}),f}function g(i,l,f){const d=l===1/0?"+Inf":l.toString();return{label:i,op:f,value:d}}function u(i,l,f){const d=new n.l;let h="",p=0;for(let m=0;m<l.length;m++){const a=l[m],v=m===l.length-1,E=i.substring(p,a.from),D=v?i.substring(a.to):"";c(a.query.labels,f)||a.query.labels.push(f);const b=d.renderQuery(a.query);h+=E+b+D,p=a.to}return h}function c(i,l){return i.find(f=>f.label===l.label&&f.value===l.value)}},60042:(Q,A,e)=>{"use strict";e.d(A,{A:()=>H});var t=e(32196),n=e(96540),o=e(14236),s=e(13544),r=e(14110),g=e(14578),u=e(55852),c=e(40845),i=e(61680);function l(w){return typeof w=="object"&&w!==null&&"isCanceled"in w}const f=w=>{let N=!1;return{promise:new Promise((G,_)=>{const K={isCanceled:!0};w.then(j=>N?_(K):G(j)),w.catch(j=>_(N?K:j))}),cancel(){N=!0}}};var d=e(45889),h=e(91793),p=e(3911),m=e(39558),a=e(66864),v=e(60029),E=e(10354),D=e(54438);const b="{}",C="__name__",y=25;function M(w){let N="";const V=[];for(const G of w)if((G.name===C||G.selected)&&G.values&&G.values.length>0){const _=G.values.filter(K=>K.selected).map(K=>K.name);_.length>1?V.push(`${G.name}=~"${_.map(d.Cs).join("|")}"`):_.length===1&&(G.name===C?N=_[0]:V.push(`${G.name}="${(0,d.Qn)(_[0])}"`))}return[N,"{",V.join(","),"}"].join("")}function T(w,N,V){return w.map(G=>{const _=N[G.name];if(_){let K;if(G.name===V&&G.values)K=G.values;else{const j=new Set(G.values?.filter(k=>k.selected).map(k=>k.name)||[]);K=_.map(k=>({name:k,selected:j.has(k)}))}return{...G,loading:!1,values:K,hidden:!_,facets:K.length}}return{...G,loading:!1,hidden:!_,values:void 0,facets:0}})}const I=(0,p.N)(w=>({wrapper:(0,t.css)` background-color: ${w.colors.background.secondary}; padding: ${w.spacing(1)}; width: 100%; `,list:(0,t.css)` margin-top: ${w.spacing(1)}; display: flex; flex-wrap: wrap; max-height: 200px; overflow: auto; align-content: flex-start; `,section:(0,t.css)` & + & { margin: ${w.spacing(2)} 0; } position: relative; `,selector:(0,t.css)` font-family: ${w.typography.fontFamilyMonospace}; margin-bottom: ${w.spacing(1)}; `,status:(0,t.css)` padding: ${w.spacing(.5)}; color: ${w.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: ${w.colors.error.main}; `,valueList:(0,t.css)` margin-right: ${w.spacing(1)}; resize: horizontal; `,valueListWrapper:(0,t.css)` border-left: 1px solid ${w.colors.border.medium}; margin: ${w.spacing(1)} 0; padding: ${w.spacing(1)} 0 ${w.spacing(1)} ${w.spacing(1)}; `,valueListArea:(0,t.css)` display: flex; flex-wrap: wrap; margin-top: ${w.spacing(1)}; `,valueTitle:(0,t.css)` margin-left: -${w.spacing(.5)}; margin-bottom: ${w.spacing(1)}; `,validationStatus:(0,t.css)` padding: ${w.spacing(.5)}; margin-bottom: ${w.spacing(1)}; color: ${w.colors.text.maxContrast}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; `}));class x extends n.Component{constructor(){super(...arguments),this.valueListsRef=n.createRef(),this.state={labels:[],labelSearchTerm:"",metricSearchTerm:"",status:"Ready",error:"",validationStatus:"",valueSearchTerm:""},this.onChangeLabelSearch=N=>{this.setState({labelSearchTerm:N.target.value})},this.onChangeMetricSearch=N=>{this.setState({metricSearchTerm:N.target.value})},this.onChangeValueSearch=N=>{this.setState({valueSearchTerm:N.target.value})},this.onClickRunQuery=()=>{const N=M(this.state.labels);this.props.onChange(N)},this.onClickRunRateQuery=()=>{const V=`rate(${M(this.state.labels)}[$__rate_interval])`;this.props.onChange(V)},this.onClickClear=()=>{this.setState(N=>({labels:N.labels.map(G=>({...G,values:void 0,selected:!1,loading:!1,hidden:!1,facets:void 0})),labelSearchTerm:"",metricSearchTerm:"",status:"",error:"",validationStatus:"",valueSearchTerm:""})),this.props.deleteLastUsedLabels(),this.fetchValues(C,b)},this.onClickLabel=(N,V,G)=>{const _=this.state.labels.find(k=>k.name===N);if(!_)return;const K=!_.selected;let j={selected:K};if(_.values&&!K){const k=_.values.map(Y=>({...Y,selected:!1}));j={...j,facets:0,values:k}}this.setState({labelSearchTerm:""}),this.updateLabelState(N,j,"",()=>this.doFacettingForLabel(N))},this.onClickValue=(N,V,G)=>{const _=this.state.labels.find(j=>j.name===N);if(!_||!_.values)return;this.setState({labelSearchTerm:""});const K=_.values.map(j=>({...j,selected:j.name===V?!j.selected:j.selected}));this.updateLabelState(N,{values:K},"",()=>this.doFacetting(N))},this.onClickMetric=(N,V,G)=>{const _=this.state.labels.find(k=>k.name===N);if(!_||!_.values)return;this.setState({metricSearchTerm:""});const K=_.values.map(k=>({...k,selected:k.name===V||k.selected?!k.selected:k.selected})),j=K.some(k=>k.selected);this.updateLabelState(N,{selected:j,values:K},"",()=>this.doFacetting(N))},this.onClickValidate=()=>{const N=M(this.state.labels);this.validateSelector(N)},this.doFacetting=N=>{const V=M(this.state.labels);if(V===b){const G=this.state.labels.map(_=>({..._,facets:0,values:void 0,hidden:!1}));this.setState({labels:G},()=>{this.state.labels.forEach(_=>(_.selected||_.name===C)&&this.fetchValues(_.name,V))})}else this.fetchSeries(V,N)}}updateLabelState(N,V,G="",_){this.setState(K=>{const j=K.labels.map(Y=>Y.name===N?{...Y,...V}:Y),k=G?"":K.error;return{labels:j,status:G,error:k,validationStatus:""}},_)}componentDidMount(){const{languageProvider:N,lastUsedLabels:V}=this.props;if(N){const G=V;N.start(this.props.timeRange).then(()=>{let _=N.getLabelKeys();this.fetchValues(C,b);const K=_.map((j,k,Y)=>({name:j,selected:G.includes(j),loading:!1}));this.setState({labels:K},()=>{this.state.labels.forEach(j=>{j.selected&&this.fetchValues(j.name,b)})})})}}doFacettingForLabel(N){const V=this.state.labels.find(_=>_.name===N);if(!V)return;const G=this.state.labels.filter(_=>_.selected).map(_=>_.name);this.props.storeLastUsedLabels(G),V.selected?V.values||this.fetchValues(N,M(this.state.labels)):this.doFacetting()}async fetchValues(N,V){const{languageProvider:G}=this.props;this.updateLabelState(N,{loading:!0},`Fetching values for ${N}`);try{let _=await G.getLabelValues(N);if(V!==M(this.state.labels)){this.updateLabelState(N,{loading:!1});return}const K=[],{metricsMetadata:j}=G;for(const k of _){const Y={name:k};if(N===C&&j){const ee=j[k];ee&&(Y.details=`(${ee.type}) ${ee.help}`)}K.push(Y)}this.updateLabelState(N,{values:K,loading:!1})}catch(_){console.error(_)}}async fetchSeries(N,V){const{languageProvider:G}=this.props;V&&this.updateLabelState(V,{loading:!0},`Facetting labels for ${N}`);try{const _=await G.fetchSeriesLabels(N,!0);if(N!==M(this.state.labels)){V&&this.updateLabelState(V,{loading:!1});return}if(Object.keys(_).length===0){this.setState({error:`Empty results, no matching label for ${N}`});return}const K=T(this.state.labels,_,V);this.setState({labels:K,error:""}),V&&this.updateLabelState(V,{loading:!1})}catch(_){console.error(_)}}async validateSelector(N){const{languageProvider:V}=this.props;this.setState({validationStatus:`Validating selector ${N}`,error:""});const G=await V.fetchSeries(N);this.setState({validationStatus:`Selector is valid (${G.length} series found)`})}render(){const{theme:N}=this.props,{labels:V,labelSearchTerm:G,metricSearchTerm:_,status:K,error:j,validationStatus:k,valueSearchTerm:Y}=this.state,ee=I(N);if(V.length===0)return n.createElement("div",{className:ee.wrapper},n.createElement(m._,{text:"Loading labels..."}));let re=V.find(ue=>ue.name===C);re&&_&&(re={...re,values:re.values?.filter(ue=>ue.selected||ue.name.includes(_))});let J=V.filter(ue=>!ue.hidden&&ue.name!==C);G&&(J=J.filter(ue=>ue.selected||ue.name.includes(G)));let ne=J.filter(ue=>ue.selected&&ue.values);Y&&(ne=ne.map(ue=>({...ue,values:ue.values?.filter(ie=>ie.selected||ie.name.includes(Y))})));const q=M(this.state.labels),te=q===b,oe=re?.values?.length||0;return n.createElement("div",{className:ee.wrapper},n.createElement(a.Gy,{align:"flex-start",spacing:"lg"},n.createElement("div",null,n.createElement("div",{className:ee.section},n.createElement(v.J,{description:"Once a metric is selected only possible labels are shown."},"1. Select a metric"),n.createElement("div",null,n.createElement(E.p,{onChange:this.onChangeMetricSearch,"aria-label":"Filter expression for metric",value:_,"data-testid":s.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.selectMetric})),n.createElement("div",{role:"list",className:ee.valueListWrapper,"data-testid":s.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.metricList},n.createElement(h.Y1,{height:Math.min(450,oe*y),itemCount:oe,itemSize:y,itemKey:ue=>re.values[ue].name,width:300,className:ee.valueList},({index:ue,style:ie})=>{const ge=re?.values?.[ue];return ge?n.createElement("div",{style:ie},n.createElement(D.J,{name:re.name,value:ge?.name,title:ge.details,active:ge?.selected,onClick:this.onClickMetric,searchTerm:_})):null})))),n.createElement("div",null,n.createElement("div",{className:ee.section},n.createElement(v.J,{description:"Once label values are selected, only possible label combinations are shown."},"2. Select labels to search in"),n.createElement("div",null,n.createElement(E.p,{onChange:this.onChangeLabelSearch,"aria-label":"Filter expression for label",value:G,"data-testid":s.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.labelNamesFilter})),n.createElement("div",{className:ee.list,style:{height:120}},J.map(ue=>n.createElement(D.J,{key:ue.name,name:ue.name,loading:ue.loading,active:ue.selected,hidden:ue.hidden,facets:ue.facets,onClick:this.onClickLabel,searchTerm:G})))),n.createElement("div",{className:ee.section},n.createElement(v.J,{description:"Use the search field to find values across selected labels."},"3. Select (multiple) values for your labels"),n.createElement("div",null,n.createElement(E.p,{onChange:this.onChangeValueSearch,"aria-label":"Filter expression for label values",value:Y,"data-testid":s.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.labelValuesFilter})),n.createElement("div",{className:ee.valueListArea,ref:this.valueListsRef},ne.map(ue=>n.createElement("div",{role:"list",key:ue.name,"aria-label":`Values for ${ue.name}`,className:ee.valueListWrapper},n.createElement("div",{className:ee.valueTitle},n.createElement(D.J,{name:ue.name,loading:ue.loading,active:ue.selected,hidden:ue.hidden,facets:ue.facets||ue.values?.length,onClick:this.onClickLabel})),n.createElement(h.Y1,{height:Math.min(200,y*(ue.values?.length||0)),itemCount:ue.values?.length||0,itemSize:28,itemKey:ie=>ue.values[ie].name,width:200,className:ee.valueList},({index:ie,style:ge})=>{const he=ue.values?.[ie];return he?n.createElement("div",{style:ge},n.createElement(D.J,{name:ue.name,value:he?.name,active:he?.selected,onClick:this.onClickValue,searchTerm:Y})):null}))))))),n.createElement("div",{className:ee.section},n.createElement(v.J,null,"4. Resulting selector"),n.createElement("div",{"aria-label":"selector",className:ee.selector},q),k&&n.createElement("div",{className:ee.validationStatus},k),n.createElement(a.Gy,null,n.createElement(u.$n,{"data-testid":s.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.useQuery,"aria-label":"Use selector for query button",disabled:te,onClick:this.onClickRunQuery},"Use query"),n.createElement(u.$n,{"data-testid":s.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.useAsRateQuery,"aria-label":"Use selector as metrics button",variant:"secondary",disabled:te,onClick:this.onClickRunRateQuery},"Use as rate query"),n.createElement(u.$n,{"data-testid":s.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.validateSelector,"aria-label":"Validate submit button",variant:"secondary",disabled:te,onClick:this.onClickValidate},"Validate selector"),n.createElement(u.$n,{"data-testid":s.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.clear,"aria-label":"Selector clear button",variant:"secondary",onClick:this.onClickClear},"Clear"),n.createElement("div",{className:(0,t.cx)(ee.status,(K||j)&&ee.statusShowing)},n.createElement("span",{className:j?ee.error:""},j||K)))))}}const S=(0,c.cV)(x),O=n.lazy(()=>e.e(8325).then(e.bind(e,29049))),P=w=>n.createElement(n.Suspense,{fallback:null},n.createElement(O,{...w})),L=w=>{const N=(0,n.useRef)(null),{onRunQuery:V,onChange:G,..._}=w,K=Y=>{N.current=Y,G(Y),V()},j=Y=>{G(Y)},k=Y=>{G(Y)};return n.createElement(P,{onChange:k,onRunQuery:K,onBlur:j,..._})},U="grafana.datasources.prometheus.browser.labels";function R(w,N,V){return w?"(Disabled)":N?V?"Metrics browser":"(No metrics found)":"Loading metrics..."}class B extends n.PureComponent{constructor(N){super(N),this.refreshHint=()=>{const{datasource:V,query:G,data:_}=this.props,K=V.getInitHints(),j=K.length>0?K[0]:null;if(!_||_.series.length===0){this.setState({hint:j});return}const k=(0,o.ci)(_.series[0])?_.series.map(o.w3):_.series,Y=V.getQueryHints(G,k);let ee=Y.length>0?Y[0]:null;this.setState({hint:ee??j})},this.refreshMetrics=async()=>{const{range:V,datasource:{languageProvider:G}}=this.props;this.languageProviderInitializationPromise=f(G.start(V));try{const _=await this.languageProviderInitializationPromise.promise;await Promise.all(_),this.onUpdateLanguage()}catch(_){if(!(l(_)&&_.isCanceled))throw _}},this.onChangeLabelBrowser=V=>{this.onChangeQuery(V,!0),this.setState({labelBrowserVisible:!1})},this.onChangeQuery=(V,G)=>{const{query:_,onChange:K,onRunQuery:j}=this.props;if(K){const k={..._,expr:V};K(k),G&&j&&j()}},this.onClickChooserButton=()=>{this.setState(V=>({labelBrowserVisible:!V.labelBrowserVisible})),(0,r.rR)("user_grafana_prometheus_metrics_browser_clicked",{editorMode:this.state.labelBrowserVisible?"metricViewClosed":"metricViewOpen",app:this.props?.app??""})},this.onClickHintFix=()=>{const{datasource:V,query:G,onChange:_,onRunQuery:K}=this.props,{hint:j}=this.state;j?.fix?.action&&_(V.modifyQuery(G,j.fix.action)),K()},this.onUpdateLanguage=()=>{const{datasource:{languageProvider:V}}=this.props,{metrics:G}=V;G&&this.setState({syntaxLoaded:!0})},this.state={labelBrowserVisible:!1,syntaxLoaded:!1,hint:null}}componentDidMount(){this.props.datasource.languageProvider&&this.refreshMetrics(),this.refreshHint()}componentWillUnmount(){this.languageProviderInitializationPromise&&this.languageProviderInitializationPromise.cancel()}componentDidUpdate(N){const{data:V,datasource:{languageProvider:G},range:_}=this.props;G!==N.datasource.languageProvider&&this.setState({syntaxLoaded:!1});const K=this.rangeChangedToRefresh(_,N.range);(G!==N.datasource.languageProvider||K)&&this.refreshMetrics(),V&&N.data&&N.data.series!==V.series&&this.refreshHint()}rangeChangedToRefresh(N,V){if(N&&V){const G=(0,d.eN)(N.from.valueOf())===(0,d.eN)(V.from.valueOf()),_=(0,d.eN)(N.to.valueOf())===(0,d.eN)(V.to.valueOf());return!(G&&_)}return!1}render(){const{datasource:N,datasource:{languageProvider:V},query:G,ExtraFieldElement:_,history:K=[],theme:j}=this.props,{labelBrowserVisible:k,syntaxLoaded:Y,hint:ee}=this.state,re=V.metrics.length>0,J=R(N.lookupsDisabled,Y,re),ne=!(Y&&re);return n.createElement(i.b,{storageKey:U,defaultValue:[]},(q,te,oe)=>n.createElement(n.Fragment,null,n.createElement("div",{className:"gf-form-inline gf-form-inline--xs-view-flex-column flex-grow-1","data-testid":this.props["data-testid"]},n.createElement("button",{className:"gf-form-label query-keyword pointer",onClick:this.onClickChooserButton,disabled:ne,type:"button","data-testid":s.Tp.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.openButton},J,n.createElement(g.I,{name:k?"angle-down":"angle-right"})),n.createElement("div",{className:"gf-form gf-form--grow flex-shrink-1 min-width-15"},n.createElement(L,{languageProvider:V,history:K,onChange:this.onChangeQuery,onRunQuery:this.props.onRunQuery,initialValue:G.expr??"",placeholder:"Enter a PromQL query\u2026",datasource:N}))),k&&n.createElement("div",{className:"gf-form"},n.createElement(S,{languageProvider:V,onChange:this.onChangeLabelBrowser,lastUsedLabels:q||[],storeLastUsedLabels:te,deleteLastUsedLabels:oe,timeRange:this.props.range})),_,ee?n.createElement("div",{className:"query-row-break"},n.createElement("div",{className:"prom-query-field-info text-warning"},ee.label," ",ee.fix?n.createElement("button",{type:"button",className:(0,t.cx)((0,u.my)(j),"text-link","muted"),onClick:this.onClickHintFix},ee.fix.label):null)):null))}}const H=(0,c.cV)(B)},4253:(Q,A,e)=>{"use strict";e.d(A,{_p:()=>Ge,k1:()=>He,jW:()=>xe,Zh:()=>be,TT:()=>$e});var t=e(32196),n=e(96540),o=e(97899),s=e(68704),r=e(91062),g=e(40845),u=e(42418),c=e(91409),i=e(72093),l=e(2913),f=e(13544),d=e(29020),h=e(32264),p=e(14186),m=e(15292);function a({options:Z,onOptionsChange:ae}){const de=(0,g.$j)(),ve=be(de),Ue=h.$.featureToggles.prometheusConfigOverhaulAuth;return n.createElement(d.I,{title:"Alerting",className:(0,t.cx)(ve.container,{[ve.alertingTop]:Ue})},n.createElement("div",{className:"gf-form-group"},n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(p.I,{labelWidth:30,label:"Manage alerts via Alerting UI",disabled:Z.readOnly,tooltip:n.createElement(n.Fragment,null,"Manage alert rules for this data source. To manage other alerting resources, add an Alertmanager data source. ",xe()),interactive:!0,className:ve.switchField},n.createElement(m.d,{value:Z.jsonData.manageAlerts!==!1,onChange:_e=>ae({...Z,jsonData:{...Z.jsonData,manageAlerts:_e.currentTarget.checked}}),id:f.Tp.components.DataSource.Prometheus.configPage.manageAlerts}))))))}var v=e(94701),E=e(39268),D=e(10354),b=(Z=>(Z.Public="AzureCloud",Z.China="AzureChinaCloud",Z.USGovernment="AzureUSGovernment",Z.None="",Z))(b||{});const C=[{value:"AzureCloud",label:"Azure"},{value:"AzureChinaCloud",label:"Azure China"},{value:"AzureUSGovernment",label:"Azure US Government"}];function y(Z){switch(Z.authType){case"msi":case"workloadidentity":return!0;case"clientsecret":return!!(Z.azureCloud&&Z.tenantId&&Z.clientId&&Z.clientSecret)}}const M=Symbol("Concealed client secret");function T(){return h.$.azure.cloud||b.Public}function I(Z){if(Z.secureJsonFields.azureClientSecret)return M;{const ae=Z.secureJsonData?.azureClientSecret;return typeof ae=="string"&&ae.length>0?ae:void 0}}function x(Z){return!!Z.jsonData.azureCredentials}function S(){return h.$.azure.managedIdentityEnabled?{authType:"msi"}:{authType:"clientsecret",azureCloud:T()}}function O(Z){const ae=Z.jsonData.azureCredentials;if(!ae)return S();switch(ae.authType){case"msi":case"workloadidentity":return ae.authType==="msi"&&h.$.azure.managedIdentityEnabled||ae.authType==="workloadidentity"&&h.$.azure.workloadIdentityEnabled?{authType:ae.authType}:{authType:"clientsecret",azureCloud:T()};case"clientsecret":return{authType:"clientsecret",azureCloud:ae.azureCloud||T(),tenantId:ae.tenantId,clientId:ae.clientId,clientSecret:I(Z)}}}function P(Z,ae){switch(ae.authType){case"msi":case"workloadidentity":if(ae.authType==="msi"&&!h.$.azure.managedIdentityEnabled)throw new Error("Managed Identity authentication is not enabled in Grafana config.");if(ae.authType==="workloadidentity"&&!h.$.azure.workloadIdentityEnabled)throw new Error("Workload Identity authentication is not enabled in Grafana config.");return Z={...Z,jsonData:{...Z.jsonData,azureAuthType:ae.authType,azureCredentials:{authType:ae.authType}}},Z;case"clientsecret":return Z={...Z,jsonData:{...Z.jsonData,azureCredentials:{authType:"clientsecret",azureCloud:ae.azureCloud||T(),tenantId:ae.tenantId,clientId:ae.clientId}},secureJsonData:{...Z.secureJsonData,azureClientSecret:typeof ae.clientSecret=="string"&&ae.clientSecret.length>0?ae.clientSecret:void 0},secureJsonFields:{...Z.secureJsonFields,azureClientSecret:typeof ae.clientSecret=="symbol"}},Z}}function L(Z){return{jsonData:{...Z.jsonData,azureCredentials:S()}}}function U(Z){return{jsonData:{...Z.jsonData,azureAuth:void 0,azureCredentials:void 0,azureEndpointResourceId:void 0}}}var R=e(38894),B=e(88323),H=e(55852);const w=Z=>{const{credentials:ae,azureCloudOptions:de,onCredentialsChange:ve,getSubscriptions:Ue,disabled:_e,managedIdentityEnabled:ze,workloadIdentityEnabled:Ve}=Z,Ne=y(ae),[ot,nt]=(0,n.useState)([]),[pt,mt]=(0,n.useReducer)(yt=>yt+1,0),gt=(0,n.useMemo)(()=>{let yt=[{value:"clientsecret",label:"App Registration"}];return ze&&yt.push({value:"msi",label:"Managed Identity"}),Ve&&yt.push({value:"workloadidentity",label:"Workload Identity"}),yt},[ze,Ve]);(0,n.useEffect)(()=>{if(!Ue||!Ne){Pt([]);return}let yt=!1;return Ue().then(jt=>{yt||Pt(jt,pt)}),()=>{yt=!0}},[pt]);const Pt=(yt,jt=!1)=>{nt(yt),Ue&&(jt&&!ae.defaultSubscriptionId&&yt.length>0?Dn(yt[0]):ae.defaultSubscriptionId&&(yt.find(pn=>pn.value===ae.defaultSubscriptionId)||Dn(void 0)))},Mt=yt=>{nt([]);const jt=ze?"msi":Ve?"workloadidentity":"clientsecret",cn={...ae,authType:yt.value||jt,defaultSubscriptionId:void 0};ve(cn)},Yt=yt=>{if(ae.authType==="clientsecret"){nt([]);const jt={...ae,azureCloud:yt.value,defaultSubscriptionId:void 0};ve(jt)}},zt=yt=>{if(ae.authType==="clientsecret"){nt([]);const jt={...ae,tenantId:yt.target.value,defaultSubscriptionId:void 0};ve(jt)}},_t=yt=>{if(ae.authType==="clientsecret"){nt([]);const jt={...ae,clientId:yt.target.value,defaultSubscriptionId:void 0};ve(jt)}},rt=yt=>{if(ae.authType==="clientsecret"){nt([]);const jt={...ae,clientSecret:yt.target.value,defaultSubscriptionId:void 0};ve(jt)}},It=()=>{if(ae.authType==="clientsecret"){nt([]);const yt={...ae,clientSecret:"",defaultSubscriptionId:void 0};ve(yt)}},Dn=yt=>{const jt={...ae,defaultSubscriptionId:yt?.value};ve(jt)},ft=h.$.featureToggles.prometheusConfigOverhaulAuth;return n.createElement("div",{className:"gf-form-group"},gt.length>1&&n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(R.I,{className:"width-12",tooltip:"Choose the type of authentication to Azure services"},"Authentication"),n.createElement(B.l6,{className:"width-15",value:gt.find(yt=>yt.value===ae.authType),options:gt,onChange:Mt,isDisabled:_e}))),ae.authType==="clientsecret"&&n.createElement(n.Fragment,null,de&&n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(R.I,{className:"width-12",tooltip:"Choose an Azure Cloud"},"Azure Cloud"),n.createElement(B.l6,{className:"width-15",value:de.find(yt=>yt.value===ae.azureCloud),options:de,onChange:Yt,isDisabled:_e}))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(R.I,{className:"width-12"},"Directory (tenant) ID"),n.createElement("div",{className:"width-15"},n.createElement(D.p,{className:(0,t.cx)(ft?"width-20":"width-30"),placeholder:"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",value:ae.tenantId||"",onChange:zt,disabled:_e})))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(R.I,{className:"width-12"},"Application (client) ID"),n.createElement("div",{className:"width-15"},n.createElement(D.p,{className:(0,t.cx)(ft?"width-20":"width-30"),placeholder:"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",value:ae.clientId||"",onChange:_t,disabled:_e})))),typeof ae.clientSecret=="symbol"?n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(R.I,{htmlFor:"azure-client-secret",className:"width-12"},"Client Secret"),n.createElement(D.p,{id:"azure-client-secret",className:(0,t.cx)(ft?"width-20":"width-25"),placeholder:"configured",disabled:!0})),!_e&&n.createElement("div",{className:"gf-form"},n.createElement("div",{className:(0,t.cx)(ft?"max-width-20 gf-form-inline":"max-width-30 gf-form-inline")},n.createElement(H.$n,{variant:"secondary",type:"button",onClick:It},"reset")))):n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(R.I,{className:"width-12"},"Client Secret"),n.createElement("div",{className:"width-15"},n.createElement(D.p,{className:(0,t.cx)(ft?"width-20":"width-30"),placeholder:"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",value:ae.clientSecret||"",onChange:rt,disabled:_e}))))),Ue&&n.createElement(n.Fragment,null,n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(R.I,{className:"width-12"},"Default Subscription"),n.createElement("div",{className:(0,t.cx)(ft?"width-20":"width-25")},n.createElement(B.l6,{value:ae.defaultSubscriptionId?ot.find(yt=>yt.value===ae.defaultSubscriptionId):void 0,options:ot,onChange:Dn,isDisabled:_e})))),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(H.$n,{variant:"secondary",size:"sm",type:"button",onClick:mt,disabled:!Ne},"Load Subscriptions"))))))},N=null,V=Z=>{const{dataSourceConfig:ae,onChange:de}=Z,[ve]=(0,n.useState)(!!h.$.featureToggles.prometheusAzureOverrideAudience),[Ue,_e]=(0,n.useState)(!!ae.jsonData.azureEndpointResourceId),ze=(0,n.useMemo)(()=>O(ae),[ae]),Ve=mt=>{de(P(ae,mt))},Ne=mt=>{_e(mt.currentTarget.checked),mt.currentTarget.checked||de({...ae,jsonData:{...ae.jsonData,azureEndpointResourceId:void 0}})},ot=mt=>{Ue&&de({...ae,jsonData:{...ae.jsonData,azureEndpointResourceId:mt.currentTarget.value}})},nt=h.$.featureToggles.prometheusConfigOverhaulAuth,pt=nt?24:26;return(0,v.A)(()=>{ae.jsonData.authType||Ve(ze)}),n.createElement(n.Fragment,null,n.createElement("h6",null,"Azure authentication"),n.createElement(w,{managedIdentityEnabled:h.$.azure.managedIdentityEnabled,workloadIdentityEnabled:h.$.azure.workloadIdentityEnabled,credentials:ze,azureCloudOptions:C,onCredentialsChange:Ve,disabled:ae.readOnly}),ve&&n.createElement(n.Fragment,null,n.createElement("h6",null,"Azure configuration"),n.createElement("div",{className:"gf-form-group"},n.createElement(E.C,null,n.createElement(p.I,{labelWidth:pt,label:"Override AAD audience",disabled:ae.readOnly},n.createElement(m.K,{value:Ue,onChange:Ne}))),Ue&&n.createElement(E.C,null,n.createElement(p.I,{labelWidth:pt,label:"Resource ID",disabled:ae.readOnly},n.createElement(D.p,{className:(0,t.cx)(nt?"width-20":"width-30"),value:ae.jsonData.azureEndpointResourceId||"",onChange:ot}))))))},G=null;var _=e(66025),K=e(77657),j=e(17466),k=e(67861),Y=e(17081);const ee=Z=>{const{options:ae,onOptionsChange:de,azureAuthSettings:ve,sigV4AuthToggleEnabled:Ue,renderSigV4Editor:_e,secureSocksDSProxyEnabled:ze}=Z,Ve=(0,_.pe)({config:ae,onChange:de}),Ne=(0,g.$j)(),ot=be(Ne);let nt=[];const[pt,mt]=(0,n.useState)(ae.jsonData.sigV4Auth||!1),gt="custom-sigV4Id",Pt={id:gt,label:"SigV4 auth",description:"This is SigV4 auth description",component:n.createElement(n.Fragment,null,_e)};Ue&&nt.push(Pt);const Mt=ve?.azureAuthSupported&&ve.getAzureAuthEnabled(ae)||!1,[Yt,zt]=(0,n.useState)(Mt),_t="custom-azureAuthId",rt={id:_t,label:"Azure auth",description:"This is Azure auth description",component:n.createElement(n.Fragment,null,ve.azureSettingsUI&&n.createElement(ve.azureSettingsUI,{dataSourceConfig:ae,onChange:de}))};ve?.azureAuthSupported&&nt.push(rt);function It(){return pt?gt:Yt?_t:Ve.selectedMethod}let Dn;switch(ae.access){case"direct":Dn=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.",xe());break;case"proxy":Dn=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.",xe());break;default:Dn=n.createElement(n.Fragment,null,"Specify a complete HTTP URL (for example http://your_server:8080) ",xe())}return n.createElement(n.Fragment,null,n.createElement(K.u,{urlPlaceholder:"http://localhost:9090",config:ae,onChange:de,urlLabel:"Prometheus server URL",urlTooltip:Dn}),n.createElement("hr",{className:`${ot.hrTopSpace} ${ot.hrBottomSpace}`}),n.createElement(j.N,{...Ve,customMethods:nt,onAuthMethodSelect:ft=>{Ue&&mt(ft===gt),ve?.azureAuthSupported&&(zt(ft===_t),ve.setAzureAuthEnabled(ae,ft===_t)),de({...ae,basicAuth:ft===k.q.BasicAuth,withCredentials:ft===k.q.CrossSiteCredentials,jsonData:{...ae.jsonData,sigV4Auth:ft===gt,oauthPassThru:ft===k.q.OAuthForward}})},selectedMethod:It()}),n.createElement("div",{className:ot.sectionBottomPadding}),ze&&n.createElement(n.Fragment,null,n.createElement(Y.Y,{options:ae,onOptionsChange:de}),n.createElement("div",{className:ot.sectionBottomPadding})))};var re=e(97716),J=e.n(re),ne=e(22391),q=e(17172),te=e(85464),oe=e(35146),ue=e(30915),ie=e(69120),ge=e(51612);function he({value:Z,onChange:ae,onDelete:de,disabled:ve}){const[Ue,_e]=(0,n.useState)(!!Z.datasourceUid),ze=(0,g.$j)(),Ve=be(ze);return n.createElement("div",{className:"gf-form-group"},n.createElement(p.I,{label:"Internal link",labelWidth:He,disabled:ve,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. ",xe()),interactive:!0,className:Ve.switchField},n.createElement(n.Fragment,null,n.createElement(m.d,{value:Ue,"data-testid":f.Tp.components.DataSource.Prometheus.configPage.internalLinkSwitch,onChange:Ne=>_e(Ne.currentTarget.checked)}))),Ue?n.createElement(p.I,{label:"Data source",labelWidth:He,tooltip:n.createElement(n.Fragment,null,"The data source the exemplar is going to navigate to. ",xe()),disabled:ve,interactive:!0},n.createElement(ge.s,{tracing:!0,current:Z.datasourceUid,noDefault:!0,width:40,onChange:Ne=>ae({...Z,datasourceUid:Ne.uid,url:void 0})})):n.createElement(p.I,{label:"URL",labelWidth:He,tooltip:n.createElement(n.Fragment,null,"The URL of the trace backend the user would go to see its trace. ",xe()),disabled:ve,interactive:!0},n.createElement(D.p,{placeholder:"https://example.com/${__value.raw}",spellCheck:!1,width:40,value:Z.url,onChange:Ne=>ae({...Z,datasourceUid:void 0,url:Ne.currentTarget.value})})),n.createElement(p.I,{label:"URL Label",labelWidth:He,tooltip:n.createElement(n.Fragment,null,"Use to override the button label on the exemplar traceID field. ",xe()),disabled:ve,interactive:!0},n.createElement(D.p,{placeholder:"Go to example.com",spellCheck:!1,width:40,value:Z.urlDisplayLabel,onChange:Ne=>ae({...Z,urlDisplayLabel:Ne.currentTarget.value})})),n.createElement(p.I,{label:"Label name",labelWidth:He,tooltip:n.createElement(n.Fragment,null,"The name of the field in the labels object that should be used to get the traceID. ",xe()),disabled:ve,interactive:!0},n.createElement(D.p,{placeholder:"traceID",spellCheck:!1,width:40,value:Z.name,onChange:Ne=>ae({...Z,name:Ne.currentTarget.value})})),!ve&&n.createElement(p.I,{label:"Remove exemplar link",labelWidth:He,disabled:ve},n.createElement(H.$n,{variant:"destructive",title:"Remove exemplar link",icon:"times",onClick:Ne=>{Ne.preventDefault(),de()}})))}function De({options:Z,onChange:ae,disabled:de}){const ve=(0,g.$j)(),Ue=be(ve);return n.createElement("div",{className:Ue.sectionBottomPadding},n.createElement(d.I,{title:"Exemplars",className:Ue.container},Z&&Z.map((_e,ze)=>n.createElement(he,{key:ze,value:_e,onChange:Ve=>{const Ne=[...Z];Ne.splice(ze,1,Ve),ae(Ne)},onDelete:()=>{const Ve=[...Z];Ve.splice(ze,1),ae(Ve)},disabled:de})),!de&&n.createElement(H.$n,{variant:"secondary","data-testid":f.Tp.components.DataSource.Prometheus.configPage.exemplarsAddButton,className:(0,t.css)` margin-bottom: 10px; `,icon:"plus",onClick:_e=>{_e.preventDefault();const ze=[...Z||[],{name:"traceID"}];ae(ze)}},"Add"),de&&!Z&&n.createElement("i",null,"No exemplars configurations")))}const pe={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"}]},le=[{value:"POST",label:"POST"},{value:"GET",label:"GET"}],Te=[{value:oe.f.Builder,label:"Builder"},{value:oe.f.Code,label:"Code"}],Ee=[{value:ie.fD.Low,label:"Low"},{value:ie.fD.Medium,label:"Medium"},{value:ie.fD.High,label:"High"},{value:ie.fD.None,label:"None"}],Re=[{value:ie.N1.Prometheus,label:ie.N1.Prometheus},{value:ie.N1.Cortex,label:ie.N1.Cortex},{value:ie.N1.Mimir,label:ie.N1.Mimir},{value:ie.N1.Thanos,label:ie.N1.Thanos}],me=/^$|^\d+(ms|[Mwdhmsy])$/,Me=/(\d+)(.+)/,ye="Value is not valid, you can use number with time unit specifier: y, M, w, d, h, m, s",Le=(Z,ae)=>{if(!ae||!pe[ae])return;const ve=pe[ae]?.filter(_e=>!!_e.value&&J().lte(_e.value,Z)).map(_e=>_e.value),Ue=ve[ve.length-1];if(Ue){const _e=J().diff(Ue,Z);if(["patch","prepatch","prerelease",null].includes(_e))return Ue}},We=Z=>{console.warn("Error fetching version from buildinfo API, must manually select version!",Z)},Be=(Z,ae,de)=>{de(Z).then(ve=>{(0,q.AI)().get(`/api/datasources/uid/${ve.uid}/resources/version-detect`).then(Ue=>{const _e=Ue.data?.version??"";if(_e&&J().valid(_e)){const ze=Le(_e,ve.jsonData.prometheusType);ze&&de({...ve,jsonData:{...ve.jsonData,prometheusVersion:ze}}).then(Ve=>{ae(Ve)})}else We()})}).catch(ve=>{We(ve)})},Ye=Z=>{const{options:ae,onOptionsChange:de}=Z,ve=(0,te.k9)();ae.jsonData.httpMethod||(ae.jsonData.httpMethod="POST");const Ue=(0,g.$j)(),_e=be(Ue),[ze,Ve]=(0,n.useState)({timeInterval:"",queryTimeout:"",incrementalQueryOverlapWindow:""});return n.createElement(n.Fragment,null,n.createElement(d.I,{title:"Interval behaviour",className:_e.container},n.createElement("div",{className:"gf-form-group"},n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(p.I,{label:"Scrape interval",labelWidth:He,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. ",xe()),interactive:!0,disabled:ae.readOnly},n.createElement(n.Fragment,null,n.createElement(D.p,{className:"width-20",value:ae.jsonData.timeInterval,spellCheck:!1,placeholder:"15s",onChange:st("timeInterval",ae,de),onBlur:Ne=>Ve({...ze,timeInterval:Ne.currentTarget.value}),"data-testid":f.Tp.components.DataSource.Prometheus.configPage.scrapeInterval}),$e(ze.timeInterval,me,ye))))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(p.I,{label:"Query timeout",labelWidth:He,tooltip:n.createElement(n.Fragment,null,"Set the Prometheus query timeout. ",xe()),interactive:!0,disabled:ae.readOnly},n.createElement(n.Fragment,null,n.createElement(D.p,{className:"width-20",value:ae.jsonData.queryTimeout,onChange:st("queryTimeout",ae,de),spellCheck:!1,placeholder:"60s",onBlur:Ne=>Ve({...ze,queryTimeout:Ne.currentTarget.value}),"data-testid":f.Tp.components.DataSource.Prometheus.configPage.queryTimeout}),$e(ze.queryTimeout,me,ye))))))),n.createElement(d.I,{title:"Query editor",className:_e.container},n.createElement("div",{className:"gf-form-group"},n.createElement("div",{className:"gf-form"},n.createElement(p.I,{label:"Default editor",labelWidth:He,tooltip:n.createElement(n.Fragment,null,"Set default editor option for all users of this data source. ",xe()),interactive:!0,disabled:ae.readOnly},n.createElement(B.l6,{"aria-label":"Default Editor (Code or Builder)",options:Te,value:Te.find(Ne=>Ne.value===ae.jsonData.defaultEditor)??Te.find(Ne=>Ne.value===oe.f.Builder),onChange:st("defaultEditor",ae,de),width:40,"data-testid":f.Tp.components.DataSource.Prometheus.configPage.defaultEditor}))),n.createElement("div",{className:"gf-form"},n.createElement(p.I,{labelWidth:He,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."," ",xe()),interactive:!0,disabled:ae.readOnly,className:_e.switchField},n.createElement(m.d,{value:ae.jsonData.disableMetricsLookup??!1,onChange:(0,ne.EX)(Z,"disableMetricsLookup"),id:f.Tp.components.DataSource.Prometheus.configPage.disableMetricLookup}))))),n.createElement(d.I,{title:"Performance",className:_e.container},!ae.jsonData.prometheusType&&!ae.jsonData.prometheusVersion&&ae.readOnly&&n.createElement("div",{className:_e.versionMargin},"For more information on configuring prometheus type and version in data sources, see the"," ",n.createElement("a",{className:_e.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.I,{label:"Prometheus type",labelWidth:He,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 supports or does 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. ",xe()),interactive:!0,disabled:ae.readOnly},n.createElement(B.l6,{"aria-label":"Prometheus type",options:Re,value:Re.find(Ne=>Ne.value===ae.jsonData.prometheusType),onChange:st("prometheusType",{...ae,jsonData:{...ae.jsonData,prometheusVersion:void 0}},Ne=>(Be(Ne,de,ve),de({...Ne,jsonData:{...Ne.jsonData,prometheusVersion:void 0}}))),width:40,"data-testid":f.Tp.components.DataSource.Prometheus.configPage.prometheusType})))),n.createElement("div",{className:"gf-form-inline"},ae.jsonData.prometheusType&&n.createElement("div",{className:"gf-form"},n.createElement(p.I,{label:`${ae.jsonData.prometheusType} version`,labelWidth:He,tooltip:n.createElement(n.Fragment,null,"Use this to set the version of your ",ae.jsonData.prometheusType," instance if it is not automatically configured. ",xe()),interactive:!0,disabled:ae.readOnly},n.createElement(B.l6,{"aria-label":`${ae.jsonData.prometheusType} type`,options:pe[ae.jsonData.prometheusType],value:pe[ae.jsonData.prometheusType]?.find(Ne=>Ne.value===ae.jsonData.prometheusVersion),onChange:st("prometheusVersion",ae,de),width:40,"data-testid":f.Tp.components.DataSource.Prometheus.configPage.prometheusVersion})))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form max-width-30"},n.createElement(p.I,{label:"Cache level",labelWidth:He,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:ae.readOnly},n.createElement(B.l6,{width:40,onChange:st("cacheLevel",ae,de),options:Ee,value:Ee.find(Ne=>Ne.value===ae.jsonData.cacheLevel)??ie.fD.Low,"data-testid":f.Tp.components.DataSource.Prometheus.configPage.cacheLevel})))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form max-width-30"},n.createElement(p.I,{label:"Incremental querying (beta)",labelWidth:He,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:_e.switchField,disabled:ae.readOnly},n.createElement(m.d,{value:ae.jsonData.incrementalQuerying??!1,onChange:(0,ne.EX)(Z,"incrementalQuerying"),id:f.Tp.components.DataSource.Prometheus.configPage.incrementalQuerying})))),n.createElement("div",{className:"gf-form-inline"},ae.jsonData.incrementalQuerying&&n.createElement(p.I,{label:"Query overlap window",labelWidth:He,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:ae.readOnly},n.createElement(n.Fragment,null,n.createElement(D.p,{onBlur:Ne=>Ve({...ze,incrementalQueryOverlapWindow:Ne.currentTarget.value}),className:"width-20",value:ae.jsonData.incrementalQueryOverlapWindow??ue.Dr,onChange:st("incrementalQueryOverlapWindow",ae,de),spellCheck:!1,"data-testid":f.Tp.components.DataSource.Prometheus.configPage.queryOverlapWindow}),$e(ze.incrementalQueryOverlapWindow,Me,ye)))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form max-width-30"},n.createElement(p.I,{label:"Disable recording rules (beta)",labelWidth:He,tooltip:n.createElement(n.Fragment,null,"This feature will disable recording rules. Turn this on to improve dashboard performance"),interactive:!0,className:_e.switchField,disabled:ae.readOnly},n.createElement(m.d,{value:ae.jsonData.disableRecordingRules??!1,onChange:(0,ne.EX)(Z,"disableRecordingRules"),id:f.Tp.components.DataSource.Prometheus.configPage.disableRecordingRules})))))),n.createElement(d.I,{title:"Other",className:_e.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.I,{label:"Custom query parameters",labelWidth:He,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. ",xe()),interactive:!0,disabled:ae.readOnly},n.createElement(D.p,{className:"width-20",value:ae.jsonData.customQueryParameters,onChange:st("customQueryParameters",ae,de),spellCheck:!1,placeholder:"Example: max_source_resolution=5m&timeout=10","data-testid":f.Tp.components.DataSource.Prometheus.configPage.customQueryParameters})))),n.createElement("div",{className:"gf-form-inline"},n.createElement("div",{className:"gf-form"},n.createElement(p.I,{labelWidth:He,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. ",xe()),interactive:!0,label:"HTTP method",disabled:ae.readOnly},n.createElement(B.l6,{width:40,"aria-label":"Select HTTP method",options:le,value:le.find(Ne=>Ne.value===ae.jsonData.httpMethod),onChange:st("httpMethod",ae,de),"data-testid":f.Tp.components.DataSource.Prometheus.configPage.httpMethod})))))),n.createElement(De,{options:ae.jsonData.exemplarTraceIdDestinations,onChange:Ne=>(0,ne.lO)({onOptionsChange:de,options:ae},"exemplarTraceIdDestinations",Ne),disabled:ae.readOnly}))},at=Z=>Z?"currentTarget"in Z?Z.currentTarget.value:Z.value:"",st=(Z,ae,de)=>ve=>{de({...ae,jsonData:{...ae.jsonData,[Z]:at(ve)}})};var Ke=e(79924);const Xe=({config:Z,onChange:ae,className:de})=>{const ve=ze=>{ae({...Z,jsonData:{...Z.jsonData,keepCookies:ze}})},Ue=ze=>{ae({...Z,jsonData:{...Z.jsonData,timeout:parseInt(ze.currentTarget.value,10)}})},_e={container:(0,t.css)({maxWidth:578})};return n.createElement(n.Fragment,null,n.createElement(d.I,{title:"Advanced HTTP settings",className:(0,t.cx)(_e.container,de)},n.createElement(p.I,{htmlFor:"advanced-http-cookies",label:"Allowed cookies",labelWidth:He,tooltip:"Grafana proxy deletes forwarded cookies by default. Specify cookies by name that should be forwarded to the data source.",disabled:Z.readOnly,grow:!0},n.createElement(Ke.u,{className:"width-20",id:"advanced-http-cookies",placeholder:"New cookie (hit enter to add)",tags:Z.jsonData.keepCookies,onChange:ve})),n.createElement(p.I,{htmlFor:"advanced-http-timeout",label:"Timeout",labelWidth:He,tooltip:"HTTP request timeout in seconds",disabled:Z.readOnly,grow:!0},n.createElement(D.p,{className:"width-20",id:"advanced-http-timeout",type:"number",min:0,placeholder:"Timeout in seconds","aria-label":"Timeout in seconds",value:Z.jsonData.timeout,onChange:Ue}))))},He=30,Ge=Z=>{const{options:ae,onOptionsChange:de}=Z,ve=l.$W.featureToggles.prometheusConfigOverhaulAuth,Ue=(0,n.useRef)(Z.options.access==="direct"),_e={azureAuthSupported:l.$W.azureAuthEnabled,getAzureAuthEnabled:Ne=>x(Ne),setAzureAuthEnabled:(Ne,ot)=>ot?L(Ne):U(Ne),azureSettingsUI:V},ze=(0,g.$j)(),Ve=be(ze);return n.createElement(n.Fragment,null,ae.access==="direct"&&n.createElement(u.F,{title:"Error",severity:"error"},"Browser access mode in the Prometheus data source is no longer available. Switch to server access mode."),ve?n.createElement(n.Fragment,null,n.createElement(s.I,{dataSourceName:"Prometheus",docsLink:"https://grafana.com/docs/grafana/latest/datasources/prometheus/configure-prometheus-data-source/"}),n.createElement("hr",{className:`${Ve.hrTopSpace} ${Ve.hrBottomSpace}`}),n.createElement(ee,{options:ae,onOptionsChange:de,azureAuthSettings:_e,sigV4AuthToggleEnabled:l.$W.sigV4AuthEnabled,renderSigV4Editor:n.createElement(o._r,{inExperimentalAuthComponent:!0,...Z}),secureSocksDSProxyEnabled:l.$W.secureSocksDSProxyEnabled})):n.createElement(c.t,{defaultUrl:"http://localhost:9090",dataSourceConfig:ae,showAccessOptions:Ue.current,onChange:de,sigV4AuthToggleEnabled:l.$W.sigV4AuthEnabled,azureAuthSettings:_e,renderSigV4Editor:n.createElement(o._r,{...Z}),secureSocksDSProxyEnabled:l.$W.secureSocksDSProxyEnabled,urlLabel:"Prometheus server URL",urlDocs:xe()}),ve?n.createElement(n.Fragment,null,n.createElement("hr",null),n.createElement(r.A,{className:Ve.advancedSettings,title:"Advanced settings",description:"Additional settings are optional settings that can be configured for more control over your data source."},n.createElement(Xe,{className:Ve.advancedHTTPSettingsMargin,config:ae,onChange:de}),n.createElement(a,{options:ae,onOptionsChange:de}),n.createElement(Ye,{options:ae,onOptionsChange:de}))):n.createElement(n.Fragment,null,n.createElement("hr",{className:Ve.hrTopSpace}),n.createElement("h3",{className:Ve.sectionHeaderPadding},"Additional settings"),n.createElement("p",{className:`${Ve.secondaryGrey} ${Ve.subsectionText}`},"Additional settings are optional settings that can be configured for more control over your data source."),n.createElement(a,{options:ae,onOptionsChange:de}),n.createElement(Ye,{options:ae,onOptionsChange:de})))};function xe(Z){const ae="https://grafana.com/docs/grafana/latest/datasources/prometheus/#configure-the-data-source";return n.createElement("a",{href:Z||ae,target:"_blank",rel:"noopener noreferrer"},"Visit docs for more details here.")}const $e=(Z,ae,de)=>{const ve="Value is not valid";return Z&&!Z.match(ae)?n.createElement(i.P,null,de||ve):!0};function be(Z){return{additionalSettings:(0,t.css)` margin-bottom: 25px; `,secondaryGrey:(0,t.css)` color: ${Z.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; `}}},87066:(Q,A,e)=>{"use strict";e.d(A,{gs:()=>Ye,UD:()=>at});var t=e(2543),n=e(13288),o=e(75505),s=e(81160),r=e(59099),g=e(97716),u=e.n(g),c=e(65879),i=e(43659),l=e(43127),f=e(47232),d=e(41987),h=e(26657),p=e(72574),m=e(47773),a=e(17172),v=e(87324),E=e(96540),D=e(13544),b=e(71087),C=e(9e4),y=e(81580),M=e(79458),T=e(51440),I=e(68402),x=e(10354),S=e(63492);function O(Ge){const xe=Ge.annotation,$e=Ge.onAnnotationChange,be={expr:xe.expr,refId:xe.name,interval:xe.step};return E.createElement(E.Fragment,null,E.createElement(b.D,null,E.createElement(S.$,{...Ge,query:be,showExplain:!1,onChange:Z=>{$e({...xe,expr:Z.expr})}}),E.createElement(C.U,null,E.createElement(y.c,{label:"Min step",tooltip:E.createElement(E.Fragment,null,"An additional lower limit for the step parameter of the Prometheus query and for the"," ",E.createElement("code",null,"$__interval")," and ",E.createElement("code",null,"$__rate_interval")," variables.")},E.createElement(T.D,{type:"text","aria-label":"Set lower limit for the step parameter",placeholder:"auto",minWidth:10,onCommitChange:Z=>{$e({...xe,step:Z.currentTarget.value})},defaultValue:be.interval,id:D.Tp.components.DataSource.Prometheus.annotations.minStep})))),E.createElement(I.$,{v:.5}),E.createElement(C.U,null,E.createElement(y.c,{label:"Title",tooltip:"Use either the name or a pattern. For example, {{instance}} is replaced with label value for the label instance."},E.createElement(x.p,{type:"text",placeholder:"{{alertname}}",value:xe.titleFormat,onChange:Z=>{$e({...xe,titleFormat:Z.currentTarget.value})},"data-testid":D.Tp.components.DataSource.Prometheus.annotations.title})),E.createElement(y.c,{label:"Tags"},E.createElement(x.p,{type:"text",placeholder:"label1,label2",value:xe.tagKeys,onChange:Z=>{$e({...xe,tagKeys:Z.currentTarget.value})},"data-testid":D.Tp.components.DataSource.Prometheus.annotations.tags})),E.createElement(y.c,{label:"Text",tooltip:"Use either the name or a pattern. For example, {{instance}} is replaced with label value for the label instance."},E.createElement(x.p,{type:"text",placeholder:"{{instance}}",value:xe.textFormat,onChange:Z=>{$e({...xe,textFormat:Z.currentTarget.value})},"data-testid":D.Tp.components.DataSource.Prometheus.annotations.text})),E.createElement(y.c,{label:"Series value as timestamp",tooltip:"The unit of timestamp is milliseconds. If the unit of the series value is seconds, multiply its range vector by 1000."},E.createElement(M.C,{value:xe.useValueForTime,onChange:Z=>{$e({...xe,useValueForTime:Z.currentTarget.value})},"data-testid":D.Tp.components.DataSource.Prometheus.annotations.seriesValueAsTimestamp}))))}var P=e(32799),L=e(45889),U=e(47891),R=e(65405),B=e(69120);const H=/^label_names\(\)\s*$/,w=/^label_values\((?:(.+),\s*)?([a-zA-Z_$][a-zA-Z0-9_]*)\)\s*$/,N=/^metrics\((.+)\)\s*$/,V=/^query_result\((.+)\)\s*$/,G=/^label_names\((.+)\)\s*$/;function _(Ge){if(typeof Ge!="string")return Ge;const xe={refId:"PrometheusDatasource-VariableQuery",qryType:B.B4.LabelNames},$e=Ge.match(G);if($e)return{...xe,qryType:B.B4.LabelNames,match:$e[1]};const be=Ge.match(H);if(be)return{...xe,qryType:B.B4.LabelNames};const Z=Ge.match(/^label_values\(/);if(Z){const ve=Ge.match(w),Ue=ve?ve[2]:"",_e=ve?ve[1]:"";if(_e){const ze=(0,R.u)(_e);return{...xe,qryType:B.B4.LabelValues,label:Ue,metric:ze.query.metric,labelFilters:ze.query.labels}}else return{...xe,qryType:B.B4.LabelValues,label:Ue}}const ae=Ge.match(/^metrics\(/);if(ae){const ve=Ge.match(N),Ue=ve?ve[1]:"";return{...xe,qryType:B.B4.MetricNames,metric:Ue}}const de=Ge.match(/^query_result\(/);if(de){const ve=Ge.match(V),Ue=ve?ve[1]:"";return{...xe,qryType:B.B4.VarQueryResult,varQuery:Ue}}return!be&&!Z&&!ae&&!de?{...xe,qryType:B.B4.SeriesQuery,seriesQuery:Ge}:xe}function K(Ge){switch(Ge.qryType){case B.B4.LabelNames:return Ge.match?`label_names(${Ge.match})`:"label_names()";case B.B4.LabelValues:if(Ge.metric||Ge.labelFilters&&Ge.labelFilters.length!==0){const $e={metric:Ge.metric,labels:Ge.labelFilters??[],operations:[]};return`label_values(${U.z.renderQuery($e)},${Ge.label})`}else return`label_values(${Ge.label})`;case B.B4.MetricNames:return`metrics(${Ge.metric})`;case B.B4.VarQueryResult:return`query_result(${j(Ge.varQuery)})`;case B.B4.SeriesQuery:return Ge.seriesQuery??"";case B.B4.ClassicQuery:return Ge.classicQuery??""}return""}function j(Ge){return Ge?Ge.replace(/[\r\n]+/gm,""):""}class k{constructor(xe,$e){this.datasource=xe,this.query=$e,this.datasource=xe,this.query=$e,this.range=(0,l.E2)()}process(xe){this.range=xe;const $e=H,be=G,Z=/^label_values\((?:(.+),\s*)?([a-zA-Z_][a-zA-Z0-9_]*)\)\s*$/,ae=N,de=V,ve=this.query.match($e),Ue=this.query.match(be);if(Ue){const ot=`{__name__=~".*${Ue[1]}.*"}`;return this.datasource.languageProvider.getSeriesLabels(ot,[]).then(nt=>nt.map(pt=>({text:pt})))}if(ve)return this.datasource.getTagKeys({filters:[],timeRange:xe});const _e=this.query.match(Z);if(_e){const ot=_e[1],nt=_e[2];return Y(ot)?this.labelValuesQuery(nt,ot):this.labelValuesQuery(nt)}const ze=this.query.match(ae);if(ze)return this.metricNameQuery(ze[1]);const Ve=this.query.match(de);return Ve?this.queryResultQuery(Ve[1]):["label_values()","metrics()","query_result()"].includes(this.query)?Promise.resolve([]):this.metricNameAndLabelsQuery(this.query)}labelValuesQuery(xe,$e){const be=(0,L.mv)(this.range.from,!1),Z=(0,L.mv)(this.range.to,!0),ae={...$e&&{"match[]":$e},start:be.toString(),end:Z.toString()};if(!$e||this.datasource.hasLabelsMatchAPISupport()){const de=`/api/v1/label/${xe}/values`;return this.datasource.metadataRequest(de,ae).then(ve=>(0,t.map)(ve.data.data,Ue=>({text:Ue})))}else{const de="/api/v1/series";return this.datasource.metadataRequest(de,ae).then(ve=>{const Ue=(0,t.map)(ve.data.data,_e=>_e[xe]||"").filter(_e=>_e!=="");return(0,t.uniq)(Ue).map(_e=>({text:_e,expandable:!0}))})}}metricNameQuery(xe){const $e=(0,L.mv)(this.range.from,!1),be=(0,L.mv)(this.range.to,!0),Z={start:$e.toString(),end:be.toString()},ae="/api/v1/label/__name__/values";return this.datasource.metadataRequest(ae,Z).then(de=>(0,t.chain)(de.data.data).filter(ve=>new RegExp(xe).test(ve)).map(ve=>({text:ve,expandable:!0})).value())}queryResultQuery(xe){const $e="/api/v1/query",be={query:xe,time:(0,L.mv)(this.range.to,!0).toString()};return this.datasource.metadataRequest($e,be).then(Z=>{switch(Z.data.data.resultType){case"scalar":case"string":return[{text:Z.data.data.result[1]||"",expandable:!1}];case"vector":return(0,t.map)(Z.data.data.result,ae=>{let de=ae.metric.__name__||"";return delete ae.metric.__name__,de+="{"+(0,t.map)(ae.metric,(ve,Ue)=>Ue+'="'+ve+'"').join(",")+"}",de+=" "+ae.value[1]+" "+ae.value[0]*1e3,{text:de,expandable:!0}});default:throw Error(`Unknown/Unhandled result type: [${Z.data.data.resultType}]`)}})}metricNameAndLabelsQuery(xe){const $e=(0,L.mv)(this.range.from,!1),be=(0,L.mv)(this.range.to,!0),Z={"match[]":xe,start:$e.toString(),end:be.toString()},ae="/api/v1/series",de=this;return this.datasource.metadataRequest(ae,Z).then(ve=>(0,t.map)(ve.data.data,Ue=>({text:de.datasource.getOriginalMetricName(Ue),expandable:!0})))}}function Y(Ge){return Ge&&Ge.split(" ").join("")!=="{}"}const ee=20;function re(Ge,xe,$e){const be=[];if(Ge.trim().match(/^\w+_bucket$|^\w+_bucket{.*}$/)){const ae="Selected metric has buckets.";be.push({type:"HISTOGRAM_QUANTILE",label:ae,fix:{label:"Consider calculating aggregated quantile by adding histogram_quantile().",action:{type:"ADD_HISTOGRAM_QUANTILE",query:Ge}}})}if(Ge.indexOf("rate(")===-1&&Ge.indexOf("increase(")===-1){const ae=Ge.match(new RegExp("\\b((?<!:)\\w+_(total|sum|count)(?!:))\\b"));let de=ae?ae[1]:"";const ve=$e?.languageProvider?.metricsMetadata;let Ue=!1;if(ve&&(de=Array.from(Ge.matchAll(/\$?[a-zA-Z_:][a-zA-Z0-9_:]*/g)).map(([ze])=>ze).filter(ze=>!ze.startsWith("$")).flatMap(ze=>ze.split(":")).find(ze=>{const Ve=ve[ze];return Ve&&Ve.type.toLowerCase()==="counter"?(Ue=!0,!0):!1})??""),de){const _e=Ge.trim().match(/^\w+$|^\w+{.*}$/);let Ve=`Selected metric ${Ue?"is":"looks like"} a counter.`,Ne;_e?Ne={label:"Consider calculating rate of counter by adding rate().",action:{type:"ADD_RATE",query:Ge}}:Ve=`${Ve} Consider calculating rate of counter by adding rate().`,be.push({type:"APPLY_RATE",label:Ve,fix:Ne})}}if($e&&$e.ruleMappings){const ae=$e.ruleMappings,de=Object.keys(ae).reduce((ve,Ue)=>Ge.search(Ue)>-1?{...ve,[Ue]:ae[Ue]}:ve,{});if((0,t.size)(de)>0){const ve="Query contains recording rules.";be.push({type:"EXPAND_RULES",label:ve,fix:{label:"Expand rules",action:{type:"EXPAND_RULES",query:Ge,options:de}}})}}return xe&&xe.length>=ee&&Ge.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:Ge,preventSubmit:!0}}}),be}function J(Ge){const xe=[];return Ge.lookupsDisabled&&xe.push({label:"Labels and metrics lookup was disabled in data source settings.",type:"INFO"}),xe}var ne=e(30915),q=e(39132),te=e(14110),oe=e(32264);function ue(Ge,xe,$e){const{app:be,targets:Z}=xe;if(!(be===d.Jk.Dashboard||be===d.Jk.PanelViewer))for(const ae of Z)(0,te.rR)("grafana_prometheus_query_executed",{app:be,grafana_version:oe.$.buildInfo.version,has_data:Ge.data.some(de=>de.length>0),has_error:Ge.error!==void 0,expr:ae.expr,format:ae.format,instant:ae.instant,range:ae.range,exemplar:ae.exemplar,hinting:ae.hinting,interval:ae.interval,intervalFactor:ae.intervalFactor,utcOffsetSec:ae.utcOffsetSec,legend:ae.legendFormat,valueWithRefId:ae.valueWithRefId,requestId:xe.requestId,showingGraph:ae.showingGraph,showingTable:ae.showingTable,editor_mode:ae.editorMode,simultaneously_sent_query_count:Z.length,time_range_from:xe?.range?.from?.toISOString(),time_range_to:xe?.range?.to?.toISOString(),time_taken:Date.now()-$e.getTime()})}var ie=e(62467),ge=e(65474),he=e(29505),De=e(39268),pe=e(14186),le=e(88323),Te=e(21744),Ee=e(46777);const Re=[{label:"Label names",value:B.B4.LabelNames},{label:"Label values",value:B.B4.LabelValues},{label:"Metrics",value:B.B4.MetricNames},{label:"Query result",value:B.B4.VarQueryResult},{label:"Series query",value:B.B4.SeriesQuery},{label:"Classic query",value:B.B4.ClassicQuery}],me="PrometheusVariableQueryEditor-VariableQuery",Me=({onChange:Ge,query:xe,datasource:$e,range:be})=>{const[Z,ae]=(0,E.useState)(void 0),[de,ve]=(0,E.useState)(""),[Ue,_e]=(0,E.useState)(""),[ze,Ve]=(0,E.useState)(""),[Ne,ot]=(0,E.useState)(""),[nt,pt]=(0,E.useState)(""),[mt,gt]=(0,E.useState)(""),[Pt,Mt]=(0,E.useState)([]),[Yt,zt]=(0,E.useState)([]);(0,E.useEffect)(()=>{$e.languageProvider.start(be)},[]),(0,E.useEffect)(()=>{if(xe)if(xe.qryType===B.B4.ClassicQuery)ae(xe.qryType),gt(xe.query??"");else{const Xt=ye(xe);_e(Xt.match??""),ae(Xt.qryType),ve(Xt.label??""),Ve(Xt.metric??""),zt(Xt.labelFilters??[]),ot(Xt.varQuery??""),pt(Xt.seriesQuery??""),gt(Xt.classicQuery??"")}},[xe]),(0,E.useEffect)(()=>{if(Z!==B.B4.LabelValues)return;const Xt=$e.getVariables().map(fn=>({label:fn,value:fn}));if(!ze)$e.getTagKeys({filters:[]}).then(fn=>{const An=fn.map(({text:hn})=>({label:hn,value:hn}));Mt([...Xt,...An])});else{const fn=[{label:"__name__",op:"=",value:ze}],An=U.z.renderLabels(fn);$e.languageProvider.fetchLabelsWithMatch(An).then(hn=>{const Rt=Object.keys(hn).map(qt=>({label:qt,value:qt}));Mt([...Xt,...Rt])})}},[$e,Z,ze]);const _t=(Xt,fn)=>{const ca={...{qryType:Z,label:de,metric:ze,match:Ue,varQuery:Ne,seriesQuery:nt,classicQuery:mt,refId:"PrometheusVariableQueryEditor-VariableQuery"},...Xt,...fn?{labelFilters:fn}:{labelFilters:Yt}},Rt=K(ca);Ge({query:Rt,qryType:ca.qryType,refId:me})},rt=Xt=>{ae(Xt.value),Xt.value!==B.B4.SeriesQuery&&_t({qryType:Xt.value??0})},It=Xt=>{const fn=Xt&&Xt.value?Xt.value:"";ve(fn),Z===B.B4.LabelValues&&fn&&_t({label:fn})},Dn=Xt=>{Ve(Xt.metric),zt(Xt.labels);const fn=Xt.metric,An=Xt.labels??[];Z===B.B4.LabelValues&&de&&(fn||An)&&_t({qryType:Z,metric:fn},An)},ft=Xt=>{Z===B.B4.LabelNames&&_t({qryType:Z,match:Xt})},yt=Xt=>{Z===B.B4.MetricNames&&Xt&&_t({metric:Xt})},jt=Xt=>{ot(Xt.currentTarget.value)},cn=Xt=>{pt(Xt.currentTarget.value)},pn=Xt=>{gt(Xt.currentTarget.value)},on=(0,E.useCallback)(()=>({metric:ze,labels:Yt,operations:[]}),[ze,Yt]);return E.createElement(E.Fragment,null,E.createElement(De.C,null,E.createElement(pe.I,{label:"Query type",labelWidth:20,tooltip:E.createElement("div",null,"The Prometheus data source plugin provides the following query types for template variables.")},E.createElement(le.l6,{placeholder:"Select query type","aria-label":"Query type",onChange:rt,value:Z,options:Re,width:25,"data-testid":D.Tp.components.DataSource.Prometheus.variableQueryEditor.queryType}))),Z===B.B4.LabelValues&&E.createElement(E.Fragment,null,E.createElement(De.C,null,E.createElement(pe.I,{label:"Label",labelWidth:20,required:!0,"aria-labelledby":"label-select",tooltip:E.createElement("div",null,"Returns a list of label values for the label name in all metrics unless the metric is specified.")},E.createElement(le.l6,{"aria-label":"label-select",onChange:It,value:de,options:Pt,width:25,allowCustomValue:!0,isClearable:!0,"data-testid":D.Tp.components.DataSource.Prometheus.variableQueryEditor.labelValues.labelSelect}))),E.createElement(Ee.I,{query:on(),datasource:$e,onChange:Dn,variableEditor:!0})),Z===B.B4.LabelNames&&E.createElement(De.C,null,E.createElement(pe.I,{label:"Metric regex",labelWidth:20,"aria-labelledby":"Metric regex",tooltip:E.createElement("div",null,"Returns a list of label names, optionally filtering by specified metric regex.")},E.createElement(x.p,{type:"text","aria-label":"Metric regex",placeholder:"Metric regex",value:Ue,onBlur:Xt=>{_e(Xt.currentTarget.value),ft(Xt.currentTarget.value)},onChange:Xt=>{_e(Xt.currentTarget.value)},width:25,"data-testid":D.Tp.components.DataSource.Prometheus.variableQueryEditor.labelnames.metricRegex}))),Z===B.B4.MetricNames&&E.createElement(De.C,null,E.createElement(pe.I,{label:"Metric regex",labelWidth:20,"aria-labelledby":"Metric selector",tooltip:E.createElement("div",null,"Returns a list of metrics matching the specified metric regex.")},E.createElement(x.p,{type:"text","aria-label":"Metric selector",placeholder:"Metric regex",value:ze,onChange:Xt=>{Ve(Xt.currentTarget.value)},onBlur:Xt=>{Ve(Xt.currentTarget.value),yt(Xt.currentTarget.value)},width:25,"data-testid":D.Tp.components.DataSource.Prometheus.variableQueryEditor.metricNames.metricRegex}))),Z===B.B4.VarQueryResult&&E.createElement(De.C,null,E.createElement(pe.I,{label:"Query",labelWidth:20,tooltip:E.createElement("div",null,"Returns a list of Prometheus query results for the query. This can include Prometheus functions, i.e. sum(go_goroutines).")},E.createElement(Te.f,{type:"text","aria-label":"Prometheus Query",placeholder:"Prometheus Query",value:Ne,onChange:jt,onBlur:()=>{Z===B.B4.VarQueryResult&&Ne&&_t({qryType:Z})},cols:100,"data-testid":D.Tp.components.DataSource.Prometheus.variableQueryEditor.varQueryResult}))),Z===B.B4.SeriesQuery&&E.createElement(De.C,null,E.createElement(pe.I,{label:"Series Query",labelWidth:20,tooltip:E.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.')},E.createElement(x.p,{type:"text","aria-label":"Series Query",placeholder:"Series Query",value:nt,onChange:cn,onBlur:()=>{Z===B.B4.SeriesQuery&&nt&&_t({qryType:Z})},width:100,"data-testid":D.Tp.components.DataSource.Prometheus.variableQueryEditor.seriesQuery}))),Z===B.B4.ClassicQuery&&E.createElement(De.C,null,E.createElement(pe.I,{label:"Classic Query",labelWidth:20,tooltip:E.createElement("div",null,"The original implemetation of the Prometheus variable query editor. Enter a string with the correct query type and parameters as described in these docs. For example, label_values(label, metric).")},E.createElement(x.p,{type:"text","aria-label":"Classic Query",placeholder:"Classic Query",value:mt,onChange:pn,onBlur:()=>{Z===B.B4.ClassicQuery&&mt&&_t({qryType:Z})},width:100,"data-testid":D.Tp.components.DataSource.Prometheus.variableQueryEditor.classicQuery}))))};function ye(Ge){return typeof Ge=="string"?_(Ge):Ge.query?_(Ge.query):Ge}class Le extends he.f5{constructor(xe,$e=(0,p.w)()){super(),this.datasource=xe,this.templateSrv=$e,this.editor=Me}query(xe){let $e;if(typeof xe.targets[0]=="string"?$e=xe.targets[0]:$e=xe.targets[0].query,!$e)return(0,ie.of)({data:[]});const be={...xe.scopedVars,__interval:{text:this.datasource.interval,value:this.datasource.interval},__interval_ms:{text:c.intervalToMs(this.datasource.interval),value:c.intervalToMs(this.datasource.interval)},...this.datasource.getRangeScopedVars(xe.range)},Z=this.templateSrv.replace($e,be,this.datasource.interpolateQueryExpr),ae=new k(this.datasource,Z);return(0,ge.H)(ae.process(xe.range)).pipe((0,s.T)(ve=>({data:ve})))}}const We="60s",Be=["api/v1/query","api/v1/query_range","api/v1/series","api/v1/labels"],Ye="-Instant";class at extends h.iy{constructor(xe,$e=(0,p.w)(),be){super(xe),this.templateSrv=$e,this.init=async()=>{this.disableRecordingRules||this.loadRules(),this.exemplarsAvailable=await this.areExemplarsAvailable()},this.processAnnotationResponse=(Z,ae)=>{const de=(0,m.bE)({data:ae}).data;if(!de||!de.length)return[];const ve=Z.annotation,{tagKeys:Ue="",titleFormat:_e="",textFormat:ze=""}=ve,Ve=c.intervalToSeconds(ve.step||We)*1e3,Ne=Ue.split(","),ot=[];for(const nt of de){if(nt.fields.length===0)continue;const pt=nt.fields[0],mt=nt.fields[1],gt=mt?.labels||{},Pt=Object.keys(gt).filter(It=>Ne.includes(It)).map(It=>gt[It]),Mt=[];let Yt=0;mt.values.forEach(It=>{let Dn,ft;const yt=pt.values[Yt];Z.annotation.useValueForTime?(Dn=Math.floor(parseFloat(It)),ft=1):(Dn=Math.floor(parseFloat(yt)),ft=parseFloat(It)),Yt++,Mt.push([Dn,ft])});const _t=Mt.filter(It=>It[1]>0).map(It=>It[0]);let rt=null;for(const It of _t){if(rt&&(rt.timeEnd??0)+Ve>=It){rt.timeEnd=It;continue}rt&&ot.push(rt),rt={time:It,timeEnd:It,annotation:ve,title:(0,i.j)(_e,gt),tags:Pt,text:(0,i.j)(ze,gt)}}rt&&(rt.timeEnd=_t[_t.length-1],ot.push(rt))}return ot},this.type="prometheus",this.id=xe.id,this.url=xe.url,this.access=xe.access,this.basicAuth=xe.basicAuth,this.withCredentials=xe.withCredentials,this.interval=xe.jsonData.timeInterval||"15s",this.queryTimeout=xe.jsonData.queryTimeout,this.httpMethod=xe.jsonData.httpMethod||"GET",this.exemplarTraceIdDestinations=xe.jsonData.exemplarTraceIdDestinations,this.hasIncrementalQuery=xe.jsonData.incrementalQuerying??!1,this.ruleMappings={},this.languageProvider=be??new P.Ay(this),this.lookupsDisabled=xe.jsonData.disableMetricsLookup??!1,this.customQueryParameters=new URLSearchParams(xe.jsonData.customQueryParameters),this.datasourceConfigurationPrometheusFlavor=xe.jsonData.prometheusType,this.datasourceConfigurationPrometheusVersion=xe.jsonData.prometheusVersion,this.defaultEditor=xe.jsonData.defaultEditor,this.disableRecordingRules=xe.jsonData.disableRecordingRules??!1,this.variables=new Le(this,this.templateSrv),this.exemplarsAvailable=!0,this.cacheLevel=xe.jsonData.cacheLevel??B.fD.Low,this.cache=new ne.$i({getTargetSignature:this.getPrometheusTargetSignature.bind(this),overlapString:xe.jsonData.incrementalQueryOverlapWindow??ne.Dr,profileFunction:this.getPrometheusProfileData.bind(this)}),this.annotations={QueryEditor:O}}getQueryDisplayText(xe){return xe.expr}getPrometheusProfileData(xe,$e){return{interval:$e.interval??xe.interval,expr:this.interpolateString($e.expr),datasource:"Prometheus"}}getPrometheusTargetSignature(xe,$e){return`${this.interpolateString($e.expr)}|${$e.interval??xe.interval}|${JSON.stringify(xe.rangeRaw??"")}|${$e.exemplar}`}hasLabelsMatchAPISupport(){return this._isDatasourceVersionGreaterOrEqualTo("2.24.0",B.N1.Prometheus)||this._isDatasourceVersionGreaterOrEqualTo("2.0.0",B.N1.Mimir)||this._isDatasourceVersionGreaterOrEqualTo("1.11.0",B.N1.Cortex)||this._isDatasourceVersionGreaterOrEqualTo("0.18.0",B.N1.Thanos)}_isDatasourceVersionGreaterOrEqualTo(xe,$e){return!this.datasourceConfigurationPrometheusVersion||!this.datasourceConfigurationPrometheusFlavor||$e!==this.datasourceConfigurationPrometheusFlavor?!1:u().gte(this.datasourceConfigurationPrometheusVersion,xe)}_addTracingHeaders(xe,$e){xe.headers={},this.access==="proxy"&&(xe.headers["X-Dashboard-UID"]=$e.dashboardUID,xe.headers["X-Panel-Id"]=$e.panelId)}directAccessError(){return(0,n.$)(()=>new Error("Browser access mode in the Prometheus datasource is no longer available. Switch to server access mode."))}_request(xe,$e,be={}){if(this.access==="direct")return this.directAccessError();$e=$e||{};for(const[de,ve]of this.customQueryParameters)$e[de]==null&&($e[de]=ve);let Z=this.url+xe;xe.startsWith(`/api/datasources/uid/${this.uid}`)&&(Z=xe);const ae=(0,t.defaults)(be,{url:Z,method:this.httpMethod,headers:{}});return ae.method==="GET"?$e&&Object.keys($e).length&&(ae.url=ae.url+(ae.url.search(/\?/)>=0?"&":"?")+Object.entries($e).map(([de,ve])=>`${encodeURIComponent(de)}=${encodeURIComponent(ve)}`).join("&")):(ae.headers["Content-Type"]="application/x-www-form-urlencoded",ae.data=$e),(this.basicAuth||this.withCredentials)&&(ae.withCredentials=!0),this.basicAuth&&(ae.headers.Authorization=this.basicAuth),(0,a.AI)().fetch(ae)}async importFromAbstractQueries(xe){return xe.map($e=>this.languageProvider.importFromAbstractQuery($e))}async exportToAbstractQueries(xe){return xe.map($e=>this.languageProvider.exportToAbstractQuery($e))}async metadataRequest(xe,$e={},be){if(Be.some(Z=>xe.includes(Z)))try{return await(0,o.s)(this._request(`/api/datasources/uid/${this.uid}/resources${xe}`,$e,{method:this.httpMethod,hideFromInspector:!0,showErrorAlert:!1,...be}))}catch(Z){if(this.httpMethod==="POST"&&(0,a.NF)(Z)&&(Z.status===405||Z.status===400))console.warn("Couldn't use configured POST HTTP method for this request. Trying to use GET method instead.");else throw Z}return await(0,o.s)(this._request(`/api/datasources/uid/${this.uid}/resources${xe}`,$e,{method:"GET",hideFromInspector:!0,...be}))}interpolateQueryExpr(xe=[],$e){if(!$e.multi&&!$e.includeAll)return Xe(xe);if(typeof xe=="string")return He(xe);const be=xe.map(Z=>He(Z));return be.length===1?be[0]:"("+be.join("|")+")"}targetContainsTemplate(xe){return this.templateSrv.containsTemplate(xe.expr)}shouldRunExemplarQuery(xe,$e){if(xe.exemplar){const be=this.languageProvider.histogramMetrics.find(de=>xe.expr.includes(de)),Z=$e.targets.findIndex(de=>de.refId===xe.refId),ae=$e.targets.slice(0,Z).filter(de=>!de.hide);return!!(!be||be&&!ae.some(de=>de.expr.includes(be)))}return!1}processTargetV2(xe,$e){const be=[],Z={...xe,exemplar:this.shouldRunExemplarQuery(xe,$e),requestId:$e.panelId+xe.refId,utcOffsetSec:$e.range.to.utcOffset()*60};return xe.instant&&xe.range?be.push({...Z,refId:Z.refId,instant:!1},{...Z,refId:Z.refId+Ye,range:!1}):be.push(Z),be}query(xe){if(this.access==="direct")return this.directAccessError();let $e,be;const Z=xe.targets.some(ve=>ve.instant);this.hasIncrementalQuery&&!Z?(be=this.cache.requestInfo(xe),$e=be.requests[0]):$e=xe;const ae=$e.targets.map(ve=>this.processTargetV2(ve,$e)),de=new Date;return super.query({...$e,targets:ae.flat()}).pipe((0,s.T)(ve=>{const Ue={...ve,data:this.cache.procFrames(xe,be,ve.data)};return(0,q.J3)(Ue,xe,{exemplarTraceIdDestinations:this.exemplarTraceIdDestinations})}),(0,r.M)(ve=>{ue(ve,xe,de)}))}createQuery(xe,$e,be,Z){const ae={hinting:xe.hinting,instant:xe.instant,exemplar:xe.exemplar,step:0,expr:"",refId:xe.refId,start:0,end:0},de=Math.ceil(Z-be);let ve=c.intervalToSeconds($e.interval);const Ue=c.intervalToSeconds(this.templateSrv.replace(xe.interval||$e.interval,$e.scopedVars)),_e=xe.interval?c.intervalToSeconds(this.templateSrv.replace(xe.interval,$e.scopedVars)):c.intervalToSeconds(this.interval),ze=xe.intervalFactor||1,Ve=this.adjustInterval(ve,Ue,de,ze);let Ne={...$e.scopedVars,...this.getRangeScopedVars($e.range),...this.getRateIntervalScopedVariable(Ve,_e)};ve!==Ve&&(ve=Ve,Ne=Object.assign({},$e.scopedVars,{__interval:{text:ve+"s",value:ve+"s"},__interval_ms:{text:ve*1e3,value:ve*1e3},...this.getRateIntervalScopedVariable(ve,_e),...this.getRangeScopedVars($e.range)})),ae.step=ve;let ot=xe.expr;ot=this.enhanceExprWithAdHocFilters($e.filters,ot),ae.expr=this.templateSrv.replace(ot,Ne,this.interpolateQueryExpr);const nt=st(be,Z,ae.step,$e.range.to.utcOffset()*60);return ae.start=nt.start,ae.end=nt.end,this._addTracingHeaders(ae,$e),ae}getRateIntervalScopedVariable(xe,$e){$e===0&&($e=15);const be=Math.max(xe+$e,4*$e);return{__rate_interval:{text:be+"s",value:be+"s"}}}adjustInterval(xe,$e,be,Z){let ae=be/11e3;return ae>1&&(ae=Math.ceil(ae)),Math.max(xe*Z,$e,ae)}metricFindQuery(xe,$e){if(!xe)return Promise.resolve([]);const be={__interval:{text:this.interval,value:this.interval},__interval_ms:{text:c.intervalToMs(this.interval),value:c.intervalToMs(this.interval)},...this.getRangeScopedVars($e?.range??(0,l.E2)())},Z=this.templateSrv.replace(xe,be,this.interpolateQueryExpr);return new k(this,Z).process($e?.range??(0,l.E2)())}getRangeScopedVars(xe){const $e=xe.to.diff(xe.from),be=Math.round($e/1e3);return{__range_ms:{text:$e,value:$e},__range_s:{text:be,value:be},__range:{text:be+"s",value:be+"s"}}}async annotationQuery(xe){if(this.access==="direct"){const de=new Error("Browser access mode in the Prometheus datasource is no longer available. Switch to server access mode.");return Promise.reject(de)}const $e=xe.annotation,{expr:be=""}=$e;if(!be)return Promise.resolve([]);const Z=xe.annotation.step||We,ae={expr:be,range:!0,instant:!1,exemplar:!1,interval:Z,refId:"X",datasource:this.getRef()};return await(0,o.s)((0,a.AI)().fetch({url:"/api/ds/query",method:"POST",headers:this.getRequestHeaders(),data:{from:((0,L.mv)(xe.range.from,!1)*1e3).toString(),to:((0,L.mv)(xe.range.to,!0)*1e3).toString(),queries:[this.applyTemplateVariables(ae,{})]},requestId:`prom-query-${$e.name}`}).pipe((0,s.T)(de=>this.processAnnotationResponse(xe,de.data))))}async getTagKeys(xe){if(!xe||xe.filters.length===0)return await this.languageProvider.fetchLabels(xe.timeRange),this.languageProvider.getLabelKeys().map(ae=>({value:ae,text:ae}));const $e=xe.filters.map(ae=>({label:ae.key,value:ae.value,op:ae.operator})),be=U.z.renderLabels($e);let Z=await this.languageProvider.fetchLabelsWithMatch(be);return Object.keys(Z).filter(ae=>!xe.filters.find(de=>de.key===ae)).map(ae=>({value:ae,text:ae}))}async getTagValues(xe){const $e=xe.filters.map(de=>({label:de.key,value:de.value,op:de.operator})),be=U.z.renderLabels($e);if(this.hasLabelsMatchAPISupport())return(await this.languageProvider.fetchSeriesValuesWithMatch(xe.key,be,xe.timeRange)).map(de=>({value:de,text:de}));const Z=this.getTimeRangeParams(xe.timeRange??(0,l.E2)());return(await this.metadataRequest(`/api/v1/label/${xe.key}/values`,Z))?.data?.data?.map(de=>({text:de}))??[]}interpolateVariablesInQueries(xe,$e,be){let Z=xe;return xe&&xe.length&&(Z=xe.map(ae=>{const de=this.templateSrv.replace(ae.expr,$e,this.interpolateQueryExpr),ve=this.templateSrv.replace(this.enhanceExprWithAdHocFilters(be,de),$e,this.interpolateQueryExpr);return{...ae,datasource:this.getRef(),expr:ve,interval:this.templateSrv.replace(ae.interval,$e)}})),Z}getQueryHints(xe,$e){return re(xe.expr??"",$e,this)}getInitHints(){return J(this)}async loadRules(){try{const $e=(await this.metadataRequest("/api/v1/rules",{},{showErrorAlert:!1})).data?.data?.groups;$e&&(this.ruleMappings=Ke($e))}catch(xe){console.log("Rules API is experimental. Ignore next error."),console.error(xe)}}async areExemplarsAvailable(){try{return(await this.metadataRequest("/api/v1/query_exemplars",{query:"test",start:(0,f.KQ)().subtract(30,"minutes").valueOf().toString(),end:(0,f.KQ)().valueOf().toString()},{showErrorAlert:!1})).data.status==="success"}catch{return!1}}modifyQuery(xe,$e){let be=xe.expr??"";switch($e.type){case"ADD_FILTER":{const{key:Z,value:ae}=$e.options??{};Z&&ae&&(be=(0,v.t)(be,Z,ae));break}case"ADD_FILTER_OUT":{const{key:Z,value:ae}=$e.options??{};Z&&ae&&(be=(0,v.t)(be,Z,ae,"!="));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":{$e.options&&(be=(0,L.P_)(be,$e.options));break}default:break}return{...xe,expr:be}}getAdjustedInterval(xe){return(0,L.Xd)(this.cacheLevel,xe)}getTimeRangeParams(xe){return{start:(0,L.mv)(xe.from,!1).toString(),end:(0,L.mv)(xe.to,!0).toString()}}getOriginalMetricName(xe){return(0,q.hF)(xe)}enhanceExprWithAdHocFilters(xe,$e){return!xe||xe.length===0?$e:xe.reduce((Z,ae)=>{const{key:de,operator:ve}=ae;let{value:Ue}=ae;return(ve==="=~"||ve==="!~")&&(Ue=Xe(Ue)),(0,v.t)(Z,de,Ue,ve)},$e)}filterQuery(xe){return!(xe.hide||!xe.expr)}applyTemplateVariables(xe,$e,be){const Z={...$e};Z.__interval={value:"$__interval"},Z.__interval_ms={value:"$__interval_ms"};const ae=this.templateSrv.replace(xe.expr,Z,this.interpolateQueryExpr),de=this.templateSrv.replace(this.enhanceExprWithAdHocFilters(be,ae),Z,this.interpolateQueryExpr);return{...xe,expr:de,interval:this.templateSrv.replace(xe.interval,Z),legendFormat:this.templateSrv.replace(xe.legendFormat,Z)}}getVariables(){return this.templateSrv.getVariables().map(xe=>`$${xe.name}`)}interpolateString(xe,$e){return this.templateSrv.replace(xe,$e,this.interpolateQueryExpr)}getDebounceTimeInMilliseconds(){switch(this.cacheLevel){case B.fD.Medium:return 600;case B.fD.High:return 1200;default:return 350}}getDaysToCacheMetadata(){switch(this.cacheLevel){case B.fD.Medium:return 7;case B.fD.High:return 30;default:return 1}}getCacheDurationInMinutes(){return(0,L.u3)(this.cacheLevel)}getDefaultQuery(xe){const $e={refId:"A",expr:"",range:!0,instant:!1};return xe===d.Jk.UnifiedAlerting?{...$e,instant:!0,range:!1}:xe===d.Jk.Explore?{...$e,instant:!0,range:!0}:$e}}function st(Ge,xe,$e,be){const Z=Math.floor((xe+be)/$e)*$e-be,ae=Math.floor((Ge+be)/$e)*$e-be;return{end:Z,start:ae}}function Ke(Ge){return Ge.reduce((xe,$e)=>$e.rules.filter(be=>be.type==="recording").reduce((be,Z)=>({...be,[Z.name]:Z.query}),xe),{})}function Xe(Ge){return typeof Ge=="string"?Ge.replace(/\\/g,"\\\\").replace(/'/g,"\\\\'"):Ge}function He(Ge){return typeof Ge=="string"?Ge.replace(/\\/g,"\\\\\\\\").replace(/[$^*{}\[\]\'+?.()|]/g,"\\\\$&"):Ge}},32799:(Q,A,e)=>{"use strict";e.d(A,{AU:()=>v,Ay:()=>b,OP:()=>h,pK:()=>a,xB:()=>m});var t=e(2543),n=e.n(t),o=e(28848),s=e.n(o),r=e(40187),g=e(43127),u=e(73372),c=e(45889),i=e(69470),l=e(69120);const f=["job","instance"],d="{}",h=1e4,p=y=>({headers:{"X-Grafana-Cache":`private, max-age=${y}`}});function m(y,M){if(!M[y])return;const{type:T,help:I}=M[y];return`${T.toUpperCase()}: ${I}`}function a(y,M){if(M[y])return M[y].help}function v(y,M){if(M[y])return M[y].type}const E=/(="|!="|=~"|!~"|\{|\[|\(|\+|-|\/|\*|%|\^|\band\b|\bor\b|\bunless\b|==|>=|!=|<=|>|<|=|~|,)/,D=86400;class b extends r.Is{constructor(M,T){super(),this.labelKeys=[],this.request=async(I,x,S={},O)=>{try{return(await this.datasource.metadataRequest(I,S,O)).data.data}catch(P){console.error(P)}return x},this.start=async I=>(this.timeRange=I??(0,g.E2)(),this.datasource.lookupsDisabled?[]:(this.metrics=await this.fetchLabelValues("__name__")||[],this.histogramMetrics=(0,c.Rg)(this.metrics).sort(),Promise.all([this.loadMetricsMetadata(),this.fetchLabels()]))),this.fetchLabelValues=async I=>{const x=this.datasource.getAdjustedInterval(this.timeRange),O=`/api/v1/label/${this.datasource.interpolateString(I)}/values`;return await this.request(O,[],x,this.getDefaultCacheHeaders())??[]},this.getSeriesValues=async(I,x)=>this.datasource.hasLabelsMatchAPISupport()?await this.fetchSeriesValuesWithMatch(I,x):(await this.getSeries(x))[I]??[],this.fetchSeriesValuesWithMatch=async(I,x,S=this.timeRange)=>{const O=I?this.datasource.interpolateString(I):null,P=x?this.datasource.interpolateString(x):null,U={...this.datasource.getAdjustedInterval(S),...P&&{"match[]":P}};return await this.request(`/api/v1/label/${O}/values`,[],U,this.getDefaultCacheHeaders())??[]},this.getSeriesLabels=async(I,x)=>{let S,O;this.datasource.hasLabelsMatchAPISupport()?(x.push({name:"__name__",value:"",op:"!="}),O=await this.fetchSeriesLabelsMatch(I),S=Object.keys(O)):(O=await this.getSeries(I),S=Object.keys(O));const P=new Set(x.map(L=>L.name));return S.filter(L=>!P.has(L))},this.fetchLabelsWithMatch=async(I,x)=>this.datasource.hasLabelsMatchAPISupport()?this.fetchSeriesLabelsMatch(I,x):this.fetchSeriesLabels(I,x),this.fetchSeriesLabels=async(I,x)=>{const S=this.datasource.interpolateString(I),P={...this.datasource.getAdjustedInterval(this.timeRange),"match[]":S},L="/api/v1/series",U=await this.request(L,[],P,this.getDefaultCacheHeaders()),{values:R}=(0,c.P7)(U,x);return R},this.fetchSeriesLabelsMatch=async(I,x)=>{const S=this.datasource.interpolateString(I),P={...this.datasource.getAdjustedInterval(this.timeRange),"match[]":S},L="/api/v1/labels";return(await this.request(L,[],P,this.getDefaultCacheHeaders())).reduce((R,B)=>({...R,[B]:""}),{})},this.fetchSeries=async I=>{const x="/api/v1/series",O={...this.datasource.getTimeRangeParams(this.timeRange),"match[]":I};return await this.request(x,{},O,this.getDefaultCacheHeaders())},this.fetchDefaultSeries=(0,t.once)(async()=>{const I=await Promise.all(f.map(x=>this.fetchLabelValues(x)));return f.reduce((x,S,O)=>({...x,[S]:I[O]}),{})}),this.datasource=M,this.histogramMetrics=[],this.timeRange=(0,g.E2)(),this.metrics=[],Object.assign(this,T)}getDefaultCacheHeaders(){if(this.datasource.cacheLevel!==l.fD.None)return p(this.datasource.getCacheDurationInMinutes()*60)}cleanText(M){return M.split(E).pop().trimLeft().replace(/"$/,"").replace(/^"/,"")}get syntax(){return i.Ay}async loadMetricsMetadata(){const M=p(this.datasource.getDaysToCacheMetadata()*D);this.metricsMetadata=(0,c.DX)(await this.request("/api/v1/metadata",{},{},{showErrorAlert:!1,...M}))}getLabelKeys(){return this.labelKeys}importFromAbstractQuery(M){return(0,c.pt)(M)}exportToAbstractQuery(M){const T=M.expr;if(!T||T.length===0)return{refId:M.refId,labelMatchers:[]};const I=s().tokenize(T,i.Ay),x=(0,c.VH)(I),S=C(T,I);return S&&S.length>0&&x.push({name:"__name__",operator:u.D_.Equal,value:S}),{refId:M.refId,labelMatchers:x}}async getSeries(M,T){if(this.datasource.lookupsDisabled)return{};try{return M===d?await this.fetchDefaultSeries():await this.fetchSeriesLabels(M,T)}catch(I){return console.error(I),{}}}async getLabelValues(M){return await this.fetchLabelValues(M)}async fetchLabels(M){M&&(this.timeRange=M);const T="/api/v1/labels",I=this.datasource.getAdjustedInterval(this.timeRange);this.labelFetchTs=Date.now().valueOf();const x=await this.request(T,[],I,this.getDefaultCacheHeaders());return Array.isArray(x)&&(this.labelKeys=x.slice().sort()),[]}}function C(y,M){let T="";for(const I of M)if(typeof I=="string"){T=I;break}return T}},45889:(Q,A,e)=>{"use strict";e.d(A,{Cs:()=>O,DX:()=>D,P7:()=>h,P_:()=>v,Qn:()=>S,Rg:()=>d,VH:()=>H,Xd:()=>w,eN:()=>b,ky:()=>G,mv:()=>V,pt:()=>R,u3:()=>N});var t=e(2543),n=e.n(t),o=e(28848),s=e.n(o),r=e(73372),g=e(77678),u=e(85858),c=e(87324),i=e(32799),l=e(95842),f=e(69120);const d=_=>{const K=new Set,j=new RegExp("_bucket($|:)");for(let k=0;k<_.length;k++){const Y=_[k];j.test(Y)&&K.add(Y)}return[...K]};function h(_,K=!1){const j={};_.forEach(Y=>{const{__name__:ee,...re}=Y;K&&(j.__name__=j.__name__||new Set,j.__name__.has(ee)||j.__name__.add(ee)),Object.keys(re).forEach(J=>{j[J]||(j[J]=new Set),j[J].has(re[J])||j[J].add(re[J])})});const k={};return M(Object.keys(j)).forEach(Y=>{k[Y]=M(Array.from(j[Y]))}),{values:k,keys:Object.keys(k)}}const p=/\{[^}]*?(\}|$)/,m=/\b(\w+)(!?=~?)("[^"\n]*?")(,)?(\s*)?/g;function a(_,K=1){if(!_.match(p)){if(_.match(/^[A-Za-z:][\w:]*$/))return{selector:`{__name__="${_}"}`,labelKeys:["__name__"]};throw new Error("Query must contain a selector: "+_)}const j=_.slice(0,K),k=j.lastIndexOf("{"),Y=j.lastIndexOf("}");if(k===-1)throw new Error("Not inside selector, missing open brace: "+j);if(Y>-1&&Y>k)throw new Error("Not inside selector, previous selector already closed: "+j);const ee=_.slice(K),J=ee.indexOf("}")+K,ne=ee.indexOf("{"),q=ne+K;if(J===-1)throw new Error("Not inside selector, missing closing brace in suffix: "+ee);if(ne>-1&&q<J)throw new Error("Not inside selector, next selector opens before this one closed: "+ee);const te=_.slice(k,J),oe={};te.replace(m,(pe,le,Te,Ee)=>{const Re=_.indexOf(pe),me=Re+le.length+Te.length+1,Me=Re+le.length+Te.length+Ee.length-1;return(K<me||K>Me)&&(oe[le]={value:Ee,operator:Te}),""});const ie=_.slice(0,k).match(/[A-Za-z:][\w:]*$/);ie&&(oe.__name__={value:`"${ie[0]}"`,operator:"="});const ge=Object.keys(oe).sort(),De=["{",ge.map(pe=>`${pe}${oe[pe].operator}${oe[pe].value}`).join(","),"}"].join("");return{labelKeys:ge,selector:De}}function v(_,K){const j=re=>new RegExp(`(\\s|\\(|^)(${re})(\\s|$|\\(|\\[|\\{)`,"ig"),k=Object.keys(K).reduce((re,J)=>{let ne=[],q=[],te=[];return re.filter(Boolean).forEach((oe,ue)=>{oe.match(j(J))&&(ne=oe.split(J),ne.length===2?(te.push(ue),q.push(...[ne[0],J,ne[1]].filter(Boolean))):ne.length>2&&(te.push(ue),ne=ne.map(ge=>ge===""?J:ge),q.push(...ne)))}),te.forEach(oe=>re[oe]=""),re=re.filter(Boolean),re.push(...q),re},[_]);let Y=!1;return k.map((re,J)=>{if(Y)return Y=!1,"";if(K[re]){const ne=K[re];if(J+1!==k.length&&k[J+1].match(m)){Y=!0;const q=k[J+1],te=/(\)\{|\}\{|\]\{)/;return E(ne+q,te)}else return ne}return re}).filter(Boolean).join("")}function E(_,K){const j=_.match(K);if(!j)return _;const k=j.index??0,Y=_.slice(0,k+1),ee=_.slice(k+1),re=[];ee.replace(m,(te,oe,ue,ie,ge,he)=>(re.push({key:oe,operator:ue,value:ie,comma:ge,space:he}),""));let J=Y;re.filter(Boolean).forEach(te=>{const oe=te.value.slice(1,-1);J=(0,c.t)(J,te.key,oe,te.operator)});let ne=re.reduce((te,oe)=>(te+=`${oe.key}${oe.operator}${oe.value}${oe.comma??""}${oe.space??""}`,te),"");ne="{"+ne+"}";const q=ee.replace(ne,"");return J+q}function D(_){if(!_)return _;const K={},j={};for(const Y in _){const ee=_[Y][0];K[Y]=ee,ee.type==="histogram"&&(j[`${Y}_bucket`]={type:"counter",help:`Cumulative counters for the observation buckets (${ee.help})`},j[`${Y}_count`]={type:"counter",help:`Count of events that have been observed for the histogram metric (${ee.help})`},j[`${Y}_sum`]={type:"counter",help:`Total sum of all observed values for the histogram metric (${ee.help})`}),ee.type==="summary"&&(j[`${Y}_count`]={type:"counter",help:`Count of events that have been observed for the base metric (${ee.help})`},j[`${Y}_sum`]={type:"counter",help:`Total sum of all observed values for the base metric (${ee.help})`})}const k={};return k.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."},{...K,...j,...k}}function b(_){return C(_/1e3)}function C(_){return Math.floor(_/60)}function y(_,K=1){return Math.ceil(_/60)-Math.ceil(_/60)%K}function M(_){return _.slice(0,i.OP)}function T(_){return _&&_.length>=SUGGESTIONS_LIMIT?`, limited to the first ${SUGGESTIONS_LIMIT} received items`:""}const I=/[*+?()|\\.\[\]{}^$]/g;function x(_){return _.replace(I,"\\$&")}function S(_){return _.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/"/g,'\\"')}function O(_){return S(x(_))}const P={"=":r.D_.Equal,"!=":r.D_.NotEqual,"=~":r.D_.EqualRegEx,"!~":r.D_.NotEqualRegEx},L=(0,t.invert)(P);function U(_){const K=_.labelMatchers.map(j=>{const k=L[j.operator];return k?`${j.name}${k}"${j.value}"`:""}).filter(j=>j!=="").join(", ");return K?`{${K}}`:""}function R(_){return{refId:_.refId,expr:U(_),range:!0}}function B(_){return typeof _.content=="string"?_.content:""}function H(_){const K=[];for(const j of _)if(j instanceof o.Token&&j.type==="context-labels"){let k="",Y="",ee="";const re=Array.isArray(j.content)?j.content:[j.content];for(let J of re)if(typeof J=="string"){let ne;ne=J,(ne==="="||ne==="!="||ne==="=~"||ne==="!~")&&(ee=ne)}else if(J instanceof o.Token)switch(J.type){case"label-key":k=B(J);break;case"label-value":Y=B(J),Y=Y.substring(1,Y.length-1);const ne=P[ee];ne&&K.push({name:k,operator:ne,value:Y});break}}return K}function w(_,K){if(_===f.fD.None)return{start:V(K.from,!1).toString(),end:V(K.to,!0).toString()};const j=V(K.from,!1),k=(0,g.rs)(j,N(_)*60),Y=V(K.to,!0),ee=y(Y,N(_))*60;if(k===ee){const ne=ee+N(_)*60;return{start:k.toString(),end:ne.toString()}}const re=k.toString(),J=ee.toString();return{start:re,end:J}}function N(_){switch(_){case f.fD.Medium:return 10;case f.fD.High:return 60;default:return 1}}function V(_,K){return typeof _=="string"&&(_=u.parse(_,K)),Math.ceil(_.valueOf()/1e3)}function G(_,K){return K===void 0&&(K=l.o6),_.length=Math.min(_.length,K),_}},69470:(Q,A,e)=>{"use strict";e.d(A,{AW:()=>g,Ay:()=>i});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"],o=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."}],u=g.map(l=>l.label),i={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(l=>l.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:/[{};()`,.]/}},47891:(Q,A,e)=>{"use strict";e.d(A,{l:()=>C,z:()=>y});var t=e(69470),n=e(56823),o=e(25378),s=e(41598),r=e(65820);function g(){return[{id:r.jN.HistogramQuantile,name:"Histogram quantile",params:[{name:"Quantile",type:"number",options:[.99,.95,.9,.75,.5,.25]}],defaultParams:[.9],category:r.Ag.Functions,renderer:n.jY,addOperationHandler:n.iZ},{id:r.jN.LabelReplace,name:"Label replace",params:[{name:"Destination label",type:"string"},{name:"Replacement",type:"string"},{name:"Source label",type:"string"},{name:"Regex",type:"string"}],category:r.Ag.Functions,defaultParams:["","$1","","(.*)"],renderer:n.kf,addOperationHandler:n.iZ},{id:r.jN.Ln,name:"Ln",params:[],defaultParams:[],category:r.Ag.Functions,renderer:n.jY,addOperationHandler:n.iZ},c(r.jN.Changes),c(r.jN.Rate,!0),c(r.jN.Irate),c(r.jN.Increase,!0),c(r.jN.Idelta),c(r.jN.Delta),u({id:r.jN.HoltWinters,params:[(0,n.z2)(),{name:"Smoothing Factor",type:"number"},{name:"Trend Factor",type:"number"}],defaultParams:["$__interval",.5,.5],alternativesKey:"range function",category:r.Ag.RangeFunctions,renderer:n.nU,addOperationHandler:f,changeTypeHandler:i}),u({id:r.jN.PredictLinear,params:[(0,n.z2)(),{name:"Seconds from now",type:"number"}],defaultParams:["$__interval",60],alternativesKey:"range function",category:r.Ag.RangeFunctions,renderer:n.nU,addOperationHandler:f,changeTypeHandler:i}),u({id:r.jN.QuantileOverTime,params:[(0,n.z2)(),{name:"Quantile",type:"number"}],defaultParams:["$__interval",.5],alternativesKey:"overtime function",category:r.Ag.RangeFunctions,renderer:n.Kl,addOperationHandler:f,changeTypeHandler:i}),...o.Iu,{id:r.jN.NestedQuery,name:"Binary operation with query",params:[],defaultParams:[],category:r.Ag.BinaryOps,renderer:(T,I,x)=>x,addOperationHandler:d},u({id:r.jN.Abs}),u({id:r.jN.Absent}),u({id:r.jN.Acos,category:r.Ag.Trigonometric}),u({id:r.jN.Acosh,category:r.Ag.Trigonometric}),u({id:r.jN.Asin,category:r.Ag.Trigonometric}),u({id:r.jN.Asinh,category:r.Ag.Trigonometric}),u({id:r.jN.Atan,category:r.Ag.Trigonometric}),u({id:r.jN.Atanh,category:r.Ag.Trigonometric}),u({id:r.jN.Ceil}),u({id:r.jN.Clamp,name:"Clamp",params:[{name:"Minimum Scalar",type:"number"},{name:"Maximum Scalar",type:"number"}],defaultParams:[1,1]}),u({id:r.jN.ClampMax,params:[{name:"Maximum Scalar",type:"number"}],defaultParams:[1]}),u({id:r.jN.ClampMin,params:[{name:"Minimum Scalar",type:"number"}],defaultParams:[1]}),u({id:r.jN.Cos,category:r.Ag.Trigonometric}),u({id:r.jN.Cosh,category:r.Ag.Trigonometric}),u({id:r.jN.DayOfMonth,category:r.Ag.Time}),u({id:r.jN.DayOfWeek,category:r.Ag.Time}),u({id:r.jN.DayOfYear,category:r.Ag.Time}),u({id:r.jN.DaysInMonth,category:r.Ag.Time}),u({id:r.jN.Deg}),c(r.jN.Deriv),u({id:r.jN.Exp}),u({id:r.jN.Floor}),u({id:r.jN.Group}),u({id:r.jN.Hour}),u({id:r.jN.LabelJoin,params:[{name:"Destination Label",type:"string",editor:s.r},{name:"Separator",type:"string"},{name:"Source Label",type:"string",restParam:!0,optional:!0,editor:s.r}],defaultParams:["",",",""],renderer:h,explainHandler:p,addOperationHandler:m}),u({id:r.jN.Log10}),u({id:r.jN.Log2}),u({id:r.jN.Minute}),u({id:r.jN.Month}),u({id:r.jN.Pi,renderer:T=>`${T.id}()`}),u({id:r.jN.Quantile,params:[{name:"Value",type:"number"}],defaultParams:[1],renderer:n.jY}),u({id:r.jN.Rad}),c(r.jN.Resets),u({id:r.jN.Round,category:r.Ag.Functions,params:[{name:"To Nearest",type:"number"}],defaultParams:[1]}),u({id:r.jN.Scalar}),u({id:r.jN.Sgn}),u({id:r.jN.Sin,category:r.Ag.Trigonometric}),u({id:r.jN.Sinh,category:r.Ag.Trigonometric}),u({id:r.jN.Sort}),u({id:r.jN.SortDesc}),u({id:r.jN.Sqrt}),u({id:r.jN.Stddev}),u({id:r.jN.Tan,category:r.Ag.Trigonometric}),u({id:r.jN.Tanh,category:r.Ag.Trigonometric}),u({id:r.jN.Time,renderer:T=>`${T.id}()`}),u({id:r.jN.Timestamp}),u({id:r.jN.Vector,params:[{name:"Value",type:"number"}],defaultParams:[1],renderer:T=>`${T.id}(${T.params[0]})`}),u({id:r.jN.Year})]}function u(M){return{...M,id:M.id,name:M.name??(0,n.DQ)(M.id),params:M.params??[],defaultParams:M.defaultParams??[],category:M.category??r.Ag.Functions,renderer:M.renderer??(M.params?n.kf:n.jY),addOperationHandler:M.addOperationHandler??n.iZ}}function c(M,T=!1){return{id:M,name:(0,n.DQ)(M),params:[(0,n.z2)(T)],defaultParams:[T?"$__rate_interval":"$__interval"],alternativesKey:"range function",category:r.Ag.RangeFunctions,renderer:l,addOperationHandler:f,changeTypeHandler:i}}function i(M,T){return(M.params[0]==="$__rate_interval"&&T.defaultParams[0]!=="$__rate_interval"||M.params[0]==="$__interval"&&T.defaultParams[0]!=="$__interval")&&(M.params=T.defaultParams),M}function l(M,T,I){let x=(M.params??[])[0]??"5m";return`${T.id}(${I}[${x}])`}function f(M,T,I){const x={id:M.id,params:M.defaultParams};return T.operations.length>0&&I.getOperationDef(T.operations[0].id).addOperationHandler===f?{...T,operations:[x,...T.operations.slice(1)]}:{...T,operations:[x,...T.operations]}}function d(M,T){return{...T,binaryQueries:[...T.binaryQueries??[],{operator:"/",query:T}]}}function h(M,T,I){const x=M.params[0]??"",O=`"${M.params[1]??""}"`;return`${M.id}(${I}, "${x}", ${O}, "${M.params.slice(2).join(O)}")`}function p(M,T){let I=T?.documentation??"no docs";return typeof M.params[1]!="string"&&(I+=" \u{1F6A8}\u{1F6A8}\u{1F6A8} The `separator` must be a string."),I}function m(M,T){const I={id:M.id,params:M.defaultParams};return{...T,operations:[...T.operations,I]}}function a(){return[...(0,n.G3)(r.jN.Sum),...(0,n.G3)(r.jN.Avg),...(0,n.G3)(r.jN.Min),...(0,n.G3)(r.jN.Max),...(0,n.G3)(r.jN.Count),...(0,n.jC)(r.jN.TopK,{params:[{name:"K-value",type:"number"}],defaultParams:[5]}),...(0,n.jC)(r.jN.BottomK,{params:[{name:"K-value",type:"number"}],defaultParams:[5]}),...(0,n.jC)(r.jN.CountValues,{params:[{name:"Identifier",type:"string"}],defaultParams:["count"]}),v(r.jN.SumOverTime),v(r.jN.AvgOverTime),v(r.jN.MinOverTime),v(r.jN.MaxOverTime),v(r.jN.CountOverTime),v(r.jN.LastOverTime),v(r.jN.PresentOverTime),v(r.jN.AbsentOverTime),v(r.jN.StddevOverTime)]}function v(M){return{id:M,name:(0,n.DQ)(M),params:[(0,n.z2)()],defaultParams:["$__interval"],alternativesKey:"overtime function",category:r.Ag.RangeFunctions,renderer:E,addOperationHandler:f}}function E(M,T,I){let x=(M.params??[])[0]??"$__interval";return`${T.id}(${I}[${x}])`}var D=e(83077);class b{constructor(T){this.categories=[],this.operationsRegistry=new D.O(T)}setOperationCategories(T){this.categories=T}getOperationsForCategory(T){return this.operationsRegistry.list().filter(I=>I.category===T&&!I.hideFromList)}getAlternativeOperations(T){return this.operationsRegistry.list().filter(I=>I.alternativesKey&&I.alternativesKey===T)}getCategories(){return this.categories}getOperationDef(T){return this.operationsRegistry.getIfExists(T)}renderOperations(T,I){for(const x of I){const S=this.operationsRegistry.getIfExists(x.id);if(!S)throw new Error(`Could not find operation ${x.id} in the registry`);T=S.renderer(x,S,T)}return T}renderBinaryQueries(T,I){if(I)for(const x of I)T=`${this.renderBinaryQuery(T,x)}`;return T}renderBinaryQuery(T,I){let x=T+` ${I.operator} `;return I.vectorMatches&&(x+=`${I.vectorMatchesType}(${I.vectorMatches}) `),x+this.renderQuery(I.query,!0)}renderLabels(T){if(T.length===0)return"";let I="{";for(const x of T)I!=="{"&&(I+=", "),I+=`${x.label}${x.op}"${x.value}"`;return I+"}"}renderQuery(T,I){let x=`${T.metric??""}${this.renderLabels(T.labels)}`;return x=this.renderOperations(x,T.operations),!I&&this.hasBinaryOp(T)&&T.binaryQueries?.length&&(x=`(${x})`),x=this.renderBinaryQueries(x,T.binaryQueries),I&&(this.hasBinaryOp(T)||T.binaryQueries?.length)&&(x=`(${x})`),x}hasBinaryOp(T){return T.operations.find(I=>this.getOperationDef(I.id)?.category===r.Ag.BinaryOps)!==void 0}}class C extends b{constructor(){super(()=>{const T=[...g(),...a()];for(const I of T){const x=t.AW.find(S=>S.insertText===I.id);x&&(I.documentation=x.documentation)}return T}),this.setOperationCategories([r.Ag.Aggregations,r.Ag.RangeFunctions,r.Ag.Functions,r.Ag.BinaryOps,r.Ag.Trigonometric,r.Ag.Time])}getQueryPatterns(){return[{name:"Rate then sum",type:r.n5.Rate,operations:[{id:"rate",params:["$__rate_interval"]},{id:"sum",params:[]}]},{name:"Rate then sum by(label) then avg",type:r.n5.Rate,operations:[{id:"rate",params:["$__rate_interval"]},{id:"__sum_by",params:[""]},{id:"avg",params:[]}]},{name:"Histogram quantile on rate",type:r.n5.Histogram,operations:[{id:"rate",params:["$__rate_interval"]},{id:"__sum_by",params:["le"]},{id:"histogram_quantile",params:[.95]}]},{name:"Histogram quantile on increase",type:r.n5.Histogram,operations:[{id:"increase",params:["$__rate_interval"]},{id:"__max_by",params:["le"]},{id:"histogram_quantile",params:[.95]}]},{name:"Binary Query",type:r.n5.Binary,operations:[{id:"rate",params:["$__rate_interval"]},{id:"sum",params:[]}],binaryQueries:[{operator:"/",query:{metric:"",labels:[],operations:[{id:"rate",params:["$__rate_interval"]},{id:"sum",params:[]}]}}]}]}}const y=new C},25378:(Q,A,e)=>{"use strict";e.d(A,{AE:()=>s,C8:()=>o,Iu:()=>r});var t=e(56823),n=e(65820);const o=[{id:n.jN.Addition,name:"Add scalar",sign:"+"},{id:n.jN.Subtraction,name:"Subtract scalar",sign:"-"},{id:n.jN.MultiplyBy,name:"Multiply by scalar",sign:"*"},{id:n.jN.DivideBy,name:"Divide by scalar",sign:"/"},{id:n.jN.Modulo,name:"Modulo by scalar",sign:"%"},{id:n.jN.Exponent,name:"Exponent",sign:"^"},{id:n.jN.EqualTo,name:"Equal to",sign:"==",comparison:!0},{id:n.jN.NotEqualTo,name:"Not equal to",sign:"!=",comparison:!0},{id:n.jN.GreaterThan,name:"Greater than",sign:">",comparison:!0},{id:n.jN.LessThan,name:"Less than",sign:"<",comparison:!0},{id:n.jN.GreaterOrEqual,name:"Greater or equal to",sign:">=",comparison:!0},{id:n.jN.LessOrEqual,name:"Less or equal to",sign:"<=",comparison:!0}],s=o.reduce((u,c)=>(u[c.sign]={id:c.id,comparison:c.comparison},u),{}),r=o.map(u=>{const c=[{name:"Value",type:"number"}],i=[2];return u.comparison&&(c.push({name:"Bool",type:"boolean",description:"If checked comparison will return 0 or 1 for the value rather than filtering."}),i.push(!1)),{id:u.id,name:u.name,params:c,defaultParams:i,alternativesKey:"binary scalar operations",category:n.Ag.BinaryOps,renderer:g(u.sign),addOperationHandler:t.iZ}});function g(u){return function(i,l,f){let d=i.params[0],h="";return i.params.length===2&&(h=i.params[1]?" bool":""),`${f} ${u}${h} ${d}`}}},41598:(Q,A,e)=>{"use strict";e.d(A,{r:()=>g});var t=e(96540),n=e(50877),o=e(88323),s=e(47891),r=e(56823);function g({onChange:c,index:i,operationId:l,value:f,query:d,datasource:h}){const[p,m]=(0,t.useState)({});return t.createElement(o.l6,{inputId:(0,r.OS)(l,i),autoFocus:f===""?!0:void 0,openMenuOnFocus:!0,onOpenMenu:async()=>{m({isLoading:!0});const a=await u(d,h);m({options:a,isLoading:void 0})},isLoading:p.isLoading,allowCustomValue:!0,noOptionsMessage:"No labels found",loadingMessage:"Loading labels",options:p.options,value:(0,n.z)(f),onChange:a=>c(i,a.value)})}async function u(c,i){let l=c.labels;i.type==="prometheus"&&(l=[{label:"__name__",op:"=",value:c.metric},...c.labels]);const f=s.z.renderLabels(l),d=await i.languageProvider.fetchLabelsWithMatch(f);return Object.keys(d).map(h=>({label:h,value:h}))}},95842:(Q,A,e)=>{"use strict";e.d(A,{dm:()=>ae,o6:()=>Z});var t=e(32196),n=e(76459),o=e.n(n),s=e(96540),r=e(23257),g=e.n(r),u=e(50877),c=e(13544),i=e(97801),l=e(81580),f=e(32264),d=e(40845),h=e(55852),p=e(14578),m=e(88824),a=e(40276),v=e(88323),E=e(39268),D=e(14186),b=e(12681),C=e(45889),y=e(71440),M=e(37390),T=e(10354),I=e(62930),x=e(60782),S=e(19727),O=e(19384),P=e(15292),L=e(56034),U=e(14110),R=e(32799),B=e(13567);const{setFilteredMetricCount:H}=B.Ow.actions;async function w(_e,ze,Ve){let Ne=!0;const ot=_e.languageProvider.metricsMetadata;ot&&Object.keys(ot).length===0&&(Ne=!1);let nt={},pt={},mt;return mt=Ve?.map(gt=>{const Pt=N(gt,_e),Mt=`${gt}\xA6${Pt.description}`;return nt[gt]=Pt,pt[Mt]=Pt,Pt}),{isLoading:!1,hasMetadata:Ne,metrics:mt??[],metaHaystackDictionary:pt,nameHaystackDictionary:nt,totalMetricCount:mt?.length??0,filteredMetricCount:mt?.length??0}}function N(_e,ze){let Ve=(0,R.AU)(_e,ze.languageProvider.metricsMetadata);const Ne=(0,R.pK)(_e,ze.languageProvider.metricsMetadata);return["histogram","summary"].forEach(nt=>{Ne?.toLowerCase().includes(nt)&&Ve!==nt&&(Ve+=` (${nt})`)}),{value:_e,type:Ve,description:Ne}}function V(_e,ze){const Ve=G(_e);return!_e.isLoading&&_e.filteredMetricCount!==Ve.length&&ze(H(Ve.length)),K(Ve,_e.pageNum,_e.resultsPerPage)}function G(_e){let ze=_e.metrics;return _e.fuzzySearchQuery&&!_e.useBackend&&(_e.fullMetaSearch?ze=_e.metaHaystackOrder.map(Ve=>_e.metaHaystackDictionary[Ve]):ze=_e.nameHaystackOrder.map(Ve=>_e.nameHaystackDictionary[Ve])),_e.selectedTypes.length>0&&(ze=ze.filter((Ve,Ne)=>_e.selectedTypes.some(nt=>Ve.type&&nt.value?Ve.type.includes(nt.value):!Ve.type&&nt.value==="no type"))),_e.includeNullMetadata||(ze=ze.filter(Ve=>Ve.type!==void 0&&Ve.description!==void 0)),ze}function _(_e){if(!_e.metrics.length)return[];const ze=_e.resultsPerPage===0?1:_e.resultsPerPage,Ve=Math.floor(G(_e).length/ze)+1;return[...Array(Ve).keys()].map(Ne=>Ne+1)}function K(_e,ze,Ve){const Ne=Ve===0?1:Ve,ot=ze===1?0:(ze-1)*Ne,nt=ot+Ne;return _e.slice(ot,nt)}const j=(_e,ze,Ve)=>_e<1?1:_e>Ve?Ve:_e??ze;async function k(_e,ze,Ve){const Ne=(0,y.b4)(_e),ot=ze.map(mt=>`,${mt.label}="${mt.value}"`),nt=`label_values({__name__=~".*${Ne}"${ze?ot.join():""}},__name__)`;return await Ve.metricFindQuery(nt).then(mt=>mt.map(gt=>N(gt.text,Ve)))}function Y(_e,ze,Ve,Ne){switch(_e){case"grafana_prom_metric_encycopedia_tracking":(0,U.rR)(_e,{metric:Ve,hasMetadata:ze?.hasMetadata,totalMetricCount:ze?.totalMetricCount,fuzzySearchQuery:ze?.fuzzySearchQuery,fullMetaSearch:ze?.fullMetaSearch,selectedTypes:ze?.selectedTypes,useRegexSearch:ze?.useBackend,includeResultsWithoutMetadata:ze?.includeNullMetadata});case"grafana_prom_metric_encycopedia_disable_text_wrap_interaction":(0,U.rR)(_e,{disableTextWrap:ze?.disableTextWrap});case"grafana_prometheus_metric_encyclopedia_open":(0,U.rR)(_e,{query:Ne})}}const ee=[{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."}],re={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 J(_e){const{state:ze,onChangeFullMetaSearch:Ve,onChangeIncludeNullMetadata:Ne,onChangeDisableTextWrap:ot,onChangeUseBackend:nt}=_e,pt=(0,d.$j)(),mt=ne(pt);return s.createElement(s.Fragment,null,s.createElement("div",{className:mt.selectItem},s.createElement(P.d,{"data-testid":$e.searchWithMetadata,value:ze.fullMetaSearch,disabled:ze.useBackend||!ze.hasMetadata,onChange:()=>Ve()}),s.createElement("div",{className:mt.selectItemLabel},re.metadataSearchSwitch)),s.createElement("div",{className:mt.selectItem},s.createElement(P.d,{value:ze.includeNullMetadata,disabled:!ze.hasMetadata,onChange:()=>Ne()}),s.createElement("div",{className:mt.selectItemLabel},re.includeNullMetadata)),s.createElement("div",{className:mt.selectItem},s.createElement(P.d,{value:ze.disableTextWrap,onChange:()=>ot()}),s.createElement("div",{className:mt.selectItemLabel},"Disable text wrap")),s.createElement("div",{className:mt.selectItem},s.createElement(P.d,{"data-testid":$e.setUseBackend,value:ze.useBackend,onChange:()=>nt()}),s.createElement("div",{className:mt.selectItemLabel},re.setUseBackend,"\xA0"),s.createElement(L.m,{content:"Filter metric names by regex search, using an additional call on the Prometheus API.",placement:"bottom-end"},s.createElement(p.I,{name:"info-circle",size:"xs",className:mt.settingsIcon}))))}function ne(_e){return{settingsIcon:(0,t.css)` color: ${_e.colors.text.secondary}; `,selectItem:(0,t.css)` display: flex; flex-direction: row; align-items: center; padding: 4px 0; `,selectItemLabel:(0,t.css)` margin: 0 0 0 ${_e.spacing(1)}; align-self: center; color: ${_e.colors.text.secondary}; font-size: 12px; `}}var q=e(67061);function te({feedbackUrl:_e}){const ze=(0,d.of)(oe);return s.createElement(q.B,null,s.createElement("a",{href:_e,className:ze.link,title:"The metrics explorer is new, please let us know how we can improve it",target:"_blank",rel:"noreferrer noopener"},s.createElement(p.I,{name:"comment-alt-message"})," Give feedback"))}function oe(_e){return{link:(0,t.css)({color:_e.colors.text.secondary,fontSize:_e.typography.bodySmall.fontSize,":hover":{color:_e.colors.text.link},margin:"-25px 0 30px 0"})}}var ue=e(4253);function ie(_e){const{metrics:ze,onChange:Ve,onClose:Ne,query:ot,state:nt,disableTextWrap:pt}=_e,mt=(0,d.$j)(),gt=ge(mt,pt);function Pt(It){It.value&&(Ve({...ot,metric:It.value}),Y("grafana_prom_metric_encycopedia_tracking",nt,It.value),Ne())}function Mt(It){return nt.fullMetaSearch&&It?s.createElement(s.Fragment,null,s.createElement("td",null,zt(It.type??"")),s.createElement("td",null,s.createElement(g(),{textToHighlight:It.description??"",searchWords:nt.metaHaystackMatches,autoEscape:!0,highlightClassName:gt.matchHighLight}))):s.createElement(s.Fragment,null,s.createElement("td",null,zt(It.type??"")),s.createElement("td",null,It.description??""))}function Yt(It,Dn,ft){return s.createElement(s.Fragment,null,It,s.createElement("span",{className:gt.tooltipSpace},s.createElement(L.m,{content:s.createElement(s.Fragment,null,"When creating a ",Dn,", Prometheus exposes multiple series with the type counter."," ",(0,ue.jW)(ft)),placement:"bottom-start",interactive:!0},s.createElement(p.I,{name:"info-circle",size:"xs"}))))}function zt(It){return It?It.includes("(summary)")?Yt(It,"summary","https://prometheus.io/docs/concepts/metric_types/#summary"):It.includes("(histogram)")?Yt(It,"histogram","https://prometheus.io/docs/concepts/metric_types/#histogram"):It:""}function _t(){let It;return nt.fuzzySearchQuery||(It="There are no metrics found in the data source."),ot.labels.length>0&&(It="There are no metrics found. Try to expand your label filters."),(nt.fuzzySearchQuery||nt.selectedTypes.length>0)&&(It="There are no metrics found. Try to expand your search and filters."),s.createElement("tr",{className:gt.noResults},s.createElement("td",{colSpan:3},It))}function rt(It){return It.useBackend?[It.fuzzySearchQuery]:It.fullMetaSearch?It.metaHaystackMatches:It.nameHaystackMatches}return s.createElement("table",{className:gt.table},s.createElement("thead",{className:gt.stickyHeader},s.createElement("tr",null,s.createElement("th",{className:`${gt.nameWidth} ${gt.tableHeaderPadding}`},"Name"),nt.hasMetadata&&s.createElement(s.Fragment,null,s.createElement("th",{className:`${gt.typeWidth} ${gt.tableHeaderPadding}`},"Type"),s.createElement("th",{className:`${gt.descriptionWidth} ${gt.tableHeaderPadding}`},"Description")),s.createElement("th",{className:gt.selectButtonWidth}," "))),s.createElement("tbody",null,s.createElement(s.Fragment,null,ze.length>0&&ze.map((It,Dn)=>s.createElement("tr",{key:It?.value??Dn,className:gt.row},s.createElement("td",{className:gt.nameOverflow},s.createElement(g(),{textToHighlight:It?.value??"",searchWords:rt(nt),autoEscape:!0,highlightClassName:gt.matchHighLight})),nt.hasMetadata&&Mt(It),s.createElement("td",null,s.createElement(h.$n,{size:"md",variant:"secondary",onClick:()=>Pt(It),className:gt.centerButton},"Select")))),ze.length===0&&!nt.isLoading&&_t())))}const ge=(_e,ze)=>({table:(0,t.css)` ${ze?"":"table-layout: fixed;"} border-radius: ${_e.shape.radius.default}; width: 100%; white-space: ${ze?"nowrap":"normal"}; td { padding: ${_e.spacing(1)}; } td, th { min-width: ${_e.spacing(3)}; border-bottom: 1px solid ${_e.colors.border.weak}; } `,row:(0,t.css)` label: row; border-bottom: 1px solid ${_e.colors.border.weak} &:last-child { border-bottom: 0; } `,tableHeaderPadding:(0,t.css)` padding: 8px; `,matchHighLight:(0,t.css)` background: inherit; color: ${_e.components.textHighlight.text}; background-color: ${_e.components.textHighlight.background}; `,nameWidth:(0,t.css)` ${ze?"":"width: 37.5%;"} `,nameOverflow:(0,t.css)` ${ze?"":"overflow-wrap: anywhere;"} `,typeWidth:(0,t.css)` ${ze?"":"width: 15%;"} `,descriptionWidth:(0,t.css)` ${ze?"":"width: 35%;"} `,selectButtonWidth:(0,t.css)` ${ze?"":"width: 12.5%;"} `,stickyHeader:(0,t.css)` position: sticky; top: 0; background-color: ${_e.colors.background.primary}; `,noResults:(0,t.css)` text-align: center; color: ${_e.colors.text.secondary}; `,tooltipSpace:(0,t.css)` margin-left: 4px; `,centerButton:(0,t.css)` display: block; margin: auto; border: none; `}),he=(_e,ze)=>({modal:(0,t.css)` width: 85vw; ${_e.breakpoints.down("md")} { width: 100%; } ${_e.breakpoints.up("xl")} { width: 60%; } `,inputWrapper:(0,t.css)` display: flex; flex-direction: row; flex-wrap: wrap; `,inputItemFirst:(0,t.css)` flex-basis: 40%; padding-right: 16px; ${_e.breakpoints.down("md")} { padding-right: 0px; padding-bottom: 16px; } `,inputItem:(0,t.css)` flex-grow: 1; flex-basis: 20%; ${_e.breakpoints.down("md")} { min-width: 100%; } `,selectWrapper:(0,t.css)` margin-bottom: ${_e.spacing(1)}; `,resultsAmount:(0,t.css)` color: ${_e.colors.text.secondary}; font-size: 0.85rem; padding: 0 0 4px 0; `,resultsData:(0,t.css)` margin: 4px 0 ${_e.spacing(2)} 0; `,resultsDataCount:(0,t.css)` margin: 0; `,resultsDataFiltered:(0,t.css)` color: ${_e.colors.text.secondary}; text-align: center; border: solid 1px rgba(204, 204, 220, 0.25); padding: 7px; `,resultsDataFilteredText:(0,t.css)` display: inline; vertical-align: text-top; `,results:(0,t.css)` height: calc(80vh - 310px); overflow-y: scroll; `,resultsFooter:(0,t.css)` margin-top: 24px; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; position: sticky; `,currentlySelected:(0,t.css)` color: grey; opacity: 75%; font-size: 0.75rem; `,loadingSpinner:(0,t.css)` visibility: hidden; `,visible:(0,t.css)` visibility: visible; `,settingsBtn:(0,t.css)` float: right; `,noBorder:(0,t.css)` border: none; `,resultsPerPageLabel:(0,t.css)` color: ${_e.colors.text.secondary}; opacity: 75%; padding-top: 5px; font-size: 0.85rem; margin-right: 8px; `,resultsPerPageWrapper:(0,t.css)` display: flex; `});var De=e(53076),pe=e(2543);const le=new De.A({intraMode:1,intraIns:1,intraSub:1,intraTrn:1,intraDel:1});function Te(_e,ze,Ve){const[Ne,ot,nt]=le.search(_e,ze,0,1e5);let pt=[],mt=new Set;if(Ne&&nt){const gt=(Pt,Mt)=>{Mt&&mt.add(Pt)};for(let Pt=0;Pt<nt.length;Pt++){let Mt=nt[Pt];De.A.highlight(_e[ot.idx[Mt]],ot.ranges[Mt],gt),pt.push(_e[ot.idx[Mt]])}Ve([pt,[...mt]])}else ze||Ve([[],[]])}const Ee=(0,pe.debounce)(Te,300),{setIsLoading:Re,buildMetrics:me,filterMetricsBackend:Me,setResultsPerPage:ye,setPageNum:Le,setFuzzySearchQuery:We,setNameHaystack:Be,setMetaHaystack:Ye,setFullMetaSearch:at,setIncludeNullMetadata:st,setSelectedTypes:Ke,setUseBackend:Xe,setDisableTextWrap:He,showAdditionalSettings:Ge}=B.Ow.actions,xe=_e=>{const{datasource:ze,isOpen:Ve,onClose:Ne,onChange:ot,query:nt,initialMetrics:pt}=_e,[mt,gt]=(0,s.useReducer)(B.Ow.reducer,(0,B.ue)(nt)),Pt=(0,d.$j)(),Mt=he(Pt,mt.disableTextWrap),Yt=(0,s.useCallback)(async()=>{gt(Re(!0));const yt=await w(ze,nt,pt);gt(me({isLoading:!1,hasMetadata:yt.hasMetadata,metrics:yt.metrics,metaHaystackDictionary:yt.metaHaystackDictionary,nameHaystackDictionary:yt.nameHaystackDictionary,totalMetricCount:yt.metrics.length,filteredMetricCount:yt.metrics.length}))},[nt,ze,pt]);(0,s.useEffect)(()=>{Yt()},[Yt]);const zt=ee.map(yt=>({value:yt.value,label:yt.value,description:yt.description})),_t=(0,s.useMemo)(()=>o()(async yt=>{gt(Re(!0));const jt=await k(yt,nt.labels,ze);gt(Me({metrics:jt,filteredMetricCount:jt.length,isLoading:!1}))},ze.getDebounceTimeInMilliseconds()),[ze,nt]);function rt(yt){gt(Be(yt))}function It(yt){gt(Ye(yt))}function Dn(yt,jt){mt.useBackend&&yt===""?Yt():mt.useBackend?_t(yt):jt?Ee(Object.keys(mt.metaHaystackDictionary),yt,It):Ee(Object.keys(mt.nameHaystackDictionary),yt,rt)}const ft=s.createElement(J,{state:mt,onChangeFullMetaSearch:()=>{const yt=!mt.fullMetaSearch;gt(at(yt)),ot({...nt,fullMetaSearch:yt}),Dn(mt.fuzzySearchQuery,yt)},onChangeIncludeNullMetadata:()=>{gt(st(!mt.includeNullMetadata)),ot({...nt,includeNullMetadata:!mt.includeNullMetadata})},onChangeDisableTextWrap:()=>{gt(He()),ot({...nt,disableTextWrap:!mt.disableTextWrap}),Y("grafana_prom_metric_encycopedia_disable_text_wrap_interaction",mt,"")},onChangeUseBackend:()=>{const yt=!mt.useBackend;gt(Xe(yt)),ot({...nt,useBackend:yt}),yt===!1?Yt():mt.fuzzySearchQuery!==""&&_t(mt.fuzzySearchQuery)}});return s.createElement(M.a,{"data-testid":$e.metricModal,isOpen:Ve,title:"Metrics explorer",onDismiss:Ne,"aria-label":"Browse metrics",className:Mt.modal},s.createElement(te,{feedbackUrl:"https://forms.gle/DEMAJHoAMpe3e54CA"}),s.createElement("div",{className:Mt.inputWrapper,"data-testid":c.Tp.components.DataSource.Prometheus.queryEditor.builder.metricsExplorer},s.createElement("div",{className:(0,t.cx)(Mt.inputItem,Mt.inputItemFirst)},s.createElement(T.p,{autoFocus:!0,"data-testid":$e.searchMetric,placeholder:re.browse,value:mt.fuzzySearchQuery,onInput:yt=>{const jt=yt.currentTarget.value??"";gt(We(jt)),Dn(jt,mt.fullMetaSearch)}})),mt.hasMetadata&&s.createElement("div",{className:Mt.inputItem},s.createElement(v.KF,{"data-testid":$e.selectType,inputId:"my-select",options:zt,value:mt.selectedTypes,placeholder:re.type,onChange:yt=>gt(Ke(yt))})),s.createElement("div",null,s.createElement(I.y,{className:`${Mt.loadingSpinner} ${mt.isLoading?Mt.visible:""}`})),s.createElement("div",{className:Mt.inputItem},s.createElement(x.G,{"aria-label":"Additional settings",content:ft,placement:"bottom-end",closeButton:!1},s.createElement(S.e,{className:Mt.settingsBtn},s.createElement(h.$n,{variant:"secondary",size:"md",onClick:()=>gt(Ge()),"data-testid":$e.showAdditionalSettings,className:Mt.noBorder},"Additional Settings"),s.createElement(h.$n,{className:Mt.noBorder,variant:"secondary",icon:mt.showAdditionalSettings?"angle-up":"angle-down"}))))),s.createElement("div",{className:Mt.resultsData},nt.metric&&s.createElement("i",{className:Mt.currentlySelected},"Currently selected: ",nt.metric),nt.labels.length>0&&s.createElement("div",{className:Mt.resultsDataFiltered},s.createElement(p.I,{name:"info-circle",size:"sm"}),s.createElement("div",{className:Mt.resultsDataFilteredText},"\xA0These metrics have been pre-filtered by labels chosen in the label filters."))),s.createElement("div",{className:Mt.results},mt.metrics&&s.createElement(ie,{metrics:V(mt,gt),onChange:ot,onClose:Ne,query:nt,state:mt,disableTextWrap:mt.disableTextWrap})),s.createElement("div",{className:Mt.resultsFooter},s.createElement("div",{className:Mt.resultsAmount},"Showing ",mt.filteredMetricCount," of ",mt.totalMetricCount," results"),s.createElement(O.d,{currentPage:mt.pageNum??1,numberOfPages:_(mt).length,onNavigate:yt=>{gt(Le(yt??1))}}),s.createElement("div",{className:Mt.resultsPerPageWrapper},s.createElement("p",{className:Mt.resultsPerPageLabel},"# Results per page\xA0"),s.createElement(T.p,{"data-testid":$e.resultsPerPage,value:j(mt.resultsPerPage,B.J3,B.yH),placeholder:"results per page",width:10,title:"The maximum results per page is "+B.yH,type:"number",onInput:yt=>{const jt=+yt.currentTarget.value;isNaN(jt)||jt>=B.yH||gt(ye(jt))}}))))},$e={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"},be=" ",Z=1e3;function ae({datasource:_e,query:ze,onChange:Ve,onGetMetrics:Ne,labelsFilters:ot,metricLookupDisabled:nt,onBlur:pt,variableEditor:mt}){const gt=(0,d.of)(de),[Pt,Mt]=(0,s.useState)({}),Yt=f.$.featureToggles.prometheusMetricEncyclopedia,zt=[{value:"BrowseMetrics",label:"Metrics explorer",description:"Browse and filter all metrics and metadata with a fuzzy search"}],_t=(0,s.useCallback)((on,Xt)=>{const fn=on.label??on.value;return fn?fn.toLowerCase?Xt.split(be).reduce((hn,ca)=>{const Rt=fn.toLowerCase().includes(ca.toLowerCase());let qt=!1;return Yt&&(qt=fn==="Metrics explorer"),hn&&(Rt||qt)},!0):!0:!1},[Yt]),rt=(0,s.useCallback)((on,Xt)=>on.__isNew__?on.label:s.createElement(g(),{searchWords:Xt.inputValue.split(be),textToHighlight:on.label??"",highlightClassName:gt.highlight}),[gt.highlight]),It=(on,Xt)=>{const fn=(0,y.b4)(on);return ve(fn,Xt)},Dn=on=>_e.metricFindQuery(It(on,ot)).then(fn=>{const An=fn.length;(0,C.ky)(fn),An>fn.length?Mt({...Pt,resultsTruncated:!0}):Mt({...Pt,resultsTruncated:!1});const hn=fn.map(ca=>({label:ca.text,value:ca.text}));return Yt?[...zt,...hn]:hn}),ft=()=>Promise.resolve([]),yt=o()(on=>Dn(on),_e.getDebounceTimeInMilliseconds()),jt=on=>{const Xt=on.data;if(Xt.value==="BrowseMetrics"){const fn=on.isFocused?gt.focus:"";return s.createElement("div",{...on.innerProps,ref:on.innerRef,className:`${gt.customOptionWidth} metric-encyclopedia-open`,"aria-label":"Select option",onKeyDown:An=>{An.code==="Enter"&&Mt({...Pt,metricsModalOpen:!0})}},s.createElement("div",{className:`${gt.customOption} ${fn} metric-encyclopedia-open`},s.createElement("div",null,s.createElement("div",{className:"metric-encyclopedia-open"},Xt.label),s.createElement("div",{className:`${gt.customOptionDesc} metric-encyclopedia-open`},Xt.description)),s.createElement(h.$n,{fill:"text",size:"sm",variant:"secondary",onClick:()=>Mt({...Pt,metricsModalOpen:!0}),className:"metric-encyclopedia-open"},"Open",s.createElement(p.I,{name:"arrow-right"}))))}return(0,b.o5)(on)},cn=({children:on,maxHeight:Xt,innerRef:fn,innerProps:An})=>{const hn=(0,d.$j)(),ca=(0,m.J)(hn),Rt=!s.isValidElement(on)&&Pt.resultsTruncated;return s.createElement("div",{...An,className:`${ca.menu} ${gt.customMenuContainer}`,style:{maxHeight:Xt},"aria-label":"Select options menu"},s.createElement(a.E,{scrollRefCallback:fn,autoHide:!1,autoHeightMax:"inherit",hideHorizontalTrack:!0},on),Rt&&s.createElement("div",{className:gt.customMenuFooter},s.createElement("div",null,"Only the top 1000 metrics are displayed in the metric select. Use the metrics explorer to view all metrics.")))},pn=()=>s.createElement(v.DW,{"data-testid":c.Tp.components.DataSource.Prometheus.queryEditor.builder.metricSelect,isClearable:!!mt,inputId:"prometheus-metric-select",className:gt.select,value:ze.metric?(0,u.z)(ze.metric):void 0,placeholder:"Select metric",allowCustomValue:!0,formatOptionLabel:rt,filterOption:_t,onOpenMenu:async()=>{if(nt)return;Mt({isLoading:!0});const on=await Ne(),Xt=on.map(An=>An.value),fn=on.length;on.length>Z&&(0,C.ky)(on),Mt(Yt?{metrics:[...zt,...on],isLoading:void 0,initialMetrics:Xt,resultsTruncated:fn>on.length}:{metrics:on,isLoading:void 0,resultsTruncated:fn>on.length})},loadOptions:nt?ft:yt,isLoading:Pt.isLoading,defaultOptions:Pt.metrics,onChange:on=>{const Xt=on?.value;Xt?Yt&&Xt==="BrowseMetrics"?(Y("grafana_prometheus_metric_encyclopedia_open",null,"",ze),Mt({...Pt,metricsModalOpen:!0})):Ve({...ze,metric:Xt}):Ve({...ze,metric:""})},components:Yt?{Option:jt,MenuList:cn}:{MenuList:cn},onBlur:pt||(()=>{})});return s.createElement(s.Fragment,null,Yt&&!_e.lookupsDisabled&&Pt.metricsModalOpen&&s.createElement(xe,{datasource:_e,isOpen:Pt.metricsModalOpen,onClose:()=>Mt({...Pt,metricsModalOpen:!1}),query:ze,onChange:Ve,initialMetrics:Pt.initialMetrics??[]}),mt?s.createElement(E.C,null,s.createElement(D.I,{label:"Metric",labelWidth:20,tooltip:s.createElement("div",null,"Optional: returns a list of label values for the label name in the specified metric.")},pn())):s.createElement(i.B,null,s.createElement(l.c,{label:"Metric"},pn())))}const de=_e=>({select:(0,t.css)` min-width: 125px; `,highlight:(0,t.css)` label: select__match-highlight; background: inherit; padding: inherit; color: ${_e.colors.warning.contrastText}; background-color: ${_e.colors.warning.main}; `,customOption:(0,t.css)` padding: 8px; display: flex; justify-content: space-between; cursor: pointer; :hover { background-color: ${_e.colors.emphasize(_e.colors.background.primary,.1)}; } `,customOptionlabel:(0,t.css)` color: ${_e.colors.text.primary}; `,customOptionDesc:(0,t.css)` color: ${_e.colors.text.secondary}; font-size: ${_e.typography.size.xs}; opacity: 50%; `,focus:(0,t.css)` background-color: ${_e.colors.emphasize(_e.colors.background.primary,.1)}; `,customOptionWidth:(0,t.css)` min-width: 400px; `,customMenuFooter:(0,t.css)` flex: 0; display: flex; justify-content: space-between; padding: ${_e.spacing(1.5)}; border-top: 1px solid ${_e.colors.border.weak}; color: ${_e.colors.text.secondary}; `,customMenuContainer:(0,t.css)` display: flex; flex-direction: column; background: ${_e.colors.background.primary}; box-shadow: ${_e.shadows.z3}; `}),ve=(_e,ze)=>{const Ve=ze?Ue(ze):[];return`label_values({__name__=~".*${_e}"${Ve?Ve.join(""):""}},__name__)`},Ue=_e=>_e.map(ze=>`,${ze.label}="${ze.value}"`)},46777:(Q,A,e)=>{"use strict";e.d(A,{I:()=>I});var t=e(96540),n=e(32799),o=e(45889),s=e(47891),r=e(71440),g=e(32196),u=e(2543),c=e(7650),i=e(97801),l=e(81580),f=e(39268),d=e(76892),h=e(76459),p=e.n(h),m=e(50877),a=e(13544),v=e(81392),E=e(3721),D=e(88323);function b({item:S,defaultOp:O,onChange:P,onDelete:L,onGetLabelNames:U,onGetLabelValues:R,invalidLabel:B,invalidValue:H,getLabelValuesAutofillSuggestions:w,debounceDuration:N}){const[V,G]=(0,t.useState)({}),[_,K]=(0,t.useState)(!1),[j,k]=(0,t.useState)(!1),Y=(ne=S.op)=>C.find(q=>q.label===ne)?.isMultiValue,ee=ne=>{if(ne){const q=/\(([^)]+)\)/,te=ne?.match(q);return te&&te[0].indexOf("|")>0?[ne]:ne.indexOf("|")>0?ne.split("|"):[ne]}return[]},re=p()(ne=>w(ne,S.label),N),J=S?.value??"";return t.createElement("div",{key:J,"data-testid":"prometheus-dimensions-filter-item"},t.createElement(v.M,null,t.createElement(D.l6,{placeholder:"Select label","data-testid":a.Tp.components.QueryBuilder.labelSelect,inputId:"prometheus-dimensions-filter-item-key",width:"auto",value:S.label?(0,m.z)(S.label):null,allowCustomValue:!0,onOpenMenu:async()=>{G({isLoadingLabelNames:!0});const ne=await U(S);K(!0),G({labelNames:ne,isLoadingLabelNames:void 0})},onCloseMenu:()=>{K(!1)},isOpen:_,isLoading:V.isLoadingLabelNames??!1,options:V.labelNames,onChange:ne=>{ne.label&&P({...S,op:S.op??O,label:ne.label})},invalid:B}),t.createElement(D.l6,{"data-testid":a.Tp.components.QueryBuilder.matchOperatorSelect,className:"query-segment-operator",value:(0,m.z)(S.op??O),options:C,width:"auto",onChange:ne=>{ne.value!=null&&P({...S,op:ne.value,value:Y(ne.value)?S.value:ee(S?.value)[0]})}}),t.createElement(D.DW,{placeholder:"Select value","data-testid":a.Tp.components.QueryBuilder.valueSelect,inputId:"prometheus-dimensions-filter-item-value",width:"auto",value:Y()?ee(J).map(m.z):ee(J).map(m.z)[0],allowCustomValue:!0,onOpenMenu:async()=>{G({isLoadingLabelValues:!0});const ne=await R(S);(0,o.ky)(ne),k(!0),G({...V,labelValues:ne,isLoadingLabelValues:void 0})},onCloseMenu:()=>{k(!1)},isOpen:j,defaultOptions:V.labelValues,isMulti:Y(),isLoading:V.isLoadingLabelValues,loadOptions:re,onChange:ne=>{if(ne.value)P({...S,value:ne.value,op:S.op??O});else{const q=ne.map(te=>te.label).join("|");P({...S,value:q,op:S.op??O})}},invalid:H}),t.createElement(E.Z,{"aria-label":`remove-${S.label}`,icon:"times",variant:"secondary",onClick:L})))}const C=[{label:"=",value:"=",isMultiValue:!1},{label:"!=",value:"!=",isMultiValue:!1},{label:"<",value:"<",isMultiValue:!1},{label:">",value:">",isMultiValue:!1},{label:"=~",value:"=~",isMultiValue:!0},{label:"!~",value:"!~",isMultiValue:!0}],y="Select at least 1 label filter (label and value)";function M({labelsFilters:S,onChange:O,onGetLabelNames:P,onGetLabelValues:L,labelFilterRequired:U,getLabelValuesAutofillSuggestions:R,debounceDuration:B,variableEditor:H}){const w="=",[N,V]=(0,t.useState)([{op:w}]);(0,t.useEffect)(()=>{S.length>0?V(S):V([{op:w}])},[S]);const G=j=>{V(j);const k=j.filter(Y=>Y.label!=null&&Y.value!=null);(0,u.isEqual)(k,S)||O(k)},_=N.some(j=>j.label&&j.value),K=()=>t.createElement(c.o,{items:N,onChange:G,renderItem:(j,k,Y)=>t.createElement(b,{debounceDuration:B,item:j,defaultOp:w,onChange:k,onDelete:Y,onGetLabelNames:P,onGetLabelValues:L,invalidLabel:U&&!j.label,invalidValue:U&&!j.value,getLabelValuesAutofillSuggestions:R})});return t.createElement(t.Fragment,null,H?t.createElement(f.C,null,t.createElement("div",{className:(0,g.cx)((0,g.css)` display: flex; `)},t.createElement(d.c,{width:20,tooltip:t.createElement("div",null,"Optional: used to filter the metric select for this query type.")},"Label filters"),K())):t.createElement(i.B,null,t.createElement(l.c,{label:"Label filters",error:y,invalid:U&&!_},K())))}var T=e(95842);function I({datasource:S,query:O,onChange:P,onBlur:L,variableEditor:U}){const R=K=>{P({...O,labels:K})},B=(0,t.useCallback)(async K=>{const j=S.getVariables(),k=await K;return[...j.map(Y=>({label:Y,value:Y})),...k.map(Y=>({label:Y.value,value:Y.value,title:Y.description}))]},[S]),H=async K=>{if(!O.metric)return await S.languageProvider.fetchLabels(),S.languageProvider.getLabelKeys().map(ee=>({value:ee}));const j=O.labels.filter(ee=>ee!==K);j.push({label:"__name__",op:"=",value:O.metric});const k=s.z.renderLabels(j);let Y=await S.languageProvider.fetchLabelsWithMatch(k);return Object.keys(Y).filter(ee=>!j.find(re=>re.label===ee)).map(ee=>({value:ee}))},w=(K,j)=>{const k={label:j??"__name__",op:"=~",value:(0,r.b4)(`.*${K}`)},Y=O.labels.filter(ne=>ne.label!==k.label);Y.push(k),O.metric&&Y.push({label:"__name__",op:"=",value:O.metric});const ee=Y.map(ne=>({...ne,label:S.interpolateString(ne.label),value:S.interpolateString(ne.value)})),re=s.z.renderLabels(ee);let J;return S.hasLabelsMatchAPISupport()?J=V(k,re):J=N(k,re),J.then(ne=>((0,o.ky)(ne),ne))},N=(K,j)=>{if(!K.label)return Promise.resolve([]);const k=S.languageProvider.fetchSeries(j),Y=S.interpolateString(K.label);return k.then(ee=>{const re=new Set;return ee.forEach(J=>{const ne=J[Y];re.add(ne)}),Array.from(re).map(J=>({label:J,value:J}))})},V=(K,j)=>K.label?S.languageProvider.fetchSeriesValuesWithMatch(K.label,j).then(k=>k.map(Y=>({value:Y,label:Y}))):Promise.resolve([]),G=async K=>{if(!K.label)return[];if(!O.metric)return(await S.languageProvider.getLabelValues(K.label)).map(ee=>({value:ee}));const j=O.labels.filter(ee=>ee!==K);j.push({label:"__name__",op:"=",value:O.metric});const k=j.map(ee=>({...ee,label:S.interpolateString(ee.label),value:S.interpolateString(ee.value)})),Y=s.z.renderLabels(k);return S.hasLabelsMatchAPISupport()?V(K,Y):N(K,Y)},_=(0,t.useCallback)(()=>B(x(S,O)),[S,O,B]);return t.createElement(t.Fragment,null,t.createElement(T.dm,{query:O,onChange:P,onGetMetrics:_,datasource:S,labelsFilters:O.labels,metricLookupDisabled:S.lookupsDisabled,onBlur:L||(()=>{}),variableEditor:U}),t.createElement(M,{debounceDuration:S.getDebounceTimeInMilliseconds(),getLabelValuesAutofillSuggestions:w,labelsFilters:O.labels,onChange:R,onGetLabelNames:K=>B(H(K)),onGetLabelValues:K=>B(G(K)),variableEditor:U}))}async function x(S,O){S.languageProvider.metricsMetadata||await S.languageProvider.loadMetricsMetadata(),S.languageProvider.metricsMetadata||(S.languageProvider.metricsMetadata={});let P;if(O.labels.length>0){const L=s.z.renderLabels(O.labels);P=(await S.languageProvider.getSeries(L,!0)).__name__??[]}else P=await S.languageProvider.getLabelValues("__name__")??[];return P.map(L=>({value:L,description:(0,n.xB)(L,S.languageProvider.metricsMetadata)}))}},52005:(Q,A,e)=>{"use strict";e.d(A,{W:()=>i,i:()=>l});var t=e(96540),n=e(67061),o=e(69470),s=e(47891),r=e(65405),g=e(30683),u=e(55698),c=e(44339);const i="Fetch all series matching metric name and label filters.",l=t.memo(({query:f})=>{const d=(0,r.u)(f||"").query,h={grammar:o.Ay,name:"promql"};return t.createElement(n.B,{gap:.5,direction:"column"},t.createElement(g.r,{stepNumber:1,title:t.createElement(c.Z,{query:`${d.metric} ${s.z.renderLabels(d.labels)}`,lang:h})},i),t.createElement(u.k,{stepNumber:2,queryModeller:s.z,query:d,lang:h}))});l.displayName="PromQueryBuilderExplained"},63492:(Q,A,e)=>{"use strict";e.d(A,{$:()=>u});var t=e(32196),n=e(96540),o=e(13544),s=e(40845),r=e(60042),g=e(52005);function u(i){const{query:l,datasource:f,range:d,onRunQuery:h,onChange:p,data:m,app:a,showExplain:v}=i,E=(0,s.of)(c);return n.createElement("div",{"data-testid":o.Tp.components.DataSource.Prometheus.queryEditor.code.queryField,className:E.wrapper},n.createElement(r.A,{datasource:f,query:l,range:d,onRunQuery:h,onChange:p,history:[],data:m,app:a}),v&&n.createElement(g.i,{query:l.expr}))}const c=i=>({wrapper:(0,t.css)` .gf-form { margin-bottom: 0; } `})},13567:(Q,A,e)=>{"use strict";e.d(A,{J3:()=>n,Ow:()=>s,mt:()=>g,ue:()=>r,yH:()=>o});var t=e(30038);const n=100,o=1e3,s=(0,t.Z0)({name:"metrics-modal-state",initialState:r(),reducers:{filterMetricsBackend:(u,c)=>{u.metrics=c.payload.metrics,u.filteredMetricCount=c.payload.filteredMetricCount,u.isLoading=c.payload.isLoading},buildMetrics:(u,c)=>{u.isLoading=c.payload.isLoading,u.metrics=c.payload.metrics,u.hasMetadata=c.payload.hasMetadata,u.metaHaystackDictionary=c.payload.metaHaystackDictionary,u.nameHaystackDictionary=c.payload.nameHaystackDictionary,u.totalMetricCount=c.payload.totalMetricCount,u.filteredMetricCount=c.payload.filteredMetricCount},setIsLoading:(u,c)=>{u.isLoading=c.payload},setFilteredMetricCount:(u,c)=>{u.filteredMetricCount=c.payload},setResultsPerPage:(u,c)=>{u.resultsPerPage=c.payload},setPageNum:(u,c)=>{u.pageNum=c.payload},setFuzzySearchQuery:(u,c)=>{u.fuzzySearchQuery=c.payload,u.pageNum=1},setNameHaystack:(u,c)=>{u.nameHaystackOrder=c.payload[0],u.nameHaystackMatches=c.payload[1]},setMetaHaystack:(u,c)=>{u.metaHaystackOrder=c.payload[0],u.metaHaystackMatches=c.payload[1]},setFullMetaSearch:(u,c)=>{u.fullMetaSearch=c.payload,u.pageNum=1},setIncludeNullMetadata:(u,c)=>{u.includeNullMetadata=c.payload,u.pageNum=1},setSelectedTypes:(u,c)=>{u.selectedTypes=c.payload,u.pageNum=1},setUseBackend:(u,c)=>{u.useBackend=c.payload,u.fullMetaSearch=!1,u.pageNum=1},setDisableTextWrap:u=>{u.disableTextWrap=!u.disableTextWrap},showAdditionalSettings:u=>{u.showAdditionalSettings=!u.showAdditionalSettings}}});function r(u){return{isLoading:!0,metrics:[],hasMetadata:!0,metaHaystackDictionary:{},metaHaystackMatches:[],metaHaystackOrder:[],nameHaystackDictionary:{},nameHaystackOrder:[],nameHaystackMatches:[],totalMetricCount:0,filteredMetricCount:null,resultsPerPage:n,pageNum:1,fuzzySearchQuery:"",fullMetaSearch:u?.fullMetaSearch??!1,includeNullMetadata:u?.includeNullMetadata??!0,selectedTypes:[],useBackend:u?.useBackend??!1,disableTextWrap:u?.disableTextWrap??!1,showAdditionalSettings:!1}}function g(u){return{useBackend:u?.useBackend??!1,disableTextWrap:u?.disableTextWrap??!1,fullMetaSearch:u?.fullMetaSearch??!1,includeNullMetadata:u.includeNullMetadata??!1}}},56823:(Q,A,e)=>{"use strict";e.d(A,{DQ:()=>p,G3:()=>v,Kl:()=>f,OS:()=>m,iZ:()=>h,jC:()=>E,jY:()=>u,kf:()=>c,nU:()=>l,z2:()=>a});var t=e(2543),n=e.n(t),o=e(55127),s=e.n(o),r=e(41598),g=e(65820);function u(x,S,O){const P=d(x,S,O),L=x.id+"(";return O&&P.push(O),L+P.join(", ")+")"}function c(x,S,O){const P=d(x,S,O),L=x.id+"(";return O&&P.unshift(O),L+P.join(", ")+")"}function i(x,S,O,P){if(S.params.length<2)throw`Cannot render a function with params of length [${S.params.length}]`;let L=(x.params??[])[0]??"5m";const U=d({...x,params:x.params.slice(1)},{...S,params:S.params.slice(1),defaultParams:S.defaultParams.slice(1)},O),R=x.id+"(";return O&&(P?U.push(`${O}[${L}]`):U.unshift(`${O}[${L}]`)),R+U.join(", ")+")"}function l(x,S,O){return i(x,S,O,!1)}function f(x,S,O){return i(x,S,O,!0)}function d(x,S,O){return(x.params??[]).map((P,L)=>S.params[L].type==="string"?'"'+P+'"':P)}function h(x,S){const O={id:x.id,params:x.defaultParams};return{...S,operations:[...S.operations,O]}}function p(x){return(0,t.capitalize)(x.replace(/_/g," "))}function m(x,S){return`operations.${x}.param.${S}`}function a(x=!1){const S={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 x&&S.options.unshift({label:"$__rate_interval",value:"$__rate_interval"}),S}function v(x,S={}){return[{id:x,name:p(x),params:[{name:"By label",type:"string",restParam:!0,optional:!0}],defaultParams:[],alternativesKey:"plain aggregations",category:g.Ag.Aggregations,renderer:u,paramChangedHandler:T(`__${x}_by`),explainHandler:C(x,""),addOperationHandler:h,...S},{id:`__${x}_by`,name:`${p(x)} by`,params:[{name:"Label",type:"string",restParam:!0,optional:!0,editor:r.r}],defaultParams:[""],alternativesKey:"aggregations by",category:g.Ag.Aggregations,renderer:D(x),paramChangedHandler:M(x),explainHandler:C(x,"by"),addOperationHandler:h,hideFromList:!0,...S},{id:`__${x}_without`,name:`${p(x)} without`,params:[{name:"Label",type:"string",restParam:!0,optional:!0,editor:r.r}],defaultParams:[""],alternativesKey:"aggregations by",category:g.Ag.Aggregations,renderer:b(x),paramChangedHandler:M(x),explainHandler:C(x,"without"),addOperationHandler:h,hideFromList:!0,...S}]}function E(x,S,O={}){const P=v(x,O);return P[0].params.unshift(...S.params),P[1].params.unshift(...S.params),P[2].params.unshift(...S.params),P[0].defaultParams=S.defaultParams,P[1].defaultParams=[...S.defaultParams,""],P[2].defaultParams=[...S.defaultParams,""],P[1].renderer=y(x),P[2].renderer=y(x),P}function D(x){return function(O,P,L){return`${x} by(${O.params.join(", ")}) (${L})`}}function b(x){return function(O,P,L){return`${x} without(${O.params.join(", ")}) (${L})`}}function C(x,S){return function(P){const L=P.params.map(R=>`\`${R}\``).join(" and "),U=s()("label",P.params.length);switch(S){case"by":return`Calculates ${x} over dimensions while preserving ${U} ${L}.`;case"without":return`Calculates ${x} over the dimensions ${L}. All other labels are preserved.`;default:return`Calculates ${x} over the dimensions.`}}}function y(x){return function(O,P,L){const U=P.params.findIndex(H=>H.restParam),R=O.params.slice(0,U),B=O.params.slice(U);return`${x} by(${B.join(", ")}) (${R.map((H,w)=>P.params[w].type==="string"?`"${H}"`:H).join(", ")}, ${L})`}}function M(x){return function(O,P,L){return P.params.length<L.params.length?{...P,id:x}:P}}function T(x){return function(O,P,L){return P.params.length===L.params.length?{...P,id:x}:P}}function I(x,S){if(!x.label||!x.op||!x.value||S.length<2)return!1;const O=x.op.toString().startsWith("!");return S.filter(U=>U.label===x.label&&U.value===x.value&&U.op!==x.op).some(U=>!!(O&&U?.op?.toString().startsWith("!")===!1||O===!1&&U?.op?.toString().startsWith("!")))}},65405:(Q,A,e)=>{"use strict";e.d(A,{u:()=>s});var t=e(21489),n=e(25378),o=e(71440);function s(a){const v=(0,o.qk)(a),D=t.K3.parse(v).topNode,C={query:{metric:"",labels:[],operations:[]},errors:[]};try{g(v,D,C)}catch(y){console.error(y),y instanceof Error&&C.errors.push({text:y.message})}return m(C.query)&&(C.errors=[]),r(a)&&(C.errors=[]),C}function r(a){const v={query:{metric:"",labels:[],operations:[]},errors:[]};a=a.replace(/\$__interval/g,"1s"),a=a.replace(/\$__interval_ms/g,"1000"),a=a.replace(/\$__rate_interval/g,"1s"),a=a.replace(/\$__range_ms/g,"1000"),a=a.replace(/\$__range_s/g,"1"),a=a.replace(/\$__range/g,"1s");const D=t.K3.parse(a).topNode;try{g(a,D,v)}catch{return!1}return v.errors.length===0}function g(a,v,E){const D=E.query;switch(v.type.id){case t.iP:{D.metric=(0,o.AA)(a,v);break}case t.BG:{D.labels.push(c(a,v));const b=v.getChild(o.Ql);b&&E.errors.push((0,o.xz)(a,b));break}case t.R6:{l(a,v,E);break}case t.Fn:{f(a,v,E);break}case t.df:{h(a,v,E);break}case o.Ql:{if(u(v))break;E.errors.push((0,o.xz)(a,v));break}default:{v.type.id===t.ek&&E.errors.push((0,o.xz)(a,v));let b=v.firstChild;for(;b;)g(a,b,E),b=b.nextSibling}}}function u(a){return a.prevSibling?.type.id===t.GN&&a.prevSibling?.firstChild?.type.id===t.Fb}function c(a,v){const E=(0,o.AA)(a,v.getChild(t.IC)),D=(0,o.AA)(a,v.getChild(t.Lf)),b=(0,o.AA)(a,v.getChild(t.LW)).replace(/"/g,"");return{label:E,op:D,value:b}}const i=["changes","rate","irate","increase","delta"];function l(a,v,E){const D=E.query,b=v.getChild(t.m3),C=(0,o.AA)(a,b),M=v.getChild(t.Dh).getChild(t.qI),T=[];let I="";if(i.includes(C)||C.endsWith("_over_time")){let S=(0,o.AA)(a,v).match(/\[(.+)\]/);S?.[1]&&(I=S[1],T.push(S[1]))}const x={id:C,params:T};if(D.operations.unshift(x),M){if((0,o.AA)(a,M)===I+"]")return;d(a,M,E,x)}}function f(a,v,E){const D=E.query,b=v.getChild(t.xb);let C=(0,o.AA)(a,b);const y=v.getChild(t.hI),M=[];y&&(y.getChild("By")&&C&&(C=`__${C}_by`),y.getChild(t.xB)&&(C=`__${C}_without`),M.push(...(0,o.R1)(a,y,t._p)));const I=v.getChild(t.Dh).getChild(t.qI),S=I?.getChild(t.GN)?.getChild(t.df);S&&E.errors.push({text:"Query parsing is ambiguous.",from:S.from,to:S.to});const O={id:C,params:[]};D.operations.unshift(O),d(a,I,E,O),O.params.push(...M)}function d(a,v,E,D){if(v)switch(v.type.id){case t.GN:case t.qI:{let b=v.firstChild;for(;b;){const y=b.getChild(t.GN)?.getChild(t.df);y&&E.errors.push({text:"Query parsing is ambiguous.",from:y.from,to:y.to}),d(a,b,E,D),b=b.nextSibling}break}case t.Po:{D.params.push(parseFloat((0,o.AA)(a,v)));break}case t.LW:{D.params.push((0,o.AA)(a,v).replace(/"/g,""));break}default:g(a,v,E)}}function h(a,v,E){const D=E.query,b=v.firstChild,C=(0,o.AA)(a,b.nextSibling),y=p(a,v.getChild(t.Wy)),M=v.lastChild,T=n.AE[C],I=b.getChild(t.Po),x=M.getChild(t.Po),S=M.getChild(t.df);if(I||g(a,b,E),x)D.operations.push((0,o.rq)(T,a,M,!!y?.isBool));else if(S){const O=(0,o.z9)(M);O?.type.id===t.Po&&D.operations.push((0,o.rq)(T,a,O,!!y?.isBool)),g(a,M,E)}else{D.binaryQueries=D.binaryQueries||[];const O={operator:C,query:{metric:"",labels:[],operations:[]}};y?.isMatcher&&(O.vectorMatchesType=y.matchType,O.vectorMatches=y.matches),D.binaryQueries.push(O),g(a,M,{query:O.query,errors:E.errors})}}function p(a,v){if(v){if(v.getChild("Bool"))return{isBool:!0,isMatcher:!1};{const E=v.getChild(t.UX);return E?{isMatcher:!0,isBool:!1,matches:(0,o.AA)(a,E.getChild(t.x$)?.getChild(t.qJ)),matchType:E.getChild(t.On)?"on":"ignoring"}:void 0}}}function m(a){return a.labels.length===0&&a.operations.length===0&&!a.metric}},71440:(Q,A,e)=>{"use strict";e.d(A,{AA:()=>c,Ql:()=>t,R1:()=>l,b4:()=>f,qk:()=>r,rq:()=>i,xz:()=>o,z9:()=>n});const t=0;function n(d){return d.firstChild?n(d.firstChild):d}function o(d,h){return{text:c(d,h),from:h.from,to:h.to,parentType:h.parent?.name}}const s=/\$(\w+)|\[\[([\s\S]+?)(?::(\w+))?\]\]|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/g;function r(d){return d.replace(s,(h,p,m,a,v,E,D)=>{const b=a||D;let C=p,y="0";return m&&(C=m,y="1"),v&&(C=v,y="2"),`__V_${y}__`+C+"__V__"+(b?"__F__"+b+"__F__":"")})}const g=[(d,h)=>`$${d}`,(d,h)=>`[[${d}${h?`:${h}`:""}]]`,(d,h)=>`\${${d}${h?`:${h}`:""}}`];function u(d){return d.replace(/__V_(\d)__(.+?)__V__(?:__F__(\w+)__F__)?/g,(h,p,m,a)=>g[parseInt(p,10)](m,a))}function c(d,h){return h?u(d.substring(h.from,h.to)):""}function i(d,h,p,m){const a=[parseFloat(c(h,p))];return d.comparison&&a.push(m),{id:d.id,params:a}}function l(d,h,p){if(h.type.id===p||h.name===p)return[c(d,h)];const m=[];let a=0,v=h.childAfter(a);for(;v;)m.push(...l(d,v,p)),a=v.to,v=h.childAfter(a);return m}const f=d=>d.split(" ").map(p=>`${p}.*`).join("")},30683:(Q,A,e)=>{"use strict";e.d(A,{r:()=>r});var t=e(32196),n=e(96540),o=e(36663),s=e(40845);function r({title:u,stepNumber:c,markdown:i,children:l}){const f=(0,s.of)(g);return n.createElement("div",{className:f.box},c!==void 0&&n.createElement("div",{className:f.stepNumber},c),n.createElement("div",{className:f.boxInner},u&&n.createElement("div",{className:f.header},n.createElement("span",null,u)),n.createElement("div",{className:f.body},i&&n.createElement("div",{dangerouslySetInnerHTML:{__html:(0,o.G)(i)}}),l)))}const g=u=>({box:(0,t.css)({background:u.colors.background.secondary,padding:u.spacing(1),borderRadius:u.shape.radius.default,position:"relative"}),boxInner:(0,t.css)({marginLeft:u.spacing(4)}),stepNumber:(0,t.css)({fontWeight:u.typography.fontWeightMedium,background:u.colors.secondary.main,width:"20px",height:"20px",borderRadius:u.shape.radius.circle,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"10px",left:"11px",fontSize:u.typography.bodySmall.fontSize}),header:(0,t.css)({paddingBottom:u.spacing(.5),display:"flex",alignItems:"center",fontFamily:u.typography.fontFamilyMonospace}),body:(0,t.css)({color:u.colors.text.secondary,"p:last-child":{margin:0},a:{color:u.colors.text.link,textDecoration:"underline"}})})},55698:(Q,A,e)=>{"use strict";e.d(A,{k:()=>s});var t=e(96540),n=e(30683),o=e(44339);function s({query:r,queryModeller:g,stepNumber:u,lang:c,onMouseEnter:i,onMouseLeave:l}){return t.createElement(t.Fragment,null,r.operations.map((f,d)=>{const h=g.getOperationDef(f.id);if(!h)return`Operation ${f.id} not found`;const p=h.renderer(f,h,"<expr>"),m=h.explainHandler?h.explainHandler(f,h):h.documentation??"no docs";return t.createElement("div",{key:d,onMouseEnter:()=>i?.(f,d),onMouseLeave:()=>l?.(f,d)},t.createElement(n.r,{stepNumber:d+u,title:t.createElement(o.Z,{query:p,lang:c}),markdown:m}))}))}},43854:(Q,A,e)=>{"use strict";e.d(A,{i:()=>r});var t=e(32196),n=e(96540),o=e(40845),s=e(67061);function r({children:u}){const c=(0,o.of)(g);return n.createElement("div",{className:c.root},n.createElement(s.B,{gap:1},u))}const g=u=>({root:(0,t.css)({padding:u.spacing(1,1,0,1),backgroundColor:u.colors.background.secondary,borderRadius:u.shape.radius.default})})},44339:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>g});var t=e(32196),n=e(28848),o=e.n(n),s=e(96540),r=e(40845);function g({query:c,lang:i,className:l}){const f=(0,r.$j)(),d=u(f),h=o().highlight(c,i.grammar,i.name);return s.createElement("div",{className:(0,t.cx)(d.editorField,"prism-syntax-highlight",l),"aria-label":"selector",dangerouslySetInnerHTML:{__html:h}})}const u=c=>({editorField:(0,t.css)({fontFamily:c.typography.fontFamilyMonospace,fontSize:c.typography.bodySmall.fontSize})})},35146:(Q,A,e)=>{"use strict";e.d(A,{f:()=>t});var t=(n=>(n.Code="code",n.Builder="builder",n))(t||{})},65820:(Q,A,e)=>{"use strict";e.d(A,{Ag:()=>t,jN:()=>n,n5:()=>o});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||{}),o=(s=>(s.Rate="rate",s.Histogram="histogram",s.Binary="binary",s))(o||{})},30915:(Q,A,e)=>{"use strict";e.d(A,{$i:()=>d,Dr:()=>l});var t=e(70416),n=e(47232),o=e(77678),s=e(32631),r=e(32264),g=e(14110),u=e(9631);function c(h,p){let[m]=h,[a]=p,v=m.length,E=m[0],D=m[v-1],b=a.length,C=a[0],y=a[b-1],M;if(v)if(b){if(C>D)M=h.map((T,I)=>h[I].concat(p[I]));else if(y<E)M=p.map((T,I)=>p[I].concat(h[I]));else if(C<=E&&y>=D)M=p;else if(!(C>E&&y<D)){if(C>=E){let T=(0,u.Ls)(C,m);T=m[T]<C?T-1:T,M=h.map((I,x)=>h[x].slice(0,T).concat(p[x]))}else if(y>=E){let T=(0,u.Ls)(y,m);T=m[T]<y?T:T+1,M=p.map((I,x)=>p[x].concat(h[x].slice(T)))}}}else M=h;else b?M=p:M=[[]];return M}function i(h,p,m){let[a,...v]=h,E,D;return a[0]<p&&(E=(0,u.Ls)(p,a),a[E]<p&&E++),a[a.length-1]>m&&(D=(0,u.Ls)(m,a),a[D]>m&&D--),(E!=null||D!=null)&&(a=a.slice(E??0,D),v=v.map(b=>b.slice(E??0,D))),[a,...v]}const l="10m",f=h=>`${h.type}|${h.name}|${JSON.stringify(h.labels??"")}`;class d{constructor(p){this.sendEventsInterval=6e4*10,this.pendingRequestIdsToTargSigs=new Map,this.pendingAccumulatedEvents=new Map,this.cache=new Map,this.sendPendingTrackingEvents=()=>{const a=this.pendingAccumulatedEvents.entries();for(let[v,E]of a)if(!E.sent){const D={datasource:E.datasource.toString(),requestCount:E.requestCount.toString(),savedBytesTotal:E.savedBytesTotal.toString(),initialRequestSize:E.initialRequestSize.toString(),lastRequestSize:E.lastRequestSize.toString(),panelId:E.panelId.toString(),dashId:E.dashId.toString(),expr:E.expr.toString(),refreshIntervalMs:E.refreshIntervalMs.toString(),from:E.from.toString(),queryRangeSeconds:E.queryRangeSeconds.toString()};r.$.featureToggles.prometheusIncrementalQueryInstrumentation?(0,g.rR)("grafana_incremental_queries_profile",D):s.P.api.pushEvent&&s.P.api.pushEvent("incremental query response size",D,"no-interaction",{skipDedupe:!0}),this.pendingAccumulatedEvents.set(v,{...E,sent:!0,requestCount:0,savedBytesTotal:0,initialRequestSize:0,lastRequestSize:0})}};const m=p.overlapString;if((0,t.di)(m)){const a=(0,t.E9)(m);this.overlapWindowMs=(0,t.WT)(a)}else{const a=(0,t.E9)(l);this.overlapWindowMs=(0,t.WT)(a)}(r.$.grafanaJavascriptAgent.enabled||r.$.featureToggles?.prometheusIncrementalQueryInstrumentation)&&p.profileFunction!==void 0?(this.profile(),this.shouldProfile=!0):this.shouldProfile=!1,this.getProfileData=p.profileFunction,this.getTargetSignature=p.getTargetSignature}profile(){typeof PerformanceObserver=="function"&&(this.perfObeserver=new PerformanceObserver(p=>{p.getEntries().forEach(m=>{const a=m,v=typeof a?.transferSize=="number";if(a?.initiatorType==="fetch"&&v){let E=a.name;if(E.includes("/api/ds/query")){let D=E.match(/requestId=([a-z\d]+)/i);if(D){let b=D[1];const C=Math.round(a.transferSize),y=this.pendingRequestIdsToTargSigs.get(b);if(y){const M=this.pendingRequestIdsToTargSigs.entries();for(let[,T]of M)if(T.identity===y.identity&&T.bytes!==null){const I=this.pendingAccumulatedEvents.get(T.identity),x=T.bytes-C;this.pendingAccumulatedEvents.set(T.identity,{datasource:T.datasource??"N/A",requestCount:(I?.requestCount??0)+1,savedBytesTotal:(I?.savedBytesTotal??0)+x,initialRequestSize:T.bytes,lastRequestSize:C,panelId:y.panelId?.toString()??"",dashId:y.dashboardUID??"",expr:y.expr??"",refreshIntervalMs:y.refreshIntervalMs??0,sent:!1,from:y.from??"",queryRangeSeconds:y.queryRangeSeconds??0}),this.pendingRequestIdsToTargSigs.delete(b);return}this.pendingRequestIdsToTargSigs.set(b,{...y,bytes:C})}}}}})}),this.perfObeserver.observe({type:"resource",buffered:!1}),setInterval(this.sendPendingTrackingEvents,this.sendEventsInterval),window.addEventListener("beforeunload",this.sendPendingTrackingEvents))}requestInfo(p){const m=p.range.from.valueOf(),a=p.range.to.valueOf(),v=p.rangeRaw?.to?.toString()==="now";let E=v,D;const b=p.intervalMs,C=new Map;p.targets.forEach(y=>{let M=`${p.dashboardUID}|${p.panelId}|${y.refId}`,T=this.getTargetSignature(p,y);this.shouldProfile&&this.getProfileData&&this.pendingRequestIdsToTargSigs.set(p.requestId,{...this.getProfileData(p,y),identity:M+"|"+T,bytes:null,panelId:p.panelId,dashboardUID:p.dashboardUID??"",from:p.rangeRaw?.from.toString()??"",queryRangeSeconds:p.range.to.diff(p.range.from,"seconds")??"",refreshIntervalMs:b??0}),C.set(M,T)});for(const[y,M]of C){let T=this.cache.get(y);if(T?.sig!==M?E=!1:(D=T?.prevTo??1/0,E=a>D&&m<=D),!E)break}if(E&&D){let y=Math.max(D-this.overlapWindowMs,m);const M=(0,n.KQ)(a),T=(0,n.KQ)((0,o.rs)(y,p.intervalMs));p={...p,range:{...p.range,from:T,to:M}}}else C.forEach((y,M)=>{this.cache.delete(M)});return{requests:[p],targSigs:C,shouldCache:v}}procFrames(p,m,a){if(m?.shouldCache){const v=p.range.from.valueOf(),E=p.range.to.valueOf(),D=new Map;a.forEach(C=>{let y=`${p.dashboardUID}|${p.panelId}|${C.refId}`,M=D.get(y);M||(M=[],D.set(y,M)),M.push(C)});let b=[];D.forEach((C,y)=>{let M=(y?this.cache.get(y)?.frames:null)??[];C.forEach(I=>{if(I.length===0||I.fields.length===0)return;let x=f(I.fields[1]),S=M.find(O=>f(O.fields[1])===x);if(!S)M.push(I);else{let O=S.fields.map(U=>U.values),P=I.fields.map(U=>U.values),L=c(O,P);if(L){for(let U=0;U<L.length;U++)S.fields[U].values=L[U];S.length=S.fields[0].values.length}}});let T=[];M.forEach(I=>{let x=I.fields.map(O=>O.values),S=i(x,v,E);if(S[0].length>0){for(let O=0;O<S.length;O++)I.fields[O].values=S[O];T.push(I)}}),this.cache.set(y,{sig:m.targSigs.get(y),frames:T,prevTo:E}),b.push(...T)}),a=b.map(C=>({...C,fields:C.fields.map(y=>({...y,config:{...y.config},values:y.values.slice()}))}))}return a}}},39132:(Q,A,e)=>{"use strict";e.d(A,{Bm:()=>I,J3:()=>p,L:()=>x,hF:()=>y});var t=e(2543),n=e.n(t),o=e(41987),s=e(41260),r=e(11261),g=e(28240),u=e(52622),c=e(57875),i=e(32264),l=e(19347);const f=/^[+-]?inf(?:inity)?$/i,d=(S,O)=>O.app===o.Jk.Explore&&(S.meta?.custom?.resultType==="vector"||S.meta?.custom?.resultType==="scalar")?!0:O.targets.find(L=>L.refId===S.refId)?.format==="table",h=(S,O)=>S.meta?.type===s.m.HeatmapCells?!1:O.targets.find(L=>L.refId===S.refId)?.format==="heatmap";function p(S,O,P){i.$.featureToggles.prometheusDataplane&&S.data.forEach(Y=>{const ee=O.targets.find(re=>re.refId===Y.refId);ee&&ee.legendFormat==="__auto"&&Y.fields.forEach(re=>{if(re.labels?.__name__&&re.labels?.__name__===re.name){const J={...re,name:r.Bc};re.config.displayNameFromDS=(0,g.Ct)(J,Y,S.data)}})});const[L,U]=(0,t.partition)(S.data,Y=>d(Y,O)),R=a(L),[B,H]=(0,t.partition)(U,Y=>Y.meta?.custom?.resultType==="exemplar"),{exemplarTraceIdDestinations:w}=P,N=B.map(Y=>{if(w?.length)for(const ee of w){const re=Y.fields.find(J=>J.name===ee.name);if(re){const J=E(ee);re.config.links=re.config.links?.length?[...re.config.links,...J]:J}}return{...Y,meta:{...Y.meta,dataTopic:u.QR.Annotations}}}),[V,G]=(0,t.partition)(H,Y=>h(Y,O));V.forEach(Y=>{if(Y.name==null){let ee=Y.fields.find(re=>re.type===r.PU.number);if(ee){let re=ee.labels?.le;re&&(Y.name=re,ee.config.displayNameFromDS=re)}}});const _=(0,t.groupBy)(V,Y=>Y.refId);let K=[];for(const Y in _){const ee=_[Y],re=(0,t.groupBy)(ee,J=>{const ne=J.fields.find(q=>q.type===r.PU.number);if(ne?.labels&&m in ne.labels){const{le:q,...te}=ne?.labels;return Object.values(te).join()}return Object.values(ne?.labels??[]).join()});(0,t.forOwn)(re,(J,ne)=>{const q=J.sort(I);K.push(M(T(q)))})}const j=G.map(Y=>({...Y,meta:{...Y.meta,preferredVisualisationType:"graph"}})),k=(0,t.flatten)(K);return{...S,data:[...j,...R,...k,...N]}}const m="le";function a(S){if(S.length===0||S.length===1&&S[0].length===0)return S;const O=(0,t.groupBy)(S,"refId"),P=Object.keys(O);return P.map(U=>{const R=v(P.length,U),B=C({data:[],valueName:R}),H=b([]),w=[];O[U].forEach(V=>{const _=V.fields[1]?.labels??{};Object.keys(_).sort().forEach(K=>{if(!w.some(j=>j.name===K)){const j=K===m;w.push({name:K,config:{filterable:!0},type:j?r.PU.number:r.PU.string,values:[]})}})}),O[U].forEach(V=>{const G=V.fields[0]?.values??[],_=V.fields[1]?.values??[];G.forEach(K=>H.values.push(K)),_.forEach(K=>{B.values.push(x(K));const j=V.fields[1].labels??{};w.forEach(k=>k.values.push(D(j,k.name)))})});const N=[H,...w,B];return{refId:U,fields:N,meta:{...O[U][0].meta,preferredVisualisationType:"rawPrometheus"},length:H.values.length}})}function v(S,O=""){return S>1?`Value #${O}`:"Value"}function E(S){const O=[];if(S.datasourceUid){const L=(0,l.l)().getInstanceSettings(S.datasourceUid);L&&O.push({title:S.urlDisplayLabel||`Query with ${L?.name}`,url:"",internal:{query:{query:"${__value.raw}",queryType:"traceql"},datasourceUid:S.datasourceUid,datasourceName:L?.name??"Data source not found"}})}return S.url&&O.push({title:S.urlDisplayLabel||`Go to ${S.url}`,url:S.url,targetBlank:!0}),O}function D(S,O){return S.hasOwnProperty(O)?O===m?x(S[O]):S[O]:""}function b(S,O=!1){return{name:r.LE,type:r.PU.time,config:{},values:S.map(P=>O?P[0]:P[0]*1e3)}}function C({data:S,valueName:O=r.Bc,parseValue:P=!0,labels:L,displayNameFromDS:U}){return{name:O,type:r.PU.number,display:(0,c.J)(),config:{displayNameFromDS:U},labels:L,values:S.map(R=>P?x(R[1]):R[1])}}function y(S){const O=S.__name__||"";delete S.__name__;const P=Object.entries(S).map(L=>`${L[0]}="${L[1]}"`).join(",");return`${O}{${P}}`}function M(S){if(S.length===0||S.length===1&&S[0].length===0)return[];const O=S[0].fields.find(L=>L.type===r.PU.time),P=S.map(L=>{let U=L.fields.find(R=>R.type===r.PU.number);return{...U,name:U.config.displayNameFromDS}});return[{...S[0],meta:{...S[0].meta,type:s.m.HeatmapRows},fields:[O,...P]}]}function T(S){for(let O=S.length-1;O>0;O--){const P=S[O].fields.find(U=>U.type===r.PU.number),L=S[O-1].fields.find(U=>U.type===r.PU.number);if(!P||!L)throw new Error("Prometheus heatmap transform error: data should be a time series");for(let U=0;U<P.values.length;U++){const R=L.values[U]||[0];P.values[U]-=R}}return S}function I(S,O){let P,L;try{P=x(S.fields[1].state?.displayName??S.name??S.fields[1].name),L=x(O.fields[1].state?.displayName??O.name??O.fields[1].name)}catch(U){return console.error(U),0}return P>L?1:P<L?-1:0}function x(S){return f.test(S)?S[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY:parseFloat(S)}},69120:(Q,A,e)=>{"use strict";e.d(A,{B4:()=>s,N1:()=>n,fD:()=>t,m_:()=>o});var t=(r=>(r.Low="Low",r.Medium="Medium",r.High="High",r.None="None",r))(t||{}),n=(r=>(r.Cortex="Cortex",r.Mimir="Mimir",r.Prometheus="Prometheus",r.Thanos="Thanos",r))(n||{}),o=(r=>(r.Auto="__auto",r.Verbose="__verbose",r.Custom="__custom",r))(o||{}),s=(r=>(r[r.LabelNames=0]="LabelNames",r[r.LabelValues=1]="LabelValues",r[r.MetricNames=2]="MetricNames",r[r.VarQueryResult=3]="VarQueryResult",r[r.SeriesQuery=4]="SeriesQuery",r[r.ClassicQuery=5]="ClassicQuery",r))(s||{})},64616:(Q,A,e)=>{"use strict";e.d(A,{Jv:()=>o,O8:()=>n,d:()=>s});const t={filters:[],groupBy:[]};var n=(r=>(r.Done="done",r.Error="error",r.Pending="pending",r.Streaming="streaming",r))(n||{}),o=(r=>(r.Spans="spans",r.Traces="traces",r))(o||{}),s=(r=>(r.Intrinsic="intrinsic",r.Resource="resource",r.Span="span",r.Unscoped="unscoped",r))(s||{})},44066:(Q,A,e)=>{"use strict";e.d(A,{OB:()=>d,XF:()=>v,Zh:()=>a,dk:()=>p,hK:()=>c,hN:()=>m,lp:()=>D,sL:()=>h,uW:()=>E,yz:()=>b});var t=e(78368),n=e(25352),o=e(37471),s=e(11261),r=e(24293),g=e(14236),u=e(32528);function c(x){const{nodes:S,edges:O}=i(x),[P,L]=(0,u.dY)();for(const U of S)P.add(U);for(const U of O)L.add(U);return[P,L]}function i(x){const S=[],O=[],P=new t.R(x),L=l(P),U=(0,u.pl)(R=>{if(R>=x.length)return;const B=P.get(R);return{span:{...B},id:B.spanID,parentIds:B.parentSpanID?[B.parentSpanID]:[]}});for(let R=0;R<P.length;R++){const B=P.get(R),H=U[B.spanID].children.map(G=>{const _=U[G].span;return[_.startTime,_.startTime+_.duration]}),w=(0,u.jP)(H),N=B.duration-w,V=(0,u.GT)(B.duration,L,N);S.push({[n.u.id]:B.spanID,[n.u.title]:B.serviceName??"",[n.u.subTitle]:B.operationName,[n.u.mainStat]:V.main,[n.u.secondaryStat]:V.secondary,[n.u.color]:N/L}),B.parentSpanID&&U[B.parentSpanID].span&&O.push({[n.u.id]:B.parentSpanID+"--"+B.spanID,[n.u.target]:B.spanID,[n.u.source]:B.parentSpanID})}return{nodes:S,edges:O}}function l(x){let S=0,O=1/0;for(let P=0;P<x.length;P++){const L=x.get(P);L.startTime<O&&(O=L.startTime),L.startTime+L.duration>S&&(S=L.startTime+L.duration)}return S-O}const f="traces_service_graph_request_server_seconds_sum",d="traces_service_graph_request_total",h="traces_service_graph_request_failed_total",p="traces_service_graph_request_server_seconds_bucket",m={expr:"sum(rate(traces_spanmetrics_calls_total{}[$__range])) by (span_name)",topk:5,params:[]},a={expr:"sum(rate(traces_spanmetrics_calls_total{}[$__range])) by (span_name)",topk:5,params:['status_code="STATUS_CODE_ERROR"']},v={expr:"histogram_quantile(.9, sum(rate(traces_spanmetrics_latency_bucket{}[$__range])) by (le))",params:[]},E='span_kind="SPAN_KIND_SERVER"',D=[f,d,h,p];function b(x,S){const O=y(x),P={},L={};return T(O[d],"total",d,P,L),T(O[f],"seconds",f,P,L),T(O[h],"failed",h,P,L),I(P,L,S)}function C(){function x(P,L){return new o.k({name:P,fields:L,meta:{preferredVisualisationType:"nodeGraph"}})}const S=x("Nodes",[{name:n.u.id,type:s.PU.string,values:[]},{name:n.u.title,type:s.PU.string,config:{displayName:"Service name"},values:[]},{name:n.u.subTitle,type:s.PU.string,config:{displayName:"Service namespace"},values:[]},{name:n.u.mainStat,type:s.PU.number,config:{unit:"ms/r",displayName:"Average response time"},values:[]},{name:n.u.secondaryStat,type:s.PU.number,config:{unit:"r/sec",displayName:"Requests per second"},values:[]},{name:n.u.arc+"success",type:s.PU.number,config:{displayName:"Success",color:{fixedColor:"green",mode:r.Y.Fixed}},values:[]},{name:n.u.arc+"failed",type:s.PU.number,config:{displayName:"Failed",color:{fixedColor:"red",mode:r.Y.Fixed}},values:[]}]),O=x("Edges",[{name:n.u.id,type:s.PU.string,values:[]},{name:n.u.source,type:s.PU.string,values:[]},{name:"sourceName",type:s.PU.string,values:[]},{name:"sourceNamespace",type:s.PU.string,values:[]},{name:n.u.target,type:s.PU.string,values:[]},{name:"targetName",type:s.PU.string,values:[]},{name:"targetNamespace",type:s.PU.string,values:[]},{name:n.u.mainStat,type:s.PU.number,config:{unit:"ms/r",displayName:"Average response time"},values:[]},{name:n.u.secondaryStat,type:s.PU.number,config:{unit:"r/sec",displayName:"Requests per second"},values:[]}]);return[S,O]}function y(x){return(x[0]?.data||[]).reduce((S,O)=>{const P=(0,g.Vc)(O);return S[P.refId??"A"]=new t.R(P),S},{})}var M=(x=>(x.sourceName="sourceName",x.sourceNamespace="sourceNamespace",x.targetName="targetName",x.targetNamespace="targetNamespace",x))(M||{});function T(x,S,O,P,L){if(!x)return;const U=`Value #${O}`;for(let R=0;R<x.length;R++){const B=x.get(R),H=B.server_service_namespace?`${B.server_service_namespace}/${B.server}`:B.server,w=B.client_service_namespace?`${B.client_service_namespace}/${B.client}`:B.client,N=`${w}_${H}`;L[N]?L[N][S]=(L[N][S]||0)+B[U]:L[N]={target:H,targetName:B.server,targetNamespace:B.server_service_namespace,source:w,sourceName:B.client,sourceNamespace:B.client_service_namespace,[S]:B[U]},P[H]?P[H][S]=(P[H][S]||0)+B[U]:P[H]={name:B.server,namespace:B.server_service_namespace,[S]:B[U]},P[w]||(P[w]={name:B.client,namespace:B.client_service_namespace,[S]:0})}}function I(x,S,O){const[P,L]=C();for(const U of Object.keys(x)){const R=x[U];P.add({[n.u.id]:U,[n.u.title]:R.name,[n.u.subTitle]:R.namespace,[n.u.mainStat]:R.total?R.seconds/R.total*1e3:Number.NaN,[n.u.secondaryStat]:R.total?Math.round(R.total*100)/100:Number.NaN,[n.u.arc+"success"]:R.total?(R.total-Math.min(R.failed||0,R.total))/R.total:1,[n.u.arc+"failed"]:R.total?Math.min(R.failed||0,R.total)/R.total:0})}for(const U of Object.keys(S)){const R=S[U];L.add({[n.u.id]:U,[n.u.source]:R.source,sourceName:R.sourceName,sourceNamespace:R.sourceNamespace,[n.u.target]:R.target,targetName:R.targetName,targetNamespace:R.targetNamespace,[n.u.mainStat]:R.total?R.seconds/R.total*1e3:Number.NaN,[n.u.secondaryStat]:R.total?Math.round(R.total*100)/100:Number.NaN})}return{nodes:P,edges:L}}},98216:(Q,A,e)=>{"use strict";e.d(A,{TG:()=>R,_2:()=>d,bT:()=>B,cd:()=>S,kX:()=>O,q0:()=>D,qS:()=>P,xw:()=>b});var t=e(87361),n=e(37471),o=e(11261),s=e(91890),r=e(14236),g=e(47696),u=e(57875),c=e(19347),i=e(64616),l=e(44066);function f(K,j,k,Y){const ee=new n.k({fields:[{name:"Time",type:o.PU.time,config:{custom:{width:200}},values:[]},{name:"traceID",type:o.PU.string,config:{displayNameFromDS:"Trace ID",custom:{width:180},links:[{title:"Click to open trace ${__value.raw}",url:"",internal:{datasourceUid:j,datasourceName:k,query:{query:"${__value.raw}"}}}]},values:[]},{name:"Message",type:o.PU.string,values:[]}],meta:{preferredVisualisationType:"table"}});if(!K||Y.length===0)return ee;const re=K.fields.find(J=>J.type===o.PU.time);for(let J of K.fields){let ne=!1;if(J.type===o.PU.string){const q=J.values;for(let te=0;te<q.length;te++){const oe=q[te];if(oe)for(let ue of Y){const ie=oe.match(ue);if(ie){const ge=ie[1],he=re?re.values[te]:null;ee.fields[0].values.push(he),ee.fields[1].values.push(ge),ee.fields[2].values.push(oe),ne=!0}}}}if(ne)break}return ee}function d(K,j,k,Y){return K.data.forEach((ee,re)=>{const J=f(ee,j,k,Y);K.data[re]=J}),K}function h(K){if(K.stringValue)return K.stringValue;if(K.boolValue!==void 0)return!!K.boolValue;if(K.intValue!==void 0)return Number.parseInt(K.intValue,10);if(K.doubleValue)return Number.parseFloat(K.doubleValue);if(K.arrayValue){const j=[];for(const k of K.arrayValue.values)j.push(h(k));return j}return""}function p(K){const j=[];let k="OTLPResourceNoServiceName";if(!K)return{serviceName:k,serviceTags:j};for(const Y of K.attributes)Y.key===t._2.SERVICE_NAME&&(k=Y.value.stringValue||k),j.push({key:Y.key,value:h(Y.value)});return{serviceName:k,serviceTags:j}}function m(K){const j=[];if(K.attributes)for(const k of K.attributes)j.push({key:k.key,value:h(k.value)});return j}function a(K){let j;if(K.kind){const k=K.kind.toString().toLowerCase().split("_");j=k.length?k[k.length-1]:K.kind.toString()}return j}function v(K){const j=[];if(K.links)for(const k of K.links){const{traceId:Y,spanId:ee}=k,re=[];if(k.attributes)for(const J of k.attributes)re.push({key:J.key,value:h(J.value)});j.push({traceID:Y,spanID:ee,tags:re})}return j}function E(K){const j=[];if(K.events)for(const k of K.events){const Y=[];if(k.attributes)for(const ee of k.attributes)Y.push({key:ee.key,value:h(ee.value)});j.push({fields:Y,timestamp:k.timeUnixNano/1e6})}return j}function D(K,j=!1){const k=new n.k({fields:[{name:"traceID",type:o.PU.string,values:[]},{name:"spanID",type:o.PU.string,values:[]},{name:"parentSpanID",type:o.PU.string,values:[]},{name:"operationName",type:o.PU.string,values:[]},{name:"serviceName",type:o.PU.string,values:[]},{name:"kind",type:o.PU.string,values:[]},{name:"statusCode",type:o.PU.number,values:[]},{name:"statusMessage",type:o.PU.string,values:[]},{name:"instrumentationLibraryName",type:o.PU.string,values:[]},{name:"instrumentationLibraryVersion",type:o.PU.string,values:[]},{name:"traceState",type:o.PU.string,values:[]},{name:"serviceTags",type:o.PU.other,values:[]},{name:"startTime",type:o.PU.number,values:[]},{name:"duration",type:o.PU.number,values:[]},{name:"logs",type:o.PU.other,values:[]},{name:"references",type:o.PU.other,values:[]},{name:"tags",type:o.PU.other,values:[]}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"otlp"}}});try{for(const ee of K){const{serviceName:re,serviceTags:J}=p(ee.resource);for(const ne of ee.instrumentationLibrarySpans)for(const q of ne.spans)k.add({traceID:q.traceId.length>16?q.traceId.slice(16):q.traceId,spanID:q.spanId,parentSpanID:q.parentSpanId||"",operationName:q.name||"",serviceName:re,kind:a(q),statusCode:q.status?.code,statusMessage:q.status?.message,instrumentationLibraryName:ne.instrumentationLibrary?.name,instrumentationLibraryVersion:ne.instrumentationLibrary?.version,traceState:q.traceState,serviceTags:J,startTime:q.startTimeUnixNano/1e6,duration:(q.endTimeUnixNano-q.startTimeUnixNano)/1e6,tags:m(q),logs:E(q),references:v(q)})}}catch(ee){return console.error(ee),{error:{message:"JSON is not valid OpenTelemetry format: "+ee},data:[]}}let Y=[k];return j&&Y.push(...(0,l.hK)(k)),{data:Y}}function b(K){let j={batches:[]},k={};for(let Y=0;Y<K.length;Y++){const ee=K.get(Y);k[ee.serviceName]||(k[ee.serviceName]=j.batches.length,j.batches.push({resource:{attributes:[],droppedAttributesCount:0},instrumentationLibrarySpans:[{spans:[]}]}));let re=k[ee.serviceName];j.batches[re].resource.attributes.length===0&&(j.batches[re].resource.attributes=y(ee.serviceTags)),j.batches[re].instrumentationLibrarySpans[0].instrumentationLibrary||ee.instrumentationLibraryName&&(j.batches[re].instrumentationLibrarySpans[0].instrumentationLibrary={name:ee.instrumentationLibraryName,version:ee.instrumentationLibraryVersion?ee.instrumentationLibraryVersion:""}),j.batches[re].instrumentationLibrarySpans[0].spans.push({traceId:ee.traceID.padStart(32,"0"),spanId:ee.spanID,parentSpanId:ee.parentSpanID||"",traceState:ee.traceState||"",name:ee.operationName,kind:C(ee.kind),startTimeUnixNano:ee.startTime*1e6,endTimeUnixNano:(ee.startTime+ee.duration)*1e6,attributes:ee.tags?y(ee.tags):[],droppedAttributesCount:0,droppedEventsCount:0,droppedLinksCount:0,status:T(ee),events:I(ee.logs),links:x(ee.references)})}return j}function C(K){let j;if(K)switch(K){case"server":j="SPAN_KIND_SERVER";break;case"client":j="SPAN_KIND_CLIENT";break;case"producer":j="SPAN_KIND_PRODUCER";break;case"consumer":j="SPAN_KIND_CONSUMER";break;case"internal":j="SPAN_KIND_INTERNAL";break}return j}function y(K){return K.reduce((j,k)=>[...j,{key:k.key,value:M(k)}],[])}function M(K){if(typeof K.value=="string")return{stringValue:K.value};if(typeof K.value=="boolean")return{boolValue:K.value};if(typeof K.value=="number")return K.value%1===0?{intValue:K.value}:{doubleValue:K.value};if(typeof K.value=="object"&&Array.isArray(K.value)){const j=[];for(const k of K.value)j.push(M(k));return{arrayValue:{values:j}}}return{stringValue:K.value}}function T(K){let j;return K.statusCode!==void 0&&(j={code:K.statusCode,message:K.statusMessage?K.statusMessage:""}),j}function I(K){if(!K||!K.length)return;let j=[];for(const k of K){let Y={timeUnixNano:k.timestamp*1e6,attributes:[],droppedAttributesCount:0,name:""};for(const ee of k.fields)Y.attributes.push({key:ee.key,value:M(ee)});j.push(Y)}return j}function x(K){if(!K||!K.length)return;let j=[];for(const k of K){let Y={traceId:k.traceID,spanId:k.spanID,attributes:[],droppedAttributesCount:0};if(k.tags?.length)for(const ee of k.tags)Y.attributes?.push({key:ee.key,value:M(ee)});j.push(Y)}return j}const S="Related profiles";function O(K,j,k=!1){const Y=K.data[0];if(!Y)return _;const re=j?.jsonData?.tracesToProfiles;let J;if(re?.datasourceUid&&(J=(0,c.l)().getInstanceSettings(re.datasourceUid)),re&&J){const q=re.customQuery?re.query:void 0,te={title:S,url:"",internal:{datasourceUid:J.uid,datasourceName:J.name,query:{labelSelector:q||"{${__tags}}",groupBy:[],profileTypeId:re.profileTypeId??"",queryType:"profile",spanSelector:['${__span.tags["pyroscope.profile.id"]}'],refId:"profile"}},origin:s.x0.Datasource};Y.fields.forEach(oe=>{oe.name==="tags"&&(oe.config.links=[te])})}let ne=[...K.data];return k&&ne.push(...(0,l.hK)((0,r.Vc)(Y))),{...K,data:ne}}function P(K,j){const k=new n.k({name:"Traces",refId:"traces",fields:[{name:"traceID",type:o.PU.string,values:[],config:{unit:"string",displayNameFromDS:"Trace ID",links:[{title:"Trace: ${__value.raw}",url:"",internal:{datasourceUid:j.uid,datasourceName:j.name,query:{query:"${__value.raw}",queryType:"traceql"}}}]}},{name:"traceService",type:o.PU.string,config:{displayNameFromDS:"Trace service"},values:[]},{name:"traceName",type:o.PU.string,config:{displayNameFromDS:"Trace name"},values:[]},{name:"startTime",type:o.PU.time,config:{displayNameFromDS:"Start time"},values:[]},{name:"traceDuration",type:o.PU.number,config:{displayNameFromDS:"Duration",unit:"ms"},values:[]}],meta:{preferredVisualisationType:"table"}});if(!K?.length)return k;const Y=K.sort((ee,re)=>parseInt(re?.startTimeUnixNano,10)/1e6-parseInt(ee?.startTimeUnixNano,10)/1e6).map(L);for(const ee of Y)k.add(ee);return k}function L(K){return{traceID:K.traceID,startTime:parseInt(K.startTimeUnixNano,10)/1e6,traceDuration:K.durationMs,traceService:K.rootServiceName||"",traceName:K.rootTraceName||""}}const U=K=>K.stringValue?`"${K.stringValue}"`:""+(K.intValue||K.doubleValue||K.boolValue||'""');function R(K,j){return j.series.map((Y,ee)=>{const re={};Y.labels?.forEach(ne=>{re[ne.key]=U(ne.value)});let J=j.series.length===1?K:"";return Y.labels&&(Y.labels.length===1?J=U(Y.labels[0].value):J=`{${Y.labels.map(ne=>`${ne.key}=${U(ne.value)}`).join(", ")}}`),(0,r.EI)({refId:J||`A${ee}`,fields:[{name:"time",type:o.PU.time,values:Y.samples.map(ne=>parseInt(ne.timestampMs,10))},{name:J,labels:re,type:o.PU.number,values:Y.samples.map(ne=>ne.value),config:{displayNameFromDS:J}}],meta:{preferredVisualisationType:"graph"}})})}function B(K,j,k){return k===i.Jv.Spans?w(K,j):H(K,j)}function H(K,j){const k=(0,r.EI)({name:"Traces",refId:"traces",fields:[{name:"traceID",type:o.PU.string,config:{unit:"string",displayNameFromDS:"Trace ID",custom:{width:200},links:[{title:"Trace: ${__value.raw}",url:"",internal:{datasourceUid:j.uid,datasourceName:j.name,query:{query:"${__value.raw}",queryType:"traceql"}}}]}},{name:"startTime",type:o.PU.time,config:{displayNameFromDS:"Start time",custom:{width:200}}},{name:"traceService",type:o.PU.string,config:{displayNameFromDS:"Service"}},{name:"traceName",type:o.PU.string,config:{displayNameFromDS:"Name"}},{name:"traceDuration",type:o.PU.number,config:{displayNameFromDS:"Duration",unit:"ms",custom:{width:120}}},{name:"nested",type:o.PU.nestedFrames}],meta:{preferredVisualisationType:"table",uniqueRowIdFields:[0]}});return K?.length?(k.length=K.length,K.sort((Y,ee)=>parseInt(ee?.startTimeUnixNano,10)/1e6-parseInt(Y?.startTimeUnixNano,10)/1e6).forEach(Y=>{const ee=L(Y);k.fields[0].values.push(ee.traceID),k.fields[1].values.push(ee.startTime),k.fields[2].values.push(ee.traceService),k.fields[3].values.push(ee.traceName),k.fields[4].values.push(ee.traceDuration),Y.spanSets?k.fields[5].values.push(Y.spanSets.map(re=>V(Y,re,j))):Y.spanSet&&k.fields[5].values.push([V(Y,Y.spanSet,j)])}),[k]):[k]}function w(K,j){const k={};let Y=!1;K?.forEach(re=>N(re).forEach(J=>{J.attributes?.forEach(ne=>{k[ne.key]={name:ne.key,type:o.PU.string,config:{displayNameFromDS:ne.key}}}),J.spans.forEach(ne=>{ne.name&&(Y=!0),ne.attributes?.forEach(q=>{k[q.key]={name:q.key,type:o.PU.string,config:{displayNameFromDS:q.key}}})})}));const ee=new n.k({name:"Spans",refId:"traces",fields:[{name:"traceIdHidden",type:o.PU.string,config:{custom:{hidden:!0}}},{name:"traceService",type:o.PU.string,config:{displayNameFromDS:"Trace Service",custom:{width:200}}},{name:"traceName",type:o.PU.string,config:{displayNameFromDS:"Trace Name",custom:{width:200}}},{name:"spanID",type:o.PU.string,config:{unit:"string",displayNameFromDS:"Span ID",custom:{width:200},links:[{title:"Span: ${__value.raw}",url:"",internal:{datasourceUid:j.uid,datasourceName:j.name,query:{query:"${__data.fields.traceIdHidden}",queryType:"traceql"},panelsState:{trace:{spanId:"${__value.raw}"}}}}]}},{name:"time",type:o.PU.time,config:{displayNameFromDS:"Start time"}},{name:"name",type:o.PU.string,config:{displayNameFromDS:"Name",custom:{hidden:!Y}}},...Object.values(k).sort((re,J)=>re.name.localeCompare(J.name)),{name:"duration",type:o.PU.number,config:{displayNameFromDS:"Duration",unit:"ns",custom:{width:120}}}],meta:{preferredVisualisationType:"table"}});return!K||!K.length?[ee]:(K.sort((re,J)=>parseInt(J?.startTimeUnixNano,10)/1e6-parseInt(re?.startTimeUnixNano,10)/1e6).forEach(re=>{N(re).forEach(J=>{J.spans.forEach(ne=>{ee.add(G(ne,J,re))})})}),[ee])}const N=K=>K.spanSets||(K.spanSet?[K.spanSet]:[]),V=(K,j,k)=>{const Y={};let ee=!1;j.attributes?.map(ne=>{Y[ne.key]={name:ne.key,type:o.PU.string,config:{displayNameFromDS:ne.key},values:[]}}),j.spans.forEach(ne=>{ne.name&&(ee=!0),ne.attributes?.forEach(q=>{Y[q.key]={name:q.key,type:o.PU.string,config:{displayNameFromDS:q.key},values:[]}})});const re=new n.k({fields:[{name:"traceIdHidden",type:o.PU.string,config:{custom:{hidden:!0}},values:[]},{name:"spanID",type:o.PU.string,values:[],config:{unit:"string",displayNameFromDS:"Span ID",custom:{width:200},links:[{title:"Span: ${__value.raw}",url:"",internal:{datasourceUid:k.uid,datasourceName:k.name,query:{query:"${__data.fields.traceIdHidden}",queryType:"traceql"},panelsState:{trace:{spanId:"${__value.raw}"}}}}]}},{name:"time",type:o.PU.time,config:{displayNameFromDS:"Start time",custom:{width:200}}},{name:"name",type:o.PU.string,values:[],config:{displayNameFromDS:"Name",custom:{hidden:!ee}}},...Object.values(Y).sort((ne,q)=>ne.name.localeCompare(q.name)),{name:"duration",type:o.PU.number,values:[],config:{displayNameFromDS:"Duration",unit:"ns",custom:{width:120}}}],meta:{preferredVisualisationType:"table"}}),J=(0,g.a)();for(const ne of re.fields)ne.display=(0,u.J)({field:ne,theme:J});return j.spans.forEach(ne=>{re.add(G(ne,j,K))}),re};function G(K,j,k){const Y=parseInt(K.startTimeUnixNano,10)/1e6,ee={traceIdHidden:k.traceID,traceService:k.rootServiceName||"",traceName:k.rootTraceName||"",spanID:K.spanID,time:Y,duration:parseInt(K.durationNanos,10),name:K.name};let re=[];return j.attributes&&(re=re.concat(j.attributes)),K.attributes&&(re=re.concat(K.attributes)),re.forEach(J=>{(J.value.boolValue||J.value.Value?.bool_value)&&(ee[J.key]=J.value.boolValue||J.value.Value?.bool_value),(J.value.doubleValue||J.value.Value?.double_value)&&(ee[J.key]=J.value.doubleValue||J.value.Value?.double_value),(J.value.intValue||J.value.Value?.int_value)&&(ee[J.key]=J.value.intValue||J.value.Value?.int_value),(J.value.stringValue||J.value.Value?.string_value)&&(ee[J.key]=J.value.stringValue||J.value.Value?.string_value)}),ee}const _={data:[new n.k({fields:[{name:"trace",type:o.PU.trace,values:[]}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"otlp"}}})]}},54807:(Q,A,e)=>{"use strict";e.d(A,{S:()=>o,T:()=>c});var t=e(37471),n=e(11261);function o(l){const f=l.map(s),d=new t.k({fields:[{name:"traceID",type:n.PU.string,values:[]},{name:"spanID",type:n.PU.string,values:[]},{name:"parentSpanID",type:n.PU.string,values:[]},{name:"operationName",type:n.PU.string,values:[]},{name:"serviceName",type:n.PU.string,values:[]},{name:"serviceTags",type:n.PU.other,values:[]},{name:"startTime",type:n.PU.number,values:[]},{name:"duration",type:n.PU.number,values:[]},{name:"logs",type:n.PU.other,values:[]},{name:"tags",type:n.PU.other,values:[]}],meta:{preferredVisualisationType:"trace",custom:{traceFormat:"zipkin"}}});for(const h of f)d.add(h);return d}function s(l){const f={traceID:l.traceId,spanID:l.id,parentSpanID:l.parentId,operationName:l.name,serviceName:l.localEndpoint?.serviceName||l.remoteEndpoint?.serviceName||"unknown",serviceTags:g(l),startTime:l.timestamp/1e3,duration:l.duration/1e3,logs:l.annotations?.map(r)??[],tags:Object.keys(l.tags||{}).reduce((d,h)=>h==="error"?(d.push({key:"error",value:!0}),d.push({key:"errorValue",value:l.tags.error}),d):(d.push({key:h,value:l.tags[h]}),d),[])};return l.kind&&(f.tags=[{key:"kind",value:l.kind},...f.tags??[]]),l.shared&&(f.tags=[{key:"shared",value:l.shared},...f.tags??[]]),f}function r(l){return{timestamp:l.timestamp,fields:[{key:"annotation",value:l.value}]}}function g(l){const f=l.localEndpoint||l.remoteEndpoint;return f?[u("ipv4",f.ipv4),u("ipv6",f.ipv6),u("port",f.port),u("endpointType",l.localEndpoint?"local":"remote")].filter(d=>!!d):[]}function u(l,f){if(f)return{key:l,value:f}}const c=l=>{let f=[];for(let d=0;d<l.length;d++){const h=l.get(d);f.push({traceId:h.traceID,parentId:h.parentSpanID,name:h.operationName,id:h.spanID,timestamp:h.startTime*1e3,duration:h.duration*1e3,...i(h),annotations:h.logs.length?h.logs.map(p=>({timestamp:p.timestamp,value:p.fields[0].value})):void 0,tags:h.tags.length?h.tags.filter(p=>p.key!=="kind"&&p.key!=="endpointType"&&p.key!=="shared").reduce((p,m)=>m.key==="error"?{...p,[m.key]:h.tags.find(a=>a.key==="errorValue").value||""}:{...p,[m.key]:m.value},{}):void 0,kind:h.tags.find(p=>p.key==="kind")?.value,shared:h.tags.find(p=>p.key==="shared")?.value})}return f},i=l=>{const f=l.serviceTags.find(d=>d.key==="endpointType")?.value==="local"?"localEndpoint":"remoteEndpoint";return l.serviceName!=="unknown"?{[f]:{serviceName:l.serviceName,ipv4:l.serviceTags.find(d=>d.key==="ipv4")?.value,ipv6:l.serviceTags.find(d=>d.key==="ipv6")?.value,port:l.serviceTags.find(d=>d.key==="port")?.value}}:void 0}},64861:(Q,A,e)=>{"use strict";e.d(A,{nE:()=>s,r6:()=>o,xB:()=>t,zX:()=>n});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||{}),o=(r=>(r.Default="default",r.Custom="custom",r))(o||{}),s=(r=>(r.List="list",r.Stat="stat",r))(s||{})},39758:(Q,A,e)=>{"use strict";e.d(A,{mn:()=>g,ur:()=>n});var t=e(97706);const n=1,o=2,s=3,r=(u,c,i,l)=>(0,t.h)(c+u*(i+l),6);function g(u,c,i,l,f){let d=1-c,h=i===n?d/(u-1):i===o?d/u:i===s?d/(u+1):0;(isNaN(h)||h===1/0)&&(h=0);let p=i===n?0:i===o?h/2:i===s?h:0,m=c/u,a=(0,t.h)(m,6);if(l==null)for(let v=0;v<u;v++)f(v,r(v,p,m,h),a);else f(l,r(l,p,m,h),a)}},4134:(Q,A,e)=>{"use strict";e.d(A,{C$:()=>g,HY:()=>r,ur:()=>o});const t=10,n=4;function o(u,c,i,l,f,d){return u>=i&&u<=f&&c>=l&&c<=d}function s(u,c,i){let l;if(u.o.length&&(l=u.o.find(f=>f.sidx===c&&f.didx===i)),l==null&&u.q)for(let f=0;f<u.q.length&&(l=s(u.q[f],c,i),!l);f++);return l}function r(u,c){return u.x<=c.x+c.w&&u.x+u.w>=c.x&&u.y+u.h>=c.y&&u.y<=c.y+c.h}class g{constructor(c,i,l,f,d=0){this.x=c,this.y=i,this.w=l,this.h=f,this.l=d,this.o=[],this.q=null}split(){let c=this,i=c.x,l=c.y,f=c.w/2,d=c.h/2,h=c.l+1;c.q=[new g(i+f,l,f,d,h),new g(i,l,f,d,h),new g(i,l+d,f,d,h),new g(i+f,l+d,f,d,h)]}quads(c,i,l,f,d){let h=this,p=h.q,m=h.x+h.w/2,a=h.y+h.h/2,v=i<a,E=c<m,D=c+l>m,b=i+f>a;v&&D&&d(p[0]),E&&v&&d(p[1]),E&&b&&d(p[2]),D&&b&&d(p[3])}add(c){let i=this;if(i.q!=null)i.quads(c.x,c.y,c.w,c.h,l=>{l.add(c)});else{let l=i.o;if(l.push(c),l.length>t&&i.l<n){i.split();for(let f=0;f<l.length;f++){let d=l[f];i.quads(d.x,d.y,d.w,d.h,h=>{h.add(d)})}i.o.length=0}}}get(c,i,l,f,d){let h=this,p=h.o;for(let m=0;m<p.length;m++)d(p[m]);h.q!=null&&h.quads(c,i,l,f,m=>{m.get(c,i,l,f,d)})}clear(){this.o.length=0,this.q=null}}},58384:(Q,A,e)=>{"use strict";e.d(A,{d:()=>d,l:()=>h});var t=e(2543),n=e.n(t),o=e(96540),s=e(47070),r=e(56323),g=e(52622),u=e(97696),c=e(59796),i=e(12509),l=e(2913),f=e(17516);class d extends o.PureComponent{constructor(){super(...arguments),this.renderComponent=(m,a)=>{const{options:v,fieldConfig:E}=this.props,{value:D,alignmentFactors:b,orientation:C,width:y,height:M,count:T}=m,{field:I,display:x,view:S,colIndex:O}=D,{openMenu:P,targetClassName:L}=a;let U;return S&&(0,t.isNumber)(O)&&(U=S.getFieldDisplayProcessor(O)),o.createElement(u.xE,{value:h(T,E.defaults,x),width:y,height:M,orientation:C,field:I,text:v.text,display:U,theme:l.$W.theme2,itemSpacing:this.getItemSpacing(),displayMode:v.displayMode,onClick:P,className:L,alignmentFactors:T>1?b:void 0,showUnfilled:v.showUnfilled,valueDisplayMode:v.valueMode,namePlacement:v.namePlacement})},this.renderValue=m=>{const{value:a,orientation:v}=m,{hasLinks:E,getLinks:D}=a;return E&&D?o.createElement("div",{style:{width:"100%",display:v===s.wV.Vertical?"flex":"initial"}},o.createElement(c.e,{style:{height:"100%"},links:D},b=>this.renderComponent(m,b))):this.renderComponent(m,{})},this.getValues=()=>{const{data:m,options:a,replaceVariables:v,fieldConfig:E,timeZone:D}=this.props;return(0,r.PI)({fieldConfig:E,reduceOptions:a.reduceOptions,replaceVariables:v,theme:l.$W.theme2,data:m.series,timeZone:D})}}getItemSpacing(){return this.props.options.displayMode==="lcd"?2:10}getOrientation(){const{options:m,width:a,height:v}=this.props,{orientation:E}=m;return E===s.wV.Auto?a>v?s.wV.Vertical:s.wV.Horizontal:E}calcBarSize(){const{options:m}=this.props,a=this.getOrientation(),v=m.sizing===g.T6.Manual,E=a===s.wV.Vertical,D=a===s.wV.Horizontal,b=v&&E?m.minVizWidth:f.K.minVizWidth,C=v&&D?m.minVizHeight:f.K.minVizHeight,y=v&&D?m.maxVizHeight:f.K.maxVizHeight;return{minVizWidth:b,minVizHeight:C,maxVizHeight:y}}render(){const{height:m,width:a,options:v,data:E,renderCounter:D}=this.props,{minVizWidth:b,minVizHeight:C,maxVizHeight:y}=this.calcBarSize();return o.createElement(i.S,{source:E,getAlignmentFactors:r.XS,getValues:this.getValues,renderValue:this.renderValue,renderCounter:D,width:a,height:m,maxVizHeight:y,minVizWidth:b,minVizHeight:C,itemSpacing:this.getItemSpacing(),orientation:v.orientation})}}function h(p,m,a){return p===1&&!m.displayName?{...a,title:void 0}:a}},17516:(Q,A,e)=>{"use strict";e.d(A,{K:()=>n});var t=e(52622);const n={displayMode:t.eX.Gradient,maxVizHeight:300,minVizHeight:16,minVizWidth:8,namePlacement:t.TZ.Auto,showUnfilled:!0,sizing:t.T6.Auto,valueMode:t.$l.Color}},14738:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{plugin:()=>C});var t=e(65158),n=e(52622),o=e(71242),s=e(23799),r=e(63250);const g=y=>(0,r._$)(y),u=(y,M,T)=>{const I=(0,r.gl)(y,M,T);if(M==="singlestat"&&T.angular){const x=T.angular.gauge;x&&(I.showThresholdMarkers=x.thresholdMarkers,I.showThresholdLabels=x.thresholdLabels)}return I};var c=e(96540),i=e(57875),l=e(56323),f=e(95164),d=e(59796),h=e(12509),p=e(2913),m=e(58384);const a={minVizHeight:75,minVizWidth:75,showThresholdLabels:!1,showThresholdMarkers:!0,sizing:n.T6.Auto};class v extends c.PureComponent{constructor(){super(...arguments),this.renderComponent=(M,T)=>{const{options:I,fieldConfig:x}=this.props,{width:S,height:O,count:P,value:L}=M,{field:U,display:R}=L,{openMenu:B,targetClassName:H}=T;return c.createElement(f._,{value:(0,m.l)(P,x.defaults,R),width:S,height:O,field:U,text:I.text,showThresholdLabels:I.showThresholdLabels,showThresholdMarkers:I.showThresholdMarkers,theme:p.$W.theme2,onClick:B,className:H,orientation:I.orientation})},this.renderValue=M=>{const{value:T}=M,{getLinks:I,hasLinks:x}=T;return x&&I?c.createElement(d.e,{links:I,style:{flexGrow:1}},S=>this.renderComponent(M,S)):this.renderComponent(M,{})},this.getValues=()=>{const{data:M,options:T,replaceVariables:I,fieldConfig:x,timeZone:S}=this.props;for(let O of M.series)for(let P of O.fields)if(P.config.unit==="percent"||P.config.unit==="percentunit"){const L=P.config.min??0,U=P.config.max??(P.config.unit==="percent"?100:1);P.state=P.state??{},P.state.range={min:L,max:U,delta:U-L},P.display=(0,i.J)({field:P,theme:p.$W.theme2})}return(0,l.PI)({fieldConfig:x,reduceOptions:T.reduceOptions,replaceVariables:I,theme:p.$W.theme2,data:M.series,timeZone:S})},this.calculateGaugeSize=()=>{const{options:M}=this.props,T=M.orientation,I=M.sizing===n.T6.Manual,x=T===n.wV.Vertical,S=T===n.wV.Horizontal,O=I&&x?M.minVizWidth:a.minVizWidth,P=I&&S?M.minVizHeight:a.minVizHeight;return{minVizWidth:O,minVizHeight:P}}}render(){const{height:M,width:T,data:I,renderCounter:x,options:S}=this.props,{minVizHeight:O,minVizWidth:P}=this.calculateGaugeSize();return c.createElement(h.S,{getValues:this.getValues,renderValue:this.renderValue,width:T,height:M,source:I,autoGrid:!0,renderCounter:x,orientation:S.orientation,minVizHeight:O,minVizWidth:P})}}var E=e(50082),D=e(38824);class b{getSuggestionsForData(M){const{dataSummary:T}=M;if(!T.hasData||!T.hasNumberField||T.numberFieldCount>=50)return;const I=M.getListAppender({name:D.m.Gauge,pluginId:"gauge",options:{},fieldConfig:{defaults:{thresholds:{steps:[{value:-1/0,color:"green"},{value:70,color:"orange"},{value:85,color:"red"}],mode:E.O.Percentage},custom:{}},overrides:[]},cardOptions:{previewModifier:x=>{x.options.reduceOptions.values&&(x.options.reduceOptions.limit=2)}}});T.hasStringField&&T.frameCount===1&&T.rowCountTotal<10?(I.append({name:D.m.Gauge,options:{reduceOptions:{values:!0,calcs:[]}}}),I.append({name:D.m.GaugeNoThresholds,options:{reduceOptions:{values:!0,calcs:[]},showThresholdMarkers:!1}})):(I.append({name:D.m.Gauge,options:{reduceOptions:{values:!1,calcs:["lastNotNull"]}}}),I.append({name:D.m.GaugeNoThresholds,options:{reduceOptions:{values:!1,calcs:["lastNotNull"]},showThresholdMarkers:!1}}))}}const C=new t.m(v).useFieldConfig({useCustomConfig:y=>{y.addNumberInput({path:"neutral",name:"Neutral",description:"Leave empty to use Min as neutral point",category:["Gauge"],settings:{placeholder:"auto"}})}}).setPanelOptions(y=>{(0,s.L)(y),(0,s.h)(y),y.addBooleanSwitch({path:"showThresholdLabels",name:"Show threshold labels",description:"Render the threshold values around the gauge bar",defaultValue:a.showThresholdLabels}).addBooleanSwitch({path:"showThresholdMarkers",name:"Show threshold markers",description:"Renders the thresholds as an outer bar",defaultValue:a.showThresholdMarkers}).addRadio({path:"sizing",name:"Gauge size",settings:{options:[{value:n.T6.Auto,label:"Auto"},{value:n.T6.Manual,label:"Manual"}]},defaultValue:a.sizing,showIf:M=>M.orientation!==n.wV.Auto}).addSliderInput({path:"minVizWidth",name:"Min width",description:"Minimum column width (vertical orientation)",defaultValue:a.minVizWidth,settings:{min:0,max:600,step:1},showIf:M=>M.sizing===n.T6.Manual&&M.orientation===n.wV.Vertical}).addSliderInput({path:"minVizHeight",name:"Min height",description:"Minimum row height (horizontal orientation)",defaultValue:a.minVizHeight,settings:{min:0,max:600,step:1},showIf:M=>M.sizing===n.T6.Manual&&M.orientation===n.wV.Horizontal}),o.I(y)}).setPanelChangeHandler(u).setSuggestionsSupplier(new b).setMigrationHandler(g)},19743:(Q,A,e)=>{"use strict";e.d(A,{x:()=>s});var t=e(96540),n=e(1173),o=e(74668);const s=({value:r,context:g,onChange:u})=>{const c=(0,t.useCallback)(i=>{u(i?.length?{id:n.jR.byRefId,options:i}:void 0)},[u]);return t.createElement(o.X,{value:r?.options,onChange:c,data:g.data,placeholder:"Change filter"})}},33744:(Q,A,e)=>{"use strict";e.d(A,{DY:()=>s,G4:()=>u,Sq:()=>i,T5:()=>c,W_:()=>n,_7:()=>o,fX:()=>r,wq:()=>g,yQ:()=>l,yu:()=>f});var t=e(52622),n=(d=>(d.Point="point",d.Line="line",d.Polygon="polygon",d.Any="*any*",d))(n||{});const o=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||{}),g=(d=>(d.Left="left",d.Center="center",d.Right="right",d))(g||{}),u=(d=>(d.Top="top",d.Center="center",d.Bottom="bottom",d))(u||{});const c=Object.freeze({size:{fixed:o,min:2,max:15},color:{fixed:"dark-green"},opacity:.4,symbol:{mode:t.q_.Fixed,fixed:"img/icons/marker/circle.svg"},symbolAlign:{horizontal:"center",vertical:"center"},textConfig:{fontSize:12,textAlign:"center",textBaseline:"middle",offsetX:0,offsetY:0},rotation:{fixed:0,mode:t.WQ.Mod,min:-360,max:360}});var i=(d=>(d.color="fill",d.opacity="fill-opacity",d.lineWidth="stroke-width",d))(i||{}),l=(d=>(d.color="marker-color",d.size="marker-size",d))(l||{}),f=(d=>(d.color="stroke",d.lineWidth="stroke-width",d))(f||{})},61994:(Q,A,e)=>{"use strict";e.d(A,{A:()=>s});var t=e(32196),n=e(96540),o=e(5636);const s=r=>(0,o.gU)(r)?n.createElement("a",{href:r,target:"_blank",className:(0,t.cx)("external-link"),rel:"noreferrer"},r):r},5636:(Q,A,e)=>{"use strict";e.d(A,{Bz:()=>d,G_:()=>c,cA:()=>f,gU:()=>m,o3:()=>p,q:()=>h,rd:()=>l,ue:()=>g});var t=e(92347),n=e(40239),o=e(63577),s=e(90183),r=e(33744);function g(a,v,E,D){const b={};return D&&Object.keys(D).length?(b.color=(0,o.getColorDimension)(a,D.color??r.T5.color,E),b.size=(0,o.getScaledDimension)(a,D.size??r.T5.size),b.rotation=(0,o.getScalarDimension)(a,D.rotation??r.T5.rotation),D.text&&(D.text.field||D.text.fixed)&&(b.text=(0,o.getTextDimension)(a,D.text))):v.fields&&(v.fields.color&&(b.color=(0,o.getColorDimension)(a,v.config.color??r.T5.color,E)),v.fields.size&&(b.size=(0,o.getScaledDimension)(a,v.config.size??r.T5.size)),v.fields.text&&(b.text=(0,o.getTextDimension)(a,v.config.text)),v.fields.rotation&&(b.rotation=(0,o.getScalarDimension)(a,v.config.rotation??r.T5.rotation))),b}let u;function c(){return u||(u=[],i()),u}async function i(){const a=await(0,s.o)();for(let v of["maps","gazetteer"])a.listFiles(v).subscribe({next:E=>{E.forEach(D=>{if(D.name.endsWith(".geojson")){const b=`public/${v}/${D.name}`;u.push({value:b,label:b})}})}})}const l=(a,v,E)=>{const D=a.initMapView(v.view);return a.map=new t.A({view:D,pixelRatio:1,layers:[],controls:[],target:E,interactions:(0,n.N)({mouseWheelZoom:!1})})},f=(a,v)=>{a.initControls(v.controls),a.forceUpdate()},d=(a,v,E)=>{a.panelContext&&a.panelContext.onInstanceStateChange&&a.panelContext.onInstanceStateChange({map:a.map,layers:v,selected:E,actions:a.actions})},h=a=>{let v=a.layers.length;for(;v<100;){const E=`Layer ${v++}`;if(!a.byName.has(E))return E}return`Layer ${Date.now()}`};function p(a,v,E,D){const b=a.getPixelFromCoordinate(E),C=a.getPixelFromCoordinate(D),y=Math.abs(b[0]-C[0]),M=Math.abs(b[1]-C[1]);return y>v||M>v}const m=a=>{try{return new URL(a).protocol.includes("http")}catch{return!1}}},86106:(Q,A,e)=>{"use strict";e.d(A,{d:()=>o});var t=e(96540),n=e(25469);function o(s){const r={position:"relative",top:"auto",right:"auto",marginRight:0};return t.createElement("div",{style:{width:"100%",display:"flex",justifyContent:"flex-end",paddingBottom:"6px"}},t.createElement(n.J,{onClick:s.onClick,style:s.style??r}))}},52995:(Q,A,e)=>{"use strict";e.d(A,{P7:()=>n,uM:()=>o,KQ:()=>r});var t=e(52622),n=(g=>(g.Opacity="opacity",g.Scheme="scheme",g))(n||{}),o=(g=>(g.Exponential="exponential",g.Linear="linear",g))(o||{});const s={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.yL.Auto,tooltip:{mode:t.$N.Single,yHistogram:!1,showColorScale:!1}},r={...s,color:{...s.color,mode:n.Scheme,scale:o.Exponential},yAxis:{...s.yAxis,axisPlacement:t.vM.Left},rowsFrame:{...s.rowsFrame,layout:t.D7.auto}}},69386:(Q,A,e)=>{"use strict";e.d(A,{K:()=>l});var t=e(32196),n=e(96540),o=e(70255),s=e(40672),r=e(72724),g=e(40845),u=e(72129);function c({width:d,showImage:h,data:p,index:m}){const a=(0,g.of)(f),v=d>600,E=p.get(m);return n.createElement("article",{className:(0,t.cx)(a.item,v&&a.itemWide)},h&&E.ogImage&&n.createElement("a",{tabIndex:-1,href:s.sQ.sanitizeUrl(E.link),target:"_blank",rel:"noopener noreferrer",className:(0,t.cx)(a.socialImage,v&&a.socialImageWide),"aria-hidden":!0},n.createElement("img",{src:E.ogImage,alt:E.title})),n.createElement("div",{className:a.body},n.createElement("time",{className:a.date,dateTime:(0,r.LE)(E.date,{format:"MMM DD"})},(0,r.LE)(E.date,{format:"MMM DD"})," "),n.createElement("a",{className:a.link,href:s.sQ.sanitizeUrl(E.link),target:"_blank",rel:"noopener noreferrer"},n.createElement("h3",{className:a.title},E.title)),n.createElement("div",{className:a.content,dangerouslySetInnerHTML:{__html:s.sQ.sanitize(E.content)}})))}const i=({width:d,showImage:h,rootProps:p})=>{const m=(0,g.of)(f),a=d>600;return n.createElement("div",{className:(0,t.cx)(m.item,a&&m.itemWide),...p},h&&n.createElement(o.A,{containerClassName:(0,t.cx)(m.socialImage,a&&m.socialImageWide),width:a?"250px":"100%",height:a?"150px":d*.5}),n.createElement("div",{className:m.body},n.createElement(o.A,{containerClassName:m.date,width:60}),n.createElement(o.A,{containerClassName:m.title,width:250}),n.createElement(o.A,{containerClassName:m.content,width:"100%",count:6})))},l=(0,u.j)(c,i),f=d=>({container:(0,t.css)({height:"100%"}),item:(0,t.css)({display:"flex",padding:d.spacing(1),position:"relative",marginBottom:d.spacing(.5),marginRight:d.spacing(1),borderBottom:`2px solid ${d.colors.border.weak}`,background:d.colors.background.primary,flexDirection:"column",flexShrink:0}),itemWide:(0,t.css)({flexDirection:"row"}),body:(0,t.css)({display:"flex",flexDirection:"column",flex:1}),socialImage:(0,t.css)({display:"flex",alignItems:"center",marginBottom:d.spacing(1),"> img":{width:"100%",borderRadius:`${d.shape.radius.default} ${d.shape.radius.default} 0 0`}}),socialImageWide:(0,t.css)({marginRight:d.spacing(2),marginBottom:0,"> img":{width:"250px",borderRadius:d.shape.radius.default}}),link:(0,t.css)({color:d.colors.text.link,display:"inline-block","&:hover":{color:d.colors.text.link,textDecoration:"underline"}}),title:(0,t.css)({fontSize:"16px",marginBottom:d.spacing(.5)}),content:(0,t.css)({p:{marginBottom:d.spacing(.5),color:d.colors.text.primary}}),date:(0,t.css)({marginBottom:d.spacing(.5),fontWeight:500,borderRadius:`0 0 0 ${d.shape.radius.default}`,color:d.colors.text.secondary})})},62372:(Q,A,e)=>{"use strict";e.d(A,{$:()=>t});const t="https://grafana.com/blog/news.xml"},4172:(Q,A,e)=>{"use strict";e.d(A,{n:()=>d});var t=e(41053),n=e(78368);function o(h){const m=new DOMParser().parseFromString(h,"text/xml");return{items:Array.from(m.querySelectorAll("entry")).map(v=>({title:u(v,"title"),link:v.querySelector("link")?.getAttribute("href")??"",content:u(v,"content"),pubDate:u(v,"published"),ogImage:v.querySelector("meta[property='og:image']")?.getAttribute("content")}))}}function s(h){const m=new DOMParser().parseFromString(h,"text/xml");return{items:Array.from(m.querySelectorAll("item")).map(v=>({title:u(v,"title"),link:u(v,"link"),content:u(v,"description"),pubDate:u(v,"pubDate"),ogImage:v.querySelector("meta[property='og:image']")?.getAttribute("content")}))}}async function r(h){return await(await fetch(h)).text()}function g(h){return new DOMParser().parseFromString(h,"text/xml").querySelector("feed")!==null}function u(h,p){return h.querySelector(p)?.textContent??""}async function c(h){const p=await r(h);return g(p)?o(p):s(p)}var i=e(47232),l=e(11261);function f(h){const p=[],m=[],a=[],v=[],E=[];for(const D of h.items){const b=(0,i.KQ)(D.pubDate);try{if(p.push(b.valueOf()),m.push(D.title),a.push(D.link),E.push(D.ogImage),D.content){const C=D.content.replace(/<\/?[^>]+(>|$)/g,"");v.push(C)}}catch(C){console.warn("Error reading news item:",C,D)}}return{fields:[{name:"date",type:l.PU.time,config:{displayName:"Date"},values:p},{name:"title",type:l.PU.string,config:{},values:m},{name:"link",type:l.PU.string,config:{},values:a},{name:"content",type:l.PU.string,config:{},values:v},{name:"ogImage",type:l.PU.string,config:{},values:E}],length:p.length}}function d(h){const[p,m]=(0,t.A)(async()=>{const a=await c(h),v=f(a);return new n.R(v)},[h],{loading:!0});return{state:p,getNews:m}}},23799:(Q,A,e)=>{"use strict";e.d(A,{L:()=>g,h:()=>u});var t=e(69550),n=e(75059),o=e(28240),s=e(54479),r=e(52622);function g(c,i=!0){const l=["Value options"];c.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:l,defaultValue:!1}),c.addNumberInput({path:"reduceOptions.limit",name:"Limit",description:"Max number of rows to display",category:l,settings:{placeholder:"25",integer:!0,min:1,max:5e3},showIf:f=>f.reduceOptions.values===!0}),c.addCustomEditor({id:"reduceOptions.calcs",path:"reduceOptions.calcs",name:"Calculation",description:"Choose a reducer function / calculation",category:l,editor:t.D.get("stats-picker").editor,defaultValue:[n.gy.lastNotNull],showIf:f=>f.reduceOptions.values===!1}),i&&c.addSelect({path:"reduceOptions.fields",name:"Fields",description:"Select the fields that should be included in the panel",category:l,settings:{allowCustomValue:!0,options:[],getOptions:async f=>{const d=[{value:"",label:"Numeric Fields"},{value:"/.*/",label:"All Fields"}];if(f&&f.data)for(const h of f.data)for(const p of h.fields){const m=(0,o.Ct)(p,h,f.data),a=`/^${(0,s.jD)(m)}$/`;d.push({value:a,label:m})}return Promise.resolve(d)}},defaultValue:""})}function u(c,i){c.addRadio({path:"orientation",name:"Orientation",description:"Layout orientation",category:i,settings:{options:[{value:r.wV.Auto,label:"Auto"},{value:r.wV.Horizontal,label:"Horizontal"},{value:r.wV.Vertical,label:"Vertical"}]},defaultValue:r.wV.Auto})}},36373:(Q,A,e)=>{"use strict";e.r(A),e.d(A,{plugin:()=>C});var t=e(65158),n=e(52622),o=e(71242),s=e(63250),r=e(24293);const g=(y,M,T)=>{const I=(0,s.gl)(y,M,T);if(T.angular&&(M==="singlestat"||M==="grafana-singlestat-panel")){const x=T.angular;if(I.graphMode=n.$p.None,x.sparkline&&x.sparkline.show&&(I.graphMode=n.$p.Area),x.colorBackground)I.colorMode=n.yp.Background;else if(x.colorValue)I.colorMode=n.yp.Value;else if(I.colorMode=n.yp.None,x.sparkline?.lineColor&&I.graphMode===n.$p.Area){const S=y.fieldConfig??{};S.defaults.color={mode:r.Y.Fixed,fixedColor:x.sparkline.lineColor},y.fieldConfig=S}x.valueName==="name"&&(I.textMode=n.SV.Name)}return I};var u=e(2543),c=e(96540),i=e(11261),l=e(56323),f=e(90708),d=e(37494),h=e(59796),p=e(12509),m=e(2913);class a extends c.PureComponent{constructor(){super(...arguments),this.renderComponent=(M,T)=>{const{timeRange:I,options:x}=this.props,{value:S,alignmentFactors:O,width:P,height:L,count:U}=M,{openMenu:R,targetClassName:B}=T;let H=S.sparkline;return H&&(H.timeRange=I),c.createElement(d.yV,{value:S.display,count:U,sparkline:H,colorMode:x.colorMode,graphMode:x.graphMode,justifyMode:x.justifyMode,textMode:this.getTextMode(),alignmentFactors:O,text:x.text,width:P,height:L,theme:m.$W.theme2,onClick:R,className:B,disableWideLayout:!x.wideLayout})},this.renderValue=M=>{const{value:T}=M,{getLinks:I,hasLinks:x}=T;return x&&I?c.createElement(h.e,{links:I},S=>this.renderComponent(M,S)):this.renderComponent(M,{})},this.getValues=()=>{const{data:M,options:T,replaceVariables:I,fieldConfig:x,timeZone:S}=this.props;let O;for(let P of M.series)for(let L of P.fields){let{config:U}=L;if(L.type===i.PU.number){if(L.state?.range)continue;!O&&(!(0,u.isNumber)(U.min)||!(0,u.isNumber)(U.max))&&(O=(0,f.nJ)(M.series));const R=U.min??O.min,B=U.max??O.max;L.state=L.state??{},L.state.range={min:R,max:B,delta:B-R}}}return(0,l.PI)({fieldConfig:x,reduceOptions:T.reduceOptions,replaceVariables:I,theme:m.$W.theme2,data:M.series,sparkline:T.graphMode!==n.$p.None,percentChange:T.showPercentChange,timeZone:S})}}getTextMode(){const{options:M,fieldConfig:T,title:I}=this.props;return M.textMode===n.SV.Auto&&(T.defaults.displayName||!I)?n.SV.ValueAndName:M.textMode}render(){const{height:M,options:T,width:I,data:x,renderCounter:S}=this.props;return c.createElement(p.S,{getValues:this.getValues,getAlignmentFactors:l.XS,renderValue:this.renderValue,width:I,height:M,source:x,itemSpacing:3,renderCounter:S,autoGrid:!0,orientation:T.orientation})}}var v=e(23799);const E={colorMode:n.yp.Value,graphMode:n.$p.Area,justifyMode:n.F8.Auto,showPercentChange:!1,textMode:n.SV.Auto,wideLayout:!0};var D=e(38824);class b{getSuggestionsForData(M){const{dataSummary:T}=M;if(!T.hasData)return;const I=M.getListAppender({name:D.m.Stat,pluginId:"stat",options:{},fieldConfig:{defaults:{unit:"short",custom:{}},overrides:[]},cardOptions:{previewModifier:x=>{x.options.reduceOptions.values&&(x.options.reduceOptions.limit=1)}}});T.hasStringField&&T.hasNumberField&&T.frameCount===1&&T.rowCountTotal<10&&(I.append({name:D.m.Stat,options:{reduceOptions:{values:!0,calcs:[],fields:"/.*/"}}}),I.append({name:D.m.StatColoredBackground,options:{reduceOptions:{values:!0,calcs:[],fields:"/.*/"},colorMode:n.yp.Background}})),T.stringFieldCount===1&&T.frameCount===1&&T.rowCountTotal<10&&T.fieldCount===1&&I.append({name:D.m.Stat,options:{reduceOptions:{values:!0,calcs:[],fields:"/.*/"},colorMode:n.yp.None}}),T.hasNumberField&&T.hasTimeField&&(I.append({options:{reduceOptions:{values:!1,calcs:["lastNotNull"]}}}),I.append({name:D.m.StatColoredBackground,options:{reduceOptions:{values:!1,calcs:["lastNotNull"]},graphMode:n.$p.None,colorMode:n.yp.Background}}))}}const C=new t.m(a).useFieldConfig().setPanelOptions(y=>{const M=["Stat styles"];(0,v.L)(y),(0,v.h)(y,M),o.I(y),y.addSelect({path:"textMode",name:"Text mode",description:"Control if name and value is displayed or just name",category:M,settings:{options:[{value:n.SV.Auto,label:"Auto"},{value:n.SV.Value,label:"Value"},{value:n.SV.ValueAndName,label:"Value and name"},{value:n.SV.Name,label:"Name"},{value:n.SV.None,label:"None"}]},defaultValue:E.textMode}).addRadio({path:"wideLayout",name:"Wide layout",category:M,settings:{options:[{value:!0,label:"On"},{value:!1,label:"Off"}]},defaultValue:E.wideLayout,showIf:T=>T.textMode===n.SV.ValueAndName}),y.addSelect({path:"colorMode",name:"Color mode",defaultValue:n.yp.Value,category:M,settings:{options:[{value:n.yp.None,label:"None"},{value:n.yp.Value,label:"Value"},{value:n.yp.Background,label:"Background Gradient"},{value:n.yp.BackgroundSolid,label:"Background Solid"}]}}).addRadio({path:"graphMode",name:"Graph mode",description:"Stat panel graph / sparkline mode",category:M,defaultValue:E.graphMode,settings:{options:[{value:n.$p.None,label:"None"},{value:n.$p.Area,label:"Area"}]}}).addRadio({path:"justifyMode",name:"Text alignment",defaultValue:E.justifyMode,category:M,settings:{options:[{value:n.F8.Auto,label:"Auto"},{value:n.F8.Center,label:"Center"}]}}).addBooleanSwitch({path:"showPercentChange",name:"Show percent change",defaultValue:E.showPercentChange,category:M,showIf:T=>!T.reduceOptions.values})}).setNoPadding().setPanelChangeHandler(g).setSuggestionsSupplier(new b).setMigrationHandler(s._$)},21164:(Q,A,e)=>{"use strict";e.d(A,{u:()=>t});const t=(n,o)=>{const s=[],r=new Set;if(n.getLinks){const g=n.values[o],u=n.display?n.display(g):{text:`${g}`,numeric:+g};n.getLinks({calculatedValue:u,valueRowIndex:o}).forEach(c=>{const i=`${c.title}/${c.href}`;r.has(i)||(s.push(c),r.add(i))})}return s}},65885:(Q,A,e)=>{"use strict";e.d(A,{S5:()=>a,fq:()=>g,gy:()=>v,l1:()=>p});var t=e(2543),n=e.n(t),o=e(1173),s=e(50082),r=e(11261);const g=E=>(!E.pluginVersion&&"columns"in E&&console.log("Was angular table",E),E.options),u={timeseries_to_rows:"seriesToRows",timeseries_to_columns:"seriesToColumns",timeseries_aggregations:"reduce",table:"merge"},c={avg:"mean",min:"min",max:"max",total:"sum",current:"lastNotNull",count:"count"},i={cell:"color-background",row:"color-background",value:"color-text"},l=(E,D)=>[-1/0,...E].map((b,C)=>({color:D[C],value:(0,t.isNumber)(b)?b:parseInt(b,10)})),f=(E,D)=>{const b=E.transformations??[];if(Object.keys(u).includes(D.transform)){const C={reducers:[]};D.transform==="timeseries_aggregations"&&(C.includeTimeField=!1,C.reducers=D.columns.map(y=>c[y.value])),b.push({id:u[D.transform],options:C})}return b},d=E=>{const b={matcher:{id:/^\/.*\/$/.test(E.pattern)?o.Ct.byRegexp:o.Ct.byName,options:E.pattern},properties:[]};return E.alias&&b.properties.push({id:"displayName",value:E.alias}),E.unit&&b.properties.push({id:"unit",value:E.unit}),E.decimals&&b.properties.push({id:"decimals",value:E.decimals}),E.type==="date"&&b.properties.push({id:"unit",value:`time: ${E.dateFormat}`}),E.link&&b.properties.push({id:"links",value:[{title:(0,t.defaultTo)(E.linkTooltip,""),url:(0,t.defaultTo)(E.linkUrl,""),targetBlank:(0,t.defaultTo)(E.linkTargetBlank,!1)}]}),E.colorMode&&b.properties.push({id:"custom.cellOptions",value:{type:i[E.colorMode]}}),E.align&&b.properties.push({id:"custom.align",value:E.align==="auto"?null:E.align}),E.thresholds?.length&&b.properties.push({id:"thresholds",value:{mode:s.O.Absolute,steps:l(E.thresholds,E.colors)}}),b},h=E=>{let D={custom:{}};if(E){if(D=(0,t.omitBy)({unit:E.unit,decimals:E.decimals,displayName:E.alias,custom:{align:E.align==="auto"?null:E.align}},t.isNil),E.thresholds.length){const b={mode:s.O.Absolute,steps:l(E.thresholds,E.colors)};D.thresholds=b}E.colorMode&&(D.custom.cellOptions={type:i[E.colorMode]})}return D},p=(E,D,b)=>{if(D==="table-old"&&b.angular){const C=b.angular,y=f(E,C),M=C.styles.find(x=>x.pattern==="/.*/"),T=h(M),I=C.styles.filter(x=>x.pattern!=="/.*/").map(d);E.transformations=y,E.fieldConfig={defaults:T,overrides:I}}return{}},m=E=>E?.filter(D=>D.meta?.custom?.parentRowIndex===void 0)||[E?.[0]],a=E=>{const D=[];return m(E).filter(C=>!!C&&C.length!==0)?.forEach(C=>{const y=E?.filter(x=>C.refId===x.refId&&x.meta?.custom?.parentRowIndex!==void 0),M=(0,t.groupBy)(y,x=>x.meta?.custom?.parentRowIndex),T=Object.keys(M).map(x=>M[x]),I={...C};y&&y.length>0&&I.fields.push({name:"nested",type:r.PU.nestedFrames,config:{},values:T}),D.push(I)}),D},v=E=>E?.some(D=>D.meta?.custom?.parentRowIndex!==void 0)},11082:(Q,A,e)=>{"use strict";e.d(A,{Z:()=>g});var t=e(96540),n=e(66864),o=e(94354),s=e(51275);const r=[{label:"Never",value:!1},{label:"Threshold",value:36e5}],g=({value:u,onChange:c,item:i})=>{const l=typeof u=="number";return r[1].value=l?u:36e5,t.createElement(n.Gy,null,t.createElement(o.z,{value:u,options:r,onChange:c}),l&&t.createElement(s.g,{value:u,onChange:c,inputPrefix:s.F.GreaterThan,isTime:i.settings?.isTime??!1}))}},43228:(Q,A,e)=>{"use strict";e.d(A,{F:()=>i});var t=e(96540),n=e(66864),o=e(94354),s=e(88323),r=e(29158);const g=[{label:"Solid",value:"solid"},{label:"Dash",value:"dash"},{label:"Dots",value:"dot"}],u=["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(f=>({label:f,value:f})),c=["0, 10","0, 20","0, 30","0, 40","0, 3, 3"].map(f=>({label:f,value:f})),i=({value:f,onChange:d})=>{const h=(0,t.useMemo)(()=>f?.fill==="dash"?u:c,[f]),p=(0,t.useMemo)(()=>{if(!f?.dash?.length)return h[0];const m=f.dash?.join(", "),a=h.find(v=>v.value===m);return a||{label:m,value:m}},[f,h]);return t.createElement(n.Gy,null,t.createElement(o.z,{value:f?.fill||"solid",options:g,onChange:m=>{let a;m==="dot"?a=l(c[0].value):m==="dash"&&(a=l(u[0].value)),d({...f,fill:m,dash:a})}}),f?.fill&&f?.fill!=="solid"&&t.createElement(t.Fragment,null,t.createElement(s.l6,{allowCustomValue:!0,options:h,value:p,width:20,onChange:m=>{d({...f,dash:l(m.value??"")})},formatCreateLabel:m=>`Segments: ${l(m).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.K,{name:"question-circle",tooltip:"Help"})))))};function l(f){const d=[];for(const h of f.split(/(?:,| )+/)){const p=Number.parseInt(h,10);isNaN(p)||d.push(p)}return d}},51275:(Q,A,e)=>{"use strict";e.d(A,{F:()=>s,g:()=>r});var t=e(96540),n=e(65879),o=e(10354),s=(g=>(g.LessThan="lessthan",g.GreaterThan="greaterthan",g))(s||{});const r=({value:g,onChange:u,inputPrefix:c,isTime:i})=>{let l=n.secondsToHms(g/1e3);i||(l="10");const f=m=>{let a=!1;if(m)try{i&&n.isValidTimeSpan(m)?a=n.intervalToMs(m):a=Number(m)}catch(v){console.warn("ERROR",v)}u(a)},d=m=>{m.key==="Enter"&&f(m.currentTarget.value)},h=m=>{f(m.currentTarget.value)},p=c==="greaterthan"?t.createElement("div",null,">"):c==="lessthan"?t.createElement("div",null,"<"):null;return t.createElement(o.p,{autoFocus:!1,placeholder:"never",width:10,defaultValue:l,onKeyDown:d,onBlur:h,prefix:p,spellCheck:!1})}},34163:(Q,A,e)=>{"use strict";e.d(A,{e:()=>g});var t=e(96540),n=e(66864),o=e(94354),s=e(51275);const r=[{label:"Never",value:!1},{label:"Always",value:!0},{label:"Threshold",value:36e5}],g=({value:u,onChange:c,item:i})=>{const l=typeof u=="number";return r[2].value=l?u:36e5,t.createElement(n.Gy,null,t.createElement(o.z,{value:u,options:r,onChange:c}),l&&t.createElement(s.g,{value:u,onChange:c,inputPrefix:s.F.LessThan,isTime:i.settings?.isTime??!1}))}},24882:(Q,A,e)=>{"use strict";e.d(A,{D:()=>o});var t=e(96540),n=e(88323);const o=({item:s,value:r,onChange:g,id:u})=>{const c=(0,t.useCallback)(i=>{g({mode:i.value})},[g]);return t.createElement(n.l6,{inputId:u,value:r.mode,options:s.settings?.options??[],onChange:c})}},22731:(Q,A,e)=>{"use strict";e.d(A,{$:()=>h,k:()=>d});var t=e(32196),n=e(96540),o=e(11261),s=e(28240),r=e(52622),g=e(40845),u=e(11389),c=e(58749),i=e(92663),l=e(10875),f=e(21164);const d=({frames:p,seriesFrame:m,dataIdxs:a,seriesIdx:v,mode:E=r.$N.Single,sortOrder:D=r.xB.None,scrollable:b=!1,isPinned:C,annotate:y})=>{const M=(0,g.of)(h),T=m.fields[0],I=T.display(T.values[a[0]]).text,x=(0,l.cp)(m.fields,T,a,v,E,D,P=>P.type===o.PU.number);let S=[];if(v!=null){const P=m.fields[v],L=a[v];S=(0,f.u)(P,L)}const O={label:T.type===o.PU.time?"":(0,s.Ct)(T,m,p),value:I};return n.createElement("div",null,n.createElement("div",{className:M.wrapper},n.createElement(i.A,{headerLabel:O,isPinned:C}),n.createElement(u.o,{contentLabelValue:x,isPinned:C,scrollable:b}),C&&n.createElement(c.S,{dataLinks:S,annotate:y})))},h=()=>({wrapper:(0,t.css)({display:"flex",flexDirection:"column"})})},41706:(Q,A,e)=>{"use strict";e.d(A,{S:()=>p,V:()=>a});var t=e(37055),n=e(24293),o=e(11261),s=e(27310),r=e(52622),g=e(52198),u=e(56675),c=e(38248),i=e(11404),l=e(11082),f=e(43228),d=e(34163),h=e(24882);const p={drawStyle:r.GR.Line,lineInterpolation:r.dx.Linear,lineWidth:1,fillOpacity:0,gradientMode:r.on.None,barAlignment:r.Nj.Center,stacking:{mode:r.gs.None,group:"A"},axisGridShow:!0,axisCenteredZero:!1,axisBorderShow:!1},m=["Graph styles"];function a(v,E=!0){return{standardOptions:{[t.uo.Color]:{settings:{byValueSupport:!0,bySeriesSupport:!0,preferThresholdsMode:!1},defaultValue:{mode:n.Y.PaletteClassic}}},useCustomConfig:D=>{D.addRadio({path:"drawStyle",name:"Style",category:m,defaultValue:v.drawStyle,settings:{options:g.t.drawStyle}}).addRadio({path:"lineInterpolation",name:"Line interpolation",category:m,defaultValue:v.lineInterpolation,settings:{options:g.t.lineInterpolation},showIf:b=>b.drawStyle===r.GR.Line}).addRadio({path:"barAlignment",name:"Bar alignment",category:m,defaultValue:v.barAlignment,settings:{options:g.t.barAlignment},showIf:b=>b.drawStyle===r.GR.Bars}).addSliderInput({path:"lineWidth",name:"Line width",category:m,defaultValue:v.lineWidth,settings:{min:0,max:10,step:1,ariaLabelForHandle:"Line width"},showIf:b=>b.drawStyle!==r.GR.Points}).addSliderInput({path:"fillOpacity",name:"Fill opacity",category:m,defaultValue:v.fillOpacity,settings:{min:0,max:100,step:1,ariaLabelForHandle:"Fill opacity"},showIf:b=>b.drawStyle!==r.GR.Points}).addRadio({path:"gradientMode",name:"Gradient mode",category:m,defaultValue:g.t.fillGradient[0].value,settings:{options:g.t.fillGradient},showIf:b=>b.drawStyle!==r.GR.Points}).addFieldNamePicker({path:"fillBelowTo",name:"Fill below to",category:m,hideFromDefaults:!0,settings:{filter:b=>b.type===o.PU.number}}).addCustomEditor({id:"lineStyle",path:"lineStyle",name:"Line style",category:m,showIf:b=>b.drawStyle===r.GR.Line,editor:f.F,override:f.F,process:s.hS,shouldApply:b=>b.type===o.PU.number}).addCustomEditor({id:"spanNulls",path:"spanNulls",name:"Connect null values",category:m,defaultValue:!1,editor:d.e,override:d.e,showIf:b=>b.drawStyle===r.GR.Line,shouldApply:b=>b.type!==o.PU.time,process:s.hS,settings:{isTime:E}}).addCustomEditor({id:"insertNulls",path:"insertNulls",name:"Disconnect values",category:m,defaultValue:!1,editor:l.Z,override:l.Z,showIf:b=>b.drawStyle===r.GR.Line,shouldApply:b=>b.type!==o.PU.time,process:s.hS,settings:{isTime:E}}).addRadio({path:"showPoints",name:"Show points",category:m,defaultValue:g.t.showPoints[0].value,settings:{options:g.t.showPoints},showIf:b=>b.drawStyle!==r.GR.Points}).addSliderInput({path:"pointSize",name:"Point size",category:m,defaultValue:5,settings:{min:1,max:40,step:1,ariaLabelForHandle:"Point size"},showIf:b=>b.showPoints!==r.yL.Never||b.drawStyle===r.GR.Points}),u.I(D,v.stacking,m),D.addSelect({category:m,name:"Transform",path:"transform",settings:{options:[{label:"Constant",value:r.NU.Constant,description:"The first value will be shown as a constant line"},{label:"Negative Y",value:r.NU.NegativeY,description:"Flip the results to negative values on the y axis"}],isClearable:!0},hideFromDefaults:!0}),c.r(D,v),i.e(D),D.addCustomEditor({id:"thresholdsStyle",path:"thresholdsStyle",name:"Show thresholds",category:["Thresholds"],defaultValue:{mode:r.Ly.Off},settings:{options:g.t.thresholdsDisplayModes},editor:h.D,override:h.D,process:s.hS,shouldApply:()=>!0})}}}},62567:(Q,A,e)=>{"use strict";e.d(A,{W:()=>K});var t=e(32196),n=e(96540),o=e(40961),s=e(84140),r=e(33948),g=e(52622),u=e(23596),c=e(24284),i=e(40845),l=e(37151),f=e(72724),d=e(42994),h=e(79041),p=e(41053),m=e(18348),a=e(66864),v=e(51253),E=e(88575),D=e(21744),b=e(16504),C=e(55852),y=e(99818),M=e(10154);const T=({annoVals:k,annoIdx:Y,dismiss:ee,timeFormatter:re,...J})=>{const ne=(0,i.of)(I),q=(0,h.d2)(),te=(0,n.useContext)(m.N);(0,n.useEffect)(()=>te.boostZIndex(),[te]);const[oe,ue]=(0,p.A)(async Re=>{const me=await q.onAnnotationCreate(Re);return ee(),me}),[ie,ge]=(0,p.A)(async Re=>{const me=await q.onAnnotationUpdate(Re);return ee(),me}),he=k.id?.[Y]!=null,De=k.isRegion?.[Y],pe=he?ge:ue,le=he?ie:oe,Te=De?`${re(k.time[Y])} - ${re(k.timeEnd[Y])}`:re(k.time[Y]),Ee=({tags:Re,description:me})=>{pe({id:k.id?.[Y]??void 0,tags:Re,description:me,from:Math.round(k.time[Y]),to:Math.round(k.timeEnd?.[Y]??k.time[Y])})};return n.createElement("div",{className:ne.editor,...J},n.createElement("div",{className:ne.header},n.createElement(a.Gy,{justify:"space-between",align:"center"},n.createElement("div",null,he?"Edit annotation":"Add annotation"),n.createElement("div",null,Te))),n.createElement(v.l,{onSubmit:Ee,defaultValues:{description:k.text?.[Y],tags:k.tags?.[Y]||[]}},({register:Re,errors:me,control:Me})=>n.createElement(n.Fragment,null,n.createElement("div",{className:ne.content},n.createElement(E.D,{label:"Description",invalid:!!me.description,error:me?.description?.message},n.createElement(D.f,{className:ne.textarea,...Re("description",{required:"Annotation description is required"})})),n.createElement(E.D,{label:"Tags"},n.createElement(b.e,{control:Me,name:"tags",render:({field:{ref:ye,onChange:Le,...We}})=>n.createElement(y.$,{allowCustomValue:!0,placeholder:"Add tags",onChange:Le,tagOptions:M.vy,tags:We.value})}))),n.createElement("div",{className:ne.footer},n.createElement(a.Gy,{justify:"flex-end"},n.createElement(C.$n,{size:"sm",variant:"secondary",onClick:ee,fill:"outline"},"Cancel"),n.createElement(C.$n,{size:"sm",type:"submit",disabled:le?.loading},le?.loading?"Saving":"Save"))))))},I=k=>({editor:(0,t.css)({background:k.colors.background.primary,border:`1px solid ${k.colors.border.weak}`,borderRadius:k.shape.radius.default,boxShadow:k.shadows.z3,userSelect:"text",width:"460px"}),content:(0,t.css)({padding:k.spacing(1)}),header:(0,t.css)({borderBottom:`1px solid ${k.colors.border.weak}`,padding:k.spacing(.5,1),fontWeight:k.typography.fontWeightBold,fontSize:k.typography.fontSize,color:k.colors.text.primary}),footer:(0,t.css)({borderTop:`1px solid ${k.colors.border.weak}`,padding:k.spacing(1,1)}),textarea:(0,t.css)({color:k.colors.text.secondary,fontSize:k.typography.bodySmall.fontSize})});var x=e(40672),S=e(29158),O=e(78369),P=e(55907);const L=({annoVals:k,annoIdx:Y,timeFormatter:ee,canEdit:re,canDelete:J,onEdit:ne,onDelete:q})=>{const te=(0,i.of)(U),oe=(0,n.useContext)(m.N);(0,n.useEffect)(()=>oe.boostZIndex(),[oe]);let ue=ee(k.time[Y]),ie=k.text[Y];k.isRegion?.[Y]&&(ue+=" - "+ee(k.timeEnd[Y]));let ge;k.login?.[Y]&&k.avatarUrl?.[Y]&&(ge=n.createElement("img",{className:te.avatar,alt:"Annotation avatar",src:k.avatarUrl[Y]}));let he=null,De="";if(k.alertId?.[Y]!==void 0&&k.newState?.[Y]){const pe=P.A.getStateDisplayModel(k.newState[Y]);he=n.createElement("div",{className:te.alertState},n.createElement("i",{className:pe.stateClass},pe.text))}else k.title?.[Y]&&(ie=k.title[Y]+"<br />"+(typeof ie=="string"?ie:""));return n.createElement("div",{className:te.wrapper},n.createElement("div",{className:te.header},n.createElement(a.Gy,{justify:"space-between",align:"center",spacing:"md"},n.createElement("div",{className:te.meta},n.createElement("span",null,ge,he),ue),(re||J)&&n.createElement("div",{className:te.editControls},re&&n.createElement(S.K,{name:"pen",size:"sm",onClick:ne,tooltip:"Edit"}),J&&n.createElement(S.K,{name:"trash-alt",size:"sm",onClick:q,tooltip:"Delete",disabled:!k.id?.[Y]})))),n.createElement("div",{className:te.body},ie&&n.createElement("div",{className:te.text,dangerouslySetInnerHTML:{__html:x.sQ.sanitize(ie)}}),De,n.createElement("div",null,n.createElement(a.Gy,{spacing:"xs",wrap:!0},k.tags?.[Y]?.map((pe,le)=>n.createElement(O.v,{name:pe,key:`${pe}-${le}`}))))))},U=k=>({wrapper:(0,t.css)({zIndex:k.zIndex.tooltip,whiteSpace:"initial",borderRadius:k.shape.radius.default,background:k.colors.background.primary,border:`1px solid ${k.colors.border.weak}`,boxShadow:k.shadows.z2,userSelect:"text"}),header:(0,t.css)({padding:k.spacing(.5,1),borderBottom:`1px solid ${k.colors.border.weak}`,fontWeight:k.typography.fontWeightBold,fontSize:k.typography.fontSize,color:k.colors.text.primary,display:"flex"}),meta:(0,t.css)({display:"flex",justifyContent:"space-between",color:k.colors.text.primary,fontWeight:400}),editControls:(0,t.css)({display:"flex",alignItems:"center","> :last-child":{marginLeft:0}}),body:(0,t.css)({padding:k.spacing(1),fontSize:k.typography.bodySmall.fontSize,color:k.colors.text.secondary,fontWeight:400,a:{color:k.colors.text.link,"&:hover":{textDecoration:"underline"}}}),text:(0,t.css)({paddingBottom:k.spacing(1)}),avatar:(0,t.css)({borderRadius:k.shape.radius.circle,width:16,height:16,marginRight:k.spacing(1)}),alertState:(0,t.css)({paddingRight:k.spacing(1),fontWeight:k.typography.fontWeightMedium})}),R=0,B=1,H=2,w=({annoVals:k,annoIdx:Y,className:ee,style:re,exitWipEdit:J,timezone:ne})=>{const{canEditAnnotations:q,canDeleteAnnotations:te,...oe}=(0,h.d2)(),ue=(0,i.of)(N),[ie,ge]=(0,n.useState)(R),he=(0,n.useRef)(null);(0,l.A)(he,()=>{ie===B&&pe(!1)});const De=n.createRef(),pe=(0,n.useCallback)(Me=>{ge(Me?B:R),!Me&&J!=null&&J()},[J]),le=(0,n.useCallback)(()=>{pe(!0)},[pe]),Te=(0,n.useCallback)(()=>{oe.onAnnotationDelete&&oe.onAnnotationDelete(k.id?.[Y])},[Y,k.id,oe]),Ee=(0,n.useCallback)(Me=>(0,f.LE)(Me,{format:d.WC.fullDate,timeZone:ne}),[ne]);(0,n.useLayoutEffect)(()=>{J!=null&&pe(!0)},[]);const Re=(0,n.useCallback)(()=>{let Me=k.dashboardUID?.[Y];return n.createElement(L,{timeFormatter:Ee,onEdit:le,onDelete:Te,canEdit:q?q(Me):!1,canDelete:te?te(Me):!1,annoIdx:Y,annoVals:k})},[Ee,le,Te,q,k,Y,te]),me=(0,n.useCallback)(()=>n.createElement(T,{dismiss:()=>pe(!1),timeFormatter:Ee,annoIdx:Y,annoVals:k}),[Y,k,Ee,pe]);return n.createElement("div",{ref:De,className:ee,style:re,onMouseEnter:()=>ie!==B&&ge(H),onMouseLeave:()=>ie!==B&&ge(R)},n.createElement("div",{className:ue.annoInfo,ref:he},ie===H&&Re(),ie===B&&me()))},N=k=>({annoInfo:(0,t.css)({background:k.colors.background.secondary,minWidth:"300px",position:"absolute",top:"5px",left:"50%",transform:"translateX(-50%)"})}),V=(k,Y,ee,re,J)=>{k.beginPath(),k.moveTo(re,Y),k.lineTo(re,ee),k.strokeStyle=J,k.stroke()},G=(0,s.A)(c.Mk).toHex8String();function _(k){let Y={};return k.fields.forEach(ee=>{Y[ee.name]=ee.values}),Y}const K=({annotations:k,timeZone:Y,config:ee,newRange:re,setNewRange:J,canvasRegionRendering:ne=!0})=>{const[q,te]=(0,n.useState)(),oe=(0,i.of)(j),ue=(0,i.$j)().visualization.getColorByName,[ie,ge]=(0,n.useReducer)(Ee=>Ee+1,0),he=(0,n.useMemo)(()=>{let Ee=k.filter(Re=>Re.name!=="exemplar"&&Re.length>0&&Re.fields.some(me=>me.name==="time"));if(re){let Re=re.to>re.from;const me=(0,r.I)([{time:re.from,timeEnd:Re?re.to:null,isRegion:Re,color:G}]);me.meta={dataTopic:g.QR.Annotations,custom:{isWip:!0}},Ee.push(me)}return Ee},[k,re]),De=(0,n.useCallback)(()=>{J(null)},[J]),pe=(0,n.useRef)(he);pe.current=he;const le=(0,n.useRef)(re);le.current=re;const Te=(0,n.useRef)();if((0,n.useLayoutEffect)(()=>{ee.addHook("ready",Ee=>{let Re=Ee.root.querySelector(".u-axis");Te.current=Re,te(Ee)}),ee.addHook("draw",Ee=>{let Re=pe.current;const me=Ee.ctx;let Me=Ee.bbox.top,ye=Me+Ee.bbox.height;me.save(),me.beginPath(),me.rect(Ee.bbox.left,Ee.bbox.top,Ee.bbox.width,Ee.bbox.height),me.clip(),me.lineWidth=2,me.setLineDash([5,5]),Re.forEach(Le=>{let We=_(Le);for(let Be=0;Be<We.time.length;Be++){let Ye=ue(We.color?.[Be]||G),at=Ee.valToPos(We.time[Be],"x",!0);if(!We.isRegion?.[Be])V(me,Me,ye,at,Ye);else if(ne){V(me,Me,ye,at,Ye);let st=Ee.valToPos(We.timeEnd[Be],"x",!0);V(me,Me,ye,st,Ye),me.fillStyle=u.alpha(Ye,.1),me.fillRect(at,Me,st-at,Ee.bbox.height)}}}),me.restore()})},[ee,ne,ue]),(0,n.useEffect)(()=>{q&&(q.redraw(),setTimeout(()=>{ge()},0))},[he,q]),q){let Ee=he.flatMap((Re,me)=>{let Me=_(Re),ye=[];for(let Le=0;Le<Me.time.length;Le++){let We=ue(Me.color?.[Le]||c.Mk),Be=q.valToPos(Me.time[Le],"x"),Ye=null,at="",st=!0;if(Me.isRegion?.[Le]){let Ke=q.valToPos(Me.timeEnd?.[Le],"x");if(st=Be<q.rect.width&&Ke>0,st){let Xe=Math.max(0,Be),He=Math.min(q.rect.width,Ke);Ye={left:Xe,background:We,width:He-Xe},at=oe.annoRegion}}else st=Be>0&&Be<=q.rect.width,st&&(Ye={left:Be,borderBottomColor:We},at=oe.annoMarker);if(st){let Ke=Re.meta?.custom?.isWip;ye.push(n.createElement(w,{annoIdx:Le,annoVals:Me,className:at,style:Ye,timezone:Y,key:`${me}:${Le}`,exitWipEdit:Ke?De:null}))}}return ye});return(0,o.createPortal)(Ee,Te.current)}return null},j=k=>({annoMarker:(0,t.css)({position:"absolute",width:0,height:0,borderLeft:"6px solid transparent",borderRight:"6px solid transparent",borderBottomWidth:"6px",borderBottomStyle:"solid",transform:"translateX(-50%)",cursor:"pointer",zIndex:1}),annoRegion:(0,t.css)({position:"absolute",height:"5px",cursor:"pointer",zIndex:1})})},99140:(Q,A,e)=>{"use strict";e.d(A,{Gu:()=>s,JD:()=>r,M_:()=>n,k3:()=>o});var t=e(48594);let n;function o(g){n=g}function s(){return!n||!n.getState?{templating:{...t.L1,lastKey:"key"}}:n.getState()}function r(g){if(!(!n||!n.getState))return n.dispatch(g)}},24897:(Q,A,e)=>{"use strict";e.d(A,{RG:()=>o,Vz:()=>s,XT:()=>t.X,Xe:()=>n});var t=e(62625),n=(r=>(r[r.Admin=4]="Admin",r[r.Editor=2]="Editor",r[r.Member=0]="Member",r[r.Viewer=1]="Viewer",r))(n||{}),o=(r=>(r.View="View",r.Edit="Edit",r.Admin="Admin",r))(o||{}),s=(r=>(r.Folder="dash-folder",r.Dashboard="dash-db",r.AlertFolder="dash-folder-alerting",r))(s||{})},50271:()=>{"use strict"},18625:()=>{"use strict"},14276:()=>{"use strict"},62543:()=>{"use strict"},28444:(Q,A,e)=>{"use strict";e.d(A,{Bt:()=>E,Cf:()=>d,Eu:()=>x,Io:()=>v,JI:()=>i,PR:()=>l,Ps:()=>y,Q$:()=>f,Rh:()=>b,S8:()=>T,U0:()=>m,VZ:()=>D,Vz:()=>C,XM:()=>p,Yn:()=>g,aP:()=>I,bG:()=>r,bY:()=>M,i0:()=>L,sL:()=>P,u4:()=>u,vk:()=>h,xL:()=>a,xc:()=>S,yj:()=>O,zq:()=>c});var t=e(89550),n=e(65463);const o=(0,t.R)("ds-request-response"),s=(0,t.R)("ds-request-error"),r=(0,t.R)("template-variable-value-updated"),g=(0,t.R)("graph-click"),u=(0,t.R)("threshold-changed");class c extends n.a{}c.type="panel-queries-changed";class i extends n.a{}i.type="panel-transformations-changed";class l extends n.a{}l.type="panels-options-changed";class f extends n.a{}f.type="dashboard-panels-changed";class d extends n.a{}d.type="dashboard-meta-changed";class h extends n.a{}h.type="panel-directive-ready";class p extends n.a{}p.type="render";class m extends n.x{}m.type="zoom-out";var a=(U=>(U[U.Left=-1]="Left",U[U.Right=1]="Right",U))(a||{});class v extends n.x{}v.type="shift-time";class E extends n.a{}E.type="copy-time";class D extends n.x{}D.type="paste-time";class b extends n.x{}b.type="absolute-time";class C extends n.x{}C.type="remove-panel";class y extends n.x{}y.type="show-modal";class M extends n.x{}M.type="show-confirm-modal";class T extends n.x{}T.type="show-react-modal";class I extends n.a{}I.type="hide-modal";class x extends n.a{}x.type="dashboard-saved";class S extends n.x{}S.type="annotation-query-started";class O extends n.x{}O.type="annotation-query-finished";class P extends n.x{}P.type="panel-edit-started";class L extends n.x{}L.type="panel-edit-finished"},76698:(Q,A,e)=>{"use strict";e.d(A,{IW:()=>t,aA:()=>o,jH:()=>s,sG:()=>n});var t=(r=>(r[r.CLOSE_PANE=0]="CLOSE_PANE",r[r.CHANGE_DATASOURCE=1]="CHANGE_DATASOURCE",r[r.CLOSE_EDITOR=2]="CLOSE_EDITOR",r))(t||{});const n=["lines","bars","points","stacked_lines","stacked_bars"];var o=(r=>(r.table="table",r.raw="raw",r))(o||{});const s=["table","raw"]},8904:()=>{"use strict"},80348:(Q,A,e)=>{"use strict";e.d(A,{AccessControlAction:()=>y,AppNotificationSeverity:()=>p,CORRELATION_EDITOR_POST_CONFIRM_ACTION:()=>v.IW,CoreEvents:()=>M,DashboardInitPhase:()=>r,DashboardRoutes:()=>s,EXPLORE_GRAPH_STYLES:()=>v.sG,KioskMode:()=>g,OrgRole:()=>u.XT,PermissionLevelString:()=>u.RG,SearchQueryType:()=>u.Vz,ServiceAccountStateFilter:()=>l,TABLE_RESULTS_STYLE:()=>v.aA,TeamPermissionLevel:()=>u.Xe,addListener:()=>E.ch,createAsyncThunk:()=>E.zD,timeoutMap:()=>a,useDispatch:()=>E.wA,useSelector:()=>E.d4});var t=e(50271),n=e(54034),o=e(8904),s=(T=>(T.Home="home-dashboard",T.New="new-dashboard",T.Normal="normal-dashboard",T.Path="path-dashboard",T.Scripted="scripted-dashboard",T.Public="public-dashboard",T.Embedded="embedded-dashboard",T))(s||{}),r=(T=>(T.NotStarted="Not started",T.Fetching="Fetching",T.Services="Services",T.Failed="Failed",T.Completed="Completed",T))(r||{}),g=(T=>(T.TV="tv",T.Full="full",T))(g||{}),u=e(24897),c=e(18625),i=e(64998),l=(T=>(T.All="All",T.WithExpiredTokens="WithExpiredTokens",T.External="External",T.Disabled="Disabled",T))(l||{}),f=e(62543),d=e(77237),h=e(75330),p=(T=>(T.Success="success",T.Warning="warning",T.Error="error",T.Info="info",T))(p||{}),m=(T=>(T[T.Success=3e3]="Success",T[T.Warning=5e3]="Warning",T[T.Error=7e3]="Error",T))(m||{});const a={success:3e3,warning:5e3,error:7e3,info:3e3};var v=e(76698),E=e(64756),D=e(13868),b=e(14276),C=e(90697),y=(T=>(T.UsersRead="users:read",T.UsersWrite="users:write",T.UsersAuthTokenList="users.authtoken:read",T.UsersAuthTokenUpdate="users.authtoken:write",T.UsersPasswordUpdate="users.password:write",T.UsersDelete="users:delete",T.UsersCreate="users:create",T.UsersEnable="users:enable",T.UsersDisable="users:disable",T.UsersPermissionsUpdate="users.permissions:write",T.UsersLogout="users:logout",T.UsersQuotasList="users.quotas:read",T.UsersQuotasUpdate="users.quotas:write",T.ServiceAccountsRead="serviceaccounts:read",T.ServiceAccountsCreate="serviceaccounts:create",T.ServiceAccountsWrite="serviceaccounts:write",T.ServiceAccountsDelete="serviceaccounts:delete",T.ServiceAccountsPermissionsRead="serviceaccounts.permissions:read",T.ServiceAccountsPermissionsWrite="serviceaccounts.permissions:write",T.OrgsRead="orgs:read",T.OrgsPreferencesRead="orgs.preferences:read",T.OrgsWrite="orgs:write",T.OrgsPreferencesWrite="orgs.preferences:write",T.OrgsCreate="orgs:create",T.OrgsDelete="orgs:delete",T.OrgUsersRead="org.users:read",T.OrgUsersAdd="org.users:add",T.OrgUsersRemove="org.users:remove",T.OrgUsersWrite="org.users:write",T.LDAPUsersRead="ldap.user:read",T.LDAPUsersSync="ldap.user:sync",T.LDAPStatusRead="ldap.status:read",T.DataSourcesExplore="datasources:explore",T.DataSourcesRead="datasources:read",T.DataSourcesCreate="datasources:create",T.DataSourcesWrite="datasources:write",T.DataSourcesDelete="datasources:delete",T.DataSourcesPermissionsRead="datasources.permissions:read",T.DataSourcesCachingRead="datasources.caching:read",T.DataSourcesInsightsRead="datasources.insights:read",T.ActionServerStatsRead="server.stats:read",T.ActionTeamsCreate="teams:create",T.ActionTeamsDelete="teams:delete",T.ActionTeamsRead="teams:read",T.ActionTeamsWrite="teams:write",T.ActionTeamsPermissionsRead="teams.permissions:read",T.ActionTeamsPermissionsWrite="teams.permissions:write",T.ActionRolesList="roles:read",T.ActionTeamsRolesList="teams.roles:read",T.ActionTeamsRolesAdd="teams.roles:add",T.ActionTeamsRolesRemove="teams.roles:remove",T.ActionUserRolesList="users.roles:read",T.ActionUserRolesAdd="users.roles:add",T.ActionUserRolesRemove="users.roles:remove",T.DashboardsRead="dashboards:read",T.DashboardsWrite="dashboards:write",T.DashboardsDelete="dashboards:delete",T.DashboardsCreate="dashboards:create",T.DashboardsPermissionsRead="dashboards.permissions:read",T.DashboardsPermissionsWrite="dashboards.permissions:write",T.DashboardsPublicWrite="dashboards.public:write",T.FoldersRead="folders:read",T.FoldersWrite="folders:write",T.FoldersDelete="folders:delete",T.FoldersCreate="folders:create",T.FoldersPermissionsRead="folders.permissions:read",T.FoldersPermissionsWrite="folders.permissions:write",T.ActionSupportBundlesCreate="support.bundles:create",T.ActionSupportBundlesRead="support.bundles:read",T.ActionSupportBundlesDelete="support.bundles:delete",T.AlertingRuleCreate="alert.rules:create",T.AlertingRuleRead="alert.rules:read",T.AlertingRuleUpdate="alert.rules:write",T.AlertingRuleDelete="alert.rules:delete",T.AlertingInstanceCreate="alert.instances:create",T.AlertingInstanceUpdate="alert.instances:write",T.AlertingInstanceRead="alert.instances:read",T.AlertingNotificationsRead="alert.notifications:read",T.AlertingNotificationsWrite="alert.notifications:write",T.AlertingRuleExternalWrite="alert.rules.external:write",T.AlertingRuleExternalRead="alert.rules.external:read",T.AlertingInstancesExternalWrite="alert.instances.external:write",T.AlertingInstancesExternalRead="alert.instances.external:read",T.AlertingNotificationsExternalWrite="alert.notifications.external:write",T.AlertingNotificationsExternalRead="alert.notifications.external:read",T.AlertingProvisioningReadSecrets="alert.provisioning.secrets:read",T.AlertingProvisioningRead="alert.provisioning:read",T.AlertingProvisioningWrite="alert.provisioning:write",T.ActionAPIKeysRead="apikeys:read",T.ActionAPIKeysCreate="apikeys:create",T.ActionAPIKeysDelete="apikeys:delete",T.PluginsInstall="plugins:install",T.PluginsWrite="plugins:write",T.SettingsRead="settings:read",T.SettingsWrite="settings:write",T))(y||{}),M=e(28444)},13868:()=>{"use strict"},54034:()=>{"use strict"},75330:()=>{"use strict"},77237:()=>{"use strict"},90697:()=>{"use strict"},64756:(Q,A,e)=>{"use strict";e.d(A,{ch:()=>g,d4:()=>s,wA:()=>o,zD:()=>r});var t=e(30038),n=e(69733);const o=n.useDispatch,s=n.useSelector,r=(u,c,i)=>(0,t.zD)(u,c,i),g=t.ch},38824:(Q,A,e)=>{"use strict";e.d(A,{m:()=>t});var t=(n=>(n.LineChart="Line chart",n.LineChartSmooth="Line chart smooth",n.LineChartGradientColorScheme="Line chart with gradient color scheme",n.AreaChart="Area chart",n.AreaChartStacked="Area chart stacked",n.AreaChartStackedPercent="Area chart 100% stacked",n.BarChart="Bar chart",n.BarChartGradientColorScheme="Bar chart with gradient color scheme",n.BarChartStacked="Bar chart stacked",n.BarChartStackedPercent="Bar chart 100% stacked",n.BarChartHorizontal="Bar chart horizontal",n.BarChartHorizontalStacked="Bar chart horizontal stacked",n.BarChartHorizontalStackedPercent="Bar chart horizontal 100% stacked",n.Candlestick="Candlestick",n.PieChart="Pie chart",n.PieChartDonut="Pie chart donut",n.Stat="Stat",n.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||{})},94822:(Q,A,e)=>{"use strict";e.d(A,{Gi:()=>n,JS:()=>u,N1:()=>c,Q8:()=>i,Si:()=>o,cF:()=>t,lh:()=>g,s1:()=>s});var t=(l=>(l.Firing="firing",l.Inactive="inactive",l.Pending="pending",l))(t||{}),n=(l=>(l.Normal="Normal",l.Alerting="Alerting",l.Pending="Pending",l.NoData="NoData",l.Error="Error",l))(n||{});function o(l){return Object.values(t).includes(l)}function s(l){return Object.values(n).some(f=>f===l)}function r(l){const f=Object.values(t);return l!=null&&!f.includes(l)}function g(l){return r(l)?l.split(" ")[0]:l}var u=(l=>(l.Alerting="alerting",l.Recording="recording",l))(u||{}),c=(l=>(l.Cortex="Cortex",l.Mimir="Mimir",l.Prometheus="Prometheus",l.Thanos="Thanos",l))(c||{}),i=(l=>(l.Alerting="Alerting",l.NoData="NoData",l.KeepLast="KeepLast",l.OK="OK",l.Error="Error",l))(i||{})},54317:(Q,A,e)=>{"use strict";e.d(A,{$:()=>s,S:()=>n});var t=e(94822);function n(r,g){return(0,t.lh)(r.state)===g}var o=(r=>(r.Firing="firing",r))(o||{}),s=(r=>(r.Alerting="alerting",r.Pending="pending",r.Normal="inactive",r.NoData="nodata",r.Error="error",r))(s||{})},64998:()=>{"use strict"},72834:Q=>{const A=" ";function e(s){let r="";return s&&Object.keys(s).forEach(function(g){r+=g+":"+s[g]+";"}),r}function t(s){function r(u){return'class="'+u+'"'}function g(u){return'style="'+e(s["."+u])+'"'}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 o(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}Q.exports=function(s,r){let g="";const u=t(r);let c=function(l,f,d,h){if(!l.length)return f+" "+d;let p=f+` `;return g+=A,l.forEach(function(m,a){p+=g+h(m)+(a<l.length-1?",":"")+` `}),g=g.slice(0,-A.length),p+g+d};function i(l){if(l===void 0)return"";switch(n(l)){case"boolean":return"<span "+u("json-markup-bool")+">"+l+"</span>";case"number":return"<span "+u("json-markup-number")+">"+l+"</span>";case"date":return'<span class="json-markup-string">"'+o(l.toISOString())+'"</span>';case"null":return"<span "+u("json-markup-null")+">null</span>";case"string":return"<span "+u("json-markup-string")+'>"'+o(l.replace(/\n/g,` `+g))+'"</span>';case"link":return"<span "+u("json-markup-string")+'>"<a href="'+encodeURI(l)+'">'+o(l)+'</a>"</span>';case"array":return c(l,"[","]",i);case"object":const f=Object.keys(l).filter(function(d){return l[d]!==void 0});return c(f,"{","}",function(d){return"<span "+u("json-markup-key")+'>"'+o(d)+'":</span> '+i(l[d])})}return""}return"<div "+u("json-markup")+">"+i(s)+"</div>"}},13609:()=>{(function(Q){"use strict";Q(function(){Q.support.transition=function(){var A=function(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},n;for(n in t)if(e.style[n]!==void 0)return t[n]}();return A&&{end:A}}()})})(window.jQuery),function(Q){"use strict";var A="[data-toggle=dropdown]",e=function(s){var r=Q(s).on("click.dropdown.data-api",this.toggle);Q("html").on("click.dropdown.data-api",function(){r.parent().removeClass("open")})};e.prototype={constructor:e,toggle:function(s){var r=Q(this),g,u;if(!r.is(".disabled, :disabled"))return g=n(r),u=g.hasClass("open"),t(),u||("ontouchstart"in document.documentElement&&Q('<div class="dropdown-backdrop"/>').insertBefore(Q(this)).on("click",t),g.toggleClass("open")),r.focus(),!1},keydown:function(s){var r,g,u,c,i,l;if(/(38|40|27)/.test(s.keyCode)&&(r=Q(this),s.preventDefault(),s.stopPropagation(),!r.is(".disabled, :disabled"))){if(c=n(r),i=c.hasClass("open"),!i||i&&s.keyCode==27)return s.which==27&&c.find(A).focus(),r.click();g=Q("[role=menu] li:not(.divider):visible a",c),g.length&&(l=g.index(g.filter(":focus")),s.keyCode==38&&l>0&&l--,s.keyCode==40&&l<g.length-1&&l++,~l||(l=0),g.eq(l).focus())}}};function t(){Q(".dropdown-backdrop").remove(),Q(A).each(function(){n(Q(this)).removeClass("open")})}function n(s){var r=s.attr("data-target"),g;return r||(r=s.attr("href"),r=r&&/#[A-Za-z]/.test(r)&&r.replace(/.*(?=#[^\s]*$)/,"")),g=r&&Q.find(r),(!g||!g.length)&&(g=s.parent()),g}var o=Q.fn.dropdown;Q.fn.dropdown=function(s){return this.each(function(){var r=Q(this),g=r.data("dropdown");g||r.data("dropdown",g=new e(this)),typeof s=="string"&&g[s].call(r)})},Q.fn.dropdown.Constructor=e,Q.fn.dropdown.noConflict=function(){return Q.fn.dropdown=o,this},Q(document).on("click.dropdown.data-api",t).on("click.dropdown.data-api",".dropdown form",function(s){s.stopPropagation()}).on("click.dropdown.data-api",A,e.prototype.toggle).on("keydown.dropdown.data-api",A+", [role=menu]",e.prototype.keydown)}(window.jQuery),function(Q){"use strict";var A=function(t,n){this.options=n,this.$element=Q(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",Q.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};A.prototype={constructor:A,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=Q.Event("show");this.$element.trigger(n),!(this.isShown||n.isDefaultPrevented())&&(this.isShown=!0,this.escape(),this.backdrop(function(){var o=Q.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),o&&t.$element[0].offsetWidth,t.$element.addClass("in").attr("aria-hidden",!1),t.enforceFocus(),o?t.$element.one(Q.support.transition.end,function(){t.$element.focus().trigger("shown")}):t.$element.focus().trigger("shown")}))},hide:function(t){t&&t.preventDefault();var n=this;t=Q.Event("hide"),this.$element.trigger(t),!(!this.isShown||t.isDefaultPrevented())&&(this.isShown=!1,this.escape(),Q(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),Q.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal())},enforceFocus:function(){var t=this;Q(document).on("focusin.modal",function(n){t.$element[0]!==n.target&&!t.$element.has(n.target).length&&t.$element.focus()})},escape:function(){var t=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(n){n.which==27&&t.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var t=this,n=setTimeout(function(){t.$element.off(Q.support.transition.end),t.hideModal()},500);this.$element.one(Q.support.transition.end,function(){clearTimeout(n),t.hideModal()})},hideModal:function(){var t=this;this.$element.hide(),this.backdrop(function(){t.removeBackdrop(),t.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(t){var n=this,o=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var s=Q.support.transition&&o;if(this.$backdrop=Q('<div class="modal-backdrop '+o+'" />').appendTo(document.body),this.$backdrop.click(this.options.backdrop=="static"?Q.proxy(this.$element[0].focus,this.$element[0]):Q.proxy(this.hide,this)),s&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;s?this.$backdrop.one(Q.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),Q.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(Q.support.transition.end,t):t()):t&&t()}};var e=Q.fn.modal;Q.fn.modal=function(t){return this.each(function(){var n=Q(this),o=n.data("modal"),s=Q.extend({},Q.fn.modal.defaults,n.data(),typeof t=="object"&&t);o||n.data("modal",o=new A(this,s)),typeof t=="string"?o[t]():s.show&&o.show()})},Q.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},Q.fn.modal.Constructor=A,Q.fn.modal.noConflict=function(){return Q.fn.modal=e,this},Q(document).on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=Q(this),o=n.attr("href"),s=Q.find(n.attr("data-target")||o&&o.replace(/.*(?=#[^\s]+$)/,"")),r=s.data("modal")?"toggle":Q.extend({remote:!/#/.test(o)&&o},s.data(),n.data());t.preventDefault(),s.modal(r).one("hide",function(){n.focus()})})}(window.jQuery),function(Q){"use strict";var A=function(t,n){this.init("tooltip",t,n)};A.prototype={constructor:A,init:function(t,n,o){var s,r,g,u,c;for(this.type=t,this.$element=Q(n),this.options=this.getOptions(o),this.enabled=!0,g=this.options.trigger.split(" "),c=g.length;c--;)u=g[c],u=="click"?this.$element.on("click."+this.type,this.options.selector,Q.proxy(this.toggle,this)):u!="manual"&&(s=u=="hover"?"mouseenter":"focus",r=u=="hover"?"mouseleave":"blur",this.$element.on(s+"."+this.type,this.options.selector,Q.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,Q.proxy(this.leave,this)));this.options.selector?this._options=Q.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=Q.extend({},Q.fn[this.type].defaults,this.$element.data(),t),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var n=Q.fn[this.type].defaults,o={},s;if(this._options&&Q.each(this._options,function(r,g){n[r]!=g&&(o[r]=g)},this),s=Q(t.currentTarget)[this.type](o).data(this.type),!s.options.delay||!s.options.delay.show)return s.show();clearTimeout(this.timeout),s.hoverState="in",this.timeout=setTimeout(function(){s.hoverState=="in"&&s.show()},s.options.delay.show)},leave:function(t){var n=Q(t.currentTarget)[this.type](this._options).data(this.type);if(this.timeout&&clearTimeout(this.timeout),!n.options.delay||!n.options.delay.hide)return n.hide();n.hoverState="out",this.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},show:function(){var t,n,o,s,r,g,u=Q.Event("show");if(this.hasContent()&&this.enabled){if(this.$element.trigger(u),u.isDefaultPrevented())return;switch(t=this.tip(),this.setContent(),this.options.animation&&t.addClass("fade"),r=typeof this.options.placement=="function"?this.options.placement.call(this,t[0],this.$element[0]):this.options.placement,t.detach().css({top:0,left:0,display:"block"}),this.options.container?t.appendTo(Q.find(this.options.container)):t.insertAfter(this.$element),n=this.getPosition(),o=t[0].offsetWidth,s=t[0].offsetHeight,r){case"bottom":g={top:n.top+n.height,left:n.left+n.width/2-o/2};break;case"top":g={top:n.top-s,left:n.left+n.width/2-o/2};break;case"left":g={top:n.top+n.height/2-s/2,left:n.left-o};break;case"right":g={top:n.top+n.height/2-s/2,left:n.left+n.width};break;case"topLeft":g={top:n.top-s,left:n.left+n.width/2-o*.1};break;case"topRight":g={top:n.top-s,left:n.left+n.width/2-o*.9};break;case"rightTop":g={top:n.top+n.height/2-s*.1,left:n.left+n.width};break;case"rightBottom":g={top:n.top+n.height/2-s*.9,left:n.left+n.width};break;case"bottomLeft":g={top:n.top+n.height,left:n.left+n.width/2-o*.1};break;case"bottomRight":g={top:n.top+n.height,left:n.left+n.width/2-o*.9};break;case"leftTop":g={top:n.top+n.height/2-s*.1,left:n.left-o};break;case"leftBottom":g={top:n.top+n.height/2-s*.9,left:n.left-o};break}this.applyPlacement(g,r),this.$element.trigger("shown")}},applyPlacement:function(t,n){var o=this.tip(),s=o[0].offsetWidth,r=o[0].offsetHeight,g,u,c,i;o.offset(t).addClass(n).addClass("in"),g=o[0].offsetWidth,u=o[0].offsetHeight,n=="top"&&u!=r&&(t.top=t.top+r-u,i=!0),n=="bottom"||n=="top"?(c=0,t.left<0&&(c=t.left*-2,t.left=0,o.offset(t),g=o[0].offsetWidth,u=o[0].offsetHeight),this.replaceArrow(c-s+g,g,"left")):this.replaceArrow(u-r,u,"top"),i&&o.offset(t)},replaceArrow:function(t,n,o){this.arrow().css(o,t?50*(1-t/n)+"%":"")},setContent:function(){var t=this.tip(),n=this.getTitle();t.find(".tooltip-inner").text(n),t.removeClass("fade in top bottom left right")},hide:function(){var t=this,n=this.tip(),o=Q.Event("hide");if(this.$element.trigger(o),o.isDefaultPrevented())return;n.removeClass("in");function s(){var r=setTimeout(function(){n.off(Q.support.transition.end).detach()},500);n.one(Q.support.transition.end,function(){clearTimeout(r),n.detach()})}return Q.support.transition&&this.$tip.hasClass("fade")?s():n.detach(),this.$element.trigger("hidden"),this},fixTitle:function(){var t=this.$element;(t.attr("title")||typeof t.attr("data-original-title")!="string")&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var t=this.$element[0];return Q.extend({},typeof t.getBoundingClientRect=="function"?t.getBoundingClientRect():{width:t.offsetWidth,height:t.offsetHeight},this.$element.offset())},getTitle:function(){var t,n=this.$element,o=this.options;return t=n.attr("data-original-title")||(typeof o.title=="function"?o.title.call(n[0]):o.title),t},tip:function(){return this.$tip=this.$tip||Q(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(t){var n=t?Q(t.currentTarget)[this.type](this._options).data(this.type):this;n.tip().hasClass("in")?n.hide():n.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var e=Q.fn.tooltip;Q.fn.tooltip=function(t){return this.each(function(){var n=Q(this),o=n.data("tooltip"),s=typeof t=="object"&&t;o||n.data("tooltip",o=new A(this,s)),typeof t=="string"&&o[t]()})},Q.fn.tooltip.Constructor=A,Q.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},Q.fn.tooltip.noConflict=function(){return Q.fn.tooltip=e,this}}(window.jQuery),function(Q){"use strict";var A=function(t){this.element=Q(t)};A.prototype={constructor:A,show:function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),o=t.attr("data-target"),s,r,g;o||(o=t.attr("href"),o=o&&o.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")&&(s=n.find(".active:last a")[0],g=Q.Event("show",{relatedTarget:s}),t.trigger(g),!g.isDefaultPrevented()&&(r=Q.find(o),this.activate(t.parent("li"),n),this.activate(r,r.parent(),function(){t.trigger({type:"shown",relatedTarget:s})})))},activate:function(t,n,o){var s=n.find("> .active"),r=o&&Q.support.transition&&s.hasClass("fade");function g(){s.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),r?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),o&&o()}r?s.one(Q.support.transition.end,g):g(),s.removeClass("in")}};var e=Q.fn.tab;Q.fn.tab=function(t){return this.each(function(){var n=Q(this),o=n.data("tab");o||n.data("tab",o=new A(this)),typeof t=="string"&&o[t]()})},Q.fn.tab.Constructor=A,Q.fn.tab.noConflict=function(){return Q.fn.tab=e,this},Q(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),Q(this).tab("show")})}(window.jQuery),function(Q){"use strict";var A=function(t,n){this.$element=Q(t),this.options=Q.extend({},Q.fn.typeahead.defaults,n),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=Q(this.options.menu),this.shown=!1,this.listen()};A.prototype={constructor:A,select:function(){var t=this.$menu.find(".active").attr("data-value")||this.$element.val();return this.$element.val(this.updater(t)).change(),this.hide()},updater:function(t){return t},show:function(){var t=Q.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:t.top+t.height,left:t.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(t){var n;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(n=Q.isFunction(this.source)?this.source(this.query,Q.proxy(this.process,this)):this.source,n?this.process(n):this)},process:function(t){var n=this;return t=Q.grep(t,function(o){return n.matcher(o)}),t=this.sorter(t),t.length?this.render(t.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(t){return~t.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(t){for(var n=[],o=[],s=[],r;r=t.shift();)r.toLowerCase().indexOf(this.query.toLowerCase())?~r.indexOf(this.query)?o.push(r):s.push(r):n.push(r);return n.concat(o,s)},highlighter:function(t){var n=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return n?t.replace(new RegExp("("+n+")","ig"),function(o,s){return"<strong>"+s+"</strong>"}):t},render:function(t){var n=this;return t=Q(t).map(function(o,s){return o=Q(n.options.item).attr("data-value",s),o.find("a").html(n.highlighter(s)),o[0]}),this.$menu.html(t),this},next:function(t){var n=this.$menu.find(".active").removeClass("active"),o=n.next();o.length||(o=Q(this.$menu.find("li")[0])),o.addClass("active")},prev:function(t){var n=this.$menu.find(".active").removeClass("active"),o=n.prev();o.length||(o=this.$menu.find("li").last()),o.addClass("active")},listen:function(){this.$element.on("focus",Q.proxy(this.focus,this)).on("blur",Q.proxy(this.blur,this)).on("keypress",Q.proxy(this.keypress,this)).on("keyup",Q.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",Q.proxy(this.keydown,this)),this.$menu.on("click",Q.proxy(this.click,this)).on("mouseenter","li",Q.proxy(this.mouseenter,this)).on("mouseleave","li",Q.proxy(this.mouseleave,this))},destroy:function(){this.$element.off().removeData("typeahead"),this.$menu.off()},eventSupported:function(t){var n=t in this.$element;return n||(this.$element.setAttribute(t,"return;"),n=typeof this.$element[t]=="function"),n},move:function(t){if(this.shown&&!(t.shiftKey&&t.keyCode===40)){switch(t.keyCode){case 9:case 13:case 27:t.preventDefault();break;case 38:t.preventDefault(),this.prev();break;case 40:t.preventDefault(),this.next();break}t.stopPropagation()}},keydown:function(t){this.suppressKeyPressRepeat=~Q.inArray(t.keyCode,[40,38,9,13,27,57]),this.move(t)},keypress:function(t){this.suppressKeyPressRepeat||this.move(t)},keyup:function(t){switch(t.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}t.keyCode===13&&typeof this.$menu.find(".active").attr("data-value")>"u"?this.$element.submit():(t.stopPropagation(),t.preventDefault())},focus:function(t){this.focused=!0},blur:function(t){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(t){t.stopPropagation(),t.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(t){this.mousedover=!0,this.$menu.find(".active").removeClass("active"),Q(t.currentTarget).addClass("active")},mouseleave:function(t){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var e=Q.fn.typeahead;Q.fn.typeahead=function(t){return this.each(function(){var n=Q(this),o=n.data("typeahead"),s=typeof t=="object"&&t;o||n.data("typeahead",o=new A(this,s)),typeof t=="string"&&o[t]()})},Q.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},Q.fn.typeahead.Constructor=A,Q.fn.typeahead.noConflict=function(){return Q.fn.typeahead=e,this},Q(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(t){var n=Q(this);n.data("typeahead")||n.typeahead(n.data())})}(window.jQuery),function(Q){"use strict";var A=function(t,n){this.options=Q.extend({},Q.fn.affix.defaults,n),this.$window=Q(window).on("scroll.affix.data-api",Q.proxy(this.checkPosition,this)).on("click.affix.data-api",Q.proxy(function(){setTimeout(Q.proxy(this.checkPosition,this),1)},this)),this.$element=Q(t),this.checkPosition()};A.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=Q(document).height(),n=this.$window.scrollTop(),o=this.$element.offset(),s=this.options.offset,r=s.bottom,g=s.top,u="affix affix-top affix-bottom",c;typeof s!="object"&&(r=g=s),typeof g=="function"&&(g=s.top()),typeof r=="function"&&(r=s.bottom()),c=this.unpin!=null&&n+this.unpin<=o.top?!1:r!=null&&o.top+this.$element.height()>=t-r?"bottom":g!=null&&n<=g?"top":!1,this.affixed!==c&&(this.affixed=c,this.unpin=c=="bottom"?o.top-n:null,this.$element.removeClass(u).addClass("affix"+(c?"-"+c:"")))}};var e=Q.fn.affix;Q.fn.affix=function(t){return this.each(function(){var n=Q(this),o=n.data("affix"),s=typeof t=="object"&&t;o||n.data("affix",o=new A(this,s)),typeof t=="string"&&o[t]()})},Q.fn.affix.Constructor=A,Q.fn.affix.defaults={offset:0},Q.fn.affix.noConflict=function(){return Q.fn.affix=e,this},Q(window).on("load",function(){Q('[data-spy="affix"]').each(function(){var t=Q(this),n=t.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),t.affix(n)})})}(window.jQuery)},82013:()=>{(function(Q){var A={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 u=t.p2c(g);n.x=Math.max(0,Math.min(u.left,t.width())),n.y=Math.max(0,Math.min(u.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 o(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(o),g.mousemove(s))}),t.hooks.drawOverlay.push(function(r,g){var u=r.getOptions().crosshair;if(u.mode){var c=r.getPlotOffset();if(g.save(),g.translate(c.left,c.top),n.x!=-1){var i=r.getOptions().crosshair.lineWidth%2?.5:0;if(g.strokeStyle=u.color,g.lineWidth=u.lineWidth,g.lineJoin="round",g.beginPath(),u.mode.indexOf("x")!=-1){var l=Math.floor(n.x)+i;g.moveTo(l,0),g.lineTo(l,r.height())}if(u.mode.indexOf("y")!=-1){var f=Math.floor(n.y)+i;g.moveTo(0,f),g.lineTo(r.width(),f)}g.stroke()}g.restore()}}),t.hooks.shutdown.push(function(r,g){g.unbind("mouseout",o),g.unbind("mousemove",s)})}Q.plot.plugins.push({init:e,options:A,name:"crosshair",version:"1.0"})})(jQuery)},2341:()=>{(function(Q){function A(e){e.hooks.processDatapoints.push(function(t,n,o){n.dashes.show&&t.hooks.draw.push(function(s,r){var g=s.getPlotOffset(),u=n.xaxis,c=n.yaxis;function i(h,p){var m=o.points,a=o.pointsize,v=null,E=null,D=0,b=!0,C,y;n.dashes.dashLength[0]?(C=n.dashes.dashLength[0],n.dashes.dashLength[1]?y=n.dashes.dashLength[1]:y=C):y=C=n.dashes.dashLength,r.beginPath();for(var M=a;M<m.length;M+=a){let H=function(w){var N=Math.sqrt(Math.pow(L-O,2)+Math.pow(U-P,2));if(N<=w)return{deltaX:L-O,deltaY:U-P,distance:N,remainder:w-N};var V=L>O?1:-1,G=U>P?1:-1;return{deltaX:V*Math.sqrt(Math.pow(w,2)/(1+Math.pow((U-P)/(L-O),2))),deltaY:G*Math.sqrt(Math.pow(w,2)-Math.pow(w,2)/(1+Math.pow((U-P)/(L-O),2))),distance:w,remainder:0}};var B=H,T=m[M-a],I=m[M-a+1],x=m[M],S=m[M+1];if(!(T==null||x==null)){if(I<=S&&I<c.min){if(S<c.min)continue;T=(c.min-I)/(S-I)*(x-T)+T,I=c.min}else if(S<=I&&S<c.min){if(I<c.min)continue;x=(c.min-I)/(S-I)*(x-T)+T,S=c.min}if(I>=S&&I>c.max){if(S>c.max)continue;T=(c.max-I)/(S-I)*(x-T)+T,I=c.max}else if(S>=I&&S>c.max){if(I>c.max)continue;x=(c.max-I)/(S-I)*(x-T)+T,S=c.max}if(T<=x&&T<u.min){if(x<u.min)continue;I=(u.min-T)/(x-T)*(S-I)+I,T=u.min}else if(x<=T&&x<u.min){if(T<u.min)continue;S=(u.min-T)/(x-T)*(S-I)+I,x=u.min}if(T>=x&&T>u.max){if(x>u.max)continue;I=(u.max-T)/(x-T)*(S-I)+I,T=u.max}else if(x>=T&&x>u.max){if(T>u.max)continue;S=(u.max-T)/(x-T)*(S-I)+I,x=u.max}(T!=v||I!=E)&&r.moveTo(u.p2c(T)+h,c.p2c(I)+p);var O=u.p2c(T)+h,P=c.p2c(I)+p,L=u.p2c(x)+h,U=c.p2c(S)+p,R;do R=H(D>0?D:b?C:y),(R.deltaX!=0||R.deltaY!=0)&&(b?r.lineTo(O+R.deltaX,P+R.deltaY):r.moveTo(O+R.deltaX,P+R.deltaY)),b=!b,D=R.remainder,O+=R.deltaX,P+=R.deltaY;while(R.distance>0);v=x,E=S}}r.stroke()}r.save(),r.translate(g.left,g.top),r.lineJoin="round";var l=n.dashes.lineWidth,f=n.shadowSize;if(l>0&&f>0){r.lineWidth=f,r.strokeStyle="rgba(0,0,0,0.1)";var d=Math.PI/18;i(Math.sin(d)*(l/2+f/2),Math.cos(d)*(l/2+f/2)),r.lineWidth=f/2,i(Math.sin(d)*(l/2+f/4),Math.cos(d)*(l/2+f/4))}r.lineWidth=l,r.strokeStyle=n.color,l>0&&i(0,0),r.restore()})})}Q.plot.plugins.push({init:A,options:{series:{dashes:{show:!1,lineWidth:2,dashLength:10}}},name:"dashes",version:"0.1"})})(jQuery)},92275:()=>{(function(Q){"use strict";var A={series:{fillBelowTo:null}};function e(t){function n(r,g){var u;for(u=0;u<g.length;++u)if(g[u].id===r.fillBelowTo)return g[u];return null}function o(r,g,u,c,i,l,f,d){var h,p,m,a,v,E;return h=u-r,p=c-g,m=f-i,a=d-l,v=(-p*(r-i)+h*(g-l))/(-m*p+h*a),E=(m*(g-l)-a*(r-i))/(-m*p+h*a),v>=0&&v<=1&&E>=0&&E<=1?[r+E*h,g+E*p]:null}function s(r,g,u){if(u.fillBelowTo===null)return;var c,i,l,f,d,h,p;function m(y,M){g.beginPath(),g.moveTo(u.xaxis.p2c(y)+h.left,u.yaxis.p2c(M)+h.top)}function a(){g.closePath(),g.fill()}function v(){if(l.length/i!==d.length/f)return console.error("Refusing to graph inconsistent number of points"),!1;var y;for(y=0;y<l.length/i;y++)if(l[y*i]!==null&&d[y*f]!==null&&l[y*i]!==d[y*f])return console.error("Refusing to graph points without matching value"),!1;return!0}function E(y,M){console.assert(M>y,"expects the end index to be greater than the start index");var T=y===0||l[y-1]===null||d[y-1]===null,I=!1,x,S;for(x=y;x<M;x++)if(l[x*i+1]===null||d[x*i+1]===null)I=!1,T=!0;else if(l[x*i+1]===d[x*f+1])I=!0,T=!1;else if(l[x*i+1]>d[x*f+1]){T?m(l[x*i],l[x*i+1]):I?m(l[(x-1)*i],l[(x-1)*i+1]):(S=D(x),m(S[0],S[1])),C(x,M);return}else T=!1,I=!1}function D(y){console.assert(y>0,"expects the second point in the series line segment");var M,T;for(M=1;M<d.length/f;M++)if(T=o(l[(y-1)*i],l[(y-1)*i+1],l[y*i],l[y*i+1],d[(M-1)*f],d[(M-1)*f+1],d[M*f],d[M*f+1]),T!==null)return T;console.error("intersectionPoint() should only be called when an intersection happens")}function b(y,M){console.assert(y>=M,"the start should be the rightmost point, and the end should be the leftmost (excluding the equal or intersecting point)");var T;for(T=y;T>=M;T--)g.lineTo(c.xaxis.p2c(d[T*f])+h.left,c.yaxis.p2c(d[T*f+1])+h.top);a()}function C(y,M){console.assert(y<=M,"the start should be the rightmost point, and the end should be the leftmost (excluding the equal or intersecting point)");var T,I;for(T=y;T<M;T++)if(l[T*i+1]===null&&T>y){b(T-1,y),E(T,M);return}else if(l[T*i+1]===d[T*f+1]){b(T,y),E(T,M);return}else if(l[T*i+1]<d[T*f+1]){I=D(T),g.lineTo(u.xaxis.p2c(I[0])+h.left,u.yaxis.p2c(I[1])+h.top),b(T,y),E(T,M);return}else g.lineTo(u.xaxis.p2c(l[T*i])+h.left,u.yaxis.p2c(l[T*i+1])+h.top);b(M,y)}c=n(u,r.getData()),c&&(i=u.datapoints.pointsize,l=u.datapoints.points,f=c.datapoints.pointsize,d=c.datapoints.points,h=r.getPlotOffset(),v()&&(p=Q.color.parse(u.color),p.a=.4,p.normalize(),g.fillStyle=p.toString(),E(0,l.length/i)))}t.hooks.drawSeries.push(s)}Q.plot.plugins.push({init:e,options:A,name:"fillbelow",version:"0.1.0"})})(jQuery)},19538:()=>{/*! * jquery.flot.gauge v1.1.0 * * * Flot plugin for rendering gauge charts. * * Copyright (c) 2015 @toyoty99. * Licensed under the MIT license. */(function(Q){var A=function(){var u,c,i,l,f,d,h=function(y,M){u=M,c=y.getPlaceholder(),i=y.getOptions(),l=i.series.gauges,f=y.getData(),d=e(l.debug)};h.prototype.calculateLayout=function(){var y=c.width(),M=c.height(),T=Math.min(f.length,l.layout.columns),I=Math.ceil(f.length/T),x=l.layout.margin,S=l.layout.hMargin,O=l.layout.vMargin,P=(y-x*2-S*(T-1))/T,L=(M-x*2-O*(I-1))/I;if(l.layout.square){var U=Math.min(P,L);P=U,L=U}p(l,P);var R=l.cell.margin,B=0,H=0;l.label.show&&(B=l.label.margin,H=l.label.font.size);var w=0,N=0;l.value.show&&(w=l.value.margin,N=l.value.font.size);var V=0;l.threshold.show&&(V=l.threshold.width);var G=0,_=0;l.threshold.label.show&&(G=l.threshold.label.margin,_=l.threshold.label.font.size);for(var K=P/2-R-V-G*2-_,j=l.gauge.startAngle,k=l.gauge.endAngle,Y=(k-j)/100,ee=-1,re=j;re<k;re+=Y)ee=Math.max(ee,Math.sin(o(re)));ee=Math.max(ee,Math.sin(o(k)));var J=(L-R*2-B*2-H)/(1+ee);J*ee<w+N/2&&(J=L-R*2-B*2-H-w-N/2);var ne=J-G*2-_-V,q=Math.min(K,ne),te=l.gauge.width;te>=q&&(te=Math.max(3,q/3));var oe=G*2+_+V+q,ue=Math.max(oe*(1+ee),oe+w+N/2);return{canvasWidth:y,canvasHeight:M,margin:x,hMargin:S,vMargin:O,columns:T,rows:I,cellWidth:P,cellHeight:L,cellMargin:R,labelMargin:B,labelFontSize:H,valueMargin:w,valueFontSize:N,width:te,radius:q,thresholdWidth:V,thresholdLabelMargin:G,thresholdLabelFontSize:_,gaugeOuterHeight:ue}};function p(y,M){y.gauge.width==="auto"&&(y.gauge.width=Math.max(5,M/8)),y.label.margin==="auto"&&(y.label.margin=Math.max(1,M/20)),y.label.font.size==="auto"&&(y.label.font.size=Math.max(5,M/8)),y.value.margin==="auto"&&(y.value.margin=Math.max(1,M/30)),y.value.font.size==="auto"&&(y.value.font.size=Math.max(5,M/9)),y.threshold.width==="auto"&&(y.threshold.width=Math.max(3,M/100)),y.threshold.label.margin==="auto"&&(y.threshold.label.margin=Math.max(3,M/40)),y.threshold.label.font.size==="auto"&&(y.threshold.label.font.size=Math.max(5,M/15))}h.prototype.calculateAutoValues=p,h.prototype.calculateCellLayout=function(y,M,T){var I=t(M.columns,T),x=n(M.columns,T),S=M.margin+(M.cellWidth+M.hMargin)*I,O=M.margin+(M.cellHeight+M.vMargin)*x,P=S+M.cellWidth/2,L=O+M.cellMargin+M.labelMargin*2+M.labelFontSize+M.thresholdWidth+M.thresholdLabelFontSize+M.thresholdLabelMargin*2+M.radius,U=M.cellHeight-M.cellMargin*2-M.labelMargin*2-M.labelFontSize-M.gaugeOuterHeight,R=0;return y.cell.vAlign==="middle"?R=U/2:y.cell.vAlign==="bottom"&&(R=U),L+=R,{col:I,row:x,x:S,y:O,offsetY:R,cellWidth:M.cellWidth,cellHeight:M.cellHeight,cellMargin:M.cellMargin,cx:P,cy:L}},h.prototype.drawBackground=function(y){l.frame.show&&(u.save(),u.strokeStyle=i.grid.borderColor,u.lineWidth=i.grid.borderWidth,u.strokeRect(0,0,y.canvasWidth,y.canvasHeight),i.grid.backgroundColor&&(u.fillStyle=i.grid.backgroundColor,u.fillRect(0,0,y.canvasWidth,y.canvasHeight)),u.restore())},h.prototype.drawCellBackground=function(y,M){u.save(),y.cell.border&&y.cell.border.show&&y.cell.border.color&&y.cell.border.width&&(u.strokeStyle=y.cell.border.color,u.lineWidth=y.cell.border.width,u.strokeRect(M.x,M.y,M.cellWidth,M.cellHeight)),y.cell.background&&y.cell.background.color&&(u.fillStyle=y.cell.background.color,u.fillRect(M.x,M.y,M.cellWidth,M.cellHeight)),u.restore()},h.prototype.drawGauge=function(y,M,T,I,x){var S=y.gauge.shadow.show?y.gauge.shadow.blur:0,O=v(y,x),P=m(y,M,x);D(T.cx,T.cy,M.radius,M.width,o(y.gauge.startAngle),o(y.gauge.endAngle),y.gauge.border.color,y.gauge.border.width,y.gauge.background.color,S),D(T.cx,T.cy,M.radius-1,M.width-2,o(P.a1),o(P.a2),O,1,O,S),y.gauge.neutralValue!=null&&a(y,M,T,O)};function m(y,M,T){let I={};var x=y.gauge.neutralValue;return x!=null?T<x?(I.a1=E(y,M,T),I.a2=E(y,M,x)):(I.a1=E(y,M,x),I.a2=E(y,M,T)):(I.a1=y.gauge.startAngle,I.a2=E(y,M,T)),I}function a(y,M,T,I){var x=(y.gauge.max-y.gauge.min)/600;s(u,T.cx,T.cy,M.radius-2,M.width-4,o(E(y,M,y.gauge.neutralValue-x)),o(E(y,M,y.gauge.neutralValue+x)),I,2,y.gauge.background.color)}function v(y,M){for(var T,I=0;I<y.threshold.values.length;I++){var x=y.threshold.values[I];if(T=x.color,M<x.value)break}return T}function E(y,M,T){var I=y.gauge.startAngle+(y.gauge.endAngle-y.gauge.startAngle)*((T-y.gauge.min)/(y.gauge.max-y.gauge.min));return I<y.gauge.startAngle?I=y.gauge.startAngle:I>y.gauge.endAngle&&(I=y.gauge.endAngle),I}h.prototype.drawThreshold=function(y,M,T){for(var I=y.gauge.startAngle,x=0;x<y.threshold.values.length;x++){var S=y.threshold.values[x];c1=S.color,a2=E(y,M,S.value),s(u,T.cx,T.cy,M.radius+M.thresholdWidth,M.thresholdWidth-2,o(I),o(a2),c1,1,c1),I=a2}};function D(y,M,T,I,x,S,O,P,L,U){x!==S&&(u.save(),s(u,y,M,T,I,x,S,O,P,L),U&&(s(u,y,M,T,I,x,S),u.clip(),u.shadowOffsetX=0,u.shadowOffsetY=0,u.shadowBlur=10,u.shadowColor="gray",s(u,y,M,T+1,I+2,x,S,O,1)),u.restore())}h.prototype.drawLable=function(y,M,T,I,x){C(T.cx,T.y+T.cellMargin+M.labelMargin+T.offsetY,"flotGaugeLabel"+I,y.label.formatter?y.label.formatter(x.label,x.data[0][1]):text,y.label)},h.prototype.drawValue=function(y,M,T,I,x){C(T.cx,T.cy-y.value.font.size/2,"flotGaugeValue"+I,y.value.formatter?y.value.formatter(x.label,x.data[0][1]):text,y.value)},h.prototype.drawThresholdValues=function(y,M,T,I){b(y,M,T,"Min"+I,y.gauge.min,y.gauge.startAngle),b(y,M,T,"Max"+I,y.gauge.max,y.gauge.endAngle);for(var x=0;x<y.threshold.values.length;x++){var S=y.threshold.values[x];if(S.value>y.gauge.min&&S.value<y.gauge.max){var O=E(y,M,S.value);b(y,M,T,I+"_"+x,S.value,O)}}var P=y.gauge.neutralValue;P!=null&&P>y.gauge.min&&P<y.gauge.max&&b(y,M,T,"Neutral"+I,P,E(y,M,P))};function b(y,M,T,I,x,S){C(T.cx+(M.thresholdLabelMargin+M.thresholdLabelFontSize/2+M.radius)*Math.cos(o(S)),T.cy+(M.thresholdLabelMargin+M.thresholdLabelFontSize/2+M.radius)*Math.sin(o(S)),"flotGaugeThresholdValue"+I,y.threshold.label.formatter?y.threshold.label.formatter(x):x,y.threshold.label,S)}function C(y,M,T,I,x,S){var O=Q(c).find("#"+T),P=O.length;P||(O=Q("<span></span>"),O.attr("id",T),O.attr("class","flot-temp-elem"),c.append(O)),O.css("position","absolute"),O.css("top",M+"px"),O.css("white-space","nowrap"),x.font.size&&O.css("font-size",x.font.size+"px"),x.font.family&&O.css("font-family",x.font.family),x.color&&O.css("color",x.color),x.background.color&&O.css("background-color",x.background.color),x.background.opacity&&O.css("opacity",x.background.opacity),O.text(I),O.css("left",y+"px"),O.css("left",parseInt(O.css("left"))-O.width()/2+"px"),!P&&S&&(O.css("top",parseInt(O.css("top"))-O.height()/2+"px"),O.css("transform","rotate("+(180*S+90)+"deg)"))}return h}();function e(u){return typeof Logger<"u"?new Logger(u):null}function t(u,c){return c%u}function n(u,c){return Math.floor(c/u)}function o(u){return u*Math.PI}function s(u,c,i,l,f,d,h,p,m,a){if(d!==h){var v=!1;u.save(),u.beginPath(),u.arc(c,i,l,d,h,v),u.lineTo(c+(l-f)*Math.cos(h),i+(l-f)*Math.sin(h)),u.arc(c,i,l-f,h,d,!v),u.closePath(),m&&(u.lineWidth=m),p&&(u.strokeStyle=p,u.stroke()),a&&(u.fillStyle=a,u.fill()),u.restore()}}function r(u){u.hooks.processOptions.push(function(c,i){var l=e(i.series.gauges.debug);i.series.gauges.show&&(i.grid.show=!1,i.legend.show=!1);var f=i.series.gauges.threshold.values;f.sort(function(d,h){return d.value<h.value?-1:d.value>h.value?1:0})}),u.hooks.draw.push(function(c,i){var l=c.getOptions(),f=l.series.gauges,d=e(f.debug);if(f.show){var h=c.getData();if(!(!h||!h.length)){var p=new A(c,i),m=p.calculateLayout();f.debug.layout,p.drawBackground(m);for(var a=0;a<h.length;a++){var v=h[a],E=Q.extend({},f,v.gauges);v.gauges&&p.calculateAutoValues(E,m.cellWidth);var D=p.calculateCellLayout(E,m,a);p.drawCellBackground(E,D),E.debug.layout,E.label.show&&p.drawLable(E,m,D,a,v),p.drawGauge(E,m,D,v.label,v.data[0][1]),E.threshold.show&&p.drawThreshold(E,m,D),E.threshold.label.show&&p.drawThresholdValues(E,m,D,a),E.value.show&&p.drawValue(E,m,D,a,v)}}}})}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(u,c){return u}},value:{show:!0,margin:"auto",background:{color:null,opacity:0},font:{size:"auto",family:"sans-serif"},color:null,formatter:function(u,c){return parseInt(c)}},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(u){return u}},values:[]}}}};Q.plot.plugins.push({init:r,options:g,name:"gauge",version:"1.1.0"})})(jQuery)},54087:()=>{(function(Q){Q.color={},Q.color.make=function(e,t,n,o){var s={};return s.r=e||0,s.g=t||0,s.b=n||0,s.a=o??1,s.add=function(r,g){for(var u=0;u<r.length;++u)s[r.charAt(u)]+=g;return s.normalize()},s.scale=function(r,g){for(var u=0;u<r.length;++u)s[r.charAt(u)]*=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,u,c){return u<g?g:u>c?c:u}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 Q.color.make(s.r,s.b,s.g,s.a)},s.normalize()},Q.color.extract=function(e,t){var n;do{if(n=e.css(t).toLowerCase(),n!=""&&n!="transparent")break;e=e.parent()}while(e.length&&!Q.nodeName(e.get(0),"body"));return n=="rgba(0, 0, 0, 0)"&&(n="transparent"),Q.color.parse(n)},Q.color.parse=function(e){var t,n=Q.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 o=Q.trim(e).toLowerCase();return o=="transparent"?n(255,255,255,0):(t=A[o]||[0,0,0],n(t[0],t[1],t[2]))};var A={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(Q){var A=Object.prototype.hasOwnProperty;Q.fn.detach||(Q.fn.detach=function(){return this.each(function(){this.parentNode&&this.parentNode.removeChild(this)})});function e(o,s){var r=s.children("."+o)[0];if(r==null&&(r=document.createElement("canvas"),r.className=o,Q(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"),u=window.devicePixelRatio||1,c=g.webkitBackingStorePixelRatio||g.mozBackingStorePixelRatio||g.msBackingStorePixelRatio||g.oBackingStorePixelRatio||g.backingStorePixelRatio||1;this.pixelRatio=u/c,this.resize(s.width(),s.height()),this.textContainer=null,this.text={},this._textCache={},this._textSizeCache=window.flotTextSizeCache=window.flotTextSizeCache||{}}e.prototype.resize=function(o,s){if(o<=0||s<=0)throw new Error("Invalid dimensions for plot, width = "+o+", height = "+s);var r=this.element,g=this.context,u=this.pixelRatio;this.width!=o&&(r.width=o*u,r.style.width=o+"px",this.width=o),this.height!=s&&(r.height=s*u,r.style.height=s+"px",this.height=s),g.restore(),g.save(),g.scale(u,u)},e.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)},e.prototype.render=function(){var o=this._textCache;for(var s in o)if(A.call(o,s)){var r=this.getTextLayer(s),g=o[s];r.hide();for(var u in g)if(A.call(g,u)){var c=g[u];for(var i in c)if(A.call(c,i)){for(var l=c[i].positions,f=0,d;d=l[f];f++)d.active?d.rendered||(r.append(d.element),d.rendered=!0):(l.splice(f--,1),d.rendered&&d.element.detach());l.length==0&&delete c[i]}}r.show()}},e.prototype.getTextLayer=function(o){var s=this.text[o];return s==null&&(this.textContainer==null&&(this.textContainer=Q("<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[o]=Q("<div></div>").addClass(o).css({position:"absolute",top:0,left:0,bottom:0,right:0}).appendTo(this.textContainer)),s},e.prototype.getTextInfo=function(o,s,r,g,u){var c,i,l,f;if(s=""+s,typeof r=="object"?c=r.style+" "+r.variant+" "+r.weight+" "+r.size+"px/"+r.lineHeight+"px "+r.family:c=r,i=this._textCache[o],i==null&&(i=this._textCache[o]={}),l=i[c],l==null&&(l=i[c]={}),f=l[s],f==null){var d=Q("<div></div>").html(s).css({position:"absolute","max-width":u,top:-9999}).appendTo(this.getTextLayer(o));typeof r=="object"?d.css({font:c,color:r.color}):typeof r=="string"&&d.addClass(r),f=l[s]={element:d,positions:[]};var h=this._textSizeCache[s];h?(f.width=h.width,f.height=h.height):(f.width=d.outerWidth(!0),f.height=d.outerHeight(!0),this._textSizeCache[s]={width:f.width,height:f.height}),d.detach()}return f},e.prototype.addText=function(o,s,r,g,u,c,i,l,f){var d=this.getTextInfo(o,g,u,c,i),h=d.positions;l=="center"?s-=d.width/2:l=="right"&&(s-=d.width),f=="middle"?r-=d.height/2:f=="bottom"&&(r-=d.height);for(var p=0,m;m=h[p];p++)if(m.x==s&&m.y==r){m.active=!0;return}m={active:!0,rendered:!1,element:h.length?d.element.clone():d.element,x:s,y:r},h.push(m),m.element.css({top:Math.round(r),left:Math.round(s),"text-align":l})},e.prototype.removeText=function(o,s,r,g,u,c){if(g==null){var i=this._textCache[o];if(i!=null){for(var l in i)if(A.call(i,l)){var f=i[l];for(var d in f)if(A.call(f,d))for(var h=f[d].positions,p=0,m;m=h[p];p++)m.active=!1}}}else for(var h=this.getTextInfo(o,g,u,c).positions,p=0,m;m=h[p];p++)m.x==s&&m.y==r&&(m.active=!1)};function t(o,s,r,g){var u=[],c={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:{}},i=null,l=null,f=null,d=null,h=null,p=[],m=[],a={left:0,right:0,top:0,bottom:0},v=0,E=0,D={processOptions:[],processRawData:[],processDatapoints:[],processOffset:[],processRange:[],drawBackground:[],drawSeries:[],draw:[],bindEvents:[],drawOverlay:[],shutdown:[]},b=this;b.setData=T,b.setupGrid=j,b.draw=ne,b.getPlaceholder=function(){return o},b.getCanvas=function(){return i.element},b.getPlotOffset=function(){return a},b.width=function(){return v},b.height=function(){return E},b.offset=function(){var Z=f.offset();return Z.left+=a.left,Z.top+=a.top,Z},b.getData=function(){return u},b.getAxes=function(){var Z={},ae;return Q.each(p.concat(m),function(de,ve){ve&&(Z[ve.direction+(ve.n!=1?ve.n:"")+"axis"]=ve)}),Z},b.getXAxes=function(){return p},b.getYAxes=function(){return m},b.c2p=O,b.p2c=P,b.getOptions=function(){return c},b.highlight=Xe,b.unhighlight=He,b.triggerRedrawOverlay=st,b.pointOffset=function(Z){return{left:parseInt(p[x(Z,"x")-1].p2c(+Z.x)+a.left,10),top:parseInt(m[x(Z,"y")-1].p2c(+Z.y)+a.top,10)}},b.shutdown=w,b.destroy=function(){w(),o.removeData("plot").empty(),u=[],c=null,i=null,l=null,f=null,d=null,h=null,p=[],m=[],D=null,Re=[],b=null},b.resize=function(){var Z=o.width(),ae=o.height();i.resize(Z,ae),l.resize(Z,ae)},b.hooks=D,y(b),M(r),B(),T(s),j(),ne(),H();function C(Z,ae){ae=[b].concat(ae);for(var de=0;de<Z.length;++de)Z[de].apply(this,ae)}function y(){for(var Z={Canvas:e},ae=0;ae<g.length;++ae){var de=g[ae];de.init(b,Z),de.options&&Q.extend(!0,c,de.options)}}function M(Z){Q.extend(!0,c,Z),Z&&Z.colors&&(c.colors=Z.colors),c.xaxis.color==null&&(c.xaxis.color=Q.color.parse(c.grid.color).scale("a",.22).toString()),c.yaxis.color==null&&(c.yaxis.color=Q.color.parse(c.grid.color).scale("a",.22).toString()),c.xaxis.tickColor==null&&(c.xaxis.tickColor=c.grid.tickColor||c.xaxis.color),c.yaxis.tickColor==null&&(c.yaxis.tickColor=c.grid.tickColor||c.yaxis.color),c.grid.borderColor==null&&(c.grid.borderColor=c.grid.color),c.grid.tickColor==null&&(c.grid.tickColor=Q.color.parse(c.grid.color).scale("a",.22).toString());var ae,de,ve,Ue=o.css("font-size"),_e=Ue?+Ue.replace("px",""):13,ze={style:o.css("font-style"),size:Math.round(.8*_e),variant:o.css("font-variant"),weight:o.css("font-weight"),family:o.css("font-family")};for(ve=c.xaxes.length||1,ae=0;ae<ve;++ae)de=c.xaxes[ae],de&&!de.tickColor&&(de.tickColor=de.color),de=Q.extend(!0,{},c.xaxis,de),c.xaxes[ae]=de,de.font&&(de.font=Q.extend({},ze,de.font),de.font.color||(de.font.color=de.color),de.font.lineHeight||(de.font.lineHeight=Math.round(de.font.size*1.15)));for(ve=c.yaxes.length||1,ae=0;ae<ve;++ae)de=c.yaxes[ae],de&&!de.tickColor&&(de.tickColor=de.color),de=Q.extend(!0,{},c.yaxis,de),c.yaxes[ae]=de,de.font&&(de.font=Q.extend({},ze,de.font),de.font.color||(de.font.color=de.color),de.font.lineHeight||(de.font.lineHeight=Math.round(de.font.size*1.15)));for(c.xaxis.noTicks&&c.xaxis.ticks==null&&(c.xaxis.ticks=c.xaxis.noTicks),c.yaxis.noTicks&&c.yaxis.ticks==null&&(c.yaxis.ticks=c.yaxis.noTicks),c.x2axis&&(c.xaxes[1]=Q.extend(!0,{},c.xaxis,c.x2axis),c.xaxes[1].position="top",c.x2axis.min==null&&(c.xaxes[1].min=null),c.x2axis.max==null&&(c.xaxes[1].max=null)),c.y2axis&&(c.yaxes[1]=Q.extend(!0,{},c.yaxis,c.y2axis),c.yaxes[1].position="right",c.y2axis.min==null&&(c.yaxes[1].min=null),c.y2axis.max==null&&(c.yaxes[1].max=null)),c.grid.coloredAreas&&(c.grid.markings=c.grid.coloredAreas),c.grid.coloredAreasColor&&(c.grid.markingsColor=c.grid.coloredAreasColor),c.lines&&Q.extend(!0,c.series.lines,c.lines),c.points&&Q.extend(!0,c.series.points,c.points),c.bars&&Q.extend(!0,c.series.bars,c.bars),c.shadowSize!=null&&(c.series.shadowSize=c.shadowSize),c.highlightColor!=null&&(c.series.highlightColor=c.highlightColor),ae=0;ae<c.xaxes.length;++ae)L(p,ae+1).options=c.xaxes[ae];for(ae=0;ae<c.yaxes.length;++ae)L(m,ae+1).options=c.yaxes[ae];for(var Ve in D)c.hooks[Ve]&&c.hooks[Ve].length&&(D[Ve]=D[Ve].concat(c.hooks[Ve]));C(D.processOptions,[c])}function T(Z){u=I(Z),U(),R()}function I(Z){for(var ae=[],de=0;de<Z.length;++de){var ve=Q.extend(!0,{},c.series);Z[de].data!=null?(ve.data=Z[de].data,delete Z[de].data,Q.extend(!0,ve,Z[de]),Z[de].data=ve.data):ve.data=Z[de],ae.push(ve)}return ae}function x(Z,ae){var de=Z[ae+"axis"];return typeof de=="object"&&(de=de.n),typeof de!="number"&&(de=1),de}function S(){return Q.grep(p.concat(m),function(Z){return Z})}function O(Z){var ae={},de,ve;for(de=0;de<p.length;++de)ve=p[de],ve&&(ae["x"+ve.n]=ve.c2p(Z.left));for(de=0;de<m.length;++de)ve=m[de],ve&&(ae["y"+ve.n]=ve.c2p(Z.top));return ae.x1!==void 0&&(ae.x=ae.x1),ae.y1!==void 0&&(ae.y=ae.y1),ae}function P(Z){var ae={},de,ve,Ue;for(de=0;de<p.length;++de)if(ve=p[de],ve&&ve.used&&(Ue="x"+ve.n,Z[Ue]==null&&ve.n==1&&(Ue="x"),Z[Ue]!=null)){ae.left=ve.p2c(Z[Ue]);break}for(de=0;de<m.length;++de)if(ve=m[de],ve&&ve.used&&(Ue="y"+ve.n,Z[Ue]==null&&ve.n==1&&(Ue="y"),Z[Ue]!=null)){ae.top=ve.p2c(Z[Ue]);break}return ae}function L(Z,ae){return Z[ae-1]||(Z[ae-1]={n:ae,direction:Z==p?"x":"y",options:Q.extend(!0,{},Z==p?c.xaxis:c.yaxis)}),Z[ae-1]}function U(){var Z=u.length,ae=-1,de;for(de=0;de<u.length;++de){var ve=u[de].color;ve!=null&&(Z--,typeof ve=="number"&&ve>ae&&(ae=ve))}Z<=ae&&(Z=ae+1);var Ue,_e=[],ze=c.colors,Ve=ze.length,Ne=0;for(de=0;de<Z;de++)Ue=Q.color.parse(ze[de%Ve]||"#666"),de%Ve==0&&de&&(Ne>=0?Ne<.5?Ne=-Ne-.2:Ne=0:Ne=-Ne),_e[de]=Ue.scale("rgb",1+Ne);var ot=0,nt;for(de=0;de<u.length;++de){if(nt=u[de],nt.color==null?(nt.color=_e[ot].toString(),++ot):typeof nt.color=="number"&&(nt.color=_e[nt.color].toString()),nt.lines.show==null){var pt,mt=!0;for(pt in nt)if(nt[pt]&&nt[pt].show){mt=!1;break}mt&&(nt.lines.show=!0)}nt.lines.zero==null&&(nt.lines.zero=!!nt.lines.fill),nt.xaxis=L(p,x(nt,"x")),nt.yaxis=L(m,x(nt,"y"))}}function R(){var Z=Number.POSITIVE_INFINITY,ae=Number.NEGATIVE_INFINITY,de=Number.MAX_VALUE,ve,Ue,_e,ze,Ve,Ne,ot,nt,pt,mt,gt,Pt,Mt,Yt,zt,_t;function rt(Xt,fn,An){fn<Xt.datamin&&fn!=-de&&(Xt.datamin=fn),An>Xt.datamax&&An!=de&&(Xt.datamax=An)}for(Q.each(S(),function(Xt,fn){fn.datamin=Z,fn.datamax=ae,fn.used=!1}),ve=0;ve<u.length;++ve)Ne=u[ve],Ne.datapoints={points:[]},C(D.processRawData,[Ne,Ne.data,Ne.datapoints]);for(ve=0;ve<u.length;++ve){if(Ne=u[ve],zt=Ne.data,_t=Ne.datapoints.format,!_t){if(_t=[],_t.push({x:!0,number:!0,required:!0}),_t.push({y:!0,number:!0,required:!0}),Ne.stack||Ne.bars.show||Ne.lines.show&&Ne.lines.fill){var It=!!(Ne.bars.show&&Ne.bars.zero||Ne.lines.show&&Ne.lines.zero);_t.push({y:!0,number:!0,required:!1,defaultValue:0,autoscale:It}),Ne.bars.horizontal&&(delete _t[_t.length-1].y,_t[_t.length-1].x=!0)}Ne.datapoints.format=_t}if(Ne.datapoints.pointsize==null){Ne.datapoints.pointsize=_t.length,nt=Ne.datapoints.pointsize,ot=Ne.datapoints.points;var Dn=Ne.lines.show&&Ne.lines.steps;for(Ne.xaxis.used=Ne.yaxis.used=!0,Ue=_e=0;Ue<zt.length;++Ue,_e+=nt){Yt=zt[Ue];var ft=Yt==null;if(!ft)for(ze=0;ze<nt;++ze)Pt=Yt[ze],Mt=_t[ze],Mt&&(Mt.number&&Pt!=null&&(Pt=+Pt,isNaN(Pt)?Pt=null:Pt==1/0?Pt=de:Pt==-1/0&&(Pt=-de)),Pt==null&&(Mt.required&&(ft=!0),Mt.defaultValue!=null&&(Pt=Mt.defaultValue))),ot[_e+ze]=Pt;if(ft)for(ze=0;ze<nt;++ze)Pt=ot[_e+ze],Pt!=null&&(Mt=_t[ze],Mt.autoscale!==!1&&(Mt.x&&rt(Ne.xaxis,Pt,Pt),Mt.y&&rt(Ne.yaxis,Pt,Pt))),ot[_e+ze]=null;if(Dn&&_e>0&&(!ft||ot[_e-nt]!=null)){for(ze=0;ze<nt;++ze)ot[_e+nt+ze]=ot[_e+ze];ot[_e+1]=ot[_e-nt+1]||0,ft&&(ot[_e]=Yt[0]),_e+=nt}}}}for(ve=0;ve<u.length;++ve){if(Ne=u[ve],ot=Ne.datapoints.points,nt=Ne.datapoints.pointsize,Ne.transform==="negative-Y")for(Ue=0;Ue<ot.length;Ue+=nt)ot[Ue]!=null&&(Pt=ot[Ue+1],ot[Ue+1]=-Pt);C(D.processDatapoints,[Ne,Ne.datapoints])}for(ve=0;ve<u.length;++ve){Ne=u[ve],ot=Ne.datapoints.points,nt=Ne.datapoints.pointsize,_t=Ne.datapoints.format;var yt=Z,jt=Z,cn=ae,pn=ae;for(Ue=0;Ue<ot.length;Ue+=nt)if(ot[Ue]!=null)for(ze=0;ze<nt;++ze)Pt=ot[Ue+ze],Mt=_t[ze],!(!Mt||Mt.autoscale===!1||Pt==de||Pt==-de)&&(Mt.x&&(Pt<yt&&(yt=Pt),Pt>cn&&(cn=Pt)),Mt.y&&(Pt<jt&&(jt=Pt),Pt>pn&&(pn=Pt)));if(Ne.bars.show){var on;switch(Ne.bars.align){case"left":on=0;break;case"right":on=-Ne.bars.barWidth;break;default:on=-Ne.bars.barWidth/2}Ne.bars.horizontal?(jt+=on,pn+=on+Ne.bars.barWidth):(yt+=on,cn+=on+Ne.bars.barWidth)}rt(Ne.xaxis,yt,cn),rt(Ne.yaxis,jt,pn)}Q.each(S(),function(Xt,fn){fn.datamin==Z&&(fn.datamin=null),fn.datamax==ae&&(fn.datamax=null)})}function B(){o.find(".flot-temp-elem").remove(),o.css("position")=="static"&&o.css("position","relative"),i=new e("flot-base",o),l=new e("flot-overlay",o),d=i.context,h=l.context,f=Q(l.element).unbind();var Z=o.data("plot");Z&&(Z.shutdown(),l.clear()),o.data("plot",b)}function H(){c.grid.hoverable&&(f.mousemove(ye),f.bind("mouseleave",Le),Q(document).bind("touchend",Be)),c.grid.clickable&&f.click(We),C(D.bindEvents,[f])}function w(){me&&clearTimeout(me),f.unbind("mousemove",ye),f.unbind("mouseleave",Le),f.unbind("click",We),Q(document).unbind("touchend",Be),C(D.shutdown,[f])}function N(Z){function ae(ze){return ze}var de,ve,Ue=Z.options.transform||ae,_e=Z.options.inverseTransform;Z.direction=="x"?(de=Z.scale=v/Math.abs(Ue(Z.max)-Ue(Z.min)),ve=Math.min(Ue(Z.max),Ue(Z.min))):(de=Z.scale=E/Math.abs(Ue(Z.max)-Ue(Z.min)),de=-de,ve=Math.max(Ue(Z.max),Ue(Z.min))),Ue==ae?Z.p2c=function(ze){return(ze-ve)*de}:Z.p2c=function(ze){return(Ue(ze)-ve)*de},_e?Z.c2p=function(ze){return _e(ve+ze/de)}:Z.c2p=function(ze){return ve+ze/de}}function V(Z){for(var ae=Z.options,de=Z.ticks||[],ve=ae.labelWidth||0,Ue=ae.labelHeight||0,_e=ve||(Z.direction=="x"?Math.floor(i.width/(de.length||1)):null),ze=Z.direction+"Axis "+Z.direction+Z.n+"Axis",Ve="flot-"+Z.direction+"-axis flot-"+Z.direction+Z.n+"-axis "+ze,Ne=ae.font||"flot-tick-label tickLabel",ot=0;ot<de.length;++ot){var nt=de[ot];if(nt.label){var pt=i.getTextInfo(Ve,nt.label,Ne,null,_e);ve=Math.max(ve,pt.width+1),Ue=Math.max(Ue,pt.height)}}Z.labelWidth=ae.labelWidth||ve,Z.labelHeight=ae.labelHeight||Ue}function G(Z){var ae=Z.labelWidth,de=Z.labelHeight,ve=Z.options.position,Ue=Z.direction==="x",_e=Z.options.tickLength,ze=c.grid.axisMargin,Ve=c.grid.labelMargin,Ne=c.grid.eventSectionHeight,ot=!0,nt=!0,pt=!0,mt=!1;Q.each(Ue?p:m,function(gt,Pt){Pt&&(Pt.show||Pt.reserveSpace)&&(Pt===Z?mt=!0:Pt.options.position===ve&&(mt?nt=!1:ot=!1),mt||(pt=!1))}),nt&&(ze=0),_e==null&&(_e=pt?"full":5),isNaN(+_e)||(Ve+=+_e),Ue?(de+=Ve,de+=Ne,ve=="bottom"?(a.bottom+=de+ze,Z.box={top:i.height-a.bottom,height:de}):(Z.box={top:a.top+ze,height:de},a.top+=de+ze)):(ae+=Ve,ve=="left"?(Z.box={left:a.left+ze,width:ae},a.left+=ae+ze):(a.right+=ae+ze,Z.box={left:i.width-a.right,width:ae})),Z.position=ve,Z.tickLength=_e,Z.box.padding=Ve,Z.box.eventSectionPadding=Ne,Z.innermost=ot}function _(Z){Z.direction=="x"?(Z.box.left=a.left-Z.labelWidth/2,Z.box.width=i.width-a.left-a.right+Z.labelWidth):(Z.box.top=a.top-Z.labelHeight/2,Z.box.height=i.height-a.bottom-a.top+Z.labelHeight)}function K(){var Z=c.grid.minBorderMargin,ae,de;if(Z==null)for(Z=0,de=0;de<u.length;++de)Z=Math.max(Z,2*(u[de].points.radius+u[de].points.lineWidth/2));var ve={left:Z,right:Z,top:Z,bottom:Z};Q.each(S(),function(Ue,_e){_e.reserveSpace&&_e.ticks&&_e.ticks.length&&(_e.direction==="x"?(ve.left=Math.max(ve.left,_e.labelWidth/2),ve.right=Math.max(ve.right,_e.labelWidth/2)):(ve.bottom=Math.max(ve.bottom,_e.labelHeight/2),ve.top=Math.max(ve.top,_e.labelHeight/2)))}),a.left=Math.ceil(Math.max(ve.left,a.left)),a.right=Math.ceil(Math.max(ve.right,a.right)),a.top=Math.ceil(Math.max(ve.top,a.top)),a.bottom=Math.ceil(Math.max(ve.bottom,a.bottom))}function j(){var Z,ae=S(),de=c.grid.show;for(var ve in a){var Ue=c.grid.margin||0;a[ve]=typeof Ue=="number"?Ue:Ue[ve]||0}C(D.processOffset,[a]);for(var ve in a)typeof c.grid.borderWidth=="object"?a[ve]+=de?c.grid.borderWidth[ve]:0:a[ve]+=de?c.grid.borderWidth:0;if(Q.each(ae,function(Ve,Ne){var ot=Ne.options;Ne.show=ot.show==null?Ne.used:ot.show,Ne.reserveSpace=ot.reserveSpace==null?Ne.show:ot.reserveSpace,k(Ne)}),C(D.processRange,[]),de){for(var _e=Q.grep(ae,function(Ve){return Ve.show||Ve.reserveSpace}),ze=!1,Z=0;Z<2&&(Q.each(_e,function(Ne,ot){ee(ot),re(ot),ze=J(ot,ot.ticks)||ze,V(ot)}),ze&&D.processRange.length>0);Z++)C(D.processRange,[]),ze=!1;for(Z=_e.length-1;Z>=0;--Z)G(_e[Z]);K(),Q.each(_e,function(Ve,Ne){_(Ne)})}v=i.width-a.left-a.right,E=i.height-a.bottom-a.top,Q.each(ae,function(Ve,Ne){N(Ne)}),de&&ue(),Ee()}function k(Z){var ae=Z.options,de=+(ae.min!=null?ae.min:Z.datamin),ve=+(ae.max!=null?ae.max:Z.datamax),Ue=ve-de;if(Ue==0){var _e=.25,ze=Math.abs(ve==0?1:ve*_e);ae.min==null&&(de-=ze),(ae.max==null||ae.min!=null)&&(ve+=ze)}else{var Ve=ae.autoscaleMargin;Ve!=null&&(ae.min==null&&(de-=Ue*Ve,de<0&&Z.datamin!=null&&Z.datamin>=0&&(de=0)),ae.max==null&&(ve+=Ue*Ve,ve>0&&Z.datamax!=null&&Z.datamax<=0&&(ve=0)))}Z.min=de,Z.max=ve}function Y(Z){if(Z=Math.abs(String(Z).replace(".","")),Z==0)return 0;for(;Z!=0&&Z%10==0;)Z/=10;return Math.floor(Math.log(Z)/Math.LN10)+1}function ee(Z){var ae=Z.options,de;typeof ae.ticks=="number"&&ae.ticks>0?de=ae.ticks:de=.3*Math.sqrt(Z.direction=="x"?i.width:i.height);var ve=(Z.max-Z.min)/de,Ue=-Math.floor(Math.log(ve)/Math.LN10),_e=ae.tickDecimals;_e!=null&&Ue>_e&&(Ue=_e);var ze=Math.pow(10,-Ue),Ve=ve/ze,Ne;if(Ve<1.5?Ne=1:Ve<3?(Ne=2,Ve>2.25&&(_e==null||Ue+1<=_e)&&(Ne=2.5,++Ue)):Ve<7.5?Ne=5:Ne=10,Ne*=ze,ae.minTickSize!=null&&Ne<ae.minTickSize&&(Ne=ae.minTickSize),Z.delta=ve,Z.tickDecimals=Math.max(0,_e??Ue),Z.tickSize=ae.tickSize||Ne,ae.mode=="time"&&!Z.tickGenerator)throw new Error("Time mode requires the flot.time plugin.");if(Z.tickGenerator||(Z.tickGenerator=function(gt){var Pt=[],Mt=n(gt.min,gt.tickSize),Yt=0,zt=Number.NaN,_t;do _t=zt,zt=Mt+Yt*gt.tickSize,Pt.push(zt),++Yt;while(zt<gt.max&&zt!=_t);return Pt},Z.tickFormatter=function(gt,Pt){var Mt=Pt.tickDecimals?Math.pow(10,Pt.tickDecimals):1,Yt=""+Math.round(gt*Mt)/Mt;if(Pt.tickDecimals!=null){var zt=Yt.indexOf("."),_t=zt==-1?0:Yt.length-zt-1;if(_t<Pt.tickDecimals)return(_t?Yt:Yt+".")+(""+Mt).substr(1,Pt.tickDecimals-_t)}return Yt}),Q.isFunction(ae.tickFormatter)&&(Z.tickFormatter=function(gt,Pt){return""+ae.tickFormatter(gt,Pt)}),ae.alignTicksWithAxis!=null){var ot=(Z.direction=="x"?p:m)[ae.alignTicksWithAxis-1];if(ot&&ot.used&&ot!=Z){var nt=Z.tickGenerator(Z);if(nt.length>0&&(ae.min==null&&(Z.min=Math.min(Z.min,nt[0])),ae.max==null&&nt.length>1&&(Z.max=Math.max(Z.max,nt[nt.length-1]))),Z.tickGenerator=function(gt){var Pt=[],Mt,Yt;for(Yt=0;Yt<ot.ticks.length;++Yt)Mt=(ot.ticks[Yt].v-ot.min)/(ot.max-ot.min),Mt=gt.min+Mt*(gt.max-gt.min),Pt.push(Mt);return Pt},!Z.mode&&ae.tickDecimals==null){var pt=Math.max(0,-Math.floor(Math.log(Z.delta)/Math.LN10)+1),mt=Z.tickGenerator(Z);mt.length>1&&/\..*0$/.test((mt[1]-mt[0]).toFixed(pt))||(Z.tickDecimals=pt)}}}}function re(Z){var ae=Z.options.ticks,de=[];ae==null||typeof ae=="number"&&ae>0?de=Z.tickGenerator(Z):ae&&(Q.isFunction(ae)?de=ae(Z):de=ae);var ve,Ue;for(Z.ticks=[],ve=0;ve<de.length;++ve){var _e=null,ze=de[ve];typeof ze=="object"?(Ue=+ze[0],ze.length>1&&(_e=ze[1])):Ue=+ze,_e==null&&(_e=Z.tickFormatter(Ue,Z)),isNaN(Ue)||Z.ticks.push({v:Ue,label:_e})}}function J(Z,ae){var de=!1;return Z.options.autoscaleMargin&&ae.length>0&&(Z.options.min==null&&(Z.min=Math.min(Z.min,ae[0].v),de=!0),Z.options.max==null&&ae.length>1&&(Z.max=Math.max(Z.max,ae[ae.length-1].v),de=!0)),de}function ne(){i.clear(),C(D.drawBackground,[d]);var Z=c.grid;Z.show&&Z.backgroundColor&&te(),Z.show&&!Z.aboveData&&oe();for(var ae=0;ae<u.length;++ae)C(D.drawSeries,[d,u[ae]]),ge(u[ae]);C(D.draw,[d]),Z.show&&Z.aboveData&&oe(),i.render(),st()}function q(Z,ae){for(var de,ve,Ue,_e,ze=S(),Ve=0;Ve<ze.length;++Ve)if(de=ze[Ve],de.direction==ae&&(_e=ae+de.n+"axis",!Z[_e]&&de.n==1&&(_e=ae+"axis"),Z[_e])){ve=Z[_e].from,Ue=Z[_e].to;break}if(Z[_e]||(de=ae=="x"?p[0]:m[0],ve=Z[ae+"1"],Ue=Z[ae+"2"]),ve!=null&&Ue!=null&&ve>Ue){var Ne=ve;ve=Ue,Ue=Ne}return{from:ve,to:Ue,axis:de}}function te(){d.save(),d.translate(a.left,a.top),d.fillStyle=be(c.grid.backgroundColor,E,0,"rgba(255, 255, 255, 0)"),d.fillRect(0,0,v,E),d.restore()}function oe(){var Z,ae,de,ve;d.save(),d.translate(a.left,a.top);var Ue=c.grid.markings;if(Ue)for(Q.isFunction(Ue)&&(ae=b.getAxes(),ae.xmin=ae.xaxis.min,ae.xmax=ae.xaxis.max,ae.ymin=ae.yaxis.min,ae.ymax=ae.yaxis.max,Ue=Ue(ae)),Z=0;Z<Ue.length;++Z){var _e=Ue[Z],ze=q(_e,"x"),Ve=q(_e,"y");if(ze.from==null&&(ze.from=ze.axis.min),ze.to==null&&(ze.to=ze.axis.max),Ve.from==null&&(Ve.from=Ve.axis.min),Ve.to==null&&(Ve.to=Ve.axis.max),!(ze.to<ze.axis.min||ze.from>ze.axis.max||Ve.to<Ve.axis.min||Ve.from>Ve.axis.max)){ze.from=Math.max(ze.from,ze.axis.min),ze.to=Math.min(ze.to,ze.axis.max),Ve.from=Math.max(Ve.from,Ve.axis.min),Ve.to=Math.min(Ve.to,Ve.axis.max);var Ne=ze.from===ze.to,ot=Ve.from===Ve.to;if(!(Ne&&ot))if(ze.from=Math.floor(ze.axis.p2c(ze.from)),ze.to=Math.floor(ze.axis.p2c(ze.to)),Ve.from=Math.floor(Ve.axis.p2c(Ve.from)),Ve.to=Math.floor(Ve.axis.p2c(Ve.to)),Ne||ot){var nt=_e.lineWidth||c.grid.markingsLineWidth,pt=nt%2?.5:0;d.beginPath(),d.strokeStyle=_e.color||c.grid.markingsColor,d.lineWidth=nt,Ne?(d.moveTo(ze.to+pt,Ve.from),d.lineTo(ze.to+pt,Ve.to)):(d.moveTo(ze.from,Ve.to+pt),d.lineTo(ze.to,Ve.to+pt)),d.stroke()}else d.fillStyle=_e.color||c.grid.markingsColor,d.fillRect(ze.from,Ve.to,ze.to-ze.from,Ve.from-Ve.to)}}ae=S(),de=c.grid.borderWidth;for(var mt=0;mt<ae.length;++mt){var gt=ae[mt],Pt=gt.box,Mt=gt.tickLength,Yt,zt,_t,rt;if(!(!gt.show||gt.ticks.length==0)){for(d.lineWidth=1,gt.direction=="x"?(Yt=0,Mt=="full"?zt=gt.position=="top"?0:E:zt=Pt.top-a.top+(gt.position=="top"?Pt.height:0)):(zt=0,Mt=="full"?Yt=gt.position=="left"?0:v:Yt=Pt.left-a.left+(gt.position=="left"?Pt.width:0)),gt.innermost||(d.strokeStyle=gt.options.color,d.beginPath(),_t=rt=0,gt.direction=="x"?_t=v+1:rt=E+1,d.lineWidth==1&&(gt.direction=="x"?zt=Math.floor(zt)+.5:Yt=Math.floor(Yt)+.5),d.moveTo(Yt,zt),d.lineTo(Yt+_t,zt+rt),d.stroke()),d.strokeStyle=gt.options.tickColor,d.beginPath(),Z=0;Z<gt.ticks.length;++Z){var It=gt.ticks[Z].v;_t=rt=0,!(isNaN(It)||It<gt.min||It>gt.max||Mt=="full"&&(typeof de=="object"&&de[gt.position]>0||de>0)&&(It==gt.min||It==gt.max))&&(gt.direction=="x"?(Yt=gt.p2c(It),rt=Mt=="full"?-E:Mt,gt.position=="top"&&(rt=-rt)):(zt=gt.p2c(It),_t=Mt=="full"?-v:Mt,gt.position=="left"&&(_t=-_t)),d.lineWidth==1&&(gt.direction=="x"?Yt=Math.floor(Yt)+.5:zt=Math.floor(zt)+.5),d.moveTo(Yt,zt),d.lineTo(Yt+_t,zt+rt))}d.stroke()}}de&&(ve=c.grid.borderColor,typeof de=="object"||typeof ve=="object"?(typeof de!="object"&&(de={top:de,right:de,bottom:de,left:de}),typeof ve!="object"&&(ve={top:ve,right:ve,bottom:ve,left:ve}),de.top>0&&(d.strokeStyle=ve.top,d.lineWidth=de.top,d.beginPath(),d.moveTo(0-de.left,0-de.top/2),d.lineTo(v,0-de.top/2),d.stroke()),de.right>0&&(d.strokeStyle=ve.right,d.lineWidth=de.right,d.beginPath(),d.moveTo(v+de.right/2,0-de.top),d.lineTo(v+de.right/2,E),d.stroke()),de.bottom>0&&(d.strokeStyle=ve.bottom,d.lineWidth=de.bottom,d.beginPath(),d.moveTo(v+de.right,E+de.bottom/2),d.lineTo(0,E+de.bottom/2),d.stroke()),de.left>0&&(d.strokeStyle=ve.left,d.lineWidth=de.left,d.beginPath(),d.moveTo(0-de.left/2,E+de.bottom),d.lineTo(0-de.left/2,0),d.stroke())):(d.lineWidth=de,d.strokeStyle=c.grid.borderColor,d.strokeRect(-de/2,-de/2,v+de,E+de))),d.restore()}function ue(){Q.each(S(),function(Z,ae){var de=ae.box,ve=ae.direction+"Axis "+ae.direction+ae.n+"Axis",Ue="flot-"+ae.direction+"-axis flot-"+ae.direction+ae.n+"-axis "+ve,_e=ae.options.font||"flot-tick-label tickLabel",ze,Ve,Ne,ot,nt;if(i.removeText(Ue),!(!ae.show||ae.ticks.length==0))for(var pt=0;pt<ae.ticks.length;++pt)ze=ae.ticks[pt],!(!ze.label||ze.v<ae.min||ze.v>ae.max)&&(ae.direction=="x"?(ot="center",Ve=a.left+ae.p2c(ze.v),ae.position=="bottom"?Ne=de.top+de.padding+de.eventSectionPadding:(Ne=de.top+de.height-de.padding,nt="bottom")):(nt="middle",Ne=a.top+ae.p2c(ze.v),ae.position=="left"?(Ve=de.left+de.width-de.padding,ot="right"):Ve=de.left+de.padding),i.addText(Ue,Ve,Ne,ze.label,_e,null,null,ot,nt))})}function ie(Z){for(var ae=[],de=null,ve=null,Ue=Z.datapoints,_e=[],ze=0;ze<Ue.pointsize-2;ze++)_e.push(0);for(var Ve=0;Ve<Ue.points.length;Ve+=Ue.pointsize){var Ne=Ue.points[Ve],ot=Ue.points[Ve+1];Ve===Ue.points.length-Ue.pointsize?ve=null:ve=Ue.points[Ve+Ue.pointsize],Ne!==null&&ot!==null&&de===null&&ve===null&&(ae.push(Ne),ae.push(ot),ae.push.apply(ae,_e)),de=Ne}var nt=Ue.points;Ue.points=ae,Z.points.radius=Z.lines.lineWidth/2,De(Z),Ue.points=nt}function ge(Z){Z.lines.show&&(he(Z),!Z.points.show&&!Z.bars.show&&ie(Z)),Z.bars.show&&le(Z),Z.points.show&&De(Z)}function he(Z){function ae(Ve,Ne,ot,nt,pt){var mt=Ve.points,gt=Ve.pointsize,Pt=null,Mt=null;d.beginPath();for(var Yt=gt;Yt<mt.length;Yt+=gt){var zt=mt[Yt-gt],_t=mt[Yt-gt+1],rt=mt[Yt],It=mt[Yt+1];if(!(zt==null||rt==null)){if(_t<=It&&_t<pt.min){if(It<pt.min)continue;zt=(pt.min-_t)/(It-_t)*(rt-zt)+zt,_t=pt.min}else if(It<=_t&&It<pt.min){if(_t<pt.min)continue;rt=(pt.min-_t)/(It-_t)*(rt-zt)+zt,It=pt.min}if(_t>=It&&_t>pt.max){if(It>pt.max)continue;zt=(pt.max-_t)/(It-_t)*(rt-zt)+zt,_t=pt.max}else if(It>=_t&&It>pt.max){if(_t>pt.max)continue;rt=(pt.max-_t)/(It-_t)*(rt-zt)+zt,It=pt.max}if(zt<=rt&&zt<nt.min){if(rt<nt.min)continue;_t=(nt.min-zt)/(rt-zt)*(It-_t)+_t,zt=nt.min}else if(rt<=zt&&rt<nt.min){if(zt<nt.min)continue;It=(nt.min-zt)/(rt-zt)*(It-_t)+_t,rt=nt.min}if(zt>=rt&&zt>nt.max){if(rt>nt.max)continue;_t=(nt.max-zt)/(rt-zt)*(It-_t)+_t,zt=nt.max}else if(rt>=zt&&rt>nt.max){if(zt>nt.max)continue;It=(nt.max-zt)/(rt-zt)*(It-_t)+_t,rt=nt.max}(zt!=Pt||_t!=Mt)&&d.moveTo(nt.p2c(zt)+Ne,pt.p2c(_t)+ot),Pt=rt,Mt=It,d.lineTo(nt.p2c(rt)+Ne,pt.p2c(It)+ot)}}d.stroke()}function de(Ve,Ne,ot){for(var nt=Ve.points,pt=Ve.pointsize,mt=Math.min(Math.max(0,ot.min),ot.max),gt=0,Pt,Mt=!1,Yt=1,zt=0,_t=0;!(pt>0&>>nt.length+pt);){gt+=pt;var rt=nt[gt-pt],It=nt[gt-pt+Yt],Dn=nt[gt],ft=nt[gt+Yt];if(Mt){if(pt>0&&rt!=null&&Dn==null){_t=gt,pt=-pt,Yt=2;continue}if(pt<0&>==zt+pt){d.fill(),Mt=!1,pt=-pt,Yt=1,gt=zt=_t+pt;continue}}if(!(rt==null||Dn==null)){if(rt<=Dn&&rt<Ne.min){if(Dn<Ne.min)continue;It=(Ne.min-rt)/(Dn-rt)*(ft-It)+It,rt=Ne.min}else if(Dn<=rt&&Dn<Ne.min){if(rt<Ne.min)continue;ft=(Ne.min-rt)/(Dn-rt)*(ft-It)+It,Dn=Ne.min}if(rt>=Dn&&rt>Ne.max){if(Dn>Ne.max)continue;It=(Ne.max-rt)/(Dn-rt)*(ft-It)+It,rt=Ne.max}else if(Dn>=rt&&Dn>Ne.max){if(rt>Ne.max)continue;ft=(Ne.max-rt)/(Dn-rt)*(ft-It)+It,Dn=Ne.max}if(Mt||(d.beginPath(),d.moveTo(Ne.p2c(rt),ot.p2c(mt)),Mt=!0),It>=ot.max&&ft>=ot.max){d.lineTo(Ne.p2c(rt),ot.p2c(ot.max)),d.lineTo(Ne.p2c(Dn),ot.p2c(ot.max));continue}else if(It<=ot.min&&ft<=ot.min){d.lineTo(Ne.p2c(rt),ot.p2c(ot.min)),d.lineTo(Ne.p2c(Dn),ot.p2c(ot.min));continue}var yt=rt,jt=Dn;It<=ft&&It<ot.min&&ft>=ot.min?(rt=(ot.min-It)/(ft-It)*(Dn-rt)+rt,It=ot.min):ft<=It&&ft<ot.min&&It>=ot.min&&(Dn=(ot.min-It)/(ft-It)*(Dn-rt)+rt,ft=ot.min),It>=ft&&It>ot.max&&ft<=ot.max?(rt=(ot.max-It)/(ft-It)*(Dn-rt)+rt,It=ot.max):ft>=It&&ft>ot.max&&It<=ot.max&&(Dn=(ot.max-It)/(ft-It)*(Dn-rt)+rt,ft=ot.max),rt!=yt&&d.lineTo(Ne.p2c(yt),ot.p2c(It)),d.lineTo(Ne.p2c(rt),ot.p2c(It)),d.lineTo(Ne.p2c(Dn),ot.p2c(ft)),Dn!=jt&&(d.lineTo(Ne.p2c(Dn),ot.p2c(ft)),d.lineTo(Ne.p2c(jt),ot.p2c(ft)))}}}d.save(),d.translate(a.left,a.top),d.lineJoin="round";var ve=Z.lines.lineWidth,Ue=Z.shadowSize;if(ve>0&&Ue>0){d.lineWidth=Ue,d.strokeStyle="rgba(0,0,0,0.1)";var _e=Math.PI/18;ae(Z.datapoints,Math.sin(_e)*(ve/2+Ue/2),Math.cos(_e)*(ve/2+Ue/2),Z.xaxis,Z.yaxis),d.lineWidth=Ue/2,ae(Z.datapoints,Math.sin(_e)*(ve/2+Ue/4),Math.cos(_e)*(ve/2+Ue/4),Z.xaxis,Z.yaxis)}d.lineWidth=ve,d.strokeStyle=Z.color;var ze=Te(Z.lines,Z.color,0,E);ze&&(d.fillStyle=ze,de(Z.datapoints,Z.xaxis,Z.yaxis)),ve>0&&ae(Z.datapoints,0,0,Z.xaxis,Z.yaxis),d.restore()}function De(Z){function ae(Ve,Ne,ot,nt,pt,mt,gt,Pt){for(var Mt=Ve.points,Yt=Ve.pointsize,zt=0;zt<Mt.length;zt+=Yt){var _t=Mt[zt],rt=Mt[zt+1];_t==null||_t<mt.min||_t>mt.max||rt<gt.min||rt>gt.max||(d.beginPath(),_t=mt.p2c(_t),rt=gt.p2c(rt)+nt,Pt=="circle"?d.arc(_t,rt,Ne,0,pt?Math.PI:Math.PI*2,!1):Pt(d,_t,rt,Ne,pt),d.closePath(),ot&&(d.fillStyle=ot,d.fill()),d.stroke())}}d.save(),d.translate(a.left,a.top);var de=Z.points.lineWidth,ve=Z.shadowSize,Ue=Z.points.radius,_e=Z.points.symbol;if(de==0&&(de=1e-4),de>0&&ve>0){var ze=ve/2;d.lineWidth=ze,d.strokeStyle="rgba(0,0,0,0.1)",ae(Z.datapoints,Ue,null,ze+ze/2,!0,Z.xaxis,Z.yaxis,_e),d.strokeStyle="rgba(0,0,0,0.2)",ae(Z.datapoints,Ue,null,ze/2,!0,Z.xaxis,Z.yaxis,_e)}d.lineWidth=de,d.strokeStyle=Z.color,ae(Z.datapoints,Ue,Te(Z.points,Z.color),0,!1,Z.xaxis,Z.yaxis,_e),d.restore()}function pe(Z,ae,de,ve,Ue,_e,ze,Ve,Ne,ot,nt){var pt,mt,gt,Pt,Mt,Yt,zt,_t,rt;ot?(_t=Yt=zt=!0,Mt=!1,pt=de,mt=Z,Pt=ae+ve,gt=ae+Ue,mt<pt&&(rt=mt,mt=pt,pt=rt,Mt=!0,Yt=!1)):(Mt=Yt=zt=!0,_t=!1,pt=Z+ve,mt=Z+Ue,gt=de,Pt=ae,Pt<gt&&(rt=Pt,Pt=gt,gt=rt,_t=!0,zt=!1)),!(mt<ze.min||pt>ze.max||Pt<Ve.min||gt>Ve.max)&&(pt<ze.min&&(pt=ze.min,Mt=!1),mt>ze.max&&(mt=ze.max,Yt=!1),gt<Ve.min&&(gt=Ve.min,_t=!1),Pt>Ve.max&&(Pt=Ve.max,zt=!1),pt=ze.p2c(pt),gt=Ve.p2c(gt),mt=ze.p2c(mt),Pt=Ve.p2c(Pt),_e&&(Ne.fillStyle=_e(gt,Pt),Ne.fillRect(pt,Pt,mt-pt,gt-Pt)),nt>0&&(Mt||Yt||zt||_t)&&(Ne.beginPath(),Ne.moveTo(pt,gt),Mt?Ne.lineTo(pt,Pt):Ne.moveTo(pt,Pt),zt?Ne.lineTo(mt,Pt):Ne.moveTo(mt,Pt),Yt?Ne.lineTo(mt,gt):Ne.moveTo(mt,gt),_t?Ne.lineTo(pt,gt):Ne.moveTo(pt,gt),Ne.stroke()))}function le(Z){function ae(Ue,_e,ze,Ve,Ne,ot){for(var nt=Ue.points,pt=Ue.pointsize,mt=0;mt<nt.length;mt+=pt)nt[mt]!=null&&pe(nt[mt],nt[mt+1],nt[mt+2],_e,ze,Ve,Ne,ot,d,Z.bars.horizontal,Z.bars.lineWidth)}d.save(),d.translate(a.left,a.top),d.lineWidth=Z.bars.lineWidth,d.strokeStyle=Z.color;var de;switch(Z.bars.align){case"left":de=0;break;case"right":de=-Z.bars.barWidth;break;default:de=-Z.bars.barWidth/2}var ve=Z.bars.fill?function(Ue,_e){return Te(Z.bars,Z.color,Ue,_e)}:null;ae(Z.datapoints,de,de+Z.bars.barWidth,ve,Z.xaxis,Z.yaxis),d.restore()}function Te(Z,ae,de,ve){var Ue=Z.fill;if(!Ue)return null;if(Z.fillColor)return be(Z.fillColor,de,ve,ae);var _e=Q.color.parse(ae);return _e.a=typeof Ue=="number"?Ue:.4,_e.normalize(),_e.toString()}function Ee(){if(c.legend.container!=null?Q.find(c.legend.container).html(""):o.find(".legend").remove(),!!c.legend.show){for(var Z=[],ae=[],de=!1,ve=c.legend.labelFormatter,Ue,_e,ze=0;ze<u.length;++ze)Ue=u[ze],Ue.label&&(_e=ve?ve(Ue.label,Ue):Ue.label,_e&&ae.push({label:_e,color:Ue.color}));if(c.legend.sorted)if(Q.isFunction(c.legend.sorted))ae.sort(c.legend.sorted);else if(c.legend.sorted=="reverse")ae.reverse();else{var Ve=c.legend.sorted!="descending";ae.sort(function(Yt,zt){return Yt.label==zt.label?0:Yt.label<zt.label!=Ve?1:-1})}for(var ze=0;ze<ae.length;++ze){var Ne=ae[ze];ze%c.legend.noColumns==0&&(de&&Z.push("</tr>"),Z.push("<tr>"),de=!0),Z.push('<td class="legendColorBox"><div style="border:1px solid '+c.legend.labelBoxBorderColor+';padding:1px"><div style="width:4px;height:0;border:5px solid '+Ne.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+Ne.label+"</td>")}if(de&&Z.push("</tr>"),Z.length!=0){var ot='<table style="font-size:smaller;color:'+c.grid.color+'">'+Z.join("")+"</table>";if(c.legend.container!=null)Q(c.legend.container).html(ot);else{var nt="",pt=c.legend.position,mt=c.legend.margin;mt[0]==null&&(mt=[mt,mt]),pt.charAt(0)=="n"?nt+="top:"+(mt[1]+a.top)+"px;":pt.charAt(0)=="s"&&(nt+="bottom:"+(mt[1]+a.bottom)+"px;"),pt.charAt(1)=="e"?nt+="right:"+(mt[0]+a.right)+"px;":pt.charAt(1)=="w"&&(nt+="left:"+(mt[0]+a.left)+"px;");var gt=Q('<div class="legend">'+ot.replace('style="','style="position:absolute;'+nt+";")+"</div>").appendTo(o);if(c.legend.backgroundOpacity!=0){var Pt=c.legend.backgroundColor;Pt==null&&(Pt=c.grid.backgroundColor,Pt&&typeof Pt=="string"?Pt=Q.color.parse(Pt):Pt=Q.color.extract(gt,"background-color"),Pt.a=1,Pt=Pt.toString());var Mt=gt.children();Q('<div style="position:absolute;width:'+Mt.width()+"px;height:"+Mt.height()+"px;"+nt+"background-color:"+Pt+';"> </div>').prependTo(gt).css("opacity",c.legend.backgroundOpacity)}}}}}var Re=[],me=null;function Me(Z,ae,de){var ve=c.grid.mouseActiveRadius,Ue=ve*ve+1,_e=null,ze=!1,Ve,Ne,ot;for(Ve=u.length-1;Ve>=0;--Ve)if(de(u[Ve])){var nt=u[Ve],pt=nt.xaxis,mt=nt.yaxis,gt=nt.datapoints.points,Pt=pt.c2p(Z),Mt=mt.c2p(ae),Yt=ve/pt.scale,zt=ve/mt.scale;if(ot=nt.datapoints.pointsize,pt.options.inverseTransform&&(Yt=Number.MAX_VALUE),mt.options.inverseTransform&&(zt=Number.MAX_VALUE),nt.lines.show||nt.points.show)for(Ne=0;Ne<gt.length;Ne+=ot){var _t=gt[Ne],rt=gt[Ne+1];if(_t!=null&&!(_t-Pt>Yt||_t-Pt<-Yt||rt-Mt>zt||rt-Mt<-zt)){var It=Math.abs(pt.p2c(_t)-Z),Dn=Math.abs(mt.p2c(rt)-ae),ft=It*It+Dn*Dn;ft<Ue&&(Ue=ft,_e=[Ve,Ne/ot])}}if(nt.bars.show&&!_e){var yt,jt;switch(nt.bars.align){case"left":yt=0;break;case"right":yt=-nt.bars.barWidth;break;default:yt=-nt.bars.barWidth/2}for(jt=yt+nt.bars.barWidth,Ne=0;Ne<gt.length;Ne+=ot){var _t=gt[Ne],rt=gt[Ne+1],cn=gt[Ne+2];_t!=null&&(u[Ve].bars.horizontal?Pt<=Math.max(cn,_t)&&Pt>=Math.min(cn,_t)&&Mt>=rt+yt&&Mt<=rt+jt:Pt>=_t+yt&&Pt<=_t+jt&&Mt>=Math.min(cn,rt)&&Mt<=Math.max(cn,rt))&&(_e=[Ve,Ne/ot])}}}return _e?(Ve=_e[0],Ne=_e[1],ot=u[Ve].datapoints.pointsize,{datapoint:u[Ve].datapoints.points.slice(Ne*ot,(Ne+1)*ot),dataIndex:Ne,series:u[Ve],seriesIndex:Ve}):null}function ye(Z){c.grid.hoverable&&at("plothover",Z,function(ae){return ae.hoverable!=!1})}function Le(Z){c.grid.hoverable&&at("plothover",Z,function(ae){return!1})}function We(Z){b.isSelecting||at("plotclick",Z,function(ae){return ae.clickable!=!1})}function Be(Z){if(Z.cancelable){if(!f.is(Z.target)&&f.has(Z.target).length===0){at("plotleave",Z,function(ae){});return}ye(Ye(Z)),Z.preventDefault()}}function Ye(Z){if(!Z||!Z.originalEvent||Z.pageX&&Z.pageY)return Z;var ae=Z.originalEvent;if(ae.changedTouches.length===0)return Z;var de=ae.changedTouches[0];return Z.pageX=de.pageX,Z.pageY=de.pageY,Z}function at(Z,ae,de){var ve=f.offset(),Ue=ae.pageX-ve.left-a.left,_e=ae.pageY-ve.top-a.top,ze=O({left:Ue,top:_e});ze.pageX=ae.pageX,ze.pageY=ae.pageY,ze.ctrlKey=ae.ctrlKey,ze.metaKey=ae.metaKey;var Ve=Me(Ue,_e,de);if(Ve&&(Ve.pageX=parseInt(Ve.series.xaxis.p2c(Ve.datapoint[0])+ve.left+a.left,10),Ve.pageY=parseInt(Ve.series.yaxis.p2c(Ve.datapoint[1])+ve.top+a.top,10)),c.grid.autoHighlight){for(var Ne=0;Ne<Re.length;++Ne){var ot=Re[Ne];ot.auto==Z&&!(Ve&&ot.series==Ve.series&&ot.point[0]==Ve.datapoint[0]&&ot.point[1]==Ve.datapoint[1])&&He(ot.series,ot.point)}Ve&&Xe(Ve.series,Ve.datapoint,Z)}o.trigger(Z,[ze,Ve])}function st(){var Z=c.interaction.redrawOverlayInterval;if(Z==-1){Ke();return}me||(me=setTimeout(Ke,Z))}function Ke(){me=null,h.save(),l.clear(),h.translate(a.left,a.top);var Z,ae;for(Z=0;Z<Re.length;++Z)ae=Re[Z],ae.series.bars.show?$e(ae.series,ae.point):xe(ae.series,ae.point);h.restore(),C(D.drawOverlay,[h])}function Xe(Z,ae,de){if(typeof Z=="number"&&(Z=u[Z]),typeof ae=="number"){var ve=Z.datapoints.pointsize;ae=Z.datapoints.points.slice(ve*ae,ve*(ae+1))}var Ue=Ge(Z,ae);Ue==-1?(Re.push({series:Z,point:ae,auto:de}),st()):de||(Re[Ue].auto=!1)}function He(Z,ae){if(Z==null&&ae==null){Re=[],st();return}if(typeof Z=="number"&&(Z=u[Z]),typeof ae=="number"){var de=Z.datapoints.pointsize;ae=Z.datapoints.points.slice(de*ae,de*(ae+1))}var ve=Ge(Z,ae);ve!=-1&&(Re.splice(ve,1),st())}function Ge(Z,ae){for(var de=0;de<Re.length;++de){var ve=Re[de];if(ve.series==Z&&ve.point[0]==ae[0]&&ve.point[1]==ae[1])return de}return-1}function xe(Z,ae){var de=ae[0],ve=ae[1],Ue=Z.xaxis,_e=Z.yaxis,ze=typeof Z.highlightColor=="string"?Z.highlightColor:Q.color.parse(Z.color).scale("a",.5).toString();if(!(de<Ue.min||de>Ue.max||ve<_e.min||ve>_e.max)){var Ve=Z.points.radius+Z.points.lineWidth/2;h.lineWidth=Ve,h.strokeStyle=ze;var Ne=1.5*Ve;de=Ue.p2c(de),ve=_e.p2c(ve),h.beginPath(),Z.points.symbol=="circle"?h.arc(de,ve,Ne,0,2*Math.PI,!1):Z.points.symbol(h,de,ve,Ne,!1),h.closePath(),h.stroke()}}function $e(Z,ae){var de=typeof Z.highlightColor=="string"?Z.highlightColor:Q.color.parse(Z.color).scale("a",.5).toString(),ve=de,Ue;switch(Z.bars.align){case"left":Ue=0;break;case"right":Ue=-Z.bars.barWidth;break;default:Ue=-Z.bars.barWidth/2}h.lineWidth=Z.bars.lineWidth,h.strokeStyle=de,pe(ae[0],ae[1],ae[2]||0,Ue,Ue+Z.bars.barWidth,function(){return ve},Z.xaxis,Z.yaxis,h,Z.bars.horizontal,Z.bars.lineWidth)}function be(Z,ae,de,ve){if(typeof Z=="string")return Z;for(var Ue=d.createLinearGradient(0,de,0,ae),_e=0,ze=Z.colors.length;_e<ze;++_e){var Ve=Z.colors[_e];if(typeof Ve!="string"){var Ne=Q.color.parse(ve);Ve.brightness!=null&&(Ne=Ne.scale("rgb",Ve.brightness)),Ve.opacity!=null&&(Ne.a*=Ve.opacity),Ve=Ne.toString()}Ue.addColorStop(_e/(ze-1),Ve)}return Ue}}Q.plot=function(o,s,r){var g=new t(Q(o),s,r,Q.plot.plugins);return g},Q.plot.version="0.8.3",Q.plot.plugins=[],Q.fn.plot=function(o,s){return this.each(function(){Q.plot(this,o,s)})};function n(o,s){return s*Math.floor(o/s)}}(jQuery)},80851:()=>{(function(Q){function A(e){var t={first:{x:-1,y:-1},second:{x:-1,y:-1},show:!1,active:!1},n={},o=null;function s(a){t.active&&(f(a),e.getPlaceholder().trigger("plotselecting",[u()]))}function r(a){a.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}),l(t.first,a),t.active=!0,o=function(v){g(v)},Q(document).one("mouseup",o))}function g(a){return o=null,document.onselectstart!==void 0&&(document.onselectstart=n.onselectstart),document.ondrag!==void 0&&(document.ondrag=n.ondrag),t.active=!1,f(a),m()?c(a):(e.getPlaceholder().trigger("plotunselected",[]),e.getPlaceholder().trigger("plotselecting",[null])),setTimeout(function(){e.isSelecting=!1},10),!1}function u(){if(!m()||!t.show)return null;var a={},v=t.first,E=t.second,D=e.getAxes(),b=!0;return Q.each(D,function(C,y){y.used&&(anyUsed=!1)}),Q.each(D,function(C,y){if(y.used||b){var M=y.c2p(v[y.direction]),T=y.c2p(E[y.direction]);a[C]={from:Math.min(M,T),to:Math.max(M,T)}}}),a}function c(a){var v=u();v.ctrlKey=a.ctrlKey,v.metaKey=a.metaKey,e.getPlaceholder().trigger("plotselected",[v]),v.xaxis&&v.yaxis&&e.getPlaceholder().trigger("selected",[{x1:v.xaxis.from,y1:v.yaxis.from,x2:v.xaxis.to,y2:v.yaxis.to}])}function i(a,v,E){return v<a?a:v>E?E:v}function l(a,v){var E=e.getOptions(),D=e.getPlaceholder().offset(),b=e.getPlotOffset();a.x=i(0,v.pageX-D.left-b.left,e.width()),a.y=i(0,v.pageY-D.top-b.top,e.height()),E.selection.mode=="y"&&(a.x=a==t.first?0:e.width()),E.selection.mode=="x"&&(a.y=a==t.first?0:e.height())}function f(a){a.pageX!=null&&(l(t.second,a),m()?(e.isSelecting=!0,t.show=!0,e.triggerRedrawOverlay()):d(!0))}function d(a){t.show&&(t.show=!1,e.triggerRedrawOverlay(),a||e.getPlaceholder().trigger("plotunselected",[]))}function h(a,v){var E,D,b,C,y=e.getAxes();for(var M in y)if(E=y[M],E.direction==v&&(C=v+E.n+"axis",!a[C]&&E.n==1&&(C=v+"axis"),a[C])){D=a[C].from,b=a[C].to;break}if(a[C]||(E=v=="x"?e.getXAxes()[0]:e.getYAxes()[0],D=a[v+"1"],b=a[v+"2"]),D!=null&&b!=null&&D>b){var T=D;D=b,b=T}return{from:D,to:b,axis:E}}function p(a,v){var E,D,b=e.getOptions();b.selection.mode=="y"?(t.first.x=0,t.second.x=e.width()):(D=h(a,"x"),t.first.x=D.axis.p2c(D.from),t.second.x=D.axis.p2c(D.to)),b.selection.mode=="x"?(t.first.y=0,t.second.y=e.height()):(D=h(a,"y"),t.first.y=D.axis.p2c(D.from),t.second.y=D.axis.p2c(D.to)),t.show=!0,e.triggerRedrawOverlay(),!v&&m()&&c()}function m(){var a=e.getOptions().selection.minSize;return Math.abs(t.second.x-t.first.x)>=a&&Math.abs(t.second.y-t.first.y)>=a}e.clearSelection=d,e.setSelection=p,e.getSelection=u,e.hooks.bindEvents.push(function(a,v){var E=a.getOptions();E.selection.mode!=null&&(v.mousemove(s),v.mousedown(r))}),e.hooks.drawOverlay.push(function(a,v){if(t.show&&m()){var E=a.getPlotOffset(),D=a.getOptions();v.save(),v.translate(E.left,E.top);var b=Q.color.parse(D.selection.color);v.strokeStyle=b.scale("a",.8).toString(),v.lineWidth=1,v.lineJoin=D.selection.shape,v.fillStyle=b.scale("a",.4).toString();var C=Math.min(t.first.x,t.second.x)+.5,y=Math.min(t.first.y,t.second.y)+.5,M=Math.abs(t.second.x-t.first.x)-1,T=Math.abs(t.second.y-t.first.y)-1;v.fillRect(C,y,M,T),v.strokeRect(C,y,M,T),v.restore()}}),e.hooks.shutdown.push(function(a,v){v.unbind("mousemove",s),v.unbind("mousedown",r),o&&(Q(document).unbind("mouseup",o),document.onselectstart!==void 0&&(document.onselectstart=n.onselectstart),document.ondrag!==void 0&&(document.ondrag=n.ondrag))})}Q.plot.plugins.push({init:A,options:{selection:{mode:null,color:"#e8cfac",shape:"round",minSize:5}},name:"selection",version:"1.1"})})(jQuery)},31221:()=>{(function(Q){var A={series:{stack:null}};function e(t){function n(s,r){for(var g=null,u=0;u<r.length&&s!=r[u];++u)r[u].stack==s.stack&&(g=r[u]);return g}function o(s,r,g){if(!(r.stack==null||r.stack===!1)){var u=n(r,s.getData());if(u){for(var c=g.pointsize,i=g.points,l=u.datapoints.pointsize,f=u.datapoints.points,d=[],h,p,m,a,v,E,D=r.lines.show,b=r.bars.horizontal,C=c>2&&(b?g.format[2].x:g.format[2].y),y=D&&r.lines.steps,M=b?1:0,T=b?0:1,I=0,x=0,S,O;!(I>=i.length&&x>=f.length);){if(S=d.length,I<i.length&&i[I]==null){for(O=0;O<c;++O)d.push(i[I+O]);I+=c}else if(I>=i.length){for(O=0;O<c;++O)d.push(f[x+O]);C&&(d[S+2]=f[x+T]),x+=l}else if(x>=f.length){for(O=0;O<c;++O)d.push(i[I+O]);I+=c}else if(x<f.length&&f[x]==null)x+=l;else{if(h=i[I+M],p=i[I+T],a=f[x+M],v=f[x+T],E=0,h==a){for(O=0;O<c;++O)d.push(i[I+O]);d[S+T]+=v,E=v,I+=c,x+=l}else if(h>a){if(I==0){for(O=0;O<c;++O)d.push(f[x+O]);E=v}if(I>0&&i[I-c]!=null){for(m=0,d.push(a),d.push(m+v),O=2;O<c;++O)d.push(i[I+O]);E=v}x+=l}else{for(O=0;O<c;++O)d.push(i[I+O]);x>0&&f[x-l]!=null&&(E=0),d[S+T]+=E,I+=c}fromgap=!1,S!=d.length&&C&&(d[S+2]=E)}if(y&&S!=d.length&&S>0&&d[S]!=null&&d[S]!=d[S-c]&&d[S+1]!=d[S-c+1]){for(O=0;O<c;++O)d[S+c+O]=d[S+O];d[S+1]=d[S-c+1]}}g.points=d}}}t.hooks.processDatapoints.push(o)}Q.plot.plugins.push({init:e,options:A,name:"stack",version:"1.2"})})(jQuery)},91520:()=>{(function(Q){var A={series:{stackpercent:null}};function e(t){var n={},o=!1,s={};function r(c,i,l,f){if(o||(o=!0,s=g(c.getData())),i.stackpercent==!0){var d=l.length;i.percents=[];var h=0,p=1;i.bars&&i.bars.horizontal&&i.bars.horizontal===!0&&(h=1,p=0);for(var m=0;m<d;m++){var a=s[l[m][h]+""];a>0?i.percents.push(l[m][p]*100/a):i.percents.push(0)}}}function g(c){var i=c.length,l={};if(i>0){for(var f=0;f<i;f++)if(c[f].stackpercent){var d=0,h=1;c[f].bars&&c[f].bars.horizontal&&c[f].bars.horizontal===!0&&(d=1,h=0);for(var p=c[f].data.length,m=0;m<p;m++){var a=0;c[f].data[m][1]!=null&&(a=c[f].data[m][h]),l[c[f].data[m][d]+""]?l[c[f].data[m][d]+""]+=a:l[c[f].data[m][d]+""]=a}}}return l}function u(c,i,l){if(i.stackpercent){o||(s=g(c.getData()));var f=[],d=0,h=1;i.bars&&i.bars.horizontal&&i.bars.horizontal===!0&&(d=1,h=0);for(var p=0;p<l.points.length;p+=3)n[l.points[p+d]]||(n[l.points[p+d]]=0),f[p+d]=l.points[p+d],f[p+h]=l.points[p+h]+n[l.points[p+d]],f[p+2]=n[l.points[p+d]],n[l.points[p+d]]+=l.points[p+h],s[f[p+d]+""]>0?(f[p+h]=f[p+h]*100/s[f[p+d]+""],f[p+2]=f[p+2]*100/s[f[p+d]+""]):(f[p+h]=0,f[p+2]=0);l.points=f}}t.hooks.processRawData.push(r),t.hooks.processDatapoints.push(u)}Q.plot.plugins.push({init:e,options:A,name:"stackpercent",version:"0.1"})})(jQuery)},32176:()=>{(function(Q){var A={xaxis:{timezone:null,timeformat:null,twelveHourClock:!1,monthNames:null}};function e(i,l){return l*Math.floor(i/l)}function t(i,l,f,d){if(typeof i.strftime=="function")return i.strftime(l);var h=function(C,y){return C=""+C,y=""+(y??"0"),C.length==1?y+C:C},p=[],m=!1,a=i.getHours(),v=a<12;f==null&&(f=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]),d==null&&(d=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]);var E;a>12?E=a-12:a==0?E=12:E=a;for(var D=0;D<l.length;++D){var b=l.charAt(D);if(m){switch(b){case"a":b=""+d[i.getDay()];break;case"b":b=""+f[i.getMonth()];break;case"d":b=h(i.getDate(),"");break;case"e":b=h(i.getDate()," ");break;case"h":case"H":b=h(a);break;case"I":b=h(E);break;case"l":b=h(E," ");break;case"m":b=h(i.getMonth()+1,"");break;case"M":b=h(i.getMinutes());break;case"q":b=""+(Math.floor(i.getMonth()/3)+1);break;case"S":b=h(i.getSeconds());break;case"y":b=h(i.getFullYear()%100);break;case"Y":b=""+i.getFullYear();break;case"p":b=v?"am":"pm";break;case"P":b=v?"AM":"PM";break;case"w":b=""+i.getDay();break}p.push(b),m=!1}else b=="%"?m=!0:p.push(b)}return p.join("")}function n(i){function l(p,m,a,v){p[m]=function(){return a[v].apply(a,arguments)}}var f={date:i};i.strftime!=null&&l(f,"strftime",i,"strftime"),l(f,"getTime",i,"getTime"),l(f,"setTime",i,"setTime");for(var d=["Date","Day","FullYear","Hours","Milliseconds","Minutes","Month","Seconds"],h=0;h<d.length;h++)l(f,"get"+d[h],i,"getUTC"+d[h]),l(f,"set"+d[h],i,"setUTC"+d[h]);return f}function o(i,l){if(l.timezone=="browser")return new Date(i);if(!l.timezone||l.timezone=="utc")return n(new Date(i));if(typeof timezoneJS<"u"&&typeof timezoneJS.Date<"u"){var f=new timezoneJS.Date;return f.setTimezone(l.timezone),f.setTime(i),f}else return n(new Date(i))}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"]]),u=r.concat([[1,"quarter"],[2,"quarter"],[1,"year"]]);function c(i){i.hooks.processOptions.push(function(l,f){Q.each(l.getAxes(),function(d,h){var p=h.options;p.mode=="time"&&(h.tickGenerator=function(m){var a=[],v=o(m.min,p),E=0,D=p.tickSize&&p.tickSize[1]==="quarter"||p.minTickSize&&p.minTickSize[1]==="quarter"?u:g;p.minTickSize!=null&&(typeof p.tickSize=="number"?E=p.tickSize:E=p.minTickSize[0]*s[p.minTickSize[1]]);for(var b=0;b<D.length-1&&!(m.delta<(D[b][0]*s[D[b][1]]+D[b+1][0]*s[D[b+1][1]])/2&&D[b][0]*s[D[b][1]]>=E);++b);var C=D[b][0],y=D[b][1];if(y=="year"){if(p.minTickSize!=null&&p.minTickSize[1]=="year")C=Math.floor(p.minTickSize[0]);else{var M=Math.pow(10,Math.floor(Math.log(m.delta/s.year)/Math.LN10)),T=m.delta/s.year/M;T<1.5?C=1:T<3?C=2:T<7.5?C=5:C=10,C*=M}C<1&&(C=1)}m.tickSize=p.tickSize||[C,y];var I=m.tickSize[0];y=m.tickSize[1];var x=I*s[y];y=="second"?v.setSeconds(e(v.getSeconds(),I)):y=="minute"?v.setMinutes(e(v.getMinutes(),I)):y=="hour"?v.setHours(e(v.getHours(),I)):y=="month"?v.setMonth(e(v.getMonth(),I)):y=="quarter"?v.setMonth(3*e(v.getMonth()/3,I)):y=="year"&&v.setFullYear(e(v.getFullYear(),I)),v.setMilliseconds(0),x>=s.minute&&v.setSeconds(0),x>=s.hour&&v.setMinutes(0),x>=s.day&&v.setHours(0),x>=s.day*4&&v.setDate(1),x>=s.month*2&&v.setMonth(e(v.getMonth(),3)),x>=s.quarter*2&&v.setMonth(e(v.getMonth(),6)),x>=s.year&&v.setMonth(0);var S=0,O=Number.NaN,P;do if(P=O,O=v.getTime(),a.push(O),y=="month"||y=="quarter")if(I<1){v.setDate(1);var L=v.getTime();v.setMonth(v.getMonth()+(y=="quarter"?3:1));var U=v.getTime();v.setTime(O+S*s.hour+(U-L)*I),S=v.getHours(),v.setHours(0)}else v.setMonth(v.getMonth()+I*(y=="quarter"?3:1));else y=="year"?v.setFullYear(v.getFullYear()+I):v.setTime(O+x);while(O<m.max&&O!=P);return a},h.tickFormatter=function(m,a){var v=o(m,a.options);if(p.timeformat!=null)return t(v,p.timeformat,p.monthNames,p.dayNames);var E=a.options.tickSize&&a.options.tickSize[1]=="quarter"||a.options.minTickSize&&a.options.minTickSize[1]=="quarter",D=a.tickSize[0]*s[a.tickSize[1]],b=a.max-a.min,C=p.twelveHourClock?" %p":"",y=p.twelveHourClock?"%I":"%H",M;D<s.minute?M=y+":%M:%S"+C:D<s.day?b<2*s.day?M=y+":%M"+C:M="%b %d "+y+":%M"+C:D<s.month?M="%b %d":E&&D<s.quarter||!E&&D<s.year?b<s.year?M="%b":M="%b %Y":E&&D<s.year?b<s.year?M="Q%q":M="Q%q %Y":M="%Y";var T=t(v,M,p.monthNames,p.dayNames);return T})})})}Q.plot.plugins.push({init:c,options:A,name:"time",version:"1.0"}),Q.plot.formatDate=t})(jQuery)}}]); //# sourceMappingURL=5017.003cacead1bba1cba035.js.map
Edit
Rename
Chmod
Delete
FILE
FOLDER
INFO
Name
Size
Permission
Action
static
---
0755
0.c88fc16b6533c8976681.js
11857 bytes
0644
0.c88fc16b6533c8976681.js.map
46011 bytes
0644
1118.6d1cbbd2070e00a7483d.js
9459 bytes
0644
1118.6d1cbbd2070e00a7483d.js.map
22012 bytes
0644
1121.6c31bf81768d3312b0d4.js
11557 bytes
0644
1121.6c31bf81768d3312b0d4.js.map
40274 bytes
0644
1122.1b3b5a9bdf4a2fc70a83.js
4310 bytes
0644
1122.1b3b5a9bdf4a2fc70a83.js.map
9301 bytes
0644
1133.cd705902767ed2e9bf55.js
107191 bytes
0644
1133.cd705902767ed2e9bf55.js.map
459177 bytes
0644
1216.ddb58ad09e0c4e3f4079.js
12860 bytes
0644
1216.ddb58ad09e0c4e3f4079.js.map
47906 bytes
0644
1282.2347f27d5b3a18a42a1e.js
2965 bytes
0644
1282.2347f27d5b3a18a42a1e.js.map
6699 bytes
0644
1345.8570fef914aafab94513.js
2223 bytes
0644
1345.8570fef914aafab94513.js.map
5201 bytes
0644
1347.8ad23b870a6e21306189.js
32035 bytes
0644
1347.8ad23b870a6e21306189.js.map
89851 bytes
0644
1420.f2553cafc235b7c32261.js
14576 bytes
0644
1420.f2553cafc235b7c32261.js.map
32839 bytes
0644
1438.897db349b7f48a15b9eb.js
2830 bytes
0644
1438.897db349b7f48a15b9eb.js.map
6911 bytes
0644
1446.babd36e7134aac1046c4.js
1832 bytes
0644
1446.babd36e7134aac1046c4.js.map
3282 bytes
0644
1488.ff35935a06f41b02b6cc.js
316 bytes
0644
1488.ff35935a06f41b02b6cc.js.map
1206 bytes
0644
1560.30962127c91e5eae9982.js
8916 bytes
0644
1560.30962127c91e5eae9982.js.map
20515 bytes
0644
1660.e1f66118fb028d12074f.js
21866 bytes
0644
1660.e1f66118fb028d12074f.js.map
71039 bytes
0644
1698.68ff1ef08e94a87836b3.js
12570 bytes
0644
1698.68ff1ef08e94a87836b3.js.map
46006 bytes
0644
1708.f42a783c0f6c7a317d49.js
2249 bytes
0644
1708.f42a783c0f6c7a317d49.js.map
2954 bytes
0644
1710.d96221051fceaf8c89dd.js
10172 bytes
0644
1710.d96221051fceaf8c89dd.js.map
22097 bytes
0644
1740.e57d920c47a11759ade4.js
6204 bytes
0644
1740.e57d920c47a11759ade4.js.map
13740 bytes
0644
1888.0ede69d3190c536744b9.js
6822 bytes
0644
1888.0ede69d3190c536744b9.js.map
15421 bytes
0644
1914.58113477b565d57e8bfe.js
10710 bytes
0644
1914.58113477b565d57e8bfe.js.map
23555 bytes
0644
198.b84c0e4f5759344ae05a.js
8267 bytes
0644
198.b84c0e4f5759344ae05a.js.map
19446 bytes
0644
205.6c51b5e35c8147226738.js
3542 bytes
0644
205.6c51b5e35c8147226738.js.map
8376 bytes
0644
2058.0e5df44647184aaf02e2.js
1252 bytes
0644
2058.0e5df44647184aaf02e2.js.map
4744 bytes
0644
2077.12b2df3682085a92a810.js
34133 bytes
0644
2077.12b2df3682085a92a810.js.map
122011 bytes
0644
2094.259625d8acf28b9c7361.js
16518 bytes
0644
2094.259625d8acf28b9c7361.js.map
41269 bytes
0644
21.afca69f2d336e287a655.js
6172 bytes
0644
21.afca69f2d336e287a655.js.map
17305 bytes
0644
2136.9c8dcd43d3af327f51f5.js
498667 bytes
0644
2136.9c8dcd43d3af327f51f5.js.map
1908011 bytes
0644
2228.cf629cf4a83c5b6c2671.js
269 bytes
0644
2228.cf629cf4a83c5b6c2671.js.map
457 bytes
0644
2244.9324c28eca7d2ffb7568.js
3396 bytes
0644
2244.9324c28eca7d2ffb7568.js.map
7683 bytes
0644
2261.ac6a26854d5acee00776.js
106373 bytes
0644
2261.ac6a26854d5acee00776.js.map
478562 bytes
0644
2278.bdd73b14b6337c6b14e4.js
5754 bytes
0644
2278.bdd73b14b6337c6b14e4.js.map
13399 bytes
0644
2398.3de0e7aa3057b7dcf9da.js
8016 bytes
0644
2398.3de0e7aa3057b7dcf9da.js.map
18383 bytes
0644
2514.c86950e9813e27962050.js
1983 bytes
0644
2514.c86950e9813e27962050.js.map
4863 bytes
0644
2571.345ecfd2b82551018f2e.js
162139 bytes
0644
2571.345ecfd2b82551018f2e.js.map
2046 bytes
0644
2586.972e9a7d564398afee76.js
6385 bytes
0644
2586.972e9a7d564398afee76.js.map
14676 bytes
0644
2658.f4100815829c4d37d35c.js
5432 bytes
0644
2658.f4100815829c4d37d35c.js.map
13650 bytes
0644
2686.2fbaa7db9c01d59cad8d.js
2815 bytes
0644
2686.2fbaa7db9c01d59cad8d.js.map
6564 bytes
0644
2692.20098ad0182743d98d62.js
2282 bytes
0644
2692.20098ad0182743d98d62.js.map
5680 bytes
0644
2694.a31d749361a36eb167da.js
2726 bytes
0644
2694.a31d749361a36eb167da.js.map
3618 bytes
0644
2745.2e5ec1fdf377d2940fb4.js
33584 bytes
0644
2745.2e5ec1fdf377d2940fb4.js.map
120277 bytes
0644
2962.4c3147d8ee365fe296ef.js
7640 bytes
0644
2962.4c3147d8ee365fe296ef.js.map
17621 bytes
0644
3042.248a4194805a8500fd28.js
19010 bytes
0644
3042.248a4194805a8500fd28.js.map
38148 bytes
0644
3062.4e9a427c2a59d53f902e.js
4663 bytes
0644
3062.4e9a427c2a59d53f902e.js.map
10650 bytes
0644
3082.c09cff56c35d736ee8b6.js
52872 bytes
0644
3082.c09cff56c35d736ee8b6.js.map
56822 bytes
0644
3096.8d41728a4f5010bc56a2.js
4378 bytes
0644
3096.8d41728a4f5010bc56a2.js.map
10739 bytes
0644
3098.f22ad6dab13d06477be0.js
31462 bytes
0644
3098.f22ad6dab13d06477be0.js.map
85588 bytes
0644
3182.1d531f28507c00e391fc.js
13817 bytes
0644
3182.1d531f28507c00e391fc.js.map
26653 bytes
0644
3407.666eb88a718e66b93f72.js
34425 bytes
0644
3407.666eb88a718e66b93f72.js.map
103716 bytes
0644
3418.d31d882b87bd5a2ef66f.js
33061 bytes
0644
3418.d31d882b87bd5a2ef66f.js.map
114234 bytes
0644
3541.8d063e3d43d55745d89b.js
20582 bytes
0644
3541.8d063e3d43d55745d89b.js.map
67154 bytes
0644
3543.eecef49ce94da5ee0418.js
136752 bytes
0644
3543.eecef49ce94da5ee0418.js.map
446118 bytes
0644
3622.976b1aef94b333e450b9.js
1260 bytes
0644
3622.976b1aef94b333e450b9.js.map
2819 bytes
0644
3686.102abfc00452299017bb.js
87 bytes
0644
3718.3993946b7a0eb8f64b4d.js
23620 bytes
0644
3718.3993946b7a0eb8f64b4d.js.map
92024 bytes
0644
3726.3adfe210678d2cd26969.js
31765 bytes
0644
3726.3adfe210678d2cd26969.js.map
118227 bytes
0644
398.4e93ffb675609ea7a9c6.js
2990 bytes
0644
398.4e93ffb675609ea7a9c6.js.map
7145 bytes
0644
4114.953b39a9ce57caa0e87a.js
2536 bytes
0644
4114.953b39a9ce57caa0e87a.js.map
6028 bytes
0644
4120.67bf5d203ed4a2eb5f1b.js
3229 bytes
0644
4120.67bf5d203ed4a2eb5f1b.js.map
7533 bytes
0644
4209.c7060d489834063658f5.js
17352 bytes
0644
4209.c7060d489834063658f5.js.map
30980 bytes
0644
4254.c5f4a5512b252e3a5796.js
71716 bytes
0644
4254.c5f4a5512b252e3a5796.js.map
237783 bytes
0644
4289.d5662b0904798ff437e9.js
16496 bytes
0644
4289.d5662b0904798ff437e9.js.map
32015 bytes
0644
4334.bc078c368a20ed3257b6.js
2598 bytes
0644
4334.bc078c368a20ed3257b6.js.map
6308 bytes
0644
4630.b604ea691184ba563d59.js
5585 bytes
0644
4630.b604ea691184ba563d59.js.map
11866 bytes
0644
4680.358dfdd92851f69ecc97.js
4573 bytes
0644
4680.358dfdd92851f69ecc97.js.map
10841 bytes
0644
4698.696713071ff5d9929a11.js
3682 bytes
0644
4698.696713071ff5d9929a11.js.map
8967 bytes
0644
4787.bd938ea7cb58d64ee246.js
738 bytes
0644
4787.bd938ea7cb58d64ee246.js.map
2168 bytes
0644
4839.17a10e0ceca3eb8954b4.js
39585 bytes
0644
4839.17a10e0ceca3eb8954b4.js.map
145699 bytes
0644
494.8cf705bc1ea509187c88.js
3796 bytes
0644
494.8cf705bc1ea509187c88.js.map
8987 bytes
0644
4958.cd447d877778fc5af081.js
4923 bytes
0644
4958.cd447d877778fc5af081.js.map
11000 bytes
0644
4962.0da526ad79f816a15985.js
2242 bytes
0644
4962.0da526ad79f816a15985.js.map
4978 bytes
0644
50.7b1e44d5b9dbbed566be.js
617497 bytes
0644
50.7b1e44d5b9dbbed566be.js.map
2271464 bytes
0644
5017.003cacead1bba1cba035.js
3567142 bytes
0644
5017.003cacead1bba1cba035.js.map
13214665 bytes
0644
5130.4d31108de97088a3b014.js
2850 bytes
0644
5130.4d31108de97088a3b014.js.map
6536 bytes
0644
5196.064b914693b6a5591a48.js
4035 bytes
0644
5196.064b914693b6a5591a48.js.map
10273 bytes
0644
5240.eceb5f73f807ac22d800.js
704 bytes
0644
5240.eceb5f73f807ac22d800.js.map
2618 bytes
0644
5277.ce6608b6f47246e32767.js
269 bytes
0644
5277.ce6608b6f47246e32767.js.map
457 bytes
0644
5280.4348c762594edebf7d0e.js
16657 bytes
0644
5280.4348c762594edebf7d0e.js.map
89146 bytes
0644
5356.eabc0dc2021a3814a65f.js
10156 bytes
0644
5356.eabc0dc2021a3814a65f.js.map
25249 bytes
0644
5358.7c5e9e1b192582f3082d.js
6173 bytes
0644
5358.7c5e9e1b192582f3082d.js.map
19652 bytes
0644
5364.ac21c32fd45a27bc998a.js
3070 bytes
0644
5364.ac21c32fd45a27bc998a.js.map
7368 bytes
0644
5398.d0c11aa7c1232f4afe44.js
81872 bytes
0644
5398.d0c11aa7c1232f4afe44.js.map
769414 bytes
0644
5428.e85b0800b30feca9d7dc.js
330175 bytes
0644
5428.e85b0800b30feca9d7dc.js.map
530929 bytes
0644
5511.93023985e5c5efe49ae2.js
21275 bytes
0644
5511.93023985e5c5efe49ae2.js.map
93188 bytes
0644
5550.9284e42acc3f2bbdfc9d.js
7039 bytes
0644
5550.9284e42acc3f2bbdfc9d.js.map
16382 bytes
0644
558.701e8b4db7b852c4a10d.js
12211 bytes
0644
558.701e8b4db7b852c4a10d.js.map
24505 bytes
0644
5618.638c32d58d896f3f7261.js
3348 bytes
0644
5618.638c32d58d896f3f7261.js.map
8181 bytes
0644
5648.cb3fd92dbbc06f7d45d2.js
57392 bytes
0644
5648.cb3fd92dbbc06f7d45d2.js.map
60585 bytes
0644
5786.db7abc3b8e4f474a8f7b.js
5325 bytes
0644
5786.db7abc3b8e4f474a8f7b.js.map
11885 bytes
0644
5807.f05d997ece5811bbc849.js
2922915 bytes
0644
5807.f05d997ece5811bbc849.js.map
10524334 bytes
0644
5950.30ec6aaa9dcece6c3b3c.js
4616249 bytes
0644
5950.30ec6aaa9dcece6c3b3c.js.map
19277501 bytes
0644
6018.f4de7ac19ac8f0c774e6.js
5861 bytes
0644
6018.f4de7ac19ac8f0c774e6.js.map
13314 bytes
0644
6029.0549a3fcb50e73c4b256.js
409895 bytes
0644
6029.0549a3fcb50e73c4b256.js.map
998408 bytes
0644
6185.883629fcc773b4968b24.js
2258 bytes
0644
6185.883629fcc773b4968b24.js.map
4788 bytes
0644
6263.e4ef9aaa3073ebacc3a5.js
54594 bytes
0644
6263.e4ef9aaa3073ebacc3a5.js.map
242030 bytes
0644
6302.257b2eb06c25ee74090e.js
8440 bytes
0644
6302.257b2eb06c25ee74090e.js.map
19322 bytes
0644
6359.f824c85233ec703f8cea.js
11411 bytes
0644
6359.f824c85233ec703f8cea.js.map
41881 bytes
0644
6377.45d36c143a694fc45bd3.js
20571 bytes
0644
6377.45d36c143a694fc45bd3.js.map
79590 bytes
0644
6378.27b1e6d863a0a3b85962.js
977993 bytes
0644
6378.27b1e6d863a0a3b85962.js.map
3865587 bytes
0644
6414.192cf271de6ecbbbcb11.js
3984 bytes
0644
6414.192cf271de6ecbbbcb11.js.map
9134 bytes
0644
6446.b4b93ee91aa1bb57ea93.js
7731 bytes
0644
6446.b4b93ee91aa1bb57ea93.js.map
17485 bytes
0644
6464.f379e014f9909e621de6.js
34429 bytes
0644
6464.f379e014f9909e621de6.js.map
113303 bytes
0644
6499.9f52e0855fd4782a8b45.js
78297 bytes
0644
6499.9f52e0855fd4782a8b45.js.map
273155 bytes
0644
6587.bfb1ca0c32c6f325b0df.js
135004 bytes
0644
6587.bfb1ca0c32c6f325b0df.js.map
541974 bytes
0644
660.838743295c2108f3492d.js
43101 bytes
0644
660.838743295c2108f3492d.js.map
100340 bytes
0644
6678.a615dbe07b8a3e591e66.js
14725 bytes
0644
6678.a615dbe07b8a3e591e66.js.map
51145 bytes
0644
680.1a328432fae403eacab3.js
53846 bytes
0644
680.1a328432fae403eacab3.js.map
57615 bytes
0644
6830.0c200fec1efc2be388e2.js
5811 bytes
0644
6830.0c200fec1efc2be388e2.js.map
13972 bytes
0644
6934.fa19d392db34411fb300.js
168944 bytes
0644
6934.fa19d392db34411fb300.js.map
540337 bytes
0644
6940.9c5d3a2dcf9d7d58fa2c.js
3408 bytes
0644
6940.9c5d3a2dcf9d7d58fa2c.js.map
8039 bytes
0644
6969.f8f153735314f9426000.js
1119 bytes
0644
6969.f8f153735314f9426000.js.map
4230 bytes
0644
6990.cc2f5674128929a3f870.js
4418 bytes
0644
6990.cc2f5674128929a3f870.js.map
10503 bytes
0644
7048.117de444b1e1cb5a1360.js
4365 bytes
0644
7048.117de444b1e1cb5a1360.js.map
10316 bytes
0644
7166.480da6892ee84ee8bb53.js
593985 bytes
0644
7166.480da6892ee84ee8bb53.js.map
2430098 bytes
0644
7200.dc60128b9d612fc7b5b0.js
3634 bytes
0644
7200.dc60128b9d612fc7b5b0.js.map
8184 bytes
0644
7246.3adf293a34fa2043387b.js
4306 bytes
0644
7246.3adf293a34fa2043387b.js.map
9084 bytes
0644
7400.024c96bd5b99b8b47a63.js
14112 bytes
0644
7400.024c96bd5b99b8b47a63.js.map
64001 bytes
0644
7409.24316c87d08c1053c46a.js
3287 bytes
0644
7409.24316c87d08c1053c46a.js.map
11649 bytes
0644
7455.845968885abe369e6479.js
19801 bytes
0644
7455.845968885abe369e6479.js.map
77213 bytes
0644
7466.09e6e197d2507f62097d.js
11670 bytes
0644
7466.09e6e197d2507f62097d.js.map
24830 bytes
0644
7515.95323f0dfbd0de010e5c.js
1083 bytes
0644
7515.95323f0dfbd0de010e5c.js.map
1321 bytes
0644
7613.6334cff4df12cc157522.js
808779 bytes
0644
7613.6334cff4df12cc157522.js.map
991378 bytes
0644
7836.6a7e4207e70fc2dc235f.js
7192 bytes
0644
7836.6a7e4207e70fc2dc235f.js.map
17613 bytes
0644
7882.1a3cc418752c83396970.js
3743 bytes
0644
7882.1a3cc418752c83396970.js.map
14950 bytes
0644
7886.485c46f14540aa23cf70.js
8668 bytes
0644
7886.485c46f14540aa23cf70.js.map
20124 bytes
0644
7914.2b1a06c504df18e20fe4.js
2390 bytes
0644
7914.2b1a06c504df18e20fe4.js.map
6418 bytes
0644
7982.6761217193d3060dbf0e.js
188973 bytes
0644
7982.6761217193d3060dbf0e.js.map
1737667 bytes
0644
8054.094788468423bb88ee68.js
38124 bytes
0644
8054.094788468423bb88ee68.js.map
132296 bytes
0644
8107.92bd414247a1d05c014f.js
5144 bytes
0644
8107.92bd414247a1d05c014f.js.map
15320 bytes
0644
8230.2eedae6021a4715c6dea.js
2413 bytes
0644
8230.2eedae6021a4715c6dea.js.map
5812 bytes
0644
8332.f4b05d2f028641445650.js
3177 bytes
0644
8332.f4b05d2f028641445650.js.map
7186 bytes
0644
8334.c95ec0eb6900c0cf7e89.js
7803 bytes
0644
8334.c95ec0eb6900c0cf7e89.js.map
17714 bytes
0644
8390.1fd9505094c8cf8830ab.js
2096 bytes
0644
8390.1fd9505094c8cf8830ab.js.map
5157 bytes
0644
84.a6f8658e6a033d642231.js
30608 bytes
0644
84.a6f8658e6a033d642231.js.map
142543 bytes
0644
8494.4470c87b7093ddf70db7.js
2180 bytes
0644
8494.4470c87b7093ddf70db7.js.map
4863 bytes
0644
8542.1391ab96a455b01963a7.js
1514 bytes
0644
8542.1391ab96a455b01963a7.js.map
3249 bytes
0644
8566.e05562713181c6ca30fe.js
3852 bytes
0644
8566.e05562713181c6ca30fe.js.map
8781 bytes
0644
8730.3dcdd8cbf22c63b45d78.js
2109 bytes
0644
8730.3dcdd8cbf22c63b45d78.js.map
2893 bytes
0644
8786.1b0e43b80c82c73e2096.js
1535 bytes
0644
8786.1b0e43b80c82c73e2096.js.map
4055 bytes
0644
8902.37d0b14aa6ef24687b7b.js
2673 bytes
0644
8902.37d0b14aa6ef24687b7b.js.map
5993 bytes
0644
8990.5a822b8788ebf0bdba81.js
3969 bytes
0644
8990.5a822b8788ebf0bdba81.js.map
9161 bytes
0644
9034.200fc7a09b466256c9a9.js
3486 bytes
0644
9034.200fc7a09b466256c9a9.js.map
8180 bytes
0644
9038.7ae2448b9cc5c423aeca.js
4937 bytes
0644
9038.7ae2448b9cc5c423aeca.js.map
11973 bytes
0644
9118.3121c6b96ec7dc211973.js
48311 bytes
0644
9118.3121c6b96ec7dc211973.js.map
62149 bytes
0644
9150.9eb62d45f9b21cb38850.js
10056 bytes
0644
9150.9eb62d45f9b21cb38850.js.map
21143 bytes
0644
9199.9897e268d6d13e834d4c.js
2307 bytes
0644
9199.9897e268d6d13e834d4c.js.map
8853 bytes
0644
9320.c403e78b78aa6df1d0bd.js
336139 bytes
0644
9320.c403e78b78aa6df1d0bd.js.map
1624993 bytes
0644
9355.421530b20c759bb75633.js
22098 bytes
0644
9355.421530b20c759bb75633.js.map
66961 bytes
0644
9384.a0d5fc49f1b15b3e311e.js
2855 bytes
0644
9384.a0d5fc49f1b15b3e311e.js.map
3717 bytes
0644
9390.fa2af7f3d3d9600c08ee.js
4201 bytes
0644
9390.fa2af7f3d3d9600c08ee.js.map
9682 bytes
0644
946.f2494c0c39a9590349b9.js
9194 bytes
0644
946.f2494c0c39a9590349b9.js.map
22193 bytes
0644
9510.4cfa85a51931dc20573a.js
2949 bytes
0644
9510.4cfa85a51931dc20573a.js.map
6939 bytes
0644
9521.de2a74ca5eb365810ca5.js
46306 bytes
0644
9521.de2a74ca5eb365810ca5.js.map
51040 bytes
0644
9538.996ade7a03ccdb01942d.js
64493 bytes
0644
9538.996ade7a03ccdb01942d.js.map
49212 bytes
0644
9569.a8d60b39654a160cb917.js
27965 bytes
0644
9569.a8d60b39654a160cb917.js.map
99160 bytes
0644
9643.b408884004ca73c102bc.js
627 bytes
0644
9643.b408884004ca73c102bc.js.map
2195 bytes
0644
968.22e079d28acb4131d34c.js
4001 bytes
0644
968.22e079d28acb4131d34c.js.map
9740 bytes
0644
970.a61e37b9b897c8098261.js
5239 bytes
0644
970.a61e37b9b897c8098261.js.map
13858 bytes
0644
9711.d6e977bd60f0e5ba673d.js
13555 bytes
0644
9711.d6e977bd60f0e5ba673d.js.map
43973 bytes
0644
9737.3340c89ea96d33307cc7.js
1001 bytes
0644
9737.3340c89ea96d33307cc7.js.map
3504 bytes
0644
9739.5a801055fcf72bf4d06f.js
1147 bytes
0644
9739.5a801055fcf72bf4d06f.js.map
4390 bytes
0644
9772.49e918c9331237552c0b.js
141 bytes
0644
9772.49e918c9331237552c0b.js.map
416 bytes
0644
9838.b8f01dc360f0c2151291.js
4003 bytes
0644
9838.b8f01dc360f0c2151291.js.map
8118 bytes
0644
AdminAuthentication.b7044adf53b669e61a87.js
22504 bytes
0644
AdminAuthentication.b7044adf53b669e61a87.js.map
67352 bytes
0644
AdminEditOrgPage.96fb6c37346641f44246.js
6369 bytes
0644
AdminEditOrgPage.96fb6c37346641f44246.js.map
20602 bytes
0644
AdminFeatureTogglesPage.22157fe31f358f1c4f09.js
4939 bytes
0644
AdminFeatureTogglesPage.22157fe31f358f1c4f09.js.map
16531 bytes
0644
AdminListOrgsPage.f01c8496fd635e20124b.js
2702 bytes
0644
AdminListOrgsPage.f01c8496fd635e20124b.js.map
7735 bytes
0644
AdminSettings.845c6def917892a0c1f9.js
1903 bytes
0644
AdminSettings.845c6def917892a0c1f9.js.map
5580 bytes
0644
AlertAmRoutes.10a0d9a23a082caf12c8.js
54554 bytes
0644
AlertAmRoutes.10a0d9a23a082caf12c8.js.map
208792 bytes
0644
AlertGroups.efd523dc41621f9f7935.js
10088 bytes
0644
AlertGroups.efd523dc41621f9f7935.js.map
39108 bytes
0644
AlertRuleListIndex.f0b17a6119cc5ea575ed.js
44623 bytes
0644
AlertRuleListIndex.f0b17a6119cc5ea575ed.js.map
156842 bytes
0644
AlertRuleListLegacy.8e675db4469232c87308.js
6270 bytes
0644
AlertRuleListLegacy.8e675db4469232c87308.js.map
18086 bytes
0644
AlertSilences.4ff252ad4c0057124d5d.js
24687 bytes
0644
AlertSilences.4ff252ad4c0057124d5d.js.map
83377 bytes
0644
AlertTabCtrl.d3377d127a336a69beb5.js
9844 bytes
0644
AlertTabCtrl.d3377d127a336a69beb5.js.map
27934 bytes
0644
AlertingAdmin.e62f9c73a69abe6a1ac0.js
10523 bytes
0644
AlertingAdmin.e62f9c73a69abe6a1ac0.js.map
37393 bytes
0644
AlertingFeatureTogglePage.f971bb7b2ad4ceb0acbd.js
672 bytes
0644
AlertingFeatureTogglePage.f971bb7b2ad4ceb0acbd.js.map
1220 bytes
0644
AlertingHome.0d6be993ef4a3df37345.js
33492 bytes
0644
AlertingHome.0d6be993ef4a3df37345.js.map
106868 bytes
0644
AlertingRedirectToRule.37a0040f89e20b99b751.js
3648 bytes
0644
AlertingRedirectToRule.37a0040f89e20b99b751.js.map
10875 bytes
0644
AlertingRuleForm.66bb5b2724b31ae6a5a4.js
79931 bytes
0644
AlertingRuleForm.66bb5b2724b31ae6a5a4.js.map
292923 bytes
0644
AlertingUpgrade.c757b99e306db50cdb16.js
31333 bytes
0644
AlertingUpgrade.c757b99e306db50cdb16.js.map
98330 bytes
0644
AngularApp.7e72879caebef22a5217.js
72809 bytes
0644
AngularApp.7e72879caebef22a5217.js.map
102853 bytes
0644
ApiKeysPage.12b0cd511f7b1e9c50dc.js
8422 bytes
0644
ApiKeysPage.12b0cd511f7b1e9c50dc.js.map
23375 bytes
0644
BenchmarksPage.3a183df3d44714f9a96a.js
2941 bytes
0644
BenchmarksPage.3a183df3d44714f9a96a.js.map
9749 bytes
0644
ChangePasswordPage.5e0562f6a9674bd95cfe.js
470 bytes
0644
ChangePasswordPage.5e0562f6a9674bd95cfe.js.map
1195 bytes
0644
Connections.b53c715b9b9a782d8647.js
32448 bytes
0644
Connections.b53c715b9b9a782d8647.js.map
112998 bytes
0644
CorrelationsFeatureToggle.71addced22f59948b708.js
674 bytes
0644
CorrelationsFeatureToggle.71addced22f59948b708.js.map
1149 bytes
0644
CorrelationsPage.4e02feddf752bdf7cfe6.js
22725 bytes
0644
CorrelationsPage.4e02feddf752bdf7cfe6.js.map
69262 bytes
0644
CreateTeam.dbde5b87278cf087cc5e.js
3046 bytes
0644
CreateTeam.dbde5b87278cf087cc5e.js.map
9594 bytes
0644
DashboardImport.06e6c4c03113061aae6c.js
18153 bytes
0644
DashboardImport.06e6c4c03113061aae6c.js.map
58242 bytes
0644
DashboardListPage.dac1fe75fbaa4f9b1c23.js
30967 bytes
0644
DashboardListPage.dac1fe75fbaa4f9b1c23.js.map
108517 bytes
0644
DashboardPage.5e50193556ad6b828f5d.js
2786 bytes
0644
DashboardPage.5e50193556ad6b828f5d.js.map
8754 bytes
0644
DashboardPageProxy.9a6d60e5cac89c11c71c.js
65136 bytes
0644
DashboardPageProxy.9a6d60e5cac89c11c71c.js.map
226791 bytes
0644
DataTrailsPage.aa19ca6750eb3f91ac5d.js
331 bytes
0644
DataTrailsPage.aa19ca6750eb3f91ac5d.js.map
582 bytes
0644
EditNotificationChannelLegacy.75122e6dbfb215d89d81.js
10507 bytes
0644
EditNotificationChannelLegacy.75122e6dbfb215d89d81.js.map
37444 bytes
0644
EmbeddedDashboard.3856404d3d608c739864.js
1768 bytes
0644
EmbeddedDashboard.3856404d3d608c739864.js.map
5917 bytes
0644
FolderAlerting.a0fe69e3574320c8a74a.js
9633 bytes
0644
FolderAlerting.a0fe69e3574320c8a74a.js.map
29985 bytes
0644
FolderLibraryPanelsPage.95dd7bf6735e202a79d2.js
8599 bytes
0644
FolderLibraryPanelsPage.95dd7bf6735e202a79d2.js.map
25919 bytes
0644
LibraryPanelsPage.4a952d4aa9c21984995a.js
2704 bytes
0644
LibraryPanelsPage.4a952d4aa9c21984995a.js.map
7623 bytes
0644
ListPublicDashboardPage.469a693c4011a5193fcd.js
4713 bytes
0644
ListPublicDashboardPage.469a693c4011a5193fcd.js.map
14309 bytes
0644
MuteTimings.cb66b37f52c9ee3ce1da.js
20855 bytes
0644
MuteTimings.cb66b37f52c9ee3ce1da.js.map
58932 bytes
0644
NewNotificationChannelLegacy.1d57814bc534bb1a3681.js
9785 bytes
0644
NewNotificationChannelLegacy.1d57814bc534bb1a3681.js.map
32951 bytes
0644
NewOrgPage.2bb0e1cab09f0cbd0310.js
1325 bytes
0644
NewOrgPage.2bb0e1cab09f0cbd0310.js.map
3158 bytes
0644
NotificationsListLegacyPage.33212668898a6db361a8.js
2547 bytes
0644
NotificationsListLegacyPage.33212668898a6db361a8.js.map
6671 bytes
0644
NotificationsListPage.1eb9cb05bf88eee08291.js
1620 bytes
0644
NotificationsListPage.1eb9cb05bf88eee08291.js.map
3378 bytes
0644
NotificationsPage.d26b90d7348139106351.js
4646 bytes
0644
NotificationsPage.d26b90d7348139106351.js.map
25381 bytes
0644
OrgDetailsPage.2d5c98f188683c2e1d3b.js
6742 bytes
0644
OrgDetailsPage.2d5c98f188683c2e1d3b.js.map
17850 bytes
0644
PlaylistEditPage.d14b3673a1bb03ca0dbb.js
6892 bytes
0644
PlaylistEditPage.d14b3673a1bb03ca0dbb.js.map
19989 bytes
0644
PlaylistNewPage.13696f39b95b8416ede2.js
6583 bytes
0644
PlaylistNewPage.13696f39b95b8416ede2.js.map
19084 bytes
0644
PlaylistPage.8f45dcc09add615f90e8.js
7895 bytes
0644
PlaylistPage.8f45dcc09add615f90e8.js.map
25502 bytes
0644
PlaylistStartPage.8be462b13a24cddee188.js
275 bytes
0644
PlaylistStartPage.8be462b13a24cddee188.js.map
698 bytes
0644
PluginListPage.815b65d32380d0a800f7.js
12167 bytes
0644
PluginListPage.815b65d32380d0a800f7.js.map
43537 bytes
0644
PluginPage.c790de5e17a0b728dd3a.js
314 bytes
0644
PluginPage.c790de5e17a0b728dd3a.js.map
668 bytes
0644
ProfileFeatureTogglePage.a14257ebc5da1e8c85e0.js
552 bytes
0644
ProfileFeatureTogglePage.a14257ebc5da1e8c85e0.js.map
1012 bytes
0644
PublicDashboardPage.51c7c24941781e091898.js
4295 bytes
0644
PublicDashboardPage.51c7c24941781e091898.js.map
14393 bytes
0644
SelectOrgPage.695c19a5101a3a03ee28.js
1124 bytes
0644
SelectOrgPage.695c19a5101a3a03ee28.js.map
2993 bytes
0644
SendResetMailPage.f16b7172a87070f57227.js
1736 bytes
0644
SendResetMailPage.f16b7172a87070f57227.js.map
4350 bytes
0644
ServerStats.3fbd2493deb8f4598755.js
3863 bytes
0644
ServerStats.3fbd2493deb8f4598755.js.map
11534 bytes
0644
ServiceAccountCreatePage.4f989fb6cd2a41193ff0.js
2440 bytes
0644
ServiceAccountCreatePage.4f989fb6cd2a41193ff0.js.map
7939 bytes
0644
ServiceAccountPage.bc7c35b63b03ccc89628.js
14806 bytes
0644
ServiceAccountPage.bc7c35b63b03ccc89628.js.map
51593 bytes
0644
ServiceAccountsPage.baaa08c045390c05e276.js
14565 bytes
0644
ServiceAccountsPage.baaa08c045390c05e276.js.map
46399 bytes
0644
SignupInvited.81ad56aceb8dd1839e15.js
2360 bytes
0644
SignupInvited.81ad56aceb8dd1839e15.js.map
6096 bytes
0644
SnapshotListPage.519c760ed66124a771ff.js
3061 bytes
0644
SnapshotListPage.519c760ed66124a771ff.js.map
9043 bytes
0644
SoloPanelPage.c729750a88c3fa90d1cc.js
3229 bytes
0644
SoloPanelPage.c729750a88c3fa90d1cc.js.map
12316 bytes
0644
SoloPanelPageOld.6518c21ccaf29701fa97.js
1727 bytes
0644
SoloPanelPageOld.6518c21ccaf29701fa97.js.map
5509 bytes
0644
StoragePage.9b93a99e75f7f2842c11.js
14081 bytes
0644
StoragePage.9b93a99e75f7f2842c11.js.map
48740 bytes
0644
SupportBundles.567d512b3f919b8112e4.js
3058 bytes
0644
SupportBundles.567d512b3f919b8112e4.js.map
8751 bytes
0644
SupportBundlesCreate.fc6b6e4cf6366f751081.js
2779 bytes
0644
SupportBundlesCreate.fc6b6e4cf6366f751081.js.map
8882 bytes
0644
TeamList.2e23d37c91734f608f09.js
9019 bytes
0644
TeamList.2e23d37c91734f608f09.js.map
30348 bytes
0644
TeamPages.4f6177b4c6ec769c72d8.js
22839 bytes
0644
TeamPages.4f6177b4c6ec769c72d8.js.map
66001 bytes
0644
TestStuffPage.8ddabdd17d265b771b17.js
2654 bytes
0644
TestStuffPage.8ddabdd17d265b771b17.js.map
8058 bytes
0644
UserCreatePage.72e86cf2c9a3ce50cff3.js
1470 bytes
0644
UserCreatePage.72e86cf2c9a3ce50cff3.js.map
3788 bytes
0644
UserInvitePage.c8243c9cee4b06e10222.js
2576 bytes
0644
UserInvitePage.c8243c9cee4b06e10222.js.map
6594 bytes
0644
UserListPage.acbb5778a782ca90c7ba.js
25463 bytes
0644
UserListPage.acbb5778a782ca90c7ba.js.map
79671 bytes
0644
UserProfileEditPage.7cc4c218d9e4664250e3.js
14593 bytes
0644
UserProfileEditPage.7cc4c218d9e4664250e3.js.map
42901 bytes
0644
UsersListPage.1b61c82d62ca416b6f2f.js
8800 bytes
0644
UsersListPage.1b61c82d62ca416b6f2f.js.map
30059 bytes
0644
alert-rules-drawer-content.1fd9de3b496d077a5f3a.js
957 bytes
0644
alert-rules-drawer-content.1fd9de3b496d077a5f3a.js.map
3199 bytes
0644
alert-rules-toolbar-button.6f275f0d03748b6c297d.js
1429 bytes
0644
alert-rules-toolbar-button.6f275f0d03748b6c297d.js.map
4041 bytes
0644
alertmanagerPlugin.d13ca72afb3f996bb284.js
3810 bytes
0644
alertmanagerPlugin.d13ca72afb3f996bb284.js.map
10753 bytes
0644
app.b11fde05d43f9632a473.js
920821 bytes
0644
app.b11fde05d43f9632a473.js.map
69088 bytes
0644
assets-manifest.json
280835 bytes
0644
azureMonitorPlugin.0bc37a9d4e3bd8421cc0.js
232 bytes
0644
azureMonitorPlugin.0bc37a9d4e3bd8421cc0.js.map
600 bytes
0644
brace.fcd4b1c7e8b9264ab02c.js
371235 bytes
0644
brace.fcd4b1c7e8b9264ab02c.js.map
1132097 bytes
0644
canvasPanel.a46aa5e57d26b1fcc380.js
485254 bytes
0644
canvasPanel.a46aa5e57d26b1fcc380.js.map
2136916 bytes
0644
cloudMonitoringPlugin.c6ea431eae8e9ad2c7b1.js
198 bytes
0644
cloudMonitoringPlugin.c6ea431eae8e9ad2c7b1.js.map
555 bytes
0644
cloudwatchPlugin.06ef34f60000c4f7ea37.js
192 bytes
0644
cloudwatchPlugin.06ef34f60000c4f7ea37.js.map
544 bytes
0644
dark.7fa24d1908c1c96e6fcc.js
134 bytes
0644
elasticsearchPlugin.3f2edb012f5162b48903.js
214 bytes
0644
elasticsearchPlugin.3f2edb012f5162b48903.js.map
583 bytes
0644
explore-feature-toggle-page.897d9f08c342ad4c0702.js
612 bytes
0644
explore-feature-toggle-page.897d9f08c342ad4c0702.js.map
1280 bytes
0644
explore.476912733278e2a99729.js
165810 bytes
0644
explore.476912733278e2a99729.js.map
579148 bytes
0644
geomapPanel.14b9605971a38c51d262.js
417078 bytes
0644
geomapPanel.14b9605971a38c51d262.js.map
540371 bytes
0644
grafana.dark.8c716fbcf630eae84ced.css
209089 bytes
0644
grafana.light.b8b3904788f25480f4a1.css
209047 bytes
0644
grafanaPlugin.1cb208185a89de28dc3a.js
8654 bytes
0644
grafanaPlugin.1cb208185a89de28dc3a.js.map
28174 bytes
0644
graphPlugin.f47f722cdfc0ceb85136.js
70277 bytes
0644
graphPlugin.f47f722cdfc0ceb85136.js.map
243430 bytes
0644
graphitePlugin.d59175976346917781fe.js
75305 bytes
0644
graphitePlugin.d59175976346917781fe.js.map
272016 bytes
0644
heatmapPanel.f6f29a53ed0f682b4404.js
37545 bytes
0644
heatmapPanel.f6f29a53ed0f682b4404.js.map
158066 bytes
0644
influxdbPlugin.140a7777089f9559c11c.js
68843 bytes
0644
influxdbPlugin.140a7777089f9559c11c.js.map
265085 bytes
0644
jaegerPlugin.d254fd4a19ef0cb5b4f5.js
19727 bytes
0644
jaegerPlugin.d254fd4a19ef0cb5b4f5.js.map
65603 bytes
0644
light.af65e5ce03b9ed0aa2b1.js
134 bytes
0644
loki-query-field.a588d587d9d762b18f22.js
191 bytes
0644
loki-query-field.a588d587d9d762b18f22.js.map
548 bytes
0644
lokiPlugin.77364509de280321b6f8.js
185 bytes
0644
lokiPlugin.77364509de280321b6f8.js.map
536 bytes
0644
mixedPlugin.f36bd557a883d9a67538.js
180 bytes
0644
mssqlPlugin.88775f59ced74c2283c5.js
20457 bytes
0644
mssqlPlugin.88775f59ced74c2283c5.js.map
61420 bytes
0644
mysqlPlugin.72fb44411afd8165d201.js
17323 bytes
0644
mysqlPlugin.72fb44411afd8165d201.js.map
45415 bytes
0644
nodeGraphPanel.9a7cdd8efdae281cbe28.js
2107 bytes
0644
nodeGraphPanel.9a7cdd8efdae281cbe28.js.map
7132 bytes
0644
opentsdbPlugin.418b8c8ea0d97ed99edb.js
22866 bytes
0644
opentsdbPlugin.418b8c8ea0d97ed99edb.js.map
82180 bytes
0644
parcaPlugin.7f2e6dde7161b08ceed2.js
11184 bytes
0644
parcaPlugin.7f2e6dde7161b08ceed2.js.map
42340 bytes
0644
postgresPlugin.f88c598bae2653ae177b.js
18902 bytes
0644
postgresPlugin.f88c598bae2653ae177b.js.map
54304 bytes
0644
prom-query-field.ff217c474ea457bdd65e.js
14104 bytes
0644
prom-query-field.ff217c474ea457bdd65e.js.map
76811 bytes
0644
prometheusPlugin.2ba02c28d3f7293e903e.js
224 bytes
0644
prometheusPlugin.2ba02c28d3f7293e903e.js.map
699 bytes
0644
pyroscopePlugin.eb14b78419d619d90dca.js
22269 bytes
0644
pyroscopePlugin.eb14b78419d619d90dca.js.map
86896 bytes
0644
react-monaco-editor.988b1aa5e90b11f9941a.js
15759 bytes
0644
react-monaco-editor.988b1aa5e90b11f9941a.js.map
51544 bytes
0644
runtime.4b7e1b5735d2ed64b824.js
13640 bytes
0644
runtime.4b7e1b5735d2ed64b824.js.map
35122 bytes
0644
tableOldPlugin.8c72b8399d197aeebe16.js
25242 bytes
0644
tableOldPlugin.8c72b8399d197aeebe16.js.map
80497 bytes
0644
tempoPlugin.efa8c2a55984263b4b61.js
182 bytes
0644
tempoPlugin.efa8c2a55984263b4b61.js.map
529 bytes
0644
testDataDSPlugin.9717509b124d754e4f35.js
120550 bytes
0644
testDataDSPlugin.9717509b124d754e4f35.js.map
303302 bytes
0644
visjs-network.d93b3aa71ac24c8cde84.js
459653 bytes
0644
visjs-network.d93b3aa71ac24c8cde84.js.map
1951742 bytes
0644
zipkinPlugin.70f0f24b6d0b6e673ccb.js
13172 bytes
0644
zipkinPlugin.70f0f24b6d0b6e673ccb.js.map
46861 bytes
0644
N4ST4R_ID | Naxtarrr