@openrig/cli 0.1.5 → 0.1.7

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 (151) hide show
  1. package/daemon/dist/adapters/claude-resume.js +1 -1
  2. package/daemon/dist/adapters/cmux-transport.d.ts.map +1 -1
  3. package/daemon/dist/adapters/cmux-transport.js +40 -3
  4. package/daemon/dist/adapters/cmux-transport.js.map +1 -1
  5. package/daemon/dist/adapters/cmux.d.ts +4 -2
  6. package/daemon/dist/adapters/cmux.d.ts.map +1 -1
  7. package/daemon/dist/adapters/cmux.js +90 -11
  8. package/daemon/dist/adapters/cmux.js.map +1 -1
  9. package/daemon/dist/adapters/compose-services-adapter.d.ts +73 -0
  10. package/daemon/dist/adapters/compose-services-adapter.d.ts.map +1 -0
  11. package/daemon/dist/adapters/compose-services-adapter.js +195 -0
  12. package/daemon/dist/adapters/compose-services-adapter.js.map +1 -0
  13. package/daemon/dist/adapters/tmux-exec.d.ts.map +1 -1
  14. package/daemon/dist/adapters/tmux-exec.js +22 -2
  15. package/daemon/dist/adapters/tmux-exec.js.map +1 -1
  16. package/daemon/dist/db/migrations/020_rig_services.d.ts +3 -0
  17. package/daemon/dist/db/migrations/020_rig_services.d.ts.map +1 -0
  18. package/daemon/dist/db/migrations/020_rig_services.js +17 -0
  19. package/daemon/dist/db/migrations/020_rig_services.js.map +1 -0
  20. package/daemon/dist/domain/bootstrap-orchestrator.d.ts +7 -0
  21. package/daemon/dist/domain/bootstrap-orchestrator.d.ts.map +1 -1
  22. package/daemon/dist/domain/bootstrap-orchestrator.js +73 -1
  23. package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
  24. package/daemon/dist/domain/compose-project-name.d.ts +3 -0
  25. package/daemon/dist/domain/compose-project-name.d.ts.map +1 -0
  26. package/daemon/dist/domain/compose-project-name.js +16 -0
  27. package/daemon/dist/domain/compose-project-name.js.map +1 -0
  28. package/daemon/dist/domain/native-resume-probe.js +5 -2
  29. package/daemon/dist/domain/native-resume-probe.js.map +1 -1
  30. package/daemon/dist/domain/node-cmux-service.d.ts +19 -0
  31. package/daemon/dist/domain/node-cmux-service.d.ts.map +1 -0
  32. package/daemon/dist/domain/node-cmux-service.js +75 -0
  33. package/daemon/dist/domain/node-cmux-service.js.map +1 -0
  34. package/daemon/dist/domain/node-inventory.js +1 -1
  35. package/daemon/dist/domain/node-inventory.js.map +1 -1
  36. package/daemon/dist/domain/restore-orchestrator.d.ts +2 -0
  37. package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
  38. package/daemon/dist/domain/restore-orchestrator.js +13 -0
  39. package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
  40. package/daemon/dist/domain/rig-repository.d.ts +6 -1
  41. package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
  42. package/daemon/dist/domain/rig-repository.js +65 -0
  43. package/daemon/dist/domain/rig-repository.js.map +1 -1
  44. package/daemon/dist/domain/rig-teardown.d.ts +1 -0
  45. package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
  46. package/daemon/dist/domain/rig-teardown.js +17 -0
  47. package/daemon/dist/domain/rig-teardown.js.map +1 -1
  48. package/daemon/dist/domain/rigspec-instantiator.d.ts +7 -0
  49. package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
  50. package/daemon/dist/domain/rigspec-instantiator.js +7 -0
  51. package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
  52. package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
  53. package/daemon/dist/domain/rigspec-schema.js +200 -0
  54. package/daemon/dist/domain/rigspec-schema.js.map +1 -1
  55. package/daemon/dist/domain/service-orchestrator.d.ts +59 -0
  56. package/daemon/dist/domain/service-orchestrator.d.ts.map +1 -0
  57. package/daemon/dist/domain/service-orchestrator.js +172 -0
  58. package/daemon/dist/domain/service-orchestrator.js.map +1 -0
  59. package/daemon/dist/domain/services-readiness.d.ts +23 -0
  60. package/daemon/dist/domain/services-readiness.d.ts.map +1 -0
  61. package/daemon/dist/domain/services-readiness.js +63 -0
  62. package/daemon/dist/domain/services-readiness.js.map +1 -0
  63. package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
  64. package/daemon/dist/domain/snapshot-capture.js +10 -0
  65. package/daemon/dist/domain/snapshot-capture.js.map +1 -1
  66. package/daemon/dist/domain/spec-library-service.d.ts +1 -0
  67. package/daemon/dist/domain/spec-library-service.d.ts.map +1 -1
  68. package/daemon/dist/domain/spec-library-service.js +7 -0
  69. package/daemon/dist/domain/spec-library-service.js.map +1 -1
  70. package/daemon/dist/domain/spec-review-service.d.ts +29 -0
  71. package/daemon/dist/domain/spec-review-service.d.ts.map +1 -1
  72. package/daemon/dist/domain/spec-review-service.js +26 -0
  73. package/daemon/dist/domain/spec-review-service.js.map +1 -1
  74. package/daemon/dist/domain/types.d.ts +83 -0
  75. package/daemon/dist/domain/types.d.ts.map +1 -1
  76. package/daemon/dist/openrig-compat.d.ts.map +1 -1
  77. package/daemon/dist/openrig-compat.js +4 -1
  78. package/daemon/dist/openrig-compat.js.map +1 -1
  79. package/daemon/dist/routes/adapters.js +3 -2
  80. package/daemon/dist/routes/adapters.js.map +1 -1
  81. package/daemon/dist/routes/env.d.ts +3 -0
  82. package/daemon/dist/routes/env.d.ts.map +1 -0
  83. package/daemon/dist/routes/env.js +119 -0
  84. package/daemon/dist/routes/env.js.map +1 -0
  85. package/daemon/dist/routes/sessions.d.ts.map +1 -1
  86. package/daemon/dist/routes/sessions.js +14 -0
  87. package/daemon/dist/routes/sessions.js.map +1 -1
  88. package/daemon/dist/routes/spec-library.d.ts.map +1 -1
  89. package/daemon/dist/routes/spec-library.js +21 -0
  90. package/daemon/dist/routes/spec-library.js.map +1 -1
  91. package/daemon/dist/server.d.ts +3 -0
  92. package/daemon/dist/server.d.ts.map +1 -1
  93. package/daemon/dist/server.js +5 -0
  94. package/daemon/dist/server.js.map +1 -1
  95. package/daemon/dist/startup.d.ts.map +1 -1
  96. package/daemon/dist/startup.js +15 -3
  97. package/daemon/dist/startup.js.map +1 -1
  98. package/daemon/specs/agents/apps/vault-specialist/agent.yaml +36 -0
  99. package/daemon/specs/agents/apps/vault-specialist/guidance/role.md +34 -0
  100. package/daemon/specs/agents/apps/vault-specialist/skills/vault-user/SKILL.md +64 -0
  101. package/daemon/specs/agents/apps/vault-specialist/startup/context.md +46 -0
  102. package/daemon/specs/agents/development/implementer/agent.yaml +1 -1
  103. package/daemon/specs/agents/development/implementer/guidance/role.md +1 -0
  104. package/daemon/specs/agents/orchestration/orchestrator/agent.yaml +1 -1
  105. package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +1 -0
  106. package/daemon/specs/agents/shared/agent.yaml +2 -0
  107. package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +53 -2
  108. package/daemon/specs/agents/shared/skills/mental-model-ha/SKILL.md +953 -0
  109. package/daemon/specs/rigs/launch/secrets-manager/rig.yaml +37 -0
  110. package/daemon/specs/rigs/launch/secrets-manager/secrets-manager.compose.yaml +18 -0
  111. package/dist/commands/destroy.d.ts +9 -0
  112. package/dist/commands/destroy.d.ts.map +1 -0
  113. package/dist/commands/destroy.js +175 -0
  114. package/dist/commands/destroy.js.map +1 -0
  115. package/dist/commands/doctor.d.ts +1 -0
  116. package/dist/commands/doctor.d.ts.map +1 -1
  117. package/dist/commands/doctor.js +82 -7
  118. package/dist/commands/doctor.js.map +1 -1
  119. package/dist/commands/down.d.ts.map +1 -1
  120. package/dist/commands/down.js +2 -1
  121. package/dist/commands/down.js.map +1 -1
  122. package/dist/commands/env.d.ts +4 -0
  123. package/dist/commands/env.d.ts.map +1 -0
  124. package/dist/commands/env.js +139 -0
  125. package/dist/commands/env.js.map +1 -0
  126. package/dist/commands/restore.d.ts.map +1 -1
  127. package/dist/commands/restore.js +2 -1
  128. package/dist/commands/restore.js.map +1 -1
  129. package/dist/commands/specs.d.ts.map +1 -1
  130. package/dist/commands/specs.js +11 -4
  131. package/dist/commands/specs.js.map +1 -1
  132. package/dist/commands/up.d.ts.map +1 -1
  133. package/dist/commands/up.js +9 -2
  134. package/dist/commands/up.js.map +1 -1
  135. package/dist/destroy-helpers.d.ts +63 -0
  136. package/dist/destroy-helpers.d.ts.map +1 -0
  137. package/dist/destroy-helpers.js +224 -0
  138. package/dist/destroy-helpers.js.map +1 -0
  139. package/dist/index.d.ts +3 -0
  140. package/dist/index.d.ts.map +1 -1
  141. package/dist/index.js +4 -0
  142. package/dist/index.js.map +1 -1
  143. package/dist/openrig-compat.d.ts.map +1 -1
  144. package/dist/openrig-compat.js +4 -1
  145. package/dist/openrig-compat.js.map +1 -1
  146. package/package.json +1 -1
  147. package/ui/dist/assets/index-BsXbqPEl.css +1 -0
  148. package/ui/dist/assets/index-CXZYxZbF.js +225 -0
  149. package/ui/dist/index.html +2 -2
  150. package/ui/dist/assets/index-DGPFTQEV.css +0 -1
  151. package/ui/dist/assets/index-VA_A8dpm.js +0 -224
@@ -1,224 +0,0 @@
1
- var GC=Object.defineProperty;var nb=e=>{throw TypeError(e)};var YC=(e,t,s)=>t in e?GC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var bl=(e,t,s)=>YC(e,typeof t!="symbol"?t+"":t,s),Gm=(e,t,s)=>t.has(e)||nb("Cannot "+s);var X=(e,t,s)=>(Gm(e,t,"read from private field"),s?s.call(e):t.get(e)),je=(e,t,s)=>t.has(e)?nb("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),me=(e,t,s,r)=>(Gm(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),Le=(e,t,s)=>(Gm(e,t,"access private method"),s);var Qu=(e,t,s,r)=>({set _(i){me(e,t,i,s)},get _(){return X(e,t,r)}});function QC(e,t){for(var s=0;s<t.length;s++){const r=t[s];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(r,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const d of l.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function s(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(i){if(i.ep)return;i.ep=!0;const l=s(i);fetch(i.href,l)}})();function yg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ym={exports:{}},Sl={};/**
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 sb;function KC(){if(sb)return Sl;sb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(r,i,l){var d=null;if(l!==void 0&&(d=""+l),i.key!==void 0&&(d=""+i.key),"key"in i){l={};for(var f in i)f!=="key"&&(l[f]=i[f])}else l=i;return i=l.ref,{$$typeof:e,type:r,key:d,ref:i!==void 0?i:null,props:l}}return Sl.Fragment=t,Sl.jsx=s,Sl.jsxs=s,Sl}var ab;function FC(){return ab||(ab=1,Ym.exports=KC()),Ym.exports}var u=FC(),Qm={exports:{}},ke={};/**
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 rb;function XC(){if(rb)return ke;rb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function b(P){return P===null||typeof P!="object"?null:(P=y&&P[y]||P["@@iterator"],typeof P=="function"?P:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,N={};function C(P,Q,ee){this.props=P,this.context=Q,this.refs=N,this.updater=ee||S}C.prototype.isReactComponent={},C.prototype.setState=function(P,Q){if(typeof P!="object"&&typeof P!="function"&&P!=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,P,Q,"setState")},C.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function T(){}T.prototype=C.prototype;function _(P,Q,ee){this.props=P,this.context=Q,this.refs=N,this.updater=ee||S}var R=_.prototype=new T;R.constructor=_,w(R,C.prototype),R.isPureReactComponent=!0;var O=Array.isArray;function B(){}var L={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function I(P,Q,ee){var se=ee.ref;return{$$typeof:e,type:P,key:Q,ref:se!==void 0?se:null,props:ee}}function H(P,Q){return I(P.type,Q,P.props)}function D(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function Y(P){var Q={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(ee){return Q[ee]})}var K=/\/+/g;function U(P,Q){return typeof P=="object"&&P!==null&&P.key!=null?Y(""+P.key):Q.toString(36)}function q(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(B,B):(P.status="pending",P.then(function(Q){P.status==="pending"&&(P.status="fulfilled",P.value=Q)},function(Q){P.status==="pending"&&(P.status="rejected",P.reason=Q)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function A(P,Q,ee,se,oe){var ce=typeof P;(ce==="undefined"||ce==="boolean")&&(P=null);var fe=!1;if(P===null)fe=!0;else switch(ce){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(P.$$typeof){case e:case t:fe=!0;break;case v:return fe=P._init,A(fe(P._payload),Q,ee,se,oe)}}if(fe)return oe=oe(P),fe=se===""?"."+U(P,0):se,O(oe)?(ee="",fe!=null&&(ee=fe.replace(K,"$&/")+"/"),A(oe,Q,ee,"",function(Ce){return Ce})):oe!=null&&(D(oe)&&(oe=H(oe,ee+(oe.key==null||P&&P.key===oe.key?"":(""+oe.key).replace(K,"$&/")+"/")+fe)),Q.push(oe)),1;fe=0;var ue=se===""?".":se+":";if(O(P))for(var he=0;he<P.length;he++)se=P[he],ce=ue+U(se,he),fe+=A(se,Q,ee,ce,oe);else if(he=b(P),typeof he=="function")for(P=he.call(P),he=0;!(se=P.next()).done;)se=se.value,ce=ue+U(se,he++),fe+=A(se,Q,ee,ce,oe);else if(ce==="object"){if(typeof P.then=="function")return A(q(P),Q,ee,se,oe);throw Q=String(P),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return fe}function $(P,Q,ee){if(P==null)return P;var se=[],oe=0;return A(P,se,"","",function(ce){return Q.call(ee,ce,oe++)}),se}function z(P){if(P._status===-1){var Q=P._result;Q=Q(),Q.then(function(ee){(P._status===0||P._status===-1)&&(P._status=1,P._result=ee)},function(ee){(P._status===0||P._status===-1)&&(P._status=2,P._result=ee)}),P._status===-1&&(P._status=0,P._result=Q)}if(P._status===1)return P._result.default;throw P._result}var G=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},V={map:$,forEach:function(P,Q,ee){$(P,function(){Q.apply(this,arguments)},ee)},count:function(P){var Q=0;return $(P,function(){Q++}),Q},toArray:function(P){return $(P,function(Q){return Q})||[]},only:function(P){if(!D(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return ke.Activity=g,ke.Children=V,ke.Component=C,ke.Fragment=s,ke.Profiler=i,ke.PureComponent=_,ke.StrictMode=r,ke.Suspense=m,ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,ke.__COMPILER_RUNTIME={__proto__:null,c:function(P){return L.H.useMemoCache(P)}},ke.cache=function(P){return function(){return P.apply(null,arguments)}},ke.cacheSignal=function(){return null},ke.cloneElement=function(P,Q,ee){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var se=w({},P.props),oe=P.key;if(Q!=null)for(ce in Q.key!==void 0&&(oe=""+Q.key),Q)!M.call(Q,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&Q.ref===void 0||(se[ce]=Q[ce]);var ce=arguments.length-2;if(ce===1)se.children=ee;else if(1<ce){for(var fe=Array(ce),ue=0;ue<ce;ue++)fe[ue]=arguments[ue+2];se.children=fe}return I(P.type,oe,se)},ke.createContext=function(P){return P={$$typeof:d,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:l,_context:P},P},ke.createElement=function(P,Q,ee){var se,oe={},ce=null;if(Q!=null)for(se in Q.key!==void 0&&(ce=""+Q.key),Q)M.call(Q,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(oe[se]=Q[se]);var fe=arguments.length-2;if(fe===1)oe.children=ee;else if(1<fe){for(var ue=Array(fe),he=0;he<fe;he++)ue[he]=arguments[he+2];oe.children=ue}if(P&&P.defaultProps)for(se in fe=P.defaultProps,fe)oe[se]===void 0&&(oe[se]=fe[se]);return I(P,ce,oe)},ke.createRef=function(){return{current:null}},ke.forwardRef=function(P){return{$$typeof:f,render:P}},ke.isValidElement=D,ke.lazy=function(P){return{$$typeof:v,_payload:{_status:-1,_result:P},_init:z}},ke.memo=function(P,Q){return{$$typeof:h,type:P,compare:Q===void 0?null:Q}},ke.startTransition=function(P){var Q=L.T,ee={};L.T=ee;try{var se=P(),oe=L.S;oe!==null&&oe(ee,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(B,G)}catch(ce){G(ce)}finally{Q!==null&&ee.types!==null&&(Q.types=ee.types),L.T=Q}},ke.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},ke.use=function(P){return L.H.use(P)},ke.useActionState=function(P,Q,ee){return L.H.useActionState(P,Q,ee)},ke.useCallback=function(P,Q){return L.H.useCallback(P,Q)},ke.useContext=function(P){return L.H.useContext(P)},ke.useDebugValue=function(){},ke.useDeferredValue=function(P,Q){return L.H.useDeferredValue(P,Q)},ke.useEffect=function(P,Q){return L.H.useEffect(P,Q)},ke.useEffectEvent=function(P){return L.H.useEffectEvent(P)},ke.useId=function(){return L.H.useId()},ke.useImperativeHandle=function(P,Q,ee){return L.H.useImperativeHandle(P,Q,ee)},ke.useInsertionEffect=function(P,Q){return L.H.useInsertionEffect(P,Q)},ke.useLayoutEffect=function(P,Q){return L.H.useLayoutEffect(P,Q)},ke.useMemo=function(P,Q){return L.H.useMemo(P,Q)},ke.useOptimistic=function(P,Q){return L.H.useOptimistic(P,Q)},ke.useReducer=function(P,Q,ee){return L.H.useReducer(P,Q,ee)},ke.useRef=function(P){return L.H.useRef(P)},ke.useState=function(P){return L.H.useState(P)},ke.useSyncExternalStore=function(P,Q,ee){return L.H.useSyncExternalStore(P,Q,ee)},ke.useTransition=function(){return L.H.useTransition()},ke.version="19.2.4",ke}var ib;function pc(){return ib||(ib=1,Qm.exports=XC()),Qm.exports}var j=pc();const Xr=yg(j),vg=QC({__proto__:null,default:Xr},[j]);var Km={exports:{}},wl={},Fm={exports:{}},Xm={};/**
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 ob;function ZC(){return ob||(ob=1,(function(e){function t(A,$){var z=A.length;A.push($);e:for(;0<z;){var G=z-1>>>1,V=A[G];if(0<i(V,$))A[G]=$,A[z]=V,z=G;else break e}}function s(A){return A.length===0?null:A[0]}function r(A){if(A.length===0)return null;var $=A[0],z=A.pop();if(z!==$){A[0]=z;e:for(var G=0,V=A.length,P=V>>>1;G<P;){var Q=2*(G+1)-1,ee=A[Q],se=Q+1,oe=A[se];if(0>i(ee,z))se<V&&0>i(oe,ee)?(A[G]=oe,A[se]=z,G=se):(A[G]=ee,A[Q]=z,G=Q);else if(se<V&&0>i(oe,z))A[G]=oe,A[se]=z,G=se;else break e}}return $}function i(A,$){var z=A.sortIndex-$.sortIndex;return z!==0?z:A.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],h=[],v=1,g=null,y=3,b=!1,S=!1,w=!1,N=!1,C=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function R(A){for(var $=s(h);$!==null;){if($.callback===null)r(h);else if($.startTime<=A)r(h),$.sortIndex=$.expirationTime,t(m,$);else break;$=s(h)}}function O(A){if(w=!1,R(A),!S)if(s(m)!==null)S=!0,B||(B=!0,Y());else{var $=s(h);$!==null&&q(O,$.startTime-A)}}var B=!1,L=-1,M=5,I=-1;function H(){return N?!0:!(e.unstable_now()-I<M)}function D(){if(N=!1,B){var A=e.unstable_now();I=A;var $=!0;try{e:{S=!1,w&&(w=!1,T(L),L=-1),b=!0;var z=y;try{t:{for(R(A),g=s(m);g!==null&&!(g.expirationTime>A&&H());){var G=g.callback;if(typeof G=="function"){g.callback=null,y=g.priorityLevel;var V=G(g.expirationTime<=A);if(A=e.unstable_now(),typeof V=="function"){g.callback=V,R(A),$=!0;break t}g===s(m)&&r(m),R(A)}else r(m);g=s(m)}if(g!==null)$=!0;else{var P=s(h);P!==null&&q(O,P.startTime-A),$=!1}}break e}finally{g=null,y=z,b=!1}$=void 0}}finally{$?Y():B=!1}}}var Y;if(typeof _=="function")Y=function(){_(D)};else if(typeof MessageChannel<"u"){var K=new MessageChannel,U=K.port2;K.port1.onmessage=D,Y=function(){U.postMessage(null)}}else Y=function(){C(D,0)};function q(A,$){L=C(function(){A(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(A){A.callback=null},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(A){switch(y){case 1:case 2:case 3:var $=3;break;default:$=y}var z=y;y=$;try{return A()}finally{y=z}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(A,$){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var z=y;y=A;try{return $()}finally{y=z}},e.unstable_scheduleCallback=function(A,$,z){var G=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?G+z:G):z=G,A){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=z+V,A={id:v++,callback:$,priorityLevel:A,startTime:z,expirationTime:V,sortIndex:-1},z>G?(A.sortIndex=z,t(h,A),s(m)===null&&A===s(h)&&(w?(T(L),L=-1):w=!0,q(O,z-G))):(A.sortIndex=V,t(m,A),S||b||(S=!0,B||(B=!0,Y()))),A},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(A){var $=y;return function(){var z=y;y=$;try{return A.apply(this,arguments)}finally{y=z}}}})(Xm)),Xm}var lb;function WC(){return lb||(lb=1,Fm.exports=ZC()),Fm.exports}var Zm={exports:{}},Bt={};/**
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 cb;function JC(){if(cb)return Bt;cb=1;var e=pc();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)h+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var r={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},i=Symbol.for("react.portal");function l(m,h,v){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:g==null?null:""+g,children:m,containerInfo:h,implementation:v}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Bt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Bt.createPortal=function(m,h){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return l(m,h,null,v)},Bt.flushSync=function(m){var h=d.T,v=r.p;try{if(d.T=null,r.p=2,m)return m()}finally{d.T=h,r.p=v,r.d.f()}},Bt.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(m,h))},Bt.prefetchDNS=function(m){typeof m=="string"&&r.d.D(m)},Bt.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var v=h.as,g=f(v,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;v==="style"?r.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:y,fetchPriority:b}):v==="script"&&r.d.X(m,{crossOrigin:g,integrity:y,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Bt.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var v=f(h.as,h.crossOrigin);r.d.M(m,{crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(m)},Bt.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var v=h.as,g=f(v,h.crossOrigin);r.d.L(m,v,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Bt.preloadModule=function(m,h){if(typeof m=="string")if(h){var v=f(h.as,h.crossOrigin);r.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:v,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(m)},Bt.requestFormReset=function(m){r.d.r(m)},Bt.unstable_batchedUpdates=function(m,h){return m(h)},Bt.useFormState=function(m,h,v){return d.H.useFormState(m,h,v)},Bt.useFormStatus=function(){return d.H.useHostTransitionStatus()},Bt.version="19.2.4",Bt}var ub;function QS(){if(ub)return Zm.exports;ub=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Zm.exports=JC(),Zm.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 db;function e_(){if(db)return wl;db=1;var e=WC(),t=pc(),s=QS();function r(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)a+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function l(n){var a=n,o=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(o=a.return),n=a.return;while(n)}return a.tag===3?o:null}function d(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function f(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function m(n){if(l(n)!==n)throw Error(r(188))}function h(n){var a=n.alternate;if(!a){if(a=l(n),a===null)throw Error(r(188));return a!==n?null:n}for(var o=n,c=a;;){var p=o.return;if(p===null)break;var x=p.alternate;if(x===null){if(c=p.return,c!==null){o=c;continue}break}if(p.child===x.child){for(x=p.child;x;){if(x===o)return m(p),n;if(x===c)return m(p),a;x=x.sibling}throw Error(r(188))}if(o.return!==c.return)o=p,c=x;else{for(var E=!1,k=p.child;k;){if(k===o){E=!0,o=p,c=x;break}if(k===c){E=!0,c=p,o=x;break}k=k.sibling}if(!E){for(k=x.child;k;){if(k===o){E=!0,o=x,c=p;break}if(k===c){E=!0,c=x,o=p;break}k=k.sibling}if(!E)throw Error(r(189))}}if(o.alternate!==c)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?n:a}function v(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=v(n),a!==null)return a;n=n.sibling}return null}var g=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),N=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),_=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),H=Symbol.for("react.memo_cache_sentinel"),D=Symbol.iterator;function Y(n){return n===null||typeof n!="object"?null:(n=D&&n[D]||n["@@iterator"],typeof n=="function"?n:null)}var K=Symbol.for("react.client.reference");function U(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===K?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case w:return"Fragment";case C:return"Profiler";case N:return"StrictMode";case O:return"Suspense";case B:return"SuspenseList";case I:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case S:return"Portal";case _:return n.displayName||"Context";case T:return(n._context.displayName||"Context")+".Consumer";case R:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case L:return a=n.displayName||null,a!==null?a:U(n.type)||"Memo";case M:a=n._payload,n=n._init;try{return U(n(a))}catch{}}return null}var q=Array.isArray,A=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z={pending:!1,data:null,method:null,action:null},G=[],V=-1;function P(n){return{current:n}}function Q(n){0>V||(n.current=G[V],G[V]=null,V--)}function ee(n,a){V++,G[V]=n.current,n.current=a}var se=P(null),oe=P(null),ce=P(null),fe=P(null);function ue(n,a){switch(ee(ce,a),ee(oe,n),ee(se,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?Ev(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=Ev(a),n=Cv(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}Q(se),ee(se,n)}function he(){Q(se),Q(oe),Q(ce)}function Ce(n){n.memoizedState!==null&&ee(fe,n);var a=se.current,o=Cv(a,n.type);a!==o&&(ee(oe,n),ee(se,o))}function Se(n){oe.current===n&&(Q(se),Q(oe)),fe.current===n&&(Q(fe),gl._currentValue=z)}var ye,ve;function de(n){if(ye===void 0)try{throw Error()}catch(o){var a=o.stack.trim().match(/\n( *(at )?)/);ye=a&&a[1]||"",ve=-1<o.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+ye+n+ve}var Ae=!1;function Re(n,a){if(!n||Ae)return"";Ae=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(a){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(ae){var ne=ae}Reflect.construct(n,[],le)}else{try{le.call()}catch(ae){ne=ae}n.call(le.prototype)}}else{try{throw Error()}catch(ae){ne=ae}(le=n())&&typeof le.catch=="function"&&le.catch(function(){})}}catch(ae){if(ae&&ne&&typeof ae.stack=="string")return[ae.stack,ne.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=c.DetermineComponentFrameRoot(),E=x[0],k=x[1];if(E&&k){var F=E.split(`
44
- `),te=k.split(`
45
- `);for(p=c=0;c<F.length&&!F[c].includes("DetermineComponentFrameRoot");)c++;for(;p<te.length&&!te[p].includes("DetermineComponentFrameRoot");)p++;if(c===F.length||p===te.length)for(c=F.length-1,p=te.length-1;1<=c&&0<=p&&F[c]!==te[p];)p--;for(;1<=c&&0<=p;c--,p--)if(F[c]!==te[p]){if(c!==1||p!==1)do if(c--,p--,0>p||F[c]!==te[p]){var re=`
46
- `+F[c].replace(" at new "," at ");return n.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",n.displayName)),re}while(1<=c&&0<=p);break}}}finally{Ae=!1,Error.prepareStackTrace=o}return(o=n?n.displayName||n.name:"")?de(o):""}function Be(n,a){switch(n.tag){case 26:case 27:case 5:return de(n.type);case 16:return de("Lazy");case 13:return n.child!==a&&a!==null?de("Suspense Fallback"):de("Suspense");case 19:return de("SuspenseList");case 0:case 15:return Re(n.type,!1);case 11:return Re(n.type.render,!1);case 1:return Re(n.type,!0);case 31:return de("Activity");default:return""}}function St(n){try{var a="",o=null;do a+=Be(n,o),o=n,n=n.return;while(n);return a}catch(c){return`
47
- Error generating stack: `+c.message+`
48
- `+c.stack}}var dt=Object.prototype.hasOwnProperty,fn=e.unstable_scheduleCallback,jn=e.unstable_cancelCallback,ps=e.unstable_shouldYield,Fn=e.unstable_requestPaint,Me=e.unstable_now,ft=e.unstable_getCurrentPriorityLevel,kt=e.unstable_ImmediatePriority,Xn=e.unstable_UserBlockingPriority,nr=e.unstable_NormalPriority,Rf=e.unstable_LowPriority,ri=e.unstable_IdlePriority,Tf=e.log,Af=e.unstable_setDisableYieldValue,sr=null,$t=null;function Zn(n){if(typeof Tf=="function"&&Af(n),$t&&typeof $t.setStrictMode=="function")try{$t.setStrictMode(sr,n)}catch{}}var qt=Math.clz32?Math.clz32:Of,Mf=Math.log,kf=Math.LN2;function Of(n){return n>>>=0,n===0?32:31-(Mf(n)/kf|0)|0}var ii=256,oi=262144,li=4194304;function gs(n){var a=n&42;if(a!==0)return a;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function ci(n,a,o){var c=n.pendingLanes;if(c===0)return 0;var p=0,x=n.suspendedLanes,E=n.pingedLanes;n=n.warmLanes;var k=c&134217727;return k!==0?(c=k&~x,c!==0?p=gs(c):(E&=k,E!==0?p=gs(E):o||(o=k&~n,o!==0&&(p=gs(o))))):(k=c&~x,k!==0?p=gs(k):E!==0?p=gs(E):o||(o=c&~n,o!==0&&(p=gs(o)))),p===0?0:a!==0&&a!==p&&(a&x)===0&&(x=p&-p,o=a&-a,x>=o||x===32&&(o&4194048)!==0)?a:p}function ar(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function Df(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 jc(){var n=li;return li<<=1,(li&62914560)===0&&(li=4194304),n}function _o(n){for(var a=[],o=0;31>o;o++)a.push(n);return a}function rr(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Lf(n,a,o,c,p,x){var E=n.pendingLanes;n.pendingLanes=o,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=o,n.entangledLanes&=o,n.errorRecoveryDisabledLanes&=o,n.shellSuspendCounter=0;var k=n.entanglements,F=n.expirationTimes,te=n.hiddenUpdates;for(o=E&~o;0<o;){var re=31-qt(o),le=1<<re;k[re]=0,F[re]=-1;var ne=te[re];if(ne!==null)for(te[re]=null,re=0;re<ne.length;re++){var ae=ne[re];ae!==null&&(ae.lane&=-536870913)}o&=~le}c!==0&&Ec(n,c,0),x!==0&&p===0&&n.tag!==0&&(n.suspendedLanes|=x&~(E&~a))}function Ec(n,a,o){n.pendingLanes|=a,n.suspendedLanes&=~a;var c=31-qt(a);n.entangledLanes|=a,n.entanglements[c]=n.entanglements[c]|1073741824|o&261930}function Cc(n,a){var o=n.entangledLanes|=a;for(n=n.entanglements;o;){var c=31-qt(o),p=1<<c;p&a|n[c]&a&&(n[c]|=a),o&=~p}}function _c(n,a){var o=a&-a;return o=(o&42)!==0?1:Ro(o),(o&(n.suspendedLanes|a))!==0?0:o}function Ro(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function To(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Rc(){var n=$.p;return n!==0?n:(n=window.event,n===void 0?32:Fv(n.type))}function Tc(n,a){var o=$.p;try{return $.p=n,a()}finally{$.p=o}}var Wn=Math.random().toString(36).slice(2),wt="__reactFiber$"+Wn,It="__reactProps$"+Wn,xs="__reactContainer$"+Wn,ui="__reactEvents$"+Wn,Ac="__reactListeners$"+Wn,zf="__reactHandles$"+Wn,Mc="__reactResources$"+Wn,ir="__reactMarker$"+Wn;function Ao(n){delete n[wt],delete n[It],delete n[ui],delete n[Ac],delete n[zf]}function Ws(n){var a=n[wt];if(a)return a;for(var o=n.parentNode;o;){if(a=o[xs]||o[wt]){if(o=a.alternate,a.child!==null||o!==null&&o.child!==null)for(n=Ov(n);n!==null;){if(o=n[wt])return o;n=Ov(n)}return a}n=o,o=n.parentNode}return null}function Js(n){if(n=n[wt]||n[xs]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function ea(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(r(33))}function ta(n){var a=n[Mc];return a||(a=n[Mc]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function pt(n){n[ir]=!0}var kc=new Set,Oc={};function ys(n,a){na(n,a),na(n+"Capture",a)}function na(n,a){for(Oc[n]=a,n=0;n<a.length;n++)kc.add(a[n])}var Pf=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]*$"),Mo={},Dc={};function If(n){return dt.call(Dc,n)?!0:dt.call(Mo,n)?!1:Pf.test(n)?Dc[n]=!0:(Mo[n]=!0,!1)}function di(n,a,o){if(If(a))if(o===null)n.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var c=a.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+o)}}function fi(n,a,o){if(o===null)n.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+o)}}function zn(n,a,o,c){if(c===null)n.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(o);return}n.setAttributeNS(a,o,""+c)}}function Zt(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Lc(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function Bf(n,a,o){var c=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var p=c.get,x=c.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return p.call(this)},set:function(E){o=""+E,x.call(this,E)}}),Object.defineProperty(n,a,{enumerable:c.enumerable}),{getValue:function(){return o},setValue:function(E){o=""+E},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function sa(n){if(!n._valueTracker){var a=Lc(n)?"checked":"value";n._valueTracker=Bf(n,a,""+n[a])}}function zc(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var o=a.getValue(),c="";return n&&(c=Lc(n)?n.checked?"true":"false":n.value),n=c,n!==o?(a.setValue(n),!0):!1}function or(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var Hf=/[\n"\\]/g;function Wt(n){return n.replace(Hf,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function lr(n,a,o,c,p,x,E,k){n.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?n.type=E:n.removeAttribute("type"),a!=null?E==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+Zt(a)):n.value!==""+Zt(a)&&(n.value=""+Zt(a)):E!=="submit"&&E!=="reset"||n.removeAttribute("value"),a!=null?ko(n,E,Zt(a)):o!=null?ko(n,E,Zt(o)):c!=null&&n.removeAttribute("value"),p==null&&x!=null&&(n.defaultChecked=!!x),p!=null&&(n.checked=p&&typeof p!="function"&&typeof p!="symbol"),k!=null&&typeof k!="function"&&typeof k!="symbol"&&typeof k!="boolean"?n.name=""+Zt(k):n.removeAttribute("name")}function Pc(n,a,o,c,p,x,E,k){if(x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(n.type=x),a!=null||o!=null){if(!(x!=="submit"&&x!=="reset"||a!=null)){sa(n);return}o=o!=null?""+Zt(o):"",a=a!=null?""+Zt(a):o,k||a===n.value||(n.value=a),n.defaultValue=a}c=c??p,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=k?n.checked:!!c,n.defaultChecked=!!c,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(n.name=E),sa(n)}function ko(n,a,o){a==="number"&&or(n.ownerDocument)===n||n.defaultValue===""+o||(n.defaultValue=""+o)}function vs(n,a,o,c){if(n=n.options,a){a={};for(var p=0;p<o.length;p++)a["$"+o[p]]=!0;for(o=0;o<n.length;o++)p=a.hasOwnProperty("$"+n[o].value),n[o].selected!==p&&(n[o].selected=p),p&&c&&(n[o].defaultSelected=!0)}else{for(o=""+Zt(o),a=null,p=0;p<n.length;p++){if(n[p].value===o){n[p].selected=!0,c&&(n[p].defaultSelected=!0);return}a!==null||n[p].disabled||(a=n[p])}a!==null&&(a.selected=!0)}}function b0(n,a,o){if(a!=null&&(a=""+Zt(a),a!==n.value&&(n.value=a),o==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=o!=null?""+Zt(o):""}function S0(n,a,o,c){if(a==null){if(c!=null){if(o!=null)throw Error(r(92));if(q(c)){if(1<c.length)throw Error(r(93));c=c[0]}o=c}o==null&&(o=""),a=o}o=Zt(a),n.defaultValue=o,c=n.textContent,c===o&&c!==""&&c!==null&&(n.value=c),sa(n)}function hi(n,a){if(a){var o=n.firstChild;if(o&&o===n.lastChild&&o.nodeType===3){o.nodeValue=a;return}}n.textContent=a}var HE=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 w0(n,a,o){var c=a.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?c?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":c?n.setProperty(a,o):typeof o!="number"||o===0||HE.has(a)?a==="float"?n.cssFloat=o:n[a]=(""+o).trim():n[a]=o+"px"}function N0(n,a,o){if(a!=null&&typeof a!="object")throw Error(r(62));if(n=n.style,o!=null){for(var c in o)!o.hasOwnProperty(c)||a!=null&&a.hasOwnProperty(c)||(c.indexOf("--")===0?n.setProperty(c,""):c==="float"?n.cssFloat="":n[c]="");for(var p in a)c=a[p],a.hasOwnProperty(p)&&o[p]!==c&&w0(n,p,c)}else for(var x in a)a.hasOwnProperty(x)&&w0(n,x,a[x])}function Uf(n){if(n.indexOf("-")===-1)return!1;switch(n){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 UE=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"]]),$E=/^[\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 Ic(n){return $E.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function bs(){}var $f=null;function qf(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var mi=null,pi=null;function j0(n){var a=Js(n);if(a&&(n=a.stateNode)){var o=n[It]||null;e:switch(n=a.stateNode,a.type){case"input":if(lr(n,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),a=o.name,o.type==="radio"&&a!=null){for(o=n;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+Wt(""+a)+'"][type="radio"]'),a=0;a<o.length;a++){var c=o[a];if(c!==n&&c.form===n.form){var p=c[It]||null;if(!p)throw Error(r(90));lr(c,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(a=0;a<o.length;a++)c=o[a],c.form===n.form&&zc(c)}break e;case"textarea":b0(n,o.value,o.defaultValue);break e;case"select":a=o.value,a!=null&&vs(n,!!o.multiple,a,!1)}}}var Vf=!1;function E0(n,a,o){if(Vf)return n(a,o);Vf=!0;try{var c=n(a);return c}finally{if(Vf=!1,(mi!==null||pi!==null)&&(Eu(),mi&&(a=mi,n=pi,pi=mi=null,j0(a),n)))for(a=0;a<n.length;a++)j0(n[a])}}function Oo(n,a){var o=n.stateNode;if(o===null)return null;var c=o[It]||null;if(c===null)return null;o=c[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(n=n.type,c=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!c;break e;default:n=!1}if(n)return null;if(o&&typeof o!="function")throw Error(r(231,a,typeof o));return o}var Ss=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Gf=!1;if(Ss)try{var Do={};Object.defineProperty(Do,"passive",{get:function(){Gf=!0}}),window.addEventListener("test",Do,Do),window.removeEventListener("test",Do,Do)}catch{Gf=!1}var aa=null,Yf=null,Bc=null;function C0(){if(Bc)return Bc;var n,a=Yf,o=a.length,c,p="value"in aa?aa.value:aa.textContent,x=p.length;for(n=0;n<o&&a[n]===p[n];n++);var E=o-n;for(c=1;c<=E&&a[o-c]===p[x-c];c++);return Bc=p.slice(n,1<c?1-c:void 0)}function Hc(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function Uc(){return!0}function _0(){return!1}function Jt(n){function a(o,c,p,x,E){this._reactName=o,this._targetInst=p,this.type=c,this.nativeEvent=x,this.target=E,this.currentTarget=null;for(var k in n)n.hasOwnProperty(k)&&(o=n[k],this[k]=o?o(x):x[k]);return this.isDefaultPrevented=(x.defaultPrevented!=null?x.defaultPrevented:x.returnValue===!1)?Uc:_0,this.isPropagationStopped=_0,this}return g(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Uc)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Uc)},persist:function(){},isPersistent:Uc}),a}var cr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$c=Jt(cr),Lo=g({},cr,{view:0,detail:0}),qE=Jt(Lo),Qf,Kf,zo,qc=g({},Lo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xf,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==zo&&(zo&&n.type==="mousemove"?(Qf=n.screenX-zo.screenX,Kf=n.screenY-zo.screenY):Kf=Qf=0,zo=n),Qf)},movementY:function(n){return"movementY"in n?n.movementY:Kf}}),R0=Jt(qc),VE=g({},qc,{dataTransfer:0}),GE=Jt(VE),YE=g({},Lo,{relatedTarget:0}),Ff=Jt(YE),QE=g({},cr,{animationName:0,elapsedTime:0,pseudoElement:0}),KE=Jt(QE),FE=g({},cr,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),XE=Jt(FE),ZE=g({},cr,{data:0}),T0=Jt(ZE),WE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},JE={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"},e2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function t2(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=e2[n])?!!a[n]:!1}function Xf(){return t2}var n2=g({},Lo,{key:function(n){if(n.key){var a=WE[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=Hc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?JE[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xf,charCode:function(n){return n.type==="keypress"?Hc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?Hc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),s2=Jt(n2),a2=g({},qc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),A0=Jt(a2),r2=g({},Lo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xf}),i2=Jt(r2),o2=g({},cr,{propertyName:0,elapsedTime:0,pseudoElement:0}),l2=Jt(o2),c2=g({},qc,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),u2=Jt(c2),d2=g({},cr,{newState:0,oldState:0}),f2=Jt(d2),h2=[9,13,27,32],Zf=Ss&&"CompositionEvent"in window,Po=null;Ss&&"documentMode"in document&&(Po=document.documentMode);var m2=Ss&&"TextEvent"in window&&!Po,M0=Ss&&(!Zf||Po&&8<Po&&11>=Po),k0=" ",O0=!1;function D0(n,a){switch(n){case"keyup":return h2.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function L0(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var gi=!1;function p2(n,a){switch(n){case"compositionend":return L0(a);case"keypress":return a.which!==32?null:(O0=!0,k0);case"textInput":return n=a.data,n===k0&&O0?null:n;default:return null}}function g2(n,a){if(gi)return n==="compositionend"||!Zf&&D0(n,a)?(n=C0(),Bc=Yf=aa=null,gi=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return M0&&a.locale!=="ko"?null:a.data;default:return null}}var x2={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 z0(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!x2[n.type]:a==="textarea"}function P0(n,a,o,c){mi?pi?pi.push(c):pi=[c]:mi=c,a=ku(a,"onChange"),0<a.length&&(o=new $c("onChange","change",null,o,c),n.push({event:o,listeners:a}))}var Io=null,Bo=null;function y2(n){vv(n,0)}function Vc(n){var a=ea(n);if(zc(a))return n}function I0(n,a){if(n==="change")return a}var B0=!1;if(Ss){var Wf;if(Ss){var Jf="oninput"in document;if(!Jf){var H0=document.createElement("div");H0.setAttribute("oninput","return;"),Jf=typeof H0.oninput=="function"}Wf=Jf}else Wf=!1;B0=Wf&&(!document.documentMode||9<document.documentMode)}function U0(){Io&&(Io.detachEvent("onpropertychange",$0),Bo=Io=null)}function $0(n){if(n.propertyName==="value"&&Vc(Bo)){var a=[];P0(a,Bo,n,qf(n)),E0(y2,a)}}function v2(n,a,o){n==="focusin"?(U0(),Io=a,Bo=o,Io.attachEvent("onpropertychange",$0)):n==="focusout"&&U0()}function b2(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Vc(Bo)}function S2(n,a){if(n==="click")return Vc(a)}function w2(n,a){if(n==="input"||n==="change")return Vc(a)}function N2(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var hn=typeof Object.is=="function"?Object.is:N2;function Ho(n,a){if(hn(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var o=Object.keys(n),c=Object.keys(a);if(o.length!==c.length)return!1;for(c=0;c<o.length;c++){var p=o[c];if(!dt.call(a,p)||!hn(n[p],a[p]))return!1}return!0}function q0(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function V0(n,a){var o=q0(n);n=0;for(var c;o;){if(o.nodeType===3){if(c=n+o.textContent.length,n<=a&&c>=a)return{node:o,offset:a-n};n=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=q0(o)}}function G0(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?G0(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function Y0(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=or(n.document);a instanceof n.HTMLIFrameElement;){try{var o=typeof a.contentWindow.location.href=="string"}catch{o=!1}if(o)n=a.contentWindow;else break;a=or(n.document)}return a}function eh(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var j2=Ss&&"documentMode"in document&&11>=document.documentMode,xi=null,th=null,Uo=null,nh=!1;function Q0(n,a,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;nh||xi==null||xi!==or(c)||(c=xi,"selectionStart"in c&&eh(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Uo&&Ho(Uo,c)||(Uo=c,c=ku(th,"onSelect"),0<c.length&&(a=new $c("onSelect","select",null,a,o),n.push({event:a,listeners:c}),a.target=xi)))}function ur(n,a){var o={};return o[n.toLowerCase()]=a.toLowerCase(),o["Webkit"+n]="webkit"+a,o["Moz"+n]="moz"+a,o}var yi={animationend:ur("Animation","AnimationEnd"),animationiteration:ur("Animation","AnimationIteration"),animationstart:ur("Animation","AnimationStart"),transitionrun:ur("Transition","TransitionRun"),transitionstart:ur("Transition","TransitionStart"),transitioncancel:ur("Transition","TransitionCancel"),transitionend:ur("Transition","TransitionEnd")},sh={},K0={};Ss&&(K0=document.createElement("div").style,"AnimationEvent"in window||(delete yi.animationend.animation,delete yi.animationiteration.animation,delete yi.animationstart.animation),"TransitionEvent"in window||delete yi.transitionend.transition);function dr(n){if(sh[n])return sh[n];if(!yi[n])return n;var a=yi[n],o;for(o in a)if(a.hasOwnProperty(o)&&o in K0)return sh[n]=a[o];return n}var F0=dr("animationend"),X0=dr("animationiteration"),Z0=dr("animationstart"),E2=dr("transitionrun"),C2=dr("transitionstart"),_2=dr("transitioncancel"),W0=dr("transitionend"),J0=new Map,ah="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(" ");ah.push("scrollEnd");function Pn(n,a){J0.set(n,a),ys(a,[n])}var Gc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},En=[],vi=0,rh=0;function Yc(){for(var n=vi,a=rh=vi=0;a<n;){var o=En[a];En[a++]=null;var c=En[a];En[a++]=null;var p=En[a];En[a++]=null;var x=En[a];if(En[a++]=null,c!==null&&p!==null){var E=c.pending;E===null?p.next=p:(p.next=E.next,E.next=p),c.pending=p}x!==0&&ex(o,p,x)}}function Qc(n,a,o,c){En[vi++]=n,En[vi++]=a,En[vi++]=o,En[vi++]=c,rh|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function ih(n,a,o,c){return Qc(n,a,o,c),Kc(n)}function fr(n,a){return Qc(n,null,null,a),Kc(n)}function ex(n,a,o){n.lanes|=o;var c=n.alternate;c!==null&&(c.lanes|=o);for(var p=!1,x=n.return;x!==null;)x.childLanes|=o,c=x.alternate,c!==null&&(c.childLanes|=o),x.tag===22&&(n=x.stateNode,n===null||n._visibility&1||(p=!0)),n=x,x=x.return;return n.tag===3?(x=n.stateNode,p&&a!==null&&(p=31-qt(o),n=x.hiddenUpdates,c=n[p],c===null?n[p]=[a]:c.push(a),a.lane=o|536870912),x):null}function Kc(n){if(50<cl)throw cl=0,pm=null,Error(r(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var bi={};function R2(n,a,o,c){this.tag=n,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mn(n,a,o,c){return new R2(n,a,o,c)}function oh(n){return n=n.prototype,!(!n||!n.isReactComponent)}function ws(n,a){var o=n.alternate;return o===null?(o=mn(n.tag,a,n.key,n.mode),o.elementType=n.elementType,o.type=n.type,o.stateNode=n.stateNode,o.alternate=n,n.alternate=o):(o.pendingProps=a,o.type=n.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=n.flags&65011712,o.childLanes=n.childLanes,o.lanes=n.lanes,o.child=n.child,o.memoizedProps=n.memoizedProps,o.memoizedState=n.memoizedState,o.updateQueue=n.updateQueue,a=n.dependencies,o.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},o.sibling=n.sibling,o.index=n.index,o.ref=n.ref,o.refCleanup=n.refCleanup,o}function tx(n,a){n.flags&=65011714;var o=n.alternate;return o===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=o.childLanes,n.lanes=o.lanes,n.child=o.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=o.memoizedProps,n.memoizedState=o.memoizedState,n.updateQueue=o.updateQueue,n.type=o.type,a=o.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function Fc(n,a,o,c,p,x){var E=0;if(c=n,typeof n=="function")oh(n)&&(E=1);else if(typeof n=="string")E=OC(n,o,se.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case I:return n=mn(31,o,a,p),n.elementType=I,n.lanes=x,n;case w:return hr(o.children,p,x,a);case N:E=8,p|=24;break;case C:return n=mn(12,o,a,p|2),n.elementType=C,n.lanes=x,n;case O:return n=mn(13,o,a,p),n.elementType=O,n.lanes=x,n;case B:return n=mn(19,o,a,p),n.elementType=B,n.lanes=x,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case _:E=10;break e;case T:E=9;break e;case R:E=11;break e;case L:E=14;break e;case M:E=16,c=null;break e}E=29,o=Error(r(130,n===null?"null":typeof n,"")),c=null}return a=mn(E,o,a,p),a.elementType=n,a.type=c,a.lanes=x,a}function hr(n,a,o,c){return n=mn(7,n,c,a),n.lanes=o,n}function lh(n,a,o){return n=mn(6,n,null,a),n.lanes=o,n}function nx(n){var a=mn(18,null,null,0);return a.stateNode=n,a}function ch(n,a,o){return a=mn(4,n.children!==null?n.children:[],n.key,a),a.lanes=o,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var sx=new WeakMap;function Cn(n,a){if(typeof n=="object"&&n!==null){var o=sx.get(n);return o!==void 0?o:(a={value:n,source:a,stack:St(a)},sx.set(n,a),a)}return{value:n,source:a,stack:St(a)}}var Si=[],wi=0,Xc=null,$o=0,_n=[],Rn=0,ra=null,Jn=1,es="";function Ns(n,a){Si[wi++]=$o,Si[wi++]=Xc,Xc=n,$o=a}function ax(n,a,o){_n[Rn++]=Jn,_n[Rn++]=es,_n[Rn++]=ra,ra=n;var c=Jn;n=es;var p=32-qt(c)-1;c&=~(1<<p),o+=1;var x=32-qt(a)+p;if(30<x){var E=p-p%5;x=(c&(1<<E)-1).toString(32),c>>=E,p-=E,Jn=1<<32-qt(a)+p|o<<p|c,es=x+n}else Jn=1<<x|o<<p|c,es=n}function uh(n){n.return!==null&&(Ns(n,1),ax(n,1,0))}function dh(n){for(;n===Xc;)Xc=Si[--wi],Si[wi]=null,$o=Si[--wi],Si[wi]=null;for(;n===ra;)ra=_n[--Rn],_n[Rn]=null,es=_n[--Rn],_n[Rn]=null,Jn=_n[--Rn],_n[Rn]=null}function rx(n,a){_n[Rn++]=Jn,_n[Rn++]=es,_n[Rn++]=ra,Jn=a.id,es=a.overflow,ra=n}var Ot=null,tt=null,$e=!1,ia=null,Tn=!1,fh=Error(r(519));function oa(n){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw qo(Cn(a,n)),fh}function ix(n){var a=n.stateNode,o=n.type,c=n.memoizedProps;switch(a[wt]=n,a[It]=c,o){case"dialog":Ie("cancel",a),Ie("close",a);break;case"iframe":case"object":case"embed":Ie("load",a);break;case"video":case"audio":for(o=0;o<dl.length;o++)Ie(dl[o],a);break;case"source":Ie("error",a);break;case"img":case"image":case"link":Ie("error",a),Ie("load",a);break;case"details":Ie("toggle",a);break;case"input":Ie("invalid",a),Pc(a,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Ie("invalid",a);break;case"textarea":Ie("invalid",a),S0(a,c.value,c.defaultValue,c.children)}o=c.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||a.textContent===""+o||c.suppressHydrationWarning===!0||Nv(a.textContent,o)?(c.popover!=null&&(Ie("beforetoggle",a),Ie("toggle",a)),c.onScroll!=null&&Ie("scroll",a),c.onScrollEnd!=null&&Ie("scrollend",a),c.onClick!=null&&(a.onclick=bs),a=!0):a=!1,a||oa(n,!0)}function ox(n){for(Ot=n.return;Ot;)switch(Ot.tag){case 5:case 31:case 13:Tn=!1;return;case 27:case 3:Tn=!0;return;default:Ot=Ot.return}}function Ni(n){if(n!==Ot)return!1;if(!$e)return ox(n),$e=!0,!1;var a=n.tag,o;if((o=a!==3&&a!==27)&&((o=a===5)&&(o=n.type,o=!(o!=="form"&&o!=="button")||Am(n.type,n.memoizedProps)),o=!o),o&&tt&&oa(n),ox(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));tt=kv(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));tt=kv(n)}else a===27?(a=tt,Sa(n.type)?(n=Lm,Lm=null,tt=n):tt=a):tt=Ot?Mn(n.stateNode.nextSibling):null;return!0}function mr(){tt=Ot=null,$e=!1}function hh(){var n=ia;return n!==null&&(sn===null?sn=n:sn.push.apply(sn,n),ia=null),n}function qo(n){ia===null?ia=[n]:ia.push(n)}var mh=P(null),pr=null,js=null;function la(n,a,o){ee(mh,a._currentValue),a._currentValue=o}function Es(n){n._currentValue=mh.current,Q(mh)}function ph(n,a,o){for(;n!==null;){var c=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,c!==null&&(c.childLanes|=a)):c!==null&&(c.childLanes&a)!==a&&(c.childLanes|=a),n===o)break;n=n.return}}function gh(n,a,o,c){var p=n.child;for(p!==null&&(p.return=n);p!==null;){var x=p.dependencies;if(x!==null){var E=p.child;x=x.firstContext;e:for(;x!==null;){var k=x;x=p;for(var F=0;F<a.length;F++)if(k.context===a[F]){x.lanes|=o,k=x.alternate,k!==null&&(k.lanes|=o),ph(x.return,o,n),c||(E=null);break e}x=k.next}}else if(p.tag===18){if(E=p.return,E===null)throw Error(r(341));E.lanes|=o,x=E.alternate,x!==null&&(x.lanes|=o),ph(E,o,n),E=null}else E=p.child;if(E!==null)E.return=p;else for(E=p;E!==null;){if(E===n){E=null;break}if(p=E.sibling,p!==null){p.return=E.return,E=p;break}E=E.return}p=E}}function ji(n,a,o,c){n=null;for(var p=a,x=!1;p!==null;){if(!x){if((p.flags&524288)!==0)x=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var E=p.alternate;if(E===null)throw Error(r(387));if(E=E.memoizedProps,E!==null){var k=p.type;hn(p.pendingProps.value,E.value)||(n!==null?n.push(k):n=[k])}}else if(p===fe.current){if(E=p.alternate,E===null)throw Error(r(387));E.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(n!==null?n.push(gl):n=[gl])}p=p.return}n!==null&&gh(a,n,o,c),a.flags|=262144}function Zc(n){for(n=n.firstContext;n!==null;){if(!hn(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function gr(n){pr=n,js=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Dt(n){return lx(pr,n)}function Wc(n,a){return pr===null&&gr(n),lx(n,a)}function lx(n,a){var o=a._currentValue;if(a={context:a,memoizedValue:o,next:null},js===null){if(n===null)throw Error(r(308));js=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else js=js.next=a;return o}var T2=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(o,c){n.push(c)}};this.abort=function(){a.aborted=!0,n.forEach(function(o){return o()})}},A2=e.unstable_scheduleCallback,M2=e.unstable_NormalPriority,gt={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function xh(){return{controller:new T2,data:new Map,refCount:0}}function Vo(n){n.refCount--,n.refCount===0&&A2(M2,function(){n.controller.abort()})}var Go=null,yh=0,Ei=0,Ci=null;function k2(n,a){if(Go===null){var o=Go=[];yh=0,Ei=Sm(),Ci={status:"pending",value:void 0,then:function(c){o.push(c)}}}return yh++,a.then(cx,cx),a}function cx(){if(--yh===0&&Go!==null){Ci!==null&&(Ci.status="fulfilled");var n=Go;Go=null,Ei=0,Ci=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function O2(n,a){var o=[],c={status:"pending",value:null,reason:null,then:function(p){o.push(p)}};return n.then(function(){c.status="fulfilled",c.value=a;for(var p=0;p<o.length;p++)(0,o[p])(a)},function(p){for(c.status="rejected",c.reason=p,p=0;p<o.length;p++)(0,o[p])(void 0)}),c}var ux=A.S;A.S=function(n,a){Qy=Me(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&k2(n,a),ux!==null&&ux(n,a)};var xr=P(null);function vh(){var n=xr.current;return n!==null?n:et.pooledCache}function Jc(n,a){a===null?ee(xr,xr.current):ee(xr,a.pool)}function dx(){var n=vh();return n===null?null:{parent:gt._currentValue,pool:n}}var _i=Error(r(460)),bh=Error(r(474)),eu=Error(r(542)),tu={then:function(){}};function fx(n){return n=n.status,n==="fulfilled"||n==="rejected"}function hx(n,a,o){switch(o=n[o],o===void 0?n.push(a):o!==a&&(a.then(bs,bs),a=o),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,px(n),n;default:if(typeof a.status=="string")a.then(bs,bs);else{if(n=et,n!==null&&100<n.shellSuspendCounter)throw Error(r(482));n=a,n.status="pending",n.then(function(c){if(a.status==="pending"){var p=a;p.status="fulfilled",p.value=c}},function(c){if(a.status==="pending"){var p=a;p.status="rejected",p.reason=c}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,px(n),n}throw vr=a,_i}}function yr(n){try{var a=n._init;return a(n._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(vr=o,_i):o}}var vr=null;function mx(){if(vr===null)throw Error(r(459));var n=vr;return vr=null,n}function px(n){if(n===_i||n===eu)throw Error(r(483))}var Ri=null,Yo=0;function nu(n){var a=Yo;return Yo+=1,Ri===null&&(Ri=[]),hx(Ri,n,a)}function Qo(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function su(n,a){throw a.$$typeof===y?Error(r(525)):(n=Object.prototype.toString.call(a),Error(r(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function gx(n){function a(W,Z){if(n){var J=W.deletions;J===null?(W.deletions=[Z],W.flags|=16):J.push(Z)}}function o(W,Z){if(!n)return null;for(;Z!==null;)a(W,Z),Z=Z.sibling;return null}function c(W){for(var Z=new Map;W!==null;)W.key!==null?Z.set(W.key,W):Z.set(W.index,W),W=W.sibling;return Z}function p(W,Z){return W=ws(W,Z),W.index=0,W.sibling=null,W}function x(W,Z,J){return W.index=J,n?(J=W.alternate,J!==null?(J=J.index,J<Z?(W.flags|=67108866,Z):J):(W.flags|=67108866,Z)):(W.flags|=1048576,Z)}function E(W){return n&&W.alternate===null&&(W.flags|=67108866),W}function k(W,Z,J,ie){return Z===null||Z.tag!==6?(Z=lh(J,W.mode,ie),Z.return=W,Z):(Z=p(Z,J),Z.return=W,Z)}function F(W,Z,J,ie){var Ee=J.type;return Ee===w?re(W,Z,J.props.children,ie,J.key):Z!==null&&(Z.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===M&&yr(Ee)===Z.type)?(Z=p(Z,J.props),Qo(Z,J),Z.return=W,Z):(Z=Fc(J.type,J.key,J.props,null,W.mode,ie),Qo(Z,J),Z.return=W,Z)}function te(W,Z,J,ie){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==J.containerInfo||Z.stateNode.implementation!==J.implementation?(Z=ch(J,W.mode,ie),Z.return=W,Z):(Z=p(Z,J.children||[]),Z.return=W,Z)}function re(W,Z,J,ie,Ee){return Z===null||Z.tag!==7?(Z=hr(J,W.mode,ie,Ee),Z.return=W,Z):(Z=p(Z,J),Z.return=W,Z)}function le(W,Z,J){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Z=lh(""+Z,W.mode,J),Z.return=W,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case b:return J=Fc(Z.type,Z.key,Z.props,null,W.mode,J),Qo(J,Z),J.return=W,J;case S:return Z=ch(Z,W.mode,J),Z.return=W,Z;case M:return Z=yr(Z),le(W,Z,J)}if(q(Z)||Y(Z))return Z=hr(Z,W.mode,J,null),Z.return=W,Z;if(typeof Z.then=="function")return le(W,nu(Z),J);if(Z.$$typeof===_)return le(W,Wc(W,Z),J);su(W,Z)}return null}function ne(W,Z,J,ie){var Ee=Z!==null?Z.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Ee!==null?null:k(W,Z,""+J,ie);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return J.key===Ee?F(W,Z,J,ie):null;case S:return J.key===Ee?te(W,Z,J,ie):null;case M:return J=yr(J),ne(W,Z,J,ie)}if(q(J)||Y(J))return Ee!==null?null:re(W,Z,J,ie,null);if(typeof J.then=="function")return ne(W,Z,nu(J),ie);if(J.$$typeof===_)return ne(W,Z,Wc(W,J),ie);su(W,J)}return null}function ae(W,Z,J,ie,Ee){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return W=W.get(J)||null,k(Z,W,""+ie,Ee);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case b:return W=W.get(ie.key===null?J:ie.key)||null,F(Z,W,ie,Ee);case S:return W=W.get(ie.key===null?J:ie.key)||null,te(Z,W,ie,Ee);case M:return ie=yr(ie),ae(W,Z,J,ie,Ee)}if(q(ie)||Y(ie))return W=W.get(J)||null,re(Z,W,ie,Ee,null);if(typeof ie.then=="function")return ae(W,Z,J,nu(ie),Ee);if(ie.$$typeof===_)return ae(W,Z,J,Wc(Z,ie),Ee);su(Z,ie)}return null}function pe(W,Z,J,ie){for(var Ee=null,Ge=null,be=Z,De=Z=0,Ue=null;be!==null&&De<J.length;De++){be.index>De?(Ue=be,be=null):Ue=be.sibling;var Ye=ne(W,be,J[De],ie);if(Ye===null){be===null&&(be=Ue);break}n&&be&&Ye.alternate===null&&a(W,be),Z=x(Ye,Z,De),Ge===null?Ee=Ye:Ge.sibling=Ye,Ge=Ye,be=Ue}if(De===J.length)return o(W,be),$e&&Ns(W,De),Ee;if(be===null){for(;De<J.length;De++)be=le(W,J[De],ie),be!==null&&(Z=x(be,Z,De),Ge===null?Ee=be:Ge.sibling=be,Ge=be);return $e&&Ns(W,De),Ee}for(be=c(be);De<J.length;De++)Ue=ae(be,W,De,J[De],ie),Ue!==null&&(n&&Ue.alternate!==null&&be.delete(Ue.key===null?De:Ue.key),Z=x(Ue,Z,De),Ge===null?Ee=Ue:Ge.sibling=Ue,Ge=Ue);return n&&be.forEach(function(Ca){return a(W,Ca)}),$e&&Ns(W,De),Ee}function _e(W,Z,J,ie){if(J==null)throw Error(r(151));for(var Ee=null,Ge=null,be=Z,De=Z=0,Ue=null,Ye=J.next();be!==null&&!Ye.done;De++,Ye=J.next()){be.index>De?(Ue=be,be=null):Ue=be.sibling;var Ca=ne(W,be,Ye.value,ie);if(Ca===null){be===null&&(be=Ue);break}n&&be&&Ca.alternate===null&&a(W,be),Z=x(Ca,Z,De),Ge===null?Ee=Ca:Ge.sibling=Ca,Ge=Ca,be=Ue}if(Ye.done)return o(W,be),$e&&Ns(W,De),Ee;if(be===null){for(;!Ye.done;De++,Ye=J.next())Ye=le(W,Ye.value,ie),Ye!==null&&(Z=x(Ye,Z,De),Ge===null?Ee=Ye:Ge.sibling=Ye,Ge=Ye);return $e&&Ns(W,De),Ee}for(be=c(be);!Ye.done;De++,Ye=J.next())Ye=ae(be,W,De,Ye.value,ie),Ye!==null&&(n&&Ye.alternate!==null&&be.delete(Ye.key===null?De:Ye.key),Z=x(Ye,Z,De),Ge===null?Ee=Ye:Ge.sibling=Ye,Ge=Ye);return n&&be.forEach(function(VC){return a(W,VC)}),$e&&Ns(W,De),Ee}function Je(W,Z,J,ie){if(typeof J=="object"&&J!==null&&J.type===w&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case b:e:{for(var Ee=J.key;Z!==null;){if(Z.key===Ee){if(Ee=J.type,Ee===w){if(Z.tag===7){o(W,Z.sibling),ie=p(Z,J.props.children),ie.return=W,W=ie;break e}}else if(Z.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===M&&yr(Ee)===Z.type){o(W,Z.sibling),ie=p(Z,J.props),Qo(ie,J),ie.return=W,W=ie;break e}o(W,Z);break}else a(W,Z);Z=Z.sibling}J.type===w?(ie=hr(J.props.children,W.mode,ie,J.key),ie.return=W,W=ie):(ie=Fc(J.type,J.key,J.props,null,W.mode,ie),Qo(ie,J),ie.return=W,W=ie)}return E(W);case S:e:{for(Ee=J.key;Z!==null;){if(Z.key===Ee)if(Z.tag===4&&Z.stateNode.containerInfo===J.containerInfo&&Z.stateNode.implementation===J.implementation){o(W,Z.sibling),ie=p(Z,J.children||[]),ie.return=W,W=ie;break e}else{o(W,Z);break}else a(W,Z);Z=Z.sibling}ie=ch(J,W.mode,ie),ie.return=W,W=ie}return E(W);case M:return J=yr(J),Je(W,Z,J,ie)}if(q(J))return pe(W,Z,J,ie);if(Y(J)){if(Ee=Y(J),typeof Ee!="function")throw Error(r(150));return J=Ee.call(J),_e(W,Z,J,ie)}if(typeof J.then=="function")return Je(W,Z,nu(J),ie);if(J.$$typeof===_)return Je(W,Z,Wc(W,J),ie);su(W,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,Z!==null&&Z.tag===6?(o(W,Z.sibling),ie=p(Z,J),ie.return=W,W=ie):(o(W,Z),ie=lh(J,W.mode,ie),ie.return=W,W=ie),E(W)):o(W,Z)}return function(W,Z,J,ie){try{Yo=0;var Ee=Je(W,Z,J,ie);return Ri=null,Ee}catch(be){if(be===_i||be===eu)throw be;var Ge=mn(29,be,null,W.mode);return Ge.lanes=ie,Ge.return=W,Ge}finally{}}}var br=gx(!0),xx=gx(!1),ca=!1;function Sh(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wh(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function ua(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function da(n,a,o){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(Qe&2)!==0){var p=c.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),c.pending=a,a=Kc(n),ex(n,null,o),a}return Qc(n,c,a,o),Kc(n)}function Ko(n,a,o){if(a=a.updateQueue,a!==null&&(a=a.shared,(o&4194048)!==0)){var c=a.lanes;c&=n.pendingLanes,o|=c,a.lanes=o,Cc(n,o)}}function Nh(n,a){var o=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var p=null,x=null;if(o=o.firstBaseUpdate,o!==null){do{var E={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};x===null?p=x=E:x=x.next=E,o=o.next}while(o!==null);x===null?p=x=a:x=x.next=a}else p=x=a;o={baseState:c.baseState,firstBaseUpdate:p,lastBaseUpdate:x,shared:c.shared,callbacks:c.callbacks},n.updateQueue=o;return}n=o.lastBaseUpdate,n===null?o.firstBaseUpdate=a:n.next=a,o.lastBaseUpdate=a}var jh=!1;function Fo(){if(jh){var n=Ci;if(n!==null)throw n}}function Xo(n,a,o,c){jh=!1;var p=n.updateQueue;ca=!1;var x=p.firstBaseUpdate,E=p.lastBaseUpdate,k=p.shared.pending;if(k!==null){p.shared.pending=null;var F=k,te=F.next;F.next=null,E===null?x=te:E.next=te,E=F;var re=n.alternate;re!==null&&(re=re.updateQueue,k=re.lastBaseUpdate,k!==E&&(k===null?re.firstBaseUpdate=te:k.next=te,re.lastBaseUpdate=F))}if(x!==null){var le=p.baseState;E=0,re=te=F=null,k=x;do{var ne=k.lane&-536870913,ae=ne!==k.lane;if(ae?(He&ne)===ne:(c&ne)===ne){ne!==0&&ne===Ei&&(jh=!0),re!==null&&(re=re.next={lane:0,tag:k.tag,payload:k.payload,callback:null,next:null});e:{var pe=n,_e=k;ne=a;var Je=o;switch(_e.tag){case 1:if(pe=_e.payload,typeof pe=="function"){le=pe.call(Je,le,ne);break e}le=pe;break e;case 3:pe.flags=pe.flags&-65537|128;case 0:if(pe=_e.payload,ne=typeof pe=="function"?pe.call(Je,le,ne):pe,ne==null)break e;le=g({},le,ne);break e;case 2:ca=!0}}ne=k.callback,ne!==null&&(n.flags|=64,ae&&(n.flags|=8192),ae=p.callbacks,ae===null?p.callbacks=[ne]:ae.push(ne))}else ae={lane:ne,tag:k.tag,payload:k.payload,callback:k.callback,next:null},re===null?(te=re=ae,F=le):re=re.next=ae,E|=ne;if(k=k.next,k===null){if(k=p.shared.pending,k===null)break;ae=k,k=ae.next,ae.next=null,p.lastBaseUpdate=ae,p.shared.pending=null}}while(!0);re===null&&(F=le),p.baseState=F,p.firstBaseUpdate=te,p.lastBaseUpdate=re,x===null&&(p.shared.lanes=0),ga|=E,n.lanes=E,n.memoizedState=le}}function yx(n,a){if(typeof n!="function")throw Error(r(191,n));n.call(a)}function vx(n,a){var o=n.callbacks;if(o!==null)for(n.callbacks=null,n=0;n<o.length;n++)yx(o[n],a)}var Ti=P(null),au=P(0);function bx(n,a){n=Ds,ee(au,n),ee(Ti,a),Ds=n|a.baseLanes}function Eh(){ee(au,Ds),ee(Ti,Ti.current)}function Ch(){Ds=au.current,Q(Ti),Q(au)}var pn=P(null),An=null;function fa(n){var a=n.alternate;ee(ht,ht.current&1),ee(pn,n),An===null&&(a===null||Ti.current!==null||a.memoizedState!==null)&&(An=n)}function _h(n){ee(ht,ht.current),ee(pn,n),An===null&&(An=n)}function Sx(n){n.tag===22?(ee(ht,ht.current),ee(pn,n),An===null&&(An=n)):ha()}function ha(){ee(ht,ht.current),ee(pn,pn.current)}function gn(n){Q(pn),An===n&&(An=null),Q(ht)}var ht=P(0);function ru(n){for(var a=n;a!==null;){if(a.tag===13){var o=a.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||Om(o)||Dm(o)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Cs=0,Oe=null,Ze=null,xt=null,iu=!1,Ai=!1,Sr=!1,ou=0,Zo=0,Mi=null,D2=0;function lt(){throw Error(r(321))}function Rh(n,a){if(a===null)return!1;for(var o=0;o<a.length&&o<n.length;o++)if(!hn(n[o],a[o]))return!1;return!0}function Th(n,a,o,c,p,x){return Cs=x,Oe=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,A.H=n===null||n.memoizedState===null?ay:Vh,Sr=!1,x=o(c,p),Sr=!1,Ai&&(x=Nx(a,o,c,p)),wx(n),x}function wx(n){A.H=el;var a=Ze!==null&&Ze.next!==null;if(Cs=0,xt=Ze=Oe=null,iu=!1,Zo=0,Mi=null,a)throw Error(r(300));n===null||yt||(n=n.dependencies,n!==null&&Zc(n)&&(yt=!0))}function Nx(n,a,o,c){Oe=n;var p=0;do{if(Ai&&(Mi=null),Zo=0,Ai=!1,25<=p)throw Error(r(301));if(p+=1,xt=Ze=null,n.updateQueue!=null){var x=n.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}A.H=ry,x=a(o,c)}while(Ai);return x}function L2(){var n=A.H,a=n.useState()[0];return a=typeof a.then=="function"?Wo(a):a,n=n.useState()[0],(Ze!==null?Ze.memoizedState:null)!==n&&(Oe.flags|=1024),a}function Ah(){var n=ou!==0;return ou=0,n}function Mh(n,a,o){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~o}function kh(n){if(iu){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}iu=!1}Cs=0,xt=Ze=Oe=null,Ai=!1,Zo=ou=0,Mi=null}function Vt(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return xt===null?Oe.memoizedState=xt=n:xt=xt.next=n,xt}function mt(){if(Ze===null){var n=Oe.alternate;n=n!==null?n.memoizedState:null}else n=Ze.next;var a=xt===null?Oe.memoizedState:xt.next;if(a!==null)xt=a,Ze=n;else{if(n===null)throw Oe.alternate===null?Error(r(467)):Error(r(310));Ze=n,n={memoizedState:Ze.memoizedState,baseState:Ze.baseState,baseQueue:Ze.baseQueue,queue:Ze.queue,next:null},xt===null?Oe.memoizedState=xt=n:xt=xt.next=n}return xt}function lu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Wo(n){var a=Zo;return Zo+=1,Mi===null&&(Mi=[]),n=hx(Mi,n,a),a=Oe,(xt===null?a.memoizedState:xt.next)===null&&(a=a.alternate,A.H=a===null||a.memoizedState===null?ay:Vh),n}function cu(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Wo(n);if(n.$$typeof===_)return Dt(n)}throw Error(r(438,String(n)))}function Oh(n){var a=null,o=Oe.updateQueue;if(o!==null&&(a=o.memoCache),a==null){var c=Oe.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(a={data:c.data.map(function(p){return p.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),o===null&&(o=lu(),Oe.updateQueue=o),o.memoCache=a,o=a.data[a.index],o===void 0)for(o=a.data[a.index]=Array(n),c=0;c<n;c++)o[c]=H;return a.index++,o}function _s(n,a){return typeof a=="function"?a(n):a}function uu(n){var a=mt();return Dh(a,Ze,n)}function Dh(n,a,o){var c=n.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=o;var p=n.baseQueue,x=c.pending;if(x!==null){if(p!==null){var E=p.next;p.next=x.next,x.next=E}a.baseQueue=p=x,c.pending=null}if(x=n.baseState,p===null)n.memoizedState=x;else{a=p.next;var k=E=null,F=null,te=a,re=!1;do{var le=te.lane&-536870913;if(le!==te.lane?(He&le)===le:(Cs&le)===le){var ne=te.revertLane;if(ne===0)F!==null&&(F=F.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),le===Ei&&(re=!0);else if((Cs&ne)===ne){te=te.next,ne===Ei&&(re=!0);continue}else le={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},F===null?(k=F=le,E=x):F=F.next=le,Oe.lanes|=ne,ga|=ne;le=te.action,Sr&&o(x,le),x=te.hasEagerState?te.eagerState:o(x,le)}else ne={lane:le,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},F===null?(k=F=ne,E=x):F=F.next=ne,Oe.lanes|=le,ga|=le;te=te.next}while(te!==null&&te!==a);if(F===null?E=x:F.next=k,!hn(x,n.memoizedState)&&(yt=!0,re&&(o=Ci,o!==null)))throw o;n.memoizedState=x,n.baseState=E,n.baseQueue=F,c.lastRenderedState=x}return p===null&&(c.lanes=0),[n.memoizedState,c.dispatch]}function Lh(n){var a=mt(),o=a.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=n;var c=o.dispatch,p=o.pending,x=a.memoizedState;if(p!==null){o.pending=null;var E=p=p.next;do x=n(x,E.action),E=E.next;while(E!==p);hn(x,a.memoizedState)||(yt=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),o.lastRenderedState=x}return[x,c]}function jx(n,a,o){var c=Oe,p=mt(),x=$e;if(x){if(o===void 0)throw Error(r(407));o=o()}else o=a();var E=!hn((Ze||p).memoizedState,o);if(E&&(p.memoizedState=o,yt=!0),p=p.queue,Ih(_x.bind(null,c,p,n),[n]),p.getSnapshot!==a||E||xt!==null&&xt.memoizedState.tag&1){if(c.flags|=2048,ki(9,{destroy:void 0},Cx.bind(null,c,p,o,a),null),et===null)throw Error(r(349));x||(Cs&127)!==0||Ex(c,a,o)}return o}function Ex(n,a,o){n.flags|=16384,n={getSnapshot:a,value:o},a=Oe.updateQueue,a===null?(a=lu(),Oe.updateQueue=a,a.stores=[n]):(o=a.stores,o===null?a.stores=[n]:o.push(n))}function Cx(n,a,o,c){a.value=o,a.getSnapshot=c,Rx(a)&&Tx(n)}function _x(n,a,o){return o(function(){Rx(a)&&Tx(n)})}function Rx(n){var a=n.getSnapshot;n=n.value;try{var o=a();return!hn(n,o)}catch{return!0}}function Tx(n){var a=fr(n,2);a!==null&&an(a,n,2)}function zh(n){var a=Vt();if(typeof n=="function"){var o=n;if(n=o(),Sr){Zn(!0);try{o()}finally{Zn(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:n},a}function Ax(n,a,o,c){return n.baseState=o,Dh(n,Ze,typeof c=="function"?c:_s)}function z2(n,a,o,c,p){if(hu(n))throw Error(r(485));if(n=a.action,n!==null){var x={payload:p,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){x.listeners.push(E)}};A.T!==null?o(!0):x.isTransition=!1,c(x),o=a.pending,o===null?(x.next=a.pending=x,Mx(a,x)):(x.next=o.next,a.pending=o.next=x)}}function Mx(n,a){var o=a.action,c=a.payload,p=n.state;if(a.isTransition){var x=A.T,E={};A.T=E;try{var k=o(p,c),F=A.S;F!==null&&F(E,k),kx(n,a,k)}catch(te){Ph(n,a,te)}finally{x!==null&&E.types!==null&&(x.types=E.types),A.T=x}}else try{x=o(p,c),kx(n,a,x)}catch(te){Ph(n,a,te)}}function kx(n,a,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(c){Ox(n,a,c)},function(c){return Ph(n,a,c)}):Ox(n,a,o)}function Ox(n,a,o){a.status="fulfilled",a.value=o,Dx(a),n.state=o,a=n.pending,a!==null&&(o=a.next,o===a?n.pending=null:(o=o.next,a.next=o,Mx(n,o)))}function Ph(n,a,o){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do a.status="rejected",a.reason=o,Dx(a),a=a.next;while(a!==c)}n.action=null}function Dx(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function Lx(n,a){return a}function zx(n,a){if($e){var o=et.formState;if(o!==null){e:{var c=Oe;if($e){if(tt){t:{for(var p=tt,x=Tn;p.nodeType!==8;){if(!x){p=null;break t}if(p=Mn(p.nextSibling),p===null){p=null;break t}}x=p.data,p=x==="F!"||x==="F"?p:null}if(p){tt=Mn(p.nextSibling),c=p.data==="F!";break e}}oa(c)}c=!1}c&&(a=o[0])}}return o=Vt(),o.memoizedState=o.baseState=a,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lx,lastRenderedState:a},o.queue=c,o=ty.bind(null,Oe,c),c.dispatch=o,c=zh(!1),x=qh.bind(null,Oe,!1,c.queue),c=Vt(),p={state:a,dispatch:null,action:n,pending:null},c.queue=p,o=z2.bind(null,Oe,p,x,o),p.dispatch=o,c.memoizedState=n,[a,o,!1]}function Px(n){var a=mt();return Ix(a,Ze,n)}function Ix(n,a,o){if(a=Dh(n,a,Lx)[0],n=uu(_s)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var c=Wo(a)}catch(E){throw E===_i?eu:E}else c=a;a=mt();var p=a.queue,x=p.dispatch;return o!==a.memoizedState&&(Oe.flags|=2048,ki(9,{destroy:void 0},P2.bind(null,p,o),null)),[c,x,n]}function P2(n,a){n.action=a}function Bx(n){var a=mt(),o=Ze;if(o!==null)return Ix(a,o,n);mt(),a=a.memoizedState,o=mt();var c=o.queue.dispatch;return o.memoizedState=n,[a,c,!1]}function ki(n,a,o,c){return n={tag:n,create:o,deps:c,inst:a,next:null},a=Oe.updateQueue,a===null&&(a=lu(),Oe.updateQueue=a),o=a.lastEffect,o===null?a.lastEffect=n.next=n:(c=o.next,o.next=n,n.next=c,a.lastEffect=n),n}function Hx(){return mt().memoizedState}function du(n,a,o,c){var p=Vt();Oe.flags|=n,p.memoizedState=ki(1|a,{destroy:void 0},o,c===void 0?null:c)}function fu(n,a,o,c){var p=mt();c=c===void 0?null:c;var x=p.memoizedState.inst;Ze!==null&&c!==null&&Rh(c,Ze.memoizedState.deps)?p.memoizedState=ki(a,x,o,c):(Oe.flags|=n,p.memoizedState=ki(1|a,x,o,c))}function Ux(n,a){du(8390656,8,n,a)}function Ih(n,a){fu(2048,8,n,a)}function I2(n){Oe.flags|=4;var a=Oe.updateQueue;if(a===null)a=lu(),Oe.updateQueue=a,a.events=[n];else{var o=a.events;o===null?a.events=[n]:o.push(n)}}function $x(n){var a=mt().memoizedState;return I2({ref:a,nextImpl:n}),function(){if((Qe&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function qx(n,a){return fu(4,2,n,a)}function Vx(n,a){return fu(4,4,n,a)}function Gx(n,a){if(typeof a=="function"){n=n();var o=a(n);return function(){typeof o=="function"?o():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function Yx(n,a,o){o=o!=null?o.concat([n]):null,fu(4,4,Gx.bind(null,a,n),o)}function Bh(){}function Qx(n,a){var o=mt();a=a===void 0?null:a;var c=o.memoizedState;return a!==null&&Rh(a,c[1])?c[0]:(o.memoizedState=[n,a],n)}function Kx(n,a){var o=mt();a=a===void 0?null:a;var c=o.memoizedState;if(a!==null&&Rh(a,c[1]))return c[0];if(c=n(),Sr){Zn(!0);try{n()}finally{Zn(!1)}}return o.memoizedState=[c,a],c}function Hh(n,a,o){return o===void 0||(Cs&1073741824)!==0&&(He&261930)===0?n.memoizedState=a:(n.memoizedState=o,n=Fy(),Oe.lanes|=n,ga|=n,o)}function Fx(n,a,o,c){return hn(o,a)?o:Ti.current!==null?(n=Hh(n,o,c),hn(n,a)||(yt=!0),n):(Cs&42)===0||(Cs&1073741824)!==0&&(He&261930)===0?(yt=!0,n.memoizedState=o):(n=Fy(),Oe.lanes|=n,ga|=n,a)}function Xx(n,a,o,c,p){var x=$.p;$.p=x!==0&&8>x?x:8;var E=A.T,k={};A.T=k,qh(n,!1,a,o);try{var F=p(),te=A.S;if(te!==null&&te(k,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var re=O2(F,c);Jo(n,a,re,vn(n))}else Jo(n,a,c,vn(n))}catch(le){Jo(n,a,{then:function(){},status:"rejected",reason:le},vn())}finally{$.p=x,E!==null&&k.types!==null&&(E.types=k.types),A.T=E}}function B2(){}function Uh(n,a,o,c){if(n.tag!==5)throw Error(r(476));var p=Zx(n).queue;Xx(n,p,a,z,o===null?B2:function(){return Wx(n),o(c)})}function Zx(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:z},next:null};var o={};return a.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:o},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function Wx(n){var a=Zx(n);a.next===null&&(a=n.alternate.memoizedState),Jo(n,a.next.queue,{},vn())}function $h(){return Dt(gl)}function Jx(){return mt().memoizedState}function ey(){return mt().memoizedState}function H2(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var o=vn();n=ua(o);var c=da(a,n,o);c!==null&&(an(c,a,o),Ko(c,a,o)),a={cache:xh()},n.payload=a;return}a=a.return}}function U2(n,a,o){var c=vn();o={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},hu(n)?ny(a,o):(o=ih(n,a,o,c),o!==null&&(an(o,n,c),sy(o,a,c)))}function ty(n,a,o){var c=vn();Jo(n,a,o,c)}function Jo(n,a,o,c){var p={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(hu(n))ny(a,p);else{var x=n.alternate;if(n.lanes===0&&(x===null||x.lanes===0)&&(x=a.lastRenderedReducer,x!==null))try{var E=a.lastRenderedState,k=x(E,o);if(p.hasEagerState=!0,p.eagerState=k,hn(k,E))return Qc(n,a,p,0),et===null&&Yc(),!1}catch{}finally{}if(o=ih(n,a,p,c),o!==null)return an(o,n,c),sy(o,a,c),!0}return!1}function qh(n,a,o,c){if(c={lane:2,revertLane:Sm(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},hu(n)){if(a)throw Error(r(479))}else a=ih(n,o,c,2),a!==null&&an(a,n,2)}function hu(n){var a=n.alternate;return n===Oe||a!==null&&a===Oe}function ny(n,a){Ai=iu=!0;var o=n.pending;o===null?a.next=a:(a.next=o.next,o.next=a),n.pending=a}function sy(n,a,o){if((o&4194048)!==0){var c=a.lanes;c&=n.pendingLanes,o|=c,a.lanes=o,Cc(n,o)}}var el={readContext:Dt,use:cu,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};el.useEffectEvent=lt;var ay={readContext:Dt,use:cu,useCallback:function(n,a){return Vt().memoizedState=[n,a===void 0?null:a],n},useContext:Dt,useEffect:Ux,useImperativeHandle:function(n,a,o){o=o!=null?o.concat([n]):null,du(4194308,4,Gx.bind(null,a,n),o)},useLayoutEffect:function(n,a){return du(4194308,4,n,a)},useInsertionEffect:function(n,a){du(4,2,n,a)},useMemo:function(n,a){var o=Vt();a=a===void 0?null:a;var c=n();if(Sr){Zn(!0);try{n()}finally{Zn(!1)}}return o.memoizedState=[c,a],c},useReducer:function(n,a,o){var c=Vt();if(o!==void 0){var p=o(a);if(Sr){Zn(!0);try{o(a)}finally{Zn(!1)}}}else p=a;return c.memoizedState=c.baseState=p,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:p},c.queue=n,n=n.dispatch=U2.bind(null,Oe,n),[c.memoizedState,n]},useRef:function(n){var a=Vt();return n={current:n},a.memoizedState=n},useState:function(n){n=zh(n);var a=n.queue,o=ty.bind(null,Oe,a);return a.dispatch=o,[n.memoizedState,o]},useDebugValue:Bh,useDeferredValue:function(n,a){var o=Vt();return Hh(o,n,a)},useTransition:function(){var n=zh(!1);return n=Xx.bind(null,Oe,n.queue,!0,!1),Vt().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,o){var c=Oe,p=Vt();if($e){if(o===void 0)throw Error(r(407));o=o()}else{if(o=a(),et===null)throw Error(r(349));(He&127)!==0||Ex(c,a,o)}p.memoizedState=o;var x={value:o,getSnapshot:a};return p.queue=x,Ux(_x.bind(null,c,x,n),[n]),c.flags|=2048,ki(9,{destroy:void 0},Cx.bind(null,c,x,o,a),null),o},useId:function(){var n=Vt(),a=et.identifierPrefix;if($e){var o=es,c=Jn;o=(c&~(1<<32-qt(c)-1)).toString(32)+o,a="_"+a+"R_"+o,o=ou++,0<o&&(a+="H"+o.toString(32)),a+="_"}else o=D2++,a="_"+a+"r_"+o.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:$h,useFormState:zx,useActionState:zx,useOptimistic:function(n){var a=Vt();a.memoizedState=a.baseState=n;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=o,a=qh.bind(null,Oe,!0,o),o.dispatch=a,[n,a]},useMemoCache:Oh,useCacheRefresh:function(){return Vt().memoizedState=H2.bind(null,Oe)},useEffectEvent:function(n){var a=Vt(),o={impl:n};return a.memoizedState=o,function(){if((Qe&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}},Vh={readContext:Dt,use:cu,useCallback:Qx,useContext:Dt,useEffect:Ih,useImperativeHandle:Yx,useInsertionEffect:qx,useLayoutEffect:Vx,useMemo:Kx,useReducer:uu,useRef:Hx,useState:function(){return uu(_s)},useDebugValue:Bh,useDeferredValue:function(n,a){var o=mt();return Fx(o,Ze.memoizedState,n,a)},useTransition:function(){var n=uu(_s)[0],a=mt().memoizedState;return[typeof n=="boolean"?n:Wo(n),a]},useSyncExternalStore:jx,useId:Jx,useHostTransitionStatus:$h,useFormState:Px,useActionState:Px,useOptimistic:function(n,a){var o=mt();return Ax(o,Ze,n,a)},useMemoCache:Oh,useCacheRefresh:ey};Vh.useEffectEvent=$x;var ry={readContext:Dt,use:cu,useCallback:Qx,useContext:Dt,useEffect:Ih,useImperativeHandle:Yx,useInsertionEffect:qx,useLayoutEffect:Vx,useMemo:Kx,useReducer:Lh,useRef:Hx,useState:function(){return Lh(_s)},useDebugValue:Bh,useDeferredValue:function(n,a){var o=mt();return Ze===null?Hh(o,n,a):Fx(o,Ze.memoizedState,n,a)},useTransition:function(){var n=Lh(_s)[0],a=mt().memoizedState;return[typeof n=="boolean"?n:Wo(n),a]},useSyncExternalStore:jx,useId:Jx,useHostTransitionStatus:$h,useFormState:Bx,useActionState:Bx,useOptimistic:function(n,a){var o=mt();return Ze!==null?Ax(o,Ze,n,a):(o.baseState=n,[n,o.queue.dispatch])},useMemoCache:Oh,useCacheRefresh:ey};ry.useEffectEvent=$x;function Gh(n,a,o,c){a=n.memoizedState,o=o(c,a),o=o==null?a:g({},a,o),n.memoizedState=o,n.lanes===0&&(n.updateQueue.baseState=o)}var Yh={enqueueSetState:function(n,a,o){n=n._reactInternals;var c=vn(),p=ua(c);p.payload=a,o!=null&&(p.callback=o),a=da(n,p,c),a!==null&&(an(a,n,c),Ko(a,n,c))},enqueueReplaceState:function(n,a,o){n=n._reactInternals;var c=vn(),p=ua(c);p.tag=1,p.payload=a,o!=null&&(p.callback=o),a=da(n,p,c),a!==null&&(an(a,n,c),Ko(a,n,c))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var o=vn(),c=ua(o);c.tag=2,a!=null&&(c.callback=a),a=da(n,c,o),a!==null&&(an(a,n,o),Ko(a,n,o))}};function iy(n,a,o,c,p,x,E){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(c,x,E):a.prototype&&a.prototype.isPureReactComponent?!Ho(o,c)||!Ho(p,x):!0}function oy(n,a,o,c){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(o,c),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(o,c),a.state!==n&&Yh.enqueueReplaceState(a,a.state,null)}function wr(n,a){var o=a;if("ref"in a){o={};for(var c in a)c!=="ref"&&(o[c]=a[c])}if(n=n.defaultProps){o===a&&(o=g({},o));for(var p in n)o[p]===void 0&&(o[p]=n[p])}return o}function ly(n){Gc(n)}function cy(n){console.error(n)}function uy(n){Gc(n)}function mu(n,a){try{var o=n.onUncaughtError;o(a.value,{componentStack:a.stack})}catch(c){setTimeout(function(){throw c})}}function dy(n,a,o){try{var c=n.onCaughtError;c(o.value,{componentStack:o.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function Qh(n,a,o){return o=ua(o),o.tag=3,o.payload={element:null},o.callback=function(){mu(n,a)},o}function fy(n){return n=ua(n),n.tag=3,n}function hy(n,a,o,c){var p=o.type.getDerivedStateFromError;if(typeof p=="function"){var x=c.value;n.payload=function(){return p(x)},n.callback=function(){dy(a,o,c)}}var E=o.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(n.callback=function(){dy(a,o,c),typeof p!="function"&&(xa===null?xa=new Set([this]):xa.add(this));var k=c.stack;this.componentDidCatch(c.value,{componentStack:k!==null?k:""})})}function $2(n,a,o,c,p){if(o.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(a=o.alternate,a!==null&&ji(a,o,p,!0),o=pn.current,o!==null){switch(o.tag){case 31:case 13:return An===null?Cu():o.alternate===null&&ct===0&&(ct=3),o.flags&=-257,o.flags|=65536,o.lanes=p,c===tu?o.flags|=16384:(a=o.updateQueue,a===null?o.updateQueue=new Set([c]):a.add(c),ym(n,c,p)),!1;case 22:return o.flags|=65536,c===tu?o.flags|=16384:(a=o.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([c])},o.updateQueue=a):(o=a.retryQueue,o===null?a.retryQueue=new Set([c]):o.add(c)),ym(n,c,p)),!1}throw Error(r(435,o.tag))}return ym(n,c,p),Cu(),!1}if($e)return a=pn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=p,c!==fh&&(n=Error(r(422),{cause:c}),qo(Cn(n,o)))):(c!==fh&&(a=Error(r(423),{cause:c}),qo(Cn(a,o))),n=n.current.alternate,n.flags|=65536,p&=-p,n.lanes|=p,c=Cn(c,o),p=Qh(n.stateNode,c,p),Nh(n,p),ct!==4&&(ct=2)),!1;var x=Error(r(520),{cause:c});if(x=Cn(x,o),ll===null?ll=[x]:ll.push(x),ct!==4&&(ct=2),a===null)return!0;c=Cn(c,o),o=a;do{switch(o.tag){case 3:return o.flags|=65536,n=p&-p,o.lanes|=n,n=Qh(o.stateNode,c,n),Nh(o,n),!1;case 1:if(a=o.type,x=o.stateNode,(o.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(xa===null||!xa.has(x))))return o.flags|=65536,p&=-p,o.lanes|=p,p=fy(p),hy(p,n,o,c),Nh(o,p),!1}o=o.return}while(o!==null);return!1}var Kh=Error(r(461)),yt=!1;function Lt(n,a,o,c){a.child=n===null?xx(a,null,o,c):br(a,n.child,o,c)}function my(n,a,o,c,p){o=o.render;var x=a.ref;if("ref"in c){var E={};for(var k in c)k!=="ref"&&(E[k]=c[k])}else E=c;return gr(a),c=Th(n,a,o,E,x,p),k=Ah(),n!==null&&!yt?(Mh(n,a,p),Rs(n,a,p)):($e&&k&&uh(a),a.flags|=1,Lt(n,a,c,p),a.child)}function py(n,a,o,c,p){if(n===null){var x=o.type;return typeof x=="function"&&!oh(x)&&x.defaultProps===void 0&&o.compare===null?(a.tag=15,a.type=x,gy(n,a,x,c,p)):(n=Fc(o.type,null,c,a,a.mode,p),n.ref=a.ref,n.return=a,a.child=n)}if(x=n.child,!nm(n,p)){var E=x.memoizedProps;if(o=o.compare,o=o!==null?o:Ho,o(E,c)&&n.ref===a.ref)return Rs(n,a,p)}return a.flags|=1,n=ws(x,c),n.ref=a.ref,n.return=a,a.child=n}function gy(n,a,o,c,p){if(n!==null){var x=n.memoizedProps;if(Ho(x,c)&&n.ref===a.ref)if(yt=!1,a.pendingProps=c=x,nm(n,p))(n.flags&131072)!==0&&(yt=!0);else return a.lanes=n.lanes,Rs(n,a,p)}return Fh(n,a,o,c,p)}function xy(n,a,o,c){var p=c.children,x=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|o:o,n!==null){for(c=a.child=n.child,p=0;c!==null;)p=p|c.lanes|c.childLanes,c=c.sibling;c=p&~x}else c=0,a.child=null;return yy(n,a,x,o,c)}if((o&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&Jc(a,x!==null?x.cachePool:null),x!==null?bx(a,x):Eh(),Sx(a);else return c=a.lanes=536870912,yy(n,a,x!==null?x.baseLanes|o:o,o,c)}else x!==null?(Jc(a,x.cachePool),bx(a,x),ha(),a.memoizedState=null):(n!==null&&Jc(a,null),Eh(),ha());return Lt(n,a,p,o),a.child}function tl(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function yy(n,a,o,c,p){var x=vh();return x=x===null?null:{parent:gt._currentValue,pool:x},a.memoizedState={baseLanes:o,cachePool:x},n!==null&&Jc(a,null),Eh(),Sx(a),n!==null&&ji(n,a,c,!0),a.childLanes=p,null}function pu(n,a){return a=xu({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function vy(n,a,o){return br(a,n.child,null,o),n=pu(a,a.pendingProps),n.flags|=2,gn(a),a.memoizedState=null,n}function q2(n,a,o){var c=a.pendingProps,p=(a.flags&128)!==0;if(a.flags&=-129,n===null){if($e){if(c.mode==="hidden")return n=pu(a,c),a.lanes=536870912,tl(null,n);if(_h(a),(n=tt)?(n=Mv(n,Tn),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:ra!==null?{id:Jn,overflow:es}:null,retryLane:536870912,hydrationErrors:null},o=nx(n),o.return=a,a.child=o,Ot=a,tt=null)):n=null,n===null)throw oa(a);return a.lanes=536870912,null}return pu(a,c)}var x=n.memoizedState;if(x!==null){var E=x.dehydrated;if(_h(a),p)if(a.flags&256)a.flags&=-257,a=vy(n,a,o);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(r(558));else if(yt||ji(n,a,o,!1),p=(o&n.childLanes)!==0,yt||p){if(c=et,c!==null&&(E=_c(c,o),E!==0&&E!==x.retryLane))throw x.retryLane=E,fr(n,E),an(c,n,E),Kh;Cu(),a=vy(n,a,o)}else n=x.treeContext,tt=Mn(E.nextSibling),Ot=a,$e=!0,ia=null,Tn=!1,n!==null&&rx(a,n),a=pu(a,c),a.flags|=4096;return a}return n=ws(n.child,{mode:c.mode,children:c.children}),n.ref=a.ref,a.child=n,n.return=a,n}function gu(n,a){var o=a.ref;if(o===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(r(284));(n===null||n.ref!==o)&&(a.flags|=4194816)}}function Fh(n,a,o,c,p){return gr(a),o=Th(n,a,o,c,void 0,p),c=Ah(),n!==null&&!yt?(Mh(n,a,p),Rs(n,a,p)):($e&&c&&uh(a),a.flags|=1,Lt(n,a,o,p),a.child)}function by(n,a,o,c,p,x){return gr(a),a.updateQueue=null,o=Nx(a,c,o,p),wx(n),c=Ah(),n!==null&&!yt?(Mh(n,a,x),Rs(n,a,x)):($e&&c&&uh(a),a.flags|=1,Lt(n,a,o,x),a.child)}function Sy(n,a,o,c,p){if(gr(a),a.stateNode===null){var x=bi,E=o.contextType;typeof E=="object"&&E!==null&&(x=Dt(E)),x=new o(c,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Yh,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=c,x.state=a.memoizedState,x.refs={},Sh(a),E=o.contextType,x.context=typeof E=="object"&&E!==null?Dt(E):bi,x.state=a.memoizedState,E=o.getDerivedStateFromProps,typeof E=="function"&&(Gh(a,o,E,c),x.state=a.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(E=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),E!==x.state&&Yh.enqueueReplaceState(x,x.state,null),Xo(a,c,x,p),Fo(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),c=!0}else if(n===null){x=a.stateNode;var k=a.memoizedProps,F=wr(o,k);x.props=F;var te=x.context,re=o.contextType;E=bi,typeof re=="object"&&re!==null&&(E=Dt(re));var le=o.getDerivedStateFromProps;re=typeof le=="function"||typeof x.getSnapshotBeforeUpdate=="function",k=a.pendingProps!==k,re||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(k||te!==E)&&oy(a,x,c,E),ca=!1;var ne=a.memoizedState;x.state=ne,Xo(a,c,x,p),Fo(),te=a.memoizedState,k||ne!==te||ca?(typeof le=="function"&&(Gh(a,o,le,c),te=a.memoizedState),(F=ca||iy(a,o,F,c,ne,te,E))?(re||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount()),typeof x.componentDidMount=="function"&&(a.flags|=4194308)):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=c,a.memoizedState=te),x.props=c,x.state=te,x.context=E,c=F):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),c=!1)}else{x=a.stateNode,wh(n,a),E=a.memoizedProps,re=wr(o,E),x.props=re,le=a.pendingProps,ne=x.context,te=o.contextType,F=bi,typeof te=="object"&&te!==null&&(F=Dt(te)),k=o.getDerivedStateFromProps,(te=typeof k=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(E!==le||ne!==F)&&oy(a,x,c,F),ca=!1,ne=a.memoizedState,x.state=ne,Xo(a,c,x,p),Fo();var ae=a.memoizedState;E!==le||ne!==ae||ca||n!==null&&n.dependencies!==null&&Zc(n.dependencies)?(typeof k=="function"&&(Gh(a,o,k,c),ae=a.memoizedState),(re=ca||iy(a,o,re,c,ne,ae,F)||n!==null&&n.dependencies!==null&&Zc(n.dependencies))?(te||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(c,ae,F),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(c,ae,F)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||E===n.memoizedProps&&ne===n.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||E===n.memoizedProps&&ne===n.memoizedState||(a.flags|=1024),a.memoizedProps=c,a.memoizedState=ae),x.props=c,x.state=ae,x.context=F,c=re):(typeof x.componentDidUpdate!="function"||E===n.memoizedProps&&ne===n.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||E===n.memoizedProps&&ne===n.memoizedState||(a.flags|=1024),c=!1)}return x=c,gu(n,a),c=(a.flags&128)!==0,x||c?(x=a.stateNode,o=c&&typeof o.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,n!==null&&c?(a.child=br(a,n.child,null,p),a.child=br(a,null,o,p)):Lt(n,a,o,p),a.memoizedState=x.state,n=a.child):n=Rs(n,a,p),n}function wy(n,a,o,c){return mr(),a.flags|=256,Lt(n,a,o,c),a.child}var Xh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Zh(n){return{baseLanes:n,cachePool:dx()}}function Wh(n,a,o){return n=n!==null?n.childLanes&~o:0,a&&(n|=yn),n}function Ny(n,a,o){var c=a.pendingProps,p=!1,x=(a.flags&128)!==0,E;if((E=x)||(E=n!==null&&n.memoizedState===null?!1:(ht.current&2)!==0),E&&(p=!0,a.flags&=-129),E=(a.flags&32)!==0,a.flags&=-33,n===null){if($e){if(p?fa(a):ha(),(n=tt)?(n=Mv(n,Tn),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:ra!==null?{id:Jn,overflow:es}:null,retryLane:536870912,hydrationErrors:null},o=nx(n),o.return=a,a.child=o,Ot=a,tt=null)):n=null,n===null)throw oa(a);return Dm(n)?a.lanes=32:a.lanes=536870912,null}var k=c.children;return c=c.fallback,p?(ha(),p=a.mode,k=xu({mode:"hidden",children:k},p),c=hr(c,p,o,null),k.return=a,c.return=a,k.sibling=c,a.child=k,c=a.child,c.memoizedState=Zh(o),c.childLanes=Wh(n,E,o),a.memoizedState=Xh,tl(null,c)):(fa(a),Jh(a,k))}var F=n.memoizedState;if(F!==null&&(k=F.dehydrated,k!==null)){if(x)a.flags&256?(fa(a),a.flags&=-257,a=em(n,a,o)):a.memoizedState!==null?(ha(),a.child=n.child,a.flags|=128,a=null):(ha(),k=c.fallback,p=a.mode,c=xu({mode:"visible",children:c.children},p),k=hr(k,p,o,null),k.flags|=2,c.return=a,k.return=a,c.sibling=k,a.child=c,br(a,n.child,null,o),c=a.child,c.memoizedState=Zh(o),c.childLanes=Wh(n,E,o),a.memoizedState=Xh,a=tl(null,c));else if(fa(a),Dm(k)){if(E=k.nextSibling&&k.nextSibling.dataset,E)var te=E.dgst;E=te,c=Error(r(419)),c.stack="",c.digest=E,qo({value:c,source:null,stack:null}),a=em(n,a,o)}else if(yt||ji(n,a,o,!1),E=(o&n.childLanes)!==0,yt||E){if(E=et,E!==null&&(c=_c(E,o),c!==0&&c!==F.retryLane))throw F.retryLane=c,fr(n,c),an(E,n,c),Kh;Om(k)||Cu(),a=em(n,a,o)}else Om(k)?(a.flags|=192,a.child=n.child,a=null):(n=F.treeContext,tt=Mn(k.nextSibling),Ot=a,$e=!0,ia=null,Tn=!1,n!==null&&rx(a,n),a=Jh(a,c.children),a.flags|=4096);return a}return p?(ha(),k=c.fallback,p=a.mode,F=n.child,te=F.sibling,c=ws(F,{mode:"hidden",children:c.children}),c.subtreeFlags=F.subtreeFlags&65011712,te!==null?k=ws(te,k):(k=hr(k,p,o,null),k.flags|=2),k.return=a,c.return=a,c.sibling=k,a.child=c,tl(null,c),c=a.child,k=n.child.memoizedState,k===null?k=Zh(o):(p=k.cachePool,p!==null?(F=gt._currentValue,p=p.parent!==F?{parent:F,pool:F}:p):p=dx(),k={baseLanes:k.baseLanes|o,cachePool:p}),c.memoizedState=k,c.childLanes=Wh(n,E,o),a.memoizedState=Xh,tl(n.child,c)):(fa(a),o=n.child,n=o.sibling,o=ws(o,{mode:"visible",children:c.children}),o.return=a,o.sibling=null,n!==null&&(E=a.deletions,E===null?(a.deletions=[n],a.flags|=16):E.push(n)),a.child=o,a.memoizedState=null,o)}function Jh(n,a){return a=xu({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function xu(n,a){return n=mn(22,n,null,a),n.lanes=0,n}function em(n,a,o){return br(a,n.child,null,o),n=Jh(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function jy(n,a,o){n.lanes|=a;var c=n.alternate;c!==null&&(c.lanes|=a),ph(n.return,a,o)}function tm(n,a,o,c,p,x){var E=n.memoizedState;E===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:c,tail:o,tailMode:p,treeForkCount:x}:(E.isBackwards=a,E.rendering=null,E.renderingStartTime=0,E.last=c,E.tail=o,E.tailMode=p,E.treeForkCount=x)}function Ey(n,a,o){var c=a.pendingProps,p=c.revealOrder,x=c.tail;c=c.children;var E=ht.current,k=(E&2)!==0;if(k?(E=E&1|2,a.flags|=128):E&=1,ee(ht,E),Lt(n,a,c,o),c=$e?$o:0,!k&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&jy(n,o,a);else if(n.tag===19)jy(n,o,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(p){case"forwards":for(o=a.child,p=null;o!==null;)n=o.alternate,n!==null&&ru(n)===null&&(p=o),o=o.sibling;o=p,o===null?(p=a.child,a.child=null):(p=o.sibling,o.sibling=null),tm(a,!1,p,o,x,c);break;case"backwards":case"unstable_legacy-backwards":for(o=null,p=a.child,a.child=null;p!==null;){if(n=p.alternate,n!==null&&ru(n)===null){a.child=p;break}n=p.sibling,p.sibling=o,o=p,p=n}tm(a,!0,o,null,x,c);break;case"together":tm(a,!1,null,null,void 0,c);break;default:a.memoizedState=null}return a.child}function Rs(n,a,o){if(n!==null&&(a.dependencies=n.dependencies),ga|=a.lanes,(o&a.childLanes)===0)if(n!==null){if(ji(n,a,o,!1),(o&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(r(153));if(a.child!==null){for(n=a.child,o=ws(n,n.pendingProps),a.child=o,o.return=a;n.sibling!==null;)n=n.sibling,o=o.sibling=ws(n,n.pendingProps),o.return=a;o.sibling=null}return a.child}function nm(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&Zc(n)))}function V2(n,a,o){switch(a.tag){case 3:ue(a,a.stateNode.containerInfo),la(a,gt,n.memoizedState.cache),mr();break;case 27:case 5:Ce(a);break;case 4:ue(a,a.stateNode.containerInfo);break;case 10:la(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,_h(a),null;break;case 13:var c=a.memoizedState;if(c!==null)return c.dehydrated!==null?(fa(a),a.flags|=128,null):(o&a.child.childLanes)!==0?Ny(n,a,o):(fa(a),n=Rs(n,a,o),n!==null?n.sibling:null);fa(a);break;case 19:var p=(n.flags&128)!==0;if(c=(o&a.childLanes)!==0,c||(ji(n,a,o,!1),c=(o&a.childLanes)!==0),p){if(c)return Ey(n,a,o);a.flags|=128}if(p=a.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),ee(ht,ht.current),c)break;return null;case 22:return a.lanes=0,xy(n,a,o,a.pendingProps);case 24:la(a,gt,n.memoizedState.cache)}return Rs(n,a,o)}function Cy(n,a,o){if(n!==null)if(n.memoizedProps!==a.pendingProps)yt=!0;else{if(!nm(n,o)&&(a.flags&128)===0)return yt=!1,V2(n,a,o);yt=(n.flags&131072)!==0}else yt=!1,$e&&(a.flags&1048576)!==0&&ax(a,$o,a.index);switch(a.lanes=0,a.tag){case 16:e:{var c=a.pendingProps;if(n=yr(a.elementType),a.type=n,typeof n=="function")oh(n)?(c=wr(n,c),a.tag=1,a=Sy(null,a,n,c,o)):(a.tag=0,a=Fh(null,a,n,c,o));else{if(n!=null){var p=n.$$typeof;if(p===R){a.tag=11,a=my(null,a,n,c,o);break e}else if(p===L){a.tag=14,a=py(null,a,n,c,o);break e}}throw a=U(n)||n,Error(r(306,a,""))}}return a;case 0:return Fh(n,a,a.type,a.pendingProps,o);case 1:return c=a.type,p=wr(c,a.pendingProps),Sy(n,a,c,p,o);case 3:e:{if(ue(a,a.stateNode.containerInfo),n===null)throw Error(r(387));c=a.pendingProps;var x=a.memoizedState;p=x.element,wh(n,a),Xo(a,c,null,o);var E=a.memoizedState;if(c=E.cache,la(a,gt,c),c!==x.cache&&gh(a,[gt],o,!0),Fo(),c=E.element,x.isDehydrated)if(x={element:c,isDehydrated:!1,cache:E.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=wy(n,a,c,o);break e}else if(c!==p){p=Cn(Error(r(424)),a),qo(p),a=wy(n,a,c,o);break e}else{switch(n=a.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(tt=Mn(n.firstChild),Ot=a,$e=!0,ia=null,Tn=!0,o=xx(a,null,c,o),a.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(mr(),c===p){a=Rs(n,a,o);break e}Lt(n,a,c,o)}a=a.child}return a;case 26:return gu(n,a),n===null?(o=Pv(a.type,null,a.pendingProps,null))?a.memoizedState=o:$e||(o=a.type,n=a.pendingProps,c=Ou(ce.current).createElement(o),c[wt]=a,c[It]=n,zt(c,o,n),pt(c),a.stateNode=c):a.memoizedState=Pv(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return Ce(a),n===null&&$e&&(c=a.stateNode=Dv(a.type,a.pendingProps,ce.current),Ot=a,Tn=!0,p=tt,Sa(a.type)?(Lm=p,tt=Mn(c.firstChild)):tt=p),Lt(n,a,a.pendingProps.children,o),gu(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&$e&&((p=c=tt)&&(c=bC(c,a.type,a.pendingProps,Tn),c!==null?(a.stateNode=c,Ot=a,tt=Mn(c.firstChild),Tn=!1,p=!0):p=!1),p||oa(a)),Ce(a),p=a.type,x=a.pendingProps,E=n!==null?n.memoizedProps:null,c=x.children,Am(p,x)?c=null:E!==null&&Am(p,E)&&(a.flags|=32),a.memoizedState!==null&&(p=Th(n,a,L2,null,null,o),gl._currentValue=p),gu(n,a),Lt(n,a,c,o),a.child;case 6:return n===null&&$e&&((n=o=tt)&&(o=SC(o,a.pendingProps,Tn),o!==null?(a.stateNode=o,Ot=a,tt=null,n=!0):n=!1),n||oa(a)),null;case 13:return Ny(n,a,o);case 4:return ue(a,a.stateNode.containerInfo),c=a.pendingProps,n===null?a.child=br(a,null,c,o):Lt(n,a,c,o),a.child;case 11:return my(n,a,a.type,a.pendingProps,o);case 7:return Lt(n,a,a.pendingProps,o),a.child;case 8:return Lt(n,a,a.pendingProps.children,o),a.child;case 12:return Lt(n,a,a.pendingProps.children,o),a.child;case 10:return c=a.pendingProps,la(a,a.type,c.value),Lt(n,a,c.children,o),a.child;case 9:return p=a.type._context,c=a.pendingProps.children,gr(a),p=Dt(p),c=c(p),a.flags|=1,Lt(n,a,c,o),a.child;case 14:return py(n,a,a.type,a.pendingProps,o);case 15:return gy(n,a,a.type,a.pendingProps,o);case 19:return Ey(n,a,o);case 31:return q2(n,a,o);case 22:return xy(n,a,o,a.pendingProps);case 24:return gr(a),c=Dt(gt),n===null?(p=vh(),p===null&&(p=et,x=xh(),p.pooledCache=x,x.refCount++,x!==null&&(p.pooledCacheLanes|=o),p=x),a.memoizedState={parent:c,cache:p},Sh(a),la(a,gt,p)):((n.lanes&o)!==0&&(wh(n,a),Xo(a,null,null,o),Fo()),p=n.memoizedState,x=a.memoizedState,p.parent!==c?(p={parent:c,cache:c},a.memoizedState=p,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=p),la(a,gt,c)):(c=x.cache,la(a,gt,c),c!==p.cache&&gh(a,[gt],o,!0))),Lt(n,a,a.pendingProps.children,o),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Ts(n){n.flags|=4}function sm(n,a,o,c,p){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(p&335544128)===p)if(n.stateNode.complete)n.flags|=8192;else if(Jy())n.flags|=8192;else throw vr=tu,bh}else n.flags&=-16777217}function _y(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!$v(a))if(Jy())n.flags|=8192;else throw vr=tu,bh}function yu(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?jc():536870912,n.lanes|=a,zi|=a)}function nl(n,a){if(!$e)switch(n.tailMode){case"hidden":a=n.tail;for(var o=null;a!==null;)a.alternate!==null&&(o=a),a=a.sibling;o===null?n.tail=null:o.sibling=null;break;case"collapsed":o=n.tail;for(var c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:c.sibling=null}}function nt(n){var a=n.alternate!==null&&n.alternate.child===n.child,o=0,c=0;if(a)for(var p=n.child;p!==null;)o|=p.lanes|p.childLanes,c|=p.subtreeFlags&65011712,c|=p.flags&65011712,p.return=n,p=p.sibling;else for(p=n.child;p!==null;)o|=p.lanes|p.childLanes,c|=p.subtreeFlags,c|=p.flags,p.return=n,p=p.sibling;return n.subtreeFlags|=c,n.childLanes=o,a}function G2(n,a,o){var c=a.pendingProps;switch(dh(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nt(a),null;case 1:return nt(a),null;case 3:return o=a.stateNode,c=null,n!==null&&(c=n.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),Es(gt),he(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(n===null||n.child===null)&&(Ni(a)?Ts(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,hh())),nt(a),null;case 26:var p=a.type,x=a.memoizedState;return n===null?(Ts(a),x!==null?(nt(a),_y(a,x)):(nt(a),sm(a,p,null,c,o))):x?x!==n.memoizedState?(Ts(a),nt(a),_y(a,x)):(nt(a),a.flags&=-16777217):(n=n.memoizedProps,n!==c&&Ts(a),nt(a),sm(a,p,n,c,o)),null;case 27:if(Se(a),o=ce.current,p=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==c&&Ts(a);else{if(!c){if(a.stateNode===null)throw Error(r(166));return nt(a),null}n=se.current,Ni(a)?ix(a):(n=Dv(p,c,o),a.stateNode=n,Ts(a))}return nt(a),null;case 5:if(Se(a),p=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==c&&Ts(a);else{if(!c){if(a.stateNode===null)throw Error(r(166));return nt(a),null}if(x=se.current,Ni(a))ix(a);else{var E=Ou(ce.current);switch(x){case 1:x=E.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:x=E.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":x=E.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":x=E.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":x=E.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof c.is=="string"?E.createElement("select",{is:c.is}):E.createElement("select"),c.multiple?x.multiple=!0:c.size&&(x.size=c.size);break;default:x=typeof c.is=="string"?E.createElement(p,{is:c.is}):E.createElement(p)}}x[wt]=a,x[It]=c;e:for(E=a.child;E!==null;){if(E.tag===5||E.tag===6)x.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===a)break e;for(;E.sibling===null;){if(E.return===null||E.return===a)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}a.stateNode=x;e:switch(zt(x,p,c),p){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Ts(a)}}return nt(a),sm(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,o),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==c&&Ts(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(r(166));if(n=ce.current,Ni(a)){if(n=a.stateNode,o=a.memoizedProps,c=null,p=Ot,p!==null)switch(p.tag){case 27:case 5:c=p.memoizedProps}n[wt]=a,n=!!(n.nodeValue===o||c!==null&&c.suppressHydrationWarning===!0||Nv(n.nodeValue,o)),n||oa(a,!0)}else n=Ou(n).createTextNode(c),n[wt]=a,a.stateNode=n}return nt(a),null;case 31:if(o=a.memoizedState,n===null||n.memoizedState!==null){if(c=Ni(a),o!==null){if(n===null){if(!c)throw Error(r(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(557));n[wt]=a}else mr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;nt(a),n=!1}else o=hh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=o),n=!0;if(!n)return a.flags&256?(gn(a),a):(gn(a),null);if((a.flags&128)!==0)throw Error(r(558))}return nt(a),null;case 13:if(c=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(p=Ni(a),c!==null&&c.dehydrated!==null){if(n===null){if(!p)throw Error(r(318));if(p=a.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(r(317));p[wt]=a}else mr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;nt(a),p=!1}else p=hh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=p),p=!0;if(!p)return a.flags&256?(gn(a),a):(gn(a),null)}return gn(a),(a.flags&128)!==0?(a.lanes=o,a):(o=c!==null,n=n!==null&&n.memoizedState!==null,o&&(c=a.child,p=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(p=c.alternate.memoizedState.cachePool.pool),x=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(x=c.memoizedState.cachePool.pool),x!==p&&(c.flags|=2048)),o!==n&&o&&(a.child.flags|=8192),yu(a,a.updateQueue),nt(a),null);case 4:return he(),n===null&&Em(a.stateNode.containerInfo),nt(a),null;case 10:return Es(a.type),nt(a),null;case 19:if(Q(ht),c=a.memoizedState,c===null)return nt(a),null;if(p=(a.flags&128)!==0,x=c.rendering,x===null)if(p)nl(c,!1);else{if(ct!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(x=ru(n),x!==null){for(a.flags|=128,nl(c,!1),n=x.updateQueue,a.updateQueue=n,yu(a,n),a.subtreeFlags=0,n=o,o=a.child;o!==null;)tx(o,n),o=o.sibling;return ee(ht,ht.current&1|2),$e&&Ns(a,c.treeForkCount),a.child}n=n.sibling}c.tail!==null&&Me()>Nu&&(a.flags|=128,p=!0,nl(c,!1),a.lanes=4194304)}else{if(!p)if(n=ru(x),n!==null){if(a.flags|=128,p=!0,n=n.updateQueue,a.updateQueue=n,yu(a,n),nl(c,!0),c.tail===null&&c.tailMode==="hidden"&&!x.alternate&&!$e)return nt(a),null}else 2*Me()-c.renderingStartTime>Nu&&o!==536870912&&(a.flags|=128,p=!0,nl(c,!1),a.lanes=4194304);c.isBackwards?(x.sibling=a.child,a.child=x):(n=c.last,n!==null?n.sibling=x:a.child=x,c.last=x)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=Me(),n.sibling=null,o=ht.current,ee(ht,p?o&1|2:o&1),$e&&Ns(a,c.treeForkCount),n):(nt(a),null);case 22:case 23:return gn(a),Ch(),c=a.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(o&536870912)!==0&&(a.flags&128)===0&&(nt(a),a.subtreeFlags&6&&(a.flags|=8192)):nt(a),o=a.updateQueue,o!==null&&yu(a,o.retryQueue),o=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==o&&(a.flags|=2048),n!==null&&Q(xr),null;case 24:return o=null,n!==null&&(o=n.memoizedState.cache),a.memoizedState.cache!==o&&(a.flags|=2048),Es(gt),nt(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function Y2(n,a){switch(dh(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Es(gt),he(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return Se(a),null;case 31:if(a.memoizedState!==null){if(gn(a),a.alternate===null)throw Error(r(340));mr()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(gn(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(r(340));mr()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return Q(ht),null;case 4:return he(),null;case 10:return Es(a.type),null;case 22:case 23:return gn(a),Ch(),n!==null&&Q(xr),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Es(gt),null;case 25:return null;default:return null}}function Ry(n,a){switch(dh(a),a.tag){case 3:Es(gt),he();break;case 26:case 27:case 5:Se(a);break;case 4:he();break;case 31:a.memoizedState!==null&&gn(a);break;case 13:gn(a);break;case 19:Q(ht);break;case 10:Es(a.type);break;case 22:case 23:gn(a),Ch(),n!==null&&Q(xr);break;case 24:Es(gt)}}function sl(n,a){try{var o=a.updateQueue,c=o!==null?o.lastEffect:null;if(c!==null){var p=c.next;o=p;do{if((o.tag&n)===n){c=void 0;var x=o.create,E=o.inst;c=x(),E.destroy=c}o=o.next}while(o!==p)}}catch(k){Xe(a,a.return,k)}}function ma(n,a,o){try{var c=a.updateQueue,p=c!==null?c.lastEffect:null;if(p!==null){var x=p.next;c=x;do{if((c.tag&n)===n){var E=c.inst,k=E.destroy;if(k!==void 0){E.destroy=void 0,p=a;var F=o,te=k;try{te()}catch(re){Xe(p,F,re)}}}c=c.next}while(c!==x)}}catch(re){Xe(a,a.return,re)}}function Ty(n){var a=n.updateQueue;if(a!==null){var o=n.stateNode;try{vx(a,o)}catch(c){Xe(n,n.return,c)}}}function Ay(n,a,o){o.props=wr(n.type,n.memoizedProps),o.state=n.memoizedState;try{o.componentWillUnmount()}catch(c){Xe(n,a,c)}}function al(n,a){try{var o=n.ref;if(o!==null){switch(n.tag){case 26:case 27:case 5:var c=n.stateNode;break;case 30:c=n.stateNode;break;default:c=n.stateNode}typeof o=="function"?n.refCleanup=o(c):o.current=c}}catch(p){Xe(n,a,p)}}function ts(n,a){var o=n.ref,c=n.refCleanup;if(o!==null)if(typeof c=="function")try{c()}catch(p){Xe(n,a,p)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(p){Xe(n,a,p)}else o.current=null}function My(n){var a=n.type,o=n.memoizedProps,c=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":o.autoFocus&&c.focus();break e;case"img":o.src?c.src=o.src:o.srcSet&&(c.srcset=o.srcSet)}}catch(p){Xe(n,n.return,p)}}function am(n,a,o){try{var c=n.stateNode;mC(c,n.type,o,a),c[It]=a}catch(p){Xe(n,n.return,p)}}function ky(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Sa(n.type)||n.tag===4}function rm(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||ky(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Sa(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function im(n,a,o){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(n,a):(a=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,a.appendChild(n),o=o._reactRootContainer,o!=null||a.onclick!==null||(a.onclick=bs));else if(c!==4&&(c===27&&Sa(n.type)&&(o=n.stateNode,a=null),n=n.child,n!==null))for(im(n,a,o),n=n.sibling;n!==null;)im(n,a,o),n=n.sibling}function vu(n,a,o){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?o.insertBefore(n,a):o.appendChild(n);else if(c!==4&&(c===27&&Sa(n.type)&&(o=n.stateNode),n=n.child,n!==null))for(vu(n,a,o),n=n.sibling;n!==null;)vu(n,a,o),n=n.sibling}function Oy(n){var a=n.stateNode,o=n.memoizedProps;try{for(var c=n.type,p=a.attributes;p.length;)a.removeAttributeNode(p[0]);zt(a,c,o),a[wt]=n,a[It]=o}catch(x){Xe(n,n.return,x)}}var As=!1,vt=!1,om=!1,Dy=typeof WeakSet=="function"?WeakSet:Set,_t=null;function Q2(n,a){if(n=n.containerInfo,Rm=Hu,n=Y0(n),eh(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var c=o.getSelection&&o.getSelection();if(c&&c.rangeCount!==0){o=c.anchorNode;var p=c.anchorOffset,x=c.focusNode;c=c.focusOffset;try{o.nodeType,x.nodeType}catch{o=null;break e}var E=0,k=-1,F=-1,te=0,re=0,le=n,ne=null;t:for(;;){for(var ae;le!==o||p!==0&&le.nodeType!==3||(k=E+p),le!==x||c!==0&&le.nodeType!==3||(F=E+c),le.nodeType===3&&(E+=le.nodeValue.length),(ae=le.firstChild)!==null;)ne=le,le=ae;for(;;){if(le===n)break t;if(ne===o&&++te===p&&(k=E),ne===x&&++re===c&&(F=E),(ae=le.nextSibling)!==null)break;le=ne,ne=le.parentNode}le=ae}o=k===-1||F===-1?null:{start:k,end:F}}else o=null}o=o||{start:0,end:0}}else o=null;for(Tm={focusedElem:n,selectionRange:o},Hu=!1,_t=a;_t!==null;)if(a=_t,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,_t=n;else for(;_t!==null;){switch(a=_t,x=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(o=0;o<n.length;o++)p=n[o],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&x!==null){n=void 0,o=a,p=x.memoizedProps,x=x.memoizedState,c=o.stateNode;try{var pe=wr(o.type,p);n=c.getSnapshotBeforeUpdate(pe,x),c.__reactInternalSnapshotBeforeUpdate=n}catch(_e){Xe(o,o.return,_e)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,o=n.nodeType,o===9)km(n);else if(o===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":km(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(r(163))}if(n=a.sibling,n!==null){n.return=a.return,_t=n;break}_t=a.return}}function Ly(n,a,o){var c=o.flags;switch(o.tag){case 0:case 11:case 15:ks(n,o),c&4&&sl(5,o);break;case 1:if(ks(n,o),c&4)if(n=o.stateNode,a===null)try{n.componentDidMount()}catch(E){Xe(o,o.return,E)}else{var p=wr(o.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(p,a,n.__reactInternalSnapshotBeforeUpdate)}catch(E){Xe(o,o.return,E)}}c&64&&Ty(o),c&512&&al(o,o.return);break;case 3:if(ks(n,o),c&64&&(n=o.updateQueue,n!==null)){if(a=null,o.child!==null)switch(o.child.tag){case 27:case 5:a=o.child.stateNode;break;case 1:a=o.child.stateNode}try{vx(n,a)}catch(E){Xe(o,o.return,E)}}break;case 27:a===null&&c&4&&Oy(o);case 26:case 5:ks(n,o),a===null&&c&4&&My(o),c&512&&al(o,o.return);break;case 12:ks(n,o);break;case 31:ks(n,o),c&4&&Iy(n,o);break;case 13:ks(n,o),c&4&&By(n,o),c&64&&(n=o.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(o=nC.bind(null,o),wC(n,o))));break;case 22:if(c=o.memoizedState!==null||As,!c){a=a!==null&&a.memoizedState!==null||vt,p=As;var x=vt;As=c,(vt=a)&&!x?Os(n,o,(o.subtreeFlags&8772)!==0):ks(n,o),As=p,vt=x}break;case 30:break;default:ks(n,o)}}function zy(n){var a=n.alternate;a!==null&&(n.alternate=null,zy(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&Ao(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var st=null,en=!1;function Ms(n,a,o){for(o=o.child;o!==null;)Py(n,a,o),o=o.sibling}function Py(n,a,o){if($t&&typeof $t.onCommitFiberUnmount=="function")try{$t.onCommitFiberUnmount(sr,o)}catch{}switch(o.tag){case 26:vt||ts(o,a),Ms(n,a,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:vt||ts(o,a);var c=st,p=en;Sa(o.type)&&(st=o.stateNode,en=!1),Ms(n,a,o),hl(o.stateNode),st=c,en=p;break;case 5:vt||ts(o,a);case 6:if(c=st,p=en,st=null,Ms(n,a,o),st=c,en=p,st!==null)if(en)try{(st.nodeType===9?st.body:st.nodeName==="HTML"?st.ownerDocument.body:st).removeChild(o.stateNode)}catch(x){Xe(o,a,x)}else try{st.removeChild(o.stateNode)}catch(x){Xe(o,a,x)}break;case 18:st!==null&&(en?(n=st,Tv(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,o.stateNode),Vi(n)):Tv(st,o.stateNode));break;case 4:c=st,p=en,st=o.stateNode.containerInfo,en=!0,Ms(n,a,o),st=c,en=p;break;case 0:case 11:case 14:case 15:ma(2,o,a),vt||ma(4,o,a),Ms(n,a,o);break;case 1:vt||(ts(o,a),c=o.stateNode,typeof c.componentWillUnmount=="function"&&Ay(o,a,c)),Ms(n,a,o);break;case 21:Ms(n,a,o);break;case 22:vt=(c=vt)||o.memoizedState!==null,Ms(n,a,o),vt=c;break;default:Ms(n,a,o)}}function Iy(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Vi(n)}catch(o){Xe(a,a.return,o)}}}function By(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Vi(n)}catch(o){Xe(a,a.return,o)}}function K2(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new Dy),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new Dy),a;default:throw Error(r(435,n.tag))}}function bu(n,a){var o=K2(n);a.forEach(function(c){if(!o.has(c)){o.add(c);var p=sC.bind(null,n,c);c.then(p,p)}})}function tn(n,a){var o=a.deletions;if(o!==null)for(var c=0;c<o.length;c++){var p=o[c],x=n,E=a,k=E;e:for(;k!==null;){switch(k.tag){case 27:if(Sa(k.type)){st=k.stateNode,en=!1;break e}break;case 5:st=k.stateNode,en=!1;break e;case 3:case 4:st=k.stateNode.containerInfo,en=!0;break e}k=k.return}if(st===null)throw Error(r(160));Py(x,E,p),st=null,en=!1,x=p.alternate,x!==null&&(x.return=null),p.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Hy(a,n),a=a.sibling}var In=null;function Hy(n,a){var o=n.alternate,c=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:tn(a,n),nn(n),c&4&&(ma(3,n,n.return),sl(3,n),ma(5,n,n.return));break;case 1:tn(a,n),nn(n),c&512&&(vt||o===null||ts(o,o.return)),c&64&&As&&(n=n.updateQueue,n!==null&&(c=n.callbacks,c!==null&&(o=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=o===null?c:o.concat(c))));break;case 26:var p=In;if(tn(a,n),nn(n),c&512&&(vt||o===null||ts(o,o.return)),c&4){var x=o!==null?o.memoizedState:null;if(c=n.memoizedState,o===null)if(c===null)if(n.stateNode===null){e:{c=n.type,o=n.memoizedProps,p=p.ownerDocument||p;t:switch(c){case"title":x=p.getElementsByTagName("title")[0],(!x||x[ir]||x[wt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=p.createElement(c),p.head.insertBefore(x,p.querySelector("head > title"))),zt(x,c,o),x[wt]=n,pt(x),c=x;break e;case"link":var E=Hv("link","href",p).get(c+(o.href||""));if(E){for(var k=0;k<E.length;k++)if(x=E[k],x.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&x.getAttribute("rel")===(o.rel==null?null:o.rel)&&x.getAttribute("title")===(o.title==null?null:o.title)&&x.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){E.splice(k,1);break t}}x=p.createElement(c),zt(x,c,o),p.head.appendChild(x);break;case"meta":if(E=Hv("meta","content",p).get(c+(o.content||""))){for(k=0;k<E.length;k++)if(x=E[k],x.getAttribute("content")===(o.content==null?null:""+o.content)&&x.getAttribute("name")===(o.name==null?null:o.name)&&x.getAttribute("property")===(o.property==null?null:o.property)&&x.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&x.getAttribute("charset")===(o.charSet==null?null:o.charSet)){E.splice(k,1);break t}}x=p.createElement(c),zt(x,c,o),p.head.appendChild(x);break;default:throw Error(r(468,c))}x[wt]=n,pt(x),c=x}n.stateNode=c}else Uv(p,n.type,n.stateNode);else n.stateNode=Bv(p,c,n.memoizedProps);else x!==c?(x===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):x.count--,c===null?Uv(p,n.type,n.stateNode):Bv(p,c,n.memoizedProps)):c===null&&n.stateNode!==null&&am(n,n.memoizedProps,o.memoizedProps)}break;case 27:tn(a,n),nn(n),c&512&&(vt||o===null||ts(o,o.return)),o!==null&&c&4&&am(n,n.memoizedProps,o.memoizedProps);break;case 5:if(tn(a,n),nn(n),c&512&&(vt||o===null||ts(o,o.return)),n.flags&32){p=n.stateNode;try{hi(p,"")}catch(pe){Xe(n,n.return,pe)}}c&4&&n.stateNode!=null&&(p=n.memoizedProps,am(n,p,o!==null?o.memoizedProps:p)),c&1024&&(om=!0);break;case 6:if(tn(a,n),nn(n),c&4){if(n.stateNode===null)throw Error(r(162));c=n.memoizedProps,o=n.stateNode;try{o.nodeValue=c}catch(pe){Xe(n,n.return,pe)}}break;case 3:if(zu=null,p=In,In=Du(a.containerInfo),tn(a,n),In=p,nn(n),c&4&&o!==null&&o.memoizedState.isDehydrated)try{Vi(a.containerInfo)}catch(pe){Xe(n,n.return,pe)}om&&(om=!1,Uy(n));break;case 4:c=In,In=Du(n.stateNode.containerInfo),tn(a,n),nn(n),In=c;break;case 12:tn(a,n),nn(n);break;case 31:tn(a,n),nn(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,bu(n,c)));break;case 13:tn(a,n),nn(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(wu=Me()),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,bu(n,c)));break;case 22:p=n.memoizedState!==null;var F=o!==null&&o.memoizedState!==null,te=As,re=vt;if(As=te||p,vt=re||F,tn(a,n),vt=re,As=te,nn(n),c&8192)e:for(a=n.stateNode,a._visibility=p?a._visibility&-2:a._visibility|1,p&&(o===null||F||As||vt||Nr(n)),o=null,a=n;;){if(a.tag===5||a.tag===26){if(o===null){F=o=a;try{if(x=F.stateNode,p)E=x.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{k=F.stateNode;var le=F.memoizedProps.style,ne=le!=null&&le.hasOwnProperty("display")?le.display:null;k.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(pe){Xe(F,F.return,pe)}}}else if(a.tag===6){if(o===null){F=a;try{F.stateNode.nodeValue=p?"":F.memoizedProps}catch(pe){Xe(F,F.return,pe)}}}else if(a.tag===18){if(o===null){F=a;try{var ae=F.stateNode;p?Av(ae,!0):Av(F.stateNode,!1)}catch(pe){Xe(F,F.return,pe)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;o===a&&(o=null),a=a.return}o===a&&(o=null),a.sibling.return=a.return,a=a.sibling}c&4&&(c=n.updateQueue,c!==null&&(o=c.retryQueue,o!==null&&(c.retryQueue=null,bu(n,o))));break;case 19:tn(a,n),nn(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,bu(n,c)));break;case 30:break;case 21:break;default:tn(a,n),nn(n)}}function nn(n){var a=n.flags;if(a&2){try{for(var o,c=n.return;c!==null;){if(ky(c)){o=c;break}c=c.return}if(o==null)throw Error(r(160));switch(o.tag){case 27:var p=o.stateNode,x=rm(n);vu(n,x,p);break;case 5:var E=o.stateNode;o.flags&32&&(hi(E,""),o.flags&=-33);var k=rm(n);vu(n,k,E);break;case 3:case 4:var F=o.stateNode.containerInfo,te=rm(n);im(n,te,F);break;default:throw Error(r(161))}}catch(re){Xe(n,n.return,re)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function Uy(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;Uy(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function ks(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Ly(n,a.alternate,a),a=a.sibling}function Nr(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:ma(4,a,a.return),Nr(a);break;case 1:ts(a,a.return);var o=a.stateNode;typeof o.componentWillUnmount=="function"&&Ay(a,a.return,o),Nr(a);break;case 27:hl(a.stateNode);case 26:case 5:ts(a,a.return),Nr(a);break;case 22:a.memoizedState===null&&Nr(a);break;case 30:Nr(a);break;default:Nr(a)}n=n.sibling}}function Os(n,a,o){for(o=o&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var c=a.alternate,p=n,x=a,E=x.flags;switch(x.tag){case 0:case 11:case 15:Os(p,x,o),sl(4,x);break;case 1:if(Os(p,x,o),c=x,p=c.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(te){Xe(c,c.return,te)}if(c=x,p=c.updateQueue,p!==null){var k=c.stateNode;try{var F=p.shared.hiddenCallbacks;if(F!==null)for(p.shared.hiddenCallbacks=null,p=0;p<F.length;p++)yx(F[p],k)}catch(te){Xe(c,c.return,te)}}o&&E&64&&Ty(x),al(x,x.return);break;case 27:Oy(x);case 26:case 5:Os(p,x,o),o&&c===null&&E&4&&My(x),al(x,x.return);break;case 12:Os(p,x,o);break;case 31:Os(p,x,o),o&&E&4&&Iy(p,x);break;case 13:Os(p,x,o),o&&E&4&&By(p,x);break;case 22:x.memoizedState===null&&Os(p,x,o),al(x,x.return);break;case 30:break;default:Os(p,x,o)}a=a.sibling}}function lm(n,a){var o=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==o&&(n!=null&&n.refCount++,o!=null&&Vo(o))}function cm(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Vo(n))}function Bn(n,a,o,c){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)$y(n,a,o,c),a=a.sibling}function $y(n,a,o,c){var p=a.flags;switch(a.tag){case 0:case 11:case 15:Bn(n,a,o,c),p&2048&&sl(9,a);break;case 1:Bn(n,a,o,c);break;case 3:Bn(n,a,o,c),p&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&Vo(n)));break;case 12:if(p&2048){Bn(n,a,o,c),n=a.stateNode;try{var x=a.memoizedProps,E=x.id,k=x.onPostCommit;typeof k=="function"&&k(E,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(F){Xe(a,a.return,F)}}else Bn(n,a,o,c);break;case 31:Bn(n,a,o,c);break;case 13:Bn(n,a,o,c);break;case 23:break;case 22:x=a.stateNode,E=a.alternate,a.memoizedState!==null?x._visibility&2?Bn(n,a,o,c):rl(n,a):x._visibility&2?Bn(n,a,o,c):(x._visibility|=2,Oi(n,a,o,c,(a.subtreeFlags&10256)!==0||!1)),p&2048&&lm(E,a);break;case 24:Bn(n,a,o,c),p&2048&&cm(a.alternate,a);break;default:Bn(n,a,o,c)}}function Oi(n,a,o,c,p){for(p=p&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=n,E=a,k=o,F=c,te=E.flags;switch(E.tag){case 0:case 11:case 15:Oi(x,E,k,F,p),sl(8,E);break;case 23:break;case 22:var re=E.stateNode;E.memoizedState!==null?re._visibility&2?Oi(x,E,k,F,p):rl(x,E):(re._visibility|=2,Oi(x,E,k,F,p)),p&&te&2048&&lm(E.alternate,E);break;case 24:Oi(x,E,k,F,p),p&&te&2048&&cm(E.alternate,E);break;default:Oi(x,E,k,F,p)}a=a.sibling}}function rl(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var o=n,c=a,p=c.flags;switch(c.tag){case 22:rl(o,c),p&2048&&lm(c.alternate,c);break;case 24:rl(o,c),p&2048&&cm(c.alternate,c);break;default:rl(o,c)}a=a.sibling}}var il=8192;function Di(n,a,o){if(n.subtreeFlags&il)for(n=n.child;n!==null;)qy(n,a,o),n=n.sibling}function qy(n,a,o){switch(n.tag){case 26:Di(n,a,o),n.flags&il&&n.memoizedState!==null&&DC(o,In,n.memoizedState,n.memoizedProps);break;case 5:Di(n,a,o);break;case 3:case 4:var c=In;In=Du(n.stateNode.containerInfo),Di(n,a,o),In=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=il,il=16777216,Di(n,a,o),il=c):Di(n,a,o));break;default:Di(n,a,o)}}function Vy(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function ol(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var o=0;o<a.length;o++){var c=a[o];_t=c,Yy(c,n)}Vy(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Gy(n),n=n.sibling}function Gy(n){switch(n.tag){case 0:case 11:case 15:ol(n),n.flags&2048&&ma(9,n,n.return);break;case 3:ol(n);break;case 12:ol(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,Su(n)):ol(n);break;default:ol(n)}}function Su(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var o=0;o<a.length;o++){var c=a[o];_t=c,Yy(c,n)}Vy(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:ma(8,a,a.return),Su(a);break;case 22:o=a.stateNode,o._visibility&2&&(o._visibility&=-3,Su(a));break;default:Su(a)}n=n.sibling}}function Yy(n,a){for(;_t!==null;){var o=_t;switch(o.tag){case 0:case 11:case 15:ma(8,o,a);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var c=o.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:Vo(o.memoizedState.cache)}if(c=o.child,c!==null)c.return=o,_t=c;else e:for(o=n;_t!==null;){c=_t;var p=c.sibling,x=c.return;if(zy(c),c===o){_t=null;break e}if(p!==null){p.return=x,_t=p;break e}_t=x}}}var F2={getCacheForType:function(n){var a=Dt(gt),o=a.data.get(n);return o===void 0&&(o=n(),a.data.set(n,o)),o},cacheSignal:function(){return Dt(gt).controller.signal}},X2=typeof WeakMap=="function"?WeakMap:Map,Qe=0,et=null,Pe=null,He=0,Fe=0,xn=null,pa=!1,Li=!1,um=!1,Ds=0,ct=0,ga=0,jr=0,dm=0,yn=0,zi=0,ll=null,sn=null,fm=!1,wu=0,Qy=0,Nu=1/0,ju=null,xa=null,Nt=0,ya=null,Pi=null,Ls=0,hm=0,mm=null,Ky=null,cl=0,pm=null;function vn(){return(Qe&2)!==0&&He!==0?He&-He:A.T!==null?Sm():Rc()}function Fy(){if(yn===0)if((He&536870912)===0||$e){var n=oi;oi<<=1,(oi&3932160)===0&&(oi=262144),yn=n}else yn=536870912;return n=pn.current,n!==null&&(n.flags|=32),yn}function an(n,a,o){(n===et&&(Fe===2||Fe===9)||n.cancelPendingCommit!==null)&&(Ii(n,0),va(n,He,yn,!1)),rr(n,o),((Qe&2)===0||n!==et)&&(n===et&&((Qe&2)===0&&(jr|=o),ct===4&&va(n,He,yn,!1)),ns(n))}function Xy(n,a,o){if((Qe&6)!==0)throw Error(r(327));var c=!o&&(a&127)===0&&(a&n.expiredLanes)===0||ar(n,a),p=c?J2(n,a):xm(n,a,!0),x=c;do{if(p===0){Li&&!c&&va(n,a,0,!1);break}else{if(o=n.current.alternate,x&&!Z2(o)){p=xm(n,a,!1),x=!1;continue}if(p===2){if(x=a,n.errorRecoveryDisabledLanes&x)var E=0;else E=n.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){a=E;e:{var k=n;p=ll;var F=k.current.memoizedState.isDehydrated;if(F&&(Ii(k,E).flags|=256),E=xm(k,E,!1),E!==2){if(um&&!F){k.errorRecoveryDisabledLanes|=x,jr|=x,p=4;break e}x=sn,sn=p,x!==null&&(sn===null?sn=x:sn.push.apply(sn,x))}p=E}if(x=!1,p!==2)continue}}if(p===1){Ii(n,0),va(n,a,0,!0);break}e:{switch(c=n,x=p,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:va(c,a,yn,!pa);break e;case 2:sn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(p=wu+300-Me(),10<p)){if(va(c,a,yn,!pa),ci(c,0,!0)!==0)break e;Ls=a,c.timeoutHandle=_v(Zy.bind(null,c,o,sn,ju,fm,a,yn,jr,zi,pa,x,"Throttled",-0,0),p);break e}Zy(c,o,sn,ju,fm,a,yn,jr,zi,pa,x,null,-0,0)}}break}while(!0);ns(n)}function Zy(n,a,o,c,p,x,E,k,F,te,re,le,ne,ae){if(n.timeoutHandle=-1,le=a.subtreeFlags,le&8192||(le&16785408)===16785408){le={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:bs},qy(a,x,le);var pe=(x&62914560)===x?wu-Me():(x&4194048)===x?Qy-Me():0;if(pe=LC(le,pe),pe!==null){Ls=x,n.cancelPendingCommit=pe(rv.bind(null,n,a,x,o,c,p,E,k,F,re,le,null,ne,ae)),va(n,x,E,!te);return}}rv(n,a,x,o,c,p,E,k,F)}function Z2(n){for(var a=n;;){var o=a.tag;if((o===0||o===11||o===15)&&a.flags&16384&&(o=a.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var c=0;c<o.length;c++){var p=o[c],x=p.getSnapshot;p=p.value;try{if(!hn(x(),p))return!1}catch{return!1}}if(o=a.child,a.subtreeFlags&16384&&o!==null)o.return=a,a=o;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function va(n,a,o,c){a&=~dm,a&=~jr,n.suspendedLanes|=a,n.pingedLanes&=~a,c&&(n.warmLanes|=a),c=n.expirationTimes;for(var p=a;0<p;){var x=31-qt(p),E=1<<x;c[x]=-1,p&=~E}o!==0&&Ec(n,o,a)}function Eu(){return(Qe&6)===0?(ul(0),!1):!0}function gm(){if(Pe!==null){if(Fe===0)var n=Pe.return;else n=Pe,js=pr=null,kh(n),Ri=null,Yo=0,n=Pe;for(;n!==null;)Ry(n.alternate,n),n=n.return;Pe=null}}function Ii(n,a){var o=n.timeoutHandle;o!==-1&&(n.timeoutHandle=-1,xC(o)),o=n.cancelPendingCommit,o!==null&&(n.cancelPendingCommit=null,o()),Ls=0,gm(),et=n,Pe=o=ws(n.current,null),He=a,Fe=0,xn=null,pa=!1,Li=ar(n,a),um=!1,zi=yn=dm=jr=ga=ct=0,sn=ll=null,fm=!1,(a&8)!==0&&(a|=a&32);var c=n.entangledLanes;if(c!==0)for(n=n.entanglements,c&=a;0<c;){var p=31-qt(c),x=1<<p;a|=n[p],c&=~x}return Ds=a,Yc(),o}function Wy(n,a){Oe=null,A.H=el,a===_i||a===eu?(a=mx(),Fe=3):a===bh?(a=mx(),Fe=4):Fe=a===Kh?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,xn=a,Pe===null&&(ct=1,mu(n,Cn(a,n.current)))}function Jy(){var n=pn.current;return n===null?!0:(He&4194048)===He?An===null:(He&62914560)===He||(He&536870912)!==0?n===An:!1}function ev(){var n=A.H;return A.H=el,n===null?el:n}function tv(){var n=A.A;return A.A=F2,n}function Cu(){ct=4,pa||(He&4194048)!==He&&pn.current!==null||(Li=!0),(ga&134217727)===0&&(jr&134217727)===0||et===null||va(et,He,yn,!1)}function xm(n,a,o){var c=Qe;Qe|=2;var p=ev(),x=tv();(et!==n||He!==a)&&(ju=null,Ii(n,a)),a=!1;var E=ct;e:do try{if(Fe!==0&&Pe!==null){var k=Pe,F=xn;switch(Fe){case 8:gm(),E=6;break e;case 3:case 2:case 9:case 6:pn.current===null&&(a=!0);var te=Fe;if(Fe=0,xn=null,Bi(n,k,F,te),o&&Li){E=0;break e}break;default:te=Fe,Fe=0,xn=null,Bi(n,k,F,te)}}W2(),E=ct;break}catch(re){Wy(n,re)}while(!0);return a&&n.shellSuspendCounter++,js=pr=null,Qe=c,A.H=p,A.A=x,Pe===null&&(et=null,He=0,Yc()),E}function W2(){for(;Pe!==null;)nv(Pe)}function J2(n,a){var o=Qe;Qe|=2;var c=ev(),p=tv();et!==n||He!==a?(ju=null,Nu=Me()+500,Ii(n,a)):Li=ar(n,a);e:do try{if(Fe!==0&&Pe!==null){a=Pe;var x=xn;t:switch(Fe){case 1:Fe=0,xn=null,Bi(n,a,x,1);break;case 2:case 9:if(fx(x)){Fe=0,xn=null,sv(a);break}a=function(){Fe!==2&&Fe!==9||et!==n||(Fe=7),ns(n)},x.then(a,a);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:fx(x)?(Fe=0,xn=null,sv(a)):(Fe=0,xn=null,Bi(n,a,x,7));break;case 5:var E=null;switch(Pe.tag){case 26:E=Pe.memoizedState;case 5:case 27:var k=Pe;if(E?$v(E):k.stateNode.complete){Fe=0,xn=null;var F=k.sibling;if(F!==null)Pe=F;else{var te=k.return;te!==null?(Pe=te,_u(te)):Pe=null}break t}}Fe=0,xn=null,Bi(n,a,x,5);break;case 6:Fe=0,xn=null,Bi(n,a,x,6);break;case 8:gm(),ct=6;break e;default:throw Error(r(462))}}eC();break}catch(re){Wy(n,re)}while(!0);return js=pr=null,A.H=c,A.A=p,Qe=o,Pe!==null?0:(et=null,He=0,Yc(),ct)}function eC(){for(;Pe!==null&&!ps();)nv(Pe)}function nv(n){var a=Cy(n.alternate,n,Ds);n.memoizedProps=n.pendingProps,a===null?_u(n):Pe=a}function sv(n){var a=n,o=a.alternate;switch(a.tag){case 15:case 0:a=by(o,a,a.pendingProps,a.type,void 0,He);break;case 11:a=by(o,a,a.pendingProps,a.type.render,a.ref,He);break;case 5:kh(a);default:Ry(o,a),a=Pe=tx(a,Ds),a=Cy(o,a,Ds)}n.memoizedProps=n.pendingProps,a===null?_u(n):Pe=a}function Bi(n,a,o,c){js=pr=null,kh(a),Ri=null,Yo=0;var p=a.return;try{if($2(n,p,a,o,He)){ct=1,mu(n,Cn(o,n.current)),Pe=null;return}}catch(x){if(p!==null)throw Pe=p,x;ct=1,mu(n,Cn(o,n.current)),Pe=null;return}a.flags&32768?($e||c===1?n=!0:Li||(He&536870912)!==0?n=!1:(pa=n=!0,(c===2||c===9||c===3||c===6)&&(c=pn.current,c!==null&&c.tag===13&&(c.flags|=16384))),av(a,n)):_u(a)}function _u(n){var a=n;do{if((a.flags&32768)!==0){av(a,pa);return}n=a.return;var o=G2(a.alternate,a,Ds);if(o!==null){Pe=o;return}if(a=a.sibling,a!==null){Pe=a;return}Pe=a=n}while(a!==null);ct===0&&(ct=5)}function av(n,a){do{var o=Y2(n.alternate,n);if(o!==null){o.flags&=32767,Pe=o;return}if(o=n.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!a&&(n=n.sibling,n!==null)){Pe=n;return}Pe=n=o}while(n!==null);ct=6,Pe=null}function rv(n,a,o,c,p,x,E,k,F){n.cancelPendingCommit=null;do Ru();while(Nt!==0);if((Qe&6)!==0)throw Error(r(327));if(a!==null){if(a===n.current)throw Error(r(177));if(x=a.lanes|a.childLanes,x|=rh,Lf(n,o,x,E,k,F),n===et&&(Pe=et=null,He=0),Pi=a,ya=n,Ls=o,hm=x,mm=p,Ky=c,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,aC(nr,function(){return uv(),null})):(n.callbackNode=null,n.callbackPriority=0),c=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||c){c=A.T,A.T=null,p=$.p,$.p=2,E=Qe,Qe|=4;try{Q2(n,a,o)}finally{Qe=E,$.p=p,A.T=c}}Nt=1,iv(),ov(),lv()}}function iv(){if(Nt===1){Nt=0;var n=ya,a=Pi,o=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||o){o=A.T,A.T=null;var c=$.p;$.p=2;var p=Qe;Qe|=4;try{Hy(a,n);var x=Tm,E=Y0(n.containerInfo),k=x.focusedElem,F=x.selectionRange;if(E!==k&&k&&k.ownerDocument&&G0(k.ownerDocument.documentElement,k)){if(F!==null&&eh(k)){var te=F.start,re=F.end;if(re===void 0&&(re=te),"selectionStart"in k)k.selectionStart=te,k.selectionEnd=Math.min(re,k.value.length);else{var le=k.ownerDocument||document,ne=le&&le.defaultView||window;if(ne.getSelection){var ae=ne.getSelection(),pe=k.textContent.length,_e=Math.min(F.start,pe),Je=F.end===void 0?_e:Math.min(F.end,pe);!ae.extend&&_e>Je&&(E=Je,Je=_e,_e=E);var W=V0(k,_e),Z=V0(k,Je);if(W&&Z&&(ae.rangeCount!==1||ae.anchorNode!==W.node||ae.anchorOffset!==W.offset||ae.focusNode!==Z.node||ae.focusOffset!==Z.offset)){var J=le.createRange();J.setStart(W.node,W.offset),ae.removeAllRanges(),_e>Je?(ae.addRange(J),ae.extend(Z.node,Z.offset)):(J.setEnd(Z.node,Z.offset),ae.addRange(J))}}}}for(le=[],ae=k;ae=ae.parentNode;)ae.nodeType===1&&le.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof k.focus=="function"&&k.focus(),k=0;k<le.length;k++){var ie=le[k];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}Hu=!!Rm,Tm=Rm=null}finally{Qe=p,$.p=c,A.T=o}}n.current=a,Nt=2}}function ov(){if(Nt===2){Nt=0;var n=ya,a=Pi,o=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||o){o=A.T,A.T=null;var c=$.p;$.p=2;var p=Qe;Qe|=4;try{Ly(n,a.alternate,a)}finally{Qe=p,$.p=c,A.T=o}}Nt=3}}function lv(){if(Nt===4||Nt===3){Nt=0,Fn();var n=ya,a=Pi,o=Ls,c=Ky;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Nt=5:(Nt=0,Pi=ya=null,cv(n,n.pendingLanes));var p=n.pendingLanes;if(p===0&&(xa=null),To(o),a=a.stateNode,$t&&typeof $t.onCommitFiberRoot=="function")try{$t.onCommitFiberRoot(sr,a,void 0,(a.current.flags&128)===128)}catch{}if(c!==null){a=A.T,p=$.p,$.p=2,A.T=null;try{for(var x=n.onRecoverableError,E=0;E<c.length;E++){var k=c[E];x(k.value,{componentStack:k.stack})}}finally{A.T=a,$.p=p}}(Ls&3)!==0&&Ru(),ns(n),p=n.pendingLanes,(o&261930)!==0&&(p&42)!==0?n===pm?cl++:(cl=0,pm=n):cl=0,ul(0)}}function cv(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,Vo(a)))}function Ru(){return iv(),ov(),lv(),uv()}function uv(){if(Nt!==5)return!1;var n=ya,a=hm;hm=0;var o=To(Ls),c=A.T,p=$.p;try{$.p=32>o?32:o,A.T=null,o=mm,mm=null;var x=ya,E=Ls;if(Nt=0,Pi=ya=null,Ls=0,(Qe&6)!==0)throw Error(r(331));var k=Qe;if(Qe|=4,Gy(x.current),$y(x,x.current,E,o),Qe=k,ul(0,!1),$t&&typeof $t.onPostCommitFiberRoot=="function")try{$t.onPostCommitFiberRoot(sr,x)}catch{}return!0}finally{$.p=p,A.T=c,cv(n,a)}}function dv(n,a,o){a=Cn(o,a),a=Qh(n.stateNode,a,2),n=da(n,a,2),n!==null&&(rr(n,2),ns(n))}function Xe(n,a,o){if(n.tag===3)dv(n,n,o);else for(;a!==null;){if(a.tag===3){dv(a,n,o);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(xa===null||!xa.has(c))){n=Cn(o,n),o=fy(2),c=da(a,o,2),c!==null&&(hy(o,c,a,n),rr(c,2),ns(c));break}}a=a.return}}function ym(n,a,o){var c=n.pingCache;if(c===null){c=n.pingCache=new X2;var p=new Set;c.set(a,p)}else p=c.get(a),p===void 0&&(p=new Set,c.set(a,p));p.has(o)||(um=!0,p.add(o),n=tC.bind(null,n,a,o),a.then(n,n))}function tC(n,a,o){var c=n.pingCache;c!==null&&c.delete(a),n.pingedLanes|=n.suspendedLanes&o,n.warmLanes&=~o,et===n&&(He&o)===o&&(ct===4||ct===3&&(He&62914560)===He&&300>Me()-wu?(Qe&2)===0&&Ii(n,0):dm|=o,zi===He&&(zi=0)),ns(n)}function fv(n,a){a===0&&(a=jc()),n=fr(n,a),n!==null&&(rr(n,a),ns(n))}function nC(n){var a=n.memoizedState,o=0;a!==null&&(o=a.retryLane),fv(n,o)}function sC(n,a){var o=0;switch(n.tag){case 31:case 13:var c=n.stateNode,p=n.memoizedState;p!==null&&(o=p.retryLane);break;case 19:c=n.stateNode;break;case 22:c=n.stateNode._retryCache;break;default:throw Error(r(314))}c!==null&&c.delete(a),fv(n,o)}function aC(n,a){return fn(n,a)}var Tu=null,Hi=null,vm=!1,Au=!1,bm=!1,ba=0;function ns(n){n!==Hi&&n.next===null&&(Hi===null?Tu=Hi=n:Hi=Hi.next=n),Au=!0,vm||(vm=!0,iC())}function ul(n,a){if(!bm&&Au){bm=!0;do for(var o=!1,c=Tu;c!==null;){if(n!==0){var p=c.pendingLanes;if(p===0)var x=0;else{var E=c.suspendedLanes,k=c.pingedLanes;x=(1<<31-qt(42|n)+1)-1,x&=p&~(E&~k),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(o=!0,gv(c,x))}else x=He,x=ci(c,c===et?x:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(x&3)===0||ar(c,x)||(o=!0,gv(c,x));c=c.next}while(o);bm=!1}}function rC(){hv()}function hv(){Au=vm=!1;var n=0;ba!==0&&gC()&&(n=ba);for(var a=Me(),o=null,c=Tu;c!==null;){var p=c.next,x=mv(c,a);x===0?(c.next=null,o===null?Tu=p:o.next=p,p===null&&(Hi=o)):(o=c,(n!==0||(x&3)!==0)&&(Au=!0)),c=p}Nt!==0&&Nt!==5||ul(n),ba!==0&&(ba=0)}function mv(n,a){for(var o=n.suspendedLanes,c=n.pingedLanes,p=n.expirationTimes,x=n.pendingLanes&-62914561;0<x;){var E=31-qt(x),k=1<<E,F=p[E];F===-1?((k&o)===0||(k&c)!==0)&&(p[E]=Df(k,a)):F<=a&&(n.expiredLanes|=k),x&=~k}if(a=et,o=He,o=ci(n,n===a?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c=n.callbackNode,o===0||n===a&&(Fe===2||Fe===9)||n.cancelPendingCommit!==null)return c!==null&&c!==null&&jn(c),n.callbackNode=null,n.callbackPriority=0;if((o&3)===0||ar(n,o)){if(a=o&-o,a===n.callbackPriority)return a;switch(c!==null&&jn(c),To(o)){case 2:case 8:o=Xn;break;case 32:o=nr;break;case 268435456:o=ri;break;default:o=nr}return c=pv.bind(null,n),o=fn(o,c),n.callbackPriority=a,n.callbackNode=o,a}return c!==null&&c!==null&&jn(c),n.callbackPriority=2,n.callbackNode=null,2}function pv(n,a){if(Nt!==0&&Nt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var o=n.callbackNode;if(Ru()&&n.callbackNode!==o)return null;var c=He;return c=ci(n,n===et?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(Xy(n,c,a),mv(n,Me()),n.callbackNode!=null&&n.callbackNode===o?pv.bind(null,n):null)}function gv(n,a){if(Ru())return null;Xy(n,a,!0)}function iC(){yC(function(){(Qe&6)!==0?fn(kt,rC):hv()})}function Sm(){if(ba===0){var n=Ei;n===0&&(n=ii,ii<<=1,(ii&261888)===0&&(ii=256)),ba=n}return ba}function xv(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:Ic(""+n)}function yv(n,a){var o=a.ownerDocument.createElement("input");return o.name=a.name,o.value=a.value,n.id&&o.setAttribute("form",n.id),a.parentNode.insertBefore(o,a),n=new FormData(n),o.parentNode.removeChild(o),n}function oC(n,a,o,c,p){if(a==="submit"&&o&&o.stateNode===p){var x=xv((p[It]||null).action),E=c.submitter;E&&(a=(a=E[It]||null)?xv(a.formAction):E.getAttribute("formAction"),a!==null&&(x=a,E=null));var k=new $c("action","action",null,c,p);n.push({event:k,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(ba!==0){var F=E?yv(p,E):new FormData(p);Uh(o,{pending:!0,data:F,method:p.method,action:x},null,F)}}else typeof x=="function"&&(k.preventDefault(),F=E?yv(p,E):new FormData(p),Uh(o,{pending:!0,data:F,method:p.method,action:x},x,F))},currentTarget:p}]})}}for(var wm=0;wm<ah.length;wm++){var Nm=ah[wm],lC=Nm.toLowerCase(),cC=Nm[0].toUpperCase()+Nm.slice(1);Pn(lC,"on"+cC)}Pn(F0,"onAnimationEnd"),Pn(X0,"onAnimationIteration"),Pn(Z0,"onAnimationStart"),Pn("dblclick","onDoubleClick"),Pn("focusin","onFocus"),Pn("focusout","onBlur"),Pn(E2,"onTransitionRun"),Pn(C2,"onTransitionStart"),Pn(_2,"onTransitionCancel"),Pn(W0,"onTransitionEnd"),na("onMouseEnter",["mouseout","mouseover"]),na("onMouseLeave",["mouseout","mouseover"]),na("onPointerEnter",["pointerout","pointerover"]),na("onPointerLeave",["pointerout","pointerover"]),ys("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ys("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ys("onBeforeInput",["compositionend","keypress","textInput","paste"]),ys("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ys("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ys("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var dl="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(" "),uC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(dl));function vv(n,a){a=(a&4)!==0;for(var o=0;o<n.length;o++){var c=n[o],p=c.event;c=c.listeners;e:{var x=void 0;if(a)for(var E=c.length-1;0<=E;E--){var k=c[E],F=k.instance,te=k.currentTarget;if(k=k.listener,F!==x&&p.isPropagationStopped())break e;x=k,p.currentTarget=te;try{x(p)}catch(re){Gc(re)}p.currentTarget=null,x=F}else for(E=0;E<c.length;E++){if(k=c[E],F=k.instance,te=k.currentTarget,k=k.listener,F!==x&&p.isPropagationStopped())break e;x=k,p.currentTarget=te;try{x(p)}catch(re){Gc(re)}p.currentTarget=null,x=F}}}}function Ie(n,a){var o=a[ui];o===void 0&&(o=a[ui]=new Set);var c=n+"__bubble";o.has(c)||(bv(a,n,2,!1),o.add(c))}function jm(n,a,o){var c=0;a&&(c|=4),bv(o,n,c,a)}var Mu="_reactListening"+Math.random().toString(36).slice(2);function Em(n){if(!n[Mu]){n[Mu]=!0,kc.forEach(function(o){o!=="selectionchange"&&(uC.has(o)||jm(o,!1,n),jm(o,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Mu]||(a[Mu]=!0,jm("selectionchange",!1,a))}}function bv(n,a,o,c){switch(Fv(a)){case 2:var p=IC;break;case 8:p=BC;break;default:p=Hm}o=p.bind(null,a,o,n),p=void 0,!Gf||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(p=!0),c?p!==void 0?n.addEventListener(a,o,{capture:!0,passive:p}):n.addEventListener(a,o,!0):p!==void 0?n.addEventListener(a,o,{passive:p}):n.addEventListener(a,o,!1)}function Cm(n,a,o,c,p){var x=c;if((a&1)===0&&(a&2)===0&&c!==null)e:for(;;){if(c===null)return;var E=c.tag;if(E===3||E===4){var k=c.stateNode.containerInfo;if(k===p)break;if(E===4)for(E=c.return;E!==null;){var F=E.tag;if((F===3||F===4)&&E.stateNode.containerInfo===p)return;E=E.return}for(;k!==null;){if(E=Ws(k),E===null)return;if(F=E.tag,F===5||F===6||F===26||F===27){c=x=E;continue e}k=k.parentNode}}c=c.return}E0(function(){var te=x,re=qf(o),le=[];e:{var ne=J0.get(n);if(ne!==void 0){var ae=$c,pe=n;switch(n){case"keypress":if(Hc(o)===0)break e;case"keydown":case"keyup":ae=s2;break;case"focusin":pe="focus",ae=Ff;break;case"focusout":pe="blur",ae=Ff;break;case"beforeblur":case"afterblur":ae=Ff;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ae=R0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ae=GE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=i2;break;case F0:case X0:case Z0:ae=KE;break;case W0:ae=l2;break;case"scroll":case"scrollend":ae=qE;break;case"wheel":ae=u2;break;case"copy":case"cut":case"paste":ae=XE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ae=A0;break;case"toggle":case"beforetoggle":ae=f2}var _e=(a&4)!==0,Je=!_e&&(n==="scroll"||n==="scrollend"),W=_e?ne!==null?ne+"Capture":null:ne;_e=[];for(var Z=te,J;Z!==null;){var ie=Z;if(J=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||J===null||W===null||(ie=Oo(Z,W),ie!=null&&_e.push(fl(Z,ie,J))),Je)break;Z=Z.return}0<_e.length&&(ne=new ae(ne,pe,null,o,re),le.push({event:ne,listeners:_e}))}}if((a&7)===0){e:{if(ne=n==="mouseover"||n==="pointerover",ae=n==="mouseout"||n==="pointerout",ne&&o!==$f&&(pe=o.relatedTarget||o.fromElement)&&(Ws(pe)||pe[xs]))break e;if((ae||ne)&&(ne=re.window===re?re:(ne=re.ownerDocument)?ne.defaultView||ne.parentWindow:window,ae?(pe=o.relatedTarget||o.toElement,ae=te,pe=pe?Ws(pe):null,pe!==null&&(Je=l(pe),_e=pe.tag,pe!==Je||_e!==5&&_e!==27&&_e!==6)&&(pe=null)):(ae=null,pe=te),ae!==pe)){if(_e=R0,ie="onMouseLeave",W="onMouseEnter",Z="mouse",(n==="pointerout"||n==="pointerover")&&(_e=A0,ie="onPointerLeave",W="onPointerEnter",Z="pointer"),Je=ae==null?ne:ea(ae),J=pe==null?ne:ea(pe),ne=new _e(ie,Z+"leave",ae,o,re),ne.target=Je,ne.relatedTarget=J,ie=null,Ws(re)===te&&(_e=new _e(W,Z+"enter",pe,o,re),_e.target=J,_e.relatedTarget=Je,ie=_e),Je=ie,ae&&pe)t:{for(_e=dC,W=ae,Z=pe,J=0,ie=W;ie;ie=_e(ie))J++;ie=0;for(var Ee=Z;Ee;Ee=_e(Ee))ie++;for(;0<J-ie;)W=_e(W),J--;for(;0<ie-J;)Z=_e(Z),ie--;for(;J--;){if(W===Z||Z!==null&&W===Z.alternate){_e=W;break t}W=_e(W),Z=_e(Z)}_e=null}else _e=null;ae!==null&&Sv(le,ne,ae,_e,!1),pe!==null&&Je!==null&&Sv(le,Je,pe,_e,!0)}}e:{if(ne=te?ea(te):window,ae=ne.nodeName&&ne.nodeName.toLowerCase(),ae==="select"||ae==="input"&&ne.type==="file")var Ge=I0;else if(z0(ne))if(B0)Ge=w2;else{Ge=b2;var be=v2}else ae=ne.nodeName,!ae||ae.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&Uf(te.elementType)&&(Ge=I0):Ge=S2;if(Ge&&(Ge=Ge(n,te))){P0(le,Ge,o,re);break e}be&&be(n,ne,te),n==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&ko(ne,"number",ne.value)}switch(be=te?ea(te):window,n){case"focusin":(z0(be)||be.contentEditable==="true")&&(xi=be,th=te,Uo=null);break;case"focusout":Uo=th=xi=null;break;case"mousedown":nh=!0;break;case"contextmenu":case"mouseup":case"dragend":nh=!1,Q0(le,o,re);break;case"selectionchange":if(j2)break;case"keydown":case"keyup":Q0(le,o,re)}var De;if(Zf)e:{switch(n){case"compositionstart":var Ue="onCompositionStart";break e;case"compositionend":Ue="onCompositionEnd";break e;case"compositionupdate":Ue="onCompositionUpdate";break e}Ue=void 0}else gi?D0(n,o)&&(Ue="onCompositionEnd"):n==="keydown"&&o.keyCode===229&&(Ue="onCompositionStart");Ue&&(M0&&o.locale!=="ko"&&(gi||Ue!=="onCompositionStart"?Ue==="onCompositionEnd"&&gi&&(De=C0()):(aa=re,Yf="value"in aa?aa.value:aa.textContent,gi=!0)),be=ku(te,Ue),0<be.length&&(Ue=new T0(Ue,n,null,o,re),le.push({event:Ue,listeners:be}),De?Ue.data=De:(De=L0(o),De!==null&&(Ue.data=De)))),(De=m2?p2(n,o):g2(n,o))&&(Ue=ku(te,"onBeforeInput"),0<Ue.length&&(be=new T0("onBeforeInput","beforeinput",null,o,re),le.push({event:be,listeners:Ue}),be.data=De)),oC(le,n,te,o,re)}vv(le,a)})}function fl(n,a,o){return{instance:n,listener:a,currentTarget:o}}function ku(n,a){for(var o=a+"Capture",c=[];n!==null;){var p=n,x=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||x===null||(p=Oo(n,o),p!=null&&c.unshift(fl(n,p,x)),p=Oo(n,a),p!=null&&c.push(fl(n,p,x))),n.tag===3)return c;n=n.return}return[]}function dC(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Sv(n,a,o,c,p){for(var x=a._reactName,E=[];o!==null&&o!==c;){var k=o,F=k.alternate,te=k.stateNode;if(k=k.tag,F!==null&&F===c)break;k!==5&&k!==26&&k!==27||te===null||(F=te,p?(te=Oo(o,x),te!=null&&E.unshift(fl(o,te,F))):p||(te=Oo(o,x),te!=null&&E.push(fl(o,te,F)))),o=o.return}E.length!==0&&n.push({event:a,listeners:E})}var fC=/\r\n?/g,hC=/\u0000|\uFFFD/g;function wv(n){return(typeof n=="string"?n:""+n).replace(fC,`
49
- `).replace(hC,"")}function Nv(n,a){return a=wv(a),wv(n)===a}function We(n,a,o,c,p,x){switch(o){case"children":typeof c=="string"?a==="body"||a==="textarea"&&c===""||hi(n,c):(typeof c=="number"||typeof c=="bigint")&&a!=="body"&&hi(n,""+c);break;case"className":fi(n,"class",c);break;case"tabIndex":fi(n,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":fi(n,o,c);break;case"style":N0(n,c,x);break;case"data":if(a!=="object"){fi(n,"data",c);break}case"src":case"href":if(c===""&&(a!=="a"||o!=="href")){n.removeAttribute(o);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(o);break}c=Ic(""+c),n.setAttribute(o,c);break;case"action":case"formAction":if(typeof c=="function"){n.setAttribute(o,"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 x=="function"&&(o==="formAction"?(a!=="input"&&We(n,a,"name",p.name,p,null),We(n,a,"formEncType",p.formEncType,p,null),We(n,a,"formMethod",p.formMethod,p,null),We(n,a,"formTarget",p.formTarget,p,null)):(We(n,a,"encType",p.encType,p,null),We(n,a,"method",p.method,p,null),We(n,a,"target",p.target,p,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(o);break}c=Ic(""+c),n.setAttribute(o,c);break;case"onClick":c!=null&&(n.onclick=bs);break;case"onScroll":c!=null&&Ie("scroll",n);break;case"onScrollEnd":c!=null&&Ie("scrollend",n);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(o=c.__html,o!=null){if(p.children!=null)throw Error(r(60));n.innerHTML=o}}break;case"multiple":n.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":n.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){n.removeAttribute("xlink:href");break}o=Ic(""+c),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(o,""+c):n.removeAttribute(o);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":c&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(o,""):n.removeAttribute(o);break;case"capture":case"download":c===!0?n.setAttribute(o,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(o,c):n.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?n.setAttribute(o,c):n.removeAttribute(o);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?n.removeAttribute(o):n.setAttribute(o,c);break;case"popover":Ie("beforetoggle",n),Ie("toggle",n),di(n,"popover",c);break;case"xlinkActuate":zn(n,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":zn(n,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":zn(n,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":zn(n,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":zn(n,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":zn(n,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":zn(n,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":zn(n,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":zn(n,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":di(n,"is",c);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=UE.get(o)||o,di(n,o,c))}}function _m(n,a,o,c,p,x){switch(o){case"style":N0(n,c,x);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(o=c.__html,o!=null){if(p.children!=null)throw Error(r(60));n.innerHTML=o}}break;case"children":typeof c=="string"?hi(n,c):(typeof c=="number"||typeof c=="bigint")&&hi(n,""+c);break;case"onScroll":c!=null&&Ie("scroll",n);break;case"onScrollEnd":c!=null&&Ie("scrollend",n);break;case"onClick":c!=null&&(n.onclick=bs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Oc.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(p=o.endsWith("Capture"),a=o.slice(2,p?o.length-7:void 0),x=n[It]||null,x=x!=null?x[o]:null,typeof x=="function"&&n.removeEventListener(a,x,p),typeof c=="function")){typeof x!="function"&&x!==null&&(o in n?n[o]=null:n.hasAttribute(o)&&n.removeAttribute(o)),n.addEventListener(a,c,p);break e}o in n?n[o]=c:c===!0?n.setAttribute(o,""):di(n,o,c)}}}function zt(n,a,o){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ie("error",n),Ie("load",n);var c=!1,p=!1,x;for(x in o)if(o.hasOwnProperty(x)){var E=o[x];if(E!=null)switch(x){case"src":c=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:We(n,a,x,E,o,null)}}p&&We(n,a,"srcSet",o.srcSet,o,null),c&&We(n,a,"src",o.src,o,null);return;case"input":Ie("invalid",n);var k=x=E=p=null,F=null,te=null;for(c in o)if(o.hasOwnProperty(c)){var re=o[c];if(re!=null)switch(c){case"name":p=re;break;case"type":E=re;break;case"checked":F=re;break;case"defaultChecked":te=re;break;case"value":x=re;break;case"defaultValue":k=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(r(137,a));break;default:We(n,a,c,re,o,null)}}Pc(n,x,k,F,te,E,p,!1);return;case"select":Ie("invalid",n),c=E=x=null;for(p in o)if(o.hasOwnProperty(p)&&(k=o[p],k!=null))switch(p){case"value":x=k;break;case"defaultValue":E=k;break;case"multiple":c=k;default:We(n,a,p,k,o,null)}a=x,o=E,n.multiple=!!c,a!=null?vs(n,!!c,a,!1):o!=null&&vs(n,!!c,o,!0);return;case"textarea":Ie("invalid",n),x=p=c=null;for(E in o)if(o.hasOwnProperty(E)&&(k=o[E],k!=null))switch(E){case"value":c=k;break;case"defaultValue":p=k;break;case"children":x=k;break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(r(91));break;default:We(n,a,E,k,o,null)}S0(n,c,p,x);return;case"option":for(F in o)if(o.hasOwnProperty(F)&&(c=o[F],c!=null))switch(F){case"selected":n.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:We(n,a,F,c,o,null)}return;case"dialog":Ie("beforetoggle",n),Ie("toggle",n),Ie("cancel",n),Ie("close",n);break;case"iframe":case"object":Ie("load",n);break;case"video":case"audio":for(c=0;c<dl.length;c++)Ie(dl[c],n);break;case"image":Ie("error",n),Ie("load",n);break;case"details":Ie("toggle",n);break;case"embed":case"source":case"link":Ie("error",n),Ie("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in o)if(o.hasOwnProperty(te)&&(c=o[te],c!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:We(n,a,te,c,o,null)}return;default:if(Uf(a)){for(re in o)o.hasOwnProperty(re)&&(c=o[re],c!==void 0&&_m(n,a,re,c,o,void 0));return}}for(k in o)o.hasOwnProperty(k)&&(c=o[k],c!=null&&We(n,a,k,c,o,null))}function mC(n,a,o,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,x=null,E=null,k=null,F=null,te=null,re=null;for(ae in o){var le=o[ae];if(o.hasOwnProperty(ae)&&le!=null)switch(ae){case"checked":break;case"value":break;case"defaultValue":F=le;default:c.hasOwnProperty(ae)||We(n,a,ae,null,c,le)}}for(var ne in c){var ae=c[ne];if(le=o[ne],c.hasOwnProperty(ne)&&(ae!=null||le!=null))switch(ne){case"type":x=ae;break;case"name":p=ae;break;case"checked":te=ae;break;case"defaultChecked":re=ae;break;case"value":E=ae;break;case"defaultValue":k=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(r(137,a));break;default:ae!==le&&We(n,a,ne,ae,c,le)}}lr(n,E,k,F,te,re,x,p);return;case"select":ae=E=k=ne=null;for(x in o)if(F=o[x],o.hasOwnProperty(x)&&F!=null)switch(x){case"value":break;case"multiple":ae=F;default:c.hasOwnProperty(x)||We(n,a,x,null,c,F)}for(p in c)if(x=c[p],F=o[p],c.hasOwnProperty(p)&&(x!=null||F!=null))switch(p){case"value":ne=x;break;case"defaultValue":k=x;break;case"multiple":E=x;default:x!==F&&We(n,a,p,x,c,F)}a=k,o=E,c=ae,ne!=null?vs(n,!!o,ne,!1):!!c!=!!o&&(a!=null?vs(n,!!o,a,!0):vs(n,!!o,o?[]:"",!1));return;case"textarea":ae=ne=null;for(k in o)if(p=o[k],o.hasOwnProperty(k)&&p!=null&&!c.hasOwnProperty(k))switch(k){case"value":break;case"children":break;default:We(n,a,k,null,c,p)}for(E in c)if(p=c[E],x=o[E],c.hasOwnProperty(E)&&(p!=null||x!=null))switch(E){case"value":ne=p;break;case"defaultValue":ae=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(r(91));break;default:p!==x&&We(n,a,E,p,c,x)}b0(n,ne,ae);return;case"option":for(var pe in o)if(ne=o[pe],o.hasOwnProperty(pe)&&ne!=null&&!c.hasOwnProperty(pe))switch(pe){case"selected":n.selected=!1;break;default:We(n,a,pe,null,c,ne)}for(F in c)if(ne=c[F],ae=o[F],c.hasOwnProperty(F)&&ne!==ae&&(ne!=null||ae!=null))switch(F){case"selected":n.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:We(n,a,F,ne,c,ae)}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 _e in o)ne=o[_e],o.hasOwnProperty(_e)&&ne!=null&&!c.hasOwnProperty(_e)&&We(n,a,_e,null,c,ne);for(te in c)if(ne=c[te],ae=o[te],c.hasOwnProperty(te)&&ne!==ae&&(ne!=null||ae!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(r(137,a));break;default:We(n,a,te,ne,c,ae)}return;default:if(Uf(a)){for(var Je in o)ne=o[Je],o.hasOwnProperty(Je)&&ne!==void 0&&!c.hasOwnProperty(Je)&&_m(n,a,Je,void 0,c,ne);for(re in c)ne=c[re],ae=o[re],!c.hasOwnProperty(re)||ne===ae||ne===void 0&&ae===void 0||_m(n,a,re,ne,c,ae);return}}for(var W in o)ne=o[W],o.hasOwnProperty(W)&&ne!=null&&!c.hasOwnProperty(W)&&We(n,a,W,null,c,ne);for(le in c)ne=c[le],ae=o[le],!c.hasOwnProperty(le)||ne===ae||ne==null&&ae==null||We(n,a,le,ne,c,ae)}function jv(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function pC(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,o=performance.getEntriesByType("resource"),c=0;c<o.length;c++){var p=o[c],x=p.transferSize,E=p.initiatorType,k=p.duration;if(x&&k&&jv(E)){for(E=0,k=p.responseEnd,c+=1;c<o.length;c++){var F=o[c],te=F.startTime;if(te>k)break;var re=F.transferSize,le=F.initiatorType;re&&jv(le)&&(F=F.responseEnd,E+=re*(F<k?1:(k-te)/(F-te)))}if(--c,a+=8*(x+E)/(p.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var Rm=null,Tm=null;function Ou(n){return n.nodeType===9?n:n.ownerDocument}function Ev(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Cv(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function Am(n,a){return n==="textarea"||n==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Mm=null;function gC(){var n=window.event;return n&&n.type==="popstate"?n===Mm?!1:(Mm=n,!0):(Mm=null,!1)}var _v=typeof setTimeout=="function"?setTimeout:void 0,xC=typeof clearTimeout=="function"?clearTimeout:void 0,Rv=typeof Promise=="function"?Promise:void 0,yC=typeof queueMicrotask=="function"?queueMicrotask:typeof Rv<"u"?function(n){return Rv.resolve(null).then(n).catch(vC)}:_v;function vC(n){setTimeout(function(){throw n})}function Sa(n){return n==="head"}function Tv(n,a){var o=a,c=0;do{var p=o.nextSibling;if(n.removeChild(o),p&&p.nodeType===8)if(o=p.data,o==="/$"||o==="/&"){if(c===0){n.removeChild(p),Vi(a);return}c--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")c++;else if(o==="html")hl(n.ownerDocument.documentElement);else if(o==="head"){o=n.ownerDocument.head,hl(o);for(var x=o.firstChild;x;){var E=x.nextSibling,k=x.nodeName;x[ir]||k==="SCRIPT"||k==="STYLE"||k==="LINK"&&x.rel.toLowerCase()==="stylesheet"||o.removeChild(x),x=E}}else o==="body"&&hl(n.ownerDocument.body);o=p}while(o);Vi(a)}function Av(n,a){var o=n;n=0;do{var c=o.nextSibling;if(o.nodeType===1?a?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(a?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),c&&c.nodeType===8)if(o=c.data,o==="/$"){if(n===0)break;n--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||n++;o=c}while(o)}function km(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var o=a;switch(a=a.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":km(o),Ao(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}n.removeChild(o)}}function bC(n,a,o,c){for(;n.nodeType===1;){var p=o;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!c&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(c){if(!n[ir])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(x=n.getAttribute("rel"),x==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(x!==p.rel||n.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||n.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||n.getAttribute("title")!==(p.title==null?null:p.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(x=n.getAttribute("src"),(x!==(p.src==null?null:p.src)||n.getAttribute("type")!==(p.type==null?null:p.type)||n.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&x&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var x=p.name==null?null:""+p.name;if(p.type==="hidden"&&n.getAttribute("name")===x)return n}else return n;if(n=Mn(n.nextSibling),n===null)break}return null}function SC(n,a,o){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!o||(n=Mn(n.nextSibling),n===null))return null;return n}function Mv(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=Mn(n.nextSibling),n===null))return null;return n}function Om(n){return n.data==="$?"||n.data==="$~"}function Dm(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function wC(n,a){var o=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||o.readyState!=="loading")a();else{var c=function(){a(),o.removeEventListener("DOMContentLoaded",c)};o.addEventListener("DOMContentLoaded",c),n._reactRetry=c}}function Mn(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var Lm=null;function kv(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var o=n.data;if(o==="/$"||o==="/&"){if(a===0)return Mn(n.nextSibling);a--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||a++}n=n.nextSibling}return null}function Ov(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var o=n.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(a===0)return n;a--}else o!=="/$"&&o!=="/&"||a++}n=n.previousSibling}return null}function Dv(n,a,o){switch(a=Ou(o),n){case"html":if(n=a.documentElement,!n)throw Error(r(452));return n;case"head":if(n=a.head,!n)throw Error(r(453));return n;case"body":if(n=a.body,!n)throw Error(r(454));return n;default:throw Error(r(451))}}function hl(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);Ao(n)}var kn=new Map,Lv=new Set;function Du(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var zs=$.d;$.d={f:NC,r:jC,D:EC,C:CC,L:_C,m:RC,X:AC,S:TC,M:MC};function NC(){var n=zs.f(),a=Eu();return n||a}function jC(n){var a=Js(n);a!==null&&a.tag===5&&a.type==="form"?Wx(a):zs.r(n)}var Ui=typeof document>"u"?null:document;function zv(n,a,o){var c=Ui;if(c&&typeof a=="string"&&a){var p=Wt(a);p='link[rel="'+n+'"][href="'+p+'"]',typeof o=="string"&&(p+='[crossorigin="'+o+'"]'),Lv.has(p)||(Lv.add(p),n={rel:n,crossOrigin:o,href:a},c.querySelector(p)===null&&(a=c.createElement("link"),zt(a,"link",n),pt(a),c.head.appendChild(a)))}}function EC(n){zs.D(n),zv("dns-prefetch",n,null)}function CC(n,a){zs.C(n,a),zv("preconnect",n,a)}function _C(n,a,o){zs.L(n,a,o);var c=Ui;if(c&&n&&a){var p='link[rel="preload"][as="'+Wt(a)+'"]';a==="image"&&o&&o.imageSrcSet?(p+='[imagesrcset="'+Wt(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(p+='[imagesizes="'+Wt(o.imageSizes)+'"]')):p+='[href="'+Wt(n)+'"]';var x=p;switch(a){case"style":x=$i(n);break;case"script":x=qi(n)}kn.has(x)||(n=g({rel:"preload",href:a==="image"&&o&&o.imageSrcSet?void 0:n,as:a},o),kn.set(x,n),c.querySelector(p)!==null||a==="style"&&c.querySelector(ml(x))||a==="script"&&c.querySelector(pl(x))||(a=c.createElement("link"),zt(a,"link",n),pt(a),c.head.appendChild(a)))}}function RC(n,a){zs.m(n,a);var o=Ui;if(o&&n){var c=a&&typeof a.as=="string"?a.as:"script",p='link[rel="modulepreload"][as="'+Wt(c)+'"][href="'+Wt(n)+'"]',x=p;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=qi(n)}if(!kn.has(x)&&(n=g({rel:"modulepreload",href:n},a),kn.set(x,n),o.querySelector(p)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(pl(x)))return}c=o.createElement("link"),zt(c,"link",n),pt(c),o.head.appendChild(c)}}}function TC(n,a,o){zs.S(n,a,o);var c=Ui;if(c&&n){var p=ta(c).hoistableStyles,x=$i(n);a=a||"default";var E=p.get(x);if(!E){var k={loading:0,preload:null};if(E=c.querySelector(ml(x)))k.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":a},o),(o=kn.get(x))&&zm(n,o);var F=E=c.createElement("link");pt(F),zt(F,"link",n),F._p=new Promise(function(te,re){F.onload=te,F.onerror=re}),F.addEventListener("load",function(){k.loading|=1}),F.addEventListener("error",function(){k.loading|=2}),k.loading|=4,Lu(E,a,c)}E={type:"stylesheet",instance:E,count:1,state:k},p.set(x,E)}}}function AC(n,a){zs.X(n,a);var o=Ui;if(o&&n){var c=ta(o).hoistableScripts,p=qi(n),x=c.get(p);x||(x=o.querySelector(pl(p)),x||(n=g({src:n,async:!0},a),(a=kn.get(p))&&Pm(n,a),x=o.createElement("script"),pt(x),zt(x,"link",n),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},c.set(p,x))}}function MC(n,a){zs.M(n,a);var o=Ui;if(o&&n){var c=ta(o).hoistableScripts,p=qi(n),x=c.get(p);x||(x=o.querySelector(pl(p)),x||(n=g({src:n,async:!0,type:"module"},a),(a=kn.get(p))&&Pm(n,a),x=o.createElement("script"),pt(x),zt(x,"link",n),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},c.set(p,x))}}function Pv(n,a,o,c){var p=(p=ce.current)?Du(p):null;if(!p)throw Error(r(446));switch(n){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(a=$i(o.href),o=ta(p).hoistableStyles,c=o.get(a),c||(c={type:"style",instance:null,count:0,state:null},o.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){n=$i(o.href);var x=ta(p).hoistableStyles,E=x.get(n);if(E||(p=p.ownerDocument||p,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(n,E),(x=p.querySelector(ml(n)))&&!x._p&&(E.instance=x,E.state.loading=5),kn.has(n)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},kn.set(n,o),x||kC(p,n,o,E.state))),a&&c===null)throw Error(r(528,""));return E}if(a&&c!==null)throw Error(r(529,""));return null;case"script":return a=o.async,o=o.src,typeof o=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=qi(o),o=ta(p).hoistableScripts,c=o.get(a),c||(c={type:"script",instance:null,count:0,state:null},o.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,n))}}function $i(n){return'href="'+Wt(n)+'"'}function ml(n){return'link[rel="stylesheet"]['+n+"]"}function Iv(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function kC(n,a,o,c){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?c.loading=1:(a=n.createElement("link"),c.preload=a,a.addEventListener("load",function(){return c.loading|=1}),a.addEventListener("error",function(){return c.loading|=2}),zt(a,"link",o),pt(a),n.head.appendChild(a))}function qi(n){return'[src="'+Wt(n)+'"]'}function pl(n){return"script[async]"+n}function Bv(n,a,o){if(a.count++,a.instance===null)switch(a.type){case"style":var c=n.querySelector('style[data-href~="'+Wt(o.href)+'"]');if(c)return a.instance=c,pt(c),c;var p=g({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),pt(c),zt(c,"style",p),Lu(c,o.precedence,n),a.instance=c;case"stylesheet":p=$i(o.href);var x=n.querySelector(ml(p));if(x)return a.state.loading|=4,a.instance=x,pt(x),x;c=Iv(o),(p=kn.get(p))&&zm(c,p),x=(n.ownerDocument||n).createElement("link"),pt(x);var E=x;return E._p=new Promise(function(k,F){E.onload=k,E.onerror=F}),zt(x,"link",c),a.state.loading|=4,Lu(x,o.precedence,n),a.instance=x;case"script":return x=qi(o.src),(p=n.querySelector(pl(x)))?(a.instance=p,pt(p),p):(c=o,(p=kn.get(x))&&(c=g({},o),Pm(c,p)),n=n.ownerDocument||n,p=n.createElement("script"),pt(p),zt(p,"link",c),n.head.appendChild(p),a.instance=p);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(c=a.instance,a.state.loading|=4,Lu(c,o.precedence,n));return a.instance}function Lu(n,a,o){for(var c=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=c.length?c[c.length-1]:null,x=p,E=0;E<c.length;E++){var k=c[E];if(k.dataset.precedence===a)x=k;else if(x!==p)break}x?x.parentNode.insertBefore(n,x.nextSibling):(a=o.nodeType===9?o.head:o,a.insertBefore(n,a.firstChild))}function zm(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function Pm(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var zu=null;function Hv(n,a,o){if(zu===null){var c=new Map,p=zu=new Map;p.set(o,c)}else p=zu,c=p.get(o),c||(c=new Map,p.set(o,c));if(c.has(n))return c;for(c.set(n,null),o=o.getElementsByTagName(n),p=0;p<o.length;p++){var x=o[p];if(!(x[ir]||x[wt]||n==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var E=x.getAttribute(a)||"";E=n+E;var k=c.get(E);k?k.push(x):c.set(E,[x])}}return c}function Uv(n,a,o){n=n.ownerDocument||n,n.head.insertBefore(o,a==="title"?n.querySelector("head > title"):null)}function OC(n,a,o){if(o===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return n=a.disabled,typeof a.precedence=="string"&&n==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function $v(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function DC(n,a,o,c){if(o.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var p=$i(c.href),x=a.querySelector(ml(p));if(x){a=x._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=Pu.bind(n),a.then(n,n)),o.state.loading|=4,o.instance=x,pt(x);return}x=a.ownerDocument||a,c=Iv(c),(p=kn.get(p))&&zm(c,p),x=x.createElement("link"),pt(x);var E=x;E._p=new Promise(function(k,F){E.onload=k,E.onerror=F}),zt(x,"link",c),o.instance=x}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(o,a),(a=o.state.preload)&&(o.state.loading&3)===0&&(n.count++,o=Pu.bind(n),a.addEventListener("load",o),a.addEventListener("error",o))}}var Im=0;function LC(n,a){return n.stylesheets&&n.count===0&&Bu(n,n.stylesheets),0<n.count||0<n.imgCount?function(o){var c=setTimeout(function(){if(n.stylesheets&&Bu(n,n.stylesheets),n.unsuspend){var x=n.unsuspend;n.unsuspend=null,x()}},6e4+a);0<n.imgBytes&&Im===0&&(Im=62500*pC());var p=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&Bu(n,n.stylesheets),n.unsuspend)){var x=n.unsuspend;n.unsuspend=null,x()}},(n.imgBytes>Im?50:800)+a);return n.unsuspend=o,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(p)}}:null}function Pu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Iu=null;function Bu(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Iu=new Map,a.forEach(zC,n),Iu=null,Pu.call(n))}function zC(n,a){if(!(a.state.loading&4)){var o=Iu.get(n);if(o)var c=o.get(null);else{o=new Map,Iu.set(n,o);for(var p=n.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x<p.length;x++){var E=p[x];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(o.set(E.dataset.precedence,E),c=E)}c&&o.set(null,c)}p=a.instance,E=p.getAttribute("data-precedence"),x=o.get(E)||c,x===c&&o.set(null,p),o.set(E,p),this.count++,c=Pu.bind(this),p.addEventListener("load",c),p.addEventListener("error",c),x?x.parentNode.insertBefore(p,x.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(p,n.firstChild)),a.state.loading|=4}}var gl={$$typeof:_,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function PC(n,a,o,c,p,x,E,k,F){this.tag=1,this.containerInfo=n,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=_o(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_o(0),this.hiddenUpdates=_o(null),this.identifierPrefix=c,this.onUncaughtError=p,this.onCaughtError=x,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=F,this.incompleteTransitions=new Map}function qv(n,a,o,c,p,x,E,k,F,te,re,le){return n=new PC(n,a,o,E,F,te,re,le,k),a=1,x===!0&&(a|=24),x=mn(3,null,null,a),n.current=x,x.stateNode=n,a=xh(),a.refCount++,n.pooledCache=a,a.refCount++,x.memoizedState={element:c,isDehydrated:o,cache:a},Sh(x),n}function Vv(n){return n?(n=bi,n):bi}function Gv(n,a,o,c,p,x){p=Vv(p),c.context===null?c.context=p:c.pendingContext=p,c=ua(a),c.payload={element:o},x=x===void 0?null:x,x!==null&&(c.callback=x),o=da(n,c,a),o!==null&&(an(o,n,a),Ko(o,n,a))}function Yv(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var o=n.retryLane;n.retryLane=o!==0&&o<a?o:a}}function Bm(n,a){Yv(n,a),(n=n.alternate)&&Yv(n,a)}function Qv(n){if(n.tag===13||n.tag===31){var a=fr(n,67108864);a!==null&&an(a,n,67108864),Bm(n,67108864)}}function Kv(n){if(n.tag===13||n.tag===31){var a=vn();a=Ro(a);var o=fr(n,a);o!==null&&an(o,n,a),Bm(n,a)}}var Hu=!0;function IC(n,a,o,c){var p=A.T;A.T=null;var x=$.p;try{$.p=2,Hm(n,a,o,c)}finally{$.p=x,A.T=p}}function BC(n,a,o,c){var p=A.T;A.T=null;var x=$.p;try{$.p=8,Hm(n,a,o,c)}finally{$.p=x,A.T=p}}function Hm(n,a,o,c){if(Hu){var p=Um(c);if(p===null)Cm(n,a,c,Uu,o),Xv(n,c);else if(UC(p,n,a,o,c))c.stopPropagation();else if(Xv(n,c),a&4&&-1<HC.indexOf(n)){for(;p!==null;){var x=Js(p);if(x!==null)switch(x.tag){case 3:if(x=x.stateNode,x.current.memoizedState.isDehydrated){var E=gs(x.pendingLanes);if(E!==0){var k=x;for(k.pendingLanes|=2,k.entangledLanes|=2;E;){var F=1<<31-qt(E);k.entanglements[1]|=F,E&=~F}ns(x),(Qe&6)===0&&(Nu=Me()+500,ul(0))}}break;case 31:case 13:k=fr(x,2),k!==null&&an(k,x,2),Eu(),Bm(x,2)}if(x=Um(c),x===null&&Cm(n,a,c,Uu,o),x===p)break;p=x}p!==null&&c.stopPropagation()}else Cm(n,a,c,null,o)}}function Um(n){return n=qf(n),$m(n)}var Uu=null;function $m(n){if(Uu=null,n=Ws(n),n!==null){var a=l(n);if(a===null)n=null;else{var o=a.tag;if(o===13){if(n=d(a),n!==null)return n;n=null}else if(o===31){if(n=f(a),n!==null)return n;n=null}else if(o===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return Uu=n,null}function Fv(n){switch(n){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(ft()){case kt:return 2;case Xn:return 8;case nr:case Rf:return 32;case ri:return 268435456;default:return 32}default:return 32}}var qm=!1,wa=null,Na=null,ja=null,xl=new Map,yl=new Map,Ea=[],HC="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 Xv(n,a){switch(n){case"focusin":case"focusout":wa=null;break;case"dragenter":case"dragleave":Na=null;break;case"mouseover":case"mouseout":ja=null;break;case"pointerover":case"pointerout":xl.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":yl.delete(a.pointerId)}}function vl(n,a,o,c,p,x){return n===null||n.nativeEvent!==x?(n={blockedOn:a,domEventName:o,eventSystemFlags:c,nativeEvent:x,targetContainers:[p]},a!==null&&(a=Js(a),a!==null&&Qv(a)),n):(n.eventSystemFlags|=c,a=n.targetContainers,p!==null&&a.indexOf(p)===-1&&a.push(p),n)}function UC(n,a,o,c,p){switch(a){case"focusin":return wa=vl(wa,n,a,o,c,p),!0;case"dragenter":return Na=vl(Na,n,a,o,c,p),!0;case"mouseover":return ja=vl(ja,n,a,o,c,p),!0;case"pointerover":var x=p.pointerId;return xl.set(x,vl(xl.get(x)||null,n,a,o,c,p)),!0;case"gotpointercapture":return x=p.pointerId,yl.set(x,vl(yl.get(x)||null,n,a,o,c,p)),!0}return!1}function Zv(n){var a=Ws(n.target);if(a!==null){var o=l(a);if(o!==null){if(a=o.tag,a===13){if(a=d(o),a!==null){n.blockedOn=a,Tc(n.priority,function(){Kv(o)});return}}else if(a===31){if(a=f(o),a!==null){n.blockedOn=a,Tc(n.priority,function(){Kv(o)});return}}else if(a===3&&o.stateNode.current.memoizedState.isDehydrated){n.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}n.blockedOn=null}function $u(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var o=Um(n.nativeEvent);if(o===null){o=n.nativeEvent;var c=new o.constructor(o.type,o);$f=c,o.target.dispatchEvent(c),$f=null}else return a=Js(o),a!==null&&Qv(a),n.blockedOn=o,!1;a.shift()}return!0}function Wv(n,a,o){$u(n)&&o.delete(a)}function $C(){qm=!1,wa!==null&&$u(wa)&&(wa=null),Na!==null&&$u(Na)&&(Na=null),ja!==null&&$u(ja)&&(ja=null),xl.forEach(Wv),yl.forEach(Wv)}function qu(n,a){n.blockedOn===a&&(n.blockedOn=null,qm||(qm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,$C)))}var Vu=null;function Jv(n){Vu!==n&&(Vu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Vu===n&&(Vu=null);for(var a=0;a<n.length;a+=3){var o=n[a],c=n[a+1],p=n[a+2];if(typeof c!="function"){if($m(c||o)===null)continue;break}var x=Js(o);x!==null&&(n.splice(a,3),a-=3,Uh(x,{pending:!0,data:p,method:o.method,action:c},c,p))}}))}function Vi(n){function a(F){return qu(F,n)}wa!==null&&qu(wa,n),Na!==null&&qu(Na,n),ja!==null&&qu(ja,n),xl.forEach(a),yl.forEach(a);for(var o=0;o<Ea.length;o++){var c=Ea[o];c.blockedOn===n&&(c.blockedOn=null)}for(;0<Ea.length&&(o=Ea[0],o.blockedOn===null);)Zv(o),o.blockedOn===null&&Ea.shift();if(o=(n.ownerDocument||n).$$reactFormReplay,o!=null)for(c=0;c<o.length;c+=3){var p=o[c],x=o[c+1],E=p[It]||null;if(typeof x=="function")E||Jv(o);else if(E){var k=null;if(x&&x.hasAttribute("formAction")){if(p=x,E=x[It]||null)k=E.formAction;else if($m(p)!==null)continue}else k=E.action;typeof k=="function"?o[c+1]=k:(o.splice(c,3),c-=3),Jv(o)}}}function eb(){function n(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(E){return p=E})},focusReset:"manual",scroll:"manual"})}function a(){p!==null&&(p(),p=null),c||setTimeout(o,20)}function o(){if(!c&&!navigation.transition){var x=navigation.currentEntry;x&&x.url!=null&&navigation.navigate(x.url,{state:x.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,p=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(o,100),function(){c=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),p!==null&&(p(),p=null)}}}function Vm(n){this._internalRoot=n}Gu.prototype.render=Vm.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(r(409));var o=a.current,c=vn();Gv(o,c,n,a,null,null)},Gu.prototype.unmount=Vm.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;Gv(n.current,2,null,n,null,null),Eu(),a[xs]=null}};function Gu(n){this._internalRoot=n}Gu.prototype.unstable_scheduleHydration=function(n){if(n){var a=Rc();n={blockedOn:null,target:n,priority:a};for(var o=0;o<Ea.length&&a!==0&&a<Ea[o].priority;o++);Ea.splice(o,0,n),o===0&&Zv(n)}};var tb=t.version;if(tb!=="19.2.4")throw Error(r(527,tb,"19.2.4"));$.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(r(188)):(n=Object.keys(n).join(","),Error(r(268,n)));return n=h(a),n=n!==null?v(n):null,n=n===null?null:n.stateNode,n};var qC={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:A,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yu.isDisabled&&Yu.supportsFiber)try{sr=Yu.inject(qC),$t=Yu}catch{}}return wl.createRoot=function(n,a){if(!i(n))throw Error(r(299));var o=!1,c="",p=ly,x=cy,E=uy;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(E=a.onRecoverableError)),a=qv(n,1,!1,null,null,o,c,null,p,x,E,eb),n[xs]=a.current,Em(n),new Vm(a)},wl.hydrateRoot=function(n,a,o){if(!i(n))throw Error(r(299));var c=!1,p="",x=ly,E=cy,k=uy,F=null;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(p=o.identifierPrefix),o.onUncaughtError!==void 0&&(x=o.onUncaughtError),o.onCaughtError!==void 0&&(E=o.onCaughtError),o.onRecoverableError!==void 0&&(k=o.onRecoverableError),o.formState!==void 0&&(F=o.formState)),a=qv(n,1,!0,a,o??null,c,p,F,x,E,k,eb),a.context=Vv(null),o=a.current,c=vn(),c=Ro(c),p=ua(c),p.callback=null,da(o,p,c),o=c,a.current.lanes=o,rr(a,o),ns(a),n[xs]=a.current,Em(n),new Gu(a)},wl.version="19.2.4",wl}var fb;function t_(){if(fb)return Km.exports;fb=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Km.exports=e_(),Km.exports}var n_=t_(),Ku=typeof window<"u"?j.useLayoutEffect:j.useEffect;function Wm(e){const t=j.useRef({value:e,prev:null}),s=t.current.value;return e!==s&&(t.current={value:e,prev:s}),t.current.prev}function s_(e,t,s={},r={}){j.useEffect(()=>{if(!e.current||r.disabled||typeof IntersectionObserver!="function")return;const i=new IntersectionObserver(([l])=>{t(l)},s);return i.observe(e.current),()=>{i.disconnect()}},[t,s,r.disabled,e])}function a_(e){const t=j.useRef(null);return j.useImperativeHandle(e,()=>t.current,[]),t}var r_=!1;function Bl(e){return e[e.length-1]}function i_(e){return typeof e=="function"}function Va(e,t){return i_(e)?e(t):e}var o_=Object.prototype.hasOwnProperty,hb=Object.prototype.propertyIsEnumerable,l_=()=>Object.create(null),Er=(e,t)=>Ga(e,t,l_);function Ga(e,t,s=()=>({}),r=0){if(e===t)return e;if(r>500)return t;const i=t,l=gb(e)&&gb(i);if(!l&&!(Od(e)&&Od(i)))return i;const d=l?e:mb(e);if(!d)return i;const f=l?i:mb(i);if(!f)return i;const m=d.length,h=f.length,v=l?new Array(h):s();let g=0;for(let y=0;y<h;y++){const b=l?y:f[y],S=e[b],w=i[b];if(S===w){v[b]=S,(l?y<m:o_.call(e,b))&&g++;continue}if(S===null||w===null||typeof S!="object"||typeof w!="object"){v[b]=w;continue}const N=Ga(S,w,s,r+1);v[b]=N,N===S&&g++}return m===h&&g===m?e:v}function mb(e){const t=Object.getOwnPropertyNames(e);for(const i of t)if(!hb.call(e,i))return!1;const s=Object.getOwnPropertySymbols(e);if(s.length===0)return t;const r=t;for(const i of s){if(!hb.call(e,i))return!1;r.push(i)}return r}function Od(e){if(!pb(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const s=t.prototype;return!(!pb(s)||!s.hasOwnProperty("isPrototypeOf"))}function pb(e){return Object.prototype.toString.call(e)==="[object Object]"}function gb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Vr(e,t,s){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!Vr(e[r],t[r],s))return!1;return!0}if(Od(e)&&Od(t)){const r=(s==null?void 0:s.ignoreUndefined)??!0;if(s!=null&&s.partial){for(const d in t)if((!r||t[d]!==void 0)&&!Vr(e[d],t[d],s))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(const d in e)e[d]!==void 0&&i++;let l=0;for(const d in t)if((!r||t[d]!==void 0)&&(l++,l>i||!Vr(e[d],t[d],s)))return!1;return i===l}return!1}function xo(e){let t,s;const r=new Promise((i,l)=>{t=i,s=l});return r.status="pending",r.resolve=i=>{r.status="resolved",r.value=i,t(i),e==null||e(i)},r.reject=i=>{r.status="rejected",s(i)},r}function Hl(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function c_(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function xb(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,s=>{try{return decodeURI(s)}catch{return s}})}return c_(t)}var u_=["http:","https:","mailto:","tel:"];function Dd(e,t){if(!e)return!1;try{const s=new URL(e);return!t.has(s.protocol)}catch{return!1}}function Nl(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let s=0,r="",i;for(;(i=t.exec(e))!==null;)r+=xb(e.slice(s,i.index))+i[0],s=t.lastIndex;r=r+xb(s?e.slice(s):e);let l=!1;return r.startsWith("//")&&(l=!0,r="/"+r.replace(/^\/+/,"")),{path:r,handledProtocolRelativeURL:l}}function d_(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function f_(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!==t[s])return!1;return!0}function Qs(){throw new Error("Invariant failed")}function Ul(e){const t=new Map;let s,r;const i=l=>{l.next&&(l.prev?(l.prev.next=l.next,l.next.prev=l.prev,l.next=void 0,r&&(r.next=l,l.prev=r)):(l.next.prev=void 0,s=l.next,l.next=void 0,r&&(l.prev=r,r.next=l)),r=l)};return{get(l){const d=t.get(l);if(d)return i(d),d.value},set(l,d){if(t.size>=e&&s){const m=s;t.delete(m.key),m.next&&(s=m.next,m.next.prev=void 0),m===r&&(r=void 0)}const f=t.get(l);if(f)f.value=d,i(f);else{const m={key:l,value:d,prev:r};r&&(r.next=m),r=m,s||(s=m),t.set(l,m)}},clear(){t.clear(),s=void 0,r=void 0}}}var Tr=4,KS=5;function h_(e){const t=e.indexOf("{");if(t===-1)return null;const s=e.indexOf("}",t);return s===-1||t+1>=e.length?null:[t,s]}function bg(e,t,s=new Uint16Array(6)){const r=e.indexOf("/",t),i=r===-1?e.length:r,l=e.substring(t,i);if(!l||!l.includes("$"))return s[0]=0,s[1]=t,s[2]=t,s[3]=i,s[4]=i,s[5]=i,s;if(l==="$"){const f=e.length;return s[0]=2,s[1]=t,s[2]=t,s[3]=f,s[4]=f,s[5]=f,s}if(l.charCodeAt(0)===36)return s[0]=1,s[1]=t,s[2]=t+1,s[3]=i,s[4]=i,s[5]=i,s;const d=h_(l);if(d){const[f,m]=d,h=l.charCodeAt(f+1);if(h===45){if(f+2<l.length&&l.charCodeAt(f+2)===36){const v=f+3,g=m;if(v<g)return s[0]=3,s[1]=t+f,s[2]=t+v,s[3]=t+g,s[4]=t+m+1,s[5]=i,s}}else if(h===36){const v=f+1,g=f+2;return g===m?(s[0]=2,s[1]=t+f,s[2]=t+v,s[3]=t+g,s[4]=t+m+1,s[5]=e.length,s):(s[0]=1,s[1]=t+f,s[2]=t+g,s[3]=t+m,s[4]=t+m+1,s[5]=i,s)}}return s[0]=0,s[1]=t,s[2]=t,s[3]=i,s[4]=i,s[5]=i,s}function af(e,t,s,r,i,l,d){var m,h,v,g,y,b,S,w,N,C,T,_,R;d==null||d(s);let f=r;{const O=s.fullPath??s.from,B=O.length,L=((m=s.options)==null?void 0:m.caseSensitive)??e,M=!!((v=(h=s.options)==null?void 0:h.params)!=null&&v.parse&&((y=(g=s.options)==null?void 0:g.skipRouteOnParseError)!=null&&y.params));for(;f<B;){const H=bg(O,f,t);let D;const Y=f,K=H[5];switch(f=K+1,l++,H[0]){case 0:{const U=O.substring(H[2],H[3]);if(L){const q=(b=i.static)==null?void 0:b.get(U);if(q)D=q;else{i.static??(i.static=new Map);const A=Ar(s.fullPath??s.from);A.parent=i,A.depth=l,D=A,i.static.set(U,A)}}else{const q=U.toLowerCase(),A=(S=i.staticInsensitive)==null?void 0:S.get(q);if(A)D=A;else{i.staticInsensitive??(i.staticInsensitive=new Map);const $=Ar(s.fullPath??s.from);$.parent=i,$.depth=l,D=$,i.staticInsensitive.set(q,$)}}break}case 1:{const U=O.substring(Y,H[1]),q=O.substring(H[4],K),A=L&&!!(U||q),$=U?A?U:U.toLowerCase():void 0,z=q?A?q:q.toLowerCase():void 0,G=!M&&((w=i.dynamic)==null?void 0:w.find(V=>!V.skipOnParamError&&V.caseSensitive===A&&V.prefix===$&&V.suffix===z));if(G)D=G;else{const V=ep(1,s.fullPath??s.from,A,$,z);D=V,V.depth=l,V.parent=i,i.dynamic??(i.dynamic=[]),i.dynamic.push(V)}break}case 3:{const U=O.substring(Y,H[1]),q=O.substring(H[4],K),A=L&&!!(U||q),$=U?A?U:U.toLowerCase():void 0,z=q?A?q:q.toLowerCase():void 0,G=!M&&((N=i.optional)==null?void 0:N.find(V=>!V.skipOnParamError&&V.caseSensitive===A&&V.prefix===$&&V.suffix===z));if(G)D=G;else{const V=ep(3,s.fullPath??s.from,A,$,z);D=V,V.parent=i,V.depth=l,i.optional??(i.optional=[]),i.optional.push(V)}break}case 2:{const U=O.substring(Y,H[1]),q=O.substring(H[4],K),A=L&&!!(U||q),$=U?A?U:U.toLowerCase():void 0,z=q?A?q:q.toLowerCase():void 0,G=ep(2,s.fullPath??s.from,A,$,z);D=G,G.parent=i,G.depth=l,i.wildcard??(i.wildcard=[]),i.wildcard.push(G)}}i=D}if(M&&s.children&&!s.isRoot&&s.id&&s.id.charCodeAt(s.id.lastIndexOf("/")+1)===95){const H=Ar(s.fullPath??s.from);H.kind=KS,H.parent=i,l++,H.depth=l,i.pathless??(i.pathless=[]),i.pathless.push(H),i=H}const I=(s.path||!s.children)&&!s.isRoot;if(I&&O.endsWith("/")){const H=Ar(s.fullPath??s.from);H.kind=Tr,H.parent=i,l++,H.depth=l,i.index=H,i=H}i.parse=((T=(C=s.options)==null?void 0:C.params)==null?void 0:T.parse)??null,i.skipOnParamError=M,i.parsingPriority=((R=(_=s.options)==null?void 0:_.skipRouteOnParseError)==null?void 0:R.priority)??0,I&&!i.route&&(i.route=s,i.fullPath=s.fullPath??s.from)}if(s.children)for(const O of s.children)af(e,t,O,f,i,l,d)}function Jm(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function Oa(e){var t,s,r;if(e.pathless)for(const i of e.pathless)Oa(i);if(e.static)for(const i of e.static.values())Oa(i);if(e.staticInsensitive)for(const i of e.staticInsensitive.values())Oa(i);if((t=e.dynamic)!=null&&t.length){e.dynamic.sort(Jm);for(const i of e.dynamic)Oa(i)}if((s=e.optional)!=null&&s.length){e.optional.sort(Jm);for(const i of e.optional)Oa(i)}if((r=e.wildcard)!=null&&r.length){e.wildcard.sort(Jm);for(const i of e.wildcard)Oa(i)}}function Ar(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function ep(e,t,s,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:s,prefix:r,suffix:i}}function m_(e,t){const s=Ar("/"),r=new Uint16Array(6);for(const i of e)af(!1,r,i,1,s,0);Oa(s),t.masksTree=s,t.flatCache=Ul(1e3)}function p_(e,t){e||(e="/");const s=t.flatCache.get(e);if(s)return s;const r=Sg(e,t.masksTree);return t.flatCache.set(e,r),r}function g_(e,t,s,r,i){e||(e="/"),r||(r="/");const l=t?`case\0${e}`:e;let d=i.singleCache.get(l);return d||(d=Ar("/"),af(t,new Uint16Array(6),{from:e},1,d,0),i.singleCache.set(l,d)),Sg(r,d,s)}function x_(e,t,s=!1){const r=s?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||(e="/");let l;try{l=Sg(e,t.segmentTree,s)}catch(d){if(d instanceof URIError)l=null;else throw d}return l&&(l.branch=b_(l.route)),t.matchCache.set(r,l),l}function y_(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function v_(e,t=!1,s){const r=Ar(e.fullPath),i=new Uint16Array(6),l={},d={};let f=0;return af(t,i,e,1,r,0,m=>{if(s==null||s(m,f),m.id in l&&Qs(),l[m.id]=m,f!==0&&m.path){const h=y_(m.fullPath);(!d[h]||m.fullPath.endsWith("/"))&&(d[h]=m)}f++}),Oa(r),{processedTree:{segmentTree:r,singleCache:Ul(1e3),matchCache:Ul(1e3),flatCache:null,masksTree:null},routesById:l,routesByPath:d}}function Sg(e,t,s=!1){const r=e.split("/"),i=w_(e,r,t,s);if(!i)return null;const[l]=FS(e,r,i);return{route:i.node.route,rawParams:l,parsedParams:i.parsedParams}}function FS(e,t,s){var v,g,y,b,S,w,N,C,T,_;const r=S_(s.node);let i=null;const l=Object.create(null);let d=((v=s.extract)==null?void 0:v.part)??0,f=((g=s.extract)==null?void 0:g.node)??0,m=((y=s.extract)==null?void 0:y.path)??0,h=((b=s.extract)==null?void 0:b.segment)??0;for(;f<r.length;d++,f++,m++,h++){const R=r[f];if(R.kind===Tr)break;if(R.kind===KS){h--,d--,m--;continue}const O=t[d],B=m;if(O&&(m+=O.length),R.kind===1){i??(i=s.node.fullPath.split("/"));const L=i[h],M=((S=R.prefix)==null?void 0:S.length)??0;if(L.charCodeAt(M)===123){const I=((w=R.suffix)==null?void 0:w.length)??0,H=L.substring(M+2,L.length-I-1),D=O.substring(M,O.length-I);l[H]=decodeURIComponent(D)}else{const I=L.substring(1);l[I]=decodeURIComponent(O)}}else if(R.kind===3){if(s.skipped&1<<f){d--,m=B-1;continue}i??(i=s.node.fullPath.split("/"));const L=i[h],M=((N=R.prefix)==null?void 0:N.length)??0,I=((C=R.suffix)==null?void 0:C.length)??0,H=L.substring(M+3,L.length-I-1),D=R.suffix||R.prefix?O.substring(M,O.length-I):O;D&&(l[H]=decodeURIComponent(D))}else if(R.kind===2){const L=R,M=e.substring(B+(((T=L.prefix)==null?void 0:T.length)??0),e.length-(((_=L.suffix)==null?void 0:_.length)??0)),I=decodeURIComponent(M);l["*"]=I,l._splat=I;break}}return s.rawParams&&Object.assign(l,s.rawParams),[l,{part:d,node:f,path:m,segment:h}]}function b_(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function S_(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function w_(e,t,s,r){if(e==="/"&&s.index)return{node:s.index,skipped:0};const i=!Bl(t),l=i&&e!=="/",d=t.length-(i?1:0),f=[{node:s,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let m=null,h=null,v=null;for(;f.length;){const g=f.pop(),{node:y,index:b,skipped:S,depth:w,statics:N,dynamics:C,optionals:T}=g;let{extract:_,rawParams:R,parsedParams:O}=g;if(y.skipOnParamError){if(!tp(e,t,g))continue;R=g.rawParams,_=g.extract,O=g.parsedParams}r&&y.route&&y.kind!==Tr&&jl(h,g)&&(h=g);const B=b===d;if(B&&(y.route&&!l&&jl(v,g)&&(v=g),!y.optional&&!y.wildcard&&!y.index&&!y.pathless))continue;const L=B?void 0:t[b];let M;if(B&&y.index){const I={node:y.index,index:b,skipped:S,depth:w+1,statics:N,dynamics:C,optionals:T,extract:_,rawParams:R,parsedParams:O};let H=!0;if(y.index.skipOnParamError&&(tp(e,t,I)||(H=!1)),H){if(N===d&&!C&&!T&&!S)return I;jl(v,I)&&(v=I)}}if(y.wildcard&&jl(m,g))for(const I of y.wildcard){const{prefix:H,suffix:D}=I;if(H&&(B||!(I.caseSensitive?L:M??(M=L.toLowerCase())).startsWith(H)))continue;if(D){if(B)continue;const K=t.slice(b).join("/").slice(-D.length);if((I.caseSensitive?K:K.toLowerCase())!==D)continue}const Y={node:I,index:d,skipped:S,depth:w,statics:N,dynamics:C,optionals:T,extract:_,rawParams:R,parsedParams:O};if(!(I.skipOnParamError&&!tp(e,t,Y))){m=Y;break}}if(y.optional){const I=S|1<<w,H=w+1;for(let D=y.optional.length-1;D>=0;D--){const Y=y.optional[D];f.push({node:Y,index:b,skipped:I,depth:H,statics:N,dynamics:C,optionals:T,extract:_,rawParams:R,parsedParams:O})}if(!B)for(let D=y.optional.length-1;D>=0;D--){const Y=y.optional[D],{prefix:K,suffix:U}=Y;if(K||U){const q=Y.caseSensitive?L:M??(M=L.toLowerCase());if(K&&!q.startsWith(K)||U&&!q.endsWith(U))continue}f.push({node:Y,index:b+1,skipped:S,depth:H,statics:N,dynamics:C,optionals:T+1,extract:_,rawParams:R,parsedParams:O})}}if(!B&&y.dynamic&&L)for(let I=y.dynamic.length-1;I>=0;I--){const H=y.dynamic[I],{prefix:D,suffix:Y}=H;if(D||Y){const K=H.caseSensitive?L:M??(M=L.toLowerCase());if(D&&!K.startsWith(D)||Y&&!K.endsWith(Y))continue}f.push({node:H,index:b+1,skipped:S,depth:w+1,statics:N,dynamics:C+1,optionals:T,extract:_,rawParams:R,parsedParams:O})}if(!B&&y.staticInsensitive){const I=y.staticInsensitive.get(M??(M=L.toLowerCase()));I&&f.push({node:I,index:b+1,skipped:S,depth:w+1,statics:N+1,dynamics:C,optionals:T,extract:_,rawParams:R,parsedParams:O})}if(!B&&y.static){const I=y.static.get(L);I&&f.push({node:I,index:b+1,skipped:S,depth:w+1,statics:N+1,dynamics:C,optionals:T,extract:_,rawParams:R,parsedParams:O})}if(y.pathless){const I=w+1;for(let H=y.pathless.length-1;H>=0;H--){const D=y.pathless[H];f.push({node:D,index:b,skipped:S,depth:I,statics:N,dynamics:C,optionals:T,extract:_,rawParams:R,parsedParams:O})}}}if(v&&m)return jl(m,v)?v:m;if(v)return v;if(m)return m;if(r&&h){let g=h.index;for(let b=0;b<h.index;b++)g+=t[b].length;const y=g===e.length?"/":e.slice(g);return h.rawParams??(h.rawParams=Object.create(null)),h.rawParams["**"]=decodeURIComponent(y),h}return null}function tp(e,t,s){try{const[r,i]=FS(e,t,s);s.rawParams=r,s.extract=i;const l=s.node.parse(r);return s.parsedParams=Object.assign(Object.create(null),s.parsedParams,l),!0}catch{return null}}function jl(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===Tr)>(e.node.kind===Tr)||t.node.kind===Tr==(e.node.kind===Tr)&&t.depth>e.depth))):!0}function Sd(e){return wg(e.filter(t=>t!==void 0).join("/"))}function wg(e){return e.replace(/\/{2,}/g,"/")}function XS(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Qa(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function ZS(e){return Qa(XS(e))}function Ld(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function N_(e,t,s){return Ld(e,s)===Ld(t,s)}function j_({base:e,to:t,trailingSlash:s="never",cache:r}){const i=t.startsWith("/"),l=!i&&t===".";let d;if(r){d=i?t:l?e:e+"\0"+t;const g=r.get(d);if(g)return g}let f;if(l)f=e.split("/");else if(i)f=t.split("/");else{for(f=e.split("/");f.length>1&&Bl(f)==="";)f.pop();const g=t.split("/");for(let y=0,b=g.length;y<b;y++){const S=g[y];S===""?y?y===b-1&&f.push(S):f=[S]:S===".."?f.pop():S==="."||f.push(S)}}f.length>1&&(Bl(f)===""?s==="never"&&f.pop():s==="always"&&f.push(""));let m,h="";for(let g=0;g<f.length;g++){g>0&&(h+="/");const y=f[g];if(!y)continue;m=bg(y,0,m);const b=m[0];if(b===0){h+=y;continue}const S=m[5],w=y.substring(0,m[1]),N=y.substring(m[4],S),C=y.substring(m[2],m[3]);b===1?h+=w||N?`${w}{$${C}}${N}`:`$${C}`:b===2?h+=w||N?`${w}{$}${N}`:"$":h+=`${w}{-$${C}}${N}`}h=wg(h);const v=h||"/";return d&&r&&r.set(d,v),v}function E_(e){const t=new Map(e.map(i=>[encodeURIComponent(i),i])),s=Array.from(t.keys()).map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),r=new RegExp(s,"g");return i=>i.replace(r,l=>t.get(l)??l)}function np(e,t,s){const r=t[e];return typeof r!="string"?r:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split("/").map(i=>vb(i,s)).join("/"):vb(r,s)}function yb({path:e,params:t,decoder:s,...r}){let i=!1;const l=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:l,isMissingParams:i};if(!e.includes("$"))return{interpolatedPath:e,usedParams:l,isMissingParams:i};const d=e.length;let f=0,m,h="";for(;f<d;){const v=f;m=bg(e,v,m);const g=m[5];if(f=g+1,v===g)continue;const y=m[0];if(y===0){h+="/"+e.substring(v,g);continue}if(y===2){const b=t._splat;l._splat=b,l["*"]=b;const S=e.substring(v,m[1]),w=e.substring(m[4],g);if(!b){i=!0,(S||w)&&(h+="/"+S+w);continue}const N=np("_splat",t,s);h+="/"+S+N+w;continue}if(y===1){const b=e.substring(m[2],m[3]);!i&&!(b in t)&&(i=!0),l[b]=t[b];const S=e.substring(v,m[1]),w=e.substring(m[4],g),N=np(b,t,s)??"undefined";h+="/"+S+N+w;continue}if(y===3){const b=e.substring(m[2],m[3]),S=t[b];if(S==null)continue;l[b]=S;const w=e.substring(v,m[1]),N=e.substring(m[4],g),C=np(b,t,s)??"";h+="/"+w+C+N;continue}}return e.endsWith("/")&&(h+="/"),{usedParams:l,interpolatedPath:h||"/",isMissingParams:i}}function vb(e,t){const s=encodeURIComponent(e);return(t==null?void 0:t(s))??s}function Ft(e){return!!(e!=null&&e.isNotFound)}function C_(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}var kp="tsr-scroll-restoration-v1_3",__=(e,t)=>{let s;return(...r)=>{s||(s=setTimeout(()=>{e(...r),s=null},t))}};function R_(){const e=C_();if(!e)return null;const t=e.getItem(kp);let s=t?JSON.parse(t):{};return{state:s,set:r=>{s=Va(r,s)||s;try{e.setItem(kp,JSON.stringify(s))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}var Fu=R_(),T_=e=>e.state.__TSR_key||e.href;function A_(e){const t=[];let s;for(;s=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(s.children,e)+1})`),e=s;return`${t.reverse().join(" > ")}`.toLowerCase()}var zd=!1;function M_({storageKey:e,key:t,behavior:s,shouldScrollRestoration:r,scrollToTopSelectors:i,location:l}){var h,v;let d;try{d=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(g){console.error(g);return}const f=t||((h=window.history.state)==null?void 0:h.__TSR_key),m=d[f];zd=!0;e:{if(r&&m&&Object.keys(m).length>0){for(const b in m){const S=m[b];if(b==="window")window.scrollTo({top:S.scrollY,left:S.scrollX,behavior:s});else if(b){const w=document.querySelector(b);w&&(w.scrollLeft=S.scrollX,w.scrollTop=S.scrollY)}}break e}const g=(l??window.location).hash.split("#",2)[1];if(g){const b=((v=window.history.state)==null?void 0:v.__hashScrollIntoViewOptions)??!0;if(b){const S=document.getElementById(g);S&&S.scrollIntoView(b)}break e}const y={top:0,left:0,behavior:s};if(window.scrollTo(y),i)for(const b of i){if(b==="window")continue;const S=typeof b=="function"?b():document.querySelector(b);S&&S.scrollTo(y)}}zd=!1}function k_(e,t){if(!Fu||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!Fu))return;e.isScrollRestorationSetup=!0,zd=!1;const s=e.options.getScrollRestorationKey||T_;window.history.scrollRestoration="manual";const r=i=>{if(zd||!e.isScrollRestoring)return;let l="";if(i.target===document||i.target===window)l="window";else{const f=i.target.getAttribute("data-scroll-restoration-id");f?l=`[data-scroll-restoration-id="${f}"]`:l=A_(i.target)}const d=s(e.stores.location.state);Fu.set(f=>{const m=f[d]||(f[d]={}),h=m[l]||(m[l]={});if(l==="window")h.scrollX=window.scrollX||0,h.scrollY=window.scrollY||0;else if(l){const v=document.querySelector(l);v&&(h.scrollX=v.scrollLeft||0,h.scrollY=v.scrollTop||0)}return f})};typeof document<"u"&&document.addEventListener("scroll",__(r,100),!0),e.subscribe("onRendered",i=>{const l=s(i.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(M_({storageKey:kp,key:l,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&Fu.set(d=>(d[l]||(d[l]={}),d)))})}function O_(e){if(typeof document<"u"&&document.querySelector){const t=e.stores.location.state,s=t.state.__hashScrollIntoViewOptions??!0;if(s&&t.hash!==""){const r=document.getElementById(t.hash);r&&r.scrollIntoView(s)}}}function D_(e,t=String){const s=new URLSearchParams;for(const r in e){const i=e[r];i!==void 0&&s.set(r,t(i))}return s.toString()}function sp(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function L_(e){const t=new URLSearchParams(e),s=Object.create(null);for(const[r,i]of t.entries()){const l=s[r];l==null?s[r]=sp(i):Array.isArray(l)?l.push(sp(i)):s[r]=[l,sp(i)]}return s}var z_=I_(JSON.parse),P_=B_(JSON.stringify,JSON.parse);function I_(e){return t=>{t[0]==="?"&&(t=t.substring(1));const s=L_(t);for(const r in s){const i=s[r];if(typeof i=="string")try{s[r]=e(i)}catch{}}return s}}function B_(e,t){const s=typeof t=="function";function r(i){if(typeof i=="object"&&i!==null)try{return e(i)}catch{}else if(s&&typeof i=="string")try{return t(i),e(i)}catch{}return i}return i=>{const l=D_(i,r);return l?`?${l}`:""}}var Gr="__root__";function H_(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const s=new Response(null,{status:e.statusCode,headers:t});if(s.options=e,e.throw)throw s;return s}function ln(e){return e instanceof Response&&!!e.options}function U_(e){return{input:({url:t})=>{for(const s of e)t=Op(s,t);return t},output:({url:t})=>{for(let s=e.length-1;s>=0;s--)t=WS(e[s],t);return t}}}function $_(e){const t=ZS(e.basepath),s=`/${t}`,r=`${s}/`,i=e.caseSensitive?s:s.toLowerCase(),l=e.caseSensitive?r:r.toLowerCase();return{input:({url:d})=>{const f=e.caseSensitive?d.pathname:d.pathname.toLowerCase();return f===i?d.pathname="/":f.startsWith(l)&&(d.pathname=d.pathname.slice(s.length)),d},output:({url:d})=>(d.pathname=Sd(["/",t,d.pathname]),d)}}function Op(e,t){var r;const s=(r=e==null?void 0:e.input)==null?void 0:r.call(e,{url:t});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return t}function WS(e,t){var r;const s=(r=e==null?void 0:e.output)==null?void 0:r.call(e,{url:t});if(s){if(typeof s=="string")return new URL(s);if(s instanceof URL)return s}return t}function q_(e,t){const{createMutableStore:s,createReadonlyStore:r,batch:i,init:l}=t,d=new Map,f=new Map,m=new Map,h=s(e.status),v=s(e.loadedAt),g=s(e.isLoading),y=s(e.isTransitioning),b=s(e.location),S=s(e.resolvedLocation),w=s(e.statusCode),N=s(e.redirect),C=s([]),T=s([]),_=s([]),R=r(()=>ap(d,C.state)),O=r(()=>ap(f,T.state)),B=r(()=>ap(m,_.state)),L=r(()=>C.state[0]),M=r(()=>C.state.some($=>{var z;return((z=d.get($))==null?void 0:z.state.status)==="pending"})),I=r(()=>{var $;return{locationHref:b.state.href,resolvedLocationHref:($=S.state)==null?void 0:$.href,status:h.state}}),H=r(()=>({status:h.state,loadedAt:v.state,isLoading:g.state,isTransitioning:y.state,matches:R.state,location:b.state,resolvedLocation:S.state,statusCode:w.state,redirect:N.state})),D=Ul(64);function Y($){let z=D.get($);return z||(z=r(()=>{const G=C.state;for(const V of G){const P=d.get(V);if(P&&P.routeId===$)return P.state}}),D.set($,z)),z}const K={status:h,loadedAt:v,isLoading:g,isTransitioning:y,location:b,resolvedLocation:S,statusCode:w,redirect:N,matchesId:C,pendingMatchesId:T,cachedMatchesId:_,activeMatchesSnapshot:R,pendingMatchesSnapshot:O,cachedMatchesSnapshot:B,firstMatchId:L,hasPendingMatches:M,matchRouteReactivity:I,activeMatchStoresById:d,pendingMatchStoresById:f,cachedMatchStoresById:m,__store:H,getMatchStoreByRouteId:Y,setActiveMatches:U,setPendingMatches:q,setCachedMatches:A};U(e.matches),l==null||l(K);function U($){rp($,d,C,s,i)}function q($){rp($,f,T,s,i)}function A($){rp($,m,_,s,i)}return K}function ap(e,t){const s=[];for(const r of t){const i=e.get(r);i&&s.push(i.state)}return s}function rp(e,t,s,r,i){const l=e.map(f=>f.id),d=new Set(l);i(()=>{for(const f of t.keys())d.has(f)||t.delete(f);for(const f of e){const m=t.get(f.id);if(!m){const h=r(f);h.routeId=f.routeId,t.set(f.id,h);continue}m.routeId=f.routeId,m.state!==f&&m.setState(()=>f)}f_(s.state,l)||s.setState(()=>l)})}var Dp=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},V_=e=>e.stores.matchesId.state.some(t=>{var s;return(s=e.stores.activeMatchStoresById.get(t))==null?void 0:s.state._forcePending}),rf=(e,t)=>!!(e.preload&&!e.router.stores.activeMatchStoresById.has(t)),Yr=(e,t,s=!0)=>{const r={...e.router.options.context??{}},i=s?t:t-1;for(let l=0;l<=i;l++){const d=e.matches[l];if(!d)continue;const f=e.router.getMatch(d.id);f&&Object.assign(r,f.__routeContext,f.__beforeLoadContext)}return r},bb=(e,t)=>{if(!e.matches.length)return;const s=t.routeId,r=e.matches.findIndex(d=>d.routeId===e.router.routeTree.id),i=r>=0?r:0;let l=s?e.matches.findIndex(d=>d.routeId===s):e.firstBadMatchIndex??e.matches.length-1;l<0&&(l=i);for(let d=l;d>=0;d--){const f=e.matches[d];if(e.router.looseRoutesById[f.routeId].options.notFoundComponent)return d}return s?l:i},Ya=(e,t,s)=>{var r,i,l;if(!(!ln(s)&&!Ft(s)))throw ln(s)&&s.redirectHandled&&!s.options.reloadDocument||(t&&((r=t._nonReactive.beforeLoadPromise)==null||r.resolve(),(i=t._nonReactive.loaderPromise)==null||i.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=s,e.updateMatch(t.id,d=>({...d,status:ln(s)?"redirected":d.status==="pending"?"success":d.status,context:Yr(e,t.index),isFetching:!1,error:s})),Ft(s)&&!s.routeId&&(s.routeId=t.routeId),(l=t._nonReactive.loadPromise)==null||l.resolve()),ln(s)&&(e.rendered=!0,s.options._fromLocation=e.location,s.redirectHandled=!0,s=e.router.resolveRedirect(s))),s},JS=(e,t)=>{const s=e.router.getMatch(t);return!!(!s||s._nonReactive.dehydrated)},Sb=(e,t,s)=>{const r=Yr(e,s);e.updateMatch(t,i=>({...i,context:r}))},El=(e,t,s,r)=>{var f,m;const{id:i,routeId:l}=e.matches[t],d=e.router.looseRoutesById[l];if(s instanceof Promise)throw s;s.routerCode=r,e.firstBadMatchIndex??(e.firstBadMatchIndex=t),Ya(e,e.router.getMatch(i),s);try{(m=(f=d.options).onError)==null||m.call(f,s)}catch(h){s=h,Ya(e,e.router.getMatch(i),s)}e.updateMatch(i,h=>{var v,g;return(v=h._nonReactive.beforeLoadPromise)==null||v.resolve(),h._nonReactive.beforeLoadPromise=void 0,(g=h._nonReactive.loadPromise)==null||g.resolve(),{...h,error:s,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController}}),!e.preload&&!ln(s)&&!Ft(s)&&(e.serialError??(e.serialError=s))},ew=(e,t,s,r)=>{var l;if(r._nonReactive.pendingTimeout!==void 0)return;const i=s.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!rf(e,t)&&(s.options.loader||s.options.beforeLoad||nw(s))&&typeof i=="number"&&i!==1/0&&(s.options.pendingComponent??((l=e.router.options)==null?void 0:l.defaultPendingComponent))){const d=setTimeout(()=>{Dp(e)},i);r._nonReactive.pendingTimeout=d}},G_=(e,t,s)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;ew(e,t,s,r);const i=()=>{const l=e.router.getMatch(t);l.preload&&(l.status==="redirected"||l.status==="notFound")&&Ya(e,l,l.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},Y_=(e,t,s,r)=>{const i=e.router.getMatch(t);let l=i._nonReactive.loadPromise;i._nonReactive.loadPromise=xo(()=>{l==null||l.resolve(),l=void 0});const{paramsError:d,searchError:f}=i;d&&El(e,s,d,"PARSE_PARAMS"),f&&El(e,s,f,"VALIDATE_SEARCH"),ew(e,t,r,i);const m=new AbortController;let h=!1;const v=()=>{h||(h=!0,e.updateMatch(t,R=>({...R,isFetching:"beforeLoad",fetchCount:R.fetchCount+1,abortController:m})))},g=()=>{var R;(R=i._nonReactive.beforeLoadPromise)==null||R.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,O=>({...O,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{v(),g()});return}i._nonReactive.beforeLoadPromise=xo();const y={...Yr(e,s,!1),...i.__routeContext},{search:b,params:S,cause:w}=i,N=rf(e,t),C={search:b,abortController:m,params:S,preload:N,context:y,location:e.location,navigate:R=>e.router.navigate({...R,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:N?"preload":w,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},T=R=>{if(R===void 0){e.router.batch(()=>{v(),g()});return}(ln(R)||Ft(R))&&(v(),El(e,s,R,"BEFORE_LOAD")),e.router.batch(()=>{v(),e.updateMatch(t,O=>({...O,__beforeLoadContext:R})),g()})};let _;try{if(_=r.options.beforeLoad(C),Hl(_))return v(),_.catch(R=>{El(e,s,R,"BEFORE_LOAD")}).then(T)}catch(R){v(),El(e,s,R,"BEFORE_LOAD")}T(_)},Q_=(e,t)=>{const{id:s,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],l=()=>f(),d=()=>Y_(e,s,t,i),f=()=>{if(JS(e,s))return;const m=G_(e,s,i);return Hl(m)?m.then(d):d()};return l()},K_=(e,t,s)=>{var l,d,f,m,h,v;const r=e.router.getMatch(t);if(!r||!s.options.head&&!s.options.scripts&&!s.options.headers)return;const i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([(d=(l=s.options).head)==null?void 0:d.call(l,i),(m=(f=s.options).scripts)==null?void 0:m.call(f,i),(v=(h=s.options).headers)==null?void 0:v.call(h,i)]).then(([g,y,b])=>({meta:g==null?void 0:g.meta,links:g==null?void 0:g.links,headScripts:g==null?void 0:g.scripts,headers:b,scripts:y,styles:g==null?void 0:g.styles}))},tw=(e,t,s,r,i)=>{const l=t[r-1],{params:d,loaderDeps:f,abortController:m,cause:h}=e.router.getMatch(s),v=Yr(e,r),g=rf(e,s);return{params:d,deps:f,preload:!!g,parentMatchPromise:l,abortController:m,context:v,location:e.location,navigate:y=>e.router.navigate({...y,_fromLocation:e.location}),cause:g?"preload":h,route:i,...e.router.options.additionalContext}},wb=async(e,t,s,r,i)=>{var l,d,f,m,h;try{const v=e.router.getMatch(s);try{(!(r_??e.router.isServer)||v.ssr===!0)&&$l(i);const g=i.options.loader,y=typeof g=="function"?g:g==null?void 0:g.handler,b=y==null?void 0:y(tw(e,t,s,r,i)),S=!!y&&Hl(b);if((S||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||v._nonReactive.minPendingPromise)&&e.updateMatch(s,N=>({...N,isFetching:"loader"})),y){const N=S?await b:b;Ya(e,e.router.getMatch(s),N),N!==void 0&&e.updateMatch(s,C=>({...C,loaderData:N}))}i._lazyPromise&&await i._lazyPromise;const w=v._nonReactive.minPendingPromise;w&&await w,i._componentsPromise&&await i._componentsPromise,e.updateMatch(s,N=>({...N,error:void 0,context:Yr(e,r),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(g){let y=g;if((y==null?void 0:y.name)==="AbortError"){if(v.abortController.signal.aborted){(l=v._nonReactive.loaderPromise)==null||l.resolve(),v._nonReactive.loaderPromise=void 0;return}e.updateMatch(s,S=>({...S,status:S.status==="pending"?"success":S.status,isFetching:!1,context:Yr(e,r)}));return}const b=v._nonReactive.minPendingPromise;b&&await b,Ft(g)&&await((f=(d=i.options.notFoundComponent)==null?void 0:d.preload)==null?void 0:f.call(d)),Ya(e,e.router.getMatch(s),g);try{(h=(m=i.options).onError)==null||h.call(m,g)}catch(S){y=S,Ya(e,e.router.getMatch(s),S)}!ln(y)&&!Ft(y)&&await $l(i,["errorComponent"]),e.updateMatch(s,S=>({...S,error:y,context:Yr(e,r),status:"error",isFetching:!1}))}}catch(v){const g=e.router.getMatch(s);g&&(g._nonReactive.loaderPromise=void 0),Ya(e,g,v)}},F_=async(e,t,s)=>{var b,S,w,N;async function r(C,T,_,R,O){const B=Date.now()-T.updatedAt,L=C?O.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:O.options.staleTime??e.router.options.defaultStaleTime??0,M=O.options.shouldReload,I=typeof M=="function"?M(tw(e,t,i,s,O)):M,{status:H,invalid:D}=R,Y=B>=L&&(!!e.forceStaleReload||R.cause==="enter"||_!==void 0&&_!==R.id);d=H==="success"&&(D||(I??Y)),C&&O.options.preload===!1||(d&&!e.sync&&v?(f=!0,(async()=>{var K,U;try{await wb(e,t,i,s,O);const q=e.router.getMatch(i);(K=q._nonReactive.loaderPromise)==null||K.resolve(),(U=q._nonReactive.loadPromise)==null||U.resolve(),q._nonReactive.loaderPromise=void 0,q._nonReactive.loadPromise=void 0}catch(q){ln(q)&&await e.router.navigate(q.options)}})()):H!=="success"||d?await wb(e,t,i,s,O):Sb(e,i,s))}const{id:i,routeId:l}=e.matches[s];let d=!1,f=!1;const m=e.router.looseRoutesById[l],h=m.options.loader,v=((typeof h=="function"||h==null?void 0:h.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(JS(e,i)){if(!e.router.getMatch(i))return e.matches[s];Sb(e,i,s)}else{const C=e.router.getMatch(i),T=e.router.stores.matchesId.state[s],_=((b=T&&e.router.stores.activeMatchStoresById.get(T)||null)==null?void 0:b.routeId)===l?T:(S=e.router.stores.activeMatchesSnapshot.state.find(O=>O.routeId===l))==null?void 0:S.id,R=rf(e,i);if(C._nonReactive.loaderPromise){if(C.status==="success"&&!e.sync&&!C.preload&&v)return C;await C._nonReactive.loaderPromise;const O=e.router.getMatch(i),B=O._nonReactive.error||O.error;B&&Ya(e,O,B),O.status==="pending"&&await r(R,C,_,O,m)}else{const O=R&&!e.router.stores.activeMatchStoresById.has(i),B=e.router.getMatch(i);B._nonReactive.loaderPromise=xo(),O!==B.preload&&e.updateMatch(i,L=>({...L,preload:O})),await r(R,C,_,B,m)}}const g=e.router.getMatch(i);f||((w=g._nonReactive.loaderPromise)==null||w.resolve(),(N=g._nonReactive.loadPromise)==null||N.resolve(),g._nonReactive.loadPromise=void 0),clearTimeout(g._nonReactive.pendingTimeout),g._nonReactive.pendingTimeout=void 0,f||(g._nonReactive.loaderPromise=void 0),g._nonReactive.dehydrated=void 0;const y=f?g.isFetching:!1;return y!==g.isFetching||g.invalid!==!1?(e.updateMatch(i,C=>({...C,isFetching:y,invalid:!1})),e.router.getMatch(i)):g};async function Nb(e){var y,b;const t=e,s=[];V_(t.router)&&Dp(t);let r;for(let S=0;S<t.matches.length;S++){try{const w=Q_(t,S);Hl(w)&&await w}catch(w){if(ln(w))throw w;if(Ft(w))r=w;else if(!t.preload)throw w;break}if(t.serialError)break}const i=t.firstBadMatchIndex??t.matches.length,l=r&&!t.preload?bb(t,r):void 0,d=r&&t.preload?0:l!==void 0?Math.min(l+1,i):i;let f,m;for(let S=0;S<d;S++)s.push(F_(t,s,S));try{await Promise.all(s)}catch{const S=await Promise.allSettled(s);for(const w of S){if(w.status!=="rejected")continue;const N=w.reason;if(ln(N))throw N;Ft(N)?f??(f=N):m??(m=N)}if(m!==void 0)throw m}const h=f??(r&&!t.preload?r:void 0);let v=t.serialError?t.firstBadMatchIndex??0:t.matches.length-1;if(!h&&r&&t.preload)return t.matches;if(h){const S=bb(t,h);S===void 0&&Qs();const w=t.matches[S],N=t.router.looseRoutesById[w.routeId],C=(y=t.router.options)==null?void 0:y.defaultNotFoundComponent;!N.options.notFoundComponent&&C&&(N.options.notFoundComponent=C),h.routeId=w.routeId;const T=w.routeId===t.router.routeTree.id;t.updateMatch(w.id,_=>({..._,...T?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:h},isFetching:!1})),v=S,await $l(N,["notFoundComponent"])}else if(!t.preload){const S=t.matches[0];S.globalNotFound||(b=t.router.getMatch(S.id))!=null&&b.globalNotFound&&t.updateMatch(S.id,w=>({...w,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const S=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await $l(S,["errorComponent"])}for(let S=0;S<=v;S++){const{id:w,routeId:N}=t.matches[S],C=t.router.looseRoutesById[N];try{const T=K_(t,w,C);if(T){const _=await T;t.updateMatch(w,R=>({...R,..._}))}}catch(T){console.error(`Error executing head for route ${N}:`,T)}}const g=Dp(t);if(Hl(g)&&await g,h)throw h;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function jb(e,t){const s=t.map(r=>{var i,l;return(l=(i=e.options[r])==null?void 0:i.preload)==null?void 0:l.call(i)}).filter(Boolean);if(s.length!==0)return Promise.all(s)}function $l(e,t=wd){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(r=>{const{id:i,...l}=r.options;Object.assign(e.options,l),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const s=()=>e._componentsLoaded?void 0:t===wd?(()=>{if(e._componentsPromise===void 0){const r=jb(e,wd);r?e._componentsPromise=r.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():jb(e,t);return e._lazyPromise?e._lazyPromise.then(s):s()}function nw(e){var t;for(const s of wd)if((t=e.options[s])!=null&&t.preload)return!0;return!1}var wd=["component","errorComponent","pendingComponent","notFoundComponent"],Ka="__TSR_index",Eb="popstate",Cb="beforeunload";function X_(e){let t=e.getLocation();const s=new Set,r=d=>{t=e.getLocation(),s.forEach(f=>f({location:t,action:d}))},i=d=>{e.notifyOnIndexChange??!0?r(d):t=e.getLocation()},l=async({task:d,navigateOpts:f,...m})=>{var g,y;if((f==null?void 0:f.ignoreBlocker)??!1){d();return}const h=((g=e.getBlockers)==null?void 0:g.call(e))??[],v=m.type==="PUSH"||m.type==="REPLACE";if(typeof document<"u"&&h.length&&v)for(const b of h){const S=Pd(m.path,m.state);if(await b.blockerFn({currentLocation:t,nextLocation:S,action:m.type})){(y=e.onBlocked)==null||y.call(e);return}}d()};return{get location(){return t},get length(){return e.getLength()},subscribers:s,subscribe:d=>(s.add(d),()=>{s.delete(d)}),push:(d,f,m)=>{const h=t.state[Ka];f=_b(h+1,f),l({task:()=>{e.pushState(d,f),r({type:"PUSH"})},navigateOpts:m,type:"PUSH",path:d,state:f})},replace:(d,f,m)=>{const h=t.state[Ka];f=_b(h,f),l({task:()=>{e.replaceState(d,f),r({type:"REPLACE"})},navigateOpts:m,type:"REPLACE",path:d,state:f})},go:(d,f)=>{l({task:()=>{e.go(d),i({type:"GO",index:d})},navigateOpts:f,type:"GO"})},back:d=>{l({task:()=>{e.back((d==null?void 0:d.ignoreBlocker)??!1),i({type:"BACK"})},navigateOpts:d,type:"BACK"})},forward:d=>{l({task:()=>{e.forward((d==null?void 0:d.ignoreBlocker)??!1),i({type:"FORWARD"})},navigateOpts:d,type:"FORWARD"})},canGoBack:()=>t.state[Ka]!==0,createHref:d=>e.createHref(d),block:d=>{var m;if(!e.setBlockers)return()=>{};const f=((m=e.getBlockers)==null?void 0:m.call(e))??[];return e.setBlockers([...f,d]),()=>{var v,g;const h=((v=e.getBlockers)==null?void 0:v.call(e))??[];(g=e.setBlockers)==null||g.call(e,h.filter(y=>y!==d))}},flush:()=>{var d;return(d=e.flush)==null?void 0:d.call(e)},destroy:()=>{var d;return(d=e.destroy)==null?void 0:d.call(e)},notify:r}}function _b(e,t){t||(t={});const s=Ng();return{...t,key:s,__TSR_key:s,[Ka]:e}}function Z_(e){var M,I;const t=typeof document<"u"?window:void 0,s=t.history.pushState,r=t.history.replaceState;let i=[];const l=()=>i,d=H=>i=H,f=(H=>H),m=(()=>Pd(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((M=t.history.state)!=null&&M.__TSR_key)&&!((I=t.history.state)!=null&&I.key)){const H=Ng();t.history.replaceState({[Ka]:0,key:H,__TSR_key:H},"")}let h=m(),v,g=!1,y=!1,b=!1,S=!1;const w=()=>h;let N,C;const T=()=>{N&&(L._ignoreSubscribers=!0,(N.isPush?t.history.pushState:t.history.replaceState)(N.state,"",N.href),L._ignoreSubscribers=!1,N=void 0,C=void 0,v=void 0)},_=(H,D,Y)=>{const K=f(D);C||(v=h),h=Pd(D,Y),N={href:K,state:Y,isPush:(N==null?void 0:N.isPush)||H==="push"},C||(C=Promise.resolve().then(()=>T()))},R=H=>{h=m(),L.notify({type:H})},O=async()=>{if(y){y=!1;return}const H=m(),D=H.state[Ka]-h.state[Ka],Y=D===1,K=D===-1,U=!Y&&!K||g;g=!1;const q=U?"GO":K?"BACK":"FORWARD",A=U?{type:"GO",index:D}:{type:K?"BACK":"FORWARD"};if(b)b=!1;else{const $=l();if(typeof document<"u"&&$.length){for(const z of $)if(await z.blockerFn({currentLocation:h,nextLocation:H,action:q})){y=!0,t.history.go(1),L.notify(A);return}}}h=m(),L.notify(A)},B=H=>{if(S){S=!1;return}let D=!1;const Y=l();if(typeof document<"u"&&Y.length)for(const K of Y){const U=K.enableBeforeUnload??!0;if(U===!0){D=!0;break}if(typeof U=="function"&&U()===!0){D=!0;break}}if(D)return H.preventDefault(),H.returnValue=""},L=X_({getLocation:w,getLength:()=>t.history.length,pushState:(H,D)=>_("push",H,D),replaceState:(H,D)=>_("replace",H,D),back:H=>(H&&(b=!0),S=!0,t.history.back()),forward:H=>{H&&(b=!0),S=!0,t.history.forward()},go:H=>{g=!0,t.history.go(H)},createHref:H=>f(H),flush:T,destroy:()=>{t.history.pushState=s,t.history.replaceState=r,t.removeEventListener(Cb,B,{capture:!0}),t.removeEventListener(Eb,O)},onBlocked:()=>{v&&h!==v&&(h=v)},getBlockers:l,setBlockers:d,notifyOnIndexChange:!1});return t.addEventListener(Cb,B,{capture:!0}),t.addEventListener(Eb,O),t.history.pushState=function(...H){const D=s.apply(t.history,H);return L._ignoreSubscribers||R("PUSH"),D},t.history.replaceState=function(...H){const D=r.apply(t.history,H);return L._ignoreSubscribers||R("REPLACE"),D},L}function W_(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Pd(e,t){const s=W_(e),r=s.indexOf("#"),i=s.indexOf("?"),l=Ng();return{href:s,pathname:s.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:s.length),hash:r>-1?s.substring(r):"",search:i>-1?s.slice(i,r===-1?void 0:r):"",state:t||{[Ka]:0,key:l,__TSR_key:l}}}function Ng(){return(Math.random()+1).toString(36).substring(7)}function eo(e,t){const s=t,r=e;return{fromLocation:s,toLocation:r,pathChanged:(s==null?void 0:s.pathname)!==r.pathname,hrefChanged:(s==null?void 0:s.href)!==r.href,hashChanged:(s==null?void 0:s.hash)!==r.hash}}var J_=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=s=>s(),this.update=s=>{var v;const r=this.options,i=this.basepath??(r==null?void 0:r.basepath)??"/",l=this.basepath===void 0,d=r==null?void 0:r.rewrite;if(this.options={...r,...s},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=E_(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=Z_()),this.origin=this.options.origin,this.origin||(window!=null&&window.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let g;this.resolvePathCache=Ul(1e3),g=this.buildRouteTree(),this.setRoutes(g)}if(!this.stores&&this.latestLocation){const g=this.getStoreConfig(this);this.batch=g.batch,this.stores=q_(tR(this.latestLocation),g),k_(this)}let f=!1;const m=this.options.basepath??"/",h=this.options.rewrite;if(l||i!==m||d!==h){this.basepath=m;const g=[],y=ZS(m);y&&y!=="/"&&g.push($_({basepath:m})),h&&g.push(h),this.rewrite=g.length===0?void 0:g.length===1?g[0]:U_(g),this.history&&this.updateLatestLocation(),f=!0}f&&this.stores&&this.stores.location.setState(()=>this.latestLocation),typeof window<"u"&&"CSS"in window&&typeof((v=window.CSS)==null?void 0:v.supports)=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const s=v_(this.routeTree,this.options.caseSensitive,(r,i)=>{r.init({originalIndex:i})});return this.options.routeMasks&&m_(this.options.routeMasks,s.processedTree),s},this.subscribe=(s,r)=>{const i={eventType:s,fn:r};return this.subscribers.add(i),()=>{this.subscribers.delete(i)}},this.emit=s=>{this.subscribers.forEach(r=>{r.eventType===s.type&&r.fn(s)})},this.parseLocation=(s,r)=>{const i=({pathname:m,search:h,hash:v,href:g,state:y})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(m)){const C=this.options.parseSearch(h),T=this.options.stringifySearch(C);return{href:m+T+v,publicHref:g,pathname:Nl(m).path,external:!1,searchStr:T,search:Er(r==null?void 0:r.search,C),hash:Nl(v.slice(1)).path,state:Ga(r==null?void 0:r.state,y)}}const b=new URL(g,this.origin),S=Op(this.rewrite,b),w=this.options.parseSearch(S.search),N=this.options.stringifySearch(w);return S.search=N,{href:S.href.replace(S.origin,""),publicHref:g,pathname:Nl(S.pathname).path,external:!!this.rewrite&&S.origin!==this.origin,searchStr:N,search:Er(r==null?void 0:r.search,w),hash:Nl(S.hash.slice(1)).path,state:Ga(r==null?void 0:r.state,y)}},l=i(s),{__tempLocation:d,__tempKey:f}=l.state;if(d&&(!f||f===this.tempLocationKey)){const m=i(d);return m.state.key=l.state.key,m.state.__TSR_key=l.state.__TSR_key,delete m.state.__tempLocation,{...m,maskedLocation:l}}return l},this.resolvePathWithBase=(s,r)=>j_({base:s,to:wg(r),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(s,r,i)=>typeof s=="string"?this.matchRoutesInternal({pathname:s,search:r},i):this.matchRoutesInternal(s,r),this.getMatchedRoutes=s=>nR({pathname:s,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=s=>{const r=this.getMatch(s);r&&(r.abortController.abort(),clearTimeout(r._nonReactive.pendingTimeout),r._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingMatchesId.state.forEach(s=>{this.cancelMatch(s)}),this.stores.matchesId.state.forEach(s=>{var i;if(this.stores.pendingMatchStoresById.has(s))return;const r=(i=this.stores.activeMatchStoresById.get(s))==null?void 0:i.state;r&&(r.status==="pending"||r.isFetching==="loader")&&this.cancelMatch(s)})},this.buildLocation=s=>{const r=(l={})=>{var H,D;const d=l._fromLocation||this.pendingBuiltLocation||this.latestLocation,f=this.matchRoutesLightweight(d);l.from;const m=l.unsafeRelative==="path"?d.pathname:l.from??f.fullPath,h=this.resolvePathWithBase(m,"."),v=f.search,g=Object.assign(Object.create(null),f.params),y=l.to?this.resolvePathWithBase(h,`${l.to}`):this.resolvePathWithBase(h,"."),b=l.params===!1||l.params===null?Object.create(null):(l.params??!0)===!0?g:Object.assign(g,Va(l.params,g)),S=this.getMatchedRoutes(y);let w=S.matchedRoutes;if((!S.foundRoute||S.foundRoute.path!=="/"&&S.routeParams["**"])&&this.options.notFoundRoute&&(w=[...w,this.options.notFoundRoute]),Object.keys(b).length>0)for(const Y of w){const K=((H=Y.options.params)==null?void 0:H.stringify)??Y.options.stringifyParams;if(K)try{Object.assign(b,K(b))}catch{}}const N=s.leaveParams?y:Nl(yb({path:y,params:b,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let C=v;if(s._includeValidateSearch&&((D=this.options.search)!=null&&D.strict)){const Y={};w.forEach(K=>{if(K.options.validateSearch)try{Object.assign(Y,Nd(K.options.validateSearch,{...Y,...C}))}catch{}}),C=Y}C=sR({search:C,dest:l,destRoutes:w,_includeValidateSearch:s._includeValidateSearch}),C=Er(v,C);const T=this.options.stringifySearch(C),_=l.hash===!0?d.hash:l.hash?Va(l.hash,d.hash):void 0,R=_?`#${_}`:"";let O=l.state===!0?d.state:l.state?Va(l.state,d.state):{};O=Ga(d.state,O);const B=`${N}${T}${R}`;let L,M,I=!1;if(this.rewrite){const Y=new URL(B,this.origin),K=WS(this.rewrite,Y);L=Y.href.replace(Y.origin,""),K.origin!==this.origin?(M=K.href,I=!0):M=K.pathname+K.search+K.hash}else L=d_(B),M=L;return{publicHref:M,href:L,pathname:N,search:C,searchStr:T,state:O,hash:_??"",external:I,unmaskOnReload:l.unmaskOnReload}},i=(l={},d)=>{const f=r(l);let m=d?r(d):void 0;if(!m){const h=Object.create(null);if(this.options.routeMasks){const v=p_(f.pathname,this.processedTree);if(v){Object.assign(h,v.rawParams);const{from:g,params:y,...b}=v.route,S=y===!1||y===null?Object.create(null):(y??!0)===!0?h:Object.assign(h,Va(y,h));d={from:s.from,...b,params:S},m=r(d)}}}return m&&(f.maskedLocation=m),f};return s.mask?i(s,{from:s.from,...s.mask}):i(s)},this.commitLocation=async({viewTransition:s,ignoreBlocker:r,...i})=>{const l=()=>{const m=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];m.forEach(v=>{i.state[v]=this.latestLocation.state[v]});const h=Vr(i.state,this.latestLocation.state);return m.forEach(v=>{delete i.state[v]}),h},d=Qa(this.latestLocation.href)===Qa(i.href);let f=this.commitLocationPromise;if(this.commitLocationPromise=xo(()=>{f==null||f.resolve(),f=void 0}),d&&l())this.load();else{let{maskedLocation:m,hashScrollIntoView:h,...v}=i;m&&(v={...m,state:{...m.state,__tempKey:void 0,__tempLocation:{...v,search:v.searchStr,state:{...v.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(v.unmaskOnReload??this.options.unmaskOnReload??!1)&&(v.state.__tempKey=this.tempLocationKey)),v.state.__hashScrollIntoViewOptions=h??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=s,this.history[i.replace?"replace":"push"](v.publicHref,v.state,{ignoreBlocker:r})}return this.resetNextScroll=i.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:s,resetScroll:r,hashScrollIntoView:i,viewTransition:l,ignoreBlocker:d,href:f,...m}={})=>{if(f){const g=this.history.location.state.__TSR_index,y=Pd(f,{__TSR_index:s?g:g+1}),b=new URL(y.pathname,this.origin);m.to=Op(this.rewrite,b).pathname,m.search=this.options.parseSearch(y.search),m.hash=y.hash.slice(1)}const h=this.buildLocation({...m,_includeValidateSearch:!0});this.pendingBuiltLocation=h;const v=this.commitLocation({...h,viewTransition:l,replace:s,resetScroll:r,hashScrollIntoView:i,ignoreBlocker:d});return Promise.resolve().then(()=>{this.pendingBuiltLocation===h&&(this.pendingBuiltLocation=void 0)}),v},this.navigate=async({to:s,reloadDocument:r,href:i,publicHref:l,...d})=>{var m,h;let f=!1;if(i)try{new URL(`${i}`),f=!0}catch{}if(f&&!r&&(r=!0),r){if(s!==void 0||!i){const g=this.buildLocation({to:s,...d});i=i??g.publicHref,l=l??g.publicHref}const v=!f&&l?l:i;if(Dd(v,this.protocolAllowlist))return Promise.resolve();if(!d.ignoreBlocker){const g=((h=(m=this.history).getBlockers)==null?void 0:h.call(m))??[];for(const y of g)if(y!=null&&y.blockerFn&&await y.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return d.replace?window.location.replace(v):window.location.href=v,Promise.resolve()}return this.buildAndCommitLocation({...d,href:i,to:s,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const s=this.matchRoutes(this.latestLocation),r=this.stores.cachedMatchesSnapshot.state.filter(i=>!s.some(l=>l.id===i.id));this.batch(()=>{this.stores.status.setState(()=>"pending"),this.stores.statusCode.setState(()=>200),this.stores.isLoading.setState(()=>!0),this.stores.location.setState(()=>this.latestLocation),this.stores.setPendingMatches(s),this.stores.setCachedMatches(r)})},this.load=async s=>{let r,i,l;const d=this.stores.resolvedLocation.state??this.stores.location.state;for(l=new Promise(m=>{this.startTransition(async()=>{var h;try{this.beforeLoad();const v=this.latestLocation,g=this.stores.resolvedLocation.state,y=eo(v,g);this.stores.redirect.state||this.emit({type:"onBeforeNavigate",...y}),this.emit({type:"onBeforeLoad",...y}),await Nb({router:this,sync:s==null?void 0:s.sync,forceStaleReload:d.href===v.href,matches:this.stores.pendingMatchesSnapshot.state,location:v,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{var C,T;let b=null,S=null,w=null,N=null;this.batch(()=>{const _=this.stores.pendingMatchesSnapshot.state,R=_.length,O=this.stores.activeMatchesSnapshot.state;b=R?O.filter(M=>!this.stores.pendingMatchStoresById.has(M.id)):null;const B=new Set;for(const M of this.stores.pendingMatchStoresById.values())M.routeId&&B.add(M.routeId);const L=new Set;for(const M of this.stores.activeMatchStoresById.values())M.routeId&&L.add(M.routeId);S=R?O.filter(M=>!B.has(M.routeId)):null,w=R?_.filter(M=>!L.has(M.routeId)):null,N=R?_.filter(M=>L.has(M.routeId)):O,this.stores.isLoading.setState(()=>!1),this.stores.loadedAt.setState(()=>Date.now()),R&&(this.stores.setActiveMatches(_),this.stores.setPendingMatches([]),this.stores.setCachedMatches([...this.stores.cachedMatchesSnapshot.state,...b.filter(M=>M.status!=="error"&&M.status!=="notFound"&&M.status!=="redirected")]),this.clearExpiredCache())});for(const[_,R]of[[S,"onLeave"],[w,"onEnter"],[N,"onStay"]])if(_)for(const O of _)(T=(C=this.looseRoutesById[O.routeId].options)[R])==null||T.call(C,O)})})}})}catch(v){ln(v)?(r=v,this.navigate({...r.options,replace:!0,ignoreBlocker:!0})):Ft(v)&&(i=v);const g=r?r.status:i?404:this.stores.activeMatchesSnapshot.state.some(y=>y.status==="error")?500:200;this.batch(()=>{this.stores.statusCode.setState(()=>g),this.stores.redirect.setState(()=>r)})}this.latestLoadPromise===l&&((h=this.commitLocationPromise)==null||h.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),m()})}),this.latestLoadPromise=l,await l;this.latestLoadPromise&&l!==this.latestLoadPromise;)await this.latestLoadPromise;let f;this.hasNotFoundMatch()?f=404:this.stores.activeMatchesSnapshot.state.some(m=>m.status==="error")&&(f=500),f!==void 0&&this.stores.statusCode.setState(()=>f)},this.startViewTransition=s=>{const r=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,r&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let i;if(typeof r=="object"&&this.isViewTransitionTypesSupported){const l=this.latestLocation,d=this.stores.resolvedLocation.state,f=typeof r.types=="function"?r.types(eo(l,d)):r.types;if(f===!1){s();return}i={update:s,types:f}}else i=s;document.startViewTransition(i)}else s()},this.updateMatch=(s,r)=>{this.startTransition(()=>{const i=this.stores.pendingMatchStoresById.get(s);if(i){i.setState(r);return}const l=this.stores.activeMatchStoresById.get(s);if(l){l.setState(r);return}const d=this.stores.cachedMatchStoresById.get(s);if(d){const f=r(d.state);f.status==="redirected"?this.stores.cachedMatchStoresById.delete(s)&&this.stores.cachedMatchesId.setState(m=>m.filter(h=>h!==s)):d.setState(()=>f)}})},this.getMatch=s=>{var r,i,l;return((r=this.stores.cachedMatchStoresById.get(s))==null?void 0:r.state)??((i=this.stores.pendingMatchStoresById.get(s))==null?void 0:i.state)??((l=this.stores.activeMatchStoresById.get(s))==null?void 0:l.state)},this.invalidate=s=>{const r=i=>{var l;return((l=s==null?void 0:s.filter)==null?void 0:l.call(s,i))??!0?{...i,invalid:!0,...s!=null&&s.forcePending||i.status==="error"||i.status==="notFound"?{status:"pending",error:void 0}:void 0}:i};return this.batch(()=>{this.stores.setActiveMatches(this.stores.activeMatchesSnapshot.state.map(r)),this.stores.setCachedMatches(this.stores.cachedMatchesSnapshot.state.map(r)),this.stores.setPendingMatches(this.stores.pendingMatchesSnapshot.state.map(r))}),this.shouldViewTransition=!1,this.load({sync:s==null?void 0:s.sync})},this.getParsedLocationHref=s=>s.publicHref||"/",this.resolveRedirect=s=>{const r=s.headers.get("Location");if(!s.options.href||s.options._builtLocation){const i=s.options._builtLocation??this.buildLocation(s.options),l=this.getParsedLocationHref(i);s.options.href=l,s.headers.set("Location",l)}else if(r)try{const i=new URL(r);if(this.origin&&i.origin===this.origin){const l=i.pathname+i.search+i.hash;s.options.href=l,s.headers.set("Location",l)}}catch{}if(s.options.href&&!s.options._builtLocation&&Dd(s.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return s.headers.get("Location")||s.headers.set("Location",s.options.href),s},this.clearCache=s=>{const r=s==null?void 0:s.filter;r!==void 0?this.stores.setCachedMatches(this.stores.cachedMatchesSnapshot.state.filter(i=>!r(i))):this.stores.setCachedMatches([])},this.clearExpiredCache=()=>{const s=Date.now(),r=i=>{const l=this.looseRoutesById[i.routeId];if(!l.options.loader)return!0;const d=(i.preload?l.options.preloadGcTime??this.options.defaultPreloadGcTime:l.options.gcTime??this.options.defaultGcTime)??300*1e3;return i.status==="error"?!0:s-i.updatedAt>=d};this.clearCache({filter:r})},this.loadRouteChunk=$l,this.preloadRoute=async s=>{const r=s._builtLocation??this.buildLocation(s);let i=this.matchRoutes(r,{throwOnError:!0,preload:!0,dest:s});const l=new Set([...this.stores.matchesId.state,...this.stores.pendingMatchesId.state]),d=new Set([...l,...this.stores.cachedMatchesId.state]),f=i.filter(m=>!d.has(m.id));if(f.length){const m=this.stores.cachedMatchesSnapshot.state;this.stores.setCachedMatches([...m,...f])}try{return i=await Nb({router:this,matches:i,location:r,preload:!0,updateMatch:(m,h)=>{l.has(m)?i=i.map(v=>v.id===m?h(v):v):this.updateMatch(m,h)}}),i}catch(m){if(ln(m))return m.options.reloadDocument?void 0:await this.preloadRoute({...m.options,_fromLocation:r});Ft(m)||console.error(m);return}},this.matchRoute=(s,r)=>{const i={...s,to:s.to?this.resolvePathWithBase(s.from||"",s.to):void 0,params:s.params||{},leaveParams:!0},l=this.buildLocation(i);if(r!=null&&r.pending&&this.stores.status.state!=="pending")return!1;const d=((r==null?void 0:r.pending)===void 0?!this.stores.isLoading.state:r.pending)?this.latestLocation:this.stores.resolvedLocation.state||this.stores.location.state,f=g_(l.pathname,(r==null?void 0:r.caseSensitive)??!1,(r==null?void 0:r.fuzzy)??!1,d.pathname,this.processedTree);return!f||s.params&&!Vr(f.rawParams,s.params,{partial:!0})?!1:(r==null?void 0:r.includeSearch)??!0?Vr(d.search,l.search,{partial:!0})?f.rawParams:!1:f.rawParams},this.hasNotFoundMatch=()=>this.stores.activeMatchesSnapshot.state.some(s=>s.status==="notFound"||s.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??P_,parseSearch:e.parseSearch??z_,protocolAllowlist:e.protocolAllowlist??u_}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.state}setRoutes({routesById:e,routesByPath:t,processedTree:s}){this.routesById=e,this.routesByPath=t,this.processedTree=s;const r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}get looseRoutesById(){return this.routesById}getParentContext(e){return e!=null&&e.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){var g,y;const s=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i,parsedParams:l}=s;let{matchedRoutes:d}=s,f=!1;(r?r.path!=="/"&&i["**"]:Qa(e.pathname))&&(this.options.notFoundRoute?d=[...d,this.options.notFoundRoute]:f=!0);const m=f?rR(this.options.notFoundMode,d):void 0,h=new Array(d.length),v=new Map;for(const b of this.stores.activeMatchStoresById.values())b.routeId&&v.set(b.routeId,b.state);for(let b=0;b<d.length;b++){const S=d[b],w=h[b-1];let N,C,T;{const q=(w==null?void 0:w.search)??e.search,A=(w==null?void 0:w._strictSearch)??void 0;try{const $=Nd(S.options.validateSearch,{...q})??void 0;N={...q,...$},C={...A,...$},T=void 0}catch($){let z=$;if($ instanceof Id||(z=new Id($.message,{cause:$})),t!=null&&t.throwOnError)throw z;N=q,C={},T=z}}const _=((y=(g=S.options).loaderDeps)==null?void 0:y.call(g,{search:N}))??"",R=_?JSON.stringify(_):"",{interpolatedPath:O,usedParams:B}=yb({path:S.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),L=S.id+O+R,M=this.getMatch(L),I=v.get(S.id),H=(M==null?void 0:M._strictParams)??B;let D;if(!M)try{Rb(S,B,l,H)}catch(q){if(Ft(q)||ln(q)?D=q:D=new eR(q.message,{cause:q}),t!=null&&t.throwOnError)throw D}Object.assign(i,H);const Y=I?"stay":"enter";let K;if(M)K={...M,cause:Y,params:(I==null?void 0:I.params)??i,_strictParams:H,search:Er(I?I.search:M.search,N),_strictSearch:C};else{const q=S.options.loader||S.options.beforeLoad||S.lazyFn||nw(S)?"pending":"success";K={id:L,ssr:S.options.ssr,index:b,routeId:S.id,params:(I==null?void 0:I.params)??i,_strictParams:H,pathname:O,updatedAt:Date.now(),search:I?Er(I.search,N):N,_strictSearch:C,searchError:void 0,status:q,isFetching:!1,error:void 0,paramsError:D,__routeContext:void 0,_nonReactive:{loadPromise:xo()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:Y,loaderDeps:I?Ga(I.loaderDeps,_):_,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:S.options.staticData||{},fullPath:S.fullPath}}t!=null&&t.preload||(K.globalNotFound=m===S.id),K.searchError=T;const U=this.getParentContext(w);K.context={...U,...K.__routeContext,...K.__beforeLoadContext},h[b]=K}for(let b=0;b<h.length;b++){const S=h[b],w=this.looseRoutesById[S.routeId],N=this.getMatch(S.id),C=v.get(S.routeId);if(S.params=C?Er(C.params,i):i,!N){const T=h[b-1],_=this.getParentContext(T);if(w.options.context){const R={deps:S.loaderDeps,params:S.params,context:_??{},location:e,navigate:O=>this.navigate({...O,_fromLocation:e}),buildLocation:this.buildLocation,cause:S.cause,abortController:S.abortController,preload:!!S.preload,matches:h,routeId:w.id};S.__routeContext=w.options.context(R)??void 0}S.context={..._,...S.__routeContext,...S.__beforeLoadContext}}}return h}matchRoutesLightweight(e){var v;const{matchedRoutes:t,routeParams:s,parsedParams:r}=this.getMatchedRoutes(e.pathname),i=Bl(t),l={...e.search};for(const g of t)try{Object.assign(l,Nd(g.options.validateSearch,l))}catch{}const d=Bl(this.stores.matchesId.state),f=d&&((v=this.stores.activeMatchStoresById.get(d))==null?void 0:v.state),m=f&&f.routeId===i.id&&f.pathname===e.pathname;let h;if(m)h=f.params;else{const g=Object.assign(Object.create(null),s);for(const y of t)try{Rb(y,s,r??{},g)}catch{}h=g}return{matchedRoutes:t,fullPath:i.fullPath,search:l,params:h}}},Id=class extends Error{},eR=class extends Error{};function tR(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function Nd(e,t){if(e==null)return{};if("~standard"in e){const s=e["~standard"].validate(t);if(s instanceof Promise)throw new Id("Async validation not supported");if(s.issues)throw new Id(JSON.stringify(s.issues,void 0,2),{cause:s});return s.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function nR({pathname:e,routesById:t,processedTree:s}){const r=Object.create(null),i=Qa(e);let l,d;const f=x_(i,s,!0);return f&&(l=f.route,Object.assign(r,f.rawParams),d=Object.assign(Object.create(null),f.parsedParams)),{matchedRoutes:(f==null?void 0:f.branch)||[t.__root__],routeParams:r,foundRoute:l,parsedParams:d}}function sR({search:e,dest:t,destRoutes:s,_includeValidateSearch:r}){return aR(s)(e,t,r??!1)}function aR(e){var i;const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const l of e){if("search"in l.options)(i=l.options.search)!=null&&i.middlewares&&t.middlewares.push(...l.options.search.middlewares);else if(l.options.preSearchFilters||l.options.postSearchFilters){const d=({search:f,next:m})=>{let h=f;"preSearchFilters"in l.options&&l.options.preSearchFilters&&(h=l.options.preSearchFilters.reduce((g,y)=>y(g),f));const v=m(h);return"postSearchFilters"in l.options&&l.options.postSearchFilters?l.options.postSearchFilters.reduce((g,y)=>y(g),v):v};t.middlewares.push(d)}if(l.options.validateSearch){const d=({search:f,next:m})=>{const h=m(f);if(!t._includeValidateSearch)return h;try{return{...h,...Nd(l.options.validateSearch,h)??void 0}}catch{return h}};t.middlewares.push(d)}}const s=({search:l})=>{const d=t.dest;return d.search?d.search===!0?l:Va(d.search,l):{}};t.middlewares.push(s);const r=(l,d,f)=>{if(l>=f.length)return d;const m=f[l];return m({search:d,next:v=>r(l+1,v,f)})};return function(d,f,m){return t.dest=f,t._includeValidateSearch=m,r(0,d,t.middlewares)}}function rR(e,t){if(e!=="root")for(let s=t.length-1;s>=0;s--){const r=t[s];if(r.children)return r.id}return Gr}function Rb(e,t,s,r){var l;const i=((l=e.options.params)==null?void 0:l.parse)??e.options.parseParams;if(i)if(e.options.skipRouteOnParseError)for(const d in t)d in s&&(r[d]=s[d]);else{const d=i(r);Object.assign(r,d)}}var iR="Error preloading route! ☝️",sw=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{var m,h;this.originalIndex=t.originalIndex;const s=this.options,r=!(s!=null&&s.path)&&!(s!=null&&s.id);this.parentRoute=(h=(m=this.options).getParentRoute)==null?void 0:h.call(m),r?this._path=Gr:this.parentRoute||Qs();let i=r?Gr:s==null?void 0:s.path;i&&i!=="/"&&(i=XS(i));const l=(s==null?void 0:s.id)||i;let d=r?Gr:Sd([this.parentRoute.id==="__root__"?"":this.parentRoute.id,l]);i==="__root__"&&(i="/"),d!=="__root__"&&(d=Sd(["/",d]));const f=d==="__root__"?"/":Sd([this.parentRoute.fullPath,i]);this._path=i,this._id=d,this._fullPath=f,this._to=Qa(f)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>H_({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!(e!=null&&e.getParentRoute),e!=null&&e.id&&(e!=null&&e.path))throw new Error("Route cannot have both an 'id' and a 'path' option.")}},oR=class extends sw{constructor(e){super(e)}};function jg(e){const t=e.errorComponent??Eg;return u.jsx(lR,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:s,reset:r})=>s?j.createElement(t,{error:s,reset:r}):e.children})}var lR=class extends j.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}};function Eg({error:e}){const[t,s]=j.useState(!1);return u.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[u.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),u.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>s(r=>!r),children:t?"Hide Error":"Show Error"})]}),u.jsx("div",{style:{height:".25rem"}}),t?u.jsx("div",{children:u.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?u.jsx("code",{children:e.message}):null})}):null]})}function cR({children:e,fallback:t=null}){return aw()?u.jsx(Xr.Fragment,{children:e}):u.jsx(Xr.Fragment,{children:t})}function aw(){return Xr.useSyncExternalStore(uR,()=>!0,()=>!1)}function uR(){return()=>{}}var rw=j.createContext(null);function dn(e){return j.useContext(rw)}var of=j.createContext(void 0),dR=j.createContext(void 0),at=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(at||{});function iw({update:e,notify:t,unwatched:s}){return{link:r,unlink:i,propagate:l,checkDirty:d,shallowPropagate:f};function r(h,v,g){const y=v.depsTail;if(y!==void 0&&y.dep===h)return;const b=y!==void 0?y.nextDep:v.deps;if(b!==void 0&&b.dep===h){b.version=g,v.depsTail=b;return}const S=h.subsTail;if(S!==void 0&&S.version===g&&S.sub===v)return;const w=v.depsTail=h.subsTail={version:g,dep:h,sub:v,prevDep:y,nextDep:b,prevSub:S,nextSub:void 0};b!==void 0&&(b.prevDep=w),y!==void 0?y.nextDep=w:v.deps=w,S!==void 0?S.nextSub=w:h.subs=w}function i(h,v=h.sub){const g=h.dep,y=h.prevDep,b=h.nextDep,S=h.nextSub,w=h.prevSub;return b!==void 0?b.prevDep=y:v.depsTail=y,y!==void 0?y.nextDep=b:v.deps=b,S!==void 0?S.prevSub=w:g.subsTail=w,w!==void 0?w.nextSub=S:(g.subs=S)===void 0&&s(g),b}function l(h){let v=h.nextSub,g;e:do{const y=h.sub;let b=y.flags;if(b&60?b&12?b&4?!(b&48)&&m(h,y)?(y.flags=b|40,b&=1):b=0:y.flags=b&-9|32:b=0:y.flags=b|32,b&2&&t(y),b&1){const S=y.subs;if(S!==void 0){const w=(h=S).nextSub;w!==void 0&&(g={value:v,prev:g},v=w);continue}}if((h=v)!==void 0){v=h.nextSub;continue}for(;g!==void 0;)if(h=g.value,g=g.prev,h!==void 0){v=h.nextSub;continue e}break}while(!0)}function d(h,v){let g,y=0,b=!1;e:do{const S=h.dep,w=S.flags;if(v.flags&16)b=!0;else if((w&17)===17){if(e(S)){const N=S.subs;N.nextSub!==void 0&&f(N),b=!0}}else if((w&33)===33){(h.nextSub!==void 0||h.prevSub!==void 0)&&(g={value:h,prev:g}),h=S.deps,v=S,++y;continue}if(!b){const N=h.nextDep;if(N!==void 0){h=N;continue}}for(;y--;){const N=v.subs,C=N.nextSub!==void 0;if(C?(h=g.value,g=g.prev):h=N,b){if(e(v)){C&&f(N),v=h.sub;continue}b=!1}else v.flags&=-33;v=h.sub;const T=h.nextDep;if(T!==void 0){h=T;continue e}}return b}while(!0)}function f(h){do{const v=h.sub,g=v.flags;(g&48)===32&&(v.flags=g|16,(g&6)===2&&t(v))}while((h=h.nextSub)!==void 0)}function m(h,v){let g=v.depsTail;for(;g!==void 0;){if(g===h)return!0;g=g.prevDep}return!1}}let Cg=0,Cr=0,zl=0;const Vs=[],{link:TI,unlink:ow,propagate:AI,checkDirty:fR,shallowPropagate:MI}=iw({update(e){return e.depsTail!==void 0?gR(e):xR(e)},notify(e){var r;let t=zl,s=t;do if(Vs[t++]=e,e.flags&=-3,e=(r=e.subs)==null?void 0:r.sub,e===void 0||!(e.flags&2))break;while(!0);for(zl=t;s<--t;){const i=Vs[s];Vs[s++]=Vs[t],Vs[t]=i}},unwatched(e){e.flags&1?e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,lf(e)):bR.call(e)}});function hR(){return Cg}function mR(){++Cg}function pR(){--Cg||vR()}function gR(e){e.depsTail=void 0,e.flags=5;try{const t=e.value;return t!==(e.value=e.getter(t))}finally{e.flags&=-5,lf(e)}}function xR(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function yR(e){const t=e.flags;if(t&16||t&32&&fR(e.deps,e)){e.depsTail=void 0,e.flags=6;try{e.fn()}finally{e.flags&=-5,lf(e)}}else e.flags=2}function vR(){try{for(;Cr<zl;){const e=Vs[Cr];Vs[Cr++]=void 0,yR(e)}}finally{for(;Cr<zl;){const e=Vs[Cr];Vs[Cr++]=void 0,e.flags|=10}Cr=0,zl=0}}function bR(){this.depsTail=void 0,this.flags=0,lf(this);const e=this.subs;e!==void 0&&ow(e)}function lf(e){const t=e.depsTail;let s=t!==void 0?t.nextDep:e.deps;for(;s!==void 0;)s=ow(s,e)}function _g(e,t,s){var l,d,f;const r=typeof e=="object",i=r?e:void 0;return{next:(l=r?e.next:e)==null?void 0:l.bind(i),error:(d=r?e.error:t)==null?void 0:d.bind(i),complete:(f=r?e.complete:s)==null?void 0:f.bind(i)}}const Lp=[];let jd=0;const{link:Tb,unlink:SR,propagate:wR,checkDirty:lw,shallowPropagate:Ab}=iw({update(e){return e._update()},notify(e){Lp[zp++]=e,e.flags&=~at.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=at.Mutable|at.Dirty,Bd(e))}});let Xu=0,zp=0,ss;function Bd(e){const t=e.depsTail;let s=t!==void 0?t.nextDep:e.deps;for(;s!==void 0;)s=SR(s,e)}function cw(){if(!(hR()>0)){for(;Xu<zp;){const e=Lp[Xu];Lp[Xu++]=void 0,e.notify()}Xu=0,zp=0}}function uw(e,t){const s=typeof e=="function",r=e,i={_snapshot:s?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:s?at.None:at.Mutable,get(){return ss!==void 0&&Tb(i,ss,jd),i._snapshot},subscribe(l){const d=_g(l),f={current:!1},m=NR(()=>{var h;i.get(),f.current?(h=d.next)==null||h.call(d,i._snapshot):f.current=!0});return{unsubscribe:()=>{m.stop()}}},_update(l){const d=ss,f=Object.is;if(s)ss=i,++jd,i.depsTail=void 0;else if(l===void 0)return!1;s&&(i.flags=at.Mutable|at.RecursedCheck);try{const m=i._snapshot,h=typeof l=="function"?l(m):l===void 0&&s?r(m):l;return m===void 0||!f(m,h)?(i._snapshot=h,!0):!1}finally{ss=d,s&&(i.flags&=~at.RecursedCheck),Bd(i)}}};return s?(i.flags=at.Mutable|at.Dirty,i.get=function(){const l=i.flags;if(l&at.Dirty||l&at.Pending&&lw(i.deps,i)){if(i._update()){const d=i.subs;d!==void 0&&Ab(d)}}else l&at.Pending&&(i.flags=l&~at.Pending);return ss!==void 0&&Tb(i,ss,jd),i._snapshot}):i.set=function(l){if(i._update(l)){const d=i.subs;d!==void 0&&(wR(d),Ab(d),cw())}},i}function NR(e){const t=()=>{const r=ss;ss=s,++jd,s.depsTail=void 0,s.flags=at.Watching|at.RecursedCheck;try{return e()}finally{ss=r,s.flags&=~at.RecursedCheck,Bd(s)}},s={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:at.Watching|at.RecursedCheck,notify(){const r=this.flags;r&at.Dirty||r&at.Pending&&lw(this.deps,this)?t():this.flags=at.Watching},stop(){this.flags=at.None,this.depsTail=void 0,Bd(this)}};return t(),s}class jR{constructor(t){this.atom=uw(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(_g(t))}}class ER{constructor(t){this.atom=uw(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(_g(t))}}function Mb(e){return typeof e=="function"?new ER(e):new jR(e)}function dw(e){try{mR(),e()}finally{pR(),cw()}}var ip={exports:{}},op={},lp={exports:{}},cp={};/**
50
- * @license React
51
- * use-sync-external-store-shim.production.js
52
- *
53
- * Copyright (c) Meta Platforms, Inc. and affiliates.
54
- *
55
- * This source code is licensed under the MIT license found in the
56
- * LICENSE file in the root directory of this source tree.
57
- */var kb;function CR(){if(kb)return cp;kb=1;var e=pc();function t(g,y){return g===y&&(g!==0||1/g===1/y)||g!==g&&y!==y}var s=typeof Object.is=="function"?Object.is:t,r=e.useState,i=e.useEffect,l=e.useLayoutEffect,d=e.useDebugValue;function f(g,y){var b=y(),S=r({inst:{value:b,getSnapshot:y}}),w=S[0].inst,N=S[1];return l(function(){w.value=b,w.getSnapshot=y,m(w)&&N({inst:w})},[g,b,y]),i(function(){return m(w)&&N({inst:w}),g(function(){m(w)&&N({inst:w})})},[g]),d(b),b}function m(g){var y=g.getSnapshot;g=g.value;try{var b=y();return!s(g,b)}catch{return!0}}function h(g,y){return y()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:f;return cp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,cp}var Ob;function _R(){return Ob||(Ob=1,lp.exports=CR()),lp.exports}/**
58
- * @license React
59
- * use-sync-external-store-shim/with-selector.production.js
60
- *
61
- * Copyright (c) Meta Platforms, Inc. and affiliates.
62
- *
63
- * This source code is licensed under the MIT license found in the
64
- * LICENSE file in the root directory of this source tree.
65
- */var Db;function RR(){if(Db)return op;Db=1;var e=pc(),t=_R();function s(h,v){return h===v&&(h!==0||1/h===1/v)||h!==h&&v!==v}var r=typeof Object.is=="function"?Object.is:s,i=t.useSyncExternalStore,l=e.useRef,d=e.useEffect,f=e.useMemo,m=e.useDebugValue;return op.useSyncExternalStoreWithSelector=function(h,v,g,y,b){var S=l(null);if(S.current===null){var w={hasValue:!1,value:null};S.current=w}else w=S.current;S=f(function(){function C(B){if(!T){if(T=!0,_=B,B=y(B),b!==void 0&&w.hasValue){var L=w.value;if(b(L,B))return R=L}return R=B}if(L=R,r(_,B))return L;var M=y(B);return b!==void 0&&b(L,M)?(_=B,L):(_=B,R=M)}var T=!1,_,R,O=g===void 0?null:g;return[function(){return C(v())},O===null?void 0:function(){return C(O())}]},[v,g,y,b]);var N=i(h,S[0],S[1]);return d(function(){w.hasValue=!0,w.value=N},[N]),m(N),N},op}var Lb;function TR(){return Lb||(Lb=1,ip.exports=RR()),ip.exports}var fw=TR();const AR=yg(fw);function MR(e,t){return e===t}function un(e,t,s=MR){const r=j.useCallback(d=>{if(!e)return()=>{};const{unsubscribe:f}=e.subscribe(d);return f},[e]),i=j.useCallback(()=>e==null?void 0:e.get(),[e]);return fw.useSyncExternalStoreWithSelector(r,i,i,t,s)}var kR={state:void 0,get:()=>{},subscribe:()=>()=>{}};function Ja(e){const t=dn(),s=j.useContext(e.from?dR:of),r=e.from??s,i=r?e.from?t.stores.getMatchStoreByRouteId(r):t.stores.activeMatchStoresById.get(r):void 0,l=j.useRef(void 0);return un(i??kR,d=>{if((e.shouldThrow??!0)&&!d&&Qs(),d===void 0)return;const f=e.select?e.select(d):d;if(e.structuralSharing??t.options.defaultStructuralSharing){const m=Ga(l.current,f);return l.current=m,m}return f})}function Rg(e){return Ja({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Tg(e){const{select:t,...s}=e;return Ja({...s,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function cf(e){return Ja({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const s=e.strict===!1?t.params:t._strictParams;return e.select?e.select(s):s}})}function Ag(e){return Ja({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Xt(e){const t=dn();return j.useCallback(s=>t.navigate({...s,from:s.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function Mg(e){return Ja({...e,select:t=>e.select?e.select(t.context):t.context})}var kg=QS();const OR=yg(kg);function DR(e,t){const s=dn(),r=a_(t),{activeProps:i,inactiveProps:l,activeOptions:d,to:f,preload:m,preloadDelay:h,hashScrollIntoView:v,replace:g,startTransition:y,resetScroll:b,viewTransition:S,children:w,target:N,disabled:C,style:T,className:_,onClick:R,onBlur:O,onFocus:B,onMouseEnter:L,onMouseLeave:M,onTouchStart:I,ignoreBlocker:H,params:D,search:Y,hash:K,state:U,mask:q,reloadDocument:A,unsafeRelative:$,from:z,_fromLocation:G,...V}=e,P=aw(),Q=j.useMemo(()=>e,[s,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),ee=un(s.stores.location,Me=>Me,(Me,ft)=>Me.href===ft.href),se=j.useMemo(()=>{const Me={_fromLocation:ee,...Q};return s.buildLocation(Me)},[s,ee,Q]),oe=se.maskedLocation?se.maskedLocation.publicHref:se.publicHref,ce=se.maskedLocation?se.maskedLocation.external:se.external,fe=j.useMemo(()=>HR(oe,ce,s.history,C),[C,ce,oe,s.history]),ue=j.useMemo(()=>{if(fe!=null&&fe.external)return Dd(fe.href,s.protocolAllowlist)?void 0:fe.href;if(!UR(f)&&!(typeof f!="string"||f.indexOf(":")===-1))try{return new URL(f),Dd(f,s.protocolAllowlist)?void 0:f}catch{}},[f,fe,s.protocolAllowlist]),he=j.useMemo(()=>{if(ue)return!1;if(d!=null&&d.exact){if(!N_(ee.pathname,se.pathname,s.basepath))return!1}else{const Me=Ld(ee.pathname,s.basepath),ft=Ld(se.pathname,s.basepath);if(!(Me.startsWith(ft)&&(Me.length===ft.length||Me[ft.length]==="/")))return!1}return((d==null?void 0:d.includeSearch)??!0)&&!Vr(ee.search,se.search,{partial:!(d!=null&&d.exact),ignoreUndefined:!(d!=null&&d.explicitUndefined)})?!1:d!=null&&d.includeHash?P&&ee.hash===se.hash:!0},[d==null?void 0:d.exact,d==null?void 0:d.explicitUndefined,d==null?void 0:d.includeHash,d==null?void 0:d.includeSearch,ee,ue,P,se.hash,se.pathname,se.search,s.basepath]),Ce=he?Va(i,{})??LR:up,Se=he?up:Va(l,{})??up,ye=[_,Ce.className,Se.className].filter(Boolean).join(" "),ve=(T||Ce.style||Se.style)&&{...T,...Ce.style,...Se.style},[de,Ae]=j.useState(!1),Re=j.useRef(!1),Be=e.reloadDocument||ue?!1:m??s.options.defaultPreload,St=h??s.options.defaultPreloadDelay??0,dt=j.useCallback(()=>{s.preloadRoute({...Q,_builtLocation:se}).catch(Me=>{console.warn(Me),console.warn(iR)})},[s,Q,se]);s_(r,j.useCallback(Me=>{Me!=null&&Me.isIntersecting&&dt()},[dt]),BR,{disabled:!!C||Be!=="viewport"}),j.useEffect(()=>{Re.current||!C&&Be==="render"&&(dt(),Re.current=!0)},[C,dt,Be]);const fn=Me=>{const ft=Me.currentTarget.getAttribute("target"),kt=N!==void 0?N:ft;if(!C&&!$R(Me)&&!Me.defaultPrevented&&(!kt||kt==="_self")&&Me.button===0){Me.preventDefault(),kg.flushSync(()=>{Ae(!0)});const Xn=s.subscribe("onResolved",()=>{Xn(),Ae(!1)});s.navigate({...Q,replace:g,resetScroll:b,hashScrollIntoView:v,startTransition:y,viewTransition:S,ignoreBlocker:H})}};if(ue)return{...V,ref:r,href:ue,...w&&{children:w},...N&&{target:N},...C&&{disabled:C},...T&&{style:T},..._&&{className:_},...R&&{onClick:R},...O&&{onBlur:O},...B&&{onFocus:B},...L&&{onMouseEnter:L},...M&&{onMouseLeave:M},...I&&{onTouchStart:I}};const jn=Me=>{if(C||Be!=="intent")return;if(!St){dt();return}const ft=Me.currentTarget;if(Cl.has(ft))return;const kt=setTimeout(()=>{Cl.delete(ft),dt()},St);Cl.set(ft,kt)},ps=Me=>{C||Be!=="intent"||dt()},Fn=Me=>{if(C||!Be||!St)return;const ft=Me.currentTarget,kt=Cl.get(ft);kt&&(clearTimeout(kt),Cl.delete(ft))};return{...V,...Ce,...Se,href:fe==null?void 0:fe.href,ref:r,onClick:Gi([R,fn]),onBlur:Gi([O,Fn]),onFocus:Gi([B,jn]),onMouseEnter:Gi([L,jn]),onMouseLeave:Gi([M,Fn]),onTouchStart:Gi([I,ps]),disabled:!!C,target:N,...ve&&{style:ve},...ye&&{className:ye},...C&&zR,...he&&PR,...P&&de&&IR}}var up={},LR={className:"active"},zR={role:"link","aria-disabled":!0},PR={"data-status":"active","aria-current":"page"},IR={"data-transitioning":"transitioning"},Cl=new WeakMap,BR={rootMargin:"100px"},Gi=e=>t=>{for(const s of e)if(s){if(t.defaultPrevented)return;s(t)}};function HR(e,t,s,r){if(!r)return t?{href:e,external:!0}:{href:s.createHref(e)||"/",external:!1}}function UR(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var gc=j.forwardRef((e,t)=>{const{_asChild:s,...r}=e,{type:i,...l}=DR(r,t),d=typeof r.children=="function"?r.children({isActive:l["data-status"]==="active"}):r.children;if(!s){const{disabled:f,...m}=l;return j.createElement("a",m,d)}return j.createElement(s,l,d)});function $R(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var qR=class extends sw{constructor(e){super(e),this.useMatch=t=>Ja({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Mg({...t,from:this.id}),this.useSearch=t=>Ag({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>cf({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Tg({...t,from:this.id}),this.useLoaderData=t=>Rg({...t,from:this.id}),this.useNavigate=()=>Xt({from:this.fullPath}),this.Link=Xr.forwardRef((t,s)=>u.jsx(gc,{ref:s,from:this.fullPath,...t}))}};function At(e){return new qR(e)}var VR=class extends oR{constructor(e){super(e),this.useMatch=t=>Ja({select:t==null?void 0:t.select,from:this.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Mg({...t,from:this.id}),this.useSearch=t=>Ag({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>cf({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Tg({...t,from:this.id}),this.useLoaderData=t=>Rg({...t,from:this.id}),this.useNavigate=()=>Xt({from:this.fullPath}),this.Link=Xr.forwardRef((t,s)=>u.jsx(gc,{ref:s,from:this.fullPath,...t}))}};function GR(e){return new VR(e)}function zb(e){return typeof e=="object"?new Pb(e,{silent:!0}).createRoute(e):new Pb(e,{silent:!0}).createRoute}var Pb=class{constructor(e,t){this.path=e,this.createRoute=s=>{const r=At(s);return r.isRoot=!1,r},this.silent=t==null?void 0:t.silent}},Ib=class{constructor(e){this.useMatch=t=>Ja({select:t==null?void 0:t.select,from:this.options.id,structuralSharing:t==null?void 0:t.structuralSharing}),this.useRouteContext=t=>Mg({...t,from:this.options.id}),this.useSearch=t=>Ag({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useParams=t=>cf({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>Tg({...t,from:this.options.id}),this.useLoaderData=t=>Rg({...t,from:this.options.id}),this.useNavigate=()=>Xt({from:dn().routesById[this.options.id].fullPath}),this.options=e}};function Bb(e){return typeof e=="object"?new Ib(e):t=>new Ib({id:e,...t})}function YR(e){const t=dn(),s=`not-found-${un(t.stores.location,r=>r.pathname)}-${un(t.stores.status,r=>r)}`;return u.jsx(jg,{getResetKey:()=>s,onCatch:(r,i)=>{var l;if(Ft(r))(l=e.onCatch)==null||l.call(e,r,i);else throw r},errorComponent:({error:r})=>{var i;if(Ft(r))return(i=e.fallback)==null?void 0:i.call(e,r);throw r},children:e.children})}function QR(){return u.jsx("p",{children:"Not Found"})}function Xi(e){return u.jsx(u.Fragment,{children:e.children})}function hw(e,t,s){return t.options.notFoundComponent?u.jsx(t.options.notFoundComponent,{...s}):e.options.defaultNotFoundComponent?u.jsx(e.options.defaultNotFoundComponent,{...s}):u.jsx(QR,{})}function KR(){return dn().isScrollRestoring,null}var mw=j.memo(function({matchId:t}){const s=dn(),r=s.stores.activeMatchStoresById.get(t);r||Qs();const i=un(s.stores.loadedAt,d=>d),l=un(r,d=>d);return u.jsx(FR,{router:s,matchId:t,resetKey:i,matchState:j.useMemo(()=>{var m;const d=l.routeId,f=(m=s.routesById[d].parentRoute)==null?void 0:m.id;return{routeId:d,ssr:l.ssr,_displayPending:l._displayPending,parentRouteId:f}},[l._displayPending,l.routeId,l.ssr,s.routesById])})});function FR({router:e,matchId:t,resetKey:s,matchState:r}){var S,w;const i=e.routesById[r.routeId],l=i.options.pendingComponent??e.options.defaultPendingComponent,d=l?u.jsx(l,{}):null,f=i.options.errorComponent??e.options.defaultErrorComponent,m=i.options.onCatch??e.options.defaultOnCatch,h=i.isRoot?i.options.notFoundComponent??((S=e.options.notFoundRoute)==null?void 0:S.options.component):i.options.notFoundComponent,v=r.ssr===!1||r.ssr==="data-only",g=(!i.isRoot||i.options.wrapInSuspense||v)&&(i.options.wrapInSuspense??l??(((w=i.options.errorComponent)==null?void 0:w.preload)||v))?j.Suspense:Xi,y=f?jg:Xi,b=h?YR:Xi;return u.jsxs(i.isRoot?i.options.shellComponent??Xi:Xi,{children:[u.jsx(of.Provider,{value:t,children:u.jsx(g,{fallback:d,children:u.jsx(y,{getResetKey:()=>s,errorComponent:f||Eg,onCatch:(N,C)=>{if(Ft(N))throw N;m==null||m(N,C)},children:u.jsx(b,{fallback:N=>{if(!h||N.routeId&&N.routeId!==r.routeId||!N.routeId&&!i.isRoot)throw N;return j.createElement(h,N)},children:v||r._displayPending?u.jsx(cR,{fallback:d,children:u.jsx(Hb,{matchId:t})}):u.jsx(Hb,{matchId:t})})})})}),r.parentRouteId===Gr&&e.options.scrollRestoration?u.jsxs(u.Fragment,{children:[u.jsx(XR,{}),u.jsx(KR,{})]}):null]})}function XR(){const e=dn(),t=j.useRef(void 0);return u.jsx("script",{suppressHydrationWarning:!0,ref:s=>{s&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...eo(e.stores.location.state,e.stores.resolvedLocation.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}var Hb=j.memo(function({matchId:t}){var h,v,g,y;const s=dn(),r=s.stores.activeMatchStoresById.get(t);r||Qs();const i=un(r,b=>b),l=i.routeId,d=s.routesById[l],f=j.useMemo(()=>{var S;const b=(S=s.routesById[l].options.remountDeps??s.options.defaultRemountDeps)==null?void 0:S({routeId:l,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return b?JSON.stringify(b):void 0},[l,i.loaderDeps,i._strictParams,i._strictSearch,s.options.defaultRemountDeps,s.routesById]),m=j.useMemo(()=>{const b=d.options.component??s.options.defaultComponent;return b?u.jsx(b,{},f):u.jsx(pw,{})},[f,d.options.component,s.options.defaultComponent]);if(i._displayPending)throw(h=s.getMatch(i.id))==null?void 0:h._nonReactive.displayPendingPromise;if(i._forcePending)throw(v=s.getMatch(i.id))==null?void 0:v._nonReactive.minPendingPromise;if(i.status==="pending"){const b=d.options.pendingMinMs??s.options.defaultPendingMinMs;if(b){const S=s.getMatch(i.id);if(S&&!S._nonReactive.minPendingPromise){const w=xo();S._nonReactive.minPendingPromise=w,setTimeout(()=>{w.resolve(),S._nonReactive.minPendingPromise=void 0},b)}}throw(g=s.getMatch(i.id))==null?void 0:g._nonReactive.loadPromise}if(i.status==="notFound")return Ft(i.error)||Qs(),hw(s,d,i.error);if(i.status==="redirected")throw ln(i.error)||Qs(),(y=s.getMatch(i.id))==null?void 0:y._nonReactive.loadPromise;if(i.status==="error")throw i.error;return m}),pw=j.memo(function(){const t=dn(),s=j.useContext(of);let r,i=!1,l;{const h=s?t.stores.activeMatchStoresById.get(s):void 0;[r,i]=un(h,v=>[v==null?void 0:v.routeId,(v==null?void 0:v.globalNotFound)??!1]),l=un(t.stores.matchesId,v=>v[v.findIndex(g=>g===s)+1])}const d=r?t.routesById[r]:void 0,f=t.options.defaultPendingComponent?u.jsx(t.options.defaultPendingComponent,{}):null;if(i)return d||Qs(),hw(t,d,void 0);if(!l)return null;const m=u.jsx(mw,{matchId:l});return r===Gr?u.jsx(j.Suspense,{fallback:f,children:m}):m});function ZR(){const e=dn(),t=j.useRef({router:e,mounted:!1}),[s,r]=j.useState(!1),i=un(e.stores.isLoading,g=>g),l=un(e.stores.hasPendingMatches,g=>g),d=Wm(i),f=i||s||l,m=Wm(f),h=i||l,v=Wm(h);return e.startTransition=g=>{r(!0),j.startTransition(()=>{g(),r(!1)})},j.useEffect(()=>{const g=e.history.subscribe(e.load),y=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Qa(e.latestLocation.publicHref)!==Qa(y.publicHref)&&e.commitLocation({...y,replace:!0}),()=>{g()}},[e,e.history]),Ku(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(y){console.error(y)}})()},[e]),Ku(()=>{d&&!i&&e.emit({type:"onLoad",...eo(e.stores.location.state,e.stores.resolvedLocation.state)})},[d,e,i]),Ku(()=>{v&&!h&&e.emit({type:"onBeforeRouteMount",...eo(e.stores.location.state,e.stores.resolvedLocation.state)})},[h,v,e]),Ku(()=>{if(m&&!f){const g=eo(e.stores.location.state,e.stores.resolvedLocation.state);e.emit({type:"onResolved",...g}),dw(()=>{e.stores.status.setState(()=>"idle"),e.stores.resolvedLocation.setState(()=>e.stores.location.state)}),g.hrefChanged&&O_(e)}},[f,m,e]),null}function WR(){const e=dn(),t=e.routesById[Gr].options.pendingComponent??e.options.defaultPendingComponent,s=t?u.jsx(t,{}):null,r=u.jsxs(typeof document<"u"&&e.ssr?Xi:j.Suspense,{fallback:s,children:[u.jsx(ZR,{}),u.jsx(JR,{})]});return e.options.InnerWrap?u.jsx(e.options.InnerWrap,{children:r}):r}function JR(){const e=dn(),t=un(e.stores.firstMatchId,i=>i),s=un(e.stores.loadedAt,i=>i),r=t?u.jsx(mw,{matchId:t}):null;return u.jsx(of.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:u.jsx(jg,{getResetKey:()=>s,errorComponent:Eg,onCatch:void 0,children:r})})}var eT=e=>({createMutableStore:Mb,createReadonlyStore:Mb,batch:dw}),tT=e=>new nT(e),nT=class extends J_{constructor(e){super(e,eT)}};typeof globalThis<"u"?(globalThis.createFileRoute=zb,globalThis.createLazyFileRoute=Bb):typeof window<"u"&&(window.createFileRoute=zb,window.createLazyFileRoute=Bb);function sT({router:e,children:t,...s}){Object.keys(s).length>0&&e.update({...e.options,...s,context:{...e.options.context,...s.context}});const r=u.jsx(rw.Provider,{value:e,children:t});return e.options.Wrap?u.jsx(e.options.Wrap,{children:r}):r}function aT({router:e,...t}){return u.jsx(sT,{router:e,...t,children:u.jsx(WR,{})})}function uf(e){const t=dn({warn:(e==null?void 0:e.router)===void 0}),s=(e==null?void 0:e.router)||t,r=j.useRef(void 0);return un(s.stores.__store,i=>{if(e!=null&&e.select){if(e.structuralSharing??s.options.defaultStructuralSharing){const l=Ga(r.current,e.select(i));return r.current=l,l}return e.select(i)}return i})}var Eo=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Lr,La,ao,zS,rT=(zS=class extends Eo{constructor(){super();je(this,Lr);je(this,La);je(this,ao);me(this,ao,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t();return window.addEventListener("visibilitychange",s,!1),()=>{window.removeEventListener("visibilitychange",s)}}})}onSubscribe(){X(this,La)||this.setEventListener(X(this,ao))}onUnsubscribe(){var t;this.hasListeners()||((t=X(this,La))==null||t.call(this),me(this,La,void 0))}setEventListener(t){var s;me(this,ao,t),(s=X(this,La))==null||s.call(this),me(this,La,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){X(this,Lr)!==t&&(me(this,Lr,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(s=>{s(t)})}isFocused(){var t;return typeof X(this,Lr)=="boolean"?X(this,Lr):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Lr=new WeakMap,La=new WeakMap,ao=new WeakMap,zS),Og=new rT,iT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},za,xg,PS,oT=(PS=class{constructor(){je(this,za,iT);je(this,xg,!1)}setTimeoutProvider(e){me(this,za,e)}setTimeout(e,t){return X(this,za).setTimeout(e,t)}clearTimeout(e){X(this,za).clearTimeout(e)}setInterval(e,t){return X(this,za).setInterval(e,t)}clearInterval(e){X(this,za).clearInterval(e)}},za=new WeakMap,xg=new WeakMap,PS),Mr=new oT;function lT(e){setTimeout(e,0)}var cT=typeof window>"u"||"Deno"in globalThis;function Yt(){}function uT(e,t){return typeof e=="function"?e(t):e}function Pp(e){return typeof e=="number"&&e>=0&&e!==1/0}function gw(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Fa(e,t){return typeof e=="function"?e(t):e}function Dn(e,t){return typeof e=="function"?e(t):e}function Ub(e,t){const{type:s="all",exact:r,fetchStatus:i,predicate:l,queryKey:d,stale:f}=e;if(d){if(r){if(t.queryHash!==Dg(d,t.options))return!1}else if(!ql(t.queryKey,d))return!1}if(s!=="all"){const m=t.isActive();if(s==="active"&&!m||s==="inactive"&&m)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||i&&i!==t.state.fetchStatus||l&&!l(t))}function $b(e,t){const{exact:s,status:r,predicate:i,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(s){if(Zr(t.options.mutationKey)!==Zr(l))return!1}else if(!ql(t.options.mutationKey,l))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function Dg(e,t){return((t==null?void 0:t.queryKeyHashFn)||Zr)(e)}function Zr(e){return JSON.stringify(e,(t,s)=>Ip(s)?Object.keys(s).sort().reduce((r,i)=>(r[i]=s[i],r),{}):s)}function ql(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(s=>ql(e[s],t[s])):!1}var dT=Object.prototype.hasOwnProperty;function xw(e,t,s=0){if(e===t)return e;if(s>500)return t;const r=qb(e)&&qb(t);if(!r&&!(Ip(e)&&Ip(t)))return t;const l=(r?e:Object.keys(e)).length,d=r?t:Object.keys(t),f=d.length,m=r?new Array(f):{};let h=0;for(let v=0;v<f;v++){const g=r?v:d[v],y=e[g],b=t[g];if(y===b){m[g]=y,(r?v<l:dT.call(e,g))&&h++;continue}if(y===null||b===null||typeof y!="object"||typeof b!="object"){m[g]=b;continue}const S=xw(y,b,s+1);m[g]=S,S===y&&h++}return l===f&&h===l?e:m}function Hd(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}function qb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Ip(e){if(!Vb(e))return!1;const t=e.constructor;if(t===void 0)return!0;const s=t.prototype;return!(!Vb(s)||!s.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Vb(e){return Object.prototype.toString.call(e)==="[object Object]"}function fT(e){return new Promise(t=>{Mr.setTimeout(t,e)})}function Bp(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?xw(e,t):t}function hT(e,t,s=0){const r=[...e,t];return s&&r.length>s?r.slice(1):r}function mT(e,t,s=0){const r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var Lg=Symbol();function yw(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Lg?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function zg(e,t){return typeof e=="function"?e(...t):!!e}function pT(e,t,s){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??(i=t()),r||(r=!0,i.aborted?s():i.addEventListener("abort",s,{once:!0})),i)}),e}var Vl=(()=>{let e=()=>cT;return{isServer(){return e()},setIsServer(t){e=t}}})();function Hp(){let e,t;const s=new Promise((i,l)=>{e=i,t=l});s.status="pending",s.catch(()=>{});function r(i){Object.assign(s,i),delete s.resolve,delete s.reject}return s.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},s.reject=i=>{r({status:"rejected",reason:i}),t(i)},s}var gT=lT;function xT(){let e=[],t=0,s=f=>{f()},r=f=>{f()},i=gT;const l=f=>{t?e.push(f):i(()=>{s(f)})},d=()=>{const f=e;e=[],f.length&&i(()=>{r(()=>{f.forEach(m=>{s(m)})})})};return{batch:f=>{let m;t++;try{m=f()}finally{t--,t||d()}return m},batchCalls:f=>(...m)=>{l(()=>{f(...m)})},schedule:l,setNotifyFunction:f=>{s=f},setBatchNotifyFunction:f=>{r=f},setScheduler:f=>{i=f}}}var Et=xT(),ro,Pa,io,IS,yT=(IS=class extends Eo{constructor(){super();je(this,ro,!0);je(this,Pa);je(this,io);me(this,io,t=>{if(typeof window<"u"&&window.addEventListener){const s=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",s,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",s),window.removeEventListener("offline",r)}}})}onSubscribe(){X(this,Pa)||this.setEventListener(X(this,io))}onUnsubscribe(){var t;this.hasListeners()||((t=X(this,Pa))==null||t.call(this),me(this,Pa,void 0))}setEventListener(t){var s;me(this,io,t),(s=X(this,Pa))==null||s.call(this),me(this,Pa,t(this.setOnline.bind(this)))}setOnline(t){X(this,ro)!==t&&(me(this,ro,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return X(this,ro)}},ro=new WeakMap,Pa=new WeakMap,io=new WeakMap,IS),Ud=new yT;function vT(e){return Math.min(1e3*2**e,3e4)}function vw(e){return(e??"online")==="online"?Ud.isOnline():!0}var Up=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function bw(e){let t=!1,s=0,r;const i=Hp(),l=()=>i.status!=="pending",d=w=>{var N;if(!l()){const C=new Up(w);y(C),(N=e.onCancel)==null||N.call(e,C)}},f=()=>{t=!0},m=()=>{t=!1},h=()=>Og.isFocused()&&(e.networkMode==="always"||Ud.isOnline())&&e.canRun(),v=()=>vw(e.networkMode)&&e.canRun(),g=w=>{l()||(r==null||r(),i.resolve(w))},y=w=>{l()||(r==null||r(),i.reject(w))},b=()=>new Promise(w=>{var N;r=C=>{(l()||h())&&w(C)},(N=e.onPause)==null||N.call(e)}).then(()=>{var w;r=void 0,l()||(w=e.onContinue)==null||w.call(e)}),S=()=>{if(l())return;let w;const N=s===0?e.initialPromise:void 0;try{w=N??e.fn()}catch(C){w=Promise.reject(C)}Promise.resolve(w).then(g).catch(C=>{var B;if(l())return;const T=e.retry??(Vl.isServer()?0:3),_=e.retryDelay??vT,R=typeof _=="function"?_(s,C):_,O=T===!0||typeof T=="number"&&s<T||typeof T=="function"&&T(s,C);if(t||!O){y(C);return}s++,(B=e.onFail)==null||B.call(e,s,C),fT(R).then(()=>h()?void 0:b()).then(()=>{t?y(C):S()})})};return{promise:i,status:()=>i.status,cancel:d,continue:()=>(r==null||r(),i),cancelRetry:f,continueRetry:m,canStart:v,start:()=>(v()?S():b().then(S),i)}}var zr,BS,Sw=(BS=class{constructor(){je(this,zr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Pp(this.gcTime)&&me(this,zr,Mr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Vl.isServer()?1/0:300*1e3))}clearGcTimeout(){X(this,zr)&&(Mr.clearTimeout(X(this,zr)),me(this,zr,void 0))}},zr=new WeakMap,BS),Pr,oo,On,Ir,Rt,uc,Br,bn,ww,Bs,HS,bT=(HS=class extends Sw{constructor(t){super();je(this,bn);je(this,Pr);je(this,oo);je(this,On);je(this,Ir);je(this,Rt);je(this,uc);je(this,Br);me(this,Br,!1),me(this,uc,t.defaultOptions),this.setOptions(t.options),this.observers=[],me(this,Ir,t.client),me(this,On,X(this,Ir).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,me(this,Pr,Yb(this.options)),this.state=t.state??X(this,Pr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=X(this,Rt))==null?void 0:t.promise}setOptions(t){if(this.options={...X(this,uc),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const s=Yb(this.options);s.data!==void 0&&(this.setState(Gb(s.data,s.dataUpdatedAt)),me(this,Pr,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&X(this,On).remove(this)}setData(t,s){const r=Bp(this.state.data,t,this.options);return Le(this,bn,Bs).call(this,{data:r,type:"success",dataUpdatedAt:s==null?void 0:s.updatedAt,manual:s==null?void 0:s.manual}),r}setState(t,s){Le(this,bn,Bs).call(this,{type:"setState",state:t,setStateOptions:s})}cancel(t){var r,i;const s=(r=X(this,Rt))==null?void 0:r.promise;return(i=X(this,Rt))==null||i.cancel(t),s?s.then(Yt).catch(Yt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return X(this,Pr)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Dn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Lg||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Fa(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!gw(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=X(this,Rt))==null||s.continue()}onOnline(){var s;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=X(this,Rt))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),X(this,On).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(s=>s!==t),this.observers.length||(X(this,Rt)&&(X(this,Br)||Le(this,bn,ww).call(this)?X(this,Rt).cancel({revert:!0}):X(this,Rt).cancelRetry()),this.scheduleGc()),X(this,On).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Le(this,bn,Bs).call(this,{type:"invalidate"})}async fetch(t,s){var m,h,v,g,y,b,S,w,N,C,T,_;if(this.state.fetchStatus!=="idle"&&((m=X(this,Rt))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(X(this,Rt))return X(this,Rt).continueRetry(),X(this,Rt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const R=this.observers.find(O=>O.options.queryFn);R&&this.setOptions(R.options)}const r=new AbortController,i=R=>{Object.defineProperty(R,"signal",{enumerable:!0,get:()=>(me(this,Br,!0),r.signal)})},l=()=>{const R=yw(this.options,s),B=(()=>{const L={client:X(this,Ir),queryKey:this.queryKey,meta:this.meta};return i(L),L})();return me(this,Br,!1),this.options.persister?this.options.persister(R,B,this):R(B)},f=(()=>{const R={fetchOptions:s,options:this.options,queryKey:this.queryKey,client:X(this,Ir),state:this.state,fetchFn:l};return i(R),R})();(h=this.options.behavior)==null||h.onFetch(f,this),me(this,oo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((v=f.fetchOptions)==null?void 0:v.meta))&&Le(this,bn,Bs).call(this,{type:"fetch",meta:(g=f.fetchOptions)==null?void 0:g.meta}),me(this,Rt,bw({initialPromise:s==null?void 0:s.initialPromise,fn:f.fetchFn,onCancel:R=>{R instanceof Up&&R.revert&&this.setState({...X(this,oo),fetchStatus:"idle"}),r.abort()},onFail:(R,O)=>{Le(this,bn,Bs).call(this,{type:"failed",failureCount:R,error:O})},onPause:()=>{Le(this,bn,Bs).call(this,{type:"pause"})},onContinue:()=>{Le(this,bn,Bs).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const R=await X(this,Rt).start();if(R===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(R),(b=(y=X(this,On).config).onSuccess)==null||b.call(y,R,this),(w=(S=X(this,On).config).onSettled)==null||w.call(S,R,this.state.error,this),R}catch(R){if(R instanceof Up){if(R.silent)return X(this,Rt).promise;if(R.revert){if(this.state.data===void 0)throw R;return this.state.data}}throw Le(this,bn,Bs).call(this,{type:"error",error:R}),(C=(N=X(this,On).config).onError)==null||C.call(N,R,this),(_=(T=X(this,On).config).onSettled)==null||_.call(T,this.state.data,R,this),R}finally{this.scheduleGc()}}},Pr=new WeakMap,oo=new WeakMap,On=new WeakMap,Ir=new WeakMap,Rt=new WeakMap,uc=new WeakMap,Br=new WeakMap,bn=new WeakSet,ww=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Bs=function(t){const s=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Nw(r.data,this.options),fetchMeta:t.meta??null};case"success":const i={...r,...Gb(t.data,t.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return me(this,oo,t.manual?i:void 0),i;case"error":const l=t.error;return{...r,error:l,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:l,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=s(this.state),Et.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),X(this,On).notify({query:this,type:"updated",action:t})})},HS);function Nw(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:vw(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Gb(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Yb(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,s=t!==void 0,r=s?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:s?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:s?"success":"pending",fetchStatus:"idle"}}var rn,qe,dc,Gt,Hr,lo,Hs,Ia,fc,co,uo,Ur,$r,Ba,fo,Ke,Ol,$p,qp,Vp,Gp,Yp,Qp,Kp,jw,US,ST=(US=class extends Eo{constructor(t,s){super();je(this,Ke);je(this,rn);je(this,qe);je(this,dc);je(this,Gt);je(this,Hr);je(this,lo);je(this,Hs);je(this,Ia);je(this,fc);je(this,co);je(this,uo);je(this,Ur);je(this,$r);je(this,Ba);je(this,fo,new Set);this.options=s,me(this,rn,t),me(this,Ia,null),me(this,Hs,Hp()),this.bindMethods(),this.setOptions(s)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(X(this,qe).addObserver(this),Qb(X(this,qe),this.options)?Le(this,Ke,Ol).call(this):this.updateResult(),Le(this,Ke,Gp).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Fp(X(this,qe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Fp(X(this,qe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Le(this,Ke,Yp).call(this),Le(this,Ke,Qp).call(this),X(this,qe).removeObserver(this)}setOptions(t){const s=this.options,r=X(this,qe);if(this.options=X(this,rn).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Dn(this.options.enabled,X(this,qe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Le(this,Ke,Kp).call(this),X(this,qe).setOptions(this.options),s._defaulted&&!Hd(this.options,s)&&X(this,rn).getQueryCache().notify({type:"observerOptionsUpdated",query:X(this,qe),observer:this});const i=this.hasListeners();i&&Kb(X(this,qe),r,this.options,s)&&Le(this,Ke,Ol).call(this),this.updateResult(),i&&(X(this,qe)!==r||Dn(this.options.enabled,X(this,qe))!==Dn(s.enabled,X(this,qe))||Fa(this.options.staleTime,X(this,qe))!==Fa(s.staleTime,X(this,qe)))&&Le(this,Ke,$p).call(this);const l=Le(this,Ke,qp).call(this);i&&(X(this,qe)!==r||Dn(this.options.enabled,X(this,qe))!==Dn(s.enabled,X(this,qe))||l!==X(this,Ba))&&Le(this,Ke,Vp).call(this,l)}getOptimisticResult(t){const s=X(this,rn).getQueryCache().build(X(this,rn),t),r=this.createResult(s,t);return NT(this,r)&&(me(this,Gt,r),me(this,lo,this.options),me(this,Hr,X(this,qe).state)),r}getCurrentResult(){return X(this,Gt)}trackResult(t,s){return new Proxy(t,{get:(r,i)=>(this.trackProp(i),s==null||s(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&X(this,Hs).status==="pending"&&X(this,Hs).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(t){X(this,fo).add(t)}getCurrentQuery(){return X(this,qe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const s=X(this,rn).defaultQueryOptions(t),r=X(this,rn).getQueryCache().build(X(this,rn),s);return r.fetch().then(()=>this.createResult(r,s))}fetch(t){return Le(this,Ke,Ol).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),X(this,Gt)))}createResult(t,s){var I;const r=X(this,qe),i=this.options,l=X(this,Gt),d=X(this,Hr),f=X(this,lo),h=t!==r?t.state:X(this,dc),{state:v}=t;let g={...v},y=!1,b;if(s._optimisticResults){const H=this.hasListeners(),D=!H&&Qb(t,s),Y=H&&Kb(t,r,s,i);(D||Y)&&(g={...g,...Nw(v.data,t.options)}),s._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:S,errorUpdatedAt:w,status:N}=g;b=g.data;let C=!1;if(s.placeholderData!==void 0&&b===void 0&&N==="pending"){let H;l!=null&&l.isPlaceholderData&&s.placeholderData===(f==null?void 0:f.placeholderData)?(H=l.data,C=!0):H=typeof s.placeholderData=="function"?s.placeholderData((I=X(this,uo))==null?void 0:I.state.data,X(this,uo)):s.placeholderData,H!==void 0&&(N="success",b=Bp(l==null?void 0:l.data,H,s),y=!0)}if(s.select&&b!==void 0&&!C)if(l&&b===(d==null?void 0:d.data)&&s.select===X(this,fc))b=X(this,co);else try{me(this,fc,s.select),b=s.select(b),b=Bp(l==null?void 0:l.data,b,s),me(this,co,b),me(this,Ia,null)}catch(H){me(this,Ia,H)}X(this,Ia)&&(S=X(this,Ia),b=X(this,co),w=Date.now(),N="error");const T=g.fetchStatus==="fetching",_=N==="pending",R=N==="error",O=_&&T,B=b!==void 0,M={status:N,fetchStatus:g.fetchStatus,isPending:_,isSuccess:N==="success",isError:R,isInitialLoading:O,isLoading:O,data:b,dataUpdatedAt:g.dataUpdatedAt,error:S,errorUpdatedAt:w,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>h.dataUpdateCount||g.errorUpdateCount>h.errorUpdateCount,isFetching:T,isRefetching:T&&!_,isLoadingError:R&&!B,isPaused:g.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:R&&B,isStale:Pg(t,s),refetch:this.refetch,promise:X(this,Hs),isEnabled:Dn(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const H=M.data!==void 0,D=M.status==="error"&&!H,Y=q=>{D?q.reject(M.error):H&&q.resolve(M.data)},K=()=>{const q=me(this,Hs,M.promise=Hp());Y(q)},U=X(this,Hs);switch(U.status){case"pending":t.queryHash===r.queryHash&&Y(U);break;case"fulfilled":(D||M.data!==U.value)&&K();break;case"rejected":(!D||M.error!==U.reason)&&K();break}}return M}updateResult(){const t=X(this,Gt),s=this.createResult(X(this,qe),this.options);if(me(this,Hr,X(this,qe).state),me(this,lo,this.options),X(this,Hr).data!==void 0&&me(this,uo,X(this,qe)),Hd(s,t))return;me(this,Gt,s);const r=()=>{if(!t)return!0;const{notifyOnChangeProps:i}=this.options,l=typeof i=="function"?i():i;if(l==="all"||!l&&!X(this,fo).size)return!0;const d=new Set(l??X(this,fo));return this.options.throwOnError&&d.add("error"),Object.keys(X(this,Gt)).some(f=>{const m=f;return X(this,Gt)[m]!==t[m]&&d.has(m)})};Le(this,Ke,jw).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Le(this,Ke,Gp).call(this)}},rn=new WeakMap,qe=new WeakMap,dc=new WeakMap,Gt=new WeakMap,Hr=new WeakMap,lo=new WeakMap,Hs=new WeakMap,Ia=new WeakMap,fc=new WeakMap,co=new WeakMap,uo=new WeakMap,Ur=new WeakMap,$r=new WeakMap,Ba=new WeakMap,fo=new WeakMap,Ke=new WeakSet,Ol=function(t){Le(this,Ke,Kp).call(this);let s=X(this,qe).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(Yt)),s},$p=function(){Le(this,Ke,Yp).call(this);const t=Fa(this.options.staleTime,X(this,qe));if(Vl.isServer()||X(this,Gt).isStale||!Pp(t))return;const r=gw(X(this,Gt).dataUpdatedAt,t)+1;me(this,Ur,Mr.setTimeout(()=>{X(this,Gt).isStale||this.updateResult()},r))},qp=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(X(this,qe)):this.options.refetchInterval)??!1},Vp=function(t){Le(this,Ke,Qp).call(this),me(this,Ba,t),!(Vl.isServer()||Dn(this.options.enabled,X(this,qe))===!1||!Pp(X(this,Ba))||X(this,Ba)===0)&&me(this,$r,Mr.setInterval(()=>{(this.options.refetchIntervalInBackground||Og.isFocused())&&Le(this,Ke,Ol).call(this)},X(this,Ba)))},Gp=function(){Le(this,Ke,$p).call(this),Le(this,Ke,Vp).call(this,Le(this,Ke,qp).call(this))},Yp=function(){X(this,Ur)&&(Mr.clearTimeout(X(this,Ur)),me(this,Ur,void 0))},Qp=function(){X(this,$r)&&(Mr.clearInterval(X(this,$r)),me(this,$r,void 0))},Kp=function(){const t=X(this,rn).getQueryCache().build(X(this,rn),this.options);if(t===X(this,qe))return;const s=X(this,qe);me(this,qe,t),me(this,dc,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},jw=function(t){Et.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(X(this,Gt))}),X(this,rn).getQueryCache().notify({query:X(this,qe),type:"observerResultsUpdated"})})},US);function wT(e,t){return Dn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Qb(e,t){return wT(e,t)||e.state.data!==void 0&&Fp(e,t,t.refetchOnMount)}function Fp(e,t,s){if(Dn(t.enabled,e)!==!1&&Fa(t.staleTime,e)!=="static"){const r=typeof s=="function"?s(e):s;return r==="always"||r!==!1&&Pg(e,t)}return!1}function Kb(e,t,s,r){return(e!==t||Dn(r.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&Pg(e,s)}function Pg(e,t){return Dn(t.enabled,e)!==!1&&e.isStaleByTime(Fa(t.staleTime,e))}function NT(e,t){return!Hd(e.getCurrentResult(),t)}function Fb(e){return{onFetch:(t,s)=>{var v,g,y,b,S;const r=t.options,i=(y=(g=(v=t.fetchOptions)==null?void 0:v.meta)==null?void 0:g.fetchMore)==null?void 0:y.direction,l=((b=t.state.data)==null?void 0:b.pages)||[],d=((S=t.state.data)==null?void 0:S.pageParams)||[];let f={pages:[],pageParams:[]},m=0;const h=async()=>{let w=!1;const N=_=>{pT(_,()=>t.signal,()=>w=!0)},C=yw(t.options,t.fetchOptions),T=async(_,R,O)=>{if(w)return Promise.reject();if(R==null&&_.pages.length)return Promise.resolve(_);const L=(()=>{const D={client:t.client,queryKey:t.queryKey,pageParam:R,direction:O?"backward":"forward",meta:t.options.meta};return N(D),D})(),M=await C(L),{maxPages:I}=t.options,H=O?mT:hT;return{pages:H(_.pages,M,I),pageParams:H(_.pageParams,R,I)}};if(i&&l.length){const _=i==="backward",R=_?jT:Xb,O={pages:l,pageParams:d},B=R(r,O);f=await T(O,B,_)}else{const _=e??l.length;do{const R=m===0?d[0]??r.initialPageParam:Xb(r,f);if(m>0&&R==null)break;f=await T(f,R),m++}while(m<_)}return f};t.options.persister?t.fetchFn=()=>{var w,N;return(N=(w=t.options).persister)==null?void 0:N.call(w,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},s)}:t.fetchFn=h}}}function Xb(e,{pages:t,pageParams:s}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,s[r],s):void 0}function jT(e,{pages:t,pageParams:s}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,s[0],s):void 0}var hc,as,Ht,qr,rs,Ma,$S,ET=($S=class extends Sw{constructor(t){super();je(this,rs);je(this,hc);je(this,as);je(this,Ht);je(this,qr);me(this,hc,t.client),this.mutationId=t.mutationId,me(this,Ht,t.mutationCache),me(this,as,[]),this.state=t.state||Ew(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){X(this,as).includes(t)||(X(this,as).push(t),this.clearGcTimeout(),X(this,Ht).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){me(this,as,X(this,as).filter(s=>s!==t)),this.scheduleGc(),X(this,Ht).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){X(this,as).length||(this.state.status==="pending"?this.scheduleGc():X(this,Ht).remove(this))}continue(){var t;return((t=X(this,qr))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var d,f,m,h,v,g,y,b,S,w,N,C,T,_,R,O,B,L;const s=()=>{Le(this,rs,Ma).call(this,{type:"continue"})},r={client:X(this,hc),meta:this.options.meta,mutationKey:this.options.mutationKey};me(this,qr,bw({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(M,I)=>{Le(this,rs,Ma).call(this,{type:"failed",failureCount:M,error:I})},onPause:()=>{Le(this,rs,Ma).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>X(this,Ht).canRun(this)}));const i=this.state.status==="pending",l=!X(this,qr).canStart();try{if(i)s();else{Le(this,rs,Ma).call(this,{type:"pending",variables:t,isPaused:l}),X(this,Ht).config.onMutate&&await X(this,Ht).config.onMutate(t,this,r);const I=await((f=(d=this.options).onMutate)==null?void 0:f.call(d,t,r));I!==this.state.context&&Le(this,rs,Ma).call(this,{type:"pending",context:I,variables:t,isPaused:l})}const M=await X(this,qr).start();return await((h=(m=X(this,Ht).config).onSuccess)==null?void 0:h.call(m,M,t,this.state.context,this,r)),await((g=(v=this.options).onSuccess)==null?void 0:g.call(v,M,t,this.state.context,r)),await((b=(y=X(this,Ht).config).onSettled)==null?void 0:b.call(y,M,null,this.state.variables,this.state.context,this,r)),await((w=(S=this.options).onSettled)==null?void 0:w.call(S,M,null,t,this.state.context,r)),Le(this,rs,Ma).call(this,{type:"success",data:M}),M}catch(M){try{await((C=(N=X(this,Ht).config).onError)==null?void 0:C.call(N,M,t,this.state.context,this,r))}catch(I){Promise.reject(I)}try{await((_=(T=this.options).onError)==null?void 0:_.call(T,M,t,this.state.context,r))}catch(I){Promise.reject(I)}try{await((O=(R=X(this,Ht).config).onSettled)==null?void 0:O.call(R,void 0,M,this.state.variables,this.state.context,this,r))}catch(I){Promise.reject(I)}try{await((L=(B=this.options).onSettled)==null?void 0:L.call(B,void 0,M,t,this.state.context,r))}catch(I){Promise.reject(I)}throw Le(this,rs,Ma).call(this,{type:"error",error:M}),M}finally{X(this,Ht).runNext(this)}}},hc=new WeakMap,as=new WeakMap,Ht=new WeakMap,qr=new WeakMap,rs=new WeakSet,Ma=function(t){const s=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=s(this.state),Et.batch(()=>{X(this,as).forEach(r=>{r.onMutationUpdate(t)}),X(this,Ht).notify({mutation:this,type:"updated",action:t})})},$S);function Ew(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Us,Un,mc,qS,CT=(qS=class extends Eo{constructor(t={}){super();je(this,Us);je(this,Un);je(this,mc);this.config=t,me(this,Us,new Set),me(this,Un,new Map),me(this,mc,0)}build(t,s,r){const i=new ET({client:t,mutationCache:this,mutationId:++Qu(this,mc)._,options:t.defaultMutationOptions(s),state:r});return this.add(i),i}add(t){X(this,Us).add(t);const s=Zu(t);if(typeof s=="string"){const r=X(this,Un).get(s);r?r.push(t):X(this,Un).set(s,[t])}this.notify({type:"added",mutation:t})}remove(t){if(X(this,Us).delete(t)){const s=Zu(t);if(typeof s=="string"){const r=X(this,Un).get(s);if(r)if(r.length>1){const i=r.indexOf(t);i!==-1&&r.splice(i,1)}else r[0]===t&&X(this,Un).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=Zu(t);if(typeof s=="string"){const r=X(this,Un).get(s),i=r==null?void 0:r.find(l=>l.state.status==="pending");return!i||i===t}else return!0}runNext(t){var r;const s=Zu(t);if(typeof s=="string"){const i=(r=X(this,Un).get(s))==null?void 0:r.find(l=>l!==t&&l.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Et.batch(()=>{X(this,Us).forEach(t=>{this.notify({type:"removed",mutation:t})}),X(this,Us).clear(),X(this,Un).clear()})}getAll(){return Array.from(X(this,Us))}find(t){const s={exact:!0,...t};return this.getAll().find(r=>$b(s,r))}findAll(t={}){return this.getAll().filter(s=>$b(t,s))}notify(t){Et.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return Et.batch(()=>Promise.all(t.map(s=>s.continue().catch(Yt))))}},Us=new WeakMap,Un=new WeakMap,mc=new WeakMap,qS);function Zu(e){var t;return(t=e.options.scope)==null?void 0:t.id}var $s,Ha,on,qs,Ks,Ed,Xp,VS,_T=(VS=class extends Eo{constructor(s,r){super();je(this,Ks);je(this,$s);je(this,Ha);je(this,on);je(this,qs);me(this,$s,s),this.setOptions(r),this.bindMethods(),Le(this,Ks,Ed).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(s){var i;const r=this.options;this.options=X(this,$s).defaultMutationOptions(s),Hd(this.options,r)||X(this,$s).getMutationCache().notify({type:"observerOptionsUpdated",mutation:X(this,on),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Zr(r.mutationKey)!==Zr(this.options.mutationKey)?this.reset():((i=X(this,on))==null?void 0:i.state.status)==="pending"&&X(this,on).setOptions(this.options)}onUnsubscribe(){var s;this.hasListeners()||(s=X(this,on))==null||s.removeObserver(this)}onMutationUpdate(s){Le(this,Ks,Ed).call(this),Le(this,Ks,Xp).call(this,s)}getCurrentResult(){return X(this,Ha)}reset(){var s;(s=X(this,on))==null||s.removeObserver(this),me(this,on,void 0),Le(this,Ks,Ed).call(this),Le(this,Ks,Xp).call(this)}mutate(s,r){var i;return me(this,qs,r),(i=X(this,on))==null||i.removeObserver(this),me(this,on,X(this,$s).getMutationCache().build(X(this,$s),this.options)),X(this,on).addObserver(this),X(this,on).execute(s)}},$s=new WeakMap,Ha=new WeakMap,on=new WeakMap,qs=new WeakMap,Ks=new WeakSet,Ed=function(){var r;const s=((r=X(this,on))==null?void 0:r.state)??Ew();me(this,Ha,{...s,isPending:s.status==="pending",isSuccess:s.status==="success",isError:s.status==="error",isIdle:s.status==="idle",mutate:this.mutate,reset:this.reset})},Xp=function(s){Et.batch(()=>{var r,i,l,d,f,m,h,v;if(X(this,qs)&&this.hasListeners()){const g=X(this,Ha).variables,y=X(this,Ha).context,b={client:X(this,$s),meta:this.options.meta,mutationKey:this.options.mutationKey};if((s==null?void 0:s.type)==="success"){try{(i=(r=X(this,qs)).onSuccess)==null||i.call(r,s.data,g,y,b)}catch(S){Promise.reject(S)}try{(d=(l=X(this,qs)).onSettled)==null||d.call(l,s.data,null,g,y,b)}catch(S){Promise.reject(S)}}else if((s==null?void 0:s.type)==="error"){try{(m=(f=X(this,qs)).onError)==null||m.call(f,s.error,g,y,b)}catch(S){Promise.reject(S)}try{(v=(h=X(this,qs)).onSettled)==null||v.call(h,void 0,s.error,g,y,b)}catch(S){Promise.reject(S)}}}this.listeners.forEach(g=>{g(X(this,Ha))})})},VS),is,GS,RT=(GS=class extends Eo{constructor(t={}){super();je(this,is);this.config=t,me(this,is,new Map)}build(t,s,r){const i=s.queryKey,l=s.queryHash??Dg(i,s);let d=this.get(l);return d||(d=new bT({client:t,queryKey:i,queryHash:l,options:t.defaultQueryOptions(s),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(d)),d}add(t){X(this,is).has(t.queryHash)||(X(this,is).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=X(this,is).get(t.queryHash);s&&(t.destroy(),s===t&&X(this,is).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Et.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return X(this,is).get(t)}getAll(){return[...X(this,is).values()]}find(t){const s={exact:!0,...t};return this.getAll().find(r=>Ub(s,r))}findAll(t={}){const s=this.getAll();return Object.keys(t).length>0?s.filter(r=>Ub(t,r)):s}notify(t){Et.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){Et.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Et.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},is=new WeakMap,GS),ut,Ua,$a,ho,mo,qa,po,go,YS,TT=(YS=class{constructor(e={}){je(this,ut);je(this,Ua);je(this,$a);je(this,ho);je(this,mo);je(this,qa);je(this,po);je(this,go);me(this,ut,e.queryCache||new RT),me(this,Ua,e.mutationCache||new CT),me(this,$a,e.defaultOptions||{}),me(this,ho,new Map),me(this,mo,new Map),me(this,qa,0)}mount(){Qu(this,qa)._++,X(this,qa)===1&&(me(this,po,Og.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,ut).onFocus())})),me(this,go,Ud.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,ut).onOnline())})))}unmount(){var e,t;Qu(this,qa)._--,X(this,qa)===0&&((e=X(this,po))==null||e.call(this),me(this,po,void 0),(t=X(this,go))==null||t.call(this),me(this,go,void 0))}isFetching(e){return X(this,ut).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return X(this,Ua).findAll({...e,status:"pending"}).length}getQueryData(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=X(this,ut).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=X(this,ut).build(this,t),r=s.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(Fa(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return X(this,ut).findAll(e).map(({queryKey:t,state:s})=>{const r=s.data;return[t,r]})}setQueryData(e,t,s){const r=this.defaultQueryOptions({queryKey:e}),i=X(this,ut).get(r.queryHash),l=i==null?void 0:i.state.data,d=uT(t,l);if(d!==void 0)return X(this,ut).build(this,r).setData(d,{...s,manual:!0})}setQueriesData(e,t,s){return Et.batch(()=>X(this,ut).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,s)]))}getQueryState(e){var s;const t=this.defaultQueryOptions({queryKey:e});return(s=X(this,ut).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=X(this,ut);Et.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=X(this,ut);return Et.batch(()=>(s.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},r=Et.batch(()=>X(this,ut).findAll(e).map(i=>i.cancel(s)));return Promise.all(r).then(Yt).catch(Yt)}invalidateQueries(e,t={}){return Et.batch(()=>(X(this,ut).findAll(e).forEach(s=>{s.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const s={...t,cancelRefetch:t.cancelRefetch??!0},r=Et.batch(()=>X(this,ut).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let l=i.fetch(void 0,s);return s.throwOnError||(l=l.catch(Yt)),i.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(r).then(Yt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=X(this,ut).build(this,t);return s.isStaleByTime(Fa(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Yt).catch(Yt)}fetchInfiniteQuery(e){return e.behavior=Fb(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Yt).catch(Yt)}ensureInfiniteQueryData(e){return e.behavior=Fb(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ud.isOnline()?X(this,Ua).resumePausedMutations():Promise.resolve()}getQueryCache(){return X(this,ut)}getMutationCache(){return X(this,Ua)}getDefaultOptions(){return X(this,$a)}setDefaultOptions(e){me(this,$a,e)}setQueryDefaults(e,t){X(this,ho).set(Zr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...X(this,ho).values()],s={};return t.forEach(r=>{ql(e,r.queryKey)&&Object.assign(s,r.defaultOptions)}),s}setMutationDefaults(e,t){X(this,mo).set(Zr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...X(this,mo).values()],s={};return t.forEach(r=>{ql(e,r.mutationKey)&&Object.assign(s,r.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;const t={...X(this,$a).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Dg(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Lg&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...X(this,$a).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){X(this,ut).clear(),X(this,Ua).clear()}},ut=new WeakMap,Ua=new WeakMap,$a=new WeakMap,ho=new WeakMap,mo=new WeakMap,qa=new WeakMap,po=new WeakMap,go=new WeakMap,YS),Cw=j.createContext(void 0),Ct=e=>{const t=j.useContext(Cw);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},AT=({client:e,children:t})=>(j.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(Cw.Provider,{value:e,children:t})),_w=j.createContext(!1),MT=()=>j.useContext(_w);_w.Provider;function kT(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var OT=j.createContext(kT()),DT=()=>j.useContext(OT),LT=(e,t,s)=>{const r=s!=null&&s.state.error&&typeof e.throwOnError=="function"?zg(e.throwOnError,[s.state.error,s]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},zT=e=>{j.useEffect(()=>{e.clearReset()},[e])},PT=({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||zg(s,[e.error,r])),IT=e=>{if(e.suspense){const s=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},BT=(e,t)=>e.isLoading&&e.isFetching&&!t,HT=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Zb=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function UT(e,t,s){var y,b,S,w;const r=MT(),i=DT(),l=Ct(),d=l.defaultQueryOptions(e);(b=(y=l.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||b.call(y,d);const f=l.getQueryCache().get(d.queryHash);d._optimisticResults=r?"isRestoring":"optimistic",IT(d),LT(d,i,f),zT(i);const m=!l.getQueryCache().get(d.queryHash),[h]=j.useState(()=>new t(l,d)),v=h.getOptimisticResult(d),g=!r&&e.subscribed!==!1;if(j.useSyncExternalStore(j.useCallback(N=>{const C=g?h.subscribe(Et.batchCalls(N)):Yt;return h.updateResult(),C},[h,g]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),j.useEffect(()=>{h.setOptions(d)},[d,h]),HT(d,v))throw Zb(d,h,i);if(PT({result:v,errorResetBoundary:i,throwOnError:d.throwOnError,query:f,suspense:d.suspense}))throw v.error;if((w=(S=l.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||w.call(S,d,v),d.experimental_prefetchInRender&&!Vl.isServer()&&BT(v,r)){const N=m?Zb(d,h,i):f==null?void 0:f.promise;N==null||N.catch(Yt).finally(()=>{h.updateResult()})}return d.notifyOnChangeProps?v:h.trackResult(v)}function Tt(e,t){return UT(e,ST)}function Pt(e,t){const s=Ct(),[r]=j.useState(()=>new _T(s,e));j.useEffect(()=>{r.setOptions(e)},[r,e]);const i=j.useSyncExternalStore(j.useCallback(d=>r.subscribe(Et.batchCalls(d)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),l=j.useCallback((d,f)=>{r.mutate(d,f).catch(Yt)},[r]);if(i.error&&zg(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:l,mutateAsync:i.mutate}}const $T=new TT({defaultOptions:{queries:{staleTime:5e3,gcTime:5*6e4,retry:1,refetchOnWindowFocus:!1}}});/**
66
- * @license lucide-react v1.6.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 Rw=(...e)=>e.filter((t,s,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===s).join(" ").trim();/**
71
- * @license lucide-react v1.6.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 qT=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
76
- * @license lucide-react v1.6.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 VT=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,s,r)=>r?r.toUpperCase():s.toLowerCase());/**
81
- * @license lucide-react v1.6.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
- */const Wb=e=>{const t=VT(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
86
- * @license lucide-react v1.6.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
- */var dp={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"};/**
91
- * @license lucide-react v1.6.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 GT=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},YT=j.createContext({}),QT=()=>j.useContext(YT),KT=j.forwardRef(({color:e,size:t,strokeWidth:s,absoluteStrokeWidth:r,className:i="",children:l,iconNode:d,...f},m)=>{const{size:h=24,strokeWidth:v=2,absoluteStrokeWidth:g=!1,color:y="currentColor",className:b=""}=QT()??{},S=r??g?Number(s??v)*24/Number(t??h):s??v;return j.createElement("svg",{ref:m,...dp,width:t??h??dp.width,height:t??h??dp.height,stroke:e??y,strokeWidth:S,className:Rw("lucide",b,i),...!l&&!GT(f)&&{"aria-hidden":"true"},...f},[...d.map(([w,N])=>j.createElement(w,N)),...Array.isArray(l)?l:[l]])});/**
96
- * @license lucide-react v1.6.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 Nn=(e,t)=>{const s=j.forwardRef(({className:r,...i},l)=>j.createElement(KT,{ref:l,iconNode:t,className:Rw(`lucide-${qT(Wb(e))}`,`lucide-${e}`,r),...i}));return s.displayName=Wb(e),s};/**
101
- * @license lucide-react v1.6.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 FT=[["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"}]],XT=Nn("boxes",FT);/**
106
- * @license lucide-react v1.6.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 ZT=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],WT=Nn("chevron-left",ZT);/**
111
- * @license lucide-react v1.6.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 JT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Tw=Nn("chevron-right",JT);/**
116
- * @license lucide-react v1.6.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 eA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],tA=Nn("circle-dot",eA);/**
121
- * @license lucide-react v1.6.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 nA=[["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}]],sA=Nn("cog",nA);/**
126
- * @license lucide-react v1.6.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 aA=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],rA=Nn("file-text",aA);/**
131
- * @license lucide-react v1.6.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 iA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],oA=Nn("globe",iA);/**
136
- * @license lucide-react v1.6.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 lA=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],cA=Nn("layers",lA);/**
141
- * @license lucide-react v1.6.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 uA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],dA=Nn("panels-top-left",uA);/**
146
- * @license lucide-react v1.6.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 fA=[["path",{d:"m10.852 14.772-.383.923",key:"11vil6"}],["path",{d:"M13.148 14.772a3 3 0 1 0-2.296-5.544l-.383-.923",key:"1v3clb"}],["path",{d:"m13.148 9.228.383-.923",key:"t2zzyc"}],["path",{d:"m13.53 15.696-.382-.924a3 3 0 1 1-2.296-5.544",key:"1bxfiv"}],["path",{d:"m14.772 10.852.923-.383",key:"k9m8cz"}],["path",{d:"m14.772 13.148.923.383",key:"1xvhww"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"m9.228 10.852-.923-.383",key:"1wtb30"}],["path",{d:"m9.228 13.148-.923.383",key:"1a830x"}]],hA=Nn("server-cog",fA);/**
151
- * @license lucide-react v1.6.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 mA=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],pA=Nn("server",mA);/**
156
- * @license lucide-react v1.6.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 gA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],xA=Nn("square-plus",gA);/**
161
- * @license lucide-react v1.6.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 yA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],vA=Nn("x",yA);async function bA(){const e=await fetch("/api/rigs/summary");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function xc(){return Tt({queryKey:["rigs","summary"],queryFn:bA})}async function SA(){const e=await fetch("/api/ps");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function Ig(){return Tt({queryKey:["ps"],queryFn:SA})}async function wA(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function Aw(e){return Tt({queryKey:["rig",e,"nodes"],queryFn:()=>wA(e),enabled:!!e})}function Mw(e){var t,s,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(s=Mw(e[t]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function kw(){for(var e,t,s=0,r="",i=arguments.length;s<i;s++)(e=arguments[s])&&(t=Mw(e))&&(r&&(r+=" "),r+=t);return r}const NA=(e,t)=>{const s=new Array(e.length+t.length);for(let r=0;r<e.length;r++)s[r]=e[r];for(let r=0;r<t.length;r++)s[e.length+r]=t[r];return s},jA=(e,t)=>({classGroupId:e,validator:t}),Ow=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),$d="-",Jb=[],EA="arbitrary..",CA=e=>{const t=RA(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return _A(d);const f=d.split($d),m=f[0]===""&&f.length>1?1:0;return Dw(f,m,t)},getConflictingClassGroupIds:(d,f)=>{if(f){const m=r[d],h=s[d];return m?h?NA(h,m):m:h||Jb}return s[d]||Jb}}},Dw=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const i=e[t],l=s.nextPart.get(i);if(l){const h=Dw(e,t+1,l);if(h)return h}const d=s.validators;if(d===null)return;const f=t===0?e.join($d):e.slice(t).join($d),m=d.length;for(let h=0;h<m;h++){const v=d[h];if(v.validator(f))return v.classGroupId}},_A=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),s=t.indexOf(":"),r=t.slice(0,s);return r?EA+r:void 0})(),RA=e=>{const{theme:t,classGroups:s}=e;return TA(s,t)},TA=(e,t)=>{const s=Ow();for(const r in e){const i=e[r];Bg(i,s,r,t)}return s},Bg=(e,t,s,r)=>{const i=e.length;for(let l=0;l<i;l++){const d=e[l];AA(d,t,s,r)}},AA=(e,t,s,r)=>{if(typeof e=="string"){MA(e,t,s);return}if(typeof e=="function"){kA(e,t,s,r);return}OA(e,t,s,r)},MA=(e,t,s)=>{const r=e===""?t:Lw(t,e);r.classGroupId=s},kA=(e,t,s,r)=>{if(DA(e)){Bg(e(r),t,s,r);return}t.validators===null&&(t.validators=[]),t.validators.push(jA(s,e))},OA=(e,t,s,r)=>{const i=Object.entries(e),l=i.length;for(let d=0;d<l;d++){const[f,m]=i[d];Bg(m,Lw(t,f),s,r)}},Lw=(e,t)=>{let s=e;const r=t.split($d),i=r.length;for(let l=0;l<i;l++){const d=r[l];let f=s.nextPart.get(d);f||(f=Ow(),s.nextPart.set(d,f)),s=f}return s},DA=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,LA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=Object.create(null),r=Object.create(null);const i=(l,d)=>{s[l]=d,t++,t>e&&(t=0,r=s,s=Object.create(null))};return{get(l){let d=s[l];if(d!==void 0)return d;if((d=r[l])!==void 0)return i(l,d),d},set(l,d){l in s?s[l]=d:i(l,d)}}},Zp="!",e1=":",zA=[],t1=(e,t,s,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:r,isExternal:i}),PA=e=>{const{prefix:t,experimentalParseClassName:s}=e;let r=i=>{const l=[];let d=0,f=0,m=0,h;const v=i.length;for(let w=0;w<v;w++){const N=i[w];if(d===0&&f===0){if(N===e1){l.push(i.slice(m,w)),m=w+1;continue}if(N==="/"){h=w;continue}}N==="["?d++:N==="]"?d--:N==="("?f++:N===")"&&f--}const g=l.length===0?i:i.slice(m);let y=g,b=!1;g.endsWith(Zp)?(y=g.slice(0,-1),b=!0):g.startsWith(Zp)&&(y=g.slice(1),b=!0);const S=h&&h>m?h-m:void 0;return t1(l,b,y,S)};if(t){const i=t+e1,l=r;r=d=>d.startsWith(i)?l(d.slice(i.length)):t1(zA,!1,d,void 0,!0)}if(s){const i=r;r=l=>s({className:l,parseClassName:i})}return r},IA=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((s,r)=>{t.set(s,1e6+r)}),s=>{const r=[];let i=[];for(let l=0;l<s.length;l++){const d=s[l],f=d[0]==="[",m=t.has(d);f||m?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(d)):i.push(d)}return i.length>0&&(i.sort(),r.push(...i)),r}},BA=e=>({cache:LA(e.cacheSize),parseClassName:PA(e),sortModifiers:IA(e),...CA(e)}),HA=/\s+/,UA=(e,t)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:l}=t,d=[],f=e.trim().split(HA);let m="";for(let h=f.length-1;h>=0;h-=1){const v=f[h],{isExternal:g,modifiers:y,hasImportantModifier:b,baseClassName:S,maybePostfixModifierPosition:w}=s(v);if(g){m=v+(m.length>0?" "+m:m);continue}let N=!!w,C=r(N?S.substring(0,w):S);if(!C){if(!N){m=v+(m.length>0?" "+m:m);continue}if(C=r(S),!C){m=v+(m.length>0?" "+m:m);continue}N=!1}const T=y.length===0?"":y.length===1?y[0]:l(y).join(":"),_=b?T+Zp:T,R=_+C;if(d.indexOf(R)>-1)continue;d.push(R);const O=i(C,N);for(let B=0;B<O.length;++B){const L=O[B];d.push(_+L)}m=v+(m.length>0?" "+m:m)}return m},$A=(...e)=>{let t=0,s,r,i="";for(;t<e.length;)(s=e[t++])&&(r=zw(s))&&(i&&(i+=" "),i+=r);return i},zw=e=>{if(typeof e=="string")return e;let t,s="";for(let r=0;r<e.length;r++)e[r]&&(t=zw(e[r]))&&(s&&(s+=" "),s+=t);return s},qA=(e,...t)=>{let s,r,i,l;const d=m=>{const h=t.reduce((v,g)=>g(v),e());return s=BA(h),r=s.cache.get,i=s.cache.set,l=f,f(m)},f=m=>{const h=r(m);if(h)return h;const v=UA(m,s);return i(m,v),v};return l=d,(...m)=>l($A(...m))},VA=[],jt=e=>{const t=s=>s[e]||VA;return t.isThemeGetter=!0,t},Pw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Iw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,GA=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,YA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,QA=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,KA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,FA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,XA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_a=e=>GA.test(e),ze=e=>!!e&&!Number.isNaN(Number(e)),Ra=e=>!!e&&Number.isInteger(Number(e)),fp=e=>e.endsWith("%")&&ze(e.slice(0,-1)),Ps=e=>YA.test(e),Bw=()=>!0,ZA=e=>QA.test(e)&&!KA.test(e),Hg=()=>!1,WA=e=>FA.test(e),JA=e=>XA.test(e),eM=e=>!ge(e)&&!xe(e),tM=e=>er(e,$w,Hg),ge=e=>Pw.test(e),_r=e=>er(e,qw,ZA),n1=e=>er(e,cM,ze),nM=e=>er(e,Gw,Bw),sM=e=>er(e,Vw,Hg),s1=e=>er(e,Hw,Hg),aM=e=>er(e,Uw,JA),Wu=e=>er(e,Yw,WA),xe=e=>Iw.test(e),_l=e=>si(e,qw),rM=e=>si(e,Vw),a1=e=>si(e,Hw),iM=e=>si(e,$w),oM=e=>si(e,Uw),Ju=e=>si(e,Yw,!0),lM=e=>si(e,Gw,!0),er=(e,t,s)=>{const r=Pw.exec(e);return r?r[1]?t(r[1]):s(r[2]):!1},si=(e,t,s=!1)=>{const r=Iw.exec(e);return r?r[1]?t(r[1]):s:!1},Hw=e=>e==="position"||e==="percentage",Uw=e=>e==="image"||e==="url",$w=e=>e==="length"||e==="size"||e==="bg-size",qw=e=>e==="length",cM=e=>e==="number",Vw=e=>e==="family-name",Gw=e=>e==="number"||e==="weight",Yw=e=>e==="shadow",uM=()=>{const e=jt("color"),t=jt("font"),s=jt("text"),r=jt("font-weight"),i=jt("tracking"),l=jt("leading"),d=jt("breakpoint"),f=jt("container"),m=jt("spacing"),h=jt("radius"),v=jt("shadow"),g=jt("inset-shadow"),y=jt("text-shadow"),b=jt("drop-shadow"),S=jt("blur"),w=jt("perspective"),N=jt("aspect"),C=jt("ease"),T=jt("animate"),_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],R=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],O=()=>[...R(),xe,ge],B=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],M=()=>[xe,ge,m],I=()=>[_a,"full","auto",...M()],H=()=>[Ra,"none","subgrid",xe,ge],D=()=>["auto",{span:["full",Ra,xe,ge]},Ra,xe,ge],Y=()=>[Ra,"auto",xe,ge],K=()=>["auto","min","max","fr",xe,ge],U=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],q=()=>["start","end","center","stretch","center-safe","end-safe"],A=()=>["auto",...M()],$=()=>[_a,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...M()],z=()=>[_a,"screen","full","dvw","lvw","svw","min","max","fit",...M()],G=()=>[_a,"screen","full","lh","dvh","lvh","svh","min","max","fit",...M()],V=()=>[e,xe,ge],P=()=>[...R(),a1,s1,{position:[xe,ge]}],Q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ee=()=>["auto","cover","contain",iM,tM,{size:[xe,ge]}],se=()=>[fp,_l,_r],oe=()=>["","none","full",h,xe,ge],ce=()=>["",ze,_l,_r],fe=()=>["solid","dashed","dotted","double"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],he=()=>[ze,fp,a1,s1],Ce=()=>["","none",S,xe,ge],Se=()=>["none",ze,xe,ge],ye=()=>["none",ze,xe,ge],ve=()=>[ze,xe,ge],de=()=>[_a,"full",...M()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ps],breakpoint:[Ps],color:[Bw],container:[Ps],"drop-shadow":[Ps],ease:["in","out","in-out"],font:[eM],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ps],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ps],shadow:[Ps],spacing:["px",ze],text:[Ps],"text-shadow":[Ps],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",_a,ge,xe,N]}],container:["container"],columns:[{columns:[ze,ge,xe,f]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:O()}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[Ra,"auto",xe,ge]}],basis:[{basis:[_a,"full","auto",f,...M()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ze,_a,"auto","initial","none",ge]}],grow:[{grow:["",ze,xe,ge]}],shrink:[{shrink:["",ze,xe,ge]}],order:[{order:[Ra,"first","last","none",xe,ge]}],"grid-cols":[{"grid-cols":H()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":H()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":K()}],"auto-rows":[{"auto-rows":K()}],gap:[{gap:M()}],"gap-x":[{"gap-x":M()}],"gap-y":[{"gap-y":M()}],"justify-content":[{justify:[...U(),"normal"]}],"justify-items":[{"justify-items":[...q(),"normal"]}],"justify-self":[{"justify-self":["auto",...q()]}],"align-content":[{content:["normal",...U()]}],"align-items":[{items:[...q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...q(),{baseline:["","last"]}]}],"place-content":[{"place-content":U()}],"place-items":[{"place-items":[...q(),"baseline"]}],"place-self":[{"place-self":["auto",...q()]}],p:[{p:M()}],px:[{px:M()}],py:[{py:M()}],ps:[{ps:M()}],pe:[{pe:M()}],pbs:[{pbs:M()}],pbe:[{pbe:M()}],pt:[{pt:M()}],pr:[{pr:M()}],pb:[{pb:M()}],pl:[{pl:M()}],m:[{m:A()}],mx:[{mx:A()}],my:[{my:A()}],ms:[{ms:A()}],me:[{me:A()}],mbs:[{mbs:A()}],mbe:[{mbe:A()}],mt:[{mt:A()}],mr:[{mr:A()}],mb:[{mb:A()}],ml:[{ml:A()}],"space-x":[{"space-x":M()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":M()}],"space-y-reverse":["space-y-reverse"],size:[{size:$()}],"inline-size":[{inline:["auto",...z()]}],"min-inline-size":[{"min-inline":["auto",...z()]}],"max-inline-size":[{"max-inline":["none",...z()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[f,"screen",...$()]}],"min-w":[{"min-w":[f,"screen","none",...$()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[d]},...$()]}],h:[{h:["screen","lh",...$()]}],"min-h":[{"min-h":["screen","lh","none",...$()]}],"max-h":[{"max-h":["screen","lh",...$()]}],"font-size":[{text:["base",s,_l,_r]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,lM,nM]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fp,ge]}],"font-family":[{font:[rM,sM,t]}],"font-features":[{"font-features":[ge]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,xe,ge]}],"line-clamp":[{"line-clamp":[ze,"none",xe,n1]}],leading:[{leading:[l,...M()]}],"list-image":[{"list-image":["none",xe,ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",xe,ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:V()}],"text-color":[{text:V()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:[ze,"from-font","auto",xe,_r]}],"text-decoration-color":[{decoration:V()}],"underline-offset":[{"underline-offset":[ze,"auto",xe,ge]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:M()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xe,ge]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",xe,ge]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:Q()}],"bg-size":[{bg:ee()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ra,xe,ge],radial:["",xe,ge],conic:[Ra,xe,ge]},oM,aM]}],"bg-color":[{bg:V()}],"gradient-from-pos":[{from:se()}],"gradient-via-pos":[{via:se()}],"gradient-to-pos":[{to:se()}],"gradient-from":[{from:V()}],"gradient-via":[{via:V()}],"gradient-to":[{to:V()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:ce()}],"border-w-x":[{"border-x":ce()}],"border-w-y":[{"border-y":ce()}],"border-w-s":[{"border-s":ce()}],"border-w-e":[{"border-e":ce()}],"border-w-bs":[{"border-bs":ce()}],"border-w-be":[{"border-be":ce()}],"border-w-t":[{"border-t":ce()}],"border-w-r":[{"border-r":ce()}],"border-w-b":[{"border-b":ce()}],"border-w-l":[{"border-l":ce()}],"divide-x":[{"divide-x":ce()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ce()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...fe(),"hidden","none"]}],"divide-style":[{divide:[...fe(),"hidden","none"]}],"border-color":[{border:V()}],"border-color-x":[{"border-x":V()}],"border-color-y":[{"border-y":V()}],"border-color-s":[{"border-s":V()}],"border-color-e":[{"border-e":V()}],"border-color-bs":[{"border-bs":V()}],"border-color-be":[{"border-be":V()}],"border-color-t":[{"border-t":V()}],"border-color-r":[{"border-r":V()}],"border-color-b":[{"border-b":V()}],"border-color-l":[{"border-l":V()}],"divide-color":[{divide:V()}],"outline-style":[{outline:[...fe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ze,xe,ge]}],"outline-w":[{outline:["",ze,_l,_r]}],"outline-color":[{outline:V()}],shadow:[{shadow:["","none",v,Ju,Wu]}],"shadow-color":[{shadow:V()}],"inset-shadow":[{"inset-shadow":["none",g,Ju,Wu]}],"inset-shadow-color":[{"inset-shadow":V()}],"ring-w":[{ring:ce()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:V()}],"ring-offset-w":[{"ring-offset":[ze,_r]}],"ring-offset-color":[{"ring-offset":V()}],"inset-ring-w":[{"inset-ring":ce()}],"inset-ring-color":[{"inset-ring":V()}],"text-shadow":[{"text-shadow":["none",y,Ju,Wu]}],"text-shadow-color":[{"text-shadow":V()}],opacity:[{opacity:[ze,xe,ge]}],"mix-blend":[{"mix-blend":[...ue(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ue()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ze]}],"mask-image-linear-from-pos":[{"mask-linear-from":he()}],"mask-image-linear-to-pos":[{"mask-linear-to":he()}],"mask-image-linear-from-color":[{"mask-linear-from":V()}],"mask-image-linear-to-color":[{"mask-linear-to":V()}],"mask-image-t-from-pos":[{"mask-t-from":he()}],"mask-image-t-to-pos":[{"mask-t-to":he()}],"mask-image-t-from-color":[{"mask-t-from":V()}],"mask-image-t-to-color":[{"mask-t-to":V()}],"mask-image-r-from-pos":[{"mask-r-from":he()}],"mask-image-r-to-pos":[{"mask-r-to":he()}],"mask-image-r-from-color":[{"mask-r-from":V()}],"mask-image-r-to-color":[{"mask-r-to":V()}],"mask-image-b-from-pos":[{"mask-b-from":he()}],"mask-image-b-to-pos":[{"mask-b-to":he()}],"mask-image-b-from-color":[{"mask-b-from":V()}],"mask-image-b-to-color":[{"mask-b-to":V()}],"mask-image-l-from-pos":[{"mask-l-from":he()}],"mask-image-l-to-pos":[{"mask-l-to":he()}],"mask-image-l-from-color":[{"mask-l-from":V()}],"mask-image-l-to-color":[{"mask-l-to":V()}],"mask-image-x-from-pos":[{"mask-x-from":he()}],"mask-image-x-to-pos":[{"mask-x-to":he()}],"mask-image-x-from-color":[{"mask-x-from":V()}],"mask-image-x-to-color":[{"mask-x-to":V()}],"mask-image-y-from-pos":[{"mask-y-from":he()}],"mask-image-y-to-pos":[{"mask-y-to":he()}],"mask-image-y-from-color":[{"mask-y-from":V()}],"mask-image-y-to-color":[{"mask-y-to":V()}],"mask-image-radial":[{"mask-radial":[xe,ge]}],"mask-image-radial-from-pos":[{"mask-radial-from":he()}],"mask-image-radial-to-pos":[{"mask-radial-to":he()}],"mask-image-radial-from-color":[{"mask-radial-from":V()}],"mask-image-radial-to-color":[{"mask-radial-to":V()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":R()}],"mask-image-conic-pos":[{"mask-conic":[ze]}],"mask-image-conic-from-pos":[{"mask-conic-from":he()}],"mask-image-conic-to-pos":[{"mask-conic-to":he()}],"mask-image-conic-from-color":[{"mask-conic-from":V()}],"mask-image-conic-to-color":[{"mask-conic-to":V()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:Q()}],"mask-size":[{mask:ee()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",xe,ge]}],filter:[{filter:["","none",xe,ge]}],blur:[{blur:Ce()}],brightness:[{brightness:[ze,xe,ge]}],contrast:[{contrast:[ze,xe,ge]}],"drop-shadow":[{"drop-shadow":["","none",b,Ju,Wu]}],"drop-shadow-color":[{"drop-shadow":V()}],grayscale:[{grayscale:["",ze,xe,ge]}],"hue-rotate":[{"hue-rotate":[ze,xe,ge]}],invert:[{invert:["",ze,xe,ge]}],saturate:[{saturate:[ze,xe,ge]}],sepia:[{sepia:["",ze,xe,ge]}],"backdrop-filter":[{"backdrop-filter":["","none",xe,ge]}],"backdrop-blur":[{"backdrop-blur":Ce()}],"backdrop-brightness":[{"backdrop-brightness":[ze,xe,ge]}],"backdrop-contrast":[{"backdrop-contrast":[ze,xe,ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ze,xe,ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ze,xe,ge]}],"backdrop-invert":[{"backdrop-invert":["",ze,xe,ge]}],"backdrop-opacity":[{"backdrop-opacity":[ze,xe,ge]}],"backdrop-saturate":[{"backdrop-saturate":[ze,xe,ge]}],"backdrop-sepia":[{"backdrop-sepia":["",ze,xe,ge]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":M()}],"border-spacing-x":[{"border-spacing-x":M()}],"border-spacing-y":[{"border-spacing-y":M()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",xe,ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ze,"initial",xe,ge]}],ease:[{ease:["linear","initial",C,xe,ge]}],delay:[{delay:[ze,xe,ge]}],animate:[{animate:["none",T,xe,ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,xe,ge]}],"perspective-origin":[{"perspective-origin":O()}],rotate:[{rotate:Se()}],"rotate-x":[{"rotate-x":Se()}],"rotate-y":[{"rotate-y":Se()}],"rotate-z":[{"rotate-z":Se()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[xe,ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:O()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:de()}],"translate-x":[{"translate-x":de()}],"translate-y":[{"translate-y":de()}],"translate-z":[{"translate-z":de()}],"translate-none":["translate-none"],accent:[{accent:V()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:V()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",xe,ge]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":M()}],"scroll-mx":[{"scroll-mx":M()}],"scroll-my":[{"scroll-my":M()}],"scroll-ms":[{"scroll-ms":M()}],"scroll-me":[{"scroll-me":M()}],"scroll-mbs":[{"scroll-mbs":M()}],"scroll-mbe":[{"scroll-mbe":M()}],"scroll-mt":[{"scroll-mt":M()}],"scroll-mr":[{"scroll-mr":M()}],"scroll-mb":[{"scroll-mb":M()}],"scroll-ml":[{"scroll-ml":M()}],"scroll-p":[{"scroll-p":M()}],"scroll-px":[{"scroll-px":M()}],"scroll-py":[{"scroll-py":M()}],"scroll-ps":[{"scroll-ps":M()}],"scroll-pe":[{"scroll-pe":M()}],"scroll-pbs":[{"scroll-pbs":M()}],"scroll-pbe":[{"scroll-pbe":M()}],"scroll-pt":[{"scroll-pt":M()}],"scroll-pr":[{"scroll-pr":M()}],"scroll-pb":[{"scroll-pb":M()}],"scroll-pl":[{"scroll-pl":M()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",xe,ge]}],fill:[{fill:["none",...V()]}],"stroke-w":[{stroke:[ze,_l,_r,n1]}],stroke:[{stroke:["none",...V()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},dM=qA(uM);function Te(...e){return dM(kw(e))}function Gs(e,t=6){return e.length<=t?e:e.slice(-t)}function cs(e){if(!e)return null;const t=e.split(".");return t.length<=1?e:t[0]??e}function us(e){return e&&e.length>0?Gs(e):"ungrouped"}function Qr(e){if(!e)return"unknown";const t=e.split(".");return t.length<=1?e:t.at(-1)??e}function Wp(e){switch(e){case"ready":return"text-green-600";case"pending":return"text-amber-500";case"failed":return"text-red-600";default:return"text-stone-400"}}function fM(e){switch(e){case"running":return"text-green-600";case"partial":return"text-amber-500";case"stopped":return"text-stone-400";default:return"text-stone-400"}}function hM(e){return e.some(t=>t.startupStatus==="failed")?"failed":e.some(t=>t.startupStatus==="pending")?"pending":e.some(t=>t.startupStatus==="ready")?"ready":null}function mM(e){const t=e.match(/^\/rigs\/([^/]+)/);return(t==null?void 0:t[1])??null}function Ug({expanded:e,label:t,onClick:s}){return u.jsx("button",{type:"button",onClick:r=>{r.stopPropagation(),s()},"aria-label":`${e?"Collapse":"Expand"} ${t}`,className:"inline-flex h-5 w-5 items-center justify-center text-stone-500 transition-colors hover:text-stone-900",children:u.jsx(Tw,{className:Te("h-4 w-4 transition-transform duration-150",e&&"rotate-90")})})}function Gl({kind:e,statusClass:t,testId:s}){const i={"data-testid":s,className:Te(e==="rig"?"h-3.5 w-3.5":"h-2.5 w-2.5","shrink-0",t),strokeWidth:1.8};switch(e){case"environment":return u.jsx(oA,{...i});case"rig":return u.jsx(XT,{...i});case"pod":return u.jsx(cA,{...i});case"infrastructure":return u.jsx(pA,{...i});default:return u.jsx(tA,{...i})}}function pM({podId:e,nodes:t,selection:s,onSelect:r,autoExpand:i}){var v;const[l,d]=j.useState(i),f=cs((v=t[0])==null?void 0:v.logicalId)??us(e),m=hM(t);j.useEffect(()=>{i&&d(!0)},[i]);const h=[...t].sort((g,y)=>Qr(g.logicalId).localeCompare(Qr(y.logicalId)));return u.jsxs("div",{"data-testid":`pod-branch-${f}`,children:[u.jsxs("div",{className:"flex cursor-pointer items-center gap-2 rounded-sm px-4 py-1.5 hover:bg-stone-100",onClick:()=>d(g=>!g),children:[u.jsx(Ug,{expanded:l,label:`pod ${f}`,onClick:()=>d(g=>!g)}),u.jsx(Gl,{kind:"pod",statusClass:Wp(m),testId:`pod-icon-${f}`}),u.jsx("span",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.12em] text-stone-600",children:f})]}),l&&u.jsx("div",{className:"ml-4 border-l border-stone-200",children:h.map(g=>{const y=(s==null?void 0:s.type)==="node"&&s.rigId===g.rigId&&s.logicalId===g.logicalId,b=Qr(g.logicalId);return u.jsxs("button",{type:"button",onClick:()=>r({type:"node",rigId:g.rigId,logicalId:g.logicalId}),"data-testid":`node-${g.logicalId}`,className:Te("flex w-full items-center gap-2 rounded-sm px-4 py-1.5 text-left transition-colors hover:bg-stone-100",y&&"bg-stone-200/80"),children:[u.jsx(Gl,{kind:g.nodeKind==="infrastructure"?"infrastructure":"agent",statusClass:Wp(g.startupStatus),testId:`node-icon-${g.logicalId}`}),u.jsx("span",{className:"font-mono text-[10px] text-stone-700 truncate",children:b}),u.jsx("span",{className:"ml-auto shrink-0 font-mono text-[8px] uppercase text-stone-400",children:g.nodeKind==="infrastructure"?"INFRA":(g.runtime??"").replace("claude-code","claude")})]},g.logicalId)})})]})}function gM({rig:e,ps:t,selection:s,onSelect:r,onClose:i,autoExpand:l}){const[d,f]=j.useState(l),m=(t==null?void 0:t.status)??"stopped",{data:h,isLoading:v}=Aw(d?e.id:null),g=(s==null?void 0:s.type)==="rig"&&s.rigId===e.id;j.useEffect(()=>{l&&f(!0)},[l]);const y=j.useMemo(()=>{if(!h||h.length===0)return[];const b=new Map;for(const S of h){const w=S.podId??"__ungrouped__";b.has(w)||b.set(w,[]),b.get(w).push(S)}return[...b.entries()].sort(([S,w],[N,C])=>{var R,O;const T=S==="__ungrouped__"?"ungrouped":cs((R=w[0])==null?void 0:R.logicalId)??us(S),_=N==="__ungrouped__"?"ungrouped":cs((O=C[0])==null?void 0:O.logicalId)??us(N);return T.localeCompare(_)})},[h]);return u.jsxs("div",{"data-testid":`rig-tree-${e.name}`,children:[u.jsxs("div",{className:Te("flex cursor-pointer items-center gap-2 rounded-sm px-4 py-1.5 hover:bg-stone-100",g&&"bg-stone-200/70"),onClick:()=>f(b=>!b),children:[u.jsx(Ug,{expanded:d,label:`rig ${e.name}`,onClick:()=>f(b=>!b)}),u.jsx(Gl,{kind:"rig",statusClass:fM(m),testId:`rig-icon-${e.name}`}),u.jsx(gc,{to:"/rigs/$rigId",params:{rigId:e.id},onClick:()=>{(s==null?void 0:s.type)!=="discovery"&&r({type:"rig",rigId:e.id}),i()},className:Te("flex-1 truncate font-mono text-[11px] font-semibold text-stone-900",g&&"underline underline-offset-2"),children:e.name})]}),d&&u.jsxs("div",{className:"ml-4 border-l border-stone-200",children:[v&&u.jsx("div",{className:"px-4 py-1.5 font-mono text-[9px] text-stone-400",children:"Loading..."}),!v&&y.length===0&&u.jsx("div",{className:"px-4 py-1.5 font-mono text-[9px] text-stone-400",children:"No nodes"}),y.map(([b,S])=>b==="__ungrouped__"?u.jsx("div",{children:S.map(w=>{const N=(s==null?void 0:s.type)==="node"&&s.rigId===w.rigId&&s.logicalId===w.logicalId,C=Qr(w.logicalId);return u.jsxs("button",{type:"button",onClick:()=>r({type:"node",rigId:w.rigId,logicalId:w.logicalId}),"data-testid":`node-${w.logicalId}`,className:Te("flex w-full items-center gap-2 rounded-sm px-4 py-1.5 text-left transition-colors hover:bg-stone-100",N&&"bg-stone-200/80"),children:[u.jsx(Gl,{kind:w.nodeKind==="infrastructure"?"infrastructure":"agent",statusClass:Wp(w.startupStatus),testId:`node-icon-${w.logicalId}`}),u.jsx("span",{className:"font-mono text-[10px] text-stone-700 truncate",children:C})]},w.logicalId)})},b):u.jsx(pM,{podId:b,nodes:S,selection:s,onSelect:r,autoExpand:d||(s==null?void 0:s.type)==="node"&&s.rigId===e.id&&S.some(w=>w.logicalId===s.logicalId)},b))]})]})}function xM({rigs:e,psMap:t,selection:s,onSelect:r,onClose:i,currentRigId:l}){const[d,f]=j.useState(!0);return u.jsxs("div",{"data-testid":"environment-branch-local",children:[u.jsxs("div",{className:"flex cursor-pointer items-center gap-2 rounded-sm px-3 py-1.5 hover:bg-stone-100",onClick:()=>f(m=>!m),children:[u.jsx(Ug,{expanded:d,label:"environment Local",onClick:()=>f(m=>!m)}),u.jsx(Gl,{kind:"environment",statusClass:"text-stone-500",testId:"environment-icon-local"}),u.jsx("span",{className:"font-mono text-[11px] font-semibold uppercase tracking-[0.12em] text-stone-700",children:"env: local"})]}),d&&u.jsx("div",{className:"ml-4 border-l border-stone-200",children:!e||e.length===0?u.jsx("div",{className:"px-4 py-3 font-mono text-[10px] text-stone-400",children:"No rigs"}):e.map((m,h)=>u.jsx(gM,{rig:m,ps:t.get(m.id),selection:s,onSelect:r,onClose:i,autoExpand:m.id===l},m.id))})]})}function yM({rigs:e,psMap:t,selection:s,onSelect:r,onClose:i,currentRigId:l}){return u.jsx(u.Fragment,{children:u.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:u.jsx(xM,{rigs:e,psMap:t,selection:s,onSelect:r,onClose:i,currentRigId:l})})})}function vM({open:e,onClose:t,selection:s,onSelect:r,desktopMode:i="full",onDesktopToggle:l=()=>{}}){const f=uf().location.pathname,m=mM(f),{data:h}=xc(),{data:v}=Ig(),g=new Map((v??[]).map(y=>[y.rigId,y]));return u.jsx("aside",{"data-testid":"explorer",className:Te("border-r border-stone-300/25 flex z-20 overflow-hidden","bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[6px_0_14px_rgba(46,52,46,0.04)]","fixed top-14 bottom-0 left-0 transition-transform duration-200 ease-tactical w-72 max-w-[80vw]",e?"translate-x-0":"-translate-x-full",i==="full"&&"lg:absolute lg:top-0 lg:bottom-0 lg:left-0 lg:w-72 lg:max-w-none lg:translate-x-0",i==="hidden"&&"lg:absolute lg:top-0 lg:bottom-0 lg:left-0 lg:w-12 lg:max-w-none lg:translate-x-0"),children:u.jsxs("div",{className:"relative flex h-full w-full flex-col",children:[u.jsx("button",{type:"button","data-testid":"explorer-edge-toggle","aria-label":i==="full"?"Collapse explorer":"Expand explorer",onClick:l,className:Te("hidden lg:flex absolute z-10 h-8 w-8 items-center justify-center rounded-full border border-stone-300 bg-background/90 text-stone-700","shadow-[0_2px_8px_rgba(41,37,36,0.08)] backdrop-blur-sm transition-colors hover:bg-stone-100 hover:text-stone-900",i==="full"?"right-2 top-3":"left-1/2 top-3 -translate-x-1/2"),children:i==="full"?u.jsx(WT,{className:"h-4 w-4"}):u.jsx(Tw,{className:"h-4 w-4"})}),i==="full"?u.jsx(yM,{rigs:h,psMap:g,selection:s,onSelect:r,onClose:t,currentRigId:m}):u.jsx("div",{className:"hidden h-full w-full lg:block"})]})})}const bM="modulepreload",SM=function(e){return"/"+e},r1={},wM=function(t,s,r){let i=Promise.resolve();if(s&&s.length>0){let d=function(h){return Promise.all(h.map(v=>Promise.resolve(v).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));i=d(s.map(h=>{if(h=SM(h),h in r1)return;r1[h]=!0;const v=h.endsWith(".css"),g=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const y=document.createElement("link");if(y.rel=v?"stylesheet":bM,v||(y.as="script"),y.crossOrigin="",y.href=h,m&&y.setAttribute("nonce",m),document.head.appendChild(y),v)return new Promise((b,S)=>{y.addEventListener("load",b),y.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function l(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return i.then(d=>{for(const f of d||[])f.status==="rejected"&&l(f.reason);return t().catch(l)})};async function NM(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/snapshots`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function jM(e){return Tt({queryKey:["rig",e,"snapshots"],queryFn:()=>NM(e),enabled:!!e})}class Jp extends Error{constructor(s){var i;const r=((i=s.errors)==null?void 0:i.join(", "))??s.message??"Import failed";super(r);bl(this,"errors");bl(this,"warnings");bl(this,"code");this.name="ImportError",this.code=s.code??"unknown",this.errors=s.errors??(s.message?[s.message]:["Import failed"]),this.warnings=s.warnings??[]}}class Qw extends Error{constructor(s,r){super(s.error??`HTTP ${r}`);bl(this,"code");this.name="RestoreError",this.code=s.code??"unknown"}}function EM(e){const t=Ct();return Pt({mutationFn:async()=>{const s=await fetch(`/api/rigs/${encodeURIComponent(e)}/snapshots`,{method:"POST"});if(!s.ok){const r=await s.json().catch(()=>({}));throw new Error(r.error??`Snapshot failed (HTTP ${s.status})`)}return s.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["rig",e,"snapshots"]}),t.invalidateQueries({queryKey:["rigs","summary"]})}})}function CM(e){const t=Ct();return Pt({mutationFn:async s=>{const r=await fetch(`/api/rigs/${encodeURIComponent(e)}/restore/${encodeURIComponent(s)}`,{method:"POST"});if(!r.ok){const i=await r.json().catch(()=>({}));throw new Qw(i,r.status)}return r.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["rig",e]})}})}function _M(e){const t=Ct();return Pt({mutationFn:async()=>{const s=await fetch("/api/down",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rigId:e})}),r=await s.json().catch(()=>({}));if(!s.ok)throw new Error(r.error??`Teardown failed (HTTP ${s.status})`);if(Array.isArray(r.errors)&&r.errors.length>0)throw new Error(r.errors.join("; "));return r},onSuccess:()=>{t.invalidateQueries({queryKey:["rigs","summary"]}),t.invalidateQueries({queryKey:["ps"]})}})}function RM(e){const t=Ct();return Pt({mutationFn:async()=>{const s=await fetch(`/api/rigs/${encodeURIComponent(e)}/up`,{method:"POST"}),r=await s.json().catch(()=>({}));if(!s.ok)throw new Error(r.error??`Start failed (HTTP ${s.status})`);return r},onSuccess:()=>{t.invalidateQueries({queryKey:["rigs","summary"]}),t.invalidateQueries({queryKey:["ps"]}),t.invalidateQueries({queryKey:["rig",e]})}})}function TM(){const e=Ct();return Pt({mutationFn:async({yaml:t,rigRoot:s})=>{const r={"Content-Type":"text/yaml"};s&&(r["X-Rig-Root"]=s);const i=await fetch("/api/rigs/import",{method:"POST",headers:r,body:t});if(!i.ok){const l=await i.json().catch(()=>({}));throw l.code==="cycle_error"?new Jp({...l,errors:l.errors??["Cycle detected in rig topology"]}):new Jp(l)}return i.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["rigs","summary"]})}})}function Kw(){const e=Ct();return Pt({mutationFn:async({rigId:t,pod:s,crossPodEdges:r})=>{const i=await fetch(`/api/rigs/${encodeURIComponent(t)}/expand`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pod:s,crossPodEdges:r})}),l=await i.json();if(i.status>=400||!l.ok)throw new Error(l.error??`Expansion failed (HTTP ${i.status})`);return l},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["rigs","summary"]}),e.invalidateQueries({queryKey:["ps"]}),e.invalidateQueries({queryKey:["rig",s.rigId,"nodes"]}),e.invalidateQueries({queryKey:["rig",s.rigId,"graph"]})}})}function AM(){const e=Ct();return Pt({mutationFn:async t=>{const s=await fetch(`/api/specs/library/${encodeURIComponent(t)}`,{method:"DELETE"}),r=await s.json().catch(()=>({}));if(!s.ok)throw new Error(r.error??`Remove failed (HTTP ${s.status})`);return r},onSuccess:()=>{e.invalidateQueries({queryKey:["spec-library"]})}})}function MM(){const e=Ct();return Pt({mutationFn:async({entryId:t,name:s})=>{const r=await fetch(`/api/specs/library/${encodeURIComponent(t)}/rename`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:s})}),i=await r.json().catch(()=>({}));if(!r.ok)throw new Error(i.error??`Rename failed (HTTP ${r.status})`);return i},onSuccess:()=>{e.invalidateQueries({queryKey:["spec-library"]})}})}function Fw(e){switch(e){case"resumed":return"text-success";case"rebuilt":return"text-success";case"fresh":return"text-foreground-muted";case"failed":return"text-destructive";case"checkpoint_written":return"text-success";case"fresh_no_checkpoint":return"text-foreground-muted";default:return"text-foreground-muted"}}function i1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function df(...e){return t=>{let s=!1;const r=e.map(i=>{const l=i1(i,t);return!s&&typeof l=="function"&&(s=!0),l});if(s)return()=>{for(let i=0;i<r.length;i++){const l=r[i];typeof l=="function"?l():i1(e[i],null)}}}}function ai(...e){return j.useCallback(df(...e),e)}var kM=Symbol.for("react.lazy"),qd=vg[" use ".trim().toString()];function OM(e){return typeof e=="object"&&e!==null&&"then"in e}function Xw(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===kM&&"_payload"in e&&OM(e._payload)}function DM(e){const t=zM(e),s=j.forwardRef((r,i)=>{let{children:l,...d}=r;Xw(l)&&typeof qd=="function"&&(l=qd(l._payload));const f=j.Children.toArray(l),m=f.find(IM);if(m){const h=m.props.children,v=f.map(g=>g===m?j.Children.count(h)>1?j.Children.only(null):j.isValidElement(h)?h.props.children:null:g);return u.jsx(t,{...d,ref:i,children:j.isValidElement(h)?j.cloneElement(h,void 0,v):null})}return u.jsx(t,{...d,ref:i,children:l})});return s.displayName=`${e}.Slot`,s}var LM=DM("Slot");function zM(e){const t=j.forwardRef((s,r)=>{let{children:i,...l}=s;if(Xw(i)&&typeof qd=="function"&&(i=qd(i._payload)),j.isValidElement(i)){const d=HM(i),f=BM(l,i.props);return i.type!==j.Fragment&&(f.ref=r?df(r,d):d),j.cloneElement(i,f)}return j.Children.count(i)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var PM=Symbol("radix.slottable");function IM(e){return j.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===PM}function BM(e,t){const s={...t};for(const r in t){const i=e[r],l=t[r];/^on[A-Z]/.test(r)?i&&l?s[r]=(...f)=>{const m=l(...f);return i(...f),m}:i&&(s[r]=i):r==="style"?s[r]={...i,...l}:r==="className"&&(s[r]=[i,l].filter(Boolean).join(" "))}return{...e,...s}}function HM(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}const o1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,l1=kw,Zw=(e,t)=>s=>{var r;if((t==null?void 0:t.variants)==null)return l1(e,s==null?void 0:s.class,s==null?void 0:s.className);const{variants:i,defaultVariants:l}=t,d=Object.keys(i).map(h=>{const v=s==null?void 0:s[h],g=l==null?void 0:l[h];if(v===null)return null;const y=o1(v)||o1(g);return i[h][y]}),f=s&&Object.entries(s).reduce((h,v)=>{let[g,y]=v;return y===void 0||(h[g]=y),h},{}),m=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((h,v)=>{let{class:g,className:y,...b}=v;return Object.entries(b).every(S=>{let[w,N]=S;return Array.isArray(N)?N.includes({...l,...f}[w]):{...l,...f}[w]===N})?[...h,g,y]:h},[]);return l1(e,d,m,s==null?void 0:s.class,s==null?void 0:s.className)},UM=Zw("inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-colors duration-150 ease-tactical focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-stone-900 text-white font-headline font-bold uppercase tracking-widest hover:bg-stone-800",destructive:"bg-tertiary text-white font-bold hover:bg-tertiary/90",outline:"border border-outline bg-transparent hover:bg-stone-100 text-on-surface",secondary:"border border-stone-900 bg-transparent text-stone-900 font-mono text-[10px] uppercase hover:bg-stone-900 hover:text-white",ghost:"text-on-surface-variant hover:bg-stone-100 hover:text-on-surface",link:"text-secondary underline-offset-4 hover:underline",tactical:"border border-outline font-mono text-[10px] text-secondary uppercase tracking-widest hover:border-stone-900 hover:text-stone-900"},size:{default:"h-10 px-4 py-2",sm:"h-9 px-3",lg:"h-11 px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ne=j.forwardRef(({className:e,variant:t,size:s,asChild:r=!1,children:i,...l},d)=>{const f=r?LM:"button";return u.jsx(f,{className:Te(UM({variant:t,size:s,className:e})),ref:d,...l,children:i})});Ne.displayName="Button";function Xa(e,t,{checkForDefaultPrevented:s=!0}={}){return function(i){if(e==null||e(i),s===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function $M(e,t){const s=j.createContext(t),r=l=>{const{children:d,...f}=l,m=j.useMemo(()=>f,Object.values(f));return u.jsx(s.Provider,{value:m,children:d})};r.displayName=e+"Provider";function i(l){const d=j.useContext(s);if(d)return d;if(t!==void 0)return t;throw new Error(`\`${l}\` must be used within \`${e}\``)}return[r,i]}function qM(e,t=[]){let s=[];function r(l,d){const f=j.createContext(d),m=s.length;s=[...s,d];const h=g=>{var C;const{scope:y,children:b,...S}=g,w=((C=y==null?void 0:y[e])==null?void 0:C[m])||f,N=j.useMemo(()=>S,Object.values(S));return u.jsx(w.Provider,{value:N,children:b})};h.displayName=l+"Provider";function v(g,y){var w;const b=((w=y==null?void 0:y[e])==null?void 0:w[m])||f,S=j.useContext(b);if(S)return S;if(d!==void 0)return d;throw new Error(`\`${g}\` must be used within \`${l}\``)}return[h,v]}const i=()=>{const l=s.map(d=>j.createContext(d));return function(f){const m=(f==null?void 0:f[e])||l;return j.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return i.scopeName=e,[r,VM(i,...t)]}function VM(...e){const t=e[0];if(e.length===1)return t;const s=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(l){const d=r.reduce((f,{useScope:m,scopeName:h})=>{const g=m(l)[`__scope${h}`];return{...f,...g}},{});return j.useMemo(()=>({[`__scope${t.scopeName}`]:d}),[d])}};return s.scopeName=t.scopeName,s}var Yl=globalThis!=null&&globalThis.document?j.useLayoutEffect:()=>{},GM=vg[" useId ".trim().toString()]||(()=>{}),YM=0;function hp(e){const[t,s]=j.useState(GM());return Yl(()=>{s(r=>r??String(YM++))},[e]),e||(t?`radix-${t}`:"")}var QM=vg[" useInsertionEffect ".trim().toString()]||Yl;function KM({prop:e,defaultProp:t,onChange:s=()=>{},caller:r}){const[i,l,d]=FM({defaultProp:t,onChange:s}),f=e!==void 0,m=f?e:i;{const v=j.useRef(e!==void 0);j.useEffect(()=>{const g=v.current;g!==f&&console.warn(`${r} is changing from ${g?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=f},[f,r])}const h=j.useCallback(v=>{var g;if(f){const y=XM(v)?v(e):v;y!==e&&((g=d.current)==null||g.call(d,y))}else l(v)},[f,e,l,d]);return[m,h]}function FM({defaultProp:e,onChange:t}){const[s,r]=j.useState(e),i=j.useRef(s),l=j.useRef(t);return QM(()=>{l.current=t},[t]),j.useEffect(()=>{var d;i.current!==s&&((d=l.current)==null||d.call(l,s),i.current=s)},[s,i]),[s,r,l]}function XM(e){return typeof e=="function"}function ZM(e){const t=WM(e),s=j.forwardRef((r,i)=>{const{children:l,...d}=r,f=j.Children.toArray(l),m=f.find(ek);if(m){const h=m.props.children,v=f.map(g=>g===m?j.Children.count(h)>1?j.Children.only(null):j.isValidElement(h)?h.props.children:null:g);return u.jsx(t,{...d,ref:i,children:j.isValidElement(h)?j.cloneElement(h,void 0,v):null})}return u.jsx(t,{...d,ref:i,children:l})});return s.displayName=`${e}.Slot`,s}function WM(e){const t=j.forwardRef((s,r)=>{const{children:i,...l}=s;if(j.isValidElement(i)){const d=nk(i),f=tk(l,i.props);return i.type!==j.Fragment&&(f.ref=r?df(r,d):d),j.cloneElement(i,f)}return j.Children.count(i)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var JM=Symbol("radix.slottable");function ek(e){return j.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===JM}function tk(e,t){const s={...t};for(const r in t){const i=e[r],l=t[r];/^on[A-Z]/.test(r)?i&&l?s[r]=(...f)=>{const m=l(...f);return i(...f),m}:i&&(s[r]=i):r==="style"?s[r]={...i,...l}:r==="className"&&(s[r]=[i,l].filter(Boolean).join(" "))}return{...e,...s}}function nk(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}var sk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Xs=sk.reduce((e,t)=>{const s=ZM(`Primitive.${t}`),r=j.forwardRef((i,l)=>{const{asChild:d,...f}=i,m=d?s:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(m,{...f,ref:l})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function ak(e,t){e&&kg.flushSync(()=>e.dispatchEvent(t))}function Ql(e){const t=j.useRef(e);return j.useEffect(()=>{t.current=e}),j.useMemo(()=>(...s)=>{var r;return(r=t.current)==null?void 0:r.call(t,...s)},[])}function rk(e,t=globalThis==null?void 0:globalThis.document){const s=Ql(e);j.useEffect(()=>{const r=i=>{i.key==="Escape"&&s(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[s,t])}var ik="DismissableLayer",eg="dismissableLayer.update",ok="dismissableLayer.pointerDownOutside",lk="dismissableLayer.focusOutside",c1,Ww=j.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jw=j.forwardRef((e,t)=>{const{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:l,onInteractOutside:d,onDismiss:f,...m}=e,h=j.useContext(Ww),[v,g]=j.useState(null),y=(v==null?void 0:v.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=j.useState({}),S=ai(t,L=>g(L)),w=Array.from(h.layers),[N]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),C=w.indexOf(N),T=v?w.indexOf(v):-1,_=h.layersWithOutsidePointerEventsDisabled.size>0,R=T>=C,O=dk(L=>{const M=L.target,I=[...h.branches].some(H=>H.contains(M));!R||I||(i==null||i(L),d==null||d(L),L.defaultPrevented||f==null||f())},y),B=fk(L=>{const M=L.target;[...h.branches].some(H=>H.contains(M))||(l==null||l(L),d==null||d(L),L.defaultPrevented||f==null||f())},y);return rk(L=>{T===h.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&f&&(L.preventDefault(),f()))},y),j.useEffect(()=>{if(v)return s&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(c1=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(v)),h.layers.add(v),u1(),()=>{s&&h.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=c1)}},[v,y,s,h]),j.useEffect(()=>()=>{v&&(h.layers.delete(v),h.layersWithOutsidePointerEventsDisabled.delete(v),u1())},[v,h]),j.useEffect(()=>{const L=()=>b({});return document.addEventListener(eg,L),()=>document.removeEventListener(eg,L)},[]),u.jsx(Xs.div,{...m,ref:S,style:{pointerEvents:_?R?"auto":"none":void 0,...e.style},onFocusCapture:Xa(e.onFocusCapture,B.onFocusCapture),onBlurCapture:Xa(e.onBlurCapture,B.onBlurCapture),onPointerDownCapture:Xa(e.onPointerDownCapture,O.onPointerDownCapture)})});Jw.displayName=ik;var ck="DismissableLayerBranch",uk=j.forwardRef((e,t)=>{const s=j.useContext(Ww),r=j.useRef(null),i=ai(t,r);return j.useEffect(()=>{const l=r.current;if(l)return s.branches.add(l),()=>{s.branches.delete(l)}},[s.branches]),u.jsx(Xs.div,{...e,ref:i})});uk.displayName=ck;function dk(e,t=globalThis==null?void 0:globalThis.document){const s=Ql(e),r=j.useRef(!1),i=j.useRef(()=>{});return j.useEffect(()=>{const l=f=>{if(f.target&&!r.current){let m=function(){eN(ok,s,h,{discrete:!0})};const h={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=m,t.addEventListener("click",i.current,{once:!0})):m()}else t.removeEventListener("click",i.current);r.current=!1},d=window.setTimeout(()=>{t.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(d),t.removeEventListener("pointerdown",l),t.removeEventListener("click",i.current)}},[t,s]),{onPointerDownCapture:()=>r.current=!0}}function fk(e,t=globalThis==null?void 0:globalThis.document){const s=Ql(e),r=j.useRef(!1);return j.useEffect(()=>{const i=l=>{l.target&&!r.current&&eN(lk,s,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,s]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function u1(){const e=new CustomEvent(eg);document.dispatchEvent(e)}function eN(e,t,s,{discrete:r}){const i=s.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:s});t&&i.addEventListener(e,t,{once:!0}),r?ak(i,l):i.dispatchEvent(l)}var mp="focusScope.autoFocusOnMount",pp="focusScope.autoFocusOnUnmount",d1={bubbles:!1,cancelable:!0},hk="FocusScope",tN=j.forwardRef((e,t)=>{const{loop:s=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:l,...d}=e,[f,m]=j.useState(null),h=Ql(i),v=Ql(l),g=j.useRef(null),y=ai(t,w=>m(w)),b=j.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;j.useEffect(()=>{if(r){let w=function(_){if(b.paused||!f)return;const R=_.target;f.contains(R)?g.current=R:ka(g.current,{select:!0})},N=function(_){if(b.paused||!f)return;const R=_.relatedTarget;R!==null&&(f.contains(R)||ka(g.current,{select:!0}))},C=function(_){if(document.activeElement===document.body)for(const O of _)O.removedNodes.length>0&&ka(f)};document.addEventListener("focusin",w),document.addEventListener("focusout",N);const T=new MutationObserver(C);return f&&T.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",w),document.removeEventListener("focusout",N),T.disconnect()}}},[r,f,b.paused]),j.useEffect(()=>{if(f){h1.add(b);const w=document.activeElement;if(!f.contains(w)){const C=new CustomEvent(mp,d1);f.addEventListener(mp,h),f.dispatchEvent(C),C.defaultPrevented||(mk(vk(nN(f)),{select:!0}),document.activeElement===w&&ka(f))}return()=>{f.removeEventListener(mp,h),setTimeout(()=>{const C=new CustomEvent(pp,d1);f.addEventListener(pp,v),f.dispatchEvent(C),C.defaultPrevented||ka(w??document.body,{select:!0}),f.removeEventListener(pp,v),h1.remove(b)},0)}}},[f,h,v,b]);const S=j.useCallback(w=>{if(!s&&!r||b.paused)return;const N=w.key==="Tab"&&!w.altKey&&!w.ctrlKey&&!w.metaKey,C=document.activeElement;if(N&&C){const T=w.currentTarget,[_,R]=pk(T);_&&R?!w.shiftKey&&C===R?(w.preventDefault(),s&&ka(_,{select:!0})):w.shiftKey&&C===_&&(w.preventDefault(),s&&ka(R,{select:!0})):C===T&&w.preventDefault()}},[s,r,b.paused]);return u.jsx(Xs.div,{tabIndex:-1,...d,ref:y,onKeyDown:S})});tN.displayName=hk;function mk(e,{select:t=!1}={}){const s=document.activeElement;for(const r of e)if(ka(r,{select:t}),document.activeElement!==s)return}function pk(e){const t=nN(e),s=f1(t,e),r=f1(t.reverse(),e);return[s,r]}function nN(e){const t=[],s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;s.nextNode();)t.push(s.currentNode);return t}function f1(e,t){for(const s of e)if(!gk(s,{upTo:t}))return s}function gk(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function xk(e){return e instanceof HTMLInputElement&&"select"in e}function ka(e,{select:t=!1}={}){if(e&&e.focus){const s=document.activeElement;e.focus({preventScroll:!0}),e!==s&&xk(e)&&t&&e.select()}}var h1=yk();function yk(){let e=[];return{add(t){const s=e[0];t!==s&&(s==null||s.pause()),e=m1(e,t),e.unshift(t)},remove(t){var s;e=m1(e,t),(s=e[0])==null||s.resume()}}}function m1(e,t){const s=[...e],r=s.indexOf(t);return r!==-1&&s.splice(r,1),s}function vk(e){return e.filter(t=>t.tagName!=="A")}var bk="Portal",sN=j.forwardRef((e,t)=>{var f;const{container:s,...r}=e,[i,l]=j.useState(!1);Yl(()=>l(!0),[]);const d=s||i&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return d?OR.createPortal(u.jsx(Xs.div,{...r,ref:t}),d):null});sN.displayName=bk;function Sk(e,t){return j.useReducer((s,r)=>t[s][r]??s,e)}var ff=e=>{const{present:t,children:s}=e,r=wk(t),i=typeof s=="function"?s({present:r.isPresent}):j.Children.only(s),l=ai(r.ref,Nk(i));return typeof s=="function"||r.isPresent?j.cloneElement(i,{ref:l}):null};ff.displayName="Presence";function wk(e){const[t,s]=j.useState(),r=j.useRef(null),i=j.useRef(e),l=j.useRef("none"),d=e?"mounted":"unmounted",[f,m]=Sk(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return j.useEffect(()=>{const h=ed(r.current);l.current=f==="mounted"?h:"none"},[f]),Yl(()=>{const h=r.current,v=i.current;if(v!==e){const y=l.current,b=ed(h);e?m("MOUNT"):b==="none"||(h==null?void 0:h.display)==="none"?m("UNMOUNT"):m(v&&y!==b?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,m]),Yl(()=>{if(t){let h;const v=t.ownerDocument.defaultView??window,g=b=>{const w=ed(r.current).includes(CSS.escape(b.animationName));if(b.target===t&&w&&(m("ANIMATION_END"),!i.current)){const N=t.style.animationFillMode;t.style.animationFillMode="forwards",h=v.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=N)})}},y=b=>{b.target===t&&(l.current=ed(r.current))};return t.addEventListener("animationstart",y),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{v.clearTimeout(h),t.removeEventListener("animationstart",y),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:j.useCallback(h=>{r.current=h?getComputedStyle(h):null,s(h)},[])}}function ed(e){return(e==null?void 0:e.animationName)||"none"}function Nk(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}var gp=0;function jk(){j.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??p1()),document.body.insertAdjacentElement("beforeend",e[1]??p1()),gp++,()=>{gp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),gp--}},[])}function p1(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ls=function(){return ls=Object.assign||function(t){for(var s,r=1,i=arguments.length;r<i;r++){s=arguments[r];for(var l in s)Object.prototype.hasOwnProperty.call(s,l)&&(t[l]=s[l])}return t},ls.apply(this,arguments)};function aN(e,t){var s={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(s[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(s[r[i]]=e[r[i]]);return s}function Ek(e,t,s){if(s||arguments.length===2)for(var r=0,i=t.length,l;r<i;r++)(l||!(r in t))&&(l||(l=Array.prototype.slice.call(t,0,r)),l[r]=t[r]);return e.concat(l||Array.prototype.slice.call(t))}var Cd="right-scroll-bar-position",_d="width-before-scroll-bar",Ck="with-scroll-bars-hidden",_k="--removed-body-scroll-bar-size";function xp(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Rk(e,t){var s=j.useState(function(){return{value:e,callback:t,facade:{get current(){return s.value},set current(r){var i=s.value;i!==r&&(s.value=r,s.callback(r,i))}}}})[0];return s.callback=t,s.facade}var Tk=typeof window<"u"?j.useLayoutEffect:j.useEffect,g1=new WeakMap;function Ak(e,t){var s=Rk(null,function(r){return e.forEach(function(i){return xp(i,r)})});return Tk(function(){var r=g1.get(s);if(r){var i=new Set(r),l=new Set(e),d=s.current;i.forEach(function(f){l.has(f)||xp(f,null)}),l.forEach(function(f){i.has(f)||xp(f,d)})}g1.set(s,e)},[e]),s}function Mk(e){return e}function kk(e,t){t===void 0&&(t=Mk);var s=[],r=!1,i={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return s.length?s[s.length-1]:e},useMedium:function(l){var d=t(l,r);return s.push(d),function(){s=s.filter(function(f){return f!==d})}},assignSyncMedium:function(l){for(r=!0;s.length;){var d=s;s=[],d.forEach(l)}s={push:function(f){return l(f)},filter:function(){return s}}},assignMedium:function(l){r=!0;var d=[];if(s.length){var f=s;s=[],f.forEach(l),d=s}var m=function(){var v=d;d=[],v.forEach(l)},h=function(){return Promise.resolve().then(m)};h(),s={push:function(v){d.push(v),h()},filter:function(v){return d=d.filter(v),s}}}};return i}function Ok(e){e===void 0&&(e={});var t=kk(null);return t.options=ls({async:!0,ssr:!1},e),t}var rN=function(e){var t=e.sideCar,s=aN(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return j.createElement(r,ls({},s))};rN.isSideCarExport=!0;function Dk(e,t){return e.useMedium(t),rN}var iN=Ok(),yp=function(){},hf=j.forwardRef(function(e,t){var s=j.useRef(null),r=j.useState({onScrollCapture:yp,onWheelCapture:yp,onTouchMoveCapture:yp}),i=r[0],l=r[1],d=e.forwardProps,f=e.children,m=e.className,h=e.removeScrollBar,v=e.enabled,g=e.shards,y=e.sideCar,b=e.noRelative,S=e.noIsolation,w=e.inert,N=e.allowPinchZoom,C=e.as,T=C===void 0?"div":C,_=e.gapMode,R=aN(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),O=y,B=Ak([s,t]),L=ls(ls({},R),i);return j.createElement(j.Fragment,null,v&&j.createElement(O,{sideCar:iN,removeScrollBar:h,shards:g,noRelative:b,noIsolation:S,inert:w,setCallbacks:l,allowPinchZoom:!!N,lockRef:s,gapMode:_}),d?j.cloneElement(j.Children.only(f),ls(ls({},L),{ref:B})):j.createElement(T,ls({},L,{className:m,ref:B}),f))});hf.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};hf.classNames={fullWidth:_d,zeroRight:Cd};var Lk=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function zk(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Lk();return t&&e.setAttribute("nonce",t),e}function Pk(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ik(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Bk=function(){var e=0,t=null;return{add:function(s){e==0&&(t=zk())&&(Pk(t,s),Ik(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Hk=function(){var e=Bk();return function(t,s){j.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&s])}},oN=function(){var e=Hk(),t=function(s){var r=s.styles,i=s.dynamic;return e(r,i),null};return t},Uk={left:0,top:0,right:0,gap:0},vp=function(e){return parseInt(e||"",10)||0},$k=function(e){var t=window.getComputedStyle(document.body),s=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],i=t[e==="padding"?"paddingRight":"marginRight"];return[vp(s),vp(r),vp(i)]},qk=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Uk;var t=$k(e),s=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-s+t[2]-t[0])}},Vk=oN(),to="data-scroll-locked",Gk=function(e,t,s,r){var i=e.left,l=e.top,d=e.right,f=e.gap;return s===void 0&&(s="margin"),`
166
- .`.concat(Ck,` {
167
- overflow: hidden `).concat(r,`;
168
- padding-right: `).concat(f,"px ").concat(r,`;
169
- }
170
- body[`).concat(to,`] {
171
- overflow: hidden `).concat(r,`;
172
- overscroll-behavior: contain;
173
- `).concat([t&&"position: relative ".concat(r,";"),s==="margin"&&`
174
- padding-left: `.concat(i,`px;
175
- padding-top: `).concat(l,`px;
176
- padding-right: `).concat(d,`px;
177
- margin-left:0;
178
- margin-top:0;
179
- margin-right: `).concat(f,"px ").concat(r,`;
180
- `),s==="padding"&&"padding-right: ".concat(f,"px ").concat(r,";")].filter(Boolean).join(""),`
181
- }
182
-
183
- .`).concat(Cd,` {
184
- right: `).concat(f,"px ").concat(r,`;
185
- }
186
-
187
- .`).concat(_d,` {
188
- margin-right: `).concat(f,"px ").concat(r,`;
189
- }
190
-
191
- .`).concat(Cd," .").concat(Cd,` {
192
- right: 0 `).concat(r,`;
193
- }
194
-
195
- .`).concat(_d," .").concat(_d,` {
196
- margin-right: 0 `).concat(r,`;
197
- }
198
-
199
- body[`).concat(to,`] {
200
- `).concat(_k,": ").concat(f,`px;
201
- }
202
- `)},x1=function(){var e=parseInt(document.body.getAttribute(to)||"0",10);return isFinite(e)?e:0},Yk=function(){j.useEffect(function(){return document.body.setAttribute(to,(x1()+1).toString()),function(){var e=x1()-1;e<=0?document.body.removeAttribute(to):document.body.setAttribute(to,e.toString())}},[])},Qk=function(e){var t=e.noRelative,s=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;Yk();var l=j.useMemo(function(){return qk(i)},[i]);return j.createElement(Vk,{styles:Gk(l,!t,i,s?"":"!important")})},tg=!1;if(typeof window<"u")try{var td=Object.defineProperty({},"passive",{get:function(){return tg=!0,!0}});window.addEventListener("test",td,td),window.removeEventListener("test",td,td)}catch{tg=!1}var Yi=tg?{passive:!1}:!1,Kk=function(e){return e.tagName==="TEXTAREA"},lN=function(e,t){if(!(e instanceof Element))return!1;var s=window.getComputedStyle(e);return s[t]!=="hidden"&&!(s.overflowY===s.overflowX&&!Kk(e)&&s[t]==="visible")},Fk=function(e){return lN(e,"overflowY")},Xk=function(e){return lN(e,"overflowX")},y1=function(e,t){var s=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=cN(e,r);if(i){var l=uN(e,r),d=l[1],f=l[2];if(d>f)return!0}r=r.parentNode}while(r&&r!==s.body);return!1},Zk=function(e){var t=e.scrollTop,s=e.scrollHeight,r=e.clientHeight;return[t,s,r]},Wk=function(e){var t=e.scrollLeft,s=e.scrollWidth,r=e.clientWidth;return[t,s,r]},cN=function(e,t){return e==="v"?Fk(t):Xk(t)},uN=function(e,t){return e==="v"?Zk(t):Wk(t)},Jk=function(e,t){return e==="h"&&t==="rtl"?-1:1},e3=function(e,t,s,r,i){var l=Jk(e,window.getComputedStyle(t).direction),d=l*r,f=s.target,m=t.contains(f),h=!1,v=d>0,g=0,y=0;do{if(!f)break;var b=uN(e,f),S=b[0],w=b[1],N=b[2],C=w-N-l*S;(S||C)&&cN(e,f)&&(g+=C,y+=S);var T=f.parentNode;f=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(v&&Math.abs(g)<1||!v&&Math.abs(y)<1)&&(h=!0),h},nd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},v1=function(e){return[e.deltaX,e.deltaY]},b1=function(e){return e&&"current"in e?e.current:e},t3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},n3=function(e){return`
203
- .block-interactivity-`.concat(e,` {pointer-events: none;}
204
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
205
- `)},s3=0,Qi=[];function a3(e){var t=j.useRef([]),s=j.useRef([0,0]),r=j.useRef(),i=j.useState(s3++)[0],l=j.useState(oN)[0],d=j.useRef(e);j.useEffect(function(){d.current=e},[e]),j.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var w=Ek([e.lockRef.current],(e.shards||[]).map(b1),!0).filter(Boolean);return w.forEach(function(N){return N.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),w.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var f=j.useCallback(function(w,N){if("touches"in w&&w.touches.length===2||w.type==="wheel"&&w.ctrlKey)return!d.current.allowPinchZoom;var C=nd(w),T=s.current,_="deltaX"in w?w.deltaX:T[0]-C[0],R="deltaY"in w?w.deltaY:T[1]-C[1],O,B=w.target,L=Math.abs(_)>Math.abs(R)?"h":"v";if("touches"in w&&L==="h"&&B.type==="range")return!1;var M=window.getSelection(),I=M&&M.anchorNode,H=I?I===B||I.contains(B):!1;if(H)return!1;var D=y1(L,B);if(!D)return!0;if(D?O=L:(O=L==="v"?"h":"v",D=y1(L,B)),!D)return!1;if(!r.current&&"changedTouches"in w&&(_||R)&&(r.current=O),!O)return!0;var Y=r.current||O;return e3(Y,N,w,Y==="h"?_:R)},[]),m=j.useCallback(function(w){var N=w;if(!(!Qi.length||Qi[Qi.length-1]!==l)){var C="deltaY"in N?v1(N):nd(N),T=t.current.filter(function(O){return O.name===N.type&&(O.target===N.target||N.target===O.shadowParent)&&t3(O.delta,C)})[0];if(T&&T.should){N.cancelable&&N.preventDefault();return}if(!T){var _=(d.current.shards||[]).map(b1).filter(Boolean).filter(function(O){return O.contains(N.target)}),R=_.length>0?f(N,_[0]):!d.current.noIsolation;R&&N.cancelable&&N.preventDefault()}}},[]),h=j.useCallback(function(w,N,C,T){var _={name:w,delta:N,target:C,should:T,shadowParent:r3(C)};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(R){return R!==_})},1)},[]),v=j.useCallback(function(w){s.current=nd(w),r.current=void 0},[]),g=j.useCallback(function(w){h(w.type,v1(w),w.target,f(w,e.lockRef.current))},[]),y=j.useCallback(function(w){h(w.type,nd(w),w.target,f(w,e.lockRef.current))},[]);j.useEffect(function(){return Qi.push(l),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",m,Yi),document.addEventListener("touchmove",m,Yi),document.addEventListener("touchstart",v,Yi),function(){Qi=Qi.filter(function(w){return w!==l}),document.removeEventListener("wheel",m,Yi),document.removeEventListener("touchmove",m,Yi),document.removeEventListener("touchstart",v,Yi)}},[]);var b=e.removeScrollBar,S=e.inert;return j.createElement(j.Fragment,null,S?j.createElement(l,{styles:n3(i)}):null,b?j.createElement(Qk,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function r3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const i3=Dk(iN,a3);var dN=j.forwardRef(function(e,t){return j.createElement(hf,ls({},e,{ref:t,sideCar:i3}))});dN.classNames=hf.classNames;var o3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ki=new WeakMap,sd=new WeakMap,ad={},bp=0,fN=function(e){return e&&(e.host||fN(e.parentNode))},l3=function(e,t){return t.map(function(s){if(e.contains(s))return s;var r=fN(s);return r&&e.contains(r)?r:(console.error("aria-hidden",s,"in not contained inside",e,". Doing nothing"),null)}).filter(function(s){return!!s})},c3=function(e,t,s,r){var i=l3(t,Array.isArray(e)?e:[e]);ad[s]||(ad[s]=new WeakMap);var l=ad[s],d=[],f=new Set,m=new Set(i),h=function(g){!g||f.has(g)||(f.add(g),h(g.parentNode))};i.forEach(h);var v=function(g){!g||m.has(g)||Array.prototype.forEach.call(g.children,function(y){if(f.has(y))v(y);else try{var b=y.getAttribute(r),S=b!==null&&b!=="false",w=(Ki.get(y)||0)+1,N=(l.get(y)||0)+1;Ki.set(y,w),l.set(y,N),d.push(y),w===1&&S&&sd.set(y,!0),N===1&&y.setAttribute(s,"true"),S||y.setAttribute(r,"true")}catch(C){console.error("aria-hidden: cannot operate on ",y,C)}})};return v(t),f.clear(),bp++,function(){d.forEach(function(g){var y=Ki.get(g)-1,b=l.get(g)-1;Ki.set(g,y),l.set(g,b),y||(sd.has(g)||g.removeAttribute(r),sd.delete(g)),b||g.removeAttribute(s)}),bp--,bp||(Ki=new WeakMap,Ki=new WeakMap,sd=new WeakMap,ad={})}},u3=function(e,t,s){s===void 0&&(s="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=o3(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),c3(r,i,s,"aria-hidden")):function(){return null}};function d3(e){const t=f3(e),s=j.forwardRef((r,i)=>{const{children:l,...d}=r,f=j.Children.toArray(l),m=f.find(m3);if(m){const h=m.props.children,v=f.map(g=>g===m?j.Children.count(h)>1?j.Children.only(null):j.isValidElement(h)?h.props.children:null:g);return u.jsx(t,{...d,ref:i,children:j.isValidElement(h)?j.cloneElement(h,void 0,v):null})}return u.jsx(t,{...d,ref:i,children:l})});return s.displayName=`${e}.Slot`,s}function f3(e){const t=j.forwardRef((s,r)=>{const{children:i,...l}=s;if(j.isValidElement(i)){const d=g3(i),f=p3(l,i.props);return i.type!==j.Fragment&&(f.ref=r?df(r,d):d),j.cloneElement(i,f)}return j.Children.count(i)>1?j.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var h3=Symbol("radix.slottable");function m3(e){return j.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===h3}function p3(e,t){const s={...t};for(const r in t){const i=e[r],l=t[r];/^on[A-Z]/.test(r)?i&&l?s[r]=(...f)=>{const m=l(...f);return i(...f),m}:i&&(s[r]=i):r==="style"?s[r]={...i,...l}:r==="className"&&(s[r]=[i,l].filter(Boolean).join(" "))}return{...e,...s}}function g3(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}var mf="Dialog",[hN]=qM(mf),[x3,Qn]=hN(mf),mN=e=>{const{__scopeDialog:t,children:s,open:r,defaultOpen:i,onOpenChange:l,modal:d=!0}=e,f=j.useRef(null),m=j.useRef(null),[h,v]=KM({prop:r,defaultProp:i??!1,onChange:l,caller:mf});return u.jsx(x3,{scope:t,triggerRef:f,contentRef:m,contentId:hp(),titleId:hp(),descriptionId:hp(),open:h,onOpenChange:v,onOpenToggle:j.useCallback(()=>v(g=>!g),[v]),modal:d,children:s})};mN.displayName=mf;var pN="DialogTrigger",y3=j.forwardRef((e,t)=>{const{__scopeDialog:s,...r}=e,i=Qn(pN,s),l=ai(t,i.triggerRef);return u.jsx(Xs.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Vg(i.open),...r,ref:l,onClick:Xa(e.onClick,i.onOpenToggle)})});y3.displayName=pN;var $g="DialogPortal",[v3,gN]=hN($g,{forceMount:void 0}),xN=e=>{const{__scopeDialog:t,forceMount:s,children:r,container:i}=e,l=Qn($g,t);return u.jsx(v3,{scope:t,forceMount:s,children:j.Children.map(r,d=>u.jsx(ff,{present:s||l.open,children:u.jsx(sN,{asChild:!0,container:i,children:d})}))})};xN.displayName=$g;var Vd="DialogOverlay",yN=j.forwardRef((e,t)=>{const s=gN(Vd,e.__scopeDialog),{forceMount:r=s.forceMount,...i}=e,l=Qn(Vd,e.__scopeDialog);return l.modal?u.jsx(ff,{present:r||l.open,children:u.jsx(S3,{...i,ref:t})}):null});yN.displayName=Vd;var b3=d3("DialogOverlay.RemoveScroll"),S3=j.forwardRef((e,t)=>{const{__scopeDialog:s,...r}=e,i=Qn(Vd,s);return u.jsx(dN,{as:b3,allowPinchZoom:!0,shards:[i.contentRef],children:u.jsx(Xs.div,{"data-state":Vg(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Wr="DialogContent",vN=j.forwardRef((e,t)=>{const s=gN(Wr,e.__scopeDialog),{forceMount:r=s.forceMount,...i}=e,l=Qn(Wr,e.__scopeDialog);return u.jsx(ff,{present:r||l.open,children:l.modal?u.jsx(w3,{...i,ref:t}):u.jsx(N3,{...i,ref:t})})});vN.displayName=Wr;var w3=j.forwardRef((e,t)=>{const s=Qn(Wr,e.__scopeDialog),r=j.useRef(null),i=ai(t,s.contentRef,r);return j.useEffect(()=>{const l=r.current;if(l)return u3(l)},[]),u.jsx(bN,{...e,ref:i,trapFocus:s.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Xa(e.onCloseAutoFocus,l=>{var d;l.preventDefault(),(d=s.triggerRef.current)==null||d.focus()}),onPointerDownOutside:Xa(e.onPointerDownOutside,l=>{const d=l.detail.originalEvent,f=d.button===0&&d.ctrlKey===!0;(d.button===2||f)&&l.preventDefault()}),onFocusOutside:Xa(e.onFocusOutside,l=>l.preventDefault())})}),N3=j.forwardRef((e,t)=>{const s=Qn(Wr,e.__scopeDialog),r=j.useRef(!1),i=j.useRef(!1);return u.jsx(bN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{var d,f;(d=e.onCloseAutoFocus)==null||d.call(e,l),l.defaultPrevented||(r.current||(f=s.triggerRef.current)==null||f.focus(),l.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:l=>{var m,h;(m=e.onInteractOutside)==null||m.call(e,l),l.defaultPrevented||(r.current=!0,l.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const d=l.target;((h=s.triggerRef.current)==null?void 0:h.contains(d))&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&i.current&&l.preventDefault()}})}),bN=j.forwardRef((e,t)=>{const{__scopeDialog:s,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:l,...d}=e,f=Qn(Wr,s),m=j.useRef(null),h=ai(t,m);return jk(),u.jsxs(u.Fragment,{children:[u.jsx(tN,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:l,children:u.jsx(Jw,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Vg(f.open),...d,ref:h,onDismiss:()=>f.onOpenChange(!1)})}),u.jsxs(u.Fragment,{children:[u.jsx(j3,{titleId:f.titleId}),u.jsx(C3,{contentRef:m,descriptionId:f.descriptionId})]})]})}),qg="DialogTitle",SN=j.forwardRef((e,t)=>{const{__scopeDialog:s,...r}=e,i=Qn(qg,s);return u.jsx(Xs.h2,{id:i.titleId,...r,ref:t})});SN.displayName=qg;var wN="DialogDescription",NN=j.forwardRef((e,t)=>{const{__scopeDialog:s,...r}=e,i=Qn(wN,s);return u.jsx(Xs.p,{id:i.descriptionId,...r,ref:t})});NN.displayName=wN;var jN="DialogClose",EN=j.forwardRef((e,t)=>{const{__scopeDialog:s,...r}=e,i=Qn(jN,s);return u.jsx(Xs.button,{type:"button",...r,ref:t,onClick:Xa(e.onClick,()=>i.onOpenChange(!1))})});EN.displayName=jN;function Vg(e){return e?"open":"closed"}var CN="DialogTitleWarning",[OI,_N]=$M(CN,{contentName:Wr,titleName:qg,docsSlug:"dialog"}),j3=({titleId:e})=>{const t=_N(CN),s=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
206
-
207
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
208
-
209
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return j.useEffect(()=>{e&&(document.getElementById(e)||console.error(s))},[s,e]),null},E3="DialogDescriptionWarning",C3=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${_N(E3).contentName}}.`;return j.useEffect(()=>{var l;const i=(l=e.current)==null?void 0:l.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},_3=mN,R3=xN,RN=yN,TN=vN,AN=SN,MN=NN,T3=EN;const Gd=_3,A3=R3,kN=j.forwardRef(({className:e,...t},s)=>u.jsx(RN,{ref:s,className:Te("fixed inset-0 z-50 bg-black/20 backdrop-blur-[8px]",e),...t}));kN.displayName=RN.displayName;const Kl=j.forwardRef(({className:e,children:t,hideCloseButton:s,...r},i)=>u.jsxs(A3,{children:[u.jsx(kN,{}),u.jsxs(TN,{ref:i,className:Te("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 vellum-heavy p-6 shadow-[0_20px_40px_rgba(46,52,46,0.06)] border border-stone-300",e),...r,children:[t,!s&&u.jsxs(T3,{className:"absolute right-4 top-4 opacity-70 transition-opacity duration-150 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 focus:ring-offset-background disabled:pointer-events-none",children:[u.jsx(vA,{className:"h-4 w-4"}),u.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Kl.displayName=TN.displayName;const Fl=({className:e,...t})=>u.jsx("div",{className:Te("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Fl.displayName="DialogHeader";const Xl=({className:e,...t})=>u.jsx("div",{className:Te("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Xl.displayName="DialogFooter";const Zl=j.forwardRef(({className:e,...t},s)=>u.jsx(AN,{ref:s,className:Te("text-lg font-semibold leading-none tracking-tight",e),...t}));Zl.displayName=AN.displayName;const Wl=j.forwardRef(({className:e,...t},s)=>u.jsx(MN,{ref:s,className:Te("text-sm text-foreground-muted",e),...t}));Wl.displayName=MN.displayName;async function M3(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/chat/history?limit=50`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}async function k3(e,t,s){const r=await fetch(`/api/rigs/${encodeURIComponent(e)}/chat/send`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sender:s,body:t})});if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()}function O3(e){const t=Ct(),s=Tt({queryKey:["rig",e,"chat"],queryFn:()=>M3(e),enabled:!!e}),r=Pt({mutationFn:({body:i,sender:l})=>k3(e,i,l),onSuccess:()=>{t.invalidateQueries({queryKey:["rig",e,"chat"]})}});return j.useEffect(()=>{if(!e)return;const i=new EventSource(`/api/rigs/${encodeURIComponent(e)}/chat/watch`);return i.addEventListener("message",()=>{t.invalidateQueries({queryKey:["rig",e,"chat"]})}),()=>{i.close()}},[e,t]),{messages:s.data??[],isLoading:s.isPending,error:s.error,send:r.mutate,isSending:r.isPending}}function D3({rigId:e}){const{messages:t,isLoading:s,send:r,isSending:i}=O3(e),[l,d]=j.useState(""),f=m=>{m.preventDefault();const h=l.trim();h&&(r({body:h,sender:"ui"}),d(""))};return u.jsxs("div",{"data-testid":"rig-chat-panel",className:"flex flex-col h-full",children:[u.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:s?u.jsx("div",{className:"font-mono text-[10px] text-stone-400 text-center",children:"Loading messages..."}):t.length===0?u.jsx("div",{className:"font-mono text-[10px] text-stone-400 text-center italic",children:"No messages yet"}):t.map(m=>u.jsx("div",{"data-testid":`chat-msg-${m.id}`,children:m.kind==="topic"?u.jsx("div",{"data-testid":`chat-topic-${m.id}`,className:"border-t border-b border-stone-300 bg-stone-50 px-2 py-1.5 text-center font-mono text-[9px] uppercase tracking-wider text-stone-500",children:m.topic}):u.jsxs("div",{className:"border-l-2 border-stone-200 pl-2",children:[u.jsx("div",{"data-testid":`chat-sender-${m.id}`,className:"font-mono text-[9px] font-bold text-stone-500",children:m.sender}),u.jsx("div",{className:"font-mono text-[10px] leading-relaxed text-stone-800 whitespace-pre-wrap",children:m.body})]})},m.id))}),u.jsxs("form",{"data-testid":"chat-send-form",onSubmit:f,className:"border-t border-stone-200 p-2 flex gap-2",children:[u.jsx("input",{"data-testid":"chat-input",type:"text",value:l,onChange:m=>d(m.target.value),placeholder:"Type a message...",className:"flex-1 px-2 py-1 border border-stone-300 font-mono text-[10px]",disabled:i}),u.jsx("button",{"data-testid":"chat-send-btn",type:"submit",disabled:i||!l.trim(),className:"px-3 py-1 border border-stone-300 font-mono text-[9px] uppercase hover:bg-stone-200 disabled:opacity-50",children:"Send"})]})]})}function ON({result:e}){var t;return u.jsxs("div",{"data-testid":"expand-result",className:"mt-2 font-mono text-[9px]",children:[u.jsxs("div",{className:e.status==="ok"?"text-green-700":"text-amber-700",children:["Status: ",e.status," — Pod: ",e.podNamespace]}),(t=e.nodes)==null?void 0:t.map(s=>u.jsxs("div",{className:s.status==="launched"?"text-stone-700":"text-red-600",children:["[",s.status==="launched"?"OK":"FAIL","] ",s.logicalId,s.error?` — ${s.error}`:""]},s.logicalId))]})}function S1(e){if(!e)return"No snapshots";const t=Date.now()-new Date(e).getTime(),s=Math.floor(t/6e4);if(s<1)return"< 1m ago";if(s<60)return`${s}m ago`;const r=Math.floor(s/60);return r<24?`${r}h ago`:`${Math.floor(r/24)}d ago`}function L3(e,t){return e instanceof Qw&&e.code==="rig_not_stopped"?`Stop ${t} before restoring. Run rig down ${t} and retry.`:e.message}function z3(e,t){return e?`${e.runningCount}/${e.nodeCount} running`:`${(t==null?void 0:t.nodeCount)??0} total`}function P3({rigId:e,onClose:t}){const{data:s}=xc(),{data:r}=Ig(),{data:i,isPending:l}=Aw(e),{data:d=[],isPending:f,error:m}=jM(e),h=EM(e),v=CM(e),g=RM(e),y=_M(e),[b,S]=j.useState("info"),[w,N]=j.useState(null),[C,T]=j.useState(!1),[_,R]=j.useState(!1),[O,B]=j.useState(null),[L,M]=j.useState(null),[I,H]=j.useState(null),[D,Y]=j.useState(!1),[K,U]=j.useState(""),[q,A]=j.useState(null),$=Kw(),z=s==null?void 0:s.find(de=>de.id===e),G=r==null?void 0:r.find(de=>de.rigId===e),V=Array.isArray(i)?i:[],P=Array.from(V.reduce((de,Ae)=>{const Re=Ae.podId??"__ungrouped__",Be=de.get(Re)??[];return Be.push(Ae),de.set(Re,Be),de},new Map)),Q=[...d].sort((de,Ae)=>new Date(Ae.createdAt).getTime()-new Date(de.createdAt).getTime()),ee=Q[0]??null,se=Q.slice(1),oe=ee?Gs(ee.id):null,ce=Gs(e),fe=e.slice(0,Math.max(0,e.length-ce.length)),ue=(G==null?void 0:G.status)??"stopped",he=()=>{M(null),H(null),h.mutate(void 0,{onError:de=>H(de.message)})},Ce=de=>{M(null),B(null),v.mutate(de,{onSuccess:Ae=>{B(Ae.nodes??[]),N(null)},onError:Ae=>{M(L3(Ae,(z==null?void 0:z.name)??e)),N(null)}})},Se=async()=>{H(null);try{const de=await fetch(`/api/rigs/${encodeURIComponent(e)}/spec`);if(!de.ok){H(`Export failed (HTTP ${de.status})`);return}const Ae=await de.text(),Re=new Blob([Ae],{type:"text/yaml"}),Be=URL.createObjectURL(Re),St=document.createElement("a");St.href=Be,St.download=`${(z==null?void 0:z.name)??e}.yaml`,St.click(),URL.revokeObjectURL(Be)}catch(de){H(de instanceof Error?de.message:"Export failed")}},ye=()=>{H(null),g.mutate(void 0,{onError:de=>H(de.message)})},ve=()=>{H(null),y.mutate(void 0,{onSuccess:()=>T(!1),onError:de=>H(de.message)})};return u.jsxs("aside",{"data-testid":"rig-detail-panel",className:"absolute inset-y-0 right-0 z-20 w-80 border-l border-stone-300/25 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-hidden",children:[u.jsxs("div",{className:"flex justify-between items-center px-4 py-3 border-b border-stone-300/35 shrink-0",children:[u.jsx("h2",{className:"min-w-0 font-mono text-xs font-bold text-stone-900 truncate",children:(z==null?void 0:z.name)??e}),u.jsx("button",{"data-testid":"close-drawer",onClick:t,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),u.jsxs("div",{className:"flex border-b border-stone-300/35 shrink-0","data-testid":"drawer-tabs",children:[u.jsx("button",{"data-testid":"tab-info",onClick:()=>S("info"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${b==="info"?"border-b-2 border-stone-800 font-bold":"text-stone-400"}`,children:"Info"}),u.jsx("button",{"data-testid":"tab-chat",onClick:()=>S("chat"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${b==="chat"?"border-b-2 border-stone-800 font-bold":"text-stone-400"}`,children:"Chat Room"})]}),b==="chat"?u.jsx(D3,{rigId:e}):u.jsxs("div",{className:"flex-1 overflow-y-auto",children:[u.jsx("section",{className:"px-4 py-3 border-b border-stone-100",children:u.jsxs("div",{children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Identity"}),u.jsx("div",{className:"space-y-1 font-mono text-[10px]",children:u.jsxs("div",{className:"flex justify-between gap-3",children:[u.jsx("span",{className:"text-stone-500",children:"ID"}),u.jsxs("span",{"data-testid":"rig-id-value",className:"min-w-0 truncate text-stone-900",children:[fe&&u.jsx("span",{className:"text-stone-500",children:fe}),u.jsx("span",{"data-testid":"rig-id-tail",className:"font-bold",children:ce})]})]})})]})}),u.jsx("section",{className:"px-4 py-3 border-b border-stone-100",children:u.jsxs("div",{children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Status"}),u.jsxs("div",{className:"space-y-1 font-mono text-[10px]",children:[u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Nodes"}),u.jsx("span",{children:z3(G,z)})]}),u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Uptime"}),u.jsx("span",{"data-testid":"rig-uptime",children:(G==null?void 0:G.uptime)??"—"})]})]})]})}),u.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Actions"}),u.jsxs("div",{className:"flex flex-col gap-1",children:[u.jsx("button",{onClick:he,"data-testid":"rig-create-snapshot",disabled:h.isPending,className:"px-2 py-1 border border-stone-300 font-mono text-[8px] uppercase hover:bg-stone-200 text-left",children:h.isPending?"Creating...":"Create snapshot"}),u.jsx("button",{onClick:Se,"data-testid":"rig-export-spec",className:"px-2 py-1 border border-stone-300 font-mono text-[8px] uppercase hover:bg-stone-200 text-left",children:"Export spec"}),ue==="running"||ue==="partial"?u.jsx("button",{onClick:()=>T(!0),"data-testid":"rig-power-action",className:"px-2 py-1 border border-stone-300 font-mono text-[8px] uppercase hover:bg-stone-200 text-left",children:"Turn off"}):u.jsx("button",{onClick:ye,"data-testid":"rig-power-action",disabled:g.isPending,className:"px-2 py-1 border border-stone-300 font-mono text-[8px] uppercase hover:bg-stone-200 text-left disabled:opacity-50",children:g.isPending?"Starting...":"Turn on"}),u.jsx("button",{onClick:()=>{Y(!D),A(null)},"data-testid":"rig-add-pod",className:"px-2 py-1 border border-stone-300 font-mono text-[8px] uppercase hover:bg-stone-200 text-left",children:"Add pod"})]}),I&&u.jsx("div",{"data-testid":"rig-action-error",className:"mt-2 font-mono text-[9px] text-red-700",children:I})]}),D&&u.jsxs("section",{"data-testid":"add-pod-form",className:"px-4 py-3 border-b border-stone-100",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Add Pod — YAML Fragment"}),u.jsx("textarea",{"data-testid":"add-pod-yaml",className:"w-full h-24 font-mono text-[9px] p-2 border border-stone-300 bg-white",value:K,onChange:de=>U(de.target.value),placeholder:`id: my-pod
210
- label: My Pod
211
- members:
212
- - id: worker
213
- runtime: terminal
214
- agent_ref: "builtin:terminal"
215
- edges: []`}),u.jsx("button",{"data-testid":"add-pod-submit",disabled:$.isPending||!K.trim(),onClick:async()=>{A(null),H(null);try{const{parse:de}=await wM(async()=>{const{parse:Be}=await import("./index-B09doO8H.js");return{parse:Be}},[]),Ae=de(K),Re=await $.mutateAsync({rigId:e,pod:Ae});A(Re),Re.status==="ok"&&(Y(!1),U(""))}catch(de){H(de.message)}},className:"mt-1 px-2 py-1 border border-stone-300 font-mono text-[8px] uppercase hover:bg-stone-200 disabled:opacity-50",children:$.isPending?"Expanding...":"Expand"}),q&&u.jsx(ON,{result:q})]}),u.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Pods"}),l?u.jsx("div",{className:"font-mono text-[9px] text-stone-400",children:"Loading pods..."}):P.length===0?u.jsx("div",{className:"font-mono text-[9px] text-stone-400",children:"No nodes yet"}):u.jsx("div",{className:"space-y-2",children:P.map(([de,Ae])=>{var Re;return u.jsxs("div",{className:"p-2 bg-stone-50 border border-stone-200",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("div",{className:"font-mono text-[10px] font-bold",children:cs((Re=Ae[0])==null?void 0:Re.logicalId)??us(de==="__ungrouped__"?null:de)}),u.jsx("div",{className:"font-mono text-[9px] text-stone-400",children:Ae.length})]}),u.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:Ae.map(Be=>u.jsx("span",{className:"font-mono text-[9px] text-stone-700 border border-stone-200 bg-white px-1.5 py-0.5",children:Qr(Be.logicalId)},Be.logicalId))})]},de)})})]}),u.jsxs("section",{className:"px-4 py-3",children:[u.jsxs("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-3",children:["Snapshots (",d.length,")"]}),L&&u.jsx("div",{"data-testid":"snapshot-error",className:"mb-2 p-2 bg-red-50 border border-red-200 font-mono text-[9px] text-red-700",children:L}),O&&u.jsxs("div",{"data-testid":"restore-result",className:"mb-3 p-2 bg-stone-50 border border-stone-200",children:[u.jsx("div",{className:"font-mono text-[9px] text-stone-500 uppercase mb-1",children:"Restore Complete"}),O.map(de=>u.jsxs("div",{className:"flex items-center justify-between font-mono text-[10px]",children:[u.jsx("span",{children:de.logicalId}),u.jsx("span",{className:Fw(de.status),"data-testid":`restore-status-${de.logicalId}`,children:de.status})]},de.nodeId))]}),m&&u.jsx("div",{"data-testid":"snapshot-fetch-error",className:"mb-2 p-2 bg-red-50 border border-red-200 font-mono text-[9px] text-red-700",children:"Failed to load snapshots"}),f?u.jsx("div",{className:"font-mono text-[10px] text-stone-400 py-2 text-center",children:"Loading snapshots..."}):d.length===0&&!m?u.jsx("div",{className:"font-mono text-[10px] text-stone-400 py-2 text-center italic",children:"No snapshots yet"}):u.jsxs("div",{className:"space-y-1",children:[ee&&u.jsx("div",{className:"p-2 bg-stone-50 hover:bg-stone-100 transition-colors",children:u.jsxs("div",{className:"flex justify-between items-start",children:[u.jsxs("div",{children:[u.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.12em] text-stone-400",children:"Latest"}),u.jsx("div",{className:"font-mono text-[10px] font-bold","data-testid":`snap-short-${ee.id}`,children:oe}),u.jsxs("div",{className:"font-mono text-[9px] text-stone-400 mt-0.5",children:[ee.kind," · ",S1(ee.createdAt)]})]}),u.jsx("button",{"data-testid":`restore-btn-${ee.id}`,onClick:()=>N(ee.id),className:"font-mono text-[8px] border border-stone-300 px-1 py-0.5 hover:bg-stone-200",children:"Restore"})]})}),se.length>0&&u.jsxs("div",{className:"border-t border-stone-200 pt-2",children:[u.jsx("button",{type:"button","data-testid":"snapshot-history-toggle",onClick:()=>R(de=>!de),className:"font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500 hover:text-stone-900",children:_?"Hide history":`Show history (${se.length})`}),_&&u.jsx("div",{className:"mt-2 space-y-1",children:se.map(de=>u.jsx("div",{className:"p-2 bg-stone-50 hover:bg-stone-100 transition-colors",children:u.jsxs("div",{className:"flex justify-between items-start gap-3",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"font-mono text-[10px] font-bold","data-testid":`snap-short-${de.id}`,children:Gs(de.id)}),u.jsxs("div",{className:"font-mono text-[9px] text-stone-400 mt-0.5",children:[de.kind," · ",S1(de.createdAt)]})]}),u.jsx("button",{"data-testid":`restore-btn-${de.id}`,onClick:()=>N(de.id),className:"shrink-0 font-mono text-[8px] border border-stone-300 px-1 py-0.5 hover:bg-stone-200",children:"Restore"})]})},de.id))})]})]})]}),u.jsx(Gd,{open:w!==null,onOpenChange:de=>{de||N(null)},children:u.jsxs(Kl,{children:[u.jsxs(Fl,{children:[u.jsx(Zl,{className:"font-headline text-lg font-bold uppercase",children:"Restore Snapshot"}),u.jsxs(Wl,{className:"text-sm text-stone-500",children:["Restore from ",w?Gs(w):"","? Existing sessions will be restarted."]})]}),u.jsxs(Xl,{children:[u.jsx(Ne,{variant:"ghost",onClick:()=>N(null),children:"Cancel"}),u.jsx(Ne,{variant:"default","data-testid":w?`confirm-restore-${w}`:void 0,onClick:()=>w&&Ce(w),children:"Confirm Restore"})]})]})}),u.jsx(Gd,{open:C,onOpenChange:de=>{de||T(!1)},children:u.jsxs(Kl,{children:[u.jsxs(Fl,{children:[u.jsx(Zl,{className:"font-headline text-lg font-bold uppercase",children:"Turn Off Rig"}),u.jsxs(Wl,{className:"text-sm text-stone-500",children:["Stop all running sessions for ",(z==null?void 0:z.name)??e,"?"]})]}),u.jsxs(Xl,{children:[u.jsx(Ne,{variant:"ghost",onClick:()=>T(!1),children:"Cancel"}),u.jsx(Ne,{variant:"default","data-testid":"confirm-rig-down",disabled:y.isPending,onClick:ve,children:y.isPending?"Stopping...":"Confirm"})]})]})})]})]})}async function I3(e,t){const s=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}`);if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()}function DN(e,t){return Tt({queryKey:["rig",e,"nodes",t],queryFn:()=>I3(e,t),enabled:!!e&&!!t,refetchInterval:3e4})}async function ds(e){var s,r;try{if((r=(s=globalThis.navigator)==null?void 0:s.clipboard)!=null&&r.writeText)return await globalThis.navigator.clipboard.writeText(e),!0}catch{}if(!globalThis.document)return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.select();try{return document.execCommand("copy")}catch{return!1}finally{t.remove()}}function LN({peers:e,edges:t,transcript:s,compactSpec:r,contextUsage:i}){return u.jsxs(u.Fragment,{children:[(t.outgoing.length>0||t.incoming.length>0)&&u.jsxs("section",{"data-testid":"detail-edges",className:"px-4 py-3 border-b border-stone-100",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Edges"}),u.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[t.outgoing.map((l,d)=>{var f;return u.jsxs("div",{className:"flex gap-1",children:[u.jsx("span",{className:"text-stone-400",children:"→"}),u.jsx("span",{className:"text-stone-500",children:l.kind}),u.jsx("span",{className:"text-stone-900",children:((f=l.to)==null?void 0:f.logicalId)??"?"})]},`out-${d}`)}),t.incoming.map((l,d)=>{var f;return u.jsxs("div",{className:"flex gap-1",children:[u.jsx("span",{className:"text-stone-400",children:"←"}),u.jsx("span",{className:"text-stone-500",children:l.kind}),u.jsx("span",{className:"text-stone-900",children:((f=l.from)==null?void 0:f.logicalId)??"?"})]},`in-${d}`)})]})]}),e.length>0&&u.jsxs("section",{"data-testid":"detail-peers",className:"px-4 py-3 border-b border-stone-100",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Peers"}),u.jsx("div",{className:"space-y-0.5 font-mono text-[10px]",children:e.map(l=>u.jsxs("div",{className:"space-y-0",children:[u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-900",children:l.logicalId}),u.jsx("span",{className:"text-stone-500",children:l.runtime??"—"})]}),l.canonicalSessionName&&u.jsx("div",{className:"text-[9px] text-stone-400 truncate",children:l.canonicalSessionName})]},l.logicalId))})]}),s.enabled&&s.tailCommand&&u.jsxs("section",{"data-testid":"detail-transcript",className:"px-4 py-3 border-b border-stone-100",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Transcript"}),u.jsx("div",{className:"font-mono text-[9px] text-stone-700",children:s.path??"enabled"}),u.jsx("button",{onClick:()=>ds(s.tailCommand),className:"mt-1 px-2 py-1 border border-stone-300 font-mono text-[8px] uppercase hover:bg-stone-200 text-left truncate w-full",children:"Copy tail command"})]}),r.name&&u.jsxs("section",{"data-testid":"detail-compact-spec",className:"px-4 py-3 border-b border-stone-100",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Agent Spec"}),u.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Spec"}),u.jsx("span",{className:"text-stone-900",children:r.name})]}),r.version&&u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Version"}),u.jsx("span",{className:"text-stone-900",children:r.version})]}),r.profile&&u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Profile"}),u.jsx("span",{className:"text-stone-900",children:r.profile})]}),u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Skills"}),u.jsx("span",{className:"text-stone-900",children:r.skillCount})]}),u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Guidance"}),u.jsx("span",{className:"text-stone-900",children:r.guidanceCount})]})]})]}),u.jsxs("section",{"data-testid":"detail-context-usage",className:"px-4 py-3 border-b border-stone-100",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Context"}),(i==null?void 0:i.availability)==="known"?u.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Used"}),u.jsxs("span",{className:"text-stone-900",children:[i.usedPercentage,"%"]})]}),u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Remaining"}),u.jsxs("span",{className:"text-stone-900",children:[i.remainingPercentage,"%"]})]}),i.contextWindowSize&&u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Window"}),u.jsx("span",{className:"text-stone-900",children:i.contextWindowSize.toLocaleString()})]}),i.totalInputTokens!=null&&u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Input tokens"}),u.jsx("span",{className:"text-stone-900",children:i.totalInputTokens.toLocaleString()})]}),i.totalOutputTokens!=null&&u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Output tokens"}),u.jsx("span",{className:"text-stone-900",children:i.totalOutputTokens.toLocaleString()})]}),i.sampledAt&&u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Sampled"}),u.jsx("span",{className:"text-stone-400 text-[9px]",children:i.sampledAt})]}),i.fresh===!1&&u.jsx("div",{className:"font-mono text-[9px] text-amber-600 mt-1",children:"Stale sample"})]}):u.jsxs("div",{className:"font-mono text-[10px] text-stone-400",children:["unknown",i!=null&&i.reason?` (${i.reason})`:""]})]})]})}function B3(e){switch(e){case"ready":return"text-green-600";case"pending":return"text-amber-600";case"failed":return"text-red-600";default:return"text-stone-400"}}function H3({rigId:e,logicalId:t,onClose:s}){const r=Xt(),{data:i,isLoading:l,error:d}=DN(e,t),f=(i==null?void 0:i.canonicalSessionName)??t,m=async()=>{i!=null&&i.tmuxAttachCommand&&await ds(i.tmuxAttachCommand)},h=async()=>{try{await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/focus`,{method:"POST"})}catch{}},v=async()=>{i!=null&&i.resumeCommand&&await ds(i.resumeCommand)};return u.jsxs("aside",{"data-testid":"node-detail-panel",className:"absolute inset-y-0 right-0 z-20 w-80 border-l border-stone-300/25 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-hidden",children:[u.jsxs("div",{className:"flex justify-between items-center px-4 py-3 border-b border-stone-300/35 shrink-0",children:[u.jsx("span",{className:"font-mono text-xs font-bold text-stone-900 truncate",children:f}),u.jsx("button",{onClick:s,className:"text-stone-400 hover:text-stone-900 text-sm","data-testid":"detail-close",children:"×"})]}),l&&u.jsx("div",{className:"p-4 font-mono text-[9px] text-stone-400",children:"Loading..."}),d&&u.jsx("div",{className:"p-4 font-mono text-[9px] text-red-500",children:"Failed to load node detail"}),i&&u.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col gap-0",children:[u.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Identity"}),u.jsxs("div",{className:"space-y-1 font-mono text-[10px]",children:[u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Rig"}),u.jsx("span",{className:"text-stone-900",children:i.rigName})]}),u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Logical ID"}),u.jsx("span",{className:"text-stone-900",children:t})]}),u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Pod"}),u.jsx("span",{className:"text-stone-900",children:i.podNamespace??cs(t)??us(i.podId)})]}),u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Session"}),u.jsx("span",{className:"text-stone-900 truncate ml-2",children:i.canonicalSessionName??"—"})]}),u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Runtime"}),u.jsx("span",{className:"text-stone-900",children:i.runtime??"—"})]}),i.cwd&&u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"CWD"}),u.jsx("span",{className:"text-stone-900 truncate ml-2",children:i.cwd})]})]})]}),i.peers&&u.jsx(LN,{peers:i.peers,edges:i.edges,transcript:i.transcript,compactSpec:i.compactSpec,contextUsage:i.contextUsage}),u.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Status"}),u.jsxs("div",{className:"space-y-1 font-mono text-[10px]",children:[u.jsxs("div",{className:"flex justify-between",children:[u.jsx("span",{className:"text-stone-500",children:"Startup"}),u.jsx("span",{className:B3(i.startupStatus),"data-testid":"detail-startup-status",children:i.startupStatus??"stopped"})]}),u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("span",{className:"text-stone-500",children:"Restore"}),u.jsx("span",{className:`font-bold text-xs ${Fw(i.restoreOutcome)}`,"data-testid":"detail-restore-outcome",children:i.restoreOutcome})]}),(i.startupStatus==="failed"||i.latestError)&&u.jsxs("div",{className:"mt-2 p-2 bg-red-50 border border-red-200","data-testid":"detail-failure-banner",children:[u.jsx("div",{className:"font-mono text-[9px] text-red-700 font-bold mb-1",children:i.startupStatus==="failed"?"Startup Failed":"Error"}),i.latestError&&u.jsx("div",{className:"font-mono text-[9px] text-red-600 mb-1",children:i.latestError}),u.jsx("div",{className:"font-mono text-[8px] text-stone-500",children:i.startupStatus==="failed"?"Check logs with: rig ps --nodes, or restart with: rig up":"Try: rig restore <snapshotId>"})]})]})]}),u.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Actions"}),u.jsxs("div",{className:"flex flex-col gap-1",children:[i.tmuxAttachCommand&&u.jsx("button",{onClick:m,"data-testid":"detail-copy-attach",className:"px-2 py-1 border border-stone-300 font-mono text-[8px] uppercase hover:bg-stone-200 text-left truncate",children:"Copy tmux attach"}),u.jsx("button",{onClick:h,"data-testid":"detail-cmux-focus",className:"px-2 py-1 border border-stone-300 font-mono text-[8px] uppercase hover:bg-stone-200 text-left",children:"Open in cmux"}),i.resumeCommand&&u.jsx("button",{onClick:v,"data-testid":"detail-copy-resume",className:"px-2 py-1 border border-stone-300 font-mono text-[8px] uppercase hover:bg-stone-200 text-left truncate",children:"Copy resume command"}),u.jsx("button",{onClick:()=>r({to:"/rigs/$rigId/nodes/$logicalId",params:{rigId:e,logicalId:encodeURIComponent(t)}}),"data-testid":"detail-open-full",className:"px-2 py-1 border border-stone-300 font-mono text-[8px] uppercase hover:bg-stone-200 text-left font-bold",children:"Open Full Details"})]})]}),i.nodeKind==="infrastructure"&&i.infrastructureStartupCommand&&u.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Startup Command"}),u.jsx("code",{className:"font-mono text-[9px] text-stone-700 bg-stone-100 px-2 py-1 block",children:i.infrastructureStartupCommand})]}),i.startupFiles.length>0&&u.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Startup Files"}),u.jsx("ol",{className:"list-decimal list-inside space-y-0.5",children:i.startupFiles.map((g,y)=>u.jsxs("li",{className:"font-mono text-[9px] text-stone-700 truncate",children:[g.path," ",u.jsxs("span",{className:"text-stone-400",children:["(",g.deliveryHint,")"]})]},y))})]}),i.recentEvents.length>0&&u.jsxs("section",{className:"px-4 py-3",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Recent Events"}),u.jsx("div",{className:"space-y-0.5",children:i.recentEvents.slice(0,10).map((g,y)=>u.jsxs("div",{className:"font-mono text-[9px] flex justify-between",children:[u.jsx("span",{className:"text-stone-700 truncate",children:g.type}),u.jsx("span",{className:"text-stone-400 ml-2 shrink-0",children:g.createdAt})]},y))})]})]})]})}const ng=100;function U3(){const e=Ct(),[t,s]=j.useState([]),[r,i]=j.useState(!1),[l,d]=j.useState(!1),f=j.useRef(!1),m=j.useCallback(h=>{try{const v=JSON.parse(h),g={seq:typeof v.seq=="number"?v.seq:Date.now(),type:v.type??"unknown",payload:v,createdAt:v.createdAt??new Date().toISOString(),receivedAt:Date.now()};if(s(y=>[g,...y].slice(0,ng)),(g.type==="package.installed"||g.type==="package.rolledback")&&e.invalidateQueries({queryKey:["packages"]}),(g.type==="bootstrap.completed"||g.type==="bootstrap.partial")&&e.invalidateQueries({queryKey:["rigs","summary"]}),(g.type==="session.discovered"||g.type==="session.vanished")&&e.invalidateQueries({queryKey:["discovery"]}),g.type==="node.claimed"){e.invalidateQueries({queryKey:["discovery"]});const y=g.payload.rigId;y&&(e.invalidateQueries({queryKey:["rig",y,"graph"]}),e.invalidateQueries({queryKey:["rig",y,"nodes"]}),e.invalidateQueries({queryKey:["rig",y,"sessions"]}),e.invalidateQueries({queryKey:["rigs","summary"]}),e.invalidateQueries({queryKey:["ps"]}))}if(g.type==="session.detached"&&e.invalidateQueries({queryKey:["discovery"]}),g.type==="session.detached"||g.type==="node.removed"||g.type==="pod.deleted"||g.type==="rig.expanded"||g.type==="restore.completed"||g.type==="rig.deleted"){const y=g.payload.rigId;y&&(e.invalidateQueries({queryKey:["rig",y,"graph"]}),e.invalidateQueries({queryKey:["rig",y,"nodes"]}),e.invalidateQueries({queryKey:["rig",y,"sessions"]})),e.invalidateQueries({queryKey:["rigs","summary"]}),e.invalidateQueries({queryKey:["ps"]})}}catch{}},[e]);return j.useEffect(()=>{f.current=!1,i(!1);const h=new EventSource("/api/events");return h.addEventListener("open",()=>{i(!0),f.current=!1}),h.addEventListener("message",v=>{m(v.data)}),h.addEventListener("error",()=>{i(!1),f.current=!0}),()=>{h.close()}},[m]),{events:t,connected:r,feedOpen:l,setFeedOpen:d}}function Sp(e){return String(e).padStart(2,"0")}function rd(e,t=6){return typeof e!="string"||e.length===0?null:e.slice(-t)}function id(e){if(typeof e!="string")return null;const t=e.replace(/\s+/g," ").trim();return t.length>0?t:null}function $3(e){const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"??:??:??":`${Sp(t.getHours())}:${Sp(t.getMinutes())}:${Sp(t.getSeconds())}`}function q3(e){return e==="bundle.created"||e.startsWith("bootstrap.")?"bg-accent":e.startsWith("package.")?"bg-primary":e.startsWith("rig.")?"bg-accent":e.startsWith("snapshot.")?"bg-primary":e.startsWith("restore.")?"bg-warning":e==="chat.message"?"bg-primary":e==="node.startup_ready"?"bg-green-500":e==="node.startup_pending"?"bg-amber-400":e==="node.startup_failed"||e==="session.detached"?"bg-destructive":e==="session.discovered"?"bg-accent":e==="session.vanished"?"bg-destructive":e==="node.claimed"||e==="node.launched"?"bg-primary":"bg-foreground-muted-on-dark"}function V3(e){var h;const t=e.payload,s=rd(t.rigId),r=rd(t.snapshotId),i=rd(t.installId),l=rd(t.nodeId),d=id(t.logicalId),f=id(t.sender),m=id(t.body);switch(e.type){case"bootstrap.planned":return`bootstrap planned ${t.sourceRef}`;case"bootstrap.started":return`bootstrap started ${t.sourceRef}`;case"bootstrap.completed":return s?`bootstrap rig#${s} completed`:"bootstrap completed";case"bootstrap.partial":return`bootstrap partial ${t.completed} ok ${t.failed} failed`;case"bootstrap.failed":return`error bootstrap ${t.error}`;case"package.validated":return`package ${t.packageName} validated`;case"package.planned":return`package ${t.packageName} planned ${t.actionable} actionable ${t.deferred} deferred`;case"package.installed":return`package ${t.packageName}@${t.packageVersion} ${t.applied} applied ${t.deferred} deferred`;case"package.rolledback":return i?`rollback install#${i} restored ${t.restored}`:`rollback restored ${t.restored}`;case"package.install_failed":return`error package ${t.packageName} ${t.message}`;case"rig.created":return s?`rig rig#${s} created`:"rig created";case"rig.deleted":return s?`rig rig#${s} deleted`:"rig deleted";case"rig.imported":return s?`import ${t.specName} rig#${s} created`:`import ${t.specName} created`;case"snapshot.created":return s&&r?`snapshot rig#${s} ${t.kind} snap#${r}`:`snapshot ${t.kind}`;case"restore.started":return s?`restore rig#${s} started`:"restore started";case"restore.completed":{const v=Array.isArray(t.result)?t.result:((h=t.result)==null?void 0:h.nodes)??[];return s?`restore rig#${s} ${v.length} nodes restored`:`restore ${v.length} nodes restored`}case"node.launched":return`startup ${d??id(t.nodeId)??"unknown"} launched`;case"node.startup_pending":return l?`startup node#${l} pending`:"startup pending";case"node.startup_ready":return l?`startup node#${l} ready`:"startup ready";case"node.startup_failed":return l?`error startup node#${l} ${t.error}`:`error startup ${t.error}`;case"session.detached":return`error session ${t.sessionName} lost`;case"bundle.created":return`bundle ${t.bundleName} v${t.bundleVersion} bundled`;case"session.discovered":return`discover ${t.tmuxSession}:${t.tmuxPane} ${t.runtimeHint}`;case"session.vanished":return`error ${t.tmuxSession}:${t.tmuxPane} vanished`;case"node.claimed":return s?`claim ${t.logicalId} rig#${s}`:`claim ${t.logicalId}`;case"chat.message":return`chat ${f??"unknown"}: ${m??""}`.trim();default:return e.type}}function G3(e){const s=e.payload.rigId;if(e.type==="session.discovered"||e.type==="session.vanished")return"/discovery";if(e.type==="node.claimed"){const r=e.payload.rigId;return r?`/rigs/${r}`:"/discovery"}return e.type.startsWith("bootstrap.")||e.type.startsWith("package.")?"/bootstrap":s?`/rigs/${s}`:null}function Y3({events:e}){const t=Xt(),s=e.length>=ng;return u.jsxs("div",{"data-testid":"feed-scroll-region",className:"relative z-10 overflow-y-auto flex-1 min-h-0",children:[u.jsxs("div",{"data-testid":"feed-disclosure",className:"px-spacing-3 py-2 border-b border-stone-300/20 font-mono text-[9px] uppercase tracking-[0.06em] text-stone-500",children:["Showing last ",ng," live events in this panel."]}),e.length===0?u.jsx("div",{"data-testid":"feed-empty",className:"px-spacing-3 py-spacing-4 font-mono text-[10px] text-stone-500 text-center",children:"No recent log entries"}):u.jsxs(u.Fragment,{children:[e.map(r=>{const i=G3(r),l=i!==null;return u.jsxs("div",{"data-testid":"feed-entry","data-event-type":r.type,role:l?"link":void 0,tabIndex:l?0:void 0,onClick:l?()=>t({to:i}):void 0,onKeyDown:l?d=>{d.key==="Enter"&&t({to:i})}:void 0,className:Te("flex items-center gap-2 px-spacing-3 py-1.5 border-b border-stone-300/20 transition-colors duration-150 ease-tactical font-mono text-[10px] leading-4",l&&"cursor-pointer hover:bg-white/24"),children:[u.jsx("span",{"data-testid":"feed-dot",className:Te("inline-block h-[6px] w-[6px] shrink-0",q3(r.type))}),u.jsx("span",{"data-testid":"feed-time",className:"shrink-0 text-[9px] text-stone-500 tabular-nums",children:$3(r.createdAt)}),u.jsx("span",{"data-testid":"feed-summary",className:"min-w-0 flex-1 truncate text-stone-900",children:V3(r)})]},r.seq)}),s?u.jsx("div",{"data-testid":"feed-end-of-history",className:"px-spacing-3 py-2 font-mono text-[9px] uppercase tracking-[0.06em] text-stone-400 text-center",children:"Older events are not loaded in this panel yet."}):null]})]})}async function Q3(){if(!(await fetch("/healthz")).ok)throw new Error("unhealthy");return!0}async function K3(){const e=await fetch("/api/adapters/cmux/status");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function od(e){return e===null?"text-stone-500":e?"text-green-600":"text-amber-600"}function w1(e,t,s,r="unknown"){return e===null?r:e?t:s}function F3({onClose:e,events:t,initialTab:s="log"}){var h;const[r,i]=j.useState(s);j.useEffect(()=>{i(s)},[s]);const l=Tt({queryKey:["daemon","health"],queryFn:Q3,refetchInterval:1e4,retry:!1}),d=Tt({queryKey:["daemon","cmux"],queryFn:K3,refetchInterval:3e4,retry:!1}),f=l.isSuccess,m=f?((h=d.data)==null?void 0:h.available)??null:null;return u.jsxs("aside",{"data-testid":"system-panel",className:"absolute inset-y-0 right-0 z-20 w-80 border-l border-stone-300/25 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-hidden",children:[u.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-stone-300/35 shrink-0",children:[u.jsx("h2",{className:"min-w-0 font-mono text-xs font-bold text-stone-900 truncate",children:"system"}),u.jsx("button",{"data-testid":"system-close",onClick:e,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),u.jsxs("div",{className:"flex border-b border-stone-300/35 shrink-0","data-testid":"system-tabs",children:[u.jsx("button",{"data-testid":"system-tab-log",onClick:()=>i("log"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${r==="log"?"border-b-2 border-stone-800 font-bold text-stone-900":"text-stone-400"}`,children:"Recent Log"}),u.jsx("button",{"data-testid":"system-tab-status",onClick:()=>i("status"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${r==="status"?"border-b-2 border-stone-800 font-bold text-stone-900":"text-stone-400"}`,children:"Status"})]}),r==="log"?u.jsx("div",{className:"flex flex-1 min-h-0 flex-col overflow-hidden","data-testid":"system-log-tab",children:u.jsx(Y3,{events:t})}):u.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-4","data-testid":"system-status-tab",children:u.jsxs("section",{className:"border border-stone-300/28 bg-white/12 px-3 py-3",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-3",children:"Runtime"}),u.jsxs("div",{className:"space-y-3 font-mono text-[10px]",children:[u.jsxs("div",{className:"flex items-start gap-3",children:[u.jsx(hA,{className:`mt-[1px] h-3.5 w-3.5 shrink-0 ${od(f)}`}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-stone-900",children:"Daemon"}),u.jsx("div",{"data-testid":"system-daemon-status",className:od(f),children:w1(f,"connected","unavailable")}),u.jsx("div",{className:"text-stone-500",children:"Controls the local OpenRig daemon connection."})]})]}),u.jsxs("div",{className:"flex items-start gap-3",children:[u.jsx(dA,{className:`mt-[1px] h-3.5 w-3.5 shrink-0 ${od(m)}`}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-stone-900",children:"cmux"}),u.jsx("div",{"data-testid":"system-cmux-status",className:od(m),children:w1(m,"available","unavailable")}),u.jsx("div",{className:"text-stone-500",children:"Enables cmux surface focus and transport-aware workflows."})]})]})]})]})})]})}function zN(){const e=Ct();return Pt({mutationFn:async()=>{const t=await fetch("/api/discovery/scan",{method:"POST"});if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["discovery"]})}})}function X3(e){const t=new URLSearchParams;e!=null&&e.status&&t.set("status",e.status),e!=null&&e.runtimeHint&&e.runtimeHint.length>0&&t.set("runtimeHint",e.runtimeHint.join(",")),e!=null&&e.minConfidence&&t.set("minConfidence",e.minConfidence);const s=t.toString();return s?`/api/discovery?${s}`:"/api/discovery"}function Gg(e,t=!0){var i;const s=X3(e),r=["discovery",(e==null?void 0:e.status)??"all",((i=e==null?void 0:e.runtimeHint)==null?void 0:i.join(","))??"any",(e==null?void 0:e.minConfidence)??"any"];return Tt({queryKey:r,queryFn:async()=>{const l=await fetch(s);if(!l.ok)throw new Error(`HTTP ${l.status}`);const d=await l.json();return Array.isArray(d)?d:[]},enabled:t})}function Z3(e){const{data:t}=Gg({status:"active"},e);return t??[]}function W3(){const e=Ct();return Pt({mutationFn:async({discoveredId:t,rigId:s,logicalId:r})=>{const i=await fetch(`/api/discovery/${encodeURIComponent(t)}/bind`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rigId:s,logicalId:r})});if(!i.ok){const l=await i.json().catch(()=>({}));throw new Error(l.error??`HTTP ${i.status}`)}return i.json()},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["discovery"]}),e.invalidateQueries({queryKey:["rig",s.rigId,"graph"]})}})}function J3(){const e=Ct();return Pt({mutationFn:async({discoveredId:t,rigId:s,target:r})=>{const i=await fetch(`/api/discovery/${encodeURIComponent(t)}/adopt`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rigId:s,target:r})});if(!i.ok){const l=await i.json().catch(()=>({}));throw new Error(l.error??`HTTP ${i.status}`)}return i.json()},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:["discovery"]}),e.invalidateQueries({queryKey:["rig",s.rigId,"graph"]})}})}function e4(e){const t=e.match(/^\/rigs\/([^/]+)/);return(t==null?void 0:t[1])??null}function t4(e){switch(e){case"claude-code":return"text-primary";case"codex":return"text-accent";default:return"text-foreground-muted"}}function n4(e){switch(e){case"claude-code":return"Claude Code";case"codex":return"Codex";default:return"Unknown"}}function s4(e){return`'${e.replace(/'/g,"'\\''")}'`}function a4(e){const t=e.tmuxWindow?`${e.tmuxSession}:${e.tmuxWindow}`:e.tmuxSession;return`tmux attach -t ${s4(t)}`}function r4(e){const t=e.split(/[@:]/)[0]??e;return(t.split(/[-_.]/).filter(Boolean).at(-1)??t).toLowerCase().replace(/[^a-z0-9_-]/g,"")||"member"}function N1(e){return e.includes(".")?Qr(e):e.length>12?Gs(e):e}function j1(e){return e.podLabel??e.podNamespace??Gs(e.podId)}function E1({label:e,activeLabel:t,onClick:s,testId:r}){const[i,l]=j.useState(!1),d=j.useRef(null);j.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const f=async()=>{await s()&&(l(!0),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{l(!1),d.current=null},900))};return u.jsx("button",{type:"button","data-testid":r,onClick:()=>{f()},className:Te("px-1.5 py-0.5 border font-mono text-[7px] uppercase transition-colors",i?"bg-stone-900 text-white border-stone-900":"bg-white text-stone-900 border-stone-300 hover:bg-stone-100"),children:i?t:e})}function i4({onClose:e,selectedDiscoveredId:t,onSelectDiscoveredId:s,placementTarget:r,onClearPlacement:i}){const l=uf({select:w=>w.location.pathname}),d=e4(l),{data:f=[]}=Gg({status:"active",runtimeHint:["claude-code","codex"],minConfidence:"medium"}),m=zN(),h=J3(),v=f.find(w=>w.id===t)??null,[g,y]=j.useState("");j.useEffect(()=>{if(v&&(r==null?void 0:r.kind)==="pod"){y(w=>w||r4(v.tmuxSession));return}(!v||!r||r.kind!=="pod")&&y("")},[v,r]);const b=j.useMemo(()=>v?d?r?r.eligible?r.kind==="node"?`Bind ${v.tmuxSession} to ${N1(r.logicalId)}.`:`Add ${v.tmuxSession} to ${j1(r)} pod.`:r.reason??"That target cannot receive the selected session.":`Selected ${v.tmuxSession}. Click an available node to bind it, or click a pod to add it there.`:"Select a rig in the explorer to place the selected session.":null,[d,r,v]),S=()=>{if(!v||!d||!r||!r.eligible)return;let w;if(r.kind==="node")w={kind:"node",logicalId:r.logicalId};else{if(!r.podNamespace)return;w={kind:"pod",podId:r.podId,podNamespace:r.podNamespace,memberName:g.trim()}}h.mutate({discoveredId:v.id,rigId:d,target:w},{onSuccess:()=>{s(null),i()}})};return u.jsxs("aside",{"data-testid":"discovery-panel",className:"absolute inset-y-0 right-0 z-20 w-80 border-l border-stone-300/25 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-hidden",children:[u.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-stone-300/35 shrink-0",children:[u.jsx("h2",{className:"min-w-0 font-mono text-xs font-bold text-stone-900 truncate",children:"discovery"}),u.jsx("button",{"data-testid":"discovery-close",onClick:e,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),u.jsxs("div",{className:"border-b border-stone-300/35 px-4 py-3 shrink-0 space-y-2",children:[u.jsxs("div",{className:"flex items-center justify-between gap-3",children:[u.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Inventory"}),u.jsx(Ne,{variant:"ghost",size:"sm","data-testid":"discovery-scan-now",disabled:m.isPending,onClick:()=>m.mutate(),children:m.isPending?"SCANNING...":"SCAN NOW"})]}),u.jsx(gc,{to:"/discovery/inventory","data-testid":"discovery-open-inventory",onClick:e,className:"inline-flex items-center border border-stone-300 bg-white px-1.5 py-0.5 font-mono text-[7px] uppercase tracking-[0.12em] text-stone-700 transition-colors hover:bg-stone-100 hover:text-stone-900",children:"Legacy Inventory Page"})]}),u.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:f.length===0?u.jsx("div",{"data-testid":"discovery-empty",className:"font-mono text-[10px] text-stone-500",children:"No running Claude or Codex sessions are currently visible."}):f.map(w=>{const N=w.id===t;return u.jsxs("div",{"data-testid":`discovery-session-${w.id}`,className:Te("border border-stone-200 bg-white/60 px-3 py-3",N&&"border-emerald-500 shadow-[0_10px_24px_rgba(34,197,94,0.16)]"),children:[u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[u.jsx("div",{className:Te("font-mono text-[8px] uppercase tracking-[0.12em]",t4(w.runtimeHint)),children:n4(w.runtimeHint)}),u.jsx("div",{className:"font-mono text-[10px] text-stone-900 truncate",title:w.tmuxSession,children:w.tmuxSession})]}),w.cwd?u.jsx("div",{className:"mt-1 font-mono text-[9px] text-stone-500 truncate",title:w.cwd,children:w.cwd}):null]}),u.jsx(Ne,{variant:N?"tactical":"ghost",size:"sm","data-testid":`discovery-select-${w.id}`,onClick:()=>s(N?null:w.id),children:N?"SELECTED":"SELECT"})]}),u.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[u.jsx(E1,{label:"copy tmux",activeLabel:"copied",testId:`discovery-copy-tmux-${w.id}`,onClick:async()=>ds(a4(w))}),w.cwd?u.jsx(E1,{label:"copy cwd",activeLabel:"copied",testId:`discovery-copy-cwd-${w.id}`,onClick:async()=>ds(w.cwd??"")}):null]}),N?u.jsxs("div",{className:"mt-3 space-y-2 border-t border-emerald-200/80 pt-3",children:[b?u.jsx("div",{"data-testid":"discovery-selected-session-status",className:"border border-emerald-300/80 bg-white/70 px-2.5 py-2 font-mono text-[10px] leading-5 text-stone-900",children:b}):null,r&&!r.eligible?u.jsx("div",{"data-testid":"discovery-target-error",className:"border border-red-200 bg-red-50/80 px-2.5 py-2 font-mono text-[9px] text-red-700",children:r.reason??"That destination is not available."}):null,r!=null&&r.eligible?u.jsxs("div",{className:"space-y-2 border border-emerald-300/80 bg-white/70 px-3 py-2","data-testid":"discovery-target-card",children:[u.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-emerald-800",children:"Target"}),u.jsx("div",{"data-testid":"discovery-target-summary",className:"font-mono text-[10px] text-stone-900",children:r.kind==="node"?`${N1(r.logicalId)} selected`:`${j1(r)} pod selected`}),r.kind==="pod"?u.jsxs("div",{className:"space-y-1",children:[u.jsx("label",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-emerald-800",htmlFor:"discovery-member-name",children:"Member name"}),u.jsx("input",{id:"discovery-member-name","data-testid":"discovery-member-name-input",value:g,onChange:C=>y(C.target.value),className:"w-full bg-transparent border-b border-emerald-300 py-1 font-mono text-[10px] text-stone-900 focus:outline-none focus:border-emerald-700"})]}):null,h.isError?u.jsx("div",{"data-testid":"discovery-adopt-error",className:"font-mono text-[9px] text-red-600",children:h.error.message}):null,u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Ne,{variant:"tactical",size:"sm","data-testid":"discovery-confirm-adopt",disabled:h.isPending||r.kind==="pod"&&!g.trim(),onClick:S,children:h.isPending?"ADOPTING...":"ADOPT"}),u.jsx(Ne,{variant:"ghost",size:"sm","data-testid":"discovery-clear-target",onClick:i,children:"CLEAR"})]})]}):null]}):null]},w.id)})})]})}const Hn={currentRigDraft:"openrig.specs.current-rig-draft",currentAgentDraft:"openrig.specs.current-agent-draft",recentRigDrafts:"openrig.specs.recent-rig-drafts",recentAgentDrafts:"openrig.specs.recent-agent-drafts",bootstrapSourceRef:"openrig.specs.bootstrap-source-ref"},o4={currentRigDraft:"rigged.specs.current-rig-draft",currentAgentDraft:"rigged.specs.current-agent-draft",recentRigDrafts:"rigged.specs.recent-rig-drafts",recentAgentDrafts:"rigged.specs.recent-agent-drafts",bootstrapSourceRef:"rigged.specs.bootstrap-source-ref"},l4={activeTask:null,currentRigDraft:null,currentAgentDraft:null,recentRigDrafts:[],recentAgentDrafts:[],selectedRigDraft:null,selectedAgentDraft:null,bootstrapSourceRef:"",saveRigDraft:()=>{},rememberRigDraft:()=>{},selectRigDraft:()=>{},clearSelectedRigDraft:()=>{},saveAgentDraft:()=>{},rememberAgentDraft:()=>{},selectAgentDraft:()=>{},clearSelectedAgentDraft:()=>{},setBootstrapSourceRef:()=>{}},PN=j.createContext(l4);function Rl(e,t){var s;if(typeof window>"u")return t;try{const r=window.localStorage.getItem(e);if(r)return JSON.parse(r);const i=((s=Object.entries(Hn).find(([,m])=>m===e))==null?void 0:s[0])??null;if(!i)return t;const l=o4[i];if(!l)return t;const d=window.localStorage.getItem(l);if(!d)return t;const f=JSON.parse(d);return window.localStorage.setItem(e,JSON.stringify(f)),window.localStorage.removeItem(l),f}catch{return t}}function Tl(e,t){if(!(typeof window>"u"))try{if(t===""||t===null){window.localStorage.removeItem(e);return}window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function ld(e,t,s){return{id:`${e}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,kind:e,label:s??(e==="rig"?"Untitled RigSpec":"Untitled AgentSpec"),yaml:t,updatedAt:Date.now()}}function cd(e,t){var r;const s=e.match(/^\s*name:\s*["']?([^"'\n#]+)["']?/m);return((r=s==null?void 0:s[1])==null?void 0:r.trim())||t}function C1(e,t){return[t,...e.filter(s=>s.id!==t.id&&s.yaml!==t.yaml)].slice(0,5)}function c4(e,t,s,r){if(e==="/import")return t?{id:"import",label:"Import RigSpec",route:"/import",summary:t.label}:null;if(e==="/bootstrap"){const i=r.trim();return i?{id:"bootstrap",label:"Bootstrap",route:"/bootstrap",summary:i}:null}return e==="/agents/validate"&&s?{id:"validate-agent",label:"Validate AgentSpec",route:"/agents/validate",summary:s.label}:null}function u4({children:e}){const t=uf({select:I=>I.location.pathname}),[s,r]=j.useState(()=>Rl(Hn.currentRigDraft,null)),[i,l]=j.useState(()=>Rl(Hn.currentAgentDraft,null)),[d,f]=j.useState(()=>Rl(Hn.recentRigDrafts,[])),[m,h]=j.useState(()=>Rl(Hn.recentAgentDrafts,[])),[v,g]=j.useState(null),[y,b]=j.useState(null),[S,w]=j.useState(()=>Rl(Hn.bootstrapSourceRef,""));j.useEffect(()=>{Tl(Hn.currentRigDraft,s)},[s]),j.useEffect(()=>{Tl(Hn.currentAgentDraft,i)},[i]),j.useEffect(()=>{Tl(Hn.recentRigDrafts,d)},[d]),j.useEffect(()=>{Tl(Hn.recentAgentDrafts,m)},[m]),j.useEffect(()=>{Tl(Hn.bootstrapSourceRef,S.trim())},[S]);const N=j.useMemo(()=>d.find(I=>I.id===v)??((s==null?void 0:s.id)===v?s:null),[s,d,v]),C=j.useMemo(()=>m.find(I=>I.id===y)??((i==null?void 0:i.id)===y?i:null),[i,m,y]),T=j.useCallback((I,H)=>{if(!I.trim()){r(null);return}r(D=>({id:(D==null?void 0:D.id)??ld("rig",I,H).id,kind:"rig",label:H??cd(I,(D==null?void 0:D.label)??"Untitled RigSpec"),yaml:I,updatedAt:Date.now()}))},[]),_=j.useCallback((I,H)=>{if(!I.trim())return;const D=ld("rig",I,H??cd(I,"Untitled RigSpec"));r(D),f(Y=>C1(Y,D)),g(D.id)},[]),R=j.useCallback((I,H)=>{if(!I.trim()){l(null);return}l(D=>({id:(D==null?void 0:D.id)??ld("agent",I,H).id,kind:"agent",label:H??cd(I,(D==null?void 0:D.label)??"Untitled AgentSpec"),yaml:I,updatedAt:Date.now()}))},[]),O=j.useCallback((I,H)=>{if(!I.trim())return;const D=ld("agent",I,H??cd(I,"Untitled AgentSpec"));l(D),h(Y=>C1(Y,D)),b(D.id)},[]),B=j.useCallback(I=>{g(I);const H=d.find(D=>D.id===I)??((s==null?void 0:s.id)===I?s:null);H&&r(H)},[s,d]),L=j.useCallback(I=>{b(I);const H=m.find(D=>D.id===I)??((i==null?void 0:i.id)===I?i:null);H&&l(H)},[i,m]),M=j.useMemo(()=>({activeTask:c4(t,s,i,S),currentRigDraft:s,currentAgentDraft:i,recentRigDrafts:d,recentAgentDrafts:m,selectedRigDraft:N,selectedAgentDraft:C,bootstrapSourceRef:S,saveRigDraft:T,rememberRigDraft:_,selectRigDraft:B,clearSelectedRigDraft:()=>g(null),saveAgentDraft:R,rememberAgentDraft:O,selectAgentDraft:L,clearSelectedAgentDraft:()=>b(null),setBootstrapSourceRef:w}),[t,s,i,d,m,N,C,S,T,_,B,R,O,L]);return u.jsx(PN.Provider,{value:M,children:e})}function Co(){return j.useContext(PN)}async function d4(e){const t=e?`/api/specs/library?kind=${e}`:"/api/specs/library",s=await fetch(t);if(!s.ok)throw new Error(`HTTP ${s.status}`);return s.json()}async function f4(e){const t=await fetch(`/api/specs/library/${encodeURIComponent(e)}/review`);if(!t.ok){const s=await t.json().catch(()=>({}));throw new Error(s.error??`HTTP ${t.status}`)}return t.json()}function Yd(e){return Tt({queryKey:["spec-library",e??"all"],queryFn:()=>d4(e)})}function Yg(e){return Tt({queryKey:["spec-library","review",e],queryFn:()=>f4(e),enabled:!!e})}function wp({title:e,description:t,children:s}){return u.jsxs("section",{className:"border border-stone-300/28 bg-white/10 px-3 py-3",children:[u.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),u.jsx("p",{className:"mt-2 text-[11px] leading-5 text-stone-600",children:t}),u.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:s})]})}function ud({title:e,drafts:t,onSelect:s}){return t.length===0?null:u.jsxs("div",{className:"mt-3 w-full space-y-2",children:[u.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),u.jsx("div",{className:"w-full space-y-1",children:t.map(r=>u.jsxs("button",{type:"button",onClick:()=>s(r.id),className:"flex w-full items-center justify-between border border-stone-300/28 bg-white/5 px-2 py-2 text-left transition-colors hover:border-stone-900/25 hover:bg-white/10",children:[u.jsx("span",{className:"min-w-0 truncate text-[11px] text-stone-800",children:r.label}),u.jsx("span",{className:"ml-3 shrink-0 font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:new Date(r.updatedAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]},r.id))})]})}function _1({title:e,entries:t,onSelect:s,renderAction:r,renderExpanded:i}){return t.length===0?null:u.jsxs("div",{className:"mt-3 w-full space-y-2",children:[u.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),u.jsx("div",{className:"w-full space-y-1",children:t.map(l=>u.jsxs("div",{children:[u.jsxs("div",{className:"flex w-full items-center border border-stone-300/28 bg-white/5 transition-colors hover:border-stone-900/25 hover:bg-white/10",children:[u.jsxs("button",{type:"button","data-testid":`library-entry-${l.id}`,onClick:()=>s(l.id),className:"flex flex-1 items-center justify-between px-2 py-2 text-left min-w-0",children:[u.jsx("span",{className:"min-w-0 truncate text-[11px] text-stone-800",children:l.name}),u.jsx("span",{className:"ml-3 shrink-0 font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:l.sourceType==="builtin"?"built-in":l.version})]}),r&&u.jsx("div",{className:"shrink-0 pr-2",children:r(l)})]}),i&&u.jsx("div",{children:i(l)})]},l.id))})]})}function h4({entryId:e,onDone:t}){var N,C;const{data:s}=Yg(e),{data:r=[]}=Ig(),i=Kw(),[l,d]=j.useState(""),[f,m]=j.useState(0),[h,v]=j.useState(null),[g,y]=j.useState(null),b=r.filter(T=>T.status==="running"),S=s&&"pods"in s&&Array.isArray(s.pods)?s.pods:[],w=async()=>{if(!l||S.length===0)return;y(null),v(null);const T=S[f];try{const _=await i.mutateAsync({rigId:l,pod:T});v(_),_.status==="ok"&&setTimeout(t,1500)}catch(_){y(_.message)}};return s?S.length===0?u.jsx("div",{className:"font-mono text-[9px] text-stone-400 p-2",children:"No pods available in this spec."}):u.jsxs("div",{"data-testid":"add-to-rig-flow",className:"mt-2 p-2 border border-stone-300/28 bg-white/5 space-y-2",children:[u.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase",children:"Add to Rig"}),u.jsxs("select",{"data-testid":"add-to-rig-select",className:"w-full font-mono text-[9px] border border-stone-300 p-1",value:l,onChange:T=>d(T.target.value),children:[u.jsx("option",{value:"",children:"Select rig..."}),b.map(T=>u.jsx("option",{value:T.rigId,children:T.name},T.rigId))]}),S.length>1&&u.jsx("select",{"data-testid":"add-to-rig-pod-select",className:"w-full font-mono text-[9px] border border-stone-300 p-1",value:f,onChange:T=>m(Number(T.target.value)),children:S.map((T,_)=>u.jsx("option",{value:_,children:T.label??T.id},T.id))}),u.jsx("button",{"data-testid":"add-to-rig-submit",disabled:!l||i.isPending,onClick:w,className:"px-2 py-1 border border-stone-300 font-mono text-[8px] uppercase hover:bg-stone-200 disabled:opacity-50",children:i.isPending?"Expanding...":`Add ${((N=S[f])==null?void 0:N.label)??((C=S[f])==null?void 0:C.id)??"pod"}`}),h&&u.jsx(ON,{result:h}),g&&u.jsx("div",{className:"font-mono text-[9px] text-red-600",children:g}),u.jsx("button",{onClick:t,className:"font-mono text-[8px] text-stone-400 hover:text-stone-700",children:"Cancel"})]}):u.jsx("div",{className:"font-mono text-[9px] text-stone-400 p-2",children:"Loading spec..."})}function m4({onClose:e}){const t=Xt(),{activeTask:s,currentRigDraft:r,currentAgentDraft:i,recentRigDrafts:l,recentAgentDrafts:d,selectRigDraft:f,selectAgentDraft:m}=Co(),h=async z=>{await t({to:z})},v=async z=>{f(z),await h("/specs/rig")},g=async z=>{m(z),await h("/specs/agent")},{data:y=[]}=Yd("rig"),{data:b=[]}=Yd("agent"),[S,w]=j.useState(null),[N,C]=j.useState(null),[T,_]=j.useState(""),[R,O]=j.useState(null),[B,L]=j.useState(null),M=AM(),I=MM(),H=async z=>{await t({to:"/specs/library/$entryId",params:{entryId:z}})},D=l.filter(z=>z.id!==(r==null?void 0:r.id)),Y=d.filter(z=>z.id!==(i==null?void 0:i.id)),K=z=>{L(null),O(null),C(z.id),_(z.name)},U=async z=>{try{L(null),await I.mutateAsync({entryId:z,name:T}),C(null),_("")}catch(G){L(G.message)}},q=async z=>{try{L(null),await M.mutateAsync(z),O(null),N===z&&(C(null),_(""))}catch(G){L(G.message)}},A=(z,G)=>u.jsxs("div",{className:"flex items-center gap-1",children:[G&&u.jsx("button",{"data-testid":`library-add-to-rig-${z.id}`,onClick:V=>{V.stopPropagation(),L(null),w(S===z.id?null:z.id)},className:"shrink-0 font-mono text-[7px] uppercase tracking-[0.12em] text-stone-500 hover:text-stone-900 border border-stone-300 px-1 py-0.5",children:"+ Rig"}),z.sourceType==="user_file"&&u.jsxs(u.Fragment,{children:[u.jsx("button",{"data-testid":`library-rename-${z.id}`,onClick:V=>{V.stopPropagation(),K(z)},className:"shrink-0 font-mono text-[7px] uppercase tracking-[0.12em] text-stone-500 hover:text-stone-900 border border-stone-300 px-1 py-0.5",children:"Rename"}),u.jsx("button",{"data-testid":`library-remove-${z.id}`,onClick:V=>{V.stopPropagation(),L(null),C(null),O(R===z.id?null:z.id)},className:"shrink-0 font-mono text-[7px] uppercase tracking-[0.12em] text-red-600 hover:text-red-800 border border-stone-300 px-1 py-0.5",children:"Remove"})]})]}),$=z=>{const G=N===z.id,V=R===z.id;return!G&&!V?null:u.jsxs("div",{className:"border-x border-b border-stone-300/28 bg-white/6 px-2 py-2 space-y-2",children:[G&&u.jsxs("div",{"data-testid":`library-rename-form-${z.id}`,className:"space-y-2",children:[u.jsx("input",{"data-testid":`library-rename-input-${z.id}`,value:T,onChange:P=>_(P.target.value),className:"w-full border border-stone-300 bg-white/80 px-2 py-1 font-mono text-[10px]"}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{"data-testid":`library-rename-submit-${z.id}`,onClick:()=>void U(z.id),className:"font-mono text-[8px] uppercase border border-stone-300 px-2 py-1 hover:bg-stone-200",children:"Save"}),u.jsx("button",{onClick:()=>{C(null),_(""),L(null)},className:"font-mono text-[8px] uppercase text-stone-500 hover:text-stone-900",children:"Cancel"})]})]}),V&&u.jsxs("div",{"data-testid":`library-remove-confirm-${z.id}`,className:"space-y-2",children:[u.jsxs("div",{className:"font-mono text-[9px] text-stone-600",children:["Remove ",z.name," from the library?"]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{"data-testid":`library-remove-submit-${z.id}`,onClick:()=>void q(z.id),className:"font-mono text-[8px] uppercase border border-stone-300 px-2 py-1 text-red-600 hover:bg-stone-200",children:"Confirm"}),u.jsx("button",{onClick:()=>{O(null),L(null)},className:"font-mono text-[8px] uppercase text-stone-500 hover:text-stone-900",children:"Cancel"})]})]}),B&&u.jsx("div",{"data-testid":"library-action-error",className:"font-mono text-[9px] text-red-600",children:B})]})};return u.jsxs("aside",{"data-testid":"specs-panel",className:"absolute inset-y-0 right-0 z-20 w-80 border-l border-stone-300/25 bg-[rgba(250,249,245,0.035)] supports-[backdrop-filter]:bg-[rgba(250,249,245,0.018)] backdrop-blur-[14px] backdrop-saturate-75 shadow-[-6px_0_14px_rgba(46,52,46,0.04)] flex flex-col overflow-hidden",children:[u.jsxs("div",{className:"flex items-center justify-between border-b border-stone-300/35 px-4 py-3 shrink-0",children:[u.jsx("h2",{className:"min-w-0 truncate font-mono text-xs font-bold text-stone-900",children:"specs"}),u.jsx("button",{"data-testid":"specs-close",onClick:e,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),u.jsxs("div",{className:"flex-1 space-y-4 overflow-y-auto px-4 py-3",children:[s&&u.jsx(wp,{title:"Current Task",description:s.summary,children:u.jsxs(Ne,{variant:"outline",size:"sm",onClick:()=>h(s.route),children:["Resume ",s.label]})}),u.jsxs(wp,{title:"Rig Specs",description:"Import a rig spec, review it in the workspace, then instantiate or bootstrap it.",children:[u.jsx(Ne,{variant:"outline",size:"sm",onClick:()=>h("/import"),children:"Import RigSpec"}),u.jsx(Ne,{variant:"outline",size:"sm",onClick:()=>h("/bootstrap"),children:"Bootstrap"}),u.jsx(_1,{title:"Library",entries:y,onSelect:H,renderAction:z=>A(z,!0),renderExpanded:$}),S&&y.some(z=>z.id===S)&&u.jsx(h4,{entryId:S,onDone:()=>w(null)}),r&&u.jsx(ud,{title:"Current Draft",drafts:[r],onSelect:v}),u.jsx(ud,{title:"Recent Drafts",drafts:D,onSelect:v})]}),u.jsxs(wp,{title:"Agent Specs",description:"Validate agent specs and use the workspace for spec-level review surfaces.",children:[u.jsx(Ne,{variant:"outline",size:"sm",onClick:()=>h("/agents/validate"),children:"Validate AgentSpec"}),u.jsx(_1,{title:"Library",entries:b,onSelect:H,renderAction:z=>A(z,!1),renderExpanded:$}),i&&u.jsx(ud,{title:"Current Draft",drafts:[i],onSelect:g}),u.jsx(ud,{title:"Recent Drafts",drafts:Y,onSelect:g})]})]})]})}function p4({selection:e,onClose:t,events:s,selectedDiscoveredId:r,onSelectDiscoveredId:i,placementTarget:l,onClearPlacement:d}){return e?e.type==="rig"?u.jsx(P3,{rigId:e.rigId,onClose:t}):e.type==="node"?u.jsx(H3,{rigId:e.rigId,logicalId:e.logicalId,onClose:t}):e.type==="system"?u.jsx(F3,{onClose:t,events:s,initialTab:e.tab??"log"}):e.type==="discovery"?u.jsx(i4,{onClose:t,selectedDiscoveredId:r,onSelectDiscoveredId:i,placementTarget:l,onClearPlacement:d}):e.type==="specs"?u.jsx(m4,{onClose:t}):null:null}function g4(){const e=Ct(),t=j.useRef(null);j.useEffect(()=>{const s=new EventSource("/api/events"),r=new Set;return s.addEventListener("message",i=>{let l={};try{l=JSON.parse(i.data)}catch{}const{type:d,rigId:f}=l;d&&(d.startsWith("node.startup_")&&f&&r.add(`rig:${f}:nodes`),(d==="rig.created"||d==="rig.deleted"||d==="rig.stopped"||d==="rig.imported"||d==="bootstrap.completed"||d==="bootstrap.partial")&&(r.add("rigs:summary"),r.add("ps")),d==="restore.completed"&&f&&(r.add("rigs:summary"),r.add("ps"),r.add(`rig:${f}:nodes`)),!t.current&&(t.current=setTimeout(()=>{t.current=null;for(const m of r)if(m==="rigs:summary")e.invalidateQueries({queryKey:["rigs","summary"]});else if(m==="ps")e.invalidateQueries({queryKey:["ps"]});else if(m.startsWith("rig:")){const h=m.split(":");e.invalidateQueries({queryKey:["rig",h[1],h[2]]})}r.clear()},150)))}),()=>{s.close(),t.current&&(clearTimeout(t.current),t.current=null)}},[e])}const IN=j.createContext({selection:null,setSelection:()=>{}}),BN=j.createContext({openExplorer:()=>{}}),HN=j.createContext({selectedDiscoveredId:null,setSelectedDiscoveredId:()=>{},placementTarget:null,setPlacementTarget:()=>{},clearPlacement:()=>{}});function tr(){return j.useContext(IN)}function x4(){return j.useContext(BN)}function y4(){return j.useContext(HN)}function v4(){const{selection:e,setSelection:t}=tr();return{selectedNode:(e==null?void 0:e.type)==="node"?{rigId:e.rigId,logicalId:e.logicalId}:null,setSelectedNode:s=>t(s?{type:"node",rigId:s.rigId,logicalId:s.logicalId}:null)}}const R1=1024;function b4(e){const t=e.match(/^\/rigs\/([^/]+)/);return(t==null?void 0:t[1])??null}function S4(e,t,s){return e==="/"?null:t?s??Gs(t,8):e.startsWith("/discovery")?"Discovery":e==="/specs"||e.startsWith("/specs/")||e.startsWith("/packages")||e==="/import"||e==="/bootstrap"||e==="/agents/validate"?"Specs":e.startsWith("/bundles/inspect")?"Bundle Inspector":e.startsWith("/bundles/install")?"Bundle Install":null}function w4({children:e}){var I;const s=uf().location.pathname,r=b4(s),{data:i}=xc(),[l,d]=j.useState(!1),[f,m]=j.useState(!0),[h,v]=j.useState(()=>typeof window>"u"?!0:window.innerWidth>=R1),{events:g}=U3(),[y,b]=j.useState(null),[S,w]=j.useState(null),[N,C]=j.useState(null),T=r?((I=i==null?void 0:i.find(H=>H.id===r))==null?void 0:I.name)??null:null,_=S4(s,r,T),R=j.useCallback(H=>{b(H),!h&&H&&d(!1)},[h]),O=j.useCallback(()=>{if(m(!0),!h){b(null),d(!0);return}d(!0)},[h]),B=j.useCallback(()=>{w(null),C(null)},[]),L=j.useCallback(H=>{w(H),C(null)},[]);j.useEffect(()=>{(y==null?void 0:y.type)!=="discovery"&&B()},[y,B]),j.useEffect(()=>{(y==null?void 0:y.type)==="discovery"&&N&&r!==N.rigId&&C(null)},[r,N,y]),j.useEffect(()=>{const H=()=>{v(window.innerWidth>=R1)};return H(),window.addEventListener("resize",H),()=>window.removeEventListener("resize",H)},[]),j.useEffect(()=>{!h&&!(s==="/specs"||s==="/discovery")&&(b(null),d(!1))},[h,s]),g4();const M={"--workspace-left-offset":h?f?"18rem":"3rem":"0rem","--workspace-right-offset":h&&y?"20rem":"0rem"};return u.jsx(u4,{children:u.jsx(IN.Provider,{value:{selection:y,setSelection:R},children:u.jsx(HN.Provider,{value:{selectedDiscoveredId:S,setSelectedDiscoveredId:L,placementTarget:N,setPlacementTarget:C,clearPlacement:B},children:u.jsx(BN.Provider,{value:{openExplorer:O},children:u.jsxs("div",{className:"h-screen flex flex-col",children:[u.jsxs("header",{"data-testid":"app-header",className:"h-14 flex items-center justify-between px-spacing-6 bg-background border-b-2 border-stone-900 shrink-0 relative z-30",children:[_&&u.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center px-28",children:u.jsx("div",{"data-testid":"header-surface-title",className:"truncate font-mono text-sm font-semibold uppercase tracking-[0.12em] text-stone-700",children:_})}),u.jsxs("div",{className:"flex items-center gap-spacing-4",children:[u.jsxs("button",{"data-testid":"sidebar-toggle",onClick:()=>{l||b(null),d(!l)},className:"flex flex-col gap-[3px] p-1 lg:hidden","aria-label":"Toggle navigation",children:[u.jsx("span",{className:"block w-4 h-[1.5px] bg-stone-900"}),u.jsx("span",{className:"block w-4 h-[1.5px] bg-stone-900"}),u.jsx("span",{className:"block w-3 h-[1.5px] bg-stone-900"})]}),u.jsx(gc,{to:"/","data-testid":"brand-home-link",className:"inline-flex items-center bg-stone-950 px-3 py-1 font-mono text-sm font-bold uppercase tracking-[0.08em] text-stone-50 transition-colors hover:bg-stone-800",children:"OPENRIG"})]}),u.jsx("div",{className:"flex-1"}),u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx("button",{type:"button","data-testid":"discovery-toggle",onClick:()=>R((y==null?void 0:y.type)==="discovery"?null:{type:"discovery"}),className:`inline-flex h-8 w-8 items-center justify-center text-stone-700 transition-colors ${(y==null?void 0:y.type)==="discovery"?"text-stone-950":"hover:text-stone-950"}`,"aria-label":(y==null?void 0:y.type)==="discovery"?"Close discovery drawer":"Open discovery drawer",title:(y==null?void 0:y.type)==="discovery"?"Close discovery drawer":"Open discovery drawer",children:u.jsx(xA,{className:"h-4 w-4"})}),u.jsx("button",{type:"button","data-testid":"specs-toggle",onClick:()=>R((y==null?void 0:y.type)==="specs"?null:{type:"specs"}),className:`inline-flex h-8 w-8 items-center justify-center text-stone-700 transition-colors ${(y==null?void 0:y.type)==="specs"?"text-stone-950":"hover:text-stone-950"}`,"aria-label":(y==null?void 0:y.type)==="specs"?"Close specs drawer":"Open specs drawer",title:(y==null?void 0:y.type)==="specs"?"Close specs drawer":"Open specs drawer",children:u.jsx(rA,{className:"h-4 w-4"})}),u.jsx("button",{type:"button","data-testid":"system-toggle",onClick:()=>R((y==null?void 0:y.type)==="system"?null:{type:"system",tab:"log"}),className:`inline-flex h-8 w-8 items-center justify-center text-stone-700 transition-colors ${(y==null?void 0:y.type)==="system"?"text-stone-950":"hover:text-stone-950"}`,"aria-label":(y==null?void 0:y.type)==="system"?"Close system drawer":"Open system drawer",title:(y==null?void 0:y.type)==="system"?"Close system drawer":"Open system drawer",children:u.jsx(sA,{className:"h-4 w-4"})})]})]}),u.jsxs("div",{className:"flex flex-1 min-h-0 relative",children:[l&&u.jsx("div",{className:"fixed inset-0 bg-black/20 z-20 lg:hidden",onClick:()=>d(!1)}),u.jsx(vM,{open:l,onClose:()=>d(!1),selection:y,onSelect:R,desktopMode:f?"full":"hidden",onDesktopToggle:()=>m(H=>!H)}),u.jsx("main",{"data-testid":"content-area",className:"flex-1 flex flex-col overflow-auto relative",style:M,children:u.jsx("div",{className:"relative z-10 route-enter flex-1 flex flex-col",children:e},s)}),u.jsx(p4,{selection:y,onClose:()=>R(null),events:g,selectedDiscoveredId:S,onSelectDiscoveredId:L,placementTarget:N,onClearPlacement:B})]})]})})})})})}function bt(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let s=0,r;s<e.length;s++)(r=bt(e[s]))!==""&&(t+=(t&&" ")+r);else for(let s in e)e[s]&&(t+=(t&&" ")+s);return t}var N4={value:()=>{}};function pf(){for(var e=0,t=arguments.length,s={},r;e<t;++e){if(!(r=arguments[e]+"")||r in s||/[\s.]/.test(r))throw new Error("illegal type: "+r);s[r]=[]}return new Rd(s)}function Rd(e){this._=e}function j4(e,t){return e.trim().split(/^|\s+/).map(function(s){var r="",i=s.indexOf(".");if(i>=0&&(r=s.slice(i+1),s=s.slice(0,i)),s&&!t.hasOwnProperty(s))throw new Error("unknown type: "+s);return{type:s,name:r}})}Rd.prototype=pf.prototype={constructor:Rd,on:function(e,t){var s=this._,r=j4(e+"",s),i,l=-1,d=r.length;if(arguments.length<2){for(;++l<d;)if((i=(e=r[l]).type)&&(i=E4(s[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<d;)if(i=(e=r[l]).type)s[i]=T1(s[i],e.name,t);else if(t==null)for(i in s)s[i]=T1(s[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var s in t)e[s]=t[s].slice();return new Rd(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var s=new Array(i),r=0,i,l;r<i;++r)s[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],r=0,i=l.length;r<i;++r)l[r].value.apply(t,s)},apply:function(e,t,s){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,l=r.length;i<l;++i)r[i].value.apply(t,s)}};function E4(e,t){for(var s=0,r=e.length,i;s<r;++s)if((i=e[s]).name===t)return i.value}function T1(e,t,s){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=N4,e=e.slice(0,r).concat(e.slice(r+1));break}return s!=null&&e.push({name:t,value:s}),e}var sg="http://www.w3.org/1999/xhtml";const A1={svg:"http://www.w3.org/2000/svg",xhtml:sg,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function gf(e){var t=e+="",s=t.indexOf(":");return s>=0&&(t=e.slice(0,s))!=="xmlns"&&(e=e.slice(s+1)),A1.hasOwnProperty(t)?{space:A1[t],local:e}:e}function C4(e){return function(){var t=this.ownerDocument,s=this.namespaceURI;return s===sg&&t.documentElement.namespaceURI===sg?t.createElement(e):t.createElementNS(s,e)}}function _4(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function UN(e){var t=gf(e);return(t.local?_4:C4)(t)}function R4(){}function Qg(e){return e==null?R4:function(){return this.querySelector(e)}}function T4(e){typeof e!="function"&&(e=Qg(e));for(var t=this._groups,s=t.length,r=new Array(s),i=0;i<s;++i)for(var l=t[i],d=l.length,f=r[i]=new Array(d),m,h,v=0;v<d;++v)(m=l[v])&&(h=e.call(m,m.__data__,v,l))&&("__data__"in m&&(h.__data__=m.__data__),f[v]=h);return new wn(r,this._parents)}function A4(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function M4(){return[]}function $N(e){return e==null?M4:function(){return this.querySelectorAll(e)}}function k4(e){return function(){return A4(e.apply(this,arguments))}}function O4(e){typeof e=="function"?e=k4(e):e=$N(e);for(var t=this._groups,s=t.length,r=[],i=[],l=0;l<s;++l)for(var d=t[l],f=d.length,m,h=0;h<f;++h)(m=d[h])&&(r.push(e.call(m,m.__data__,h,d)),i.push(m));return new wn(r,i)}function qN(e){return function(){return this.matches(e)}}function VN(e){return function(t){return t.matches(e)}}var D4=Array.prototype.find;function L4(e){return function(){return D4.call(this.children,e)}}function z4(){return this.firstElementChild}function P4(e){return this.select(e==null?z4:L4(typeof e=="function"?e:VN(e)))}var I4=Array.prototype.filter;function B4(){return Array.from(this.children)}function H4(e){return function(){return I4.call(this.children,e)}}function U4(e){return this.selectAll(e==null?B4:H4(typeof e=="function"?e:VN(e)))}function $4(e){typeof e!="function"&&(e=qN(e));for(var t=this._groups,s=t.length,r=new Array(s),i=0;i<s;++i)for(var l=t[i],d=l.length,f=r[i]=[],m,h=0;h<d;++h)(m=l[h])&&e.call(m,m.__data__,h,l)&&f.push(m);return new wn(r,this._parents)}function GN(e){return new Array(e.length)}function q4(){return new wn(this._enter||this._groups.map(GN),this._parents)}function Qd(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Qd.prototype={constructor:Qd,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function V4(e){return function(){return e}}function G4(e,t,s,r,i,l){for(var d=0,f,m=t.length,h=l.length;d<h;++d)(f=t[d])?(f.__data__=l[d],r[d]=f):s[d]=new Qd(e,l[d]);for(;d<m;++d)(f=t[d])&&(i[d]=f)}function Y4(e,t,s,r,i,l,d){var f,m,h=new Map,v=t.length,g=l.length,y=new Array(v),b;for(f=0;f<v;++f)(m=t[f])&&(y[f]=b=d.call(m,m.__data__,f,t)+"",h.has(b)?i[f]=m:h.set(b,m));for(f=0;f<g;++f)b=d.call(e,l[f],f,l)+"",(m=h.get(b))?(r[f]=m,m.__data__=l[f],h.delete(b)):s[f]=new Qd(e,l[f]);for(f=0;f<v;++f)(m=t[f])&&h.get(y[f])===m&&(i[f]=m)}function Q4(e){return e.__data__}function K4(e,t){if(!arguments.length)return Array.from(this,Q4);var s=t?Y4:G4,r=this._parents,i=this._groups;typeof e!="function"&&(e=V4(e));for(var l=i.length,d=new Array(l),f=new Array(l),m=new Array(l),h=0;h<l;++h){var v=r[h],g=i[h],y=g.length,b=F4(e.call(v,v&&v.__data__,h,r)),S=b.length,w=f[h]=new Array(S),N=d[h]=new Array(S),C=m[h]=new Array(y);s(v,g,w,N,C,b,t);for(var T=0,_=0,R,O;T<S;++T)if(R=w[T]){for(T>=_&&(_=T+1);!(O=N[_])&&++_<S;);R._next=O||null}}return d=new wn(d,r),d._enter=f,d._exit=m,d}function F4(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function X4(){return new wn(this._exit||this._groups.map(GN),this._parents)}function Z4(e,t,s){var r=this.enter(),i=this,l=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),s==null?l.remove():s(l),r&&i?r.merge(i).order():i}function W4(e){for(var t=e.selection?e.selection():e,s=this._groups,r=t._groups,i=s.length,l=r.length,d=Math.min(i,l),f=new Array(i),m=0;m<d;++m)for(var h=s[m],v=r[m],g=h.length,y=f[m]=new Array(g),b,S=0;S<g;++S)(b=h[S]||v[S])&&(y[S]=b);for(;m<i;++m)f[m]=s[m];return new wn(f,this._parents)}function J4(){for(var e=this._groups,t=-1,s=e.length;++t<s;)for(var r=e[t],i=r.length-1,l=r[i],d;--i>=0;)(d=r[i])&&(l&&d.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(d,l),l=d);return this}function e5(e){e||(e=t5);function t(g,y){return g&&y?e(g.__data__,y.__data__):!g-!y}for(var s=this._groups,r=s.length,i=new Array(r),l=0;l<r;++l){for(var d=s[l],f=d.length,m=i[l]=new Array(f),h,v=0;v<f;++v)(h=d[v])&&(m[v]=h);m.sort(t)}return new wn(i,this._parents).order()}function t5(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function n5(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function s5(){return Array.from(this)}function a5(){for(var e=this._groups,t=0,s=e.length;t<s;++t)for(var r=e[t],i=0,l=r.length;i<l;++i){var d=r[i];if(d)return d}return null}function r5(){let e=0;for(const t of this)++e;return e}function i5(){return!this.node()}function o5(e){for(var t=this._groups,s=0,r=t.length;s<r;++s)for(var i=t[s],l=0,d=i.length,f;l<d;++l)(f=i[l])&&e.call(f,f.__data__,l,i);return this}function l5(e){return function(){this.removeAttribute(e)}}function c5(e){return function(){this.removeAttributeNS(e.space,e.local)}}function u5(e,t){return function(){this.setAttribute(e,t)}}function d5(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function f5(e,t){return function(){var s=t.apply(this,arguments);s==null?this.removeAttribute(e):this.setAttribute(e,s)}}function h5(e,t){return function(){var s=t.apply(this,arguments);s==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,s)}}function m5(e,t){var s=gf(e);if(arguments.length<2){var r=this.node();return s.local?r.getAttributeNS(s.space,s.local):r.getAttribute(s)}return this.each((t==null?s.local?c5:l5:typeof t=="function"?s.local?h5:f5:s.local?d5:u5)(s,t))}function YN(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function p5(e){return function(){this.style.removeProperty(e)}}function g5(e,t,s){return function(){this.style.setProperty(e,t,s)}}function x5(e,t,s){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,s)}}function y5(e,t,s){return arguments.length>1?this.each((t==null?p5:typeof t=="function"?x5:g5)(e,t,s??"")):yo(this.node(),e)}function yo(e,t){return e.style.getPropertyValue(t)||YN(e).getComputedStyle(e,null).getPropertyValue(t)}function v5(e){return function(){delete this[e]}}function b5(e,t){return function(){this[e]=t}}function S5(e,t){return function(){var s=t.apply(this,arguments);s==null?delete this[e]:this[e]=s}}function w5(e,t){return arguments.length>1?this.each((t==null?v5:typeof t=="function"?S5:b5)(e,t)):this.node()[e]}function QN(e){return e.trim().split(/^|\s+/)}function Kg(e){return e.classList||new KN(e)}function KN(e){this._node=e,this._names=QN(e.getAttribute("class")||"")}KN.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function FN(e,t){for(var s=Kg(e),r=-1,i=t.length;++r<i;)s.add(t[r])}function XN(e,t){for(var s=Kg(e),r=-1,i=t.length;++r<i;)s.remove(t[r])}function N5(e){return function(){FN(this,e)}}function j5(e){return function(){XN(this,e)}}function E5(e,t){return function(){(t.apply(this,arguments)?FN:XN)(this,e)}}function C5(e,t){var s=QN(e+"");if(arguments.length<2){for(var r=Kg(this.node()),i=-1,l=s.length;++i<l;)if(!r.contains(s[i]))return!1;return!0}return this.each((typeof t=="function"?E5:t?N5:j5)(s,t))}function _5(){this.textContent=""}function R5(e){return function(){this.textContent=e}}function T5(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function A5(e){return arguments.length?this.each(e==null?_5:(typeof e=="function"?T5:R5)(e)):this.node().textContent}function M5(){this.innerHTML=""}function k5(e){return function(){this.innerHTML=e}}function O5(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function D5(e){return arguments.length?this.each(e==null?M5:(typeof e=="function"?O5:k5)(e)):this.node().innerHTML}function L5(){this.nextSibling&&this.parentNode.appendChild(this)}function z5(){return this.each(L5)}function P5(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function I5(){return this.each(P5)}function B5(e){var t=typeof e=="function"?e:UN(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function H5(){return null}function U5(e,t){var s=typeof e=="function"?e:UN(e),r=t==null?H5:typeof t=="function"?t:Qg(t);return this.select(function(){return this.insertBefore(s.apply(this,arguments),r.apply(this,arguments)||null)})}function $5(){var e=this.parentNode;e&&e.removeChild(this)}function q5(){return this.each($5)}function V5(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function G5(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Y5(e){return this.select(e?G5:V5)}function Q5(e){return arguments.length?this.property("__data__",e):this.node().__data__}function K5(e){return function(t){e.call(this,t,this.__data__)}}function F5(e){return e.trim().split(/^|\s+/).map(function(t){var s="",r=t.indexOf(".");return r>=0&&(s=t.slice(r+1),t=t.slice(0,r)),{type:t,name:s}})}function X5(e){return function(){var t=this.__on;if(t){for(var s=0,r=-1,i=t.length,l;s<i;++s)l=t[s],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++r]=l;++r?t.length=r:delete this.__on}}}function Z5(e,t,s){return function(){var r=this.__on,i,l=K5(t);if(r){for(var d=0,f=r.length;d<f;++d)if((i=r[d]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=l,i.options=s),i.value=t;return}}this.addEventListener(e.type,l,s),i={type:e.type,name:e.name,value:t,listener:l,options:s},r?r.push(i):this.__on=[i]}}function W5(e,t,s){var r=F5(e+""),i,l=r.length,d;if(arguments.length<2){var f=this.node().__on;if(f){for(var m=0,h=f.length,v;m<h;++m)for(i=0,v=f[m];i<l;++i)if((d=r[i]).type===v.type&&d.name===v.name)return v.value}return}for(f=t?Z5:X5,i=0;i<l;++i)this.each(f(r[i],t,s));return this}function ZN(e,t,s){var r=YN(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,s):(i=r.document.createEvent("Event"),s?(i.initEvent(t,s.bubbles,s.cancelable),i.detail=s.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function J5(e,t){return function(){return ZN(this,e,t)}}function eO(e,t){return function(){return ZN(this,e,t.apply(this,arguments))}}function tO(e,t){return this.each((typeof t=="function"?eO:J5)(e,t))}function*nO(){for(var e=this._groups,t=0,s=e.length;t<s;++t)for(var r=e[t],i=0,l=r.length,d;i<l;++i)(d=r[i])&&(yield d)}var WN=[null];function wn(e,t){this._groups=e,this._parents=t}function yc(){return new wn([[document.documentElement]],WN)}function sO(){return this}wn.prototype=yc.prototype={constructor:wn,select:T4,selectAll:O4,selectChild:P4,selectChildren:U4,filter:$4,data:K4,enter:q4,exit:X4,join:Z4,merge:W4,selection:sO,order:J4,sort:e5,call:n5,nodes:s5,node:a5,size:r5,empty:i5,each:o5,attr:m5,style:y5,property:w5,classed:C5,text:A5,html:D5,raise:z5,lower:I5,append:B5,insert:U5,remove:q5,clone:Y5,datum:Q5,on:W5,dispatch:tO,[Symbol.iterator]:nO};function Sn(e){return typeof e=="string"?new wn([[document.querySelector(e)]],[document.documentElement]):new wn([[e]],WN)}function aO(e){let t;for(;t=e.sourceEvent;)e=t;return e}function $n(e,t){if(e=aO(e),t===void 0&&(t=e.currentTarget),t){var s=t.ownerSVGElement||t;if(s.createSVGPoint){var r=s.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const rO={passive:!1},Jl={capture:!0,passive:!1};function Np(e){e.stopImmediatePropagation()}function no(e){e.preventDefault(),e.stopImmediatePropagation()}function JN(e){var t=e.document.documentElement,s=Sn(e).on("dragstart.drag",no,Jl);"onselectstart"in t?s.on("selectstart.drag",no,Jl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ej(e,t){var s=e.document.documentElement,r=Sn(e).on("dragstart.drag",null);t&&(r.on("click.drag",no,Jl),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in s?r.on("selectstart.drag",null):(s.style.MozUserSelect=s.__noselect,delete s.__noselect)}const dd=e=>()=>e;function ag(e,{sourceEvent:t,subject:s,target:r,identifier:i,active:l,x:d,y:f,dx:m,dy:h,dispatch:v}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:s,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:d,enumerable:!0,configurable:!0},y:{value:f,enumerable:!0,configurable:!0},dx:{value:m,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:v}})}ag.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function iO(e){return!e.ctrlKey&&!e.button}function oO(){return this.parentNode}function lO(e,t){return t??{x:e.x,y:e.y}}function cO(){return navigator.maxTouchPoints||"ontouchstart"in this}function tj(){var e=iO,t=oO,s=lO,r=cO,i={},l=pf("start","drag","end"),d=0,f,m,h,v,g=0;function y(R){R.on("mousedown.drag",b).filter(r).on("touchstart.drag",N).on("touchmove.drag",C,rO).on("touchend.drag touchcancel.drag",T).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function b(R,O){if(!(v||!e.call(this,R,O))){var B=_(this,t.call(this,R,O),R,O,"mouse");B&&(Sn(R.view).on("mousemove.drag",S,Jl).on("mouseup.drag",w,Jl),JN(R.view),Np(R),h=!1,f=R.clientX,m=R.clientY,B("start",R))}}function S(R){if(no(R),!h){var O=R.clientX-f,B=R.clientY-m;h=O*O+B*B>g}i.mouse("drag",R)}function w(R){Sn(R.view).on("mousemove.drag mouseup.drag",null),ej(R.view,h),no(R),i.mouse("end",R)}function N(R,O){if(e.call(this,R,O)){var B=R.changedTouches,L=t.call(this,R,O),M=B.length,I,H;for(I=0;I<M;++I)(H=_(this,L,R,O,B[I].identifier,B[I]))&&(Np(R),H("start",R,B[I]))}}function C(R){var O=R.changedTouches,B=O.length,L,M;for(L=0;L<B;++L)(M=i[O[L].identifier])&&(no(R),M("drag",R,O[L]))}function T(R){var O=R.changedTouches,B=O.length,L,M;for(v&&clearTimeout(v),v=setTimeout(function(){v=null},500),L=0;L<B;++L)(M=i[O[L].identifier])&&(Np(R),M("end",R,O[L]))}function _(R,O,B,L,M,I){var H=l.copy(),D=$n(I||B,O),Y,K,U;if((U=s.call(R,new ag("beforestart",{sourceEvent:B,target:y,identifier:M,active:d,x:D[0],y:D[1],dx:0,dy:0,dispatch:H}),L))!=null)return Y=U.x-D[0]||0,K=U.y-D[1]||0,function q(A,$,z){var G=D,V;switch(A){case"start":i[M]=q,V=d++;break;case"end":delete i[M],--d;case"drag":D=$n(z||$,O),V=d;break}H.call(A,R,new ag(A,{sourceEvent:$,subject:U,target:y,identifier:M,active:V,x:D[0]+Y,y:D[1]+K,dx:D[0]-G[0],dy:D[1]-G[1],dispatch:H}),L)}}return y.filter=function(R){return arguments.length?(e=typeof R=="function"?R:dd(!!R),y):e},y.container=function(R){return arguments.length?(t=typeof R=="function"?R:dd(R),y):t},y.subject=function(R){return arguments.length?(s=typeof R=="function"?R:dd(R),y):s},y.touchable=function(R){return arguments.length?(r=typeof R=="function"?R:dd(!!R),y):r},y.on=function(){var R=l.on.apply(l,arguments);return R===l?y:R},y.clickDistance=function(R){return arguments.length?(g=(R=+R)*R,y):Math.sqrt(g)},y}function Fg(e,t,s){e.prototype=t.prototype=s,s.constructor=e}function nj(e,t){var s=Object.create(e.prototype);for(var r in t)s[r]=t[r];return s}function vc(){}var ec=.7,Kd=1/ec,so="\\s*([+-]?\\d+)\\s*",tc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",uO=/^#([0-9a-f]{3,8})$/,dO=new RegExp(`^rgb\\(${so},${so},${so}\\)$`),fO=new RegExp(`^rgb\\(${fs},${fs},${fs}\\)$`),hO=new RegExp(`^rgba\\(${so},${so},${so},${tc}\\)$`),mO=new RegExp(`^rgba\\(${fs},${fs},${fs},${tc}\\)$`),pO=new RegExp(`^hsl\\(${tc},${fs},${fs}\\)$`),gO=new RegExp(`^hsla\\(${tc},${fs},${fs},${tc}\\)$`),M1={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Fg(vc,Jr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:k1,formatHex:k1,formatHex8:xO,formatHsl:yO,formatRgb:O1,toString:O1});function k1(){return this.rgb().formatHex()}function xO(){return this.rgb().formatHex8()}function yO(){return sj(this).formatHsl()}function O1(){return this.rgb().formatRgb()}function Jr(e){var t,s;return e=(e+"").trim().toLowerCase(),(t=uO.exec(e))?(s=t[1].length,t=parseInt(t[1],16),s===6?D1(t):s===3?new cn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):s===8?fd(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):s===4?fd(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=dO.exec(e))?new cn(t[1],t[2],t[3],1):(t=fO.exec(e))?new cn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=hO.exec(e))?fd(t[1],t[2],t[3],t[4]):(t=mO.exec(e))?fd(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=pO.exec(e))?P1(t[1],t[2]/100,t[3]/100,1):(t=gO.exec(e))?P1(t[1],t[2]/100,t[3]/100,t[4]):M1.hasOwnProperty(e)?D1(M1[e]):e==="transparent"?new cn(NaN,NaN,NaN,0):null}function D1(e){return new cn(e>>16&255,e>>8&255,e&255,1)}function fd(e,t,s,r){return r<=0&&(e=t=s=NaN),new cn(e,t,s,r)}function vO(e){return e instanceof vc||(e=Jr(e)),e?(e=e.rgb(),new cn(e.r,e.g,e.b,e.opacity)):new cn}function rg(e,t,s,r){return arguments.length===1?vO(e):new cn(e,t,s,r??1)}function cn(e,t,s,r){this.r=+e,this.g=+t,this.b=+s,this.opacity=+r}Fg(cn,rg,nj(vc,{brighter(e){return e=e==null?Kd:Math.pow(Kd,e),new cn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ec:Math.pow(ec,e),new cn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new cn(Kr(this.r),Kr(this.g),Kr(this.b),Fd(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:L1,formatHex:L1,formatHex8:bO,formatRgb:z1,toString:z1}));function L1(){return`#${kr(this.r)}${kr(this.g)}${kr(this.b)}`}function bO(){return`#${kr(this.r)}${kr(this.g)}${kr(this.b)}${kr((isNaN(this.opacity)?1:this.opacity)*255)}`}function z1(){const e=Fd(this.opacity);return`${e===1?"rgb(":"rgba("}${Kr(this.r)}, ${Kr(this.g)}, ${Kr(this.b)}${e===1?")":`, ${e})`}`}function Fd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Kr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function kr(e){return e=Kr(e),(e<16?"0":"")+e.toString(16)}function P1(e,t,s,r){return r<=0?e=t=s=NaN:s<=0||s>=1?e=t=NaN:t<=0&&(e=NaN),new qn(e,t,s,r)}function sj(e){if(e instanceof qn)return new qn(e.h,e.s,e.l,e.opacity);if(e instanceof vc||(e=Jr(e)),!e)return new qn;if(e instanceof qn)return e;e=e.rgb();var t=e.r/255,s=e.g/255,r=e.b/255,i=Math.min(t,s,r),l=Math.max(t,s,r),d=NaN,f=l-i,m=(l+i)/2;return f?(t===l?d=(s-r)/f+(s<r)*6:s===l?d=(r-t)/f+2:d=(t-s)/f+4,f/=m<.5?l+i:2-l-i,d*=60):f=m>0&&m<1?0:d,new qn(d,f,m,e.opacity)}function SO(e,t,s,r){return arguments.length===1?sj(e):new qn(e,t,s,r??1)}function qn(e,t,s,r){this.h=+e,this.s=+t,this.l=+s,this.opacity=+r}Fg(qn,SO,nj(vc,{brighter(e){return e=e==null?Kd:Math.pow(Kd,e),new qn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ec:Math.pow(ec,e),new qn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,s=this.l,r=s+(s<.5?s:1-s)*t,i=2*s-r;return new cn(jp(e>=240?e-240:e+120,i,r),jp(e,i,r),jp(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new qn(I1(this.h),hd(this.s),hd(this.l),Fd(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Fd(this.opacity);return`${e===1?"hsl(":"hsla("}${I1(this.h)}, ${hd(this.s)*100}%, ${hd(this.l)*100}%${e===1?")":`, ${e})`}`}}));function I1(e){return e=(e||0)%360,e<0?e+360:e}function hd(e){return Math.max(0,Math.min(1,e||0))}function jp(e,t,s){return(e<60?t+(s-t)*e/60:e<180?s:e<240?t+(s-t)*(240-e)/60:t)*255}const Xg=e=>()=>e;function wO(e,t){return function(s){return e+s*t}}function NO(e,t,s){return e=Math.pow(e,s),t=Math.pow(t,s)-e,s=1/s,function(r){return Math.pow(e+r*t,s)}}function jO(e){return(e=+e)==1?aj:function(t,s){return s-t?NO(t,s,e):Xg(isNaN(t)?s:t)}}function aj(e,t){var s=t-e;return s?wO(e,s):Xg(isNaN(e)?t:e)}const Xd=(function e(t){var s=jO(t);function r(i,l){var d=s((i=rg(i)).r,(l=rg(l)).r),f=s(i.g,l.g),m=s(i.b,l.b),h=aj(i.opacity,l.opacity);return function(v){return i.r=d(v),i.g=f(v),i.b=m(v),i.opacity=h(v),i+""}}return r.gamma=e,r})(1);function EO(e,t){t||(t=[]);var s=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(l){for(i=0;i<s;++i)r[i]=e[i]*(1-l)+t[i]*l;return r}}function CO(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function _O(e,t){var s=t?t.length:0,r=e?Math.min(s,e.length):0,i=new Array(r),l=new Array(s),d;for(d=0;d<r;++d)i[d]=Pl(e[d],t[d]);for(;d<s;++d)l[d]=t[d];return function(f){for(d=0;d<r;++d)l[d]=i[d](f);return l}}function RO(e,t){var s=new Date;return e=+e,t=+t,function(r){return s.setTime(e*(1-r)+t*r),s}}function os(e,t){return e=+e,t=+t,function(s){return e*(1-s)+t*s}}function TO(e,t){var s={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?s[i]=Pl(e[i],t[i]):r[i]=t[i];return function(l){for(i in s)r[i]=s[i](l);return r}}var ig=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ep=new RegExp(ig.source,"g");function AO(e){return function(){return e}}function MO(e){return function(t){return e(t)+""}}function rj(e,t){var s=ig.lastIndex=Ep.lastIndex=0,r,i,l,d=-1,f=[],m=[];for(e=e+"",t=t+"";(r=ig.exec(e))&&(i=Ep.exec(t));)(l=i.index)>s&&(l=t.slice(s,l),f[d]?f[d]+=l:f[++d]=l),(r=r[0])===(i=i[0])?f[d]?f[d]+=i:f[++d]=i:(f[++d]=null,m.push({i:d,x:os(r,i)})),s=Ep.lastIndex;return s<t.length&&(l=t.slice(s),f[d]?f[d]+=l:f[++d]=l),f.length<2?m[0]?MO(m[0].x):AO(t):(t=m.length,function(h){for(var v=0,g;v<t;++v)f[(g=m[v]).i]=g.x(h);return f.join("")})}function Pl(e,t){var s=typeof t,r;return t==null||s==="boolean"?Xg(t):(s==="number"?os:s==="string"?(r=Jr(t))?(t=r,Xd):rj:t instanceof Jr?Xd:t instanceof Date?RO:CO(t)?EO:Array.isArray(t)?_O:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?TO:os)(e,t)}var B1=180/Math.PI,og={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ij(e,t,s,r,i,l){var d,f,m;return(d=Math.sqrt(e*e+t*t))&&(e/=d,t/=d),(m=e*s+t*r)&&(s-=e*m,r-=t*m),(f=Math.sqrt(s*s+r*r))&&(s/=f,r/=f,m/=f),e*r<t*s&&(e=-e,t=-t,m=-m,d=-d),{translateX:i,translateY:l,rotate:Math.atan2(t,e)*B1,skewX:Math.atan(m)*B1,scaleX:d,scaleY:f}}var md;function kO(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?og:ij(t.a,t.b,t.c,t.d,t.e,t.f)}function OO(e){return e==null||(md||(md=document.createElementNS("http://www.w3.org/2000/svg","g")),md.setAttribute("transform",e),!(e=md.transform.baseVal.consolidate()))?og:(e=e.matrix,ij(e.a,e.b,e.c,e.d,e.e,e.f))}function oj(e,t,s,r){function i(h){return h.length?h.pop()+" ":""}function l(h,v,g,y,b,S){if(h!==g||v!==y){var w=b.push("translate(",null,t,null,s);S.push({i:w-4,x:os(h,g)},{i:w-2,x:os(v,y)})}else(g||y)&&b.push("translate("+g+t+y+s)}function d(h,v,g,y){h!==v?(h-v>180?v+=360:v-h>180&&(h+=360),y.push({i:g.push(i(g)+"rotate(",null,r)-2,x:os(h,v)})):v&&g.push(i(g)+"rotate("+v+r)}function f(h,v,g,y){h!==v?y.push({i:g.push(i(g)+"skewX(",null,r)-2,x:os(h,v)}):v&&g.push(i(g)+"skewX("+v+r)}function m(h,v,g,y,b,S){if(h!==g||v!==y){var w=b.push(i(b)+"scale(",null,",",null,")");S.push({i:w-4,x:os(h,g)},{i:w-2,x:os(v,y)})}else(g!==1||y!==1)&&b.push(i(b)+"scale("+g+","+y+")")}return function(h,v){var g=[],y=[];return h=e(h),v=e(v),l(h.translateX,h.translateY,v.translateX,v.translateY,g,y),d(h.rotate,v.rotate,g,y),f(h.skewX,v.skewX,g,y),m(h.scaleX,h.scaleY,v.scaleX,v.scaleY,g,y),h=v=null,function(b){for(var S=-1,w=y.length,N;++S<w;)g[(N=y[S]).i]=N.x(b);return g.join("")}}}var DO=oj(kO,"px, ","px)","deg)"),LO=oj(OO,", ",")",")"),zO=1e-12;function H1(e){return((e=Math.exp(e))+1/e)/2}function PO(e){return((e=Math.exp(e))-1/e)/2}function IO(e){return((e=Math.exp(2*e))-1)/(e+1)}const Td=(function e(t,s,r){function i(l,d){var f=l[0],m=l[1],h=l[2],v=d[0],g=d[1],y=d[2],b=v-f,S=g-m,w=b*b+S*S,N,C;if(w<zO)C=Math.log(y/h)/t,N=function(L){return[f+L*b,m+L*S,h*Math.exp(t*L*C)]};else{var T=Math.sqrt(w),_=(y*y-h*h+r*w)/(2*h*s*T),R=(y*y-h*h-r*w)/(2*y*s*T),O=Math.log(Math.sqrt(_*_+1)-_),B=Math.log(Math.sqrt(R*R+1)-R);C=(B-O)/t,N=function(L){var M=L*C,I=H1(O),H=h/(s*T)*(I*IO(t*M+O)-PO(O));return[f+H*b,m+H*S,h*I/H1(t*M+O)]}}return N.duration=C*1e3*t/Math.SQRT2,N}return i.rho=function(l){var d=Math.max(.001,+l),f=d*d,m=f*f;return e(d,f,m)},i})(Math.SQRT2,2,4);var vo=0,Dl=0,Al=0,lj=1e3,Zd,Ll,Wd=0,ei=0,xf=0,nc=typeof performance=="object"&&performance.now?performance:Date,cj=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Zg(){return ei||(cj(BO),ei=nc.now()+xf)}function BO(){ei=0}function Jd(){this._call=this._time=this._next=null}Jd.prototype=uj.prototype={constructor:Jd,restart:function(e,t,s){if(typeof e!="function")throw new TypeError("callback is not a function");s=(s==null?Zg():+s)+(t==null?0:+t),!this._next&&Ll!==this&&(Ll?Ll._next=this:Zd=this,Ll=this),this._call=e,this._time=s,lg()},stop:function(){this._call&&(this._call=null,this._time=1/0,lg())}};function uj(e,t,s){var r=new Jd;return r.restart(e,t,s),r}function HO(){Zg(),++vo;for(var e=Zd,t;e;)(t=ei-e._time)>=0&&e._call.call(void 0,t),e=e._next;--vo}function U1(){ei=(Wd=nc.now())+xf,vo=Dl=0;try{HO()}finally{vo=0,$O(),ei=0}}function UO(){var e=nc.now(),t=e-Wd;t>lj&&(xf-=t,Wd=e)}function $O(){for(var e,t=Zd,s,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(s=t._next,t._next=null,t=e?e._next=s:Zd=s);Ll=e,lg(r)}function lg(e){if(!vo){Dl&&(Dl=clearTimeout(Dl));var t=e-ei;t>24?(e<1/0&&(Dl=setTimeout(U1,e-nc.now()-xf)),Al&&(Al=clearInterval(Al))):(Al||(Wd=nc.now(),Al=setInterval(UO,lj)),vo=1,cj(U1))}}function $1(e,t,s){var r=new Jd;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,s),r}var qO=pf("start","end","cancel","interrupt"),VO=[],dj=0,q1=1,cg=2,Ad=3,V1=4,ug=5,Md=6;function yf(e,t,s,r,i,l){var d=e.__transition;if(!d)e.__transition={};else if(s in d)return;GO(e,s,{name:t,index:r,group:i,on:qO,tween:VO,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:dj})}function Wg(e,t){var s=Kn(e,t);if(s.state>dj)throw new Error("too late; already scheduled");return s}function ms(e,t){var s=Kn(e,t);if(s.state>Ad)throw new Error("too late; already running");return s}function Kn(e,t){var s=e.__transition;if(!s||!(s=s[t]))throw new Error("transition not found");return s}function GO(e,t,s){var r=e.__transition,i;r[t]=s,s.timer=uj(l,0,s.time);function l(h){s.state=q1,s.timer.restart(d,s.delay,s.time),s.delay<=h&&d(h-s.delay)}function d(h){var v,g,y,b;if(s.state!==q1)return m();for(v in r)if(b=r[v],b.name===s.name){if(b.state===Ad)return $1(d);b.state===V1?(b.state=Md,b.timer.stop(),b.on.call("interrupt",e,e.__data__,b.index,b.group),delete r[v]):+v<t&&(b.state=Md,b.timer.stop(),b.on.call("cancel",e,e.__data__,b.index,b.group),delete r[v])}if($1(function(){s.state===Ad&&(s.state=V1,s.timer.restart(f,s.delay,s.time),f(h))}),s.state=cg,s.on.call("start",e,e.__data__,s.index,s.group),s.state===cg){for(s.state=Ad,i=new Array(y=s.tween.length),v=0,g=-1;v<y;++v)(b=s.tween[v].value.call(e,e.__data__,s.index,s.group))&&(i[++g]=b);i.length=g+1}}function f(h){for(var v=h<s.duration?s.ease.call(null,h/s.duration):(s.timer.restart(m),s.state=ug,1),g=-1,y=i.length;++g<y;)i[g].call(e,v);s.state===ug&&(s.on.call("end",e,e.__data__,s.index,s.group),m())}function m(){s.state=Md,s.timer.stop(),delete r[t];for(var h in r)return;delete e.__transition}}function kd(e,t){var s=e.__transition,r,i,l=!0,d;if(s){t=t==null?null:t+"";for(d in s){if((r=s[d]).name!==t){l=!1;continue}i=r.state>cg&&r.state<ug,r.state=Md,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete s[d]}l&&delete e.__transition}}function YO(e){return this.each(function(){kd(this,e)})}function QO(e,t){var s,r;return function(){var i=ms(this,e),l=i.tween;if(l!==s){r=s=l;for(var d=0,f=r.length;d<f;++d)if(r[d].name===t){r=r.slice(),r.splice(d,1);break}}i.tween=r}}function KO(e,t,s){var r,i;if(typeof s!="function")throw new Error;return function(){var l=ms(this,e),d=l.tween;if(d!==r){i=(r=d).slice();for(var f={name:t,value:s},m=0,h=i.length;m<h;++m)if(i[m].name===t){i[m]=f;break}m===h&&i.push(f)}l.tween=i}}function FO(e,t){var s=this._id;if(e+="",arguments.length<2){for(var r=Kn(this.node(),s).tween,i=0,l=r.length,d;i<l;++i)if((d=r[i]).name===e)return d.value;return null}return this.each((t==null?QO:KO)(s,e,t))}function Jg(e,t,s){var r=e._id;return e.each(function(){var i=ms(this,r);(i.value||(i.value={}))[t]=s.apply(this,arguments)}),function(i){return Kn(i,r).value[t]}}function fj(e,t){var s;return(typeof t=="number"?os:t instanceof Jr?Xd:(s=Jr(t))?(t=s,Xd):rj)(e,t)}function XO(e){return function(){this.removeAttribute(e)}}function ZO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function WO(e,t,s){var r,i=s+"",l;return function(){var d=this.getAttribute(e);return d===i?null:d===r?l:l=t(r=d,s)}}function JO(e,t,s){var r,i=s+"",l;return function(){var d=this.getAttributeNS(e.space,e.local);return d===i?null:d===r?l:l=t(r=d,s)}}function eD(e,t,s){var r,i,l;return function(){var d,f=s(this),m;return f==null?void this.removeAttribute(e):(d=this.getAttribute(e),m=f+"",d===m?null:d===r&&m===i?l:(i=m,l=t(r=d,f)))}}function tD(e,t,s){var r,i,l;return function(){var d,f=s(this),m;return f==null?void this.removeAttributeNS(e.space,e.local):(d=this.getAttributeNS(e.space,e.local),m=f+"",d===m?null:d===r&&m===i?l:(i=m,l=t(r=d,f)))}}function nD(e,t){var s=gf(e),r=s==="transform"?LO:fj;return this.attrTween(e,typeof t=="function"?(s.local?tD:eD)(s,r,Jg(this,"attr."+e,t)):t==null?(s.local?ZO:XO)(s):(s.local?JO:WO)(s,r,t))}function sD(e,t){return function(s){this.setAttribute(e,t.call(this,s))}}function aD(e,t){return function(s){this.setAttributeNS(e.space,e.local,t.call(this,s))}}function rD(e,t){var s,r;function i(){var l=t.apply(this,arguments);return l!==r&&(s=(r=l)&&aD(e,l)),s}return i._value=t,i}function iD(e,t){var s,r;function i(){var l=t.apply(this,arguments);return l!==r&&(s=(r=l)&&sD(e,l)),s}return i._value=t,i}function oD(e,t){var s="attr."+e;if(arguments.length<2)return(s=this.tween(s))&&s._value;if(t==null)return this.tween(s,null);if(typeof t!="function")throw new Error;var r=gf(e);return this.tween(s,(r.local?rD:iD)(r,t))}function lD(e,t){return function(){Wg(this,e).delay=+t.apply(this,arguments)}}function cD(e,t){return t=+t,function(){Wg(this,e).delay=t}}function uD(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?lD:cD)(t,e)):Kn(this.node(),t).delay}function dD(e,t){return function(){ms(this,e).duration=+t.apply(this,arguments)}}function fD(e,t){return t=+t,function(){ms(this,e).duration=t}}function hD(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?dD:fD)(t,e)):Kn(this.node(),t).duration}function mD(e,t){if(typeof t!="function")throw new Error;return function(){ms(this,e).ease=t}}function pD(e){var t=this._id;return arguments.length?this.each(mD(t,e)):Kn(this.node(),t).ease}function gD(e,t){return function(){var s=t.apply(this,arguments);if(typeof s!="function")throw new Error;ms(this,e).ease=s}}function xD(e){if(typeof e!="function")throw new Error;return this.each(gD(this._id,e))}function yD(e){typeof e!="function"&&(e=qN(e));for(var t=this._groups,s=t.length,r=new Array(s),i=0;i<s;++i)for(var l=t[i],d=l.length,f=r[i]=[],m,h=0;h<d;++h)(m=l[h])&&e.call(m,m.__data__,h,l)&&f.push(m);return new Fs(r,this._parents,this._name,this._id)}function vD(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,s=e._groups,r=t.length,i=s.length,l=Math.min(r,i),d=new Array(r),f=0;f<l;++f)for(var m=t[f],h=s[f],v=m.length,g=d[f]=new Array(v),y,b=0;b<v;++b)(y=m[b]||h[b])&&(g[b]=y);for(;f<r;++f)d[f]=t[f];return new Fs(d,this._parents,this._name,this._id)}function bD(e){return(e+"").trim().split(/^|\s+/).every(function(t){var s=t.indexOf(".");return s>=0&&(t=t.slice(0,s)),!t||t==="start"})}function SD(e,t,s){var r,i,l=bD(t)?Wg:ms;return function(){var d=l(this,e),f=d.on;f!==r&&(i=(r=f).copy()).on(t,s),d.on=i}}function wD(e,t){var s=this._id;return arguments.length<2?Kn(this.node(),s).on.on(e):this.each(SD(s,e,t))}function ND(e){return function(){var t=this.parentNode;for(var s in this.__transition)if(+s!==e)return;t&&t.removeChild(this)}}function jD(){return this.on("end.remove",ND(this._id))}function ED(e){var t=this._name,s=this._id;typeof e!="function"&&(e=Qg(e));for(var r=this._groups,i=r.length,l=new Array(i),d=0;d<i;++d)for(var f=r[d],m=f.length,h=l[d]=new Array(m),v,g,y=0;y<m;++y)(v=f[y])&&(g=e.call(v,v.__data__,y,f))&&("__data__"in v&&(g.__data__=v.__data__),h[y]=g,yf(h[y],t,s,y,h,Kn(v,s)));return new Fs(l,this._parents,t,s)}function CD(e){var t=this._name,s=this._id;typeof e!="function"&&(e=$N(e));for(var r=this._groups,i=r.length,l=[],d=[],f=0;f<i;++f)for(var m=r[f],h=m.length,v,g=0;g<h;++g)if(v=m[g]){for(var y=e.call(v,v.__data__,g,m),b,S=Kn(v,s),w=0,N=y.length;w<N;++w)(b=y[w])&&yf(b,t,s,w,y,S);l.push(y),d.push(v)}return new Fs(l,d,t,s)}var _D=yc.prototype.constructor;function RD(){return new _D(this._groups,this._parents)}function TD(e,t){var s,r,i;return function(){var l=yo(this,e),d=(this.style.removeProperty(e),yo(this,e));return l===d?null:l===s&&d===r?i:i=t(s=l,r=d)}}function hj(e){return function(){this.style.removeProperty(e)}}function AD(e,t,s){var r,i=s+"",l;return function(){var d=yo(this,e);return d===i?null:d===r?l:l=t(r=d,s)}}function MD(e,t,s){var r,i,l;return function(){var d=yo(this,e),f=s(this),m=f+"";return f==null&&(m=f=(this.style.removeProperty(e),yo(this,e))),d===m?null:d===r&&m===i?l:(i=m,l=t(r=d,f))}}function kD(e,t){var s,r,i,l="style."+t,d="end."+l,f;return function(){var m=ms(this,e),h=m.on,v=m.value[l]==null?f||(f=hj(t)):void 0;(h!==s||i!==v)&&(r=(s=h).copy()).on(d,i=v),m.on=r}}function OD(e,t,s){var r=(e+="")=="transform"?DO:fj;return t==null?this.styleTween(e,TD(e,r)).on("end.style."+e,hj(e)):typeof t=="function"?this.styleTween(e,MD(e,r,Jg(this,"style."+e,t))).each(kD(this._id,e)):this.styleTween(e,AD(e,r,t),s).on("end.style."+e,null)}function DD(e,t,s){return function(r){this.style.setProperty(e,t.call(this,r),s)}}function LD(e,t,s){var r,i;function l(){var d=t.apply(this,arguments);return d!==i&&(r=(i=d)&&DD(e,d,s)),r}return l._value=t,l}function zD(e,t,s){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,LD(e,t,s??""))}function PD(e){return function(){this.textContent=e}}function ID(e){return function(){var t=e(this);this.textContent=t??""}}function BD(e){return this.tween("text",typeof e=="function"?ID(Jg(this,"text",e)):PD(e==null?"":e+""))}function HD(e){return function(t){this.textContent=e.call(this,t)}}function UD(e){var t,s;function r(){var i=e.apply(this,arguments);return i!==s&&(t=(s=i)&&HD(i)),t}return r._value=e,r}function $D(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,UD(e))}function qD(){for(var e=this._name,t=this._id,s=mj(),r=this._groups,i=r.length,l=0;l<i;++l)for(var d=r[l],f=d.length,m,h=0;h<f;++h)if(m=d[h]){var v=Kn(m,t);yf(m,e,s,h,d,{time:v.time+v.delay+v.duration,delay:0,duration:v.duration,ease:v.ease})}return new Fs(r,this._parents,e,s)}function VD(){var e,t,s=this,r=s._id,i=s.size();return new Promise(function(l,d){var f={value:d},m={value:function(){--i===0&&l()}};s.each(function(){var h=ms(this,r),v=h.on;v!==e&&(t=(e=v).copy(),t._.cancel.push(f),t._.interrupt.push(f),t._.end.push(m)),h.on=t}),i===0&&l()})}var GD=0;function Fs(e,t,s,r){this._groups=e,this._parents=t,this._name=s,this._id=r}function mj(){return++GD}var Is=yc.prototype;Fs.prototype={constructor:Fs,select:ED,selectAll:CD,selectChild:Is.selectChild,selectChildren:Is.selectChildren,filter:yD,merge:vD,selection:RD,transition:qD,call:Is.call,nodes:Is.nodes,node:Is.node,size:Is.size,empty:Is.empty,each:Is.each,on:wD,attr:nD,attrTween:oD,style:OD,styleTween:zD,text:BD,textTween:$D,remove:jD,tween:FO,delay:uD,duration:hD,ease:pD,easeVarying:xD,end:VD,[Symbol.iterator]:Is[Symbol.iterator]};function YD(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var QD={time:null,delay:0,duration:250,ease:YD};function KD(e,t){for(var s;!(s=e.__transition)||!(s=s[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return s}function FD(e){var t,s;e instanceof Fs?(t=e._id,e=e._name):(t=mj(),(s=QD).time=Zg(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,l=0;l<i;++l)for(var d=r[l],f=d.length,m,h=0;h<f;++h)(m=d[h])&&yf(m,e,t,h,d,s||KD(m,t));return new Fs(r,this._parents,e,t)}yc.prototype.interrupt=YO;yc.prototype.transition=FD;const pd=e=>()=>e;function XD(e,{sourceEvent:t,target:s,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:s,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Ys(e,t,s){this.k=e,this.x=t,this.y=s}Ys.prototype={constructor:Ys,scale:function(e){return e===1?this:new Ys(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ys(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var vf=new Ys(1,0,0);pj.prototype=Ys.prototype;function pj(e){for(;!e.__zoom;)if(!(e=e.parentNode))return vf;return e.__zoom}function Cp(e){e.stopImmediatePropagation()}function Ml(e){e.preventDefault(),e.stopImmediatePropagation()}function ZD(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function WD(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function G1(){return this.__zoom||vf}function JD(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function eL(){return navigator.maxTouchPoints||"ontouchstart"in this}function tL(e,t,s){var r=e.invertX(t[0][0])-s[0][0],i=e.invertX(t[1][0])-s[1][0],l=e.invertY(t[0][1])-s[0][1],d=e.invertY(t[1][1])-s[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),d>l?(l+d)/2:Math.min(0,l)||Math.max(0,d))}function gj(){var e=ZD,t=WD,s=tL,r=JD,i=eL,l=[0,1/0],d=[[-1/0,-1/0],[1/0,1/0]],f=250,m=Td,h=pf("start","zoom","end"),v,g,y,b=500,S=150,w=0,N=10;function C(U){U.property("__zoom",G1).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",H).filter(i).on("touchstart.zoom",D).on("touchmove.zoom",Y).on("touchend.zoom touchcancel.zoom",K).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}C.transform=function(U,q,A,$){var z=U.selection?U.selection():U;z.property("__zoom",G1),U!==z?O(U,q,A,$):z.interrupt().each(function(){B(this,arguments).event($).start().zoom(null,typeof q=="function"?q.apply(this,arguments):q).end()})},C.scaleBy=function(U,q,A,$){C.scaleTo(U,function(){var z=this.__zoom.k,G=typeof q=="function"?q.apply(this,arguments):q;return z*G},A,$)},C.scaleTo=function(U,q,A,$){C.transform(U,function(){var z=t.apply(this,arguments),G=this.__zoom,V=A==null?R(z):typeof A=="function"?A.apply(this,arguments):A,P=G.invert(V),Q=typeof q=="function"?q.apply(this,arguments):q;return s(_(T(G,Q),V,P),z,d)},A,$)},C.translateBy=function(U,q,A,$){C.transform(U,function(){return s(this.__zoom.translate(typeof q=="function"?q.apply(this,arguments):q,typeof A=="function"?A.apply(this,arguments):A),t.apply(this,arguments),d)},null,$)},C.translateTo=function(U,q,A,$,z){C.transform(U,function(){var G=t.apply(this,arguments),V=this.__zoom,P=$==null?R(G):typeof $=="function"?$.apply(this,arguments):$;return s(vf.translate(P[0],P[1]).scale(V.k).translate(typeof q=="function"?-q.apply(this,arguments):-q,typeof A=="function"?-A.apply(this,arguments):-A),G,d)},$,z)};function T(U,q){return q=Math.max(l[0],Math.min(l[1],q)),q===U.k?U:new Ys(q,U.x,U.y)}function _(U,q,A){var $=q[0]-A[0]*U.k,z=q[1]-A[1]*U.k;return $===U.x&&z===U.y?U:new Ys(U.k,$,z)}function R(U){return[(+U[0][0]+ +U[1][0])/2,(+U[0][1]+ +U[1][1])/2]}function O(U,q,A,$){U.on("start.zoom",function(){B(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){B(this,arguments).event($).end()}).tween("zoom",function(){var z=this,G=arguments,V=B(z,G).event($),P=t.apply(z,G),Q=A==null?R(P):typeof A=="function"?A.apply(z,G):A,ee=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),se=z.__zoom,oe=typeof q=="function"?q.apply(z,G):q,ce=m(se.invert(Q).concat(ee/se.k),oe.invert(Q).concat(ee/oe.k));return function(fe){if(fe===1)fe=oe;else{var ue=ce(fe),he=ee/ue[2];fe=new Ys(he,Q[0]-ue[0]*he,Q[1]-ue[1]*he)}V.zoom(null,fe)}})}function B(U,q,A){return!A&&U.__zooming||new L(U,q)}function L(U,q){this.that=U,this.args=q,this.active=0,this.sourceEvent=null,this.extent=t.apply(U,q),this.taps=0}L.prototype={event:function(U){return U&&(this.sourceEvent=U),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(U,q){return this.mouse&&U!=="mouse"&&(this.mouse[1]=q.invert(this.mouse[0])),this.touch0&&U!=="touch"&&(this.touch0[1]=q.invert(this.touch0[0])),this.touch1&&U!=="touch"&&(this.touch1[1]=q.invert(this.touch1[0])),this.that.__zoom=q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(U){var q=Sn(this.that).datum();h.call(U,this.that,new XD(U,{sourceEvent:this.sourceEvent,target:C,transform:this.that.__zoom,dispatch:h}),q)}};function M(U,...q){if(!e.apply(this,arguments))return;var A=B(this,q).event(U),$=this.__zoom,z=Math.max(l[0],Math.min(l[1],$.k*Math.pow(2,r.apply(this,arguments)))),G=$n(U);if(A.wheel)(A.mouse[0][0]!==G[0]||A.mouse[0][1]!==G[1])&&(A.mouse[1]=$.invert(A.mouse[0]=G)),clearTimeout(A.wheel);else{if($.k===z)return;A.mouse=[G,$.invert(G)],kd(this),A.start()}Ml(U),A.wheel=setTimeout(V,S),A.zoom("mouse",s(_(T($,z),A.mouse[0],A.mouse[1]),A.extent,d));function V(){A.wheel=null,A.end()}}function I(U,...q){if(y||!e.apply(this,arguments))return;var A=U.currentTarget,$=B(this,q,!0).event(U),z=Sn(U.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",ee,!0),G=$n(U,A),V=U.clientX,P=U.clientY;JN(U.view),Cp(U),$.mouse=[G,this.__zoom.invert(G)],kd(this),$.start();function Q(se){if(Ml(se),!$.moved){var oe=se.clientX-V,ce=se.clientY-P;$.moved=oe*oe+ce*ce>w}$.event(se).zoom("mouse",s(_($.that.__zoom,$.mouse[0]=$n(se,A),$.mouse[1]),$.extent,d))}function ee(se){z.on("mousemove.zoom mouseup.zoom",null),ej(se.view,$.moved),Ml(se),$.event(se).end()}}function H(U,...q){if(e.apply(this,arguments)){var A=this.__zoom,$=$n(U.changedTouches?U.changedTouches[0]:U,this),z=A.invert($),G=A.k*(U.shiftKey?.5:2),V=s(_(T(A,G),$,z),t.apply(this,q),d);Ml(U),f>0?Sn(this).transition().duration(f).call(O,V,$,U):Sn(this).call(C.transform,V,$,U)}}function D(U,...q){if(e.apply(this,arguments)){var A=U.touches,$=A.length,z=B(this,q,U.changedTouches.length===$).event(U),G,V,P,Q;for(Cp(U),V=0;V<$;++V)P=A[V],Q=$n(P,this),Q=[Q,this.__zoom.invert(Q),P.identifier],z.touch0?!z.touch1&&z.touch0[2]!==Q[2]&&(z.touch1=Q,z.taps=0):(z.touch0=Q,G=!0,z.taps=1+!!v);v&&(v=clearTimeout(v)),G&&(z.taps<2&&(g=Q[0],v=setTimeout(function(){v=null},b)),kd(this),z.start())}}function Y(U,...q){if(this.__zooming){var A=B(this,q).event(U),$=U.changedTouches,z=$.length,G,V,P,Q;for(Ml(U),G=0;G<z;++G)V=$[G],P=$n(V,this),A.touch0&&A.touch0[2]===V.identifier?A.touch0[0]=P:A.touch1&&A.touch1[2]===V.identifier&&(A.touch1[0]=P);if(V=A.that.__zoom,A.touch1){var ee=A.touch0[0],se=A.touch0[1],oe=A.touch1[0],ce=A.touch1[1],fe=(fe=oe[0]-ee[0])*fe+(fe=oe[1]-ee[1])*fe,ue=(ue=ce[0]-se[0])*ue+(ue=ce[1]-se[1])*ue;V=T(V,Math.sqrt(fe/ue)),P=[(ee[0]+oe[0])/2,(ee[1]+oe[1])/2],Q=[(se[0]+ce[0])/2,(se[1]+ce[1])/2]}else if(A.touch0)P=A.touch0[0],Q=A.touch0[1];else return;A.zoom("touch",s(_(V,P,Q),A.extent,d))}}function K(U,...q){if(this.__zooming){var A=B(this,q).event(U),$=U.changedTouches,z=$.length,G,V;for(Cp(U),y&&clearTimeout(y),y=setTimeout(function(){y=null},b),G=0;G<z;++G)V=$[G],A.touch0&&A.touch0[2]===V.identifier?delete A.touch0:A.touch1&&A.touch1[2]===V.identifier&&delete A.touch1;if(A.touch1&&!A.touch0&&(A.touch0=A.touch1,delete A.touch1),A.touch0)A.touch0[1]=this.__zoom.invert(A.touch0[0]);else if(A.end(),A.taps===2&&(V=$n(V,this),Math.hypot(g[0]-V[0],g[1]-V[1])<N)){var P=Sn(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return C.wheelDelta=function(U){return arguments.length?(r=typeof U=="function"?U:pd(+U),C):r},C.filter=function(U){return arguments.length?(e=typeof U=="function"?U:pd(!!U),C):e},C.touchable=function(U){return arguments.length?(i=typeof U=="function"?U:pd(!!U),C):i},C.extent=function(U){return arguments.length?(t=typeof U=="function"?U:pd([[+U[0][0],+U[0][1]],[+U[1][0],+U[1][1]]]),C):t},C.scaleExtent=function(U){return arguments.length?(l[0]=+U[0],l[1]=+U[1],C):[l[0],l[1]]},C.translateExtent=function(U){return arguments.length?(d[0][0]=+U[0][0],d[1][0]=+U[1][0],d[0][1]=+U[0][1],d[1][1]=+U[1][1],C):[[d[0][0],d[0][1]],[d[1][0],d[1][1]]]},C.constrain=function(U){return arguments.length?(s=U,C):s},C.duration=function(U){return arguments.length?(f=+U,C):f},C.interpolate=function(U){return arguments.length?(m=U,C):m},C.on=function(){var U=h.on.apply(h,arguments);return U===h?C:U},C.clickDistance=function(U){return arguments.length?(w=(U=+U)*U,C):Math.sqrt(w)},C.tapDistance=function(U){return arguments.length?(N=+U,C):N},C}const hs={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:s,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?s:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},sc=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],xj=["Enter"," ","Escape"],yj={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:s})=>`Moved selected node ${e}. New position, x: ${t}, y: ${s}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var bo;(function(e){e.Strict="strict",e.Loose="loose"})(bo||(bo={}));var Fr;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Fr||(Fr={}));var ac;(function(e){e.Partial="partial",e.Full="full"})(ac||(ac={}));const vj={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Da;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Da||(Da={}));var rc;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(rc||(rc={}));var we;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(we||(we={}));const Y1={[we.Left]:we.Right,[we.Right]:we.Left,[we.Top]:we.Bottom,[we.Bottom]:we.Top};function bj(e){return e===null?null:e?"valid":"invalid"}const Sj=e=>"id"in e&&"source"in e&&"target"in e,nL=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),e0=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),bc=(e,t=[0,0])=>{const{width:s,height:r}=Zs(e),i=e.origin??t,l=s*i[0],d=r*i[1];return{x:e.position.x-l,y:e.position.y-d}},sL=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const s=e.reduce((r,i)=>{const l=typeof i=="string";let d=!t.nodeLookup&&!l?i:void 0;t.nodeLookup&&(d=l?t.nodeLookup.get(i):e0(i)?i:t.nodeLookup.get(i.id));const f=d?ef(d,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return bf(r,f)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Sf(s)},Sc=(e,t={})=>{let s={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(s=bf(s,ef(i)),r=!0)}),r?Sf(s):{x:0,y:0,width:0,height:0}},t0=(e,t,[s,r,i]=[0,0,1],l=!1,d=!1)=>{const f={...Nc(t,[s,r,i]),width:t.width/i,height:t.height/i},m=[];for(const h of e.values()){const{measured:v,selectable:g=!0,hidden:y=!1}=h;if(d&&!g||y)continue;const b=v.width??h.width??h.initialWidth??null,S=v.height??h.height??h.initialHeight??null,w=ic(f,wo(h)),N=(b??0)*(S??0),C=l&&w>0;(!h.internals.handleBounds||C||w>=N||h.dragging)&&m.push(h)}return m},aL=(e,t)=>{const s=new Set;return e.forEach(r=>{s.add(r.id)}),t.filter(r=>s.has(r.source)||s.has(r.target))};function rL(e,t){const s=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!r||r.has(i.id))&&s.set(i.id,i)}),s}async function iL({nodes:e,width:t,height:s,panZoom:r,minZoom:i,maxZoom:l},d){if(e.size===0)return Promise.resolve(!0);const f=rL(e,d),m=Sc(f),h=n0(m,t,s,(d==null?void 0:d.minZoom)??i,(d==null?void 0:d.maxZoom)??l,(d==null?void 0:d.padding)??.1);return await r.setViewport(h,{duration:d==null?void 0:d.duration,ease:d==null?void 0:d.ease,interpolate:d==null?void 0:d.interpolate}),Promise.resolve(!0)}function wj({nodeId:e,nextPosition:t,nodeLookup:s,nodeOrigin:r=[0,0],nodeExtent:i,onError:l}){const d=s.get(e),f=d.parentId?s.get(d.parentId):void 0,{x:m,y:h}=f?f.internals.positionAbsolute:{x:0,y:0},v=d.origin??r;let g=d.extent||i;if(d.extent==="parent"&&!d.expandParent)if(!f)l==null||l("005",hs.error005());else{const b=f.measured.width,S=f.measured.height;b&&S&&(g=[[m,h],[m+b,h+S]])}else f&&No(d.extent)&&(g=[[d.extent[0][0]+m,d.extent[0][1]+h],[d.extent[1][0]+m,d.extent[1][1]+h]]);const y=No(g)?ti(t,g,d.measured):t;return(d.measured.width===void 0||d.measured.height===void 0)&&(l==null||l("015",hs.error015())),{position:{x:y.x-m+(d.measured.width??0)*v[0],y:y.y-h+(d.measured.height??0)*v[1]},positionAbsolute:y}}async function oL({nodesToRemove:e=[],edgesToRemove:t=[],nodes:s,edges:r,onBeforeDelete:i}){const l=new Set(e.map(y=>y.id)),d=[];for(const y of s){if(y.deletable===!1)continue;const b=l.has(y.id),S=!b&&y.parentId&&d.find(w=>w.id===y.parentId);(b||S)&&d.push(y)}const f=new Set(t.map(y=>y.id)),m=r.filter(y=>y.deletable!==!1),v=aL(d,m);for(const y of m)f.has(y.id)&&!v.find(S=>S.id===y.id)&&v.push(y);if(!i)return{edges:v,nodes:d};const g=await i({nodes:d,edges:v});return typeof g=="boolean"?g?{edges:v,nodes:d}:{edges:[],nodes:[]}:g}const So=(e,t=0,s=1)=>Math.min(Math.max(e,t),s),ti=(e={x:0,y:0},t,s)=>({x:So(e.x,t[0][0],t[1][0]-((s==null?void 0:s.width)??0)),y:So(e.y,t[0][1],t[1][1]-((s==null?void 0:s.height)??0))});function Nj(e,t,s){const{width:r,height:i}=Zs(s),{x:l,y:d}=s.internals.positionAbsolute;return ti(e,[[l,d],[l+r,d+i]],t)}const Q1=(e,t,s)=>e<t?So(Math.abs(e-t),1,t)/t:e>s?-So(Math.abs(e-s),1,t)/t:0,jj=(e,t,s=15,r=40)=>{const i=Q1(e.x,r,t.width-r)*s,l=Q1(e.y,r,t.height-r)*s;return[i,l]},bf=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),dg=({x:e,y:t,width:s,height:r})=>({x:e,y:t,x2:e+s,y2:t+r}),Sf=({x:e,y:t,x2:s,y2:r})=>({x:e,y:t,width:s-e,height:r-t}),wo=(e,t=[0,0])=>{var i,l;const{x:s,y:r}=e0(e)?e.internals.positionAbsolute:bc(e,t);return{x:s,y:r,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0}},ef=(e,t=[0,0])=>{var i,l;const{x:s,y:r}=e0(e)?e.internals.positionAbsolute:bc(e,t);return{x:s,y:r,x2:s+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:r+(((l=e.measured)==null?void 0:l.height)??e.height??e.initialHeight??0)}},Ej=(e,t)=>Sf(bf(dg(e),dg(t))),ic=(e,t)=>{const s=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(s*r)},K1=e=>Vn(e.width)&&Vn(e.height)&&Vn(e.x)&&Vn(e.y),Vn=e=>!isNaN(e)&&isFinite(e),lL=(e,t)=>{},wc=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Nc=({x:e,y:t},[s,r,i],l=!1,d=[1,1])=>{const f={x:(e-s)/i,y:(t-r)/i};return l?wc(f,d):f},tf=({x:e,y:t},[s,r,i])=>({x:e*i+s,y:t*i+r});function Fi(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const s=parseFloat(e);if(!Number.isNaN(s))return Math.floor(s)}if(typeof e=="string"&&e.endsWith("%")){const s=parseFloat(e);if(!Number.isNaN(s))return Math.floor(t*s*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function cL(e,t,s){if(typeof e=="string"||typeof e=="number"){const r=Fi(e,s),i=Fi(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=Fi(e.top??e.y??0,s),i=Fi(e.bottom??e.y??0,s),l=Fi(e.left??e.x??0,t),d=Fi(e.right??e.x??0,t);return{top:r,right:d,bottom:i,left:l,x:l+d,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function uL(e,t,s,r,i,l){const{x:d,y:f}=tf(e,[t,s,r]),{x:m,y:h}=tf({x:e.x+e.width,y:e.y+e.height},[t,s,r]),v=i-m,g=l-h;return{left:Math.floor(d),top:Math.floor(f),right:Math.floor(v),bottom:Math.floor(g)}}const n0=(e,t,s,r,i,l)=>{const d=cL(l,t,s),f=(t-d.x)/e.width,m=(s-d.y)/e.height,h=Math.min(f,m),v=So(h,r,i),g=e.x+e.width/2,y=e.y+e.height/2,b=t/2-g*v,S=s/2-y*v,w=uL(e,b,S,v,t,s),N={left:Math.min(w.left-d.left,0),top:Math.min(w.top-d.top,0),right:Math.min(w.right-d.right,0),bottom:Math.min(w.bottom-d.bottom,0)};return{x:b-N.left+N.right,y:S-N.top+N.bottom,zoom:v}},oc=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function No(e){return e!=null&&e!=="parent"}function Zs(e){var t,s;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}}function Cj(e){var t,s;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight)!==void 0}function _j(e,t={width:0,height:0},s,r,i){const l={...e},d=r.get(s);if(d){const f=d.origin||i;l.x+=d.internals.positionAbsolute.x-(t.width??0)*f[0],l.y+=d.internals.positionAbsolute.y-(t.height??0)*f[1]}return l}function F1(e,t){if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0}function dL(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function fL(e){return{...yj,...e||{}}}function Il(e,{snapGrid:t=[0,0],snapToGrid:s=!1,transform:r,containerBounds:i}){const{x:l,y:d}=Gn(e),f=Nc({x:l-((i==null?void 0:i.left)??0),y:d-((i==null?void 0:i.top)??0)},r),{x:m,y:h}=s?wc(f,t):f;return{xSnapped:m,ySnapped:h,...f}}const s0=e=>({width:e.offsetWidth,height:e.offsetHeight}),Rj=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},hL=["INPUT","SELECT","TEXTAREA"];function Tj(e){var r,i;const t=((i=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:hL.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Aj=e=>"clientX"in e,Gn=(e,t)=>{var l,d;const s=Aj(e),r=s?e.clientX:(l=e.touches)==null?void 0:l[0].clientX,i=s?e.clientY:(d=e.touches)==null?void 0:d[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},X1=(e,t,s,r,i)=>{const l=t.querySelectorAll(`.${e}`);return!l||!l.length?null:Array.from(l).map(d=>{const f=d.getBoundingClientRect();return{id:d.getAttribute("data-handleid"),type:e,nodeId:i,position:d.getAttribute("data-handlepos"),x:(f.left-s.left)/r,y:(f.top-s.top)/r,...s0(d)}})};function Mj({sourceX:e,sourceY:t,targetX:s,targetY:r,sourceControlX:i,sourceControlY:l,targetControlX:d,targetControlY:f}){const m=e*.125+i*.375+d*.375+s*.125,h=t*.125+l*.375+f*.375+r*.125,v=Math.abs(m-e),g=Math.abs(h-t);return[m,h,v,g]}function gd(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Z1({pos:e,x1:t,y1:s,x2:r,y2:i,c:l}){switch(e){case we.Left:return[t-gd(t-r,l),s];case we.Right:return[t+gd(r-t,l),s];case we.Top:return[t,s-gd(s-i,l)];case we.Bottom:return[t,s+gd(i-s,l)]}}function kj({sourceX:e,sourceY:t,sourcePosition:s=we.Bottom,targetX:r,targetY:i,targetPosition:l=we.Top,curvature:d=.25}){const[f,m]=Z1({pos:s,x1:e,y1:t,x2:r,y2:i,c:d}),[h,v]=Z1({pos:l,x1:r,y1:i,x2:e,y2:t,c:d}),[g,y,b,S]=Mj({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:f,sourceControlY:m,targetControlX:h,targetControlY:v});return[`M${e},${t} C${f},${m} ${h},${v} ${r},${i}`,g,y,b,S]}function Oj({sourceX:e,sourceY:t,targetX:s,targetY:r}){const i=Math.abs(s-e)/2,l=s<e?s+i:s-i,d=Math.abs(r-t)/2,f=r<t?r+d:r-d;return[l,f,i,d]}function mL({sourceNode:e,targetNode:t,selected:s=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:l="basic"}){if(l==="manual")return r;const d=i&&s?r+1e3:r,f=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return d+f}function pL({sourceNode:e,targetNode:t,width:s,height:r,transform:i}){const l=bf(ef(e),ef(t));l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const d={x:-i[0]/i[2],y:-i[1]/i[2],width:s/i[2],height:r/i[2]};return ic(d,Sf(l))>0}const gL=({source:e,sourceHandle:t,target:s,targetHandle:r})=>`xy-edge__${e}${t||""}-${s}${r||""}`,xL=(e,t)=>t.some(s=>s.source===e.source&&s.target===e.target&&(s.sourceHandle===e.sourceHandle||!s.sourceHandle&&!e.sourceHandle)&&(s.targetHandle===e.targetHandle||!s.targetHandle&&!e.targetHandle)),yL=(e,t,s={})=>{if(!e.source||!e.target)return t;const r=s.getEdgeId||gL;let i;return Sj(e)?i={...e}:i={...e,id:r(e)},xL(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Dj({sourceX:e,sourceY:t,targetX:s,targetY:r}){const[i,l,d,f]=Oj({sourceX:e,sourceY:t,targetX:s,targetY:r});return[`M ${e},${t}L ${s},${r}`,i,l,d,f]}const W1={[we.Left]:{x:-1,y:0},[we.Right]:{x:1,y:0},[we.Top]:{x:0,y:-1},[we.Bottom]:{x:0,y:1}},vL=({source:e,sourcePosition:t=we.Bottom,target:s})=>t===we.Left||t===we.Right?e.x<s.x?{x:1,y:0}:{x:-1,y:0}:e.y<s.y?{x:0,y:1}:{x:0,y:-1},J1=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function bL({source:e,sourcePosition:t=we.Bottom,target:s,targetPosition:r=we.Top,center:i,offset:l,stepPosition:d}){const f=W1[t],m=W1[r],h={x:e.x+f.x*l,y:e.y+f.y*l},v={x:s.x+m.x*l,y:s.y+m.y*l},g=vL({source:h,sourcePosition:t,target:v}),y=g.x!==0?"x":"y",b=g[y];let S=[],w,N;const C={x:0,y:0},T={x:0,y:0},[,,_,R]=Oj({sourceX:e.x,sourceY:e.y,targetX:s.x,targetY:s.y});if(f[y]*m[y]===-1){y==="x"?(w=i.x??h.x+(v.x-h.x)*d,N=i.y??(h.y+v.y)/2):(w=i.x??(h.x+v.x)/2,N=i.y??h.y+(v.y-h.y)*d);const B=[{x:w,y:h.y},{x:w,y:v.y}],L=[{x:h.x,y:N},{x:v.x,y:N}];f[y]===b?S=y==="x"?B:L:S=y==="x"?L:B}else{const B=[{x:h.x,y:v.y}],L=[{x:v.x,y:h.y}];if(y==="x"?S=f.x===b?L:B:S=f.y===b?B:L,t===r){const Y=Math.abs(e[y]-s[y]);if(Y<=l){const K=Math.min(l-1,l-Y);f[y]===b?C[y]=(h[y]>e[y]?-1:1)*K:T[y]=(v[y]>s[y]?-1:1)*K}}if(t!==r){const Y=y==="x"?"y":"x",K=f[y]===m[Y],U=h[Y]>v[Y],q=h[Y]<v[Y];(f[y]===1&&(!K&&U||K&&q)||f[y]!==1&&(!K&&q||K&&U))&&(S=y==="x"?B:L)}const M={x:h.x+C.x,y:h.y+C.y},I={x:v.x+T.x,y:v.y+T.y},H=Math.max(Math.abs(M.x-S[0].x),Math.abs(I.x-S[0].x)),D=Math.max(Math.abs(M.y-S[0].y),Math.abs(I.y-S[0].y));H>=D?(w=(M.x+I.x)/2,N=S[0].y):(w=S[0].x,N=(M.y+I.y)/2)}return[[e,{x:h.x+C.x,y:h.y+C.y},...S,{x:v.x+T.x,y:v.y+T.y},s],w,N,_,R]}function SL(e,t,s,r){const i=Math.min(J1(e,t)/2,J1(t,s)/2,r),{x:l,y:d}=t;if(e.x===l&&l===s.x||e.y===d&&d===s.y)return`L${l} ${d}`;if(e.y===d){const h=e.x<s.x?-1:1,v=e.y<s.y?1:-1;return`L ${l+i*h},${d}Q ${l},${d} ${l},${d+i*v}`}const f=e.x<s.x?1:-1,m=e.y<s.y?-1:1;return`L ${l},${d+i*m}Q ${l},${d} ${l+i*f},${d}`}function fg({sourceX:e,sourceY:t,sourcePosition:s=we.Bottom,targetX:r,targetY:i,targetPosition:l=we.Top,borderRadius:d=5,centerX:f,centerY:m,offset:h=20,stepPosition:v=.5}){const[g,y,b,S,w]=bL({source:{x:e,y:t},sourcePosition:s,target:{x:r,y:i},targetPosition:l,center:{x:f,y:m},offset:h,stepPosition:v});return[g.reduce((C,T,_)=>{let R="";return _>0&&_<g.length-1?R=SL(g[_-1],T,g[_+1],d):R=`${_===0?"M":"L"}${T.x} ${T.y}`,C+=R,C},""),y,b,S,w]}function eS(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function wL(e){var g;const{sourceNode:t,targetNode:s}=e;if(!eS(t)||!eS(s))return null;const r=t.internals.handleBounds||tS(t.handles),i=s.internals.handleBounds||tS(s.handles),l=nS((r==null?void 0:r.source)??[],e.sourceHandle),d=nS(e.connectionMode===bo.Strict?(i==null?void 0:i.target)??[]:((i==null?void 0:i.target)??[]).concat((i==null?void 0:i.source)??[]),e.targetHandle);if(!l||!d)return(g=e.onError)==null||g.call(e,"008",hs.error008(l?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const f=(l==null?void 0:l.position)||we.Bottom,m=(d==null?void 0:d.position)||we.Top,h=ni(t,l,f),v=ni(s,d,m);return{sourceX:h.x,sourceY:h.y,targetX:v.x,targetY:v.y,sourcePosition:f,targetPosition:m}}function tS(e){if(!e)return null;const t=[],s=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&s.push(r);return{source:t,target:s}}function ni(e,t,s=we.Left,r=!1){const i=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,l=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:d,height:f}=t??Zs(e);if(r)return{x:i+d/2,y:l+f/2};switch((t==null?void 0:t.position)??s){case we.Top:return{x:i+d/2,y:l};case we.Right:return{x:i+d,y:l+f/2};case we.Bottom:return{x:i+d/2,y:l+f};case we.Left:return{x:i,y:l+f/2}}}function nS(e,t){return e&&(t?e.find(s=>s.id===t):e[0])||null}function hg(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function NL(e,{id:t,defaultColor:s,defaultMarkerStart:r,defaultMarkerEnd:i}){const l=new Set;return e.reduce((d,f)=>([f.markerStart||r,f.markerEnd||i].forEach(m=>{if(m&&typeof m=="object"){const h=hg(m,t);l.has(h)||(d.push({id:h,color:m.color||s,...m}),l.add(h))}}),d),[]).sort((d,f)=>d.id.localeCompare(f.id))}const Lj=1e3,jL=10,a0={nodeOrigin:[0,0],nodeExtent:sc,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},EL={...a0,checkEquality:!0};function r0(e,t){const s={...e};for(const r in t)t[r]!==void 0&&(s[r]=t[r]);return s}function CL(e,t,s){const r=r0(a0,s);for(const i of e.values())if(i.parentId)o0(i,e,t,r);else{const l=bc(i,r.nodeOrigin),d=No(i.extent)?i.extent:r.nodeExtent,f=ti(l,d,Zs(i));i.internals.positionAbsolute=f}}function _L(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const s=[],r=[];for(const i of e.handles){const l={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?s.push(l):i.type==="target"&&r.push(l)}return{source:s,target:r}}function i0(e){return e==="manual"}function mg(e,t,s,r={}){var h,v;const i=r0(EL,r),l={i:0},d=new Map(t),f=i!=null&&i.elevateNodesOnSelect&&!i0(i.zIndexMode)?Lj:0;let m=e.length>0;t.clear(),s.clear();for(const g of e){let y=d.get(g.id);if(i.checkEquality&&g===(y==null?void 0:y.internals.userNode))t.set(g.id,y);else{const b=bc(g,i.nodeOrigin),S=No(g.extent)?g.extent:i.nodeExtent,w=ti(b,S,Zs(g));y={...i.defaults,...g,measured:{width:(h=g.measured)==null?void 0:h.width,height:(v=g.measured)==null?void 0:v.height},internals:{positionAbsolute:w,handleBounds:_L(g,y),z:zj(g,f,i.zIndexMode),userNode:g}},t.set(g.id,y)}(y.measured===void 0||y.measured.width===void 0||y.measured.height===void 0)&&!y.hidden&&(m=!1),g.parentId&&o0(y,t,s,r,l)}return m}function RL(e,t){if(!e.parentId)return;const s=t.get(e.parentId);s?s.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function o0(e,t,s,r,i){const{elevateNodesOnSelect:l,nodeOrigin:d,nodeExtent:f,zIndexMode:m}=r0(a0,r),h=e.parentId,v=t.get(h);if(!v){console.warn(`Parent node ${h} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}RL(e,s),i&&!v.parentId&&v.internals.rootParentIndex===void 0&&m==="auto"&&(v.internals.rootParentIndex=++i.i,v.internals.z=v.internals.z+i.i*jL),i&&v.internals.rootParentIndex!==void 0&&(i.i=v.internals.rootParentIndex);const g=l&&!i0(m)?Lj:0,{x:y,y:b,z:S}=TL(e,v,d,f,g,m),{positionAbsolute:w}=e.internals,N=y!==w.x||b!==w.y;(N||S!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:N?{x:y,y:b}:w,z:S}})}function zj(e,t,s){const r=Vn(e.zIndex)?e.zIndex:0;return i0(s)?r:r+(e.selected?t:0)}function TL(e,t,s,r,i,l){const{x:d,y:f}=t.internals.positionAbsolute,m=Zs(e),h=bc(e,s),v=No(e.extent)?ti(h,e.extent,m):h;let g=ti({x:d+v.x,y:f+v.y},r,m);e.extent==="parent"&&(g=Nj(g,m,t));const y=zj(e,i,l),b=t.internals.z??0;return{x:g.x,y:g.y,z:b>=y?b+1:y}}function l0(e,t,s,r=[0,0]){var d;const i=[],l=new Map;for(const f of e){const m=t.get(f.parentId);if(!m)continue;const h=((d=l.get(f.parentId))==null?void 0:d.expandedRect)??wo(m),v=Ej(h,f.rect);l.set(f.parentId,{expandedRect:v,parent:m})}return l.size>0&&l.forEach(({expandedRect:f,parent:m},h)=>{var _;const v=m.internals.positionAbsolute,g=Zs(m),y=m.origin??r,b=f.x<v.x?Math.round(Math.abs(v.x-f.x)):0,S=f.y<v.y?Math.round(Math.abs(v.y-f.y)):0,w=Math.max(g.width,Math.round(f.width)),N=Math.max(g.height,Math.round(f.height)),C=(w-g.width)*y[0],T=(N-g.height)*y[1];(b>0||S>0||C||T)&&(i.push({id:h,type:"position",position:{x:m.position.x-b+C,y:m.position.y-S+T}}),(_=s.get(h))==null||_.forEach(R=>{e.some(O=>O.id===R.id)||i.push({id:R.id,type:"position",position:{x:R.position.x+b,y:R.position.y+S}})})),(g.width<f.width||g.height<f.height||b||S)&&i.push({id:h,type:"dimensions",setAttributes:!0,dimensions:{width:w+(b?y[0]*b-C:0),height:N+(S?y[1]*S-T:0)}})}),i}function AL(e,t,s,r,i,l,d){const f=r==null?void 0:r.querySelector(".xyflow__viewport");let m=!1;if(!f)return{changes:[],updatedInternals:m};const h=[],v=window.getComputedStyle(f),{m22:g}=new window.DOMMatrixReadOnly(v.transform),y=[];for(const b of e.values()){const S=t.get(b.id);if(!S)continue;if(S.hidden){t.set(S.id,{...S,internals:{...S.internals,handleBounds:void 0}}),m=!0;continue}const w=s0(b.nodeElement),N=S.measured.width!==w.width||S.measured.height!==w.height;if(!!(w.width&&w.height&&(N||!S.internals.handleBounds||b.force))){const T=b.nodeElement.getBoundingClientRect(),_=No(S.extent)?S.extent:l;let{positionAbsolute:R}=S.internals;S.parentId&&S.extent==="parent"?R=Nj(R,w,t.get(S.parentId)):_&&(R=ti(R,_,w));const O={...S,measured:w,internals:{...S.internals,positionAbsolute:R,handleBounds:{source:X1("source",b.nodeElement,T,g,S.id),target:X1("target",b.nodeElement,T,g,S.id)}}};t.set(S.id,O),S.parentId&&o0(O,t,s,{nodeOrigin:i,zIndexMode:d}),m=!0,N&&(h.push({id:S.id,type:"dimensions",dimensions:w}),S.expandParent&&S.parentId&&y.push({id:S.id,parentId:S.parentId,rect:wo(O,i)}))}}if(y.length>0){const b=l0(y,t,s,i);h.push(...b)}return{changes:h,updatedInternals:m}}async function ML({delta:e,panZoom:t,transform:s,translateExtent:r,width:i,height:l}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const d=await t.setViewportConstrained({x:s[0]+e.x,y:s[1]+e.y,zoom:s[2]},[[0,0],[i,l]],r),f=!!d&&(d.x!==s[0]||d.y!==s[1]||d.k!==s[2]);return Promise.resolve(f)}function sS(e,t,s,r,i,l){let d=i;const f=r.get(d)||new Map;r.set(d,f.set(s,t)),d=`${i}-${e}`;const m=r.get(d)||new Map;if(r.set(d,m.set(s,t)),l){d=`${i}-${e}-${l}`;const h=r.get(d)||new Map;r.set(d,h.set(s,t))}}function Pj(e,t,s){e.clear(),t.clear();for(const r of s){const{source:i,target:l,sourceHandle:d=null,targetHandle:f=null}=r,m={edgeId:r.id,source:i,target:l,sourceHandle:d,targetHandle:f},h=`${i}-${d}--${l}-${f}`,v=`${l}-${f}--${i}-${d}`;sS("source",m,v,e,i,d),sS("target",m,h,e,l,f),t.set(r.id,r)}}function Ij(e,t){if(!e.parentId)return!1;const s=t.get(e.parentId);return s?s.selected?!0:Ij(s,t):!1}function aS(e,t,s){var i;let r=e;do{if((i=r==null?void 0:r.matches)!=null&&i.call(r,t))return!0;if(r===s)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function kL(e,t,s,r){const i=new Map;for(const[l,d]of e)if((d.selected||d.id===r)&&(!d.parentId||!Ij(d,e))&&(d.draggable||t&&typeof d.draggable>"u")){const f=e.get(l);f&&i.set(l,{id:l,position:f.position||{x:0,y:0},distance:{x:s.x-f.internals.positionAbsolute.x,y:s.y-f.internals.positionAbsolute.y},extent:f.extent,parentId:f.parentId,origin:f.origin,expandParent:f.expandParent,internals:{positionAbsolute:f.internals.positionAbsolute||{x:0,y:0}},measured:{width:f.measured.width??0,height:f.measured.height??0}})}return i}function _p({nodeId:e,dragItems:t,nodeLookup:s,dragging:r=!0}){var d,f,m;const i=[];for(const[h,v]of t){const g=(d=s.get(h))==null?void 0:d.internals.userNode;g&&i.push({...g,position:v.position,dragging:r})}if(!e)return[i[0],i];const l=(f=s.get(e))==null?void 0:f.internals.userNode;return[l?{...l,position:((m=t.get(e))==null?void 0:m.position)||l.position,dragging:r}:i[0],i]}function OL({dragItems:e,snapGrid:t,x:s,y:r}){const i=e.values().next().value;if(!i)return null;const l={x:s-i.distance.x,y:r-i.distance.y},d=wc(l,t);return{x:d.x-l.x,y:d.y-l.y}}function DL({onNodeMouseDown:e,getStoreItems:t,onDragStart:s,onDrag:r,onDragStop:i}){let l={x:null,y:null},d=0,f=new Map,m=!1,h={x:0,y:0},v=null,g=!1,y=null,b=!1,S=!1,w=null;function N({noDragClassName:T,handleSelector:_,domNode:R,isSelectable:O,nodeId:B,nodeClickDistance:L=0}){y=Sn(R);function M({x:Y,y:K}){const{nodeLookup:U,nodeExtent:q,snapGrid:A,snapToGrid:$,nodeOrigin:z,onNodeDrag:G,onSelectionDrag:V,onError:P,updateNodePositions:Q}=t();l={x:Y,y:K};let ee=!1;const se=f.size>1,oe=se&&q?dg(Sc(f)):null,ce=se&&$?OL({dragItems:f,snapGrid:A,x:Y,y:K}):null;for(const[fe,ue]of f){if(!U.has(fe))continue;let he={x:Y-ue.distance.x,y:K-ue.distance.y};$&&(he=ce?{x:Math.round(he.x+ce.x),y:Math.round(he.y+ce.y)}:wc(he,A));let Ce=null;if(se&&q&&!ue.extent&&oe){const{positionAbsolute:ve}=ue.internals,de=ve.x-oe.x+q[0][0],Ae=ve.x+ue.measured.width-oe.x2+q[1][0],Re=ve.y-oe.y+q[0][1],Be=ve.y+ue.measured.height-oe.y2+q[1][1];Ce=[[de,Re],[Ae,Be]]}const{position:Se,positionAbsolute:ye}=wj({nodeId:fe,nextPosition:he,nodeLookup:U,nodeExtent:Ce||q,nodeOrigin:z,onError:P});ee=ee||ue.position.x!==Se.x||ue.position.y!==Se.y,ue.position=Se,ue.internals.positionAbsolute=ye}if(S=S||ee,!!ee&&(Q(f,!0),w&&(r||G||!B&&V))){const[fe,ue]=_p({nodeId:B,dragItems:f,nodeLookup:U});r==null||r(w,f,fe,ue),G==null||G(w,fe,ue),B||V==null||V(w,ue)}}async function I(){if(!v)return;const{transform:Y,panBy:K,autoPanSpeed:U,autoPanOnNodeDrag:q}=t();if(!q){m=!1,cancelAnimationFrame(d);return}const[A,$]=jj(h,v,U);(A!==0||$!==0)&&(l.x=(l.x??0)-A/Y[2],l.y=(l.y??0)-$/Y[2],await K({x:A,y:$})&&M(l)),d=requestAnimationFrame(I)}function H(Y){var se;const{nodeLookup:K,multiSelectionActive:U,nodesDraggable:q,transform:A,snapGrid:$,snapToGrid:z,selectNodesOnDrag:G,onNodeDragStart:V,onSelectionDragStart:P,unselectNodesAndEdges:Q}=t();g=!0,(!G||!O)&&!U&&B&&((se=K.get(B))!=null&&se.selected||Q()),O&&G&&B&&(e==null||e(B));const ee=Il(Y.sourceEvent,{transform:A,snapGrid:$,snapToGrid:z,containerBounds:v});if(l=ee,f=kL(K,q,ee,B),f.size>0&&(s||V||!B&&P)){const[oe,ce]=_p({nodeId:B,dragItems:f,nodeLookup:K});s==null||s(Y.sourceEvent,f,oe,ce),V==null||V(Y.sourceEvent,oe,ce),B||P==null||P(Y.sourceEvent,ce)}}const D=tj().clickDistance(L).on("start",Y=>{const{domNode:K,nodeDragThreshold:U,transform:q,snapGrid:A,snapToGrid:$}=t();v=(K==null?void 0:K.getBoundingClientRect())||null,b=!1,S=!1,w=Y.sourceEvent,U===0&&H(Y),l=Il(Y.sourceEvent,{transform:q,snapGrid:A,snapToGrid:$,containerBounds:v}),h=Gn(Y.sourceEvent,v)}).on("drag",Y=>{const{autoPanOnNodeDrag:K,transform:U,snapGrid:q,snapToGrid:A,nodeDragThreshold:$,nodeLookup:z}=t(),G=Il(Y.sourceEvent,{transform:U,snapGrid:q,snapToGrid:A,containerBounds:v});if(w=Y.sourceEvent,(Y.sourceEvent.type==="touchmove"&&Y.sourceEvent.touches.length>1||B&&!z.has(B))&&(b=!0),!b){if(!m&&K&&g&&(m=!0,I()),!g){const V=Gn(Y.sourceEvent,v),P=V.x-h.x,Q=V.y-h.y;Math.sqrt(P*P+Q*Q)>$&&H(Y)}(l.x!==G.xSnapped||l.y!==G.ySnapped)&&f&&g&&(h=Gn(Y.sourceEvent,v),M(G))}}).on("end",Y=>{if(!(!g||b)&&(m=!1,g=!1,cancelAnimationFrame(d),f.size>0)){const{nodeLookup:K,updateNodePositions:U,onNodeDragStop:q,onSelectionDragStop:A}=t();if(S&&(U(f,!1),S=!1),i||q||!B&&A){const[$,z]=_p({nodeId:B,dragItems:f,nodeLookup:K,dragging:!1});i==null||i(Y.sourceEvent,f,$,z),q==null||q(Y.sourceEvent,$,z),B||A==null||A(Y.sourceEvent,z)}}}).filter(Y=>{const K=Y.target;return!Y.button&&(!T||!aS(K,`.${T}`,R))&&(!_||aS(K,_,R))});y.call(D)}function C(){y==null||y.on(".drag",null)}return{update:N,destroy:C}}function LL(e,t,s){const r=[],i={x:e.x-s,y:e.y-s,width:s*2,height:s*2};for(const l of t.values())ic(i,wo(l))>0&&r.push(l);return r}const zL=250;function PL(e,t,s,r){var f,m;let i=[],l=1/0;const d=LL(e,s,t+zL);for(const h of d){const v=[...((f=h.internals.handleBounds)==null?void 0:f.source)??[],...((m=h.internals.handleBounds)==null?void 0:m.target)??[]];for(const g of v){if(r.nodeId===g.nodeId&&r.type===g.type&&r.id===g.id)continue;const{x:y,y:b}=ni(h,g,g.position,!0),S=Math.sqrt(Math.pow(y-e.x,2)+Math.pow(b-e.y,2));S>t||(S<l?(i=[{...g,x:y,y:b}],l=S):S===l&&i.push({...g,x:y,y:b}))}}if(!i.length)return null;if(i.length>1){const h=r.type==="source"?"target":"source";return i.find(v=>v.type===h)??i[0]}return i[0]}function Bj(e,t,s,r,i,l=!1){var h,v,g;const d=r.get(e);if(!d)return null;const f=i==="strict"?(h=d.internals.handleBounds)==null?void 0:h[t]:[...((v=d.internals.handleBounds)==null?void 0:v.source)??[],...((g=d.internals.handleBounds)==null?void 0:g.target)??[]],m=(s?f==null?void 0:f.find(y=>y.id===s):f==null?void 0:f[0])??null;return m&&l?{...m,...ni(d,m,m.position,!0)}:m}function Hj(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function IL(e,t){let s=null;return t?s=!0:e&&!t&&(s=!1),s}const Uj=()=>!0;function BL(e,{connectionMode:t,connectionRadius:s,handleId:r,nodeId:i,edgeUpdaterType:l,isTarget:d,domNode:f,nodeLookup:m,lib:h,autoPanOnConnect:v,flowId:g,panBy:y,cancelConnection:b,onConnectStart:S,onConnect:w,onConnectEnd:N,isValidConnection:C=Uj,onReconnectEnd:T,updateConnection:_,getTransform:R,getFromHandle:O,autoPanSpeed:B,dragThreshold:L=1,handleDomNode:M}){const I=Rj(e.target);let H=0,D;const{x:Y,y:K}=Gn(e),U=Hj(l,M),q=f==null?void 0:f.getBoundingClientRect();let A=!1;if(!q||!U)return;const $=Bj(i,U,r,m,t);if(!$)return;let z=Gn(e,q),G=!1,V=null,P=!1,Q=null;function ee(){if(!v||!q)return;const[Se,ye]=jj(z,q,B);y({x:Se,y:ye}),H=requestAnimationFrame(ee)}const se={...$,nodeId:i,type:U,position:$.position},oe=m.get(i);let fe={inProgress:!0,isValid:null,from:ni(oe,se,we.Left,!0),fromHandle:se,fromPosition:se.position,fromNode:oe,to:z,toHandle:null,toPosition:Y1[se.position],toNode:null,pointer:z};function ue(){A=!0,_(fe),S==null||S(e,{nodeId:i,handleId:r,handleType:U})}L===0&&ue();function he(Se){if(!A){const{x:Be,y:St}=Gn(Se),dt=Be-Y,fn=St-K;if(!(dt*dt+fn*fn>L*L))return;ue()}if(!O()||!se){Ce(Se);return}const ye=R();z=Gn(Se,q),D=PL(Nc(z,ye,!1,[1,1]),s,m,se),G||(ee(),G=!0);const ve=$j(Se,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:d?"target":"source",isValidConnection:C,doc:I,lib:h,flowId:g,nodeLookup:m});Q=ve.handleDomNode,V=ve.connection,P=IL(!!D,ve.isValid);const de=m.get(i),Ae=de?ni(de,se,we.Left,!0):fe.from,Re={...fe,from:Ae,isValid:P,to:ve.toHandle&&P?tf({x:ve.toHandle.x,y:ve.toHandle.y},ye):z,toHandle:ve.toHandle,toPosition:P&&ve.toHandle?ve.toHandle.position:Y1[se.position],toNode:ve.toHandle?m.get(ve.toHandle.nodeId):null,pointer:z};_(Re),fe=Re}function Ce(Se){if(!("touches"in Se&&Se.touches.length>0)){if(A){(D||Q)&&V&&P&&(w==null||w(V));const{inProgress:ye,...ve}=fe,de={...ve,toPosition:fe.toHandle?fe.toPosition:null};N==null||N(Se,de),l&&(T==null||T(Se,de))}b(),cancelAnimationFrame(H),G=!1,P=!1,V=null,Q=null,I.removeEventListener("mousemove",he),I.removeEventListener("mouseup",Ce),I.removeEventListener("touchmove",he),I.removeEventListener("touchend",Ce)}}I.addEventListener("mousemove",he),I.addEventListener("mouseup",Ce),I.addEventListener("touchmove",he),I.addEventListener("touchend",Ce)}function $j(e,{handle:t,connectionMode:s,fromNodeId:r,fromHandleId:i,fromType:l,doc:d,lib:f,flowId:m,isValidConnection:h=Uj,nodeLookup:v}){const g=l==="target",y=t?d.querySelector(`.${f}-flow__handle[data-id="${m}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:b,y:S}=Gn(e),w=d.elementFromPoint(b,S),N=w!=null&&w.classList.contains(`${f}-flow__handle`)?w:y,C={handleDomNode:N,isValid:!1,connection:null,toHandle:null};if(N){const T=Hj(void 0,N),_=N.getAttribute("data-nodeid"),R=N.getAttribute("data-handleid"),O=N.classList.contains("connectable"),B=N.classList.contains("connectableend");if(!_||!T)return C;const L={source:g?_:r,sourceHandle:g?R:i,target:g?r:_,targetHandle:g?i:R};C.connection=L;const I=O&&B&&(s===bo.Strict?g&&T==="source"||!g&&T==="target":_!==r||R!==i);C.isValid=I&&h(L),C.toHandle=Bj(_,T,R,v,s,!0)}return C}const pg={onPointerDown:BL,isValid:$j};function HL({domNode:e,panZoom:t,getTransform:s,getViewScale:r}){const i=Sn(e);function l({translateExtent:f,width:m,height:h,zoomStep:v=1,pannable:g=!0,zoomable:y=!0,inversePan:b=!1}){const S=_=>{if(_.sourceEvent.type!=="wheel"||!t)return;const R=s(),O=_.sourceEvent.ctrlKey&&oc()?10:1,B=-_.sourceEvent.deltaY*(_.sourceEvent.deltaMode===1?.05:_.sourceEvent.deltaMode?1:.002)*v,L=R[2]*Math.pow(2,B*O);t.scaleTo(L)};let w=[0,0];const N=_=>{(_.sourceEvent.type==="mousedown"||_.sourceEvent.type==="touchstart")&&(w=[_.sourceEvent.clientX??_.sourceEvent.touches[0].clientX,_.sourceEvent.clientY??_.sourceEvent.touches[0].clientY])},C=_=>{const R=s();if(_.sourceEvent.type!=="mousemove"&&_.sourceEvent.type!=="touchmove"||!t)return;const O=[_.sourceEvent.clientX??_.sourceEvent.touches[0].clientX,_.sourceEvent.clientY??_.sourceEvent.touches[0].clientY],B=[O[0]-w[0],O[1]-w[1]];w=O;const L=r()*Math.max(R[2],Math.log(R[2]))*(b?-1:1),M={x:R[0]-B[0]*L,y:R[1]-B[1]*L},I=[[0,0],[m,h]];t.setViewportConstrained({x:M.x,y:M.y,zoom:R[2]},I,f)},T=gj().on("start",N).on("zoom",g?C:null).on("zoom.wheel",y?S:null);i.call(T,{})}function d(){i.on("zoom",null)}return{update:l,destroy:d,pointer:$n}}const wf=e=>({x:e.x,y:e.y,zoom:e.k}),Rp=({x:e,y:t,zoom:s})=>vf.translate(e,t).scale(s),Wi=(e,t)=>e.target.closest(`.${t}`),qj=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),UL=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Tp=(e,t=0,s=UL,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(s).on("end",r):e},Vj=e=>{const t=e.ctrlKey&&oc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function $L({zoomPanValues:e,noWheelClassName:t,d3Selection:s,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:l,zoomOnPinch:d,onPanZoomStart:f,onPanZoom:m,onPanZoomEnd:h}){return v=>{if(Wi(v,t))return v.ctrlKey&&v.preventDefault(),!1;v.preventDefault(),v.stopImmediatePropagation();const g=s.property("__zoom").k||1;if(v.ctrlKey&&d){const N=$n(v),C=Vj(v),T=g*Math.pow(2,C);r.scaleTo(s,T,N,v);return}const y=v.deltaMode===1?20:1;let b=i===Fr.Vertical?0:v.deltaX*y,S=i===Fr.Horizontal?0:v.deltaY*y;!oc()&&v.shiftKey&&i!==Fr.Vertical&&(b=v.deltaY*y,S=0),r.translateBy(s,-(b/g)*l,-(S/g)*l,{internal:!0});const w=wf(s.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(m==null||m(v,w),e.panScrollTimeout=setTimeout(()=>{h==null||h(v,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,f==null||f(v,w))}}function qL({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:s}){return function(r,i){const l=r.type==="wheel",d=!t&&l&&!r.ctrlKey,f=Wi(r,e);if(r.ctrlKey&&l&&f&&r.preventDefault(),d||f)return null;r.preventDefault(),s.call(this,r,i)}}function VL({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:s}){return r=>{var l,d,f;if((l=r.sourceEvent)!=null&&l.internal)return;const i=wf(r.transform);e.mouseButton=((d=r.sourceEvent)==null?void 0:d.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((f=r.sourceEvent)==null?void 0:f.type)==="mousedown"&&t(!0),s&&(s==null||s(r.sourceEvent,i))}}function GL({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:s,onTransformChange:r,onPanZoom:i}){return l=>{var d,f;e.usedRightMouseButton=!!(s&&qj(t,e.mouseButton??0)),(d=l.sourceEvent)!=null&&d.sync||r([l.transform.x,l.transform.y,l.transform.k]),i&&!((f=l.sourceEvent)!=null&&f.internal)&&(i==null||i(l.sourceEvent,wf(l.transform)))}}function YL({zoomPanValues:e,panOnDrag:t,panOnScroll:s,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:l}){return d=>{var f;if(!((f=d.sourceEvent)!=null&&f.internal)&&(e.isZoomingOrPanning=!1,l&&qj(t,e.mouseButton??0)&&!e.usedRightMouseButton&&d.sourceEvent&&l(d.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const m=wf(d.transform);e.prevViewport=m,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(d.sourceEvent,m)},s?150:0)}}}function QL({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:s,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:l,userSelectionActive:d,noWheelClassName:f,noPanClassName:m,lib:h,connectionInProgress:v}){return g=>{var N;const y=e||t,b=s&&g.ctrlKey,S=g.type==="wheel";if(g.button===1&&g.type==="mousedown"&&(Wi(g,`${h}-flow__node`)||Wi(g,`${h}-flow__edge`)))return!0;if(!r&&!y&&!i&&!l&&!s||d||v&&!S||Wi(g,f)&&S||Wi(g,m)&&(!S||i&&S&&!e)||!s&&g.ctrlKey&&S)return!1;if(!s&&g.type==="touchstart"&&((N=g.touches)==null?void 0:N.length)>1)return g.preventDefault(),!1;if(!y&&!i&&!b&&S||!r&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(r)&&!r.includes(g.button)&&g.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||S)&&w}}function KL({domNode:e,minZoom:t,maxZoom:s,translateExtent:r,viewport:i,onPanZoom:l,onPanZoomStart:d,onPanZoomEnd:f,onDraggingChange:m}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},v=e.getBoundingClientRect(),g=gj().scaleExtent([t,s]).translateExtent(r),y=Sn(e).call(g);T({x:i.x,y:i.y,zoom:So(i.zoom,t,s)},[[0,0],[v.width,v.height]],r);const b=y.on("wheel.zoom"),S=y.on("dblclick.zoom");g.wheelDelta(Vj);function w(D,Y){return y?new Promise(K=>{g==null||g.interpolate((Y==null?void 0:Y.interpolate)==="linear"?Pl:Td).transform(Tp(y,Y==null?void 0:Y.duration,Y==null?void 0:Y.ease,()=>K(!0)),D)}):Promise.resolve(!1)}function N({noWheelClassName:D,noPanClassName:Y,onPaneContextMenu:K,userSelectionActive:U,panOnScroll:q,panOnDrag:A,panOnScrollMode:$,panOnScrollSpeed:z,preventScrolling:G,zoomOnPinch:V,zoomOnScroll:P,zoomOnDoubleClick:Q,zoomActivationKeyPressed:ee,lib:se,onTransformChange:oe,connectionInProgress:ce,paneClickDistance:fe,selectionOnDrag:ue}){U&&!h.isZoomingOrPanning&&C();const he=q&&!ee&&!U;g.clickDistance(ue?1/0:!Vn(fe)||fe<0?0:fe);const Ce=he?$L({zoomPanValues:h,noWheelClassName:D,d3Selection:y,d3Zoom:g,panOnScrollMode:$,panOnScrollSpeed:z,zoomOnPinch:V,onPanZoomStart:d,onPanZoom:l,onPanZoomEnd:f}):qL({noWheelClassName:D,preventScrolling:G,d3ZoomHandler:b});if(y.on("wheel.zoom",Ce,{passive:!1}),!U){const ye=VL({zoomPanValues:h,onDraggingChange:m,onPanZoomStart:d});g.on("start",ye);const ve=GL({zoomPanValues:h,panOnDrag:A,onPaneContextMenu:!!K,onPanZoom:l,onTransformChange:oe});g.on("zoom",ve);const de=YL({zoomPanValues:h,panOnDrag:A,panOnScroll:q,onPaneContextMenu:K,onPanZoomEnd:f,onDraggingChange:m});g.on("end",de)}const Se=QL({zoomActivationKeyPressed:ee,panOnDrag:A,zoomOnScroll:P,panOnScroll:q,zoomOnDoubleClick:Q,zoomOnPinch:V,userSelectionActive:U,noPanClassName:Y,noWheelClassName:D,lib:se,connectionInProgress:ce});g.filter(Se),Q?y.on("dblclick.zoom",S):y.on("dblclick.zoom",null)}function C(){g.on("zoom",null)}async function T(D,Y,K){const U=Rp(D),q=g==null?void 0:g.constrain()(U,Y,K);return q&&await w(q),new Promise(A=>A(q))}async function _(D,Y){const K=Rp(D);return await w(K,Y),new Promise(U=>U(K))}function R(D){if(y){const Y=Rp(D),K=y.property("__zoom");(K.k!==D.zoom||K.x!==D.x||K.y!==D.y)&&(g==null||g.transform(y,Y,null,{sync:!0}))}}function O(){const D=y?pj(y.node()):{x:0,y:0,k:1};return{x:D.x,y:D.y,zoom:D.k}}function B(D,Y){return y?new Promise(K=>{g==null||g.interpolate((Y==null?void 0:Y.interpolate)==="linear"?Pl:Td).scaleTo(Tp(y,Y==null?void 0:Y.duration,Y==null?void 0:Y.ease,()=>K(!0)),D)}):Promise.resolve(!1)}function L(D,Y){return y?new Promise(K=>{g==null||g.interpolate((Y==null?void 0:Y.interpolate)==="linear"?Pl:Td).scaleBy(Tp(y,Y==null?void 0:Y.duration,Y==null?void 0:Y.ease,()=>K(!0)),D)}):Promise.resolve(!1)}function M(D){g==null||g.scaleExtent(D)}function I(D){g==null||g.translateExtent(D)}function H(D){const Y=!Vn(D)||D<0?0:D;g==null||g.clickDistance(Y)}return{update:N,destroy:C,setViewport:_,setViewportConstrained:T,getViewport:O,scaleTo:B,scaleBy:L,setScaleExtent:M,setTranslateExtent:I,syncViewport:R,setClickDistance:H}}var jo;(function(e){e.Line="line",e.Handle="handle"})(jo||(jo={}));function FL({width:e,prevWidth:t,height:s,prevHeight:r,affectsX:i,affectsY:l}){const d=e-t,f=s-r,m=[d>0?1:d<0?-1:0,f>0?1:f<0?-1:0];return d&&i&&(m[0]=m[0]*-1),f&&l&&(m[1]=m[1]*-1),m}function rS(e){const t=e.includes("right")||e.includes("left"),s=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:s,affectsX:r,affectsY:i}}function Ta(e,t){return Math.max(0,t-e)}function Aa(e,t){return Math.max(0,e-t)}function xd(e,t,s){return Math.max(0,t-e,e-s)}function iS(e,t){return e?!t:t}function XL(e,t,s,r,i,l,d,f){let{affectsX:m,affectsY:h}=t;const{isHorizontal:v,isVertical:g}=t,y=v&&g,{xSnapped:b,ySnapped:S}=s,{minWidth:w,maxWidth:N,minHeight:C,maxHeight:T}=r,{x:_,y:R,width:O,height:B,aspectRatio:L}=e;let M=Math.floor(v?b-e.pointerX:0),I=Math.floor(g?S-e.pointerY:0);const H=O+(m?-M:M),D=B+(h?-I:I),Y=-l[0]*O,K=-l[1]*B;let U=xd(H,w,N),q=xd(D,C,T);if(d){let z=0,G=0;m&&M<0?z=Ta(_+M+Y,d[0][0]):!m&&M>0&&(z=Aa(_+H+Y,d[1][0])),h&&I<0?G=Ta(R+I+K,d[0][1]):!h&&I>0&&(G=Aa(R+D+K,d[1][1])),U=Math.max(U,z),q=Math.max(q,G)}if(f){let z=0,G=0;m&&M>0?z=Aa(_+M,f[0][0]):!m&&M<0&&(z=Ta(_+H,f[1][0])),h&&I>0?G=Aa(R+I,f[0][1]):!h&&I<0&&(G=Ta(R+D,f[1][1])),U=Math.max(U,z),q=Math.max(q,G)}if(i){if(v){const z=xd(H/L,C,T)*L;if(U=Math.max(U,z),d){let G=0;!m&&!h||m&&!h&&y?G=Aa(R+K+H/L,d[1][1])*L:G=Ta(R+K+(m?M:-M)/L,d[0][1])*L,U=Math.max(U,G)}if(f){let G=0;!m&&!h||m&&!h&&y?G=Ta(R+H/L,f[1][1])*L:G=Aa(R+(m?M:-M)/L,f[0][1])*L,U=Math.max(U,G)}}if(g){const z=xd(D*L,w,N)/L;if(q=Math.max(q,z),d){let G=0;!m&&!h||h&&!m&&y?G=Aa(_+D*L+Y,d[1][0])/L:G=Ta(_+(h?I:-I)*L+Y,d[0][0])/L,q=Math.max(q,G)}if(f){let G=0;!m&&!h||h&&!m&&y?G=Ta(_+D*L,f[1][0])/L:G=Aa(_+(h?I:-I)*L,f[0][0])/L,q=Math.max(q,G)}}}I=I+(I<0?q:-q),M=M+(M<0?U:-U),i&&(y?H>D*L?I=(iS(m,h)?-M:M)/L:M=(iS(m,h)?-I:I)*L:v?(I=M/L,h=m):(M=I*L,m=h));const A=m?_+M:_,$=h?R+I:R;return{width:O+(m?-M:M),height:B+(h?-I:I),x:l[0]*M*(m?-1:1)+A,y:l[1]*I*(h?-1:1)+$}}const Gj={width:0,height:0,x:0,y:0},ZL={...Gj,pointerX:0,pointerY:0,aspectRatio:1};function WL(e){return[[0,0],[e.measured.width,e.measured.height]]}function JL(e,t,s){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,l=e.measured.width??0,d=e.measured.height??0,f=s[0]*l,m=s[1]*d;return[[r-f,i-m],[r+l-f,i+d-m]]}function ez({domNode:e,nodeId:t,getStoreItems:s,onChange:r,onEnd:i}){const l=Sn(e);let d={controlDirection:rS("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function f({controlPosition:h,boundaries:v,keepAspectRatio:g,resizeDirection:y,onResizeStart:b,onResize:S,onResizeEnd:w,shouldResize:N}){let C={...Gj},T={...ZL};d={boundaries:v,resizeDirection:y,keepAspectRatio:g,controlDirection:rS(h)};let _,R=null,O=[],B,L,M,I=!1;const H=tj().on("start",D=>{const{nodeLookup:Y,transform:K,snapGrid:U,snapToGrid:q,nodeOrigin:A,paneDomNode:$}=s();if(_=Y.get(t),!_)return;R=($==null?void 0:$.getBoundingClientRect())??null;const{xSnapped:z,ySnapped:G}=Il(D.sourceEvent,{transform:K,snapGrid:U,snapToGrid:q,containerBounds:R});C={width:_.measured.width??0,height:_.measured.height??0,x:_.position.x??0,y:_.position.y??0},T={...C,pointerX:z,pointerY:G,aspectRatio:C.width/C.height},B=void 0,_.parentId&&(_.extent==="parent"||_.expandParent)&&(B=Y.get(_.parentId),L=B&&_.extent==="parent"?WL(B):void 0),O=[],M=void 0;for(const[V,P]of Y)if(P.parentId===t&&(O.push({id:V,position:{...P.position},extent:P.extent}),P.extent==="parent"||P.expandParent)){const Q=JL(P,_,P.origin??A);M?M=[[Math.min(Q[0][0],M[0][0]),Math.min(Q[0][1],M[0][1])],[Math.max(Q[1][0],M[1][0]),Math.max(Q[1][1],M[1][1])]]:M=Q}b==null||b(D,{...C})}).on("drag",D=>{const{transform:Y,snapGrid:K,snapToGrid:U,nodeOrigin:q}=s(),A=Il(D.sourceEvent,{transform:Y,snapGrid:K,snapToGrid:U,containerBounds:R}),$=[];if(!_)return;const{x:z,y:G,width:V,height:P}=C,Q={},ee=_.origin??q,{width:se,height:oe,x:ce,y:fe}=XL(T,d.controlDirection,A,d.boundaries,d.keepAspectRatio,ee,L,M),ue=se!==V,he=oe!==P,Ce=ce!==z&&ue,Se=fe!==G&&he;if(!Ce&&!Se&&!ue&&!he)return;if((Ce||Se||ee[0]===1||ee[1]===1)&&(Q.x=Ce?ce:C.x,Q.y=Se?fe:C.y,C.x=Q.x,C.y=Q.y,O.length>0)){const Ae=ce-z,Re=fe-G;for(const Be of O)Be.position={x:Be.position.x-Ae+ee[0]*(se-V),y:Be.position.y-Re+ee[1]*(oe-P)},$.push(Be)}if((ue||he)&&(Q.width=ue&&(!d.resizeDirection||d.resizeDirection==="horizontal")?se:C.width,Q.height=he&&(!d.resizeDirection||d.resizeDirection==="vertical")?oe:C.height,C.width=Q.width,C.height=Q.height),B&&_.expandParent){const Ae=ee[0]*(Q.width??0);Q.x&&Q.x<Ae&&(C.x=Ae,T.x=T.x-(Q.x-Ae));const Re=ee[1]*(Q.height??0);Q.y&&Q.y<Re&&(C.y=Re,T.y=T.y-(Q.y-Re))}const ye=FL({width:C.width,prevWidth:V,height:C.height,prevHeight:P,affectsX:d.controlDirection.affectsX,affectsY:d.controlDirection.affectsY}),ve={...C,direction:ye};(N==null?void 0:N(D,ve))!==!1&&(I=!0,S==null||S(D,ve),r(Q,$))}).on("end",D=>{I&&(w==null||w(D,{...C}),i==null||i({...C}),I=!1)});l.call(H)}function m(){l.on(".drag",null)}return{update:f,destroy:m}}const tz={},oS=e=>{let t;const s=new Set,r=(v,g)=>{const y=typeof v=="function"?v(t):v;if(!Object.is(y,t)){const b=t;t=g??(typeof y!="object"||y===null)?y:Object.assign({},t,y),s.forEach(S=>S(t,b))}},i=()=>t,m={setState:r,getState:i,getInitialState:()=>h,subscribe:v=>(s.add(v),()=>s.delete(v)),destroy:()=>{(tz?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),s.clear()}},h=t=e(r,i,m);return m},nz=e=>e?oS(e):oS,{useDebugValue:sz}=Xr,{useSyncExternalStoreWithSelector:az}=AR,rz=e=>e;function Yj(e,t=rz,s){const r=az(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,s);return sz(r),r}const lS=(e,t)=>{const s=nz(e),r=(i,l=t)=>Yj(s,i,l);return Object.assign(r,s),r},iz=(e,t)=>e?lS(e,t):lS;function it(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const s=Object.keys(e);if(s.length!==Object.keys(t).length)return!1;for(const r of s)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Nf=j.createContext(null),oz=Nf.Provider,Qj=hs.error001();function Ve(e,t){const s=j.useContext(Nf);if(s===null)throw new Error(Qj);return Yj(s,e,t)}function ot(){const e=j.useContext(Nf);if(e===null)throw new Error(Qj);return j.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const cS={display:"none"},lz={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Kj="react-flow__node-desc",Fj="react-flow__edge-desc",cz="react-flow__aria-live",uz=e=>e.ariaLiveMessage,dz=e=>e.ariaLabelConfig;function fz({rfId:e}){const t=Ve(uz);return u.jsx("div",{id:`${cz}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:lz,children:t})}function hz({rfId:e,disableKeyboardA11y:t}){const s=Ve(dz);return u.jsxs(u.Fragment,{children:[u.jsx("div",{id:`${Kj}-${e}`,style:cS,children:t?s["node.a11yDescription.default"]:s["node.a11yDescription.keyboardDisabled"]}),u.jsx("div",{id:`${Fj}-${e}`,style:cS,children:s["edge.a11yDescription.default"]}),!t&&u.jsx(fz,{rfId:e})]})}const jf=j.forwardRef(({position:e="top-left",children:t,className:s,style:r,...i},l)=>{const d=`${e}`.split("-");return u.jsx("div",{className:bt(["react-flow__panel",s,...d]),style:r,ref:l,...i,children:t})});jf.displayName="Panel";function mz({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:u.jsx(jf,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:u.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const pz=e=>{const t=[],s=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&s.push(r);return{selectedNodes:t,selectedEdges:s}},yd=e=>e.id;function gz(e,t){return it(e.selectedNodes.map(yd),t.selectedNodes.map(yd))&&it(e.selectedEdges.map(yd),t.selectedEdges.map(yd))}function xz({onSelectionChange:e}){const t=ot(),{selectedNodes:s,selectedEdges:r}=Ve(pz,gz);return j.useEffect(()=>{const i={nodes:s,edges:r};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(l=>l(i))},[s,r,e]),null}const yz=e=>!!e.onSelectionChangeHandlers;function vz({onSelectionChange:e}){const t=Ve(yz);return e||t?u.jsx(xz,{onSelectionChange:e}):null}const Xj=[0,0],bz={x:0,y:0,zoom:1},Sz=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],uS=[...Sz,"rfId"],wz=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),dS={translateExtent:sc,nodeOrigin:Xj,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Nz(e){const{setNodes:t,setEdges:s,setMinZoom:r,setMaxZoom:i,setTranslateExtent:l,setNodeExtent:d,reset:f,setDefaultNodesAndEdges:m}=Ve(wz,it),h=ot();j.useEffect(()=>(m(e.defaultNodes,e.defaultEdges),()=>{v.current=dS,f()}),[]);const v=j.useRef(dS);return j.useEffect(()=>{for(const g of uS){const y=e[g],b=v.current[g];y!==b&&(typeof e[g]>"u"||(g==="nodes"?t(y):g==="edges"?s(y):g==="minZoom"?r(y):g==="maxZoom"?i(y):g==="translateExtent"?l(y):g==="nodeExtent"?d(y):g==="ariaLabelConfig"?h.setState({ariaLabelConfig:fL(y)}):g==="fitView"?h.setState({fitViewQueued:y}):g==="fitViewOptions"?h.setState({fitViewOptions:y}):h.setState({[g]:y})))}v.current=e},uS.map(g=>e[g])),null}function fS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function jz(e){var r;const[t,s]=j.useState(e==="system"?null:e);return j.useEffect(()=>{if(e!=="system"){s(e);return}const i=fS(),l=()=>s(i!=null&&i.matches?"dark":"light");return l(),i==null||i.addEventListener("change",l),()=>{i==null||i.removeEventListener("change",l)}},[e]),t!==null?t:(r=fS())!=null&&r.matches?"dark":"light"}const hS=typeof document<"u"?document:null;function lc(e=null,t={target:hS,actInsideInputWithModifier:!0}){const[s,r]=j.useState(!1),i=j.useRef(!1),l=j.useRef(new Set([])),[d,f]=j.useMemo(()=>{if(e!==null){const h=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.replace("+",`
216
- `).replace(`
217
-
218
- `,`
219
- +`).split(`
220
- `)),v=h.reduce((g,y)=>g.concat(...y),[]);return[h,v]}return[[],[]]},[e]);return j.useEffect(()=>{const m=(t==null?void 0:t.target)??hS,h=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const v=b=>{var N,C;if(i.current=b.ctrlKey||b.metaKey||b.shiftKey||b.altKey,(!i.current||i.current&&!h)&&Tj(b))return!1;const w=pS(b.code,f);if(l.current.add(b[w]),mS(d,l.current,!1)){const T=((C=(N=b.composedPath)==null?void 0:N.call(b))==null?void 0:C[0])||b.target,_=(T==null?void 0:T.nodeName)==="BUTTON"||(T==null?void 0:T.nodeName)==="A";t.preventDefault!==!1&&(i.current||!_)&&b.preventDefault(),r(!0)}},g=b=>{const S=pS(b.code,f);mS(d,l.current,!0)?(r(!1),l.current.clear()):l.current.delete(b[S]),b.key==="Meta"&&l.current.clear(),i.current=!1},y=()=>{l.current.clear(),r(!1)};return m==null||m.addEventListener("keydown",v),m==null||m.addEventListener("keyup",g),window.addEventListener("blur",y),window.addEventListener("contextmenu",y),()=>{m==null||m.removeEventListener("keydown",v),m==null||m.removeEventListener("keyup",g),window.removeEventListener("blur",y),window.removeEventListener("contextmenu",y)}}},[e,r]),s}function mS(e,t,s){return e.filter(r=>s||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function pS(e,t){return t.includes(e)?"code":"key"}const Ez=()=>{const e=ot();return j.useMemo(()=>({zoomIn:t=>{const{panZoom:s}=e.getState();return s?s.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:s}=e.getState();return s?s.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,s)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:s==null?void 0:s.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,s)=>{const{transform:[r,i,l],panZoom:d}=e.getState();return d?(await d.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??l},s),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,s,r]=e.getState().transform;return{x:t,y:s,zoom:r}},setCenter:async(t,s,r)=>e.getState().setCenter(t,s,r),fitBounds:async(t,s)=>{const{width:r,height:i,minZoom:l,maxZoom:d,panZoom:f}=e.getState(),m=n0(t,r,i,l,d,(s==null?void 0:s.padding)??.1);return f?(await f.setViewport(m,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,s={})=>{const{transform:r,snapGrid:i,snapToGrid:l,domNode:d}=e.getState();if(!d)return t;const{x:f,y:m}=d.getBoundingClientRect(),h={x:t.x-f,y:t.y-m},v=s.snapGrid??i,g=s.snapToGrid??l;return Nc(h,r,g,v)},flowToScreenPosition:t=>{const{transform:s,domNode:r}=e.getState();if(!r)return t;const{x:i,y:l}=r.getBoundingClientRect(),d=tf(t,s);return{x:d.x+i,y:d.y+l}}}),[])};function Zj(e,t){const s=[],r=new Map,i=[];for(const l of e)if(l.type==="add"){i.push(l);continue}else if(l.type==="remove"||l.type==="replace")r.set(l.id,[l]);else{const d=r.get(l.id);d?d.push(l):r.set(l.id,[l])}for(const l of t){const d=r.get(l.id);if(!d){s.push(l);continue}if(d[0].type==="remove")continue;if(d[0].type==="replace"){s.push({...d[0].item});continue}const f={...l};for(const m of d)Cz(m,f);s.push(f)}return i.length&&i.forEach(l=>{l.index!==void 0?s.splice(l.index,0,{...l.item}):s.push({...l.item})}),s}function Cz(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function _z(e,t){return Zj(e,t)}function Rz(e,t){return Zj(e,t)}function Rr(e,t){return{id:e,type:"select",selected:t}}function Ji(e,t=new Set,s=!1){const r=[];for(const[i,l]of e){const d=t.has(i);!(l.selected===void 0&&!d)&&l.selected!==d&&(s&&(l.selected=d),r.push(Rr(l.id,d)))}return r}function gS({items:e=[],lookup:t}){var i;const s=[],r=new Map(e.map(l=>[l.id,l]));for(const[l,d]of e.entries()){const f=t.get(d.id),m=((i=f==null?void 0:f.internals)==null?void 0:i.userNode)??f;m!==void 0&&m!==d&&s.push({id:d.id,item:d,type:"replace"}),m===void 0&&s.push({item:d,type:"add",index:l})}for(const[l]of t)r.get(l)===void 0&&s.push({id:l,type:"remove"});return s}function xS(e){return{id:e.id,type:"remove"}}const yS=e=>nL(e),Tz=e=>Sj(e);function Wj(e){return j.forwardRef(e)}const Az=typeof window<"u"?j.useLayoutEffect:j.useEffect;function vS(e){const[t,s]=j.useState(BigInt(0)),[r]=j.useState(()=>Mz(()=>s(i=>i+BigInt(1))));return Az(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function Mz(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:s=>{t.push(s),e()}}}const Jj=j.createContext(null);function kz({children:e}){const t=ot(),s=j.useCallback(f=>{const{nodes:m=[],setNodes:h,hasDefaultNodes:v,onNodesChange:g,nodeLookup:y,fitViewQueued:b,onNodesChangeMiddlewareMap:S}=t.getState();let w=m;for(const C of f)w=typeof C=="function"?C(w):C;let N=gS({items:w,lookup:y});for(const C of S.values())N=C(N);v&&h(w),N.length>0?g==null||g(N):b&&window.requestAnimationFrame(()=>{const{fitViewQueued:C,nodes:T,setNodes:_}=t.getState();C&&_(T)})},[]),r=vS(s),i=j.useCallback(f=>{const{edges:m=[],setEdges:h,hasDefaultEdges:v,onEdgesChange:g,edgeLookup:y}=t.getState();let b=m;for(const S of f)b=typeof S=="function"?S(b):S;v?h(b):g&&g(gS({items:b,lookup:y}))},[]),l=vS(i),d=j.useMemo(()=>({nodeQueue:r,edgeQueue:l}),[]);return u.jsx(Jj.Provider,{value:d,children:e})}function Oz(){const e=j.useContext(Jj);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Dz=e=>!!e.panZoom;function c0(){const e=Ez(),t=ot(),s=Oz(),r=Ve(Dz),i=j.useMemo(()=>{const l=g=>t.getState().nodeLookup.get(g),d=g=>{s.nodeQueue.push(g)},f=g=>{s.edgeQueue.push(g)},m=g=>{var C,T;const{nodeLookup:y,nodeOrigin:b}=t.getState(),S=yS(g)?g:y.get(g.id),w=S.parentId?_j(S.position,S.measured,S.parentId,y,b):S.position,N={...S,position:w,width:((C=S.measured)==null?void 0:C.width)??S.width,height:((T=S.measured)==null?void 0:T.height)??S.height};return wo(N)},h=(g,y,b={replace:!1})=>{d(S=>S.map(w=>{if(w.id===g){const N=typeof y=="function"?y(w):y;return b.replace&&yS(N)?N:{...w,...N}}return w}))},v=(g,y,b={replace:!1})=>{f(S=>S.map(w=>{if(w.id===g){const N=typeof y=="function"?y(w):y;return b.replace&&Tz(N)?N:{...w,...N}}return w}))};return{getNodes:()=>t.getState().nodes.map(g=>({...g})),getNode:g=>{var y;return(y=l(g))==null?void 0:y.internals.userNode},getInternalNode:l,getEdges:()=>{const{edges:g=[]}=t.getState();return g.map(y=>({...y}))},getEdge:g=>t.getState().edgeLookup.get(g),setNodes:d,setEdges:f,addNodes:g=>{const y=Array.isArray(g)?g:[g];s.nodeQueue.push(b=>[...b,...y])},addEdges:g=>{const y=Array.isArray(g)?g:[g];s.edgeQueue.push(b=>[...b,...y])},toObject:()=>{const{nodes:g=[],edges:y=[],transform:b}=t.getState(),[S,w,N]=b;return{nodes:g.map(C=>({...C})),edges:y.map(C=>({...C})),viewport:{x:S,y:w,zoom:N}}},deleteElements:async({nodes:g=[],edges:y=[]})=>{const{nodes:b,edges:S,onNodesDelete:w,onEdgesDelete:N,triggerNodeChanges:C,triggerEdgeChanges:T,onDelete:_,onBeforeDelete:R}=t.getState(),{nodes:O,edges:B}=await oL({nodesToRemove:g,edgesToRemove:y,nodes:b,edges:S,onBeforeDelete:R}),L=B.length>0,M=O.length>0;if(L){const I=B.map(xS);N==null||N(B),T(I)}if(M){const I=O.map(xS);w==null||w(O),C(I)}return(M||L)&&(_==null||_({nodes:O,edges:B})),{deletedNodes:O,deletedEdges:B}},getIntersectingNodes:(g,y=!0,b)=>{const S=K1(g),w=S?g:m(g),N=b!==void 0;return w?(b||t.getState().nodes).filter(C=>{const T=t.getState().nodeLookup.get(C.id);if(T&&!S&&(C.id===g.id||!T.internals.positionAbsolute))return!1;const _=wo(N?C:T),R=ic(_,w);return y&&R>0||R>=_.width*_.height||R>=w.width*w.height}):[]},isNodeIntersecting:(g,y,b=!0)=>{const w=K1(g)?g:m(g);if(!w)return!1;const N=ic(w,y);return b&&N>0||N>=y.width*y.height||N>=w.width*w.height},updateNode:h,updateNodeData:(g,y,b={replace:!1})=>{h(g,S=>{const w=typeof y=="function"?y(S):y;return b.replace?{...S,data:w}:{...S,data:{...S.data,...w}}},b)},updateEdge:v,updateEdgeData:(g,y,b={replace:!1})=>{v(g,S=>{const w=typeof y=="function"?y(S):y;return b.replace?{...S,data:w}:{...S,data:{...S.data,...w}}},b)},getNodesBounds:g=>{const{nodeLookup:y,nodeOrigin:b}=t.getState();return sL(g,{nodeLookup:y,nodeOrigin:b})},getHandleConnections:({type:g,id:y,nodeId:b})=>{var S;return Array.from(((S=t.getState().connectionLookup.get(`${b}-${g}${y?`-${y}`:""}`))==null?void 0:S.values())??[])},getNodeConnections:({type:g,handleId:y,nodeId:b})=>{var S;return Array.from(((S=t.getState().connectionLookup.get(`${b}${g?y?`-${g}-${y}`:`-${g}`:""}`))==null?void 0:S.values())??[])},fitView:async g=>{const y=t.getState().fitViewResolver??dL();return t.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:y}),s.nodeQueue.push(b=>[...b]),y.promise}}},[]);return j.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const bS=e=>e.selected,Lz=typeof window<"u"?window:void 0;function zz({deleteKeyCode:e,multiSelectionKeyCode:t}){const s=ot(),{deleteElements:r}=c0(),i=lc(e,{actInsideInputWithModifier:!1}),l=lc(t,{target:Lz});j.useEffect(()=>{if(i){const{edges:d,nodes:f}=s.getState();r({nodes:f.filter(bS),edges:d.filter(bS)}),s.setState({nodesSelectionActive:!1})}},[i]),j.useEffect(()=>{s.setState({multiSelectionActive:l})},[l])}function Pz(e){const t=ot();j.useEffect(()=>{const s=()=>{var i,l,d,f;if(!e.current||!(((l=(i=e.current).checkVisibility)==null?void 0:l.call(i))??!0))return!1;const r=s0(e.current);(r.height===0||r.width===0)&&((f=(d=t.getState()).onError)==null||f.call(d,"004",hs.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){s(),window.addEventListener("resize",s);const r=new ResizeObserver(()=>s());return r.observe(e.current),()=>{window.removeEventListener("resize",s),r&&e.current&&r.unobserve(e.current)}}},[])}const Ef={position:"absolute",width:"100%",height:"100%",top:0,left:0},Iz=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Bz({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:s=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:l=Fr.Free,zoomOnDoubleClick:d=!0,panOnDrag:f=!0,defaultViewport:m,translateExtent:h,minZoom:v,maxZoom:g,zoomActivationKeyCode:y,preventScrolling:b=!0,children:S,noWheelClassName:w,noPanClassName:N,onViewportChange:C,isControlledViewport:T,paneClickDistance:_,selectionOnDrag:R}){const O=ot(),B=j.useRef(null),{userSelectionActive:L,lib:M,connectionInProgress:I}=Ve(Iz,it),H=lc(y),D=j.useRef();Pz(B);const Y=j.useCallback(K=>{C==null||C({x:K[0],y:K[1],zoom:K[2]}),T||O.setState({transform:K})},[C,T]);return j.useEffect(()=>{if(B.current){D.current=KL({domNode:B.current,minZoom:v,maxZoom:g,translateExtent:h,viewport:m,onDraggingChange:A=>O.setState($=>$.paneDragging===A?$:{paneDragging:A}),onPanZoomStart:(A,$)=>{const{onViewportChangeStart:z,onMoveStart:G}=O.getState();G==null||G(A,$),z==null||z($)},onPanZoom:(A,$)=>{const{onViewportChange:z,onMove:G}=O.getState();G==null||G(A,$),z==null||z($)},onPanZoomEnd:(A,$)=>{const{onViewportChangeEnd:z,onMoveEnd:G}=O.getState();G==null||G(A,$),z==null||z($)}});const{x:K,y:U,zoom:q}=D.current.getViewport();return O.setState({panZoom:D.current,transform:[K,U,q],domNode:B.current.closest(".react-flow")}),()=>{var A;(A=D.current)==null||A.destroy()}}},[]),j.useEffect(()=>{var K;(K=D.current)==null||K.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:s,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:l,zoomOnDoubleClick:d,panOnDrag:f,zoomActivationKeyPressed:H,preventScrolling:b,noPanClassName:N,userSelectionActive:L,noWheelClassName:w,lib:M,onTransformChange:Y,connectionInProgress:I,selectionOnDrag:R,paneClickDistance:_})},[e,t,s,r,i,l,d,f,H,b,N,L,w,M,Y,I,R,_]),u.jsx("div",{className:"react-flow__renderer",ref:B,style:Ef,children:S})}const Hz=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Uz(){const{userSelectionActive:e,userSelectionRect:t}=Ve(Hz,it);return e&&t?u.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Ap=(e,t)=>s=>{s.target===t.current&&(e==null||e(s))},$z=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function qz({isSelecting:e,selectionKeyPressed:t,selectionMode:s=ac.Full,panOnDrag:r,paneClickDistance:i,selectionOnDrag:l,onSelectionStart:d,onSelectionEnd:f,onPaneClick:m,onPaneContextMenu:h,onPaneScroll:v,onPaneMouseEnter:g,onPaneMouseMove:y,onPaneMouseLeave:b,children:S}){const w=ot(),{userSelectionActive:N,elementsSelectable:C,dragging:T,connectionInProgress:_}=Ve($z,it),R=C&&(e||N),O=j.useRef(null),B=j.useRef(),L=j.useRef(new Set),M=j.useRef(new Set),I=j.useRef(!1),H=z=>{if(I.current||_){I.current=!1;return}m==null||m(z),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},D=z=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){z.preventDefault();return}h==null||h(z)},Y=v?z=>v(z):void 0,K=z=>{I.current&&(z.stopPropagation(),I.current=!1)},U=z=>{var oe,ce;const{domNode:G}=w.getState();if(B.current=G==null?void 0:G.getBoundingClientRect(),!B.current)return;const V=z.target===O.current;if(!V&&!!z.target.closest(".nokey")||!e||!(l&&V||t)||z.button!==0||!z.isPrimary)return;(ce=(oe=z.target)==null?void 0:oe.setPointerCapture)==null||ce.call(oe,z.pointerId),I.current=!1;const{x:ee,y:se}=Gn(z.nativeEvent,B.current);w.setState({userSelectionRect:{width:0,height:0,startX:ee,startY:se,x:ee,y:se}}),V||(z.stopPropagation(),z.preventDefault())},q=z=>{const{userSelectionRect:G,transform:V,nodeLookup:P,edgeLookup:Q,connectionLookup:ee,triggerNodeChanges:se,triggerEdgeChanges:oe,defaultEdgeOptions:ce,resetSelectedElements:fe}=w.getState();if(!B.current||!G)return;const{x:ue,y:he}=Gn(z.nativeEvent,B.current),{startX:Ce,startY:Se}=G;if(!I.current){const Re=t?0:i;if(Math.hypot(ue-Ce,he-Se)<=Re)return;fe(),d==null||d(z)}I.current=!0;const ye={startX:Ce,startY:Se,x:ue<Ce?ue:Ce,y:he<Se?he:Se,width:Math.abs(ue-Ce),height:Math.abs(he-Se)},ve=L.current,de=M.current;L.current=new Set(t0(P,ye,V,s===ac.Partial,!0).map(Re=>Re.id)),M.current=new Set;const Ae=(ce==null?void 0:ce.selectable)??!0;for(const Re of L.current){const Be=ee.get(Re);if(Be)for(const{edgeId:St}of Be.values()){const dt=Q.get(St);dt&&(dt.selectable??Ae)&&M.current.add(St)}}if(!F1(ve,L.current)){const Re=Ji(P,L.current,!0);se(Re)}if(!F1(de,M.current)){const Re=Ji(Q,M.current);oe(Re)}w.setState({userSelectionRect:ye,userSelectionActive:!0,nodesSelectionActive:!1})},A=z=>{var G,V;z.button===0&&((V=(G=z.target)==null?void 0:G.releasePointerCapture)==null||V.call(G,z.pointerId),!N&&z.target===O.current&&w.getState().userSelectionRect&&(H==null||H(z)),w.setState({userSelectionActive:!1,userSelectionRect:null}),I.current&&(f==null||f(z),w.setState({nodesSelectionActive:L.current.size>0})))},$=r===!0||Array.isArray(r)&&r.includes(0);return u.jsxs("div",{className:bt(["react-flow__pane",{draggable:$,dragging:T,selection:e}]),onClick:R?void 0:Ap(H,O),onContextMenu:Ap(D,O),onWheel:Ap(Y,O),onPointerEnter:R?void 0:g,onPointerMove:R?q:y,onPointerUp:R?A:void 0,onPointerDownCapture:R?U:void 0,onClickCapture:R?K:void 0,onPointerLeave:b,ref:O,style:Ef,children:[S,u.jsx(Uz,{})]})}function gg({id:e,store:t,unselect:s=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:l,multiSelectionActive:d,nodeLookup:f,onError:m}=t.getState(),h=f.get(e);if(!h){m==null||m("012",hs.error012(e));return}t.setState({nodesSelectionActive:!1}),h.selected?(s||h.selected&&d)&&(l({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var v;return(v=r==null?void 0:r.current)==null?void 0:v.blur()})):i([e])}function eE({nodeRef:e,disabled:t=!1,noDragClassName:s,handleSelector:r,nodeId:i,isSelectable:l,nodeClickDistance:d}){const f=ot(),[m,h]=j.useState(!1),v=j.useRef();return j.useEffect(()=>{v.current=DL({getStoreItems:()=>f.getState(),onNodeMouseDown:g=>{gg({id:g,store:f,nodeRef:e})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),j.useEffect(()=>{if(!(t||!e.current||!v.current))return v.current.update({noDragClassName:s,handleSelector:r,domNode:e.current,isSelectable:l,nodeId:i,nodeClickDistance:d}),()=>{var g;(g=v.current)==null||g.destroy()}},[s,r,t,l,e,i,d]),m}const Vz=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function tE(){const e=ot();return j.useCallback(s=>{const{nodeExtent:r,snapToGrid:i,snapGrid:l,nodesDraggable:d,onError:f,updateNodePositions:m,nodeLookup:h,nodeOrigin:v}=e.getState(),g=new Map,y=Vz(d),b=i?l[0]:5,S=i?l[1]:5,w=s.direction.x*b*s.factor,N=s.direction.y*S*s.factor;for(const[,C]of h){if(!y(C))continue;let T={x:C.internals.positionAbsolute.x+w,y:C.internals.positionAbsolute.y+N};i&&(T=wc(T,l));const{position:_,positionAbsolute:R}=wj({nodeId:C.id,nextPosition:T,nodeLookup:h,nodeExtent:r,nodeOrigin:v,onError:f});C.position=_,C.internals.positionAbsolute=R,g.set(C.id,C)}m(g)},[])}const u0=j.createContext(null),Gz=u0.Provider;u0.Consumer;const nE=()=>j.useContext(u0),Yz=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Qz=(e,t,s)=>r=>{const{connectionClickStartHandle:i,connectionMode:l,connection:d}=r,{fromHandle:f,toHandle:m,isValid:h}=d,v=(m==null?void 0:m.nodeId)===e&&(m==null?void 0:m.id)===t&&(m==null?void 0:m.type)===s;return{connectingFrom:(f==null?void 0:f.nodeId)===e&&(f==null?void 0:f.id)===t&&(f==null?void 0:f.type)===s,connectingTo:v,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===t&&(i==null?void 0:i.type)===s,isPossibleEndHandle:l===bo.Strict?(f==null?void 0:f.type)!==s:e!==(f==null?void 0:f.nodeId)||t!==(f==null?void 0:f.id),connectionInProcess:!!f,clickConnectionInProcess:!!i,valid:v&&h}};function Kz({type:e="source",position:t=we.Top,isValidConnection:s,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:l=!0,id:d,onConnect:f,children:m,className:h,onMouseDown:v,onTouchStart:g,...y},b){var q,A;const S=d||null,w=e==="target",N=ot(),C=nE(),{connectOnClick:T,noPanClassName:_,rfId:R}=Ve(Yz,it),{connectingFrom:O,connectingTo:B,clickConnecting:L,isPossibleEndHandle:M,connectionInProcess:I,clickConnectionInProcess:H,valid:D}=Ve(Qz(C,S,e),it);C||(A=(q=N.getState()).onError)==null||A.call(q,"010",hs.error010());const Y=$=>{const{defaultEdgeOptions:z,onConnect:G,hasDefaultEdges:V}=N.getState(),P={...z,...$};if(V){const{edges:Q,setEdges:ee}=N.getState();ee(yL(P,Q))}G==null||G(P),f==null||f(P)},K=$=>{if(!C)return;const z=Aj($.nativeEvent);if(i&&(z&&$.button===0||!z)){const G=N.getState();pg.onPointerDown($.nativeEvent,{handleDomNode:$.currentTarget,autoPanOnConnect:G.autoPanOnConnect,connectionMode:G.connectionMode,connectionRadius:G.connectionRadius,domNode:G.domNode,nodeLookup:G.nodeLookup,lib:G.lib,isTarget:w,handleId:S,nodeId:C,flowId:G.rfId,panBy:G.panBy,cancelConnection:G.cancelConnection,onConnectStart:G.onConnectStart,onConnectEnd:(...V)=>{var P,Q;return(Q=(P=N.getState()).onConnectEnd)==null?void 0:Q.call(P,...V)},updateConnection:G.updateConnection,onConnect:Y,isValidConnection:s||((...V)=>{var P,Q;return((Q=(P=N.getState()).isValidConnection)==null?void 0:Q.call(P,...V))??!0}),getTransform:()=>N.getState().transform,getFromHandle:()=>N.getState().connection.fromHandle,autoPanSpeed:G.autoPanSpeed,dragThreshold:G.connectionDragThreshold})}z?v==null||v($):g==null||g($)},U=$=>{const{onClickConnectStart:z,onClickConnectEnd:G,connectionClickStartHandle:V,connectionMode:P,isValidConnection:Q,lib:ee,rfId:se,nodeLookup:oe,connection:ce}=N.getState();if(!C||!V&&!i)return;if(!V){z==null||z($.nativeEvent,{nodeId:C,handleId:S,handleType:e}),N.setState({connectionClickStartHandle:{nodeId:C,type:e,id:S}});return}const fe=Rj($.target),ue=s||Q,{connection:he,isValid:Ce}=pg.isValid($.nativeEvent,{handle:{nodeId:C,id:S,type:e},connectionMode:P,fromNodeId:V.nodeId,fromHandleId:V.id||null,fromType:V.type,isValidConnection:ue,flowId:se,doc:fe,lib:ee,nodeLookup:oe});Ce&&he&&Y(he);const Se=structuredClone(ce);delete Se.inProgress,Se.toPosition=Se.toHandle?Se.toHandle.position:null,G==null||G($,Se),N.setState({connectionClickStartHandle:null})};return u.jsx("div",{"data-handleid":S,"data-nodeid":C,"data-handlepos":t,"data-id":`${R}-${C}-${S}-${e}`,className:bt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",_,h,{source:!w,target:w,connectable:r,connectablestart:i,connectableend:l,clickconnecting:L,connectingfrom:O,connectingto:B,valid:D,connectionindicator:r&&(!I||M)&&(I||H?l:i)}]),onMouseDown:K,onTouchStart:K,onClick:T?U:void 0,ref:b,...y,children:m})}const Wa=j.memo(Wj(Kz));function Fz({data:e,isConnectable:t,sourcePosition:s=we.Bottom}){return u.jsxs(u.Fragment,{children:[e==null?void 0:e.label,u.jsx(Wa,{type:"source",position:s,isConnectable:t})]})}function Xz({data:e,isConnectable:t,targetPosition:s=we.Top,sourcePosition:r=we.Bottom}){return u.jsxs(u.Fragment,{children:[u.jsx(Wa,{type:"target",position:s,isConnectable:t}),e==null?void 0:e.label,u.jsx(Wa,{type:"source",position:r,isConnectable:t})]})}function Zz(){return null}function Wz({data:e,isConnectable:t,targetPosition:s=we.Top}){return u.jsxs(u.Fragment,{children:[u.jsx(Wa,{type:"target",position:s,isConnectable:t}),e==null?void 0:e.label]})}const nf={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},SS={input:Fz,default:Xz,output:Wz,group:Zz};function Jz(e){var t,s,r,i;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((s=e.style)==null?void 0:s.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((i=e.style)==null?void 0:i.height)}}const e8=e=>{const{width:t,height:s,x:r,y:i}=Sc(e.nodeLookup,{filter:l=>!!l.selected});return{width:Vn(t)?t:null,height:Vn(s)?s:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function t8({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:s}){const r=ot(),{width:i,height:l,transformString:d,userSelectionActive:f}=Ve(e8,it),m=tE(),h=j.useRef(null);j.useEffect(()=>{var b;s||(b=h.current)==null||b.focus({preventScroll:!0})},[s]);const v=!f&&i!==null&&l!==null;if(eE({nodeRef:h,disabled:!v}),!v)return null;const g=e?b=>{const S=r.getState().nodes.filter(w=>w.selected);e(b,S)}:void 0,y=b=>{Object.prototype.hasOwnProperty.call(nf,b.key)&&(b.preventDefault(),m({direction:nf[b.key],factor:b.shiftKey?4:1}))};return u.jsx("div",{className:bt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:d},children:u.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:s?void 0:-1,onKeyDown:s?void 0:y,style:{width:i,height:l}})})}const wS=typeof window<"u"?window:void 0,n8=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function sE({children:e,onPaneClick:t,onPaneMouseEnter:s,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:l,onPaneScroll:d,paneClickDistance:f,deleteKeyCode:m,selectionKeyCode:h,selectionOnDrag:v,selectionMode:g,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:S,panActivationKeyCode:w,zoomActivationKeyCode:N,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:R,panOnScrollSpeed:O,panOnScrollMode:B,zoomOnDoubleClick:L,panOnDrag:M,defaultViewport:I,translateExtent:H,minZoom:D,maxZoom:Y,preventScrolling:K,onSelectionContextMenu:U,noWheelClassName:q,noPanClassName:A,disableKeyboardA11y:$,onViewportChange:z,isControlledViewport:G}){const{nodesSelectionActive:V,userSelectionActive:P}=Ve(n8,it),Q=lc(h,{target:wS}),ee=lc(w,{target:wS}),se=ee||M,oe=ee||R,ce=v&&se!==!0,fe=Q||P||ce;return zz({deleteKeyCode:m,multiSelectionKeyCode:S}),u.jsx(Bz,{onPaneContextMenu:l,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:oe,panOnScrollSpeed:O,panOnScrollMode:B,zoomOnDoubleClick:L,panOnDrag:!Q&&se,defaultViewport:I,translateExtent:H,minZoom:D,maxZoom:Y,zoomActivationKeyCode:N,preventScrolling:K,noWheelClassName:q,noPanClassName:A,onViewportChange:z,isControlledViewport:G,paneClickDistance:f,selectionOnDrag:ce,children:u.jsxs(qz,{onSelectionStart:y,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:s,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:l,onPaneScroll:d,panOnDrag:se,isSelecting:!!fe,selectionMode:g,selectionKeyPressed:Q,paneClickDistance:f,selectionOnDrag:ce,children:[e,V&&u.jsx(t8,{onSelectionContextMenu:U,noPanClassName:A,disableKeyboardA11y:$})]})})}sE.displayName="FlowRenderer";const s8=j.memo(sE),a8=e=>t=>e?t0(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(s=>s.id):Array.from(t.nodeLookup.keys());function r8(e){return Ve(j.useCallback(a8(e),[e]),it)}const i8=e=>e.updateNodeInternals;function o8(){const e=Ve(i8),[t]=j.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(s=>{const r=new Map;s.forEach(i=>{const l=i.target.getAttribute("data-id");r.set(l,{id:l,nodeElement:i.target,force:!0})}),e(r)}));return j.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function l8({node:e,nodeType:t,hasDimensions:s,resizeObserver:r}){const i=ot(),l=j.useRef(null),d=j.useRef(null),f=j.useRef(e.sourcePosition),m=j.useRef(e.targetPosition),h=j.useRef(t),v=s&&!!e.internals.handleBounds;return j.useEffect(()=>{l.current&&!e.hidden&&(!v||d.current!==l.current)&&(d.current&&(r==null||r.unobserve(d.current)),r==null||r.observe(l.current),d.current=l.current)},[v,e.hidden]),j.useEffect(()=>()=>{d.current&&(r==null||r.unobserve(d.current),d.current=null)},[]),j.useEffect(()=>{if(l.current){const g=h.current!==t,y=f.current!==e.sourcePosition,b=m.current!==e.targetPosition;(g||y||b)&&(h.current=t,f.current=e.sourcePosition,m.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:l.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),l}function c8({id:e,onClick:t,onMouseEnter:s,onMouseMove:r,onMouseLeave:i,onContextMenu:l,onDoubleClick:d,nodesDraggable:f,elementsSelectable:m,nodesConnectable:h,nodesFocusable:v,resizeObserver:g,noDragClassName:y,noPanClassName:b,disableKeyboardA11y:S,rfId:w,nodeTypes:N,nodeClickDistance:C,onError:T}){const{node:_,internals:R,isParent:O}=Ve(ue=>{const he=ue.nodeLookup.get(e),Ce=ue.parentLookup.has(e);return{node:he,internals:he.internals,isParent:Ce}},it);let B=_.type||"default",L=(N==null?void 0:N[B])||SS[B];L===void 0&&(T==null||T("003",hs.error003(B)),B="default",L=(N==null?void 0:N.default)||SS.default);const M=!!(_.draggable||f&&typeof _.draggable>"u"),I=!!(_.selectable||m&&typeof _.selectable>"u"),H=!!(_.connectable||h&&typeof _.connectable>"u"),D=!!(_.focusable||v&&typeof _.focusable>"u"),Y=ot(),K=Cj(_),U=l8({node:_,nodeType:B,hasDimensions:K,resizeObserver:g}),q=eE({nodeRef:U,disabled:_.hidden||!M,noDragClassName:y,handleSelector:_.dragHandle,nodeId:e,isSelectable:I,nodeClickDistance:C}),A=tE();if(_.hidden)return null;const $=Zs(_),z=Jz(_),G=I||M||t||s||r||i,V=s?ue=>s(ue,{...R.userNode}):void 0,P=r?ue=>r(ue,{...R.userNode}):void 0,Q=i?ue=>i(ue,{...R.userNode}):void 0,ee=l?ue=>l(ue,{...R.userNode}):void 0,se=d?ue=>d(ue,{...R.userNode}):void 0,oe=ue=>{const{selectNodesOnDrag:he,nodeDragThreshold:Ce}=Y.getState();I&&(!he||!M||Ce>0)&&gg({id:e,store:Y,nodeRef:U}),t&&t(ue,{...R.userNode})},ce=ue=>{if(!(Tj(ue.nativeEvent)||S)){if(xj.includes(ue.key)&&I){const he=ue.key==="Escape";gg({id:e,store:Y,unselect:he,nodeRef:U})}else if(M&&_.selected&&Object.prototype.hasOwnProperty.call(nf,ue.key)){ue.preventDefault();const{ariaLabelConfig:he}=Y.getState();Y.setState({ariaLiveMessage:he["node.a11yDescription.ariaLiveMessage"]({direction:ue.key.replace("Arrow","").toLowerCase(),x:~~R.positionAbsolute.x,y:~~R.positionAbsolute.y})}),A({direction:nf[ue.key],factor:ue.shiftKey?4:1})}}},fe=()=>{var de;if(S||!((de=U.current)!=null&&de.matches(":focus-visible")))return;const{transform:ue,width:he,height:Ce,autoPanOnNodeFocus:Se,setCenter:ye}=Y.getState();if(!Se)return;t0(new Map([[e,_]]),{x:0,y:0,width:he,height:Ce},ue,!0).length>0||ye(_.position.x+$.width/2,_.position.y+$.height/2,{zoom:ue[2]})};return u.jsx("div",{className:bt(["react-flow__node",`react-flow__node-${B}`,{[b]:M},_.className,{selected:_.selected,selectable:I,parent:O,draggable:M,dragging:q}]),ref:U,style:{zIndex:R.z,transform:`translate(${R.positionAbsolute.x}px,${R.positionAbsolute.y}px)`,pointerEvents:G?"all":"none",visibility:K?"visible":"hidden",..._.style,...z},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:V,onMouseMove:P,onMouseLeave:Q,onContextMenu:ee,onClick:oe,onDoubleClick:se,onKeyDown:D?ce:void 0,tabIndex:D?0:void 0,onFocus:D?fe:void 0,role:_.ariaRole??(D?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${Kj}-${w}`,"aria-label":_.ariaLabel,..._.domAttributes,children:u.jsx(Gz,{value:e,children:u.jsx(L,{id:e,data:_.data,type:B,positionAbsoluteX:R.positionAbsolute.x,positionAbsoluteY:R.positionAbsolute.y,selected:_.selected??!1,selectable:I,draggable:M,deletable:_.deletable??!0,isConnectable:H,sourcePosition:_.sourcePosition,targetPosition:_.targetPosition,dragging:q,dragHandle:_.dragHandle,zIndex:R.z,parentId:_.parentId,...$})})})}var u8=j.memo(c8);const d8=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function aE(e){const{nodesDraggable:t,nodesConnectable:s,nodesFocusable:r,elementsSelectable:i,onError:l}=Ve(d8,it),d=r8(e.onlyRenderVisibleElements),f=o8();return u.jsx("div",{className:"react-flow__nodes",style:Ef,children:d.map(m=>u.jsx(u8,{id:m,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:f,nodesDraggable:t,nodesConnectable:s,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:l},m))})}aE.displayName="NodeRenderer";const f8=j.memo(aE);function h8(e){return Ve(j.useCallback(s=>{if(!e)return s.edges.map(i=>i.id);const r=[];if(s.width&&s.height)for(const i of s.edges){const l=s.nodeLookup.get(i.source),d=s.nodeLookup.get(i.target);l&&d&&pL({sourceNode:l,targetNode:d,width:s.width,height:s.height,transform:s.transform})&&r.push(i.id)}return r},[e]),it)}const m8=({color:e="none",strokeWidth:t=1})=>{const s={strokeWidth:t,...e&&{stroke:e}};return u.jsx("polyline",{className:"arrow",style:s,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},p8=({color:e="none",strokeWidth:t=1})=>{const s={strokeWidth:t,...e&&{stroke:e,fill:e}};return u.jsx("polyline",{className:"arrowclosed",style:s,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},NS={[rc.Arrow]:m8,[rc.ArrowClosed]:p8};function g8(e){const t=ot();return j.useMemo(()=>{var i,l;return Object.prototype.hasOwnProperty.call(NS,e)?NS[e]:((l=(i=t.getState()).onError)==null||l.call(i,"009",hs.error009(e)),null)},[e])}const x8=({id:e,type:t,color:s,width:r=12.5,height:i=12.5,markerUnits:l="strokeWidth",strokeWidth:d,orient:f="auto-start-reverse"})=>{const m=g8(t);return m?u.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:f,refX:"0",refY:"0",children:u.jsx(m,{color:s,strokeWidth:d})}):null},rE=({defaultColor:e,rfId:t})=>{const s=Ve(l=>l.edges),r=Ve(l=>l.defaultEdgeOptions),i=j.useMemo(()=>NL(s,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[s,r,t,e]);return i.length?u.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:u.jsx("defs",{children:i.map(l=>u.jsx(x8,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};rE.displayName="MarkerDefinitions";var y8=j.memo(rE);function iE({x:e,y:t,label:s,labelStyle:r,labelShowBg:i=!0,labelBgStyle:l,labelBgPadding:d=[2,4],labelBgBorderRadius:f=2,children:m,className:h,...v}){const[g,y]=j.useState({x:1,y:0,width:0,height:0}),b=bt(["react-flow__edge-textwrapper",h]),S=j.useRef(null);return j.useEffect(()=>{if(S.current){const w=S.current.getBBox();y({x:w.x,y:w.y,width:w.width,height:w.height})}},[s]),s?u.jsxs("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:b,visibility:g.width?"visible":"hidden",...v,children:[i&&u.jsx("rect",{width:g.width+2*d[0],x:-d[0],y:-d[1],height:g.height+2*d[1],className:"react-flow__edge-textbg",style:l,rx:f,ry:f}),u.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:S,style:r,children:s}),m]}):null}iE.displayName="EdgeText";const v8=j.memo(iE);function Cf({path:e,labelX:t,labelY:s,label:r,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m,interactionWidth:h=20,...v}){return u.jsxs(u.Fragment,{children:[u.jsx("path",{...v,d:e,fill:"none",className:bt(["react-flow__edge-path",v.className])}),h?u.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,r&&Vn(t)&&Vn(s)?u.jsx(v8,{x:t,y:s,label:r,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m}):null]})}function jS({pos:e,x1:t,y1:s,x2:r,y2:i}){return e===we.Left||e===we.Right?[.5*(t+r),s]:[t,.5*(s+i)]}function oE({sourceX:e,sourceY:t,sourcePosition:s=we.Bottom,targetX:r,targetY:i,targetPosition:l=we.Top}){const[d,f]=jS({pos:s,x1:e,y1:t,x2:r,y2:i}),[m,h]=jS({pos:l,x1:r,y1:i,x2:e,y2:t}),[v,g,y,b]=Mj({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:d,sourceControlY:f,targetControlX:m,targetControlY:h});return[`M${e},${t} C${d},${f} ${m},${h} ${r},${i}`,v,g,y,b]}function lE(e){return j.memo(({id:t,sourceX:s,sourceY:r,targetX:i,targetY:l,sourcePosition:d,targetPosition:f,label:m,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:b,style:S,markerEnd:w,markerStart:N,interactionWidth:C})=>{const[T,_,R]=oE({sourceX:s,sourceY:r,sourcePosition:d,targetX:i,targetY:l,targetPosition:f}),O=e.isInternal?void 0:t;return u.jsx(Cf,{id:O,path:T,labelX:_,labelY:R,label:m,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:b,style:S,markerEnd:w,markerStart:N,interactionWidth:C})})}const b8=lE({isInternal:!1}),cE=lE({isInternal:!0});b8.displayName="SimpleBezierEdge";cE.displayName="SimpleBezierEdgeInternal";function uE(e){return j.memo(({id:t,sourceX:s,sourceY:r,targetX:i,targetY:l,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:g,style:y,sourcePosition:b=we.Bottom,targetPosition:S=we.Top,markerEnd:w,markerStart:N,pathOptions:C,interactionWidth:T})=>{const[_,R,O]=fg({sourceX:s,sourceY:r,sourcePosition:b,targetX:i,targetY:l,targetPosition:S,borderRadius:C==null?void 0:C.borderRadius,offset:C==null?void 0:C.offset,stepPosition:C==null?void 0:C.stepPosition}),B=e.isInternal?void 0:t;return u.jsx(Cf,{id:B,path:_,labelX:R,labelY:O,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:T})})}const dE=uE({isInternal:!1}),fE=uE({isInternal:!0});dE.displayName="SmoothStepEdge";fE.displayName="SmoothStepEdgeInternal";function hE(e){return j.memo(({id:t,...s})=>{var i;const r=e.isInternal?void 0:t;return u.jsx(dE,{...s,id:r,pathOptions:j.useMemo(()=>{var l;return{borderRadius:0,offset:(l=s.pathOptions)==null?void 0:l.offset}},[(i=s.pathOptions)==null?void 0:i.offset])})})}const S8=hE({isInternal:!1}),mE=hE({isInternal:!0});S8.displayName="StepEdge";mE.displayName="StepEdgeInternal";function pE(e){return j.memo(({id:t,sourceX:s,sourceY:r,targetX:i,targetY:l,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:g,style:y,markerEnd:b,markerStart:S,interactionWidth:w})=>{const[N,C,T]=Dj({sourceX:s,sourceY:r,targetX:i,targetY:l}),_=e.isInternal?void 0:t;return u.jsx(Cf,{id:_,path:N,labelX:C,labelY:T,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:g,style:y,markerEnd:b,markerStart:S,interactionWidth:w})})}const w8=pE({isInternal:!1}),gE=pE({isInternal:!0});w8.displayName="StraightEdge";gE.displayName="StraightEdgeInternal";function xE(e){return j.memo(({id:t,sourceX:s,sourceY:r,targetX:i,targetY:l,sourcePosition:d=we.Bottom,targetPosition:f=we.Top,label:m,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:b,style:S,markerEnd:w,markerStart:N,pathOptions:C,interactionWidth:T})=>{const[_,R,O]=kj({sourceX:s,sourceY:r,sourcePosition:d,targetX:i,targetY:l,targetPosition:f,curvature:C==null?void 0:C.curvature}),B=e.isInternal?void 0:t;return u.jsx(Cf,{id:B,path:_,labelX:R,labelY:O,label:m,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:b,style:S,markerEnd:w,markerStart:N,interactionWidth:T})})}const N8=xE({isInternal:!1}),yE=xE({isInternal:!0});N8.displayName="BezierEdge";yE.displayName="BezierEdgeInternal";const ES={default:yE,straight:gE,step:mE,smoothstep:fE,simplebezier:cE},CS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},j8=(e,t,s)=>s===we.Left?e-t:s===we.Right?e+t:e,E8=(e,t,s)=>s===we.Top?e-t:s===we.Bottom?e+t:e,_S="react-flow__edgeupdater";function RS({position:e,centerX:t,centerY:s,radius:r=10,onMouseDown:i,onMouseEnter:l,onMouseOut:d,type:f}){return u.jsx("circle",{onMouseDown:i,onMouseEnter:l,onMouseOut:d,className:bt([_S,`${_S}-${f}`]),cx:j8(t,r,e),cy:E8(s,r,e),r,stroke:"transparent",fill:"transparent"})}function C8({isReconnectable:e,reconnectRadius:t,edge:s,sourceX:r,sourceY:i,targetX:l,targetY:d,sourcePosition:f,targetPosition:m,onReconnect:h,onReconnectStart:v,onReconnectEnd:g,setReconnecting:y,setUpdateHover:b}){const S=ot(),w=(R,O)=>{if(R.button!==0)return;const{autoPanOnConnect:B,domNode:L,connectionMode:M,connectionRadius:I,lib:H,onConnectStart:D,cancelConnection:Y,nodeLookup:K,rfId:U,panBy:q,updateConnection:A}=S.getState(),$=O.type==="target",z=(P,Q)=>{y(!1),g==null||g(P,s,O.type,Q)},G=P=>h==null?void 0:h(s,P),V=(P,Q)=>{y(!0),v==null||v(R,s,O.type),D==null||D(P,Q)};pg.onPointerDown(R.nativeEvent,{autoPanOnConnect:B,connectionMode:M,connectionRadius:I,domNode:L,handleId:O.id,nodeId:O.nodeId,nodeLookup:K,isTarget:$,edgeUpdaterType:O.type,lib:H,flowId:U,cancelConnection:Y,panBy:q,isValidConnection:(...P)=>{var Q,ee;return((ee=(Q=S.getState()).isValidConnection)==null?void 0:ee.call(Q,...P))??!0},onConnect:G,onConnectStart:V,onConnectEnd:(...P)=>{var Q,ee;return(ee=(Q=S.getState()).onConnectEnd)==null?void 0:ee.call(Q,...P)},onReconnectEnd:z,updateConnection:A,getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,dragThreshold:S.getState().connectionDragThreshold,handleDomNode:R.currentTarget})},N=R=>w(R,{nodeId:s.target,id:s.targetHandle??null,type:"target"}),C=R=>w(R,{nodeId:s.source,id:s.sourceHandle??null,type:"source"}),T=()=>b(!0),_=()=>b(!1);return u.jsxs(u.Fragment,{children:[(e===!0||e==="source")&&u.jsx(RS,{position:f,centerX:r,centerY:i,radius:t,onMouseDown:N,onMouseEnter:T,onMouseOut:_,type:"source"}),(e===!0||e==="target")&&u.jsx(RS,{position:m,centerX:l,centerY:d,radius:t,onMouseDown:C,onMouseEnter:T,onMouseOut:_,type:"target"})]})}function _8({id:e,edgesFocusable:t,edgesReconnectable:s,elementsSelectable:r,onClick:i,onDoubleClick:l,onContextMenu:d,onMouseEnter:f,onMouseMove:m,onMouseLeave:h,reconnectRadius:v,onReconnect:g,onReconnectStart:y,onReconnectEnd:b,rfId:S,edgeTypes:w,noPanClassName:N,onError:C,disableKeyboardA11y:T}){let _=Ve(ye=>ye.edgeLookup.get(e));const R=Ve(ye=>ye.defaultEdgeOptions);_=R?{...R,..._}:_;let O=_.type||"default",B=(w==null?void 0:w[O])||ES[O];B===void 0&&(C==null||C("011",hs.error011(O)),O="default",B=(w==null?void 0:w.default)||ES.default);const L=!!(_.focusable||t&&typeof _.focusable>"u"),M=typeof g<"u"&&(_.reconnectable||s&&typeof _.reconnectable>"u"),I=!!(_.selectable||r&&typeof _.selectable>"u"),H=j.useRef(null),[D,Y]=j.useState(!1),[K,U]=j.useState(!1),q=ot(),{zIndex:A,sourceX:$,sourceY:z,targetX:G,targetY:V,sourcePosition:P,targetPosition:Q}=Ve(j.useCallback(ye=>{const ve=ye.nodeLookup.get(_.source),de=ye.nodeLookup.get(_.target);if(!ve||!de)return{zIndex:_.zIndex,...CS};const Ae=wL({id:e,sourceNode:ve,targetNode:de,sourceHandle:_.sourceHandle||null,targetHandle:_.targetHandle||null,connectionMode:ye.connectionMode,onError:C});return{zIndex:mL({selected:_.selected,zIndex:_.zIndex,sourceNode:ve,targetNode:de,elevateOnSelect:ye.elevateEdgesOnSelect,zIndexMode:ye.zIndexMode}),...Ae||CS}},[_.source,_.target,_.sourceHandle,_.targetHandle,_.selected,_.zIndex]),it),ee=j.useMemo(()=>_.markerStart?`url('#${hg(_.markerStart,S)}')`:void 0,[_.markerStart,S]),se=j.useMemo(()=>_.markerEnd?`url('#${hg(_.markerEnd,S)}')`:void 0,[_.markerEnd,S]);if(_.hidden||$===null||z===null||G===null||V===null)return null;const oe=ye=>{var Re;const{addSelectedEdges:ve,unselectNodesAndEdges:de,multiSelectionActive:Ae}=q.getState();I&&(q.setState({nodesSelectionActive:!1}),_.selected&&Ae?(de({nodes:[],edges:[_]}),(Re=H.current)==null||Re.blur()):ve([e])),i&&i(ye,_)},ce=l?ye=>{l(ye,{..._})}:void 0,fe=d?ye=>{d(ye,{..._})}:void 0,ue=f?ye=>{f(ye,{..._})}:void 0,he=m?ye=>{m(ye,{..._})}:void 0,Ce=h?ye=>{h(ye,{..._})}:void 0,Se=ye=>{var ve;if(!T&&xj.includes(ye.key)&&I){const{unselectNodesAndEdges:de,addSelectedEdges:Ae}=q.getState();ye.key==="Escape"?((ve=H.current)==null||ve.blur(),de({edges:[_]})):Ae([e])}};return u.jsx("svg",{style:{zIndex:A},children:u.jsxs("g",{className:bt(["react-flow__edge",`react-flow__edge-${O}`,_.className,N,{selected:_.selected,animated:_.animated,inactive:!I&&!i,updating:D,selectable:I}]),onClick:oe,onDoubleClick:ce,onContextMenu:fe,onMouseEnter:ue,onMouseMove:he,onMouseLeave:Ce,onKeyDown:L?Se:void 0,tabIndex:L?0:void 0,role:_.ariaRole??(L?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":_.ariaLabel===null?void 0:_.ariaLabel||`Edge from ${_.source} to ${_.target}`,"aria-describedby":L?`${Fj}-${S}`:void 0,ref:H,..._.domAttributes,children:[!K&&u.jsx(B,{id:e,source:_.source,target:_.target,type:_.type,selected:_.selected,animated:_.animated,selectable:I,deletable:_.deletable??!0,label:_.label,labelStyle:_.labelStyle,labelShowBg:_.labelShowBg,labelBgStyle:_.labelBgStyle,labelBgPadding:_.labelBgPadding,labelBgBorderRadius:_.labelBgBorderRadius,sourceX:$,sourceY:z,targetX:G,targetY:V,sourcePosition:P,targetPosition:Q,data:_.data,style:_.style,sourceHandleId:_.sourceHandle,targetHandleId:_.targetHandle,markerStart:ee,markerEnd:se,pathOptions:"pathOptions"in _?_.pathOptions:void 0,interactionWidth:_.interactionWidth}),M&&u.jsx(C8,{edge:_,isReconnectable:M,reconnectRadius:v,onReconnect:g,onReconnectStart:y,onReconnectEnd:b,sourceX:$,sourceY:z,targetX:G,targetY:V,sourcePosition:P,targetPosition:Q,setUpdateHover:Y,setReconnecting:U})]})})}var R8=j.memo(_8);const T8=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function vE({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:s,edgeTypes:r,noPanClassName:i,onReconnect:l,onEdgeContextMenu:d,onEdgeMouseEnter:f,onEdgeMouseMove:m,onEdgeMouseLeave:h,onEdgeClick:v,reconnectRadius:g,onEdgeDoubleClick:y,onReconnectStart:b,onReconnectEnd:S,disableKeyboardA11y:w}){const{edgesFocusable:N,edgesReconnectable:C,elementsSelectable:T,onError:_}=Ve(T8,it),R=h8(t);return u.jsxs("div",{className:"react-flow__edges",children:[u.jsx(y8,{defaultColor:e,rfId:s}),R.map(O=>u.jsx(R8,{id:O,edgesFocusable:N,edgesReconnectable:C,elementsSelectable:T,noPanClassName:i,onReconnect:l,onContextMenu:d,onMouseEnter:f,onMouseMove:m,onMouseLeave:h,onClick:v,reconnectRadius:g,onDoubleClick:y,onReconnectStart:b,onReconnectEnd:S,rfId:s,onError:_,edgeTypes:r,disableKeyboardA11y:w},O))]})}vE.displayName="EdgeRenderer";const A8=j.memo(vE),M8=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function k8({children:e}){const t=Ve(M8);return u.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function O8(e){const t=c0(),s=j.useRef(!1);j.useEffect(()=>{!s.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),s.current=!0)},[e,t.viewportInitialized])}const D8=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function L8(e){const t=Ve(D8),s=ot();return j.useEffect(()=>{e&&(t==null||t(e),s.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function z8(e){return e.connection.inProgress?{...e.connection,to:Nc(e.connection.to,e.transform)}:{...e.connection}}function P8(e){return z8}function I8(e){const t=P8();return Ve(t,it)}const B8=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function H8({containerStyle:e,style:t,type:s,component:r}){const{nodesConnectable:i,width:l,height:d,isValid:f,inProgress:m}=Ve(B8,it);return!(l&&i&&m)?null:u.jsx("svg",{style:e,width:l,height:d,className:"react-flow__connectionline react-flow__container",children:u.jsx("g",{className:bt(["react-flow__connection",bj(f)]),children:u.jsx(bE,{style:t,type:s,CustomComponent:r,isValid:f})})})}const bE=({style:e,type:t=Da.Bezier,CustomComponent:s,isValid:r})=>{const{inProgress:i,from:l,fromNode:d,fromHandle:f,fromPosition:m,to:h,toNode:v,toHandle:g,toPosition:y,pointer:b}=I8();if(!i)return;if(s)return u.jsx(s,{connectionLineType:t,connectionLineStyle:e,fromNode:d,fromHandle:f,fromX:l.x,fromY:l.y,toX:h.x,toY:h.y,fromPosition:m,toPosition:y,connectionStatus:bj(r),toNode:v,toHandle:g,pointer:b});let S="";const w={sourceX:l.x,sourceY:l.y,sourcePosition:m,targetX:h.x,targetY:h.y,targetPosition:y};switch(t){case Da.Bezier:[S]=kj(w);break;case Da.SimpleBezier:[S]=oE(w);break;case Da.Step:[S]=fg({...w,borderRadius:0});break;case Da.SmoothStep:[S]=fg(w);break;default:[S]=Dj(w)}return u.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:e})};bE.displayName="ConnectionLine";const U8={};function TS(e=U8){j.useRef(e),ot(),j.useEffect(()=>{},[e])}function $8(){ot(),j.useRef(!1),j.useEffect(()=>{},[])}function SE({nodeTypes:e,edgeTypes:t,onInit:s,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:l,onEdgeDoubleClick:d,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:h,onNodeContextMenu:v,onSelectionContextMenu:g,onSelectionStart:y,onSelectionEnd:b,connectionLineType:S,connectionLineStyle:w,connectionLineComponent:N,connectionLineContainerStyle:C,selectionKeyCode:T,selectionOnDrag:_,selectionMode:R,multiSelectionKeyCode:O,panActivationKeyCode:B,zoomActivationKeyCode:L,deleteKeyCode:M,onlyRenderVisibleElements:I,elementsSelectable:H,defaultViewport:D,translateExtent:Y,minZoom:K,maxZoom:U,preventScrolling:q,defaultMarkerColor:A,zoomOnScroll:$,zoomOnPinch:z,panOnScroll:G,panOnScrollSpeed:V,panOnScrollMode:P,zoomOnDoubleClick:Q,panOnDrag:ee,onPaneClick:se,onPaneMouseEnter:oe,onPaneMouseMove:ce,onPaneMouseLeave:fe,onPaneScroll:ue,onPaneContextMenu:he,paneClickDistance:Ce,nodeClickDistance:Se,onEdgeContextMenu:ye,onEdgeMouseEnter:ve,onEdgeMouseMove:de,onEdgeMouseLeave:Ae,reconnectRadius:Re,onReconnect:Be,onReconnectStart:St,onReconnectEnd:dt,noDragClassName:fn,noWheelClassName:jn,noPanClassName:ps,disableKeyboardA11y:Fn,nodeExtent:Me,rfId:ft,viewport:kt,onViewportChange:Xn}){return TS(e),TS(t),$8(),O8(s),L8(kt),u.jsx(s8,{onPaneClick:se,onPaneMouseEnter:oe,onPaneMouseMove:ce,onPaneMouseLeave:fe,onPaneContextMenu:he,onPaneScroll:ue,paneClickDistance:Ce,deleteKeyCode:M,selectionKeyCode:T,selectionOnDrag:_,selectionMode:R,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:O,panActivationKeyCode:B,zoomActivationKeyCode:L,elementsSelectable:H,zoomOnScroll:$,zoomOnPinch:z,zoomOnDoubleClick:Q,panOnScroll:G,panOnScrollSpeed:V,panOnScrollMode:P,panOnDrag:ee,defaultViewport:D,translateExtent:Y,minZoom:K,maxZoom:U,onSelectionContextMenu:g,preventScrolling:q,noDragClassName:fn,noWheelClassName:jn,noPanClassName:ps,disableKeyboardA11y:Fn,onViewportChange:Xn,isControlledViewport:!!kt,children:u.jsxs(k8,{children:[u.jsx(A8,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:d,onReconnect:Be,onReconnectStart:St,onReconnectEnd:dt,onlyRenderVisibleElements:I,onEdgeContextMenu:ye,onEdgeMouseEnter:ve,onEdgeMouseMove:de,onEdgeMouseLeave:Ae,reconnectRadius:Re,defaultMarkerColor:A,noPanClassName:ps,disableKeyboardA11y:Fn,rfId:ft}),u.jsx(H8,{style:w,type:S,component:N,containerStyle:C}),u.jsx("div",{className:"react-flow__edgelabel-renderer"}),u.jsx(f8,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:l,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:h,onNodeContextMenu:v,nodeClickDistance:Se,onlyRenderVisibleElements:I,noPanClassName:ps,noDragClassName:fn,disableKeyboardA11y:Fn,nodeExtent:Me,rfId:ft}),u.jsx("div",{className:"react-flow__viewport-portal"})]})})}SE.displayName="GraphView";const q8=j.memo(SE),AS=({nodes:e,edges:t,defaultNodes:s,defaultEdges:r,width:i,height:l,fitView:d,fitViewOptions:f,minZoom:m=.5,maxZoom:h=2,nodeOrigin:v,nodeExtent:g,zIndexMode:y="basic"}={})=>{const b=new Map,S=new Map,w=new Map,N=new Map,C=r??t??[],T=s??e??[],_=v??[0,0],R=g??sc;Pj(w,N,C);const O=mg(T,b,S,{nodeOrigin:_,nodeExtent:R,zIndexMode:y});let B=[0,0,1];if(d&&i&&l){const L=Sc(b,{filter:D=>!!((D.width||D.initialWidth)&&(D.height||D.initialHeight))}),{x:M,y:I,zoom:H}=n0(L,i,l,m,h,(f==null?void 0:f.padding)??.1);B=[M,I,H]}return{rfId:"1",width:i??0,height:l??0,transform:B,nodes:T,nodesInitialized:O,nodeLookup:b,parentLookup:S,edges:C,edgeLookup:N,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:s!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:m,maxZoom:h,translateExtent:sc,nodeExtent:R,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:bo.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:_,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:d??!1,fitViewOptions:f,fitViewResolver:null,connection:{...vj},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:lL,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:yj,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},V8=({nodes:e,edges:t,defaultNodes:s,defaultEdges:r,width:i,height:l,fitView:d,fitViewOptions:f,minZoom:m,maxZoom:h,nodeOrigin:v,nodeExtent:g,zIndexMode:y})=>iz((b,S)=>{async function w(){const{nodeLookup:N,panZoom:C,fitViewOptions:T,fitViewResolver:_,width:R,height:O,minZoom:B,maxZoom:L}=S();C&&(await iL({nodes:N,width:R,height:O,panZoom:C,minZoom:B,maxZoom:L},T),_==null||_.resolve(!0),b({fitViewResolver:null}))}return{...AS({nodes:e,edges:t,width:i,height:l,fitView:d,fitViewOptions:f,minZoom:m,maxZoom:h,nodeOrigin:v,nodeExtent:g,defaultNodes:s,defaultEdges:r,zIndexMode:y}),setNodes:N=>{const{nodeLookup:C,parentLookup:T,nodeOrigin:_,elevateNodesOnSelect:R,fitViewQueued:O,zIndexMode:B}=S(),L=mg(N,C,T,{nodeOrigin:_,nodeExtent:g,elevateNodesOnSelect:R,checkEquality:!0,zIndexMode:B});O&&L?(w(),b({nodes:N,nodesInitialized:L,fitViewQueued:!1,fitViewOptions:void 0})):b({nodes:N,nodesInitialized:L})},setEdges:N=>{const{connectionLookup:C,edgeLookup:T}=S();Pj(C,T,N),b({edges:N})},setDefaultNodesAndEdges:(N,C)=>{if(N){const{setNodes:T}=S();T(N),b({hasDefaultNodes:!0})}if(C){const{setEdges:T}=S();T(C),b({hasDefaultEdges:!0})}},updateNodeInternals:N=>{const{triggerNodeChanges:C,nodeLookup:T,parentLookup:_,domNode:R,nodeOrigin:O,nodeExtent:B,debug:L,fitViewQueued:M,zIndexMode:I}=S(),{changes:H,updatedInternals:D}=AL(N,T,_,R,O,B,I);D&&(CL(T,_,{nodeOrigin:O,nodeExtent:B,zIndexMode:I}),M?(w(),b({fitViewQueued:!1,fitViewOptions:void 0})):b({}),(H==null?void 0:H.length)>0&&(L&&console.log("React Flow: trigger node changes",H),C==null||C(H)))},updateNodePositions:(N,C=!1)=>{const T=[];let _=[];const{nodeLookup:R,triggerNodeChanges:O,connection:B,updateConnection:L,onNodesChangeMiddlewareMap:M}=S();for(const[I,H]of N){const D=R.get(I),Y=!!(D!=null&&D.expandParent&&(D!=null&&D.parentId)&&(H!=null&&H.position)),K={id:I,type:"position",position:Y?{x:Math.max(0,H.position.x),y:Math.max(0,H.position.y)}:H.position,dragging:C};if(D&&B.inProgress&&B.fromNode.id===D.id){const U=ni(D,B.fromHandle,we.Left,!0);L({...B,from:U})}Y&&D.parentId&&T.push({id:I,parentId:D.parentId,rect:{...H.internals.positionAbsolute,width:H.measured.width??0,height:H.measured.height??0}}),_.push(K)}if(T.length>0){const{parentLookup:I,nodeOrigin:H}=S(),D=l0(T,R,I,H);_.push(...D)}for(const I of M.values())_=I(_);O(_)},triggerNodeChanges:N=>{const{onNodesChange:C,setNodes:T,nodes:_,hasDefaultNodes:R,debug:O}=S();if(N!=null&&N.length){if(R){const B=_z(N,_);T(B)}O&&console.log("React Flow: trigger node changes",N),C==null||C(N)}},triggerEdgeChanges:N=>{const{onEdgesChange:C,setEdges:T,edges:_,hasDefaultEdges:R,debug:O}=S();if(N!=null&&N.length){if(R){const B=Rz(N,_);T(B)}O&&console.log("React Flow: trigger edge changes",N),C==null||C(N)}},addSelectedNodes:N=>{const{multiSelectionActive:C,edgeLookup:T,nodeLookup:_,triggerNodeChanges:R,triggerEdgeChanges:O}=S();if(C){const B=N.map(L=>Rr(L,!0));R(B);return}R(Ji(_,new Set([...N]),!0)),O(Ji(T))},addSelectedEdges:N=>{const{multiSelectionActive:C,edgeLookup:T,nodeLookup:_,triggerNodeChanges:R,triggerEdgeChanges:O}=S();if(C){const B=N.map(L=>Rr(L,!0));O(B);return}O(Ji(T,new Set([...N]))),R(Ji(_,new Set,!0))},unselectNodesAndEdges:({nodes:N,edges:C}={})=>{const{edges:T,nodes:_,nodeLookup:R,triggerNodeChanges:O,triggerEdgeChanges:B}=S(),L=N||_,M=C||T,I=[];for(const D of L){if(!D.selected)continue;const Y=R.get(D.id);Y&&(Y.selected=!1),I.push(Rr(D.id,!1))}const H=[];for(const D of M)D.selected&&H.push(Rr(D.id,!1));O(I),B(H)},setMinZoom:N=>{const{panZoom:C,maxZoom:T}=S();C==null||C.setScaleExtent([N,T]),b({minZoom:N})},setMaxZoom:N=>{const{panZoom:C,minZoom:T}=S();C==null||C.setScaleExtent([T,N]),b({maxZoom:N})},setTranslateExtent:N=>{var C;(C=S().panZoom)==null||C.setTranslateExtent(N),b({translateExtent:N})},resetSelectedElements:()=>{const{edges:N,nodes:C,triggerNodeChanges:T,triggerEdgeChanges:_,elementsSelectable:R}=S();if(!R)return;const O=C.reduce((L,M)=>M.selected?[...L,Rr(M.id,!1)]:L,[]),B=N.reduce((L,M)=>M.selected?[...L,Rr(M.id,!1)]:L,[]);T(O),_(B)},setNodeExtent:N=>{const{nodes:C,nodeLookup:T,parentLookup:_,nodeOrigin:R,elevateNodesOnSelect:O,nodeExtent:B,zIndexMode:L}=S();N[0][0]===B[0][0]&&N[0][1]===B[0][1]&&N[1][0]===B[1][0]&&N[1][1]===B[1][1]||(mg(C,T,_,{nodeOrigin:R,nodeExtent:N,elevateNodesOnSelect:O,checkEquality:!1,zIndexMode:L}),b({nodeExtent:N}))},panBy:N=>{const{transform:C,width:T,height:_,panZoom:R,translateExtent:O}=S();return ML({delta:N,panZoom:R,transform:C,translateExtent:O,width:T,height:_})},setCenter:async(N,C,T)=>{const{width:_,height:R,maxZoom:O,panZoom:B}=S();if(!B)return Promise.resolve(!1);const L=typeof(T==null?void 0:T.zoom)<"u"?T.zoom:O;return await B.setViewport({x:_/2-N*L,y:R/2-C*L,zoom:L},{duration:T==null?void 0:T.duration,ease:T==null?void 0:T.ease,interpolate:T==null?void 0:T.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{b({connection:{...vj}})},updateConnection:N=>{b({connection:N})},reset:()=>b({...AS()})}},Object.is);function G8({initialNodes:e,initialEdges:t,defaultNodes:s,defaultEdges:r,initialWidth:i,initialHeight:l,initialMinZoom:d,initialMaxZoom:f,initialFitViewOptions:m,fitView:h,nodeOrigin:v,nodeExtent:g,zIndexMode:y,children:b}){const[S]=j.useState(()=>V8({nodes:e,edges:t,defaultNodes:s,defaultEdges:r,width:i,height:l,fitView:h,minZoom:d,maxZoom:f,fitViewOptions:m,nodeOrigin:v,nodeExtent:g,zIndexMode:y}));return u.jsx(oz,{value:S,children:u.jsx(kz,{children:b})})}function Y8({children:e,nodes:t,edges:s,defaultNodes:r,defaultEdges:i,width:l,height:d,fitView:f,fitViewOptions:m,minZoom:h,maxZoom:v,nodeOrigin:g,nodeExtent:y,zIndexMode:b}){return j.useContext(Nf)?u.jsx(u.Fragment,{children:e}):u.jsx(G8,{initialNodes:t,initialEdges:s,defaultNodes:r,defaultEdges:i,initialWidth:l,initialHeight:d,fitView:f,initialFitViewOptions:m,initialMinZoom:h,initialMaxZoom:v,nodeOrigin:g,nodeExtent:y,zIndexMode:b,children:e})}const Q8={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function K8({nodes:e,edges:t,defaultNodes:s,defaultEdges:r,className:i,nodeTypes:l,edgeTypes:d,onNodeClick:f,onEdgeClick:m,onInit:h,onMove:v,onMoveStart:g,onMoveEnd:y,onConnect:b,onConnectStart:S,onConnectEnd:w,onClickConnectStart:N,onClickConnectEnd:C,onNodeMouseEnter:T,onNodeMouseMove:_,onNodeMouseLeave:R,onNodeContextMenu:O,onNodeDoubleClick:B,onNodeDragStart:L,onNodeDrag:M,onNodeDragStop:I,onNodesDelete:H,onEdgesDelete:D,onDelete:Y,onSelectionChange:K,onSelectionDragStart:U,onSelectionDrag:q,onSelectionDragStop:A,onSelectionContextMenu:$,onSelectionStart:z,onSelectionEnd:G,onBeforeDelete:V,connectionMode:P,connectionLineType:Q=Da.Bezier,connectionLineStyle:ee,connectionLineComponent:se,connectionLineContainerStyle:oe,deleteKeyCode:ce="Backspace",selectionKeyCode:fe="Shift",selectionOnDrag:ue=!1,selectionMode:he=ac.Full,panActivationKeyCode:Ce="Space",multiSelectionKeyCode:Se=oc()?"Meta":"Control",zoomActivationKeyCode:ye=oc()?"Meta":"Control",snapToGrid:ve,snapGrid:de,onlyRenderVisibleElements:Ae=!1,selectNodesOnDrag:Re,nodesDraggable:Be,autoPanOnNodeFocus:St,nodesConnectable:dt,nodesFocusable:fn,nodeOrigin:jn=Xj,edgesFocusable:ps,edgesReconnectable:Fn,elementsSelectable:Me=!0,defaultViewport:ft=bz,minZoom:kt=.5,maxZoom:Xn=2,translateExtent:nr=sc,preventScrolling:Rf=!0,nodeExtent:ri,defaultMarkerColor:Tf="#b1b1b7",zoomOnScroll:Af=!0,zoomOnPinch:sr=!0,panOnScroll:$t=!1,panOnScrollSpeed:Zn=.5,panOnScrollMode:qt=Fr.Free,zoomOnDoubleClick:Mf=!0,panOnDrag:kf=!0,onPaneClick:Of,onPaneMouseEnter:ii,onPaneMouseMove:oi,onPaneMouseLeave:li,onPaneScroll:gs,onPaneContextMenu:ci,paneClickDistance:ar=1,nodeClickDistance:Df=0,children:jc,onReconnect:_o,onReconnectStart:rr,onReconnectEnd:Lf,onEdgeContextMenu:Ec,onEdgeDoubleClick:Cc,onEdgeMouseEnter:_c,onEdgeMouseMove:Ro,onEdgeMouseLeave:To,reconnectRadius:Rc=10,onNodesChange:Tc,onEdgesChange:Wn,noDragClassName:wt="nodrag",noWheelClassName:It="nowheel",noPanClassName:xs="nopan",fitView:ui,fitViewOptions:Ac,connectOnClick:zf,attributionPosition:Mc,proOptions:ir,defaultEdgeOptions:Ao,elevateNodesOnSelect:Ws=!0,elevateEdgesOnSelect:Js=!1,disableKeyboardA11y:ea=!1,autoPanOnConnect:ta,autoPanOnNodeDrag:pt,autoPanSpeed:kc,connectionRadius:Oc,isValidConnection:ys,onError:na,style:Pf,id:Mo,nodeDragThreshold:Dc,connectionDragThreshold:If,viewport:di,onViewportChange:fi,width:zn,height:Zt,colorMode:Lc="light",debug:Bf,onScroll:sa,ariaLabelConfig:zc,zIndexMode:or="basic",...Hf},Wt){const lr=Mo||"1",Pc=jz(Lc),ko=j.useCallback(vs=>{vs.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),sa==null||sa(vs)},[sa]);return u.jsx("div",{"data-testid":"rf__wrapper",...Hf,onScroll:ko,style:{...Pf,...Q8},ref:Wt,className:bt(["react-flow",i,Pc]),id:Mo,role:"application",children:u.jsxs(Y8,{nodes:e,edges:t,width:zn,height:Zt,fitView:ui,fitViewOptions:Ac,minZoom:kt,maxZoom:Xn,nodeOrigin:jn,nodeExtent:ri,zIndexMode:or,children:[u.jsx(q8,{onInit:h,onNodeClick:f,onEdgeClick:m,onNodeMouseEnter:T,onNodeMouseMove:_,onNodeMouseLeave:R,onNodeContextMenu:O,onNodeDoubleClick:B,nodeTypes:l,edgeTypes:d,connectionLineType:Q,connectionLineStyle:ee,connectionLineComponent:se,connectionLineContainerStyle:oe,selectionKeyCode:fe,selectionOnDrag:ue,selectionMode:he,deleteKeyCode:ce,multiSelectionKeyCode:Se,panActivationKeyCode:Ce,zoomActivationKeyCode:ye,onlyRenderVisibleElements:Ae,defaultViewport:ft,translateExtent:nr,minZoom:kt,maxZoom:Xn,preventScrolling:Rf,zoomOnScroll:Af,zoomOnPinch:sr,zoomOnDoubleClick:Mf,panOnScroll:$t,panOnScrollSpeed:Zn,panOnScrollMode:qt,panOnDrag:kf,onPaneClick:Of,onPaneMouseEnter:ii,onPaneMouseMove:oi,onPaneMouseLeave:li,onPaneScroll:gs,onPaneContextMenu:ci,paneClickDistance:ar,nodeClickDistance:Df,onSelectionContextMenu:$,onSelectionStart:z,onSelectionEnd:G,onReconnect:_o,onReconnectStart:rr,onReconnectEnd:Lf,onEdgeContextMenu:Ec,onEdgeDoubleClick:Cc,onEdgeMouseEnter:_c,onEdgeMouseMove:Ro,onEdgeMouseLeave:To,reconnectRadius:Rc,defaultMarkerColor:Tf,noDragClassName:wt,noWheelClassName:It,noPanClassName:xs,rfId:lr,disableKeyboardA11y:ea,nodeExtent:ri,viewport:di,onViewportChange:fi}),u.jsx(Nz,{nodes:e,edges:t,defaultNodes:s,defaultEdges:r,onConnect:b,onConnectStart:S,onConnectEnd:w,onClickConnectStart:N,onClickConnectEnd:C,nodesDraggable:Be,autoPanOnNodeFocus:St,nodesConnectable:dt,nodesFocusable:fn,edgesFocusable:ps,edgesReconnectable:Fn,elementsSelectable:Me,elevateNodesOnSelect:Ws,elevateEdgesOnSelect:Js,minZoom:kt,maxZoom:Xn,nodeExtent:ri,onNodesChange:Tc,onEdgesChange:Wn,snapToGrid:ve,snapGrid:de,connectionMode:P,translateExtent:nr,connectOnClick:zf,defaultEdgeOptions:Ao,fitView:ui,fitViewOptions:Ac,onNodesDelete:H,onEdgesDelete:D,onDelete:Y,onNodeDragStart:L,onNodeDrag:M,onNodeDragStop:I,onSelectionDrag:q,onSelectionDragStart:U,onSelectionDragStop:A,onMove:v,onMoveStart:g,onMoveEnd:y,noPanClassName:xs,nodeOrigin:jn,rfId:lr,autoPanOnConnect:ta,autoPanOnNodeDrag:pt,autoPanSpeed:kc,onError:na,connectionRadius:Oc,isValidConnection:ys,selectNodesOnDrag:Re,nodeDragThreshold:Dc,connectionDragThreshold:If,onBeforeDelete:V,debug:Bf,ariaLabelConfig:zc,zIndexMode:or}),u.jsx(vz,{onSelectionChange:K}),jc,u.jsx(mz,{proOptions:ir,position:Mc}),u.jsx(hz,{rfId:lr,disableKeyboardA11y:ea})]})})}var wE=Wj(K8);function F8({dimensions:e,lineWidth:t,variant:s,className:r}){return u.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:bt(["react-flow__background-pattern",s,r])})}function X8({radius:e,className:t}){return u.jsx("circle",{cx:e,cy:e,r:e,className:bt(["react-flow__background-pattern","dots",t])})}var Za;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Za||(Za={}));const Z8={[Za.Dots]:1,[Za.Lines]:1,[Za.Cross]:6},W8=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function NE({id:e,variant:t=Za.Dots,gap:s=20,size:r,lineWidth:i=1,offset:l=0,color:d,bgColor:f,style:m,className:h,patternClassName:v}){const g=j.useRef(null),{transform:y,patternId:b}=Ve(W8,it),S=r||Z8[t],w=t===Za.Dots,N=t===Za.Cross,C=Array.isArray(s)?s:[s,s],T=[C[0]*y[2]||1,C[1]*y[2]||1],_=S*y[2],R=Array.isArray(l)?l:[l,l],O=N?[_,_]:T,B=[R[0]*y[2]||1+O[0]/2,R[1]*y[2]||1+O[1]/2],L=`${b}${e||""}`;return u.jsxs("svg",{className:bt(["react-flow__background",h]),style:{...m,...Ef,"--xy-background-color-props":f,"--xy-background-pattern-color-props":d},ref:g,"data-testid":"rf__background",children:[u.jsx("pattern",{id:L,x:y[0]%T[0],y:y[1]%T[1],width:T[0],height:T[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${B[0]},-${B[1]})`,children:w?u.jsx(X8,{radius:_/2,className:v}):u.jsx(F8,{dimensions:O,lineWidth:i,variant:t,className:v})}),u.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${L})`})]})}NE.displayName="Background";const J8=j.memo(NE);function e6(){return u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:u.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function t6(){return u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:u.jsx("path",{d:"M0 0h32v4.2H0z"})})}function n6(){return u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:u.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function s6(){return u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:u.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function a6(){return u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:u.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function vd({children:e,className:t,...s}){return u.jsx("button",{type:"button",className:bt(["react-flow__controls-button",t]),...s,children:e})}const r6=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function jE({style:e,showZoom:t=!0,showFitView:s=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:l,onZoomOut:d,onFitView:f,onInteractiveChange:m,className:h,children:v,position:g="bottom-left",orientation:y="vertical","aria-label":b}){const S=ot(),{isInteractive:w,minZoomReached:N,maxZoomReached:C,ariaLabelConfig:T}=Ve(r6,it),{zoomIn:_,zoomOut:R,fitView:O}=c0(),B=()=>{_(),l==null||l()},L=()=>{R(),d==null||d()},M=()=>{O(i),f==null||f()},I=()=>{S.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),m==null||m(!w)},H=y==="horizontal"?"horizontal":"vertical";return u.jsxs(jf,{className:bt(["react-flow__controls",H,h]),position:g,style:e,"data-testid":"rf__controls","aria-label":b??T["controls.ariaLabel"],children:[t&&u.jsxs(u.Fragment,{children:[u.jsx(vd,{onClick:B,className:"react-flow__controls-zoomin",title:T["controls.zoomIn.ariaLabel"],"aria-label":T["controls.zoomIn.ariaLabel"],disabled:C,children:u.jsx(e6,{})}),u.jsx(vd,{onClick:L,className:"react-flow__controls-zoomout",title:T["controls.zoomOut.ariaLabel"],"aria-label":T["controls.zoomOut.ariaLabel"],disabled:N,children:u.jsx(t6,{})})]}),s&&u.jsx(vd,{className:"react-flow__controls-fitview",onClick:M,title:T["controls.fitView.ariaLabel"],"aria-label":T["controls.fitView.ariaLabel"],children:u.jsx(n6,{})}),r&&u.jsx(vd,{className:"react-flow__controls-interactive",onClick:I,title:T["controls.interactive.ariaLabel"],"aria-label":T["controls.interactive.ariaLabel"],children:w?u.jsx(a6,{}):u.jsx(s6,{})}),v]})}jE.displayName="Controls";const EE=j.memo(jE);function i6({id:e,x:t,y:s,width:r,height:i,style:l,color:d,strokeColor:f,strokeWidth:m,className:h,borderRadius:v,shapeRendering:g,selected:y,onClick:b}){const{background:S,backgroundColor:w}=l||{},N=d||S||w;return u.jsx("rect",{className:bt(["react-flow__minimap-node",{selected:y},h]),x:t,y:s,rx:v,ry:v,width:r,height:i,style:{fill:N,stroke:f,strokeWidth:m},shapeRendering:g,onClick:b?C=>b(C,e):void 0})}const o6=j.memo(i6),l6=e=>e.nodes.map(t=>t.id),Mp=e=>e instanceof Function?e:()=>e;function c6({nodeStrokeColor:e,nodeColor:t,nodeClassName:s="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:l=o6,onClick:d}){const f=Ve(l6,it),m=Mp(t),h=Mp(e),v=Mp(s),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return u.jsx(u.Fragment,{children:f.map(y=>u.jsx(d6,{id:y,nodeColorFunc:m,nodeStrokeColorFunc:h,nodeClassNameFunc:v,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:l,onClick:d,shapeRendering:g},y))})}function u6({id:e,nodeColorFunc:t,nodeStrokeColorFunc:s,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:l,shapeRendering:d,NodeComponent:f,onClick:m}){const{node:h,x:v,y:g,width:y,height:b}=Ve(S=>{const w=S.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const N=w.internals.userNode,{x:C,y:T}=w.internals.positionAbsolute,{width:_,height:R}=Zs(N);return{node:N,x:C,y:T,width:_,height:R}},it);return!h||h.hidden||!Cj(h)?null:u.jsx(f,{x:v,y:g,width:y,height:b,style:h.style,selected:!!h.selected,className:r(h),color:t(h),borderRadius:i,strokeColor:s(h),strokeWidth:l,shapeRendering:d,onClick:m,id:h.id})}const d6=j.memo(u6);var f6=j.memo(c6);const h6=200,m6=150,p6=e=>!e.hidden,g6=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Ej(Sc(e.nodeLookup,{filter:p6}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},x6="react-flow__minimap-desc";function CE({style:e,className:t,nodeStrokeColor:s,nodeColor:r,nodeClassName:i="",nodeBorderRadius:l=5,nodeStrokeWidth:d,nodeComponent:f,bgColor:m,maskColor:h,maskStrokeColor:v,maskStrokeWidth:g,position:y="bottom-right",onClick:b,onNodeClick:S,pannable:w=!1,zoomable:N=!1,ariaLabel:C,inversePan:T,zoomStep:_=1,offsetScale:R=5}){const O=ot(),B=j.useRef(null),{boundingRect:L,viewBB:M,rfId:I,panZoom:H,translateExtent:D,flowWidth:Y,flowHeight:K,ariaLabelConfig:U}=Ve(g6,it),q=(e==null?void 0:e.width)??h6,A=(e==null?void 0:e.height)??m6,$=L.width/q,z=L.height/A,G=Math.max($,z),V=G*q,P=G*A,Q=R*G,ee=L.x-(V-L.width)/2-Q,se=L.y-(P-L.height)/2-Q,oe=V+Q*2,ce=P+Q*2,fe=`${x6}-${I}`,ue=j.useRef(0),he=j.useRef();ue.current=G,j.useEffect(()=>{if(B.current&&H)return he.current=HL({domNode:B.current,panZoom:H,getTransform:()=>O.getState().transform,getViewScale:()=>ue.current}),()=>{var ve;(ve=he.current)==null||ve.destroy()}},[H]),j.useEffect(()=>{var ve;(ve=he.current)==null||ve.update({translateExtent:D,width:Y,height:K,inversePan:T,pannable:w,zoomStep:_,zoomable:N})},[w,N,T,_,D,Y,K]);const Ce=b?ve=>{var Re;const[de,Ae]=((Re=he.current)==null?void 0:Re.pointer(ve))||[0,0];b(ve,{x:de,y:Ae})}:void 0,Se=S?j.useCallback((ve,de)=>{const Ae=O.getState().nodeLookup.get(de).internals.userNode;S(ve,Ae)},[]):void 0,ye=C??U["minimap.ariaLabel"];return u.jsx(jf,{position:y,style:{...e,"--xy-minimap-background-color-props":typeof m=="string"?m:void 0,"--xy-minimap-mask-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-color-props":typeof v=="string"?v:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*G:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof s=="string"?s:void 0,"--xy-minimap-node-stroke-width-props":typeof d=="number"?d:void 0},className:bt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:u.jsxs("svg",{width:q,height:A,viewBox:`${ee} ${se} ${oe} ${ce}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":fe,ref:B,onClick:Ce,children:[ye&&u.jsx("title",{id:fe,children:ye}),u.jsx(f6,{onClick:Se,nodeColor:r,nodeStrokeColor:s,nodeBorderRadius:l,nodeClassName:i,nodeStrokeWidth:d,nodeComponent:f}),u.jsx("path",{className:"react-flow__minimap-mask",d:`M${ee-Q},${se-Q}h${oe+Q*2}v${ce+Q*2}h${-oe-Q*2}z
221
- M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}CE.displayName="MiniMap";j.memo(CE);const y6=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,v6={[jo.Line]:"right",[jo.Handle]:"bottom-right"};function b6({nodeId:e,position:t,variant:s=jo.Handle,className:r,style:i=void 0,children:l,color:d,minWidth:f=10,minHeight:m=10,maxWidth:h=Number.MAX_VALUE,maxHeight:v=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:y,autoScale:b=!0,shouldResize:S,onResizeStart:w,onResize:N,onResizeEnd:C}){const T=nE(),_=typeof e=="string"?e:T,R=ot(),O=j.useRef(null),B=s===jo.Handle,L=Ve(j.useCallback(y6(B&&b),[B,b]),it),M=j.useRef(null),I=t??v6[s];j.useEffect(()=>{if(!(!O.current||!_))return M.current||(M.current=ez({domNode:O.current,nodeId:_,getStoreItems:()=>{const{nodeLookup:D,transform:Y,snapGrid:K,snapToGrid:U,nodeOrigin:q,domNode:A}=R.getState();return{nodeLookup:D,transform:Y,snapGrid:K,snapToGrid:U,nodeOrigin:q,paneDomNode:A}},onChange:(D,Y)=>{const{triggerNodeChanges:K,nodeLookup:U,parentLookup:q,nodeOrigin:A}=R.getState(),$=[],z={x:D.x,y:D.y},G=U.get(_);if(G&&G.expandParent&&G.parentId){const V=G.origin??A,P=D.width??G.measured.width??0,Q=D.height??G.measured.height??0,ee={id:G.id,parentId:G.parentId,rect:{width:P,height:Q,..._j({x:D.x??G.position.x,y:D.y??G.position.y},{width:P,height:Q},G.parentId,U,V)}},se=l0([ee],U,q,A);$.push(...se),z.x=D.x?Math.max(V[0]*P,D.x):void 0,z.y=D.y?Math.max(V[1]*Q,D.y):void 0}if(z.x!==void 0&&z.y!==void 0){const V={id:_,type:"position",position:{...z}};$.push(V)}if(D.width!==void 0&&D.height!==void 0){const P={id:_,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:D.width,height:D.height}};$.push(P)}for(const V of Y){const P={...V,type:"position"};$.push(P)}K($)},onEnd:({width:D,height:Y})=>{const K={id:_,type:"dimensions",resizing:!1,dimensions:{width:D,height:Y}};R.getState().triggerNodeChanges([K])}})),M.current.update({controlPosition:I,boundaries:{minWidth:f,minHeight:m,maxWidth:h,maxHeight:v},keepAspectRatio:g,resizeDirection:y,onResizeStart:w,onResize:N,onResizeEnd:C,shouldResize:S}),()=>{var D;(D=M.current)==null||D.destroy()}},[I,f,m,h,v,g,w,N,C,S]);const H=I.split("-");return u.jsx("div",{className:bt(["react-flow__resize-control","nodrag",...H,s,r]),ref:O,style:{...i,scale:L,...d&&{[B?"backgroundColor":"borderColor"]:d}},children:l})}j.memo(b6);async function S6(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/graph`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function w6(e){return Tt({queryKey:["rig",e,"graph"],queryFn:()=>S6(e),enabled:!!e,refetchInterval:3e4})}const N6=100;function j6(e){const t=Ct(),[s,r]=j.useState(!1),[i,l]=j.useState(!1),d=j.useRef(!1),f=j.useRef(null),m=j.useCallback(()=>{e&&(f.current||(f.current=setTimeout(()=>{f.current=null,t.invalidateQueries({queryKey:["rig",e,"graph"]})},N6)))},[e,t]);return j.useEffect(()=>{if(!e){r(!1),l(!1);return}d.current=!1,r(!1),l(!1);const h=new EventSource(`/api/events?rigId=${e}`);return h.addEventListener("open",()=>{r(!0),d.current&&(l(!1),d.current=!1,m())}),h.addEventListener("message",()=>{m()}),h.addEventListener("error",()=>{r(!1),l(!0),d.current=!0}),()=>{h.close(),f.current&&(clearTimeout(f.current),f.current=null)}},[e,m]),{connected:s,reconnecting:i}}const Zi="#546073",kl={type:rc.ArrowClosed,color:Zi,width:12,height:12};function E6(e){switch(e){case"delegates_to":return{style:{stroke:Zi,strokeWidth:1.5},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:kl,label:void 0};case"spawned_by":return{style:{stroke:Zi,strokeWidth:1.5,strokeDasharray:"6 3"},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:kl,label:void 0};case"can_observe":return{style:{stroke:Zi,strokeWidth:1,strokeDasharray:"4 2"},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:kl,label:void 0};case"uses":return{style:{stroke:Zi,strokeWidth:1,strokeDasharray:"2 2"},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:kl,label:void 0};default:return{style:{stroke:Zi,strokeWidth:1},animated:!1,type:"smoothstep",pathOptions:{borderRadius:18,offset:20},markerEnd:kl,label:void 0}}}function MS(e){return e.type==="group"||e.type==="podGroup"}const d0=240,f0=160,sf=3,_E=36,RE=32,TE=28,AE=44,C6=28,_6=120,R6=0,T6=new Set(["delegates_to","spawned_by"]);function A6(e,t){if(e.length<=1)return e;const s=new Set(e.filter(h=>MS(h)).map(h=>h.id)),r=new Map;for(const h of e)typeof h.parentId!="string"||!s.has(h.parentId)||(r.has(h.parentId)||r.set(h.parentId,[]),r.get(h.parentId).push(h));const i=[],l=new Map;for(const h of e){if(MS(h)){const v=r.get(h.id)??[],{width:g,height:y}=k6(v.length);i.push({id:h.id,kind:"group",node:h,width:g,height:y,members:v}),l.set(h.id,h.id);for(const b of v)l.set(b.id,h.id);continue}typeof h.parentId=="string"&&s.has(h.parentId)||(i.push({id:h.id,kind:"standalone",node:h,width:d0,height:f0,members:[]}),l.set(h.id,h.id))}if(i.length===0)return e;const d=M6(t,l),f=L6(i,d),m=new Map;for(const h of e)m.set(h.id,{...h});for(const h of i){const v=f.get(h.id);if(!v)continue;if(h.kind==="standalone"){const y=m.get(h.node.id);y.position={x:v.x,y:v.y};continue}const g=m.get(h.node.id);g.position={x:v.x,y:v.y},g.initialWidth=h.width,g.initialHeight=h.height,g.style={...g.style??{},width:h.width,height:h.height,background:"linear-gradient(180deg, rgba(84, 96, 115, 0.08) 0px, rgba(84, 96, 115, 0.08) 32px, rgba(255, 255, 255, 0.22) 32px, rgba(255, 255, 255, 0.22) 100%)",border:"1px dashed rgba(84, 96, 115, 0.45)",boxShadow:"0 0 0 1px rgba(84, 96, 115, 0.10)"};for(let y=0;y<h.members.length;y+=1){const b=h.members[y],S=m.get(b.id);S.position=O6(y)}}return e.map(h=>m.get(h.id)??h)}function M6(e,t){const s=kS(e.filter(r=>T6.has(D6(r))),t);return s.length>0?s:kS(e,t)}function kS(e,t){const s=new Map;for(const r of e){const i=t.get(r.source),l=t.get(r.target);if(!i||!l||i===l)continue;const d=`${i}->${l}`;s.has(d)||s.set(d,{source:i,target:l})}return Array.from(s.values())}function k6(e){const t=Math.max(e,1),s=Math.min(t,sf),r=Math.ceil(t/sf),i=s*d0+Math.max(s-1,0)*_E,l=r*f0+Math.max(r-1,0)*RE;return{width:i+TE*2,height:l+AE+C6}}function O6(e){const t=e%sf,s=Math.floor(e/sf);return{x:TE+t*(d0+_E),y:AE+s*(f0+RE)}}function D6(e){var t;return((t=e.data)==null?void 0:t.kind)??e.label??""}function L6(e,t){const s=new Map(e.map(b=>[b.id,b])),r=new Map,i=new Map,l=[],d=new Set;for(const b of e)r.set(b.id,new Set),i.set(b.id,0);for(const b of t)!s.has(b.source)||!s.has(b.target)||r.get(b.source).has(b.target)||(r.get(b.source).add(b.target),i.set(b.target,(i.get(b.target)??0)+1));const f=e.filter(b=>{var S;return(i.get(b.id)??0)===0&&(((S=r.get(b.id))==null?void 0:S.size)??0)>0}).map(b=>b.id).sort((b,S)=>bd(b,S,r,e)),m=e.filter(b=>{var S;return(i.get(b.id)??0)===0&&(((S=r.get(b.id))==null?void 0:S.size)??0)===0}).map(b=>b.id).sort((b,S)=>bd(b,S,r,e)),h=b=>{const S=new Map(i),w=[...b],N=new Set(w);for(;w.length>0;){const C=w.shift();if(d.has(C))continue;d.add(C),l.push(C);const T=Array.from(r.get(C)??[]).sort((R,O)=>bd(R,O,r,e));for(const R of T)S.set(R,(S.get(R)??1)-1);const _=T.filter(R=>(S.get(R)??0)===0&&!d.has(R)&&!N.has(R));for(const R of _)w.push(R),N.add(R)}};h(f),h(m);const v=e.map(b=>b.id).filter(b=>!d.has(b)).sort((b,S)=>bd(b,S,r,e));l.push(...v);const g=new Map;let y=0;for(const b of l){const S=s.get(b);S&&(g.set(S.id,{x:R6,y}),y+=S.height+_6)}return g}function bd(e,t,s,r){var d,f;const i=((d=s.get(e))==null?void 0:d.size)??0,l=((f=s.get(t))==null?void 0:f.size)??0;return i!==l?l-i:r.findIndex(m=>m.id===e)-r.findIndex(m=>m.id===t)}function z6(e){return e==="architect"||e==="lead"||e==="orchestrator"}function P6(e){switch(e){case"ready":return"ready";case"pending":return"launching";case"failed":return"failed";default:return"stopped"}}function I6(e){switch(e){case"ready":return"bg-green-500";case"pending":return"bg-amber-500";case"failed":return"bg-red-500";default:return"bg-stone-400"}}function B6({data:e}){var O,B,L,M,I;const t=j.useRef(e.startupStatus),s=j.useRef(null),[r,i]=j.useState(!1),[l,d]=j.useState(null),f=z6(e.role),m=e.nodeKind==="infrastructure";j.useEffect(()=>{if(t.current!==e.startupStatus&&t.current!==null){i(!0);const H=setTimeout(()=>i(!1),600);return t.current=e.startupStatus,()=>clearTimeout(H)}t.current=e.startupStatus},[e.startupStatus]),j.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]);const h=[e.runtime,e.model].filter(Boolean).join(" · "),v=Qr(e.logicalId),g=P6(e.startupStatus),y=I6(e.startupStatus),b=e.placementState==="selected"?"target":e.placementState==="available"?"avail":null,S=[e.canonicalSessionName?`Session: ${e.canonicalSessionName}`:null,h?`Runtime: ${h}`:null,e.resolvedSpecName?`Spec: ${e.resolvedSpecName}`:null,e.profile?`Profile: ${e.profile}`:null,typeof e.edgeCount=="number"?`Edges: ${e.edgeCount}`:null].filter(H=>!!H),w=S.join(`
222
- `),N=H=>{s.current&&clearTimeout(s.current),d(H),s.current=setTimeout(()=>{d(D=>D===H?null:D),s.current=null},900)},C=async H=>{var Y;H.stopPropagation();const D=e.canonicalSessionName??((Y=e.binding)==null?void 0:Y.tmuxSession);D&&(await ds(`tmux attach -t ${D}`),N("attach"))},T=async H=>{var D;if(H.stopPropagation(),!(!((D=e.binding)!=null&&D.cmuxSurface)||!e.rigId))try{(await fetch(`/api/rigs/${encodeURIComponent(e.rigId)}/nodes/${encodeURIComponent(e.logicalId)}/focus`,{method:"POST"})).ok&&N("cmux")}catch{}},_=async H=>{H.stopPropagation(),e.resumeToken&&(e.runtime==="claude-code"?(await ds(`claude --resume ${e.resumeToken}`),N("resume")):e.runtime==="codex"&&(await ds(`codex resume ${e.resumeToken}`),N("resume")))},R=H=>`px-1.5 py-0.5 border font-mono text-[7px] uppercase transition-colors ${l===H?"bg-stone-900 text-white border-stone-900":"bg-white text-stone-900 border-stone-300 hover:bg-stone-100"}`;return u.jsxs("div",{className:`group bg-white border min-w-[200px] hard-shadow relative ${e.placementState==="selected"?"border-emerald-600 ring-2 ring-emerald-400/70 shadow-[0_0_0_3px_rgba(52,211,153,0.12)]":e.placementState==="available"?"border-emerald-500 ring-1 ring-emerald-300/70":"border-stone-900"}`,"data-testid":"rig-node",title:w||void 0,children:[u.jsx(Wa,{type:"target",position:we.Top}),u.jsxs("div",{className:`px-3 py-1 font-mono text-[10px] flex justify-between items-center ${m?"bg-stone-500 text-white border-b border-stone-900":f?"bg-stone-900 text-white":"bg-stone-200 text-stone-900 border-b border-stone-900"}`,children:[u.jsx("span",{className:"font-bold truncate",children:v}),u.jsx("span",{className:`inline-flex h-2.5 w-2.5 rounded-full border border-white/50 ${y} ${r?"status-changed":""}`,"data-testid":`status-dot-${e.logicalId}`,"aria-label":g,title:g})]}),u.jsxs("div",{className:"p-3 space-y-2",children:[h&&u.jsxs("div",{className:"font-mono text-[8px] text-stone-500",children:["RUNTIME: ",h]}),e.resolvedSpecName&&u.jsxs("div",{className:"font-mono text-[8px] text-stone-400","data-testid":"spec-hint",children:[e.resolvedSpecName,e.profile?` · ${e.profile}`:""]}),e.contextAvailability==="known"&&e.contextFresh&&typeof e.contextUsedPercentage=="number"?u.jsxs("div",{className:"font-mono text-[8px] text-stone-500","data-testid":"context-badge",children:["CTX ",e.contextUsedPercentage,"%"]}):u.jsx("div",{className:"font-mono text-[8px] text-stone-300","data-testid":"context-badge-unknown",children:"CTX unknown"}),e.restoreOutcome&&e.restoreOutcome!=="n-a"&&u.jsxs("div",{className:"font-mono text-[8px] text-stone-500",children:["RESTORE: ",e.restoreOutcome]}),e.packageRefs&&e.packageRefs.length>0&&u.jsxs("div",{"data-testid":"package-badge",title:e.packageRefs.join(", "),className:"font-mono text-[8px] text-stone-400",onClick:H=>H.stopPropagation(),onKeyDown:H=>H.stopPropagation(),children:["PKG ",e.packageRefs.length]}),e.startupStatus==="failed"&&u.jsxs("div",{className:"stamp-badge",children:[u.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500"}),u.jsx("span",{className:"text-red-600",children:"FAILED"})]}),(e.canonicalSessionName??((O=e.binding)==null?void 0:O.tmuxSession)??e.resumeToken??((B=e.binding)==null?void 0:B.cmuxSurface))&&u.jsxs("div",{"data-testid":"node-toolbar",className:"flex flex-wrap gap-1 pt-1",onClick:H=>H.stopPropagation(),onKeyDown:H=>H.stopPropagation(),children:[(e.canonicalSessionName??((L=e.binding)==null?void 0:L.tmuxSession))&&u.jsx("button",{onClick:C,"data-testid":"toolbar-copy-attach",className:R("attach"),title:`tmux attach -t ${e.canonicalSessionName??((M=e.binding)==null?void 0:M.tmuxSession)??"?"}`,children:l==="attach"?"copied":"tmux"}),((I=e.binding)==null?void 0:I.cmuxSurface)&&u.jsx("button",{onClick:T,"data-testid":"toolbar-cmux-focus",className:R("cmux"),children:l==="cmux"?"opened":"cmux"}),e.resumeToken&&e.runtime&&e.runtime!=="terminal"&&u.jsx("button",{onClick:_,"data-testid":"toolbar-copy-resume",className:R("resume"),children:l==="resume"?"copied":"resume"})]}),b&&u.jsx("div",{className:"pt-1",children:u.jsx("span",{"data-testid":`placement-chip-${e.logicalId}`,className:`inline-flex items-center border px-1.5 py-0.5 font-mono text-[7px] uppercase tracking-[0.12em] ${e.placementState==="selected"?"border-emerald-700 bg-emerald-700 text-white":"border-emerald-300 bg-emerald-50 text-emerald-800"}`,children:b})})]}),S.length>0&&u.jsx("div",{"data-testid":"node-hover-hint",className:"pointer-events-none absolute left-2 top-full z-20 mt-2 hidden min-w-[180px] border border-stone-900 bg-white px-2 py-1 font-mono text-[8px] text-stone-700 shadow-[4px_4px_0_rgba(28,25,23,0.14)] group-hover:block",children:S.map(H=>u.jsx("div",{children:H},H))}),u.jsx(Wa,{type:"source",position:we.Bottom})]})}const H6=Zw("relative w-full p-4 bg-surface-low border-l-2 border-l-stone-900 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-on-surface",{variants:{variant:{default:"bg-background text-foreground",destructive:"text-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Qt=j.forwardRef(({className:e,variant:t,...s},r)=>u.jsx("div",{ref:r,role:"alert",className:Te(H6({variant:t}),e),...s}));Qt.displayName="Alert";const U6=j.forwardRef(({className:e,...t},s)=>u.jsx("h5",{ref:s,className:Te("mb-1 font-medium leading-none tracking-tight",e),...t}));U6.displayName="AlertTitle";const Kt=j.forwardRef(({className:e,...t},s)=>u.jsx("div",{ref:s,className:Te("text-sm [&_p]:leading-relaxed",e),...t}));Kt.displayName="AlertDescription";function $6({data:e}){const t=e.podDisplayName??e.podNamespace??cs(e.logicalId)??us(e.podId??e.logicalId);return u.jsx("div",{"data-testid":"pod-group-node",className:`w-full h-full relative pointer-events-auto ${e.placementState==="selected"?"ring-2 ring-emerald-500/80 shadow-[0_0_0_4px_rgba(52,211,153,0.12)]":e.placementState==="available"?"ring-1 ring-emerald-300/80":""}`,children:u.jsx("div",{className:"absolute left-4 top-3 inline-flex items-center font-mono text-[12px] font-bold leading-none tracking-[0.08em] text-stone-800",children:`${t} pod`})})}function q6({data:e}){const t=e.session;return u.jsxs("div",{"data-testid":"discovered-graph-node",className:"border-dashed border-2 border-foreground/30 bg-surface-low/50 p-spacing-3 min-w-[180px]",children:[u.jsx(Wa,{type:"target",position:we.Top,className:"opacity-0"}),u.jsxs("div",{className:"text-label-sm font-mono uppercase mb-spacing-1",children:[t.tmuxSession,":",t.tmuxPane]}),u.jsxs("div",{className:"flex gap-spacing-2 items-center mb-spacing-1",children:[u.jsx("span",{className:"text-label-sm uppercase text-foreground-muted",children:t.runtimeHint}),u.jsx("span",{className:"text-label-sm text-foreground-muted",children:t.confidence})]}),t.cwd&&u.jsx("div",{className:"text-label-sm font-mono text-foreground-muted truncate",children:t.cwd}),u.jsx(Wa,{type:"source",position:we.Bottom,className:"opacity-0"})]})}const V6={rigNode:B6,discoveredNode:q6,podGroup:$6};function G6(){return u.jsxs("div",{className:"flex flex-col items-center justify-center h-full relative text-foreground-muted","data-testid":"empty-topology",children:[u.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 400 300",fill:"none",style:{opacity:.08},children:[u.jsx("rect",{x:"160",y:"60",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),u.jsx("rect",{x:"60",y:"180",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),u.jsx("rect",{x:"260",y:"180",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),u.jsx("line",{x1:"200",y1:"100",x2:"100",y2:"180",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 4"}),u.jsx("line",{x1:"200",y1:"100",x2:"300",y2:"180",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 4"})]}),u.jsx("div",{className:"relative z-10 text-center",children:u.jsx("h2",{className:"text-headline-md uppercase",children:"EMPTY TOPOLOGY"})})]})}function Y6({rigId:e,rigName:t=null,showDiscovered:s=!0}){const{data:r,isPending:i,error:l}=w6(e??""),d=Z3(s),f=(r==null?void 0:r.nodes)??[],m=(r==null?void 0:r.edges)??[],h=(l==null?void 0:l.message)??null,{reconnecting:v}=j6(e),[g,y]=j.useState(null),b=j.useRef(null),S=j.useRef(null),w=e!==null&&S.current!==e;j.useEffect(()=>{e&&f.length>0&&S.current!==e&&(S.current=e)},[e,f.length]);const N=j.useCallback(K=>{b.current&&clearTimeout(b.current),y(K),b.current=setTimeout(()=>{y(null),b.current=null},3e3)},[]);j.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]);const C=j.useMemo(()=>m.map(K=>{var A;const U=((A=K.data)==null?void 0:A.kind)??K.label??"delegates_to",q=E6(U);return{...K,...q,className:w?"edge-draw-in":void 0,style:{...q.style,animationDelay:w?`${Math.min(f.length*50+100,2e3)}ms`:void 0}}}),[m,w,f.length]),T=j.useMemo(()=>{const K=new Map;for(const U of f){const q=U.data;if((U.type==="podGroup"||U.type==="group")&&(q!=null&&q.podId)){K.set(q.podId,{displayName:q.podLabel??q.podNamespace??cs(q.logicalId)??us(q.podId),namespace:q.podNamespace??q.logicalId??null});continue}const A=(q==null?void 0:q.podId)??null;if(!A)continue;const $=(q==null?void 0:q.podNamespace)??cs(q==null?void 0:q.logicalId)??null,z=(q==null?void 0:q.podLabel)??$??us(A);K.has(A)||K.set(A,{displayName:z,namespace:$})}return K},[f]),{selection:_,setSelection:R}=tr(),{selectedDiscoveredId:O,placementTarget:B,setPlacementTarget:L}=y4(),M=(_==null?void 0:_.type)==="discovery"&&!!O,I=j.useMemo(()=>{const K=new Map;for(const z of f){if(!z.parentId)continue;const G=typeof z.data=="object"&&z.data!==null&&"logicalId"in z.data?z.data.logicalId:null,V=typeof z.data=="object"&&z.data!==null&&"podId"in z.data?z.data.podId:null,P=cs(G)??us(V);P&&!K.has(z.parentId)&&K.set(z.parentId,P)}const q=A6(f,m).map((z,G)=>({...z,data:(()=>{if(z.type==="podGroup"||z.type==="group"){const V=z.data,P=(V==null?void 0:V.podId)??null,Q=(B==null?void 0:B.kind)==="pod"&&P!==null&&B.podId===P;return{...z.data??{},podDisplayName:K.get(z.id)??null,placementState:M?Q?"selected":"available":null}}if(z.type==="rigNode"){const V=z.data,P=!(V!=null&&V.binding)&&!(V!=null&&V.canonicalSessionName),Q=(B==null?void 0:B.kind)==="node"&&(V==null?void 0:V.logicalId)!==void 0&&B.logicalId===V.logicalId;return{...z.data??{},placementState:M?Q?"selected":P?"available":null:null}}return z.data})(),className:w?"node-enter":void 0,style:{...z.style??{},animationDelay:w?`${Math.min(G*50,2e3)}ms`:void 0}})),A=q.reduce((z,G)=>{var V;return Math.max(z,((V=G.position)==null?void 0:V.y)??0)},0),$=d.map((z,G)=>({id:`discovered-${z.id}`,type:"discoveredNode",position:{x:300,y:A+200+G*150},data:{session:z}}));return[...q,...$]},[f,m,w,d,M,B]),{setSelectedNode:H}=v4(),D=t!=null&&t.trim()?t:e?Gs(e):null,Y=j.useCallback(async(K,U)=>{var A;if(!e)return;if(M){if(U.type==="podGroup"||U.type==="group"){const $=U.data,z=($==null?void 0:$.podId)??null,G=z?T.get(z):null,V=!!(z&&(G!=null&&G.namespace));L({kind:"pod",rigId:e,podId:z??"",podNamespace:(G==null?void 0:G.namespace)??null,podLabel:(G==null?void 0:G.displayName)??null,eligible:V,...V?{}:{reason:"This pod cannot receive a new node yet."}});return}if(U.type==="rigNode"){const $=U.data,z=!$.binding&&!$.canonicalSessionName;L({kind:"node",rigId:e,logicalId:$.logicalId,eligible:z,...z?{}:{reason:"This node is already claimed."}});return}}if(U.type==="podGroup"||U.type==="group"){R({type:"rig",rigId:e});return}const q=U.data;if(H({rigId:e,logicalId:q.logicalId}),!((A=q.binding)!=null&&A.cmuxSurface)){N({text:"Not bound to cmux surface",type:"info"});return}try{const $=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(q.logicalId)}/focus`,{method:"POST"});if(!$.ok){N({text:"Focus failed",type:"error"});return}const z=await $.json();z.ok===!1&&z.code==="unavailable"?N({text:"cmux not connected",type:"error"}):z.ok?N({text:"Focused",type:"success"}):N({text:"Focus failed",type:"error"})}catch{N({text:"Focus failed",type:"error"})}},[M,T,e,L,H,R,N]);return e===null?u.jsx("div",{className:"p-spacing-6 text-foreground-muted",children:"No rig selected"}):i?u.jsxs("div",{className:"p-spacing-6","data-testid":"graph-loading",children:[u.jsx("div",{className:"h-8 w-48 animate-pulse-tactical mb-spacing-4"}),u.jsx("div",{className:"h-64 animate-pulse-tactical"})]}):h?u.jsx("div",{className:"p-spacing-6",children:u.jsx(Qt,{"data-testid":"graph-error",children:u.jsxs(Kt,{children:["Error: ",h]})})}):I.length===0?u.jsx(G6,{}):u.jsxs("div",{className:"w-full h-full relative","data-testid":"graph-view","data-animated":w?"true":"false",children:[u.jsx("div",{className:"absolute top-4 left-4 w-3 h-3 reg-mark",children:u.jsx("div",{className:"reg-tl"})}),u.jsx("div",{className:"absolute top-4 right-4 w-3 h-3",children:u.jsx("div",{className:"reg-tr"})}),u.jsx("div",{className:"absolute bottom-4 left-4 w-3 h-3",children:u.jsx("div",{className:"reg-bl"})}),u.jsx("div",{className:"absolute bottom-4 right-4 w-3 h-3",children:u.jsx("div",{className:"reg-br"})}),D&&u.jsx("div",{"data-testid":"rig-stamp-watermark",className:"stamp-watermark text-3xl left-[20%] top-[35%]",children:D}),v&&u.jsx("div",{className:"absolute top-spacing-4 right-spacing-4 z-20",children:u.jsx(Qt,{children:u.jsx(Kt,{className:"text-warning",children:"Live updates disconnected from daemon — reconnecting..."})})}),g&&u.jsx("div",{className:`absolute top-spacing-4 left-spacing-4 z-20 px-spacing-4 py-spacing-2 font-mono text-[10px] border ${g.type==="success"?"bg-white border-stone-900 text-stone-900":g.type==="error"?"bg-tertiary/10 border-tertiary text-tertiary":"bg-white border-stone-300 text-stone-600"}`,children:g.text}),M&&u.jsx("div",{"data-testid":"graph-placement-banner",className:"absolute top-spacing-4 left-1/2 z-20 -translate-x-1/2 border border-emerald-300/90 bg-[rgba(236,253,245,0.92)] px-3.5 py-2 font-mono text-[10px] text-emerald-950 shadow-[0_12px_28px_rgba(34,197,94,0.14)] backdrop-blur-sm",children:"PLACEMENT MODE · click an available node to bind, or click a pod to add a new node."}),u.jsx(wE,{nodes:I,edges:C,nodeTypes:V6,onNodeClick:Y,nodesDraggable:!1,selectionOnDrag:!1,panOnDrag:!0,fitView:!0,fitViewOptions:{padding:.16,maxZoom:1.15},className:"relative z-10",proOptions:{hideAttribution:!0},minZoom:.3,maxZoom:1.5,children:u.jsx(EE,{})})]})}function h0(){const{openExplorer:e}=x4(),{setSelection:t}=tr();return u.jsx("div",{"data-testid":"workspace-home",className:"flex h-full min-h-[420px] flex-col items-center justify-center bg-[radial-gradient(circle_at_top,rgba(245,244,240,0.85),rgba(244,242,236,0.55)_32%,rgba(243,241,236,0.22)_58%,transparent_72%)] px-8 text-center",children:u.jsxs("div",{className:"max-w-xl space-y-3",children:[u.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:"Explorer-Driven Workspace"}),u.jsx("h1",{className:"font-headline text-2xl font-bold uppercase tracking-tight text-stone-900",children:"Select a rig from the explorer to inspect its topology."}),u.jsxs("p",{className:"text-sm text-stone-600",children:["Use ",u.jsx("span",{className:"font-mono text-stone-800",children:"Specs"})," to import a rig spec or run bootstrap, and use the ",u.jsx("span",{className:"font-mono text-stone-800",children:"Discovery"})," drawer to place running sessions."]}),u.jsxs("div",{className:"flex items-center justify-center gap-3 pt-2",children:[u.jsx("button",{type:"button","data-testid":"workspace-open-explorer",onClick:e,className:"border border-stone-300 px-4 py-2 font-mono text-[10px] uppercase tracking-[0.14em] text-stone-700 transition-colors hover:bg-stone-100",children:"Explore"}),u.jsx("button",{type:"button","data-testid":"workspace-open-specs",onClick:()=>t({type:"specs"}),className:"border border-stone-300 px-4 py-2 font-mono text-[10px] uppercase tracking-[0.14em] text-stone-700 transition-colors hover:bg-stone-100",children:"Open Specs"}),u.jsx("button",{type:"button","data-testid":"workspace-open-discovery",onClick:()=>t({type:"discovery"}),className:"border border-stone-300 px-4 py-2 font-mono text-[10px] uppercase tracking-[0.14em] text-stone-700 transition-colors hover:bg-stone-100",children:"Open Discovery"})]})]})})}function Q6(e){switch(e){case"launched":return"text-success";case"failed":return"text-destructive";default:return"text-foreground-muted"}}const m0=j.forwardRef(({className:e,type:t,...s},r)=>u.jsx("input",{type:t,className:Te("flex h-11 w-full border border-stone-300/55 bg-white/85 px-4 py-2 text-base text-foreground placeholder:text-foreground-muted/60 transition-colors duration-150 focus-visible:outline-none focus-visible:border-stone-900/35 focus-visible:ring-2 focus-visible:ring-stone-900/10 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...s}));m0.displayName="Input";const p0=j.forwardRef(({className:e,...t},s)=>u.jsx("textarea",{className:Te("flex min-h-[80px] w-full border border-stone-300/55 bg-white/85 px-4 py-3 text-base text-on-surface font-mono placeholder:text-stone-400 transition-all duration-150 focus-visible:outline-none focus-visible:border-stone-900/35 focus-visible:ring-2 focus-visible:ring-stone-900/10 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...t}));p0.displayName="Textarea";function rt({children:e,className:t,innerClassName:s}){return u.jsx("div",{"data-testid":"workspace-page",className:Te("w-full flex-1 overflow-y-auto lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",t),children:u.jsx("div",{"data-testid":"workspace-page-inner",className:Te("mx-auto w-full max-w-[960px] px-4 py-6 sm:px-6 sm:py-8 md:px-8 lg:px-10",s),children:e})})}const g0=j.forwardRef(({className:e,...t},s)=>u.jsx("div",{className:"relative w-full overflow-auto",children:u.jsx("table",{ref:s,className:Te("w-full caption-bottom text-sm",e),...t})}));g0.displayName="Table";const x0=j.forwardRef(({className:e,...t},s)=>u.jsx("thead",{ref:s,className:Te("bg-surface-low [&_tr]:border-b [&_tr]:border-stone-300",e),...t}));x0.displayName="TableHeader";const y0=j.forwardRef(({className:e,...t},s)=>u.jsx("tbody",{ref:s,className:Te("[&_tr:last-child]:border-0",e),...t}));y0.displayName="TableBody";const K6=j.forwardRef(({className:e,...t},s)=>u.jsx("tfoot",{ref:s,className:Te("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));K6.displayName="TableFooter";const cc=j.forwardRef(({className:e,...t},s)=>u.jsx("tr",{ref:s,className:Te("border-b border-stone-200 transition-colors duration-150 hover:bg-surface-low data-[state=selected]:bg-surface-mid odd:bg-surface-low/50",e),...t}));cc.displayName="TableRow";const Or=j.forwardRef(({className:e,...t},s)=>u.jsx("th",{ref:s,className:Te("h-12 px-4 text-left align-middle font-medium text-foreground-muted uppercase text-label-md tracking-[0.04em] [&:has([role=checkbox])]:pr-0",e),...t}));Or.displayName="TableHead";const Dr=j.forwardRef(({className:e,...t},s)=>u.jsx("td",{ref:s,className:Te("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Dr.displayName="TableCell";const F6=j.forwardRef(({className:e,...t},s)=>u.jsx("caption",{ref:s,className:Te("mt-4 text-sm text-foreground-muted",e),...t}));F6.displayName="TableCaption";function Yn({eyebrow:e,title:t,description:s,actions:r}){return u.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[u.jsxs("div",{className:"space-y-3",children:[u.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:e}),u.jsx("h2",{className:"text-2xl font-bold uppercase tracking-[0.04em] text-stone-900 sm:text-3xl",children:t}),s&&u.jsx("p",{className:"max-w-2xl text-base leading-8 text-stone-600",children:s})]}),r?u.jsx("div",{className:"flex flex-wrap gap-2",children:r}):null]})}function ME({steps:e,currentStep:t,errorAtStep:s=0,"data-testid":r}){const i=s||t;return u.jsx("div",{className:"flex flex-wrap items-center gap-2 sm:gap-3","data-testid":r,children:e.map((l,d)=>{const f=i>l.num,m=i===l.num,h=i<l.num,v=f?"done":m?"active":"upcoming";return u.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[u.jsxs("div",{"data-testid":`step-${l.num}`,"data-step-state":v,className:Te("inline-flex min-h-0 items-center gap-2 border-b-2 px-1 py-1 font-mono text-[10px] uppercase tracking-[0.16em] transition-colors",f&&"border-primary/35 text-foreground-muted",m&&"border-stone-900 text-foreground",h&&"border-transparent text-foreground-muted/35"),children:[u.jsxs("span",{className:"text-[9px] tracking-[0.22em]",children:[f?"✓ ":"",String(l.num).padStart(2,"0")]}),u.jsx("span",{className:"text-[10px] leading-none tracking-[0.2em]",children:l.label})]}),d<e.length-1?u.jsx("div",{"aria-hidden":"true",className:Te("h-px w-4 shrink-0 sm:w-6",f?"bg-primary/35":"bg-stone-300/45")}):null]},l.num)})})}function Ln({title:e,description:t,children:s,className:r}){return u.jsxs("section",{className:Te("space-y-4 border border-stone-300/45 bg-[rgba(255,255,255,0.62)] p-5 shadow-[0_1px_0_rgba(255,255,255,0.95)_inset,0_10px_26px_rgba(34,34,24,0.035)] sm:p-6",r),children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:e}),t?u.jsx("p",{className:"text-base leading-8 text-stone-600",children:t}):null]}),s]})}function _f({children:e}){return u.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:e})}function Ut({label:e,value:t,testId:s}){return u.jsxs("div",{className:"border border-stone-300/35 bg-white/10 px-4 py-4",children:[u.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),u.jsx("div",{"data-testid":s,className:"mt-2 text-2xl font-semibold uppercase tracking-[0.04em] text-stone-900",children:t})]})}function kE({title:e,testId:t,children:s}){return u.jsx(Ln,{title:e,children:u.jsx("pre",{"data-testid":t,className:"overflow-x-auto border border-stone-300/45 bg-white/75 p-4 text-xs leading-6 text-stone-800",children:s})})}const X6=[{num:1,label:"VALIDATE RIGSPEC"},{num:2,label:"PREFLIGHT"},{num:3,label:"INSTANTIATE"}];function Z6(e){switch(e){case"input":case"validating":return 1;case"valid":case"preflight":return 2;case"preflight_done":case"instantiating":case"done":return 3;case"error":return 0}}function W6({onBack:e}={}){const t=TM(),{currentRigDraft:s,selectedRigDraft:r,saveRigDraft:i,rememberRigDraft:l,clearSelectedRigDraft:d}=Co(),[f,m]=j.useState(()=>(r==null?void 0:r.yaml)??(s==null?void 0:s.yaml)??""),[h,v]=j.useState(""),[g,y]=j.useState("input"),[b,S]=j.useState(0),[w,N]=j.useState([]),[C,T]=j.useState([]),[_,R]=j.useState(null);j.useEffect(()=>{i(f)},[i,f]),j.useEffect(()=>{r&&(m(r.yaml),d())},[d,r]);const O=async()=>{l(f),y("validating"),N([]);try{const I=await(await fetch("/api/rigs/import/validate",{method:"POST",headers:{"Content-Type":"text/yaml"},body:f})).json();I.valid?y("valid"):(N(I.errors??["Validation failed"]),S(1),y("error"))}catch{N(["Validation request failed"]),S(1),y("error")}},B=async()=>{y("preflight"),N([]),T([]);try{const M={"Content-Type":"text/yaml"};h&&(M["X-Rig-Root"]=h);const H=await(await fetch("/api/rigs/import/preflight",{method:"POST",headers:M,body:f})).json();T(H.warnings??[]),H.errors&&H.errors.length>0?(N(H.errors),S(2),y("error")):y("preflight_done")}catch{N(["Preflight request failed"]),S(2),y("error")}},L=async()=>{y("instantiating"),N([]);try{const M=await t.mutateAsync({yaml:f,rigRoot:h.trim()||void 0});R(M),y("done")}catch(M){M instanceof Jp?(M.code==="cycle_error"?N(["Cycle detected in rig topology"]):N(M.errors),T(M.warnings)):N([M instanceof Error?M.message:"Instantiate request failed"]),S(3),y("error")}};return u.jsx(rt,{children:u.jsxs("div",{"data-testid":"import-flow",className:"space-y-8",children:[u.jsx(Yn,{eyebrow:"Rig Import",title:"Import Rig",description:"Validate a RigSpec, run preflight checks, then instantiate a topology from YAML."}),u.jsx(ME,{"data-testid":"step-indicator",steps:X6,currentStep:Z6(g),errorAtStep:g==="error"?b:0}),g==="input"&&u.jsxs(Ln,{title:"Rig YAML",description:"Paste a rig spec and optionally provide a rig root to anchor relative references during import.",children:[u.jsx(p0,{"data-testid":"yaml-input",value:f,onChange:M=>m(M.target.value),placeholder:"Paste YAML rig spec here...",rows:14,className:"font-mono text-body-sm mb-spacing-4"}),u.jsxs("div",{className:"mb-spacing-4",children:[u.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"RIG ROOT (OPTIONAL)"}),u.jsx(m0,{"data-testid":"rig-root-input",type:"text",value:h,onChange:M=>v(M.target.value),placeholder:"/path/to/rig/root",className:"font-mono text-body-sm"})]}),u.jsx(Ne,{variant:"tactical","data-testid":"validate-btn",onClick:O,disabled:!f.trim(),children:"VALIDATE RIGSPEC"})]}),g==="validating"&&u.jsx("div",{className:"text-label-md text-foreground-muted",children:"Validating..."}),g==="valid"&&u.jsxs(Ln,{title:"Validation Passed",description:"The RigSpec is valid. Run preflight checks before you instantiate it.",children:[u.jsx(Qt,{className:"mb-spacing-4","data-testid":"valid-message",children:u.jsx(Kt,{className:"text-primary",children:"RigSpec valid. Run preflight checks?"})}),u.jsx(Ne,{variant:"tactical","data-testid":"preflight-btn",onClick:B,children:"RUN PREFLIGHT"})]}),g==="preflight"&&u.jsx("div",{className:"text-label-md text-foreground-muted",children:"Running preflight..."}),g==="preflight_done"&&u.jsxs(Ln,{title:"Preflight Results",description:"Review warnings before you instantiate the rig into live runtime sessions.",children:[C.length>0&&u.jsx(Qt,{className:"mb-spacing-4","data-testid":"preflight-warnings",children:u.jsxs(Kt,{className:"text-warning",children:[u.jsx("div",{className:"text-label-md uppercase mb-spacing-1",children:"WARNINGS"}),C.map((M,I)=>u.jsxs("div",{children:["— ",M]},I))]})}),u.jsx(Qt,{className:"mb-spacing-4","data-testid":"preflight-ready",children:u.jsx(Kt,{className:"text-primary",children:"Preflight passed. Ready to instantiate."})}),u.jsx(Ne,{variant:"tactical","data-testid":"instantiate-btn",onClick:L,children:"INSTANTIATE"})]}),g==="instantiating"&&u.jsx("div",{className:"text-label-md text-foreground-muted",children:"Instantiating..."}),g==="done"&&_&&u.jsx(Ln,{title:"Instantiate Result",description:"The daemon returned per-node launch status for the imported topology.",className:"space-y-4",children:u.jsxs("div",{"data-testid":"import-result",children:[u.jsx(Qt,{className:"mb-spacing-4",children:u.jsxs(Kt,{children:[u.jsx("span",{className:"text-primary font-mono",children:_.specName}),u.jsxs("span",{className:"text-foreground-muted",children:[" (",_.rigId,")"]})]})}),u.jsxs(g0,{children:[u.jsx(x0,{children:u.jsxs(cc,{children:[u.jsx(Or,{children:"NODE"}),u.jsx(Or,{children:"STATUS"})]})}),u.jsx(y0,{children:_.nodes.map(M=>u.jsxs(cc,{children:[u.jsx(Dr,{className:"font-mono",children:M.logicalId}),u.jsx(Dr,{children:u.jsx("span",{className:`font-mono ${Q6(M.status)}`,"data-testid":`inst-status-${M.logicalId}`,children:M.status})})]},M.logicalId))})]}),e?u.jsx("div",{className:"mt-spacing-6",children:u.jsx(Ne,{variant:"ghost",onClick:e,children:"Close"})}):null]})}),g==="error"&&u.jsx(Ln,{title:"Import Errors",description:"Fix the reported issues, then retry the import flow.",children:u.jsxs("div",{"data-testid":"import-errors",children:[C.length>0&&u.jsx(Qt,{className:"mb-spacing-2","data-testid":"error-warnings",children:u.jsxs(Kt,{className:"text-warning",children:[u.jsx("div",{className:"text-label-md uppercase mb-spacing-1",children:"WARNINGS"}),C.map((M,I)=>u.jsxs("div",{children:["— ",M]},I))]})}),w.map((M,I)=>u.jsx(Qt,{className:"mb-spacing-2",children:u.jsx(Kt,{className:"text-destructive",children:M})},I)),u.jsx(Ne,{variant:"tactical",className:"mt-spacing-4",onClick:()=>{y("input"),N([]),T([]),R(null),S(0),v("")},children:"TRY AGAIN"})]})})]})})}async function J6(){const e=await fetch("/api/packages/summary");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function eP(){return Tt({queryKey:["packages"],queryFn:J6})}function tP(e){switch(e){case"applied":return"bg-success";case"rolled_back":return"bg-warning";case"failed":return"bg-destructive";default:return"bg-foreground-muted-on-dark"}}function nP(e){switch(e){case"applied":return"APPLIED";case"rolled_back":return"ROLLED BACK";case"failed":return"FAILED";default:return"NONE"}}function sP({pkg:e,onSelect:t}){return u.jsxs("div",{"data-testid":"package-card",role:"link",tabIndex:0,className:"card-dark p-spacing-6 mb-spacing-3 cursor-pointer",onClick:()=>t(e.id),onKeyDown:s=>{s.key==="Enter"&&t(e.id)},children:[u.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[u.jsx("h3",{className:"text-headline-md uppercase",children:e.name}),u.jsxs("span",{className:"text-label-md font-mono text-foreground-muted-on-dark",children:["v",e.version]})]}),e.summary&&u.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark mb-spacing-4",children:e.summary}),u.jsx("div",{className:"flex items-center gap-spacing-4 text-label-sm",children:u.jsxs("span",{className:"text-foreground-muted-on-dark",children:["SOURCE ",u.jsx("span",{className:"font-mono text-foreground-on-dark",children:e.sourceRef})]})}),u.jsxs("div",{className:"flex items-center gap-spacing-4 mt-spacing-3 text-label-sm",children:[u.jsxs("span",{className:"text-foreground-muted-on-dark",children:["INSTALLS ",u.jsx("span",{className:"font-mono text-foreground-on-dark","data-testid":"install-count",children:e.installCount})]}),u.jsxs("span",{className:"flex items-center gap-spacing-1",children:[u.jsx("span",{className:Te("inline-block w-[6px] h-[6px]",tP(e.latestInstallStatus))}),u.jsx("span",{className:"text-foreground-muted-on-dark","data-testid":"install-status",children:nP(e.latestInstallStatus)})]})]})]})}function aP(){const e=Xt(),{data:t,isPending:s,error:r}=eP(),i=t?[...t].sort((l,d)=>d.createdAt.localeCompare(l.createdAt)):[];return s?u.jsx(rt,{children:u.jsxs("div",{"data-testid":"packages-loading",children:[u.jsxs("div",{className:"flex justify-between mb-spacing-6",children:[u.jsx("div",{className:"h-8 w-32 shimmer"}),u.jsx("div",{className:"h-8 w-28 shimmer"})]}),[1,2].map(l=>u.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-3",children:[u.jsx("div",{className:"h-6 w-48 shimmer-dark mb-spacing-4"}),u.jsx("div",{className:"h-12 shimmer-dark mb-spacing-4"}),u.jsx("div",{className:"h-4 w-64 shimmer-dark"})]},l))]})}):r?u.jsx(rt,{children:u.jsx("div",{children:u.jsx(Qt,{"data-testid":"packages-error",children:u.jsx(Kt,{children:r.message})})})}):i.length===0?u.jsx(rt,{children:u.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh]","data-testid":"packages-empty",children:[u.jsx("h2",{className:"text-display-lg text-foreground mb-spacing-4",children:"NO LEGACY PACKAGE INSTALLS"}),u.jsx("p",{className:"text-body-md text-foreground-muted mb-spacing-8",children:"Legacy package tools remain available for bootstrap internals while Specs becomes the main authoring surface."}),u.jsxs("div",{className:"flex flex-col items-center gap-spacing-3",children:[u.jsx(Ne,{variant:"default",size:"lg","data-testid":"empty-import-btn",onClick:()=>e({to:"/import"}),children:"IMPORT RIGSPEC"}),u.jsx(Ne,{variant:"ghost",size:"lg","data-testid":"empty-bootstrap-btn",onClick:()=>e({to:"/bootstrap"}),children:"BOOTSTRAP"})]})]})}):u.jsx(rt,{children:u.jsxs("div",{children:[u.jsxs("div",{className:"flex justify-between items-baseline mb-spacing-6",children:[u.jsxs("div",{children:[u.jsx("h2",{className:"text-headline-lg uppercase",children:"LEGACY PACKAGE TOOLS"}),u.jsxs("p",{className:"text-label-md text-foreground-muted font-grotesk mt-spacing-1",children:[i.length," legacy package install",i.length!==1?"s":""," retained for bootstrap internals"]})]}),u.jsxs("div",{className:"flex flex-col items-end gap-spacing-2",children:[u.jsx(Ne,{variant:"default",size:"sm","data-testid":"header-import-btn",onClick:()=>e({to:"/import"}),children:"IMPORT RIGSPEC"}),u.jsx(Ne,{variant:"ghost",size:"sm","data-testid":"header-bootstrap-btn",onClick:()=>e({to:"/bootstrap"}),children:"BOOTSTRAP"})]})]}),i.map(l=>u.jsx(sP,{pkg:l,onSelect:d=>e({to:"/packages/$packageId",params:{packageId:d}})},l.id))]})})}const rP=[{num:1,label:"ENTER"},{num:2,label:"VALIDATE"},{num:3,label:"CONFIGURE"},{num:4,label:"PLAN"},{num:5,label:"APPLY"}];function iP(e){switch(e){case"enter":return 1;case"validating":case"validated":return 2;case"configure":return 3;case"planning":case"planned":return 4;case"applying":case"done":return 5;case"error":return 0}}function oP({currentStep:e,errorAtStep:t}){const s=e==="error"?t:iP(e);return u.jsx("div",{className:"flex items-center gap-spacing-2 mb-spacing-8 p-spacing-4 inset-light flex-wrap","data-testid":"step-indicator",children:rP.map((r,i)=>{const l=s>r.num,d=s===r.num;return u.jsxs("div",{className:"flex items-center gap-spacing-2",children:[i>0&&u.jsx("div",{className:`w-6 h-px mx-spacing-1 ${l?"bg-primary/40":"bg-foreground-muted/20"}`}),u.jsxs("span",{"data-testid":`step-${r.num}`,className:Te("text-label-sm uppercase tracking-[0.04em] font-mono px-spacing-2 py-spacing-1 transition-colors whitespace-nowrap",l?"text-foreground-muted":d?"text-foreground bg-foreground/10":"text-foreground-muted/30"),children:[l?"✓":""," [ ",r.num," ",r.label," ]"]})]},r.num)})})}function lP(e){switch(e){case"approved":return"text-success";case"rejected":return"text-warning";case"deferred":return"text-foreground-muted";case"conflict":return"text-destructive";case"noop":return"text-foreground-muted/50";default:return""}}function cP(e){switch(e){case"approved":return"bg-success/8";case"rejected":return"bg-warning/8";case"deferred":return"bg-foreground-muted/4";case"conflict":return"bg-destructive/8";default:return""}}function uP(){const e=Xt(),[t,s]=j.useState(""),[r,i]=j.useState("enter"),[l,d]=j.useState(0),[f,m]=j.useState([]),[h,v]=j.useState(null),[g,y]=j.useState("claude-code"),[b,S]=j.useState("."),[w,N]=j.useState(""),[C,T]=j.useState(!1),[_,R]=j.useState(null),[O,B]=j.useState(null),L=async()=>{i("validating"),m([]);try{const Y=await(await fetch("/api/packages/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t})})).json();Y.valid?(v(Y.manifest),i("validated")):(m(Y.errors??[Y.error??"Validation failed"]),d(2),i("error"))}catch{m(["Validation request failed"]),d(2),i("error")}},M=async()=>{i("planning"),m([]);try{const D=await fetch("/api/packages/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t,targetRoot:b,runtime:g,roleName:w||void 0,allowMerge:C})});if(!D.ok){const K=await D.json();m(K.errors??[K.error??"Plan failed"]),d(4),i("error");return}const Y=await D.json();R(Y),i("planned")}catch{m(["Plan request failed"]),d(4),i("error")}},I=async()=>{i("applying"),m([]);try{const D=await fetch("/api/packages/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t,targetRoot:b,runtime:g,roleName:w||void 0,allowMerge:C})}),Y=await D.json();if(D.status>=400){m(Y.errors??[Y.error??"Install failed"]),d(5),i("error");return}B(Y),i("done")}catch{m(["Install request failed"]),d(5),i("error")}},H=((_==null?void 0:_.conflicts)??0)>0;return u.jsx(rt,{children:u.jsxs("div",{"data-testid":"install-flow",children:[u.jsx("div",{className:"mb-spacing-8",children:u.jsxs("div",{children:[u.jsx("h2",{className:"text-headline-lg uppercase tracking-[0.06em]",children:"INSTALL PACKAGE (Legacy)"}),u.jsx("p",{className:"text-label-md text-foreground-muted font-grotesk mt-spacing-1",children:"Validate, configure, and apply an agent package"})]})}),u.jsx(oP,{currentStep:r,errorAtStep:l}),r==="enter"&&u.jsxs("div",{children:[u.jsx("label",{className:"text-label-md text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-2",children:"PACKAGE PATH"}),u.jsx("input",{"data-testid":"source-path-input",type:"text",value:t,onChange:D=>s(D.target.value),placeholder:"/path/to/package",className:"w-full bg-transparent border-b border-foreground/20 focus:border-foreground px-0 py-spacing-2 text-body-md font-mono outline-none transition-colors"}),u.jsx(Ne,{variant:"tactical","data-testid":"validate-btn",onClick:L,disabled:!t.trim(),className:"mt-spacing-4",children:"VALIDATE"})]}),r==="validating"&&u.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"validating-indicator",children:"Validating..."}),r==="validated"&&h&&u.jsxs("div",{"data-testid":"manifest-summary",children:[u.jsxs("div",{className:"card-dark p-spacing-4 mb-spacing-4",children:[u.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[u.jsx("span",{className:"text-headline-md uppercase",children:h.name}),u.jsxs("span",{className:"font-mono text-foreground-muted-on-dark",children:["v",h.version]})]}),u.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark mb-spacing-3",children:h.summary}),u.jsxs("div",{className:"flex flex-wrap gap-spacing-3 text-label-sm",children:[u.jsxs("span",{children:["Skills: ",u.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.exportCounts.skills})]}),u.jsxs("span",{children:["Guidance: ",u.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.exportCounts.guidance})]}),u.jsxs("span",{children:["Agents: ",u.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.exportCounts.agents})]}),u.jsxs("span",{children:["Hooks: ",u.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.exportCounts.hooks})]}),u.jsxs("span",{children:["Runtimes: ",u.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.runtimes.join(", ")})]})]})]}),u.jsx(Ne,{variant:"tactical","data-testid":"configure-btn",onClick:()=>i("configure"),children:"CONFIGURE"})]}),r==="configure"&&h&&u.jsxs("div",{"data-testid":"configure-step",children:[u.jsxs("div",{className:"space-y-spacing-4 mb-spacing-6",children:[u.jsxs("div",{children:[u.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"RUNTIME"}),u.jsx("select",{"data-testid":"runtime-select",value:g,onChange:D=>y(D.target.value),className:"bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono outline-none",children:h.runtimes.map(D=>u.jsx("option",{value:D,children:D},D))})]}),u.jsxs("div",{children:[u.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"TARGET ROOT"}),u.jsx("input",{"data-testid":"target-root-input",type:"text",value:b,onChange:D=>S(D.target.value),className:"w-full bg-transparent border-b border-foreground/20 px-0 py-spacing-1 text-body-md font-mono outline-none"})]}),h.roles.length>0&&u.jsxs("div",{children:[u.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"ROLE"}),u.jsxs("select",{"data-testid":"role-select",value:w,onChange:D=>N(D.target.value),className:"bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono outline-none",children:[u.jsx("option",{value:"",children:"All exports"}),h.roles.map(D=>u.jsxs("option",{value:D.name,children:[D.name,D.description?` — ${D.description}`:""]},D.name))]})]}),u.jsxs("div",{className:"flex items-center gap-spacing-2",children:[u.jsx("input",{"data-testid":"allow-merge-toggle",type:"checkbox",checked:C,onChange:D=>T(D.target.checked),className:"accent-primary"}),u.jsx("label",{className:"text-label-sm text-foreground-muted",children:"Allow managed block merges into existing files"})]}),(h.requirements.cliTools.length>0||h.requirements.systemPackages.length>0)&&u.jsxs("div",{"data-testid":"requirements-section",className:"p-spacing-3 bg-foreground/4",children:[u.jsx("span",{className:"text-label-sm text-foreground-muted uppercase block mb-spacing-1",children:"REQUIREMENTS"}),h.requirements.cliTools.map(D=>u.jsxs("div",{className:"text-body-sm font-mono",children:["CLI: ",D.name]},D.name)),h.requirements.systemPackages.map(D=>u.jsxs("div",{className:"text-body-sm font-mono",children:["System: ",D.name]},D.name))]})]}),u.jsx(Ne,{variant:"tactical","data-testid":"plan-btn",onClick:M,children:"PREVIEW PLAN"})]}),r==="planning"&&u.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"planning-indicator",children:"Planning..."}),r==="planned"&&_&&u.jsxs("div",{"data-testid":"plan-preview",children:[u.jsxs("div",{className:"flex flex-wrap gap-spacing-4 mb-spacing-4 text-label-sm",children:[u.jsxs("span",{children:["Approved: ",u.jsx("span",{className:"font-mono text-success","data-testid":"plan-actionable",children:_.actionable})]}),u.jsxs("span",{children:["Deferred: ",u.jsx("span",{className:"font-mono text-foreground-muted","data-testid":"plan-deferred",children:_.deferred})]}),u.jsxs("span",{children:["Conflicts: ",u.jsx("span",{className:"font-mono text-destructive","data-testid":"plan-conflicts",children:_.conflicts})]}),u.jsxs("span",{children:["No-ops: ",u.jsx("span",{className:"font-mono","data-testid":"plan-noops",children:_.noOps})]}),_.rejected>0&&u.jsxs("span",{children:["Rejected: ",u.jsx("span",{className:"font-mono text-warning","data-testid":"plan-rejected",children:_.rejected})]})]}),H&&u.jsx(Qt,{className:"mb-spacing-4","data-testid":"conflict-warning",children:u.jsx(Kt,{className:"text-destructive",children:"Conflicts detected — resolve before applying"})}),u.jsxs(g0,{children:[u.jsx(x0,{children:u.jsxs(cc,{children:[u.jsx(Or,{children:"TYPE"}),u.jsx(Or,{children:"NAME"}),u.jsx(Or,{children:"STATUS"}),u.jsx(Or,{children:"TARGET"})]})}),u.jsx(y0,{children:_.entries.map((D,Y)=>u.jsxs(cc,{className:cP(D.policyStatus),"data-testid":"plan-entry","data-policy-status":D.policyStatus,children:[u.jsx(Dr,{className:"font-mono text-label-sm",children:D.exportType}),u.jsx(Dr,{className:"font-mono text-label-sm",children:D.exportName}),u.jsxs(Dr,{className:Te("font-mono text-label-sm uppercase",lP(D.policyStatus)),children:[D.policyStatus,D.deferReason&&u.jsxs("span",{className:"text-foreground-muted normal-case",children:[" — ",D.deferReason]}),D.conflict&&u.jsxs("span",{className:"text-destructive normal-case",children:[" — ",D.conflict.reason]})]}),u.jsx(Dr,{className:"font-mono text-label-sm text-foreground-muted truncate max-w-[200px]",children:D.targetPath||"—"})]},Y))})]}),u.jsx("div",{className:"mt-spacing-4",children:u.jsx(Ne,{variant:"tactical","data-testid":"apply-btn",onClick:I,disabled:H,title:H?"Resolve conflicts before applying":void 0,children:"APPLY"})})]}),r==="applying"&&u.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"applying-indicator",children:"Applying..."}),r==="done"&&O&&u.jsxs("div",{"data-testid":"install-result",children:[u.jsx(Qt,{className:"mb-spacing-4",children:u.jsxs(Kt,{children:[u.jsx("span",{className:"text-primary font-mono",children:O.packageName}),u.jsx("span",{className:"text-foreground-muted",children:" installed as "}),u.jsx("span",{className:"font-mono","data-testid":"result-install-id",children:O.installId})]})}),u.jsxs("div",{className:"flex gap-spacing-4 text-label-sm mb-spacing-4",children:[u.jsxs("span",{children:["Applied: ",u.jsx("span",{className:"font-mono text-success","data-testid":"result-applied",children:O.applied.length})]}),u.jsxs("span",{children:["Deferred: ",u.jsx("span",{className:"font-mono text-foreground-muted","data-testid":"result-deferred",children:O.deferred.length})]}),u.jsxs("span",{children:["Verified: ",u.jsx("span",{className:Te("font-mono",O.verification.passed?"text-success":"text-destructive"),"data-testid":"result-verified",children:O.verification.passed?"PASS":"FAIL"})]})]}),u.jsx("div",{className:"flex gap-spacing-3",children:u.jsx(Ne,{variant:"tactical","data-testid":"detail-link",onClick:()=>e({to:"/packages/$packageId",params:{packageId:O.packageId}}),children:"VIEW INSTALL DETAILS"})})]}),r==="error"&&u.jsxs("div",{"data-testid":"install-errors",children:[f.map((D,Y)=>u.jsx(Qt,{className:"mb-spacing-2",children:u.jsx(Kt,{className:"text-destructive",children:D})},Y)),u.jsx(Ne,{variant:"tactical",className:"mt-spacing-4","data-testid":"try-again-btn",onClick:()=>{i("enter"),m([]),v(null),R(null),B(null),d(0)},children:"TRY AGAIN"})]})]})})}function dP(e){return Tt({queryKey:["packages",e],queryFn:async()=>{const t=await fetch(`/api/packages/${e}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},enabled:!!e})}function fP(e){return Tt({queryKey:["packages",e,"installs"],queryFn:async()=>{const t=await fetch(`/api/packages/${e}/installs`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},enabled:!!e})}function hP(e){return Tt({queryKey:["installs",e,"journal"],queryFn:async()=>{const t=await fetch(`/api/packages/installs/${e}/journal`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()},enabled:!!e})}function mP(e){const t=Ct();return Pt({mutationFn:async s=>{const r=await fetch(`/api/packages/${s}/rollback`,{method:"POST"});if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["packages",e,"installs"]}),t.invalidateQueries({queryKey:["installs"]})}})}function pP(e){switch(e){case"applied":return"bg-success";case"rolled_back":return"bg-warning";case"failed":return"bg-destructive";default:return"bg-foreground-muted"}}function gP(e){switch(e){case"applied":return"APPLIED";case"rolled_back":return"ROLLED BACK";case"failed":return"FAILED";default:return e.toUpperCase()}}function xP({installId:e}){const{data:t,isPending:s,isError:r}=hP(e);return s?u.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-foreground-muted",children:"Loading journal..."}):r?u.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-destructive","data-testid":"journal-error",children:"Failed to load journal entries"}):!t||t.length===0?u.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-foreground-muted",children:"No journal entries"}):u.jsx("div",{className:"pl-spacing-6 py-spacing-2 space-y-spacing-1","data-testid":"journal-entries",children:t.map(i=>u.jsxs("div",{"data-testid":"journal-entry",className:"flex items-center gap-spacing-3 text-label-sm font-mono py-spacing-1 border-b border-foreground/6 last:border-0",children:[u.jsx("span",{className:"text-foreground-muted w-6 text-right",children:i.seq}),u.jsx("span",{className:"uppercase",children:i.action}),u.jsx("span",{className:"text-foreground-muted",children:i.exportType}),u.jsx("span",{className:"text-foreground-muted truncate max-w-[200px]",children:i.targetPath}),u.jsx("span",{className:"text-foreground-muted ml-auto",children:i.status})]},i.id))})}function yP({install:e,onRollback:t}){const[s,r]=j.useState(!1);return u.jsxs("div",{"data-testid":"install-row",className:"card-dark p-spacing-4 mb-spacing-2",children:[u.jsxs("div",{className:"flex items-center gap-spacing-4",children:[u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-spacing-3 mb-spacing-1",children:[u.jsx("span",{className:"font-mono text-label-sm text-foreground-muted",children:e.createdAt}),u.jsx("span",{"data-testid":"install-status-badge",className:Te("inline-block px-spacing-2 py-px text-label-sm uppercase",pP(e.status)),children:gP(e.status)})]}),u.jsx("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:e.targetRoot}),u.jsxs("div",{className:"flex items-center gap-spacing-3 mt-spacing-1 text-label-sm",children:[u.jsxs("span",{"data-testid":"applied-count",children:[u.jsx("span",{className:"font-mono",children:e.appliedCount})," applied"]}),u.jsx("span",{"data-testid":"deferred-placeholder",className:"text-foreground-muted",children:"— deferred"})]})]}),u.jsxs("div",{className:"flex items-center gap-spacing-2 shrink-0",children:[u.jsx(Ne,{variant:"tactical",size:"sm","data-testid":"expand-btn",onClick:()=>r(!s),children:s?"COLLAPSE":"EXPAND"}),e.status==="applied"&&u.jsx(Ne,{variant:"tactical",size:"sm","data-testid":"rollback-btn",onClick:()=>t(e.id),children:"ROLLBACK"})]})]}),s&&u.jsx(xP,{installId:e.id})]})}function vP(){var w;const{packageId:e}=cf({strict:!1}),{data:t,isPending:s,error:r}=dP(e),{data:i,isPending:l,error:d}=fP(e),f=mP(e),[m,h]=j.useState(null),[v,g]=j.useState(!1),y=N=>{h(N),g(!0)},b=()=>{m&&f.mutate(m,{onSuccess:()=>{g(!1),h(null)}})};if(s||l)return u.jsx(rt,{children:u.jsxs("div",{"data-testid":"detail-loading",children:[u.jsx("div",{className:"h-8 w-48 shimmer mb-spacing-4"}),u.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-4",children:[u.jsx("div",{className:"h-6 w-64 shimmer-dark mb-spacing-3"}),u.jsx("div",{className:"h-4 w-full shimmer-dark"})]})]})});if(r)return u.jsx(rt,{children:u.jsx("div",{"data-testid":"detail-error",children:u.jsx("p",{className:"text-destructive",children:r.message})})});if(d)return u.jsx(rt,{children:u.jsx("div",{"data-testid":"installs-error",children:u.jsx("p",{className:"text-destructive",children:"Failed to load install history"})})});const S=i??[];return u.jsx(rt,{children:u.jsxs("div",{children:[t&&u.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-6","data-testid":"package-header",children:[u.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[u.jsxs("h2",{className:"text-headline-lg uppercase",children:[t.name," (Legacy)"]}),u.jsxs("span",{className:"text-label-md font-mono text-foreground-muted-on-dark",children:["v",t.version]})]}),u.jsxs("div",{className:"text-label-sm text-foreground-muted-on-dark mb-spacing-2",children:["SOURCE"," ",u.jsx("span",{className:"font-mono text-foreground-on-dark","data-testid":"package-source",children:t.sourceRef})]}),t.summary&&u.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark",children:t.summary})]}),u.jsx("h3",{className:"text-headline-md uppercase mb-spacing-4",children:"INSTALL HISTORY"}),S.length===0?u.jsx("div",{"data-testid":"empty-installs",className:"text-body-md text-foreground-muted",children:"No installs yet"}):u.jsx("div",{"data-testid":"install-list",children:S.map(N=>u.jsx(yP,{install:N,onRollback:y},N.id))}),u.jsx(Gd,{open:v,onOpenChange:N=>{f.isPending||(g(N),N||f.reset())},children:u.jsxs(Kl,{"data-testid":"rollback-dialog",onPointerDownOutside:N=>{f.isPending&&N.preventDefault()},onEscapeKeyDown:N=>{f.isPending&&N.preventDefault()},hideCloseButton:f.isPending,children:[u.jsxs(Fl,{children:[u.jsx(Zl,{className:"text-headline-md uppercase",children:"CONFIRM ROLLBACK"}),u.jsx(Wl,{children:"This will roll back the install and restore previous file states. This action cannot be undone."})]}),f.isError&&u.jsxs("p",{className:"text-destructive text-label-sm","data-testid":"rollback-error",children:["Rollback failed: ",((w=f.error)==null?void 0:w.message)??"Unknown error"]}),u.jsxs(Xl,{children:[u.jsx(Ne,{variant:"ghost",onClick:()=>{f.reset(),g(!1)},"data-testid":"rollback-cancel",disabled:f.isPending,children:"CANCEL"}),u.jsx(Ne,{variant:"destructive",onClick:b,"data-testid":"rollback-confirm",disabled:f.isPending,children:f.isPending?"ROLLING BACK...":"ROLLBACK"})]})]})})]})})}function bP(e){switch(e){case"installed":return"bg-success";case"missing":return"bg-destructive";case"unsupported":return"bg-warning";case"unknown":return"bg-warning";default:return"bg-foreground-muted"}}function SP(e){switch(e){case"installed":return"OK";case"missing":return"MISSING";case"unsupported":return"MANUAL";case"unknown":return"UNKNOWN";default:return e.toUpperCase()}}function wP({results:e}){return e.length===0?u.jsx("div",{className:"text-body-sm text-foreground-muted","data-testid":"no-requirements",children:"No requirements declared."}):u.jsx("div",{className:"space-y-spacing-1","data-testid":"requirements-panel",children:e.map(t=>u.jsxs("div",{"data-testid":"requirement-row",className:"flex items-center gap-spacing-3 py-spacing-1 text-label-sm font-mono",children:[u.jsx("span",{"data-testid":"requirement-dot",className:Te("w-2 h-2 shrink-0",bP(t.status))}),u.jsx("span",{"data-testid":"requirement-status",className:"w-16 uppercase",children:SP(t.status)}),u.jsx("span",{className:"text-foreground-muted w-24",children:t.kind}),u.jsx("span",{children:t.name}),t.detectedPath&&u.jsx("span",{className:"text-foreground-muted ml-auto truncate max-w-[200px]",children:t.detectedPath})]},`${t.kind}:${t.name}`))})}function OE(e,t){var r,i;const s=((r=e.stages)==null?void 0:r.flatMap(l=>{const d=l.detail;if(!d)return[];const f=[];return Array.isArray(d.errors)&&f.push(...d.errors.filter(m=>typeof m=="string")),typeof d.error=="string"&&f.push(d.error),f}))??[];return((i=e.errors)==null?void 0:i.find(l=>typeof l=="string"))??s[0]??e.error??`HTTP ${t}`}function NP(){return Pt({mutationFn:async({sourceRef:e})=>{const t=await fetch("/api/bootstrap/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:e})});if(!t.ok){const s=await t.json().catch(()=>({})),r=new Error(OE(s,t.status));throw r.data=s,r}return t.json()}})}function jP(){const e=Ct();return Pt({mutationFn:async({sourceRef:t,autoApprove:s,approvedActionKeys:r})=>{const i=await fetch("/api/bootstrap/apply",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t,autoApprove:s,approvedActionKeys:r})}),l=await i.json();if(!i.ok){const d=new Error(OE(l,i.status));throw d.data=l,d}return l},onSuccess:()=>{e.invalidateQueries({queryKey:["rigs","summary"]})}})}const EP=["ENTER","PLAN","REVIEW","APPLY"],CP=EP.map((e,t)=>({num:t+1,label:e}));function _P(e){switch(e){case"enter":return 1;case"planning":return 2;case"planned":return 3;case"applying":return 4;case"done":case"error":return 4;default:return 1}}function RP(){const e=Xt(),{bootstrapSourceRef:t,setBootstrapSourceRef:s}=Co(),[r,i]=j.useState("enter"),[l,d]=j.useState(()=>t),[f,m]=j.useState(null),[h,v]=j.useState(new Set),[g,y]=j.useState(!1),[b,S]=j.useState(null),w=NP(),N=jP();j.useEffect(()=>{s(l)},[s,l]);const C=async()=>{if(l.trim()){i("planning");try{const K=await w.mutateAsync({sourceRef:l.trim()});m(K),v(new Set(K.actionKeys??[])),i("planned")}catch(K){S(K.message),i("error")}}},T=async()=>{i("applying");try{const K=await N.mutateAsync({sourceRef:l.trim(),autoApprove:g,approvedActionKeys:g?void 0:[...h]});m(K),i("done")}catch(K){S(K.message),i("error")}},_=()=>{i("enter"),d(""),m(null),v(new Set),y(!1),S(null),w.reset(),N.reset()},R=f==null?void 0:f.stages.find(K=>K.stage==="probe_requirements"),O=R==null?void 0:R.detail,B=(O==null?void 0:O.results)??[],L=f==null?void 0:f.stages.find(K=>K.stage==="build_install_plan"),M=L==null?void 0:L.detail,I=(M==null?void 0:M.actions)??[],H=(L==null?void 0:L.status)==="blocked",Y=I.some(K=>K.classification!=="manual_only"&&K.commandPreview)&&h.size===0&&!g;return u.jsx(rt,{children:u.jsxs("div",{"data-testid":"bootstrap-wizard",className:"space-y-8",children:[u.jsx(Yn,{eyebrow:"Bootstrap",title:"Bootstrap",description:"Plan environment requirements, approve install actions, then import the rig into a running topology."}),u.jsx(ME,{"data-testid":"step-indicator",steps:CP,currentStep:_P(r)}),r==="enter"&&u.jsx(Ln,{title:"Source",description:"Provide a rig spec or bundle path. Bootstrap will inspect requirements before it imports anything.",children:u.jsxs("div",{"data-testid":"step-enter",children:[u.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"SPEC OR BUNDLE PATH"}),u.jsx(m0,{"data-testid":"spec-input",type:"text",value:l,onChange:K=>d(K.target.value),placeholder:"/path/to/rig.yaml or /path/to/bundle.rigbundle",className:"font-mono text-body-md"}),u.jsxs("p",{className:"text-label-sm text-foreground-muted mt-spacing-1",children:["Accepts .yaml rig specs or .rigbundle archives."," ",u.jsx("span",{role:"link",tabIndex:0,className:"text-primary cursor-pointer","data-testid":"inspect-link",onClick:()=>e({to:"/bundles/inspect"}),onKeyDown:K=>{K.key==="Enter"&&e({to:"/bundles/inspect"})},children:"Inspect a bundle first →"})]}),u.jsx("div",{className:"mt-spacing-4",children:u.jsx(Ne,{variant:"tactical",onClick:C,disabled:!l.trim(),"data-testid":"plan-btn",children:"PLAN"})})]})}),r==="planning"&&u.jsx("div",{"data-testid":"step-planning",className:"text-body-md text-foreground-muted",children:"Planning..."}),r==="planned"&&f&&u.jsx(Ln,{title:"Plan Review",description:"Review requirement probe results and approve the install actions that bootstrap should execute.",children:u.jsxs("div",{"data-testid":"step-planned",children:[u.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"STAGES"}),u.jsx("div",{className:"space-y-spacing-1 mb-spacing-6","data-testid":"stage-list",children:f.stages.map(K=>u.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"stage-row",children:[u.jsx("span",{className:K.status==="ok"?"text-success":K.status==="blocked"?"text-warning":"text-foreground-muted",children:K.status.toUpperCase()}),u.jsx("span",{children:K.stage})]},K.stage))}),B.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"REQUIREMENTS"}),u.jsx("div",{className:"mb-spacing-6",children:u.jsx(wP,{results:B})})]}),I.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"ACTIONS"}),u.jsx("div",{className:"space-y-spacing-1 mb-spacing-4",children:I.map(K=>u.jsxs("label",{className:"flex items-center gap-spacing-3 text-label-sm font-mono cursor-pointer",children:[u.jsx("input",{type:"checkbox",checked:g||h.has(K.key),disabled:g||K.classification==="manual_only",onChange:U=>{const q=new Set(h);U.target.checked?q.add(K.key):q.delete(K.key),v(q)}}),u.jsx("span",{className:K.classification==="manual_only"?"text-warning":"",children:K.requirementName}),K.commandPreview&&u.jsx("span",{className:"text-foreground-muted",children:K.commandPreview})]},K.key))}),u.jsxs("label",{className:"flex items-center gap-spacing-2 text-label-sm mb-spacing-4",children:[u.jsx("input",{type:"checkbox",checked:g,onChange:K=>y(K.target.checked)}),"Auto-approve all trusted actions"]})]}),H&&u.jsx("div",{className:"text-warning text-label-sm mb-spacing-4","data-testid":"blocked-warning",children:"Manual requirements must be resolved before bootstrap can proceed."}),f.warnings.length>0&&u.jsx("div",{className:"mb-spacing-4",children:f.warnings.map((K,U)=>u.jsx("div",{className:"text-warning text-label-sm",children:K},U))}),u.jsx(Ne,{variant:"tactical",onClick:T,disabled:H||Y,title:H?"Manual requirements must be resolved":Y?"Select actions to approve":void 0,"data-testid":"apply-btn",children:"APPLY"})]})}),r==="applying"&&f&&u.jsx(Ln,{title:"Applying",description:"Bootstrap is executing the approved actions and importing the rig.",children:u.jsxs("div",{"data-testid":"step-applying",children:[u.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"APPLYING"}),u.jsxs("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"applying-checklist",children:[f.stages.map(K=>u.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[u.jsx("span",{className:"text-foreground-muted",children:"○"}),u.jsx("span",{children:K.stage})]},K.stage)),u.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[u.jsx("span",{className:"text-foreground-muted",children:"○"}),u.jsx("span",{children:"execute_external_installs"})]}),u.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[u.jsx("span",{className:"text-foreground-muted",children:"○"}),u.jsx("span",{children:"install_packages"})]}),u.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[u.jsx("span",{className:"text-foreground-muted",children:"○"}),u.jsx("span",{children:"import_rig"})]})]}),u.jsx("p",{className:"text-body-sm text-foreground-muted",children:"Bootstrapping..."})]})}),r==="done"&&f&&u.jsx(Ln,{title:"Result",description:"Bootstrap finished and returned the managed rig identity.",children:u.jsxs("div",{"data-testid":"step-done",children:[u.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:f.status==="completed"?"BOOTSTRAP COMPLETE":"BOOTSTRAP PARTIAL"}),u.jsxs("div",{className:"text-label-sm font-mono space-y-spacing-1 mb-spacing-4",children:[u.jsxs("div",{children:["Status: ",u.jsx("span",{className:f.status==="completed"?"text-success":"text-warning",children:f.status.toUpperCase()})]}),f.rigId&&u.jsxs("div",{"data-testid":"result-rig-id",children:["Rig: ",f.rigId]})]}),f.rigId&&u.jsx(Ne,{variant:"tactical","data-testid":"view-rig-btn",onClick:()=>e({to:"/rigs/$rigId",params:{rigId:f.rigId}}),children:"VIEW RIG"})]})}),r==="error"&&u.jsx(Ln,{title:"Bootstrap Error",description:"Bootstrap could not complete. Fix the issue and retry the plan.",children:u.jsxs("div",{"data-testid":"step-error",children:[u.jsx("p",{className:"text-destructive text-body-md mb-spacing-4",children:b}),u.jsx(Ne,{variant:"tactical",onClick:_,"data-testid":"try-again-btn",children:"TRY AGAIN"})]})})]})})}function TP(){const{currentAgentDraft:e,selectedAgentDraft:t,saveAgentDraft:s,rememberAgentDraft:r,clearSelectedAgentDraft:i}=Co(),[l,d]=j.useState(()=>(t==null?void 0:t.yaml)??(e==null?void 0:e.yaml)??""),[f,m]=j.useState("idle"),[h,v]=j.useState([]);j.useEffect(()=>{s(l)},[s,l]),j.useEffect(()=>{t&&(d(t.yaml),i())},[i,t]);const g=async()=>{r(l),m("pending"),v([]);try{const y=await fetch("/api/agents/validate",{method:"POST",headers:{"Content-Type":"text/yaml"},body:l}),b=await y.json().catch(()=>({}));if(y.ok&&b.valid){m("valid");return}v(b.errors??["Validation failed"]),m("invalid")}catch{v(["Validation request failed"]),m("error")}};return u.jsx(rt,{children:u.jsxs("div",{"data-testid":"agent-spec-validate-flow",className:"space-y-8",children:[u.jsx(Yn,{eyebrow:"Agent Spec Validation",title:"VALIDATE AGENT",description:"Check an AgentSpec before you use it in a rig."}),u.jsxs(Ln,{title:"Agent YAML",description:"Paste or refine an AgentSpec draft, then validate it against the daemon contract.",children:[u.jsx(p0,{"data-testid":"agent-spec-yaml-input",value:l,onChange:y=>d(y.target.value),placeholder:"Paste agent.yaml here...",rows:16,className:"bg-background font-mono text-body-sm"}),u.jsx("div",{className:"flex flex-wrap gap-2",children:u.jsx(Ne,{variant:"tactical","data-testid":"agent-spec-validate-btn",onClick:g,disabled:!l.trim()||f==="pending",children:f==="pending"?"VALIDATING...":"VALIDATE AGENTSPEC"})}),f==="valid"&&u.jsx(Qt,{className:"mt-spacing-1","data-testid":"agent-spec-valid",children:u.jsx(Kt,{className:"text-primary",children:"AgentSpec valid."})}),(f==="invalid"||f==="error")&&u.jsx(Qt,{className:"mt-spacing-1","data-testid":"agent-spec-invalid",children:u.jsx(Kt,{children:u.jsx("ul",{className:"list-disc pl-5",children:h.map(y=>u.jsx("li",{children:y},y))})})})]})]})})}async function AP(e,t="draft"){var r;const s=await fetch("/api/specs/review/rig",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:e,sourceState:t})});if(!s.ok){const i=await s.json().catch(()=>({}));throw new Error(((r=i.errors)==null?void 0:r.join("; "))??`HTTP ${s.status}`)}return s.json()}async function MP(e,t="draft"){var r;const s=await fetch("/api/specs/review/agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({yaml:e,sourceState:t})});if(!s.ok){const i=await s.json().catch(()=>({}));throw new Error(((r=i.errors)==null?void 0:r.join("; "))??`HTTP ${s.status}`)}return s.json()}function DE(e){let t=0;for(let s=0;s<e.length;s++)t=(t<<5)-t+e.charCodeAt(s)|0;return t}function kP(e,t="draft"){return Tt({queryKey:["spec-review","rig",e?DE(e):null,t],queryFn:()=>AP(e,t),enabled:!!e})}function OP(e,t="draft"){return Tt({queryKey:["spec-review","agent",e?DE(e):null,t],queryFn:()=>MP(e,t),enabled:!!e})}const DP=160,LP=48,OS=200,zP=100;function PP(e){switch(e){case"claude-code":return"#d4c4a8";case"codex":return"#b8c9d4";case"terminal":return"#c4c4c4";default:return"#e0ddd4"}}function IP(e){const t=new Map,s=[];for(const l of e)l.pod?(t.has(l.pod)||t.set(l.pod,[]),t.get(l.pod).push(l)):s.push(l);const r=[];let i=0;for(const[,l]of t)l.forEach((d,f)=>{r.push({id:d.id,x:f*OS,y:i})}),i+=zP;return s.forEach((l,d)=>{r.push({id:l.id,x:d*OS,y:i})}),r}function BP({graph:e,testId:t}){const s=e??{nodes:[],edges:[]},{nodes:r,edges:i}=j.useMemo(()=>{const l=IP(s.nodes),d=new Map(l.map(h=>[h.id,h])),f=s.nodes.map(h=>{const v=d.get(h.id)??{x:0,y:0};return{id:h.id,type:"default",position:{x:v.x,y:v.y},data:{label:`${h.pod?`${h.pod} / `:""}${h.label}`},style:{backgroundColor:PP(h.runtime),border:"1px solid #8a8577",fontSize:11,fontFamily:"monospace",width:DP,height:LP}}}),m=s.edges.map((h,v)=>({id:`e-${v}`,source:h.source,target:h.target,label:h.kind,labelStyle:{fontSize:9,fontFamily:"monospace"},style:{strokeDasharray:"4 4",stroke:"#8a8577"}}));return{nodes:f,edges:m}},[s]);return u.jsx("div",{"data-testid":t??"spec-topology-preview",className:"w-full h-[400px] bg-stone-50 border border-stone-200",children:u.jsxs(wE,{nodes:r,edges:i,fitView:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[u.jsx(J8,{gap:20,size:.5,color:"#d4d0c8"}),u.jsx(EE,{showInteractive:!1})]})})}function LE({review:e,yaml:t,testIdPrefix:s="",yamlTestId:r,onMemberClick:i}){const[l,d]=j.useState("topology"),f=(e==null?void 0:e.pods)??[],m=(e==null?void 0:e.nodes)??[],h=(e==null?void 0:e.edges)??[],v=s?`${s}-`:"";return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"flex gap-1 border-b border-stone-200",children:["topology","configuration","yaml"].map(g=>u.jsx("button",{"data-testid":`${v}tab-${g}`,onClick:()=>d(g),className:`px-3 py-1.5 font-mono text-[10px] uppercase tracking-wider transition-colors ${l===g?"border-b-2 border-stone-900 text-stone-900 font-bold":"text-stone-500 hover:text-stone-700"}`,children:g},g))}),l==="topology"&&e&&u.jsx(BP,{graph:e.graph,testId:`${v}topology-preview`}),l==="configuration"&&e&&u.jsxs("div",{"data-testid":`${v}config-tables`,className:"space-y-4",children:[e.format==="pod_aware"&&f.map(g=>u.jsxs("div",{className:"border border-stone-200 p-3",children:[u.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:g.label??g.id}),u.jsxs("table",{className:"w-full font-mono text-[10px]",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[u.jsx("th",{className:"text-left py-1",children:"Member"}),u.jsx("th",{className:"text-left py-1",children:"Agent Ref"}),u.jsx("th",{className:"text-left py-1",children:"Runtime"}),u.jsx("th",{className:"text-left py-1",children:"Profile"})]})}),u.jsx("tbody",{children:g.members.map(y=>u.jsxs("tr",{className:"border-b border-stone-100",children:[u.jsx("td",{className:"py-1",children:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{children:y.id}),i&&u.jsx(Ne,{variant:"outline",size:"sm","data-testid":`${v}member-open-agent-${g.id}-${y.id}`,className:"h-6 px-2 font-mono text-[9px] uppercase tracking-[0.12em]",onClick:()=>i(g.id,y),children:"Agent Spec"})]})}),u.jsx("td",{className:"py-1 text-stone-600",children:y.agentRef}),u.jsx("td",{className:"py-1",children:y.runtime}),u.jsx("td",{className:"py-1 text-stone-500",children:y.profile??"—"})]},y.id))})]})]},g.id)),e.format==="legacy"&&m.length>0&&u.jsxs("div",{className:"border border-stone-200 p-3",children:[u.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Nodes"}),u.jsxs("table",{className:"w-full font-mono text-[10px]",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[u.jsx("th",{className:"text-left py-1",children:"ID"}),u.jsx("th",{className:"text-left py-1",children:"Runtime"}),u.jsx("th",{className:"text-left py-1",children:"Role"})]})}),u.jsx("tbody",{children:m.map(g=>u.jsxs("tr",{className:"border-b border-stone-100",children:[u.jsx("td",{className:"py-1",children:g.id}),u.jsx("td",{className:"py-1",children:g.runtime}),u.jsx("td",{className:"py-1 text-stone-500",children:g.role??"—"})]},g.id))})]})]}),h.length>0&&u.jsxs("div",{className:"border border-stone-200 p-3",children:[u.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:e.format==="pod_aware"?"Cross-Pod Edges":"Edges"}),u.jsxs("table",{className:"w-full font-mono text-[10px]",children:[u.jsx("thead",{children:u.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[u.jsx("th",{className:"text-left py-1",children:"From"}),u.jsx("th",{className:"text-left py-1",children:"To"}),u.jsx("th",{className:"text-left py-1",children:"Kind"})]})}),u.jsx("tbody",{children:h.map((g,y)=>u.jsxs("tr",{className:"border-b border-stone-100",children:[u.jsx("td",{className:"py-1",children:g.from}),u.jsx("td",{className:"py-1",children:g.to}),u.jsx("td",{className:"py-1 text-stone-500",children:g.kind})]},y))})]})]})]}),l==="yaml"&&u.jsx(kE,{title:"YAML Preview",testId:r??`${v}spec-yaml`,children:t})]})}function HP(){const e=Xt(),{selectedRigDraft:t,currentRigDraft:s}=Co(),r=t??s,{data:i,isLoading:l,error:d}=kP((r==null?void 0:r.yaml)??null),f=(i==null?void 0:i.pods)??[],m=(i==null?void 0:i.nodes)??[],h=(i==null?void 0:i.edges)??[];return r?u.jsx(rt,{children:u.jsxs("div",{"data-testid":"rig-spec-review",className:"space-y-6",children:[u.jsx(Yn,{eyebrow:"Rig Spec Review",title:(i==null?void 0:i.name)??r.label,description:(i==null?void 0:i.summary)??"Review the spec structure before import or bootstrap.",actions:u.jsxs(u.Fragment,{children:[u.jsx(Ne,{variant:"outline",size:"sm",onClick:()=>e({to:"/import"}),children:"Open In Import"}),u.jsx(Ne,{variant:"outline",size:"sm",onClick:()=>e({to:"/bootstrap"}),children:"Bootstrap"})]})}),i&&u.jsxs(_f,{children:[u.jsx(Ut,{label:"Format",value:i.format==="pod_aware"?"Pod-Aware":"Legacy",testId:"rig-spec-summary-format"}),u.jsx(Ut,{label:i.format==="pod_aware"?"Pods":"Nodes",value:i.format==="pod_aware"?f.length:m.length,testId:"rig-spec-summary-pods"}),u.jsx(Ut,{label:"Members",value:i.format==="pod_aware"?f.reduce((v,g)=>v+g.members.length,0):m.length,testId:"rig-spec-summary-members"}),u.jsx(Ut,{label:"Edges",value:h.length+(i.format==="pod_aware"?f.reduce((v,g)=>{var y;return v+(((y=g.edges)==null?void 0:y.length)??0)},0):0),testId:"rig-spec-summary-edges"})]}),l&&u.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading review..."}),d&&u.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:d.message}),u.jsx(LE,{review:i,yaml:r.yaml,yamlTestId:"rig-spec-yaml"})]})}):u.jsx(rt,{children:u.jsxs("div",{"data-testid":"rig-spec-review-empty",className:"space-y-5",children:[u.jsx(Yn,{eyebrow:"Rig Spec Review",title:"No RigSpec Selected",description:"Choose a current or recent rig draft from the Specs drawer to review it here before you import or bootstrap it."}),u.jsx(Ne,{variant:"outline",size:"sm",onClick:()=>e({to:"/import"}),children:"Open Import"})]})})}function v0({review:e,yaml:t,testIdPrefix:s="agent"}){const r=(e==null?void 0:e.profiles)??[],i=(e==null?void 0:e.resources)??{skills:[],guidance:[],hooks:[]},l=(e==null?void 0:e.startup)??{files:[],actions:[]};return u.jsxs(u.Fragment,{children:[r.length>0&&u.jsxs("div",{"data-testid":`${s}-profiles-section`,className:"border border-stone-200 p-3",children:[u.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Profiles"}),u.jsx("div",{className:"space-y-1",children:r.map(d=>u.jsxs("div",{className:"font-mono text-[10px] flex justify-between",children:[u.jsx("span",{className:"font-bold",children:d.name}),d.description&&u.jsx("span",{className:"text-stone-500",children:d.description})]},d.name))})]}),u.jsxs("div",{"data-testid":`${s}-resources-section`,className:"border border-stone-200 p-3",children:[u.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Resources"}),u.jsxs("div",{className:"space-y-2 font-mono text-[10px]",children:[i.skills.length>0&&u.jsxs("div",{children:[u.jsx("span",{className:"text-stone-500",children:"Skills:"})," ",i.skills.map((d,f)=>u.jsx("span",{className:"inline-block bg-stone-100 px-1.5 py-0.5 mr-1 mb-0.5",children:d},f))]}),i.guidance.length>0&&u.jsxs("div",{children:[u.jsx("span",{className:"text-stone-500",children:"Guidance:"})," ",i.guidance.map((d,f)=>u.jsx("span",{className:"inline-block bg-stone-100 px-1.5 py-0.5 mr-1 mb-0.5",children:d},f))]}),i.hooks.length>0&&u.jsxs("div",{children:[u.jsx("span",{className:"text-stone-500",children:"Hooks:"})," ",i.hooks.join(", ")]})]})]}),(l.files.length>0||l.actions.length>0)&&u.jsxs("div",{"data-testid":`${s}-startup-section`,className:"border border-stone-200 p-3",children:[u.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Startup"}),l.files.length>0&&u.jsxs("div",{className:"mb-2",children:[u.jsx("div",{className:"font-mono text-[9px] text-stone-500 uppercase mb-1",children:"Files"}),l.files.map((d,f)=>u.jsxs("div",{className:"font-mono text-[10px]",children:[d.path," ",d.required&&u.jsx("span",{className:"text-red-500 text-[8px]",children:"REQUIRED"})]},f))]}),l.actions.length>0&&u.jsxs("div",{children:[u.jsx("div",{className:"font-mono text-[9px] text-stone-500 uppercase mb-1",children:"Actions"}),l.actions.map((d,f)=>u.jsxs("div",{className:"font-mono text-[10px]",children:[u.jsxs("span",{className:"text-stone-500",children:[d.type,":"]})," ",d.value]},f))]})]}),u.jsx(kE,{title:"YAML Preview",testId:`${s}-spec-yaml`,children:t})]})}function UP(){const e=Xt(),{selectedAgentDraft:t,currentAgentDraft:s}=Co(),r=t??s,{data:i,isLoading:l,error:d}=OP((r==null?void 0:r.yaml)??null);return r?u.jsx(rt,{children:u.jsxs("div",{"data-testid":"agent-spec-review",className:"space-y-6",children:[u.jsx(Yn,{eyebrow:"Agent Spec Review",title:(i==null?void 0:i.name)??r.label,description:(i==null?void 0:i.description)??"Review the agent spec structure before validation.",actions:u.jsx(Ne,{variant:"outline",size:"sm",onClick:()=>e({to:"/agents/validate"}),children:"Open In Validate"})}),i&&u.jsxs(_f,{children:[u.jsx(Ut,{label:"Format",value:"AgentSpec",testId:"agent-spec-summary-format"}),u.jsx(Ut,{label:"Version",value:i.version,testId:"agent-spec-summary-version"}),u.jsx(Ut,{label:"Profiles",value:(i.profiles??[]).length,testId:"agent-spec-summary-profiles"}),u.jsx(Ut,{label:"Skills",value:(i.resources??{skills:[]}).skills.length,testId:"agent-spec-summary-skills"})]}),l&&u.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading review..."}),d&&u.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:d.message}),u.jsx(v0,{review:i,yaml:r.yaml,testIdPrefix:"agent"})]})}):u.jsx(rt,{children:u.jsxs("div",{"data-testid":"agent-spec-review-empty",className:"space-y-5",children:[u.jsx(Yn,{eyebrow:"Agent Spec Review",title:"No AgentSpec Selected",description:"Choose a current or recent agent draft from the Specs drawer to review it here before you validate it."}),u.jsx(Ne,{variant:"outline",size:"sm",onClick:()=>e({to:"/agents/validate"}),children:"Open Validate"})]})})}function $P(){return Pt({mutationFn:async({bundlePath:e})=>{const t=await fetch("/api/bundles/inspect",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bundlePath:e})}),s=await t.json();if(s.error)throw new Error(s.error);if(!t.ok)throw new Error(`HTTP ${t.status}`);return s}})}function qP(){return Pt({mutationFn:async({bundlePath:e,plan:t,autoApprove:s,targetRoot:r})=>{const i=await fetch("/api/bundles/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bundlePath:e,plan:t,autoApprove:s,targetRoot:r})}),l=await i.json();if(!i.ok)throw new Error(l.error??`HTTP ${i.status}`);return l}})}function VP(){var l,d;const[e,t]=j.useState(""),s=$P(),r=()=>{e.trim()&&s.mutate({bundlePath:e.trim()})},i=s.data;return u.jsx(rt,{children:u.jsxs("div",{"data-testid":"bundle-inspector",children:[u.jsx("h2",{className:"text-headline-lg uppercase mb-spacing-4",children:"INSPECT BUNDLE"}),u.jsxs("div",{className:"mb-spacing-4",children:[u.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"BUNDLE PATH"}),u.jsx("input",{"data-testid":"bundle-path-input",type:"text",value:e,onChange:f=>t(f.target.value),placeholder:"/path/to/my-rig.rigbundle",className:"w-full bg-transparent border-b border-foreground/20 py-spacing-2 text-body-md font-mono focus:outline-none focus:border-primary"}),u.jsx(Ne,{variant:"tactical",onClick:r,disabled:!e.trim()||s.isPending,className:"mt-spacing-3","data-testid":"inspect-btn",children:s.isPending?"INSPECTING...":"INSPECT"})]}),s.isError&&u.jsx("div",{className:"text-destructive text-body-md mb-spacing-4","data-testid":"inspect-error",children:s.error.message}),i&&u.jsxs("div",{"data-testid":"inspect-result",children:[u.jsxs("div",{className:"card-dark p-spacing-4 mb-spacing-4","data-testid":"manifest-summary",children:[u.jsxs("div",{className:"flex items-center gap-spacing-2 mb-spacing-2",children:[u.jsx("h3",{className:"text-headline-md uppercase",children:i.manifest.name}),u.jsxs("span",{className:"text-label-sm font-mono px-spacing-2 py-px bg-foreground/10","data-testid":"schema-badge",children:["v",i.manifest.schemaVersion??1]})]}),u.jsxs("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:["v",i.manifest.version]}),u.jsxs("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:["Spec: ",i.manifest.rigSpec]}),u.jsxs("div",{className:"mt-spacing-2 flex gap-spacing-3",children:[u.jsxs("span",{className:Te("text-label-sm",i.digestValid?"text-success":"text-destructive"),children:["DIGEST: ",i.digestValid?"VALID":"INVALID"]}),u.jsxs("span",{className:Te("text-label-sm",i.integrityResult.passed?"text-success":"text-destructive"),"data-testid":"integrity-status",children:["INTEGRITY: ",i.integrityResult.passed?"PASS":"FAIL"]})]})]}),i.manifest.schemaVersion===2&&i.manifest.agents?u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"AGENTS"}),u.jsx("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"agent-list",children:i.manifest.agents.map(f=>u.jsxs("div",{className:"text-label-sm font-mono","data-testid":"agent-entry",children:[f.name," v",f.version," — ",f.path]},f.name))})]}):u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"PACKAGES"}),u.jsx("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"package-list",children:(i.manifest.packages??[]).map(f=>u.jsxs("div",{className:"text-label-sm font-mono","data-testid":"package-entry",children:[f.name," v",f.version," — ",f.path]},f.name))})]}),i.integrityResult&&u.jsxs(u.Fragment,{children:[u.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"FILE INTEGRITY"}),u.jsxs("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"file-integrity",children:[Object.keys((i.manifest.packages??i.manifest.agents??[]).length>0?((d=(l=i.manifest)==null?void 0:l.integrity)==null?void 0:d.files)??{}:{}).map(f=>{const m=i.integrityResult.mismatches.includes(f),h=i.integrityResult.missing.includes(f),v=m?"MISMATCH":h?"MISSING":"OK";return u.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"file-row",children:[u.jsx("span",{className:Te("w-2 h-2",v==="OK"?"bg-success":"bg-destructive"),"data-testid":"file-dot"}),u.jsx("span",{children:f}),u.jsx("span",{className:"text-foreground-muted ml-auto",children:v})]},f)}),i.integrityResult.extra.map(f=>u.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"file-row",children:[u.jsx("span",{className:"w-2 h-2 bg-warning","data-testid":"file-dot"}),u.jsx("span",{children:f}),u.jsx("span",{className:"text-foreground-muted ml-auto",children:"EXTRA"})]},f))]})]}),u.jsx(Ne,{variant:"tactical","data-testid":"install-btn",onClick:()=>window.location.href=`/bundles/install?bundlePath=${encodeURIComponent(e)}`,children:"INSTALL THIS BUNDLE"})]})]})})}function GP(){const e=Xt(),[t,s]=j.useState("enter"),r=typeof window<"u"?new URLSearchParams(window.location.search):null,[i,l]=j.useState((r==null?void 0:r.get("bundlePath"))??""),[d,f]=j.useState(""),[m,h]=j.useState(null),[v,g]=j.useState(null),y=qP(),b=async()=>{if(i.trim()){s("planning");try{const w=await y.mutateAsync({bundlePath:i.trim(),plan:!0});h(w),s("planned")}catch(w){g(w.message),s("error")}}},S=async()=>{if(d.trim()){s("applying");try{const w=await y.mutateAsync({bundlePath:i.trim(),autoApprove:!0,targetRoot:d.trim()});h(w),s("done")}catch(w){g(w.message),s("error")}}};return u.jsx(rt,{children:u.jsxs("div",{"data-testid":"bundle-install-flow",children:[u.jsx("h2",{className:"text-headline-lg uppercase mb-spacing-4",children:"INSTALL BUNDLE"}),t==="enter"&&u.jsxs("div",{"data-testid":"step-enter",children:[u.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"BUNDLE PATH"}),u.jsx("input",{"data-testid":"bundle-input",type:"text",value:i,onChange:w=>l(w.target.value),placeholder:"/path/to/my-rig.rigbundle",className:"w-full bg-transparent border-b border-foreground/20 py-spacing-2 text-body-md font-mono focus:outline-none focus:border-primary mb-spacing-4"}),u.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"TARGET ROOT"}),u.jsx("input",{"data-testid":"target-input",type:"text",value:d,onChange:w=>f(w.target.value),placeholder:"/path/to/target/project",className:"w-full bg-transparent border-b border-foreground/20 py-spacing-2 text-body-md font-mono focus:outline-none focus:border-primary mb-spacing-4"}),u.jsx(Ne,{variant:"tactical",onClick:b,disabled:!i.trim(),"data-testid":"plan-btn",children:"PLAN"})]}),t==="planning"&&u.jsx("div",{"data-testid":"step-planning",className:"text-foreground-muted",children:"Planning..."}),t==="planned"&&m&&u.jsxs("div",{"data-testid":"step-planned",children:[u.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"PLAN"}),u.jsx("div",{className:"space-y-spacing-1 mb-spacing-4",children:m.stages.map(w=>u.jsxs("div",{className:"text-label-sm font-mono",children:[u.jsx("span",{className:w.status==="ok"?"text-success":"text-foreground-muted",children:w.status.toUpperCase()})," ",w.stage]},w.stage))}),u.jsx(Ne,{variant:"tactical",onClick:S,disabled:!d.trim(),"data-testid":"apply-btn",children:"APPLY"})]}),t==="applying"&&u.jsx("div",{"data-testid":"step-applying",className:"text-foreground-muted",children:"Installing..."}),t==="done"&&m&&u.jsxs("div",{"data-testid":"step-done",children:[u.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"COMPLETE"}),u.jsxs("div",{className:"text-label-sm font-mono",children:["Status: ",u.jsx("span",{className:"text-success",children:m.status.toUpperCase()}),m.stages.some(w=>{var N;return((N=w.detail)==null?void 0:N.source)==="pod_bundle"})?u.jsx("span",{className:"ml-spacing-2 text-primary","data-testid":"bundle-type-label",children:"Pod-aware bundle"}):u.jsx("span",{className:"ml-spacing-2 text-foreground-muted","data-testid":"bundle-type-label",children:"Legacy bundle"})]}),m.rigId&&u.jsxs("div",{className:"text-label-sm font-mono","data-testid":"result-rig-id",children:["Rig: ",m.rigId]}),m.rigId&&u.jsx(Ne,{variant:"tactical",className:"mt-spacing-3",onClick:()=>e({to:"/rigs/$rigId",params:{rigId:m.rigId}}),children:"VIEW RIG"})]}),t==="error"&&u.jsxs("div",{"data-testid":"step-error",children:[u.jsx("p",{className:"text-destructive text-body-md mb-spacing-4",children:v}),u.jsx(Ne,{variant:"tactical",onClick:()=>{s("enter"),g(null),y.reset()},"data-testid":"try-again-btn",children:"TRY AGAIN"})]})]})})}function zE({sourcePath:e,sourceState:t}){return u.jsxs("div",{className:"font-mono text-[9px] text-stone-500","data-testid":"library-provenance",children:["Source: ",e," · ",t]})}function YP({review:e}){const t=Xt(),s=e.profiles??[],r=e.resources??{skills:[]};return u.jsx(rt,{children:u.jsxs("div",{"data-testid":"library-review-agent",className:"space-y-6",children:[u.jsx(Yn,{eyebrow:"Library — Agent Spec",title:e.name,description:e.description??"Agent spec from library.",actions:u.jsx(Ne,{variant:"outline",size:"sm",onClick:()=>t({to:"/agents/validate"}),children:"Validate"})}),u.jsx(zE,{sourcePath:e.sourcePath,sourceState:e.sourceState}),u.jsxs(_f,{children:[u.jsx(Ut,{label:"Format",value:"AgentSpec",testId:"lib-agent-format"}),u.jsx(Ut,{label:"Version",value:e.version,testId:"lib-agent-version"}),u.jsx(Ut,{label:"Profiles",value:s.length,testId:"lib-agent-profiles"}),u.jsx(Ut,{label:"Skills",value:r.skills.length,testId:"lib-agent-skills"})]}),u.jsx(v0,{review:e,yaml:e.raw,testIdPrefix:"lib-agent"})]})})}function QP({review:e}){const t=Xt(),{data:s=[]}=Yd("agent"),r=new Map(s.map(m=>[m.name,m])),i=e.pods??[],l=e.nodes??[],d=e.edges??[],f=m=>{const h=m.match(/^local:agents\/([^/]+)$/);return h!=null&&h[1]?r.get(h[1])??null:null};return u.jsx(rt,{children:u.jsxs("div",{"data-testid":"library-review-rig",className:"space-y-6",children:[u.jsx(Yn,{eyebrow:"Library — Rig Spec",title:e.name,description:e.summary??"Rig spec from library.",actions:u.jsx(Ne,{variant:"outline",size:"sm",onClick:()=>t({to:"/import"}),children:"Import"})}),u.jsx(zE,{sourcePath:e.sourcePath,sourceState:e.sourceState}),u.jsxs(_f,{children:[u.jsx(Ut,{label:"Format",value:e.format==="pod_aware"?"Pod-Aware":"Legacy",testId:"lib-rig-format"}),u.jsx(Ut,{label:e.format==="pod_aware"?"Pods":"Nodes",value:e.format==="pod_aware"?i.length:l.length,testId:"lib-rig-pods"}),u.jsx(Ut,{label:"Members",value:e.format==="pod_aware"?i.reduce((m,h)=>m+h.members.length,0):l.length,testId:"lib-rig-members"}),u.jsx(Ut,{label:"Edges",value:d.length+(e.format==="pod_aware"?i.reduce((m,h)=>{var v;return m+(((v=h.edges)==null?void 0:v.length)??0)},0):0),testId:"lib-rig-edges"})]}),u.jsx(LE,{review:e,yaml:e.raw,testIdPrefix:"lib",yamlTestId:"lib-rig-yaml",onMemberClick:(m,h)=>{const v=f(h.agentRef);v&&t({to:"/specs/library/$entryId",params:{entryId:v.id}})}})]})})}function KP({entryId:e}){const t=Xt(),{data:s,isLoading:r,error:i}=Yg(e);return r?u.jsx(rt,{children:u.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading spec review..."})}):i||!s?u.jsx(rt,{children:u.jsxs("div",{"data-testid":"library-review-error",className:"space-y-4",children:[u.jsx(Yn,{eyebrow:"Library",title:"Spec Not Found",description:(i==null?void 0:i.message)??"Could not load spec."}),u.jsx(Ne,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back to Specs"})]})}):s.kind==="agent"?u.jsx(YP,{review:s}):u.jsx(QP,{review:s})}function FP(e){if(!e)return null;const t=e.match(/^local:agents\/([^/]+)$/);return(t==null?void 0:t[1])??null}function XP({agentRef:e}){const t=FP(e),{data:s=[],isLoading:r}=Yd("agent"),i=t?s.filter(m=>m.name===t):[],l=i.length===1?i[0].id:null,{data:d,isLoading:f}=Yg(l);return t?r||f?u.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading agent spec..."}):i.length===0?u.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"}):i.length>1?u.jsxs("div",{"data-testid":"agent-spec-ambiguous",className:"p-4 font-mono text-[10px] text-amber-600",children:["Agent spec ambiguous (",i.length,' matches for "',t,'")']}):!d||d.kind!=="agent"?u.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"}):u.jsx(v0,{review:d,yaml:d.raw,testIdPrefix:"live-agent"}):u.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"})}function ZP({rigId:e,logicalId:t}){const{data:s,isLoading:r,error:i}=DN(e,t),[l,d]=j.useState("identity"),f=s?s.nodeKind!=="infrastructure":!0,m=f?["identity","agent-spec","startup","transcript"]:["identity","startup","transcript"];return u.jsx(rt,{children:u.jsxs("div",{"data-testid":"live-node-details",className:"space-y-6",children:[u.jsx(Yn,{eyebrow:"Live Node Details",title:(s==null?void 0:s.canonicalSessionName)??t,description:`${(s==null?void 0:s.rigName)??e} / ${(s==null?void 0:s.podNamespace)??cs(t)??us((s==null?void 0:s.podId)??null)} / ${t}`}),r&&u.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading..."}),i&&u.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:i.message}),u.jsx("div",{className:"flex gap-1 border-b border-stone-200",children:m.map(h=>u.jsx("button",{"data-testid":`live-tab-${h}`,onClick:()=>d(h),className:`px-3 py-1.5 font-mono text-[10px] uppercase tracking-wider transition-colors ${l===h?"border-b-2 border-stone-900 text-stone-900 font-bold":"text-stone-500 hover:text-stone-700"}`,children:h.replace("-"," ")},h))}),s&&l==="identity"&&u.jsx(LN,{peers:s.peers,edges:s.edges,transcript:s.transcript,compactSpec:s.compactSpec,contextUsage:s.contextUsage}),s&&l==="agent-spec"&&f&&u.jsx(XP,{agentRef:s.agentRef}),s&&l==="startup"&&u.jsx("div",{"data-testid":"live-startup-section",className:"space-y-4",children:s.startupFiles.length>0&&u.jsxs("div",{className:"border border-stone-200 p-3",children:[u.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Startup Files"}),s.startupFiles.map((h,v)=>u.jsxs("div",{className:"font-mono text-[10px]",children:[h.path," ",u.jsxs("span",{className:"text-stone-400",children:["(",h.deliveryHint,")"]}),h.required&&u.jsx("span",{className:"text-red-500 text-[8px] ml-1",children:"REQUIRED"})]},v))]})}),s&&l==="transcript"&&u.jsx("div",{"data-testid":"live-transcript-section",className:"space-y-4",children:s.transcript.enabled?u.jsxs("div",{className:"border border-stone-200 p-3",children:[u.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Transcript"}),u.jsx("div",{className:"font-mono text-[10px] text-stone-700",children:s.transcript.path}),s.transcript.tailCommand&&u.jsx("code",{className:"block mt-1 font-mono text-[9px] text-stone-500 bg-stone-100 px-2 py-1",children:s.transcript.tailCommand})]}):u.jsx("div",{className:"font-mono text-[10px] text-stone-400 p-4",children:"Transcript capture not enabled"})})]})})}function WP(e){switch(e){case"claude-code":return"text-primary";case"codex":return"text-accent";case"terminal":return"text-foreground";default:return"text-foreground-muted"}}function JP(e){switch(e){case"claude-code":return"Claude Code";case"codex":return"Codex";case"terminal":return"Terminal";default:return"Unknown"}}function eI(e){return`'${e.replace(/'/g,"'\\''")}'`}function tI(e){const t=e.tmuxWindow?`${e.tmuxSession}:${e.tmuxWindow}`:e.tmuxSession;return`tmux attach -t ${eI(t)}`}function DS({label:e,activeLabel:t,onClick:s,testId:r}){const[i,l]=j.useState(!1),d=j.useRef(null);j.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]);const f=async()=>{await s()&&(l(!0),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{l(!1),d.current=null},900))};return u.jsx("button",{type:"button","data-testid":r,onClick:()=>{f()},className:Te("px-spacing-2 py-1 border font-mono text-[10px] uppercase transition-colors duration-150 ease-tactical",i?"bg-stone-900 text-white border-stone-900":"bg-white text-stone-900 border-stone-300 hover:bg-stone-100"),children:i?t:e})}function nI({session:e,onAdopt:t}){return u.jsx("div",{"data-testid":"discovered-node",className:Te("border-dashed border border-foreground/20 bg-[rgba(255,255,255,0.72)] px-spacing-4 py-spacing-3 mb-spacing-2 shadow-[0_10px_28px_rgba(20,20,20,0.04)] backdrop-blur-sm"),children:u.jsxs("div",{className:"flex flex-col gap-spacing-3 lg:flex-row lg:items-center lg:justify-between",children:[u.jsxs("div",{className:"min-w-0 flex-1",children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-x-spacing-3 gap-y-spacing-1",children:[u.jsx("div",{"data-testid":"runtime-badge",className:Te("text-[10px] uppercase tracking-[0.08em]",WP(e.runtimeHint)),children:JP(e.runtimeHint)}),u.jsx("div",{"data-testid":"session-name",className:"font-mono text-[13px] leading-5 text-foreground",title:e.tmuxSession,children:e.tmuxSession}),e.confidence==="medium"?u.jsx("div",{"data-testid":"runtime-inferred-note",className:"text-[10px] uppercase tracking-[0.08em] text-foreground-muted",children:"runtime inferred"}):null]}),e.cwd?u.jsxs("div",{className:"mt-spacing-2 min-w-0",children:[u.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-foreground-muted",children:"cwd"}),u.jsx("div",{className:"font-mono text-[12px] leading-5 text-foreground-muted truncate",title:e.cwd,children:e.cwd})]}):null]}),u.jsxs("div",{className:"flex flex-wrap items-center gap-spacing-2 lg:justify-end",children:[u.jsx(DS,{label:"copy tmux",activeLabel:"copied",testId:"copy-tmux-btn",onClick:async()=>await ds(tI(e))}),e.cwd?u.jsx(DS,{label:"copy cwd",activeLabel:"copied",testId:"copy-cwd-btn",onClick:async()=>await ds(e.cwd??"")}):null,u.jsx(Ne,{variant:"tactical",size:"sm","data-testid":"adopt-btn",onClick:()=>t(e.id),children:"ADOPT"})]})]})})}function sI(){const[e,t]=j.useState(null),[s,r]=j.useState(!1),i=j.useCallback(async()=>{r(!0);try{const l=await fetch("/api/discovery/draft-rig",{method:"POST"});if(!l.ok){t(`# Error: draft generation failed (HTTP ${l.status})`);return}const d=await l.text();t(d)}catch{t("# Error: failed to reach daemon")}finally{r(!1)}},[]);return u.jsxs("div",{className:"mt-spacing-4 border-t border-foreground/10 pt-spacing-4","data-testid":"generate-draft-section",children:[u.jsx(Ne,{variant:"tactical",onClick:i,disabled:s,"data-testid":"generate-draft-btn",className:"mb-spacing-3",children:s?"GENERATING...":"GENERATE RIG SPEC"}),e&&(()=>{const l=e.split(`
223
- `),d=l.filter(m=>m.startsWith("# WARNING:")).map(m=>m.replace(/^# WARNING:\s*/,"")),f=l.filter(m=>!m.startsWith("# WARNING:")).join(`
224
- `).trim();return u.jsxs("div",{className:"relative",children:[d.length>0&&u.jsx("div",{className:"mb-spacing-2 p-spacing-2 bg-warning/10 border border-warning/30 text-label-sm","data-testid":"draft-warnings",children:d.map((m,h)=>u.jsx("div",{className:"text-warning font-mono",children:m},h))}),u.jsx("pre",{className:"bg-surface-low p-spacing-3 text-label-sm font-mono overflow-x-auto max-h-64 border border-foreground/10","data-testid":"draft-yaml",children:f}),u.jsx("button",{onClick:()=>{var m;return(m=navigator.clipboard)==null?void 0:m.writeText(e)},className:"absolute top-2 right-2 text-label-sm text-foreground-muted hover:text-foreground","data-testid":"copy-draft-btn",children:"COPY"})]})})()]})}function aI(){var T,_;const{data:e=[]}=Gg({status:"active",runtimeHint:["claude-code","codex"],minConfidence:"medium"}),t=zN(),{data:s=[]}=xc(),r=W3(),i=e,[l,d]=j.useState(null),[f,m]=j.useState(!1),[h,v]=j.useState(""),[g,y]=j.useState(""),b=R=>{d(R),m(!0),v(""),y(""),r.reset()},S=()=>{m(!1),d(null)},w=()=>{!l||!h||!g.trim()||r.mutate({discoveredId:l,rigId:h,logicalId:g.trim()},{onSuccess:S})},N=((T=r.error)==null?void 0:T.message)??null,C=r.isPending;return u.jsx(rt,{children:u.jsxs("div",{"data-testid":"discovery-overlay",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"flex flex-col gap-spacing-4 border-b border-foreground/10 pb-spacing-5 sm:flex-row sm:items-end sm:justify-between",children:[u.jsxs("div",{className:"max-w-[620px]",children:[u.jsx("h2",{className:"text-headline-lg uppercase",children:"DISCOVERY"}),u.jsx("p",{className:"mt-spacing-1 text-body-md text-foreground-muted",children:"Running agent sessions currently visible on this machine. Copy a tmux attach command, review the working directory, or adopt the session into a rig."})]}),u.jsx(Ne,{variant:"ghost",size:"sm","data-testid":"scan-now-btn",disabled:t.isPending,onClick:()=>t.mutate(),children:t.isPending?"SCANNING...":"SCAN NOW"})]}),t.isError?u.jsxs("div",{className:"mt-spacing-4 text-label-sm text-destructive","data-testid":"scan-error",children:["Discovery scan failed: ",(_=t.error)==null?void 0:_.message]}):null,i.length===0?u.jsx("div",{className:"py-spacing-8","data-testid":"discovery-empty",children:u.jsx("p",{className:"text-body-md text-foreground-muted",children:"No running Claude or Codex sessions are currently visible."})}):u.jsxs("div",{className:"mt-spacing-6 space-y-spacing-3","data-testid":"discovery-active-section",children:[u.jsxs("div",{className:"mb-spacing-2",children:[u.jsx("h3",{className:"text-headline-sm uppercase",children:"Running agents"}),u.jsxs("p",{className:"text-label-md text-foreground-muted",children:[i.length," session",i.length!==1?"s":""," available to inspect or adopt"]})]}),i.map(R=>u.jsx(nI,{session:R,onAdopt:b},R.id))]}),u.jsx(sI,{})]}),u.jsx(Gd,{open:f,onOpenChange:m,children:u.jsxs(Kl,{"data-testid":"adopt-dialog",children:[u.jsxs(Fl,{children:[u.jsx(Zl,{className:"text-headline-md uppercase",children:"ADOPT SESSION"}),u.jsx(Wl,{children:"Bind this session to an existing logical node in the rig."})]}),u.jsxs("div",{className:"space-y-spacing-3",children:[u.jsxs("div",{children:[u.jsx("label",{className:"text-label-sm uppercase block mb-spacing-1",children:"RIG"}),u.jsxs("select",{"data-testid":"adopt-rig-input",value:h,onChange:R=>v(R.target.value),className:"w-full bg-white border-b border-outline py-spacing-1 text-body-md font-mono focus:outline-none focus:border-stone-900 appearance-none cursor-pointer",children:[u.jsx("option",{value:"",children:"Select a rig..."}),s.map(R=>u.jsxs("option",{value:R.id,children:[R.name," (",R.nodeCount," nodes)"]},R.id))]})]}),u.jsxs("div",{children:[u.jsx("label",{className:"text-label-sm uppercase block mb-spacing-1",children:"LOGICAL ID (required)"}),u.jsx("input",{"data-testid":"adopt-logical-input",type:"text",value:g,onChange:R=>y(R.target.value),className:"w-full bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono focus:outline-none focus:border-primary"}),u.jsx("p",{className:"mt-spacing-1 text-label-sm text-foreground-muted",children:"Enter the logical ID of an existing node in the target rig. For pod placement, use the Discovery drawer instead."})]})]}),N&&u.jsx("p",{className:"text-destructive text-label-sm","data-testid":"adopt-error",children:N}),u.jsxs(Xl,{children:[u.jsx(Ne,{variant:"ghost",onClick:()=>m(!1),children:"CANCEL"}),u.jsx(Ne,{variant:"tactical",onClick:w,disabled:!h||!g.trim()||C,"data-testid":"adopt-confirm",children:C?"ADOPTING...":"ADOPT"})]})]})})]})})}const Mt=GR({component:()=>u.jsx(AT,{client:$T,children:u.jsx(w4,{children:u.jsx(pw,{})})})}),rI=At({getParentRoute:()=>Mt,path:"/",component:h0});function iI(){var r;const{rigId:e}=PE.useParams(),{data:t}=xc(),s=(r=t==null?void 0:t.find(i=>i.id===e))==null?void 0:r.name;return u.jsx("div",{className:"flex flex-col flex-1 h-full",children:u.jsx("div",{className:"flex-1 min-h-[400px] relative",children:u.jsx(Y6,{rigId:e,rigName:s??null,showDiscovered:!1})})})}const PE=At({getParentRoute:()=>Mt,path:"/rigs/$rigId",component:iI}),oI=At({getParentRoute:()=>Mt,path:"/import",component:W6}),lI=At({getParentRoute:()=>Mt,path:"/packages",component:aP}),cI=At({getParentRoute:()=>Mt,path:"/packages/install",component:uP}),uI=At({getParentRoute:()=>Mt,path:"/bootstrap",component:RP}),dI=At({getParentRoute:()=>Mt,path:"/agents/validate",component:TP});function fI(){const{setSelection:e}=tr();return j.useEffect(()=>{e({type:"discovery"})},[e]),u.jsx(h0,{})}function hI(){const{setSelection:e}=tr();return j.useEffect(()=>{e({type:"specs"})},[e]),u.jsx(h0,{})}function mI(){const{setSelection:e}=tr();return j.useEffect(()=>{e({type:"specs"})},[e]),u.jsx(HP,{})}function pI(){const{setSelection:e}=tr();return j.useEffect(()=>{e({type:"specs"})},[e]),u.jsx(UP,{})}const gI=At({getParentRoute:()=>Mt,path:"/discovery",component:fI}),xI=At({getParentRoute:()=>Mt,path:"/specs",component:hI}),yI=At({getParentRoute:()=>Mt,path:"/specs/rig",component:mI}),vI=At({getParentRoute:()=>Mt,path:"/specs/agent",component:pI});function bI(){const{entryId:e}=IE.useParams(),{setSelection:t}=tr();return j.useEffect(()=>{t({type:"specs"})},[t]),u.jsx(KP,{entryId:e})}const IE=At({getParentRoute:()=>Mt,path:"/specs/library/$entryId",component:bI}),SI=At({getParentRoute:()=>Mt,path:"/discovery/inventory",component:aI}),wI=At({getParentRoute:()=>Mt,path:"/bundles/inspect",component:VP}),NI=At({getParentRoute:()=>Mt,path:"/bundles/install",component:GP}),jI=At({getParentRoute:()=>Mt,path:"/packages/$packageId",component:vP}),BE=At({getParentRoute:()=>Mt,path:"/rigs/$rigId/nodes/$logicalId",component:()=>{const{rigId:e,logicalId:t}=BE.useParams();return u.jsx(ZP,{rigId:e,logicalId:decodeURIComponent(t)})}}),EI=Mt.addChildren([rI,PE,oI,lI,cI,jI,uI,dI,xI,yI,vI,IE,gI,SI,wI,NI,BE]),CI=tT({routeTree:EI});function _I(){return u.jsx(aT,{router:CI})}const LS=document.getElementById("root");LS&&n_.createRoot(LS).render(u.jsx(j.StrictMode,{children:u.jsx(_I,{})}));