@orbs-network/spot-react 0.0.92 → 0.0.94
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as p, g as m, s as w, d as k, i as b, l as L, a as O, c as E, b as x, e as R, H as y, f as M } from "./index-
|
|
1
|
+
import { B as p, g as m, s as w, d as k, i as b, l as L, a as O, c as E, b as x, e as R, H as y, f as M } from "./index-Y2zGBvY6.js";
|
|
2
2
|
class S extends p {
|
|
3
3
|
constructor({ callbackSelector: r, cause: a, data: n, extraData: i, sender: f, urls: t }) {
|
|
4
4
|
var o;
|
|
@@ -3239,7 +3239,7 @@ const p3 = async ({
|
|
|
3239
3239
|
}) => (await Promise.all([
|
|
3240
3240
|
s ? p3({ chainId: r, signal: e, page: t, limit: n, filters: { accounts: [a], configs: s.twapConfig ? [s.twapConfig] : [] } }) : Promise.resolve([]),
|
|
3241
3241
|
n3({ chainId: r, signal: e, account: a, exchange: s == null ? void 0 : s.adapter })
|
|
3242
|
-
]).then(([c, l]) => [...c, ...l])).sort((c, l) => l.createdAt - c.createdAt), b3 = "0.0.
|
|
3242
|
+
]).then(([c, l]) => [...c, ...l])).sort((c, l) => l.createdAt - c.createdAt), b3 = "0.0.94", y3 = {
|
|
3243
3243
|
version: b3
|
|
3244
3244
|
};
|
|
3245
3245
|
var wo = class {
|
|
@@ -11900,7 +11900,7 @@ async function Cu(e, t) {
|
|
|
11900
11900
|
});
|
|
11901
11901
|
return ie === "0x" ? { data: void 0 } : { data: ie };
|
|
11902
11902
|
} catch (O) {
|
|
11903
|
-
const U = C7(O), { offchainLookup: N, offchainLookupSignature: L } = await import("./ccip-
|
|
11903
|
+
const U = C7(O), { offchainLookup: N, offchainLookupSignature: L } = await import("./ccip-X8Voykhl.js");
|
|
11904
11904
|
if (e.ccipRead !== !1 && (U == null ? void 0 : U.slice(0, 10)) === L && C)
|
|
11905
11905
|
return { data: await N(e, { data: U, to: C }) };
|
|
11906
11906
|
throw T && (U == null ? void 0 : U.slice(0, 10)) === "0x101bb98d" ? new JE({ factory: f }) : m0(O, {
|
package/dist/spot-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a$ as e, C as r, ab as t, D as i, aK as n, aZ as E, aX as o, a_ as _, aY as T, aV as P, aO as u, aP as l, ap as A, aM as O, aL as d, M as I, ao as R, au as S, aJ as g, aB as L, az as D, aA as b, aD as m, aC as M, U as C, aS as U, aT as p, aR as N, aQ as c, aU as F, as as k, R as y, T as B, P as h, Q as G, aW as x, aq as Y, aN as f, ay as v, S as H, N as W, O as V, aE as w, ar as K, at as z, ac as Q, bn as X, an as j, Y as q, a2 as J, a8 as Z, Z as $, F as aa, am as sa, ax as ea, b4 as ra, bj as ta, b6 as ia, b0 as na, b1 as Ea, b3 as oa, bm as _a, b7 as Ta, aa as Pa, bi as ua, b9 as la, be as Aa, b5 as Oa, bl as da, bg as Ia, a1 as Ra, bf as Sa, bh as ga, ae as La, ai as Da, ah as ba, af as ma, aj as Ma, a5 as Ca, ag as Ua, aI as pa, bk as Na, b8 as ca, bc as Fa, ba as ka, bd as ya, bb as Ba, b2 as ha, ak as Ga, aw as xa, a9 as Ya, a0 as fa, _ as va, aH as Ha, a3 as Wa, a4 as Va, aG as wa, al as Ka, $ as za, V as Qa, av as Xa, ad as ja, a7 as qa, a6 as Ja, bo as Za, X as $a, W as as, y as ss, q as es, m as rs, h as ts, j as is, L as ns, t as Es, r as os, k as _s, A as Ts, E as Ps, o as us, J as ls, x as As, K as Os, I as ds, G as Is, z as Rs, p as Ss, v as gs, u as Ls, w as Ds, n as bs, aF as ms } from "./index-
|
|
1
|
+
import { a$ as e, C as r, ab as t, D as i, aK as n, aZ as E, aX as o, a_ as _, aY as T, aV as P, aO as u, aP as l, ap as A, aM as O, aL as d, M as I, ao as R, au as S, aJ as g, aB as L, az as D, aA as b, aD as m, aC as M, U as C, aS as U, aT as p, aR as N, aQ as c, aU as F, as as k, R as y, T as B, P as h, Q as G, aW as x, aq as Y, aN as f, ay as v, S as H, N as W, O as V, aE as w, ar as K, at as z, ac as Q, bn as X, an as j, Y as q, a2 as J, a8 as Z, Z as $, F as aa, am as sa, ax as ea, b4 as ra, bj as ta, b6 as ia, b0 as na, b1 as Ea, b3 as oa, bm as _a, b7 as Ta, aa as Pa, bi as ua, b9 as la, be as Aa, b5 as Oa, bl as da, bg as Ia, a1 as Ra, bf as Sa, bh as ga, ae as La, ai as Da, ah as ba, af as ma, aj as Ma, a5 as Ca, ag as Ua, aI as pa, bk as Na, b8 as ca, bc as Fa, ba as ka, bd as ya, bb as Ba, b2 as ha, ak as Ga, aw as xa, a9 as Ya, a0 as fa, _ as va, aH as Ha, a3 as Wa, a4 as Va, aG as wa, al as Ka, $ as za, V as Qa, av as Xa, ad as ja, a7 as qa, a6 as Ja, bo as Za, X as $a, W as as, y as ss, q as es, m as rs, h as ts, j as is, L as ns, t as Es, r as os, k as _s, A as Ts, E as Ps, o as us, J as ls, x as As, K as Os, I as ds, G as Is, z as Rs, p as Ss, v as gs, u as Ls, w as Ds, n as bs, aF as ms } from "./index-Y2zGBvY6.js";
|
|
2
2
|
export {
|
|
3
3
|
e as CRASH_ERROR_MESSAGE,
|
|
4
4
|
r as Components,
|
package/dist/spot-react.umd.cjs
CHANGED
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
dollarValueOut
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
`,extractResults:d=>{var f;return(((f=d.data)==null?void 0:f.orderFilleds)||[]).map(m=>({...m,timestamp:new Date(m.timestamp).getTime()}))}})};class Ww extends Error{constructor(){super("No graph endpoint found"),this.name="NoGraphEndpointError"}}const qw=async({chainId:e,signal:t,page:r,limit:n,filters:s})=>{try{const a=await Gw({chainId:e,signal:t,page:r,limit:n,filters:s}),[o,i]=await Promise.all([Vw({chainId:e,orders:a,signal:t}),jw({chainId:e,orders:a,signal:t})]),c=a.map(u=>{const d=o==null?void 0:o.filter(f=>f.TWAP_id===Number(u.Contract_id)&&Ds(f.exchange,u.exchange)&&Ds(f.twapAddress,u.twapAddress));return Hw(u,e,d,Kw(u,d||[],i))}).sort((u,d)=>d.createdAt-u.createdAt),l=new Set;return c.filter(u=>l.has(u.id)?!1:(l.add(u.id),!0))}catch{return[]}},Kw=(e,t,r)=>{var i;const n=(i=r==null?void 0:r.find(c=>c.twapId===e.Contract_id.toString()&&Ds(c.twapAddress,e.twapAddress)))==null?void 0:i.status,a=Dh(t).reduce((c,l)=>c.plus(l.inAmount),new G(0)).toFixed(),o=Mh(e.ask_srcAmount,a);return Yw(o,e.ask_deadline*1e3,n)},Mh=(e,t)=>{if(!t||!e)return 0;const r=G(t).dividedBy(e).toNumber();return r>=.99?100:r<=0?0:Number((r*100).toFixed(2))},Yw=(e,t,r)=>e===100?ut.Completed:r==="CANCELED"?ut.Canceled:r==="COMPLETED"?ut.Completed:t>Date.now()?ut.Open:ut.Expired,Nh=async({signal:e,page:t,chainId:r,limit:n,config:s,account:a})=>(await Promise.all([s?qw({chainId:r,signal:e,page:t,limit:n,filters:{accounts:[a],configs:s.twapConfig?[s.twapConfig]:[]}}):Promise.resolve([]),zw({chainId:r,signal:e,account:a,exchange:s==null?void 0:s.adapter})]).then(([c,l])=>[...c,...l])).sort((c,l)=>l.createdAt-c.createdAt),Zw={version:"0.0.92"};var Ia=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Xw={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Qw=(B5=class{constructor(){le(this,bn,Xw);le(this,ha,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&N(this,ha)&&e!==N(this,bn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:N(this,bn),provider:e}),J(this,bn,e),process.env.NODE_ENV!=="production"&&J(this,ha,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&J(this,ha,!0),N(this,bn).setTimeout(e,t)}clearTimeout(e){N(this,bn).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&J(this,ha,!0),N(this,bn).setInterval(e,t)}clearInterval(e){N(this,bn).clearInterval(e)}},bn=new WeakMap,ha=new WeakMap,B5),Ns=new Qw;function Jw(e){setTimeout(e,0)}var Ls=typeof window>"u"||"Deno"in globalThis;function Gt(){}function e3(e,t){return typeof e=="function"?e(t):e}function Cd(e){return typeof e=="number"&&e>=0&&e!==1/0}function Lh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Jn(e,t){return typeof e=="function"?e(t):e}function wr(e,t){return typeof e=="function"?e(t):e}function zh(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:a,queryKey:o,stale:i}=e;if(o){if(n){if(t.queryHash!==Td(o,t.options))return!1}else if(!Lo(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||s&&s!==t.state.fetchStatus||a&&!a(t))}function Rh(e,t){const{exact:r,status:n,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(zs(t.options.mutationKey)!==zs(a))return!1}else if(!Lo(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Td(e,t){return((t==null?void 0:t.queryKeyHashFn)||zs)(e)}function zs(e){return JSON.stringify(e,(t,r)=>Sd(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Lo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Lo(e[r],t[r])):!1}var t3=Object.prototype.hasOwnProperty;function Ad(e,t){if(e===t)return e;const r=Hh(e)&&Hh(t);if(!r&&!(Sd(e)&&Sd(t)))return t;const s=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,i=r?new Array(o):{};let c=0;for(let l=0;l<o;l++){const u=r?l:a[l],d=e[u],f=t[u];if(d===f){i[u]=d,(r?l<s:t3.call(e,u))&&c++;continue}if(d===null||f===null||typeof d!="object"||typeof f!="object"){i[u]=f;continue}const m=Ad(d,f);i[u]=m,m===d&&c++}return s===o&&c===s?e:i}function zc(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Hh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Sd(e){if(!$h(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!$h(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function $h(e){return Object.prototype.toString.call(e)==="[object Object]"}function r3(e){return new Promise(t=>{Ns.setTimeout(t,e)})}function Pd(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Ad(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return Ad(e,t)}return t}function n3(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function s3(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Rc=Symbol();function Gh(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Rc&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Rc?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function jh(e,t){return typeof e=="function"?e(...t):!!e}var a3=(F5=class extends Ia{constructor(){super();le(this,ba);le(this,ks);le(this,ko);J(this,ko,t=>{if(!Ls&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){N(this,ks)||this.setEventListener(N(this,ko))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,ks))==null||t.call(this),J(this,ks,void 0))}setEventListener(t){var r;J(this,ko,t),(r=N(this,ks))==null||r.call(this),J(this,ks,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){N(this,ba)!==t&&(J(this,ba,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof N(this,ba)=="boolean"?N(this,ba):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ba=new WeakMap,ks=new WeakMap,ko=new WeakMap,F5),Id=new a3;function Bd(){let e,t;const r=new Promise((s,a)=>{e=s,t=a});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var o3=Jw;function i3(){let e=[],t=0,r=i=>{i()},n=i=>{i()},s=o3;const a=i=>{t?e.push(i):s(()=>{r(i)})},o=()=>{const i=e;e=[],i.length&&s(()=>{n(()=>{i.forEach(c=>{r(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||o()}return c},batchCalls:i=>(...c)=>{a(()=>{i(...c)})},schedule:a,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{s=i}}}var kt=i3(),c3=(O5=class extends Ia{constructor(){super();le(this,Co,!0);le(this,Cs);le(this,To);J(this,To,t=>{if(!Ls&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){N(this,Cs)||this.setEventListener(N(this,To))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,Cs))==null||t.call(this),J(this,Cs,void 0))}setEventListener(t){var r;J(this,To,t),(r=N(this,Cs))==null||r.call(this),J(this,Cs,t(this.setOnline.bind(this)))}setOnline(t){N(this,Co)!==t&&(J(this,Co,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return N(this,Co)}},Co=new WeakMap,Cs=new WeakMap,To=new WeakMap,O5),Hc=new c3;function l3(e){return Math.min(1e3*2**e,3e4)}function Vh(e){return(e??"online")==="online"?Hc.isOnline():!0}var Fd=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Wh(e){let t=!1,r=0,n;const s=Bd(),a=()=>s.status!=="pending",o=g=>{var E;if(!a()){const v=new Fd(g);f(v),(E=e.onCancel)==null||E.call(e,v)}},i=()=>{t=!0},c=()=>{t=!1},l=()=>Id.isFocused()&&(e.networkMode==="always"||Hc.isOnline())&&e.canRun(),u=()=>Vh(e.networkMode)&&e.canRun(),d=g=>{a()||(n==null||n(),s.resolve(g))},f=g=>{a()||(n==null||n(),s.reject(g))},m=()=>new Promise(g=>{var E;n=v=>{(a()||l())&&g(v)},(E=e.onPause)==null||E.call(e)}).then(()=>{var g;n=void 0,a()||(g=e.onContinue)==null||g.call(e)}),b=()=>{if(a())return;let g;const E=r===0?e.initialPromise:void 0;try{g=E??e.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(d).catch(v=>{var L;if(a())return;const w=e.retry??(Ls?0:3),S=e.retryDelay??l3,T=typeof S=="function"?S(r,v):S,O=w===!0||typeof w=="number"&&r<w||typeof w=="function"&&w(r,v);if(t||!O){f(v);return}r++,(L=e.onFail)==null||L.call(e,r,v),r3(T).then(()=>l()?void 0:m()).then(()=>{t?f(v):b()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:i,continueRetry:c,canStart:u,start:()=>(u()?b():m().then(b),s)}}var qh=(U5=class{constructor(){le(this,ya)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Cd(this.gcTime)&&J(this,ya,Ns.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ls?1/0:300*1e3))}clearGcTimeout(){N(this,ya)&&(Ns.clearTimeout(N(this,ya)),J(this,ya,void 0))}},ya=new WeakMap,U5),u3=(D5=class extends qh{constructor(t){super();le(this,Xr);le(this,ga);le(this,Ao);le(this,Fr);le(this,xa);le(this,Bt);le(this,Pc);le(this,wa);J(this,wa,!1),J(this,Pc,t.defaultOptions),this.setOptions(t.options),this.observers=[],J(this,xa,t.client),J(this,Fr,N(this,xa).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,J(this,ga,Zh(this.options)),this.state=t.state??N(this,ga),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=N(this,Bt))==null?void 0:t.promise}setOptions(t){if(this.options={...N(this,Pc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Zh(this.options);r.data!==void 0&&(this.setState(Yh(r.data,r.dataUpdatedAt)),J(this,ga,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&N(this,Fr).remove(this)}setData(t,r){const n=Pd(this.state.data,t,this.options);return Se(this,Xr,Zn).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){Se(this,Xr,Zn).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,s;const r=(n=N(this,Bt))==null?void 0:n.promise;return(s=N(this,Bt))==null||s.cancel(t),r?r.then(Gt).catch(Gt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(N(this,ga))}isActive(){return this.observers.some(t=>wr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Rc||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Jn(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:!Lh(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,Bt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,Bt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),N(this,Fr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(N(this,Bt)&&(N(this,wa)?N(this,Bt).cancel({revert:!0}):N(this,Bt).cancelRetry()),this.scheduleGc()),N(this,Fr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Se(this,Xr,Zn).call(this,{type:"invalidate"})}async fetch(t,r){var c,l,u,d,f,m,b,g,E,v,w,S;if(this.state.fetchStatus!=="idle"&&((c=N(this,Bt))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(N(this,Bt))return N(this,Bt).continueRetry(),N(this,Bt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const T=this.observers.find(O=>O.options.queryFn);T&&this.setOptions(T.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=T=>{Object.defineProperty(T,"signal",{enumerable:!0,get:()=>(J(this,wa,!0),n.signal)})},a=()=>{const T=Gh(this.options,r),L=(()=>{const I={client:N(this,xa),queryKey:this.queryKey,meta:this.meta};return s(I),I})();return J(this,wa,!1),this.options.persister?this.options.persister(T,L,this):T(L)},i=(()=>{const T={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:N(this,xa),state:this.state,fetchFn:a};return s(T),T})();(l=this.options.behavior)==null||l.onFetch(i,this),J(this,Ao,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=i.fetchOptions)==null?void 0:u.meta))&&Se(this,Xr,Zn).call(this,{type:"fetch",meta:(d=i.fetchOptions)==null?void 0:d.meta}),J(this,Bt,Wh({initialPromise:r==null?void 0:r.initialPromise,fn:i.fetchFn,onCancel:T=>{T instanceof Fd&&T.revert&&this.setState({...N(this,Ao),fetchStatus:"idle"}),n.abort()},onFail:(T,O)=>{Se(this,Xr,Zn).call(this,{type:"failed",failureCount:T,error:O})},onPause:()=>{Se(this,Xr,Zn).call(this,{type:"pause"})},onContinue:()=>{Se(this,Xr,Zn).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}));try{const T=await N(this,Bt).start();if(T===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(T),(m=(f=N(this,Fr).config).onSuccess)==null||m.call(f,T,this),(g=(b=N(this,Fr).config).onSettled)==null||g.call(b,T,this.state.error,this),T}catch(T){if(T instanceof Fd){if(T.silent)return N(this,Bt).promise;if(T.revert){if(this.state.data===void 0)throw T;return this.state.data}}throw Se(this,Xr,Zn).call(this,{type:"error",error:T}),(v=(E=N(this,Fr).config).onError)==null||v.call(E,T,this),(S=(w=N(this,Fr).config).onSettled)==null||S.call(w,this.state.data,T,this),T}finally{this.scheduleGc()}}},ga=new WeakMap,Ao=new WeakMap,Fr=new WeakMap,xa=new WeakMap,Bt=new WeakMap,Pc=new WeakMap,wa=new WeakMap,Xr=new WeakSet,Zn=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Kh(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Yh(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return J(this,Ao,t.manual?s:void 0),s;case"error":const a=t.error;return{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),kt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),N(this,Fr).notify({query:this,type:"updated",action:t})})},D5);function Kh(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vh(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Yh(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Zh(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var d3=(_5=class extends Ia{constructor(t,r){super();le(this,We);le(this,nr);le(this,_e);le(this,Ic);le(this,Wt);le(this,va);le(this,So);le(this,Vn);le(this,Ts);le(this,Bc);le(this,Po);le(this,Io);le(this,Ea);le(this,ka);le(this,As);le(this,Bo,new Set);this.options=r,J(this,nr,t),J(this,Ts,null),J(this,Vn,Bd()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(N(this,_e).addObserver(this),Xh(N(this,_e),this.options)?Se(this,We,Uc).call(this):this.updateResult(),Se(this,We,Um).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Od(N(this,_e),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Od(N(this,_e),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Se(this,We,Dm).call(this),Se(this,We,_m).call(this),N(this,_e).removeObserver(this)}setOptions(t){const r=this.options,n=N(this,_e);if(this.options=N(this,nr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof wr(this.options.enabled,N(this,_e))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Se(this,We,Mm).call(this),N(this,_e).setOptions(this.options),r._defaulted&&!zc(this.options,r)&&N(this,nr).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,_e),observer:this});const s=this.hasListeners();s&&Qh(N(this,_e),n,this.options,r)&&Se(this,We,Uc).call(this),this.updateResult(),s&&(N(this,_e)!==n||wr(this.options.enabled,N(this,_e))!==wr(r.enabled,N(this,_e))||Jn(this.options.staleTime,N(this,_e))!==Jn(r.staleTime,N(this,_e)))&&Se(this,We,Bm).call(this);const a=Se(this,We,Fm).call(this);s&&(N(this,_e)!==n||wr(this.options.enabled,N(this,_e))!==wr(r.enabled,N(this,_e))||a!==N(this,As))&&Se(this,We,Om).call(this,a)}getOptimisticResult(t){const r=N(this,nr).getQueryCache().build(N(this,nr),t),n=this.createResult(r,t);return f3(this,n)&&(J(this,Wt,n),J(this,So,this.options),J(this,va,N(this,_e).state)),n}getCurrentResult(){return N(this,Wt)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&N(this,Vn).status==="pending"&&N(this,Vn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){N(this,Bo).add(t)}getCurrentQuery(){return N(this,_e)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=N(this,nr).defaultQueryOptions(t),n=N(this,nr).getQueryCache().build(N(this,nr),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Se(this,We,Uc).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,Wt)))}createResult(t,r){var y;const n=N(this,_e),s=this.options,a=N(this,Wt),o=N(this,va),i=N(this,So),l=t!==n?t.state:N(this,Ic),{state:u}=t;let d={...u},f=!1,m;if(r._optimisticResults){const x=this.hasListeners(),A=!x&&Xh(t,r),B=x&&Qh(t,n,r,s);(A||B)&&(d={...d,...Kh(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:b,errorUpdatedAt:g,status:E}=d;m=d.data;let v=!1;if(r.placeholderData!==void 0&&m===void 0&&E==="pending"){let x;a!=null&&a.isPlaceholderData&&r.placeholderData===(i==null?void 0:i.placeholderData)?(x=a.data,v=!0):x=typeof r.placeholderData=="function"?r.placeholderData((y=N(this,Io))==null?void 0:y.state.data,N(this,Io)):r.placeholderData,x!==void 0&&(E="success",m=Pd(a==null?void 0:a.data,x,r),f=!0)}if(r.select&&m!==void 0&&!v)if(a&&m===(o==null?void 0:o.data)&&r.select===N(this,Bc))m=N(this,Po);else try{J(this,Bc,r.select),m=r.select(m),m=Pd(a==null?void 0:a.data,m,r),J(this,Po,m),J(this,Ts,null)}catch(x){J(this,Ts,x)}N(this,Ts)&&(b=N(this,Ts),m=N(this,Po),g=Date.now(),E="error");const w=d.fetchStatus==="fetching",S=E==="pending",T=E==="error",O=S&&w,L=m!==void 0,h={status:E,fetchStatus:d.fetchStatus,isPending:S,isSuccess:E==="success",isError:T,isInitialLoading:O,isLoading:O,data:m,dataUpdatedAt:d.dataUpdatedAt,error:b,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:w,isRefetching:w&&!S,isLoadingError:T&&!L,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:T&&L,isStale:Ud(t,r),refetch:this.refetch,promise:N(this,Vn),isEnabled:wr(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const x=F=>{h.status==="error"?F.reject(h.error):h.data!==void 0&&F.resolve(h.data)},A=()=>{const F=J(this,Vn,h.promise=Bd());x(F)},B=N(this,Vn);switch(B.status){case"pending":t.queryHash===n.queryHash&&x(B);break;case"fulfilled":(h.status==="error"||h.data!==B.value)&&A();break;case"rejected":(h.status!=="error"||h.error!==B.reason)&&A();break}}return h}updateResult(){const t=N(this,Wt),r=this.createResult(N(this,_e),this.options);if(J(this,va,N(this,_e).state),J(this,So,this.options),N(this,va).data!==void 0&&J(this,Io,N(this,_e)),zc(r,t))return;J(this,Wt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!N(this,Bo).size)return!0;const o=new Set(a??N(this,Bo));return this.options.throwOnError&&o.add("error"),Object.keys(N(this,Wt)).some(i=>{const c=i;return N(this,Wt)[c]!==t[c]&&o.has(c)})};Se(this,We,K5).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Se(this,We,Um).call(this)}},nr=new WeakMap,_e=new WeakMap,Ic=new WeakMap,Wt=new WeakMap,va=new WeakMap,So=new WeakMap,Vn=new WeakMap,Ts=new WeakMap,Bc=new WeakMap,Po=new WeakMap,Io=new WeakMap,Ea=new WeakMap,ka=new WeakMap,As=new WeakMap,Bo=new WeakMap,We=new WeakSet,Uc=function(t){Se(this,We,Mm).call(this);let r=N(this,_e).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Gt)),r},Bm=function(){Se(this,We,Dm).call(this);const t=Jn(this.options.staleTime,N(this,_e));if(Ls||N(this,Wt).isStale||!Cd(t))return;const n=Lh(N(this,Wt).dataUpdatedAt,t)+1;J(this,Ea,Ns.setTimeout(()=>{N(this,Wt).isStale||this.updateResult()},n))},Fm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(N(this,_e)):this.options.refetchInterval)??!1},Om=function(t){Se(this,We,_m).call(this),J(this,As,t),!(Ls||wr(this.options.enabled,N(this,_e))===!1||!Cd(N(this,As))||N(this,As)===0)&&J(this,ka,Ns.setInterval(()=>{(this.options.refetchIntervalInBackground||Id.isFocused())&&Se(this,We,Uc).call(this)},N(this,As)))},Um=function(){Se(this,We,Bm).call(this),Se(this,We,Om).call(this,Se(this,We,Fm).call(this))},Dm=function(){N(this,Ea)&&(Ns.clearTimeout(N(this,Ea)),J(this,Ea,void 0))},_m=function(){N(this,ka)&&(Ns.clearInterval(N(this,ka)),J(this,ka,void 0))},Mm=function(){const t=N(this,nr).getQueryCache().build(N(this,nr),this.options);if(t===N(this,_e))return;const r=N(this,_e);J(this,_e,t),J(this,Ic,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},K5=function(t){kt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(N(this,Wt))}),N(this,nr).getQueryCache().notify({query:N(this,_e),type:"observerResultsUpdated"})})},_5);function p3(e,t){return wr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Xh(e,t){return p3(e,t)||e.state.data!==void 0&&Od(e,t,t.refetchOnMount)}function Od(e,t,r){if(wr(t.enabled,e)!==!1&&Jn(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Ud(e,t)}return!1}function Qh(e,t,r,n){return(e!==t||wr(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Ud(e,r)}function Ud(e,t){return wr(t.enabled,e)!==!1&&e.isStaleByTime(Jn(t.staleTime,e))}function f3(e,t){return!zc(e.getCurrentResult(),t)}function Jh(e){return{onFetch:(t,r)=>{var u,d,f,m,b;const n=t.options,s=(f=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,a=((m=t.state.data)==null?void 0:m.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const l=async()=>{let g=!1;const E=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},v=Gh(t.options,t.fetchOptions),w=async(S,T,O)=>{if(g)return Promise.reject();if(T==null&&S.pages.length)return Promise.resolve(S);const I=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:T,direction:O?"backward":"forward",meta:t.options.meta};return E(A),A})(),h=await v(I),{maxPages:y}=t.options,x=O?s3:n3;return{pages:x(S.pages,h,y),pageParams:x(S.pageParams,T,y)}};if(s&&a.length){const S=s==="backward",T=S?m3:e1,O={pages:a,pageParams:o},L=T(n,O);i=await w(O,L,S)}else{const S=e??a.length;do{const T=c===0?o[0]??n.initialPageParam:e1(n,i);if(c>0&&T==null)break;i=await w(i,T),c++}while(c<S)}return i};t.options.persister?t.fetchFn=()=>{var g,E;return(E=(g=t.options).persister)==null?void 0:E.call(g,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=l}}}function e1(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function m3(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var h3=(M5=class extends qh{constructor(t){super();le(this,gn);le(this,Fc);le(this,yn);le(this,qt);le(this,Ca);J(this,Fc,t.client),this.mutationId=t.mutationId,J(this,qt,t.mutationCache),J(this,yn,[]),this.state=t.state||t1(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){N(this,yn).includes(t)||(N(this,yn).push(t),this.clearGcTimeout(),N(this,qt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){J(this,yn,N(this,yn).filter(r=>r!==t)),this.scheduleGc(),N(this,qt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){N(this,yn).length||(this.state.status==="pending"?this.scheduleGc():N(this,qt).remove(this))}continue(){var t;return((t=N(this,Ca))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,c,l,u,d,f,m,b,g,E,v,w,S,T,O,L,I,h,y;const r=()=>{Se(this,gn,Fs).call(this,{type:"continue"})},n={client:N(this,Fc),meta:this.options.meta,mutationKey:this.options.mutationKey};J(this,Ca,Wh({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(x,A)=>{Se(this,gn,Fs).call(this,{type:"failed",failureCount:x,error:A})},onPause:()=>{Se(this,gn,Fs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>N(this,qt).canRun(this)}));const s=this.state.status==="pending",a=!N(this,Ca).canStart();try{if(s)r();else{Se(this,gn,Fs).call(this,{type:"pending",variables:t,isPaused:a}),await((i=(o=N(this,qt).config).onMutate)==null?void 0:i.call(o,t,this,n));const A=await((l=(c=this.options).onMutate)==null?void 0:l.call(c,t,n));A!==this.state.context&&Se(this,gn,Fs).call(this,{type:"pending",context:A,variables:t,isPaused:a})}const x=await N(this,Ca).start();return await((d=(u=N(this,qt).config).onSuccess)==null?void 0:d.call(u,x,t,this.state.context,this,n)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,x,t,this.state.context,n)),await((g=(b=N(this,qt).config).onSettled)==null?void 0:g.call(b,x,null,this.state.variables,this.state.context,this,n)),await((v=(E=this.options).onSettled)==null?void 0:v.call(E,x,null,t,this.state.context,n)),Se(this,gn,Fs).call(this,{type:"success",data:x}),x}catch(x){try{throw await((S=(w=N(this,qt).config).onError)==null?void 0:S.call(w,x,t,this.state.context,this,n)),await((O=(T=this.options).onError)==null?void 0:O.call(T,x,t,this.state.context,n)),await((I=(L=N(this,qt).config).onSettled)==null?void 0:I.call(L,void 0,x,this.state.variables,this.state.context,this,n)),await((y=(h=this.options).onSettled)==null?void 0:y.call(h,void 0,x,t,this.state.context,n)),x}finally{Se(this,gn,Fs).call(this,{type:"error",error:x})}}finally{N(this,qt).runNext(this)}}},Fc=new WeakMap,yn=new WeakMap,qt=new WeakMap,Ca=new WeakMap,gn=new WeakSet,Fs=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,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{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),kt.batch(()=>{N(this,yn).forEach(n=>{n.onMutationUpdate(t)}),N(this,qt).notify({mutation:this,type:"updated",action:t})})},M5);function t1(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var b3=(N5=class extends Ia{constructor(t={}){super();le(this,Wn);le(this,Qr);le(this,Oc);this.config=t,J(this,Wn,new Set),J(this,Qr,new Map),J(this,Oc,0)}build(t,r,n){const s=new h3({client:t,mutationCache:this,mutationId:++rd(this,Oc)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){N(this,Wn).add(t);const r=$c(t);if(typeof r=="string"){const n=N(this,Qr).get(r);n?n.push(t):N(this,Qr).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(N(this,Wn).delete(t)){const r=$c(t);if(typeof r=="string"){const n=N(this,Qr).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&N(this,Qr).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=$c(t);if(typeof r=="string"){const n=N(this,Qr).get(r),s=n==null?void 0:n.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=$c(t);if(typeof r=="string"){const s=(n=N(this,Qr).get(r))==null?void 0:n.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){kt.batch(()=>{N(this,Wn).forEach(t=>{this.notify({type:"removed",mutation:t})}),N(this,Wn).clear(),N(this,Qr).clear()})}getAll(){return Array.from(N(this,Wn))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Rh(r,n))}findAll(t={}){return this.getAll().filter(r=>Rh(t,r))}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return kt.batch(()=>Promise.all(t.map(r=>r.continue().catch(Gt))))}},Wn=new WeakMap,Qr=new WeakMap,Oc=new WeakMap,N5);function $c(e){var t;return(t=e.options.scope)==null?void 0:t.id}var y3=(L5=class extends Ia{constructor(t,r){super();le(this,Yn);le(this,qn);le(this,Ss);le(this,sr);le(this,Kn);J(this,qn,t),this.setOptions(r),this.bindMethods(),Se(this,Yn,nd).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var n;const r=this.options;this.options=N(this,qn).defaultMutationOptions(t),zc(this.options,r)||N(this,qn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:N(this,sr),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&zs(r.mutationKey)!==zs(this.options.mutationKey)?this.reset():((n=N(this,sr))==null?void 0:n.state.status)==="pending"&&N(this,sr).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=N(this,sr))==null||t.removeObserver(this)}onMutationUpdate(t){Se(this,Yn,nd).call(this),Se(this,Yn,Nm).call(this,t)}getCurrentResult(){return N(this,Ss)}reset(){var t;(t=N(this,sr))==null||t.removeObserver(this),J(this,sr,void 0),Se(this,Yn,nd).call(this),Se(this,Yn,Nm).call(this)}mutate(t,r){var n;return J(this,Kn,r),(n=N(this,sr))==null||n.removeObserver(this),J(this,sr,N(this,qn).getMutationCache().build(N(this,qn),this.options)),N(this,sr).addObserver(this),N(this,sr).execute(t)}},qn=new WeakMap,Ss=new WeakMap,sr=new WeakMap,Kn=new WeakMap,Yn=new WeakSet,nd=function(){var r;const t=((r=N(this,sr))==null?void 0:r.state)??t1();J(this,Ss,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Nm=function(t){kt.batch(()=>{var r,n,s,a,o,i,c,l;if(N(this,Kn)&&this.hasListeners()){const u=N(this,Ss).variables,d=N(this,Ss).context,f={client:N(this,qn),meta:this.options.meta,mutationKey:this.options.mutationKey};(t==null?void 0:t.type)==="success"?((n=(r=N(this,Kn)).onSuccess)==null||n.call(r,t.data,u,d,f),(a=(s=N(this,Kn)).onSettled)==null||a.call(s,t.data,null,u,d,f)):(t==null?void 0:t.type)==="error"&&((i=(o=N(this,Kn)).onError)==null||i.call(o,t.error,u,d,f),(l=(c=N(this,Kn)).onSettled)==null||l.call(c,void 0,t.error,u,d,f))}this.listeners.forEach(u=>{u(N(this,Ss))})})},L5),g3=(z5=class extends Ia{constructor(t={}){super();le(this,xn);this.config=t,J(this,xn,new Map)}build(t,r,n){const s=r.queryKey,a=r.queryHash??Td(s,r);let o=this.get(a);return o||(o=new u3({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){N(this,xn).has(t.queryHash)||(N(this,xn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=N(this,xn).get(t.queryHash);r&&(t.destroy(),r===t&&N(this,xn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){kt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return N(this,xn).get(t)}getAll(){return[...N(this,xn).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>zh(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>zh(t,n)):r}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){kt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){kt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},xn=new WeakMap,z5),x3=(R5=class{constructor(e={}){le(this,mt);le(this,Ps);le(this,Is);le(this,Fo);le(this,Oo);le(this,Bs);le(this,Uo);le(this,Do);J(this,mt,e.queryCache||new g3),J(this,Ps,e.mutationCache||new b3),J(this,Is,e.defaultOptions||{}),J(this,Fo,new Map),J(this,Oo,new Map),J(this,Bs,0)}mount(){rd(this,Bs)._++,N(this,Bs)===1&&(J(this,Uo,Id.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,mt).onFocus())})),J(this,Do,Hc.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,mt).onOnline())})))}unmount(){var e,t;rd(this,Bs)._--,N(this,Bs)===0&&((e=N(this,Uo))==null||e.call(this),J(this,Uo,void 0),(t=N(this,Do))==null||t.call(this),J(this,Do,void 0))}isFetching(e){return N(this,mt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return N(this,Ps).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,mt).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=N(this,mt).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Jn(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return N(this,mt).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=N(this,mt).get(n.queryHash),a=s==null?void 0:s.state.data,o=e3(t,a);if(o!==void 0)return N(this,mt).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return kt.batch(()=>N(this,mt).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,mt).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=N(this,mt);kt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=N(this,mt);return kt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=kt.batch(()=>N(this,mt).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Gt).catch(Gt)}invalidateQueries(e,t={}){return kt.batch(()=>(N(this,mt).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=kt.batch(()=>N(this,mt).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,r);return r.throwOnError||(a=a.catch(Gt)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(Gt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=N(this,mt).build(this,t);return r.isStaleByTime(Jn(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Gt).catch(Gt)}fetchInfiniteQuery(e){return e.behavior=Jh(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Gt).catch(Gt)}ensureInfiniteQueryData(e){return e.behavior=Jh(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Hc.isOnline()?N(this,Ps).resumePausedMutations():Promise.resolve()}getQueryCache(){return N(this,mt)}getMutationCache(){return N(this,Ps)}getDefaultOptions(){return N(this,Is)}setDefaultOptions(e){J(this,Is,e)}setQueryDefaults(e,t){N(this,Fo).set(zs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...N(this,Fo).values()],r={};return t.forEach(n=>{Lo(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){N(this,Oo).set(zs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...N(this,Oo).values()],r={};return t.forEach(n=>{Lo(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...N(this,Is).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Td(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===Rc&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...N(this,Is).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){N(this,mt).clear(),N(this,Ps).clear()}},mt=new WeakMap,Ps=new WeakMap,Is=new WeakMap,Fo=new WeakMap,Oo=new WeakMap,Bs=new WeakMap,Uo=new WeakMap,Do=new WeakMap,R5),r1=Et.createContext(void 0),Dd=e=>{const t=Et.useContext(r1);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},w3=({client:e,children:t})=>(Et.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),C.jsx(r1.Provider,{value:e,children:t})),n1=Et.createContext(!1),v3=()=>Et.useContext(n1);n1.Provider;function E3(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var k3=Et.createContext(E3()),C3=()=>Et.useContext(k3),T3=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},A3=e=>{Et.useEffect(()=>{e.clearReset()},[e])},S3=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||jh(r,[e.error,n])),P3=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},I3=(e,t)=>e.isLoading&&e.isFetching&&!t,B3=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,s1=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function F3(e,t,r){var d,f,m,b,g;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=v3(),s=C3(),a=Dd(),o=a.defaultQueryOptions(e);(f=(d=a.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||f.call(d,o),process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=n?"isRestoring":"optimistic",P3(o),T3(o,s),A3(s);const i=!a.getQueryCache().get(o.queryHash),[c]=Et.useState(()=>new t(a,o)),l=c.getOptimisticResult(o),u=!n&&e.subscribed!==!1;if(Et.useSyncExternalStore(Et.useCallback(E=>{const v=u?c.subscribe(kt.batchCalls(E)):Gt;return c.updateResult(),v},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),Et.useEffect(()=>{c.setOptions(o)},[o,c]),B3(o,l))throw s1(o,c,s);if(S3({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;if((b=(m=a.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||b.call(m,o,l),o.experimental_prefetchInRender&&!Ls&&I3(l,n)){const E=i?s1(o,c,s):(g=a.getQueryCache().get(o.queryHash))==null?void 0:g.promise;E==null||E.catch(Gt).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?l:c.trackResult(l)}function O3(e,t){return F3(e,d3)}function en(e,t){const r=Dd(),[n]=Et.useState(()=>new y3(r,e));Et.useEffect(()=>{n.setOptions(e)},[n,e]);const s=Et.useSyncExternalStore(Et.useCallback(o=>n.subscribe(kt.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=Et.useCallback((o,i)=>{n.mutate(o,i).catch(Gt)},[n]);if(s.error&&jh(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}const U3=M.createContext(null),_d={didCatch:!1,error:null};class D3 extends M.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=_d}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var r,n,s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:a,reason:"imperative-api"}),this.setState(_d)}}componentDidCatch(t,r){var n,s;(n=(s=this.props).onError)===null||n===void 0||n.call(s,t,r)}componentDidUpdate(t,r){const{didCatch:n}=this.state,{resetKeys:s}=this.props;if(n&&r.error!==null&&_3(t.resetKeys,s)){var a,o;(a=(o=this.props).onReset)===null||a===void 0||a.call(o,{next:s,prev:t.resetKeys,reason:"keys"}),this.setState(_d)}}render(){const{children:t,fallbackRender:r,FallbackComponent:n,fallback:s}=this.props,{didCatch:a,error:o}=this.state;let i=t;if(a){const c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")i=r(c);else if(n)i=M.createElement(n,c);else if(s!==void 0)i=s;else throw o}return M.createElement(U3.Provider,{value:{didCatch:a,error:o,resetErrorBoundary:this.resetErrorBoundary}},i)}}function _3(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((r,n)=>!Object.is(r,t[n]))}const a1=e=>{let t;const r=new Set,n=(l,u)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const f=t;t=u??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(m=>m(t,f))}},s=()=>t,i={setState:n,getState:s,getInitialState:()=>c,subscribe:l=>(r.add(l),()=>r.delete(l))},c=t=e(n,s,i);return i},M3=(e=>e?a1(e):a1),N3=e=>e;function L3(e,t=N3){const r=M.useSyncExternalStore(e.subscribe,M.useCallback(()=>t(e.getState()),[e,t]),M.useCallback(()=>t(e.getInitialState()),[e,t]));return M.useDebugValue(r),r}const o1=e=>{const t=M3(e),r=n=>L3(t,n);return Object.assign(r,t),r},z3=(e=>e?o1(e):o1),Md={disclaimerAccepted:!0,currentTime:Date.now(),swapExecution:{}},ee=z3((e,t)=>({state:Md,updateState:r=>e(n=>({state:{...n.state,...r}})),updateSwapExecution:r=>e(n=>({state:{...n.state,swapExecution:{...n.state.swapExecution,...r}}})),resetSwapExecution:r=>e(n=>({state:{...n.state,swapExecution:{...Md.swapExecution,...r}}})),resetState:()=>{e({state:{...Md,currentTime:Date.now(),swapExecution:{...t().state.swapExecution,acceptedMarketPrice:void 0,acceptedSrcAmount:void 0},isMarketOrder:t().state.isMarketOrder}}),setTimeout(()=>{t().resetSwapExecution()},1e3)}}));(function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".orbs_OrbsLogo{object-fit:contain;display:inline}.orbs_PoweredBy{border-radius:8px;margin-left:auto;margin-right:auto}.orbs_PoweredBy a{display:flex;align-items:center;justify-content:center;text-decoration:none;color:inherit}.orbs_PoweredBy span{font-size:14px}.orbs_PoweredBy .orbs_OrbsLogo{margin-left:6px;margin-right:6px;width:18px;height:18px}.orbs_Text{margin:0;padding:0}.orbs_Spinner{width:var(--size, 38px);height:var(--size, 38px);border:var(--border-width, 3px) solid var(--border-color, white);border-bottom-color:var(--bottom-border-color, rgba(255, 255, 255, .2));border-radius:50%;display:inline-block;box-sizing:border-box;animation:orbs_rotation 1s linear infinite}@keyframes orbs_rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.orbs_TradeStepLayout{--layout-min-height: 220px;--layout-width: 100%;--layout-display: flex;--layout-direction: column;--layout-align: center;--layout-overflow: visible;display:var(--layout-display);flex-direction:var(--layout-direction);align-items:var(--layout-align);width:var(--layout-width);min-height:var(--layout-min-height);overflow:var(--layout-overflow)}.orbs_TradeStepLayoutBody{--body-gap: 20px;--body-margin-top: 30px;--body-width: 100%;--body-display: flex;--body-direction: column;--body-align: center;--body-overflow: visible;gap:var(--body-gap);align-items:var(--body-align);display:var(--body-display);flex-direction:var(--body-direction);width:var(--body-width);margin-top:var(--body-margin-top);overflow:var(--body-overflow)}.orbs_TradeStepLayoutHeader{--header-gap: 30px;--header-display: flex;--header-direction: column;--header-align: center;--header-justify: center;--header-overflow: visible;display:var(--header-display);flex-direction:var(--header-direction);align-items:var(--header-align);justify-content:var(--header-justify);gap:var(--header-gap);overflow:var(--header-overflow)}.orbs_TradeStepLayoutTitle{--title-font-size: 18px;--title-font-weight: 500;--title-line-height: normal;--title-color: inherit;--title-text-align: center;--title-margin: 0;--title-padding: 0;font-size:var(--title-font-size);font-weight:var(--title-font-weight);line-height:var(--title-line-height);color:var(--title-color);text-align:var(--title-text-align);margin:var(--title-margin);padding:var(--title-padding)}.orbs_StepIndicator{--indicator-display: flex;--indicator-align: center;--indicator-justify: flex-start;--indicator-height: 7px;--indicator-width: 120px;--indicator-border-radius: 999px;--indicator-bg-color: white;--indicator-margin-bottom: 20px;--indicator-position: relative;--indicator-overflow: hidden;--indicator-border: none;--indicator-box-shadow: none;display:var(--indicator-display);align-items:var(--indicator-align);justify-content:var(--indicator-justify);height:var(--indicator-height);width:var(--indicator-width);border-radius:var(--indicator-border-radius);overflow:var(--indicator-overflow);background-color:var(--indicator-bg-color);margin-bottom:var(--indicator-margin-bottom);position:var(--indicator-position);border:var(--indicator-border);box-shadow:var(--indicator-box-shadow)}.orbs_StepIndicatorLine{--line-height: 100%;--line-bg-color: black;--line-position: absolute;--line-top: 0;--line-left: 0;--line-right: 0;--line-bottom: 0;--line-transition: all .3s ease;--line-border-radius: inherit;--line-box-shadow: none;height:var(--line-height);background-color:var(--line-bg-color);position:var(--line-position);top:var(--line-top);left:var(--line-left);right:var(--line-right);bottom:var(--line-bottom);transition:var(--line-transition);border-radius:var(--line-border-radius);box-shadow:var(--line-box-shadow)}.orbs_TradeStepLayoutFooter{--footer-display: flex;--footer-align: center;--footer-justify: center;--footer-direction: column;--footer-margin-top: auto;--footer-padding-top: 30px;--footer-width: 100%;--footer-overflow: visible;--footer-border-top: none;display:var(--footer-display);align-items:var(--footer-align);justify-content:var(--footer-justify);flex-direction:var(--footer-direction);margin-top:var(--footer-margin-top);padding-top:var(--footer-padding-top);width:var(--footer-width);overflow:var(--footer-overflow);border-top:var(--footer-border-top)}.orbs_TradeStepLayoutFooter p{--footer-text-font-size: 15px;--footer-text-line-height: normal;--footer-text-color: inherit;--footer-text-margin: 0;--footer-text-padding: 0;font-size:var(--footer-text-font-size);line-height:var(--footer-text-line-height);color:var(--footer-text-color);margin:var(--footer-text-margin);padding:var(--footer-text-padding)}.orbs_TradeStepLayoutFooterLink{--link-color: inherit;--link-text-decoration: none;--link-font-size: 15px;--link-text-align: center;--link-margin: auto;--link-outline: none;--link-line-height: normal;--link-padding: 0;--link-transition: color .2s ease;--link-hover-color: inherit;--link-hover-text-decoration: underline;color:var(--link-color);text-decoration:var(--link-text-decoration);font-size:var(--link-font-size);text-align:var(--link-text-align);margin-left:var(--link-margin);margin-right:var(--link-margin);outline:var(--link-outline);line-height:var(--link-line-height);padding:var(--link-padding);transition:var(--link-transition)}.orbs_TradeStepLayoutFooterLink:hover{color:var(--link-hover-color);text-decoration:var(--link-hover-text-decoration)}.orbs_TradeStepLayoutSuccessIcon{--success-icon-display: flex;--success-icon-justify: center;--success-icon-align: center;--success-icon-width: 60px;--success-icon-height: 60px;--success-icon-border-radius: 50%;--success-icon-overflow: visible;--success-icon-bg-color: transparent;--success-icon-border: none;--success-icon-box-shadow: none;display:var(--success-icon-display);justify-content:var(--success-icon-justify);align-items:var(--success-icon-align);width:var(--success-icon-width);height:var(--success-icon-height);border-radius:var(--success-icon-border-radius);overflow:var(--success-icon-overflow);background-color:var(--success-icon-bg-color);border:var(--success-icon-border);box-shadow:var(--success-icon-box-shadow)}.orbs_TradeStepLayoutErrorIcon{--error-icon-width: 80px;--error-icon-height: 80px;--error-icon-display: flex;--error-icon-justify: center;--error-icon-align: center;--error-icon-overflow: visible;--error-icon-bg-color: transparent;--error-icon-border: none;--error-icon-box-shadow: none;width:var(--error-icon-width);height:var(--error-icon-height);display:var(--error-icon-display);justify-content:var(--error-icon-justify);align-items:var(--error-icon-align);overflow:var(--error-icon-overflow);background-color:var(--error-icon-bg-color);border:var(--error-icon-border);box-shadow:var(--error-icon-box-shadow)}.orbs_FailedContentMsg{font-size:22px;font-weight:500}.orbs_TradePreview{display:flex;align-items:center;justify-content:center;gap:8px;width:100%}.orbs_TradePreviewToken{display:flex;align-items:center;gap:6px;max-width:calc(50% - 30px)}.orbs_TradePreviewToken p{--token-font-size: 15px;--token-white-space: nowrap;--token-overflow: hidden;--token-text-overflow: ellipsis;--token-flex: 1;--token-margin: 0;--token-padding: 0;font-size:var(--token-font-size);white-space:var(--token-white-space);overflow:var(--token-overflow);text-overflow:var(--token-text-overflow);flex:var(--token-flex);margin:var(--token-margin)}.orbs_TradepPreviewIcon{width:22px;height:22px}.orbs_TradepPreviewLogo{width:24px;height:24px;border-radius:50%;overflow:hidden}.orbs_FlexRow{display:flex;flex-direction:row}.orbs_FlexColumn{display:flex;flex-direction:column}@keyframes orbs_skeletonAnimation{0%{opacity:.2}to{opacity:.4}}.orbs_SkeletonLoader{animation:orbs_skeletonAnimation 1s linear infinite alternate;background-color:#fff}.orbs_Main-wrapper{width:100%}.orbs_Main{width:100%;display:flex;flex-direction:column;gap:28px}.orbs_MainToken{display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%;gap:8px}.orbs_MainTokenLeft{display:flex;flex-direction:column;align-items:flex-start;gap:8px}.orbs_MainTokenUsd{display:flex;align-items:center;gap:5px}.orbs_MainTokenUsd small{font-size:12px;opacity:.6}.orbs_MainContentLoader{width:100%;display:flex;gap:15px;align-items:center;margin-top:20px}.orbs_MainContentRectengularLoader{flex:1;height:20px;max-width:250px;border-radius:20px}.orbs_MainContentCircleLoader{width:30px;height:30px;border-radius:50%}.orbs_MainTokenLogo{--width: 40px;--height: 40px;width:var(--width);height:var(--height)}.orbs_MainTokenLogo img{width:100%;height:100%;object-fit:cover}.orbs_SwapFlow{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%}.orbs_SwapFlow *{box-sizing:border-box}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();const Le=e=>`orbs_${e}`;function zo({children:e,className:t=""}){return C.jsx("p",{className:`${t} ${Le("Text")}`,children:e})}const i1=M.createContext({});function R3({children:e,...t}){return C.jsx(i1.Provider,{value:t,children:e})}const tn=()=>M.useContext(i1);var pt=(e=>(e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILED=3]="FAILED",e))(pt||{});const H3=({className:e="",size:t=38,borderWidth:r=3,borderColor:n="white",bottomBorderColor:s="rgba(255, 255, 255, 0.2)"})=>{const a={"--size":`${t}px`,"--border-width":`${r}px`,"--border-color":n,"--bottom-border-color":s};return C.jsx("div",{className:`${Le("Spinner")} ${e}`,style:a})};function Gc({className:e="",body:t,footerLink:r,footerText:n,title:s,children:a}){return C.jsxs("div",{className:`${Le("TradeStepLayout")} ${e}`,children:[C.jsxs("div",{className:Le("TradeStepLayoutHeader"),children:[C.jsx(W3,{}),s&&C.jsx(zo,{className:Le("TradeStepLayoutTitle"),children:s})]}),t&&C.jsx("div",{className:Le("TradeStepLayoutBody"),children:t}),C.jsx($3,{link:r,text:n}),a]})}const $3=({link:e,text:t})=>{const{swapStatus:r}=tn();return!e&&!t?null:C.jsxs("div",{className:Le("TradeStepLayoutFooter"),children:[C.jsx(K3,{}),e?C.jsx(G3,{link:e,text:t}):r===pt.FAILED?void 0:C.jsx(zo,{children:t})]})},G3=({link:e,text:t})=>C.jsx("a",{target:"_blank",className:Le("TradeStepLayoutFooterLink"),href:e,children:t});function j3(){const{components:e}=tn();return e.SuccessIcon?e.SuccessIcon:C.jsxs("svg",{fill:"none",viewBox:"0 0 16 16",className:Le("TradeStepLayoutSuccessIcon"),children:[C.jsx("circle",{cx:"8",cy:"8",r:"7",strokeWidth:"1.5",stroke:"#00C853"}),C.jsx("path",{strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"#00C853",d:"M5 8l2 2 4-4"})]})}function V3(){const{components:e}=tn();return e.FailedIcon?e.FailedIcon:C.jsxs("svg",{className:Le("TradeStepLayoutErrorIcon"),viewBox:"0 0 16 16",fill:"none",children:[C.jsx("circle",{cx:"8",cy:"8",r:"7",strokeWidth:"1.5",stroke:"#FF3D00"}),C.jsx("path",{strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"#FF3D00",d:"M8 4v5M8 11h.01"})]})}const W3=()=>{const{swapStatus:e}=tn();return e===pt.SUCCESS?C.jsx(j3,{}):e===pt.FAILED?C.jsx(V3,{}):C.jsx(q3,{})},q3=()=>{const{components:e}=tn();return e.Loader?e.Loader:C.jsx(H3,{size:60,borderWidth:5,className:Le("TradeStepLayoutSpinner")})},K3=()=>{const{totalSteps:e,currentStepIndex:t=0,swapStatus:r}=tn();return r!==pt.LOADING||e===1?null:C.jsx("div",{className:Le("StepIndicator"),children:C.jsx("div",{style:{width:`${100/(e||0)}%`,left:`${t*100/(e||0)}%`},className:Le("StepIndicatorLine")})})},Y3=({error:e,footerLink:t,footerText:r})=>C.jsx(Gc,{footerLink:t,footerText:r,body:e||C.jsx("p",{className:Le("FailedContentMsg"),children:"Something went wrong"}),className:Le("FailedContent")});function Z3(){return C.jsx("svg",{fill:"currentColor",viewBox:"0 0 16 16",className:Le("TradepPreviewIcon"),children:C.jsx("path",{fillRule:"evenodd",d:"M4 8a.5.5 0 01.5-.5h5.793L8.146 5.354a.5.5 0 11.708-.708l3 3a.5.5 0 010 .708l-3 3a.5.5 0 01-.708-.708L10.293 8.5H4.5A.5.5 0 014 8z"})})}const c1=({inTokenOnly:e})=>{const{inToken:t,outToken:r,inAmount:n,outAmount:s,components:a}=tn();return C.jsxs("div",{className:Le("TradePreview"),children:[C.jsx(l1,{token:t,amount:n,Logo:a==null?void 0:a.SrcTokenLogo}),!e&&C.jsxs(C.Fragment,{children:[C.jsx(Z3,{}),C.jsx(l1,{token:r,amount:s,Logo:a==null?void 0:a.DstTokenLogo})]})]})},l1=({token:e,amount:t,Logo:r})=>C.jsxs("div",{className:Le("TradePreviewToken"),children:[r||C.jsx("img",{src:e==null?void 0:e.logoUrl,className:Le("TradepPreviewLogo"),alt:`${e==null?void 0:e.symbol} logo`}),C.jsxs(zo,{children:[t," ",e==null?void 0:e.symbol]})]});function X3({title:e,footerLink:t,footerText:r,hideTokens:n}){return C.jsx(Gc,{title:e,className:Le("Success"),body:!n&&C.jsx(c1,{}),footerLink:t,footerText:r})}const u1=({$gap:e=10,$alignItems:t="flex-start",children:r,className:n="",customStyles:s={}})=>{const a={gap:`${e}px`,alignItems:t,width:"100%",...s};return C.jsx("div",{className:`${Le("FlexColumn")} ${n}`,style:a,children:r})};function d1({styles:e={},className:t=""}){return C.jsx("div",{style:e,className:`${Le("SkeletonLoader")} ${t}`})}const Q3=()=>C.jsxs("div",{className:`${Le("MainContentLoader")}`,children:[C.jsx(d1,{className:`${Le("MainContentCircleLoader")}`}),C.jsx(d1,{className:`${Le("MainContentRectengularLoader")}`})]}),J3=({fromTitle:e,toTitle:t,inUsd:r,outUsd:n})=>{const{swapStatus:s,outAmount:a,inAmount:o,inToken:i,outToken:c,components:l,totalSteps:u}=tn(),d=C.jsx(f1,{fromTitle:e,inUsd:r,inToken:i,toTitle:t,outUsd:n,outToken:c,inAmount:o,outAmount:a,SrcTokenLogo:l.SrcTokenLogo,DstTokenLogo:l.DstTokenLogo});return s?u?C.jsx(e8,{}):C.jsxs(u1,{children:[d,C.jsx(Q3,{})]}):C.jsx(u1,{children:d})},p1=({amount:e,token:t,usd:r,title:n,Logo:s})=>C.jsxs("div",{className:`${Le("MainToken")}`,children:[C.jsxs("div",{className:`${Le("MainTokenLeft")}`,children:[C.jsx(zo,{className:`${Le("MainTokenTitle")}`,children:n}),C.jsx(zo,{className:` ${Le("MainTokenAmount")}`,children:`${e&&Number(e)>0?e:""} ${(t==null?void 0:t.symbol)||""}`}),r&&C.jsx("div",{className:` ${Le("MainTokenUsd")}`,children:r})]}),s||C.jsx("div",{className:` ${Le("MainTokenLogo")}`,children:t!=null&&t.logoUrl?C.jsx("img",{src:t==null?void 0:t.logoUrl,alt:"Token logo"}):null})]});function e8(){const{currentStep:e}=tn();return e?C.jsx(Gc,{footerLink:e.footerLink,footerText:e.footerText,title:e.title,body:e.hideTokens?void 0:C.jsx(c1,{inTokenOnly:e==null?void 0:e.inTokenOnly})}):null}const f1=({fromTitle:e,inUsd:t,inToken:r,toTitle:n,outUsd:s,outToken:a,inAmount:o,outAmount:i,SrcTokenLogo:c,DstTokenLogo:l})=>C.jsxs("div",{className:`${Le("Main")}`,children:[C.jsx(p1,{title:e||"Swap from",usd:t,token:r,amount:o,Logo:c}),C.jsx(p1,{title:n||"Swap to",usd:s,token:a,amount:i,Logo:l})]}),es=e=>C.jsx(R3,{...e,children:C.jsx(t8,{})}),t8=()=>{const{swapStatus:e,components:t,className:r}=tn();return C.jsx("div",{className:`${Le("SwapFlow")} ${r}`,children:e===pt.SUCCESS?t==null?void 0:t.Success:e===pt.FAILED?t==null?void 0:t.Failed:t==null?void 0:t.Main})};es.Success=X3,es.Failed=Y3,es.Main=J3,es.StepLayout=Gc;var Rs=(e=>(e.WRAP="wrap",e.APPROVE="approve",e.CREATE="create",e))(Rs||{});const r8="1.2.3";let Yt=class Lm extends Error{constructor(t,r={}){var o;const n=r.cause instanceof Lm?r.cause.details:(o=r.cause)!=null&&o.message?r.cause.message:r.details,s=r.cause instanceof Lm&&r.cause.docsPath||r.docsPath,a=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${r8}`].join(`
|
|
64
|
+
`,extractResults:d=>{var f;return(((f=d.data)==null?void 0:f.orderFilleds)||[]).map(m=>({...m,timestamp:new Date(m.timestamp).getTime()}))}})};class Ww extends Error{constructor(){super("No graph endpoint found"),this.name="NoGraphEndpointError"}}const qw=async({chainId:e,signal:t,page:r,limit:n,filters:s})=>{try{const a=await Gw({chainId:e,signal:t,page:r,limit:n,filters:s}),[o,i]=await Promise.all([Vw({chainId:e,orders:a,signal:t}),jw({chainId:e,orders:a,signal:t})]),c=a.map(u=>{const d=o==null?void 0:o.filter(f=>f.TWAP_id===Number(u.Contract_id)&&Ds(f.exchange,u.exchange)&&Ds(f.twapAddress,u.twapAddress));return Hw(u,e,d,Kw(u,d||[],i))}).sort((u,d)=>d.createdAt-u.createdAt),l=new Set;return c.filter(u=>l.has(u.id)?!1:(l.add(u.id),!0))}catch{return[]}},Kw=(e,t,r)=>{var i;const n=(i=r==null?void 0:r.find(c=>c.twapId===e.Contract_id.toString()&&Ds(c.twapAddress,e.twapAddress)))==null?void 0:i.status,a=Dh(t).reduce((c,l)=>c.plus(l.inAmount),new G(0)).toFixed(),o=Mh(e.ask_srcAmount,a);return Yw(o,e.ask_deadline*1e3,n)},Mh=(e,t)=>{if(!t||!e)return 0;const r=G(t).dividedBy(e).toNumber();return r>=.99?100:r<=0?0:Number((r*100).toFixed(2))},Yw=(e,t,r)=>e===100?ut.Completed:r==="CANCELED"?ut.Canceled:r==="COMPLETED"?ut.Completed:t>Date.now()?ut.Open:ut.Expired,Nh=async({signal:e,page:t,chainId:r,limit:n,config:s,account:a})=>(await Promise.all([s?qw({chainId:r,signal:e,page:t,limit:n,filters:{accounts:[a],configs:s.twapConfig?[s.twapConfig]:[]}}):Promise.resolve([]),zw({chainId:r,signal:e,account:a,exchange:s==null?void 0:s.adapter})]).then(([c,l])=>[...c,...l])).sort((c,l)=>l.createdAt-c.createdAt),Zw={version:"0.0.94"};var Ia=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Xw={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},Qw=(B5=class{constructor(){le(this,bn,Xw);le(this,ha,!1)}setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&N(this,ha)&&e!==N(this,bn)&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:N(this,bn),provider:e}),J(this,bn,e),process.env.NODE_ENV!=="production"&&J(this,ha,!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&J(this,ha,!0),N(this,bn).setTimeout(e,t)}clearTimeout(e){N(this,bn).clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&J(this,ha,!0),N(this,bn).setInterval(e,t)}clearInterval(e){N(this,bn).clearInterval(e)}},bn=new WeakMap,ha=new WeakMap,B5),Ns=new Qw;function Jw(e){setTimeout(e,0)}var Ls=typeof window>"u"||"Deno"in globalThis;function Gt(){}function e3(e,t){return typeof e=="function"?e(t):e}function Cd(e){return typeof e=="number"&&e>=0&&e!==1/0}function Lh(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Jn(e,t){return typeof e=="function"?e(t):e}function wr(e,t){return typeof e=="function"?e(t):e}function zh(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:a,queryKey:o,stale:i}=e;if(o){if(n){if(t.queryHash!==Td(o,t.options))return!1}else if(!Lo(t.queryKey,o))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||s&&s!==t.state.fetchStatus||a&&!a(t))}function Rh(e,t){const{exact:r,status:n,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(zs(t.options.mutationKey)!==zs(a))return!1}else if(!Lo(t.options.mutationKey,a))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function Td(e,t){return((t==null?void 0:t.queryKeyHashFn)||zs)(e)}function zs(e){return JSON.stringify(e,(t,r)=>Sd(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function Lo(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Lo(e[r],t[r])):!1}var t3=Object.prototype.hasOwnProperty;function Ad(e,t){if(e===t)return e;const r=Hh(e)&&Hh(t);if(!r&&!(Sd(e)&&Sd(t)))return t;const s=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,i=r?new Array(o):{};let c=0;for(let l=0;l<o;l++){const u=r?l:a[l],d=e[u],f=t[u];if(d===f){i[u]=d,(r?l<s:t3.call(e,u))&&c++;continue}if(d===null||f===null||typeof d!="object"||typeof f!="object"){i[u]=f;continue}const m=Ad(d,f);i[u]=m,m===d&&c++}return s===o&&c===s?e:i}function zc(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Hh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Sd(e){if(!$h(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!$h(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function $h(e){return Object.prototype.toString.call(e)==="[object Object]"}function r3(e){return new Promise(t=>{Ns.setTimeout(t,e)})}function Pd(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Ad(e,t)}catch(n){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${n}`),n}return Ad(e,t)}return t}function n3(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function s3(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Rc=Symbol();function Gh(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Rc&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Rc?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function jh(e,t){return typeof e=="function"?e(...t):!!e}var a3=(F5=class extends Ia{constructor(){super();le(this,ba);le(this,ks);le(this,ko);J(this,ko,t=>{if(!Ls&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){N(this,ks)||this.setEventListener(N(this,ko))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,ks))==null||t.call(this),J(this,ks,void 0))}setEventListener(t){var r;J(this,ko,t),(r=N(this,ks))==null||r.call(this),J(this,ks,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){N(this,ba)!==t&&(J(this,ba,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof N(this,ba)=="boolean"?N(this,ba):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ba=new WeakMap,ks=new WeakMap,ko=new WeakMap,F5),Id=new a3;function Bd(){let e,t;const r=new Promise((s,a)=>{e=s,t=a});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}var o3=Jw;function i3(){let e=[],t=0,r=i=>{i()},n=i=>{i()},s=o3;const a=i=>{t?e.push(i):s(()=>{r(i)})},o=()=>{const i=e;e=[],i.length&&s(()=>{n(()=>{i.forEach(c=>{r(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||o()}return c},batchCalls:i=>(...c)=>{a(()=>{i(...c)})},schedule:a,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{s=i}}}var kt=i3(),c3=(O5=class extends Ia{constructor(){super();le(this,Co,!0);le(this,Cs);le(this,To);J(this,To,t=>{if(!Ls&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){N(this,Cs)||this.setEventListener(N(this,To))}onUnsubscribe(){var t;this.hasListeners()||((t=N(this,Cs))==null||t.call(this),J(this,Cs,void 0))}setEventListener(t){var r;J(this,To,t),(r=N(this,Cs))==null||r.call(this),J(this,Cs,t(this.setOnline.bind(this)))}setOnline(t){N(this,Co)!==t&&(J(this,Co,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return N(this,Co)}},Co=new WeakMap,Cs=new WeakMap,To=new WeakMap,O5),Hc=new c3;function l3(e){return Math.min(1e3*2**e,3e4)}function Vh(e){return(e??"online")==="online"?Hc.isOnline():!0}var Fd=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Wh(e){let t=!1,r=0,n;const s=Bd(),a=()=>s.status!=="pending",o=g=>{var E;if(!a()){const v=new Fd(g);f(v),(E=e.onCancel)==null||E.call(e,v)}},i=()=>{t=!0},c=()=>{t=!1},l=()=>Id.isFocused()&&(e.networkMode==="always"||Hc.isOnline())&&e.canRun(),u=()=>Vh(e.networkMode)&&e.canRun(),d=g=>{a()||(n==null||n(),s.resolve(g))},f=g=>{a()||(n==null||n(),s.reject(g))},m=()=>new Promise(g=>{var E;n=v=>{(a()||l())&&g(v)},(E=e.onPause)==null||E.call(e)}).then(()=>{var g;n=void 0,a()||(g=e.onContinue)==null||g.call(e)}),b=()=>{if(a())return;let g;const E=r===0?e.initialPromise:void 0;try{g=E??e.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(d).catch(v=>{var L;if(a())return;const w=e.retry??(Ls?0:3),S=e.retryDelay??l3,T=typeof S=="function"?S(r,v):S,O=w===!0||typeof w=="number"&&r<w||typeof w=="function"&&w(r,v);if(t||!O){f(v);return}r++,(L=e.onFail)==null||L.call(e,r,v),r3(T).then(()=>l()?void 0:m()).then(()=>{t?f(v):b()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(n==null||n(),s),cancelRetry:i,continueRetry:c,canStart:u,start:()=>(u()?b():m().then(b),s)}}var qh=(U5=class{constructor(){le(this,ya)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Cd(this.gcTime)&&J(this,ya,Ns.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ls?1/0:300*1e3))}clearGcTimeout(){N(this,ya)&&(Ns.clearTimeout(N(this,ya)),J(this,ya,void 0))}},ya=new WeakMap,U5),u3=(D5=class extends qh{constructor(t){super();le(this,Xr);le(this,ga);le(this,Ao);le(this,Fr);le(this,xa);le(this,Bt);le(this,Pc);le(this,wa);J(this,wa,!1),J(this,Pc,t.defaultOptions),this.setOptions(t.options),this.observers=[],J(this,xa,t.client),J(this,Fr,N(this,xa).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,J(this,ga,Zh(this.options)),this.state=t.state??N(this,ga),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=N(this,Bt))==null?void 0:t.promise}setOptions(t){if(this.options={...N(this,Pc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=Zh(this.options);r.data!==void 0&&(this.setState(Yh(r.data,r.dataUpdatedAt)),J(this,ga,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&N(this,Fr).remove(this)}setData(t,r){const n=Pd(this.state.data,t,this.options);return Se(this,Xr,Zn).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t,r){Se(this,Xr,Zn).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var n,s;const r=(n=N(this,Bt))==null?void 0:n.promise;return(s=N(this,Bt))==null||s.cancel(t),r?r.then(Gt).catch(Gt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(N(this,ga))}isActive(){return this.observers.some(t=>wr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Rc||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Jn(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:!Lh(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,Bt))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=N(this,Bt))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),N(this,Fr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(N(this,Bt)&&(N(this,wa)?N(this,Bt).cancel({revert:!0}):N(this,Bt).cancelRetry()),this.scheduleGc()),N(this,Fr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Se(this,Xr,Zn).call(this,{type:"invalidate"})}async fetch(t,r){var c,l,u,d,f,m,b,g,E,v,w,S;if(this.state.fetchStatus!=="idle"&&((c=N(this,Bt))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(N(this,Bt))return N(this,Bt).continueRetry(),N(this,Bt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const T=this.observers.find(O=>O.options.queryFn);T&&this.setOptions(T.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const n=new AbortController,s=T=>{Object.defineProperty(T,"signal",{enumerable:!0,get:()=>(J(this,wa,!0),n.signal)})},a=()=>{const T=Gh(this.options,r),L=(()=>{const I={client:N(this,xa),queryKey:this.queryKey,meta:this.meta};return s(I),I})();return J(this,wa,!1),this.options.persister?this.options.persister(T,L,this):T(L)},i=(()=>{const T={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:N(this,xa),state:this.state,fetchFn:a};return s(T),T})();(l=this.options.behavior)==null||l.onFetch(i,this),J(this,Ao,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=i.fetchOptions)==null?void 0:u.meta))&&Se(this,Xr,Zn).call(this,{type:"fetch",meta:(d=i.fetchOptions)==null?void 0:d.meta}),J(this,Bt,Wh({initialPromise:r==null?void 0:r.initialPromise,fn:i.fetchFn,onCancel:T=>{T instanceof Fd&&T.revert&&this.setState({...N(this,Ao),fetchStatus:"idle"}),n.abort()},onFail:(T,O)=>{Se(this,Xr,Zn).call(this,{type:"failed",failureCount:T,error:O})},onPause:()=>{Se(this,Xr,Zn).call(this,{type:"pause"})},onContinue:()=>{Se(this,Xr,Zn).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0}));try{const T=await N(this,Bt).start();if(T===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(T),(m=(f=N(this,Fr).config).onSuccess)==null||m.call(f,T,this),(g=(b=N(this,Fr).config).onSettled)==null||g.call(b,T,this.state.error,this),T}catch(T){if(T instanceof Fd){if(T.silent)return N(this,Bt).promise;if(T.revert){if(this.state.data===void 0)throw T;return this.state.data}}throw Se(this,Xr,Zn).call(this,{type:"error",error:T}),(v=(E=N(this,Fr).config).onError)==null||v.call(E,T,this),(S=(w=N(this,Fr).config).onSettled)==null||S.call(w,this.state.data,T,this),T}finally{this.scheduleGc()}}},ga=new WeakMap,Ao=new WeakMap,Fr=new WeakMap,xa=new WeakMap,Bt=new WeakMap,Pc=new WeakMap,wa=new WeakMap,Xr=new WeakSet,Zn=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...Kh(n.data,this.options),fetchMeta:t.meta??null};case"success":const s={...n,...Yh(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return J(this,Ao,t.manual?s:void 0),s;case"error":const a=t.error;return{...n,error:a,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),kt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),N(this,Fr).notify({query:this,type:"updated",action:t})})},D5);function Kh(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vh(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Yh(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Zh(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var d3=(_5=class extends Ia{constructor(t,r){super();le(this,We);le(this,nr);le(this,_e);le(this,Ic);le(this,Wt);le(this,va);le(this,So);le(this,Vn);le(this,Ts);le(this,Bc);le(this,Po);le(this,Io);le(this,Ea);le(this,ka);le(this,As);le(this,Bo,new Set);this.options=r,J(this,nr,t),J(this,Ts,null),J(this,Vn,Bd()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(N(this,_e).addObserver(this),Xh(N(this,_e),this.options)?Se(this,We,Uc).call(this):this.updateResult(),Se(this,We,Um).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Od(N(this,_e),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Od(N(this,_e),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Se(this,We,Dm).call(this),Se(this,We,_m).call(this),N(this,_e).removeObserver(this)}setOptions(t){const r=this.options,n=N(this,_e);if(this.options=N(this,nr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof wr(this.options.enabled,N(this,_e))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Se(this,We,Mm).call(this),N(this,_e).setOptions(this.options),r._defaulted&&!zc(this.options,r)&&N(this,nr).getQueryCache().notify({type:"observerOptionsUpdated",query:N(this,_e),observer:this});const s=this.hasListeners();s&&Qh(N(this,_e),n,this.options,r)&&Se(this,We,Uc).call(this),this.updateResult(),s&&(N(this,_e)!==n||wr(this.options.enabled,N(this,_e))!==wr(r.enabled,N(this,_e))||Jn(this.options.staleTime,N(this,_e))!==Jn(r.staleTime,N(this,_e)))&&Se(this,We,Bm).call(this);const a=Se(this,We,Fm).call(this);s&&(N(this,_e)!==n||wr(this.options.enabled,N(this,_e))!==wr(r.enabled,N(this,_e))||a!==N(this,As))&&Se(this,We,Om).call(this,a)}getOptimisticResult(t){const r=N(this,nr).getQueryCache().build(N(this,nr),t),n=this.createResult(r,t);return f3(this,n)&&(J(this,Wt,n),J(this,So,this.options),J(this,va,N(this,_e).state)),n}getCurrentResult(){return N(this,Wt)}trackResult(t,r){return new Proxy(t,{get:(n,s)=>(this.trackProp(s),r==null||r(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&N(this,Vn).status==="pending"&&N(this,Vn).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,s))})}trackProp(t){N(this,Bo).add(t)}getCurrentQuery(){return N(this,_e)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=N(this,nr).defaultQueryOptions(t),n=N(this,nr).getQueryCache().build(N(this,nr),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return Se(this,We,Uc).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),N(this,Wt)))}createResult(t,r){var y;const n=N(this,_e),s=this.options,a=N(this,Wt),o=N(this,va),i=N(this,So),l=t!==n?t.state:N(this,Ic),{state:u}=t;let d={...u},f=!1,m;if(r._optimisticResults){const x=this.hasListeners(),A=!x&&Xh(t,r),B=x&&Qh(t,n,r,s);(A||B)&&(d={...d,...Kh(u.data,t.options)}),r._optimisticResults==="isRestoring"&&(d.fetchStatus="idle")}let{error:b,errorUpdatedAt:g,status:E}=d;m=d.data;let v=!1;if(r.placeholderData!==void 0&&m===void 0&&E==="pending"){let x;a!=null&&a.isPlaceholderData&&r.placeholderData===(i==null?void 0:i.placeholderData)?(x=a.data,v=!0):x=typeof r.placeholderData=="function"?r.placeholderData((y=N(this,Io))==null?void 0:y.state.data,N(this,Io)):r.placeholderData,x!==void 0&&(E="success",m=Pd(a==null?void 0:a.data,x,r),f=!0)}if(r.select&&m!==void 0&&!v)if(a&&m===(o==null?void 0:o.data)&&r.select===N(this,Bc))m=N(this,Po);else try{J(this,Bc,r.select),m=r.select(m),m=Pd(a==null?void 0:a.data,m,r),J(this,Po,m),J(this,Ts,null)}catch(x){J(this,Ts,x)}N(this,Ts)&&(b=N(this,Ts),m=N(this,Po),g=Date.now(),E="error");const w=d.fetchStatus==="fetching",S=E==="pending",T=E==="error",O=S&&w,L=m!==void 0,h={status:E,fetchStatus:d.fetchStatus,isPending:S,isSuccess:E==="success",isError:T,isInitialLoading:O,isLoading:O,data:m,dataUpdatedAt:d.dataUpdatedAt,error:b,errorUpdatedAt:g,failureCount:d.fetchFailureCount,failureReason:d.fetchFailureReason,errorUpdateCount:d.errorUpdateCount,isFetched:d.dataUpdateCount>0||d.errorUpdateCount>0,isFetchedAfterMount:d.dataUpdateCount>l.dataUpdateCount||d.errorUpdateCount>l.errorUpdateCount,isFetching:w,isRefetching:w&&!S,isLoadingError:T&&!L,isPaused:d.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:T&&L,isStale:Ud(t,r),refetch:this.refetch,promise:N(this,Vn),isEnabled:wr(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const x=F=>{h.status==="error"?F.reject(h.error):h.data!==void 0&&F.resolve(h.data)},A=()=>{const F=J(this,Vn,h.promise=Bd());x(F)},B=N(this,Vn);switch(B.status){case"pending":t.queryHash===n.queryHash&&x(B);break;case"fulfilled":(h.status==="error"||h.data!==B.value)&&A();break;case"rejected":(h.status!=="error"||h.error!==B.reason)&&A();break}}return h}updateResult(){const t=N(this,Wt),r=this.createResult(N(this,_e),this.options);if(J(this,va,N(this,_e).state),J(this,So,this.options),N(this,va).data!==void 0&&J(this,Io,N(this,_e)),zc(r,t))return;J(this,Wt,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!N(this,Bo).size)return!0;const o=new Set(a??N(this,Bo));return this.options.throwOnError&&o.add("error"),Object.keys(N(this,Wt)).some(i=>{const c=i;return N(this,Wt)[c]!==t[c]&&o.has(c)})};Se(this,We,K5).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Se(this,We,Um).call(this)}},nr=new WeakMap,_e=new WeakMap,Ic=new WeakMap,Wt=new WeakMap,va=new WeakMap,So=new WeakMap,Vn=new WeakMap,Ts=new WeakMap,Bc=new WeakMap,Po=new WeakMap,Io=new WeakMap,Ea=new WeakMap,ka=new WeakMap,As=new WeakMap,Bo=new WeakMap,We=new WeakSet,Uc=function(t){Se(this,We,Mm).call(this);let r=N(this,_e).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Gt)),r},Bm=function(){Se(this,We,Dm).call(this);const t=Jn(this.options.staleTime,N(this,_e));if(Ls||N(this,Wt).isStale||!Cd(t))return;const n=Lh(N(this,Wt).dataUpdatedAt,t)+1;J(this,Ea,Ns.setTimeout(()=>{N(this,Wt).isStale||this.updateResult()},n))},Fm=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(N(this,_e)):this.options.refetchInterval)??!1},Om=function(t){Se(this,We,_m).call(this),J(this,As,t),!(Ls||wr(this.options.enabled,N(this,_e))===!1||!Cd(N(this,As))||N(this,As)===0)&&J(this,ka,Ns.setInterval(()=>{(this.options.refetchIntervalInBackground||Id.isFocused())&&Se(this,We,Uc).call(this)},N(this,As)))},Um=function(){Se(this,We,Bm).call(this),Se(this,We,Om).call(this,Se(this,We,Fm).call(this))},Dm=function(){N(this,Ea)&&(Ns.clearTimeout(N(this,Ea)),J(this,Ea,void 0))},_m=function(){N(this,ka)&&(Ns.clearInterval(N(this,ka)),J(this,ka,void 0))},Mm=function(){const t=N(this,nr).getQueryCache().build(N(this,nr),this.options);if(t===N(this,_e))return;const r=N(this,_e);J(this,_e,t),J(this,Ic,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},K5=function(t){kt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(N(this,Wt))}),N(this,nr).getQueryCache().notify({query:N(this,_e),type:"observerResultsUpdated"})})},_5);function p3(e,t){return wr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Xh(e,t){return p3(e,t)||e.state.data!==void 0&&Od(e,t,t.refetchOnMount)}function Od(e,t,r){if(wr(t.enabled,e)!==!1&&Jn(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Ud(e,t)}return!1}function Qh(e,t,r,n){return(e!==t||wr(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Ud(e,r)}function Ud(e,t){return wr(t.enabled,e)!==!1&&e.isStaleByTime(Jn(t.staleTime,e))}function f3(e,t){return!zc(e.getCurrentResult(),t)}function Jh(e){return{onFetch:(t,r)=>{var u,d,f,m,b;const n=t.options,s=(f=(d=(u=t.fetchOptions)==null?void 0:u.meta)==null?void 0:d.fetchMore)==null?void 0:f.direction,a=((m=t.state.data)==null?void 0:m.pages)||[],o=((b=t.state.data)==null?void 0:b.pageParams)||[];let i={pages:[],pageParams:[]},c=0;const l=async()=>{let g=!1;const E=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?g=!0:t.signal.addEventListener("abort",()=>{g=!0}),t.signal)})},v=Gh(t.options,t.fetchOptions),w=async(S,T,O)=>{if(g)return Promise.reject();if(T==null&&S.pages.length)return Promise.resolve(S);const I=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:T,direction:O?"backward":"forward",meta:t.options.meta};return E(A),A})(),h=await v(I),{maxPages:y}=t.options,x=O?s3:n3;return{pages:x(S.pages,h,y),pageParams:x(S.pageParams,T,y)}};if(s&&a.length){const S=s==="backward",T=S?m3:e1,O={pages:a,pageParams:o},L=T(n,O);i=await w(O,L,S)}else{const S=e??a.length;do{const T=c===0?o[0]??n.initialPageParam:e1(n,i);if(c>0&&T==null)break;i=await w(i,T),c++}while(c<S)}return i};t.options.persister?t.fetchFn=()=>{var g,E;return(E=(g=t.options).persister)==null?void 0:E.call(g,l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=l}}}function e1(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function m3(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var h3=(M5=class extends qh{constructor(t){super();le(this,gn);le(this,Fc);le(this,yn);le(this,qt);le(this,Ca);J(this,Fc,t.client),this.mutationId=t.mutationId,J(this,qt,t.mutationCache),J(this,yn,[]),this.state=t.state||t1(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){N(this,yn).includes(t)||(N(this,yn).push(t),this.clearGcTimeout(),N(this,qt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){J(this,yn,N(this,yn).filter(r=>r!==t)),this.scheduleGc(),N(this,qt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){N(this,yn).length||(this.state.status==="pending"?this.scheduleGc():N(this,qt).remove(this))}continue(){var t;return((t=N(this,Ca))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,c,l,u,d,f,m,b,g,E,v,w,S,T,O,L,I,h,y;const r=()=>{Se(this,gn,Fs).call(this,{type:"continue"})},n={client:N(this,Fc),meta:this.options.meta,mutationKey:this.options.mutationKey};J(this,Ca,Wh({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(x,A)=>{Se(this,gn,Fs).call(this,{type:"failed",failureCount:x,error:A})},onPause:()=>{Se(this,gn,Fs).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>N(this,qt).canRun(this)}));const s=this.state.status==="pending",a=!N(this,Ca).canStart();try{if(s)r();else{Se(this,gn,Fs).call(this,{type:"pending",variables:t,isPaused:a}),await((i=(o=N(this,qt).config).onMutate)==null?void 0:i.call(o,t,this,n));const A=await((l=(c=this.options).onMutate)==null?void 0:l.call(c,t,n));A!==this.state.context&&Se(this,gn,Fs).call(this,{type:"pending",context:A,variables:t,isPaused:a})}const x=await N(this,Ca).start();return await((d=(u=N(this,qt).config).onSuccess)==null?void 0:d.call(u,x,t,this.state.context,this,n)),await((m=(f=this.options).onSuccess)==null?void 0:m.call(f,x,t,this.state.context,n)),await((g=(b=N(this,qt).config).onSettled)==null?void 0:g.call(b,x,null,this.state.variables,this.state.context,this,n)),await((v=(E=this.options).onSettled)==null?void 0:v.call(E,x,null,t,this.state.context,n)),Se(this,gn,Fs).call(this,{type:"success",data:x}),x}catch(x){try{throw await((S=(w=N(this,qt).config).onError)==null?void 0:S.call(w,x,t,this.state.context,this,n)),await((O=(T=this.options).onError)==null?void 0:O.call(T,x,t,this.state.context,n)),await((I=(L=N(this,qt).config).onSettled)==null?void 0:I.call(L,void 0,x,this.state.variables,this.state.context,this,n)),await((y=(h=this.options).onSettled)==null?void 0:y.call(h,void 0,x,t,this.state.context,n)),x}finally{Se(this,gn,Fs).call(this,{type:"error",error:x})}}finally{N(this,qt).runNext(this)}}},Fc=new WeakMap,yn=new WeakMap,qt=new WeakMap,Ca=new WeakMap,gn=new WeakSet,Fs=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,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{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),kt.batch(()=>{N(this,yn).forEach(n=>{n.onMutationUpdate(t)}),N(this,qt).notify({mutation:this,type:"updated",action:t})})},M5);function t1(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var b3=(N5=class extends Ia{constructor(t={}){super();le(this,Wn);le(this,Qr);le(this,Oc);this.config=t,J(this,Wn,new Set),J(this,Qr,new Map),J(this,Oc,0)}build(t,r,n){const s=new h3({client:t,mutationCache:this,mutationId:++rd(this,Oc)._,options:t.defaultMutationOptions(r),state:n});return this.add(s),s}add(t){N(this,Wn).add(t);const r=$c(t);if(typeof r=="string"){const n=N(this,Qr).get(r);n?n.push(t):N(this,Qr).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(N(this,Wn).delete(t)){const r=$c(t);if(typeof r=="string"){const n=N(this,Qr).get(r);if(n)if(n.length>1){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}else n[0]===t&&N(this,Qr).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=$c(t);if(typeof r=="string"){const n=N(this,Qr).get(r),s=n==null?void 0:n.find(a=>a.state.status==="pending");return!s||s===t}else return!0}runNext(t){var n;const r=$c(t);if(typeof r=="string"){const s=(n=N(this,Qr).get(r))==null?void 0:n.find(a=>a!==t&&a.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){kt.batch(()=>{N(this,Wn).forEach(t=>{this.notify({type:"removed",mutation:t})}),N(this,Wn).clear(),N(this,Qr).clear()})}getAll(){return Array.from(N(this,Wn))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Rh(r,n))}findAll(t={}){return this.getAll().filter(r=>Rh(t,r))}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return kt.batch(()=>Promise.all(t.map(r=>r.continue().catch(Gt))))}},Wn=new WeakMap,Qr=new WeakMap,Oc=new WeakMap,N5);function $c(e){var t;return(t=e.options.scope)==null?void 0:t.id}var y3=(L5=class extends Ia{constructor(t,r){super();le(this,Yn);le(this,qn);le(this,Ss);le(this,sr);le(this,Kn);J(this,qn,t),this.setOptions(r),this.bindMethods(),Se(this,Yn,nd).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var n;const r=this.options;this.options=N(this,qn).defaultMutationOptions(t),zc(this.options,r)||N(this,qn).getMutationCache().notify({type:"observerOptionsUpdated",mutation:N(this,sr),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&zs(r.mutationKey)!==zs(this.options.mutationKey)?this.reset():((n=N(this,sr))==null?void 0:n.state.status)==="pending"&&N(this,sr).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=N(this,sr))==null||t.removeObserver(this)}onMutationUpdate(t){Se(this,Yn,nd).call(this),Se(this,Yn,Nm).call(this,t)}getCurrentResult(){return N(this,Ss)}reset(){var t;(t=N(this,sr))==null||t.removeObserver(this),J(this,sr,void 0),Se(this,Yn,nd).call(this),Se(this,Yn,Nm).call(this)}mutate(t,r){var n;return J(this,Kn,r),(n=N(this,sr))==null||n.removeObserver(this),J(this,sr,N(this,qn).getMutationCache().build(N(this,qn),this.options)),N(this,sr).addObserver(this),N(this,sr).execute(t)}},qn=new WeakMap,Ss=new WeakMap,sr=new WeakMap,Kn=new WeakMap,Yn=new WeakSet,nd=function(){var r;const t=((r=N(this,sr))==null?void 0:r.state)??t1();J(this,Ss,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Nm=function(t){kt.batch(()=>{var r,n,s,a,o,i,c,l;if(N(this,Kn)&&this.hasListeners()){const u=N(this,Ss).variables,d=N(this,Ss).context,f={client:N(this,qn),meta:this.options.meta,mutationKey:this.options.mutationKey};(t==null?void 0:t.type)==="success"?((n=(r=N(this,Kn)).onSuccess)==null||n.call(r,t.data,u,d,f),(a=(s=N(this,Kn)).onSettled)==null||a.call(s,t.data,null,u,d,f)):(t==null?void 0:t.type)==="error"&&((i=(o=N(this,Kn)).onError)==null||i.call(o,t.error,u,d,f),(l=(c=N(this,Kn)).onSettled)==null||l.call(c,void 0,t.error,u,d,f))}this.listeners.forEach(u=>{u(N(this,Ss))})})},L5),g3=(z5=class extends Ia{constructor(t={}){super();le(this,xn);this.config=t,J(this,xn,new Map)}build(t,r,n){const s=r.queryKey,a=r.queryHash??Td(s,r);let o=this.get(a);return o||(o=new u3({client:t,queryKey:s,queryHash:a,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){N(this,xn).has(t.queryHash)||(N(this,xn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=N(this,xn).get(t.queryHash);r&&(t.destroy(),r===t&&N(this,xn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){kt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return N(this,xn).get(t)}getAll(){return[...N(this,xn).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>zh(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>zh(t,n)):r}notify(t){kt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){kt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){kt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},xn=new WeakMap,z5),x3=(R5=class{constructor(e={}){le(this,mt);le(this,Ps);le(this,Is);le(this,Fo);le(this,Oo);le(this,Bs);le(this,Uo);le(this,Do);J(this,mt,e.queryCache||new g3),J(this,Ps,e.mutationCache||new b3),J(this,Is,e.defaultOptions||{}),J(this,Fo,new Map),J(this,Oo,new Map),J(this,Bs,0)}mount(){rd(this,Bs)._++,N(this,Bs)===1&&(J(this,Uo,Id.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,mt).onFocus())})),J(this,Do,Hc.subscribe(async e=>{e&&(await this.resumePausedMutations(),N(this,mt).onOnline())})))}unmount(){var e,t;rd(this,Bs)._--,N(this,Bs)===0&&((e=N(this,Uo))==null||e.call(this),J(this,Uo,void 0),(t=N(this,Do))==null||t.call(this),J(this,Do,void 0))}isFetching(e){return N(this,mt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return N(this,Ps).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,mt).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=N(this,mt).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Jn(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return N(this,mt).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),s=N(this,mt).get(n.queryHash),a=s==null?void 0:s.state.data,o=e3(t,a);if(o!==void 0)return N(this,mt).build(this,n).setData(o,{...r,manual:!0})}setQueriesData(e,t,r){return kt.batch(()=>N(this,mt).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=N(this,mt).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=N(this,mt);kt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=N(this,mt);return kt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=kt.batch(()=>N(this,mt).findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Gt).catch(Gt)}invalidateQueries(e,t={}){return kt.batch(()=>(N(this,mt).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=kt.batch(()=>N(this,mt).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,r);return r.throwOnError||(a=a.catch(Gt)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(Gt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=N(this,mt).build(this,t);return r.isStaleByTime(Jn(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Gt).catch(Gt)}fetchInfiniteQuery(e){return e.behavior=Jh(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Gt).catch(Gt)}ensureInfiniteQueryData(e){return e.behavior=Jh(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Hc.isOnline()?N(this,Ps).resumePausedMutations():Promise.resolve()}getQueryCache(){return N(this,mt)}getMutationCache(){return N(this,Ps)}getDefaultOptions(){return N(this,Is)}setDefaultOptions(e){J(this,Is,e)}setQueryDefaults(e,t){N(this,Fo).set(zs(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...N(this,Fo).values()],r={};return t.forEach(n=>{Lo(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){N(this,Oo).set(zs(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...N(this,Oo).values()],r={};return t.forEach(n=>{Lo(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...N(this,Is).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Td(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===Rc&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...N(this,Is).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){N(this,mt).clear(),N(this,Ps).clear()}},mt=new WeakMap,Ps=new WeakMap,Is=new WeakMap,Fo=new WeakMap,Oo=new WeakMap,Bs=new WeakMap,Uo=new WeakMap,Do=new WeakMap,R5),r1=Et.createContext(void 0),Dd=e=>{const t=Et.useContext(r1);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},w3=({client:e,children:t})=>(Et.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),C.jsx(r1.Provider,{value:e,children:t})),n1=Et.createContext(!1),v3=()=>Et.useContext(n1);n1.Provider;function E3(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var k3=Et.createContext(E3()),C3=()=>Et.useContext(k3),T3=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},A3=e=>{Et.useEffect(()=>{e.clearReset()},[e])},S3=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||jh(r,[e.error,n])),P3=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>r(n(...s)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},I3=(e,t)=>e.isLoading&&e.isFetching&&!t,B3=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,s1=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function F3(e,t,r){var d,f,m,b,g;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const n=v3(),s=C3(),a=Dd(),o=a.defaultQueryOptions(e);(f=(d=a.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||f.call(d,o),process.env.NODE_ENV!=="production"&&(o.queryFn||console.error(`[${o.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),o._optimisticResults=n?"isRestoring":"optimistic",P3(o),T3(o,s),A3(s);const i=!a.getQueryCache().get(o.queryHash),[c]=Et.useState(()=>new t(a,o)),l=c.getOptimisticResult(o),u=!n&&e.subscribed!==!1;if(Et.useSyncExternalStore(Et.useCallback(E=>{const v=u?c.subscribe(kt.batchCalls(E)):Gt;return c.updateResult(),v},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),Et.useEffect(()=>{c.setOptions(o)},[o,c]),B3(o,l))throw s1(o,c,s);if(S3({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:a.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw l.error;if((b=(m=a.getDefaultOptions().queries)==null?void 0:m._experimental_afterQuery)==null||b.call(m,o,l),o.experimental_prefetchInRender&&!Ls&&I3(l,n)){const E=i?s1(o,c,s):(g=a.getQueryCache().get(o.queryHash))==null?void 0:g.promise;E==null||E.catch(Gt).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?l:c.trackResult(l)}function O3(e,t){return F3(e,d3)}function en(e,t){const r=Dd(),[n]=Et.useState(()=>new y3(r,e));Et.useEffect(()=>{n.setOptions(e)},[n,e]);const s=Et.useSyncExternalStore(Et.useCallback(o=>n.subscribe(kt.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=Et.useCallback((o,i)=>{n.mutate(o,i).catch(Gt)},[n]);if(s.error&&jh(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}const U3=M.createContext(null),_d={didCatch:!1,error:null};class D3 extends M.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=_d}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var r,n,s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:a,reason:"imperative-api"}),this.setState(_d)}}componentDidCatch(t,r){var n,s;(n=(s=this.props).onError)===null||n===void 0||n.call(s,t,r)}componentDidUpdate(t,r){const{didCatch:n}=this.state,{resetKeys:s}=this.props;if(n&&r.error!==null&&_3(t.resetKeys,s)){var a,o;(a=(o=this.props).onReset)===null||a===void 0||a.call(o,{next:s,prev:t.resetKeys,reason:"keys"}),this.setState(_d)}}render(){const{children:t,fallbackRender:r,FallbackComponent:n,fallback:s}=this.props,{didCatch:a,error:o}=this.state;let i=t;if(a){const c={error:o,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")i=r(c);else if(n)i=M.createElement(n,c);else if(s!==void 0)i=s;else throw o}return M.createElement(U3.Provider,{value:{didCatch:a,error:o,resetErrorBoundary:this.resetErrorBoundary}},i)}}function _3(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((r,n)=>!Object.is(r,t[n]))}const a1=e=>{let t;const r=new Set,n=(l,u)=>{const d=typeof l=="function"?l(t):l;if(!Object.is(d,t)){const f=t;t=u??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(m=>m(t,f))}},s=()=>t,i={setState:n,getState:s,getInitialState:()=>c,subscribe:l=>(r.add(l),()=>r.delete(l))},c=t=e(n,s,i);return i},M3=(e=>e?a1(e):a1),N3=e=>e;function L3(e,t=N3){const r=M.useSyncExternalStore(e.subscribe,M.useCallback(()=>t(e.getState()),[e,t]),M.useCallback(()=>t(e.getInitialState()),[e,t]));return M.useDebugValue(r),r}const o1=e=>{const t=M3(e),r=n=>L3(t,n);return Object.assign(r,t),r},z3=(e=>e?o1(e):o1),Md={disclaimerAccepted:!0,currentTime:Date.now(),swapExecution:{}},ee=z3((e,t)=>({state:Md,updateState:r=>e(n=>({state:{...n.state,...r}})),updateSwapExecution:r=>e(n=>({state:{...n.state,swapExecution:{...n.state.swapExecution,...r}}})),resetSwapExecution:r=>e(n=>({state:{...n.state,swapExecution:{...Md.swapExecution,...r}}})),resetState:()=>{e({state:{...Md,currentTime:Date.now(),swapExecution:{...t().state.swapExecution,acceptedMarketPrice:void 0,acceptedSrcAmount:void 0},isMarketOrder:t().state.isMarketOrder}}),setTimeout(()=>{t().resetSwapExecution()},1e3)}}));(function(){try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".orbs_OrbsLogo{object-fit:contain;display:inline}.orbs_PoweredBy{border-radius:8px;margin-left:auto;margin-right:auto}.orbs_PoweredBy a{display:flex;align-items:center;justify-content:center;text-decoration:none;color:inherit}.orbs_PoweredBy span{font-size:14px}.orbs_PoweredBy .orbs_OrbsLogo{margin-left:6px;margin-right:6px;width:18px;height:18px}.orbs_Text{margin:0;padding:0}.orbs_Spinner{width:var(--size, 38px);height:var(--size, 38px);border:var(--border-width, 3px) solid var(--border-color, white);border-bottom-color:var(--bottom-border-color, rgba(255, 255, 255, .2));border-radius:50%;display:inline-block;box-sizing:border-box;animation:orbs_rotation 1s linear infinite}@keyframes orbs_rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.orbs_TradeStepLayout{--layout-min-height: 220px;--layout-width: 100%;--layout-display: flex;--layout-direction: column;--layout-align: center;--layout-overflow: visible;display:var(--layout-display);flex-direction:var(--layout-direction);align-items:var(--layout-align);width:var(--layout-width);min-height:var(--layout-min-height);overflow:var(--layout-overflow)}.orbs_TradeStepLayoutBody{--body-gap: 20px;--body-margin-top: 30px;--body-width: 100%;--body-display: flex;--body-direction: column;--body-align: center;--body-overflow: visible;gap:var(--body-gap);align-items:var(--body-align);display:var(--body-display);flex-direction:var(--body-direction);width:var(--body-width);margin-top:var(--body-margin-top);overflow:var(--body-overflow)}.orbs_TradeStepLayoutHeader{--header-gap: 30px;--header-display: flex;--header-direction: column;--header-align: center;--header-justify: center;--header-overflow: visible;display:var(--header-display);flex-direction:var(--header-direction);align-items:var(--header-align);justify-content:var(--header-justify);gap:var(--header-gap);overflow:var(--header-overflow)}.orbs_TradeStepLayoutTitle{--title-font-size: 18px;--title-font-weight: 500;--title-line-height: normal;--title-color: inherit;--title-text-align: center;--title-margin: 0;--title-padding: 0;font-size:var(--title-font-size);font-weight:var(--title-font-weight);line-height:var(--title-line-height);color:var(--title-color);text-align:var(--title-text-align);margin:var(--title-margin);padding:var(--title-padding)}.orbs_StepIndicator{--indicator-display: flex;--indicator-align: center;--indicator-justify: flex-start;--indicator-height: 7px;--indicator-width: 120px;--indicator-border-radius: 999px;--indicator-bg-color: white;--indicator-margin-bottom: 20px;--indicator-position: relative;--indicator-overflow: hidden;--indicator-border: none;--indicator-box-shadow: none;display:var(--indicator-display);align-items:var(--indicator-align);justify-content:var(--indicator-justify);height:var(--indicator-height);width:var(--indicator-width);border-radius:var(--indicator-border-radius);overflow:var(--indicator-overflow);background-color:var(--indicator-bg-color);margin-bottom:var(--indicator-margin-bottom);position:var(--indicator-position);border:var(--indicator-border);box-shadow:var(--indicator-box-shadow)}.orbs_StepIndicatorLine{--line-height: 100%;--line-bg-color: black;--line-position: absolute;--line-top: 0;--line-left: 0;--line-right: 0;--line-bottom: 0;--line-transition: all .3s ease;--line-border-radius: inherit;--line-box-shadow: none;height:var(--line-height);background-color:var(--line-bg-color);position:var(--line-position);top:var(--line-top);left:var(--line-left);right:var(--line-right);bottom:var(--line-bottom);transition:var(--line-transition);border-radius:var(--line-border-radius);box-shadow:var(--line-box-shadow)}.orbs_TradeStepLayoutFooter{--footer-display: flex;--footer-align: center;--footer-justify: center;--footer-direction: column;--footer-margin-top: auto;--footer-padding-top: 30px;--footer-width: 100%;--footer-overflow: visible;--footer-border-top: none;display:var(--footer-display);align-items:var(--footer-align);justify-content:var(--footer-justify);flex-direction:var(--footer-direction);margin-top:var(--footer-margin-top);padding-top:var(--footer-padding-top);width:var(--footer-width);overflow:var(--footer-overflow);border-top:var(--footer-border-top)}.orbs_TradeStepLayoutFooter p{--footer-text-font-size: 15px;--footer-text-line-height: normal;--footer-text-color: inherit;--footer-text-margin: 0;--footer-text-padding: 0;font-size:var(--footer-text-font-size);line-height:var(--footer-text-line-height);color:var(--footer-text-color);margin:var(--footer-text-margin);padding:var(--footer-text-padding)}.orbs_TradeStepLayoutFooterLink{--link-color: inherit;--link-text-decoration: none;--link-font-size: 15px;--link-text-align: center;--link-margin: auto;--link-outline: none;--link-line-height: normal;--link-padding: 0;--link-transition: color .2s ease;--link-hover-color: inherit;--link-hover-text-decoration: underline;color:var(--link-color);text-decoration:var(--link-text-decoration);font-size:var(--link-font-size);text-align:var(--link-text-align);margin-left:var(--link-margin);margin-right:var(--link-margin);outline:var(--link-outline);line-height:var(--link-line-height);padding:var(--link-padding);transition:var(--link-transition)}.orbs_TradeStepLayoutFooterLink:hover{color:var(--link-hover-color);text-decoration:var(--link-hover-text-decoration)}.orbs_TradeStepLayoutSuccessIcon{--success-icon-display: flex;--success-icon-justify: center;--success-icon-align: center;--success-icon-width: 60px;--success-icon-height: 60px;--success-icon-border-radius: 50%;--success-icon-overflow: visible;--success-icon-bg-color: transparent;--success-icon-border: none;--success-icon-box-shadow: none;display:var(--success-icon-display);justify-content:var(--success-icon-justify);align-items:var(--success-icon-align);width:var(--success-icon-width);height:var(--success-icon-height);border-radius:var(--success-icon-border-radius);overflow:var(--success-icon-overflow);background-color:var(--success-icon-bg-color);border:var(--success-icon-border);box-shadow:var(--success-icon-box-shadow)}.orbs_TradeStepLayoutErrorIcon{--error-icon-width: 80px;--error-icon-height: 80px;--error-icon-display: flex;--error-icon-justify: center;--error-icon-align: center;--error-icon-overflow: visible;--error-icon-bg-color: transparent;--error-icon-border: none;--error-icon-box-shadow: none;width:var(--error-icon-width);height:var(--error-icon-height);display:var(--error-icon-display);justify-content:var(--error-icon-justify);align-items:var(--error-icon-align);overflow:var(--error-icon-overflow);background-color:var(--error-icon-bg-color);border:var(--error-icon-border);box-shadow:var(--error-icon-box-shadow)}.orbs_FailedContentMsg{font-size:22px;font-weight:500}.orbs_TradePreview{display:flex;align-items:center;justify-content:center;gap:8px;width:100%}.orbs_TradePreviewToken{display:flex;align-items:center;gap:6px;max-width:calc(50% - 30px)}.orbs_TradePreviewToken p{--token-font-size: 15px;--token-white-space: nowrap;--token-overflow: hidden;--token-text-overflow: ellipsis;--token-flex: 1;--token-margin: 0;--token-padding: 0;font-size:var(--token-font-size);white-space:var(--token-white-space);overflow:var(--token-overflow);text-overflow:var(--token-text-overflow);flex:var(--token-flex);margin:var(--token-margin)}.orbs_TradepPreviewIcon{width:22px;height:22px}.orbs_TradepPreviewLogo{width:24px;height:24px;border-radius:50%;overflow:hidden}.orbs_FlexRow{display:flex;flex-direction:row}.orbs_FlexColumn{display:flex;flex-direction:column}@keyframes orbs_skeletonAnimation{0%{opacity:.2}to{opacity:.4}}.orbs_SkeletonLoader{animation:orbs_skeletonAnimation 1s linear infinite alternate;background-color:#fff}.orbs_Main-wrapper{width:100%}.orbs_Main{width:100%;display:flex;flex-direction:column;gap:28px}.orbs_MainToken{display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%;gap:8px}.orbs_MainTokenLeft{display:flex;flex-direction:column;align-items:flex-start;gap:8px}.orbs_MainTokenUsd{display:flex;align-items:center;gap:5px}.orbs_MainTokenUsd small{font-size:12px;opacity:.6}.orbs_MainContentLoader{width:100%;display:flex;gap:15px;align-items:center;margin-top:20px}.orbs_MainContentRectengularLoader{flex:1;height:20px;max-width:250px;border-radius:20px}.orbs_MainContentCircleLoader{width:30px;height:30px;border-radius:50%}.orbs_MainTokenLogo{--width: 40px;--height: 40px;width:var(--width);height:var(--height)}.orbs_MainTokenLogo img{width:100%;height:100%;object-fit:cover}.orbs_SwapFlow{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%}.orbs_SwapFlow *{box-sizing:border-box}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();const Le=e=>`orbs_${e}`;function zo({children:e,className:t=""}){return C.jsx("p",{className:`${t} ${Le("Text")}`,children:e})}const i1=M.createContext({});function R3({children:e,...t}){return C.jsx(i1.Provider,{value:t,children:e})}const tn=()=>M.useContext(i1);var pt=(e=>(e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILED=3]="FAILED",e))(pt||{});const H3=({className:e="",size:t=38,borderWidth:r=3,borderColor:n="white",bottomBorderColor:s="rgba(255, 255, 255, 0.2)"})=>{const a={"--size":`${t}px`,"--border-width":`${r}px`,"--border-color":n,"--bottom-border-color":s};return C.jsx("div",{className:`${Le("Spinner")} ${e}`,style:a})};function Gc({className:e="",body:t,footerLink:r,footerText:n,title:s,children:a}){return C.jsxs("div",{className:`${Le("TradeStepLayout")} ${e}`,children:[C.jsxs("div",{className:Le("TradeStepLayoutHeader"),children:[C.jsx(W3,{}),s&&C.jsx(zo,{className:Le("TradeStepLayoutTitle"),children:s})]}),t&&C.jsx("div",{className:Le("TradeStepLayoutBody"),children:t}),C.jsx($3,{link:r,text:n}),a]})}const $3=({link:e,text:t})=>{const{swapStatus:r}=tn();return!e&&!t?null:C.jsxs("div",{className:Le("TradeStepLayoutFooter"),children:[C.jsx(K3,{}),e?C.jsx(G3,{link:e,text:t}):r===pt.FAILED?void 0:C.jsx(zo,{children:t})]})},G3=({link:e,text:t})=>C.jsx("a",{target:"_blank",className:Le("TradeStepLayoutFooterLink"),href:e,children:t});function j3(){const{components:e}=tn();return e.SuccessIcon?e.SuccessIcon:C.jsxs("svg",{fill:"none",viewBox:"0 0 16 16",className:Le("TradeStepLayoutSuccessIcon"),children:[C.jsx("circle",{cx:"8",cy:"8",r:"7",strokeWidth:"1.5",stroke:"#00C853"}),C.jsx("path",{strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"#00C853",d:"M5 8l2 2 4-4"})]})}function V3(){const{components:e}=tn();return e.FailedIcon?e.FailedIcon:C.jsxs("svg",{className:Le("TradeStepLayoutErrorIcon"),viewBox:"0 0 16 16",fill:"none",children:[C.jsx("circle",{cx:"8",cy:"8",r:"7",strokeWidth:"1.5",stroke:"#FF3D00"}),C.jsx("path",{strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"#FF3D00",d:"M8 4v5M8 11h.01"})]})}const W3=()=>{const{swapStatus:e}=tn();return e===pt.SUCCESS?C.jsx(j3,{}):e===pt.FAILED?C.jsx(V3,{}):C.jsx(q3,{})},q3=()=>{const{components:e}=tn();return e.Loader?e.Loader:C.jsx(H3,{size:60,borderWidth:5,className:Le("TradeStepLayoutSpinner")})},K3=()=>{const{totalSteps:e,currentStepIndex:t=0,swapStatus:r}=tn();return r!==pt.LOADING||e===1?null:C.jsx("div",{className:Le("StepIndicator"),children:C.jsx("div",{style:{width:`${100/(e||0)}%`,left:`${t*100/(e||0)}%`},className:Le("StepIndicatorLine")})})},Y3=({error:e,footerLink:t,footerText:r})=>C.jsx(Gc,{footerLink:t,footerText:r,body:e||C.jsx("p",{className:Le("FailedContentMsg"),children:"Something went wrong"}),className:Le("FailedContent")});function Z3(){return C.jsx("svg",{fill:"currentColor",viewBox:"0 0 16 16",className:Le("TradepPreviewIcon"),children:C.jsx("path",{fillRule:"evenodd",d:"M4 8a.5.5 0 01.5-.5h5.793L8.146 5.354a.5.5 0 11.708-.708l3 3a.5.5 0 010 .708l-3 3a.5.5 0 01-.708-.708L10.293 8.5H4.5A.5.5 0 014 8z"})})}const c1=({inTokenOnly:e})=>{const{inToken:t,outToken:r,inAmount:n,outAmount:s,components:a}=tn();return C.jsxs("div",{className:Le("TradePreview"),children:[C.jsx(l1,{token:t,amount:n,Logo:a==null?void 0:a.SrcTokenLogo}),!e&&C.jsxs(C.Fragment,{children:[C.jsx(Z3,{}),C.jsx(l1,{token:r,amount:s,Logo:a==null?void 0:a.DstTokenLogo})]})]})},l1=({token:e,amount:t,Logo:r})=>C.jsxs("div",{className:Le("TradePreviewToken"),children:[r||C.jsx("img",{src:e==null?void 0:e.logoUrl,className:Le("TradepPreviewLogo"),alt:`${e==null?void 0:e.symbol} logo`}),C.jsxs(zo,{children:[t," ",e==null?void 0:e.symbol]})]});function X3({title:e,footerLink:t,footerText:r,hideTokens:n}){return C.jsx(Gc,{title:e,className:Le("Success"),body:!n&&C.jsx(c1,{}),footerLink:t,footerText:r})}const u1=({$gap:e=10,$alignItems:t="flex-start",children:r,className:n="",customStyles:s={}})=>{const a={gap:`${e}px`,alignItems:t,width:"100%",...s};return C.jsx("div",{className:`${Le("FlexColumn")} ${n}`,style:a,children:r})};function d1({styles:e={},className:t=""}){return C.jsx("div",{style:e,className:`${Le("SkeletonLoader")} ${t}`})}const Q3=()=>C.jsxs("div",{className:`${Le("MainContentLoader")}`,children:[C.jsx(d1,{className:`${Le("MainContentCircleLoader")}`}),C.jsx(d1,{className:`${Le("MainContentRectengularLoader")}`})]}),J3=({fromTitle:e,toTitle:t,inUsd:r,outUsd:n})=>{const{swapStatus:s,outAmount:a,inAmount:o,inToken:i,outToken:c,components:l,totalSteps:u}=tn(),d=C.jsx(f1,{fromTitle:e,inUsd:r,inToken:i,toTitle:t,outUsd:n,outToken:c,inAmount:o,outAmount:a,SrcTokenLogo:l.SrcTokenLogo,DstTokenLogo:l.DstTokenLogo});return s?u?C.jsx(e8,{}):C.jsxs(u1,{children:[d,C.jsx(Q3,{})]}):C.jsx(u1,{children:d})},p1=({amount:e,token:t,usd:r,title:n,Logo:s})=>C.jsxs("div",{className:`${Le("MainToken")}`,children:[C.jsxs("div",{className:`${Le("MainTokenLeft")}`,children:[C.jsx(zo,{className:`${Le("MainTokenTitle")}`,children:n}),C.jsx(zo,{className:` ${Le("MainTokenAmount")}`,children:`${e&&Number(e)>0?e:""} ${(t==null?void 0:t.symbol)||""}`}),r&&C.jsx("div",{className:` ${Le("MainTokenUsd")}`,children:r})]}),s||C.jsx("div",{className:` ${Le("MainTokenLogo")}`,children:t!=null&&t.logoUrl?C.jsx("img",{src:t==null?void 0:t.logoUrl,alt:"Token logo"}):null})]});function e8(){const{currentStep:e}=tn();return e?C.jsx(Gc,{footerLink:e.footerLink,footerText:e.footerText,title:e.title,body:e.hideTokens?void 0:C.jsx(c1,{inTokenOnly:e==null?void 0:e.inTokenOnly})}):null}const f1=({fromTitle:e,inUsd:t,inToken:r,toTitle:n,outUsd:s,outToken:a,inAmount:o,outAmount:i,SrcTokenLogo:c,DstTokenLogo:l})=>C.jsxs("div",{className:`${Le("Main")}`,children:[C.jsx(p1,{title:e||"Swap from",usd:t,token:r,amount:o,Logo:c}),C.jsx(p1,{title:n||"Swap to",usd:s,token:a,amount:i,Logo:l})]}),es=e=>C.jsx(R3,{...e,children:C.jsx(t8,{})}),t8=()=>{const{swapStatus:e,components:t,className:r}=tn();return C.jsx("div",{className:`${Le("SwapFlow")} ${r}`,children:e===pt.SUCCESS?t==null?void 0:t.Success:e===pt.FAILED?t==null?void 0:t.Failed:t==null?void 0:t.Main})};es.Success=X3,es.Failed=Y3,es.Main=J3,es.StepLayout=Gc;var Rs=(e=>(e.WRAP="wrap",e.APPROVE="approve",e.CREATE="create",e))(Rs||{});const r8="1.2.3";let Yt=class Lm extends Error{constructor(t,r={}){var o;const n=r.cause instanceof Lm?r.cause.details:(o=r.cause)!=null&&o.message?r.cause.message:r.details,s=r.cause instanceof Lm&&r.cause.docsPath||r.docsPath,a=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${r8}`].join(`
|
|
65
65
|
`);super(a),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=s,this.metaMessages=r.metaMessages,this.shortMessage=t}};function En(e,t){const r=e.exec(t);return r==null?void 0:r.groups}const m1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,h1=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,b1=/^\(.+?\).*?$/,y1=/^tuple(?<array>(\[(\d*)\])*)$/;function Nd(e){let t=e.type;if(y1.test(e.type)&&"components"in e){t="(";const r=e.components.length;for(let s=0;s<r;s++){const a=e.components[s];t+=Nd(a),s<r-1&&(t+=", ")}const n=En(y1,e.type);return t+=`)${(n==null?void 0:n.array)||""}`,Nd({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Ba(e){let t="";const r=e.length;for(let n=0;n<r;n++){const s=e[n];t+=Nd(s),n!==r-1&&(t+=", ")}return t}function jc(e){var t;return e.type==="function"?`function ${e.name}(${Ba(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Ba(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Ba(e.inputs)})`:e.type==="error"?`error ${e.name}(${Ba(e.inputs)})`:e.type==="constructor"?`constructor(${Ba(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const g1=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function n8(e){return g1.test(e)}function s8(e){return En(g1,e)}const x1=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function a8(e){return x1.test(e)}function o8(e){return En(x1,e)}const w1=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function i8(e){return w1.test(e)}function c8(e){return En(w1,e)}const v1=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Vc(e){return v1.test(e)}function l8(e){return En(v1,e)}const E1=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function u8(e){return E1.test(e)}function d8(e){return En(E1,e)}const k1=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function p8(e){return k1.test(e)}function f8(e){return En(k1,e)}const m8=/^receive\(\) external payable$/;function h8(e){return m8.test(e)}const C1=new Set(["memory","indexed","storage","calldata"]),b8=new Set(["indexed"]),Ld=new Set(["calldata","memory","storage"]);class y8 extends Yt{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class g8 extends Yt{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class x8 extends Yt{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class w8 extends Yt{constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class v8 extends Yt{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class E8 extends Yt{constructor({param:t,name:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${r}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class k8 extends Yt{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class C8 extends Yt{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${n}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class T8 extends Yt{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class Fa extends Yt{constructor({signature:t,type:r}){super(`Invalid ${r} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class A8 extends Yt{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class S8 extends Yt{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class P8 extends Yt{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class I8 extends Yt{constructor({current:t,depth:r}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${r>0?"opening":"closing"} parentheses.`],details:`Depth "${r}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function B8(e,t,r){let n="";if(r)for(const s of Object.entries(r)){if(!s)continue;let a="";for(const o of s[1])a+=`[${o.type}${o.name?`:${o.name}`:""}]`;n+=`(${s[0]}{${a}})`}return t?`${t}:${e}${n}`:`${e}${n}`}const zd=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Rd(e,t={}){if(i8(e))return F8(e,t);if(a8(e))return O8(e,t);if(n8(e))return U8(e,t);if(u8(e))return D8(e,t);if(p8(e))return _8(e);if(h8(e))return{type:"receive",stateMutability:"payable"};throw new A8({signature:e})}function F8(e,t={}){const r=c8(e);if(!r)throw new Fa({signature:e,type:"function"});const n=or(r.parameters),s=[],a=n.length;for(let i=0;i<a;i++)s.push(kn(n[i],{modifiers:Ld,structs:t,type:"function"}));const o=[];if(r.returns){const i=or(r.returns),c=i.length;for(let l=0;l<c;l++)o.push(kn(i[l],{modifiers:Ld,structs:t,type:"function"}))}return{name:r.name,type:"function",stateMutability:r.stateMutability??"nonpayable",inputs:s,outputs:o}}function O8(e,t={}){const r=o8(e);if(!r)throw new Fa({signature:e,type:"event"});const n=or(r.parameters),s=[],a=n.length;for(let o=0;o<a;o++)s.push(kn(n[o],{modifiers:b8,structs:t,type:"event"}));return{name:r.name,type:"event",inputs:s}}function U8(e,t={}){const r=s8(e);if(!r)throw new Fa({signature:e,type:"error"});const n=or(r.parameters),s=[],a=n.length;for(let o=0;o<a;o++)s.push(kn(n[o],{structs:t,type:"error"}));return{name:r.name,type:"error",inputs:s}}function D8(e,t={}){const r=d8(e);if(!r)throw new Fa({signature:e,type:"constructor"});const n=or(r.parameters),s=[],a=n.length;for(let o=0;o<a;o++)s.push(kn(n[o],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:r.stateMutability??"nonpayable",inputs:s}}function _8(e){const t=f8(e);if(!t)throw new Fa({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const M8=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,N8=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,L8=/^u?int$/;function kn(e,t){var d,f;const r=B8(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(zd.has(r))return zd.get(r);const n=b1.test(e),s=En(n?N8:M8,e);if(!s)throw new v8({param:e});if(s.name&&R8(s.name))throw new E8({param:e,name:s.name});const a=s.name?{name:s.name}:{},o=s.modifier==="indexed"?{indexed:!0}:{},i=(t==null?void 0:t.structs)??{};let c,l={};if(n){c="tuple";const m=or(s.type),b=[],g=m.length;for(let E=0;E<g;E++)b.push(kn(m[E],{structs:i}));l={components:b}}else if(s.type in i)c="tuple",l={components:i[s.type]};else if(L8.test(s.type))c=`${s.type}256`;else if(s.type==="address payable")c="address";else if(c=s.type,(t==null?void 0:t.type)!=="struct"&&!T1(c))throw new x8({type:c});if(s.modifier){if(!((f=(d=t==null?void 0:t.modifiers)==null?void 0:d.has)!=null&&f.call(d,s.modifier)))throw new k8({param:e,type:t==null?void 0:t.type,modifier:s.modifier});if(Ld.has(s.modifier)&&!H8(c,!!s.array))throw new C8({param:e,type:t==null?void 0:t.type,modifier:s.modifier})}const u={type:`${c}${s.array??""}`,...a,...o,...l};return zd.set(r,u),u}function or(e,t=[],r="",n=0){const s=e.trim().length;for(let a=0;a<s;a++){const o=e[a],i=e.slice(a+1);switch(o){case",":return n===0?or(i,[...t,r.trim()]):or(i,t,`${r}${o}`,n);case"(":return or(i,t,`${r}${o}`,n+1);case")":return or(i,t,`${r}${o}`,n-1);default:return or(i,t,`${r}${o}`,n)}}if(r==="")return t;if(n!==0)throw new I8({current:r,depth:n});return t.push(r.trim()),t}function T1(e){return e==="address"||e==="bool"||e==="function"||e==="string"||m1.test(e)||h1.test(e)}const z8=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function R8(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||m1.test(e)||h1.test(e)||z8.test(e)}function H8(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Hd(e){const t={},r=e.length;for(let o=0;o<r;o++){const i=e[o];if(!Vc(i))continue;const c=l8(i);if(!c)throw new Fa({signature:i,type:"struct"});const l=c.properties.split(";"),u=[],d=l.length;for(let f=0;f<d;f++){const b=l[f].trim();if(!b)continue;const g=kn(b,{type:"struct"});u.push(g)}if(!u.length)throw new S8({signature:i});t[c.name]=u}const n={},s=Object.entries(t),a=s.length;for(let o=0;o<a;o++){const[i,c]=s[o];n[i]=A1(c,t)}return n}const $8=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function A1(e=[],t={},r=new Set){const n=[],s=e.length;for(let a=0;a<s;a++){const o=e[a];if(b1.test(o.type))n.push(o);else{const c=En($8,o.type);if(!(c!=null&&c.type))throw new T8({abiParameter:o});const{array:l,type:u}=c;if(u in t){if(r.has(u))throw new P8({type:u});n.push({...o,type:`tuple${l??""}`,components:A1(t[u],t,new Set([...r,u]))})}else if(T1(u))n.push(o);else throw new g8({type:u})}}return n}function S1(e){const t=Hd(e),r=[],n=e.length;for(let s=0;s<n;s++){const a=e[s];Vc(a)||r.push(Rd(a,t))}return r}function P1(e){let t;if(typeof e=="string")t=Rd(e);else{const r=Hd(e),n=e.length;for(let s=0;s<n;s++){const a=e[s];if(!Vc(a)){t=Rd(a,r);break}}}if(!t)throw new y8({signature:e});return t}function I1(e){const t=[];if(typeof e=="string"){const r=or(e),n=r.length;for(let s=0;s<n;s++)t.push(kn(r[s],{modifiers:C1}))}else{const r=Hd(e),n=e.length;for(let s=0;s<n;s++){const a=e[s];if(Vc(a))continue;const o=or(a),i=o.length;for(let c=0;c<i;c++)t.push(kn(o[c],{modifiers:C1,structs:r}))}}if(t.length===0)throw new w8({params:e});return t}function se(e,t,r){const n=e[t.name];if(typeof n=="function")return n;const s=e[r];return typeof s=="function"?s:a=>t(e,a)}function _r(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new rv(e.type);return`${e.name}(${Wc(e.inputs,{includeName:t})})`}function Wc(e,{includeName:t=!1}={}){return e?e.map(r=>G8(r,{includeName:t})).join(t?", ":","):""}function G8(e,{includeName:t}){return e.type.startsWith("tuple")?`(${Wc(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Mr(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function lt(e){return Mr(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const B1="2.43.3";let Ro={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${B1}`},$=class zm extends Error{constructor(t,r={}){var i;const n=(()=>{var c;return r.cause instanceof zm?r.cause.details:(c=r.cause)!=null&&c.message?r.cause.message:r.details})(),s=r.cause instanceof zm&&r.cause.docsPath||r.docsPath,a=(i=Ro.getDocsUrl)==null?void 0:i.call(Ro,{...r,docsPath:s}),o=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...n?[`Details: ${n}`]:[],...Ro.version?[`Version: ${Ro.version}`]:[]].join(`
|
|
66
66
|
`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=s,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=t,this.version=B1}walk(t){return F1(this,t)}};function F1(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?F1(e.cause,t):t?null:e}class j8 extends ${constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
|
|
67
67
|
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class O1 extends ${constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
|