@av-pi-studio/web-client 0.0.24 → 0.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/web/assets/{BinaryFallbackViewer-BnWhdpeg.js → BinaryFallbackViewer-mLjhu11M.js} +2 -2
  2. package/dist/web/assets/{BinaryFallbackViewer-BnWhdpeg.js.map → BinaryFallbackViewer-mLjhu11M.js.map} +1 -1
  3. package/dist/web/assets/ChatPanel-B_B_2aOA.js +3 -0
  4. package/dist/web/assets/ChatPanel-B_B_2aOA.js.map +1 -0
  5. package/dist/web/assets/{CodeView-CtOlx2Hf.js → CodeView-CB09dqGQ.js} +2 -2
  6. package/dist/web/assets/{CodeView-CtOlx2Hf.js.map → CodeView-CB09dqGQ.js.map} +1 -1
  7. package/dist/web/assets/{FilePanel-CgECH-BF.js → FilePanel-Hla4aEUX.js} +3 -3
  8. package/dist/web/assets/{FilePanel-CgECH-BF.js.map → FilePanel-Hla4aEUX.js.map} +1 -1
  9. package/dist/web/assets/{ImageViewer-DufNRX54.js → ImageViewer-DtVjY-TF.js} +2 -2
  10. package/dist/web/assets/{ImageViewer-DufNRX54.js.map → ImageViewer-DtVjY-TF.js.map} +1 -1
  11. package/dist/web/assets/{MarkdownFileViewer-DDs4bgjE.js → MarkdownFileViewer-CCq6ncYt.js} +2 -2
  12. package/dist/web/assets/{MarkdownFileViewer-DDs4bgjE.js.map → MarkdownFileViewer-CCq6ncYt.js.map} +1 -1
  13. package/dist/web/assets/{TerminalPanel-BuhO09jx.js → TerminalPanel-CpqJXnEn.js} +2 -2
  14. package/dist/web/assets/{TerminalPanel-BuhO09jx.js.map → TerminalPanel-CpqJXnEn.js.map} +1 -1
  15. package/dist/web/assets/{TextViewer-fQRmhUYA.js → TextViewer-CcF-CYR9.js} +2 -2
  16. package/dist/web/assets/{TextViewer-fQRmhUYA.js.map → TextViewer-CcF-CYR9.js.map} +1 -1
  17. package/dist/web/assets/{VideoViewer-CJRC70tG.js → VideoViewer-qOKrbk4G.js} +2 -2
  18. package/dist/web/assets/{VideoViewer-CJRC70tG.js.map → VideoViewer-qOKrbk4G.js.map} +1 -1
  19. package/dist/web/assets/{index-Czdb4qso.js → index-Bo913WdX.js} +3 -3
  20. package/dist/web/assets/{index-Czdb4qso.js.map → index-Bo913WdX.js.map} +1 -1
  21. package/dist/web/assets/{use-file-download-DGFPkZIR.js → use-file-download-DBTB0i17.js} +2 -2
  22. package/dist/web/assets/{use-file-download-DGFPkZIR.js.map → use-file-download-DBTB0i17.js.map} +1 -1
  23. package/dist/web/assets/{vendor-query-D5H9KBcL.js → vendor-query-AtKBh_Yt.js} +2 -2
  24. package/dist/web/assets/{vendor-query-D5H9KBcL.js.map → vendor-query-AtKBh_Yt.js.map} +1 -1
  25. package/dist/web/index.html +2 -2
  26. package/package.json +3 -3
  27. package/dist/web/assets/ChatPanel-CpySMxiE.js +0 -3
  28. package/dist/web/assets/ChatPanel-CpySMxiE.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{r as a}from"./vendor-react-BoIQBqDW.js";import{u as f}from"./vendor-query-D5H9KBcL.js";import{a as s,c as m,r as y}from"./index-Czdb4qso.js";function p(o,u=!0){var i;const l=s(e=>e.client),n=s(e=>e.daemon),c=f({queryKey:y.fileDownload(o),queryFn:async()=>{if(!l||!n)throw new Error("not connected");const e=await m(n).download(o),t=new Blob([Uint8Array.from(e.bytes)],{type:e.mimeType||"application/octet-stream"});return{objectUrl:URL.createObjectURL(t),mimeType:e.mimeType,fileName:e.fileName}},enabled:!!l&&!!n&&!!o&&u,staleTime:1/0,gcTime:0}),r=a.useRef(null);return a.useEffect(()=>{var t;const e=((t=c.data)==null?void 0:t.objectUrl)??null;e&&r.current&&r.current!==e&&URL.revokeObjectURL(r.current),r.current=e},[(i=c.data)==null?void 0:i.objectUrl]),a.useEffect(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]),c}export{p as u};
2
- //# sourceMappingURL=use-file-download-DGFPkZIR.js.map
1
+ import{r as a}from"./vendor-react-BoIQBqDW.js";import{u as f}from"./vendor-query-AtKBh_Yt.js";import{a as s,c as m,r as y}from"./index-Bo913WdX.js";function p(o,u=!0){var i;const l=s(e=>e.client),n=s(e=>e.daemon),c=f({queryKey:y.fileDownload(o),queryFn:async()=>{if(!l||!n)throw new Error("not connected");const e=await m(n).download(o),t=new Blob([Uint8Array.from(e.bytes)],{type:e.mimeType||"application/octet-stream"});return{objectUrl:URL.createObjectURL(t),mimeType:e.mimeType,fileName:e.fileName}},enabled:!!l&&!!n&&!!o&&u,staleTime:1/0,gcTime:0}),r=a.useRef(null);return a.useEffect(()=>{var t;const e=((t=c.data)==null?void 0:t.objectUrl)??null;e&&r.current&&r.current!==e&&URL.revokeObjectURL(r.current),r.current=e},[(i=c.data)==null?void 0:i.objectUrl]),a.useEffect(()=>()=>{r.current&&URL.revokeObjectURL(r.current)},[]),c}export{p as u};
2
+ //# sourceMappingURL=use-file-download-DBTB0i17.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-file-download-DGFPkZIR.js","sources":["../../../src/hooks/use-file-download.ts"],"sourcesContent":["/**\n * `use-file-download` — TanStack Query wrapper over the binary file-transfer download path\n * (`file_download_token_request` → `file_download_request` → chunked `Begin`/`Chunk`/`End`\n * binary frames), for viewers that need raw bytes rather than the UTF-8 preview\n * `file_read_request` returns (images, video — POC_TO_APP_PLAN_UI.md §4.5 follow-up: modular\n * file preview). Resolves to an object URL, revoked once superseded by a new one or once this\n * consumer unmounts.\n */\n\nimport { useEffect, useRef } from \"react\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useConnectionStore } from \"@pi-studio-ui/lib/connection/connection-store.js\";\nimport { rpcKeys } from \"@pi-studio-ui/lib/connection/rpc-keys.js\";\nimport { transferFor } from \"./file-transfer-instance.js\";\n\nexport interface FileDownload {\n objectUrl: string;\n mimeType?: string;\n fileName?: string;\n}\n\nexport function useFileDownload(path: string, enabled = true) {\n const client = useConnectionStore((s) => s.client);\n const daemon = useConnectionStore((s) => s.daemon);\n\n const query = useQuery({\n queryKey: rpcKeys.fileDownload(path),\n queryFn: async (): Promise<FileDownload> => {\n if (!client || !daemon) throw new Error(\"not connected\");\n const file = await transferFor(daemon).download(path);\n // `Blob`'s DOM typings require an `ArrayBuffer`-backed view; the assembled `Uint8Array`'s\n // `ArrayBufferLike` backing (a decode-time implementation detail) doesn't satisfy that on\n // its own, so copy into a plain `ArrayBuffer`-backed `Uint8Array` first.\n const blob = new Blob([Uint8Array.from(file.bytes)], {\n type: file.mimeType || \"application/octet-stream\",\n });\n return { objectUrl: URL.createObjectURL(blob), mimeType: file.mimeType, fileName: file.fileName };\n },\n enabled: Boolean(client) && Boolean(daemon) && Boolean(path) && enabled,\n // Object URLs are process-local, non-serializable browser resources — never persist them or\n // silently refetch behind this hook's back (that would leak the previous blob's URL).\n staleTime: Infinity,\n gcTime: 0,\n });\n\n // Revoke the previous object URL once a new one supersedes it, and the current one on unmount\n // — TanStack Query's cache has no notion that this value owns a browser resource to release.\n const urlRef = useRef<string | null>(null);\n useEffect(() => {\n const nextUrl = query.data?.objectUrl ?? null;\n if (nextUrl && urlRef.current && urlRef.current !== nextUrl) {\n URL.revokeObjectURL(urlRef.current);\n }\n urlRef.current = nextUrl;\n }, [query.data?.objectUrl]);\n\n useEffect(() => {\n return () => {\n if (urlRef.current) URL.revokeObjectURL(urlRef.current);\n };\n }, []);\n\n return query;\n}\n"],"names":["useFileDownload","path","enabled","client","useConnectionStore","s","daemon","query","useQuery","rpcKeys","file","transferFor","blob","urlRef","useRef","useEffect","nextUrl","_a"],"mappings":"oJAqBO,SAASA,EAAgBC,EAAcC,EAAU,GAAM,OAC5D,MAAMC,EAASC,EAAoBC,GAAMA,EAAE,MAAM,EAC3CC,EAASF,EAAoBC,GAAMA,EAAE,MAAM,EAE3CE,EAAQC,EAAS,CACrB,SAAUC,EAAQ,aAAaR,CAAI,EACnC,QAAS,SAAmC,CAC1C,GAAI,CAACE,GAAU,CAACG,EAAQ,MAAM,IAAI,MAAM,eAAe,EACvD,MAAMI,EAAO,MAAMC,EAAYL,CAAM,EAAE,SAASL,CAAI,EAI9CW,EAAO,IAAI,KAAK,CAAC,WAAW,KAAKF,EAAK,KAAK,CAAC,EAAG,CACnD,KAAMA,EAAK,UAAY,0BAAA,CACxB,EACD,MAAO,CAAE,UAAW,IAAI,gBAAgBE,CAAI,EAAG,SAAUF,EAAK,SAAU,SAAUA,EAAK,QAAA,CACzF,EACA,QAAS,EAAQP,GAAW,EAAQG,GAAW,EAAQL,GAASC,EAGhE,UAAW,IACX,OAAQ,CAAA,CACT,EAIKW,EAASC,EAAAA,OAAsB,IAAI,EACzCC,OAAAA,EAAAA,UAAU,IAAM,OACd,MAAMC,IAAUC,EAAAV,EAAM,OAAN,YAAAU,EAAY,YAAa,KACrCD,GAAWH,EAAO,SAAWA,EAAO,UAAYG,GAClD,IAAI,gBAAgBH,EAAO,OAAO,EAEpCA,EAAO,QAAUG,CACnB,EAAG,EAACC,EAAAV,EAAM,OAAN,YAAAU,EAAY,SAAS,CAAC,EAE1BF,EAAAA,UAAU,IACD,IAAM,CACPF,EAAO,SAAS,IAAI,gBAAgBA,EAAO,OAAO,CACxD,EACC,CAAA,CAAE,EAEEN,CACT"}
1
+ {"version":3,"file":"use-file-download-DBTB0i17.js","sources":["../../../src/hooks/use-file-download.ts"],"sourcesContent":["/**\n * `use-file-download` — TanStack Query wrapper over the binary file-transfer download path\n * (`file_download_token_request` → `file_download_request` → chunked `Begin`/`Chunk`/`End`\n * binary frames), for viewers that need raw bytes rather than the UTF-8 preview\n * `file_read_request` returns (images, video — POC_TO_APP_PLAN_UI.md §4.5 follow-up: modular\n * file preview). Resolves to an object URL, revoked once superseded by a new one or once this\n * consumer unmounts.\n */\n\nimport { useEffect, useRef } from \"react\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useConnectionStore } from \"@pi-studio-ui/lib/connection/connection-store.js\";\nimport { rpcKeys } from \"@pi-studio-ui/lib/connection/rpc-keys.js\";\nimport { transferFor } from \"./file-transfer-instance.js\";\n\nexport interface FileDownload {\n objectUrl: string;\n mimeType?: string;\n fileName?: string;\n}\n\nexport function useFileDownload(path: string, enabled = true) {\n const client = useConnectionStore((s) => s.client);\n const daemon = useConnectionStore((s) => s.daemon);\n\n const query = useQuery({\n queryKey: rpcKeys.fileDownload(path),\n queryFn: async (): Promise<FileDownload> => {\n if (!client || !daemon) throw new Error(\"not connected\");\n const file = await transferFor(daemon).download(path);\n // `Blob`'s DOM typings require an `ArrayBuffer`-backed view; the assembled `Uint8Array`'s\n // `ArrayBufferLike` backing (a decode-time implementation detail) doesn't satisfy that on\n // its own, so copy into a plain `ArrayBuffer`-backed `Uint8Array` first.\n const blob = new Blob([Uint8Array.from(file.bytes)], {\n type: file.mimeType || \"application/octet-stream\",\n });\n return { objectUrl: URL.createObjectURL(blob), mimeType: file.mimeType, fileName: file.fileName };\n },\n enabled: Boolean(client) && Boolean(daemon) && Boolean(path) && enabled,\n // Object URLs are process-local, non-serializable browser resources — never persist them or\n // silently refetch behind this hook's back (that would leak the previous blob's URL).\n staleTime: Infinity,\n gcTime: 0,\n });\n\n // Revoke the previous object URL once a new one supersedes it, and the current one on unmount\n // — TanStack Query's cache has no notion that this value owns a browser resource to release.\n const urlRef = useRef<string | null>(null);\n useEffect(() => {\n const nextUrl = query.data?.objectUrl ?? null;\n if (nextUrl && urlRef.current && urlRef.current !== nextUrl) {\n URL.revokeObjectURL(urlRef.current);\n }\n urlRef.current = nextUrl;\n }, [query.data?.objectUrl]);\n\n useEffect(() => {\n return () => {\n if (urlRef.current) URL.revokeObjectURL(urlRef.current);\n };\n }, []);\n\n return query;\n}\n"],"names":["useFileDownload","path","enabled","client","useConnectionStore","s","daemon","query","useQuery","rpcKeys","file","transferFor","blob","urlRef","useRef","useEffect","nextUrl","_a"],"mappings":"oJAqBO,SAASA,EAAgBC,EAAcC,EAAU,GAAM,OAC5D,MAAMC,EAASC,EAAoBC,GAAMA,EAAE,MAAM,EAC3CC,EAASF,EAAoBC,GAAMA,EAAE,MAAM,EAE3CE,EAAQC,EAAS,CACrB,SAAUC,EAAQ,aAAaR,CAAI,EACnC,QAAS,SAAmC,CAC1C,GAAI,CAACE,GAAU,CAACG,EAAQ,MAAM,IAAI,MAAM,eAAe,EACvD,MAAMI,EAAO,MAAMC,EAAYL,CAAM,EAAE,SAASL,CAAI,EAI9CW,EAAO,IAAI,KAAK,CAAC,WAAW,KAAKF,EAAK,KAAK,CAAC,EAAG,CACnD,KAAMA,EAAK,UAAY,0BAAA,CACxB,EACD,MAAO,CAAE,UAAW,IAAI,gBAAgBE,CAAI,EAAG,SAAUF,EAAK,SAAU,SAAUA,EAAK,QAAA,CACzF,EACA,QAAS,EAAQP,GAAW,EAAQG,GAAW,EAAQL,GAASC,EAGhE,UAAW,IACX,OAAQ,CAAA,CACT,EAIKW,EAASC,EAAAA,OAAsB,IAAI,EACzCC,OAAAA,EAAAA,UAAU,IAAM,OACd,MAAMC,IAAUC,EAAAV,EAAM,OAAN,YAAAU,EAAY,YAAa,KACrCD,GAAWH,EAAO,SAAWA,EAAO,UAAYG,GAClD,IAAI,gBAAgBH,EAAO,OAAO,EAEpCA,EAAO,QAAUG,CACnB,EAAG,EAACC,EAAAV,EAAM,OAAN,YAAAU,EAAY,SAAS,CAAC,EAE1BF,EAAAA,UAAU,IACD,IAAM,CACPF,EAAO,SAAS,IAAI,gBAAgBA,EAAO,OAAO,CACxD,EACC,CAAA,CAAE,EAEEN,CACT"}
@@ -1,2 +1,2 @@
1
- var Le=s=>{throw TypeError(s)};var le=(s,t,e)=>t.has(s)||Le("Cannot "+e);var o=(s,t,e)=>(le(s,t,"read from private field"),e?e.call(s):t.get(s)),b=(s,t,e)=>t.has(s)?Le("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),c=(s,t,e,i)=>(le(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e),C=(s,t,e)=>(le(s,t,"access private method"),e);var ie=(s,t,e,i)=>({set _(n){c(s,t,n,e)},get _(){return o(s,t,i)}});import{r as F,j as Ts,a as Fs}from"./vendor-react-BoIQBqDW.js";var Lt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ft,st,Et,Ze,As=(Ze=class extends Lt{constructor(){super();b(this,ft);b(this,st);b(this,Et);c(this,Et,t=>{if(typeof window<"u"&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}})}onSubscribe(){o(this,st)||this.setEventListener(o(this,Et))}onUnsubscribe(){var t;this.hasListeners()||((t=o(this,st))==null||t.call(this),c(this,st,void 0))}setEventListener(t){var e;c(this,Et,t),(e=o(this,st))==null||e.call(this),c(this,st,t(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(t){o(this,ft)!==t&&(c(this,ft,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){var t;return typeof o(this,ft)=="boolean"?o(this,ft):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ft=new WeakMap,st=new WeakMap,Et=new WeakMap,Ze),Pe=new As,Ps={setTimeout:(s,t)=>setTimeout(s,t),clearTimeout:s=>clearTimeout(s),setInterval:(s,t)=>setInterval(s,t),clearInterval:s=>clearInterval(s)},it,Ae,Ye,_s=(Ye=class{constructor(){b(this,it,Ps);b(this,Ae,!1)}setTimeoutProvider(s){c(this,it,s)}setTimeout(s,t){return o(this,it).setTimeout(s,t)}clearTimeout(s){o(this,it).clearTimeout(s)}setInterval(s,t){return o(this,it).setInterval(s,t)}clearInterval(s){o(this,it).clearInterval(s)}},it=new WeakMap,Ae=new WeakMap,Ye),dt=new _s;function zs(s){setTimeout(s,0)}var Qs=typeof window>"u"||"Deno"in globalThis;function U(){}function Ds(s,t){return typeof s=="function"?s(t):s}function ce(s){return typeof s=="number"&&s>=0&&s!==1/0}function hs(s,t){return Math.max(s+(t||0)-Date.now(),0)}function ct(s,t){return typeof s=="function"?s(t):s}function N(s,t){return typeof s=="function"?s(t):s}function Ue(s,t){const{type:e="all",exact:i,fetchStatus:n,predicate:r,queryKey:l,stale:a}=s;if(l){if(i){if(t.queryHash!==_e(l,t.options))return!1}else if(!Ht(t.queryKey,l))return!1}if(e!=="all"){const h=t.isActive();if(e==="active"&&!h||e==="inactive"&&h)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||r&&!r(t))}function qe(s,t){const{exact:e,status:i,predicate:n,mutationKey:r}=s;if(r){if(!t.options.mutationKey)return!1;if(e){if(Kt(t.options.mutationKey)!==Kt(r))return!1}else if(!Ht(t.options.mutationKey,r))return!1}return!(i&&t.state.status!==i||n&&!n(t))}function _e(s,t){return((t==null?void 0:t.queryKeyHashFn)||Kt)(s)}function Kt(s){return JSON.stringify(s,(t,e)=>de(e)?Object.keys(e).sort().reduce((i,n)=>(i[n]=e[n],i),{}):e)}function Ht(s,t){return s===t?!0:typeof s!=typeof t?!1:s&&t&&typeof s=="object"&&typeof t=="object"?Object.keys(t).every(e=>Ht(s[e],t[e])):!1}var js=Object.prototype.hasOwnProperty;function ze(s,t,e=0){if(s===t)return s;if(e>500)return t;const i=Ke(s)&&Ke(t);if(!i&&!(de(s)&&de(t)))return t;const r=(i?s:Object.keys(s)).length,l=i?t:Object.keys(t),a=l.length,h=i?new Array(a):{};let f=0;for(let d=0;d<a;d++){const u=i?d:l[d],m=s[u],y=t[u];if(m===y){h[u]=m,(i?d<r:js.call(s,u))&&f++;continue}if(m===null||y===null||typeof m!="object"||typeof y!="object"){h[u]=y;continue}const p=ze(m,y,e+1);h[u]=p,p===m&&f++}return r===a&&f===r?s:h}function re(s,t){if(!t||Object.keys(s).length!==Object.keys(t).length)return!1;for(const e in s)if(s[e]!==t[e])return!1;return!0}function Ke(s){return Array.isArray(s)&&s.length===Object.keys(s).length}function de(s){if(!He(s))return!1;const t=s.constructor;if(t===void 0)return!0;const e=t.prototype;return!(!He(e)||!e.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(s)!==Object.prototype)}function He(s){return Object.prototype.toString.call(s)==="[object Object]"}function ks(s){return new Promise(t=>{dt.setTimeout(t,s)})}function fe(s,t,e){return typeof e.structuralSharing=="function"?e.structuralSharing(s,t):e.structuralSharing!==!1?ze(s,t):t}function Ls(s,t,e=0){const i=[...s,t];return e&&i.length>e?i.slice(1):i}function Us(s,t,e=0){const i=[t,...s];return e&&i.length>e?i.slice(0,-1):i}var Qe=Symbol();function us(s,t){return!s.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!s.queryFn||s.queryFn===Qe?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}function cs(s,t){return typeof s=="function"?s(...t):!!s}function qs(s,t,e){let i=!1,n;return Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(n??(n=t()),i||(i=!0,n.aborted?e():n.addEventListener("abort",e,{once:!0})),n)}),s}var Wt=(()=>{let s=()=>Qs;return{isServer(){return s()},setIsServer(t){s=t}}})();function me(){let s,t;const e=new Promise((n,r)=>{s=n,t=r});e.status="pending",e.catch(()=>{});function i(n){Object.assign(e,n),delete e.resolve,delete e.reject}return e.resolve=n=>{i({status:"fulfilled",value:n}),s(n)},e.reject=n=>{i({status:"rejected",reason:n}),t(n)},e}var Ks=zs;function Hs(){let s=[],t=0,e=a=>{a()},i=a=>{a()},n=Ks;const r=a=>{t?s.push(a):n(()=>{e(a)})},l=()=>{const a=s;s=[],a.length&&n(()=>{i(()=>{a.forEach(h=>{e(h)})})})};return{batch:a=>{let h;t++;try{h=a()}finally{t--,t||l()}return h},batchCalls:a=>(...h)=>{r(()=>{a(...h)})},schedule:r,setNotifyFunction:a=>{e=a},setBatchNotifyFunction:a=>{i=a},setScheduler:a=>{n=a}}}var A=Hs(),Mt,nt,It,ts,Ws=(ts=class extends Lt{constructor(){super();b(this,Mt,!0);b(this,nt);b(this,It);c(this,It,t=>{if(typeof window<"u"&&window.addEventListener){const e=()=>t(!0),i=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",i)}}})}onSubscribe(){o(this,nt)||this.setEventListener(o(this,It))}onUnsubscribe(){var t;this.hasListeners()||((t=o(this,nt))==null||t.call(this),c(this,nt,void 0))}setEventListener(t){var e;c(this,It,t),(e=o(this,nt))==null||e.call(this),c(this,nt,t(this.setOnline.bind(this)))}setOnline(t){o(this,Mt)!==t&&(c(this,Mt,t),this.listeners.forEach(i=>{i(t)}))}isOnline(){return o(this,Mt)}},Mt=new WeakMap,nt=new WeakMap,It=new WeakMap,ts),oe=new Ws;function Ns(s){return Math.min(1e3*2**s,3e4)}function ds(s){return(s??"online")==="online"?oe.isOnline():!0}var pe=class extends Error{constructor(s){super("CancelledError"),this.revert=s==null?void 0:s.revert,this.silent=s==null?void 0:s.silent}};function fs(s){let t=!1,e=0,i;const n=me(),r=()=>n.status!=="pending",l=g=>{var S;if(!r()){const v=new pe(g);m(v),(S=s.onCancel)==null||S.call(s,v)}},a=()=>{t=!0},h=()=>{t=!1},f=()=>Pe.isFocused()&&(s.networkMode==="always"||oe.isOnline())&&s.canRun(),d=()=>ds(s.networkMode)&&s.canRun(),u=g=>{r()||(i==null||i(),n.resolve(g))},m=g=>{r()||(i==null||i(),n.reject(g))},y=()=>new Promise(g=>{var S;i=v=>{(r()||f())&&g(v)},(S=s.onPause)==null||S.call(s)}).then(()=>{var g;i=void 0,r()||(g=s.onContinue)==null||g.call(s)}),p=()=>{if(r())return;let g;const S=e===0?s.initialPromise:void 0;try{g=S??s.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(u).catch(v=>{var P;if(r())return;const E=s.retry??(Wt.isServer()?0:3),w=s.retryDelay??Ns,O=typeof w=="function"?w(e,v):w,x=E===!0||typeof E=="number"&&e<E||typeof E=="function"&&E(e,v);if(t||!x){m(v);return}e++,(P=s.onFail)==null||P.call(s,e,v),ks(O).then(()=>f()?void 0:y()).then(()=>{t?m(v):p()})})};return{promise:n,status:()=>n.status,cancel:l,continue:()=>(i==null||i(),n),cancelRetry:a,continueRetry:h,canStart:d,start:()=>(d()?p():y().then(p),n)}}var mt,es,ms=(es=class{constructor(){b(this,mt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ce(this.gcTime)&&c(this,mt,dt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(Wt.isServer()?1/0:300*1e3))}clearGcTimeout(){o(this,mt)!==void 0&&(dt.clearTimeout(o(this,mt)),c(this,mt,void 0))}},mt=new WeakMap,es);function Bs(s){return{onFetch:(t,e)=>{var d,u,m,y,p;const i=t.options,n=(m=(u=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:u.fetchMore)==null?void 0:m.direction,r=((y=t.state.data)==null?void 0:y.pages)||[],l=((p=t.state.data)==null?void 0:p.pageParams)||[];let a={pages:[],pageParams:[]},h=0;const f=async()=>{let g=!1;const S=w=>{qs(w,()=>t.signal,()=>g=!0)},v=us(t.options,t.fetchOptions),E=async(w,O,x)=>{if(g)return Promise.reject(t.signal.reason);if(O==null&&w.pages.length)return Promise.resolve(w);const D=(()=>{const tt={client:t.client,queryKey:t.queryKey,pageParam:O,direction:x?"backward":"forward",meta:t.options.meta};return S(tt),tt})(),R=await v(D),{maxPages:z}=t.options,k=x?Us:Ls;return{pages:k(w.pages,R,z),pageParams:k(w.pageParams,O,z)}};if(n&&r.length){const w=n==="backward",O=w?Vs:We,x={pages:r,pageParams:l},P=O(i,x);a=await E(x,P,w)}else{const w=s??r.length;do{const O=h===0?l[0]??i.initialPageParam:We(i,a);if(h>0&&O==null)break;a=await E(a,O),h++}while(h<w)}return a};t.options.persister?t.fetchFn=()=>{var g,S;return(S=(g=t.options).persister)==null?void 0:S.call(g,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},e)}:t.fetchFn=f}}}function We(s,{pages:t,pageParams:e}){const i=t.length-1;return t.length>0?s.getNextPageParam(t[i],t,e[i],e):void 0}function Vs(s,{pages:t,pageParams:e}){var i;return t.length>0?(i=s.getPreviousPageParam)==null?void 0:i.call(s,t[0],t,e[0],e):void 0}var Rt,pt,xt,B,gt,Q,Nt,yt,W,ps,X,ss,Gs=(ss=class extends ms{constructor(t){super();b(this,W);b(this,Rt);b(this,pt);b(this,xt);b(this,B);b(this,gt);b(this,Q);b(this,Nt);b(this,yt);c(this,yt,!1),c(this,Nt,t.defaultOptions),this.setOptions(t.options),this.observers=[],c(this,gt,t.client),c(this,B,o(this,gt).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,c(this,pt,Be(this.options)),this.state=t.state??o(this,pt),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return o(this,Rt)}get promise(){var t;return(t=o(this,Q))==null?void 0:t.promise}setOptions(t){if(this.options={...o(this,Nt),...t},t!=null&&t._type&&c(this,Rt,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=Be(this.options);e.data!==void 0&&(this.setState(Ne(e.data,e.dataUpdatedAt)),c(this,pt,e))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&o(this,B).remove(this)}setData(t,e){const i=fe(this.state.data,t,this.options);return C(this,W,X).call(this,{data:i,type:"success",dataUpdatedAt:e==null?void 0:e.updatedAt,manual:e==null?void 0:e.manual}),i}setState(t){C(this,W,X).call(this,{type:"setState",state:t})}cancel(t){var i,n;const e=(i=o(this,Q))==null?void 0:i.promise;return(n=o(this,Q))==null||n.cancel(t),e?e.then(U).catch(U):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return o(this,pt)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>N(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Qe||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ct(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!hs(this.state.dataUpdatedAt,t)}onFocus(){var e;const t=this.observers.find(i=>i.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(e=o(this,Q))==null||e.continue()}onOnline(){var e;const t=this.observers.find(i=>i.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(e=o(this,Q))==null||e.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),o(this,B).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(o(this,Q)&&(o(this,yt)||C(this,W,ps).call(this)?o(this,Q).cancel({revert:!0}):o(this,Q).cancelRetry()),this.scheduleGc()),o(this,B).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||C(this,W,X).call(this,{type:"invalidate"})}async fetch(t,e){var f,d,u,m,y,p,g,S,v,E,w;if(this.state.fetchStatus!=="idle"&&((f=o(this,Q))==null?void 0:f.status())!=="rejected"){if(this.state.data!==void 0&&(e!=null&&e.cancelRefetch))this.cancel({silent:!0});else if(o(this,Q))return o(this,Q).continueRetry(),o(this,Q).promise}if(t&&this.setOptions(t),!this.options.queryFn){const O=this.observers.find(x=>x.options.queryFn);O&&this.setOptions(O.options)}const i=new AbortController,n=O=>{Object.defineProperty(O,"signal",{enumerable:!0,get:()=>(c(this,yt,!0),i.signal)})},r=()=>{const O=us(this.options,e),P=(()=>{const D={client:o(this,gt),queryKey:this.queryKey,meta:this.meta};return n(D),D})();return c(this,yt,!1),this.options.persister?this.options.persister(O,P,this):O(P)},a=(()=>{const O={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:o(this,gt),state:this.state,fetchFn:r};return n(O),O})(),h=o(this,Rt)==="infinite"?Bs(this.options.pages):this.options.behavior;h==null||h.onFetch(a,this),c(this,xt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&C(this,W,X).call(this,{type:"fetch",meta:(u=a.fetchOptions)==null?void 0:u.meta}),c(this,Q,fs({initialPromise:e==null?void 0:e.initialPromise,fn:a.fetchFn,onCancel:O=>{O instanceof pe&&O.revert&&this.setState({...o(this,xt),fetchStatus:"idle"}),i.abort()},onFail:(O,x)=>{C(this,W,X).call(this,{type:"failed",failureCount:O,error:x})},onPause:()=>{C(this,W,X).call(this,{type:"pause"})},onContinue:()=>{C(this,W,X).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const O=await o(this,Q).start();if(O===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(O),(y=(m=o(this,B).config).onSuccess)==null||y.call(m,O,this),(g=(p=o(this,B).config).onSettled)==null||g.call(p,O,this.state.error,this),O}catch(O){if(O instanceof pe){if(O.silent)return o(this,Q).promise;if(O.revert){if(this.state.data===void 0)throw O;return this.state.data}}throw C(this,W,X).call(this,{type:"error",error:O}),(v=(S=o(this,B).config).onError)==null||v.call(S,O,this),(w=(E=o(this,B).config).onSettled)==null||w.call(E,this.state.data,O,this),O}finally{this.scheduleGc()}}},Rt=new WeakMap,pt=new WeakMap,xt=new WeakMap,B=new WeakMap,gt=new WeakMap,Q=new WeakMap,Nt=new WeakMap,yt=new WeakMap,W=new WeakSet,ps=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},X=function(t){const e=i=>{switch(t.type){case"failed":return{...i,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...gs(i.data,this.options),fetchMeta:t.meta??null};case"success":const n={...i,...Ne(t.data,t.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return c(this,xt,t.manual?n:void 0),n;case"error":const r=t.error;return{...i,error:r,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...t.state}}};this.state=e(this.state),A.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),o(this,B).notify({query:this,type:"updated",action:t})})},ss);function gs(s,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ds(t.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function Ne(s,t){return{data:s,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Be(s){const t=typeof s.initialData=="function"?s.initialData():s.initialData,e=t!==void 0,i=e?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:e?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:e?"success":"pending",fetchStatus:"idle"}}var q,M,Bt,L,vt,Tt,Z,rt,Vt,Ft,At,bt,St,ot,Pt,I,qt,ge,ye,ve,be,Se,Oe,we,ys,is,De=(is=class extends Lt{constructor(t,e){super();b(this,I);b(this,q);b(this,M);b(this,Bt);b(this,L);b(this,vt);b(this,Tt);b(this,Z);b(this,rt);b(this,Vt);b(this,Ft);b(this,At);b(this,bt);b(this,St);b(this,ot);b(this,Pt,new Set);this.options=e,c(this,q,t),c(this,rt,null),c(this,Z,me()),this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(o(this,M).addObserver(this),Ve(o(this,M),this.options)?C(this,I,qt).call(this):this.updateResult(),C(this,I,be).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ce(o(this,M),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ce(o(this,M),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,C(this,I,Se).call(this),C(this,I,Oe).call(this),o(this,M).removeObserver(this)}setOptions(t){const e=this.options,i=o(this,M);if(this.options=o(this,q).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof N(this.options.enabled,o(this,M))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");C(this,I,we).call(this),o(this,M).setOptions(this.options),e._defaulted&&!re(this.options,e)&&o(this,q).getQueryCache().notify({type:"observerOptionsUpdated",query:o(this,M),observer:this});const n=this.hasListeners();n&&Ge(o(this,M),i,this.options,e)&&C(this,I,qt).call(this),this.updateResult(),n&&(o(this,M)!==i||N(this.options.enabled,o(this,M))!==N(e.enabled,o(this,M))||ct(this.options.staleTime,o(this,M))!==ct(e.staleTime,o(this,M)))&&C(this,I,ge).call(this);const r=C(this,I,ye).call(this);n&&(o(this,M)!==i||N(this.options.enabled,o(this,M))!==N(e.enabled,o(this,M))||r!==o(this,ot))&&C(this,I,ve).call(this,r)}getOptimisticResult(t){const e=o(this,q).getQueryCache().build(o(this,q),t),i=this.createResult(e,t);return Js(this,i)&&(c(this,L,i),c(this,Tt,this.options),c(this,vt,o(this,M).state)),i}getCurrentResult(){return o(this,L)}trackResult(t,e){return new Proxy(t,{get:(i,n)=>(this.trackProp(n),e==null||e(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&o(this,Z).status==="pending"&&o(this,Z).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,n))})}trackProp(t){o(this,Pt).add(t)}getCurrentQuery(){return o(this,M)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=o(this,q).defaultQueryOptions(t),i=o(this,q).getQueryCache().build(o(this,q),e);return i.fetch().then(()=>this.createResult(i,e))}fetch(t){return C(this,I,qt).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),o(this,L)))}createResult(t,e){var z;const i=o(this,M),n=this.options,r=o(this,L),l=o(this,vt),a=o(this,Tt),f=t!==i?t.state:o(this,Bt),{state:d}=t;let u={...d},m=!1,y;if(e._optimisticResults){const k=this.hasListeners(),tt=!k&&Ve(t,e),te=k&&Ge(t,i,e,n);(tt||te)&&(u={...u,...gs(d.data,t.options)}),e._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:p,errorUpdatedAt:g,status:S}=u;y=u.data;let v=!1;if(e.placeholderData!==void 0&&y===void 0&&S==="pending"){let k;r!=null&&r.isPlaceholderData&&e.placeholderData===(a==null?void 0:a.placeholderData)?(k=r.data,v=!0):k=typeof e.placeholderData=="function"?e.placeholderData((z=o(this,At))==null?void 0:z.state.data,o(this,At)):e.placeholderData,k!==void 0&&(S="success",y=fe(r==null?void 0:r.data,k,e),m=!0)}if(e.select&&y!==void 0&&!v)if(r&&y===(l==null?void 0:l.data)&&e.select===o(this,Vt))y=o(this,Ft);else try{c(this,Vt,e.select),y=e.select(y),y=fe(r==null?void 0:r.data,y,e),c(this,Ft,y),c(this,rt,null)}catch(k){c(this,rt,k)}o(this,rt)&&(p=o(this,rt),y=o(this,Ft),g=Date.now(),S="error");const E=u.fetchStatus==="fetching",w=S==="pending",O=S==="error",x=w&&E,P=y!==void 0,R={status:S,fetchStatus:u.fetchStatus,isPending:w,isSuccess:S==="success",isError:O,isInitialLoading:x,isLoading:x,data:y,dataUpdatedAt:u.dataUpdatedAt,error:p,errorUpdatedAt:g,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:u.dataUpdateCount>f.dataUpdateCount||u.errorUpdateCount>f.errorUpdateCount,isFetching:E,isRefetching:E&&!w,isLoadingError:O&&!P,isPaused:u.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:O&&P,isStale:je(t,e),refetch:this.refetch,promise:o(this,Z),isEnabled:N(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const k=R.data!==void 0,tt=R.status==="error"&&!k,te=se=>{tt?se.reject(R.error):k&&se.resolve(R.data)},ke=()=>{const se=c(this,Z,R.promise=me());te(se)},ee=o(this,Z);switch(ee.status){case"pending":t.queryHash===i.queryHash&&te(ee);break;case"fulfilled":(tt||R.data!==ee.value)&&ke();break;case"rejected":(!tt||R.error!==ee.reason)&&ke();break}}return R}updateResult(){const t=o(this,L),e=this.createResult(o(this,M),this.options);if(c(this,vt,o(this,M).state),c(this,Tt,this.options),o(this,vt).data!==void 0&&c(this,At,o(this,M)),re(e,t))return;c(this,L,e);const i=()=>{if(!t)return!0;const{notifyOnChangeProps:n}=this.options,r=typeof n=="function"?n():n;if(r==="all"||!r&&!o(this,Pt).size)return!0;const l=new Set(r??o(this,Pt));return this.options.throwOnError&&l.add("error"),Object.keys(o(this,L)).some(a=>{const h=a;return o(this,L)[h]!==t[h]&&l.has(h)})};C(this,I,ys).call(this,{listeners:i()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&C(this,I,be).call(this)}},q=new WeakMap,M=new WeakMap,Bt=new WeakMap,L=new WeakMap,vt=new WeakMap,Tt=new WeakMap,Z=new WeakMap,rt=new WeakMap,Vt=new WeakMap,Ft=new WeakMap,At=new WeakMap,bt=new WeakMap,St=new WeakMap,ot=new WeakMap,Pt=new WeakMap,I=new WeakSet,qt=function(t){C(this,I,we).call(this);let e=o(this,M).fetch(this.options,t);return t!=null&&t.throwOnError||(e=e.catch(U)),e},ge=function(){C(this,I,Se).call(this);const t=ct(this.options.staleTime,o(this,M));if(Wt.isServer()||o(this,L).isStale||!ce(t))return;const i=hs(o(this,L).dataUpdatedAt,t)+1;c(this,bt,dt.setTimeout(()=>{o(this,L).isStale||this.updateResult()},i))},ye=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(o(this,M)):this.options.refetchInterval)??!1},ve=function(t){C(this,I,Oe).call(this),c(this,ot,t),!(Wt.isServer()||N(this.options.enabled,o(this,M))===!1||!ce(o(this,ot))||o(this,ot)===0)&&c(this,St,dt.setInterval(()=>{(this.options.refetchIntervalInBackground||Pe.isFocused())&&C(this,I,qt).call(this)},o(this,ot)))},be=function(){C(this,I,ge).call(this),C(this,I,ve).call(this,C(this,I,ye).call(this))},Se=function(){o(this,bt)!==void 0&&(dt.clearTimeout(o(this,bt)),c(this,bt,void 0))},Oe=function(){o(this,St)!==void 0&&(dt.clearInterval(o(this,St)),c(this,St,void 0))},we=function(){const t=o(this,q).getQueryCache().build(o(this,q),this.options);if(t===o(this,M))return;const e=o(this,M);c(this,M,t),c(this,Bt,t.state),this.hasListeners()&&(e==null||e.removeObserver(this),t.addObserver(this))},ys=function(t){A.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(o(this,L))}),o(this,q).getQueryCache().notify({query:o(this,M),type:"observerResultsUpdated"})})},is);function $s(s,t){return N(t.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&N(t.retryOnMount,s)===!1)}function Ve(s,t){return $s(s,t)||s.state.data!==void 0&&Ce(s,t,t.refetchOnMount)}function Ce(s,t,e){if(N(t.enabled,s)!==!1&&ct(t.staleTime,s)!=="static"){const i=typeof e=="function"?e(s):e;return i==="always"||i!==!1&&je(s,t)}return!1}function Ge(s,t,e,i){return(s!==t||N(i.enabled,s)===!1)&&(!e.suspense||s.state.status!=="error")&&je(s,e)}function je(s,t){return N(t.enabled,s)!==!1&&s.isStaleByTime(ct(t.staleTime,s))}function Js(s,t){return!re(s.getCurrentResult(),t)}var Gt,G,j,Ot,$,et,ns,Xs=(ns=class extends ms{constructor(t){super();b(this,$);b(this,Gt);b(this,G);b(this,j);b(this,Ot);c(this,Gt,t.client),this.mutationId=t.mutationId,c(this,j,t.mutationCache),c(this,G,[]),this.state=t.state||Zs(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){o(this,G).includes(t)||(o(this,G).push(t),this.clearGcTimeout(),o(this,j).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){c(this,G,o(this,G).filter(e=>e!==t)),this.scheduleGc(),o(this,j).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){o(this,G).length||(this.state.status==="pending"?this.scheduleGc():o(this,j).remove(this))}continue(){var t;return((t=o(this,Ot))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,a,h,f,d,u,m,y,p,g,S,v,E,w,O,x,P,D;const e=()=>{C(this,$,et).call(this,{type:"continue"})},i={client:o(this,Gt),meta:this.options.meta,mutationKey:this.options.mutationKey};c(this,Ot,fs({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(new Error("No mutationFn found")),onFail:(R,z)=>{C(this,$,et).call(this,{type:"failed",failureCount:R,error:z})},onPause:()=>{C(this,$,et).call(this,{type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>o(this,j).canRun(this)}));const n=this.state.status==="pending",r=!o(this,Ot).canStart();try{if(n)e();else{C(this,$,et).call(this,{type:"pending",variables:t,isPaused:r}),o(this,j).config.onMutate&&await o(this,j).config.onMutate(t,this,i);const z=await((a=(l=this.options).onMutate)==null?void 0:a.call(l,t,i));z!==this.state.context&&C(this,$,et).call(this,{type:"pending",context:z,variables:t,isPaused:r})}const R=await o(this,Ot).start();return await((f=(h=o(this,j).config).onSuccess)==null?void 0:f.call(h,R,t,this.state.context,this,i)),await((u=(d=this.options).onSuccess)==null?void 0:u.call(d,R,t,this.state.context,i)),await((y=(m=o(this,j).config).onSettled)==null?void 0:y.call(m,R,null,this.state.variables,this.state.context,this,i)),await((g=(p=this.options).onSettled)==null?void 0:g.call(p,R,null,t,this.state.context,i)),C(this,$,et).call(this,{type:"success",data:R}),R}catch(R){try{await((v=(S=o(this,j).config).onError)==null?void 0:v.call(S,R,t,this.state.context,this,i))}catch(z){Promise.reject(z)}try{await((w=(E=this.options).onError)==null?void 0:w.call(E,R,t,this.state.context,i))}catch(z){Promise.reject(z)}try{await((x=(O=o(this,j).config).onSettled)==null?void 0:x.call(O,void 0,R,this.state.variables,this.state.context,this,i))}catch(z){Promise.reject(z)}try{await((D=(P=this.options).onSettled)==null?void 0:D.call(P,void 0,R,t,this.state.context,i))}catch(z){Promise.reject(z)}throw C(this,$,et).call(this,{type:"error",error:R}),R}finally{o(this,j).runNext(this)}}},Gt=new WeakMap,G=new WeakMap,j=new WeakMap,Ot=new WeakMap,$=new WeakSet,et=function(t){const e=i=>{switch(t.type){case"failed":return{...i,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,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{...i,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:t.error,failureCount:i.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),A.batch(()=>{o(this,G).forEach(i=>{i.onMutationUpdate(t)}),o(this,j).notify({mutation:this,type:"updated",action:t})})},ns);function Zs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Y,V,$t,rs,Ys=(rs=class extends Lt{constructor(t={}){super();b(this,Y);b(this,V);b(this,$t);this.config=t,c(this,Y,new Set),c(this,V,new Map),c(this,$t,0)}build(t,e,i){const n=new Xs({client:t,mutationCache:this,mutationId:++ie(this,$t)._,options:t.defaultMutationOptions(e),state:i});return this.add(n),n}add(t){o(this,Y).add(t);const e=ne(t);if(typeof e=="string"){const i=o(this,V).get(e);i?i.push(t):o(this,V).set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(o(this,Y).delete(t)){const e=ne(t);if(typeof e=="string"){const i=o(this,V).get(e);if(i)if(i.length>1){const n=i.indexOf(t);n!==-1&&i.splice(n,1)}else i[0]===t&&o(this,V).delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=ne(t);if(typeof e=="string"){const i=o(this,V).get(e),n=i==null?void 0:i.find(r=>r.state.status==="pending");return!n||n===t}else return!0}runNext(t){var i;const e=ne(t);if(typeof e=="string"){const n=(i=o(this,V).get(e))==null?void 0:i.find(r=>r!==t&&r.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){A.batch(()=>{o(this,Y).forEach(t=>{this.notify({type:"removed",mutation:t})}),o(this,Y).clear(),o(this,V).clear()})}getAll(){return Array.from(o(this,Y))}find(t){const e={exact:!0,...t};return this.getAll().find(i=>qe(e,i))}findAll(t={}){return this.getAll().filter(e=>qe(t,e))}notify(t){A.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return A.batch(()=>Promise.all(t.map(e=>e.continue().catch(U))))}},Y=new WeakMap,V=new WeakMap,$t=new WeakMap,rs);function ne(s){var t;return(t=s.options.scope)==null?void 0:t.id}function $e(s,t){const e=new Set(t);return s.filter(i=>!e.has(i))}function ti(s,t,e){const i=s.slice(0);return i[t]=e,i}var _t,K,zt,wt,H,at,Jt,Xt,Zt,Yt,_,Ee,Me,vs,Ie,Re,xe,os,ei=(os=class extends Lt{constructor(t,e,i){super();b(this,_);b(this,_t);b(this,K);b(this,zt);b(this,wt);b(this,H);b(this,at);b(this,Jt);b(this,Xt);b(this,Zt);b(this,Yt,[]);c(this,_t,t),c(this,wt,i),c(this,zt,[]),c(this,H,[]),c(this,K,[]),this.setQueries(e)}onSubscribe(){this.listeners.size===1&&o(this,H).forEach(t=>{t.subscribe(e=>{C(this,_,Re).call(this,t,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,o(this,H).forEach(t=>{t.destroy()})}setQueries(t,e){c(this,zt,t),c(this,wt,e),A.batch(()=>{const i=o(this,H),n=C(this,_,Ie).call(this,o(this,zt));n.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const r=n.map(u=>u.observer),l=r.map(u=>u.getCurrentResult()),a=i.length!==r.length,h=r.some((u,m)=>u!==i[m]),f=a||h,d=f?!0:l.some((u,m)=>{const y=o(this,K)[m];return!y||!re(u,y)});!f&&!d||(f&&(c(this,Yt,n),c(this,H,r)),c(this,K,l),this.hasListeners()&&(f&&($e(i,r).forEach(u=>{u.destroy()}),$e(r,i).forEach(u=>{u.subscribe(m=>{C(this,_,Re).call(this,u,m)})})),C(this,_,xe).call(this)))})}getCurrentResult(){return o(this,K)}getQueries(){return o(this,H).map(t=>t.getCurrentQuery())}getObservers(){return o(this,H)}getOptimisticResult(t,e){const i=C(this,_,Ie).call(this,t),n=i.map(l=>l.observer.getOptimisticResult(l.defaultedQueryOptions)),r=i.map(l=>l.defaultedQueryOptions.queryHash);return[n,l=>C(this,_,Me).call(this,l??n,e,r),()=>C(this,_,Ee).call(this,n,i)]}},_t=new WeakMap,K=new WeakMap,zt=new WeakMap,wt=new WeakMap,H=new WeakMap,at=new WeakMap,Jt=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,Yt=new WeakMap,_=new WeakSet,Ee=function(t,e){return e.map((i,n)=>{const r=t[n];return i.defaultedQueryOptions.notifyOnChangeProps?r:i.observer.trackResult(r,l=>{e.forEach(a=>{a.observer.trackProp(l)})})})},Me=function(t,e,i){if(e){const n=o(this,Zt),r=i!==void 0&&n!==void 0&&(n.length!==i.length||i.some((l,a)=>l!==n[a]));return(!o(this,at)||o(this,K)!==o(this,Xt)||r||e!==o(this,Jt))&&(c(this,Jt,e),c(this,Xt,o(this,K)),i!==void 0&&c(this,Zt,i),c(this,at,ze(o(this,at),e(t)))),o(this,at)}return t},vs=function(){var t;return((t=o(this,wt))==null?void 0:t.combine)!==void 0&&o(this,H).some((e,i)=>{var n;return e.options.suspense&&((n=o(this,K)[i])==null?void 0:n.data)===void 0})},Ie=function(t){const e=new Map;o(this,H).forEach(n=>{const r=n.options.queryHash;if(!r)return;const l=e.get(r);l?l.push(n):e.set(r,[n])});const i=[];return t.forEach(n=>{var h;const r=o(this,_t).defaultQueryOptions(n),a=((h=e.get(r.queryHash))==null?void 0:h.shift())??new De(o(this,_t),r);i.push({defaultedQueryOptions:r,observer:a})}),i},Re=function(t,e){const i=o(this,H).indexOf(t);i!==-1&&(c(this,K,ti(o(this,K),i,e)),C(this,_,xe).call(this))},xe=function(){var t;if(this.hasListeners()){const e=C(this,_,Ee).call(this,o(this,K),o(this,Yt)),i=C(this,_,vs).call(this),n=o(this,at),r=i?n:C(this,_,Me).call(this,e,(t=o(this,wt))==null?void 0:t.combine);(i||n!==r)&&A.batch(()=>{this.listeners.forEach(l=>{l(o(this,K))})})}},os),J,as,si=(as=class extends Lt{constructor(t={}){super();b(this,J);this.config=t,c(this,J,new Map)}build(t,e,i){const n=e.queryKey,r=e.queryHash??_e(n,e);let l=this.get(r);return l||(l=new Gs({client:t,queryKey:n,queryHash:r,options:t.defaultQueryOptions(e),state:i,defaultOptions:t.getQueryDefaults(n)}),this.add(l)),l}add(t){o(this,J).has(t.queryHash)||(o(this,J).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=o(this,J).get(t.queryHash);e&&(t.destroy(),e===t&&o(this,J).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){A.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return o(this,J).get(t)}getAll(){return[...o(this,J).values()]}find(t){const e={exact:!0,...t};return this.getAll().find(i=>Ue(e,i))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(i=>Ue(t,i)):e}notify(t){A.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){A.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){A.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},J=new WeakMap,as),T,lt,ht,Qt,Dt,ut,jt,kt,ls,Mi=(ls=class{constructor(s={}){b(this,T);b(this,lt);b(this,ht);b(this,Qt);b(this,Dt);b(this,ut);b(this,jt);b(this,kt);c(this,T,s.queryCache||new si),c(this,lt,s.mutationCache||new Ys),c(this,ht,s.defaultOptions||{}),c(this,Qt,new Map),c(this,Dt,new Map),c(this,ut,0)}mount(){ie(this,ut)._++,o(this,ut)===1&&(c(this,jt,Pe.subscribe(async s=>{s&&(await this.resumePausedMutations(),o(this,T).onFocus())})),c(this,kt,oe.subscribe(async s=>{s&&(await this.resumePausedMutations(),o(this,T).onOnline())})))}unmount(){var s,t;ie(this,ut)._--,o(this,ut)===0&&((s=o(this,jt))==null||s.call(this),c(this,jt,void 0),(t=o(this,kt))==null||t.call(this),c(this,kt,void 0))}isFetching(s){return o(this,T).findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return o(this,lt).findAll({...s,status:"pending"}).length}getQueryData(s){var e;const t=this.defaultQueryOptions({queryKey:s});return(e=o(this,T).get(t.queryHash))==null?void 0:e.state.data}ensureQueryData(s){const t=this.defaultQueryOptions(s),e=o(this,T).build(this,t),i=e.state.data;return i===void 0?this.fetchQuery(s):(s.revalidateIfStale&&e.isStaleByTime(ct(t.staleTime,e))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(s){return o(this,T).findAll(s).map(({queryKey:t,state:e})=>{const i=e.data;return[t,i]})}setQueryData(s,t,e){const i=this.defaultQueryOptions({queryKey:s}),n=o(this,T).get(i.queryHash),r=n==null?void 0:n.state.data,l=Ds(t,r);if(l!==void 0)return o(this,T).build(this,i).setData(l,{...e,manual:!0})}setQueriesData(s,t,e){return A.batch(()=>o(this,T).findAll(s).map(({queryKey:i})=>[i,this.setQueryData(i,t,e)]))}getQueryState(s){var e;const t=this.defaultQueryOptions({queryKey:s});return(e=o(this,T).get(t.queryHash))==null?void 0:e.state}removeQueries(s){const t=o(this,T);A.batch(()=>{t.findAll(s).forEach(e=>{t.remove(e)})})}resetQueries(s,t){const e=o(this,T);return A.batch(()=>(e.findAll(s).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...s},t)))}cancelQueries(s,t={}){const e={revert:!0,...t},i=A.batch(()=>o(this,T).findAll(s).map(n=>n.cancel(e)));return Promise.all(i).then(U).catch(U)}invalidateQueries(s,t={}){return A.batch(()=>(o(this,T).findAll(s).forEach(e=>{e.invalidate()}),(s==null?void 0:s.refetchType)==="none"?Promise.resolve():this.refetchQueries({...s,type:(s==null?void 0:s.refetchType)??(s==null?void 0:s.type)??"active"},t)))}refetchQueries(s,t={}){const e={...t,cancelRefetch:t.cancelRefetch??!0},i=A.batch(()=>o(this,T).findAll(s).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let r=n.fetch(void 0,e);return e.throwOnError||(r=r.catch(U)),n.state.fetchStatus==="paused"?Promise.resolve():r}));return Promise.all(i).then(U)}fetchQuery(s){const t=this.defaultQueryOptions(s);t.retry===void 0&&(t.retry=!1);const e=o(this,T).build(this,t);return e.isStaleByTime(ct(t.staleTime,e))?e.fetch(t):Promise.resolve(e.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(U).catch(U)}fetchInfiniteQuery(s){return s._type="infinite",this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(U).catch(U)}ensureInfiniteQueryData(s){return s._type="infinite",this.ensureQueryData(s)}resumePausedMutations(){return oe.isOnline()?o(this,lt).resumePausedMutations():Promise.resolve()}getQueryCache(){return o(this,T)}getMutationCache(){return o(this,lt)}getDefaultOptions(){return o(this,ht)}setDefaultOptions(s){c(this,ht,s)}setQueryDefaults(s,t){o(this,Qt).set(Kt(s),{queryKey:s,defaultOptions:t})}getQueryDefaults(s){const t=[...o(this,Qt).values()],e={};return t.forEach(i=>{Ht(s,i.queryKey)&&Object.assign(e,i.defaultOptions)}),e}setMutationDefaults(s,t){o(this,Dt).set(Kt(s),{mutationKey:s,defaultOptions:t})}getMutationDefaults(s){const t=[...o(this,Dt).values()],e={};return t.forEach(i=>{Ht(s,i.mutationKey)&&Object.assign(e,i.defaultOptions)}),e}defaultQueryOptions(s){if(s._defaulted)return s;const t={...o(this,ht).queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return t.queryHash||(t.queryHash=_e(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Qe&&(t.enabled=!1),t}defaultMutationOptions(s){return s!=null&&s._defaulted?s:{...o(this,ht).mutations,...(s==null?void 0:s.mutationKey)&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){o(this,T).clear(),o(this,lt).clear()}},T=new WeakMap,lt=new WeakMap,ht=new WeakMap,Qt=new WeakMap,Dt=new WeakMap,ut=new WeakMap,jt=new WeakMap,kt=new WeakMap,ls),bs=F.createContext(void 0),Ss=s=>{const t=F.useContext(bs);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ii=({client:s,children:t})=>(F.useEffect(()=>(s.mount(),()=>{s.unmount()}),[s]),Ts.jsx(bs.Provider,{value:s,children:t})),Os=F.createContext(!1),ws=()=>F.useContext(Os);Os.Provider;function ii(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var ni=F.createContext(ii()),Cs=()=>F.useContext(ni),Es=(s,t,e)=>{const i=e!=null&&e.state.error&&typeof s.throwOnError=="function"?cs(s.throwOnError,[e.state.error,e]):s.throwOnError;(s.suspense||s.experimental_prefetchInRender||i)&&(t.isReset()||(s.retryOnMount=!1))},Ms=s=>{F.useEffect(()=>{s.clearReset()},[s])},Is=({result:s,errorResetBoundary:t,throwOnError:e,query:i,suspense:n})=>s.isError&&!t.isReset()&&!s.isFetching&&i&&(n&&s.data===void 0||cs(e,[s.error,i])),Rs=s=>{if(s.suspense){const e=n=>n==="static"?n:Math.max(n??1e3,1e3),i=s.staleTime;s.staleTime=typeof i=="function"?(...n)=>e(i(...n)):e(i),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},ri=(s,t)=>s.isLoading&&s.isFetching&&!t,Te=(s,t)=>(s==null?void 0:s.suspense)&&t.isPending,Fe=(s,t,e)=>t.fetchOptimistic(s).catch(()=>{e.clearReset()});function Ri({queries:s,...t},e){const i=Ss(),n=ws(),r=Cs(),l=F.useMemo(()=>s.map(g=>{const S=i.defaultQueryOptions(g);return S._optimisticResults=n?"isRestoring":"optimistic",S}),[s,i,n]);l.forEach(g=>{Rs(g);const S=i.getQueryCache().get(g.queryHash);Es(g,r,S)}),Ms(r);const[a]=F.useState(()=>new ei(i,l,t)),[h,f,d]=a.getOptimisticResult(l,t.combine),u=!n&&t.subscribed!==!1;F.useSyncExternalStore(F.useCallback(g=>u?a.subscribe(A.batchCalls(g)):U,[a,u]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),F.useEffect(()=>{a.setQueries(l,t)},[l,t,a]);const y=h.some((g,S)=>Te(l[S],g))?h.flatMap((g,S)=>{const v=l[S];if(v&&Te(v,g)){const E=new De(i,v);return Fe(v,E,r)}return[]}):[];if(y.length>0)throw Promise.all(y);const p=h.find((g,S)=>{const v=l[S];return v&&Is({result:g,errorResetBoundary:r,throwOnError:v.throwOnError,query:i.getQueryCache().get(v.queryHash),suspense:v.suspense})});if(p!=null&&p.error)throw p.error;return f(d())}function oi(s,t,e){var y,p,g,S;const i=ws(),n=Cs(),r=Ss(),l=r.defaultQueryOptions(s);(p=(y=r.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||p.call(y,l);const a=r.getQueryCache().get(l.queryHash),h=s.subscribed!==!1;l._optimisticResults=i?"isRestoring":h?"optimistic":void 0,Rs(l),Es(l,n,a),Ms(n);const f=!r.getQueryCache().get(l.queryHash),[d]=F.useState(()=>new t(r,l)),u=d.getOptimisticResult(l),m=!i&&h;if(F.useSyncExternalStore(F.useCallback(v=>{const E=m?d.subscribe(A.batchCalls(v)):U;return d.updateResult(),E},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),F.useEffect(()=>{d.setOptions(l)},[l,d]),Te(l,u))throw Fe(l,d,n);if(Is({result:u,errorResetBoundary:n,throwOnError:l.throwOnError,query:a,suspense:l.suspense}))throw u.error;if((S=(g=r.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||S.call(g,l,u),l.experimental_prefetchInRender&&!Wt.isServer()&&ri(u,i)){const v=f?Fe(l,d,n):a==null?void 0:a.promise;v==null||v.catch(U).finally(()=>{d.updateResult()})}return l.notifyOnChangeProps?u:d.trackResult(u)}function xi(s,t){return oi(s,De)}function ai(s,t,e){const i=new Array(s);return new Proxy(i,{get(n,r,l){if(typeof r=="string"){const a=r.charCodeAt(0);if(a>=48&&a<=57){const h=+r;if(Number.isInteger(h)&&h>=0&&h<s){let f=n[h];if(!f){const d=t[h*2];f=n[h]={index:h,key:e(h),start:d,size:t[h*2+1],end:d+t[h*2+1],lane:0}}return f}}if(r==="length")return s}return Reflect.get(n,r,l)}})}function Ct(s,t,e){let i=e.initialDeps??[],n,r=!0;function l(){const a=s();return(a.length!==i.length||a.some((f,d)=>i[d]!==f))&&(i=a,n=t(...a),e!=null&&e.onChange&&!(r&&e.skipInitialOnChange)&&e.onChange(n),r=!1),n}return l.updateDeps=a=>{i=a},l}function Je(s,t){if(s===void 0)throw new Error("Unexpected undefined");return s}const li=(s,t)=>Math.abs(s-t)<1.01,hi=(s,t,e)=>{let i;return function(...n){s.clearTimeout(i),i=s.setTimeout(()=>t.apply(this,n),e)}};let Ut;const he=()=>{if(Ut!==void 0)return Ut;if(typeof navigator>"u")return Ut=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ut=!0;const s=navigator.maxTouchPoints;return Ut=navigator.platform==="MacIntel"&&s!==void 0&&s>0},Xe=s=>{const{offsetWidth:t,offsetHeight:e}=s;return{width:t,height:e}},ui=s=>s,ci=s=>{const t=Math.max(s.startIndex-s.overscan,0),i=Math.min(s.endIndex+s.overscan,s.count-1)-t+1,n=new Array(i);for(let r=0;r<i;r++)n[r]=t+r;return n},di=(s,t)=>{const e=s.scrollElement;if(!e)return;const i=s.targetWindow;if(!i)return;const n=l=>{const{width:a,height:h}=l;t({width:Math.round(a),height:Math.round(h)})};if(n(Xe(e)),!i.ResizeObserver)return()=>{};const r=new i.ResizeObserver(l=>{const a=()=>{const h=l[0];if(h!=null&&h.borderBoxSize){const f=h.borderBoxSize[0];if(f){n({width:f.inlineSize,height:f.blockSize});return}}n(Xe(e))};s.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return r.observe(e,{box:"border-box"}),()=>{r.unobserve(e)}},ae={passive:!0},fi=typeof window>"u"?!0:"onscrollend"in window,mi=(s,t,e)=>{const i=s.scrollElement;if(!i)return;const n=s.targetWindow;if(!n)return;const r=s.options.useScrollendEvent&&fi;let l=0;const a=r?null:hi(n,()=>t(l,!1),s.options.isScrollingResetDelay),h=u=>()=>{l=e(i),a==null||a(),t(l,u)},f=h(!0),d=h(!1);return i.addEventListener("scroll",f,ae),r&&i.addEventListener("scrollend",d,ae),()=>{i.removeEventListener("scroll",f),r&&i.removeEventListener("scrollend",d)}},pi=(s,t)=>mi(s,t,e=>{const{horizontal:i,isRtl:n}=s.options;return i?e.scrollLeft*(n&&-1||1):e.scrollTop}),gi=(s,t,e)=>{if(e.options.useCachedMeasurements){const i=e.indexFromElement(s),n=e.options.getItemKey(i);return e.itemSizeCache.get(n)??e.options.estimateSize(i)}if(t!=null&&t.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[e.options.horizontal?"inlineSize":"blockSize"])}if(!t){const i=e.indexFromElement(s),n=e.options.getItemKey(i),r=e.itemSizeCache.get(n);if(r!==void 0)return r}return s[e.options.horizontal?"offsetWidth":"offsetHeight"]},yi=(s,{adjustments:t=0,behavior:e},i)=>{var n,r;(r=(n=i.scrollElement)==null?void 0:n.scrollTo)==null||r.call(n,{[i.options.horizontal?"left":"top"]:s+t,behavior:e})},vi=yi;class bi{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e,i,n;return((n=(i=(e=this.targetWindow)==null?void 0:e.performance)==null?void 0:i.now)==null?void 0:n.call(i))??Date.now()},this.observer=(()=>{let e=null;const i=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(n=>{n.forEach(r=>{const l=()=>{const a=r.target,h=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[f,d]of this.elementsCache)if(d===a){this.elementsCache.delete(f);break}return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(a,r,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()})}));return{disconnect:()=>{var n;(n=i())==null||n.disconnect(),e=null},observe:n=>{var r;return(r=i())==null?void 0:r.observe(n,{box:"border-box"})},unobserve:n=>{var r;return(r=i())==null?void 0:r.unobserve(n)}}})(),this.range=null,this.setOptions=e=>{var i,n;const r={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ui,rangeExtractor:ci,onChange:()=>{},measureElement:gi,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const m in e){const y=e[m];y!==void 0&&(r[m]=y)}const l=this.options;let a=null,h=null,f=!1;if(l!==void 0&&l.enabled&&r.enabled&&r.anchorTo==="end"&&this.scrollElement!==null){const m=l.count,y=r.count,p=this.getMeasurements(),g=m>0?((i=p[0])==null?void 0:i.key)??l.getItemKey(0):null,S=m>0?((n=p[m-1])==null?void 0:n.key)??l.getItemKey(m-1):null;if(y!==m||m>0&&y>0&&(r.getItemKey(0)!==g||r.getItemKey(y-1)!==S)){f=!0;const w=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??p[0]:null;w&&(a=[w.key,this.getScrollOffset()-w.start]);const O=r.followOnAppend===!0?"auto":r.followOnAppend||null;O&&y>m&&this.isAtEnd(l.scrollEndThreshold)&&(m===0||r.getItemKey(y-1)!==S)&&(h=O)}}this.options=r,f&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,u=0;if(a&&this.scrollOffset!==null){const[m,y]=a,p=this.getMeasurements(),{count:g,getItemKey:S}=this.options;let v=0;for(;v<g&&S(v)!==m;)v++;if(v<g){const E=p[v];if(E){const w=E.start+y;w!==this.scrollOffset&&(u=w-this.scrollOffset,this.scrollOffset=w,d=!0)}}}(d||h)&&(this.pendingScrollAnchor=[d?a[0]:null,d?a[1]:0,h,u])},this.notify=e=>{var i,n;(n=(i=this.options).onChange)==null||n.call(i,this,e)},this.maybeNotify=Ct(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}if(this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,l)=>{if(l&&this._intendedScrollOffset===null&&r===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(r-this._intendedScrollOffset)<1.5&&(r=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const a=this.getScrollOffset();this.scrollDirection=l?a===r?this.scrollDirection:a<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=l,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const r=this.scrollElement,l=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!he()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};r.addEventListener("touchstart",l,ae),r.addEventListener("touchend",a,ae),this.unsubs.push(()=>{r.removeEventListener("touchstart",l),r.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const n=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,n&&this.scrollElement&&this.options.enabled){const[r,l,a,h]=n;r!==null&&!a&&(he()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?h!==0&&(this._iosDeferredAdjustment+=h):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const e=this.getScrollOffset(),i=this.getMaxScrollOffset();if(e<0||e>i)return;const n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,i)=>{const n=new Map,r=new Map;for(let l=i-1;l>=0;l--){const a=e[l];if(n.has(a.lane))continue;const h=r.get(a.lane);if(h==null||a.end>h.end?r.set(a.lane,a):a.end<h.end&&n.set(a.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((l,a)=>l.end===a.end?l.index-a.index:l.end-a.end)[0]:void 0},this.getMeasurementOptions=Ct(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,i,n,r,l,a,h)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:i,scrollMargin:n,getItemKey:r,enabled:l,lanes:a,laneAssignmentMode:h}),{key:!1}),this.getMeasurements=Ct(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:i,scrollMargin:n,getItemKey:r,enabled:l,lanes:a,laneAssignmentMode:h},f)=>{const d=this.itemSizeCache;if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const p of this.laneAssignments.keys())p>=e&&this.laneAssignments.delete(p);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(p=>{this.itemSizeCache.set(p.key,p.size)}));const u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){const p=this.options.gap,g=e*2;let S=this._flatMeasurements;if(!S||S.length<g){const w=new Float64Array(g);S&&u>0&&w.set(S.subarray(0,u*2)),S=w,this._flatMeasurements=S}let v;if(u===0)v=i+n;else{const w=u-1;v=S[w*2]+S[w*2+1]+p}for(let w=u;w<e;w++){const O=r(w),x=d.get(O),P=typeof x=="number"?x:this.options.estimateSize(w);S[w*2]=v,S[w*2+1]=P,v+=P+p}const E=ai(e,S,r);return this.measurementsCache=E,E}const m=this.measurementsCache.slice(0,u),y=new Array(a).fill(void 0);for(let p=0;p<u;p++){const g=m[p];g&&(y[g.lane]=p)}for(let p=u;p<e;p++){const g=r(p),S=this.laneAssignments.get(p);let v,E;const w=h==="estimate"||d.has(g);if(S!==void 0&&this.options.lanes>1){v=S;const D=y[v],R=D!==void 0?m[D]:void 0;E=R?R.end+this.options.gap:i+n}else{const D=this.options.lanes===1?m[p-1]:this.getFurthestMeasurement(m,p);E=D?D.end+this.options.gap:i+n,v=D?D.lane:p%this.options.lanes,this.options.lanes>1&&w&&this.laneAssignments.set(p,v)}const O=d.get(g),x=typeof O=="number"?O:this.options.estimateSize(p),P=E+x;m[p]={index:p,start:E,size:x,end:P,key:g,lane:v},y[v]=p}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Ct(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,i,n,r)=>e.length===0||i===0?(this.range=null,null):(this.range=Oi(e,i,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ct(()=>{let e=null,i=null;const n=this.calculateRange();return n&&(e=n.startIndex,i=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,i]},(e,i,n,r,l)=>r===null||l===null?[]:e({startIndex:r,endIndex:l,overscan:i,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const i=this.options.indexAttribute,n=e.getAttribute(i);return n?parseInt(n,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const n=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(n!==void 0&&this.range){const r=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),l=Math.max(0,n-r),a=Math.min(this.options.count-1,n+r);return e>=l&&e<=a}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((l,a)=>{l.isConnected||(this.observer.unobserve(l),this.elementsCache.delete(a))});return}const i=this.indexFromElement(e),n=this.options.getItemKey(i),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,i)=>{var n,r;if(e<0||e>=this.options.count)return;let l,a,h;const f=this._flatMeasurements;if(this.options.lanes===1&&f!==null)h=this.options.getItemKey(e),a=f[e*2],l=f[e*2+1];else{const m=this.measurementsCache[e];if(!m)return;h=m.key,a=m.start,l=m.size}const d=this.itemSizeCache.get(h)??l,u=i-d;if(u!==0){const m=this.options.anchorTo==="end"&&((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,y=m?this.getTotalSize():0,p=((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:h,start:a,size:l,end:a+l,lane:0},u,this):a<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(h)||this.scrollDirection!=="backward"));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(h,i),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-y):p&&this.applyScrollAdjustment(u),this.notify(!1)}},this.getVirtualItems=Ct(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,i)=>{const n=[];for(let r=0,l=e.length;r<l;r++){const a=e[r],h=i[a];n.push(h)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const i=this.getMeasurements();if(i.length===0)return;const n=this._flatMeasurements,r=this.options.lanes===1&&n!=null,l=xs(0,i.length-1,r?a=>n[a*2]:a=>Je(i[a]).start,e);return Je(i[l])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,i,n=0)=>{if(!this.scrollElement)return 0;const r=this.getSize(),l=this.getScrollOffset();i==="auto"&&(i=e>=l+r?"end":"start"),i==="center"?e+=(n-r)/2:i==="end"&&(e-=r);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,i="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.getSize(),r=this.getScrollOffset(),l=this.measurementsCache[e];if(!l)return;if(i==="auto")if(l.end>=r+n-this.options.scrollPaddingEnd)i="end";else if(l.start<=r+this.options.scrollPaddingStart)i="start";else return[r,i];if(i==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),i];const a=i==="end"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,i,l.size),i]},this.scrollToOffset=(e,{align:i="start",behavior:n="auto"}={})=>{const r=this.getOffsetForAlignment(e,i),l=this.now();this.scrollState={index:null,align:i,behavior:n,startedAt:l,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:i="auto",behavior:n="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));const r=this.getOffsetForIndex(e,i);if(!r)return;const[l,a]=r,h=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:h,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:i="auto"}={})=>{const n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{var e;const i=this.getMeasurements();let n;if(i.length===0)n=this.options.paddingStart;else if(this.options.lanes===1){const r=i.length-1,l=this._flatMeasurements;l!=null?n=l[r*2]+l[r*2+1]:n=((e=i[r])==null?void 0:e.end)??0}else{const r=Array(this.options.lanes).fill(null);let l=i.length-1;for(;l>=0&&r.some(a=>a===null);){const a=i[l];r[a.lane]===null&&(r[a.lane]=a.end),l--}n=Math.max(...r.filter(a=>a!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const e=[];if(this.itemSizeCache.size===0)return e;const i=this.getMeasurements();for(const n of i)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:i,behavior:n})=>{this._intendedScrollOffset=e+(i??0),this.options.scrollToFn(e,{behavior:n,adjustments:i},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,e){t!==0&&(he()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:e}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,n=i?i[0]:this.scrollState.lastTargetOffset,r=1,l=n!==this.scrollState.lastTargetOffset;if(!l&&li(n,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=r){this.getScrollOffset()!==n&&this._scrollToOffset(n,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,l){const a=this.getSize()||600,h=Math.abs(n-this.getScrollOffset()),f=this.scrollState.behavior==="smooth"&&h>a;this.scrollState.lastTargetOffset=n,f||(this.scrollState.behavior="auto"),this._scrollToOffset(n,{adjustments:void 0,behavior:f?"smooth":"auto"})}this.scheduleScrollReconcile()}}const xs=(s,t,e,i)=>{for(;s<=t;){const n=(s+t)/2|0,r=e(n);if(r<i)s=n+1;else if(r>i)t=n-1;else return n}return s>0?s-1:0};function Si(s,t,e){let i=0;for(;i<=t;){const n=(i+t)/2|0,r=s[n*2];if(r<e)i=n+1;else if(r>e)t=n-1;else return n}return i>0?i-1:0}function Oi(s,t,e,i,n){const r=s.length-1;if(s.length<=i)return{startIndex:0,endIndex:r};if(i===1&&n!==null){const f=Si(n,r,e);let d=f;const u=e+t;for(;d<r&&n[d*2]+n[d*2+1]<u;)d++;return{startIndex:f,endIndex:d}}let a=xs(0,r,f=>s[f].start,e),h=a;if(i===1)for(;h<r&&s[h].end<e+t;)h++;else if(i>1){const f=Array(i).fill(0);for(;h<r&&f.some(u=>u<e+t);){const u=s[h];f[u.lane]=u.end,h++}const d=Array(i).fill(e+t);for(;a>=0&&d.some(u=>u>=e);){const u=s[a];d[u.lane]=u.start,a--}a=Math.max(0,a-a%i),h=Math.min(r,h+(i-1-h%i))}return{startIndex:a,endIndex:h}}const ue=typeof document<"u"?F.useLayoutEffect:F.useEffect;function wi({useFlushSync:s=!0,directDomUpdates:t=!1,directDomUpdatesMode:e="transform",...i}){const n=F.useReducer(f=>f+1,0)[1],r=F.useRef({enabled:t,mode:e,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});r.current.enabled=t,r.current.mode=e;const l=f=>{const d=r.current;if(!d.enabled||!d.container)return;const u=f.getTotalSize();if(u!==d.lastSize){d.lastSize=u;const v=f.options.horizontal?"width":"height";d.container.style[v]=`${u}px`}const m=!!f.options.horizontal,y=d.mode==="transform",p=m?"left":"top",g=f.options.scrollMargin,S=f.getVirtualItems();for(const v of S){const E=v.start-g,w=f.elementsCache.get(v.key);w&&d.lastPositions.get(w)!==E&&(d.lastPositions.set(w,E),y?w.style.transform=m?`translate3d(${E}px, 0, 0)`:`translate3d(0, ${E}px, 0)`:w.style[p]=`${E}px`)}},a={...i,onChange:(f,d)=>{var u;const m=r.current;let y=!0;if(m.enabled){l(f);const p=f.range,g=m.prevRange;y=!g||g.isScrolling!==f.isScrolling||g.startIndex!==(p==null?void 0:p.startIndex)||g.endIndex!==(p==null?void 0:p.endIndex),y&&(m.prevRange=p?{startIndex:p.startIndex,endIndex:p.endIndex,isScrolling:f.isScrolling}:null)}y&&(s&&d?Fs.flushSync(n):n()),(u=i.onChange)==null||u.call(i,f,d)}},[h]=F.useState(()=>{const f=new bi(a);return Object.assign(f,{containerRef:d=>{const u=r.current;if(u.container=d,u.lastSize=null,d&&u.enabled){const m=f.getTotalSize();u.lastSize=m;const y=f.options.horizontal?"width":"height";d.style[y]=`${m}px`}}})});return h.setOptions(a),ue(()=>h._didMount(),[]),ue(()=>h._willUpdate()),ue(()=>{l(h)}),h}function Ti(s){return wi({observeElementRect:di,observeElementOffset:pi,scrollToFn:vi,...s})}export{Mi as Q,Ii as a,Ri as b,Ss as c,Ti as d,xi as u};
2
- //# sourceMappingURL=vendor-query-D5H9KBcL.js.map
1
+ var Le=s=>{throw TypeError(s)};var le=(s,t,e)=>t.has(s)||Le("Cannot "+e);var o=(s,t,e)=>(le(s,t,"read from private field"),e?e.call(s):t.get(s)),b=(s,t,e)=>t.has(s)?Le("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),c=(s,t,e,i)=>(le(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e),C=(s,t,e)=>(le(s,t,"access private method"),e);var ie=(s,t,e,i)=>({set _(n){c(s,t,n,e)},get _(){return o(s,t,i)}});import{r as F,j as Ts,a as Fs}from"./vendor-react-BoIQBqDW.js";var Lt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(s){return this.listeners.add(s),this.onSubscribe(),()=>{this.listeners.delete(s),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ft,st,Et,Ze,As=(Ze=class extends Lt{constructor(){super();b(this,ft);b(this,st);b(this,Et);c(this,Et,t=>{if(typeof window<"u"&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}})}onSubscribe(){o(this,st)||this.setEventListener(o(this,Et))}onUnsubscribe(){var t;this.hasListeners()||((t=o(this,st))==null||t.call(this),c(this,st,void 0))}setEventListener(t){var e;c(this,Et,t),(e=o(this,st))==null||e.call(this),c(this,st,t(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(t){o(this,ft)!==t&&(c(this,ft,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){var t;return typeof o(this,ft)=="boolean"?o(this,ft):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ft=new WeakMap,st=new WeakMap,Et=new WeakMap,Ze),Pe=new As,Ps={setTimeout:(s,t)=>setTimeout(s,t),clearTimeout:s=>clearTimeout(s),setInterval:(s,t)=>setInterval(s,t),clearInterval:s=>clearInterval(s)},it,Ae,Ye,_s=(Ye=class{constructor(){b(this,it,Ps);b(this,Ae,!1)}setTimeoutProvider(s){c(this,it,s)}setTimeout(s,t){return o(this,it).setTimeout(s,t)}clearTimeout(s){o(this,it).clearTimeout(s)}setInterval(s,t){return o(this,it).setInterval(s,t)}clearInterval(s){o(this,it).clearInterval(s)}},it=new WeakMap,Ae=new WeakMap,Ye),dt=new _s;function zs(s){setTimeout(s,0)}var Qs=typeof window>"u"||"Deno"in globalThis;function U(){}function Ds(s,t){return typeof s=="function"?s(t):s}function ce(s){return typeof s=="number"&&s>=0&&s!==1/0}function hs(s,t){return Math.max(s+(t||0)-Date.now(),0)}function ct(s,t){return typeof s=="function"?s(t):s}function N(s,t){return typeof s=="function"?s(t):s}function Ue(s,t){const{type:e="all",exact:i,fetchStatus:n,predicate:r,queryKey:l,stale:a}=s;if(l){if(i){if(t.queryHash!==_e(l,t.options))return!1}else if(!Ht(t.queryKey,l))return!1}if(e!=="all"){const h=t.isActive();if(e==="active"&&!h||e==="inactive"&&h)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||n&&n!==t.state.fetchStatus||r&&!r(t))}function qe(s,t){const{exact:e,status:i,predicate:n,mutationKey:r}=s;if(r){if(!t.options.mutationKey)return!1;if(e){if(Kt(t.options.mutationKey)!==Kt(r))return!1}else if(!Ht(t.options.mutationKey,r))return!1}return!(i&&t.state.status!==i||n&&!n(t))}function _e(s,t){return((t==null?void 0:t.queryKeyHashFn)||Kt)(s)}function Kt(s){return JSON.stringify(s,(t,e)=>de(e)?Object.keys(e).sort().reduce((i,n)=>(i[n]=e[n],i),{}):e)}function Ht(s,t){return s===t?!0:typeof s!=typeof t?!1:s&&t&&typeof s=="object"&&typeof t=="object"?Object.keys(t).every(e=>Ht(s[e],t[e])):!1}var js=Object.prototype.hasOwnProperty;function ze(s,t,e=0){if(s===t)return s;if(e>500)return t;const i=Ke(s)&&Ke(t);if(!i&&!(de(s)&&de(t)))return t;const r=(i?s:Object.keys(s)).length,l=i?t:Object.keys(t),a=l.length,h=i?new Array(a):{};let f=0;for(let d=0;d<a;d++){const u=i?d:l[d],m=s[u],y=t[u];if(m===y){h[u]=m,(i?d<r:js.call(s,u))&&f++;continue}if(m===null||y===null||typeof m!="object"||typeof y!="object"){h[u]=y;continue}const p=ze(m,y,e+1);h[u]=p,p===m&&f++}return r===a&&f===r?s:h}function re(s,t){if(!t||Object.keys(s).length!==Object.keys(t).length)return!1;for(const e in s)if(s[e]!==t[e])return!1;return!0}function Ke(s){return Array.isArray(s)&&s.length===Object.keys(s).length}function de(s){if(!He(s))return!1;const t=s.constructor;if(t===void 0)return!0;const e=t.prototype;return!(!He(e)||!e.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(s)!==Object.prototype)}function He(s){return Object.prototype.toString.call(s)==="[object Object]"}function ks(s){return new Promise(t=>{dt.setTimeout(t,s)})}function fe(s,t,e){return typeof e.structuralSharing=="function"?e.structuralSharing(s,t):e.structuralSharing!==!1?ze(s,t):t}function Ls(s,t,e=0){const i=[...s,t];return e&&i.length>e?i.slice(1):i}function Us(s,t,e=0){const i=[t,...s];return e&&i.length>e?i.slice(0,-1):i}var Qe=Symbol();function us(s,t){return!s.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!s.queryFn||s.queryFn===Qe?()=>Promise.reject(new Error(`Missing queryFn: '${s.queryHash}'`)):s.queryFn}function cs(s,t){return typeof s=="function"?s(...t):!!s}function qs(s,t,e){let i=!1,n;return Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(n??(n=t()),i||(i=!0,n.aborted?e():n.addEventListener("abort",e,{once:!0})),n)}),s}var Wt=(()=>{let s=()=>Qs;return{isServer(){return s()},setIsServer(t){s=t}}})();function me(){let s,t;const e=new Promise((n,r)=>{s=n,t=r});e.status="pending",e.catch(()=>{});function i(n){Object.assign(e,n),delete e.resolve,delete e.reject}return e.resolve=n=>{i({status:"fulfilled",value:n}),s(n)},e.reject=n=>{i({status:"rejected",reason:n}),t(n)},e}var Ks=zs;function Hs(){let s=[],t=0,e=a=>{a()},i=a=>{a()},n=Ks;const r=a=>{t?s.push(a):n(()=>{e(a)})},l=()=>{const a=s;s=[],a.length&&n(()=>{i(()=>{a.forEach(h=>{e(h)})})})};return{batch:a=>{let h;t++;try{h=a()}finally{t--,t||l()}return h},batchCalls:a=>(...h)=>{r(()=>{a(...h)})},schedule:r,setNotifyFunction:a=>{e=a},setBatchNotifyFunction:a=>{i=a},setScheduler:a=>{n=a}}}var A=Hs(),Mt,nt,It,ts,Ws=(ts=class extends Lt{constructor(){super();b(this,Mt,!0);b(this,nt);b(this,It);c(this,It,t=>{if(typeof window<"u"&&window.addEventListener){const e=()=>t(!0),i=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",i)}}})}onSubscribe(){o(this,nt)||this.setEventListener(o(this,It))}onUnsubscribe(){var t;this.hasListeners()||((t=o(this,nt))==null||t.call(this),c(this,nt,void 0))}setEventListener(t){var e;c(this,It,t),(e=o(this,nt))==null||e.call(this),c(this,nt,t(this.setOnline.bind(this)))}setOnline(t){o(this,Mt)!==t&&(c(this,Mt,t),this.listeners.forEach(i=>{i(t)}))}isOnline(){return o(this,Mt)}},Mt=new WeakMap,nt=new WeakMap,It=new WeakMap,ts),oe=new Ws;function Ns(s){return Math.min(1e3*2**s,3e4)}function ds(s){return(s??"online")==="online"?oe.isOnline():!0}var pe=class extends Error{constructor(s){super("CancelledError"),this.revert=s==null?void 0:s.revert,this.silent=s==null?void 0:s.silent}};function fs(s){let t=!1,e=0,i;const n=me(),r=()=>n.status!=="pending",l=g=>{var S;if(!r()){const v=new pe(g);m(v),(S=s.onCancel)==null||S.call(s,v)}},a=()=>{t=!0},h=()=>{t=!1},f=()=>Pe.isFocused()&&(s.networkMode==="always"||oe.isOnline())&&s.canRun(),d=()=>ds(s.networkMode)&&s.canRun(),u=g=>{r()||(i==null||i(),n.resolve(g))},m=g=>{r()||(i==null||i(),n.reject(g))},y=()=>new Promise(g=>{var S;i=v=>{(r()||f())&&g(v)},(S=s.onPause)==null||S.call(s)}).then(()=>{var g;i=void 0,r()||(g=s.onContinue)==null||g.call(s)}),p=()=>{if(r())return;let g;const S=e===0?s.initialPromise:void 0;try{g=S??s.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(u).catch(v=>{var P;if(r())return;const E=s.retry??(Wt.isServer()?0:3),w=s.retryDelay??Ns,O=typeof w=="function"?w(e,v):w,x=E===!0||typeof E=="number"&&e<E||typeof E=="function"&&E(e,v);if(t||!x){m(v);return}e++,(P=s.onFail)==null||P.call(s,e,v),ks(O).then(()=>f()?void 0:y()).then(()=>{t?m(v):p()})})};return{promise:n,status:()=>n.status,cancel:l,continue:()=>(i==null||i(),n),cancelRetry:a,continueRetry:h,canStart:d,start:()=>(d()?p():y().then(p),n)}}var mt,es,ms=(es=class{constructor(){b(this,mt)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),ce(this.gcTime)&&c(this,mt,dt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(s){this.gcTime=Math.max(this.gcTime||0,s??(Wt.isServer()?1/0:300*1e3))}clearGcTimeout(){o(this,mt)!==void 0&&(dt.clearTimeout(o(this,mt)),c(this,mt,void 0))}},mt=new WeakMap,es);function Bs(s){return{onFetch:(t,e)=>{var d,u,m,y,p;const i=t.options,n=(m=(u=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:u.fetchMore)==null?void 0:m.direction,r=((y=t.state.data)==null?void 0:y.pages)||[],l=((p=t.state.data)==null?void 0:p.pageParams)||[];let a={pages:[],pageParams:[]},h=0;const f=async()=>{let g=!1;const S=w=>{qs(w,()=>t.signal,()=>g=!0)},v=us(t.options,t.fetchOptions),E=async(w,O,x)=>{if(g)return Promise.reject(t.signal.reason);if(O==null&&w.pages.length)return Promise.resolve(w);const D=(()=>{const tt={client:t.client,queryKey:t.queryKey,pageParam:O,direction:x?"backward":"forward",meta:t.options.meta};return S(tt),tt})(),R=await v(D),{maxPages:z}=t.options,k=x?Us:Ls;return{pages:k(w.pages,R,z),pageParams:k(w.pageParams,O,z)}};if(n&&r.length){const w=n==="backward",O=w?Vs:We,x={pages:r,pageParams:l},P=O(i,x);a=await E(x,P,w)}else{const w=s??r.length;do{const O=h===0?l[0]??i.initialPageParam:We(i,a);if(h>0&&O==null)break;a=await E(a,O),h++}while(h<w)}return a};t.options.persister?t.fetchFn=()=>{var g,S;return(S=(g=t.options).persister)==null?void 0:S.call(g,f,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},e)}:t.fetchFn=f}}}function We(s,{pages:t,pageParams:e}){const i=t.length-1;return t.length>0?s.getNextPageParam(t[i],t,e[i],e):void 0}function Vs(s,{pages:t,pageParams:e}){var i;return t.length>0?(i=s.getPreviousPageParam)==null?void 0:i.call(s,t[0],t,e[0],e):void 0}var Rt,pt,xt,B,gt,Q,Nt,yt,W,ps,X,ss,Gs=(ss=class extends ms{constructor(t){super();b(this,W);b(this,Rt);b(this,pt);b(this,xt);b(this,B);b(this,gt);b(this,Q);b(this,Nt);b(this,yt);c(this,yt,!1),c(this,Nt,t.defaultOptions),this.setOptions(t.options),this.observers=[],c(this,gt,t.client),c(this,B,o(this,gt).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,c(this,pt,Be(this.options)),this.state=t.state??o(this,pt),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return o(this,Rt)}get promise(){var t;return(t=o(this,Q))==null?void 0:t.promise}setOptions(t){if(this.options={...o(this,Nt),...t},t!=null&&t._type&&c(this,Rt,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=Be(this.options);e.data!==void 0&&(this.setState(Ne(e.data,e.dataUpdatedAt)),c(this,pt,e))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&o(this,B).remove(this)}setData(t,e){const i=fe(this.state.data,t,this.options);return C(this,W,X).call(this,{data:i,type:"success",dataUpdatedAt:e==null?void 0:e.updatedAt,manual:e==null?void 0:e.manual}),i}setState(t){C(this,W,X).call(this,{type:"setState",state:t})}cancel(t){var i,n;const e=(i=o(this,Q))==null?void 0:i.promise;return(n=o(this,Q))==null||n.cancel(t),e?e.then(U).catch(U):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return o(this,pt)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>N(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Qe||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ct(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!hs(this.state.dataUpdatedAt,t)}onFocus(){var e;const t=this.observers.find(i=>i.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(e=o(this,Q))==null||e.continue()}onOnline(){var e;const t=this.observers.find(i=>i.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(e=o(this,Q))==null||e.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),o(this,B).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(o(this,Q)&&(o(this,yt)||C(this,W,ps).call(this)?o(this,Q).cancel({revert:!0}):o(this,Q).cancelRetry()),this.scheduleGc()),o(this,B).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||C(this,W,X).call(this,{type:"invalidate"})}async fetch(t,e){var f,d,u,m,y,p,g,S,v,E,w;if(this.state.fetchStatus!=="idle"&&((f=o(this,Q))==null?void 0:f.status())!=="rejected"){if(this.state.data!==void 0&&(e!=null&&e.cancelRefetch))this.cancel({silent:!0});else if(o(this,Q))return o(this,Q).continueRetry(),o(this,Q).promise}if(t&&this.setOptions(t),!this.options.queryFn){const O=this.observers.find(x=>x.options.queryFn);O&&this.setOptions(O.options)}const i=new AbortController,n=O=>{Object.defineProperty(O,"signal",{enumerable:!0,get:()=>(c(this,yt,!0),i.signal)})},r=()=>{const O=us(this.options,e),P=(()=>{const D={client:o(this,gt),queryKey:this.queryKey,meta:this.meta};return n(D),D})();return c(this,yt,!1),this.options.persister?this.options.persister(O,P,this):O(P)},a=(()=>{const O={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:o(this,gt),state:this.state,fetchFn:r};return n(O),O})(),h=o(this,Rt)==="infinite"?Bs(this.options.pages):this.options.behavior;h==null||h.onFetch(a,this),c(this,xt,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&C(this,W,X).call(this,{type:"fetch",meta:(u=a.fetchOptions)==null?void 0:u.meta}),c(this,Q,fs({initialPromise:e==null?void 0:e.initialPromise,fn:a.fetchFn,onCancel:O=>{O instanceof pe&&O.revert&&this.setState({...o(this,xt),fetchStatus:"idle"}),i.abort()},onFail:(O,x)=>{C(this,W,X).call(this,{type:"failed",failureCount:O,error:x})},onPause:()=>{C(this,W,X).call(this,{type:"pause"})},onContinue:()=>{C(this,W,X).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const O=await o(this,Q).start();if(O===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(O),(y=(m=o(this,B).config).onSuccess)==null||y.call(m,O,this),(g=(p=o(this,B).config).onSettled)==null||g.call(p,O,this.state.error,this),O}catch(O){if(O instanceof pe){if(O.silent)return o(this,Q).promise;if(O.revert){if(this.state.data===void 0)throw O;return this.state.data}}throw C(this,W,X).call(this,{type:"error",error:O}),(v=(S=o(this,B).config).onError)==null||v.call(S,O,this),(w=(E=o(this,B).config).onSettled)==null||w.call(E,this.state.data,O,this),O}finally{this.scheduleGc()}}},Rt=new WeakMap,pt=new WeakMap,xt=new WeakMap,B=new WeakMap,gt=new WeakMap,Q=new WeakMap,Nt=new WeakMap,yt=new WeakMap,W=new WeakSet,ps=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},X=function(t){const e=i=>{switch(t.type){case"failed":return{...i,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...gs(i.data,this.options),fetchMeta:t.meta??null};case"success":const n={...i,...Ne(t.data,t.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return c(this,xt,t.manual?n:void 0),n;case"error":const r=t.error;return{...i,error:r,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...t.state}}};this.state=e(this.state),A.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),o(this,B).notify({query:this,type:"updated",action:t})})},ss);function gs(s,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:ds(t.networkMode)?"fetching":"paused",...s===void 0&&{error:null,status:"pending"}}}function Ne(s,t){return{data:s,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Be(s){const t=typeof s.initialData=="function"?s.initialData():s.initialData,e=t!==void 0,i=e?typeof s.initialDataUpdatedAt=="function"?s.initialDataUpdatedAt():s.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:e?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:e?"success":"pending",fetchStatus:"idle"}}var q,M,Bt,L,vt,Tt,Z,rt,Vt,Ft,At,bt,St,ot,Pt,I,qt,ge,ye,ve,be,Se,Oe,we,ys,is,De=(is=class extends Lt{constructor(t,e){super();b(this,I);b(this,q);b(this,M);b(this,Bt);b(this,L);b(this,vt);b(this,Tt);b(this,Z);b(this,rt);b(this,Vt);b(this,Ft);b(this,At);b(this,bt);b(this,St);b(this,ot);b(this,Pt,new Set);this.options=e,c(this,q,t),c(this,rt,null),c(this,Z,me()),this.bindMethods(),this.setOptions(e)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(o(this,M).addObserver(this),Ve(o(this,M),this.options)?C(this,I,qt).call(this):this.updateResult(),C(this,I,be).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ce(o(this,M),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ce(o(this,M),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,C(this,I,Se).call(this),C(this,I,Oe).call(this),o(this,M).removeObserver(this)}setOptions(t){const e=this.options,i=o(this,M);if(this.options=o(this,q).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof N(this.options.enabled,o(this,M))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");C(this,I,we).call(this),o(this,M).setOptions(this.options),e._defaulted&&!re(this.options,e)&&o(this,q).getQueryCache().notify({type:"observerOptionsUpdated",query:o(this,M),observer:this});const n=this.hasListeners();n&&Ge(o(this,M),i,this.options,e)&&C(this,I,qt).call(this),this.updateResult(),n&&(o(this,M)!==i||N(this.options.enabled,o(this,M))!==N(e.enabled,o(this,M))||ct(this.options.staleTime,o(this,M))!==ct(e.staleTime,o(this,M)))&&C(this,I,ge).call(this);const r=C(this,I,ye).call(this);n&&(o(this,M)!==i||N(this.options.enabled,o(this,M))!==N(e.enabled,o(this,M))||r!==o(this,ot))&&C(this,I,ve).call(this,r)}getOptimisticResult(t){const e=o(this,q).getQueryCache().build(o(this,q),t),i=this.createResult(e,t);return Js(this,i)&&(c(this,L,i),c(this,Tt,this.options),c(this,vt,o(this,M).state)),i}getCurrentResult(){return o(this,L)}trackResult(t,e){return new Proxy(t,{get:(i,n)=>(this.trackProp(n),e==null||e(n),n==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&o(this,Z).status==="pending"&&o(this,Z).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,n))})}trackProp(t){o(this,Pt).add(t)}getCurrentQuery(){return o(this,M)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=o(this,q).defaultQueryOptions(t),i=o(this,q).getQueryCache().build(o(this,q),e);return i.fetch().then(()=>this.createResult(i,e))}fetch(t){return C(this,I,qt).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),o(this,L)))}createResult(t,e){var z;const i=o(this,M),n=this.options,r=o(this,L),l=o(this,vt),a=o(this,Tt),f=t!==i?t.state:o(this,Bt),{state:d}=t;let u={...d},m=!1,y;if(e._optimisticResults){const k=this.hasListeners(),tt=!k&&Ve(t,e),te=k&&Ge(t,i,e,n);(tt||te)&&(u={...u,...gs(d.data,t.options)}),e._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:p,errorUpdatedAt:g,status:S}=u;y=u.data;let v=!1;if(e.placeholderData!==void 0&&y===void 0&&S==="pending"){let k;r!=null&&r.isPlaceholderData&&e.placeholderData===(a==null?void 0:a.placeholderData)?(k=r.data,v=!0):k=typeof e.placeholderData=="function"?e.placeholderData((z=o(this,At))==null?void 0:z.state.data,o(this,At)):e.placeholderData,k!==void 0&&(S="success",y=fe(r==null?void 0:r.data,k,e),m=!0)}if(e.select&&y!==void 0&&!v)if(r&&y===(l==null?void 0:l.data)&&e.select===o(this,Vt))y=o(this,Ft);else try{c(this,Vt,e.select),y=e.select(y),y=fe(r==null?void 0:r.data,y,e),c(this,Ft,y),c(this,rt,null)}catch(k){c(this,rt,k)}o(this,rt)&&(p=o(this,rt),y=o(this,Ft),g=Date.now(),S="error");const E=u.fetchStatus==="fetching",w=S==="pending",O=S==="error",x=w&&E,P=y!==void 0,R={status:S,fetchStatus:u.fetchStatus,isPending:w,isSuccess:S==="success",isError:O,isInitialLoading:x,isLoading:x,data:y,dataUpdatedAt:u.dataUpdatedAt,error:p,errorUpdatedAt:g,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:u.dataUpdateCount>f.dataUpdateCount||u.errorUpdateCount>f.errorUpdateCount,isFetching:E,isRefetching:E&&!w,isLoadingError:O&&!P,isPaused:u.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:O&&P,isStale:je(t,e),refetch:this.refetch,promise:o(this,Z),isEnabled:N(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const k=R.data!==void 0,tt=R.status==="error"&&!k,te=se=>{tt?se.reject(R.error):k&&se.resolve(R.data)},ke=()=>{const se=c(this,Z,R.promise=me());te(se)},ee=o(this,Z);switch(ee.status){case"pending":t.queryHash===i.queryHash&&te(ee);break;case"fulfilled":(tt||R.data!==ee.value)&&ke();break;case"rejected":(!tt||R.error!==ee.reason)&&ke();break}}return R}updateResult(){const t=o(this,L),e=this.createResult(o(this,M),this.options);if(c(this,vt,o(this,M).state),c(this,Tt,this.options),o(this,vt).data!==void 0&&c(this,At,o(this,M)),re(e,t))return;c(this,L,e);const i=()=>{if(!t)return!0;const{notifyOnChangeProps:n}=this.options,r=typeof n=="function"?n():n;if(r==="all"||!r&&!o(this,Pt).size)return!0;const l=new Set(r??o(this,Pt));return this.options.throwOnError&&l.add("error"),Object.keys(o(this,L)).some(a=>{const h=a;return o(this,L)[h]!==t[h]&&l.has(h)})};C(this,I,ys).call(this,{listeners:i()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&C(this,I,be).call(this)}},q=new WeakMap,M=new WeakMap,Bt=new WeakMap,L=new WeakMap,vt=new WeakMap,Tt=new WeakMap,Z=new WeakMap,rt=new WeakMap,Vt=new WeakMap,Ft=new WeakMap,At=new WeakMap,bt=new WeakMap,St=new WeakMap,ot=new WeakMap,Pt=new WeakMap,I=new WeakSet,qt=function(t){C(this,I,we).call(this);let e=o(this,M).fetch(this.options,t);return t!=null&&t.throwOnError||(e=e.catch(U)),e},ge=function(){C(this,I,Se).call(this);const t=ct(this.options.staleTime,o(this,M));if(Wt.isServer()||o(this,L).isStale||!ce(t))return;const i=hs(o(this,L).dataUpdatedAt,t)+1;c(this,bt,dt.setTimeout(()=>{o(this,L).isStale||this.updateResult()},i))},ye=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(o(this,M)):this.options.refetchInterval)??!1},ve=function(t){C(this,I,Oe).call(this),c(this,ot,t),!(Wt.isServer()||N(this.options.enabled,o(this,M))===!1||!ce(o(this,ot))||o(this,ot)===0)&&c(this,St,dt.setInterval(()=>{(this.options.refetchIntervalInBackground||Pe.isFocused())&&C(this,I,qt).call(this)},o(this,ot)))},be=function(){C(this,I,ge).call(this),C(this,I,ve).call(this,C(this,I,ye).call(this))},Se=function(){o(this,bt)!==void 0&&(dt.clearTimeout(o(this,bt)),c(this,bt,void 0))},Oe=function(){o(this,St)!==void 0&&(dt.clearInterval(o(this,St)),c(this,St,void 0))},we=function(){const t=o(this,q).getQueryCache().build(o(this,q),this.options);if(t===o(this,M))return;const e=o(this,M);c(this,M,t),c(this,Bt,t.state),this.hasListeners()&&(e==null||e.removeObserver(this),t.addObserver(this))},ys=function(t){A.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(o(this,L))}),o(this,q).getQueryCache().notify({query:o(this,M),type:"observerResultsUpdated"})})},is);function $s(s,t){return N(t.enabled,s)!==!1&&s.state.data===void 0&&!(s.state.status==="error"&&N(t.retryOnMount,s)===!1)}function Ve(s,t){return $s(s,t)||s.state.data!==void 0&&Ce(s,t,t.refetchOnMount)}function Ce(s,t,e){if(N(t.enabled,s)!==!1&&ct(t.staleTime,s)!=="static"){const i=typeof e=="function"?e(s):e;return i==="always"||i!==!1&&je(s,t)}return!1}function Ge(s,t,e,i){return(s!==t||N(i.enabled,s)===!1)&&(!e.suspense||s.state.status!=="error")&&je(s,e)}function je(s,t){return N(t.enabled,s)!==!1&&s.isStaleByTime(ct(t.staleTime,s))}function Js(s,t){return!re(s.getCurrentResult(),t)}var Gt,G,j,Ot,$,et,ns,Xs=(ns=class extends ms{constructor(t){super();b(this,$);b(this,Gt);b(this,G);b(this,j);b(this,Ot);c(this,Gt,t.client),this.mutationId=t.mutationId,c(this,j,t.mutationCache),c(this,G,[]),this.state=t.state||Zs(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){o(this,G).includes(t)||(o(this,G).push(t),this.clearGcTimeout(),o(this,j).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){c(this,G,o(this,G).filter(e=>e!==t)),this.scheduleGc(),o(this,j).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){o(this,G).length||(this.state.status==="pending"?this.scheduleGc():o(this,j).remove(this))}continue(){var t;return((t=o(this,Ot))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var l,a,h,f,d,u,m,y,p,g,S,v,E,w,O,x,P,D;const e=()=>{C(this,$,et).call(this,{type:"continue"})},i={client:o(this,Gt),meta:this.options.meta,mutationKey:this.options.mutationKey};c(this,Ot,fs({fn:()=>this.options.mutationFn?this.options.mutationFn(t,i):Promise.reject(new Error("No mutationFn found")),onFail:(R,z)=>{C(this,$,et).call(this,{type:"failed",failureCount:R,error:z})},onPause:()=>{C(this,$,et).call(this,{type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>o(this,j).canRun(this)}));const n=this.state.status==="pending",r=!o(this,Ot).canStart();try{if(n)e();else{C(this,$,et).call(this,{type:"pending",variables:t,isPaused:r}),o(this,j).config.onMutate&&await o(this,j).config.onMutate(t,this,i);const z=await((a=(l=this.options).onMutate)==null?void 0:a.call(l,t,i));z!==this.state.context&&C(this,$,et).call(this,{type:"pending",context:z,variables:t,isPaused:r})}const R=await o(this,Ot).start();return await((f=(h=o(this,j).config).onSuccess)==null?void 0:f.call(h,R,t,this.state.context,this,i)),await((u=(d=this.options).onSuccess)==null?void 0:u.call(d,R,t,this.state.context,i)),await((y=(m=o(this,j).config).onSettled)==null?void 0:y.call(m,R,null,this.state.variables,this.state.context,this,i)),await((g=(p=this.options).onSettled)==null?void 0:g.call(p,R,null,t,this.state.context,i)),C(this,$,et).call(this,{type:"success",data:R}),R}catch(R){try{await((v=(S=o(this,j).config).onError)==null?void 0:v.call(S,R,t,this.state.context,this,i))}catch(z){Promise.reject(z)}try{await((w=(E=this.options).onError)==null?void 0:w.call(E,R,t,this.state.context,i))}catch(z){Promise.reject(z)}try{await((x=(O=o(this,j).config).onSettled)==null?void 0:x.call(O,void 0,R,this.state.variables,this.state.context,this,i))}catch(z){Promise.reject(z)}try{await((D=(P=this.options).onSettled)==null?void 0:D.call(P,void 0,R,t,this.state.context,i))}catch(z){Promise.reject(z)}throw C(this,$,et).call(this,{type:"error",error:R}),R}finally{o(this,j).runNext(this)}}},Gt=new WeakMap,G=new WeakMap,j=new WeakMap,Ot=new WeakMap,$=new WeakSet,et=function(t){const e=i=>{switch(t.type){case"failed":return{...i,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,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{...i,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:t.error,failureCount:i.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),A.batch(()=>{o(this,G).forEach(i=>{i.onMutationUpdate(t)}),o(this,j).notify({mutation:this,type:"updated",action:t})})},ns);function Zs(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Y,V,$t,rs,Ys=(rs=class extends Lt{constructor(t={}){super();b(this,Y);b(this,V);b(this,$t);this.config=t,c(this,Y,new Set),c(this,V,new Map),c(this,$t,0)}build(t,e,i){const n=new Xs({client:t,mutationCache:this,mutationId:++ie(this,$t)._,options:t.defaultMutationOptions(e),state:i});return this.add(n),n}add(t){o(this,Y).add(t);const e=ne(t);if(typeof e=="string"){const i=o(this,V).get(e);i?i.push(t):o(this,V).set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(o(this,Y).delete(t)){const e=ne(t);if(typeof e=="string"){const i=o(this,V).get(e);if(i)if(i.length>1){const n=i.indexOf(t);n!==-1&&i.splice(n,1)}else i[0]===t&&o(this,V).delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=ne(t);if(typeof e=="string"){const i=o(this,V).get(e),n=i==null?void 0:i.find(r=>r.state.status==="pending");return!n||n===t}else return!0}runNext(t){var i;const e=ne(t);if(typeof e=="string"){const n=(i=o(this,V).get(e))==null?void 0:i.find(r=>r!==t&&r.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}else return Promise.resolve()}clear(){A.batch(()=>{o(this,Y).forEach(t=>{this.notify({type:"removed",mutation:t})}),o(this,Y).clear(),o(this,V).clear()})}getAll(){return Array.from(o(this,Y))}find(t){const e={exact:!0,...t};return this.getAll().find(i=>qe(e,i))}findAll(t={}){return this.getAll().filter(e=>qe(t,e))}notify(t){A.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return A.batch(()=>Promise.all(t.map(e=>e.continue().catch(U))))}},Y=new WeakMap,V=new WeakMap,$t=new WeakMap,rs);function ne(s){var t;return(t=s.options.scope)==null?void 0:t.id}function $e(s,t){const e=new Set(t);return s.filter(i=>!e.has(i))}function ti(s,t,e){const i=s.slice(0);return i[t]=e,i}var _t,K,zt,wt,H,at,Jt,Xt,Zt,Yt,_,Ee,Me,vs,Ie,Re,xe,os,ei=(os=class extends Lt{constructor(t,e,i){super();b(this,_);b(this,_t);b(this,K);b(this,zt);b(this,wt);b(this,H);b(this,at);b(this,Jt);b(this,Xt);b(this,Zt);b(this,Yt,[]);c(this,_t,t),c(this,wt,i),c(this,zt,[]),c(this,H,[]),c(this,K,[]),this.setQueries(e)}onSubscribe(){this.listeners.size===1&&o(this,H).forEach(t=>{t.subscribe(e=>{C(this,_,Re).call(this,t,e)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,o(this,H).forEach(t=>{t.destroy()})}setQueries(t,e){c(this,zt,t),c(this,wt,e),A.batch(()=>{const i=o(this,H),n=C(this,_,Ie).call(this,o(this,zt));n.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions));const r=n.map(u=>u.observer),l=r.map(u=>u.getCurrentResult()),a=i.length!==r.length,h=r.some((u,m)=>u!==i[m]),f=a||h,d=f?!0:l.some((u,m)=>{const y=o(this,K)[m];return!y||!re(u,y)});!f&&!d||(f&&(c(this,Yt,n),c(this,H,r)),c(this,K,l),this.hasListeners()&&(f&&($e(i,r).forEach(u=>{u.destroy()}),$e(r,i).forEach(u=>{u.subscribe(m=>{C(this,_,Re).call(this,u,m)})})),C(this,_,xe).call(this)))})}getCurrentResult(){return o(this,K)}getQueries(){return o(this,H).map(t=>t.getCurrentQuery())}getObservers(){return o(this,H)}getOptimisticResult(t,e){const i=C(this,_,Ie).call(this,t),n=i.map(l=>l.observer.getOptimisticResult(l.defaultedQueryOptions)),r=i.map(l=>l.defaultedQueryOptions.queryHash);return[n,l=>C(this,_,Me).call(this,l??n,e,r),()=>C(this,_,Ee).call(this,n,i)]}},_t=new WeakMap,K=new WeakMap,zt=new WeakMap,wt=new WeakMap,H=new WeakMap,at=new WeakMap,Jt=new WeakMap,Xt=new WeakMap,Zt=new WeakMap,Yt=new WeakMap,_=new WeakSet,Ee=function(t,e){return e.map((i,n)=>{const r=t[n];return i.defaultedQueryOptions.notifyOnChangeProps?r:i.observer.trackResult(r,l=>{e.forEach(a=>{a.observer.trackProp(l)})})})},Me=function(t,e,i){if(e){const n=o(this,Zt),r=i!==void 0&&n!==void 0&&(n.length!==i.length||i.some((l,a)=>l!==n[a]));return(!o(this,at)||o(this,K)!==o(this,Xt)||r||e!==o(this,Jt))&&(c(this,Jt,e),c(this,Xt,o(this,K)),i!==void 0&&c(this,Zt,i),c(this,at,ze(o(this,at),e(t)))),o(this,at)}return t},vs=function(){var t;return((t=o(this,wt))==null?void 0:t.combine)!==void 0&&o(this,H).some((e,i)=>{var n;return e.options.suspense&&((n=o(this,K)[i])==null?void 0:n.data)===void 0})},Ie=function(t){const e=new Map;o(this,H).forEach(n=>{const r=n.options.queryHash;if(!r)return;const l=e.get(r);l?l.push(n):e.set(r,[n])});const i=[];return t.forEach(n=>{var h;const r=o(this,_t).defaultQueryOptions(n),a=((h=e.get(r.queryHash))==null?void 0:h.shift())??new De(o(this,_t),r);i.push({defaultedQueryOptions:r,observer:a})}),i},Re=function(t,e){const i=o(this,H).indexOf(t);i!==-1&&(c(this,K,ti(o(this,K),i,e)),C(this,_,xe).call(this))},xe=function(){var t;if(this.hasListeners()){const e=C(this,_,Ee).call(this,o(this,K),o(this,Yt)),i=C(this,_,vs).call(this),n=o(this,at),r=i?n:C(this,_,Me).call(this,e,(t=o(this,wt))==null?void 0:t.combine);(i||n!==r)&&A.batch(()=>{this.listeners.forEach(l=>{l(o(this,K))})})}},os),J,as,si=(as=class extends Lt{constructor(t={}){super();b(this,J);this.config=t,c(this,J,new Map)}build(t,e,i){const n=e.queryKey,r=e.queryHash??_e(n,e);let l=this.get(r);return l||(l=new Gs({client:t,queryKey:n,queryHash:r,options:t.defaultQueryOptions(e),state:i,defaultOptions:t.getQueryDefaults(n)}),this.add(l)),l}add(t){o(this,J).has(t.queryHash)||(o(this,J).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=o(this,J).get(t.queryHash);e&&(t.destroy(),e===t&&o(this,J).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){A.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return o(this,J).get(t)}getAll(){return[...o(this,J).values()]}find(t){const e={exact:!0,...t};return this.getAll().find(i=>Ue(e,i))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(i=>Ue(t,i)):e}notify(t){A.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){A.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){A.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},J=new WeakMap,as),T,lt,ht,Qt,Dt,ut,jt,kt,ls,Mi=(ls=class{constructor(s={}){b(this,T);b(this,lt);b(this,ht);b(this,Qt);b(this,Dt);b(this,ut);b(this,jt);b(this,kt);c(this,T,s.queryCache||new si),c(this,lt,s.mutationCache||new Ys),c(this,ht,s.defaultOptions||{}),c(this,Qt,new Map),c(this,Dt,new Map),c(this,ut,0)}mount(){ie(this,ut)._++,o(this,ut)===1&&(c(this,jt,Pe.subscribe(async s=>{s&&(await this.resumePausedMutations(),o(this,T).onFocus())})),c(this,kt,oe.subscribe(async s=>{s&&(await this.resumePausedMutations(),o(this,T).onOnline())})))}unmount(){var s,t;ie(this,ut)._--,o(this,ut)===0&&((s=o(this,jt))==null||s.call(this),c(this,jt,void 0),(t=o(this,kt))==null||t.call(this),c(this,kt,void 0))}isFetching(s){return o(this,T).findAll({...s,fetchStatus:"fetching"}).length}isMutating(s){return o(this,lt).findAll({...s,status:"pending"}).length}getQueryData(s){var e;const t=this.defaultQueryOptions({queryKey:s});return(e=o(this,T).get(t.queryHash))==null?void 0:e.state.data}ensureQueryData(s){const t=this.defaultQueryOptions(s),e=o(this,T).build(this,t),i=e.state.data;return i===void 0?this.fetchQuery(s):(s.revalidateIfStale&&e.isStaleByTime(ct(t.staleTime,e))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(s){return o(this,T).findAll(s).map(({queryKey:t,state:e})=>{const i=e.data;return[t,i]})}setQueryData(s,t,e){const i=this.defaultQueryOptions({queryKey:s}),n=o(this,T).get(i.queryHash),r=n==null?void 0:n.state.data,l=Ds(t,r);if(l!==void 0)return o(this,T).build(this,i).setData(l,{...e,manual:!0})}setQueriesData(s,t,e){return A.batch(()=>o(this,T).findAll(s).map(({queryKey:i})=>[i,this.setQueryData(i,t,e)]))}getQueryState(s){var e;const t=this.defaultQueryOptions({queryKey:s});return(e=o(this,T).get(t.queryHash))==null?void 0:e.state}removeQueries(s){const t=o(this,T);A.batch(()=>{t.findAll(s).forEach(e=>{t.remove(e)})})}resetQueries(s,t){const e=o(this,T);return A.batch(()=>(e.findAll(s).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...s},t)))}cancelQueries(s,t={}){const e={revert:!0,...t},i=A.batch(()=>o(this,T).findAll(s).map(n=>n.cancel(e)));return Promise.all(i).then(U).catch(U)}invalidateQueries(s,t={}){return A.batch(()=>(o(this,T).findAll(s).forEach(e=>{e.invalidate()}),(s==null?void 0:s.refetchType)==="none"?Promise.resolve():this.refetchQueries({...s,type:(s==null?void 0:s.refetchType)??(s==null?void 0:s.type)??"active"},t)))}refetchQueries(s,t={}){const e={...t,cancelRefetch:t.cancelRefetch??!0},i=A.batch(()=>o(this,T).findAll(s).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let r=n.fetch(void 0,e);return e.throwOnError||(r=r.catch(U)),n.state.fetchStatus==="paused"?Promise.resolve():r}));return Promise.all(i).then(U)}fetchQuery(s){const t=this.defaultQueryOptions(s);t.retry===void 0&&(t.retry=!1);const e=o(this,T).build(this,t);return e.isStaleByTime(ct(t.staleTime,e))?e.fetch(t):Promise.resolve(e.state.data)}prefetchQuery(s){return this.fetchQuery(s).then(U).catch(U)}fetchInfiniteQuery(s){return s._type="infinite",this.fetchQuery(s)}prefetchInfiniteQuery(s){return this.fetchInfiniteQuery(s).then(U).catch(U)}ensureInfiniteQueryData(s){return s._type="infinite",this.ensureQueryData(s)}resumePausedMutations(){return oe.isOnline()?o(this,lt).resumePausedMutations():Promise.resolve()}getQueryCache(){return o(this,T)}getMutationCache(){return o(this,lt)}getDefaultOptions(){return o(this,ht)}setDefaultOptions(s){c(this,ht,s)}setQueryDefaults(s,t){o(this,Qt).set(Kt(s),{queryKey:s,defaultOptions:t})}getQueryDefaults(s){const t=[...o(this,Qt).values()],e={};return t.forEach(i=>{Ht(s,i.queryKey)&&Object.assign(e,i.defaultOptions)}),e}setMutationDefaults(s,t){o(this,Dt).set(Kt(s),{mutationKey:s,defaultOptions:t})}getMutationDefaults(s){const t=[...o(this,Dt).values()],e={};return t.forEach(i=>{Ht(s,i.mutationKey)&&Object.assign(e,i.defaultOptions)}),e}defaultQueryOptions(s){if(s._defaulted)return s;const t={...o(this,ht).queries,...this.getQueryDefaults(s.queryKey),...s,_defaulted:!0};return t.queryHash||(t.queryHash=_e(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Qe&&(t.enabled=!1),t}defaultMutationOptions(s){return s!=null&&s._defaulted?s:{...o(this,ht).mutations,...(s==null?void 0:s.mutationKey)&&this.getMutationDefaults(s.mutationKey),...s,_defaulted:!0}}clear(){o(this,T).clear(),o(this,lt).clear()}},T=new WeakMap,lt=new WeakMap,ht=new WeakMap,Qt=new WeakMap,Dt=new WeakMap,ut=new WeakMap,jt=new WeakMap,kt=new WeakMap,ls),bs=F.createContext(void 0),Ss=s=>{const t=F.useContext(bs);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},Ii=({client:s,children:t})=>(F.useEffect(()=>(s.mount(),()=>{s.unmount()}),[s]),Ts.jsx(bs.Provider,{value:s,children:t})),Os=F.createContext(!1),ws=()=>F.useContext(Os);Os.Provider;function ii(){let s=!1;return{clearReset:()=>{s=!1},reset:()=>{s=!0},isReset:()=>s}}var ni=F.createContext(ii()),Cs=()=>F.useContext(ni),Es=(s,t,e)=>{const i=e!=null&&e.state.error&&typeof s.throwOnError=="function"?cs(s.throwOnError,[e.state.error,e]):s.throwOnError;(s.suspense||s.experimental_prefetchInRender||i)&&(t.isReset()||(s.retryOnMount=!1))},Ms=s=>{F.useEffect(()=>{s.clearReset()},[s])},Is=({result:s,errorResetBoundary:t,throwOnError:e,query:i,suspense:n})=>s.isError&&!t.isReset()&&!s.isFetching&&i&&(n&&s.data===void 0||cs(e,[s.error,i])),Rs=s=>{if(s.suspense){const e=n=>n==="static"?n:Math.max(n??1e3,1e3),i=s.staleTime;s.staleTime=typeof i=="function"?(...n)=>e(i(...n)):e(i),typeof s.gcTime=="number"&&(s.gcTime=Math.max(s.gcTime,1e3))}},ri=(s,t)=>s.isLoading&&s.isFetching&&!t,Te=(s,t)=>(s==null?void 0:s.suspense)&&t.isPending,Fe=(s,t,e)=>t.fetchOptimistic(s).catch(()=>{e.clearReset()});function Ri({queries:s,...t},e){const i=Ss(),n=ws(),r=Cs(),l=F.useMemo(()=>s.map(g=>{const S=i.defaultQueryOptions(g);return S._optimisticResults=n?"isRestoring":"optimistic",S}),[s,i,n]);l.forEach(g=>{Rs(g);const S=i.getQueryCache().get(g.queryHash);Es(g,r,S)}),Ms(r);const[a]=F.useState(()=>new ei(i,l,t)),[h,f,d]=a.getOptimisticResult(l,t.combine),u=!n&&t.subscribed!==!1;F.useSyncExternalStore(F.useCallback(g=>u?a.subscribe(A.batchCalls(g)):U,[a,u]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),F.useEffect(()=>{a.setQueries(l,t)},[l,t,a]);const y=h.some((g,S)=>Te(l[S],g))?h.flatMap((g,S)=>{const v=l[S];if(v&&Te(v,g)){const E=new De(i,v);return Fe(v,E,r)}return[]}):[];if(y.length>0)throw Promise.all(y);const p=h.find((g,S)=>{const v=l[S];return v&&Is({result:g,errorResetBoundary:r,throwOnError:v.throwOnError,query:i.getQueryCache().get(v.queryHash),suspense:v.suspense})});if(p!=null&&p.error)throw p.error;return f(d())}function oi(s,t,e){var y,p,g,S;const i=ws(),n=Cs(),r=Ss(),l=r.defaultQueryOptions(s);(p=(y=r.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||p.call(y,l);const a=r.getQueryCache().get(l.queryHash),h=s.subscribed!==!1;l._optimisticResults=i?"isRestoring":h?"optimistic":void 0,Rs(l),Es(l,n,a),Ms(n);const f=!r.getQueryCache().get(l.queryHash),[d]=F.useState(()=>new t(r,l)),u=d.getOptimisticResult(l),m=!i&&h;if(F.useSyncExternalStore(F.useCallback(v=>{const E=m?d.subscribe(A.batchCalls(v)):U;return d.updateResult(),E},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),F.useEffect(()=>{d.setOptions(l)},[l,d]),Te(l,u))throw Fe(l,d,n);if(Is({result:u,errorResetBoundary:n,throwOnError:l.throwOnError,query:a,suspense:l.suspense}))throw u.error;if((S=(g=r.getDefaultOptions().queries)==null?void 0:g._experimental_afterQuery)==null||S.call(g,l,u),l.experimental_prefetchInRender&&!Wt.isServer()&&ri(u,i)){const v=f?Fe(l,d,n):a==null?void 0:a.promise;v==null||v.catch(U).finally(()=>{d.updateResult()})}return l.notifyOnChangeProps?u:d.trackResult(u)}function xi(s,t){return oi(s,De)}function ai(s,t,e){const i=new Array(s);return new Proxy(i,{get(n,r,l){if(typeof r=="string"){const a=r.charCodeAt(0);if(a>=48&&a<=57){const h=+r;if(Number.isInteger(h)&&h>=0&&h<s){let f=n[h];if(!f){const d=t[h*2];f=n[h]={index:h,key:e(h),start:d,size:t[h*2+1],end:d+t[h*2+1],lane:0}}return f}}if(r==="length")return s}return Reflect.get(n,r,l)}})}function Ct(s,t,e){let i=e.initialDeps??[],n,r=!0;function l(){const a=s();return(a.length!==i.length||a.some((f,d)=>i[d]!==f))&&(i=a,n=t(...a),e!=null&&e.onChange&&!(r&&e.skipInitialOnChange)&&e.onChange(n),r=!1),n}return l.updateDeps=a=>{i=a},l}function Je(s,t){if(s===void 0)throw new Error("Unexpected undefined");return s}const li=(s,t)=>Math.abs(s-t)<1.01,hi=(s,t,e)=>{let i;return function(...n){s.clearTimeout(i),i=s.setTimeout(()=>t.apply(this,n),e)}};let Ut;const he=()=>{if(Ut!==void 0)return Ut;if(typeof navigator>"u")return Ut=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ut=!0;const s=navigator.maxTouchPoints;return Ut=navigator.platform==="MacIntel"&&s!==void 0&&s>0},Xe=s=>{const{offsetWidth:t,offsetHeight:e}=s;return{width:t,height:e}},ui=s=>s,ci=s=>{const t=Math.max(s.startIndex-s.overscan,0),i=Math.min(s.endIndex+s.overscan,s.count-1)-t+1,n=new Array(i);for(let r=0;r<i;r++)n[r]=t+r;return n},di=(s,t)=>{const e=s.scrollElement;if(!e)return;const i=s.targetWindow;if(!i)return;const n=l=>{const{width:a,height:h}=l;t({width:Math.round(a),height:Math.round(h)})};if(n(Xe(e)),!i.ResizeObserver)return()=>{};const r=new i.ResizeObserver(l=>{const a=()=>{const h=l[0];if(h!=null&&h.borderBoxSize){const f=h.borderBoxSize[0];if(f){n({width:f.inlineSize,height:f.blockSize});return}}n(Xe(e))};s.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return r.observe(e,{box:"border-box"}),()=>{r.unobserve(e)}},ae={passive:!0},fi=typeof window>"u"?!0:"onscrollend"in window,mi=(s,t,e)=>{const i=s.scrollElement;if(!i)return;const n=s.targetWindow;if(!n)return;const r=s.options.useScrollendEvent&&fi;let l=0;const a=r?null:hi(n,()=>t(l,!1),s.options.isScrollingResetDelay),h=u=>()=>{l=e(i),a==null||a(),t(l,u)},f=h(!0),d=h(!1);return i.addEventListener("scroll",f,ae),r&&i.addEventListener("scrollend",d,ae),()=>{i.removeEventListener("scroll",f),r&&i.removeEventListener("scrollend",d)}},pi=(s,t)=>mi(s,t,e=>{const{horizontal:i,isRtl:n}=s.options;return i?e.scrollLeft*(n&&-1||1):e.scrollTop}),gi=(s,t,e)=>{if(e.options.useCachedMeasurements){const i=e.indexFromElement(s),n=e.options.getItemKey(i);return e.itemSizeCache.get(n)??e.options.estimateSize(i)}if(t!=null&&t.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[e.options.horizontal?"inlineSize":"blockSize"])}if(!t){const i=e.indexFromElement(s),n=e.options.getItemKey(i),r=e.itemSizeCache.get(n);if(r!==void 0)return r}return s[e.options.horizontal?"offsetWidth":"offsetHeight"]},yi=(s,{adjustments:t=0,behavior:e},i)=>{var n,r;(r=(n=i.scrollElement)==null?void 0:n.scrollTo)==null||r.call(n,{[i.options.horizontal?"left":"top"]:s+t,behavior:e})},vi=yi;class bi{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e,i,n;return((n=(i=(e=this.targetWindow)==null?void 0:e.performance)==null?void 0:i.now)==null?void 0:n.call(i))??Date.now()},this.observer=(()=>{let e=null;const i=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(n=>{n.forEach(r=>{const l=()=>{const a=r.target,h=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[f,d]of this.elementsCache)if(d===a){this.elementsCache.delete(f);break}return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(a,r,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()})}));return{disconnect:()=>{var n;(n=i())==null||n.disconnect(),e=null},observe:n=>{var r;return(r=i())==null?void 0:r.observe(n,{box:"border-box"})},unobserve:n=>{var r;return(r=i())==null?void 0:r.unobserve(n)}}})(),this.range=null,this.setOptions=e=>{var i,n;const r={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ui,rangeExtractor:ci,onChange:()=>{},measureElement:gi,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const m in e){const y=e[m];y!==void 0&&(r[m]=y)}const l=this.options;let a=null,h=null,f=!1;if(l!==void 0&&l.enabled&&r.enabled&&r.anchorTo==="end"&&this.scrollElement!==null){const m=l.count,y=r.count,p=this.getMeasurements(),g=m>0?((i=p[0])==null?void 0:i.key)??l.getItemKey(0):null,S=m>0?((n=p[m-1])==null?void 0:n.key)??l.getItemKey(m-1):null;if(y!==m||m>0&&y>0&&(r.getItemKey(0)!==g||r.getItemKey(y-1)!==S)){f=!0;const w=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??p[0]:null;w&&(a=[w.key,this.getScrollOffset()-w.start]);const O=r.followOnAppend===!0?"auto":r.followOnAppend||null;O&&y>m&&this.isAtEnd(l.scrollEndThreshold)&&(m===0||r.getItemKey(y-1)!==S)&&(h=O)}}this.options=r,f&&(this.pendingMin=0,this.itemSizeCacheVersion++);let d=!1,u=0;if(a&&this.scrollOffset!==null){const[m,y]=a,p=this.getMeasurements(),{count:g,getItemKey:S}=this.options;let v=0;for(;v<g&&S(v)!==m;)v++;if(v<g){const E=p[v];if(E){const w=E.start+y;w!==this.scrollOffset&&(u=w-this.scrollOffset,this.scrollOffset=w,d=!0)}}}(d||h)&&(this.pendingScrollAnchor=[d?a[0]:null,d?a[1]:0,h,u])},this.notify=e=>{var i,n;(n=(i=this.options).onChange)==null||n.call(i,this,e)},this.maybeNotify=Ct(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}if(this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,l)=>{if(l&&this._intendedScrollOffset===null&&r===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(r-this._intendedScrollOffset)<1.5&&(r=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const a=this.getScrollOffset();this.scrollDirection=l?a===r?this.scrollDirection:a<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=l,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const r=this.scrollElement,l=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!he()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};r.addEventListener("touchstart",l,ae),r.addEventListener("touchend",a,ae),this.unsubs.push(()=>{r.removeEventListener("touchstart",l),r.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const n=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,n&&this.scrollElement&&this.options.enabled){const[r,l,a,h]=n;r!==null&&!a&&(he()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?h!==0&&(this._iosDeferredAdjustment+=h):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const e=this.getScrollOffset(),i=this.getMaxScrollOffset();if(e<0||e>i)return;const n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,i)=>{const n=new Map,r=new Map;for(let l=i-1;l>=0;l--){const a=e[l];if(n.has(a.lane))continue;const h=r.get(a.lane);if(h==null||a.end>h.end?r.set(a.lane,a):a.end<h.end&&n.set(a.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((l,a)=>l.end===a.end?l.index-a.index:l.end-a.end)[0]:void 0},this.getMeasurementOptions=Ct(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,i,n,r,l,a,h)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:i,scrollMargin:n,getItemKey:r,enabled:l,lanes:a,laneAssignmentMode:h}),{key:!1}),this.getMeasurements=Ct(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:i,scrollMargin:n,getItemKey:r,enabled:l,lanes:a,laneAssignmentMode:h},f)=>{const d=this.itemSizeCache;if(!l)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const p of this.laneAssignments.keys())p>=e&&this.laneAssignments.delete(p);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(p=>{this.itemSizeCache.set(p.key,p.size)}));const u=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){const p=this.options.gap,g=e*2;let S=this._flatMeasurements;if(!S||S.length<g){const w=new Float64Array(g);S&&u>0&&w.set(S.subarray(0,u*2)),S=w,this._flatMeasurements=S}let v;if(u===0)v=i+n;else{const w=u-1;v=S[w*2]+S[w*2+1]+p}for(let w=u;w<e;w++){const O=r(w),x=d.get(O),P=typeof x=="number"?x:this.options.estimateSize(w);S[w*2]=v,S[w*2+1]=P,v+=P+p}const E=ai(e,S,r);return this.measurementsCache=E,E}const m=this.measurementsCache.slice(0,u),y=new Array(a).fill(void 0);for(let p=0;p<u;p++){const g=m[p];g&&(y[g.lane]=p)}for(let p=u;p<e;p++){const g=r(p),S=this.laneAssignments.get(p);let v,E;const w=h==="estimate"||d.has(g);if(S!==void 0&&this.options.lanes>1){v=S;const D=y[v],R=D!==void 0?m[D]:void 0;E=R?R.end+this.options.gap:i+n}else{const D=this.options.lanes===1?m[p-1]:this.getFurthestMeasurement(m,p);E=D?D.end+this.options.gap:i+n,v=D?D.lane:p%this.options.lanes,this.options.lanes>1&&w&&this.laneAssignments.set(p,v)}const O=d.get(g),x=typeof O=="number"?O:this.options.estimateSize(p),P=E+x;m[p]={index:p,start:E,size:x,end:P,key:g,lane:v},y[v]=p}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Ct(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,i,n,r)=>e.length===0||i===0?(this.range=null,null):(this.range=Oi(e,i,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ct(()=>{let e=null,i=null;const n=this.calculateRange();return n&&(e=n.startIndex,i=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,i]},(e,i,n,r,l)=>r===null||l===null?[]:e({startIndex:r,endIndex:l,overscan:i,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const i=this.options.indexAttribute,n=e.getAttribute(i);return n?parseInt(n,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const n=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(n!==void 0&&this.range){const r=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),l=Math.max(0,n-r),a=Math.min(this.options.count-1,n+r);return e>=l&&e<=a}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((l,a)=>{l.isConnected||(this.observer.unobserve(l),this.elementsCache.delete(a))});return}const i=this.indexFromElement(e),n=this.options.getItemKey(i),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,i)=>{var n,r;if(e<0||e>=this.options.count)return;let l,a,h;const f=this._flatMeasurements;if(this.options.lanes===1&&f!==null)h=this.options.getItemKey(e),a=f[e*2],l=f[e*2+1];else{const m=this.measurementsCache[e];if(!m)return;h=m.key,a=m.start,l=m.size}const d=this.itemSizeCache.get(h)??l,u=i-d;if(u!==0){const m=this.options.anchorTo==="end"&&((n=this.scrollState)==null?void 0:n.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,y=m?this.getTotalSize():0,p=((r=this.scrollState)==null?void 0:r.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:h,start:a,size:l,end:a+l,lane:0},u,this):a<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(h)||this.scrollDirection!=="backward"));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(h,i),this.itemSizeCacheVersion++,m?this.applyScrollAdjustment(this.getTotalSize()-y):p&&this.applyScrollAdjustment(u),this.notify(!1)}},this.getVirtualItems=Ct(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,i)=>{const n=[];for(let r=0,l=e.length;r<l;r++){const a=e[r],h=i[a];n.push(h)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const i=this.getMeasurements();if(i.length===0)return;const n=this._flatMeasurements,r=this.options.lanes===1&&n!=null,l=xs(0,i.length-1,r?a=>n[a*2]:a=>Je(i[a]).start,e);return Je(i[l])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,i,n=0)=>{if(!this.scrollElement)return 0;const r=this.getSize(),l=this.getScrollOffset();i==="auto"&&(i=e>=l+r?"end":"start"),i==="center"?e+=(n-r)/2:i==="end"&&(e-=r);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,i="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const n=this.getSize(),r=this.getScrollOffset(),l=this.measurementsCache[e];if(!l)return;if(i==="auto")if(l.end>=r+n-this.options.scrollPaddingEnd)i="end";else if(l.start<=r+this.options.scrollPaddingStart)i="start";else return[r,i];if(i==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),i];const a=i==="end"?l.end+this.options.scrollPaddingEnd:l.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,i,l.size),i]},this.scrollToOffset=(e,{align:i="start",behavior:n="auto"}={})=>{const r=this.getOffsetForAlignment(e,i),l=this.now();this.scrollState={index:null,align:i,behavior:n,startedAt:l,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:i="auto",behavior:n="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));const r=this.getOffsetForIndex(e,i);if(!r)return;const[l,a]=r,h=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:h,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:i="auto"}={})=>{const n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{var e;const i=this.getMeasurements();let n;if(i.length===0)n=this.options.paddingStart;else if(this.options.lanes===1){const r=i.length-1,l=this._flatMeasurements;l!=null?n=l[r*2]+l[r*2+1]:n=((e=i[r])==null?void 0:e.end)??0}else{const r=Array(this.options.lanes).fill(null);let l=i.length-1;for(;l>=0&&r.some(a=>a===null);){const a=i[l];r[a.lane]===null&&(r[a.lane]=a.end),l--}n=Math.max(...r.filter(a=>a!==null))}return Math.max(n-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const e=[];if(this.itemSizeCache.size===0)return e;const i=this.getMeasurements();for(const n of i)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:i,behavior:n})=>{this._intendedScrollOffset=e+(i??0),this.options.scrollToFn(e,{behavior:n,adjustments:i},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,e){t!==0&&(he()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:e}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,n=i?i[0]:this.scrollState.lastTargetOffset,r=1,l=n!==this.scrollState.lastTargetOffset;if(!l&&li(n,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=r){this.getScrollOffset()!==n&&this._scrollToOffset(n,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,l){const a=this.getSize()||600,h=Math.abs(n-this.getScrollOffset()),f=this.scrollState.behavior==="smooth"&&h>a;this.scrollState.lastTargetOffset=n,f||(this.scrollState.behavior="auto"),this._scrollToOffset(n,{adjustments:void 0,behavior:f?"smooth":"auto"})}this.scheduleScrollReconcile()}}const xs=(s,t,e,i)=>{for(;s<=t;){const n=(s+t)/2|0,r=e(n);if(r<i)s=n+1;else if(r>i)t=n-1;else return n}return s>0?s-1:0};function Si(s,t,e){let i=0;for(;i<=t;){const n=(i+t)/2|0,r=s[n*2];if(r<e)i=n+1;else if(r>e)t=n-1;else return n}return i>0?i-1:0}function Oi(s,t,e,i,n){const r=s.length-1;if(s.length<=i)return{startIndex:0,endIndex:r};if(i===1&&n!==null){const f=Si(n,r,e);let d=f;const u=e+t;for(;d<r&&n[d*2]+n[d*2+1]<u;)d++;return{startIndex:f,endIndex:d}}let a=xs(0,r,f=>s[f].start,e),h=a;if(i===1)for(;h<r&&s[h].end<e+t;)h++;else if(i>1){const f=Array(i).fill(0);for(;h<r&&f.some(u=>u<e+t);){const u=s[h];f[u.lane]=u.end,h++}const d=Array(i).fill(e+t);for(;a>=0&&d.some(u=>u>=e);){const u=s[a];d[u.lane]=u.start,a--}a=Math.max(0,a-a%i),h=Math.min(r,h+(i-1-h%i))}return{startIndex:a,endIndex:h}}const ue=typeof document<"u"?F.useLayoutEffect:F.useEffect;function wi({useFlushSync:s=!0,directDomUpdates:t=!1,directDomUpdatesMode:e="transform",...i}){const n=F.useReducer(f=>f+1,0)[1],r=F.useRef({enabled:t,mode:e,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});r.current.enabled=t,r.current.mode=e;const l=f=>{const d=r.current;if(!d.enabled||!d.container)return;const u=f.getTotalSize();if(u!==d.lastSize){d.lastSize=u;const v=f.options.horizontal?"width":"height";d.container.style[v]=`${u}px`}const m=!!f.options.horizontal,y=d.mode==="transform",p=m?"left":"top",g=f.options.scrollMargin,S=f.getVirtualItems();for(const v of S){const E=v.start-g,w=f.elementsCache.get(v.key);w&&d.lastPositions.get(w)!==E&&(d.lastPositions.set(w,E),y?w.style.transform=m?`translate3d(${E}px, 0, 0)`:`translate3d(0, ${E}px, 0)`:w.style[p]=`${E}px`)}},a={...i,onChange:(f,d)=>{var u;const m=r.current;let y=!0;if(m.enabled){l(f);const p=f.range,g=m.prevRange;y=!g||g.isScrolling!==f.isScrolling||g.startIndex!==(p==null?void 0:p.startIndex)||g.endIndex!==(p==null?void 0:p.endIndex),y&&(m.prevRange=p?{startIndex:p.startIndex,endIndex:p.endIndex,isScrolling:f.isScrolling}:null)}y&&(s&&d?Fs.flushSync(n):n()),(u=i.onChange)==null||u.call(i,f,d)}},[h]=F.useState(()=>{const f=new bi(a);return Object.assign(f,{containerRef:d=>{const u=r.current;if(u.container=d,u.lastSize=null,d&&u.enabled){const m=f.getTotalSize();u.lastSize=m;const y=f.options.horizontal?"width":"height";d.style[y]=`${m}px`}}})});return h.setOptions(a),ue(()=>h._didMount(),[]),ue(()=>h._willUpdate()),ue(()=>{l(h)}),h}function Ti(s){return wi({observeElementRect:di,observeElementOffset:pi,scrollToFn:vi,...s})}export{Mi as Q,Ii as a,Ri as b,Ss as c,Ti as d,gi as m,xi as u};
2
+ //# sourceMappingURL=vendor-query-AtKBh_Yt.js.map