@kb-labs/quality-entry 2.98.0 → 2.100.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.
- package/dist/widgets/117.js +1 -1
- package/dist/widgets/165.js +1 -1
- package/dist/widgets/370.js +1 -1
- package/dist/widgets/46.js +1 -1
- package/dist/widgets/50.js +1 -1
- package/dist/widgets/546.js +1 -1
- package/dist/widgets/62.js +1 -1
- package/dist/widgets/669.js +1 -1
- package/dist/widgets/733.js +2 -2
- package/dist/widgets/775.js +1 -1
- package/dist/widgets/78.js +1 -1
- package/dist/widgets/__federation_expose_QualityOverview.js +1 -1
- package/dist/widgets/mf-manifest.json +15 -15
- package/dist/widgets/mf-stats.json +15 -15
- package/dist/widgets/remoteEntry.js +3 -3
- package/dist/widgets/remoteEntry.js.map +1 -1
- package/package.json +8 -8
package/dist/widgets/78.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.rspackChunk_kb_labs_quality_entry=self.rspackChunk_kb_labs_quality_entry||[]).push([[78],{453(t,e,s){let r,i,n,a,u,o,h;s.r(e),s.d(e,{CancelledError:()=>Y,HydrationBoundary:()=>t5,InfiniteQueryObserver:()=>tp,IsRestoringProvider:()=>tA,Mutation:()=>ty,MutationCache:()=>tv,MutationObserver:()=>tg,QueriesObserver:()=>tR,Query:()=>ts,QueryCache:()=>tC,QueryClient:()=>tQ,QueryClientContext:()=>tD,QueryClientProvider:()=>tF,QueryErrorResetBoundary:()=>tK,QueryObserver:()=>ta,dataTagErrorSymbol:()=>tP,dataTagSymbol:()=>tw,defaultScheduler:()=>W,defaultShouldDehydrateMutation:()=>_,defaultShouldDehydrateQuery:()=>G,dehydrate:()=>z,environmentManager:()=>K,experimental_streamedQuery:()=>tS,focusManager:()=>l,hashKey:()=>Q,hydrate:()=>B,infiniteQueryOptions:()=>t3,isCancelledError:()=>Z,isServer:()=>p,keepPreviousData:()=>F,matchMutation:()=>R,matchQuery:()=>O,mutationOptions:()=>t6,noop:()=>y,notifyManager:()=>$,onlineManager:()=>J,partialMatchKey:()=>S,queryOptions:()=>t1,replaceEqualDeep:()=>P,shouldThrowError:()=>U,skipToken:()=>A,timeoutManager:()=>f,unsetMarker:()=>tq,useInfiniteQuery:()=>et,useIsFetching:()=>t4,useIsMutating:()=>t2,useIsRestoring:()=>tx,useMutation:()=>t9,useMutationState:()=>t8,usePrefetchInfiniteQuery:()=>t0,usePrefetchQuery:()=>tZ,useQueries:()=>tW,useQuery:()=>tJ,useQueryClient:()=>tI,useQueryErrorResetBoundary:()=>tj,useSuspenseInfiniteQuery:()=>tX,useSuspenseQueries:()=>tY,useSuspenseQuery:()=>tV});var c=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(){}},l=new class extends c{#t;#e;#s;constructor(){super(),this.#s=t=>{if("u">typeof window&&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"}},d={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},f=new class{#r=d;#i=!1;setTimeoutProvider(t){this.#r=t}setTimeout(t,e){return this.#r.setTimeout(t,e)}clearTimeout(t){this.#r.clearTimeout(t)}setInterval(t,e){return this.#r.setInterval(t,e)}clearInterval(t){this.#r.clearInterval(t)}},p="u"<typeof window||"Deno"in globalThis;function y(){}function m(t){return"number"==typeof t&&t>=0&&t!==1/0}function v(t,e){return Math.max(t+(e||0)-Date.now(),0)}function b(t,e){return"function"==typeof t?t(e):t}function g(t,e){return"function"==typeof t?t(e):t}function O(t,e){let{type:s="all",exact:r,fetchStatus:i,predicate:n,queryKey:a,stale:u}=t;if(a){if(r){if(e.queryHash!==C(a,e.options))return!1}else if(!S(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 R(t,e){let{exact:s,status:r,predicate:i,mutationKey:n}=t;if(n){if(!e.options.mutationKey)return!1;if(s){if(Q(e.options.mutationKey)!==Q(n))return!1}else if(!S(e.options.mutationKey,n))return!1}return(!r||e.state.status===r)&&(!i||!!i(e))}function C(t,e){return(e?.queryKeyHashFn||Q)(t)}function Q(t){return JSON.stringify(t,(t,e)=>M(e)?Object.keys(e).sort().reduce((t,s)=>(t[s]=e[s],t),{}):e)}function S(t,e){return t===e||typeof t==typeof e&&!!t&&!!e&&"object"==typeof t&&"object"==typeof e&&Object.keys(e).every(s=>S(t[s],e[s]))}var w=Object.prototype.hasOwnProperty;function P(t,e,s=0){if(t===e)return t;if(s>500)return e;let r=E(t)&&E(e);if(!r&&!(M(t)&&M(e)))return e;let i=(r?t:Object.keys(t)).length,n=r?e:Object.keys(e),a=n.length,u=r?Array(a):{},o=0;for(let h=0;h<a;h++){let a=r?h:n[h],c=t[a],l=e[a];if(c===l){u[a]=c,(r?h<i:w.call(t,a))&&o++;continue}if(null===c||null===l||"object"!=typeof c||"object"!=typeof l){u[a]=l;continue}let d=P(c,l,s+1);u[a]=d,d===c&&o++}return i===a&&o===i?t:u}function q(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 E(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function M(t){if(!D(t))return!1;let e=t.constructor;if(void 0===e)return!0;let s=e.prototype;return!!D(s)&&!!s.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(t)===Object.prototype}function D(t){return"[object Object]"===Object.prototype.toString.call(t)}function I(t,e,s){return"function"==typeof s.structuralSharing?s.structuralSharing(t,e):!1!==s.structuralSharing?P(t,e):e}function F(t){return t}function T(t,e,s=0){let r=[...t,e];return s&&r.length>s?r.slice(1):r}function x(t,e,s=0){let r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}var A=Symbol();function k(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:t.queryFn&&t.queryFn!==A?t.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${t.queryHash}'`))}function U(t,e){return"function"==typeof t?t(...e):!!t}function j(t,e,s){let r,i=!1;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(r??=e(),i||(i=!0,r.aborted?s():r.addEventListener("abort",s,{once:!0})),r)}),t}var K=(r=()=>p,{isServer:()=>r(),setIsServer(t){r=t}});function H(){let t,e,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 L(t){return t}function _(t){return t.state.isPaused}function G(t){return"success"===t.state.status}function N(t){return!0}function z(t,e={}){let s=e.shouldDehydrateMutation??t.getDefaultOptions().dehydrate?.shouldDehydrateMutation??_,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??G,n=e.shouldRedactErrors??t.getDefaultOptions().dehydrate?.shouldRedactErrors??N,a=e.serializeData??t.getDefaultOptions().dehydrate?.serializeData??L;return{mutations:r,queries:t.getQueryCache().getAll().flatMap(t=>{let e;return i(t)?[{dehydratedAt:Date.now(),state:{...t.state,...void 0!==t.state.data&&{data:a(t.state.data)}},queryKey:t.queryKey,queryHash:t.queryHash,..."pending"===t.state.status&&{promise:(e=t.promise?.then(a).catch(t=>n(t)?Promise.reject(Error("redacted")):Promise.reject(t)),e?.catch(y),e)},...t.meta&&{meta:t.meta}}]:[]})}}function B(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??L,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,dehydratedAt:h})=>{let c=o?function(t){let e;if(t.then(t=>(e=t,t),y)?.catch(y),void 0!==e)return{data:e}}(o):void 0,l=void 0===r.data?c?.data:r.data,d=void 0===l?l:n(l),f=i.get(a),p=f?.state.status==="pending",m=f?.state.fetchStatus==="fetching";if(f){let t=c&&void 0!==h&&h>f.state.dataUpdatedAt;if(r.dataUpdatedAt>f.state.dataUpdatedAt||t){let{fetchStatus:t,...e}=r;f.setState({...e,data:d})}}else f=i.build(t,{...t.getDefaultOptions().hydrate?.queries,...s?.defaultOptions?.queries,queryKey:e,queryHash:a,meta:u},{...r,data:d,fetchStatus:"idle",status:void 0!==d?"success":r.status});o&&!p&&!m&&(void 0===h||h>f.state.dataUpdatedAt)&&f.fetch(void 0,{initialPromise:Promise.resolve(o).then(n)}).catch(y)})}var W=function(t){setTimeout(t,0)},$=(i=[],n=0,a=t=>{t()},u=t=>{t()},o=W,{batch:t=>{let e;n++;try{e=t()}finally{let t;--n||(t=i,i=[],t.length&&o(()=>{u(()=>{t.forEach(t=>{a(t)})})}))}return e},batchCalls:t=>(...e)=>{h(()=>{t(...e)})},schedule:h=t=>{n?i.push(t):o(()=>{a(t)})},setNotifyFunction:t=>{a=t},setBatchNotifyFunction:t=>{u=t},setScheduler:t=>{o=t}}),J=new class extends c{#n=!0;#e;#s;constructor(){super(),this.#s=t=>{if("u">typeof window&&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.#n!==t&&(this.#n=t,this.listeners.forEach(e=>{e(t)}))}isOnline(){return this.#n}};function V(t){return Math.min(1e3*2**t,3e4)}function X(t){return(t??"online")!=="online"||J.isOnline()}var Y=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function Z(t){return t instanceof Y}function tt(t){let e,s=!1,r=0,i=H(),n=()=>l.isFocused()&&("always"===t.networkMode||J.isOnline())&&t.canRun(),a=()=>X(t.networkMode)&&t.canRun(),u=t=>{"pending"===i.status&&(e?.(),i.resolve(t))},o=t=>{"pending"===i.status&&(e?.(),i.reject(t))},h=()=>new Promise(s=>{e=t=>{("pending"!==i.status||n())&&s(t)},t.onPause?.()}).then(()=>{e=void 0,"pending"===i.status&&t.onContinue?.()}),c=()=>{let e;if("pending"!==i.status)return;let a=0===r?t.initialPromise:void 0;try{e=a??t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(u).catch(e=>{if("pending"!==i.status)return;let a=t.retry??3*!K.isServer(),u=t.retryDelay??V,l="function"==typeof u?u(r,e):u,d=!0===a||"number"==typeof a&&r<a||"function"==typeof a&&a(r,e);s||!d?o(e):(r++,t.onFail?.(r,e),new Promise(t=>{f.setTimeout(t,l)}).then(()=>n()?void 0:h()).then(()=>{s?o(e):c()}))})};return{promise:i,status:()=>i.status,cancel:e=>{if("pending"===i.status){let s=new Y(e);o(s),t.onCancel?.(s)}},continue:()=>(e?.(),i),cancelRetry:()=>{s=!0},continueRetry:()=>{s=!1},canStart:a,start:()=>(a()?c():h().then(c),i)}}var te=class{#a;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),m(this.gcTime)&&(this.#a=f.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(K.isServer()?1/0:3e5))}clearGcTimeout(){void 0!==this.#a&&(f.clearTimeout(this.#a),this.#a=void 0)}},ts=class extends te{#u;#o;#h;#c;#l;#d;#f;constructor(t){super(),this.#f=!1,this.#d=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#c=t.client,this.#h=this.#c.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#u=tn(this.options),this.state=t.state??this.#u,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#l?.promise}setOptions(t){if(this.options={...this.#d,...t},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let t=tn(this.options);void 0!==t.data&&(this.setState(ti(t.data,t.dataUpdatedAt)),this.#u=t)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#h.remove(this)}setData(t,e){let s=I(this.state.data,t,this.options);return this.#p({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#p({type:"setState",state:t,setStateOptions:e})}cancel(t){let e=this.#l?.promise;return this.#l?.cancel(t),e?e.then(y).catch(y):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#u}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>!1!==g(t.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===A||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(t=>"static"===b(t.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(t=0){return void 0===this.state.data||"static"!==t&&(!!this.state.isInvalidated||!v(this.state.dataUpdatedAt,t))}onFocus(){let t=this.observers.find(t=>t.shouldFetchOnWindowFocus());t?.refetch({cancelRefetch:!1}),this.#l?.continue()}onOnline(){let t=this.observers.find(t=>t.shouldFetchOnReconnect());t?.refetch({cancelRefetch:!1}),this.#l?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#h.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.#l&&(this.#f||this.#y()?this.#l.cancel({revert:!0}):this.#l.cancelRetry()),this.scheduleGc()),this.#h.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}#y(){return"paused"===this.state.fetchStatus&&"pending"===this.state.status}invalidate(){this.state.isInvalidated||this.#p({type:"invalidate"})}async fetch(t,e){let s;if("idle"!==this.state.fetchStatus&&this.#l?.status()!=="rejected"){if(void 0!==this.state.data&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#l)return this.#l.continueRetry(),this.#l.promise}if(t&&this.setOptions(t),!this.options.queryFn){let t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}let r=new AbortController,i=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(this.#f=!0,r.signal)})},n=()=>{let t,s=k(this.options,e),r=(i(t={client:this.#c,queryKey:this.queryKey,meta:this.meta}),t);return(this.#f=!1,this.options.persister)?this.options.persister(s,r,this):s(r)},a=(i(s={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:n}),s);this.options.behavior?.onFetch(a,this),this.#o=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#p({type:"fetch",meta:a.fetchOptions?.meta}),this.#l=tt({initialPromise:e?.initialPromise,fn:a.fetchFn,onCancel:t=>{t instanceof Y&&t.revert&&this.setState({...this.#o,fetchStatus:"idle"}),r.abort()},onFail:(t,e)=>{this.#p({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#p({type:"pause"})},onContinue:()=>{this.#p({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let t=await this.#l.start();if(void 0===t)throw Error(`${this.queryHash} data is undefined`);return this.setData(t),this.#h.config.onSuccess?.(t,this),this.#h.config.onSettled?.(t,this.state.error,this),t}catch(t){if(t instanceof Y){if(t.silent)return this.#l.promise;else if(t.revert){if(void 0===this.state.data)throw t;return this.state.data}}throw this.#p({type:"error",error:t}),this.#h.config.onError?.(t,this),this.#h.config.onSettled?.(this.state.data,t,this),t}finally{this.scheduleGc()}}#p(t){let e=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,...tr(e.data,this.options),fetchMeta:t.meta??null};case"success":let s={...e,...ti(t.data,t.dataUpdatedAt),dataUpdateCount:e.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#o=t.manual?s:void 0,s;case"error":let r=t.error;return{...e,error:r,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}};this.state=e(this.state),$.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#h.notify({query:this,type:"updated",action:t})})}};function tr(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:X(e.networkMode)?"fetching":"paused",...void 0===t&&{error:null,status:"pending"}}}function ti(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function tn(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"}}var ta=class extends c{constructor(t,e){super(),this.options=e,this.#c=t,this.#m=null,this.#v=H(),this.bindMethods(),this.setOptions(e)}#c;#b=void 0;#g=void 0;#O=void 0;#R;#C;#v;#m;#Q;#S;#w;#P;#q;#E;#M=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#b.addObserver(this),tu(this.#b,this.options)?this.#D():this.updateResult(),this.#I())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return to(this.#b,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return to(this.#b,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#F(),this.#T(),this.#b.removeObserver(this)}setOptions(t){let e=this.options,s=this.#b;if(this.options=this.#c.defaultQueryOptions(t),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof g(this.options.enabled,this.#b))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#b.setOptions(this.options),e._defaulted&&!q(this.options,e)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#b,observer:this});let r=this.hasListeners();r&&th(this.#b,s,this.options,e)&&this.#D(),this.updateResult(),r&&(this.#b!==s||g(this.options.enabled,this.#b)!==g(e.enabled,this.#b)||b(this.options.staleTime,this.#b)!==b(e.staleTime,this.#b))&&this.#A();let i=this.#k();r&&(this.#b!==s||g(this.options.enabled,this.#b)!==g(e.enabled,this.#b)||i!==this.#E)&&this.#U(i)}getOptimisticResult(t){var e,s;let r=this.#c.getQueryCache().build(this.#c,t),i=this.createResult(r,t);return e=this,s=i,q(e.getCurrentResult(),s)||(this.#O=i,this.#C=this.options,this.#R=this.#b.state),i}getCurrentResult(){return this.#O}trackResult(t,e){return new Proxy(t,{get:(t,s)=>(this.trackProp(s),e?.(s),"promise"===s&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#v.status||this.#v.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(t,s))})}trackProp(t){this.#M.add(t)}getCurrentQuery(){return this.#b}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#c.defaultQueryOptions(t),s=this.#c.getQueryCache().build(this.#c,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#D({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#O))}#D(t){this.#x();let e=this.#b.fetch(this.options,t);return t?.throwOnError||(e=e.catch(y)),e}#A(){this.#F();let t=b(this.options.staleTime,this.#b);if(K.isServer()||this.#O.isStale||!m(t))return;let e=v(this.#O.dataUpdatedAt,t);this.#P=f.setTimeout(()=>{this.#O.isStale||this.updateResult()},e+1)}#k(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#b):this.options.refetchInterval)??!1}#U(t){this.#T(),this.#E=t,!K.isServer()&&!1!==g(this.options.enabled,this.#b)&&m(this.#E)&&0!==this.#E&&(this.#q=f.setInterval(()=>{(this.options.refetchIntervalInBackground||l.isFocused())&&this.#D()},this.#E))}#I(){this.#A(),this.#U(this.#k())}#F(){void 0!==this.#P&&(f.clearTimeout(this.#P),this.#P=void 0)}#T(){void 0!==this.#q&&(f.clearInterval(this.#q),this.#q=void 0)}createResult(t,e){let s,r=this.#b,i=this.options,n=this.#O,a=this.#R,u=this.#C,o=t!==r?t.state:this.#g,{state:h}=t,c={...h},l=!1;if(e._optimisticResults){let s=this.hasListeners(),n=!s&&tu(t,e),a=s&&th(t,r,e,i);(n||a)&&(c={...c,...tr(h.data,t.options)}),"isRestoring"===e._optimisticResults&&(c.fetchStatus="idle")}let{error:d,errorUpdatedAt:f,status:p}=c;s=c.data;let y=!1;if(void 0!==e.placeholderData&&void 0===s&&"pending"===p){let t;n?.isPlaceholderData&&e.placeholderData===u?.placeholderData?(t=n.data,y=!0):t="function"==typeof e.placeholderData?e.placeholderData(this.#w?.state.data,this.#w):e.placeholderData,void 0!==t&&(p="success",s=I(n?.data,t,e),l=!0)}if(e.select&&void 0!==s&&!y)if(n&&s===a?.data&&e.select===this.#Q)s=this.#S;else try{this.#Q=e.select,s=e.select(s),s=I(n?.data,s,e),this.#S=s,this.#m=null}catch(t){this.#m=t}this.#m&&(d=this.#m,s=this.#S,f=Date.now(),p="error");let m="fetching"===c.fetchStatus,v="pending"===p,b="error"===p,O=v&&m,R=void 0!==s,C={status:p,fetchStatus:c.fetchStatus,isPending:v,isSuccess:"success"===p,isError:b,isInitialLoading:O,isLoading:O,data:s,dataUpdatedAt:c.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:c.dataUpdateCount>o.dataUpdateCount||c.errorUpdateCount>o.errorUpdateCount,isFetching:m,isRefetching:m&&!v,isLoadingError:b&&!R,isPaused:"paused"===c.fetchStatus,isPlaceholderData:l,isRefetchError:b&&R,isStale:tc(t,e),refetch:this.refetch,promise:this.#v,isEnabled:!1!==g(e.enabled,t)};if(this.options.experimental_prefetchInRender){let e=void 0!==C.data,s="error"===C.status&&!e,i=t=>{s?t.reject(C.error):e&&t.resolve(C.data)},n=()=>{i(this.#v=C.promise=H())},a=this.#v;switch(a.status){case"pending":t.queryHash===r.queryHash&&i(a);break;case"fulfilled":(s||C.data!==a.value)&&n();break;case"rejected":s&&C.error===a.reason||n()}}return C}updateResult(){let t=this.#O,e=this.createResult(this.#b,this.options);if(this.#R=this.#b.state,this.#C=this.options,void 0!==this.#R.data&&(this.#w=this.#b),q(e,t))return;this.#O=e;let s=()=>{if(!t)return!0;let{notifyOnChangeProps:e}=this.options,s="function"==typeof e?e():e;if("all"===s||!s&&!this.#M.size)return!0;let r=new Set(s??this.#M);return this.options.throwOnError&&r.add("error"),Object.keys(this.#O).some(e=>this.#O[e]!==t[e]&&r.has(e))};this.#j({listeners:s()})}#x(){let t=this.#c.getQueryCache().build(this.#c,this.options);if(t===this.#b)return;let e=this.#b;this.#b=t,this.#g=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#I()}#j(t){$.batch(()=>{t.listeners&&this.listeners.forEach(t=>{t(this.#O)}),this.#c.getQueryCache().notify({query:this.#b,type:"observerResultsUpdated"})})}};function tu(t,e){return!1!==g(e.enabled,t)&&void 0===t.state.data&&("error"!==t.state.status||!1!==e.retryOnMount)||void 0!==t.state.data&&to(t,e,e.refetchOnMount)}function to(t,e,s){if(!1!==g(e.enabled,t)&&"static"!==b(e.staleTime,t)){let r="function"==typeof s?s(t):s;return"always"===r||!1!==r&&tc(t,e)}return!1}function th(t,e,s,r){return(t!==e||!1===g(r.enabled,t))&&(!s.suspense||"error"!==t.state.status)&&tc(t,s)}function tc(t,e){return!1!==g(e.enabled,t)&&t.isStaleByTime(b(e.staleTime,t))}function tl(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=k(e.options,e.fetchOptions),c=async(t,r,i)=>{let n;if(s)return Promise.reject();if(null==r&&t.pages.length)return Promise.resolve(t);let a=(j(n={client:e.client,queryKey:e.queryKey,pageParam:r,direction:i?"backward":"forward",meta:e.options.meta},()=>e.signal,()=>s=!0),n),u=await h(a),{maxPages:o}=e.options,c=i?x:T;return{pages:c(t.pages,u,o),pageParams:c(t.pageParams,r,o)}};if(i&&n.length){let t="backward"===i,e={pages:n,pageParams:a},s=(t?tf:td)(r,e);u=await c(e,s,t)}else{let e=t??n.length;do{let t=0===o?a[0]??r.initialPageParam:td(r,u);if(o>0&&null==t)break;u=await c(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 td(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 tf(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var tp=class extends ta{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:tl()})}getOptimisticResult(t){return t.behavior=tl(),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!=td(e,s),hasPreviousPage:!!(r=i.data)&&!!e.getPreviousPageParam&&null!=tf(e,r),isFetchNextPageError:l,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:h&&!l&&!f,isRefetching:u&&!d&&!p}}},ty=class extends te{#c;#K;#H;#l;constructor(t){super(),this.#c=t.client,this.mutationId=t.mutationId,this.#H=t.mutationCache,this.#K=[],this.state=t.state||tm(),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.#K.includes(t)||(this.#K.push(t),this.clearGcTimeout(),this.#H.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#K=this.#K.filter(e=>e!==t),this.scheduleGc(),this.#H.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#K.length||("pending"===this.state.status?this.scheduleGc():this.#H.remove(this))}continue(){return this.#l?.continue()??this.execute(this.state.variables)}async execute(t){let e=()=>{this.#p({type:"continue"})},s={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#l=tt({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{this.#p({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#p({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#H.canRun(this)});let r="pending"===this.state.status,i=!this.#l.canStart();try{if(r)e();else{this.#p({type:"pending",variables:t,isPaused:i}),this.#H.config.onMutate&&await this.#H.config.onMutate(t,this,s);let e=await this.options.onMutate?.(t,s);e!==this.state.context&&this.#p({type:"pending",context:e,variables:t,isPaused:i})}let n=await this.#l.start();return await this.#H.config.onSuccess?.(n,t,this.state.context,this,s),await this.options.onSuccess?.(n,t,this.state.context,s),await this.#H.config.onSettled?.(n,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(n,null,t,this.state.context,s),this.#p({type:"success",data:n}),n}catch(e){try{await this.#H.config.onError?.(e,t,this.state.context,this,s)}catch(t){Promise.reject(t)}try{await this.options.onError?.(e,t,this.state.context,s)}catch(t){Promise.reject(t)}try{await this.#H.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this,s)}catch(t){Promise.reject(t)}try{await this.options.onSettled?.(void 0,e,t,this.state.context,s)}catch(t){Promise.reject(t)}throw this.#p({type:"error",error:e}),e}finally{this.#H.runNext(this)}}#p(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),$.batch(()=>{this.#K.forEach(e=>{e.onMutationUpdate(t)}),this.#H.notify({mutation:this,type:"updated",action:t})})}};function tm(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var tv=class extends c{constructor(t={}){super(),this.config=t,this.#L=new Set,this.#_=new Map,this.#G=0}#L;#_;#G;build(t,e,s){let r=new ty({client:t,mutationCache:this,mutationId:++this.#G,options:t.defaultMutationOptions(e),state:s});return this.add(r),r}add(t){this.#L.add(t);let e=tb(t);if("string"==typeof e){let s=this.#_.get(e);s?s.push(t):this.#_.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#L.delete(t)){let e=tb(t);if("string"==typeof e){let s=this.#_.get(e);if(s)if(s.length>1){let e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#_.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=tb(t);if("string"!=typeof e)return!0;{let s=this.#_.get(e),r=s?.find(t=>"pending"===t.state.status);return!r||r===t}}runNext(t){let e=tb(t);if("string"!=typeof e)return Promise.resolve();{let s=this.#_.get(e)?.find(e=>e!==t&&e.state.isPaused);return s?.continue()??Promise.resolve()}}clear(){$.batch(()=>{this.#L.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#L.clear(),this.#_.clear()})}getAll(){return Array.from(this.#L)}find(t){let e={exact:!0,...t};return this.getAll().find(t=>R(e,t))}findAll(t={}){return this.getAll().filter(e=>R(t,e))}notify(t){$.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(t=>t.state.isPaused);return $.batch(()=>Promise.all(t.map(t=>t.continue().catch(y))))}};function tb(t){return t.options.scope?.id}var tg=class extends c{#c;#O=void 0;#N;#z;constructor(t,e){super(),this.#c=t,this.setOptions(e),this.bindMethods(),this.#B()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#c.defaultMutationOptions(t),q(this.options,e)||this.#c.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#N,observer:this}),e?.mutationKey&&this.options.mutationKey&&Q(e.mutationKey)!==Q(this.options.mutationKey)?this.reset():this.#N?.state.status==="pending"&&this.#N.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#N?.removeObserver(this)}onMutationUpdate(t){this.#B(),this.#j(t)}getCurrentResult(){return this.#O}reset(){this.#N?.removeObserver(this),this.#N=void 0,this.#B(),this.#j()}mutate(t,e){return this.#z=e,this.#N?.removeObserver(this),this.#N=this.#c.getMutationCache().build(this.#c,this.options),this.#N.addObserver(this),this.#N.execute(t)}#B(){let t=this.#N?.state??tm();this.#O={...t,isPending:"pending"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset}}#j(t){$.batch(()=>{if(this.#z&&this.hasListeners()){let e=this.#O.variables,s=this.#O.context,r={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#z.onSuccess?.(t.data,e,s,r)}catch(t){Promise.reject(t)}try{this.#z.onSettled?.(t.data,null,e,s,r)}catch(t){Promise.reject(t)}}else if(t?.type==="error"){try{this.#z.onError?.(t.error,e,s,r)}catch(t){Promise.reject(t)}try{this.#z.onSettled?.(void 0,t.error,e,s,r)}catch(t){Promise.reject(t)}}}this.listeners.forEach(t=>{t(this.#O)})})}};function tO(t,e){let s=new Set(e);return t.filter(t=>!s.has(t))}var tR=class extends c{#c;#W;#$;#J;#K;#V;#X;#Y;#Z;#tt=[];constructor(t,e,s){super(),this.#c=t,this.#J=s,this.#$=[],this.#K=[],this.#W=[],this.setQueries(e)}onSubscribe(){1===this.listeners.size&&this.#K.forEach(t=>{t.subscribe(e=>{this.#te(t,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#K.forEach(t=>{t.destroy()})}setQueries(t,e){this.#$=t,this.#J=e,$.batch(()=>{let t=this.#K,e=this.#ts(this.#$);e.forEach(t=>t.observer.setOptions(t.defaultedQueryOptions));let s=e.map(t=>t.observer),r=s.map(t=>t.getCurrentResult()),i=t.length!==s.length,n=s.some((e,s)=>e!==t[s]),a=i||n,u=!!a||r.some((t,e)=>{let s=this.#W[e];return!s||!q(t,s)});(a||u)&&(a&&(this.#tt=e,this.#K=s),this.#W=r,this.hasListeners()&&(a&&(tO(t,s).forEach(t=>{t.destroy()}),tO(s,t).forEach(t=>{t.subscribe(e=>{this.#te(t,e)})})),this.#j()))})}getCurrentResult(){return this.#W}getQueries(){return this.#K.map(t=>t.getCurrentQuery())}getObservers(){return this.#K}getOptimisticResult(t,e){let s=this.#ts(t),r=s.map(t=>t.observer.getOptimisticResult(t.defaultedQueryOptions)),i=s.map(t=>t.defaultedQueryOptions.queryHash);return[r,t=>this.#tr(t??r,e,i),()=>this.#ti(r,s)]}#ti(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)})})})}#tr(t,e,s){if(e){let r=this.#Z,i=void 0!==s&&void 0!==r&&(r.length!==s.length||s.some((t,e)=>t!==r[e]));return(!this.#V||this.#W!==this.#Y||i||e!==this.#X)&&(this.#X=e,this.#Y=this.#W,void 0!==s&&(this.#Z=s),this.#V=P(this.#V,e(t))),this.#V}return t}#ts(t){let e=new Map;this.#K.forEach(t=>{let s=t.options.queryHash;if(!s)return;let r=e.get(s);r?r.push(t):e.set(s,[t])});let s=[];return t.forEach(t=>{let r=this.#c.defaultQueryOptions(t),i=e.get(r.queryHash)?.shift()??new ta(this.#c,r);s.push({defaultedQueryOptions:r,observer:i})}),s}#te(t,e){let s=this.#K.indexOf(t);if(-1!==s){var r;let t;this.#W=(r=this.#W,(t=r.slice(0))[s]=e,t),this.#j()}}#j(){if(this.hasListeners()){let t=this.#V,e=this.#ti(this.#W,this.#tt);t!==this.#tr(e,this.#J?.combine)&&$.batch(()=>{this.listeners.forEach(t=>{t(this.#W)})})}}},tC=class extends c{constructor(t={}){super(),this.config=t,this.#$=new Map}#$;build(t,e,s){let r=e.queryKey,i=e.queryHash??C(r,e),n=this.get(i);return n||(n=new ts({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(n)),n}add(t){this.#$.has(t.queryHash)||(this.#$.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#$.get(t.queryHash);e&&(t.destroy(),e===t&&this.#$.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){$.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#$.get(t)}getAll(){return[...this.#$.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(t=>O(e,t))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(e=>O(t,e)):e}notify(t){$.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){$.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){$.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},tQ=class{#tn;#H;#d;#ta;#tu;#to;#th;#tc;constructor(t={}){this.#tn=t.queryCache||new tC,this.#H=t.mutationCache||new tv,this.#d=t.defaultOptions||{},this.#ta=new Map,this.#tu=new Map,this.#to=0}mount(){this.#to++,1===this.#to&&(this.#th=l.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#tn.onFocus())}),this.#tc=J.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#tn.onOnline())}))}unmount(){this.#to--,0===this.#to&&(this.#th?.(),this.#th=void 0,this.#tc?.(),this.#tc=void 0)}isFetching(t){return this.#tn.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#H.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#tn.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#tn.build(this,e),r=s.state.data;return void 0===r?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(b(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#tn.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){let r=this.defaultQueryOptions({queryKey:t}),i=this.#tn.get(r.queryHash),n=i?.state.data,a="function"==typeof e?e(n):e;if(void 0!==a)return this.#tn.build(this,r).setData(a,{...s,manual:!0})}setQueriesData(t,e,s){return $.batch(()=>this.#tn.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#tn.get(e.queryHash)?.state}removeQueries(t){let e=this.#tn;$.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){let s=this.#tn;return $.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($.batch(()=>this.#tn.findAll(t).map(t=>t.cancel(s)))).then(y).catch(y)}invalidateQueries(t,e={}){return $.batch(()=>(this.#tn.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($.batch(()=>this.#tn.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(y)),"paused"===t.state.fetchStatus?Promise.resolve():e}))).then(y)}fetchQuery(t){let e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);let s=this.#tn.build(this,e);return s.isStaleByTime(b(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(y).catch(y)}fetchInfiniteQuery(t){return t.behavior=tl(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(y).catch(y)}ensureInfiniteQueryData(t){return t.behavior=tl(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return J.isOnline()?this.#H.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#tn}getMutationCache(){return this.#H}getDefaultOptions(){return this.#d}setDefaultOptions(t){this.#d=t}setQueryDefaults(t,e){this.#ta.set(Q(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#ta.values()],s={};return e.forEach(e=>{S(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#tu.set(Q(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#tu.values()],s={};return e.forEach(e=>{S(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#d.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=C(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===A&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#d.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#tn.clear(),this.#H.clear()}};function tS({streamFn:t,refetchMode:e="reset",reducer:s=(t,e)=>T(t,e),initialValue:r=[]}){return async i=>{let n=i.client.getQueryCache().find({queryKey:i.queryKey,exact:!0}),a=!!n&&n.isFetched();a&&"reset"===e&&n.setState({...n.resetState,fetchStatus:"fetching"});let u=r,o=!1,h=j({client:i.client,meta:i.meta,queryKey:i.queryKey,pageParam:i.pageParam,direction:i.direction},()=>i.signal,()=>o=!0),c=await t(h),l=a&&"replace"===e;for await(let t of c){if(o)break;l?u=s(u,t):i.client.setQueryData(i.queryKey,e=>s(void 0===e?r:e,t))}return l&&!o&&i.client.setQueryData(i.queryKey,u),i.client.getQueryData(i.queryKey)??r}}var tw=Symbol("dataTagSymbol"),tP=Symbol("dataTagErrorSymbol"),tq=Symbol("unsetMarker"),tE=s(1913),tM=s(4552),tD=tE.createContext(void 0),tI=t=>{let e=tE.useContext(tD);if(t)return t;if(!e)throw Error("No QueryClient set, use QueryClientProvider to set one");return e},tF=({client:t,children:e})=>(tE.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,tM.jsx)(tD.Provider,{value:t,children:e})),tT=tE.createContext(!1),tx=()=>tE.useContext(tT),tA=tT.Provider;function tk(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var tU=tE.createContext(tk()),tj=()=>tE.useContext(tU),tK=({children:t})=>{let[e]=tE.useState(()=>tk());return(0,tM.jsx)(tU.Provider,{value:e,children:"function"==typeof t?t(e):t})},tH=(t,e,s)=>{let r=s?.state.error&&"function"==typeof t.throwOnError?U(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&!e.isReset()&&(t.retryOnMount=!1)},tL=t=>{tE.useEffect(()=>{t.clearReset()},[t])},t_=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&void 0===t.data||U(s,[t.error,r])),tG=(t,e)=>void 0===e.state.data,tN=t=>{if(t.suspense){let e=t=>"static"===t?t:Math.max(t??1e3,1e3),s=t.staleTime;t.staleTime="function"==typeof s?(...t)=>e(s(...t)):e(s),"number"==typeof t.gcTime&&(t.gcTime=Math.max(t.gcTime,1e3))}},tz=(t,e)=>t?.suspense&&e.isPending,tB=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function tW({queries:t,...e},s){let r=tI(s),i=tx(),n=tj(),a=tE.useMemo(()=>t.map(t=>{let e=r.defaultQueryOptions(t);return e._optimisticResults=i?"isRestoring":"optimistic",e}),[t,r,i]);a.forEach(t=>{tN(t);let e=r.getQueryCache().get(t.queryHash);tH(t,n,e)}),tL(n);let[u]=tE.useState(()=>new tR(r,a,e)),[o,h,c]=u.getOptimisticResult(a,e.combine),l=!i&&!1!==e.subscribed;tE.useSyncExternalStore(tE.useCallback(t=>l?u.subscribe($.batchCalls(t)):y,[u,l]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),tE.useEffect(()=>{u.setQueries(a,e)},[a,e,u]);let d=o.some((t,e)=>tz(a[e],t))?o.flatMap((t,e)=>{let s=a[e];if(s&&tz(s,t)){let t=new ta(r,s);return tB(s,t,n)}return[]}):[];if(d.length>0)throw Promise.all(d);let f=o.find((t,e)=>{let s=a[e];return s&&t_({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 t$(t,e,s){let r=tx(),i=tj(),n=tI(s),a=n.defaultQueryOptions(t);n.getDefaultOptions().queries?._experimental_beforeQuery?.(a);let u=n.getQueryCache().get(a.queryHash);a._optimisticResults=r?"isRestoring":"optimistic",tN(a),tH(a,i,u),tL(i);let o=!n.getQueryCache().get(a.queryHash),[h]=tE.useState(()=>new e(n,a)),c=h.getOptimisticResult(a),l=!r&&!1!==t.subscribed;if(tE.useSyncExternalStore(tE.useCallback(t=>{let e=l?h.subscribe($.batchCalls(t)):y;return h.updateResult(),e},[h,l]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),tE.useEffect(()=>{h.setOptions(a)},[a,h]),tz(a,c))throw tB(a,h,i);if(t_({result:c,errorResetBoundary:i,throwOnError:a.throwOnError,query:u,suspense:a.suspense}))throw c.error;if(n.getDefaultOptions().queries?._experimental_afterQuery?.(a,c),a.experimental_prefetchInRender&&!K.isServer()&&c.isLoading&&c.isFetching&&!r){let t=o?tB(a,h,i):u?.promise;t?.catch(y).finally(()=>{h.updateResult()})}return a.notifyOnChangeProps?c:h.trackResult(c)}function tJ(t,e){return t$(t,ta,e)}function tV(t,e){return t$({...t,enabled:!0,suspense:!0,throwOnError:tG,placeholderData:void 0},ta,e)}function tX(t,e){return t$({...t,enabled:!0,suspense:!0,throwOnError:tG},tp,e)}function tY(t,e){return tW({...t,queries:t.queries.map(t=>({...t,suspense:!0,throwOnError:tG,enabled:!0,placeholderData:void 0}))},e)}function tZ(t,e){let s=tI(e);s.getQueryState(t.queryKey)||s.prefetchQuery(t)}function t0(t,e){let s=tI(e);s.getQueryState(t.queryKey)||s.prefetchInfiniteQuery(t)}function t1(t){return t}function t3(t){return t}var t5=({children:t,options:e={},state:s,queryClient:r})=>{let i=tI(r),n=tE.useRef(e);tE.useEffect(()=>{n.current=e});let a=tE.useMemo(()=>{if(s){if("object"!=typeof s)return;let t=i.getQueryCache(),e=s.queries||[],r=[],a=[];for(let s of e){let e=t.get(s.queryHash);e?(s.state.dataUpdatedAt>e.state.dataUpdatedAt||s.promise&&"pending"!==e.state.status&&"fetching"!==e.state.fetchStatus&&void 0!==s.dehydratedAt&&s.dehydratedAt>e.state.dataUpdatedAt)&&a.push(s):r.push(s)}if(r.length>0&&B(i,{queries:r},n.current),a.length>0)return a}},[i,s]);return tE.useEffect(()=>{a&&B(i,{queries:a},n.current)},[i,a]),t};function t4(t,e){let s=tI(e),r=s.getQueryCache();return tE.useSyncExternalStore(tE.useCallback(t=>r.subscribe($.batchCalls(t)),[r]),()=>s.isFetching(t),()=>s.isFetching(t))}function t2(t,e){let s=tI(e);return t8({filters:{...t,status:"pending"}},s).length}function t7(t,e){return t.findAll(e.filters).map(t=>e.select?e.select(t):t.state)}function t8(t={},e){let s=tI(e).getMutationCache(),r=tE.useRef(t),i=tE.useRef(null);return null===i.current&&(i.current=t7(s,t)),tE.useEffect(()=>{r.current=t}),tE.useSyncExternalStore(tE.useCallback(t=>s.subscribe(()=>{let e=P(i.current,t7(s,r.current));i.current!==e&&(i.current=e,$.schedule(t))}),[s]),()=>i.current,()=>i.current)}function t9(t,e){let s=tI(e),[r]=tE.useState(()=>new tg(s,t));tE.useEffect(()=>{r.setOptions(t)},[r,t]);let i=tE.useSyncExternalStore(tE.useCallback(t=>r.subscribe($.batchCalls(t)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),n=tE.useCallback((t,e)=>{r.mutate(t,e).catch(y)},[r]);if(i.error&&U(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:n,mutateAsync:i.mutate}}function t6(t){return t}function et(t,e){return t$(t,tp,e)}}}]);
|
|
1
|
+
"use strict";(self.rspackChunk_kb_labs_quality_entry=self.rspackChunk_kb_labs_quality_entry||[]).push([[78],{453(t,e,s){let r,i,n,a,u,o,h;s.r(e),s.d(e,{CancelledError:()=>Y,HydrationBoundary:()=>t5,InfiniteQueryObserver:()=>tp,IsRestoringProvider:()=>tA,Mutation:()=>ty,MutationCache:()=>tv,MutationObserver:()=>tg,QueriesObserver:()=>tR,Query:()=>ts,QueryCache:()=>tC,QueryClient:()=>tQ,QueryClientContext:()=>tD,QueryClientProvider:()=>tF,QueryErrorResetBoundary:()=>tK,QueryObserver:()=>ta,dataTagErrorSymbol:()=>tP,dataTagSymbol:()=>tw,defaultScheduler:()=>W,defaultShouldDehydrateMutation:()=>_,defaultShouldDehydrateQuery:()=>G,dehydrate:()=>z,environmentManager:()=>K,experimental_streamedQuery:()=>tS,focusManager:()=>l,hashKey:()=>Q,hydrate:()=>B,infiniteQueryOptions:()=>t3,isCancelledError:()=>Z,isServer:()=>p,keepPreviousData:()=>F,matchMutation:()=>R,matchQuery:()=>O,mutationOptions:()=>t6,noop:()=>y,notifyManager:()=>$,onlineManager:()=>J,partialMatchKey:()=>S,queryOptions:()=>t1,replaceEqualDeep:()=>P,shouldThrowError:()=>U,skipToken:()=>A,timeoutManager:()=>f,unsetMarker:()=>tq,useInfiniteQuery:()=>et,useIsFetching:()=>t4,useIsMutating:()=>t7,useIsRestoring:()=>tx,useMutation:()=>t9,useMutationState:()=>t8,usePrefetchInfiniteQuery:()=>t0,usePrefetchQuery:()=>tZ,useQueries:()=>tW,useQuery:()=>tJ,useQueryClient:()=>tI,useQueryErrorResetBoundary:()=>tj,useSuspenseInfiniteQuery:()=>tX,useSuspenseQueries:()=>tY,useSuspenseQuery:()=>tV});var c=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(){}},l=new class extends c{#t;#e;#s;constructor(){super(),this.#s=t=>{if("u">typeof window&&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"}},d={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},f=new class{#r=d;#i=!1;setTimeoutProvider(t){this.#r=t}setTimeout(t,e){return this.#r.setTimeout(t,e)}clearTimeout(t){this.#r.clearTimeout(t)}setInterval(t,e){return this.#r.setInterval(t,e)}clearInterval(t){this.#r.clearInterval(t)}},p="u"<typeof window||"Deno"in globalThis;function y(){}function m(t){return"number"==typeof t&&t>=0&&t!==1/0}function v(t,e){return Math.max(t+(e||0)-Date.now(),0)}function b(t,e){return"function"==typeof t?t(e):t}function g(t,e){return"function"==typeof t?t(e):t}function O(t,e){let{type:s="all",exact:r,fetchStatus:i,predicate:n,queryKey:a,stale:u}=t;if(a){if(r){if(e.queryHash!==C(a,e.options))return!1}else if(!S(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 R(t,e){let{exact:s,status:r,predicate:i,mutationKey:n}=t;if(n){if(!e.options.mutationKey)return!1;if(s){if(Q(e.options.mutationKey)!==Q(n))return!1}else if(!S(e.options.mutationKey,n))return!1}return(!r||e.state.status===r)&&(!i||!!i(e))}function C(t,e){return(e?.queryKeyHashFn||Q)(t)}function Q(t){return JSON.stringify(t,(t,e)=>M(e)?Object.keys(e).sort().reduce((t,s)=>(t[s]=e[s],t),{}):e)}function S(t,e){return t===e||typeof t==typeof e&&!!t&&!!e&&"object"==typeof t&&"object"==typeof e&&Object.keys(e).every(s=>S(t[s],e[s]))}var w=Object.prototype.hasOwnProperty;function P(t,e,s=0){if(t===e)return t;if(s>500)return e;let r=E(t)&&E(e);if(!r&&!(M(t)&&M(e)))return e;let i=(r?t:Object.keys(t)).length,n=r?e:Object.keys(e),a=n.length,u=r?Array(a):{},o=0;for(let h=0;h<a;h++){let a=r?h:n[h],c=t[a],l=e[a];if(c===l){u[a]=c,(r?h<i:w.call(t,a))&&o++;continue}if(null===c||null===l||"object"!=typeof c||"object"!=typeof l){u[a]=l;continue}let d=P(c,l,s+1);u[a]=d,d===c&&o++}return i===a&&o===i?t:u}function q(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 E(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function M(t){if(!D(t))return!1;let e=t.constructor;if(void 0===e)return!0;let s=e.prototype;return!!D(s)&&!!s.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(t)===Object.prototype}function D(t){return"[object Object]"===Object.prototype.toString.call(t)}function I(t,e,s){return"function"==typeof s.structuralSharing?s.structuralSharing(t,e):!1!==s.structuralSharing?P(t,e):e}function F(t){return t}function T(t,e,s=0){let r=[...t,e];return s&&r.length>s?r.slice(1):r}function x(t,e,s=0){let r=[e,...t];return s&&r.length>s?r.slice(0,-1):r}var A=Symbol();function k(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:t.queryFn&&t.queryFn!==A?t.queryFn:()=>Promise.reject(Error(`Missing queryFn: '${t.queryHash}'`))}function U(t,e){return"function"==typeof t?t(...e):!!t}function j(t,e,s){let r,i=!1;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(r??=e(),i||(i=!0,r.aborted?s():r.addEventListener("abort",s,{once:!0})),r)}),t}var K=(r=()=>p,{isServer:()=>r(),setIsServer(t){r=t}});function H(){let t,e,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 L(t){return t}function _(t){return t.state.isPaused}function G(t){return"success"===t.state.status}function N(t){return!0}function z(t,e={}){let s=e.shouldDehydrateMutation??t.getDefaultOptions().dehydrate?.shouldDehydrateMutation??_,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??G,n=e.shouldRedactErrors??t.getDefaultOptions().dehydrate?.shouldRedactErrors??N,a=e.serializeData??t.getDefaultOptions().dehydrate?.serializeData??L;return{mutations:r,queries:t.getQueryCache().getAll().flatMap(t=>{let e;return i(t)?[{dehydratedAt:Date.now(),state:{...t.state,...void 0!==t.state.data&&{data:a(t.state.data)}},queryKey:t.queryKey,queryHash:t.queryHash,..."pending"===t.state.status&&{promise:(e=t.promise?.then(a).catch(t=>n(t)?Promise.reject(Error("redacted")):Promise.reject(t)),e?.catch(y),e)},...t.meta&&{meta:t.meta}}]:[]})}}function B(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??L,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,dehydratedAt:h})=>{let c=o?function(t){let e;if(t.then(t=>(e=t,t),y)?.catch(y),void 0!==e)return{data:e}}(o):void 0,l=void 0===r.data?c?.data:r.data,d=void 0===l?l:n(l),f=i.get(a),p=f?.state.status==="pending",m=f?.state.fetchStatus==="fetching";if(f){let t=c&&void 0!==h&&h>f.state.dataUpdatedAt;if(r.dataUpdatedAt>f.state.dataUpdatedAt||t){let{fetchStatus:t,...e}=r;f.setState({...e,data:d})}}else f=i.build(t,{...t.getDefaultOptions().hydrate?.queries,...s?.defaultOptions?.queries,queryKey:e,queryHash:a,meta:u},{...r,data:d,fetchStatus:"idle",status:void 0!==d?"success":r.status});o&&!p&&!m&&(void 0===h||h>f.state.dataUpdatedAt)&&f.fetch(void 0,{initialPromise:Promise.resolve(o).then(n)}).catch(y)})}var W=function(t){setTimeout(t,0)},$=(i=[],n=0,a=t=>{t()},u=t=>{t()},o=W,{batch:t=>{let e;n++;try{e=t()}finally{let t;--n||(t=i,i=[],t.length&&o(()=>{u(()=>{t.forEach(t=>{a(t)})})}))}return e},batchCalls:t=>(...e)=>{h(()=>{t(...e)})},schedule:h=t=>{n?i.push(t):o(()=>{a(t)})},setNotifyFunction:t=>{a=t},setBatchNotifyFunction:t=>{u=t},setScheduler:t=>{o=t}}),J=new class extends c{#n=!0;#e;#s;constructor(){super(),this.#s=t=>{if("u">typeof window&&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.#n!==t&&(this.#n=t,this.listeners.forEach(e=>{e(t)}))}isOnline(){return this.#n}};function V(t){return Math.min(1e3*2**t,3e4)}function X(t){return(t??"online")!=="online"||J.isOnline()}var Y=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function Z(t){return t instanceof Y}function tt(t){let e,s=!1,r=0,i=H(),n=()=>l.isFocused()&&("always"===t.networkMode||J.isOnline())&&t.canRun(),a=()=>X(t.networkMode)&&t.canRun(),u=t=>{"pending"===i.status&&(e?.(),i.resolve(t))},o=t=>{"pending"===i.status&&(e?.(),i.reject(t))},h=()=>new Promise(s=>{e=t=>{("pending"!==i.status||n())&&s(t)},t.onPause?.()}).then(()=>{e=void 0,"pending"===i.status&&t.onContinue?.()}),c=()=>{let e;if("pending"!==i.status)return;let a=0===r?t.initialPromise:void 0;try{e=a??t.fn()}catch(t){e=Promise.reject(t)}Promise.resolve(e).then(u).catch(e=>{if("pending"!==i.status)return;let a=t.retry??3*!K.isServer(),u=t.retryDelay??V,l="function"==typeof u?u(r,e):u,d=!0===a||"number"==typeof a&&r<a||"function"==typeof a&&a(r,e);s||!d?o(e):(r++,t.onFail?.(r,e),new Promise(t=>{f.setTimeout(t,l)}).then(()=>n()?void 0:h()).then(()=>{s?o(e):c()}))})};return{promise:i,status:()=>i.status,cancel:e=>{if("pending"===i.status){let s=new Y(e);o(s),t.onCancel?.(s)}},continue:()=>(e?.(),i),cancelRetry:()=>{s=!0},continueRetry:()=>{s=!1},canStart:a,start:()=>(a()?c():h().then(c),i)}}var te=class{#a;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),m(this.gcTime)&&(this.#a=f.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(K.isServer()?1/0:3e5))}clearGcTimeout(){void 0!==this.#a&&(f.clearTimeout(this.#a),this.#a=void 0)}},ts=class extends te{#u;#o;#h;#c;#l;#d;#f;constructor(t){super(),this.#f=!1,this.#d=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#c=t.client,this.#h=this.#c.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#u=tn(this.options),this.state=t.state??this.#u,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#l?.promise}setOptions(t){if(this.options={...this.#d,...t},this.updateGcTime(this.options.gcTime),this.state&&void 0===this.state.data){let t=tn(this.options);void 0!==t.data&&(this.setState(ti(t.data,t.dataUpdatedAt)),this.#u=t)}}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||this.#h.remove(this)}setData(t,e){let s=I(this.state.data,t,this.options);return this.#p({data:s,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),s}setState(t,e){this.#p({type:"setState",state:t,setStateOptions:e})}cancel(t){let e=this.#l?.promise;return this.#l?.cancel(t),e?e.then(y).catch(y):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#u}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>!1!==g(t.options.enabled,this))}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===A||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(t=>"static"===b(t.options.staleTime,this))}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):void 0===this.state.data||this.state.isInvalidated}isStaleByTime(t=0){return void 0===this.state.data||"static"!==t&&(!!this.state.isInvalidated||!v(this.state.dataUpdatedAt,t))}onFocus(){let t=this.observers.find(t=>t.shouldFetchOnWindowFocus());t?.refetch({cancelRefetch:!1}),this.#l?.continue()}onOnline(){let t=this.observers.find(t=>t.shouldFetchOnReconnect());t?.refetch({cancelRefetch:!1}),this.#l?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#h.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.#l&&(this.#f||this.#y()?this.#l.cancel({revert:!0}):this.#l.cancelRetry()),this.scheduleGc()),this.#h.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}#y(){return"paused"===this.state.fetchStatus&&"pending"===this.state.status}invalidate(){this.state.isInvalidated||this.#p({type:"invalidate"})}async fetch(t,e){let s;if("idle"!==this.state.fetchStatus&&this.#l?.status()!=="rejected"){if(void 0!==this.state.data&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#l)return this.#l.continueRetry(),this.#l.promise}if(t&&this.setOptions(t),!this.options.queryFn){let t=this.observers.find(t=>t.options.queryFn);t&&this.setOptions(t.options)}let r=new AbortController,i=t=>{Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(this.#f=!0,r.signal)})},n=()=>{let t,s=k(this.options,e),r=(i(t={client:this.#c,queryKey:this.queryKey,meta:this.meta}),t);return(this.#f=!1,this.options.persister)?this.options.persister(s,r,this):s(r)},a=(i(s={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#c,state:this.state,fetchFn:n}),s);this.options.behavior?.onFetch(a,this),this.#o=this.state,("idle"===this.state.fetchStatus||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#p({type:"fetch",meta:a.fetchOptions?.meta}),this.#l=tt({initialPromise:e?.initialPromise,fn:a.fetchFn,onCancel:t=>{t instanceof Y&&t.revert&&this.setState({...this.#o,fetchStatus:"idle"}),r.abort()},onFail:(t,e)=>{this.#p({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#p({type:"pause"})},onContinue:()=>{this.#p({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let t=await this.#l.start();if(void 0===t)throw Error(`${this.queryHash} data is undefined`);return this.setData(t),this.#h.config.onSuccess?.(t,this),this.#h.config.onSettled?.(t,this.state.error,this),t}catch(t){if(t instanceof Y){if(t.silent)return this.#l.promise;else if(t.revert){if(void 0===this.state.data)throw t;return this.state.data}}throw this.#p({type:"error",error:t}),this.#h.config.onError?.(t,this),this.#h.config.onSettled?.(this.state.data,t,this),t}finally{this.scheduleGc()}}#p(t){let e=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,...tr(e.data,this.options),fetchMeta:t.meta??null};case"success":let s={...e,...ti(t.data,t.dataUpdatedAt),dataUpdateCount:e.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#o=t.manual?s:void 0,s;case"error":let r=t.error;return{...e,error:r,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}};this.state=e(this.state),$.batch(()=>{this.observers.forEach(t=>{t.onQueryUpdate()}),this.#h.notify({query:this,type:"updated",action:t})})}};function tr(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:X(e.networkMode)?"fetching":"paused",...void 0===t&&{error:null,status:"pending"}}}function ti(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function tn(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"}}var ta=class extends c{constructor(t,e){super(),this.options=e,this.#c=t,this.#m=null,this.#v=H(),this.bindMethods(),this.setOptions(e)}#c;#b=void 0;#g=void 0;#O=void 0;#R;#C;#v;#m;#Q;#S;#w;#P;#q;#E;#M=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#b.addObserver(this),tu(this.#b,this.options)?this.#D():this.updateResult(),this.#I())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return to(this.#b,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return to(this.#b,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#F(),this.#T(),this.#b.removeObserver(this)}setOptions(t){let e=this.options,s=this.#b;if(this.options=this.#c.defaultQueryOptions(t),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof g(this.options.enabled,this.#b))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#b.setOptions(this.options),e._defaulted&&!q(this.options,e)&&this.#c.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#b,observer:this});let r=this.hasListeners();r&&th(this.#b,s,this.options,e)&&this.#D(),this.updateResult(),r&&(this.#b!==s||g(this.options.enabled,this.#b)!==g(e.enabled,this.#b)||b(this.options.staleTime,this.#b)!==b(e.staleTime,this.#b))&&this.#A();let i=this.#k();r&&(this.#b!==s||g(this.options.enabled,this.#b)!==g(e.enabled,this.#b)||i!==this.#E)&&this.#U(i)}getOptimisticResult(t){var e,s;let r=this.#c.getQueryCache().build(this.#c,t),i=this.createResult(r,t);return e=this,s=i,q(e.getCurrentResult(),s)||(this.#O=i,this.#C=this.options,this.#R=this.#b.state),i}getCurrentResult(){return this.#O}trackResult(t,e){return new Proxy(t,{get:(t,s)=>(this.trackProp(s),e?.(s),"promise"===s&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#v.status||this.#v.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(t,s))})}trackProp(t){this.#M.add(t)}getCurrentQuery(){return this.#b}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){let e=this.#c.defaultQueryOptions(t),s=this.#c.getQueryCache().build(this.#c,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#D({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#O))}#D(t){this.#x();let e=this.#b.fetch(this.options,t);return t?.throwOnError||(e=e.catch(y)),e}#A(){this.#F();let t=b(this.options.staleTime,this.#b);if(K.isServer()||this.#O.isStale||!m(t))return;let e=v(this.#O.dataUpdatedAt,t);this.#P=f.setTimeout(()=>{this.#O.isStale||this.updateResult()},e+1)}#k(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#b):this.options.refetchInterval)??!1}#U(t){this.#T(),this.#E=t,!K.isServer()&&!1!==g(this.options.enabled,this.#b)&&m(this.#E)&&0!==this.#E&&(this.#q=f.setInterval(()=>{(this.options.refetchIntervalInBackground||l.isFocused())&&this.#D()},this.#E))}#I(){this.#A(),this.#U(this.#k())}#F(){void 0!==this.#P&&(f.clearTimeout(this.#P),this.#P=void 0)}#T(){void 0!==this.#q&&(f.clearInterval(this.#q),this.#q=void 0)}createResult(t,e){let s,r=this.#b,i=this.options,n=this.#O,a=this.#R,u=this.#C,o=t!==r?t.state:this.#g,{state:h}=t,c={...h},l=!1;if(e._optimisticResults){let s=this.hasListeners(),n=!s&&tu(t,e),a=s&&th(t,r,e,i);(n||a)&&(c={...c,...tr(h.data,t.options)}),"isRestoring"===e._optimisticResults&&(c.fetchStatus="idle")}let{error:d,errorUpdatedAt:f,status:p}=c;s=c.data;let y=!1;if(void 0!==e.placeholderData&&void 0===s&&"pending"===p){let t;n?.isPlaceholderData&&e.placeholderData===u?.placeholderData?(t=n.data,y=!0):t="function"==typeof e.placeholderData?e.placeholderData(this.#w?.state.data,this.#w):e.placeholderData,void 0!==t&&(p="success",s=I(n?.data,t,e),l=!0)}if(e.select&&void 0!==s&&!y)if(n&&s===a?.data&&e.select===this.#Q)s=this.#S;else try{this.#Q=e.select,s=e.select(s),s=I(n?.data,s,e),this.#S=s,this.#m=null}catch(t){this.#m=t}this.#m&&(d=this.#m,s=this.#S,f=Date.now(),p="error");let m="fetching"===c.fetchStatus,v="pending"===p,b="error"===p,O=v&&m,R=void 0!==s,C={status:p,fetchStatus:c.fetchStatus,isPending:v,isSuccess:"success"===p,isError:b,isInitialLoading:O,isLoading:O,data:s,dataUpdatedAt:c.dataUpdatedAt,error:d,errorUpdatedAt:f,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:c.dataUpdateCount>o.dataUpdateCount||c.errorUpdateCount>o.errorUpdateCount,isFetching:m,isRefetching:m&&!v,isLoadingError:b&&!R,isPaused:"paused"===c.fetchStatus,isPlaceholderData:l,isRefetchError:b&&R,isStale:tc(t,e),refetch:this.refetch,promise:this.#v,isEnabled:!1!==g(e.enabled,t)};if(this.options.experimental_prefetchInRender){let e=void 0!==C.data,s="error"===C.status&&!e,i=t=>{s?t.reject(C.error):e&&t.resolve(C.data)},n=()=>{i(this.#v=C.promise=H())},a=this.#v;switch(a.status){case"pending":t.queryHash===r.queryHash&&i(a);break;case"fulfilled":(s||C.data!==a.value)&&n();break;case"rejected":s&&C.error===a.reason||n()}}return C}updateResult(){let t=this.#O,e=this.createResult(this.#b,this.options);if(this.#R=this.#b.state,this.#C=this.options,void 0!==this.#R.data&&(this.#w=this.#b),q(e,t))return;this.#O=e;let s=()=>{if(!t)return!0;let{notifyOnChangeProps:e}=this.options,s="function"==typeof e?e():e;if("all"===s||!s&&!this.#M.size)return!0;let r=new Set(s??this.#M);return this.options.throwOnError&&r.add("error"),Object.keys(this.#O).some(e=>this.#O[e]!==t[e]&&r.has(e))};this.#j({listeners:s()})}#x(){let t=this.#c.getQueryCache().build(this.#c,this.options);if(t===this.#b)return;let e=this.#b;this.#b=t,this.#g=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#I()}#j(t){$.batch(()=>{t.listeners&&this.listeners.forEach(t=>{t(this.#O)}),this.#c.getQueryCache().notify({query:this.#b,type:"observerResultsUpdated"})})}};function tu(t,e){return!1!==g(e.enabled,t)&&void 0===t.state.data&&("error"!==t.state.status||!1!==e.retryOnMount)||void 0!==t.state.data&&to(t,e,e.refetchOnMount)}function to(t,e,s){if(!1!==g(e.enabled,t)&&"static"!==b(e.staleTime,t)){let r="function"==typeof s?s(t):s;return"always"===r||!1!==r&&tc(t,e)}return!1}function th(t,e,s,r){return(t!==e||!1===g(r.enabled,t))&&(!s.suspense||"error"!==t.state.status)&&tc(t,s)}function tc(t,e){return!1!==g(e.enabled,t)&&t.isStaleByTime(b(e.staleTime,t))}function tl(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=k(e.options,e.fetchOptions),c=async(t,r,i)=>{let n;if(s)return Promise.reject();if(null==r&&t.pages.length)return Promise.resolve(t);let a=(j(n={client:e.client,queryKey:e.queryKey,pageParam:r,direction:i?"backward":"forward",meta:e.options.meta},()=>e.signal,()=>s=!0),n),u=await h(a),{maxPages:o}=e.options,c=i?x:T;return{pages:c(t.pages,u,o),pageParams:c(t.pageParams,r,o)}};if(i&&n.length){let t="backward"===i,e={pages:n,pageParams:a},s=(t?tf:td)(r,e);u=await c(e,s,t)}else{let e=t??n.length;do{let t=0===o?a[0]??r.initialPageParam:td(r,u);if(o>0&&null==t)break;u=await c(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 td(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 tf(t,{pages:e,pageParams:s}){return e.length>0?t.getPreviousPageParam?.(e[0],e,s[0],s):void 0}var tp=class extends ta{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:tl()})}getOptimisticResult(t){return t.behavior=tl(),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!=td(e,s),hasPreviousPage:!!(r=i.data)&&!!e.getPreviousPageParam&&null!=tf(e,r),isFetchNextPageError:l,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:h&&!l&&!f,isRefetching:u&&!d&&!p}}},ty=class extends te{#c;#K;#H;#l;constructor(t){super(),this.#c=t.client,this.mutationId=t.mutationId,this.#H=t.mutationCache,this.#K=[],this.state=t.state||tm(),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.#K.includes(t)||(this.#K.push(t),this.clearGcTimeout(),this.#H.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#K=this.#K.filter(e=>e!==t),this.scheduleGc(),this.#H.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#K.length||("pending"===this.state.status?this.scheduleGc():this.#H.remove(this))}continue(){return this.#l?.continue()??this.execute(this.state.variables)}async execute(t){let e=()=>{this.#p({type:"continue"})},s={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#l=tt({fn:()=>this.options.mutationFn?this.options.mutationFn(t,s):Promise.reject(Error("No mutationFn found")),onFail:(t,e)=>{this.#p({type:"failed",failureCount:t,error:e})},onPause:()=>{this.#p({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#H.canRun(this)});let r="pending"===this.state.status,i=!this.#l.canStart();try{if(r)e();else{this.#p({type:"pending",variables:t,isPaused:i}),this.#H.config.onMutate&&await this.#H.config.onMutate(t,this,s);let e=await this.options.onMutate?.(t,s);e!==this.state.context&&this.#p({type:"pending",context:e,variables:t,isPaused:i})}let n=await this.#l.start();return await this.#H.config.onSuccess?.(n,t,this.state.context,this,s),await this.options.onSuccess?.(n,t,this.state.context,s),await this.#H.config.onSettled?.(n,null,this.state.variables,this.state.context,this,s),await this.options.onSettled?.(n,null,t,this.state.context,s),this.#p({type:"success",data:n}),n}catch(e){try{await this.#H.config.onError?.(e,t,this.state.context,this,s)}catch(t){Promise.reject(t)}try{await this.options.onError?.(e,t,this.state.context,s)}catch(t){Promise.reject(t)}try{await this.#H.config.onSettled?.(void 0,e,this.state.variables,this.state.context,this,s)}catch(t){Promise.reject(t)}try{await this.options.onSettled?.(void 0,e,t,this.state.context,s)}catch(t){Promise.reject(t)}throw this.#p({type:"error",error:e}),e}finally{this.#H.runNext(this)}}#p(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),$.batch(()=>{this.#K.forEach(e=>{e.onMutationUpdate(t)}),this.#H.notify({mutation:this,type:"updated",action:t})})}};function tm(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var tv=class extends c{constructor(t={}){super(),this.config=t,this.#L=new Set,this.#_=new Map,this.#G=0}#L;#_;#G;build(t,e,s){let r=new ty({client:t,mutationCache:this,mutationId:++this.#G,options:t.defaultMutationOptions(e),state:s});return this.add(r),r}add(t){this.#L.add(t);let e=tb(t);if("string"==typeof e){let s=this.#_.get(e);s?s.push(t):this.#_.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#L.delete(t)){let e=tb(t);if("string"==typeof e){let s=this.#_.get(e);if(s)if(s.length>1){let e=s.indexOf(t);-1!==e&&s.splice(e,1)}else s[0]===t&&this.#_.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){let e=tb(t);if("string"!=typeof e)return!0;{let s=this.#_.get(e),r=s?.find(t=>"pending"===t.state.status);return!r||r===t}}runNext(t){let e=tb(t);if("string"!=typeof e)return Promise.resolve();{let s=this.#_.get(e)?.find(e=>e!==t&&e.state.isPaused);return s?.continue()??Promise.resolve()}}clear(){$.batch(()=>{this.#L.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#L.clear(),this.#_.clear()})}getAll(){return Array.from(this.#L)}find(t){let e={exact:!0,...t};return this.getAll().find(t=>R(e,t))}findAll(t={}){return this.getAll().filter(e=>R(t,e))}notify(t){$.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){let t=this.getAll().filter(t=>t.state.isPaused);return $.batch(()=>Promise.all(t.map(t=>t.continue().catch(y))))}};function tb(t){return t.options.scope?.id}var tg=class extends c{#c;#O=void 0;#N;#z;constructor(t,e){super(),this.#c=t,this.setOptions(e),this.bindMethods(),this.#B()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){let e=this.options;this.options=this.#c.defaultMutationOptions(t),q(this.options,e)||this.#c.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#N,observer:this}),e?.mutationKey&&this.options.mutationKey&&Q(e.mutationKey)!==Q(this.options.mutationKey)?this.reset():this.#N?.state.status==="pending"&&this.#N.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#N?.removeObserver(this)}onMutationUpdate(t){this.#B(),this.#j(t)}getCurrentResult(){return this.#O}reset(){this.#N?.removeObserver(this),this.#N=void 0,this.#B(),this.#j()}mutate(t,e){return this.#z=e,this.#N?.removeObserver(this),this.#N=this.#c.getMutationCache().build(this.#c,this.options),this.#N.addObserver(this),this.#N.execute(t)}#B(){let t=this.#N?.state??tm();this.#O={...t,isPending:"pending"===t.status,isSuccess:"success"===t.status,isError:"error"===t.status,isIdle:"idle"===t.status,mutate:this.mutate,reset:this.reset}}#j(t){$.batch(()=>{if(this.#z&&this.hasListeners()){let e=this.#O.variables,s=this.#O.context,r={client:this.#c,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#z.onSuccess?.(t.data,e,s,r)}catch(t){Promise.reject(t)}try{this.#z.onSettled?.(t.data,null,e,s,r)}catch(t){Promise.reject(t)}}else if(t?.type==="error"){try{this.#z.onError?.(t.error,e,s,r)}catch(t){Promise.reject(t)}try{this.#z.onSettled?.(void 0,t.error,e,s,r)}catch(t){Promise.reject(t)}}}this.listeners.forEach(t=>{t(this.#O)})})}};function tO(t,e){let s=new Set(e);return t.filter(t=>!s.has(t))}var tR=class extends c{#c;#W;#$;#J;#K;#V;#X;#Y;#Z;#tt=[];constructor(t,e,s){super(),this.#c=t,this.#J=s,this.#$=[],this.#K=[],this.#W=[],this.setQueries(e)}onSubscribe(){1===this.listeners.size&&this.#K.forEach(t=>{t.subscribe(e=>{this.#te(t,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#K.forEach(t=>{t.destroy()})}setQueries(t,e){this.#$=t,this.#J=e,$.batch(()=>{let t=this.#K,e=this.#ts(this.#$);e.forEach(t=>t.observer.setOptions(t.defaultedQueryOptions));let s=e.map(t=>t.observer),r=s.map(t=>t.getCurrentResult()),i=t.length!==s.length,n=s.some((e,s)=>e!==t[s]),a=i||n,u=!!a||r.some((t,e)=>{let s=this.#W[e];return!s||!q(t,s)});(a||u)&&(a&&(this.#tt=e,this.#K=s),this.#W=r,this.hasListeners()&&(a&&(tO(t,s).forEach(t=>{t.destroy()}),tO(s,t).forEach(t=>{t.subscribe(e=>{this.#te(t,e)})})),this.#j()))})}getCurrentResult(){return this.#W}getQueries(){return this.#K.map(t=>t.getCurrentQuery())}getObservers(){return this.#K}getOptimisticResult(t,e){let s=this.#ts(t),r=s.map(t=>t.observer.getOptimisticResult(t.defaultedQueryOptions)),i=s.map(t=>t.defaultedQueryOptions.queryHash);return[r,t=>this.#tr(t??r,e,i),()=>this.#ti(r,s)]}#ti(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)})})})}#tr(t,e,s){if(e){let r=this.#Z,i=void 0!==s&&void 0!==r&&(r.length!==s.length||s.some((t,e)=>t!==r[e]));return(!this.#V||this.#W!==this.#Y||i||e!==this.#X)&&(this.#X=e,this.#Y=this.#W,void 0!==s&&(this.#Z=s),this.#V=P(this.#V,e(t))),this.#V}return t}#ts(t){let e=new Map;this.#K.forEach(t=>{let s=t.options.queryHash;if(!s)return;let r=e.get(s);r?r.push(t):e.set(s,[t])});let s=[];return t.forEach(t=>{let r=this.#c.defaultQueryOptions(t),i=e.get(r.queryHash)?.shift()??new ta(this.#c,r);s.push({defaultedQueryOptions:r,observer:i})}),s}#te(t,e){let s=this.#K.indexOf(t);if(-1!==s){var r;let t;this.#W=(r=this.#W,(t=r.slice(0))[s]=e,t),this.#j()}}#j(){if(this.hasListeners()){let t=this.#V,e=this.#ti(this.#W,this.#tt);t!==this.#tr(e,this.#J?.combine)&&$.batch(()=>{this.listeners.forEach(t=>{t(this.#W)})})}}},tC=class extends c{constructor(t={}){super(),this.config=t,this.#$=new Map}#$;build(t,e,s){let r=e.queryKey,i=e.queryHash??C(r,e),n=this.get(i);return n||(n=new ts({client:t,queryKey:r,queryHash:i,options:t.defaultQueryOptions(e),state:s,defaultOptions:t.getQueryDefaults(r)}),this.add(n)),n}add(t){this.#$.has(t.queryHash)||(this.#$.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){let e=this.#$.get(t.queryHash);e&&(t.destroy(),e===t&&this.#$.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){$.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#$.get(t)}getAll(){return[...this.#$.values()]}find(t){let e={exact:!0,...t};return this.getAll().find(t=>O(e,t))}findAll(t={}){let e=this.getAll();return Object.keys(t).length>0?e.filter(e=>O(t,e)):e}notify(t){$.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){$.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){$.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},tQ=class{#tn;#H;#d;#ta;#tu;#to;#th;#tc;constructor(t={}){this.#tn=t.queryCache||new tC,this.#H=t.mutationCache||new tv,this.#d=t.defaultOptions||{},this.#ta=new Map,this.#tu=new Map,this.#to=0}mount(){this.#to++,1===this.#to&&(this.#th=l.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#tn.onFocus())}),this.#tc=J.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#tn.onOnline())}))}unmount(){this.#to--,0===this.#to&&(this.#th?.(),this.#th=void 0,this.#tc?.(),this.#tc=void 0)}isFetching(t){return this.#tn.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#H.findAll({...t,status:"pending"}).length}getQueryData(t){let e=this.defaultQueryOptions({queryKey:t});return this.#tn.get(e.queryHash)?.state.data}ensureQueryData(t){let e=this.defaultQueryOptions(t),s=this.#tn.build(this,e),r=s.state.data;return void 0===r?this.fetchQuery(t):(t.revalidateIfStale&&s.isStaleByTime(b(e.staleTime,s))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return this.#tn.findAll(t).map(({queryKey:t,state:e})=>[t,e.data])}setQueryData(t,e,s){let r=this.defaultQueryOptions({queryKey:t}),i=this.#tn.get(r.queryHash),n=i?.state.data,a="function"==typeof e?e(n):e;if(void 0!==a)return this.#tn.build(this,r).setData(a,{...s,manual:!0})}setQueriesData(t,e,s){return $.batch(()=>this.#tn.findAll(t).map(({queryKey:t})=>[t,this.setQueryData(t,e,s)]))}getQueryState(t){let e=this.defaultQueryOptions({queryKey:t});return this.#tn.get(e.queryHash)?.state}removeQueries(t){let e=this.#tn;$.batch(()=>{e.findAll(t).forEach(t=>{e.remove(t)})})}resetQueries(t,e){let s=this.#tn;return $.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($.batch(()=>this.#tn.findAll(t).map(t=>t.cancel(s)))).then(y).catch(y)}invalidateQueries(t,e={}){return $.batch(()=>(this.#tn.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($.batch(()=>this.#tn.findAll(t).filter(t=>!t.isDisabled()&&!t.isStatic()).map(t=>{let e=t.fetch(void 0,s);return s.throwOnError||(e=e.catch(y)),"paused"===t.state.fetchStatus?Promise.resolve():e}))).then(y)}fetchQuery(t){let e=this.defaultQueryOptions(t);void 0===e.retry&&(e.retry=!1);let s=this.#tn.build(this,e);return s.isStaleByTime(b(e.staleTime,s))?s.fetch(e):Promise.resolve(s.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(y).catch(y)}fetchInfiniteQuery(t){return t.behavior=tl(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(y).catch(y)}ensureInfiniteQueryData(t){return t.behavior=tl(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return J.isOnline()?this.#H.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#tn}getMutationCache(){return this.#H}getDefaultOptions(){return this.#d}setDefaultOptions(t){this.#d=t}setQueryDefaults(t,e){this.#ta.set(Q(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){let e=[...this.#ta.values()],s={};return e.forEach(e=>{S(t,e.queryKey)&&Object.assign(s,e.defaultOptions)}),s}setMutationDefaults(t,e){this.#tu.set(Q(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){let e=[...this.#tu.values()],s={};return e.forEach(e=>{S(t,e.mutationKey)&&Object.assign(s,e.defaultOptions)}),s}defaultQueryOptions(t){if(t._defaulted)return t;let e={...this.#d.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=C(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===A&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#d.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#tn.clear(),this.#H.clear()}};function tS({streamFn:t,refetchMode:e="reset",reducer:s=(t,e)=>T(t,e),initialValue:r=[]}){return async i=>{let n=i.client.getQueryCache().find({queryKey:i.queryKey,exact:!0}),a=!!n&&n.isFetched();a&&"reset"===e&&n.setState({...n.resetState,fetchStatus:"fetching"});let u=r,o=!1,h=j({client:i.client,meta:i.meta,queryKey:i.queryKey,pageParam:i.pageParam,direction:i.direction},()=>i.signal,()=>o=!0),c=await t(h),l=a&&"replace"===e;for await(let t of c){if(o)break;l?u=s(u,t):i.client.setQueryData(i.queryKey,e=>s(void 0===e?r:e,t))}return l&&!o&&i.client.setQueryData(i.queryKey,u),i.client.getQueryData(i.queryKey)??r}}var tw=Symbol("dataTagSymbol"),tP=Symbol("dataTagErrorSymbol"),tq=Symbol("unsetMarker"),tE=s(7079),tM=s(4552),tD=tE.createContext(void 0),tI=t=>{let e=tE.useContext(tD);if(t)return t;if(!e)throw Error("No QueryClient set, use QueryClientProvider to set one");return e},tF=({client:t,children:e})=>(tE.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,tM.jsx)(tD.Provider,{value:t,children:e})),tT=tE.createContext(!1),tx=()=>tE.useContext(tT),tA=tT.Provider;function tk(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var tU=tE.createContext(tk()),tj=()=>tE.useContext(tU),tK=({children:t})=>{let[e]=tE.useState(()=>tk());return(0,tM.jsx)(tU.Provider,{value:e,children:"function"==typeof t?t(e):t})},tH=(t,e,s)=>{let r=s?.state.error&&"function"==typeof t.throwOnError?U(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&!e.isReset()&&(t.retryOnMount=!1)},tL=t=>{tE.useEffect(()=>{t.clearReset()},[t])},t_=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&void 0===t.data||U(s,[t.error,r])),tG=(t,e)=>void 0===e.state.data,tN=t=>{if(t.suspense){let e=t=>"static"===t?t:Math.max(t??1e3,1e3),s=t.staleTime;t.staleTime="function"==typeof s?(...t)=>e(s(...t)):e(s),"number"==typeof t.gcTime&&(t.gcTime=Math.max(t.gcTime,1e3))}},tz=(t,e)=>t?.suspense&&e.isPending,tB=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function tW({queries:t,...e},s){let r=tI(s),i=tx(),n=tj(),a=tE.useMemo(()=>t.map(t=>{let e=r.defaultQueryOptions(t);return e._optimisticResults=i?"isRestoring":"optimistic",e}),[t,r,i]);a.forEach(t=>{tN(t);let e=r.getQueryCache().get(t.queryHash);tH(t,n,e)}),tL(n);let[u]=tE.useState(()=>new tR(r,a,e)),[o,h,c]=u.getOptimisticResult(a,e.combine),l=!i&&!1!==e.subscribed;tE.useSyncExternalStore(tE.useCallback(t=>l?u.subscribe($.batchCalls(t)):y,[u,l]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),tE.useEffect(()=>{u.setQueries(a,e)},[a,e,u]);let d=o.some((t,e)=>tz(a[e],t))?o.flatMap((t,e)=>{let s=a[e];if(s&&tz(s,t)){let t=new ta(r,s);return tB(s,t,n)}return[]}):[];if(d.length>0)throw Promise.all(d);let f=o.find((t,e)=>{let s=a[e];return s&&t_({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 t$(t,e,s){let r=tx(),i=tj(),n=tI(s),a=n.defaultQueryOptions(t);n.getDefaultOptions().queries?._experimental_beforeQuery?.(a);let u=n.getQueryCache().get(a.queryHash);a._optimisticResults=r?"isRestoring":"optimistic",tN(a),tH(a,i,u),tL(i);let o=!n.getQueryCache().get(a.queryHash),[h]=tE.useState(()=>new e(n,a)),c=h.getOptimisticResult(a),l=!r&&!1!==t.subscribed;if(tE.useSyncExternalStore(tE.useCallback(t=>{let e=l?h.subscribe($.batchCalls(t)):y;return h.updateResult(),e},[h,l]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),tE.useEffect(()=>{h.setOptions(a)},[a,h]),tz(a,c))throw tB(a,h,i);if(t_({result:c,errorResetBoundary:i,throwOnError:a.throwOnError,query:u,suspense:a.suspense}))throw c.error;if(n.getDefaultOptions().queries?._experimental_afterQuery?.(a,c),a.experimental_prefetchInRender&&!K.isServer()&&c.isLoading&&c.isFetching&&!r){let t=o?tB(a,h,i):u?.promise;t?.catch(y).finally(()=>{h.updateResult()})}return a.notifyOnChangeProps?c:h.trackResult(c)}function tJ(t,e){return t$(t,ta,e)}function tV(t,e){return t$({...t,enabled:!0,suspense:!0,throwOnError:tG,placeholderData:void 0},ta,e)}function tX(t,e){return t$({...t,enabled:!0,suspense:!0,throwOnError:tG},tp,e)}function tY(t,e){return tW({...t,queries:t.queries.map(t=>({...t,suspense:!0,throwOnError:tG,enabled:!0,placeholderData:void 0}))},e)}function tZ(t,e){let s=tI(e);s.getQueryState(t.queryKey)||s.prefetchQuery(t)}function t0(t,e){let s=tI(e);s.getQueryState(t.queryKey)||s.prefetchInfiniteQuery(t)}function t1(t){return t}function t3(t){return t}var t5=({children:t,options:e={},state:s,queryClient:r})=>{let i=tI(r),n=tE.useRef(e);tE.useEffect(()=>{n.current=e});let a=tE.useMemo(()=>{if(s){if("object"!=typeof s)return;let t=i.getQueryCache(),e=s.queries||[],r=[],a=[];for(let s of e){let e=t.get(s.queryHash);e?(s.state.dataUpdatedAt>e.state.dataUpdatedAt||s.promise&&"pending"!==e.state.status&&"fetching"!==e.state.fetchStatus&&void 0!==s.dehydratedAt&&s.dehydratedAt>e.state.dataUpdatedAt)&&a.push(s):r.push(s)}if(r.length>0&&B(i,{queries:r},n.current),a.length>0)return a}},[i,s]);return tE.useEffect(()=>{a&&B(i,{queries:a},n.current)},[i,a]),t};function t4(t,e){let s=tI(e),r=s.getQueryCache();return tE.useSyncExternalStore(tE.useCallback(t=>r.subscribe($.batchCalls(t)),[r]),()=>s.isFetching(t),()=>s.isFetching(t))}function t7(t,e){let s=tI(e);return t8({filters:{...t,status:"pending"}},s).length}function t2(t,e){return t.findAll(e.filters).map(t=>e.select?e.select(t):t.state)}function t8(t={},e){let s=tI(e).getMutationCache(),r=tE.useRef(t),i=tE.useRef(null);return null===i.current&&(i.current=t2(s,t)),tE.useEffect(()=>{r.current=t}),tE.useSyncExternalStore(tE.useCallback(t=>s.subscribe(()=>{let e=P(i.current,t2(s,r.current));i.current!==e&&(i.current=e,$.schedule(t))}),[s]),()=>i.current,()=>i.current)}function t9(t,e){let s=tI(e),[r]=tE.useState(()=>new tg(s,t));tE.useEffect(()=>{r.setOptions(t)},[r,t]);let i=tE.useSyncExternalStore(tE.useCallback(t=>r.subscribe($.batchCalls(t)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),n=tE.useCallback((t,e)=>{r.mutate(t,e).catch(y)},[r]);if(i.error&&U(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:n,mutateAsync:i.mutate}}function t6(t){return t}function et(t,e){return t$(t,tp,e)}}}]);
|
|
2
2
|
//# sourceMappingURL=78.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";(self.rspackChunk_kb_labs_quality_entry=self.rspackChunk_kb_labs_quality_entry||[]).push([[15],{6026(e,n){var t=Symbol.for("react.transitional.element");function l(e,n,l){var i=null;if(void 0!==l&&(i=""+l),void 0!==n.key&&(i=""+n.key),"key"in n)for(var r in l={},n)"key"!==r&&(l[r]=n[r]);else l=n;return{$$typeof:t,type:e,key:i,ref:void 0!==(n=l.ref)?n:null,props:l}}n.Fragment=Symbol.for("react.fragment"),n.jsx=l,n.jsxs=l},4552(e,n,t){e.exports=t(6026)},9586(e,n,t){t.r(n),t.d(n,{default:()=>S});var l=t(4552),i=t(1913),r=t(1198),a=t(6188);function s(e){switch(e){case"A":return"green";case"B":return"blue";case"C":return"orange";case"D":return"red";case"F":return"volcano";default:return"default"}}function o(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return 0===e?null:(0,l.jsxs)("span",{style:{color:(n?e<0:e>0)?"#52c41a":"#ff4d4f",fontSize:12,marginLeft:4},children:[e>0?"▲":"▼"," ",Math.abs(e)]})}var c=[{key:"architecture",label:"Architecture",icon:"ApartmentOutlined"},{key:"typescript",label:"TypeScript",icon:"CodeOutlined"},{key:"deadCode",label:"Dead Code",icon:"DeleteOutlined"},{key:"depHygiene",label:"Dep Hygiene",icon:"NodeIndexOutlined"},{key:"testCoverage",label:"Test Coverage",icon:"CheckCircleOutlined"}];function d(){var e,n,t,i,d,u,h,p,x=(0,a.useData)("/v1/plugins/quality/stats"),g=x.data,y=x.isLoading,f=(0,a.useData)("/v1/plugins/quality/health"),I=f.data,j=f.isLoading,m=(0,a.useData)("/v1/plugins/quality/history"),v=m.data,U=m.isLoading;if(y||j||U)return(0,l.jsx)(r.UISkeleton,{active:!0,lines:8,style:{padding:"24px 0"}});var k=null==v?void 0:v.delta,S=null!=(n=null==v||null==(p=v.latest)?void 0:p.dimensions)?n:null==I?void 0:I.dimensions;return(0,l.jsxs)("div",{children:[(0,l.jsx)(r.UICard,{title:"Health Score",style:{marginBottom:24},children:(0,l.jsxs)(r.UIRow,{gutter:32,align:"middle",children:[(0,l.jsxs)(r.UICol,{span:8,style:{textAlign:"center"},children:[(0,l.jsx)(r.UIProgress,{type:"circle",percent:null!=(t=null==I?void 0:I.score)?t:0,size:160,status:(e=null==I?void 0:I.score)?e>=80?"success":e<60?"exception":"normal":"normal"}),(0,l.jsxs)("div",{style:{marginTop:12},children:[(0,l.jsxs)(r.UITag,{color:s(null==I?void 0:I.grade),style:{fontSize:16,padding:"4px 12px"},children:["Grade ",null!=(i=null==I?void 0:I.grade)?i:"—"]}),k&&(0,l.jsxs)("div",{style:{marginTop:8,color:"#8c8c8c",fontSize:13},children:[o(k.score)," vs previous snapshot"]})]})]}),(0,l.jsx)(r.UICol,{span:16,children:(0,l.jsx)(r.UIRow,{gutter:[16,16],children:c.map(function(e){var n,t,i,a,o,c=e.key,d=e.label,u=e.icon,h=S?S[c]:void 0;return(0,l.jsx)(r.UICol,{span:12,children:(0,l.jsxs)(r.UICard,{size:"small",style:{borderRadius:8},children:[(0,l.jsxs)(r.UISpace,{children:[(0,l.jsx)(r.UIIcon,{name:u}),(0,l.jsx)("span",{style:{fontWeight:500},children:d}),(0,l.jsx)(r.UITag,{color:s(null==h?void 0:h.grade),children:null!=(n=null==h?void 0:h.grade)?n:"—"})]}),(0,l.jsx)(r.UIProgress,{percent:null!=(t=null==h?void 0:h.score)?t:0,size:"small",showInfo:!1,strokeColor:(null!=(i=null==h?void 0:h.score)?i:0)>=80?"#52c41a":(null!=(a=null==h?void 0:h.score)?a:0)>=60?"#faad14":"#ff4d4f",style:{marginTop:8}}),(0,l.jsxs)("div",{style:{fontSize:12,color:"#8c8c8c",marginTop:4},children:[null!=(o=null==h?void 0:h.score)?o:0,"/100"]})]})},c)})})})]})}),k&&(0,l.jsx)(r.UIAlert,{variant:"info",showIcon:!0,icon:(0,l.jsx)(r.UIIcon,{name:"LineChartOutlined"}),message:"Changes since last snapshot",description:(0,l.jsx)(r.UIRow,{gutter:16,style:{marginTop:8},children:[{label:"Layering violations",value:-k.layeringViolations,invert:!0},{label:"Any count",value:-k.anyCount,invert:!0},{label:"Unused files",value:-k.unusedFiles,invert:!0},{label:"Unused deps",value:-k.unusedDeps,invert:!0},{label:"Avg instability",value:-k.avgInstability,invert:!0}].map(function(e){var n=e.label,t=e.value,i=e.invert;return(0,l.jsxs)(r.UICol,{children:[(0,l.jsxs)("span",{style:{color:"#8c8c8c"},children:[n,": "]}),o(t,i),0===t&&(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"—"})]},n)})}),style:{marginBottom:24}}),(0,l.jsxs)(r.UIRow,{gutter:16,children:[(0,l.jsx)(r.UICol,{span:8,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Packages",value:null!=(d=null==g?void 0:g.packages)?d:0,prefix:(0,l.jsx)(r.UIIcon,{name:"DatabaseOutlined"})})})}),(0,l.jsx)(r.UICol,{span:8,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Lines of Code",value:null!=(u=null==g?void 0:g.loc)?u:0,prefix:(0,l.jsx)(r.UIIcon,{name:"CodeOutlined"})})})}),(0,l.jsx)(r.UICol,{span:8,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Total Size",value:null!=(h=null==g?void 0:g.size)?h:"N/A",prefix:(0,l.jsx)(r.UIIcon,{name:"FileTextOutlined"})})})})]})]})}var u=[{title:"Package",dataIndex:"name",key:"name",render:function(e){return(0,l.jsx)("code",{style:{fontSize:12},children:e})},ellipsis:!0},{title:"Ca (afferent)",dataIndex:"afferent",key:"afferent",width:110,sorter:function(e,n){return e.afferent-n.afferent}},{title:"Ce (efferent)",dataIndex:"efferent",key:"efferent",width:110,sorter:function(e,n){return e.efferent-n.efferent}},{title:"Instability",dataIndex:"instability",key:"instability",width:110,defaultSortOrder:"descend",sorter:function(e,n){return e.instability-n.instability},render:function(e){return(0,l.jsx)(r.UITag,{color:e>=.8?"#ff4d4f":e>=.6?"#faad14":e>=.4?"#1677ff":"#52c41a",children:e.toFixed(2)})}}],h=[{title:"File",dataIndex:"file",key:"file",ellipsis:!0,render:function(e){return(0,l.jsx)("code",{style:{fontSize:11},children:e.replace(/^.*\/src\//,"src/")})}},{title:"From",key:"from",width:180,render:function(e,n){return(0,l.jsxs)(r.UISpace,{size:4,children:[(0,l.jsx)(r.UITag,{children:n.fromPackage}),(0,l.jsxs)("span",{style:{color:"#8c8c8c",fontSize:11},children:["L",n.fromLayer]})]})}},{title:"To",key:"to",width:180,render:function(e,n){return(0,l.jsxs)(r.UISpace,{size:4,children:[(0,l.jsx)(r.UITag,{color:"red",children:n.toPackage}),(0,l.jsxs)("span",{style:{color:"#8c8c8c",fontSize:11},children:["L",n.toLayer]})]})}},{title:"Import",dataIndex:"importSpecifier",key:"importSpecifier",ellipsis:!0,render:function(e){return(0,l.jsx)("code",{style:{fontSize:11},children:e})}}];function p(){var e,n,t,i,s,o,c,d=(0,a.useData)("/v1/plugins/quality/coupling"),p=d.data,x=d.isLoading,g=(0,a.useData)("/v1/plugins/quality/layers"),y=g.data,f=g.isLoading;if(x||f)return(0,l.jsx)(r.UISkeleton,{active:!0,lines:10,style:{padding:"24px 0"}});var I=(null!=(e=null==y?void 0:y.totalViolations)?e:0)>0;return(0,l.jsxs)("div",{children:[(0,l.jsxs)(r.UIRow,{gutter:16,style:{marginBottom:24},children:[(0,l.jsx)(r.UICol,{span:8,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Layering Violations",value:null!=(n=null==y?void 0:y.totalViolations)?n:0,valueStyle:{color:I?"#ff4d4f":"#52c41a"},prefix:(0,l.jsx)(r.UIIcon,{name:I?"WarningOutlined":"CheckCircleOutlined"})})})}),(0,l.jsx)(r.UICol,{span:8,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Avg Instability",value:(null!=(t=null==p?void 0:p.avgInstability)?t:0).toFixed(2),prefix:(0,l.jsx)(r.UIIcon,{name:"NodeIndexOutlined"})})})}),(0,l.jsx)(r.UICol,{span:8,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Affected Packages",value:null!=(i=null==y||null==(c=y.affectedPackages)?void 0:c.length)?i:0,prefix:(0,l.jsx)(r.UIIcon,{name:"ApartmentOutlined"})})})})]}),I&&(0,l.jsx)(r.UIAlert,{variant:"error",showIcon:!0,icon:(0,l.jsx)(r.UIIcon,{name:"WarningOutlined"}),message:"".concat(y.totalViolations," layering violation").concat(y.totalViolations>1?"s":""," detected"),description:"Lower-layer packages are importing from higher-layer packages, breaking the dependency rules.",style:{marginBottom:16}}),(0,l.jsx)(r.UICard,{title:"Layering Violations",style:{marginBottom:24},children:I?(0,l.jsx)(r.UITable,{dataSource:null!=(s=null==y?void 0:y.violations)?s:[],columns:h,rowKey:function(e){return"".concat(e.file,":").concat(e.importSpecifier)},size:"small",pagination:{pageSize:20}}):(0,l.jsx)(r.UIAlert,{variant:"success",showIcon:!0,icon:(0,l.jsx)(r.UIIcon,{name:"CheckCircleOutlined"}),message:"No layering violations — architecture is clean"})}),(0,l.jsx)(r.UICard,{title:"Package Coupling (Ca/Ce/Instability)",children:(0,l.jsx)(r.UITable,{dataSource:null!=(o=null==p?void 0:p.packages)?o:[],columns:u,rowKey:"name",size:"small",pagination:{pageSize:30}})})]})}var x=[{title:"File",dataIndex:"file",key:"file",ellipsis:!0,render:function(e){return(0,l.jsx)("code",{style:{fontSize:12},children:e})}}],g=[{title:"File",dataIndex:"file",key:"file",ellipsis:!0,render:function(e){return(0,l.jsx)("code",{style:{fontSize:12},children:e})}},{title:"Symbol",dataIndex:"symbol",key:"symbol",width:200,render:function(e){return(0,l.jsx)(r.UITag,{children:(0,l.jsx)("code",{children:e})})}}],y=[{title:"Package",dataIndex:"package",key:"package",render:function(e){return(0,l.jsx)("code",{style:{fontSize:12},children:e})}},{title:"Workspace",dataIndex:"workspace",key:"workspace",width:220,render:function(e){return(0,l.jsx)(r.UITag,{children:e})}}];function f(){var e,n,t,i,s,o,c,d,u,h,p,f,I,j,m=(0,a.useData)("/v1/plugins/quality/dead-code"),v=m.data,U=m.isLoading,k=(0,a.useData)("/v1/plugins/quality/health"),S=k.data,C=k.isLoading;if(U||C)return(0,l.jsx)(r.UISkeleton,{active:!0,lines:8,style:{padding:"24px 0"}});var b=null!=(n=null==S||null==(h=S.dimensions)||null==(u=h.typescript)?void 0:u.details)?n:[],w=null!=(t=null==S||null==(f=S.dimensions)||null==(p=f.typescript)?void 0:p.score)?t:100,z=null!=(i=null==S||null==(j=S.dimensions)||null==(I=j.typescript)?void 0:I.grade)?i:"A",T=(null!=(s=null==v?void 0:v.unusedFiles)?s:[]).map(function(e){return{key:e,file:e}}),A=(null!=(o=null==v?void 0:v.unusedExports)?o:[]).map(function(e){return{key:"".concat(e.file,":").concat(e.symbol),file:e.file,symbol:e.symbol}}),D=(null!=(c=null==v?void 0:v.unusedDependencies)?c:[]).map(function(e){return{key:"".concat(e.workspace,":").concat(e.package),package:e.package,workspace:e.workspace}}),O=(null!=(d=null==v?void 0:v.unlistedDependencies)?d:[]).map(function(e){return{key:"".concat(e.workspace,":").concat(e.package),package:e.package,workspace:e.workspace}});return(0,l.jsxs)("div",{children:[(0,l.jsxs)(r.UIRow,{gutter:16,style:{marginBottom:24},children:[(0,l.jsx)(r.UICol,{span:6,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"TypeScript Score",value:"".concat(w,"/100"),prefix:(0,l.jsx)(r.UITag,{color:null!=(e=({A:"green",B:"blue",C:"orange",D:"red",F:"volcano"})[z])?e:"default",children:z})})})}),(0,l.jsx)(r.UICol,{span:6,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Unused Files",value:T.length,valueStyle:{color:T.length>0?"#ff4d4f":"#52c41a"},prefix:(0,l.jsx)(r.UIIcon,{name:"FileUnknownOutlined"})})})}),(0,l.jsx)(r.UICol,{span:6,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Unused Exports",value:A.length,valueStyle:{color:A.length>0?"#faad14":"#52c41a"},prefix:(0,l.jsx)(r.UIIcon,{name:"ExportOutlined"})})})}),(0,l.jsx)(r.UICol,{span:6,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Dep Issues",value:D.length+O.length,valueStyle:{color:D.length+O.length>0?"#faad14":"#52c41a"},prefix:(0,l.jsx)(r.UIIcon,{name:"NodeIndexOutlined"})})})})]}),b.length>0&&(0,l.jsx)(r.UICard,{title:"TypeScript Health",style:{marginBottom:24},children:b.map(function(e,n){return(0,l.jsx)(r.UIAlert,{variant:w<60?"error":w<80?"warning":"info",showIcon:!0,message:e,style:{marginBottom:8}},n)})}),T.length>0&&(0,l.jsx)(r.UICard,{title:(0,l.jsxs)(r.UISpace,{children:[(0,l.jsx)(r.UIIcon,{name:"FileUnknownOutlined"}),(0,l.jsx)("span",{children:"Unused Files"}),(0,l.jsx)(r.UITag,{color:"red",children:T.length})]}),style:{marginBottom:16},children:(0,l.jsx)(r.UITable,{dataSource:T,columns:x,size:"small",pagination:{pageSize:20}})}),A.length>0&&(0,l.jsx)(r.UICard,{title:(0,l.jsxs)(r.UISpace,{children:[(0,l.jsx)(r.UIIcon,{name:"ExportOutlined"}),(0,l.jsx)("span",{children:"Unused Exports"}),(0,l.jsx)(r.UITag,{color:"orange",children:A.length})]}),style:{marginBottom:16},children:(0,l.jsx)(r.UITable,{dataSource:A,columns:g,size:"small",pagination:{pageSize:20}})}),D.length>0&&(0,l.jsx)(r.UICard,{title:(0,l.jsxs)(r.UISpace,{children:[(0,l.jsx)(r.UIIcon,{name:"NodeCollapseOutlined"}),(0,l.jsx)("span",{children:"Unused Dependencies"}),(0,l.jsx)(r.UITag,{color:"orange",children:D.length})]}),style:{marginBottom:16},children:(0,l.jsx)(r.UITable,{dataSource:D,columns:y,size:"small",pagination:{pageSize:20}})}),O.length>0&&(0,l.jsx)(r.UICard,{title:(0,l.jsxs)(r.UISpace,{children:[(0,l.jsx)(r.UIIcon,{name:"WarningOutlined"}),(0,l.jsx)("span",{children:"Unlisted Dependencies"}),(0,l.jsx)(r.UITag,{color:"red",children:O.length})]}),children:(0,l.jsx)(r.UITable,{dataSource:O,columns:y,size:"small",pagination:{pageSize:20}})}),0===T.length&&0===A.length&&0===D.length&&0===O.length&&(0,l.jsx)(r.UIAlert,{variant:"success",showIcon:!0,icon:(0,l.jsx)(r.UIIcon,{name:"CheckCircleOutlined"}),message:"No dead code detected — codebase is clean"})]})}function I(e){var n;return null!=(n=({A:"green",B:"blue",C:"orange",D:"red",F:"volcano"})[null!=e?e:""])?n:"default"}function j(e){var n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return 0===e?(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"—"}):(0,l.jsxs)("span",{style:{color:(n?e<0:e>0)?"#52c41a":"#ff4d4f"},children:[e>0?"▲":"▼"," ",Math.abs(e)]})}var m=[{title:"Date",dataIndex:"timestamp",key:"timestamp",width:170,render:function(e){return new Date(e).toLocaleString()}},{title:"Score",dataIndex:"score",key:"score",width:80,sorter:function(e,n){return e.score-n.score}},{title:"Grade",dataIndex:"grade",key:"grade",width:70,render:function(e){return(0,l.jsx)(r.UITag,{color:I(e),children:e})}},{title:"Architecture",key:"arch",width:110,render:function(e,n){return(0,l.jsxs)(r.UISpace,{size:4,children:[(0,l.jsx)(r.UITag,{color:I(n.dimensions.architecture.grade),style:{fontSize:11},children:n.dimensions.architecture.grade}),(0,l.jsx)("span",{style:{fontSize:11,color:"#8c8c8c"},children:n.dimensions.architecture.score})]})}},{title:"TypeScript",key:"ts",width:110,render:function(e,n){return(0,l.jsxs)(r.UISpace,{size:4,children:[(0,l.jsx)(r.UITag,{color:I(n.dimensions.typescript.grade),style:{fontSize:11},children:n.dimensions.typescript.grade}),(0,l.jsx)("span",{style:{fontSize:11,color:"#8c8c8c"},children:n.dimensions.typescript.score})]})}},{title:"Dead Code",key:"dc",width:110,render:function(e,n){return(0,l.jsxs)(r.UISpace,{size:4,children:[(0,l.jsx)(r.UITag,{color:I(n.dimensions.deadCode.grade),style:{fontSize:11},children:n.dimensions.deadCode.grade}),(0,l.jsx)("span",{style:{fontSize:11,color:"#8c8c8c"},children:n.dimensions.deadCode.score})]})}},{title:"Violations",key:"violations",width:95,render:function(e,n){return(0,l.jsx)("span",{style:{color:n.counters.layeringViolations>0?"#ff4d4f":"#52c41a"},children:n.counters.layeringViolations})}},{title:"Any",key:"any",width:70,render:function(e,n){return n.counters.anyCount}},{title:"Unused",key:"unused",width:80,render:function(e,n){return n.counters.unusedFiles}},{title:"Branch",key:"branch",width:120,ellipsis:!0,render:function(e,n){return(0,l.jsx)("code",{style:{fontSize:11},children:n.git.branch||"—"})}},{title:"Commit",key:"commit",width:90,render:function(e,n){return(0,l.jsx)("code",{style:{fontSize:11},children:n.git.commit?n.git.commit.slice(0,7):"—"})}}];function v(){var e,n=(0,a.useData)("/v1/plugins/quality/history"),t=n.data,i=n.isLoading,s=n.refetch,o=(0,a.useMutateData)("/v1/plugins/quality/snapshot"),c=(0,a.useNotification)();if(i)return(0,l.jsx)(r.UISkeleton,{active:!0,lines:8,style:{padding:"24px 0"}});var d=null!=(e=null==t?void 0:t.snapshots)?e:[],u=null==t?void 0:t.delta,h=u&&Object.values(u).some(function(e){return 0!==e});return(0,l.jsxs)("div",{children:[u&&(0,l.jsx)(r.UICard,{title:"Changes since last snapshot",style:{marginBottom:24},children:h?(0,l.jsxs)("div",{style:{display:"flex",gap:32,flexWrap:"wrap"},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Score "}),j(u.score,!1)]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Violations "}),j(u.layeringViolations)]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Any count "}),j(u.anyCount)]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Ts-ignore "}),j(u.tsIgnoreCount)]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Unused files "}),j(u.unusedFiles)]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Unused deps "}),j(u.unusedDeps)]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Avg instability "}),j(parseFloat(u.avgInstability.toFixed(2)))]})]}):(0,l.jsx)("span",{style:{color:"#8c8c8c",fontSize:13},children:"No changes since last snapshot"})}),(0,l.jsx)(r.UICard,{title:"Snapshot History (".concat(d.length,")"),extra:(0,l.jsx)(r.UIButton,{size:"small",icon:(0,l.jsx)(r.UIIcon,{name:"CameraOutlined"}),loading:o.isLoading,onClick:function(){o.mutate({},{onSuccess:function(){c.success("Snapshot saved"),s()},onError:function(e){var n;c.error("Failed: ".concat((null!=(n=Error)&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n)?e.message:String(e)))}})},children:"Save Snapshot"}),children:0===d.length?(0,l.jsx)(r.UIAlert,{variant:"info",showIcon:!0,icon:(0,l.jsx)(r.UIIcon,{name:"InfoCircleOutlined"}),message:"No snapshots yet",description:'Run "kb quality snapshot" or click "Save Snapshot" to start tracking trends.'}):(0,l.jsx)(r.UITable,{dataSource:d.slice().reverse(),columns:m,rowKey:"id",size:"small",pagination:{pageSize:20},scroll:{x:1200}})})]})}function U(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,l=Array(n);t<n;t++)l[t]=e[t];return l}function k(){var e,n,t,s,o=function(e){if(Array.isArray(e))return e}(e=i.useState())||function(e){var n,t,l=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var i=[],r=!0,a=!1;try{for(l=l.call(e);!(r=(n=l.next()).done)&&(i.push(n.value),2!==i.length);r=!0);}catch(e){a=!0,t=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw t}}return i}}(e)||function(e){if(e){if("string"==typeof e)return U(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return U(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),c=o[0],d=o[1],u=c?"/v1/plugins/quality/build-order?package=".concat(encodeURIComponent(c)):"/v1/plugins/quality/build-order",h=(0,a.useData)(u),p=h.data,x=h.isLoading,g=h.isError;if((0,a.useData)("/v1/plugins/quality/cycles").data,x)return(0,l.jsx)(r.UISkeleton,{active:!0,lines:6,style:{padding:"24px 0"}});if(g)return(0,l.jsx)(r.UIAlert,{message:"Failed to load build order",variant:"error",showIcon:!0});var y=[{title:"Layer",dataIndex:"layer",key:"layer",width:100,render:function(e){return(0,l.jsxs)(r.UITag,{color:"blue",children:["Layer ",e]})}},{title:"Packages (can build in parallel)",dataIndex:"packages",key:"packages",render:function(e){return(0,l.jsx)(r.UISpace,{wrap:!0,children:e.map(function(e){return(0,l.jsx)(r.UITag,{children:e},e)})})}}],f=null==p?void 0:p.layers.map(function(e,n){return{layer:n+1,packages:e,key:n}});return(0,l.jsxs)("div",{children:[(null==p?void 0:p.hasCircular)&&(0,l.jsx)(r.UIAlert,{message:"Circular Dependencies Detected!",description:"Found ".concat(p.circular.length," circular dependency cycles. Build order may not be correct."),variant:"error",showIcon:!0,style:{marginBottom:24}}),(0,l.jsx)(r.UICard,{title:"Filter",style:{marginBottom:24},children:(0,l.jsx)(r.UISelect,{style:{width:400},placeholder:"Select package to see its build dependencies",value:c,onChange:function(e){return d(e)},allowClear:!0,showSearch:!0,options:null!=(n=null==p?void 0:p.sorted.map(function(e){return{label:e,value:e}}))?n:[]})}),(0,l.jsx)(r.UICard,{title:"Build Layers (".concat(null!=(t=null==p?void 0:p.layerCount)?t:0," layers, ").concat(null!=(s=null==p?void 0:p.packageCount)?s:0," packages)"),style:{marginBottom:24},children:(0,l.jsx)(r.UITable,{dataSource:null!=f?f:[],columns:y,pagination:!1,expandable:{expandedRowRender:function(e){return(0,l.jsxs)("div",{style:{padding:"8px 0"},children:[(0,l.jsx)("strong",{children:"Packages in this layer:"}),(0,l.jsx)("div",{style:{marginTop:8},children:e.packages.map(function(e){return(0,l.jsx)(r.UITag,{style:{marginBottom:4},children:e},e)})})]})}}})}),(null==p?void 0:p.hasCircular)&&(0,l.jsx)(r.UICard,{title:"Circular Dependencies (".concat(p.circular.length,")"),children:p.circular.map(function(e,n){return(0,l.jsx)(r.UIAlert,{message:"Cycle ".concat(n+1),description:e.join(" → "),variant:"warning",showIcon:!0,style:{marginBottom:12}},n)})})]})}function S(){var e=(0,l.jsx)(r.UITabs,{syncUrl:"search",items:[{key:"overview",label:"Overview",children:(0,l.jsx)(d,{})},{key:"architecture",label:"Architecture",children:(0,l.jsx)(p,{})},{key:"debt",label:"Debt",children:(0,l.jsx)(f,{})},{key:"history",label:"History",children:(0,l.jsx)(v,{})},{key:"build-order",label:"Build Order",children:(0,l.jsx)(k,{})}]});return(0,l.jsx)(r.UIPage,{children:(0,l.jsx)(r.UIPageHeader,{title:"Quality",description:"Code health, architecture analysis, and trend tracking",tabs:e})})}}}]);
|
|
1
|
+
"use strict";(self.rspackChunk_kb_labs_quality_entry=self.rspackChunk_kb_labs_quality_entry||[]).push([[15],{6026(e,n){var t=Symbol.for("react.transitional.element");function l(e,n,l){var i=null;if(void 0!==l&&(i=""+l),void 0!==n.key&&(i=""+n.key),"key"in n)for(var r in l={},n)"key"!==r&&(l[r]=n[r]);else l=n;return{$$typeof:t,type:e,key:i,ref:void 0!==(n=l.ref)?n:null,props:l}}n.Fragment=Symbol.for("react.fragment"),n.jsx=l,n.jsxs=l},4552(e,n,t){e.exports=t(6026)},9586(e,n,t){t.r(n),t.d(n,{default:()=>S});var l=t(4552),i=t(7079),r=t(9776),a=t(7936);function s(e){switch(e){case"A":return"green";case"B":return"blue";case"C":return"orange";case"D":return"red";case"F":return"volcano";default:return"default"}}function o(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return 0===e?null:(0,l.jsxs)("span",{style:{color:(n?e<0:e>0)?"#52c41a":"#ff4d4f",fontSize:12,marginLeft:4},children:[e>0?"▲":"▼"," ",Math.abs(e)]})}var c=[{key:"architecture",label:"Architecture",icon:"ApartmentOutlined"},{key:"typescript",label:"TypeScript",icon:"CodeOutlined"},{key:"deadCode",label:"Dead Code",icon:"DeleteOutlined"},{key:"depHygiene",label:"Dep Hygiene",icon:"NodeIndexOutlined"},{key:"testCoverage",label:"Test Coverage",icon:"CheckCircleOutlined"}];function d(){var e,n,t,i,d,u,h,p,x=(0,a.useData)("/v1/plugins/quality/stats"),g=x.data,y=x.isLoading,f=(0,a.useData)("/v1/plugins/quality/health"),I=f.data,j=f.isLoading,m=(0,a.useData)("/v1/plugins/quality/history"),v=m.data,U=m.isLoading;if(y||j||U)return(0,l.jsx)(r.UISkeleton,{active:!0,lines:8,style:{padding:"24px 0"}});var k=null==v?void 0:v.delta,S=null!=(n=null==v||null==(p=v.latest)?void 0:p.dimensions)?n:null==I?void 0:I.dimensions;return(0,l.jsxs)("div",{children:[(0,l.jsx)(r.UICard,{title:"Health Score",style:{marginBottom:24},children:(0,l.jsxs)(r.UIRow,{gutter:32,align:"middle",children:[(0,l.jsxs)(r.UICol,{span:8,style:{textAlign:"center"},children:[(0,l.jsx)(r.UIProgress,{type:"circle",percent:null!=(t=null==I?void 0:I.score)?t:0,size:160,status:(e=null==I?void 0:I.score)?e>=80?"success":e<60?"exception":"normal":"normal"}),(0,l.jsxs)("div",{style:{marginTop:12},children:[(0,l.jsxs)(r.UITag,{color:s(null==I?void 0:I.grade),style:{fontSize:16,padding:"4px 12px"},children:["Grade ",null!=(i=null==I?void 0:I.grade)?i:"—"]}),k&&(0,l.jsxs)("div",{style:{marginTop:8,color:"#8c8c8c",fontSize:13},children:[o(k.score)," vs previous snapshot"]})]})]}),(0,l.jsx)(r.UICol,{span:16,children:(0,l.jsx)(r.UIRow,{gutter:[16,16],children:c.map(function(e){var n,t,i,a,o,c=e.key,d=e.label,u=e.icon,h=S?S[c]:void 0;return(0,l.jsx)(r.UICol,{span:12,children:(0,l.jsxs)(r.UICard,{size:"small",style:{borderRadius:8},children:[(0,l.jsxs)(r.UISpace,{children:[(0,l.jsx)(r.UIIcon,{name:u}),(0,l.jsx)("span",{style:{fontWeight:500},children:d}),(0,l.jsx)(r.UITag,{color:s(null==h?void 0:h.grade),children:null!=(n=null==h?void 0:h.grade)?n:"—"})]}),(0,l.jsx)(r.UIProgress,{percent:null!=(t=null==h?void 0:h.score)?t:0,size:"small",showInfo:!1,strokeColor:(null!=(i=null==h?void 0:h.score)?i:0)>=80?"#52c41a":(null!=(a=null==h?void 0:h.score)?a:0)>=60?"#faad14":"#ff4d4f",style:{marginTop:8}}),(0,l.jsxs)("div",{style:{fontSize:12,color:"#8c8c8c",marginTop:4},children:[null!=(o=null==h?void 0:h.score)?o:0,"/100"]})]})},c)})})})]})}),k&&(0,l.jsx)(r.UIAlert,{variant:"info",showIcon:!0,icon:(0,l.jsx)(r.UIIcon,{name:"LineChartOutlined"}),message:"Changes since last snapshot",description:(0,l.jsx)(r.UIRow,{gutter:16,style:{marginTop:8},children:[{label:"Layering violations",value:-k.layeringViolations,invert:!0},{label:"Any count",value:-k.anyCount,invert:!0},{label:"Unused files",value:-k.unusedFiles,invert:!0},{label:"Unused deps",value:-k.unusedDeps,invert:!0},{label:"Avg instability",value:-k.avgInstability,invert:!0}].map(function(e){var n=e.label,t=e.value,i=e.invert;return(0,l.jsxs)(r.UICol,{children:[(0,l.jsxs)("span",{style:{color:"#8c8c8c"},children:[n,": "]}),o(t,i),0===t&&(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"—"})]},n)})}),style:{marginBottom:24}}),(0,l.jsxs)(r.UIRow,{gutter:16,children:[(0,l.jsx)(r.UICol,{span:8,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Packages",value:null!=(d=null==g?void 0:g.packages)?d:0,prefix:(0,l.jsx)(r.UIIcon,{name:"DatabaseOutlined"})})})}),(0,l.jsx)(r.UICol,{span:8,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Lines of Code",value:null!=(u=null==g?void 0:g.loc)?u:0,prefix:(0,l.jsx)(r.UIIcon,{name:"CodeOutlined"})})})}),(0,l.jsx)(r.UICol,{span:8,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Total Size",value:null!=(h=null==g?void 0:g.size)?h:"N/A",prefix:(0,l.jsx)(r.UIIcon,{name:"FileTextOutlined"})})})})]})]})}var u=[{title:"Package",dataIndex:"name",key:"name",render:function(e){return(0,l.jsx)("code",{style:{fontSize:12},children:e})},ellipsis:!0},{title:"Ca (afferent)",dataIndex:"afferent",key:"afferent",width:110,sorter:function(e,n){return e.afferent-n.afferent}},{title:"Ce (efferent)",dataIndex:"efferent",key:"efferent",width:110,sorter:function(e,n){return e.efferent-n.efferent}},{title:"Instability",dataIndex:"instability",key:"instability",width:110,defaultSortOrder:"descend",sorter:function(e,n){return e.instability-n.instability},render:function(e){return(0,l.jsx)(r.UITag,{color:e>=.8?"#ff4d4f":e>=.6?"#faad14":e>=.4?"#1677ff":"#52c41a",children:e.toFixed(2)})}}],h=[{title:"File",dataIndex:"file",key:"file",ellipsis:!0,render:function(e){return(0,l.jsx)("code",{style:{fontSize:11},children:e.replace(/^.*\/src\//,"src/")})}},{title:"From",key:"from",width:180,render:function(e,n){return(0,l.jsxs)(r.UISpace,{size:4,children:[(0,l.jsx)(r.UITag,{children:n.fromPackage}),(0,l.jsxs)("span",{style:{color:"#8c8c8c",fontSize:11},children:["L",n.fromLayer]})]})}},{title:"To",key:"to",width:180,render:function(e,n){return(0,l.jsxs)(r.UISpace,{size:4,children:[(0,l.jsx)(r.UITag,{color:"red",children:n.toPackage}),(0,l.jsxs)("span",{style:{color:"#8c8c8c",fontSize:11},children:["L",n.toLayer]})]})}},{title:"Import",dataIndex:"importSpecifier",key:"importSpecifier",ellipsis:!0,render:function(e){return(0,l.jsx)("code",{style:{fontSize:11},children:e})}}];function p(){var e,n,t,i,s,o,c,d=(0,a.useData)("/v1/plugins/quality/coupling"),p=d.data,x=d.isLoading,g=(0,a.useData)("/v1/plugins/quality/layers"),y=g.data,f=g.isLoading;if(x||f)return(0,l.jsx)(r.UISkeleton,{active:!0,lines:10,style:{padding:"24px 0"}});var I=(null!=(e=null==y?void 0:y.totalViolations)?e:0)>0;return(0,l.jsxs)("div",{children:[(0,l.jsxs)(r.UIRow,{gutter:16,style:{marginBottom:24},children:[(0,l.jsx)(r.UICol,{span:8,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Layering Violations",value:null!=(n=null==y?void 0:y.totalViolations)?n:0,valueStyle:{color:I?"#ff4d4f":"#52c41a"},prefix:(0,l.jsx)(r.UIIcon,{name:I?"WarningOutlined":"CheckCircleOutlined"})})})}),(0,l.jsx)(r.UICol,{span:8,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Avg Instability",value:(null!=(t=null==p?void 0:p.avgInstability)?t:0).toFixed(2),prefix:(0,l.jsx)(r.UIIcon,{name:"NodeIndexOutlined"})})})}),(0,l.jsx)(r.UICol,{span:8,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Affected Packages",value:null!=(i=null==y||null==(c=y.affectedPackages)?void 0:c.length)?i:0,prefix:(0,l.jsx)(r.UIIcon,{name:"ApartmentOutlined"})})})})]}),I&&(0,l.jsx)(r.UIAlert,{variant:"error",showIcon:!0,icon:(0,l.jsx)(r.UIIcon,{name:"WarningOutlined"}),message:"".concat(y.totalViolations," layering violation").concat(y.totalViolations>1?"s":""," detected"),description:"Lower-layer packages are importing from higher-layer packages, breaking the dependency rules.",style:{marginBottom:16}}),(0,l.jsx)(r.UICard,{title:"Layering Violations",style:{marginBottom:24},children:I?(0,l.jsx)(r.UITable,{dataSource:null!=(s=null==y?void 0:y.violations)?s:[],columns:h,rowKey:function(e){return"".concat(e.file,":").concat(e.importSpecifier)},size:"small",pagination:{pageSize:20}}):(0,l.jsx)(r.UIAlert,{variant:"success",showIcon:!0,icon:(0,l.jsx)(r.UIIcon,{name:"CheckCircleOutlined"}),message:"No layering violations — architecture is clean"})}),(0,l.jsx)(r.UICard,{title:"Package Coupling (Ca/Ce/Instability)",children:(0,l.jsx)(r.UITable,{dataSource:null!=(o=null==p?void 0:p.packages)?o:[],columns:u,rowKey:"name",size:"small",pagination:{pageSize:30}})})]})}var x=[{title:"File",dataIndex:"file",key:"file",ellipsis:!0,render:function(e){return(0,l.jsx)("code",{style:{fontSize:12},children:e})}}],g=[{title:"File",dataIndex:"file",key:"file",ellipsis:!0,render:function(e){return(0,l.jsx)("code",{style:{fontSize:12},children:e})}},{title:"Symbol",dataIndex:"symbol",key:"symbol",width:200,render:function(e){return(0,l.jsx)(r.UITag,{children:(0,l.jsx)("code",{children:e})})}}],y=[{title:"Package",dataIndex:"package",key:"package",render:function(e){return(0,l.jsx)("code",{style:{fontSize:12},children:e})}},{title:"Workspace",dataIndex:"workspace",key:"workspace",width:220,render:function(e){return(0,l.jsx)(r.UITag,{children:e})}}];function f(){var e,n,t,i,s,o,c,d,u,h,p,f,I,j,m=(0,a.useData)("/v1/plugins/quality/dead-code"),v=m.data,U=m.isLoading,k=(0,a.useData)("/v1/plugins/quality/health"),S=k.data,C=k.isLoading;if(U||C)return(0,l.jsx)(r.UISkeleton,{active:!0,lines:8,style:{padding:"24px 0"}});var b=null!=(n=null==S||null==(h=S.dimensions)||null==(u=h.typescript)?void 0:u.details)?n:[],w=null!=(t=null==S||null==(f=S.dimensions)||null==(p=f.typescript)?void 0:p.score)?t:100,z=null!=(i=null==S||null==(j=S.dimensions)||null==(I=j.typescript)?void 0:I.grade)?i:"A",T=(null!=(s=null==v?void 0:v.unusedFiles)?s:[]).map(function(e){return{key:e,file:e}}),A=(null!=(o=null==v?void 0:v.unusedExports)?o:[]).map(function(e){return{key:"".concat(e.file,":").concat(e.symbol),file:e.file,symbol:e.symbol}}),D=(null!=(c=null==v?void 0:v.unusedDependencies)?c:[]).map(function(e){return{key:"".concat(e.workspace,":").concat(e.package),package:e.package,workspace:e.workspace}}),O=(null!=(d=null==v?void 0:v.unlistedDependencies)?d:[]).map(function(e){return{key:"".concat(e.workspace,":").concat(e.package),package:e.package,workspace:e.workspace}});return(0,l.jsxs)("div",{children:[(0,l.jsxs)(r.UIRow,{gutter:16,style:{marginBottom:24},children:[(0,l.jsx)(r.UICol,{span:6,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"TypeScript Score",value:"".concat(w,"/100"),prefix:(0,l.jsx)(r.UITag,{color:null!=(e=({A:"green",B:"blue",C:"orange",D:"red",F:"volcano"})[z])?e:"default",children:z})})})}),(0,l.jsx)(r.UICol,{span:6,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Unused Files",value:T.length,valueStyle:{color:T.length>0?"#ff4d4f":"#52c41a"},prefix:(0,l.jsx)(r.UIIcon,{name:"FileUnknownOutlined"})})})}),(0,l.jsx)(r.UICol,{span:6,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Unused Exports",value:A.length,valueStyle:{color:A.length>0?"#faad14":"#52c41a"},prefix:(0,l.jsx)(r.UIIcon,{name:"ExportOutlined"})})})}),(0,l.jsx)(r.UICol,{span:6,children:(0,l.jsx)(r.UICard,{children:(0,l.jsx)(r.UIStatistic,{title:"Dep Issues",value:D.length+O.length,valueStyle:{color:D.length+O.length>0?"#faad14":"#52c41a"},prefix:(0,l.jsx)(r.UIIcon,{name:"NodeIndexOutlined"})})})})]}),b.length>0&&(0,l.jsx)(r.UICard,{title:"TypeScript Health",style:{marginBottom:24},children:b.map(function(e,n){return(0,l.jsx)(r.UIAlert,{variant:w<60?"error":w<80?"warning":"info",showIcon:!0,message:e,style:{marginBottom:8}},n)})}),T.length>0&&(0,l.jsx)(r.UICard,{title:(0,l.jsxs)(r.UISpace,{children:[(0,l.jsx)(r.UIIcon,{name:"FileUnknownOutlined"}),(0,l.jsx)("span",{children:"Unused Files"}),(0,l.jsx)(r.UITag,{color:"red",children:T.length})]}),style:{marginBottom:16},children:(0,l.jsx)(r.UITable,{dataSource:T,columns:x,size:"small",pagination:{pageSize:20}})}),A.length>0&&(0,l.jsx)(r.UICard,{title:(0,l.jsxs)(r.UISpace,{children:[(0,l.jsx)(r.UIIcon,{name:"ExportOutlined"}),(0,l.jsx)("span",{children:"Unused Exports"}),(0,l.jsx)(r.UITag,{color:"orange",children:A.length})]}),style:{marginBottom:16},children:(0,l.jsx)(r.UITable,{dataSource:A,columns:g,size:"small",pagination:{pageSize:20}})}),D.length>0&&(0,l.jsx)(r.UICard,{title:(0,l.jsxs)(r.UISpace,{children:[(0,l.jsx)(r.UIIcon,{name:"NodeCollapseOutlined"}),(0,l.jsx)("span",{children:"Unused Dependencies"}),(0,l.jsx)(r.UITag,{color:"orange",children:D.length})]}),style:{marginBottom:16},children:(0,l.jsx)(r.UITable,{dataSource:D,columns:y,size:"small",pagination:{pageSize:20}})}),O.length>0&&(0,l.jsx)(r.UICard,{title:(0,l.jsxs)(r.UISpace,{children:[(0,l.jsx)(r.UIIcon,{name:"WarningOutlined"}),(0,l.jsx)("span",{children:"Unlisted Dependencies"}),(0,l.jsx)(r.UITag,{color:"red",children:O.length})]}),children:(0,l.jsx)(r.UITable,{dataSource:O,columns:y,size:"small",pagination:{pageSize:20}})}),0===T.length&&0===A.length&&0===D.length&&0===O.length&&(0,l.jsx)(r.UIAlert,{variant:"success",showIcon:!0,icon:(0,l.jsx)(r.UIIcon,{name:"CheckCircleOutlined"}),message:"No dead code detected — codebase is clean"})]})}function I(e){var n;return null!=(n=({A:"green",B:"blue",C:"orange",D:"red",F:"volcano"})[null!=e?e:""])?n:"default"}function j(e){var n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return 0===e?(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"—"}):(0,l.jsxs)("span",{style:{color:(n?e<0:e>0)?"#52c41a":"#ff4d4f"},children:[e>0?"▲":"▼"," ",Math.abs(e)]})}var m=[{title:"Date",dataIndex:"timestamp",key:"timestamp",width:170,render:function(e){return new Date(e).toLocaleString()}},{title:"Score",dataIndex:"score",key:"score",width:80,sorter:function(e,n){return e.score-n.score}},{title:"Grade",dataIndex:"grade",key:"grade",width:70,render:function(e){return(0,l.jsx)(r.UITag,{color:I(e),children:e})}},{title:"Architecture",key:"arch",width:110,render:function(e,n){return(0,l.jsxs)(r.UISpace,{size:4,children:[(0,l.jsx)(r.UITag,{color:I(n.dimensions.architecture.grade),style:{fontSize:11},children:n.dimensions.architecture.grade}),(0,l.jsx)("span",{style:{fontSize:11,color:"#8c8c8c"},children:n.dimensions.architecture.score})]})}},{title:"TypeScript",key:"ts",width:110,render:function(e,n){return(0,l.jsxs)(r.UISpace,{size:4,children:[(0,l.jsx)(r.UITag,{color:I(n.dimensions.typescript.grade),style:{fontSize:11},children:n.dimensions.typescript.grade}),(0,l.jsx)("span",{style:{fontSize:11,color:"#8c8c8c"},children:n.dimensions.typescript.score})]})}},{title:"Dead Code",key:"dc",width:110,render:function(e,n){return(0,l.jsxs)(r.UISpace,{size:4,children:[(0,l.jsx)(r.UITag,{color:I(n.dimensions.deadCode.grade),style:{fontSize:11},children:n.dimensions.deadCode.grade}),(0,l.jsx)("span",{style:{fontSize:11,color:"#8c8c8c"},children:n.dimensions.deadCode.score})]})}},{title:"Violations",key:"violations",width:95,render:function(e,n){return(0,l.jsx)("span",{style:{color:n.counters.layeringViolations>0?"#ff4d4f":"#52c41a"},children:n.counters.layeringViolations})}},{title:"Any",key:"any",width:70,render:function(e,n){return n.counters.anyCount}},{title:"Unused",key:"unused",width:80,render:function(e,n){return n.counters.unusedFiles}},{title:"Branch",key:"branch",width:120,ellipsis:!0,render:function(e,n){return(0,l.jsx)("code",{style:{fontSize:11},children:n.git.branch||"—"})}},{title:"Commit",key:"commit",width:90,render:function(e,n){return(0,l.jsx)("code",{style:{fontSize:11},children:n.git.commit?n.git.commit.slice(0,7):"—"})}}];function v(){var e,n=(0,a.useData)("/v1/plugins/quality/history"),t=n.data,i=n.isLoading,s=n.refetch,o=(0,a.useMutateData)("/v1/plugins/quality/snapshot"),c=(0,a.useNotification)();if(i)return(0,l.jsx)(r.UISkeleton,{active:!0,lines:8,style:{padding:"24px 0"}});var d=null!=(e=null==t?void 0:t.snapshots)?e:[],u=null==t?void 0:t.delta,h=u&&Object.values(u).some(function(e){return 0!==e});return(0,l.jsxs)("div",{children:[u&&(0,l.jsx)(r.UICard,{title:"Changes since last snapshot",style:{marginBottom:24},children:h?(0,l.jsxs)("div",{style:{display:"flex",gap:32,flexWrap:"wrap"},children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Score "}),j(u.score,!1)]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Violations "}),j(u.layeringViolations)]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Any count "}),j(u.anyCount)]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Ts-ignore "}),j(u.tsIgnoreCount)]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Unused files "}),j(u.unusedFiles)]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Unused deps "}),j(u.unusedDeps)]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("span",{style:{color:"#8c8c8c"},children:"Avg instability "}),j(parseFloat(u.avgInstability.toFixed(2)))]})]}):(0,l.jsx)("span",{style:{color:"#8c8c8c",fontSize:13},children:"No changes since last snapshot"})}),(0,l.jsx)(r.UICard,{title:"Snapshot History (".concat(d.length,")"),extra:(0,l.jsx)(r.UIButton,{size:"small",icon:(0,l.jsx)(r.UIIcon,{name:"CameraOutlined"}),loading:o.isLoading,onClick:function(){o.mutate({},{onSuccess:function(){c.success("Snapshot saved"),s()},onError:function(e){var n;c.error("Failed: ".concat((null!=(n=Error)&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n)?e.message:String(e)))}})},children:"Save Snapshot"}),children:0===d.length?(0,l.jsx)(r.UIAlert,{variant:"info",showIcon:!0,icon:(0,l.jsx)(r.UIIcon,{name:"InfoCircleOutlined"}),message:"No snapshots yet",description:'Run "kb quality snapshot" or click "Save Snapshot" to start tracking trends.'}):(0,l.jsx)(r.UITable,{dataSource:d.slice().reverse(),columns:m,rowKey:"id",size:"small",pagination:{pageSize:20},scroll:{x:1200}})})]})}function U(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,l=Array(n);t<n;t++)l[t]=e[t];return l}function k(){var e,n,t,s,o=function(e){if(Array.isArray(e))return e}(e=i.useState())||function(e){var n,t,l=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=l){var i=[],r=!0,a=!1;try{for(l=l.call(e);!(r=(n=l.next()).done)&&(i.push(n.value),2!==i.length);r=!0);}catch(e){a=!0,t=e}finally{try{r||null==l.return||l.return()}finally{if(a)throw t}}return i}}(e)||function(e){if(e){if("string"==typeof e)return U(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return U(e,2)}}(e)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),c=o[0],d=o[1],u=c?"/v1/plugins/quality/build-order?package=".concat(encodeURIComponent(c)):"/v1/plugins/quality/build-order",h=(0,a.useData)(u),p=h.data,x=h.isLoading,g=h.isError;if((0,a.useData)("/v1/plugins/quality/cycles").data,x)return(0,l.jsx)(r.UISkeleton,{active:!0,lines:6,style:{padding:"24px 0"}});if(g)return(0,l.jsx)(r.UIAlert,{message:"Failed to load build order",variant:"error",showIcon:!0});var y=[{title:"Layer",dataIndex:"layer",key:"layer",width:100,render:function(e){return(0,l.jsxs)(r.UITag,{color:"blue",children:["Layer ",e]})}},{title:"Packages (can build in parallel)",dataIndex:"packages",key:"packages",render:function(e){return(0,l.jsx)(r.UISpace,{wrap:!0,children:e.map(function(e){return(0,l.jsx)(r.UITag,{children:e},e)})})}}],f=null==p?void 0:p.layers.map(function(e,n){return{layer:n+1,packages:e,key:n}});return(0,l.jsxs)("div",{children:[(null==p?void 0:p.hasCircular)&&(0,l.jsx)(r.UIAlert,{message:"Circular Dependencies Detected!",description:"Found ".concat(p.circular.length," circular dependency cycles. Build order may not be correct."),variant:"error",showIcon:!0,style:{marginBottom:24}}),(0,l.jsx)(r.UICard,{title:"Filter",style:{marginBottom:24},children:(0,l.jsx)(r.UISelect,{style:{width:400},placeholder:"Select package to see its build dependencies",value:c,onChange:function(e){return d(e)},allowClear:!0,showSearch:!0,options:null!=(n=null==p?void 0:p.sorted.map(function(e){return{label:e,value:e}}))?n:[]})}),(0,l.jsx)(r.UICard,{title:"Build Layers (".concat(null!=(t=null==p?void 0:p.layerCount)?t:0," layers, ").concat(null!=(s=null==p?void 0:p.packageCount)?s:0," packages)"),style:{marginBottom:24},children:(0,l.jsx)(r.UITable,{dataSource:null!=f?f:[],columns:y,pagination:!1,expandable:{expandedRowRender:function(e){return(0,l.jsxs)("div",{style:{padding:"8px 0"},children:[(0,l.jsx)("strong",{children:"Packages in this layer:"}),(0,l.jsx)("div",{style:{marginTop:8},children:e.packages.map(function(e){return(0,l.jsx)(r.UITag,{style:{marginBottom:4},children:e},e)})})]})}}})}),(null==p?void 0:p.hasCircular)&&(0,l.jsx)(r.UICard,{title:"Circular Dependencies (".concat(p.circular.length,")"),children:p.circular.map(function(e,n){return(0,l.jsx)(r.UIAlert,{message:"Cycle ".concat(n+1),description:e.join(" → "),variant:"warning",showIcon:!0,style:{marginBottom:12}},n)})})]})}function S(){var e=(0,l.jsx)(r.UITabs,{syncUrl:"search",items:[{key:"overview",label:"Overview",children:(0,l.jsx)(d,{})},{key:"architecture",label:"Architecture",children:(0,l.jsx)(p,{})},{key:"debt",label:"Debt",children:(0,l.jsx)(f,{})},{key:"history",label:"History",children:(0,l.jsx)(v,{})},{key:"build-order",label:"Build Order",children:(0,l.jsx)(k,{})}]});return(0,l.jsx)(r.UIPage,{children:(0,l.jsx)(r.UIPageHeader,{title:"Quality",description:"Code health, architecture analysis, and trend tracking",tabs:e})})}}}]);
|
|
2
2
|
//# sourceMappingURL=__federation_expose_QualityOverview.js.map
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "qualityPlugin",
|
|
6
6
|
"globalName": "qualityPlugin",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "2.
|
|
8
|
+
"buildVersion": "2.99.0",
|
|
9
9
|
"buildName": "@kb-labs/quality-entry"
|
|
10
10
|
},
|
|
11
11
|
"publicPath": "auto",
|
|
@@ -25,15 +25,16 @@
|
|
|
25
25
|
},
|
|
26
26
|
"shared": [
|
|
27
27
|
{
|
|
28
|
-
"id": "qualityPlugin
|
|
29
|
-
"name": "
|
|
30
|
-
"version": "
|
|
28
|
+
"id": "qualityPlugin:@kb-labs/studio-event-bus",
|
|
29
|
+
"name": "@kb-labs/studio-event-bus",
|
|
30
|
+
"version": "2.99.0",
|
|
31
31
|
"singleton": true,
|
|
32
|
-
"requiredVersion": "^
|
|
32
|
+
"requiredVersion": "^2.0.0",
|
|
33
33
|
"assets": {
|
|
34
34
|
"js": {
|
|
35
35
|
"sync": [
|
|
36
|
-
"
|
|
36
|
+
"50.js",
|
|
37
|
+
"669.js"
|
|
37
38
|
],
|
|
38
39
|
"async": []
|
|
39
40
|
},
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
{
|
|
47
48
|
"id": "qualityPlugin:@kb-labs/studio-ui-core",
|
|
48
49
|
"name": "@kb-labs/studio-ui-core",
|
|
49
|
-
"version": "2.
|
|
50
|
+
"version": "2.99.0",
|
|
50
51
|
"singleton": true,
|
|
51
52
|
"requiredVersion": "^2.0.0",
|
|
52
53
|
"assets": {
|
|
@@ -85,7 +86,7 @@
|
|
|
85
86
|
{
|
|
86
87
|
"id": "qualityPlugin:@kb-labs/studio-hooks",
|
|
87
88
|
"name": "@kb-labs/studio-hooks",
|
|
88
|
-
"version": "2.
|
|
89
|
+
"version": "2.99.0",
|
|
89
90
|
"singleton": true,
|
|
90
91
|
"requiredVersion": "^2.0.0",
|
|
91
92
|
"assets": {
|
|
@@ -105,7 +106,7 @@
|
|
|
105
106
|
{
|
|
106
107
|
"id": "qualityPlugin:@kb-labs/studio-ui-kit",
|
|
107
108
|
"name": "@kb-labs/studio-ui-kit",
|
|
108
|
-
"version": "2.
|
|
109
|
+
"version": "2.99.0",
|
|
109
110
|
"singleton": true,
|
|
110
111
|
"requiredVersion": "^2.0.0",
|
|
111
112
|
"assets": {
|
|
@@ -184,16 +185,15 @@
|
|
|
184
185
|
}
|
|
185
186
|
},
|
|
186
187
|
{
|
|
187
|
-
"id": "qualityPlugin
|
|
188
|
-
"name": "
|
|
189
|
-
"version": "
|
|
188
|
+
"id": "qualityPlugin:react-router-dom",
|
|
189
|
+
"name": "react-router-dom",
|
|
190
|
+
"version": "7.17.0",
|
|
190
191
|
"singleton": true,
|
|
191
|
-
"requiredVersion": "^
|
|
192
|
+
"requiredVersion": "^7.0.0",
|
|
192
193
|
"assets": {
|
|
193
194
|
"js": {
|
|
194
195
|
"sync": [
|
|
195
|
-
"
|
|
196
|
-
"669.js"
|
|
196
|
+
"733.js"
|
|
197
197
|
],
|
|
198
198
|
"async": []
|
|
199
199
|
},
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"name": "qualityPlugin",
|
|
6
6
|
"globalName": "qualityPlugin",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "2.
|
|
8
|
+
"buildVersion": "2.99.0",
|
|
9
9
|
"buildName": "@kb-labs/quality-entry"
|
|
10
10
|
},
|
|
11
11
|
"publicPath": "auto",
|
|
@@ -25,15 +25,16 @@
|
|
|
25
25
|
},
|
|
26
26
|
"shared": [
|
|
27
27
|
{
|
|
28
|
-
"id": "qualityPlugin
|
|
29
|
-
"name": "
|
|
30
|
-
"version": "
|
|
31
|
-
"requiredVersion": "^
|
|
28
|
+
"id": "qualityPlugin:@kb-labs/studio-event-bus",
|
|
29
|
+
"name": "@kb-labs/studio-event-bus",
|
|
30
|
+
"version": "2.99.0",
|
|
31
|
+
"requiredVersion": "^2.0.0",
|
|
32
32
|
"singleton": true,
|
|
33
33
|
"assets": {
|
|
34
34
|
"js": {
|
|
35
35
|
"sync": [
|
|
36
|
-
"
|
|
36
|
+
"50.js",
|
|
37
|
+
"669.js"
|
|
37
38
|
],
|
|
38
39
|
"async": []
|
|
39
40
|
},
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
{
|
|
49
50
|
"id": "qualityPlugin:@kb-labs/studio-ui-core",
|
|
50
51
|
"name": "@kb-labs/studio-ui-core",
|
|
51
|
-
"version": "2.
|
|
52
|
+
"version": "2.99.0",
|
|
52
53
|
"requiredVersion": "^2.0.0",
|
|
53
54
|
"singleton": true,
|
|
54
55
|
"assets": {
|
|
@@ -91,7 +92,7 @@
|
|
|
91
92
|
{
|
|
92
93
|
"id": "qualityPlugin:@kb-labs/studio-hooks",
|
|
93
94
|
"name": "@kb-labs/studio-hooks",
|
|
94
|
-
"version": "2.
|
|
95
|
+
"version": "2.99.0",
|
|
95
96
|
"requiredVersion": "^2.0.0",
|
|
96
97
|
"singleton": true,
|
|
97
98
|
"assets": {
|
|
@@ -113,7 +114,7 @@
|
|
|
113
114
|
{
|
|
114
115
|
"id": "qualityPlugin:@kb-labs/studio-ui-kit",
|
|
115
116
|
"name": "@kb-labs/studio-ui-kit",
|
|
116
|
-
"version": "2.
|
|
117
|
+
"version": "2.99.0",
|
|
117
118
|
"requiredVersion": "^2.0.0",
|
|
118
119
|
"singleton": true,
|
|
119
120
|
"assets": {
|
|
@@ -202,16 +203,15 @@
|
|
|
202
203
|
"usedExports": []
|
|
203
204
|
},
|
|
204
205
|
{
|
|
205
|
-
"id": "qualityPlugin
|
|
206
|
-
"name": "
|
|
207
|
-
"version": "
|
|
208
|
-
"requiredVersion": "^
|
|
206
|
+
"id": "qualityPlugin:react-router-dom",
|
|
207
|
+
"name": "react-router-dom",
|
|
208
|
+
"version": "7.17.0",
|
|
209
|
+
"requiredVersion": "^7.0.0",
|
|
209
210
|
"singleton": true,
|
|
210
211
|
"assets": {
|
|
211
212
|
"js": {
|
|
212
213
|
"sync": [
|
|
213
|
-
"
|
|
214
|
-
"669.js"
|
|
214
|
+
"733.js"
|
|
215
215
|
],
|
|
216
216
|
"async": []
|
|
217
217
|
},
|