(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7808],{6191:(I,S,o)=>{"use strict";o.d(S,{X:()=>M});var j=o(32196),P=o(96540),G=o(40845);const M=({children:l})=>{const d=(0,G.of)(K);return P.createElement("div",{className:d.root},l)},K=l=>({root:(0,j.css)({display:"flex",flexWrap:"wrap",alignItems:"center",gap:l.spacing(3),minHeight:l.spacing(4)})})},31347:(I,S,o)=>{"use strict";o.d(S,{Z:()=>P});var j=o(96540);const P=({grow:G,shrink:M})=>j.createElement("div",{style:{display:"block",flexGrow:G,flexShrink:M}})},22354:(I,S,o)=>{"use strict";o.d(S,{W:()=>k});var j=o(32196),P=o(96540),G=o(40845),M=o(90182),K=o(4603),l=Object.defineProperty,d=Object.defineProperties,v=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,L=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable,ue=(ne,D,H)=>D in ne?l(ne,D,{enumerable:!0,configurable:!0,writable:!0,value:H}):ne[D]=H,le=(ne,D)=>{for(var H in D||(D={}))L.call(D,H)&&ue(ne,H,D[H]);if(u)for(var H of u(D))b.call(D,H)&&ue(ne,H,D[H]);return ne},J=(ne,D)=>d(ne,v(D)),ee=(ne,D)=>{var H={};for(var se in ne)L.call(ne,se)&&D.indexOf(se)<0&&(H[se]=ne[se]);if(ne!=null&&u)for(var se of u(ne))D.indexOf(se)<0&&b.call(ne,se)&&(H[se]=ne[se]);return H};function k(ne){var D=ne,{label:H}=D,se=ee(D,["label"]);const E=(0,G.of)(ie),[pe]=(0,P.useState)(()=>Math.random().toString(16).slice(2)),B={SelectContainer:W,ValueContainer:g,SingleValue:g};return P.createElement("div",{className:E.root},H&&P.createElement("label",{className:E.label,htmlFor:pe},H,":","\xA0"),P.createElement(M.l6,J(le({openMenuOnFocus:!0,inputId:pe},se),{components:B})))}const W=ne=>{const{children:D}=ne,H=(0,G.of)(ie);return P.createElement(K.K,J(le({},ne),{className:(0,j.cx)(ne.className,H.container)}),D)},g=ne=>{const{className:D,children:H}=ne,se=(0,G.of)(ie);return P.createElement("div",{className:(0,j.cx)(D,se.valueContainer)},H)},ie=ne=>({root:(0,j.css)({display:"flex",fontSize:12,alignItems:"center"}),label:(0,j.css)({color:ne.colors.text.secondary,whiteSpace:"nowrap"}),container:(0,j.css)({background:"none",borderColor:"transparent"}),valueContainer:(0,j.css)({display:"flex",alignItems:"center",flex:"initial",color:ne.colors.text.secondary,fontSize:12})})},74526:()=>{(function(){"use strict";/**
 * Bindonce - Zero watches binding for AngularJs
 * @version v0.3.1
 * @link https://github.com/Pasvaz/bindonce
 * @author Pasquale Vazzana <pasqualevazzana@gmail.com>
 * @license MIT License, http://www.opensource.org/licenses/MIT
 */var I=angular.module("pasvaz.bindonce",[]);I.directive("bindonce",function(){var S=function(P){if(P&&P.length!==0){var G=angular.lowercase(""+P);P=!(G==="f"||G==="0"||G==="false"||G==="no"||G==="n"||G==="[]")}else P=!1;return P},o=parseInt((/msie (\d+)/.exec(angular.lowercase(navigator.userAgent))||[])[1],10);isNaN(o)&&(o=parseInt((/trident\/.*; rv:(\d+)/.exec(angular.lowercase(navigator.userAgent))||[])[1],10));var j={restrict:"AM",controller:["$scope","$element","$attrs","$interpolate",function(P,G,M,K){var l=function(u,L,b){var ue=L==="show"?"":"none",le=L==="hide"?"":"none";u.css("display",S(b)?ue:le)},d=function(u,L){if(angular.isObject(L)&&!angular.isArray(L)){var b=[];angular.forEach(L,function(ue,le){ue&&b.push(le)}),L=b}L&&u.addClass(angular.isArray(L)?L.join(" "):L)},v={watcherRemover:void 0,binders:[],group:M.boName,element:G,ran:!1,addBinder:function(u){this.binders.push(u),this.ran&&this.runBinders()},setupWatcher:function(u){var L=this;this.watcherRemover=P.$watch(u,function(b){b!==void 0&&(L.removeWatcher(),L.runBinders())},!0)},removeWatcher:function(){this.watcherRemover!==void 0&&(this.watcherRemover(),this.watcherRemover=void 0)},runBinders:function(){for(;this.binders.length>0;){var u=this.binders.shift();if(!(this.group&&this.group!=u.group)){var L=u.scope.$eval(u.interpolate?K(u.value):u.value);switch(u.attr){case"boIf":S(L)&&u.transclude(u.scope.$new(),function(J){var ee=u.element.parent(),k=u.element&&u.element[u.element.length-1],W=ee&&ee[0]||k&&k.parentNode,g=k&&k.nextSibling||null;angular.forEach(J,function(ie){W.insertBefore(ie,g)})});break;case"boSwitch":var b,ue=u.controller[0];(b=ue.cases["!"+L]||ue.cases["?"])&&(u.scope.$eval(u.attrs.change),angular.forEach(b,function(J){J.transclude(u.scope.$new(),function(ee){var k=J.element.parent(),W=J.element&&J.element[J.element.length-1],g=k&&k[0]||W&&W.parentNode,ie=W&&W.nextSibling||null;angular.forEach(ee,function(ne){g.insertBefore(ne,ie)})})}));break;case"boSwitchWhen":var le=u.controller[0];le.cases["!"+u.attrs.boSwitchWhen]=le.cases["!"+u.attrs.boSwitchWhen]||[],le.cases["!"+u.attrs.boSwitchWhen].push({transclude:u.transclude,element:u.element});break;case"boSwitchDefault":var le=u.controller[0];le.cases["?"]=le.cases["?"]||[],le.cases["?"].push({transclude:u.transclude,element:u.element});break;case"hide":case"show":l(u.element,u.attr,L);break;case"class":d(u.element,L);break;case"text":u.element.text(L);break;case"html":u.element.html(L);break;case"style":u.element.css(L);break;case"src":u.element.attr(u.attr,L),o&&u.element.prop("src",L);break;case"attr":angular.forEach(u.attrs,function(J,ee){var k,W;ee.match(/^boAttr./)&&u.attrs[ee]&&(k=ee.replace(/^boAttr/,"").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),W=u.scope.$eval(u.attrs[ee]),u.element.attr(k,W))});break;case"href":case"alt":case"title":case"id":case"value":u.element.attr(u.attr,L);break}}}this.ran=!0}};return v}],link:function(P,G,M,K){var l=M.bindonce?P.$eval(M.bindonce):!0;l!==void 0?K.runBinders():(K.setupWatcher(M.bindonce),G.bind("$destroy",K.removeWatcher))}};return j}),angular.forEach([{directiveName:"boShow",attribute:"show"},{directiveName:"boHide",attribute:"hide"},{directiveName:"boClass",attribute:"class"},{directiveName:"boText",attribute:"text"},{directiveName:"boBind",attribute:"text"},{directiveName:"boHtml",attribute:"html"},{directiveName:"boSrcI",attribute:"src",interpolate:!0},{directiveName:"boSrc",attribute:"src"},{directiveName:"boHrefI",attribute:"href",interpolate:!0},{directiveName:"boHref",attribute:"href"},{directiveName:"boAlt",attribute:"alt"},{directiveName:"boTitle",attribute:"title"},{directiveName:"boId",attribute:"id"},{directiveName:"boStyle",attribute:"style"},{directiveName:"boValue",attribute:"value"},{directiveName:"boAttr",attribute:"attr"},{directiveName:"boIf",transclude:"element",terminal:!0,priority:1e3},{directiveName:"boSwitch",require:"boSwitch",controller:function(){this.cases={}}},{directiveName:"boSwitchWhen",transclude:"element",priority:800,require:"^boSwitch"},{directiveName:"boSwitchDefault",transclude:"element",priority:800,require:"^boSwitch"}],function(S){var o=200;return I.directive(S.directiveName,function(){var j={priority:S.priority||o,transclude:S.transclude||!1,terminal:S.terminal||!1,require:["^bindonce"].concat(S.require||[]),controller:S.controller,compile:function(P,G,M){return function(K,l,d,v){var u=v[0],L=d.boParent;if(L&&u.group!==L){var b=u.element.parent();u=void 0;for(var ue;b[0].nodeType!==9&&b.length;){if((ue=b.data("$bindonceController"))&&ue.group===L){u=ue;break}b=b.parent()}if(!u)throw new Error("No bindonce controller: "+L)}u.addBinder({element:l,attr:S.attribute||S.directiveName,attrs:d,value:d[S.directiveName],interpolate:S.interpolate,group:L,transclude:M,controller:v.slice(1),scope:K})}}};return j})})})()},32747:()=>{/**
 * @license AngularJS v1.8.3
 * (c) 2010-2020 Google LLC. http://angularjs.org
 * License: MIT
 */(function(I,S){"use strict";function o(J,ee){if(P(J)){ee=ee||[];for(var k=0,W=J.length;k<W;k++)ee[k]=J[k]}else if(G(J)){ee=ee||{};for(var g in J)g.charAt(0)==="$"&&g.charAt(1)==="$"||(ee[g]=J[g])}return ee||J}function j(J,ee){var k=[],W=J.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)(\*\?|[?*])?/g,function(g,ie,ne,D){var H=D==="?"||D==="*?",se=D==="*"||D==="*?";return k.push({name:ne,optional:H}),ie=ie||"",(H?"(?:"+ie:ie+"(?:")+(se?"(.+?)":"([^/]+)")+(H?"?)?":")")}).replace(/([/$*])/g,"\\$1");return ee.ignoreTrailingSlashes&&(W=W.replace(/\/+$/,"")+"/*"),{keys:k,regexp:new RegExp("^"+W+"(?:[?#]|$)",ee.caseInsensitiveMatch?"i":"")}}var P,G,M,K,l=S.module("ngRoute",[]).info({angularVersion:"1.8.3"}).provider("$route",u).run(L),d=S.$$minErr("ngRoute"),v;function u(){P=S.isArray,G=S.isObject,M=S.isDefined,K=S.noop;function J(k,W){return S.extend(Object.create(k),W)}var ee={};this.when=function(k,W){var g=o(W);if(S.isUndefined(g.reloadOnUrl)&&(g.reloadOnUrl=!0),S.isUndefined(g.reloadOnSearch)&&(g.reloadOnSearch=!0),S.isUndefined(g.caseInsensitiveMatch)&&(g.caseInsensitiveMatch=this.caseInsensitiveMatch),ee[k]=S.extend(g,{originalPath:k},k&&j(k,g)),k){var ie=k[k.length-1]==="/"?k.substr(0,k.length-1):k+"/";ee[ie]=S.extend({originalPath:k,redirectTo:k},j(ie,g))}return this},this.caseInsensitiveMatch=!1,this.otherwise=function(k){return typeof k=="string"&&(k={redirectTo:k}),this.when(null,k),this},v=!0,this.eagerInstantiationEnabled=function(W){return M(W)?(v=W,this):v},this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce","$browser",function(k,W,g,ie,ne,D,H,se){var E=!1,pe,B,ge={routes:ee,reload:function(){E=!0;var V={defaultPrevented:!1,preventDefault:function(){this.defaultPrevented=!0,E=!1}};k.$evalAsync(function(){de(V),V.defaultPrevented||oe()})},updateParams:function(V){if(this.current&&this.current.$$route)V=S.extend({},this.current.params,V),W.path(Pe(this.current.$$route.originalPath,V)),W.search(V);else throw d("norout","Tried updating route with no current route")}};return k.$on("$locationChangeStart",de),k.$on("$locationChangeSuccess",oe),ge;function C(V,z){var N=z.keys,Y={};if(!z.regexp)return null;var q=z.regexp.exec(V);if(!q)return null;for(var ae=1,re=q.length;ae<re;++ae){var be=N[ae-1],R=q[ae];be&&R&&(Y[be.name]=R)}return Y}function de(V){var z=ge.current;pe=we(),B=De(pe,z),!B&&(z||pe)&&k.$broadcast("$routeChangeStart",pe,z).defaultPrevented&&V&&V.preventDefault()}function oe(){var V=ge.current,z=pe;if(B)V.params=z.params,S.copy(V.params,g),k.$broadcast("$routeUpdate",V);else if(z||V){E=!1,ge.current=z;var N=ie.resolve(z);se.$$incOutstandingRequestCount("$route"),N.then(Q).then(_).then(function(Y){return Y&&N.then(Te).then(function(q){z===ge.current&&(z&&(z.locals=q,S.copy(z.params,g)),k.$broadcast("$routeChangeSuccess",z,V))})}).catch(function(Y){z===ge.current&&k.$broadcast("$routeChangeError",z,V,Y)}).finally(function(){se.$$completeOutstandingRequest(K,"$route")})}}function Q(V){var z={route:V,hasRedirection:!1};if(V){if(V.redirectTo)if(S.isString(V.redirectTo))z.path=Pe(V.redirectTo,V.params),z.search=V.params,z.hasRedirection=!0;else{var N=W.path(),Y=W.search(),q=V.redirectTo(V.pathParams,N,Y);S.isDefined(q)&&(z.url=q,z.hasRedirection=!0)}else if(V.resolveRedirectTo)return ie.resolve(ne.invoke(V.resolveRedirectTo)).then(function(ae){return S.isDefined(ae)&&(z.url=ae,z.hasRedirection=!0),z})}return z}function _(V){var z=!0;if(V.route!==ge.current)z=!1;else if(V.hasRedirection){var N=W.url(),Y=V.url;Y?W.url(Y).replace():Y=W.path(V.path).search(V.search).replace().url(),Y!==N&&(z=!1)}return z}function Te(V){if(V){var z=S.extend({},V.resolve);S.forEach(z,function(Y,q){z[q]=S.isString(Y)?ne.get(Y):ne.invoke(Y,null,null,q)});var N=ve(V);return S.isDefined(N)&&(z.$template=N),ie.all(z)}}function ve(V){var z,N;return S.isDefined(z=V.template)?S.isFunction(z)&&(z=z(V.params)):S.isDefined(N=V.templateUrl)&&(S.isFunction(N)&&(N=N(V.params)),S.isDefined(N)&&(V.loadedTemplateUrl=H.valueOf(N),z=D(N))),z}function we(){var V,z;return S.forEach(ee,function(N,Y){!z&&(V=C(W.path(),N))&&(z=J(N,{params:S.extend({},W.search(),V),pathParams:V}),z.$$route=N)}),z||ee[null]&&J(ee[null],{params:{},pathParams:{}})}function De(V,z){return!E&&V&&z&&V.$$route===z.$$route&&(!V.reloadOnUrl||!V.reloadOnSearch&&S.equals(V.pathParams,z.pathParams))}function Pe(V,z){var N=[];return S.forEach((V||"").split(":"),function(Y,q){if(q===0)N.push(Y);else{var ae=Y.match(/(\w+)(?:[?*])?(.*)/),re=ae[1];N.push(z[re]),N.push(ae[2]||""),delete z[re]}}),N.join("")}}]}L.$inject=["$injector"];function L(J){v&&J.get("$route")}l.provider("$routeParams",b);function b(){this.$get=function(){return{}}}l.directive("ngView",ue),l.directive("ngView",le),ue.$inject=["$route","$anchorScroll","$animate"];function ue(J,ee,k){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(W,g,ie,ne,D){var H,se,E,pe=ie.autoscroll,B=ie.onload||"";W.$on("$routeChangeSuccess",C),C();function ge(){E&&(k.cancel(E),E=null),H&&(H.$destroy(),H=null),se&&(E=k.leave(se),E.done(function(de){de!==!1&&(E=null)}),se=null)}function C(){var de=J.current&&J.current.locals,oe=de&&de.$template;if(S.isDefined(oe)){var Q=W.$new(),_=J.current,Te=D(Q,function(ve){k.enter(ve,null,se||g).done(function(De){De!==!1&&S.isDefined(pe)&&(!pe||W.$eval(pe))&&ee()}),ge()});se=Te,H=_.scope=Q,H.$emit("$viewContentLoaded"),H.$eval(B)}else ge()}}}}le.$inject=["$compile","$controller","$route"];function le(J,ee,k){return{restrict:"ECA",priority:-400,link:function(W,g){var ie=k.current,ne=ie.locals;g.html(ne.$template);var D=J(g.contents());if(ie.controller){ne.$scope=W;var H=ee(ie.controller,ne);ie.controllerAs&&(W[ie.controllerAs]=H),g.data("$ngControllerController",H),g.children().data("$ngControllerController",H)}W[ie.resolveAs||"$resolve"]=ne,D(W)}}}})(window,window.angular)},23345:(I,S,o)=>{o(32747),I.exports="ngRoute"},81221:()=>{/**
 * @license AngularJS v1.8.3
 * (c) 2010-2020 Google LLC. http://angularjs.org
 * License: MIT
 */(function(I,S){"use strict";var o=S.$$minErr("$sanitize"),j,P,G,M,K,l,d,v,u,L;function b(){var le=!1,J=!1;this.$get=["$$sanitizeUri",function(N){return le=!0,J&&P(pe,se),function(Y){var q=[];return u(Y,L(q,function(ae,re){return!/^unsafe:/.test(N(ae,re))})),q.join("")}}],this.enableSvg=function(N){return K(N)?(J=N,this):J},this.addValidElements=function(N){return le||(M(N)&&(N={htmlElements:N}),_(se,N.svgElements),_(W,N.htmlVoidElements),_(pe,N.htmlVoidElements),_(pe,N.htmlElements)),this},this.addValidAttrs=function(N){return le||P(de,Q(N,!0)),this},j=S.bind,P=S.extend,G=S.forEach,M=S.isArray,K=S.isDefined,l=S.$$lowercase,d=S.noop,u=ve,L=Pe,v=I.Node.prototype.contains||function(N){return!!(this.compareDocumentPosition(N)&16)};var ee=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,k=/([^#-~ |!])/g,W=oe("area,br,col,hr,img,wbr"),g=oe("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),ie=oe("rp,rt"),ne=P({},ie,g),D=P({},g,oe("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul")),H=P({},ie,oe("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),se=oe("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,stop,svg,switch,text,title,tspan"),E=oe("script,style"),pe=P({},W,D,H,ne),B=oe("background,cite,href,longdesc,src,xlink:href,xml:base"),ge=oe("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,valign,value,vspace,width"),C=oe("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan",!0),de=P({},B,C,ge);function oe(N,Y){return Q(N.split(","),Y)}function Q(N,Y){var q={},ae;for(ae=0;ae<N.length;ae++)q[Y?l(N[ae]):N[ae]]=!0;return q}function _(N,Y){Y&&Y.length&&P(N,Q(Y))}var Te=function(N,Y){if(re())return be;if(!Y||!Y.implementation)throw o("noinert","Can't create an inert html document");var q=Y.implementation.createHTMLDocument("inert"),ae=(q.documentElement||q.getDocumentElement()).querySelector("body");return R;function re(){try{return!!be("")}catch{return!1}}function be(fe){fe="<remove></remove>"+fe;try{var O=new N.DOMParser().parseFromString(fe,"text/html").body;return O.firstChild.remove(),O}catch{return}}function R(fe){return ae.innerHTML=fe,Y.documentMode&&V(ae),ae}}(I,I.document);function ve(N,Y){N==null?N="":typeof N!="string"&&(N=""+N);var q=Te(N);if(!q)return"";var ae=5;do{if(ae===0)throw o("uinput","Failed to sanitize html because the input is unstable");ae--,N=q.innerHTML,q=Te(N)}while(N!==q.innerHTML);for(var re=q.firstChild;re;){switch(re.nodeType){case 1:Y.start(re.nodeName.toLowerCase(),we(re.attributes));break;case 3:Y.chars(re.textContent);break}var be;if(!(be=re.firstChild)&&(re.nodeType===1&&Y.end(re.nodeName.toLowerCase()),be=z("nextSibling",re),!be))for(;be==null&&(re=z("parentNode",re),re!==q);)be=z("nextSibling",re),re.nodeType===1&&Y.end(re.nodeName.toLowerCase());re=be}for(;re=q.firstChild;)q.removeChild(re)}function we(N){for(var Y={},q=0,ae=N.length;q<ae;q++){var re=N[q];Y[re.name]=re.value}return Y}function De(N){return N.replace(/&/g,"&amp;").replace(ee,function(Y){var q=Y.charCodeAt(0),ae=Y.charCodeAt(1);return"&#"+((q-55296)*1024+(ae-56320)+65536)+";"}).replace(k,function(Y){return"&#"+Y.charCodeAt(0)+";"}).replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pe(N,Y){var q=!1,ae=j(N,N.push);return{start:function(re,be){re=l(re),!q&&E[re]&&(q=re),!q&&pe[re]===!0&&(ae("<"),ae(re),G(be,function(R,fe){var O=l(fe),je=re==="img"&&O==="src"||O==="background";de[O]===!0&&(B[O]!==!0||Y(R,je))&&(ae(" "),ae(fe),ae('="'),ae(De(R)),ae('"'))}),ae(">"))},end:function(re){re=l(re),!q&&pe[re]===!0&&W[re]!==!0&&(ae("</"),ae(re),ae(">")),re==q&&(q=!1)},chars:function(re){q||ae(De(re))}}}function V(N){for(;N;){if(N.nodeType===I.Node.ELEMENT_NODE)for(var Y=N.attributes,q=0,ae=Y.length;q<ae;q++){var re=Y[q],be=re.name.toLowerCase();(be==="xmlns:ns1"||be.lastIndexOf("ns1:",0)===0)&&(N.removeAttributeNode(re),q--,ae--)}var R=N.firstChild;R&&V(R),N=z("nextSibling",N)}}function z(N,Y){var q=Y[N];if(q&&v.call(Y,q))throw o("elclob","Failed to sanitize html because the element is clobbered: {0}",Y.outerHTML||Y.outerText);return q}}function ue(le){var J=[],ee=L(J,d);return ee.chars(le),J.join("")}S.module("ngSanitize",[]).provider("$sanitize",b).info({angularVersion:"1.8.3"}),S.module("ngSanitize").filter("linky",["$sanitize",function(le){var J=/((s?ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,ee=/^mailto:/i,k=S.$$minErr("linky"),W=S.isDefined,g=S.isFunction,ie=S.isObject,ne=S.isString;return function(D,H,se){if(D==null||D==="")return D;if(!ne(D))throw k("notstring","Expected string but received: {0}",D);for(var E=g(se)?se:ie(se)?function(){return se}:function(){return{}},pe,B=D,ge=[],C,de;pe=B.match(J);)C=pe[0],!pe[2]&&!pe[4]&&(C=(pe[3]?"http://":"mailto:")+C),de=pe.index,oe(B.substr(0,de)),Q(C,pe[0].replace(ee,"")),B=B.substring(de+pe[0].length);return oe(B),le(ge.join(""));function oe(_){_&&ge.push(ue(_))}function Q(_,Te){var ve,we=E(_);ge.push("<a ");for(ve in we)ge.push(ve+'="'+we[ve]+'" ');W(H)&&!("target"in we)&&ge.push('target="',H,'" '),ge.push('href="',_.replace(/"/g,"&quot;"),'">'),oe(Te),ge.push("</a>")}}}])})(window,window.angular)},26415:(I,S,o)=>{o(81221),I.exports="ngSanitize"},12582:I=>{"use strict";function S(o){var j=this,P;if(this._au)return;function G(){j.root[j.origin.offset]?K():M()}function M(){P||(P=setInterval(function(){j.root[j.origin.offset]&&(K(),j.update())},300))}function K(){clearInterval(P),P=null}var l=j._debounce(function(){j.update()},300);this._observer=new o(function(){G(),j.update(),l()}),this.on("init",function(){j._observer.observe(j.root,{childList:!0,subtree:!0,characterData:!0}),G()}),this.on("dispose",function(){j._observer.disconnect(),K(),delete j._observer}),this._au=!0}I.exports=function(j){var P=j.MutationObserver||j.WebKitMutationObserver||j.MozMutationObserver||null;return function(){return P?(S.call(this,P),this):this}}},69786:(I,S,o)=>{"use strict";var j=o(69079).qs;I.exports=function(G){var M,K,l,d,v=this,u;d=G.screen||.9,G.forward&&(M=j(G.forward,this.clipper),u={element:M,handler:function(){var L=v.pos()+(G.delta||30);v.pos(L)},type:"click"},this._eventHandlers.push(u),this.event(u.element,u.type,u.handler,"on")),G.backward&&(K=j(G.backward,this.clipper),u={element:K,handler:function(){var L=v.pos()-(G.delta||30);v.pos(L)},type:"click"},this._eventHandlers.push(u),this.event(u.element,u.type,u.handler,"on")),G.track&&(G.track===!0?l=this.track:l=j(G.track,this.clipper),l&&(u={element:l,handler:function(L){if(L.target==l){var b=L["offset"+v.origin.x],ue=v.bar[v.origin.offsetPos],le=0;b<ue?le=-1:b>ue+v.bar[v.origin.offset]&&(le=1);var J=v.pos()+le*d*v.scroller[v.origin.client];v.pos(J)}},type:"mousedown"},this._eventHandlers.push(u),this.event(u.element,u.type,u.handler,"on")))}},92747:(I,S,o)=>{"use strict";var j=function(){return this||(0,eval)("this")}(),P=j&&j.window||j,G=o(69079).f0,M=o(69079).AH,K=o(69079).WQ,l=o(69079).zy,d=o(69079).rm,v=o(69079).o8,u=o(69079).qs,L=D,b=["left","top","right","bottom","width","height"],ue=[],le={v:{x:"Y",pos:b[1],oppos:b[3],crossPos:b[0],crossOpPos:b[2],size:b[5],crossSize:b[4],crossMinSize:"min-"+b[4],crossMaxSize:"max-"+b[4],client:"clientHeight",crossClient:"clientWidth",scrollEdge:"scrollLeft",offset:"offsetHeight",crossOffset:"offsetWidth",offsetPos:"offsetTop",scroll:"scrollTop",scrollSize:"scrollHeight"},h:{x:"X",pos:b[0],oppos:b[2],crossPos:b[1],crossOpPos:b[3],size:b[4],crossSize:b[5],crossMinSize:"min-"+b[5],crossMaxSize:"max-"+b[5],client:"clientWidth",crossClient:"clientHeight",scrollEdge:"scrollTop",offset:"offsetWidth",crossOffset:"offsetHeight",offsetPos:"offsetLeft",scroll:"scrollLeft",scrollSize:"scrollWidth"}},J=17,ee=15,k=/[\s\S]*Macintosh[\s\S]*\) Gecko[\s\S]*/,W=k.test(P.navigator&&P.navigator.userAgent),g,ie,ne;function D(C){var de=!!C,oe=C&&C[0]||C,Q=typeof C=="string"||oe instanceof HTMLElement,_=Q?{root:C}:v(C),Te,ve,we={direction:"v",barOnCls:"_scrollbar",resizeDebounce:0,event:G,cssGuru:!1,impact:"scroller",position:"static"};_=_||{};for(var De in we)_[De]==null&&(_[De]=we[De]);Te=this&&this instanceof P.jQuery,_._chain?ve=_.root:Te?_.root=ve=this[0]:ve=u(_.root||_.scroller);var Pe=pe(ve,_.direction),V=+Pe;if(_.index=V,V==V&&Pe!==null&&ue[V])return ue[V];_.root&&_.scroller?_.scroller=u(_.scroller,ve):_.scroller=ve,_.root=ve;var z=B(_);return z.autoUpdate&&z.autoUpdate(),z}function H(C,de){var oe=0,Q=C;for((Q.length===void 0||Q===P)&&(Q=[Q]);Q[oe];)de.call(this,Q[oe],oe),oe++}function se(){return new Date().getTime()}function E(C,de,oe){C._eventHandlers=C._eventHandlers||[{element:C.scroller,handler:function(Q){C.scroll(Q)},type:"scroll"},{element:C.root,handler:function(){C.update()},type:"transitionend animationend"},{element:C.scroller,handler:function(){C.update()},type:"keyup"},{element:C.bar,handler:function(Q){Q.preventDefault(),C.selection(),C.drag.now=1,C.draggingCls&&K(C.root,C.draggingCls)},type:"touchstart mousedown"},{element:document,handler:function(){C.selection(1),C.drag.now=0,C.draggingCls&&d(C.root,C.draggingCls)},type:"mouseup blur touchend"},{element:document,handler:function(Q){Q.button!=2&&C._pos0(Q)},type:"touchstart mousedown"},{element:document,handler:function(Q){C.drag.now&&C.drag(Q)},type:"mousemove touchmove"},{element:P,handler:function(){C.update()},type:"resize"},{element:C.root,handler:function(){C.update()},type:"sizeChange"},{element:C.clipper,handler:function(){C.clipperOnScroll()},type:"scroll"}],H(C._eventHandlers,function(Q){if(Q.element)if(Q.element.length&&Q.element!==P)for(var _=0;_<Q.element.length;_++)de(Q.element[_],Q.type,Q.handler,oe);else de(Q.element,Q.type,Q.handler,oe)})}function pe(C,de,oe,Q){var _="data-baron-"+de+"-id";return oe=="on"?C.setAttribute(_,Q):oe=="off"&&C.removeAttribute(_),C.getAttribute(_)}function B(C){var de=new D.prototype.constructor(C);return E(de,C.event,"on"),pe(de.root,C.direction,"on",ue.length),ue.push(de),de.update(),de}function ge(C){if(this.events&&this.events[C])for(var de=0;de<this.events[C].length;de++){var oe=Array.prototype.slice.call(arguments,1);this.events[C][de].apply(this,oe)}}D.prototype={_debounce:function(C,de){var oe=this,Q,_,Te=function(){if(oe._disposed){clearTimeout(Q),Q=oe=null;return}var ve=se()-_;ve<de&&ve>=0?Q=setTimeout(Te,de-ve):(Q=null,C())};return function(){_=se(),Q||(Q=setTimeout(Te,de))}},constructor:function(C){var de,oe,Q,_,Te,ve,we;ve=se(),this.params=C,this.event=C.event,this.events={},this.root=C.root,this.scroller=u(C.scroller),this.bar=u(C.bar,this.root),Q=this.track=u(C.track,this.root),!this.track&&this.bar&&(Q=this.bar.parentNode),this.clipper=this.scroller.parentNode,this.direction=C.direction,this.rtl=C.rtl,this.origin=le[this.direction],this.barOnCls=C.barOnCls,this.scrollingCls=C.scrollingCls,this.draggingCls=C.draggingCls,this.impact=C.impact,this.position=C.position,this.rtl=C.rtl,this.barTopLimit=0,this.resizeDebounce=C.resizeDebounce;function De(R){var fe=this.barMinSize||20,O=R;O>0&&O<fe&&(O=fe),this.bar&&M(this.bar,this.origin.size,parseInt(O,10)+"px")}function Pe(R){if(this.bar){var fe=M(this.bar,this.origin.pos),O=+R+"px";O&&O!=fe&&M(this.bar,this.origin.pos,O)}}function V(){return Q[this.origin.client]-this.barTopLimit-this.bar[this.origin.offset]}function z(R){return R*V.call(this)+this.barTopLimit}function N(R){return(R-this.barTopLimit)/V.call(this)}this.cursor=function(R){return R["client"+this.origin.x]||(((R.originalEvent||R).touches||{})[0]||{})["page"+this.origin.x]};function Y(){return!1}if(this.pos=function(R){var fe="page"+this.origin.x+"Offset",O=this.scroller[fe]?fe:this.origin.scroll;return R!==void 0&&(this.scroller[O]=R),this.scroller[O]},this.rpos=function(R){var fe=this.scroller[this.origin.scrollSize]-this.scroller[this.origin.client],O;return R?O=this.pos(R*fe):O=this.pos(),O/(fe||1)},this.barOn=function(R){if(this.barOnCls){var fe=this.scroller[this.origin.client]>=this.scroller[this.origin.scrollSize];R||fe?l(this.root,this.barOnCls)&&d(this.root,this.barOnCls):l(this.root,this.barOnCls)||K(this.root,this.barOnCls)}},this._pos0=function(R){oe=this.cursor(R)-de},this.drag=function(R){var fe=N.call(this,this.cursor(R)-oe),O=this.scroller[this.origin.scrollSize]-this.scroller[this.origin.client];this.scroller[this.origin.scroll]=fe*O},this.selection=function(R){this.event(document,"selectpos selectstart",Y,R?"off":"on")},this.resize=function(){var R=this,fe=R.resizeDebounce===void 0?300:R.resizeDebounce,O=0;se()-ve<fe&&(clearTimeout(_),O=fe);function je(){var Ge=R.scroller[R.origin.crossOffset],Se=R.scroller[R.origin.crossClient],et=0,We,Fe;if(W?et=ee:Se>0&&Ge===0&&(Ge=Se+J),Ge)if(R.barOn(),R.impact=="scroller"){var tt=Ge-Se+et;if(R.position=="static")We=M(R.scroller,R.origin.crossSize),Fe=R.clipper[R.origin.crossClient]+tt+"px",We!=Fe&&R._setCrossSizes(R.scroller,Fe);else{var nt={},rt=R.rtl?"Left":"Right";R.direction=="h"&&(rt="Bottom"),nt["padding"+rt]=tt+"px",M(R.scroller,nt)}}else We=M(R.clipper,R.origin.crossSize),Fe=Se+"px",We!=Fe&&R._setCrossSizes(R.clipper,Fe);Array.prototype.unshift.call(arguments,"resize"),ge.apply(R,arguments),ve=se()}O?_=setTimeout(je,O):je()},this.updatePositions=function(R){var fe,O=this;O.bar&&(fe=(Q[O.origin.client]-O.barTopLimit)*O.scroller[O.origin.client]/O.scroller[O.origin.scrollSize],(R||parseInt(we,10)!=parseInt(fe,10))&&(De.call(O,fe),we=fe),de=z.call(O,O.rpos()),Pe.call(O,de)),Array.prototype.unshift.call(arguments,"scroll"),ge.apply(O,arguments)},this.scroll=function(){var R=this;R.updatePositions(),R.scrollingCls&&(Te||K(R.root,R.scrollingCls),clearTimeout(Te),Te=setTimeout(function(){d(R.root,R.scrollingCls),Te=void 0},300))},this.clipperOnScroll=function(){this.rtl?this.clipper[this.origin.scrollEdge]=this.clipper[this.origin.scrollSize]:this.clipper[this.origin.scrollEdge]=0},this._setCrossSizes=function(R,fe){var O={};O[this.origin.crossSize]=fe,O[this.origin.crossMinSize]=fe,O[this.origin.crossMaxSize]=fe,M(R,O)},this._dumbCss=function(R){if(!C.cssGuru){var fe=R?"hidden":null,O=R?"none":null;M(this.clipper,{overflow:fe,msOverflowStyle:O,position:this.position=="static"?"":"relative"});var je=R?"scroll":null,Ge=this.direction=="v"?"y":"x",Se={};Se["overflow-"+Ge]=je,Se["box-sizing"]="border-box",Se.margin="0",Se.border="0",this.position=="absolute"&&(Se.position="absolute",Se.top="0",this.direction=="h"?Se.left=Se.right="0":(Se.bottom="0",Se.right=this.rtl?"0":"",Se.left=this.rtl?"":"0")),M(this.scroller,Se)}},this._dumbCss(!0),W){var q="paddingRight",ae={},re=P.getComputedStyle(this.scroller)[[q]];C.direction=="h"?q="paddingBottom":C.rtl&&(q="paddingLeft");var be=parseInt(re,10);be!=be&&(be=0),ae[q]=ee+be+"px",M(this.scroller,ae)}return this},update:function(C){return ge.call(this,"upd",C),this.resize(1),this.updatePositions(1),this},dispose:function(){E(this,this.event,"off"),pe(this.root,this.params.direction,"off"),this.params.direction=="v"?this._setCrossSizes(this.scroller,""):this._setCrossSizes(this.clipper,""),this._dumbCss(!1),this.barOn(!0),ge.call(this,"dispose"),ue[this.params.index]=null,this.params=null,this._disposed=!0},on:function(C,de,oe){for(var Q=C.split(" "),_=0;_<Q.length;_++)Q[_]=="init"?de.call(this,oe):(this.events[Q[_]]=this.events[Q[_]]||[],this.events[Q[_]].push(function(Te){de.call(this,Te||oe)}))},baron:function(C){return C.root=this.params.root,C.scroller=this.params.scroller,C.direction=this.params.direction=="v"?"h":"v",C._chain=!0,D(C)}},D.prototype.constructor.prototype=D.prototype,D.noConflict=function(){return P.baron=L,D},D.version="3.0.1",D.prototype.autoUpdate=o(12582)(P),D.prototype.fix=o(41197),D.prototype.controls=o(69786),I.exports=D},41197:(I,S,o)=>{"use strict";var j=o(37420),P=o(69079).AH,G=o(69079).WQ,M=o(69079).rm;I.exports=function(l){var d,v,u={outside:"",inside:"",before:"",after:"",past:"",future:"",radius:0,minView:0},L=[],b=[],ue=[],le=this.scroller,J=this.event,ee=this;function k(D,H,se){var E=H,pe=se==1?"pos":"oppos";v<(u.minView||0)&&(E=void 0),P(d[D],this.origin.pos,""),P(d[D],this.origin.oppos,""),M(d[D],u.outside),E!==void 0&&(E+="px",P(d[D],this.origin[pe],E),G(d[D],u.outside))}function W(D){try{var H=document.createEvent("WheelEvent");H.initWebKitWheelEvent(D.originalEvent.wheelDeltaX,D.originalEvent.wheelDeltaY),le.dispatchEvent(H),D.preventDefault()}catch{}}function g(D){var H;for(var se in D)u[se]=D[se];if(u.elements instanceof HTMLElement?d=[u.elements]:typeof u.elements=="string"?d=this.scroller.querySelectorAll(u.elements):u.elements&&u.elements[0]instanceof HTMLElement&&(d=u.elements),d){v=this.scroller[this.origin.client];for(var E=0;E<d.length;E++)H={},H[this.origin.size]=d[E][this.origin.offset]+"px",d[E].parentNode!==this.scroller&&P(d[E].parentNode,H),H={},H[this.origin.crossSize]=d[E].parentNode[this.origin.crossClient]+"px",P(d[E],H),v-=d[E][this.origin.offset],ue[E]=d[E].parentNode[this.origin.offsetPos],L[E]=L[E-1]||0,b[E]=b[E-1]||Math.min(ue[E],0),d[E-1]&&(L[E]+=d[E-1][this.origin.offset],b[E]+=d[E-1][this.origin.offset]),E==0&&ue[E]==0||(this.event(d[E],"mousewheel",W,"off"),this.event(d[E],"mousewheel",W));u.limiter&&d[0]&&(this.track&&this.track!=this.scroller?(H={},H[this.origin.pos]=d[0].parentNode[this.origin.offset]+"px",P(this.track,H)):this.barTopLimit=d[0].parentNode[this.origin.offset],this.scroll()),u.limiter===!1&&(this.barTopLimit=0)}var pe={element:d,handler:function(){for(var ge=this.parentNode,C=ge.offsetTop,de,oe=0;oe<d.length;oe++)d[oe]===this&&(de=oe);var Q=C-L[de];u.scroll?u.scroll({x1:ee.scroller.scrollTop,x2:Q}):ee.scroller.scrollTop=Q},type:"click"};if(u.clickable){this._eventHandlers.push(pe);for(var B=0;B<pe.element.length;B++)J(pe.element[B],pe.type,pe.handler,"on")}}this.on("init",g,l);var ie=[],ne=[];return this.on("init scroll",function(){var D,H,se,E;if(d){var pe;for(E=0;E<d.length;E++)D=0,ue[E]-this.pos()<b[E]+u.radius?(D=1,H=L[E]):ue[E]-this.pos()>b[E]+v-u.radius?(D=2,H=this.scroller[this.origin.client]-d[E][this.origin.offset]-L[E]-v):(D=3,H=void 0),se=!1,(ue[E]-this.pos()<b[E]||ue[E]-this.pos()>b[E]+v)&&(se=!0),(D!=ie[E]||se!=ne[E])&&(k.call(this,E,H,D),ie[E]=D,ne[E]=se,pe=!0);if(pe)for(E=0;E<d.length;E++)ie[E]==1&&u.past&&(G(d[E],u.past),M(d[E],u.future)),ie[E]==2&&u.future&&(G(d[E],u.future),M(d[E],u.past)),ie[E]==3&&(M(d[E],u.past),M(d[E],u.future),G(d[E],u.inside)),ie[E]!=ie[E+1]&&ie[E]==1?(G(d[E],u.before),M(d[E],u.after)):ie[E]!=ie[E-1]&&ie[E]==2?(G(d[E],u.after),M(d[E],u.before)):(M(d[E],u.before),M(d[E],u.after)),u.grad&&(ne[E]?G(d[E],u.grad):M(d[E],u.grad))}}),this.on("resize upd",function(D){g.call(this,D&&D.fix)}),this}},37420:I=>{I.exports=function(o,j,P){var G=console[o]||console.log,M=["Baron: "+j,P];Function.prototype.apply.call(G,console,M)}},69079:I=>{"use strict";var S,o=!1;try{var j=Object.defineProperty({},"passive",{get:function(){o=!0}});window.addEventListener("test",null,j)}catch{}I.exports.f0=function(M,K,l,d){var v=K.split(" "),u=d=="on"?"add":"remove";v.forEach(function(L){var b=!1;["scroll","touchstart","touchmove"].indexOf(L)!=-1&&o&&(b={passive:!0}),M[u+"EventListener"](L,l,b)})};function P(G,M){for(var K in G)G.hasOwnProperty(K)&&M(K,G[K])}I.exports.AH=function(M,K,l){var d;if(l===void 0){if(typeof K=="string")return M.style[K];d=K}else d={},d[K]=l;P(d,function(v,u){M.style[v]=u})},I.exports.WQ=function(M,K){K&&M.classList.add(K)},I.exports.rm=function(M,K){K&&M.classList.remove(K)},I.exports.zy=function(M,K){return K?M.classList.contains(K):!1},I.exports.o8=function(M){var K={},l=M||{};return P(l,function(d,v){K[d]=v}),K},I.exports.qs=function(M,K){if(M instanceof HTMLElement)return M;var l=K||document;return l.querySelector(M)},S=P},27808:(I,S,o)=>{"use strict";o.d(S,{AngularApp:()=>Zi});var j=o(92747),P=o.n(j),G=o(64423),M=o(26272),K=o(3591),l=o(67982),d=o(28444);const v=`
  <ng-transclude class="panel-height-helper"></ng-transclude>
`;l.m7.directive("grafanaPanel",["$timeout",t=>({restrict:"E",template:v,transclude:!0,scope:{ctrl:"="},link:(e,r)=>{const n=e.ctrl,i=e.ctrl.panel,s=new G.yU;let a;function c(){a&&a.update()}n.events.on(M.ee.componentDidMount,()=>{if(n.__proto__.constructor.scrollable){const f="baron baron__root baron__clipper panel-content--scrollable",T="baron__scroller",p=`
            <div class="baron__track">
              <div class="baron__bar"></div>
            </div>
          `,A=r,x=r.find(":first").find(":first");A.addClass(f),$(p).appendTo(A),x.addClass(T),a=P()({root:A[0],scroller:x[0],bar:".baron__bar",barOnCls:"_scrollbar",scrollingCls:"_scrolling"}),a.scroll()}});function h(){n.height=e.$parent.$parent.size.height,n.width=e.$parent.$parent.size.width}h(),s.add(i.events.subscribe(K._,()=>{h(),n.events.emit("refresh")})),s.add(i.events.subscribe(d.XM,f=>{f.payload?.fromAngular||(h(),t(()=>{c(),n.events.emit("render")}))})),s.add(n.events.subscribe(d.XM,f=>{f.payload&&(f.payload.fromAngular=!0,i.events.publish(f))})),e.$on("$destroy",()=>{r.off(),s.unsubscribe(),n.events.emit(M.ee.panelTeardown),n.events.removeAllListeners(),a&&a.dispose()}),i.events.publish(d.vk)}})]);var u=o(59559),L=o(7025),b=o.n(L);const ue=b().module("grafana.directives"),le={};ue.directive("panelEditorTab",["dynamicDirectiveSrv",J]);function J(t){return t.create({scope:{ctrl:"=",editorTab:"="},directive:e=>{const r=e.ctrl.pluginId,n=e.editorTab.title.toLowerCase().replace(" ","-").replace("&","").replace(" ","").replace(" ","-");if(le[r]){if(le[r][n])return le[r][n]}else le[r]=[];const i={fn:()=>e.editorTab.directiveFn(),name:`panel-editor-tab-${r}${n}`};return le[r][n]=i,i}})}class ee{constructor(){this.hasTextEditMode=!1}$onInit(){this.panelCtrl=this.queryCtrl.panelCtrl,this.target=this.queryCtrl.target,this.panel=this.panelCtrl.panel,this.hasTextEditMode&&this.queryCtrl.toggleEditorMode&&(this.panelCtrl.toggleEditorMode=this.queryCtrl.toggleEditorMode.bind(this.queryCtrl)),this.queryCtrl.getCollapsedText&&(this.panelCtrl.getCollapsedText=this.queryCtrl.getCollapsedText.bind(this.queryCtrl))}}l.m7.directive("queryEditorRow",k);function k(){return{restrict:"E",controller:ee,bindToController:!0,controllerAs:"ctrl",templateUrl:"public/app/angular/panel/partials/query_editor_row.html",transclude:!0,scope:{queryCtrl:"=",canCollapse:"=",hasTextEditMode:"="}}}var W=o(50410),g=o(2543),ie=o.n(g),ne=o(47232),D=o(23989);l.Ay.filter("stringSort",()=>t=>t.sort()),l.Ay.filter("slice",()=>(t,e,r)=>(0,g.isUndefined)(t)?t:t.slice(e,r)),l.Ay.filter("stringify",()=>t=>(0,g.isObject)(t)&&!(0,g.isArray)(t)?b().toJson(t):(0,g.isNull)(t)?null:t.toString()),l.Ay.filter("moment",()=>(t,e)=>{switch(e){case"ago":return(0,ne.KQ)(t).fromNow()}return(0,ne.KQ)(t).fromNow()});function H(t=(0,D.w)()){const e=(r,n)=>{let i;return n.ctrl?i=(n.ctrl.panel||n.ctrl.row).scopedVars:i=n.row.scopedVars,t.replaceWithText(r,i)};return e.$stateful=!0,e}l.Ay.filter("interpolateTemplateVars",H);const se={};class E{constructor(){}set(){console.warn("old deprecated alert srv being used")}}l.Ay.service("alertSrv",E);class pe{constructor(e){this.$compile=e}static{this.$inject=["$compile"]}addDirective(e,r,n){const i=b().element(document.createElement(r));this.$compile(i)(n),e.empty(),e.append(i)}link(e,r,n,i){const s=i.directive(e);if(!s||!s.fn){r.empty();return}s.fn.registered||(l.Ay.directive(n.$normalize(s.name),s.fn),s.fn.registered=!0),this.addDirective(r,s.name,e)}create(e){return{restrict:"E",scope:e.scope,link:(n,i,s)=>{if(e.watchPath){let a=null;n.$watch(e.watchPath,()=>{a&&a.$destroy(),a=n.$new(),this.link(a,i,s,e)})}else this.link(n,i,s,e)}}}}l.Ay.service("dynamicDirectiveSrv",pe);var B=o(96540),ge=o(5338);function C(t,e){if(b().isFunction(t))return t;if(!t)throw new Error("ReactComponent name attribute must be specified");let r;try{r=e.get(t)}catch{}if(!r)try{r=t.split(".").reduce((n,i)=>n[i],window)}catch{}if(!r)throw Error("Cannot find react component "+t);return r}function de(t,e){if(t.wrappedInApply)return t;const r=function(){const n=arguments,i=e.$root.$$phase;return i==="$apply"||i==="$digest"?t.apply(null,n):e.$apply(()=>t.apply(null,n))};return r.wrappedInApply=!0,r}function oe(t,e,r){return Object.keys(t||{}).reduce((n,i)=>{const s=t[i],a=(r||{})[i]||{};return n[i]=b().isFunction(s)&&a.wrapApply!==!1?de(s,e):s,n},{})}function Q(t,e,r,n){const i=b().isFunction(e.$watchCollection),s=b().isFunction(e.$watchGroup),a=[];for(const c of r){const h=we(c),f=Pe(t,c);!h||h.match(/\(.*\)/)||f==="one-time"||(f==="collection"&&i?e.$watchCollection(h,n):f==="reference"&&s?a.push(h):e.$watch(h,n,f!=="reference"))}t==="one-time"&&n(),a.length&&e.$watchGroup(a,n)}function _(t,e,r,n){r.$evalAsync(()=>{n.render(B.createElement(t,e))})}function Te(t){return Array.isArray(t)?t[0]:t}function ve(t){return Array.isArray(t)?t[1]:{}}function we(t){return Array.isArray(t)?t[0]:t}function De(t,e){const r=Object.keys(t).find(n=>n.toLowerCase()===e.toLowerCase()||(0,g.kebabCase)(n)===(0,g.kebabCase)(e));return t[r]}function Pe(t,e){return Array.isArray(e)&&b().isObject(e[1])&&e[1].watchDepth||t}const V=t=>({restrict:"E",replace:!0,link:function(e,r,n){const i=C(n.name,t),s=(0,ge.H)(r[0]),a=()=>{const c=e.$eval(n.props),h=oe(c,e);_(i,h,e,s)};n.props?Q(n.watchDepth,e,[n.props],a):a(),e.$on("$destroy",()=>{n.onScopeDestroy?e.$eval(n.onScopeDestroy,{unmountComponent:s.unmount.bind(this)}):s.unmount()})}}),z=t=>(e,r,n,i)=>{const s={restrict:"E",replace:!0,link:function(a,c,h){const f=C(e,t),T=(0,ge.H)(c[0]);r=r||Object.keys(f.propTypes||{});const p=()=>{let x={};const F={};r.forEach(he=>{const w=Te(he);x[w]=a.$eval(De(h,w)),F[w]=ve(he)}),x=oe(x,a,F),x=b().extend({},x,i),_(f,x,a,T)},A=r.map(x=>Array.isArray(x)?[De(h,x[0]),ve(x)]:De(h,x));r.length?Q(h.watchDepth,a,A,p):p(),a.$on("$destroy",()=>{h.onScopeDestroy?a.$eval(h.onScopeDestroy,{unmountComponent:T.unmount.bind(this)}):T.unmount()})}};return b().extend(s,n)},N=b().module("react",[]);N.directive("reactComponent",["$injector",V]),N.factory("reactDirective",["$injector",z]),l.Ay.service("uiSegmentSrv",["$sce","templateSrv",Y]);function Y(t,e){const r=this;class n{constructor(s){if(s==="*"||s.value==="*"){this.value="*",this.html=t.trustAsHtml('<i class="fa fa-asterisk"><i>'),this.type=s.type,this.expandable=!0;return}if((0,g.isString)(s)){this.value=s,this.html=t.trustAsHtml(e.highlightVariablesAsHtml(this.value));return}this.text=s.value,this.cssClass=s.cssClass,this.custom=s.custom,this.type=s.type,this.fake=s.fake,this.value=s.value,this.selectMode=s.selectMode,this.expandable=s.expandable,this.html=s.html||t.trustAsHtml(e.highlightVariablesAsHtml(this.value))}}this.getSegmentForValue=function(i,s){return i?this.newSegment(i):this.newSegment({value:s,fake:!0})},this.newSelectMeasurement=()=>new n({value:"select measurement",fake:!0}),this.newFake=(i,s,a)=>new n({value:i,fake:!0,type:s,cssClass:a}),this.newSegment=i=>new n(i),this.newKey=i=>new n({value:i,type:"key",cssClass:"query-segment-key"}),this.newKeyValue=i=>new n({value:i,type:"value",cssClass:"query-segment-value"}),this.newCondition=i=>new n({value:i,type:"condition",cssClass:"query-keyword"}),this.newOperator=i=>new n({value:i,type:"operator",cssClass:"query-segment-operator"}),this.newOperators=i=>(0,g.map)(i,s=>new n({value:s,type:"operator",cssClass:"query-segment-operator"})),this.transformToSegments=(i,s)=>a=>{const c=(0,g.map)(a,h=>r.newSegment({value:h.text,expandable:h.expandable}));return i&&(0,g.each)(e.getVariables(),h=>{(s===void 0||s===h.type)&&c.unshift(r.newSegment({type:"value",value:"$"+h.name,expandable:!0}))}),c},this.newSelectMetric=()=>new n({value:"select metric",fake:!0}),this.newPlusButton=()=>new n({fake:!0,html:'<i class="fa fa-plus "></i>',type:"plus-button",cssClass:"query-part"})}var q=o(66899),ae=o.n(q);l.Ay.service("popoverSrv",["$compile","$rootScope","$timeout",re]);function re(t,e,r){let n=null;this.close=()=>{n&&n.close()},this.show=i=>{n&&(n.close(),n=null);const s=(0,g.extend)(e.$new(!0),i.model);let a;const c=()=>{setTimeout(()=>{s.$destroy(),a.tether&&a.destroy(),i.onClose&&i.onClose()}),n=null};s.dismiss=()=>{a.close()};const h=document.createElement("div");return h.innerHTML=i.template,t(h)(s),r(()=>{a=new(ae())({target:i.element,content:h,position:i.position,classes:i.classNames||"drop-popover",openOn:i.openOn,hoverCloseDelay:200,tetherOptions:{constraints:[{to:"scrollParent",attachment:"together"}]}}),a.on("close",()=>{c()}),n=a,n.open()},100),()=>{a&&a.close()}}}class be{constructor(e){this.$timeout=e,this.timers=[]}static{this.$inject=["$timeout"]}register(e){return this.timers.push(e),e}cancel(e){this.timers=(0,g.without)(this.timers,e),this.$timeout.cancel(e)}cancelAll(){(0,g.each)(this.timers,e=>{this.$timeout.cancel(e)}),this.timers=[]}}l.Ay.service("timer",be);class R{constructor(e,r){this.$compile=e,this.$rootScope=r}static{this.$inject=["$compile","$rootScope"]}load(e,r,n){const i=this.$rootScope.$new();(0,g.assign)(i,r);const s=this.$compile(n)(i);return b().element(e).append(s),{destroy:()=>{i.$destroy(),s.remove()},digest:()=>{i.$$phase||i.$digest()},getScope:()=>i}}}l.Ay.service("angularLoader",R);var fe=o(34796),O=o.n(fe);const je=O()(window);O().fn.place_tt=(()=>{const t={offset:5};return function(e,r,n){return n=O().extend(!0,{},t,n),this.each(()=>{const i=O()(this);let s,a;i.addClass("grafana-tooltip"),O()("#tooltip").remove(),i.appendTo(document.body),n.compile&&b().element(document).injector().invoke(["$compile","$rootScope",(f,T)=>{const p=T.$new(!0);(0,g.extend)(p,n.scopeData),f(i)(p),p.$digest(),p.$destroy()}]),s=i.outerWidth(!0),a=i.outerHeight(!0);const c=e+n.offset+s>je.width()?e-n.offset-s:e+n.offset,h=r+n.offset+a>je.height()?r-n.offset-a:r+n.offset;i.css("left",c>0?c:0),i.css("top",h>0?h:0)})}})();function Ge(t){const e='<input type="text" class="gf-form-input input-medium tight-form-input" spellcheck="false" style="display:none"></input>',r='<a class="gf-form-label tight-form-func dropdown-toggle" tabindex="1" gf-dropdown="menuItems" data-toggle="dropdown" ><i class="fa fa-plus"></i></a>';return{scope:{menuItems:"=dropdownTypeahead",dropdownTypeaheadOnSelect:"&dropdownTypeaheadOnSelect",model:"=ngModel"},link:(n,i,s)=>{const a=O()(e),c=O()(r);a.appendTo(i),c.appendTo(i),s.linkText&&c.html(s.linkText),s.ngModel&&n.$watch("model",T=>{(0,g.each)(n.menuItems,p=>{(0,g.each)(p.submenu,A=>{A.value===T&&c.html(A.text)})})});const h=(0,g.reduce)(n.menuItems,(T,p,A)=>(p.submenu?(0,g.each)(p.submenu,(x,F)=>{x.click="menuItemSelected("+A+","+F+")",T.push(p.text+" "+x.text)}):(p.click="menuItemSelected("+A+")",T.push(p.text)),T),[]),f=()=>{a.hide(),a.val(""),c.show(),c.focus(),i.removeClass("open")};n.menuItemSelected=(T,p)=>{const A=n.menuItems[T],x={$item:A};A.submenu&&p!==void 0&&(x.$subItem=A.submenu[p]),n.dropdownTypeaheadOnSelect(x),f()},a.attr("data-provide","typeahead"),a.typeahead({source:h,minLength:1,items:10,updater:T=>{const p={};return(0,g.each)(n.menuItems,A=>{(0,g.each)(A.submenu,x=>{T===A.text+" "+x.text&&(p.$subItem=x,p.$item=A)})}),p.$item&&n.$apply(()=>{n.dropdownTypeaheadOnSelect(p)}),a.trigger("blur"),""}}),c.click(()=>{c.hide(),a.show(),a.focus()}),a.keyup(()=>{i.toggleClass("open",a.val()==="")}),i.mousedown(T=>{T.preventDefault()}),a.blur(()=>{a.hide(),a.val(""),c.show(),c.focus(),setTimeout(()=>{i.removeClass("open")},200)}),t(i.contents())(n)}}}function Se(t){const e='<input type="text" class="gf-form-input" spellcheck="false" style="display:none"></input>',r='<a class="{{buttonTemplateClass}} dropdown-toggle" tabindex="1" gf-dropdown="menuItems" data-toggle="dropdown" ><i class="fa fa-plus"></i></a>';return{scope:{menuItems:"=dropdownTypeahead2",dropdownTypeaheadOnSelect:"&dropdownTypeaheadOnSelect",model:"=ngModel",buttonTemplateClass:"@"},link:(n,i,s)=>{const a=O()(e);n.buttonTemplateClass||(n.buttonTemplateClass="gf-form-input");const c=O()(r),h={blur:null};a.appendTo(i),c.appendTo(i),s.linkText&&c.html(s.linkText),s.ngModel&&n.$watch("model",p=>{(0,g.each)(n.menuItems,A=>{(0,g.each)(A.submenu,x=>{x.value===p&&c.html(x.text)})})});const f=(0,g.reduce)(n.menuItems,(p,A,x)=>(A.submenu?(0,g.each)(A.submenu,(F,he)=>{F.click="menuItemSelected("+x+","+he+")",p.push(A.text+" "+F.text)}):(A.click="menuItemSelected("+x+")",p.push(A.text)),p),[]),T=()=>{a.hide(),a.val(""),c.show(),c.focus(),i.removeClass("open")};n.menuItemSelected=(p,A)=>{const x=n.menuItems[p],F={$item:x};x.submenu&&A!==void 0&&(F.$subItem=x.submenu[A]),n.dropdownTypeaheadOnSelect(F),T()},a.attr("data-provide","typeahead"),a.typeahead({source:f,minLength:1,items:10,updater:p=>{const A={};return(0,g.each)(n.menuItems,x=>{(0,g.each)(x.submenu,F=>{p===x.text+" "+F.text&&(A.$subItem=F,A.$item=x)})}),A.$item&&n.$apply(()=>{n.dropdownTypeaheadOnSelect(A)}),a.trigger("blur"),""}}),c.click(()=>{c.hide(),a.show(),a.focus()}),a.keyup(()=>{i.toggleClass("open",a.val()==="")}),i.mousedown(p=>{p.preventDefault(),h.blur=null}),a.blur(()=>{h.blur=setTimeout(()=>{T()},1)}),t(i.contents())(n)}}}l.Ay.directive("dropdownTypeahead",["$compile",Ge]),l.Ay.directive("dropdownTypeahead2",["$compile",Se]);function et(t){return{link:(e,r)=>{const n=r[0],i=()=>{const a=new Event("change");return n.dispatchEvent(a)},s=({animationName:a})=>{switch(a){case"onAutoFillStart":return i();case"onAutoFillCancel":return i()}return null};n.addEventListener("animationstart",s),e.$on("$destroy",()=>{n.removeEventListener("animationstart",s)})}}}l.Ay.directive("autofillEventFix",["$compile",et]);function We(t,e,r){const n='<input type="text" data-provide="typeahead"  class="gf-form-input input-medium" spellcheck="false" style="display:none"></input>',i='<a class="gf-form-label" ng-class="segment.cssClass" tabindex="1" give-focus="segment.focus" ng-bind-html="segment.html"></a>',s='<a class="gf-form-input gf-form-input--dropdown" ng-class="segment.cssClass" tabindex="1" give-focus="segment.focus" ng-bind-html="segment.html"></a>';return{scope:{segment:"=",getOptions:"&",onChange:"&",debounce:"@"},link:(a,c)=>{const h=O()(n),f=a.segment,T=O()(f.selectMode?s:i);let p=null,A=null,x=!0;const F=a.debounce;h.appendTo(c),T.appendTo(c),a.updateVariableValue=w=>{w===""||f.value===w||a.$apply(()=>{const X=(0,g.find)(a.altSegments,{value:w});X?(f.value=X.value,f.html=X.html||e.trustAsHtml(r.highlightVariablesAsHtml(X.value)),f.fake=!1,f.expandable=X.expandable,X.type&&(f.type=X.type)):f.custom!=="false"&&(f.value=w,f.html=e.trustAsHtml(r.highlightVariablesAsHtml(w)),f.expandable=!0,f.fake=!1),a.onChange()})},a.switchToLink=w=>{x&&!w||(clearTimeout(A),A=null,x=!0,h.hide(),T.show(),a.updateVariableValue(h.val()))},a.inputBlur=()=>{A=setTimeout(a.switchToLink,200)},a.source=(w,X)=>{a.$apply(()=>{a.getOptions({$query:w}).then(Z=>{a.altSegments=Z,p=(0,g.map)(a.altSegments,te=>(0,g.escape)(te.value)),f.custom!=="false"&&!f.fake&&(0,g.indexOf)(p,f.value)===-1&&p.unshift((0,g.escape)(f.value)),X(p)})})},a.updater=w=>(w=(0,g.unescape)(w),w===f.value?(clearTimeout(A),h.focus(),w):(h.val(w),a.switchToLink(!0),w)),a.matcher=function(w){if(x)return!1;let X=this.query;X[0]==="/"&&(X=X.substring(1)),X[X.length-1]==="/"&&(X=X.substring(0,X.length-1));try{return w.toLowerCase().match(X.toLowerCase())}catch{return!1}},h.attr("data-provide","typeahead"),h.typeahead({source:a.source,minLength:0,items:1e4,updater:a.updater,matcher:a.matcher});const he=h.data("typeahead");he.lookup=function(){this.query=this.$element.val()||"";const w=this.source(this.query,O().proxy(this.process,this));return w&&this.process(w)},F&&(he.lookup=(0,g.debounce)(he.lookup,500,{leading:!0})),T.keydown(w=>{(w.keyCode===40||w.keyCode===13)&&T.click()}),T.click(()=>{p=null,h.css("width",Math.max(T.width(),80)+16+"px"),T.hide(),h.show(),h.focus(),x=!1;const w=h.data("typeahead");w&&(h.val(""),w.lookup())}),h.blur(a.inputBlur),t(c.contents())(a)}}}function Fe(t){return{template:'<metric-segment segment="segment" get-options="getOptionsInternal()" on-change="onSegmentChange()"></metric-segment>',restrict:"E",scope:{property:"=",options:"=",getOptions:"&",onChange:"&"},link:{pre:function(r,n,i){let s;r.valueToSegment=a=>{const c=(0,g.find)(r.options,{value:a}),h={cssClass:i.cssClass,custom:i.custom,value:c?c.text:a,selectMode:i.selectMode};return t.newSegment(h)},r.getOptionsInternal=()=>r.options?(s=r.options,Promise.resolve((0,g.map)(r.options,a=>({value:a.text})))):r.getOptions().then(a=>(s=a,(0,g.map)(a,c=>c.html?c:{value:c.text}))),r.onSegmentChange=()=>{if(s){const a=(0,g.find)(s,{text:r.segment.value});a&&a.value!==r.property?r.property=a.value:i.custom!=="false"&&(r.property=r.segment.value)}else r.property=r.segment.value;r.$$postDigest(()=>{r.$apply(()=>{r.onChange()})})},r.segment=r.valueToSegment(r.property)}}}}l.Ay.directive("metricSegment",["$compile","$sce","templateSrv",We]),l.Ay.directive("metricSegmentModel",["uiSegmentSrv",Fe]),l.Ay.directive("tip",["$compile",tt]);function tt(t){return{restrict:"E",link:(e,r,n)=>{let i='<i class="grafana-tip fa fa-'+(n.icon||"question-circle")+`" bs-tooltip="'`+r.text().replace(/[\'\"\\{}<>&]/g,s=>"&amp;#"+s.charCodeAt(0)+";")+`'"></i>`;r.replaceWith(t(b().element(i))(e))}}}l.Ay.directive("compile",["$compile",nt]);function nt(t){return{restrict:"A",link:(e,r,n)=>{e.$watch(i=>i.$eval(n.compile),i=>{r.html(i),t(r.contents())(e)})}}}l.Ay.directive("watchChange",rt);function rt(){return{scope:{onchange:"&watchChange"},link:(t,e)=>{e.on("input",()=>{t.$apply(()=>{t.onchange({inputValue:e.val()})})})}}}l.Ay.directive("editorOptBool",["$compile",Wt]);function Wt(t){return{restrict:"E",link:(e,r,n)=>{const i=n.change?' ng-change="'+n.change+'"':"",s=n.tip?" <tip>"+n.tip+"</tip>":"",c='<div class="editor-option gf-form-checkbox text-center"'+(n.showIf?' ng-show="'+n.showIf+'" ':"")+'> <label for="'+n.model+'" class="small">'+n.text+s+'</label><input class="cr1" id="'+n.model+'" type="checkbox"        ng-model="'+n.model+'"'+i+'       ng-checked="'+n.model+'"></input> <label for="'+n.model+'" class="cr1"></label>';r.replaceWith(t(b().element(c))(e))}}}l.Ay.directive("editorCheckbox",["$compile, $interpolate",Qt]);function Qt(t,e){return{restrict:"E",link:(r,n,i)=>{const s=e(i.text)(r),a=e(i.model)(r),c=i.change?' ng-change="'+i.change+'"':"",h=i.tip?" <tip>"+i.tip+"</tip>":"",f='<label for="'+r.$id+a+'" class="checkbox-label">'+s+h+"</label>";let T='<input class="cr1" id="'+r.$id+a+'" type="checkbox"        ng-model="'+a+'"'+c+'       ng-checked="'+a+'"></input> <label for="'+r.$id+a+'" class="cr1"></label>';T=T+f,n.addClass("gf-form-checkbox"),n.html(t(b().element(T))(r))}}}l.Ay.directive("gfDropdown",["$parse","$compile","$timeout",Yt]);function Yt(t,e,r){function n(i,s){const c=['<ul class="dropdown-menu '+(s==="top"?"dropup":"")+'" role="menu" aria-labelledby="drop1">',"</ul>"];for(let h=0;h<i.length;h++){const f=i[h];if(f.divider){c.splice(h+1,0,'<li class="divider"></li>');continue}let T="<li"+(f.submenu&&f.submenu.length?' class="dropdown-submenu"':"")+'><a tabindex="-1" ng-href="'+(f.href||"")+'"'+(f.click?' ng-click="'+f.click+'"':"")+(f.target?' target="'+f.target+'"':"")+(f.method?' data-method="'+f.method+'"':"")+">"+(f.text||"")+"</a>";f.submenu&&f.submenu.length&&(T+=n(f.submenu).join(`
`)),T+="</li>",c.splice(h+1,0,T)}return c}return{restrict:"EA",scope:!0,link:function(s,a,c){const h=t(c.gfDropdown),f=h(s);r(()=>{const T=a.data("placement");b().element(n(f,T).join("")).insertAfter(a),e(a.next("ul.dropdown-menu"))(s)}),a.addClass("dropdown-toggle").attr("data-toggle","dropdown")}}}l.Ay.directive("bsTooltip",["$parse","$compile",function(t,e){return{restrict:"A",scope:!0,link:function(n,i,s){let a=t(s.bsTooltip),c=a(n);n.$watch(s.bsTooltip,function(f,T){f!==T&&(c=f)}),i.on("show",function(f){O()(".tooltip.in").each(function(){const T=O()(this),p=T.data("tooltip");p&&!p.$element.is(i)&&T.tooltip("hide")})}),i.tooltip({title:function(){return b().isFunction(c)?c.apply(null,arguments):c},html:!0,container:"body"});const h=i.data("tooltip");h.show=function(){const f=O().fn.tooltip.Constructor.prototype.show.apply(this,arguments);return this.tip().data("tooltip",this),f},n._tooltip=function(f){i.tooltip(f)},n.hide=function(){i.tooltip("hide")},n.show=function(){i.tooltip("show")},n.dismiss=n.hide}}}]),l.Ay.directive("bsTypeahead",["$parse",function(t){return{restrict:"A",require:"?ngModel",link:function(r,n,i,s){let a=t(i.bsTypeahead),c=a(r);r.$watch(i.bsTypeahead,function(f,T){f!==T&&(c=f)}),n.attr("data-provide","typeahead"),n.typeahead({source:function(){return b().isFunction(c)?c.apply(null,arguments):c},minLength:i.minLength||1,items:i.item,updater:function(f){return s&&r.$apply(function(){s.$setViewValue(f)}),r.$emit("typeahead-updated",f),f}});const h=n.data("typeahead");h.lookup=function(){let f;return this.query=this.$element.val()||"",this.query.length<this.options.minLength?this.shown?this.hide():this:(f=(0,g.isFunction)(this.source)?this.source(this.query,O().proxy(this.process,this)):this.source,f?this.process(f):this)},i.matchAll&&(h.matcher=function(){return!0}),i.minLength==="0"&&setTimeout(function(){n.on("focus",function(){n.val().length===0&&setTimeout(n.typeahead.bind(n,"lookup"),200)})})}}}]);var Et=o(65879);function Xt(){return{restrict:"A",priority:1,require:"ngModel",link:(t,e,r,n)=>{r.type==="radio"||r.type==="checkbox"||(e.off("input keydown change"),e.bind("blur",()=>{t.$apply(()=>{n.$setViewValue(e.val())})}))}}}function Jt(){return{restrict:"A",require:"ngModel",link:(t,e,r,n)=>{n.$parsers.push(i=>i===""?null:i)}}}function Zt(){return{require:"ngModel",link:(t,e,r,n)=>{n.$validators.integer=(i,s)=>n.$isEmpty(i)||s.indexOf("$")===0||s.indexOf("+$")===0?!0:Et.describeTextRange(s).invalid!==!0}}}l.Ay.directive("ngModelOnblur",Xt),l.Ay.directive("emptyToNull",Jt),l.Ay.directive("validTimeSpan",Zt);var qt=o(69613),ns=o(42346);function bt(t,e){const{color:r,borderColor:n}=(0,qt.MC)(t);e.css("background-color",r),e.css("border-color",n)}function _t(){return{scope:{tagColorFromName:"="},link:(t,e)=>{bt(t.tagColorFromName,e)}}}function en(){function t(e,r){if(r)return b().isFunction(e.$parent[r])?e.$parent[r]:n=>n[r]}return{restrict:"EA",scope:{model:"=ngModel",onTagsUpdated:"&"},template:"<select multiple></select>",replace:!1,link:function(e,r,n){b().isArray(e.model)||(e.model=[]);const i=O()("select",r);n.placeholder&&i.attr("placeholder",n.placeholder),i.tagsinput({typeahead:{source:b().isFunction(e.$parent[n.typeaheadSource])?e.$parent[n.typeaheadSource]:null},widthClass:n.widthClass,itemValue:t(e,n.itemvalue),itemText:t(e,n.itemtext),tagClass:b().isFunction(e.$parent[n.tagclass])?e.$parent[n.tagclass]:()=>n.tagclass}),i.on("itemAdded",s=>{e.model.indexOf(s.item)===-1&&(e.model.push(s.item),e.onTagsUpdated&&e.onTagsUpdated());const a=i.next().children("span").filter(()=>O()(this).text()===s.item);bt(s.item,a)}),i.on("itemRemoved",s=>{const a=e.model.indexOf(s.item);a!==-1&&(e.model.splice(a,1),e.onTagsUpdated&&e.onTagsUpdated())}),e.$watch("model",()=>{b().isArray(e.model)||(e.model=[]),i.tagsinput("removeAll");for(let s=0;s<e.model.length;s++)i.tagsinput("add",e.model[s])},!0)}}}l.Ay.directive("tagColorFromName",_t),l.Ay.directive("bootstrapTagsinput",en);function tn(t){let e=t[0];const r=t[t.length-1];let n;e=e.nextSibling;for(let i=1;e!==r&&e;i++)(n||t[i]!==e)&&(n||(n=O()([].slice.call(t,0,i))),n.push(e)),e=e.nextSibling;return n||t}l.Ay.directive("rebuildOnChange",["$animate",nn]);function nn(t){return{multiElement:!0,terminal:!0,transclude:!0,priority:600,restrict:"E",link:(e,r,n,i,s)=>{let a,c,h;function f(){h&&(h.remove(),h=null),c&&(c.$destroy(),c=null),a&&(h=tn(a.clone),t.leave(h).then(()=>{h=null}),a=null)}e.$watch(n.property,function(p,A){c&&p!==A&&f(),!c&&(p||n.showNull)?s((x,F)=>{c=F,x[x.length++]=document.createComment(" end rebuild on change "),a={clone:x},t.enter(x,r.parent(),r)}):f()})}}}l.Ay.directive("giveFocus",()=>(t,e,r)=>{e.click(n=>{n.stopPropagation()}),t.$watch(r.giveFocus,n=>{n&&setTimeout(()=>{e.focus();const i=e[0];if(i.setSelectionRange){const s=e.val().length*2;i.setSelectionRange(s,s)}},200)},!0)});const rs={};class rn{constructor(){const e=()=>{};this.observer=new MutationObserver(e);const r={attributes:!0,attributeFilter:["class"],characterData:!1,childList:!0,subtree:!1};this.observer.observe(b().element(".delta-html")[0],r)}$onDestroy(){this.observer.disconnect()}}function sn(){return{controller:rn,replace:!1,restrict:"A"}}l.Ay.directive("diffDelta",sn);class on{constructor(e,r,n){this.$scope=e,this.$rootScope=r,this.$anchorScroll=n}static{this.$inject=["$scope","$rootScope","$anchorScroll"]}goToLine(e){let r;const n=()=>{this.$anchorScroll(`l${e}`),r()};this.$scope.switchView().then(()=>{r=this.$rootScope.$on("json-diff-ready",n.bind(this))})}}function an(){return{controller:on,controllerAs:"ctrl",replace:!0,restrict:"E",scope:{line:"@lineDisplay",link:"@lineLink",switchView:"&"},template:'<a class="diff-linenum btn btn-inverse btn-small" ng-click="ctrl.goToLine(link)">Line {{ line }}</a>'}}l.Ay.directive("diffLinkJson",an);function ln(){"use strict";return{restrict:"A",require:"ngModel",link:(t,e,r,n)=>{function i(a){return(a||"").split(",")}function s(a){return(0,g.isArray)(a)?(a||"").join(","):a}n.$parsers.push(i),n.$formatters.push(s)}}}l.Ay.directive("arrayJoin",ln);var cn=o(96129),Je=o(14578),un=o(62930),dn=o(83598),pn=o(70104),hn=o(2056),fn=o(33083),mn=o(64919),gn=o(91409),vn=o(10534),yn=o(32264),En=o(96378);function Ie(t,e,r){l.Ay.directive(t,["reactDirective",n=>n((0,En.e)(e,yn.$.theme2),r)])}var bn=o(85242),xn=o(75590),m=o(74848),Tn=o(32017),Cn=o.n(Tn),ut=o(50877),An=o(43127),xt=o(71087),Sn=o(96374);const Ze={components:{queryEditor:{container:"data-testid cloud-monitoring-query-editor",header:{select:"data-testid cloud-monitoring-header"},visualMetricsQueryEditor:{container:{input:"data-testid cloud-monitoring-visual-metrics-query-editor"}},mqlMetricsQueryEditor:{container:{input:"data-testid cloud-monitoring-mql-query-editor"}},sloQueryEditor:{container:{input:"data-testid cloud-monitoring-slo-query-editor"}},promQlQueryEditor:{container:{input:"data-testid cloud-monitoring-prom-ql-query-editor"}}}}};var Ae=(t=>(t.ANNOTATION="annotation",t.PROMQL="promQL",t.SLO="slo",t.TIME_SERIES_LIST="timeSeriesList",t.TIME_SERIES_QUERY="timeSeriesQuery",t))(Ae||{});const ss={filters:[],groupBys:[],secondaryGroupBys:[]};var Ve=(t=>(t.Delta="delta",t.None="none",t.Rate="rate",t))(Ve||{});const os={filters:[],groupBys:[]};var U=(t=>(t.CUMULATIVE="CUMULATIVE",t.DELTA="DELTA",t.GAUGE="GAUGE",t.METRIC_KIND_UNSPECIFIED="METRIC_KIND_UNSPECIFIED",t))(U||{}),y=(t=>(t.BOOL="BOOL",t.DISTRIBUTION="DISTRIBUTION",t.DOUBLE="DOUBLE",t.INT64="INT64",t.MONEY="MONEY",t.STRING="STRING",t.VALUE_TYPE_UNSPECIFIED="VALUE_TYPE_UNSPECIFIED",t))(y||{}),qe=(t=>(t.ALIGN_COUNT="ALIGN_COUNT",t.ALIGN_COUNT_FALSE="ALIGN_COUNT_FALSE",t.ALIGN_COUNT_TRUE="ALIGN_COUNT_TRUE",t.ALIGN_DELTA="ALIGN_DELTA",t.ALIGN_FRACTION_TRUE="ALIGN_FRACTION_TRUE",t.ALIGN_INTERPOLATE="ALIGN_INTERPOLATE",t.ALIGN_MAX="ALIGN_MAX",t.ALIGN_MEAN="ALIGN_MEAN",t.ALIGN_MIN="ALIGN_MIN",t.ALIGN_NEXT_OLDER="ALIGN_NEXT_OLDER",t.ALIGN_NONE="ALIGN_NONE",t.ALIGN_PERCENTILE_05="ALIGN_PERCENTILE_05",t.ALIGN_PERCENTILE_50="ALIGN_PERCENTILE_50",t.ALIGN_PERCENTILE_95="ALIGN_PERCENTILE_95",t.ALIGN_PERCENTILE_99="ALIGN_PERCENTILE_99",t.ALIGN_PERCENT_CHANGE="ALIGN_PERCENT_CHANGE",t.ALIGN_RATE="ALIGN_RATE",t.ALIGN_STDDEV="ALIGN_STDDEV",t.ALIGN_SUM="ALIGN_SUM",t))(qe||{});const as={filters:[]};var In=(t=>(t.Aggregations="aggregations",t.Aligners="aligners",t.AlignmentPeriods="alignmentPeriods",t.DefaultProject="defaultProject",t.LabelKeys="labelKeys",t.LabelValues="labelValues",t.MetricTypes="metricTypes",t.Projects="projects",t.ResourceTypes="resourceTypes",t.SLO="slo",t.SLOServices="sloServices",t.Selectors="selectors",t.Services="services",t))(In||{}),Ln=o(46819),Le=o(81580),Tt=o(10354);const dt=({refId:t,value:e="",onChange:r})=>{const[n,i]=(0,B.useState)(e??""),s=(0,g.debounce)(r,1e3),a=c=>{i(c.currentTarget.value),s(c.currentTarget.value)};return(0,m.jsx)(Le.c,{label:"Alias by",children:(0,m.jsx)(Tt.p,{id:`${t}-alias-by`,value:n,onChange:a})})};var Qe=o(9e4),Ct=o(66864),Nn=o(15292);const ls=71,cs=19,us=14,ds=28,At=[{text:"none",value:"ALIGN_NONE",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION,y.STRING,y.VALUE_TYPE_UNSPECIFIED,y.BOOL],metricKinds:[U.GAUGE]},{text:"delta",value:"ALIGN_DELTA",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[U.CUMULATIVE,U.DELTA]},{text:"rate",value:"ALIGN_RATE",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[U.CUMULATIVE,U.DELTA]},{text:"interpolate",value:"ALIGN_INTERPOLATE",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[U.GAUGE]},{text:"next older",value:"ALIGN_NEXT_OLDER",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION,y.STRING,y.VALUE_TYPE_UNSPECIFIED,y.BOOL],metricKinds:[U.GAUGE]},{text:"min",value:"ALIGN_MIN",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[U.GAUGE,U.DELTA]},{text:"max",value:"ALIGN_MAX",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[U.GAUGE,U.DELTA]},{text:"mean",value:"ALIGN_MEAN",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[U.GAUGE,U.DELTA]},{text:"count",value:"ALIGN_COUNT",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.BOOL],metricKinds:[U.GAUGE,U.DELTA]},{text:"sum",value:"ALIGN_SUM",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[U.GAUGE,U.DELTA]},{text:"stddev",value:"ALIGN_STDDEV",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[U.GAUGE,U.DELTA]},{text:"count true",value:"ALIGN_COUNT_TRUE",valueTypes:[y.BOOL],metricKinds:[U.GAUGE]},{text:"count false",value:"ALIGN_COUNT_FALSE",valueTypes:[y.BOOL],metricKinds:[U.GAUGE]},{text:"fraction true",value:"ALIGN_FRACTION_TRUE",valueTypes:[y.BOOL],metricKinds:[U.GAUGE]},{text:"percentile 99",value:"ALIGN_PERCENTILE_99",valueTypes:[y.DISTRIBUTION],metricKinds:[U.GAUGE,U.DELTA]},{text:"percentile 95",value:"ALIGN_PERCENTILE_95",valueTypes:[y.DISTRIBUTION],metricKinds:[U.GAUGE,U.DELTA]},{text:"percentile 50",value:"ALIGN_PERCENTILE_50",valueTypes:[y.DISTRIBUTION],metricKinds:[U.GAUGE,U.DELTA]},{text:"percentile 05",value:"ALIGN_PERCENTILE_05",valueTypes:[y.DISTRIBUTION],metricKinds:[U.GAUGE,U.DELTA]},{text:"percent change",value:"ALIGN_PERCENT_CHANGE",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[U.GAUGE,U.DELTA]}],wn=[{text:"none",value:"REDUCE_NONE",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION,y.BOOL,y.STRING],metricKinds:[U.GAUGE,U.DELTA,U.CUMULATIVE,U.METRIC_KIND_UNSPECIFIED]},{text:"mean",value:"REDUCE_MEAN",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[U.GAUGE,U.DELTA,U.CUMULATIVE]},{text:"min",value:"REDUCE_MIN",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[U.GAUGE,U.DELTA,U.CUMULATIVE,U.METRIC_KIND_UNSPECIFIED]},{text:"max",value:"REDUCE_MAX",valueTypes:[y.INT64,y.DOUBLE,y.MONEY],metricKinds:[U.GAUGE,U.DELTA,U.CUMULATIVE,U.METRIC_KIND_UNSPECIFIED]},{text:"sum",value:"REDUCE_SUM",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[U.GAUGE,U.DELTA,U.CUMULATIVE,U.METRIC_KIND_UNSPECIFIED]},{text:"std. dev.",value:"REDUCE_STDDEV",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[U.GAUGE,U.DELTA,U.CUMULATIVE,U.METRIC_KIND_UNSPECIFIED]},{text:"count",value:"REDUCE_COUNT",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION,y.BOOL,y.STRING],metricKinds:[U.GAUGE,U.DELTA,U.CUMULATIVE]},{text:"count true",value:"REDUCE_COUNT_TRUE",valueTypes:[y.BOOL],metricKinds:[U.GAUGE,U.DELTA]},{text:"count false",value:"REDUCE_COUNT_FALSE",valueTypes:[y.BOOL],metricKinds:[U.GAUGE,U.DELTA]},{text:"99th percentile",value:"REDUCE_PERCENTILE_99",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[U.GAUGE,U.DELTA,U.CUMULATIVE]},{text:"95th percentile",value:"REDUCE_PERCENTILE_95",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[U.GAUGE,U.DELTA,U.CUMULATIVE]},{text:"50th percentile",value:"REDUCE_PERCENTILE_50",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[U.GAUGE,U.DELTA,U.CUMULATIVE]},{text:"5th percentile",value:"REDUCE_PERCENTILE_05",valueTypes:[y.INT64,y.DOUBLE,y.MONEY,y.DISTRIBUTION],metricKinds:[U.GAUGE,U.DELTA,U.CUMULATIVE]}],St=[{text:"grafana auto",value:"grafana-auto"},{text:"stackdriver auto",value:"stackdriver-auto",hidden:!0},{text:"cloud monitoring auto",value:"cloud-monitoring-auto"},{text:"1m",value:"+60s"},{text:"2m",value:"+120s"},{text:"5m",value:"+300s"},{text:"10m",value:"+600s"},{text:"30m",value:"+1800s"},{text:"1h",value:"+3600s"},{text:"3h",value:"+7200s"},{text:"6h",value:"+21600s"},{text:"1d",value:"+86400s"},{text:"3d",value:"+259200s"},{text:"1w",value:"+604800s"}],Dn=[{text:"auto",value:"auto"},{text:"1m",value:"1m"},{text:"2m",value:"2m"},{text:"5m",value:"5m"},{text:"10m",value:"10m"},{text:"30m",value:"30m"},{text:"1h",value:"1h"},{text:"3h",value:"3h"},{text:"6h",value:"6h"},{text:"1d",value:"1d"},{text:"3d",value:"3d"},{text:"1w",value:"1w"}],On=[{text:"1m",value:"1m"},{text:"2m",value:"2m"},{text:"5m",value:"5m"},{text:"10m",value:"10m"},{text:"30m",value:"30m"},{text:"1h",value:"1h"},{text:"3h",value:"3h"},{text:"6h",value:"6h"},{text:"24h",value:"24h"},{text:"72h",value:"72h"}],Mn=["metadata.system_labels.cloud_account","metadata.system_labels.name","metadata.system_labels.region","metadata.system_labels.state","metadata.system_labels.instance_group","metadata.system_labels.node_name","metadata.system_labels.service_name","metadata.system_labels.top_level_controller_type","metadata.system_labels.top_level_controller_name","metadata.system_labels.container_image"],It="select_slo_burn_rate",Lt=[{label:"SLI Value",value:"select_slo_health"},{label:"SLO Compliance",value:"select_slo_compliance"},{label:"SLO Error Budget Remaining",value:"select_slo_budget_fraction"},{label:"SLO Burn Rate",value:It}],Pn=[{label:"Builder",value:Ae.TIME_SERIES_LIST},{label:"MQL",value:Ae.TIME_SERIES_QUERY},{label:"Service Level Objectives (SLO)",value:Ae.SLO},{label:"PromQL",value:Ae.PROMQL}];var Oe=o(90182);function it({refId:t,projectName:e,datasource:r,onChange:n,templateVariableOptions:i}){const[s,a]=(0,B.useState)([]);(0,B.useEffect)(()=>{r.getProjects().then(h=>a(h))},[r]);const c=(0,B.useMemo)(()=>[{label:"Template Variables",options:i},...s],[s,i]);return(0,m.jsx)(Le.c,{label:"Project",children:(0,m.jsx)(Oe.l6,{width:"auto",allowCustomValue:!0,formatCreateLabel:h=>`Use project: ${h}`,onChange:({value:h})=>n(h),options:c,value:{value:e,label:e},placeholder:"Select Project",inputId:`${t}-project`})})}var st=o(97801),Nt=o(72574);const ps=t=>uniqBy(t,"service"),Un=(t,e)=>t.filter(r=>r.service===e),hs=(t,e,r,n)=>{const i=Un(t,n).map(h=>({value:h.type,name:h.displayName})),s=i.some(h=>h.value===r),a=i.length?i[0].value:"";return{metricTypes:i,selectedMetricType:s?e:a}},jn=(t,e,r)=>(r&&r===Ve.Rate&&(e=U.GAUGE),t?At.filter(n=>n.valueTypes.indexOf(t)!==-1&&n.metricKinds.indexOf(e)!==-1):[]),$n=(t,e)=>e?wn.filter(r=>r.valueTypes.indexOf(t)!==-1&&r.metricKinds.indexOf(e)!==-1):[],fs=async(t,e,r)=>{const i=await t.getLabels(e,"handleLabelKeysQuery",r);return[...Object.keys(i),...SYSTEM_LABELS]},pt=(t=y.DOUBLE,e=U.GAUGE,r=qe.ALIGN_MEAN,n)=>{const i=(0,Nt.w)(),s=jn(t,e,n).map(a=>({...a,label:a.text}));return s.some(a=>a.value===i.replace(r))||(r=s.length>0?s[0].value:qe.ALIGN_MEAN),{alignOptions:s,perSeriesAligner:r}},wt=t=>{const e=t.reduce((r,n)=>{const i=n.split(".").map(g.startCase),s=(i.length===2?i:(0,g.initial)(i)).join(" "),a={value:n,label:n};return r[s]?r[s]=[...r[s],a]:r[s]=[a],r},{});return Object.entries(e).map(([r,n])=>({label:r,options:n,expanded:!0}),[])},Rn=t=>(0,g.chunk)(t,4).map(([e,r,n,i="AND"])=>({key:e,operator:r,value:n,condition:i})),Dt=(t,e)=>{const{perSeriesAligner:r,alignmentPeriod:n}=t;if(!n||!r)return"";const i=At.find(c=>c.value===e.templateSrv.replace(r)),s=parseInt(n,10);return`${Et.secondsToHms(s)} interval (${i?.text??""})`},kn=t=>{const e=t?.filters?.findIndex(n=>n==="metric.type");return t?.filters?.[e+2]||""},Bn=(t,e)=>{if(!t.filters)return t.filters=["metric.type","=",e],t;const r=t?.filters?.findIndex(n=>n==="metric.type");return r===-1?t.filters.push("metric.type","=",e):t.filters[r+2]=e,t},Gn=t=>{const e=Fn(t),r=Vn(e,t);return(0,m.jsx)(Le.c,{label:"Group by function","data-testid":"cloud-monitoring-aggregation",children:(0,m.jsx)(Oe.l6,{width:"auto",onChange:({value:n})=>t.onChange(n),value:r,options:[{label:"Template Variables",options:t.templateVariableOptions},{label:"Aggregations",expanded:!0,options:e}],placeholder:"Select Reducer",inputId:`${t.refId}-group-by-function`,menuPlacement:"top"})})},Fn=({metricDescriptor:t})=>{const e=t?.valueType,r=t?.metricKind;return(0,B.useMemo)(()=>!e||!r?[]:$n(e,r).map(n=>({...n,label:n.text})),[e,r])},Vn=(t,e)=>(0,B.useMemo)(()=>[...t,...e.templateVariableOptions].find(n=>n.value===e.crossSeriesReducer),[t,e.crossSeriesReducer,e.templateVariableOptions]),zn=({refId:t,labels:e=[],query:r,onChange:n,variableOptionGroup:i,metricDescriptor:s})=>{const a=(0,B.useMemo)(()=>[i,...wt([...e,...Mn])],[e,i]);return(0,m.jsxs)(st.B,{children:[(0,m.jsx)(Le.c,{label:"Group by",tooltip:"You can reduce the amount of data returned for a metric by combining different time series. To combine multiple time series, you can specify a grouping and a function. Grouping is done on the basis of labels. The grouping function is used to combine the time series in the group into a single time series.",children:(0,m.jsx)(Oe.KF,{allowCustomValue:!0,inputId:`${t}-group-by`,width:"auto",placeholder:"Choose label",options:a,value:r.groupBys??[],onChange:c=>{n({...r,groupBys:c.map(h=>h.value)})},menuPlacement:"top"})}),(0,m.jsx)(Gn,{metricDescriptor:s,templateVariableOptions:i.options,crossSeriesReducer:r.crossSeriesReducer,groupBys:r.groupBys??[],onChange:c=>n({...r,crossSeriesReducer:c}),refId:t})]})},Kn=({inputId:t,query:e,templateVariableOptions:r,onChange:n,metricDescriptor:i,preprocessor:s})=>{const{perSeriesAligner:a}=e;let{valueType:c,metricKind:h}=i||{};const{perSeriesAligner:f,alignOptions:T}=(0,B.useMemo)(()=>pt(c,h,a,s),[c,h,a,s]);return(0,m.jsx)(Oe.l6,{onChange:({value:p})=>n({...e,perSeriesAligner:p}),value:[...T,...r].find(p=>p.value===f),options:[{label:"Template Variables",options:r},{label:"Alignment options",expanded:!0,options:T}],placeholder:"Select Alignment",inputId:t,menuPlacement:"top"})};function ht({inputId:t,templateVariableOptions:e,onChange:r,current:n,disabled:i,aligmentPeriods:s}){const a=(0,B.useMemo)(()=>s.map(h=>({...h,label:h.text})),[s]),c=(0,B.useMemo)(()=>a.filter(h=>!h.hidden),[a]);return(0,m.jsx)(Oe.l6,{width:"auto",onChange:({value:h})=>r(h),value:[...a,...e].find(h=>h.value===n),options:[{label:"Template Variables",options:e},{label:"Aggregations",expanded:!0,options:c}],placeholder:"Select Period",inputId:t,disabled:i,allowCustomValue:!0,menuPlacement:"top"})}const Hn=({refId:t,templateVariableOptions:e,onChange:r,query:n,customMetaData:i,datasource:s,metricDescriptor:a,preprocessor:c})=>{const h=(0,B.useMemo)(()=>Dt(i,s),[i,s]);return(0,m.jsxs)(st.B,{children:[(0,m.jsx)(Le.c,{label:"Alignment function",tooltip:"The process of alignment consists of collecting all data points received in a fixed length of time, applying a function to combine those data points, and assigning a timestamp to the result.",children:(0,m.jsx)(Kn,{inputId:`${t}-alignment-function`,templateVariableOptions:e,query:n,onChange:f=>r({...n,...f}),metricDescriptor:a,preprocessor:c})}),(0,m.jsx)(Le.c,{label:"Alignment period",tooltip:h,children:(0,m.jsx)(ht,{inputId:`${t}-alignment-period`,templateVariableOptions:e,current:n.alignmentPeriod,onChange:f=>r({...n,alignmentPeriod:f}),aligmentPeriods:St})})]})};var Wn=o(3721),Qn=o(85269);const ft="=",Ot="AND",Yn=t=>t.flatMap(({key:e,operator:r,value:n,condition:i})=>[e,r,n,i]).slice(0,-1),Xn=["=","!=","=~","!=~"].map(ut.z),Mt=["metric.type"],Jn=({labels:t={},filters:e,onChange:r,variableOptionGroup:n})=>{const i=Rn(e),s=i.filter(({key:p})=>!Mt.includes(p)),a=i.filter(({key:p})=>Mt.includes(p)),c=(0,B.useMemo)(()=>[n,...wt(Object.keys(t))],[t,n]),h=({key:p="",value:A=""})=>{c.some(w=>w.options?c.some(X=>X.label===p):w.label===p)||c.push({label:p,value:p});const F=t.hasOwnProperty(p)?[n,...t[p].map(ut.z)]:[n];return F.some(w=>w.label===A)||F.push({label:A,value:A}),{options:c,valueOptions:F}},f=p=>{const A=p.concat(a).map(({key:x,operator:F,value:he,condition:w})=>({key:x||"",operator:F||ft,value:he||"",condition:w||Ot}));r(Yn(A))},T=(p,A,x)=>{const{key:F="",operator:he=ft,value:w="",condition:X=Ot}=p,{options:Z,valueOptions:te}=h(p);return(0,m.jsxs)(Ct.Gy,{spacing:"xs",width:"auto",children:[(0,m.jsx)(Oe.l6,{"aria-label":"Filter label key",formatCreateLabel:ce=>`Use label key: ${ce}`,allowCustomValue:!0,value:F,options:Z,onChange:({value:ce=""})=>A({key:ce,operator:he,value:w,condition:X})}),(0,m.jsx)(Oe.l6,{value:he,options:Xn,onChange:({value:ce=ft})=>A({key:F,operator:ce,value:w,condition:X})}),(0,m.jsx)(Oe.l6,{"aria-label":"Filter label value",placeholder:"add filter value",formatCreateLabel:ce=>`Use label value: ${ce}`,allowCustomValue:!0,value:w,options:te,onChange:({value:ce=""})=>A({key:F,operator:he,value:ce,condition:X})}),(0,m.jsx)(Wn.Z,{"aria-label":"Remove",icon:"times",variant:"secondary",onClick:x,type:"button"})]})};return(0,m.jsx)(Qe.U,{children:(0,m.jsx)(Le.c,{label:"Filter",tooltip:"To reduce the amount of data charted, apply a filter. A filter has three components: a label, a comparison, and a value. The comparison can be an equality, inequality, or regular expression.",children:(0,m.jsx)(Qn.o,{items:s,renderItem:T,onChange:f})})})},ms=()=>jsx(Alert,{severity:"info",title:"Annotation Query Format",children:jsxs("div",{children:[jsxs("p",{children:["An annotation is an event that is overlaid on top of graphs. Annotation rendering is expensive so it is important to limit the number of rows returned."," "]}),jsx("p",{children:"The Title and Text fields support templating and can use data returned from the query. For example, the Title field could have the following text:"}),jsxs("code",{children:["{{metric.type}}"," has value: ","{{metric.value}}"]}),jsxs("p",{children:["Example Result: ",jsx("code",{children:"monitoring.googleapis.com/uptime_check/http_status has this value: 502"})]}),jsx("span",{children:"Patterns:"}),jsxs("p",{children:[jsx("code",{children:"{{metric.value}}"})," = value of the metric/point"]}),jsxs("p",{children:[jsx("code",{children:"{{metric.type}}"})," = metric type e.g. compute.googleapis.com/instance/cpu/usage_time"]}),jsxs("p",{children:[jsx("code",{children:"{{metric.name}}"})," = name part of metric e.g. instance/cpu/usage_time"]}),jsxs("p",{children:[jsx("code",{children:"{{metric.service}}"})," = service part of metric e.g. compute"]}),jsxs("p",{children:[jsx("code",{children:"{{metric.label.label_name}}"})," = Metric label metadata e.g. metric.label.instance_name"]}),jsxs("p",{children:[jsx("code",{children:"{{resource.label.label_name}}"})," = Resource label metadata e.g. resource.label.zone"]})]})}),Zn=({refId:t,current:e,templateVariableOptions:r,onChange:n})=>{const i=On.map(a=>({...a,label:a.text}));e&&!i.find(a=>a.value===e)&&i.push({label:e,text:e,value:e,hidden:!1});const s=i.filter(a=>!a.hidden);return(0,m.jsx)(Le.c,{label:"Lookback period",htmlFor:`${t}-lookback-period`,children:(0,m.jsx)(Oe.l6,{inputId:`${t}-lookback-period`,width:"auto",allowCustomValue:!0,value:[...i,...r].find(a=>a.value===e),options:[{label:"Template Variables",options:r},{label:"Predefined periods",expanded:!0,options:s}],onChange:({value:a})=>n(a)})})},qn=({refId:t,query:e,templateVariableOptions:r,onChange:n,datasource:i})=>{const[s,a]=(0,B.useState)([]),{projectName:c,serviceId:h}=e;return(0,B.useEffect)(()=>{!c||!h||i.getServiceLevelObjectives(c,h).then(f=>{a([{label:"Template Variables",options:r},...f])})},[i,c,h,r]),(0,m.jsx)(Le.c,{label:"SLO",children:(0,m.jsx)(Oe.l6,{inputId:`${t}-slo`,width:"auto",allowCustomValue:!0,value:e?.sloId&&{value:e?.sloId,label:e?.sloName||e?.sloId},placeholder:"Select SLO",options:s,onChange:async({value:f="",label:T=""})=>{const A=(await i.getServiceLevelObjectives(c,h)).find(({value:x})=>x===i.templateSrv.replace(f));n({...e,sloId:f,sloName:T,goal:A?.goal})}})})},_n=({refId:t,query:e,templateVariableOptions:r,onChange:n,datasource:i})=>(0,m.jsx)(Le.c,{label:"Selector",htmlFor:`${t}-slo-selector`,children:(0,m.jsx)(Oe.l6,{inputId:`${t}-slo-selector`,width:"auto",allowCustomValue:!0,value:[...Lt,...r].find(s=>s.value===e?.selectorName),options:[{label:"Template Variables",options:r},...Lt],onChange:({value:s})=>n({...e,selectorName:s??""})})}),er=({refId:t,query:e,templateVariableOptions:r,onChange:n,datasource:i})=>{const[s,a]=(0,B.useState)([]),{projectName:c}=e;return(0,B.useEffect)(()=>{c&&i.getSLOServices(c).then(h=>{a([{label:"Template Variables",options:r},...h])})},[i,c,r]),(0,m.jsx)(Le.c,{label:"Service",children:(0,m.jsx)(Oe.l6,{inputId:`${t}-slo-service`,width:"auto",allowCustomValue:!0,value:e?.serviceId&&{value:e?.serviceId,label:e?.serviceName||e?.serviceId},placeholder:"Select service",options:s,onChange:({value:h="",label:f=""})=>n({...e,serviceId:h,serviceName:f,sloId:""})})})},tr=t=>({projectName:t.getDefaultProject(),alignmentPeriod:"cloud-monitoring-auto",perSeriesAligner:qe.ALIGN_MEAN,aliasBy:"",selectorName:"select_slo_health",serviceId:"",serviceName:"",sloId:"",sloName:"",lookbackPeriod:""});function nr({refId:t,query:e,datasource:r,onChange:n,variableOptionGroup:i,customMetaData:s,aliasBy:a,onChangeAliasBy:c}){const h=(0,B.useMemo)(()=>Dt(s,r),[s,r]);return(0,m.jsx)("span",{"data-testid":Ze.components.queryEditor.sloQueryEditor.container.input,children:(0,m.jsxs)(Qe.U,{children:[(0,m.jsx)(it,{refId:t,templateVariableOptions:i.options,projectName:e.projectName,datasource:r,onChange:f=>n({...e,projectName:f})}),(0,m.jsx)(er,{refId:t,datasource:r,templateVariableOptions:i.options,query:e,onChange:n}),(0,m.jsx)(qn,{refId:t,datasource:r,templateVariableOptions:i.options,query:e,onChange:n}),(0,m.jsx)(_n,{refId:t,datasource:r,templateVariableOptions:i.options,query:e,onChange:n}),e.selectorName===It&&(0,m.jsx)(Zn,{refId:t,onChange:f=>n({...e,lookbackPeriod:f}),current:e.lookbackPeriod,templateVariableOptions:i.options}),(0,m.jsx)(st.B,{children:(0,m.jsx)(Le.c,{label:"Alignment period",tooltip:h,children:(0,m.jsx)(ht,{inputId:`${t}-alignment-period`,templateVariableOptions:i.options,current:e.alignmentPeriod,onChange:f=>n({...e,alignmentPeriod:f}),aligmentPeriods:St})})}),(0,m.jsx)(dt,{refId:t,value:a,onChange:c})]})})}var Pt=o(21744);function rr({query:t,onChange:e,onRunQuery:r}){const n=i=>{i.key==="Enter"&&(i.shiftKey||i.ctrlKey)&&(i.preventDefault(),r())};return(0,m.jsx)("span",{"data-testid":Ze.components.queryEditor.mqlMetricsQueryEditor.container.input,children:(0,m.jsx)(Pt.f,{name:"Query",className:"slate-query-field",value:t,rows:10,placeholder:"Enter a Cloud Monitoring MQL query (Run with Shift+Enter)",onBlur:r,onChange:i=>e(i.currentTarget.value),onKeyDown:n})})}const gs=({label:t,onChange:e,value:r,options:n,allowCustomValue:i=!1})=>jsx(Field,{label:t,children:jsx(Select,{width:25,allowCustomValue:i,value:r,onChange:({value:s})=>e(s),options:n})});var Be=o(32196),ir=o(76459),sr=o.n(ir),or=o(14110),ot=o(40845),ar=o(88824),lr=o(94354);const Ut={label:"None",value:Ve.None},cr=({query:t,metricDescriptor:e,onChange:r})=>{const n=ur(e);return(0,m.jsx)(Le.c,{label:"Pre-processing",tooltip:"Preprocessing options are displayed when the selected metric has a metric kind of delta or cumulative. The specific options available are determined by the metric's value type. If you select 'Rate', data points are aligned and converted to a rate per time series. If you select 'Delta', data points are aligned by their delta (difference) per time series",children:(0,m.jsx)(lr.z,{onChange:i=>{const{perSeriesAligner:s}=t,{valueType:a,metricKind:c}=e??{},{perSeriesAligner:h}=pt(a,c,s,i);r({...t,preprocessor:i,perSeriesAligner:h})},value:t.preprocessor??Ve.None,options:n})})},ur=t=>{const e=t?.metricKind,r=t?.valueType;return(0,B.useMemo)(()=>{if(!e||e===U.GAUGE||r===y.DISTRIBUTION)return[Ut];const n=[Ut,{label:"Rate",value:Ve.Rate,description:"Data points are aligned and converted to a rate per time series"}];return e===U.CUMULATIVE?[...n,{label:"Delta",value:Ve.Delta,description:"Data points are aligned by their delta (difference) per time series"}]:n},[e,r])};function dr({refId:t,onChange:e,datasource:r,query:n,variableOptionGroup:i,customMetaData:s,aliasBy:a,onChangeAliasBy:c,range:h}){const[f,T]=(0,B.useState)({}),[p,A]=(0,B.useState)([]),[x,F]=(0,B.useState)(),[he,w]=(0,B.useState)([]),[X,Z]=(0,B.useState)([]),[te,ce]=(0,B.useState)(""),[Ee,me]=(0,B.useState)({...h});(ye=>{Ee!==null&&(Ee.raw.from.toString()!==ye.raw.from.toString()||Ee.raw.to.toString()!==ye.raw.to.toString())&&me({...ye})})(h);const Ke=(0,ot.$j)(),Me=(0,ar.J)(Ke),Re=(0,ot.of)(pr),{projectName:ke,groupBys:zt,crossSeriesReducer:Kt}=n,ze=kn(n),{templateSrv:at}=r,lt=(0,B.useCallback)((ye,Ce)=>ye.find(xe=>xe.type===at.replace(Ce)),[at]);(0,B.useEffect)(()=>{ke&&ze&&r.getLabels(ze,t,ke,{groupBys:zt,crossSeriesReducer:Kt},Ee).then(ye=>T(ye))},[r,zt,ze,ke,t,Kt,Ee]),(0,B.useEffect)(()=>{(async()=>{if(ke){const Ce=await r.getMetricTypes(ke);(0,or.rR)("cloud-monitoring-metric-descriptors-loaded",{count:Ce.length});const xe=_i(Ce);A(Ce),Z(xe)}})()},[r,ke,Re,Me.optionDescription]),(0,B.useEffect)(()=>{const Ce=(Xe=>{const ct=lt(Xe,ze);return ct?Xe.filter(He=>He.service===ct.service).map(He=>({service:He.service,value:He.type,label:He.displayName,component:function(){return(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:Re,children:He.type}),(0,m.jsx)("div",{className:Me.optionDescription,children:He.description})]})}})):[]})(p),xe=Ce.length>0?Ce[0].service:"",Ue=lt(p,ze);F(Ue),w(Ce),ce(xe)},[p,lt,ze,Re,Me.optionDescription]);const qi=({value:ye})=>{const Ce=p.filter(xe=>xe.service===at.replace(ye)).map(xe=>({service:xe.service,value:xe.type,label:xe.displayName,description:xe.description}));n.filters=[],Ce.length>0&&!Ce.some(xe=>xe.value===at.replace(ze))?(Ht(Ce[0]),ce(ye),w(Ce)):(ce(ye),w(Ce))},_i=ye=>{const Ce=ye.map(xe=>({value:xe.service,label:(0,g.startCase)(xe.serviceShortName)}));return Ce.length>0?(0,g.uniqBy)(Ce,xe=>xe.value):[]},es=async ye=>{const xe=(await r.filterMetricsByType(ke,te)).filter(Ue=>Ue.type.includes(ye.toLowerCase())).map(Ue=>({value:Ue.type,label:Ue.displayName,component:function(){return(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:Re,children:Ue.type}),(0,m.jsx)("div",{className:Me.optionDescription,children:Ue.description})]})}}));return[{label:"Template Variables",options:i.options},...xe]},ts=sr()(es,400),Ht=({value:ye})=>{const Ce=lt(p,ye);F(Ce);const{metricKind:xe,valueType:Ue}=Ce,Xe=xe===U.GAUGE||Ue===y.DISTRIBUTION?Ve.None:Ve.Rate,{perSeriesAligner:ct}=pt(Ue,xe,n.perSeriesAligner,Xe);Object.assign(n,{...mt(r),projectName:n.projectName,filters:n.filters}),e({...Bn({...n,perSeriesAligner:ct},ye),preprocessor:Xe})};return(0,m.jsxs)("span",{"data-testid":Ze.components.queryEditor.visualMetricsQueryEditor.container.input,children:[(0,m.jsx)(Qe.U,{children:(0,m.jsxs)(st.B,{children:[(0,m.jsx)(it,{refId:t,templateVariableOptions:i.options,projectName:ke,datasource:r,onChange:ye=>{e({...n,projectName:ye})}}),(0,m.jsx)(Le.c,{label:"Service",width:"auto",children:(0,m.jsx)(Oe.l6,{width:"auto",onChange:qi,isLoading:X.length===0,value:[...X,...i.options].find(ye=>ye.value===te),options:[{label:"Template Variables",options:i.options},...X],placeholder:"Select Services",inputId:`${t}-service`})}),(0,m.jsx)(Le.c,{label:"Metric name",width:"auto",htmlFor:`${t}-select-metric`,children:(0,m.jsx)("span",{title:te===""?"Select a service first":"Type to search metrics",children:(0,m.jsx)(Oe.DW,{width:"auto",onChange:Ht,value:[...he,...i.options].find(ye=>ye.value===ze),loadOptions:ts,defaultOptions:[{label:"Template Variables",options:i.options},...he.slice(0,100)],placeholder:"Select Metric",inputId:`${t}-select-metric`,disabled:te===""})})})]})}),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Jn,{labels:f,filters:n.filters,onChange:ye=>e({...n,filters:ye}),variableOptionGroup:i}),(0,m.jsxs)(Qe.U,{children:[(0,m.jsx)(cr,{metricDescriptor:x,query:n,onChange:e}),(0,m.jsx)(zn,{refId:t,labels:Object.keys(f),query:n,onChange:e,variableOptionGroup:i,metricDescriptor:x}),(0,m.jsx)(Hn,{refId:t,datasource:r,templateVariableOptions:i.options,query:n,customMetaData:s,onChange:e,metricDescriptor:x,preprocessor:n.preprocessor}),(0,m.jsx)(dt,{refId:t,value:a,onChange:c})]})]})]})}const pr=t=>(0,Be.css)`
  label: grafana-select-option-description;
  font-weight: normal;
  font-style: italic;
  color: ${t.colors.text.secondary};
`,hr=B.memo(dr),fr=({refId:t,onChange:e,graphPeriod:r,variableOptionGroup:n})=>(0,m.jsx)(Qe.U,{children:(0,m.jsx)(Le.c,{label:"Graph period",htmlFor:`${t}-graph-period`,tooltip:(0,m.jsxs)(m.Fragment,{children:["Set ",(0,m.jsx)("code",{children:"graph_period"})," which forces a preferred period between points. Automatically set to the current interval if left blank."]}),children:(0,m.jsxs)(Ct.Gy,{children:[(0,m.jsx)(Nn.d,{"data-testid":`${t}-switch-graph-period`,value:r!=="disabled",onChange:i=>e(i.currentTarget.checked?"":"disabled")}),(0,m.jsx)(ht,{inputId:`${t}-graph-period`,templateVariableOptions:n.options,current:r,onChange:e,disabled:r==="disabled",aligmentPeriods:Dn})]})})}),mt=t=>({projectName:t.getDefaultProject(),crossSeriesReducer:"REDUCE_NONE",alignmentPeriod:"cloud-monitoring-auto",perSeriesAligner:qe.ALIGN_MEAN,groupBys:[],filters:[]}),jt=t=>({projectName:t.getDefaultProject(),query:""});function mr({refId:t,query:e,datasource:r,onChange:n,onRunQuery:i,customMetaData:s,variableOptionGroup:a,range:c}){const h=(0,B.useCallback)(T=>{let p=!0;if(T?.filters&&T.filters.length>0){for(const A of T.filters)if(A===""){p=!1;break}}n({...e,timeSeriesList:T}),p&&i()},[n,i,e]),f=(0,B.useCallback)(T=>{n({...e,timeSeriesQuery:T}),i()},[n,i,e]);return(0,B.useEffect)(()=>{e.queryType===Ae.TIME_SERIES_LIST&&!e.timeSeriesList&&n({refId:e.refId,datasource:e.datasource,queryType:Ae.TIME_SERIES_LIST,timeSeriesList:mt(r),aliasBy:e.aliasBy}),e.queryType===Ae.TIME_SERIES_QUERY&&!e.timeSeriesQuery&&n({refId:e.refId,datasource:e.datasource,queryType:Ae.TIME_SERIES_QUERY,timeSeriesQuery:jt(r),aliasBy:e.aliasBy})},[n,e,r]),(0,m.jsxs)(xt.D,{children:[(e.queryType===Ae.ANNOTATION||e.queryType===Ae.TIME_SERIES_LIST)&&e.timeSeriesList&&(0,m.jsx)(hr,{refId:t,variableOptionGroup:a,customMetaData:s,onChange:h,datasource:r,query:e.timeSeriesList,aliasBy:e.aliasBy,onChangeAliasBy:T=>n({...e,aliasBy:T}),range:c}),e.queryType===Ae.TIME_SERIES_QUERY&&e.timeSeriesQuery&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(Ln.B,{gap:1,direction:"row",children:[(0,m.jsx)(it,{refId:t,datasource:r,onChange:T=>f({...e.timeSeriesQuery,projectName:T}),templateVariableOptions:a.options,projectName:e.timeSeriesQuery.projectName}),(0,m.jsx)(dt,{refId:t,value:e.aliasBy,onChange:T=>n({...e,aliasBy:T})})]}),(0,m.jsx)(rr,{onChange:T=>f({...e.timeSeriesQuery,query:T}),onRunQuery:i,query:e.timeSeriesQuery.query}),(0,m.jsx)(fr,{onChange:T=>f({...e.timeSeriesQuery,graphPeriod:T}),graphPeriod:e.timeSeriesQuery.graphPeriod,refId:t,variableOptionGroup:a})]})]})}const gr=B.memo(mr),vs=t=>({projectName:t.getDefaultProject(),expr:"",step:"10s"});function vr({refId:t,query:e,datasource:r,onChange:n,variableOptionGroup:i,onRunQuery:s}){function a(c){c.key==="Enter"&&c.shiftKey&&(s(),c.preventDefault(),c.stopPropagation())}return(0,m.jsx)("span",{"data-testid":Ze.components.queryEditor.promQlQueryEditor.container.input,children:(0,m.jsxs)(Qe.U,{children:[(0,m.jsx)(it,{refId:t,templateVariableOptions:i.options,projectName:e.projectName,datasource:r,onChange:c=>n({...e,projectName:c})}),(0,m.jsx)(Pt.f,{name:"Query",className:"slate-query-field",value:e.expr,rows:10,placeholder:"Enter a Cloud Monitoring Prometheus query (Run with Shift+Enter)",onBlur:s,onKeyDown:a,onChange:c=>n({...e,expr:c.currentTarget.value})}),(0,m.jsx)(Le.c,{label:"Min step",tooltip:"Time units and built-in variables can be used here, for example: $__interval, $__rate_interval, 5s, 1m, 3h, 1d, 1y (Default if no unit is specified: 10s)",children:(0,m.jsx)(Tt.p,{type:"string",placeholder:"auto",onChange:c=>n({...e,step:c.currentTarget.value}),onKeyDown:a,value:e.step??""})})]})})}var yr=o(6191),Er=o(22354),br=o(31347);const xr=t=>{const{query:e,onChange:r,onRunQuery:n}=t,{queryType:i}=e;return(0,m.jsxs)(yr.X,{children:[(0,m.jsx)(Er.W,{label:"Query type",options:Pn,value:i,onChange:({value:s})=>{r({...e,queryType:s}),n()}}),(0,m.jsx)(br.Z,{grow:1})]})},Tr=t=>{const{datasource:e,query:r,onRunQuery:n,onChange:i,range:s}=t,[a,c]=(0,B.useState)(!1);(0,B.useEffect)(()=>{const me=e.migrateQuery(r);Cn()(me,r)||i({...me})},[r,e,i]);const[h,f]=(0,B.useState)(r),[T,p]=(0,B.useState)(!1),A={...tr(e),...r.sloQuery},x=me=>{i({...r,sloQuery:me}),n()},F={projectName:e.getDefaultProject(),expr:"",step:"10s",...r.promQLQuery},he=me=>{i({...r,promQLQuery:me})},w=me=>{(me.queryType===Ae.TIME_SERIES_LIST&&!(0,g.isEqual)(me.timeSeriesList,mt(e))||me.queryType===Ae.TIME_SERIES_QUERY&&!(0,g.isEqual)(me.timeSeriesQuery,jt(e)))&&p(!0),i(me)},Z=(t.data?.series.length?t.data?.series[0].meta:{})?.custom??{},te={label:"Template Variables",expanded:!1,options:e.getVariables().map(ut.z)};(0,B.useEffect)(()=>{(!r.queryType||!Object.values(Ae).includes(r.queryType))&&i({...r,queryType:Ae.TIME_SERIES_LIST})});const ce=r.queryType,Ee=me=>{T&&(h.queryType===Ae.TIME_SERIES_LIST||h.queryType===Ae.TIME_SERIES_QUERY)?h.queryType!==me.queryType&&c(!0):i(me),f(me)};return(0,m.jsx)("span",{"data-testid":Ze.components.queryEditor.container,children:(0,m.jsxs)(xt.D,{children:[(0,m.jsx)(Sn.u,{"data-testid":"switch-query-type-modal",title:"Warning",body:"By switching your query type, your current query will be lost.",isOpen:a,onConfirm:()=>{c(!1),i(h),p(!1)},confirmText:"Confirm",onDismiss:()=>{c(!1),f(r)}}),(0,m.jsx)(xr,{query:r,onChange:Ee,onRunQuery:n}),ce===Ae.PROMQL&&(0,m.jsx)(vr,{refId:r.refId,variableOptionGroup:te,onChange:he,onRunQuery:n,datasource:e,query:F}),ce!==Ae.SLO&&(0,m.jsx)(gr,{refId:r.refId,variableOptionGroup:te,customMetaData:Z,onChange:w,onRunQuery:n,datasource:e,query:r,range:s||(0,An.E2)()}),ce===Ae.SLO&&(0,m.jsx)(nr,{refId:r.refId,variableOptionGroup:te,customMetaData:Z,onChange:x,onRunQuery:n,datasource:e,query:A,aliasBy:r.aliasBy,onChangeAliasBy:me=>i({...r,aliasBy:me})})]})})};var Cr=o(7521),Ar=o(38645);const Sr=t=>{const{value:e,placeholder:r,className:n,isSearchable:i,onChange:s}=t,a=Ir(t),c=Lr(a,e),h=(0,B.useCallback)(f=>s(f.value),[s]);return(0,m.jsx)(Oe.l6,{className:n,isMulti:!1,isClearable:!1,backspaceRemovesValue:!1,onChange:h,options:a,isSearchable:i,maxMenuHeight:500,placeholder:r,noOptionsMessage:"No options found",value:c})},Ir=({variables:t=[],options:e})=>(0,B.useMemo)(()=>!Array.isArray(t)||t.length===0?e:[{label:"Template Variables",options:t.map(({name:r})=>({label:`$${r}`,value:`$${r}`}))},...e],[t,e]),Lr=(t,e)=>(0,B.useMemo)(()=>(t.every(n=>n.options)?(0,g.flatten)(t.map(n=>n.options)):t).find(n=>n.value===e),[t,e]);var Nr=o(99818),wr=o(93522),Dr=o(63021),Or=o(40675),$t=o(8887),Mr=o(13773),Pr=o(76323),Rt=o(13544);const Ur=t=>{const[e,r]=(0,B.useState)(null),n=t.type==="submenu",i=(0,ot.of)($r),s=t.iconClassName?(0,$t.Uo)(t.iconClassName):void 0;switch(t.type){case"divider":return(0,m.jsx)("li",{className:"divider"});case"group":return(0,m.jsx)("li",{children:(0,m.jsx)("span",{className:i.groupLabel,children:t.text})});default:return(0,m.jsxs)("li",{className:n?`dropdown-submenu ${jr(e)}`:void 0,ref:r,"data-testid":Rt.Tp.components.Panels.Panel.menuItems(t.text),children:[(0,m.jsxs)("a",{onClick:t.onClick,href:t.href,role:"menuitem",children:[s&&(0,m.jsx)(Je.I,{name:s,className:i.menuIconClassName}),(0,m.jsxs)("span",{className:"dropdown-item-text","data-testid":Rt.Tp.components.Panels.Panel.headerItems(t.text),children:[t.text,n&&(0,m.jsx)(Je.I,{name:"angle-right",className:i.shortcutIconClassName})]}),t.shortcut&&(0,m.jsxs)("span",{className:"dropdown-menu-item-shortcut",children:[(0,m.jsx)(Je.I,{name:"keyboard",className:i.menuIconClassName})," ",t.shortcut]})]}),t.children]})}};function jr(t){if(!t)return"invisible";const e=t.parentElement.getBoundingClientRect(),r=t.getBoundingClientRect();return r.width===0?"invisible":e.right+r.width+10>window.innerWidth?"pull-left":"pull-right"}function $r(t){return{menuIconClassName:(0,Be.css)({marginRight:t.spacing(1),"a::after":{display:"none"}}),shortcutIconClassName:(0,Be.css)({position:"absolute",top:"7px",right:t.spacing(.5),color:t.colors.text.secondary}),groupLabel:(0,Be.css)({color:t.colors.text.secondary,fontSize:t.typography.size.sm,padding:t.spacing(.5,1)})}}const Rr=({children:t,customCss:e})=>{if(!t||t.length===0)return null;const r=t.find(n=>n.active===!0);return(0,m.jsx)("div",{className:`gf-form-select-wrapper width-20 ${e}`,children:(0,m.jsxs)("div",{className:"dropdown",children:[(0,m.jsx)("button",{type:"button",className:"gf-form-input dropdown-toggle","data-toggle":"dropdown",style:{textAlign:"left"},children:r?.text}),(0,m.jsx)("ul",{role:"menu",className:"dropdown-menu dropdown-menu--menu",children:t.map(n=>n.hideFromTabs?null:(0,m.jsx)(Ur,{iconClassName:n.icon,text:n.text,href:n.url},n.url))})]})})},kr=({children:t})=>!t||t.length===0?null:(0,m.jsxs)("nav",{children:[(0,m.jsx)(Rr,{customCss:"page-header__select-nav",children:t}),(0,m.jsx)(Dr.U,{className:"page-header__tabs",hideBorder:!0,children:t.map((e,r)=>!e.hideFromTabs&&(0,m.jsx)(Or.o,{label:e.text,active:e.active,icon:e.icon,href:e.url,suffix:e.tabSuffix},`${e.url}-${r}`))})]}),Br=({navItem:t,renderTitle:e,actions:r,info:n,subTitle:i})=>{const s=(0,ot.of)(Fr);if(!t)return null;const a=c=>{const h=c.icon==="grafana"?12:14,f=c.icon&&(0,$t.Uo)(c.icon),T=i??c.subTitle;return(0,m.jsxs)("div",{className:"page-header__inner",children:[(0,m.jsxs)("span",{className:"page-header__logo",children:[f&&(0,m.jsx)(Je.I,{name:f,size:"xxxl",style:{marginTop:h}}),c.img&&(0,m.jsx)("img",{className:"page-header__img",src:c.img,alt:""})]}),(0,m.jsxs)("div",{className:(0,Be.cx)("page-header__info-block",s.headerText),children:[e?e(c.text):Gr(c.text,c.highlightText),n&&(0,m.jsx)(Mr.Q,{info:n}),T&&(0,m.jsx)("div",{className:"page-header__sub-title",children:T}),r&&(0,m.jsx)("div",{className:s.actions,children:r})]})]})};return(0,m.jsx)("div",{className:s.headerCanvas,children:(0,m.jsx)("div",{className:"page-container",children:(0,m.jsxs)("div",{className:"page-header",children:[a(t),t.children&&t.children.length>0&&(0,m.jsx)(kr,{children:t.children})]})})})};function Gr(t,e){return t?(0,m.jsxs)("h1",{className:"page-header__title",children:[t,e&&(0,m.jsx)(Pr.J,{text:e,className:(0,Be.css)`
            vertical-align: middle;
          `})]}):null}const Fr=t=>({actions:(0,Be.css)({display:"flex",flexDirection:"row",gap:t.spacing(1)}),headerText:(0,Be.css)({display:"flex",flexDirection:"column",gap:t.spacing(1)}),headerCanvas:(0,Be.css)`
    background: ${t.colors.background.canvas};
  `}),{SecretFormField:Vr}=cn.rRI;function zr(){Ie("footer",Ar.wi,[]),Ie("icon",Je.I,["name","size","type",["onClick",{watchDepth:"reference",wrapApply:!0}]]),Ie("spinner",un.y,["inline"]),Ie("helpModal",wr.N,[]),Ie("pageHeader",Br,["model","noTabs"]),Ie("emptyListCta",Cr.A,["title","buttonIcon","buttonLink","buttonTitle",["onClick",{watchDepth:"reference",wrapApply:!0}],"proTip","proTipLink","proTipLinkTitle","proTipTarget","infoBox","infoBoxTitle"]),Ie("tagFilter",Nr.$,["tags",["onChange",{watchDepth:"reference"}],["tagOptions",{watchDepth:"reference"}]]),Ie("colorPicker",dn.sk,["color",["onChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("seriesColorPickerPopover",pn.t,["color","series","onColorChange","onToggleAxis"]),Ie("unitPicker",hn.p,["value","width",["onChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("metricSelect",Sr,["options","onChange","value","isSearchable","className","placeholder",["variables",{watchDepth:"reference"}]]),Ie("cloudMonitoringQueryEditor",Tr,["target","onQueryChange","onExecuteQuery",["events",{watchDepth:"reference"}],["datasource",{watchDepth:"reference"}],["templateSrv",{watchDepth:"reference"}]]),Ie("secretFormField",Vr,["value","isConfigured","inputWidth","labelWidth","aria-label",["onReset",{watchDepth:"reference",wrapApply:!0}],["onChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("graphContextMenu",fn.H,["x","y","itemsGroup",["onClose",{watchDepth:"reference",wrapApply:!0}],["getContextMenuSource",{watchDepth:"reference",wrapApply:!0}],["timeZone",{watchDepth:"reference",wrapApply:!0}]]),Ie("drilldownLinksEditor",mn.e,["value","links","suggestions",["onChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("datasourceHttpSettingsNext",gn.t,["defaultUrl","showAccessOptions","dataSourceConfig","showForwardOAuthIdentityOption",["onChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("folderPicker",bn.sR,["labelClass","rootName","enableCreateNew","enableReset","initialTitle","initialFolderId","dashboardId","onCreateFolder",["enterFolderCreation",{watchDepth:"reference",wrapApply:!0}],["exitFolderCreation",{watchDepth:"reference",wrapApply:!0}],["onLoad",{watchDepth:"reference",wrapApply:!0}],["onChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("timePickerSettings",xn.p,["renderCount","refreshIntervals","timePickerHidden","nowDelay","timezone",["onTimeZoneChange",{watchDepth:"reference",wrapApply:!0}],["onRefreshIntervalChange",{watchDepth:"reference",wrapApply:!0}],["onNowDelayChange",{watchDepth:"reference",wrapApply:!0}],["onHideTimePickerChange",{watchDepth:"reference",wrapApply:!0}]]),Ie("clipboardButton",vn.b,[["getText",{watchDepth:"reference",wrapApply:!0}]])}const gt=t=>e=>e.finally(t.$evalAsync),Kr=`
<div class="dropdown cascade-open">
<a ng-click="showActionsMenu()" class="query-part-name pointer dropdown-toggle" data-toggle="dropdown">{{part.def.type}}</a>
<span>(</span><span class="query-part-parameters"></span><span>)</span>
<ul class="dropdown-menu">
  <li ng-repeat="action in partActions">
    <a ng-click="triggerPartAction(action)">{{action.text}}</a>
  </li>
</ul>
`;l.Ay.directive("queryPartEditor",["templateSrv",Hr]);function Hr(t){const e='<input type="text" class="hide input-mini tight-form-func-param"></input>';return{restrict:"E",template:Kr,scope:{part:"=",handleEvent:"&",debounce:"@"},link:function(n,i){const s=n.part,a=s.def,c=i.find(".query-part-parameters"),h=n.debounce;n.partActions=[];function f(w){const X=O()(this),Z=X.next();Z.val(s.params[w]),Z.css("width",X.width()+16+"px"),X.hide(),Z.show(),Z.focus(),Z.select();const te=Z.data("typeahead");te&&(Z.val(""),te.lookup())}function T(w){const X=O()(this),Z=X.prev(),te=X.val();(te!==""||s.def.params[w].optional)&&(Z.html(t.highlightVariablesAsHtml(te)),s.updateParam(X.val(),w),n.$apply(()=>{n.handleEvent({$event:{name:"part-param-changed"}})})),X.hide(),Z.show()}function p(w,X){X.which===13&&T.call(this,w)}function A(){this.style.width=(3+this.value.length)*8+"px"}function x(w,X,Z){if(!X.options&&!X.dynamicLookup)return;const te=(Ee,me)=>{if(X.options){let Ne=X.options;return X.type==="int"&&(Ne=(0,g.map)(Ne,Ke=>Ke.toString())),Ne}n.$apply(()=>{n.handleEvent({$event:{name:"get-param-options"}}).then(Ne=>{const Ke=(0,g.map)(Ne,Me=>(0,g.escape)(Me.value));me(Ke)})})};w.attr("data-provide","typeahead"),w.typeahead({source:te,minLength:0,items:1e3,updater:Ee=>(Ee=(0,g.unescape)(Ee),setTimeout(()=>{T.call(w[0],Z)},0),Ee)});const ce=w.data("typeahead");ce.lookup=function(){this.query=this.$element.val()||"";const Ee=this.source(this.query,O().proxy(this.process,this));return Ee&&this.process(Ee)},h&&(ce.lookup=(0,g.debounce)(ce.lookup,500,{leading:!0}))}n.showActionsMenu=()=>{gt(n)(n.handleEvent({$event:{name:"get-part-actions"}}).then(w=>{n.partActions=w}))},n.triggerPartAction=w=>{n.handleEvent({$event:{name:"action",action:w}})};function F(){(0,g.each)(a.params,(w,X)=>{if(w.optional&&s.params.length<=X)return;X>0&&O()("<span>, </span>").appendTo(c);const Z=t.highlightVariablesAsHtml(s.params[X]),te=O()('<a class="graphite-func-param-link pointer">'+Z+"</a>"),ce=O()(e);te.appendTo(c),ce.appendTo(c),ce.blur((0,g.partial)(T,X)),ce.keyup(A),ce.keypress((0,g.partial)(p,X)),te.click((0,g.partial)(f,X)),x(ce,w,X)})}function he(){c.empty(),F()}he()}}}function Wr(t){let e=this.query;return e===""?!0:(e[0]==="/"&&(e=e.substring(1)),e[e.length-1]==="/"&&(e=e.substring(0,e.length-1)),t.toLowerCase().match(e.toLowerCase()))}class Qr{constructor(e,r,n,i){this.$scope=e,this.$sce=n,this.templateSrv=i,this.inputElement=r.find("input").first(),this.linkElement=r.find("a").first(),this.linkMode=!0,this.cancelBlur=null,this.labelMode=!1,this.lookupText=!1,this.debounce=!1,e.$watch("ctrl.model",this.modelChanged.bind(this))}static{this.$inject=["$scope","$element","$sce","templateSrv"]}$onInit(){this.labelMode?this.cssClasses="gf-form-label "+this.cssClass:this.cssClasses="gf-form-input gf-form-input--dropdown "+this.cssClass,this.placeholder&&this.inputElement.attr("placeholder",this.placeholder),this.inputElement.attr("data-provide","typeahead"),this.inputElement.typeahead({source:this.typeaheadSource.bind(this),minLength:0,items:1e4,updater:this.typeaheadUpdater.bind(this),matcher:Wr});const e=this.inputElement.data("typeahead");e.lookup=function(){this.query=this.$element.val()||"",this.source(this.query,this.process.bind(this))},this.debounce&&(e.lookup=(0,g.debounce)(e.lookup,500,{leading:!0})),this.linkElement.keydown(r=>{(r.keyCode===40||r.keyCode===13)&&this.linkElement.click()}),this.inputElement.keydown(r=>{r.keyCode===13&&setTimeout(()=>{this.inputElement.blur()},300)}),this.inputElement.blur(this.inputBlur.bind(this)),this.startOpen&&setTimeout(this.open.bind(this),0)}getOptionsInternal(e){return gt(this.$scope)(Promise.resolve(this.getOptions({$query:e})))}isPromiseLike(e){return e&&typeof e.then=="function"}modelChanged(){(0,g.isObject)(this.model)?this.updateDisplay(this.model.text):this.lookupText?this.getOptionsInternal("").then(e=>{const r=(0,g.find)(e,{value:this.model});this.updateDisplay(r?r.text:this.model)}):this.updateDisplay(this.model)}typeaheadSource(e,r){this.getOptionsInternal(e).then(n=>{this.optionCache=n;const i=(0,g.map)(n,s=>(0,g.escape)(s.text));this.allowCustom&&this.text!==""&&(0,g.indexOf)(i,this.text)===-1&&i.unshift(this.text),r(i)})}typeaheadUpdater(e){return e===this.text?(clearTimeout(this.cancelBlur),this.inputElement.focus(),e):(this.inputElement.val(e),this.switchToLink(!0),e)}switchToLink(e){this.linkMode&&!e||(clearTimeout(this.cancelBlur),this.cancelBlur=null,this.linkMode=!0,this.inputElement.hide(),this.linkElement.show(),this.updateValue(this.inputElement.val()))}inputBlur(){this.cancelBlur=setTimeout(this.switchToLink.bind(this),200)}updateValue(e){e=(0,g.unescape)(e),!(e===""||this.text===e)&&this.$scope.$apply(()=>{const r=(0,g.find)(this.optionCache,{text:e});r?((0,g.isObject)(this.model)?this.model=r:this.model=r.value,this.text=r.text):this.allowCustom&&((0,g.isObject)(this.model)?this.model.text=this.model.value=e:this.model=e,this.text=e),this.$scope.$$postDigest(()=>{this.$scope.$apply(()=>{this.onChange({$option:r})})})})}updateDisplay(e){this.text=e,this.display=this.$sce.trustAsHtml(this.templateSrv.highlightVariablesAsHtml(e))}open(){this.inputElement.css("width",Math.max(this.linkElement.width(),80)+16+"px"),this.inputElement.show(),this.inputElement.focus(),this.linkElement.hide(),this.linkMode=!1;const e=this.inputElement.data("typeahead");e&&(this.inputElement.val(""),e.lookup())}}const Yr=`
<input type="text"
  data-provide="typeahead"
  class="gf-form-input"
  spellcheck="false"
  style="display:none">
</input>
<a ng-class="ctrl.cssClasses"
   tabindex="1"
   ng-click="ctrl.open()"
   give-focus="ctrl.focus"
   ng-bind-html="ctrl.display || '&nbsp;'">
</a>
`;function Xr(){return{restrict:"E",template:Yr,controller:Qr,bindToController:!0,controllerAs:"ctrl",scope:{model:"=",getOptions:"&",onChange:"&",cssClass:"@",allowCustom:"@",labelMode:"@",lookupText:"@",placeholder:"@",startOpen:"@",debounce:"@"}}}l.Ay.directive("gfFormDropdown",Xr);const Jr=`
<div class="baron__track">
  <div class="baron__bar"></div>
</div>
`,Zr="baron baron__root",qr="baron__scroller";function _r(){return{restrict:"A",link:(t,e,r)=>{let n=e.parent();const i=e;r.grafanaScrollbar&&r.grafanaScrollbar==="scrollonroot"&&(n=i),n.addClass(Zr),O()(Jr).appendTo(n),e.addClass(qr);const s={root:n[0],scroller:i[0],bar:".baron__bar",barOnCls:"_scrollbar",scrollingCls:"_scrolling",track:".baron__track",direction:"v"},a=P()(s);t.$on("$destroy",()=>{a.dispose()})}}}l.Ay.directive("grafanaScrollbar",_r);var ei=o(44533);l.Ay.directive("jsonTree",[function(){return{restrict:"E",scope:{object:"=",startExpanded:"@",rootName:"@"},link:(e,r)=>{let n=e.startExpanded;e.startExpanded==="true"?n=2:e.startExpanded==="false"&&(n=1);const i={[e.rootName]:e.object},a=new ei.O(i,n,{animateOpen:!0}).render(!0);r.append(a)}}}]);const ti=`
<label for="check-{{ctrl.id}}" class="gf-form-switch-container">
  <div class="gf-form-label {{ctrl.labelClass}}" ng-show="ctrl.label">
    {{ctrl.label}}
    <info-popover mode="right-normal" ng-if="ctrl.tooltip" position="top center">
      {{ctrl.tooltip}}
    </info-popover>
  </div>
  <div class="gf-form-switch {{ctrl.switchClass}}" ng-if="ctrl.show">
    <input id="check-{{ctrl.id}}" type="checkbox" ng-model="ctrl.checked" ng-change="ctrl.internalOnChange()">
    <span class="gf-form-switch__slider"></span>
  </div>
</label>
`,ni=`
<label for="check-{{ctrl.id}}" class="gf-form-switch-container">
   <div class="gf-form-label {{ctrl.labelClass}}" ng-show="ctrl.label">
    {{ctrl.label}}
    <info-popover mode="right-normal" ng-if="ctrl.tooltip" position="top center">
      {{ctrl.tooltip}}
    </info-popover>
  </div>
  <div class="gf-form-checkbox {{ctrl.switchClass}}" ng-if="ctrl.show">
    <input id="check-{{ctrl.id}}" type="checkbox" ng-model="ctrl.checked" ng-change="ctrl.internalOnChange()">
    <span class="gf-form-switch__checkbox"></span>
  </div>
</label>
`;class kt{constructor(e,r){this.$timeout=r,this.show=!0,this.id=e.$id}static{this.$inject=["$scope","$timeout"]}internalOnChange(){return this.$timeout(()=>this.onChange())}}function ri(){return{restrict:"E",controller:kt,controllerAs:"ctrl",bindToController:!0,scope:{checked:"=",label:"@",labelClass:"@",tooltip:"@",switchClass:"@",onChange:"&"},template:ti}}function ii(){return{restrict:"E",controller:kt,controllerAs:"ctrl",bindToController:!0,scope:{checked:"=",label:"@",labelClass:"@",tooltip:"@",switchClass:"@",onChange:"&"},template:ni}}l.Ay.directive("gfFormSwitch",ri),l.Ay.directive("gfFormCheckbox",ii);function si(){return{restrict:"E",template:`<icon name="'info-circle'" style="margin-left: 10px;" size="'xs'"></icon>`,transclude:!0,link:(t,e,r,n,i)=>{const s=r.offset||"0 -10px",a=r.position||"right middle";let c="drop-help drop-hide-out-of-bounds";const h="hover";e.addClass("gf-form-help-icon"),r.wide&&(c+=" drop-wide"),r.mode&&e.addClass("gf-form-help-icon--"+r.mode),i((f,T)=>{const p=document.createElement("div");p.className="markdown-html",(0,g.each)(f,x=>{p.appendChild(x)});const A={target:e[0],content:p,position:a,classes:c,openOn:h,hoverOpenDelay:400,tetherOptions:{offset:s,constraints:[{to:"window",attachment:"together",pin:!0}]}};t.$applyAsync(()=>{const x=new(ae())(A),F=t.$on("$destroy",()=>{x.destroy(),F()})})})}}}l.Ay.directive("infoPopover",si),l.Ay.directive("spectrumPicker",oi);function oi(){return{restrict:"E",require:"ngModel",scope:!0,replace:!0,template:'<color-picker color="ngModel.$viewValue" on-change="onColorChange"></color-picker>',link:(t,e,r,n)=>{t.ngModel=n,t.onColorChange=i=>{n.$setViewValue(i)}}}}var Ye=o(2913);const ai="ace/theme/grafana-dark",li="ace/theme/textmate",ci="text",ui=10,di=2,pi=!0,hi=!0,fi="<div></div>";async function mi(t,e,r){const n=r.mode||ci,i=r.maxLines||ui,s=r.showGutter!==void 0,a=r.tabSize||di,c=r.behavioursEnabled?r.behavioursEnabled==="true":pi,h=r.snippetsEnabled?r.snippetsEnabled==="true":hi,f=e.get(0),{default:T}=await o.e(3832).then(o.t.bind(o,47496,23));await o.e(6464).then(o.t.bind(o,6464,23)),await o.e(2694).then(o.t.bind(o,52694,23)),await o.e(7391).then(o.t.bind(o,57391,23)),await o.e(2228).then(o.t.bind(o,32228,23)),await o.e(2514).then(o.t.bind(o,32514,23)),await o.e(7515).then(o.t.bind(o,17515,23)),await o.e(4289).then(o.t.bind(o,54289,23)),await o.e(1708).then(o.t.bind(o,11708,23)),await o.e(7613).then(o.t.bind(o,7613,23)),await o.e(8730).then(o.t.bind(o,98730,23)),await o.e(9118).then(o.t.bind(o,59118,23)),await o.e(5277).then(o.t.bind(o,45277,23)),await o.e(9384).then(o.t.bind(o,47003,23));const p=T.edit(f),A=p.getSession(),x={maxLines:i,showGutter:s,tabSize:a,behavioursEnabled:c,highlightActiveLine:!1,showPrintMargin:!1,autoScrollEditorIntoView:!0};p.setOptions(x),p.$blockScrolling=1/0,p.renderer.setScrollMargin(10,10),p.renderer.setPadding(10),w(),he(n),X(t.content),e.addClass("gf-code-editor");const F=e.find("textarea");F.addClass("gf-form-input"),F.attr("aria-label",r.textareaLabel),t.codeEditorFocus&&setTimeout(()=>{F.focus();const Z=F[0];if(Z.setSelectionRange){const te=F.val().length*2;Z.setSelectionRange(te,te)}},100),A.on("change",Z=>{t.$apply(()=>{const te=p.getValue();t.content=te})}),t.$watch("content",(Z,te)=>{const ce=p.getValue();Z!==ce&&Z!==te&&t.$$postDigest(()=>{X(Z)})}),p.on("blur",()=>{t.onChange()}),t.$on("$destroy",()=>{p.destroy()}),p.commands.addCommand({name:"executeQuery",bindKey:{win:"Ctrl-Enter",mac:"Command-Enter"},exec:()=>{t.onChange()}});function he(Z){if(T.acequire("ace/ext/language_tools"),p.setOptions({enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:h}),t.getCompleter()){const ce=p;ce.completers=ce.completers.slice(),ce.completers.push(t.getCompleter())}const te=`ace/mode/${Z}`;A.setMode(te)}function w(){let Z=ai;Ye.Ay.bootData.user.lightTheme&&(Z=li),p.setTheme(Z)}function X(Z){p.setValue(Z),p.clearSelection()}}function gi(){return{restrict:"E",template:fi,scope:{content:"=",datasource:"=",codeEditorFocus:"<",onChange:"&",getCompleter:"&"},link:mi}}l.Ay.directive("codeEditor",gi);const vi=`
<div class="dropdown cascade-open">
<a ng-click="showActionsMenu()" class="query-part-name pointer dropdown-toggle" data-toggle="dropdown">{{part.label}}</a>
<span>{{part.def.wrapOpen}}</span><span class="query-part-parameters"></span><span>{{part.def.wrapClose}}</span>
<ul class="dropdown-menu">
  <li ng-repeat="action in partActions">
    <a ng-click="triggerPartAction(action)">{{action.text}}</a>
  </li>
</ul>
`;l.Ay.directive("sqlPartEditor",["templateSrv",yi]);function yi(t){const e='<input type="text" class="hide input-mini"></input>';return{restrict:"E",template:vi,scope:{part:"=",handleEvent:"&",debounce:"@"},link:function(n,i){const s=n.part,a=s.def,c=i.find(".query-part-parameters"),h=n.debounce;let f=null;n.partActions=[];function T(Z){const te=O()(this),ce=te.next();ce.val(s.params[Z]),ce.css("width",te.width()+16+"px"),te.hide(),ce.show(),ce.focus(),ce.select();const Ee=ce.data("typeahead");Ee&&(ce.val(""),Ee.lookup())}function p(Z,te){f=setTimeout(()=>{A(Z,te)},200)}function A(Z,te){const ce=Z.prev(),Ee=Z.val();(Ee!==""||s.def.params[te].optional)&&(ce.html(t.highlightVariablesAsHtml(Ee)),s.updateParam(Z.val(),te),n.$apply(()=>{n.handleEvent({$event:{name:"part-param-changed"}})})),Z.hide(),ce.show()}function x(Z,te){te.which===13&&A(O()(this),Z)}function F(){this.style.width=(3+this.value.length)*8+"px"}function he(Z,te,ce){if(!te.options&&!te.dynamicLookup)return;const Ee=(Ne,Ke)=>{if(te.options){let Me=te.options;return te.type==="int"&&(Me=(0,g.map)(Me,Re=>Re.toString())),Me}n.$apply(()=>{n.handleEvent({$event:{name:"get-param-options",param:te}}).then(Me=>{const Re=(0,g.map)(Me,ke=>(0,g.escape)(ke.value));(0,g.indexOf)(Re,s.params[ce])===-1&&Re.unshift((0,g.escape)(s.params[ce])),Ke(Re)})})};Z.attr("data-provide","typeahead"),Z.typeahead({source:Ee,minLength:0,items:1e3,updater:Ne=>(Ne=(0,g.unescape)(Ne),Ne===s.params[ce]&&(clearTimeout(f),Z.focus()),Ne)});const me=Z.data("typeahead");me.lookup=function(){this.query=this.$element.val()||"";const Ne=this.source(this.query,O().proxy(this.process,this));return Ne&&this.process(Ne)},h&&(me.lookup=(0,g.debounce)(me.lookup,500,{leading:!0}))}n.showActionsMenu=()=>{n.handleEvent({$event:{name:"get-part-actions"}}).then(Z=>{n.partActions=Z})},n.triggerPartAction=Z=>{n.handleEvent({$event:{name:"action",action:Z}})};function w(){(0,g.each)(a.params,(Z,te)=>{if(Z.optional&&s.params.length<=te)return;te>0&&O()("<span>"+a.separator+"</span>").appendTo(c);const ce=t.highlightVariablesAsHtml(s.params[te]),Ee=O()('<a class="query-part__link">'+ce+"</a>"),me=O()(e);Ee.appendTo(c),me.appendTo(c),me.blur((0,g.partial)(p,me,te)),me.keyup(F),me.keypress((0,g.partial)(x,te)),Ee.click((0,g.partial)(T,te)),he(me,Z,te)})}function X(){c.empty(),w()}X()}}}l.m7.directive("datasourceHttpSettings",()=>({scope:{current:"=",suggestUrl:"@",noDirectAccess:"@",showForwardOAuthIdentityOption:"@"},templateUrl:"public/app/angular/partials/http_settings_next.html",link:{pre:t=>{t.showAccessOption=t.noDirectAccess!=="true",t.onChange=e=>{t.current=e}}}})),l.m7.directive("datasourceTlsAuthSettings",()=>({scope:{current:"="},templateUrl:"public/app/angular/partials/tls_auth_settings.html"}));var Bt=o(15162),vt=o(1682);l.Ay.directive("pluginComponent",["$compile","$http","$templateCache","$location",Ei]);function Ei(t,e,r,n){function i(p){if(p.template)return Promise.resolve(p.template);const A=r.get(p.templateUrl);return A?Promise.resolve(A):e.get(p.templateUrl).then(x=>x.data)}function s(p,A){if(p)return p.indexOf("public")===0?p:A+"/"+p}function a(p){return p.Component.templateUrl=s(p.Component.templateUrl,p.baseUrl),()=>({templateUrl:p.Component.templateUrl,template:p.Component.template,restrict:"E",controller:p.Component,controllerAs:"ctrl",bindToController:!0,scope:p.bindings,link:(A,x,F,he)=>{he.link&&he.link(A,x,F,he),he.init&&he.init()}})}function c(p,A){const x={name:"panel-plugin-"+p.panel.type,bindings:{dashboard:"=",panel:"=",row:"="},attrs:{dashboard:"dashboard",panel:"panel",class:"panel-height-helper"}},F=Ye.Ay.panels[p.panel.type];return(0,Bt.TV)(F.id).then(he=>{const w=he.angularPanelCtrl;return x.Component=w,!w||w.registered?x:w.templatePromise?w.templatePromise.then(X=>x):(F&&(w.templateUrl=s(w.templateUrl,F.baseUrl)),w.templatePromise=i(w).then(X=>(w.templateUrl=null,w.template=`<grafana-panel ctrl="ctrl" class="panel-height-helper">${X}</grafana-panel>`,{...x,baseUrl:F.baseUrl})),w.templatePromise)})}function h(p,A){switch(A.type){case"query-ctrl":{const x=p.ctrl.datasource;return Promise.resolve({baseUrl:x.meta.baseUrl,name:"query-ctrl-"+x.meta.id,bindings:{target:"=",panelCtrl:"=",datasource:"="},attrs:{target:"ctrl.target","panel-ctrl":"ctrl",datasource:"ctrl.datasource"},Component:x.components.QueryCtrl})}case"annotations-query-ctrl":{const x=p.ctrl.currentDatasource.meta.baseUrl,F=p.ctrl.currentDatasource.meta.id;return(0,vt.cS)(p.ctrl.currentDatasource.meta).then(he=>({baseUrl:x,name:"annotations-query-ctrl-"+F,bindings:{annotation:"=",datasource:"="},attrs:{annotation:"ctrl.currentAnnotation",datasource:"ctrl.currentDatasource"},Component:he.components.AnnotationsQueryCtrl}))}case"datasource-config-ctrl":{const x=p.ctrl.datasourceMeta,F=n.url();return(0,vt.cS)(x).then(he=>(p.$watch("ctrl.current",()=>{F===n.url()&&p.onModelChanged(p.ctrl.current)},!0),{baseUrl:x.baseUrl,name:"ds-config-"+x.id,bindings:{meta:"=",current:"="},attrs:{meta:"ctrl.datasourceMeta",current:"ctrl.current"},Component:he.angularConfigCtrl}))}case"app-config-ctrl":{const x=p.ctrl.model;return(0,vt.ui)(x).then(F=>({baseUrl:x.baseUrl,name:"app-config-"+x.id,bindings:{appModel:"=",appEditCtrl:"="},attrs:{"app-model":"ctrl.model","app-edit-ctrl":"ctrl"},Component:F.angularConfigCtrl}))}case"panel":return c(p,A);default:return Promise.reject({message:"Could not find component type: "+A.type})}}function f(p,A,x){const F=b().element(document.createElement(x.name));(0,g.each)(x.attrs,(he,w)=>{F.attr(w,he)}),t(F)(p),A.empty(),setTimeout(()=>{p.$applyAsync(()=>{A.append(F),setTimeout(()=>{p.$applyAsync(()=>{p.$broadcast(M.ee.componentDidMount.name)})})})})}function T(p,A,x,F){if(F.notFound){A.empty();return}if(!F.Component)throw{message:"Failed to find exported plugin component for "+F.name};if(!F.Component.registered){const he=x.$normalize(F.name),w=a(F);l.Ay.directive(he,w),F.Component.registered=!0}f(p,A,F)}return{restrict:"E",link:(p,A,x)=>{h(p,x).then(F=>{T(p,A,x,F)}).catch(F=>{console.error("Plugin component error",F)})}}}var Gt=o(7376),bi=o(81634),xi=o(24284),_e=o(28138);class Ti{static{this.$inject=["$scope","utilSrv","$rootScope","contextSrv","angularLoader","$injector"]}constructor(e,r,n,i,s,a){(0,Gt.w)(s),(0,bi.j)(a),e.init=()=>{e.contextSrv=i,e.appSubUrl=Ye.Ay.appSubUrl,e._=ie(),r.init()},n.colors=xi.Tj,n.onAppEvent=function(c,h,f){let T;typeof c=="string"?T=n.$on(c,h):T=n.$on(c.name,h);let p=this;p.$id===1&&!f&&console.warn("warning rootScope onAppEvent called without localscope"),f&&(p=f),p.$on("$destroy",T)},n.appEvent=(c,h)=>{typeof c=="string"?(n.$emit(c,h),_e.A.emit(c,h)):(n.$emit(c.name,h),_e.A.emit(c,h))},e.init()}}function Ci(){return{restrict:"E",controller:Ti,link:(t,e)=>{const r=O()("body");O().fn.modal.Constructor.prototype.enforceFocus=()=>{};let n=new Date().getTime(),i=!0;const s=60*5e3;function a(){i&&r.hasClass("page-dashboard")&&new Date().getTime()-n>s&&(i=!1,r.addClass("view-mode--inactive"))}function c(){n=new Date().getTime(),i||(i=!0,r.removeClass("view-mode--inactive"))}r.mousemove(c),r.keydown(c),document.addEventListener("wheel",c,{capture:!0,passive:!0}),document.addEventListener("visibilitychange",c),setInterval(a,2e3),r.click(h=>{const f=O()(h.target);if(f.parents().length===0)return;r.find(".dropdown-menu-open").removeClass("dropdown-menu-open");const T=f.closest("[data-click-hide]");if(T.length){const A=T.parent();T.detach(),setTimeout(()=>{A.append(T)},100)}const p=e.find(".popover");p.length>0&&f.parents(".graph-legend").length===0&&p.hide()})}}}l.Ay.directive("grafanaApp",Ci);var ys=o(23345),Es=o(26415),bs=o(74526),Ai=o(16233),Si=o(17493),Ii=o(74856),Li=o(63770),Ni=o(87815),wi=o(5808),Ft=o(39601);class Di{constructor(){this.$get=()=>{},(0,Ft.Lc)("Patch angular",!1,"RouteParamsProvider")}}class Oi{constructor(){(0,Ft.Lc)("Patch angular",!1,"RouteProvider")}$get(){return this}}var Mi=o(4244);const Pi=()=>{l.m7.config(["$provide",t=>{t.decorator("$browser",["$delegate",e=>(e.onUrlChange=()=>{},e.url=()=>"",e)])}])},Ui=()=>{l.m7.config(["$provide",t=>{t.decorator("$location",["$delegate",e=>(e=new Mi.b,e)])}]),l.m7.provider("$route",Oi),l.m7.provider("$routeParams",Di)};function ji(){Pi(),Ui()}function $i(t){t.oldInvoke=t.invoke,t.invoke=(e,r,n,i)=>{const s=n?.$scope?.$parent;return s&&(s.panel&&(r.panel=s.panel),s.dashboard&&(r.dashboard=s.dashboard),s.ctrl?.target&&(r.panelCtrl=s.ctrl,r.datasource=s.ctrl.datasource,r.target=s.ctrl.target),s.ctrl?.datasourceMeta&&(r.meta=s.ctrl.datasourceMeta,r.current=s.ctrl.current),s.ctrl?.currentAnnotation&&(r.annotation=s.ctrl.currentAnnotation,r.datasource=s.ctrl.currentDatasource),s.isAppConfigCtrl&&(r.appEditCtrl=s.ctrl,r.appModel=s.ctrl.model),s.$parent?.$parent?.ctrl?.appModel&&(r.appModel=s.$parent?.$parent?.ctrl?.appModel)),t.oldInvoke(e,r,n,i)}}var Ri=o(39741),ki=o(18226),Vt=o(14792);function Bi(t){return function(r){const n=(0,B.useRef)(null),i=(0,B.useRef)(),s=(0,B.useRef)();return(0,B.useEffect)(()=>{if(!n.current)return;const a=(0,Gt.E)(),c='<plugin-component type="panel" class="panel-height-helper"></plugin-component>',h=new Fi,f=new Gi(t,r,h);i.current={panel:f,dashboard:(0,Vt.UA)().getCurrent(),size:{width:r.width,height:r.height},queryRunner:h},s.current=a.load(n.current,i.current,c)},[]),(0,B.useEffect)(()=>{s.current&&(i.current.size.height=r.height,i.current.size.width=r.width,i.current.panel.events.publish(new d.XM))},[r.width,r.height]),(0,B.useEffect)(()=>{i.current?.panel&&i.current.queryRunner.forwardNewData(r.data)},[r.data]),(0,m.jsx)("div",{ref:n,className:"panel-height-helper"})}}class Gi{constructor(e,r,n){r.options.angularOptions&&Object.assign(this,r.options.angularOptions),this.id=r.id,this.type=e.meta.id,this.title=r.title,this.fieldConfig=r.fieldConfig,this.options=r.options,this.plugin=e,this.events=new ki.o,this.queryRunner=n}refresh(){this.events.publish(new K._)}render(){this.events.publish(new d.XM)}getQueryRunner(){return this.queryRunner}}class Fi{constructor(){this.subject=new Ri.m(1)}getData(e){return this.subject}forwardNewData(e){this.subject.next(e)}run(){}}var Vi=o(17172),zi=o(19347),Ki=o(10096),Hi=o(71500),Wi=o(29304),$e=o(95344);class Qi{constructor(){}init(){_e.l.subscribe(d.Ps,e=>this.showModal(e.payload)),_e.l.subscribe(d.aP,this.hideModal.bind(this))}hideModal(){(0,$e.l)("UtilSrv","hideModal",""),this.modalScope&&this.modalScope.dismiss&&this.modalScope.dismiss()}showModal(e){(0,$e.l)("UtilSrv","showModal","publish ShowModalReactEvent")}}var yt=o(10154);class Yi{clearPromiseCaches(){(0,$e.l)("annotations_srv.ts","clearPromiseCaches","DashboardQueryRunner")}getAnnotations(e){return(0,$e.l)("annotations_srv.ts","getAnnotations","DashboardQueryRunner.getResult"),Promise.resolve({annotations:[],alertState:void 0})}getAlertStates(e){return(0,$e.l)("annotations_srv.ts","getAlertStates","DashboardQueryRunner.getResult"),Promise.resolve(void 0)}getGlobalAnnotations(e){return(0,$e.l)("annotations_srv.ts","getGlobalAnnotations","DashboardQueryRunner.getResult"),Promise.resolve([])}saveAnnotationEvent(e){return(0,$e.l)("annotations_srv.ts","saveAnnotationEvent","api/saveAnnotation"),(0,yt.vJ)(e)}updateAnnotationEvent(e){return(0,$e.l)("annotations_srv.ts","updateAnnotationEvent","api/updateAnnotation"),(0,yt.rJ)(e)}deleteAnnotationEvent(e){return(0,$e.l)("annotations_srv.ts","deleteAnnotationEvent","api/deleteAnnotation"),(0,yt.Xm)(e)}translateQueryResult(e,r){(0,$e.l)("annotations_srv.ts","translateQueryResult","DashboardQueryRunner/utils/translateQueryResult"),e.snapshotData&&(e=(0,g.cloneDeep)(e),delete e.snapshotData);for(const n of r)n.source=e,n.color=e.iconColor,n.type=e.name,n.isRegion=n.timeEnd&&n.time!==n.timeEnd;return r}}function Xi(){l.Ay.factory("backendSrv",()=>(0,Vi.AI)()),l.Ay.factory("contextSrv",()=>Ki.TP),l.Ay.factory("dashboardSrv",()=>(0,Vt.UA)()),l.Ay.factory("datasourceSrv",()=>(0,zi.l)()),l.Ay.factory("linkSrv",()=>(0,Wi.mQ)()),l.Ay.factory("validationSrv",()=>Hi.P),l.Ay.service("annotationsSrv",Yi),l.Ay.service("utilSrv",Qi)}const Ji={angular:{...b(),default:b()},"app/core/core_module":{default:l.m7,__useDefault:!0},"app/core/core":{appEvents:_e.A,contextSrv:Ai.TP,coreModule:l.m7},"app/plugins/sdk":wi,"app/core/utils/promiseToDigest":{promiseToDigest:gt}};class Zi{constructor(){this.preBootModules=[],this.ngModuleDependencies=[],this.registerFunctions={}}init(){const e=b().module("grafana",[]);(0,Bt.f7)(Bi),e.config(["$controllerProvider","$compileProvider","$filterProvider","$httpProvider","$provide","$sceDelegateProvider",(n,i,s,a,c,h)=>{Ye.$W.buildInfo.env!=="development"&&i.debugInfoEnabled(!1),a.useApplyAsync(!0),Ye.$W.pluginsCDNBaseURL&&h.trustedResourceUrlList(["self",`${Ye.$W.pluginsCDNBaseURL}/**`]),this.registerFunctions.controller=n.register,this.registerFunctions.directive=i.directive,this.registerFunctions.factory=c.factory,this.registerFunctions.service=c.service,this.registerFunctions.filter=s.register,c.decorator("$http",["$delegate","$templateCache",(f,T)=>{const p=f.get;return f.get=(A,x)=>(A.match(/\.html$/)&&(T.get(A)||(A+="?v="+new Date().getTime())),p(A,x)),f}])}]),this.ngModuleDependencies=["grafana.core","ngSanitize","grafana","pasvaz.bindonce","react"],l.yF.forEach(n=>{this.useModule(n)}),b().module("grafana.services").service("dashboardLoaderSrv",Si.Fu),l.m7.factory("timeSrv",()=>(0,Ii.jG)()),l.m7.factory("templateSrv",()=>(0,Nt.w)()),zr(),Xi(),ji();const r=(0,Ni.kB)(Ji);Li.z.addImportMap({imports:r}),$.fn.tooltip.defaults.animation=!1}useModule(e){return this.preBootModules?this.preBootModules.push(e):(0,g.extend)(e,this.registerFunctions),this.ngModuleDependencies.push(e.name),e}bootstrap(){const e=b().bootstrap(document.getElementById("ngRoot"),this.ngModuleDependencies);return $i(e),e.invoke(()=>(this.preBootModules.forEach(r=>{(0,g.extend)(r,this.registerFunctions)}),()=>{})),e}}},59559:(I,S,o)=>{"use strict";o.d(S,{a:()=>G});var j=o(2543),P=o.n(j);class G{constructor(K,l){this.$scope=K,this.$injector=l,this.panelCtrl=this.panelCtrl??K.ctrl.panelCtrl,this.target=this.target??K.ctrl.target,this.datasource=this.datasource??K.ctrl.datasource,this.panel=this.panelCtrl?.panel??K.ctrl.panelCtrl.panel,this.isLastQuery=(0,j.indexOf)(this.panel.targets,this.target)===this.panel.targets.length-1}refresh(){this.panelCtrl.refresh()}}},50410:(I,S,o)=>{"use strict";let j=o(12631);j.keys().forEach(P=>{j(P)})},7521:(I,S,o)=>{"use strict";o.d(S,{A:()=>b});var j=o(74848),P=o(32196),G=o(13544),M=o(14578),K=o(42418),l=o(55852),d=o(76442);const v=(0,P.css)({textAlign:"center"}),u=(0,P.css)({maxWidth:"700px",margin:"0 auto"}),b=({title:ue,buttonIcon:le,buttonLink:J,buttonTitle:ee,buttonDisabled:k,onClick:W,proTip:g,proTipLink:ie,proTipLinkTitle:ne,proTipTarget:D,infoBox:H,infoBoxTitle:se})=>{const E=()=>(0,j.jsxs)(j.Fragment,{children:[g?(0,j.jsxs)("span",{children:[(0,j.jsx)(M.I,{name:"rocket"}),(0,j.jsxs)(j.Fragment,{children:[" ProTip: ",g," "]}),ie&&(0,j.jsx)("a",{href:ie,target:D,className:"text-link",children:ne})]},"proTipFooter"):"",H?(0,j.jsx)(K.F,{severity:"info",title:se??"",className:u,children:(0,j.jsx)("div",{dangerouslySetInnerHTML:H})}):""]}),pe=E()?"":(0,P.css)({marginBottom:"20px"}),B=J?l.z9:l.$n,ge=(0,j.jsx)(B,{size:"lg",onClick:W,href:J,icon:le,className:pe,"data-testid":G.Tp.components.CallToActionCard.buttonV2(ee),disabled:k,children:ee});return(0,j.jsx)(d.c,{className:v,message:ue,footer:E(),callToActionElement:ge})}},5808:(I,S,o)=>{"use strict";o.r(S),o.d(S,{MetricsPanelCtrl:()=>d,PanelCtrl:()=>l,QueryCtrl:()=>v,loadPluginCss:()=>P.PL});var j=o(92341),P=o(89191),G=o(75519),M=o(70225),K=o(59559);const l=(0,j.Y)(M.y),d=(0,j.Y)(G.F),v=(0,j.Y)(K.a)},42346:()=>{(function(I){"use strict";var S={tagClass:function(l){return"label label-info"},itemValue:function(l){return l&&l.toString()},itemText:function(l){return this.itemValue(l)},freeInput:!0,maxTags:void 0,confirmKeys:[13],onTagExists:function(l,d){d.hide().fadeIn()}};function o(l,d){this.itemsArray=[],this.$element=I(l),this.$element.hide(),this.widthClass=d.widthClass||"width-9",this.isSelect=l.tagName==="SELECT",this.multiple=this.isSelect&&l.hasAttribute("multiple"),this.objectItems=d&&d.itemValue,this.placeholderText=l.hasAttribute("placeholder")?this.$element.attr("placeholder"):"",this.$container=I('<div class="bootstrap-tagsinput"></div>'),this.$input=I('<input class="gf-form-input '+this.widthClass+'" type="text" placeholder="'+this.placeholderText+'"/>').appendTo(this.$container),this.$element.after(this.$container),this.build(d)}o.prototype={constructor:o,add:function(l,d){var v=this;if(!(v.options.maxTags&&v.itemsArray.length>=v.options.maxTags)&&!(l!==!1&&!l)){if(typeof l=="object"&&!v.objectItems)throw"Can't add objects when itemValue option is not set";if(!l.toString().match(/^\s*$/)){if(v.isSelect&&!v.multiple&&v.itemsArray.length>0&&v.remove(v.itemsArray[0]),typeof l=="string"&&this.$element[0].tagName==="INPUT"){var u=l.split(",");if(u.length>1){for(var L=0;L<u.length;L++)this.add(u[L],!0);d||v.pushVal();return}}var b=v.options.itemValue(l),ue=v.options.itemText(l),le=v.options.tagClass(l),J=I.grep(v.itemsArray,function(g){return v.options.itemValue(g)===b})[0];if(J){if(v.options.onTagExists){var ee=I(".tag",v.$container).filter(function(){return I(this).data("item")===J});v.options.onTagExists(l,ee)}return}v.itemsArray.push(l);var k=I('<span class="tag '+M(le)+'">'+M(ue)+'<span data-role="remove"></span></span>');if(k.data("item",l),v.findInputWrapper().before(k),k.after(" "),v.isSelect&&!I('option[value="'+escape(b)+'"]',v.$element)[0]){var W=I("<option selected>"+M(ue)+"</option>");W.data("item",l),W.attr("value",b),v.$element.append(W)}d||v.pushVal(),v.options.maxTags===v.itemsArray.length&&v.$container.addClass("bootstrap-tagsinput-max"),v.$element.trigger(I.Event("itemAdded",{item:l}))}}},remove:function(l,d){var v=this;v.objectItems&&(typeof l=="object"?l=I.grep(v.itemsArray,function(u){return v.options.itemValue(u)==v.options.itemValue(l)})[0]:l=I.grep(v.itemsArray,function(u){return v.options.itemValue(u)==l})[0]),l&&(I(".tag",v.$container).filter(function(){return I(this).data("item")===l}).remove(),I("option",v.$element).filter(function(){return I(this).data("item")===l}).remove(),v.itemsArray.splice(I.inArray(l,v.itemsArray),1)),d||v.pushVal(),v.options.maxTags>v.itemsArray.length&&v.$container.removeClass("bootstrap-tagsinput-max"),v.$element.trigger(I.Event("itemRemoved",{item:l}))},removeAll:function(){var l=this;for(I(".tag",l.$container).remove(),I("option",l.$element).remove();l.itemsArray.length>0;)l.itemsArray.pop();l.pushVal(),l.options.maxTags&&!this.isEnabled()&&this.enable()},refresh:function(){var l=this;I(".tag",l.$container).each(function(){var d=I(this),v=d.data("item"),u=l.options.itemValue(v),L=l.options.itemText(v),b=l.options.tagClass(v);if(d.attr("class",null),d.addClass("tag "+M(b)),d.contents().filter(function(){return this.nodeType==3})[0].nodeValue=M(L),l.isSelect){var ue=I("option",l.$element).filter(function(){return I(this).data("item")===v});ue.attr("value",u)}})},items:function(){return this.itemsArray},pushVal:function(){var l=this,d=I.map(l.items(),function(v){return l.options.itemValue(v).toString()});l.$element.val(d,!0).trigger("change")},build:function(l){var d=this;d.options=I.extend({},S,l);var v=d.options.typeahead||{};d.objectItems&&(d.options.freeInput=!1),j(d.options,"itemValue"),j(d.options,"itemText"),j(d.options,"tagClass"),d.options.source&&(v.source=d.options.source),v.source&&I.fn.typeahead&&(P(v,"source"),d.$input.typeahead({source:function(u,L){function b(J){for(var ee=[],k=0;k<J.length;k++){var W=d.options.itemText(J[k]);ue[W]=J[k],ee.push(W)}L(ee)}this.map={};var ue=this.map,le=v.source(u);I.isFunction(le.success)?le.success(b):I.when(le).then(b)},updater:function(u){d.add(this.map[u])},matcher:function(u){return u.toLowerCase().indexOf(this.query.trim().toLowerCase())!==-1},sorter:function(u){return u.sort()},highlighter:function(u){var L=new RegExp("("+this.query+")","gi");return u.replace(L,"<strong>$1</strong>")}})),d.$container.on("click",I.proxy(function(u){d.$input.focus()},d)),d.$container.on("blur","input",I.proxy(function(u){var L=I(u.target);d.add(L.val()),L.val(""),u.preventDefault()},d)),d.$container.on("keydown","input",I.proxy(function(u){var L=I(u.target),b=d.findInputWrapper();switch(u.which){case 8:if(K(L[0])===0){var ue=b.prev();ue&&d.remove(ue.data("item"))}break;case 46:if(K(L[0])===0){var le=b.next();le&&d.remove(le.data("item"))}break;case 37:var J=b.prev();L.val().length===0&&J[0]&&(J.before(b),L.focus());break;case 39:var ee=b.next();L.val().length===0&&ee[0]&&(ee.after(b),L.focus());break;default:d.options.freeInput&&I.inArray(u.which,d.options.confirmKeys)>=0&&(d.add(L.val()),L.val(""),u.preventDefault())}L.attr("size",Math.max(this.inputSize,L.val().length))},d)),d.$container.on("click","[data-role=remove]",I.proxy(function(u){d.remove(I(u.target).closest(".tag").data("item")),u.stopPropagation()},d)),d.options.itemValue===S.itemValue&&(d.$element[0].tagName==="INPUT"?d.add(d.$element.val()):I("option",d.$element).each(function(){d.add(I(this).attr("value"),!0)}))},destroy:function(){var l=this;l.$container.off("keypress","input"),l.$container.off("click","[role=remove]"),l.$container.remove(),l.$element.removeData("tagsinput"),l.$element.show()},focus:function(){this.$input.focus()},input:function(){return this.$input},findInputWrapper:function(){for(var l=this.$input[0],d=this.$container[0];l&&l.parentNode!==d;)l=l.parentNode;return I(l)}},I.fn.tagsinput=function(l,d){var v=[];return this.each(function(){var u=I(this).data("tagsinput");if(!u)u=new o(this,l),I(this).data("tagsinput",u),v.push(u),this.tagName==="SELECT"&&I("option",I(this)).attr("selected","selected"),I(this).val(I(this).val());else{var L=u[l](d);L!==void 0&&v.push(L)}}),typeof l=="string"?v.length>1?v:v[0]:v},I.fn.tagsinput.Constructor=o;function j(l,d){if(typeof l[d]!="function"){var v=l[d];l[d]=function(u){return u[v]}}}function P(l,d){if(typeof l[d]!="function"){var v=l[d];l[d]=function(){return v}}}var G=I("<div />");function M(l){return l?G.text(l).html():""}function K(l){var d=0;if(document.selection){l.focus();var v=document.selection.createRange();v.moveStart("character",-l.value.length),d=v.text.length}else(l.selectionStart||l.selectionStart=="0")&&(d=l.selectionStart);return d}I(function(){I("input[data-role=tagsinput], select[multiple][data-role=tagsinput]").tagsinput()})})(window.jQuery)}}]);

//# sourceMappingURL=7808.012d7bf1c64b2ffcfb7f.js.map