"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[9137],{9137(C,F,l){l.d(F,{RegressionTransformerEditor:()=>M});var t=l(14553),f=l(55501),i=l(52358),x=l(78364),N=l(72480),c=l(12592),T=l(38758),h=l(69192),v=l(35831),o=l(28805);const j=()=>[{label:(0,i.t)("transformers.regression-transformer-editor.model-type-options.label.linear","Linear"),value:o.e3.linear},{label:(0,i.t)("transformers.regression-transformer-editor.model-type-options.label.polynomial","Polynomial"),value:o.e3.polynomial}],b={editor:c.O,id:"",name:"",settings:{width:24,isClearable:!1}},p=20,g={firstTimeMatcher:h.sJ.get(v.Ct.firstTimeField).get({}),numericMatcher:h.sJ.get(v.Ct.numeric).get({})},u=(s,e,a)=>{for(const d of s){const m=d.fields.find(r=>e(r,d,s)&&r!==a);if(m)return m}},M=({input:s,options:e,onChange:a})=>{const d=(0,f.useMemo)(()=>j(),[]),m=(0,f.useMemo)(()=>o.iR.map(r=>({label:r.label(),value:r.value})),[]);return(0,f.useEffect)(()=>{let r,y;e.xFieldName&&e.yFieldName||(e.xFieldName||(r=u(s,g.firstTimeMatcher)||u(s,g.numericMatcher)),e.yFieldName||(y=u(s,g.numericMatcher,r)),r&&y&&a({...e,xFieldName:r.name,yFieldName:y.name}))},[s,e,a]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n,{label:(0,i.t)("transformers.regression-transformer-editor.label-x-field","X field"),children:(0,t.jsx)(c.O,{context:{data:s},value:e.xFieldName??"",item:b,onChange:r=>a({...e,xFieldName:r})})}),(0,t.jsx)(n,{label:(0,i.t)("transformers.regression-transformer-editor.label-y-field","Y field"),children:(0,t.jsx)(c.O,{context:{data:s},value:e.yFieldName??"",item:b,onChange:r=>a({...e,yFieldName:r})})}),(0,t.jsx)(n,{label:(0,i.t)("transformers.regression-transformer-editor.label-model-type","Model type"),children:(0,t.jsx)(x.G,{value:e.modelType??o.zY.modelType,onChange:r=>a({...e,modelType:r.value??o.zY.modelType}),options:d})}),(0,t.jsx)(n,{label:(0,i.t)("transformers.regression-transformer-editor.label-predicted-points","Predicted points"),tooltip:(0,i.t)("transformers.regression-transformer-editor.tooltip-number-of-xy-points-to-predict","Number of X,Y points to predict"),children:(0,t.jsx)(T.Q,{value:e.predictionCount??o.zY.predictionCount,onChange:r=>a({...e,predictionCount:r})})}),e.modelType===o.e3.polynomial&&(0,t.jsx)(n,{label:(0,i.t)("transformers.regression-transformer-editor.label-degree","Degree"),tooltip:(0,i.t)("transformers.regression-transformer-editor.tooltip-high-degree-polynomial","Higher-degree polynomials (e.g., degree 4 or higher) can result in misleading trends and unstable fits. Proceed with caution."),children:(0,t.jsx)(x.G,{value:e.degree??o.zY.degree,options:m,onChange:r=>a({...e,degree:Number(r.value)})})})]})},n=({label:s,tooltip:e,children:a})=>(0,t.jsx)(N.I,{labelWidth:p,label:s,tooltip:e,children:a})}}]);

//# sourceMappingURL=9137-react19.c02a26e5869ed01e4e75.js.map