"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[2666],{32930(p,c,e){e.d(c,{O:()=>a});var C=e(87228);const a=(y,o,f,v,F)=>{const x=[];if(o.state?.scopedVars){const m=new Set;(0,C.ko)(y,o,o.state.scopedVars,f,o.config.actions??[],{valueRowIndex:v},F).forEach(g=>{const h=`${g.title}`;m.has(h)||(x.push(g),m.add(h))})}return x}},14474(p,c,e){e.r(c),e.d(c,{plugin:()=>H});var C=e(45468),a=e(17727),y=e(15283),o=e(52358),f=e(28520),v=e(6980),F=e(8538),x=e(50467),m=e(87452),r=e(14553),g=e(55501),h=e(60642),A=e(69192),E=e(35831),R=e(47018),U=e(14707),I=e(96887),T=e(53151),D=e(47172),G=e(23817),L=e(10045),V=e(26746),W=e(63075),B=e(47468),X=e(97521);function M(n,i){if(n.length>1)return{warning:"Only one frame is supported, consider adding a join transformation",frames:n};let t;if(i){if(t=(0,B.gG)(i,n[0]),t==null)return{warning:"Unable to find field: "+i,frames:n}}else if(t=n[0]?n[0].fields.findIndex(l=>l.type===a.PU.number):-1,t===-1)return{warning:"No numeric fields found for X axis",frames:n};if(t!=null){const l=n[0].fields[t];if(l.type===a.PU.number&&!(0,V.g2)(l.values))return{warning:"Values must be in ascending order",frames:n}}return{frames:(0,X.B_)(n,W.Ay.theme2,void 0,t)}}const Z=({data:n,timeRange:i,timeZone:t,width:l,height:$,options:s,fieldConfig:K,replaceVariables:N,id:J})=>{const{dataLinkPostProcessor:Q}=(0,h.Cq)(),{canExecuteActions:O}=(0,U.d2)(),z=(0,g.useMemo)(()=>O?.()??!1,[O]),Y=s.xField??n.series[0]?.fields.find(d=>d.type===a.PU.number)?.name,w=(d,u,S)=>(u={...u,x:A.sJ.get(E.Ct.byName).get(Y)},(0,D.m)(d,u)),P=(0,g.useMemo)(()=>M(n.series,s.xField),[n.series,s.xField]);return P.warning||!P.frames?(0,r.jsx)(R.a,{panelId:J,fieldConfig:K,data:n,message:P.warning,needsNumberField:!0}):(0,r.jsx)(G.Z,{frames:P.frames,structureRev:n.structureRev,timeRange:i,timeZone:t,width:l,height:$,legend:s.legend,options:s,preparePlotFrame:w,replaceVariables:N,dataLinkPostProcessor:Q,children:(d,u)=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(I.Z,{config:d}),s.tooltip.mode!==f.$N.None&&(0,r.jsx)(T.xl,{config:d,hoverMode:s.tooltip.mode===f.$N.Single?T.b3.xOne:T.b3.xAll,getDataLinks:(S,j)=>u.fields[S].getLinks?.({valueRowIndex:j})??[],render:(S,j,b,k=!1,_,ee,ne,q)=>(0,r.jsx)(L.k,{series:u,dataIdxs:j,seriesIdx:b,mode:s.tooltip.mode,sortOrder:s.tooltip.sort,isPinned:k,maxHeight:s.tooltip.maxHeight,replaceVariables:N,dataLinks:q,hideZeros:s.tooltip.hideZeros,canExecuteActions:z}),maxWidth:s.tooltip.maxWidth})]})})},H=new C.m(Z).useFieldConfig((0,m.V)(m.S,!1)).setPanelOptions(n=>{const i=[(0,o.t)("trend.category-x-axis","X axis")];n.addFieldNamePicker({path:"xField",name:(0,o.t)("trend.name-x-field","X field"),description:(0,o.t)("trend.description-x-field","An increasing numeric value"),category:i,defaultValue:void 0,settings:{isClearable:!0,placeholderText:(0,o.t)("trend.placeholder-x-field","First numeric value"),filter:t=>t.type===a.PU.number}}),v.D(n,!1,!0,v.U),F.H(n,!0,!0)}).setSuggestionsSupplier(n=>{if(!n.rawFrames||n.fieldCountByType(a.PU.number)<2||n.rowCountTotal<2||n.rowCountTotal<2||n.frameCount>1)return;const i=M(n.rawFrames);if(!(i.warning||!i.frames))return[{score:y.nQ.Good,fieldConfig:{defaults:{custom:{}},overrides:[]},cardOptions:{previewModifier:t=>{t.options.legend=x.PI,t.fieldConfig?.defaults.custom?.drawStyle!==f.GR.Bars&&(t.fieldConfig.defaults.custom.lineWidth=Math.max(t.fieldConfig.defaults.custom.lineWidth??1,2))}}}]})}}]);

//# sourceMappingURL=trendPanel-react19.d237e953e6b678b13f04.js.map