define(["@grafana/data","react","jquery","@grafana/ui"],((e,t,r,a)=>(()=>{"use strict";var o={7781:t=>{t.exports=e},2007:e=>{e.exports=a},4846:e=>{e.exports=r},5959:e=>{e.exports=t}},n={};function l(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,l),r.exports}l.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return l.d(t,{a:t}),t},l.d=(e,t)=>{for(var r in t)l.o(t,r)&&!l.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},l.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{l.r(i),l.d(i,{plugin:()=>z});var e=l(7781),t=l(5959),r=l.n(t),a=l(4846),o=l.n(a),n=l(2007);const u={label:"Vertical",value:1},c={label:"Horizontal",value:2},d={label:"Acknowledged",value:1},s={label:"Severity",value:2},f={index:0,label:"Outstanding",value:void 0},v={index:1,label:"Acknowledged",value:!0},p=0,b="Cleared",g="CLEARED",m=1,y="Normal",O="NORMAL",h=2,E="Indeterm.",P="INDETERMINATE",x=3,C="Warning",j="WARNING",w=4,S="Minor",A="MINOR",D=5,M="Major",R="MAJOR",k=6,I="Critical",N="CRITICAL";function G(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),a.forEach((function(t){G(e,t,r[t])}))}return e}const T=({value:e,onChange:t})=>r().createElement("div",null,r().createElement(n.Select,{options:[B({},d),B({},s)],value:e,onChange:e=>t(e.value)}));function W(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function L(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),a.forEach((function(t){W(e,t,r[t])}))}return e}const _=({value:e,onChange:t})=>r().createElement("div",null,r().createElement(n.Select,{options:[L({},u),L({},c)],value:e,onChange:e=>t(e.value)})),z=new e.PanelPlugin((({options:e,data:a,width:l,height:i})=>{const{getPlotConfig:u,getPlotData:s,ref:G}=(()=>{const e=(0,t.useRef)(),r=(e,t,r)=>e===c.value?[t,r]:[r,t],a=(e,t,r,a=!1)=>{const o=((e,t)=>t.series.map((t=>{var r;return null===(r=t.fields.find((t=>t.name===e)))||void 0===r?void 0:r.values.toArray()})))(e,r);let n=0;for(let e of o)if(e)for(let r of e)(r===t||a&&r)&&(n+=1);return n},o=e=>e===d.value?[[v.index,v.label],[f.index,f.label]]:[[p,b],[m,y],[h,E],[x,C],[w,S],[D,M],[k,I]];return{getPlotData:(e,t,o)=>e===d.value?((e,t)=>{const o="Acked By",l=[a(o,f.value,t),a(o,v.value,t,!0)];return[{data:[r(e,l[0],f.index)],color:n.colors[0]},{data:[r(e,l[1],v.index)],color:n.colors[4]}]})(t,o):((e,t)=>{const o="Severity",n=[a(o,g,t),a(o,O,t),a(o,P,t),a(o,j,t),a(o,A,t),a(o,R,t),a(o,N,t)];return[{data:[r(e,n[0],p)],color:"#EEE000"},{data:[r(e,n[1],m)],color:"#86B15B"},{data:[r(e,n[2],h)],color:"#990000"},{data:[r(e,n[3],x)],color:"#FCCC3B"},{data:[r(e,n[4],w)],color:"#EE901C"},{data:[r(e,n[5],D)],color:"#E3692F"},{data:[r(e,n[6],k)],color:"#DB4345"}]})(t,o),getPlotConfig:(e,t)=>{const r=c.value===t?"yaxis":"xaxis";return{series:{bars:{show:!0,barWidth:t===c.value?.5:.6,align:"center",fill:.8,lineWidth:1,horizontal:t===c.value}},[r]:{mode:"categories",tickLength:0,autoscaleMargin:.02,ticks:o(e)},grid:{borderWidth:0}}},ref:e}})();return(0,t.useEffect)((()=>{const t=s(e.alarmGroup,e.alarmDirection,a),r=u(e.alarmGroup,e.alarmDirection);o().plot(G.current,t,r)}),[a,e.alarmGroup,l,i,e.alarmDirection,u,s,G]),r().createElement("div",{ref:G,style:{width:l,height:i}})})).setPanelOptions((e=>{e.addCustomEditor({id:"alarm-group",path:"alarmGroup",name:"Alarm Group",editor:T}),e.addCustomEditor({id:"alarm-direction",path:"alarmDirection",name:"Alarm Direction",editor:_})}))})(),i})()));
//# sourceMappingURL=module.js.map