{{part.def.type}}
()
`;o.Ay.directive("queryPartEditor",["templateSrv",en]);function en(r){const e='
';return{restrict:"E",template:_t,scope:{part:"=",handleEvent:"&",debounce:"@"},link:function(t,a){const l=t.part,u=l.def,m=a.find(".query-part-parameters"),y=t.debounce;t.partActions=[];function v(N){const _=D()(this),J=_.next();J.val(l.params[N]),J.css("width",_.width()+16+"px"),_.hide(),J.show(),J.focus(),J.select();const re=J.data("typeahead");re&&(J.val(""),re.lookup())}function L(N){const _=D()(this),J=_.prev(),re=_.val();(re!==""||l.def.params[N].optional)&&(J.html(r.highlightVariablesAsHtml(re)),l.updateParam(_.val(),N),t.$apply(()=>{t.handleEvent({$event:{name:"part-param-changed"}})})),_.hide(),J.show()}function f(N,_){_.which===13&&L.call(this,N)}function P(){this.style.width=(3+this.value.length)*8+"px"}function x(N,_,J){if(!_.options&&!_.dynamicLookup)return;const re=(ye,we)=>{if(_.options){let Ee=_.options;return _.type==="int"&&(Ee=(0,g.map)(Ee,Ie=>Ie.toString())),Ee}t.$apply(()=>{t.handleEvent({$event:{name:"get-param-options"}}).then(Ee=>{const Ie=(0,g.map)(Ee,Pe=>(0,g.escape)(Pe.value));we(Ie)})})};N.attr("data-provide","typeahead"),N.typeahead({source:re,minLength:0,items:1e3,updater:ye=>(ye=(0,g.unescape)(ye),setTimeout(()=>{L.call(N[0],J)},0),ye)});const ce=N.data("typeahead");ce.lookup=function(){this.query=this.$element.val()||"";const ye=this.source(this.query,D().proxy(this.process,this));return ye&&this.process(ye)},y&&(ce.lookup=(0,g.debounce)(ce.lookup,500,{leading:!0}))}t.showActionsMenu=()=>{(0,We.F)(t)(t.handleEvent({$event:{name:"get-part-actions"}}).then(N=>{t.partActions=N}))},t.triggerPartAction=N=>{t.handleEvent({$event:{name:"action",action:N}})};function X(){(0,g.each)(u.params,(N,_)=>{if(N.optional&&l.params.length<=_)return;_>0&&D()("
, ").appendTo(m);const J=r.highlightVariablesAsHtml(l.params[_]),re=D()('
'+J+""),ce=D()(e);re.appendTo(m),ce.appendTo(m),ce.blur((0,g.partial)(L,_)),ce.keyup(P),ce.keypress((0,g.partial)(f,_)),re.click((0,g.partial)(v,_)),x(ce,N,_)})}function he(){m.empty(),X()}he()}}}function tn(r){let e=this.query;return e===""?!0:(e[0]==="/"&&(e=e.substring(1)),e[e.length-1]==="/"&&(e=e.substring(0,e.length-1)),r.toLowerCase().match(e.toLowerCase()))}class Je{constructor(e,n,t,a){this.$scope=e,this.$sce=t,this.templateSrv=a,this.inputElement=n.find("input").first(),this.linkElement=n.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))}$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:tn});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(n=>{(n.keyCode===40||n.keyCode===13)&&this.linkElement.click()}),this.inputElement.keydown(n=>{n.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(0,We.F)(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 n=(0,g.find)(e,{value:this.model});this.updateDisplay(n?n.text:this.model)}):this.updateDisplay(this.model)}typeaheadSource(e,n){this.getOptionsInternal(e).then(t=>{this.optionCache=t;const a=(0,g.map)(t,l=>(0,g.escape)(l.text));this.allowCustom&&this.text!==""&&(0,g.indexOf)(a,this.text)===-1&&a.unshift(this.text),n(a)})}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 n=(0,g.find)(this.optionCache,{text:e});n?((0,g.isObject)(this.model)?this.model=n:this.model=n.value,this.text=n.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:n})})})})}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())}}Je.$inject=["$scope","$element","$sce","templateSrv"];const nn=`
`;function rn(){return{restrict:"E",template:nn,controller:Je,bindToController:!0,controllerAs:"ctrl",scope:{model:"=",getOptions:"&",onChange:"&",cssClass:"@",allowCustom:"@",labelMode:"@",lookupText:"@",placeholder:"@",startOpen:"@",debounce:"@"}}}o.Ay.directive("gfFormDropdown",rn);const an=`
`,on="baron baron__root",sn="baron__scroller";function ln(){return{restrict:"A",link:(r,e,n)=>{let t=e.parent();const a=e;n.grafanaScrollbar&&n.grafanaScrollbar==="scrollonroot"&&(t=a),t.addClass(on),D()(an).appendTo(t),e.addClass(sn);const l={root:t[0],scroller:a[0],bar:".baron__bar",barOnCls:"_scrollbar",scrollingCls:"_scrolling",track:".baron__track",direction:"v"},u=I()(l);r.$on("$destroy",()=>{u.dispose()})}}}o.Ay.directive("grafanaScrollbar",ln);var cn=i(44533);o.Ay.directive("jsonTree",[function(){return{restrict:"E",scope:{object:"=",startExpanded:"@",rootName:"@"},link:(e,n)=>{let t=e.startExpanded;e.startExpanded==="true"?t=2:e.startExpanded==="false"&&(t=1);const a={[e.rootName]:e.object},u=new cn.O(a,t,{animateOpen:!0}).render(!0);n.append(u)}}}]);const un=`
`,hn=`
`;class Be{constructor(e,n){this.$timeout=n,this.show=!0,this.id=e.$id}internalOnChange(){return this.$timeout(()=>this.onChange())}}Be.$inject=["$scope","$timeout"];function dn(){return{restrict:"E",controller:Be,controllerAs:"ctrl",bindToController:!0,scope:{checked:"=",label:"@",labelClass:"@",tooltip:"@",switchClass:"@",onChange:"&"},template:un}}function pn(){return{restrict:"E",controller:Be,controllerAs:"ctrl",bindToController:!0,scope:{checked:"=",label:"@",labelClass:"@",tooltip:"@",switchClass:"@",onChange:"&"},template:hn}}o.Ay.directive("gfFormSwitch",dn),o.Ay.directive("gfFormCheckbox",pn);function fn(){return{restrict:"E",template:`
`,transclude:!0,link:(r,e,n,t,a)=>{const l=n.offset||"0 -10px",u=n.position||"right middle";let m="drop-help drop-hide-out-of-bounds";const y="hover";e.addClass("gf-form-help-icon"),n.wide&&(m+=" drop-wide"),n.mode&&e.addClass("gf-form-help-icon--"+n.mode),a((v,L)=>{const f=document.createElement("div");f.className="markdown-html",(0,g.each)(v,x=>{f.appendChild(x)});const P={target:e[0],content:f,position:u,classes:m,openOn:y,hoverOpenDelay:400,tetherOptions:{offset:l,constraints:[{to:"window",attachment:"together",pin:!0}]}};r.$applyAsync(()=>{const x=new(te())(P),X=r.$on("$destroy",()=>{x.destroy(),X()})})})}}}o.Ay.directive("infoPopover",fn),o.Ay.directive("spectrumPicker",mn);function mn(){return{restrict:"E",require:"ngModel",scope:!0,replace:!0,template:'
',link:(r,e,n,t)=>{r.ngModel=t,r.onColorChange=a=>{t.$setViewValue(a)}}}}var ke=i(2913);const gn="ace/theme/grafana-dark",vn="ace/theme/textmate",yn="text",bn=10,Cn=2,En=!0,wn=!0,An="
";async function xn(r,e,n){const t=n.mode||yn,a=n.maxLines||bn,l=n.showGutter!==void 0,u=n.tabSize||Cn,m=n.behavioursEnabled?n.behavioursEnabled==="true":En,y=n.snippetsEnabled?n.snippetsEnabled==="true":wn,v=e.get(0),{default:L}=await i.e(3832).then(i.t.bind(i,47496,23));await i.e(6464).then(i.t.bind(i,6464,23)),await i.e(2694).then(i.t.bind(i,52694,23)),await i.e(9772).then(i.t.bind(i,57391,23)),await i.e(2228).then(i.t.bind(i,32228,23)),await i.e(2514).then(i.t.bind(i,32514,23)),await i.e(7515).then(i.t.bind(i,17515,23)),await i.e(4289).then(i.t.bind(i,54289,23)),await i.e(1708).then(i.t.bind(i,11708,23)),await i.e(7613).then(i.t.bind(i,7613,23)),await i.e(8730).then(i.t.bind(i,98730,23)),await i.e(9118).then(i.t.bind(i,59118,23)),await i.e(5277).then(i.t.bind(i,45277,23)),await i.e(9384).then(i.t.bind(i,69384,23));const f=L.edit(v),P=f.getSession(),x={maxLines:a,showGutter:l,tabSize:u,behavioursEnabled:m,highlightActiveLine:!1,showPrintMargin:!1,autoScrollEditorIntoView:!0};f.setOptions(x),f.$blockScrolling=1/0,f.renderer.setScrollMargin(10,10),f.renderer.setPadding(10),N(),he(t),_(r.content),e.addClass("gf-code-editor");const X=e.find("textarea");X.addClass("gf-form-input"),X.attr("aria-label",n.textareaLabel),r.codeEditorFocus&&setTimeout(()=>{X.focus();const J=X[0];if(J.setSelectionRange){const re=X.val().length*2;J.setSelectionRange(re,re)}},100),P.on("change",J=>{r.$apply(()=>{const re=f.getValue();r.content=re})}),r.$watch("content",(J,re)=>{const ce=f.getValue();J!==ce&&J!==re&&r.$$postDigest(()=>{_(J)})}),f.on("blur",()=>{r.onChange()}),r.$on("$destroy",()=>{f.destroy()}),f.commands.addCommand({name:"executeQuery",bindKey:{win:"Ctrl-Enter",mac:"Command-Enter"},exec:()=>{r.onChange()}});function he(J){if(L.acequire("ace/ext/language_tools"),f.setOptions({enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:y}),r.getCompleter()){const ce=f;ce.completers=ce.completers.slice(),ce.completers.push(r.getCompleter())}const re=`ace/mode/${J}`;P.setMode(re)}function N(){let J=gn;ke.Ay.bootData.user.lightTheme&&(J=vn),f.setTheme(J)}function _(J){f.setValue(J),f.clearSelection()}}function Tn(){return{restrict:"E",template:An,scope:{content:"=",datasource:"=",codeEditorFocus:"<",onChange:"&",getCompleter:"&"},link:xn}}o.Ay.directive("codeEditor",Tn);const Sn=`
{{part.label}}
{{part.def.wrapOpen}}{{part.def.wrapClose}}
`;o.Ay.directive("sqlPartEditor",["templateSrv",Dn]);function Dn(r){const e='
';return{restrict:"E",template:Sn,scope:{part:"=",handleEvent:"&",debounce:"@"},link:function(t,a){const l=t.part,u=l.def,m=a.find(".query-part-parameters"),y=t.debounce;let v=null;t.partActions=[];function L(J){const re=D()(this),ce=re.next();ce.val(l.params[J]),ce.css("width",re.width()+16+"px"),re.hide(),ce.show(),ce.focus(),ce.select();const ye=ce.data("typeahead");ye&&(ce.val(""),ye.lookup())}function f(J,re){v=setTimeout(()=>{P(J,re)},200)}function P(J,re){const ce=J.prev(),ye=J.val();(ye!==""||l.def.params[re].optional)&&(ce.html(r.highlightVariablesAsHtml(ye)),l.updateParam(J.val(),re),t.$apply(()=>{t.handleEvent({$event:{name:"part-param-changed"}})})),J.hide(),ce.show()}function x(J,re){re.which===13&&P(D()(this),J)}function X(){this.style.width=(3+this.value.length)*8+"px"}function he(J,re,ce){if(!re.options&&!re.dynamicLookup)return;const ye=(Ee,Ie)=>{if(re.options){let Pe=re.options;return re.type==="int"&&(Pe=(0,g.map)(Pe,Re=>Re.toString())),Pe}t.$apply(()=>{t.handleEvent({$event:{name:"get-param-options",param:re}}).then(Pe=>{const Re=(0,g.map)(Pe,sr=>(0,g.escape)(sr.value));(0,g.indexOf)(Re,l.params[ce])===-1&&Re.unshift((0,g.escape)(l.params[ce])),Ie(Re)})})};J.attr("data-provide","typeahead"),J.typeahead({source:ye,minLength:0,items:1e3,updater:Ee=>(Ee=(0,g.unescape)(Ee),Ee===l.params[ce]&&(clearTimeout(v),J.focus()),Ee)});const we=J.data("typeahead");we.lookup=function(){this.query=this.$element.val()||"";const Ee=this.source(this.query,D().proxy(this.process,this));return Ee&&this.process(Ee)},y&&(we.lookup=(0,g.debounce)(we.lookup,500,{leading:!0}))}t.showActionsMenu=()=>{t.handleEvent({$event:{name:"get-part-actions"}}).then(J=>{t.partActions=J})},t.triggerPartAction=J=>{t.handleEvent({$event:{name:"action",action:J}})};function N(){(0,g.each)(u.params,(J,re)=>{if(J.optional&&l.params.length<=re)return;re>0&&D()("
"+u.separator+"").appendTo(m);const ce=r.highlightVariablesAsHtml(l.params[re]),ye=D()('
'+ce+""),we=D()(e);ye.appendTo(m),we.appendTo(m),we.blur((0,g.partial)(f,we,re)),we.keyup(X),we.keypress((0,g.partial)(x,re)),ye.click((0,g.partial)(L,re)),he(we,J,re)})}function _(){m.empty(),N()}_()}}}o.m7.directive("datasourceHttpSettings",()=>({scope:{current:"=",suggestUrl:"@",noDirectAccess:"@",showForwardOAuthIdentityOption:"@"},templateUrl:"public/app/angular/partials/http_settings_next.html",link:{pre:r=>{r.showAccessOption=r.noDirectAccess!=="true",r.onChange=e=>{r.current=e}}}})),o.m7.directive("datasourceTlsAuthSettings",()=>({scope:{current:"="},templateUrl:"public/app/angular/partials/tls_auth_settings.html"}));var Ye=i(15162),Ve=i(91629);o.Ay.directive("pluginComponent",["$compile","$http","$templateCache","$location",$n]);function $n(r,e,n,t){function a(f){if(f.template)return Promise.resolve(f.template);const P=n.get(f.templateUrl);return P?Promise.resolve(P):e.get(f.templateUrl).then(x=>x.data)}function l(f,P){if(f)return f.indexOf("public")===0?f:P+"/"+f}function u(f){return f.Component.templateUrl=l(f.Component.templateUrl,f.baseUrl),()=>({templateUrl:f.Component.templateUrl,template:f.Component.template,restrict:"E",controller:f.Component,controllerAs:"ctrl",bindToController:!0,scope:f.bindings,link:(P,x,X,he)=>{he.link&&he.link(P,x,X,he),he.init&&he.init()}})}function m(f,P){const x={name:"panel-plugin-"+f.panel.type,bindings:{dashboard:"=",panel:"=",row:"="},attrs:{dashboard:"dashboard",panel:"panel",class:"panel-height-helper"}},X=ke.Ay.panels[f.panel.type];return(0,Ye.TV)(X.id).then(he=>{const N=he.angularPanelCtrl;return x.Component=N,!N||N.registered?x:N.templatePromise?N.templatePromise.then(_=>x):(X&&(N.templateUrl=l(N.templateUrl,X.baseUrl)),N.templatePromise=a(N).then(_=>(N.templateUrl=null,N.template=`
${_}`,{...x,baseUrl:X.baseUrl})),N.templatePromise)})}function y(f,P){switch(P.type){case"query-ctrl":{const x=f.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=f.ctrl.currentDatasource.meta.baseUrl,X=f.ctrl.currentDatasource.meta.id;return(0,Ve.cS)(f.ctrl.currentDatasource.meta).then(he=>({baseUrl:x,name:"annotations-query-ctrl-"+X,bindings:{annotation:"=",datasource:"="},attrs:{annotation:"ctrl.currentAnnotation",datasource:"ctrl.currentDatasource"},Component:he.components.AnnotationsQueryCtrl}))}case"datasource-config-ctrl":{const x=f.ctrl.datasourceMeta,X=t.url();return(0,Ve.cS)(x).then(he=>(f.$watch("ctrl.current",()=>{X===t.url()&&f.onModelChanged(f.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=f.ctrl.model;return(0,Ve.ui)(x).then(X=>({baseUrl:x.baseUrl,name:"app-config-"+x.id,bindings:{appModel:"=",appEditCtrl:"="},attrs:{"app-model":"ctrl.model","app-edit-ctrl":"ctrl"},Component:X.angularConfigCtrl}))}case"panel":return m(f,P);default:return Promise.reject({message:"Could not find component type: "+P.type})}}function v(f,P,x){const X=d().element(document.createElement(x.name));(0,g.each)(x.attrs,(he,N)=>{X.attr(N,he)}),r(X)(f),P.empty(),setTimeout(()=>{f.$applyAsync(()=>{P.append(X),setTimeout(()=>{f.$applyAsync(()=>{f.$broadcast(S.ee.componentDidMount.name)})})})})}function L(f,P,x,X){if(X.notFound){P.empty();return}if(!X.Component)throw{message:"Failed to find exported plugin component for "+X.name};if(!X.Component.registered){const he=x.$normalize(X.name),N=u(X);o.Ay.directive(he,N),X.Component.registered=!0}v(f,P,X)}return{restrict:"E",link:(f,P,x)=>{y(f,x).then(X=>{L(f,P,x,X)}).catch(X=>{console.error("Plugin component error",X)})}}}var Ze=i(7376),Pn=i(81634),Mn=i(24284),Oe=i(28138);class qe{constructor(e,n,t,a,l,u){(0,Ze.w)(l),(0,Pn.j)(u),e.init=()=>{e.contextSrv=a,e.appSubUrl=ke.Ay.appSubUrl,e._=ie(),n.init()},t.colors=Mn.Tj,t.onAppEvent=function(m,y,v){let L;typeof m=="string"?L=t.$on(m,y):L=t.$on(m.name,y);let f=this;f.$id===1&&!v&&console.warn("warning rootScope onAppEvent called without localscope"),v&&(f=v),f.$on("$destroy",L)},t.appEvent=(m,y)=>{typeof m=="string"?(t.$emit(m,y),Oe.A.emit(m,y)):(t.$emit(m.name,y),Oe.A.emit(m,y))},e.init()}}qe.$inject=["$scope","utilSrv","$rootScope","contextSrv","angularLoader","$injector"];function kn(){return{restrict:"E",controller:qe,link:(r,e)=>{const n=D()("body");D().fn.modal.Constructor.prototype.enforceFocus=()=>{};let t=new Date().getTime(),a=!0;const l=60*5e3;function u(){a&&n.hasClass("page-dashboard")&&new Date().getTime()-t>l&&(a=!1,n.addClass("view-mode--inactive"))}function m(){t=new Date().getTime(),a||(a=!0,n.removeClass("view-mode--inactive"))}n.mousemove(m),n.keydown(m),document.addEventListener("wheel",m,{capture:!0,passive:!0}),document.addEventListener("visibilitychange",m),setInterval(u,2e3),n.click(y=>{const v=D()(y.target);if(v.parents().length===0)return;n.find(".dropdown-menu-open").removeClass("dropdown-menu-open");const L=v.closest("[data-click-hide]");if(L.length){const P=L.parent();L.detach(),setTimeout(()=>{P.append(L)},100)}const f=e.find(".popover");f.length>0&&v.parents(".graph-legend").length===0&&f.hide()})}}}o.Ay.directive("grafanaApp",kn);var ur=i(23345),hr=i(26415),dr=i(74526),Ln=i(72574),On=i(89191),In=i(16233),Rn=i(17493),Nn=i(74856),Fn=i(94429),Un=i(5808),_e=i(12131);class zn{constructor(){this.$get=()=>{},(0,_e.Lc)("Patch angular",!1,"RouteParamsProvider")}}class Wn{constructor(){(0,_e.Lc)("Patch angular",!1,"RouteProvider")}$get(){return this}}var Bn=i(4244);const Vn=()=>{o.m7.config(["$provide",r=>{r.decorator("$browser",["$delegate",e=>(e.onUrlChange=()=>{},e.url=()=>"",e)])}])},Hn=()=>{o.m7.config(["$provide",r=>{r.decorator("$location",["$delegate",e=>(e=new Bn.b,e)])}]),o.m7.provider("$route",Wn),o.m7.provider("$routeParams",zn)};function jn(){Vn(),Hn()}function Qn(r){r.oldInvoke=r.invoke,r.invoke=(e,n,t,a)=>{const l=t?.$scope?.$parent;return l&&(l.panel&&(n.panel=l.panel),l.dashboard&&(n.dashboard=l.dashboard),l.ctrl?.target&&(n.panelCtrl=l.ctrl,n.datasource=l.ctrl.datasource,n.target=l.ctrl.target),l.ctrl?.datasourceMeta&&(n.meta=l.ctrl.datasourceMeta,n.current=l.ctrl.current),l.ctrl?.currentAnnotation&&(n.annotation=l.ctrl.currentAnnotation,n.datasource=l.ctrl.currentDatasource),l.isAppConfigCtrl&&(n.appEditCtrl=l.ctrl,n.appModel=l.ctrl.model),l.$parent?.$parent?.ctrl?.appModel&&(n.appModel=l.$parent?.$parent?.ctrl?.appModel)),r.oldInvoke(e,n,t,a)}}var Kn=i(39741),Gn=i(18226),et=i(14792);function Xn(r){return function(n){const t=(0,U.useRef)(null),a=(0,U.useRef)(),l=(0,U.useRef)();return(0,U.useEffect)(()=>{if(!t.current)return;const u=(0,Ze.E)(),m='
',y=new Yn,v=new Jn(r,n,y);a.current={panel:v,dashboard:(0,et.UA)().getCurrent(),size:{width:n.width,height:n.height},queryRunner:y},l.current=u.load(t.current,a.current,m)},[]),(0,U.useEffect)(()=>{l.current&&(a.current.size.height=n.height,a.current.size.width=n.width,a.current.panel.events.publish(new s.XM))},[n.width,n.height]),(0,U.useEffect)(()=>{a.current?.panel&&a.current.queryRunner.forwardNewData(n.data)},[n.data]),U.createElement("div",{ref:t,className:"panel-height-helper"})}}class Jn{constructor(e,n,t){n.options.angularOptions&&Object.assign(this,n.options.angularOptions),this.id=n.id,this.type=e.meta.id,this.title=n.title,this.fieldConfig=n.fieldConfig,this.options=n.options,this.plugin=e,this.events=new Gn.o,this.queryRunner=t}refresh(){this.events.publish(new k._)}render(){this.events.publish(new s.XM)}getQueryRunner(){return this.queryRunner}}class Yn{constructor(){this.subject=new Kn.m(1)}getData(e){return this.subject}forwardNewData(e){this.subject.next(e)}run(){}}var Zn=i(17172),qn=i(19347),_n=i(10096),er=i(71500),tr=i(6923),Te=i(95344);class nr{constructor(){}init(){Oe.l.subscribe(s.Ps,e=>this.showModal(e.payload)),Oe.l.subscribe(s.aP,this.hideModal.bind(this))}hideModal(){(0,Te.l)("UtilSrv","hideModal",""),this.modalScope&&this.modalScope.dismiss&&this.modalScope.dismiss()}showModal(e){(0,Te.l)("UtilSrv","showModal","publish ShowModalReactEvent")}}var He=i(10154);class rr{clearPromiseCaches(){(0,Te.l)("annotations_srv.ts","clearPromiseCaches","DashboardQueryRunner")}getAnnotations(e){return(0,Te.l)("annotations_srv.ts","getAnnotations","DashboardQueryRunner.getResult"),Promise.resolve({annotations:[],alertState:void 0})}getAlertStates(e){return(0,Te.l)("annotations_srv.ts","getAlertStates","DashboardQueryRunner.getResult"),Promise.resolve(void 0)}getGlobalAnnotations(e){return(0,Te.l)("annotations_srv.ts","getGlobalAnnotations","DashboardQueryRunner.getResult"),Promise.resolve([])}saveAnnotationEvent(e){return(0,Te.l)("annotations_srv.ts","saveAnnotationEvent","api/saveAnnotation"),(0,He.vJ)(e)}updateAnnotationEvent(e){return(0,Te.l)("annotations_srv.ts","updateAnnotationEvent","api/updateAnnotation"),(0,He.rJ)(e)}deleteAnnotationEvent(e){return(0,Te.l)("annotations_srv.ts","deleteAnnotationEvent","api/deleteAnnotation"),(0,He.Xm)(e)}translateQueryResult(e,n){(0,Te.l)("annotations_srv.ts","translateQueryResult","DashboardQueryRunner/utils/translateQueryResult"),e.snapshotData&&(e=(0,g.cloneDeep)(e),delete e.snapshotData);for(const t of n)t.source=e,t.color=e.iconColor,t.type=e.name,t.isRegion=t.timeEnd&&t.time!==t.timeEnd;return n}}function ir(){o.Ay.factory("backendSrv",()=>(0,Zn.AI)()),o.Ay.factory("contextSrv",()=>_n.TP),o.Ay.factory("dashboardSrv",()=>(0,et.UA)()),o.Ay.factory("datasourceSrv",()=>(0,qn.l)()),o.Ay.factory("linkSrv",()=>(0,tr.mQ)()),o.Ay.factory("validationSrv",()=>er.P),o.Ay.service("annotationsSrv",rr),o.Ay.service("utilSrv",nr)}const ar={angular:{...d(),default:d()},"app/core/core_module":{default:o.m7,__useDefault:!0},"app/core/core":{appEvents:Oe.A,contextSrv:In.TP,coreModule:o.m7},"app/plugins/sdk":Un,"app/core/utils/promiseToDigest":{promiseToDigest:We.F}};class or{constructor(){this.preBootModules=[],this.ngModuleDependencies=[],this.registerFunctions={}}init(){const e=d().module("grafana",[]);(0,Ye.f7)(Xn),e.config(["$controllerProvider","$compileProvider","$filterProvider","$httpProvider","$provide","$sceDelegateProvider",(t,a,l,u,m,y)=>{ke.$W.buildInfo.env!=="development"&&a.debugInfoEnabled(!1),u.useApplyAsync(!0),ke.$W.pluginsCDNBaseURL&&y.trustedResourceUrlList(["self",`${ke.$W.pluginsCDNBaseURL}/**`]),this.registerFunctions.controller=t.register,this.registerFunctions.directive=a.directive,this.registerFunctions.factory=m.factory,this.registerFunctions.service=m.service,this.registerFunctions.filter=l.register,m.decorator("$http",["$delegate","$templateCache",(v,L)=>{const f=v.get;return v.get=(P,x)=>(P.match(/\.html$/)&&(L.get(P)||(P+="?v="+new Date().getTime())),f(P,x)),v}])}]),this.ngModuleDependencies=["grafana.core","ngSanitize","grafana","pasvaz.bindonce","react"],o.yF.forEach(t=>{this.useModule(t)}),d().module("grafana.services").service("dashboardLoaderSrv",Rn.Fu),o.m7.factory("timeSrv",()=>(0,Nn.jG)()),o.m7.factory("templateSrv",()=>(0,Ln.w)()),qt(),ir(),jn();const n=(0,Fn.kB)(ar);On.zO.addImportMap({imports:n}),$.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=d().bootstrap(document.getElementById("ngRoot"),this.ngModuleDependencies);return Qn(e),e.invoke(()=>(this.preBootModules.forEach(n=>{(0,g.extend)(n,this.registerFunctions)}),()=>{})),e}}},75519:(A,w,i)=>{"use strict";i.d(w,{F:()=>p});var z=i(2543),I=i.n(z),E=i(39070),S=i(14236),k=i(26272),o=i(70225),s=i(19752);class p extends o.y{constructor(h,d){super(h,d),this.skipDataOnInit=!1,this.dataList=[],this.useDataFrames=!1,this.panelDataObserver={next:B=>{if(this.panelData=B,B.state===E.Gu.Error&&(this.loading=!1,this.processDataError(B.error)),B.state===E.Gu.Loading){this.loading=!0,this.angularDirtyCheck();return}if(B.request){const{timeInfo:Z}=B.request;Z&&(this.timeInfo=Z)}if(B.timeRange&&(this.range=B.timeRange),this.useDataFrames)this.handleDataFrames(B.series);else{const Z=B.series.map(H=>(0,S.w3)(H));this.handleQueryResult({data:Z})}this.angularDirtyCheck()}},this.contextSrv=d.get("contextSrv"),this.datasourceSrv=d.get("datasourceSrv"),this.timeSrv=d.get("timeSrv"),this.templateSrv=d.get("templateSrv"),this.panel.datasource=this.panel.datasource||null,this.events.on(k.ee.refresh,this.onMetricsPanelRefresh.bind(this)),this.events.on(k.ee.panelTeardown,this.onPanelTearDown.bind(this)),this.events.on(k.ee.componentDidMount,this.onMetricsPanelMounted.bind(this))}onMetricsPanelMounted(){const h=this.panel.getQueryRunner();this.querySubscription=h.getData({withTransforms:!0,withFieldConfig:!0}).subscribe(this.panelDataObserver)}onPanelTearDown(){this.querySubscription&&(this.querySubscription.unsubscribe(),this.querySubscription=null)}onMetricsPanelRefresh(){if(!this.otherPanelInFullscreenMode()){if(this.panel.snapshotData){this.updateTimeRange();let h=this.panel.snapshotData;return(0,z.isArray)(h)||(h=h.data),this.panelData={state:E.Gu.Done,series:h,timeRange:this.range},this.$timeout(()=>{this.events.emit(k.ee.dataSnapshotLoad,h)})}return delete this.error,this.loading=!0,this.datasourceSrv.get(this.panel.datasource,this.panel.scopedVars).then(this.issueQueries.bind(this)).catch(h=>{this.processDataError(h)})}}processDataError(h){if(h.cancelled){console.log("Panel request cancelled",h);return}this.error=h.message||"Request Error",h.data&&(h.data.message?this.error=h.data.message:h.data.error&&(this.error=h.data.error)),this.angularDirtyCheck()}angularDirtyCheck(){this.$scope.$root.$$phase||this.$scope.$digest()}updateTimeRange(h){this.datasource=h||this.datasource,this.range=this.timeSrv.timeRange();const d=(0,s.nk)(this.panel,this.range);this.timeInfo=d.timeInfo,this.range=d.timeRange}issueQueries(h){this.updateTimeRange(h),this.datasource=h;const d=this.panel;return d.getQueryRunner().run({datasource:d.datasource,queries:d.targets,panelId:d.id,dashboardUID:this.dashboard.uid,timezone:this.dashboard.getTimezone(),timeInfo:this.timeInfo,timeRange:this.range,maxDataPoints:d.maxDataPoints||this.width,minInterval:d.interval,scopedVars:d.scopedVars,cacheTimeout:d.cacheTimeout,queryCachingTTL:d.queryCachingTTL,transformations:d.transformations})}handleDataFrames(h){this.loading=!1,this.dashboard&&this.dashboard.snapshot&&(this.panel.snapshotData=h.map(d=>(0,S.Kl)(d)));try{this.events.emit(k.ee.dataFramesReceived,h)}catch(d){this.processDataError(d)}}handleQueryResult(h){this.loading=!1,this.dashboard.snapshot&&(this.panel.snapshotData=h.data),(!h||!h.data)&&(console.log("Data source query result invalid, missing data field:",h),h={data:[]});try{this.events.emit(k.ee.dataReceived,h.data)}catch(d){this.processDataError(d)}}}},70225:(A,w,i)=>{"use strict";i.d(w,{y:()=>p});var z=i(2543),I=i.n(z),E=i(18226),S=i(26272),k=i(4244),o=i(2913),s=i(10096);class p{constructor(h,d){this.pluginName="",this.pluginId="",this.editModeInitiated=!1,this.loading=!1,this.onPluginTypeChange=Z=>{},this.panel=this.panel??h.$parent.panel,this.dashboard=this.dashboard??h.$parent.dashboard,this.$injector=d,this.$scope=h,this.$timeout=d.get("$timeout"),this.editorTabs=[],this.$location=new k.b,this.events=new E.o,this.timing={};const B=o.Ay.panels[this.panel.type];B&&(this.pluginId=B.id,this.pluginName=B.name),h.$on(S.ee.componentDidMount.name,()=>this.panelDidMount())}panelDidMount(){this.events.emit(S.ee.componentDidMount),this.events.emit(S.ee.initialized),this.dashboard.panelInitialized(this.panel)}renderingCompleted(){s.Ef.renderingCompleted()}refresh(){this.panel.refresh()}publishAppEvent(h,d){this.$scope.$root.appEvent(h,d)}initEditMode(){this.editModeInitiated||(this.editModeInitiated=!0,this.events.emit(S.ee.editModeInitialized))}addEditorTab(h,d,B,Z){const H={title:h,directiveFn:d,icon:Z};(0,z.isString)(d)&&(H.directiveFn=()=>({templateUrl:d})),B?this.editorTabs.splice(B,0,H):this.editorTabs.push(H)}getExtendedMenu(){const h=[];return this.events.emit(S.ee.initPanelActions,h),h}async getAdditionalMenuItems(){return[]}otherPanelInFullscreenMode(){return this.dashboard.otherPanelInFullscreen(this.panel)}render(h){this.events.emit(S.ee.render,h)}}},59559:(A,w,i)=>{"use strict";i.d(w,{a:()=>E});var z=i(2543),I=i.n(z);class E{constructor(k,o){this.$scope=k,this.$injector=o,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,z.indexOf)(this.panel.targets,this.target)===this.panel.targets.length-1}refresh(){this.panelCtrl.refresh()}}},50410:(A,w,i)=>{"use strict";let z=i(12631);z.keys().forEach(I=>{z(I)})},8678:(A,w,i)=>{"use strict";i.d(w,{F:()=>z});const z=I=>E=>E.finally(I.$evalAsync)},5808:(A,w,i)=>{"use strict";i.r(w),i.d(w,{MetricsPanelCtrl:()=>s,PanelCtrl:()=>o,QueryCtrl:()=>p,loadPluginCss:()=>I.PL});var z=i(92341),I=i(89191),E=i(75519),S=i(70225),k=i(59559);const o=(0,z.Y)(S.y),s=(0,z.Y)(E.F),p=(0,z.Y)(k.a)},42346:()=>{(function(A){"use strict";var w={tagClass:function(o){return"label label-info"},itemValue:function(o){return o&&o.toString()},itemText:function(o){return this.itemValue(o)},freeInput:!0,maxTags:void 0,confirmKeys:[13],onTagExists:function(o,s){s.hide().fadeIn()}};function i(o,s){this.itemsArray=[],this.$element=A(o),this.$element.hide(),this.widthClass=s.widthClass||"width-9",this.isSelect=o.tagName==="SELECT",this.multiple=this.isSelect&&o.hasAttribute("multiple"),this.objectItems=s&&s.itemValue,this.placeholderText=o.hasAttribute("placeholder")?this.$element.attr("placeholder"):"",this.$container=A('
'),this.$input=A('
').appendTo(this.$container),this.$element.after(this.$container),this.build(s)}i.prototype={constructor:i,add:function(o,s){var p=this;if(!(p.options.maxTags&&p.itemsArray.length>=p.options.maxTags)&&!(o!==!1&&!o)){if(typeof o=="object"&&!p.objectItems)throw"Can't add objects when itemValue option is not set";if(!o.toString().match(/^\s*$/)){if(p.isSelect&&!p.multiple&&p.itemsArray.length>0&&p.remove(p.itemsArray[0]),typeof o=="string"&&this.$element[0].tagName==="INPUT"){var c=o.split(",");if(c.length>1){for(var h=0;h
'+S(B)+'');if(R.data("item",o),p.findInputWrapper().before(R),R.after(" "),p.isSelect&&!A('option[value="'+escape(d)+'"]',p.$element)[0]){var j=A("");j.data("item",o),j.attr("value",d),p.$element.append(j)}s||p.pushVal(),p.options.maxTags===p.itemsArray.length&&p.$container.addClass("bootstrap-tagsinput-max"),p.$element.trigger(A.Event("itemAdded",{item:o}))}}},remove:function(o,s){var p=this;p.objectItems&&(typeof o=="object"?o=A.grep(p.itemsArray,function(c){return p.options.itemValue(c)==p.options.itemValue(o)})[0]:o=A.grep(p.itemsArray,function(c){return p.options.itemValue(c)==o})[0]),o&&(A(".tag",p.$container).filter(function(){return A(this).data("item")===o}).remove(),A("option",p.$element).filter(function(){return A(this).data("item")===o}).remove(),p.itemsArray.splice(A.inArray(o,p.itemsArray),1)),s||p.pushVal(),p.options.maxTags>p.itemsArray.length&&p.$container.removeClass("bootstrap-tagsinput-max"),p.$element.trigger(A.Event("itemRemoved",{item:o}))},removeAll:function(){var o=this;for(A(".tag",o.$container).remove(),A("option",o.$element).remove();o.itemsArray.length>0;)o.itemsArray.pop();o.pushVal(),o.options.maxTags&&!this.isEnabled()&&this.enable()},refresh:function(){var o=this;A(".tag",o.$container).each(function(){var s=A(this),p=s.data("item"),c=o.options.itemValue(p),h=o.options.itemText(p),d=o.options.tagClass(p);if(s.attr("class",null),s.addClass("tag "+S(d)),s.contents().filter(function(){return this.nodeType==3})[0].nodeValue=S(h),o.isSelect){var B=A("option",o.$element).filter(function(){return A(this).data("item")===p});B.attr("value",c)}})},items:function(){return this.itemsArray},pushVal:function(){var o=this,s=A.map(o.items(),function(p){return o.options.itemValue(p).toString()});o.$element.val(s,!0).trigger("change")},build:function(o){var s=this;s.options=A.extend({},w,o);var p=s.options.typeahead||{};s.objectItems&&(s.options.freeInput=!1),z(s.options,"itemValue"),z(s.options,"itemText"),z(s.options,"tagClass"),s.options.source&&(p.source=s.options.source),p.source&&A.fn.typeahead&&(I(p,"source"),s.$input.typeahead({source:function(c,h){function d(H){for(var q=[],R=0;R$1")}})),s.$container.on("click",A.proxy(function(c){s.$input.focus()},s)),s.$container.on("blur","input",A.proxy(function(c){var h=A(c.target);s.add(h.val()),h.val(""),c.preventDefault()},s)),s.$container.on("keydown","input",A.proxy(function(c){var h=A(c.target),d=s.findInputWrapper();switch(c.which){case 8:if(k(h[0])===0){var B=d.prev();B&&s.remove(B.data("item"))}break;case 46:if(k(h[0])===0){var Z=d.next();Z&&s.remove(Z.data("item"))}break;case 37:var H=d.prev();h.val().length===0&&H[0]&&(H.before(d),h.focus());break;case 39:var q=d.next();h.val().length===0&&q[0]&&(q.after(d),h.focus());break;default:s.options.freeInput&&A.inArray(c.which,s.options.confirmKeys)>=0&&(s.add(h.val()),h.val(""),c.preventDefault())}h.attr("size",Math.max(this.inputSize,h.val().length))},s)),s.$container.on("click","[data-role=remove]",A.proxy(function(c){s.remove(A(c.target).closest(".tag").data("item")),c.stopPropagation()},s)),s.options.itemValue===w.itemValue&&(s.$element[0].tagName==="INPUT"?s.add(s.$element.val()):A("option",s.$element).each(function(){s.add(A(this).attr("value"),!0)}))},destroy:function(){var o=this;o.$container.off("keypress","input"),o.$container.off("click","[role=remove]"),o.$container.remove(),o.$element.removeData("tagsinput"),o.$element.show()},focus:function(){this.$input.focus()},input:function(){return this.$input},findInputWrapper:function(){for(var o=this.$input[0],s=this.$container[0];o&&o.parentNode!==s;)o=o.parentNode;return A(o)}},A.fn.tagsinput=function(o,s){var p=[];return this.each(function(){var c=A(this).data("tagsinput");if(!c)c=new i(this,o),A(this).data("tagsinput",c),p.push(c),this.tagName==="SELECT"&&A("option",A(this)).attr("selected","selected"),A(this).val(A(this).val());else{var h=c[o](s);h!==void 0&&p.push(h)}}),typeof o=="string"?p.length>1?p:p[0]:p},A.fn.tagsinput.Constructor=i;function z(o,s){if(typeof o[s]!="function"){var p=o[s];o[s]=function(c){return c[p]}}}function I(o,s){if(typeof o[s]!="function"){var p=o[s];o[s]=function(){return p}}}var E=A("");function S(o){return o?E.text(o).html():""}function k(o){var s=0;if(document.selection){o.focus();var p=document.selection.createRange();p.moveStart("character",-o.value.length),s=p.text.length}else(o.selectionStart||o.selectionStart=="0")&&(s=o.selectionStart);return s}A(function(){A("input[data-role=tagsinput], select[multiple][data-role=tagsinput]").tagsinput()})})(window.jQuery)}}]);
//# sourceMappingURL=1133.cd705902767ed2e9bf55.js.map