@av-pi-studio/web-client 0.0.80 → 0.0.82
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{BinaryFallbackViewer-Ciqrig3T.js → BinaryFallbackViewer-BhBojgYd.js} +1 -1
- package/dist/web/assets/{ChatPanel-D2Bkm6Wd.js → ChatPanel-B2VO6E82.js} +2 -2
- package/dist/web/assets/CodeView-D91mREsp.js +1 -0
- package/dist/web/assets/{DiffView-T-iuJ8Yk.js → DiffView-CRrnffpG.js} +1 -1
- package/dist/web/assets/{FilePanel-DtQ3WVct.js → FilePanel-CIFuH4f_.js} +1 -1
- package/dist/web/assets/{ImageViewer-mRoOMDBw.js → ImageViewer-BcpC-9HE.js} +1 -1
- package/dist/web/assets/{MarkdownFileViewer-sanw8Q5h.js → MarkdownFileViewer-BDzrwPiB.js} +1 -1
- package/dist/web/assets/{MoleculeViewerPanel-DViBR60h.js → MoleculeViewerPanel-aCElW220.js} +1 -1
- package/dist/web/assets/{TerminalPanel-DD4qlRmT.js → TerminalPanel-B95G8KXL.js} +1 -1
- package/dist/web/assets/{TextViewer-Bw7SfPxe.js → TextViewer-C1zYu_5r.js} +1 -1
- package/dist/web/assets/{VideoViewer-JenKBw6O.js → VideoViewer-BZMclaqR.js} +1 -1
- package/dist/web/assets/abnfDiagram-N423BO3Z-C6HkBcEq.js +1 -0
- package/dist/web/assets/arc-IiyVx_qI.js +1 -0
- package/dist/web/assets/architectureDiagram-T3A2C74G-CYIM1z-g.js +36 -0
- package/dist/web/assets/blockDiagram-VBNYF7ZC-YPcAvcMb.js +132 -0
- package/dist/web/assets/c4Diagram-5PPSVZJV-DqDoye-L.js +10 -0
- package/dist/web/assets/channel-C_AW0H08.js +1 -0
- package/dist/web/assets/chunk-2GRJ4B5K-Cop7pTQw.js +1 -0
- package/dist/web/assets/chunk-2Q5K7J3B-Ac8_uEHb.js +1 -0
- package/dist/web/assets/chunk-5RXB4S5H-BM-eu37i.js +231 -0
- package/dist/web/assets/chunk-5VM5RSS4-DJtnYoNy.js +15 -0
- package/dist/web/assets/chunk-6Q2QTUOP-BYIYubMk.js +88 -0
- package/dist/web/assets/chunk-GF5L2VYU-CfAs4Mvp.js +206 -0
- package/dist/web/assets/chunk-JWPE2WC7-B4PZpRuq.js +1 -0
- package/dist/web/assets/chunk-KBJHAD2P-B5C5n9l8.js +1 -0
- package/dist/web/assets/chunk-RYQCIY6F-CazvmEAg.js +1 -0
- package/dist/web/assets/chunk-XXDRQBXY-CPzJFrpL.js +1 -0
- package/dist/web/assets/classDiagram-JCYQIIEL-cs4QmU1Z.js +1 -0
- package/dist/web/assets/classDiagram-v2-OCEON4UE-cs4QmU1Z.js +1 -0
- package/dist/web/assets/cose-bilkent-JH36ORCC-k7zF9G_V.js +1 -0
- package/dist/web/assets/cynefin-VYW2F7L2-kO1G0JNx.js +178 -0
- package/dist/web/assets/cynefinDiagram-MW4NZA55-Br6Pehe8.js +62 -0
- package/dist/web/assets/cytoscape.esm-BjAbmLdb.js +331 -0
- package/dist/web/assets/dagre-VZM6K2ZE-hhOjIDFV.js +4 -0
- package/dist/web/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/web/assets/diagram-7IWD3JNH-CT0_cl76.js +30 -0
- package/dist/web/assets/diagram-B4RE2ZJO-Cg2nPF5t.js +3 -0
- package/dist/web/assets/diagram-LBJQPF4R-CXTRoDCu.js +24 -0
- package/dist/web/assets/diagram-Q27KOJAE-CwiVIKjR.js +24 -0
- package/dist/web/assets/diagram-UB23O5K3-qSYfXBYQ.js +41 -0
- package/dist/web/assets/ebnfDiagram-BXEA7PRR-Vop3xM4L.js +1 -0
- package/dist/web/assets/erDiagram-JOGREHBK-RM6hSByi.js +85 -0
- package/dist/web/assets/flowDiagram-UKHOOZJN-BSKFt7t6.js +156 -0
- package/dist/web/assets/ganttDiagram-PKOTCBZU-DrqYFg5A.js +292 -0
- package/dist/web/assets/gitGraphDiagram-DS77QQ5N-hcaeYucr.js +106 -0
- package/dist/web/assets/graph-DeCteHfw.js +1 -0
- package/dist/web/assets/index-C-gDLAhS.js +19 -0
- package/dist/web/assets/index-DNsKUhP1.css +1 -0
- package/dist/web/assets/infoDiagram-6WML65LV-bld-35iu.js +2 -0
- package/dist/web/assets/init-Gi6I4Gst.js +1 -0
- package/dist/web/assets/ishikawaDiagram-WSZJBQD7-JF1ywaiO.js +70 -0
- package/dist/web/assets/journeyDiagram-NVQOT4AX-7Dyz0KO8.js +139 -0
- package/dist/web/assets/kanban-definition-27J2QSJJ-BCe3jXau.js +89 -0
- package/dist/web/assets/katex-C5jXJg4s.js +257 -0
- package/dist/web/assets/layout-DfNZ6M8-.js +1 -0
- package/dist/web/assets/linear-B0jaW5hA.js +1 -0
- package/dist/web/assets/markdown-B-dnhity.js +5 -0
- package/dist/web/assets/mermaid.core-BEntOW_N.js +314 -0
- package/dist/web/assets/mindmap-definition-FAOFIHXS-DduU1MmZ.js +96 -0
- package/dist/web/assets/ordinal-B9c66tb1.js +1 -0
- package/dist/web/assets/pegDiagram-VL7TDLO6-CFwGl9tu.js +1 -0
- package/dist/web/assets/pieDiagram-7S7Q4E2Y-BxWGQVnp.js +39 -0
- package/dist/web/assets/quadrantDiagram-CIZ2JOQS-SfrJdJAW.js +7 -0
- package/dist/web/assets/railroadDiagram-AXF67PYL-D5lmlh0U.js +1 -0
- package/dist/web/assets/requirementDiagram-LRYGKXZP-DeoQYTPf.js +84 -0
- package/dist/web/assets/sankeyDiagram-W5VNT64P-DP7Qbo5Z.js +40 -0
- package/dist/web/assets/sequenceDiagram-SI44F4Z6-D8fP12gy.js +162 -0
- package/dist/web/assets/sizeCapture-X5ZJPWSS-7cP_oZfG.js +1 -0
- package/dist/web/assets/stateDiagram-OKZ733FA-B1ZcscLg.js +1 -0
- package/dist/web/assets/stateDiagram-v2-UEYNNEHI-CbC8RsB4.js +1 -0
- package/dist/web/assets/swimlanes-SLNWSIFB-DOaGnSGR.js +2 -0
- package/dist/web/assets/swimlanesDiagram-ULZ7WXOC-DkBnDEEj.js +8 -0
- package/dist/web/assets/timeline-definition-Z64GVDOM-BvLI2jjl.js +120 -0
- package/dist/web/assets/{use-file-download-CDLL7FOS.js → use-file-download-DaCAhjAL.js} +1 -1
- package/dist/web/assets/{use-file-watch-xtDY-sV8.js → use-file-watch-a91DX08b.js} +1 -1
- package/dist/web/assets/vendor-DVp0ZLQo.js +82 -0
- package/dist/web/assets/{vendor-highlight-Bp4AESDQ.js → vendor-highlight-BjiGXuEM.js} +1 -1
- package/dist/web/assets/{vendor-icons-C8b9N6AX.js → vendor-icons-CQPWxe0u.js} +53 -58
- package/dist/web/assets/{vendor-markdown-B1tcb-dp.js → vendor-markdown-Bc_dOmsB.js} +1 -1
- package/dist/web/assets/{vendor-overlays-DWX2bju9.js → vendor-overlays-BfyojyuH.js} +1 -1
- package/dist/web/assets/{vendor-query-DhxQd-Xj.js → vendor-query-i7fr__Xm.js} +1 -1
- package/dist/web/assets/vennDiagram-T6HMQDX7-DArxlf6M.js +34 -0
- package/dist/web/assets/wardleyDiagram-T6FBY63Y-BC8iMU8l.js +78 -0
- package/dist/web/assets/xychartDiagram-ELKLHX3M-IFP_sgiY.js +7 -0
- package/dist/web/index.html +6 -6
- package/package.json +12 -12
- package/dist/.tsbuildinfo +0 -1
- package/dist/web/assets/CodeView-BU0HnkdV.js +0 -1
- package/dist/web/assets/index-BFBJrHUp.js +0 -17
- package/dist/web/assets/index-CLKr9fTl.css +0 -1
- package/dist/web/assets/markdown-ZxxqwjfA.js +0 -5
- package/dist/web/assets/vendor-CKGvrx4M.js +0 -3644
|
@@ -1 +1 @@
|
|
|
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-DQUAl2K8.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};
|
|
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-DQUAl2K8.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,Ss as a,Ti as b,Ii as c,Ri as d,gi as m,xi as u};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import{aI as Wt,s as Kt,g as Ht,p as Yt,o as Xt,a as Zt,b as Jt,_ as S,z as St,F as Qt,d as rt,au as $t,aa as te,ab as ee,ac as ne,e as se,q as ie,B as re,D as oe}from"./mermaid.core-BEntOW_N.js";import"./vendor-DVp0ZLQo.js";import"./vendor-react-DQUAl2K8.js";const kt=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let h=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(h.x+a.x)*(a.y-h.y);const p={x:(a.x+h.x)/2,y:(a.y+h.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(h.parentIndex.includes(a.parentIndex[m])){const y=t[a.parentIndex[m]],M=Math.atan2(a.x-y.x,a.y-y.y),E=Math.atan2(h.x-y.x,h.y-y.y);let T=E-M;T<0&&(T+=2*Math.PI);const w=E-T/2;let g=K(p,{x:y.x+y.radius*Math.sin(w),y:y.y+y.radius*Math.cos(w)});g>y.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let h=!1;for(let u=0;u<t.length;++u)if(K(t[u],l)>Math.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function K(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u<i;++u){h/=2;const a=n+h,p=t(a);if(p*o>=0&&(n=a),Math.abs(h)<r||p===0)return a}return n+h}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function Q(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,h=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,p=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,y=new Array(m+1);y[0]=n,y[0].fx=t(n),y[0].id=0;for(let v=0;v<m;++v){const c=n.slice();c[v]=c[v]?c[v]*i:r,y[v+1]=c,y[v+1].fx=t(c),y[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)y[m][c]=v[c];y[m].fx=v.fx}const E=(v,c)=>v.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(y.sort(E),s.history){const x=y.map(f=>{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x<m;++x)d=Math.max(d,Math.abs(y[0][x]-y[1][x]));if(Math.abs(y[0].fx-y[m].fx)<o&&d<l)break;for(let x=0;x<m;++x){T[x]=0;for(let f=0;f<m;++f)T[x]+=y[f][x];T[x]/=m}const c=y[m];if(Q(w,1+h,T,-h,c),w.fx=t(w),w.fx<y[0].fx)Q(b,1+u,T,-u,c),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=y[m-1].fx){let x=!1;if(w.fx>c.fx?(Q(g,1+a,T,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(Q(g,1-a*h,T,a*h,c),g.fx=t(g),g.fx<w.fx?M(g):x=!0),x){if(p>=1)break;for(let f=1;f<y.length;++f)Q(y[f],1-p,y[0],p,y[f]),y[f].fx=t(y[f])}}else M(w)}return y.sort(E),{fx:y[0].fx,x:y[0]}}function ue(t,n,s,e,i,r,o){const l=s.fx,h=tt(s.fxprime,n);let u=l,a=l,p=h,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(y,M,E){for(let T=0;T<16;++T)if(i=(y+M)/2,Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(h=ue(t,o,e,i,h),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),!h)ht(o,e.fxprime,-1);else{Q(r,1,i.fxprime,-1,e.fxprime);const p=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/p);Q(o,d,o,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||et,i=fe(t,n),r=s(i,n),o=Object.keys(r),l=[];for(const a of o)l.push(r[a].x),l.push(r[a].y);const u=zt(a=>{const p={};for(let d=0;d<o.length;++d){const m=o[d];p[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(p,i)},l,n).x;for(let a=0;a<o.length;++a){const p=o[a];r[p].x=u[2*a],r[p].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;u<h.sets.length;u++){const a=String(h.sets[u]);l.set(a,h.size+(l.get(a)||0));for(let p=u+1;p<h.sets.length;p++){const d=String(h.sets[p]),m=`${a};${d}`,y=`${d};${a}`;l.set(m,h.size+(l.get(m)||0)),l.set(y,h.size+(l.get(y)||0))}}for(const h of e)h.sets.length<3&&(h.size=l.get(i(h.sets)))}const r=[],o=new Set;for(const l of e)if(l.sets.length===1)r.push(l.sets[0]);else if(l.sets.length===2){const h=l.sets[0],u=l.sets[1];o.add(i(l.sets)),o.add(i([u,h]))}r.sort((l,h)=>l===h?0:l<h?-1:1);for(let l=0;l<r.length;++l){const h=r[l];for(let u=l+1;u<r.length;++u){const a=r[u];o.has(i([h,a]))||e.push({sets:[h,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],l=t[2*r+1];for(let h=r+1;h<s.length;++h){const u=t[2*h],a=t[2*h+1],p=s[r][h],d=e[r][h],m=(u-o)*(u-o)+(a-l)*(a-l),y=Math.sqrt(m),M=m-p*p;d>0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=de(t,e,i);const l=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),y=he(h,m,n);(!u||y.fx<u.fx)&&(u=y)}const a=u.x,p={};for(let d=0;d<e.length;++d){const m=e[d];p[m.sets[0]]={x:a[2*d]*l,y:a[2*d+1]*l,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,l);return p}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const p of t)if(p.sets.length===1){const d=p.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:p.size,radius:Math.sqrt(p.size/Math.PI)},i[d]=[]}t=t.filter(p=>p.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;m<i[p].length;++m)d+=i[p][m].size*i[p][m].weight;r.push({set:p,size:d})});function o(p,d){return d.size-p.size}r.sort(o);const l={};function h(p){return p.set in l}function u(p,d){e[d].x=p.x,e[d].y=p.y,l[d]=!0}u({x:0,y:0},r[0].set);for(let p=1;p<r.length;++p){const d=r[p].set,m=i[d].filter(h),y=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(y.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],c=ft(y.radius,v.radius,m[b].size),x=Tt({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let E=1e50,T=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<E&&(E=g,T=w)}u(T,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],l=t[e.sets[1]];i=xt(o.radius,l.radius,K(o,l))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;K(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h<i.length;)l(i[h],!0,!1),l(i[h+1],!1,!0),l(i[h+2],!0,!0),h+=3,r=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const r=Ft(t);n-=2*e,s-=2*e;const{xRange:o,yRange:l}=dt(r);if(o.max===o.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let h,u;if(i){const m=Math.sqrt(i/Math.PI)*2;h=n/m,u=s/m}else h=n/(o.max-o.min),u=s/(l.max-l.min);const a=Math.min(u,h),p=(n-(o.max-o.min)*a)/2,d=(s-(l.max-l.min)*a)/2;return Ot(r.map(m=>({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(I=>{I.size==0&&I.sets.length==1&&O.add(I.sets[0])}),f=f.filter(I=>!I.sets.some(C=>O.has(C)));let k={},R={};if(f.length>0){let I=b(f,{lossFunction:v,distinct:m});l&&(I=Ct(I,o,d)),k=Nt(I,s,e,i,h),R=Lt(k,f,M)}const Z={};f.forEach(I=>{I.label&&(Z[I.sets]=I.label)});function U(I){if(I.sets in Z)return Z[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(I){const C=this.getAttribute("d");I.sets.length==1&&C&&!m&&(z=!0,V[I.sets[0]]=Me(C))});function q(I){return C=>{const G=I.sets.map(J=>{let W=V[J],X=k[J];return W||(W={x:s/2,y:e/2,radius:1}),X||(X={x:s/2,y:e/2,radius:1}),{x:W.x*(1-C)+X.x*C,y:W.y*(1-C)+X.y*C,radius:W.radius*(1-C)+X.radius*C}});return wt(G,y)}}const A=B.selectAll(".venn-area").data(f,I=>I.sets),F=A.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),j=F.append("path"),L=F.append("text").attr("class","label").text(I=>U(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(j.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),L.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function P(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",q)):_.selectAll("path").attr("d",I=>wt(I.sets.map(C=>k[C])),y);const D=_.selectAll("text").filter(I=>I.sets in R).text(I=>U(I)).attr("x",I=>Math.floor(R[I.sets].x)).attr("y",I=>Math.floor(R[I.sets].y));u&&(z?"on"in D?D.on("end",ot(k,U)):D.each("end",ot(k,U)):D.each(ot(k,U)));const N=P(A.exit()).remove();typeof A.transition=="function"&&N.selectAll("path").attrTween("d",q);const Y=N.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),D.style("font-size",p),Y.style("font-size","0px")),{circles:k,textCentres:R,nodes:A,enter:F,update:_,exit:N}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Dt:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-K(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=K(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function jt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const p=at(e[a],t,n);p>=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)<a.radius){h=!1;break}if(h)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?jt(t,[]):Et(u.arcs.map(a=>a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const l=s[o],h=t[l],u=K(r,h);u+h.radius<=r.radius+1e-10?n[l].push(i):u+r.radius<=h.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=Ie(t);for(let r=0;r<n.length;++r){const o=n[r].sets,l={},h={};for(let d=0;d<o.length;++d){l[o[d]]=!0;const m=i[o[d]];for(let y=0;y<m.length;++y)h[m[y]]=!0}const u=[],a=[];for(let d in t)d in l?u.push(t[d]):d in h||a.push(t[d]);const p=jt(u,a,s);e[o]=p,p.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(`
|
|
2
|
+
M`,t,n),e.push(`
|
|
3
|
+
m`,-s,0),e.push(`
|
|
4
|
+
a`,s,s,0,1,0,s*2,0),e.push(`
|
|
5
|
+
a`,s,s,0,1,0,-s*2,0),e.join(" ")}function Me(t){const n=t.split(" ");return{x:Number.parseFloat(n[1]),y:Number.parseFloat(n[2]),radius:-Number.parseFloat(n[4])}}function Pt(t){if(t.length===0)return[];const n={};return st(t,n),n.arcs}function Bt(t,n){if(t.length===0)return"M 0 0";const s=Math.pow(10,n||0),e=n!=null?r=>Math.round(r*s)/s:r=>r;if(t.length==1){const r=t[0].circle;return ke(e(r.x),e(r.y),e(r.radius))}const i=[`
|
|
6
|
+
M`,e(t[0].p2.x),e(t[0].p2.y)];for(const r of t){const o=e(r.circle.radius);i.push(`
|
|
7
|
+
A`,o,o,0,r.large?1:0,r.sweep?1:0,e(r.p1.x),e(r.p1.y))}return i.join(" ")}function wt(t,n){return Bt(Pt(t),n)}function we(t,n={}){const{lossFunction:s,layoutFunction:e=At,normalize:i=!0,orientation:r=Math.PI/2,orientationOrder:o,width:l=600,height:h=350,padding:u=15,scaleToFit:a=!1,symmetricalTextCentre:p=!1,distinct:d,round:m=2}=n;let y=e(t,{lossFunction:s==="default"||!s?et:s==="logRatio"?Dt:s,distinct:d});i&&(y=Ct(y,r,o));const M=Nt(y,l,h,u,a),E=Lt(M,t,p),T=new Map(Object.keys(M).map(b=>[b,{set:b,x:M[b].x,y:M[b].y,radius:M[b].radius}])),w=t.map(b=>{const v=b.sets.map(f=>T.get(f)),c=Pt(v),x=Bt(c,m);return{circles:v,arcs:c,path:x,area:b,has:new Set(b.sets)}});function g(b){let v="";for(const c of w)c.has.size>b.length&&b.every(x=>c.has.has(x))&&(v+=" "+c.path);return v}return w.map(({circles:b,arcs:v,path:c,area:x})=>({data:x,text:E[x.sets],circles:b,arcs:v,path:c,distinctPath:c+g(x.sets)}))}var gt=(function(){var t=S(function(w,g,b,v){for(b=b||{},v=w.length;v--;b[w[v]]=g);return b},"o"),n=[5,8],s=[7,8,11,12,17,19,22,24],e=[1,17],i=[1,18],r=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],o=[1,31],l=[1,39],h=[7,8,11,12,17,19,22,24,27],u=[1,57],a=[1,56],p=[1,58],d=[1,59],m=[1,60],y=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],M={trace:S(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:S(function(g,b,v,c,x,f,O){var k=f.length-1;switch(x){case 1:return f[k-1];case 2:case 3:case 4:this.$=[];break;case 5:f[k-1].push(f[k]),this.$=f[k-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=f[k];break;case 8:c.setDiagramTitle(f[k].substr(6)),this.$=f[k].substr(6);break;case 9:c.addSubsetData([f[k]],void 0,void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 10:c.addSubsetData([f[k-1]],f[k],void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 11:c.addSubsetData([f[k-2]],void 0,parseFloat(f[k])),c.setIndentMode&&c.setIndentMode(!0);break;case 12:c.addSubsetData([f[k-3]],f[k-2],parseFloat(f[k])),c.setIndentMode&&c.setIndentMode(!0);break;case 13:if(f[k].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(f[k]),c.addSubsetData(f[k],void 0,void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 14:if(f[k-1].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(f[k-1]),c.addSubsetData(f[k-1],f[k],void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 15:if(f[k-2].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(f[k-2]),c.addSubsetData(f[k-2],void 0,parseFloat(f[k])),c.setIndentMode&&c.setIndentMode(!0);break;case 16:if(f[k-3].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(f[k-3]),c.addSubsetData(f[k-3],f[k-2],parseFloat(f[k])),c.setIndentMode&&c.setIndentMode(!0);break;case 17:case 18:case 19:c.addTextData(f[k-1],f[k],void 0);break;case 20:case 21:c.addTextData(f[k-2],f[k-1],f[k]);break;case 23:c.addStyleData(f[k-1],f[k]);break;case 24:case 25:case 26:var R=c.getCurrentSets();if(!R)throw new Error("text requires set");c.addTextData(R,f[k],void 0);break;case 27:case 28:var R=c.getCurrentSets();if(!R)throw new Error("text requires set");c.addTextData(R,f[k-1],f[k]);break;case 29:case 41:this.$=[f[k]];break;case 30:case 42:this.$=[...f[k-2],f[k]];break;case 31:this.$=[f[k-2],f[k]];break;case 33:this.$=f[k].join(" ");break;case 34:this.$=[f[k]];break;case 35:f[k-1].push(f[k]),this.$=f[k-1];break;case 43:case 44:this.$=f[k];break}},"anonymous"),table:[t(n,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(s,[2,4],{6:5}),t(n,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},t(s,[2,5]),t(s,[2,6]),t(s,[2,7]),t(s,[2,8]),{13:16,20:e,21:i},{13:20,18:19,20:e,21:i},{13:20,18:21,20:e,21:i},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:e,21:i},t(s,[2,9],{14:[1,27],15:[1,28]}),t(r,[2,43]),t(r,[2,44]),t(s,[2,13],{14:[1,29],15:[1,30],27:o}),t(r,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:o},t(s,[2,22]),t(s,[2,24],{14:[1,35]}),t(s,[2,25],{14:[1,36]}),t(s,[2,26]),{20:l,25:37,26:38,27:o},t(s,[2,10],{15:[1,40]}),{16:[1,41]},t(s,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:e,21:i},t(s,[2,17],{14:[1,45]}),t(s,[2,18],{14:[1,46]}),t(s,[2,19]),t(s,[2,27]),t(s,[2,28]),t(s,[2,23],{27:[1,47]}),t(h,[2,29]),{15:[1,48]},{16:[1,49]},t(s,[2,11]),{16:[1,50]},t(s,[2,15]),t(r,[2,42]),t(s,[2,20]),t(s,[2,21]),{20:l,26:51},{16:u,20:a,21:[1,53],28:52,29:54,30:55,31:p,32:d,33:m},t(s,[2,12]),t(s,[2,16]),t(h,[2,30]),t(h,[2,31]),t(h,[2,32]),t(h,[2,33],{30:61,16:u,20:a,31:p,32:d,33:m}),t(y,[2,34]),t(y,[2,36]),t(y,[2,37]),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,35])],defaultActions:{6:[2,1]},parseError:S(function(g,b){if(b.recoverable)this.trace(g);else{var v=new Error(g);throw v.hash=b,v}},"parseError"),parse:S(function(g){var b=this,v=[0],c=[],x=[null],f=[],O=this.table,k="",R=0,Z=0,U=2,B=1,V=f.slice.call(arguments,1),z=Object.create(this.lexer),q={yy:{}};for(var A in this.yy)Object.prototype.hasOwnProperty.call(this.yy,A)&&(q.yy[A]=this.yy[A]);z.setInput(g,q.yy),q.yy.lexer=z,q.yy.parser=this,typeof z.yylloc>"u"&&(z.yylloc={});var F=z.yylloc;f.push(F);var j=z.options&&z.options.ranges;typeof q.yy.parseError=="function"?this.parseError=q.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function L(H){v.length=v.length-2*H,x.length=x.length-H,f.length=f.length-H}S(L,"popStack");function P(){var H;return H=c.pop()||z.lex()||B,typeof H!="number"&&(H instanceof Array&&(c=H,H=c.pop()),H=b.symbols_[H]||H),H}S(P,"lex");for(var _,D,N,Y,I={},C,G,J,W;;){if(D=v[v.length-1],this.defaultActions[D]?N=this.defaultActions[D]:((_===null||typeof _>"u")&&(_=P()),N=O[D]&&O[D][_]),typeof N>"u"||!N.length||!N[0]){var X="";W=[];for(C in O[D])this.terminals_[C]&&C>U&&W.push("'"+this.terminals_[C]+"'");z.showPosition?X="Parse error on line "+(R+1)+`:
|
|
8
|
+
`+z.showPosition()+`
|
|
9
|
+
Expecting `+W.join(", ")+", got '"+(this.terminals_[_]||_)+"'":X="Parse error on line "+(R+1)+": Unexpected "+(_==B?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(X,{text:z.match,token:this.terminals_[_]||_,line:z.yylineno,loc:F,expected:W})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+D+", token: "+_);switch(N[0]){case 1:v.push(_),x.push(z.yytext),f.push(z.yylloc),v.push(N[1]),_=null,Z=z.yyleng,k=z.yytext,R=z.yylineno,F=z.yylloc;break;case 2:if(G=this.productions_[N[1]][1],I.$=x[x.length-G],I._$={first_line:f[f.length-(G||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(G||1)].first_column,last_column:f[f.length-1].last_column},j&&(I._$.range=[f[f.length-(G||1)].range[0],f[f.length-1].range[1]]),Y=this.performAction.apply(I,[k,Z,R,q.yy,N[1],x,f].concat(V)),typeof Y<"u")return Y;G&&(v=v.slice(0,-1*G*2),x=x.slice(0,-1*G),f=f.slice(0,-1*G)),v.push(this.productions_[N[1]][0]),x.push(I.$),f.push(I._$),J=O[v[v.length-2]][v[v.length-1]],v.push(J);break;case 3:return!0}}return!0},"parse")},E=(function(){var w={EOF:1,parseError:S(function(b,v){if(this.yy.parser)this.yy.parser.parseError(b,v);else throw new Error(b)},"parseError"),setInput:S(function(g,b){return this.yy=b||this.yy||{},this._input=g,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:S(function(){var g=this._input[0];this.yytext+=g,this.yyleng++,this.offset++,this.match+=g,this.matched+=g;var b=g.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),g},"input"),unput:S(function(g){var b=g.length,v=g.split(/(?:\r\n?|\n)/g);this._input=g+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b),this.offset-=b;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),v.length-1&&(this.yylineno-=v.length-1);var x=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:v?(v.length===c.length?this.yylloc.first_column:0)+c[c.length-v.length].length-v[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[x[0],x[0]+this.yyleng-b]),this.yyleng=this.yytext.length,this},"unput"),more:S(function(){return this._more=!0,this},"more"),reject:S(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
10
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:S(function(g){this.unput(this.match.slice(g))},"less"),pastInput:S(function(){var g=this.matched.substr(0,this.matched.length-this.match.length);return(g.length>20?"...":"")+g.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:S(function(){var g=this.match;return g.length<20&&(g+=this._input.substr(0,20-g.length)),(g.substr(0,20)+(g.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:S(function(){var g=this.pastInput(),b=new Array(g.length+1).join("-");return g+this.upcomingInput()+`
|
|
11
|
+
`+b+"^"},"showPosition"),test_match:S(function(g,b){var v,c,x;if(this.options.backtrack_lexer&&(x={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(x.yylloc.range=this.yylloc.range.slice(0))),c=g[0].match(/(?:\r\n?|\n).*/g),c&&(this.yylineno+=c.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:c?c[c.length-1].length-c[c.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+g[0].length},this.yytext+=g[0],this.match+=g[0],this.matches=g,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(g[0].length),this.matched+=g[0],v=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),v)return v;if(this._backtrack){for(var f in x)this[f]=x[f];return!1}return!1},"test_match"),next:S(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var g,b,v,c;this._more||(this.yytext="",this.match="");for(var x=this._currentRules(),f=0;f<x.length;f++)if(v=this._input.match(this.rules[x[f]]),v&&(!b||v[0].length>b[0].length)){if(b=v,c=f,this.options.backtrack_lexer){if(g=this.test_match(v,x[f]),g!==!1)return g;if(this._backtrack){b=!1;continue}else return!1}else if(!this.options.flex)break}return b?(g=this.test_match(b,x[c]),g!==!1?g:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
12
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:S(function(){var b=this.next();return b||this.lex()},"lex"),begin:S(function(b){this.conditionStack.push(b)},"begin"),popState:S(function(){var b=this.conditionStack.length-1;return b>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:S(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:S(function(b){return b=this.conditionStack.length-1-Math.abs(b||0),b>=0?this.conditionStack[b]:"INITIAL"},"topState"),pushState:S(function(b){this.begin(b)},"pushState"),stateStackSize:S(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:S(function(b,v,c,x){switch(c){case 0:break;case 1:break;case 2:break;case 3:if(b.getIndentMode&&b.getIndentMode())return b.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:b.setIndentMode&&b.setIndentMode(!1),this.begin("INITIAL"),this.unput(v.yytext);break;case 6:return this.begin("bol"),8;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(b.consumeIndentText)b.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return v.yytext=v.yytext.slice(2,-2),14;case 17:return v.yytext=v.yytext.slice(1,-1).trim(),14;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};return w})();M.lexer=E;function T(){this.yy={}}return S(T,"Parser"),T.prototype=M,M.Parser=T,new T})();gt.parser=gt;var Se=gt,yt=[],pt=[],mt=[],bt=new Set,vt,It=!1,_e=S((t,n,s)=>{const e=it(t).sort(),i=s??10/Math.pow(t.length,2);vt=e,e.length===1&&bt.add(e[0]),yt.push({sets:e,size:i,label:n?nt(n):void 0})},"addSubsetData"),Te=S(()=>yt,"getSubsetData"),nt=S(t=>{const n=t.trim();return n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):n},"normalizeText"),Ee=S(t=>t&&nt(t),"normalizeStyleValue"),ze=S((t,n,s)=>{const e=nt(n);pt.push({sets:it(t).sort(),id:e,label:s?nt(s):void 0})},"addTextData"),Ae=S((t,n)=>{const s=it(t).sort(),e={};for(const[i,r]of n)e[i]=Ee(r)??r;mt.push({targets:s,styles:e})},"addStyleData"),Re=S(()=>mt,"getStyleData"),it=S(t=>t.map(n=>nt(n)),"normalizeIdentifierList"),De=S(t=>{const s=it(t).filter(e=>!bt.has(e));if(s.length>0)throw new Error(`unknown set identifier: ${s.join(", ")}`)},"validateUnionIdentifiers"),Ce=S(()=>pt,"getTextData"),Ne=S(()=>vt,"getCurrentSets"),Oe=S(()=>It,"getIndentMode"),Fe=S(t=>{It=t},"setIndentMode"),je=oe.venn;function Vt(){return re(je,St().venn)}S(Vt,"getConfig");var Le=S(()=>{ie(),yt.length=0,pt.length=0,mt.length=0,bt.clear(),vt=void 0,It=!1},"customClear"),Pe={getConfig:Vt,clear:Le,setAccTitle:Jt,getAccTitle:Zt,setDiagramTitle:Xt,getDiagramTitle:Yt,getAccDescription:Ht,setAccDescription:Kt,addSubsetData:_e,getSubsetData:Te,addTextData:ze,addStyleData:Ae,validateUnionIdentifiers:De,getTextData:Ce,getStyleData:Re,getCurrentSets:Ne,getIndentMode:Oe,setIndentMode:Fe},Be=S(t=>`
|
|
13
|
+
.venn-title {
|
|
14
|
+
font-size: 32px;
|
|
15
|
+
fill: ${t.vennTitleTextColor};
|
|
16
|
+
font-family: ${t.fontFamily};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.venn-circle text {
|
|
20
|
+
font-size: 48px;
|
|
21
|
+
font-family: ${t.fontFamily};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.venn-intersection text {
|
|
25
|
+
font-size: 48px;
|
|
26
|
+
fill: ${t.vennSetTextColor};
|
|
27
|
+
font-family: ${t.fontFamily};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.venn-text-node {
|
|
31
|
+
font-family: ${t.fontFamily};
|
|
32
|
+
color: ${t.vennSetTextColor};
|
|
33
|
+
}
|
|
34
|
+
`,"getStyles"),Ve=Be;function qt(t){const n=new Map;for(const s of t){const e=s.targets.join("|"),i=n.get(e);i?Object.assign(i,s.styles):n.set(e,{...s.styles})}return n}S(qt,"buildStyleByKey");var qe=S((t,n,s,e)=>{var V,z,q;const i=e.db,r=(V=i.getConfig)==null?void 0:V.call(i),{themeVariables:o,look:l,handDrawnSeed:h}=St(),u=l==="handDrawn",a=[o.venn1,o.venn2,o.venn3,o.venn4,o.venn5,o.venn6,o.venn7,o.venn8].filter(Boolean),p=(z=i.getDiagramTitle)==null?void 0:z.call(i),d=i.getSubsetData(),m=i.getTextData(),y=qt(i.getStyleData()),M=Gt(d),E=(r==null?void 0:r.width)??800,T=(r==null?void 0:r.height)??450,g=E/1600,b=p?48*g:0,v=o.primaryTextColor??o.textColor,c=Qt(n);c.attr("viewBox",`0 0 ${E} ${T}`),p&&c.append("text").text(p).attr("class","venn-title").attr("font-size",`${32*g}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*g).style("fill",o.vennTitleTextColor||o.titleColor);const x=rt(document.createElement("div")),f=ve().width(E).height(T-b);x.datum(M).call(f);const O=u?$t.svg(x.select("svg").node()):void 0,k=we(M,{width:E,height:T-b,padding:(r==null?void 0:r.padding)??15}),R=new Map;for(const A of k){const F=$([...A.data.sets].sort());R.set(F,A)}m.length>0&&Ut(r,R,x,m,g,y);const Z=te(o.background||"#f4f4f4");x.selectAll(".venn-circle").each(function(A,F){var G;const j=rt(this),P=$([...A.sets].sort()),_=y.get(P),D=(_==null?void 0:_.fill)||a[F%a.length]||o.primaryColor;j.classed(`venn-set-${F%8}`,!0);const N=(_==null?void 0:_["fill-opacity"])??.1,Y=(_==null?void 0:_.stroke)||D,I=(_==null?void 0:_["stroke-width"])||`${5*g}`;if(u&&O){const J=R.get(P);if(J&&J.circles.length>0){const W=J.circles[0],X=O.circle(W.x,W.y,W.radius*2,{roughness:.7,seed:h,fill:kt(D,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+F*60,stroke:Y,strokeWidth:parseFloat(String(I))});j.select("path").remove(),(G=j.node())==null||G.insertBefore(X,j.select("text").node())}}else j.select("path").style("fill",D).style("fill-opacity",N).style("stroke",Y).style("stroke-width",I).style("stroke-opacity",.95);const C=(_==null?void 0:_.color)||(Z?ee(D,30):ne(D,30));j.select("text").style("font-size",`${48*g}px`).style("fill",C)}),u&&O?x.selectAll(".venn-intersection").each(function(A){var D;const F=rt(this),L=$([...A.sets].sort()),P=y.get(L),_=P==null?void 0:P.fill;if(_){const N=F.select("path"),Y=N.attr("d");if(Y){const I=O.path(Y,{roughness:.7,seed:h,fill:kt(_,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),C=N.node();(D=C==null?void 0:C.parentNode)==null||D.insertBefore(I,C),N.remove()}}else F.select("path").style("fill-opacity",0);F.select("text").style("font-size",`${48*g}px`).style("fill",(P==null?void 0:P.color)??o.vennSetTextColor??v)}):(x.selectAll(".venn-intersection text").style("font-size",`${48*g}px`).style("fill",A=>{var L;const j=$([...A.sets].sort());return((L=y.get(j))==null?void 0:L.color)??o.vennSetTextColor??v}),x.selectAll(".venn-intersection path").style("fill-opacity",A=>{var L;const j=$([...A.sets].sort());return(L=y.get(j))!=null&&L.fill?1:0}).style("fill",A=>{var L;const j=$([...A.sets].sort());return((L=y.get(j))==null?void 0:L.fill)??"transparent"}));const U=c.append("g").attr("transform",`translate(0, ${b})`),B=x.select("svg").node();if(B&&"childNodes"in B)for(const A of[...B.childNodes])(q=U.node())==null||q.appendChild(A);se(c,T,E,(r==null?void 0:r.useMaxWidth)??!0)},"draw");function $(t){return t.join("|")}S($,"stableSetsKey");function Ut(t,n,s,e,i,r){var a;const o=(t==null?void 0:t.useDebugLayout)??!1,h=s.select("svg").append("g").attr("class","venn-text-nodes"),u=new Map;for(const p of e){const d=$(p.sets),m=u.get(d);m?m.push(p):u.set(d,[p])}for(const[p,d]of u.entries()){const m=n.get(p);if(!(m!=null&&m.text))continue;const y=m.text.x,M=m.text.y,E=Math.min(...m.circles.map(V=>V.radius)),T=Math.min(...m.circles.map(V=>V.radius-Math.hypot(y-V.x,M-V.y)));let w=Number.isFinite(T)?Math.max(0,T):0;w===0&&Number.isFinite(E)&&(w=E*.6);const g=h.append("g").attr("class","venn-text-area").attr("font-size",`${40*i}px`);o&&g.append("circle").attr("class","venn-text-debug-circle").attr("cx",y).attr("cy",M).attr("r",w).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*i).attr("stroke-dasharray",`${6*i} ${4*i}`);const b=Math.max(80*i,w*2*.95),v=Math.max(60*i,w*2*.95),f=(m.data.label&&m.data.label.length>0?Math.min(32*i,w*.25):0)+(d.length<=2?30*i:0),O=y-b/2,k=M-v/2+f,R=Math.max(1,Math.ceil(Math.sqrt(d.length))),Z=Math.max(1,Math.ceil(d.length/R)),U=b/R,B=v/Z;for(const[V,z]of d.entries()){const q=V%R,A=Math.floor(V/R),F=O+U*(q+.5),j=k+B*(A+.5);o&&g.append("rect").attr("class","venn-text-debug-cell").attr("x",O+U*q).attr("y",k+B*A).attr("width",U).attr("height",B).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*i).attr("stroke-dasharray",`${4*i} ${3*i}`);const L=U*.9,P=B*.9,_=g.append("foreignObject").attr("class","venn-text-node-fo").attr("width",L).attr("height",P).attr("x",F-L/2).attr("y",j-P/2).attr("overflow","visible"),D=(a=r.get(z.id))==null?void 0:a.color,N=_.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(z.label??z.id);D&&N.style("color",D)}}}S(Ut,"renderTextNodes");function Gt(t){const n=new Set(t.map(i=>[...i.sets].sort().join("|"))),s=new Map(t.filter(i=>i.sets.length===1&&i.size!==void 0).map(i=>[i.sets[0],i.size])),e=[];for(const i of t){if(i.sets.length<3)continue;const r=[...i.sets].sort();for(let o=0;o<r.length-1;o++)for(let l=o+1;l<r.length;l++){const h=[r[o],r[l]],u=h.join("|");if(!n.has(u)){n.add(u);const a=s.get(h[0]),p=s.get(h[1]),d=a!==void 0&&p!==void 0?Math.min(a,p)/4:2.5;e.push({sets:h,size:d,label:""})}}}return e.length>0?[...t,...e]:t}S(Gt,"ensurePairwiseSubsets");var Ue={draw:qe},He={parser:Se,db:Pe,renderer:Ue,styles:Ve};export{He as diagram};
|