"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[7466],{47466(m,c,t){t.d(c,{fieldLookupTransformer:()=>P});var g=t(65474),E=t(69862),p=t(69192),M=t(19560),O=t(35831),i=t(33143);const P={id:M.F.fieldLookup,name:"Lookup fields from resource",description:"Use a field value to lookup countries, states, or airports.",defaultOptions:{},operator:a=>e=>e.pipe((0,E.Z)(r=>(0,g.H)(v(r,a))))};async function v(a,e){const r=p.sJ.get(O.Ct.byName).get(e?.lookupField),o=await(0,i.q3)(e?.gazetteer??i.jt.countries.path);return o.frame?D(a,o,r):Promise.reject("missing frame in gazetteer")}function D(a,e,r){const o=e.frame()?.fields;return o?a.map(f=>{const h=f.length,u=[];for(const d of f.fields)if(u.push(d),r(d,f,a)){const L=d.values,_=[];for(const n of o){const s=new Array(h);_.push(s),u.push({...n,values:s})}for(let n=0;n<e.count;n++){const s=e.find(L[n]);if(s?.index!=null)for(let l=0;l<o.length;l++)_[l][n]=o[l].values[s.index]}}return{...f,fields:u}}):a}}}]);

//# sourceMappingURL=7466.f1b8a55e62b8c2b4683c.js.map