@tokenbuddy/tokenbuddy 1.0.35 → 1.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/dist/src/buyer-store.d.ts +6 -1
  2. package/dist/src/buyer-store.js +43 -4
  3. package/dist/src/cli.js +2 -2
  4. package/dist/src/daemon.d.ts +12 -0
  5. package/dist/src/daemon.js +791 -61
  6. package/dist/src/doctor-diagnostics.js +1 -6
  7. package/dist/src/provider-install.d.ts +2 -2
  8. package/dist/src/provider-install.js +248 -2
  9. package/dist/src/seller-catalog.d.ts +21 -0
  10. package/dist/src/seller-catalog.js +17 -0
  11. package/dist/src/seller-route-planner.d.ts +4 -1
  12. package/dist/src/seller-route-planner.js +3 -0
  13. package/dist/src/seller-routing-strategy.d.ts +3 -0
  14. package/dist/src/terminal-detect.d.ts +1 -1
  15. package/dist/src/terminal-detect.js +3 -2
  16. package/package.json +15 -2
  17. package/static/ui/assets/index-Djfl9tw5.js +271 -0
  18. package/static/ui/assets/index-DkfztCkn.css +1 -0
  19. package/static/ui/index.html +2 -2
  20. package/dist/src/buyer-store.d.ts.map +0 -1
  21. package/dist/src/buyer-store.js.map +0 -1
  22. package/dist/src/clawtip-bootstrap.d.ts.map +0 -1
  23. package/dist/src/clawtip-bootstrap.js.map +0 -1
  24. package/dist/src/cli.d.ts.map +0 -1
  25. package/dist/src/cli.js.map +0 -1
  26. package/dist/src/credit-tracker.d.ts.map +0 -1
  27. package/dist/src/credit-tracker.js.map +0 -1
  28. package/dist/src/daemon.d.ts.map +0 -1
  29. package/dist/src/daemon.js.map +0 -1
  30. package/dist/src/doctor-clawtip-wallet.d.ts.map +0 -1
  31. package/dist/src/doctor-clawtip-wallet.js.map +0 -1
  32. package/dist/src/doctor-diagnostics.d.ts.map +0 -1
  33. package/dist/src/doctor-diagnostics.js.map +0 -1
  34. package/dist/src/index.d.ts.map +0 -1
  35. package/dist/src/index.js.map +0 -1
  36. package/dist/src/init-clawtip-activation.d.ts.map +0 -1
  37. package/dist/src/init-clawtip-activation.js.map +0 -1
  38. package/dist/src/init-payment-options.d.ts.map +0 -1
  39. package/dist/src/init-payment-options.js.map +0 -1
  40. package/dist/src/init-setup.d.ts.map +0 -1
  41. package/dist/src/init-setup.js.map +0 -1
  42. package/dist/src/model-index.d.ts.map +0 -1
  43. package/dist/src/model-index.js.map +0 -1
  44. package/dist/src/package-update.d.ts.map +0 -1
  45. package/dist/src/package-update.js.map +0 -1
  46. package/dist/src/prewarm-cache.d.ts.map +0 -1
  47. package/dist/src/prewarm-cache.js.map +0 -1
  48. package/dist/src/prewarm-scheduler.d.ts.map +0 -1
  49. package/dist/src/prewarm-scheduler.js.map +0 -1
  50. package/dist/src/provider-install.d.ts.map +0 -1
  51. package/dist/src/provider-install.js.map +0 -1
  52. package/dist/src/provider-routing-config.d.ts.map +0 -1
  53. package/dist/src/provider-routing-config.js.map +0 -1
  54. package/dist/src/registry-trust.d.ts.map +0 -1
  55. package/dist/src/registry-trust.js.map +0 -1
  56. package/dist/src/route-failover.d.ts.map +0 -1
  57. package/dist/src/route-failover.js.map +0 -1
  58. package/dist/src/seller-catalog.d.ts.map +0 -1
  59. package/dist/src/seller-catalog.js.map +0 -1
  60. package/dist/src/seller-concurrency-limiter.d.ts.map +0 -1
  61. package/dist/src/seller-concurrency-limiter.js.map +0 -1
  62. package/dist/src/seller-metadata-cache.d.ts.map +0 -1
  63. package/dist/src/seller-metadata-cache.js.map +0 -1
  64. package/dist/src/seller-pool.d.ts.map +0 -1
  65. package/dist/src/seller-pool.js.map +0 -1
  66. package/dist/src/seller-route-planner.d.ts.map +0 -1
  67. package/dist/src/seller-route-planner.js.map +0 -1
  68. package/dist/src/seller-routing-config.d.ts.map +0 -1
  69. package/dist/src/seller-routing-config.js.map +0 -1
  70. package/dist/src/seller-routing-strategy.d.ts.map +0 -1
  71. package/dist/src/seller-routing-strategy.js.map +0 -1
  72. package/dist/src/stream-failover.d.ts.map +0 -1
  73. package/dist/src/stream-failover.js.map +0 -1
  74. package/dist/src/tb-clawtip-proof.d.ts.map +0 -1
  75. package/dist/src/tb-clawtip-proof.js.map +0 -1
  76. package/dist/src/tb-proxyd.d.ts.map +0 -1
  77. package/dist/src/tb-proxyd.js.map +0 -1
  78. package/dist/src/terminal-detect.d.ts.map +0 -1
  79. package/dist/src/terminal-detect.js.map +0 -1
  80. package/dist/src/terminal-image.d.ts.map +0 -1
  81. package/dist/src/terminal-image.js.map +0 -1
  82. package/src/buyer-store.ts +0 -1090
  83. package/src/clawtip-bootstrap.ts +0 -65
  84. package/src/cli.ts +0 -2243
  85. package/src/credit-tracker.ts +0 -295
  86. package/src/daemon.ts +0 -5475
  87. package/src/doctor-clawtip-wallet.ts +0 -95
  88. package/src/doctor-diagnostics.ts +0 -1026
  89. package/src/index.ts +0 -16
  90. package/src/init-clawtip-activation.ts +0 -695
  91. package/src/init-payment-options.ts +0 -373
  92. package/src/init-setup.ts +0 -165
  93. package/src/model-index.ts +0 -278
  94. package/src/package-update.ts +0 -311
  95. package/src/prewarm-cache.ts +0 -485
  96. package/src/prewarm-scheduler.ts +0 -675
  97. package/src/provider-install.ts +0 -1006
  98. package/src/provider-routing-config.ts +0 -410
  99. package/src/registry-trust.ts +0 -51
  100. package/src/route-failover.ts +0 -304
  101. package/src/seller-catalog.ts +0 -505
  102. package/src/seller-concurrency-limiter.ts +0 -161
  103. package/src/seller-metadata-cache.ts +0 -91
  104. package/src/seller-pool.ts +0 -557
  105. package/src/seller-route-planner.ts +0 -513
  106. package/src/seller-routing-config.ts +0 -211
  107. package/src/seller-routing-strategy.ts +0 -362
  108. package/src/stream-failover.ts +0 -152
  109. package/src/tb-clawtip-proof.ts +0 -28
  110. package/src/tb-proxyd.ts +0 -101
  111. package/src/terminal-detect.ts +0 -333
  112. package/src/terminal-image.ts +0 -228
  113. package/static/ui/assets/index-0MVXD7bH.css +0 -1
  114. package/static/ui/assets/index-BVbeDEwq.js +0 -271
  115. package/static/ui/assets/index-BVbeDEwq.js.map +0 -1
  116. package/tests/cli-routing.test.ts +0 -363
  117. package/tests/control-plane-ui-endpoints.test.ts +0 -1630
  118. package/tests/credit-tracker.test.ts +0 -165
  119. package/tests/daemon-413-fallback.test.ts +0 -92
  120. package/tests/daemon-classify.test.ts +0 -452
  121. package/tests/daemon-roles.test.ts +0 -92
  122. package/tests/daemon-trusted-registry-cache.test.ts +0 -132
  123. package/tests/e2e.test.ts +0 -366
  124. package/tests/image-generation-e2e.test.ts +0 -230
  125. package/tests/model-index.test.ts +0 -198
  126. package/tests/package-update.test.ts +0 -147
  127. package/tests/prewarm-cache.test.ts +0 -296
  128. package/tests/prewarm-scheduler.test.ts +0 -367
  129. package/tests/provider-routing-config.test.ts +0 -150
  130. package/tests/registry-trust.test.ts +0 -28
  131. package/tests/route-failover.test.ts +0 -222
  132. package/tests/seller-catalog-413.test.ts +0 -120
  133. package/tests/seller-catalog-utilities.test.ts +0 -124
  134. package/tests/seller-concurrency-limiter.test.ts +0 -83
  135. package/tests/seller-metadata-cache.test.ts +0 -89
  136. package/tests/seller-pool.test.ts +0 -365
  137. package/tests/seller-route-planner.test.ts +0 -312
  138. package/tests/seller-routing-config.test.ts +0 -124
  139. package/tests/seller-routing-strategy.test.ts +0 -167
  140. package/tests/stream-failover.test.ts +0 -52
  141. package/tests/thousand-seller.test.ts +0 -151
  142. package/tests/tokenbuddy.test.ts +0 -4043
  143. package/tsconfig.json +0 -8
@@ -0,0 +1,271 @@
1
+ var Y0=Object.defineProperty;var Jv=a=>{throw TypeError(a)};var G0=(a,l,o)=>l in a?Y0(a,l,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[l]=o;var Ed=(a,l,o)=>G0(a,typeof l!="symbol"?l+"":l,o),kd=(a,l,o)=>l.has(a)||Jv("Cannot "+o);var C=(a,l,o)=>(kd(a,l,"read from private field"),o?o.call(a):l.get(a)),de=(a,l,o)=>l.has(a)?Jv("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(a):l.set(a,o),ie=(a,l,o,s)=>(kd(a,l,"write to private field"),s?s.call(a,o):l.set(a,o),o),we=(a,l,o)=>(kd(a,l,"access private method"),o);var Vo=(a,l,o,s)=>({set _(u){ie(a,l,u,o)},get _(){return C(a,l,s)}});(function(){const l=document.createElement("link").relList;if(l&&l.supports&&l.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))s(u);new MutationObserver(u=>{for(const f of u)if(f.type==="childList")for(const p of f.addedNodes)p.tagName==="LINK"&&p.rel==="modulepreload"&&s(p)}).observe(document,{childList:!0,subtree:!0});function o(u){const f={};return u.integrity&&(f.integrity=u.integrity),u.referrerPolicy&&(f.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?f.credentials="include":u.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function s(u){if(u.ep)return;u.ep=!0;const f=o(u);fetch(u.href,f)}})();var Rd={exports:{}},is={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Iv;function V0(){if(Iv)return is;Iv=1;var a=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function o(s,u,f){var p=null;if(f!==void 0&&(p=""+f),u.key!==void 0&&(p=""+u.key),"key"in u){f={};for(var h in u)h!=="key"&&(f[h]=u[h])}else f=u;return u=f.ref,{$$typeof:a,type:s,key:p,ref:u!==void 0?u:null,props:f}}return is.Fragment=l,is.jsx=o,is.jsxs=o,is}var Wv;function X0(){return Wv||(Wv=1,Rd.exports=V0()),Rd.exports}var i=X0(),zd={exports:{}},ye={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var ex;function F0(){if(ex)return ye;ex=1;var a=Symbol.for("react.transitional.element"),l=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),p=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),x=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),j=Symbol.iterator;function N(w){return w===null||typeof w!="object"?null:(w=j&&w[j]||w["@@iterator"],typeof w=="function"?w:null)}var T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E=Object.assign,D={};function R(w,$,V){this.props=w,this.context=$,this.refs=D,this.updater=V||T}R.prototype.isReactComponent={},R.prototype.setState=function(w,$){if(typeof w!="object"&&typeof w!="function"&&w!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,w,$,"setState")},R.prototype.forceUpdate=function(w){this.updater.enqueueForceUpdate(this,w,"forceUpdate")};function L(){}L.prototype=R.prototype;function H(w,$,V){this.props=w,this.context=$,this.refs=D,this.updater=V||T}var P=H.prototype=new L;P.constructor=H,E(P,R.prototype),P.isPureReactComponent=!0;var G=Array.isArray;function Q(){}var q={H:null,A:null,T:null,S:null},W=Object.prototype.hasOwnProperty;function I(w,$,V){var le=V.ref;return{$$typeof:a,type:w,key:$,ref:le!==void 0?le:null,props:V}}function ne(w,$){return I(w.type,$,w.props)}function F(w){return typeof w=="object"&&w!==null&&w.$$typeof===a}function J(w){var $={"=":"=0",":":"=2"};return"$"+w.replace(/[=:]/g,function(V){return $[V]})}var se=/\/+/g;function ge(w,$){return typeof w=="object"&&w!==null&&w.key!=null?J(""+w.key):$.toString(36)}function fe(w){switch(w.status){case"fulfilled":return w.value;case"rejected":throw w.reason;default:switch(typeof w.status=="string"?w.then(Q,Q):(w.status="pending",w.then(function($){w.status==="pending"&&(w.status="fulfilled",w.value=$)},function($){w.status==="pending"&&(w.status="rejected",w.reason=$)})),w.status){case"fulfilled":return w.value;case"rejected":throw w.reason}}throw w}function O(w,$,V,le,pe){var ve=typeof w;(ve==="undefined"||ve==="boolean")&&(w=null);var be=!1;if(w===null)be=!0;else switch(ve){case"bigint":case"string":case"number":be=!0;break;case"object":switch(w.$$typeof){case a:case l:be=!0;break;case y:return be=w._init,O(be(w._payload),$,V,le,pe)}}if(be)return pe=pe(w),be=le===""?"."+ge(w,0):le,G(pe)?(V="",be!=null&&(V=be.replace(se,"$&/")+"/"),O(pe,$,V,"",function(Nt){return Nt})):pe!=null&&(F(pe)&&(pe=ne(pe,V+(pe.key==null||w&&w.key===pe.key?"":(""+pe.key).replace(se,"$&/")+"/")+be)),$.push(pe)),1;be=0;var Xe=le===""?".":le+":";if(G(w))for(var Oe=0;Oe<w.length;Oe++)le=w[Oe],ve=Xe+ge(le,Oe),be+=O(le,$,V,ve,pe);else if(Oe=N(w),typeof Oe=="function")for(w=Oe.call(w),Oe=0;!(le=w.next()).done;)le=le.value,ve=Xe+ge(le,Oe++),be+=O(le,$,V,ve,pe);else if(ve==="object"){if(typeof w.then=="function")return O(fe(w),$,V,le,pe);throw $=String(w),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(w).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}return be}function te(w,$,V){if(w==null)return w;var le=[],pe=0;return O(w,le,"","",function(ve){return $.call(V,ve,pe++)}),le}function re(w){if(w._status===-1){var $=w._result;$=$(),$.then(function(V){(w._status===0||w._status===-1)&&(w._status=1,w._result=V)},function(V){(w._status===0||w._status===-1)&&(w._status=2,w._result=V)}),w._status===-1&&(w._status=0,w._result=$)}if(w._status===1)return w._result.default;throw w._result}var Z=typeof reportError=="function"?reportError:function(w){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof w=="object"&&w!==null&&typeof w.message=="string"?String(w.message):String(w),error:w});if(!window.dispatchEvent($))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",w);return}console.error(w)},he={map:te,forEach:function(w,$,V){te(w,function(){$.apply(this,arguments)},V)},count:function(w){var $=0;return te(w,function(){$++}),$},toArray:function(w){return te(w,function($){return $})||[]},only:function(w){if(!F(w))throw Error("React.Children.only expected to receive a single React element child.");return w}};return ye.Activity=g,ye.Children=he,ye.Component=R,ye.Fragment=o,ye.Profiler=u,ye.PureComponent=H,ye.StrictMode=s,ye.Suspense=v,ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=q,ye.__COMPILER_RUNTIME={__proto__:null,c:function(w){return q.H.useMemoCache(w)}},ye.cache=function(w){return function(){return w.apply(null,arguments)}},ye.cacheSignal=function(){return null},ye.cloneElement=function(w,$,V){if(w==null)throw Error("The argument must be a React element, but you passed "+w+".");var le=E({},w.props),pe=w.key;if($!=null)for(ve in $.key!==void 0&&(pe=""+$.key),$)!W.call($,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&$.ref===void 0||(le[ve]=$[ve]);var ve=arguments.length-2;if(ve===1)le.children=V;else if(1<ve){for(var be=Array(ve),Xe=0;Xe<ve;Xe++)be[Xe]=arguments[Xe+2];le.children=be}return I(w.type,pe,le)},ye.createContext=function(w){return w={$$typeof:p,_currentValue:w,_currentValue2:w,_threadCount:0,Provider:null,Consumer:null},w.Provider=w,w.Consumer={$$typeof:f,_context:w},w},ye.createElement=function(w,$,V){var le,pe={},ve=null;if($!=null)for(le in $.key!==void 0&&(ve=""+$.key),$)W.call($,le)&&le!=="key"&&le!=="__self"&&le!=="__source"&&(pe[le]=$[le]);var be=arguments.length-2;if(be===1)pe.children=V;else if(1<be){for(var Xe=Array(be),Oe=0;Oe<be;Oe++)Xe[Oe]=arguments[Oe+2];pe.children=Xe}if(w&&w.defaultProps)for(le in be=w.defaultProps,be)pe[le]===void 0&&(pe[le]=be[le]);return I(w,ve,pe)},ye.createRef=function(){return{current:null}},ye.forwardRef=function(w){return{$$typeof:h,render:w}},ye.isValidElement=F,ye.lazy=function(w){return{$$typeof:y,_payload:{_status:-1,_result:w},_init:re}},ye.memo=function(w,$){return{$$typeof:x,type:w,compare:$===void 0?null:$}},ye.startTransition=function(w){var $=q.T,V={};q.T=V;try{var le=w(),pe=q.S;pe!==null&&pe(V,le),typeof le=="object"&&le!==null&&typeof le.then=="function"&&le.then(Q,Z)}catch(ve){Z(ve)}finally{$!==null&&V.types!==null&&($.types=V.types),q.T=$}},ye.unstable_useCacheRefresh=function(){return q.H.useCacheRefresh()},ye.use=function(w){return q.H.use(w)},ye.useActionState=function(w,$,V){return q.H.useActionState(w,$,V)},ye.useCallback=function(w,$){return q.H.useCallback(w,$)},ye.useContext=function(w){return q.H.useContext(w)},ye.useDebugValue=function(){},ye.useDeferredValue=function(w,$){return q.H.useDeferredValue(w,$)},ye.useEffect=function(w,$){return q.H.useEffect(w,$)},ye.useEffectEvent=function(w){return q.H.useEffectEvent(w)},ye.useId=function(){return q.H.useId()},ye.useImperativeHandle=function(w,$,V){return q.H.useImperativeHandle(w,$,V)},ye.useInsertionEffect=function(w,$){return q.H.useInsertionEffect(w,$)},ye.useLayoutEffect=function(w,$){return q.H.useLayoutEffect(w,$)},ye.useMemo=function(w,$){return q.H.useMemo(w,$)},ye.useOptimistic=function(w,$){return q.H.useOptimistic(w,$)},ye.useReducer=function(w,$,V){return q.H.useReducer(w,$,V)},ye.useRef=function(w){return q.H.useRef(w)},ye.useState=function(w){return q.H.useState(w)},ye.useSyncExternalStore=function(w,$,V){return q.H.useSyncExternalStore(w,$,V)},ye.useTransition=function(){return q.H.useTransition()},ye.version="19.2.7",ye}var tx;function kf(){return tx||(tx=1,zd.exports=F0()),zd.exports}var S=kf(),_d={exports:{}},ss={},Od={exports:{}},Dd={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var nx;function Z0(){return nx||(nx=1,(function(a){function l(O,te){var re=O.length;O.push(te);e:for(;0<re;){var Z=re-1>>>1,he=O[Z];if(0<u(he,te))O[Z]=te,O[re]=he,re=Z;else break e}}function o(O){return O.length===0?null:O[0]}function s(O){if(O.length===0)return null;var te=O[0],re=O.pop();if(re!==te){O[0]=re;e:for(var Z=0,he=O.length,w=he>>>1;Z<w;){var $=2*(Z+1)-1,V=O[$],le=$+1,pe=O[le];if(0>u(V,re))le<he&&0>u(pe,V)?(O[Z]=pe,O[le]=re,Z=le):(O[Z]=V,O[$]=re,Z=$);else if(le<he&&0>u(pe,re))O[Z]=pe,O[le]=re,Z=le;else break e}}return te}function u(O,te){var re=O.sortIndex-te.sortIndex;return re!==0?re:O.id-te.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var p=Date,h=p.now();a.unstable_now=function(){return p.now()-h}}var v=[],x=[],y=1,g=null,j=3,N=!1,T=!1,E=!1,D=!1,R=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function P(O){for(var te=o(x);te!==null;){if(te.callback===null)s(x);else if(te.startTime<=O)s(x),te.sortIndex=te.expirationTime,l(v,te);else break;te=o(x)}}function G(O){if(E=!1,P(O),!T)if(o(v)!==null)T=!0,Q||(Q=!0,J());else{var te=o(x);te!==null&&fe(G,te.startTime-O)}}var Q=!1,q=-1,W=5,I=-1;function ne(){return D?!0:!(a.unstable_now()-I<W)}function F(){if(D=!1,Q){var O=a.unstable_now();I=O;var te=!0;try{e:{T=!1,E&&(E=!1,L(q),q=-1),N=!0;var re=j;try{t:{for(P(O),g=o(v);g!==null&&!(g.expirationTime>O&&ne());){var Z=g.callback;if(typeof Z=="function"){g.callback=null,j=g.priorityLevel;var he=Z(g.expirationTime<=O);if(O=a.unstable_now(),typeof he=="function"){g.callback=he,P(O),te=!0;break t}g===o(v)&&s(v),P(O)}else s(v);g=o(v)}if(g!==null)te=!0;else{var w=o(x);w!==null&&fe(G,w.startTime-O),te=!1}}break e}finally{g=null,j=re,N=!1}te=void 0}}finally{te?J():Q=!1}}}var J;if(typeof H=="function")J=function(){H(F)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,ge=se.port2;se.port1.onmessage=F,J=function(){ge.postMessage(null)}}else J=function(){R(F,0)};function fe(O,te){q=R(function(){O(a.unstable_now())},te)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(O){O.callback=null},a.unstable_forceFrameRate=function(O){0>O||125<O?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<O?Math.floor(1e3/O):5},a.unstable_getCurrentPriorityLevel=function(){return j},a.unstable_next=function(O){switch(j){case 1:case 2:case 3:var te=3;break;default:te=j}var re=j;j=te;try{return O()}finally{j=re}},a.unstable_requestPaint=function(){D=!0},a.unstable_runWithPriority=function(O,te){switch(O){case 1:case 2:case 3:case 4:case 5:break;default:O=3}var re=j;j=O;try{return te()}finally{j=re}},a.unstable_scheduleCallback=function(O,te,re){var Z=a.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?Z+re:Z):re=Z,O){case 1:var he=-1;break;case 2:he=250;break;case 5:he=1073741823;break;case 4:he=1e4;break;default:he=5e3}return he=re+he,O={id:y++,callback:te,priorityLevel:O,startTime:re,expirationTime:he,sortIndex:-1},re>Z?(O.sortIndex=re,l(x,O),o(v)===null&&O===o(x)&&(E?(L(q),q=-1):E=!0,fe(G,re-Z))):(O.sortIndex=he,l(v,O),T||N||(T=!0,Q||(Q=!0,J()))),O},a.unstable_shouldYield=ne,a.unstable_wrapCallback=function(O){var te=j;return function(){var re=j;j=te;try{return O.apply(this,arguments)}finally{j=re}}}})(Dd)),Dd}var ax;function J0(){return ax||(ax=1,Od.exports=Z0()),Od.exports}var Ud={exports:{}},Dt={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var lx;function I0(){if(lx)return Dt;lx=1;var a=kf();function l(v){var x="https://react.dev/errors/"+v;if(1<arguments.length){x+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)x+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+v+"; visit "+x+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(){}var s={d:{f:o,r:function(){throw Error(l(522))},D:o,C:o,L:o,m:o,X:o,S:o,M:o},p:0,findDOMNode:null},u=Symbol.for("react.portal");function f(v,x,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:g==null?null:""+g,children:v,containerInfo:x,implementation:y}}var p=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(v,x){if(v==="font")return"";if(typeof x=="string")return x==="use-credentials"?x:""}return Dt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Dt.createPortal=function(v,x){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!x||x.nodeType!==1&&x.nodeType!==9&&x.nodeType!==11)throw Error(l(299));return f(v,x,null,y)},Dt.flushSync=function(v){var x=p.T,y=s.p;try{if(p.T=null,s.p=2,v)return v()}finally{p.T=x,s.p=y,s.d.f()}},Dt.preconnect=function(v,x){typeof v=="string"&&(x?(x=x.crossOrigin,x=typeof x=="string"?x==="use-credentials"?x:"":void 0):x=null,s.d.C(v,x))},Dt.prefetchDNS=function(v){typeof v=="string"&&s.d.D(v)},Dt.preinit=function(v,x){if(typeof v=="string"&&x&&typeof x.as=="string"){var y=x.as,g=h(y,x.crossOrigin),j=typeof x.integrity=="string"?x.integrity:void 0,N=typeof x.fetchPriority=="string"?x.fetchPriority:void 0;y==="style"?s.d.S(v,typeof x.precedence=="string"?x.precedence:void 0,{crossOrigin:g,integrity:j,fetchPriority:N}):y==="script"&&s.d.X(v,{crossOrigin:g,integrity:j,fetchPriority:N,nonce:typeof x.nonce=="string"?x.nonce:void 0})}},Dt.preinitModule=function(v,x){if(typeof v=="string")if(typeof x=="object"&&x!==null){if(x.as==null||x.as==="script"){var y=h(x.as,x.crossOrigin);s.d.M(v,{crossOrigin:y,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0})}}else x==null&&s.d.M(v)},Dt.preload=function(v,x){if(typeof v=="string"&&typeof x=="object"&&x!==null&&typeof x.as=="string"){var y=x.as,g=h(y,x.crossOrigin);s.d.L(v,y,{crossOrigin:g,integrity:typeof x.integrity=="string"?x.integrity:void 0,nonce:typeof x.nonce=="string"?x.nonce:void 0,type:typeof x.type=="string"?x.type:void 0,fetchPriority:typeof x.fetchPriority=="string"?x.fetchPriority:void 0,referrerPolicy:typeof x.referrerPolicy=="string"?x.referrerPolicy:void 0,imageSrcSet:typeof x.imageSrcSet=="string"?x.imageSrcSet:void 0,imageSizes:typeof x.imageSizes=="string"?x.imageSizes:void 0,media:typeof x.media=="string"?x.media:void 0})}},Dt.preloadModule=function(v,x){if(typeof v=="string")if(x){var y=h(x.as,x.crossOrigin);s.d.m(v,{as:typeof x.as=="string"&&x.as!=="script"?x.as:void 0,crossOrigin:y,integrity:typeof x.integrity=="string"?x.integrity:void 0})}else s.d.m(v)},Dt.requestFormReset=function(v){s.d.r(v)},Dt.unstable_batchedUpdates=function(v,x){return v(x)},Dt.useFormState=function(v,x,y){return p.H.useFormState(v,x,y)},Dt.useFormStatus=function(){return p.H.useHostTransitionStatus()},Dt.version="19.2.7",Dt}var rx;function hg(){if(rx)return Ud.exports;rx=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),Ud.exports=I0(),Ud.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var ix;function W0(){if(ix)return ss;ix=1;var a=J0(),l=kf(),o=hg();function s(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function p(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function h(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function v(e){if(f(e)!==e)throw Error(s(188))}function x(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(s(188));return t!==e?null:e}for(var n=e,r=t;;){var c=n.return;if(c===null)break;var d=c.alternate;if(d===null){if(r=c.return,r!==null){n=r;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===n)return v(c),e;if(d===r)return v(c),t;d=d.sibling}throw Error(s(188))}if(n.return!==r.return)n=c,r=d;else{for(var m=!1,b=c.child;b;){if(b===n){m=!0,n=c,r=d;break}if(b===r){m=!0,r=c,n=d;break}b=b.sibling}if(!m){for(b=d.child;b;){if(b===n){m=!0,n=d,r=c;break}if(b===r){m=!0,r=d,n=c;break}b=b.sibling}if(!m)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var g=Object.assign,j=Symbol.for("react.element"),N=Symbol.for("react.transitional.element"),T=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),D=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),H=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),Q=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),ne=Symbol.for("react.memo_cache_sentinel"),F=Symbol.iterator;function J(e){return e===null||typeof e!="object"?null:(e=F&&e[F]||e["@@iterator"],typeof e=="function"?e:null)}var se=Symbol.for("react.client.reference");function ge(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===se?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case R:return"Profiler";case D:return"StrictMode";case G:return"Suspense";case Q:return"SuspenseList";case I:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case T:return"Portal";case H:return e.displayName||"Context";case L:return(e._context.displayName||"Context")+".Consumer";case P:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case q:return t=e.displayName||null,t!==null?t:ge(e.type)||"Memo";case W:t=e._payload,e=e._init;try{return ge(e(t))}catch{}}return null}var fe=Array.isArray,O=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,te=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re={pending:!1,data:null,method:null,action:null},Z=[],he=-1;function w(e){return{current:e}}function $(e){0>he||(e.current=Z[he],Z[he]=null,he--)}function V(e,t){he++,Z[he]=e.current,e.current=t}var le=w(null),pe=w(null),ve=w(null),be=w(null);function Xe(e,t){switch(V(ve,t),V(pe,e),V(le,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?yv(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=yv(t),e=Sv(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}$(le),V(le,e)}function Oe(){$(le),$(pe),$(ve)}function Nt(e){e.memoizedState!==null&&V(be,e);var t=le.current,n=Sv(t,e.type);t!==n&&(V(pe,e),V(le,n))}function dt(e){pe.current===e&&($(le),$(pe)),be.current===e&&($(be),ns._currentValue=re)}var yn,Ie;function Qe(e){if(yn===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);yn=t&&t[1]||"",Ie=-1<n.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+yn+e+Ie}var Gt=!1;function an(e,t){if(!e||Gt)return"";Gt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var X=function(){throw Error()};if(Object.defineProperty(X.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(X,[])}catch(B){var U=B}Reflect.construct(e,[],X)}else{try{X.call()}catch(B){U=B}e.call(X.prototype)}}else{try{throw Error()}catch(B){U=B}(X=e())&&typeof X.catch=="function"&&X.catch(function(){})}}catch(B){if(B&&U&&typeof B.stack=="string")return[B.stack,U.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=r.DetermineComponentFrameRoot(),m=d[0],b=d[1];if(m&&b){var M=m.split(`
44
+ `),_=b.split(`
45
+ `);for(c=r=0;r<M.length&&!M[r].includes("DetermineComponentFrameRoot");)r++;for(;c<_.length&&!_[c].includes("DetermineComponentFrameRoot");)c++;if(r===M.length||c===_.length)for(r=M.length-1,c=_.length-1;1<=r&&0<=c&&M[r]!==_[c];)c--;for(;1<=r&&0<=c;r--,c--)if(M[r]!==_[c]){if(r!==1||c!==1)do if(r--,c--,0>c||M[r]!==_[c]){var K=`
46
+ `+M[r].replace(" at new "," at ");return e.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",e.displayName)),K}while(1<=r&&0<=c);break}}}finally{Gt=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Qe(n):""}function ln(e,t){switch(e.tag){case 26:case 27:case 5:return Qe(e.type);case 16:return Qe("Lazy");case 13:return e.child!==t&&t!==null?Qe("Suspense Fallback"):Qe("Suspense");case 19:return Qe("SuspenseList");case 0:case 15:return an(e.type,!1);case 11:return an(e.type.render,!1);case 1:return an(e.type,!0);case 31:return Qe("Activity");default:return""}}function Bt(e){try{var t="",n=null;do t+=ln(e,n),n=e,e=e.return;while(e);return t}catch(r){return`
47
+ Error generating stack: `+r.message+`
48
+ `+r.stack}}var At=Object.prototype.hasOwnProperty,rn=a.unstable_scheduleCallback,sn=a.unstable_cancelCallback,Pn=a.unstable_shouldYield,la=a.unstable_requestPaint,at=a.unstable_now,Qa=a.unstable_getCurrentPriorityLevel,Pa=a.unstable_ImmediatePriority,Sn=a.unstable_UserBlockingPriority,qt=a.unstable_NormalPriority,Ka=a.unstable_LowPriority,ra=a.unstable_IdlePriority,Ya=a.log,Ga=a.unstable_setDisableYieldValue,on=null,ft=null;function $t(e){if(typeof Ya=="function"&&Ga(e),ft&&typeof ft.setStrictMode=="function")try{ft.setStrictMode(on,e)}catch{}}var mt=Math.clz32?Math.clz32:bt,ia=Math.log,Ue=Math.LN2;function bt(e){return e>>>=0,e===0?32:31-(ia(e)/Ue|0)|0}var sa=256,oa=262144,ca=4194304;function jn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ua(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var c=0,d=e.suspendedLanes,m=e.pingedLanes;e=e.warmLanes;var b=r&134217727;return b!==0?(r=b&~d,r!==0?c=jn(r):(m&=b,m!==0?c=jn(m):n||(n=b&~e,n!==0&&(c=jn(n))))):(b=r&~d,b!==0?c=jn(b):m!==0?c=jn(m):n||(n=r&~e,n!==0&&(c=jn(n)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,n=t&-t,d>=n||d===32&&(n&4194048)!==0)?t:c}function Kn(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function pr(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ul(){var e=ca;return ca<<=1,(ca&62914560)===0&&(ca=4194304),e}function Va(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ue(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function De(e,t,n,r,c,d){var m=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var b=e.entanglements,M=e.expirationTimes,_=e.hiddenUpdates;for(n=m&~n;0<n;){var K=31-mt(n),X=1<<K;b[K]=0,M[K]=-1;var U=_[K];if(U!==null)for(_[K]=null,K=0;K<U.length;K++){var B=U[K];B!==null&&(B.lane&=-536870913)}n&=~X}r!==0&&Ot(e,r,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(m&~t))}function Ot(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-mt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Dn(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-mt(n),c=1<<r;c&t|e[r]&t&&(e[r]|=t),n&=~c}}function Xa(e,t){var n=t&-t;return n=(n&42)!==0?1:da(n),(n&(e.suspendedLanes|t))!==0?0:n}function da(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function fa(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Fa(){var e=te.p;return e!==0?e:(e=window.event,e===void 0?32:Kv(e.type))}function Za(e,t){var n=te.p;try{return te.p=e,t()}finally{te.p=n}}var ot=Math.random().toString(36).slice(2),$e="__reactFiber$"+ot,et="__reactProps$"+ot,ma="__reactContainer$"+ot,vr="__reactEvents$"+ot,ee="__reactListeners$"+ot,ae="__reactHandles$"+ot,ke="__reactResources$"+ot,tt="__reactMarker$"+ot;function Ja(e){delete e[$e],delete e[et],delete e[vr],delete e[ee],delete e[ae]}function Ll(e){var t=e[$e];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ma]||n[$e]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Av(e);e!==null;){if(n=e[$e])return n;e=Av(e)}return t}e=n,n=e.parentNode}return null}function ha(e){if(e=e[$e]||e[ma]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function cn(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(s(33))}function xr(e){var t=e[ke];return t||(t=e[ke]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function wt(e){e[tt]=!0}var om=new Set,cm={};function Bl(e,t){gr(e,t),gr(e+"Capture",t)}function gr(e,t){for(cm[e]=t,e=0;e<t.length;e++)om.add(t[e])}var Ub=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),um={},dm={};function Lb(e){return At.call(dm,e)?!0:At.call(um,e)?!1:Ub.test(e)?dm[e]=!0:(um[e]=!0,!1)}function Os(e,t,n){if(Lb(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Ds(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function pa(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+r)}}function Nn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function fm(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Bb(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var c=r.get,d=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(m){n=""+m,d.call(this,m)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(m){n=""+m},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jc(e){if(!e._valueTracker){var t=fm(e)?"checked":"value";e._valueTracker=Bb(e,t,""+e[t])}}function mm(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=fm(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Us(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var qb=/[\n"\\]/g;function wn(e){return e.replace(qb,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Nc(e,t,n,r,c,d,m,b){e.name="",m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"?e.type=m:e.removeAttribute("type"),t!=null?m==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Nn(t)):e.value!==""+Nn(t)&&(e.value=""+Nn(t)):m!=="submit"&&m!=="reset"||e.removeAttribute("value"),t!=null?wc(e,m,Nn(t)):n!=null?wc(e,m,Nn(n)):r!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.name=""+Nn(b):e.removeAttribute("name")}function hm(e,t,n,r,c,d,m,b){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||n!=null){if(!(d!=="submit"&&d!=="reset"||t!=null)){jc(e);return}n=n!=null?""+Nn(n):"",t=t!=null?""+Nn(t):n,b||t===e.value||(e.value=t),e.defaultValue=t}r=r??c,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=b?e.checked:!!r,e.defaultChecked=!!r,m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(e.name=m),jc(e)}function wc(e,t,n){t==="number"&&Us(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function br(e,t,n,r){if(e=e.options,t){t={};for(var c=0;c<n.length;c++)t["$"+n[c]]=!0;for(n=0;n<e.length;n++)c=t.hasOwnProperty("$"+e[n].value),e[n].selected!==c&&(e[n].selected=c),c&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Nn(n),t=null,c=0;c<e.length;c++){if(e[c].value===n){e[c].selected=!0,r&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function pm(e,t,n){if(t!=null&&(t=""+Nn(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+Nn(n):""}function vm(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(s(92));if(fe(r)){if(1<r.length)throw Error(s(93));r=r[0]}n=r}n==null&&(n=""),t=n}n=Nn(t),e.defaultValue=n,r=e.textContent,r===n&&r!==""&&r!==null&&(e.value=r),jc(e)}function yr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var $b=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function xm(e,t,n){var r=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,n):typeof n!="number"||n===0||$b.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function gm(e,t,n){if(t!=null&&typeof t!="object")throw Error(s(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var c in t)r=t[c],t.hasOwnProperty(c)&&n[c]!==r&&xm(e,c,r)}else for(var d in t)t.hasOwnProperty(d)&&xm(e,d,t[d])}function Mc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Hb=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),Qb=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ls(e){return Qb.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function va(){}var Cc=null;function Tc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Sr=null,jr=null;function bm(e){var t=ha(e);if(t&&(e=t.stateNode)){var n=e[et]||null;e:switch(e=t.stateNode,t.type){case"input":if(Nc(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+wn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var c=r[et]||null;if(!c)throw Error(s(90));Nc(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&mm(r)}break e;case"textarea":pm(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&br(e,!!n.multiple,t,!1)}}}var Ac=!1;function ym(e,t,n){if(Ac)return e(t,n);Ac=!0;try{var r=e(t);return r}finally{if(Ac=!1,(Sr!==null||jr!==null)&&(Mo(),Sr&&(t=Sr,e=jr,jr=Sr=null,bm(t),e)))for(t=0;t<e.length;t++)bm(e[t])}}function bi(e,t){var n=e.stateNode;if(n===null)return null;var r=n[et]||null;if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(s(231,t,typeof n));return n}var xa=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ec=!1;if(xa)try{var yi={};Object.defineProperty(yi,"passive",{get:function(){Ec=!0}}),window.addEventListener("test",yi,yi),window.removeEventListener("test",yi,yi)}catch{Ec=!1}var Ia=null,kc=null,Bs=null;function Sm(){if(Bs)return Bs;var e,t=kc,n=t.length,r,c="value"in Ia?Ia.value:Ia.textContent,d=c.length;for(e=0;e<n&&t[e]===c[e];e++);var m=n-e;for(r=1;r<=m&&t[n-r]===c[d-r];r++);return Bs=c.slice(e,1<r?1-r:void 0)}function qs(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function $s(){return!0}function jm(){return!1}function Vt(e){function t(n,r,c,d,m){this._reactName=n,this._targetInst=c,this.type=r,this.nativeEvent=d,this.target=m,this.currentTarget=null;for(var b in e)e.hasOwnProperty(b)&&(n=e[b],this[b]=n?n(d):d[b]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?$s:jm,this.isPropagationStopped=jm,this}return g(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=$s)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=$s)},persist:function(){},isPersistent:$s}),t}var ql={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Hs=Vt(ql),Si=g({},ql,{view:0,detail:0}),Pb=Vt(Si),Rc,zc,ji,Qs=g({},Si,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Oc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==ji&&(ji&&e.type==="mousemove"?(Rc=e.screenX-ji.screenX,zc=e.screenY-ji.screenY):zc=Rc=0,ji=e),Rc)},movementY:function(e){return"movementY"in e?e.movementY:zc}}),Nm=Vt(Qs),Kb=g({},Qs,{dataTransfer:0}),Yb=Vt(Kb),Gb=g({},Si,{relatedTarget:0}),_c=Vt(Gb),Vb=g({},ql,{animationName:0,elapsedTime:0,pseudoElement:0}),Xb=Vt(Vb),Fb=g({},ql,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Zb=Vt(Fb),Jb=g({},ql,{data:0}),wm=Vt(Jb),Ib={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Wb={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},ey={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ty(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ey[e])?!!t[e]:!1}function Oc(){return ty}var ny=g({},Si,{key:function(e){if(e.key){var t=Ib[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=qs(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Wb[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Oc,charCode:function(e){return e.type==="keypress"?qs(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?qs(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ay=Vt(ny),ly=g({},Qs,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Mm=Vt(ly),ry=g({},Si,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Oc}),iy=Vt(ry),sy=g({},ql,{propertyName:0,elapsedTime:0,pseudoElement:0}),oy=Vt(sy),cy=g({},Qs,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),uy=Vt(cy),dy=g({},ql,{newState:0,oldState:0}),fy=Vt(dy),my=[9,13,27,32],Dc=xa&&"CompositionEvent"in window,Ni=null;xa&&"documentMode"in document&&(Ni=document.documentMode);var hy=xa&&"TextEvent"in window&&!Ni,Cm=xa&&(!Dc||Ni&&8<Ni&&11>=Ni),Tm=" ",Am=!1;function Em(e,t){switch(e){case"keyup":return my.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function km(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Nr=!1;function py(e,t){switch(e){case"compositionend":return km(t);case"keypress":return t.which!==32?null:(Am=!0,Tm);case"textInput":return e=t.data,e===Tm&&Am?null:e;default:return null}}function vy(e,t){if(Nr)return e==="compositionend"||!Dc&&Em(e,t)?(e=Sm(),Bs=kc=Ia=null,Nr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Cm&&t.locale!=="ko"?null:t.data;default:return null}}var xy={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Rm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!xy[e.type]:t==="textarea"}function zm(e,t,n,r){Sr?jr?jr.push(r):jr=[r]:Sr=r,t=zo(t,"onChange"),0<t.length&&(n=new Hs("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var wi=null,Mi=null;function gy(e){hv(e,0)}function Ps(e){var t=cn(e);if(mm(t))return e}function _m(e,t){if(e==="change")return t}var Om=!1;if(xa){var Uc;if(xa){var Lc="oninput"in document;if(!Lc){var Dm=document.createElement("div");Dm.setAttribute("oninput","return;"),Lc=typeof Dm.oninput=="function"}Uc=Lc}else Uc=!1;Om=Uc&&(!document.documentMode||9<document.documentMode)}function Um(){wi&&(wi.detachEvent("onpropertychange",Lm),Mi=wi=null)}function Lm(e){if(e.propertyName==="value"&&Ps(Mi)){var t=[];zm(t,Mi,e,Tc(e)),ym(gy,t)}}function by(e,t,n){e==="focusin"?(Um(),wi=t,Mi=n,wi.attachEvent("onpropertychange",Lm)):e==="focusout"&&Um()}function yy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ps(Mi)}function Sy(e,t){if(e==="click")return Ps(t)}function jy(e,t){if(e==="input"||e==="change")return Ps(t)}function Ny(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var un=typeof Object.is=="function"?Object.is:Ny;function Ci(e,t){if(un(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var c=n[r];if(!At.call(t,c)||!un(e[c],t[c]))return!1}return!0}function Bm(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function qm(e,t){var n=Bm(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Bm(n)}}function $m(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?$m(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Hm(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Us(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Us(e.document)}return t}function Bc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var wy=xa&&"documentMode"in document&&11>=document.documentMode,wr=null,qc=null,Ti=null,$c=!1;function Qm(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$c||wr==null||wr!==Us(r)||(r=wr,"selectionStart"in r&&Bc(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ti&&Ci(Ti,r)||(Ti=r,r=zo(qc,"onSelect"),0<r.length&&(t=new Hs("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=wr)))}function $l(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Mr={animationend:$l("Animation","AnimationEnd"),animationiteration:$l("Animation","AnimationIteration"),animationstart:$l("Animation","AnimationStart"),transitionrun:$l("Transition","TransitionRun"),transitionstart:$l("Transition","TransitionStart"),transitioncancel:$l("Transition","TransitionCancel"),transitionend:$l("Transition","TransitionEnd")},Hc={},Pm={};xa&&(Pm=document.createElement("div").style,"AnimationEvent"in window||(delete Mr.animationend.animation,delete Mr.animationiteration.animation,delete Mr.animationstart.animation),"TransitionEvent"in window||delete Mr.transitionend.transition);function Hl(e){if(Hc[e])return Hc[e];if(!Mr[e])return e;var t=Mr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Pm)return Hc[e]=t[n];return e}var Km=Hl("animationend"),Ym=Hl("animationiteration"),Gm=Hl("animationstart"),My=Hl("transitionrun"),Cy=Hl("transitionstart"),Ty=Hl("transitioncancel"),Vm=Hl("transitionend"),Xm=new Map,Qc="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Qc.push("scrollEnd");function Un(e,t){Xm.set(e,t),Bl(t,[e])}var Ks=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Mn=[],Cr=0,Pc=0;function Ys(){for(var e=Cr,t=Pc=Cr=0;t<e;){var n=Mn[t];Mn[t++]=null;var r=Mn[t];Mn[t++]=null;var c=Mn[t];Mn[t++]=null;var d=Mn[t];if(Mn[t++]=null,r!==null&&c!==null){var m=r.pending;m===null?c.next=c:(c.next=m.next,m.next=c),r.pending=c}d!==0&&Fm(n,c,d)}}function Gs(e,t,n,r){Mn[Cr++]=e,Mn[Cr++]=t,Mn[Cr++]=n,Mn[Cr++]=r,Pc|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Kc(e,t,n,r){return Gs(e,t,n,r),Vs(e)}function Ql(e,t){return Gs(e,null,null,t),Vs(e)}function Fm(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var c=!1,d=e.return;d!==null;)d.childLanes|=n,r=d.alternate,r!==null&&(r.childLanes|=n),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-mt(n),e=d.hiddenUpdates,r=e[c],r===null?e[c]=[t]:r.push(t),t.lane=n|536870912),d):null}function Vs(e){if(50<Fi)throw Fi=0,Wu=null,Error(s(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Tr={};function Ay(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function dn(e,t,n,r){return new Ay(e,t,n,r)}function Yc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ga(e,t){var n=e.alternate;return n===null?(n=dn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Zm(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Xs(e,t,n,r,c,d){var m=0;if(r=e,typeof e=="function")Yc(e)&&(m=1);else if(typeof e=="string")m=_0(e,n,le.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case I:return e=dn(31,n,t,c),e.elementType=I,e.lanes=d,e;case E:return Pl(n.children,c,d,t);case D:m=8,c|=24;break;case R:return e=dn(12,n,t,c|2),e.elementType=R,e.lanes=d,e;case G:return e=dn(13,n,t,c),e.elementType=G,e.lanes=d,e;case Q:return e=dn(19,n,t,c),e.elementType=Q,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case H:m=10;break e;case L:m=9;break e;case P:m=11;break e;case q:m=14;break e;case W:m=16,r=null;break e}m=29,n=Error(s(130,e===null?"null":typeof e,"")),r=null}return t=dn(m,n,t,c),t.elementType=e,t.type=r,t.lanes=d,t}function Pl(e,t,n,r){return e=dn(7,e,r,t),e.lanes=n,e}function Gc(e,t,n){return e=dn(6,e,null,t),e.lanes=n,e}function Jm(e){var t=dn(18,null,null,0);return t.stateNode=e,t}function Vc(e,t,n){return t=dn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Im=new WeakMap;function Cn(e,t){if(typeof e=="object"&&e!==null){var n=Im.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Bt(t)},Im.set(e,t),t)}return{value:e,source:t,stack:Bt(t)}}var Ar=[],Er=0,Fs=null,Ai=0,Tn=[],An=0,Wa=null,Yn=1,Gn="";function ba(e,t){Ar[Er++]=Ai,Ar[Er++]=Fs,Fs=e,Ai=t}function Wm(e,t,n){Tn[An++]=Yn,Tn[An++]=Gn,Tn[An++]=Wa,Wa=e;var r=Yn;e=Gn;var c=32-mt(r)-1;r&=~(1<<c),n+=1;var d=32-mt(t)+c;if(30<d){var m=c-c%5;d=(r&(1<<m)-1).toString(32),r>>=m,c-=m,Yn=1<<32-mt(t)+c|n<<c|r,Gn=d+e}else Yn=1<<d|n<<c|r,Gn=e}function Xc(e){e.return!==null&&(ba(e,1),Wm(e,1,0))}function Fc(e){for(;e===Fs;)Fs=Ar[--Er],Ar[Er]=null,Ai=Ar[--Er],Ar[Er]=null;for(;e===Wa;)Wa=Tn[--An],Tn[An]=null,Gn=Tn[--An],Tn[An]=null,Yn=Tn[--An],Tn[An]=null}function eh(e,t){Tn[An++]=Yn,Tn[An++]=Gn,Tn[An++]=Wa,Yn=t.id,Gn=t.overflow,Wa=e}var Et=null,Ze=null,Re=!1,el=null,En=!1,Zc=Error(s(519));function tl(e){var t=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ei(Cn(t,e)),Zc}function th(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[$e]=e,t[et]=r,n){case"dialog":Te("cancel",t),Te("close",t);break;case"iframe":case"object":case"embed":Te("load",t);break;case"video":case"audio":for(n=0;n<Ji.length;n++)Te(Ji[n],t);break;case"source":Te("error",t);break;case"img":case"image":case"link":Te("error",t),Te("load",t);break;case"details":Te("toggle",t);break;case"input":Te("invalid",t),hm(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Te("invalid",t);break;case"textarea":Te("invalid",t),vm(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||r.suppressHydrationWarning===!0||gv(t.textContent,n)?(r.popover!=null&&(Te("beforetoggle",t),Te("toggle",t)),r.onScroll!=null&&Te("scroll",t),r.onScrollEnd!=null&&Te("scrollend",t),r.onClick!=null&&(t.onclick=va),t=!0):t=!1,t||tl(e,!0)}function nh(e){for(Et=e.return;Et;)switch(Et.tag){case 5:case 31:case 13:En=!1;return;case 27:case 3:En=!0;return;default:Et=Et.return}}function kr(e){if(e!==Et)return!1;if(!Re)return nh(e),Re=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||hd(e.type,e.memoizedProps)),n=!n),n&&Ze&&tl(e),nh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Ze=Tv(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(317));Ze=Tv(e)}else t===27?(t=Ze,pl(e.type)?(e=bd,bd=null,Ze=e):Ze=t):Ze=Et?Rn(e.stateNode.nextSibling):null;return!0}function Kl(){Ze=Et=null,Re=!1}function Jc(){var e=el;return e!==null&&(Jt===null?Jt=e:Jt.push.apply(Jt,e),el=null),e}function Ei(e){el===null?el=[e]:el.push(e)}var Ic=w(null),Yl=null,ya=null;function nl(e,t,n){V(Ic,t._currentValue),t._currentValue=n}function Sa(e){e._currentValue=Ic.current,$(Ic)}function Wc(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function eu(e,t,n,r){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var m=c.child;d=d.firstContext;e:for(;d!==null;){var b=d;d=c;for(var M=0;M<t.length;M++)if(b.context===t[M]){d.lanes|=n,b=d.alternate,b!==null&&(b.lanes|=n),Wc(d.return,n,e),r||(m=null);break e}d=b.next}}else if(c.tag===18){if(m=c.return,m===null)throw Error(s(341));m.lanes|=n,d=m.alternate,d!==null&&(d.lanes|=n),Wc(m,n,e),m=null}else m=c.child;if(m!==null)m.return=c;else for(m=c;m!==null;){if(m===e){m=null;break}if(c=m.sibling,c!==null){c.return=m.return,m=c;break}m=m.return}c=m}}function Rr(e,t,n,r){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var m=c.alternate;if(m===null)throw Error(s(387));if(m=m.memoizedProps,m!==null){var b=c.type;un(c.pendingProps.value,m.value)||(e!==null?e.push(b):e=[b])}}else if(c===be.current){if(m=c.alternate,m===null)throw Error(s(387));m.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(ns):e=[ns])}c=c.return}e!==null&&eu(t,e,n,r),t.flags|=262144}function Zs(e){for(e=e.firstContext;e!==null;){if(!un(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Gl(e){Yl=e,ya=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function kt(e){return ah(Yl,e)}function Js(e,t){return Yl===null&&Gl(e),ah(e,t)}function ah(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ya===null){if(e===null)throw Error(s(308));ya=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ya=ya.next=t;return n}var Ey=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},ky=a.unstable_scheduleCallback,Ry=a.unstable_NormalPriority,ht={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function tu(){return{controller:new Ey,data:new Map,refCount:0}}function ki(e){e.refCount--,e.refCount===0&&ky(Ry,function(){e.controller.abort()})}var Ri=null,nu=0,zr=0,_r=null;function zy(e,t){if(Ri===null){var n=Ri=[];nu=0,zr=rd(),_r={status:"pending",value:void 0,then:function(r){n.push(r)}}}return nu++,t.then(lh,lh),t}function lh(){if(--nu===0&&Ri!==null){_r!==null&&(_r.status="fulfilled");var e=Ri;Ri=null,zr=0,_r=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function _y(e,t){var n=[],r={status:"pending",value:null,reason:null,then:function(c){n.push(c)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var c=0;c<n.length;c++)(0,n[c])(t)},function(c){for(r.status="rejected",r.reason=c,c=0;c<n.length;c++)(0,n[c])(void 0)}),r}var rh=O.S;O.S=function(e,t){Qp=at(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&zy(e,t),rh!==null&&rh(e,t)};var Vl=w(null);function au(){var e=Vl.current;return e!==null?e:Fe.pooledCache}function Is(e,t){t===null?V(Vl,Vl.current):V(Vl,t.pool)}function ih(){var e=au();return e===null?null:{parent:ht._currentValue,pool:e}}var Or=Error(s(460)),lu=Error(s(474)),Ws=Error(s(542)),eo={then:function(){}};function sh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function oh(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(va,va),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,uh(e),e;default:if(typeof t.status=="string")t.then(va,va);else{if(e=Fe,e!==null&&100<e.shellSuspendCounter)throw Error(s(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=r}},function(r){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,uh(e),e}throw Fl=t,Or}}function Xl(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Fl=n,Or):n}}var Fl=null;function ch(){if(Fl===null)throw Error(s(459));var e=Fl;return Fl=null,e}function uh(e){if(e===Or||e===Ws)throw Error(s(483))}var Dr=null,zi=0;function to(e){var t=zi;return zi+=1,Dr===null&&(Dr=[]),oh(Dr,e,t)}function _i(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function no(e,t){throw t.$$typeof===j?Error(s(525)):(e=Object.prototype.toString.call(t),Error(s(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function dh(e){function t(k,A){if(e){var z=k.deletions;z===null?(k.deletions=[A],k.flags|=16):z.push(A)}}function n(k,A){if(!e)return null;for(;A!==null;)t(k,A),A=A.sibling;return null}function r(k){for(var A=new Map;k!==null;)k.key!==null?A.set(k.key,k):A.set(k.index,k),k=k.sibling;return A}function c(k,A){return k=ga(k,A),k.index=0,k.sibling=null,k}function d(k,A,z){return k.index=z,e?(z=k.alternate,z!==null?(z=z.index,z<A?(k.flags|=67108866,A):z):(k.flags|=67108866,A)):(k.flags|=1048576,A)}function m(k){return e&&k.alternate===null&&(k.flags|=67108866),k}function b(k,A,z,Y){return A===null||A.tag!==6?(A=Gc(z,k.mode,Y),A.return=k,A):(A=c(A,z),A.return=k,A)}function M(k,A,z,Y){var me=z.type;return me===E?K(k,A,z.props.children,Y,z.key):A!==null&&(A.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===W&&Xl(me)===A.type)?(A=c(A,z.props),_i(A,z),A.return=k,A):(A=Xs(z.type,z.key,z.props,null,k.mode,Y),_i(A,z),A.return=k,A)}function _(k,A,z,Y){return A===null||A.tag!==4||A.stateNode.containerInfo!==z.containerInfo||A.stateNode.implementation!==z.implementation?(A=Vc(z,k.mode,Y),A.return=k,A):(A=c(A,z.children||[]),A.return=k,A)}function K(k,A,z,Y,me){return A===null||A.tag!==7?(A=Pl(z,k.mode,Y,me),A.return=k,A):(A=c(A,z),A.return=k,A)}function X(k,A,z){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return A=Gc(""+A,k.mode,z),A.return=k,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case N:return z=Xs(A.type,A.key,A.props,null,k.mode,z),_i(z,A),z.return=k,z;case T:return A=Vc(A,k.mode,z),A.return=k,A;case W:return A=Xl(A),X(k,A,z)}if(fe(A)||J(A))return A=Pl(A,k.mode,z,null),A.return=k,A;if(typeof A.then=="function")return X(k,to(A),z);if(A.$$typeof===H)return X(k,Js(k,A),z);no(k,A)}return null}function U(k,A,z,Y){var me=A!==null?A.key:null;if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return me!==null?null:b(k,A,""+z,Y);if(typeof z=="object"&&z!==null){switch(z.$$typeof){case N:return z.key===me?M(k,A,z,Y):null;case T:return z.key===me?_(k,A,z,Y):null;case W:return z=Xl(z),U(k,A,z,Y)}if(fe(z)||J(z))return me!==null?null:K(k,A,z,Y,null);if(typeof z.then=="function")return U(k,A,to(z),Y);if(z.$$typeof===H)return U(k,A,Js(k,z),Y);no(k,z)}return null}function B(k,A,z,Y,me){if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return k=k.get(z)||null,b(A,k,""+Y,me);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case N:return k=k.get(Y.key===null?z:Y.key)||null,M(A,k,Y,me);case T:return k=k.get(Y.key===null?z:Y.key)||null,_(A,k,Y,me);case W:return Y=Xl(Y),B(k,A,z,Y,me)}if(fe(Y)||J(Y))return k=k.get(z)||null,K(A,k,Y,me,null);if(typeof Y.then=="function")return B(k,A,z,to(Y),me);if(Y.$$typeof===H)return B(k,A,z,Js(A,Y),me);no(A,Y)}return null}function oe(k,A,z,Y){for(var me=null,Le=null,ce=A,Ne=A=0,Ee=null;ce!==null&&Ne<z.length;Ne++){ce.index>Ne?(Ee=ce,ce=null):Ee=ce.sibling;var Be=U(k,ce,z[Ne],Y);if(Be===null){ce===null&&(ce=Ee);break}e&&ce&&Be.alternate===null&&t(k,ce),A=d(Be,A,Ne),Le===null?me=Be:Le.sibling=Be,Le=Be,ce=Ee}if(Ne===z.length)return n(k,ce),Re&&ba(k,Ne),me;if(ce===null){for(;Ne<z.length;Ne++)ce=X(k,z[Ne],Y),ce!==null&&(A=d(ce,A,Ne),Le===null?me=ce:Le.sibling=ce,Le=ce);return Re&&ba(k,Ne),me}for(ce=r(ce);Ne<z.length;Ne++)Ee=B(ce,k,Ne,z[Ne],Y),Ee!==null&&(e&&Ee.alternate!==null&&ce.delete(Ee.key===null?Ne:Ee.key),A=d(Ee,A,Ne),Le===null?me=Ee:Le.sibling=Ee,Le=Ee);return e&&ce.forEach(function(yl){return t(k,yl)}),Re&&ba(k,Ne),me}function xe(k,A,z,Y){if(z==null)throw Error(s(151));for(var me=null,Le=null,ce=A,Ne=A=0,Ee=null,Be=z.next();ce!==null&&!Be.done;Ne++,Be=z.next()){ce.index>Ne?(Ee=ce,ce=null):Ee=ce.sibling;var yl=U(k,ce,Be.value,Y);if(yl===null){ce===null&&(ce=Ee);break}e&&ce&&yl.alternate===null&&t(k,ce),A=d(yl,A,Ne),Le===null?me=yl:Le.sibling=yl,Le=yl,ce=Ee}if(Be.done)return n(k,ce),Re&&ba(k,Ne),me;if(ce===null){for(;!Be.done;Ne++,Be=z.next())Be=X(k,Be.value,Y),Be!==null&&(A=d(Be,A,Ne),Le===null?me=Be:Le.sibling=Be,Le=Be);return Re&&ba(k,Ne),me}for(ce=r(ce);!Be.done;Ne++,Be=z.next())Be=B(ce,k,Ne,Be.value,Y),Be!==null&&(e&&Be.alternate!==null&&ce.delete(Be.key===null?Ne:Be.key),A=d(Be,A,Ne),Le===null?me=Be:Le.sibling=Be,Le=Be);return e&&ce.forEach(function(K0){return t(k,K0)}),Re&&ba(k,Ne),me}function Ve(k,A,z,Y){if(typeof z=="object"&&z!==null&&z.type===E&&z.key===null&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case N:e:{for(var me=z.key;A!==null;){if(A.key===me){if(me=z.type,me===E){if(A.tag===7){n(k,A.sibling),Y=c(A,z.props.children),Y.return=k,k=Y;break e}}else if(A.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===W&&Xl(me)===A.type){n(k,A.sibling),Y=c(A,z.props),_i(Y,z),Y.return=k,k=Y;break e}n(k,A);break}else t(k,A);A=A.sibling}z.type===E?(Y=Pl(z.props.children,k.mode,Y,z.key),Y.return=k,k=Y):(Y=Xs(z.type,z.key,z.props,null,k.mode,Y),_i(Y,z),Y.return=k,k=Y)}return m(k);case T:e:{for(me=z.key;A!==null;){if(A.key===me)if(A.tag===4&&A.stateNode.containerInfo===z.containerInfo&&A.stateNode.implementation===z.implementation){n(k,A.sibling),Y=c(A,z.children||[]),Y.return=k,k=Y;break e}else{n(k,A);break}else t(k,A);A=A.sibling}Y=Vc(z,k.mode,Y),Y.return=k,k=Y}return m(k);case W:return z=Xl(z),Ve(k,A,z,Y)}if(fe(z))return oe(k,A,z,Y);if(J(z)){if(me=J(z),typeof me!="function")throw Error(s(150));return z=me.call(z),xe(k,A,z,Y)}if(typeof z.then=="function")return Ve(k,A,to(z),Y);if(z.$$typeof===H)return Ve(k,A,Js(k,z),Y);no(k,z)}return typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint"?(z=""+z,A!==null&&A.tag===6?(n(k,A.sibling),Y=c(A,z),Y.return=k,k=Y):(n(k,A),Y=Gc(z,k.mode,Y),Y.return=k,k=Y),m(k)):n(k,A)}return function(k,A,z,Y){try{zi=0;var me=Ve(k,A,z,Y);return Dr=null,me}catch(ce){if(ce===Or||ce===Ws)throw ce;var Le=dn(29,ce,null,k.mode);return Le.lanes=Y,Le.return=k,Le}finally{}}}var Zl=dh(!0),fh=dh(!1),al=!1;function ru(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function iu(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ll(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function rl(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(qe&2)!==0){var c=r.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),r.pending=t,t=Vs(e),Fm(e,null,n),t}return Gs(e,r,t,n),Vs(e)}function Oi(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Dn(e,n)}}function su(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var c=null,d=null;if(n=n.firstBaseUpdate,n!==null){do{var m={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};d===null?c=d=m:d=d.next=m,n=n.next}while(n!==null);d===null?c=d=t:d=d.next=t}else c=d=t;n={baseState:r.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var ou=!1;function Di(){if(ou){var e=_r;if(e!==null)throw e}}function Ui(e,t,n,r){ou=!1;var c=e.updateQueue;al=!1;var d=c.firstBaseUpdate,m=c.lastBaseUpdate,b=c.shared.pending;if(b!==null){c.shared.pending=null;var M=b,_=M.next;M.next=null,m===null?d=_:m.next=_,m=M;var K=e.alternate;K!==null&&(K=K.updateQueue,b=K.lastBaseUpdate,b!==m&&(b===null?K.firstBaseUpdate=_:b.next=_,K.lastBaseUpdate=M))}if(d!==null){var X=c.baseState;m=0,K=_=M=null,b=d;do{var U=b.lane&-536870913,B=U!==b.lane;if(B?(Ae&U)===U:(r&U)===U){U!==0&&U===zr&&(ou=!0),K!==null&&(K=K.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});e:{var oe=e,xe=b;U=t;var Ve=n;switch(xe.tag){case 1:if(oe=xe.payload,typeof oe=="function"){X=oe.call(Ve,X,U);break e}X=oe;break e;case 3:oe.flags=oe.flags&-65537|128;case 0:if(oe=xe.payload,U=typeof oe=="function"?oe.call(Ve,X,U):oe,U==null)break e;X=g({},X,U);break e;case 2:al=!0}}U=b.callback,U!==null&&(e.flags|=64,B&&(e.flags|=8192),B=c.callbacks,B===null?c.callbacks=[U]:B.push(U))}else B={lane:U,tag:b.tag,payload:b.payload,callback:b.callback,next:null},K===null?(_=K=B,M=X):K=K.next=B,m|=U;if(b=b.next,b===null){if(b=c.shared.pending,b===null)break;B=b,b=B.next,B.next=null,c.lastBaseUpdate=B,c.shared.pending=null}}while(!0);K===null&&(M=X),c.baseState=M,c.firstBaseUpdate=_,c.lastBaseUpdate=K,d===null&&(c.shared.lanes=0),ul|=m,e.lanes=m,e.memoizedState=X}}function mh(e,t){if(typeof e!="function")throw Error(s(191,e));e.call(t)}function hh(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)mh(n[e],t)}var Ur=w(null),ao=w(0);function ph(e,t){e=ka,V(ao,e),V(Ur,t),ka=e|t.baseLanes}function cu(){V(ao,ka),V(Ur,Ur.current)}function uu(){ka=ao.current,$(Ur),$(ao)}var fn=w(null),kn=null;function il(e){var t=e.alternate;V(ct,ct.current&1),V(fn,e),kn===null&&(t===null||Ur.current!==null||t.memoizedState!==null)&&(kn=e)}function du(e){V(ct,ct.current),V(fn,e),kn===null&&(kn=e)}function vh(e){e.tag===22?(V(ct,ct.current),V(fn,e),kn===null&&(kn=e)):sl()}function sl(){V(ct,ct.current),V(fn,fn.current)}function mn(e){$(fn),kn===e&&(kn=null),$(ct)}var ct=w(0);function lo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||xd(n)||gd(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ja=0,je=null,Ye=null,pt=null,ro=!1,Lr=!1,Jl=!1,io=0,Li=0,Br=null,Oy=0;function lt(){throw Error(s(321))}function fu(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!un(e[n],t[n]))return!1;return!0}function mu(e,t,n,r,c,d){return ja=d,je=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,O.H=e===null||e.memoizedState===null?Wh:Au,Jl=!1,d=n(r,c),Jl=!1,Lr&&(d=gh(t,n,r,c)),xh(e),d}function xh(e){O.H=$i;var t=Ye!==null&&Ye.next!==null;if(ja=0,pt=Ye=je=null,ro=!1,Li=0,Br=null,t)throw Error(s(300));e===null||vt||(e=e.dependencies,e!==null&&Zs(e)&&(vt=!0))}function gh(e,t,n,r){je=e;var c=0;do{if(Lr&&(Br=null),Li=0,Lr=!1,25<=c)throw Error(s(301));if(c+=1,pt=Ye=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}O.H=ep,d=t(n,r)}while(Lr);return d}function Dy(){var e=O.H,t=e.useState()[0];return t=typeof t.then=="function"?Bi(t):t,e=e.useState()[0],(Ye!==null?Ye.memoizedState:null)!==e&&(je.flags|=1024),t}function hu(){var e=io!==0;return io=0,e}function pu(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function vu(e){if(ro){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ro=!1}ja=0,pt=Ye=je=null,Lr=!1,Li=io=0,Br=null}function Ht(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pt===null?je.memoizedState=pt=e:pt=pt.next=e,pt}function ut(){if(Ye===null){var e=je.alternate;e=e!==null?e.memoizedState:null}else e=Ye.next;var t=pt===null?je.memoizedState:pt.next;if(t!==null)pt=t,Ye=e;else{if(e===null)throw je.alternate===null?Error(s(467)):Error(s(310));Ye=e,e={memoizedState:Ye.memoizedState,baseState:Ye.baseState,baseQueue:Ye.baseQueue,queue:Ye.queue,next:null},pt===null?je.memoizedState=pt=e:pt=pt.next=e}return pt}function so(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Bi(e){var t=Li;return Li+=1,Br===null&&(Br=[]),e=oh(Br,e,t),t=je,(pt===null?t.memoizedState:pt.next)===null&&(t=t.alternate,O.H=t===null||t.memoizedState===null?Wh:Au),e}function oo(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Bi(e);if(e.$$typeof===H)return kt(e)}throw Error(s(438,String(e)))}function xu(e){var t=null,n=je.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=je.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=so(),je.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=ne;return t.index++,n}function Na(e,t){return typeof t=="function"?t(e):t}function co(e){var t=ut();return gu(t,Ye,e)}function gu(e,t,n){var r=e.queue;if(r===null)throw Error(s(311));r.lastRenderedReducer=n;var c=e.baseQueue,d=r.pending;if(d!==null){if(c!==null){var m=c.next;c.next=d.next,d.next=m}t.baseQueue=c=d,r.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var b=m=null,M=null,_=t,K=!1;do{var X=_.lane&-536870913;if(X!==_.lane?(Ae&X)===X:(ja&X)===X){var U=_.revertLane;if(U===0)M!==null&&(M=M.next={lane:0,revertLane:0,gesture:null,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null}),X===zr&&(K=!0);else if((ja&U)===U){_=_.next,U===zr&&(K=!0);continue}else X={lane:0,revertLane:_.revertLane,gesture:null,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},M===null?(b=M=X,m=d):M=M.next=X,je.lanes|=U,ul|=U;X=_.action,Jl&&n(d,X),d=_.hasEagerState?_.eagerState:n(d,X)}else U={lane:X,revertLane:_.revertLane,gesture:_.gesture,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},M===null?(b=M=U,m=d):M=M.next=U,je.lanes|=X,ul|=X;_=_.next}while(_!==null&&_!==t);if(M===null?m=d:M.next=b,!un(d,e.memoizedState)&&(vt=!0,K&&(n=_r,n!==null)))throw n;e.memoizedState=d,e.baseState=m,e.baseQueue=M,r.lastRenderedState=d}return c===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function bu(e){var t=ut(),n=t.queue;if(n===null)throw Error(s(311));n.lastRenderedReducer=e;var r=n.dispatch,c=n.pending,d=t.memoizedState;if(c!==null){n.pending=null;var m=c=c.next;do d=e(d,m.action),m=m.next;while(m!==c);un(d,t.memoizedState)||(vt=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),n.lastRenderedState=d}return[d,r]}function bh(e,t,n){var r=je,c=ut(),d=Re;if(d){if(n===void 0)throw Error(s(407));n=n()}else n=t();var m=!un((Ye||c).memoizedState,n);if(m&&(c.memoizedState=n,vt=!0),c=c.queue,ju(jh.bind(null,r,c,e),[e]),c.getSnapshot!==t||m||pt!==null&&pt.memoizedState.tag&1){if(r.flags|=2048,qr(9,{destroy:void 0},Sh.bind(null,r,c,n,t),null),Fe===null)throw Error(s(349));d||(ja&127)!==0||yh(r,t,n)}return n}function yh(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=je.updateQueue,t===null?(t=so(),je.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Sh(e,t,n,r){t.value=n,t.getSnapshot=r,Nh(t)&&wh(e)}function jh(e,t,n){return n(function(){Nh(t)&&wh(e)})}function Nh(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!un(e,n)}catch{return!0}}function wh(e){var t=Ql(e,2);t!==null&&It(t,e,2)}function yu(e){var t=Ht();if(typeof e=="function"){var n=e;if(e=n(),Jl){$t(!0);try{n()}finally{$t(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:e},t}function Mh(e,t,n,r){return e.baseState=n,gu(e,Ye,typeof r=="function"?r:Na)}function Uy(e,t,n,r,c){if(mo(e))throw Error(s(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(m){d.listeners.push(m)}};O.T!==null?n(!0):d.isTransition=!1,r(d),n=t.pending,n===null?(d.next=t.pending=d,Ch(t,d)):(d.next=n.next,t.pending=n.next=d)}}function Ch(e,t){var n=t.action,r=t.payload,c=e.state;if(t.isTransition){var d=O.T,m={};O.T=m;try{var b=n(c,r),M=O.S;M!==null&&M(m,b),Th(e,t,b)}catch(_){Su(e,t,_)}finally{d!==null&&m.types!==null&&(d.types=m.types),O.T=d}}else try{d=n(c,r),Th(e,t,d)}catch(_){Su(e,t,_)}}function Th(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){Ah(e,t,r)},function(r){return Su(e,t,r)}):Ah(e,t,n)}function Ah(e,t,n){t.status="fulfilled",t.value=n,Eh(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ch(e,n)))}function Su(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=n,Eh(t),t=t.next;while(t!==r)}e.action=null}function Eh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function kh(e,t){return t}function Rh(e,t){if(Re){var n=Fe.formState;if(n!==null){e:{var r=je;if(Re){if(Ze){t:{for(var c=Ze,d=En;c.nodeType!==8;){if(!d){c=null;break t}if(c=Rn(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){Ze=Rn(c.nextSibling),r=c.data==="F!";break e}}tl(r)}r=!1}r&&(t=n[0])}}return n=Ht(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:kh,lastRenderedState:t},n.queue=r,n=Zh.bind(null,je,r),r.dispatch=n,r=yu(!1),d=Tu.bind(null,je,!1,r.queue),r=Ht(),c={state:t,dispatch:null,action:e,pending:null},r.queue=c,n=Uy.bind(null,je,c,d,n),c.dispatch=n,r.memoizedState=e,[t,n,!1]}function zh(e){var t=ut();return _h(t,Ye,e)}function _h(e,t,n){if(t=gu(e,t,kh)[0],e=co(Na)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=Bi(t)}catch(m){throw m===Or?Ws:m}else r=t;t=ut();var c=t.queue,d=c.dispatch;return n!==t.memoizedState&&(je.flags|=2048,qr(9,{destroy:void 0},Ly.bind(null,c,n),null)),[r,d,e]}function Ly(e,t){e.action=t}function Oh(e){var t=ut(),n=Ye;if(n!==null)return _h(t,n,e);ut(),t=t.memoizedState,n=ut();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function qr(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=je.updateQueue,t===null&&(t=so(),je.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Dh(){return ut().memoizedState}function uo(e,t,n,r){var c=Ht();je.flags|=e,c.memoizedState=qr(1|t,{destroy:void 0},n,r===void 0?null:r)}function fo(e,t,n,r){var c=ut();r=r===void 0?null:r;var d=c.memoizedState.inst;Ye!==null&&r!==null&&fu(r,Ye.memoizedState.deps)?c.memoizedState=qr(t,d,n,r):(je.flags|=e,c.memoizedState=qr(1|t,d,n,r))}function Uh(e,t){uo(8390656,8,e,t)}function ju(e,t){fo(2048,8,e,t)}function By(e){je.flags|=4;var t=je.updateQueue;if(t===null)t=so(),je.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Lh(e){var t=ut().memoizedState;return By({ref:t,nextImpl:e}),function(){if((qe&2)!==0)throw Error(s(440));return t.impl.apply(void 0,arguments)}}function Bh(e,t){return fo(4,2,e,t)}function qh(e,t){return fo(4,4,e,t)}function $h(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Hh(e,t,n){n=n!=null?n.concat([e]):null,fo(4,4,$h.bind(null,t,e),n)}function Nu(){}function Qh(e,t){var n=ut();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&fu(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ph(e,t){var n=ut();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&fu(t,r[1]))return r[0];if(r=e(),Jl){$t(!0);try{e()}finally{$t(!1)}}return n.memoizedState=[r,t],r}function wu(e,t,n){return n===void 0||(ja&1073741824)!==0&&(Ae&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Kp(),je.lanes|=e,ul|=e,n)}function Kh(e,t,n,r){return un(n,t)?n:Ur.current!==null?(e=wu(e,n,r),un(e,t)||(vt=!0),e):(ja&42)===0||(ja&1073741824)!==0&&(Ae&261930)===0?(vt=!0,e.memoizedState=n):(e=Kp(),je.lanes|=e,ul|=e,t)}function Yh(e,t,n,r,c){var d=te.p;te.p=d!==0&&8>d?d:8;var m=O.T,b={};O.T=b,Tu(e,!1,t,n);try{var M=c(),_=O.S;if(_!==null&&_(b,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var K=_y(M,r);qi(e,t,K,vn(e))}else qi(e,t,r,vn(e))}catch(X){qi(e,t,{then:function(){},status:"rejected",reason:X},vn())}finally{te.p=d,m!==null&&b.types!==null&&(m.types=b.types),O.T=m}}function qy(){}function Mu(e,t,n,r){if(e.tag!==5)throw Error(s(476));var c=Gh(e).queue;Yh(e,c,t,re,n===null?qy:function(){return Vh(e),n(r)})}function Gh(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:re},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Vh(e){var t=Gh(e);t.next===null&&(t=e.alternate.memoizedState),qi(e,t.next.queue,{},vn())}function Cu(){return kt(ns)}function Xh(){return ut().memoizedState}function Fh(){return ut().memoizedState}function $y(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=vn();e=ll(n);var r=rl(t,e,n);r!==null&&(It(r,t,n),Oi(r,t,n)),t={cache:tu()},e.payload=t;return}t=t.return}}function Hy(e,t,n){var r=vn();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},mo(e)?Jh(t,n):(n=Kc(e,t,n,r),n!==null&&(It(n,e,r),Ih(n,t,r)))}function Zh(e,t,n){var r=vn();qi(e,t,n,r)}function qi(e,t,n,r){var c={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(mo(e))Jh(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var m=t.lastRenderedState,b=d(m,n);if(c.hasEagerState=!0,c.eagerState=b,un(b,m))return Gs(e,t,c,0),Fe===null&&Ys(),!1}catch{}finally{}if(n=Kc(e,t,c,r),n!==null)return It(n,e,r),Ih(n,t,r),!0}return!1}function Tu(e,t,n,r){if(r={lane:2,revertLane:rd(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},mo(e)){if(t)throw Error(s(479))}else t=Kc(e,n,r,2),t!==null&&It(t,e,2)}function mo(e){var t=e.alternate;return e===je||t!==null&&t===je}function Jh(e,t){Lr=ro=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ih(e,t,n){if((n&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Dn(e,n)}}var $i={readContext:kt,use:oo,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useLayoutEffect:lt,useInsertionEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useSyncExternalStore:lt,useId:lt,useHostTransitionStatus:lt,useFormState:lt,useActionState:lt,useOptimistic:lt,useMemoCache:lt,useCacheRefresh:lt};$i.useEffectEvent=lt;var Wh={readContext:kt,use:oo,useCallback:function(e,t){return Ht().memoizedState=[e,t===void 0?null:t],e},useContext:kt,useEffect:Uh,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,uo(4194308,4,$h.bind(null,t,e),n)},useLayoutEffect:function(e,t){return uo(4194308,4,e,t)},useInsertionEffect:function(e,t){uo(4,2,e,t)},useMemo:function(e,t){var n=Ht();t=t===void 0?null:t;var r=e();if(Jl){$t(!0);try{e()}finally{$t(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=Ht();if(n!==void 0){var c=n(t);if(Jl){$t(!0);try{n(t)}finally{$t(!1)}}}else c=t;return r.memoizedState=r.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},r.queue=e,e=e.dispatch=Hy.bind(null,je,e),[r.memoizedState,e]},useRef:function(e){var t=Ht();return e={current:e},t.memoizedState=e},useState:function(e){e=yu(e);var t=e.queue,n=Zh.bind(null,je,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Nu,useDeferredValue:function(e,t){var n=Ht();return wu(n,e,t)},useTransition:function(){var e=yu(!1);return e=Yh.bind(null,je,e.queue,!0,!1),Ht().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=je,c=Ht();if(Re){if(n===void 0)throw Error(s(407));n=n()}else{if(n=t(),Fe===null)throw Error(s(349));(Ae&127)!==0||yh(r,t,n)}c.memoizedState=n;var d={value:n,getSnapshot:t};return c.queue=d,Uh(jh.bind(null,r,d,e),[e]),r.flags|=2048,qr(9,{destroy:void 0},Sh.bind(null,r,d,n,t),null),n},useId:function(){var e=Ht(),t=Fe.identifierPrefix;if(Re){var n=Gn,r=Yn;n=(r&~(1<<32-mt(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=io++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=Oy++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:Cu,useFormState:Rh,useActionState:Rh,useOptimistic:function(e){var t=Ht();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Tu.bind(null,je,!0,n),n.dispatch=t,[e,t]},useMemoCache:xu,useCacheRefresh:function(){return Ht().memoizedState=$y.bind(null,je)},useEffectEvent:function(e){var t=Ht(),n={impl:e};return t.memoizedState=n,function(){if((qe&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}},Au={readContext:kt,use:oo,useCallback:Qh,useContext:kt,useEffect:ju,useImperativeHandle:Hh,useInsertionEffect:Bh,useLayoutEffect:qh,useMemo:Ph,useReducer:co,useRef:Dh,useState:function(){return co(Na)},useDebugValue:Nu,useDeferredValue:function(e,t){var n=ut();return Kh(n,Ye.memoizedState,e,t)},useTransition:function(){var e=co(Na)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:Bi(e),t]},useSyncExternalStore:bh,useId:Xh,useHostTransitionStatus:Cu,useFormState:zh,useActionState:zh,useOptimistic:function(e,t){var n=ut();return Mh(n,Ye,e,t)},useMemoCache:xu,useCacheRefresh:Fh};Au.useEffectEvent=Lh;var ep={readContext:kt,use:oo,useCallback:Qh,useContext:kt,useEffect:ju,useImperativeHandle:Hh,useInsertionEffect:Bh,useLayoutEffect:qh,useMemo:Ph,useReducer:bu,useRef:Dh,useState:function(){return bu(Na)},useDebugValue:Nu,useDeferredValue:function(e,t){var n=ut();return Ye===null?wu(n,e,t):Kh(n,Ye.memoizedState,e,t)},useTransition:function(){var e=bu(Na)[0],t=ut().memoizedState;return[typeof e=="boolean"?e:Bi(e),t]},useSyncExternalStore:bh,useId:Xh,useHostTransitionStatus:Cu,useFormState:Oh,useActionState:Oh,useOptimistic:function(e,t){var n=ut();return Ye!==null?Mh(n,Ye,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:xu,useCacheRefresh:Fh};ep.useEffectEvent=Lh;function Eu(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:g({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ku={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=vn(),c=ll(r);c.payload=t,n!=null&&(c.callback=n),t=rl(e,c,r),t!==null&&(It(t,e,r),Oi(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=vn(),c=ll(r);c.tag=1,c.payload=t,n!=null&&(c.callback=n),t=rl(e,c,r),t!==null&&(It(t,e,r),Oi(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=vn(),r=ll(n);r.tag=2,t!=null&&(r.callback=t),t=rl(e,r,n),t!==null&&(It(t,e,n),Oi(t,e,n))}};function tp(e,t,n,r,c,d,m){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,d,m):t.prototype&&t.prototype.isPureReactComponent?!Ci(n,r)||!Ci(c,d):!0}function np(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ku.enqueueReplaceState(t,t.state,null)}function Il(e,t){var n=t;if("ref"in t){n={};for(var r in t)r!=="ref"&&(n[r]=t[r])}if(e=e.defaultProps){n===t&&(n=g({},n));for(var c in e)n[c]===void 0&&(n[c]=e[c])}return n}function ap(e){Ks(e)}function lp(e){console.error(e)}function rp(e){Ks(e)}function ho(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function ip(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function Ru(e,t,n){return n=ll(n),n.tag=3,n.payload={element:null},n.callback=function(){ho(e,t)},n}function sp(e){return e=ll(e),e.tag=3,e}function op(e,t,n,r){var c=n.type.getDerivedStateFromError;if(typeof c=="function"){var d=r.value;e.payload=function(){return c(d)},e.callback=function(){ip(t,n,r)}}var m=n.stateNode;m!==null&&typeof m.componentDidCatch=="function"&&(e.callback=function(){ip(t,n,r),typeof c!="function"&&(dl===null?dl=new Set([this]):dl.add(this));var b=r.stack;this.componentDidCatch(r.value,{componentStack:b!==null?b:""})})}function Qy(e,t,n,r,c){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=n.alternate,t!==null&&Rr(t,n,c,!0),n=fn.current,n!==null){switch(n.tag){case 31:case 13:return kn===null?Co():n.alternate===null&&rt===0&&(rt=3),n.flags&=-257,n.flags|=65536,n.lanes=c,r===eo?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),nd(e,r,c)),!1;case 22:return n.flags|=65536,r===eo?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),nd(e,r,c)),!1}throw Error(s(435,n.tag))}return nd(e,r,c),Co(),!1}if(Re)return t=fn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,r!==Zc&&(e=Error(s(422),{cause:r}),Ei(Cn(e,n)))):(r!==Zc&&(t=Error(s(423),{cause:r}),Ei(Cn(t,n))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,r=Cn(r,n),c=Ru(e.stateNode,r,c),su(e,c),rt!==4&&(rt=2)),!1;var d=Error(s(520),{cause:r});if(d=Cn(d,n),Xi===null?Xi=[d]:Xi.push(d),rt!==4&&(rt=2),t===null)return!0;r=Cn(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=c&-c,n.lanes|=e,e=Ru(n.stateNode,r,e),su(n,e),!1;case 1:if(t=n.type,d=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(dl===null||!dl.has(d))))return n.flags|=65536,c&=-c,n.lanes|=c,c=sp(c),op(c,e,n,r),su(n,c),!1}n=n.return}while(n!==null);return!1}var zu=Error(s(461)),vt=!1;function Rt(e,t,n,r){t.child=e===null?fh(t,null,n,r):Zl(t,e.child,n,r)}function cp(e,t,n,r,c){n=n.render;var d=t.ref;if("ref"in r){var m={};for(var b in r)b!=="ref"&&(m[b]=r[b])}else m=r;return Gl(t),r=mu(e,t,n,m,d,c),b=hu(),e!==null&&!vt?(pu(e,t,c),wa(e,t,c)):(Re&&b&&Xc(t),t.flags|=1,Rt(e,t,r,c),t.child)}function up(e,t,n,r,c){if(e===null){var d=n.type;return typeof d=="function"&&!Yc(d)&&d.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=d,dp(e,t,d,r,c)):(e=Xs(n.type,null,r,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!$u(e,c)){var m=d.memoizedProps;if(n=n.compare,n=n!==null?n:Ci,n(m,r)&&e.ref===t.ref)return wa(e,t,c)}return t.flags|=1,e=ga(d,r),e.ref=t.ref,e.return=t,t.child=e}function dp(e,t,n,r,c){if(e!==null){var d=e.memoizedProps;if(Ci(d,r)&&e.ref===t.ref)if(vt=!1,t.pendingProps=r=d,$u(e,c))(e.flags&131072)!==0&&(vt=!0);else return t.lanes=e.lanes,wa(e,t,c)}return _u(e,t,n,r,c)}function fp(e,t,n,r){var c=r.children,d=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(d=d!==null?d.baseLanes|n:n,e!==null){for(r=t.child=e.child,c=0;r!==null;)c=c|r.lanes|r.childLanes,r=r.sibling;r=c&~d}else r=0,t.child=null;return mp(e,t,d,n,r)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Is(t,d!==null?d.cachePool:null),d!==null?ph(t,d):cu(),vh(t);else return r=t.lanes=536870912,mp(e,t,d!==null?d.baseLanes|n:n,n,r)}else d!==null?(Is(t,d.cachePool),ph(t,d),sl(),t.memoizedState=null):(e!==null&&Is(t,null),cu(),sl());return Rt(e,t,c,n),t.child}function Hi(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function mp(e,t,n,r,c){var d=au();return d=d===null?null:{parent:ht._currentValue,pool:d},t.memoizedState={baseLanes:n,cachePool:d},e!==null&&Is(t,null),cu(),vh(t),e!==null&&Rr(e,t,r,!0),t.childLanes=c,null}function po(e,t){return t=xo({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function hp(e,t,n){return Zl(t,e.child,null,n),e=po(t,t.pendingProps),e.flags|=2,mn(t),t.memoizedState=null,e}function Py(e,t,n){var r=t.pendingProps,c=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Re){if(r.mode==="hidden")return e=po(t,r),t.lanes=536870912,Hi(null,e);if(du(t),(e=Ze)?(e=Cv(e,En),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Wa!==null?{id:Yn,overflow:Gn}:null,retryLane:536870912,hydrationErrors:null},n=Jm(e),n.return=t,t.child=n,Et=t,Ze=null)):e=null,e===null)throw tl(t);return t.lanes=536870912,null}return po(t,r)}var d=e.memoizedState;if(d!==null){var m=d.dehydrated;if(du(t),c)if(t.flags&256)t.flags&=-257,t=hp(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(s(558));else if(vt||Rr(e,t,n,!1),c=(n&e.childLanes)!==0,vt||c){if(r=Fe,r!==null&&(m=Xa(r,n),m!==0&&m!==d.retryLane))throw d.retryLane=m,Ql(e,m),It(r,e,m),zu;Co(),t=hp(e,t,n)}else e=d.treeContext,Ze=Rn(m.nextSibling),Et=t,Re=!0,el=null,En=!1,e!==null&&eh(t,e),t=po(t,r),t.flags|=4096;return t}return e=ga(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function vo(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(s(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function _u(e,t,n,r,c){return Gl(t),n=mu(e,t,n,r,void 0,c),r=hu(),e!==null&&!vt?(pu(e,t,c),wa(e,t,c)):(Re&&r&&Xc(t),t.flags|=1,Rt(e,t,n,c),t.child)}function pp(e,t,n,r,c,d){return Gl(t),t.updateQueue=null,n=gh(t,r,n,c),xh(e),r=hu(),e!==null&&!vt?(pu(e,t,d),wa(e,t,d)):(Re&&r&&Xc(t),t.flags|=1,Rt(e,t,n,d),t.child)}function vp(e,t,n,r,c){if(Gl(t),t.stateNode===null){var d=Tr,m=n.contextType;typeof m=="object"&&m!==null&&(d=kt(m)),d=new n(r,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=ku,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=r,d.state=t.memoizedState,d.refs={},ru(t),m=n.contextType,d.context=typeof m=="object"&&m!==null?kt(m):Tr,d.state=t.memoizedState,m=n.getDerivedStateFromProps,typeof m=="function"&&(Eu(t,n,m,r),d.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(m=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),m!==d.state&&ku.enqueueReplaceState(d,d.state,null),Ui(t,r,d,c),Di(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){d=t.stateNode;var b=t.memoizedProps,M=Il(n,b);d.props=M;var _=d.context,K=n.contextType;m=Tr,typeof K=="object"&&K!==null&&(m=kt(K));var X=n.getDerivedStateFromProps;K=typeof X=="function"||typeof d.getSnapshotBeforeUpdate=="function",b=t.pendingProps!==b,K||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(b||_!==m)&&np(t,d,r,m),al=!1;var U=t.memoizedState;d.state=U,Ui(t,r,d,c),Di(),_=t.memoizedState,b||U!==_||al?(typeof X=="function"&&(Eu(t,n,X,r),_=t.memoizedState),(M=al||tp(t,n,M,r,U,_,m))?(K||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=_),d.props=r,d.state=_,d.context=m,r=M):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{d=t.stateNode,iu(e,t),m=t.memoizedProps,K=Il(n,m),d.props=K,X=t.pendingProps,U=d.context,_=n.contextType,M=Tr,typeof _=="object"&&_!==null&&(M=kt(_)),b=n.getDerivedStateFromProps,(_=typeof b=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(m!==X||U!==M)&&np(t,d,r,M),al=!1,U=t.memoizedState,d.state=U,Ui(t,r,d,c),Di();var B=t.memoizedState;m!==X||U!==B||al||e!==null&&e.dependencies!==null&&Zs(e.dependencies)?(typeof b=="function"&&(Eu(t,n,b,r),B=t.memoizedState),(K=al||tp(t,n,K,r,U,B,M)||e!==null&&e.dependencies!==null&&Zs(e.dependencies))?(_||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(r,B,M),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(r,B,M)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||m===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=B),d.props=r,d.state=B,d.context=M,r=K):(typeof d.componentDidUpdate!="function"||m===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||m===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),r=!1)}return d=r,vo(e,t),r=(t.flags&128)!==0,d||r?(d=t.stateNode,n=r&&typeof n.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&r?(t.child=Zl(t,e.child,null,c),t.child=Zl(t,null,n,c)):Rt(e,t,n,c),t.memoizedState=d.state,e=t.child):e=wa(e,t,c),e}function xp(e,t,n,r){return Kl(),t.flags|=256,Rt(e,t,n,r),t.child}var Ou={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Du(e){return{baseLanes:e,cachePool:ih()}}function Uu(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=pn),e}function gp(e,t,n){var r=t.pendingProps,c=!1,d=(t.flags&128)!==0,m;if((m=d)||(m=e!==null&&e.memoizedState===null?!1:(ct.current&2)!==0),m&&(c=!0,t.flags&=-129),m=(t.flags&32)!==0,t.flags&=-33,e===null){if(Re){if(c?il(t):sl(),(e=Ze)?(e=Cv(e,En),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Wa!==null?{id:Yn,overflow:Gn}:null,retryLane:536870912,hydrationErrors:null},n=Jm(e),n.return=t,t.child=n,Et=t,Ze=null)):e=null,e===null)throw tl(t);return gd(e)?t.lanes=32:t.lanes=536870912,null}var b=r.children;return r=r.fallback,c?(sl(),c=t.mode,b=xo({mode:"hidden",children:b},c),r=Pl(r,c,n,null),b.return=t,r.return=t,b.sibling=r,t.child=b,r=t.child,r.memoizedState=Du(n),r.childLanes=Uu(e,m,n),t.memoizedState=Ou,Hi(null,r)):(il(t),Lu(t,b))}var M=e.memoizedState;if(M!==null&&(b=M.dehydrated,b!==null)){if(d)t.flags&256?(il(t),t.flags&=-257,t=Bu(e,t,n)):t.memoizedState!==null?(sl(),t.child=e.child,t.flags|=128,t=null):(sl(),b=r.fallback,c=t.mode,r=xo({mode:"visible",children:r.children},c),b=Pl(b,c,n,null),b.flags|=2,r.return=t,b.return=t,r.sibling=b,t.child=r,Zl(t,e.child,null,n),r=t.child,r.memoizedState=Du(n),r.childLanes=Uu(e,m,n),t.memoizedState=Ou,t=Hi(null,r));else if(il(t),gd(b)){if(m=b.nextSibling&&b.nextSibling.dataset,m)var _=m.dgst;m=_,r=Error(s(419)),r.stack="",r.digest=m,Ei({value:r,source:null,stack:null}),t=Bu(e,t,n)}else if(vt||Rr(e,t,n,!1),m=(n&e.childLanes)!==0,vt||m){if(m=Fe,m!==null&&(r=Xa(m,n),r!==0&&r!==M.retryLane))throw M.retryLane=r,Ql(e,r),It(m,e,r),zu;xd(b)||Co(),t=Bu(e,t,n)}else xd(b)?(t.flags|=192,t.child=e.child,t=null):(e=M.treeContext,Ze=Rn(b.nextSibling),Et=t,Re=!0,el=null,En=!1,e!==null&&eh(t,e),t=Lu(t,r.children),t.flags|=4096);return t}return c?(sl(),b=r.fallback,c=t.mode,M=e.child,_=M.sibling,r=ga(M,{mode:"hidden",children:r.children}),r.subtreeFlags=M.subtreeFlags&65011712,_!==null?b=ga(_,b):(b=Pl(b,c,n,null),b.flags|=2),b.return=t,r.return=t,r.sibling=b,t.child=r,Hi(null,r),r=t.child,b=e.child.memoizedState,b===null?b=Du(n):(c=b.cachePool,c!==null?(M=ht._currentValue,c=c.parent!==M?{parent:M,pool:M}:c):c=ih(),b={baseLanes:b.baseLanes|n,cachePool:c}),r.memoizedState=b,r.childLanes=Uu(e,m,n),t.memoizedState=Ou,Hi(e.child,r)):(il(t),n=e.child,e=n.sibling,n=ga(n,{mode:"visible",children:r.children}),n.return=t,n.sibling=null,e!==null&&(m=t.deletions,m===null?(t.deletions=[e],t.flags|=16):m.push(e)),t.child=n,t.memoizedState=null,n)}function Lu(e,t){return t=xo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function xo(e,t){return e=dn(22,e,null,t),e.lanes=0,e}function Bu(e,t,n){return Zl(t,e.child,null,n),e=Lu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function bp(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Wc(e.return,t,n)}function qu(e,t,n,r,c,d){var m=e.memoizedState;m===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:c,treeForkCount:d}:(m.isBackwards=t,m.rendering=null,m.renderingStartTime=0,m.last=r,m.tail=n,m.tailMode=c,m.treeForkCount=d)}function yp(e,t,n){var r=t.pendingProps,c=r.revealOrder,d=r.tail;r=r.children;var m=ct.current,b=(m&2)!==0;if(b?(m=m&1|2,t.flags|=128):m&=1,V(ct,m),Rt(e,t,r,n),r=Re?Ai:0,!b&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&bp(e,n,t);else if(e.tag===19)bp(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(c){case"forwards":for(n=t.child,c=null;n!==null;)e=n.alternate,e!==null&&lo(e)===null&&(c=n),n=n.sibling;n=c,n===null?(c=t.child,t.child=null):(c=n.sibling,n.sibling=null),qu(t,!1,c,n,d,r);break;case"backwards":case"unstable_legacy-backwards":for(n=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&lo(e)===null){t.child=c;break}e=c.sibling,c.sibling=n,n=c,c=e}qu(t,!0,n,null,d,r);break;case"together":qu(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function wa(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ul|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Rr(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(s(153));if(t.child!==null){for(e=t.child,n=ga(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ga(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function $u(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Zs(e)))}function Ky(e,t,n){switch(t.tag){case 3:Xe(t,t.stateNode.containerInfo),nl(t,ht,e.memoizedState.cache),Kl();break;case 27:case 5:Nt(t);break;case 4:Xe(t,t.stateNode.containerInfo);break;case 10:nl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,du(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(il(t),t.flags|=128,null):(n&t.child.childLanes)!==0?gp(e,t,n):(il(t),e=wa(e,t,n),e!==null?e.sibling:null);il(t);break;case 19:var c=(e.flags&128)!==0;if(r=(n&t.childLanes)!==0,r||(Rr(e,t,n,!1),r=(n&t.childLanes)!==0),c){if(r)return yp(e,t,n);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),V(ct,ct.current),r)break;return null;case 22:return t.lanes=0,fp(e,t,n,t.pendingProps);case 24:nl(t,ht,e.memoizedState.cache)}return wa(e,t,n)}function Sp(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)vt=!0;else{if(!$u(e,n)&&(t.flags&128)===0)return vt=!1,Ky(e,t,n);vt=(e.flags&131072)!==0}else vt=!1,Re&&(t.flags&1048576)!==0&&Wm(t,Ai,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=Xl(t.elementType),t.type=e,typeof e=="function")Yc(e)?(r=Il(e,r),t.tag=1,t=vp(null,t,e,r,n)):(t.tag=0,t=_u(null,t,e,r,n));else{if(e!=null){var c=e.$$typeof;if(c===P){t.tag=11,t=cp(null,t,e,r,n);break e}else if(c===q){t.tag=14,t=up(null,t,e,r,n);break e}}throw t=ge(e)||e,Error(s(306,t,""))}}return t;case 0:return _u(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,c=Il(r,t.pendingProps),vp(e,t,r,c,n);case 3:e:{if(Xe(t,t.stateNode.containerInfo),e===null)throw Error(s(387));r=t.pendingProps;var d=t.memoizedState;c=d.element,iu(e,t),Ui(t,r,null,n);var m=t.memoizedState;if(r=m.cache,nl(t,ht,r),r!==d.cache&&eu(t,[ht],n,!0),Di(),r=m.element,d.isDehydrated)if(d={element:r,isDehydrated:!1,cache:m.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=xp(e,t,r,n);break e}else if(r!==c){c=Cn(Error(s(424)),t),Ei(c),t=xp(e,t,r,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(Ze=Rn(e.firstChild),Et=t,Re=!0,el=null,En=!0,n=fh(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Kl(),r===c){t=wa(e,t,n);break e}Rt(e,t,r,n)}t=t.child}return t;case 26:return vo(e,t),e===null?(n=zv(t.type,null,t.pendingProps,null))?t.memoizedState=n:Re||(n=t.type,e=t.pendingProps,r=_o(ve.current).createElement(n),r[$e]=t,r[et]=e,zt(r,n,e),wt(r),t.stateNode=r):t.memoizedState=zv(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Nt(t),e===null&&Re&&(r=t.stateNode=Ev(t.type,t.pendingProps,ve.current),Et=t,En=!0,c=Ze,pl(t.type)?(bd=c,Ze=Rn(r.firstChild)):Ze=c),Rt(e,t,t.pendingProps.children,n),vo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Re&&((c=r=Ze)&&(r=y0(r,t.type,t.pendingProps,En),r!==null?(t.stateNode=r,Et=t,Ze=Rn(r.firstChild),En=!1,c=!0):c=!1),c||tl(t)),Nt(t),c=t.type,d=t.pendingProps,m=e!==null?e.memoizedProps:null,r=d.children,hd(c,d)?r=null:m!==null&&hd(c,m)&&(t.flags|=32),t.memoizedState!==null&&(c=mu(e,t,Dy,null,null,n),ns._currentValue=c),vo(e,t),Rt(e,t,r,n),t.child;case 6:return e===null&&Re&&((e=n=Ze)&&(n=S0(n,t.pendingProps,En),n!==null?(t.stateNode=n,Et=t,Ze=null,e=!0):e=!1),e||tl(t)),null;case 13:return gp(e,t,n);case 4:return Xe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Zl(t,null,r,n):Rt(e,t,r,n),t.child;case 11:return cp(e,t,t.type,t.pendingProps,n);case 7:return Rt(e,t,t.pendingProps,n),t.child;case 8:return Rt(e,t,t.pendingProps.children,n),t.child;case 12:return Rt(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,nl(t,t.type,r.value),Rt(e,t,r.children,n),t.child;case 9:return c=t.type._context,r=t.pendingProps.children,Gl(t),c=kt(c),r=r(c),t.flags|=1,Rt(e,t,r,n),t.child;case 14:return up(e,t,t.type,t.pendingProps,n);case 15:return dp(e,t,t.type,t.pendingProps,n);case 19:return yp(e,t,n);case 31:return Py(e,t,n);case 22:return fp(e,t,n,t.pendingProps);case 24:return Gl(t),r=kt(ht),e===null?(c=au(),c===null&&(c=Fe,d=tu(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=n),c=d),t.memoizedState={parent:r,cache:c},ru(t),nl(t,ht,c)):((e.lanes&n)!==0&&(iu(e,t),Ui(t,null,null,n),Di()),c=e.memoizedState,d=t.memoizedState,c.parent!==r?(c={parent:r,cache:r},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),nl(t,ht,r)):(r=d.cache,nl(t,ht,r),r!==c.cache&&eu(t,[ht],n,!0))),Rt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(s(156,t.tag))}function Ma(e){e.flags|=4}function Hu(e,t,n,r,c){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(c&335544128)===c)if(e.stateNode.complete)e.flags|=8192;else if(Xp())e.flags|=8192;else throw Fl=eo,lu}else e.flags&=-16777217}function jp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Lv(t))if(Xp())e.flags|=8192;else throw Fl=eo,lu}function go(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ul():536870912,e.lanes|=t,Pr|=t)}function Qi(e,t){if(!Re)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Je(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var c=e.child;c!==null;)n|=c.lanes|c.childLanes,r|=c.subtreeFlags&65011712,r|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)n|=c.lanes|c.childLanes,r|=c.subtreeFlags,r|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Yy(e,t,n){var r=t.pendingProps;switch(Fc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Je(t),null;case 1:return Je(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Sa(ht),Oe(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(kr(t)?Ma(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Jc())),Je(t),null;case 26:var c=t.type,d=t.memoizedState;return e===null?(Ma(t),d!==null?(Je(t),jp(t,d)):(Je(t),Hu(t,c,null,r,n))):d?d!==e.memoizedState?(Ma(t),Je(t),jp(t,d)):(Je(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Ma(t),Je(t),Hu(t,c,e,r,n)),null;case 27:if(dt(t),n=ve.current,c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ma(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Je(t),null}e=le.current,kr(t)?th(t):(e=Ev(c,r,n),t.stateNode=e,Ma(t))}return Je(t),null;case 5:if(dt(t),c=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ma(t);else{if(!r){if(t.stateNode===null)throw Error(s(166));return Je(t),null}if(d=le.current,kr(t))th(t);else{var m=_o(ve.current);switch(d){case 1:d=m.createElementNS("http://www.w3.org/2000/svg",c);break;case 2:d=m.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;default:switch(c){case"svg":d=m.createElementNS("http://www.w3.org/2000/svg",c);break;case"math":d=m.createElementNS("http://www.w3.org/1998/Math/MathML",c);break;case"script":d=m.createElement("div"),d.innerHTML="<script><\/script>",d=d.removeChild(d.firstChild);break;case"select":d=typeof r.is=="string"?m.createElement("select",{is:r.is}):m.createElement("select"),r.multiple?d.multiple=!0:r.size&&(d.size=r.size);break;default:d=typeof r.is=="string"?m.createElement(c,{is:r.is}):m.createElement(c)}}d[$e]=t,d[et]=r;e:for(m=t.child;m!==null;){if(m.tag===5||m.tag===6)d.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===t)break e;for(;m.sibling===null;){if(m.return===null||m.return===t)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}t.stateNode=d;e:switch(zt(d,c,r),c){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Ma(t)}}return Je(t),Hu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ma(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(s(166));if(e=ve.current,kr(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,c=Et,c!==null)switch(c.tag){case 27:case 5:r=c.memoizedProps}e[$e]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||gv(e.nodeValue,n)),e||tl(t,!0)}else e=_o(e).createTextNode(r),e[$e]=t,t.stateNode=e}return Je(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=kr(t),n!==null){if(e===null){if(!r)throw Error(s(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[$e]=t}else Kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),e=!1}else n=Jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(mn(t),t):(mn(t),null);if((t.flags&128)!==0)throw Error(s(558))}return Je(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=kr(t),r!==null&&r.dehydrated!==null){if(e===null){if(!c)throw Error(s(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(s(317));c[$e]=t}else Kl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Je(t),c=!1}else c=Jc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(mn(t),t):(mn(t),null)}return mn(t),(t.flags&128)!==0?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,c=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(c=r.alternate.memoizedState.cachePool.pool),d=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(d=r.memoizedState.cachePool.pool),d!==c&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),go(t,t.updateQueue),Je(t),null);case 4:return Oe(),e===null&&cd(t.stateNode.containerInfo),Je(t),null;case 10:return Sa(t.type),Je(t),null;case 19:if($(ct),r=t.memoizedState,r===null)return Je(t),null;if(c=(t.flags&128)!==0,d=r.rendering,d===null)if(c)Qi(r,!1);else{if(rt!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=lo(e),d!==null){for(t.flags|=128,Qi(r,!1),e=d.updateQueue,t.updateQueue=e,go(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Zm(n,e),n=n.sibling;return V(ct,ct.current&1|2),Re&&ba(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&at()>No&&(t.flags|=128,c=!0,Qi(r,!1),t.lanes=4194304)}else{if(!c)if(e=lo(d),e!==null){if(t.flags|=128,c=!0,e=e.updateQueue,t.updateQueue=e,go(t,e),Qi(r,!0),r.tail===null&&r.tailMode==="hidden"&&!d.alternate&&!Re)return Je(t),null}else 2*at()-r.renderingStartTime>No&&n!==536870912&&(t.flags|=128,c=!0,Qi(r,!1),t.lanes=4194304);r.isBackwards?(d.sibling=t.child,t.child=d):(e=r.last,e!==null?e.sibling=d:t.child=d,r.last=d)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=at(),e.sibling=null,n=ct.current,V(ct,c?n&1|2:n&1),Re&&ba(t,r.treeForkCount),e):(Je(t),null);case 22:case 23:return mn(t),uu(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(n&536870912)!==0&&(t.flags&128)===0&&(Je(t),t.subtreeFlags&6&&(t.flags|=8192)):Je(t),n=t.updateQueue,n!==null&&go(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&$(Vl),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Sa(ht),Je(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function Gy(e,t){switch(Fc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Sa(ht),Oe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return dt(t),null;case 31:if(t.memoizedState!==null){if(mn(t),t.alternate===null)throw Error(s(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(mn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return $(ct),null;case 4:return Oe(),null;case 10:return Sa(t.type),null;case 22:case 23:return mn(t),uu(),e!==null&&$(Vl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Sa(ht),null;case 25:return null;default:return null}}function Np(e,t){switch(Fc(t),t.tag){case 3:Sa(ht),Oe();break;case 26:case 27:case 5:dt(t);break;case 4:Oe();break;case 31:t.memoizedState!==null&&mn(t);break;case 13:mn(t);break;case 19:$(ct);break;case 10:Sa(t.type);break;case 22:case 23:mn(t),uu(),e!==null&&$(Vl);break;case 24:Sa(ht)}}function Pi(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var c=r.next;n=c;do{if((n.tag&e)===e){r=void 0;var d=n.create,m=n.inst;r=d(),m.destroy=r}n=n.next}while(n!==c)}}catch(b){Ke(t,t.return,b)}}function ol(e,t,n){try{var r=t.updateQueue,c=r!==null?r.lastEffect:null;if(c!==null){var d=c.next;r=d;do{if((r.tag&e)===e){var m=r.inst,b=m.destroy;if(b!==void 0){m.destroy=void 0,c=t;var M=n,_=b;try{_()}catch(K){Ke(c,M,K)}}}r=r.next}while(r!==d)}}catch(K){Ke(t,t.return,K)}}function wp(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{hh(t,n)}catch(r){Ke(e,e.return,r)}}}function Mp(e,t,n){n.props=Il(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Ke(e,t,r)}}function Ki(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n=="function"?e.refCleanup=n(r):n.current=r}}catch(c){Ke(e,t,c)}}function Vn(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(c){Ke(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(c){Ke(e,t,c)}else n.current=null}function Cp(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(c){Ke(e,e.return,c)}}function Qu(e,t,n){try{var r=e.stateNode;h0(r,e.type,n,t),r[et]=t}catch(c){Ke(e,e.return,c)}}function Tp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&pl(e.type)||e.tag===4}function Pu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Tp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&pl(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Ku(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=va));else if(r!==4&&(r===27&&pl(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Ku(e,t,n),e=e.sibling;e!==null;)Ku(e,t,n),e=e.sibling}function bo(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&pl(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(bo(e,t,n),e=e.sibling;e!==null;)bo(e,t,n),e=e.sibling}function Ap(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);zt(t,r,n),t[$e]=e,t[et]=n}catch(d){Ke(e,e.return,d)}}var Ca=!1,xt=!1,Yu=!1,Ep=typeof WeakSet=="function"?WeakSet:Set,Mt=null;function Vy(e,t){if(e=e.containerInfo,fd=$o,e=Hm(e),Bc(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var c=r.anchorOffset,d=r.focusNode;r=r.focusOffset;try{n.nodeType,d.nodeType}catch{n=null;break e}var m=0,b=-1,M=-1,_=0,K=0,X=e,U=null;t:for(;;){for(var B;X!==n||c!==0&&X.nodeType!==3||(b=m+c),X!==d||r!==0&&X.nodeType!==3||(M=m+r),X.nodeType===3&&(m+=X.nodeValue.length),(B=X.firstChild)!==null;)U=X,X=B;for(;;){if(X===e)break t;if(U===n&&++_===c&&(b=m),U===d&&++K===r&&(M=m),(B=X.nextSibling)!==null)break;X=U,U=X.parentNode}X=B}n=b===-1||M===-1?null:{start:b,end:M}}else n=null}n=n||{start:0,end:0}}else n=null;for(md={focusedElem:e,selectionRange:n},$o=!1,Mt=t;Mt!==null;)if(t=Mt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Mt=e;else for(;Mt!==null;){switch(t=Mt,d=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)c=e[n],c.ref.impl=c.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,n=t,c=d.memoizedProps,d=d.memoizedState,r=n.stateNode;try{var oe=Il(n.type,c);e=r.getSnapshotBeforeUpdate(oe,d),r.__reactInternalSnapshotBeforeUpdate=e}catch(xe){Ke(n,n.return,xe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)vd(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":vd(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(s(163))}if(e=t.sibling,e!==null){e.return=t.return,Mt=e;break}Mt=t.return}}function kp(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Aa(e,n),r&4&&Pi(5,n);break;case 1:if(Aa(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(m){Ke(n,n.return,m)}else{var c=Il(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(m){Ke(n,n.return,m)}}r&64&&wp(n),r&512&&Ki(n,n.return);break;case 3:if(Aa(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{hh(e,t)}catch(m){Ke(n,n.return,m)}}break;case 27:t===null&&r&4&&Ap(n);case 26:case 5:Aa(e,n),t===null&&r&4&&Cp(n),r&512&&Ki(n,n.return);break;case 12:Aa(e,n);break;case 31:Aa(e,n),r&4&&_p(e,n);break;case 13:Aa(e,n),r&4&&Op(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=n0.bind(null,n),j0(e,n))));break;case 22:if(r=n.memoizedState!==null||Ca,!r){t=t!==null&&t.memoizedState!==null||xt,c=Ca;var d=xt;Ca=r,(xt=t)&&!d?Ea(e,n,(n.subtreeFlags&8772)!==0):Aa(e,n),Ca=c,xt=d}break;case 30:break;default:Aa(e,n)}}function Rp(e){var t=e.alternate;t!==null&&(e.alternate=null,Rp(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Ja(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var We=null,Xt=!1;function Ta(e,t,n){for(n=n.child;n!==null;)zp(e,t,n),n=n.sibling}function zp(e,t,n){if(ft&&typeof ft.onCommitFiberUnmount=="function")try{ft.onCommitFiberUnmount(on,n)}catch{}switch(n.tag){case 26:xt||Vn(n,t),Ta(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:xt||Vn(n,t);var r=We,c=Xt;pl(n.type)&&(We=n.stateNode,Xt=!1),Ta(e,t,n),Wi(n.stateNode),We=r,Xt=c;break;case 5:xt||Vn(n,t);case 6:if(r=We,c=Xt,We=null,Ta(e,t,n),We=r,Xt=c,We!==null)if(Xt)try{(We.nodeType===9?We.body:We.nodeName==="HTML"?We.ownerDocument.body:We).removeChild(n.stateNode)}catch(d){Ke(n,t,d)}else try{We.removeChild(n.stateNode)}catch(d){Ke(n,t,d)}break;case 18:We!==null&&(Xt?(e=We,wv(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Jr(e)):wv(We,n.stateNode));break;case 4:r=We,c=Xt,We=n.stateNode.containerInfo,Xt=!0,Ta(e,t,n),We=r,Xt=c;break;case 0:case 11:case 14:case 15:ol(2,n,t),xt||ol(4,n,t),Ta(e,t,n);break;case 1:xt||(Vn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"&&Mp(n,t,r)),Ta(e,t,n);break;case 21:Ta(e,t,n);break;case 22:xt=(r=xt)||n.memoizedState!==null,Ta(e,t,n),xt=r;break;default:Ta(e,t,n)}}function _p(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Jr(e)}catch(n){Ke(t,t.return,n)}}}function Op(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Jr(e)}catch(n){Ke(t,t.return,n)}}function Xy(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Ep),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Ep),t;default:throw Error(s(435,e.tag))}}function yo(e,t){var n=Xy(e);t.forEach(function(r){if(!n.has(r)){n.add(r);var c=a0.bind(null,e,r);r.then(c,c)}})}function Ft(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var c=n[r],d=e,m=t,b=m;e:for(;b!==null;){switch(b.tag){case 27:if(pl(b.type)){We=b.stateNode,Xt=!1;break e}break;case 5:We=b.stateNode,Xt=!1;break e;case 3:case 4:We=b.stateNode.containerInfo,Xt=!0;break e}b=b.return}if(We===null)throw Error(s(160));zp(d,m,c),We=null,Xt=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Dp(t,e),t=t.sibling}var Ln=null;function Dp(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ft(t,e),Zt(e),r&4&&(ol(3,e,e.return),Pi(3,e),ol(5,e,e.return));break;case 1:Ft(t,e),Zt(e),r&512&&(xt||n===null||Vn(n,n.return)),r&64&&Ca&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var c=Ln;if(Ft(t,e),Zt(e),r&512&&(xt||n===null||Vn(n,n.return)),r&4){var d=n!==null?n.memoizedState:null;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){e:{r=e.type,n=e.memoizedProps,c=c.ownerDocument||c;t:switch(r){case"title":d=c.getElementsByTagName("title")[0],(!d||d[tt]||d[$e]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(r),c.head.insertBefore(d,c.querySelector("head > title"))),zt(d,r,n),d[$e]=e,wt(d),r=d;break e;case"link":var m=Dv("link","href",c).get(r+(n.href||""));if(m){for(var b=0;b<m.length;b++)if(d=m[b],d.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&d.getAttribute("rel")===(n.rel==null?null:n.rel)&&d.getAttribute("title")===(n.title==null?null:n.title)&&d.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){m.splice(b,1);break t}}d=c.createElement(r),zt(d,r,n),c.head.appendChild(d);break;case"meta":if(m=Dv("meta","content",c).get(r+(n.content||""))){for(b=0;b<m.length;b++)if(d=m[b],d.getAttribute("content")===(n.content==null?null:""+n.content)&&d.getAttribute("name")===(n.name==null?null:n.name)&&d.getAttribute("property")===(n.property==null?null:n.property)&&d.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&d.getAttribute("charset")===(n.charSet==null?null:n.charSet)){m.splice(b,1);break t}}d=c.createElement(r),zt(d,r,n),c.head.appendChild(d);break;default:throw Error(s(468,r))}d[$e]=e,wt(d),r=d}e.stateNode=r}else Uv(c,e.type,e.stateNode);else e.stateNode=Ov(c,r,e.memoizedProps);else d!==r?(d===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):d.count--,r===null?Uv(c,e.type,e.stateNode):Ov(c,r,e.memoizedProps)):r===null&&e.stateNode!==null&&Qu(e,e.memoizedProps,n.memoizedProps)}break;case 27:Ft(t,e),Zt(e),r&512&&(xt||n===null||Vn(n,n.return)),n!==null&&r&4&&Qu(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Ft(t,e),Zt(e),r&512&&(xt||n===null||Vn(n,n.return)),e.flags&32){c=e.stateNode;try{yr(c,"")}catch(oe){Ke(e,e.return,oe)}}r&4&&e.stateNode!=null&&(c=e.memoizedProps,Qu(e,c,n!==null?n.memoizedProps:c)),r&1024&&(Yu=!0);break;case 6:if(Ft(t,e),Zt(e),r&4){if(e.stateNode===null)throw Error(s(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(oe){Ke(e,e.return,oe)}}break;case 3:if(Uo=null,c=Ln,Ln=Oo(t.containerInfo),Ft(t,e),Ln=c,Zt(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Jr(t.containerInfo)}catch(oe){Ke(e,e.return,oe)}Yu&&(Yu=!1,Up(e));break;case 4:r=Ln,Ln=Oo(e.stateNode.containerInfo),Ft(t,e),Zt(e),Ln=r;break;case 12:Ft(t,e),Zt(e);break;case 31:Ft(t,e),Zt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yo(e,r)));break;case 13:Ft(t,e),Zt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(jo=at()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yo(e,r)));break;case 22:c=e.memoizedState!==null;var M=n!==null&&n.memoizedState!==null,_=Ca,K=xt;if(Ca=_||c,xt=K||M,Ft(t,e),xt=K,Ca=_,Zt(e),r&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(n===null||M||Ca||xt||Wl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){M=n=t;try{if(d=M.stateNode,c)m=d.style,typeof m.setProperty=="function"?m.setProperty("display","none","important"):m.display="none";else{b=M.stateNode;var X=M.memoizedProps.style,U=X!=null&&X.hasOwnProperty("display")?X.display:null;b.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(oe){Ke(M,M.return,oe)}}}else if(t.tag===6){if(n===null){M=t;try{M.stateNode.nodeValue=c?"":M.memoizedProps}catch(oe){Ke(M,M.return,oe)}}}else if(t.tag===18){if(n===null){M=t;try{var B=M.stateNode;c?Mv(B,!0):Mv(M.stateNode,!1)}catch(oe){Ke(M,M.return,oe)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,yo(e,n))));break;case 19:Ft(t,e),Zt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,yo(e,r)));break;case 30:break;case 21:break;default:Ft(t,e),Zt(e)}}function Zt(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Tp(r)){n=r;break}r=r.return}if(n==null)throw Error(s(160));switch(n.tag){case 27:var c=n.stateNode,d=Pu(e);bo(e,d,c);break;case 5:var m=n.stateNode;n.flags&32&&(yr(m,""),n.flags&=-33);var b=Pu(e);bo(e,b,m);break;case 3:case 4:var M=n.stateNode.containerInfo,_=Pu(e);Ku(e,_,M);break;default:throw Error(s(161))}}catch(K){Ke(e,e.return,K)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Up(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Up(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Aa(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)kp(e,t.alternate,t),t=t.sibling}function Wl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:ol(4,t,t.return),Wl(t);break;case 1:Vn(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Mp(t,t.return,n),Wl(t);break;case 27:Wi(t.stateNode);case 26:case 5:Vn(t,t.return),Wl(t);break;case 22:t.memoizedState===null&&Wl(t);break;case 30:Wl(t);break;default:Wl(t)}e=e.sibling}}function Ea(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,c=e,d=t,m=d.flags;switch(d.tag){case 0:case 11:case 15:Ea(c,d,n),Pi(4,d);break;case 1:if(Ea(c,d,n),r=d,c=r.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(_){Ke(r,r.return,_)}if(r=d,c=r.updateQueue,c!==null){var b=r.stateNode;try{var M=c.shared.hiddenCallbacks;if(M!==null)for(c.shared.hiddenCallbacks=null,c=0;c<M.length;c++)mh(M[c],b)}catch(_){Ke(r,r.return,_)}}n&&m&64&&wp(d),Ki(d,d.return);break;case 27:Ap(d);case 26:case 5:Ea(c,d,n),n&&r===null&&m&4&&Cp(d),Ki(d,d.return);break;case 12:Ea(c,d,n);break;case 31:Ea(c,d,n),n&&m&4&&_p(c,d);break;case 13:Ea(c,d,n),n&&m&4&&Op(c,d);break;case 22:d.memoizedState===null&&Ea(c,d,n),Ki(d,d.return);break;case 30:break;default:Ea(c,d,n)}t=t.sibling}}function Gu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ki(n))}function Vu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ki(e))}function Bn(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Lp(e,t,n,r),t=t.sibling}function Lp(e,t,n,r){var c=t.flags;switch(t.tag){case 0:case 11:case 15:Bn(e,t,n,r),c&2048&&Pi(9,t);break;case 1:Bn(e,t,n,r);break;case 3:Bn(e,t,n,r),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ki(e)));break;case 12:if(c&2048){Bn(e,t,n,r),e=t.stateNode;try{var d=t.memoizedProps,m=d.id,b=d.onPostCommit;typeof b=="function"&&b(m,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(M){Ke(t,t.return,M)}}else Bn(e,t,n,r);break;case 31:Bn(e,t,n,r);break;case 13:Bn(e,t,n,r);break;case 23:break;case 22:d=t.stateNode,m=t.alternate,t.memoizedState!==null?d._visibility&2?Bn(e,t,n,r):Yi(e,t):d._visibility&2?Bn(e,t,n,r):(d._visibility|=2,$r(e,t,n,r,(t.subtreeFlags&10256)!==0||!1)),c&2048&&Gu(m,t);break;case 24:Bn(e,t,n,r),c&2048&&Vu(t.alternate,t);break;default:Bn(e,t,n,r)}}function $r(e,t,n,r,c){for(c=c&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var d=e,m=t,b=n,M=r,_=m.flags;switch(m.tag){case 0:case 11:case 15:$r(d,m,b,M,c),Pi(8,m);break;case 23:break;case 22:var K=m.stateNode;m.memoizedState!==null?K._visibility&2?$r(d,m,b,M,c):Yi(d,m):(K._visibility|=2,$r(d,m,b,M,c)),c&&_&2048&&Gu(m.alternate,m);break;case 24:$r(d,m,b,M,c),c&&_&2048&&Vu(m.alternate,m);break;default:$r(d,m,b,M,c)}t=t.sibling}}function Yi(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,c=r.flags;switch(r.tag){case 22:Yi(n,r),c&2048&&Gu(r.alternate,r);break;case 24:Yi(n,r),c&2048&&Vu(r.alternate,r);break;default:Yi(n,r)}t=t.sibling}}var Gi=8192;function Hr(e,t,n){if(e.subtreeFlags&Gi)for(e=e.child;e!==null;)Bp(e,t,n),e=e.sibling}function Bp(e,t,n){switch(e.tag){case 26:Hr(e,t,n),e.flags&Gi&&e.memoizedState!==null&&O0(n,Ln,e.memoizedState,e.memoizedProps);break;case 5:Hr(e,t,n);break;case 3:case 4:var r=Ln;Ln=Oo(e.stateNode.containerInfo),Hr(e,t,n),Ln=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Gi,Gi=16777216,Hr(e,t,n),Gi=r):Hr(e,t,n));break;default:Hr(e,t,n)}}function qp(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Vi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Mt=r,Hp(r,e)}qp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)$p(e),e=e.sibling}function $p(e){switch(e.tag){case 0:case 11:case 15:Vi(e),e.flags&2048&&ol(9,e,e.return);break;case 3:Vi(e);break;case 12:Vi(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,So(e)):Vi(e);break;default:Vi(e)}}function So(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Mt=r,Hp(r,e)}qp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ol(8,t,t.return),So(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,So(t));break;default:So(t)}e=e.sibling}}function Hp(e,t){for(;Mt!==null;){var n=Mt;switch(n.tag){case 0:case 11:case 15:ol(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ki(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Mt=r;else e:for(n=e;Mt!==null;){r=Mt;var c=r.sibling,d=r.return;if(Rp(r),r===n){Mt=null;break e}if(c!==null){c.return=d,Mt=c;break e}Mt=d}}}var Fy={getCacheForType:function(e){var t=kt(ht),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return kt(ht).controller.signal}},Zy=typeof WeakMap=="function"?WeakMap:Map,qe=0,Fe=null,Ce=null,Ae=0,Pe=0,hn=null,cl=!1,Qr=!1,Xu=!1,ka=0,rt=0,ul=0,er=0,Fu=0,pn=0,Pr=0,Xi=null,Jt=null,Zu=!1,jo=0,Qp=0,No=1/0,wo=null,dl=null,yt=0,fl=null,Kr=null,Ra=0,Ju=0,Iu=null,Pp=null,Fi=0,Wu=null;function vn(){return(qe&2)!==0&&Ae!==0?Ae&-Ae:O.T!==null?rd():Fa()}function Kp(){if(pn===0)if((Ae&536870912)===0||Re){var e=oa;oa<<=1,(oa&3932160)===0&&(oa=262144),pn=e}else pn=536870912;return e=fn.current,e!==null&&(e.flags|=32),pn}function It(e,t,n){(e===Fe&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)&&(Yr(e,0),ml(e,Ae,pn,!1)),ue(e,n),((qe&2)===0||e!==Fe)&&(e===Fe&&((qe&2)===0&&(er|=n),rt===4&&ml(e,Ae,pn,!1)),Xn(e))}function Yp(e,t,n){if((qe&6)!==0)throw Error(s(327));var r=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Kn(e,t),c=r?Wy(e,t):td(e,t,!0),d=r;do{if(c===0){Qr&&!r&&ml(e,t,0,!1);break}else{if(n=e.current.alternate,d&&!Jy(n)){c=td(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var m=0;else m=e.pendingLanes&-536870913,m=m!==0?m:m&536870912?536870912:0;if(m!==0){t=m;e:{var b=e;c=Xi;var M=b.current.memoizedState.isDehydrated;if(M&&(Yr(b,m).flags|=256),m=td(b,m,!1),m!==2){if(Xu&&!M){b.errorRecoveryDisabledLanes|=d,er|=d,c=4;break e}d=Jt,Jt=c,d!==null&&(Jt===null?Jt=d:Jt.push.apply(Jt,d))}c=m}if(d=!1,c!==2)continue}}if(c===1){Yr(e,0),ml(e,t,0,!0);break}e:{switch(r=e,d=c,d){case 0:case 1:throw Error(s(345));case 4:if((t&4194048)!==t)break;case 6:ml(r,t,pn,!cl);break e;case 2:Jt=null;break;case 3:case 5:break;default:throw Error(s(329))}if((t&62914560)===t&&(c=jo+300-at(),10<c)){if(ml(r,t,pn,!cl),ua(r,0,!0)!==0)break e;Ra=t,r.timeoutHandle=jv(Gp.bind(null,r,n,Jt,wo,Zu,t,pn,er,Pr,cl,d,"Throttled",-0,0),c);break e}Gp(r,n,Jt,wo,Zu,t,pn,er,Pr,cl,d,null,-0,0)}}break}while(!0);Xn(e)}function Gp(e,t,n,r,c,d,m,b,M,_,K,X,U,B){if(e.timeoutHandle=-1,X=t.subtreeFlags,X&8192||(X&16785408)===16785408){X={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:va},Bp(t,d,X);var oe=(d&62914560)===d?jo-at():(d&4194048)===d?Qp-at():0;if(oe=D0(X,oe),oe!==null){Ra=d,e.cancelPendingCommit=oe(ev.bind(null,e,t,d,n,r,c,m,b,M,K,X,null,U,B)),ml(e,d,m,!_);return}}ev(e,t,d,n,r,c,m,b,M)}function Jy(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var c=n[r],d=c.getSnapshot;c=c.value;try{if(!un(d(),c))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ml(e,t,n,r){t&=~Fu,t&=~er,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var c=t;0<c;){var d=31-mt(c),m=1<<d;r[d]=-1,c&=~m}n!==0&&Ot(e,n,t)}function Mo(){return(qe&6)===0?(Zi(0),!1):!0}function ed(){if(Ce!==null){if(Pe===0)var e=Ce.return;else e=Ce,ya=Yl=null,vu(e),Dr=null,zi=0,e=Ce;for(;e!==null;)Np(e.alternate,e),e=e.return;Ce=null}}function Yr(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,x0(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ra=0,ed(),Fe=e,Ce=n=ga(e.current,null),Ae=t,Pe=0,hn=null,cl=!1,Qr=Kn(e,t),Xu=!1,Pr=pn=Fu=er=ul=rt=0,Jt=Xi=null,Zu=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var c=31-mt(r),d=1<<c;t|=e[c],r&=~d}return ka=t,Ys(),n}function Vp(e,t){je=null,O.H=$i,t===Or||t===Ws?(t=ch(),Pe=3):t===lu?(t=ch(),Pe=4):Pe=t===zu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,hn=t,Ce===null&&(rt=1,ho(e,Cn(t,e.current)))}function Xp(){var e=fn.current;return e===null?!0:(Ae&4194048)===Ae?kn===null:(Ae&62914560)===Ae||(Ae&536870912)!==0?e===kn:!1}function Fp(){var e=O.H;return O.H=$i,e===null?$i:e}function Zp(){var e=O.A;return O.A=Fy,e}function Co(){rt=4,cl||(Ae&4194048)!==Ae&&fn.current!==null||(Qr=!0),(ul&134217727)===0&&(er&134217727)===0||Fe===null||ml(Fe,Ae,pn,!1)}function td(e,t,n){var r=qe;qe|=2;var c=Fp(),d=Zp();(Fe!==e||Ae!==t)&&(wo=null,Yr(e,t)),t=!1;var m=rt;e:do try{if(Pe!==0&&Ce!==null){var b=Ce,M=hn;switch(Pe){case 8:ed(),m=6;break e;case 3:case 2:case 9:case 6:fn.current===null&&(t=!0);var _=Pe;if(Pe=0,hn=null,Gr(e,b,M,_),n&&Qr){m=0;break e}break;default:_=Pe,Pe=0,hn=null,Gr(e,b,M,_)}}Iy(),m=rt;break}catch(K){Vp(e,K)}while(!0);return t&&e.shellSuspendCounter++,ya=Yl=null,qe=r,O.H=c,O.A=d,Ce===null&&(Fe=null,Ae=0,Ys()),m}function Iy(){for(;Ce!==null;)Jp(Ce)}function Wy(e,t){var n=qe;qe|=2;var r=Fp(),c=Zp();Fe!==e||Ae!==t?(wo=null,No=at()+500,Yr(e,t)):Qr=Kn(e,t);e:do try{if(Pe!==0&&Ce!==null){t=Ce;var d=hn;t:switch(Pe){case 1:Pe=0,hn=null,Gr(e,t,d,1);break;case 2:case 9:if(sh(d)){Pe=0,hn=null,Ip(t);break}t=function(){Pe!==2&&Pe!==9||Fe!==e||(Pe=7),Xn(e)},d.then(t,t);break e;case 3:Pe=7;break e;case 4:Pe=5;break e;case 7:sh(d)?(Pe=0,hn=null,Ip(t)):(Pe=0,hn=null,Gr(e,t,d,7));break;case 5:var m=null;switch(Ce.tag){case 26:m=Ce.memoizedState;case 5:case 27:var b=Ce;if(m?Lv(m):b.stateNode.complete){Pe=0,hn=null;var M=b.sibling;if(M!==null)Ce=M;else{var _=b.return;_!==null?(Ce=_,To(_)):Ce=null}break t}}Pe=0,hn=null,Gr(e,t,d,5);break;case 6:Pe=0,hn=null,Gr(e,t,d,6);break;case 8:ed(),rt=6;break e;default:throw Error(s(462))}}e0();break}catch(K){Vp(e,K)}while(!0);return ya=Yl=null,O.H=r,O.A=c,qe=n,Ce!==null?0:(Fe=null,Ae=0,Ys(),rt)}function e0(){for(;Ce!==null&&!Pn();)Jp(Ce)}function Jp(e){var t=Sp(e.alternate,e,ka);e.memoizedProps=e.pendingProps,t===null?To(e):Ce=t}function Ip(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=pp(n,t,t.pendingProps,t.type,void 0,Ae);break;case 11:t=pp(n,t,t.pendingProps,t.type.render,t.ref,Ae);break;case 5:vu(t);default:Np(n,t),t=Ce=Zm(t,ka),t=Sp(n,t,ka)}e.memoizedProps=e.pendingProps,t===null?To(e):Ce=t}function Gr(e,t,n,r){ya=Yl=null,vu(t),Dr=null,zi=0;var c=t.return;try{if(Qy(e,c,t,n,Ae)){rt=1,ho(e,Cn(n,e.current)),Ce=null;return}}catch(d){if(c!==null)throw Ce=c,d;rt=1,ho(e,Cn(n,e.current)),Ce=null;return}t.flags&32768?(Re||r===1?e=!0:Qr||(Ae&536870912)!==0?e=!1:(cl=e=!0,(r===2||r===9||r===3||r===6)&&(r=fn.current,r!==null&&r.tag===13&&(r.flags|=16384))),Wp(t,e)):To(t)}function To(e){var t=e;do{if((t.flags&32768)!==0){Wp(t,cl);return}e=t.return;var n=Yy(t.alternate,t,ka);if(n!==null){Ce=n;return}if(t=t.sibling,t!==null){Ce=t;return}Ce=t=e}while(t!==null);rt===0&&(rt=5)}function Wp(e,t){do{var n=Gy(e.alternate,e);if(n!==null){n.flags&=32767,Ce=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Ce=e;return}Ce=e=n}while(e!==null);rt=6,Ce=null}function ev(e,t,n,r,c,d,m,b,M){e.cancelPendingCommit=null;do Ao();while(yt!==0);if((qe&6)!==0)throw Error(s(327));if(t!==null){if(t===e.current)throw Error(s(177));if(d=t.lanes|t.childLanes,d|=Pc,De(e,n,d,m,b,M),e===Fe&&(Ce=Fe=null,Ae=0),Kr=t,fl=e,Ra=n,Ju=d,Iu=c,Pp=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,l0(qt,function(){return rv(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=O.T,O.T=null,c=te.p,te.p=2,m=qe,qe|=4;try{Vy(e,t,n)}finally{qe=m,te.p=c,O.T=r}}yt=1,tv(),nv(),av()}}function tv(){if(yt===1){yt=0;var e=fl,t=Kr,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=O.T,O.T=null;var r=te.p;te.p=2;var c=qe;qe|=4;try{Dp(t,e);var d=md,m=Hm(e.containerInfo),b=d.focusedElem,M=d.selectionRange;if(m!==b&&b&&b.ownerDocument&&$m(b.ownerDocument.documentElement,b)){if(M!==null&&Bc(b)){var _=M.start,K=M.end;if(K===void 0&&(K=_),"selectionStart"in b)b.selectionStart=_,b.selectionEnd=Math.min(K,b.value.length);else{var X=b.ownerDocument||document,U=X&&X.defaultView||window;if(U.getSelection){var B=U.getSelection(),oe=b.textContent.length,xe=Math.min(M.start,oe),Ve=M.end===void 0?xe:Math.min(M.end,oe);!B.extend&&xe>Ve&&(m=Ve,Ve=xe,xe=m);var k=qm(b,xe),A=qm(b,Ve);if(k&&A&&(B.rangeCount!==1||B.anchorNode!==k.node||B.anchorOffset!==k.offset||B.focusNode!==A.node||B.focusOffset!==A.offset)){var z=X.createRange();z.setStart(k.node,k.offset),B.removeAllRanges(),xe>Ve?(B.addRange(z),B.extend(A.node,A.offset)):(z.setEnd(A.node,A.offset),B.addRange(z))}}}}for(X=[],B=b;B=B.parentNode;)B.nodeType===1&&X.push({element:B,left:B.scrollLeft,top:B.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<X.length;b++){var Y=X[b];Y.element.scrollLeft=Y.left,Y.element.scrollTop=Y.top}}$o=!!fd,md=fd=null}finally{qe=c,te.p=r,O.T=n}}e.current=t,yt=2}}function nv(){if(yt===2){yt=0;var e=fl,t=Kr,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=O.T,O.T=null;var r=te.p;te.p=2;var c=qe;qe|=4;try{kp(e,t.alternate,t)}finally{qe=c,te.p=r,O.T=n}}yt=3}}function av(){if(yt===4||yt===3){yt=0,la();var e=fl,t=Kr,n=Ra,r=Pp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?yt=5:(yt=0,Kr=fl=null,lv(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(dl=null),fa(n),t=t.stateNode,ft&&typeof ft.onCommitFiberRoot=="function")try{ft.onCommitFiberRoot(on,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=O.T,c=te.p,te.p=2,O.T=null;try{for(var d=e.onRecoverableError,m=0;m<r.length;m++){var b=r[m];d(b.value,{componentStack:b.stack})}}finally{O.T=t,te.p=c}}(Ra&3)!==0&&Ao(),Xn(e),c=e.pendingLanes,(n&261930)!==0&&(c&42)!==0?e===Wu?Fi++:(Fi=0,Wu=e):Fi=0,Zi(0)}}function lv(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ki(t)))}function Ao(){return tv(),nv(),av(),rv()}function rv(){if(yt!==5)return!1;var e=fl,t=Ju;Ju=0;var n=fa(Ra),r=O.T,c=te.p;try{te.p=32>n?32:n,O.T=null,n=Iu,Iu=null;var d=fl,m=Ra;if(yt=0,Kr=fl=null,Ra=0,(qe&6)!==0)throw Error(s(331));var b=qe;if(qe|=4,$p(d.current),Lp(d,d.current,m,n),qe=b,Zi(0,!1),ft&&typeof ft.onPostCommitFiberRoot=="function")try{ft.onPostCommitFiberRoot(on,d)}catch{}return!0}finally{te.p=c,O.T=r,lv(e,t)}}function iv(e,t,n){t=Cn(n,t),t=Ru(e.stateNode,t,2),e=rl(e,t,2),e!==null&&(ue(e,2),Xn(e))}function Ke(e,t,n){if(e.tag===3)iv(e,e,n);else for(;t!==null;){if(t.tag===3){iv(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(dl===null||!dl.has(r))){e=Cn(n,e),n=sp(2),r=rl(t,n,2),r!==null&&(op(n,r,t,e),ue(r,2),Xn(r));break}}t=t.return}}function nd(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Zy;var c=new Set;r.set(t,c)}else c=r.get(t),c===void 0&&(c=new Set,r.set(t,c));c.has(n)||(Xu=!0,c.add(n),e=t0.bind(null,e,t,n),t.then(e,e))}function t0(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Fe===e&&(Ae&n)===n&&(rt===4||rt===3&&(Ae&62914560)===Ae&&300>at()-jo?(qe&2)===0&&Yr(e,0):Fu|=n,Pr===Ae&&(Pr=0)),Xn(e)}function sv(e,t){t===0&&(t=Ul()),e=Ql(e,t),e!==null&&(ue(e,t),Xn(e))}function n0(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),sv(e,n)}function a0(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,c=e.memoizedState;c!==null&&(n=c.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(s(314))}r!==null&&r.delete(t),sv(e,n)}function l0(e,t){return rn(e,t)}var Eo=null,Vr=null,ad=!1,ko=!1,ld=!1,hl=0;function Xn(e){e!==Vr&&e.next===null&&(Vr===null?Eo=Vr=e:Vr=Vr.next=e),ko=!0,ad||(ad=!0,i0())}function Zi(e,t){if(!ld&&ko){ld=!0;do for(var n=!1,r=Eo;r!==null;){if(e!==0){var c=r.pendingLanes;if(c===0)var d=0;else{var m=r.suspendedLanes,b=r.pingedLanes;d=(1<<31-mt(42|e)+1)-1,d&=c&~(m&~b),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(n=!0,dv(r,d))}else d=Ae,d=ua(r,r===Fe?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(d&3)===0||Kn(r,d)||(n=!0,dv(r,d));r=r.next}while(n);ld=!1}}function r0(){ov()}function ov(){ko=ad=!1;var e=0;hl!==0&&v0()&&(e=hl);for(var t=at(),n=null,r=Eo;r!==null;){var c=r.next,d=cv(r,t);d===0?(r.next=null,n===null?Eo=c:n.next=c,c===null&&(Vr=n)):(n=r,(e!==0||(d&3)!==0)&&(ko=!0)),r=c}yt!==0&&yt!==5||Zi(e),hl!==0&&(hl=0)}function cv(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var m=31-mt(d),b=1<<m,M=c[m];M===-1?((b&n)===0||(b&r)!==0)&&(c[m]=pr(b,t)):M<=t&&(e.expiredLanes|=b),d&=~b}if(t=Fe,n=Ae,n=ua(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Pe===2||Pe===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&sn(r),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Kn(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&sn(r),fa(n)){case 2:case 8:n=Sn;break;case 32:n=qt;break;case 268435456:n=ra;break;default:n=qt}return r=uv.bind(null,e),n=rn(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&sn(r),e.callbackPriority=2,e.callbackNode=null,2}function uv(e,t){if(yt!==0&&yt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Ao()&&e.callbackNode!==n)return null;var r=Ae;return r=ua(e,e===Fe?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Yp(e,r,t),cv(e,at()),e.callbackNode!=null&&e.callbackNode===n?uv.bind(null,e):null)}function dv(e,t){if(Ao())return null;Yp(e,t,!0)}function i0(){g0(function(){(qe&6)!==0?rn(Pa,r0):ov()})}function rd(){if(hl===0){var e=zr;e===0&&(e=sa,sa<<=1,(sa&261888)===0&&(sa=256)),hl=e}return hl}function fv(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Ls(""+e)}function mv(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function s0(e,t,n,r,c){if(t==="submit"&&n&&n.stateNode===c){var d=fv((c[et]||null).action),m=r.submitter;m&&(t=(t=m[et]||null)?fv(t.formAction):m.getAttribute("formAction"),t!==null&&(d=t,m=null));var b=new Hs("action","action",null,r,c);e.push({event:b,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(hl!==0){var M=m?mv(c,m):new FormData(c);Mu(n,{pending:!0,data:M,method:c.method,action:d},null,M)}}else typeof d=="function"&&(b.preventDefault(),M=m?mv(c,m):new FormData(c),Mu(n,{pending:!0,data:M,method:c.method,action:d},d,M))},currentTarget:c}]})}}for(var id=0;id<Qc.length;id++){var sd=Qc[id],o0=sd.toLowerCase(),c0=sd[0].toUpperCase()+sd.slice(1);Un(o0,"on"+c0)}Un(Km,"onAnimationEnd"),Un(Ym,"onAnimationIteration"),Un(Gm,"onAnimationStart"),Un("dblclick","onDoubleClick"),Un("focusin","onFocus"),Un("focusout","onBlur"),Un(My,"onTransitionRun"),Un(Cy,"onTransitionStart"),Un(Ty,"onTransitionCancel"),Un(Vm,"onTransitionEnd"),gr("onMouseEnter",["mouseout","mouseover"]),gr("onMouseLeave",["mouseout","mouseover"]),gr("onPointerEnter",["pointerout","pointerover"]),gr("onPointerLeave",["pointerout","pointerover"]),Bl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Bl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Bl("onBeforeInput",["compositionend","keypress","textInput","paste"]),Bl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Bl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Bl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ji="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),u0=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ji));function hv(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],c=r.event;r=r.listeners;e:{var d=void 0;if(t)for(var m=r.length-1;0<=m;m--){var b=r[m],M=b.instance,_=b.currentTarget;if(b=b.listener,M!==d&&c.isPropagationStopped())break e;d=b,c.currentTarget=_;try{d(c)}catch(K){Ks(K)}c.currentTarget=null,d=M}else for(m=0;m<r.length;m++){if(b=r[m],M=b.instance,_=b.currentTarget,b=b.listener,M!==d&&c.isPropagationStopped())break e;d=b,c.currentTarget=_;try{d(c)}catch(K){Ks(K)}c.currentTarget=null,d=M}}}}function Te(e,t){var n=t[vr];n===void 0&&(n=t[vr]=new Set);var r=e+"__bubble";n.has(r)||(pv(t,e,2,!1),n.add(r))}function od(e,t,n){var r=0;t&&(r|=4),pv(n,e,r,t)}var Ro="_reactListening"+Math.random().toString(36).slice(2);function cd(e){if(!e[Ro]){e[Ro]=!0,om.forEach(function(n){n!=="selectionchange"&&(u0.has(n)||od(n,!1,e),od(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ro]||(t[Ro]=!0,od("selectionchange",!1,t))}}function pv(e,t,n,r){switch(Kv(t)){case 2:var c=B0;break;case 8:c=q0;break;default:c=wd}n=c.bind(null,t,n,e),c=void 0,!Ec||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),r?c!==void 0?e.addEventListener(t,n,{capture:!0,passive:c}):e.addEventListener(t,n,!0):c!==void 0?e.addEventListener(t,n,{passive:c}):e.addEventListener(t,n,!1)}function ud(e,t,n,r,c){var d=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var m=r.tag;if(m===3||m===4){var b=r.stateNode.containerInfo;if(b===c)break;if(m===4)for(m=r.return;m!==null;){var M=m.tag;if((M===3||M===4)&&m.stateNode.containerInfo===c)return;m=m.return}for(;b!==null;){if(m=Ll(b),m===null)return;if(M=m.tag,M===5||M===6||M===26||M===27){r=d=m;continue e}b=b.parentNode}}r=r.return}ym(function(){var _=d,K=Tc(n),X=[];e:{var U=Xm.get(e);if(U!==void 0){var B=Hs,oe=e;switch(e){case"keypress":if(qs(n)===0)break e;case"keydown":case"keyup":B=ay;break;case"focusin":oe="focus",B=_c;break;case"focusout":oe="blur",B=_c;break;case"beforeblur":case"afterblur":B=_c;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":B=Nm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":B=Yb;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":B=iy;break;case Km:case Ym:case Gm:B=Xb;break;case Vm:B=oy;break;case"scroll":case"scrollend":B=Pb;break;case"wheel":B=uy;break;case"copy":case"cut":case"paste":B=Zb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":B=Mm;break;case"toggle":case"beforetoggle":B=fy}var xe=(t&4)!==0,Ve=!xe&&(e==="scroll"||e==="scrollend"),k=xe?U!==null?U+"Capture":null:U;xe=[];for(var A=_,z;A!==null;){var Y=A;if(z=Y.stateNode,Y=Y.tag,Y!==5&&Y!==26&&Y!==27||z===null||k===null||(Y=bi(A,k),Y!=null&&xe.push(Ii(A,Y,z))),Ve)break;A=A.return}0<xe.length&&(U=new B(U,oe,null,n,K),X.push({event:U,listeners:xe}))}}if((t&7)===0){e:{if(U=e==="mouseover"||e==="pointerover",B=e==="mouseout"||e==="pointerout",U&&n!==Cc&&(oe=n.relatedTarget||n.fromElement)&&(Ll(oe)||oe[ma]))break e;if((B||U)&&(U=K.window===K?K:(U=K.ownerDocument)?U.defaultView||U.parentWindow:window,B?(oe=n.relatedTarget||n.toElement,B=_,oe=oe?Ll(oe):null,oe!==null&&(Ve=f(oe),xe=oe.tag,oe!==Ve||xe!==5&&xe!==27&&xe!==6)&&(oe=null)):(B=null,oe=_),B!==oe)){if(xe=Nm,Y="onMouseLeave",k="onMouseEnter",A="mouse",(e==="pointerout"||e==="pointerover")&&(xe=Mm,Y="onPointerLeave",k="onPointerEnter",A="pointer"),Ve=B==null?U:cn(B),z=oe==null?U:cn(oe),U=new xe(Y,A+"leave",B,n,K),U.target=Ve,U.relatedTarget=z,Y=null,Ll(K)===_&&(xe=new xe(k,A+"enter",oe,n,K),xe.target=z,xe.relatedTarget=Ve,Y=xe),Ve=Y,B&&oe)t:{for(xe=d0,k=B,A=oe,z=0,Y=k;Y;Y=xe(Y))z++;Y=0;for(var me=A;me;me=xe(me))Y++;for(;0<z-Y;)k=xe(k),z--;for(;0<Y-z;)A=xe(A),Y--;for(;z--;){if(k===A||A!==null&&k===A.alternate){xe=k;break t}k=xe(k),A=xe(A)}xe=null}else xe=null;B!==null&&vv(X,U,B,xe,!1),oe!==null&&Ve!==null&&vv(X,Ve,oe,xe,!0)}}e:{if(U=_?cn(_):window,B=U.nodeName&&U.nodeName.toLowerCase(),B==="select"||B==="input"&&U.type==="file")var Le=_m;else if(Rm(U))if(Om)Le=jy;else{Le=yy;var ce=by}else B=U.nodeName,!B||B.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?_&&Mc(_.elementType)&&(Le=_m):Le=Sy;if(Le&&(Le=Le(e,_))){zm(X,Le,n,K);break e}ce&&ce(e,U,_),e==="focusout"&&_&&U.type==="number"&&_.memoizedProps.value!=null&&wc(U,"number",U.value)}switch(ce=_?cn(_):window,e){case"focusin":(Rm(ce)||ce.contentEditable==="true")&&(wr=ce,qc=_,Ti=null);break;case"focusout":Ti=qc=wr=null;break;case"mousedown":$c=!0;break;case"contextmenu":case"mouseup":case"dragend":$c=!1,Qm(X,n,K);break;case"selectionchange":if(wy)break;case"keydown":case"keyup":Qm(X,n,K)}var Ne;if(Dc)e:{switch(e){case"compositionstart":var Ee="onCompositionStart";break e;case"compositionend":Ee="onCompositionEnd";break e;case"compositionupdate":Ee="onCompositionUpdate";break e}Ee=void 0}else Nr?Em(e,n)&&(Ee="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Ee="onCompositionStart");Ee&&(Cm&&n.locale!=="ko"&&(Nr||Ee!=="onCompositionStart"?Ee==="onCompositionEnd"&&Nr&&(Ne=Sm()):(Ia=K,kc="value"in Ia?Ia.value:Ia.textContent,Nr=!0)),ce=zo(_,Ee),0<ce.length&&(Ee=new wm(Ee,e,null,n,K),X.push({event:Ee,listeners:ce}),Ne?Ee.data=Ne:(Ne=km(n),Ne!==null&&(Ee.data=Ne)))),(Ne=hy?py(e,n):vy(e,n))&&(Ee=zo(_,"onBeforeInput"),0<Ee.length&&(ce=new wm("onBeforeInput","beforeinput",null,n,K),X.push({event:ce,listeners:Ee}),ce.data=Ne)),s0(X,e,_,n,K)}hv(X,t)})}function Ii(e,t,n){return{instance:e,listener:t,currentTarget:n}}function zo(e,t){for(var n=t+"Capture",r=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=bi(e,n),c!=null&&r.unshift(Ii(e,c,d)),c=bi(e,t),c!=null&&r.push(Ii(e,c,d))),e.tag===3)return r;e=e.return}return[]}function d0(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function vv(e,t,n,r,c){for(var d=t._reactName,m=[];n!==null&&n!==r;){var b=n,M=b.alternate,_=b.stateNode;if(b=b.tag,M!==null&&M===r)break;b!==5&&b!==26&&b!==27||_===null||(M=_,c?(_=bi(n,d),_!=null&&m.unshift(Ii(n,_,M))):c||(_=bi(n,d),_!=null&&m.push(Ii(n,_,M)))),n=n.return}m.length!==0&&e.push({event:t,listeners:m})}var f0=/\r\n?/g,m0=/\u0000|\uFFFD/g;function xv(e){return(typeof e=="string"?e:""+e).replace(f0,`
49
+ `).replace(m0,"")}function gv(e,t){return t=xv(t),xv(e)===t}function Ge(e,t,n,r,c,d){switch(n){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||yr(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&yr(e,""+r);break;case"className":Ds(e,"class",r);break;case"tabIndex":Ds(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Ds(e,n,r);break;case"style":gm(e,r,d);break;case"data":if(t!=="object"){Ds(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=Ls(""+r),e.setAttribute(n,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof d=="function"&&(n==="formAction"?(t!=="input"&&Ge(e,t,"name",c.name,c,null),Ge(e,t,"formEncType",c.formEncType,c,null),Ge(e,t,"formMethod",c.formMethod,c,null),Ge(e,t,"formTarget",c.formTarget,c,null)):(Ge(e,t,"encType",c.encType,c,null),Ge(e,t,"method",c.method,c,null),Ge(e,t,"target",c.target,c,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(n);break}r=Ls(""+r),e.setAttribute(n,r);break;case"onClick":r!=null&&(e.onclick=va);break;case"onScroll":r!=null&&Te("scroll",e);break;case"onScrollEnd":r!=null&&Te("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(s(61));if(n=r.__html,n!=null){if(c.children!=null)throw Error(s(60));e.innerHTML=n}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}n=Ls(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""+r):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":r===!0?e.setAttribute(n,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(n,r):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case"popover":Te("beforetoggle",e),Te("toggle",e),Os(e,"popover",r);break;case"xlinkActuate":pa(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":pa(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":pa(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":pa(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":pa(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":pa(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":pa(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":pa(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":pa(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Os(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=Hb.get(n)||n,Os(e,n,r))}}function dd(e,t,n,r,c,d){switch(n){case"style":gm(e,r,d);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(s(61));if(n=r.__html,n!=null){if(c.children!=null)throw Error(s(60));e.innerHTML=n}}break;case"children":typeof r=="string"?yr(e,r):(typeof r=="number"||typeof r=="bigint")&&yr(e,""+r);break;case"onScroll":r!=null&&Te("scroll",e);break;case"onScrollEnd":r!=null&&Te("scrollend",e);break;case"onClick":r!=null&&(e.onclick=va);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!cm.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(c=n.endsWith("Capture"),t=n.slice(2,c?n.length-7:void 0),d=e[et]||null,d=d!=null?d[n]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof r=="function")){typeof d!="function"&&d!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,c);break e}n in e?e[n]=r:r===!0?e.setAttribute(n,""):Os(e,n,r)}}}function zt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Te("error",e),Te("load",e);var r=!1,c=!1,d;for(d in n)if(n.hasOwnProperty(d)){var m=n[d];if(m!=null)switch(d){case"src":r=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:Ge(e,t,d,m,n,null)}}c&&Ge(e,t,"srcSet",n.srcSet,n,null),r&&Ge(e,t,"src",n.src,n,null);return;case"input":Te("invalid",e);var b=d=m=c=null,M=null,_=null;for(r in n)if(n.hasOwnProperty(r)){var K=n[r];if(K!=null)switch(r){case"name":c=K;break;case"type":m=K;break;case"checked":M=K;break;case"defaultChecked":_=K;break;case"value":d=K;break;case"defaultValue":b=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(s(137,t));break;default:Ge(e,t,r,K,n,null)}}hm(e,d,b,M,_,m,c,!1);return;case"select":Te("invalid",e),r=m=d=null;for(c in n)if(n.hasOwnProperty(c)&&(b=n[c],b!=null))switch(c){case"value":d=b;break;case"defaultValue":m=b;break;case"multiple":r=b;default:Ge(e,t,c,b,n,null)}t=d,n=m,e.multiple=!!r,t!=null?br(e,!!r,t,!1):n!=null&&br(e,!!r,n,!0);return;case"textarea":Te("invalid",e),d=c=r=null;for(m in n)if(n.hasOwnProperty(m)&&(b=n[m],b!=null))switch(m){case"value":r=b;break;case"defaultValue":c=b;break;case"children":d=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(s(91));break;default:Ge(e,t,m,b,n,null)}vm(e,r,c,d);return;case"option":for(M in n)if(n.hasOwnProperty(M)&&(r=n[M],r!=null))switch(M){case"selected":e.selected=r&&typeof r!="function"&&typeof r!="symbol";break;default:Ge(e,t,M,r,n,null)}return;case"dialog":Te("beforetoggle",e),Te("toggle",e),Te("cancel",e),Te("close",e);break;case"iframe":case"object":Te("load",e);break;case"video":case"audio":for(r=0;r<Ji.length;r++)Te(Ji[r],e);break;case"image":Te("error",e),Te("load",e);break;case"details":Te("toggle",e);break;case"embed":case"source":case"link":Te("error",e),Te("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(_ in n)if(n.hasOwnProperty(_)&&(r=n[_],r!=null))switch(_){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,t));default:Ge(e,t,_,r,n,null)}return;default:if(Mc(t)){for(K in n)n.hasOwnProperty(K)&&(r=n[K],r!==void 0&&dd(e,t,K,r,n,void 0));return}}for(b in n)n.hasOwnProperty(b)&&(r=n[b],r!=null&&Ge(e,t,b,r,n,null))}function h0(e,t,n,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,m=null,b=null,M=null,_=null,K=null;for(B in n){var X=n[B];if(n.hasOwnProperty(B)&&X!=null)switch(B){case"checked":break;case"value":break;case"defaultValue":M=X;default:r.hasOwnProperty(B)||Ge(e,t,B,null,r,X)}}for(var U in r){var B=r[U];if(X=n[U],r.hasOwnProperty(U)&&(B!=null||X!=null))switch(U){case"type":d=B;break;case"name":c=B;break;case"checked":_=B;break;case"defaultChecked":K=B;break;case"value":m=B;break;case"defaultValue":b=B;break;case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(s(137,t));break;default:B!==X&&Ge(e,t,U,B,r,X)}}Nc(e,m,b,M,_,K,d,c);return;case"select":B=m=b=U=null;for(d in n)if(M=n[d],n.hasOwnProperty(d)&&M!=null)switch(d){case"value":break;case"multiple":B=M;default:r.hasOwnProperty(d)||Ge(e,t,d,null,r,M)}for(c in r)if(d=r[c],M=n[c],r.hasOwnProperty(c)&&(d!=null||M!=null))switch(c){case"value":U=d;break;case"defaultValue":b=d;break;case"multiple":m=d;default:d!==M&&Ge(e,t,c,d,r,M)}t=b,n=m,r=B,U!=null?br(e,!!n,U,!1):!!r!=!!n&&(t!=null?br(e,!!n,t,!0):br(e,!!n,n?[]:"",!1));return;case"textarea":B=U=null;for(b in n)if(c=n[b],n.hasOwnProperty(b)&&c!=null&&!r.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Ge(e,t,b,null,r,c)}for(m in r)if(c=r[m],d=n[m],r.hasOwnProperty(m)&&(c!=null||d!=null))switch(m){case"value":U=c;break;case"defaultValue":B=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(s(91));break;default:c!==d&&Ge(e,t,m,c,r,d)}pm(e,U,B);return;case"option":for(var oe in n)if(U=n[oe],n.hasOwnProperty(oe)&&U!=null&&!r.hasOwnProperty(oe))switch(oe){case"selected":e.selected=!1;break;default:Ge(e,t,oe,null,r,U)}for(M in r)if(U=r[M],B=n[M],r.hasOwnProperty(M)&&U!==B&&(U!=null||B!=null))switch(M){case"selected":e.selected=U&&typeof U!="function"&&typeof U!="symbol";break;default:Ge(e,t,M,U,r,B)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var xe in n)U=n[xe],n.hasOwnProperty(xe)&&U!=null&&!r.hasOwnProperty(xe)&&Ge(e,t,xe,null,r,U);for(_ in r)if(U=r[_],B=n[_],r.hasOwnProperty(_)&&U!==B&&(U!=null||B!=null))switch(_){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(s(137,t));break;default:Ge(e,t,_,U,r,B)}return;default:if(Mc(t)){for(var Ve in n)U=n[Ve],n.hasOwnProperty(Ve)&&U!==void 0&&!r.hasOwnProperty(Ve)&&dd(e,t,Ve,void 0,r,U);for(K in r)U=r[K],B=n[K],!r.hasOwnProperty(K)||U===B||U===void 0&&B===void 0||dd(e,t,K,U,r,B);return}}for(var k in n)U=n[k],n.hasOwnProperty(k)&&U!=null&&!r.hasOwnProperty(k)&&Ge(e,t,k,null,r,U);for(X in r)U=r[X],B=n[X],!r.hasOwnProperty(X)||U===B||U==null&&B==null||Ge(e,t,X,U,r,B)}function bv(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function p0(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var c=n[r],d=c.transferSize,m=c.initiatorType,b=c.duration;if(d&&b&&bv(m)){for(m=0,b=c.responseEnd,r+=1;r<n.length;r++){var M=n[r],_=M.startTime;if(_>b)break;var K=M.transferSize,X=M.initiatorType;K&&bv(X)&&(M=M.responseEnd,m+=K*(M<b?1:(b-_)/(M-_)))}if(--r,t+=8*(d+m)/(c.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var fd=null,md=null;function _o(e){return e.nodeType===9?e:e.ownerDocument}function yv(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Sv(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function hd(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var pd=null;function v0(){var e=window.event;return e&&e.type==="popstate"?e===pd?!1:(pd=e,!0):(pd=null,!1)}var jv=typeof setTimeout=="function"?setTimeout:void 0,x0=typeof clearTimeout=="function"?clearTimeout:void 0,Nv=typeof Promise=="function"?Promise:void 0,g0=typeof queueMicrotask=="function"?queueMicrotask:typeof Nv<"u"?function(e){return Nv.resolve(null).then(e).catch(b0)}:jv;function b0(e){setTimeout(function(){throw e})}function pl(e){return e==="head"}function wv(e,t){var n=t,r=0;do{var c=n.nextSibling;if(e.removeChild(n),c&&c.nodeType===8)if(n=c.data,n==="/$"||n==="/&"){if(r===0){e.removeChild(c),Jr(t);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")Wi(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Wi(n);for(var d=n.firstChild;d;){var m=d.nextSibling,b=d.nodeName;d[tt]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&d.rel.toLowerCase()==="stylesheet"||n.removeChild(d),d=m}}else n==="body"&&Wi(e.ownerDocument.body);n=c}while(n);Jr(t)}function Mv(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=r}while(n)}function vd(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":vd(n),Ja(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function y0(e,t,n,r){for(;e.nodeType===1;){var c=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[tt])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=Rn(e.nextSibling),e===null)break}return null}function S0(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Rn(e.nextSibling),e===null))return null;return e}function Cv(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Rn(e.nextSibling),e===null))return null;return e}function xd(e){return e.data==="$?"||e.data==="$~"}function gd(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function j0(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var r=function(){t(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function Rn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var bd=null;function Tv(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Rn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Av(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function Ev(e,t,n){switch(t=_o(n),e){case"html":if(e=t.documentElement,!e)throw Error(s(452));return e;case"head":if(e=t.head,!e)throw Error(s(453));return e;case"body":if(e=t.body,!e)throw Error(s(454));return e;default:throw Error(s(451))}}function Wi(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Ja(e)}var zn=new Map,kv=new Set;function Oo(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var za=te.d;te.d={f:N0,r:w0,D:M0,C:C0,L:T0,m:A0,X:k0,S:E0,M:R0};function N0(){var e=za.f(),t=Mo();return e||t}function w0(e){var t=ha(e);t!==null&&t.tag===5&&t.type==="form"?Vh(t):za.r(e)}var Xr=typeof document>"u"?null:document;function Rv(e,t,n){var r=Xr;if(r&&typeof t=="string"&&t){var c=wn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof n=="string"&&(c+='[crossorigin="'+n+'"]'),kv.has(c)||(kv.add(c),e={rel:e,crossOrigin:n,href:t},r.querySelector(c)===null&&(t=r.createElement("link"),zt(t,"link",e),wt(t),r.head.appendChild(t)))}}function M0(e){za.D(e),Rv("dns-prefetch",e,null)}function C0(e,t){za.C(e,t),Rv("preconnect",e,t)}function T0(e,t,n){za.L(e,t,n);var r=Xr;if(r&&e&&t){var c='link[rel="preload"][as="'+wn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(c+='[imagesrcset="'+wn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(c+='[imagesizes="'+wn(n.imageSizes)+'"]')):c+='[href="'+wn(e)+'"]';var d=c;switch(t){case"style":d=Fr(e);break;case"script":d=Zr(e)}zn.has(d)||(e=g({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),zn.set(d,e),r.querySelector(c)!==null||t==="style"&&r.querySelector(es(d))||t==="script"&&r.querySelector(ts(d))||(t=r.createElement("link"),zt(t,"link",e),wt(t),r.head.appendChild(t)))}}function A0(e,t){za.m(e,t);var n=Xr;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+wn(r)+'"][href="'+wn(e)+'"]',d=c;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=Zr(e)}if(!zn.has(d)&&(e=g({rel:"modulepreload",href:e},t),zn.set(d,e),n.querySelector(c)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(ts(d)))return}r=n.createElement("link"),zt(r,"link",e),wt(r),n.head.appendChild(r)}}}function E0(e,t,n){za.S(e,t,n);var r=Xr;if(r&&e){var c=xr(r).hoistableStyles,d=Fr(e);t=t||"default";var m=c.get(d);if(!m){var b={loading:0,preload:null};if(m=r.querySelector(es(d)))b.loading=5;else{e=g({rel:"stylesheet",href:e,"data-precedence":t},n),(n=zn.get(d))&&yd(e,n);var M=m=r.createElement("link");wt(M),zt(M,"link",e),M._p=new Promise(function(_,K){M.onload=_,M.onerror=K}),M.addEventListener("load",function(){b.loading|=1}),M.addEventListener("error",function(){b.loading|=2}),b.loading|=4,Do(m,t,r)}m={type:"stylesheet",instance:m,count:1,state:b},c.set(d,m)}}}function k0(e,t){za.X(e,t);var n=Xr;if(n&&e){var r=xr(n).hoistableScripts,c=Zr(e),d=r.get(c);d||(d=n.querySelector(ts(c)),d||(e=g({src:e,async:!0},t),(t=zn.get(c))&&Sd(e,t),d=n.createElement("script"),wt(d),zt(d,"link",e),n.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(c,d))}}function R0(e,t){za.M(e,t);var n=Xr;if(n&&e){var r=xr(n).hoistableScripts,c=Zr(e),d=r.get(c);d||(d=n.querySelector(ts(c)),d||(e=g({src:e,async:!0,type:"module"},t),(t=zn.get(c))&&Sd(e,t),d=n.createElement("script"),wt(d),zt(d,"link",e),n.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},r.set(c,d))}}function zv(e,t,n,r){var c=(c=ve.current)?Oo(c):null;if(!c)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Fr(n.href),n=xr(c).hoistableStyles,r=n.get(t),r||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Fr(n.href);var d=xr(c).hoistableStyles,m=d.get(e);if(m||(c=c.ownerDocument||c,m={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,m),(d=c.querySelector(es(e)))&&!d._p&&(m.instance=d,m.state.loading=5),zn.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},zn.set(e,n),d||z0(c,e,n,m.state))),t&&r===null)throw Error(s(528,""));return m}if(t&&r!==null)throw Error(s(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Zr(n),n=xr(c).hoistableScripts,r=n.get(t),r||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Fr(e){return'href="'+wn(e)+'"'}function es(e){return'link[rel="stylesheet"]['+e+"]"}function _v(e){return g({},e,{"data-precedence":e.precedence,precedence:null})}function z0(e,t,n,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),zt(t,"link",n),wt(t),e.head.appendChild(t))}function Zr(e){return'[src="'+wn(e)+'"]'}function ts(e){return"script[async]"+e}function Ov(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+wn(n.href)+'"]');if(r)return t.instance=r,wt(r),r;var c=g({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),wt(r),zt(r,"style",c),Do(r,n.precedence,e),t.instance=r;case"stylesheet":c=Fr(n.href);var d=e.querySelector(es(c));if(d)return t.state.loading|=4,t.instance=d,wt(d),d;r=_v(n),(c=zn.get(c))&&yd(r,c),d=(e.ownerDocument||e).createElement("link"),wt(d);var m=d;return m._p=new Promise(function(b,M){m.onload=b,m.onerror=M}),zt(d,"link",r),t.state.loading|=4,Do(d,n.precedence,e),t.instance=d;case"script":return d=Zr(n.src),(c=e.querySelector(ts(d)))?(t.instance=c,wt(c),c):(r=n,(c=zn.get(d))&&(r=g({},n),Sd(r,c)),e=e.ownerDocument||e,c=e.createElement("script"),wt(c),zt(c,"link",r),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(s(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,Do(r,n.precedence,e));return t.instance}function Do(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=r.length?r[r.length-1]:null,d=c,m=0;m<r.length;m++){var b=r[m];if(b.dataset.precedence===t)d=b;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function yd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Sd(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Uo=null;function Dv(e,t,n){if(Uo===null){var r=new Map,c=Uo=new Map;c.set(n,r)}else c=Uo,r=c.get(n),r||(r=new Map,c.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),c=0;c<n.length;c++){var d=n[c];if(!(d[tt]||d[$e]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var m=d.getAttribute(t)||"";m=e+m;var b=r.get(m);b?b.push(d):r.set(m,[d])}}return r}function Uv(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function _0(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Lv(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function O0(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var c=Fr(r.href),d=t.querySelector(es(c));if(d){t=d._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Lo.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=d,wt(d);return}d=t.ownerDocument||t,r=_v(r),(c=zn.get(c))&&yd(r,c),d=d.createElement("link"),wt(d);var m=d;m._p=new Promise(function(b,M){m.onload=b,m.onerror=M}),zt(d,"link",r),n.instance=d}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Lo.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var jd=0;function D0(e,t){return e.stylesheets&&e.count===0&&qo(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&qo(e,e.stylesheets),e.unsuspend){var d=e.unsuspend;e.unsuspend=null,d()}},6e4+t);0<e.imgBytes&&jd===0&&(jd=62500*p0());var c=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&qo(e,e.stylesheets),e.unsuspend)){var d=e.unsuspend;e.unsuspend=null,d()}},(e.imgBytes>jd?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(c)}}:null}function Lo(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)qo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Bo=null;function qo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Bo=new Map,t.forEach(U0,e),Bo=null,Lo.call(e))}function U0(e,t){if(!(t.state.loading&4)){var n=Bo.get(e);if(n)var r=n.get(null);else{n=new Map,Bo.set(e,n);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var m=c[d];(m.nodeName==="LINK"||m.getAttribute("media")!=="not all")&&(n.set(m.dataset.precedence,m),r=m)}r&&n.set(null,r)}c=t.instance,m=c.getAttribute("data-precedence"),d=n.get(m)||r,d===r&&n.set(null,c),n.set(m,c),this.count++,r=Lo.bind(this),c.addEventListener("load",r),c.addEventListener("error",r),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var ns={$$typeof:H,Provider:null,Consumer:null,_currentValue:re,_currentValue2:re,_threadCount:0};function L0(e,t,n,r,c,d,m,b,M){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Va(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Va(0),this.hiddenUpdates=Va(null),this.identifierPrefix=r,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=m,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=M,this.incompleteTransitions=new Map}function Bv(e,t,n,r,c,d,m,b,M,_,K,X){return e=new L0(e,t,n,m,M,_,K,X,b),t=1,d===!0&&(t|=24),d=dn(3,null,null,t),e.current=d,d.stateNode=e,t=tu(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:r,isDehydrated:n,cache:t},ru(d),e}function qv(e){return e?(e=Tr,e):Tr}function $v(e,t,n,r,c,d){c=qv(c),r.context===null?r.context=c:r.pendingContext=c,r=ll(t),r.payload={element:n},d=d===void 0?null:d,d!==null&&(r.callback=d),n=rl(e,r,t),n!==null&&(It(n,e,t),Oi(n,e,t))}function Hv(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Nd(e,t){Hv(e,t),(e=e.alternate)&&Hv(e,t)}function Qv(e){if(e.tag===13||e.tag===31){var t=Ql(e,67108864);t!==null&&It(t,e,67108864),Nd(e,67108864)}}function Pv(e){if(e.tag===13||e.tag===31){var t=vn();t=da(t);var n=Ql(e,t);n!==null&&It(n,e,t),Nd(e,t)}}var $o=!0;function B0(e,t,n,r){var c=O.T;O.T=null;var d=te.p;try{te.p=2,wd(e,t,n,r)}finally{te.p=d,O.T=c}}function q0(e,t,n,r){var c=O.T;O.T=null;var d=te.p;try{te.p=8,wd(e,t,n,r)}finally{te.p=d,O.T=c}}function wd(e,t,n,r){if($o){var c=Md(r);if(c===null)ud(e,t,r,Ho,n),Yv(e,r);else if(H0(c,e,t,n,r))r.stopPropagation();else if(Yv(e,r),t&4&&-1<$0.indexOf(e)){for(;c!==null;){var d=ha(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var m=jn(d.pendingLanes);if(m!==0){var b=d;for(b.pendingLanes|=2,b.entangledLanes|=2;m;){var M=1<<31-mt(m);b.entanglements[1]|=M,m&=~M}Xn(d),(qe&6)===0&&(No=at()+500,Zi(0))}}break;case 31:case 13:b=Ql(d,2),b!==null&&It(b,d,2),Mo(),Nd(d,2)}if(d=Md(r),d===null&&ud(e,t,r,Ho,n),d===c)break;c=d}c!==null&&r.stopPropagation()}else ud(e,t,r,null,n)}}function Md(e){return e=Tc(e),Cd(e)}var Ho=null;function Cd(e){if(Ho=null,e=Ll(e),e!==null){var t=f(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=p(t),e!==null)return e;e=null}else if(n===31){if(e=h(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ho=e,null}function Kv(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Qa()){case Pa:return 2;case Sn:return 8;case qt:case Ka:return 32;case ra:return 268435456;default:return 32}default:return 32}}var Td=!1,vl=null,xl=null,gl=null,as=new Map,ls=new Map,bl=[],$0="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Yv(e,t){switch(e){case"focusin":case"focusout":vl=null;break;case"dragenter":case"dragleave":xl=null;break;case"mouseover":case"mouseout":gl=null;break;case"pointerover":case"pointerout":as.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ls.delete(t.pointerId)}}function rs(e,t,n,r,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:d,targetContainers:[c]},t!==null&&(t=ha(t),t!==null&&Qv(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function H0(e,t,n,r,c){switch(t){case"focusin":return vl=rs(vl,e,t,n,r,c),!0;case"dragenter":return xl=rs(xl,e,t,n,r,c),!0;case"mouseover":return gl=rs(gl,e,t,n,r,c),!0;case"pointerover":var d=c.pointerId;return as.set(d,rs(as.get(d)||null,e,t,n,r,c)),!0;case"gotpointercapture":return d=c.pointerId,ls.set(d,rs(ls.get(d)||null,e,t,n,r,c)),!0}return!1}function Gv(e){var t=Ll(e.target);if(t!==null){var n=f(t);if(n!==null){if(t=n.tag,t===13){if(t=p(n),t!==null){e.blockedOn=t,Za(e.priority,function(){Pv(n)});return}}else if(t===31){if(t=h(n),t!==null){e.blockedOn=t,Za(e.priority,function(){Pv(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Qo(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Md(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Cc=r,n.target.dispatchEvent(r),Cc=null}else return t=ha(n),t!==null&&Qv(t),e.blockedOn=n,!1;t.shift()}return!0}function Vv(e,t,n){Qo(e)&&n.delete(t)}function Q0(){Td=!1,vl!==null&&Qo(vl)&&(vl=null),xl!==null&&Qo(xl)&&(xl=null),gl!==null&&Qo(gl)&&(gl=null),as.forEach(Vv),ls.forEach(Vv)}function Po(e,t){e.blockedOn===t&&(e.blockedOn=null,Td||(Td=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Q0)))}var Ko=null;function Xv(e){Ko!==e&&(Ko=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Ko===e&&(Ko=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],c=e[t+2];if(typeof r!="function"){if(Cd(r||n)===null)continue;break}var d=ha(n);d!==null&&(e.splice(t,3),t-=3,Mu(d,{pending:!0,data:c,method:n.method,action:r},r,c))}}))}function Jr(e){function t(M){return Po(M,e)}vl!==null&&Po(vl,e),xl!==null&&Po(xl,e),gl!==null&&Po(gl,e),as.forEach(t),ls.forEach(t);for(var n=0;n<bl.length;n++){var r=bl[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<bl.length&&(n=bl[0],n.blockedOn===null);)Gv(n),n.blockedOn===null&&bl.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var c=n[r],d=n[r+1],m=c[et]||null;if(typeof d=="function")m||Xv(n);else if(m){var b=null;if(d&&d.hasAttribute("formAction")){if(c=d,m=d[et]||null)b=m.formAction;else if(Cd(c)!==null)continue}else b=m.action;typeof b=="function"?n[r+1]=b:(n.splice(r,3),r-=3),Xv(n)}}}function Fv(){function e(d){d.canIntercept&&d.info==="react-transition"&&d.intercept({handler:function(){return new Promise(function(m){return c=m})},focusReset:"manual",scroll:"manual"})}function t(){c!==null&&(c(),c=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var d=navigation.currentEntry;d&&d.url!=null&&navigation.navigate(d.url,{state:d.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,c=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),c!==null&&(c(),c=null)}}}function Ad(e){this._internalRoot=e}Yo.prototype.render=Ad.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(s(409));var n=t.current,r=vn();$v(n,r,e,t,null,null)},Yo.prototype.unmount=Ad.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;$v(e.current,2,null,e,null,null),Mo(),t[ma]=null}};function Yo(e){this._internalRoot=e}Yo.prototype.unstable_scheduleHydration=function(e){if(e){var t=Fa();e={blockedOn:null,target:e,priority:t};for(var n=0;n<bl.length&&t!==0&&t<bl[n].priority;n++);bl.splice(n,0,e),n===0&&Gv(e)}};var Zv=l.version;if(Zv!=="19.2.7")throw Error(s(527,Zv,"19.2.7"));te.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(s(188)):(e=Object.keys(e).join(","),Error(s(268,e)));return e=x(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var P0={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:O,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Go=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Go.isDisabled&&Go.supportsFiber)try{on=Go.inject(P0),ft=Go}catch{}}return ss.createRoot=function(e,t){if(!u(e))throw Error(s(299));var n=!1,r="",c=ap,d=lp,m=rp;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(m=t.onRecoverableError)),t=Bv(e,1,!1,null,null,n,r,null,c,d,m,Fv),e[ma]=t.current,cd(e),new Ad(t)},ss.hydrateRoot=function(e,t,n){if(!u(e))throw Error(s(299));var r=!1,c="",d=ap,m=lp,b=rp,M=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onUncaughtError!==void 0&&(d=n.onUncaughtError),n.onCaughtError!==void 0&&(m=n.onCaughtError),n.onRecoverableError!==void 0&&(b=n.onRecoverableError),n.formState!==void 0&&(M=n.formState)),t=Bv(e,1,!0,t,n??null,r,c,M,d,m,b,Fv),t.context=qv(null),n=t.current,r=vn(),r=da(r),c=ll(r),c.callback=null,rl(n,c,r),n=r,t.current.lanes=n,ue(t,n),Xn(t),e[ma]=t.current,cd(e),new Yo(t)},ss.version="19.2.7",ss}var sx;function e1(){if(sx)return _d.exports;sx=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(l){console.error(l)}}return a(),_d.exports=W0(),_d.exports}var t1=e1();/**
50
+ * react-router v7.17.0
51
+ *
52
+ * Copyright (c) Remix Software Inc.
53
+ *
54
+ * This source code is licensed under the MIT license found in the
55
+ * LICENSE.md file in the root directory of this source tree.
56
+ *
57
+ * @license MIT
58
+ */var ox="popstate";function cx(a){return typeof a=="object"&&a!=null&&"pathname"in a&&"search"in a&&"hash"in a&&"state"in a&&"key"in a}function n1(a={}){function l(s,u){var x;let f=(x=u.state)==null?void 0:x.masked,{pathname:p,search:h,hash:v}=f||s.location;return Wd("",{pathname:p,search:h,hash:v},u.state&&u.state.usr||null,u.state&&u.state.key||"default",f?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function o(s,u){return typeof u=="string"?u:ps(u)}return l1(l,o,null,a)}function nt(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function Hn(a,l){if(!a){typeof console<"u"&&console.warn(l);try{throw new Error(l)}catch{}}}function a1(){return Math.random().toString(36).substring(2,10)}function ux(a,l){return{usr:a.state,key:a.key,idx:l,masked:a.mask?{pathname:a.pathname,search:a.search,hash:a.hash}:void 0}}function Wd(a,l,o=null,s,u){return{pathname:typeof a=="string"?a:a.pathname,search:"",hash:"",...typeof l=="string"?pi(l):l,state:o,key:l&&l.key||s||a1(),mask:u}}function ps({pathname:a="/",search:l="",hash:o=""}){return l&&l!=="?"&&(a+=l.charAt(0)==="?"?l:"?"+l),o&&o!=="#"&&(a+=o.charAt(0)==="#"?o:"#"+o),a}function pi(a){let l={};if(a){let o=a.indexOf("#");o>=0&&(l.hash=a.substring(o),a=a.substring(0,o));let s=a.indexOf("?");s>=0&&(l.search=a.substring(s),a=a.substring(0,s)),a&&(l.pathname=a)}return l}function l1(a,l,o,s={}){let{window:u=document.defaultView,v5Compat:f=!1}=s,p=u.history,h="POP",v=null,x=y();x==null&&(x=0,p.replaceState({...p.state,idx:x},""));function y(){return(p.state||{idx:null}).idx}function g(){h="POP";let D=y(),R=D==null?null:D-x;x=D,v&&v({action:h,location:E.location,delta:R})}function j(D,R){h="PUSH";let L=cx(D)?D:Wd(E.location,D,R);x=y()+1;let H=ux(L,x),P=E.createHref(L.mask||L);try{p.pushState(H,"",P)}catch(G){if(G instanceof DOMException&&G.name==="DataCloneError")throw G;u.location.assign(P)}f&&v&&v({action:h,location:E.location,delta:1})}function N(D,R){h="REPLACE";let L=cx(D)?D:Wd(E.location,D,R);x=y();let H=ux(L,x),P=E.createHref(L.mask||L);p.replaceState(H,"",P),f&&v&&v({action:h,location:E.location,delta:0})}function T(D){return r1(u,D)}let E={get action(){return h},get location(){return a(u,p)},listen(D){if(v)throw new Error("A history only accepts one active listener");return u.addEventListener(ox,g),v=D,()=>{u.removeEventListener(ox,g),v=null}},createHref(D){return l(u,D)},createURL:T,encodeLocation(D){let R=T(D);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:j,replace:N,go(D){return p.go(D)}};return E}function r1(a,l,o=!1){let s="http://localhost";a&&(s=a.location.origin!=="null"?a.location.origin:a.location.href),nt(s,"No window.location.(origin|href) available to create URL");let u=typeof l=="string"?l:ps(l);return u=u.replace(/ $/,"%20"),!o&&u.startsWith("//")&&(u=s+u),new URL(u,s)}function pg(a,l,o="/"){return i1(a,l,o,!1)}function i1(a,l,o,s,u){let f=typeof l=="string"?pi(l):l,p=$a(f.pathname||"/",o);if(p==null)return null;let h=s1(a),v=null,x=b1(p);for(let y=0;v==null&&y<h.length;++y)v=x1(h[y],x,s);return v}function s1(a){let l=vg(a);return o1(l),l}function vg(a,l=[],o=[],s="",u=!1){let f=(p,h,v=u,x)=>{let y={relativePath:x===void 0?p.path||"":x,caseSensitive:p.caseSensitive===!0,childrenIndex:h,route:p};if(y.relativePath.startsWith("/")){if(!y.relativePath.startsWith(s)&&v)return;nt(y.relativePath.startsWith(s),`Absolute route path "${y.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),y.relativePath=y.relativePath.slice(s.length)}let g=$n([s,y.relativePath]),j=o.concat(y);p.children&&p.children.length>0&&(nt(p.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),vg(p.children,l,j,g,v)),!(p.path==null&&!p.index)&&l.push({path:g,score:p1(g,p.index),routesMeta:j})};return a.forEach((p,h)=>{var v;if(p.path===""||!((v=p.path)!=null&&v.includes("?")))f(p,h);else for(let x of xg(p.path))f(p,h,!0,x)}),l}function xg(a){let l=a.split("/");if(l.length===0)return[];let[o,...s]=l,u=o.endsWith("?"),f=o.replace(/\?$/,"");if(s.length===0)return u?[f,""]:[f];let p=xg(s.join("/")),h=[];return h.push(...p.map(v=>v===""?f:[f,v].join("/"))),u&&h.push(...p),h.map(v=>a.startsWith("/")&&v===""?"/":v)}function o1(a){a.sort((l,o)=>l.score!==o.score?o.score-l.score:v1(l.routesMeta.map(s=>s.childrenIndex),o.routesMeta.map(s=>s.childrenIndex)))}var c1=/^:[\w-]+$/,u1=3,d1=2,f1=1,m1=10,h1=-2,dx=a=>a==="*";function p1(a,l){let o=a.split("/"),s=o.length;return o.some(dx)&&(s+=h1),l&&(s+=d1),o.filter(u=>!dx(u)).reduce((u,f)=>u+(c1.test(f)?u1:f===""?f1:m1),s)}function v1(a,l){return a.length===l.length&&a.slice(0,-1).every((s,u)=>s===l[u])?a[a.length-1]-l[l.length-1]:0}function x1(a,l,o=!1){let{routesMeta:s}=a,u={},f="/",p=[];for(let h=0;h<s.length;++h){let v=s[h],x=h===s.length-1,y=f==="/"?l:l.slice(f.length)||"/",g=rc({path:v.relativePath,caseSensitive:v.caseSensitive,end:x},y),j=v.route;if(!g&&x&&o&&!s[s.length-1].route.index&&(g=rc({path:v.relativePath,caseSensitive:v.caseSensitive,end:!1},y)),!g)return null;Object.assign(u,g.params),p.push({params:u,pathname:$n([f,g.pathname]),pathnameBase:N1($n([f,g.pathnameBase])),route:j}),g.pathnameBase!=="/"&&(f=$n([f,g.pathnameBase]))}return p}function rc(a,l){typeof a=="string"&&(a={path:a,caseSensitive:!1,end:!0});let[o,s]=g1(a.path,a.caseSensitive,a.end),u=l.match(o);if(!u)return null;let f=u[0],p=f.replace(/(.)\/+$/,"$1"),h=u.slice(1);return{params:s.reduce((x,{paramName:y,isOptional:g},j)=>{if(y==="*"){let T=h[j]||"";p=f.slice(0,f.length-T.length).replace(/(.)\/+$/,"$1")}const N=h[j];return g&&!N?x[y]=void 0:x[y]=(N||"").replace(/%2F/g,"/"),x},{}),pathname:f,pathnameBase:p,pattern:a}}function g1(a,l=!1,o=!0){Hn(a==="*"||!a.endsWith("*")||a.endsWith("/*"),`Route path "${a}" will be treated as if it were "${a.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${a.replace(/\*$/,"/*")}".`);let s=[],u="^"+a.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(p,h,v,x,y)=>{if(s.push({paramName:h,isOptional:v!=null}),v){let g=y.charAt(x+p.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return a.endsWith("*")?(s.push({paramName:"*"}),u+=a==="*"||a==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?u+="\\/*$":a!==""&&a!=="/"&&(u+="(?:(?=\\/|$))"),[new RegExp(u,l?void 0:"i"),s]}function b1(a){try{return a.split("/").map(l=>decodeURIComponent(l).replace(/\//g,"%2F")).join("/")}catch(l){return Hn(!1,`The URL path "${a}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${l}).`),a}}function $a(a,l){if(l==="/")return a;if(!a.toLowerCase().startsWith(l.toLowerCase()))return null;let o=l.endsWith("/")?l.length-1:l.length,s=a.charAt(o);return s&&s!=="/"?null:a.slice(o)||"/"}var y1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function S1(a,l="/"){let{pathname:o,search:s="",hash:u=""}=typeof a=="string"?pi(a):a,f;return o?(o=bg(o),o.startsWith("/")?f=fx(o.substring(1),"/"):f=fx(o,l)):f=l,{pathname:f,search:w1(s),hash:M1(u)}}function fx(a,l){let o=ic(l).split("/");return a.split("/").forEach(u=>{u===".."?o.length>1&&o.pop():u!=="."&&o.push(u)}),o.length>1?o.join("/"):"/"}function Ld(a,l,o,s){return`Cannot include a '${a}' character in a manually specified \`to.${l}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${o}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function j1(a){return a.filter((l,o)=>o===0||l.route.path&&l.route.path.length>0)}function gg(a){let l=j1(a);return l.map((o,s)=>s===l.length-1?o.pathname:o.pathnameBase)}function Rf(a,l,o,s=!1){let u;typeof a=="string"?u=pi(a):(u={...a},nt(!u.pathname||!u.pathname.includes("?"),Ld("?","pathname","search",u)),nt(!u.pathname||!u.pathname.includes("#"),Ld("#","pathname","hash",u)),nt(!u.search||!u.search.includes("#"),Ld("#","search","hash",u)));let f=a===""||u.pathname==="",p=f?"/":u.pathname,h;if(p==null)h=o;else{let g=l.length-1;if(!s&&p.startsWith("..")){let j=p.split("/");for(;j[0]==="..";)j.shift(),g-=1;u.pathname=j.join("/")}h=g>=0?l[g]:"/"}let v=S1(u,h),x=p&&p!=="/"&&p.endsWith("/"),y=(f||p===".")&&o.endsWith("/");return!v.pathname.endsWith("/")&&(x||y)&&(v.pathname+="/"),v}var bg=a=>a.replace(/\/\/+/g,"/"),$n=a=>bg(a.join("/")),ic=a=>a.replace(/\/+$/,""),N1=a=>ic(a).replace(/^\/*/,"/"),w1=a=>!a||a==="?"?"":a.startsWith("?")?a:"?"+a,M1=a=>!a||a==="#"?"":a.startsWith("#")?a:"#"+a,C1=class{constructor(a,l,o,s=!1){this.status=a,this.statusText=l||"",this.internal=s,o instanceof Error?(this.data=o.toString(),this.error=o):this.data=o}};function T1(a){return a!=null&&typeof a.status=="number"&&typeof a.statusText=="string"&&typeof a.internal=="boolean"&&"data"in a}function A1(a){let l=a.map(o=>o.route.path).filter(Boolean);return $n(l)||"/"}var yg=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Sg(a,l){let o=a;if(typeof o!="string"||!y1.test(o))return{absoluteURL:void 0,isExternal:!1,to:o};let s=o,u=!1;if(yg)try{let f=new URL(window.location.href),p=o.startsWith("//")?new URL(f.protocol+o):new URL(o),h=$a(p.pathname,l);p.origin===f.origin&&h!=null?o=h+p.search+p.hash:u=!0}catch{Hn(!1,`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:u,to:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var jg=["POST","PUT","PATCH","DELETE"];new Set(jg);var E1=["GET",...jg];new Set(E1);var vi=S.createContext(null);vi.displayName="DataRouter";var mc=S.createContext(null);mc.displayName="DataRouterState";var Ng=S.createContext(!1);function k1(){return S.useContext(Ng)}var wg=S.createContext({isTransitioning:!1});wg.displayName="ViewTransition";var R1=S.createContext(new Map);R1.displayName="Fetchers";var z1=S.createContext(null);z1.displayName="Await";var On=S.createContext(null);On.displayName="Navigation";var Cs=S.createContext(null);Cs.displayName="Location";var Ha=S.createContext({outlet:null,matches:[],isDataRoute:!1});Ha.displayName="Route";var zf=S.createContext(null);zf.displayName="RouteError";var Mg="REACT_ROUTER_ERROR",_1="REDIRECT",O1="ROUTE_ERROR_RESPONSE";function D1(a){if(a.startsWith(`${Mg}:${_1}:{`))try{let l=JSON.parse(a.slice(28));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string"&&typeof l.location=="string"&&typeof l.reloadDocument=="boolean"&&typeof l.replace=="boolean")return l}catch{}}function U1(a){if(a.startsWith(`${Mg}:${O1}:{`))try{let l=JSON.parse(a.slice(40));if(typeof l=="object"&&l&&typeof l.status=="number"&&typeof l.statusText=="string")return new C1(l.status,l.statusText,l.data)}catch{}}function L1(a,{relative:l}={}){nt(Ts(),"useHref() may be used only in the context of a <Router> component.");let{basename:o,navigator:s}=S.useContext(On),{hash:u,pathname:f,search:p}=As(a,{relative:l}),h=f;return o!=="/"&&(h=f==="/"?o:$n([o,f])),s.createHref({pathname:h,search:p,hash:u})}function Ts(){return S.useContext(Cs)!=null}function aa(){return nt(Ts(),"useLocation() may be used only in the context of a <Router> component."),S.useContext(Cs).location}var Cg="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Tg(a){S.useContext(On).static||S.useLayoutEffect(a)}function Ag(){let{isDataRoute:a}=S.useContext(Ha);return a?Z1():B1()}function B1(){nt(Ts(),"useNavigate() may be used only in the context of a <Router> component.");let a=S.useContext(vi),{basename:l,navigator:o}=S.useContext(On),{matches:s}=S.useContext(Ha),{pathname:u}=aa(),f=JSON.stringify(gg(s)),p=S.useRef(!1);return Tg(()=>{p.current=!0}),S.useCallback((v,x={})=>{if(Hn(p.current,Cg),!p.current)return;if(typeof v=="number"){o.go(v);return}let y=Rf(v,JSON.parse(f),u,x.relative==="path");a==null&&l!=="/"&&(y.pathname=y.pathname==="/"?l:$n([l,y.pathname])),(x.replace?o.replace:o.push)(y,x.state,x)},[l,o,f,u,a])}S.createContext(null);function As(a,{relative:l}={}){let{matches:o}=S.useContext(Ha),{pathname:s}=aa(),u=JSON.stringify(gg(o));return S.useMemo(()=>Rf(a,JSON.parse(u),s,l==="path"),[a,u,s,l])}function q1(a,l){return Eg(a,l)}function Eg(a,l,o){var D;nt(Ts(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=S.useContext(On),{matches:u}=S.useContext(Ha),f=u[u.length-1],p=f?f.params:{},h=f?f.pathname:"/",v=f?f.pathnameBase:"/",x=f&&f.route;{let R=x&&x.path||"";Rg(h,!x||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${R}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
+
60
+ Please change the parent <Route path="${R}"> to <Route path="${R==="/"?"*":`${R}/*`}">.`)}let y=aa(),g;if(l){let R=typeof l=="string"?pi(l):l;nt(v==="/"||((D=R.pathname)==null?void 0:D.startsWith(v)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${v}" but pathname "${R.pathname}" was given in the \`location\` prop.`),g=R}else g=y;let j=g.pathname||"/",N=j;if(v!=="/"){let R=v.replace(/^\//,"").split("/");N="/"+j.replace(/^\//,"").split("/").slice(R.length).join("/")}let T=o&&o.state.matches.length?o.state.matches.map(R=>Object.assign(R,{route:o.manifest[R.route.id]||R.route})):pg(a,{pathname:N});Hn(x||T!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),Hn(T==null||T[T.length-1].route.element!==void 0||T[T.length-1].route.Component!==void 0||T[T.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let E=K1(T&&T.map(R=>Object.assign({},R,{params:Object.assign({},p,R.params),pathname:$n([v,s.encodeLocation?s.encodeLocation(R.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?v:$n([v,s.encodeLocation?s.encodeLocation(R.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),u,o);return l&&E?S.createElement(Cs.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...g},navigationType:"POP"}},E):E}function $1(){let a=F1(),l=T1(a)?`${a.status} ${a.statusText}`:a instanceof Error?a.message:JSON.stringify(a),o=a instanceof Error?a.stack:null,s="rgba(200,200,200, 0.5)",u={padding:"0.5rem",backgroundColor:s},f={padding:"2px 4px",backgroundColor:s},p=null;return console.error("Error handled by React Router default ErrorBoundary:",a),p=S.createElement(S.Fragment,null,S.createElement("p",null,"💿 Hey developer 👋"),S.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",S.createElement("code",{style:f},"ErrorBoundary")," or"," ",S.createElement("code",{style:f},"errorElement")," prop on your route.")),S.createElement(S.Fragment,null,S.createElement("h2",null,"Unexpected Application Error!"),S.createElement("h3",{style:{fontStyle:"italic"}},l),o?S.createElement("pre",{style:u},o):null,p)}var H1=S.createElement($1,null),kg=class extends S.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,l){return l.location!==a.location||l.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:l.error,location:l.location,revalidation:a.revalidation||l.revalidation}}componentDidCatch(a,l){this.props.onError?this.props.onError(a,l):console.error("React Router caught the following error during render",a)}render(){let a=this.state.error;if(this.context&&typeof a=="object"&&a&&"digest"in a&&typeof a.digest=="string"){const o=U1(a.digest);o&&(a=o)}let l=a!==void 0?S.createElement(Ha.Provider,{value:this.props.routeContext},S.createElement(zf.Provider,{value:a,children:this.props.component})):this.props.children;return this.context?S.createElement(Q1,{error:a},l):l}};kg.contextType=Ng;var Bd=new WeakMap;function Q1({children:a,error:l}){let{basename:o}=S.useContext(On);if(typeof l=="object"&&l&&"digest"in l&&typeof l.digest=="string"){let s=D1(l.digest);if(s){let u=Bd.get(l);if(u)throw u;let f=Sg(s.location,o);if(yg&&!Bd.get(l))if(f.isExternal||s.reloadDocument)window.location.href=f.absoluteURL||f.to;else{const p=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(f.to,{replace:s.replace}));throw Bd.set(l,p),p}return S.createElement("meta",{httpEquiv:"refresh",content:`0;url=${f.absoluteURL||f.to}`})}}return a}function P1({routeContext:a,match:l,children:o}){let s=S.useContext(vi);return s&&s.static&&s.staticContext&&(l.route.errorElement||l.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=l.route.id),S.createElement(Ha.Provider,{value:a},o)}function K1(a,l=[],o){let s=o==null?void 0:o.state;if(a==null){if(!s)return null;if(s.errors)a=s.matches;else if(l.length===0&&!s.initialized&&s.matches.length>0)a=s.matches;else return null}let u=a,f=s==null?void 0:s.errors;if(f!=null){let y=u.findIndex(g=>g.route.id&&(f==null?void 0:f[g.route.id])!==void 0);nt(y>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(f).join(",")}`),u=u.slice(0,Math.min(u.length,y+1))}let p=!1,h=-1;if(o&&s){p=s.renderFallback;for(let y=0;y<u.length;y++){let g=u[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(h=y),g.route.id){let{loaderData:j,errors:N}=s,T=g.route.loader&&!j.hasOwnProperty(g.route.id)&&(!N||N[g.route.id]===void 0);if(g.route.lazy||T){o.isStatic&&(p=!0),h>=0?u=u.slice(0,h+1):u=[u[0]];break}}}}let v=o==null?void 0:o.onError,x=s&&v?(y,g)=>{var j,N;v(y,{location:s.location,params:((N=(j=s.matches)==null?void 0:j[0])==null?void 0:N.params)??{},pattern:A1(s.matches),errorInfo:g})}:void 0;return u.reduceRight((y,g,j)=>{let N,T=!1,E=null,D=null;s&&(N=f&&g.route.id?f[g.route.id]:void 0,E=g.route.errorElement||H1,p&&(h<0&&j===0?(Rg("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),T=!0,D=null):h===j&&(T=!0,D=g.route.hydrateFallbackElement||null)));let R=l.concat(u.slice(0,j+1)),L=()=>{let H;return N?H=E:T?H=D:g.route.Component?H=S.createElement(g.route.Component,null):g.route.element?H=g.route.element:H=y,S.createElement(P1,{match:g,routeContext:{outlet:y,matches:R,isDataRoute:s!=null},children:H})};return s&&(g.route.ErrorBoundary||g.route.errorElement||j===0)?S.createElement(kg,{location:s.location,revalidation:s.revalidation,component:E,error:N,children:L(),routeContext:{outlet:null,matches:R,isDataRoute:!0},onError:x}):L()},null)}function _f(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Y1(a){let l=S.useContext(vi);return nt(l,_f(a)),l}function G1(a){let l=S.useContext(mc);return nt(l,_f(a)),l}function V1(a){let l=S.useContext(Ha);return nt(l,_f(a)),l}function Of(a){let l=V1(a),o=l.matches[l.matches.length-1];return nt(o.route.id,`${a} can only be used on routes that contain a unique "id"`),o.route.id}function X1(){return Of("useRouteId")}function F1(){var s;let a=S.useContext(zf),l=G1("useRouteError"),o=Of("useRouteError");return a!==void 0?a:(s=l.errors)==null?void 0:s[o]}function Z1(){let{router:a}=Y1("useNavigate"),l=Of("useNavigate"),o=S.useRef(!1);return Tg(()=>{o.current=!0}),S.useCallback(async(u,f={})=>{Hn(o.current,Cg),o.current&&(typeof u=="number"?await a.navigate(u):await a.navigate(u,{fromRouteId:l,...f}))},[a,l])}var mx={};function Rg(a,l,o){!l&&!mx[a]&&(mx[a]=!0,Hn(!1,o))}S.memo(J1);function J1({routes:a,manifest:l,future:o,state:s,isStatic:u,onError:f}){return Eg(a,void 0,{manifest:l,state:s,isStatic:u,onError:f})}function tr(a){nt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function I1({basename:a="/",children:l=null,location:o,navigationType:s="POP",navigator:u,static:f=!1,useTransitions:p}){nt(!Ts(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=a.replace(/^\/*/,"/"),v=S.useMemo(()=>({basename:h,navigator:u,static:f,useTransitions:p,future:{}}),[h,u,f,p]);typeof o=="string"&&(o=pi(o));let{pathname:x="/",search:y="",hash:g="",state:j=null,key:N="default",mask:T}=o,E=S.useMemo(()=>{let D=$a(x,h);return D==null?null:{location:{pathname:D,search:y,hash:g,state:j,key:N,mask:T},navigationType:s}},[h,x,y,g,j,N,s,T]);return Hn(E!=null,`<Router basename="${h}"> is not able to match the URL "${x}${y}${g}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:S.createElement(On.Provider,{value:v},S.createElement(Cs.Provider,{children:l,value:E}))}function W1({children:a,location:l}){return q1(ef(a),l)}function ef(a,l=[]){let o=[];return S.Children.forEach(a,(s,u)=>{if(!S.isValidElement(s))return;let f=[...l,u];if(s.type===S.Fragment){o.push.apply(o,ef(s.props.children,f));return}nt(s.type===tr,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),nt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let p={id:s.props.id||f.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(p.children=ef(s.props.children,f)),o.push(p)}),o}var ec="get",tc="application/x-www-form-urlencoded";function hc(a){return typeof HTMLElement<"u"&&a instanceof HTMLElement}function e2(a){return hc(a)&&a.tagName.toLowerCase()==="button"}function t2(a){return hc(a)&&a.tagName.toLowerCase()==="form"}function n2(a){return hc(a)&&a.tagName.toLowerCase()==="input"}function a2(a){return!!(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)}function l2(a,l){return a.button===0&&(!l||l==="_self")&&!a2(a)}function tf(a=""){return new URLSearchParams(typeof a=="string"||Array.isArray(a)||a instanceof URLSearchParams?a:Object.keys(a).reduce((l,o)=>{let s=a[o];return l.concat(Array.isArray(s)?s.map(u=>[o,u]):[[o,s]])},[]))}function r2(a,l){let o=tf(a);return l&&l.forEach((s,u)=>{o.has(u)||l.getAll(u).forEach(f=>{o.append(u,f)})}),o}var Xo=null;function i2(){if(Xo===null)try{new FormData(document.createElement("form"),0),Xo=!1}catch{Xo=!0}return Xo}var s2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function qd(a){return a!=null&&!s2.has(a)?(Hn(!1,`"${a}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${tc}"`),null):a}function o2(a,l){let o,s,u,f,p;if(t2(a)){let h=a.getAttribute("action");s=h?$a(h,l):null,o=a.getAttribute("method")||ec,u=qd(a.getAttribute("enctype"))||tc,f=new FormData(a)}else if(e2(a)||n2(a)&&(a.type==="submit"||a.type==="image")){let h=a.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let v=a.getAttribute("formaction")||h.getAttribute("action");if(s=v?$a(v,l):null,o=a.getAttribute("formmethod")||h.getAttribute("method")||ec,u=qd(a.getAttribute("formenctype"))||qd(h.getAttribute("enctype"))||tc,f=new FormData(h,a),!i2()){let{name:x,type:y,value:g}=a;if(y==="image"){let j=x?`${x}.`:"";f.append(`${j}x`,"0"),f.append(`${j}y`,"0")}else x&&f.append(x,g)}}else{if(hc(a))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');o=ec,s=null,u=tc,p=a}return f&&u==="text/plain"&&(p=f,f=void 0),{action:s,method:o.toLowerCase(),encType:u,formData:f,body:p}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Df(a,l){if(a===!1||a===null||typeof a>"u")throw new Error(l)}function zg(a,l,o,s){let u=typeof a=="string"?new URL(a,typeof window>"u"?"server://singlefetch/":window.location.origin):a;return o?u.pathname.endsWith("/")?u.pathname=`${u.pathname}_.${s}`:u.pathname=`${u.pathname}.${s}`:u.pathname==="/"?u.pathname=`_root.${s}`:l&&$a(u.pathname,l)==="/"?u.pathname=`${ic(l)}/_root.${s}`:u.pathname=`${ic(u.pathname)}.${s}`,u}async function c2(a,l){if(a.id in l)return l[a.id];try{let o=await import(a.module);return l[a.id]=o,o}catch(o){return console.error(`Error loading route module \`${a.module}\`, reloading page...`),console.error(o),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function u2(a){return a==null?!1:a.href==null?a.rel==="preload"&&typeof a.imageSrcSet=="string"&&typeof a.imageSizes=="string":typeof a.rel=="string"&&typeof a.href=="string"}async function d2(a,l,o){let s=await Promise.all(a.map(async u=>{let f=l.routes[u.route.id];if(f){let p=await c2(f,o);return p.links?p.links():[]}return[]}));return p2(s.flat(1).filter(u2).filter(u=>u.rel==="stylesheet"||u.rel==="preload").map(u=>u.rel==="stylesheet"?{...u,rel:"prefetch",as:"style"}:{...u,rel:"prefetch"}))}function hx(a,l,o,s,u,f){let p=(v,x)=>o[x]?v.route.id!==o[x].route.id:!0,h=(v,x)=>{var y;return o[x].pathname!==v.pathname||((y=o[x].route.path)==null?void 0:y.endsWith("*"))&&o[x].params["*"]!==v.params["*"]};return f==="assets"?l.filter((v,x)=>p(v,x)||h(v,x)):f==="data"?l.filter((v,x)=>{var g;let y=s.routes[v.route.id];if(!y||!y.hasLoader)return!1;if(p(v,x)||h(v,x))return!0;if(v.route.shouldRevalidate){let j=v.route.shouldRevalidate({currentUrl:new URL(u.pathname+u.search+u.hash,window.origin),currentParams:((g=o[0])==null?void 0:g.params)||{},nextUrl:new URL(a,window.origin),nextParams:v.params,defaultShouldRevalidate:!0});if(typeof j=="boolean")return j}return!0}):[]}function f2(a,l,{includeHydrateFallback:o}={}){return m2(a.map(s=>{let u=l.routes[s.route.id];if(!u)return[];let f=[u.module];return u.clientActionModule&&(f=f.concat(u.clientActionModule)),u.clientLoaderModule&&(f=f.concat(u.clientLoaderModule)),o&&u.hydrateFallbackModule&&(f=f.concat(u.hydrateFallbackModule)),u.imports&&(f=f.concat(u.imports)),f}).flat(1))}function m2(a){return[...new Set(a)]}function h2(a){let l={},o=Object.keys(a).sort();for(let s of o)l[s]=a[s];return l}function p2(a,l){let o=new Set;return new Set(l),a.reduce((s,u)=>{let f=JSON.stringify(h2(u));return o.has(f)||(o.add(f),s.push({key:f,link:u})),s},[])}function Uf(){let a=S.useContext(vi);return Df(a,"You must render this element inside a <DataRouterContext.Provider> element"),a}function v2(){let a=S.useContext(mc);return Df(a,"You must render this element inside a <DataRouterStateContext.Provider> element"),a}var Lf=S.createContext(void 0);Lf.displayName="FrameworkContext";function Bf(){let a=S.useContext(Lf);return Df(a,"You must render this element inside a <HydratedRouter> element"),a}function x2(a,l){let o=S.useContext(Lf),[s,u]=S.useState(!1),[f,p]=S.useState(!1),{onFocus:h,onBlur:v,onMouseEnter:x,onMouseLeave:y,onTouchStart:g}=l,j=S.useRef(null);S.useEffect(()=>{if(a==="render"&&p(!0),a==="viewport"){let E=R=>{R.forEach(L=>{p(L.isIntersecting)})},D=new IntersectionObserver(E,{threshold:.5});return j.current&&D.observe(j.current),()=>{D.disconnect()}}},[a]),S.useEffect(()=>{if(s){let E=setTimeout(()=>{p(!0)},100);return()=>{clearTimeout(E)}}},[s]);let N=()=>{u(!0)},T=()=>{u(!1),p(!1)};return o?a!=="intent"?[f,j,{}]:[f,j,{onFocus:os(h,N),onBlur:os(v,T),onMouseEnter:os(x,N),onMouseLeave:os(y,T),onTouchStart:os(g,N)}]:[!1,j,{}]}function os(a,l){return o=>{a&&a(o),o.defaultPrevented||l(o)}}function g2({page:a,...l}){let o=k1(),{router:s}=Uf(),u=S.useMemo(()=>pg(s.routes,a,s.basename),[s.routes,a,s.basename]);return u?o?S.createElement(y2,{page:a,matches:u,...l}):S.createElement(S2,{page:a,matches:u,...l}):null}function b2(a){let{manifest:l,routeModules:o}=Bf(),[s,u]=S.useState([]);return S.useEffect(()=>{let f=!1;return d2(a,l,o).then(p=>{f||u(p)}),()=>{f=!0}},[a,l,o]),s}function y2({page:a,matches:l,...o}){let s=aa(),{future:u}=Bf(),{basename:f}=Uf(),p=S.useMemo(()=>{if(a===s.pathname+s.search+s.hash)return[];let h=zg(a,f,u.v8_trailingSlashAwareDataRequests,"rsc"),v=!1,x=[];for(let y of l)typeof y.route.shouldRevalidate=="function"?v=!0:x.push(y.route.id);return v&&x.length>0&&h.searchParams.set("_routes",x.join(",")),[h.pathname+h.search]},[f,u.v8_trailingSlashAwareDataRequests,a,s,l]);return S.createElement(S.Fragment,null,p.map(h=>S.createElement("link",{key:h,rel:"prefetch",as:"fetch",href:h,...o})))}function S2({page:a,matches:l,...o}){let s=aa(),{future:u,manifest:f,routeModules:p}=Bf(),{basename:h}=Uf(),{loaderData:v,matches:x}=v2(),y=S.useMemo(()=>hx(a,l,x,f,s,"data"),[a,l,x,f,s]),g=S.useMemo(()=>hx(a,l,x,f,s,"assets"),[a,l,x,f,s]),j=S.useMemo(()=>{if(a===s.pathname+s.search+s.hash)return[];let E=new Set,D=!1;if(l.forEach(L=>{var P;let H=f.routes[L.route.id];!H||!H.hasLoader||(!y.some(G=>G.route.id===L.route.id)&&L.route.id in v&&((P=p[L.route.id])!=null&&P.shouldRevalidate)||H.hasClientLoader?D=!0:E.add(L.route.id))}),E.size===0)return[];let R=zg(a,h,u.v8_trailingSlashAwareDataRequests,"data");return D&&E.size>0&&R.searchParams.set("_routes",l.filter(L=>E.has(L.route.id)).map(L=>L.route.id).join(",")),[R.pathname+R.search]},[h,u.v8_trailingSlashAwareDataRequests,v,s,f,y,l,a,p]),N=S.useMemo(()=>f2(g,f),[g,f]),T=b2(g);return S.createElement(S.Fragment,null,j.map(E=>S.createElement("link",{key:E,rel:"prefetch",as:"fetch",href:E,...o})),N.map(E=>S.createElement("link",{key:E,rel:"modulepreload",href:E,...o})),T.map(({key:E,link:D})=>S.createElement("link",{key:E,nonce:o.nonce,...D,crossOrigin:D.crossOrigin??o.crossOrigin})))}function j2(...a){return l=>{a.forEach(o=>{typeof o=="function"?o(l):o!=null&&(o.current=l)})}}var N2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{N2&&(window.__reactRouterVersion="7.17.0")}catch{}function w2({basename:a,children:l,useTransitions:o,window:s}){let u=S.useRef();u.current==null&&(u.current=n1({window:s,v5Compat:!0}));let f=u.current,[p,h]=S.useState({action:f.action,location:f.location}),v=S.useCallback(x=>{o===!1?h(x):S.startTransition(()=>h(x))},[o]);return S.useLayoutEffect(()=>f.listen(v),[f,v]),S.createElement(I1,{basename:a,children:l,location:p.location,navigationType:p.action,navigator:f,useTransitions:o})}var _g=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,mr=S.forwardRef(function({onClick:l,discover:o="render",prefetch:s="none",relative:u,reloadDocument:f,replace:p,mask:h,state:v,target:x,to:y,preventScrollReset:g,viewTransition:j,defaultShouldRevalidate:N,...T},E){let{basename:D,navigator:R,useTransitions:L}=S.useContext(On),H=typeof y=="string"&&_g.test(y),P=Sg(y,D);y=P.to;let G=L1(y,{relative:u}),Q=aa(),q=null;if(h){let fe=Rf(h,[],Q.mask?Q.mask.pathname:"/",!0);D!=="/"&&(fe.pathname=fe.pathname==="/"?D:$n([D,fe.pathname])),q=R.createHref(fe)}let[W,I,ne]=x2(s,T),F=T2(y,{replace:p,mask:h,state:v,target:x,preventScrollReset:g,relative:u,viewTransition:j,defaultShouldRevalidate:N,useTransitions:L});function J(fe){l&&l(fe),fe.defaultPrevented||F(fe)}let se=!(P.isExternal||f),ge=S.createElement("a",{...T,...ne,href:(se?q:void 0)||P.absoluteURL||G,onClick:se?J:l,ref:j2(E,I),target:x,"data-discover":!H&&o==="render"?"true":void 0});return W&&!H?S.createElement(S.Fragment,null,ge,S.createElement(g2,{page:G})):ge});mr.displayName="Link";var qf=S.forwardRef(function({"aria-current":l="page",caseSensitive:o=!1,className:s="",end:u=!1,style:f,to:p,viewTransition:h,children:v,...x},y){let g=As(p,{relative:x.relative}),j=aa(),N=S.useContext(mc),{navigator:T,basename:E}=S.useContext(On),D=N!=null&&_2(g)&&h===!0,R=T.encodeLocation?T.encodeLocation(g).pathname:g.pathname,L=j.pathname,H=N&&N.navigation&&N.navigation.location?N.navigation.location.pathname:null;o||(L=L.toLowerCase(),H=H?H.toLowerCase():null,R=R.toLowerCase()),H&&E&&(H=$a(H,E)||H);const P=R!=="/"&&R.endsWith("/")?R.length-1:R.length;let G=L===R||!u&&L.startsWith(R)&&L.charAt(P)==="/",Q=H!=null&&(H===R||!u&&H.startsWith(R)&&H.charAt(R.length)==="/"),q={isActive:G,isPending:Q,isTransitioning:D},W=G?l:void 0,I;typeof s=="function"?I=s(q):I=[s,G?"active":null,Q?"pending":null,D?"transitioning":null].filter(Boolean).join(" ");let ne=typeof f=="function"?f(q):f;return S.createElement(mr,{...x,"aria-current":W,className:I,ref:y,style:ne,to:p,viewTransition:h},typeof v=="function"?v(q):v)});qf.displayName="NavLink";var M2=S.forwardRef(({discover:a="render",fetcherKey:l,navigate:o,reloadDocument:s,replace:u,state:f,method:p=ec,action:h,onSubmit:v,relative:x,preventScrollReset:y,viewTransition:g,defaultShouldRevalidate:j,...N},T)=>{let{useTransitions:E}=S.useContext(On),D=R2(),R=z2(h,{relative:x}),L=p.toLowerCase()==="get"?"get":"post",H=typeof h=="string"&&_g.test(h),P=G=>{if(v&&v(G),G.defaultPrevented)return;G.preventDefault();let Q=G.nativeEvent.submitter,q=(Q==null?void 0:Q.getAttribute("formmethod"))||p,W=()=>D(Q||G.currentTarget,{fetcherKey:l,method:q,navigate:o,replace:u,state:f,relative:x,preventScrollReset:y,viewTransition:g,defaultShouldRevalidate:j});E&&o!==!1?S.startTransition(()=>W()):W()};return S.createElement("form",{ref:T,method:L,action:R,onSubmit:s?v:P,...N,"data-discover":!H&&a==="render"?"true":void 0})});M2.displayName="Form";function C2(a){return`${a} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Og(a){let l=S.useContext(vi);return nt(l,C2(a)),l}function T2(a,{target:l,replace:o,mask:s,state:u,preventScrollReset:f,relative:p,viewTransition:h,defaultShouldRevalidate:v,useTransitions:x}={}){let y=Ag(),g=aa(),j=As(a,{relative:p});return S.useCallback(N=>{if(l2(N,l)){N.preventDefault();let T=o!==void 0?o:ps(g)===ps(j),E=()=>y(a,{replace:T,mask:s,state:u,preventScrollReset:f,relative:p,viewTransition:h,defaultShouldRevalidate:v});x?S.startTransition(()=>E()):E()}},[g,y,j,o,s,u,l,a,f,p,h,v,x])}function A2(a){Hn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let l=S.useRef(tf(a)),o=S.useRef(!1),s=aa(),u=S.useMemo(()=>r2(s.search,o.current?null:l.current),[s.search]),f=Ag(),p=S.useCallback((h,v)=>{const x=tf(typeof h=="function"?h(new URLSearchParams(u)):h);o.current=!0,f("?"+x,v)},[f,u]);return[u,p]}var E2=0,k2=()=>`__${String(++E2)}__`;function R2(){let{router:a}=Og("useSubmit"),{basename:l}=S.useContext(On),o=X1(),s=a.fetch,u=a.navigate;return S.useCallback(async(f,p={})=>{let{action:h,method:v,encType:x,formData:y,body:g}=o2(f,l);if(p.navigate===!1){let j=p.fetcherKey||k2();await s(j,o,p.action||h,{defaultShouldRevalidate:p.defaultShouldRevalidate,preventScrollReset:p.preventScrollReset,formData:y,body:g,formMethod:p.method||v,formEncType:p.encType||x,flushSync:p.flushSync})}else await u(p.action||h,{defaultShouldRevalidate:p.defaultShouldRevalidate,preventScrollReset:p.preventScrollReset,formData:y,body:g,formMethod:p.method||v,formEncType:p.encType||x,replace:p.replace,state:p.state,fromRouteId:o,flushSync:p.flushSync,viewTransition:p.viewTransition})},[s,u,l,o])}function z2(a,{relative:l}={}){let{basename:o}=S.useContext(On),s=S.useContext(Ha);nt(s,"useFormAction must be used inside a RouteContext");let[u]=s.matches.slice(-1),f={...As(a||".",{relative:l})},p=aa();if(a==null){f.search=p.search;let h=new URLSearchParams(f.search),v=h.getAll("index");if(v.some(y=>y==="")){h.delete("index"),v.filter(g=>g).forEach(g=>h.append("index",g));let y=h.toString();f.search=y?`?${y}`:""}}return(!a||a===".")&&u.route.index&&(f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index"),o!=="/"&&(f.pathname=f.pathname==="/"?o:$n([o,f.pathname])),ps(f)}function _2(a,{relative:l}={}){let o=S.useContext(wg);nt(o!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Og("useViewTransitionState"),u=As(a,{relative:l});if(!o.isTransitioning)return!1;let f=$a(o.currentLocation.pathname,s)||o.currentLocation.pathname,p=$a(o.nextLocation.pathname,s)||o.nextLocation.pathname;return rc(u.pathname,p)!=null||rc(u.pathname,f)!=null}var O2=hg(),xi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(a){return this.listeners.add(a),this.onSubscribe(),()=>{this.listeners.delete(a),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ar,Ml,ti,ag,D2=(ag=class extends xi{constructor(){super();de(this,ar);de(this,Ml);de(this,ti);ie(this,ti,l=>{if(typeof window<"u"&&window.addEventListener){const o=()=>l();return window.addEventListener("visibilitychange",o,!1),()=>{window.removeEventListener("visibilitychange",o)}}})}onSubscribe(){C(this,Ml)||this.setEventListener(C(this,ti))}onUnsubscribe(){var l;this.hasListeners()||((l=C(this,Ml))==null||l.call(this),ie(this,Ml,void 0))}setEventListener(l){var o;ie(this,ti,l),(o=C(this,Ml))==null||o.call(this),ie(this,Ml,l(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(l){C(this,ar)!==l&&(ie(this,ar,l),this.onFocus())}onFocus(){const l=this.isFocused();this.listeners.forEach(o=>{o(l)})}isFocused(){var l;return typeof C(this,ar)=="boolean"?C(this,ar):((l=globalThis.document)==null?void 0:l.visibilityState)!=="hidden"}},ar=new WeakMap,Ml=new WeakMap,ti=new WeakMap,ag),$f=new D2,U2={setTimeout:(a,l)=>setTimeout(a,l),clearTimeout:a=>clearTimeout(a),setInterval:(a,l)=>setInterval(a,l),clearInterval:a=>clearInterval(a)},Cl,Ef,lg,L2=(lg=class{constructor(){de(this,Cl,U2);de(this,Ef,!1)}setTimeoutProvider(a){ie(this,Cl,a)}setTimeout(a,l){return C(this,Cl).setTimeout(a,l)}clearTimeout(a){C(this,Cl).clearTimeout(a)}setInterval(a,l){return C(this,Cl).setInterval(a,l)}clearInterval(a){C(this,Cl).clearInterval(a)}},Cl=new WeakMap,Ef=new WeakMap,lg),nr=new L2;function B2(a){setTimeout(a,0)}var q2=typeof window>"u"||"Deno"in globalThis;function Pt(){}function $2(a,l){return typeof a=="function"?a(l):a}function nf(a){return typeof a=="number"&&a>=0&&a!==1/0}function Dg(a,l){return Math.max(a+(l||0)-Date.now(),0)}function Ol(a,l){return typeof a=="function"?a(l):a}function gn(a,l){return typeof a=="function"?a(l):a}function px(a,l){const{type:o="all",exact:s,fetchStatus:u,predicate:f,queryKey:p,stale:h}=a;if(p){if(s){if(l.queryHash!==Hf(p,l.options))return!1}else if(!vs(l.queryKey,p))return!1}if(o!=="all"){const v=l.isActive();if(o==="active"&&!v||o==="inactive"&&v)return!1}return!(typeof h=="boolean"&&l.isStale()!==h||u&&u!==l.state.fetchStatus||f&&!f(l))}function vx(a,l){const{exact:o,status:s,predicate:u,mutationKey:f}=a;if(f){if(!l.options.mutationKey)return!1;if(o){if(fr(l.options.mutationKey)!==fr(f))return!1}else if(!vs(l.options.mutationKey,f))return!1}return!(s&&l.state.status!==s||u&&!u(l))}function Hf(a,l){return((l==null?void 0:l.queryKeyHashFn)||fr)(a)}function fr(a){return JSON.stringify(a,(l,o)=>af(o)?Object.keys(o).sort().reduce((s,u)=>(s[u]=o[u],s),{}):o)}function vs(a,l){return a===l?!0:typeof a!=typeof l?!1:a&&l&&typeof a=="object"&&typeof l=="object"?Object.keys(l).every(o=>vs(a[o],l[o])):!1}var H2=Object.prototype.hasOwnProperty;function Ug(a,l,o=0){if(a===l)return a;if(o>500)return l;const s=xx(a)&&xx(l);if(!s&&!(af(a)&&af(l)))return l;const f=(s?a:Object.keys(a)).length,p=s?l:Object.keys(l),h=p.length,v=s?new Array(h):{};let x=0;for(let y=0;y<h;y++){const g=s?y:p[y],j=a[g],N=l[g];if(j===N){v[g]=j,(s?y<f:H2.call(a,g))&&x++;continue}if(j===null||N===null||typeof j!="object"||typeof N!="object"){v[g]=N;continue}const T=Ug(j,N,o+1);v[g]=T,T===j&&x++}return f===h&&x===f?a:v}function sc(a,l){if(!l||Object.keys(a).length!==Object.keys(l).length)return!1;for(const o in a)if(a[o]!==l[o])return!1;return!0}function xx(a){return Array.isArray(a)&&a.length===Object.keys(a).length}function af(a){if(!gx(a))return!1;const l=a.constructor;if(l===void 0)return!0;const o=l.prototype;return!(!gx(o)||!o.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(a)!==Object.prototype)}function gx(a){return Object.prototype.toString.call(a)==="[object Object]"}function Q2(a){return new Promise(l=>{nr.setTimeout(l,a)})}function lf(a,l,o){return typeof o.structuralSharing=="function"?o.structuralSharing(a,l):o.structuralSharing!==!1?Ug(a,l):l}function P2(a,l,o=0){const s=[...a,l];return o&&s.length>o?s.slice(1):s}function K2(a,l,o=0){const s=[l,...a];return o&&s.length>o?s.slice(0,-1):s}var Qf=Symbol();function Lg(a,l){return!a.queryFn&&(l!=null&&l.initialPromise)?()=>l.initialPromise:!a.queryFn||a.queryFn===Qf?()=>Promise.reject(new Error(`Missing queryFn: '${a.queryHash}'`)):a.queryFn}function Pf(a,l){return typeof a=="function"?a(...l):!!a}function Y2(a,l,o){let s=!1,u;return Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(u??(u=l()),s||(s=!0,u.aborted?o():u.addEventListener("abort",o,{once:!0})),u)}),a}var xs=(()=>{let a=()=>q2;return{isServer(){return a()},setIsServer(l){a=l}}})();function rf(){let a,l;const o=new Promise((u,f)=>{a=u,l=f});o.status="pending",o.catch(()=>{});function s(u){Object.assign(o,u),delete o.resolve,delete o.reject}return o.resolve=u=>{s({status:"fulfilled",value:u}),a(u)},o.reject=u=>{s({status:"rejected",reason:u}),l(u)},o}var G2=B2;function V2(){let a=[],l=0,o=h=>{h()},s=h=>{h()},u=G2;const f=h=>{l?a.push(h):u(()=>{o(h)})},p=()=>{const h=a;a=[],h.length&&u(()=>{s(()=>{h.forEach(v=>{o(v)})})})};return{batch:h=>{let v;l++;try{v=h()}finally{l--,l||p()}return v},batchCalls:h=>(...v)=>{f(()=>{h(...v)})},schedule:f,setNotifyFunction:h=>{o=h},setBatchNotifyFunction:h=>{s=h},setScheduler:h=>{u=h}}}var St=V2(),ni,Tl,ai,rg,X2=(rg=class extends xi{constructor(){super();de(this,ni,!0);de(this,Tl);de(this,ai);ie(this,ai,l=>{if(typeof window<"u"&&window.addEventListener){const o=()=>l(!0),s=()=>l(!1);return window.addEventListener("online",o,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",o),window.removeEventListener("offline",s)}}})}onSubscribe(){C(this,Tl)||this.setEventListener(C(this,ai))}onUnsubscribe(){var l;this.hasListeners()||((l=C(this,Tl))==null||l.call(this),ie(this,Tl,void 0))}setEventListener(l){var o;ie(this,ai,l),(o=C(this,Tl))==null||o.call(this),ie(this,Tl,l(this.setOnline.bind(this)))}setOnline(l){C(this,ni)!==l&&(ie(this,ni,l),this.listeners.forEach(s=>{s(l)}))}isOnline(){return C(this,ni)}},ni=new WeakMap,Tl=new WeakMap,ai=new WeakMap,rg),oc=new X2;function F2(a){return Math.min(1e3*2**a,3e4)}function Bg(a){return(a??"online")==="online"?oc.isOnline():!0}var sf=class extends Error{constructor(a){super("CancelledError"),this.revert=a==null?void 0:a.revert,this.silent=a==null?void 0:a.silent}};function qg(a){let l=!1,o=0,s;const u=rf(),f=()=>u.status!=="pending",p=E=>{var D;if(!f()){const R=new sf(E);j(R),(D=a.onCancel)==null||D.call(a,R)}},h=()=>{l=!0},v=()=>{l=!1},x=()=>$f.isFocused()&&(a.networkMode==="always"||oc.isOnline())&&a.canRun(),y=()=>Bg(a.networkMode)&&a.canRun(),g=E=>{f()||(s==null||s(),u.resolve(E))},j=E=>{f()||(s==null||s(),u.reject(E))},N=()=>new Promise(E=>{var D;s=R=>{(f()||x())&&E(R)},(D=a.onPause)==null||D.call(a)}).then(()=>{var E;s=void 0,f()||(E=a.onContinue)==null||E.call(a)}),T=()=>{if(f())return;let E;const D=o===0?a.initialPromise:void 0;try{E=D??a.fn()}catch(R){E=Promise.reject(R)}Promise.resolve(E).then(g).catch(R=>{var Q;if(f())return;const L=a.retry??(xs.isServer()?0:3),H=a.retryDelay??F2,P=typeof H=="function"?H(o,R):H,G=L===!0||typeof L=="number"&&o<L||typeof L=="function"&&L(o,R);if(l||!G){j(R);return}o++,(Q=a.onFail)==null||Q.call(a,o,R),Q2(P).then(()=>x()?void 0:N()).then(()=>{l?j(R):T()})})};return{promise:u,status:()=>u.status,cancel:p,continue:()=>(s==null||s(),u),cancelRetry:h,continueRetry:v,canStart:y,start:()=>(y()?T():N().then(T),u)}}var lr,ig,$g=(ig=class{constructor(){de(this,lr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),nf(this.gcTime)&&ie(this,lr,nr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(a){this.gcTime=Math.max(this.gcTime||0,a??(xs.isServer()?1/0:300*1e3))}clearGcTimeout(){C(this,lr)!==void 0&&(nr.clearTimeout(C(this,lr)),ie(this,lr,void 0))}},lr=new WeakMap,ig);function Z2(a){return{onFetch:(l,o)=>{var y,g,j,N,T;const s=l.options,u=(j=(g=(y=l.fetchOptions)==null?void 0:y.meta)==null?void 0:g.fetchMore)==null?void 0:j.direction,f=((N=l.state.data)==null?void 0:N.pages)||[],p=((T=l.state.data)==null?void 0:T.pageParams)||[];let h={pages:[],pageParams:[]},v=0;const x=async()=>{let E=!1;const D=H=>{Y2(H,()=>l.signal,()=>E=!0)},R=Lg(l.options,l.fetchOptions),L=async(H,P,G)=>{if(E)return Promise.reject(l.signal.reason);if(P==null&&H.pages.length)return Promise.resolve(H);const q=(()=>{const F={client:l.client,queryKey:l.queryKey,pageParam:P,direction:G?"backward":"forward",meta:l.options.meta};return D(F),F})(),W=await R(q),{maxPages:I}=l.options,ne=G?K2:P2;return{pages:ne(H.pages,W,I),pageParams:ne(H.pageParams,P,I)}};if(u&&f.length){const H=u==="backward",P=H?J2:bx,G={pages:f,pageParams:p},Q=P(s,G);h=await L(G,Q,H)}else{const H=a??f.length;do{const P=v===0?p[0]??s.initialPageParam:bx(s,h);if(v>0&&P==null)break;h=await L(h,P),v++}while(v<H)}return h};l.options.persister?l.fetchFn=()=>{var E,D;return(D=(E=l.options).persister)==null?void 0:D.call(E,x,{client:l.client,queryKey:l.queryKey,meta:l.options.meta,signal:l.signal},o)}:l.fetchFn=x}}}function bx(a,{pages:l,pageParams:o}){const s=l.length-1;return l.length>0?a.getNextPageParam(l[s],l,o[s],o):void 0}function J2(a,{pages:l,pageParams:o}){var s;return l.length>0?(s=a.getPreviousPageParam)==null?void 0:s.call(a,l[0],l,o[0],o):void 0}var li,rr,ri,_n,ir,Ct,Ss,sr,xn,Hg,_a,sg,I2=(sg=class extends $g{constructor(l){super();de(this,xn);de(this,li);de(this,rr);de(this,ri);de(this,_n);de(this,ir);de(this,Ct);de(this,Ss);de(this,sr);ie(this,sr,!1),ie(this,Ss,l.defaultOptions),this.setOptions(l.options),this.observers=[],ie(this,ir,l.client),ie(this,_n,C(this,ir).getQueryCache()),this.queryKey=l.queryKey,this.queryHash=l.queryHash,ie(this,rr,Sx(this.options)),this.state=l.state??C(this,rr),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return C(this,li)}get promise(){var l;return(l=C(this,Ct))==null?void 0:l.promise}setOptions(l){if(this.options={...C(this,Ss),...l},l!=null&&l._type&&ie(this,li,l._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const o=Sx(this.options);o.data!==void 0&&(this.setState(yx(o.data,o.dataUpdatedAt)),ie(this,rr,o))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&C(this,_n).remove(this)}setData(l,o){const s=lf(this.state.data,l,this.options);return we(this,xn,_a).call(this,{data:s,type:"success",dataUpdatedAt:o==null?void 0:o.updatedAt,manual:o==null?void 0:o.manual}),s}setState(l){we(this,xn,_a).call(this,{type:"setState",state:l})}cancel(l){var s,u;const o=(s=C(this,Ct))==null?void 0:s.promise;return(u=C(this,Ct))==null||u.cancel(l),o?o.then(Pt).catch(Pt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return C(this,rr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(l=>gn(l.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Qf||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(l=>Ol(l.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(l=>l.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(l=0){return this.state.data===void 0?!0:l==="static"?!1:this.state.isInvalidated?!0:!Dg(this.state.dataUpdatedAt,l)}onFocus(){var o;const l=this.observers.find(s=>s.shouldFetchOnWindowFocus());l==null||l.refetch({cancelRefetch:!1}),(o=C(this,Ct))==null||o.continue()}onOnline(){var o;const l=this.observers.find(s=>s.shouldFetchOnReconnect());l==null||l.refetch({cancelRefetch:!1}),(o=C(this,Ct))==null||o.continue()}addObserver(l){this.observers.includes(l)||(this.observers.push(l),this.clearGcTimeout(),C(this,_n).notify({type:"observerAdded",query:this,observer:l}))}removeObserver(l){this.observers.includes(l)&&(this.observers=this.observers.filter(o=>o!==l),this.observers.length||(C(this,Ct)&&(C(this,sr)||we(this,xn,Hg).call(this)?C(this,Ct).cancel({revert:!0}):C(this,Ct).cancelRetry()),this.scheduleGc()),C(this,_n).notify({type:"observerRemoved",query:this,observer:l}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||we(this,xn,_a).call(this,{type:"invalidate"})}async fetch(l,o){var x,y,g,j,N,T,E,D,R,L,H;if(this.state.fetchStatus!=="idle"&&((x=C(this,Ct))==null?void 0:x.status())!=="rejected"){if(this.state.data!==void 0&&(o!=null&&o.cancelRefetch))this.cancel({silent:!0});else if(C(this,Ct))return C(this,Ct).continueRetry(),C(this,Ct).promise}if(l&&this.setOptions(l),!this.options.queryFn){const P=this.observers.find(G=>G.options.queryFn);P&&this.setOptions(P.options)}const s=new AbortController,u=P=>{Object.defineProperty(P,"signal",{enumerable:!0,get:()=>(ie(this,sr,!0),s.signal)})},f=()=>{const P=Lg(this.options,o),Q=(()=>{const q={client:C(this,ir),queryKey:this.queryKey,meta:this.meta};return u(q),q})();return ie(this,sr,!1),this.options.persister?this.options.persister(P,Q,this):P(Q)},h=(()=>{const P={fetchOptions:o,options:this.options,queryKey:this.queryKey,client:C(this,ir),state:this.state,fetchFn:f};return u(P),P})(),v=C(this,li)==="infinite"?Z2(this.options.pages):this.options.behavior;v==null||v.onFetch(h,this),ie(this,ri,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((y=h.fetchOptions)==null?void 0:y.meta))&&we(this,xn,_a).call(this,{type:"fetch",meta:(g=h.fetchOptions)==null?void 0:g.meta}),ie(this,Ct,qg({initialPromise:o==null?void 0:o.initialPromise,fn:h.fetchFn,onCancel:P=>{P instanceof sf&&P.revert&&this.setState({...C(this,ri),fetchStatus:"idle"}),s.abort()},onFail:(P,G)=>{we(this,xn,_a).call(this,{type:"failed",failureCount:P,error:G})},onPause:()=>{we(this,xn,_a).call(this,{type:"pause"})},onContinue:()=>{we(this,xn,_a).call(this,{type:"continue"})},retry:h.options.retry,retryDelay:h.options.retryDelay,networkMode:h.options.networkMode,canRun:()=>!0}));try{const P=await C(this,Ct).start();if(P===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(P),(N=(j=C(this,_n).config).onSuccess)==null||N.call(j,P,this),(E=(T=C(this,_n).config).onSettled)==null||E.call(T,P,this.state.error,this),P}catch(P){if(P instanceof sf){if(P.silent)return C(this,Ct).promise;if(P.revert){if(this.state.data===void 0)throw P;return this.state.data}}throw we(this,xn,_a).call(this,{type:"error",error:P}),(R=(D=C(this,_n).config).onError)==null||R.call(D,P,this),(H=(L=C(this,_n).config).onSettled)==null||H.call(L,this.state.data,P,this),P}finally{this.scheduleGc()}}},li=new WeakMap,rr=new WeakMap,ri=new WeakMap,_n=new WeakMap,ir=new WeakMap,Ct=new WeakMap,Ss=new WeakMap,sr=new WeakMap,xn=new WeakSet,Hg=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},_a=function(l){const o=s=>{switch(l.type){case"failed":return{...s,fetchFailureCount:l.failureCount,fetchFailureReason:l.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,...Qg(s.data,this.options),fetchMeta:l.meta??null};case"success":const u={...s,...yx(l.data,l.dataUpdatedAt),dataUpdateCount:s.dataUpdateCount+1,...!l.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return ie(this,ri,l.manual?u:void 0),u;case"error":const f=l.error;return{...s,error:f,errorUpdateCount:s.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:s.fetchFailureCount+1,fetchFailureReason:f,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...s,isInvalidated:!0};case"setState":return{...s,...l.state}}};this.state=o(this.state),St.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),C(this,_n).notify({query:this,type:"updated",action:l})})},sg);function Qg(a,l){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Bg(l.networkMode)?"fetching":"paused",...a===void 0&&{error:null,status:"pending"}}}function yx(a,l){return{data:a,dataUpdatedAt:l??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Sx(a){const l=typeof a.initialData=="function"?a.initialData():a.initialData,o=l!==void 0,s=o?typeof a.initialDataUpdatedAt=="function"?a.initialDataUpdatedAt():a.initialDataUpdatedAt:0;return{data:l,dataUpdateCount:0,dataUpdatedAt:o?s??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:o?"success":"pending",fetchStatus:"idle"}}var Wt,ze,js,Qt,or,ii,Oa,Al,Ns,si,oi,cr,ur,El,ci,He,ms,of,cf,uf,df,ff,mf,hf,Pg,og,W2=(og=class extends xi{constructor(l,o){super();de(this,He);de(this,Wt);de(this,ze);de(this,js);de(this,Qt);de(this,or);de(this,ii);de(this,Oa);de(this,Al);de(this,Ns);de(this,si);de(this,oi);de(this,cr);de(this,ur);de(this,El);de(this,ci,new Set);this.options=o,ie(this,Wt,l),ie(this,Al,null),ie(this,Oa,rf()),this.bindMethods(),this.setOptions(o)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(C(this,ze).addObserver(this),jx(C(this,ze),this.options)?we(this,He,ms).call(this):this.updateResult(),we(this,He,df).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return pf(C(this,ze),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return pf(C(this,ze),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,we(this,He,ff).call(this),we(this,He,mf).call(this),C(this,ze).removeObserver(this)}setOptions(l){const o=this.options,s=C(this,ze);if(this.options=C(this,Wt).defaultQueryOptions(l),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof gn(this.options.enabled,C(this,ze))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");we(this,He,hf).call(this),C(this,ze).setOptions(this.options),o._defaulted&&!sc(this.options,o)&&C(this,Wt).getQueryCache().notify({type:"observerOptionsUpdated",query:C(this,ze),observer:this});const u=this.hasListeners();u&&Nx(C(this,ze),s,this.options,o)&&we(this,He,ms).call(this),this.updateResult(),u&&(C(this,ze)!==s||gn(this.options.enabled,C(this,ze))!==gn(o.enabled,C(this,ze))||Ol(this.options.staleTime,C(this,ze))!==Ol(o.staleTime,C(this,ze)))&&we(this,He,of).call(this);const f=we(this,He,cf).call(this);u&&(C(this,ze)!==s||gn(this.options.enabled,C(this,ze))!==gn(o.enabled,C(this,ze))||f!==C(this,El))&&we(this,He,uf).call(this,f)}getOptimisticResult(l){const o=C(this,Wt).getQueryCache().build(C(this,Wt),l),s=this.createResult(o,l);return tS(this,s)&&(ie(this,Qt,s),ie(this,ii,this.options),ie(this,or,C(this,ze).state)),s}getCurrentResult(){return C(this,Qt)}trackResult(l,o){return new Proxy(l,{get:(s,u)=>(this.trackProp(u),o==null||o(u),u==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&C(this,Oa).status==="pending"&&C(this,Oa).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,u))})}trackProp(l){C(this,ci).add(l)}getCurrentQuery(){return C(this,ze)}refetch({...l}={}){return this.fetch({...l})}fetchOptimistic(l){const o=C(this,Wt).defaultQueryOptions(l),s=C(this,Wt).getQueryCache().build(C(this,Wt),o);return s.fetch().then(()=>this.createResult(s,o))}fetch(l){return we(this,He,ms).call(this,{...l,cancelRefetch:l.cancelRefetch??!0}).then(()=>(this.updateResult(),C(this,Qt)))}createResult(l,o){var I;const s=C(this,ze),u=this.options,f=C(this,Qt),p=C(this,or),h=C(this,ii),x=l!==s?l.state:C(this,js),{state:y}=l;let g={...y},j=!1,N;if(o._optimisticResults){const ne=this.hasListeners(),F=!ne&&jx(l,o),J=ne&&Nx(l,s,o,u);(F||J)&&(g={...g,...Qg(y.data,l.options)}),o._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:T,errorUpdatedAt:E,status:D}=g;N=g.data;let R=!1;if(o.placeholderData!==void 0&&N===void 0&&D==="pending"){let ne;f!=null&&f.isPlaceholderData&&o.placeholderData===(h==null?void 0:h.placeholderData)?(ne=f.data,R=!0):ne=typeof o.placeholderData=="function"?o.placeholderData((I=C(this,oi))==null?void 0:I.state.data,C(this,oi)):o.placeholderData,ne!==void 0&&(D="success",N=lf(f==null?void 0:f.data,ne,o),j=!0)}if(o.select&&N!==void 0&&!R)if(f&&N===(p==null?void 0:p.data)&&o.select===C(this,Ns))N=C(this,si);else try{ie(this,Ns,o.select),N=o.select(N),N=lf(f==null?void 0:f.data,N,o),ie(this,si,N),ie(this,Al,null)}catch(ne){ie(this,Al,ne)}C(this,Al)&&(T=C(this,Al),N=C(this,si),E=Date.now(),D="error");const L=g.fetchStatus==="fetching",H=D==="pending",P=D==="error",G=H&&L,Q=N!==void 0,W={status:D,fetchStatus:g.fetchStatus,isPending:H,isSuccess:D==="success",isError:P,isInitialLoading:G,isLoading:G,data:N,dataUpdatedAt:g.dataUpdatedAt,error:T,errorUpdatedAt:E,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:l.isFetched(),isFetchedAfterMount:g.dataUpdateCount>x.dataUpdateCount||g.errorUpdateCount>x.errorUpdateCount,isFetching:L,isRefetching:L&&!H,isLoadingError:P&&!Q,isPaused:g.fetchStatus==="paused",isPlaceholderData:j,isRefetchError:P&&Q,isStale:Kf(l,o),refetch:this.refetch,promise:C(this,Oa),isEnabled:gn(o.enabled,l)!==!1};if(this.options.experimental_prefetchInRender){const ne=W.data!==void 0,F=W.status==="error"&&!ne,J=fe=>{F?fe.reject(W.error):ne&&fe.resolve(W.data)},se=()=>{const fe=ie(this,Oa,W.promise=rf());J(fe)},ge=C(this,Oa);switch(ge.status){case"pending":l.queryHash===s.queryHash&&J(ge);break;case"fulfilled":(F||W.data!==ge.value)&&se();break;case"rejected":(!F||W.error!==ge.reason)&&se();break}}return W}updateResult(){const l=C(this,Qt),o=this.createResult(C(this,ze),this.options);if(ie(this,or,C(this,ze).state),ie(this,ii,this.options),C(this,or).data!==void 0&&ie(this,oi,C(this,ze)),sc(o,l))return;ie(this,Qt,o);const s=()=>{if(!l)return!0;const{notifyOnChangeProps:u}=this.options,f=typeof u=="function"?u():u;if(f==="all"||!f&&!C(this,ci).size)return!0;const p=new Set(f??C(this,ci));return this.options.throwOnError&&p.add("error"),Object.keys(C(this,Qt)).some(h=>{const v=h;return C(this,Qt)[v]!==l[v]&&p.has(v)})};we(this,He,Pg).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&we(this,He,df).call(this)}},Wt=new WeakMap,ze=new WeakMap,js=new WeakMap,Qt=new WeakMap,or=new WeakMap,ii=new WeakMap,Oa=new WeakMap,Al=new WeakMap,Ns=new WeakMap,si=new WeakMap,oi=new WeakMap,cr=new WeakMap,ur=new WeakMap,El=new WeakMap,ci=new WeakMap,He=new WeakSet,ms=function(l){we(this,He,hf).call(this);let o=C(this,ze).fetch(this.options,l);return l!=null&&l.throwOnError||(o=o.catch(Pt)),o},of=function(){we(this,He,ff).call(this);const l=Ol(this.options.staleTime,C(this,ze));if(xs.isServer()||C(this,Qt).isStale||!nf(l))return;const s=Dg(C(this,Qt).dataUpdatedAt,l)+1;ie(this,cr,nr.setTimeout(()=>{C(this,Qt).isStale||this.updateResult()},s))},cf=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(C(this,ze)):this.options.refetchInterval)??!1},uf=function(l){we(this,He,mf).call(this),ie(this,El,l),!(xs.isServer()||gn(this.options.enabled,C(this,ze))===!1||!nf(C(this,El))||C(this,El)===0)&&ie(this,ur,nr.setInterval(()=>{(this.options.refetchIntervalInBackground||$f.isFocused())&&we(this,He,ms).call(this)},C(this,El)))},df=function(){we(this,He,of).call(this),we(this,He,uf).call(this,we(this,He,cf).call(this))},ff=function(){C(this,cr)!==void 0&&(nr.clearTimeout(C(this,cr)),ie(this,cr,void 0))},mf=function(){C(this,ur)!==void 0&&(nr.clearInterval(C(this,ur)),ie(this,ur,void 0))},hf=function(){const l=C(this,Wt).getQueryCache().build(C(this,Wt),this.options);if(l===C(this,ze))return;const o=C(this,ze);ie(this,ze,l),ie(this,js,l.state),this.hasListeners()&&(o==null||o.removeObserver(this),l.addObserver(this))},Pg=function(l){St.batch(()=>{l.listeners&&this.listeners.forEach(o=>{o(C(this,Qt))}),C(this,Wt).getQueryCache().notify({query:C(this,ze),type:"observerResultsUpdated"})})},og);function eS(a,l){return gn(l.enabled,a)!==!1&&a.state.data===void 0&&!(a.state.status==="error"&&gn(l.retryOnMount,a)===!1)}function jx(a,l){return eS(a,l)||a.state.data!==void 0&&pf(a,l,l.refetchOnMount)}function pf(a,l,o){if(gn(l.enabled,a)!==!1&&Ol(l.staleTime,a)!=="static"){const s=typeof o=="function"?o(a):o;return s==="always"||s!==!1&&Kf(a,l)}return!1}function Nx(a,l,o,s){return(a!==l||gn(s.enabled,a)===!1)&&(!o.suspense||a.state.status!=="error")&&Kf(a,o)}function Kf(a,l){return gn(l.enabled,a)!==!1&&a.isStaleByTime(Ol(l.staleTime,a))}function tS(a,l){return!sc(a.getCurrentResult(),l)}var ws,Zn,Ut,dr,Jn,Nl,cg,nS=(cg=class extends $g{constructor(l){super();de(this,Jn);de(this,ws);de(this,Zn);de(this,Ut);de(this,dr);ie(this,ws,l.client),this.mutationId=l.mutationId,ie(this,Ut,l.mutationCache),ie(this,Zn,[]),this.state=l.state||Kg(),this.setOptions(l.options),this.scheduleGc()}setOptions(l){this.options=l,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(l){C(this,Zn).includes(l)||(C(this,Zn).push(l),this.clearGcTimeout(),C(this,Ut).notify({type:"observerAdded",mutation:this,observer:l}))}removeObserver(l){ie(this,Zn,C(this,Zn).filter(o=>o!==l)),this.scheduleGc(),C(this,Ut).notify({type:"observerRemoved",mutation:this,observer:l})}optionalRemove(){C(this,Zn).length||(this.state.status==="pending"?this.scheduleGc():C(this,Ut).remove(this))}continue(){var l;return((l=C(this,dr))==null?void 0:l.continue())??this.execute(this.state.variables)}async execute(l){var p,h,v,x,y,g,j,N,T,E,D,R,L,H,P,G,Q,q;const o=()=>{we(this,Jn,Nl).call(this,{type:"continue"})},s={client:C(this,ws),meta:this.options.meta,mutationKey:this.options.mutationKey};ie(this,dr,qg({fn:()=>this.options.mutationFn?this.options.mutationFn(l,s):Promise.reject(new Error("No mutationFn found")),onFail:(W,I)=>{we(this,Jn,Nl).call(this,{type:"failed",failureCount:W,error:I})},onPause:()=>{we(this,Jn,Nl).call(this,{type:"pause"})},onContinue:o,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>C(this,Ut).canRun(this)}));const u=this.state.status==="pending",f=!C(this,dr).canStart();try{if(u)o();else{we(this,Jn,Nl).call(this,{type:"pending",variables:l,isPaused:f}),C(this,Ut).config.onMutate&&await C(this,Ut).config.onMutate(l,this,s);const I=await((h=(p=this.options).onMutate)==null?void 0:h.call(p,l,s));I!==this.state.context&&we(this,Jn,Nl).call(this,{type:"pending",context:I,variables:l,isPaused:f})}const W=await C(this,dr).start();return await((x=(v=C(this,Ut).config).onSuccess)==null?void 0:x.call(v,W,l,this.state.context,this,s)),await((g=(y=this.options).onSuccess)==null?void 0:g.call(y,W,l,this.state.context,s)),await((N=(j=C(this,Ut).config).onSettled)==null?void 0:N.call(j,W,null,this.state.variables,this.state.context,this,s)),await((E=(T=this.options).onSettled)==null?void 0:E.call(T,W,null,l,this.state.context,s)),we(this,Jn,Nl).call(this,{type:"success",data:W}),W}catch(W){try{await((R=(D=C(this,Ut).config).onError)==null?void 0:R.call(D,W,l,this.state.context,this,s))}catch(I){Promise.reject(I)}try{await((H=(L=this.options).onError)==null?void 0:H.call(L,W,l,this.state.context,s))}catch(I){Promise.reject(I)}try{await((G=(P=C(this,Ut).config).onSettled)==null?void 0:G.call(P,void 0,W,this.state.variables,this.state.context,this,s))}catch(I){Promise.reject(I)}try{await((q=(Q=this.options).onSettled)==null?void 0:q.call(Q,void 0,W,l,this.state.context,s))}catch(I){Promise.reject(I)}throw we(this,Jn,Nl).call(this,{type:"error",error:W}),W}finally{C(this,Ut).runNext(this)}}},ws=new WeakMap,Zn=new WeakMap,Ut=new WeakMap,dr=new WeakMap,Jn=new WeakSet,Nl=function(l){const o=s=>{switch(l.type){case"failed":return{...s,failureCount:l.failureCount,failureReason:l.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:l.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:l.isPaused,status:"pending",variables:l.variables,submittedAt:Date.now()};case"success":return{...s,data:l.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:l.error,failureCount:s.failureCount+1,failureReason:l.error,isPaused:!1,status:"error"}}};this.state=o(this.state),St.batch(()=>{C(this,Zn).forEach(s=>{s.onMutationUpdate(l)}),C(this,Ut).notify({mutation:this,type:"updated",action:l})})},cg);function Kg(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Da,qn,Ms,ug,aS=(ug=class extends xi{constructor(l={}){super();de(this,Da);de(this,qn);de(this,Ms);this.config=l,ie(this,Da,new Set),ie(this,qn,new Map),ie(this,Ms,0)}build(l,o,s){const u=new nS({client:l,mutationCache:this,mutationId:++Vo(this,Ms)._,options:l.defaultMutationOptions(o),state:s});return this.add(u),u}add(l){C(this,Da).add(l);const o=Fo(l);if(typeof o=="string"){const s=C(this,qn).get(o);s?s.push(l):C(this,qn).set(o,[l])}this.notify({type:"added",mutation:l})}remove(l){if(C(this,Da).delete(l)){const o=Fo(l);if(typeof o=="string"){const s=C(this,qn).get(o);if(s)if(s.length>1){const u=s.indexOf(l);u!==-1&&s.splice(u,1)}else s[0]===l&&C(this,qn).delete(o)}}this.notify({type:"removed",mutation:l})}canRun(l){const o=Fo(l);if(typeof o=="string"){const s=C(this,qn).get(o),u=s==null?void 0:s.find(f=>f.state.status==="pending");return!u||u===l}else return!0}runNext(l){var s;const o=Fo(l);if(typeof o=="string"){const u=(s=C(this,qn).get(o))==null?void 0:s.find(f=>f!==l&&f.state.isPaused);return(u==null?void 0:u.continue())??Promise.resolve()}else return Promise.resolve()}clear(){St.batch(()=>{C(this,Da).forEach(l=>{this.notify({type:"removed",mutation:l})}),C(this,Da).clear(),C(this,qn).clear()})}getAll(){return Array.from(C(this,Da))}find(l){const o={exact:!0,...l};return this.getAll().find(s=>vx(o,s))}findAll(l={}){return this.getAll().filter(o=>vx(l,o))}notify(l){St.batch(()=>{this.listeners.forEach(o=>{o(l)})})}resumePausedMutations(){const l=this.getAll().filter(o=>o.state.isPaused);return St.batch(()=>Promise.all(l.map(o=>o.continue().catch(Pt))))}},Da=new WeakMap,qn=new WeakMap,Ms=new WeakMap,ug);function Fo(a){var l;return(l=a.options.scope)==null?void 0:l.id}var Ua,kl,en,La,qa,nc,vf,dg,lS=(dg=class extends xi{constructor(o,s){super();de(this,qa);de(this,Ua);de(this,kl);de(this,en);de(this,La);ie(this,Ua,o),this.setOptions(s),this.bindMethods(),we(this,qa,nc).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(o){var u;const s=this.options;this.options=C(this,Ua).defaultMutationOptions(o),sc(this.options,s)||C(this,Ua).getMutationCache().notify({type:"observerOptionsUpdated",mutation:C(this,en),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&fr(s.mutationKey)!==fr(this.options.mutationKey)?this.reset():((u=C(this,en))==null?void 0:u.state.status)==="pending"&&C(this,en).setOptions(this.options)}onUnsubscribe(){var o;this.hasListeners()||(o=C(this,en))==null||o.removeObserver(this)}onMutationUpdate(o){we(this,qa,nc).call(this),we(this,qa,vf).call(this,o)}getCurrentResult(){return C(this,kl)}reset(){var o;(o=C(this,en))==null||o.removeObserver(this),ie(this,en,void 0),we(this,qa,nc).call(this),we(this,qa,vf).call(this)}mutate(o,s){var u;return ie(this,La,s),(u=C(this,en))==null||u.removeObserver(this),ie(this,en,C(this,Ua).getMutationCache().build(C(this,Ua),this.options)),C(this,en).addObserver(this),C(this,en).execute(o)}},Ua=new WeakMap,kl=new WeakMap,en=new WeakMap,La=new WeakMap,qa=new WeakSet,nc=function(){var s;const o=((s=C(this,en))==null?void 0:s.state)??Kg();ie(this,kl,{...o,isPending:o.status==="pending",isSuccess:o.status==="success",isError:o.status==="error",isIdle:o.status==="idle",mutate:this.mutate,reset:this.reset})},vf=function(o){St.batch(()=>{var s,u,f,p,h,v,x,y;if(C(this,La)&&this.hasListeners()){const g=C(this,kl).variables,j=C(this,kl).context,N={client:C(this,Ua),meta:this.options.meta,mutationKey:this.options.mutationKey};if((o==null?void 0:o.type)==="success"){try{(u=(s=C(this,La)).onSuccess)==null||u.call(s,o.data,g,j,N)}catch(T){Promise.reject(T)}try{(p=(f=C(this,La)).onSettled)==null||p.call(f,o.data,null,g,j,N)}catch(T){Promise.reject(T)}}else if((o==null?void 0:o.type)==="error"){try{(v=(h=C(this,La)).onError)==null||v.call(h,o.error,g,j,N)}catch(T){Promise.reject(T)}try{(y=(x=C(this,La)).onSettled)==null||y.call(x,void 0,o.error,g,j,N)}catch(T){Promise.reject(T)}}}this.listeners.forEach(g=>{g(C(this,kl))})})},dg),In,fg,rS=(fg=class extends xi{constructor(l={}){super();de(this,In);this.config=l,ie(this,In,new Map)}build(l,o,s){const u=o.queryKey,f=o.queryHash??Hf(u,o);let p=this.get(f);return p||(p=new I2({client:l,queryKey:u,queryHash:f,options:l.defaultQueryOptions(o),state:s,defaultOptions:l.getQueryDefaults(u)}),this.add(p)),p}add(l){C(this,In).has(l.queryHash)||(C(this,In).set(l.queryHash,l),this.notify({type:"added",query:l}))}remove(l){const o=C(this,In).get(l.queryHash);o&&(l.destroy(),o===l&&C(this,In).delete(l.queryHash),this.notify({type:"removed",query:l}))}clear(){St.batch(()=>{this.getAll().forEach(l=>{this.remove(l)})})}get(l){return C(this,In).get(l)}getAll(){return[...C(this,In).values()]}find(l){const o={exact:!0,...l};return this.getAll().find(s=>px(o,s))}findAll(l={}){const o=this.getAll();return Object.keys(l).length>0?o.filter(s=>px(l,s)):o}notify(l){St.batch(()=>{this.listeners.forEach(o=>{o(l)})})}onFocus(){St.batch(()=>{this.getAll().forEach(l=>{l.onFocus()})})}onOnline(){St.batch(()=>{this.getAll().forEach(l=>{l.onOnline()})})}},In=new WeakMap,fg),it,Rl,zl,ui,di,_l,fi,mi,mg,iS=(mg=class{constructor(a={}){de(this,it);de(this,Rl);de(this,zl);de(this,ui);de(this,di);de(this,_l);de(this,fi);de(this,mi);ie(this,it,a.queryCache||new rS),ie(this,Rl,a.mutationCache||new aS),ie(this,zl,a.defaultOptions||{}),ie(this,ui,new Map),ie(this,di,new Map),ie(this,_l,0)}mount(){Vo(this,_l)._++,C(this,_l)===1&&(ie(this,fi,$f.subscribe(async a=>{a&&(await this.resumePausedMutations(),C(this,it).onFocus())})),ie(this,mi,oc.subscribe(async a=>{a&&(await this.resumePausedMutations(),C(this,it).onOnline())})))}unmount(){var a,l;Vo(this,_l)._--,C(this,_l)===0&&((a=C(this,fi))==null||a.call(this),ie(this,fi,void 0),(l=C(this,mi))==null||l.call(this),ie(this,mi,void 0))}isFetching(a){return C(this,it).findAll({...a,fetchStatus:"fetching"}).length}isMutating(a){return C(this,Rl).findAll({...a,status:"pending"}).length}getQueryData(a){var o;const l=this.defaultQueryOptions({queryKey:a});return(o=C(this,it).get(l.queryHash))==null?void 0:o.state.data}ensureQueryData(a){const l=this.defaultQueryOptions(a),o=C(this,it).build(this,l),s=o.state.data;return s===void 0?this.fetchQuery(a):(a.revalidateIfStale&&o.isStaleByTime(Ol(l.staleTime,o))&&this.prefetchQuery(l),Promise.resolve(s))}getQueriesData(a){return C(this,it).findAll(a).map(({queryKey:l,state:o})=>{const s=o.data;return[l,s]})}setQueryData(a,l,o){const s=this.defaultQueryOptions({queryKey:a}),u=C(this,it).get(s.queryHash),f=u==null?void 0:u.state.data,p=$2(l,f);if(p!==void 0)return C(this,it).build(this,s).setData(p,{...o,manual:!0})}setQueriesData(a,l,o){return St.batch(()=>C(this,it).findAll(a).map(({queryKey:s})=>[s,this.setQueryData(s,l,o)]))}getQueryState(a){var o;const l=this.defaultQueryOptions({queryKey:a});return(o=C(this,it).get(l.queryHash))==null?void 0:o.state}removeQueries(a){const l=C(this,it);St.batch(()=>{l.findAll(a).forEach(o=>{l.remove(o)})})}resetQueries(a,l){const o=C(this,it);return St.batch(()=>(o.findAll(a).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...a},l)))}cancelQueries(a,l={}){const o={revert:!0,...l},s=St.batch(()=>C(this,it).findAll(a).map(u=>u.cancel(o)));return Promise.all(s).then(Pt).catch(Pt)}invalidateQueries(a,l={}){return St.batch(()=>(C(this,it).findAll(a).forEach(o=>{o.invalidate()}),(a==null?void 0:a.refetchType)==="none"?Promise.resolve():this.refetchQueries({...a,type:(a==null?void 0:a.refetchType)??(a==null?void 0:a.type)??"active"},l)))}refetchQueries(a,l={}){const o={...l,cancelRefetch:l.cancelRefetch??!0},s=St.batch(()=>C(this,it).findAll(a).filter(u=>!u.isDisabled()&&!u.isStatic()).map(u=>{let f=u.fetch(void 0,o);return o.throwOnError||(f=f.catch(Pt)),u.state.fetchStatus==="paused"?Promise.resolve():f}));return Promise.all(s).then(Pt)}fetchQuery(a){const l=this.defaultQueryOptions(a);l.retry===void 0&&(l.retry=!1);const o=C(this,it).build(this,l);return o.isStaleByTime(Ol(l.staleTime,o))?o.fetch(l):Promise.resolve(o.state.data)}prefetchQuery(a){return this.fetchQuery(a).then(Pt).catch(Pt)}fetchInfiniteQuery(a){return a._type="infinite",this.fetchQuery(a)}prefetchInfiniteQuery(a){return this.fetchInfiniteQuery(a).then(Pt).catch(Pt)}ensureInfiniteQueryData(a){return a._type="infinite",this.ensureQueryData(a)}resumePausedMutations(){return oc.isOnline()?C(this,Rl).resumePausedMutations():Promise.resolve()}getQueryCache(){return C(this,it)}getMutationCache(){return C(this,Rl)}getDefaultOptions(){return C(this,zl)}setDefaultOptions(a){ie(this,zl,a)}setQueryDefaults(a,l){C(this,ui).set(fr(a),{queryKey:a,defaultOptions:l})}getQueryDefaults(a){const l=[...C(this,ui).values()],o={};return l.forEach(s=>{vs(a,s.queryKey)&&Object.assign(o,s.defaultOptions)}),o}setMutationDefaults(a,l){C(this,di).set(fr(a),{mutationKey:a,defaultOptions:l})}getMutationDefaults(a){const l=[...C(this,di).values()],o={};return l.forEach(s=>{vs(a,s.mutationKey)&&Object.assign(o,s.defaultOptions)}),o}defaultQueryOptions(a){if(a._defaulted)return a;const l={...C(this,zl).queries,...this.getQueryDefaults(a.queryKey),...a,_defaulted:!0};return l.queryHash||(l.queryHash=Hf(l.queryKey,l)),l.refetchOnReconnect===void 0&&(l.refetchOnReconnect=l.networkMode!=="always"),l.throwOnError===void 0&&(l.throwOnError=!!l.suspense),!l.networkMode&&l.persister&&(l.networkMode="offlineFirst"),l.queryFn===Qf&&(l.enabled=!1),l}defaultMutationOptions(a){return a!=null&&a._defaulted?a:{...C(this,zl).mutations,...(a==null?void 0:a.mutationKey)&&this.getMutationDefaults(a.mutationKey),...a,_defaulted:!0}}clear(){C(this,it).clear(),C(this,Rl).clear()}},it=new WeakMap,Rl=new WeakMap,zl=new WeakMap,ui=new WeakMap,di=new WeakMap,_l=new WeakMap,fi=new WeakMap,mi=new WeakMap,mg),Yg=S.createContext(void 0),Tt=a=>{const l=S.useContext(Yg);if(!l)throw new Error("No QueryClient set, use QueryClientProvider to set one");return l},sS=({client:a,children:l})=>(S.useEffect(()=>(a.mount(),()=>{a.unmount()}),[a]),i.jsx(Yg.Provider,{value:a,children:l})),Gg=S.createContext(!1),oS=()=>S.useContext(Gg);Gg.Provider;function cS(){let a=!1;return{clearReset:()=>{a=!1},reset:()=>{a=!0},isReset:()=>a}}var uS=S.createContext(cS()),dS=()=>S.useContext(uS),fS=(a,l,o)=>{const s=o!=null&&o.state.error&&typeof a.throwOnError=="function"?Pf(a.throwOnError,[o.state.error,o]):a.throwOnError;(a.suspense||a.experimental_prefetchInRender||s)&&(l.isReset()||(a.retryOnMount=!1))},mS=a=>{S.useEffect(()=>{a.clearReset()},[a])},hS=({result:a,errorResetBoundary:l,throwOnError:o,query:s,suspense:u})=>a.isError&&!l.isReset()&&!a.isFetching&&s&&(u&&a.data===void 0||Pf(o,[a.error,s])),pS=a=>{if(a.suspense){const o=u=>u==="static"?u:Math.max(u??1e3,1e3),s=a.staleTime;a.staleTime=typeof s=="function"?(...u)=>o(s(...u)):o(s),typeof a.gcTime=="number"&&(a.gcTime=Math.max(a.gcTime,1e3))}},vS=(a,l)=>a.isLoading&&a.isFetching&&!l,xS=(a,l)=>(a==null?void 0:a.suspense)&&l.isPending,wx=(a,l,o)=>l.fetchOptimistic(a).catch(()=>{o.clearReset()});function gS(a,l,o){var N,T,E,D;const s=oS(),u=dS(),f=Tt(),p=f.defaultQueryOptions(a);(T=(N=f.getDefaultOptions().queries)==null?void 0:N._experimental_beforeQuery)==null||T.call(N,p);const h=f.getQueryCache().get(p.queryHash),v=a.subscribed!==!1;p._optimisticResults=s?"isRestoring":v?"optimistic":void 0,pS(p),fS(p,u,h),mS(u);const x=!f.getQueryCache().get(p.queryHash),[y]=S.useState(()=>new l(f,p)),g=y.getOptimisticResult(p),j=!s&&v;if(S.useSyncExternalStore(S.useCallback(R=>{const L=j?y.subscribe(St.batchCalls(R)):Pt;return y.updateResult(),L},[y,j]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),S.useEffect(()=>{y.setOptions(p)},[p,y]),xS(p,g))throw wx(p,y,u);if(hS({result:g,errorResetBoundary:u,throwOnError:p.throwOnError,query:h,suspense:p.suspense}))throw g.error;if((D=(E=f.getDefaultOptions().queries)==null?void 0:E._experimental_afterQuery)==null||D.call(E,p,g),p.experimental_prefetchInRender&&!xs.isServer()&&vS(g,s)){const R=x?wx(p,y,u):h==null?void 0:h.promise;R==null||R.catch(Pt).finally(()=>{y.updateResult()})}return p.notifyOnChangeProps?g:y.trackResult(g)}function Yt(a,l){return gS(a,W2)}function gt(a,l){const o=Tt(),[s]=S.useState(()=>new lS(o,a));S.useEffect(()=>{s.setOptions(a)},[s,a]);const u=S.useSyncExternalStore(S.useCallback(p=>s.subscribe(St.batchCalls(p)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),f=S.useCallback((p,h)=>{s.mutate(p,h).catch(Pt)},[s]);if(u.error&&Pf(s.options.throwOnError,[u.error]))throw u.error;return{...u,mutate:f,mutateAsync:u.mutate}}/**
61
+ * @license lucide-react v1.17.0 - ISC
62
+ *
63
+ * This source code is licensed under the ISC license.
64
+ * See the LICENSE file in the root directory of this source tree.
65
+ */const Vg=(...a)=>a.filter((l,o,s)=>!!l&&l.trim()!==""&&s.indexOf(l)===o).join(" ").trim();/**
66
+ * @license lucide-react v1.17.0 - ISC
67
+ *
68
+ * This source code is licensed under the ISC license.
69
+ * See the LICENSE file in the root directory of this source tree.
70
+ */const bS=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
71
+ * @license lucide-react v1.17.0 - ISC
72
+ *
73
+ * This source code is licensed under the ISC license.
74
+ * See the LICENSE file in the root directory of this source tree.
75
+ */const yS=a=>a.replace(/^([A-Z])|[\s-_]+(\w)/g,(l,o,s)=>s?s.toUpperCase():o.toLowerCase());/**
76
+ * @license lucide-react v1.17.0 - ISC
77
+ *
78
+ * This source code is licensed under the ISC license.
79
+ * See the LICENSE file in the root directory of this source tree.
80
+ */const Mx=a=>{const l=yS(a);return l.charAt(0).toUpperCase()+l.slice(1)};/**
81
+ * @license lucide-react v1.17.0 - ISC
82
+ *
83
+ * This source code is licensed under the ISC license.
84
+ * See the LICENSE file in the root directory of this source tree.
85
+ */var $d={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
86
+ * @license lucide-react v1.17.0 - ISC
87
+ *
88
+ * This source code is licensed under the ISC license.
89
+ * See the LICENSE file in the root directory of this source tree.
90
+ */const SS=a=>{for(const l in a)if(l.startsWith("aria-")||l==="role"||l==="title")return!0;return!1},jS=S.createContext({}),NS=()=>S.useContext(jS),wS=S.forwardRef(({color:a,size:l,strokeWidth:o,absoluteStrokeWidth:s,className:u="",children:f,iconNode:p,...h},v)=>{const{size:x=24,strokeWidth:y=2,absoluteStrokeWidth:g=!1,color:j="currentColor",className:N=""}=NS()??{},T=s??g?Number(o??y)*24/Number(l??x):o??y;return S.createElement("svg",{ref:v,...$d,width:l??x??$d.width,height:l??x??$d.height,stroke:a??j,strokeWidth:T,className:Vg("lucide",N,u),...!f&&!SS(h)&&{"aria-hidden":"true"},...h},[...p.map(([E,D])=>S.createElement(E,D)),...Array.isArray(f)?f:[f]])});/**
91
+ * @license lucide-react v1.17.0 - ISC
92
+ *
93
+ * This source code is licensed under the ISC license.
94
+ * See the LICENSE file in the root directory of this source tree.
95
+ */const _e=(a,l)=>{const o=S.forwardRef(({className:s,...u},f)=>S.createElement(wS,{ref:f,iconNode:l,className:Vg(`lucide-${bS(Mx(a))}`,`lucide-${a}`,s),...u}));return o.displayName=Mx(a),o};/**
96
+ * @license lucide-react v1.17.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */const MS=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Yf=_e("activity",MS);/**
101
+ * @license lucide-react v1.17.0 - ISC
102
+ *
103
+ * This source code is licensed under the ISC license.
104
+ * See the LICENSE file in the root directory of this source tree.
105
+ */const CS=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],TS=_e("arrow-down",CS);/**
106
+ * @license lucide-react v1.17.0 - ISC
107
+ *
108
+ * This source code is licensed under the ISC license.
109
+ * See the LICENSE file in the root directory of this source tree.
110
+ */const AS=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],pc=_e("arrow-right",AS);/**
111
+ * @license lucide-react v1.17.0 - ISC
112
+ *
113
+ * This source code is licensed under the ISC license.
114
+ * See the LICENSE file in the root directory of this source tree.
115
+ */const ES=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],kS=_e("arrow-up-right",ES);/**
116
+ * @license lucide-react v1.17.0 - ISC
117
+ *
118
+ * This source code is licensed under the ISC license.
119
+ * See the LICENSE file in the root directory of this source tree.
120
+ */const RS=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Xg=_e("arrow-up",RS);/**
121
+ * @license lucide-react v1.17.0 - ISC
122
+ *
123
+ * This source code is licensed under the ISC license.
124
+ * See the LICENSE file in the root directory of this source tree.
125
+ */const zS=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],_S=_e("box",zS);/**
126
+ * @license lucide-react v1.17.0 - ISC
127
+ *
128
+ * This source code is licensed under the ISC license.
129
+ * See the LICENSE file in the root directory of this source tree.
130
+ */const OS=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],DS=_e("boxes",OS);/**
131
+ * @license lucide-react v1.17.0 - ISC
132
+ *
133
+ * This source code is licensed under the ISC license.
134
+ * See the LICENSE file in the root directory of this source tree.
135
+ */const US=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Kt=_e("check",US);/**
136
+ * @license lucide-react v1.17.0 - ISC
137
+ *
138
+ * This source code is licensed under the ISC license.
139
+ * See the LICENSE file in the root directory of this source tree.
140
+ */const LS=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],BS=_e("chevron-down",LS);/**
141
+ * @license lucide-react v1.17.0 - ISC
142
+ *
143
+ * This source code is licensed under the ISC license.
144
+ * See the LICENSE file in the root directory of this source tree.
145
+ */const qS=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],xf=_e("circle-dashed",qS);/**
146
+ * @license lucide-react v1.17.0 - ISC
147
+ *
148
+ * This source code is licensed under the ISC license.
149
+ * See the LICENSE file in the root directory of this source tree.
150
+ */const $S=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],HS=_e("clipboard",$S);/**
151
+ * @license lucide-react v1.17.0 - ISC
152
+ *
153
+ * This source code is licensed under the ISC license.
154
+ * See the LICENSE file in the root directory of this source tree.
155
+ */const QS=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],PS=_e("copy",QS);/**
156
+ * @license lucide-react v1.17.0 - ISC
157
+ *
158
+ * This source code is licensed under the ISC license.
159
+ * See the LICENSE file in the root directory of this source tree.
160
+ */const KS=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],YS=_e("cpu",KS);/**
161
+ * @license lucide-react v1.17.0 - ISC
162
+ *
163
+ * This source code is licensed under the ISC license.
164
+ * See the LICENSE file in the root directory of this source tree.
165
+ */const GS=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],gs=_e("credit-card",GS);/**
166
+ * @license lucide-react v1.17.0 - ISC
167
+ *
168
+ * This source code is licensed under the ISC license.
169
+ * See the LICENSE file in the root directory of this source tree.
170
+ */const VS=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],XS=_e("database",VS);/**
171
+ * @license lucide-react v1.17.0 - ISC
172
+ *
173
+ * This source code is licensed under the ISC license.
174
+ * See the LICENSE file in the root directory of this source tree.
175
+ */const FS=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Fg=_e("git-branch",FS);/**
176
+ * @license lucide-react v1.17.0 - ISC
177
+ *
178
+ * This source code is licensed under the ISC license.
179
+ * See the LICENSE file in the root directory of this source tree.
180
+ */const ZS=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],JS=_e("image",ZS);/**
181
+ * @license lucide-react v1.17.0 - ISC
182
+ *
183
+ * This source code is licensed under the ISC license.
184
+ * See the LICENSE file in the root directory of this source tree.
185
+ */const IS=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],WS=_e("info",IS);/**
186
+ * @license lucide-react v1.17.0 - ISC
187
+ *
188
+ * This source code is licensed under the ISC license.
189
+ * See the LICENSE file in the root directory of this source tree.
190
+ */const ej=[["path",{d:"M10 18v-7",key:"wt116b"}],["path",{d:"M11.119 2.205a2 2 0 0 1 1.762 0l7.84 3.846A.5.5 0 0 1 20.5 7h-17a.5.5 0 0 1-.22-.949z",key:"yxxwt6"}],["path",{d:"M14 18v-7",key:"vav6t3"}],["path",{d:"M18 18v-7",key:"aexdmj"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M6 18v-7",key:"1ivflk"}]],tj=_e("landmark",ej);/**
191
+ * @license lucide-react v1.17.0 - ISC
192
+ *
193
+ * This source code is licensed under the ISC license.
194
+ * See the LICENSE file in the root directory of this source tree.
195
+ */const nj=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],aj=_e("list",nj);/**
196
+ * @license lucide-react v1.17.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const lj=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],jt=_e("loader-circle",lj);/**
201
+ * @license lucide-react v1.17.0 - ISC
202
+ *
203
+ * This source code is licensed under the ISC license.
204
+ * See the LICENSE file in the root directory of this source tree.
205
+ */const rj=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],ij=_e("network",rj);/**
206
+ * @license lucide-react v1.17.0 - ISC
207
+ *
208
+ * This source code is licensed under the ISC license.
209
+ * See the LICENSE file in the root directory of this source tree.
210
+ */const sj=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],oj=_e("pencil",sj);/**
211
+ * @license lucide-react v1.17.0 - ISC
212
+ *
213
+ * This source code is licensed under the ISC license.
214
+ * See the LICENSE file in the root directory of this source tree.
215
+ */const cj=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],bs=_e("plus",cj);/**
216
+ * @license lucide-react v1.17.0 - ISC
217
+ *
218
+ * This source code is licensed under the ISC license.
219
+ * See the LICENSE file in the root directory of this source tree.
220
+ */const uj=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],hi=_e("refresh-cw",uj);/**
221
+ * @license lucide-react v1.17.0 - ISC
222
+ *
223
+ * This source code is licensed under the ISC license.
224
+ * See the LICENSE file in the root directory of this source tree.
225
+ */const dj=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],fj=_e("rotate-ccw",dj);/**
226
+ * @license lucide-react v1.17.0 - ISC
227
+ *
228
+ * This source code is licensed under the ISC license.
229
+ * See the LICENSE file in the root directory of this source tree.
230
+ */const mj=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Es=_e("search",mj);/**
231
+ * @license lucide-react v1.17.0 - ISC
232
+ *
233
+ * This source code is licensed under the ISC license.
234
+ * See the LICENSE file in the root directory of this source tree.
235
+ */const hj=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],pj=_e("settings-2",hj);/**
236
+ * @license lucide-react v1.17.0 - ISC
237
+ *
238
+ * This source code is licensed under the ISC license.
239
+ * See the LICENSE file in the root directory of this source tree.
240
+ */const vj=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],xj=_e("shield-check",vj);/**
241
+ * @license lucide-react v1.17.0 - ISC
242
+ *
243
+ * This source code is licensed under the ISC license.
244
+ * See the LICENSE file in the root directory of this source tree.
245
+ */const gj=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],bj=_e("smartphone",gj);/**
246
+ * @license lucide-react v1.17.0 - ISC
247
+ *
248
+ * This source code is licensed under the ISC license.
249
+ * See the LICENSE file in the root directory of this source tree.
250
+ */const yj=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Sj=_e("terminal",yj);/**
251
+ * @license lucide-react v1.17.0 - ISC
252
+ *
253
+ * This source code is licensed under the ISC license.
254
+ * See the LICENSE file in the root directory of this source tree.
255
+ */const jj=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Gf=_e("trash-2",jj);/**
256
+ * @license lucide-react v1.17.0 - ISC
257
+ *
258
+ * This source code is licensed under the ISC license.
259
+ * See the LICENSE file in the root directory of this source tree.
260
+ */const Nj=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],wj=_e("trending-up",Nj);/**
261
+ * @license lucide-react v1.17.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */const Mj=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]],hs=_e("wallet-cards",Mj);/**
266
+ * @license lucide-react v1.17.0 - ISC
267
+ *
268
+ * This source code is licensed under the ISC license.
269
+ * See the LICENSE file in the root directory of this source tree.
270
+ */const Cj=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Dl=_e("x",Cj);class Zg extends Error{constructor(o,s,u){super(o);Ed(this,"status");Ed(this,"code");this.status=s,this.code=u}}async function Lt(a){var o,s;const l=await fetch(a);if(!l.ok){const u=await l.json().catch(()=>({}));throw new Zg(((o=u.error)==null?void 0:o.message)??`${a} returned ${l.status}`,l.status,(s=u.error)==null?void 0:s.code)}return l.json()}async function st(a,l,o){var u,f;const s=await fetch(l,{method:a,headers:o?{"content-type":"application/json"}:void 0,body:o?JSON.stringify(o):void 0});if(!s.ok){const p=await s.json().catch(()=>({}));throw new Zg(((u=p.error)==null?void 0:u.message)??`${a} ${l} returned ${s.status}`,s.status,(f=p.error)==null?void 0:f.code)}return s.json()}function vc(){return Yt({queryKey:["ledger","inferences"],queryFn:()=>Lt("/ledger/inferences"),refetchInterval:1e4})}function Tj(){return Yt({queryKey:["ledger","purchases"],queryFn:()=>Lt("/ledger/purchases"),refetchInterval:1e4})}function Vf(){return Yt({queryKey:["payments"],queryFn:()=>Lt("/payments"),refetchInterval:1e4})}function Aj(){const a=Tt();return gt({mutationFn:l=>st("PUT","/payments/default",{method:l}),onSuccess:()=>{a.invalidateQueries({queryKey:["payments"]}),a.invalidateQueries({queryKey:["routing","provider-mode"]})}})}function Xf(){const a=Tt();return gt({mutationFn:()=>st("POST","/payments/clawtip/activate"),onSuccess:()=>{a.invalidateQueries({queryKey:["payments"]})}})}function Ff(){return gt({mutationFn:()=>st("POST","/payments/clawtip/recharge")})}function Jg(){return Yt({queryKey:["routing","strategy"],queryFn:()=>Lt("/routing/strategy")})}function Ej(){const a=Tt();return gt({mutationFn:l=>st("PUT","/routing/strategy",l),onSuccess:()=>{a.invalidateQueries({queryKey:["routing","strategy"]})}})}function Ig(){return Yt({queryKey:["routing","provider-mode"],queryFn:()=>Lt("/routing/provider-mode")})}function kj(){const a=Tt();return gt({mutationFn:l=>st("PUT","/routing/provider-mode",{mode:l}),onSuccess:l=>{a.setQueryData(["routing","provider-mode"],l),a.invalidateQueries({queryKey:["routing","provider-mode"]}),a.invalidateQueries({queryKey:["routing","auto-provider"]}),a.invalidateQueries({queryKey:["routing","strategy"]}),a.invalidateQueries({queryKey:["models"]})}})}function Wg(){return Yt({queryKey:["routing","auto-provider"],queryFn:()=>Lt("/routing/auto-provider")})}function Rj(){const a=Tt();return gt({mutationFn:l=>st("PUT","/routing/auto-provider",l),onSuccess:l=>{a.setQueryData(["routing","auto-provider"],{config:l.config,active:l.autoEnabled,locked:l.locked.auto,paymentReady:l.paymentReady,paymentRequired:l.paymentRequired,paymentLabel:l.paymentLabel}),a.setQueryData(["routing","provider-mode"],l),a.invalidateQueries({queryKey:["routing","auto-provider"]}),a.invalidateQueries({queryKey:["routing","provider-mode"]}),a.invalidateQueries({queryKey:["routing","strategy"]}),a.invalidateQueries({queryKey:["prewarm","focus-set"]}),a.invalidateQueries({queryKey:["models"]})}})}function Zf(){return Yt({queryKey:["routing","manual-providers"],queryFn:()=>Lt("/routing/manual-providers")})}function zj(){const a=Tt();return gt({mutationFn:l=>st("POST","/routing/manual-providers/local",l),onSuccess:()=>{a.invalidateQueries({queryKey:["routing","manual-providers"]}),a.invalidateQueries({queryKey:["models"]})}})}function _j(){const a=Tt();return gt({mutationFn:({providerId:l,input:o})=>st("PUT",`/routing/manual-providers/local/${encodeURIComponent(l)}`,o),onSuccess:()=>{a.invalidateQueries({queryKey:["routing","manual-providers"]}),a.invalidateQueries({queryKey:["models"]})}})}function Oj(){const a=Tt();return gt({mutationFn:l=>st("DELETE",`/routing/manual-providers/${encodeURIComponent(l)}`),onSuccess:()=>{a.invalidateQueries({queryKey:["routing","manual-providers"]}),a.invalidateQueries({queryKey:["models"]})}})}function Dj(){const a=Tt();return gt({mutationFn:l=>st("PUT","/routing/manual-providers/order",{providerIds:l}),onSuccess:l=>{a.setQueryData(["routing","manual-providers"],l),a.invalidateQueries({queryKey:["routing","manual-providers"]}),a.invalidateQueries({queryKey:["models"]})}})}function Uj(){const a=Tt();return gt({mutationFn:l=>st("PUT","/routing/manual-providers/routing",l),onSuccess:()=>{a.invalidateQueries({queryKey:["routing","manual-providers"]}),a.invalidateQueries({queryKey:["models"]})}})}function Lj(a){return st("POST","/routing/manual-providers/probe",a)}function Bj(){const a=Tt();return gt({mutationFn:l=>st("POST",`/routing/manual-providers/${encodeURIComponent(l)}/test`),onSuccess:()=>{a.invalidateQueries({queryKey:["routing","manual-providers"]}),a.invalidateQueries({queryKey:["ledger","inferences"]})}})}function qj(){const a=Tt();return gt({mutationFn:l=>st("POST",`/routing/manual-providers/${encodeURIComponent(l)}/models/refresh`),onSuccess:l=>{a.setQueryData(["routing","manual-providers"],{version:1,updatedAt:new Date().toISOString(),routing:l.routing,providers:l.providers}),a.invalidateQueries({queryKey:["routing","manual-providers"]}),a.invalidateQueries({queryKey:["models"]})}})}function $j(a){const l=new URLSearchParams;for(const[o,s]of Object.entries(a))s!=null&&s!==""&&l.set(o,Hj(s));return Yt({queryKey:["routing","preview",l.toString()],queryFn:()=>Lt(`/routing/preview?${l.toString()}`),enabled:!1})}function Hj(a){return Array.isArray(a)?a.join(","):typeof a=="object"&&a!==null?Object.entries(a).map(([l,o])=>`${l}:${o}`).join(","):String(a)}function Jf(){return Yt({queryKey:["sellers"],queryFn:()=>Lt("/sellers"),refetchInterval:3e4})}function ks(){return Yt({queryKey:["models"],queryFn:()=>Lt("/models"),refetchInterval:3e4})}function Qj(){const a=Tt();return gt({mutationFn:l=>st("POST",`/sellers/${encodeURIComponent(l)}/test`),onSuccess:()=>{a.invalidateQueries({queryKey:["models"]})}})}function Pj(){const a=Tt();return gt({mutationFn:()=>Lt("/models"),onSuccess:l=>{a.setQueryData(["models"],l),a.invalidateQueries({queryKey:["models"]}),a.invalidateQueries({queryKey:["sellers"]})}})}function Kj(){return Yt({queryKey:["prewarm","focus-set"],queryFn:()=>Lt("/v1.2/prewarm").then(a=>({ok:!0,focusSet:a.focusSet??[],source:"historical"}))})}async function gf(a){const l=Array.isArray(a)?{models:a}:a;return st("PUT","/prewarm/focus-set",l)}function If(){return Yt({queryKey:["status"],queryFn:()=>Lt("/status"),refetchInterval:5e3})}function Yj(){return Yt({queryKey:["update","status"],queryFn:()=>Lt("/update/status"),refetchInterval:3600*1e3})}function Gj(){return gt({mutationFn:()=>st("POST","/update/run")})}const Me="—",Qn="-",nn=a=>a<10?`0${a}`:`${a}`;function bf(a,l={}){if(!Number.isFinite(a))return Me;const o=a;return o<=0?Qn:l.compact===!1||o<1e4?Math.round(o).toLocaleString("en-US"):o<1e6?`${(o/1e3).toFixed(1)}K`:o<1e9?`${(o/1e6).toFixed(1)}M`:`${(o/1e9).toFixed(2)}B`}function ac(a){if(!Number.isFinite(a))return Me;const l=a;return l<=0?Qn:l<1e4?Math.round(l).toLocaleString("en-US"):l<1e6?`${(l/1e3).toFixed(2)}K`:l<1e9?`${(l/1e6).toFixed(2)}M`:`${(l/1e9).toFixed(2)}B`}function ys(a){return Number.isFinite(a)?a<=0?Qn:`${a.toFixed(1)} tok/s`:Me}function eb(a){return Number.isFinite(a)?a<=0?Qn:a.toFixed(1):Me}function Se(a){return Number.isFinite(a)?a===0?Qn:Math.round(a).toLocaleString("en-US"):Me}function Ba(a,l={}){if(!Number.isFinite(a))return Me;if(a===0)return Qn;const o=Math.abs(a/1e6),s=l.digits??(l.ledger&&o<.01?6:4),u=`$${(a/1e6).toFixed(s)}`;return l.signed&&a>=0?`+${u}`:u}function Vj(a,l={}){if(!Number.isFinite(a))return Me;if(a===0)return Qn;const s=`${Math.abs(a/1e6).toFixed(l.digits??4)} credit`;return l.signed?a>=0?`+${s}`:`-${s}`:a<0?`-${s}`:s}function wl(a,l={}){return Ba(a,{digits:l.digits??6})}function Xj(a){var s,u;const l=(s=a.paymentCurrency)==null?void 0:s.trim().toUpperCase(),o=(u=a.paymentAmount)==null?void 0:u.trim();return l==="USD"&&Number.isFinite(a.paymentAmountMinor)?`$${(a.paymentAmountMinor/100).toFixed(4)}`:l==="CNY"&&Number.isFinite(a.paymentAmountMinor)?`¥${(a.paymentAmountMinor/100).toFixed(2)} CNY`:o&&l?l==="USD"?`${Cx(l)}${o}`:`${Cx(l)}${o} ${l}`:Number.isFinite(a.paymentAmountMinor)&&l?`${Se(a.paymentAmountMinor)} ${l} minor`:Me}function Fj(a,l){if(!Number.isFinite(a)||!l)return Me;const o=l.trim().toUpperCase();return o==="USD"?`$${(a/100).toFixed(4)}`:o==="CNY"?`¥${(a/100).toFixed(2)} CNY`:`${Se(a)} ${o} minor`}function Cx(a){return a==="USD"?"$":a==="CNY"?"¥":a==="EUR"?"€":a==="GBP"?"£":""}function Zj(a,l,o={}){return!Number.isFinite(a)&&!Number.isFinite(l)?Me:`${Ba(a,o)} / ${Ba(l,o)}`}function na(a){if(!Number.isFinite(a))return Me;const l=Math.max(0,Math.round(a));return l===0?Qn:l<1e3?`${l}ms`:`${(l/1e3).toFixed(2)}s`}function Jj(a){return Number.isFinite(a)?`${Math.round(a*100)}%`:Me}function Wf(a){if(!Number.isFinite(a))return Me;const l=Math.max(0,a);return Wj(l)}function yf(a,l){return Zj(a,l,{digits:4})}function cc(a){const l=Ba(a,{digits:4});return l===Me||l===Qn?l:`${l} / 1M Token`}function Ij(a){return Number.isFinite(a)?a<=0?Qn:`${a.toFixed(2)}x`:Me}function Wj(a){return String(a)}function bn(a){return a?a.trim().toLowerCase().replaceAll("_"," "):Me}function ea(a){const l=bn(a);return l==="ok"||l==="online"||l==="configured"||l==="settled"||l==="completed"||l==="success"||l==="active"||l==="healthy"?"green":l==="fallback"||l==="pending"||l==="degraded"||l==="preview"||l==="cooldown"||l==="full"?"amber":l==="failed"||l==="error"||l==="canceled"||l==="unhealthy"||l==="offline"?"red":l==="running"?"blue":"gray"}function Rs(a){return a?a.startsWith("tbs-")&&a.length>10?a.slice(0,10):a.length<=12?a:a.slice(0,12):Me}function eN(a){if(!a)return Me;const l=new Date(a);if(Number.isNaN(l.getTime()))return Me;const o=new Date,s=l.getFullYear()===o.getFullYear()&&l.getMonth()===o.getMonth()&&l.getDate()===o.getDate(),u=`${nn(l.getHours())}:${nn(l.getMinutes())}`;return s?u:`${nn(l.getMonth()+1)}/${nn(l.getDate())} ${u}`}function xc(a){if(!a)return Me;const l=new Date(a);return Number.isNaN(l.getTime())?Me:`${l.getFullYear()}-${nn(l.getMonth()+1)}-${nn(l.getDate())} ${nn(l.getHours())}:${nn(l.getMinutes())}:${nn(l.getSeconds())}`}function gc(a){if(!a)return Me;const l=new Date(a);return Number.isNaN(l.getTime())?Me:`${l.getFullYear()}/${nn(l.getMonth()+1)}/${nn(l.getDate())} ${nn(l.getHours())}:${nn(l.getMinutes())}:${nn(l.getSeconds())}`}function tN(a){return eN(a)}function tb(a,l){const o=new Map;for(const s of[...l].sort((u,f)=>u.createdAt.localeCompare(f.createdAt)))!s.paymentMethod||s.balanceSnapshotMicros===void 0||o.set(ta(s.paymentMethod),s.balanceSnapshotMicros);return[...a].filter(s=>ta(s.method)!=="mock").sort((s,u)=>Number(u.isDefault)-Number(s.isDefault)||s.method.localeCompare(u.method)).map(s=>{const u=ta(s.method),f=s.enabled||!!(s.config&&Object.keys(s.config).length>0),p=o.get(u),h=u==="clawtip";return{name:ab(s.method),method:s.method,balance:h?"••••":Ba(p),status:s.enabled?"Bound":"Available",note:f?s.isDefault?"Default wallet":"Configured":"Not bound",action:s.enabled?"Recharge":"Activate",icon:nN(s.method),balanceHidden:h,config:s.config}})}function nb({modal:a,methods:l,qr:o,loading:s,error:u,onClose:f}){const p=a.kind==="recharge",h=l.find(E=>E.method===a.method),v=p&&ta(a.method)==="clawtip",x=Hd(h==null?void 0:h.config,"resourceUrl"),y=Hd(h==null?void 0:h.config,"walletConfigPath"),g=Hd(h==null?void 0:h.config,"orderNo"),j=(o==null?void 0:o.walletConfigPresent)===!0||lb(h==null?void 0:h.config,"walletConfigPresent"),N=!p&&!!(o!=null&&o.qrImageUrl)&&!j&&!u,T=(h==null?void 0:h.name)??ab(a.method);return i.jsx("div",{className:"fixed inset-0 z-30 grid place-items-center overflow-y-auto bg-[rgba(32,26,56,0.28)] px-4 py-6",children:i.jsxs("div",{className:"w-full max-w-[820px] rounded-[14px] bg-white p-5 shadow-[0_20px_56px_rgba(32,26,56,0.20)] sm:p-6",children:[i.jsxs("div",{className:"flex items-start justify-between gap-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-[1.05rem] font-semibold text-[var(--color-ink)]",children:v?"ClawTip wallet QR":p?`Recharge ${T}`:`Activate ${T}`}),i.jsx("p",{className:"mt-1 text-[0.82rem] leading-5 text-[var(--color-muted)]",children:v?"Scan with JD app to view wallet balance or recharge.":p?"Load the fixed ClawTip recharge QR from static assets.":"Reuse the tb init ClawTip flow and wait for wallet binding."})]}),i.jsx("button",{className:"tb-button tb-button-icon tb-button-quiet",onClick:f,"aria-label":"Close payment modal",children:i.jsx(Dl,{className:"size-4"})})]}),i.jsxs("div",{className:"mt-5 flex flex-col gap-4",children:[i.jsx("div",{className:"mx-auto grid min-h-[320px] w-full max-w-[720px] place-items-center overflow-hidden rounded-[12px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-3 sm:min-h-[560px] sm:p-4",children:o!=null&&o.qrImageUrl?i.jsx("img",{className:"max-h-[72vh] w-full object-contain",src:o.qrImageUrl,alt:`${T} ${p?"recharge":"activation"} QR code`}):i.jsxs("div",{className:"flex flex-col items-center gap-2 px-3 text-center text-[0.78rem] leading-5 text-[var(--color-muted)]",children:[s?i.jsx(jt,{className:"size-5 animate-spin text-[var(--color-purple)]"}):null,i.jsx("span",{children:s?"Generating ClawTip QR...":"QR image unavailable"})]})}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[i.jsx(cs,{label:"Method",value:T}),i.jsx(cs,{label:"Wallet",value:j?"bound":"waiting",warn:!j}),o!=null&&o.orderNo||g?i.jsx(cs,{label:"Order",value:(o==null?void 0:o.orderNo)??g??""}):null,o!=null&&o.walletConfigPath||y?i.jsx(cs,{label:"Config",value:lN((o==null?void 0:o.walletConfigPath)??y??"")}):null,o!=null&&o.clawtipId?i.jsx(cs,{label:"Device",value:o.clawtipId}):null]}),u?i.jsx("div",{className:"rounded-[8px] border border-rose-100 bg-rose-50 px-3 py-2 text-[0.78rem] leading-5 text-rose-700",children:u instanceof Error?u.message:String(u)}):null,o!=null&&o.qrImageUrl?i.jsx("div",{className:"rounded-[8px] border border-emerald-100 bg-emerald-50 px-3 py-2 text-[0.78rem] leading-5 text-emerald-800",children:p?"Scan with JD app to view wallet balance or recharge.":i.jsxs("span",{className:"flex items-start gap-2",children:[N?i.jsx(jt,{className:"mt-0.5 size-4 shrink-0 animate-spin"}):null,i.jsx("span",{children:j?"Wallet bound. Closing...":"Scan with JD app. TokenBuddy is waiting for the local wallet config."})]})}):null,o!=null&&o.resourceUrl||x?i.jsx("a",{className:"tb-button tb-button-md tb-button-secondary w-full justify-start overflow-hidden font-mono text-[0.75rem]",href:(o==null?void 0:o.resourceUrl)??x,target:"_blank",rel:"noreferrer",children:aN((o==null?void 0:o.resourceUrl)??x??"")}):!(o!=null&&o.qrImageUrl)&&!s&&!u?i.jsxs("div",{className:"rounded-[8px] border border-amber-100 bg-amber-50 px-3 py-2 text-[0.78rem] leading-5 text-amber-800",children:["No recharge link is available from the daemon. Run ",i.jsx("span",{className:"font-mono",children:"tb init"})," to bind this payment method."]}):null]})]})]})})}function ab(a){const l=ta(a);return l==="clawtip"?"ClawTip":l==="alipay-agent"?"Alipay Agent Payment":l==="wechat-pay"?"WeChat Pay":l==="coinbase-smart-wallet"?"Coinbase Smart Wallet":a.split(/[-_\s]+/).filter(Boolean).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")}function ta(a){return a.trim().toLowerCase()}function lb(a,l){return(a==null?void 0:a[l])===!0}function cs({label:a,value:l,warn:o=!1}){return i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsx("div",{className:"text-[0.78rem] text-[var(--color-muted)]",children:a}),i.jsx("div",{className:["font-mono text-[0.94rem] font-semibold",o?"text-amber-700":"text-[var(--color-ink)]"].join(" "),children:l})]})}function nN(a){const l=ta(a);return l==="clawtip"?"C":l==="wechat-pay"?"W":l==="alipay-agent"?"A":l.charAt(0).toUpperCase()||"P"}function aN(a){try{const l=new URL(a),o=l.pathname==="/"?"":l.pathname;return`${l.host}${o}`.slice(0,34)}catch{return a.length>34?`${a.slice(0,31)}...`:a}}function lN(a){const l=a.split("/");return l.length<=3?a:`.../${l.slice(-2).join("/")}`}function Hd(a,l){const o=a==null?void 0:a[l];return typeof o=="string"&&o.length>0?o:void 0}const rN=320,Qd=12;function iN({inputTokens:a,outputTokens:l,cacheReadTokens:o}){const s=rb(a,l,o),u=Number.isFinite(o),f=Number.isFinite(o)&&o>0,p=[{label:"输入 Token",value:Se(a)},{label:"输出 Token",value:Se(l)}];return u&&p.push({label:"缓存读取 Token",value:Se(o)}),p.push({label:"总 Token",value:Se(s),dividerBefore:!0,emphasis:!0}),i.jsxs("span",{className:"inline-flex min-w-[13rem] items-center gap-2 align-middle",children:[i.jsxs("span",{className:"grid min-w-0 gap-1",children:[i.jsxs("span",{className:"inline-flex items-center gap-4 whitespace-nowrap font-mono text-[0.88rem] font-semibold text-[var(--color-ink)]",children:[i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx(TS,{className:"size-3.5 text-[var(--color-success)]","aria-hidden":"true"}),Se(a)]}),i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx(Xg,{className:"size-3.5 text-[var(--color-primary)]","aria-hidden":"true"}),Se(l)]})]}),f?i.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap font-mono text-[0.78rem] font-semibold text-[var(--color-tokens)]",children:[i.jsx(XS,{className:"size-3.5","aria-hidden":"true"}),bf(o)]}):null]}),i.jsx(em,{ariaLabel:"Token 明细",children:i.jsx(tm,{title:"Token 明细",rows:p})})]})}function sN({imageCount:a,imageSize:l,imageQuality:o,imageOutputFormat:s}){const u=[{label:"图片数量",value:Se(a)},{label:"尺寸",value:l||Me},{label:"质量",value:o||Me},{label:"输出格式",value:s||Me}];return i.jsxs("span",{className:"inline-flex min-w-[13rem] items-center gap-2 align-middle",children:[i.jsxs("span",{className:"grid min-w-0 gap-1",children:[i.jsxs("span",{className:"inline-flex items-center justify-end gap-1 whitespace-nowrap font-mono text-[0.88rem] font-semibold text-[var(--color-ink)]",children:[i.jsx(JS,{className:"size-3.5 text-[var(--color-primary)]","aria-hidden":"true"}),Se(a)," image",a===1?"":"s"]}),i.jsx("span",{className:"whitespace-nowrap font-mono text-[0.78rem] font-semibold text-[var(--color-muted)]",children:[l,o,s].filter(Boolean).join(" / ")||Me})]}),i.jsx(em,{ariaLabel:"图片明细",children:i.jsx(tm,{title:"图片明细",rows:u})})]})}function oN({inputTokens:a,outputTokens:l}){const o=rb(a,l);return i.jsxs("div",{className:"flex min-w-0 items-center gap-4",children:[i.jsx("div",{className:"grid size-[4.5rem] shrink-0 place-items-center rounded-[var(--radius-lg)] border border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] text-[var(--color-tokens)]",children:i.jsx(_S,{className:"size-7","aria-hidden":"true"})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[0.8rem] font-bold uppercase tracking-normal text-[var(--color-muted)]",children:"总 Token"}),i.jsx("div",{className:"mt-1 font-mono text-[2rem] font-bold leading-none tracking-normal text-[var(--color-ink)]",children:ac(o)}),i.jsxs("div",{className:"mt-1 font-mono text-[0.9rem] font-medium leading-snug tracking-normal text-[var(--color-muted)]",children:["输入: ",ac(a)," / 输出: ",ac(l)]})]})]})}function cN(a){const l=a.settledUsdMicros??a.billedMicros,o=dN(a,l);return i.jsxs("span",{className:"inline-flex items-center gap-2 align-middle",children:[i.jsx("span",{className:"whitespace-nowrap font-mono text-[0.9rem] font-semibold text-[var(--color-spend)]",children:wl(l)}),i.jsx(em,{ariaLabel:"成本明细",children:i.jsx(tm,{title:"成本明细",rows:o})})]})}function uN({inputPriceMicrosPer1m:a,outputPriceMicrosPer1m:l}){return i.jsxs("span",{className:"grid gap-0.5 font-mono text-[0.78rem] leading-snug text-[var(--color-muted)]",children:[i.jsxs("span",{children:["输入 ",cc(a)]}),i.jsxs("span",{children:["输出 ",cc(l)]})]})}function bc({ttftMs:a,tokensPerSecond:l,compact:o=!1}){return o?i.jsxs("span",{className:"font-mono",children:["TTFT ",na(a)," / ",ys(l)]}):i.jsxs("span",{className:"inline-grid gap-0.5 font-mono text-[0.78rem] leading-snug",children:[i.jsxs("span",{children:[i.jsx("span",{className:"text-[var(--color-muted)]",children:"TTFT"})," ",na(a)]}),i.jsxs("span",{children:[i.jsx("span",{className:"text-[var(--color-muted)]",children:"Tok/s"})," ",eb(l)]})]})}function dN(a,l){const o=[];return a.billingUnit==="images"&&(o.push({label:"图片数量",value:Se(a.imageCount)}),a.imageSize&&o.push({label:"尺寸",value:a.imageSize}),a.imageQuality&&o.push({label:"质量",value:a.imageQuality}),a.imageOutputFormat&&o.push({label:"输出格式",value:a.imageOutputFormat}),Fn(o,"图片输出成本",wl(a.imageOutputCostMicros),a.imageOutputCostMicros),Fn(o,"单张折算",wl(a.imageCostMicrosPerImage),a.imageCostMicrosPerImage),Fn(o,"图片输出 Token",Se(a.imageOutputTokens),a.imageOutputTokens)),Fn(o,"输入成本",wl(a.inputCostMicros),a.inputCostMicros),Fn(o,"输出成本",wl(a.outputCostMicros),a.outputCostMicros),Fn(o,"输入单价",cc(a.inputPriceMicrosPer1m),a.inputPriceMicrosPer1m),Fn(o,"输出单价",cc(a.outputPriceMicrosPer1m),a.outputPriceMicrosPer1m),Fn(o,"缓存读取成本",wl(a.cacheReadCostMicros),a.cacheReadCostMicros),a.serviceTier&&o.push({label:"服务档位",value:a.serviceTier,dividerBefore:o.length>0}),Fn(o,"倍率",Ij(a.billingMultiplier),a.billingMultiplier),Fn(o,"原始",wl(a.originalUsdMicros),a.originalUsdMicros),o.push({label:"计费",value:wl(l),dividerBefore:o.length>0,emphasis:!0}),o.length===1&&o.unshift({label:"明细",value:Me}),o}function Fn(a,l,o,s){Number.isFinite(s)&&a.push({label:l,value:o})}function em({ariaLabel:a,children:l}){const o=S.useRef(null),[s,u]=S.useState(!1),[f,p]=S.useState(),h=S.useCallback(()=>{const x=o.current;if(!x)return;const y=x.getBoundingClientRect(),g=window.innerWidth-rN-Qd,j=Math.max(Qd,Math.min(g,y.right+8)),N=Math.max(Qd,y.top+y.height/2-32);p({top:N,left:j})},[]),v=S.useCallback(()=>{h(),u(!0)},[h]);return S.useEffect(()=>{if(s)return h(),window.addEventListener("scroll",h,!0),window.addEventListener("resize",h),()=>{window.removeEventListener("scroll",h,!0),window.removeEventListener("resize",h)}},[s,h]),i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:o,type:"button","aria-label":a,className:"inline-grid size-6 shrink-0 place-items-center rounded-full border border-[var(--color-line)] bg-[var(--color-panel-subtle)] text-[var(--color-muted)] hover:border-[var(--color-primary)] hover:text-[var(--color-primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-primary)]/30",onMouseEnter:v,onMouseLeave:()=>u(!1),onFocus:v,onBlur:()=>u(!1),onClick:()=>{h(),u(x=>!x)},children:i.jsx(WS,{className:"size-3.5","aria-hidden":"true"})}),s&&f&&typeof document<"u"?O2.createPortal(i.jsx("div",{className:"pointer-events-none fixed z-50 w-[20rem] rounded-[var(--radius-lg)] border border-[var(--color-line)] bg-white p-4 shadow-[var(--shadow-modal)]",style:{top:f.top,left:f.left},children:l}),document.body):null]})}function tm({title:a,rows:l}){return i.jsxs("div",{className:"grid gap-2",children:[i.jsx("div",{className:"text-[0.92rem] font-bold text-[var(--color-ink)]",children:a}),i.jsx("div",{className:"grid gap-1",children:l.map((o,s)=>i.jsxs("div",{className:["grid grid-cols-[1fr_auto] items-baseline gap-4 text-[0.86rem]",o.dividerBefore?"mt-1 border-t border-[var(--color-line-2)] pt-2":""].join(" "),children:[i.jsx("span",{className:"text-[var(--color-muted)]",children:o.label}),i.jsx("span",{className:["font-mono tracking-normal",o.emphasis?"font-bold text-[var(--color-ink)]":"font-semibold text-[var(--color-ink)]",o.value===Qn?"text-[var(--color-muted)]":""].join(" "),children:o.value})]},`${o.label}-${s}`))})]})}function rb(...a){return a.reduce((l,o)=>l+(Number.isFinite(o)?o:0),0)}function _t({children:a,className:l=""}){return i.jsx("div",{className:["rounded-[var(--radius-xl)] border border-[var(--color-line-2)] bg-white shadow-[var(--shadow-panel)]",l].join(" "),children:a})}function zs(a){return{router:{card:"border border-[var(--color-hairline-strong)] bg-white shadow-[var(--shadow-panel)] hover:border-[var(--color-lavender-2)] hover:bg-[var(--color-panel-subtle)]",icon:"border border-[var(--color-lavender-2)] bg-[var(--color-lavender)] text-[var(--color-router)]",label:"text-[var(--color-router)]",value:"text-[var(--color-ink)]",note:"text-[var(--color-muted)]"},requests:{card:"border border-[var(--color-hairline)] bg-white shadow-[var(--shadow-panel)] hover:border-[var(--color-success-border)] hover:bg-[var(--color-panel-subtle)]",icon:"border border-[var(--color-success-border)] bg-[var(--color-success-soft)] text-[var(--color-success)]",label:"text-[var(--color-success)]",value:"text-[var(--color-ink)]",note:"text-[var(--color-muted)]"},spend:{card:"border border-[var(--color-hairline)] bg-white shadow-[var(--shadow-panel)] hover:border-[var(--color-spend-border)] hover:bg-[var(--color-panel-subtle)]",icon:"border border-[var(--color-spend-border)] bg-[var(--color-spend-soft)] text-[var(--color-spend)]",label:"text-[var(--color-spend)]",value:"text-[var(--color-ink)]",note:"text-[var(--color-muted)]"},tokens:{card:"border border-[var(--color-hairline)] bg-white shadow-[var(--shadow-panel)] hover:border-[var(--color-tokens-border)] hover:bg-[var(--color-panel-subtle)]",icon:"border border-[var(--color-tokens-border)] bg-[var(--color-tokens-soft)] text-[var(--color-tokens)]",label:"text-[var(--color-tokens)]",value:"text-[var(--color-ink)]",note:"text-[var(--color-muted)]"},inventory:{card:"border border-[var(--color-hairline)] bg-white shadow-[var(--shadow-panel)] hover:border-[var(--color-inventory-border)] hover:bg-[var(--color-panel-subtle)]",icon:"border border-[var(--color-inventory-border)] bg-[var(--color-inventory-soft)] text-[var(--color-inventory)]",label:"text-[var(--color-inventory)]",value:"text-[var(--color-ink)]",note:"text-[var(--color-muted)]"}}[a]}function nm({tone:a,children:l,className:o="size-7"}){const s=zs(a);return i.jsx("div",{className:[`grid ${o} place-items-center rounded-[var(--radius-md)]`,s.icon].join(" "),children:l})}function Tx({icon:a,label:l,tone:o,rows:s}){const u=zs(o);return i.jsxs(_t,{className:"relative min-h-[9rem] overflow-hidden border-[var(--color-hairline)] bg-white px-4 py-4",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[i.jsx(nm,{tone:o,className:"size-10",children:a}),i.jsx("div",{className:["text-[0.72rem] font-bold uppercase tracking-[0.08em]",u.label].join(" "),children:l})]}),i.jsx("div",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:s.map(f=>i.jsxs("div",{className:"min-w-0 rounded-[8px] border border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-3 py-2",children:[i.jsx("div",{className:"text-[0.68rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:f.label}),i.jsx("div",{className:["mt-1 truncate font-mono text-[1.15rem] font-bold leading-tight tracking-normal",u.value].join(" "),children:f.value}),i.jsx("div",{className:"mt-1 truncate text-[0.72rem] font-medium text-[var(--color-muted)]",children:f.detail})]},f.key))})]})}function fN({tone:a="lavender",children:l}){const o={lavender:"bg-[var(--color-lavender)] text-[var(--color-primary)]",green:"bg-[var(--color-success-soft)] text-[var(--color-success)]",amber:"bg-[var(--color-warning-soft)] text-[var(--color-warning)]",red:"bg-[var(--color-danger-soft)] text-[var(--color-danger)]",blue:"bg-[var(--color-tokens-soft)] text-[var(--color-tokens)]",gray:"bg-slate-100 text-slate-600"};return i.jsxs("span",{className:["inline-flex items-center gap-1.5 text-[0.78rem] font-medium px-2.5 py-0.5 rounded-[var(--radius-pill)]",o[a]??o.lavender].join(" "),children:[i.jsx("span",{className:"size-1.5 rounded-full bg-current"}),l]})}const Ax="tokenbuddy-ui-language",Ex={en:{"nav.overview":"Overview","nav.routing":"Routing","nav.ledger":"Ledger","nav.tools":"Tools","language.label":"Language","language.english":"EN","language.chinese":"中文","language.switchToEnglish":"Switch to English","language.switchToChinese":"切换到中文","common.add":"Add","common.cancel":"Cancel","common.close":"Close","common.save":"Save","common.delete":"Delete","common.edit":"Edit","common.select":"Select","common.search":"Search","common.loading":"Loading...","common.refresh":"Refresh","common.connected":"Connected","common.installed":"Installed","common.manual":"Manual","common.missing":"Missing","common.current":"Current","common.unknown":"unknown","common.active":"Active","common.bind":"Bind {name}","common.recharge":"Recharge","common.notAvailable":"{name} is not available in Manual mode.","overview.providerMode.label":"Routing mode","overview.providerMode.manualValue":"Manual","overview.providerMode.autoValue":"Auto","overview.providerMode.manualStats":"{count} node{plural} · {policy}","overview.providerMode.manualNote":"Uses your node list only","overview.providerMode.autoStats":"{range} · {models} model{modelPlural} · {sellers} node{sellerPlural}","overview.providerMode.autoPolicy":"{scorer} · {payment}","overview.providerMode.autoPolicyNoPayment":"{scorer}","overview.providerMode.recommendedRange":"Recommended","overview.providerMode.customRange":"Custom","overview.providerMode.fallbackPolicy":"fallback","overview.providerMode.fixedProvider":"fixed node","overview.providerMode.balancedScorer":"balanced","overview.providerMode.speedScorer":"speed first","overview.providerMode.costScorer":"cost first","tools.title":"App connections","tools.connectedSummary":"{configured}/{total} connected","tools.refreshStatus":"Refresh tool status","tools.oneClick":"One-click setup","tools.tool":"Tool","tools.protocol":"Protocol","tools.status":"Status","tools.actions":"Actions","tools.disconnect":"Disconnect","tools.connect":"Connect","tools.getApp":"Get app","tools.importCcSwitch":"Import {name} provider with CC Switch","tools.disconnectFrom":"Disconnect TokenBuddy from {name}","tools.connectTo":"Connect {name} to TokenBuddy","tools.manualSetup":"Compatible agents","tools.appsCount":"{count} apps","tools.searchApps":"Search apps","tools.searchAppsPlaceholder":"Search apps or protocols","tools.noMatchingApp":"No matching app","tools.configuration":"Configuration","tools.openAiBaseUrl":"OpenAI base URL","tools.anthropicBaseUrl":"Anthropic base URL","tools.apiKey":"API key","tools.copyFailed":"Copy failed. Select the value and copy it manually.","tools.fileChangesApplied":"{name}: {count} file change{plural} applied.","tools.noSnapshot":"{name}: no TokenBuddy install snapshot was found.","tools.noCompatibleModel":"{name}: no {protocol} compatible model is available.","tools.disconnectedChanges":"{name}: disconnected with {count} file change{plural}.","tools.restoredChanges":"{name}: restored {count} file change{plural}."},zh:{"nav.overview":"看板","nav.routing":"规则","nav.ledger":"账本","nav.tools":"工具","language.label":"语言","language.english":"EN","language.chinese":"中文","language.switchToEnglish":"Switch to English","language.switchToChinese":"切换到中文","common.add":"添加","common.cancel":"取消","common.close":"关闭","common.save":"保存","common.delete":"删除","common.edit":"编辑","common.select":"选择","common.search":"搜索","common.loading":"加载中...","common.refresh":"刷新","common.connected":"已连接","common.installed":"已安装","common.manual":"手动","common.missing":"未安装","common.current":"当前","common.unknown":"未知","common.active":"已启用","common.bind":"绑定 {name}","common.recharge":"充值","common.notAvailable":"{name} 在手动模式下不可用。","overview.providerMode.label":"路由模式","overview.providerMode.manualValue":"手动","overview.providerMode.autoValue":"自动","overview.providerMode.manualStats":"{count} 个节点 · {policy}","overview.providerMode.manualNote":"只使用你的节点列表","overview.providerMode.autoStats":"{range} · {models} 个模型 · {sellers} 个节点","overview.providerMode.autoPolicy":"{scorer} · {payment}","overview.providerMode.autoPolicyNoPayment":"{scorer}","overview.providerMode.recommendedRange":"推荐列表","overview.providerMode.customRange":"自定义列表","overview.providerMode.fallbackPolicy":"失败切换","overview.providerMode.fixedProvider":"固定节点","overview.providerMode.balancedScorer":"均衡策略","overview.providerMode.speedScorer":"速度优先","overview.providerMode.costScorer":"成本优先","tools.title":"应用连接","tools.connectedSummary":"{configured}/{total} 已连接","tools.refreshStatus":"刷新工具状态","tools.oneClick":"一键配置","tools.tool":"工具","tools.protocol":"协议","tools.status":"状态","tools.actions":"操作","tools.disconnect":"断开","tools.connect":"连接","tools.getApp":"获取应用","tools.importCcSwitch":"用 CC Switch 导入 {name} provider","tools.disconnectFrom":"断开 TokenBuddy 与 {name} 的连接","tools.connectTo":"将 {name} 连接到 TokenBuddy","tools.manualSetup":"可以兼容的其它 agent","tools.appsCount":"{count} 个应用","tools.searchApps":"搜索应用","tools.searchAppsPlaceholder":"搜索应用或协议","tools.noMatchingApp":"没有匹配应用","tools.configuration":"配置","tools.openAiBaseUrl":"OpenAI Base URL","tools.anthropicBaseUrl":"Anthropic Base URL","tools.apiKey":"API Key","tools.copyFailed":"复制失败,请手动选中内容复制。","tools.fileChangesApplied":"{name}: 已写入 {count} 个文件变更。","tools.noSnapshot":"{name}: 没有找到 TokenBuddy 安装快照。","tools.noCompatibleModel":"{name}: 没有可用的 {protocol} 兼容模型。","tools.disconnectedChanges":"{name}: 已断开,处理了 {count} 个文件变更。","tools.restoredChanges":"{name}: 已恢复 {count} 个文件变更。"}},ib=S.createContext(null);function mN({children:a}){const[l,o]=S.useState(()=>{if(typeof window>"u")return"en";const u=window.localStorage.getItem(Ax);return u==="zh"||u==="en"?u:"en"});S.useEffect(()=>{document.documentElement.lang=l==="zh"?"zh-CN":"en",window.localStorage.setItem(Ax,l)},[l]),S.useEffect(()=>{if(typeof document>"u")return;const u=()=>xN(l);u();const f=new MutationObserver(()=>{window.requestAnimationFrame(u)});return f.observe(document.body,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["placeholder","title","aria-label","alt"]}),()=>f.disconnect()},[l]);const s=S.useMemo(()=>({language:l,setLanguage:o,t:(u,f)=>hN(Ex[l][u]??Ex.en[u],f)}),[l]);return i.jsx(ib.Provider,{value:s,children:a})}function hr(){const a=S.useContext(ib);if(!a)throw new Error("useI18n must be used inside I18nProvider");return a}function hN(a,l){return l?a.replace(/\{(\w+)\}/g,(o,s)=>{const u=l[s];return u===void 0?o:String(u)}):a}const sb=[["Router","路由器"],["Today requests","今日请求"],["Inference cost","推理成本"],["Total tokens","总 Token"],["Models / Sellers","模型 / Seller"],["Token usage","Token 用量"],["Daily model input and output usage lines","每日模型输入输出用量折线图"],["Daily inference cost curve","每日推理成本曲线"],["Recent model routes","最近模型路由"],["Details","详情"],["Model","模型"],["Seller","Seller"],["Token","Token"],["In","输入"],["Out","输出"],["in","输入"],["out","输出"],["TTFT","首 token"],["Tok/s","Token/s"],["Disc","折扣"],["Last switch","最近切换"],["No model traffic yet.","暂无模型流量。"],["Open Router","打开路由器"],["Open Today requests","打开今日请求"],["Open Inference cost","打开推理成本"],["Open Total tokens","打开总 Token"],["Open Models / Sellers","打开模型 / Seller"],["requests","次请求"],["sellers","个 Seller"],["Inference cost","推理成本"],["30 day inference cost","30 天推理成本"],["Daemon","守护进程"],["Proxy","代理"],["Control","控制台"],["TokenBuddy update","TokenBuddy 更新"],["Updating","更新中"],["Update","更新"],["Installed. tb-proxyd restart is in progress.","已安装,tb-proxyd 正在重启。"],["Installed. Restart needs attention.","已安装,需要检查重启。"],["Update failed.","更新失败。"],["TokenBuddy update available","TokenBuddy 有可用更新"],["Inference tokens","推理 Token"],["Image generations","图片生成"],["Token purchase spend","Token 购买支出"],["Today","今天"],["This week","本周"],["This month","本月"],["Total","总计"],["Usage details","用量明细"],["Inferences","推理"],["Purchases","购买"],["Search request, model, seller...","搜索请求、模型、Seller..."],["Search purchase, method, seller...","搜索购买、方式、Seller..."],["Search model, seller...","搜索模型、Seller..."],["Search seller...","搜索 Seller..."],["Status","状态"],["Method","方式"],["All status","全部状态"],["All model","全部模型"],["All method","全部方式"],["Ledger data could not be loaded. The local daemon may be offline or missing ledger endpoints.","账本数据加载失败。本地 daemon 可能离线或缺少账本接口。"],["TIME","时间"],["REQ","请求"],["MODEL","模型"],["SELLER","Seller"],["TOKENS","Token"],["USAGE","用量"],["COST","成本"],["TOTAL","总计"],["STATUS","状态"],["When","时间"],["Input","输入"],["Output","输出"],["Cache hit","缓冲命中"],["Purchase","购买"],["Payment method","支付方式"],["Spent","花费"],["Credit","额度"],["Request ID","请求 ID"],["Created","创建时间"],["Endpoint","端点"],["Route","路由"],["Fallback chain","Fallback 链路"],["Upstream status","上游状态"],["Input / output tokens","输入 / 输出 Token"],["Billed","计费"],["Images","图片"],["Balance after","之后余额"],["Prompt hash","Prompt Hash"],["Response hash","Response Hash"],["Price version","价格版本"],["Purchase ID","购买 ID"],["Completed","完成时间"],["Payment reference","支付引用"],["Credit micros","额度 micros"],["Currency","币种"],["No matching inference records","没有匹配的推理记录"],["No matching purchase records","没有匹配的购买记录"],["Adjust the query or filters to inspect another slice of the local ledger.","调整搜索或筛选条件以查看本地账本的其他数据。"],["Rows","行数"],["Showing","显示"],["of","共"],["First page","第一页"],["Previous page","上一页"],["Next page","下一页"],["Last page","最后一页"],["Go to","跳转到"],["Go to page","跳转到页面"],["page","页"],["Manual","手动"],["Auto","自动"],["Manual provider mode","手动 Provider 模式"],["Auto provider mode","自动 Provider 模式"],["Loading routing data...","正在加载路由数据..."],["Some routing data could not be loaded. Check that tb-proxyd is running.","部分路由数据加载失败,请确认 tb-proxyd 正在运行。"],["Custom providers","自定义 Provider"],["Provider","Provider"],["Models","模型"],["Last call","最后调用"],["Actions","操作"],["No custom providers yet.","还没有自定义 Provider。"],["Add provider","添加 Provider"],["Fallback on error","失败自动切换"],["Cost first","成本优先"],["Multi-provider concurrent calls","多供应商并发调用"],["Use providers by table order when the current provider fails.","当前 Provider 失败时,按表格顺序切换。"],["Move up","上移"],["Edit","编辑"],["Current","当前"],["Payment route","支付路由"],["Models","模型"],["Choose at least one model.","至少选择一个模型。"],["Models could not be saved.","模型保存失败。"],["Seller list","Seller 列表"],["Loading providers...","正在加载 Provider..."],["Refreshing","刷新中"],["Recommended","推荐"],["Custom","自定义"],["Select","选择"],["Select sellers","选择 Seller"],["Switch to Custom to select sellers","切换到自定义后选择 Seller"],["Discount","折扣"],["No custom sellers selected.","还没有选择自定义 Seller。"],["No warmed sellers available for these models.","这些模型暂无预热 Seller。"],["Routing priority","路由优先级"],["Balanced","均衡"],["Speed","速度"],["Cost","成本"],["Prefers lower TTFT and stronger throughput.","优先选择更低首 token 延迟和更高吞吐。"],["Prefers lower effective cost among healthy providers.","在健康 Provider 中优先选择更低成本。"],["Balances reliability, speed, and cost.","平衡可靠性、速度和成本。"],["Current routes","当前路由"],["PROVIDER","Provider"],["STRATEGY","策略"],["LAST CALL","最后调用"],["Preview","预览"],["Ready","就绪"],["healthy","健康"],["configured","已配置"],["settled","已结算"],["estimated","预估"],["ok","正常"],["online","在线"],["offline","离线"],["degraded","降级"],["Active","已启用"],["Manual fallback","手动 fallback"],["Manual direct","手动直连"],["Auto custom","自动自定义"],["Auto fixed","自动固定"],["Auto cost","自动成本优先"],["Auto speed","自动速度优先"],["Auto balanced","自动均衡"],["Add models","添加模型"],["Search models or payment","搜索模型或支付方式"],["Payment","支付"],["Sellers","Seller"],["No models found.","没有找到模型。"],["Selected","已选择"],["Clear","清空"],["No model selected.","未选择模型。"],["Cancel","取消"],["Save and close","保存并关闭"],["Save selected models","保存已选模型"],["Select custom sellers","选择自定义 Seller"],["Search sellers, payment, notes","搜索 Seller、支付方式或备注"],["Service fee","服务费"],["No sellers found.","没有找到 Seller。"],["No seller selected.","未选择 Seller。"],["Name","名称"],["Base URL","Base URL"],["API key","API key"],["My provider","我的 Provider"],["Leave blank to keep existing key","留空以保留现有 key"],["Probe required before adding.","添加前必须探测接口。"],["Probe required when replacing the key.","替换 key 时必须重新探测。"],["Reading model list...","正在读取模型列表..."],["Model list request failed.","模型列表请求失败。"],["Probe new key","探测新 key"],["Probe models","探测模型"],["Save","保存"],["Add","添加"],["Close","关闭"],["Search models","搜索模型"],["View models","查看模型"],["Delete","删除"],["JD wallet","京东钱包"],["Default wallet","默认钱包"],["Configured","已配置"],["Not bound","未绑定"],["Bound","已绑定"],["Available","可用"],["Recharge","充值"],["Activate","激活"],["ClawTip wallet QR","ClawTip 钱包二维码"],["Close payment modal","关闭支付弹窗"],["Scan with JD app to view wallet balance or recharge.","使用京东 App 扫码查看余额或充值。"],["Load the fixed ClawTip recharge QR from static assets.","加载静态资源中的固定 ClawTip 充值二维码。"],["Reuse the tb init ClawTip flow and wait for wallet binding.","复用 tb init 的 ClawTip 流程并等待钱包绑定。"],["Generating ClawTip QR...","正在生成 ClawTip 二维码..."],["QR image unavailable","二维码不可用"],["Wallet","钱包"],["Order","订单"],["Config","配置"],["Device","设备"],["bound","已绑定"],["waiting","等待中"],["Wallet bound. Closing...","钱包已绑定,正在关闭..."],["Scan with JD app. TokenBuddy is waiting for the local wallet config.","使用京东 App 扫码。TokenBuddy 正在等待本地钱包配置。"],["No recharge link is available from the daemon. Run tb init to bind this payment method.","daemon 没有返回充值链接。请运行 tb init 绑定该支付方式。"],["Scan with JD app to view ClawTip wallet balance","使用京东 App 查看 ClawTip 钱包余额"],["Scan with JD app to view wallet balance","使用京东 App 查看钱包余额"],["activation","激活"],["recharge","充值"],["QR code","二维码"],["选择模型","Select models"],["默认模型","Default models"],["绑定钱包","Bind wallet"],["支付方式","Payment method"],["配置策略","Configure strategy"],["路由规则","Routing rules"],["配置工具","Configure tools"],["终端接入","Tool access"],["全自动","Full auto"],["自动选择可用供应商。","Automatically select available providers."],["固定供应商组","Fixed provider set"],["在指定供应商组内切换。","Switch within selected providers."],["固定供应商","Fixed provider"],["始终使用指定供应商。","Always use the selected provider."],["平衡模式","Balanced"],["综合速度、价格、健康度、余额。","Balance speed, price, health, and balance."],["速度优先","Speed first"],["优先选择更快、吞吐量更高供应商。","Prefer faster providers with higher throughput."],["成本优先","Cost first"],["优先选择更低成本供应商。","Prefer lower-cost providers."],["微信支付入口预留","WeChat Pay entry reserved"],["代理支付入口预留","Agent payment entry reserved"],["USDC 钱包入口预留","USDC wallet entry reserved"],["浏览器已经允许直接安装 TokenBuddy。","The browser is ready to install TokenBuddy."],["TokenBuddy 桌面应用已安装。","TokenBuddy desktop app has been installed."],["关注模型已保存。后续工具配置会优先参考这些模型。","Focus models saved. Tool setup will prefer these models."],["请选择一个固定供应商。","Select a fixed provider."],["请至少选择一个供应商。","Select at least one provider."],["供应商路由策略已保存。","Provider routing strategy saved."],["初始化步骤","Initialization steps"],["模型访问","Model access"],["默认和高频模型","Default and frequent models"],["下一步","Next"],["上一步","Back"],["完成","Finish"],["保存","Save"],["添加模型","Add models"],["推荐模型","Recommended models"],["直接勾选","Quick select"],["搜索添加","Search and add"],["全部模型","All models"],["选择可能使用到的模型","Choose models you may use"],["搜索平台全部模型...","Search all platform models..."],["关闭模型选择","Close model picker"],["完成选择模型","Done selecting models"],["模型已选","Models selected"],["保存关注模型","Save focus models"],["默认供应商策略","Default provider strategy"],["选择支付方式","Choose payment method"],["生成后使用京东 App 扫码绑定。","Scan with JD app after the QR is generated."],["配置终端工具","Configure client tools"],["验证网关","Verify gateway"],["初始化完成","Initialization complete"],["桌面应用","Desktop app"],["安装入口","Install entry"],["地址栏或浏览器菜单。","Address bar or browser menu."],["应用名称","App name"],["本地服务","Local service"],["继续由 tb-proxyd 提供。","Still served by tb-proxyd."],["路由策略已选择","Routing strategy selected"],["状态","Status"],["供应商","Provider"],["价格","Price"],["折扣","Discount"],["响应","Latency"],["加入本次写入","Include in this setup"],["移出本次写入","Remove from this setup"],["写入配置","Write config"],["生成预览","Generate preview"],["安装应用","Install app"]],ob=sb.filter(([a])=>!db(a)),pN=sb.filter(([a])=>db(a)),cb=new Map(ob),ub=new Map([...ob.map(([a,l])=>[l,a]),...pN]);function vN(a,l){return am(a,l==="zh"?cb:ub,l)}function xN(a){const l=a==="zh"?cb:ub;gN(document.body,l,a)}function gN(a,l,o){var f;const s=document.createTreeWalker(a,NodeFilter.SHOW_TEXT,{acceptNode(p){var v;const h=p.parentElement;return!h||["SCRIPT","STYLE","NOSCRIPT","TEXTAREA"].includes(h.tagName)||h.closest("[data-no-translate='true']")||!((v=p.textContent)!=null&&v.trim())?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),u=[];for(;s.nextNode();)u.push(s.currentNode);for(const p of u){const h=am(p.textContent??"",l,o);h!==p.textContent&&(p.textContent=h)}a instanceof Element&&kx(a,l,o);for(const p of Array.from(((f=a.querySelectorAll)==null?void 0:f.call(a,"[placeholder], [title], [aria-label], [alt]"))??[]))kx(p,l,o)}function kx(a,l,o){for(const s of["placeholder","title","aria-label","alt"]){if(a.closest("[data-no-translate='true']"))return;const u=a.getAttribute(s);if(!u)continue;const f=am(u,l,o);f!==u&&a.setAttribute(s,f)}}function am(a,l,o){var h,v;const s=((h=a.match(/^\s*/))==null?void 0:h[0])??"",u=((v=a.match(/\s*$/))==null?void 0:v[0])??"",f=a.trim();if(!f)return a;const p=l.get(f);if(p)return`${s}${p}${u}`;if(o==="zh"){const x=f.match(/^Selected (\d+)$/);if(x)return`${s}已选择 ${x[1]}${u}`;const y=f.match(/^(\d+) selected$/);if(y)return`${s}已选择 ${y[1]}${u}`;const g=f.match(/^Page (\d+)$/);if(g)return`${s}第 ${g[1]} 页${u}`;const j=f.match(/^(\d+) of (\d+) providers$/);if(j)return`${s}${j[1]} / ${j[2]} 个 Provider${u}`;const N=f.match(/^(\d+) of (\d+) models$/);if(N)return`${s}${N[1]} / ${N[2]} 个模型${u}`;const T=f.match(/^(\d+) purchases$/);if(T)return`${s}${T[1]} 次购买${u}`;const E=f.match(/^(\d+) requests$/);if(E)return`${s}${E[1]} 次请求${u}`;const D=f.match(/^(\d+) sellers$/);if(D)return`${s}${D[1]} 个 Seller${u}`;const R=f.match(/^In ([\d,]+) \/ Out ([\d,]+)$/);if(R)return`${s}输入 ${R[1]} / 输出 ${R[2]}${u}`;const L=f.match(/^(.+) total$/);if(L)return`${s}总计 ${L[1]}${u}`;const H=f.match(/^Open (.+)$/);if(H)return`${s}打开 ${H[1]}${u}`;const P=f.match(/^Activate (.+)$/);if(P)return`${s}激活 ${P[1]}${u}`;const G=f.match(/^Recharge (.+)$/);if(G)return`${s}充值 ${G[1]}${u}`;const Q=f.match(/^Bind (.+)$/);if(Q)return`${s}绑定 ${Q[1]}${u}`;const q=f.match(/^Remove (.+)$/);if(q)return`${s}移除 ${q[1]}${u}`;const W=f.match(/^View models for (.+)$/);if(W)return`${s}查看 ${W[1]} 的模型${u}`;const I=f.match(/^Move (.+) up$/);if(I)return`${s}上移 ${I[1]}${u}`;const ne=f.match(/^Edit provider · (.+)$/);if(ne)return`${s}编辑 Provider · ${ne[1]}${u}`;const F=f.match(/^Models · (.+)$/);if(F)return`${s}模型 · ${F[1]}${u}`;const J=f.match(/^(.+) ledger records, ([\d,]+) records$/);if(J)return`${s}${J[1]}账本记录,${J[2]} 条记录${u}`;const se=f.match(/^Input tokens: (.+)$/);if(se)return`${s}输入 Token: ${se[1]}${u}`;const ge=f.match(/^Output tokens: (.+)$/);if(ge)return`${s}输出 Token: ${ge[1]}${u}`;const fe=f.match(/^Time to first token: (.+)$/);if(fe)return`${s}首 token 延迟: ${fe[1]}${u}`;const O=f.match(/^Tokens per second: (.+)$/);if(O)return`${s}每秒 Token: ${O[1]}${u}`;const te=f.match(/^Seller discount: (.+)$/);if(te)return`${s}Seller 折扣: ${te[1]}${u}`;const re=f.match(/^Last seller switch: (.+)$/);if(re)return`${s}最近 Seller 切换: ${re[1]}${u}`;const Z=f.match(/^(.+) (recharge|activation) QR code$/);if(Z)return`${s}${Z[1]} ${Z[2]==="recharge"?"充值":"激活"}二维码${u}`}else{const x=f.match(/^已选择 (\d+)$/);if(x)return`${s}Selected ${x[1]}${u}`;const y=f.match(/^第 (\d+) 页$/);if(y)return`${s}Page ${y[1]}${u}`;const g=f.match(/^(\d+) \/ (\d+) 个 Provider$/);if(g)return`${s}${g[1]} of ${g[2]} providers${u}`;const j=f.match(/^(\d+) \/ (\d+) 个模型$/);if(j)return`${s}${j[1]} of ${j[2]} models${u}`;const N=f.match(/^总计 (.+)$/);if(N)return`${s}${N[1]} total${u}`;const T=f.match(/^(\d+) 个 Seller$/);if(T)return`${s}${T[1]} sellers${u}`;const E=f.match(/^输入 ([\d,]+) \/ 输出 ([\d,]+)$/);if(E)return`${s}In ${E[1]} / Out ${E[2]}${u}`;const D=f.match(/^打开 (.+)$/);if(D)return`${s}Open ${D[1]}${u}`;const R=f.match(/^移除 (.+)$/);if(R)return`${s}Remove ${R[1]}${u}`;const L=f.match(/^查看 (.+) 的模型$/);if(L)return`${s}View models for ${L[1]}${u}`;const H=f.match(/^上移 (.+)$/);if(H)return`${s}Move ${H[1]} up${u}`}return a}function db(a){return/[\u4e00-\u9fff]/.test(a)}function fb({inferences:a,modelsResponse:l,sellersResponse:o,manualProviders:s,previewPlan:u,activeModelId:f}){const p=SN(l,o,s),h=[...a].sort(MN),v=new Map,x=new Map;let y=0,g=0,j=0;for(const T of h){const E=T.modelId||Me,D=T.sellerKey||Me,R=T.billingUnit==="images"||T.endpoint==="/v1/images/generations",L=R?0:tn(T.promptTokens)??0,H=R?0:tn(T.completionTokens)??0,P=L+H,G=tn(T.settledUsdMicros)??tn(T.billedMicros)??0;y+=1,g+=P,j+=G;const Q=v.get(E)??jN(E);Q.entries.push(T),Q.requestCount+=1,Q.inputTokens+=L,Q.outputTokens+=H,Q.totalSpendMicros+=G,Q.touchedSellers.add(D),Q.sellerCounts.set(D,(Q.sellerCounts.get(D)??0)+1),Q.fallbackCount+=tn(T.fallbackCount)??0;const q=tn(T.ttftMs);q!==void 0&&(Q.ttftTotal+=q,Q.ttftCount+=1);const W=tn(T.durationMs);W!==void 0&&(Q.durationTotal+=W,Q.durationCount+=1);const I=tn(T.avgOutputTokensPerSecond);I!==void 0&&(Q.outputSpeedTotal+=I,Q.outputSpeedCount+=1),v.set(E,Q);const ne=x.get(D)??{requestCount:0,totalTokens:0};ne.requestCount+=1,ne.totalTokens+=P,x.set(D,ne)}const N=Array.from(v.values()).map(T=>bN(T,x,p)).sort(CN);if(N.length===0){const T=yN(f,u,p);T&&N.push(T)}return{rows:N,totalRequests:y,totalTokens:g,totalSpendMicros:j}}function bN(a,l,o){const s=a.entries[a.entries.length-1],u=(s==null?void 0:s.sellerKey)||Me,f=mb(u,o),p=a.sellerCounts.get(u)??0,h=l.get(u),v=o.modelsBySellerAndModel.get(`${u}\0${a.modelId}`);return{source:"ledger",modelId:a.modelId,currentSellerId:u,currentSellerName:f.name,currentSellerUrl:f.url,currentSellerStatus:f.status,routeState:f.routeState,currentSellerPaymentMethods:f.paymentMethods,sellerDiscount:f.discount,sellerServiceFee:f.serviceFee,sellerModelCount:f.modelCount,requestCount:a.requestCount,currentSellerModelRequests:p,currentSellerRequests:(h==null?void 0:h.requestCount)??p,inputTokens:a.inputTokens,outputTokens:a.outputTokens,totalTokens:a.inputTokens+a.outputTokens,currentSellerTokens:(h==null?void 0:h.totalTokens)??0,totalSpendMicros:a.totalSpendMicros,tokensPerSecond:Pd(a.outputSpeedTotal,a.outputSpeedCount),avgTtftMs:Pd(a.ttftTotal,a.ttftCount),avgDurationMs:Pd(a.durationTotal,a.durationCount),lastTtftMs:tn(s==null?void 0:s.ttftMs),lastDurationMs:tn(s==null?void 0:s.durationMs),selectedAt:NN(a.entries,u),lastSellerSwitchAt:wN(a.entries),lastAccessAt:s==null?void 0:s.createdAt,lastRequestId:s==null?void 0:s.requestId,lastStatus:s==null?void 0:s.status,routeReason:s==null?void 0:s.routeReason,upstreamStatus:s==null?void 0:s.upstreamStatus,fallbackCount:a.fallbackCount,falloverChain:(s==null?void 0:s.falloverChain)??[],touchedSellerCount:a.touchedSellers.size,inputPriceMicrosPer1m:v==null?void 0:v.inputPriceMicrosPer1m,outputPriceMicrosPer1m:v==null?void 0:v.outputPriceMicrosPer1m}}function yN(a,l,o){var v,x,y;const s=(v=l==null?void 0:l.routes)==null?void 0:v[0];if(!s||!a)return;const u=mb(s.seller.id,o,s),f=tn(s.metrics.ttftMs)??tn(s.metrics.avgLatencyMs),p=tn(s.metrics.avgInferenceMs),h=o.modelsBySellerAndModel.get(`${s.seller.id}\0${a}`);return{source:"preview",modelId:a,currentSellerId:s.seller.id,currentSellerName:u.name,currentSellerUrl:u.url,currentSellerStatus:u.status,routeState:s.metrics.routeState??u.routeState,currentSellerPaymentMethods:u.paymentMethods,sellerDiscount:u.discount,sellerServiceFee:u.serviceFee,sellerModelCount:u.modelCount,requestCount:0,currentSellerModelRequests:0,currentSellerRequests:0,inputTokens:0,outputTokens:0,totalTokens:0,currentSellerTokens:0,totalSpendMicros:0,tokensPerSecond:tn(s.metrics.avgTokensPerSecond),avgTtftMs:f,avgDurationMs:p,lastTtftMs:f,lastDurationMs:p,routeReason:l.reason??l.sourceReason??"Preview route",fallbackCount:0,falloverChain:((x=l.routes)==null?void 0:x.map(g=>g.seller.id))??[],touchedSellerCount:((y=l.routes)==null?void 0:y.length)??1,inputPriceMicrosPer1m:h==null?void 0:h.inputPriceMicrosPer1m,outputPriceMicrosPer1m:h==null?void 0:h.outputPriceMicrosPer1m}}function SN(a,l,o){const s=new Map;for(const u of(a==null?void 0:a.data)??[]){const f=s.get(u.sellerId)??new Set;f.add(u.id),s.set(u.sellerId,f)}return{registryById:new Map(((l==null?void 0:l.sellers)??[]).map(u=>[u.id,u])),catalogById:new Map(((a==null?void 0:a.sellers)??[]).map(u=>[u.id,u])),manualProvidersById:new Map((o??[]).map(u=>[u.id,u])),modelsBySellerAndModel:new Map(((a==null?void 0:a.data)??[]).map(u=>[`${u.sellerId}\0${u.id}`,u])),modelCountsBySellerId:new Map(Array.from(s.entries()).map(([u,f])=>[u,f.size]))}}function jN(a){return{modelId:a,entries:[],sellerCounts:new Map,touchedSellers:new Set,requestCount:0,inputTokens:0,outputTokens:0,totalSpendMicros:0,ttftTotal:0,ttftCount:0,durationTotal:0,durationCount:0,outputSpeedTotal:0,outputSpeedCount:0,fallbackCount:0}}function NN(a,l){var o;for(let s=a.length-1;s>=0;s-=1){const u=a[s];if(u.sellerKey!==l)return(o=a[s+1])==null?void 0:o.createdAt;if(s===0)return u.createdAt}}function wN(a){let l;for(let o=1;o<a.length;o+=1)a[o].sellerKey!==a[o-1].sellerKey&&(l=a[o].createdAt);return l}function mb(a,l,o){const s=l.catalogById.get(a),u=l.registryById.get(a),f=l.manualProvidersById.get(a),p=(o==null?void 0:o.metrics.discountRatio)??(s==null?void 0:s.discountRatio);return{name:TN((o==null?void 0:o.seller.name)??(s==null?void 0:s.name)??(u==null?void 0:u.name)??(f==null?void 0:f.name)??a),url:(o==null?void 0:o.seller.url)??(s==null?void 0:s.url)??(u==null?void 0:u.url)??(f==null?void 0:f.baseUrl),status:(s==null?void 0:s.status)??(u==null?void 0:u.status)??(f==null?void 0:f.status)??Me,routeState:(o==null?void 0:o.metrics.routeState)??(s==null?void 0:s.routeState),paymentMethods:(s==null?void 0:s.paymentMethods)??(u==null?void 0:u.paymentMethods)??(o==null?void 0:o.seller.paymentMethods)??[],discount:Wf(p),serviceFee:Jj(s==null?void 0:s.serviceFeeRatio),modelCount:(s==null?void 0:s.modelCount)??l.modelCountsBySellerId.get(a)}}function MN(a,l){return uc(a.createdAt)-uc(l.createdAt)}function CN(a,l){return uc(l.lastAccessAt)-uc(a.lastAccessAt)}function uc(a){if(!a)return 0;const l=new Date(a).getTime();return Number.isNaN(l)?0:l}function Pd(a,l){return l>0?a/l:void 0}function tn(a){return Number.isFinite(a)?a:void 0}function TN(a){var l;return((l=a.split("(")[0])==null?void 0:l.trim())||a}function Rx(){var be,Xe,Oe,Nt,dt,yn,Ie,Qe,Gt,an,ln,Bt,At,rn,sn,Pn,la,at,Qa,Pa,Sn,qt,Ka,ra,Ya,Ga,on,ft,$t,mt,ia;const{t:a}=hr(),[l,o]=S.useState(null),[s,u]=A2(),f=S.useRef(null),p=If(),h=Jg(),v=Ig(),x=Wg(),y=Zf(),g=Vf(),j=Xf(),N=Ff(),T=g.refetch,E=j.reset,D=vc(),R=Jf(),L=ks(),H=Yj(),P=Gj(),G=((be=D.data)==null?void 0:be.inferences)??[],Q=((Xe=g.data)==null?void 0:Xe.payments)??[],q=new Set((((Oe=L.data)==null?void 0:Oe.data)??[]).map(Ue=>Ue.id)).size,W=((Nt=R.data)==null?void 0:Nt.sellers.length)??((yn=(dt=L.data)==null?void 0:dt.sellers)==null?void 0:yn.length)??0,I=S.useMemo(()=>GN(G),[G]),ne=S.useMemo(()=>tb(Q,G),[G,Q]),F=S.useMemo(()=>{var Ue;return fb({inferences:G,manualProviders:(Ue=y.data)==null?void 0:Ue.providers,modelsResponse:L.data,sellersResponse:R.data})},[G,(Ie=y.data)==null?void 0:Ie.providers,L.data,R.data]),se=Q.some(Ue=>ta(Ue.method)==="clawtip"&&(Ue.enabled||lb(Ue.config,"walletConfigPresent")))||((Qe=j.data)==null?void 0:Qe.walletConfigPresent)===!0,ge=((Gt=p.data)==null?void 0:Gt.status)==="running"&&!p.isError,fe=new Date().toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),O=ne.find(Ue=>Q.some(bt=>bt.method===Ue.method&&bt.isDefault))??ne.find(Ue=>Ue.status==="Bound"),te=((an=v.data)==null?void 0:an.active)??((ln=v.data)==null?void 0:ln.mode)??((Bt=p.data)==null?void 0:Bt.selectionMode),re=((At=y.data)==null?void 0:At.providers.length)??0,Z=new Set((((rn=y.data)==null?void 0:rn.providers)??[]).flatMap(Ue=>Ue.models)).size,he=((sn=x.data)==null?void 0:sn.config.range)??EN((Pn=h.data)==null?void 0:Pn.strategy.mode),w=((la=x.data)==null?void 0:la.config.modelIds.length)??0,$=he==="custom"?((at=x.data)==null?void 0:at.config.sellerIds.length)??((Pa=(Qa=h.data)==null?void 0:Qa.strategy.sellerIds)==null?void 0:Pa.length)??0:W,V=te==="manual"?re:$||W||re,le=te==="manual"?Z:w||q||Z,pe=AN({activeMode:te,autoModelCount:w,autoRange:he,autoSellerCount:$,manualProviderCount:re,manualPolicy:(Sn=y.data)==null?void 0:Sn.routing.policy,paymentName:O==null?void 0:O.name,scorer:((qt=x.data)==null?void 0:qt.config.scorer)??((Ka=h.data)==null?void 0:Ka.strategy.scorer)??((ra=p.data)==null?void 0:ra.sellerRoutingScorer),t:a}),ve=()=>{o(null),j.reset(),N.reset()};return S.useEffect(()=>{const Ue=s.get("activatePayment");if(!Ue||ta(Ue)!=="clawtip"||f.current===Ue)return;f.current=Ue,o({kind:"activate",method:"clawtip"}),j.mutate();const bt=new URLSearchParams(s);bt.delete("activatePayment"),u(bt,{replace:!0})},[j,s,u]),S.useEffect(()=>{if((l==null?void 0:l.kind)!=="activate"||ta(l.method)!=="clawtip"||se)return;const Ue=window.setInterval(()=>{T()},1500);return()=>window.clearInterval(Ue)},[se,l==null?void 0:l.kind,l==null?void 0:l.method,T]),S.useEffect(()=>{(l==null?void 0:l.kind)==="activate"&&ta(l.method)==="clawtip"&&se&&(o(null),E())},[se,l==null?void 0:l.kind,l==null?void 0:l.method,E]),i.jsxs("div",{className:"min-w-0 overflow-x-hidden space-y-3",children:[i.jsx(_N,{currentVersion:(Ya=H.data)==null?void 0:Ya.currentVersion,latestVersion:(Ga=H.data)==null?void 0:Ga.latestVersion,updateAvailable:(on=H.data)==null?void 0:on.updateAvailable,running:P.isPending,result:P.data,error:P.error,onUpdate:()=>P.mutate()}),i.jsxs("section",{className:"grid grid-cols-2 gap-2.5 md:grid-cols-3 xl:grid-cols-6",children:[i.jsx(qN,{icon:i.jsx(Fg,{className:"size-4"}),...pe}),i.jsx(Yd,{to:"/ledger",icon:i.jsx(Yf,{className:"size-4"}),label:"Today requests",value:Se(I.todayRequestCount),note:`${Se(I.totalRequestCount)} total`,tone:"requests"}),i.jsx(Yd,{to:"/ledger",icon:i.jsx(gs,{className:"size-4"}),label:"Inference cost",value:Ba(I.todaySpendMicros,{digits:4}),note:`${Ba(I.totalSpendMicros,{digits:4})} total`,tone:"spend"}),i.jsx(BN,{inputTokens:I.inputTokens,outputTokens:I.outputTokens}),i.jsx(Yd,{to:"/routing",icon:i.jsx(DS,{className:"size-4"}),label:"Nodes",value:Se(V),note:`${Se(le)} models`,tone:"inventory"})]}),i.jsx("section",{className:"grid min-w-0 gap-3",children:i.jsxs("div",{className:"min-w-0 space-y-3",children:[i.jsx(ON,{rows:F.rows}),i.jsxs(_t,{className:"p-3",children:[i.jsxs("div",{className:"mb-2 flex min-w-0 flex-col gap-2",children:[i.jsx("div",{className:"flex min-w-0 flex-wrap items-center justify-between gap-2",children:i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(wj,{className:"size-4 shrink-0 text-[var(--color-purple)]"}),i.jsx("h2",{className:"truncate text-[1rem] font-semibold text-[var(--color-ink)]",children:"Token usage"})]})}),i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 text-[0.7rem] text-[var(--color-muted)]",children:[I.modelUsage.map(Ue=>i.jsx(PN,{model:Ue.model,color:Ue.color},Ue.model)),i.jsx(Ox,{label:"in"}),i.jsx(Ox,{label:"out",dashed:!0})]})]}),i.jsxs("div",{className:"grid min-w-0 gap-3 sm:grid-cols-[minmax(0,1fr)_190px]",children:[i.jsx($N,{days:I.days,series:I.modelUsage}),i.jsxs("div",{className:"grid gap-3",children:[i.jsx(HN,{days:I.days,values:I.cost,total:Ba(I.weeklySpendMicros)}),i.jsx(QN,{values:I.thirtyDaySpend,total:Ba(I.totalSpendMicros)})]})]})]})]})}),i.jsx(KN,{checkedAt:fe,healthy:ge,pid:(ft=p.data)==null?void 0:ft.pid,status:($t=p.data)==null?void 0:$t.status,proxyPort:(mt=p.data)==null?void 0:mt.proxyPort,controlPort:(ia=p.data)==null?void 0:ia.controlPort}),l?i.jsx(nb,{modal:l,methods:ne,qr:l.kind==="activate"?j.data:N.data,loading:l.kind==="activate"?j.isPending:N.isPending,error:l.kind==="activate"?j.error:N.error,onClose:ve}):null]})}function AN({activeMode:a,autoModelCount:l,autoRange:o,autoSellerCount:s,manualProviderCount:u,manualPolicy:f,paymentName:p,scorer:h,t:v}){const x=a==="auto"?v("overview.providerMode.autoValue"):a==="manual"?v("overview.providerMode.manualValue"):Me;if(a==="auto"){const y=zN(h,v);return{label:v("overview.providerMode.label"),value:x,detail:v("overview.providerMode.autoStats",{range:kN(o,v),models:l,modelPlural:l===1?"":"s",sellers:s,sellerPlural:s===1?"":"s"}),note:p?v("overview.providerMode.autoPolicy",{scorer:y,payment:p}):v("overview.providerMode.autoPolicyNoPayment",{scorer:y})}}return{label:v("overview.providerMode.label"),value:x,detail:v("overview.providerMode.manualStats",{count:u,plural:u===1?"":"s",policy:RN(f,v)}),note:v("overview.providerMode.manualNote")}}function EN(a){if(a==="fixedSet")return"custom";if(a==="fullAuto")return"recommended"}function kN(a,l){return l(a==="custom"?"overview.providerMode.customRange":"overview.providerMode.recommendedRange")}function RN(a,l){return l(a==="locked"?"overview.providerMode.fixedProvider":"overview.providerMode.fallbackPolicy")}function zN(a,l){return l(a==="speed"?"overview.providerMode.speedScorer":a==="discount"?"overview.providerMode.costScorer":"overview.providerMode.balancedScorer")}function _N({currentVersion:a,latestVersion:l,updateAvailable:o,running:s,result:u,error:f,onUpdate:p}){if(!o&&!s&&!u&&!f)return null;const h=u?u.install.succeeded?u.restart.scheduled||u.restart.restarted?"Installed. tb-proxyd restart is in progress.":u.restart.error??"Installed. Restart needs attention.":u.install.error??"Update failed.":void 0,v=(f==null?void 0:f.message)??h??(a&&l?`TokenBuddy ${a} -> ${l}`:"TokenBuddy update available"),x=!!(f||(u==null?void 0:u.install.succeeded)===!1||u!=null&&u.restart.error);return i.jsxs("section",{className:["flex min-w-0 flex-col gap-2 rounded-[var(--radius-xl)] border px-3 py-2.5 shadow-[var(--shadow-chip)] sm:flex-row sm:items-center sm:justify-between",x?"border-[var(--color-danger)]/30 bg-[var(--color-danger-soft)]":"border-[var(--color-lavender-2)] bg-[var(--color-lavender)]"].join(" "),children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:["grid size-7 shrink-0 place-items-center rounded-[var(--radius-md)] bg-white",x?"text-[var(--color-danger)]":"text-[var(--color-purple)]"].join(" "),children:i.jsx(hi,{className:["size-4",s?"animate-spin":""].join(" ")})}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[0.82rem] font-semibold text-[var(--color-ink)]",children:"TokenBuddy update"}),i.jsx("div",{className:"truncate text-[0.74rem] text-[var(--color-muted)]",children:v})]})]}),o?i.jsxs("button",{type:"button",onClick:p,disabled:s,className:"tb-button tb-button-sm tb-button-secondary shrink-0 disabled:cursor-wait",children:[i.jsx(hi,{className:["size-3.5",s?"animate-spin":""].join(" ")}),s?"Updating":"Update"]}):null]})}function ON({rows:a}){const l=a.slice(0,3);return i.jsxs(_t,{className:"overflow-hidden",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-[var(--color-line-2)] px-3.5 py-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(Fg,{className:"size-4 shrink-0 text-[var(--color-purple)]"}),i.jsx("h2",{className:"truncate text-[1rem] font-semibold text-[var(--color-ink)]",children:"Recent model routes"})]}),i.jsx(mr,{to:"/routing",className:"tb-button tb-button-sm tb-button-secondary shrink-0",children:"Details"})]}),l.length>0?i.jsxs("div",{children:[i.jsxs("div",{className:"hidden grid-cols-[minmax(0,1fr)_minmax(180px,0.85fr)_70px_minmax(116px,0.6fr)_minmax(116px,0.6fr)_96px] gap-2 border-b border-[var(--color-line-2)] bg-[var(--color-page)]/55 px-3.5 py-2 text-[0.64rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)] lg:grid",children:[i.jsx("div",{children:"Model"}),i.jsx("div",{children:"Node"}),i.jsx("div",{className:"text-right",children:"Disc"}),i.jsx("div",{className:"text-right",children:"Token"}),i.jsx("div",{className:"text-right",children:"Speed"}),i.jsx("div",{className:"text-right",children:"Switch"})]}),i.jsx("div",{className:"divide-y divide-[var(--color-line-2)]",children:l.map(o=>i.jsx(DN,{row:o},`${o.modelId}-${o.currentSellerId}`))})]}):i.jsx("div",{className:"px-3.5 py-7 text-center text-[0.82rem] text-[var(--color-muted)]",children:"No model traffic yet."})]})}function DN({row:a}){const l=a.lastSellerSwitchAt??a.selectedAt;return i.jsxs("div",{className:"grid min-w-0 grid-cols-2 gap-3 px-3.5 py-3 lg:grid-cols-[minmax(0,1fr)_minmax(180px,0.85fr)_70px_minmax(116px,0.6fr)_minmax(116px,0.6fr)_96px] lg:items-center lg:gap-2",children:[i.jsxs("div",{className:"col-span-2 min-w-0 lg:col-span-1",children:[i.jsx("div",{className:"truncate font-mono text-[0.84rem] font-semibold text-[var(--color-ink)]",title:a.modelId,children:a.modelId}),i.jsxs("div",{className:"mt-0.5 text-[0.72rem] font-medium text-[var(--color-muted)]",children:[Se(a.requestCount)," requests"]})]}),i.jsxs("div",{className:"col-span-2 min-w-0 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-white/70 px-2.5 py-2 lg:col-span-1 lg:border-0 lg:bg-transparent lg:px-0 lg:py-0",children:[i.jsx("div",{className:"text-[0.58rem] font-semibold uppercase tracking-wider text-[var(--color-muted)] lg:hidden",children:"Node"}),i.jsxs("div",{className:"mt-1 flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:"min-w-0 truncate text-[0.82rem] font-semibold text-[var(--color-ink)]",title:a.currentSellerName,children:a.currentSellerName}),i.jsx(UN,{row:a})]}),i.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.68rem] text-[var(--color-muted)]",title:a.currentSellerId,children:Rs(a.currentSellerId)})]}),i.jsx(_x,{label:"Disc",value:a.sellerDiscount,title:`Node discount: ${a.sellerDiscount}`}),i.jsxs(zx,{label:"Token",title:`Input tokens: ${Se(a.inputTokens)} / Output tokens: ${Se(a.outputTokens)}`,children:[i.jsx(Zo,{label:"In",value:bf(a.inputTokens)}),i.jsx(Zo,{label:"Out",value:bf(a.outputTokens)})]}),i.jsxs(zx,{label:"Speed",title:`Time to first token: ${na(a.lastTtftMs??a.avgTtftMs)} / Tokens per second: ${ys(a.tokensPerSecond)}`,children:[i.jsx(Zo,{label:"TTFT",value:na(a.lastTtftMs??a.avgTtftMs)}),i.jsx(Zo,{label:"Tok/s",value:eb(a.tokensPerSecond)})]}),i.jsx(_x,{label:"Switch",value:tN(l),title:`Last node switch: ${xc(l)}`})]})}function UN({row:a}){const l=LN(a),o={green:"bg-emerald-50 text-emerald-700",amber:"bg-amber-50 text-amber-700",red:"bg-rose-50 text-rose-700",blue:"bg-blue-50 text-blue-700",gray:"bg-slate-100 text-slate-600"}[l.tone];return i.jsx("span",{className:["shrink-0 rounded-full px-1.5 py-0.5 text-[0.62rem] font-semibold uppercase",o].join(" "),children:l.label})}function LN(a){return a.source==="preview"?{label:"preview",tone:"amber"}:a.routeState?{label:bn(a.routeState),tone:ea(a.routeState)}:a.upstreamStatus&&!Kd(a.upstreamStatus)?{label:bn(a.upstreamStatus),tone:ea(a.upstreamStatus)}:a.lastStatus&&!Kd(a.lastStatus)?{label:bn(a.lastStatus),tone:ea(a.lastStatus)}:a.currentSellerStatus&&!Kd(a.currentSellerStatus)?{label:bn(a.currentSellerStatus),tone:ea(a.currentSellerStatus)}:{label:"ok",tone:"green"}}function Kd(a){const l=bn(a);return l==="ok"||l==="online"||l==="configured"||l==="settled"||l==="completed"||l==="success"||l==="active"||l==="healthy"}function zx({label:a,title:l,children:o}){return i.jsxs("div",{className:"min-w-0 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-2 py-1 lg:border-0 lg:bg-transparent lg:px-0 lg:py-0 lg:text-right",title:l,children:[i.jsx("div",{className:"text-[0.58rem] font-semibold uppercase tracking-wider text-[var(--color-muted)] lg:hidden",children:a}),i.jsx("div",{className:"grid gap-0.5 font-mono text-[0.74rem] font-semibold leading-snug text-[var(--color-ink)]",children:o})]})}function Zo({label:a,value:l}){return i.jsxs("div",{className:"flex min-w-0 items-baseline justify-between gap-2 lg:justify-end",children:[i.jsx("span",{className:"shrink-0 text-[0.6rem] font-semibold uppercase tracking-normal text-[var(--color-muted)]",children:a}),i.jsx("span",{className:"truncate",children:l})]})}function _x({label:a,value:l,title:o}){return i.jsxs("div",{className:"min-w-0 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-2 py-1 lg:border-0 lg:bg-transparent lg:px-0 lg:py-0 lg:text-right",title:o??`${a}: ${l}`,children:[i.jsx("div",{className:"text-[0.58rem] font-semibold uppercase tracking-wider text-[var(--color-muted)] lg:hidden",children:a}),i.jsx("div",{className:"truncate font-mono text-[0.76rem] font-semibold text-[var(--color-ink)]",children:l})]})}function Yd({to:a,icon:l,label:o,value:s,note:u,tone:f}){const p=zs(f);return i.jsxs(mr,{to:a,"aria-label":`Open ${o}`,className:["relative block min-h-[94px] overflow-hidden rounded-[var(--radius-xl)] p-3 transition hover:-translate-y-0.5 focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]",p.card].join(" "),children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(nm,{tone:f,children:l}),i.jsx("span",{className:["text-right text-[0.66rem] font-semibold uppercase leading-3 tracking-[0.08em]",p.label].join(" "),children:o})]}),i.jsx("div",{className:["mt-2 text-[1.25rem] font-semibold leading-none tracking-tight",p.value].join(" "),children:s}),i.jsx("div",{className:["mt-1.5 truncate text-[0.72rem] font-medium",p.note].join(" "),children:u})]})}function BN({inputTokens:a,outputTokens:l}){const o=zs("tokens");return i.jsx(mr,{to:"/ledger","aria-label":"Open Total tokens",className:["relative col-span-2 block min-h-[124px] overflow-hidden rounded-[var(--radius-xl)] p-3 transition hover:-translate-y-0.5 focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]",o.card].join(" "),children:i.jsx(oN,{inputTokens:a,outputTokens:l})})}function qN({icon:a,label:l,value:o,detail:s,note:u}){const f=zs("router");return i.jsxs(mr,{to:"/routing","aria-label":`Open ${l}`,className:["relative block min-h-[94px] overflow-hidden rounded-[var(--radius-xl)] p-3 transition hover:-translate-y-0.5 focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]",f.card].join(" "),children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx(nm,{tone:"router",children:a}),i.jsx("span",{className:["text-right text-[0.66rem] font-semibold uppercase leading-3 tracking-[0.08em]",f.label].join(" "),children:l})]}),i.jsx("div",{className:["mt-2 text-[1.25rem] font-semibold leading-none tracking-tight",f.value].join(" "),children:o}),i.jsx("div",{className:["mt-1.5 truncate text-[0.72rem] font-semibold",f.note].join(" "),children:s}),i.jsx("div",{className:"mt-0.5 truncate text-[0.68rem] font-medium text-[var(--color-muted)]",children:u})]})}function $N({days:a,series:l}){const u={top:14,right:18,bottom:26,left:26},f=l.flatMap(x=>[...x.input,...x.output]),p=Math.max(1,...f),h=x=>u.left+x*(680-u.left-u.right)/Math.max(1,a.length-1),v=x=>u.top+(1-x/p)*(150-u.top-u.bottom);return i.jsx("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-line-2)] bg-white px-3 py-1.5",children:i.jsxs("svg",{className:"h-[160px] w-full",viewBox:"0 0 680 150",role:"img","aria-label":"Daily model input and output usage lines",children:[[.25,.5,.75,1].map(x=>i.jsx("line",{x1:u.left,x2:680-u.right,y1:u.top+(1-x)*(150-u.top-u.bottom),y2:u.top+(1-x)*(150-u.top-u.bottom),stroke:"var(--color-chart-grid)",strokeWidth:"1"},x)),a.map((x,y)=>i.jsx("text",{x:h(y),y:143,textAnchor:"middle",className:"fill-[var(--color-muted)] text-[10px]",children:x},x)),l.map(x=>i.jsxs("g",{children:[i.jsx("path",{d:Sf(x.input.map((y,g)=>[h(g),v(y)])),fill:"none",stroke:x.color,strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:Sf(x.output.map((y,g)=>[h(g),v(y)])),fill:"none",stroke:x.color,strokeWidth:"2.4",strokeDasharray:"5 5",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.75"}),x.input.map((y,g)=>i.jsx("circle",{cx:h(g),cy:v(y),r:"2.7",fill:x.color},`${x.model}-input-${g}`)),x.output.map((y,g)=>i.jsx("circle",{cx:h(g),cy:v(y),r:"2.2",fill:"#fff",stroke:x.color,strokeWidth:"1.8"},`${x.model}-output-${g}`))]},x.model)),l.length===0?i.jsx("text",{x:680/2,y:150/2,textAnchor:"middle",className:"fill-[var(--color-muted)] text-[12px]",children:"No token usage yet"}):null]})})}function HN({days:a,values:l,total:o}){const f={top:10,right:8,bottom:16,left:8},p=Math.max(1,...l),h=x=>f.left+x*(190-f.left-f.right)/Math.max(1,l.length-1),v=x=>f.top+(1-x/p)*(72-f.top-f.bottom);return i.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-line-2)] bg-white px-3 py-1.5",children:[i.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[i.jsx("span",{className:"text-[0.74rem] font-semibold text-[var(--color-ink)]",children:"Inference cost"}),i.jsx("span",{className:"font-mono text-[0.74rem] text-[var(--color-muted)]",children:o})]}),i.jsxs("svg",{className:"h-[66px] w-full",viewBox:"0 0 190 72",role:"img","aria-label":"Daily inference cost curve",children:[i.jsx("path",{d:Sf(l.map((x,y)=>[h(y),v(x)])),fill:"none",stroke:"var(--color-chart-cost)",strokeWidth:"3",strokeLinecap:"round"}),l.map((x,y)=>i.jsx("circle",{cx:h(y),cy:v(x),r:"2.4",fill:"var(--color-chart-cost)"},a[y]))]})]})}function QN({values:a,total:l}){const o=Math.max(1,...a);return i.jsxs("div",{className:"rounded-[var(--radius-lg)] border border-[var(--color-line-2)] bg-white px-3 py-1.5",children:[i.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[i.jsx("span",{className:"text-[0.74rem] font-semibold text-[var(--color-ink)]",children:"30 day inference cost"}),i.jsx("span",{className:"font-mono text-[0.74rem] text-[var(--color-muted)]",children:l})]}),i.jsx("div",{className:"flex h-[60px] items-end gap-1",children:a.map((s,u)=>i.jsx("span",{className:"flex-1 rounded-t-[3px] bg-[var(--color-tokens)]/75",style:{height:`${Math.max(8,s/o*100)}%`}},u))})]})}function Sf(a){return a.length===0?"":a.length===1?`M ${a[0][0]} ${a[0][1]}`:a.reduce((l,o,s)=>{if(s===0)return`M ${o[0]} ${o[1]}`;const u=a[s-1],f=(u[0]+o[0])/2;return`${l} C ${f} ${u[1]}, ${f} ${o[1]}, ${o[0]} ${o[1]}`},"")}function PN({model:a,color:l}){return i.jsxs("span",{className:"inline-flex min-w-0 max-w-[9rem] items-center gap-1.5 rounded-[7px] border border-[var(--color-line-2)] bg-white px-1.5 py-0.5",title:a,children:[i.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:l}}),i.jsx("span",{className:"truncate font-mono text-[0.68rem]",children:a})]})}function Ox({label:a,dashed:l=!1}){return i.jsxs("span",{className:"inline-flex items-center gap-1 rounded-[7px] border border-[var(--color-line-2)] bg-white px-1.5 py-0.5",children:[i.jsx("span",{className:["h-px w-4 border-t border-[var(--color-ink)]",l?"border-dashed":""].join(" ")}),i.jsx("span",{className:"font-mono text-[0.68rem]",children:a})]})}function KN({checkedAt:a,healthy:l,pid:o,status:s,proxyPort:u,controlPort:f}){const p=[{icon:i.jsx(YS,{className:"size-3"}),label:"Daemon",value:o?`pid ${o}`:s??Me,tone:l?"green":"amber"},{icon:i.jsx(ij,{className:"size-3"}),label:"Proxy",value:u?`:${u}`:Me,tone:"blue"},{icon:i.jsx(pj,{className:"size-3"}),label:"Control",value:f?`:${f}`:Me,tone:"router"}];return i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 rounded-[var(--radius-xl)] border border-[var(--color-line-2)] bg-white px-3 py-2 shadow-[var(--shadow-chip)]",children:[i.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-white px-2.5 py-1 text-[0.72rem] font-medium text-[var(--color-muted)]",children:[i.jsx(hi,{className:"size-3.5"}),a]}),p.map(h=>i.jsx(YN,{...h},h.label))]})}function YN({icon:a,label:l,value:o,tone:s}){const u={green:"bg-[var(--color-success-soft)] text-[var(--color-success)]",blue:"bg-[var(--color-tokens-soft)] text-[var(--color-tokens)]",router:"bg-[var(--color-lavender)] text-[var(--color-router)]",spend:"bg-[var(--color-spend-soft)] text-[var(--color-spend)]",amber:"bg-[var(--color-warning-soft)] text-[var(--color-warning)]"}[s];return i.jsxs("div",{className:"inline-flex min-w-0 max-w-full items-center gap-2 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-white px-2.5 py-1",children:[i.jsx("span",{className:["grid size-5 shrink-0 place-items-center rounded-[var(--radius-sm)]",u].join(" "),children:a}),i.jsx("span",{className:"text-[0.72rem] font-semibold text-[var(--color-ink)]",children:l}),i.jsx("span",{className:"min-w-0 truncate font-mono text-[0.72rem] text-[var(--color-muted)]",children:o})]})}function GN(a){const l=Dx(7),o=Dx(30),s=jf(new Date),u=new Set(l.map(Q=>Q.key)),f=new Map(o.map((Q,q)=>[Q.key,q])),p=["var(--color-chart-input)","var(--color-spend)","var(--color-chart-cost)","var(--color-inventory)"],h=new Map,v=l.map(()=>0),x=o.map(()=>0);let y=0,g=0,j=0,N=0,T=0,E=0,D=0,R=0,L=0,H=0,P=0;for(const Q of a){const q=jf(new Date(Q.createdAt)),W=Q.settledUsdMicros??Q.billedMicros??0,I=VN(Q),ne=I?0:Q.promptTokens??0,F=I?0:Q.completionTokens??0,J=I?Number.isFinite(Q.imageCount)?Q.imageCount:1:0;P+=1,g+=W,L+=J,N+=ne,T+=F,q===s&&(H+=1,y+=W,R+=J,E+=ne,D+=F);const se=l.findIndex(fe=>fe.key===q);if(se>=0){j+=W,v[se]+=W/1e6;const fe=h.get(Q.modelId)??{input:l.map(()=>0),output:l.map(()=>0),total:0};fe.input[se]+=ne,fe.output[se]+=F,fe.total+=ne+F,h.set(Q.modelId,fe)}else u.has(q)&&(j+=W);const ge=f.get(q);ge!==void 0&&(x[ge]+=W/1e6)}const G=Array.from(h.entries()).sort((Q,q)=>q[1].total-Q[1].total).slice(0,4).map(([Q,q],W)=>({model:Q,color:p[W%p.length],input:q.input,output:q.output}));return{days:l.map(Q=>Q.label),modelUsage:G,cost:v,thirtyDaySpend:x,todaySpendMicros:y,totalSpendMicros:g,weeklySpendMicros:j,inputTokens:N,outputTokens:T,todayInputTokens:E,todayOutputTokens:D,todayImageCount:R,totalImageCount:L,todayRequestCount:H,totalRequestCount:P}}function VN(a){return a.billingUnit==="images"||a.endpoint==="/v1/images/generations"}function Dx(a){const l=[],o=new Intl.DateTimeFormat("en",{weekday:"short"});for(let s=a-1;s>=0;s-=1){const u=new Date;u.setHours(0,0,0,0),u.setDate(u.getDate()-s),l.push({key:jf(u),label:o.format(u)})}return l}function jf(a){if(Number.isNaN(a.getTime()))return"";const l=a.getFullYear(),o=String(a.getMonth()+1).padStart(2,"0"),s=String(a.getDate()).padStart(2,"0");return`${l}-${o}-${s}`}const XN=[{value:"balanced",label:"Balanced"},{value:"speed",label:"Speed"},{value:"discount",label:"Cost"}],Ux=10,FN=["clawtip"];function ZN(){var Ot,Dn,Xa,da,fa,Fa,Za,ot,$e,et,ma,vr;const a=Jg(),l=Ig(),o=kj(),s=Wg(),u=Rj(),f=Zf(),p=Uj(),h=zj(),v=_j(),x=Oj(),y=Dj(),g=Bj(),j=qj(),N=Jf(),T=ks(),E=Qj(),D=Pj(),R=Kj(),L=vc(),H=Vf(),P=Aj(),G=Xf(),Q=Ff(),[q,W]=S.useState({mode:"fullAuto",scorer:"balanced"}),[I,ne]=S.useState([]),[F,J]=S.useState(""),[se,ge]=S.useState("manual"),[fe,O]=S.useState("recommended"),[te,re]=S.useState(null),[Z,he]=S.useState(null),[w,$]=S.useState(null),[V,le]=S.useState(null),pe=$j({...q,modelId:F}),ve=T.data,be=((Ot=f.data)==null?void 0:Ot.providers)??[],Xe=((Dn=f.data)==null?void 0:Dn.routing)??{policy:"fallback"},Oe=((Xa=N.data)==null?void 0:Xa.sellers)??[],Nt=((da=R.data)==null?void 0:da.focusSet)??[],dt=((fa=L.data)==null?void 0:fa.inferences)??[],yn=S.useMemo(()=>jw(dt),[dt]),Ie=S.useMemo(()=>bw((ve==null?void 0:ve.data)??[],Nt),[Nt,ve==null?void 0:ve.data]),Qe=Cw(pe.data),Gt=S.useMemo(()=>ww(Oe,ve,(Qe==null?void 0:Qe.routes)??[]),[ve,Qe==null?void 0:Qe.routes,Oe]),an=S.useMemo(()=>I.map(ee=>Ie.find(ae=>ae.id===ee)).filter(dc),[Ie,I]),ln=q.sellerIds??[],Bt=((Fa=H.data)==null?void 0:Fa.payments)??[],At=S.useMemo(()=>zw(Bt),[Bt]),rn=S.useMemo(()=>tb(Bt,dt),[dt,Bt]),sn=S.useMemo(()=>{const ee=Rw(Gt,I,q.scorer);if(fe==="recommended")return ee;const ae=ln.map(ke=>Gt.find(tt=>tt.id===ke)).filter(dc);return lm(ae,I,q.scorer)},[fe,q.scorer,ln,I,Gt]),Pn=s.isLoading||T.isLoading||N.isLoading||pe.isFetching&&sn.length===0,la=!Pn&&(s.isFetching||T.isFetching||N.isFetching||pe.isFetching),at=S.useMemo(()=>fb({inferences:dt,modelsResponse:ve,sellersResponse:N.data,manualProviders:be,previewPlan:Qe,activeModelId:F}),[F,dt,be,ve,Qe,N.data]),Qa=S.useMemo(()=>Nw(at.rows,dt),[dt,at.rows]),Sn=Bt.some(ee=>Wn(ee.method)==="clawtip"&&(ee.enabled||vb(ee.config,"walletConfigPresent")))||((Za=G.data)==null?void 0:Za.walletConfigPresent)===!0,qt=se==="auto"&&At.active;S.useEffect(()=>{if(!Z)return;const ee=window.setTimeout(()=>he(null),4200);return()=>window.clearTimeout(ee)},[Z]),S.useEffect(()=>{var ee,ae,ke;if((ee=a.data)!=null&&ee.strategy){if(((ae=l.data)==null?void 0:ae.active)==="auto"&&((ke=s.data)!=null&&ke.config))return;W(a.data.strategy)}},[(ot=s.data)==null?void 0:ot.config,($e=l.data)==null?void 0:$e.active,(et=a.data)==null?void 0:et.strategy]),S.useEffect(()=>{l.data&&ge(l.data.active)},[l.data]),S.useEffect(()=>{var ae;const ee=(ae=s.data)==null?void 0:ae.config;ee&&(O(ee.range),W(ke=>({...ke,mode:ee.range==="custom"?"fixedSet":"fullAuto",scorer:ee.scorer,sellerId:void 0,sellerIds:ee.sellerIds})),ee.modelIds.length>0&&(ne(ee.modelIds),J(ke=>ee.modelIds.includes(ke)?ke:ee.modelIds[0]??"")))},[(ma=s.data)==null?void 0:ma.config]),S.useEffect(()=>{const ee=!R.isLoading&&!L.isLoading;if(I.length>0||Ie.length===0||!ee)return;const ae=yw({focusModels:Nt,referencedModelIds:yn,modelOptions:Ie});ae.length!==0&&(ne(ae),J(ae[0]??""))},[Nt,R.isLoading,L.isLoading,Ie,yn,I.length]),S.useEffect(()=>{!F||I.includes(F)||J(I[0]??"")},[F,I]),S.useEffect(()=>{F&&pe.refetch()},[F,q.mode,q.scorer,q.sellerId,(vr=q.sellerIds)==null?void 0:vr.join(","),Aw(q.fixedByModel)]),S.useEffect(()=>{if((V==null?void 0:V.kind)!=="activate"||Wn(V.method)!=="clawtip"||Sn)return;const ee=window.setInterval(()=>{H.refetch()},1500);return()=>window.clearInterval(ee)},[Sn,V==null?void 0:V.kind,V==null?void 0:V.method,H.refetch]),S.useEffect(()=>{(V==null?void 0:V.kind)==="activate"&&Wn(V.method)==="clawtip"&&Sn&&(le(null),G.reset())},[G,Sn,V==null?void 0:V.kind,V==null?void 0:V.method]);function Ka(ee){ne(ae=>{const ke=ae.filter(tt=>tt!==ee);return F===ee&&J(ke[0]??""),gf(ke).catch(()=>{}),qt&&De({modelIds:ke}),ke})}function ra(ee){const ae=Array.from(new Set(ee));ne(ae),J(ke=>ae.includes(ke)?ke:ae[0]??""),gf(ae).catch(()=>{}),qt&&De({modelIds:ae})}function Ya(ee){W(ae=>({...ae,scorer:ee})),qt&&De({scorer:ee})}function Ga(ee,ae){const ke=q.sellerIds??[],tt=ke.includes(ae)?ke.filter(Ja=>Ja!==ae):[...ke,ae];on(tt)}function on(ee){const ae={...q,mode:"fixedSet",sellerIds:ee,sellerId:void 0};W(ae),qt&&fe==="custom"&&De({range:"custom",sellerIds:ee})}async function ft(ee){await h.mutateAsync({name:ee.name.trim()||"Custom endpoint",baseUrl:ee.baseUrl.trim(),apiKey:ee.apiKey.trim(),enabled:!0}),$(null)}async function $t(ee,ae){await v.mutateAsync({providerId:ee,input:{name:ae.name.trim()||"Custom endpoint",baseUrl:ae.baseUrl.trim(),apiKey:ae.apiKey.trim(),enabled:!0}}),$(null)}function mt(ee){x.mutateAsync(ee).catch(ae=>{re(ae instanceof Error?ae.message:String(ae))})}function ia(ee){p.mutateAsync(ee).catch(ae=>{re(ae instanceof Error?ae.message:String(ae))})}function Ue(ee){const ae=be.findIndex(tt=>tt.id===ee);if(ae<=0)return;const ke=be.map(tt=>tt.id);[ke[ae-1],ke[ae]]=[ke[ae],ke[ae-1]],y.mutateAsync(ke).catch(tt=>{re(tt instanceof Error?tt.message:String(tt))})}function bt(ee){he(ee)}function sa(ee){g.mutateAsync(ee.id).then(ae=>{bt({tone:"success",title:`${ee.name} is healthy`,detail:`say hi · ${ae.modelId} · ${na(ae.elapsedMs)}`})}).catch(ae=>{bt({tone:"error",title:`${ee.name} test failed`,detail:ae instanceof Error?ae.message:String(ae)})})}function oa(ee){j.mutateAsync(ee.id).then(ae=>{bt({tone:"success",title:`${ee.name} models refreshed`,detail:`${Se(ae.modelIds.length)} models · ${na(ae.elapsedMs)}`})}).catch(ae=>{bt({tone:"error",title:`${ee.name} model refresh failed`,detail:ae instanceof Error?ae.message:String(ae)})})}function ca(ee){E.mutateAsync(ee.id).then(ae=>{bt({tone:"success",title:`${ee.name} is healthy`,detail:`say hi · ${ae.modelId} · ${na(ae.elapsedMs)}`})}).catch(ae=>{bt({tone:"error",title:`${ee.name} test failed`,detail:ae instanceof Error?ae.message:String(ae)})})}function jn(ee){D.mutateAsync().then(ae=>{const ke=ae.data.filter(tt=>tt.sellerId===ee.id).length;bt({tone:"success",title:`${ee.name} models refreshed`,detail:`${Se(ke)} node models · ${Se(ae.data.length)} total`})}).catch(ae=>{bt({tone:"error",title:`${ee.name} model refresh failed`,detail:ae instanceof Error?ae.message:String(ae)})})}function ua(ee){O(ee),ee==="custom"&&ln.length===0&&$({kind:"sellers"}),qt&&De({range:ee})}function Kn(ee){ge(ee),re(null),o.mutateAsync(ee).then(ae=>{ge(ae.active),ae.strategy&&W(ae.strategy)}).catch(ae=>{re(ae instanceof Error?ae.message:String(ae))})}function pr(ee){re(null),P.mutateAsync(ee).catch(ae=>{re(ae instanceof Error?ae.message:String(ae))})}function Ul(ee){le({kind:"activate",method:ee}),Wn(ee)==="clawtip"&&G.mutate()}function Va(ee){le({kind:"recharge",method:ee}),Wn(ee)==="clawtip"&&Q.mutate()}function ue(){le(null),G.reset(),Q.reset()}async function De(ee={}){var ha;if(!At.active){re("Bind a payment method to enable Auto routing.");return}const ae=ee.scorer??q.scorer,ke=ee.range??fe,tt=ee.modelIds??I,Ja=ee.sellerIds??ln;W(ke==="recommended"?{mode:"fullAuto",scorer:ae}:{mode:"fixedSet",scorer:ae,sellerIds:Ja}),re(null);try{const cn=await u.mutateAsync(Sw({base:(ha=s.data)==null?void 0:ha.config,enabled:!0,range:ke,scorer:ae,modelIds:tt,sellerIds:Ja}));ge(cn.active),cn.strategy&&W(cn.strategy)}catch(cn){re(cn instanceof Error?cn.message:String(cn))}}return i.jsxs("div",{className:"space-y-5",children:[i.jsx("section",{children:i.jsxs(_t,{className:"overflow-hidden",children:[i.jsx(JN,{activeTab:se,onChange:Kn}),i.jsxs("div",{className:"p-4",children:[a.isLoading||l.isLoading||N.isLoading||T.isLoading||f.isLoading?i.jsx("div",{className:"mb-3 rounded-[10px] border border-[var(--color-line-2)] bg-white px-3 py-2 text-[0.82rem] text-[var(--color-muted)]",children:"Loading routing data..."}):null,a.isError||l.isError||N.isError||T.isError||f.isError?i.jsx("div",{className:"mb-3 rounded-[10px] border border-rose-100 bg-rose-50 px-3 py-2 text-[0.82rem] text-rose-700",children:"Some routing data could not be loaded. Check that tb-proxyd is running."}):null,se==="manual"?i.jsx(IN,{providers:be,routing:Xe,onAdd:()=>$({kind:"manualProvider"}),onRemove:mt,onSetRouting:ia,onMoveUp:Ue,onTest:sa,onRefreshModels:oa,onViewModels:ee=>$({kind:"manualProviderModels",provider:ee}),onEdit:ee=>$({kind:"manualProviderEdit",provider:ee}),testingProviderId:g.isPending?g.variables:void 0,refreshingModelsProviderId:j.isPending?j.variables:void 0}):i.jsx(nw,{walletAccess:At,paymentMethods:rn,selectedModels:an,activeModelId:F,range:fe,scorer:q.scorer,effectiveSellers:sn,selectedSellerIds:ln,sellerActivityById:Qa,loading:Pn,refreshing:la,applyError:te,focusSaveError:R.isError,onSelectPayment:pr,onActivatePayment:Ul,onRechargePayment:Va,onAddModels:()=>$({kind:"models"}),onSetActiveModel:J,onRemoveModel:Ka,onRangeChange:ua,onScorerChange:Ya,onChooseSellers:()=>$({kind:"sellers"}),onRemoveSeller:ee=>Ga(F,ee),onTestSeller:ca,onRefreshSellerModels:jn,testingSellerId:E.isPending?E.variables:void 0,refreshingSellerModels:D.isPending})]})]})}),i.jsx(sw,{summary:at}),(w==null?void 0:w.kind)==="models"?i.jsx(mw,{models:Ie,selectedModelIds:I,onClose:()=>$(null),onSave:ee=>{ra(ee),$(null)}}):null,(w==null?void 0:w.kind)==="sellers"?i.jsx(hw,{selectedSellerIds:ln,selectedModelIds:I,activeModelId:F,scorer:q.scorer,sellers:Gt,onClose:()=>$(null),onSave:ee=>{on(ee),$(null)}}):null,(w==null?void 0:w.kind)==="manualProvider"?i.jsx($x,{onClose:()=>$(null),onSave:ft}):null,(w==null?void 0:w.kind)==="manualProviderEdit"?i.jsx($x,{provider:w.provider,onClose:()=>$(null),onSave:ee=>$t(w.provider.id,ee)}):null,(w==null?void 0:w.kind)==="manualProviderModels"?i.jsx(pw,{provider:w.provider,onClose:()=>$(null)}):null,V?i.jsx(nb,{modal:V,methods:rn,qr:V.kind==="activate"?G.data:Q.data,loading:V.kind==="activate"?G.isPending:Q.isPending,error:V.kind==="activate"?G.error:Q.error,onClose:ue}):null,Z?i.jsx(fw,{toast:Z,onClose:()=>he(null)}):null]})}function JN({activeTab:a,onChange:l}){return i.jsx("div",{className:"border-b border-[var(--color-line-2)] bg-white p-2.5",children:i.jsxs("div",{className:["relative grid min-h-[58px] grid-cols-2 overflow-hidden rounded-full border border-[var(--color-line-2)] bg-[var(--color-page)] p-1 shadow-inner","before:absolute before:inset-y-1 before:left-1 before:w-[calc(50%-4px)] before:rounded-full before:shadow-[0_10px_24px_rgba(60,41,112,0.14)] before:transition before:duration-200 before:ease-out",a==="auto"?"border-[var(--color-purple)]/35 before:bg-[var(--color-purple)]":"before:bg-white",a==="auto"?"before:translate-x-full":"before:translate-x-0"].join(" "),children:[i.jsx("button",{type:"button",onClick:()=>l("manual"),"aria-pressed":a==="manual","aria-label":"Manual endpoint mode",className:["relative z-10 flex min-w-0 items-center justify-center rounded-full px-5 text-center transition",a==="manual"?"text-[var(--color-ink)]":"text-[var(--color-muted)] hover:text-[var(--color-ink)]"].join(" "),children:i.jsx("span",{className:"min-w-0 truncate text-[1rem] font-semibold",children:"Manual"})}),i.jsx("button",{type:"button",onClick:()=>l("auto"),"aria-pressed":a==="auto","aria-label":"Auto node mode",className:["relative z-10 flex min-w-0 items-center justify-center rounded-full px-5 text-center transition",a==="auto"?"text-white":"text-[var(--color-muted)] hover:text-[var(--color-ink)]"].join(" "),children:i.jsx("span",{className:"min-w-0 truncate text-[1rem] font-semibold",children:"Auto"})})]})})}function IN({providers:a,routing:l,onAdd:o,onRemove:s,onSetRouting:u,onMoveUp:f,onTest:p,onRefreshModels:h,onViewModels:v,onEdit:x,testingProviderId:y,refreshingModelsProviderId:g}){const j=l.policy==="fallback";return i.jsxs("div",{className:"overflow-hidden rounded-[12px] border border-[var(--color-line-2)] bg-white",children:[i.jsx("div",{className:"flex flex-wrap items-center gap-2 border-b border-[var(--color-line-2)] px-3 py-2.5",children:i.jsx("span",{className:"text-[0.78rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Custom endpoints"})}),a.length>0?i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full min-w-[720px] table-fixed",children:[i.jsx("thead",{className:"border-b border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] text-left text-[0.66rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:i.jsxs("tr",{children:[i.jsx("th",{className:"w-[30%] px-3 py-2",children:"Endpoint"}),i.jsx("th",{className:"w-[9%] px-3 py-2 text-right",children:"Models"}),i.jsx("th",{className:"w-[15%] px-3 py-2",children:"Status"}),i.jsx("th",{className:"w-[15%] px-3 py-2",children:"Speed"}),i.jsx("th",{className:"w-[16%] px-3 py-2",children:"Last call"}),i.jsx("th",{className:"w-[15%] px-3 py-2 text-right",children:"Actions"})]})}),i.jsx("tbody",{className:"divide-y divide-[var(--color-line-2)]",children:a.map((N,T)=>{var E;return i.jsxs("tr",{className:"align-middle",children:[i.jsx("td",{className:"px-3 py-2.5",children:i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate font-semibold text-[var(--color-ink)]",children:N.name}),i.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.72rem] text-[var(--color-muted)]",children:N.baseUrl})]})}),i.jsx("td",{className:"px-3 py-2.5 text-right",children:i.jsxs("button",{type:"button",onClick:()=>v(N),className:"inline-flex items-center gap-1 rounded-full bg-[var(--color-page)] px-2 py-1 font-mono text-[0.72rem] font-semibold text-[var(--color-purple)] ring-1 ring-[var(--color-line-2)] transition hover:bg-[var(--color-lavender)]","aria-label":`View models for ${N.name}`,children:[Se(((E=N.models)==null?void 0:E.length)??0),i.jsx(aj,{size:12})]})}),i.jsx("td",{className:"px-3 py-2.5",children:i.jsx(WN,{provider:N})}),i.jsx("td",{className:"px-3 py-2.5",children:i.jsx(bc,{ttftMs:N.ttftMs,tokensPerSecond:N.avgTokensPerSecond})}),i.jsx("td",{className:"px-3 py-2.5 font-mono text-[0.72rem] text-[var(--color-muted)]",children:xc(N.lastAccess)}),i.jsx("td",{className:"px-3 py-2.5",children:i.jsxs("div",{className:"flex justify-end gap-1.5",children:[i.jsx("button",{type:"button",onClick:()=>p(N),disabled:y===N.id,className:"tb-button tb-button-icon tb-button-quiet disabled:cursor-wait disabled:opacity-60","aria-label":`Test ${N.name}`,title:"Run say hi test",children:y===N.id?i.jsx(jt,{size:14,className:"animate-spin"}):i.jsx(Yf,{size:14})}),i.jsx("button",{type:"button",onClick:()=>h(N),disabled:g===N.id,className:"tb-button tb-button-icon tb-button-quiet disabled:cursor-wait disabled:opacity-60","aria-label":`Refresh models for ${N.name}`,title:"Refresh model list",children:i.jsx(hi,{size:14,className:g===N.id?"animate-spin":""})}),j?i.jsx("button",{type:"button",onClick:()=>f(N.id),disabled:T===0,className:"tb-button tb-button-icon tb-button-quiet disabled:cursor-not-allowed disabled:opacity-35","aria-label":`Move ${N.name} up`,title:"Move up",children:i.jsx(Xg,{size:14})}):null,i.jsx("button",{type:"button",onClick:()=>x(N),className:"tb-button tb-button-icon tb-button-quiet","aria-label":`Edit ${N.name}`,title:"Edit",children:i.jsx(oj,{size:14})}),i.jsx("button",{type:"button",onClick:()=>s(N.id),className:"tb-button tb-button-icon tb-button-quiet hover:border-[var(--color-danger)] hover:bg-[var(--color-danger-soft)] hover:text-[var(--color-danger)]","aria-label":`Remove ${N.name}`,children:i.jsx(Gf,{size:14})})]})})]},N.id)})})]})}):i.jsx("div",{className:"px-3 py-6 text-center text-[0.84rem] text-[var(--color-muted)]",children:"No custom endpoints yet."}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-t border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2.5",children:[i.jsxs("button",{type:"button",onClick:o,className:"tb-button tb-button-sm tb-button-primary",children:[i.jsx(bs,{size:14}),"Add endpoint"]}),i.jsxs("div",{className:"ml-auto flex flex-wrap items-center justify-end gap-1.5",children:[i.jsx(Gd,{label:"Fallback on error",state:j?"selected":"enabled",onClick:()=>u({policy:"fallback"})}),i.jsx(Gd,{label:"Cost first",state:"disabled"}),i.jsx(Gd,{label:"Multi-endpoint concurrent calls",state:"disabled"})]})]})]})}function Gd({label:a,state:l,onClick:o}){const s=l!=="disabled"&&!!o,u={enabled:"border-[var(--color-line-2)] bg-white text-[var(--color-muted)] shadow-[0_1px_3px_rgba(60,41,112,0.05)] hover:border-[var(--color-primary)] hover:bg-[var(--color-primary-soft)] hover:text-[var(--color-primary-deep)]",selected:"border-[var(--color-primary)]/35 bg-[var(--color-primary-soft)] text-[var(--color-primary-deep)] shadow-[0_1px_4px_rgba(60,41,112,0.08)]",disabled:"border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] text-[var(--color-muted-soft)] opacity-70"}[l];return i.jsx("button",{type:"button",onClick:o,disabled:!s,className:["inline-flex h-7 items-center justify-center rounded-full border px-3 text-[0.7rem] font-semibold transition disabled:cursor-not-allowed",u].join(" "),"aria-pressed":l==="selected",title:a==="Fallback on error"?"Use endpoints by table order when the current endpoint fails.":`${a} is not available in Manual mode.`,children:a})}function WN({provider:a}){const l=(a.status??"unknown").toLowerCase(),u=l==="healthy"||l==="ok"||l==="online"?"bg-emerald-50 text-emerald-700 ring-emerald-100":l==="unknown"||l===""?"bg-[var(--color-page)] text-[var(--color-muted)] ring-[var(--color-line-2)]":"bg-rose-50 text-rose-700 ring-rose-100";return i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsxs("span",{className:["inline-flex h-6 items-center gap-1.5 rounded-full px-2 text-[0.68rem] font-semibold ring-1",u].join(" "),children:[i.jsx("span",{className:"size-1.5 rounded-full bg-current","aria-hidden":"true"}),a.status??"unknown"]}),a.current?i.jsx("span",{className:"inline-flex h-6 items-center rounded-full bg-emerald-50 px-2 text-[0.62rem] font-semibold uppercase text-emerald-700 ring-1 ring-emerald-100",children:"Current"}):null,a.errorClass?i.jsx("span",{className:"text-[0.7rem] text-[var(--color-danger)]",children:a.errorClass}):null]})}function hb({seller:a,current:l}){const o=Nf(a),s={green:"bg-emerald-50 text-emerald-700 ring-emerald-100",amber:"bg-amber-50 text-amber-700 ring-amber-100",red:"bg-rose-50 text-rose-700 ring-rose-100",blue:"bg-blue-50 text-blue-700 ring-blue-100",gray:"bg-slate-100 text-slate-600 ring-slate-200"}[o.tone];return i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[i.jsx("span",{className:["inline-flex h-6 items-center rounded-full px-2 text-[0.62rem] font-semibold uppercase ring-1",s].join(" "),children:o.label}),l?i.jsx("span",{className:"inline-flex h-6 items-center rounded-full bg-emerald-50 px-2 text-[0.62rem] font-semibold uppercase text-emerald-700 ring-1 ring-emerald-100",children:"Current"}):null]})}function Nf(a){return a.routeState?{label:bn(a.routeState),tone:ea(a.routeState)}:a.health==="offline"?{label:"error",tone:"red"}:a.health==="degraded"?{label:"degraded",tone:"amber"}:a.coverageModelIds.length<=0?{label:"unknown",tone:"gray"}:{label:"ok",tone:"green"}}function ew(a,l){if(l.length===0)return"available";const o=l.filter(s=>a.coverageModelIds.includes(s)).length;return`${Se(o)}/${Se(l.length)} selected`}function tw({value:a}){return i.jsx("div",{className:"min-w-0 font-mono text-[0.72rem] text-[var(--color-muted)]",children:i.jsx("div",{className:"truncate",children:xc(a)})})}function nw({walletAccess:a,paymentMethods:l,selectedModels:o,activeModelId:s,range:u,scorer:f,effectiveSellers:p,selectedSellerIds:h,sellerActivityById:v,loading:x,refreshing:y,applyError:g,focusSaveError:j,onSelectPayment:N,onActivatePayment:T,onRechargePayment:E,onAddModels:D,onSetActiveModel:R,onRemoveModel:L,onRangeChange:H,onScorerChange:P,onChooseSellers:G,onRemoveSeller:Q,onTestSeller:q,onRefreshSellerModels:W,testingSellerId:I,refreshingSellerModels:ne=!1}){const F=!a.active;return i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-3 rounded-[12px] border border-[var(--color-line-2)] bg-white px-3 py-2",children:[!F&&g?i.jsx("span",{className:"max-w-full truncate rounded-full bg-rose-50 px-2.5 py-1 text-[0.74rem] font-semibold text-rose-700 ring-1 ring-rose-100 sm:max-w-[360px]",title:g,children:g}):null,i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-2",children:[i.jsx("span",{className:"text-[0.68rem] font-semibold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:"Payment route"}),i.jsx("div",{className:"inline-flex min-h-9 flex-wrap items-center gap-1 rounded-full border border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] p-0.5",children:a.options.map(J=>i.jsx(aw,{option:J,method:l.find(se=>Wn(se.method)===Wn(J.method)),onSelect:N,onActivate:T,onRecharge:E},J.method))})]})]}),i.jsxs("div",{className:["space-y-3 transition",F?"pointer-events-none select-none opacity-45 grayscale-[0.25]":""].join(" "),"aria-disabled":F,children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-[12px] border border-[var(--color-line-2)] bg-white px-3 py-2",children:[i.jsx("span",{className:"mr-1 text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Recent models"}),o.map(J=>{const se=s===J.id;return i.jsxs("span",{className:["inline-flex h-8 items-center gap-1.5 rounded-[8px] border px-2.5 font-mono text-[0.8rem] transition",se?"border-[var(--color-primary)] bg-[var(--color-primary-soft)] shadow-[inset_0_0_0_1px_rgba(124,61,240,0.18)]":"border-[var(--color-line-2)] bg-white hover:border-[var(--color-lavender-2)] hover:bg-[var(--color-panel-subtle)]"].join(" "),children:[i.jsx("button",{type:"button",onClick:()=>R(J.id),disabled:F,className:["truncate font-semibold",se?"text-[var(--color-primary-deep)]":"text-[color-mix(in_srgb,var(--color-primary-deep)_82%,var(--color-muted))]"].join(" "),children:J.id}),i.jsx("span",{className:"rounded-full bg-white px-1.5 text-[0.68rem] text-[var(--color-muted)]",children:J.sellerCount}),i.jsx("button",{type:"button",onClick:()=>L(J.id),disabled:F,className:"text-[var(--color-muted)] hover:text-rose-700","aria-label":`Remove ${J.id}`,children:i.jsx(Gf,{size:12})})]},J.id)}),i.jsxs("button",{type:"button",onClick:D,disabled:F,className:"tb-button tb-button-sm tb-button-secondary",children:[i.jsx(bs,{size:14}),"Manage"]}),o.length===0?i.jsx("span",{className:"text-[0.8rem] text-[var(--color-muted)]",children:"Choose at least one model."}):null,j?i.jsx("span",{className:"text-[0.8rem] text-amber-700",children:"Models could not be saved."}):null]}),i.jsx(lw,{range:u,scorer:f,activeModelId:s,sellers:p,selectedSellerIds:h,selectedModelIds:o.map(J=>J.id),sellerActivityById:v,disabled:F,loading:x,refreshing:y,onRangeChange:H,onScorerChange:P,onChooseSellers:G,onRemoveSeller:Q,onTestSeller:q,onRefreshSellerModels:W,testingSellerId:I,refreshingSellerModels:ne})]})]})}function aw({option:a,method:l,onSelect:o,onActivate:s,onRecharge:u}){const[f,p]=S.useState(!1),h=["inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.74rem] font-semibold transition",a.selected?"bg-[var(--color-primary-soft)] text-[var(--color-primary-deep)] shadow-[0_1px_4px_rgba(60,41,112,0.08)]":a.configured?"text-[var(--color-muted)] hover:bg-white hover:text-[var(--color-ink)]":"border border-amber-200 bg-amber-50 text-amber-800 hover:border-amber-300 hover:bg-amber-100"].join(" "),v=["inline-flex size-4 items-center justify-center rounded-full text-[0.58rem] font-black",a.method==="clawtip"?"bg-[var(--color-danger-soft)] text-[var(--color-danger)]":"bg-[var(--color-lavender)] text-[var(--color-primary-deep)]"].join(" "),x=i.jsxs(i.Fragment,{children:[i.jsx("span",{className:v,"aria-hidden":"true",children:a.label.charAt(0)}),i.jsx("span",{children:a.configured?a.label:`Bind ${a.label}`}),a.selected?i.jsx("span",{className:"text-[0.64rem] uppercase tracking-[0.08em] opacity-75",children:"Active"}):null,a.selected?i.jsx(BS,{size:13,"aria-hidden":"true"}):null]});return a.configured?a.selected?i.jsxs("div",{className:"relative",children:[i.jsx("button",{type:"button",onClick:()=>p(y=>!y),className:h,"aria-pressed":!0,"aria-expanded":f,"aria-haspopup":"menu",children:x}),f?i.jsx("div",{className:"absolute right-0 z-20 mt-1 w-40 overflow-hidden rounded-[10px] border border-[var(--color-line-2)] bg-white p-1 shadow-[0_12px_28px_rgba(15,23,42,0.1)]",children:i.jsxs("button",{type:"button",onClick:()=>{p(!1),u((l==null?void 0:l.method)??a.method)},className:"flex h-8 w-full items-center justify-between rounded-[8px] px-2.5 text-left text-[0.76rem] font-semibold text-[var(--color-ink)] transition hover:bg-[var(--color-lavender)]/45",role:"menuitem",children:[i.jsx("span",{children:"Recharge"}),i.jsx("span",{className:"font-mono text-[0.68rem] text-[var(--color-muted)]",children:(l==null?void 0:l.balance)??"••••"})]})}):null]}):i.jsx("button",{type:"button",onClick:()=>o(a.method),className:h,"aria-pressed":!1,children:x}):i.jsx("button",{type:"button",onClick:()=>s(a.method),className:h,"aria-label":`Bind ${a.label}`,children:x})}function lw({range:a,scorer:l,activeModelId:o,sellers:s,selectedSellerIds:u,selectedModelIds:f,sellerActivityById:p,disabled:h=!1,loading:v=!1,refreshing:x=!1,onRangeChange:y,onScorerChange:g,onChooseSellers:j,onRemoveSeller:N,onTestSeller:T,onRefreshSellerModels:E,testingSellerId:D,refreshingSellerModels:R=!1}){return i.jsxs("div",{className:"overflow-hidden rounded-[12px] border border-[var(--color-line-2)] bg-white",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-[var(--color-line-2)] px-3 py-2.5",children:[i.jsxs("div",{className:"min-w-[150px]",children:[i.jsx("div",{className:"text-[0.78rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Node list"}),i.jsxs("div",{className:"mt-0.5 font-mono text-[0.72rem] text-[var(--color-muted)]",children:[v&&s.length===0?"Loading nodes...":`${Se(Math.min(s.length,Ux))} of ${Se(s.length)} nodes`,x?i.jsx("span",{className:"ml-2 text-[var(--color-purple)]",children:"Refreshing"}):null]})]}),i.jsxs("div",{className:"ml-auto flex flex-wrap items-center justify-end gap-2",children:[i.jsx(Lx,{options:[{value:"recommended",label:"Recommended"},{value:"custom",label:"Custom"}],value:a,onChange:y,disabled:h}),i.jsx("button",{type:"button",onClick:j,disabled:h||a!=="custom",className:"tb-button tb-button-sm tb-button-primary min-w-[72px]",title:a==="custom"?"Select nodes":"Switch to Custom to select nodes",children:"Select"})]})]}),i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("div",{className:"min-w-[900px]",children:[s.length>0?i.jsxs("div",{className:"grid grid-cols-[minmax(210px,1.35fr)_90px_128px_74px_138px_132px_130px_80px] gap-2 border-b border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-3 py-2 text-[0.62rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:[i.jsx("div",{children:"Node"}),i.jsx("div",{className:"text-right",children:"Models"}),i.jsx("div",{children:"Status"}),i.jsx("div",{className:"text-right",children:"Disc"}),i.jsx("div",{className:"text-right",children:"Price"}),i.jsx("div",{className:"text-right",children:"Speed"}),i.jsx("div",{children:"Last inspect"}),i.jsx("div",{className:"text-right",children:"Actions"})]}):null,i.jsxs("div",{className:"divide-y divide-[var(--color-line-2)]",children:[v&&s.length===0?i.jsx(rw,{}):null,s.slice(0,Ux).map(L=>{const H=p.get(L.id),P=(H==null?void 0:H.averageTtftMs)??L.latencyMs,G=(H==null?void 0:H.tokensPerSecond)??L.tokensPerSecond,Q=o?L.priceByModelId[o]??L.price:L.price;return i.jsxs("div",{className:"grid grid-cols-[minmax(210px,1.35fr)_90px_128px_74px_138px_132px_130px_80px] items-center gap-2 px-3 py-2.5",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate font-semibold text-[var(--color-ink)]",children:L.name}),i.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.72rem] text-[var(--color-muted)]",children:Rs(L.id)})]}),i.jsxs("div",{className:"min-w-0 text-right font-mono text-[0.72rem] font-semibold leading-snug text-[var(--color-ink)]",children:[i.jsx("div",{children:Se(L.coverageModelIds.length)}),i.jsx("div",{className:"text-[0.66rem] font-medium text-[var(--color-muted)]",children:ew(L,f)})]}),i.jsx(hb,{seller:L,current:(H==null?void 0:H.current)===!0}),i.jsx(Bx,{value:L.discount}),i.jsx(Bx,{value:Q}),i.jsxs("div",{className:"min-w-0 text-right font-mono text-[0.72rem] font-semibold leading-snug text-[var(--color-ink)]",children:[i.jsxs("div",{children:["TTFT ",na(P)]}),i.jsx("div",{children:ys(G)})]}),i.jsx(tw,{value:L.lastInspectAt}),i.jsxs("div",{className:"flex items-center justify-end gap-1.5",children:[i.jsx("button",{type:"button",onClick:()=>T(L),disabled:h||D===L.id,className:"tb-button tb-button-icon tb-button-quiet disabled:cursor-wait disabled:opacity-60","aria-label":`Test ${L.name}`,title:"Run say hi test",children:D===L.id?i.jsx(jt,{size:14,className:"animate-spin"}):i.jsx(Yf,{size:14})}),i.jsx("button",{type:"button",onClick:()=>E(L),disabled:h||R,className:"tb-button tb-button-icon tb-button-quiet disabled:cursor-wait disabled:opacity-60","aria-label":`Refresh models for ${L.name}`,title:"Refresh model list",children:i.jsx(hi,{size:14,className:R?"animate-spin":""})}),a==="custom"&&u.includes(L.id)?i.jsx("button",{type:"button",onClick:()=>N(L.id),disabled:h,className:"tb-button tb-button-icon tb-button-quiet hover:border-[var(--color-danger)] hover:bg-[var(--color-danger-soft)] hover:text-[var(--color-danger)]","aria-label":`Remove ${L.name}`,children:i.jsx(Gf,{size:14})}):null]})]},L.id)}),!v&&s.length===0?i.jsx("div",{className:"px-3 py-8 text-center text-[0.84rem] text-[var(--color-muted)]",children:a==="custom"?"No custom nodes selected.":"No warmed nodes available for these models."}):null]})]})}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-t border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2",children:[i.jsx("span",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Routing priority"}),i.jsx(Lx,{options:XN,value:l,onChange:g,disabled:h}),i.jsx("span",{className:"ml-auto max-w-full text-right text-[0.74rem] text-[var(--color-muted)] sm:max-w-[420px]",children:iw(l)})]})]})}function rw(){return i.jsx(i.Fragment,{children:[0,1,2].map(a=>i.jsxs("div",{className:"grid gap-2 px-3 py-2.5 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center",children:[i.jsxs("div",{className:"min-w-0 space-y-2",children:[i.jsx("div",{className:"h-4 w-44 animate-pulse rounded-full bg-[var(--color-line-2)]"}),i.jsx("div",{className:"h-3 w-28 animate-pulse rounded-full bg-[var(--color-page)]"}),i.jsx("div",{className:"h-3 w-52 animate-pulse rounded-full bg-[var(--color-page)]"})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2 sm:justify-end",children:[i.jsx("div",{className:"h-10 w-16 animate-pulse rounded-[8px] bg-[var(--color-page)]"}),i.jsx("div",{className:"h-10 w-16 animate-pulse rounded-[8px] bg-[var(--color-page)]"}),i.jsx("div",{className:"h-10 w-16 animate-pulse rounded-[8px] bg-[var(--color-page)]"})]})]},a))})}function Lx({options:a,value:l,onChange:o,disabled:s=!1}){return i.jsx("div",{className:"inline-flex h-8 rounded-[8px] border border-[var(--color-purple)]/20 bg-[var(--color-page)] p-0.5",children:a.map(u=>i.jsx("button",{type:"button",onClick:()=>o(u.value),disabled:s,className:["rounded-[6px] px-2.5 text-[0.74rem] font-semibold transition disabled:cursor-not-allowed disabled:opacity-60",l===u.value?"bg-[var(--color-purple)] text-white shadow-[0_4px_12px_rgba(124,61,240,0.24)]":"text-[var(--color-muted)] hover:text-[var(--color-ink)]"].join(" "),children:u.label},String(u.value)))})}function Bx({value:a}){return i.jsx("div",{className:"min-w-0 text-right",children:i.jsx("div",{className:"truncate font-mono text-[0.76rem] font-semibold text-[var(--color-ink)]",children:a})})}function iw(a){return a==="speed"?"Prefers lower TTFT and stronger throughput.":a==="discount"?"Prefers lower effective cost among healthy nodes.":"Balances reliability, speed, and cost."}function sw({summary:a}){return i.jsx("section",{children:i.jsxs(_t,{className:"overflow-hidden",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-[var(--color-line-2)] px-4 py-3",children:[i.jsx("div",{className:"min-w-0",children:i.jsx("div",{className:"text-[0.78rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Current routes"})}),i.jsxs("div",{className:"rounded-[8px] border border-[var(--color-line-2)] bg-white px-2.5 py-1.5 font-mono text-[0.74rem] text-[var(--color-muted)]",children:[Se(a.rows.length)," models"]})]}),i.jsx("div",{className:"min-w-0 max-w-full overflow-x-auto",children:i.jsxs("table",{className:"w-full min-w-[840px] border-collapse text-left text-[0.82rem]",children:[i.jsx("thead",{className:"bg-white/70 text-[0.66rem] uppercase tracking-wider text-[var(--color-muted)]",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"MODEL"}),i.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"TARGET"}),i.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"STRATEGY"}),i.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"STATUS"}),i.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"EVIDENCE"}),i.jsx("th",{className:"px-4 py-2.5 font-semibold",children:"LAST CALL"})]})}),i.jsxs("tbody",{className:"divide-y divide-[var(--color-line-2)] bg-white",children:[a.rows.map(l=>i.jsx(ow,{row:l},`${l.source}-${l.modelId}-${l.currentSellerId}`)),a.rows.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-[var(--color-muted)]",children:"No model traffic yet."})}):null]})]})})]})})}function ow({row:a}){const l=uw(a),o=dw(a.routeReason,a.source);return i.jsxs("tr",{className:"align-middle transition hover:bg-[var(--color-lavender)]/25",children:[i.jsx("td",{className:"px-4 py-3.5",children:i.jsx("div",{className:"max-w-[220px] truncate font-mono text-[0.84rem] font-semibold text-[var(--color-ink)]",title:a.modelId,children:a.modelId})}),i.jsxs("td",{className:"px-4 py-3.5",children:[i.jsx("div",{className:"max-w-[230px] truncate font-semibold text-[var(--color-purple)]",title:a.currentSellerId,children:a.currentSellerName}),i.jsx("div",{className:"mt-0.5 font-mono text-[0.68rem] text-[var(--color-muted)]",children:Rs(a.currentSellerId)})]}),i.jsx("td",{className:"px-4 py-3.5",children:i.jsx(qx,{tone:o.tone,children:o.label})}),i.jsx("td",{className:"px-4 py-3.5",children:i.jsx(qx,{tone:l.tone,children:l.label})}),i.jsx("td",{className:"px-4 py-3.5",children:i.jsx(cw,{row:a})}),i.jsx("td",{className:"whitespace-nowrap px-4 py-3.5",children:i.jsx("div",{className:"font-mono text-[0.74rem] text-[var(--color-muted)]",children:xc(a.lastAccessAt)})})]})}function cw({row:a}){const l=yf(a.inputPriceMicrosPer1m,a.outputPriceMicrosPer1m);return i.jsxs("div",{className:"grid gap-0.5 font-mono text-[0.72rem] leading-snug",children:[i.jsxs("div",{className:"truncate font-semibold text-[var(--color-ink)]",title:`Disc ${a.sellerDiscount} / Price ${l}`,children:["Disc ",a.sellerDiscount," / ",l]}),i.jsxs("div",{className:"truncate text-[var(--color-muted)]",title:`TTFT ${na(a.lastTtftMs??a.avgTtftMs)} / ${ys(a.tokensPerSecond)}`,children:["TTFT ",na(a.lastTtftMs??a.avgTtftMs)," / ",ys(a.tokensPerSecond)]})]})}function uw(a){return a.source==="preview"?{label:"Preview",tone:"amber"}:a.routeState?{label:bn(a.routeState),tone:ea(a.routeState)}:a.upstreamStatus&&!Vd(a.upstreamStatus)?{label:bn(a.upstreamStatus),tone:ea(a.upstreamStatus)}:a.lastStatus&&!Vd(a.lastStatus)?{label:bn(a.lastStatus),tone:ea(a.lastStatus)}:a.currentSellerStatus&&!Vd(a.currentSellerStatus)?{label:bn(a.currentSellerStatus),tone:ea(a.currentSellerStatus)}:{label:"Ready",tone:"green"}}function Vd(a){const l=bn(a);return l==="ok"||l==="online"||l==="configured"||l==="settled"||l==="completed"||l==="success"||l==="active"||l==="healthy"}function dw(a,l){return a?a.startsWith("manual:fallback")?{label:"Manual fallback",tone:"blue"}:a.startsWith("manual:locked")?{label:"Manual direct",tone:"blue"}:a.startsWith("fixedSet")?{label:"Auto custom",tone:"green"}:a.startsWith("fixed")?{label:"Auto fixed",tone:"green"}:a.startsWith("fullAuto:discount")?{label:"Auto cost",tone:"green"}:a.startsWith("fullAuto:speed")?{label:"Auto speed",tone:"green"}:a.startsWith("fullAuto:balanced")?{label:"Auto balanced",tone:"green"}:a.startsWith("fullAuto")?{label:"Auto",tone:"green"}:l==="preview"?{label:"Preview",tone:"amber"}:{label:"Active",tone:"gray"}:l==="preview"?{label:"Preview",tone:"amber"}:{label:"Active",tone:"gray"}}function qx({tone:a,children:l}){const o={green:"bg-emerald-50 text-emerald-700",amber:"bg-amber-50 text-amber-700",red:"bg-rose-50 text-rose-700",blue:"bg-blue-50 text-blue-700",gray:"bg-slate-100 text-slate-600"}[a];return i.jsx("span",{className:["rounded-full px-2 py-0.5 text-[0.66rem] font-semibold uppercase",o].join(" "),children:l})}function fw({toast:a,onClose:l}){const o=a.tone==="success"?"border-emerald-100 bg-emerald-50 text-emerald-800":"border-rose-100 bg-rose-50 text-rose-800";return i.jsx("div",{className:"fixed bottom-5 right-5 z-40 w-[min(360px,calc(100vw-2rem))]",children:i.jsx("div",{className:["rounded-[12px] border px-3 py-2.5 shadow-[0_14px_34px_rgba(32,26,56,0.16)]",o].join(" "),children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"truncate text-[0.82rem] font-semibold",children:a.title}),i.jsx("div",{className:"mt-0.5 line-clamp-3 text-[0.74rem] leading-5 opacity-90",children:a.detail})]}),i.jsx("button",{type:"button",onClick:l,className:"grid size-6 shrink-0 place-items-center rounded-full bg-white/70 transition hover:bg-white","aria-label":"Close notification",children:i.jsx(Dl,{size:13})})]})})})}function mw({models:a,selectedModelIds:l,onClose:o,onSave:s}){const[u,f]=S.useState(""),[p,h]=S.useState(l),v=S.useMemo(()=>p.map(g=>a.find(j=>j.id===g)).filter(dc),[p,a]),x=a.filter(g=>xb(u,[g.id,g.paymentMethod,g.enabled?"enabled":"not enabled"]));function y(g){h(j=>j.includes(g)?j.filter(N=>N!==g):[...j,g])}return i.jsxs(yc,{title:"Add models",onClose:o,children:[i.jsx(rm,{value:u,onChange:f,placeholder:"Search models or payment"}),i.jsx("div",{className:"mt-3 max-h-[48dvh] overflow-auto rounded-[12px] border border-[var(--color-line-2)]",children:i.jsxs("table",{className:"w-full border-collapse text-left text-[0.84rem]",children:[i.jsx("thead",{className:"sticky top-0 z-[1] bg-white/95 text-[0.7rem] uppercase tracking-wider text-[var(--color-muted)] backdrop-blur",children:i.jsxs("tr",{children:[i.jsx("th",{className:"w-16 px-3 py-2 font-semibold",children:"Select"}),i.jsx("th",{className:"px-3 py-2 font-semibold",children:"Model"}),i.jsx("th",{className:"px-3 py-2 font-semibold",children:"Payment"}),i.jsx("th",{className:"px-3 py-2 text-right font-semibold",children:"Nodes"})]})}),i.jsxs("tbody",{className:"divide-y divide-[var(--color-line-2)] bg-white",children:[x.map(g=>{const j=p.includes(g.id);return i.jsxs("tr",{onClick:()=>y(g.id),className:["cursor-pointer",j?"bg-[var(--color-lavender)]/70":"hover:bg-[var(--color-lavender)]/35",g.enabled?"":"opacity-60"].join(" "),children:[i.jsx("td",{className:"px-3 py-2.5",children:i.jsx(pb,{active:j,fixed:!1})}),i.jsx("td",{className:"px-3 py-2.5 font-mono font-semibold text-[var(--color-ink)]",children:g.id}),i.jsx("td",{className:"px-3 py-2.5",children:i.jsx(xw,{enabled:g.enabled,paymentMethod:g.paymentMethod})}),i.jsx("td",{className:"px-3 py-2.5 text-right font-mono font-semibold text-[var(--color-ink)]",children:Se(g.sellerCount)})]},g.id)}),x.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:4,className:"px-3 py-8 text-center text-[var(--color-muted)]",children:"No models found."})}):null]})]})}),i.jsxs("div",{className:"mt-3 rounded-[12px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2.5",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs("div",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:["Selected ",v.length]}),v.length>0?i.jsx("button",{type:"button",onClick:()=>h([]),className:"ml-auto text-[0.74rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-purple)]",children:"Clear"}):null]}),i.jsxs("div",{className:"mt-2 flex min-h-8 flex-wrap gap-2",children:[v.map(g=>i.jsxs("button",{type:"button",onClick:()=>y(g.id),className:"inline-flex max-w-full items-center gap-1.5 rounded-full border border-[var(--color-line-2)] bg-white px-2.5 py-1 text-[0.76rem] font-mono font-semibold text-[var(--color-ink)] shadow-[0_1px_4px_rgba(60,41,112,0.06)] transition hover:border-[var(--color-purple)] hover:text-[var(--color-purple)]",title:`Remove ${g.id}`,children:[i.jsx("span",{className:"truncate",children:g.id}),i.jsx(Dl,{size:13,"aria-hidden":"true"})]},g.id)),v.length===0?i.jsx("span",{className:"text-[0.8rem] text-[var(--color-muted)]",children:"No model selected."}):null]})]}),i.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2 border-t border-[var(--color-line-2)] pt-3",children:[i.jsx("button",{type:"button",onClick:o,className:"tb-button tb-button-md tb-button-secondary",children:"Cancel"}),i.jsx("button",{type:"button",onClick:()=>s(p),"aria-label":"Save selected models","data-testid":"routing-model-picker-done",className:"tb-button tb-button-md tb-button-primary",children:"Save and close"})]})]})}function hw({selectedSellerIds:a,selectedModelIds:l,activeModelId:o,scorer:s,sellers:u,onClose:f,onSave:p}){const[h,v]=S.useState(""),[x,y]=S.useState(a),[g,j]=S.useState({key:"discount",direction:"asc"}),[N,T]=S.useState(1),E=S.useMemo(()=>lm(u,l,s),[s,l,u]),D=S.useMemo(()=>new Set(E.map(J=>J.id)),[E]),R=S.useMemo(()=>x.map(J=>u.find(se=>se.id===J)).filter(dc).filter(J=>D.has(J.id)),[D,x,u]),L=S.useMemo(()=>E.filter(J=>xb(h,[J.name,J.id,J.paymentMethods.join(" "),J.health,J.notes.join(" ")])),[E,h]),H=S.useMemo(()=>gw(L,g.key,g.direction),[L,g.direction,g.key]),P=10,G=Math.max(1,Math.ceil(H.length/P)),Q=Math.min(N,G),q=H.slice((Q-1)*P,Q*P),W=H.length===0?0:(Q-1)*P+1,I=Math.min(Q*P,H.length);S.useEffect(()=>{T(1)},[h,g.direction,g.key]),S.useEffect(()=>{N>G&&T(G)},[N,G]);function ne(J){y(se=>se.includes(J)?se.filter(ge=>ge!==J):[...se,J])}function F(J){j(se=>({key:J,direction:se.key===J&&se.direction==="asc"?"desc":"asc"}))}return i.jsxs(yc,{title:"Select custom nodes",onClose:f,children:[i.jsx(rm,{value:h,onChange:v,placeholder:"Search nodes, payment, notes"}),i.jsx("div",{className:"mt-3 overflow-hidden rounded-[12px] border border-[var(--color-line-2)]",children:i.jsxs("table",{className:"w-full border-collapse text-left text-[0.82rem]",children:[i.jsx("thead",{className:"bg-white/70 text-[0.7rem] uppercase tracking-wider text-[var(--color-muted)]",children:i.jsxs("tr",{children:[i.jsx("th",{className:"w-16 px-3 py-2 font-semibold",children:"Select"}),i.jsx(Ir,{label:"Node",sortKey:"seller",activeSort:g,onSort:F}),i.jsx(Ir,{label:"Status",sortKey:"status",activeSort:g,onSort:F}),i.jsx(Ir,{label:"Disc",sortKey:"discount",align:"right",activeSort:g,onSort:F}),i.jsx(Ir,{label:"Price",sortKey:"price",align:"right",activeSort:g,onSort:F}),i.jsx(Ir,{label:"Payment",sortKey:"payment",activeSort:g,onSort:F}),i.jsx(Ir,{label:"Speed",sortKey:"speed",align:"right",activeSort:g,onSort:F})]})}),i.jsxs("tbody",{className:"divide-y divide-[var(--color-line-2)] bg-white",children:[q.map(J=>{const se=x.includes(J.id),ge=o?J.priceByModelId[o]??J.price:J.price;return i.jsxs("tr",{onClick:()=>ne(J.id),className:["cursor-pointer",se?"bg-[var(--color-lavender)]/70":"hover:bg-[var(--color-lavender)]/35"].join(" "),children:[i.jsx("td",{className:"px-3 py-2.5",children:i.jsx(pb,{active:se,fixed:!1})}),i.jsxs("td",{className:"px-3 py-2.5",children:[i.jsx("div",{className:"font-semibold text-[var(--color-ink)]",children:J.name}),i.jsx("div",{className:"mt-0.5 font-mono text-[0.68rem] text-[var(--color-muted)]",children:Rs(J.id)})]}),i.jsx("td",{className:"px-3 py-2.5",children:i.jsx(hb,{seller:J,current:!1})}),i.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono font-semibold text-[var(--color-purple)]",children:J.discount}),i.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono text-[var(--color-ink)]",children:ge}),i.jsx("td",{className:"px-3 py-2.5 text-[var(--color-muted)]",children:J.paymentMethods.join(", ")}),i.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right text-[var(--color-ink)]",children:i.jsx(bc,{ttftMs:J.latencyMs,tokensPerSecond:J.tokensPerSecond})})]},J.id)}),H.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:7,className:"px-3 py-8 text-center text-[var(--color-muted)]",children:"No nodes found."})}):null]})]})}),H.length>P?i.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2 text-[0.74rem] text-[var(--color-muted)]",children:[i.jsxs("span",{children:["Showing ",Se(W),"-",Se(I)," of ",Se(H.length)]}),i.jsxs("div",{className:"inline-flex items-center gap-1",children:[i.jsx("button",{type:"button",onClick:()=>T(J=>Math.max(1,J-1)),disabled:Q<=1,className:"tb-button tb-button-sm tb-button-secondary disabled:opacity-45",children:"Previous"}),i.jsxs("span",{className:"min-w-16 text-center font-mono text-[0.72rem] font-semibold text-[var(--color-ink)]",children:[Q," / ",G]}),i.jsx("button",{type:"button",onClick:()=>T(J=>Math.min(G,J+1)),disabled:Q>=G,className:"tb-button tb-button-sm tb-button-secondary disabled:opacity-45",children:"Next"})]})]}):null,i.jsxs("div",{className:"mt-3 rounded-[12px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2.5",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs("div",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:["Selected ",R.length]}),R.length>0?i.jsx("button",{type:"button",onClick:()=>y(J=>J.filter(se=>!D.has(se))),className:"ml-auto text-[0.74rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-purple)]",children:"Clear"}):null]}),i.jsxs("div",{className:"mt-2 flex min-h-8 flex-wrap gap-2",children:[R.map(J=>i.jsxs("button",{type:"button",onClick:()=>ne(J.id),className:"inline-flex max-w-full items-center gap-1.5 rounded-full border border-[var(--color-line-2)] bg-white px-2.5 py-1 text-[0.76rem] font-semibold text-[var(--color-ink)] shadow-[0_1px_4px_rgba(60,41,112,0.06)] transition hover:border-[var(--color-purple)] hover:text-[var(--color-purple)]",title:`Remove ${J.name}`,children:[i.jsx("span",{className:"truncate",children:J.name}),i.jsx(Dl,{size:13,"aria-hidden":"true"})]},J.id)),R.length===0?i.jsx("span",{className:"text-[0.8rem] text-[var(--color-muted)]",children:"No node selected."}):null]})]}),i.jsxs("div",{className:"mt-3 flex justify-end gap-2 border-t border-[var(--color-line-2)] pt-3",children:[i.jsx("button",{type:"button",onClick:f,className:"tb-button tb-button-md tb-button-secondary",children:"Cancel"}),i.jsx("button",{type:"button",onClick:()=>p(x),className:"tb-button tb-button-md tb-button-primary",children:"Save and close"})]})]})}function $x({provider:a,onClose:l,onSave:o}){var Q;const s=!!a,[u,f]=S.useState((a==null?void 0:a.name)??""),[p,h]=S.useState((a==null?void 0:a.baseUrl)??""),[v,x]=S.useState(""),[y,g]=S.useState(null),j=s?{status:"passed",message:`${Se(((Q=a==null?void 0:a.models)==null?void 0:Q.length)??0)} existing models.`,modelIds:(a==null?void 0:a.models)??[],supportedProtocols:(a==null?void 0:a.supportedProtocols)??[],baseUrl:(a==null?void 0:a.baseUrl)??"",apiKey:""}:{status:"idle",message:"Probe required before adding.",modelIds:[],supportedProtocols:[],baseUrl:"",apiKey:""},[N,T]=S.useState(j),E=p.trim(),D=v.trim(),R=E.length>0&&D.length>0&&N.status!=="checking",L=N.status==="passed"&&N.baseUrl===E&&N.apiKey===D,H=s?u.trim().length>0&&E.length>0&&(D.length===0||L&&N.modelIds.length>0&&N.supportedProtocols.length>0):L&&N.modelIds.length>0&&N.supportedProtocols.length>0;function P(){var q;if(s&&v.trim().length===0){T({status:"passed",message:`${Se(((q=a==null?void 0:a.models)==null?void 0:q.length)??0)} existing models.`,modelIds:(a==null?void 0:a.models)??[],supportedProtocols:(a==null?void 0:a.supportedProtocols)??[],baseUrl:(a==null?void 0:a.baseUrl)??"",apiKey:""});return}T({status:"idle",message:s?"Probe required when replacing the key.":"Probe required before adding.",modelIds:[],supportedProtocols:[],baseUrl:"",apiKey:""})}async function G(){if(R){g(null),T({status:"checking",message:"Reading model list...",modelIds:[],supportedProtocols:[],baseUrl:E,apiKey:D});try{const q=await Lj({baseUrl:E,apiKey:D});T({status:"passed",message:`${Se(q.modelIds.length)} models · ${vw(q.supportedProtocols)}.`,modelIds:q.modelIds,supportedProtocols:q.supportedProtocols,baseUrl:E,apiKey:D})}catch(q){T({status:"failed",message:q instanceof Error?q.message:"Model list request failed.",modelIds:[],supportedProtocols:[],baseUrl:E,apiKey:D})}}}return i.jsxs(yc,{title:s?`Edit endpoint · ${(a==null?void 0:a.name)??""}`:"Add endpoint",onClose:l,children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx(Xd,{label:"Name",value:u,onChange:f,placeholder:"My endpoint"}),i.jsx(Xd,{label:"Base URL",value:p,onChange:q=>{h(q),P()},placeholder:"https://api.example.com/v1"}),i.jsx(Xd,{label:"API key",value:v,onChange:q=>{var W;x(q),q.trim().length===0&&s?T({status:"passed",message:`${Se(((W=a==null?void 0:a.models)==null?void 0:W.length)??0)} existing models.`,modelIds:(a==null?void 0:a.models)??[],supportedProtocols:(a==null?void 0:a.supportedProtocols)??[],baseUrl:(a==null?void 0:a.baseUrl)??"",apiKey:""}):P()},placeholder:s?"Leave blank to keep existing key":"sk-...",type:"password"}),i.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2.5",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:["inline-flex h-7 items-center rounded-full px-2.5 text-[0.7rem] font-semibold ring-1",N.status==="passed"?"bg-emerald-50 text-emerald-700 ring-emerald-100":N.status==="failed"?"bg-rose-50 text-rose-700 ring-rose-100":"bg-white text-[var(--color-muted)] ring-[var(--color-line-2)]"].join(" "),children:N.message}),i.jsx("button",{type:"button",onClick:G,disabled:!R,className:"tb-button tb-button-sm tb-button-secondary ml-auto",children:s?"Probe new key":"Probe models"})]}),L||s&&N.status==="passed"?i.jsxs("div",{className:"mt-2 space-y-2",children:[i.jsx("div",{className:"flex flex-wrap gap-1.5",children:N.supportedProtocols.map(q=>i.jsx("span",{className:"rounded-full bg-emerald-50 px-2 py-0.5 font-mono text-[0.68rem] font-semibold text-emerald-700 ring-1 ring-emerald-100",children:q},q))}),i.jsx("div",{className:"flex flex-wrap gap-1.5",children:N.modelIds.map(q=>i.jsx("span",{className:"rounded-full bg-white px-2 py-0.5 font-mono text-[0.68rem] text-[var(--color-muted)] ring-1 ring-[var(--color-line-2)]",children:q},q))})]}):null]}),y?i.jsx("div",{className:"rounded-[10px] border border-rose-100 bg-rose-50 px-3 py-2 text-[0.78rem] font-semibold text-rose-700",children:y}):null]}),i.jsxs("div",{className:"mt-4 flex justify-end gap-2 border-t border-[var(--color-line-2)] pt-3",children:[i.jsx("button",{type:"button",onClick:l,className:"tb-button tb-button-md tb-button-secondary",children:"Cancel"}),i.jsx("button",{type:"button",onClick:async()=>{if(H){g(null);try{await o({name:u,baseUrl:p,apiKey:v})}catch(q){g(q instanceof Error?q.message:String(q))}}},disabled:!H,className:"tb-button tb-button-md tb-button-primary",children:s?"Save":"Add"})]})]})}function pw({provider:a,onClose:l}){var p;const[o,s]=S.useState(""),u=o.trim().toLowerCase(),f=(a.models??[]).filter(h=>h.toLowerCase().includes(u));return i.jsxs(yc,{title:`Models · ${a.name}`,onClose:l,children:[i.jsxs("div",{className:"space-y-3",children:[i.jsx(rm,{value:o,onChange:s,placeholder:"Search models"}),i.jsxs("div",{className:"rounded-[12px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2",children:[i.jsxs("div",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:[Se(f.length)," of ",Se(((p=a.models)==null?void 0:p.length)??0)," models"]}),i.jsxs("div",{className:"mt-2 flex max-h-[320px] flex-wrap gap-1.5 overflow-y-auto",children:[f.map(h=>i.jsx("span",{className:"rounded-full bg-white px-2 py-1 font-mono text-[0.72rem] text-[var(--color-muted)] ring-1 ring-[var(--color-line-2)]",children:h},h)),f.length===0?i.jsx("span",{className:"text-[0.82rem] text-[var(--color-muted)]",children:"No models found."}):null]})]})]}),i.jsx("div",{className:"mt-4 flex justify-end border-t border-[var(--color-line-2)] pt-3",children:i.jsx("button",{type:"button",onClick:l,className:"tb-button tb-button-md tb-button-secondary",children:"Close"})})]})}function vw(a){return a.length>0?a.join(", "):"no protocols"}function Xd({label:a,value:l,onChange:o,placeholder:s,type:u="text"}){return i.jsxs("label",{className:"block",children:[i.jsx("span",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:a}),i.jsx("input",{value:l,type:u,onChange:f=>o(f.target.value),placeholder:s,className:"mt-1 h-10 w-full rounded-[9px] border border-[var(--color-line-2)] bg-white px-3 font-mono text-[0.84rem] text-[var(--color-ink)] outline-none transition placeholder:text-[var(--color-faint)] focus:border-[var(--color-purple)]"})]})}function yc({title:a,children:l,onClose:o}){return i.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-[#201a38]/35 px-4 py-6 backdrop-blur-sm",children:i.jsxs("div",{className:"max-h-[86dvh] w-full max-w-[820px] overflow-hidden rounded-[14px] border border-[var(--color-line-2)] bg-white shadow-[0_24px_70px_rgba(32,26,56,0.22)]",children:[i.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--color-line-2)] px-5 py-4",children:[i.jsx("div",{className:"min-w-0 flex-1 truncate text-[1rem] font-semibold text-[var(--color-ink)]",children:a}),i.jsx("button",{type:"button",onClick:o,className:"tb-button tb-button-icon tb-button-quiet","aria-label":"Close",children:i.jsx(Dl,{size:16})})]}),i.jsx("div",{className:"max-h-[calc(86dvh-65px)] overflow-auto p-4",children:l})]})})}function xw({enabled:a,paymentMethod:l}){return i.jsxs("span",{className:["inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[0.72rem] ring-1",a?"bg-emerald-50 text-emerald-700 ring-emerald-100":"bg-slate-100 text-slate-500 ring-slate-200"].join(" "),children:[a?i.jsx(xj,{size:12}):i.jsx(xf,{size:12}),l," ",a?"enabled":"not enabled"]})}function pb({active:a,fixed:l}){return i.jsx("span",{className:["inline-flex size-5 shrink-0 items-center justify-center border",l?"rounded-full":"rounded-[6px]",a?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line)] bg-white text-transparent"].join(" "),children:i.jsx(Kt,{size:13,strokeWidth:2.4})})}function Ir({label:a,sortKey:l,activeSort:o,align:s="left",onSort:u}){const f=o.key===l;return i.jsx("th",{className:["px-3 py-2 font-semibold",s==="right"?"text-right":""].join(" "),children:i.jsxs("button",{type:"button",onClick:()=>u(l),className:["inline-flex items-center gap-1 transition hover:text-[var(--color-primary-deep)]",s==="right"?"justify-end":"",f?"text-[var(--color-primary-deep)]":""].join(" "),children:[i.jsx("span",{children:a}),i.jsx("span",{className:["font-mono text-[0.58rem]",f?"opacity-100":"opacity-35"].join(" "),children:f?o.direction==="asc"?"↑":"↓":"↕"})]})})}function gw(a,l,o){return[...a].sort((s,u)=>l==="seller"?jl(s.name,u.name):l==="status"?jl(Nf(s).label,Nf(u).label)||jl(s.name,u.name):l==="discount"?Jo(s.discountRatio,u.discountRatio,o)||jl(s.name,u.name):l==="price"?Jo(s.inputPriceMicrosPer1m,u.inputPriceMicrosPer1m,o)||jl(s.name,u.name):l==="payment"?jl(s.paymentMethods.join(", "),u.paymentMethods.join(", "))||jl(s.name,u.name):Jo(s.latencyMs,u.latencyMs,o)||Jo(u.tokensPerSecond,s.tokensPerSecond,o)||jl(s.name,u.name))}function lm(a,l,o){return[...a].sort((s,u)=>{const f=Kx(s,l),p=Kx(u,l);return f!==p?p-f:o==="speed"?wf(s.latencyMs,u.latencyMs)||Tw(s.tokensPerSecond,u.tokensPerSecond):o==="discount"?wf(s.discountRatio,u.discountRatio):u.healthScore-s.healthScore})}function bw(a,l){const o=new Map;for(const u of a){const f=o.get(u.id)??{sellerIds:new Set,paymentMethods:new Set};f.sellerIds.add(u.sellerId);for(const p of u.paymentMethods)f.paymentMethods.add(p);o.set(u.id,f)}const s=new Map(l.map((u,f)=>[u,f]));return Array.from(o.entries()).map(([u,f])=>({id:u,paymentMethod:Array.from(f.paymentMethods)[0]??Me,enabled:f.sellerIds.size>0,sellerCount:f.sellerIds.size})).sort((u,f)=>{const p=s.get(u.id),h=s.get(f.id);return p!==void 0||h!==void 0?(p??9999)-(h??9999):u.id.localeCompare(f.id)})}function yw({focusModels:a,referencedModelIds:l,modelOptions:o}){const s=new Set(o.map(f=>f.id)),u=a.filter(f=>s.has(f));return u.length>0?u:l.filter(f=>s.has(f))}function Sw({base:a,enabled:l,range:o,scorer:s,modelIds:u,sellerIds:f}){return{enabled:l,range:o,scorer:s,modelIds:Array.from(new Set(u)),sellerIds:Array.from(new Set(f)),maxConcurrentProviders:10,updatedAt:(a==null?void 0:a.updatedAt)??new Date().toISOString()}}function jw(a){const l=new Set;return[...a].sort((o,s)=>Ew(o.createdAt,s.createdAt)).flatMap(o=>!o.modelId||l.has(o.modelId)?[]:(l.add(o.modelId),[o.modelId]))}function Nw(a,l){const o=new Map;for(const s of l){if(!s.sellerKey)continue;const u=o.get(s.sellerKey)??Hx();(!u.lastAccessAt||ei(s.createdAt)>ei(u.lastAccessAt))&&(u.lastAccessAt=s.createdAt),u.requestCount+=1,u.modelIds.includes(s.modelId)||u.modelIds.push(s.modelId),s.billingUnit!=="images"&&s.endpoint!=="/v1/images/generations"&&(u.inputTokens+=Sl(s.promptTokens)??0,u.outputTokens+=Sl(s.completionTokens)??0),u.totalSpendMicros+=Sl(s.settledUsdMicros)??Sl(s.billedMicros)??Sl(s.estimatedMicros)??0;const f=Sl(s.ttftMs);f!==void 0&&(u.ttftTotal+=f,u.ttftCount+=1);const p=Sl(s.durationMs),h=Sl(s.completionTokens)??0;p!==void 0&&p>0&&h>0&&(u.speedOutputTokens+=h,u.speedDurationMs+=p),o.set(s.sellerKey,u)}for(const s of a){if(!s.currentSellerId||s.currentSellerId===Me)continue;const u=o.get(s.currentSellerId)??Hx();u.current=!0,s.lastAccessAt&&(!u.lastAccessAt||ei(s.lastAccessAt)>ei(u.lastAccessAt))&&(u.lastAccessAt=s.lastAccessAt),u.modelIds.includes(s.modelId)||u.modelIds.push(s.modelId),o.set(s.currentSellerId,u)}return new Map(Array.from(o.entries()).map(([s,u])=>{const{ttftTotal:f,ttftCount:p,speedOutputTokens:h,speedDurationMs:v,...x}=u;return[s,{...x,averageTtftMs:p>0?f/p:void 0,tokensPerSecond:v>0?h/(v/1e3):void 0}]}))}function Hx(){return{current:!1,modelIds:[],requestCount:0,inputTokens:0,outputTokens:0,totalSpendMicros:0,ttftTotal:0,ttftCount:0,speedOutputTokens:0,speedDurationMs:0}}function Sl(a){return Number.isFinite(a)?a:void 0}function ww(a,l,o){const s=(l==null?void 0:l.data)??[],u=new Map(a.map(v=>[v.id,v])),f=new Map(((l==null?void 0:l.sellers)??[]).map(v=>[v.id,v])),p=new Map(o.map(v=>[v.seller.id,v])),h=new Set([...a.map(v=>v.id),...((l==null?void 0:l.sellers)??[]).map(v=>v.id),...s.map(v=>v.sellerId)]);return Array.from(h).map((v,x)=>{const y=u.get(v),g=p.get(v),j=f.get(v),N=s.filter(ne=>ne.sellerId===v),T=N[0],E=Array.from(new Set(N.map(ne=>ne.id))),D=Qx(N.map(ne=>ne.inputPriceMicrosPer1m)),R=Qx(N.map(ne=>ne.outputPriceMicrosPer1m)),L=Object.fromEntries(N.map(ne=>[ne.id,yf(ne.inputPriceMicrosPer1m,ne.outputPriceMicrosPer1m)])),H=(g==null?void 0:g.metrics.ttftMs)??(j==null?void 0:j.ttftMs)??(g==null?void 0:g.metrics.avgLatencyMs),P=(g==null?void 0:g.metrics.avgTokensPerSecond)??(j==null?void 0:j.avgTokensPerSecond),G=g==null?void 0:g.metrics.healthScore,Q=(g==null?void 0:g.metrics.discountRatio)??(j==null?void 0:j.discountRatio),q=(g==null?void 0:g.metrics.routeState)??(j==null?void 0:j.routeState),W=Px([...(j==null?void 0:j.paymentMethods)??[],...(y==null?void 0:y.paymentMethods)??[],...N.flatMap(ne=>ne.paymentMethods)]),I=Px([...(y==null?void 0:y.supportedProtocols)??[],...(j==null?void 0:j.supportedProtocols)??[],...(T==null?void 0:T.supportedProtocols)??[]]);return{id:v,name:kw((y==null?void 0:y.name)??(j==null?void 0:j.name)??(T==null?void 0:T.sellerName)??v),endpoint:(y==null?void 0:y.url)??(j==null?void 0:j.url)??(T==null?void 0:T.sellerUrl)??"",routeState:q,health:q?Mw(q):(j==null?void 0:j.status)==="error"||(j==null?void 0:j.status)==="manifest_unavailable"||(y==null?void 0:y.status)==="failed"?"offline":(y==null?void 0:y.status)==="degraded"?"degraded":"online",healthScore:Number.isFinite(G)?Math.round(G):0,coverageModelIds:E,paymentMethods:W,discountRatio:Q,discount:Wf(Q),price:yf(D,R),priceByModelId:L,inputPriceMicrosPer1m:D,outputPriceMicrosPer1m:R,latencyMs:Number.isFinite(H)?Math.round(H):void 0,tokensPerSecond:P,lastInspectAt:j==null?void 0:j.lastModelInspectionAt,notes:[I.join(", ")||"no protocols",`${j?"catalog":"registry"} #${x+1}`]}})}function Mw(a){return a==="error"?"offline":a==="degraded"||a==="cooldown"||a==="full"?"degraded":"online"}function Qx(a){const l=a.filter(o=>Number.isFinite(o));if(l.length!==0)return Math.min(...l)}function Px(a){return Array.from(new Set(a.filter(l=>l.trim().length>0)))}function Cw(a){if(a)return a.plan??{routes:a.routes,mode:a.mode,scorer:a.scorer,reason:a.reason}}function Kx(a,l){return l.length===0?a.coverageModelIds.length:l.filter(o=>a.coverageModelIds.includes(o)).length}function jl(a,l){return a.localeCompare(l,void 0,{sensitivity:"base",numeric:!0})}function wf(a,l){const o=Number.isFinite(a),s=Number.isFinite(l);return o&&s?a-l:o?-1:s?1:0}function Tw(a,l){return wf(l,a)}function Jo(a,l,o){const s=Number.isFinite(a),u=Number.isFinite(l);return!s&&!u?0:s?u?o==="asc"?a-l:l-a:-1:1}function Aw(a){return Object.entries(a??{}).sort(([l],[o])=>l.localeCompare(o)).map(([l,o])=>`${l}:${o}`).join(",")}function Ew(a,l){return ei(l)-ei(a)}function ei(a){const l=new Date(a).getTime();return Number.isNaN(l)?0:l}function kw(a){var l;return((l=a.split("(")[0])==null?void 0:l.trim())||a}function Rw(a,l,o){const s=l.length===0?a:a.filter(u=>l.some(f=>u.coverageModelIds.includes(f)));return lm(s,l,o)}function zw(a){var p;const l=new Map(a.map(h=>[Wn(h.method),h])),s=Array.from(new Set([...FN,...a.map(h=>Wn(h.method)).filter(h=>h&&h!=="mock")])).map(h=>{const v=l.get(h),x=!!v&&((v==null?void 0:v.enabled)===!0||vb(v==null?void 0:v.config,"walletConfigPresent"));return{method:h,label:_w(h),configured:x,selected:x&&(v==null?void 0:v.isDefault)===!0}}),u=s.filter(h=>h.configured),f=s.find(h=>h.selected)??u[0];return f&&!f.selected&&(f.selected=!0),u.length===0?{active:!1,count:0,label:"No payment",options:s}:{active:!0,count:u.length,label:u.length===1?((p=u[0])==null?void 0:p.label)??"Payment ready":`${u.length} payments`,options:s,activeMethod:f==null?void 0:f.method}}function _w(a){const l=Wn(a);return l==="clawtip"?"ClawTip":l==="alipay-agent"?"Alipay":l==="wechat-pay"?"WeChat":l==="coinbase-smart-wallet"?"Coinbase":a.split(/[-_\s]+/).filter(Boolean).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" ")}function Wn(a){return a.trim().toLowerCase()}function vb(a,l){const o=a==null?void 0:a[l];return o===!0||o==="true"||o===1||o==="1"}function rm({value:a,onChange:l,placeholder:o}){return i.jsxs("label",{className:"flex items-center gap-2 rounded-[12px] border border-[var(--color-line-2)] bg-white px-3 py-2 text-[0.84rem] text-[var(--color-muted)]",children:[i.jsx(Es,{size:15}),i.jsx("input",{name:"routing-search",value:a,onChange:s=>l(s.target.value),placeholder:o,className:"min-w-0 flex-1 bg-transparent font-mono text-[0.84rem] text-[var(--color-ink)] outline-none placeholder:text-[var(--color-faint)]"})]})}function xb(a,l){const o=a.trim().toLowerCase();return o?l.some(s=>s.toLowerCase().includes(o)):!0}function dc(a){return a!==void 0}function Ow(a,l){const o=bb(l),s=gb(a,o);if(o<=7)return Array.from({length:o},(p,h)=>h+1);const u=[],f=p=>{u[u.length-1]!==p&&u.push(p)};f(1),s>4&&f("…");for(let p=Math.max(2,s-1);p<=Math.min(o-1,s+1);p++)f(p);return s<o-3&&f("…"),f(o),u}function gb(a,l){return Number.isFinite(a)?Math.max(1,Math.min(bb(l),Math.floor(a))):1}function Dw(a,l){return Number.isFinite(a)&&a>0?Math.floor(a):Math.max(1,l[0]??25)}function bb(a){return!Number.isFinite(a)||a<1?1:Math.floor(a)}function yb({totalItems:a,pageSize:l,page:o,onPageChange:s,onPageSizeChange:u,pageSizeOptions:f=[25,50,100]}){const p=Dw(l,f),h=Math.max(1,Math.ceil(a/p)),v=gb(o,h),x=S.useMemo(()=>Ow(v,h),[v,h]),[y,g]=S.useState(String(v));if(S.useEffect(()=>{g(String(v))},[v]),S.useEffect(()=>{o!==v&&s(v)},[v,s,o]),a===0)return null;const j=(v-1)*p+1,N=Math.min(v*p,a);return i.jsxs("div",{className:"flex flex-col gap-3 border-t border-[var(--color-line-2)] bg-[var(--color-page)]/60 px-4 py-3 text-[0.85rem] lg:flex-row lg:items-center lg:justify-between",children:[i.jsxs("div",{className:"text-[var(--color-muted)]",children:["Showing ",i.jsx("span",{className:"font-mono font-semibold text-[var(--color-ink)]",children:j}),"-",i.jsx("span",{className:"font-mono font-semibold text-[var(--color-ink)]",children:N})," of"," ",i.jsx("span",{className:"font-mono font-semibold text-[var(--color-ink)]",children:a})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("label",{className:"text-[0.78rem] text-[var(--color-muted)]",children:"Rows"}),i.jsx("select",{className:"bg-[var(--color-card)] border border-[var(--color-line-2)] rounded px-1.5 py-0.5 text-[0.85rem] text-[var(--color-ink)] focus:outline-none focus:border-[var(--color-purple)]",value:p,onChange:T=>{const E=Math.max(1,Number(T.target.value)||25);u==null||u(E),s(1)},children:f.map(T=>i.jsx("option",{value:T,children:T},T))}),i.jsxs("div",{className:"ml-2 flex items-center gap-1",children:[i.jsx("button",{type:"button",disabled:v<=1,onClick:()=>s(1),className:"tb-button tb-button-sm tb-button-secondary min-w-8 px-2",title:"First page","aria-label":"First page",children:"«"}),i.jsx("button",{type:"button",disabled:v<=1,onClick:()=>s(v-1),className:"tb-button tb-button-sm tb-button-secondary min-w-8 px-2",title:"Previous page","aria-label":"Previous page",children:"‹"}),x.map((T,E)=>T==="…"?i.jsx("span",{className:"px-1.5 text-[var(--color-muted)]",children:"…"},`gap-${E}`):i.jsx("button",{type:"button",onClick:()=>s(T),"aria-label":`Page ${T}`,"aria-current":T===v?"page":void 0,className:T===v?"tb-button tb-button-sm tb-button-primary min-w-8 px-2.5":"tb-button tb-button-sm tb-button-secondary min-w-8 px-2.5",children:T},T)),i.jsx("button",{type:"button",disabled:v>=h,onClick:()=>s(v+1),className:"tb-button tb-button-sm tb-button-secondary min-w-8 px-2",title:"Next page","aria-label":"Next page",children:"›"}),i.jsx("button",{type:"button",disabled:v>=h,onClick:()=>s(h),className:"tb-button tb-button-sm tb-button-secondary min-w-8 px-2",title:"Last page","aria-label":"Last page",children:"»"}),i.jsx("span",{className:"ml-2 text-[0.78rem] text-[var(--color-muted)]",children:"Go to"}),i.jsx("input",{type:"number",min:1,max:h,value:y,"aria-label":"Go to page",onChange:T=>g(T.target.value),onKeyDown:T=>{if(T.key==="Enter"){const E=Math.max(1,Math.min(h,Number(T.target.value)||1));g(String(E)),s(E)}},className:"w-14 bg-[var(--color-card)] border border-[var(--color-line-2)] rounded px-1.5 py-0.5 text-[0.85rem] text-[var(--color-ink)] text-center focus:outline-none focus:border-[var(--color-purple)]"}),i.jsx("span",{className:"text-[0.78rem] text-[var(--color-muted)]",children:"page"})]})]})]})}function Uw(a,l,o=new Date){const s=Lw(o);return{inferenceTokens:s.map(u=>({key:u.key,label:u.label,inputTokens:Yx(a,u,"promptTokens"),outputTokens:Yx(a,u,"completionTokens")})),imageGenerations:s.map(u=>({key:u.key,label:u.label,imageCount:Bw(a,u),requestCount:qw(a,u)})),purchaseSpend:s.map(u=>({key:u.key,label:u.label,paymentTotals:$w(l,u),purchaseCount:Hw(l,u)}))}}function Lw(a){const l=new Date(a.getFullYear(),a.getMonth(),a.getDate()),o=new Date(l);o.setDate(l.getDate()-(l.getDay()+6)%7);const s=new Date(a.getFullYear(),a.getMonth(),1);return[{key:"today",label:"Today",start:l},{key:"week",label:"This week",start:o},{key:"month",label:"This month",start:s},{key:"total",label:"Total"}]}function Yx(a,l,o){return a.reduce((s,u)=>!_s(u.createdAt,l)||im(u)?s:s+(u[o]??0),0)}function Bw(a,l){return a.reduce((o,s)=>!_s(s.createdAt,l)||!im(s)?o:o+(Number.isFinite(s.imageCount)?s.imageCount:1),0)}function qw(a,l){return a.reduce((o,s)=>!_s(s.createdAt,l)||!im(s)?o:o+1,0)}function im(a){return a.billingUnit==="images"||a.endpoint==="/v1/images/generations"}function $w(a,l){const o=a.reduce((s,u)=>{if(!_s(u.completedAt??u.createdAt,l)||!u.paymentCurrency||!Number.isFinite(u.paymentAmountMinor))return s;const f=u.paymentCurrency.trim().toUpperCase();return f&&s.set(f,(s.get(f)??0)+Math.round(u.paymentAmountMinor)),s},new Map);return Array.from(o.entries()).map(([s,u])=>({paymentCurrency:s,paymentAmountMinor:u})).sort((s,u)=>s.paymentCurrency.localeCompare(u.paymentCurrency))}function Hw(a,l){return a.reduce((o,s)=>_s(s.completedAt??s.createdAt,l)?o+1:o,0)}function _s(a,l){if(!l.start)return!0;if(!a)return!1;const o=new Date(a);return Number.isNaN(o.getTime())?!1:o>=l.start}function Qw(){var fe,O,te,re;const{language:a}=hr(),l=Z=>vN(Z,a),o=vc(),s=Tj(),u=Zf(),f=Jf(),p=ks(),[h,v]=S.useState("inferences"),[x,y]=S.useState(""),[g,j]=S.useState("all"),[N,T]=S.useState(1),[E,D]=S.useState(1),[R,L]=S.useState(25),H=o.isLoading||s.isLoading,P=((fe=o.data)==null?void 0:fe.inferences)??[],G=((O=s.data)==null?void 0:O.purchases)??[],Q=x.trim().toLowerCase(),q=S.useMemo(()=>Uw(P,G),[P,G]),W=S.useMemo(()=>Iw(P),[P]),I=S.useMemo(()=>{var Z,he;return nM({manualProviders:(Z=u.data)==null?void 0:Z.providers,modelsResponse:p.data,registrySellers:(he=f.data)==null?void 0:he.sellers})},[(te=u.data)==null?void 0:te.providers,p.data,(re=f.data)==null?void 0:re.sellers]),ne=S.useMemo(()=>P.filter(Z=>g!=="all"&&Z.modelId!==g?!1:eM(Z,Q,I)).sort((Z,he)=>he.createdAt.localeCompare(Z.createdAt)),[P,g,I,Q]),F=S.useMemo(()=>G.filter(Z=>tM(Z,Q,I)).sort((Z,he)=>he.createdAt.localeCompare(Z.createdAt)),[I,G,Q]),J=S.useMemo(()=>Vx(ne,N,R),[ne,N,R]),se=S.useMemo(()=>Vx(F,E,R),[F,E,R]),ge=o.isError||s.isError;return S.useEffect(()=>{const Z=Math.max(1,Math.ceil(ne.length/R));N>Z&&T(Z)},[ne.length,N,R]),S.useEffect(()=>{const Z=Math.max(1,Math.ceil(F.length/R));E>Z&&D(Z)},[F.length,R,E]),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("section",{className:"grid gap-3 xl:grid-cols-2",children:[i.jsx(Tx,{icon:i.jsx(gs,{className:"size-5"}),label:"Inference tokens",tone:"tokens",rows:q.inferenceTokens.map(Z=>({key:Z.key,label:l(Z.label),value:ac(Z.inputTokens+Z.outputTokens),detail:l(`In ${Se(Z.inputTokens)} / Out ${Se(Z.outputTokens)}`)}))}),i.jsx(Tx,{icon:i.jsx(hs,{className:"size-5"}),label:"Token purchase spend",tone:"spend",rows:q.purchaseSpend.map(Z=>({key:Z.key,label:l(Z.label),value:aM(Z.paymentTotals),detail:l(`${Se(Z.purchaseCount)} purchases`)}))})]}),i.jsxs(_t,{className:"overflow-hidden p-0",children:[i.jsxs("div",{className:"border-b border-[var(--color-line-2)] bg-white px-4 py-3",children:[i.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between",children:[i.jsx("div",{children:i.jsx("h1",{className:"text-[1.05rem] font-semibold text-[var(--color-ink)]",children:l("Usage details")})}),i.jsxs("div",{className:"grid grid-cols-2 overflow-hidden rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-1",children:[i.jsx(Gx,{label:l("Inferences"),active:h==="inferences",count:ne.length,onClick:()=>v("inferences"),children:l("Inferences")}),i.jsx(Gx,{label:l("Purchases"),active:h==="purchases",count:F.length,onClick:()=>v("purchases"),children:l("Purchases")})]})]}),i.jsxs("div",{className:["mt-3 grid gap-2",h==="inferences"?"lg:grid-cols-[minmax(220px,1fr)_200px]":"lg:grid-cols-1"].join(" "),children:[i.jsxs("label",{className:"relative block",children:[i.jsx(Es,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-[var(--color-muted)]"}),i.jsx("input",{className:"h-9 w-full rounded-[8px] border border-[var(--color-line-2)] bg-white pl-9 pr-3 text-[0.86rem] text-[var(--color-ink)] outline-none transition placeholder:text-[var(--color-muted)] focus:border-[var(--color-purple)]",value:x,placeholder:l(h==="inferences"?"Search model, node...":"Search node..."),onChange:Z=>{y(Z.target.value),T(1),D(1)}})]}),h==="inferences"?i.jsx(Pw,{label:l("Model"),allLabel:l("All model"),value:g,options:W.models,translateOption:l,onChange:Z=>{j(Z),T(1)}}):null]})]}),ge?i.jsx("div",{className:"border-b border-rose-100 bg-rose-50 px-4 py-3 text-[0.86rem] text-rose-700",children:"Ledger data could not be loaded. The local daemon may be offline or missing ledger endpoints."}):null,H?i.jsx(Gw,{}):h==="inferences"?i.jsx(Kw,{entries:J,nodeNameById:I,total:ne.length,page:N,pageSize:R,onPageChange:T,onPageSizeChange:Z=>{L(Z),T(1),D(1)}}):i.jsx(Yw,{entries:se,nodeNameById:I,total:F.length,page:E,pageSize:R,onPageChange:D,onPageSizeChange:Z=>{L(Z),T(1),D(1)}})]})]})}function Gx({label:a,active:l,count:o,onClick:s,children:u}){return i.jsxs("button",{type:"button",onClick:s,"aria-label":`${a} ledger records, ${Se(o)} records`,className:["tb-button tb-button-sm gap-2",l?"tb-button-primary":"tb-button-secondary"].join(" "),children:[i.jsx("span",{children:u}),i.jsx("span",{className:"font-mono text-[0.76rem]",children:Se(o)})]})}function Pw({label:a,allLabel:l,value:o,options:s,translateOption:u,onChange:f}){return i.jsxs("label",{className:"grid gap-1",children:[i.jsx("span",{className:"sr-only",children:a}),i.jsxs("select",{"aria-label":a,className:"h-9 rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.86rem] text-[var(--color-ink)] outline-none transition focus:border-[var(--color-purple)]",value:o,onChange:p=>f(p.target.value),children:[i.jsx("option",{value:"all",children:l}),s.map(p=>i.jsx("option",{value:p,children:u(p)},p))]})]})}function Kw({entries:a,nodeNameById:l,total:o,page:s,pageSize:u,onPageChange:f,onPageSizeChange:p}){return o===0?i.jsx(Sb,{label:"inference records"}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"min-w-0 max-w-full overflow-x-auto",children:i.jsxs("table",{className:"w-full min-w-[1080px] text-[0.86rem]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[var(--color-page)]/70 text-left text-[0.7rem] font-semibold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:[i.jsx("th",{className:"px-4 py-2.5",children:"TIME"}),i.jsx("th",{className:"px-4 py-2.5",children:"MODEL"}),i.jsx("th",{className:"px-4 py-2.5",children:"NODE"}),i.jsx("th",{className:"px-4 py-2.5",children:"TOKENS"}),i.jsx("th",{className:"px-4 py-2.5",children:"SPEED"}),i.jsx("th",{className:"px-4 py-2.5",children:"STATUS"}),i.jsx("th",{className:"px-4 py-2.5 text-right",children:"COST"})]})}),a.map(h=>i.jsx("tbody",{children:i.jsxs("tr",{className:"border-t border-[var(--color-line-2)] transition hover:bg-[var(--color-lavender)]/25",children:[i.jsx("td",{className:"whitespace-nowrap px-4 py-3 font-mono text-[0.76rem] text-[var(--color-muted)]",children:gc(h.createdAt)}),i.jsx("td",{className:"max-w-[190px] truncate px-4 py-3 text-[var(--color-ink)]",children:h.modelId}),i.jsx("td",{className:"px-4 py-3",children:i.jsx(jb,{nodeId:h.sellerKey,nodeName:l.get(h.sellerKey)})}),i.jsx("td",{className:"px-4 py-3",children:i.jsx(Vw,{entry:h})}),i.jsx("td",{className:"px-4 py-3",children:i.jsx(bc,{ttftMs:h.ttftMs,tokensPerSecond:Jw(h)})}),i.jsx("td",{className:"px-4 py-3",children:i.jsx(Xw,{status:h.status,source:h.balanceSource,method:h.paymentMethod})}),i.jsx("td",{className:"px-4 py-3 text-right",children:i.jsx(cN,{billingUnit:h.billingUnit,billedMicros:h.billedMicros,settledUsdMicros:h.settledUsdMicros,inputPriceMicrosPer1m:h.inputPriceMicrosPer1m,outputPriceMicrosPer1m:h.outputPriceMicrosPer1m,cacheReadPriceMicrosPer1m:h.cacheReadPriceMicrosPer1m,inputCostMicros:h.inputCostMicros,outputCostMicros:h.outputCostMicros,cacheReadCostMicros:h.cacheReadCostMicros,originalUsdMicros:h.originalUsdMicros,billingMultiplier:h.billingMultiplier,serviceTier:h.serviceTier,imageCount:h.imageCount,imageSize:h.imageSize,imageQuality:h.imageQuality,imageOutputFormat:h.imageOutputFormat,imageOutputTokens:h.imageOutputTokens,imageOutputCostMicros:h.imageOutputCostMicros,imageCostMicrosPerImage:h.imageCostMicrosPerImage})})]})},h.requestId))]})}),i.jsx(yb,{totalItems:o,pageSize:u,page:s,onPageChange:f,onPageSizeChange:p})]})}function Yw({entries:a,nodeNameById:l,total:o,page:s,pageSize:u,onPageChange:f,onPageSizeChange:p}){return o===0?i.jsx(Sb,{label:"purchase records"}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"min-w-0 max-w-full overflow-x-auto",children:i.jsxs("table",{className:"w-full min-w-[940px] text-[0.86rem]",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"bg-[var(--color-page)]/70 text-left text-[0.7rem] font-semibold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:[i.jsx("th",{className:"px-4 py-2.5",children:"TIME"}),i.jsx("th",{className:"px-4 py-2.5",children:"NODE"}),i.jsx("th",{className:"px-4 py-2.5",children:"METHOD"}),i.jsx("th",{className:"px-4 py-2.5 text-right",children:"SPENT"}),i.jsx("th",{className:"px-4 py-2.5 text-right",children:"CREDIT"}),i.jsx("th",{className:"px-4 py-2.5",children:"STATUS"}),i.jsx("th",{className:"px-4 py-2.5",children:"SCOPE"})]})}),a.map(h=>i.jsx("tbody",{children:i.jsxs("tr",{className:"border-t border-[var(--color-line-2)] transition hover:bg-[var(--color-lavender)]/25",children:[i.jsx("td",{className:"whitespace-nowrap px-4 py-3 font-mono text-[0.76rem] text-[var(--color-muted)]",children:gc(h.completedAt??h.createdAt)}),i.jsx("td",{className:"px-4 py-3",children:i.jsx(jb,{nodeId:h.sellerKey,nodeName:l.get(h.sellerKey)})}),i.jsx("td",{className:"px-4 py-3",children:i.jsx(Fw,{method:h.paymentMethod})}),i.jsx("td",{className:"px-4 py-3 text-right font-mono text-[0.82rem] font-semibold text-[var(--color-ink)]",children:Xj(h)}),i.jsx("td",{className:"px-4 py-3 text-right font-mono text-[0.82rem] font-semibold text-emerald-700",children:Vj(h.creditMicros)}),i.jsx("td",{className:"px-4 py-3",children:i.jsx(Nb,{status:h.status})}),i.jsx("td",{className:"max-w-[180px] truncate px-4 py-3 font-mono text-[0.78rem] text-[var(--color-muted)]",title:h.modelId,children:Zw(h.modelId)})]})},h.purchaseId))]})}),i.jsx(yb,{totalItems:o,pageSize:u,page:s,onPageChange:f,onPageSizeChange:p})]})}function Gw(){return i.jsx("div",{className:"space-y-2 px-4 py-4",children:Array.from({length:7},(a,l)=>i.jsx("div",{className:"h-12 rounded-lg bg-[var(--color-lavender)]/35"},l))})}function Sb({label:a}){return i.jsxs("div",{className:"flex min-h-[220px] flex-col items-center justify-center px-6 py-10 text-center",children:[i.jsx("div",{className:"grid size-12 place-items-center rounded-xl border border-[var(--color-line-2)] bg-[var(--color-page)] text-[var(--color-purple)]",children:i.jsx(Es,{className:"size-5"})}),i.jsxs("div",{className:"mt-4 font-semibold text-[var(--color-ink)]",children:["No matching ",a]}),i.jsx("div",{className:"mt-1 max-w-[360px] text-[0.86rem] text-[var(--color-muted)]",children:"Adjust the query or filters to inspect another slice of the local ledger."})]})}function jb({nodeId:a,nodeName:l}){const o=l??a;return i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"max-w-[220px] truncate font-semibold text-[var(--color-ink)]",title:o,children:o}),i.jsx("div",{className:"mt-0.5 font-mono text-[0.68rem] text-[var(--color-muted)]",children:Rs(a)})]})}function Vw({entry:a}){return wb(a)?i.jsx(sN,{imageCount:a.imageCount,imageSize:a.imageSize,imageQuality:a.imageQuality,imageOutputFormat:a.imageOutputFormat}):i.jsx(iN,{inputTokens:a.promptTokens,outputTokens:a.completionTokens,cacheReadTokens:a.cacheReadTokens})}function Xw({status:a,source:l,method:o}){const s=[l,o].filter(u=>!!u);return i.jsxs("div",{className:"grid gap-1",children:[i.jsx(Nb,{status:a}),s.length>0?i.jsx("div",{className:"max-w-[180px] truncate font-mono text-[0.68rem] text-[var(--color-muted)]",title:s.join(" / "),children:s.join(" / ")}):null]})}function Nb({status:a}){const l=ea(a),o={green:"bg-emerald-50 text-emerald-700 ring-emerald-100",amber:"bg-amber-50 text-amber-700 ring-amber-100",red:"bg-rose-50 text-rose-700 ring-rose-100",blue:"bg-blue-50 text-blue-700 ring-blue-100",gray:"bg-slate-100 text-slate-600 ring-slate-200"}[l];return i.jsx("span",{className:["inline-flex h-6 w-fit items-center rounded-full px-2 text-[0.66rem] font-semibold uppercase ring-1",o].join(" "),children:bn(a)})}function Fw({method:a}){return i.jsx("span",{className:"inline-flex max-w-[160px] rounded-full bg-[var(--color-page)] px-2 py-1 font-mono text-[0.72rem] font-semibold text-[var(--color-ink)] ring-1 ring-[var(--color-line-2)]",children:i.jsx("span",{className:"truncate",children:a||"—"})})}function Zw(a){return a||"All models"}function Jw(a){if(!wb(a))return Number.isFinite(a.avgOutputTokensPerSecond)?a.avgOutputTokensPerSecond:void 0}function Iw(a){return{models:Ww(a.map(l=>l.modelId))}}function Ww(a){return Array.from(new Set(a.filter(Boolean))).sort((l,o)=>l.localeCompare(o))}function eM(a,l,o){return l?[a.sellerKey,o.get(a.sellerKey),a.modelId,a.status,a.balanceSource,a.paymentMethod,gc(a.createdAt)].some(s=>s==null?void 0:s.toLowerCase().includes(l)):!0}function tM(a,l,o){return l?[a.sellerKey,o.get(a.sellerKey),a.paymentMethod,a.status,a.modelId,gc(a.createdAt)].some(s=>s==null?void 0:s.toLowerCase().includes(l)):!0}function Vx(a,l,o){const s=(l-1)*o;return a.slice(s,s+o)}function wb(a){return a.billingUnit==="images"||a.endpoint==="/v1/images/generations"}function nM({manualProviders:a,modelsResponse:l,registrySellers:o}){const s=new Map;for(const u of o??[])s.set(u.id,Io(u.name??u.id));for(const u of(l==null?void 0:l.sellers)??[])s.set(u.id,Io(u.name??u.id));for(const u of(l==null?void 0:l.data)??[])u.sellerName&&s.set(u.sellerId,Io(u.sellerName));for(const u of a??[])s.set(u.id,Io(u.name||u.id));return s}function Io(a){var l;return((l=a.split("(")[0])==null?void 0:l.trim())||a}function aM(a){return a.length===0?"-":a.map(l=>Fj(l.paymentAmountMinor,l.paymentCurrency)).join(" / ")}function lM(){return Yt({queryKey:["init","state"],queryFn:()=>Lt("/init/state"),refetchInterval:1e4})}async function rM(a){return st("POST","/init/complete",void 0)}function iM(){return gt({mutationFn:()=>st("POST","/init/doctor/run")})}function Mb(){return Yt({queryKey:["providers","status"],queryFn:()=>Lt("/providers/status"),refetchInterval:1e4})}function sM(){return gt({mutationFn:a=>st("POST","/providers/install/preview",a)})}function Cb(){const a=Tt();return gt({mutationFn:l=>st("POST","/providers/install/apply",l),onSuccess:()=>{a.invalidateQueries({queryKey:["providers","status"]}),a.invalidateQueries({queryKey:["init","state"]})}})}function oM(){const a=Tt();return gt({mutationFn:l=>st("POST","/providers/install/rollback",l),onSuccess:()=>{a.invalidateQueries({queryKey:["providers","status"]}),a.invalidateQueries({queryKey:["init","state"]})}})}const cM=[{value:"fullAuto",title:"全自动",body:"自动选择可用节点。"},{value:"fixedSet",title:"固定节点组",body:"在指定节点组内切换。"},{value:"fixed",title:"固定节点",body:"始终使用指定节点。"}],Mf="tbp_local_17821_d7f4c9a2b8e1",uM=[{value:"balanced",title:"平衡模式",body:"综合速度、价格、健康度、余额。"},{value:"speed",title:"速度优先",body:"优先选择更快、吞吐量更高节点。"},{value:"discount",title:"成本优先",body:"优先选择更低成本节点。"}],Xx=[{index:1,label:"选择模型",value:"默认模型"},{index:2,label:"绑定钱包",value:"支付方式"},{index:3,label:"配置策略",value:"路由规则"},{index:4,label:"配置工具",value:"终端接入"}],dM=[{method:"wechat-pay",name:"WeChat Pay",detail:"微信支付入口预留"},{method:"alipay-agent",name:"Alipay Agent Payment",detail:"代理支付入口预留"},{method:"coinbase-smart-wallet",name:"Coinbase Smart Wallet",detail:"USDC 钱包入口预留"}],fM=["GPT","Claude","Gemini","DeepSeek","Kimi","Qwen","MiniMax","GLM","Doubao","Grok"];function mM(a){const l=new URLSearchParams(a);return l.has("verifyPaymentMethods")?2:(l.has("verifyPickerDom")||l.has("verifyNoIntro")||l.has("verifyCompact"),1)}function hM(){var ia,Ue,bt,sa,oa,ca,jn,ua,Kn,pr,Ul,Va;const[a,l]=S.useState(()=>mM(typeof window>"u"?"":window.location.search)),[o,s]=S.useState([]),[u,f]=S.useState(!1),[p,h]=S.useState(),[v,x]=S.useState(!1),[y,g]=S.useState(!1),[j,N]=S.useState("fullAuto"),[T,E]=S.useState("balanced"),[D,R]=S.useState(""),[L,H]=S.useState([]),[P,G]=S.useState(),[Q,q]=S.useState(""),[W,I]=S.useState([]),[ne,F]=S.useState({}),[J,se]=S.useState(),[ge,fe]=S.useState(),[O,te]=S.useState(!1),[re,Z]=S.useState(null),[he,w]=S.useState(!1),[$,V]=S.useState(),le=lM(),pe=If(),ve=Ej(),be=Vf(),Xe=Mb(),Oe=Xf(),Nt=Ff(),dt=sM(),yn=Cb(),Ie=iM(),Qe=ks(),Gt=vc(),an=S.useMemo(()=>{var ue;return gM(((ue=Qe.data)==null?void 0:ue.data)??[])},[(ia=Qe.data)==null?void 0:ia.data]),ln=S.useMemo(()=>{var ue,De,Ot;return OM(((ue=Qe.data)==null?void 0:ue.sellers)??[],((De=Qe.data)==null?void 0:De.data)??[],((Ot=Gt.data)==null?void 0:Ot.inferences)??[])},[(Ue=Gt.data)==null?void 0:Ue.inferences,(bt=Qe.data)==null?void 0:bt.data,(sa=Qe.data)==null?void 0:sa.sellers]),Bt=S.useMemo(()=>{var ue;return bM(an,o,((ue=le.data)==null?void 0:ue.recommendedModels)??[])},[(oa=le.data)==null?void 0:oa.recommendedModels,an,o]),At=S.useMemo(()=>o.length>0?o:Bt.map(ue=>ue.id),[Bt,o]),rn=`http://127.0.0.1:${((ca=pe.data)==null?void 0:ca.proxyPort)??((jn=le.data)==null?void 0:jn.runtime.proxyPort)??17821}`,sn=S.useMemo(()=>{var ue;return(((ue=Xe.data)==null?void 0:ue.clients)??[]).filter(De=>De.id!=="custom"&&De.detected)},[(ua=Xe.data)==null?void 0:ua.clients]),Pn=((Kn=be.data)==null?void 0:Kn.payments.filter(ue=>ue.enabled&&Sc(ue.method)!=="mock"))??[],la=S.useMemo(()=>BM(j,T,D,L),[D,L,j,T]),at=qM({serviceReady:((pr=pe.data)==null?void 0:pr.status)==="running",modelCount:an.length,routingMode:j,paymentReady:Pn.length>0,configuredTools:((Ul=Xe.data)==null?void 0:Ul.summary.configuredCount)??0}),Qa=((Va=Ie.data)==null?void 0:Va.checks.map($M))??at;S.useEffect(()=>{v||!le.data||(s(le.data.focusSet),x(!0))},[le.data,v]),S.useEffect(()=>{Q||o.length===0||q(o[0])},[Q,o]),S.useEffect(()=>{y||sn.length===0||g(!0)},[y,sn]),S.useEffect(()=>{a!==5||Ie.data||Ie.error||Ie.isPending||Ie.mutate()},[a,Ie]),S.useEffect(()=>{var Ot;const ue=Dn=>{Dn.preventDefault(),Z(Dn),V("浏览器已经允许直接安装 TokenBuddy。")},De=()=>{w(!0),Z(null),V("TokenBuddy 桌面应用已安装。")};return window.addEventListener("beforeinstallprompt",ue),window.addEventListener("appinstalled",De),(Ot=window.matchMedia)!=null&&Ot.call(window,"(display-mode: standalone)").matches&&w(!0),()=>{window.removeEventListener("beforeinstallprompt",ue),window.removeEventListener("appinstalled",De)}},[]);const Pa=ue=>{h(void 0),s(De=>De.includes(ue)?De.filter(Ot=>Ot!==ue):[...De,ue])},Sn=async()=>{f(!0),h(void 0);try{await gf(o),h("关注模型已保存。后续工具配置会优先参考这些模型。")}catch(ue){h(`保存失败:${ue instanceof Error?ue.message:String(ue)}`)}finally{f(!1)}},qt=async()=>{if(G(void 0),!la){G(j==="fixed"?"请选择一个固定节点。":"请至少选择一个节点。");return}try{await ve.mutateAsync(la),G("节点路由策略已保存。"),l(4)}catch(ue){G(`保存失败:${ue instanceof Error?ue.message:String(ue)}`)}},Ka=async()=>{try{await Oe.mutateAsync()}catch{}},ra=async()=>{try{await Nt.mutateAsync()}catch{}},Ya=async()=>{se(void 0);const ue=Q||At[0];if(!ue){se("请先选择一个默认模型。");return}if(W.length===0){se("请选择至少一个要写入 TokenBuddy 配置的终端工具。");return}try{await dt.mutateAsync({providers:W,proxyUrl:rn,model:ue,providerSelections:eg(W,ne,At,ue)}),se("已生成写入预览。确认无误后可以写入配置。")}catch(De){se(`预览失败:${De instanceof Error?De.message:String(De)}`)}},Ga=async()=>{se(void 0);const ue=Q||At[0];if(!ue){se("请先选择一个默认模型。");return}if(W.length===0){se("请选择至少一个要写入 TokenBuddy 配置的终端工具。");return}try{const De=await yn.mutateAsync({providers:W,proxyUrl:rn,model:ue,providerSelections:eg(W,ne,At,ue)});se(`已写入 ${De.applied.length} 个配置文件。`),l(5)}catch(De){se(`写入失败:${De instanceof Error?De.message:String(De)}`)}},on=()=>{pe.refetch(),le.refetch(),be.refetch(),Xe.refetch(),Qe.refetch(),Ie.mutate()},ft=async()=>{fe(void 0),te(!0);try{await rM(),fe("初始化已标记完成。你可以把 TokenBuddy 安装成桌面应用,之后从系统应用入口打开。"),le.refetch()}catch(ue){fe(`完成失败:${ue instanceof Error?ue.message:String(ue)}`)}finally{te(!1)}},$t=async()=>{if(!re){V("请在浏览器地址栏右侧或菜单里选择“安装应用”。");return}try{V(void 0),await re.prompt();const ue=await re.userChoice;if(Z(null),ue.outcome==="accepted"){w(!0),V("TokenBuddy 桌面应用已安装。");return}V("你可以稍后继续使用浏览器安装入口。")}catch(ue){V(`安装未完成:${ue instanceof Error?ue.message:String(ue)}`)}},mt=(()=>{var ue,De,Ot,Dn,Xa,da,fa,Fa,Za;return a<=1?i.jsx(vM,{commonModels:Bt,allModels:an,loading:Qe.isLoading,error:Qe.error,selectedModels:o,saving:u,saveMessage:p,onToggleModel:Pa,onSave:Sn,onContinue:()=>l(2)}):a===2?i.jsx(AM,{payments:((ue=be.data)==null?void 0:ue.payments)??[],enabledPaymentCount:Pn.length,loading:be.isLoading,qrUrl:(De=Oe.data)==null?void 0:De.qrImageUrl,rechargeQrUrl:(Ot=Nt.data)==null?void 0:Ot.qrImageUrl,walletConfigPresent:(Dn=Oe.data)==null?void 0:Dn.walletConfigPresent,error:Oe.error,rechargeError:Nt.error,binding:Oe.isPending,rechargeLoading:Nt.isPending,onBind:Ka,onLoadRecharge:ra,onRefreshPayments:()=>{be.refetch()},onBack:()=>l(1),onContinue:()=>l(3)}):a===3?i.jsx(CM,{mode:j,scorer:T,sellers:ln,fixedSellerId:D,fixedSetSellerIds:L,saving:ve.isPending,message:P,onModeChange:N,onScorerChange:E,onFixedSellerChange:R,onToggleFixedSetSeller:ot=>{H($e=>$e.includes(ot)?$e.filter(et=>et!==ot):[...$e,ot])},onSave:qt,onBack:()=>l(2)}):a===4?i.jsx(kM,{clients:((Xa=Xe.data)==null?void 0:Xa.clients)??[],candidates:sn,loading:Xe.isLoading,selectedProviders:W,selectedModel:Q||At[0]||"",modelOptions:At,providerSelections:ne,proxyUrl:rn,previewChanges:(da=dt.data)==null?void 0:da.changes,applying:yn.isPending,previewing:dt.isPending,message:J,onToggleProvider:ot=>{I($e=>$e.includes(ot)?$e.filter(et=>et!==ot):[...$e,ot])},onModelChange:q,onProviderSelectionChange:(ot,$e)=>{F(et=>({...et,[ot]:$e}))},onPreview:Ya,onInstall:Ga,onBack:()=>l(3)}):a===5?i.jsx(zM,{items:Qa,status:(fa=Ie.data)==null?void 0:fa.status,generatedAt:(Fa=Ie.data)==null?void 0:Fa.generatedAt,running:Ie.isPending,error:Ie.error,onRefresh:on,onBack:()=>l(4),onContinue:()=>l(6)}):i.jsx(_M,{complete:((Za=le.data)==null?void 0:Za.setup.status)==="completed",message:ge,installMessage:$,canInstall:!!re,installed:he,saving:O,onBack:()=>l(5),onComplete:ft,onInstall:$t})})();return i.jsxs("div",{className:"min-w-0 space-y-3",children:[i.jsx(pM,{activeStep:a,onSelect:l}),i.jsx("div",{className:"min-w-0",children:mt})]})}function pM({activeStep:a,onSelect:l}){return i.jsx("nav",{"aria-label":"初始化步骤",className:"rounded-[12px] border border-[var(--color-line-2)] bg-white p-2.5 shadow-[0_8px_22px_rgba(60,41,112,0.045)]",children:i.jsx("div",{className:"flex items-stretch gap-2 overflow-x-auto",children:Xx.map(o=>{const s=a===o.index,u=a>o.index;return i.jsxs(S.Fragment,{children:[i.jsxs("button",{type:"button",onClick:()=>l(o.index),"aria-current":s?"step":void 0,className:["relative flex min-w-[190px] flex-1 items-center gap-2 rounded-[8px] px-3 py-2 text-left transition",s?"bg-[var(--color-lavender)] ring-1 ring-[var(--color-lavender-2)]":"hover:bg-[var(--color-page)]"].join(" "),children:[i.jsx("span",{className:["grid size-6 shrink-0 place-items-center rounded-full border bg-white",s?"border-[var(--color-purple)] text-[var(--color-purple)] shadow-[0_0_0_3px_rgba(124,61,240,0.1)]":"",u?"border-emerald-200 bg-emerald-50 text-emerald-700":"",!s&&!u?"border-[var(--color-line-2)] text-[var(--color-muted)]":""].join(" "),children:u?i.jsx(Kt,{className:"size-3.5"}):i.jsx("span",{className:"size-1.5 rounded-full bg-current"})}),i.jsxs("span",{className:"min-w-0",children:[i.jsxs("span",{className:["block font-mono text-[0.62rem] font-black uppercase tracking-[0.08em]",s?"text-[var(--color-purple)]":"text-[var(--color-muted)]"].join(" "),children:["STEP ",o.index,":"]}),i.jsx("span",{className:["mt-0.5 block text-[0.82rem] font-semibold",s?"text-[var(--color-purple)]":"text-[var(--color-ink)]"].join(" "),children:o.label}),i.jsx("span",{className:"block truncate text-[0.7rem] text-[var(--color-muted)]",children:o.value})]})]}),o.index<Xx.length?i.jsx("div",{className:"hidden min-w-8 items-center justify-center text-[var(--color-purple)]/70 sm:flex",children:i.jsx(pc,{className:"size-5",strokeWidth:2.6})}):null]},o.index)})})})}function gi({index:a,title:l,detail:o,meta:s,action:u}){return i.jsxs("div",{className:"flex flex-col gap-2.5 border-b border-[var(--color-line-2)] pb-3 sm:flex-row sm:items-center sm:justify-between",children:[i.jsx("div",{className:"min-w-0",children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("span",{className:"rounded-[7px] bg-[var(--color-lavender)] px-2 py-0.5 font-mono text-[0.68rem] font-semibold text-[var(--color-purple)]",children:String(a).padStart(2,"0")}),i.jsx("div",{className:"text-[0.92rem] font-semibold text-[var(--color-ink)]",children:l}),o?i.jsx("span",{className:"text-[0.74rem] text-[var(--color-muted)]",children:o}):null,s?i.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5 font-mono text-[0.68rem] text-[var(--color-muted)]",children:s}):null]})}),u?i.jsx("div",{className:"shrink-0",children:u}):null]})}function vM({commonModels:a,allModels:l,loading:o,error:s,selectedModels:u,saving:f,saveMessage:p,onToggleModel:h,onSave:v,onContinue:x}){const[y,g]=S.useState(!1),j=u.map(N=>l.find(T=>T.id===N)??{id:N,sellerCount:0,protocols:[],paymentMethods:[]});return i.jsxs("div",{className:"space-y-3",children:[i.jsxs(_t,{className:"p-3",children:[i.jsx(gi,{index:1,title:"模型访问",detail:"默认和高频模型",meta:`${u.length} selected`,action:i.jsxs("button",{type:"button",disabled:o||!!s,onClick:()=>g(!0),className:"inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-purple)] px-2.5 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple-2)] disabled:cursor-not-allowed disabled:opacity-45",children:[i.jsx(bs,{className:"size-3.5"}),"添加模型"]})}),s?i.jsxs("div",{className:"mt-3 rounded-[10px] bg-rose-50 px-3 py-2 text-[0.84rem] leading-6 text-rose-700",children:["模型目录加载失败:",s instanceof Error?s.message:String(s)]}):null,j.length===0?i.jsxs("button",{type:"button",disabled:o||!!s,onClick:()=>g(!0),className:"mt-3 flex min-h-[72px] w-full items-center gap-3 rounded-[10px] border border-dashed border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-3 text-left transition hover:border-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[i.jsx("span",{className:"grid size-8 shrink-0 place-items-center rounded-[8px] bg-white text-[var(--color-purple)]",children:i.jsx(bs,{className:"size-4"})}),i.jsxs("span",{className:"min-w-0",children:[i.jsx("span",{className:"block text-[0.86rem] font-semibold text-[var(--color-ink)]",children:"添加可能使用到的模型"}),i.jsx("span",{className:"mt-0.5 block text-[0.76rem] text-[var(--color-muted)]",children:"至少选择一个模型后才能保存并继续。"})]})]}):i.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:j.map(N=>i.jsxs("div",{className:"inline-flex min-h-9 max-w-full items-center gap-2 rounded-[9px] border border-[var(--color-lavender-2)] bg-[var(--color-lavender)] px-3 py-1.5",children:[i.jsx("span",{className:"truncate font-mono text-[0.82rem] font-semibold text-[var(--color-purple)]",children:N.id}),i.jsx("span",{className:"rounded-full bg-white/70 px-2 py-0.5 text-[0.68rem] font-semibold text-emerald-700",children:"可用"}),i.jsx("button",{type:"button",onClick:()=>h(N.id),className:"inline-flex size-5 items-center justify-center rounded-[6px] text-[var(--color-purple)]/70 hover:bg-white hover:text-[var(--color-purple)]","aria-label":`Remove ${N.id}`,children:i.jsx(Dl,{className:"size-3"})})]},N.id))}),i.jsxs("div",{className:"mt-3 flex flex-col gap-2.5 border-t border-[var(--color-line-2)] pt-3 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"min-h-5 text-[0.8rem] leading-5 text-[var(--color-muted)]",children:[o?i.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[i.jsx(jt,{className:"size-3.5 animate-spin text-[var(--color-purple)]"})," loading catalog"]}):null,!o&&!s&&u.length===0?i.jsx("span",{children:"请选择至少一个可能使用的模型。"}):null,p?i.jsx("div",{className:"mt-1 font-medium text-[var(--color-ink)]",children:p}):null]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsxs("button",{type:"button",disabled:f||u.length===0,onClick:v,className:"inline-flex h-9 shrink-0 items-center justify-center gap-2 rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.82rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[f?i.jsx(jt,{className:"size-3.5 animate-spin"}):null,"保存"]}),i.jsxs("button",{type:"button",disabled:u.length===0,onClick:x,className:"inline-flex h-9 shrink-0 items-center justify-center gap-1.5 rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-ink)] transition hover:border-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:["下一步",i.jsx(pc,{className:"size-3.5"})]})]})]})]}),y?i.jsx(xM,{models:a,allModels:l,selectedModelIds:u,onToggle:h,onClose:()=>g(!1)}):null]})}function xM({models:a,allModels:l,selectedModelIds:o,onToggle:s,onClose:u}){const[f,p]=S.useState("common"),[h,v]=S.useState(""),x=h.trim(),y=f==="common"?a:x?jM(l,x):[],g=f==="common"?"没有可用的推荐模型。":"输入关键词搜索全部可用模型。",j=[{id:"common",label:"推荐模型",hint:"直接勾选"},{id:"all",label:"搜索添加",hint:"全部模型"}];return i.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[rgba(32,26,56,0.22)] px-3 py-6 backdrop-blur-sm",children:i.jsxs("div",{className:"flex max-h-full w-full max-w-[720px] flex-col overflow-hidden rounded-[14px] border border-[var(--color-line-2)] bg-white shadow-[0_24px_80px_rgba(32,26,56,0.22)]",children:[i.jsxs("div",{className:"flex items-start gap-3 border-b border-[var(--color-line-2)] px-4 py-3",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"Select models"}),i.jsx("h2",{className:"mt-0.5 text-[1rem] font-semibold text-[var(--color-ink)]",children:"选择可能使用到的模型"}),i.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:"推荐模型直接勾选;搜索添加用于查找平台全部模型。"})]}),i.jsxs("div",{className:"mt-0.5 rounded-full bg-[var(--color-lavender)] px-2.5 py-1 font-mono text-[0.72rem] font-semibold text-[var(--color-purple)]",children:[o.length," selected"]}),i.jsx("button",{type:"button",onClick:u,className:"inline-flex size-8 items-center justify-center rounded-[8px] border border-[var(--color-line-2)] text-[var(--color-muted)] hover:text-[var(--color-ink)]","aria-label":"Close model picker",children:i.jsx(Dl,{className:"size-4"})})]}),i.jsxs("div",{className:"border-b border-[var(--color-line-2)] px-4 py-2.5",children:[i.jsx("div",{className:"mb-2 text-[0.72rem] font-semibold uppercase tracking-wider text-[var(--color-muted)]",children:"已选模型"}),o.length===0?i.jsx("div",{className:"rounded-[9px] border border-dashed border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2 text-[0.78rem] text-[var(--color-muted)]",children:"还没有选择模型。"}):i.jsx("div",{className:"flex max-h-[92px] flex-wrap gap-1.5 overflow-y-auto pr-1",children:o.map(N=>i.jsxs("span",{className:"inline-flex max-w-full items-center gap-1.5 rounded-[8px] border border-[var(--color-lavender-2)] bg-[var(--color-lavender)] px-2 py-1",children:[i.jsx("span",{className:"max-w-[220px] truncate font-mono text-[0.72rem] font-semibold text-[var(--color-purple)]",children:N}),i.jsx("button",{type:"button",onClick:()=>s(N),className:"inline-flex size-4 items-center justify-center rounded-[5px] text-[var(--color-purple)]/70 hover:bg-white hover:text-[var(--color-purple)]","aria-label":`Remove ${N}`,children:i.jsx(Dl,{className:"size-3"})})]},N))})]}),i.jsxs("div",{className:"border-b border-[var(--color-line-2)] p-3",children:[i.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:j.map(N=>{const T=f===N.id;return i.jsxs("button",{type:"button",onClick:()=>p(N.id),className:["rounded-[9px] border px-3 py-2 text-left transition",T?"border-[var(--color-purple)] bg-[var(--color-lavender)]":"border-[var(--color-line-2)] bg-white hover:border-[var(--color-lavender-2)]"].join(" "),children:[i.jsx("span",{className:["block text-[0.84rem] font-semibold",T?"text-[var(--color-purple)]":"text-[var(--color-ink)]"].join(" "),children:N.label}),i.jsx("span",{className:"mt-0.5 block text-[0.72rem] text-[var(--color-muted)]",children:N.hint})]},N.id)})}),f==="all"?i.jsxs("label",{className:"relative mt-3 block",children:[i.jsx(Es,{className:"pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-[var(--color-muted)]"}),i.jsx("input",{value:h,onChange:N=>v(N.target.value),placeholder:"搜索平台全部模型...",className:"h-10 w-full rounded-[9px] border border-[var(--color-line-2)] bg-white pl-9 pr-3 text-[0.88rem] text-[var(--color-ink)] outline-none transition placeholder:text-[var(--color-muted)] focus:border-[var(--color-purple)]"})]}):null]}),i.jsx("div",{className:"min-h-0 max-h-[320px] overflow-y-auto p-3",children:y.length===0?i.jsx("div",{className:"rounded-[12px] border border-dashed border-[var(--color-line-2)] bg-[var(--color-page)] px-4 py-8 text-center text-[0.86rem] text-[var(--color-muted)]",children:g}):i.jsx("div",{className:"grid gap-2",children:y.map(N=>{const T=o.includes(N.id);return i.jsxs("button",{type:"button",onClick:()=>s(N.id),"aria-pressed":T,className:["flex items-center gap-3 rounded-[10px] border px-3 py-2 text-left transition",T?"border-[var(--color-purple)] bg-[var(--color-lavender)]":"border-[var(--color-line-2)] bg-white hover:border-[var(--color-lavender-2)]"].join(" "),children:[i.jsx("span",{className:["grid size-6 shrink-0 place-items-center rounded-[7px] border",T?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line-2)] bg-white text-transparent"].join(" "),children:i.jsx(Kt,{className:"size-3.5"})}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate font-mono text-[0.88rem] font-semibold text-[var(--color-ink)]",children:N.id}),i.jsxs("span",{className:"mt-1 flex flex-wrap gap-1.5 text-[0.72rem] text-[var(--color-muted)]",children:[i.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:sm(N.id)}),i.jsx("span",{className:"rounded-full bg-emerald-50 px-2 py-0.5 font-semibold text-emerald-700",children:"可用"}),Cf(N.paymentMethods)?i.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:Cf(N.paymentMethods)}):null]})]}),i.jsx("span",{className:["rounded-[7px] px-2 py-1 text-[0.72rem] font-semibold",T?"bg-[var(--color-purple)] text-white":"bg-[var(--color-page)] text-[var(--color-muted)]"].join(" "),children:T?"已选择":"选择"})]},N.id)})})}),i.jsxs("div",{className:"flex flex-col gap-2 border-t border-[var(--color-line-2)] bg-white px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[i.jsxs("div",{className:"text-[0.8rem] leading-5 text-[var(--color-muted)]",children:["已选择 ",i.jsx("span",{className:"font-mono font-semibold text-[var(--color-ink)]",children:o.length})," 个模型"]}),i.jsxs("button",{type:"button",onClick:u,"aria-label":"Done",title:"Done selecting models",className:"inline-flex h-9 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.82rem] font-semibold text-white transition hover:bg-[var(--color-purple)]",children:["完成选择",i.jsx(Kt,{className:"size-3.5"})]})]})]})})}function gM(a){const l=new Map;for(const o of a){const s=l.get(o.id)??{sellers:new Set,protocols:new Set,paymentMethods:new Set};s.sellers.add(o.sellerId);for(const u of o.supportedProtocols)s.protocols.add(u);for(const u of o.paymentMethods)s.paymentMethods.add(u);l.set(o.id,s)}return Array.from(l.entries()).map(([o,s])=>({id:o,sellerCount:s.sellers.size,protocols:Array.from(s.protocols).sort(),paymentMethods:Array.from(s.paymentMethods).sort()})).sort((o,s)=>s.sellerCount!==o.sellerCount?s.sellerCount-o.sellerCount:o.id.localeCompare(s.id))}function bM(a,l,o){const s=yM(a,o);if(s.length>0)return s.slice(0,14);const u=new Set(l),f=new Map;for(const v of l){const x=a.find(y=>y.id===v);x&&f.set(x.id,x)}const p=a.map(v=>({model:v,rank:NM(v.id)})).filter(v=>v.rank<100).sort((v,x)=>v.rank!==x.rank?v.rank-x.rank:x.model.sellerCount!==v.model.sellerCount?x.model.sellerCount-v.model.sellerCount:v.model.id.localeCompare(x.model.id)),h=new Map;for(const v of p){const x=sm(v.model.id),y=h.get(x)??[];y.push(v),h.set(x,y)}for(const v of fM){const x=v==="GPT"?3:v==="Claude"||v==="Gemini"?2:1;for(const y of(h.get(v)??[]).slice(0,x))f.set(y.model.id,y.model)}for(const v of p){if(f.size>=14)break;u.has(v.model.id)||f.set(v.model.id,v.model)}return Array.from(f.values()).slice(0,14)}function yM(a,l){const o=new Map;for(const s of l){const u=SM(a,s,o);u&&o.set(u.id,u)}return Array.from(o.values())}function SM(a,l,o){const s=Fd(l);if(!s)return;const u=a.find(f=>Fd(f.id)===s&&!o.has(f.id));return u||a.find(f=>{if(o.has(f.id))return!1;const p=Fd(f.id);return p.includes(s)||s.includes(p)})}function Fd(a){return a.trim().toLowerCase().replace(/_/g,"-")}function jM(a,l){const o=l.trim().toLowerCase();return o?a.filter(s=>[s.id,sm(s.id),...s.paymentMethods].some(u=>u.toLowerCase().includes(o))):a}function NM(a){const l=a.toLowerCase();return l.includes("gpt-5.5")||l.includes("gpt-5-5")||l.includes("gpt-5_5")?0:l.includes("gpt-5.4")||l.includes("gpt-5-4")||l.includes("gpt-5_4")?1:l.includes("gpt-5")||l.includes("gpt-latest")||l.includes("openai/gpt")?2:l.includes("claude")&&(l.includes("4.8")||l.includes("4-8"))?3:l.includes("claude")&&l.includes("opus")?4:l.includes("claude")&&l.includes("sonnet")?5:l.includes("claude")?6:l.includes("gemini")&&(l.includes("3.1")||l.includes("3-1"))?7:l.includes("gemini")&&l.includes("pro")?8:l.includes("gemini")?9:l.includes("deepseek")?10:l.includes("kimi")||l.includes("moonshot")?11:l.includes("qwen")||l.includes("tongyi")?12:l.includes("minimax")?13:l.includes("glm")||l.includes("zhipu")?14:l.includes("doubao")||l.includes("bytedance")?15:l.includes("grok")?16:100}function sm(a){const l=a.toLowerCase();return l.includes("gpt")||l.includes("openai")?"GPT":l.includes("claude")||l.includes("anthropic")?"Claude":l.includes("gemini")||l.includes("google")?"Gemini":l.includes("deepseek")?"DeepSeek":l.includes("kimi")||l.includes("moonshot")?"Kimi":l.includes("qwen")||l.includes("tongyi")?"Qwen":l.includes("minimax")?"MiniMax":l.includes("glm")||l.includes("zhipu")?"GLM":l.includes("doubao")||l.includes("bytedance")?"Doubao":l.includes("grok")?"Grok":"Common"}function Cf(a){return a.length===0?"":`${wM(a.map(MM)).join("、")}`}function wM(a){return Array.from(new Set(a))}function MM(a){const l=Sc(a);return l.includes("x402")?"X402":l.includes("clawtip")?"ClawTip":l.includes("wallet")?"钱包":l.includes("mock")||l.includes("test")?"测试":"其它"}function Sc(a){return a.trim().toLowerCase()}function CM({mode:a,scorer:l,sellers:o,fixedSellerId:s,fixedSetSellerIds:u,saving:f,message:p,onModeChange:h,onScorerChange:v,onFixedSellerChange:x,onToggleFixedSetSeller:y,onSave:g,onBack:j}){const N=a!=="fullAuto";return i.jsxs("div",{className:"space-y-3",children:[i.jsxs(_t,{className:"p-3",children:[i.jsx(gi,{index:3,title:"配置策略",detail:"路由规则",meta:`${_b(a)} / ${YM(l)}`}),i.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-2",children:[i.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-2.5",children:[i.jsx("div",{className:"mb-2 text-[0.78rem] font-semibold text-[var(--color-ink)]",children:"路由模式"}),i.jsx("div",{className:"grid gap-2",children:cM.map(T=>i.jsxs("button",{type:"button",onClick:()=>h(T.value),className:["rounded-[9px] border bg-white p-2.5 text-left transition",a===T.value?"border-[var(--color-purple)] bg-[var(--color-lavender)]":"border-[var(--color-line-2)] bg-white hover:border-[var(--color-lavender-2)]"].join(" "),children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:["grid size-5 place-items-center rounded-full border",a===T.value?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line-2)] text-transparent"].join(" "),children:i.jsx(Kt,{className:"size-3"})}),i.jsx("span",{className:"text-[0.84rem] font-semibold text-[var(--color-ink)]",children:T.title})]}),i.jsx("p",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:T.body})]},T.value))})]}),i.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-2.5",children:[i.jsx("div",{className:"mb-2 text-[0.78rem] font-semibold text-[var(--color-ink)]",children:"优化目标"}),i.jsx("div",{className:"grid gap-2",children:uM.map(T=>i.jsxs("button",{type:"button",onClick:()=>v(T.value),className:["rounded-[9px] border bg-white p-2.5 text-left transition",l===T.value?"border-[var(--color-purple)] bg-[var(--color-lavender)]":"border-[var(--color-line-2)] bg-white hover:border-[var(--color-lavender-2)]"].join(" "),children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:["grid size-5 place-items-center rounded-full border",l===T.value?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line-2)] text-transparent"].join(" "),children:i.jsx(Kt,{className:"size-3"})}),i.jsx("span",{className:"text-[0.84rem] font-semibold text-[var(--color-ink)]",children:T.title})]}),i.jsx("p",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:T.body})]},T.value))})]})]}),N?i.jsxs("div",{className:"mt-3 rounded-[10px] border border-[var(--color-line-2)] bg-white p-3",children:[i.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[i.jsx("div",{className:"text-[0.8rem] font-semibold text-[var(--color-ink)]",children:"选择节点"}),i.jsx("div",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5 text-[0.72rem] text-[var(--color-muted)]",children:a==="fixed"?s?"已选择 1 个":"尚未选择":`已选择 ${u.length} 个`})]}),o.length===0?i.jsx("div",{className:"mt-2 rounded-[9px] border border-dashed border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-3 text-[0.8rem] leading-5 text-[var(--color-muted)]",children:"正在等待节点目录。你也可以先返回上一步确认模型目录是否已经加载完成。"}):i.jsx(TM,{mode:a,sellers:o,fixedSellerId:s,fixedSetSellerIds:u,onFixedSellerChange:x,onToggleFixedSetSeller:y})]}):i.jsx("div",{className:"mt-3 rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2 text-[0.8rem] leading-5 text-[var(--color-muted)]",children:"当前是全自动模式,TokenBuddy 会根据模型、节点健康度、速度、价格和余额状态自动规划调用路径。"})]}),i.jsx(Tb,{backLabel:"上一步:绑定钱包",nextLabel:"下一步:配置工具",saving:f,message:p,onBack:j,onNext:g})]})}function TM({mode:a,sellers:l,fixedSellerId:o,fixedSetSellerIds:s,onFixedSellerChange:u,onToggleFixedSetSeller:f}){const[p,h]=S.useState({key:"status",direction:"asc"}),v=S.useMemo(()=>Ab(l,p),[l,p]),x=g=>{h(j=>({key:g,direction:j.key===g&&j.direction==="asc"?"desc":"asc"}))},y=g=>{if(a==="fixed"){u(g);return}f(g)};return i.jsx("div",{className:"mt-2 overflow-hidden rounded-[9px] border border-[var(--color-line-2)]",children:i.jsx("div",{className:"max-h-[300px] overflow-auto",children:i.jsxs("table",{className:"min-w-[760px] w-full border-collapse text-left text-[0.78rem]",children:[i.jsx("thead",{className:"sticky top-0 z-10 border-b border-[var(--color-line-2)] bg-[var(--color-page)] text-[0.68rem] uppercase tracking-wider text-[var(--color-muted)]",children:i.jsxs("tr",{children:[i.jsx("th",{className:"w-12 px-2 py-2 font-semibold",children:"选"}),i.jsx(Wr,{label:"节点",sortKey:"name",sort:p,onSort:x}),i.jsx(Wr,{label:"状态",sortKey:"status",sort:p,onSort:x}),i.jsx(Wr,{label:"模型",sortKey:"models",sort:p,onSort:x,align:"right"}),i.jsx(Wr,{label:"价格",sortKey:"price",sort:p,onSort:x}),i.jsx(Wr,{label:"折扣",sortKey:"discount",sort:p,onSort:x,align:"right"}),i.jsx(Wr,{label:"响应",sortKey:"speed",sort:p,onSort:x,align:"right"}),i.jsx("th",{className:"px-3 py-2 font-semibold",children:"支付"})]})}),i.jsx("tbody",{className:"divide-y divide-[var(--color-line-2)] bg-white",children:v.map(g=>{const j=a==="fixed"?o===g.id:s.includes(g.id);return i.jsxs("tr",{onClick:()=>y(g.id),className:["cursor-pointer transition hover:bg-[var(--color-lavender)]/45",j?"bg-[var(--color-lavender)]/70":"bg-white"].join(" "),children:[i.jsx("td",{className:"px-2 py-2.5",children:i.jsx("span",{className:["grid size-5 place-items-center rounded-full border",j?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line-2)] text-transparent"].join(" "),children:i.jsx(Kt,{className:"size-3"})})}),i.jsxs("td",{className:"max-w-[210px] px-3 py-2.5",children:[i.jsx("div",{className:"truncate font-semibold text-[var(--color-ink)]",children:g.name}),i.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.68rem] text-[var(--color-muted)]",children:g.id})]}),i.jsx("td",{className:"px-3 py-2.5",children:i.jsx("span",{className:["inline-flex whitespace-nowrap rounded-full px-2 py-0.5 text-[0.7rem] font-semibold",VM(g.status)].join(" "),children:GM(g.status)})}),i.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono font-semibold text-[var(--color-ink)]",children:g.modelCount}),i.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 font-mono text-[0.72rem] text-[var(--color-ink)]",children:i.jsx(uN,{inputPriceMicrosPer1m:g.minInputPriceMicrosPer1m,outputPriceMicrosPer1m:g.minOutputPriceMicrosPer1m})}),i.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono font-semibold text-[var(--color-purple)]",children:Wf(g.discountRatio)}),i.jsx("td",{className:"whitespace-nowrap px-3 py-2.5 text-right font-mono text-[var(--color-ink)]",children:i.jsx(bc,{ttftMs:g.avgTtftMs,tokensPerSecond:g.avgTokensPerSecond,compact:!0})}),i.jsx("td",{className:"max-w-[150px] px-3 py-2.5",children:i.jsx("div",{className:"truncate text-[0.72rem] text-[var(--color-muted)]",children:Cf(g.paymentMethods)||"—"})})]},g.id)})})]})})})}function Wr({label:a,sortKey:l,sort:o,align:s="left",onSort:u}){const f=o.key===l,p=f?o.direction==="asc"?"↑":"↓":"↕";return i.jsx("th",{className:["px-3 py-2 font-semibold",s==="right"?"text-right":"text-left"].join(" "),children:i.jsxs("button",{type:"button",onClick:()=>u(l),className:["inline-flex items-center gap-1 rounded-[6px] px-1.5 py-1 transition hover:bg-white",s==="right"?"justify-end":"justify-start",f?"text-[var(--color-purple)]":"text-[var(--color-muted)]"].join(" "),children:[i.jsx("span",{children:a}),i.jsx("span",{className:"font-mono text-[0.66rem]",children:p})]})})}function AM({payments:a,enabledPaymentCount:l,loading:o,qrUrl:s,rechargeQrUrl:u,walletConfigPresent:f,error:p,rechargeError:h,binding:v,rechargeLoading:x,onBind:y,onLoadRecharge:g,onRefreshPayments:j,onBack:N,onContinue:T}){const[E,D]=S.useState("clawtip"),[R,L]=S.useState(!1),[H,P]=S.useState(!1),G=a.find(O=>Sc(O.method)==="clawtip"),Q=!!(G!=null&&G.enabled||f||EM(G==null?void 0:G.config,"walletConfigPresent")),q=R&&Q,W=[{method:"clawtip",name:"ClawTip",detail:"JD App 扫码 / 微支付",status:Q?"已绑定":"可绑定",available:!0},...dM.map(O=>({...O,status:"Coming soon",available:!1}))],I=W.find(O=>O.method===E)??W[0],ne=I.method==="clawtip",F=ne&&Q&&!q,J=q||F||R,se=ne?J:!0,ge=()=>{L(!0),y()},fe=()=>{P(!0),g()};return S.useEffect(()=>{if(!ne||!R||Q)return;const O=window.setInterval(j,1500);return()=>window.clearInterval(O)},[R,Q,j,ne]),S.useEffect(()=>{!F||u||x||H||(P(!0),g())},[g,x,u,H,F]),i.jsxs("div",{className:"space-y-3",children:[i.jsxs(_t,{className:"p-3",children:[i.jsx(gi,{index:2,title:"选择支付方式",detail:"钱包和充值通道",meta:o?"checking":`${l} active`,action:ne&&F?i.jsxs("button",{type:"button",disabled:x,onClick:fe,className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-2.5 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[x?i.jsx(jt,{className:"size-3.5 animate-spin"}):i.jsx(gs,{className:"size-3.5"}),"刷新充值码"]}):ne&&R&&!Q?i.jsxs("button",{type:"button",disabled:v,onClick:ge,className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-2.5 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[v?i.jsx(jt,{className:"size-3.5 animate-spin"}):i.jsx(hs,{className:"size-3.5"}),"重新生成"]}):ne&&!R&&!Q?i.jsxs("button",{type:"button",disabled:v,onClick:ge,className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-2.5 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[v?i.jsx(jt,{className:"size-3.5 animate-spin"}):i.jsx(hs,{className:"size-3.5"}),"开始绑定"]}):ne?null:i.jsx("span",{className:"inline-flex h-8 items-center rounded-[8px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-2.5 font-mono text-[0.72rem] font-semibold text-[var(--color-muted)]",children:"Coming soon"})}),i.jsxs("div",{className:["mt-3 grid gap-3",se?"lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]":"lg:max-w-[360px]"].join(" "),children:[i.jsx("div",{className:"grid content-start gap-2",children:W.map(O=>{const te=O.method===I.method;return i.jsxs("button",{type:"button",onClick:()=>D(O.method),"aria-pressed":te,className:["grid min-h-[64px] grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 rounded-[10px] border px-3 py-2 text-left transition",te?"border-[var(--color-purple)] bg-[var(--color-lavender)] shadow-[0_8px_22px_rgba(124,61,240,0.08)]":"border-[var(--color-line-2)] bg-white hover:bg-[var(--color-page)]"].join(" "),children:[i.jsx("span",{className:["grid size-9 shrink-0 place-items-center rounded-[9px] border",te?"border-[var(--color-lavender-2)] bg-white text-[var(--color-purple)]":"border-[var(--color-line-2)] bg-[var(--color-page)] text-[var(--color-muted)]"].join(" "),children:Fx(O.method)}),i.jsxs("span",{className:"min-w-0",children:[i.jsx("span",{className:"block truncate text-[0.86rem] font-semibold text-[var(--color-ink)]",children:O.name}),i.jsx("span",{className:"mt-0.5 block truncate text-[0.73rem] text-[var(--color-muted)]",children:O.detail})]}),i.jsx("span",{className:["rounded-full px-2 py-0.5 text-[0.68rem] font-semibold",O.available?"bg-emerald-50 text-emerald-700":"bg-[var(--color-page)] text-[var(--color-muted)]"].join(" "),children:O.status})]},O.method)})}),ne?J?i.jsx("div",{className:"flex min-h-[360px] items-center justify-center rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-4",children:q?i.jsx("div",{className:"grid size-full min-h-[320px] place-items-center rounded-[10px] border border-emerald-100 bg-emerald-50 px-4 py-5 text-center",children:i.jsxs("div",{children:[i.jsx(Kt,{className:"mx-auto size-8 text-emerald-700"}),i.jsx("div",{className:"mt-3 text-[0.92rem] font-semibold text-emerald-900",children:"绑定成功"}),i.jsx("div",{className:"mt-1 text-[0.78rem] leading-5 text-emerald-800",children:"ClawTip 钱包已经写入本机配置,可以继续配置路由策略。"})]})}):F?u?i.jsx("img",{src:u,alt:"ClawTip 充值二维码",className:"max-h-[340px] w-full max-w-[340px] rounded-[10px] border border-[var(--color-line-2)] bg-white p-3 object-contain shadow-[0_12px_28px_rgba(15,23,42,0.1)]"}):i.jsx("div",{className:"grid size-full min-h-[320px] place-items-center rounded-[10px] border border-dashed border-[var(--color-line-2)] bg-white px-3 py-4 text-center",children:i.jsxs("div",{children:[x?i.jsx(jt,{className:"mx-auto size-6 animate-spin text-[var(--color-purple)]"}):i.jsx(gs,{className:"mx-auto size-6 text-[var(--color-purple)]"}),i.jsx("div",{className:"mt-2 text-[0.84rem] font-semibold text-[var(--color-ink)]",children:x?"正在加载充值码":"充值码未加载"}),i.jsx("button",{type:"button",disabled:x,onClick:fe,className:"mt-3 inline-flex h-8 items-center justify-center rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:"重新加载"})]})}):R&&s?i.jsx("img",{src:s,alt:"ClawTip 钱包绑定二维码",className:"max-h-[340px] w-full max-w-[340px] rounded-[10px] border border-[var(--color-line-2)] bg-white p-3 object-contain shadow-[0_12px_28px_rgba(15,23,42,0.1)]"}):R?i.jsx("div",{className:"grid size-full min-h-[320px] place-items-center rounded-[10px] border border-dashed border-[var(--color-line-2)] bg-white px-3 py-4 text-center",children:i.jsxs("div",{children:[v?i.jsx(jt,{className:"mx-auto size-6 animate-spin text-[var(--color-purple)]"}):i.jsx(hs,{className:"mx-auto size-6 text-[var(--color-purple)]"}),i.jsx("div",{className:"mt-2 text-[0.84rem] font-semibold text-[var(--color-ink)]",children:v?"正在生成二维码":"等待二维码"}),i.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:"生成后使用京东 App 扫码绑定。"})]})}):null}):null:i.jsx("div",{className:"grid min-h-[220px] place-items-center rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-4 text-center",children:i.jsxs("div",{className:"max-w-[360px]",children:[i.jsx("span",{className:"mx-auto grid size-11 place-items-center rounded-[12px] border border-[var(--color-line-2)] bg-white text-[var(--color-purple)]",children:Fx(I.method)}),i.jsx("div",{className:"mt-3 text-[0.92rem] font-semibold text-[var(--color-ink)]",children:I.name}),i.jsxs("div",{className:"mt-1 text-[0.78rem] leading-5 text-[var(--color-muted)]",children:[I.detail,"。当前版本先通过 ClawTip 完成钱包绑定,后续会在这里接入更多支付流程。"]}),i.jsx("div",{className:"mt-3 inline-flex rounded-full bg-white px-3 py-1 font-mono text-[0.7rem] font-semibold text-[var(--color-muted)]",children:"Coming soon"})]})})]}),ne&&!Q&&R&&p?i.jsxs("div",{className:"mt-3 rounded-[10px] bg-rose-50 px-3 py-2 text-[0.84rem] leading-6 text-rose-700",children:["生成二维码失败:",p instanceof Error?p.message:String(p)]}):null,ne&&F&&h?i.jsxs("div",{className:"mt-3 rounded-[10px] bg-rose-50 px-3 py-2 text-[0.84rem] leading-6 text-rose-700",children:["加载充值二维码失败:",h instanceof Error?h.message:String(h)]}):null]}),i.jsx(Tb,{backLabel:"上一步:模型访问",nextLabel:"下一步:配置策略",message:l>0?"支付方式已可用,可以继续配置路由策略。":"如果你暂时跳过绑定,后续首次购买模型额度时仍需要完成支付配置。",onBack:N,onNext:T})]})}function Fx(a){const l=Sc(a);return l==="wechat-pay"?i.jsx(bj,{className:"size-4"}):l==="alipay-agent"?i.jsx(tj,{className:"size-4"}):l==="coinbase-smart-wallet"?i.jsx(gs,{className:"size-4"}):i.jsx(hs,{className:"size-4"})}function EM(a,l){const o=a==null?void 0:a[l];return o===!0||o==="true"||o===1||o==="1"}function kM({clients:a,candidates:l,loading:o,selectedProviders:s,selectedModel:u,modelOptions:f,providerSelections:p,proxyUrl:h,previewChanges:v,applying:x,previewing:y,message:g,onToggleProvider:j,onModelChange:N,onProviderSelectionChange:T,onPreview:E,onInstall:D,onBack:R}){var ne;const L=new Set(l.map(F=>F.id)),H=l.length,P=a.find(F=>F.id==="custom")??Rb(h),G=[...a.filter(F=>F.id!=="custom"),{...P,name:"其他工具"}],Q=((ne=G[0])==null?void 0:ne.id)??"custom",[q,W]=S.useState(Q),I=G.find(F=>F.id===q)??G[0]??P;return S.useEffect(()=>{var F;G.some(J=>J.id===q)||W(((F=G[0])==null?void 0:F.id)??"custom")},[q,G]),i.jsxs("div",{className:"space-y-3",children:[i.jsxs(_t,{className:"p-3",children:[i.jsx(gi,{index:4,title:"配置工具",detail:"终端接入",meta:`${s.length} 本次写入 / ${H} 已安装`,action:o?i.jsx(jt,{className:"size-4 animate-spin text-[var(--color-purple)]"}):null}),i.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-[minmax(0,320px)_minmax(0,1fr)]",children:[i.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-2.5",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("div",{className:"text-[0.8rem] font-semibold text-[var(--color-ink)]",children:"工具"}),i.jsxs("div",{className:"rounded-full bg-white px-2 py-0.5 text-[0.72rem] text-[var(--color-muted)]",children:[a.length," tools"]})]}),i.jsx("div",{className:"mt-2 grid max-h-[380px] gap-2 overflow-y-auto pr-1",children:G.map(F=>{const J=F.id!=="custom"&&L.has(F.id),se=s.includes(F.id),ge=I.id===F.id;return i.jsxs("div",{className:["rounded-[10px] border p-2.5 text-left transition",ge?"border-[var(--color-purple)] bg-white shadow-[0_10px_24px_rgba(60,41,112,0.08)]":"border-[var(--color-line-2)] bg-white/70 hover:border-[var(--color-lavender-2)]"].join(" "),children:[i.jsxs("div",{className:"flex items-start gap-2.5",children:[i.jsx("span",{className:["mt-0.5 grid size-6 shrink-0 place-items-center rounded-[8px] border text-[0.72rem] font-semibold",ge?"border-[var(--color-purple)] bg-[var(--color-lavender)] text-[var(--color-purple)]":"border-[var(--color-line-2)] bg-white text-[var(--color-muted)]"].join(" "),children:LM(F.name)}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("div",{className:"truncate text-[0.84rem] font-semibold text-[var(--color-ink)]",children:F.name}),se?i.jsx("span",{className:"rounded-full bg-[var(--color-lavender)] px-1.5 py-0.5 text-[0.66rem] font-semibold text-[var(--color-purple)]",children:"本次写入"}):null]}),i.jsxs("div",{className:"mt-1 flex flex-wrap gap-1.5 text-[0.68rem] text-[var(--color-muted)]",children:[i.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:Ob(F)}),F.commandName?i.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:F.commandName}):null,F.id==="custom"?i.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:"复制配置"}):null]})]}),F.id!=="custom"?i.jsx("button",{type:"button",disabled:!J,className:["mt-0.5 grid size-5 shrink-0 place-items-center rounded-full border",se?"border-[var(--color-purple)] bg-[var(--color-purple)] text-white":"border-[var(--color-line-2)] bg-white text-transparent",J?"":"opacity-45"].join(" "),"aria-label":se?`移出 ${F.name} 本次写入`:`写入 ${F.name} 的 TokenBuddy 配置`,"aria-pressed":se,title:se?"移出本次写入":"加入本次写入",onClick:()=>j(F.id),children:i.jsx(Kt,{className:"size-3"})}):null]}),i.jsx("button",{type:"button",onClick:()=>W(F.id),className:["mt-2 inline-flex h-7 items-center justify-center rounded-[7px] px-2 text-[0.72rem] font-semibold transition",ge?"bg-[var(--color-lavender)] text-[var(--color-purple)]":"border border-[var(--color-line-2)] bg-white text-[var(--color-muted)] hover:border-[var(--color-purple)] hover:text-[var(--color-ink)]"].join(" "),children:"查看配置"})]},F.id)})})]}),i.jsx("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-white p-3",children:i.jsx(RM,{client:I,selected:s.includes(I.id),installable:I.id!=="custom"&&L.has(I.id),selectedModel:u,modelOptions:f,providerSelections:p,proxyUrl:h,onToggleInstall:()=>j(I.id),onModelChange:N,onProviderSelectionChange:T})})]}),v?i.jsxs("div",{className:"mt-3 rounded-[10px] border border-[var(--color-line-2)] bg-white p-3",children:[i.jsx("div",{className:"text-[0.8rem] font-semibold text-[var(--color-ink)]",children:"配置文件变更"}),v.length===0?i.jsx("div",{className:"mt-2 rounded-[9px] border border-dashed border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-3 text-[0.8rem] text-[var(--color-muted)]",children:"没有需要写入的配置变更。"}):i.jsx("div",{className:"mt-2 grid max-h-[180px] gap-2 overflow-y-auto pr-1",children:v.map(F=>i.jsxs("div",{className:"rounded-[9px] border border-[var(--color-line-2)] bg-white p-2.5",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[0.78rem] font-semibold text-[var(--color-ink)]",children:[i.jsx("span",{className:"rounded-full bg-[var(--color-page)] px-2 py-0.5",children:XM(F.action)}),i.jsx("span",{children:F.providerId})]}),i.jsx("div",{className:"mt-1 truncate font-mono text-[0.72rem] text-[var(--color-muted)]",children:F.path}),i.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:F.summary})]},`${F.providerId}:${F.path}:${F.summary}`))})]}):null]}),i.jsxs(_t,{className:"flex flex-col gap-3 p-3 lg:flex-row lg:items-center lg:justify-between",children:[i.jsx("div",{className:"text-[0.84rem] leading-6 text-[var(--color-muted)]",children:g?i.jsx("div",{className:"mt-1 font-medium text-[var(--color-ink)]",children:g}):null}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsx("button",{type:"button",onClick:R,className:"inline-flex h-9 items-center justify-center rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-ink)]",children:"上一步:配置策略"}),i.jsxs("button",{type:"button",disabled:y||s.length===0,onClick:E,className:"inline-flex h-9 items-center justify-center gap-2 rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-ink)] transition hover:border-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[y?i.jsx(jt,{className:"size-4 animate-spin"}):null,"预览写入"]}),i.jsxs("button",{type:"button",disabled:x||s.length===0,onClick:D,className:"inline-flex h-9 items-center justify-center gap-2 rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.82rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[x?i.jsx(jt,{className:"size-4 animate-spin"}):null,"写入 TokenBuddy 配置"]})]})]})]})}function RM({client:a,selected:l,installable:o,selectedModel:s,modelOptions:u,providerSelections:f,proxyUrl:p,onToggleInstall:h,onModelChange:v,onProviderSelectionChange:x}){var j,N,T;if(a.id==="custom"){const E=a.manualConfig??Rb(p).manualConfig;return i.jsxs("div",{className:"space-y-3",children:[i.jsx(Zd,{client:a,selected:!1,installable:!1}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(ds,{label:"OpenAI base URL",value:(E==null?void 0:E.openaiBaseUrl)??zb(p)}),i.jsx(ds,{label:"Anthropic base URL",value:(E==null?void 0:E.anthropicBaseUrl)??p}),i.jsx(ds,{label:"API key",value:(E==null?void 0:E.apiKey)??Mf})]}),i.jsx("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:"其他工具只需要填入本地推理服务接口和 key,不会写入本机配置文件。"})]})}if(a.id==="claude-code"){const E=kb(f[a.id],u,s),D=(L,H)=>{x(a.id,{...E,fallbackModel:E.fallbackModel||H||s,roles:{...E.roles,[L]:H?{upstreamModel:H,displayName:H}:void 0}})},R=L=>{x(a.id,{...E,fallbackModel:L}),v(L)};return i.jsxs("div",{className:"space-y-3",children:[i.jsx(Zd,{client:a,selected:l,installable:o,onToggleInstall:h}),i.jsxs("div",{className:"grid gap-2 lg:grid-cols-2",children:[i.jsx(us,{label:"Fallback",value:E.fallbackModel??s,modelOptions:u,onChange:R}),i.jsx(us,{label:"Haiku",value:((j=E.roles.haiku)==null?void 0:j.upstreamModel)??"",modelOptions:u,onChange:L=>D("haiku",L)}),i.jsx(us,{label:"Sonnet",value:((N=E.roles.sonnet)==null?void 0:N.upstreamModel)??"",modelOptions:u,onChange:L=>D("sonnet",L)}),i.jsx(us,{label:"Opus",value:((T=E.roles.opus)==null?void 0:T.upstreamModel)??"",modelOptions:u,onChange:L=>D("opus",L)})]}),i.jsx("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:"Claude Code 会把 Haiku、Sonnet、Opus 三种客户端模型映射到你选择的上游模型。"})]})}const y=Eb(a.id,f[a.id],s),g=E=>{v(E),x(a.id,{selectionKind:"single-model",protocolPreference:Tf(a.id),defaultModel:E})};return i.jsxs("div",{className:"space-y-3",children:[i.jsx(Zd,{client:a,selected:l,installable:o,onToggleInstall:h}),i.jsx(us,{label:"模型",value:y.defaultModel,modelOptions:u,onChange:g}),i.jsxs("div",{className:"grid gap-2 lg:grid-cols-2",children:[i.jsx(ds,{label:"Proxy URL",value:p,compact:!0}),i.jsx(ds,{label:"API key",value:Mf,compact:!0})]}),a.configPath?i.jsx("div",{className:"truncate rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-3 py-2 font-mono text-[0.72rem] text-[var(--color-muted)]",children:a.configPath}):null]})}function Zd({client:a,selected:l,installable:o,onToggleInstall:s}){return i.jsxs("div",{className:"flex flex-col gap-2 border-b border-[var(--color-line-2)] pb-3 sm:flex-row sm:items-start sm:justify-between",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("div",{className:"text-[0.9rem] font-semibold text-[var(--color-ink)]",children:a.name}),i.jsx("span",{className:["rounded-full px-2 py-0.5 text-[0.7rem] font-semibold",a.configured?"bg-emerald-50 text-emerald-700":a.status==="installed"?"bg-[var(--color-lavender)] text-[var(--color-purple)]":"bg-[var(--color-page)] text-[var(--color-muted)]"].join(" "),children:Ob(a)})]}),i.jsx("div",{className:"mt-1 text-[0.74rem] leading-5 text-[var(--color-muted)]",children:a.reason})]}),a.id!=="custom"?i.jsxs("button",{type:"button",disabled:!o,onClick:s,className:["inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-[8px] px-2.5 text-[0.78rem] font-semibold transition disabled:cursor-not-allowed disabled:opacity-45",l?"border border-[var(--color-purple)] bg-white text-[var(--color-purple)] hover:bg-[var(--color-lavender)]":"bg-[var(--color-purple)] text-white hover:bg-[var(--color-purple-2)]"].join(" "),children:[l?i.jsx(Kt,{className:"size-3.5"}):i.jsx(bs,{className:"size-3.5"}),l?"已加入本次写入":"写入 TokenBuddy 配置"]}):null]})}function us({label:a,value:l,modelOptions:o,onChange:s}){return i.jsxs("label",{className:"block",children:[i.jsx("span",{className:"text-[0.74rem] font-semibold text-[var(--color-muted)]",children:a}),i.jsxs("select",{value:l,onChange:u=>s(u.target.value),className:"mt-1 h-9 w-full rounded-[8px] border border-[var(--color-line-2)] bg-white px-2.5 text-[0.82rem] text-[var(--color-ink)] outline-none focus:border-[var(--color-purple)]",children:[i.jsx("option",{value:"",children:"请选择模型"}),o.map(u=>i.jsx("option",{value:u,children:u},u))]})]})}function ds({label:a,value:l,compact:o=!1}){const[s,u]=S.useState(!1),f=async()=>{try{await navigator.clipboard.writeText(l),u(!0),window.setTimeout(()=>u(!1),1200)}catch{u(!1)}};return i.jsxs("div",{className:["rounded-[10px] border border-[var(--color-line-2)] bg-white px-3 py-2",o?"min-w-0":""].join(" "),children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("div",{className:"text-[0.72rem] font-semibold text-[var(--color-muted)]",children:a}),i.jsxs("button",{type:"button",onClick:f,className:"inline-flex h-7 items-center justify-center gap-1 rounded-[7px] border border-[var(--color-line-2)] bg-[var(--color-page)] px-2 text-[0.7rem] font-semibold text-[var(--color-ink)] transition hover:border-[var(--color-purple)]",children:[i.jsx(PS,{className:"size-3"}),s?"已复制":"复制"]})]}),i.jsx("div",{className:"mt-1 truncate font-mono text-[0.76rem] text-[var(--color-ink)]",children:l})]})}function zM({items:a,status:l,generatedAt:o,running:s,error:u,onRefresh:f,onBack:p,onContinue:h}){return i.jsx("div",{className:"space-y-3",children:i.jsxs(_t,{className:"p-3",children:[i.jsx(gi,{index:5,title:"验证网关",detail:"本机状态",meta:s?"checking":tg(l),action:i.jsxs("button",{type:"button",disabled:s,onClick:f,className:"inline-flex h-8 items-center justify-center gap-1.5 rounded-[8px] border border-[var(--color-line-2)] bg-white px-2.5 text-[0.78rem] font-semibold text-[var(--color-ink)] transition hover:border-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[s?i.jsx(jt,{className:"size-3.5 animate-spin"}):i.jsx(xf,{className:"size-3.5"}),"刷新"]})}),i.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[0.76rem] text-[var(--color-muted)]",children:[i.jsx("span",{className:["rounded-full px-2 py-0.5 font-semibold",HM(l)].join(" "),children:s?"正在检查":tg(l)}),o?i.jsxs("span",{children:["检查时间:",new Date(o).toLocaleString()]}):i.jsx("span",{children:"等待后端检查。"})]}),u?i.jsxs("div",{className:"mt-3 rounded-[10px] bg-rose-50 px-3 py-2 text-[0.82rem] leading-6 text-rose-700",children:["检查失败:",u instanceof Error?u.message:String(u)]}):null,i.jsx("div",{className:"mt-3 grid gap-2 xl:grid-cols-2",children:a.map(v=>i.jsxs("div",{className:"flex gap-2.5 rounded-[10px] border border-[var(--color-line-2)] bg-white p-2.5",children:[i.jsx("span",{className:["mt-0.5 grid size-6 shrink-0 place-items-center rounded-full",PM(v.status)].join(" "),children:v.ok?i.jsx(Kt,{className:"size-3.5"}):i.jsx(xf,{className:"size-3.5"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-[0.82rem] font-semibold text-[var(--color-ink)]",children:[v.title,i.jsx("span",{className:["rounded-full px-1.5 py-0.5 text-[0.68rem]",KM(v.status)].join(" "),children:QM(v.status)})]}),i.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:v.body})]})]},v.title))}),i.jsxs("div",{className:"mt-3 flex flex-col gap-2 border-t border-[var(--color-line-2)] pt-3 sm:flex-row sm:items-center sm:justify-between",children:[i.jsx("div",{className:"text-[0.78rem] leading-5 text-[var(--color-muted)]",children:"发现异常时返回对应步骤补齐配置。"}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsx("button",{type:"button",onClick:p,className:"inline-flex h-9 items-center justify-center rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-ink)]",children:"上一步"}),i.jsxs("button",{type:"button",onClick:h,className:"inline-flex h-9 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.82rem] font-semibold text-white transition hover:bg-[var(--color-purple)]",children:["下一步",i.jsx(pc,{className:"size-3.5"})]})]})]})]})})}function _M({complete:a,message:l,installMessage:o,canInstall:s,installed:u,saving:f,onBack:p,onComplete:h,onInstall:v}){return i.jsx("div",{className:"space-y-3",children:i.jsxs(_t,{className:"p-3",children:[i.jsx(gi,{index:6,title:a?"初始化完成":"桌面应用",detail:u?"已安装":"可选安装",meta:a?"complete":u?"installed":"optional",action:i.jsxs("button",{type:"button",disabled:u,onClick:v,className:"inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-2.5 text-[0.78rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[i.jsx(Kt,{className:"size-3.5"}),u?"已安装":"安装应用"]})}),i.jsxs("div",{className:"mt-3 grid gap-3 xl:grid-cols-[minmax(0,290px)_minmax(0,1fr)]",children:[i.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-[var(--color-page)] p-3",children:[i.jsx("div",{className:"text-[0.84rem] font-semibold text-[var(--color-ink)]",children:u?"TokenBuddy 桌面应用已安装":s?"浏览器支持直接安装":"可从浏览器菜单安装"}),i.jsx("div",{className:"mt-1 text-[0.76rem] leading-5 text-[var(--color-muted)]",children:u?"你可以从系统应用入口打开 TokenBuddy。":s?"点击右上角安装按钮并确认浏览器弹窗。":"在地址栏右侧或浏览器菜单中找到安装应用入口。"}),o?i.jsx("div",{className:"mt-2 text-[0.78rem] font-medium text-[var(--color-ink)]",children:o}):null]}),i.jsx("div",{className:"grid gap-2 lg:grid-cols-3",children:[{title:"安装入口",body:"地址栏或浏览器菜单。"},{title:"应用名称",body:"TokenBuddy。"},{title:"本地服务",body:"继续由 tb-proxyd 提供。"}].map((x,y)=>i.jsxs("div",{className:"rounded-[10px] border border-[var(--color-line-2)] bg-white p-2.5",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"grid size-5 place-items-center rounded-full bg-[var(--color-lavender)] font-mono text-[0.68rem] font-semibold text-[var(--color-purple)]",children:y+1}),i.jsx("span",{className:"text-[0.8rem] font-semibold text-[var(--color-ink)]",children:x.title})]}),i.jsx("div",{className:"mt-1 text-[0.74rem] leading-5 text-[var(--color-muted)]",children:x.body})]},x.title))})]}),i.jsxs("div",{className:"mt-3 flex flex-col gap-2 border-t border-[var(--color-line-2)] pt-3 sm:flex-row sm:items-center sm:justify-between",children:[i.jsx("div",{className:"text-[0.78rem] leading-5 text-[var(--color-muted)]",children:l?i.jsx("span",{className:"font-medium text-[var(--color-ink)]",children:l}):"完成后可以进入控制台。"}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsx("button",{type:"button",onClick:p,className:"inline-flex h-9 items-center justify-center rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-ink)]",children:"上一步"}),i.jsxs("button",{type:"button",disabled:f||a,onClick:h,className:"inline-flex h-9 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.82rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[f?i.jsx(jt,{className:"size-3.5 animate-spin"}):i.jsx(Kt,{className:"size-3.5"}),a?"已完成":"完成初始化"]}),i.jsx(mr,{to:"/overview",className:"inline-flex h-9 items-center justify-center rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-ink)] transition hover:border-[var(--color-purple)]",children:"进入控制台"})]})]})]})})}function Tb({backLabel:a,nextLabel:l,saving:o=!1,message:s,onBack:u,onNext:f}){return i.jsxs(_t,{className:"flex flex-col gap-2.5 p-3 sm:flex-row sm:items-center sm:justify-between",children:[i.jsx("div",{className:"text-[0.78rem] leading-5 text-[var(--color-muted)]",children:s??"配置完成后继续下一步。"}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsx("button",{type:"button",onClick:u,className:"inline-flex h-9 items-center justify-center rounded-[8px] border border-[var(--color-line-2)] bg-white px-3 text-[0.82rem] font-semibold text-[var(--color-muted)] transition hover:text-[var(--color-ink)]",children:a}),i.jsxs("button",{type:"button",disabled:o,onClick:f,className:"inline-flex h-9 items-center justify-center gap-1.5 rounded-[8px] bg-[var(--color-ink)] px-3 text-[0.82rem] font-semibold text-white transition hover:bg-[var(--color-purple)] disabled:cursor-not-allowed disabled:opacity-45",children:[o?i.jsx(jt,{className:"size-3.5 animate-spin"}):null,l,o?null:i.jsx(pc,{className:"size-3.5"})]})]})]})}function OM(a,l,o){const s=new Map;for(const p of l){const h=s.get(p.sellerId)??{modelIds:new Set,protocols:new Set,paymentMethods:new Set,ttftMsSamples:[]};h.modelIds.add(p.id);for(const v of p.supportedProtocols)h.protocols.add(v);for(const v of p.paymentMethods)h.paymentMethods.add(v);h.minInputPriceMicrosPer1m=Jx(h.minInputPriceMicrosPer1m,p.inputPriceMicrosPer1m),h.minOutputPriceMicrosPer1m=Jx(h.minOutputPriceMicrosPer1m,p.outputPriceMicrosPer1m),s.set(p.sellerId,h)}for(const p of o){const h=p.sellerKey;if(!h)continue;const v=s.get(h)??{modelIds:new Set,protocols:new Set,paymentMethods:new Set,ttftMsSamples:[]};Number.isFinite(p.ttftMs)&&v.ttftMsSamples.push(p.ttftMs),s.set(h,v)}const u=a.map(p=>{const h=s.get(p.id);return{id:p.id,name:Wx(p.name??p.manifestSellerId??p.id),status:p.status,modelCount:p.modelCount??(h==null?void 0:h.modelIds.size)??0,protocols:p.supportedProtocols??Array.from((h==null?void 0:h.protocols)??[]),paymentMethods:p.paymentMethods??Array.from((h==null?void 0:h.paymentMethods)??[]),discountRatio:p.discountRatio,serviceFeeRatio:p.serviceFeeRatio,minInputPriceMicrosPer1m:h==null?void 0:h.minInputPriceMicrosPer1m,minOutputPriceMicrosPer1m:h==null?void 0:h.minOutputPriceMicrosPer1m,avgTtftMs:p.ttftMs??Ix((h==null?void 0:h.ttftMsSamples)??[]),avgTokensPerSecond:p.avgTokensPerSecond}}),f=new Set(u.map(p=>p.id));for(const[p,h]of s.entries()){if(f.has(p))continue;const v=l.find(x=>x.sellerId===p);u.push({id:p,name:Wx((v==null?void 0:v.sellerName)??p),status:"unknown",modelCount:h.modelIds.size,protocols:Array.from(h.protocols).sort(),paymentMethods:Array.from(h.paymentMethods).sort(),minInputPriceMicrosPer1m:h.minInputPriceMicrosPer1m,minOutputPriceMicrosPer1m:h.minOutputPriceMicrosPer1m,avgTtftMs:Ix(h.ttftMsSamples)})}return Ab(u,{key:"status",direction:"asc"})}function Ab(a,l){const o=l.direction==="asc"?1:-1;return[...a].sort((s,u)=>{const f=DM(s,u,l.key);if(f!==0)return f*o;const p=fc(s.status)-fc(u.status);return p!==0?p:u.modelCount!==s.modelCount?u.modelCount-s.modelCount:s.name.localeCompare(u.name)})}function DM(a,l,o){return o==="status"?fc(a.status)-fc(l.status):o==="name"?a.name.localeCompare(l.name):o==="models"?a.modelCount-l.modelCount:o==="price"?lc(Zx(a),Zx(l)):o==="discount"?lc(a.discountRatio,l.discountRatio):lc(a.avgTtftMs,l.avgTtftMs)||UM(a.avgTokensPerSecond,l.avgTokensPerSecond)}function Zx(a){if(!(!Number.isFinite(a.minInputPriceMicrosPer1m)&&!Number.isFinite(a.minOutputPriceMicrosPer1m)))return(a.minInputPriceMicrosPer1m??0)+(a.minOutputPriceMicrosPer1m??0)}function Jx(a,l){const o=Number.isFinite(a),s=Number.isFinite(l);if(o&&s)return Math.min(a,l);if(o)return a;if(s)return l}function Ix(a){const l=a.filter(o=>Number.isFinite(o));if(l.length!==0)return l.reduce((o,s)=>o+s,0)/l.length}function lc(a,l){const o=Number.isFinite(a),s=Number.isFinite(l);return o&&s?a-l:o?-1:s?1:0}function UM(a,l){return lc(l,a)}function Wx(a){var l;return((l=a.split("(")[0])==null?void 0:l.trim())||a}function eg(a,l,o,s){const u=s||o[0]||"",f={};for(const p of a)p!=="custom"&&(f[p]=p==="claude-code"?kb(l[p],o,u):Eb(p,l[p],u));return f}function Eb(a,l,o){return(l==null?void 0:l.selectionKind)==="single-model"?{...l,protocolPreference:l.protocolPreference??Tf(a),defaultModel:l.defaultModel||o}:{selectionKind:"single-model",protocolPreference:Tf(a),defaultModel:o}}function kb(a,l,o){var f;const s=(a==null?void 0:a.selectionKind)==="claude-role-mapping"?(f=a.roles.sonnet)==null?void 0:f.upstreamModel:void 0,u=o||s||l[0]||"";return(a==null?void 0:a.selectionKind)==="claude-role-mapping"?{...a,protocolPreference:"messages",fallbackModel:a.fallbackModel||u,roles:{...a.roles,sonnet:a.roles.sonnet??(u?{upstreamModel:u,displayName:u}:void 0)}}:{selectionKind:"claude-role-mapping",protocolPreference:"messages",fallbackModel:u,roles:{sonnet:u?{upstreamModel:u,displayName:u}:void 0}}}function Tf(a){if(a==="codex")return"responses";if(a==="claude-code"||a==="claude-desktop")return"messages";if(["openclaw","opencode","hermes"].includes(a))return"chat_completions"}function Rb(a){return{id:"custom",name:"其他工具",status:"manual",detected:!0,configured:!1,reason:"复制本地推理服务接口到任意 OpenAI 或 Anthropic 兼容客户端。",manualConfig:{openaiBaseUrl:zb(a),anthropicBaseUrl:a,apiKey:Mf}}}function zb(a){const l=a.replace(/\/+$/,"");return l.endsWith("/v1")?l:`${l}/v1`}function LM(a){const l=a.trim();return l?l.slice(0,1).toUpperCase():"?"}function BM(a,l,o,s){if(a==="fixed"){const u=o.trim();return u?{mode:a,scorer:l,sellerId:u}:void 0}if(a==="fixedSet"){const u=Array.from(new Set(s.map(f=>f.trim()).filter(Boolean)));return u.length===0?void 0:{mode:a,scorer:l,sellerIds:u}}return{mode:a,scorer:l}}function qM({serviceReady:a,modelCount:l,routingMode:o,paymentReady:s,configuredTools:u}){return[{title:a?"本地网关正在运行":"本地网关尚未就绪",body:a?"控制台服务和本地代理已经响应。":"请确认 tb-proxyd 已启动,并等待控制台刷新状态。",ok:a,status:a?"passed":"failed",details:[]},{title:l>0?"模型目录已加载":"模型目录尚未加载",body:l>0?`已发现 ${l} 个可用模型。`:"请检查节点注册表或网络连接。",ok:l>0,status:l>0?"passed":"failed",details:[]},{title:"路由策略已选择",body:`当前策略为${_b(o)},TokenBuddy 会按这个策略规划节点。`,ok:!!o,status:o?"passed":"failed",details:[]},{title:s?"支付方式可用":"支付方式尚未可用",body:s?"已经检测到至少一个可用支付方式。":"请完成 ClawTip 绑定,或稍后在支付页面补充配置。",ok:s,status:s?"passed":"warning",details:[]},{title:u>0?"终端工具已接入":"终端工具尚未接入",body:u>0?`已经写入 ${u} 个终端工具配置。`:"如果你还没有安装终端工具,可以稍后再执行接入。",ok:u>0,status:u>0?"passed":"warning",details:[]}]}function $M(a){return{title:a.label,body:a.message,ok:a.status==="passed"||a.status==="skipped",status:a.status,details:a.details}}function tg(a){return a==="passed"?"全部通过":a==="warning"?"存在警告":a==="failed"?"需要修复":"等待检查"}function HM(a){return a==="passed"?"bg-emerald-50 text-emerald-700":a==="warning"?"bg-amber-50 text-amber-700":a==="failed"?"bg-rose-50 text-rose-700":"bg-[var(--color-page)] text-[var(--color-muted)]"}function QM(a){return a==="passed"?"通过":a==="warning"?"警告":a==="failed"?"失败":"已跳过"}function PM(a){return a==="passed"?"bg-emerald-50 text-emerald-700":a==="failed"?"bg-rose-50 text-rose-700":a==="skipped"?"bg-slate-100 text-slate-600":"bg-amber-50 text-amber-700"}function KM(a){return a==="passed"?"bg-emerald-50 text-emerald-700":a==="failed"?"bg-rose-50 text-rose-700":a==="skipped"?"bg-slate-100 text-slate-600":"bg-amber-50 text-amber-700"}function _b(a){return a==="fixed"?"固定节点":a==="fixedSet"?"固定节点组":"全自动"}function YM(a){return a==="speed"?"速度优先":a==="discount"?"成本优先":"平衡模式"}function GM(a){const l=a.toLowerCase();return["ok","healthy","active","available"].includes(l)?"状态正常":["error","failed","unavailable"].includes(l)?"状态异常":["unknown","pending"].includes(l)?"等待检测":`状态:${a}`}function VM(a){const l=a.toLowerCase();return["ok","healthy","active","available"].includes(l)?"bg-emerald-50 text-emerald-700":["error","failed","unavailable"].includes(l)?"bg-rose-50 text-rose-700":"bg-amber-50 text-amber-700"}function fc(a){const l=a.toLowerCase();return["ok","healthy","active","available"].includes(l)?0:["unknown","pending"].includes(l)?1:2}function Ob(a){return a.configured?"已配置":a.status==="installed"?"已安装":a.status==="manual"?"需要手动配置":a.detected?"已检测到":"未检测到"}function XM(a){return a==="create"?"创建":"更新"}function FM({app:a,name:l="TokenBuddy",endpoint:o,apiKey:s,model:u,homepage:f}){const p=new URLSearchParams({resource:"provider",app:a,name:l,endpoint:o,apiKey:s});return u!=null&&u.trim()&&p.set("model",u.trim()),f!=null&&f.trim()&&p.set("homepage",f.trim()),`ccswitch://v1/import?${p.toString()}`}const Db="tbp_local_17821_d7f4c9a2b8e1",ZM="https://tokenbuddy.ai",JM={codex:{logo:"/tool-logos/codex.svg",tone:"blue",protocol:"Responses"},"claude-code":{logo:"/tool-logos/claude.svg",tone:"lavender",protocol:"Anthropic Messages"},"claude-desktop":{logo:"/tool-logos/claude.svg",tone:"lavender",protocol:"Anthropic Messages"},opencode:{logo:"/tool-logos/opencode.svg",tone:"green",protocol:"OpenAI Chat Completions"},openclaw:{tone:"amber",protocol:"OpenAI Chat Completions"},hermes:{logo:"/tool-logos/hermes.svg",tone:"gray",protocol:"OpenAI Chat Completions"}},IM={codex:{app:"codex",endpointKind:"openai"},"claude-code":{app:"claude",endpointKind:"anthropic"},"claude-desktop":{app:"claude",endpointKind:"anthropic"},opencode:{app:"opencode",endpointKind:"openai"},openclaw:{app:"openclaw",endpointKind:"openai"}},WM={codex:"https://developers.openai.com/codex/cli","claude-code":"https://code.claude.com/docs/en/setup","claude-desktop":"https://claude.com/download",openclaw:"https://docs.openclaw.ai/install",opencode:"https://opencode.ai/docs/",hermes:"https://github.com/NousResearch/hermes-agent"},fs=[{id:"cline",name:"Cline",logo:"/tool-logos/cline.svg",protocol:"OpenAI-compatible"},{id:"goose",name:"goose",logo:"/tool-logos/goose.svg",protocol:"OpenAI / Anthropic / Ollama compatible"},{id:"cursor",name:"Cursor",logo:"/tool-logos/cursor.svg",protocol:"OpenAI / Anthropic base URL"},{id:"qwen-code",name:"Qwen Code",logo:"/tool-logos/qwen-code.png",protocol:"OpenAI / Anthropic / Google compatible"},{id:"kimi",name:"Kimi Code",protocol:"OpenAI / Anthropic / Responses"},{id:"kilo",name:"Kilo Code",logo:"/tool-logos/kilocode.svg",protocol:"OpenAI-compatible"},{id:"omp",name:"Oh My Pi",logo:"/tool-logos/pi.svg",protocol:"40+ providers / OpenAI-compatible"},{id:"pi",name:"Pi Agent",logo:"/tool-logos/pi.svg",protocol:"OpenAI Responses / Chat / Anthropic"},{id:"crow-cli",name:"crow-cli",protocol:"OpenAI-compatible YAML"},{id:"dimcode",name:"DimCode",protocol:"TUI /connect custom provider"},{id:"dirac",name:"Dirac",logo:"/tool-logos/dirac.ico",protocol:"OpenAI-compatible endpoint"},{id:"factory-droid",name:"Factory Droid",logo:"/tool-logos/factory.svg",protocol:"BYOK custom models"},{id:"fast-agent",name:"fast-agent",logo:"/tool-logos/fast-agent.svg",protocol:"Responses / Chat / Anthropic"},{id:"glm",name:"GLM Agent",logo:"/tool-logos/glm.svg",protocol:"ACP_GLM_BASE_URL"},{id:"minion-code",name:"Minion Code",protocol:"YAML / CLI model override"}];function e3(){var I,ne,F,J,se,ge,fe,O,te,re;const{t:a}=hr(),l=Mb(),o=If(),s=ks(),u=Cb(),f=oM(),[p,h]=S.useState(null),[v,x]=S.useState(null),[y,g]=S.useState(null),j=((I=o.data)==null?void 0:I.proxyPort)??17821,N=((J=(F=(ne=l.data)==null?void 0:ne.clients.find(Z=>Z.id==="custom"))==null?void 0:F.manualConfig)==null?void 0:J.openaiBaseUrl)??`http://127.0.0.1:${j}/v1`,T=((fe=(ge=(se=l.data)==null?void 0:se.clients.find(Z=>Z.id==="custom"))==null?void 0:ge.manualConfig)==null?void 0:fe.anthropicBaseUrl)??`http://127.0.0.1:${j}`,E=((O=s.data)==null?void 0:O.data)??[],D=(((te=l.data)==null?void 0:te.clients)??[]).filter(Z=>Z.id!=="custom"),R=D.length,L=((re=l.data)==null?void 0:re.summary.configuredCount)??0,H=u.isPending||f.isPending,P=s3(u.error,f.error),G=!!(v||P),Q=async(Z,he)=>{try{await navigator.clipboard.writeText(he),g(Z),x(null),window.setTimeout(()=>g(w=>w===Z?null:w),1600)}catch{x(a("tools.copyFailed"))}},q=async Z=>{h(Z.id),x(null);const he=Id(Z.id),w=ng(E,he);if(!w){x(a("tools.noCompatibleModel",{name:Z.name,protocol:i3(he)}));return}const $=await u.mutateAsync({providers:[Z.id],proxyUrl:Id(Z.id)==="messages"?T:N,model:w});x(a("tools.fileChangesApplied",{name:Z.name,count:$.applied.length,plural:$.applied.length===1?"":"s"}))},W=async Z=>{h(Z.id),x(null);const he=await f.mutateAsync({providers:[Z.id]}),w=he.rolledBack.filter(V=>V.action==="restored"||V.action==="removed"||V.action==="cleaned").length,$=he.rolledBack.some(V=>V.action==="missing_snapshot");x($&&w===0?a("tools.noSnapshot",{name:Z.name}):a("tools.disconnectedChanges",{name:Z.name,count:w,plural:w===1?"":"s"}))};return i.jsxs("div",{className:"min-w-0 space-y-4",children:[i.jsxs("section",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("h1",{className:"text-[1.18rem] font-bold leading-7 text-[var(--color-ink)]",children:a("tools.title")}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[0.78rem] text-[var(--color-muted)]",children:[i.jsx("span",{children:a("tools.connectedSummary",{configured:L,total:R})}),i.jsx("span",{"aria-hidden":"true",children:"·"}),i.jsx("span",{className:"font-mono",children:N.replace("http://","")})]})]}),i.jsx("button",{type:"button",title:a("tools.refreshStatus"),"aria-label":a("tools.refreshStatus"),onClick:()=>void l.refetch(),className:"tb-button tb-button-icon tb-button-secondary size-9",children:i.jsx(hi,{className:["size-4",l.isFetching?"animate-spin":""].join(" ")})})]}),i.jsxs("section",{className:"space-y-3",children:[i.jsxs(_t,{className:"overflow-hidden p-0",children:[i.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--color-line-2)] px-4 py-3",children:[i.jsx("div",{className:"min-w-0",children:i.jsx("h2",{className:"text-[0.96rem] font-bold text-[var(--color-ink)]",children:a("tools.oneClick")})}),l.isLoading?i.jsx(jt,{className:"size-4 animate-spin text-[var(--color-muted)]"}):null]}),i.jsxs("div",{className:"hidden border-b border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-4 py-2 text-[0.68rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)] md:grid md:grid-cols-[minmax(12rem,1fr)_minmax(10rem,14rem)_8rem_13rem] md:items-center xl:grid-cols-[minmax(18rem,1fr)_minmax(13rem,18rem)_9rem_16rem]",children:[i.jsx("div",{children:a("tools.tool")}),i.jsx("div",{children:a("tools.protocol")}),i.jsx("div",{children:a("tools.status")}),i.jsx("div",{className:"text-right",children:a("tools.actions")})]}),i.jsx("div",{className:"divide-y divide-[var(--color-line-2)]",children:D.map(Z=>{const he=ng(E,Id(Z.id));return i.jsx(t3,{client:Z,busy:H&&p===Z.id,ccSwitchLink:he?a3(Z.id,N,T,he):void 0,onConfigure:()=>void q(Z),onRollback:()=>void W(Z)},Z.id)})})]}),G?i.jsx(_t,{className:"overflow-hidden",children:i.jsxs("div",{className:"p-3",children:[v?i.jsx("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-success-border)] bg-[var(--color-success-soft)] px-3 py-2 text-[0.82rem] font-medium text-emerald-800",children:v}):null,P?i.jsx("div",{className:"rounded-[var(--radius-md)] border border-[var(--color-danger)]/25 bg-[var(--color-danger-soft)] px-3 py-2 text-[0.82rem] font-medium text-[var(--color-danger)]",children:P}):null]})}):null]}),i.jsx("section",{children:i.jsx(n3,{openAiBaseUrl:N,anthropicBaseUrl:T,copied:y,onCopy:Q})})]})}function t3({client:a,busy:l,ccSwitchLink:o,onConfigure:s,onRollback:u}){const{t:f}=hr(),p=JM[a.id]??{tone:"gray",protocol:"Custom"},h=a.status!=="missing",v=WM[a.id],x=a.configured?"green":a.status==="installed"?"blue":a.status==="missing"?"gray":"amber",y=a.configured?f("common.connected"):a.status==="installed"?f("common.installed"):a.status==="manual"?f("common.manual"):f("common.missing");return i.jsxs("article",{className:"grid gap-3 px-4 py-2.5 md:grid-cols-[minmax(12rem,1fr)_minmax(10rem,14rem)_8rem_13rem] md:items-center xl:grid-cols-[minmax(18rem,1fr)_minmax(13rem,18rem)_9rem_16rem]",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[i.jsx(Af,{logo:p.logo,name:a.name,tone:p.tone,size:"sm"}),i.jsx("div",{className:"min-w-0",children:i.jsx("h3",{className:"truncate text-[0.92rem] font-medium text-[var(--color-ink)]",children:a.name})})]}),i.jsx("div",{className:"hidden min-w-0 truncate text-[0.76rem] font-medium text-[var(--color-muted)] md:block",children:p.protocol}),i.jsx("div",{children:i.jsx(fN,{tone:x,children:y})}),i.jsxs("div",{className:"flex items-center gap-2 md:grid md:w-[13rem] md:grid-cols-[2rem_minmax(0,7rem)] md:justify-end xl:w-[16rem]",children:[o?i.jsx("a",{href:o,title:f("tools.importCcSwitch",{name:a.name}),"aria-label":f("tools.importCcSwitch",{name:a.name}),className:"tb-button tb-button-icon tb-button-secondary",children:i.jsx("img",{src:"/tool-logos/cc-switch.png",alt:"","aria-hidden":"true",className:"size-4 rounded-[var(--radius-xs)]"})}):i.jsx("span",{"aria-hidden":"true",className:"hidden size-8 md:block"}),h?a.configured?i.jsxs("button",{type:"button","aria-label":f("tools.disconnectFrom",{name:a.name}),onClick:u,disabled:l,className:"tb-button tb-button-sm tb-button-secondary flex-1 md:w-full",children:[i.jsx(fj,{className:"size-3.5"}),f("tools.disconnect")]}):i.jsxs("button",{type:"button","aria-label":f("tools.connectTo",{name:a.name}),onClick:s,disabled:l,className:"tb-button tb-button-sm tb-button-primary flex-1 md:w-full",children:[l?i.jsx(jt,{className:"size-3.5 animate-spin"}):i.jsx(Kt,{className:"size-3.5"}),f("tools.connect")]}):v?i.jsxs("a",{href:v,target:"_blank",rel:"noreferrer","aria-label":`${f("tools.getApp")}: ${a.name}`,className:"tb-button tb-button-sm tb-button-primary flex-1 md:w-full",children:[i.jsx(kS,{className:"size-3.5"}),f("tools.getApp")]}):i.jsx("span",{"aria-hidden":"true",className:"hidden h-8 md:block"})]})]})}function Af({logo:a,name:l,tone:o,size:s="md"}){const u={green:"border-[var(--color-success-border)] bg-[var(--color-success-soft)]",blue:"border-[var(--color-tokens-border)] bg-[var(--color-tokens-soft)]",lavender:"border-[var(--color-lavender-2)] bg-[var(--color-lavender)]",amber:"border-amber-100 bg-amber-50",gray:"border-slate-200 bg-slate-50"}[o],f=s==="sm"?"size-8":"size-10",p=s==="sm"?"size-4":"size-5";return i.jsxs("div",{className:["grid shrink-0 place-items-center rounded-[var(--radius-md)] border",f,u].join(" "),children:[a?i.jsx("img",{src:a,alt:"","aria-hidden":"true",className:p}):i.jsx(Sj,{className:"size-4 text-[var(--color-muted)]","aria-hidden":"true"}),i.jsx("span",{className:"sr-only",children:l})]})}function n3({openAiBaseUrl:a,anthropicBaseUrl:l,copied:o,onCopy:s}){var g;const{t:u}=hr(),[f,p]=S.useState(((g=fs[0])==null?void 0:g.id)??null),[h,v]=S.useState(""),x=S.useMemo(()=>{const j=h.trim().toLowerCase();return j?fs.filter(N=>`${N.name} ${N.protocol}`.toLowerCase().includes(j)):fs},[h]),y=fs.find(j=>j.id===f);return i.jsxs(_t,{className:"overflow-hidden p-0",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-[var(--color-line-2)] px-4 py-3",children:[i.jsx("h2",{className:"text-[0.96rem] font-bold text-[var(--color-ink)]",children:u("tools.manualSetup")}),i.jsx("span",{className:"text-[0.72rem] font-medium text-[var(--color-muted)]",children:u("tools.appsCount",{count:fs.length})})]}),i.jsxs("div",{className:"grid gap-0 lg:grid-cols-[minmax(0,1fr)_23rem]",children:[i.jsxs("div",{className:"min-w-0 px-4 py-3",children:[i.jsxs("label",{className:"mb-3 flex h-9 items-center gap-2 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-3 focus-within:border-[var(--color-primary)] focus-within:bg-white",children:[i.jsx(Es,{className:"size-4 shrink-0 text-[var(--color-muted)]","aria-hidden":"true"}),i.jsx("span",{className:"sr-only",children:u("tools.searchApps")}),i.jsx("input",{value:h,onChange:j=>v(j.target.value),placeholder:u("tools.searchAppsPlaceholder"),className:"h-full min-w-0 flex-1 bg-transparent text-[0.82rem] font-medium text-[var(--color-ink)] outline-none placeholder:text-[var(--color-muted)]"})]}),i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 xl:grid-cols-3",children:[x.map(j=>{const N=j.id===f;return i.jsxs("button",{type:"button","aria-pressed":N,onClick:()=>p(j.id),className:["flex min-h-[3.75rem] min-w-0 items-center gap-2 rounded-[var(--radius-md)] border px-2.5 py-2 text-left transition",N?"border-[var(--color-primary)] bg-[var(--color-primary-soft)] shadow-[inset_0_0_0_1px_var(--color-primary)]":"border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] hover:border-[var(--color-lavender-2)]"].join(" "),children:[i.jsx(Af,{logo:j.logo,name:j.name,tone:N?"lavender":"gray"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"truncate text-[0.8rem] font-medium text-[var(--color-ink)]",children:j.name}),i.jsx("div",{className:"mt-0.5 truncate text-[0.68rem] text-[var(--color-muted)]",children:j.protocol})]})]},j.id)}),x.length===0?i.jsx("div",{className:"rounded-[var(--radius-md)] border border-dashed border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-3 py-6 text-center text-[0.78rem] font-medium text-[var(--color-muted)] sm:col-span-2 xl:col-span-3",children:u("tools.noMatchingApp")}):null]})]}),i.jsx("div",{className:"border-t border-[var(--color-line-2)] bg-[var(--color-panel-subtle)] px-4 py-3 lg:border-l lg:border-t-0",children:i.jsxs("div",{className:"sticky top-3 space-y-3",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[i.jsx(Af,{logo:y==null?void 0:y.logo,name:(y==null?void 0:y.name)??"Selected app",tone:"lavender"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[0.68rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:u("tools.configuration")}),i.jsx("div",{className:"truncate text-[0.96rem] font-medium text-[var(--color-ink)]",children:(y==null?void 0:y.name)??"Select an app"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(Jd,{label:u("tools.openAiBaseUrl"),value:a,copyKey:"manual-openai",copied:o,onCopy:s}),i.jsx(Jd,{label:u("tools.anthropicBaseUrl"),value:l,copyKey:"manual-anthropic",copied:o,onCopy:s}),i.jsx(Jd,{label:u("tools.apiKey"),value:Db,copyKey:"manual-key",copied:o,onCopy:s})]})]})})]})]})}function Jd({label:a,value:l,copyKey:o,copied:s,onCopy:u,compact:f=!1}){return i.jsxs("div",{className:["flex items-center gap-2 rounded-[var(--radius-md)] border border-[var(--color-line-2)] bg-white px-2.5",f?"py-1.5":"py-2"].join(" "),children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("div",{className:"text-[0.68rem] font-bold uppercase tracking-[0.08em] text-[var(--color-muted)]",children:a}),i.jsx("div",{className:"mt-0.5 truncate font-mono text-[0.78rem] text-[var(--color-ink)]",children:l||Me})]}),i.jsx("button",{type:"button",onClick:()=>void u(o,l),className:"tb-button tb-button-icon tb-button-secondary",children:s===o?i.jsx(Kt,{className:"size-4"}):i.jsx(HS,{className:"size-4"})})]})}function Id(a){return a==="codex"?"responses":a==="claude-code"||a==="claude-desktop"?"messages":"chat_completions"}function a3(a,l,o,s){const u=IM[a];if(u)return FM({app:u.app,endpoint:u.endpointKind==="anthropic"?o:l,apiKey:Db,model:s,homepage:ZM})}function ng(a,l){const o=a.filter(s=>l3(s,l)).map(s=>s.id);return r3(o)}function l3(a,l){return l==="messages"?a.supportedProtocols.includes("messages")||a.supportedProtocols.includes("anthropic_messages"):a.supportedProtocols.includes(l)}function r3(a){return a.find(l=>l==="gpt-5.4")??a.find(l=>l.toLowerCase().includes("gpt"))??a[0]??void 0}function i3(a){return a==="responses"?"Responses":a==="messages"?"Messages":"Chat Completions"}function s3(...a){const l=a.find(Boolean);return l instanceof Error?l.message:void 0}function o3({compact:a=!1,className:l="",hideTextBelowSm:o=!1,showAi:s=!1}){return i.jsxs("span",{"data-no-translate":"true",className:["inline-flex min-w-0 items-center gap-2",l].join(" "),children:[i.jsx(c3,{className:a?"size-6":"size-7"}),i.jsxs("span",{className:["min-w-0 font-mono text-[0.84rem] font-black uppercase leading-none tracking-[0.12em] text-[var(--color-ink)]",o?"hidden min-[420px]:inline":""].join(" "),children:["Token",i.jsx("span",{className:"text-[var(--color-primary)]",children:"Buddy"}),s?i.jsx("span",{className:"text-[var(--color-muted)]",children:".AI"}):null]})]})}function c3({className:a}){return i.jsxs("svg",{className:a,viewBox:"0 0 32 32","aria-hidden":"true",focusable:"false",children:[i.jsx("rect",{x:"2.5",y:"2.5",width:"27",height:"27",rx:"8",fill:"#ffffff",stroke:"var(--color-line)"}),i.jsx("path",{d:"M9.5 19.5V12.5L16 8.75L22.5 12.5V19.5L16 23.25L9.5 19.5Z",fill:"var(--color-primary-soft)",stroke:"var(--color-primary)",strokeWidth:"1.7",strokeLinejoin:"round"}),i.jsx("path",{d:"M16 8.75V23.25M9.5 12.5L16 16.25L22.5 12.5",fill:"none",stroke:"var(--color-primary-deep)",strokeWidth:"1.45",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("circle",{cx:"23.25",cy:"8.75",r:"2.35",fill:"var(--color-success)",stroke:"#ffffff",strokeWidth:"1.3"})]})}function u3(){const{t:a}=hr();return i.jsxs("div",{className:"min-h-full",children:[i.jsxs("nav",{"aria-label":"Primary",className:"sticky top-0 z-10 flex h-12 items-center gap-2 border-b border-[var(--color-line-2)] bg-[var(--color-page)]/95 px-3 backdrop-blur sm:gap-5 sm:px-6",children:[i.jsx(qf,{to:"/overview","aria-label":"TokenBuddy home",className:"group inline-flex shrink-0 items-center rounded-[var(--radius-md)] px-1 py-1.5 focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)]",children:i.jsx(o3,{compact:!0,hideTextBelowSm:!0})}),i.jsxs("div",{className:"ml-auto flex min-w-0 gap-0.5 sm:gap-1",children:[i.jsx(Wo,{to:"/overview",children:a("nav.overview")}),i.jsx(Wo,{to:"/routing",children:a("nav.routing")}),i.jsx(Wo,{to:"/ledger",children:a("nav.ledger")}),i.jsx(Wo,{to:"/tools",children:a("nav.tools")})]}),i.jsx(d3,{})]}),i.jsx("main",{className:"mx-auto max-w-[1180px] px-3 py-5 sm:px-6 sm:py-7",children:i.jsxs(W1,{children:[i.jsx(tr,{path:"/",element:i.jsx(Rx,{})}),i.jsx(tr,{path:"/overview",element:i.jsx(Rx,{})}),i.jsx(tr,{path:"/init",element:i.jsx(hM,{})}),i.jsx(tr,{path:"/routing",element:i.jsx(ZN,{})}),i.jsx(tr,{path:"/ledger",element:i.jsx(Qw,{})}),i.jsx(tr,{path:"/tools",element:i.jsx(e3,{})})]})})]})}function d3(){const{language:a,setLanguage:l,t:o}=hr(),s=[{value:"en",label:o("language.english"),ariaLabel:o("language.switchToEnglish")},{value:"zh",label:o("language.chinese"),ariaLabel:o("language.switchToChinese")}];return i.jsx("div",{className:"ml-1 inline-flex h-8 shrink-0 items-center rounded-full border border-[var(--color-line-2)] bg-white p-0.5 shadow-[var(--shadow-chip)]","aria-label":o("language.label"),children:s.map(u=>i.jsx("button",{type:"button",onClick:()=>l(u.value),"aria-label":u.ariaLabel,"aria-pressed":a===u.value,className:["h-6 rounded-full px-2 text-[0.68rem] font-bold transition",a===u.value?"bg-[var(--color-primary)] text-white shadow-[0_1px_5px_rgba(124,61,240,0.26)]":"text-[var(--color-muted)] hover:bg-[var(--color-primary-soft)] hover:text-[var(--color-primary-deep)]"].join(" "),children:u.label},u.value))})}function Wo({to:a,children:l}){return i.jsx(qf,{to:a,className:({isActive:o})=>["rounded-[var(--radius-md)] px-2 py-1.5 text-[0.82rem] font-medium transition-colors sm:px-3.5 sm:text-[0.92rem]",o?"font-semibold text-[var(--color-ink)] underline decoration-[var(--color-primary)] decoration-2 underline-offset-[10px]":"text-[var(--color-muted)] hover:text-[var(--color-ink)]"].join(" "),children:l})}function f3(){!("serviceWorker"in navigator)||window.location.port==="5173"||window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(()=>{})})}const m3=new iS({defaultOptions:{queries:{staleTime:5e3,refetchOnWindowFocus:!1,retry:1}}});t1.createRoot(document.getElementById("root")).render(i.jsx(S.StrictMode,{children:i.jsx(sS,{client:m3,children:i.jsx(mN,{children:i.jsx(w2,{children:i.jsx(u3,{})})})})}));f3();
271
+ //# sourceMappingURL=index-Djfl9tw5.js.map