@perses-dev/prometheus-plugin 0.51.0-rc.1 → 0.51.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/__mf/js/{622.d6ff9685.js → 622.893bb954.js} +1 -1
  2. package/__mf/js/{Prometheus.bee3ab4b.js → Prometheus.bafb3562.js} +3 -3
  3. package/__mf/js/async/212.bd5d617a.js +1 -0
  4. package/__mf/js/async/3057.e568f9b6.js +7 -0
  5. package/__mf/js/async/{1407.a7511546.js.LICENSE.txt → 3057.e568f9b6.js.LICENSE.txt} +1 -17
  6. package/__mf/js/async/3090.9fb5fe73.js +2 -0
  7. package/__mf/js/async/3818.dde21d04.js +1 -0
  8. package/__mf/js/async/3980.7cea5715.js +2 -0
  9. package/__mf/js/async/{6333.865a46e0.js.LICENSE.txt → 3980.7cea5715.js.LICENSE.txt} +2 -2
  10. package/__mf/js/async/{4421.d4715b5f.js → 4421.42e889f6.js} +1 -1
  11. package/__mf/js/async/528.d364bb0e.js +1 -0
  12. package/__mf/js/async/{5345.05718f02.js → 5345.2e531d76.js} +1 -1
  13. package/__mf/js/async/537.6911ea2e.js +1 -0
  14. package/__mf/js/async/5503.7c0ff0ee.js +1 -0
  15. package/__mf/js/async/5913.4e5abd09.js +73 -0
  16. package/__mf/js/async/684.ca510333.js +1 -0
  17. package/__mf/js/async/8587.4891ea90.js +1 -0
  18. package/__mf/js/async/__federation_expose_PrometheusDatasource.f9c8cf41.js +1 -0
  19. package/__mf/js/async/__federation_expose_PrometheusExplorer.f3fe63da.js +1 -0
  20. package/__mf/js/async/{__federation_expose_PrometheusLabelNamesVariable.93231b2e.js → __federation_expose_PrometheusLabelNamesVariable.873e5f4d.js} +1 -1
  21. package/__mf/js/async/{__federation_expose_PrometheusLabelValuesVariable.f216888c.js → __federation_expose_PrometheusLabelValuesVariable.6696e340.js} +1 -1
  22. package/__mf/js/async/{__federation_expose_PrometheusPromQLVariable.0060ab26.js → __federation_expose_PrometheusPromQLVariable.ab45c7cc.js} +1 -1
  23. package/__mf/js/async/{__federation_expose_PrometheusTimeSeriesQuery.4e934fa1.js → __federation_expose_PrometheusTimeSeriesQuery.66611c9d.js} +1 -1
  24. package/__mf/js/main.04881e62.js +1 -0
  25. package/mf-manifest.json +189 -254
  26. package/mf-stats.json +191 -256
  27. package/package.json +7 -7
  28. package/__mf/css/async/8909.dacad691.css +0 -1
  29. package/__mf/css/async/9263.dacad691.css +0 -1
  30. package/__mf/js/async/1407.a7511546.js +0 -7
  31. package/__mf/js/async/1742.c468cb18.js +0 -1
  32. package/__mf/js/async/1959.ad668ff3.js +0 -23
  33. package/__mf/js/async/2292.37cc6c8f.js +0 -2
  34. package/__mf/js/async/232.f3523a60.js +0 -1
  35. package/__mf/js/async/2581.7c85a457.js +0 -1
  36. package/__mf/js/async/2641.1cd3c706.js +0 -1
  37. package/__mf/js/async/4425.4a89f3b8.js +0 -1
  38. package/__mf/js/async/4659.c56181df.js +0 -1
  39. package/__mf/js/async/4665.70feb200.js +0 -1
  40. package/__mf/js/async/4800.e23c630f.js +0 -1
  41. package/__mf/js/async/5409.d646c006.js +0 -1
  42. package/__mf/js/async/5913.c7536be1.js +0 -73
  43. package/__mf/js/async/6333.865a46e0.js +0 -2
  44. package/__mf/js/async/6386.d92b974a.js +0 -1
  45. package/__mf/js/async/6712.341e962a.js +0 -1
  46. package/__mf/js/async/7488.e0afae27.js +0 -23
  47. package/__mf/js/async/8909.a5d96930.js +0 -1
  48. package/__mf/js/async/9216.7a78af54.js +0 -1
  49. package/__mf/js/async/9263.2c4799b2.js +0 -1
  50. package/__mf/js/async/9611.58220d82.js +0 -1
  51. package/__mf/js/async/__federation_expose_PrometheusDatasource.19952f82.js +0 -1
  52. package/__mf/js/async/__federation_expose_PrometheusExplorer.035ddd24.js +0 -1
  53. package/__mf/js/main.8b69f3f7.js +0 -1
  54. /package/__mf/js/async/{2292.37cc6c8f.js.LICENSE.txt → 3090.9fb5fe73.js.LICENSE.txt} +0 -0
  55. /package/__mf/js/async/{5913.c7536be1.js.LICENSE.txt → 5913.4e5abd09.js.LICENSE.txt} +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkPrometheus=self.webpackChunkPrometheus||[]).push([["232"],{40150:function(t,e,s){s.r(e),s.d(e,{useIsRestoring:()=>tv,dataTagErrorSymbol:()=>tc,QueryClientProvider:()=>tm,matchQuery:()=>c,useSuspenseQuery:()=>tU,QueryClientContext:()=>tp,IsRestoringProvider:()=>tg,Mutation:()=>K,usePrefetchInfiniteQuery:()=>tL,replaceEqualDeep:()=>y,useSuspenseQueries:()=>tK,defaultShouldDehydrateQuery:()=>ti,notifyManager:()=>T,useInfiniteQuery:()=>tX,matchMutation:()=>l,unsetMarker:()=>tl,MutationObserver:()=>te,useMutationState:()=>tJ,defaultShouldDehydrateMutation:()=>tr,Query:()=>A,dataTagSymbol:()=>th,HydrationBoundary:()=>tz,onlineManager:()=>P,useQueries:()=>tT,hydrate:()=>tu,skipToken:()=>S,experimental_streamedQuery:()=>to,dehydrate:()=>ta,QueryCache:()=>j,QueryClient:()=>B,CancelledError:()=>F,isCancelledError:()=>x,usePrefetchQuery:()=>tH,QueryObserver:()=>W,focusManager:()=>q,keepPreviousData:()=>R,useQueryErrorResetBoundary:()=>tC,useMutation:()=>tV,useSuspenseInfiniteQuery:()=>tj,useIsFetching:()=>tB,QueryErrorResetBoundary:()=>tQ,hashKey:()=>f,infiniteQueryOptions:()=>tG,useIsMutating:()=>tW,useQueryClient:()=>ty,InfiniteQueryObserver:()=>tt,useQuery:()=>tA,isServer:()=>i,MutationCache:()=>L,QueriesObserver:()=>Z,queryOptions:()=>t_});var r=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},i="undefined"==typeof window||"Deno"in globalThis;function n(){}function a(t){return"number"==typeof t&&t>=0&&t!==1/0}function u(t,e){return Math.max(t+(e||0)-Date.now(),0)}function o(t,e){return"function"==typeof t?t(e):t}function h(t,e){return"function"==typeof t?t(e):t}function c(t,e){let{type:s="all",exact:r,fetchStatus:i,predicate:n,queryKey:a,stale:u}=t;if(a){if(r){if(e.queryHash!==d(a,e.options))return!1}else if(!p(e.queryKey,a))return!1}if("all"!==s){let t=e.isActive();if("active"===s&&!t||"inactive"===s&&t)return!1}return("boolean"!=typeof u||e.isStale()===u)&&(!i||i===e.state.fetchStatus)&&(!n||!!n(e))}function l(t,e){let{exact:s,status:r,predicate:i,mutationKey:n}=t;if(n){if(!e.options.mutationKey)return!1;if(s){if(f(e.options.mutationKey)!==f(n))return!1}else if(!p(e.options.mutationKey,n))return!1}return(!r||e.state.status===r)&&(!i||!!i(e))}function d(t,e){return(e?.queryKeyHashFn||f)(t)}function f(t){return JSON.stringify(t,(t,e)=>v(e)?Object.keys(e).sort().reduce((t,s)=>(t[s]=e[s],t),{}):e)}function p(t,e){return t===e||typeof t==typeof e&&!!t&&!!e&&"object"==typeof t&&"object"==typeof e&&!Object.keys(e).some(s=>!p(t[s],e[s]))}function y(t,e){if(t===e)return t;let s=b(t)&&b(e);if(s||v(t)&&v(e)){let r=s?t:Object.keys(t),i=r.length,n=s?e:Object.keys(e),a=n.length,u=s?[]:{},o=0;for(let i=0;i<a;i++){let a=s?i:n[i];(!s&&r.includes(a)||s)&&void 0===t[a]&&void 0===e[a]?(u[a]=void 0,o++):(u[a]=y(t[a],e[a]),u[a]===t[a]&&void 0!==t[a]&&o++)}return i===a&&o===i?t:u}return e}function m(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(let s in t)if(t[s]!==e[s])return!1;return!0}function b(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function v(t){if(!g(t))return!1;let e=t.constructor;if(void 0===e)return!0;let s=e.prototype;return!!(g(s)&&s.hasOwnProperty("isPrototypeOf"))&&Object.getPrototypeOf(t)===Object.prototype}function g(t){return"[object Object]"===Object.prototype.toString.call(t)}function O(t,e,s){return"function"==typeof s.structuralSharing?s.structuralSharing(t,e):!1!==s.structuralSharing?y(t,e):e}function R(t){return t}function C(t,e,s=0){let r=[...t,e];return s&&r.length>s?r.slice(1):r}function Q(t,e,s=0){let r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}var S=Symbol();function w(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:t.queryFn&&t.queryFn!==S?t.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${t.queryHash}'`))}var q=new class extends r{#t;#e;#s;constructor(){super(),this.#s=t=>{if(!i&&window.addEventListener){let e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(t=>{"boolean"==typeof t?this.setFocused(t):this.onFocus()})}setFocused(t){this.#t!==t&&(this.#t=t,this.onFocus())}onFocus(){let t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return"boolean"==typeof this.#t?this.#t:globalThis.document?.visibilityState!=="hidden"}},P=new class extends r{#r=!0;#e;#s;constructor(){super(),this.#s=t=>{if(!i&&window.addEventListener){let e=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",s)}}}}onSubscribe(){this.#e||this.setEventListener(this.#s)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#s=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#r!==t&&(this.#r=t,this.listeners.forEach(e=>{e(t)}))}isOnline(){return this.#r}};function E(){let t,e;let s=new Promise((s,r)=>{t=s,e=r});function r(t){Object.assign(s,t),delete s.resolve,delete s.reject}return s.status="pending",s.catch(()=>{}),s.resolve=e=>{r({status:"fulfilled",value:e}),t(e)},s.reject=t=>{r({status:"rejected",reason:t}),e(t)},s}function M(t){return Math.min(1e3*2**t,3e4)}function D(t){return(t??"online")!=="online"||P.isOnline()}var F=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function x(t){return t instanceof F}function I(t){let e,s=!1,r=0,n=!1,a=E(),u=()=>q.isFocused()&&("always"===t.networkMode||P.isOnline())&&t.canRun(),o=()=>D(t.networkMode)&&t.canRun(),h=s=>{n||(n=!0,t.onSuccess?.(s),e?.(),a.resolve(s))},c=s=>{n||(n=!0,t.onError?.(s),e?.(),a.reject(s))},l=()=>new Promise(s=>{e=t=>{(n||u())&&s(t)},t.onPause?.()}).then(()=>{e=void 0,n||t.onContinue?.()}),d=()=>{let e;if(n)return;let a=0===r?t.initialPromise:void 0;try{e=a??t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(h).catch(e=>{if(n)return;let a=t.retry??3*!i,o=t.retryDelay??M,h="function"==typeof o?o(r,e):o,f=!0===a||"number"==typeof a&&r<a||"function"==typeof a&&a(r,e);if(s||!f){c(e);return}r++,t.onFail?.(r,e),new Promise(t=>{setTimeout(t,h)}).then(()=>u()?void 0:l()).then(()=>{s?c(e):d()})})};return{promise:a,cancel:e=>{n||(c(new F(e)),t.abort?.())},continue:()=>(e?.(),a),cancelRetry:()=>{s=!0},continueRetry:()=>{s=!1},canStart:o,start:()=>(o()?d():l().then(d),a)}}var T=function(){let t=[],e=0,s=t=>{t()},r=t=>{t()},i=t=>setTimeout(t,0),n=r=>{e?t.push(r):i(()=>{s(r)})},a=()=>{let e=t;t=[],e.length&&i(()=>{r(()=>{e.forEach(t=>{s(t)})})})};return{batch:t=>{let s;e++;try{s=t()}finally{--e||a()}return s},batchCalls:t=>(...e)=>{n(()=>{t(...e)})},schedule:n,setNotifyFunction:t=>{s=t},setBatchNotifyFunction:t=>{r=t},setScheduler:t=>{i=t}}}(),k=class{#i;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),a(this.gcTime)&&(this.#i=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(i?1/0:3e5))}clearGcTimeout(){this.#i&&(clearTimeout(this.#i),this.#i=void 0)}},A=class extends k{#n;#a;#u;#o;#h;#c;#l;constructor(t){super(),this.#l=!1,this.#c=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#o=t.client,this.#u=this.#o.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#n=function(t){let e="function"==typeof t.initialData?t.initialData():t.initialData,s=void 0!==e,r=s?"function"==typeof t.initialDataUpdatedAt?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}(this.options),this.state=t.state??this.#n,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#h?.promise}setOptions(t){this.options={...this.#c,...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#u.remove(this)}setData(t,e){let s=O(this.state.data,t,this.options);return this.#d({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#d({type:"setState",state:t,setStateOptions:e})}cancel(t){let e=this.#h?.promise;return this.#h?.cancel(t),e?e.then(n).catch(n):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#n)}isActive(){return this.observers.some(t=>!1!==h(t.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===S||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return!!this.state.isInvalidated||(this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data)}isStaleByTime(t=0){return this.state.isInvalidated||void 0===this.state.data||!u(this.state.dataUpdatedAt,t)}onFocus(){let t=this.observers.find(t=>t.shouldFetchOnWindowFocus());t?.refetch({cancelRefetch:!1}),this.#h?.continue()}onOnline(){let t=this.observers.find(t=>t.shouldFetchOnReconnect());t?.refetch({cancelRefetch:!1}),this.#h?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#u.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#h&&(this.#l?this.#h.cancel({revert:!0}):this.#h.cancelRetry()),this.scheduleGc()),this.#u.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#d({type:"invalidate"})}fetch(t,e){if("idle"!==this.state.fetchStatus){if(void 0!==this.state.data&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#h)return this.#h.continueRetry(),this.#h.promise}if(t&&this.setOptions(t),!this.options.queryFn){let t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}let s=new AbortController,r=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(this.#l=!0,s.signal)})},i={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#o,state:this.state,fetchFn:()=>{let t=w(this.options,e),s={client:this.#o,queryKey:this.queryKey,meta:this.meta};return(r(s),this.#l=!1,this.options.persister)?this.options.persister(t,s,this):t(s)}};r(i),this.options.behavior?.onFetch(i,this),this.#a=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#d({type:"fetch",meta:i.fetchOptions?.meta});let n=t=>{x(t)&&t.silent||this.#d({type:"error",error:t}),x(t)||(this.#u.config.onError?.(t,this),this.#u.config.onSettled?.(this.state.data,t,this)),this.scheduleGc()};return this.#h=I({initialPromise:e?.initialPromise,fn:i.fetchFn,abort:s.abort.bind(s),onSuccess:t=>{if(void 0===t){n(Error(`${this.queryHash} data is undefined`));return}try{this.setData(t)}catch(t){n(t);return}this.#u.config.onSuccess?.(t,this),this.#u.config.onSettled?.(t,this.state.error,this),this.scheduleGc()},onError:n,onFail:(t,e)=>{this.#d({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#d({type:"pause"})},onContinue:()=>{this.#d({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}),this.#h.start()}#d(t){this.state=(e=>{switch(t.type){case"failed":return{...e,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...e,fetchStatus:"paused"};case"continue":return{...e,fetchStatus:"fetching"};case"fetch":return{...e,...U(e.data,this.options),fetchMeta:t.meta??null};case"success":return{...e,data:t.data,dataUpdateCount:e.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":let s=t.error;if(x(s)&&s.revert&&this.#a)return{...this.#a,fetchStatus:"idle"};return{...e,error:s,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}})(this.state),T.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#u.notify({query:this,type:"updated",action:t})})}};function U(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:D(e.networkMode)?"fetching":"paused",...void 0===t&&{error:null,status:"pending"}}}var j=class extends r{constructor(t={}){super(),this.config=t,this.#f=new Map}#f;build(t,e,s){let r=e.queryKey,i=e.queryHash??d(r,e),n=this.get(i);return n||(n=new A({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(n)),n}add(t){this.#f.has(t.queryHash)||(this.#f.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#f.get(t.queryHash);e&&(t.destroy(),e===t&&this.#f.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){T.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#f.get(t)}getAll(){return[...this.#f.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(t=>c(e,t))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(e=>c(t,e)):e}notify(t){T.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){T.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){T.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},K=class extends k{#p;#y;#h;constructor(t){super(),this.mutationId=t.mutationId,this.#y=t.mutationCache,this.#p=[],this.state=t.state||H(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#p.includes(t)||(this.#p.push(t),this.clearGcTimeout(),this.#y.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#p=this.#p.filter(e=>e!==t),this.scheduleGc(),this.#y.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#p.length||("pending"===this.state.status?this.scheduleGc():this.#y.remove(this))}continue(){return this.#h?.continue()??this.execute(this.state.variables)}async execute(t){this.#h=I({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{this.#d({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#d({type:"pause"})},onContinue:()=>{this.#d({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#y.canRun(this)});let e="pending"===this.state.status,s=!this.#h.canStart();try{if(!e){this.#d({type:"pending",variables:t,isPaused:s}),await this.#y.config.onMutate?.(t,this);let e=await this.options.onMutate?.(t);e!==this.state.context&&this.#d({type:"pending",context:e,variables:t,isPaused:s})}let r=await this.#h.start();return await this.#y.config.onSuccess?.(r,t,this.state.context,this),await this.options.onSuccess?.(r,t,this.state.context),await this.#y.config.onSettled?.(r,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(r,null,t,this.state.context),this.#d({type:"success",data:r}),r}catch(e){try{throw await this.#y.config.onError?.(e,t,this.state.context,this),await this.options.onError?.(e,t,this.state.context),await this.#y.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,e,t,this.state.context),e}finally{this.#d({type:"error",error:e})}}finally{this.#y.runNext(this)}}#d(t){this.state=(e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),T.batch(()=>{this.#p.forEach(e=>{e.onMutationUpdate(t)}),this.#y.notify({mutation:this,type:"updated",action:t})})}};function H(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var L=class extends r{constructor(t={}){super(),this.config=t,this.#m=new Set,this.#b=new Map,this.#v=0}#m;#b;#v;build(t,e,s){let r=new K({mutationCache:this,mutationId:++this.#v,options:t.defaultMutationOptions(e),state:s});return this.add(r),r}add(t){this.#m.add(t);let e=_(t);if("string"==typeof e){let s=this.#b.get(e);s?s.push(t):this.#b.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#m.delete(t)){let e=_(t);if("string"==typeof e){let s=this.#b.get(e);if(s){if(s.length>1){let e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#b.delete(e)}}}this.notify({type:"removed",mutation:t})}canRun(t){let e=_(t);if("string"!=typeof e)return!0;{let s=this.#b.get(e),r=s?.find(t=>"pending"===t.state.status);return!r||r===t}}runNext(t){let e=_(t);if("string"!=typeof e)return Promise.resolve();{let s=this.#b.get(e)?.find(e=>e!==t&&e.state.isPaused);return s?.continue()??Promise.resolve()}}clear(){T.batch(()=>{this.#m.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#m.clear(),this.#b.clear()})}getAll(){return Array.from(this.#m)}find(t){let e={exact:!0,...t};return this.getAll().find(t=>l(e,t))}findAll(t={}){return this.getAll().filter(e=>l(t,e))}notify(t){T.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(t=>t.state.isPaused);return T.batch(()=>Promise.all(t.map(t=>t.continue().catch(n))))}};function _(t){return t.options.scope?.id}function G(t){return{onFetch:(e,s)=>{let r=e.options,i=e.fetchOptions?.meta?.fetchMore?.direction,n=e.state.data?.pages||[],a=e.state.data?.pageParams||[],u={pages:[],pageParams:[]},o=0,h=async()=>{let s=!1,h=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(e.signal.aborted?s=!0:e.signal.addEventListener("abort",()=>{s=!0}),e.signal)})},c=w(e.options,e.fetchOptions),l=async(t,r,i)=>{if(s)return Promise.reject();if(null==r&&t.pages.length)return Promise.resolve(t);let n={client:e.client,queryKey:e.queryKey,pageParam:r,direction:i?"backward":"forward",meta:e.options.meta};h(n);let a=await c(n),{maxPages:u}=e.options,o=i?Q:C;return{pages:o(t.pages,a,u),pageParams:o(t.pageParams,r,u)}};if(i&&n.length){let t="backward"===i,e={pages:n,pageParams:a},s=(t?z:N)(r,e);u=await l(e,s,t)}else{let e=t??n.length;do{let t=0===o?a[0]??r.initialPageParam:N(r,u);if(o>0&&null==t)break;u=await l(u,t),o++}while(o<e)}return u};e.options.persister?e.fetchFn=()=>e.options.persister?.(h,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},s):e.fetchFn=h}}}function N(t,{pages:e,pageParams:s}){let r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,s[r],s):void 0}function z(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var B=class{#g;#y;#c;#O;#R;#C;#Q;#S;constructor(t={}){this.#g=t.queryCache||new j,this.#y=t.mutationCache||new L,this.#c=t.defaultOptions||{},this.#O=new Map,this.#R=new Map,this.#C=0}mount(){this.#C++,1===this.#C&&(this.#Q=q.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#g.onFocus())}),this.#S=P.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#g.onOnline())}))}unmount(){this.#C--,0===this.#C&&(this.#Q?.(),this.#Q=void 0,this.#S?.(),this.#S=void 0)}isFetching(t){return this.#g.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#y.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#g.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#g.build(this,e),r=s.state.data;return void 0===r?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(o(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#g.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){let r=this.defaultQueryOptions({queryKey:t}),i=this.#g.get(r.queryHash),n=i?.state.data,a="function"==typeof e?e(n):e;if(void 0!==a)return this.#g.build(this,r).setData(a,{...s,manual:!0})}setQueriesData(t,e,s){return T.batch(()=>this.#g.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#g.get(e.queryHash)?.state}removeQueries(t){let e=this.#g;T.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){let s=this.#g;return T.batch(()=>(s.findAll(t).forEach(t=>{t.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){let s={revert:!0,...e};return Promise.all(T.batch(()=>this.#g.findAll(t).map(t=>t.cancel(s)))).then(n).catch(n)}invalidateQueries(t,e={}){return T.batch(()=>(this.#g.findAll(t).forEach(t=>{t.invalidate()}),t?.refetchType==="none")?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e))}refetchQueries(t,e={}){let s={...e,cancelRefetch:e.cancelRefetch??!0};return Promise.all(T.batch(()=>this.#g.findAll(t).filter(t=>!t.isDisabled()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(n)),"paused"===t.state.fetchStatus?Promise.resolve():e}))).then(n)}fetchQuery(t){let e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);let s=this.#g.build(this,e);return s.isStaleByTime(o(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(n).catch(n)}fetchInfiniteQuery(t){return t.behavior=G(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(n).catch(n)}ensureInfiniteQueryData(t){return t.behavior=G(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return P.isOnline()?this.#y.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#g}getMutationCache(){return this.#y}getDefaultOptions(){return this.#c}setDefaultOptions(t){this.#c=t}setQueryDefaults(t,e){this.#O.set(f(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#O.values()],s={};return e.forEach(e=>{p(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#R.set(f(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#R.values()],s={};return e.forEach(e=>{p(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#c.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=d(e.queryKey,e)),void 0===e.refetchOnReconnect&&(e.refetchOnReconnect="always"!==e.networkMode),void 0===e.throwOnError&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===S&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#c.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#g.clear(),this.#y.clear()}},W=class extends r{constructor(t,e){super(),this.options=e,this.#o=t,this.#w=null,this.#q=E(),this.options.experimental_prefetchInRender||this.#q.reject(Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(e)}#o;#P=void 0;#E=void 0;#M=void 0;#D;#F;#q;#w;#x;#I;#T;#k;#A;#U;#j=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#P.addObserver(this),$(this.#P,this.options)?this.#K():this.updateResult(),this.#H())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return J(this.#P,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return J(this.#P,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#L(),this.#_(),this.#P.removeObserver(this)}setOptions(t,e){let s=this.options,r=this.#P;if(this.options=this.#o.defaultQueryOptions(t),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof h(this.options.enabled,this.#P))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#G(),this.#P.setOptions(this.options),s._defaulted&&!m(this.options,s)&&this.#o.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#P,observer:this});let i=this.hasListeners();i&&V(this.#P,r,this.options,s)&&this.#K(),this.updateResult(e),i&&(this.#P!==r||h(this.options.enabled,this.#P)!==h(s.enabled,this.#P)||o(this.options.staleTime,this.#P)!==o(s.staleTime,this.#P))&&this.#N();let n=this.#z();i&&(this.#P!==r||h(this.options.enabled,this.#P)!==h(s.enabled,this.#P)||n!==this.#U)&&this.#B(n)}getOptimisticResult(t){var e,s;let r=this.#o.getQueryCache().build(this.#o,t),i=this.createResult(r,t);return e=this,s=i,m(e.getCurrentResult(),s)||(this.#M=i,this.#F=this.options,this.#D=this.#P.state),i}getCurrentResult(){return this.#M}trackResult(t,e){let s={};return Object.keys(t).forEach(r=>{Object.defineProperty(s,r,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(r),e?.(r),t[r])})}),s}trackProp(t){this.#j.add(t)}getCurrentQuery(){return this.#P}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#o.defaultQueryOptions(t),s=this.#o.getQueryCache().build(this.#o,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#K({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#M))}#K(t){this.#G();let e=this.#P.fetch(this.options,t);return t?.throwOnError||(e=e.catch(n)),e}#N(){this.#L();let t=o(this.options.staleTime,this.#P);if(i||this.#M.isStale||!a(t))return;let e=u(this.#M.dataUpdatedAt,t);this.#k=setTimeout(()=>{this.#M.isStale||this.updateResult()},e+1)}#z(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#P):this.options.refetchInterval)??!1}#B(t){this.#_(),this.#U=t,!i&&!1!==h(this.options.enabled,this.#P)&&a(this.#U)&&0!==this.#U&&(this.#A=setInterval(()=>{(this.options.refetchIntervalInBackground||q.isFocused())&&this.#K()},this.#U))}#H(){this.#N(),this.#B(this.#z())}#L(){this.#k&&(clearTimeout(this.#k),this.#k=void 0)}#_(){this.#A&&(clearInterval(this.#A),this.#A=void 0)}createResult(t,e){let s;let r=this.#P,i=this.options,n=this.#M,a=this.#D,u=this.#F,o=t!==r?t.state:this.#E,{state:h}=t,c={...h},l=!1;if(e._optimisticResults){let s=this.hasListeners(),n=!s&&$(t,e),a=s&&V(t,r,e,i);(n||a)&&(c={...c,...U(h.data,t.options)}),"isRestoring"===e._optimisticResults&&(c.fetchStatus="idle")}let{error:d,errorUpdatedAt:f,status:p}=c;if(e.select&&void 0!==c.data){if(n&&c.data===a?.data&&e.select===this.#x)s=this.#I;else try{this.#x=e.select,s=e.select(c.data),s=O(n?.data,s,e),this.#I=s,this.#w=null}catch(t){this.#w=t}}else s=c.data;if(void 0!==e.placeholderData&&void 0===s&&"pending"===p){let t;if(n?.isPlaceholderData&&e.placeholderData===u?.placeholderData)t=n.data;else if(t="function"==typeof e.placeholderData?e.placeholderData(this.#T?.state.data,this.#T):e.placeholderData,e.select&&void 0!==t)try{t=e.select(t),this.#w=null}catch(t){this.#w=t}void 0!==t&&(p="success",s=O(n?.data,t,e),l=!0)}this.#w&&(d=this.#w,s=this.#I,f=Date.now(),p="error");let y="fetching"===c.fetchStatus,m="pending"===p,b="error"===p,v=m&&y,g=void 0!==s,R={status:p,fetchStatus:c.fetchStatus,isPending:m,isSuccess:"success"===p,isError:b,isInitialLoading:v,isLoading:v,data:s,dataUpdatedAt:c.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>o.dataUpdateCount||c.errorUpdateCount>o.errorUpdateCount,isFetching:y,isRefetching:y&&!m,isLoadingError:b&&!g,isPaused:"paused"===c.fetchStatus,isPlaceholderData:l,isRefetchError:b&&g,isStale:X(t,e),refetch:this.refetch,promise:this.#q};if(this.options.experimental_prefetchInRender){let e=t=>{"error"===R.status?t.reject(R.error):void 0!==R.data&&t.resolve(R.data)},s=()=>{e(this.#q=R.promise=E())},i=this.#q;switch(i.status){case"pending":t.queryHash===r.queryHash&&e(i);break;case"fulfilled":("error"===R.status||R.data!==i.value)&&s();break;case"rejected":("error"!==R.status||R.error!==i.reason)&&s()}}return R}updateResult(t){let e=this.#M,s=this.createResult(this.#P,this.options);if(this.#D=this.#P.state,this.#F=this.options,void 0!==this.#D.data&&(this.#T=this.#P),m(s,e))return;this.#M=s;let r={};t?.listeners!==!1&&(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,s="function"==typeof t?t():t;if("all"===s||!s&&!this.#j.size)return!0;let r=new Set(s??this.#j);return this.options.throwOnError&&r.add("error"),Object.keys(this.#M).some(t=>this.#M[t]!==e[t]&&r.has(t))})()&&(r.listeners=!0),this.#W({...r,...t})}#G(){let t=this.#o.getQueryCache().build(this.#o,this.options);if(t===this.#P)return;let e=this.#P;this.#P=t,this.#E=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#H()}#W(t){T.batch(()=>{t.listeners&&this.listeners.forEach(t=>{t(this.#M)}),this.#o.getQueryCache().notify({query:this.#P,type:"observerResultsUpdated"})})}};function $(t,e){return!1!==h(e.enabled,t)&&void 0===t.state.data&&("error"!==t.state.status||!1!==e.retryOnMount)||void 0!==t.state.data&&J(t,e,e.refetchOnMount)}function J(t,e,s){if(!1!==h(e.enabled,t)){let r="function"==typeof s?s(t):s;return"always"===r||!1!==r&&X(t,e)}return!1}function V(t,e,s,r){return(t!==e||!1===h(r.enabled,t))&&(!s.suspense||"error"!==t.state.status)&&X(t,s)}function X(t,e){return!1!==h(e.enabled,t)&&t.isStaleByTime(o(e.staleTime,t))}function Y(t,e){return t.filter(t=>!e.includes(t))}var Z=class extends r{#o;#$;#f;#J;#p;#V;#X;#Y;#Z=[];constructor(t,e,s){super(),this.#o=t,this.#J=s,this.#f=[],this.#p=[],this.#$=[],this.setQueries(e)}onSubscribe(){1===this.listeners.size&&this.#p.forEach(t=>{t.subscribe(e=>{this.#tt(t,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#p.forEach(t=>{t.destroy()})}setQueries(t,e,s){this.#f=t,this.#J=e,T.batch(()=>{let t=this.#p,e=this.#te(this.#f);this.#Z=e,e.forEach(t=>t.observer.setOptions(t.defaultedQueryOptions,s));let r=e.map(t=>t.observer),i=r.map(t=>t.getCurrentResult()),n=r.some((e,s)=>e!==t[s]);if(t.length!==r.length||n)this.#p=r,this.#$=i,this.hasListeners()&&(Y(t,r).forEach(t=>{t.destroy()}),Y(r,t).forEach(t=>{t.subscribe(e=>{this.#tt(t,e)})}),this.#W())})}getCurrentResult(){return this.#$}getQueries(){return this.#p.map(t=>t.getCurrentQuery())}getObservers(){return this.#p}getOptimisticResult(t,e){let s=this.#te(t),r=s.map(t=>t.observer.getOptimisticResult(t.defaultedQueryOptions));return[r,t=>this.#ts(t??r,e),()=>this.#tr(r,s)]}#tr(t,e){return e.map((s,r)=>{let i=t[r];return s.defaultedQueryOptions.notifyOnChangeProps?i:s.observer.trackResult(i,t=>{e.forEach(e=>{e.observer.trackProp(t)})})})}#ts(t,e){return e?(this.#V&&this.#$===this.#Y&&e===this.#X||(this.#X=e,this.#Y=this.#$,this.#V=y(this.#V,e(t))),this.#V):t}#te(t){let e=new Map(this.#p.map(t=>[t.options.queryHash,t])),s=[];return t.forEach(t=>{let r=this.#o.defaultQueryOptions(t),i=e.get(r.queryHash);i?s.push({defaultedQueryOptions:r,observer:i}):s.push({defaultedQueryOptions:r,observer:new W(this.#o,r)})}),s}#tt(t,e){let s=this.#p.indexOf(t);-1!==s&&(this.#$=function(t,e,s){let r=t.slice(0);return r[e]=s,r}(this.#$,s,e),this.#W())}#W(){if(this.hasListeners()){let t=this.#V,e=this.#tr(this.#$,this.#Z);t!==this.#ts(e,this.#J?.combine)&&T.batch(()=>{this.listeners.forEach(t=>{t(this.#$)})})}}},tt=class extends W{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t,e){super.setOptions({...t,behavior:G()},e)}getOptimisticResult(t){return t.behavior=G(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){var s,r;let{state:i}=t,n=super.createResult(t,e),{isFetching:a,isRefetching:u,isError:o,isRefetchError:h}=n,c=i.fetchMeta?.fetchMore?.direction,l=o&&"forward"===c,d=a&&"forward"===c,f=o&&"backward"===c,p=a&&"backward"===c;return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:!!(s=i.data)&&null!=N(e,s),hasPreviousPage:!!(r=i.data)&&!!e.getPreviousPageParam&&null!=z(e,r),isFetchNextPageError:l,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:h&&!l&&!f,isRefetching:u&&!d&&!p}}},te=class extends r{#o;#M=void 0;#ti;#tn;constructor(t,e){super(),this.#o=t,this.setOptions(e),this.bindMethods(),this.#ta()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#o.defaultMutationOptions(t),m(this.options,e)||this.#o.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#ti,observer:this}),e?.mutationKey&&this.options.mutationKey&&f(e.mutationKey)!==f(this.options.mutationKey)?this.reset():this.#ti?.state.status==="pending"&&this.#ti.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#ti?.removeObserver(this)}onMutationUpdate(t){this.#ta(),this.#W(t)}getCurrentResult(){return this.#M}reset(){this.#ti?.removeObserver(this),this.#ti=void 0,this.#ta(),this.#W()}mutate(t,e){return this.#tn=e,this.#ti?.removeObserver(this),this.#ti=this.#o.getMutationCache().build(this.#o,this.options),this.#ti.addObserver(this),this.#ti.execute(t)}#ta(){let t=this.#ti?.state??H();this.#M={...t,isPending:"pending"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset}}#W(t){T.batch(()=>{if(this.#tn&&this.hasListeners()){let e=this.#M.variables,s=this.#M.context;t?.type==="success"?(this.#tn.onSuccess?.(t.data,e,s),this.#tn.onSettled?.(t.data,null,e,s)):t?.type==="error"&&(this.#tn.onError?.(t.error,e,s),this.#tn.onSettled?.(void 0,t.error,e,s))}this.listeners.forEach(t=>{t(this.#M)})})}};function ts(t){return t}function tr(t){return t.state.isPaused}function ti(t){return"success"===t.state.status}function tn(t){return!0}function ta(t,e={}){let s=e.shouldDehydrateMutation??t.getDefaultOptions().dehydrate?.shouldDehydrateMutation??tr,r=t.getMutationCache().getAll().flatMap(t=>s(t)?[{mutationKey:t.options.mutationKey,state:t.state,...t.options.scope&&{scope:t.options.scope},...t.meta&&{meta:t.meta}}]:[]),i=e.shouldDehydrateQuery??t.getDefaultOptions().dehydrate?.shouldDehydrateQuery??ti,n=e.shouldRedactErrors??t.getDefaultOptions().dehydrate?.shouldRedactErrors??tn,a=e.serializeData??t.getDefaultOptions().dehydrate?.serializeData??ts;return{mutations:r,queries:t.getQueryCache().getAll().flatMap(t=>i(t)?[{state:{...t.state,...void 0!==t.state.data&&{data:a(t.state.data)}},queryKey:t.queryKey,queryHash:t.queryHash,..."pending"===t.state.status&&{promise:t.promise?.then(a).catch(t=>n(t)?Promise.reject(Error("redacted")):Promise.reject(t))},...t.meta&&{meta:t.meta}}]:[])}}function tu(t,e,s){if("object"!=typeof e||null===e)return;let r=t.getMutationCache(),i=t.getQueryCache(),n=s?.defaultOptions?.deserializeData??t.getDefaultOptions().hydrate?.deserializeData??ts,a=e.mutations||[],u=e.queries||[];a.forEach(({state:e,...i})=>{r.build(t,{...t.getDefaultOptions().hydrate?.mutations,...s?.defaultOptions?.mutations,...i},e)}),u.forEach(({queryKey:e,state:r,queryHash:a,meta:u,promise:o})=>{let h=i.get(a),c=void 0===r.data?r.data:n(r.data);if(h){if(h.state.dataUpdatedAt<r.dataUpdatedAt){let{fetchStatus:t,...e}=r;h.setState({...e,data:c})}}else h=i.build(t,{...t.getDefaultOptions().hydrate?.queries,...s?.defaultOptions?.queries,queryKey:e,queryHash:a,meta:u},{...r,data:c,fetchStatus:"idle"});if(o){let t=Promise.resolve(o).then(n);h.fetch(void 0,{initialPromise:t})}})}function to({queryFn:t,refetchMode:e}){return async s=>{if("append"!==e){let t=s.client.getQueryCache().find({queryKey:s.queryKey,exact:!0});t&&void 0!==t.state.data&&t.setState({status:"pending",data:void 0,error:null,fetchStatus:"fetching"})}for await(let e of(await t(s))){if(s.signal.aborted)break;s.client.setQueryData(s.queryKey,(t=[])=>t.concat(e))}return s.client.getQueryData(s.queryKey)}}var th=Symbol("dataTagSymbol"),tc=Symbol("dataTagErrorSymbol"),tl=Symbol("unsetMarker"),td=s(54538),tf=s(24246),tp=td.createContext(void 0),ty=t=>{let e=td.useContext(tp);if(t)return t;if(!e)throw Error("No QueryClient set, use QueryClientProvider to set one");return e},tm=({client:t,children:e})=>(td.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,tf.jsx)(tp.Provider,{value:t,children:e})),tb=td.createContext(!1),tv=()=>td.useContext(tb),tg=tb.Provider;function tO(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var tR=td.createContext(tO()),tC=()=>td.useContext(tR),tQ=({children:t})=>{let[e]=td.useState(()=>tO());return(0,tf.jsx)(tR.Provider,{value:e,children:"function"==typeof t?t(e):t})};function tS(t,e){return"function"==typeof t?t(...e):!!t}function tw(){}var tq=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&!e.isReset()&&(t.retryOnMount=!1)},tP=t=>{td.useEffect(()=>{t.clearReset()},[t])},tE=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&void 0===t.data||tS(s,[t.error,r])),tM=(t,e)=>void 0===e.state.data,tD=t=>{let e=t.staleTime;t.suspense&&(t.staleTime="function"==typeof e?(...t)=>Math.max(e(...t),1e3):Math.max(e??1e3,1e3),"number"==typeof t.gcTime&&(t.gcTime=Math.max(t.gcTime,1e3)))},tF=(t,e)=>t.isLoading&&t.isFetching&&!e,tx=(t,e)=>t?.suspense&&e.isPending,tI=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function tT({queries:t,...e},s){let r=ty(s),i=tv(),n=tC(),a=td.useMemo(()=>t.map(t=>{let e=r.defaultQueryOptions(t);return e._optimisticResults=i?"isRestoring":"optimistic",e}),[t,r,i]);a.forEach(t=>{tD(t),tq(t,n)}),tP(n);let[u]=td.useState(()=>new Z(r,a,e)),[o,h,c]=u.getOptimisticResult(a,e.combine),l=!i&&!1!==e.subscribed;td.useSyncExternalStore(td.useCallback(t=>l?u.subscribe(T.batchCalls(t)):tw,[u,l]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),td.useEffect(()=>{u.setQueries(a,e,{listeners:!1})},[a,e,u]);let d=o.some((t,e)=>tx(a[e],t))?o.flatMap((t,e)=>{let s=a[e];if(s){let e=new W(r,s);if(tx(s,t))return tI(s,e,n);tF(t,i)&&tI(s,e,n)}return[]}):[];if(d.length>0)throw Promise.all(d);let f=o.find((t,e)=>{let s=a[e];return s&&tE({result:t,errorResetBoundary:n,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash),suspense:s.suspense})});if(f?.error)throw f.error;return h(c())}function tk(t,e,s){let r=ty(s),n=tv(),a=tC(),u=r.defaultQueryOptions(t);r.getDefaultOptions().queries?._experimental_beforeQuery?.(u),u._optimisticResults=n?"isRestoring":"optimistic",tD(u),tq(u,a),tP(a);let o=!r.getQueryCache().get(u.queryHash),[h]=td.useState(()=>new e(r,u)),c=h.getOptimisticResult(u),l=!n&&!1!==t.subscribed;if(td.useSyncExternalStore(td.useCallback(t=>{let e=l?h.subscribe(T.batchCalls(t)):tw;return h.updateResult(),e},[h,l]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),td.useEffect(()=>{h.setOptions(u,{listeners:!1})},[u,h]),tx(u,c))throw tI(u,h,a);if(tE({result:c,errorResetBoundary:a,throwOnError:u.throwOnError,query:r.getQueryCache().get(u.queryHash),suspense:u.suspense}))throw c.error;if(r.getDefaultOptions().queries?._experimental_afterQuery?.(u,c),u.experimental_prefetchInRender&&!i&&tF(c,n)){let t=o?tI(u,h,a):r.getQueryCache().get(u.queryHash)?.promise;t?.catch(tw).finally(()=>{h.updateResult()})}return u.notifyOnChangeProps?c:h.trackResult(c)}function tA(t,e){return tk(t,W,e)}function tU(t,e){return tk({...t,enabled:!0,suspense:!0,throwOnError:tM,placeholderData:void 0},W,e)}function tj(t,e){return tk({...t,enabled:!0,suspense:!0,throwOnError:tM},tt,e)}function tK(t,e){return tT({...t,queries:t.queries.map(t=>({...t,suspense:!0,throwOnError:tM,enabled:!0,placeholderData:void 0}))},e)}function tH(t,e){let s=ty(e);s.getQueryState(t.queryKey)||s.prefetchQuery(t)}function tL(t,e){let s=ty(e);s.getQueryState(t.queryKey)||s.prefetchInfiniteQuery(t)}function t_(t){return t}function tG(t){return t}var tN=(t,e)=>"object"==typeof t&&null!==t&&e in t,tz=({children:t,options:e={},state:s,queryClient:r})=>{let i=ty(r),[n,a]=td.useState(),u=td.useRef(e);return u.current=e,td.useMemo(()=>{if(s){if("object"!=typeof s)return;let t=i.getQueryCache(),e=s.queries||[],r=[],o=[];for(let s of e){let e=t.get(s.queryHash);if(e){let t=s.state.dataUpdatedAt>e.state.dataUpdatedAt||tN(s.promise,"status")&&tN(e.promise,"status")&&s.promise.status!==e.promise.status,r=n?.find(t=>t.queryHash===s.queryHash);t&&(!r||s.state.dataUpdatedAt>r.state.dataUpdatedAt)&&o.push(s)}else r.push(s)}r.length>0&&tu(i,{queries:r},u.current),o.length>0&&a(t=>t?[...t,...o]:o)}},[i,n,s]),td.useEffect(()=>{n&&(tu(i,{queries:n},u.current),a(void 0))},[i,n]),t};function tB(t,e){let s=ty(e),r=s.getQueryCache();return td.useSyncExternalStore(td.useCallback(t=>r.subscribe(T.batchCalls(t)),[r]),()=>s.isFetching(t),()=>s.isFetching(t))}function tW(t,e){let s=ty(e);return tJ({filters:{...t,status:"pending"}},s).length}function t$(t,e){return t.findAll(e.filters).map(t=>e.select?e.select(t):t.state)}function tJ(t={},e){let s=ty(e).getMutationCache(),r=td.useRef(t),i=td.useRef(null);return i.current||(i.current=t$(s,t)),td.useEffect(()=>{r.current=t}),td.useSyncExternalStore(td.useCallback(t=>s.subscribe(()=>{let e=y(i.current,t$(s,r.current));i.current!==e&&(i.current=e,T.schedule(t))}),[s]),()=>i.current,()=>i.current)}function tV(t,e){let s=ty(e),[r]=td.useState(()=>new te(s,t));td.useEffect(()=>{r.setOptions(t)},[r,t]);let i=td.useSyncExternalStore(td.useCallback(t=>r.subscribe(T.batchCalls(t)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),n=td.useCallback((t,e)=>{r.mutate(t,e).catch(tw)},[r]);if(i.error&&tS(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:n,mutateAsync:i.mutate}}function tX(t,e){return tk(t,tt,e)}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkPrometheus=self.webpackChunkPrometheus||[]).push([["2581"],{70313:function(e,r,n){n.d(r,{d:()=>u});var t=n(54538),i=n(97048),o=n(81925),a=n(80668),l=n(94680);function s(e){return e.substring(2).toLowerCase()}function u(e){let{children:r,disableReactTree:n=!1,mouseEvent:u="onClick",onClickAway:d,touchEvent:c="onTouchEnd"}=e,p=t.useRef(!1),m=t.useRef(null),g=t.useRef(!1),h=t.useRef(!1);t.useEffect(()=>(setTimeout(()=>{g.current=!0},0),()=>{g.current=!1}),[]);let f=(0,i.Z)((0,l.Z)(r),m),v=(0,o.Z)(e=>{let r;let t=h.current;h.current=!1;let i=(0,a.Z)(m.current);if(g.current&&m.current&&(!("clientX"in e)||!(i.documentElement.clientWidth<e.clientX)&&!(i.documentElement.clientHeight<e.clientY))){if(p.current){p.current=!1;return}(e.composedPath?e.composedPath().includes(m.current):!i.documentElement.contains(e.target)||m.current.contains(e.target))||!n&&t||d(e)}}),x=e=>n=>{h.current=!0;let t=r.props[e];t&&t(n)},b={ref:f};return!1!==c&&(b[c]=x(c)),t.useEffect(()=>{if(!1!==c){let e=s(c),r=(0,a.Z)(m.current),n=()=>{p.current=!0};return r.addEventListener(e,v),r.addEventListener("touchmove",n),()=>{r.removeEventListener(e,v),r.removeEventListener("touchmove",n)}}},[v,c]),!1!==u&&(b[u]=x(u)),t.useEffect(()=>{if(!1!==u){let e=s(u),r=(0,a.Z)(m.current);return r.addEventListener(e,v),()=>{r.removeEventListener(e,v)}}},[v,u]),t.cloneElement(r,b)}},85843:function(e,r,n){n.d(r,{Z:()=>f});var t=n(54538),i=n(90496),o=n(82267),a=n(12709),l=n(51751),s=n(44124),u=n(6749);function d(e){return(0,u.ZP)("MuiFormGroup",e)}(0,s.Z)("MuiFormGroup",["root","row","error"]);var c=n(36683),p=n(33567),m=n(24246);let g=e=>{let{classes:r,row:n,error:t}=e;return(0,o.Z)({root:["root",n&&"row",t&&"error"]},d,r)},h=(0,a.ZP)("div",{name:"MuiFormGroup",slot:"Root",overridesResolver:(e,r)=>{let{ownerState:n}=e;return[r.root,n.row&&r.row]}})({display:"flex",flexDirection:"column",flexWrap:"wrap",variants:[{props:{row:!0},style:{flexDirection:"row"}}]}),f=t.forwardRef(function(e,r){let n=(0,l.i)({props:e,name:"MuiFormGroup"}),{className:t,row:o=!1,...a}=n,s=(0,c.Z)(),u=(0,p.Z)({props:n,muiFormControl:s,states:["error"]}),d={...n,row:o,error:u.error},f=g(d);return(0,m.jsx)(h,{className:(0,i.Z)(f.root,t),ownerState:d,ref:r,...a})})},14371:function(e,r,n){r.default=void 0;var t,i=(t=n(30265))&&t.__esModule?t:{default:t};r.default=(0,i.default)("M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z","OpenInNew")},38475:function(e,r,n){n.d(r,{BL:()=>s,Jj:()=>d,bk:()=>c,dT:()=>p,kx:()=>l,vo:()=>a,zx:()=>u});let t=["bottom","right"],i=["list","table"],o=["small","medium"];function a(e){return t.includes(e)}function l(e){return i.includes(e)}function s(e){return o.includes(e)}let u={position:"bottom",mode:"list",size:"medium"};function d(e){return void 0===e?u.position:a(e)?e:u.position}function c(e){return e&&l(e)?e:u.mode}function p(e){return e&&s(e)?e:u.size}},20660:function(e,r,n){n.r(r),n.d(r,{LEGEND_SIZE_CONFIG:()=>e5,PanelSpecEditor:()=>rg,validateLegendSpec:()=>e3,ProjectStoreProvider:()=>r4,useInitialRefreshInterval:()=>no,MultiQueryEditor:()=>rl,useReplaceVariablesInString:()=>eR,LEGEND_VALUE_CONFIG:()=>e4,VariableListPreview:()=>rW,TimeRangeSettingsContext:()=>rw,DEFAULT_REFRESH_INTERVAL_OPTIONS:()=>rR,OptionsEditorTabs:()=>rd,replaceVariables:()=>eP,DatasourceSelect:()=>eM,useActiveTimeSeriesQueries:()=>nh,getVariableValuesKey:()=>rq,useListVariablePluginValues:()=>rM,usePluginBuiltinVariableDefinitions:()=>en,TimeRangeProvider:()=>rT,useListDatasourceSelectItems:()=>ey,BuiltinVariableContext:()=>eZ,useUsageMetrics:()=>nC,useShowCustomTimeRangeSetting:()=>rL,useTraceQueries:()=>nb,CalculationSelector:()=>l,useSetRefreshIntervalParams:()=>na,QueryCountProvider:()=>rp,decodeTimeRangeValue:()=>r9,usePluginRegistry:()=>Y,TRACE_QUERY_KEY:()=>nv,useBuiltinVariableDefinitions:()=>eV,TimeRangeProviderWithQueryParams:()=>nl,ProjectSelect:()=>r3,TOOLTIP_TEXT:()=>ry,datasourceSelectValueToSelector:()=>eN,OptionsEditorRadios:()=>eJ,useProjectList:()=>r2,useTimeRangeContext:()=>rP,VariablePreview:()=>rB,useDataQueriesContext:()=>nw,usePlugins:()=>ee,useBuiltinVariableValues:()=>eS,TimeRangeSettingsProvider:()=>rO,useProjectStore:()=>r5,LEGEND_MODE_CONFIG:()=>e2,useDatasourceStore:()=>eb,ValidationProvider:()=>B,mockPluginRegistry:()=>nL,LEGEND_POSITIONS_CONFIG:()=>e1,PluginLoaderComponent:()=>nF,getMockPluginName:()=>nz,useQueryCountContext:()=>rm,getUnixTimeRange:()=>nx,TimeRangeParam:()=>ne,useShowZoomRangeSetting:()=>rz,replaceVariable:()=>ek,useTimeRangeSettingsContext:()=>rS,useTimeSeriesQueries:()=>nm,remotePluginLoader:()=>nU,LegendOptionsEditor:()=>re,useTimeRangeOptionsSetting:()=>rI,useDatasourceSelectValueToSelector:()=>e_,useBuiltinVariableContext:()=>ew,PluginSpecEditor:()=>el,encodeTimeRangeValue:()=>r8,useListPluginMetadata:()=>er,useQueryType:()=>nT,VariableEditorForm:()=>rJ,useTimeSeriesQuery:()=>np,DataQueriesContext:()=>nZ,PluginKindSelect:()=>et,filterVariableList:()=>rA,useSuggestedStepMs:()=>rE,useTimeRange:()=>rk,DataQueriesProvider:()=>nV,isVariableDatasource:()=>eF,PluginRegistry:()=>rh,getActiveTimeSeriesQueries:()=>nf,usePluginEditor:()=>ed,useValidationSchemas:()=>U,PluginRegistryContext:()=>J,UsageMetricsProvider:()=>nk,TimeRangeControls:()=>rD,usePlugin:()=>X,legendValues:()=>e0,timeRangeQueryConfig:()=>nr,MetricLabelInput:()=>r7,VariableContext:()=>ez,HTTPSettingsEditor:()=>eY,VARIABLE_TYPES:()=>rQ,getSubmitText:()=>K,refreshIntervalQueryConfig:()=>nn,useUsageMetricsContext:()=>nj,useVariableValues:()=>eI,ValidationSchemasContext:()=>_,dynamicImportPluginLoader:()=>r6,PluginEditor:()=>ec,TimeRangeContext:()=>rC,transformQueryResults:()=>nE,useDataQueries:()=>nS,useDatasource:()=>eC,getTitleAction:()=>W,parseVariables:()=>eT,ProjectStoreContext:()=>r1,useAllVariableValues:()=>eO,useTimeRangeSettings:()=>rV,UsageMetricsContext:()=>ny,useTimeRangeParams:()=>ni,DatasourceName:()=>eq,useInitialTimeRange:()=>nt,VariableStoreStateMap:()=>eL,DatasourceStoreContext:()=>ex,TIME_SERIES_QUERY_KEY:()=>nd,DatasourceEditorForm:()=>ep,useDatasourceClient:()=>ej});var t=n(24246),i=n(89698);let o={first:{label:"First",description:"First value"},last:{label:"Last",description:"Last value"},"first-number":{label:"First *",description:"First numeric value"},"last-number":{label:"Last *",description:"Last numeric value"},mean:{label:"Avg",description:"Average value excluding nulls"},sum:{label:"Sum",description:"The sum of all values"},min:{label:"Min",description:"Minimum value"},max:{label:"Max",description:"Maximum value"}},a=Object.entries(o).map(([e,r])=>({id:e,...r}));function l({value:e,onChange:r}){let n=o[e];return(0,t.jsx)(i.OptionsEditorControl,{label:"Calculation",control:(0,t.jsx)(i.SettingsAutocomplete,{value:{...n,id:e},options:a,onChange:(e,n)=>{r(n.id)},disableClearable:!0})})}var s=n(494),u=n(36372),d=n(52054),c=n(38359),p=n(8695),m=n(25283),g=n(28797),h=n(87895),f=n(79119),v=n(54538),x=n.n(v),b=n(64293),y=n(77891);let j=y.z.string().min(1,"Required").max(75,"Must be 75 or fewer characters long").regex(/^[a-zA-Z0-9_.-]+$/,"Must only contains alphanumerical characters and special characters _ . -"),C=y.z.object({name:j}),P=C.extend({project:j}),k=y.z.object({kind:y.z.string().min(1,"Required"),spec:y.z.record(y.z.string(),y.z.any())}),E=y.z.object({name:y.z.string().optional(),description:y.z.string().optional()}),T=y.z.object({display:E.optional(),default:y.z.boolean(),plugin:k}),Z=y.z.object({kind:y.z.literal("Datasource"),metadata:P,spec:T}),w=y.z.object({kind:y.z.literal("GlobalDatasource"),metadata:C,spec:T});y.z.discriminatedUnion("kind",[Z,w]);let S=y.z.object({name:y.z.string().min(1),spec:T}),V=y.z.object({name:y.z.string().min(1,{message:"Required"}),description:y.z.string().optional()}),L=y.z.object({kind:y.z.string().min(1),spec:y.z.object({plugin:k})}),z=y.z.object({name:y.z.string().optional(),url:y.z.string().min(1),tooltip:y.z.string().optional(),renderVariables:y.z.boolean().optional(),targetBlank:y.z.boolean().optional()}),I=y.z.object({display:V,plugin:k,queries:y.z.array(L).optional(),links:y.z.array(z).optional()}),O=y.z.object({kind:y.z.literal("Panel"),spec:I}),R=y.z.object({groupId:y.z.number(),panelDefinition:O}),D=y.z.object({name:y.z.string().optional(),description:y.z.string().optional(),hidden:y.z.boolean().optional()}),A=y.z.object({name:y.z.string().min(1),display:D.optional(),defaultValue:y.z.string().or(y.z.array(y.z.string())).optional(),allowAllValue:y.z.boolean(),allowMultiple:y.z.boolean(),customAllValue:y.z.string().optional(),capturingRegexp:y.z.string().optional(),sort:y.z.enum(["none","alphabetical-asc","alphabetical-desc","numerical-asc","numerical-desc","alphabetical-ci-asc","alphabetical-ci-desc"]).optional(),plugin:k}),M=y.z.object({kind:y.z.literal("ListVariable"),spec:A}),q=y.z.object({name:y.z.string().min(1),display:D.optional(),value:y.z.string(),constant:y.z.boolean().optional()}),Q=y.z.object({kind:y.z.literal("TextVariable"),spec:q}),$=y.z.discriminatedUnion("kind",[Q,M]),F=y.z.object({kind:y.z.literal("Variable"),metadata:P,spec:$}),N=y.z.object({kind:y.z.literal("GlobalVariable"),metadata:P,spec:$});y.z.discriminatedUnion("kind",[F,N]);let _=(0,v.createContext)(void 0);function U(){let e=(0,v.useContext)(_);if(void 0===e)throw Error("No ValidationSchemasContext found. Did you forget a Provider?");return e}function B({children:e}){let[r,n]=(0,v.useState)(S),[i,o]=(0,v.useState)(R),[a,l]=(0,v.useState)($);return(0,t.jsx)(_.Provider,{value:{datasourceEditorSchema:r,panelEditorSchema:i,variableEditorSchema:a,setDatasourceEditorSchemaPlugin:function(e){n(y.z.object({name:y.z.string().min(1),spec:y.z.object({display:E.optional(),default:y.z.boolean(),plugin:e})}))},setPanelEditorSchemaPlugin:function(e){o(y.z.object({groupId:y.z.number(),panelDefinition:y.z.object({kind:y.z.literal("Panel"),spec:y.z.object({display:V,plugin:e,queries:y.z.array(L).optional(),links:y.z.array(z).optional()})})}))},setVariableEditorSchemaPlugin:function(e){l(y.z.discriminatedUnion("kind",[y.z.object({kind:y.z.literal("ListVariable"),spec:y.z.object({name:y.z.string().min(1),display:D.optional(),defaultValue:y.z.string().or(y.z.array(y.z.string())).optional(),allowAllValue:y.z.boolean(),allowMultiple:y.z.boolean(),customAllValue:y.z.string().optional(),capturingRegexp:y.z.string().optional(),sort:y.z.enum(["none","alphabetical-asc","alphabetical-desc","numerical-asc","numerical-desc","alphabetical-ci-asc","alphabetical-ci-desc"]).optional(),plugin:e})}),y.z.object({kind:y.z.literal("TextVariable"),spec:q})]))}},children:e})}function W(e,r){return"read"===e?"View":r&&"create"===e?"Add":r||"create"!==e?"update"===e?"Edit":"":"Create"}function K(e,r){return r&&"create"===e?"Add":r&&"update"===e?"Apply":r?"":"Save"}var H=n(10517),G=n(53034);let J=(0,v.createContext)(void 0);function Y(){let e=(0,v.useContext)(J);if(void 0===e)throw Error("PluginRegistryContext not found. Did you forget a provider?");return e}function X(e,r,n){n={...n,enabled:(n?.enabled??!0)&&void 0!==e&&""!==r};let{getPlugin:t}=Y();return(0,G.useQuery)({queryKey:["getPlugin",e,r],queryFn:()=>t(e,r),...n})}function ee(e,r){let{getPlugin:n}=Y(),t=[...new Set(r.map(e=>e.kind))],i=(0,G.useQueries)({queries:t.map(r=>({queryKey:["getPlugin",e,r],queryFn:()=>n(e,r)}))});return r.map(e=>i[t.indexOf(e.kind)])}function er(e,r){let{listPluginMetadata:n}=Y();return(0,G.useQuery)({queryKey:["listPluginMetadata",e],queryFn:()=>n(e),...r})}function en(){let{getPlugin:e,listPluginMetadata:r}=Y();return(0,G.useQuery)({queryKey:["usePluginBuiltinVariableDefinitions"],queryFn:async()=>{let n=new Set((await r(["Datasource"])).map(e=>e.spec.name)),t=[];for(let r of n){let n=await e("Datasource",r);n.getBuiltinVariableDefinitions&&n.getBuiltinVariableDefinitions().forEach(e=>t.push(e))}return t}})}let et=(0,v.forwardRef)((e,r)=>{let{pluginTypes:n,value:i,onChange:o,...a}=e,{data:l,isLoading:s}=er(n),u=!i||s?"":eo(i),d=(0,v.useCallback)(e=>{if(""===e)return"";let r=ea(e);return l?.find(e=>e.kind===r.type&&e.spec.name===r.kind)?.spec.display.name},[l]);return(0,t.jsxs)(p.Z,{select:!0,inputRef:r,...a,value:u,"aria-label":u,onChange:e=>{o?.(ea(e.target.value))},SelectProps:{renderValue:d},"data-testid":"plugin-kind-select",children:[s&&(0,t.jsx)(H.Z,{value:"",children:"Loading..."}),l?.map(e=>t.jsx(H.Z,{"data-testid":"option",value:eo({type:e.kind,kind:e.spec.name}),children:e.spec.display.name},e.kind+e.spec.name))]})});et.displayName="PluginKindSelect";let ei="_____";function eo(e){return[e.type,e.kind].join(ei)}function ea(e){let r=e.split(ei),n=r[0],t=r[1];if(void 0===n||void 0===t)throw Error("Invalid optionValue string");return{type:n,kind:t}}function el(e){let{pluginSelection:{type:r,kind:n},...o}=e,{data:a,isLoading:l,error:s}=X(r,n);if(s)return(0,t.jsx)(i.ErrorAlert,{error:s});if(l)return null;if(void 0===a)throw Error(`Missing implementation for ${r} plugin with kind '${n}'`);if("Panel"===r)throw Error("This editor should not be used for panel type. Please use Panel Spec Editor instead.");let{OptionsEditorComponent:u}=a;return void 0!==u?(0,t.jsx)(u,{...o}):null}function es(e){let r=(0,v.useRef)(e);return(0,v.useLayoutEffect)(()=>{r.current=e}),(0,v.useCallback)((...e)=>r.current(...e),[])}var eu=n(75586);function ed(e){let{pluginTypes:r,value:n,onHideQueryEditorChange:t=()=>{}}=e,i=es(e.onChange),o=es(t),a=(0,v.useRef)({[n.selection.type]:{[n.selection.kind]:n.spec}}),l=es(()=>{let e=a.current[n.selection.type];void 0===e&&(e={},a.current[n.selection.type]=e),e[n.selection.kind]=n.spec}),s=(0,v.useRef)({[n.selection.kind]:!1}),{defaultPluginKinds:u}=Y(),d=r[0],c=d?u?.[d]:void 0,p=d&&c?{type:d,kind:c}:void 0,m=!n.selection&&p?p:void 0,[g,h]=(0,v.useState)(m);(0,v.useEffect)(()=>{""===n.selection.kind&&(n.selection.kind=c||"")},[n.selection,c]);let{data:f,isFetching:x,error:b}=X(g?.type,g?.kind||"");return(0,v.useEffect)(()=>{g&&void 0!==f&&(l(),i({selection:g,spec:f.createInitialOptions?f.createInitialOptions():{}}),"Panel"===g.type&&(s.current[g.kind]=!!f.hideQueryEditor,!!f.hideQueryEditor!==s.current[n.selection.kind]&&o(!!f.hideQueryEditor)),h(void 0))},[g,f,l,i,o,s,n.selection]),{pendingSelection:g,isLoading:x,error:b,onSelectionChange:e=>{let r=a.current[e.type]?.[e.kind];void 0!==r?(l(),i({selection:e,spec:r})):h(e),"Panel"===e.type&&void 0!==s.current[e.kind]&&s.current[n.selection.kind]!==s.current[e.kind]&&o(!!s.current[e.kind])},onSpecChange:e=>{i((0,eu.Uy)(n,r=>{r.spec=e}))},rememberCurrentSpecState:l}}function ec(e){let{value:r,pluginTypes:n,pluginKindLabel:o,onChange:a,isReadonly:l,...s}=e,{pendingSelection:d,isLoading:c,error:p,onSelectionChange:m,onSpecChange:g}=ed(e);return(0,t.jsxs)(u.Z,{...s,children:[(0,t.jsx)(et,{fullWidth:!1,sx:{mb:2,minWidth:120},margin:"dense",label:o,pluginTypes:n,disabled:c,value:d||r.selection,InputProps:{readOnly:l},error:!!p,helperText:p?.message,onChange:m}),(0,t.jsx)(i.ErrorBoundary,{FallbackComponent:i.ErrorAlert,children:(0,t.jsx)(el,{pluginSelection:r.selection,value:r.spec,onChange:g,isReadonly:l})})]})}function ep(e){let{initialDatasourceDefinition:r,action:n,isDraft:o,isReadonly:a,onActionChange:l,onSave:x,onClose:y,onDelete:j}=e,[C,P]=(0,v.useState)(!1),k=W(n,o),E=K(n,o),{datasourceEditorSchema:T}=U(),Z=(0,b.useForm)({resolver:(0,s.F)(T),mode:"onBlur",defaultValues:r});function w(e){let r={...e};return r.spec.display?.name===void 0&&r.spec.display?.description===void 0&&delete r.spec.display,r}return(0,t.jsxs)(b.FormProvider,{...Z,children:[(0,t.jsxs)(u.Z,{sx:{display:"flex",alignItems:"center",padding:e=>e.spacing(1,2),borderBottom:e=>`1px solid ${e.palette.divider}`},children:[(0,t.jsxs)(d.Z,{variant:"h2",children:[k," Datasource"]}),(0,t.jsx)(i.FormActions,{action:n,submitText:E,isReadonly:a,isValid:Z.formState.isValid,onActionChange:l,onSubmit:Z.handleSubmit(e=>{x(w(e))}),onDelete:j,onCancel:function(){JSON.stringify(r)!==JSON.stringify(w(Z.getValues()))?P(!0):y()}})]}),(0,t.jsxs)(u.Z,{padding:2,sx:{overflowY:"scroll"},children:[(0,t.jsxs)(c.ZP,{container:!0,spacing:2,mb:2,children:[(0,t.jsx)(c.ZP,{item:!0,xs:4,children:(0,t.jsx)(b.Controller,{control:Z.control,name:"name",render:({field:e,fieldState:r})=>(0,t.jsx)(p.Z,{...e,required:!0,fullWidth:!0,name:"name",label:"Name",InputLabelProps:{shrink:"read"===n||void 0},InputProps:{disabled:"update"===n&&!o,readOnly:"read"===n},error:!!r.error,helperText:r.error?.message,value:e.value??"",onChange:r=>{e.onChange(r)}})})}),(0,t.jsx)(c.ZP,{item:!0,xs:8,children:(0,t.jsx)(b.Controller,{control:Z.control,name:"spec.display.name",render:({field:e,fieldState:r})=>(0,t.jsx)(p.Z,{...e,fullWidth:!0,name:"title",label:"Display Label",InputLabelProps:{shrink:"read"===n||void 0},InputProps:{readOnly:"read"===n},error:!!r.error,helperText:r.error?.message,value:e.value??"",onChange:r=>{e.onChange(r)}})})}),(0,t.jsx)(c.ZP,{item:!0,xs:12,children:(0,t.jsx)(b.Controller,{control:Z.control,name:"spec.display.description",render:({field:e,fieldState:r})=>(0,t.jsx)(p.Z,{...e,fullWidth:!0,name:"description",label:"Description",InputLabelProps:{shrink:"read"===n||void 0},InputProps:{readOnly:"read"===n},error:!!r.error,helperText:r.error?.message,value:e.value??"",onChange:r=>{e.onChange(r)}})})}),(0,t.jsx)(c.ZP,{item:!0,xs:6,sx:{paddingTop:"5px !important"},children:(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(b.Controller,{control:Z.control,name:"spec.default",render:({field:e})=>(0,t.jsx)(g.Z,{label:"Set as default",control:(0,t.jsx)(h.Z,{...e,checked:!!e.value,readOnly:"read"===n,onChange:r=>{"read"!==n&&e.onChange(r)}})})}),(0,t.jsxs)(d.Z,{variant:"caption",children:["Whether this datasource should be the default ",Z.getValues().spec.plugin.kind," to be used"]})]})})]}),(0,t.jsx)(f.Z,{}),(0,t.jsx)(d.Z,{py:1,variant:"h3",children:"Plugin Options"}),(0,t.jsx)(b.Controller,{control:Z.control,name:"spec.plugin",render:({field:e})=>(0,t.jsx)(ec,{width:"100%",pluginTypes:["Datasource"],pluginKindLabel:"Source",value:{selection:{type:"Datasource",kind:e.value.kind},spec:e.value.spec},isReadonly:"read"===n,onChange:r=>{e.onChange({kind:r.selection.kind,spec:r.spec})}})})]}),(0,t.jsx)(i.DiscardChangesConfirmationDialog,{description:"Are you sure you want to discard your changes? Changes cannot be recovered.",isOpen:C,onCancel:()=>P(!1),onDiscardChanges:()=>{P(!1),y()}})]})}var em=n(14371),eg=n(11774),eh=n(12577),ef=n(52889),ev=n(75094);let ex=(0,v.createContext)(void 0);function eb(){let e=(0,v.useContext)(ex);if(void 0===e)throw Error("No DatasourceStoreContext found. Did you forget a Provider?");return e}function ey(e,r){let{listDatasourceSelectItems:n}=eb();return(0,G.useQuery)({queryKey:["listDatasourceSelectItems",e,r],queryFn:()=>n(e)})}function ej(e){let r=eb();return(0,G.useQuery)({queryKey:["getDatasourceClient",e],queryFn:()=>r.getDatasourceClient(e)})}function eC(e){let r=eb();return(0,G.useQuery)({queryKey:["getDatasource",e],queryFn:()=>r.getDatasource(e)})}function eP(e,r){let n=eT(e),t=e;return n.sort((e,r)=>r.length-e.length).forEach(e=>{let n=r[e];n&&void 0!==n.value&&(t=ek(t,e,n?.value))}),t}function ek(e,r,n){let t="";return Array.isArray(n)&&(t=`(${n.join("|")})`),"string"==typeof n&&(t=n),(e=e.replaceAll("$"+r,t)).replaceAll("${"+r+"}",t)}let eE=/\$(\w+)|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/gm,eT=e=>{let r;let n=new Set;for(;null!==(r=eE.exec(e));)r&&(r[1]?n.add(r[1]):r[2]&&n.add(r[2]));return Array.from(n.values())},eZ=(0,v.createContext)(void 0);function ew(){let e=(0,v.useContext)(eZ);if(void 0===e)throw Error("No BuiltinVariableContext found. Did you forget a Provider?");return e}function eS(e){let{variables:r}=ew(),n=(0,v.useMemo)(()=>{let e={};for(let n of r)e[n.spec.name]={loading:!1,value:n.spec.value()};return e},[r]),t=(0,v.useMemo)(()=>{let r={};return e?.forEach(e=>{let t=n[e];t&&(r[e]=t)}),r},[e,n]);return void 0===e?n:t}function eV(){let{variables:e}=ew();return e}class eL{[eu.sc]=!0;DEFAULT_LOCAL_SOURCE_NAME="";_state={};get(e){return this._sourceStatesOrEmpty(e.source)[e.name]}set(e,r){let n=this._sourceName(e.source);return this._state[n]||(this._state[n]={}),this._sourceStatesOrEmpty(e.source)[e.name]=r,r}has(e){return void 0!==this._sourceStatesOrEmpty(e.source)[e.name]}delete(e){let r=this.has(e),n=this._sourceName(e.source),t=this._state[n];return t&&delete t[e.name],Object.keys(t??{})?.length===0&&delete this._state[n],r}_sourceName(e){return e??this.DEFAULT_LOCAL_SOURCE_NAME}_sourceStatesOrEmpty(e){return this._state[this._sourceName(e)]??{}}}let ez=(0,v.createContext)(void 0);function eI(e){let{state:r}=function(){let e=(0,v.useContext)(ez);if(void 0===e)throw Error("No VariableContext found. Did you forget a Provider?");return e}(),n=(0,v.useMemo)(()=>{let n={};return e?.forEach(e=>{let t=r[e];t&&(n[e]=t)}),n},[r,e]);return void 0===e?r:n}function eO(e){let r=eI(e),n=eS(e);return(0,v.useMemo)(()=>({...r,...n}),[r,n])}function eR(e){let r=eO(e?eT(e):[]);if(e)return eP(e,r)}let eD="__DATASOURCE_VARIABLE_VALUE__",eA={name:"",value:""};function eM(e){let{datasourcePluginKind:r,value:n,project:i,onChange:o,...a}=e,{data:l,isLoading:s}=ey(r,i),u=eI(),d=(0,v.useMemo)(()=>{if(eF(n))return n;let e=(l??[]).flatMap(e=>e.items).find(e=>n.kind===e.selector.kind&&n.name===e.selector.name&&!e.overridden)?.selector.group;return{...n,group:e}},[n,l]),c=(0,v.useMemo)(()=>{let e=(l||[]).flatMap(e=>e.items.map(r=>({groupLabel:e.group,groupEditLink:e.editLink,name:r.name,overriding:r.overriding,overridden:r.overridden,saved:r.saved??!0,group:r.selector.group,value:e$(r.selector)}))),r=new Map(e.map(e=>[e.name,e]));return[...e,...Object.entries(u).flatMap(([e,n])=>Array.isArray(n.value)||!r.get(n.value??"")?[]:{groupLabel:"Variables",name:`$${e}`,saved:!0,value:`${eD}$${e}`})]},[l,u]),g=s?eA:c.find(e=>e.value===e$(d)),h=e=>{e?o(function(e){if(e.startsWith(eD))return e.split(eD)[1];let r=e.split(eQ),n=r[0],t=r[2];if(void 0===n||void 0===t)throw Error("Invalid optionValue string");return{kind:n,name:""===t?void 0:t}}(e?.value||"")):o({kind:r})},f=()=>{};return(0,t.jsx)(eg.Z,{options:c,renderInput:e=>(0,t.jsx)(p.Z,{...e,label:a.label,placeholder:""}),groupBy:e=>e.groupLabel||"No group",getOptionLabel:e=>e.name,onChange:(e,r)=>h(r),value:g,renderOption:(e,r)=>(0,v.createElement)("li",{...e,key:r.value},(0,t.jsxs)(m.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",width:"100%",children:[(0,t.jsx)(eh.Z,{children:(0,t.jsx)(eq,{name:r.name,overridden:r.overridden,overriding:r.overriding})}),!r.saved&&(0,t.jsx)(eh.Z,{children:"Save the dashboard to enable this datasource"}),(0,t.jsx)(eh.Z,{style:{textAlign:"right"},children:r.groupLabel&&r.groupLabel.length>0&&(0,t.jsx)(ef.Z,{disabled:!1,label:r.groupLabel,size:"small",onDelete:r.groupEditLink?f:void 0,deleteIcon:r.groupEditLink?(0,t.jsx)(ev.Z,{href:r.groupEditLink,target:"_blank",children:(0,t.jsx)(em.default,{fontSize:"small"})}):void 0})})]}))})}function eq(e){let{name:r,overridden:n,overriding:i}=e;return(0,t.jsxs)(t.Fragment,{children:[`${r} `,!n&&i&&(0,t.jsx)(u.Z,{display:"inline",fontWeight:"normal",color:e=>e.palette.primary.main,children:"(overriding)"}),n&&"(overridden)"]})}let eQ="_____";function e$(e){return eF(e)?`${eD}${e}`:[e.kind,e.group??"",e.name??""].join(eQ)}function eF(e){return"string"==typeof e&&e.startsWith("$")}let eN=(e,r,n)=>{if(!eF(e))return e;let[t]=eT(e),i=r[t??""];if(!i||Array.isArray(i.value))return;let o=(n||[]).flatMap(e=>e.items).find(e=>e.name===i.value);if(void 0!==o)return{kind:o.selector.kind,name:o.selector.name}},e_=(e,r)=>{let{data:n}=ey(r),t=eI();return eF(e)?eN(e,t,n)??{kind:r}:e};var eU=n(86396),eB=n(33755),eW=n(90192),eK=n(65091),eH=n(12e3);function eG(e){let{children:r,value:n,index:i,...o}=e,a=n===i;return(0,t.jsx)("div",{role:"tabpanel",hidden:!a,id:`options-editor-tabpanel-${i}`,"aria-labelledby":`options-editor-tab-${i}`,...o,children:a&&(0,t.jsx)(u.Z,{mt:2,children:r})})}let eJ=e=>{let{tabs:r,defaultTab:n,onModeChange:i,isReadonly:o}=e,[a,l]=(0,v.useState)(n);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Z,{sx:{borderBottom:1,borderColor:e=>e.palette.divider},children:(0,t.jsx)(eW.Z,{children:(0,t.jsx)(eK.Z,{row:!0,defaultValue:n,value:a,onChange:(e,r)=>{let n=parseInt(r);l(n),i(n)},"aria-labelledby":"Configuration radio",children:r.map(({label:e},r)=>(0,t.jsx)(g.Z,{disabled:o,value:r,control:(0,t.jsx)(eH.Z,{}),label:e},e))})})}),r.map(({label:e,content:r},n)=>(0,t.jsx)(eG,{value:a,index:n,children:r},e))]})};function eY(e){let{value:r,onChange:n,isReadonly:i,initialSpecDirect:o,initialSpecProxy:a}=e,l="Direct access",s="Proxy",u=(e,r,n)=>void 0===e?e:{...Object.keys(e).reduce((t,i)=>(i===r?t[n]=e[r]||"":t[i]=e[i]||"",t),{})},m=[{label:l,content:(0,t.jsx)(b.Controller,{name:"URL",render:({field:e,fieldState:o})=>(0,t.jsx)(p.Z,{...e,fullWidth:!0,label:"URL",value:r.directUrl||"",error:!!o.error,helperText:o.error?.message,InputProps:{readOnly:i},InputLabelProps:{shrink:!!i||void 0},onChange:t=>{e.onChange(t),n((0,eu.Uy)(r,e=>{e.directUrl=t.target.value}))}})})},{label:s,content:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b.Controller,{name:"URL",render:({field:e,fieldState:o})=>(0,t.jsx)(p.Z,{...e,fullWidth:!0,label:"URL",value:r.proxy?.spec.url||"",error:!!o.error,helperText:o.error?.message,InputProps:{readOnly:i},InputLabelProps:{shrink:!!i||void 0},onChange:t=>{e.onChange(t),n((0,eu.Uy)(r,e=>{void 0!==e.proxy&&(e.proxy.spec.url=t.target.value)}))},sx:{mb:2}})}),(0,t.jsx)(d.Z,{variant:"h4",mb:2,children:"Allowed endpoints"}),(0,t.jsxs)(c.ZP,{container:!0,spacing:2,mb:2,children:[r.proxy?.spec.allowedEndpoints&&r.proxy?.spec.allowedEndpoints.length!==0?r.proxy.spec.allowedEndpoints.map(({endpointPattern:e,method:o},a)=>(0,t.jsxs)(v.Fragment,{children:[(0,t.jsx)(c.ZP,{item:!0,xs:8,children:(0,t.jsx)(b.Controller,{name:`Endpoint pattern ${a}`,render:({field:o,fieldState:l})=>(0,t.jsx)(p.Z,{...o,fullWidth:!0,label:"Endpoint pattern",value:e,error:!!l.error,helperText:l.error?.message,InputProps:{readOnly:i},InputLabelProps:{shrink:!!i||void 0},onChange:e=>{o.onChange(e),n((0,eu.Uy)(r,r=>{void 0!==r.proxy&&(r.proxy.spec.allowedEndpoints=r.proxy.spec.allowedEndpoints?.map((r,n)=>a===n?{endpointPattern:e.target.value,method:r.method}:r))}))}})})}),(0,t.jsx)(c.ZP,{item:!0,xs:3,children:(0,t.jsx)(b.Controller,{name:`Method ${a}`,render:({field:e,fieldState:l})=>(0,t.jsxs)(p.Z,{...e,select:!0,fullWidth:!0,label:"Method",value:o,error:!!l.error,helperText:l.error?.message,InputProps:{readOnly:i},InputLabelProps:{shrink:!!i||void 0},onChange:t=>{e.onChange(t),n((0,eu.Uy)(r,e=>{void 0!==e.proxy&&(e.proxy.spec.allowedEndpoints=e.proxy.spec.allowedEndpoints?.map((e,r)=>a===r?{endpointPattern:e.endpointPattern,method:t.target.value}:e))}))},children:[(0,t.jsx)(H.Z,{value:"GET",children:"GET"}),(0,t.jsx)(H.Z,{value:"POST",children:"POST"}),(0,t.jsx)(H.Z,{value:"PUT",children:"PUT"}),(0,t.jsx)(H.Z,{value:"PATCH",children:"PATCH"}),(0,t.jsx)(H.Z,{value:"DELETE",children:"DELETE"})]})})}),(0,t.jsx)(c.ZP,{item:!0,xs:1,children:(0,t.jsx)(b.Controller,{name:`Remove Endpoint ${a}`,render:({field:e})=>(0,t.jsx)(ev.Z,{...e,disabled:i,onClick:t=>{e.onChange(t),n((0,eu.Uy)(r,e=>{void 0!==e.proxy&&(e.proxy.spec.allowedEndpoints=[...e.proxy.spec.allowedEndpoints?.filter((e,r)=>r!==a)||[]])}))},children:(0,t.jsx)(eU.default,{})})})})]},a)):(0,t.jsx)(c.ZP,{item:!0,xs:4,children:(0,t.jsx)(d.Z,{sx:{fontStyle:"italic"},children:"None"})}),(0,t.jsx)(c.ZP,{item:!0,xs:12,sx:{paddingTop:"0px !important",paddingLeft:"5px !important"},children:(0,t.jsx)(ev.Z,{disabled:i,onClick:()=>n((0,eu.Uy)(r,e=>{void 0!==e.proxy&&(e.proxy.spec.allowedEndpoints=[...e.proxy.spec.allowedEndpoints??[],{endpointPattern:"",method:""}])})),children:(0,t.jsx)(eB.default,{})})})]}),(0,t.jsx)(d.Z,{variant:"h4",mb:2,children:"Request Headers"}),(0,t.jsxs)(c.ZP,{container:!0,spacing:2,mb:2,children:[r.proxy?.spec.headers&&Object.keys(r.proxy.spec.headers).map((e,o)=>(0,t.jsxs)(v.Fragment,{children:[(0,t.jsx)(c.ZP,{item:!0,xs:4,children:(0,t.jsx)(b.Controller,{name:`Header name ${o}`,render:({field:o,fieldState:a})=>(0,t.jsx)(p.Z,{...o,fullWidth:!0,label:"Header name",value:e,error:!!a.error,helperText:a.error?.message,InputProps:{readOnly:i},InputLabelProps:{shrink:!!i||void 0},onChange:t=>{o.onChange(t),n((0,eu.Uy)(r,r=>{void 0!==r.proxy&&(r.proxy.spec.headers=u(r.proxy.spec.headers,e,t.target.value))}))}})})}),(0,t.jsx)(c.ZP,{item:!0,xs:7,children:(0,t.jsx)(b.Controller,{name:`Header value ${o}`,render:({field:o,fieldState:a})=>(0,t.jsx)(p.Z,{...o,fullWidth:!0,label:"Header value",value:r.proxy?.spec.headers?.[e],error:!!a.error,helperText:a.error?.message,InputProps:{readOnly:i},InputLabelProps:{shrink:!!i||void 0},onChange:t=>{o.onChange(t),n((0,eu.Uy)(r,r=>{void 0!==r.proxy&&(r.proxy.spec.headers={...r.proxy.spec.headers,[e]:t.target.value})}))}})})}),(0,t.jsx)(c.ZP,{item:!0,xs:1,children:(0,t.jsx)(b.Controller,{name:`Remove Header ${o}`,render:({field:o})=>(0,t.jsx)(ev.Z,{...o,disabled:i,onClick:t=>{o.onChange(t);let i={...r.proxy?.spec.headers};delete i[e],n((0,eu.Uy)(r,e=>{void 0!==e.proxy&&(e.proxy.spec.headers=i)}))},children:(0,t.jsx)(eU.default,{})})})})]},o)),(0,t.jsx)(c.ZP,{item:!0,xs:12,sx:{paddingTop:"0px !important",paddingLeft:"5px !important"},children:(0,t.jsx)(ev.Z,{disabled:i,onClick:()=>n((0,eu.Uy)(r,e=>{void 0!==e.proxy&&(e.proxy.spec.headers={...e.proxy.spec.headers,"":""})})),children:(0,t.jsx)(eB.default,{})})})]}),(0,t.jsx)(b.Controller,{name:"Secret",render:({field:e,fieldState:o})=>(0,t.jsx)(p.Z,{...e,fullWidth:!0,label:"Secret",value:r.proxy?.spec.secret||"",error:!!o.error,helperText:o.error?.message,InputProps:{readOnly:i},InputLabelProps:{shrink:!!i||void 0},onChange:t=>{e.onChange(t),n((0,eu.Uy)(r,e=>{void 0!==e.proxy&&(e.proxy.spec.secret=t.target.value)}))}})})]})}],g=m.findIndex(e=>e.label===l),h=m.findIndex(e=>e.label===s),f=r.proxy?h:g,[x,y]=(0,v.useState)(o),[j,C]=(0,v.useState)(a);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.Z,{variant:"h4",mt:2,children:"HTTP Settings"}),(0,t.jsx)(eJ,{isReadonly:i,tabs:m,defaultTab:f,onModeChange:e=>{if(m[e]?.label===l){C(r);let{proxy:e,...t}=r;n({...t,directUrl:x.directUrl})}else if(m[e]?.label===s){y(r);let{directUrl:e,...t}=r;n({...t,proxy:j.proxy})}}})]})}var eX=n(38475);let e0=["mean","first","first-number","last","last-number","min","max","sum"],e1={bottom:{label:"Bottom"},right:{label:"Right"}},e2={list:{label:"List"},table:{label:"Table"}},e5={small:{label:"Small"},medium:{label:"Medium"}},e4=e0.reduce((e,r)=>(e[r]=o[r],e),{});function e3(e){return void 0===e||!!((0,eX.vo)(e.position)&&(!e.mode||(0,eX.kx)(e.mode))&&(!e.size||(0,eX.BL)(e.size)))}let e7=Object.entries(e1).map(([e,r])=>({id:e,...r})),e6=Object.entries(e2).map(([e,r])=>({id:e,...r})),e8=Object.entries(e5).map(([e,r])=>({id:e,...r})),e9=Object.entries(e4).map(([e,r])=>({id:e,...r}));function re({value:e,onChange:r,showValuesEditor:n=!0}){let o=e3(e),a=(0,eX.Jj)(e?.position),l=e1[a],s=(0,eX.bk)(e?.mode),u=e2[s],d=(0,eX.dT)(e?.size),c=e5[d],p=(e?.values||[]).reduce((e,r)=>{let n=e4[r];return n&&e.push({...n,id:r}),e},[]);return(0,t.jsxs)(i.OptionsEditorGroup,{title:"Legend",children:[!o&&(0,t.jsx)(i.ErrorAlert,{error:{name:"invalid-legend",message:"Invalid legend spec"}}),(0,t.jsx)(i.OptionsEditorControl,{label:"Show",control:(0,t.jsx)(h.Z,{checked:void 0!==e,onChange:(e,n)=>{r(!0===n?{position:eX.zx.position}:void 0)}})}),(0,t.jsx)(i.OptionsEditorControl,{label:"Position",control:(0,t.jsx)(i.SettingsAutocomplete,{value:{...l,id:a},options:e7,onChange:(n,t)=>{r({...e,position:t.id})},disabled:void 0===e,disableClearable:!0})}),(0,t.jsx)(i.OptionsEditorControl,{label:"Mode",control:(0,t.jsx)(i.SettingsAutocomplete,{value:{...u,id:s},options:e6,onChange:(n,t)=>{r({...e,position:a,mode:t.id})},disabled:void 0===e,disableClearable:!0})}),(0,t.jsx)(i.OptionsEditorControl,{label:"Size",control:(0,t.jsx)(i.SettingsAutocomplete,{value:{...c,id:d},options:e8,onChange:(n,t)=>{r({...e,position:a,size:t.id})},disabled:void 0===e||"table"!==s,disableClearable:!0})}),n&&(0,t.jsx)(i.OptionsEditorControl,{label:"Values",control:(0,t.jsx)(i.SettingsAutocomplete,{multiple:!0,disableCloseOnSelect:!0,disableClearable:!0,value:p,options:e9,onChange:(n,t)=>{r({...e,position:a,values:t.map(e=>e.id)})},disabled:void 0===e||"table"!==s,limitTags:1,ChipProps:{size:"small"}})})]})}var rr=n(48565),rn=n(22446),rt=n(12449),ri=n(84974);let ro=({queryTypes:e,index:r,query:n,isCollapsed:i,onDelete:o,onChange:a,onCollapseExpand:l})=>(0,t.jsxs)(m.Z,{spacing:1,children:[(0,t.jsxs)(m.Z,{direction:"row",alignItems:"center",borderBottom:1,borderColor:e=>e.palette.divider,children:[(0,t.jsx)(ev.Z,{size:"small",onClick:()=>l(r),children:i?(0,t.jsx)(ri.default,{}):(0,t.jsx)(rt.default,{})}),(0,t.jsxs)(d.Z,{variant:"overline",component:"h4",children:["Query #",r+1]}),(0,t.jsx)(ev.Z,{size:"small",sx:{marginLeft:"auto",visibility:`${o?"visible":"hidden"}`},onClick:()=>o&&o(r),children:(0,t.jsx)(rn.default,{})})]}),!i&&(0,t.jsx)(ra,{queryTypes:e,value:n,onChange:e=>a(r,e)})]},r);function ra(e){let{value:r,onChange:n,queryTypes:i,...o}=e;return(0,t.jsx)(u.Z,{...o,children:(0,t.jsx)(ec,{pluginTypes:i,pluginKindLabel:"Query Type",value:{selection:{kind:r.spec.plugin.kind,type:r.kind},spec:r.spec.plugin.spec},onChange:e=>{n((0,eu.Uy)(r,r=>{r.kind=e.selection.type,r.spec.plugin.kind=e.selection.kind,r.spec.plugin.spec=e.spec}))}})})}function rl({queryTypes:e,queries:r=[],onChange:n}){let{defaultInitialQueryDefinition:i,isLoading:o}=function(e){let r=e[0],{data:n,isLoading:t}=er(e),{defaultPluginKinds:i}=Y(),o=i?.[r]??n?.[0]?.spec.name??"",{data:a}=X(r,o,{throwOnError:!0,enabled:!0});return{defaultInitialQueryDefinition:{kind:r,spec:{plugin:{kind:o,spec:a?.createInitialOptions()||{}}}},isLoading:t}}(e),[a,l]=(0,v.useState)(r.map(()=>!1)),s=(e,t)=>{n((0,eu.Uy)(r,r=>{r?r[e]=t:r=[t]}))},u=e=>{n((0,eu.Uy)(r,r=>{r.splice(e,1)})),l(r=>(r.splice(e,1),[...r]))},d=e=>{l(r=>(r[e]=!r[e],[...r]))},c=r.length?r:o?[]:[i];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.Z,{spacing:1,children:c.map((n,i)=>(0,t.jsx)(ro,{queryTypes:e,index:i,query:n,isCollapsed:!!a[i],onChange:s,onDelete:r.length>1?u:void 0,onCollapseExpand:d},i))}),(0,t.jsx)(rr.Z,{variant:"contained",startIcon:(0,t.jsx)(eB.default,{}),sx:{marginTop:1},onClick:()=>{n((0,eu.Uy)(r,e=>{e?e.push(i):e=[...r,i]})),l(e=>(e.push(!1),[...e]))},children:"Add Query"})]})}var rs=n(51781),ru=n(49408);let rd=({tabs:e})=>{let[r,n]=(0,v.useState)(0);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Z,{sx:{borderBottom:1,borderColor:e=>e.palette.divider},children:(0,t.jsx)(rs.Z,{value:r,onChange:(e,r)=>{n(r)},"aria-label":"Panel configuration tabs",children:e.map(({label:e},r)=>(0,t.jsx)(ru.Z,{label:e,id:`options-editor-tab-${r}`,"aria-controls":`options-editor-tabpanel-${r}`},e))})}),e.map(({label:e,content:n},i)=>(0,t.jsx)(eG,{value:r,index:i,children:n},e))]})},rc=(0,v.createContext)(0),rp=({queryCount:e,children:r})=>(0,t.jsx)(rc.Provider,{value:e,children:r}),rm=()=>(0,v.useContext)(rc);function rg(e){let{control:r,panelDefinition:n,onJSONChange:o,onQueriesChange:a,onPluginSpecChange:l}=e,{kind:s}=n.spec.plugin,{data:u,isPending:d,error:c}=X("Panel",s);if(c)return(0,t.jsx)(i.ErrorAlert,{error:c});if(d)return null;if(void 0===u)throw Error(`Missing implementation for panel plugin with kind '${s}'`);let{panelOptionsEditorComponents:p,hideQueryEditor:m}=u,g=[];return m||g.push({label:"Query",content:(0,t.jsx)(b.Controller,{control:r,name:"panelDefinition.spec.queries",render:({field:e})=>(0,t.jsx)(rl,{queryTypes:u.supportedQueryTypes??[],queries:n.spec.queries??[],onChange:r=>{e.onChange(r),a(r)}})})}),void 0!==p&&(g=g.concat(p.map(({label:e,content:i})=>({label:e,content:(0,t.jsx)(b.Controller,{control:r,name:"panelDefinition.spec.plugin.spec",render:({field:e})=>(0,t.jsx)(i,{value:n.spec.plugin.spec,onChange:r=>{e.onChange(r),l(r)}})})})))),g.push({label:"Links",content:(0,t.jsx)(i.LinksEditor,{control:r})}),g.push({label:"JSON",content:(0,t.jsx)(b.Controller,{control:r,name:"panelDefinition",render:({field:e})=>(0,t.jsx)(i.JSONEditor,{maxHeight:"80vh",value:n,onChange:r=>{e.onChange(JSON.parse(r)),o(r)}})})}),(0,t.jsx)(rp,{queryCount:(n.spec.queries??[]).length,children:(0,t.jsx)(rd,{tabs:g},g.length)})}function rh(e){let{pluginLoader:{getInstalledPlugins:r,importPluginModule:n},children:i,defaultPluginKinds:o}=e,a=function(e){let r=es(async()=>{let r=await e(),n=new Map,t=new Map;for(let e of r)for(let r of e.spec.plugins){var i,o;let{kind:a,spec:{name:l}}=r,s=(i=a,o=l,`${i}:${o}`);n.has(s)&&console.warn(`Got more than one ${a} plugin for kind ${l}`),n.set(s,e);let u=t.get(a);void 0===u&&(u=[],t.set(a,u)),u.push({...r,module:e.metadata})}return{pluginResourcesByNameAndKind:n,pluginMetadataByKind:t}}),n=(0,v.useRef)(void 0);return(0,v.useCallback)(()=>{let e=n.current;return void 0===e&&(e=r(),n.current=e,e.catch(()=>void 0===n.current)),e},[r])}(r),l=(0,v.useRef)(new Map),s=es(e=>{let r=l.current.get(e);return void 0===r&&(r=n(e),l.current.set(e,r),r.catch(()=>l.current.delete(e))),r}),u=(0,v.useCallback)(async(e,r)=>{let n=await a(),t=`${e}:${r}`,i=n.pluginResourcesByNameAndKind.get(t);if(void 0===i)throw Error(`A ${r} plugin for kind '${e}' is not installed`);let o=(await s(i))[r];if(void 0===o)throw Error(`The ${r} plugin for kind '${e}' is missing from the ${i.metadata.name} plugin module`);return o},[a,s]),d=(0,v.useCallback)(async e=>{let r=await a();return e.flatMap(e=>r.pluginMetadataByKind.get(e)??[])},[a]),c=(0,v.useMemo)(()=>({getPlugin:u,listPluginMetadata:d,defaultPluginKinds:o}),[u,d,o]);return(0,t.jsx)(J.Provider,{value:c,children:i})}var rf=n(67877),rv=n(28278),rx=n(17001),rb=n(93729);let ry={refreshVariableValues:"Refresh values",copyVariableValues:"Copy values to clipboard",refresh:"Refresh",refreshInterval:"Auto refresh interval",zoomIn:"Zoom in",zoomOut:"Zoom out"};var rj=n(20461);let rC=(0,v.createContext)(void 0);function rP(){let e=(0,v.useContext)(rC);if(void 0===e)throw Error("No TimeRangeContext found. Did you forget a Provider?");return e}function rk(){return rP()}function rE(e){let{absoluteTimeRange:r}=rk();return void 0===e?0:(0,rb.YF)(r,e)}function rT(e){let{timeRange:r,refreshInterval:n,children:i,setTimeRange:o,setRefreshInterval:a}=e,[l,s]=(0,v.useState)(r),[u,d]=(0,v.useState)(n),[c,p]=(0,v.useState)(0);(0,v.useEffect)(()=>{s(r)},[r,c]),(0,v.useEffect)(()=>{d(n)},[n]);let m=(0,v.useCallback)(()=>{p(e=>e+1)},[p]),g=null!=u?(0,rj.milliseconds)((0,rb.Ib)(u)):0;(0,v.useEffect)(()=>{if(g>0){let e=setInterval(()=>{m()},g);return()=>clearInterval(e)}},[m,g]);let h=(0,v.useMemo)(()=>{let e=(0,rb.s3)(l)?(0,rb.sG)(l):l;return{timeRange:l,setTimeRange:o??s,absoluteTimeRange:e,refresh:m,refreshKey:`${e.start}:${e.end}:${u}:${c}`,refreshInterval:u,refreshIntervalInMs:g,setRefreshInterval:a??d}},[l,o,m,u,c,g,a]);return(0,t.jsx)(rC.Provider,{value:h,children:i})}let rZ={showCustom:!0,showZoomButtons:!0,options:["5m","15m","30m","1h","6h","12h","24h","7d","14d"].map(e=>(0,i.buildRelativeTimeOption)(e))},rw=(0,v.createContext)(rZ);function rS(){let e=(0,v.useContext)(rw);if(void 0===e)throw Error("No TimeRangeContext found. Did you forget a Provider?");return e}function rV(){return rS()}function rL(e){let r=rV().showCustom;return void 0!==e?e:r}function rz(e){let r=rV().showZoomButtons;return void 0!==e?e:r}function rI(e){let r=rV().options;return void 0!==e?e:r}function rO(e){let r=(0,v.useMemo)(()=>({showCustom:void 0===e.showCustom?rZ.showCustom:e.showCustom,showZoomButtons:void 0===e.showZoomButtons?rZ.showZoomButtons:e.showZoomButtons,options:void 0===e.options?rZ.options:e.options}),[e.showCustom,e.showZoomButtons,e.options]);return(0,t.jsx)(rw.Provider,{value:r,children:e.children})}let rR=[{value:{pastDuration:"0s"},display:"Off"},{value:{pastDuration:"5s"},display:"5s"},{value:{pastDuration:"10s"},display:"10s"},{value:{pastDuration:"15s"},display:"15s"},{value:{pastDuration:"30s"},display:"30s"},{value:{pastDuration:"60s"},display:"1m"}];function rD({heightPx:e,showTimeRangeSelector:r=!0,showRefreshButton:n=!0,showRefreshInterval:o=!0,showCustomTimeRange:a,showZoomButtons:l=!0,timePresets:s}){let{timeRange:u,setTimeRange:d,refresh:c,refreshInterval:p,setRefreshInterval:g}=rk(),h=rL(a),f=rz(l),x=rI(s),b=void 0===e?"34px":`${e}px`;"pastDuration"in u&&!x.some(e=>e.value.pastDuration===u.pastDuration)&&x.push((0,i.buildRelativeTimeOption)(u.pastDuration));let y=(0,v.useCallback)(e=>{g(e)},[g]),j=e=>{let r=(0,rb.Ib)(e);return((r.seconds??0)+(r.minutes??0)*60+(r.hours??0)*3600+(r.days??0)*86400+(r.weeks??0)*604800+(r.months??0)*2629746+(r.years??0)*0x1e18558)*1e3},C=()=>{let e,r,n;let t=new Date;return Object.hasOwn(u,"start")?(n=(u.end.getTime()-u.start.getTime())/2,e=new Date(u.start.getTime()-n),r=new Date(u.end.getTime()+n)):(n=j(u.pastDuration)/2,e=new Date((r=void 0===u.end?t:new Date(u.end.getTime()+n)).getTime()-4*n)),r.getTime()>t.getTime()&&(r=t,e.setTime(t.getTime()-4*n)),1>e.getTime()&&e.setTime(1),{start:e,end:r}},P=()=>{let e,r;if(Object.hasOwn(u,"start")){let n=(u.end.getTime()-u.start.getTime())/4;e=new Date(u.start.getTime()+n),r=new Date(u.end.getTime()-n)}else{let n=j(u.pastDuration)/4;e=new Date((r=void 0!==u.end?new Date(u.end.getTime()-n):new Date).getTime()-2*n)}return e.getTime()>=r.getTime()-1e3&&e.setTime(r.getTime()-1e3),{start:e,end:r}};return(0,t.jsxs)(m.Z,{direction:"row",spacing:1,children:[r&&(0,t.jsx)(i.TimeRangeSelector,{timeOptions:x,value:u,onChange:d,height:b,showCustomTimeRange:h}),f&&(0,t.jsx)(i.InfoTooltip,{description:ry.zoomOut,children:(0,t.jsx)(i.ToolbarIconButton,{"aria-label":ry.zoomOut,onClick:()=>d(C()),sx:{height:b},children:(0,t.jsx)(rx.default,{})})}),f&&(0,t.jsx)(i.InfoTooltip,{description:ry.zoomIn,children:(0,t.jsx)(i.ToolbarIconButton,{"aria-label":ry.zoomIn,onClick:()=>d(P()),sx:{height:b},children:(0,t.jsx)(rv.default,{})})}),n&&(0,t.jsx)(i.InfoTooltip,{description:ry.refresh,children:(0,t.jsx)(i.ToolbarIconButton,{"aria-label":ry.refresh,onClick:c,sx:{height:b},children:(0,t.jsx)(rf.default,{})})}),o&&(0,t.jsx)(i.InfoTooltip,{description:ry.refreshInterval,children:(0,t.jsx)(i.RefreshIntervalPicker,{timeOptions:rR,value:p,onChange:y,height:b})})]})}function rA(e,r){let n=[],t=new Set;for(let i of e){let e=i.value.matchAll(r),o="";for(let r of e)for(let e=1;e<r.length;e++){let n=r[e];void 0!==n&&(o=`${o}${n}`)}""===o||t.has(o)||(t.add(o),n.push({label:i.label,value:o}))}return n}function rM(e){let r;let{data:n}=X("Variable",e.spec.plugin.kind),t=eb(),i=eO(),{absoluteTimeRange:o,refreshKey:a}=rk(),l=e.spec.plugin.spec,s=void 0!==e.spec.capturingRegexp?RegExp(e.spec.capturingRegexp,"g"):void 0;n?.dependsOn&&(r=n.dependsOn(l,{timeRange:o,datasourceStore:t,variables:i}).variables);let u=eO(r),d=!1;r&&(d=r.some(e=>u[e]?.loading));let c=rq(u);return(0,G.useQuery)({queryKey:[e,c,o,a],queryFn:async()=>{let e=await n?.getVariableOptions(l,{datasourceStore:t,variables:u,timeRange:o});return void 0===e?[]:s?rA(e.data,s):e.data},enabled:!!n||d})}function rq(e){return Object.values(e).map(e=>JSON.stringify(e.value)).join(",")}let rQ=[{label:"List",kind:"ListVariable"},{label:"Text",kind:"TextVariable"}];var r$=n(70313),rF=n(84954),rN=n(315),r_=n(50898),rU=n(60993);function rB(e){let{values:r,onRefresh:n,isLoading:o,error:a}=e,[l,s]=(0,v.useState)(50),{infoSnackbar:c}=(0,i.useSnackbar)(),p=0;return r&&r?.length>0&&l&&(p=r.length-l),(0,t.jsxs)(u.Z,{children:[(0,t.jsxs)(m.Z,{direction:"row",spacing:1,alignItems:"center",mb:1,children:[(0,t.jsx)(d.Z,{variant:"h4",children:"Preview Values"}),n&&(0,t.jsx)(i.InfoTooltip,{description:ry.refreshVariableValues,children:(0,t.jsx)(ev.Z,{onClick:n,size:"small",children:(0,t.jsx)(rf.default,{})})}),(0,t.jsx)(i.InfoTooltip,{description:ry.copyVariableValues,children:(0,t.jsx)(ev.Z,{onClick:async()=>{r?.length&&(await navigator.clipboard.writeText(r.map(e=>e).join(", ")),c("Preview values copied to clipboard!"))},size:"small",children:(0,t.jsx)(rU.default,{})})})]}),(0,t.jsx)(rF.Z,{variant:"outlined",children:(0,t.jsxs)(u.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1,m:2},children:[a&&(0,t.jsx)(rN.Z,{severity:"error",children:a}),r?.length===0&&(0,t.jsx)(rN.Z,{severity:"info",children:"No results"}),o&&(0,t.jsx)(m.Z,{width:"100%",sx:{alignItems:"center",justifyContent:"center"},children:(0,t.jsx)(r_.Z,{})}),r?.slice(0,l).map((e,r)=>t.jsx(ef.Z,{size:"small",label:e},r)),p>0&&(0,t.jsx)(ef.Z,{onClick:()=>{s(void 0)},variant:"outlined",size:"small",label:`+${p} more`})]})})]})}function rW(e){let{definition:r,onRefresh:n}=e,{data:i,isFetching:o,error:a}=rM(r),l=a?.message;return(0,t.jsx)(rB,{values:i?.map(e=>e.value)||[],onRefresh:n,isLoading:o,error:l})}function rK(){return(0,t.jsx)("div",{children:"Error previewing values"})}function rH({action:e,control:r}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.Z,{py:1,variant:"subtitle1",children:"Text Options"}),(0,t.jsxs)(m.Z,{spacing:2,children:[(0,t.jsx)(b.Controller,{control:r,name:"spec.value",render:({field:r,fieldState:n})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Z,{children:(0,t.jsx)(rB,{values:[r.value]})}),(0,t.jsx)(p.Z,{...r,label:"Value",InputLabelProps:{shrink:"read"===e||void 0},InputProps:{readOnly:"read"===e},error:!!n.error,helperText:n.error?.message,value:r.value??"",onChange:e=>{r.onChange(e)}})]})}),(0,t.jsx)(b.Controller,{control:r,name:"spec.constant",render:({field:r})=>(0,t.jsx)(g.Z,{label:"Constant",control:(0,t.jsx)(h.Z,{...r,checked:!!r.value,readOnly:"read"===e,value:r.value??!1,onChange:n=>{"read"!==e&&r.onChange(n)}})})})]})]})}function rG({action:e,control:r}){let n=(0,b.useFormContext)(),[o,a]=(0,v.useState)(n.getValues()),l=()=>{a(n.getValues())},s=(0,b.useWatch)({control:r,name:"spec.plugin"}),c=s?.kind,x=s?.spec,y=(0,b.useWatch)({control:r,name:"spec.allowAllValue"}),j=n.getValues();return void 0===j.spec.allowAllValue&&n.setValue("spec.allowAllValue",!1),void 0===j.spec.allowMultiple&&n.setValue("spec.allowMultiple",!1),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.Z,{py:1,variant:"subtitle1",children:"List Options"}),(0,t.jsxs)(m.Z,{spacing:2,mb:2,children:[c?(0,t.jsx)(u.Z,{children:(0,t.jsx)(i.ErrorBoundary,{FallbackComponent:rK,resetKeys:[o],children:(0,t.jsx)(rW,{definition:o,onRefresh:l})})}):(0,t.jsx)(rB,{isLoading:!0}),(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(r$.d,{onClickAway:()=>l(),children:(0,t.jsx)(u.Z,{})}),(0,t.jsx)(i.ErrorBoundary,{FallbackComponent:i.ErrorAlert,children:(0,t.jsx)(b.Controller,{control:r,name:"spec.plugin",render:({field:r})=>(0,t.jsx)(ec,{width:"100%",pluginTypes:["Variable"],pluginKindLabel:"Source",value:{selection:{type:"Variable",kind:c??"StaticListVariable"},spec:x??{values:[]}},isReadonly:"read"===e,onChange:e=>{r.onChange({kind:e.selection.kind,spec:e.spec})}})})})]}),(0,t.jsx)(m.Z,{children:(0,t.jsx)(b.Controller,{control:r,name:"spec.capturingRegexp",render:({field:r,fieldState:n})=>(0,t.jsx)(p.Z,{...r,label:"Capturing Regexp Filter",InputLabelProps:{shrink:"read"===e||void 0},InputProps:{readOnly:"read"===e},error:!!n.error,value:r.value??"",onChange:e=>{""===e.target.value?r.onChange(void 0):r.onChange(e)},helperText:n.error?.message?n.error.message:"Optional, if you want to filter on captured result."})})}),(0,t.jsx)(m.Z,{children:(0,t.jsx)(b.Controller,{control:r,name:"spec.sort",render:({field:r,fieldState:n})=>(0,t.jsxs)(p.Z,{select:!0,...r,fullWidth:!0,label:"Sort",InputLabelProps:{shrink:"read"===e||void 0},InputProps:{readOnly:"read"===e},error:!!n.error,helperText:n.error?.message,value:r.value??"none",onChange:e=>{r.onChange(e)},children:[(0,t.jsx)(H.Z,{value:"none",children:"None"}),(0,t.jsx)(H.Z,{value:"alphabetical-asc",children:"Alphabetical, asc"}),(0,t.jsx)(H.Z,{value:"alphabetical-desc",children:"Alphabetical, desc"}),(0,t.jsx)(H.Z,{value:"numerical-asc",children:"Numerical, asc"}),(0,t.jsx)(H.Z,{value:"numerical-desc",children:"Numerical, desc"}),(0,t.jsx)(H.Z,{value:"alphabetical-ci-asc",children:"Alphabetical, case-insensitive, asc"}),(0,t.jsx)(H.Z,{value:"alphabetical-ci-desc",children:"Alphabetical, case-insensitive, desc"})]})})})]}),(0,t.jsx)(f.Z,{}),(0,t.jsx)(d.Z,{py:1,variant:"subtitle1",children:"Dropdown Options"}),(0,t.jsxs)(m.Z,{spacing:"2",children:[(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(b.Controller,{control:r,name:"spec.allowMultiple",render:({field:r})=>(0,t.jsx)(g.Z,{label:"Allow Multiple Values",control:(0,t.jsx)(h.Z,{...r,checked:!!r.value,readOnly:"read"===e,value:r.value??!1,onChange:n=>{"read"!==e&&r.onChange(n)}})})}),(0,t.jsx)(d.Z,{variant:"caption",children:"Enables multiple values to be selected at the same time"})]}),(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(b.Controller,{control:r,name:"spec.allowAllValue",render:({field:r})=>(0,t.jsx)(g.Z,{label:"Allow All option",control:(0,t.jsx)(h.Z,{...r,checked:!!r.value,readOnly:"read"===e,value:r.value??!1,onChange:n=>{"read"!==e&&r.onChange(n)}})})}),(0,t.jsx)(d.Z,{mb:1,variant:"caption",children:"Enables an option to include all variable values"}),y&&(0,t.jsx)(b.Controller,{control:r,name:"spec.customAllValue",render:({field:r,fieldState:n})=>(0,t.jsx)(p.Z,{...r,fullWidth:!0,label:"Custom All Value",InputLabelProps:{shrink:"read"===e||void 0},InputProps:{readOnly:"read"===e},error:!!n.error,helperText:n.error?.message?n.error.message:"When All is selected, this value will be used",value:r.value??"",onChange:e=>{""===e.target.value?r.onChange(void 0):r.onChange(e)}})})]})]})]})}function rJ({initialVariableDefinition:e,action:r,isDraft:n,isReadonly:o,onActionChange:a,onSave:l,onClose:m,onDelete:g}){let[h,x]=(0,v.useState)(!1),y=W(r,n),j=K(r,n),{variableEditorSchema:C}=U(),P=(0,b.useForm)({resolver:(0,s.F)(C),mode:"onBlur",defaultValues:e}),k=(0,b.useWatch)({control:P.control,name:"kind"});function E(e){let r={...e};return r.spec.display?.name===void 0&&r.spec.display?.description===void 0&&r.spec.display?.hidden===void 0&&delete r.spec.display,r}return(0,t.jsxs)(b.FormProvider,{...P,children:[(0,t.jsxs)(u.Z,{sx:{display:"flex",alignItems:"center",padding:e=>e.spacing(1,2),borderBottom:e=>`1px solid ${e.palette.divider}`},children:[(0,t.jsxs)(d.Z,{variant:"h2",children:[y," Variable"]}),(0,t.jsx)(i.FormActions,{action:r,submitText:j,isReadonly:o,isValid:P.formState.isValid,onActionChange:a,onSubmit:P.handleSubmit(e=>{l(E(e))}),onDelete:g,onCancel:function(){JSON.stringify(e)!==JSON.stringify(E(P.getValues()))?x(!0):m()}})]}),(0,t.jsxs)(u.Z,{padding:2,sx:{overflowY:"scroll"},children:[(0,t.jsxs)(c.ZP,{container:!0,spacing:2,mb:2,children:[(0,t.jsx)(c.ZP,{item:!0,xs:8,children:(0,t.jsx)(b.Controller,{control:P.control,name:"spec.name",render:({field:e,fieldState:i})=>(0,t.jsx)(p.Z,{...e,required:!0,fullWidth:!0,label:"Name",InputLabelProps:{shrink:"read"===r||void 0},InputProps:{disabled:"update"===r&&!n,readOnly:"read"===r},error:!!i.error,helperText:i.error?.message,value:e.value??"",onChange:r=>{e.onChange(r)}})})}),(0,t.jsx)(c.ZP,{item:!0,xs:4,children:(0,t.jsx)(b.Controller,{control:P.control,name:"spec.display.name",render:({field:e,fieldState:n})=>(0,t.jsx)(p.Z,{...e,fullWidth:!0,label:"Display Label",InputLabelProps:{shrink:"read"===r||void 0},InputProps:{readOnly:"read"===r},error:!!n.error,helperText:n.error?.message,value:e.value??"",onChange:r=>{e.onChange(r)}})})}),(0,t.jsx)(c.ZP,{item:!0,xs:8,children:(0,t.jsx)(b.Controller,{control:P.control,name:"spec.display.description",render:({field:e,fieldState:n})=>(0,t.jsx)(p.Z,{...e,fullWidth:!0,label:"Description",InputLabelProps:{shrink:"read"===r||void 0},InputProps:{readOnly:"read"===r},error:!!n.error,helperText:n.error?.message,value:e.value??"",onChange:r=>{e.onChange(r)}})})}),(0,t.jsx)(c.ZP,{item:!0,xs:4,children:(0,t.jsx)(b.Controller,{control:P.control,name:"kind",render:({field:e,fieldState:n})=>(0,t.jsx)(p.Z,{select:!0,...e,fullWidth:!0,label:"Type",InputLabelProps:{shrink:"read"===r||void 0},InputProps:{readOnly:"read"===r},error:!!n.error,helperText:n.error?.message,value:e.value??"TextVariable",onChange:r=>{e.onChange(r)},children:rQ.map(e=>(0,t.jsx)(H.Z,{value:e.kind,children:e.label},e.kind))})})})]}),(0,t.jsx)(f.Z,{}),"TextVariable"===k&&(0,t.jsx)(i.ErrorBoundary,{FallbackComponent:i.ErrorAlert,children:(0,t.jsx)(rH,{action:r,control:P.control})}),"ListVariable"===k&&(0,t.jsx)(i.ErrorBoundary,{FallbackComponent:i.ErrorAlert,children:(0,t.jsx)(rG,{action:r,control:P.control})})]}),(0,t.jsx)(i.DiscardChangesConfirmationDialog,{description:"Are you sure you want to discard these changes? Changes cannot be recovered.",isOpen:h,onCancel:()=>{x(!1)},onDiscardChanges:()=>{x(!1),m()}})]})}var rY=n(63767),rX=n(76251),r0=n(51564);let r1=(0,v.createContext)(void 0);function r2(){return(0,G.useQuery)({queryKey:["projects"],queryFn:()=>(0,rX.rd)("/api/v1/projects")})}function r5(){let e=(0,v.useContext)(r1);if(void 0===e)throw Error("No ProjectStoreContext found. Did you forget a Provider?");return e}function r4(e){let{children:r,enabledURLParams:n}=e,{project:i,setProject:o}=function(e=!0){let[r,n]=(0,r0.useQueryParams)({project:""},{updateType:"replaceIn"}),[t,i]=(0,v.useState)("none"),o=(0,v.useCallback)(e=>n({project:e}),[n]);return e?{project:r.project||"none",setProject:o}:{project:t,setProject:i}}(n),a=(0,v.useMemo)(()=>({project:{kind:"Project",metadata:{name:i}},setProject:e=>{o(e.metadata.name)}}),[i,o]);return(0,t.jsx)(r1.Provider,{value:a,children:r})}function r3(e){let{onChange:r,value:n,...i}=e,{data:o,isLoading:a}=r2(),l=a?"":n.metadata.name??"none";return(0,t.jsxs)(rY.Z,{...i,value:l,onChange:e=>{r({kind:"Project",metadata:{name:e.target.value},spec:{}})},children:[(0,t.jsx)(H.Z,{value:"none",children:(0,t.jsx)(m.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",width:"100%",height:32,children:(0,t.jsx)(eh.Z,{children:"None"})})}),o?.map(e=>[t.jsx(H.Z,{value:e.metadata.name,children:t.jsx(m.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",width:"100%",height:32,children:t.jsx(eh.Z,{children:e.metadata.name})})},e.metadata.name)])]})}let r7=({value:e,onChange:r})=>(0,t.jsx)(i.OptionsEditorControl,{label:"Metric label",description:"Specify label to display",control:(0,t.jsx)(p.Z,{fullWidth:!0,name:"Metric label",value:e||"",onChange:e=>{r(e.target.value||void 0)}})});function r6(e){let r=new Map(e.map(e=>[e.resource,e.importPlugin]));return{getInstalledPlugins:async()=>Promise.resolve(Array.from(r.keys())),importPluginModule(e){let n=r.get(e);if(void 0===n)throw Error("Plugin not found");return n()}}}function r8(e){return!e||"string"==typeof e&&(0,rb.fs)(e)?e:(1e3*(0,rj.getUnixTime)(e)).toString()}function r9(e){let r=function(e,r){if(!e||0===e.length)return null;let n=e instanceof Array?e[0]:e;return null==n?n:""!==n?n:null}(e);return r?(0,rb.fs)(r)?r:new Date(Number(r)):null}let ne={encode:r8,decode:r9,equals:(e,r)=>e===r||(e&&r?e.valueOf()===r.valueOf():e===r)},nr={start:ne,end:ne},nn={refresh:ne};function nt(e){let[r]=(0,r0.useQueryParams)(nr,{updateType:"replaceIn"}),{start:n,end:t}=r;return(0,v.useMemo)(()=>{let r={pastDuration:e};if(!n)return r;let i=n.toString();return(0,rb.fs)(i)?r={pastDuration:i}:(0,rj.isDate)(n)&&(0,rj.isDate)(t)&&(r={start:n,end:t}),r},[n,t,e])}function ni(e){let[r,n]=(0,r0.useQueryParams)(nr,{updateType:"replaceIn"}),[t,i]=(0,v.useState)(!1),{start:o}=r;return(0,v.useEffect)(()=>{!t&&!o&&(0,rb.s3)(e)&&(n({start:e.pastDuration,end:void 0}),i(!0))},[e,t,o,n]),{timeRange:e,setTimeRange:(0,v.useCallback)(e=>{(0,rb.s3)(e)?n({start:e.pastDuration,end:void 0}):n(e)},[n])}}function no(e){let[r]=(0,r0.useQueryParams)(nn,{updateType:"replaceIn"}),{refresh:n}=r;return(0,v.useMemo)(()=>{let r=e;if(!n)return r;let t=n.toString();return(0,rb.fs)(t)&&(r=t),r},[e,n])}function na(e){let[r,n]=(0,r0.useQueryParams)(nn,{updateType:"replaceIn"}),[t,i]=(0,v.useState)(!1),{refresh:o}=r;return(0,v.useEffect)(()=>{t||o||(n({refresh:e}),i(!0))},[e,t,o,n]),{refreshInterval:e,setRefreshInterval:(0,v.useCallback)(e=>n({refresh:e}),[n])}}function nl(e){let{initialTimeRange:r,initialRefreshInterval:n,children:i}=e,{timeRange:o,setTimeRange:a}=ni(r),{refreshInterval:l,setRefreshInterval:s}=na(n);return(0,t.jsx)(rT,{timeRange:o,refreshInterval:l,setTimeRange:a,setRefreshInterval:s,children:i})}function ns(e,r){return r?Object.fromEntries(Object.entries(e).filter(([e])=>r.includes(e))):e}function nu(e){return Object.values(e).map(e=>JSON.stringify(e.value)).join(",")}let nd="TimeSeriesQuery";function nc({plugin:e,definition:r,context:n}){let{timeRange:t,datasourceStore:i,suggestedStepMs:o,mode:a,variableState:l,refreshKey:s}=n,u=e?.dependsOn?e.dependsOn(r.spec.plugin.spec,n):{},d=u?.variables,c=[r,t,i,o,a,nu(ns(l,d)),s],p=!1;return d&&(p=d.some(e=>l[e]?.loading)),{queryKey:c,queryEnabled:void 0!==e&&!p}}let np=(e,r,n)=>{let{data:t}=X(nd,e.spec.plugin.kind),i=ng(),{queryEnabled:o,queryKey:a}=nc({plugin:t,definition:e,context:i});return(0,G.useQuery)({enabled:(n?.enabled??!0)||o,queryKey:a,queryFn:()=>{if(void 0===t)throw Error("Expected plugin to be loaded");let n={...i,suggestedStepMs:r?.suggestedStepMs};return t.getTimeSeriesData(e.spec.plugin.spec,n)}})};function nm(e,r,n){let{getPlugin:t}=Y(),i={...ng(),mode:r?.mode},o=ee(nd,e.map(e=>({kind:e.spec.plugin.kind})));return(0,G.useQueries)({queries:e.map((e,a)=>{let{queryEnabled:l,queryKey:s}=nc({plugin:o[a]?.data,definition:e,context:i});return{enabled:(n?.enabled??!0)&&l,queryKey:s,queryFn:async()=>{let n={...i,suggestedStepMs:r?.suggestedStepMs},o=await t(nd,e.spec.plugin.kind);return await o.getTimeSeriesData(e.spec.plugin.spec,n)}}})})}function ng(){let{absoluteTimeRange:e,refreshKey:r}=rk();return{timeRange:e,variableState:eO(),datasourceStore:eb(),refreshKey:r}}function nh(){return nf((0,G.useQueryClient)().getQueryCache())}function nf(e){let r=[];for(let n of e.findAll({type:"active"})){let e=n.queryKey?.[0];e?.kind&&e.kind.startsWith(nd)&&r.push(n)}return r}let nv="TraceQuery";function nx(e){let{start:r,end:n}=e;return{start:Math.ceil((0,rj.getUnixTime)(r)),end:Math.ceil((0,rj.getUnixTime)(n))}}function nb(e){let{getPlugin:r}=Y(),n=function(){let{absoluteTimeRange:e}=rk();return{variableState:eO(),datasourceStore:eb(),absoluteTimeRange:e}}(),t=ee("TraceQuery",e.map(e=>({kind:e.spec.plugin.kind})));return(0,G.useQueries)({queries:e.map((e,i)=>{let{queryEnabled:o,queryKey:a}=function({plugin:e,definition:r,context:n}){let{datasourceStore:t,variableState:i,absoluteTimeRange:o}=n,a=e?.dependsOn?e.dependsOn(r.spec.plugin.spec,n):{},l=a?.variables,s=[r,t,o,nu(ns(i,l))],u=!1;return l&&(u=l.some(e=>i[e]?.loading)),{queryKey:s,queryEnabled:void 0!==e&&!u}}({context:n,definition:e,plugin:t[i]?.data}),l=e?.spec?.plugin?.kind;return{enabled:o,queryKey:a,queryFn:async()=>{let t=await r(nv,l);return await t.getTraceData(e.spec.plugin.spec,n)}}})})}let ny=(0,v.createContext)(void 0),nj=()=>(0,v.useContext)(ny),nC=()=>{let e=nj();return{markQuery:(r,n)=>{if(void 0===e)return;let t=JSON.stringify(r);if((!e.pendingQueries.has(t)||"pending"!==n)&&e.pendingQueries.get(t)!==n){e.pendingQueries.set(t,n),"error"===n&&(e.renderErrorCount+=1);let r=[...e.pendingQueries.values()].every(e=>"pending"!==e);0===e.renderDurationMs&&r&&(e.renderDurationMs=Date.now()-e.startRenderTime,nP(e))}}}},nP=async e=>{await (0,rX.he)("/api/v1/view",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:e.project,dashboard:e.dashboard,render_time:e.renderDurationMs/1e3,render_errors:e.renderErrorCount})})},nk=({project:e,dashboard:r,children:n})=>{let i={project:e,dashboard:r,renderErrorCount:0,startRenderTime:Date.now(),renderDurationMs:0,pendingQueries:new Map};return(0,t.jsx)(ny.Provider,{value:i,children:n})};function nE(e,r){return e.map(({data:e,isFetching:n,isLoading:t,refetch:i,error:o},a)=>({definition:r[a],data:e,isFetching:n,isLoading:t,refetch:i,error:o}))}function nT(){let{data:e,isLoading:r}=er(["TimeSeriesQuery"]),{data:n,isLoading:t}=er(["TraceQuery"]),i=(0,v.useMemo)(()=>{let r={TimeSeriesQuery:[],TraceQuery:[]};return e&&e.forEach(e=>{r[e.kind]?.push(e.spec.name)}),n&&n.forEach(e=>{r[e.kind]?.push(e.spec.name)}),r},[e,n]);return(0,v.useCallback)(e=>{if(!(e=>{switch(e){case"PrometheusTimeSeriesQuery":return r;case"TempoTraceQuery":return t}return t||r})(e)){for(let r in i)if(i[r]?.includes(e))return r;throw Error(`Unable to determine the query type: ${e}`)}},[i,r,t])}let nZ=(0,v.createContext)(void 0);function nw(){let e=(0,v.useContext)(nZ);if(void 0===e)throw Error("No DataQueriesContext found. Did you forget a Provider?");return e}function nS(e){let r=nw(),n=r.queryResults.filter(r=>r?.definition?.kind===e),t=r.errors.filter((n,t)=>r.queryResults[t]?.definition?.kind===e);return{queryResults:n,isFetching:n.some(e=>e.isFetching),isLoading:n.some(e=>e.isLoading),refetchAll:r.refetchAll,errors:t}}function nV(e){let{definitions:r,options:n,children:i,queryOptions:o}=e,a=nT(),l=r.map(e=>({kind:a(e.kind),spec:{plugin:e}})),s=nC(),u=l.filter(e=>"TimeSeriesQuery"===e.kind),d=nm(u,n,o),c=l.filter(e=>"TraceQuery"===e.kind),p=nb(c),m=(0,v.useCallback)(()=>{d.forEach(e=>e.refetch()),p.forEach(e=>e.refetch())},[d,p]),g=(0,v.useMemo)(()=>{let e=[...nE(d,u),...nE(p,c)];if(o?.enabled)for(let r of e)r.isLoading||r.isFetching||r.error?r.error?s.markQuery(r.definition,"error"):s.markQuery(r.definition,"pending"):s.markQuery(r.definition,"success");return{queryResults:e,isFetching:e.some(e=>e.isFetching),isLoading:e.some(e=>e.isLoading),refetchAll:m,errors:e.map(e=>e.error)}},[u,d,c,p,m,o?.enabled,s]);return(0,t.jsx)(nZ.Provider,{value:g,children:i})}function nL(...e){let r={kind:"PluginModule",metadata:{name:"Fake Plugin Module for Tests",version:"0"},spec:{plugins:e.map(({kind:e,spec:{name:r}})=>({kind:e,spec:{name:r,display:{name:nz(e,r)}}}))}},n={};for(let r of e)n[r.spec.name]=r.plugin;return{pluginLoader:{getInstalledPlugins:()=>Promise.resolve([r]),importPluginModule:()=>Promise.resolve(n)},defaultPluginKinds:{TimeSeriesQuery:"PrometheusTimeSeriesQuery"}}}function nz(e,r){return`${e} Plugin for ${r}`}var nI=n(82749),nO=n(6085),nR=n.n(nO),nD=n(67430);let nA=null,nM=()=>(null===nA&&(nA=(0,nI.init)({name:"@perses/perses-ui-host",remotes:[],shared:{react:{version:x().version,lib:()=>x(),shareConfig:{singleton:!0,requiredVersion:`^${x().version}`}},"react-dom":{version:"18.3.1",lib:()=>nR(),shareConfig:{singleton:!0,requiredVersion:"^18.3.1"}},"react-router-dom":{version:"6.26.0",lib:()=>nD,shareConfig:{singleton:!0,requiredVersion:"^6.26.0"}},"@tanstack/react-query":{version:"5.64.2",lib:()=>G,shareConfig:{singleton:!0,requiredVersion:"^5.64.2"}},"react-hook-form":{version:"7.52.2",lib:()=>b,shareConfig:{singleton:!0,requiredVersion:"^7.52.2"}},echarts:{version:"5.5.0",lib:()=>n(76242),shareConfig:{singleton:!0,requiredVersion:"^5.5.0"}},"@perses-dev/components":{version:"0.51.0-beta.0",lib:()=>n(89698),shareConfig:{singleton:!0,requiredVersion:"^0.51.0-beta.0"}},"@perses-dev/plugin-system":{version:"0.51.0-beta.0",lib:()=>n(90585),shareConfig:{singleton:!0,requiredVersion:"^0.51.0-beta.0"}},"@perses-dev/explore":{version:"0.51.0-beta.0",lib:()=>n(75522),shareConfig:{singleton:!0,requiredVersion:"^0.51.0-beta.0"}},"@perses-dev/dashboards":{version:"0.51.0-beta.0",lib:()=>n(70343),shareConfig:{singleton:!0,requiredVersion:"^0.51.0-beta.0"}},"date-fns":{version:"4.1.0",lib:()=>n(20461),shareConfig:{singleton:!0,requiredVersion:"^4.1.0"}},"date-fns-tz":{version:"3.2.0",lib:()=>n(4665),shareConfig:{singleton:!0,requiredVersion:"^3.2.0"}},lodash:{version:"4.17.21",lib:()=>n(93098),shareConfig:{singleton:!0,requiredVersion:"^4.17.21"}},"@emotion/react":{version:"11.11.3",lib:()=>n(72116),shareConfig:{singleton:!0,requiredVersion:"^11.11.3"}},"@emotion/styled":{version:"11.11.0",lib:()=>n(31373),shareConfig:{singleton:!0,requiredVersion:"^11.11.0"}},"@hookform/resolvers/zod":{version:"3.3.4",lib:()=>n(22538),shareConfig:{singleton:!0,requiredVersion:"^3.3.4"}},"use-resize-observer":{version:"9.1.0",lib:()=>n(75276),shareConfig:{singleton:!0,requiredVersion:"^9.1.0"}},"mdi-material-ui":{version:"7.4.0",lib:()=>n(61157),shareConfig:{singleton:!0,requiredVersion:"^7.4.0"}},immer:{version:"10.1.1",lib:()=>n(86373),shareConfig:{singleton:!0,requiredVersion:"^10.1.1"}}}})),nA),nq=(e,r)=>{let n=nM();if(!n.options.remotes.find(r=>r.name===e)){let t=r?`${r}/${e}/mf-manifest.json`:`/plugins/${e}/mf-manifest.json`;n.registerRemotes([{name:e,entry:t,alias:e}])}},nQ=async(e,r,n)=>(nq(e,n),(0,nI.loadRemote)(`${e}/${r}`));function n$({pluginFn:e,props:r}){return e(r)}function nF({plugin:e,props:r,field:n}){let{loadPlugin:i}=function({plugin:e}){return{pluginRuntime:nM(),loadPlugin:()=>nQ(e.moduleName,e.name,e.baseURL)}}({plugin:e}),[o,a]=(0,v.useState)(null),[l,s]=(0,v.useState)(null),u=`${e.moduleName}-${e.name}`,d=(0,v.useRef)(u);if((0,v.useEffect)(()=>{d.current=u,s(null),i().then(e=>{a(e)}).catch(r=>{a(null),console.error(`PluginLoaderComponent: Error loading plugin ${e.name} from module ${e.moduleName}:`,r),s(Error(`PluginLoaderComponent: Error loading plugin ${e.name} from module ${e.moduleName}`))})},[u]),l)throw l;if(!o)return null;let c=o[e.name];if(n&&c&&"object"==typeof c&&n in c&&(c=c[n]),!c)throw Error(`PluginLoaderComponent: Plugin module ${e.moduleName} does not have a ${e.name} export`);if("function"!=typeof c)throw Error(`PluginLoaderComponent: Plugin ${e.name} export is not a function`);return d.current!==u?null:(0,t.jsx)(n$,{pluginFn:c,props:r},u)}let nN=e=>"object"==typeof e&&null!==e&&"kind"in e&&"spec"in e&&"object"==typeof e.spec&&null!==e.spec&&"name"in e.spec,n_=e=>"object"==typeof e&&null!==e&&"metadata"in e&&"spec"in e&&"object"==typeof e.spec&&null!==e.spec&&"plugins"in e.spec&&Array.isArray(e.spec.plugins)&&e.spec.plugins.every(nN),nU=e=>({getInstalledPlugins:async()=>{let r=await fetch(`${e||""}/api/v1/plugins`),n=await r.json(),t=[];return Array.isArray(n)?t=n.filter(n_):console.error("RemotePluginLoader: Error loading plugins, response is not an array"),t.length||console.error("RemotePluginLoader: No valid plugins found"),t},importPluginModule:async e=>{let r=e.metadata.name,n={};for(let t of e.spec.plugins){let e=await nQ(r,t.spec.name),i=e?.[t.spec.name];i?n[t.spec.name]=i:console.error(`RemotePluginLoader: Error loading plugin ${t.spec.name}`)}return n}})},494:function(e,r,n){n.d(r,{F:()=>a});var t=n(84275),i=n(57576),o=function(e,r){for(var n={};e.length;){var t=e[0],o=t.code,a=t.message,l=t.path.join(".");if(!n[l]){if("unionErrors"in t){var s=t.unionErrors[0].errors[0];n[l]={message:s.message,type:s.code}}else n[l]={message:a,type:o}}if("unionErrors"in t&&t.unionErrors.forEach(function(r){return r.errors.forEach(function(r){return e.push(r)})}),r){var u=n[l].types,d=u&&u[t.code];n[l]=(0,i.appendErrors)(l,r,n,o,d?[].concat(d,t.message):t.message)}e.shift()}return n},a=function(e,r,n){return void 0===n&&(n={}),function(i,a,l){try{return Promise.resolve(function(o,a){try{var s=Promise.resolve(e["sync"===n.mode?"parse":"parseAsync"](i,r)).then(function(e){return l.shouldUseNativeValidation&&(0,t.validateFieldsNatively)({},l),{errors:{},values:n.raw?i:e}})}catch(e){return a(e)}return s&&s.then?s.then(void 0,a):s}(0,function(e){if(Array.isArray(null==e?void 0:e.errors))return{values:{},errors:(0,t.toNestErrors)(o(e.errors,!l.shouldUseNativeValidation&&"all"===l.criteriaMode),l)};throw e}))}catch(e){return Promise.reject(e)}}}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkPrometheus=self.webpackChunkPrometheus||[]).push([["2641"],{56050:function(){}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkPrometheus=self.webpackChunkPrometheus||[]).push([["4425"],{51217:function(e,t,a){a.d(t,{q9:()=>I});var i,r,n,o,s,l,c,u,h=a(7749),p=a(94197);let d={inf:147,nan:148,bool:1,ignoring:2,on:3,group_left:4,group_right:5,offset:6},O=(e,t)=>d[e.toLowerCase()]||-1,v={avg:8,atan2:7,bottomk:9,count:10,count_values:11,group:12,max:13,min:14,quantile:15,stddev:16,stdvar:17,sum:18,topk:19,by:20,without:21,and:22,or:23,unless:24,start:25,end:26},m=(e,t)=>v[e.toLowerCase()]||-1,f=(0,p.Gv)({LineComment:p.pJ.comment,LabelName:p.pJ.labelName,StringLiteral:p.pJ.string,NumberLiteral:p.pJ.number,Duration:p.pJ.number,Identifier:p.pJ.variableName,"Abs Absent AbsentOverTime Acos Acosh Asin Asinh Atan Atanh AvgOverTime Ceil Changes Clamp ClampMax ClampMin Cos Cosh CountOverTime DaysInMonth DayOfMonth DayOfWeek DayOfYear Deg Delta Deriv Exp Floor HistogramCount HistogramFraction HistogramQuantile HistogramSum HoltWinters Hour Idelta Increase Irate LabelReplace LabelJoin LastOverTime Ln Log10 Log2 MaxOverTime MinOverTime Minute Month Pi PredictLinear PresentOverTime QuantileOverTime Rad Rate Resets Round Scalar Sgn Sin Sinh Sort SortDesc Sqrt StddevOverTime StdvarOverTime SumOverTime Tan Tanh Time Timestamp Vector Year":p.pJ.function(p.pJ.variableName),"Avg Bottomk Count Count_values Group Max Min Quantile Stddev Stdvar Sum Topk":p.pJ.operatorKeyword,"By Without Bool On Ignoring GroupLeft GroupRight Offset Start End":p.pJ.modifier,"And Unless Or":p.pJ.logicOperator,"Sub Add Mul Mod Div Atan2 Eql Neq Lte Lss Gte Gtr EqlRegex EqlSingle NeqRegex Pow At":p.pJ.operator,UnaryOp:p.pJ.arithmeticOperator,"( )":p.pJ.paren,"[ ]":p.pJ.squareBracket,"{ }":p.pJ.brace,"⚠":p.pJ.invalid}),g={__proto__:null,absent_over_time:313,absent:315,abs:317,acos:319,acosh:321,asin:323,asinh:325,atan:327,atanh:329,avg_over_time:331,ceil:333,changes:335,clamp:337,clamp_max:339,clamp_min:341,cos:343,cosh:345,count_over_time:347,days_in_month:349,day_of_month:351,day_of_week:353,day_of_year:355,deg:357,delta:359,deriv:361,exp:363,floor:365,histogram_count:367,histogram_fraction:369,histogram_quantile:371,histogram_sum:373,holt_winters:375,hour:377,idelta:379,increase:381,irate:383,label_replace:385,label_join:387,last_over_time:389,ln:391,log10:393,log2:395,max_over_time:397,min_over_time:399,minute:401,month:403,pi:405,predict_linear:407,present_over_time:409,quantile_over_time:411,rad:413,rate:415,resets:417,round:419,scalar:421,sgn:423,sin:425,sinh:427,sort:429,sort_desc:431,sqrt:433,stddev_over_time:435,stdvar_over_time:437,sum_over_time:439,tan:441,tanh:443,timestamp:445,time:447,vector:449,year:451},y=h.WQ.deserialize({version:14,states:"7pOYQPOOO'XQPOOOOQO'#Cz'#CzO'^QPO'#CyQ'iQQOOOOQO'#Da'#DaO'dQPO'#D`OOQO'#E}'#E}O(vQPO'#FTOYQPO'#FPOYQPO'#FSO/OQSO'#FVO/WQQO'#FUOOQO'#FU'#FUOOQO'#Fi'#FiOOQO'#Db'#DbOOQO'#Dd'#DdOOQO'#De'#DeOOQO'#Df'#DfOOQO'#Dg'#DgOOQO'#Dh'#DhOOQO'#Di'#DiOOQO'#Dj'#DjOOQO'#Dk'#DkOOQO'#Dl'#DlOOQO'#Dm'#DmOOQO'#Dn'#DnOOQO'#Do'#DoOOQO'#Dp'#DpOOQO'#Dq'#DqOOQO'#Dr'#DrOOQO'#Ds'#DsOOQO'#Dt'#DtOOQO'#Du'#DuOOQO'#Dv'#DvOOQO'#Dw'#DwOOQO'#Dx'#DxOOQO'#Dy'#DyOOQO'#Dz'#DzOOQO'#D{'#D{OOQO'#D|'#D|OOQO'#D}'#D}OOQO'#EO'#EOOOQO'#EP'#EPOOQO'#EQ'#EQOOQO'#ER'#EROOQO'#ES'#ESOOQO'#ET'#ETOOQO'#EU'#EUOOQO'#EV'#EVOOQO'#EW'#EWOOQO'#EX'#EXOOQO'#EY'#EYOOQO'#EZ'#EZOOQO'#E['#E[OOQO'#E]'#E]OOQO'#E^'#E^OOQO'#E_'#E_OOQO'#E`'#E`OOQO'#Ea'#EaOOQO'#Eb'#EbOOQO'#Ec'#EcOOQO'#Ed'#EdOOQO'#Ee'#EeOOQO'#Ef'#EfOOQO'#Eg'#EgOOQO'#Eh'#EhOOQO'#Ei'#EiOOQO'#Ej'#EjOOQO'#Ek'#EkOOQO'#El'#ElOOQO'#Em'#EmOOQO'#En'#EnOOQO'#Eo'#EoOOQO'#Ep'#EpOOQO'#Eq'#EqOOQO'#Er'#ErOOQO'#Es'#EsOOQO'#Et'#EtOOQO'#Eu'#EuOOQO'#Ev'#EvOOQO'#Ew'#EwOOQO'#Ex'#ExOOQO'#Ey'#EyOOQO'#Ez'#EzQOQPOOO0qQPO'#C{O0vQPO'#DOO'dQPO,59eO0}QQO,59eO2kQPO,59kO2kQPO,59kO2kQPO,59kO2kQPO,59kO2kQPO,59kO8sQQO,5;gO8xQQO,5;jO9QQPO,5;wOOQO,59z,59zOOQO,5;i,5;iO9iQQO,5;kO9pQQO,5;nO;WQPO'#FWOOQO,5;q,5;qO;fQPO,5;qOOQO,5;p,5;pO;nQSO'#C|OOQO,59g,59gOOQO,59j,59jO;vQQO,59jOOQO1G/P1G/POOQO'#DR'#DRO0qQPO'#DSOOQO'#Fm'#FmO<QQPO'#FmOYQPO1G/VOYQPO1G/VOYQPO1G/VOYQPO1G/VOYQPO1G/VOBVQSO1G1ROOQO1G1U1G1UOB_QQO1G1UOBdQPO'#E}OOQO'#F_'#F_OOQO1G1c1G1cOBoQPO1G1cOOQO1G1V1G1VOOQO'#FX'#FXOBtQPO,5;rOByQSO1G1]OCRQPO1G1]OOQO1G1]1G1]OOQO,59h,59hOCZQPO,59hOYQPO'#FbOCcQPO1G/UOOQO1G/U1G/UOCkQPO,59nOOQO,5<X,5<XOJzQQO7+$qOK[QQO7+$qOLpQQO7+$qOMWQQO7+$qONoQQO7+$qOOQO7+&m7+&mO! YQQO7+&sOOQO7+&p7+&pO! bQPO7+&}OOQO1G1^1G1^OOQO,5;},5;}OOQO7+&w7+&wO! gQSO7+&wOOQO-E9a-E9aO! oQSO1G/SO! wQPO1G/SOOQO1G/S1G/SO!!PQQO,5;|OOQO-E9`-E9`OOQO7+$p7+$pO!!ZQPO1G/YOOQO<<J_<<J_O!(YQPO<<J_OOQO<<Ji<<JiOOQO<<Jc<<JcP!(_QSO'#FcOOQO,5;{,5;{OOQO7+$n7+$nO!(dQSO7+$nOOQO-E9_-E9_OOQO7+$t7+$tOOQOAN?yAN?yOOQO<<HY<<HYP!(lQSO'#Fa",stateData:"!(q~O$[OSkOS~OWQOXQOYQOZQO[QO]QO^QO_QO`QOaQObQOcQO!V[O#t^O$XVO$YVO$^XO$b_O$c`O$daO$ebO$fcO$gdO$heO$ifO$jgO$khO$liO$mjO$nkO$olO$pmO$qnO$roO$spO$tqO$urO$vsO$wtO$xuO$yvO$zwO${xO$|yO$}zO%O{O%P|O%Q}O%R!OO%S!PO%T!QO%U!RO%V!SO%W!TO%X!UO%Y!VO%Z!WO%[!XO%]!YO%^!ZO%_![O%`!]O%a!^O%b!_O%c!`O%d!aO%e!bO%f!cO%g!dO%h!eO%i!fO%j!gO%k!hO%l!iO%m!jO%n!kO%o!lO%p!mO%q!nO%r!oO%s!pO%t!qO%u!rO%v!sO%w!tO%x!uO%y!vO%|WO%}WO&OVO&QZO~O!V!wO~Od!xOe!xO$^!yO~OU#SOV!|Of#POg#QOh#POt!|Ow!|Ox!|Oy!|Oz!}O{!}O|#OO}#OO!O#OO!P#OO!Q#OO!R#OO$Q#TO%z#RO~O$X#VO$Y#VO&O#VOW#wXX#wXY#wXZ#wX[#wX]#wX^#wX_#wX`#wXa#wXb#wXc#wX!V#wX#t#wX$X#wX$Y#wX$^#wX$b#wX$c#wX$d#wX$e#wX$f#wX$g#wX$h#wX$i#wX$j#wX$k#wX$l#wX$m#wX$n#wX$o#wX$p#wX$q#wX$r#wX$s#wX$t#wX$u#wX$v#wX$w#wX$x#wX$y#wX$z#wX${#wX$|#wX$}#wX%O#wX%P#wX%Q#wX%R#wX%S#wX%T#wX%U#wX%V#wX%W#wX%X#wX%Y#wX%Z#wX%[#wX%]#wX%^#wX%_#wX%`#wX%a#wX%b#wX%c#wX%d#wX%e#wX%f#wX%g#wX%h#wX%i#wX%j#wX%k#wX%l#wX%m#wX%n#wX%o#wX%p#wX%q#wX%r#wX%s#wX%t#wX%u#wX%v#wX%w#wX%x#wX%y#wX%|#wX%}#wX&O#wX&Q#wX~Oq#YO&R#ZO~O&QZOU#xXV#xXf#xXg#xXh#xXt#xXw#xXx#xXy#xXz#xX{#xX|#xX}#xX!O#xX!P#xX!Q#xX!R#xX$Q#xX$W#xX%z#xX$`#xX$_#xX~O$^#^O~O$`#`O~PYOd!xOe!xOUmaVmafmagmahmatmawmaxmaymazma{ma|ma}ma!Oma!Pma!Qma!Rma$Qma$Wma%zma$`ma$_ma~OP#cOQ#dOR#dOW$aPX$aPY$aPZ$aP[$aP]$aP^$aP_$aP`$aPa$aPb$aPc$aP!V$aP#t$aP$X$aP$Y$aP$^$aP$b$aP$c$aP$d$aP$e$aP$f$aP$g$aP$h$aP$i$aP$j$aP$k$aP$l$aP$m$aP$n$aP$o$aP$p$aP$q$aP$r$aP$s$aP$t$aP$u$aP$v$aP$w$aP$x$aP$y$aP$z$aP${$aP$|$aP$}$aP%O$aP%P$aP%Q$aP%R$aP%S$aP%T$aP%U$aP%V$aP%W$aP%X$aP%Y$aP%Z$aP%[$aP%]$aP%^$aP%_$aP%`$aP%a$aP%b$aP%c$aP%d$aP%e$aP%f$aP%g$aP%h$aP%i$aP%j$aP%k$aP%l$aP%m$aP%n$aP%o$aP%p$aP%q$aP%r$aP%s$aP%t$aP%u$aP%v$aP%w$aP%x$aP%y$aP%|$aP%}$aP&O$aP&Q$aP~O#p#lO~O{#nO#p#mO~Oi#pOj#pO$XVO$YVO%|#oO%}#oO&OVO~O$`#sO~P'iOt!|OU#vaV#vaf#vag#vah#vaw#vax#vay#vaz#va{#va|#va}#va!O#va!P#va!Q#va!R#va$Q#va$W#va%z#va$`#va$_#va~O!R#tO#|#tO#}#tO$O#tO~O$_#vO&R#xO~Oq#zO$`#yO~O$_#{O$`#}O~P'iOQ#dOR#dOW$aXX$aXY$aXZ$aX[$aX]$aX^$aX_$aX`$aXa$aXb$aXc$aX!V$aX#t$aX$X$aX$Y$aX$^$aX$b$aX$c$aX$d$aX$e$aX$f$aX$g$aX$h$aX$i$aX$j$aX$k$aX$l$aX$m$aX$n$aX$o$aX$p$aX$q$aX$r$aX$s$aX$t$aX$u$aX$v$aX$w$aX$x$aX$y$aX$z$aX${$aX$|$aX$}$aX%O$aX%P$aX%Q$aX%R$aX%S$aX%T$aX%U$aX%V$aX%W$aX%X$aX%Y$aX%Z$aX%[$aX%]$aX%^$aX%_$aX%`$aX%a$aX%b$aX%c$aX%d$aX%e$aX%f$aX%g$aX%h$aX%i$aX%j$aX%k$aX%l$aX%m$aX%n$aX%o$aX%p$aX%q$aX%r$aX%s$aX%t$aX%u$aX%v$aX%w$aX%x$aX%y$aX%|$aX%}$aX&O$aX&Q$aX~O%{$VO&P$WO~O#p$XO~O$X#VO$Y#VO&O#VO~O$^$YO~O#t$ZO~Oq#YO&R$]O~O$_$^O&R$]O~O$_$`O$`$bO~O$_#{O$`$eO~OS$fOT$fOWvaXvaYvaZva[va]va^va_va`vaavabvacva!Vva#tva$Xva$Yva$^va$bva$cva$dva$eva$fva$gva$hva$iva$jva$kva$lva$mva$nva$ova$pva$qva$rva$sva$tva$uva$vva$wva$xva$yva$zva${va$|va$}va%Ova%Pva%Qva%Rva%Sva%Tva%Uva%Vva%Wva%Xva%Yva%Zva%[va%]va%^va%_va%`va%ava%bva%cva%dva%eva%fva%gva%hva%iva%jva%kva%lva%mva%nva%ova%pva%qva%rva%sva%tva%uva%vva%wva%xva%yva%|va%}va&Ova&Qva~Ot!|OUsqfsqgsqhsqzsq{sq|sq}sq!Osq!Psq!Qsq!Rsq$Qsq$Wsq%zsq$`sq$_sq~OVsqwsqxsqysq~PIpOV!|Ow!|Ox!|Oy!|O~PIpOV!|Ot!|Ow!|Ox!|Oy!|Oz!}O{!}OUsqfsqgsqhsq$Qsq$Wsq%zsq$`sq$_sq~O|sq}sq!Osq!Psq!Qsq!Rsq~PKlO|#OO}#OO!O#OO!P#OO!Q#OO!R#OO~PKlOV!|Of#POh#POt!|Ow!|Ox!|Oy!|Oz!}O{!}O|#OO}#OO!O#OO!P#OO!Q#OO!R#OO~OUsqgsq$Qsq$Wsq%zsq$`sq$_sq~PMnO#p$hO%{$gO~O$`$iO~Oq#YO&R$jO~Oq$lO$`$mO~O$_$nO$`$mO~O$_$Ua$`$Ua~P'iO$^#^OWviXviYviZvi[vi]vi^vi_vi`viavibvicvi!Vvi#tvi$Xvi$Yvi$bvi$cvi$dvi$evi$fvi$gvi$hvi$ivi$jvi$kvi$lvi$mvi$nvi$ovi$pvi$qvi$rvi$svi$tvi$uvi$vvi$wvi$xvi$yvi$zvi${vi$|vi$}vi%Ovi%Pvi%Qvi%Rvi%Svi%Tvi%Uvi%Vvi%Wvi%Xvi%Yvi%Zvi%[vi%]vi%^vi%_vi%`vi%avi%bvi%cvi%dvi%evi%fvi%gvi%hvi%ivi%jvi%kvi%lvi%mvi%nvi%ovi%pvi%qvi%rvi%svi%tvi%uvi%vvi%wvi%xvi%yvi%|vi%}vi&Ovi&Qvi~O%{$qO~Oq#YO~Oq$lO$`$rO~Oq$lO~O",goto:"({$bPPPPPPPPPPPPPPPPPPPPPPPPPPPPP$c$o${%RP%[$cP%e%lPPPPPPPPPPP$c%v&SP&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S&S$cP&`$c$cP$c$c&o$c&{'['dPPP$cP'gP'j'p'vPPPPP'|PPP(le^OXY!y#g#h#i#j#k#{eROXY!y#g#h#i#j#k#{Q!zRR#b!{Q#_!xQ$O#dR$p$fQ!{RQ#UUR#b!zZ#f!|!}#O#P#QY#e!|!}#O#P#QR$P#feUOXY!y#g#h#i#j#k#{eTOXY!y#g#h#i#j#k#{d^OXY!y#g#h#i#j#k#{R#q#TeYOXY!y#g#h#i#j#k#{d]OXY!y#g#h#i#j#k#{R#][Q#[ZV$[#v$^$kR#u#YR#r#TQ$a#zR$o$aQ#|#aR$d#|Q#w#[R$_#wQSOQ#WXQ#XYQ#a!yQ$Q#gQ$R#hQ$S#iQ$T#jQ$U#kR$c#{Q#g!|Q#h!}Q#i#OQ#j#PR#k#Q",nodeNames:"⚠ Bool Ignoring On GroupLeft GroupRight Offset Atan2 Avg Bottomk Count CountValues Group Max Min Quantile Stddev Stdvar Sum Topk By Without And Or Unless Start End LineComment PromQL AggregateExpr AggregateOp AggregateModifier GroupingLabels LabelName FunctionCallBody BinaryExpr Pow BoolModifier MatchingModifierClause Mul Div Mod Add Sub Eql Gte Gtr Lte Lss Neq FunctionCall FunctionIdentifier AbsentOverTime Identifier Absent Abs Acos Acosh Asin Asinh Atan Atanh AvgOverTime Ceil Changes Clamp ClampMax ClampMin Cos Cosh CountOverTime DaysInMonth DayOfMonth DayOfWeek DayOfYear Deg Delta Deriv Exp Floor HistogramCount HistogramFraction HistogramQuantile HistogramSum HoltWinters Hour Idelta Increase Irate LabelReplace LabelJoin LastOverTime Ln Log10 Log2 MaxOverTime MinOverTime Minute Month Pi PredictLinear PresentOverTime QuantileOverTime Rad Rate Resets Round Scalar Sgn Sin Sinh Sort SortDesc Sqrt StddevOverTime StdvarOverTime SumOverTime Tan Tanh Timestamp Time Vector Year MatrixSelector Duration NumberLiteral OffsetExpr ParenExpr StringLiteral SubqueryExpr UnaryExpr UnaryOp VectorSelector LabelMatchers LabelMatcher MatchOp EqlSingle EqlRegex NeqRegex StepInvariantExpr At AtModifierPreprocessors MetricName",maxTerm:233,nodeProps:[["group",-12,29,35,50,123,125,126,127,128,129,130,132,139,"Expr"]],propSources:[f],skippedNodes:[0,27],repeatNodeCount:3,tokenData:"3s~RwX^#lpq#lqr$ars$tst&luv'Twx'Yxy({yz)Qz{)V{|)[|})c}!O)h!O!P)o!P!Q*o!Q!R*t!R![+l![!]0W!^!_1S!_!`1a!`!a1v!b!c2T!c!}2Y!}#O2p#P#Q2u#Q#R2z#R#S2Y#S#T3P#T#o2Y#o#p3i#q#r3n#y#z#l$f$g#l#BY#BZ#l$IS$I_#l$I|$JO#l$JT$JU#l$KV$KW#l&FU&FV#l~#qY$[~X^#lpq#l#y#z#l$f$g#l#BY#BZ#l$IS$I_#l$I|$JO#l$JT$JU#l$KV$KW#l&FU&FV#l~$dQ!_!`$j#r#s$o~$oO!R~~$tO$O~~$yW#t~OY$tZr$trs%cs#O$t#O#P%h#P;'S$t;'S;=`&f<%lO$t~%hO#t~~%kRO;'S$t;'S;=`%t;=`O$t~%yX#t~OY$tZr$trs%cs#O$t#O#P%h#P;'S$t;'S;=`&f;=`<%l$t<%lO$t~&iP;=`<%l$t~&qSk~OY&lZ;'S&l;'S;=`&}<%lO&l~'QP;=`<%l&l~'YOy~~'_W#t~OY'YZw'Ywx%cx#O'Y#O#P'w#P;'S'Y;'S;=`(u<%lO'Y~'zRO;'S'Y;'S;=`(T;=`O'Y~(YX#t~OY'YZw'Ywx%cx#O'Y#O#P'w#P;'S'Y;'S;=`(u;=`<%l'Y<%lO'Y~(xP;=`<%l'Y~)QO$^~~)VO$`~~)[Ow~R)cO%}PzQ~)hO$_~R)oO%|P{QP)rP!Q![)uP)zR&OP!Q![)u!g!h*T#X#Y*TP*WR{|*a}!O*a!Q![*gP*dP!Q![*gP*lP&OP!Q![*g~*tOx~R*yZ&OP!O!P)u!Q![+l!g!h*T#W#X,a#X#Y*T#[#],x#a#b-^#g#h.Q#k#l.c#l#m/l#m#n.}R+qY&OP!O!P)u!Q![+l!g!h*T#W#X,a#X#Y*T#[#],x#a#b-^#g#h.Q#k#l.c#m#n.}Q,fP#pQ!Q![,iQ,lS!Q![,i#[#],x#a#b-^#g#h.QQ,}P#pQ!Q![-QQ-TR!Q![-Q#a#b-^#g#h.QQ-cQ#pQ!Q![-i#g#h-{Q-lR!Q![-i#a#b-u#g#h.QQ-xP#g#h-{Q.QO#pQQ.VP#pQ!Q![.YQ.]Q!Q![.Y#a#b-uQ.hP#pQ!Q![.kQ.nT!Q![.k#W#X,a#[#],x#a#b-^#g#h.QQ/SP#pQ!Q![/VQ/YU!Q![/V#W#X,a#[#],x#a#b-^#g#h.Q#k#l.cP/oR!Q![/x!c!i/x#T#Z/xP/}R&OP!Q![/x!c!i/x#T#Z/xV0_T&PS!VR!Q![0n![!]0n!c!}0n#R#S0n#T#o0nR0sT!VR!Q![0n![!]0n!c!}0n#R#S0n#T#o0n~1XP!Q~!_!`1[~1aO!P~~1fQ#|P!_!`1l#r#s1qQ1qO|Q~1vO#}~~1{P!O~!_!`2O~2TO}~~2YO$Q~V2aT!VRqS!Q![2Y![!]0n!c!}2Y#R#S2Y#T#o2Y~2uO%z~~2zO%{~~3POt~~3STO#S3P#S#T%c#T;'S3P;'S;=`3c<%lO3P~3fP;=`<%l3P~3nO&Q~~3sO&R~",tokenizers:[0,1,2],topRules:{PromQL:[0,28],MetricName:[1,142]},specialized:[{term:53,get:(e,t)=>O(e)<<1,external:O},{term:53,get:(e,t)=>m(e)<<1|1,external:m,extend:!0},{term:53,get:e=>g[e]||-1}],tokenPrec:0});(i=s||(s={})).none="none",i.vector="vector",i.scalar="scalar",i.matrix="matrix",i.string="string";let $={55:{name:"abs",argTypes:[s.vector],variadic:0,returnType:s.vector},54:{name:"absent",argTypes:[s.vector],variadic:0,returnType:s.vector},52:{name:"absent_over_time",argTypes:[s.matrix],variadic:0,returnType:s.vector},56:{name:"acos",argTypes:[s.vector],variadic:0,returnType:s.vector},57:{name:"acosh",argTypes:[s.vector],variadic:0,returnType:s.vector},58:{name:"asin",argTypes:[s.vector],variadic:0,returnType:s.vector},59:{name:"asinh",argTypes:[s.vector],variadic:0,returnType:s.vector},60:{name:"atan",argTypes:[s.vector],variadic:0,returnType:s.vector},61:{name:"atanh",argTypes:[s.vector],variadic:0,returnType:s.vector},62:{name:"avg_over_time",argTypes:[s.matrix],variadic:0,returnType:s.vector},63:{name:"ceil",argTypes:[s.vector],variadic:0,returnType:s.vector},64:{name:"changes",argTypes:[s.matrix],variadic:0,returnType:s.vector},65:{name:"clamp",argTypes:[s.vector,s.scalar,s.scalar],variadic:0,returnType:s.vector},66:{name:"clamp_max",argTypes:[s.vector,s.scalar],variadic:0,returnType:s.vector},67:{name:"clamp_min",argTypes:[s.vector,s.scalar],variadic:0,returnType:s.vector},68:{name:"cos",argTypes:[s.vector],variadic:0,returnType:s.vector},69:{name:"Cosh",argTypes:[s.vector],variadic:0,returnType:s.vector},70:{name:"count_over_time",argTypes:[s.matrix],variadic:0,returnType:s.vector},71:{name:"days_in_month",argTypes:[s.vector],variadic:1,returnType:s.vector},72:{name:"day_of_month",argTypes:[s.vector],variadic:1,returnType:s.vector},73:{name:"day_of_week",argTypes:[s.vector],variadic:1,returnType:s.vector},74:{name:"day_of_year",argTypes:[s.vector],variadic:1,returnType:s.vector},75:{name:"deg",argTypes:[s.vector],variadic:0,returnType:s.vector},76:{name:"delta",argTypes:[s.matrix],variadic:0,returnType:s.vector},77:{name:"deriv",argTypes:[s.matrix],variadic:0,returnType:s.vector},78:{name:"exp",argTypes:[s.vector],variadic:0,returnType:s.vector},79:{name:"floor",argTypes:[s.vector],variadic:0,returnType:s.vector},80:{name:"histogram_count",argTypes:[s.vector],variadic:0,returnType:s.vector},81:{name:"histogram_fraction",argTypes:[s.scalar,s.scalar,s.vector],variadic:0,returnType:s.vector},82:{name:"histogram_quantile",argTypes:[s.scalar,s.vector],variadic:0,returnType:s.vector},83:{name:"histogram_sum",argTypes:[s.vector],variadic:0,returnType:s.vector},84:{name:"holt_winters",argTypes:[s.matrix,s.scalar,s.scalar],variadic:0,returnType:s.vector},85:{name:"hour",argTypes:[s.vector],variadic:1,returnType:s.vector},86:{name:"idelta",argTypes:[s.matrix],variadic:0,returnType:s.vector},87:{name:"increase",argTypes:[s.matrix],variadic:0,returnType:s.vector},88:{name:"irate",argTypes:[s.matrix],variadic:0,returnType:s.vector},89:{name:"label_replace",argTypes:[s.vector,s.string,s.string,s.string,s.string],variadic:0,returnType:s.vector},90:{name:"label_join",argTypes:[s.vector,s.string,s.string,s.string],variadic:-1,returnType:s.vector},91:{name:"last_over_time",argTypes:[s.matrix],variadic:0,returnType:s.vector},92:{name:"ln",argTypes:[s.vector],variadic:0,returnType:s.vector},93:{name:"log10",argTypes:[s.vector],variadic:0,returnType:s.vector},94:{name:"log2",argTypes:[s.vector],variadic:0,returnType:s.vector},95:{name:"max_over_time",argTypes:[s.matrix],variadic:0,returnType:s.vector},96:{name:"min_over_time",argTypes:[s.matrix],variadic:0,returnType:s.vector},97:{name:"minute",argTypes:[s.vector],variadic:1,returnType:s.vector},98:{name:"month",argTypes:[s.vector],variadic:1,returnType:s.vector},99:{name:"pi",argTypes:[],variadic:0,returnType:s.vector},100:{name:"predict_linear",argTypes:[s.matrix,s.scalar],variadic:0,returnType:s.vector},101:{name:"present_over_time",argTypes:[s.matrix],variadic:0,returnType:s.vector},102:{name:"quantile_over_time",argTypes:[s.scalar,s.matrix],variadic:0,returnType:s.vector},103:{name:"rad",argTypes:[s.vector],variadic:0,returnType:s.vector},104:{name:"rate",argTypes:[s.matrix],variadic:0,returnType:s.vector},105:{name:"resets",argTypes:[s.matrix],variadic:0,returnType:s.vector},106:{name:"round",argTypes:[s.vector,s.scalar],variadic:1,returnType:s.vector},107:{name:"scalar",argTypes:[s.vector],variadic:0,returnType:s.scalar},108:{name:"sgn",argTypes:[s.vector],variadic:0,returnType:s.vector},109:{name:"sin",argTypes:[s.vector],variadic:0,returnType:s.vector},110:{name:"Sinh",argTypes:[s.vector],variadic:0,returnType:s.vector},111:{name:"sort",argTypes:[s.vector],variadic:0,returnType:s.vector},112:{name:"sort_desc",argTypes:[s.vector],variadic:0,returnType:s.vector},113:{name:"sqrt",argTypes:[s.vector],variadic:0,returnType:s.vector},114:{name:"stddev_over_time",argTypes:[s.matrix],variadic:0,returnType:s.vector},115:{name:"stdvar_over_time",argTypes:[s.matrix],variadic:0,returnType:s.vector},116:{name:"sum_over_time",argTypes:[s.matrix],variadic:0,returnType:s.vector},117:{name:"tan",argTypes:[s.vector],variadic:0,returnType:s.vector},118:{name:"tanh",argTypes:[s.vector],variadic:0,returnType:s.vector},120:{name:"time",argTypes:[],variadic:0,returnType:s.scalar},119:{name:"timestamp",argTypes:[s.vector],variadic:0,returnType:s.vector},121:{name:"vector",argTypes:[s.scalar],variadic:0,returnType:s.vector},122:{name:"year",argTypes:[s.vector],variadic:1,returnType:s.vector}};class b{constructor(e,t,a){this.type=e,this.name=t,this.value=a}matchesEmpty(){switch(this.type){case 136:return""===this.value;case 49:return""!==this.value;default:return!1}}}function _(e,t){let a=[];return e.forEach(e=>{a.push(function(e,t){let a=new b(0,"",""),i=e.cursor();if(!i.next())return a;do switch(i.type.id){case 33:a.name=t.sliceDoc(i.from,i.to);break;case 135:let r=i.node.firstChild;r&&(a.type=r.type.id);break;case 128:a.value=t.sliceDoc(i.from,i.to).slice(1,-1)}while(i.nextSibling());return a}(e,t))}),a}function Q(e,t){for(;;){if(!e||e.type.id===t)return e;e=e.parent}return null}function P(e,...t){let a=e.cursor();if(!a.next())return!1;let i=!1;do i=t.some(e=>a.type.id===e||a.type.name===e);while(!i&&a.nextSibling());return i}function x(e,...t){let a=e.cursor();if(!a.next())return!1;let i=0;do a.type.is(t[i])&&i++;while(i<t.length&&a.nextSibling());return i>=t.length}(r=l||(l={})).CardOneToOne="one-to-one",r.CardManyToOne="many-to-one",r.CardOneToMany="one-to-many",r.CardManyToMany="many-to-many";var w=a(61262);class T{constructor(e){this.tree=(0,w.qz)(e),this.state=e,this.diagnostics=[]}getDiagnostics(){return this.diagnostics.sort((e,t)=>e.from-t.from)}analyze(){this.checkAST(this.tree.topNode.firstChild),this.diagnoseAllErrorNodes()}diagnoseAllErrorNodes(){let e=this.tree.cursor();for(;e.next();)if(0===e.type.id&&e.to!==this.tree.topNode.to){let t=e.node.parent;this.diagnostics.push({severity:"error",message:"unexpected expression",from:t?t.from:e.from,to:t?t.to:e.to})}}checkAST(e){if(!e)return s.none;switch(e.type.id){case 29:this.checkAggregationExpr(e);break;case 35:this.checkBinaryExpr(e);break;case 50:this.checkCallFunction(e);break;case 127:case 123:this.checkAST(e.getChild("Expr"));break;case 130:let t=this.checkAST(e.getChild("Expr"));t!==s.scalar&&t!==s.vector&&this.addDiagnostic(e,`unary expression only allowed on expressions of type scalar or instant vector, got ${t}`);break;case 129:let a=this.checkAST(e.getChild("Expr"));a!==s.vector&&this.addDiagnostic(e,`subquery is only allowed on instant vector, got ${a} in ${e.name} instead`);break;case 132:this.checkVectorSelector(e);break;case 139:let i=this.checkAST(e.getChild("Expr"));i!==s.vector&&i!==s.matrix&&this.addDiagnostic(e,"@ modifier must be preceded by an instant selector vector or range vector selector or a subquery")}return function e(t){var a;if(!t)return s.none;switch(t.type.id){case 29:case 132:return s.vector;case 126:return e(t.firstChild);case 128:return s.string;case 125:return s.scalar;case 123:case 129:return s.matrix;case 127:case 130:case 139:return e(t.getChild("Expr"));case 35:let i=e(t.firstChild),r=e(t.lastChild);if(i===s.scalar&&r===s.scalar)return s.scalar;return s.vector;case 50:let n=null===(a=t.firstChild)||void 0===a?void 0:a.firstChild;if(!n)return s.none;return $[n.type.id].returnType;default:return s.none}}(e)}checkAggregationExpr(e){var t;let a=null===(t=e.firstChild)||void 0===t?void 0:t.firstChild;if(!a){this.addDiagnostic(e,"aggregation operator expected in aggregation expression but got nothing");return}let i=e.getChild(34),r=i?i.getChildren("Expr"):[];if(!r.length){this.addDiagnostic(e,"unable to find the parameter for the expression");return}this.expectType(r[r.length-1],s.vector,"aggregation expression"),(19===a.type.id||9===a.type.id||15===a.type.id)&&this.expectType(r[0],s.scalar,"aggregation parameter"),11===a.type.id&&this.expectType(r[0],s.string,"aggregation parameter")}checkBinaryExpr(e){let t=e.firstChild,a=e.lastChild;if(!t||!a){this.addDiagnostic(e,"left or right expression is missing in binary expression");return}let i=this.checkAST(t),r=this.checkAST(a),n=e.getChild(37),o=P(e,44,49,47,48,45,46),c=P(e,22,23,24);n?o||this.addDiagnostic(e,"bool modifier can only be used on comparison operators"):o&&i===s.scalar&&r===s.scalar&&this.addDiagnostic(e,"comparisons between scalars must use BOOL modifier");let u=function(e,t){if(!t||35!==t.type.id)return null;let a={card:l.CardOneToOne,matchingLabels:[],on:!1,include:[]},i=t.getChild(38);if(i){a.on=null!==i.getChild(3);let t=i.getChild(32);for(let i of t?t.getChildren(33):[])a.matchingLabels.push(e.sliceDoc(i.from,i.to));let r=i.getChild(4),n=i.getChild(5),o=r||n;if(o){a.card=r?l.CardManyToOne:l.CardOneToMany;let t=o.nextSibling;for(let i of(null==t?void 0:t.getChildren(33))||[])a.include.push(e.sliceDoc(i.from,i.to))}}return P(t,22,23,24)&&a.card===l.CardOneToOne&&(a.card=l.CardManyToMany),a}(this.state,e);if(null!==u&&u.on)for(let t of u.matchingLabels)for(let a of u.include)t===a&&this.addDiagnostic(e,`label "${t}" must not occur in ON and GROUP clause at once`);i!==s.scalar&&i!==s.vector&&this.addDiagnostic(t,"binary expression must contain only scalar and instant vector types"),r!==s.scalar&&r!==s.vector&&this.addDiagnostic(a,"binary expression must contain only scalar and instant vector types"),(i!==s.vector||r!==s.vector)&&null!==u?u.matchingLabels.length>0&&this.addDiagnostic(e,"vector matching only allowed between instant vectors"):c&&(((null==u?void 0:u.card)===l.CardOneToMany||(null==u?void 0:u.card)===l.CardManyToOne)&&this.addDiagnostic(e,"no grouping allowed for set operations"),(null==u?void 0:u.card)!==l.CardManyToMany&&this.addDiagnostic(e,"set operations must always be many-to-many")),(i===s.scalar||r===s.scalar)&&c&&this.addDiagnostic(e,"set operator not allowed in binary scalar expression")}checkCallFunction(e){var t;let a=null===(t=e.firstChild)||void 0===t?void 0:t.firstChild;if(!a){this.addDiagnostic(e,"function not defined");return}let i=e.getChild(34),r=i?i.getChildren("Expr"):[],n=$[a.type.id],o=n.argTypes.length;if(0===n.variadic)r.length!==o&&this.addDiagnostic(e,`expected ${o} argument(s) in call to "${n.name}", got ${r.length}`);else{let t=o-1;if(t>r.length)this.addDiagnostic(e,`expected at least ${t} argument(s) in call to "${n.name}", got ${r.length}`);else{let a=t+n.variadic;n.variadic>0&&a<r.length&&this.addDiagnostic(e,`expected at most ${a} argument(s) in call to "${n.name}", got ${r.length}`)}}let s=0;for(let e=0;e<r.length;e++){if((s=e)>=n.argTypes.length){if(0===n.variadic)break;s=n.argTypes.length-1}this.expectType(r[e],n.argTypes[s],`call to function "${n.name}"`)}}checkVectorSelector(e){let t=e.getChild(133),a=_(t?t.getChildren(134):[],this.state),i="",r=e.getChild(53);if(r&&(i=this.state.sliceDoc(r.from,r.to)),""!==i){let t=a.find(e=>"__name__"===e.name);t&&this.addDiagnostic(e,`metric name must not be set twice: ${i} or ${t.value}`),a.push(new b(136,"__name__",i))}a.every(e=>e.matchesEmpty())&&this.addDiagnostic(e,"vector selector must contain at least one non-empty matcher")}expectType(e,t,a){let i=this.checkAST(e);i!==t&&this.addDiagnostic(e,`expected type ${t} in ${a}, got ${i}`)}addDiagnostic(e,t){this.diagnostics.push({severity:"error",message:t,from:e.from,to:e.to})}}var S=a(13018);let X=[{label:"^"},{label:"*"},{label:"/"},{label:"%"},{label:"+"},{label:"-"},{label:"=="},{label:">="},{label:">"},{label:"<"},{label:"<="},{label:"!="},{label:"atan2"},{label:"and"},{label:"or"},{label:"unless"}],k=[{label:"avg",detail:"aggregation",info:"Calculate the average over dimensions",type:"keyword"},{label:"bottomk",detail:"aggregation",info:"Smallest k elements by sample value",type:"keyword"},{label:"count",detail:"aggregation",info:"Count number of elements in the vector",type:"keyword"},{label:"count_values",detail:"aggregation",info:"Count number of elements with the same value",type:"keyword"},{label:"group",detail:"aggregation",info:"Group series, while setting the sample value to 1",type:"keyword"},{label:"max",detail:"aggregation",info:"Select maximum over dimensions",type:"keyword"},{label:"min",detail:"aggregation",info:"Select minimum over dimensions",type:"keyword"},{label:"quantile",detail:"aggregation",info:"Calculate φ-quantile (0 ≤ φ ≤ 1) over dimensions",type:"keyword"},{label:"stddev",detail:"aggregation",info:"Calculate population standard deviation over dimensions",type:"keyword"},{label:"stdvar",detail:"aggregation",info:"Calculate population standard variance over dimensions",type:"keyword"},{label:"sum",detail:"aggregation",info:"Calculate sum over dimensions",type:"keyword"},{label:"topk",detail:"aggregation",info:"Largest k elements by sample value",type:"keyword"}],M=[{label:"sum(rate(__input_vector__[5m]))",type:"function",detail:"snippet",info:"Sum over rates of increase",apply:(0,S.DB)("sum(rate(${__input_vector__}[5m]))")},{label:"histogram_quantile(__quantile__, sum by(le) (rate(__histogram_metric__[5m])))",type:"function",detail:"snippet",info:"Approximate a quantile value from an aggregated histogram",apply:(0,S.DB)("histogram_quantile(${__quantile__}, sum by(le) (rate(${__histogram_metric__}[5m])))")},{label:'label_replace(__input_vector__, "__dst__", "__replacement__", "__src__", "__regex__")',type:"function",detail:"snippet",info:"Set or replace a label value in an input vector",apply:(0,S.DB)('label_replace(${__input_vector__}, "${__dst__}", "${__replacement__}", "${__src__}", "${__regex__}")')},{label:"topk(__rank_number__, __input_vector__)",type:"function",detail:"snippet",info:"Largest k elements by sample value",apply:(0,S.DB)("topk(${__rank_number__}, ${__input_vector__})")},{label:"bottomk(__rank_number__, __input_vector__)",type:"function",detail:"snippet",info:"Smallest k elements by sample value",apply:(0,S.DB)("bottomk(${__rank_number__}, ${__input_vector__})")},{label:'count_values("__label_name__", __input_vector__)',type:"function",detail:"snippet",info:"Count the number of series per distinct sample value",apply:(0,S.DB)('count_values("${__label_name__}", ${__metric__})')}],E={matchOp:[{label:"="},{label:"!="},{label:"=~"},{label:"!~"}],binOp:X,duration:[{label:"y"},{label:"w"},{label:"d"},{label:"h"},{label:"m"},{label:"s"},{label:"ms"}],binOpModifier:[{label:"on",info:"Match only on specified labels",type:"keyword"},{label:"ignoring",info:"Ignore specified labels for matching",type:"keyword"},{label:"group_left",info:"Allow many-to-one matching",type:"keyword"},{label:"group_right",info:"Allow one-to-many matching",type:"keyword"}],atModifier:[{label:"start()",info:"resolve to the start of the query",type:"keyword"},{label:"end()",info:"resolve to the end of the query",type:"keyword"}],functionIdentifier:[{label:"abs",detail:"function",info:"Return absolute values of input series",type:"function"},{label:"absent",detail:"function",info:"Determine whether input vector is empty",type:"function"},{label:"absent_over_time",detail:"function",info:"Determine whether input range vector is empty",type:"function"},{label:"acos",detail:"function",info:"Calculate the arccosine, in radians, for input series",type:"function"},{label:"acosh",detail:"function",info:"Calculate the inverse hyperbolic cosine, in radians, for input series",type:"function"},{label:"asin",detail:"function",info:"Calculate the arcsine, in radians, for input series",type:"function"},{label:"asinh",detail:"function",info:"Calculate the inverse hyperbolic sine, in radians, for input series",type:"function"},{label:"atan",detail:"function",info:"Calculate the arctangent, in radians, for input series",type:"function"},{label:"atanh",detail:"function",info:"Calculate the inverse hyperbolic tangent, in radians, for input series",type:"function"},{label:"avg_over_time",detail:"function",info:"Average series values over time",type:"function"},{label:"ceil",detail:"function",info:"Round up values of input series to nearest integer",type:"function"},{label:"changes",detail:"function",info:"Return number of value changes in input series over time",type:"function"},{label:"clamp",detail:"function",info:"Limit the value of input series between a minimum and a maximum",type:"function"},{label:"clamp_max",detail:"function",info:"Limit the value of input series to a maximum",type:"function"},{label:"clamp_min",detail:"function",info:"Limit the value of input series to a minimum",type:"function"},{label:"cos",detail:"function",info:"Calculate the cosine, in radians, for input series",type:"function",boost:-1},{label:"cosh",detail:"function",info:"Calculate the hyperbolic cosine, in radians, for input series",type:"function",boost:-1},{label:"count_over_time",detail:"function",info:"Count the number of values for each input series",type:"function"},{label:"days_in_month",detail:"function",info:"Return the number of days in current month for provided timestamps",type:"function"},{label:"day_of_month",detail:"function",info:"Return the day of the month for provided timestamps",type:"function"},{label:"day_of_week",detail:"function",info:"Return the day of the week for provided timestamps",type:"function"},{label:"day_of_year",detail:"function",info:"Return the day of the year for provided timestamps",type:"function"},{label:"deg",detail:"function",info:"Convert radians to degrees for input series",type:"function",boost:-1},{label:"delta",detail:"function",info:"Calculate the difference between beginning and end of a range vector (for gauges)",type:"function"},{label:"deriv",detail:"function",info:"Calculate the per-second derivative over series in a range vector (for gauges)",type:"function"},{label:"exp",detail:"function",info:"Calculate exponential function for input vector values",type:"function"},{label:"floor",detail:"function",info:"Round down values of input series to nearest integer",type:"function"},{label:"histogram_count",detail:"function",info:"Return the count of observations from a native histogram (experimental feature)",type:"function"},{label:"histogram_fraction",detail:"function",info:"Calculate fractions of observations within an interval from a native histogram (experimental feature)",type:"function"},{label:"histogram_quantile",detail:"function",info:"Calculate quantiles from native histograms (experimental) and from conventional histogram buckets",type:"function"},{label:"histogram_sum",detail:"function",info:"Return the sum of observations from a native histogram (experimental feature)",type:"function"},{label:"holt_winters",detail:"function",info:"Calculate smoothed value of input series",type:"function"},{label:"hour",detail:"function",info:"Return the hour of the day for provided timestamps",type:"function"},{label:"idelta",detail:"function",info:"Calculate the difference between the last two samples of a range vector (for counters)",type:"function"},{label:"increase",detail:"function",info:"Calculate the increase in value over a range of time (for counters)",type:"function"},{label:"irate",detail:"function",info:"Calculate the per-second increase over the last two samples of a range vector (for counters)",type:"function"},{label:"label_replace",detail:"function",info:"Set or replace label values",type:"function"},{label:"label_join",detail:"function",info:"Join together label values into new label",type:"function"},{label:"last_over_time",detail:"function",info:"The most recent point value in specified interval.",type:"function"},{label:"ln",detail:"function",info:"Calculate natural logarithm of input series",type:"function"},{label:"log10",detail:"function",info:"Calulcate base-10 logarithm of input series",type:"function"},{label:"log2",detail:"function",info:"Calculate base-2 logarithm of input series",type:"function"},{label:"max_over_time",detail:"function",info:"Return the maximum value over time for input series",type:"function"},{label:"min_over_time",detail:"function",info:"Return the minimum value over time for input series",type:"function"},{label:"minute",detail:"function",info:"Return the minute of the hour for provided timestamps",type:"function"},{label:"month",detail:"function",info:"Return the month for provided timestamps",type:"function"},{label:"pi",detail:"function",info:"Return pi",type:"function"},{label:"predict_linear",detail:"function",info:"Predict the value of a gauge into the future",type:"function"},{label:"present_over_time",detail:"function",info:"the value 1 for any series in the specified interval",type:"function"},{label:"quantile_over_time",detail:"function",info:"Calculate value quantiles over time for input series",type:"function"},{label:"rad",detail:"function",info:"Convert degrees to radians for input series",type:"function",boost:-1},{label:"rate",detail:"function",info:"Calculate per-second increase over a range vector (for counters)",type:"function"},{label:"resets",detail:"function",info:"Return number of value decreases (resets) in input series of time",type:"function"},{label:"round",detail:"function",info:"Round values of input series to nearest integer",type:"function"},{label:"scalar",detail:"function",info:"Convert single-element series vector into scalar value",type:"function"},{label:"sgn",detail:"function",info:"Returns the sign of the instant vector",type:"function"},{label:"sin",detail:"function",info:"Calculate the sine, in radians, for input series",type:"function"},{label:"sinh",detail:"function",info:"Calculate the hyperbolic sine, in radians, for input series",type:"function"},{label:"sort",detail:"function",info:"Sort input series ascendingly by value",type:"function"},{label:"sort_desc",detail:"function",info:"Sort input series descendingly by value",type:"function"},{label:"sqrt",detail:"function",info:"Return the square root for input series",type:"function"},{label:"stddev_over_time",detail:"function",info:"Calculate the standard deviation within input series over time",type:"function"},{label:"stdvar_over_time",detail:"function",info:"Calculate the standard variation within input series over time",type:"function"},{label:"sum_over_time",detail:"function",info:"Calculate the sum over the values of input series over time",type:"function"},{label:"tan",detail:"function",info:"Calculate the tangent, in radians, for input series",type:"function"},{label:"tanh",detail:"function",info:"Calculate the hyperbolic tangent, in radians, for input series",type:"function"},{label:"time",detail:"function",info:"Return the Unix timestamp at the current evaluation time",type:"function"},{label:"timestamp",detail:"function",info:"Return the Unix timestamp for the samples in the input vector",type:"function"},{label:"vector",detail:"function",info:"Convert a scalar value into a single-element series vector",type:"function"},{label:"year",detail:"function",info:"Return the year for provided timestamps",type:"function"}],aggregateOp:k,aggregateOpModifier:[{label:"by",info:"Keep the listed labels, remove all others.",type:"keyword"},{label:"without",info:"Remove the listed labels, preserve all others.",type:"keyword"}],number:[{label:"nan",info:"Floating-point NaN value",type:"constant"},{label:"inf",info:"Floating-point infinity",type:"constant"}]};function C(e,t){let a=Q(e,132);return a&&(a=a.getChild(53))?t.sliceDoc(a.from,a.to):""}(n=c||(c={}))[n.MetricName=0]="MetricName",n[n.LabelName=1]="LabelName",n[n.LabelValue=2]="LabelValue",n[n.Function=3]="Function",n[n.Aggregation=4]="Aggregation",n[n.BinOpModifier=5]="BinOpModifier",n[n.BinOp=6]="BinOp",n[n.MatchOp=7]="MatchOp",n[n.AggregateOpModifier=8]="AggregateOpModifier",n[n.Duration=9]="Duration",n[n.Offset=10]="Offset",n[n.Bool=11]="Bool",n[n.AtModifiers=12]="AtModifiers",n[n.Number=13]="Number";class D{constructor(e,t=1e4){this.prometheusClient=e,this.maxMetricsMetadata=t}getPrometheusClient(){return this.prometheusClient}promQL(e){let{state:t,pos:a}=e,i=(0,w.qz)(t).resolve(a,-1),r=function(e,t){var a,i,r,n,o,s,l,u,h,p,d,O,v,m;let f=[];switch(t.type.id){case 0:if((null===(a=t.parent)||void 0===a?void 0:a.type.id)===126){f.push({kind:c.Duration});break}if((null===(i=t.parent)||void 0===i?void 0:i.type.id)===134){f.push({kind:c.MatchOp});break}if((null===(r=t.parent)||void 0===r?void 0:r.type.id)===123||(null===(n=t.parent)||void 0===n?void 0:n.type.id)===129&&P(t.parent,124)){f.push({kind:c.Duration});break}let g=e.sliceDoc(t.from,t.to);X.filter(e=>e.label.includes(g)).length>0&&f.push({kind:c.BinOp});break;case 53:if((null===(o=t.parent)||void 0===o?void 0:o.type.id)===0){let a=t.parent.parent;if((null==a?void 0:a.type.id)===139){f.push({kind:c.AtModifiers});break}if((null==a?void 0:a.type.id)===29){f.push({kind:c.AggregateOpModifier},{kind:c.BinOp});break}if((null==a?void 0:a.type.id)===132){let a=C(t,e);k.filter(e=>e.label===a).length>0&&f.push({kind:c.AggregateOpModifier}),f.push({kind:c.BinOp},{kind:c.Offset});break}if(a&&x(a,"Expr")){f.push({kind:c.BinOp},{kind:c.Offset});break}}let y=null===(s=t.parent)||void 0===s?void 0:s.parent;if(!y){f.push({kind:c.MetricName,metricName:e.sliceDoc(t.from,t.to)});break}x(y,"Expr","Expr")?35!==y.type.id||P(y,0)||(f.push({kind:c.MetricName,metricName:e.sliceDoc(t.from,t.to)},{kind:c.Function},{kind:c.Aggregation},{kind:c.BinOpModifier},{kind:c.Number}),P(y,44,45,46,47,48,49)&&!P(y,37)&&f.push({kind:c.Bool})):(f.push({kind:c.MetricName,metricName:e.sliceDoc(t.from,t.to)},{kind:c.Function},{kind:c.Aggregation}),34!==y.type.id&&123!==y.type.id&&f.push({kind:c.Number}));break;case 28:null!==t.firstChild&&0===t.firstChild.type.id&&f.push({kind:c.MetricName,metricName:""},{kind:c.Function},{kind:c.Aggregation},{kind:c.Number});break;case 32:f.push({kind:c.LabelName,metricName:function(e,t){let a=Q(e,29);if(!a)return"";let i="";return a.cursor().iterate(e=>{if(132===e.type.id&&(i=C(e.node,t)))return!1}),i}(t,e)});break;case 133:f.push({kind:c.LabelName,metricName:C(t,e)});break;case 33:(null===(l=t.parent)||void 0===l?void 0:l.type.id)===32?f.push({kind:c.LabelName}):(null===(u=t.parent)||void 0===u?void 0:u.type.id)===134&&f.push({kind:c.LabelName,metricName:C(t,e)});break;case 128:if((null===(h=t.parent)||void 0===h?void 0:h.type.id)===134){let a="";(null===(p=t.parent.firstChild)||void 0===p?void 0:p.type.id)===33&&(a=e.sliceDoc(t.parent.firstChild.from,t.parent.firstChild.to));let i=C(t,e),r=Q(t,133),n=_(r?r.getChildren(134):[],e);f.push({kind:c.LabelValue,metricName:i,labelName:a,matchers:n})}break;case 125:(null===(d=t.parent)||void 0===d?void 0:d.type.id)===0&&(null===(O=t.parent.parent)||void 0===O?void 0:O.type.id)===129?f.push({kind:c.Duration}):f.push({kind:c.Number});break;case 124:case 126:f.push({kind:c.Duration});break;case 34:f.push({kind:c.MetricName,metricName:""},{kind:c.Function},{kind:c.Aggregation});break;case 49:(null===(v=t.parent)||void 0===v?void 0:v.type.id)===135?f.push({kind:c.MatchOp}):(null===(m=t.parent)||void 0===m?void 0:m.type.id)===35&&f.push({kind:c.BinOp});break;case 136:case 137:case 138:case 135:f.push({kind:c.MatchOp});break;case 36:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 22:case 24:case 23:case 35:f.push({kind:c.BinOp})}return f}(t,i),n=Promise.resolve([]),o=!1,s=!0;for(let e of r)switch(e.kind){case c.Aggregation:o=!0,n=n.then(e=>e.concat(E.aggregateOp));break;case c.Function:o=!0,n=n.then(e=>e.concat(E.functionIdentifier));break;case c.BinOpModifier:n=n.then(e=>e.concat(E.binOpModifier));break;case c.BinOp:n=n.then(e=>e.concat(E.binOp));break;case c.MatchOp:n=n.then(e=>e.concat(E.matchOp));break;case c.AggregateOpModifier:n=n.then(e=>e.concat(E.aggregateOpModifier));break;case c.Duration:s=!1,n=n.then(e=>e.concat(E.duration));break;case c.Offset:n=n.then(e=>e.concat([{label:"offset"}]));break;case c.Bool:n=n.then(e=>e.concat([{label:"bool"}]));break;case c.AtModifiers:n=n.then(e=>e.concat(E.atModifier));break;case c.Number:n=n.then(e=>e.concat(E.number));break;case c.MetricName:n=n.then(t=>this.autocompleteMetricName(t,e));break;case c.LabelName:n=n.then(t=>this.autocompleteLabelName(t,e));break;case c.LabelValue:n=n.then(t=>this.autocompleteLabelValue(t,e))}return n.then(e=>(function(e,t,a,i=!1,r=!0){return i&&e.push(...M),{from:t,to:a,options:e,validFor:r?/^[a-zA-Z0-9_:]+$/:void 0}})(e,function(e,t){var a,i,r,n,o,s;let l=e.from;if(133===e.type.id||32===e.type.id){let a;a=e.from+1,null!==e.firstChild&&(a=t),l=a}else 34===e.type.id||128===e.type.id&&(null===(a=e.parent)||void 0===a?void 0:a.type.id)===134?l++:(126===e.type.id||125===e.type.id&&(null===(i=e.parent)||void 0===i?void 0:i.type.id)===0&&(null===(r=e.parent.parent)||void 0===r?void 0:r.type.id)===129||0===e.type.id&&((null===(n=e.parent)||void 0===n?void 0:n.type.id)===126||(null===(o=e.parent)||void 0===o?void 0:o.type.id)===123||(null===(s=e.parent)||void 0===s?void 0:s.type.id)===129&&P(e.parent,124)))&&(l=t);return l}(i,a),a,o,s))}autocompleteMetricName(e,t){if(!this.prometheusClient)return e;let a=new Map;return this.prometheusClient.metricNames(t.metricName).then(e=>{var t;for(let t of e)a.set(t,{label:t,type:"constant"});if(e.length<=this.maxMetricsMetadata)return null===(t=this.prometheusClient)||void 0===t?void 0:t.metricMetadata()}).then(t=>{if(t)for(let[e,i]of a){let a=t[e.replace(/(_count|_sum|_bucket)$/,"")];if(a){if(a.length>1)for(let e of a)""===i.detail?i.detail=e.type:i.detail!==e.type&&(i.detail="unknown",i.info="multiple different definitions for this metric"),""===i.info?i.info=e.help:i.info!==e.help&&(i.info="multiple different definitions for this metric");else if(1===a.length){let{type:t,help:r}=a[0];("histogram"===t||"summary"===t)&&(e.endsWith("_count")&&(t="counter",r=`The total number of observations for: ${r}`),e.endsWith("_sum")&&(t="counter",r=`The total sum of observations for: ${r}`),e.endsWith("_bucket")&&(t="counter",r=`The total count of observations for a bucket in the histogram: ${r}`)),i.detail=t,i.info=r}}}return e.concat(Array.from(a.values()))})}autocompleteLabelName(e,t){return this.prometheusClient?this.prometheusClient.labelNames(t.metricName).then(t=>e.concat(t.map(e=>({label:e,type:"constant"})))):e}autocompleteLabelValue(e,t){return this.prometheusClient&&t.labelName?this.prometheusClient.labelValues(t.labelName,t.metricName,t.matchers).then(t=>e.concat(t.map(e=>({label:e,type:"text"})))):e}}var q=a(54685),R=a.n(q);class A{constructor(e){this.lookbackInterval=432e5,this.httpMethod="POST",this.apiPrefix="/api/v1",this.fetchFn=(e,t)=>fetch(e,t),this.url=e.url?e.url:"",this.errorHandler=e.httpErrorHandler,e.lookbackInterval&&(this.lookbackInterval=e.lookbackInterval),e.fetchFn&&(this.fetchFn=e.fetchFn),e.httpMethod&&(this.httpMethod=e.httpMethod),e.apiPrefix&&(this.apiPrefix=e.apiPrefix)}labelNames(e){let t=new Date,a=new Date(t.getTime()-this.lookbackInterval);if(void 0===e||""===e){let e=this.buildRequest(this.labelsEndpoint(),new URLSearchParams({start:a.toISOString(),end:t.toISOString()}));return this.fetchAPI(e.uri,{method:this.httpMethod,body:e.body}).catch(e=>(this.errorHandler&&this.errorHandler(e),[]))}return this.series(e).then(e=>{let t=new Set;for(let a of e)for(let[e]of Object.entries(a))"__name__"!==e&&t.add(e);return Array.from(t)})}labelValues(e,t,a){let i=new Date,r=new Date(i.getTime()-this.lookbackInterval);if(!t||0===t.length){let t=new URLSearchParams({start:r.toISOString(),end:i.toISOString()});return this.fetchAPI(`${this.labelValuesEndpoint().replace(/:name/gi,e)}?${t}`).catch(e=>(this.errorHandler&&this.errorHandler(e),[]))}return this.series(t,a,e).then(t=>{let a=new Set;for(let i of t)for(let[t,r]of Object.entries(i))"__name__"!==t&&t===e&&a.add(r);return Array.from(a)})}metricMetadata(){return this.fetchAPI(this.metricMetadataEndpoint()).catch(e=>(this.errorHandler&&this.errorHandler(e),{}))}series(e,t,a){let i=new Date,r=new Date(i.getTime()-this.lookbackInterval),n=this.buildRequest(this.seriesEndpoint(),new URLSearchParams({start:r.toISOString(),end:i.toISOString(),"match[]":function(e,t,a){if(!t||0===t.length)return e;let i="";for(let e of t){if(e.name===a||""===e.value)continue;let t="";switch(e.type){case 136:default:t="=";break;case 49:t="!=";break;case 138:t="!~";break;case 137:t="=~"}let r=`${e.name}${t}"${e.value}"`;i=""===i?r:`${i},${r}`}return`${e}{${i}}`}(e,t,a)}));return this.fetchAPI(n.uri,{method:this.httpMethod,body:n.body}).catch(e=>(this.errorHandler&&this.errorHandler(e),[]))}metricNames(){return this.labelValues("__name__")}flags(){return this.fetchAPI(this.flagsEndpoint()).catch(e=>(this.errorHandler&&this.errorHandler(e),{}))}fetchAPI(e,t){return this.fetchFn(this.url+e,t).then(e=>{if(!e.ok&&![400,422,503].includes(e.status))throw Error(e.statusText);return e}).then(e=>e.json()).then(e=>{if("error"===e.status)throw Error(void 0!==e.error?e.error:'missing "error" field in response JSON');if(void 0===e.data)throw Error('missing "data" field in response JSON');return e.data})}buildRequest(e,t){let a=e,i=t;return"GET"===this.httpMethod&&(a=`${a}?${t}`,i=null),{uri:a,body:i}}labelsEndpoint(){return`${this.apiPrefix}/labels`}labelValuesEndpoint(){return`${this.apiPrefix}/label/:name/values`}seriesEndpoint(){return`${this.apiPrefix}/series`}metricMetadataEndpoint(){return`${this.apiPrefix}/metadata`}flagsEndpoint(){return`${this.apiPrefix}/status/flags`}}class V{constructor(e){let t=e&&e.maxAge?e.maxAge:3e5;this.completeAssociation=new(R())(t),this.metricMetadata={},this.labelValues=new(R())(t),this.labelNames=[],this.flags={},(null==e?void 0:e.initialMetricList)&&this.setLabelValues("__name__",e.initialMetricList)}setAssociations(e,t){t.forEach(t=>{let a=this.completeAssociation.get(e);for(let[i,r]of(a||(a=new Map,this.completeAssociation.set(e,a)),Object.entries(t))){if("__name__"===i)continue;let e=a.get(i);void 0===e?a.set(i,new Set([r])):e.add(r)}})}setFlags(e){this.flags=e}getFlags(){return this.flags}setMetricMetadata(e){this.metricMetadata=e}getMetricMetadata(){return this.metricMetadata}setLabelNames(e){this.labelNames=e}getLabelNames(e){if(!e||0===e.length)return this.labelNames;let t=this.completeAssociation.get(e);return t?Array.from(t.keys()):[]}setLabelValues(e,t){this.labelValues.set(e,t)}getLabelValues(e,t){if(!t||0===t.length)return this.labelValues.get(e)||[];let a=this.completeAssociation.get(t);if(a){let t=a.get(e);return t?Array.from(t):[]}return[]}}class Y{constructor(e,t){this.client=e,this.cache=new V(t)}labelNames(e){let t=this.cache.getLabelNames(e);return t&&t.length>0?Promise.resolve(t):void 0===e||""===e?this.client.labelNames().then(e=>(this.cache.setLabelNames(e),e)):this.series(e).then(()=>this.cache.getLabelNames(e))}labelValues(e,t){let a=this.cache.getLabelValues(e,t);return a&&a.length>0?Promise.resolve(a):void 0===t||""===t?this.client.labelValues(e).then(t=>(this.cache.setLabelValues(e,t),t)):this.series(t).then(()=>this.cache.getLabelValues(e,t))}metricMetadata(){let e=this.cache.getMetricMetadata();return e&&Object.keys(e).length>0?Promise.resolve(e):this.client.metricMetadata().then(e=>(this.cache.setMetricMetadata(e),e))}series(e){return this.client.series(e).then(t=>(this.cache.setAssociations(e,t),t))}metricNames(){return this.labelValues("__name__")}flags(){let e=this.cache.getFlags();return e&&Object.keys(e).length>0?Promise.resolve(e):this.client.flags().then(e=>(this.cache.setFlags(e),e))}}function N(e){if(null==e?void 0:e.completeStrategy)return e.completeStrategy;if(null==e?void 0:e.remote){var t;return"function"==typeof(t=e.remote).labelNames&&"function"==typeof t.labelValues&&"function"==typeof t.metricMetadata&&"function"==typeof t.series&&"function"==typeof t.metricNames?new D(e.remote,e.maxMetricsMetadata):new D(new Y(new A(e.remote),e.remote.cache),e.maxMetricsMetadata)}return new D}var L=a(68799);class F{promQL(){return e=>{let t=new T(e.state);return t.analyze(),t.getDiagnostics()}}}(o=u||(u={})).PromQL="PromQL",o.MetricName="MetricName";class I{constructor(){this.complete=N(),this.lint=new F,this.enableLinter=!0,this.enableCompletion=!0}setComplete(e){return this.complete=N(e),this}getComplete(){return this.complete}activateCompletion(e){return this.enableCompletion=e,this}setLinter(e){return this.lint=e,this}getLinter(){return this.lint}activateLinter(e){return this.enableLinter=e,this}asExtension(e=u.PromQL){var t,a;let i=w.qp.define({parser:y.configure({top:e}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"#"}}}),r=[i];if(this.enableCompletion){let e=i.data.of({autocomplete:e=>this.complete.promQL(e)});r=r.concat(e)}return this.enableLinter&&(r=r.concat((t=this.lint.promQL,a=this.lint,(0,L.ir)(t.call(a))))),r}}},54685:function(e,t,a){let i=a(94403),r=Symbol("max"),n=Symbol("length"),o=Symbol("lengthCalculator"),s=Symbol("allowStale"),l=Symbol("maxAge"),c=Symbol("dispose"),u=Symbol("noDisposeOnSet"),h=Symbol("lruList"),p=Symbol("cache"),d=Symbol("updateAgeOnGet"),O=()=>1,v=(e,t,a)=>{let i=e[p].get(t);if(i){let t=i.value;if(m(e,t)){if(g(e,i),!e[s])return}else a&&(e[d]&&(i.value.now=Date.now()),e[h].unshiftNode(i));return t.value}},m=(e,t)=>{if(!t||!t.maxAge&&!e[l])return!1;let a=Date.now()-t.now;return t.maxAge?a>t.maxAge:e[l]&&a>e[l]},f=e=>{if(e[n]>e[r])for(let t=e[h].tail;e[n]>e[r]&&null!==t;){let a=t.prev;g(e,t),t=a}},g=(e,t)=>{if(t){let a=t.value;e[c]&&e[c](a.key,a.value),e[n]-=a.length,e[p].delete(a.key),e[h].removeNode(t)}};class y{constructor(e,t,a,i,r){this.key=e,this.value=t,this.length=a,this.now=i,this.maxAge=r||0}}let $=(e,t,a,i)=>{let r=a.value;m(e,r)&&(g(e,a),e[s]||(r=void 0)),r&&t.call(i,r.value,r.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw TypeError("max must be a non-negative number");this[r]=e.max||1/0;let t=e.length||O;if(this[o]="function"!=typeof t?O:t,this[s]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw TypeError("maxAge must be a number");this[l]=e.maxAge||0,this[c]=e.dispose,this[u]=e.noDisposeOnSet||!1,this[d]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw TypeError("max must be a non-negative number");this[r]=e||1/0,f(this)}get max(){return this[r]}set allowStale(e){this[s]=!!e}get allowStale(){return this[s]}set maxAge(e){if("number"!=typeof e)throw TypeError("maxAge must be a non-negative number");this[l]=e,f(this)}get maxAge(){return this[l]}set lengthCalculator(e){"function"!=typeof e&&(e=O),e!==this[o]&&(this[o]=e,this[n]=0,this[h].forEach(e=>{e.length=this[o](e.value,e.key),this[n]+=e.length})),f(this)}get lengthCalculator(){return this[o]}get length(){return this[n]}get itemCount(){return this[h].length}rforEach(e,t){t=t||this;for(let a=this[h].tail;null!==a;){let i=a.prev;$(this,e,a,t),a=i}}forEach(e,t){t=t||this;for(let a=this[h].head;null!==a;){let i=a.next;$(this,e,a,t),a=i}}keys(){return this[h].toArray().map(e=>e.key)}values(){return this[h].toArray().map(e=>e.value)}reset(){this[c]&&this[h]&&this[h].length&&this[h].forEach(e=>this[c](e.key,e.value)),this[p]=new Map,this[h]=new i,this[n]=0}dump(){return this[h].map(e=>!m(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[h]}set(e,t,a){if((a=a||this[l])&&"number"!=typeof a)throw TypeError("maxAge must be a number");let i=a?Date.now():0,s=this[o](t,e);if(this[p].has(e)){if(s>this[r])return g(this,this[p].get(e)),!1;let o=this[p].get(e).value;return this[c]&&!this[u]&&this[c](e,o.value),o.now=i,o.maxAge=a,o.value=t,this[n]+=s-o.length,o.length=s,this.get(e),f(this),!0}let d=new y(e,t,s,i,a);return d.length>this[r]?(this[c]&&this[c](e,t),!1):(this[n]+=d.length,this[h].unshift(d),this[p].set(e,this[h].head),f(this),!0)}has(e){return!!this[p].has(e)&&!m(this,this[p].get(e).value)}get(e){return v(this,e,!0)}peek(e){return v(this,e,!1)}pop(){let e=this[h].tail;return e?(g(this,e),e.value):null}del(e){g(this,this[p].get(e))}load(e){this.reset();let t=Date.now();for(let a=e.length-1;a>=0;a--){let i=e[a],r=i.e||0;if(0===r)this.set(i.k,i.v);else{let e=r-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[p].forEach((e,t)=>v(this,t,!1))}}},80663:function(e){e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},94403:function(e,t,a){function i(e){var t=this;if(t instanceof i||(t=new i),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var a=0,r=arguments.length;a<r;a++)t.push(arguments[a]);return t}function r(e,t,a,i){if(!(this instanceof r))return new r(e,t,a,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,a?(a.prev=this,this.next=a):this.next=null}e.exports=i,i.Node=r,i.create=i,i.prototype.removeNode=function(e){if(e.list!==this)throw Error("removing node which does not belong to this list");var t=e.next,a=e.prev;return t&&(t.prev=a),a&&(a.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=a),e.list.length--,e.next=null,e.prev=null,e.list=null,t},i.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},i.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},i.prototype.push=function(){for(var e,t,a=0,i=arguments.length;a<i;a++){e=this,t=arguments[a],e.tail=new r(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}return this.length},i.prototype.unshift=function(){for(var e,t,a=0,i=arguments.length;a<i;a++){e=this,t=arguments[a],e.head=new r(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}return this.length},i.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},i.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},i.prototype.forEach=function(e,t){t=t||this;for(var a=this.head,i=0;null!==a;i++)e.call(t,a.value,i,this),a=a.next},i.prototype.forEachReverse=function(e,t){t=t||this;for(var a=this.tail,i=this.length-1;null!==a;i--)e.call(t,a.value,i,this),a=a.prev},i.prototype.get=function(e){for(var t=0,a=this.head;null!==a&&t<e;t++)a=a.next;if(t===e&&null!==a)return a.value},i.prototype.getReverse=function(e){for(var t=0,a=this.tail;null!==a&&t<e;t++)a=a.prev;if(t===e&&null!==a)return a.value},i.prototype.map=function(e,t){t=t||this;for(var a=new i,r=this.head;null!==r;)a.push(e.call(t,r.value,this)),r=r.next;return a},i.prototype.mapReverse=function(e,t){t=t||this;for(var a=new i,r=this.tail;null!==r;)a.push(e.call(t,r.value,this)),r=r.prev;return a},i.prototype.reduce=function(e,t){var a,i=this.head;if(arguments.length>1)a=t;else if(this.head)i=this.head.next,a=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var r=0;null!==i;r++)a=e(a,i.value,r),i=i.next;return a},i.prototype.reduceReverse=function(e,t){var a,i=this.tail;if(arguments.length>1)a=t;else if(this.tail)i=this.tail.prev,a=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(var r=this.length-1;null!==i;r--)a=e(a,i.value,r),i=i.prev;return a},i.prototype.toArray=function(){for(var e=Array(this.length),t=0,a=this.head;null!==a;t++)e[t]=a.value,a=a.next;return e},i.prototype.toArrayReverse=function(){for(var e=Array(this.length),t=0,a=this.tail;null!==a;t++)e[t]=a.value,a=a.prev;return e},i.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var a=new i;if(t<e||t<0)return a;e<0&&(e=0),t>this.length&&(t=this.length);for(var r=0,n=this.head;null!==n&&r<e;r++)n=n.next;for(;null!==n&&r<t;r++,n=n.next)a.push(n.value);return a},i.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var a=new i;if(t<e||t<0)return a;e<0&&(e=0),t>this.length&&(t=this.length);for(var r=this.length,n=this.tail;null!==n&&r>t;r--)n=n.prev;for(;null!==n&&r>e;r--,n=n.prev)a.push(n.value);return a},i.prototype.splice=function(e,t,...a){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,n=this.head;null!==n&&i<e;i++)n=n.next;for(var o=[],i=0;n&&i<t;i++)o.push(n.value),n=this.removeNode(n);null===n&&(n=this.tail),n!==this.head&&n!==this.tail&&(n=n.prev);for(var i=0;i<a.length;i++)n=function(e,t,a){var i=t===e.head?new r(a,null,t,e):new r(a,t,t.next,e);return null===i.next&&(e.tail=i),null===i.prev&&(e.head=i),e.length++,i}(this,n,a[i]);return o},i.prototype.reverse=function(){for(var e=this.head,t=this.tail,a=e;null!==a;a=a.prev){var i=a.prev;a.prev=a.next,a.next=i}return this.head=t,this.tail=e,this};try{a(80663)(i)}catch(e){}},78277:function(e,t,a){t.default=void 0;var i,r=(i=a(30265))&&i.__esModule?i:{default:i};t.default=(0,r.default)("M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z","AlertCircle")},96402:function(e,t,a){t.default=void 0;var i,r=(i=a(30265))&&i.__esModule?i:{default:i};t.default=(0,r.default)("M3,3H9V7H3V3M15,10H21V14H15V10M15,17H21V21H15V17M13,13H7V18H13V20H7L5,20V9H7V11H13V13Z","FileTree")},93729:function(e,t,a){a.d(t,{Ib:()=>s,LU:()=>u,YF:()=>p,fs:()=>l,oK:()=>c,s3:()=>r,sG:()=>n});var i=a(20461);function r(e){return void 0!==e.pastDuration}function n(e){let t=e.end??new Date;return{start:(0,i.sub)(t,s(e.pastDuration)),end:t}}let o=/^(?:(\d+)y)?(?:(\d+)w)?(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?(?:(\d+)ms)?$/;function s(e){let t=o.exec(e);if(null===t)throw Error(`Invalid duration string '${e}'`);return{years:parseInt(t[1]??"0"),months:0,weeks:parseInt(t[2]??"0"),days:parseInt(t[3]??"0"),hours:parseInt(t[4]??"0"),minutes:parseInt(t[5]??"0"),seconds:parseInt(t[6]??"0")+parseInt(t[7]??"0")/1e3}}function l(e){return""!==e&&o.test(e)}function c(e){let t=Math.trunc(e/31536e6);t>0&&(e-=31536e6*t);let a=Math.trunc(e/6048e5);a>0&&(e-=6048e5*a);let i=Math.trunc(e/864e5);i>0&&(e-=864e5*i);let r=Math.trunc(e/36e5);r>0&&(e-=36e5*r);let n=Math.trunc(e/6e4);return n>0&&(e-=6e4*n),{years:t,months:0,weeks:a,days:i,hours:r,minutes:n,seconds:e/1e3}}function u(e){let t=[];if(e.years&&t.push(`${e.years}y`),e.weeks&&t.push(`${e.weeks}w`),e.days&&t.push(`${e.days}d`),e.hours&&t.push(`${e.hours}h`),e.minutes&&t.push(`${e.minutes}m`),e.seconds){let a=Math.trunc(e.seconds);a&&t.push(`${a}s`);let i=Math.round((e.seconds-a)*1e3);i&&t.push(`${i}ms`)}return t.join("")}let h=[{maxMs:15,roundedStepMs:10,display:"0.01s"},{maxMs:35,roundedStepMs:20,display:"0.02s"},{maxMs:75,roundedStepMs:50,display:"0.05s"},{maxMs:150,roundedStepMs:100,display:"0.1s"},{maxMs:350,roundedStepMs:200,display:"0.2s"},{maxMs:750,roundedStepMs:500,display:"0.5s"},{maxMs:1500,roundedStepMs:1e3,display:"1s"},{maxMs:3500,roundedStepMs:2e3,display:"2s"},{maxMs:7500,roundedStepMs:5e3,display:"5s"},{maxMs:12500,roundedStepMs:1e4,display:"10s"},{maxMs:17500,roundedStepMs:15e3,display:"15s"},{maxMs:25e3,roundedStepMs:2e4,display:"20s"},{maxMs:45e3,roundedStepMs:3e4,display:"30s"},{maxMs:9e4,roundedStepMs:6e4,display:"1m"},{maxMs:21e4,roundedStepMs:12e4,display:"2m"},{maxMs:45e4,roundedStepMs:3e5,display:"5m"},{maxMs:75e4,roundedStepMs:6e5,display:"10m"},{maxMs:75e4,roundedStepMs:9e5,display:"15m"},{maxMs:15e5,roundedStepMs:12e5,display:"20m"},{maxMs:27e5,roundedStepMs:18e5,display:"30m"},{maxMs:54e5,roundedStepMs:36e5,display:"1h"},{maxMs:9e6,roundedStepMs:72e5,display:"2h"},{maxMs:162e5,roundedStepMs:108e5,display:"3h"},{maxMs:324e5,roundedStepMs:216e5,display:"6h"},{maxMs:864e5,roundedStepMs:432e5,display:"12h"},{maxMs:6048e5,roundedStepMs:864e5,display:"1d"},{maxMs:18144e5,roundedStepMs:6048e5,display:"1w"},{maxMs:36288e5,roundedStepMs:2592e6,display:"30d"},{maxMs:63072e6,roundedStepMs:31536e6,display:"1y"}];function p(e,t){return function(e){for(let{maxMs:t,roundedStepMs:a}of h)if(e<t)return a;return 15e3}(Math.floor((e.end.valueOf()-e.start.valueOf())/t))}},76251:function(e,t,a){async function i(...e){let t=await a.g.fetch(...e);if(!1===t.ok){let e=t.headers.get("content-type");if(e?.includes("application/json")){let e=await t.json();if(e.error)throw new o(e.error,t.status);if(e.message)throw new o(e.message,t.status)}let a=await t.text();if(a)throw new o(a,t.status);throw new n(t)}return t}async function r(...e){let t=await i(...e);return await t.json()}a.d(t,{he:()=>i,rd:()=>r});class n extends Error{status;constructor(e){super(`${e.status} ${e.statusText}`),this.status=e.status,Object.setPrototypeOf(this,n.prototype)}}class o extends Error{status;constructor(e,t){super(e),this.status=t,Object.setPrototypeOf(this,o.prototype)}}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkPrometheus=self.webpackChunkPrometheus||[]).push([["4659"],{93729:function(e,s,t){t.d(s,{Ib:()=>u,LU:()=>i,YF:()=>l,fs:()=>o,oK:()=>p,s3:()=>d,sG:()=>n});var a=t(20461);function d(e){return void 0!==e.pastDuration}function n(e){let s=e.end??new Date;return{start:(0,a.sub)(s,u(e.pastDuration)),end:s}}let r=/^(?:(\d+)y)?(?:(\d+)w)?(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?(?:(\d+)ms)?$/;function u(e){let s=r.exec(e);if(null===s)throw Error(`Invalid duration string '${e}'`);return{years:parseInt(s[1]??"0"),months:0,weeks:parseInt(s[2]??"0"),days:parseInt(s[3]??"0"),hours:parseInt(s[4]??"0"),minutes:parseInt(s[5]??"0"),seconds:parseInt(s[6]??"0")+parseInt(s[7]??"0")/1e3}}function o(e){return""!==e&&r.test(e)}function p(e){let s=Math.trunc(e/31536e6);s>0&&(e-=31536e6*s);let t=Math.trunc(e/6048e5);t>0&&(e-=6048e5*t);let a=Math.trunc(e/864e5);a>0&&(e-=864e5*a);let d=Math.trunc(e/36e5);d>0&&(e-=36e5*d);let n=Math.trunc(e/6e4);return n>0&&(e-=6e4*n),{years:s,months:0,weeks:t,days:a,hours:d,minutes:n,seconds:e/1e3}}function i(e){let s=[];if(e.years&&s.push(`${e.years}y`),e.weeks&&s.push(`${e.weeks}w`),e.days&&s.push(`${e.days}d`),e.hours&&s.push(`${e.hours}h`),e.minutes&&s.push(`${e.minutes}m`),e.seconds){let t=Math.trunc(e.seconds);t&&s.push(`${t}s`);let a=Math.round((e.seconds-t)*1e3);a&&s.push(`${a}ms`)}return s.join("")}let M=[{maxMs:15,roundedStepMs:10,display:"0.01s"},{maxMs:35,roundedStepMs:20,display:"0.02s"},{maxMs:75,roundedStepMs:50,display:"0.05s"},{maxMs:150,roundedStepMs:100,display:"0.1s"},{maxMs:350,roundedStepMs:200,display:"0.2s"},{maxMs:750,roundedStepMs:500,display:"0.5s"},{maxMs:1500,roundedStepMs:1e3,display:"1s"},{maxMs:3500,roundedStepMs:2e3,display:"2s"},{maxMs:7500,roundedStepMs:5e3,display:"5s"},{maxMs:12500,roundedStepMs:1e4,display:"10s"},{maxMs:17500,roundedStepMs:15e3,display:"15s"},{maxMs:25e3,roundedStepMs:2e4,display:"20s"},{maxMs:45e3,roundedStepMs:3e4,display:"30s"},{maxMs:9e4,roundedStepMs:6e4,display:"1m"},{maxMs:21e4,roundedStepMs:12e4,display:"2m"},{maxMs:45e4,roundedStepMs:3e5,display:"5m"},{maxMs:75e4,roundedStepMs:6e5,display:"10m"},{maxMs:75e4,roundedStepMs:9e5,display:"15m"},{maxMs:15e5,roundedStepMs:12e5,display:"20m"},{maxMs:27e5,roundedStepMs:18e5,display:"30m"},{maxMs:54e5,roundedStepMs:36e5,display:"1h"},{maxMs:9e6,roundedStepMs:72e5,display:"2h"},{maxMs:162e5,roundedStepMs:108e5,display:"3h"},{maxMs:324e5,roundedStepMs:216e5,display:"6h"},{maxMs:864e5,roundedStepMs:432e5,display:"12h"},{maxMs:6048e5,roundedStepMs:864e5,display:"1d"},{maxMs:18144e5,roundedStepMs:6048e5,display:"1w"},{maxMs:36288e5,roundedStepMs:2592e6,display:"30d"},{maxMs:63072e6,roundedStepMs:31536e6,display:"1y"}];function l(e,s){return function(e){for(let{maxMs:s,roundedStepMs:t}of M)if(e<s)return t;return 15e3}(Math.floor((e.end.valueOf()-e.start.valueOf())/s))}},76251:function(e,s,t){async function a(...e){let s=await t.g.fetch(...e);if(!1===s.ok){let e=s.headers.get("content-type");if(e?.includes("application/json")){let e=await s.json();if(e.error)throw new r(e.error,s.status);if(e.message)throw new r(e.message,s.status)}let t=await s.text();if(t)throw new r(t,s.status);throw new n(s)}return s}async function d(...e){let s=await a(...e);return await s.json()}t.d(s,{he:()=>a,rd:()=>d});class n extends Error{status;constructor(e){super(`${e.status} ${e.statusText}`),this.status=e.status,Object.setPrototypeOf(this,n.prototype)}}class r extends Error{status;constructor(e,s){super(e),this.status=s,Object.setPrototypeOf(this,r.prototype)}}}}]);