"use strict";(self.webpackChunkgrafana_lokiexplore_app=self.webpackChunkgrafana_lokiexplore_app||[]).push([[398],{25398:(e,r,n)=>{n.d(r,{O7:()=>v,jj:()=>b,g:()=>h,ev:()=>w});var t=n(77909),a=n(75561),o=n(18531);const i={experiment_fake_flag:null};class u{after(e,r){v[e.flagKey]&&(i[v[e.flagKey]]=r.value)}constructor(){}}var l=n(25953);function c(e,r,n,t,a,o,i){try{var u=e[o](i),l=u.value}catch(e){return void n(e)}u.done?r(l):Promise.resolve(l).then(t,a)}function s(e){return function(){var r=this,n=arguments;return new Promise(function(t,a){var o=e.apply(r,n);function i(e){c(o,t,a,i,u,"next",e)}function u(e){c(o,t,a,i,u,"throw",e)}i(void 0)})}}function f(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}const g={exploreLogsAggregatedMetrics:{valueType:"boolean",value:!1,reason:"static provider evaluation result",variant:"default"},"drilldown.logs.fake_flag":{valueType:"string",values:["treatment","control","excluded"],defaultValue:"excluded",trackingKey:"experiment_fake_flag"}},p=(d=g,Object.keys(d));var d;const v=Object.fromEntries(p.reduce((e,r)=>{const n=g[r];return"trackingKey"in n&&e.push([r,n.trackingKey]),e},[])),m="logs-drilldown",y=new Map;function b(e){if(y.has(e))return y.get(e);const r=g[e];return"value"in r?r.value:r.defaultValue}function w(){return s(function*(){yield Promise.all(p.map(e=>s(function*(){const r=yield function(e){return s(function*(){try{const r=a.B0.getClient(m);yield function(e){if(e.providerStatus===a.$l.READY)return Promise.resolve();if(e.providerStatus===a.$l.ERROR||e.providerStatus===a.$l.FATAL)return Promise.reject(new Error("OpenFeature provider failed to initialize"));return new Promise((r,n)=>{e.addHandler(a.Nm.Ready,()=>r()),e.addHandler(a.Nm.Error,()=>n(new Error("OpenFeature provider error")))})}(r),r.addHooks(new u);const n=g[e],t=k(n);switch(n.valueType){case"boolean":return r.getBooleanValue(e,t);case"number":return r.getNumberValue(e,t);case"object":return r.getObjectValue(e,t);case"string":return r.getStringValue(e,t);default:throw new Error(`Invalid flag value type for flag ${e}`)}}catch(r){l.v.error(new Error(`Error evaluating ${e} flag.`,{cause:r}));const n=function(e){if("exploreLogsAggregatedMetrics"===e)return o.config.featureToggles.exploreLogsAggregatedMetrics;return}(e);if(void 0!==n)return n;return k(g[e])}})()}(e);y.set(e,r)})()))})()}function h(){return a.B0.setProviderAndWait(m,new t.S({baseUrl:`/apis/features.grafana.app/v0alpha1/namespaces/${o.config.namespace}`,pollInterval:-1,timeoutMs:1e4}),function(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{},t=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.forEach(function(r){f(e,r,n[r])})}return e}({targetingKey:o.config.namespace,namespace:o.config.namespace},o.config.openFeatureContext)).catch(e=>{l.v.warn("OpenFeature provider initialization failed, using config.featureToggles fallback",{error:e instanceof Error?e.message:String(e)})})}function k(e){return"value"in e?e.value:e.defaultValue}}}]);
//# sourceMappingURL=398.js.map?_cache=cca4721c740ebcc5e08e