Files
clash-for-linux/dashboard/public/_nuxt/ftm_ukHF.js
wnlen 0b49d27bee ui
2026-01-15 21:33:41 +08:00

1 line
11 KiB
JavaScript

import{Ct as e,W as t,_ as n,_t as r,a as i,b as a,bt as o,c as s,d as c,dt as l,f as u,g as d,gt as f,h as p,i as m,l as h,m as g,n as _,nt as v,o as y,p as b,r as x,s as S,t as C,tt as w,u as T,v as E,vt as D,xt as O,y as k}from"./CxatB1L6.js";import{_ as A}from"./DRJWd5jk.js";var j=class extends a{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=S(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),N(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return P(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return P(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof g(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!d(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&F(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||p(this.options.staleTime,this.#t)!==p(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||g(this.options.enabled,this.#t)!==g(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return L(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u)),t}#g(){this.#b();let e=p(this.options.staleTime,this.#t);if(T||this.#r.isStale||!c(e))return;let t=E(this.#r.dataUpdatedAt,e)+1;this.#d=k.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(T||g(this.options.enabled,this.#t)===!1||!c(this.#p)||this.#p===0)&&(this.#f=k.setInterval(()=>{(this.options.refetchIntervalInBackground||s.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d&&=(k.clearTimeout(this.#d),void 0)}#x(){this.#f&&=(k.clearInterval(this.#f),void 0)}createResult(e,t){let n=this.#t,r=this.options,a=this.#r,o=this.#i,s=this.#a,c=e===n?this.#n:e.state,{state:l}=e,u={...l},d=!1,f;if(t._optimisticResults){let a=this.hasListeners(),o=!a&&N(e,t),s=a&&F(e,n,t,r);(o||s)&&(u={...u,...i(l.data,e.options)}),t._optimisticResults===`isRestoring`&&(u.fetchStatus=`idle`)}let{error:p,errorUpdatedAt:m,status:h}=u;f=u.data;let _=!1;if(t.placeholderData!==void 0&&f===void 0&&h===`pending`){let e;a?.isPlaceholderData&&t.placeholderData===s?.placeholderData?(e=a.data,_=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(h=`success`,f=b(a?.data,e,t),d=!0)}if(t.select&&f!==void 0&&!_)if(a&&f===o?.data&&t.select===this.#c)f=this.#l;else try{this.#c=t.select,f=t.select(f),f=b(a?.data,f,t),this.#l=f,this.#s=null}catch(e){this.#s=e}this.#s&&(p=this.#s,f=this.#l,m=Date.now(),h=`error`);let v=u.fetchStatus===`fetching`,y=h===`pending`,x=h===`error`,C=y&&v,w=f!==void 0,T={status:h,fetchStatus:u.fetchStatus,isPending:y,isSuccess:h===`success`,isError:x,isInitialLoading:C,isLoading:C,data:f,dataUpdatedAt:u.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:v,isRefetching:v&&!y,isLoadingError:x&&!w,isPaused:u.fetchStatus===`paused`,isPlaceholderData:d,isRefetchError:x&&w,isStale:I(e,t),refetch:this.refetch,promise:this.#o,isEnabled:g(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=e=>{T.status===`error`?e.reject(T.error):T.data!==void 0&&e.resolve(T.data)},r=()=>{t(this.#o=T.promise=S())},i=this.#o;switch(i.status){case`pending`:e.queryHash===n.queryHash&&t(i);break;case`fulfilled`:(T.status===`error`||T.data!==i.value)&&r();break;case`rejected`:(T.status!==`error`||T.error!==i.reason)&&r();break}}return T}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!d(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){y.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function M(e,t){return g(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&t.retryOnMount===!1)}function N(e,t){return M(e,t)||e.state.data!==void 0&&P(e,t,t.refetchOnMount)}function P(e,t,n){if(g(t.enabled,e)!==!1&&p(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&I(e,t)}return!1}function F(e,t,n,r){return(e!==t||g(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&I(e,n)}function I(e,t){return g(t.enabled,e)!==!1&&e.isStaleByTime(p(t.staleTime,e))}function L(e,t){return!d(e.getCurrentResult(),t)}var R=class extends a{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),d(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&h(t.mutationKey)!==h(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??m();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){y.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};e?.type===`success`?(this.#r.onSuccess?.(e.data,t,n,r),this.#r.onSettled?.(e.data,null,t,n,r)):e?.type===`error`&&(this.#r.onError?.(e.error,t,n,r),this.#r.onSettled?.(void 0,e.error,t,n,r))}this.listeners.forEach(e=>{e(this.#t)})})}};function z(e=``){if(!w())throw Error(`vue-query hooks can only be used inside setup() function or functions that support injection context.`);let t=v(_(e));if(!t)throw Error(`No 'queryClient' found in Vue context, use 'VueQueryPlugin' to properly initialize the library.`);return t}function B(i,a,s){let c=s||z(),u=t(()=>{let e=a;typeof e==`function`&&(e=e());let t=C(e);typeof t.enabled==`function`&&(t.enabled=t.enabled());let n=c.defaultQueryOptions(t);return n._optimisticResults=c.isRestoring?.value?`isRestoring`:`optimistic`,n}),d=new i(c,u.value),p=u.value.shallow?o(d.getCurrentResult()):r(d.getCurrentResult()),m=()=>{};c.isRestoring&&l(c.isRestoring,e=>{e||(m(),m=d.subscribe(e=>{x(p,e)}))},{immediate:!0});let h=()=>{d.setOptions(u.value),x(p,d.getCurrentResult())};l(u,h),f(()=>{m()});let g=(...e)=>(h(),p.refetch(...e)),_=()=>new Promise((e,t)=>{let r=()=>{},i=()=>{if(u.value.enabled!==!1){d.setOptions(u.value);let i=d.getOptimisticResult(u.value);i.isStale?(r(),d.fetchOptimistic(u.value).then(e,r=>{n(u.value.throwOnError,[r,d.getCurrentQuery()])?t(r):e(d.getCurrentResult())})):(r(),e(i))}};i(),r=l(u,i)});l(()=>p.error,e=>{if(p.isError&&!p.isFetching&&n(u.value.throwOnError,[e,d.getCurrentQuery()]))throw e});let v=e(u.value.shallow?O(p):D(p));for(let e in p)typeof p[e]==`function`&&(v[e]=p[e]);return v.suspense=_,v.refetch=g,v}function V(e,t){return B(j,e,t)}function H(i,a){let s=a||z(),c=t(()=>{let e=typeof i==`function`?i():i;return s.defaultMutationOptions(C(e))}),u=new R(s,c.value),d=c.value.shallow?o(u.getCurrentResult()):r(u.getCurrentResult()),p=u.subscribe(e=>{x(d,e)}),m=(e,t)=>{u.mutate(e,t).catch(()=>{})};l(c,()=>{u.setOptions(c.value)}),f(()=>{p()});let h=e(c.value.shallow?O(d):D(d));return l(()=>d.error,e=>{if(e&&n(c.value.throwOnError,[e]))throw e}),{...h,mutate:m,mutateAsync:d.mutate,reset:d.reset}}function U(){return A()}const W={proxies:[`proxies`],proxyProviders:[`proxy-providers`],rules:[`rules`],ruleProviders:[`rule-providers`],config:[`config`],version:[`version`]};function G(){return V({queryKey:W.rules,queryFn:async()=>{let{rules:e}=await U().get(`rules`).json();return Object.values(e)}})}function K(){return V({queryKey:W.ruleProviders,queryFn:async()=>{let{providers:e}=await U().get(`providers/rules`).json();return Object.values(e)}})}function q(){let e=z();return H({mutationFn:async e=>{await U().put(`providers/rules/${encodeURIComponent(e)}`)},onSuccess:()=>{e.invalidateQueries({queryKey:W.rules}),e.invalidateQueries({queryKey:W.ruleProviders})}})}function J(){return V({queryKey:W.config,queryFn:async()=>U().get(`configs`).json()})}function Y(){let e=z();return H({mutationFn:async({key:e,value:t})=>{await U().patch(`configs`,{json:{[e]:t}})},onSuccess:()=>{e.invalidateQueries({queryKey:W.config})}})}function X(){return V({queryKey:W.version,queryFn:async()=>{let{version:e}=await U().get(`version`).json();return e}})}export{q as a,Y as i,K as n,X as o,G as r,H as s,J as t};