nsthorat's picture
Push
ce592f8
raw
history blame
No virus
34.3 kB
var de=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)};var y=(s,e,t)=>(de(s,e,"read from private field"),t?t.call(s):e.get(s)),P=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},C=(s,e,t,r)=>(de(s,e,"write to private field"),r?r.call(s,t):e.set(s,t),t);import{S as Se,i as Ce,s as Qe,E as N,_ as j,$ as U,m as L,h as E,n as I,a0 as Y,b as ee,J as B,O as Me,a1 as Z,D as X,F as $,q as Te,r as Ae,u as Fe,T as Je,ac as Ve}from"./index.c7ccf096.js";import{r as K,d as Ie}from"./index.273e036c.js";function fe(s){let e,t;return{c(){e=j("title"),t=Te(s[1])},l(r){e=U(r,"title",{});var n=L(e);t=Ae(n,s[1]),n.forEach(E)},m(r,n){ee(r,e,n),B(e,t)},p(r,n){n&2&&Fe(t,r[1])},d(r){r&&E(e)}}}function Ye(s){let e,t,r,n=s[1]&&fe(s),i=[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},{width:s[0]},{height:s[0]},s[2],s[3]],a={};for(let u=0;u<i.length;u+=1)a=N(a,i[u]);return{c(){e=j("svg"),n&&n.c(),t=j("path"),r=j("path"),this.h()},l(u){e=U(u,"svg",{xmlns:!0,viewBox:!0,fill:!0,preserveAspectRatio:!0,width:!0,height:!0});var o=L(e);n&&n.l(o),t=U(o,"path",{d:!0}),L(t).forEach(E),r=U(o,"path",{fill:!0,d:!0,"data-icon-path":!0}),L(r).forEach(E),o.forEach(E),this.h()},h(){I(t,"d","M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2ZM14,21.5908l-5-5L10.5906,15,14,18.4092,21.41,11l1.5957,1.5859Z"),I(r,"fill","none"),I(r,"d","M14 21.591L9 16.591 10.591 15 14 18.409 21.41 11 23.005 12.585 14 21.591z"),I(r,"data-icon-path","inner-path"),Y(e,a)},m(u,o){ee(u,e,o),n&&n.m(e,null),B(e,t),B(e,r)},p(u,[o]){u[1]?n?n.p(u,o):(n=fe(u),n.c(),n.m(e,t)):n&&(n.d(1),n=null),Y(e,a=Me(i,[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},o&1&&{width:u[0]},o&1&&{height:u[0]},o&4&&u[2],o&8&&u[3]]))},i:Z,o:Z,d(u){u&&E(e),n&&n.d()}}}function Ze(s,e,t){let r,n;const i=["size","title"];let a=X(e,i),{size:u=16}=e,{title:o=void 0}=e;return s.$$set=l=>{t(5,e=N(N({},e),$(l))),t(3,a=X(e,i)),"size"in l&&t(0,u=l.size),"title"in l&&t(1,o=l.title)},s.$$.update=()=>{t(4,r=e["aria-label"]||e["aria-labelledby"]||o),t(2,n={"aria-hidden":r?void 0:!0,role:r?"img":void 0,focusable:Number(e.tabindex)===0?!0:void 0})},e=$(e),[u,o,n,a,r]}class Xe extends Se{constructor(e){super(),Ce(this,e,Ze,Ye,Qe,{size:0,title:1})}}const Ht=Xe;function ye(s){let e,t;return{c(){e=j("title"),t=Te(s[1])},l(r){e=U(r,"title",{});var n=L(e);t=Ae(n,s[1]),n.forEach(E)},m(r,n){ee(r,e,n),B(e,t)},p(r,n){n&2&&Fe(t,r[1])},d(r){r&&E(e)}}}function $e(s){let e,t,r,n=s[1]&&ye(s),i=[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},{width:s[0]},{height:s[0]},s[2],s[3]],a={};for(let u=0;u<i.length;u+=1)a=N(a,i[u]);return{c(){e=j("svg"),n&&n.c(),t=j("path"),r=j("path"),this.h()},l(u){e=U(u,"svg",{xmlns:!0,viewBox:!0,fill:!0,preserveAspectRatio:!0,width:!0,height:!0});var o=L(e);n&&n.l(o),t=U(o,"path",{fill:!0,d:!0,"data-icon-path":!0,transform:!0}),L(t).forEach(E),r=U(o,"path",{d:!0}),L(r).forEach(E),o.forEach(E),this.h()},h(){I(t,"fill","none"),I(t,"d","M14.9 7.2H17.1V24.799H14.9z"),I(t,"data-icon-path","inner-path"),I(t,"transform","rotate(-45 16 16)"),I(r,"d","M16,2A13.914,13.914,0,0,0,2,16,13.914,13.914,0,0,0,16,30,13.914,13.914,0,0,0,30,16,13.914,13.914,0,0,0,16,2Zm5.4449,21L9,10.5557,10.5557,9,23,21.4448Z"),Y(e,a)},m(u,o){ee(u,e,o),n&&n.m(e,null),B(e,t),B(e,r)},p(u,[o]){u[1]?n?n.p(u,o):(n=ye(u),n.c(),n.m(e,t)):n&&(n.d(1),n=null),Y(e,a=Me(i,[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},o&1&&{width:u[0]},o&1&&{height:u[0]},o&4&&u[2],o&8&&u[3]]))},i:Z,o:Z,d(u){u&&E(e),n&&n.d()}}}function et(s,e,t){let r,n;const i=["size","title"];let a=X(e,i),{size:u=16}=e,{title:o=void 0}=e;return s.$$set=l=>{t(5,e=N(N({},e),$(l))),t(3,a=X(e,i)),"size"in l&&t(0,u=l.size),"title"in l&&t(1,o=l.title)},s.$$.update=()=>{t(4,r=e["aria-label"]||e["aria-labelledby"]||o),t(2,n={"aria-hidden":r?void 0:!0,role:r?"img":void 0,focusable:Number(e.tabindex)===0?!0:void 0})},e=$(e),[u,o,n,a,r]}class tt extends Se{constructor(e){super(),Ce(this,e,et,$e,Qe,{size:0,title:1})}}const zt=tt;class G{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){const t={listener:e};return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}}const z=typeof window>"u"||"Deno"in window;function st(){}function _t(s,e){return typeof s=="function"?s(e):s}function se(s){return typeof s=="number"&&s>=0&&s!==1/0}function pe(s,e){return s.filter(t=>!e.includes(t))}function rt(s,e,t){const r=s.slice(0);return r[e]=t,r}function nt(s,e){return Math.max(s+(e||0)-Date.now(),0)}function it(s,e,t){return W(s)?typeof e=="function"?{...t,queryKey:s,queryFn:e}:{...e,queryKey:s}:s}function ut(s,e,t){return W(s)?typeof e=="function"?{...t,mutationKey:s,mutationFn:e}:{...e,mutationKey:s}:typeof s=="function"?{...e,mutationFn:s}:{...s}}function Gt(s,e,t){return W(s)?[{...e,queryKey:s},t]:[s||{},e]}function Wt(s,e){const{type:t="all",exact:r,fetchStatus:n,predicate:i,queryKey:a,stale:u}=s;if(W(a)){if(r){if(e.queryHash!==at(a,e.options))return!1}else if(!xe(e.queryKey,a))return!1}if(t!=="all"){const o=e.isActive();if(t==="active"&&!o||t==="inactive"&&o)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||typeof n<"u"&&n!==e.state.fetchStatus||i&&!i(e))}function Jt(s,e){const{exact:t,fetching:r,predicate:n,mutationKey:i}=s;if(W(i)){if(!e.options.mutationKey)return!1;if(t){if(re(e.options.mutationKey)!==re(i))return!1}else if(!xe(e.options.mutationKey,i))return!1}return!(typeof r=="boolean"&&e.state.status==="loading"!==r||n&&!n(e))}function at(s,e){return((e==null?void 0:e.queryKeyHashFn)||re)(s)}function re(s){return JSON.stringify(s,(e,t)=>ie(t)?Object.keys(t).sort().reduce((r,n)=>(r[n]=t[n],r),{}):t)}function xe(s,e){return Pe(s,e)}function Pe(s,e){return s===e?!0:typeof s!=typeof e?!1:s&&e&&typeof s=="object"&&typeof e=="object"?!Object.keys(e).some(t=>!Pe(s[t],e[t])):!1}function De(s,e){if(s===e)return s;const t=be(s)&&be(e);if(t||ie(s)&&ie(e)){const r=t?s.length:Object.keys(s).length,n=t?e:Object.keys(e),i=n.length,a=t?[]:{};let u=0;for(let o=0;o<i;o++){const l=t?o:n[o];a[l]=De(s[l],e[l]),a[l]===s[l]&&u++}return r===i&&u===r?s:a}return e}function ne(s,e){if(s&&!e||e&&!s)return!1;for(const t in s)if(s[t]!==e[t])return!1;return!0}function be(s){return Array.isArray(s)&&s.length===Object.keys(s).length}function ie(s){if(!ve(s))return!1;const e=s.constructor;if(typeof e>"u")return!0;const t=e.prototype;return!(!ve(t)||!t.hasOwnProperty("isPrototypeOf"))}function ve(s){return Object.prototype.toString.call(s)==="[object Object]"}function W(s){return Array.isArray(s)}function je(s){return new Promise(e=>{setTimeout(e,s)})}function me(s){je(0).then(s)}function Vt(){if(typeof AbortController=="function")return new AbortController}function Re(s,e,t){return t.isDataEqual!=null&&t.isDataEqual(s,e)?s:typeof t.structuralSharing=="function"?t.structuralSharing(s,e):t.structuralSharing!==!1?De(s,e):e}class ot extends G{constructor(){super(),this.setup=e=>{if(!z&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),window.addEventListener("focus",t,!1),()=>{window.removeEventListener("visibilitychange",t),window.removeEventListener("focus",t)}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.cleanup)==null||e.call(this),this.cleanup=void 0}}setEventListener(e){var t;this.setup=e,(t=this.cleanup)==null||t.call(this),this.cleanup=e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()})}setFocused(e){this.focused=e,e&&this.onFocus()}onFocus(){this.listeners.forEach(({listener:e})=>{e()})}isFocused(){return typeof this.focused=="boolean"?this.focused:typeof document>"u"?!0:[void 0,"visible","prerender"].includes(document.visibilityState)}}const Ue=new ot,Oe=["online","offline"];class lt extends G{constructor(){super(),this.setup=e=>{if(!z&&window.addEventListener){const t=()=>e();return Oe.forEach(r=>{window.addEventListener(r,t,!1)}),()=>{Oe.forEach(r=>{window.removeEventListener(r,t)})}}}}onSubscribe(){this.cleanup||this.setEventListener(this.setup)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.cleanup)==null||e.call(this),this.cleanup=void 0}}setEventListener(e){var t;this.setup=e,(t=this.cleanup)==null||t.call(this),this.cleanup=e(r=>{typeof r=="boolean"?this.setOnline(r):this.onOnline()})}setOnline(e){this.online=e,e&&this.onOnline()}onOnline(){this.listeners.forEach(({listener:e})=>{e()})}isOnline(){return typeof this.online=="boolean"?this.online:typeof navigator>"u"||typeof navigator.onLine>"u"?!0:navigator.onLine}}const Le=new lt;function ct(s){return Math.min(1e3*2**s,3e4)}function ae(s){return(s??"online")==="online"?Le.isOnline():!0}class qe{constructor(e){this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}}function ht(s){return s instanceof qe}function dt(s){let e=!1,t=0,r=!1,n,i,a;const u=new Promise((f,m)=>{i=f,a=m}),o=f=>{r||(d(new qe(f)),s.abort==null||s.abort())},l=()=>{e=!0},c=()=>{e=!1},h=()=>!Ue.isFocused()||s.networkMode!=="always"&&!Le.isOnline(),g=f=>{r||(r=!0,s.onSuccess==null||s.onSuccess(f),n==null||n(),i(f))},d=f=>{r||(r=!0,s.onError==null||s.onError(f),n==null||n(),a(f))},b=()=>new Promise(f=>{n=m=>{const S=r||!h();return S&&f(m),S},s.onPause==null||s.onPause()}).then(()=>{n=void 0,r||s.onContinue==null||s.onContinue()}),v=()=>{if(r)return;let f;try{f=s.fn()}catch(m){f=Promise.reject(m)}Promise.resolve(f).then(g).catch(m=>{var S,R;if(r)return;const w=(S=s.retry)!=null?S:3,T=(R=s.retryDelay)!=null?R:ct,x=typeof T=="function"?T(t,m):T,p=w===!0||typeof w=="number"&&t<w||typeof w=="function"&&w(t,m);if(e||!p){d(m);return}t++,s.onFail==null||s.onFail(t,m),je(x).then(()=>{if(h())return b()}).then(()=>{e?d(m):v()})})};return ae(s.networkMode)?v():b().then(v),{promise:u,cancel:o,continue:()=>(n==null?void 0:n())?u:Promise.resolve(),cancelRetry:l,continueRetry:c}}const ft=console;function yt(){let s=[],e=0,t=c=>{c()},r=c=>{c()};const n=c=>{let h;e++;try{h=c()}finally{e--,e||u()}return h},i=c=>{e?s.push(c):me(()=>{t(c)})},a=c=>(...h)=>{i(()=>{c(...h)})},u=()=>{const c=s;s=[],c.length&&me(()=>{r(()=>{c.forEach(h=>{t(h)})})})};return{batch:n,batchCalls:a,schedule:i,setNotifyFunction:c=>{t=c},setBatchNotifyFunction:c=>{r=c}}}const M=yt();class pt{destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),se(this.cacheTime)&&(this.gcTimeout=setTimeout(()=>{this.optionalRemove()},this.cacheTime))}updateCacheTime(e){this.cacheTime=Math.max(this.cacheTime||0,e??(z?1/0:5*60*1e3))}clearGcTimeout(){this.gcTimeout&&(clearTimeout(this.gcTimeout),this.gcTimeout=void 0)}}class Yt extends pt{constructor(e){super(),this.defaultOptions=e.defaultOptions,this.mutationId=e.mutationId,this.mutationCache=e.mutationCache,this.logger=e.logger||ft,this.observers=[],this.state=e.state||ke(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options={...this.defaultOptions,...e},this.updateCacheTime(this.options.cacheTime)}get meta(){return this.options.meta}setState(e){this.dispatch({type:"setState",state:e})}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.mutationCache.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.observers=this.observers.filter(t=>t!==e),this.scheduleGc(),this.mutationCache.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.observers.length||(this.state.status==="loading"?this.scheduleGc():this.mutationCache.remove(this))}continue(){var e,t;return(e=(t=this.retryer)==null?void 0:t.continue())!=null?e:this.execute()}async execute(){const e=()=>{var p;return this.retryer=dt({fn:()=>this.options.mutationFn?this.options.mutationFn(this.state.variables):Promise.reject("No mutationFn found"),onFail:(O,H)=>{this.dispatch({type:"failed",failureCount:O,error:H})},onPause:()=>{this.dispatch({type:"pause"})},onContinue:()=>{this.dispatch({type:"continue"})},retry:(p=this.options.retry)!=null?p:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode}),this.retryer.promise},t=this.state.status==="loading";try{var r,n,i,a,u,o,l,c;if(!t){var h,g,d,b;this.dispatch({type:"loading",variables:this.options.variables}),await((h=(g=this.mutationCache.config).onMutate)==null?void 0:h.call(g,this.state.variables,this));const O=await((d=(b=this.options).onMutate)==null?void 0:d.call(b,this.state.variables));O!==this.state.context&&this.dispatch({type:"loading",context:O,variables:this.state.variables})}const p=await e();return await((r=(n=this.mutationCache.config).onSuccess)==null?void 0:r.call(n,p,this.state.variables,this.state.context,this)),await((i=(a=this.options).onSuccess)==null?void 0:i.call(a,p,this.state.variables,this.state.context)),await((u=(o=this.mutationCache.config).onSettled)==null?void 0:u.call(o,p,null,this.state.variables,this.state.context,this)),await((l=(c=this.options).onSettled)==null?void 0:l.call(c,p,null,this.state.variables,this.state.context)),this.dispatch({type:"success",data:p}),p}catch(p){try{var v,f,m,S,R,w,T,x;throw await((v=(f=this.mutationCache.config).onError)==null?void 0:v.call(f,p,this.state.variables,this.state.context,this)),await((m=(S=this.options).onError)==null?void 0:m.call(S,p,this.state.variables,this.state.context)),await((R=(w=this.mutationCache.config).onSettled)==null?void 0:R.call(w,void 0,p,this.state.variables,this.state.context,this)),await((T=(x=this.options).onSettled)==null?void 0:T.call(x,void 0,p,this.state.variables,this.state.context)),p}finally{this.dispatch({type:"error",error:p})}}}dispatch(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"loading":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:!ae(this.options.networkMode),status:"loading",variables:e.variables};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"};case"setState":return{...r,...e.state}}};this.state=t(this.state),M.batch(()=>{this.observers.forEach(r=>{r.onMutationUpdate(e)}),this.mutationCache.notify({mutation:this,type:"updated",action:e})})}}function ke(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0}}class Ne extends G{constructor(e,t){super(),this.client=e,this.options=t,this.trackedProps=new Set,this.selectError=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.remove=this.remove.bind(this),this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.currentQuery.addObserver(this),ge(this.currentQuery,this.options)&&this.executeFetch(),this.updateTimers())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ue(this.currentQuery,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ue(this.currentQuery,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.clearStaleTimeout(),this.clearRefetchInterval(),this.currentQuery.removeObserver(this)}setOptions(e,t){const r=this.options,n=this.currentQuery;if(this.options=this.client.defaultQueryOptions(e),ne(r,this.options)||this.client.getQueryCache().notify({type:"observerOptionsUpdated",query:this.currentQuery,observer:this}),typeof this.options.enabled<"u"&&typeof this.options.enabled!="boolean")throw new Error("Expected enabled to be a boolean");this.options.queryKey||(this.options.queryKey=r.queryKey),this.updateQuery();const i=this.hasListeners();i&&we(this.currentQuery,n,this.options,r)&&this.executeFetch(),this.updateResult(t),i&&(this.currentQuery!==n||this.options.enabled!==r.enabled||this.options.staleTime!==r.staleTime)&&this.updateStaleTimeout();const a=this.computeRefetchInterval();i&&(this.currentQuery!==n||this.options.enabled!==r.enabled||a!==this.currentRefetchInterval)&&this.updateRefetchInterval(a)}getOptimisticResult(e){const t=this.client.getQueryCache().build(this.client,e);return this.createResult(t,e)}getCurrentResult(){return this.currentResult}trackResult(e){const t={};return Object.keys(e).forEach(r=>{Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:()=>(this.trackedProps.add(r),e[r])})}),t}getCurrentQuery(){return this.currentQuery}remove(){this.client.getQueryCache().remove(this.currentQuery)}refetch({refetchPage:e,...t}={}){return this.fetch({...t,meta:{refetchPage:e}})}fetchOptimistic(e){const t=this.client.defaultQueryOptions(e),r=this.client.getQueryCache().build(this.client,t);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,t))}fetch(e){var t;return this.executeFetch({...e,cancelRefetch:(t=e.cancelRefetch)!=null?t:!0}).then(()=>(this.updateResult(),this.currentResult))}executeFetch(e){this.updateQuery();let t=this.currentQuery.fetch(this.options,e);return e!=null&&e.throwOnError||(t=t.catch(st)),t}updateStaleTimeout(){if(this.clearStaleTimeout(),z||this.currentResult.isStale||!se(this.options.staleTime))return;const t=nt(this.currentResult.dataUpdatedAt,this.options.staleTime)+1;this.staleTimeoutId=setTimeout(()=>{this.currentResult.isStale||this.updateResult()},t)}computeRefetchInterval(){var e;return typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.currentResult.data,this.currentQuery):(e=this.options.refetchInterval)!=null?e:!1}updateRefetchInterval(e){this.clearRefetchInterval(),this.currentRefetchInterval=e,!(z||this.options.enabled===!1||!se(this.currentRefetchInterval)||this.currentRefetchInterval===0)&&(this.refetchIntervalId=setInterval(()=>{(this.options.refetchIntervalInBackground||Ue.isFocused())&&this.executeFetch()},this.currentRefetchInterval))}updateTimers(){this.updateStaleTimeout(),this.updateRefetchInterval(this.computeRefetchInterval())}clearStaleTimeout(){this.staleTimeoutId&&(clearTimeout(this.staleTimeoutId),this.staleTimeoutId=void 0)}clearRefetchInterval(){this.refetchIntervalId&&(clearInterval(this.refetchIntervalId),this.refetchIntervalId=void 0)}createResult(e,t){const r=this.currentQuery,n=this.options,i=this.currentResult,a=this.currentResultState,u=this.currentResultOptions,o=e!==r,l=o?e.state:this.currentQueryInitialState,c=o?this.currentResult:this.previousQueryResult,{state:h}=e;let{dataUpdatedAt:g,error:d,errorUpdatedAt:b,fetchStatus:v,status:f}=h,m=!1,S=!1,R;if(t._optimisticResults){const O=this.hasListeners(),H=!O&&ge(e,t),We=O&&we(e,r,t,n);(H||We)&&(v=ae(e.options.networkMode)?"fetching":"paused",g||(f="loading")),t._optimisticResults==="isRestoring"&&(v="idle")}if(t.keepPreviousData&&!h.dataUpdatedAt&&c!=null&&c.isSuccess&&f!=="error")R=c.data,g=c.dataUpdatedAt,f=c.status,m=!0;else if(t.select&&typeof h.data<"u")if(i&&h.data===(a==null?void 0:a.data)&&t.select===this.selectFn)R=this.selectResult;else try{this.selectFn=t.select,R=t.select(h.data),R=Re(i==null?void 0:i.data,R,t),this.selectResult=R,this.selectError=null}catch(O){this.selectError=O}else R=h.data;if(typeof t.placeholderData<"u"&&typeof R>"u"&&f==="loading"){let O;if(i!=null&&i.isPlaceholderData&&t.placeholderData===(u==null?void 0:u.placeholderData))O=i.data;else if(O=typeof t.placeholderData=="function"?t.placeholderData():t.placeholderData,t.select&&typeof O<"u")try{O=t.select(O),this.selectError=null}catch(H){this.selectError=H}typeof O<"u"&&(f="success",R=Re(i==null?void 0:i.data,O,t),S=!0)}this.selectError&&(d=this.selectError,R=this.selectResult,b=Date.now(),f="error");const w=v==="fetching",T=f==="loading",x=f==="error";return{status:f,fetchStatus:v,isLoading:T,isSuccess:f==="success",isError:x,isInitialLoading:T&&w,data:R,dataUpdatedAt:g,error:d,errorUpdatedAt:b,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>l.dataUpdateCount||h.errorUpdateCount>l.errorUpdateCount,isFetching:w,isRefetching:w&&!T,isLoadingError:x&&h.dataUpdatedAt===0,isPaused:v==="paused",isPlaceholderData:S,isPreviousData:m,isRefetchError:x&&h.dataUpdatedAt!==0,isStale:oe(e,t),refetch:this.refetch,remove:this.remove}}updateResult(e){const t=this.currentResult,r=this.createResult(this.currentQuery,this.options);if(this.currentResultState=this.currentQuery.state,this.currentResultOptions=this.options,ne(r,t))return;this.currentResult=r;const n={cache:!0},i=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options;if(a==="all"||!a&&!this.trackedProps.size)return!0;const u=new Set(a??this.trackedProps);return this.options.useErrorBoundary&&u.add("error"),Object.keys(this.currentResult).some(o=>{const l=o;return this.currentResult[l]!==t[l]&&u.has(l)})};(e==null?void 0:e.listeners)!==!1&&i()&&(n.listeners=!0),this.notify({...n,...e})}updateQuery(){const e=this.client.getQueryCache().build(this.client,this.options);if(e===this.currentQuery)return;const t=this.currentQuery;this.currentQuery=e,this.currentQueryInitialState=e.state,this.previousQueryResult=this.currentResult,this.hasListeners()&&(t==null||t.removeObserver(this),e.addObserver(this))}onQueryUpdate(e){const t={};e.type==="success"?t.onSuccess=!e.manual:e.type==="error"&&!ht(e.error)&&(t.onError=!0),this.updateResult(t),this.hasListeners()&&this.updateTimers()}notify(e){M.batch(()=>{if(e.onSuccess){var t,r,n,i;(t=(r=this.options).onSuccess)==null||t.call(r,this.currentResult.data),(n=(i=this.options).onSettled)==null||n.call(i,this.currentResult.data,null)}else if(e.onError){var a,u,o,l;(a=(u=this.options).onError)==null||a.call(u,this.currentResult.error),(o=(l=this.options).onSettled)==null||o.call(l,void 0,this.currentResult.error)}e.listeners&&this.listeners.forEach(({listener:c})=>{c(this.currentResult)}),e.cache&&this.client.getQueryCache().notify({query:this.currentQuery,type:"observerResultsUpdated"})})}}function bt(s,e){return e.enabled!==!1&&!s.state.dataUpdatedAt&&!(s.state.status==="error"&&e.retryOnMount===!1)}function ge(s,e){return bt(s,e)||s.state.dataUpdatedAt>0&&ue(s,e,e.refetchOnMount)}function ue(s,e,t){if(e.enabled!==!1){const r=typeof t=="function"?t(s):t;return r==="always"||r!==!1&&oe(s,e)}return!1}function we(s,e,t,r){return t.enabled!==!1&&(s!==e||r.enabled===!1)&&(!t.suspense||s.state.status!=="error")&&oe(s,t)}function oe(s,e){return s.isStaleByTime(e.staleTime)}class vt extends G{constructor(e,t){super(),this.client=e,this.queries=[],this.result=[],this.observers=[],this.observersMap={},t&&this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.observers.forEach(e=>{e.subscribe(t=>{this.onUpdate(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.observers.forEach(e=>{e.destroy()})}setQueries(e,t){this.queries=e,M.batch(()=>{const r=this.observers,n=this.findMatchingObservers(this.queries);n.forEach(l=>l.observer.setOptions(l.defaultedQueryOptions,t));const i=n.map(l=>l.observer),a=Object.fromEntries(i.map(l=>[l.options.queryHash,l])),u=i.map(l=>l.getCurrentResult()),o=i.some((l,c)=>l!==r[c]);r.length===i.length&&!o||(this.observers=i,this.observersMap=a,this.result=u,this.hasListeners()&&(pe(r,i).forEach(l=>{l.destroy()}),pe(i,r).forEach(l=>{l.subscribe(c=>{this.onUpdate(l,c)})}),this.notify()))})}getCurrentResult(){return this.result}getQueries(){return this.observers.map(e=>e.getCurrentQuery())}getObservers(){return this.observers}getOptimisticResult(e){return this.findMatchingObservers(e).map(t=>t.observer.getOptimisticResult(t.defaultedQueryOptions))}findMatchingObservers(e){const t=this.observers,r=new Map(t.map(d=>[d.options.queryHash,d])),n=e.map(d=>this.client.defaultQueryOptions(d)),i=n.flatMap(d=>{const b=r.get(d.queryHash);return b!=null?[{defaultedQueryOptions:d,observer:b}]:[]}),a=new Set(i.map(d=>d.defaultedQueryOptions.queryHash)),u=n.filter(d=>!a.has(d.queryHash)),o=new Set(i.map(d=>d.observer)),l=t.filter(d=>!o.has(d)),c=d=>{const b=this.client.defaultQueryOptions(d),v=this.observersMap[b.queryHash];return v??new Ne(this.client,b)},h=u.map((d,b)=>{if(d.keepPreviousData){const v=l[b];if(v!==void 0)return{defaultedQueryOptions:d,observer:v}}return{defaultedQueryOptions:d,observer:c(d)}}),g=(d,b)=>n.indexOf(d.defaultedQueryOptions)-n.indexOf(b.defaultedQueryOptions);return i.concat(h).sort(g)}onUpdate(e,t){const r=this.observers.indexOf(e);r!==-1&&(this.result=rt(this.result,r,t),this.notify())}notify(){M.batch(()=>{this.listeners.forEach(({listener:e})=>{e(this.result)})})}}class mt extends G{constructor(e,t){super(),this.client=e,this.setOptions(t),this.bindMethods(),this.updateResult()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var t;const r=this.options;this.options=this.client.defaultMutationOptions(e),ne(r,this.options)||this.client.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.currentMutation,observer:this}),(t=this.currentMutation)==null||t.setOptions(this.options)}onUnsubscribe(){if(!this.hasListeners()){var e;(e=this.currentMutation)==null||e.removeObserver(this)}}onMutationUpdate(e){this.updateResult();const t={listeners:!0};e.type==="success"?t.onSuccess=!0:e.type==="error"&&(t.onError=!0),this.notify(t)}getCurrentResult(){return this.currentResult}reset(){this.currentMutation=void 0,this.updateResult(),this.notify({listeners:!0})}mutate(e,t){return this.mutateOptions=t,this.currentMutation&&this.currentMutation.removeObserver(this),this.currentMutation=this.client.getMutationCache().build(this.client,{...this.options,variables:typeof e<"u"?e:this.options.variables}),this.currentMutation.addObserver(this),this.currentMutation.execute()}updateResult(){const e=this.currentMutation?this.currentMutation.state:ke(),t={...e,isLoading:e.status==="loading",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset};this.currentResult=t}notify(e){M.batch(()=>{if(this.mutateOptions&&this.hasListeners()){if(e.onSuccess){var t,r,n,i;(t=(r=this.mutateOptions).onSuccess)==null||t.call(r,this.currentResult.data,this.currentResult.variables,this.currentResult.context),(n=(i=this.mutateOptions).onSettled)==null||n.call(i,this.currentResult.data,null,this.currentResult.variables,this.currentResult.context)}else if(e.onError){var a,u,o,l;(a=(u=this.mutateOptions).onError)==null||a.call(u,this.currentResult.error,this.currentResult.variables,this.currentResult.context),(o=(l=this.mutateOptions).onSettled)==null||o.call(l,void 0,this.currentResult.error,this.currentResult.variables,this.currentResult.context)}}e.listeners&&this.listeners.forEach(({listener:c})=>{c(this.currentResult)})})}}const Be="$$_queryClient",Rt=()=>{const s=Ve(Be);if(!s)throw new Error("No QueryClient was found in Svelte context. Did you forget to wrap your component with QueryClientProvider?");return s},Zt=s=>{Je(Be,s)};function le(){return Rt()}function Ot(s,e){const t=le(),r=t.defaultQueryOptions(s);r._optimisticResults="optimistic";let n=new e(t,r);r.onError&&(r.onError=M.batchCalls(r.onError)),r.onSuccess&&(r.onSuccess=M.batchCalls(r.onSuccess)),r.onSettled&&(r.onSettled=M.batchCalls(r.onSettled)),K(n).subscribe(u=>{n=u,n.setOptions(r,{listeners:!1})});const i=K(n.getCurrentResult(),u=>n.subscribe(M.batchCalls(u))),{subscribe:a}=Ie(i,u=>(u=n.getOptimisticResult(r),r.notifyOnChangeProps?u:n.trackResult(u)));return{subscribe:a}}function gt(s,e,t){const r=it(s,e,t);return Ot(r,Ne)}function wt(s){const e=le();function t(a){return a.map(u=>{const o=e.defaultQueryOptions(u);return o._optimisticResults="optimistic",o})}const r=t(s);let n=new vt(e,r);K(n).subscribe(a=>{n=a,n.setQueries(r,{listeners:!1})});const{subscribe:i}=K(n.getOptimisticResult(r),a=>n.subscribe(M.batchCalls(a)));return{subscribe:i}}function Et(s,e,t){const r=ut(s,e,t),n=le();let i=new mt(n,r),a;K(i).subscribe(l=>{i=l,a=(c,h)=>{i.mutate(c,h).catch(St)},i.setOptions(r)});const u=K(i.getCurrentResult(),l=>i.subscribe(M.batchCalls(c=>l(c)))),{subscribe:o}=Ie(u,l=>({...l,mutate:a,mutateAsync:l.mutate}));return{subscribe:o}}function St(){}class Ee extends Error{constructor(e,t,r){super(r),this.name="ApiError",this.url=t.url,this.status=t.status,this.statusText=t.statusText,this.body=t.body,this.request=e}}class Ct extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}}var A,F,Q,D,q,_,k;class Qt{constructor(e){P(this,A,void 0);P(this,F,void 0);P(this,Q,void 0);P(this,D,void 0);P(this,q,void 0);P(this,_,void 0);P(this,k,void 0);C(this,A,!1),C(this,F,!1),C(this,Q,!1),C(this,D,[]),C(this,q,new Promise((t,r)=>{C(this,_,t),C(this,k,r);const n=u=>{var o;y(this,A)||y(this,F)||y(this,Q)||(C(this,A,!0),(o=y(this,_))==null||o.call(this,u))},i=u=>{var o;y(this,A)||y(this,F)||y(this,Q)||(C(this,F,!0),(o=y(this,k))==null||o.call(this,u))},a=u=>{y(this,A)||y(this,F)||y(this,Q)||y(this,D).push(u)};return Object.defineProperty(a,"isResolved",{get:()=>y(this,A)}),Object.defineProperty(a,"isRejected",{get:()=>y(this,F)}),Object.defineProperty(a,"isCancelled",{get:()=>y(this,Q)}),e(n,i,a)}))}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,t){return y(this,q).then(e,t)}catch(e){return y(this,q).catch(e)}finally(e){return y(this,q).finally(e)}cancel(){var e;if(!(y(this,A)||y(this,F)||y(this,Q))){if(C(this,Q,!0),y(this,D).length)try{for(const t of y(this,D))t()}catch(t){console.warn("Cancellation threw an error",t);return}y(this,D).length=0,(e=y(this,k))==null||e.call(this,new Ct("Request aborted"))}}get isCancelled(){return y(this,Q)}}A=new WeakMap,F=new WeakMap,Q=new WeakMap,D=new WeakMap,q=new WeakMap,_=new WeakMap,k=new WeakMap;const Ke={BASE:"",VERSION:"0.1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0},ce=s=>s!=null,J=s=>typeof s=="string",te=s=>J(s)&&s!=="",he=s=>typeof s=="object"&&typeof s.type=="string"&&typeof s.stream=="function"&&typeof s.arrayBuffer=="function"&&typeof s.constructor=="function"&&typeof s.constructor.name=="string"&&/^(Blob|File)$/.test(s.constructor.name)&&/^(Blob|File)$/.test(s[Symbol.toStringTag]),He=s=>s instanceof FormData,Mt=s=>{try{return btoa(s)}catch{return Buffer.from(s).toString("base64")}},Tt=s=>{const e=[],t=(n,i)=>{e.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`)},r=(n,i)=>{ce(i)&&(Array.isArray(i)?i.forEach(a=>{r(n,a)}):typeof i=="object"?Object.entries(i).forEach(([a,u])=>{r(`${n}[${a}]`,u)}):t(n,i))};return Object.entries(s).forEach(([n,i])=>{r(n,i)}),e.length>0?`?${e.join("&")}`:""},At=(s,e)=>{const t=s.ENCODE_PATH||encodeURI,r=e.url.replace("{api-version}",s.VERSION).replace(/{(.*?)}/g,(i,a)=>{var u;return(u=e.path)!=null&&u.hasOwnProperty(a)?t(String(e.path[a])):i}),n=`${s.BASE}${r}`;return e.query?`${n}${Tt(e.query)}`:n},Ft=s=>{if(s.formData){const e=new FormData,t=(r,n)=>{J(n)||he(n)?e.append(r,n):e.append(r,JSON.stringify(n))};return Object.entries(s.formData).filter(([r,n])=>ce(n)).forEach(([r,n])=>{Array.isArray(n)?n.forEach(i=>t(r,i)):t(r,n)}),e}},V=async(s,e)=>typeof e=="function"?e(s):e,It=async(s,e)=>{const t=await V(e,s.TOKEN),r=await V(e,s.USERNAME),n=await V(e,s.PASSWORD),i=await V(e,s.HEADERS),a=Object.entries({Accept:"application/json",...i,...e.headers}).filter(([u,o])=>ce(o)).reduce((u,[o,l])=>({...u,[o]:String(l)}),{});if(te(t)&&(a.Authorization=`Bearer ${t}`),te(r)&&te(n)){const u=Mt(`${r}:${n}`);a.Authorization=`Basic ${u}`}return e.body&&(e.mediaType?a["Content-Type"]=e.mediaType:he(e.body)?a["Content-Type"]=e.body.type||"application/octet-stream":J(e.body)?a["Content-Type"]="text/plain":He(e.body)||(a["Content-Type"]="application/json")),new Headers(a)},xt=s=>{var e;if(s.body!==void 0)return(e=s.mediaType)!=null&&e.includes("/json")?JSON.stringify(s.body):J(s.body)||he(s.body)||He(s.body)?s.body:JSON.stringify(s.body)},Pt=async(s,e,t,r,n,i,a)=>{const u=new AbortController,o={headers:i,body:r??n,method:e.method,signal:u.signal};return s.WITH_CREDENTIALS&&(o.credentials=s.CREDENTIALS),a(()=>u.abort()),await fetch(t,o)},Dt=(s,e)=>{if(e){const t=s.headers.get(e);if(J(t))return t}},jt=async s=>{if(s.status!==204)try{const e=s.headers.get("Content-Type");if(e)return["application/json","application/problem+json"].some(n=>e.toLowerCase().startsWith(n))?await s.json():await s.text()}catch(e){console.error(e)}},Ut=(s,e)=>{const r={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...s.errors}[e.status];if(r)throw new Ee(s,e,r);if(!e.ok)throw new Ee(s,e,"Generic Error")},ze=(s,e)=>new Qt(async(t,r,n)=>{try{const i=At(s,e),a=Ft(e),u=xt(e),o=await It(s,e);if(!n.isCancelled){const l=await Pt(s,e,i,u,a,o,n),c=await jt(l),h=Dt(l,e.responseHeader),g={url:i,ok:l.ok,status:l.status,statusText:l.statusText,body:h??c};Ut(e,g),t(g.body)}}catch(i){r(i)}});class Lt{static serverStatus(){return ze(Ke,{method:"GET",url:"/api/v1/status"})}}class qt{static getTaskManifest(){return ze(Ke,{method:"GET",url:"/api/v1/tasks/"})}}const _e=(s,e,...t)=>[...s,e,...t];function Ge(s,e,t={}){return e=Array.isArray(e)?e:[e],(...r)=>gt({queryKey:_e(e,s.name,...r),queryFn:()=>s(...r),...t})}function Xt(s,e,t=[]){return e=Array.isArray(e)?e:[e],r=>{const n=r.map(i=>({queryKey:_e(e,s.name,...i),queryFn:()=>s(...i),...t}));return wt(n)}}function $t(s,e={}){return()=>Et({mutationFn:t=>s(...t),...e})}const es=Ge(Lt.serverStatus,"server_status"),kt="tasks",ts=Ge(qt.getTaskManifest,kt,{staleTime:500,refetchInterval:500,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0});export{re as A,xe as B,Ht as C,zt as E,Yt as M,Ke as O,Ne as Q,pt as R,G as S,kt as T,es as a,$t as b,Ge as c,gt as d,Ot as e,Xt as f,ft as g,Re as h,Vt as i,dt as j,M as k,ht as l,ae as m,st as n,at as o,it as p,ts as q,ze as r,Zt as s,nt as t,Gt as u,Wt as v,Jt as w,Ue as x,Le as y,_t as z};