@perses-dev/table-plugin 0.6.0 → 0.7.0

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 (59) hide show
  1. package/__mf/js/{6487.f255ba88.js → 6487.b74a51ce.js} +1 -1
  2. package/__mf/js/{Table.510470af.js → Table.ae720bb0.js} +3 -3
  3. package/__mf/js/async/3090.f748dadb.js +2 -0
  4. package/__mf/js/async/{468.cca77551.js → 3372.d4622f1a.js} +7 -7
  5. package/__mf/js/async/3598.193e9962.js +1 -0
  6. package/__mf/js/async/3980.9246eb0c.js +2 -0
  7. package/__mf/js/async/{6333.35401612.js.LICENSE.txt → 3980.9246eb0c.js.LICENSE.txt} +2 -2
  8. package/__mf/js/async/4300.4e662fdf.js +38 -0
  9. package/__mf/js/async/{5377.05ab91aa.js → 5377.0695a823.js} +1 -1
  10. package/__mf/js/async/5503.6fa43555.js +1 -0
  11. package/__mf/js/async/5677.c54b356e.js +1 -0
  12. package/__mf/js/async/5901.2aaa62a6.js +2 -0
  13. package/__mf/js/async/6284.0d33a1ae.js +1 -0
  14. package/__mf/js/async/6357.e10e2a7f.js +1 -0
  15. package/__mf/js/async/7179.516df6f8.js +73 -0
  16. package/__mf/js/async/8565.0065c3c7.js +1 -0
  17. package/__mf/js/async/8970.e4194572.js +7 -0
  18. package/__mf/js/async/9010.06449312.js +1 -0
  19. package/__mf/js/async/9354.fc319e8b.js +1 -0
  20. package/__mf/js/async/__federation_expose_Table.12e32a6d.js +1 -0
  21. package/__mf/js/main.8865f4ed.js +1 -0
  22. package/mf-manifest.json +74 -111
  23. package/mf-stats.json +77 -114
  24. package/package.json +5 -12
  25. package/__mf/css/async/8433.cbbd94a8.css +0 -1
  26. package/__mf/js/async/1722.586085f2.js +0 -1
  27. package/__mf/js/async/1996.e0e5fb2a.js +0 -2
  28. package/__mf/js/async/232.ab228ab3.js +0 -1
  29. package/__mf/js/async/2399.8ceb88c6.js +0 -23
  30. package/__mf/js/async/2641.78a9e888.js +0 -1
  31. package/__mf/js/async/3001.51d0062c.js +0 -1
  32. package/__mf/js/async/3598.66df4cef.js +0 -1
  33. package/__mf/js/async/3660.4a5855e1.js +0 -23
  34. package/__mf/js/async/3893.f1c71cae.js +0 -1
  35. package/__mf/js/async/4062.0dd7dc24.js +0 -1
  36. package/__mf/js/async/4446.9a215492.js +0 -1
  37. package/__mf/js/async/4741.ceabfbaa.js +0 -38
  38. package/__mf/js/async/52.77f8a241.js +0 -2
  39. package/__mf/js/async/5409.3c667e6d.js +0 -1
  40. package/__mf/js/async/5662.d6ae2721.js +0 -1
  41. package/__mf/js/async/5767.6be60775.js +0 -1
  42. package/__mf/js/async/5998.ac755fc8.js +0 -73
  43. package/__mf/js/async/6333.35401612.js +0 -2
  44. package/__mf/js/async/654.fd64ef4b.js +0 -1
  45. package/__mf/js/async/6757.5675a614.js +0 -7
  46. package/__mf/js/async/6884.5426473f.js +0 -1
  47. package/__mf/js/async/7606.4ba8e3ec.js +0 -1
  48. package/__mf/js/async/8444.d0d247d8.js +0 -1
  49. package/__mf/js/async/8807.f0e4209b.js +0 -1
  50. package/__mf/js/async/894.1c4bbdb5.js +0 -1
  51. package/__mf/js/async/9010.8332598b.js +0 -1
  52. package/__mf/js/async/9509.e6075bf0.js +0 -1
  53. package/__mf/js/async/__federation_expose_Table.0b081d4a.js +0 -1
  54. package/__mf/js/main.fa5edfce.js +0 -1
  55. /package/__mf/js/async/{1996.e0e5fb2a.js.LICENSE.txt → 3090.f748dadb.js.LICENSE.txt} +0 -0
  56. /package/__mf/js/async/{468.cca77551.js.LICENSE.txt → 3372.d4622f1a.js.LICENSE.txt} +0 -0
  57. /package/__mf/js/async/{52.77f8a241.js.LICENSE.txt → 5901.2aaa62a6.js.LICENSE.txt} +0 -0
  58. /package/__mf/js/async/{5998.ac755fc8.js.LICENSE.txt → 7179.516df6f8.js.LICENSE.txt} +0 -0
  59. /package/__mf/js/async/{6757.5675a614.js.LICENSE.txt → 8970.e4194572.js.LICENSE.txt} +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkTable=self.webpackChunkTable||[]).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,23 +0,0 @@
1
- "use strict";(self.webpackChunkTable=self.webpackChunkTable||[]).push([["2399"],{53717:function(e,t,n){let r;n.r(t),n.d(t,{ErrorAlert:()=>nc,JSONEditor:()=>nC,INCREASE_NEARBY_SERIES_MULTIPLIER:()=>rx,OptionsEditorGroup:()=>rz,DensitySelector:()=>t5,assembleTransform:()=>rZ,clearHighlightedSeries:()=>rd,getColorsForValues:()=>i9,ErrorBoundary:()=>nu.ErrorBoundary,SeriesMarker:()=>n3,TimeRangeSelector:()=>io,testChartsTheme:()=>iy,ChartsThemeContext:()=>j,TextOverlay:()=>r$,hexToHSL:()=>le,DEFAULT_COLUMN_HEIGHT:()=>te,useMousePosition:()=>n0,NoDataOverlay:()=>rH,generateChartsTheme:()=>im,OptionsEditorGrid:()=>rO,OPTIMIZED_MODE_SERIES_LIMIT:()=>ri,TOOLTIP_ADJUST_Y_POS_MULTIPLIER:()=>nH,DiscardChangesConfirmationDialog:()=>t$,getDateRange:()=>z,EMPHASIZED_SERIES_DESCRIPTION:()=>nU,useChartsTheme:()=>w,persesColumnsToTanstackColumns:()=>tn,mockChartsContext:()=>ij,Legend:()=>tI,TOOLTIP_DATE_FORMAT:()=>nG,TOOLTIP_MAX_WIDTH:()=>nz,dateFormatOptionsWithTimeZone:()=>nA,legacyCheckforNearbySeries:()=>rb,ToolbarIconButton:()=>is,PIN_TOOLTIP_HELP_TEXT:()=>n5,checkforNearbyTimeSeries:()=>rv,getTheme:()=>i$,PieChart:()=>i5,TooltipHeader:()=>rr,TOOLTIP_BG_COLOR_FALLBACK:()=>nY,UNPIN_TOOLTIP_HELP_TEXT:()=>n2,DateTimeRangePicker:()=>il,handleMoveUp:()=>nr,browser:()=>nq,getClosestTimestamp:()=>rp,formatWithTimeZone:()=>nD,batchDispatchNearbySeriesActions:()=>ru,getFormattedAxis:()=>O,useTimeZone:()=>nN,ChartsProvider:()=>y,isWithinPercentageRange:()=>rC,TOOLTIP_MIN_WIDTH:()=>nO,StatusHistoryChart:()=>i3,TOOLTIP_LABELS_MAX_WIDTH:()=>n$,getYBuffer:()=>rw,DEFAULT_PINNED_CROSSHAIR:()=>ro,LineChartTooltip:()=>rk,FormatControls:()=>iu,TooltipContent:()=>n9,hslToHex:()=>lt,SHOW_FEWER_SERIES_LIMIT:()=>rf,TimeChartTooltip:()=>r7,getClosestTimestampInFullDataset:()=>rg,getTableCellLayout:()=>tt,pointerEventsSupported:()=>nJ,EChart:()=>P,PINNED_CROSSHAIR_SERIES_NAME:()=>rl,SortSelector:()=>rV,SnackbarProvider:()=>ip.wT,Drawer:()=>ns,AlignSelector:()=>s,LinksEditor:()=>rE,ValueMappingsEditor:()=>ll,TimeZoneContext:()=>nP,GaugeChart:()=>nf,LineChart:()=>rT,SeriesLabelsStack:()=>n4,checkCrosshairPinnedStatus:()=>rh,StatChart:()=>rK,SeriesInfo:()=>n8,ColorPicker:()=>Y,Table:()=>tZ,useSnackbar:()=>ig,InfoTooltip:()=>tG,TimeZoneProvider:()=>nF,LoadingOverlay:()=>rW,typography:()=>iz,Dialog:()=>tB,DropIndicator:()=>t2,TransformsEditor:()=>iQ,OptionsEditorControl:()=>tq,TOOLTIP_PADDING:()=>nW,getFormattedAxisLabel:()=>nL,SortSelectorButtons:()=>rU,getTooltipStyles:()=>rS,useChartsContext:()=>C,RefreshIntervalPicker:()=>i0,enableDataZoom:()=>ra,useDragAndDropMonitor:()=>t9,trackingEventName:()=>nQ,combineSx:()=>ei,OptionsEditorColumn:()=>rN,getDateAndTime:()=>nR,ThresholdsEditor:()=>r2,DEFAULT_TOOLTIP_CONFIG:()=>n1,handleMoveDown:()=>ni,DragButton:()=>nl,useId:()=>tV,ContentWithLegend:()=>tD,BarChart:()=>B,getFormattedDate:()=>nE,NEARBY_SERIES_DESCRIPTION:()=>nV,getColorForValue:()=>i8,isLegendItemVisuallySelected:()=>es,getPointInGrid:()=>rc,EMPTY_TOOLTIP_DATA:()=>nX,legacyGetNearbySeriesData:()=>rj,buildRelativeTimeOption:()=>iv,SettingsAutocomplete:()=>t0,FontSizeSelector:()=>np,defaultCursorData:()=>nK,DYNAMIC_NEARBY_SERIES_MULTIPLIER:()=>rm,FALLBACK_COLOR:()=>i4,getNearbySeriesData:()=>ry,TOOLTIP_MAX_HEIGHT:()=>nB,YAxisLabel:()=>ih,TimeChart:()=>r3,FALLBACK_CHART_WIDTH:()=>n_,DragAndDropElement:()=>ne,getResponsiveValueSize:()=>nv,restoreChart:()=>rs,ModeSelector:()=>rP,TextField:()=>tE,DEFAULT_COLUMN_WIDTH:()=>e9,FormActions:()=>nx,OptionsColorPicker:()=>q});var i,l=n(24246),o=n(10970),a=n(48565);function s({onChange:e,value:t="left",...n}){let r=t=>{e(t)};return(0,l.jsxs)(o.Z,{"aria-label":"Alignement",...n,children:[(0,l.jsx)(a.Z,{onClick:()=>r("left"),variant:"left"===t?"contained":"outlined",children:"Left"},"left"),(0,l.jsx)(a.Z,{onClick:()=>r("center"),variant:"center"===t?"contained":"outlined",children:"Center"},"center"),(0,l.jsx)(a.Z,{onClick:()=>r("right"),variant:"right"===t?"contained":"outlined",children:"Right"},"right")]})}var d=n(54538),c=n.n(d),u=n(73776),h=n(36232),p=n(508),g=n(65201),x=n(99635),m=n(23709),f=n(67745),v=n(50378),b=n(36372);function y(e){let{children:t,chartsTheme:n,enablePinning:r=!1}=e,[i,o]=(0,d.useState)(null),a=(0,d.useMemo)(()=>({chartsTheme:n,enablePinning:r,lastTooltipPinnedCoords:i,setLastTooltipPinnedCoords:o}),[n,r,i,o]);return(0,l.jsx)(j.Provider,{value:a,children:t})}let j=(0,d.createContext)(void 0);function C(){let e=(0,d.useContext)(j);if(void 0===e)throw Error("No ChartsThemeContext found. Did you forget a Provider?");return e}function w(){return C().chartsTheme}var Z=n(59161),S=n(56141),k=n.n(S),T=n(66726),M=n.n(T),I=n(8890),A=n(35246),D=n(48906),E=n(27806);(0,h.D)([x.N,D.N,E.N,I.N,A.N,g.N,m.N,f.N,v.N]);let L=["click","dblclick","mousedown","mousemove","mouseup","mouseover","mouseout","globalout","contextmenu"],R=["datazoom","downplay","highlight"],P=(0,d.memo)(function({option:e,theme:t,renderer:n,sx:r,style:i,onEvents:o,_instance:a,syncGroup:s,onChartInitialized:c}){let u=(0,d.useRef)(e),h=(0,d.useRef)(e),p=(0,d.useRef)(null),g=(0,d.useRef)(null);return(0,d.useLayoutEffect)(()=>{if(null!==p.current&&null===g.current&&(g.current=(0,Z.S1)(p.current,t,{renderer:n??"canvas"}),void 0!==g.current))return g.current.setOption(u.current,!0),c?.(g.current),void 0!==a&&(a.current=g.current),()=>{null!==g.current&&(g.current.dispose(),g.current=null)}},[a,c,t,n]),(0,d.useEffect)(()=>{g.current&&s&&(g.current.group=s,(0,Z.$j)([g.current]))},[s,g]),(0,d.useEffect)(()=>{!(void 0===h.current||k()(h.current,e))&&g.current&&(g.current.setOption(e,!0),h.current=e)},[e]),(0,d.useLayoutEffect)(()=>{let e=M()(()=>{g.current&&g.current.resize()},200);return window.addEventListener("resize",e),e(),()=>{window.removeEventListener("resize",e)}},[]),(0,d.useEffect)(()=>{let e=g.current;if(e&&void 0!==o)return function(e,t){if(void 0!==t){for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n)){let r=t[n]??null;r&&function(t,n){var r,i;"function"==typeof n&&((r=t,L.includes(r))?e.on(t,t=>n(t,e)):(i=t,R.includes(i))?e.on(t,e=>n(e)):e.on(t,()=>n(null,e)))}(n,r)}}}(e,o),()=>{if(void 0!==e&&!0!==e.isDisposed())for(let t in o)e.off(t)}},[o]),(0,d.useEffect)(()=>{M()(()=>{g.current&&g.current.resize()},200,{leading:!0})()},[r,i]),(0,l.jsx)(b.Z,{ref:p,sx:r,style:i})});var F=n(15409),N=n.n(F);function O(e,t){return[N()({type:"value",boundaryGap:[0,"10%"],axisLabel:{formatter:e=>(0,u.formatValue)(e,t)}},e)]}function z(e){if(0===e.length)return 36e5;let t=e[e.length-1];return void 0===e[0]||void 0===t?36e5:t-e[0]}function B(e){let{width:t,height:n,data:r,format:i={unit:"decimal"},mode:o="value"}=e,a=w(),s=(0,d.useMemo)(()=>{if(!r||!r.length)return a.noDataOption;let e=[];return r.map(t=>{e.push([t.label,t.value])}),{title:{show:!1},dataset:[{dimensions:["label","value"],source:e}],xAxis:O({},i),yAxis:{type:"category",splitLine:{show:!1},axisLabel:{overflow:"truncate",width:t/3}},series:{type:"bar",label:{show:!0,position:"right",formatter:e=>e.data[1]?"percentage"===o?(0,u.formatValue)(e.data[1],{unit:"percent",decimalPlaces:i.decimalPlaces}):(0,u.formatValue)(e.data[1],i):void 0,barMinWidth:14,barCategoryGap:6},itemStyle:{borderRadius:4,color:a.echartsTheme[0]}},tooltip:{appendToBody:!0,confine:!0,formatter:e=>e.data[1]&&`<b>${e.name}</b> &emsp; ${(0,u.formatValue)(e.data[1],i)}`},grid:{left:"5%",right:"5%"}}},[r,a,t,o,i]);return(0,l.jsx)(b.Z,{style:{width:t,height:n},sx:{overflow:"auto"},children:(0,l.jsx)(P,{sx:{minHeight:n,height:r?20*r.length:"100%"},option:s,theme:a.echartsTheme})})}(0,h.D)([p.N,g.N,x.N,m.N,f.N,v.N]);var $=n(25283),H=n(75094),W=n(8695),_=n(53094),V=n(20791),U=n(80354);let Y=({color:e,onChange:t,onClear:n,palette:r})=>{let[i,o]=(0,d.useState)(e),a=e=>{o(e),t?.(e)};return(0,l.jsxs)($.Z,{spacing:1,children:[(0,l.jsx)(_.gW,{color:e,onChange:a,style:{width:"100%"}}),(0,l.jsx)($.Z,{direction:"row",flexWrap:"wrap",justifyContent:"space-evenly",width:"200px",children:r&&r.map((e,t)=>(0,l.jsx)(H.Z,{size:"small","aria-label":`change color to ${e}`,sx:{color:e},onClick:()=>a(e),children:(0,l.jsx)(V.default,{})},t))}),(0,l.jsxs)($.Z,{direction:"row",gap:1,alignItems:"center",children:[(0,l.jsx)(W.Z,{inputProps:{"aria-label":"enter hex color"},fullWidth:!0,value:i,onChange:e=>{let n=e.target.value.replace(/([^0-9A-F]+)/gi,"").substring(0,8);o(`#${n}`),G(e.target.value)&&t?.(e.target.value)}}),n&&(0,l.jsx)(H.Z,{onClick:n,children:(0,l.jsx)(U.default,{})})]})]})},G=(e,t)=>{let n=/^#?([0-9A-F]{3,8})$/i.exec(e),r=n&&n[1]?n[1].length:0;return 3===r||6===r||!!t&&4===r||!!t&&8===r};var K=n(6714),X=n(12709);function q({label:e,color:t,onColorChange:n,onClear:r}){let[i,o]=(0,d.useState)(null),a=!!i,{thresholds:{defaultColor:s,palette:c}}=w();return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(J,{size:"small","aria-label":`change ${e} color`,isSelected:a,iconColor:t,onClick:e=>{o(e.currentTarget)},children:(0,l.jsx)(V.default,{})}),(0,l.jsx)(K.ZP,{"data-testid":"options color picker",open:a,anchorEl:i,onClose:()=>{o(null)},slotProps:{paper:{sx:{padding:e=>e.spacing(2)}}},anchorOrigin:{vertical:"top",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"right"},children:(0,l.jsx)(Y,{color:t,palette:[s,...c],onChange:n,onClear:r})})]})}let J=(0,X.ZP)(H.Z,{shouldForwardProp:e=>"isSelected"!==e&&"iconColor"!==e})(({iconColor:e,isSelected:t})=>({backgroundColor:t&&e?`${e}3F`:"undefined",color:e}));var Q=n(94776),ee=n(75586),et=n(83675),en=n(73845),er=n(12577);function ei(...e){return e.flatMap(e=>void 0===e?[]:Array.isArray(e)?e:[e])}let el=(0,d.memo)(function({color:e,sx:t,...n}){return(0,l.jsx)(b.Z,{...n,sx:ei({height:4,width:16,margin:e=>e.spacing(.5)},t),style:{backgroundColor:e}})}),eo=(0,d.forwardRef)(function({item:e,sx:t,truncateLabel:n,onClick:r,isVisuallySelected:i,onMouseOver:o,onMouseOut:a,index:s,...c},u){let[h,p]=(0,d.useState)(n);return(0,l.jsxs)(en.Z,{...c,role:"listitem",sx:ei({padding:0,cursor:"pointer"},t),dense:!0,onClick:t=>{r(t,e.id),e.onClick?.(t)},onMouseOver:t=>o?.(t,{id:e.id,index:s}),onMouseOut:t=>a?.(t,{id:e.id,index:s}),selected:i,ref:u,children:[(0,l.jsx)(b.Z,{sx:{display:"flex",alignItems:"center"},children:(0,l.jsx)(el,{color:e.color})}),(0,l.jsx)(er.Z,{primary:e.label,primaryTypographyProps:{noWrap:h},onMouseOver:function(){n&&p(!1)},onMouseOut:function(){n&&p(!0)}})]})}),ea=(0,d.memo)(eo);function es(e,t){return"ALL"!==t&&!!t[e.id]}function ed({items:e,height:t,width:n,selectedItems:r,onLegendItemClick:i,onItemMouseOver:o,onItemMouseOut:a}){let s=e.length>5;return(0,l.jsx)(et.OO,{style:{height:t,width:n},data:e,itemContent:(e,t)=>(0,l.jsx)(ea,{item:t,index:e,truncateLabel:s,isVisuallySelected:es(t,r),onClick:i,onMouseOver:o,onMouseOut:a,sx:{width:"100%",wordBreak:"break-word",overflow:"hidden"}},t.id),role:"list"})}function ec({height:e,items:t,selectedItems:n,onLegendItemClick:r,onItemMouseOver:i,onItemMouseOut:o}){return(0,l.jsx)(b.Z,{component:"ul",sx:{width:"100%",height:e,padding:[0,1,0,0],overflowY:"scroll",margin:0},children:t.map((e,t)=>(0,l.jsx)(ea,{item:e,index:t,isVisuallySelected:es(e,n),onMouseOver:i,onMouseOut:o,onClick:r,sx:{width:"auto",float:"left",paddingRight:1.5}},e.id))})}var eu=n(22577),eh=n(80900),ep=n(14968),eg=n(90496),ex=n(82267),em=n(82319),ef=n(51751),ev=n(55879),eb=n(10517),ey=n(63767),ej=n(96205),eC=n(44124),ew=n(6749);function eZ(e){return(0,ew.ZP)("MuiToolbar",e)}(0,eC.Z)("MuiToolbar",["root","gutters","regular","dense"]);let eS=e=>{let{classes:t,disableGutters:n,variant:r}=e;return(0,ex.Z)({root:["root",!n&&"gutters",r]},eZ,t)},ek=(0,X.ZP)("div",{name:"MuiToolbar",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})((0,em.Z)(({theme:e})=>({position:"relative",display:"flex",alignItems:"center",variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up("sm")]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}},{props:{variant:"dense"},style:{minHeight:48}},{props:{variant:"regular"},style:e.mixins.toolbar}]}))),eT=d.forwardRef(function(e,t){let n=(0,ef.i)({props:e,name:"MuiToolbar"}),{className:r,component:i="div",disableGutters:o=!1,variant:a="regular",...s}=n,d={...n,component:i,disableGutters:o,variant:a},c=eS(d);return(0,l.jsx)(ek,{as:i,className:(0,eg.Z)(c.root,r),ref:t,ownerState:d,...s})});var eM=n(6595),eI=n(67665),eA=n(63633),eD=n(90247);let eE=(0,eD.Z)((0,l.jsx)("path",{d:"M5.59 7.41L10.18 12l-4.59 4.59L7 18l6-6-6-6zM16 6h2v12h-2z"}),"LastPage"),eL=(0,eD.Z)((0,l.jsx)("path",{d:"M18.41 16.59L13.82 12l4.59-4.59L17 6l-6 6 6 6zM6 6h2v12H6z"}),"FirstPage"),eR=d.forwardRef(function(e,t){let{backIconButtonProps:n,count:r,disabled:i=!1,getItemAriaLabel:o,nextIconButtonProps:a,onPageChange:s,page:d,rowsPerPage:c,showFirstButton:u,showLastButton:h,slots:p={},slotProps:g={},...x}=e,m=(0,eM.V)(),f=p.firstButton??H.Z,v=p.lastButton??H.Z,b=p.nextButton??H.Z,y=p.previousButton??H.Z,j=p.firstButtonIcon??eL,C=p.lastButtonIcon??eE,w=p.nextButtonIcon??eA.Z,Z=p.previousButtonIcon??eI.Z,S=m?v:f,k=m?b:y,T=m?y:b,M=m?f:v,I=m?g.lastButton:g.firstButton,A=m?g.nextButton:g.previousButton,D=m?g.previousButton:g.nextButton,E=m?g.firstButton:g.lastButton;return(0,l.jsxs)("div",{ref:t,...x,children:[u&&(0,l.jsx)(S,{onClick:e=>{s(e,0)},disabled:i||0===d,"aria-label":o("first",d),title:o("first",d),...I,children:m?(0,l.jsx)(C,{...g.lastButtonIcon}):(0,l.jsx)(j,{...g.firstButtonIcon})}),(0,l.jsx)(k,{onClick:e=>{s(e,d-1)},disabled:i||0===d,color:"inherit","aria-label":o("previous",d),title:o("previous",d),...A??n,children:m?(0,l.jsx)(w,{...g.nextButtonIcon}):(0,l.jsx)(Z,{...g.previousButtonIcon})}),(0,l.jsx)(T,{onClick:e=>{s(e,d+1)},disabled:i||-1!==r&&d>=Math.ceil(r/c)-1,color:"inherit","aria-label":o("next",d),title:o("next",d),...D??a,children:m?(0,l.jsx)(Z,{...g.previousButtonIcon}):(0,l.jsx)(w,{...g.nextButtonIcon})}),h&&(0,l.jsx)(M,{onClick:e=>{s(e,Math.max(0,Math.ceil(r/c)-1))},disabled:i||d>=Math.ceil(r/c)-1,"aria-label":o("last",d),title:o("last",d),...E,children:m?(0,l.jsx)(j,{...g.firstButtonIcon}):(0,l.jsx)(C,{...g.lastButtonIcon})})]})});var eP=n(56839);function eF(e){return(0,ew.ZP)("MuiTablePagination",e)}let eN=(0,eC.Z)("MuiTablePagination",["root","toolbar","spacer","selectLabel","selectRoot","select","selectIcon","input","menuItem","displayedRows","actions"]);var eO=n(16351);let ez=(0,X.ZP)(ej.Z,{name:"MuiTablePagination",slot:"Root",overridesResolver:(e,t)=>t.root})((0,em.Z)(({theme:e})=>({overflow:"auto",color:(e.vars||e).palette.text.primary,fontSize:e.typography.pxToRem(14),"&:last-child":{padding:0}}))),eB=(0,X.ZP)(eT,{name:"MuiTablePagination",slot:"Toolbar",overridesResolver:(e,t)=>({[`& .${eN.actions}`]:t.actions,...t.toolbar})})((0,em.Z)(({theme:e})=>({minHeight:52,paddingRight:2,[`${e.breakpoints.up("xs")} and (orientation: landscape)`]:{minHeight:52},[e.breakpoints.up("sm")]:{minHeight:52,paddingRight:2},[`& .${eN.actions}`]:{flexShrink:0,marginLeft:20}}))),e$=(0,X.ZP)("div",{name:"MuiTablePagination",slot:"Spacer",overridesResolver:(e,t)=>t.spacer})({flex:"1 1 100%"}),eH=(0,X.ZP)("p",{name:"MuiTablePagination",slot:"SelectLabel",overridesResolver:(e,t)=>t.selectLabel})((0,em.Z)(({theme:e})=>({...e.typography.body2,flexShrink:0}))),eW=(0,X.ZP)(ey.Z,{name:"MuiTablePagination",slot:"Select",overridesResolver:(e,t)=>({[`& .${eN.selectIcon}`]:t.selectIcon,[`& .${eN.select}`]:t.select,...t.input,...t.selectRoot})})({color:"inherit",fontSize:"inherit",flexShrink:0,marginRight:32,marginLeft:8,[`& .${eN.select}`]:{paddingLeft:8,paddingRight:24,textAlign:"right",textAlignLast:"right"}}),e_=(0,X.ZP)(eb.Z,{name:"MuiTablePagination",slot:"MenuItem",overridesResolver:(e,t)=>t.menuItem})({}),eV=(0,X.ZP)("p",{name:"MuiTablePagination",slot:"DisplayedRows",overridesResolver:(e,t)=>t.displayedRows})((0,em.Z)(({theme:e})=>({...e.typography.body2,flexShrink:0})));function eU({from:e,to:t,count:n}){return`${e}–${t} of ${-1!==n?n:`more than ${t}`}`}function eY(e){return`Go to ${e} page`}let eG=e=>{let{classes:t}=e;return(0,ex.Z)({root:["root"],toolbar:["toolbar"],spacer:["spacer"],selectLabel:["selectLabel"],select:["select"],input:["input"],selectIcon:["selectIcon"],menuItem:["menuItem"],displayedRows:["displayedRows"],actions:["actions"]},eF,t)},eK=d.forwardRef(function(e,t){let n;let r=(0,ef.i)({props:e,name:"MuiTablePagination"}),{ActionsComponent:o=eR,backIconButtonProps:a,colSpan:s,component:c=ej.Z,count:u,disabled:h=!1,getItemAriaLabel:p=eY,labelDisplayedRows:g=eU,labelRowsPerPage:x="Rows per page:",nextIconButtonProps:m,onPageChange:f,onRowsPerPageChange:v,page:b,rowsPerPage:y,rowsPerPageOptions:j=[10,25,50,100],SelectProps:C={},showFirstButton:w=!1,showLastButton:Z=!1,slotProps:S={},slots:k={},...T}=r,M=eG(r),I=S?.select??C,A=I.native?"option":e_;(c===ej.Z||"td"===c)&&(n=s||1e3);let D=(0,eP.Z)(I.id),E=(0,eP.Z)(I.labelId),L={slots:k,slotProps:S},[R,P]=(0,eO.Z)("root",{ref:t,className:M.root,elementType:ez,externalForwardedProps:{...L,component:c,...T},ownerState:r,additionalProps:{colSpan:n}}),[F,N]=(0,eO.Z)("toolbar",{className:M.toolbar,elementType:eB,externalForwardedProps:L,ownerState:r}),[O,z]=(0,eO.Z)("spacer",{className:M.spacer,elementType:e$,externalForwardedProps:L,ownerState:r}),[B,$]=(0,eO.Z)("selectLabel",{className:M.selectLabel,elementType:eH,externalForwardedProps:L,ownerState:r,additionalProps:{id:E}}),[H,W]=(0,eO.Z)("select",{className:M.select,elementType:eW,externalForwardedProps:L,ownerState:r}),[_,V]=(0,eO.Z)("menuItem",{className:M.menuItem,elementType:A,externalForwardedProps:L,ownerState:r}),[U,Y]=(0,eO.Z)("displayedRows",{className:M.displayedRows,elementType:eV,externalForwardedProps:L,ownerState:r});return(0,l.jsx)(R,{...P,children:(0,l.jsxs)(F,{...N,children:[(0,l.jsx)(O,{...z}),j.length>1&&(0,l.jsx)(B,{...$,children:x}),j.length>1&&(0,l.jsx)(H,{variant:"standard",...!I.variant&&{input:i||(i=(0,l.jsx)(ev.ZP,{}))},value:y,onChange:v,id:D,labelId:E,...I,classes:{...I.classes,root:(0,eg.Z)(M.input,M.selectRoot,(I.classes||{}).root),select:(0,eg.Z)(M.select,(I.classes||{}).select),icon:(0,eg.Z)(M.selectIcon,(I.classes||{}).icon)},disabled:h,...W,children:j.map(e=>(0,d.createElement)(_,{...V,key:e.label?e.label:e,value:e.value?e.value:e},e.label?e.label:e))}),(0,l.jsx)(U,{...Y,children:g({from:0===u?0:b*y+1,to:-1===u?(b+1)*y:-1===y?u:Math.min(u,(b+1)*y),count:-1===u?-1:u,page:b})}),(0,l.jsx)(o,{className:M.actions,backIconButtonProps:a,count:u,nextIconButtonProps:m,onPageChange:f,page:b,rowsPerPage:y,showFirstButton:w,showLastButton:Z,slotProps:S.actions,slots:k.actions,getItemAriaLabel:p,disabled:h})]})})});var eX=n(16838);let eq=(0,d.forwardRef)(function(e,t){return(0,l.jsx)(ep.Z,{...e,ref:t,sx:{backgroundColor:e=>e.palette.background.default,"&:hover":{backgroundColor:e=>(0,eX.Fq)(e.palette.primary.main,e.palette.action.hoverOpacity)}}})});var eJ=n(56174);let eQ=(0,d.forwardRef)(function(e,t){return(0,l.jsx)(eJ.Z,{...e,ref:t})});var e0=n(90190);let e1=(0,X.ZP)(e0.Z)(({theme:e})=>({tableLayout:"fixed",borderCollapse:"separate",backgroundColor:e.palette.background.default})),e5={compact:"small",standard:"medium",comfortable:"medium"},e2=(0,d.forwardRef)(function({density:e,...t},n){return(0,l.jsx)(e1,{...t,tabIndex:-1,size:e5[e],ref:n,sx:{width:"100%"}})});var e6=n(31889);let e7=(0,d.forwardRef)(function(e,t){return(0,l.jsx)(e6.Z,{...e,ref:t})});var e3=n(52054),e4=n(78214),e8=n(23147);let e9=150,te=40;function tt(e,t,{isHeader:n,isLastColumn:r,isFirstColumn:i,defaultColumnHeight:l}={}){var o,a;let s=e.spacing(1),d=e.spacing(1.25),c=e.spacing(2),u=i?c:d,h=r?c:d,p=e.typography.body1.lineHeight,g=e.typography.body1.fontSize;"compact"===t&&(s=e.spacing(.5),d=e.spacing(.5),c=e.spacing(1),u=i?c:d,h=r?c:d,p=e.typography.body2.lineHeight,g=e.typography.body2.fontSize),"comfortable"===t&&(s=e.spacing(2),d=e.spacing(1.5),c=e.spacing(2),u=i?c:d,h=r?c:d,p=e.typography.body1.lineHeight,g=e.typography.body1.fontSize);let x=n||!l||"auto"===l?(o=p,a=s,("string"==typeof o?parseInt(o,10):o??0)+2*("string"==typeof a?parseInt(a,10):a)):l;return{padding:`${s} ${h} ${s} ${u}`,height:x,fontSize:g,lineHeight:p}}function tn(e){return e.map(({width:e,align:t,headerDescription:n,cellDescription:r,enableSorting:i,...l})=>({...l,..."auto"===e||void 0===e?{size:0,minSize:0,maxSize:0}:{size:e},enableSorting:!!i,meta:{align:t,headerDescription:n,cellDescription:r}}))}let tr=(0,X.ZP)(ej.Z)(({theme:e})=>({padding:0,backgroundColor:"inherit","&.MuiTableCell-head":{backgroundColor:e.palette.background.default},"&:focus-visible":{outline:`solid 1px ${e.palette.primary.main}`,outlineOffset:"-1px",borderRadius:0}}));function ti({children:e,density:t,variant:n,width:r,defaultColumnHeight:i,focusState:o="none",onFocusTrigger:a,isFirstColumn:s,isLastColumn:c,description:u,align:h,color:p,backgroundColor:g,...x}){let m=(0,Q.Z)(),f=(0,d.useRef)(),v="head"===n;(0,d.useEffect)(()=>{"trigger-focus"===o&&f.current&&f.current.focus()},[o]);let y=e=>{a?.(e)};return(0,l.jsx)(tr,{...x,tabIndex:"none"!==o?0:-1,onFocus:e=>{let t=e.currentTarget?.querySelector('a[href], button, input, textarea, select, details,[role="button"]');t&&t.focus()},onClick:y,onKeyUp:y,style:{width:r},sx:{position:"relative",borderBottom:v?`solid 1px ${m.palette.grey[100]}`:`solid 1px ${m.palette.grey[50]}`,"&:hover #original-cell":{position:"absolute",top:0,left:0,zIndex:10,width:"fit-content",minWidth:"100%",whiteSpace:"nowrap",overflow:"visible",backgroundColor:`${g??m.palette.background.default} !important`,outline:`solid 1px ${m.palette.info.main}`,outlineOffset:"-1px"}},ref:f,children:(0,l.jsx)(b.Z,{id:"original-cell",sx:{...tt(m,t,{isHeader:v,isLastColumn:c,isFirstColumn:s,defaultColumnHeight:i}),position:"relative",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flexDirection:"inherit"},style:{backgroundColor:g??"inherit",color:p??"inherit"},title:u,"aria-label":u,textAlign:h,children:e})})}function tl({onSort:e,sortDirection:t,nextSortDirection:n,children:r,...i}){let o=!!e,a=(0,l.jsx)(e3.Z,{noWrap:!0,variant:"inherit",component:"div",color:"inherit",children:r}),s=!!t;return(0,l.jsx)(ti,{...i,children:o?(0,l.jsx)(e4.Z,{onClick:e,direction:s?t:n,active:s,sx:{verticalAlign:"unset",maxWidth:"100%","&:focus-visible":{[`& .${e8.Z.icon}`]:{opacity:s?1:.5}}},children:a}):a})}var to=n(59019);let ta=(0,d.forwardRef)(function(e,t){return(0,l.jsx)(to.Z,{...e,tabIndex:-1,ref:t})}),ts={row:0,column:0},td=["ArrowRight","ArrowLeft","ArrowUp","ArrowDown"];var tc=n(32641);function tu(e){return(0,ew.ZP)("MuiTableFooter",e)}(0,eC.Z)("MuiTableFooter",["root"]);let th=e=>{let{classes:t}=e;return(0,ex.Z)({root:["root"]},tu,t)},tp=(0,X.ZP)("tfoot",{name:"MuiTableFooter",slot:"Root",overridesResolver:(e,t)=>t.root})({display:"table-footer-group"}),tg={variant:"footer"},tx="tfoot",tm=d.forwardRef(function(e,t){let n=(0,ef.i)({props:e,name:"MuiTableFooter"}),{className:r,component:i=tx,...o}=n,a={...n,component:i},s=th(a);return(0,l.jsx)(tc.Z.Provider,{value:tg,children:(0,l.jsx)(tp,{as:i,className:(0,eg.Z)(s.root,r),ref:t,role:i===tx?null:"rowgroup",ownerState:a,...o})})}),tf=(0,d.forwardRef)(function(e,t){return(0,l.jsx)(tm,{...e,ref:t})});function tv({width:e,height:t,density:n,defaultColumnWidth:r,defaultColumnHeight:i,onRowClick:o,onRowMouseOver:a,onRowMouseOut:s,rows:c,columns:u,headers:h,cellConfigs:p,pagination:g,onPaginationChange:x,rowCount:m}){let f=(0,d.useRef)(null),v=(0,d.useRef)({startIndex:0,endIndex:0}),y=function({visibleRange:e,virtualTable:t,maxRows:n,maxColumns:r}){return function({maxRows:e,maxColumns:t,onActiveCellChange:n}){let[r,i]=(0,d.useState)(ts),[l,o]=(0,d.useState)(!1);return{activeCell:r,isActive:l,onTableKeyDown:(0,d.useCallback)(r=>{let l=r.key;(td.includes(l)||"Home"===l||"End"===l||"PageDown"===l||"PageUp"===l)&&i(i=>{let o=i.row,a=i.column;"ArrowRight"===l&&a<t-1?(r.preventDefault(),a+=1):"ArrowLeft"===l&&a>0?(r.preventDefault(),a-=1):"ArrowDown"===l&&o<e-1?(r.preventDefault(),o+=1):"ArrowUp"===l&&o>0?(r.preventDefault(),o-=1):"Home"===l?(r.preventDefault(),o=0,a=0):"End"===l&&(r.preventDefault(),o=e-1,a=t-1);let s={column:a,row:o},d=n?.(r,i,s)||s;return d.row===i.row&&d.column===i.column?i:d})},[t,e,n]),onCellFocus:e=>{(e.column!==r.column||e.row!==r.row||!l)&&(o(!0),i(e))}}}({maxRows:n,maxColumns:r,onActiveCellChange:(r,i,l)=>{let o=r.key,a=l&&(i.column!==l.column||i.row!==l.row),s=l?.row??i.row;if("ArrowDown"===o&&a)(s-1<e.current.startIndex||s-1>e.current.endIndex)&&t.current?.scrollToIndex({index:s-1,align:"end"});else if("ArrowUp"===o&&a)(s-1<e.current.startIndex||s-1>e.current.endIndex)&&t.current?.scrollToIndex({index:s-1,align:"start"});else if(a&&("Home"===o||"End"===o))t.current?.scrollToIndex({index:Math.max(s-1,0),align:"start"});else if("PageDown"===o){r.preventDefault();let l=i.row;return l=Math.min(n-1,e.current.endIndex+1),t.current?.scrollToIndex({index:l-1,align:"start"}),{row:l,column:i.column}}else if("PageUp"===o){let n=i.row;return n=Math.max(0,e.current.startIndex-1),t.current?.scrollToIndex({index:n-1,align:"end"}),{row:n,column:i.column}}return l}})}({visibleRange:v,virtualTable:f,maxRows:c.length+1,maxColumns:u.length}),j=e=>e.row===y.activeCell.row&&e.column===y.activeCell.column?y.isActive?"trigger-focus":"focus-next":"none",C=(0,d.useMemo)(()=>({Scroller:ta,Table:t=>(0,l.jsx)(e2,{...t,width:e,density:n,onKeyDown:y.onTableKeyDown}),TableHead:e7,TableFoot:tf,TableRow:({item:e,...t})=>{let r=c[t["data-index"]];if(!r)return null;let i={id:r.id,index:r.index};return(0,l.jsx)(eq,{...t,onClick:e=>o(e,r.id),density:n,onMouseOver:e=>{a?.(e,i)},onMouseOut:e=>{s?.(e,i)}})},TableBody:eQ}),[n,y.onTableKeyDown,o,s,a,c,e]),w=(e,t)=>{g&&x&&x({...g,pageIndex:t})},Z=e=>{g&&x&&x({pageIndex:0,pageSize:parseInt(e.target.value,10)})};return(0,l.jsx)(b.Z,{style:{width:e,height:t},children:(0,l.jsx)(et._n,{ref:f,totalCount:c.length,components:C,rangeChanged:e=>{v.current=e},fixedHeaderContent:()=>(0,l.jsx)(l.Fragment,{children:h.map(e=>(0,l.jsx)(eq,{density:n,children:e.headers.map((e,t,o)=>{let a=e.column,s={row:0,column:t},d=a.getIsSorted(),c=a.getNextSortingOrder();return(0,l.jsx)(tl,{onSort:a.getCanSort()?a.getToggleSortingHandler():void 0,sortDirection:"string"==typeof d?d:void 0,nextSortDirection:"string"==typeof c?c:void 0,width:a.getSize()||r,defaultColumnHeight:i,align:a.columnDef.meta?.align,variant:"head",density:n,description:a.columnDef.meta?.headerDescription,focusState:j(s),onFocusTrigger:()=>y.onCellFocus(s),isFirstColumn:0===t,isLastColumn:t===o.length-1,children:(0,eu.ie)(a.columnDef.header,e.getContext())},e.id)})},e.id))}),fixedFooterContent:g?()=>(0,l.jsx)(ep.Z,{sx:{backgroundColor:e=>e.palette.background.default},children:(0,l.jsx)(eK,{colSpan:u.length,count:m,page:g.pageIndex,rowsPerPage:g.pageSize,onPageChange:w,onRowsPerPageChange:Z})}):void 0,itemContent:e=>{let t=c[e];return t?(0,l.jsx)(l.Fragment,{children:t.getVisibleCells().map((t,o,a)=>{let s;let d={row:e+1,column:o},c=t.getContext(),u=p?.[c.cell.id],h=t.column.columnDef.cell,g="function"==typeof h?h(c):null,x=t.column.columnDef.meta?.cellDescription;return"function"==typeof x?s=x(c):x&&"string"==typeof g&&(s=g),(0,l.jsx)(ti,{"data-testid":t.id,title:s||u?.text||g,width:t.column.getSize()||r,defaultColumnHeight:i,align:t.column.columnDef.meta?.align,density:n,focusState:j(d),onFocusTrigger:()=>y.onCellFocus(d),isFirstColumn:0===o,isLastColumn:o===a.length-1,description:s,color:u?.textColor??void 0,backgroundColor:u?.backgroundColor??void 0,children:u?.text||g},t.id)})}):null}})})}var tb=n(82707);function ty({color:e,density:t,...n}){let r="compact"===t;return(0,l.jsx)(tb.Z,{size:r?"small":"medium",...n,focusRipple:!1,tabIndex:-1,sx:{color:e,padding:e=>e.spacing(r?.25:.5),position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)","&.Mui-checked":{color:e},"&.Mui-focusVisible":{background:e?(0,eX.Fq)(e,.5):void 0},"& .MuiSvgIcon-root":{fontSize:r?16:18}}})}let tj=(e,t)=>`${t}`,tC={},tw=[];function tZ({data:e,columns:t,cellConfigs:n,density:r="standard",defaultColumnWidth:i=e9,defaultColumnHeight:o="auto",checkboxSelection:a,onRowSelectionChange:s,onSortingChange:c,getCheckboxColor:u,getRowId:h=tj,rowSelection:p=tC,sorting:g=tw,pagination:x,onPaginationChange:m,rowSelectionVariant:f="standard",...v}){let b=(0,Q.Z)(),y=(0,d.useCallback)((e,t,n)=>{"standard"===f||n?t.toggleSelected():t.getIsSelected()&&!e.getIsAllRowsSelected()?e.toggleAllRowsSelected():s?.({[t.id]:!0})},[s,f]),j=(0,d.useCallback)((e,t,n)=>{let r=e.nativeEvent&&(e.nativeEvent instanceof MouseEvent||e.nativeEvent instanceof KeyboardEvent)?e.nativeEvent:void 0;y(t,n,!!r?.metaKey||!!r?.shiftKey)},[y]),C=(0,d.useMemo)(()=>({id:"checkboxRowSelect",size:28,header:({table:e})=>(0,l.jsx)(ty,{checked:e.getIsAllRowsSelected(),indeterminate:e.getIsSomeRowsSelected(),onChange:e.getToggleAllRowsSelectedHandler(),color:b.palette.text.primary,density:r}),cell:({row:e,table:t})=>(0,l.jsx)(ty,{checked:e.getIsSelected(),indeterminate:e.getIsSomeSelected(),onChange:n=>{j(n,t,e)},color:u?.(e.original),density:r}),enableSorting:!1}),[b.palette.text.primary,r,u,j]),w=(0,d.useMemo)(()=>{let e=tn(t);return a&&e.unshift(C),e},[C,a,t]),Z=(0,eu.b7)({data:e,columns:w,getRowId:h,getCoreRowModel:(0,eh.sC)(),getSortedRowModel:(0,eh.tj)(),getPaginationRowModel:x?(0,eh.G_)():void 0,manualPagination:!x,enableRowSelection:!!a,onRowSelectionChange:e=>{let t="function"==typeof e?e(p):e;s?.(t)},onSortingChange:e=>{let t="function"==typeof e?e(g):e;c?.(t)},sortDescFirst:!0,state:{rowSelection:p,sorting:g,...x?{pagination:x}:{}}}),S=(0,d.useCallback)((e,t)=>{let n=Z.getRow(t);y(Z,n,e.metaKey||e.shiftKey)},[y,Z]);return(0,l.jsx)(tv,{...v,density:r,defaultColumnWidth:i,defaultColumnHeight:o,onRowClick:S,rows:Z.getRowModel().rows,columns:Z.getAllFlatColumns(),headers:Z.getHeaderGroups(),cellConfigs:n,pagination:x,onPaginationChange:m,rowCount:Z.getRowCount()})}let tS=[{accessorKey:"label",header:"Name",enableSorting:!0,cell:({getValue:e})=>(0,l.jsx)("span",{title:e(),children:e()})}],tk=e=>e.id,tT=e=>e.color;function tM({items:e,selectedItems:t,onSelectedItemsChange:n,onItemMouseOver:r,onItemMouseOut:i,height:o,width:a,columns:s=[],sorting:c,onSortingChange:u}){let h=(0,d.useMemo)(()=>"string"!=typeof t?t:e.reduce((e,t,n)=>(e[tk(t,n)]=!0,e),{}),[t,e]),p=(0,d.useMemo)(()=>[...tS,...s],[s]);return(0,l.jsx)(tZ,{height:o,width:a,rowSelection:h,onRowSelectionChange:n,onRowMouseOver:r,onRowMouseOut:i,sorting:c,onSortingChange:u,data:e,columns:p,density:"compact",defaultColumnWidth:"auto",getRowId:tk,getCheckboxColor:tT,checkboxSelection:!0,rowSelectionVariant:"legend"})}function tI({width:e,height:t,options:n,data:r,selectedItems:i,onSelectedItemsChange:o,onItemMouseOver:a,onItemMouseOut:s,tableProps:d}){let c;let h=(e,t)=>{let n=e.metaKey||e.shiftKey;o((0,ee.Uy)(i,e=>{if("ALL"===e)return{[t]:!0};let r=!!e[t];return n?(r?delete e[t]:e[t]=!0,e):r?"ALL":{[t]:!0}}))},p=(0,u.getLegendMode)(n.mode),g=r.length>=500,x={height:t,items:r,selectedItems:i,onLegendItemClick:h,onItemMouseOver:a,onItemMouseOut:s};return(c="table"===p?(0,l.jsx)(tM,{...x,onSelectedItemsChange:o,width:e,...d}):"right"===n.position||g?(0,l.jsx)(ed,{...x,width:e,onLegendItemClick:h}):(0,l.jsx)(ec,{...x,onLegendItemClick:h}),"right"===n.position)?(0,l.jsx)(b.Z,{style:{width:e,height:t},sx:{position:"absolute",top:0,right:0},children:c}):(0,l.jsx)(b.Z,{style:{width:e,height:t},sx:{position:"absolute",bottom:0},children:c})}let tA={medium:{bottom:6,right:250},small:{bottom:4,right:150}};function tD({children:e,legendProps:t,width:n,height:r,spacing:i=0,legendSize:o,minChildrenWidth:a=100,minChildrenHeight:s=100}){let{content:d,legend:c,margin:h}=function({width:e,height:t,legendProps:n,legendSize:r,minChildrenHeight:i,minChildrenWidth:l,spacing:o,theme:a}){let s,d;let c=n?.options,h={legend:{show:!1,width:0,height:0},content:{width:e,height:t},margin:{right:0,bottom:0}};if(!c)return h;let{position:p}=c;if("list"===(0,u.getLegendMode)(c.mode))s="right"===p?200:e,d=40,"right"===p?d=t:t>=300&&(d=100);else{let i=tt(a,"compact"),l=(n?.tableProps?.columns||[]).reduce((e,t)=>("number"==typeof t.width&&(e+=t.width),e),0);s="right"===p?tA[r].right+l:e;let o=Math.min(tA[r].bottom,n.data.length+1);d="bottom"===p?o*i.height:t}let g="right"===p?e-s-o:e,x="bottom"===p?t-d-o:t;return"right"===p&&g<l||"bottom"===p&&x<i?h:{legend:{width:s,height:d,show:!0},content:{width:g,height:x},margin:{right:"right"===p?o:0,bottom:"bottom"===p?o:0}}}({width:n,height:r,legendProps:t,minChildrenHeight:s,minChildrenWidth:a,spacing:i,theme:(0,Q.Z)(),legendSize:(0,u.getLegendSize)(o)});return(0,l.jsxs)(b.Z,{style:{width:n,height:r},sx:{position:"relative",overflow:"hidden"},children:[(0,l.jsx)(b.Z,{style:{width:d.width,height:d.height},sx:{marginRight:`${h.right}px`,marginBottom:`${h.bottom}px`,overflow:"hidden"},children:"function"==typeof e?e({width:d.width,height:d.height}):e}),t&&c.show&&(0,l.jsx)(tI,{...t,height:c.height,width:c.width})]})}let tE=(0,d.forwardRef)(function({debounceMs:e=250,value:t,onChange:n,...r},i){let[o,a]=(0,d.useState)(t),s=(0,d.useCallback)(e=>{n?.(e)},[n]),c=(0,d.useMemo)(()=>M()(s,e),[e,s]);return(0,l.jsx)(W.Z,{ref:i,value:o,onChange:function(e){a(e.target.value),c(e.target.value)},...r})});tE.displayName="TextField";var tL=n(51602),tR=n(19978),tP=n(56873),tF=n(70616),tN=n(10763);let tO=(0,X.ZP)("form")({overflowY:"auto",display:"flex",flexDirection:"column"}),tz=e=>({position:"absolute",top:e.spacing(.5),right:e.spacing(.5)}),tB=({children:e,...t})=>(0,l.jsx)(tP.Z,{...t,children:e});tB.Header=({children:e,onClose:t,...n})=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tL.Z,{style:{textOverflow:"ellipsis",overflow:"hidden"},...n,children:e}),t&&(0,l.jsx)(H.Z,{"aria-label":"Close",onClick:t,sx:tz,children:(0,l.jsx)(tN.default,{})})]}),tB.Form=tO,tB.Content=({children:e,sx:t,...n})=>(0,l.jsx)(tR.Z,{dividers:!0,...n,sx:ei({minWidth:"500px",textWrap:"balance"},t),children:e}),tB.PrimaryButton=({children:e,...t})=>(0,l.jsx)(a.Z,{variant:"contained",type:"submit",...t,children:e}),tB.SecondaryButton=({children:e,...t})=>(0,l.jsx)(a.Z,{variant:"outlined",color:"secondary",...t,children:e}),tB.Actions=tF.Z;let t$=e=>{let{description:t,isOpen:n,onCancel:r,onDiscardChanges:i}=e;return(0,l.jsxs)(tB,{open:n,"aria-labelledby":"discard-dialog",children:[(0,l.jsx)(tB.Header,{children:"Discard Changes"}),(0,l.jsx)(tB.Content,{children:t}),(0,l.jsxs)(tB.Actions,{children:[(0,l.jsx)(a.Z,{variant:"contained",onClick:i,children:"Discard Changes"}),(0,l.jsx)(a.Z,{variant:"outlined",color:"secondary",onClick:r,children:"Cancel"})]})]})};var tH=n(90192),tW=n(23626),t_=n(39398);function tV(e){void 0===globalThis.useIdValue&&(globalThis.useIdValue=0);let t=(0,d.useRef)(void 0);return void 0===t.current&&(t.current=`${e}-${globalThis.useIdValue++}`),t.current}var tU=n(32964),tY=n(87143);let tG=({id:e,title:t,description:n,placement:r,children:i,enterDelay:o,enterNextDelay:a})=>{let s=(0,l.jsx)("span",{children:i});return(0,l.jsx)(tX,{arrow:!0,id:e,placement:r??"top",title:(0,l.jsx)(tK,{title:t,description:n}),enterDelay:o??500,enterNextDelay:a??500,children:s})},tK=({title:e,description:t})=>(0,l.jsxs)(l.Fragment,{children:[e&&(0,l.jsx)(e3.Z,{variant:"body2",sx:e=>({color:e.palette.text.primary,fontWeight:e.typography.fontWeightMedium}),children:e}),(0,l.jsx)(e3.Z,{variant:"caption",sx:e=>({color:e.palette.text.primary,whiteSpace:"pre-line"}),children:t})]}),tX=(0,X.ZP)(({className:e,...t})=>(0,l.jsx)(tU.Z,{...t,classes:{popper:e}}))(({theme:e})=>({[`& .${tY.Z.tooltip}`]:{backgroundColor:e.palette.background.tooltip,color:e.palette.text.primary,maxWidth:"300px",padding:e.spacing(1),boxShadow:e.shadows[1]},[`& .${tY.Z.arrow}`]:{color:e.palette.background.tooltip}})),tq=({label:e,control:t,description:n})=>{let r=tV("EditorSectionControl"),i=`${r}-control`;return(0,l.jsx)(tH.Z,{children:(0,l.jsxs)($.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[(0,l.jsxs)($.Z,{direction:"row",alignItems:"center",justifyContent:"center",children:[(0,l.jsx)(tW.Z,{htmlFor:i,children:e}),n&&(0,l.jsx)(tG,{description:n,enterDelay:100,children:(0,l.jsx)(H.Z,{size:"small",sx:e=>({borderRadius:e.shape.borderRadius,padding:"4x",margin:"0 2px"}),children:(0,l.jsx)(t_.default,{"aria-describedby":"info-tooltip","aria-hidden":!1,fontSize:"inherit",sx:{color:e=>e.palette.grey[700]}})})})]}),(0,l.jsxs)(b.Z,{sx:{width:"180px",textAlign:"right"},children:[" ",c().cloneElement(t,{id:i})]})]})})};var tJ=n(11774),tQ=n(57174);function t0({options:e,renderInput:t=e=>(0,l.jsx)(W.Z,{...e}),...n}){let r=e=>e.label??e.id;return(0,l.jsx)(tJ.Z,{isOptionEqualToValue:(e,t)=>e.id===t.id,getOptionDisabled:e=>!!e.disabled,getOptionLabel:r,options:e,renderInput:t,renderOption:({key:e,...t},n)=>(0,l.jsx)("li",{...t,children:(0,l.jsxs)("div",{children:[(0,l.jsx)(e3.Z,{variant:"body1",component:"div",children:r(n)}),n.description&&(0,l.jsx)(e3.Z,{variant:"body2",component:"div",sx:{color:e=>e.palette.text.secondary},children:n.description})]})},e),filterOptions:(0,tQ.D)({stringify:e=>`${r(e)} ${e.description||""}`}),...n})}let t1=[{id:"compact",label:"Compact"},{id:"standard",label:"Standard"},{id:"comfortable",label:"Comfortable"}];function t5({onChange:e,value:t="standard"}){return(0,l.jsx)(tq,{label:"Density",control:(0,l.jsx)(t0,{value:t1.find(e=>e.id===t),options:t1,getOptionLabel:e=>e.label,onChange:(t,{id:n})=>{e(n)},disableClearable:!0})})}function t2(){return(0,l.jsxs)($.Z,{direction:"row",alignItems:"center",children:[(0,l.jsx)(b.Z,{sx:{content:'""',width:8,height:8,boxSizing:"border-box",position:"absolute",backgroundColor:e=>e.palette.background.default,border:e=>`2px solid ${e.palette.info.main}`,borderRadius:"50%"}}),(0,l.jsx)(b.Z,{sx:{content:'""',height:2,background:e=>e.palette.info.main,width:"100%"}})]})}var t6=n(39020),t7=n(55255),t3=n(62422),t4=n(74183);let t8={type:"idle"};function t9({elements:e,accessKey:t,axis:n="vertical",onChange:r}){return(0,d.useEffect)(()=>(0,t7.sd)({onDrop({location:i,source:l}){let o=i.current.dropTargets[0];if(!o)return;let a=l.data,s=o.data,d=e.findIndex(e=>e[t]===a[t]),c=e.findIndex(e=>e[t]===s[t]);if(c<0||d<0)return;let u=(0,t4.A)(s);r((0,t6.h)({list:e,startIndex:d,indexOfTarget:c,closestEdgeOfTarget:u,axis:n}))}}),[t,n,e,r])}function ne({children:e,data:t}){let n=(0,d.useRef)(null),[r,i]=(0,d.useState)(t8);return(0,d.useEffect)(()=>{let e=n.current;if(e)return(0,t3.$)((0,t7.En)({element:e,getInitialData:()=>t,onDragStart(){i({type:"is-dragging"})},onDrop(){i(t8)}}),(0,t7.wO)({element:e,canDrop:({source:t})=>t.element!==e,getData:({input:n})=>(0,t4.X)(t,{element:e,input:n,allowedEdges:["top","bottom"]}),getIsSticky:()=>!0,onDragEnter({self:e}){i({type:"is-dragging-over",closestEdge:(0,t4.A)(e.data)})},onDrag({self:e}){let t=(0,t4.A)(e.data);i(e=>"is-dragging-over"===e.type&&e.closestEdge===t?e:{type:"is-dragging-over",closestEdge:t})},onDragLeave(){i(t8)},onDrop(){i(t8)}}))},[t]),(0,l.jsxs)($.Z,{ref:n,spacing:1,style:{opacity:"is-dragging"===r.type?.5:"unset"},children:["is-dragging-over"===r.type&&"top"===r.closestEdge?(0,l.jsx)(t2,{}):null,e,"is-dragging-over"===r.type&&"bottom"===r.closestEdge?(0,l.jsx)(t2,{}):null]})}var nt=n(5549),nn=n(11682);function nr(e,t){let n=t.indexOf(e);if(0===n)return t;let r=[...t];return r.splice(n,1),r.splice(n-1,0,e),r}function ni(e,t){let n=t.indexOf(e);if(n===t.length-1)return t;let r=[...t];return r.splice(n,1),r.splice(n+1,0,e),r}let nl=(0,d.forwardRef)(function({onMoveUp:e,onMoveDown:t,onMoveLeft:n,onMoveRight:r,menuSx:i,...o},a){let[s,c]=(0,d.useState)(null),u=!!s;function h(e){c(null),e?.()}return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(H.Z,{...o,ref:a,"aria-label":"move","aria-haspopup":!0,"aria-expanded":u,size:"small",onClick:function(e){c(e.currentTarget)},children:(0,l.jsx)(nn.default,{})}),(e||t||n||r)&&(0,l.jsxs)(nt.Z,{id:"drag-button-menu",MenuListProps:{"aria-labelledby":"drag-button-menu"},anchorEl:s,open:u,onClose:()=>h(void 0),sx:i,children:[e&&(0,l.jsx)(eb.Z,{onClick:()=>h(e),children:"Move Up"}),t&&(0,l.jsx)(eb.Z,{onClick:()=>h(t),children:"Move Down"}),n&&(0,l.jsx)(eb.Z,{onClick:()=>h(n),children:"Move Left"}),r&&(0,l.jsx)(eb.Z,{onClick:()=>h(r),children:"Move Right"}),r&&(0,l.jsx)(eb.Z,{onClick:()=>h(r),children:"Move Right"})]})]})});var no=n(76439),na=n(73957);let ns=({anchor:e="right",isOpen:t,onClose:n,PaperProps:r,children:i,...o})=>{let a=(0,no.Z)("(max-width:1080px)");return(0,l.jsx)(na.ZP,{...o,open:t,onClose:n,anchor:e,PaperProps:{...r,sx:ei({width:a?"100%":"1080px",overflow:"hidden"},r?.sx)},children:i})};var nd=n(315);function nc(e){let{error:t}=e;return(0,l.jsx)(nd.Z,{severity:"error",children:t.message})}var nu=n(68715);let nh=[{id:"default",label:"Default",value:void 0},{id:"12",label:"12",value:12},{id:"14",label:"14",value:14},{id:"16",label:"16",value:16},{id:"20",label:"20",value:20},{id:"24",label:"24",value:24},{id:"28",label:"28",value:28},{id:"32",label:"32",value:32},{id:"36",label:"36",value:36},{id:"40",label:"40",value:40},{id:"48",label:"48",value:48},{id:"56",label:"56",value:56},{id:"64",label:"64",value:64},{id:"72",label:"72",value:72},{id:"96",label:"96",value:96},{id:"128",label:"128",value:128},{id:"160",label:"160",value:160},{id:"192",label:"192",value:192}];function np({value:e,onChange:t}){return(0,l.jsx)(tq,{label:"Font Size",control:(0,l.jsx)(t0,{value:nh.find(t=>t.value===e),options:nh,getOptionLabel:e=>e.label,onChange:(e,{value:n})=>{t(n)},disableClearable:!0})})}var ng=n(79119);function nx({action:e,submitText:t="Save",cancelText:n="Cancel",isReadonly:r,isValid:i,onActionChange:o,onSubmit:s,onDelete:d,onCancel:c,...u}){return(0,l.jsx)($.Z,{direction:"row",gap:1,sx:{marginLeft:"auto"},...u,children:"read"===e?(0,l.jsxs)(l.Fragment,{children:[o&&(0,l.jsx)(a.Z,{disabled:r,variant:"contained",onClick:()=>o("update"),children:"Edit"}),d&&(0,l.jsx)(a.Z,{color:"error",disabled:r,variant:"outlined",onClick:d,children:"Delete"}),c&&(s||d)&&(0,l.jsx)(ng.Z,{orientation:"vertical",flexItem:!0,sx:{borderColor:e=>e.palette.grey["500"],"&.MuiDivider-root":{marginLeft:2,marginRight:1}}}),c&&(0,l.jsx)(a.Z,{color:"secondary",variant:"outlined",onClick:c,children:n})]}):(0,l.jsxs)(l.Fragment,{children:[s&&(0,l.jsx)(a.Z,{variant:"contained",disabled:!i,onClick:s,children:t}),c&&(0,l.jsx)(a.Z,{color:"secondary",variant:"outlined",onClick:c,children:n})]})})}var nm=n(78846);function nf(e){let{width:t,height:n,data:r,format:i,axisLine:o,max:a}=e,s=w(),d=(0,u.useDeepMemo)(()=>{if(void 0===r.value)return s.noDataOption;let e=nv(r.value,i,t,n);return{title:{show:!1},tooltip:{show:!1},series:[{type:"gauge",center:["50%","65%"],radius:"86%",startAngle:200,endAngle:-20,min:0,max:a,silent:!0,progress:{show:!0,width:16,itemStyle:{color:"auto"}},pointer:{show:!1},axisLine:{lineStyle:{color:[[1,"rgba(127,127,127,0.35)"]],width:16}},axisTick:{show:!1,distance:0},splitLine:{show:!1},axisLabel:{show:!1,distance:-18,color:"#999",fontSize:12},anchor:{show:!1},title:{show:!1},detail:{show:!1},data:[{value:r.value}]},{type:"gauge",center:["50%","65%"],radius:"100%",startAngle:200,endAngle:-20,min:0,max:a,pointer:{show:!0,icon:t>170?"path://M12.8,0.7l12,40.1H0.7L12.8,0.7z":"none",length:10,width:5,offsetCenter:[0,"-49%"],itemStyle:{color:"auto"}},axisLine:o,axisTick:{show:!1},splitLine:{show:!1},axisLabel:{show:!1},detail:{show:!0,width:"60%",borderRadius:8,offsetCenter:[0,"-9%"],color:"inherit",fontSize:e,formatter:null===r.value?()=>"null":e=>(0,u.formatValue)(e,i)},data:[{value:r.value,name:r.label,title:{show:!0,color:s.echartsTheme.textStyle?.color??"inherit",offsetCenter:[0,"55%"],overflow:"truncate",fontSize:12,width:.8*t}}]}]}},[r,t,n,s,i,o,a]);return(0,l.jsx)(P,{sx:{width:t,height:n,padding:`${s.container.padding.default}px`},option:d,theme:s.echartsTheme})}function nv(e,t,n,r){let i=Math.min(n,r)/(("number"==typeof e?(0,u.formatValue)(e,t):`${e}`).length??2)*.7;return`clamp(3px, ${i}px, 24px)`}(0,h.D)([nm.N,g.N,m.N,f.N,v.N]);var nb=n(97313),ny=n(10225),nj=n(68799);function nC(e){let t=(0,Q.Z)(),n="dark"===t.palette.mode,[r,i]=(0,d.useState)(()=>JSON.stringify(e.value,null,2)),[o,a]=(0,d.useState)(r);return(0,l.jsx)(nb.ZP,{...e,style:{border:`1px solid ${t.palette.divider}`},theme:n?"dark":"light",extensions:[(0,ny.AV)(),(0,nj.ir)((0,ny.ap)()),(0,nj.Q2)()],value:r,onChange:t=>{i(t),e.onChange&&e.onChange(t)},onBlur:()=>{o!==r&&void 0!==e.onChange&&(e.onChange(r),a(r))},placeholder:e.placeholder})}var nw=n(44811),nZ=n(98857),nS=n(219),nk=n(17846),nT=n(55328),nM=n(4665),nI=n(20461);function nA(e,t){if(t){let n=t.toLowerCase();if("local"!==n&&"browser"!==n)return{...e,timeZone:"utc"===n?"UTC":t}}return e}function nD(e,t,n){let r=n?.toLowerCase();return n&&"local"!==r&&"browser"!==r?(0,nM.formatInTimeZone)(e,"utc"===r?"UTC":n,t):(0,nI.format)(e,t)}function nE(e,t,n){let r=nA({hour:"numeric",minute:"numeric",hourCycle:"h23"},n);return t<=18e5?r.second="numeric":t>=864e5&&(r.month="numeric",r.day="numeric"),new Intl.DateTimeFormat(void 0,r).format(e).replace(/, /g," ")}function nL(e){return e>15768e7?"{yyyy}":e>63072e6?"{MMM} {yyyy}":e>432e6&&e<1577664e4?"{MM}/{dd}":e>1728e5&&e<=432e6?"{MM}/{dd} {HH}:{mm}":{year:"{yearStyle|{yyyy}}\n{monthStyle|{MMM}}",month:"{MMM}",day:"{MM}/{dd}"}}let nR=e=>{if(!e)return{formattedDate:"",formattedTime:""};let t=new Date(e);return{formattedDate:(0,nI.format)(t,"MMM dd, yyyy - "),formattedTime:(0,nI.format)(t,"HH:mm:ss")}},nP=(0,d.createContext)(void 0);function nF(e){let{children:t,timeZone:n}=e;return(0,l.jsx)(nP.Provider,{value:n,children:t})}function nN(){let e=(0,d.useContext)(nP);return{timeZone:e??"local",formatWithUserTimeZone:(t,n)=>nD(t,n,e),dateFormatOptionsWithUserTimeZone:t=>nA(t,e)}}let nO=375,nz=650,nB=650,n$=500,nH=.75,nW=8,n_=750,nV="nearby series showing in tooltip",nU="emphasized series showing as bold in tooltip",nY="#2E313E",nG=new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!0}),nK={coords:{plotCanvas:{x:0,y:0},zrender:{x:0,y:0},target:null},chartWidth:0},nX=[],nq={ie:navigator.userAgent.match(/MSIE\s([\d.]+)/)||navigator.userAgent.match(/Trident\/.+?rv:(([\d.]+))/),edge:navigator.userAgent.match(/Edge?\/([\d.]+)/)},nJ="onpointerdown"in window&&(nq.edge||nq.ie&&nq.ie[1]&&+nq.ie[1]>=11),nQ=nJ?"pointermove":"mousemove",n0=()=>{let[e,t]=(0,d.useState)(null);return(0,d.useEffect)(()=>{let e=e=>t({page:{x:e.pageX,y:e.pageY},client:{x:e.clientX,y:e.clientY},plotCanvas:{x:e.zrX,y:e.zrY},target:e.target});return window.addEventListener(nQ,e),()=>{window.removeEventListener(nQ,e)}},[]),e},n1={wrapLabels:!0,enablePinning:!0},n5="Click chart to pin",n2="Click chart to unpin";var n6=n(7444),n7=n(75276);function n3(e){let{markerColor:t,sx:n}=e;return(0,l.jsx)(b.Z,{sx:ei({display:"inline-block",width:"11px",height:"11px",borderRadius:"2px",marginRight:1,verticalAlign:"top"},n),style:{backgroundColor:t}})}function n4(e){let{formattedY:t,markerColor:n,metricName:r,metricLabels:i}=e;return(0,l.jsxs)($.Z,{spacing:.5,children:[(0,l.jsxs)(b.Z,{sx:e=>({display:"flex",height:"16px",flexDirection:"row",alignItems:"center",justifyContent:"left",color:e.palette.common.white,fontSize:"11px"}),children:[(0,l.jsx)(n3,{markerColor:n,sx:{marginTop:.25}}),(0,l.jsxs)(b.Z,{component:"span",children:[r,(0,l.jsx)(b.Z,{component:"span",sx:e=>({color:e.palette.common.white,fontWeight:700,paddingLeft:"2px"}),children:t})]})]}),(0,l.jsx)(ng.Z,{sx:e=>({borderColor:e.palette.grey["500"]})}),(0,l.jsx)(b.Z,{sx:e=>({color:e.palette.common.white}),children:i.map(e=>{if(e){let[t,n]=e.split("="),r=void 0!==n?`${t}: `:t,i=void 0!==n?n.replace(/(^"|"$)/g,""):n;return(0,l.jsxs)(b.Z,{sx:{display:"flex",gap:"4px"},children:[(0,l.jsx)(e3.Z,{sx:{fontSize:"11px"},children:r}),(0,l.jsx)(e3.Z,{sx:e=>({color:e.palette.common.white,fontWeight:700,fontSize:"11px"}),children:i})]},e)}})})]})}function n8(e){let{seriesName:t,formattedY:n,markerColor:r,totalSeries:i,emphasizeText:o=!1,wrapLabels:a=!0}=e,s=t.split("{"),d=(s[1]??t).replace(/[{}]/g,"").split(",");if(1===i&&d.length>1){let e=s[0]?`${s[0]}:`:"value:";return(0,l.jsx)(n4,{formattedY:n,metricName:e,metricLabels:d,markerColor:r})}let c=t.replace(/[,]/g,", ");return(0,l.jsxs)(b.Z,{sx:{display:"table-row",paddingTop:.5},children:[(0,l.jsxs)(b.Z,{sx:{display:"table-cell",maxWidth:"520px"},children:[(0,l.jsx)(n3,{markerColor:r,sx:{marginTop:.5}}),(0,l.jsx)(b.Z,{component:"span",sx:e=>({display:"inline-block",width:"calc(100% - 20px)",minWidth:150,maxWidth:n$,overflow:"hidden",color:e.palette.common.white,fontWeight:o?e.typography.fontWeightBold:e.typography.fontWeightRegular,textOverflow:"ellipsis",whiteSpace:a?"normal":"nowrap"}),"aria-label":o?nU:nV,children:c})]}),(0,l.jsx)(b.Z,{sx:e=>({display:"table-cell",paddingLeft:1.5,textAlign:"right",verticalAlign:"top",fontWeight:o?e.typography.fontWeightBold:e.typography.fontWeightRegular}),children:n})]})}function n9(e){let{series:t,wrapLabels:n}=e,r=(0,d.useMemo)(()=>null===t?null:t.sort((e,t)=>e.y>t.y?-1:1),[t]);return null===t||null===r?null:(0,l.jsx)(b.Z,{sx:e=>({display:"table",padding:e.spacing(.5,2)}),children:r.map(({datumIdx:e,seriesIdx:t,seriesName:i,y:o,formattedY:a,markerColor:s,isClosestToCursor:d})=>{if(null===e||null===t)return null;let c=t.toString()+e.toString();return(0,l.jsx)(n8,{seriesName:i,y:o,formattedY:a,markerColor:s,totalSeries:r.length,wrapLabels:n,emphasizeText:d},c)})})}var re=n(87895),rt=n(1889),rn=n(75186);let rr=(0,d.memo)(function({nearbySeries:e,totalSeries:t,isTooltipPinned:n,showAllSeries:r,enablePinning:i=!0,onShowAllClick:o,onUnpinClick:a}){let s=e[0]?.date??null;if(null===s)return null;let d=i&&t>5;return(0,l.jsxs)(b.Z,{sx:e=>({width:"100%",maxWidth:nz,padding:e.spacing(1.5,2,.5,2),backgroundColor:e.palette.designSystem?.grey[800]??nY,position:"sticky",top:0,left:0}),children:[(0,l.jsxs)(b.Z,{sx:{width:"100%",display:"flex",justifyContent:"start",alignItems:"center",paddingBottom:.5},children:[(e=>{let{formattedTime:t,formattedDate:n}=nR(e);return(0,l.jsxs)(b.Z,{children:[(0,l.jsx)(e3.Z,{variant:"caption",sx:e=>({color:e.palette.common.white}),children:n}),(0,l.jsx)(e3.Z,{variant:"caption",children:(0,l.jsx)("strong",{children:t})})]})})(s),(0,l.jsxs)($.Z,{direction:"row",gap:1,sx:{marginLeft:"auto"},children:[d&&(0,l.jsxs)($.Z,{direction:"row",gap:.5,alignItems:"center",sx:{textAlign:"right"},children:[(0,l.jsx)(e3.Z,{sx:{fontSize:11},children:"Show All"}),(0,l.jsx)(re.Z,{checked:r,size:"small",onChange:(e,t)=>{if(void 0!==o)return o(t)},sx:e=>({"& .MuiSwitch-switchBase":{color:e.palette.common.white},"& .MuiSwitch-track":{backgroundColor:e.palette.common.white}})})]}),i&&(0,l.jsxs)($.Z,{direction:"row",alignItems:"center",children:[(0,l.jsx)(e3.Z,{sx:{marginRight:.5,fontSize:11,verticalAlign:"middle"},children:n?n2:n5}),n?(0,l.jsx)(rt.default,{onClick:()=>{void 0!==a&&a()},sx:{fontSize:16,cursor:"pointer"}}):(0,l.jsx)(rn.default,{sx:{fontSize:16}})]})]})]}),(0,l.jsx)(ng.Z,{sx:e=>({width:"100%",borderColor:e.palette.grey["500"]})})]})}),ri=1e3,rl="Pinned Crosshair",ro={name:rl,type:"line",markLine:{data:[],lineStyle:{type:"dashed",width:2},emphasis:{lineStyle:{width:2,opacity:1}},blur:{lineStyle:{width:2,opacity:1}}}};function ra(e){let t=e._model;void 0!==t&&void 0!==t.option.toolbox&&t.option.toolbox.length>0&&"normal"===t.option.toolbox[0].feature.dataZoom.iconStatus.zoom&&e.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:!0})}function rs(e){e.dispatchAction({type:"restore"})}function rd(e){void 0!==e.dispatchAction&&(e.dispatchAction({type:"unselect"}),e.dispatchAction({type:"downplay"}))}function rc(e,t,n){if(void 0===n)return null;let r=[e,t];return n.containPixel("grid",r)?n.convertFromPixel("grid",r):null}function ru(e,t,n,r,i,l){let o=l.length>0?l[l.length-1]:i[i.length-1];void 0!==o&&e.dispatchAction({type:"select",seriesIndex:o.seriesIndex,dataIndex:o.dataIndex,escapeConnect:!0}),e.dispatchAction({type:"downplay",seriesIndex:r}),n.length>0?e.dispatchAction({type:"highlight",seriesIndex:n,notBlur:!1,escapeConnect:!0}):(e.dispatchAction({type:"highlight",seriesIndex:t,notBlur:!0,escapeConnect:!0}),e.dispatchAction({type:"toggleSelect"}))}function rh(e){return e[e.length-1]?.name===rl}function rp(e,t){if(void 0===e||void 0===t)return null;let n=null,r=1/0;for(let[i]of e){let e=Math.abs(i-t);e<r&&(n=i,r=e)}return n}function rg(e,t){if(void 0===t)return null;let n=e.length,r=null;for(let i=0;i<n;i++){let l=n>0?e[i]:null;if(!l)break;r=rp(l.values,t)}return r}let rx=5.5,rm=30,rf=5;function rv(e,t,n,r,i,l){let o=[],a=n[0]??null,s=n[1]??null;if(null===a||null===s||void 0===i.dispatchAction||!Array.isArray(e))return o;let d=[],c=[],h=[],p=[],g=[],x=e.length,m=new Map,f=rp(e[0]?.values,a);if(null===f)return nX;for(let n=0;n<x;n++){let a=t[n];if(!a)break;let v=x>0?e[n]:null;if(!v)break;let b=v.values;if(void 0===b||!Array.isArray(b))break;let y=a.name?a.name.toString():"",j=a.color??"#000";if(Array.isArray(e))for(let e=0;e<b.length;e++){let t=b[e];if(void 0===t||!Array.isArray(t))break;let a=t[0],v=t[1];if(null!=v&&f===a&&s<=v+r&&s>=v-r){let t=rC({valueToCheck:s,baseValue:v,percentage:Math.max(x>rf?2:5,100/x)});if(t){c.push(n);let t=m.get(v)??0;m.set(v,t+1),t>0&&g.push({seriesIndex:n,dataIndex:e,seriesName:y,yValue:v}),p.push({seriesIndex:n,dataIndex:e,seriesName:y,yValue:v})}else h.push(n),i.dispatchAction({type:"downplay",seriesIndex:n});let r=(0,u.formatValue)(v,l);o.push({seriesIdx:n,datumIdx:e,seriesName:y,date:f,x:a,y:v,formattedY:r,markerColor:j.toString(),isClosestToCursor:t}),d.push(n)}}}return ru(i,d,c,h,p,g),o}function rb(e,t,n,r,i){let l=[],o=t[0]??null,a=t[1]??null;if(null===o||null===a)return l;let s=[],d=[],c=[],h=e.timeSeries.length;if(Array.isArray(e.xAxis)&&Array.isArray(e.timeSeries))for(let t=0;t<h;t++){let p=e.timeSeries[t];if(void 0===p||l.length>=ri)break;let g=p.name?p.name.toString():"",x=p.color??"#000";if(Array.isArray(p.data))for(let m=0;m<p.data.length;m++){let f=e.xAxis[m]??0,v=p.data[m];if(null!=v&&o===m&&"-"!==v&&a<=v+n&&a>=v-n){let e=rC({valueToCheck:a,baseValue:v,percentage:Math.max(h>rf?2:5,100/h)});e?d.push(t):(c.push(t),r?.dispatchAction!==void 0&&r.dispatchAction({type:"downplay",seriesIndex:t}));let n=f>0x174876e7ff?f:1e3*f,o=(0,u.formatValue)(v,i);l.push({seriesIdx:t,datumIdx:m,seriesName:g,date:n,x:f,y:v,formattedY:o,markerColor:x.toString(),isClosestToCursor:e}),s.push(t)}}}return r?.dispatchAction!==void 0&&(r.dispatchAction({type:"downplay",seriesIndex:c}),d.length>0?r.dispatchAction({type:"highlight",seriesIndex:d,notBlur:!1,escapeConnect:!0}):r.dispatchAction({type:"highlight",seriesIndex:s,notBlur:!0,escapeConnect:!0})),l}function ry({mousePos:e,pinnedPos:t,data:n,seriesMapping:r,chart:i,format:l,showAllSeries:o=!1}){if(void 0===i||null===e)return nX;let a=!1;if(null!==e.target){let t=e.target.parentElement;if(null!==t){let e=t.parentElement;null!==e&&i.getDom()===e&&(a=!0)}}if(null!==t&&(e=t,a=!0),!1===a||null===n||void 0===i._model||void 0===e.plotCanvas.x||void 0===e.plotCanvas.y)return nX;let s=rc(e.plotCanvas.x,e.plotCanvas.y,i);if(null!==s){let e=rw({yInterval:i._model.getComponent("yAxis").axis.scale._interval,totalSeries:n.length,showAllSeries:o});return rv(n,r,s,e,i,l)}return nX}function rj({mousePos:e,pinnedPos:t,chartData:n,chart:r,format:i,showAllSeries:l=!1}){if(void 0===r||null===e)return[];let o=!1;if(null!==e.target){let t=e.target.parentElement;if(null!==t){let e=t.parentElement;null!==e&&r.getDom()===e&&(o=!0)}}if(null!==t&&(e=t,o=!0),!1===o||void 0===r._model)return[];let a=rw({yInterval:r._model.getComponent("yAxis").axis.scale._interval,totalSeries:n.timeSeries.length,showAllSeries:l}),s=[e.plotCanvas.x??0,e.plotCanvas.y??0];if(r.containPixel("grid",s)){let e=r.convertFromPixel("grid",s);if(void 0!==e[0]&&void 0!==e[1])return rb(n,e,a,r,i)}return[]}function rC({valueToCheck:e,baseValue:t,percentage:n}){let r=n/100*t;return e>=t-r&&e<=t+r}function rw({yInterval:e,totalSeries:t,showAllSeries:n=!1}){if(n)return 10*e;let r=.3*e;return t>rf?Math.max(r,e*rm/t):Math.max(r,e*rx)}function rZ(e,t,n,r,i){if(null===e||(null!==t&&(e=t),void 0===e.plotCanvas.x))return;let l=e.page.x+32,o=e.page.y+16;if(i){let e=i.getBoundingClientRect();l=l-e.left+i.scrollLeft,o=o-e.top+i.scrollTop;let t=e.top+i.scrollHeight;o+n>t&&(o=Math.max(t-n-16,nW/2))}else o+n>window.innerHeight+window.scrollY&&(o=Math.max(window.innerHeight+window.scrollY-n-16,nW/2));return l+r>window.innerWidth&&(l=e.page.x-r-32),l<32&&(l=32),o<nW/2&&(o=nW/2),`translate3d(${l}px, ${o}px, 0)`}function rS(e,t,n){return{minWidth:nO,maxWidth:nz,maxHeight:(n?n-nW:void 0)??nB,padding:0,position:"absolute",top:0,left:0,backgroundColor:e.palette.designSystem?.grey[800]??nY,borderRadius:"6px",color:"#fff",fontSize:"11px",visibility:"visible",opacity:1,transition:"all 0.1s ease-out",zIndex:null!==t?"auto":e.zIndex.tooltip,overflow:"hidden","&:hover":{overflowY:"auto"}}}let rk=(0,d.memo)(function({chartRef:e,chartData:t,enablePinning:n=!0,wrapLabels:r,format:i,onUnpinClick:o,pinnedPos:a,containerId:s}){let[c,u]=(0,d.useState)(!1),h=n0(),{height:p,width:g,ref:x}=(0,n7.default)(),m=(0,d.useRef)(),f=null!==a&&n;if(null===h||null===h.target||null===a&&"CANVAS"!==h.target.tagName)return null;let v=rj({mousePos:h,chartData:t,pinnedPos:a,chart:e.current,format:i,showAllSeries:c});if(0===v.length)return null;let y=t.timeSeries.length,j=s?document.querySelector(s):void 0,C=j?j.getBoundingClientRect().height:void 0;return m.current=rZ(h,a,p??0,g??0,j),(0,l.jsx)(n6.Z,{container:j,children:(0,l.jsx)(b.Z,{ref:x,sx:e=>({minWidth:nO,maxWidth:nz,maxHeight:C??nB,padding:0,position:"absolute",top:0,left:0,backgroundColor:e.palette.designSystem?.grey[800]??nY,borderRadius:"6px",color:"#fff",fontSize:"11px",visibility:"visible",opacity:1,transition:"all 0.1s ease-out",zIndex:null!==a?"auto":e.zIndex.tooltip,overflow:"hidden","&:hover":{overflowY:"auto"}}),style:{transform:m.current,display:m.current?"block":"none"},children:(0,l.jsxs)($.Z,{spacing:.5,children:[(0,l.jsx)(rr,{nearbySeries:v,totalSeries:y,enablePinning:n,isTooltipPinned:f,showAllSeries:c,onShowAllClick:e=>u(e),onUnpinClick:o}),(0,l.jsx)(n9,{series:v,wrapLabels:r})]})})})});(0,h.D)([nw.N,g.N,D.N,nZ.N,nS.N,nk.N,m.N,nT.N,f.N,E.N,v.N]);let rT=(0,d.forwardRef)(function({height:e,data:t,yAxis:n,format:r,grid:i,legend:o,tooltipConfig:a=n1,noDataVariant:s="message",syncGroup:c,onDataZoom:u,onDoubleClick:h,__experimentalEChartsOptionsOverride:p},g){let x=w(),m=(0,d.useRef)(),[f,v]=(0,d.useState)(!0),[y,j]=(0,d.useState)(null),{timeZone:C}=nN(),[Z,S]=(0,d.useState)(!1),[k,T]=(0,d.useState)(0);(0,d.useImperativeHandle)(g,()=>({highlightSeries({id:e}){m.current&&m.current.dispatchAction({type:"highlight",seriesId:e})},clearHighlightedSeries:()=>{m.current&&rd(m.current)}}),[]);let M=(0,d.useMemo)(()=>({datazoom:e=>{if(void 0===u&&setTimeout(()=>{j(null)},10),void 0===u||void 0===e.batch[0])return;let n=e.batch[0].startValue??0,r=e.batch[0].endValue??t.xAxis.length-1,i=t.xAxis[n],l=t.xAxis[r];void 0!==i&&void 0!==l&&u({start:i,end:l,startIndex:n,endIndex:r})}}),[t,u,j]);void 0!==m.current&&ra(m.current);let{noDataOption:I}=x,A=(0,d.useMemo)(()=>{if(void 0===t.timeSeries)return{};if(null===t.timeSeries||0===t.timeSeries.length&&"message"===s)return I;let e=t.rangeMs??z(t.xAxis),l={series:t.timeSeries,xAxis:{type:"category",data:t.xAxis,max:t.xAxisMax,axisLabel:{formatter:t=>nE(t,e,C)}},yAxis:O(n,r),animation:!1,tooltip:{show:!0,trigger:"axis",showContent:!1},axisPointer:{type:"line",z:0,triggerEmphasis:!1,triggerTooltip:!1,snap:!0},toolbox:{feature:{dataZoom:{icon:null,yAxisIndex:"none"}}},grid:i,legend:o};return p?p(l):l},[t,n,r,i,o,I,C,p,s]);return(0,l.jsxs)(b.Z,{style:{height:e},onClick:e=>{a.enablePinning&&e.target instanceof HTMLCanvasElement&&j(t=>null===t?{page:{x:e.pageX,y:e.pageY},client:{x:e.clientX,y:e.clientY},plotCanvas:{x:e.nativeEvent.offsetX,y:e.nativeEvent.offsetY},target:e.target}:null)},onMouseDown:e=>{let{clientX:t}=e;S(!0),T(t)},onMouseMove:e=>{if(!(e.target instanceof HTMLCanvasElement))return;let{clientX:t}=e;Z&&t-k>0&&v(!1)},onMouseUp:()=>{S(!1),T(0),v(!0)},onMouseLeave:()=>{null===y&&v(!1),void 0!==m.current&&rd(m.current)},onMouseEnter:()=>{v(!0),void 0!==m.current&&ra(m.current)},onDoubleClick:e=>{j(null),void 0===h?void 0!==m.current&&rs(m.current):h(e)},children:[!0===f&&A.tooltip?.showContent===!1&&!0!==a.hidden&&(0,l.jsx)(rk,{chartRef:m,chartData:t,wrapLabels:a.wrapLabels,enablePinning:a.enablePinning,pinnedPos:y,format:r,onUnpinClick:()=>{j(null)},containerId:x.tooltipPortalContainerId}),(0,l.jsx)(P,{sx:{width:"100%",height:"100%"},option:A,theme:x.echartsTheme,onEvents:M,_instance:m,syncGroup:c})]})});var rM=n(28797),rI=n(48137),rA=n(33755),rD=n(86396);function rE({control:e,...t}){let{fields:n,append:r,remove:i}=(0,rI.useFieldArray)({control:e,name:"panelDefinition.spec.links"});return(0,l.jsxs)($.Z,{...t,gap:3,children:[n&&n.length>0?n.map((t,n)=>(0,l.jsxs)(d.Fragment,{children:[(0,l.jsxs)($.Z,{direction:"row",gap:1,alignItems:"center",children:[(0,l.jsx)(rL,{control:e,index:n}),(0,l.jsx)(H.Z,{style:{width:"fit-content",height:"fit-content"},onClick:()=>i(n),children:(0,l.jsx)(rD.default,{})})]}),(0,l.jsx)(ng.Z,{})]},t.id)):(0,l.jsx)(e3.Z,{variant:"subtitle1",mb:2,fontStyle:"italic",children:"No links defined"}),(0,l.jsx)(H.Z,{style:{width:"fit-content",height:"fit-content"},onClick:()=>r({url:""}),children:(0,l.jsx)(rA.default,{})})]})}function rL({control:e,index:t}){return(0,l.jsxs)($.Z,{gap:2,flexGrow:1,children:[(0,l.jsxs)($.Z,{direction:"row",gap:2,children:[(0,l.jsx)(rI.Controller,{control:e,name:`panelDefinition.spec.links.${t}.url`,render:({field:e,fieldState:t})=>(0,l.jsx)(W.Z,{...e,required:!0,fullWidth:!0,label:"URL",error:!!t.error,helperText:t.error?.message,onChange:t=>{e.onChange(t)}})}),(0,l.jsx)(rI.Controller,{control:e,name:`panelDefinition.spec.links.${t}.name`,render:({field:e,fieldState:t})=>(0,l.jsx)(W.Z,{...e,fullWidth:!0,label:"Name",defaultValue:"",error:!!t.error,helperText:t.error?.message,onChange:t=>{e.onChange(t)}})}),(0,l.jsx)(rI.Controller,{control:e,name:`panelDefinition.spec.links.${t}.tooltip`,render:({field:e,fieldState:t})=>(0,l.jsx)(W.Z,{...e,fullWidth:!0,label:"Tooltip",defaultValue:"",error:!!t.error,helperText:t.error?.message,onChange:t=>{e.onChange(t)}})})]}),(0,l.jsxs)($.Z,{gap:2,direction:"row",alignItems:"center",children:[(0,l.jsx)(rI.Controller,{control:e,name:`panelDefinition.spec.links.${t}.renderVariables`,render:({field:e})=>(0,l.jsx)(rM.Z,{label:"Render Variables",control:(0,l.jsx)(tb.Z,{...e,checked:e.value,onChange:t=>e.onChange(t.target.checked)})})}),(0,l.jsx)(rI.Controller,{control:e,name:`panelDefinition.spec.links.${t}.targetBlank`,render:({field:e})=>(0,l.jsx)(rM.Z,{label:"Open in new tab",control:(0,l.jsx)(tb.Z,{...e,checked:e.value,onChange:t=>e.onChange(t.target.checked)})})})]})]})}let rR=[{id:"value",label:"Value"},{id:"percentage",label:"Percentage"}];function rP({disablePercentageMode:e,onChange:t,value:n="value"}){return(0,l.jsx)(tq,{label:"Mode",control:(0,l.jsx)(t0,{value:rR.find(e=>e.id===n),options:rR,getOptionLabel:e=>e.label,getOptionDisabled:t=>"percentage"===t.id&&e,onChange:(e,{id:n})=>{t(n)},disableClearable:!0})})}var rF=n(38359);let rN=({children:e})=>(0,l.jsx)(rF.ZP,{item:!0,xs:4,children:(0,l.jsx)($.Z,{spacing:3,children:e})}),rO=({children:e})=>(0,l.jsx)(rF.ZP,{container:!0,spacing:8,children:e}),rz=({title:e,children:t,icon:n})=>(0,l.jsxs)(b.Z,{children:[(0,l.jsxs)(b.Z,{display:"flex",borderBottom:1,borderColor:"grey.300",marginBottom:e=>e.spacing(1),children:[(0,l.jsx)(e3.Z,{variant:"overline",component:"h4",children:e}),n&&(0,l.jsx)(b.Z,{sx:{marginLeft:"auto"},children:n})]}),(0,l.jsx)($.Z,{spacing:1,children:t})]});var rB=n(66224);function r$(e){let{message:t}=e;return(0,l.jsx)($.Z,{sx:{height:"100%",alignItems:"center",justifyContent:"center"},children:(0,l.jsx)(e3.Z,{children:t})})}function rH(e){let{resource:t}=e;return(0,l.jsx)(r$,{message:`No ${t}`})}function rW(e){let{variant:t="rounded"}=e;return(0,l.jsx)($.Z,{sx:{height:"100%",alignItems:"center",justifyContent:"center",px:1},children:(0,l.jsx)(rB.Z,{variant:t,width:"100%",height:"30%","aria-label":"Loading..."})})}let r_=[{id:"asc",label:"Ascending"},{id:"desc",label:"Descending"}];function rV({onChange:e,value:t="desc"}){return(0,l.jsx)(tq,{label:"Sort",control:(0,l.jsx)(t0,{value:r_.find(e=>e.id===t),options:r_,getOptionLabel:e=>e.label,onChange:(t,{id:n})=>{e(n)},disableClearable:!0})})}function rU({onChange:e,value:t,...n}){let r=t=>{e(t)};return(0,l.jsxs)(o.Z,{"aria-label":"Sort",...n,children:[(0,l.jsx)(a.Z,{onClick:()=>r(void 0),variant:void 0===t?"contained":"outlined",children:"None"}),(0,l.jsx)(a.Z,{onClick:()=>r("asc"),variant:"asc"===t?"contained":"outlined",children:"Asc"}),(0,l.jsx)(a.Z,{onClick:()=>r("desc"),variant:"desc"===t?"contained":"outlined",children:"Desc"})]})}function rY({text:e,fontWeight:t,width:n,height:i,lineHeight:l,maxSize:o,fontSizeOverride:a}){let s=function(){if(!r&&null===(r=document.createElement("canvas").getContext("2d")))throw Error("Canvas context is null.");return r}(),{echartsTheme:d}=w();if(void 0!==a)return Number(a);let c=d.textStyle,u=Number(c?.fontSize)??12,h=c?.fontFamily??"Lato",p=`${t} ${u}px ${h}`;s.font=p;let g=Math.min(i/l,n/s.measureText(e).width*u);return o?Math.min(g,o):g}let rG=(e,t)=>null===e?"null":"number"==typeof e?(0,u.formatValue)(e,t):void 0===e?"":e;(0,h.D)([nw.N,g.N,x.N,m.N,f.N,v.N]);let rK=e=>{let{width:t,height:n,data:r,sparkline:i,showSeriesName:o,format:a,valueFontSize:s}=e,c=w(),u=r.color,h=rG(r.calculatedValue,a),p=c.container.padding.default,g=rY({text:r?.seriesData?.name??"",fontWeight:400,width:t,height:.125*n,lineHeight:1.2,maxSize:30}),x=o?1.2*g+p:0,m=t-2*p,f=n-x,v=rY({text:h,fontSizeOverride:s,fontWeight:700,width:i?m:.5*m,height:i?.25*f:.9*f,lineHeight:1.2}),y=1.2*v;g=Math.min(.7*v,g);let j=(0,d.useMemo)(()=>{if(void 0===r.seriesData)return c.noDataOption;let e=r.seriesData,t=[];if(void 0!==i){let n={type:"line",name:e.name,data:e.values,zlevel:1,symbol:"none",animation:!1,silent:!0},r=N()(n,i);t.push(r)}return{title:{show:!1},grid:{show:!1,top:"35%",right:0,bottom:0,left:0,containLabel:!1},xAxis:{type:"time",show:!1,boundaryGap:!1},yAxis:{type:"value",show:!1,min:e=>e.min>=0&&e.min<=1?0:e.min},tooltip:{show:!1},series:t}},[r,c,i]),C=i?"auto":"center";return(0,l.jsxs)(b.Z,{sx:{height:"100%",width:"100%",display:"flex",flexDirection:"column",justifyContent:C,alignItems:C},children:[o&&(0,l.jsx)(rX,{padding:p,fontSize:g,children:r.seriesData?.name}),(0,l.jsx)(rq,{variant:"h3",color:u,fontSize:v,padding:p,children:h}),void 0!==i&&(0,l.jsx)(P,{sx:{width:"100%"},style:{height:Math.floor(n-x-y)},option:j,theme:c.echartsTheme,renderer:"svg"})]})},rX=(0,X.ZP)(e3.Z,{shouldForwardProp:e=>"padding"!==e&&"fontSize"!==e})(({theme:e,padding:t,fontSize:n})=>({color:e.palette.text.secondary,padding:`${t}px`,fontSize:`${n}px`,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"})),rq=(0,X.ZP)(e3.Z,{shouldForwardProp:e=>"color"!==e&&"padding"!==e&&"fontSize"!==e&&"sparkline"!==e})(({theme:e,color:t,padding:n,fontSize:r,sparkline:i})=>({color:t??e.palette.text.primary,fontSize:`${r}px`,padding:i?`${n}px ${n}px 0 ${n}px`:` 0 ${n}px`,whiteSpace:"nowrap",lineHeight:1.2}));var rJ=n(5404),rQ=n(98346),r0=n(12434),r1=n(22446);function r5({inputRef:e,label:t,color:n,value:r,mode:i,onChange:o,onColorChange:a,onBlur:s,onDelete:c}){let[u,h]=(0,d.useState)(0);return(0,l.jsxs)($.Z,{flex:1,direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,children:[(0,l.jsx)(q,{label:t,color:n,onColorChange:a}),(0,l.jsx)(tW.Z,{htmlFor:t,children:t}),(0,l.jsx)(W.Z,{id:t,inputRef:e,type:"number",value:0===r?"":r,placeholder:"0",onChange:o,onBlur:s,onKeyDown:e=>{"Enter"===e.key&&(s(),h(u+1))},InputProps:{endAdornment:"percent"===i?(0,l.jsx)(b.Z,{paddingX:1,children:"%"}):void 0}},u),(0,l.jsx)(H.Z,{"aria-label":`delete threshold ${t}`,size:"small",onClick:c,children:(0,l.jsx)(r1.default,{})})]})}function r2({thresholds:e,onChange:t,hideDefault:n,disablePercentMode:r}){let{thresholds:{defaultColor:i,palette:o}}=w(),a=e?.defaultColor??i,[s,c]=(0,d.useState)(e?.steps);(0,d.useEffect)(()=>{c(e?.steps)},[e?.steps]);let u=(0,d.useRef)(null),h=(0,d.useRef)(!1);(0,d.useEffect)(()=>{u.current&&h.current&&(u.current?.focus(),h.current=!1)},[s?.length]);let p=(e,t)=>{c((0,ee.Uy)(s,n=>{let r=n?.[t];r&&(r.value=Number(e.target.value))}))},g=(n,r)=>{void 0!==e&&t((0,ee.Uy)(e,e=>{if(void 0!==e.steps){let t=e.steps[r];t&&(t.color=n)}}))},x=()=>{if(void 0!==s){let n=[...s];n.sort((e,t)=>e.value-t.value),void 0!==e&&t((0,ee.Uy)(e,e=>{e.steps=n}))}},m=n=>{void 0!==e&&t((0,ee.Uy)(e,e=>{e.steps&&e.steps.splice(n,1)}))};return(0,l.jsxs)(rz,{title:"Thresholds",icon:(0,l.jsx)(tG,{description:"Add threshold",children:(0,l.jsx)(H.Z,{size:"small","aria-label":"add threshold",onClick:()=>{h.current=!0,void 0===e?t({steps:[{value:10}]}):e&&void 0===e.steps?t((0,ee.Uy)(e,e=>{e.steps=[{value:10}]})):t((0,ee.Uy)(e,e=>{let t=e.steps;if(t?.length){let e=t[t.length-1],n=o[t.length]??r6();t.push({color:n,value:(e?.value??0)+10})}else t&&t.push({value:10})}))},children:(0,l.jsx)(rA.default,{})})}),children:[(0,l.jsx)(tq,{label:"Mode",description:"Percentage means thresholds relative to min & max",control:(0,l.jsxs)(rJ.Z,{exclusive:!0,disabled:r,value:e?.mode??"absolute",onChange:(n,r)=>{let i="percent"===r?"percent":void 0;void 0!==e?t((0,ee.Uy)(e,e=>{e.mode=i})):t({mode:i})},sx:{height:"36px",marginLeft:"auto"},children:[(0,l.jsx)(rQ.Z,{"aria-label":"absolute",value:"absolute",sx:{fontWeight:500},children:"Absolute"}),(0,l.jsx)(rQ.Z,{"aria-label":"percent",value:"percent",sx:{fontWeight:500},children:"Percent"})]})}),s&&s.map((t,n)=>(0,l.jsx)(r5,{inputRef:n===s.length-1?u:void 0,label:`T${n+1}`,color:t.color??o[n]??a,value:t.value,mode:e?.mode,onColorChange:e=>g(e,n),onChange:e=>{p(e,n)},onDelete:()=>{m(n)},onBlur:x},n)).reverse(),!n&&(0,l.jsxs)(r0.Z,{flex:1,direction:"row",alignItems:"center",spacing:1,children:[(0,l.jsx)(q,{label:"default",color:a,onColorChange:n=>{void 0!==e?t((0,ee.Uy)(e,e=>{e.defaultColor=n})):t({defaultColor:n})}}),(0,l.jsx)(e3.Z,{children:"Default"})]})]})}let r6=()=>"#"+Math.floor(0x1000000*Math.random()).toString(16).padStart(6,"0"),r7=(0,d.memo)(function({containerId:e,chartRef:t,data:n,seriesMapping:r,enablePinning:i=!0,wrapLabels:o,format:a,onUnpinClick:s,pinnedPos:c}){let[u,h]=(0,d.useState)(!1),p=(0,d.useRef)(),g=n0(),{height:x,width:m,ref:f}=(0,n7.default)(),v=null!==c&&i;if(null===g||null===g.target||null===n||null===c&&"CANVAS"!==g.target.tagName)return null;let y=t.current,j=e?document.querySelector(e):void 0,C=j?j.getBoundingClientRect().height:void 0;p.current=rZ(g,c,x??0,m??0,j);let w=ry({mousePos:g,data:n,seriesMapping:r,pinnedPos:c,chart:y,format:a,showAllSeries:u});if(0===w.length)return null;let Z=n.length;return(0,l.jsx)(n6.Z,{container:j,children:(0,l.jsx)(b.Z,{ref:f,sx:e=>rS(e,c,C),style:{transform:p.current},children:(0,l.jsxs)($.Z,{spacing:.5,children:[(0,l.jsx)(rr,{nearbySeries:w,totalSeries:Z,enablePinning:i,isTooltipPinned:v,showAllSeries:u,onShowAllClick:e=>h(e),onUnpinClick:s}),(0,l.jsx)(n9,{series:w,wrapLabels:o})]})})})});(0,h.D)([nw.N,p.N,g.N,x.N,D.N,nZ.N,nS.N,nk.N,m.N,nT.N,f.N,v.N]);let r3=(0,d.forwardRef)(function({height:e,data:t,seriesMapping:n,timeScale:r,yAxis:i,format:o,grid:a,isStackedBar:s=!1,tooltipConfig:c=n1,noDataVariant:h="message",syncGroup:p,onDataZoom:g,onDoubleClick:x,__experimentalEChartsOptionsOverride:m},f){let v;let{chartsTheme:y,enablePinning:j,lastTooltipPinnedCoords:w,setLastTooltipPinnedCoords:Z}=C(),S=c.enablePinning&&j,T=(0,d.useRef)(),[M,I]=(0,d.useState)(!0),[A,D]=(0,d.useState)(null),[E,L]=(0,d.useState)(null),[R,F]=(0,d.useState)(!1),[z,B]=(0,d.useState)(0),{timeZone:$}=nN();if(void 0===r){let e=(0,u.getCommonTimeScale)(t);if(void 0===e){let e=new Date,t=new Date(e);t.setFullYear(e.getFullYear()-5);let n=e.getTime(),r=t.getTime();v={startMs:r,endMs:n,stepMs:1,rangeMs:n-r}}else v=e}else v=r;(0,d.useImperativeHandle)(f,()=>({highlightSeries({name:e}){T.current&&T.current.dispatchAction({type:"highlight",seriesId:e})},clearHighlightedSeries:()=>{T.current&&rd(T.current)}}),[]);let H=(0,d.useMemo)(()=>({datazoom:e=>{if(void 0===g&&setTimeout(()=>{D(null)},10),void 0===g||void 0===e.batch[0])return;let t=e.batch[0].startValue,n=e.batch[0].endValue;void 0!==t&&void 0!==n&&g({start:t,end:n})},finished:()=>{void 0!==T.current&&ra(T.current)}}),[g,D]),{noDataOption:W}=y,_=(0,d.useMemo)(()=>{if(null===t||0===t.length&&"message"===h)return W;let e=[],r="local"===$;t.map((t,n)=>{let i=t.values.map(([e,t])=>[r?e:(0,nM.toZonedTime)(e,$),null===t?"-":t]);e.push({id:n,source:[...i],dimensions:["time","value"]})});let l={dataset:e,series:j&&null!==E?[...n,E]:n,xAxis:{type:"time",min:r?v.startMs:(0,nM.toZonedTime)(v.startMs,$),max:r?v.endMs:(0,nM.toZonedTime)(v.endMs,$),axisLabel:{hideOverlap:!0,formatter:nL(v.rangeMs??0)},axisPointer:{snap:!1}},yAxis:O(i,o),animation:!1,tooltip:{show:!0,showContent:s,trigger:s?"item":"axis",appendToBody:s},axisPointer:{type:"line",z:0,triggerEmphasis:!1,triggerTooltip:!1,snap:!1},toolbox:{feature:{dataZoom:{icon:null,yAxisIndex:"none"}}},grid:a};return m?m(l):l},[t,n,v,i,o,a,W,m,h,$,s,j,E]);return(0,d.useEffect)(()=>{null===A||null===w||k()(w,A)||(D(null),null!==A&&null!==E&&L(null))},[w,n]),(0,l.jsxs)(b.Z,{style:{height:e},onClick:e=>{let n=e.ctrlKey||e.metaKey;n&&e.preventDefault();let r=rc(e.nativeEvent.offsetX,e.nativeEvent.offsetY,T.current);if(null!==r&&S&&e.target instanceof HTMLCanvasElement){let i={page:{x:e.pageX,y:e.pageY},client:{x:e.clientX,y:e.clientY},plotCanvas:{x:e.nativeEvent.offsetX,y:e.nativeEvent.offsetY},target:e.target};D(e=>null===e?i:(L(null),null)),L(e=>{if(null!==e)return null;{let e=r[0],n=rp(t[0]?.values,e);return N()({},ro,{markLine:{data:[{xAxis:n}]}})}}),n||Z(i)}},onMouseDown:e=>{let{clientX:t}=e;F(!0),B(t)},onMouseMove:e=>{if(!(e.target instanceof HTMLCanvasElement))return;let{clientX:t}=e;R&&t-z>0&&I(!1)},onMouseUp:()=>{F(!1),B(0),I(!0)},onMouseLeave:()=>{null===A&&I(!1),void 0!==T.current&&rd(T.current)},onMouseEnter:()=>{I(!0),void 0!==T.current&&ra(T.current)},onDoubleClick:e=>{D(null),void 0===x?void 0!==T.current&&rs(T.current):x(e)},children:[!0===M&&_.tooltip?.showContent===!1&&!0!==c.hidden&&(0,l.jsx)(r7,{containerId:y.tooltipPortalContainerId,chartRef:T,data:t,seriesMapping:n,wrapLabels:c.wrapLabels,enablePinning:S,pinnedPos:A,format:o,onUnpinClick:()=>{D(null),L(null)}}),(0,l.jsx)(P,{sx:{width:"100%",height:"100%"},option:_,theme:y.echartsTheme,onEvents:H,_instance:T,syncGroup:p})]})});var r4=n(59986),r8=n(53578),r9=n(52583),ie=n(94913),it=n(51727);let ir="yyyy-MM-dd HH:mm:ss";function ii(e,t){return e?(0,u.isRelativeTimeRange)(e)?e.pastDuration:function(e,t,n){let r=nD(e.start,t,n),i=nD(e.end,t,n);return`${r} - ${i}`}(e,ir,t):"Custom Time Range"}let il=({initialTimeRange:e,onChange:t,onCancel:n})=>{let{formatWithUserTimeZone:r}=nN(),[i,o]=(0,d.useState)(e),[s,c]=(0,d.useState)({start:r(e.start,ir),end:r(e.end,ir)}),[u,h]=(0,d.useState)(!0),p=(e,t)=>{let n="string"==typeof e,i=n?e:r(e,ir);c(e=>({...e,[t]:i})),n||o(n=>({...n,[t]:e}))},g=e=>{p(e,"start")},x=e=>{p(e,"end")},m=()=>{var e,t;let n={start:new Date(s.start),end:new Date(s.end)};if(e=n.start,t=n.end,(0,nI.isValid)(e)&&(0,nI.isValid)(t)?!!(0,nI.isBefore)(e,t)||(console.error("End Time is before Start Time"),!1):(console.error("Invalid Date"),!1))return o(n),n},f=()=>{let e=m();e&&t(e)};return(0,l.jsx)(r8._,{dateAdapter:it.H,children:(0,l.jsxs)($.Z,{spacing:2,sx:e=>({padding:e.spacing(1,0,2)}),children:[u&&(0,l.jsxs)(b.Z,{sx:e=>({".MuiPickersLayout-contentWrapper":{backgroundColor:e.palette.background.default}}),children:[(0,l.jsx)(e3.Z,{variant:"h3",padding:1,paddingLeft:2,children:"Select Start Time"}),(0,l.jsx)(r9.S,{displayStaticWrapperAs:"desktop",openTo:"day",disableHighlightToday:!0,value:e.start,onChange:e=>{null!==e&&g(e)},onAccept:()=>{h(!1)}})]}),!u&&(0,l.jsxs)(b.Z,{sx:e=>({".MuiPickersLayout-contentWrapper":{backgroundColor:e.palette.background.default}}),children:[(0,l.jsx)(e3.Z,{variant:"h3",padding:1,paddingLeft:2,children:"Select End Time"}),(0,l.jsx)(r9.S,{displayStaticWrapperAs:"desktop",openTo:"day",disableHighlightToday:!0,value:e.end,minDateTime:i.start,onChange:e=>{null!==e&&x(e)},onAccept:e=>{null!==e&&(h(!0),x(e))}})]}),(0,l.jsxs)($.Z,{direction:"row",alignItems:"center",gap:1,pl:1,pr:1,children:[(0,l.jsx)(nu.ErrorBoundary,{FallbackComponent:nc,children:(0,l.jsx)(ie.l,{label:"Start Time",value:new Date(s.start),onChange:e=>{e&&g(e)},onBlur:()=>m(),format:ir})}),(0,l.jsx)(nu.ErrorBoundary,{FallbackComponent:nc,children:(0,l.jsx)(ie.l,{label:"End Time",value:new Date(s.end),onChange:e=>{e&&x(e)},onBlur:()=>m(),format:ir})})]}),(0,l.jsxs)($.Z,{direction:"row",sx:{padding:e=>e.spacing(0,1)},gap:1,children:[(0,l.jsx)(a.Z,{variant:"contained",onClick:()=>f(),fullWidth:!0,children:"Apply"}),(0,l.jsx)(a.Z,{variant:"outlined",onClick:()=>n(),fullWidth:!0,children:"Cancel"})]})]})})};function io({value:e,timeOptions:t,onChange:n,height:r,showCustomTimeRange:i=!0}){let{timeZone:o}=nN(),a=(0,d.useRef)(),[s,c]=(0,d.useState)(!1),h=(0,d.useMemo)(()=>(0,u.isRelativeTimeRange)(e)?(0,u.toAbsoluteTimeRange)(e):e,[e]),p=(0,d.useMemo)(()=>{var t;return{value:t=(0,u.isRelativeTimeRange)(e)?void 0:e,display:ii(t,o)}},[e,o]),[g,x]=(0,d.useState)(!1);return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(K.ZP,{anchorEl:a.current,anchorOrigin:{vertical:"bottom",horizontal:"center"},open:s,onClose:()=>c(!1),sx:e=>({padding:e.spacing(2)}),children:(0,l.jsx)(il,{initialTimeRange:h,onChange:e=>{n(e),c(!1),x(!1)},onCancel:()=>c(!1)})}),(0,l.jsx)(b.Z,{ref:a,children:(0,l.jsxs)(ey.Z,{open:g,value:ii(e,o),onClick:()=>x(!g),IconComponent:r4.default,inputProps:{"aria-label":`Select time range. Currently set to ${e}`},sx:{".MuiSelect-icon":{marginTop:"1px",transform:"none"},".MuiSelect-select.MuiSelect-outlined.MuiInputBase-input":{paddingRight:"36px"},".MuiSelect-select":r?{lineHeight:r,paddingY:0}:{}},children:[t.map((e,t)=>(0,l.jsx)(eb.Z,{value:ii(e.value,o),onClick:()=>{n(e.value)},children:e.display},t)),i&&(0,l.jsx)(eb.Z,{value:ii(p.value,o),onClick:()=>c(!0),children:p.display})]})})]})}let ia=(0,X.ZP)(a.Z)(({theme:e})=>({padding:e.spacing(.5),minWidth:"auto"})),is=(0,d.forwardRef)(function(e,t){return(0,l.jsx)(ia,{ref:t,variant:"outlined",color:"secondary",...e})}),id=Object.entries(u.UNIT_CONFIG).map(([e,t])=>({id:e,...t})).filter(e=>!e.disableSelectorOption),ic=[{id:"default",label:"Default",decimalPlaces:void 0},{id:"0",label:"0",decimalPlaces:0},{id:"1",label:"1",decimalPlaces:1},{id:"2",label:"2",decimalPlaces:2},{id:"3",label:"3",decimalPlaces:3},{id:"4",label:"4",decimalPlaces:4}];function iu({value:e,onChange:t,disabled:n=!1}){var r;let i=(0,u.isUnitWithDecimalPlaces)(e),o=(0,u.isUnitWithShortValues)(e),a=({decimalPlaces:n})=>{i&&t({...e,decimalPlaces:n})},s=u.UNIT_CONFIG[e.unit];return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tq,{label:"Short values",control:(0,l.jsx)(re.Z,{checked:!!o&&(0,u.shouldShortenValues)(e.shortValues),onChange:(n,r)=>{o&&t({...e,shortValues:r})},disabled:!o})}),(0,l.jsx)(tq,{label:"Unit",control:(0,l.jsx)(t0,{value:{id:e.unit,...s},options:id,groupBy:e=>e.group,onChange:(e,n)=>{t({unit:n.id})},disableClearable:!0,disabled:n})}),(0,l.jsx)(tq,{label:"Decimals",control:(0,l.jsx)(t0,{value:(r=e.decimalPlaces,ic.find(e=>e.decimalPlaces===r)),options:ic,getOptionLabel:e=>e.label,onChange:(e,t)=>a(t),disabled:!i,disableClearable:!0})})]})}function ih({name:e,height:t}){return(0,l.jsx)(b.Z,{style:{maxWidth:t,top:`calc(${t}px / 2)`},sx:{display:"inline-block",position:"absolute",transform:"translateX(-50%) rotate(-90deg)",transformOrigin:"top",textAlign:"center",zIndex:1},children:(0,l.jsx)(e3.Z,{variant:"body1","aria-label":"y axis label",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e})})}var ip=n(78439);function ig(){let{enqueueSnackbar:e,closeSnackbar:t}=(0,ip.Ds)(),n=ix(e,"error"),r=ix(e,"info"),i=ix(e,"warning"),l=ix(e,"success"),o=(0,d.useCallback)((e,t)=>n(e instanceof Error?e.message:`An unexpected error occurred: ${e}`,t),[n]);return{enqueueSnackbar:e,closeSnackbar:t,errorSnackbar:n,infoSnackbar:r,warningSnackbar:i,successSnackbar:l,exceptionSnackbar:o}}function ix(e,t){return(0,d.useCallback)((n,r)=>e(n,{...r,variant:t}),[e,t])}function im(e,t){let n=e.palette.text?.primary??"#222",r={title:{show:!1},textStyle:{color:n,fontFamily:e.typography.fontFamily,fontSize:12},grid:{top:5,right:20,bottom:0,left:20,containLabel:!0},color:["#56B4E9","#009E73","#0072B2","#CC79A7","#F0E442","#E69F00","#D55E00"],categoryAxis:{show:!0,axisLabel:{show:!0,color:n,margin:15},axisTick:{show:!1,length:6,lineStyle:{color:e.palette.grey[600]}},axisLine:{show:!0,lineStyle:{color:e.palette.grey[600]}},splitLine:{show:!0,lineStyle:{width:.5,color:e.palette.grey[300],opacity:.4}},splitArea:{show:!1,areaStyle:{color:[e.palette.grey[300]]}}},timeAxis:{show:!0,axisLabel:{show:!0,color:n,margin:15},axisTick:{show:!1,length:6,lineStyle:{color:e.palette.grey[600]}},axisLine:{show:!0,lineStyle:{color:e.palette.grey[600]}},splitLine:{show:!0,lineStyle:{width:.5,color:e.palette.grey[300],opacity:.4}},splitArea:{show:!1,areaStyle:{color:[e.palette.grey[300]]}}},valueAxis:{show:!0,axisLabel:{color:n,margin:12},axisLine:{show:!1},splitLine:{show:!0,lineStyle:{width:.5,color:e.palette.grey[300],opacity:.6}}},legend:{orient:"horizontal",textStyle:{color:n},pageTextStyle:{color:e.palette.grey[600]},pageIconColor:e?.palette?.action?.active,pageIconInactiveColor:e?.palette?.action?.disabled},toolbox:{show:!0,top:10,right:10,iconStyle:{borderColor:n}},tooltip:{backgroundColor:e.palette.designSystem?.grey[800],borderColor:e.palette.designSystem?.grey[800],textStyle:{color:"#fff",fontSize:11}},axisPointer:{lineStyle:{color:e.palette.grey[500]}},markLine:{symbol:"none",symbolSize:0,itemStyle:{color:e.palette.grey[500]},lineStyle:{type:"dashed",width:1}},line:{showSymbol:!1,symbol:"circle",symbolSize:4,smooth:!1,lineStyle:{width:1},emphasis:{lineStyle:{width:1.5}}},bar:{barMaxWidth:150,itemStyle:{borderWidth:0,borderRadius:0,borderColor:e.palette.grey[300]},label:{show:!1,color:n}},gauge:{detail:{fontSize:18,fontWeight:600,valueAnimation:!1},splitLine:{distance:0,length:4,lineStyle:{width:1}},splitNumber:12}};return N()({echartsTheme:r,noDataOption:{title:{show:!0,textStyle:{color:n,fontSize:16,fontWeight:400},text:"No data",left:"center",top:"center"},xAxis:{show:!1},yAxis:{show:!1}},sparkline:{width:2,color:"#1976d2"},container:{padding:{default:parseInt(e.spacing(1.5),10)}},thresholds:{defaultColor:e.palette.success.main,palette:["#FFCC00",e.palette.warning.main,e.palette.error.main]}},t)}function iv(e){return{value:{pastDuration:e},display:`Last ${(0,nI.formatDuration)((0,u.parseDurationString)(e),{delimiter:", "})}`}}var ib=n(28730);let iy=im((0,ib.Z)({}),{echartsTheme:{textStyle:{fontFamily:"Lato"},categoryAxis:{splitLine:{show:!1}},timeAxis:{splitLine:{show:!1}},bar:{barCategoryGap:2}}}),ij={chartsTheme:iy,enablePinning:!1,lastTooltipPinnedCoords:null,setLastTooltipPinnedCoords:()=>null};var iC=n(79602);let iw={defaultProps:{variant:"standard",severity:"success"},styleOverrides:{standardError:({theme:e})=>"dark"===e.palette.mode?{...e.typography.body1,backgroundColor:e.palette.error.dark,color:e.palette.error.light,[`& .${iC.Z.icon}`]:{color:e.palette.error.main}}:{...e.typography.body1,backgroundColor:e.palette.error.light,color:e.palette.error.dark,[`& .${iC.Z.icon}`]:{color:e.palette.error.main}},standardInfo:({theme:e})=>"dark"===e.palette.mode?{...e.typography.body1,backgroundColor:e.palette.info.dark,color:e.palette.info.light,[`& .${iC.Z.icon}`]:{color:e.palette.info.main}}:{...e.typography.body1,backgroundColor:e.palette.info.light,color:e.palette.info.dark,[`& .${iC.Z.icon}`]:{color:e.palette.info.main}},standardSuccess:({theme:e})=>"dark"===e.palette.mode?{...e.typography.body1,backgroundColor:e.palette.success.dark,color:e.palette.success.light,[`& .${iC.Z.icon}`]:{color:e.palette.success.main}}:{...e.typography.body1,backgroundColor:e.palette.success.light,color:e.palette.success.dark,[`& .${iC.Z.icon}`]:{color:e.palette.success.main}},standardWarning:({theme:e})=>"dark"===e.palette.mode?{...e.typography.body1,backgroundColor:e.palette.warning.dark,color:e.palette.warning.light,[`& .${iC.Z.icon}`]:{color:e.palette.warning.main}}:{...e.typography.body1,backgroundColor:e.palette.warning.light,color:e.palette.warning.dark,[`& .${iC.Z.icon}`]:{color:e.palette.warning.main}},root:{["& ."+n(757).Z.root]:{textDecoration:"underline"}}}},iZ={50:"#F0F1F6",100:"#E1E3ED",150:"#D2D5E4",200:"#C3C7DB",300:"#A4ACC8",400:"#8690B6",500:"#717CA4",600:"#535D83",700:"#3E4662",800:"#2A2E42",850:"#1F2331",900:"#151721",950:"#0A0C10"},iS={50:"#E7F1FC",100:"#D0E3FA",150:"#B8D5F7",200:"#A1C7F5",300:"#72ABF0",400:"#438FEB",500:"#1473E6",600:"#105CB8",700:"#0C458A",800:"#082E5C",850:"#062345",900:"#04172E",950:"#020C17"},ik="#FFFFFF",iT=e=>{let t=iZ["800"],n=iZ["300"];return"light"===e?{navigation:t,accent:n,primary:iZ["800"],secondary:iZ["700"],disabled:iZ["300"],link:iS["500"],linkHover:iS["600"]}:{navigation:t,accent:n,primary:ik,secondary:iZ["50"],disabled:iZ["600"],link:iS["400"],linkHover:iS["500"]}},iM=e=>{let t=iS["150"],n="rgba(21, 23, 33, 0.75)";return"light"===e?{navigation:t,overlay:n,default:ik,paper:iZ["50"],code:iZ["50"],tooltip:iZ["100"],lighter:iZ["50"],border:iZ["100"]}:{navigation:t,overlay:n,default:iZ["900"],paper:iZ["850"],code:iZ["800"],tooltip:iZ["600"],lighter:iZ["700"],border:iZ["600"]}},iI=e=>"light"===e?{50:iZ["50"],100:iZ["100"],200:iZ["200"],300:iZ["300"],400:iZ["400"],500:iZ["500"],600:iZ["600"],700:iZ["700"],800:iZ["800"],900:iZ["900"],950:iZ["950"]}:{50:iZ["950"],100:iZ["900"],200:iZ["800"],300:iZ["700"],400:iZ["600"],500:iZ["500"],600:iZ["400"],700:iZ["300"],800:iZ["200"],900:iZ["100"],950:iZ["50"]},iA=e=>"light"===e?{main:iS["500"],dark:iS["600"],light:iS["50"]}:{main:iS["400"],dark:iS["800"],light:iS["200"]},iD=e=>"light"===e?{main:iZ["600"],dark:iZ["900"],light:iZ["100"]}:{main:ik,dark:ik,light:ik},iE={50:"#EAF9F1",100:"#D5F2E3",150:"#C1ECD4",200:"#ACE5C6",300:"#82D9AA",400:"#59CC8D",500:"#2FBF71",600:"#26995A",700:"#1C7344",800:"#134C2D",850:"#0E3922",900:"#092617",950:"#05130B"},iL={50:"#FFF5E8",100:"#FFECD2",150:"#FFE2BB",200:"#FFD9A4",300:"#FFC577",400:"#FFB249",500:"#FF9F1C",600:"#CC7F16",700:"#995F11",800:"#66400B",850:"#4D3008",900:"#332006",950:"#1A1003"},iR={50:"#EFE9FD",100:"#E0D2FC",150:"#D0BCFA",200:"#C1A6F8",300:"#A179F5",400:"#824DF1",500:"#6320EE",600:"#4F1ABE",700:"#3B138F",800:"#280D5F",850:"#1E0A47",900:"#140630",950:"#0A0318"},iP={50:"#FDEDED",100:"#FBDADA",150:"#F9C8C8",200:"#F7B5B5",300:"#F29191",400:"#EE6C6C",500:"#EA4747",600:"#BD3939",700:"#902B2B",800:"#621D1D",850:"#4C1616",900:"#350F0F",950:"#1F0808"},iF=e=>"light"===e?{main:iP["500"],dark:iP["600"],light:iP["50"]}:{main:iP["400"],dark:iP["800"],light:iP["300"]},iN=e=>"light"===e?{main:iE["500"],dark:iE["700"],light:iE["50"]}:{main:iE["400"],dark:iE["800"],light:iE["300"]},iO=e=>"light"===e?{main:iL["500"],dark:iL["700"],light:iL["50"]}:{main:iL["400"],dark:iL["800"],light:iL["300"]};n(12711),n(89479),n(99511),n(53213);let iz={fontFamily:'"Lato", sans-serif',fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:700,fontWeightBold:900,h1:{fontSize:"1.5rem",fontWeight:700,lineHeight:"32px"},h2:{fontSize:"1.25rem",fontWeight:700,lineHeight:"28px"},h3:{fontSize:"1rem",fontWeight:700,lineHeight:"24px"},h4:{fontSize:"0.875rem",fontWeight:700,lineHeight:"22px"},h5:void 0,h6:void 0,body1:{fontSize:"0.875rem",fontWeight:400,lineHeight:"20px"},body2:{fontSize:"0.75rem",fontWeight:400,lineHeight:"18px"},subtitle1:{fontSize:"1rem",fontWeight:400,lineHeight:"24px",letterSpacing:"0.02rem"},subtitle2:{fontSize:"0.875rem",fontWeight:700,lineHeight:"22px",letterSpacing:"0.03rem",textTransform:"uppercase"},button:{fontSize:"0.875rem",fontWeight:700,lineHeight:"1.25rem",textTransform:"none",letterSpacing:"0.03rem"},caption:{fontSize:"0.6875rem",fontWeight:400,lineHeight:"16px"}},iB=({theme:e})=>({..."light"===e.palette.mode?{}:{backgroundImage:"unset",backgroundColor:e.palette.designSystem.grey[800]}});function i$(e,t={}){return(0,ib.Z)({palette:{mode:e,primary:iA(e),secondary:iD(e),grey:iI(e),background:iM(e),text:iT(e),error:iF(e),warning:iO(e),info:iA(e),success:iN(e),common:{white:ik,black:"#000000"},designSystem:{blue:iS,green:iE,grey:iZ,orange:iL,purple:iR,red:iP}},typography:iz,mixins:{},components:iH,...t})}let iH={MuiAlert:iw,MuiFormControl:{defaultProps:{size:"small"}},MuiPaper:{styleOverrides:{root:({theme:e})=>({backgroundColor:e.palette.background.default})}},MuiTextField:{defaultProps:{size:"small"}},MuiDrawer:{styleOverrides:{paper:iB}},MuiDialog:{styleOverrides:{paper:iB}},MuiPopover:{styleOverrides:{paper:iB}}};var iW=n(84974),i_=n(12449),iV=n(28418),iU=n(57689);function iY({value:e,onChange:t}){return(0,l.jsxs)($.Z,{direction:"row",children:[(0,l.jsx)(tJ.Z,{freeSolo:!0,multiple:!0,id:"join-columns",sx:{width:"100%"},options:[],value:e.spec.columns??[],renderInput:e=>(0,l.jsx)(W.Z,{...e,variant:"outlined",label:"Columns",required:!0}),onChange:(n,r)=>{t({...e,spec:{...e.spec,columns:r}})}}),(0,l.jsx)(rM.Z,{label:"Enabled",labelPlacement:"start",control:(0,l.jsx)(re.Z,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})]})}function iG({value:e,onChange:t}){return(0,l.jsxs)($.Z,{direction:"row",gap:1,alignItems:"center",children:[(0,l.jsx)(tJ.Z,{freeSolo:!0,multiple:!0,id:"merge-columns-columns",sx:{width:"100%"},options:[],value:e.spec.columns??[],renderInput:e=>(0,l.jsx)(W.Z,{...e,variant:"outlined",label:"Columns",required:!0}),onChange:(n,r)=>{t({...e,spec:{...e.spec,columns:r}})}}),(0,l.jsx)(tE,{id:"merge-columns-name",variant:"outlined",label:"Output Name",value:e.spec.name??"",sx:{width:"100%"},onChange:n=>{t({...e,spec:{...e.spec,name:n}})},required:!0}),(0,l.jsx)(rM.Z,{label:"Enabled",labelPlacement:"start",control:(0,l.jsx)(re.Z,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})]})}function iK({value:e,onChange:t}){return(0,l.jsxs)($.Z,{direction:"row",children:[(0,l.jsx)(tE,{id:"merge-indexed-columns",variant:"outlined",label:"Column",placeholder:"Example: 'value' for merging 'value #1', 'value #2' and 'value #...'",value:e.spec.column??"",sx:{width:"100%"},onChange:n=>{t({...e,spec:{...e.spec,column:n}})},required:!0}),(0,l.jsx)(rM.Z,{label:"Enabled",labelPlacement:"start",control:(0,l.jsx)(re.Z,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})]})}function iX({value:e,onChange:t}){return(0,l.jsx)($.Z,{direction:"row",children:(0,l.jsx)(rM.Z,{label:"Enabled",labelPlacement:"start",control:(0,l.jsx)(re.Z,{value:!e.spec.disabled,checked:!e.spec.disabled,onChange:n=>t({...e,spec:{...e.spec,disabled:!n.target.checked}})})})})}function iq({value:e,onChange:t,...n}){return(0,l.jsxs)($.Z,{gap:2,sx:{width:"100%"},mt:1,...n,children:[(0,l.jsxs)(tE,{select:!0,label:"Kind",value:e.kind,onChange:n=>t({...e,kind:n}),children:[(0,l.jsx)(eb.Z,{value:"JoinByColumnValue",children:(0,l.jsxs)($.Z,{children:[(0,l.jsx)(e3.Z,{children:"Join by column value"}),(0,l.jsx)(e3.Z,{variant:"caption",children:"Regroup rows with equal cell value in a column"})]})}),(0,l.jsx)(eb.Z,{value:"MergeColumns",children:(0,l.jsxs)($.Z,{children:[(0,l.jsx)(e3.Z,{children:"Merge columns"}),(0,l.jsx)(e3.Z,{variant:"caption",children:"Multiple columns are merged to one column"})]})}),(0,l.jsx)(eb.Z,{value:"MergeIndexedColumns",children:(0,l.jsxs)($.Z,{children:[(0,l.jsx)(e3.Z,{children:"Merge indexed columns"}),(0,l.jsx)(e3.Z,{variant:"caption",children:"Indexed columns are merged to one column"})]})}),(0,l.jsx)(eb.Z,{value:"MergeSeries",children:(0,l.jsxs)($.Z,{children:[(0,l.jsx)(e3.Z,{children:"Merge series"}),(0,l.jsx)(e3.Z,{variant:"caption",children:"Series will be merged by their labels"})]})})]}),"JoinByColumnValue"===e.kind&&(0,l.jsx)(iY,{value:e,onChange:t}),"MergeColumns"===e.kind&&(0,l.jsx)(iG,{value:e,onChange:t}),"MergeIndexedColumns"===e.kind&&(0,l.jsx)(iK,{value:e,onChange:t}),"MergeSeries"===e.kind&&(0,l.jsx)(iX,{value:e,onChange:t})]})}function iJ({index:e,value:t,isCollapsed:n,onChange:r,onCollapse:i,onDelete:o,...a}){return(0,l.jsxs)($.Z,{...a,children:[(0,l.jsxs)($.Z,{direction:"row",alignItems:"center",borderBottom:1,borderColor:e=>e.palette.divider,justifyContent:"space-between",gap:4,children:[(0,l.jsxs)($.Z,{direction:"row",gap:1,children:[(0,l.jsx)(H.Z,{"data-testid":`transform-toggle#${e}`,size:"small",onClick:()=>i(!n),children:n?(0,l.jsx)(iW.default,{}):(0,l.jsx)(i_.default,{})}),(0,l.jsx)(e3.Z,{variant:"overline",component:"h4",sx:{textTransform:"none"},children:t.kind?(0,l.jsx)("span",{children:(0,l.jsx)("strong",{children:u.TRANSFORM_TEXT[t.kind]})}):(0,l.jsx)("strong",{children:"Select a transformation kind"})})]}),(0,l.jsxs)($.Z,{direction:"row",gap:1,children:[n&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(tU.Z,{title:t.spec?.disabled?"Enable transformation":"Disable transformation",placement:"top",children:(0,l.jsx)(H.Z,{size:"small",sx:{marginLeft:"auto"},onClick:function(){r({...t,spec:{...t.spec,disabled:!t.spec?.disabled}})},children:t.spec?.disabled?(0,l.jsx)(iV.default,{}):(0,l.jsx)(iU.default,{})})}),(0,l.jsx)(ng.Z,{flexItem:!0,orientation:"vertical",variant:"middle"})]}),(0,l.jsx)(tU.Z,{title:"Remove transformation",placement:"top",children:(0,l.jsx)(H.Z,{size:"small",sx:{marginLeft:"auto"},onClick:o,children:(0,l.jsx)(r1.default,{})})})]})]}),!n&&(0,l.jsx)(iq,{value:t,onChange:r})]})}function iQ({value:e,onChange:t,...n}){let[r,i]=(0,d.useState)(e.map(()=>!0));return(0,l.jsxs)($.Z,{gap:1,...n,children:[e.map((n,o)=>(0,l.jsx)(iJ,{index:o,value:n,isCollapsed:r[o]??!0,onChange:n=>(function(n,r){let i=[...e];i[n]=r,t(i)})(o,n),onDelete:()=>(function(n){let r=[...e];r.splice(n,1),t(r),i(e=>(e.splice(n,1),[...e]))})(o),onCollapse:e=>{i(t=>(t[o]=e,[...t]))}},o)),(0,l.jsx)(a.Z,{variant:"contained",startIcon:(0,l.jsx)(rA.default,{}),sx:{marginTop:1},onClick:function(){let n=[...e];n.push({kind:"",spec:{}}),t(n),i(e=>(e.push(!1),[...e]))},children:"Add Transformation"})]})}function i0(e){let{value:t,onChange:n,timeOptions:r,height:i}=e,o=(0,d.useMemo)(()=>{if(t&&!r.some(e=>e.value.pastDuration===t))return(0,l.jsx)(eb.Z,{value:t,children:t})},[r,t]);return(0,l.jsx)(tH.Z,{children:(0,l.jsx)(b.Z,{children:(0,l.jsxs)(ey.Z,{id:"refreshInterval",value:t,onChange:e=>{n(e.target.value)},inputProps:{"aria-label":`Select refresh interval. Currently set to ${t}`},sx:{".MuiSelect-select":i?{lineHeight:i,paddingY:0}:{}},children:[r.map((e,t)=>(0,l.jsx)(eb.Z,{value:e.value.pastDuration,children:e.display},t)),o]})})})}var i1=n(85731);function i5(e){let{width:t,height:n,data:r}=e,i=w(),o={title:{text:"Referer of a Website",subtext:"Fake Data",left:"center"},tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c} ({d}%)"},axisLabel:{overflow:"truncate",width:t/3},series:[{name:"Access From",type:"pie",radius:"55%",label:!1,center:["40%","50%"],data:r,emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}],itemStyle:{borderRadius:2,color:i.echartsTheme[0]}};return(0,l.jsx)(b.Z,{style:{width:t,height:n},sx:{overflow:"auto"},children:(0,l.jsx)(P,{sx:{minHeight:n,height:r?16*r.length:"100%"},option:o,theme:i.echartsTheme})})}(0,h.D)([i1.N,g.N,x.N,m.N,f.N,v.N]);var i2=n(27835),i6=n(943),i7=n(72116);(0,h.D)([i2.N,i6.N,g.N,x.N,m.N,f.N,v.N]);let i3=e=>{var t;let{height:n,data:r,xAxisCategories:i,yAxisCategories:o,timeScale:a,colors:s}=e,{timeZone:d}=nN(),c=w(),u=(0,Q.Z)(),h={tooltip:{appendToBody:!0,formatter:e=>(function({data:e,label:t,marker:n,xAxisCategories:r,yAxisCategories:i,theme:l}){let[o,a]=e,{formattedDate:s,formattedTime:d}=nR(r[o]),c=(0,i7.css)`
2
- border-bottom: 1px solid ${l.palette.grey[500]};
3
- padding-bottom: 8px;
4
- `,u=(0,i7.css)`
5
- display: flex;
6
- justify-content: space-between;
7
- padding-top: 8px;
8
- `,h=(0,i7.css)`
9
- margin-right: 16px;
10
- `;return`
11
- <div>
12
- <div style="${c.styles}">${s} ${d}</div>
13
- <div style="${u.styles}">
14
- <div style="${h.styles}">
15
- ${n}
16
- <strong>${i[a]}</strong>
17
- </div>
18
- <div>
19
- ${t}
20
- </div>
21
- </div>
22
- </div>
23
- `})({data:e.data.value,label:e.data.label,marker:e.marker,xAxisCategories:i,yAxisCategories:o,theme:u})},grid:{top:"5%",bottom:"5%"},xAxis:{type:"category",data:i,axisLine:{show:!1},splitArea:{show:!1},axisLabel:{hideOverlap:!0,formatter:(t=a?.rangeMs??0,function(e){let n=new Date(Number(e));return t>15768e7?nD(n,"yyy",d):t>63072e6?nD(n,"MMM yyy",d):t>864e6&&t<1577664e4?nD(n,"dd.MM",d):t>1728e5&&t<=864e6?nD(n,"dd.MM HH:mm",d):nD(n,"HH:mm",d)})}},yAxis:{type:"category",data:o,axisLine:{show:!1},splitArea:{show:!1,interval:0},splitLine:{show:!1},axisLabel:{interval:0}},visualMap:{show:!1,type:"piecewise",pieces:s},series:[{name:"Status history",type:"heatmap",coordinateSystem:"cartesian2d",data:r,label:{show:!1},itemStyle:{borderWidth:1,borderType:"solid",borderColor:"#ffffff"},emphasis:{itemStyle:{opacity:.5}}}]};return(0,l.jsx)(b.Z,{style:{height:n},sx:{overflow:"auto"},children:(0,l.jsx)(P,{sx:{width:"100%",height:n},option:h,theme:c.echartsTheme})})},i4="#1f77b4";function i8(e,t){t.match(/^#[0-9A-Fa-f]{6}$/)||(t=i4);try{let[n,r,i]=le(t);if(isNaN(n)||isNaN(r)||isNaN(i))throw Error("Invalid HSL values");let l=String(e).split("").reduce((e,t)=>e+t.charCodeAt(0),0),o=Math.min(r+10,90),a=lt(Math.abs((n+l%6*60)%360),Math.min(Math.max(o,50),90),Math.min(Math.max(i+(l%2?15:-15),30),70));if(!a.match(/^#[0-9A-Fa-f]{6}$/))throw Error("Invalid generated color");return a}catch(e){return i4}}function i9(e,t){return t.length>=e.length?t.slice(0,e.length):e.map((e,n)=>n<t.length?t[n]||i4:i8(e,t[0]||i4))}function le(e){let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),l=Math.min(t,n,r),o=0,a=0,s=(i+l)/2;if(i!==l){let e=i-l;switch(a=s>.5?e/(2-i-l):e/(i+l),i){case t:o=(n-r)/e+6*(n<r);break;case n:o=(r-t)/e+2;break;case r:o=(t-n)/e+4}o/=6}return[360*o,100*a,100*s]}function lt(e,t,n){let r=t*Math.min(n/=100,1-n)/100,i=t=>{let i=(t+e/30)%12;return Math.round(255*(n-r*Math.max(Math.min(i-3,9-i,1),-1))).toString(16).padStart(2,"0")};return`#${i(0)}${i(8)}${i(4)}`}var ln=n(41305);let lr=({mapping:e,onChange:t,...n})=>{switch(e.kind){case"Value":return(0,l.jsx)($.Z,{gap:1,direction:"row",...n,children:(0,l.jsx)(W.Z,{label:"Value",placeholder:"Exact value",value:e.spec?.value??"",onChange:n=>t({...e,spec:{...e.spec,value:n.target.value}}),fullWidth:!0})});case"Range":return(0,l.jsxs)($.Z,{gap:1,direction:"row",...n,children:[(0,l.jsx)(W.Z,{label:"From",placeholder:"Start of range",value:e.spec?.from??"",onChange:n=>t({...e,spec:{...e.spec,from:""===n.target.value?void 0:+n.target.value}}),fullWidth:!0}),(0,l.jsx)(W.Z,{label:"To",placeholder:"End of range (inclusive)",value:e.spec?.to??"",onChange:n=>t({...e,spec:{...e.spec,to:""===n.target.value?void 0:+n.target.value}}),fullWidth:!0})]});case"Regex":return(0,l.jsx)($.Z,{gap:1,direction:"row",...n,children:(0,l.jsx)(W.Z,{label:"Regular Expression",placeholder:"JavaScript regular expression",value:e.spec?.pattern??"",onChange:n=>t({...e,spec:{...e.spec,pattern:n.target.value}}),fullWidth:!0})});case"Misc":return(0,l.jsx)($.Z,{gap:1,direction:"row",...n,children:(0,l.jsxs)(W.Z,{select:!0,label:"Value",value:e.spec?.value??"",onChange:n=>t({...e,spec:{value:n.target.value}}),SelectProps:{renderValue:e=>{switch(e){case"empty":return"Empty";case"null":return"Null";case"NaN":return"NaN";case"true":return"True";case"false":return"False";default:return String(e)}}},fullWidth:!0,children:[(0,l.jsx)(eb.Z,{value:"empty",children:(0,l.jsxs)($.Z,{children:[(0,l.jsx)(e3.Z,{children:"Empty"}),(0,l.jsx)(e3.Z,{variant:"caption",children:"Matches empty string"})]})}),(0,l.jsx)(eb.Z,{value:"null",children:(0,l.jsxs)($.Z,{children:[(0,l.jsx)(e3.Z,{children:"Null"}),(0,l.jsx)(e3.Z,{variant:"caption",children:"Matches null or undefined"})]})}),(0,l.jsx)(eb.Z,{value:"NaN",children:(0,l.jsxs)($.Z,{children:[(0,l.jsx)(e3.Z,{children:"NaN"}),(0,l.jsx)(e3.Z,{variant:"caption",children:"Matches Not a Number value"})]})}),(0,l.jsx)(eb.Z,{value:"true",children:(0,l.jsxs)($.Z,{children:[(0,l.jsx)(e3.Z,{children:"True"}),(0,l.jsx)(e3.Z,{variant:"caption",children:"Matches true boolean"})]})}),(0,l.jsx)(eb.Z,{value:"false",children:(0,l.jsxs)($.Z,{children:[(0,l.jsx)(e3.Z,{children:"False"}),(0,l.jsx)(e3.Z,{variant:"caption",children:"Matches false boolean"})]})})]})});default:return null}},li=({mapping:e,onChange:t,onDelete:n,...r})=>{let i=n=>{t({...e,spec:{...e.spec,result:{...e.spec.result,color:n}}})};return(0,l.jsxs)(ln.Z,{container:!0,spacing:2,...r,children:[(0,l.jsx)(ln.Z,{size:{xs:5},children:(0,l.jsxs)($.Z,{direction:"row",gap:1,width:"100%",children:[(0,l.jsxs)(W.Z,{select:!0,label:"Type",value:e.kind,onChange:n=>t({...e,kind:n.target.value}),required:!0,sx:{width:"120px"},children:[(0,l.jsx)(eb.Z,{value:"Value",children:(0,l.jsxs)($.Z,{children:[(0,l.jsx)(e3.Z,{children:"Value"}),"Value"!==e.kind&&(0,l.jsx)(e3.Z,{variant:"caption",children:"Matches an exact text value"})]})}),(0,l.jsx)(eb.Z,{value:"Range",children:(0,l.jsxs)($.Z,{children:[(0,l.jsx)(e3.Z,{children:"Range"}),"Range"!==e.kind&&(0,l.jsx)(e3.Z,{variant:"caption",children:"Matches against a numerical range"})]})}),(0,l.jsx)(eb.Z,{value:"Regex",children:(0,l.jsxs)($.Z,{children:[(0,l.jsx)(e3.Z,{children:"Regex"}),"Regex"!==e.kind&&(0,l.jsx)(e3.Z,{variant:"caption",children:"Matches against a regular expression"})]})}),(0,l.jsx)(eb.Z,{value:"Misc",children:(0,l.jsxs)($.Z,{children:[(0,l.jsx)(e3.Z,{children:"Misc"}),"Misc"!==e.kind&&(0,l.jsx)(e3.Z,{variant:"caption",children:"Matches against empty, null and NaN values"})]})})]}),(0,l.jsx)(lr,{width:"100%",mapping:e,onChange:n=>t({...e,...n})})]})}),(0,l.jsx)(ln.Z,{size:{xs:4},children:(0,l.jsx)(W.Z,{label:"Display text",value:e.spec?.result?.value??"",onChange:n=>t({...e,spec:{...e.spec,result:{...e.spec?.result,value:n.target.value}}}),fullWidth:!0})}),(0,l.jsx)(ln.Z,{size:{xs:1},children:(0,l.jsx)($.Z,{direction:"row",justifyContent:"center",gap:1,children:e.spec?.result?.color?(0,l.jsx)(q,{label:"Color",color:e.spec.result.color??"#000",onColorChange:i,onClear:()=>i(void 0)}):(0,l.jsx)(H.Z,{onClick:()=>i("#000"),children:(0,l.jsx)(rA.default,{})})})}),(0,l.jsx)(ln.Z,{size:{xs:1},textAlign:"end",children:(0,l.jsx)(tU.Z,{title:"Remove mapping settings",placement:"top",children:(0,l.jsx)(H.Z,{size:"small",sx:{marginLeft:"auto"},onClick:n,children:(0,l.jsx)(r1.default,{})})})})]})},ll=({mappings:e,onChange:t})=>{let[n,r]=(0,d.useState)(e);return(0,l.jsxs)($.Z,{spacing:1,children:[(0,l.jsxs)(ln.Z,{container:!0,spacing:2,children:[(0,l.jsx)(ln.Z,{size:{xs:5},children:(0,l.jsx)(e3.Z,{variant:"subtitle1",children:"Condition"})}),(0,l.jsx)(ln.Z,{size:{xs:4},children:(0,l.jsx)(e3.Z,{variant:"subtitle1",children:"Display Text"})}),(0,l.jsx)(ln.Z,{size:{xs:1},textAlign:"center",children:(0,l.jsx)(e3.Z,{variant:"subtitle1",children:"Color"})}),(0,l.jsx)(ln.Z,{size:{xs:1}})]}),(0,l.jsx)($.Z,{gap:1.5,divider:(0,l.jsx)(ng.Z,{flexItem:!0,orientation:"horizontal"}),children:n.map((e,i)=>(0,l.jsx)(li,{mapping:e,onChange:e=>(function(e,i){let l=[...n];l[e]=i,r(l),t(l)})(i,e),onDelete:()=>(function(e){let i=[...n];i.splice(e,1),r(i),t(i)})(i)},i))}),(0,l.jsx)(a.Z,{variant:"contained",startIcon:(0,l.jsx)(rA.default,{}),sx:{marginTop:1},onClick:function(){let e=[...n];e.push({kind:"Value",spec:{result:{value:""}}}),r(e),t(e)},children:"Add value mappings"})]})}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkTable=self.webpackChunkTable||[]).push([["2641"],{56050:function(){}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkTable=self.webpackChunkTable||[]).push([["3001"],{51074:function(e,r,n){n.r(r),n.d(r,{LEGEND_SIZE_CONFIG:()=>eh,useBuiltinVariableContext:()=>e4,PluginSpecEditor:()=>M,encodeTimeRangeValue:()=>rE,PanelSpecEditor:()=>eD,useListPluginMetadata:()=>O,useQueryType:()=>rJ,ProjectStoreProvider:()=>rj,VariableEditorForm:()=>rx,MultiQueryEditor:()=>eT,useInitialRefreshInterval:()=>rV,useReplaceVariablesInString:()=>rr,LEGEND_VALUE_CONFIG:()=>eg,useTimeRangeContext:()=>eN,DataQueriesContext:()=>rY,VariableListPreview:()=>rp,TimeRangeSettingsContext:()=>eW,PluginKindSelect:()=>L,filterVariableList:()=>rn,DEFAULT_REFRESH_INTERVAL_OPTIONS:()=>eJ,OptionsEditorTabs:()=>eI,replaceVariables:()=>eX,DatasourceSelect:()=>Y,useActiveTimeSeriesQueries:()=>rN,useSuggestedStepMs:()=>eF,useTimeRange:()=>e$,useTimeSeriesQuery:()=>rM,getVariableValuesKey:()=>ri,useListVariablePluginValues:()=>rt,DataQueriesProvider:()=>r1,validateLegendSpec:()=>em,usePluginBuiltinVariableDefinitions:()=>V,PluginRegistry:()=>eR,TimeRangeProvider:()=>e_,BuiltinVariableContext:()=>e5,getActiveTimeSeriesQueries:()=>r$,useListDatasourceSelectItems:()=>G,usePluginEditor:()=>q,useUsageMetrics:()=>rK,useValidationSchemas:()=>j,PluginRegistryContext:()=>T,useShowCustomTimeRangeSetting:()=>ez,UsageMetricsProvider:()=>rG,CalculationSelector:()=>l,TimeRangeControls:()=>eY,useSetRefreshIntervalParams:()=>rL,useTraceQueries:()=>rU,QueryCountProvider:()=>eV,usePlugin:()=>w,legendValues:()=>ed,decodeTimeRangeValue:()=>rk,usePluginRegistry:()=>Z,timeRangeQueryConfig:()=>rZ,MetricLabelInput:()=>rP,VariableContext:()=>e8,TRACE_QUERY_KEY:()=>rF,HTTPSettingsEditor:()=>eu,VARIABLE_TYPES:()=>ro,getSubmitText:()=>S,refreshIntervalQueryConfig:()=>rw,TimeRangeProviderWithQueryParams:()=>rD,ProjectSelect:()=>rC,useBuiltinVariableDefinitions:()=>e7,useUsageMetricsContext:()=>rB,useVariableValues:()=>e9,TOOLTIP_TEXT:()=>eM,OptionsEditorRadios:()=>es,useProjectList:()=>ry,ValidationSchemasContext:()=>b,VariablePreview:()=>rc,PluginEditor:()=>N,TimeRangeContext:()=>eq,dynamicImportPluginLoader:()=>rS,TimeRangeSettingsProvider:()=>eH,transformQueryResults:()=>rH,LEGEND_MODE_CONFIG:()=>ep,useBuiltinVariableValues:()=>e3,ValidationProvider:()=>C,getTitleAction:()=>P,ProjectStoreContext:()=>rf,mockPluginRegistry:()=>r2,parseVariables:()=>e2,useAllVariableValues:()=>re,LEGEND_POSITIONS_CONFIG:()=>ec,PluginLoaderComponent:()=>nn,UsageMetricsContext:()=>rW,getMockPluginName:()=>r5,useDataQueries:()=>r0,useDataQueriesContext:()=>rX,useDatasource:()=>J,useDatasourceStore:()=>z,usePlugins:()=>I,getUnixTimeRange:()=>r_,DatasourceName:()=>X,TimeRangeParam:()=>rT,useInitialTimeRange:()=>rI,useProjectStore:()=>rb,VariableStoreStateMap:()=>e6,useQueryCountContext:()=>eL,replaceVariable:()=>e0,useTimeRangeParams:()=>rO,useTimeRangeSettings:()=>eK,useTimeRangeSettingsContext:()=>eB,DatasourceStoreContext:()=>K,remotePluginLoader:()=>no,LegendOptionsEditor:()=>eb,useTimeSeriesQueries:()=>rQ,useTimeRangeOptionsSetting:()=>eG,TIME_SERIES_QUERY_KEY:()=>rR,DatasourceEditorForm:()=>$,useDatasourceClient:()=>H});var t=n(24246),i=n(68393),o=n(51278);let a=Object.entries(o.CALCULATIONS_CONFIG).map(([e,r])=>({id:e,...r}));function l({value:e,onChange:r}){let n=o.CALCULATIONS_CONFIG[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),h=n(25283),g=n(28797),m=n(87895),x=n(79119),v=n(54538),f=n.n(v),y=n(64293);let b=(0,v.createContext)(void 0);function j(){let e=(0,v.useContext)(b);if(void 0===e)throw Error("No ValidationSchemasContext found. Did you forget a Provider?");return e}function C({children:e}){let[r,n]=(0,v.useState)(o.datasourceDefinitionSchema),[i,a]=(0,v.useState)(o.panelEditorSchema),[l,s]=(0,v.useState)(o.variableDefinitionSchema);return(0,t.jsx)(b.Provider,{value:{datasourceEditorSchema:r,panelEditorSchema:i,variableEditorSchema:l,setDatasourceEditorSchemaPlugin:function(e){n((0,o.buildDatasourceDefinitionSchema)(e))},setPanelEditorSchemaPlugin:function(e){a((0,o.buildPanelEditorSchema)(e))},setVariableEditorSchemaPlugin:function(e){s((0,o.buildVariableDefinitionSchema)(e))}},children:e})}function P(e,r){return"read"===e?"View":r&&"create"===e?"Add":r||"create"!==e?"update"===e?"Edit":"":"Create"}function S(e,r){return r&&"create"===e?"Add":r&&"update"===e?"Apply":r?"":"Save"}var E=n(10517),k=n(53034);let T=(0,v.createContext)(void 0);function Z(){let e=(0,v.useContext)(T);if(void 0===e)throw Error("PluginRegistryContext not found. Did you forget a provider?");return e}function w(e,r,n){n={...n,enabled:(n?.enabled??!0)&&void 0!==e&&""!==r};let{getPlugin:t}=Z();return(0,k.useQuery)({queryKey:["getPlugin",e,r],queryFn:()=>t(e,r),...n})}function I(e,r){let{getPlugin:n}=Z(),t=[...new Set(r.map(e=>e.kind))],i=(0,k.useQueries)({queries:t.map(r=>({queryKey:["getPlugin",e,r],queryFn:()=>n(e,r)}))});return r.map(e=>i[t.indexOf(e.kind)])}function O(e,r){let{listPluginMetadata:n}=Z();return(0,k.useQuery)({queryKey:["listPluginMetadata",e],queryFn:()=>n(e),...r})}function V(){let{getPlugin:e,listPluginMetadata:r}=Z();return(0,k.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 L=(0,v.forwardRef)((e,r)=>{let{pluginTypes:n,value:i,onChange:o,...a}=e,{data:l,isLoading:s}=O(n),u=!i||s?"":R(i),d=(0,v.useCallback)(e=>{if(""===e)return"";let r=A(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?.(A(e.target.value))},SelectProps:{renderValue:d},"data-testid":"plugin-kind-select",children:[s&&(0,t.jsx)(E.Z,{value:"",children:"Loading..."}),l?.map(e=>t.jsx(E.Z,{"data-testid":"option",value:R({type:e.kind,kind:e.spec.name}),children:e.spec.display.name},e.kind+e.spec.name))]})});L.displayName="PluginKindSelect";let D="_____";function R(e){return[e.type,e.kind].join(D)}function A(e){let r=e.split(D),n=r[0],t=r[1];if(void 0===n||void 0===t)throw Error("Invalid optionValue string");return{type:n,kind:t}}function M(e){let{pluginSelection:{type:r,kind:n},...o}=e,{data:a,isLoading:l,error:s}=w(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}var Q=n(75586);function q(e){let{pluginTypes:r,value:n,onHideQueryEditorChange:t=()=>{}}=e,i=(0,o.useEvent)(e.onChange),a=(0,o.useEvent)(t),l=(0,v.useRef)({[n.selection.type]:{[n.selection.kind]:n.spec}}),s=(0,o.useEvent)(()=>{let e=l.current[n.selection.type];void 0===e&&(e={},l.current[n.selection.type]=e),e[n.selection.kind]=n.spec}),u=(0,v.useRef)({[n.selection.kind]:!1}),{defaultPluginKinds:d}=Z(),c=r[0],p=c?d?.[c]:void 0,h=c&&p?{type:c,kind:p}:void 0,g=!n.selection&&h?h:void 0,[m,x]=(0,v.useState)(g);(0,v.useEffect)(()=>{""===n.selection.kind&&(n.selection.kind=p||"")},[n.selection,p]);let{data:f,isFetching:y,error:b}=w(m?.type,m?.kind||"");return(0,v.useEffect)(()=>{m&&void 0!==f&&(s(),i({selection:m,spec:f.createInitialOptions?f.createInitialOptions():{}}),"Panel"===m.type&&(u.current[m.kind]=!!f.hideQueryEditor,!!f.hideQueryEditor!==u.current[n.selection.kind]&&a(!!f.hideQueryEditor)),x(void 0))},[m,f,s,i,a,u,n.selection]),{pendingSelection:m,isLoading:y,error:b,onSelectionChange:e=>{let r=l.current[e.type]?.[e.kind];void 0!==r?(s(),i({selection:e,spec:r})):x(e),"Panel"===e.type&&void 0!==u.current[e.kind]&&u.current[n.selection.kind]!==u.current[e.kind]&&a(!!u.current[e.kind])},onSpecChange:e=>{i((0,Q.Uy)(n,r=>{r.spec=e}))},rememberCurrentSpecState:s}}function N(e){let{value:r,pluginTypes:n,pluginKindLabel:o,onChange:a,isReadonly:l,...s}=e,{pendingSelection:d,isLoading:c,error:p,onSelectionChange:h,onSpecChange:g}=q(e);return(0,t.jsxs)(u.Z,{...s,children:[(0,t.jsx)(L,{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:h}),(0,t.jsx)(i.ErrorBoundary,{FallbackComponent:i.ErrorAlert,children:(0,t.jsx)(M,{pluginSelection:r.selection,value:r.spec,onChange:g,isReadonly:l})})]})}function $(e){let{initialDatasourceDefinition:r,action:n,isDraft:o,isReadonly:a,onActionChange:l,onSave:f,onClose:b,onDelete:C}=e,[E,k]=(0,v.useState)(!1),T=P(n,o),Z=S(n,o),{datasourceEditorSchema:w}=j(),I=(0,y.useForm)({resolver:(0,s.F)(w),mode:"onBlur",defaultValues:r});function O(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)(y.FormProvider,{...I,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:[T," Datasource"]}),(0,t.jsx)(i.FormActions,{action:n,submitText:Z,isReadonly:a,isValid:I.formState.isValid,onActionChange:l,onSubmit:I.handleSubmit(e=>{f(O(e))}),onDelete:C,onCancel:function(){JSON.stringify(r)!==JSON.stringify(O(I.getValues()))?k(!0):b()}})]}),(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)(y.Controller,{control:I.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)(y.Controller,{control:I.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)(y.Controller,{control:I.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)(h.Z,{children:[(0,t.jsx)(y.Controller,{control:I.control,name:"spec.default",render:({field:e})=>(0,t.jsx)(g.Z,{label:"Set as default",control:(0,t.jsx)(m.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 ",I.getValues().spec.plugin.kind," to be used"]})]})})]}),(0,t.jsx)(x.Z,{}),(0,t.jsx)(d.Z,{py:1,variant:"h3",children:"Plugin Options"}),(0,t.jsx)(y.Controller,{control:I.control,name:"spec.plugin",render:({field:e})=>(0,t.jsx)(N,{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:E,onCancel:()=>k(!1),onDiscardChanges:()=>{k(!1),b()}})]})}var F=n(14371),_=n(63767),U=n(12577),W=n(52889),B=n(75094);let K=(0,v.createContext)(void 0);function z(){let e=(0,v.useContext)(K);if(void 0===e)throw Error("No DatasourceStoreContext found. Did you forget a Provider?");return e}function G(e,r){let{listDatasourceSelectItems:n}=z();return(0,k.useQuery)({queryKey:["listDatasourceSelectItems",e,r],queryFn:()=>n(e)})}function H(e){let r=z();return(0,k.useQuery)({queryKey:["getDatasourceClient",e],queryFn:()=>r.getDatasourceClient(e)})}function J(e){let r=z();return(0,k.useQuery)({queryKey:["getDatasource",e],queryFn:()=>r.getDatasource(e)})}function Y(e){let{datasourcePluginKind:r,value:n,project:i,onChange:o,...a}=e,{data:l,isLoading:s}=G(r,i),u=(0,v.useMemo)(()=>{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]),d=(0,v.useMemo)(()=>(l??[]).map(e=>({group:e.group,editLink:e.editLink,items:e.items.map(e=>({name:e.name,overriding:e.overriding,overridden:e.overridden,saved:e.saved??!0,group:e.selector.group,value:er(e.selector)}))})),[l]),c=s?"":er(u),p=()=>{};return(0,t.jsx)(_.Z,{...a,value:c,onChange:e=>{o(function(e){let r=e.split(ee),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.target.value))},children:d.map(e=>[(0,t.jsx)(x.Z,{},`${e.group}-divider`),...e.items.map(r=>(0,t.jsx)(E.Z,{value:r.value,disabled:r.overridden||!r.saved,children:(0,t.jsxs)(h.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",width:"100%",children:[(0,t.jsx)(U.Z,{children:(0,t.jsx)(X,{name:r.name,overridden:r.overridden,overriding:r.overriding})}),!r.saved&&(0,t.jsx)(U.Z,{children:"Save the dashboard to enable this datasource"}),(0,t.jsx)(U.Z,{style:{textAlign:"right"},children:e.group&&e.group.length>0&&(0,t.jsx)(W.Z,{disabled:!1,label:e.group,size:"small",onDelete:e.editLink?p:void 0,deleteIcon:e.editLink?(0,t.jsx)(B.Z,{href:e.editLink,target:"_blank",children:(0,t.jsx)(F.default,{fontSize:"small"})}):void 0})})]})},r.value))])})}function X(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 ee="_____";function er(e){return[e.kind,e.group??"",e.name??""].join(ee)}var en=n(86396),et=n(33755),ei=n(90192),eo=n(65091),ea=n(12e3);function el(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 es=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)(ei.Z,{children:(0,t.jsx)(eo.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)(ea.Z,{}),label:e},e))})})}),r.map(({label:e,content:r},n)=>(0,t.jsx)(el,{value:a,index:n,children:r},e))]})};function eu(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),{})},h=[{label:l,content:(0,t.jsx)(y.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,Q.Uy)(r,e=>{e.directUrl=t.target.value}))}})})},{label:s,content:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.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,Q.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)(y.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,Q.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)(y.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,Q.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)(E.Z,{value:"GET",children:"GET"}),(0,t.jsx)(E.Z,{value:"POST",children:"POST"}),(0,t.jsx)(E.Z,{value:"PUT",children:"PUT"}),(0,t.jsx)(E.Z,{value:"PATCH",children:"PATCH"}),(0,t.jsx)(E.Z,{value:"DELETE",children:"DELETE"})]})})}),(0,t.jsx)(c.ZP,{item:!0,xs:1,children:(0,t.jsx)(y.Controller,{name:`Remove Endpoint ${a}`,render:({field:e})=>(0,t.jsx)(B.Z,{...e,disabled:i,onClick:t=>{e.onChange(t),n((0,Q.Uy)(r,e=>{void 0!==e.proxy&&(e.proxy.spec.allowedEndpoints=[...e.proxy.spec.allowedEndpoints?.filter((e,r)=>r!==a)||[]])}))},children:(0,t.jsx)(en.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)(B.Z,{disabled:i,onClick:()=>n((0,Q.Uy)(r,e=>{void 0!==e.proxy&&(e.proxy.spec.allowedEndpoints=[...e.proxy.spec.allowedEndpoints??[],{endpointPattern:"",method:""}])})),children:(0,t.jsx)(et.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)(y.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,Q.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)(y.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,Q.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)(y.Controller,{name:`Remove Header ${o}`,render:({field:o})=>(0,t.jsx)(B.Z,{...o,disabled:i,onClick:t=>{o.onChange(t);let i={...r.proxy?.spec.headers};delete i[e],n((0,Q.Uy)(r,e=>{void 0!==e.proxy&&(e.proxy.spec.headers=i)}))},children:(0,t.jsx)(en.default,{})})})})]},o)),(0,t.jsx)(c.ZP,{item:!0,xs:12,sx:{paddingTop:"0px !important",paddingLeft:"5px !important"},children:(0,t.jsx)(B.Z,{disabled:i,onClick:()=>n((0,Q.Uy)(r,e=>{void 0!==e.proxy&&(e.proxy.spec.headers={...e.proxy.spec.headers,"":""})})),children:(0,t.jsx)(et.default,{})})})]}),(0,t.jsx)(y.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,Q.Uy)(r,e=>{void 0!==e.proxy&&(e.proxy.spec.secret=t.target.value)}))}})})]})}],g=h.findIndex(e=>e.label===l),m=h.findIndex(e=>e.label===s),x=r.proxy?m:g,[f,b]=(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)(es,{isReadonly:i,tabs:h,defaultTab:x,onModeChange:e=>{if(h[e]?.label===l){C(r);let{proxy:e,...t}=r;n({...t,directUrl:f.directUrl})}else if(h[e]?.label===s){b(r);let{directUrl:e,...t}=r;n({...t,proxy:j.proxy})}}})]})}let ed=["mean","first","first-number","last","last-number","min","max","sum"],ec={bottom:{label:"Bottom"},right:{label:"Right"}},ep={list:{label:"List"},table:{label:"Table"}},eh={small:{label:"Small"},medium:{label:"Medium"}},eg=ed.reduce((e,r)=>(e[r]=o.CALCULATIONS_CONFIG[r],e),{});function em(e){return void 0===e||!!((0,o.isValidLegendPosition)(e.position)&&(!e.mode||(0,o.isValidLegendMode)(e.mode))&&(!e.size||(0,o.isValidLegendSize)(e.size)))}let ex=Object.entries(ec).map(([e,r])=>({id:e,...r})),ev=Object.entries(ep).map(([e,r])=>({id:e,...r})),ef=Object.entries(eh).map(([e,r])=>({id:e,...r})),ey=Object.entries(eg).map(([e,r])=>({id:e,...r}));function eb({value:e,onChange:r,showValuesEditor:n=!0}){let a=em(e),l=(0,o.getLegendPosition)(e?.position),s=ec[l],u=(0,o.getLegendMode)(e?.mode),d=ep[u],c=(0,o.getLegendSize)(e?.size),p=eh[c],h=(e?.values||[]).reduce((e,r)=>{let n=eg[r];return n&&e.push({...n,id:r}),e},[]);return(0,t.jsxs)(i.OptionsEditorGroup,{title:"Legend",children:[!a&&(0,t.jsx)(i.ErrorAlert,{error:{name:"invalid-legend",message:"Invalid legend spec"}}),(0,t.jsx)(i.OptionsEditorControl,{label:"Show",control:(0,t.jsx)(m.Z,{checked:void 0!==e,onChange:(e,n)=>{r(!0===n?{position:o.DEFAULT_LEGEND.position}:void 0)}})}),(0,t.jsx)(i.OptionsEditorControl,{label:"Position",control:(0,t.jsx)(i.SettingsAutocomplete,{value:{...s,id:l},options:ex,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:{...d,id:u},options:ev,onChange:(n,t)=>{r({...e,position:l,mode:t.id})},disabled:void 0===e,disableClearable:!0})}),(0,t.jsx)(i.OptionsEditorControl,{label:"Size",control:(0,t.jsx)(i.SettingsAutocomplete,{value:{...p,id:c},options:ef,onChange:(n,t)=>{r({...e,position:l,size:t.id})},disabled:void 0===e||"table"!==u,disableClearable:!0})}),n&&(0,t.jsx)(i.OptionsEditorControl,{label:"Values",control:(0,t.jsx)(i.SettingsAutocomplete,{multiple:!0,disableCloseOnSelect:!0,disableClearable:!0,value:h,options:ey,onChange:(n,t)=>{r({...e,position:l,values:t.map(e=>e.id)})},disabled:void 0===e||"table"!==u,limitTags:1,ChipProps:{size:"small"}})})]})}var ej=n(48565),eC=n(22446),eP=n(12449),eS=n(84974);let eE=({queryTypes:e,index:r,query:n,isCollapsed:i,onDelete:o,onChange:a,onCollapseExpand:l})=>(0,t.jsxs)(h.Z,{spacing:1,children:[(0,t.jsxs)(h.Z,{direction:"row",alignItems:"center",borderBottom:1,borderColor:e=>e.palette.divider,children:[(0,t.jsx)(B.Z,{size:"small",onClick:()=>l(r),children:i?(0,t.jsx)(eS.default,{}):(0,t.jsx)(eP.default,{})}),(0,t.jsxs)(d.Z,{variant:"overline",component:"h4",children:["Query #",r+1]}),(0,t.jsx)(B.Z,{size:"small",sx:{marginLeft:"auto",visibility:`${o?"visible":"hidden"}`},onClick:()=>o&&o(r),children:(0,t.jsx)(eC.default,{})})]}),!i&&(0,t.jsx)(ek,{queryTypes:e,value:n,onChange:e=>a(r,e)})]},r);function ek(e){let{value:r,onChange:n,queryTypes:i,...o}=e;return(0,t.jsx)(u.Z,{...o,children:(0,t.jsx)(N,{pluginTypes:i,pluginKindLabel:"Query Type",value:{selection:{kind:r.spec.plugin.kind,type:r.kind},spec:r.spec.plugin.spec},onChange:e=>{n((0,Q.Uy)(r,r=>{r.kind=e.selection.type,r.spec.plugin.kind=e.selection.kind,r.spec.plugin.spec=e.spec}))}})})}function eT({queryTypes:e,queries:r=[],onChange:n}){let{defaultInitialQueryDefinition:i,isLoading:o}=function(e){let r=e[0],{data:n,isLoading:t}=O(e),{defaultPluginKinds:i}=Z(),o=i?.[r]??n?.[0]?.spec.name??"",{data:a}=w(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,Q.Uy)(r,r=>{r?r[e]=t:r=[t]}))},u=e=>{n((0,Q.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)(h.Z,{spacing:1,children:c.map((n,i)=>(0,t.jsx)(eE,{queryTypes:e,index:i,query:n,isCollapsed:!!a[i],onChange:s,onDelete:r.length>1?u:void 0,onCollapseExpand:d},i))}),(0,t.jsx)(ej.Z,{variant:"contained",startIcon:(0,t.jsx)(et.default,{}),sx:{marginTop:1},onClick:()=>{n((0,Q.Uy)(r,e=>{e?e.push(i):e=[...r,i]})),l(e=>(e.push(!1),[...e]))},children:"Add Query"})]})}var eZ=n(51781),ew=n(49408);let eI=({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)(eZ.Z,{value:r,onChange:(e,r)=>{n(r)},"aria-label":"Panel configuration tabs",children:e.map(({label:e},r)=>(0,t.jsx)(ew.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)(el,{value:r,index:i,children:n},e))]})},eO=(0,v.createContext)(0),eV=({queryCount:e,children:r})=>(0,t.jsx)(eO.Provider,{value:e,children:r}),eL=()=>(0,v.useContext)(eO);function eD(e){let{control:r,panelDefinition:n,onJSONChange:o,onQueriesChange:a,onPluginSpecChange:l}=e,{kind:s}=n.spec.plugin,{data:u,isPending:d,error:c}=w("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:h}=u,g=[];return h||g.push({label:"Query",content:(0,t.jsx)(y.Controller,{control:r,name:"panelDefinition.spec.queries",render:({field:e})=>(0,t.jsx)(eT,{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)(y.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)(y.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)(eV,{queryCount:(n.spec.queries??[]).length,children:(0,t.jsx)(eI,{tabs:g},g.length)})}function eR(e){let{pluginLoader:{getInstalledPlugins:r,importPluginModule:n},children:i,defaultPluginKinds:a}=e,l=function(e){let r=(0,o.useEvent)(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),s=(0,v.useRef)(new Map),u=(0,o.useEvent)(e=>{let r=s.current.get(e);return void 0===r&&(r=n(e),s.current.set(e,r),r.catch(()=>s.current.delete(e))),r}),d=(0,v.useCallback)(async(e,r)=>{let n=await l(),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 u(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},[l,u]),c=(0,v.useCallback)(async e=>{let r=await l();return e.flatMap(e=>r.pluginMetadataByKind.get(e)??[])},[l]),p=(0,v.useMemo)(()=>({getPlugin:d,listPluginMetadata:c,defaultPluginKinds:a}),[d,c,a]);return(0,t.jsx)(T.Provider,{value:p,children:i})}var eA=n(67877);let eM={refreshVariableValues:"Refresh values",copyVariableValues:"Copy values to clipboard",refresh:"Refresh",refreshInterval:"Auto refresh interval"};var eQ=n(20461);let eq=(0,v.createContext)(void 0);function eN(){let e=(0,v.useContext)(eq);if(void 0===e)throw Error("No TimeRangeContext found. Did you forget a Provider?");return e}function e$(){return eN()}function eF(e){let{absoluteTimeRange:r}=e$();return void 0===e?0:(0,o.getSuggestedStepMs)(r,e)}function e_(e){let{timeRange:r,refreshInterval:n,children:i,setTimeRange:a,setRefreshInterval:l}=e,[s,u]=(0,v.useState)(r),[d,c]=(0,v.useState)(n),[p,h]=(0,v.useState)(0);(0,v.useEffect)(()=>{u(r)},[r,p]),(0,v.useEffect)(()=>{c(n)},[n]);let g=(0,v.useCallback)(()=>{h(e=>e+1)},[h]),m=null!=d?(0,eQ.milliseconds)((0,o.parseDurationString)(d)):0;(0,v.useEffect)(()=>{if(m>0){let e=setInterval(()=>{g()},m);return()=>clearInterval(e)}},[g,m]);let x=(0,v.useMemo)(()=>{let e=(0,o.isRelativeTimeRange)(s)?(0,o.toAbsoluteTimeRange)(s):s;return{timeRange:s,setTimeRange:a??u,absoluteTimeRange:e,refresh:g,refreshKey:`${e.start}:${e.end}:${d}:${p}`,refreshInterval:d,refreshIntervalInMs:m,setRefreshInterval:l??c}},[s,a,g,d,p,m,l]);return(0,t.jsx)(eq.Provider,{value:x,children:i})}let eU={showCustom:!0,options:["5m","15m","30m","1h","6h","12h","24h","7d","14d"].map(e=>(0,i.buildRelativeTimeOption)(e))},eW=(0,v.createContext)(eU);function eB(){let e=(0,v.useContext)(eW);if(void 0===e)throw Error("No TimeRangeContext found. Did you forget a Provider?");return e}function eK(){return eB()}function ez(e){let r=eK().showCustom;return void 0!==e?e:r}function eG(e){let r=eK().options;return void 0!==e?e:r}function eH(e){let r=(0,v.useMemo)(()=>({showCustom:void 0===e.showCustom?eU.showCustom:e.showCustom,options:void 0===e.options?eU.options:e.options}),[e.showCustom,e.options]);return(0,t.jsx)(eW.Provider,{value:r,children:e.children})}let eJ=[{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 eY({heightPx:e,showTimeRangeSelector:r=!0,showRefreshButton:n=!0,showRefreshInterval:o=!0,showCustomTimeRange:a,timePresets:l}){let{timeRange:s,setTimeRange:u,refresh:d,refreshInterval:c,setRefreshInterval:p}=e$(),g=ez(a),m=eG(l),x=void 0===e?"34px":`${e}px`;"pastDuration"in s&&!m.some(e=>e.value.pastDuration===s.pastDuration)&&m.push((0,i.buildRelativeTimeOption)(s.pastDuration));let f=(0,v.useCallback)(e=>{p(e)},[p]);return(0,t.jsxs)(h.Z,{direction:"row",spacing:1,children:[r&&(0,t.jsx)(i.TimeRangeSelector,{timeOptions:m,value:s,onChange:u,height:x,showCustomTimeRange:g}),n&&(0,t.jsx)(i.InfoTooltip,{description:eM.refresh,children:(0,t.jsx)(i.ToolbarIconButton,{"aria-label":eM.refresh,onClick:d,sx:{height:x},children:(0,t.jsx)(eA.default,{})})}),o&&(0,t.jsx)(i.InfoTooltip,{description:eM.refreshInterval,children:(0,t.jsx)(i.RefreshIntervalPicker,{timeOptions:eJ,value:c,onChange:f,height:x})})]})}function eX(e,r){let n=e2(e),t=e;return n.sort((e,r)=>r.length-e.length).forEach(e=>{let n=r[e];n&&void 0!==n.value&&(t=e0(t,e,n?.value))}),t}function e0(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 e1=/\$(\w+)|\${(\w+)(?:\.([^:^\}]+))?(?::([^\}]+))?}/gm,e2=e=>{let r;let n=new Set;for(;null!==(r=e1.exec(e));)r&&(r[1]?n.add(r[1]):r[2]&&n.add(r[2]));return Array.from(n.values())},e5=(0,v.createContext)(void 0);function e4(){let e=(0,v.useContext)(e5);if(void 0===e)throw Error("No BuiltinVariableContext found. Did you forget a Provider?");return e}function e3(e){let{variables:r}=e4(),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 e7(){let{variables:e}=e4();return e}class e6{[Q.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 e8=(0,v.createContext)(void 0);function e9(e){let{state:r}=function(){let e=(0,v.useContext)(e8);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 re(e){let r=e9(e),n=e3(e);return(0,v.useMemo)(()=>({...r,...n}),[r,n])}function rr(e){let r=re(e?e2(e):[]);if(e)return eX(e,r)}function rn(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 rt(e){let r;let{data:n}=w("Variable",e.spec.plugin.kind),t=z(),i=re(),{absoluteTimeRange:o,refreshKey:a}=e$(),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=re(r),d=!1;r&&(d=r.some(e=>u[e]?.loading));let c=ri(u);return(0,k.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?rn(e.data,s):e.data},enabled:!!n||d})}function ri(e){return Object.values(e).map(e=>JSON.stringify(e.value)).join(",")}let ro=[{label:"List",kind:"ListVariable"},{label:"Text",kind:"TextVariable"}];var ra=n(70313),rl=n(84954),rs=n(315),ru=n(50898),rd=n(60993);function rc(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)(h.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:eM.refreshVariableValues,children:(0,t.jsx)(B.Z,{onClick:n,size:"small",children:(0,t.jsx)(eA.default,{})})}),(0,t.jsx)(i.InfoTooltip,{description:eM.copyVariableValues,children:(0,t.jsx)(B.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)(rd.default,{})})})]}),(0,t.jsx)(rl.Z,{variant:"outlined",children:(0,t.jsxs)(u.Z,{sx:{display:"flex",flexWrap:"wrap",gap:1,m:2},children:[a&&(0,t.jsx)(rs.Z,{severity:"error",children:a}),r?.length===0&&(0,t.jsx)(rs.Z,{severity:"info",children:"No results"}),o&&(0,t.jsx)(h.Z,{width:"100%",sx:{alignItems:"center",justifyContent:"center"},children:(0,t.jsx)(ru.Z,{})}),r?.slice(0,l).map((e,r)=>t.jsx(W.Z,{size:"small",label:e},r)),p>0&&(0,t.jsx)(W.Z,{onClick:()=>{s(void 0)},variant:"outlined",size:"small",label:`+${p} more`})]})})]})}function rp(e){let{definition:r,onRefresh:n}=e,{data:i,isFetching:o,error:a}=rt(r),l=a?.message;return(0,t.jsx)(rc,{values:i?.map(e=>e.value)||[],onRefresh:n,isLoading:o,error:l})}function rh(){return(0,t.jsx)("div",{children:"Error previewing values"})}function rg({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)(h.Z,{spacing:2,children:[(0,t.jsx)(y.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)(rc,{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)(y.Controller,{control:r,name:"spec.constant",render:({field:r})=>(0,t.jsx)(g.Z,{label:"Constant",control:(0,t.jsx)(m.Z,{...r,checked:!!r.value,readOnly:"read"===e,value:r.value??!1,onChange:n=>{"read"!==e&&r.onChange(n)}})})})]})]})}function rm({action:e,control:r}){let n=(0,y.useFormContext)(),[o,a]=(0,v.useState)(n.getValues()),l=()=>{a(n.getValues())},s=(0,y.useWatch)({control:r,name:"spec.plugin.kind"}),c=(0,y.useWatch)({control:r,name:"spec.allowAllValue"}),f=n.getValues();return void 0===f.spec.allowAllValue&&n.setValue("spec.allowAllValue",!1),void 0===f.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)(h.Z,{spacing:2,mb:2,children:[s?(0,t.jsx)(u.Z,{children:(0,t.jsx)(i.ErrorBoundary,{FallbackComponent:rh,resetKeys:[o],children:(0,t.jsx)(rp,{definition:o,onRefresh:l})})}):(0,t.jsx)(rc,{isLoading:!0}),(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(ra.d,{onClickAway:()=>l(),children:(0,t.jsx)(u.Z,{})}),(0,t.jsx)(i.ErrorBoundary,{FallbackComponent:i.ErrorAlert,children:(0,t.jsx)(y.Controller,{control:r,name:"spec.plugin",render:({field:r})=>(0,t.jsx)(N,{width:"100%",pluginTypes:["Variable"],pluginKindLabel:"Source",value:{selection:{type:"Variable",kind:r.value?.kind??"StaticListVariable"},spec:r.value?.spec??{values:[]}},isReadonly:"read"===e,onChange:e=>{r.onChange({kind:e.selection.kind,spec:e.spec})}})})})]}),(0,t.jsx)(h.Z,{children:(0,t.jsx)(y.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)(h.Z,{children:(0,t.jsx)(y.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)(E.Z,{value:"none",children:"None"}),(0,t.jsx)(E.Z,{value:"alphabetical-asc",children:"Alphabetical, asc"}),(0,t.jsx)(E.Z,{value:"alphabetical-desc",children:"Alphabetical, desc"}),(0,t.jsx)(E.Z,{value:"numerical-asc",children:"Numerical, asc"}),(0,t.jsx)(E.Z,{value:"numerical-desc",children:"Numerical, desc"}),(0,t.jsx)(E.Z,{value:"alphabetical-ci-asc",children:"Alphabetical, case-insensitive, asc"}),(0,t.jsx)(E.Z,{value:"alphabetical-ci-desc",children:"Alphabetical, case-insensitive, desc"})]})})})]}),(0,t.jsx)(x.Z,{}),(0,t.jsx)(d.Z,{py:1,variant:"subtitle1",children:"Dropdown Options"}),(0,t.jsxs)(h.Z,{spacing:"2",children:[(0,t.jsxs)(h.Z,{children:[(0,t.jsx)(y.Controller,{control:r,name:"spec.allowMultiple",render:({field:r})=>(0,t.jsx)(g.Z,{label:"Allow Multiple Values",control:(0,t.jsx)(m.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)(h.Z,{children:[(0,t.jsx)(y.Controller,{control:r,name:"spec.allowAllValue",render:({field:r})=>(0,t.jsx)(g.Z,{label:"Allow All option",control:(0,t.jsx)(m.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"}),c&&(0,t.jsx)(y.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 rx({initialVariableDefinition:e,action:r,isDraft:n,isReadonly:o,onActionChange:a,onSave:l,onClose:h,onDelete:g}){let[m,f]=(0,v.useState)(!1),b=P(r,n),C=S(r,n),{variableEditorSchema:k}=j(),T=(0,y.useForm)({resolver:(0,s.F)(k),mode:"onBlur",defaultValues:e}),Z=(0,y.useWatch)({control:T.control,name:"kind"});function w(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)(y.FormProvider,{...T,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:[b," Variable"]}),(0,t.jsx)(i.FormActions,{action:r,submitText:C,isReadonly:o,isValid:T.formState.isValid,onActionChange:a,onSubmit:T.handleSubmit(e=>{l(w(e))}),onDelete:g,onCancel:function(){JSON.stringify(e)!==JSON.stringify(w(T.getValues()))?f(!0):h()}})]}),(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)(y.Controller,{control:T.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)(y.Controller,{control:T.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)(y.Controller,{control:T.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)(y.Controller,{control:T.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:ro.map(e=>(0,t.jsx)(E.Z,{value:e.kind,children:e.label},e.kind))})})})]}),(0,t.jsx)(x.Z,{}),"TextVariable"===Z&&(0,t.jsx)(i.ErrorBoundary,{FallbackComponent:i.ErrorAlert,children:(0,t.jsx)(rg,{action:r,control:T.control})}),"ListVariable"===Z&&(0,t.jsx)(i.ErrorBoundary,{FallbackComponent:i.ErrorAlert,children:(0,t.jsx)(rm,{action:r,control:T.control})})]}),(0,t.jsx)(i.DiscardChangesConfirmationDialog,{description:"Are you sure you want to discard these changes? Changes cannot be recovered.",isOpen:m,onCancel:()=>{f(!1)},onDiscardChanges:()=>{f(!1),h()}})]})}var rv=n(51564);let rf=(0,v.createContext)(void 0);function ry(){return(0,k.useQuery)({queryKey:["projects"],queryFn:()=>(0,o.fetchJson)("/api/v1/projects")})}function rb(){let e=(0,v.useContext)(rf);if(void 0===e)throw Error("No ProjectStoreContext found. Did you forget a Provider?");return e}function rj(e){let{children:r,enabledURLParams:n}=e,{project:i,setProject:o}=function(e=!0){let[r,n]=(0,rv.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)(rf.Provider,{value:a,children:r})}function rC(e){let{onChange:r,value:n,...i}=e,{data:o,isLoading:a}=ry(),l=a?"":n.metadata.name??"none";return(0,t.jsxs)(_.Z,{...i,value:l,onChange:e=>{r({kind:"Project",metadata:{name:e.target.value},spec:{}})},children:[(0,t.jsx)(E.Z,{value:"none",children:(0,t.jsx)(h.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",width:"100%",height:32,children:(0,t.jsx)(U.Z,{children:"None"})})}),o?.map(e=>[t.jsx(E.Z,{value:e.metadata.name,children:t.jsx(h.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",width:"100%",height:32,children:t.jsx(U.Z,{children:e.metadata.name})})},e.metadata.name)])]})}let rP=({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 rS(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 rE(e){return!e||"string"==typeof e&&(0,o.isDurationString)(e)?e:(1e3*(0,eQ.getUnixTime)(e)).toString()}function rk(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,o.isDurationString)(r)?r:new Date(Number(r)):null}let rT={encode:rE,decode:rk,equals:(e,r)=>e===r||(e&&r?e.valueOf()===r.valueOf():e===r)},rZ={start:rT,end:rT},rw={refresh:rT};function rI(e){let[r]=(0,rv.useQueryParams)(rZ,{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,o.isDurationString)(i)?r={pastDuration:i}:(0,eQ.isDate)(n)&&(0,eQ.isDate)(t)&&(r={start:n,end:t}),r},[n,t,e])}function rO(e){let[r,n]=(0,rv.useQueryParams)(rZ,{updateType:"replaceIn"}),[t,i]=(0,v.useState)(!1),{start:a}=r;return(0,v.useEffect)(()=>{!t&&!a&&(0,o.isRelativeTimeRange)(e)&&(n({start:e.pastDuration,end:void 0}),i(!0))},[e,t,a,n]),{timeRange:e,setTimeRange:(0,v.useCallback)(e=>{(0,o.isRelativeTimeRange)(e)?n({start:e.pastDuration,end:void 0}):n(e)},[n])}}function rV(e){let[r]=(0,rv.useQueryParams)(rw,{updateType:"replaceIn"}),{refresh:n}=r;return(0,v.useMemo)(()=>{let r=e;if(!n)return r;let t=n.toString();return(0,o.isDurationString)(t)&&(r=t),r},[e,n])}function rL(e){let[r,n]=(0,rv.useQueryParams)(rw,{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 rD(e){let{initialTimeRange:r,initialRefreshInterval:n,children:i}=e,{timeRange:o,setTimeRange:a}=rO(r),{refreshInterval:l,setRefreshInterval:s}=rL(n);return(0,t.jsx)(e_,{timeRange:o,refreshInterval:l,setTimeRange:a,setRefreshInterval:s,children:i})}let rR="TimeSeriesQuery";function rA({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,Object.values(d?Object.fromEntries(Object.entries(l).filter(([e])=>d.includes(e))):l).map(e=>JSON.stringify(e.value)).join(","),s],p=!1;return d&&(p=d.some(e=>l[e]?.loading)),{queryKey:c,queryEnabled:void 0!==e&&!p}}let rM=(e,r,n)=>{let{data:t}=w(rR,e.spec.plugin.kind),i=rq(),{queryEnabled:o,queryKey:a}=rA({plugin:t,definition:e,context:i});return(0,k.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 rQ(e,r,n){let{getPlugin:t}=Z(),i={...rq(),mode:r?.mode},o=I(rR,e.map(e=>({kind:e.spec.plugin.kind})));return(0,k.useQueries)({queries:e.map((e,a)=>{let{queryEnabled:l,queryKey:s}=rA({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(rR,e.spec.plugin.kind);return await o.getTimeSeriesData(e.spec.plugin.spec,n)}}})})}function rq(){let{absoluteTimeRange:e,refreshKey:r}=e$();return{timeRange:e,variableState:re(),datasourceStore:z(),refreshKey:r}}function rN(){return r$((0,k.useQueryClient)().getQueryCache())}function r$(e){let r=[];for(let n of e.findAll({type:"active"})){let e=n.queryKey?.[0];e?.kind&&e.kind.startsWith(rR)&&r.push(n)}return r}let rF="TraceQuery";function r_(e){let{start:r,end:n}=e;return{start:Math.ceil((0,eQ.getUnixTime)(r)),end:Math.ceil((0,eQ.getUnixTime)(n))}}function rU(e){let{getPlugin:r}=Z(),n=z(),{absoluteTimeRange:t}=e$(),i={datasourceStore:n,absoluteTimeRange:t};return(0,k.useQueries)({queries:e.map(e=>{let o=[e,n,t],a=e?.spec?.plugin?.kind;return{queryKey:o,queryFn:async()=>{let n=await r(rF,a);return await n.getTraceData(e.spec.plugin.spec,i)},structuralSharing:!1}})})}let rW=(0,v.createContext)(void 0),rB=()=>(0,v.useContext)(rW),rK=()=>{let e=rB();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,rz(e))}}}},rz=async e=>{await (0,o.fetch)("/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})})},rG=({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)(rW.Provider,{value:i,children:n})};function rH(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 rJ(){let{data:e,isLoading:r}=O(["TimeSeriesQuery"]),{data:n,isLoading:t}=O(["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 rY=(0,v.createContext)(void 0);function rX(){let e=(0,v.useContext)(rY);if(void 0===e)throw Error("No DataQueriesContext found. Did you forget a Provider?");return e}function r0(e){let r=rX(),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 r1(e){let{definitions:r,options:n,children:i,queryOptions:o}=e,a=rJ(),l=r.map(e=>({kind:a(e.kind),spec:{plugin:e}})),s=rK(),u=l.filter(e=>"TimeSeriesQuery"===e.kind),d=rQ(u,n,o),c=l.filter(e=>"TraceQuery"===e.kind),p=rU(c),h=(0,v.useCallback)(()=>{d.forEach(e=>e.refetch()),p.forEach(e=>e.refetch())},[d,p]),g=(0,v.useMemo)(()=>{let e=[...rH(d,u),...rH(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:h,errors:e.map(e=>e.error)}},[u,d,c,p,h,o?.enabled,s]);return(0,t.jsx)(rY.Provider,{value:g,children:i})}function r2(...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:r5(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 r5(e,r){return`${e} Plugin for ${r}`}var r4=n(82749),r3=n(6085),r7=n.n(r3),r6=n(65895);let r8=(0,r4.init)({name:"@perses/perses-ui-host",remotes:[],shared:{react:{version:f().version,lib:()=>f(),shareConfig:{singleton:!0,requiredVersion:`^${f().version}`}},"react-dom":{version:"18.3.1",lib:()=>r7(),shareConfig:{singleton:!0,requiredVersion:"^18.3.1"}},"react-router-dom":{version:"6.26.0",lib:()=>r6,shareConfig:{singleton:!0,requiredVersion:"^6.26.0"}},"@tanstack/react-query":{version:"5.64.2",lib:()=>k,shareConfig:{singleton:!0,requiredVersion:"^5.64.2"}},"react-hook-form":{version:"7.52.2",lib:()=>y,shareConfig:{singleton:!0,requiredVersion:"^7.52.2"}},echarts:{version:"5.5.0",lib:()=>n(30156),shareConfig:{singleton:!0,requiredVersion:"^5.5.0"}},"@perses-dev/components":{version:"0.51.0-beta.0",lib:()=>n(68393),shareConfig:{singleton:!0,requiredVersion:"^0.51.0-beta.0"}},"@perses-dev/plugin-system":{version:"0.51.0-beta.0",lib:()=>n(57751),shareConfig:{singleton:!0,requiredVersion:"^0.51.0-beta.0"}},"@perses-dev/explore":{version:"0.51.0-beta.0",lib:()=>n(73223),shareConfig:{singleton:!0,requiredVersion:"^0.51.0-beta.0"}},"@perses-dev/dashboards":{version:"0.51.0-beta.0",lib:()=>n(56173),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(74614),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(55922),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"}}}}),r9=(e,r)=>{if(!r8.options.remotes.find(r=>r.name===e)){let n=r?`${r}/${e}/mf-manifest.json`:`/plugins/${e}/mf-manifest.json`;r8.registerRemotes([{name:e,entry:n,alias:e}])}},ne=async(e,r,n)=>(r9(e,n),(0,r4.loadRemote)(`${e}/${r}`));function nr({pluginFn:e,props:r}){return e(r)}function nn({plugin:e,props:r,field:n}){let{loadPlugin:i}=function({plugin:e}){return{pluginRuntime:r8,loadPlugin:()=>ne(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)(nr,{pluginFn:c,props:r},u)}let nt=e=>"object"==typeof e&&null!==e&&"kind"in e&&"spec"in e&&"object"==typeof e.spec&&null!==e.spec&&"name"in e.spec,ni=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(nt),no=e=>({getInstalledPlugins:async()=>{let r=await fetch(`${e||""}/api/v1/plugins`),n=await r.json(),t=[];return Array.isArray(n)?t=n.filter(ni):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 ne(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}})}}]);