(window.webpackJsonp=window.webpackJsonp||[]).push([[82],{CaV2:function(e,t,r){"use strict";r.r(t);var a=r("LvDl"),s=r("F/XL"),n=r("0/uQ"),o=r("VNr4"),c=r("psW0"),i=r("67Y/"),u=r("9Z1F"),d=r("Zn8D"),p=r("Obii"),b=r("t8hP");function g(){return(g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}class O extends p.DataSourceApi{constructor(e){super(e)}query(e){const t=e.targets.filter(e=>"-- Mixed --"!==e.datasource);if(!t.length)return Object(s.a)({data:[]});const r=Object(a.groupBy)(t,"datasource"),n=[];for(const t in r){const a=r[t],s=a[0].datasource;n.push({datasource:Object(b.getDataSourceSrv)().get(s,e.scopedVars),targets:a})}return this.batchQueries(n,e)}batchQueries(e,t){const r=e.filter(this.isQueryable).map((e,r)=>Object(n.a)(e.datasource).pipe(Object(c.b)(o=>{const c=Object(a.cloneDeep)(t);return c.requestId=`mixed-${r}-${c.requestId||""}`,c.targets=e.targets,Object(n.a)(o.query(c)).pipe(Object(i.a)(e=>g({},e,{data:e.data||[],state:p.LoadingState.Loading,key:`mixed-${r}-${e.key||""}`})),Object(u.a)(e=>((e=Object(b.toDataQueryError)(e)).message=`${o.name}: ${e.message}`,Object(s.a)({data:[],state:p.LoadingState.Error,error:e,key:`mixed-${r}-${c.requestId||""}`}))))})));return Object(o.a)(r).pipe(Object(i.a)(this.finalizeResponses),Object(d.a)())}testDatasource(){return Promise.resolve({})}isQueryable(e){return e&&Array.isArray(e.targets)&&e.targets.length>0}finalizeResponses(e){const{length:t}=e;if(0===t)return e;const r=e.find(e=>e.state===p.LoadingState.Error);return r?e.push(r):e[t-1].state=p.LoadingState.Done,e}}r.d(t,"MixedDatasource",(function(){return O})),r.d(t,"Datasource",(function(){return O}))}}]);
//# sourceMappingURL=mixedPlugin.4bfd7b0ee99616560b7a.js.map