@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.
- package/daemon/dist/adapters/claude-resume.js +1 -1
- package/daemon/dist/adapters/cmux-transport.d.ts.map +1 -1
- package/daemon/dist/adapters/cmux-transport.js +40 -3
- package/daemon/dist/adapters/cmux-transport.js.map +1 -1
- package/daemon/dist/adapters/cmux.d.ts +4 -2
- package/daemon/dist/adapters/cmux.d.ts.map +1 -1
- package/daemon/dist/adapters/cmux.js +90 -11
- package/daemon/dist/adapters/cmux.js.map +1 -1
- package/daemon/dist/adapters/compose-services-adapter.d.ts +73 -0
- package/daemon/dist/adapters/compose-services-adapter.d.ts.map +1 -0
- package/daemon/dist/adapters/compose-services-adapter.js +195 -0
- package/daemon/dist/adapters/compose-services-adapter.js.map +1 -0
- package/daemon/dist/adapters/tmux-exec.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux-exec.js +22 -2
- package/daemon/dist/adapters/tmux-exec.js.map +1 -1
- package/daemon/dist/db/migrations/020_rig_services.d.ts +3 -0
- package/daemon/dist/db/migrations/020_rig_services.d.ts.map +1 -0
- package/daemon/dist/db/migrations/020_rig_services.js +17 -0
- package/daemon/dist/db/migrations/020_rig_services.js.map +1 -0
- package/daemon/dist/domain/bootstrap-orchestrator.d.ts +7 -0
- package/daemon/dist/domain/bootstrap-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/bootstrap-orchestrator.js +73 -1
- package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
- package/daemon/dist/domain/compose-project-name.d.ts +3 -0
- package/daemon/dist/domain/compose-project-name.d.ts.map +1 -0
- package/daemon/dist/domain/compose-project-name.js +16 -0
- package/daemon/dist/domain/compose-project-name.js.map +1 -0
- package/daemon/dist/domain/native-resume-probe.js +5 -2
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/domain/node-cmux-service.d.ts +19 -0
- package/daemon/dist/domain/node-cmux-service.d.ts.map +1 -0
- package/daemon/dist/domain/node-cmux-service.js +75 -0
- package/daemon/dist/domain/node-cmux-service.js.map +1 -0
- package/daemon/dist/domain/node-inventory.js +1 -1
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +2 -0
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +13 -0
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/rig-repository.d.ts +6 -1
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +65 -0
- package/daemon/dist/domain/rig-repository.js.map +1 -1
- package/daemon/dist/domain/rig-teardown.d.ts +1 -0
- package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
- package/daemon/dist/domain/rig-teardown.js +17 -0
- package/daemon/dist/domain/rig-teardown.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts +7 -0
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +7 -0
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-schema.js +200 -0
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/service-orchestrator.d.ts +59 -0
- package/daemon/dist/domain/service-orchestrator.d.ts.map +1 -0
- package/daemon/dist/domain/service-orchestrator.js +172 -0
- package/daemon/dist/domain/service-orchestrator.js.map +1 -0
- package/daemon/dist/domain/services-readiness.d.ts +23 -0
- package/daemon/dist/domain/services-readiness.d.ts.map +1 -0
- package/daemon/dist/domain/services-readiness.js +63 -0
- package/daemon/dist/domain/services-readiness.js.map +1 -0
- package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
- package/daemon/dist/domain/snapshot-capture.js +10 -0
- package/daemon/dist/domain/snapshot-capture.js.map +1 -1
- package/daemon/dist/domain/spec-library-service.d.ts +1 -0
- package/daemon/dist/domain/spec-library-service.d.ts.map +1 -1
- package/daemon/dist/domain/spec-library-service.js +7 -0
- package/daemon/dist/domain/spec-library-service.js.map +1 -1
- package/daemon/dist/domain/spec-review-service.d.ts +29 -0
- package/daemon/dist/domain/spec-review-service.d.ts.map +1 -1
- package/daemon/dist/domain/spec-review-service.js +26 -0
- package/daemon/dist/domain/spec-review-service.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +83 -0
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/openrig-compat.d.ts.map +1 -1
- package/daemon/dist/openrig-compat.js +4 -1
- package/daemon/dist/openrig-compat.js.map +1 -1
- package/daemon/dist/routes/adapters.js +3 -2
- package/daemon/dist/routes/adapters.js.map +1 -1
- package/daemon/dist/routes/env.d.ts +3 -0
- package/daemon/dist/routes/env.d.ts.map +1 -0
- package/daemon/dist/routes/env.js +119 -0
- package/daemon/dist/routes/env.js.map +1 -0
- package/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/daemon/dist/routes/sessions.js +14 -0
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/spec-library.d.ts.map +1 -1
- package/daemon/dist/routes/spec-library.js +21 -0
- package/daemon/dist/routes/spec-library.js.map +1 -1
- package/daemon/dist/server.d.ts +3 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +5 -0
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +15 -3
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/specs/agents/apps/vault-specialist/agent.yaml +36 -0
- package/daemon/specs/agents/apps/vault-specialist/guidance/role.md +34 -0
- package/daemon/specs/agents/apps/vault-specialist/skills/vault-user/SKILL.md +64 -0
- package/daemon/specs/agents/apps/vault-specialist/startup/context.md +46 -0
- package/daemon/specs/agents/development/implementer/agent.yaml +1 -1
- package/daemon/specs/agents/development/implementer/guidance/role.md +1 -0
- package/daemon/specs/agents/orchestration/orchestrator/agent.yaml +1 -1
- package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +1 -0
- package/daemon/specs/agents/shared/agent.yaml +2 -0
- package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +53 -2
- package/daemon/specs/agents/shared/skills/mental-model-ha/SKILL.md +953 -0
- package/daemon/specs/rigs/launch/secrets-manager/rig.yaml +37 -0
- package/daemon/specs/rigs/launch/secrets-manager/secrets-manager.compose.yaml +18 -0
- package/dist/commands/destroy.d.ts +9 -0
- package/dist/commands/destroy.d.ts.map +1 -0
- package/dist/commands/destroy.js +175 -0
- package/dist/commands/destroy.js.map +1 -0
- package/dist/commands/doctor.d.ts +1 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +82 -7
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +2 -1
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/env.d.ts +4 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +139 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/restore.d.ts.map +1 -1
- package/dist/commands/restore.js +2 -1
- package/dist/commands/restore.js.map +1 -1
- package/dist/commands/specs.d.ts.map +1 -1
- package/dist/commands/specs.js +11 -4
- package/dist/commands/specs.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +9 -2
- package/dist/commands/up.js.map +1 -1
- package/dist/destroy-helpers.d.ts +63 -0
- package/dist/destroy-helpers.d.ts.map +1 -0
- package/dist/destroy-helpers.js +224 -0
- package/dist/destroy-helpers.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/openrig-compat.d.ts.map +1 -1
- package/dist/openrig-compat.js +4 -1
- package/dist/openrig-compat.js.map +1 -1
- package/package.json +1 -1
- package/ui/dist/assets/index-BsXbqPEl.css +1 -0
- package/ui/dist/assets/index-CXZYxZbF.js +225 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/index-DGPFTQEV.css +0 -1
- package/ui/dist/assets/index-VA_A8dpm.js +0 -224
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
var VC=Object.defineProperty;var nb=e=>{throw TypeError(e)};var GC=(e,t,s)=>t in e?VC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var bl=(e,t,s)=>GC(e,typeof t!="symbol"?t+"":t,s),Vm=(e,t,s)=>t.has(e)||nb("Cannot "+s);var X=(e,t,s)=>(Vm(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),he=(e,t,s,r)=>(Vm(e,t,"write to private field"),r?r.call(e,s):t.set(e,s),s),Le=(e,t,s)=>(Vm(e,t,"access private method"),s);var Qu=(e,t,s,r)=>({set _(i){he(e,t,i,s)},get _(){return X(e,t,r)}});function YC(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 xg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Gm={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 QC(){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,Gm.exports=QC()),Gm.exports}var c=FC(),Ym={exports:{}},Me={};/**
|
|
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 KC(){if(rb)return Me;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(D){return D===null||typeof D!="object"?null:(D=y&&D[y]||D["@@iterator"],typeof D=="function"?D:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,N={};function E(D,G,J){this.props=D,this.context=G,this.refs=N,this.updater=J||S}E.prototype.isReactComponent={},E.prototype.setState=function(D,G){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,G,"setState")},E.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function T(){}T.prototype=E.prototype;function _(D,G,J){this.props=D,this.context=G,this.refs=N,this.updater=J||S}var R=_.prototype=new T;R.constructor=_,w(R,E.prototype),R.isPureReactComponent=!0;var L=Array.isArray;function I(){}var P={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function M(D,G,J){var se=J.ref;return{$$typeof:e,type:D,key:G,ref:se!==void 0?se:null,props:J}}function q(D,G){return M(D.type,G,D.props)}function z(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function Q(D){var G={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(J){return G[J]})}var Y=/\/+/g;function B(D,G){return typeof D=="object"&&D!==null&&D.key!=null?Q(""+D.key):G.toString(36)}function V(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(I,I):(D.status="pending",D.then(function(G){D.status==="pending"&&(D.status="fulfilled",D.value=G)},function(G){D.status==="pending"&&(D.status="rejected",D.reason=G)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function k(D,G,J,se,oe){var ce=typeof D;(ce==="undefined"||ce==="boolean")&&(D=null);var de=!1;if(D===null)de=!0;else switch(ce){case"bigint":case"string":case"number":de=!0;break;case"object":switch(D.$$typeof){case e:case t:de=!0;break;case v:return de=D._init,k(de(D._payload),G,J,se,oe)}}if(de)return oe=oe(D),de=se===""?"."+B(D,0):se,L(oe)?(J="",de!=null&&(J=de.replace(Y,"$&/")+"/"),k(oe,G,J,"",function(Ce){return Ce})):oe!=null&&(z(oe)&&(oe=q(oe,J+(oe.key==null||D&&D.key===oe.key?"":(""+oe.key).replace(Y,"$&/")+"/")+de)),G.push(oe)),1;de=0;var ue=se===""?".":se+":";if(L(D))for(var fe=0;fe<D.length;fe++)se=D[fe],ce=ue+B(se,fe),de+=k(se,G,J,ce,oe);else if(fe=b(D),typeof fe=="function")for(D=fe.call(D),fe=0;!(se=D.next()).done;)se=se.value,ce=ue+B(se,fe++),de+=k(se,G,J,ce,oe);else if(ce==="object"){if(typeof D.then=="function")return k(V(D),G,J,se,oe);throw G=String(D),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return de}function U(D,G,J){if(D==null)return D;var se=[],oe=0;return k(D,se,"","",function(ce){return G.call(J,ce,oe++)}),se}function $(D){if(D._status===-1){var G=D._result;G=G(),G.then(function(J){(D._status===0||D._status===-1)&&(D._status=1,D._result=J)},function(J){(D._status===0||D._status===-1)&&(D._status=2,D._result=J)}),D._status===-1&&(D._status=0,D._result=G)}if(D._status===1)return D._result.default;throw D._result}var F=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},H={map:U,forEach:function(D,G,J){U(D,function(){G.apply(this,arguments)},J)},count:function(D){var G=0;return U(D,function(){G++}),G},toArray:function(D){return U(D,function(G){return G})||[]},only:function(D){if(!z(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Me.Activity=g,Me.Children=H,Me.Component=E,Me.Fragment=s,Me.Profiler=i,Me.PureComponent=_,Me.StrictMode=r,Me.Suspense=m,Me.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,Me.__COMPILER_RUNTIME={__proto__:null,c:function(D){return P.H.useMemoCache(D)}},Me.cache=function(D){return function(){return D.apply(null,arguments)}},Me.cacheSignal=function(){return null},Me.cloneElement=function(D,G,J){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var se=w({},D.props),oe=D.key;if(G!=null)for(ce in G.key!==void 0&&(oe=""+G.key),G)!A.call(G,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&G.ref===void 0||(se[ce]=G[ce]);var ce=arguments.length-2;if(ce===1)se.children=J;else if(1<ce){for(var de=Array(ce),ue=0;ue<ce;ue++)de[ue]=arguments[ue+2];se.children=de}return M(D.type,oe,se)},Me.createContext=function(D){return D={$$typeof:d,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:l,_context:D},D},Me.createElement=function(D,G,J){var se,oe={},ce=null;if(G!=null)for(se in G.key!==void 0&&(ce=""+G.key),G)A.call(G,se)&&se!=="key"&&se!=="__self"&&se!=="__source"&&(oe[se]=G[se]);var de=arguments.length-2;if(de===1)oe.children=J;else if(1<de){for(var ue=Array(de),fe=0;fe<de;fe++)ue[fe]=arguments[fe+2];oe.children=ue}if(D&&D.defaultProps)for(se in de=D.defaultProps,de)oe[se]===void 0&&(oe[se]=de[se]);return M(D,ce,oe)},Me.createRef=function(){return{current:null}},Me.forwardRef=function(D){return{$$typeof:f,render:D}},Me.isValidElement=z,Me.lazy=function(D){return{$$typeof:v,_payload:{_status:-1,_result:D},_init:$}},Me.memo=function(D,G){return{$$typeof:h,type:D,compare:G===void 0?null:G}},Me.startTransition=function(D){var G=P.T,J={};P.T=J;try{var se=D(),oe=P.S;oe!==null&&oe(J,se),typeof se=="object"&&se!==null&&typeof se.then=="function"&&se.then(I,F)}catch(ce){F(ce)}finally{G!==null&&J.types!==null&&(G.types=J.types),P.T=G}},Me.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},Me.use=function(D){return P.H.use(D)},Me.useActionState=function(D,G,J){return P.H.useActionState(D,G,J)},Me.useCallback=function(D,G){return P.H.useCallback(D,G)},Me.useContext=function(D){return P.H.useContext(D)},Me.useDebugValue=function(){},Me.useDeferredValue=function(D,G){return P.H.useDeferredValue(D,G)},Me.useEffect=function(D,G){return P.H.useEffect(D,G)},Me.useEffectEvent=function(D){return P.H.useEffectEvent(D)},Me.useId=function(){return P.H.useId()},Me.useImperativeHandle=function(D,G,J){return P.H.useImperativeHandle(D,G,J)},Me.useInsertionEffect=function(D,G){return P.H.useInsertionEffect(D,G)},Me.useLayoutEffect=function(D,G){return P.H.useLayoutEffect(D,G)},Me.useMemo=function(D,G){return P.H.useMemo(D,G)},Me.useOptimistic=function(D,G){return P.H.useOptimistic(D,G)},Me.useReducer=function(D,G,J){return P.H.useReducer(D,G,J)},Me.useRef=function(D){return P.H.useRef(D)},Me.useState=function(D){return P.H.useState(D)},Me.useSyncExternalStore=function(D,G,J){return P.H.useSyncExternalStore(D,G,J)},Me.useTransition=function(){return P.H.useTransition()},Me.version="19.2.4",Me}var ib;function pc(){return ib||(ib=1,Ym.exports=KC()),Ym.exports}var j=pc();const Xr=xg(j),yg=YC({__proto__:null,default:Xr},[j]);var Qm={exports:{}},wl={},Fm={exports:{}},Km={};/**
|
|
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 XC(){return ob||(ob=1,(function(e){function t(k,U){var $=k.length;k.push(U);e:for(;0<$;){var F=$-1>>>1,H=k[F];if(0<i(H,U))k[F]=U,k[$]=H,$=F;else break e}}function s(k){return k.length===0?null:k[0]}function r(k){if(k.length===0)return null;var U=k[0],$=k.pop();if($!==U){k[0]=$;e:for(var F=0,H=k.length,D=H>>>1;F<D;){var G=2*(F+1)-1,J=k[G],se=G+1,oe=k[se];if(0>i(J,$))se<H&&0>i(oe,J)?(k[F]=oe,k[se]=$,F=se):(k[F]=J,k[G]=$,F=G);else if(se<H&&0>i(oe,$))k[F]=oe,k[se]=$,F=se;else break e}}return U}function i(k,U){var $=k.sortIndex-U.sortIndex;return $!==0?$:k.id-U.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,E=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function R(k){for(var U=s(h);U!==null;){if(U.callback===null)r(h);else if(U.startTime<=k)r(h),U.sortIndex=U.expirationTime,t(m,U);else break;U=s(h)}}function L(k){if(w=!1,R(k),!S)if(s(m)!==null)S=!0,I||(I=!0,Q());else{var U=s(h);U!==null&&V(L,U.startTime-k)}}var I=!1,P=-1,A=5,M=-1;function q(){return N?!0:!(e.unstable_now()-M<A)}function z(){if(N=!1,I){var k=e.unstable_now();M=k;var U=!0;try{e:{S=!1,w&&(w=!1,T(P),P=-1),b=!0;var $=y;try{t:{for(R(k),g=s(m);g!==null&&!(g.expirationTime>k&&q());){var F=g.callback;if(typeof F=="function"){g.callback=null,y=g.priorityLevel;var H=F(g.expirationTime<=k);if(k=e.unstable_now(),typeof H=="function"){g.callback=H,R(k),U=!0;break t}g===s(m)&&r(m),R(k)}else r(m);g=s(m)}if(g!==null)U=!0;else{var D=s(h);D!==null&&V(L,D.startTime-k),U=!1}}break e}finally{g=null,y=$,b=!1}U=void 0}}finally{U?Q():I=!1}}}var Q;if(typeof _=="function")Q=function(){_(z)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,B=Y.port2;Y.port1.onmessage=z,Q=function(){B.postMessage(null)}}else Q=function(){E(z,0)};function V(k,U){P=E(function(){k(e.unstable_now())},U)}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(k){k.callback=null},e.unstable_forceFrameRate=function(k){0>k||125<k?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<k?Math.floor(1e3/k):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(k){switch(y){case 1:case 2:case 3:var U=3;break;default:U=y}var $=y;y=U;try{return k()}finally{y=$}},e.unstable_requestPaint=function(){N=!0},e.unstable_runWithPriority=function(k,U){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var $=y;y=k;try{return U()}finally{y=$}},e.unstable_scheduleCallback=function(k,U,$){var F=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?F+$:F):$=F,k){case 1:var H=-1;break;case 2:H=250;break;case 5:H=1073741823;break;case 4:H=1e4;break;default:H=5e3}return H=$+H,k={id:v++,callback:U,priorityLevel:k,startTime:$,expirationTime:H,sortIndex:-1},$>F?(k.sortIndex=$,t(h,k),s(m)===null&&k===s(h)&&(w?(T(P),P=-1):w=!0,V(L,$-F))):(k.sortIndex=H,t(m,k),S||b||(S=!0,I||(I=!0,Q()))),k},e.unstable_shouldYield=q,e.unstable_wrapCallback=function(k){var U=y;return function(){var $=y;y=U;try{return k.apply(this,arguments)}finally{y=$}}}})(Km)),Km}var lb;function ZC(){return lb||(lb=1,Fm.exports=XC()),Fm.exports}var Xm={exports:{}},$t={};/**
|
|
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 WC(){if(cb)return $t;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 $t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,$t.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)},$t.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()}},$t.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))},$t.prefetchDNS=function(m){typeof m=="string"&&r.d.D(m)},$t.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})}},$t.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)},$t.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})}},$t.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)},$t.requestFormReset=function(m){r.d.r(m)},$t.unstable_batchedUpdates=function(m,h){return m(h)},$t.useFormState=function(m,h,v){return d.H.useFormState(m,h,v)},$t.useFormStatus=function(){return d.H.useHostTransitionStatus()},$t.version="19.2.4",$t}var ub;function YS(){if(ub)return Xm.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(),Xm.exports=WC(),Xm.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 JC(){if(db)return wl;db=1;var e=ZC(),t=pc(),s=YS();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,u=a;;){var p=o.return;if(p===null)break;var x=p.alternate;if(x===null){if(u=p.return,u!==null){o=u;continue}break}if(p.child===x.child){for(x=p.child;x;){if(x===o)return m(p),n;if(x===u)return m(p),a;x=x.sibling}throw Error(r(188))}if(o.return!==u.return)o=p,u=x;else{for(var C=!1,O=p.child;O;){if(O===o){C=!0,o=p,u=x;break}if(O===u){C=!0,u=p,o=x;break}O=O.sibling}if(!C){for(O=x.child;O;){if(O===o){C=!0,o=x,u=p;break}if(O===u){C=!0,u=x,o=p;break}O=O.sibling}if(!C)throw Error(r(189))}}if(o.alternate!==u)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"),E=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),_=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),M=Symbol.for("react.activity"),q=Symbol.for("react.memo_cache_sentinel"),z=Symbol.iterator;function Q(n){return n===null||typeof n!="object"?null:(n=z&&n[z]||n["@@iterator"],typeof n=="function"?n:null)}var Y=Symbol.for("react.client.reference");function B(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===Y?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case w:return"Fragment";case E:return"Profiler";case N:return"StrictMode";case L:return"Suspense";case I:return"SuspenseList";case M: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 P:return a=n.displayName||null,a!==null?a:B(n.type)||"Memo";case A:a=n._payload,n=n._init;try{return B(n(a))}catch{}}return null}var V=Array.isArray,k=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$={pending:!1,data:null,method:null,action:null},F=[],H=-1;function D(n){return{current:n}}function G(n){0>H||(n.current=F[H],F[H]=null,H--)}function J(n,a){H++,F[H]=n.current,n.current=a}var se=D(null),oe=D(null),ce=D(null),de=D(null);function ue(n,a){switch(J(ce,a),J(oe,n),J(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}}G(se),J(se,n)}function fe(){G(se),G(oe),G(ce)}function Ce(n){n.memoizedState!==null&&J(de,n);var a=se.current,o=Cv(a,n.type);a!==o&&(J(oe,n),J(se,o))}function be(n){oe.current===n&&(G(se),G(oe)),de.current===n&&(G(de),gl._currentValue=$)}var xe,ve;function Te(n){if(xe===void 0)try{throw Error()}catch(o){var a=o.stack.trim().match(/\n( *(at )?)/);xe=a&&a[1]||"",ve=-1<o.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+xe+n+ve}var Ve=!1;function Oe(n,a){if(!n||Ve)return"";Ve=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={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]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var x=u.DetermineComponentFrameRoot(),C=x[0],O=x[1];if(C&&O){var K=C.split(`
|
|
44
|
+
`),te=O.split(`
|
|
45
|
+
`);for(p=u=0;u<K.length&&!K[u].includes("DetermineComponentFrameRoot");)u++;for(;p<te.length&&!te[p].includes("DetermineComponentFrameRoot");)p++;if(u===K.length||p===te.length)for(u=K.length-1,p=te.length-1;1<=u&&0<=p&&K[u]!==te[p];)p--;for(;1<=u&&0<=p;u--,p--)if(K[u]!==te[p]){if(u!==1||p!==1)do if(u--,p--,0>p||K[u]!==te[p]){var re=`
|
|
46
|
+
`+K[u].replace(" at new "," at ");return n.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",n.displayName)),re}while(1<=u&&0<=p);break}}}finally{Ve=!1,Error.prepareStackTrace=o}return(o=n?n.displayName||n.name:"")?Te(o):""}function tt(n,a){switch(n.tag){case 26:case 27:case 5:return Te(n.type);case 16:return Te("Lazy");case 13:return n.child!==a&&a!==null?Te("Suspense Fallback"):Te("Suspense");case 19:return Te("SuspenseList");case 0:case 15:return Oe(n.type,!1);case 11:return Oe(n.type.render,!1);case 1:return Oe(n.type,!0);case 31:return Te("Activity");default:return""}}function me(n){try{var a="",o=null;do a+=tt(n,o),o=n,n=n.return;while(n);return a}catch(u){return`
|
|
47
|
+
Error generating stack: `+u.message+`
|
|
48
|
+
`+u.stack}}var Pe=Object.prototype.hasOwnProperty,rt=e.unstable_scheduleCallback,dt=e.unstable_cancelCallback,mn=e.unstable_shouldYield,Zn=e.unstable_requestPaint,Ae=e.unstable_now,pt=e.unstable_getCurrentPriorityLevel,Lt=e.unstable_ImmediatePriority,Wn=e.unstable_UserBlockingPriority,nr=e.unstable_NormalPriority,_f=e.unstable_LowPriority,ri=e.unstable_IdlePriority,Rf=e.log,Tf=e.unstable_setDisableYieldValue,sr=null,Vt=null;function Jn(n){if(typeof Rf=="function"&&Tf(n),Vt&&typeof Vt.setStrictMode=="function")try{Vt.setStrictMode(sr,n)}catch{}}var Gt=Math.clz32?Math.clz32:kf,Af=Math.log,Mf=Math.LN2;function kf(n){return n>>>=0,n===0?32:31-(Af(n)/Mf|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 u=n.pendingLanes;if(u===0)return 0;var p=0,x=n.suspendedLanes,C=n.pingedLanes;n=n.warmLanes;var O=u&134217727;return O!==0?(u=O&~x,u!==0?p=gs(u):(C&=O,C!==0?p=gs(C):o||(o=O&~n,o!==0&&(p=gs(o))))):(O=u&~x,O!==0?p=gs(O):C!==0?p=gs(C):o||(o=u&~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 Of(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 Df(n,a,o,u,p,x){var C=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 O=n.entanglements,K=n.expirationTimes,te=n.hiddenUpdates;for(o=C&~o;0<o;){var re=31-Gt(o),le=1<<re;O[re]=0,K[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}u!==0&&Ec(n,u,0),x!==0&&p===0&&n.tag!==0&&(n.suspendedLanes|=x&~(C&~a))}function Ec(n,a,o){n.pendingLanes|=a,n.suspendedLanes&=~a;var u=31-Gt(a);n.entangledLanes|=a,n.entanglements[u]=n.entanglements[u]|1073741824|o&261930}function Cc(n,a){var o=n.entangledLanes|=a;for(n=n.entanglements;o;){var u=31-Gt(o),p=1<<u;p&a|n[u]&a&&(n[u]|=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=U.p;return n!==0?n:(n=window.event,n===void 0?32:Kv(n.type))}function Tc(n,a){var o=U.p;try{return U.p=n,a()}finally{U.p=o}}var es=Math.random().toString(36).slice(2),jt="__reactFiber$"+es,Ut="__reactProps$"+es,xs="__reactContainer$"+es,ui="__reactEvents$"+es,Ac="__reactListeners$"+es,Lf="__reactHandles$"+es,Mc="__reactResources$"+es,ir="__reactMarker$"+es;function Ao(n){delete n[jt],delete n[Ut],delete n[ui],delete n[Ac],delete n[Lf]}function Ws(n){var a=n[jt];if(a)return a;for(var o=n.parentNode;o;){if(a=o[xs]||o[jt]){if(o=a.alternate,a.child!==null||o!==null&&o.child!==null)for(n=Ov(n);n!==null;){if(o=n[jt])return o;n=Ov(n)}return a}n=o,o=n.parentNode}return null}function Js(n){if(n=n[jt]||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 yt(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 zf=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 Pf(n){return Pe.call(Dc,n)?!0:Pe.call(Mo,n)?!1:zf.test(n)?Dc[n]=!0:(Mo[n]=!0,!1)}function di(n,a,o){if(Pf(a))if(o===null)n.removeAttribute(a);else{switch(typeof o){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var u=a.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="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 Pn(n,a,o,u){if(u===null)n.removeAttribute(o);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(o);return}n.setAttributeNS(a,o,""+u)}}function Jt(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 If(n,a,o){var u=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var p=u.get,x=u.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return p.call(this)},set:function(C){o=""+C,x.call(this,C)}}),Object.defineProperty(n,a,{enumerable:u.enumerable}),{getValue:function(){return o},setValue:function(C){o=""+C},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function sa(n){if(!n._valueTracker){var a=Lc(n)?"checked":"value";n._valueTracker=If(n,a,""+n[a])}}function zc(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var o=a.getValue(),u="";return n&&(u=Lc(n)?n.checked?"true":"false":n.value),n=u,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 Bf=/[\n"\\]/g;function en(n){return n.replace(Bf,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function lr(n,a,o,u,p,x,C,O){n.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?n.type=C:n.removeAttribute("type"),a!=null?C==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+Jt(a)):n.value!==""+Jt(a)&&(n.value=""+Jt(a)):C!=="submit"&&C!=="reset"||n.removeAttribute("value"),a!=null?ko(n,C,Jt(a)):o!=null?ko(n,C,Jt(o)):u!=null&&n.removeAttribute("value"),p==null&&x!=null&&(n.defaultChecked=!!x),p!=null&&(n.checked=p&&typeof p!="function"&&typeof p!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?n.name=""+Jt(O):n.removeAttribute("name")}function Pc(n,a,o,u,p,x,C,O){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?""+Jt(o):"",a=a!=null?""+Jt(a):o,O||a===n.value||(n.value=a),n.defaultValue=a}u=u??p,u=typeof u!="function"&&typeof u!="symbol"&&!!u,n.checked=O?n.checked:!!u,n.defaultChecked=!!u,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(n.name=C),sa(n)}function ko(n,a,o){a==="number"&&or(n.ownerDocument)===n||n.defaultValue===""+o||(n.defaultValue=""+o)}function vs(n,a,o,u){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&&u&&(n[o].defaultSelected=!0)}else{for(o=""+Jt(o),a=null,p=0;p<n.length;p++){if(n[p].value===o){n[p].selected=!0,u&&(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=""+Jt(a),a!==n.value&&(n.value=a),o==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=o!=null?""+Jt(o):""}function S0(n,a,o,u){if(a==null){if(u!=null){if(o!=null)throw Error(r(92));if(V(u)){if(1<u.length)throw Error(r(93));u=u[0]}o=u}o==null&&(o=""),a=o}o=Jt(a),n.defaultValue=o,u=n.textContent,u===o&&u!==""&&u!==null&&(n.value=u),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 BE=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 u=a.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?u?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":u?n.setProperty(a,o):typeof o!="number"||o===0||BE.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 u in o)!o.hasOwnProperty(u)||a!=null&&a.hasOwnProperty(u)||(u.indexOf("--")===0?n.setProperty(u,""):u==="float"?n.cssFloat="":n[u]="");for(var p in a)u=a[p],a.hasOwnProperty(p)&&o[p]!==u&&w0(n,p,u)}else for(var x in a)a.hasOwnProperty(x)&&w0(n,x,a[x])}function Hf(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 HE=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"]]),UE=/^[\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 UE.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function bs(){}var Uf=null;function $f(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[Ut]||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="'+en(""+a)+'"][type="radio"]'),a=0;a<o.length;a++){var u=o[a];if(u!==n&&u.form===n.form){var p=u[Ut]||null;if(!p)throw Error(r(90));lr(u,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(a=0;a<o.length;a++)u=o[a],u.form===n.form&&zc(u)}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 qf=!1;function E0(n,a,o){if(qf)return n(a,o);qf=!0;try{var u=n(a);return u}finally{if(qf=!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 u=o[Ut]||null;if(u===null)return null;o=u[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":(u=!u.disabled)||(n=n.type,u=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!u;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"),Vf=!1;if(Ss)try{var Do={};Object.defineProperty(Do,"passive",{get:function(){Vf=!0}}),window.addEventListener("test",Do,Do),window.removeEventListener("test",Do,Do)}catch{Vf=!1}var aa=null,Gf=null,Bc=null;function C0(){if(Bc)return Bc;var n,a=Gf,o=a.length,u,p="value"in aa?aa.value:aa.textContent,x=p.length;for(n=0;n<o&&a[n]===p[n];n++);var C=o-n;for(u=1;u<=C&&a[o-u]===p[x-u];u++);return Bc=p.slice(n,1<u?1-u: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 tn(n){function a(o,u,p,x,C){this._reactName=o,this._targetInst=p,this.type=u,this.nativeEvent=x,this.target=C,this.currentTarget=null;for(var O in n)n.hasOwnProperty(O)&&(o=n[O],this[O]=o?o(x):x[O]);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=tn(cr),Lo=g({},cr,{view:0,detail:0}),$E=tn(Lo),Yf,Qf,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:Kf,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"?(Yf=n.screenX-zo.screenX,Qf=n.screenY-zo.screenY):Qf=Yf=0,zo=n),Yf)},movementY:function(n){return"movementY"in n?n.movementY:Qf}}),R0=tn(qc),qE=g({},qc,{dataTransfer:0}),VE=tn(qE),GE=g({},Lo,{relatedTarget:0}),Ff=tn(GE),YE=g({},cr,{animationName:0,elapsedTime:0,pseudoElement:0}),QE=tn(YE),FE=g({},cr,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),KE=tn(FE),XE=g({},cr,{data:0}),T0=tn(XE),ZE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},WE={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"},JE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function e2(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=JE[n])?!!a[n]:!1}function Kf(){return e2}var t2=g({},Lo,{key:function(n){if(n.key){var a=ZE[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"?WE[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Kf,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}}),n2=tn(t2),s2=g({},qc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),A0=tn(s2),a2=g({},Lo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Kf}),r2=tn(a2),i2=g({},cr,{propertyName:0,elapsedTime:0,pseudoElement:0}),o2=tn(i2),l2=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}),c2=tn(l2),u2=g({},cr,{newState:0,oldState:0}),d2=tn(u2),f2=[9,13,27,32],Xf=Ss&&"CompositionEvent"in window,Po=null;Ss&&"documentMode"in document&&(Po=document.documentMode);var h2=Ss&&"TextEvent"in window&&!Po,M0=Ss&&(!Xf||Po&&8<Po&&11>=Po),k0=" ",O0=!1;function D0(n,a){switch(n){case"keyup":return f2.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 m2(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 p2(n,a){if(gi)return n==="compositionend"||!Xf&&D0(n,a)?(n=C0(),Bc=Gf=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 g2={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"?!!g2[n.type]:a==="textarea"}function P0(n,a,o,u){mi?pi?pi.push(u):pi=[u]:mi=u,a=ku(a,"onChange"),0<a.length&&(o=new $c("onChange","change",null,o,u),n.push({event:o,listeners:a}))}var Io=null,Bo=null;function x2(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 Zf;if(Ss){var Wf="oninput"in document;if(!Wf){var H0=document.createElement("div");H0.setAttribute("oninput","return;"),Wf=typeof H0.oninput=="function"}Zf=Wf}else Zf=!1;B0=Zf&&(!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,$f(n)),E0(x2,a)}}function y2(n,a,o){n==="focusin"?(U0(),Io=a,Bo=o,Io.attachEvent("onpropertychange",$0)):n==="focusout"&&U0()}function v2(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return Vc(Bo)}function b2(n,a){if(n==="click")return Vc(a)}function S2(n,a){if(n==="input"||n==="change")return Vc(a)}function w2(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var pn=typeof Object.is=="function"?Object.is:w2;function Ho(n,a){if(pn(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var o=Object.keys(n),u=Object.keys(a);if(o.length!==u.length)return!1;for(u=0;u<o.length;u++){var p=o[u];if(!Pe.call(a,p)||!pn(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 u;o;){if(o.nodeType===3){if(u=n+o.textContent.length,n<=a&&u>=a)return{node:o,offset:a-n};n=u}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 Jf(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 N2=Ss&&"documentMode"in document&&11>=document.documentMode,xi=null,eh=null,Uo=null,th=!1;function Q0(n,a,o){var u=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;th||xi==null||xi!==or(u)||(u=xi,"selectionStart"in u&&Jf(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Uo&&Ho(Uo,u)||(Uo=u,u=ku(eh,"onSelect"),0<u.length&&(a=new $c("onSelect","select",null,a,o),n.push({event:a,listeners:u}),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")},nh={},F0={};Ss&&(F0=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(nh[n])return nh[n];if(!yi[n])return n;var a=yi[n],o;for(o in a)if(a.hasOwnProperty(o)&&o in F0)return nh[n]=a[o];return n}var K0=dr("animationend"),X0=dr("animationiteration"),Z0=dr("animationstart"),j2=dr("transitionrun"),E2=dr("transitionstart"),C2=dr("transitioncancel"),W0=dr("transitionend"),J0=new Map,sh="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(" ");sh.push("scrollEnd");function In(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)},Cn=[],vi=0,ah=0;function Yc(){for(var n=vi,a=ah=vi=0;a<n;){var o=Cn[a];Cn[a++]=null;var u=Cn[a];Cn[a++]=null;var p=Cn[a];Cn[a++]=null;var x=Cn[a];if(Cn[a++]=null,u!==null&&p!==null){var C=u.pending;C===null?p.next=p:(p.next=C.next,C.next=p),u.pending=p}x!==0&&ex(o,p,x)}}function Qc(n,a,o,u){Cn[vi++]=n,Cn[vi++]=a,Cn[vi++]=o,Cn[vi++]=u,ah|=u,n.lanes|=u,n=n.alternate,n!==null&&(n.lanes|=u)}function rh(n,a,o,u){return Qc(n,a,o,u),Fc(n)}function fr(n,a){return Qc(n,null,null,a),Fc(n)}function ex(n,a,o){n.lanes|=o;var u=n.alternate;u!==null&&(u.lanes|=o);for(var p=!1,x=n.return;x!==null;)x.childLanes|=o,u=x.alternate,u!==null&&(u.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-Gt(o),n=x.hiddenUpdates,u=n[p],u===null?n[p]=[a]:u.push(a),a.lane=o|536870912),x):null}function Fc(n){if(50<cl)throw cl=0,mm=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 _2(n,a,o,u){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=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function gn(n,a,o,u){return new _2(n,a,o,u)}function ih(n){return n=n.prototype,!(!n||!n.isReactComponent)}function ws(n,a){var o=n.alternate;return o===null?(o=gn(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 Kc(n,a,o,u,p,x){var C=0;if(u=n,typeof n=="function")ih(n)&&(C=1);else if(typeof n=="string")C=kC(n,o,se.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case M:return n=gn(31,o,a,p),n.elementType=M,n.lanes=x,n;case w:return hr(o.children,p,x,a);case N:C=8,p|=24;break;case E:return n=gn(12,o,a,p|2),n.elementType=E,n.lanes=x,n;case L:return n=gn(13,o,a,p),n.elementType=L,n.lanes=x,n;case I:return n=gn(19,o,a,p),n.elementType=I,n.lanes=x,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case _:C=10;break e;case T:C=9;break e;case R:C=11;break e;case P:C=14;break e;case A:C=16,u=null;break e}C=29,o=Error(r(130,n===null?"null":typeof n,"")),u=null}return a=gn(C,o,a,p),a.elementType=n,a.type=u,a.lanes=x,a}function hr(n,a,o,u){return n=gn(7,n,u,a),n.lanes=o,n}function oh(n,a,o){return n=gn(6,n,null,a),n.lanes=o,n}function nx(n){var a=gn(18,null,null,0);return a.stateNode=n,a}function lh(n,a,o){return a=gn(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 _n(n,a){if(typeof n=="object"&&n!==null){var o=sx.get(n);return o!==void 0?o:(a={value:n,source:a,stack:me(a)},sx.set(n,a),a)}return{value:n,source:a,stack:me(a)}}var Si=[],wi=0,Xc=null,$o=0,Rn=[],Tn=0,ra=null,ts=1,ns="";function Ns(n,a){Si[wi++]=$o,Si[wi++]=Xc,Xc=n,$o=a}function ax(n,a,o){Rn[Tn++]=ts,Rn[Tn++]=ns,Rn[Tn++]=ra,ra=n;var u=ts;n=ns;var p=32-Gt(u)-1;u&=~(1<<p),o+=1;var x=32-Gt(a)+p;if(30<x){var C=p-p%5;x=(u&(1<<C)-1).toString(32),u>>=C,p-=C,ts=1<<32-Gt(a)+p|o<<p|u,ns=x+n}else ts=1<<x|o<<p|u,ns=n}function ch(n){n.return!==null&&(Ns(n,1),ax(n,1,0))}function uh(n){for(;n===Xc;)Xc=Si[--wi],Si[wi]=null,$o=Si[--wi],Si[wi]=null;for(;n===ra;)ra=Rn[--Tn],Rn[Tn]=null,ns=Rn[--Tn],Rn[Tn]=null,ts=Rn[--Tn],Rn[Tn]=null}function rx(n,a){Rn[Tn++]=ts,Rn[Tn++]=ns,Rn[Tn++]=ra,ts=a.id,ns=a.overflow,ra=n}var zt=null,st=null,$e=!1,ia=null,An=!1,dh=Error(r(519));function oa(n){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw qo(_n(a,n)),dh}function ix(n){var a=n.stateNode,o=n.type,u=n.memoizedProps;switch(a[jt]=n,a[Ut]=u,o){case"dialog":Be("cancel",a),Be("close",a);break;case"iframe":case"object":case"embed":Be("load",a);break;case"video":case"audio":for(o=0;o<dl.length;o++)Be(dl[o],a);break;case"source":Be("error",a);break;case"img":case"image":case"link":Be("error",a),Be("load",a);break;case"details":Be("toggle",a);break;case"input":Be("invalid",a),Pc(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":Be("invalid",a);break;case"textarea":Be("invalid",a),S0(a,u.value,u.defaultValue,u.children)}o=u.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||a.textContent===""+o||u.suppressHydrationWarning===!0||Nv(a.textContent,o)?(u.popover!=null&&(Be("beforetoggle",a),Be("toggle",a)),u.onScroll!=null&&Be("scroll",a),u.onScrollEnd!=null&&Be("scrollend",a),u.onClick!=null&&(a.onclick=bs),a=!0):a=!1,a||oa(n,!0)}function ox(n){for(zt=n.return;zt;)switch(zt.tag){case 5:case 31:case 13:An=!1;return;case 27:case 3:An=!0;return;default:zt=zt.return}}function Ni(n){if(n!==zt)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")||Tm(n.type,n.memoizedProps)),o=!o),o&&st&&oa(n),ox(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));st=kv(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(317));st=kv(n)}else a===27?(a=st,Sa(n.type)?(n=Dm,Dm=null,st=n):st=a):st=zt?kn(n.stateNode.nextSibling):null;return!0}function mr(){st=zt=null,$e=!1}function fh(){var n=ia;return n!==null&&(rn===null?rn=n:rn.push.apply(rn,n),ia=null),n}function qo(n){ia===null?ia=[n]:ia.push(n)}var hh=D(null),pr=null,js=null;function la(n,a,o){J(hh,a._currentValue),a._currentValue=o}function Es(n){n._currentValue=hh.current,G(hh)}function mh(n,a,o){for(;n!==null;){var u=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,u!==null&&(u.childLanes|=a)):u!==null&&(u.childLanes&a)!==a&&(u.childLanes|=a),n===o)break;n=n.return}}function ph(n,a,o,u){var p=n.child;for(p!==null&&(p.return=n);p!==null;){var x=p.dependencies;if(x!==null){var C=p.child;x=x.firstContext;e:for(;x!==null;){var O=x;x=p;for(var K=0;K<a.length;K++)if(O.context===a[K]){x.lanes|=o,O=x.alternate,O!==null&&(O.lanes|=o),mh(x.return,o,n),u||(C=null);break e}x=O.next}}else if(p.tag===18){if(C=p.return,C===null)throw Error(r(341));C.lanes|=o,x=C.alternate,x!==null&&(x.lanes|=o),mh(C,o,n),C=null}else C=p.child;if(C!==null)C.return=p;else for(C=p;C!==null;){if(C===n){C=null;break}if(p=C.sibling,p!==null){p.return=C.return,C=p;break}C=C.return}p=C}}function ji(n,a,o,u){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 C=p.alternate;if(C===null)throw Error(r(387));if(C=C.memoizedProps,C!==null){var O=p.type;pn(p.pendingProps.value,C.value)||(n!==null?n.push(O):n=[O])}}else if(p===de.current){if(C=p.alternate,C===null)throw Error(r(387));C.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(n!==null?n.push(gl):n=[gl])}p=p.return}n!==null&&ph(a,n,o,u),a.flags|=262144}function Zc(n){for(n=n.firstContext;n!==null;){if(!pn(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 Pt(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 R2=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(o,u){n.push(u)}};this.abort=function(){a.aborted=!0,n.forEach(function(o){return o()})}},T2=e.unstable_scheduleCallback,A2=e.unstable_NormalPriority,vt={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gh(){return{controller:new R2,data:new Map,refCount:0}}function Vo(n){n.refCount--,n.refCount===0&&T2(A2,function(){n.controller.abort()})}var Go=null,xh=0,Ei=0,Ci=null;function M2(n,a){if(Go===null){var o=Go=[];xh=0,Ei=bm(),Ci={status:"pending",value:void 0,then:function(u){o.push(u)}}}return xh++,a.then(cx,cx),a}function cx(){if(--xh===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 k2(n,a){var o=[],u={status:"pending",value:null,reason:null,then:function(p){o.push(p)}};return n.then(function(){u.status="fulfilled",u.value=a;for(var p=0;p<o.length;p++)(0,o[p])(a)},function(p){for(u.status="rejected",u.reason=p,p=0;p<o.length;p++)(0,o[p])(void 0)}),u}var ux=k.S;k.S=function(n,a){Qy=Ae(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&M2(n,a),ux!==null&&ux(n,a)};var xr=D(null);function yh(){var n=xr.current;return n!==null?n:nt.pooledCache}function Jc(n,a){a===null?J(xr,xr.current):J(xr,a.pool)}function dx(){var n=yh();return n===null?null:{parent:vt._currentValue,pool:n}}var _i=Error(r(460)),vh=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=nt,n!==null&&100<n.shellSuspendCounter)throw Error(r(482));n=a,n.status="pending",n.then(function(u){if(a.status==="pending"){var p=a;p.status="fulfilled",p.value=u}},function(u){if(a.status==="pending"){var p=a;p.status="rejected",p.reason=u}})}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 ee=W.deletions;ee===null?(W.deletions=[Z],W.flags|=16):ee.push(Z)}}function o(W,Z){if(!n)return null;for(;Z!==null;)a(W,Z),Z=Z.sibling;return null}function u(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,ee){return W.index=ee,n?(ee=W.alternate,ee!==null?(ee=ee.index,ee<Z?(W.flags|=67108866,Z):ee):(W.flags|=67108866,Z)):(W.flags|=1048576,Z)}function C(W){return n&&W.alternate===null&&(W.flags|=67108866),W}function O(W,Z,ee,ie){return Z===null||Z.tag!==6?(Z=oh(ee,W.mode,ie),Z.return=W,Z):(Z=p(Z,ee),Z.return=W,Z)}function K(W,Z,ee,ie){var Ee=ee.type;return Ee===w?re(W,Z,ee.props.children,ie,ee.key):Z!==null&&(Z.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===A&&yr(Ee)===Z.type)?(Z=p(Z,ee.props),Qo(Z,ee),Z.return=W,Z):(Z=Kc(ee.type,ee.key,ee.props,null,W.mode,ie),Qo(Z,ee),Z.return=W,Z)}function te(W,Z,ee,ie){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==ee.containerInfo||Z.stateNode.implementation!==ee.implementation?(Z=lh(ee,W.mode,ie),Z.return=W,Z):(Z=p(Z,ee.children||[]),Z.return=W,Z)}function re(W,Z,ee,ie,Ee){return Z===null||Z.tag!==7?(Z=hr(ee,W.mode,ie,Ee),Z.return=W,Z):(Z=p(Z,ee),Z.return=W,Z)}function le(W,Z,ee){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Z=oh(""+Z,W.mode,ee),Z.return=W,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case b:return ee=Kc(Z.type,Z.key,Z.props,null,W.mode,ee),Qo(ee,Z),ee.return=W,ee;case S:return Z=lh(Z,W.mode,ee),Z.return=W,Z;case A:return Z=yr(Z),le(W,Z,ee)}if(V(Z)||Q(Z))return Z=hr(Z,W.mode,ee,null),Z.return=W,Z;if(typeof Z.then=="function")return le(W,nu(Z),ee);if(Z.$$typeof===_)return le(W,Wc(W,Z),ee);su(W,Z)}return null}function ne(W,Z,ee,ie){var Ee=Z!==null?Z.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Ee!==null?null:O(W,Z,""+ee,ie);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case b:return ee.key===Ee?K(W,Z,ee,ie):null;case S:return ee.key===Ee?te(W,Z,ee,ie):null;case A:return ee=yr(ee),ne(W,Z,ee,ie)}if(V(ee)||Q(ee))return Ee!==null?null:re(W,Z,ee,ie,null);if(typeof ee.then=="function")return ne(W,Z,nu(ee),ie);if(ee.$$typeof===_)return ne(W,Z,Wc(W,ee),ie);su(W,ee)}return null}function ae(W,Z,ee,ie,Ee){if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return W=W.get(ee)||null,O(Z,W,""+ie,Ee);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case b:return W=W.get(ie.key===null?ee:ie.key)||null,K(Z,W,ie,Ee);case S:return W=W.get(ie.key===null?ee:ie.key)||null,te(Z,W,ie,Ee);case A:return ie=yr(ie),ae(W,Z,ee,ie,Ee)}if(V(ie)||Q(ie))return W=W.get(ee)||null,re(Z,W,ie,Ee,null);if(typeof ie.then=="function")return ae(W,Z,ee,nu(ie),Ee);if(ie.$$typeof===_)return ae(W,Z,ee,Wc(Z,ie),Ee);su(Z,ie)}return null}function pe(W,Z,ee,ie){for(var Ee=null,Ye=null,Se=Z,De=Z=0,Ue=null;Se!==null&&De<ee.length;De++){Se.index>De?(Ue=Se,Se=null):Ue=Se.sibling;var Qe=ne(W,Se,ee[De],ie);if(Qe===null){Se===null&&(Se=Ue);break}n&&Se&&Qe.alternate===null&&a(W,Se),Z=x(Qe,Z,De),Ye===null?Ee=Qe:Ye.sibling=Qe,Ye=Qe,Se=Ue}if(De===ee.length)return o(W,Se),$e&&Ns(W,De),Ee;if(Se===null){for(;De<ee.length;De++)Se=le(W,ee[De],ie),Se!==null&&(Z=x(Se,Z,De),Ye===null?Ee=Se:Ye.sibling=Se,Ye=Se);return $e&&Ns(W,De),Ee}for(Se=u(Se);De<ee.length;De++)Ue=ae(Se,W,De,ee[De],ie),Ue!==null&&(n&&Ue.alternate!==null&&Se.delete(Ue.key===null?De:Ue.key),Z=x(Ue,Z,De),Ye===null?Ee=Ue:Ye.sibling=Ue,Ye=Ue);return n&&Se.forEach(function(Ca){return a(W,Ca)}),$e&&Ns(W,De),Ee}function _e(W,Z,ee,ie){if(ee==null)throw Error(r(151));for(var Ee=null,Ye=null,Se=Z,De=Z=0,Ue=null,Qe=ee.next();Se!==null&&!Qe.done;De++,Qe=ee.next()){Se.index>De?(Ue=Se,Se=null):Ue=Se.sibling;var Ca=ne(W,Se,Qe.value,ie);if(Ca===null){Se===null&&(Se=Ue);break}n&&Se&&Ca.alternate===null&&a(W,Se),Z=x(Ca,Z,De),Ye===null?Ee=Ca:Ye.sibling=Ca,Ye=Ca,Se=Ue}if(Qe.done)return o(W,Se),$e&&Ns(W,De),Ee;if(Se===null){for(;!Qe.done;De++,Qe=ee.next())Qe=le(W,Qe.value,ie),Qe!==null&&(Z=x(Qe,Z,De),Ye===null?Ee=Qe:Ye.sibling=Qe,Ye=Qe);return $e&&Ns(W,De),Ee}for(Se=u(Se);!Qe.done;De++,Qe=ee.next())Qe=ae(Se,W,De,Qe.value,ie),Qe!==null&&(n&&Qe.alternate!==null&&Se.delete(Qe.key===null?De:Qe.key),Z=x(Qe,Z,De),Ye===null?Ee=Qe:Ye.sibling=Qe,Ye=Qe);return n&&Se.forEach(function(qC){return a(W,qC)}),$e&&Ns(W,De),Ee}function et(W,Z,ee,ie){if(typeof ee=="object"&&ee!==null&&ee.type===w&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case b:e:{for(var Ee=ee.key;Z!==null;){if(Z.key===Ee){if(Ee=ee.type,Ee===w){if(Z.tag===7){o(W,Z.sibling),ie=p(Z,ee.props.children),ie.return=W,W=ie;break e}}else if(Z.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===A&&yr(Ee)===Z.type){o(W,Z.sibling),ie=p(Z,ee.props),Qo(ie,ee),ie.return=W,W=ie;break e}o(W,Z);break}else a(W,Z);Z=Z.sibling}ee.type===w?(ie=hr(ee.props.children,W.mode,ie,ee.key),ie.return=W,W=ie):(ie=Kc(ee.type,ee.key,ee.props,null,W.mode,ie),Qo(ie,ee),ie.return=W,W=ie)}return C(W);case S:e:{for(Ee=ee.key;Z!==null;){if(Z.key===Ee)if(Z.tag===4&&Z.stateNode.containerInfo===ee.containerInfo&&Z.stateNode.implementation===ee.implementation){o(W,Z.sibling),ie=p(Z,ee.children||[]),ie.return=W,W=ie;break e}else{o(W,Z);break}else a(W,Z);Z=Z.sibling}ie=lh(ee,W.mode,ie),ie.return=W,W=ie}return C(W);case A:return ee=yr(ee),et(W,Z,ee,ie)}if(V(ee))return pe(W,Z,ee,ie);if(Q(ee)){if(Ee=Q(ee),typeof Ee!="function")throw Error(r(150));return ee=Ee.call(ee),_e(W,Z,ee,ie)}if(typeof ee.then=="function")return et(W,Z,nu(ee),ie);if(ee.$$typeof===_)return et(W,Z,Wc(W,ee),ie);su(W,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,Z!==null&&Z.tag===6?(o(W,Z.sibling),ie=p(Z,ee),ie.return=W,W=ie):(o(W,Z),ie=oh(ee,W.mode,ie),ie.return=W,W=ie),C(W)):o(W,Z)}return function(W,Z,ee,ie){try{Yo=0;var Ee=et(W,Z,ee,ie);return Ri=null,Ee}catch(Se){if(Se===_i||Se===eu)throw Se;var Ye=gn(29,Se,null,W.mode);return Ye.lanes=ie,Ye.return=W,Ye}finally{}}}var br=gx(!0),xx=gx(!1),ca=!1;function bh(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Sh(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 u=n.updateQueue;if(u===null)return null;if(u=u.shared,(Fe&2)!==0){var p=u.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),u.pending=a,a=Fc(n),ex(n,null,o),a}return Qc(n,u,a,o),Fc(n)}function Fo(n,a,o){if(a=a.updateQueue,a!==null&&(a=a.shared,(o&4194048)!==0)){var u=a.lanes;u&=n.pendingLanes,o|=u,a.lanes=o,Cc(n,o)}}function wh(n,a){var o=n.updateQueue,u=n.alternate;if(u!==null&&(u=u.updateQueue,o===u)){var p=null,x=null;if(o=o.firstBaseUpdate,o!==null){do{var C={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};x===null?p=x=C:x=x.next=C,o=o.next}while(o!==null);x===null?p=x=a:x=x.next=a}else p=x=a;o={baseState:u.baseState,firstBaseUpdate:p,lastBaseUpdate:x,shared:u.shared,callbacks:u.callbacks},n.updateQueue=o;return}n=o.lastBaseUpdate,n===null?o.firstBaseUpdate=a:n.next=a,o.lastBaseUpdate=a}var Nh=!1;function Ko(){if(Nh){var n=Ci;if(n!==null)throw n}}function Xo(n,a,o,u){Nh=!1;var p=n.updateQueue;ca=!1;var x=p.firstBaseUpdate,C=p.lastBaseUpdate,O=p.shared.pending;if(O!==null){p.shared.pending=null;var K=O,te=K.next;K.next=null,C===null?x=te:C.next=te,C=K;var re=n.alternate;re!==null&&(re=re.updateQueue,O=re.lastBaseUpdate,O!==C&&(O===null?re.firstBaseUpdate=te:O.next=te,re.lastBaseUpdate=K))}if(x!==null){var le=p.baseState;C=0,re=te=K=null,O=x;do{var ne=O.lane&-536870913,ae=ne!==O.lane;if(ae?(He&ne)===ne:(u&ne)===ne){ne!==0&&ne===Ei&&(Nh=!0),re!==null&&(re=re.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var pe=n,_e=O;ne=a;var et=o;switch(_e.tag){case 1:if(pe=_e.payload,typeof pe=="function"){le=pe.call(et,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(et,le,ne):pe,ne==null)break e;le=g({},le,ne);break e;case 2:ca=!0}}ne=O.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:O.tag,payload:O.payload,callback:O.callback,next:null},re===null?(te=re=ae,K=le):re=re.next=ae,C|=ne;if(O=O.next,O===null){if(O=p.shared.pending,O===null)break;ae=O,O=ae.next,ae.next=null,p.lastBaseUpdate=ae,p.shared.pending=null}}while(!0);re===null&&(K=le),p.baseState=K,p.firstBaseUpdate=te,p.lastBaseUpdate=re,x===null&&(p.shared.lanes=0),ga|=C,n.lanes=C,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=D(null),au=D(0);function bx(n,a){n=Ds,J(au,n),J(Ti,a),Ds=n|a.baseLanes}function jh(){J(au,Ds),J(Ti,Ti.current)}function Eh(){Ds=au.current,G(Ti),G(au)}var xn=D(null),Mn=null;function fa(n){var a=n.alternate;J(gt,gt.current&1),J(xn,n),Mn===null&&(a===null||Ti.current!==null||a.memoizedState!==null)&&(Mn=n)}function Ch(n){J(gt,gt.current),J(xn,n),Mn===null&&(Mn=n)}function Sx(n){n.tag===22?(J(gt,gt.current),J(xn,n),Mn===null&&(Mn=n)):ha()}function ha(){J(gt,gt.current),J(xn,xn.current)}function yn(n){G(xn),Mn===n&&(Mn=null),G(gt)}var gt=D(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||km(o)||Om(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,ke=null,We=null,bt=null,iu=!1,Ai=!1,Sr=!1,ou=0,Zo=0,Mi=null,O2=0;function ft(){throw Error(r(321))}function _h(n,a){if(a===null)return!1;for(var o=0;o<a.length&&o<n.length;o++)if(!pn(n[o],a[o]))return!1;return!0}function Rh(n,a,o,u,p,x){return Cs=x,ke=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,k.H=n===null||n.memoizedState===null?ay:qh,Sr=!1,x=o(u,p),Sr=!1,Ai&&(x=Nx(a,o,u,p)),wx(n),x}function wx(n){k.H=el;var a=We!==null&&We.next!==null;if(Cs=0,bt=We=ke=null,iu=!1,Zo=0,Mi=null,a)throw Error(r(300));n===null||St||(n=n.dependencies,n!==null&&Zc(n)&&(St=!0))}function Nx(n,a,o,u){ke=n;var p=0;do{if(Ai&&(Mi=null),Zo=0,Ai=!1,25<=p)throw Error(r(301));if(p+=1,bt=We=null,n.updateQueue!=null){var x=n.updateQueue;x.lastEffect=null,x.events=null,x.stores=null,x.memoCache!=null&&(x.memoCache.index=0)}k.H=ry,x=a(o,u)}while(Ai);return x}function D2(){var n=k.H,a=n.useState()[0];return a=typeof a.then=="function"?Wo(a):a,n=n.useState()[0],(We!==null?We.memoizedState:null)!==n&&(ke.flags|=1024),a}function Th(){var n=ou!==0;return ou=0,n}function Ah(n,a,o){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~o}function Mh(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,bt=We=ke=null,Ai=!1,Zo=ou=0,Mi=null}function Yt(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?ke.memoizedState=bt=n:bt=bt.next=n,bt}function xt(){if(We===null){var n=ke.alternate;n=n!==null?n.memoizedState:null}else n=We.next;var a=bt===null?ke.memoizedState:bt.next;if(a!==null)bt=a,We=n;else{if(n===null)throw ke.alternate===null?Error(r(467)):Error(r(310));We=n,n={memoizedState:We.memoizedState,baseState:We.baseState,baseQueue:We.baseQueue,queue:We.queue,next:null},bt===null?ke.memoizedState=bt=n:bt=bt.next=n}return bt}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=ke,(bt===null?a.memoizedState:bt.next)===null&&(a=a.alternate,k.H=a===null||a.memoizedState===null?ay:qh),n}function cu(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Wo(n);if(n.$$typeof===_)return Pt(n)}throw Error(r(438,String(n)))}function kh(n){var a=null,o=ke.updateQueue;if(o!==null&&(a=o.memoCache),a==null){var u=ke.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(a={data:u.data.map(function(p){return p.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),o===null&&(o=lu(),ke.updateQueue=o),o.memoCache=a,o=a.data[a.index],o===void 0)for(o=a.data[a.index]=Array(n),u=0;u<n;u++)o[u]=q;return a.index++,o}function _s(n,a){return typeof a=="function"?a(n):a}function uu(n){var a=xt();return Oh(a,We,n)}function Oh(n,a,o){var u=n.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=o;var p=n.baseQueue,x=u.pending;if(x!==null){if(p!==null){var C=p.next;p.next=x.next,x.next=C}a.baseQueue=p=x,u.pending=null}if(x=n.baseState,p===null)n.memoizedState=x;else{a=p.next;var O=C=null,K=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)K!==null&&(K=K.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},K===null?(O=K=le,C=x):K=K.next=le,ke.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},K===null?(O=K=ne,C=x):K=K.next=ne,ke.lanes|=le,ga|=le;te=te.next}while(te!==null&&te!==a);if(K===null?C=x:K.next=O,!pn(x,n.memoizedState)&&(St=!0,re&&(o=Ci,o!==null)))throw o;n.memoizedState=x,n.baseState=C,n.baseQueue=K,u.lastRenderedState=x}return p===null&&(u.lanes=0),[n.memoizedState,u.dispatch]}function Dh(n){var a=xt(),o=a.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=n;var u=o.dispatch,p=o.pending,x=a.memoizedState;if(p!==null){o.pending=null;var C=p=p.next;do x=n(x,C.action),C=C.next;while(C!==p);pn(x,a.memoizedState)||(St=!0),a.memoizedState=x,a.baseQueue===null&&(a.baseState=x),o.lastRenderedState=x}return[x,u]}function jx(n,a,o){var u=ke,p=xt(),x=$e;if(x){if(o===void 0)throw Error(r(407));o=o()}else o=a();var C=!pn((We||p).memoizedState,o);if(C&&(p.memoizedState=o,St=!0),p=p.queue,Ph(_x.bind(null,u,p,n),[n]),p.getSnapshot!==a||C||bt!==null&&bt.memoizedState.tag&1){if(u.flags|=2048,ki(9,{destroy:void 0},Cx.bind(null,u,p,o,a),null),nt===null)throw Error(r(349));x||(Cs&127)!==0||Ex(u,a,o)}return o}function Ex(n,a,o){n.flags|=16384,n={getSnapshot:a,value:o},a=ke.updateQueue,a===null?(a=lu(),ke.updateQueue=a,a.stores=[n]):(o=a.stores,o===null?a.stores=[n]:o.push(n))}function Cx(n,a,o,u){a.value=o,a.getSnapshot=u,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!pn(n,o)}catch{return!0}}function Tx(n){var a=fr(n,2);a!==null&&on(a,n,2)}function Lh(n){var a=Yt();if(typeof n=="function"){var o=n;if(n=o(),Sr){Jn(!0);try{o()}finally{Jn(!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,u){return n.baseState=o,Oh(n,We,typeof u=="function"?u:_s)}function L2(n,a,o,u,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(C){x.listeners.push(C)}};k.T!==null?o(!0):x.isTransition=!1,u(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,u=a.payload,p=n.state;if(a.isTransition){var x=k.T,C={};k.T=C;try{var O=o(p,u),K=k.S;K!==null&&K(C,O),kx(n,a,O)}catch(te){zh(n,a,te)}finally{x!==null&&C.types!==null&&(x.types=C.types),k.T=x}}else try{x=o(p,u),kx(n,a,x)}catch(te){zh(n,a,te)}}function kx(n,a,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(u){Ox(n,a,u)},function(u){return zh(n,a,u)}):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 zh(n,a,o){var u=n.pending;if(n.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=o,Dx(a),a=a.next;while(a!==u)}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=nt.formState;if(o!==null){e:{var u=ke;if($e){if(st){t:{for(var p=st,x=An;p.nodeType!==8;){if(!x){p=null;break t}if(p=kn(p.nextSibling),p===null){p=null;break t}}x=p.data,p=x==="F!"||x==="F"?p:null}if(p){st=kn(p.nextSibling),u=p.data==="F!";break e}}oa(u)}u=!1}u&&(a=o[0])}}return o=Yt(),o.memoizedState=o.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Lx,lastRenderedState:a},o.queue=u,o=ty.bind(null,ke,u),u.dispatch=o,u=Lh(!1),x=$h.bind(null,ke,!1,u.queue),u=Yt(),p={state:a,dispatch:null,action:n,pending:null},u.queue=p,o=L2.bind(null,ke,p,x,o),p.dispatch=o,u.memoizedState=n,[a,o,!1]}function Px(n){var a=xt();return Ix(a,We,n)}function Ix(n,a,o){if(a=Oh(n,a,Lx)[0],n=uu(_s)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=Wo(a)}catch(C){throw C===_i?eu:C}else u=a;a=xt();var p=a.queue,x=p.dispatch;return o!==a.memoizedState&&(ke.flags|=2048,ki(9,{destroy:void 0},z2.bind(null,p,o),null)),[u,x,n]}function z2(n,a){n.action=a}function Bx(n){var a=xt(),o=We;if(o!==null)return Ix(a,o,n);xt(),a=a.memoizedState,o=xt();var u=o.queue.dispatch;return o.memoizedState=n,[a,u,!1]}function ki(n,a,o,u){return n={tag:n,create:o,deps:u,inst:a,next:null},a=ke.updateQueue,a===null&&(a=lu(),ke.updateQueue=a),o=a.lastEffect,o===null?a.lastEffect=n.next=n:(u=o.next,o.next=n,n.next=u,a.lastEffect=n),n}function Hx(){return xt().memoizedState}function du(n,a,o,u){var p=Yt();ke.flags|=n,p.memoizedState=ki(1|a,{destroy:void 0},o,u===void 0?null:u)}function fu(n,a,o,u){var p=xt();u=u===void 0?null:u;var x=p.memoizedState.inst;We!==null&&u!==null&&_h(u,We.memoizedState.deps)?p.memoizedState=ki(a,x,o,u):(ke.flags|=n,p.memoizedState=ki(1|a,x,o,u))}function Ux(n,a){du(8390656,8,n,a)}function Ph(n,a){fu(2048,8,n,a)}function P2(n){ke.flags|=4;var a=ke.updateQueue;if(a===null)a=lu(),ke.updateQueue=a,a.events=[n];else{var o=a.events;o===null?a.events=[n]:o.push(n)}}function $x(n){var a=xt().memoizedState;return P2({ref:a,nextImpl:n}),function(){if((Fe&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 Ih(){}function Qx(n,a){var o=xt();a=a===void 0?null:a;var u=o.memoizedState;return a!==null&&_h(a,u[1])?u[0]:(o.memoizedState=[n,a],n)}function Fx(n,a){var o=xt();a=a===void 0?null:a;var u=o.memoizedState;if(a!==null&&_h(a,u[1]))return u[0];if(u=n(),Sr){Jn(!0);try{n()}finally{Jn(!1)}}return o.memoizedState=[u,a],u}function Bh(n,a,o){return o===void 0||(Cs&1073741824)!==0&&(He&261930)===0?n.memoizedState=a:(n.memoizedState=o,n=Ky(),ke.lanes|=n,ga|=n,o)}function Kx(n,a,o,u){return pn(o,a)?o:Ti.current!==null?(n=Bh(n,o,u),pn(n,a)||(St=!0),n):(Cs&42)===0||(Cs&1073741824)!==0&&(He&261930)===0?(St=!0,n.memoizedState=o):(n=Ky(),ke.lanes|=n,ga|=n,a)}function Xx(n,a,o,u,p){var x=U.p;U.p=x!==0&&8>x?x:8;var C=k.T,O={};k.T=O,$h(n,!1,a,o);try{var K=p(),te=k.S;if(te!==null&&te(O,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var re=k2(K,u);Jo(n,a,re,Sn(n))}else Jo(n,a,u,Sn(n))}catch(le){Jo(n,a,{then:function(){},status:"rejected",reason:le},Sn())}finally{U.p=x,C!==null&&O.types!==null&&(C.types=O.types),k.T=C}}function I2(){}function Hh(n,a,o,u){if(n.tag!==5)throw Error(r(476));var p=Zx(n).queue;Xx(n,p,a,$,o===null?I2:function(){return Wx(n),o(u)})}function Zx(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:$,baseState:$,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:$},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,{},Sn())}function Uh(){return Pt(gl)}function Jx(){return xt().memoizedState}function ey(){return xt().memoizedState}function B2(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var o=Sn();n=ua(o);var u=da(a,n,o);u!==null&&(on(u,a,o),Fo(u,a,o)),a={cache:gh()},n.payload=a;return}a=a.return}}function H2(n,a,o){var u=Sn();o={lane:u,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},hu(n)?ny(a,o):(o=rh(n,a,o,u),o!==null&&(on(o,n,u),sy(o,a,u)))}function ty(n,a,o){var u=Sn();Jo(n,a,o,u)}function Jo(n,a,o,u){var p={lane:u,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 C=a.lastRenderedState,O=x(C,o);if(p.hasEagerState=!0,p.eagerState=O,pn(O,C))return Qc(n,a,p,0),nt===null&&Yc(),!1}catch{}finally{}if(o=rh(n,a,p,u),o!==null)return on(o,n,u),sy(o,a,u),!0}return!1}function $h(n,a,o,u){if(u={lane:2,revertLane:bm(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},hu(n)){if(a)throw Error(r(479))}else a=rh(n,o,u,2),a!==null&&on(a,n,2)}function hu(n){var a=n.alternate;return n===ke||a!==null&&a===ke}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 u=a.lanes;u&=n.pendingLanes,o|=u,a.lanes=o,Cc(n,o)}}var el={readContext:Pt,use:cu,useCallback:ft,useContext:ft,useEffect:ft,useImperativeHandle:ft,useLayoutEffect:ft,useInsertionEffect:ft,useMemo:ft,useReducer:ft,useRef:ft,useState:ft,useDebugValue:ft,useDeferredValue:ft,useTransition:ft,useSyncExternalStore:ft,useId:ft,useHostTransitionStatus:ft,useFormState:ft,useActionState:ft,useOptimistic:ft,useMemoCache:ft,useCacheRefresh:ft};el.useEffectEvent=ft;var ay={readContext:Pt,use:cu,useCallback:function(n,a){return Yt().memoizedState=[n,a===void 0?null:a],n},useContext:Pt,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=Yt();a=a===void 0?null:a;var u=n();if(Sr){Jn(!0);try{n()}finally{Jn(!1)}}return o.memoizedState=[u,a],u},useReducer:function(n,a,o){var u=Yt();if(o!==void 0){var p=o(a);if(Sr){Jn(!0);try{o(a)}finally{Jn(!1)}}}else p=a;return u.memoizedState=u.baseState=p,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:p},u.queue=n,n=n.dispatch=H2.bind(null,ke,n),[u.memoizedState,n]},useRef:function(n){var a=Yt();return n={current:n},a.memoizedState=n},useState:function(n){n=Lh(n);var a=n.queue,o=ty.bind(null,ke,a);return a.dispatch=o,[n.memoizedState,o]},useDebugValue:Ih,useDeferredValue:function(n,a){var o=Yt();return Bh(o,n,a)},useTransition:function(){var n=Lh(!1);return n=Xx.bind(null,ke,n.queue,!0,!1),Yt().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,o){var u=ke,p=Yt();if($e){if(o===void 0)throw Error(r(407));o=o()}else{if(o=a(),nt===null)throw Error(r(349));(He&127)!==0||Ex(u,a,o)}p.memoizedState=o;var x={value:o,getSnapshot:a};return p.queue=x,Ux(_x.bind(null,u,x,n),[n]),u.flags|=2048,ki(9,{destroy:void 0},Cx.bind(null,u,x,o,a),null),o},useId:function(){var n=Yt(),a=nt.identifierPrefix;if($e){var o=ns,u=ts;o=(u&~(1<<32-Gt(u)-1)).toString(32)+o,a="_"+a+"R_"+o,o=ou++,0<o&&(a+="H"+o.toString(32)),a+="_"}else o=O2++,a="_"+a+"r_"+o.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:Uh,useFormState:zx,useActionState:zx,useOptimistic:function(n){var a=Yt();a.memoizedState=a.baseState=n;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=o,a=$h.bind(null,ke,!0,o),o.dispatch=a,[n,a]},useMemoCache:kh,useCacheRefresh:function(){return Yt().memoizedState=B2.bind(null,ke)},useEffectEvent:function(n){var a=Yt(),o={impl:n};return a.memoizedState=o,function(){if((Fe&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}},qh={readContext:Pt,use:cu,useCallback:Qx,useContext:Pt,useEffect:Ph,useImperativeHandle:Yx,useInsertionEffect:qx,useLayoutEffect:Vx,useMemo:Fx,useReducer:uu,useRef:Hx,useState:function(){return uu(_s)},useDebugValue:Ih,useDeferredValue:function(n,a){var o=xt();return Kx(o,We.memoizedState,n,a)},useTransition:function(){var n=uu(_s)[0],a=xt().memoizedState;return[typeof n=="boolean"?n:Wo(n),a]},useSyncExternalStore:jx,useId:Jx,useHostTransitionStatus:Uh,useFormState:Px,useActionState:Px,useOptimistic:function(n,a){var o=xt();return Ax(o,We,n,a)},useMemoCache:kh,useCacheRefresh:ey};qh.useEffectEvent=$x;var ry={readContext:Pt,use:cu,useCallback:Qx,useContext:Pt,useEffect:Ph,useImperativeHandle:Yx,useInsertionEffect:qx,useLayoutEffect:Vx,useMemo:Fx,useReducer:Dh,useRef:Hx,useState:function(){return Dh(_s)},useDebugValue:Ih,useDeferredValue:function(n,a){var o=xt();return We===null?Bh(o,n,a):Kx(o,We.memoizedState,n,a)},useTransition:function(){var n=Dh(_s)[0],a=xt().memoizedState;return[typeof n=="boolean"?n:Wo(n),a]},useSyncExternalStore:jx,useId:Jx,useHostTransitionStatus:Uh,useFormState:Bx,useActionState:Bx,useOptimistic:function(n,a){var o=xt();return We!==null?Ax(o,We,n,a):(o.baseState=n,[n,o.queue.dispatch])},useMemoCache:kh,useCacheRefresh:ey};ry.useEffectEvent=$x;function Vh(n,a,o,u){a=n.memoizedState,o=o(u,a),o=o==null?a:g({},a,o),n.memoizedState=o,n.lanes===0&&(n.updateQueue.baseState=o)}var Gh={enqueueSetState:function(n,a,o){n=n._reactInternals;var u=Sn(),p=ua(u);p.payload=a,o!=null&&(p.callback=o),a=da(n,p,u),a!==null&&(on(a,n,u),Fo(a,n,u))},enqueueReplaceState:function(n,a,o){n=n._reactInternals;var u=Sn(),p=ua(u);p.tag=1,p.payload=a,o!=null&&(p.callback=o),a=da(n,p,u),a!==null&&(on(a,n,u),Fo(a,n,u))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var o=Sn(),u=ua(o);u.tag=2,a!=null&&(u.callback=a),a=da(n,u,o),a!==null&&(on(a,n,o),Fo(a,n,o))}};function iy(n,a,o,u,p,x,C){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(u,x,C):a.prototype&&a.prototype.isPureReactComponent?!Ho(o,u)||!Ho(p,x):!0}function oy(n,a,o,u){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(o,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(o,u),a.state!==n&&Gh.enqueueReplaceState(a,a.state,null)}function wr(n,a){var o=a;if("ref"in a){o={};for(var u in a)u!=="ref"&&(o[u]=a[u])}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(u){setTimeout(function(){throw u})}}function dy(n,a,o){try{var u=n.onCaughtError;u(o.value,{componentStack:o.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function Yh(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,u){var p=o.type.getDerivedStateFromError;if(typeof p=="function"){var x=u.value;n.payload=function(){return p(x)},n.callback=function(){dy(a,o,u)}}var C=o.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(n.callback=function(){dy(a,o,u),typeof p!="function"&&(xa===null?xa=new Set([this]):xa.add(this));var O=u.stack;this.componentDidCatch(u.value,{componentStack:O!==null?O:""})})}function U2(n,a,o,u,p){if(o.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=o.alternate,a!==null&&ji(a,o,p,!0),o=xn.current,o!==null){switch(o.tag){case 31:case 13:return Mn===null?Cu():o.alternate===null&&ht===0&&(ht=3),o.flags&=-257,o.flags|=65536,o.lanes=p,u===tu?o.flags|=16384:(a=o.updateQueue,a===null?o.updateQueue=new Set([u]):a.add(u),xm(n,u,p)),!1;case 22:return o.flags|=65536,u===tu?o.flags|=16384:(a=o.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([u])},o.updateQueue=a):(o=a.retryQueue,o===null?a.retryQueue=new Set([u]):o.add(u)),xm(n,u,p)),!1}throw Error(r(435,o.tag))}return xm(n,u,p),Cu(),!1}if($e)return a=xn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=p,u!==dh&&(n=Error(r(422),{cause:u}),qo(_n(n,o)))):(u!==dh&&(a=Error(r(423),{cause:u}),qo(_n(a,o))),n=n.current.alternate,n.flags|=65536,p&=-p,n.lanes|=p,u=_n(u,o),p=Yh(n.stateNode,u,p),wh(n,p),ht!==4&&(ht=2)),!1;var x=Error(r(520),{cause:u});if(x=_n(x,o),ll===null?ll=[x]:ll.push(x),ht!==4&&(ht=2),a===null)return!0;u=_n(u,o),o=a;do{switch(o.tag){case 3:return o.flags|=65536,n=p&-p,o.lanes|=n,n=Yh(o.stateNode,u,n),wh(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,u),wh(o,p),!1}o=o.return}while(o!==null);return!1}var Qh=Error(r(461)),St=!1;function It(n,a,o,u){a.child=n===null?xx(a,null,o,u):br(a,n.child,o,u)}function my(n,a,o,u,p){o=o.render;var x=a.ref;if("ref"in u){var C={};for(var O in u)O!=="ref"&&(C[O]=u[O])}else C=u;return gr(a),u=Rh(n,a,o,C,x,p),O=Th(),n!==null&&!St?(Ah(n,a,p),Rs(n,a,p)):($e&&O&&ch(a),a.flags|=1,It(n,a,u,p),a.child)}function py(n,a,o,u,p){if(n===null){var x=o.type;return typeof x=="function"&&!ih(x)&&x.defaultProps===void 0&&o.compare===null?(a.tag=15,a.type=x,gy(n,a,x,u,p)):(n=Kc(o.type,null,u,a,a.mode,p),n.ref=a.ref,n.return=a,a.child=n)}if(x=n.child,!tm(n,p)){var C=x.memoizedProps;if(o=o.compare,o=o!==null?o:Ho,o(C,u)&&n.ref===a.ref)return Rs(n,a,p)}return a.flags|=1,n=ws(x,u),n.ref=a.ref,n.return=a,a.child=n}function gy(n,a,o,u,p){if(n!==null){var x=n.memoizedProps;if(Ho(x,u)&&n.ref===a.ref)if(St=!1,a.pendingProps=u=x,tm(n,p))(n.flags&131072)!==0&&(St=!0);else return a.lanes=n.lanes,Rs(n,a,p)}return Fh(n,a,o,u,p)}function xy(n,a,o,u){var p=u.children,x=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((a.flags&128)!==0){if(x=x!==null?x.baseLanes|o:o,n!==null){for(u=a.child=n.child,p=0;u!==null;)p=p|u.lanes|u.childLanes,u=u.sibling;u=p&~x}else u=0,a.child=null;return yy(n,a,x,o,u)}if((o&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&Jc(a,x!==null?x.cachePool:null),x!==null?bx(a,x):jh(),Sx(a);else return u=a.lanes=536870912,yy(n,a,x!==null?x.baseLanes|o:o,o,u)}else x!==null?(Jc(a,x.cachePool),bx(a,x),ha(),a.memoizedState=null):(n!==null&&Jc(a,null),jh(),ha());return It(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,u,p){var x=yh();return x=x===null?null:{parent:vt._currentValue,pool:x},a.memoizedState={baseLanes:o,cachePool:x},n!==null&&Jc(a,null),jh(),Sx(a),n!==null&&ji(n,a,u,!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,yn(a),a.memoizedState=null,n}function $2(n,a,o){var u=a.pendingProps,p=(a.flags&128)!==0;if(a.flags&=-129,n===null){if($e){if(u.mode==="hidden")return n=pu(a,u),a.lanes=536870912,tl(null,n);if(Ch(a),(n=st)?(n=Mv(n,An),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:ra!==null?{id:ts,overflow:ns}:null,retryLane:536870912,hydrationErrors:null},o=nx(n),o.return=a,a.child=o,zt=a,st=null)):n=null,n===null)throw oa(a);return a.lanes=536870912,null}return pu(a,u)}var x=n.memoizedState;if(x!==null){var C=x.dehydrated;if(Ch(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(St||ji(n,a,o,!1),p=(o&n.childLanes)!==0,St||p){if(u=nt,u!==null&&(C=_c(u,o),C!==0&&C!==x.retryLane))throw x.retryLane=C,fr(n,C),on(u,n,C),Qh;Cu(),a=vy(n,a,o)}else n=x.treeContext,st=kn(C.nextSibling),zt=a,$e=!0,ia=null,An=!1,n!==null&&rx(a,n),a=pu(a,u),a.flags|=4096;return a}return n=ws(n.child,{mode:u.mode,children:u.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,u,p){return gr(a),o=Rh(n,a,o,u,void 0,p),u=Th(),n!==null&&!St?(Ah(n,a,p),Rs(n,a,p)):($e&&u&&ch(a),a.flags|=1,It(n,a,o,p),a.child)}function by(n,a,o,u,p,x){return gr(a),a.updateQueue=null,o=Nx(a,u,o,p),wx(n),u=Th(),n!==null&&!St?(Ah(n,a,x),Rs(n,a,x)):($e&&u&&ch(a),a.flags|=1,It(n,a,o,x),a.child)}function Sy(n,a,o,u,p){if(gr(a),a.stateNode===null){var x=bi,C=o.contextType;typeof C=="object"&&C!==null&&(x=Pt(C)),x=new o(u,x),a.memoizedState=x.state!==null&&x.state!==void 0?x.state:null,x.updater=Gh,a.stateNode=x,x._reactInternals=a,x=a.stateNode,x.props=u,x.state=a.memoizedState,x.refs={},bh(a),C=o.contextType,x.context=typeof C=="object"&&C!==null?Pt(C):bi,x.state=a.memoizedState,C=o.getDerivedStateFromProps,typeof C=="function"&&(Vh(a,o,C,u),x.state=a.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof x.getSnapshotBeforeUpdate=="function"||typeof x.UNSAFE_componentWillMount!="function"&&typeof x.componentWillMount!="function"||(C=x.state,typeof x.componentWillMount=="function"&&x.componentWillMount(),typeof x.UNSAFE_componentWillMount=="function"&&x.UNSAFE_componentWillMount(),C!==x.state&&Gh.enqueueReplaceState(x,x.state,null),Xo(a,u,x,p),Ko(),x.state=a.memoizedState),typeof x.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(n===null){x=a.stateNode;var O=a.memoizedProps,K=wr(o,O);x.props=K;var te=x.context,re=o.contextType;C=bi,typeof re=="object"&&re!==null&&(C=Pt(re));var le=o.getDerivedStateFromProps;re=typeof le=="function"||typeof x.getSnapshotBeforeUpdate=="function",O=a.pendingProps!==O,re||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(O||te!==C)&&oy(a,x,u,C),ca=!1;var ne=a.memoizedState;x.state=ne,Xo(a,u,x,p),Ko(),te=a.memoizedState,O||ne!==te||ca?(typeof le=="function"&&(Vh(a,o,le,u),te=a.memoizedState),(K=ca||iy(a,o,K,u,ne,te,C))?(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=u,a.memoizedState=te),x.props=u,x.state=te,x.context=C,u=K):(typeof x.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{x=a.stateNode,Sh(n,a),C=a.memoizedProps,re=wr(o,C),x.props=re,le=a.pendingProps,ne=x.context,te=o.contextType,K=bi,typeof te=="object"&&te!==null&&(K=Pt(te)),O=o.getDerivedStateFromProps,(te=typeof O=="function"||typeof x.getSnapshotBeforeUpdate=="function")||typeof x.UNSAFE_componentWillReceiveProps!="function"&&typeof x.componentWillReceiveProps!="function"||(C!==le||ne!==K)&&oy(a,x,u,K),ca=!1,ne=a.memoizedState,x.state=ne,Xo(a,u,x,p),Ko();var ae=a.memoizedState;C!==le||ne!==ae||ca||n!==null&&n.dependencies!==null&&Zc(n.dependencies)?(typeof O=="function"&&(Vh(a,o,O,u),ae=a.memoizedState),(re=ca||iy(a,o,re,u,ne,ae,K)||n!==null&&n.dependencies!==null&&Zc(n.dependencies))?(te||typeof x.UNSAFE_componentWillUpdate!="function"&&typeof x.componentWillUpdate!="function"||(typeof x.componentWillUpdate=="function"&&x.componentWillUpdate(u,ae,K),typeof x.UNSAFE_componentWillUpdate=="function"&&x.UNSAFE_componentWillUpdate(u,ae,K)),typeof x.componentDidUpdate=="function"&&(a.flags|=4),typeof x.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof x.componentDidUpdate!="function"||C===n.memoizedProps&&ne===n.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||C===n.memoizedProps&&ne===n.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=ae),x.props=u,x.state=ae,x.context=K,u=re):(typeof x.componentDidUpdate!="function"||C===n.memoizedProps&&ne===n.memoizedState||(a.flags|=4),typeof x.getSnapshotBeforeUpdate!="function"||C===n.memoizedProps&&ne===n.memoizedState||(a.flags|=1024),u=!1)}return x=u,gu(n,a),u=(a.flags&128)!==0,x||u?(x=a.stateNode,o=u&&typeof o.getDerivedStateFromError!="function"?null:x.render(),a.flags|=1,n!==null&&u?(a.child=br(a,n.child,null,p),a.child=br(a,null,o,p)):It(n,a,o,p),a.memoizedState=x.state,n=a.child):n=Rs(n,a,p),n}function wy(n,a,o,u){return mr(),a.flags|=256,It(n,a,o,u),a.child}var Kh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Xh(n){return{baseLanes:n,cachePool:dx()}}function Zh(n,a,o){return n=n!==null?n.childLanes&~o:0,a&&(n|=bn),n}function Ny(n,a,o){var u=a.pendingProps,p=!1,x=(a.flags&128)!==0,C;if((C=x)||(C=n!==null&&n.memoizedState===null?!1:(gt.current&2)!==0),C&&(p=!0,a.flags&=-129),C=(a.flags&32)!==0,a.flags&=-33,n===null){if($e){if(p?fa(a):ha(),(n=st)?(n=Mv(n,An),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:ra!==null?{id:ts,overflow:ns}:null,retryLane:536870912,hydrationErrors:null},o=nx(n),o.return=a,a.child=o,zt=a,st=null)):n=null,n===null)throw oa(a);return Om(n)?a.lanes=32:a.lanes=536870912,null}var O=u.children;return u=u.fallback,p?(ha(),p=a.mode,O=xu({mode:"hidden",children:O},p),u=hr(u,p,o,null),O.return=a,u.return=a,O.sibling=u,a.child=O,u=a.child,u.memoizedState=Xh(o),u.childLanes=Zh(n,C,o),a.memoizedState=Kh,tl(null,u)):(fa(a),Wh(a,O))}var K=n.memoizedState;if(K!==null&&(O=K.dehydrated,O!==null)){if(x)a.flags&256?(fa(a),a.flags&=-257,a=Jh(n,a,o)):a.memoizedState!==null?(ha(),a.child=n.child,a.flags|=128,a=null):(ha(),O=u.fallback,p=a.mode,u=xu({mode:"visible",children:u.children},p),O=hr(O,p,o,null),O.flags|=2,u.return=a,O.return=a,u.sibling=O,a.child=u,br(a,n.child,null,o),u=a.child,u.memoizedState=Xh(o),u.childLanes=Zh(n,C,o),a.memoizedState=Kh,a=tl(null,u));else if(fa(a),Om(O)){if(C=O.nextSibling&&O.nextSibling.dataset,C)var te=C.dgst;C=te,u=Error(r(419)),u.stack="",u.digest=C,qo({value:u,source:null,stack:null}),a=Jh(n,a,o)}else if(St||ji(n,a,o,!1),C=(o&n.childLanes)!==0,St||C){if(C=nt,C!==null&&(u=_c(C,o),u!==0&&u!==K.retryLane))throw K.retryLane=u,fr(n,u),on(C,n,u),Qh;km(O)||Cu(),a=Jh(n,a,o)}else km(O)?(a.flags|=192,a.child=n.child,a=null):(n=K.treeContext,st=kn(O.nextSibling),zt=a,$e=!0,ia=null,An=!1,n!==null&&rx(a,n),a=Wh(a,u.children),a.flags|=4096);return a}return p?(ha(),O=u.fallback,p=a.mode,K=n.child,te=K.sibling,u=ws(K,{mode:"hidden",children:u.children}),u.subtreeFlags=K.subtreeFlags&65011712,te!==null?O=ws(te,O):(O=hr(O,p,o,null),O.flags|=2),O.return=a,u.return=a,u.sibling=O,a.child=u,tl(null,u),u=a.child,O=n.child.memoizedState,O===null?O=Xh(o):(p=O.cachePool,p!==null?(K=vt._currentValue,p=p.parent!==K?{parent:K,pool:K}:p):p=dx(),O={baseLanes:O.baseLanes|o,cachePool:p}),u.memoizedState=O,u.childLanes=Zh(n,C,o),a.memoizedState=Kh,tl(n.child,u)):(fa(a),o=n.child,n=o.sibling,o=ws(o,{mode:"visible",children:u.children}),o.return=a,o.sibling=null,n!==null&&(C=a.deletions,C===null?(a.deletions=[n],a.flags|=16):C.push(n)),a.child=o,a.memoizedState=null,o)}function Wh(n,a){return a=xu({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function xu(n,a){return n=gn(22,n,null,a),n.lanes=0,n}function Jh(n,a,o){return br(a,n.child,null,o),n=Wh(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function jy(n,a,o){n.lanes|=a;var u=n.alternate;u!==null&&(u.lanes|=a),mh(n.return,a,o)}function em(n,a,o,u,p,x){var C=n.memoizedState;C===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:o,tailMode:p,treeForkCount:x}:(C.isBackwards=a,C.rendering=null,C.renderingStartTime=0,C.last=u,C.tail=o,C.tailMode=p,C.treeForkCount=x)}function Ey(n,a,o){var u=a.pendingProps,p=u.revealOrder,x=u.tail;u=u.children;var C=gt.current,O=(C&2)!==0;if(O?(C=C&1|2,a.flags|=128):C&=1,J(gt,C),It(n,a,u,o),u=$e?$o:0,!O&&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),em(a,!1,p,o,x,u);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}em(a,!0,o,null,x,u);break;case"together":em(a,!1,null,null,void 0,u);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 tm(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&Zc(n)))}function q2(n,a,o){switch(a.tag){case 3:ue(a,a.stateNode.containerInfo),la(a,vt,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,Ch(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.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(u=(o&a.childLanes)!==0,u||(ji(n,a,o,!1),u=(o&a.childLanes)!==0),p){if(u)return Ey(n,a,o);a.flags|=128}if(p=a.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),J(gt,gt.current),u)break;return null;case 22:return a.lanes=0,xy(n,a,o,a.pendingProps);case 24:la(a,vt,n.memoizedState.cache)}return Rs(n,a,o)}function Cy(n,a,o){if(n!==null)if(n.memoizedProps!==a.pendingProps)St=!0;else{if(!tm(n,o)&&(a.flags&128)===0)return St=!1,q2(n,a,o);St=(n.flags&131072)!==0}else St=!1,$e&&(a.flags&1048576)!==0&&ax(a,$o,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(n=yr(a.elementType),a.type=n,typeof n=="function")ih(n)?(u=wr(n,u),a.tag=1,a=Sy(null,a,n,u,o)):(a.tag=0,a=Fh(null,a,n,u,o));else{if(n!=null){var p=n.$$typeof;if(p===R){a.tag=11,a=my(null,a,n,u,o);break e}else if(p===P){a.tag=14,a=py(null,a,n,u,o);break e}}throw a=B(n)||n,Error(r(306,a,""))}}return a;case 0:return Fh(n,a,a.type,a.pendingProps,o);case 1:return u=a.type,p=wr(u,a.pendingProps),Sy(n,a,u,p,o);case 3:e:{if(ue(a,a.stateNode.containerInfo),n===null)throw Error(r(387));u=a.pendingProps;var x=a.memoizedState;p=x.element,Sh(n,a),Xo(a,u,null,o);var C=a.memoizedState;if(u=C.cache,la(a,vt,u),u!==x.cache&&ph(a,[vt],o,!0),Ko(),u=C.element,x.isDehydrated)if(x={element:u,isDehydrated:!1,cache:C.cache},a.updateQueue.baseState=x,a.memoizedState=x,a.flags&256){a=wy(n,a,u,o);break e}else if(u!==p){p=_n(Error(r(424)),a),qo(p),a=wy(n,a,u,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(st=kn(n.firstChild),zt=a,$e=!0,ia=null,An=!0,o=xx(a,null,u,o),a.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(mr(),u===p){a=Rs(n,a,o);break e}It(n,a,u,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,u=Ou(ce.current).createElement(o),u[jt]=a,u[Ut]=n,Bt(u,o,n),yt(u),a.stateNode=u):a.memoizedState=Pv(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return Ce(a),n===null&&$e&&(u=a.stateNode=Dv(a.type,a.pendingProps,ce.current),zt=a,An=!0,p=st,Sa(a.type)?(Dm=p,st=kn(u.firstChild)):st=p),It(n,a,a.pendingProps.children,o),gu(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&$e&&((p=u=st)&&(u=vC(u,a.type,a.pendingProps,An),u!==null?(a.stateNode=u,zt=a,st=kn(u.firstChild),An=!1,p=!0):p=!1),p||oa(a)),Ce(a),p=a.type,x=a.pendingProps,C=n!==null?n.memoizedProps:null,u=x.children,Tm(p,x)?u=null:C!==null&&Tm(p,C)&&(a.flags|=32),a.memoizedState!==null&&(p=Rh(n,a,D2,null,null,o),gl._currentValue=p),gu(n,a),It(n,a,u,o),a.child;case 6:return n===null&&$e&&((n=o=st)&&(o=bC(o,a.pendingProps,An),o!==null?(a.stateNode=o,zt=a,st=null,n=!0):n=!1),n||oa(a)),null;case 13:return Ny(n,a,o);case 4:return ue(a,a.stateNode.containerInfo),u=a.pendingProps,n===null?a.child=br(a,null,u,o):It(n,a,u,o),a.child;case 11:return my(n,a,a.type,a.pendingProps,o);case 7:return It(n,a,a.pendingProps,o),a.child;case 8:return It(n,a,a.pendingProps.children,o),a.child;case 12:return It(n,a,a.pendingProps.children,o),a.child;case 10:return u=a.pendingProps,la(a,a.type,u.value),It(n,a,u.children,o),a.child;case 9:return p=a.type._context,u=a.pendingProps.children,gr(a),p=Pt(p),u=u(p),a.flags|=1,It(n,a,u,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 $2(n,a,o);case 22:return xy(n,a,o,a.pendingProps);case 24:return gr(a),u=Pt(vt),n===null?(p=yh(),p===null&&(p=nt,x=gh(),p.pooledCache=x,x.refCount++,x!==null&&(p.pooledCacheLanes|=o),p=x),a.memoizedState={parent:u,cache:p},bh(a),la(a,vt,p)):((n.lanes&o)!==0&&(Sh(n,a),Xo(a,null,null,o),Ko()),p=n.memoizedState,x=a.memoizedState,p.parent!==u?(p={parent:u,cache:u},a.memoizedState=p,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=p),la(a,vt,u)):(u=x.cache,la(a,vt,u),u!==p.cache&&ph(a,[vt],o,!0))),It(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 nm(n,a,o,u,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,vh}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,vh}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 u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:u.sibling=null}}function at(n){var a=n.alternate!==null&&n.alternate.child===n.child,o=0,u=0;if(a)for(var p=n.child;p!==null;)o|=p.lanes|p.childLanes,u|=p.subtreeFlags&65011712,u|=p.flags&65011712,p.return=n,p=p.sibling;else for(p=n.child;p!==null;)o|=p.lanes|p.childLanes,u|=p.subtreeFlags,u|=p.flags,p.return=n,p=p.sibling;return n.subtreeFlags|=u,n.childLanes=o,a}function V2(n,a,o){var u=a.pendingProps;switch(uh(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return at(a),null;case 1:return at(a),null;case 3:return o=a.stateNode,u=null,n!==null&&(u=n.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Es(vt),fe(),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,fh())),at(a),null;case 26:var p=a.type,x=a.memoizedState;return n===null?(Ts(a),x!==null?(at(a),_y(a,x)):(at(a),nm(a,p,null,u,o))):x?x!==n.memoizedState?(Ts(a),at(a),_y(a,x)):(at(a),a.flags&=-16777217):(n=n.memoizedProps,n!==u&&Ts(a),at(a),nm(a,p,n,u,o)),null;case 27:if(be(a),o=ce.current,p=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==u&&Ts(a);else{if(!u){if(a.stateNode===null)throw Error(r(166));return at(a),null}n=se.current,Ni(a)?ix(a):(n=Dv(p,u,o),a.stateNode=n,Ts(a))}return at(a),null;case 5:if(be(a),p=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==u&&Ts(a);else{if(!u){if(a.stateNode===null)throw Error(r(166));return at(a),null}if(x=se.current,Ni(a))ix(a);else{var C=Ou(ce.current);switch(x){case 1:x=C.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:x=C.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":x=C.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":x=C.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":x=C.createElement("div"),x.innerHTML="<script><\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof u.is=="string"?C.createElement("select",{is:u.is}):C.createElement("select"),u.multiple?x.multiple=!0:u.size&&(x.size=u.size);break;default:x=typeof u.is=="string"?C.createElement(p,{is:u.is}):C.createElement(p)}}x[jt]=a,x[Ut]=u;e:for(C=a.child;C!==null;){if(C.tag===5||C.tag===6)x.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===a)break e;for(;C.sibling===null;){if(C.return===null||C.return===a)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}a.stateNode=x;e:switch(Bt(x,p,u),p){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Ts(a)}}return at(a),nm(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,o),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==u&&Ts(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(r(166));if(n=ce.current,Ni(a)){if(n=a.stateNode,o=a.memoizedProps,u=null,p=zt,p!==null)switch(p.tag){case 27:case 5:u=p.memoizedProps}n[jt]=a,n=!!(n.nodeValue===o||u!==null&&u.suppressHydrationWarning===!0||Nv(n.nodeValue,o)),n||oa(a,!0)}else n=Ou(n).createTextNode(u),n[jt]=a,a.stateNode=n}return at(a),null;case 31:if(o=a.memoizedState,n===null||n.memoizedState!==null){if(u=Ni(a),o!==null){if(n===null){if(!u)throw Error(r(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(r(557));n[jt]=a}else mr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;at(a),n=!1}else o=fh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=o),n=!0;if(!n)return a.flags&256?(yn(a),a):(yn(a),null);if((a.flags&128)!==0)throw Error(r(558))}return at(a),null;case 13:if(u=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(p=Ni(a),u!==null&&u.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[jt]=a}else mr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;at(a),p=!1}else p=fh(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=p),p=!0;if(!p)return a.flags&256?(yn(a),a):(yn(a),null)}return yn(a),(a.flags&128)!==0?(a.lanes=o,a):(o=u!==null,n=n!==null&&n.memoizedState!==null,o&&(u=a.child,p=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(p=u.alternate.memoizedState.cachePool.pool),x=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(x=u.memoizedState.cachePool.pool),x!==p&&(u.flags|=2048)),o!==n&&o&&(a.child.flags|=8192),yu(a,a.updateQueue),at(a),null);case 4:return fe(),n===null&&jm(a.stateNode.containerInfo),at(a),null;case 10:return Es(a.type),at(a),null;case 19:if(G(gt),u=a.memoizedState,u===null)return at(a),null;if(p=(a.flags&128)!==0,x=u.rendering,x===null)if(p)nl(u,!1);else{if(ht!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(x=ru(n),x!==null){for(a.flags|=128,nl(u,!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 J(gt,gt.current&1|2),$e&&Ns(a,u.treeForkCount),a.child}n=n.sibling}u.tail!==null&&Ae()>Nu&&(a.flags|=128,p=!0,nl(u,!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(u,!0),u.tail===null&&u.tailMode==="hidden"&&!x.alternate&&!$e)return at(a),null}else 2*Ae()-u.renderingStartTime>Nu&&o!==536870912&&(a.flags|=128,p=!0,nl(u,!1),a.lanes=4194304);u.isBackwards?(x.sibling=a.child,a.child=x):(n=u.last,n!==null?n.sibling=x:a.child=x,u.last=x)}return u.tail!==null?(n=u.tail,u.rendering=n,u.tail=n.sibling,u.renderingStartTime=Ae(),n.sibling=null,o=gt.current,J(gt,p?o&1|2:o&1),$e&&Ns(a,u.treeForkCount),n):(at(a),null);case 22:case 23:return yn(a),Eh(),u=a.memoizedState!==null,n!==null?n.memoizedState!==null!==u&&(a.flags|=8192):u&&(a.flags|=8192),u?(o&536870912)!==0&&(a.flags&128)===0&&(at(a),a.subtreeFlags&6&&(a.flags|=8192)):at(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),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==o&&(a.flags|=2048),n!==null&&G(xr),null;case 24:return o=null,n!==null&&(o=n.memoizedState.cache),a.memoizedState.cache!==o&&(a.flags|=2048),Es(vt),at(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function G2(n,a){switch(uh(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Es(vt),fe(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return be(a),null;case 31:if(a.memoizedState!==null){if(yn(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(yn(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 G(gt),null;case 4:return fe(),null;case 10:return Es(a.type),null;case 22:case 23:return yn(a),Eh(),n!==null&&G(xr),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Es(vt),null;case 25:return null;default:return null}}function Ry(n,a){switch(uh(a),a.tag){case 3:Es(vt),fe();break;case 26:case 27:case 5:be(a);break;case 4:fe();break;case 31:a.memoizedState!==null&&yn(a);break;case 13:yn(a);break;case 19:G(gt);break;case 10:Es(a.type);break;case 22:case 23:yn(a),Eh(),n!==null&&G(xr);break;case 24:Es(vt)}}function sl(n,a){try{var o=a.updateQueue,u=o!==null?o.lastEffect:null;if(u!==null){var p=u.next;o=p;do{if((o.tag&n)===n){u=void 0;var x=o.create,C=o.inst;u=x(),C.destroy=u}o=o.next}while(o!==p)}}catch(O){Ze(a,a.return,O)}}function ma(n,a,o){try{var u=a.updateQueue,p=u!==null?u.lastEffect:null;if(p!==null){var x=p.next;u=x;do{if((u.tag&n)===n){var C=u.inst,O=C.destroy;if(O!==void 0){C.destroy=void 0,p=a;var K=o,te=O;try{te()}catch(re){Ze(p,K,re)}}}u=u.next}while(u!==x)}}catch(re){Ze(a,a.return,re)}}function Ty(n){var a=n.updateQueue;if(a!==null){var o=n.stateNode;try{vx(a,o)}catch(u){Ze(n,n.return,u)}}}function Ay(n,a,o){o.props=wr(n.type,n.memoizedProps),o.state=n.memoizedState;try{o.componentWillUnmount()}catch(u){Ze(n,a,u)}}function al(n,a){try{var o=n.ref;if(o!==null){switch(n.tag){case 26:case 27:case 5:var u=n.stateNode;break;case 30:u=n.stateNode;break;default:u=n.stateNode}typeof o=="function"?n.refCleanup=o(u):o.current=u}}catch(p){Ze(n,a,p)}}function ss(n,a){var o=n.ref,u=n.refCleanup;if(o!==null)if(typeof u=="function")try{u()}catch(p){Ze(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){Ze(n,a,p)}else o.current=null}function My(n){var a=n.type,o=n.memoizedProps,u=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":o.autoFocus&&u.focus();break e;case"img":o.src?u.src=o.src:o.srcSet&&(u.srcset=o.srcSet)}}catch(p){Ze(n,n.return,p)}}function sm(n,a,o){try{var u=n.stateNode;hC(u,n.type,o,a),u[Ut]=a}catch(p){Ze(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 am(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 rm(n,a,o){var u=n.tag;if(u===5||u===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(u!==4&&(u===27&&Sa(n.type)&&(o=n.stateNode,a=null),n=n.child,n!==null))for(rm(n,a,o),n=n.sibling;n!==null;)rm(n,a,o),n=n.sibling}function vu(n,a,o){var u=n.tag;if(u===5||u===6)n=n.stateNode,a?o.insertBefore(n,a):o.appendChild(n);else if(u!==4&&(u===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 u=n.type,p=a.attributes;p.length;)a.removeAttributeNode(p[0]);Bt(a,u,o),a[jt]=n,a[Ut]=o}catch(x){Ze(n,n.return,x)}}var As=!1,wt=!1,im=!1,Dy=typeof WeakSet=="function"?WeakSet:Set,At=null;function Y2(n,a){if(n=n.containerInfo,_m=Hu,n=Y0(n),Jf(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var u=o.getSelection&&o.getSelection();if(u&&u.rangeCount!==0){o=u.anchorNode;var p=u.anchorOffset,x=u.focusNode;u=u.focusOffset;try{o.nodeType,x.nodeType}catch{o=null;break e}var C=0,O=-1,K=-1,te=0,re=0,le=n,ne=null;t:for(;;){for(var ae;le!==o||p!==0&&le.nodeType!==3||(O=C+p),le!==x||u!==0&&le.nodeType!==3||(K=C+u),le.nodeType===3&&(C+=le.nodeValue.length),(ae=le.firstChild)!==null;)ne=le,le=ae;for(;;){if(le===n)break t;if(ne===o&&++te===p&&(O=C),ne===x&&++re===u&&(K=C),(ae=le.nextSibling)!==null)break;le=ne,ne=le.parentNode}le=ae}o=O===-1||K===-1?null:{start:O,end:K}}else o=null}o=o||{start:0,end:0}}else o=null;for(Rm={focusedElem:n,selectionRange:o},Hu=!1,At=a;At!==null;)if(a=At,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,At=n;else for(;At!==null;){switch(a=At,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,u=o.stateNode;try{var pe=wr(o.type,p);n=u.getSnapshotBeforeUpdate(pe,x),u.__reactInternalSnapshotBeforeUpdate=n}catch(_e){Ze(o,o.return,_e)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,o=n.nodeType,o===9)Mm(n);else if(o===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Mm(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,At=n;break}At=a.return}}function Ly(n,a,o){var u=o.flags;switch(o.tag){case 0:case 11:case 15:ks(n,o),u&4&&sl(5,o);break;case 1:if(ks(n,o),u&4)if(n=o.stateNode,a===null)try{n.componentDidMount()}catch(C){Ze(o,o.return,C)}else{var p=wr(o.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(p,a,n.__reactInternalSnapshotBeforeUpdate)}catch(C){Ze(o,o.return,C)}}u&64&&Ty(o),u&512&&al(o,o.return);break;case 3:if(ks(n,o),u&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(C){Ze(o,o.return,C)}}break;case 27:a===null&&u&4&&Oy(o);case 26:case 5:ks(n,o),a===null&&u&4&&My(o),u&512&&al(o,o.return);break;case 12:ks(n,o);break;case 31:ks(n,o),u&4&&Iy(n,o);break;case 13:ks(n,o),u&4&&By(n,o),u&64&&(n=o.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(o=tC.bind(null,o),SC(n,o))));break;case 22:if(u=o.memoizedState!==null||As,!u){a=a!==null&&a.memoizedState!==null||wt,p=As;var x=wt;As=u,(wt=a)&&!x?Os(n,o,(o.subtreeFlags&8772)!==0):ks(n,o),As=p,wt=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 it=null,nn=!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(Vt&&typeof Vt.onCommitFiberUnmount=="function")try{Vt.onCommitFiberUnmount(sr,o)}catch{}switch(o.tag){case 26:wt||ss(o,a),Ms(n,a,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:wt||ss(o,a);var u=it,p=nn;Sa(o.type)&&(it=o.stateNode,nn=!1),Ms(n,a,o),hl(o.stateNode),it=u,nn=p;break;case 5:wt||ss(o,a);case 6:if(u=it,p=nn,it=null,Ms(n,a,o),it=u,nn=p,it!==null)if(nn)try{(it.nodeType===9?it.body:it.nodeName==="HTML"?it.ownerDocument.body:it).removeChild(o.stateNode)}catch(x){Ze(o,a,x)}else try{it.removeChild(o.stateNode)}catch(x){Ze(o,a,x)}break;case 18:it!==null&&(nn?(n=it,Tv(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,o.stateNode),Vi(n)):Tv(it,o.stateNode));break;case 4:u=it,p=nn,it=o.stateNode.containerInfo,nn=!0,Ms(n,a,o),it=u,nn=p;break;case 0:case 11:case 14:case 15:ma(2,o,a),wt||ma(4,o,a),Ms(n,a,o);break;case 1:wt||(ss(o,a),u=o.stateNode,typeof u.componentWillUnmount=="function"&&Ay(o,a,u)),Ms(n,a,o);break;case 21:Ms(n,a,o);break;case 22:wt=(u=wt)||o.memoizedState!==null,Ms(n,a,o),wt=u;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){Ze(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){Ze(a,a.return,o)}}function Q2(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=Q2(n);a.forEach(function(u){if(!o.has(u)){o.add(u);var p=nC.bind(null,n,u);u.then(p,p)}})}function sn(n,a){var o=a.deletions;if(o!==null)for(var u=0;u<o.length;u++){var p=o[u],x=n,C=a,O=C;e:for(;O!==null;){switch(O.tag){case 27:if(Sa(O.type)){it=O.stateNode,nn=!1;break e}break;case 5:it=O.stateNode,nn=!1;break e;case 3:case 4:it=O.stateNode.containerInfo,nn=!0;break e}O=O.return}if(it===null)throw Error(r(160));Py(x,C,p),it=null,nn=!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 Bn=null;function Hy(n,a){var o=n.alternate,u=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:sn(a,n),an(n),u&4&&(ma(3,n,n.return),sl(3,n),ma(5,n,n.return));break;case 1:sn(a,n),an(n),u&512&&(wt||o===null||ss(o,o.return)),u&64&&As&&(n=n.updateQueue,n!==null&&(u=n.callbacks,u!==null&&(o=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=o===null?u:o.concat(u))));break;case 26:var p=Bn;if(sn(a,n),an(n),u&512&&(wt||o===null||ss(o,o.return)),u&4){var x=o!==null?o.memoizedState:null;if(u=n.memoizedState,o===null)if(u===null)if(n.stateNode===null){e:{u=n.type,o=n.memoizedProps,p=p.ownerDocument||p;t:switch(u){case"title":x=p.getElementsByTagName("title")[0],(!x||x[ir]||x[jt]||x.namespaceURI==="http://www.w3.org/2000/svg"||x.hasAttribute("itemprop"))&&(x=p.createElement(u),p.head.insertBefore(x,p.querySelector("head > title"))),Bt(x,u,o),x[jt]=n,yt(x),u=x;break e;case"link":var C=Hv("link","href",p).get(u+(o.href||""));if(C){for(var O=0;O<C.length;O++)if(x=C[O],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)){C.splice(O,1);break t}}x=p.createElement(u),Bt(x,u,o),p.head.appendChild(x);break;case"meta":if(C=Hv("meta","content",p).get(u+(o.content||""))){for(O=0;O<C.length;O++)if(x=C[O],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)){C.splice(O,1);break t}}x=p.createElement(u),Bt(x,u,o),p.head.appendChild(x);break;default:throw Error(r(468,u))}x[jt]=n,yt(x),u=x}n.stateNode=u}else Uv(p,n.type,n.stateNode);else n.stateNode=Bv(p,u,n.memoizedProps);else x!==u?(x===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):x.count--,u===null?Uv(p,n.type,n.stateNode):Bv(p,u,n.memoizedProps)):u===null&&n.stateNode!==null&&sm(n,n.memoizedProps,o.memoizedProps)}break;case 27:sn(a,n),an(n),u&512&&(wt||o===null||ss(o,o.return)),o!==null&&u&4&&sm(n,n.memoizedProps,o.memoizedProps);break;case 5:if(sn(a,n),an(n),u&512&&(wt||o===null||ss(o,o.return)),n.flags&32){p=n.stateNode;try{hi(p,"")}catch(pe){Ze(n,n.return,pe)}}u&4&&n.stateNode!=null&&(p=n.memoizedProps,sm(n,p,o!==null?o.memoizedProps:p)),u&1024&&(im=!0);break;case 6:if(sn(a,n),an(n),u&4){if(n.stateNode===null)throw Error(r(162));u=n.memoizedProps,o=n.stateNode;try{o.nodeValue=u}catch(pe){Ze(n,n.return,pe)}}break;case 3:if(zu=null,p=Bn,Bn=Du(a.containerInfo),sn(a,n),Bn=p,an(n),u&4&&o!==null&&o.memoizedState.isDehydrated)try{Vi(a.containerInfo)}catch(pe){Ze(n,n.return,pe)}im&&(im=!1,Uy(n));break;case 4:u=Bn,Bn=Du(n.stateNode.containerInfo),sn(a,n),an(n),Bn=u;break;case 12:sn(a,n),an(n);break;case 31:sn(a,n),an(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,bu(n,u)));break;case 13:sn(a,n),an(n),n.child.flags&8192&&n.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(wu=Ae()),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,bu(n,u)));break;case 22:p=n.memoizedState!==null;var K=o!==null&&o.memoizedState!==null,te=As,re=wt;if(As=te||p,wt=re||K,sn(a,n),wt=re,As=te,an(n),u&8192)e:for(a=n.stateNode,a._visibility=p?a._visibility&-2:a._visibility|1,p&&(o===null||K||As||wt||Nr(n)),o=null,a=n;;){if(a.tag===5||a.tag===26){if(o===null){K=o=a;try{if(x=K.stateNode,p)C=x.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{O=K.stateNode;var le=K.memoizedProps.style,ne=le!=null&&le.hasOwnProperty("display")?le.display:null;O.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(pe){Ze(K,K.return,pe)}}}else if(a.tag===6){if(o===null){K=a;try{K.stateNode.nodeValue=p?"":K.memoizedProps}catch(pe){Ze(K,K.return,pe)}}}else if(a.tag===18){if(o===null){K=a;try{var ae=K.stateNode;p?Av(ae,!0):Av(K.stateNode,!1)}catch(pe){Ze(K,K.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}u&4&&(u=n.updateQueue,u!==null&&(o=u.retryQueue,o!==null&&(u.retryQueue=null,bu(n,o))));break;case 19:sn(a,n),an(n),u&4&&(u=n.updateQueue,u!==null&&(n.updateQueue=null,bu(n,u)));break;case 30:break;case 21:break;default:sn(a,n),an(n)}}function an(n){var a=n.flags;if(a&2){try{for(var o,u=n.return;u!==null;){if(ky(u)){o=u;break}u=u.return}if(o==null)throw Error(r(160));switch(o.tag){case 27:var p=o.stateNode,x=am(n);vu(n,x,p);break;case 5:var C=o.stateNode;o.flags&32&&(hi(C,""),o.flags&=-33);var O=am(n);vu(n,O,C);break;case 3:case 4:var K=o.stateNode.containerInfo,te=am(n);rm(n,te,K);break;default:throw Error(r(161))}}catch(re){Ze(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:ss(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:ss(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 u=a.alternate,p=n,x=a,C=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),u=x,p=u.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(te){Ze(u,u.return,te)}if(u=x,p=u.updateQueue,p!==null){var O=u.stateNode;try{var K=p.shared.hiddenCallbacks;if(K!==null)for(p.shared.hiddenCallbacks=null,p=0;p<K.length;p++)yx(K[p],O)}catch(te){Ze(u,u.return,te)}}o&&C&64&&Ty(x),al(x,x.return);break;case 27:Oy(x);case 26:case 5:Os(p,x,o),o&&u===null&&C&4&&My(x),al(x,x.return);break;case 12:Os(p,x,o);break;case 31:Os(p,x,o),o&&C&4&&Iy(p,x);break;case 13:Os(p,x,o),o&&C&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 om(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 lm(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 Hn(n,a,o,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)$y(n,a,o,u),a=a.sibling}function $y(n,a,o,u){var p=a.flags;switch(a.tag){case 0:case 11:case 15:Hn(n,a,o,u),p&2048&&sl(9,a);break;case 1:Hn(n,a,o,u);break;case 3:Hn(n,a,o,u),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){Hn(n,a,o,u),n=a.stateNode;try{var x=a.memoizedProps,C=x.id,O=x.onPostCommit;typeof O=="function"&&O(C,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(K){Ze(a,a.return,K)}}else Hn(n,a,o,u);break;case 31:Hn(n,a,o,u);break;case 13:Hn(n,a,o,u);break;case 23:break;case 22:x=a.stateNode,C=a.alternate,a.memoizedState!==null?x._visibility&2?Hn(n,a,o,u):rl(n,a):x._visibility&2?Hn(n,a,o,u):(x._visibility|=2,Oi(n,a,o,u,(a.subtreeFlags&10256)!==0||!1)),p&2048&&om(C,a);break;case 24:Hn(n,a,o,u),p&2048&&lm(a.alternate,a);break;default:Hn(n,a,o,u)}}function Oi(n,a,o,u,p){for(p=p&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var x=n,C=a,O=o,K=u,te=C.flags;switch(C.tag){case 0:case 11:case 15:Oi(x,C,O,K,p),sl(8,C);break;case 23:break;case 22:var re=C.stateNode;C.memoizedState!==null?re._visibility&2?Oi(x,C,O,K,p):rl(x,C):(re._visibility|=2,Oi(x,C,O,K,p)),p&&te&2048&&om(C.alternate,C);break;case 24:Oi(x,C,O,K,p),p&&te&2048&&lm(C.alternate,C);break;default:Oi(x,C,O,K,p)}a=a.sibling}}function rl(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var o=n,u=a,p=u.flags;switch(u.tag){case 22:rl(o,u),p&2048&&om(u.alternate,u);break;case 24:rl(o,u),p&2048&&lm(u.alternate,u);break;default:rl(o,u)}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&&OC(o,Bn,n.memoizedState,n.memoizedProps);break;case 5:Di(n,a,o);break;case 3:case 4:var u=Bn;Bn=Du(n.stateNode.containerInfo),Di(n,a,o),Bn=u;break;case 22:n.memoizedState===null&&(u=n.alternate,u!==null&&u.memoizedState!==null?(u=il,il=16777216,Di(n,a,o),il=u):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 u=a[o];At=u,Yy(u,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 u=a[o];At=u,Yy(u,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(;At!==null;){var o=At;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 u=o.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Vo(o.memoizedState.cache)}if(u=o.child,u!==null)u.return=o,At=u;else e:for(o=n;At!==null;){u=At;var p=u.sibling,x=u.return;if(zy(u),u===o){At=null;break e}if(p!==null){p.return=x,At=p;break e}At=x}}}var F2={getCacheForType:function(n){var a=Pt(vt),o=a.data.get(n);return o===void 0&&(o=n(),a.data.set(n,o)),o},cacheSignal:function(){return Pt(vt).controller.signal}},K2=typeof WeakMap=="function"?WeakMap:Map,Fe=0,nt=null,Ie=null,He=0,Xe=0,vn=null,pa=!1,Li=!1,cm=!1,Ds=0,ht=0,ga=0,jr=0,um=0,bn=0,zi=0,ll=null,rn=null,dm=!1,wu=0,Qy=0,Nu=1/0,ju=null,xa=null,Et=0,ya=null,Pi=null,Ls=0,fm=0,hm=null,Fy=null,cl=0,mm=null;function Sn(){return(Fe&2)!==0&&He!==0?He&-He:k.T!==null?bm():Rc()}function Ky(){if(bn===0)if((He&536870912)===0||$e){var n=oi;oi<<=1,(oi&3932160)===0&&(oi=262144),bn=n}else bn=536870912;return n=xn.current,n!==null&&(n.flags|=32),bn}function on(n,a,o){(n===nt&&(Xe===2||Xe===9)||n.cancelPendingCommit!==null)&&(Ii(n,0),va(n,He,bn,!1)),rr(n,o),((Fe&2)===0||n!==nt)&&(n===nt&&((Fe&2)===0&&(jr|=o),ht===4&&va(n,He,bn,!1)),as(n))}function Xy(n,a,o){if((Fe&6)!==0)throw Error(r(327));var u=!o&&(a&127)===0&&(a&n.expiredLanes)===0||ar(n,a),p=u?W2(n,a):gm(n,a,!0),x=u;do{if(p===0){Li&&!u&&va(n,a,0,!1);break}else{if(o=n.current.alternate,x&&!X2(o)){p=gm(n,a,!1),x=!1;continue}if(p===2){if(x=a,n.errorRecoveryDisabledLanes&x)var C=0;else C=n.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){a=C;e:{var O=n;p=ll;var K=O.current.memoizedState.isDehydrated;if(K&&(Ii(O,C).flags|=256),C=gm(O,C,!1),C!==2){if(cm&&!K){O.errorRecoveryDisabledLanes|=x,jr|=x,p=4;break e}x=rn,rn=p,x!==null&&(rn===null?rn=x:rn.push.apply(rn,x))}p=C}if(x=!1,p!==2)continue}}if(p===1){Ii(n,0),va(n,a,0,!0);break}e:{switch(u=n,x=p,x){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:va(u,a,bn,!pa);break e;case 2:rn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(p=wu+300-Ae(),10<p)){if(va(u,a,bn,!pa),ci(u,0,!0)!==0)break e;Ls=a,u.timeoutHandle=_v(Zy.bind(null,u,o,rn,ju,dm,a,bn,jr,zi,pa,x,"Throttled",-0,0),p);break e}Zy(u,o,rn,ju,dm,a,bn,jr,zi,pa,x,null,-0,0)}}break}while(!0);as(n)}function Zy(n,a,o,u,p,x,C,O,K,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-Ae():(x&4194048)===x?Qy-Ae():0;if(pe=DC(le,pe),pe!==null){Ls=x,n.cancelPendingCommit=pe(rv.bind(null,n,a,x,o,u,p,C,O,K,re,le,null,ne,ae)),va(n,x,C,!te);return}}rv(n,a,x,o,u,p,C,O,K)}function X2(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 u=0;u<o.length;u++){var p=o[u],x=p.getSnapshot;p=p.value;try{if(!pn(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,u){a&=~um,a&=~jr,n.suspendedLanes|=a,n.pingedLanes&=~a,u&&(n.warmLanes|=a),u=n.expirationTimes;for(var p=a;0<p;){var x=31-Gt(p),C=1<<x;u[x]=-1,p&=~C}o!==0&&Ec(n,o,a)}function Eu(){return(Fe&6)===0?(ul(0),!1):!0}function pm(){if(Ie!==null){if(Xe===0)var n=Ie.return;else n=Ie,js=pr=null,Mh(n),Ri=null,Yo=0,n=Ie;for(;n!==null;)Ry(n.alternate,n),n=n.return;Ie=null}}function Ii(n,a){var o=n.timeoutHandle;o!==-1&&(n.timeoutHandle=-1,gC(o)),o=n.cancelPendingCommit,o!==null&&(n.cancelPendingCommit=null,o()),Ls=0,pm(),nt=n,Ie=o=ws(n.current,null),He=a,Xe=0,vn=null,pa=!1,Li=ar(n,a),cm=!1,zi=bn=um=jr=ga=ht=0,rn=ll=null,dm=!1,(a&8)!==0&&(a|=a&32);var u=n.entangledLanes;if(u!==0)for(n=n.entanglements,u&=a;0<u;){var p=31-Gt(u),x=1<<p;a|=n[p],u&=~x}return Ds=a,Yc(),o}function Wy(n,a){ke=null,k.H=el,a===_i||a===eu?(a=mx(),Xe=3):a===vh?(a=mx(),Xe=4):Xe=a===Qh?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,vn=a,Ie===null&&(ht=1,mu(n,_n(a,n.current)))}function Jy(){var n=xn.current;return n===null?!0:(He&4194048)===He?Mn===null:(He&62914560)===He||(He&536870912)!==0?n===Mn:!1}function ev(){var n=k.H;return k.H=el,n===null?el:n}function tv(){var n=k.A;return k.A=F2,n}function Cu(){ht=4,pa||(He&4194048)!==He&&xn.current!==null||(Li=!0),(ga&134217727)===0&&(jr&134217727)===0||nt===null||va(nt,He,bn,!1)}function gm(n,a,o){var u=Fe;Fe|=2;var p=ev(),x=tv();(nt!==n||He!==a)&&(ju=null,Ii(n,a)),a=!1;var C=ht;e:do try{if(Xe!==0&&Ie!==null){var O=Ie,K=vn;switch(Xe){case 8:pm(),C=6;break e;case 3:case 2:case 9:case 6:xn.current===null&&(a=!0);var te=Xe;if(Xe=0,vn=null,Bi(n,O,K,te),o&&Li){C=0;break e}break;default:te=Xe,Xe=0,vn=null,Bi(n,O,K,te)}}Z2(),C=ht;break}catch(re){Wy(n,re)}while(!0);return a&&n.shellSuspendCounter++,js=pr=null,Fe=u,k.H=p,k.A=x,Ie===null&&(nt=null,He=0,Yc()),C}function Z2(){for(;Ie!==null;)nv(Ie)}function W2(n,a){var o=Fe;Fe|=2;var u=ev(),p=tv();nt!==n||He!==a?(ju=null,Nu=Ae()+500,Ii(n,a)):Li=ar(n,a);e:do try{if(Xe!==0&&Ie!==null){a=Ie;var x=vn;t:switch(Xe){case 1:Xe=0,vn=null,Bi(n,a,x,1);break;case 2:case 9:if(fx(x)){Xe=0,vn=null,sv(a);break}a=function(){Xe!==2&&Xe!==9||nt!==n||(Xe=7),as(n)},x.then(a,a);break e;case 3:Xe=7;break e;case 4:Xe=5;break e;case 7:fx(x)?(Xe=0,vn=null,sv(a)):(Xe=0,vn=null,Bi(n,a,x,7));break;case 5:var C=null;switch(Ie.tag){case 26:C=Ie.memoizedState;case 5:case 27:var O=Ie;if(C?$v(C):O.stateNode.complete){Xe=0,vn=null;var K=O.sibling;if(K!==null)Ie=K;else{var te=O.return;te!==null?(Ie=te,_u(te)):Ie=null}break t}}Xe=0,vn=null,Bi(n,a,x,5);break;case 6:Xe=0,vn=null,Bi(n,a,x,6);break;case 8:pm(),ht=6;break e;default:throw Error(r(462))}}J2();break}catch(re){Wy(n,re)}while(!0);return js=pr=null,k.H=u,k.A=p,Fe=o,Ie!==null?0:(nt=null,He=0,Yc(),ht)}function J2(){for(;Ie!==null&&!mn();)nv(Ie)}function nv(n){var a=Cy(n.alternate,n,Ds);n.memoizedProps=n.pendingProps,a===null?_u(n):Ie=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:Mh(a);default:Ry(o,a),a=Ie=tx(a,Ds),a=Cy(o,a,Ds)}n.memoizedProps=n.pendingProps,a===null?_u(n):Ie=a}function Bi(n,a,o,u){js=pr=null,Mh(a),Ri=null,Yo=0;var p=a.return;try{if(U2(n,p,a,o,He)){ht=1,mu(n,_n(o,n.current)),Ie=null;return}}catch(x){if(p!==null)throw Ie=p,x;ht=1,mu(n,_n(o,n.current)),Ie=null;return}a.flags&32768?($e||u===1?n=!0:Li||(He&536870912)!==0?n=!1:(pa=n=!0,(u===2||u===9||u===3||u===6)&&(u=xn.current,u!==null&&u.tag===13&&(u.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=V2(a.alternate,a,Ds);if(o!==null){Ie=o;return}if(a=a.sibling,a!==null){Ie=a;return}Ie=a=n}while(a!==null);ht===0&&(ht=5)}function av(n,a){do{var o=G2(n.alternate,n);if(o!==null){o.flags&=32767,Ie=o;return}if(o=n.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!a&&(n=n.sibling,n!==null)){Ie=n;return}Ie=n=o}while(n!==null);ht=6,Ie=null}function rv(n,a,o,u,p,x,C,O,K){n.cancelPendingCommit=null;do Ru();while(Et!==0);if((Fe&6)!==0)throw Error(r(327));if(a!==null){if(a===n.current)throw Error(r(177));if(x=a.lanes|a.childLanes,x|=ah,Df(n,o,x,C,O,K),n===nt&&(Ie=nt=null,He=0),Pi=a,ya=n,Ls=o,fm=x,hm=p,Fy=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,sC(nr,function(){return uv(),null})):(n.callbackNode=null,n.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=k.T,k.T=null,p=U.p,U.p=2,C=Fe,Fe|=4;try{Y2(n,a,o)}finally{Fe=C,U.p=p,k.T=u}}Et=1,iv(),ov(),lv()}}function iv(){if(Et===1){Et=0;var n=ya,a=Pi,o=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||o){o=k.T,k.T=null;var u=U.p;U.p=2;var p=Fe;Fe|=4;try{Hy(a,n);var x=Rm,C=Y0(n.containerInfo),O=x.focusedElem,K=x.selectionRange;if(C!==O&&O&&O.ownerDocument&&G0(O.ownerDocument.documentElement,O)){if(K!==null&&Jf(O)){var te=K.start,re=K.end;if(re===void 0&&(re=te),"selectionStart"in O)O.selectionStart=te,O.selectionEnd=Math.min(re,O.value.length);else{var le=O.ownerDocument||document,ne=le&&le.defaultView||window;if(ne.getSelection){var ae=ne.getSelection(),pe=O.textContent.length,_e=Math.min(K.start,pe),et=K.end===void 0?_e:Math.min(K.end,pe);!ae.extend&&_e>et&&(C=et,et=_e,_e=C);var W=V0(O,_e),Z=V0(O,et);if(W&&Z&&(ae.rangeCount!==1||ae.anchorNode!==W.node||ae.anchorOffset!==W.offset||ae.focusNode!==Z.node||ae.focusOffset!==Z.offset)){var ee=le.createRange();ee.setStart(W.node,W.offset),ae.removeAllRanges(),_e>et?(ae.addRange(ee),ae.extend(Z.node,Z.offset)):(ee.setEnd(Z.node,Z.offset),ae.addRange(ee))}}}}for(le=[],ae=O;ae=ae.parentNode;)ae.nodeType===1&&le.push({element:ae,left:ae.scrollLeft,top:ae.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<le.length;O++){var ie=le[O];ie.element.scrollLeft=ie.left,ie.element.scrollTop=ie.top}}Hu=!!_m,Rm=_m=null}finally{Fe=p,U.p=u,k.T=o}}n.current=a,Et=2}}function ov(){if(Et===2){Et=0;var n=ya,a=Pi,o=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||o){o=k.T,k.T=null;var u=U.p;U.p=2;var p=Fe;Fe|=4;try{Ly(n,a.alternate,a)}finally{Fe=p,U.p=u,k.T=o}}Et=3}}function lv(){if(Et===4||Et===3){Et=0,Zn();var n=ya,a=Pi,o=Ls,u=Fy;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Et=5:(Et=0,Pi=ya=null,cv(n,n.pendingLanes));var p=n.pendingLanes;if(p===0&&(xa=null),To(o),a=a.stateNode,Vt&&typeof Vt.onCommitFiberRoot=="function")try{Vt.onCommitFiberRoot(sr,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=k.T,p=U.p,U.p=2,k.T=null;try{for(var x=n.onRecoverableError,C=0;C<u.length;C++){var O=u[C];x(O.value,{componentStack:O.stack})}}finally{k.T=a,U.p=p}}(Ls&3)!==0&&Ru(),as(n),p=n.pendingLanes,(o&261930)!==0&&(p&42)!==0?n===mm?cl++:(cl=0,mm=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(Et!==5)return!1;var n=ya,a=fm;fm=0;var o=To(Ls),u=k.T,p=U.p;try{U.p=32>o?32:o,k.T=null,o=hm,hm=null;var x=ya,C=Ls;if(Et=0,Pi=ya=null,Ls=0,(Fe&6)!==0)throw Error(r(331));var O=Fe;if(Fe|=4,Gy(x.current),$y(x,x.current,C,o),Fe=O,ul(0,!1),Vt&&typeof Vt.onPostCommitFiberRoot=="function")try{Vt.onPostCommitFiberRoot(sr,x)}catch{}return!0}finally{U.p=p,k.T=u,cv(n,a)}}function dv(n,a,o){a=_n(o,a),a=Yh(n.stateNode,a,2),n=da(n,a,2),n!==null&&(rr(n,2),as(n))}function Ze(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 u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(xa===null||!xa.has(u))){n=_n(o,n),o=fy(2),u=da(a,o,2),u!==null&&(hy(o,u,a,n),rr(u,2),as(u));break}}a=a.return}}function xm(n,a,o){var u=n.pingCache;if(u===null){u=n.pingCache=new K2;var p=new Set;u.set(a,p)}else p=u.get(a),p===void 0&&(p=new Set,u.set(a,p));p.has(o)||(cm=!0,p.add(o),n=eC.bind(null,n,a,o),a.then(n,n))}function eC(n,a,o){var u=n.pingCache;u!==null&&u.delete(a),n.pingedLanes|=n.suspendedLanes&o,n.warmLanes&=~o,nt===n&&(He&o)===o&&(ht===4||ht===3&&(He&62914560)===He&&300>Ae()-wu?(Fe&2)===0&&Ii(n,0):um|=o,zi===He&&(zi=0)),as(n)}function fv(n,a){a===0&&(a=jc()),n=fr(n,a),n!==null&&(rr(n,a),as(n))}function tC(n){var a=n.memoizedState,o=0;a!==null&&(o=a.retryLane),fv(n,o)}function nC(n,a){var o=0;switch(n.tag){case 31:case 13:var u=n.stateNode,p=n.memoizedState;p!==null&&(o=p.retryLane);break;case 19:u=n.stateNode;break;case 22:u=n.stateNode._retryCache;break;default:throw Error(r(314))}u!==null&&u.delete(a),fv(n,o)}function sC(n,a){return rt(n,a)}var Tu=null,Hi=null,ym=!1,Au=!1,vm=!1,ba=0;function as(n){n!==Hi&&n.next===null&&(Hi===null?Tu=Hi=n:Hi=Hi.next=n),Au=!0,ym||(ym=!0,rC())}function ul(n,a){if(!vm&&Au){vm=!0;do for(var o=!1,u=Tu;u!==null;){if(n!==0){var p=u.pendingLanes;if(p===0)var x=0;else{var C=u.suspendedLanes,O=u.pingedLanes;x=(1<<31-Gt(42|n)+1)-1,x&=p&~(C&~O),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(o=!0,gv(u,x))}else x=He,x=ci(u,u===nt?x:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(x&3)===0||ar(u,x)||(o=!0,gv(u,x));u=u.next}while(o);vm=!1}}function aC(){hv()}function hv(){Au=ym=!1;var n=0;ba!==0&&pC()&&(n=ba);for(var a=Ae(),o=null,u=Tu;u!==null;){var p=u.next,x=mv(u,a);x===0?(u.next=null,o===null?Tu=p:o.next=p,p===null&&(Hi=o)):(o=u,(n!==0||(x&3)!==0)&&(Au=!0)),u=p}Et!==0&&Et!==5||ul(n),ba!==0&&(ba=0)}function mv(n,a){for(var o=n.suspendedLanes,u=n.pingedLanes,p=n.expirationTimes,x=n.pendingLanes&-62914561;0<x;){var C=31-Gt(x),O=1<<C,K=p[C];K===-1?((O&o)===0||(O&u)!==0)&&(p[C]=Of(O,a)):K<=a&&(n.expiredLanes|=O),x&=~O}if(a=nt,o=He,o=ci(n,n===a?o:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u=n.callbackNode,o===0||n===a&&(Xe===2||Xe===9)||n.cancelPendingCommit!==null)return u!==null&&u!==null&&dt(u),n.callbackNode=null,n.callbackPriority=0;if((o&3)===0||ar(n,o)){if(a=o&-o,a===n.callbackPriority)return a;switch(u!==null&&dt(u),To(o)){case 2:case 8:o=Wn;break;case 32:o=nr;break;case 268435456:o=ri;break;default:o=nr}return u=pv.bind(null,n),o=rt(o,u),n.callbackPriority=a,n.callbackNode=o,a}return u!==null&&u!==null&&dt(u),n.callbackPriority=2,n.callbackNode=null,2}function pv(n,a){if(Et!==0&&Et!==5)return n.callbackNode=null,n.callbackPriority=0,null;var o=n.callbackNode;if(Ru()&&n.callbackNode!==o)return null;var u=He;return u=ci(n,n===nt?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),u===0?null:(Xy(n,u,a),mv(n,Ae()),n.callbackNode!=null&&n.callbackNode===o?pv.bind(null,n):null)}function gv(n,a){if(Ru())return null;Xy(n,a,!0)}function rC(){xC(function(){(Fe&6)!==0?rt(Lt,aC):hv()})}function bm(){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 iC(n,a,o,u,p){if(a==="submit"&&o&&o.stateNode===p){var x=xv((p[Ut]||null).action),C=u.submitter;C&&(a=(a=C[Ut]||null)?xv(a.formAction):C.getAttribute("formAction"),a!==null&&(x=a,C=null));var O=new $c("action","action",null,u,p);n.push({event:O,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(ba!==0){var K=C?yv(p,C):new FormData(p);Hh(o,{pending:!0,data:K,method:p.method,action:x},null,K)}}else typeof x=="function"&&(O.preventDefault(),K=C?yv(p,C):new FormData(p),Hh(o,{pending:!0,data:K,method:p.method,action:x},x,K))},currentTarget:p}]})}}for(var Sm=0;Sm<sh.length;Sm++){var wm=sh[Sm],oC=wm.toLowerCase(),lC=wm[0].toUpperCase()+wm.slice(1);In(oC,"on"+lC)}In(K0,"onAnimationEnd"),In(X0,"onAnimationIteration"),In(Z0,"onAnimationStart"),In("dblclick","onDoubleClick"),In("focusin","onFocus"),In("focusout","onBlur"),In(j2,"onTransitionRun"),In(E2,"onTransitionStart"),In(C2,"onTransitionCancel"),In(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(" "),cC=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 u=n[o],p=u.event;u=u.listeners;e:{var x=void 0;if(a)for(var C=u.length-1;0<=C;C--){var O=u[C],K=O.instance,te=O.currentTarget;if(O=O.listener,K!==x&&p.isPropagationStopped())break e;x=O,p.currentTarget=te;try{x(p)}catch(re){Gc(re)}p.currentTarget=null,x=K}else for(C=0;C<u.length;C++){if(O=u[C],K=O.instance,te=O.currentTarget,O=O.listener,K!==x&&p.isPropagationStopped())break e;x=O,p.currentTarget=te;try{x(p)}catch(re){Gc(re)}p.currentTarget=null,x=K}}}}function Be(n,a){var o=a[ui];o===void 0&&(o=a[ui]=new Set);var u=n+"__bubble";o.has(u)||(bv(a,n,2,!1),o.add(u))}function Nm(n,a,o){var u=0;a&&(u|=4),bv(o,n,u,a)}var Mu="_reactListening"+Math.random().toString(36).slice(2);function jm(n){if(!n[Mu]){n[Mu]=!0,kc.forEach(function(o){o!=="selectionchange"&&(cC.has(o)||Nm(o,!1,n),Nm(o,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Mu]||(a[Mu]=!0,Nm("selectionchange",!1,a))}}function bv(n,a,o,u){switch(Kv(a)){case 2:var p=PC;break;case 8:p=IC;break;default:p=Bm}o=p.bind(null,a,o,n),p=void 0,!Vf||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(p=!0),u?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 Em(n,a,o,u,p){var x=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var C=u.tag;if(C===3||C===4){var O=u.stateNode.containerInfo;if(O===p)break;if(C===4)for(C=u.return;C!==null;){var K=C.tag;if((K===3||K===4)&&C.stateNode.containerInfo===p)return;C=C.return}for(;O!==null;){if(C=Ws(O),C===null)return;if(K=C.tag,K===5||K===6||K===26||K===27){u=x=C;continue e}O=O.parentNode}}u=u.return}E0(function(){var te=x,re=$f(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=n2;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=VE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ae=r2;break;case K0:case X0:case Z0:ae=QE;break;case W0:ae=o2;break;case"scroll":case"scrollend":ae=$E;break;case"wheel":ae=c2;break;case"copy":case"cut":case"paste":ae=KE;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=d2}var _e=(a&4)!==0,et=!_e&&(n==="scroll"||n==="scrollend"),W=_e?ne!==null?ne+"Capture":null:ne;_e=[];for(var Z=te,ee;Z!==null;){var ie=Z;if(ee=ie.stateNode,ie=ie.tag,ie!==5&&ie!==26&&ie!==27||ee===null||W===null||(ie=Oo(Z,W),ie!=null&&_e.push(fl(Z,ie,ee))),et)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!==Uf&&(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&&(et=l(pe),_e=pe.tag,pe!==et||_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"),et=ae==null?ne:ea(ae),ee=pe==null?ne:ea(pe),ne=new _e(ie,Z+"leave",ae,o,re),ne.target=et,ne.relatedTarget=ee,ie=null,Ws(re)===te&&(_e=new _e(W,Z+"enter",pe,o,re),_e.target=ee,_e.relatedTarget=et,ie=_e),et=ie,ae&&pe)t:{for(_e=uC,W=ae,Z=pe,ee=0,ie=W;ie;ie=_e(ie))ee++;ie=0;for(var Ee=Z;Ee;Ee=_e(Ee))ie++;for(;0<ee-ie;)W=_e(W),ee--;for(;0<ie-ee;)Z=_e(Z),ie--;for(;ee--;){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&&et!==null&&Sv(le,et,pe,_e,!0)}}e:{if(ne=te?ea(te):window,ae=ne.nodeName&&ne.nodeName.toLowerCase(),ae==="select"||ae==="input"&&ne.type==="file")var Ye=I0;else if(z0(ne))if(B0)Ye=S2;else{Ye=v2;var Se=y2}else ae=ne.nodeName,!ae||ae.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?te&&Hf(te.elementType)&&(Ye=I0):Ye=b2;if(Ye&&(Ye=Ye(n,te))){P0(le,Ye,o,re);break e}Se&&Se(n,ne,te),n==="focusout"&&te&&ne.type==="number"&&te.memoizedProps.value!=null&&ko(ne,"number",ne.value)}switch(Se=te?ea(te):window,n){case"focusin":(z0(Se)||Se.contentEditable==="true")&&(xi=Se,eh=te,Uo=null);break;case"focusout":Uo=eh=xi=null;break;case"mousedown":th=!0;break;case"contextmenu":case"mouseup":case"dragend":th=!1,Q0(le,o,re);break;case"selectionchange":if(N2)break;case"keydown":case"keyup":Q0(le,o,re)}var De;if(Xf)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,Gf="value"in aa?aa.value:aa.textContent,gi=!0)),Se=ku(te,Ue),0<Se.length&&(Ue=new T0(Ue,n,null,o,re),le.push({event:Ue,listeners:Se}),De?Ue.data=De:(De=L0(o),De!==null&&(Ue.data=De)))),(De=h2?m2(n,o):p2(n,o))&&(Ue=ku(te,"onBeforeInput"),0<Ue.length&&(Se=new T0("onBeforeInput","beforeinput",null,o,re),le.push({event:Se,listeners:Ue}),Se.data=De)),iC(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",u=[];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&&u.unshift(fl(n,p,x)),p=Oo(n,a),p!=null&&u.push(fl(n,p,x))),n.tag===3)return u;n=n.return}return[]}function uC(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,u,p){for(var x=a._reactName,C=[];o!==null&&o!==u;){var O=o,K=O.alternate,te=O.stateNode;if(O=O.tag,K!==null&&K===u)break;O!==5&&O!==26&&O!==27||te===null||(K=te,p?(te=Oo(o,x),te!=null&&C.unshift(fl(o,te,K))):p||(te=Oo(o,x),te!=null&&C.push(fl(o,te,K)))),o=o.return}C.length!==0&&n.push({event:a,listeners:C})}var dC=/\r\n?/g,fC=/\u0000|\uFFFD/g;function wv(n){return(typeof n=="string"?n:""+n).replace(dC,`
|
|
49
|
+
`).replace(fC,"")}function Nv(n,a){return a=wv(a),wv(n)===a}function Je(n,a,o,u,p,x){switch(o){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||hi(n,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&hi(n,""+u);break;case"className":fi(n,"class",u);break;case"tabIndex":fi(n,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":fi(n,o,u);break;case"style":N0(n,u,x);break;case"data":if(a!=="object"){fi(n,"data",u);break}case"src":case"href":if(u===""&&(a!=="a"||o!=="href")){n.removeAttribute(o);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=Ic(""+u),n.setAttribute(o,u);break;case"action":case"formAction":if(typeof u=="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"&&Je(n,a,"name",p.name,p,null),Je(n,a,"formEncType",p.formEncType,p,null),Je(n,a,"formMethod",p.formMethod,p,null),Je(n,a,"formTarget",p.formTarget,p,null)):(Je(n,a,"encType",p.encType,p,null),Je(n,a,"method",p.method,p,null),Je(n,a,"target",p.target,p,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){n.removeAttribute(o);break}u=Ic(""+u),n.setAttribute(o,u);break;case"onClick":u!=null&&(n.onclick=bs);break;case"onScroll":u!=null&&Be("scroll",n);break;case"onScrollEnd":u!=null&&Be("scrollend",n);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(r(60));n.innerHTML=o}}break;case"multiple":n.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":n.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){n.removeAttribute("xlink:href");break}o=Ic(""+u),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":u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""+u):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":u&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,""):n.removeAttribute(o);break;case"capture":case"download":u===!0?n.setAttribute(o,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?n.setAttribute(o,u):n.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?n.setAttribute(o,u):n.removeAttribute(o);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?n.removeAttribute(o):n.setAttribute(o,u);break;case"popover":Be("beforetoggle",n),Be("toggle",n),di(n,"popover",u);break;case"xlinkActuate":Pn(n,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":Pn(n,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":Pn(n,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":Pn(n,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":Pn(n,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":Pn(n,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":Pn(n,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":Pn(n,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":Pn(n,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":di(n,"is",u);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=HE.get(o)||o,di(n,o,u))}}function Cm(n,a,o,u,p,x){switch(o){case"style":N0(n,u,x);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(o=u.__html,o!=null){if(p.children!=null)throw Error(r(60));n.innerHTML=o}}break;case"children":typeof u=="string"?hi(n,u):(typeof u=="number"||typeof u=="bigint")&&hi(n,""+u);break;case"onScroll":u!=null&&Be("scroll",n);break;case"onScrollEnd":u!=null&&Be("scrollend",n);break;case"onClick":u!=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[Ut]||null,x=x!=null?x[o]:null,typeof x=="function"&&n.removeEventListener(a,x,p),typeof u=="function")){typeof x!="function"&&x!==null&&(o in n?n[o]=null:n.hasAttribute(o)&&n.removeAttribute(o)),n.addEventListener(a,u,p);break e}o in n?n[o]=u:u===!0?n.setAttribute(o,""):di(n,o,u)}}}function Bt(n,a,o){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Be("error",n),Be("load",n);var u=!1,p=!1,x;for(x in o)if(o.hasOwnProperty(x)){var C=o[x];if(C!=null)switch(x){case"src":u=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Je(n,a,x,C,o,null)}}p&&Je(n,a,"srcSet",o.srcSet,o,null),u&&Je(n,a,"src",o.src,o,null);return;case"input":Be("invalid",n);var O=x=C=p=null,K=null,te=null;for(u in o)if(o.hasOwnProperty(u)){var re=o[u];if(re!=null)switch(u){case"name":p=re;break;case"type":C=re;break;case"checked":K=re;break;case"defaultChecked":te=re;break;case"value":x=re;break;case"defaultValue":O=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(r(137,a));break;default:Je(n,a,u,re,o,null)}}Pc(n,x,O,K,te,C,p,!1);return;case"select":Be("invalid",n),u=C=x=null;for(p in o)if(o.hasOwnProperty(p)&&(O=o[p],O!=null))switch(p){case"value":x=O;break;case"defaultValue":C=O;break;case"multiple":u=O;default:Je(n,a,p,O,o,null)}a=x,o=C,n.multiple=!!u,a!=null?vs(n,!!u,a,!1):o!=null&&vs(n,!!u,o,!0);return;case"textarea":Be("invalid",n),x=p=u=null;for(C in o)if(o.hasOwnProperty(C)&&(O=o[C],O!=null))switch(C){case"value":u=O;break;case"defaultValue":p=O;break;case"children":x=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(r(91));break;default:Je(n,a,C,O,o,null)}S0(n,u,p,x);return;case"option":for(K in o)if(o.hasOwnProperty(K)&&(u=o[K],u!=null))switch(K){case"selected":n.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Je(n,a,K,u,o,null)}return;case"dialog":Be("beforetoggle",n),Be("toggle",n),Be("cancel",n),Be("close",n);break;case"iframe":case"object":Be("load",n);break;case"video":case"audio":for(u=0;u<dl.length;u++)Be(dl[u],n);break;case"image":Be("error",n),Be("load",n);break;case"details":Be("toggle",n);break;case"embed":case"source":case"link":Be("error",n),Be("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)&&(u=o[te],u!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Je(n,a,te,u,o,null)}return;default:if(Hf(a)){for(re in o)o.hasOwnProperty(re)&&(u=o[re],u!==void 0&&Cm(n,a,re,u,o,void 0));return}}for(O in o)o.hasOwnProperty(O)&&(u=o[O],u!=null&&Je(n,a,O,u,o,null))}function hC(n,a,o,u){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,C=null,O=null,K=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":K=le;default:u.hasOwnProperty(ae)||Je(n,a,ae,null,u,le)}}for(var ne in u){var ae=u[ne];if(le=o[ne],u.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":C=ae;break;case"defaultValue":O=ae;break;case"children":case"dangerouslySetInnerHTML":if(ae!=null)throw Error(r(137,a));break;default:ae!==le&&Je(n,a,ne,ae,u,le)}}lr(n,C,O,K,te,re,x,p);return;case"select":ae=C=O=ne=null;for(x in o)if(K=o[x],o.hasOwnProperty(x)&&K!=null)switch(x){case"value":break;case"multiple":ae=K;default:u.hasOwnProperty(x)||Je(n,a,x,null,u,K)}for(p in u)if(x=u[p],K=o[p],u.hasOwnProperty(p)&&(x!=null||K!=null))switch(p){case"value":ne=x;break;case"defaultValue":O=x;break;case"multiple":C=x;default:x!==K&&Je(n,a,p,x,u,K)}a=O,o=C,u=ae,ne!=null?vs(n,!!o,ne,!1):!!u!=!!o&&(a!=null?vs(n,!!o,a,!0):vs(n,!!o,o?[]:"",!1));return;case"textarea":ae=ne=null;for(O in o)if(p=o[O],o.hasOwnProperty(O)&&p!=null&&!u.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:Je(n,a,O,null,u,p)}for(C in u)if(p=u[C],x=o[C],u.hasOwnProperty(C)&&(p!=null||x!=null))switch(C){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&&Je(n,a,C,p,u,x)}b0(n,ne,ae);return;case"option":for(var pe in o)if(ne=o[pe],o.hasOwnProperty(pe)&&ne!=null&&!u.hasOwnProperty(pe))switch(pe){case"selected":n.selected=!1;break;default:Je(n,a,pe,null,u,ne)}for(K in u)if(ne=u[K],ae=o[K],u.hasOwnProperty(K)&&ne!==ae&&(ne!=null||ae!=null))switch(K){case"selected":n.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:Je(n,a,K,ne,u,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&&!u.hasOwnProperty(_e)&&Je(n,a,_e,null,u,ne);for(te in u)if(ne=u[te],ae=o[te],u.hasOwnProperty(te)&&ne!==ae&&(ne!=null||ae!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(r(137,a));break;default:Je(n,a,te,ne,u,ae)}return;default:if(Hf(a)){for(var et in o)ne=o[et],o.hasOwnProperty(et)&&ne!==void 0&&!u.hasOwnProperty(et)&&Cm(n,a,et,void 0,u,ne);for(re in u)ne=u[re],ae=o[re],!u.hasOwnProperty(re)||ne===ae||ne===void 0&&ae===void 0||Cm(n,a,re,ne,u,ae);return}}for(var W in o)ne=o[W],o.hasOwnProperty(W)&&ne!=null&&!u.hasOwnProperty(W)&&Je(n,a,W,null,u,ne);for(le in u)ne=u[le],ae=o[le],!u.hasOwnProperty(le)||ne===ae||ne==null&&ae==null||Je(n,a,le,ne,u,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 mC(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,o=performance.getEntriesByType("resource"),u=0;u<o.length;u++){var p=o[u],x=p.transferSize,C=p.initiatorType,O=p.duration;if(x&&O&&jv(C)){for(C=0,O=p.responseEnd,u+=1;u<o.length;u++){var K=o[u],te=K.startTime;if(te>O)break;var re=K.transferSize,le=K.initiatorType;re&&jv(le)&&(K=K.responseEnd,C+=re*(K<O?1:(O-te)/(K-te)))}if(--u,a+=8*(x+C)/(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 _m=null,Rm=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 Tm(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 Am=null;function pC(){var n=window.event;return n&&n.type==="popstate"?n===Am?!1:(Am=n,!0):(Am=null,!1)}var _v=typeof setTimeout=="function"?setTimeout:void 0,gC=typeof clearTimeout=="function"?clearTimeout:void 0,Rv=typeof Promise=="function"?Promise:void 0,xC=typeof queueMicrotask=="function"?queueMicrotask:typeof Rv<"u"?function(n){return Rv.resolve(null).then(n).catch(yC)}:_v;function yC(n){setTimeout(function(){throw n})}function Sa(n){return n==="head"}function Tv(n,a){var o=a,u=0;do{var p=o.nextSibling;if(n.removeChild(o),p&&p.nodeType===8)if(o=p.data,o==="/$"||o==="/&"){if(u===0){n.removeChild(p),Vi(a);return}u--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")u++;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 C=x.nextSibling,O=x.nodeName;x[ir]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&x.rel.toLowerCase()==="stylesheet"||o.removeChild(x),x=C}}else o==="body"&&hl(n.ownerDocument.body);o=p}while(o);Vi(a)}function Av(n,a){var o=n;n=0;do{var u=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||""),u&&u.nodeType===8)if(o=u.data,o==="/$"){if(n===0)break;n--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||n++;o=u}while(o)}function Mm(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":Mm(o),Ao(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}n.removeChild(o)}}function vC(n,a,o,u){for(;n.nodeType===1;){var p=o;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(u){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=kn(n.nextSibling),n===null)break}return null}function bC(n,a,o){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!o||(n=kn(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=kn(n.nextSibling),n===null))return null;return n}function km(n){return n.data==="$?"||n.data==="$~"}function Om(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function SC(n,a){var o=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||o.readyState!=="loading")a();else{var u=function(){a(),o.removeEventListener("DOMContentLoaded",u)};o.addEventListener("DOMContentLoaded",u),n._reactRetry=u}}function kn(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 Dm=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 kn(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 On=new Map,Lv=new Set;function Du(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var zs=U.d;U.d={f:wC,r:NC,D:jC,C:EC,L:CC,m:_C,X:TC,S:RC,M:AC};function wC(){var n=zs.f(),a=Eu();return n||a}function NC(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 u=Ui;if(u&&typeof a=="string"&&a){var p=en(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},u.querySelector(p)===null&&(a=u.createElement("link"),Bt(a,"link",n),yt(a),u.head.appendChild(a)))}}function jC(n){zs.D(n),zv("dns-prefetch",n,null)}function EC(n,a){zs.C(n,a),zv("preconnect",n,a)}function CC(n,a,o){zs.L(n,a,o);var u=Ui;if(u&&n&&a){var p='link[rel="preload"][as="'+en(a)+'"]';a==="image"&&o&&o.imageSrcSet?(p+='[imagesrcset="'+en(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(p+='[imagesizes="'+en(o.imageSizes)+'"]')):p+='[href="'+en(n)+'"]';var x=p;switch(a){case"style":x=$i(n);break;case"script":x=qi(n)}On.has(x)||(n=g({rel:"preload",href:a==="image"&&o&&o.imageSrcSet?void 0:n,as:a},o),On.set(x,n),u.querySelector(p)!==null||a==="style"&&u.querySelector(ml(x))||a==="script"&&u.querySelector(pl(x))||(a=u.createElement("link"),Bt(a,"link",n),yt(a),u.head.appendChild(a)))}}function _C(n,a){zs.m(n,a);var o=Ui;if(o&&n){var u=a&&typeof a.as=="string"?a.as:"script",p='link[rel="modulepreload"][as="'+en(u)+'"][href="'+en(n)+'"]',x=p;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=qi(n)}if(!On.has(x)&&(n=g({rel:"modulepreload",href:n},a),On.set(x,n),o.querySelector(p)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(pl(x)))return}u=o.createElement("link"),Bt(u,"link",n),yt(u),o.head.appendChild(u)}}}function RC(n,a,o){zs.S(n,a,o);var u=Ui;if(u&&n){var p=ta(u).hoistableStyles,x=$i(n);a=a||"default";var C=p.get(x);if(!C){var O={loading:0,preload:null};if(C=u.querySelector(ml(x)))O.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":a},o),(o=On.get(x))&&Lm(n,o);var K=C=u.createElement("link");yt(K),Bt(K,"link",n),K._p=new Promise(function(te,re){K.onload=te,K.onerror=re}),K.addEventListener("load",function(){O.loading|=1}),K.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Lu(C,a,u)}C={type:"stylesheet",instance:C,count:1,state:O},p.set(x,C)}}}function TC(n,a){zs.X(n,a);var o=Ui;if(o&&n){var u=ta(o).hoistableScripts,p=qi(n),x=u.get(p);x||(x=o.querySelector(pl(p)),x||(n=g({src:n,async:!0},a),(a=On.get(p))&&zm(n,a),x=o.createElement("script"),yt(x),Bt(x,"link",n),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},u.set(p,x))}}function AC(n,a){zs.M(n,a);var o=Ui;if(o&&n){var u=ta(o).hoistableScripts,p=qi(n),x=u.get(p);x||(x=o.querySelector(pl(p)),x||(n=g({src:n,async:!0,type:"module"},a),(a=On.get(p))&&zm(n,a),x=o.createElement("script"),yt(x),Bt(x,"link",n),o.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},u.set(p,x))}}function Pv(n,a,o,u){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,u=o.get(a),u||(u={type:"style",instance:null,count:0,state:null},o.set(a,u)),u):{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,C=x.get(n);if(C||(p=p.ownerDocument||p,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(n,C),(x=p.querySelector(ml(n)))&&!x._p&&(C.instance=x,C.state.loading=5),On.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},On.set(n,o),x||MC(p,n,o,C.state))),a&&u===null)throw Error(r(528,""));return C}if(a&&u!==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,u=o.get(a),u||(u={type:"script",instance:null,count:0,state:null},o.set(a,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,n))}}function $i(n){return'href="'+en(n)+'"'}function ml(n){return'link[rel="stylesheet"]['+n+"]"}function Iv(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function MC(n,a,o,u){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?u.loading=1:(a=n.createElement("link"),u.preload=a,a.addEventListener("load",function(){return u.loading|=1}),a.addEventListener("error",function(){return u.loading|=2}),Bt(a,"link",o),yt(a),n.head.appendChild(a))}function qi(n){return'[src="'+en(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 u=n.querySelector('style[data-href~="'+en(o.href)+'"]');if(u)return a.instance=u,yt(u),u;var p=g({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return u=(n.ownerDocument||n).createElement("style"),yt(u),Bt(u,"style",p),Lu(u,o.precedence,n),a.instance=u;case"stylesheet":p=$i(o.href);var x=n.querySelector(ml(p));if(x)return a.state.loading|=4,a.instance=x,yt(x),x;u=Iv(o),(p=On.get(p))&&Lm(u,p),x=(n.ownerDocument||n).createElement("link"),yt(x);var C=x;return C._p=new Promise(function(O,K){C.onload=O,C.onerror=K}),Bt(x,"link",u),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,yt(p),p):(u=o,(p=On.get(x))&&(u=g({},o),zm(u,p)),n=n.ownerDocument||n,p=n.createElement("script"),yt(p),Bt(p,"link",u),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&&(u=a.instance,a.state.loading|=4,Lu(u,o.precedence,n));return a.instance}function Lu(n,a,o){for(var u=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=u.length?u[u.length-1]:null,x=p,C=0;C<u.length;C++){var O=u[C];if(O.dataset.precedence===a)x=O;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 Lm(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function zm(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 u=new Map,p=zu=new Map;p.set(o,u)}else p=zu,u=p.get(o),u||(u=new Map,p.set(o,u));if(u.has(n))return u;for(u.set(n,null),o=o.getElementsByTagName(n),p=0;p<o.length;p++){var x=o[p];if(!(x[ir]||x[jt]||n==="link"&&x.getAttribute("rel")==="stylesheet")&&x.namespaceURI!=="http://www.w3.org/2000/svg"){var C=x.getAttribute(a)||"";C=n+C;var O=u.get(C);O?O.push(x):u.set(C,[x])}}return u}function Uv(n,a,o){n=n.ownerDocument||n,n.head.insertBefore(o,a==="title"?n.querySelector("head > title"):null)}function kC(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 OC(n,a,o,u){if(o.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var p=$i(u.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,yt(x);return}x=a.ownerDocument||a,u=Iv(u),(p=On.get(p))&&Lm(u,p),x=x.createElement("link"),yt(x);var C=x;C._p=new Promise(function(O,K){C.onload=O,C.onerror=K}),Bt(x,"link",u),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 Pm=0;function DC(n,a){return n.stylesheets&&n.count===0&&Bu(n,n.stylesheets),0<n.count||0<n.imgCount?function(o){var u=setTimeout(function(){if(n.stylesheets&&Bu(n,n.stylesheets),n.unsuspend){var x=n.unsuspend;n.unsuspend=null,x()}},6e4+a);0<n.imgBytes&&Pm===0&&(Pm=62500*mC());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>Pm?50:800)+a);return n.unsuspend=o,function(){n.unsuspend=null,clearTimeout(u),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(LC,n),Iu=null,Pu.call(n))}function LC(n,a){if(!(a.state.loading&4)){var o=Iu.get(n);if(o)var u=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 C=p[x];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(o.set(C.dataset.precedence,C),u=C)}u&&o.set(null,u)}p=a.instance,C=p.getAttribute("data-precedence"),x=o.get(C)||u,x===u&&o.set(null,p),o.set(C,p),this.count++,u=Pu.bind(this),p.addEventListener("load",u),p.addEventListener("error",u),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:$,_currentValue2:$,_threadCount:0};function zC(n,a,o,u,p,x,C,O,K){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=u,this.onUncaughtError=p,this.onCaughtError=x,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function qv(n,a,o,u,p,x,C,O,K,te,re,le){return n=new zC(n,a,o,C,K,te,re,le,O),a=1,x===!0&&(a|=24),x=gn(3,null,null,a),n.current=x,x.stateNode=n,a=gh(),a.refCount++,n.pooledCache=a,a.refCount++,x.memoizedState={element:u,isDehydrated:o,cache:a},bh(x),n}function Vv(n){return n?(n=bi,n):bi}function Gv(n,a,o,u,p,x){p=Vv(p),u.context===null?u.context=p:u.pendingContext=p,u=ua(a),u.payload={element:o},x=x===void 0?null:x,x!==null&&(u.callback=x),o=da(n,u,a),o!==null&&(on(o,n,a),Fo(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 Im(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&&on(a,n,67108864),Im(n,67108864)}}function Fv(n){if(n.tag===13||n.tag===31){var a=Sn();a=Ro(a);var o=fr(n,a);o!==null&&on(o,n,a),Im(n,a)}}var Hu=!0;function PC(n,a,o,u){var p=k.T;k.T=null;var x=U.p;try{U.p=2,Bm(n,a,o,u)}finally{U.p=x,k.T=p}}function IC(n,a,o,u){var p=k.T;k.T=null;var x=U.p;try{U.p=8,Bm(n,a,o,u)}finally{U.p=x,k.T=p}}function Bm(n,a,o,u){if(Hu){var p=Hm(u);if(p===null)Em(n,a,u,Uu,o),Xv(n,u);else if(HC(p,n,a,o,u))u.stopPropagation();else if(Xv(n,u),a&4&&-1<BC.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 C=gs(x.pendingLanes);if(C!==0){var O=x;for(O.pendingLanes|=2,O.entangledLanes|=2;C;){var K=1<<31-Gt(C);O.entanglements[1]|=K,C&=~K}as(x),(Fe&6)===0&&(Nu=Ae()+500,ul(0))}}break;case 31:case 13:O=fr(x,2),O!==null&&on(O,x,2),Eu(),Im(x,2)}if(x=Hm(u),x===null&&Em(n,a,u,Uu,o),x===p)break;p=x}p!==null&&u.stopPropagation()}else Em(n,a,u,null,o)}}function Hm(n){return n=$f(n),Um(n)}var Uu=null;function Um(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 Kv(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(pt()){case Lt:return 2;case Wn:return 8;case nr:case _f:return 32;case ri:return 268435456;default:return 32}default:return 32}}var $m=!1,wa=null,Na=null,ja=null,xl=new Map,yl=new Map,Ea=[],BC="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,u,p,x){return n===null||n.nativeEvent!==x?(n={blockedOn:a,domEventName:o,eventSystemFlags:u,nativeEvent:x,targetContainers:[p]},a!==null&&(a=Js(a),a!==null&&Qv(a)),n):(n.eventSystemFlags|=u,a=n.targetContainers,p!==null&&a.indexOf(p)===-1&&a.push(p),n)}function HC(n,a,o,u,p){switch(a){case"focusin":return wa=vl(wa,n,a,o,u,p),!0;case"dragenter":return Na=vl(Na,n,a,o,u,p),!0;case"mouseover":return ja=vl(ja,n,a,o,u,p),!0;case"pointerover":var x=p.pointerId;return xl.set(x,vl(xl.get(x)||null,n,a,o,u,p)),!0;case"gotpointercapture":return x=p.pointerId,yl.set(x,vl(yl.get(x)||null,n,a,o,u,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(){Fv(o)});return}}else if(a===31){if(a=f(o),a!==null){n.blockedOn=a,Tc(n.priority,function(){Fv(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=Hm(n.nativeEvent);if(o===null){o=n.nativeEvent;var u=new o.constructor(o.type,o);Uf=u,o.target.dispatchEvent(u),Uf=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 UC(){$m=!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,$m||($m=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,UC)))}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],u=n[a+1],p=n[a+2];if(typeof u!="function"){if(Um(u||o)===null)continue;break}var x=Js(o);x!==null&&(n.splice(a,3),a-=3,Hh(x,{pending:!0,data:p,method:o.method,action:u},u,p))}}))}function Vi(n){function a(K){return qu(K,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 u=Ea[o];u.blockedOn===n&&(u.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(u=0;u<o.length;u+=3){var p=o[u],x=o[u+1],C=p[Ut]||null;if(typeof x=="function")C||Jv(o);else if(C){var O=null;if(x&&x.hasAttribute("formAction")){if(p=x,C=x[Ut]||null)O=C.formAction;else if(Um(p)!==null)continue}else O=C.action;typeof O=="function"?o[u+1]=O:(o.splice(u,3),u-=3),Jv(o)}}}function eb(){function n(x){x.canIntercept&&x.info==="react-transition"&&x.intercept({handler:function(){return new Promise(function(C){return p=C})},focusReset:"manual",scroll:"manual"})}function a(){p!==null&&(p(),p=null),u||setTimeout(o,20)}function o(){if(!u&&!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 u=!1,p=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(o,100),function(){u=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),p!==null&&(p(),p=null)}}}function qm(n){this._internalRoot=n}Gu.prototype.render=qm.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(r(409));var o=a.current,u=Sn();Gv(o,u,n,a,null,null)},Gu.prototype.unmount=qm.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"));U.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 $C={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:k,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($C),Vt=Yu}catch{}}return wl.createRoot=function(n,a){if(!i(n))throw Error(r(299));var o=!1,u="",p=ly,x=cy,C=uy;return a!=null&&(a.unstable_strictMode===!0&&(o=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(x=a.onCaughtError),a.onRecoverableError!==void 0&&(C=a.onRecoverableError)),a=qv(n,1,!1,null,null,o,u,null,p,x,C,eb),n[xs]=a.current,jm(n),new qm(a)},wl.hydrateRoot=function(n,a,o){if(!i(n))throw Error(r(299));var u=!1,p="",x=ly,C=cy,O=uy,K=null;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(p=o.identifierPrefix),o.onUncaughtError!==void 0&&(x=o.onUncaughtError),o.onCaughtError!==void 0&&(C=o.onCaughtError),o.onRecoverableError!==void 0&&(O=o.onRecoverableError),o.formState!==void 0&&(K=o.formState)),a=qv(n,1,!0,a,o??null,u,p,K,x,C,O,eb),a.context=Vv(null),o=a.current,u=Sn(),u=Ro(u),p=ua(u),p.callback=null,da(o,p,u),o=u,a.current.lanes=o,rr(a,o),as(a),n[xs]=a.current,jm(n),new Gu(a)},wl.version="19.2.4",wl}var fb;function e_(){if(fb)return Qm.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(),Qm.exports=JC(),Qm.exports}var t_=e_(),Fu=typeof window<"u"?j.useLayoutEffect:j.useEffect;function Zm(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 n_(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 s_(e){const t=j.useRef(null);return j.useImperativeHandle(e,()=>t.current,[]),t}var a_=!1;function Bl(e){return e[e.length-1]}function r_(e){return typeof e=="function"}function Va(e,t){return r_(e)?e(t):e}var i_=Object.prototype.hasOwnProperty,hb=Object.prototype.propertyIsEnumerable,o_=()=>Object.create(null),Er=(e,t)=>Ga(e,t,o_);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:i_.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 l_(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 l_(t)}var c_=["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 u_(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function d_(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,QS=5;function f_(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 vg(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=f_(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 sf(e,t,s,r,i,l,d){var m,h,v,g,y,b,S,w,N,E,T,_,R;d==null||d(s);let f=r;{const L=s.fullPath??s.from,I=L.length,P=((m=s.options)==null?void 0:m.caseSensitive)??e,A=!!((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<I;){const q=vg(L,f,t);let z;const Q=f,Y=q[5];switch(f=Y+1,l++,q[0]){case 0:{const B=L.substring(q[2],q[3]);if(P){const V=(b=i.static)==null?void 0:b.get(B);if(V)z=V;else{i.static??(i.static=new Map);const k=Ar(s.fullPath??s.from);k.parent=i,k.depth=l,z=k,i.static.set(B,k)}}else{const V=B.toLowerCase(),k=(S=i.staticInsensitive)==null?void 0:S.get(V);if(k)z=k;else{i.staticInsensitive??(i.staticInsensitive=new Map);const U=Ar(s.fullPath??s.from);U.parent=i,U.depth=l,z=U,i.staticInsensitive.set(V,U)}}break}case 1:{const B=L.substring(Q,q[1]),V=L.substring(q[4],Y),k=P&&!!(B||V),U=B?k?B:B.toLowerCase():void 0,$=V?k?V:V.toLowerCase():void 0,F=!A&&((w=i.dynamic)==null?void 0:w.find(H=>!H.skipOnParamError&&H.caseSensitive===k&&H.prefix===U&&H.suffix===$));if(F)z=F;else{const H=Jm(1,s.fullPath??s.from,k,U,$);z=H,H.depth=l,H.parent=i,i.dynamic??(i.dynamic=[]),i.dynamic.push(H)}break}case 3:{const B=L.substring(Q,q[1]),V=L.substring(q[4],Y),k=P&&!!(B||V),U=B?k?B:B.toLowerCase():void 0,$=V?k?V:V.toLowerCase():void 0,F=!A&&((N=i.optional)==null?void 0:N.find(H=>!H.skipOnParamError&&H.caseSensitive===k&&H.prefix===U&&H.suffix===$));if(F)z=F;else{const H=Jm(3,s.fullPath??s.from,k,U,$);z=H,H.parent=i,H.depth=l,i.optional??(i.optional=[]),i.optional.push(H)}break}case 2:{const B=L.substring(Q,q[1]),V=L.substring(q[4],Y),k=P&&!!(B||V),U=B?k?B:B.toLowerCase():void 0,$=V?k?V:V.toLowerCase():void 0,F=Jm(2,s.fullPath??s.from,k,U,$);z=F,F.parent=i,F.depth=l,i.wildcard??(i.wildcard=[]),i.wildcard.push(F)}}i=z}if(A&&s.children&&!s.isRoot&&s.id&&s.id.charCodeAt(s.id.lastIndexOf("/")+1)===95){const q=Ar(s.fullPath??s.from);q.kind=QS,q.parent=i,l++,q.depth=l,i.pathless??(i.pathless=[]),i.pathless.push(q),i=q}const M=(s.path||!s.children)&&!s.isRoot;if(M&&L.endsWith("/")){const q=Ar(s.fullPath??s.from);q.kind=Tr,q.parent=i,l++,q.depth=l,i.index=q,i=q}i.parse=((T=(E=s.options)==null?void 0:E.params)==null?void 0:T.parse)??null,i.skipOnParamError=A,i.parsingPriority=((R=(_=s.options)==null?void 0:_.skipRouteOnParseError)==null?void 0:R.priority)??0,M&&!i.route&&(i.route=s,i.fullPath=s.fullPath??s.from)}if(s.children)for(const L of s.children)sf(e,t,L,f,i,l,d)}function Wm(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(Wm);for(const i of e.dynamic)Oa(i)}if((s=e.optional)!=null&&s.length){e.optional.sort(Wm);for(const i of e.optional)Oa(i)}if((r=e.wildcard)!=null&&r.length){e.wildcard.sort(Wm);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 Jm(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 h_(e,t){const s=Ar("/"),r=new Uint16Array(6);for(const i of e)sf(!1,r,i,1,s,0);Oa(s),t.masksTree=s,t.flatCache=Ul(1e3)}function m_(e,t){e||(e="/");const s=t.flatCache.get(e);if(s)return s;const r=bg(e,t.masksTree);return t.flatCache.set(e,r),r}function p_(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("/"),sf(t,new Uint16Array(6),{from:e},1,d,0),i.singleCache.set(l,d)),bg(r,d,s)}function g_(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=bg(e,t.segmentTree,s)}catch(d){if(d instanceof URIError)l=null;else throw d}return l&&(l.branch=v_(l.route)),t.matchCache.set(r,l),l}function x_(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function y_(e,t=!1,s){const r=Ar(e.fullPath),i=new Uint16Array(6),l={},d={};let f=0;return sf(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=x_(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 bg(e,t,s=!1){const r=e.split("/"),i=S_(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,E,T,_;const r=b_(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===QS){h--,d--,m--;continue}const L=t[d],I=m;if(L&&(m+=L.length),R.kind===1){i??(i=s.node.fullPath.split("/"));const P=i[h],A=((S=R.prefix)==null?void 0:S.length)??0;if(P.charCodeAt(A)===123){const M=((w=R.suffix)==null?void 0:w.length)??0,q=P.substring(A+2,P.length-M-1),z=L.substring(A,L.length-M);l[q]=decodeURIComponent(z)}else{const M=P.substring(1);l[M]=decodeURIComponent(L)}}else if(R.kind===3){if(s.skipped&1<<f){d--,m=I-1;continue}i??(i=s.node.fullPath.split("/"));const P=i[h],A=((N=R.prefix)==null?void 0:N.length)??0,M=((E=R.suffix)==null?void 0:E.length)??0,q=P.substring(A+3,P.length-M-1),z=R.suffix||R.prefix?L.substring(A,L.length-M):L;z&&(l[q]=decodeURIComponent(z))}else if(R.kind===2){const P=R,A=e.substring(I+(((T=P.prefix)==null?void 0:T.length)??0),e.length-(((_=P.suffix)==null?void 0:_.length)??0)),M=decodeURIComponent(A);l["*"]=M,l._splat=M;break}}return s.rawParams&&Object.assign(l,s.rawParams),[l,{part:d,node:f,path:m,segment:h}]}function v_(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function b_(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function S_(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:E,optionals:T}=g;let{extract:_,rawParams:R,parsedParams:L}=g;if(y.skipOnParamError){if(!ep(e,t,g))continue;R=g.rawParams,_=g.extract,L=g.parsedParams}r&&y.route&&y.kind!==Tr&&jl(h,g)&&(h=g);const I=b===d;if(I&&(y.route&&!l&&jl(v,g)&&(v=g),!y.optional&&!y.wildcard&&!y.index&&!y.pathless))continue;const P=I?void 0:t[b];let A;if(I&&y.index){const M={node:y.index,index:b,skipped:S,depth:w+1,statics:N,dynamics:E,optionals:T,extract:_,rawParams:R,parsedParams:L};let q=!0;if(y.index.skipOnParamError&&(ep(e,t,M)||(q=!1)),q){if(N===d&&!E&&!T&&!S)return M;jl(v,M)&&(v=M)}}if(y.wildcard&&jl(m,g))for(const M of y.wildcard){const{prefix:q,suffix:z}=M;if(q&&(I||!(M.caseSensitive?P:A??(A=P.toLowerCase())).startsWith(q)))continue;if(z){if(I)continue;const Y=t.slice(b).join("/").slice(-z.length);if((M.caseSensitive?Y:Y.toLowerCase())!==z)continue}const Q={node:M,index:d,skipped:S,depth:w,statics:N,dynamics:E,optionals:T,extract:_,rawParams:R,parsedParams:L};if(!(M.skipOnParamError&&!ep(e,t,Q))){m=Q;break}}if(y.optional){const M=S|1<<w,q=w+1;for(let z=y.optional.length-1;z>=0;z--){const Q=y.optional[z];f.push({node:Q,index:b,skipped:M,depth:q,statics:N,dynamics:E,optionals:T,extract:_,rawParams:R,parsedParams:L})}if(!I)for(let z=y.optional.length-1;z>=0;z--){const Q=y.optional[z],{prefix:Y,suffix:B}=Q;if(Y||B){const V=Q.caseSensitive?P:A??(A=P.toLowerCase());if(Y&&!V.startsWith(Y)||B&&!V.endsWith(B))continue}f.push({node:Q,index:b+1,skipped:S,depth:q,statics:N,dynamics:E,optionals:T+1,extract:_,rawParams:R,parsedParams:L})}}if(!I&&y.dynamic&&P)for(let M=y.dynamic.length-1;M>=0;M--){const q=y.dynamic[M],{prefix:z,suffix:Q}=q;if(z||Q){const Y=q.caseSensitive?P:A??(A=P.toLowerCase());if(z&&!Y.startsWith(z)||Q&&!Y.endsWith(Q))continue}f.push({node:q,index:b+1,skipped:S,depth:w+1,statics:N,dynamics:E+1,optionals:T,extract:_,rawParams:R,parsedParams:L})}if(!I&&y.staticInsensitive){const M=y.staticInsensitive.get(A??(A=P.toLowerCase()));M&&f.push({node:M,index:b+1,skipped:S,depth:w+1,statics:N+1,dynamics:E,optionals:T,extract:_,rawParams:R,parsedParams:L})}if(!I&&y.static){const M=y.static.get(P);M&&f.push({node:M,index:b+1,skipped:S,depth:w+1,statics:N+1,dynamics:E,optionals:T,extract:_,rawParams:R,parsedParams:L})}if(y.pathless){const M=w+1;for(let q=y.pathless.length-1;q>=0;q--){const z=y.pathless[q];f.push({node:z,index:b,skipped:S,depth:M,statics:N,dynamics:E,optionals:T,extract:_,rawParams:R,parsedParams:L})}}}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 ep(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 Sg(e.filter(t=>t!==void 0).join("/"))}function Sg(e){return e.replace(/\/{2,}/g,"/")}function KS(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 XS(e){return Qa(KS(e))}function Ld(e,t){return e!=null&&e.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function w_(e,t,s){return Ld(e,s)===Ld(t,s)}function N_({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=vg(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),E=y.substring(m[2],m[3]);b===1?h+=w||N?`${w}{$${E}}${N}`:`$${E}`:b===2?h+=w||N?`${w}{$}${N}`:"$":h+=`${w}{-$${E}}${N}`}h=Sg(h);const v=h||"/";return d&&r&&r.set(d,v),v}function j_(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 tp(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=vg(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=tp("_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=tp(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),E=tp(b,t,s)??"";h+="/"+w+E+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 Zt(e){return!!(e!=null&&e.isNotFound)}function E_(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}var Mp="tsr-scroll-restoration-v1_3",C_=(e,t)=>{let s;return(...r)=>{s||(s=setTimeout(()=>{e(...r),s=null},t))}};function __(){const e=E_();if(!e)return null;const t=e.getItem(Mp);let s=t?JSON.parse(t):{};return{state:s,set:r=>{s=Va(r,s)||s;try{e.setItem(Mp,JSON.stringify(s))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}var Ku=__(),R_=e=>e.state.__TSR_key||e.href;function T_(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 A_({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 M_(e,t){if(!Ku||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!Ku))return;e.isScrollRestorationSetup=!0,zd=!1;const s=e.options.getScrollRestorationKey||R_;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=T_(i.target)}const d=s(e.stores.location.state);Ku.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",C_(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})||(A_({storageKey:Mp,key:l,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&Ku.set(d=>(d[l]||(d[l]={}),d)))})}function k_(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 O_(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 np(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function D_(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]=np(i):Array.isArray(l)?l.push(np(i)):s[r]=[l,np(i)]}return s}var L_=P_(JSON.parse),z_=I_(JSON.stringify,JSON.parse);function P_(e){return t=>{t[0]==="?"&&(t=t.substring(1));const s=D_(t);for(const r in s){const i=s[r];if(typeof i=="string")try{s[r]=e(i)}catch{}}return s}}function I_(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=O_(i,r);return l?`?${l}`:""}}var Gr="__root__";function B_(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 un(e){return e instanceof Response&&!!e.options}function H_(e){return{input:({url:t})=>{for(const s of e)t=kp(s,t);return t},output:({url:t})=>{for(let s=e.length-1;s>=0;s--)t=ZS(e[s],t);return t}}}function U_(e){const t=XS(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 kp(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 ZS(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 $_(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),E=s([]),T=s([]),_=s([]),R=r(()=>sp(d,E.state)),L=r(()=>sp(f,T.state)),I=r(()=>sp(m,_.state)),P=r(()=>E.state[0]),A=r(()=>E.state.some(U=>{var $;return(($=d.get(U))==null?void 0:$.state.status)==="pending"})),M=r(()=>{var U;return{locationHref:b.state.href,resolvedLocationHref:(U=S.state)==null?void 0:U.href,status:h.state}}),q=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})),z=Ul(64);function Q(U){let $=z.get(U);return $||($=r(()=>{const F=E.state;for(const H of F){const D=d.get(H);if(D&&D.routeId===U)return D.state}}),z.set(U,$)),$}const Y={status:h,loadedAt:v,isLoading:g,isTransitioning:y,location:b,resolvedLocation:S,statusCode:w,redirect:N,matchesId:E,pendingMatchesId:T,cachedMatchesId:_,activeMatchesSnapshot:R,pendingMatchesSnapshot:L,cachedMatchesSnapshot:I,firstMatchId:P,hasPendingMatches:A,matchRouteReactivity:M,activeMatchStoresById:d,pendingMatchStoresById:f,cachedMatchStoresById:m,__store:q,getMatchStoreByRouteId:Q,setActiveMatches:B,setPendingMatches:V,setCachedMatches:k};B(e.matches),l==null||l(Y);function B(U){ap(U,d,E,s,i)}function V(U){ap(U,f,T,s,i)}function k(U){ap(U,m,_,s,i)}return Y}function sp(e,t){const s=[];for(const r of t){const i=e.get(r);i&&s.push(i.state)}return s}function ap(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)}d_(s.state,l)||s.setState(()=>l)})}var Op=e=>{var t;if(!e.rendered)return e.rendered=!0,(t=e.onReady)==null?void 0:t.call(e)},q_=e=>e.stores.matchesId.state.some(t=>{var s;return(s=e.stores.activeMatchStoresById.get(t))==null?void 0:s.state._forcePending}),af=(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(!(!un(s)&&!Zt(s)))throw un(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:un(s)?"redirected":d.status==="pending"?"success":d.status,context:Yr(e,t.index),isFetching:!1,error:s})),Zt(s)&&!s.routeId&&(s.routeId=t.routeId),(l=t._nonReactive.loadPromise)==null||l.resolve()),un(s)&&(e.rendered=!0,s.options._fromLocation=e.location,s.redirectHandled=!0,s=e.router.resolveRedirect(s))),s},WS=(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&&!un(s)&&!Zt(s)&&(e.serialError??(e.serialError=s))},JS=(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&&!af(e,t)&&(s.options.loader||s.options.beforeLoad||tw(s))&&typeof i=="number"&&i!==1/0&&(s.options.pendingComponent??((l=e.router.options)==null?void 0:l.defaultPendingComponent))){const d=setTimeout(()=>{Op(e)},i);r._nonReactive.pendingTimeout=d}},V_=(e,t,s)=>{const r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;JS(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()},G_=(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"),JS(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,L=>({...L,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=af(e,t),E={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}(un(R)||Zt(R))&&(v(),El(e,s,R,"BEFORE_LOAD")),e.router.batch(()=>{v(),e.updateMatch(t,L=>({...L,__beforeLoadContext:R})),g()})};let _;try{if(_=r.options.beforeLoad(E),Hl(_))return v(),_.catch(R=>{El(e,s,R,"BEFORE_LOAD")}).then(T)}catch(R){v(),El(e,s,R,"BEFORE_LOAD")}T(_)},Y_=(e,t)=>{const{id:s,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],l=()=>f(),d=()=>G_(e,s,t,i),f=()=>{if(WS(e,s))return;const m=V_(e,s,i);return Hl(m)?m.then(d):d()};return l()},Q_=(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}))},ew=(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=af(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{(!(a_??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(ew(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,E=>({...E,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,Zt(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)}!un(y)&&!Zt(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(E,T,_,R,L){const I=Date.now()-T.updatedAt,P=E?L.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:L.options.staleTime??e.router.options.defaultStaleTime??0,A=L.options.shouldReload,M=typeof A=="function"?A(ew(e,t,i,s,L)):A,{status:q,invalid:z}=R,Q=I>=P&&(!!e.forceStaleReload||R.cause==="enter"||_!==void 0&&_!==R.id);d=q==="success"&&(z||(M??Q)),E&&L.options.preload===!1||(d&&!e.sync&&v?(f=!0,(async()=>{var Y,B;try{await wb(e,t,i,s,L);const V=e.router.getMatch(i);(Y=V._nonReactive.loaderPromise)==null||Y.resolve(),(B=V._nonReactive.loadPromise)==null||B.resolve(),V._nonReactive.loaderPromise=void 0,V._nonReactive.loadPromise=void 0}catch(V){un(V)&&await e.router.navigate(V.options)}})()):q!=="success"||d?await wb(e,t,i,s,L):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(WS(e,i)){if(!e.router.getMatch(i))return e.matches[s];Sb(e,i,s)}else{const E=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(L=>L.routeId===l))==null?void 0:S.id,R=af(e,i);if(E._nonReactive.loaderPromise){if(E.status==="success"&&!e.sync&&!E.preload&&v)return E;await E._nonReactive.loaderPromise;const L=e.router.getMatch(i),I=L._nonReactive.error||L.error;I&&Ya(e,L,I),L.status==="pending"&&await r(R,E,_,L,m)}else{const L=R&&!e.router.stores.activeMatchStoresById.has(i),I=e.router.getMatch(i);I._nonReactive.loaderPromise=xo(),L!==I.preload&&e.updateMatch(i,P=>({...P,preload:L})),await r(R,E,_,I,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,E=>({...E,isFetching:y,invalid:!1})),e.router.getMatch(i)):g};async function Nb(e){var y,b;const t=e,s=[];q_(t.router)&&Op(t);let r;for(let S=0;S<t.matches.length;S++){try{const w=Y_(t,S);Hl(w)&&await w}catch(w){if(un(w))throw w;if(Zt(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(un(N))throw N;Zt(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],E=(y=t.router.options)==null?void 0:y.defaultNotFoundComponent;!N.options.notFoundComponent&&E&&(N.options.notFoundComponent=E),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],E=t.router.looseRoutesById[N];try{const T=Q_(t,w,E);if(T){const _=await T;t.updateMatch(w,R=>({...R,..._}))}}catch(T){console.error(`Error executing head for route ${N}:`,T)}}const g=Op(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 tw(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"],Fa="__TSR_index",Eb="popstate",Cb="beforeunload";function K_(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[Fa];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[Fa];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[Fa]!==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=wg();return{...t,key:s,__TSR_key:s,[Fa]:e}}function X_(e){var A,M;const t=typeof document<"u"?window:void 0,s=t.history.pushState,r=t.history.replaceState;let i=[];const l=()=>i,d=q=>i=q,f=(q=>q),m=(()=>Pd(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!((A=t.history.state)!=null&&A.__TSR_key)&&!((M=t.history.state)!=null&&M.key)){const q=wg();t.history.replaceState({[Fa]:0,key:q,__TSR_key:q},"")}let h=m(),v,g=!1,y=!1,b=!1,S=!1;const w=()=>h;let N,E;const T=()=>{N&&(P._ignoreSubscribers=!0,(N.isPush?t.history.pushState:t.history.replaceState)(N.state,"",N.href),P._ignoreSubscribers=!1,N=void 0,E=void 0,v=void 0)},_=(q,z,Q)=>{const Y=f(z);E||(v=h),h=Pd(z,Q),N={href:Y,state:Q,isPush:(N==null?void 0:N.isPush)||q==="push"},E||(E=Promise.resolve().then(()=>T()))},R=q=>{h=m(),P.notify({type:q})},L=async()=>{if(y){y=!1;return}const q=m(),z=q.state[Fa]-h.state[Fa],Q=z===1,Y=z===-1,B=!Q&&!Y||g;g=!1;const V=B?"GO":Y?"BACK":"FORWARD",k=B?{type:"GO",index:z}:{type:Y?"BACK":"FORWARD"};if(b)b=!1;else{const U=l();if(typeof document<"u"&&U.length){for(const $ of U)if(await $.blockerFn({currentLocation:h,nextLocation:q,action:V})){y=!0,t.history.go(1),P.notify(k);return}}}h=m(),P.notify(k)},I=q=>{if(S){S=!1;return}let z=!1;const Q=l();if(typeof document<"u"&&Q.length)for(const Y of Q){const B=Y.enableBeforeUnload??!0;if(B===!0){z=!0;break}if(typeof B=="function"&&B()===!0){z=!0;break}}if(z)return q.preventDefault(),q.returnValue=""},P=K_({getLocation:w,getLength:()=>t.history.length,pushState:(q,z)=>_("push",q,z),replaceState:(q,z)=>_("replace",q,z),back:q=>(q&&(b=!0),S=!0,t.history.back()),forward:q=>{q&&(b=!0),S=!0,t.history.forward()},go:q=>{g=!0,t.history.go(q)},createHref:q=>f(q),flush:T,destroy:()=>{t.history.pushState=s,t.history.replaceState=r,t.removeEventListener(Cb,I,{capture:!0}),t.removeEventListener(Eb,L)},onBlocked:()=>{v&&h!==v&&(h=v)},getBlockers:l,setBlockers:d,notifyOnIndexChange:!1});return t.addEventListener(Cb,I,{capture:!0}),t.addEventListener(Eb,L),t.history.pushState=function(...q){const z=s.apply(t.history,q);return P._ignoreSubscribers||R("PUSH"),z},t.history.replaceState=function(...q){const z=r.apply(t.history,q);return P._ignoreSubscribers||R("REPLACE"),z},P}function Z_(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function Pd(e,t){const s=Z_(e),r=s.indexOf("#"),i=s.indexOf("?"),l=wg();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||{[Fa]:0,key:l,__TSR_key:l}}}function wg(){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 W_=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=j_(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=X_()),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=$_(eR(this.latestLocation),g),M_(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=XS(m);y&&y!=="/"&&g.push(U_({basepath:m})),h&&g.push(h),this.rewrite=g.length===0?void 0:g.length===1?g[0]:H_(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=y_(this.routeTree,this.options.caseSensitive,(r,i)=>{r.init({originalIndex:i})});return this.options.routeMasks&&h_(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 E=this.options.parseSearch(h),T=this.options.stringifySearch(E);return{href:m+T+v,publicHref:g,pathname:Nl(m).path,external:!1,searchStr:T,search:Er(r==null?void 0:r.search,E),hash:Nl(v.slice(1)).path,state:Ga(r==null?void 0:r.state,y)}}const b=new URL(g,this.origin),S=kp(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)=>N_({base:s,to:Sg(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=>tR({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 q,z;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 Q of w){const Y=((q=Q.options.params)==null?void 0:q.stringify)??Q.options.stringifyParams;if(Y)try{Object.assign(b,Y(b))}catch{}}const N=s.leaveParams?y:Nl(yb({path:y,params:b,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let E=v;if(s._includeValidateSearch&&((z=this.options.search)!=null&&z.strict)){const Q={};w.forEach(Y=>{if(Y.options.validateSearch)try{Object.assign(Q,Nd(Y.options.validateSearch,{...Q,...E}))}catch{}}),E=Q}E=nR({search:E,dest:l,destRoutes:w,_includeValidateSearch:s._includeValidateSearch}),E=Er(v,E);const T=this.options.stringifySearch(E),_=l.hash===!0?d.hash:l.hash?Va(l.hash,d.hash):void 0,R=_?`#${_}`:"";let L=l.state===!0?d.state:l.state?Va(l.state,d.state):{};L=Ga(d.state,L);const I=`${N}${T}${R}`;let P,A,M=!1;if(this.rewrite){const Q=new URL(I,this.origin),Y=ZS(this.rewrite,Q);P=Q.href.replace(Q.origin,""),Y.origin!==this.origin?(A=Y.href,M=!0):A=Y.pathname+Y.search+Y.hash}else P=u_(I),A=P;return{publicHref:A,href:P,pathname:N,search:E,searchStr:T,state:L,hash:_??"",external:M,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=m_(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=kp(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 E,T;let b=null,S=null,w=null,N=null;this.batch(()=>{const _=this.stores.pendingMatchesSnapshot.state,R=_.length,L=this.stores.activeMatchesSnapshot.state;b=R?L.filter(A=>!this.stores.pendingMatchStoresById.has(A.id)):null;const I=new Set;for(const A of this.stores.pendingMatchStoresById.values())A.routeId&&I.add(A.routeId);const P=new Set;for(const A of this.stores.activeMatchStoresById.values())A.routeId&&P.add(A.routeId);S=R?L.filter(A=>!I.has(A.routeId)):null,w=R?_.filter(A=>!P.has(A.routeId)):null,N=R?_.filter(A=>P.has(A.routeId)):L,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(A=>A.status!=="error"&&A.status!=="notFound"&&A.status!=="redirected")]),this.clearExpiredCache())});for(const[_,R]of[[S,"onLeave"],[w,"onEnter"],[N,"onStay"]])if(_)for(const L of _)(T=(E=this.looseRoutesById[L.routeId].options)[R])==null||T.call(E,L)})})}})}catch(v){un(v)?(r=v,this.navigate({...r.options,replace:!0,ignoreBlocker:!0})):Zt(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(un(m))return m.options.reloadDocument?void 0:await this.preloadRoute({...m.options,_fromLocation:r});Zt(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=p_(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??z_,parseSearch:e.parseSearch??L_,protocolAllowlist:e.protocolAllowlist??c_}),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?aR(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,E,T;{const V=(w==null?void 0:w.search)??e.search,k=(w==null?void 0:w._strictSearch)??void 0;try{const U=Nd(S.options.validateSearch,{...V})??void 0;N={...V,...U},E={...k,...U},T=void 0}catch(U){let $=U;if(U instanceof Id||($=new Id(U.message,{cause:U})),t!=null&&t.throwOnError)throw $;N=V,E={},T=$}}const _=((y=(g=S.options).loaderDeps)==null?void 0:y.call(g,{search:N}))??"",R=_?JSON.stringify(_):"",{interpolatedPath:L,usedParams:I}=yb({path:S.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),P=S.id+L+R,A=this.getMatch(P),M=v.get(S.id),q=(A==null?void 0:A._strictParams)??I;let z;if(!A)try{Rb(S,I,l,q)}catch(V){if(Zt(V)||un(V)?z=V:z=new J_(V.message,{cause:V}),t!=null&&t.throwOnError)throw z}Object.assign(i,q);const Q=M?"stay":"enter";let Y;if(A)Y={...A,cause:Q,params:(M==null?void 0:M.params)??i,_strictParams:q,search:Er(M?M.search:A.search,N),_strictSearch:E};else{const V=S.options.loader||S.options.beforeLoad||S.lazyFn||tw(S)?"pending":"success";Y={id:P,ssr:S.options.ssr,index:b,routeId:S.id,params:(M==null?void 0:M.params)??i,_strictParams:q,pathname:L,updatedAt:Date.now(),search:M?Er(M.search,N):N,_strictSearch:E,searchError:void 0,status:V,isFetching:!1,error:void 0,paramsError:z,__routeContext:void 0,_nonReactive:{loadPromise:xo()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:Q,loaderDeps:M?Ga(M.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||(Y.globalNotFound=m===S.id),Y.searchError=T;const B=this.getParentContext(w);Y.context={...B,...Y.__routeContext,...Y.__beforeLoadContext},h[b]=Y}for(let b=0;b<h.length;b++){const S=h[b],w=this.looseRoutesById[S.routeId],N=this.getMatch(S.id),E=v.get(S.routeId);if(S.params=E?Er(E.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:L=>this.navigate({...L,_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{},J_=class extends Error{};function eR(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 tR({pathname:e,routesById:t,processedTree:s}){const r=Object.create(null),i=Qa(e);let l,d;const f=g_(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 nR({search:e,dest:t,destRoutes:s,_includeValidateSearch:r}){return sR(s)(e,t,r??!1)}function sR(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 aR(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 rR="Error preloading route! ☝️",nw=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=KS(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=>B_({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.")}},iR=class extends nw{constructor(e){super(e)}};function Ng(e){const t=e.errorComponent??jg;return c.jsx(oR,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:s,reset:r})=>s?j.createElement(t,{error:s,reset:r}):e.children})}var oR=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 jg({error:e}){const[t,s]=j.useState(!1);return c.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[c.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),c.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"})]}),c.jsx("div",{style:{height:".25rem"}}),t?c.jsx("div",{children:c.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?c.jsx("code",{children:e.message}):null})}):null]})}function lR({children:e,fallback:t=null}){return sw()?c.jsx(Xr.Fragment,{children:e}):c.jsx(Xr.Fragment,{children:t})}function sw(){return Xr.useSyncExternalStore(cR,()=>!0,()=>!1)}function cR(){return()=>{}}var aw=j.createContext(null);function hn(e){return j.useContext(aw)}var rf=j.createContext(void 0),uR=j.createContext(void 0),ot=(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))(ot||{});function rw({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,E=N.nextSub!==void 0;if(E?(h=g.value,g=g.prev):h=N,b){if(e(v)){E&&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 Eg=0,Cr=0,zl=0;const Vs=[],{link:zI,unlink:iw,propagate:PI,checkDirty:dR,shallowPropagate:II}=rw({update(e){return e.depsTail!==void 0?pR(e):gR(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,of(e)):vR.call(e)}});function fR(){return Eg}function hR(){++Eg}function mR(){--Eg||yR()}function pR(e){e.depsTail=void 0,e.flags=5;try{const t=e.value;return t!==(e.value=e.getter(t))}finally{e.flags&=-5,of(e)}}function gR(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function xR(e){const t=e.flags;if(t&16||t&32&&dR(e.deps,e)){e.depsTail=void 0,e.flags=6;try{e.fn()}finally{e.flags&=-5,of(e)}}else e.flags=2}function yR(){try{for(;Cr<zl;){const e=Vs[Cr];Vs[Cr++]=void 0,xR(e)}}finally{for(;Cr<zl;){const e=Vs[Cr];Vs[Cr++]=void 0,e.flags|=10}Cr=0,zl=0}}function vR(){this.depsTail=void 0,this.flags=0,of(this);const e=this.subs;e!==void 0&&iw(e)}function of(e){const t=e.depsTail;let s=t!==void 0?t.nextDep:e.deps;for(;s!==void 0;)s=iw(s,e)}function Cg(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 Dp=[];let jd=0;const{link:Tb,unlink:bR,propagate:SR,checkDirty:ow,shallowPropagate:Ab}=rw({update(e){return e._update()},notify(e){Dp[Lp++]=e,e.flags&=~ot.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=ot.Mutable|ot.Dirty,Bd(e))}});let Xu=0,Lp=0,rs;function Bd(e){const t=e.depsTail;let s=t!==void 0?t.nextDep:e.deps;for(;s!==void 0;)s=bR(s,e)}function lw(){if(!(fR()>0)){for(;Xu<Lp;){const e=Dp[Xu];Dp[Xu++]=void 0,e.notify()}Xu=0,Lp=0}}function cw(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?ot.None:ot.Mutable,get(){return rs!==void 0&&Tb(i,rs,jd),i._snapshot},subscribe(l){const d=Cg(l),f={current:!1},m=wR(()=>{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=rs,f=Object.is;if(s)rs=i,++jd,i.depsTail=void 0;else if(l===void 0)return!1;s&&(i.flags=ot.Mutable|ot.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{rs=d,s&&(i.flags&=~ot.RecursedCheck),Bd(i)}}};return s?(i.flags=ot.Mutable|ot.Dirty,i.get=function(){const l=i.flags;if(l&ot.Dirty||l&ot.Pending&&ow(i.deps,i)){if(i._update()){const d=i.subs;d!==void 0&&Ab(d)}}else l&ot.Pending&&(i.flags=l&~ot.Pending);return rs!==void 0&&Tb(i,rs,jd),i._snapshot}):i.set=function(l){if(i._update(l)){const d=i.subs;d!==void 0&&(SR(d),Ab(d),lw())}},i}function wR(e){const t=()=>{const r=rs;rs=s,++jd,s.depsTail=void 0,s.flags=ot.Watching|ot.RecursedCheck;try{return e()}finally{rs=r,s.flags&=~ot.RecursedCheck,Bd(s)}},s={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:ot.Watching|ot.RecursedCheck,notify(){const r=this.flags;r&ot.Dirty||r&ot.Pending&&ow(this.deps,this)?t():this.flags=ot.Watching},stop(){this.flags=ot.None,this.depsTail=void 0,Bd(this)}};return t(),s}class NR{constructor(t){this.atom=cw(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Cg(t))}}class jR{constructor(t){this.atom=cw(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(Cg(t))}}function Mb(e){return typeof e=="function"?new jR(e):new NR(e)}function uw(e){try{hR(),e()}finally{mR(),lw()}}var rp={exports:{}},ip={},op={exports:{}},lp={};/**
|
|
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 ER(){if(kb)return lp;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 lp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,lp}var Ob;function CR(){return Ob||(Ob=1,op.exports=ER()),op.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 _R(){if(Db)return ip;Db=1;var e=pc(),t=CR();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 ip.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 E(I){if(!T){if(T=!0,_=I,I=y(I),b!==void 0&&w.hasValue){var P=w.value;if(b(P,I))return R=P}return R=I}if(P=R,r(_,I))return P;var A=y(I);return b!==void 0&&b(P,A)?(_=I,P):(_=I,R=A)}var T=!1,_,R,L=g===void 0?null:g;return[function(){return E(v())},L===null?void 0:function(){return E(L())}]},[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},ip}var Lb;function RR(){return Lb||(Lb=1,rp.exports=_R()),rp.exports}var dw=RR();const TR=xg(dw);function AR(e,t){return e===t}function fn(e,t,s=AR){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 dw.useSyncExternalStoreWithSelector(r,i,i,t,s)}var MR={state:void 0,get:()=>{},subscribe:()=>()=>{}};function Ja(e){const t=hn(),s=j.useContext(e.from?uR:rf),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 fn(i??MR,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 _g(e){return Ja({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Rg(e){const{select:t,...s}=e;return Ja({...s,select:r=>t?t(r.loaderDeps):r.loaderDeps})}function lf(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 Tg(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 Wt(e){const t=hn();return j.useCallback(s=>t.navigate({...s,from:s.from??(e==null?void 0:e.from)}),[e==null?void 0:e.from,t])}function Ag(e){return Ja({...e,select:t=>e.select?e.select(t.context):t.context})}var Mg=YS();const kR=xg(Mg);function OR(e,t){const s=hn(),r=s_(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:E,style:T,className:_,onClick:R,onBlur:L,onFocus:I,onMouseEnter:P,onMouseLeave:A,onTouchStart:M,ignoreBlocker:q,params:z,search:Q,hash:Y,state:B,mask:V,reloadDocument:k,unsafeRelative:U,from:$,_fromLocation:F,...H}=e,D=sw(),G=j.useMemo(()=>e,[s,e.from,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),J=fn(s.stores.location,Ae=>Ae,(Ae,pt)=>Ae.href===pt.href),se=j.useMemo(()=>{const Ae={_fromLocation:J,...G};return s.buildLocation(Ae)},[s,J,G]),oe=se.maskedLocation?se.maskedLocation.publicHref:se.publicHref,ce=se.maskedLocation?se.maskedLocation.external:se.external,de=j.useMemo(()=>BR(oe,ce,s.history,E),[E,ce,oe,s.history]),ue=j.useMemo(()=>{if(de!=null&&de.external)return Dd(de.href,s.protocolAllowlist)?void 0:de.href;if(!HR(f)&&!(typeof f!="string"||f.indexOf(":")===-1))try{return new URL(f),Dd(f,s.protocolAllowlist)?void 0:f}catch{}},[f,de,s.protocolAllowlist]),fe=j.useMemo(()=>{if(ue)return!1;if(d!=null&&d.exact){if(!w_(J.pathname,se.pathname,s.basepath))return!1}else{const Ae=Ld(J.pathname,s.basepath),pt=Ld(se.pathname,s.basepath);if(!(Ae.startsWith(pt)&&(Ae.length===pt.length||Ae[pt.length]==="/")))return!1}return((d==null?void 0:d.includeSearch)??!0)&&!Vr(J.search,se.search,{partial:!(d!=null&&d.exact),ignoreUndefined:!(d!=null&&d.explicitUndefined)})?!1:d!=null&&d.includeHash?D&&J.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,J,ue,D,se.hash,se.pathname,se.search,s.basepath]),Ce=fe?Va(i,{})??DR:cp,be=fe?cp:Va(l,{})??cp,xe=[_,Ce.className,be.className].filter(Boolean).join(" "),ve=(T||Ce.style||be.style)&&{...T,...Ce.style,...be.style},[Te,Ve]=j.useState(!1),Oe=j.useRef(!1),tt=e.reloadDocument||ue?!1:m??s.options.defaultPreload,me=h??s.options.defaultPreloadDelay??0,Pe=j.useCallback(()=>{s.preloadRoute({...G,_builtLocation:se}).catch(Ae=>{console.warn(Ae),console.warn(rR)})},[s,G,se]);n_(r,j.useCallback(Ae=>{Ae!=null&&Ae.isIntersecting&&Pe()},[Pe]),IR,{disabled:!!E||tt!=="viewport"}),j.useEffect(()=>{Oe.current||!E&&tt==="render"&&(Pe(),Oe.current=!0)},[E,Pe,tt]);const rt=Ae=>{const pt=Ae.currentTarget.getAttribute("target"),Lt=N!==void 0?N:pt;if(!E&&!UR(Ae)&&!Ae.defaultPrevented&&(!Lt||Lt==="_self")&&Ae.button===0){Ae.preventDefault(),Mg.flushSync(()=>{Ve(!0)});const Wn=s.subscribe("onResolved",()=>{Wn(),Ve(!1)});s.navigate({...G,replace:g,resetScroll:b,hashScrollIntoView:v,startTransition:y,viewTransition:S,ignoreBlocker:q})}};if(ue)return{...H,ref:r,href:ue,...w&&{children:w},...N&&{target:N},...E&&{disabled:E},...T&&{style:T},..._&&{className:_},...R&&{onClick:R},...L&&{onBlur:L},...I&&{onFocus:I},...P&&{onMouseEnter:P},...A&&{onMouseLeave:A},...M&&{onTouchStart:M}};const dt=Ae=>{if(E||tt!=="intent")return;if(!me){Pe();return}const pt=Ae.currentTarget;if(Cl.has(pt))return;const Lt=setTimeout(()=>{Cl.delete(pt),Pe()},me);Cl.set(pt,Lt)},mn=Ae=>{E||tt!=="intent"||Pe()},Zn=Ae=>{if(E||!tt||!me)return;const pt=Ae.currentTarget,Lt=Cl.get(pt);Lt&&(clearTimeout(Lt),Cl.delete(pt))};return{...H,...Ce,...be,href:de==null?void 0:de.href,ref:r,onClick:Gi([R,rt]),onBlur:Gi([L,Zn]),onFocus:Gi([I,dt]),onMouseEnter:Gi([P,dt]),onMouseLeave:Gi([A,Zn]),onTouchStart:Gi([M,mn]),disabled:!!E,target:N,...ve&&{style:ve},...xe&&{className:xe},...E&&LR,...fe&&zR,...D&&Te&&PR}}var cp={},DR={className:"active"},LR={role:"link","aria-disabled":!0},zR={"data-status":"active","aria-current":"page"},PR={"data-transitioning":"transitioning"},Cl=new WeakMap,IR={rootMargin:"100px"},Gi=e=>t=>{for(const s of e)if(s){if(t.defaultPrevented)return;s(t)}};function BR(e,t,s,r){if(!r)return t?{href:e,external:!0}:{href:s.createHref(e)||"/",external:!1}}function HR(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}=OR(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 UR(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var $R=class extends nw{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=>Ag({...t,from:this.id}),this.useSearch=t=>Tg({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>lf({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Rg({...t,from:this.id}),this.useLoaderData=t=>_g({...t,from:this.id}),this.useNavigate=()=>Wt({from:this.fullPath}),this.Link=Xr.forwardRef((t,s)=>c.jsx(gc,{ref:s,from:this.fullPath,...t}))}};function Ot(e){return new $R(e)}var qR=class extends iR{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=>Ag({...t,from:this.id}),this.useSearch=t=>Tg({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useParams=t=>lf({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Rg({...t,from:this.id}),this.useLoaderData=t=>_g({...t,from:this.id}),this.useNavigate=()=>Wt({from:this.fullPath}),this.Link=Xr.forwardRef((t,s)=>c.jsx(gc,{ref:s,from:this.fullPath,...t}))}};function VR(e){return new qR(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=Ot(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=>Ag({...t,from:this.options.id}),this.useSearch=t=>Tg({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useParams=t=>lf({select:t==null?void 0:t.select,structuralSharing:t==null?void 0:t.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>Rg({...t,from:this.options.id}),this.useLoaderData=t=>_g({...t,from:this.options.id}),this.useNavigate=()=>Wt({from:hn().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 GR(e){const t=hn(),s=`not-found-${fn(t.stores.location,r=>r.pathname)}-${fn(t.stores.status,r=>r)}`;return c.jsx(Ng,{getResetKey:()=>s,onCatch:(r,i)=>{var l;if(Zt(r))(l=e.onCatch)==null||l.call(e,r,i);else throw r},errorComponent:({error:r})=>{var i;if(Zt(r))return(i=e.fallback)==null?void 0:i.call(e,r);throw r},children:e.children})}function YR(){return c.jsx("p",{children:"Not Found"})}function Xi(e){return c.jsx(c.Fragment,{children:e.children})}function fw(e,t,s){return t.options.notFoundComponent?c.jsx(t.options.notFoundComponent,{...s}):e.options.defaultNotFoundComponent?c.jsx(e.options.defaultNotFoundComponent,{...s}):c.jsx(YR,{})}function QR(){return hn().isScrollRestoring,null}var hw=j.memo(function({matchId:t}){const s=hn(),r=s.stores.activeMatchStoresById.get(t);r||Qs();const i=fn(s.stores.loadedAt,d=>d),l=fn(r,d=>d);return c.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?c.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?Ng:Xi,b=h?GR:Xi;return c.jsxs(i.isRoot?i.options.shellComponent??Xi:Xi,{children:[c.jsx(rf.Provider,{value:t,children:c.jsx(g,{fallback:d,children:c.jsx(y,{getResetKey:()=>s,errorComponent:f||jg,onCatch:(N,E)=>{if(Zt(N))throw N;m==null||m(N,E)},children:c.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?c.jsx(lR,{fallback:d,children:c.jsx(Hb,{matchId:t})}):c.jsx(Hb,{matchId:t})})})})}),r.parentRouteId===Gr&&e.options.scrollRestoration?c.jsxs(c.Fragment,{children:[c.jsx(KR,{}),c.jsx(QR,{})]}):null]})}function KR(){const e=hn(),t=j.useRef(void 0);return c.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=hn(),r=s.stores.activeMatchStoresById.get(t);r||Qs();const i=fn(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?c.jsx(b,{},f):c.jsx(mw,{})},[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 Zt(i.error)||Qs(),fw(s,d,i.error);if(i.status==="redirected")throw un(i.error)||Qs(),(y=s.getMatch(i.id))==null?void 0:y._nonReactive.loadPromise;if(i.status==="error")throw i.error;return m}),mw=j.memo(function(){const t=hn(),s=j.useContext(rf);let r,i=!1,l;{const h=s?t.stores.activeMatchStoresById.get(s):void 0;[r,i]=fn(h,v=>[v==null?void 0:v.routeId,(v==null?void 0:v.globalNotFound)??!1]),l=fn(t.stores.matchesId,v=>v[v.findIndex(g=>g===s)+1])}const d=r?t.routesById[r]:void 0,f=t.options.defaultPendingComponent?c.jsx(t.options.defaultPendingComponent,{}):null;if(i)return d||Qs(),fw(t,d,void 0);if(!l)return null;const m=c.jsx(hw,{matchId:l});return r===Gr?c.jsx(j.Suspense,{fallback:f,children:m}):m});function XR(){const e=hn(),t=j.useRef({router:e,mounted:!1}),[s,r]=j.useState(!1),i=fn(e.stores.isLoading,g=>g),l=fn(e.stores.hasPendingMatches,g=>g),d=Zm(i),f=i||s||l,m=Zm(f),h=i||l,v=Zm(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]),Fu(()=>{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]),Fu(()=>{d&&!i&&e.emit({type:"onLoad",...eo(e.stores.location.state,e.stores.resolvedLocation.state)})},[d,e,i]),Fu(()=>{v&&!h&&e.emit({type:"onBeforeRouteMount",...eo(e.stores.location.state,e.stores.resolvedLocation.state)})},[h,v,e]),Fu(()=>{if(m&&!f){const g=eo(e.stores.location.state,e.stores.resolvedLocation.state);e.emit({type:"onResolved",...g}),uw(()=>{e.stores.status.setState(()=>"idle"),e.stores.resolvedLocation.setState(()=>e.stores.location.state)}),g.hrefChanged&&k_(e)}},[f,m,e]),null}function ZR(){const e=hn(),t=e.routesById[Gr].options.pendingComponent??e.options.defaultPendingComponent,s=t?c.jsx(t,{}):null,r=c.jsxs(typeof document<"u"&&e.ssr?Xi:j.Suspense,{fallback:s,children:[c.jsx(XR,{}),c.jsx(WR,{})]});return e.options.InnerWrap?c.jsx(e.options.InnerWrap,{children:r}):r}function WR(){const e=hn(),t=fn(e.stores.firstMatchId,i=>i),s=fn(e.stores.loadedAt,i=>i),r=t?c.jsx(hw,{matchId:t}):null;return c.jsx(rf.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?r:c.jsx(Ng,{getResetKey:()=>s,errorComponent:jg,onCatch:void 0,children:r})})}var JR=e=>({createMutableStore:Mb,createReadonlyStore:Mb,batch:uw}),eT=e=>new tT(e),tT=class extends W_{constructor(e){super(e,JR)}};typeof globalThis<"u"?(globalThis.createFileRoute=zb,globalThis.createLazyFileRoute=Bb):typeof window<"u"&&(window.createFileRoute=zb,window.createLazyFileRoute=Bb);function nT({router:e,children:t,...s}){Object.keys(s).length>0&&e.update({...e.options,...s,context:{...e.options.context,...s.context}});const r=c.jsx(aw.Provider,{value:e,children:t});return e.options.Wrap?c.jsx(e.options.Wrap,{children:r}):r}function sT({router:e,...t}){return c.jsx(nT,{router:e,...t,children:c.jsx(ZR,{})})}function cf(e){const t=hn({warn:(e==null?void 0:e.router)===void 0}),s=(e==null?void 0:e.router)||t,r=j.useRef(void 0);return fn(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,LS,aT=(LS=class extends Eo{constructor(){super();je(this,Lr);je(this,La);je(this,ao);he(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),he(this,La,void 0))}setEventListener(t){var s;he(this,ao,t),(s=X(this,La))==null||s.call(this),he(this,La,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){X(this,Lr)!==t&&(he(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,LS),kg=new aT,rT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},za,gg,zS,iT=(zS=class{constructor(){je(this,za,rT);je(this,gg,!1)}setTimeoutProvider(e){he(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,gg=new WeakMap,zS),Mr=new iT;function oT(e){setTimeout(e,0)}var lT=typeof window>"u"||"Deno"in globalThis;function Ft(){}function cT(e,t){return typeof e=="function"?e(t):e}function zp(e){return typeof e=="number"&&e>=0&&e!==1/0}function pw(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ka(e,t){return typeof e=="function"?e(t):e}function Ln(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!==Og(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 Og(e,t){return((t==null?void 0:t.queryKeyHashFn)||Zr)(e)}function Zr(e){return JSON.stringify(e,(t,s)=>Pp(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 uT=Object.prototype.hasOwnProperty;function gw(e,t,s=0){if(e===t)return e;if(s>500)return t;const r=qb(e)&&qb(t);if(!r&&!(Pp(e)&&Pp(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:uT.call(e,g))&&h++;continue}if(y===null||b===null||typeof y!="object"||typeof b!="object"){m[g]=b;continue}const S=gw(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 Pp(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 dT(e){return new Promise(t=>{Mr.setTimeout(t,e)})}function Ip(e,t,s){return typeof s.structuralSharing=="function"?s.structuralSharing(e,t):s.structuralSharing!==!1?gw(e,t):t}function fT(e,t,s=0){const r=[...e,t];return s&&r.length>s?r.slice(1):r}function hT(e,t,s=0){const r=[t,...e];return s&&r.length>s?r.slice(0,-1):r}var Dg=Symbol();function xw(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Dg?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Lg(e,t){return typeof e=="function"?e(...t):!!e}function mT(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=()=>lT;return{isServer(){return e()},setIsServer(t){e=t}}})();function Bp(){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 pT=oT;function gT(){let e=[],t=0,s=f=>{f()},r=f=>{f()},i=pT;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 _t=gT(),ro,Pa,io,PS,xT=(PS=class extends Eo{constructor(){super();je(this,ro,!0);je(this,Pa);je(this,io);he(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),he(this,Pa,void 0))}setEventListener(t){var s;he(this,io,t),(s=X(this,Pa))==null||s.call(this),he(this,Pa,t(this.setOnline.bind(this)))}setOnline(t){X(this,ro)!==t&&(he(this,ro,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return X(this,ro)}},ro=new WeakMap,Pa=new WeakMap,io=new WeakMap,PS),Ud=new xT;function yT(e){return Math.min(1e3*2**e,3e4)}function yw(e){return(e??"online")==="online"?Ud.isOnline():!0}var Hp=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function vw(e){let t=!1,s=0,r;const i=Bp(),l=()=>i.status!=="pending",d=w=>{var N;if(!l()){const E=new Hp(w);y(E),(N=e.onCancel)==null||N.call(e,E)}},f=()=>{t=!0},m=()=>{t=!1},h=()=>kg.isFocused()&&(e.networkMode==="always"||Ud.isOnline())&&e.canRun(),v=()=>yw(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=E=>{(l()||h())&&w(E)},(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(E){w=Promise.reject(E)}Promise.resolve(w).then(g).catch(E=>{var I;if(l())return;const T=e.retry??(Vl.isServer()?0:3),_=e.retryDelay??yT,R=typeof _=="function"?_(s,E):_,L=T===!0||typeof T=="number"&&s<T||typeof T=="function"&&T(s,E);if(t||!L){y(E);return}s++,(I=e.onFail)==null||I.call(e,s,E),dT(R).then(()=>h()?void 0:b()).then(()=>{t?y(E):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,IS,bw=(IS=class{constructor(){je(this,zr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),zp(this.gcTime)&&he(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)),he(this,zr,void 0))}},zr=new WeakMap,IS),Pr,oo,Dn,Ir,Mt,uc,Br,wn,Sw,Bs,BS,vT=(BS=class extends bw{constructor(t){super();je(this,wn);je(this,Pr);je(this,oo);je(this,Dn);je(this,Ir);je(this,Mt);je(this,uc);je(this,Br);he(this,Br,!1),he(this,uc,t.defaultOptions),this.setOptions(t.options),this.observers=[],he(this,Ir,t.client),he(this,Dn,X(this,Ir).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,he(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,Mt))==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)),he(this,Pr,s))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&X(this,Dn).remove(this)}setData(t,s){const r=Ip(this.state.data,t,this.options);return Le(this,wn,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,wn,Bs).call(this,{type:"setState",state:t,setStateOptions:s})}cancel(t){var r,i;const s=(r=X(this,Mt))==null?void 0:r.promise;return(i=X(this,Mt))==null||i.cancel(t),s?s.then(Ft).catch(Ft):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=>Ln(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Dg||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>Ka(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:!pw(this.state.dataUpdatedAt,t)}onFocus(){var s;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(s=X(this,Mt))==null||s.continue()}onOnline(){var s;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(s=X(this,Mt))==null||s.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),X(this,Dn).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,Mt)&&(X(this,Br)||Le(this,wn,Sw).call(this)?X(this,Mt).cancel({revert:!0}):X(this,Mt).cancelRetry()),this.scheduleGc()),X(this,Dn).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Le(this,wn,Bs).call(this,{type:"invalidate"})}async fetch(t,s){var m,h,v,g,y,b,S,w,N,E,T,_;if(this.state.fetchStatus!=="idle"&&((m=X(this,Mt))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(s!=null&&s.cancelRefetch))this.cancel({silent:!0});else if(X(this,Mt))return X(this,Mt).continueRetry(),X(this,Mt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const R=this.observers.find(L=>L.options.queryFn);R&&this.setOptions(R.options)}const r=new AbortController,i=R=>{Object.defineProperty(R,"signal",{enumerable:!0,get:()=>(he(this,Br,!0),r.signal)})},l=()=>{const R=xw(this.options,s),I=(()=>{const P={client:X(this,Ir),queryKey:this.queryKey,meta:this.meta};return i(P),P})();return he(this,Br,!1),this.options.persister?this.options.persister(R,I,this):R(I)},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),he(this,oo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((v=f.fetchOptions)==null?void 0:v.meta))&&Le(this,wn,Bs).call(this,{type:"fetch",meta:(g=f.fetchOptions)==null?void 0:g.meta}),he(this,Mt,vw({initialPromise:s==null?void 0:s.initialPromise,fn:f.fetchFn,onCancel:R=>{R instanceof Hp&&R.revert&&this.setState({...X(this,oo),fetchStatus:"idle"}),r.abort()},onFail:(R,L)=>{Le(this,wn,Bs).call(this,{type:"failed",failureCount:R,error:L})},onPause:()=>{Le(this,wn,Bs).call(this,{type:"pause"})},onContinue:()=>{Le(this,wn,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,Mt).start();if(R===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(R),(b=(y=X(this,Dn).config).onSuccess)==null||b.call(y,R,this),(w=(S=X(this,Dn).config).onSettled)==null||w.call(S,R,this.state.error,this),R}catch(R){if(R instanceof Hp){if(R.silent)return X(this,Mt).promise;if(R.revert){if(this.state.data===void 0)throw R;return this.state.data}}throw Le(this,wn,Bs).call(this,{type:"error",error:R}),(E=(N=X(this,Dn).config).onError)==null||E.call(N,R,this),(_=(T=X(this,Dn).config).onSettled)==null||_.call(T,this.state.data,R,this),R}finally{this.scheduleGc()}}},Pr=new WeakMap,oo=new WeakMap,Dn=new WeakMap,Ir=new WeakMap,Mt=new WeakMap,uc=new WeakMap,Br=new WeakMap,wn=new WeakSet,Sw=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,...ww(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 he(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),_t.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),X(this,Dn).notify({query:this,type:"updated",action:t})})},BS);function ww(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:yw(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 ln,qe,dc,Qt,Hr,lo,Hs,Ia,fc,co,uo,Ur,$r,Ba,fo,Ke,Ol,Up,$p,qp,Vp,Gp,Yp,Qp,Nw,HS,bT=(HS=class extends Eo{constructor(t,s){super();je(this,Ke);je(this,ln);je(this,qe);je(this,dc);je(this,Qt);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,he(this,ln,t),he(this,Ia,null),he(this,Hs,Bp()),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,Vp).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,Gp).call(this),Le(this,Ke,Yp).call(this),X(this,qe).removeObserver(this)}setOptions(t){const s=this.options,r=X(this,qe);if(this.options=X(this,ln).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ln(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,Qp).call(this),X(this,qe).setOptions(this.options),s._defaulted&&!Hd(this.options,s)&&X(this,ln).getQueryCache().notify({type:"observerOptionsUpdated",query:X(this,qe),observer:this});const i=this.hasListeners();i&&Fb(X(this,qe),r,this.options,s)&&Le(this,Ke,Ol).call(this),this.updateResult(),i&&(X(this,qe)!==r||Ln(this.options.enabled,X(this,qe))!==Ln(s.enabled,X(this,qe))||Ka(this.options.staleTime,X(this,qe))!==Ka(s.staleTime,X(this,qe)))&&Le(this,Ke,Up).call(this);const l=Le(this,Ke,$p).call(this);i&&(X(this,qe)!==r||Ln(this.options.enabled,X(this,qe))!==Ln(s.enabled,X(this,qe))||l!==X(this,Ba))&&Le(this,Ke,qp).call(this,l)}getOptimisticResult(t){const s=X(this,ln).getQueryCache().build(X(this,ln),t),r=this.createResult(s,t);return wT(this,r)&&(he(this,Qt,r),he(this,lo,this.options),he(this,Hr,X(this,qe).state)),r}getCurrentResult(){return X(this,Qt)}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,ln).defaultQueryOptions(t),r=X(this,ln).getQueryCache().build(X(this,ln),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,Qt)))}createResult(t,s){var M;const r=X(this,qe),i=this.options,l=X(this,Qt),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 q=this.hasListeners(),z=!q&&Qb(t,s),Q=q&&Fb(t,r,s,i);(z||Q)&&(g={...g,...ww(v.data,t.options)}),s._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:S,errorUpdatedAt:w,status:N}=g;b=g.data;let E=!1;if(s.placeholderData!==void 0&&b===void 0&&N==="pending"){let q;l!=null&&l.isPlaceholderData&&s.placeholderData===(f==null?void 0:f.placeholderData)?(q=l.data,E=!0):q=typeof s.placeholderData=="function"?s.placeholderData((M=X(this,uo))==null?void 0:M.state.data,X(this,uo)):s.placeholderData,q!==void 0&&(N="success",b=Ip(l==null?void 0:l.data,q,s),y=!0)}if(s.select&&b!==void 0&&!E)if(l&&b===(d==null?void 0:d.data)&&s.select===X(this,fc))b=X(this,co);else try{he(this,fc,s.select),b=s.select(b),b=Ip(l==null?void 0:l.data,b,s),he(this,co,b),he(this,Ia,null)}catch(q){he(this,Ia,q)}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",L=_&&T,I=b!==void 0,A={status:N,fetchStatus:g.fetchStatus,isPending:_,isSuccess:N==="success",isError:R,isInitialLoading:L,isLoading:L,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&&!I,isPaused:g.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:R&&I,isStale:zg(t,s),refetch:this.refetch,promise:X(this,Hs),isEnabled:Ln(s.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const q=A.data!==void 0,z=A.status==="error"&&!q,Q=V=>{z?V.reject(A.error):q&&V.resolve(A.data)},Y=()=>{const V=he(this,Hs,A.promise=Bp());Q(V)},B=X(this,Hs);switch(B.status){case"pending":t.queryHash===r.queryHash&&Q(B);break;case"fulfilled":(z||A.data!==B.value)&&Y();break;case"rejected":(!z||A.error!==B.reason)&&Y();break}}return A}updateResult(){const t=X(this,Qt),s=this.createResult(X(this,qe),this.options);if(he(this,Hr,X(this,qe).state),he(this,lo,this.options),X(this,Hr).data!==void 0&&he(this,uo,X(this,qe)),Hd(s,t))return;he(this,Qt,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,Qt)).some(f=>{const m=f;return X(this,Qt)[m]!==t[m]&&d.has(m)})};Le(this,Ke,Nw).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Le(this,Ke,Vp).call(this)}},ln=new WeakMap,qe=new WeakMap,dc=new WeakMap,Qt=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,Qp).call(this);let s=X(this,qe).fetch(this.options,t);return t!=null&&t.throwOnError||(s=s.catch(Ft)),s},Up=function(){Le(this,Ke,Gp).call(this);const t=Ka(this.options.staleTime,X(this,qe));if(Vl.isServer()||X(this,Qt).isStale||!zp(t))return;const r=pw(X(this,Qt).dataUpdatedAt,t)+1;he(this,Ur,Mr.setTimeout(()=>{X(this,Qt).isStale||this.updateResult()},r))},$p=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(X(this,qe)):this.options.refetchInterval)??!1},qp=function(t){Le(this,Ke,Yp).call(this),he(this,Ba,t),!(Vl.isServer()||Ln(this.options.enabled,X(this,qe))===!1||!zp(X(this,Ba))||X(this,Ba)===0)&&he(this,$r,Mr.setInterval(()=>{(this.options.refetchIntervalInBackground||kg.isFocused())&&Le(this,Ke,Ol).call(this)},X(this,Ba)))},Vp=function(){Le(this,Ke,Up).call(this),Le(this,Ke,qp).call(this,Le(this,Ke,$p).call(this))},Gp=function(){X(this,Ur)&&(Mr.clearTimeout(X(this,Ur)),he(this,Ur,void 0))},Yp=function(){X(this,$r)&&(Mr.clearInterval(X(this,$r)),he(this,$r,void 0))},Qp=function(){const t=X(this,ln).getQueryCache().build(X(this,ln),this.options);if(t===X(this,qe))return;const s=X(this,qe);he(this,qe,t),he(this,dc,t.state),this.hasListeners()&&(s==null||s.removeObserver(this),t.addObserver(this))},Nw=function(t){_t.batch(()=>{t.listeners&&this.listeners.forEach(s=>{s(X(this,Qt))}),X(this,ln).getQueryCache().notify({query:X(this,qe),type:"observerResultsUpdated"})})},HS);function ST(e,t){return Ln(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Qb(e,t){return ST(e,t)||e.state.data!==void 0&&Fp(e,t,t.refetchOnMount)}function Fp(e,t,s){if(Ln(t.enabled,e)!==!1&&Ka(t.staleTime,e)!=="static"){const r=typeof s=="function"?s(e):s;return r==="always"||r!==!1&&zg(e,t)}return!1}function Fb(e,t,s,r){return(e!==t||Ln(r.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&zg(e,s)}function zg(e,t){return Ln(t.enabled,e)!==!1&&e.isStaleByTime(Ka(t.staleTime,e))}function wT(e,t){return!Hd(e.getCurrentResult(),t)}function Kb(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=_=>{mT(_,()=>t.signal,()=>w=!0)},E=xw(t.options,t.fetchOptions),T=async(_,R,L)=>{if(w)return Promise.reject();if(R==null&&_.pages.length)return Promise.resolve(_);const P=(()=>{const z={client:t.client,queryKey:t.queryKey,pageParam:R,direction:L?"backward":"forward",meta:t.options.meta};return N(z),z})(),A=await E(P),{maxPages:M}=t.options,q=L?hT:fT;return{pages:q(_.pages,A,M),pageParams:q(_.pageParams,R,M)}};if(i&&l.length){const _=i==="backward",R=_?NT:Xb,L={pages:l,pageParams:d},I=R(r,L);f=await T(L,I,_)}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 NT(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,is,qt,qr,os,Ma,US,jT=(US=class extends bw{constructor(t){super();je(this,os);je(this,hc);je(this,is);je(this,qt);je(this,qr);he(this,hc,t.client),this.mutationId=t.mutationId,he(this,qt,t.mutationCache),he(this,is,[]),this.state=t.state||jw(),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,is).includes(t)||(X(this,is).push(t),this.clearGcTimeout(),X(this,qt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){he(this,is,X(this,is).filter(s=>s!==t)),this.scheduleGc(),X(this,qt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){X(this,is).length||(this.state.status==="pending"?this.scheduleGc():X(this,qt).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,E,T,_,R,L,I,P;const s=()=>{Le(this,os,Ma).call(this,{type:"continue"})},r={client:X(this,hc),meta:this.options.meta,mutationKey:this.options.mutationKey};he(this,qr,vw({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(A,M)=>{Le(this,os,Ma).call(this,{type:"failed",failureCount:A,error:M})},onPause:()=>{Le(this,os,Ma).call(this,{type:"pause"})},onContinue:s,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>X(this,qt).canRun(this)}));const i=this.state.status==="pending",l=!X(this,qr).canStart();try{if(i)s();else{Le(this,os,Ma).call(this,{type:"pending",variables:t,isPaused:l}),X(this,qt).config.onMutate&&await X(this,qt).config.onMutate(t,this,r);const M=await((f=(d=this.options).onMutate)==null?void 0:f.call(d,t,r));M!==this.state.context&&Le(this,os,Ma).call(this,{type:"pending",context:M,variables:t,isPaused:l})}const A=await X(this,qr).start();return await((h=(m=X(this,qt).config).onSuccess)==null?void 0:h.call(m,A,t,this.state.context,this,r)),await((g=(v=this.options).onSuccess)==null?void 0:g.call(v,A,t,this.state.context,r)),await((b=(y=X(this,qt).config).onSettled)==null?void 0:b.call(y,A,null,this.state.variables,this.state.context,this,r)),await((w=(S=this.options).onSettled)==null?void 0:w.call(S,A,null,t,this.state.context,r)),Le(this,os,Ma).call(this,{type:"success",data:A}),A}catch(A){try{await((E=(N=X(this,qt).config).onError)==null?void 0:E.call(N,A,t,this.state.context,this,r))}catch(M){Promise.reject(M)}try{await((_=(T=this.options).onError)==null?void 0:_.call(T,A,t,this.state.context,r))}catch(M){Promise.reject(M)}try{await((L=(R=X(this,qt).config).onSettled)==null?void 0:L.call(R,void 0,A,this.state.variables,this.state.context,this,r))}catch(M){Promise.reject(M)}try{await((P=(I=this.options).onSettled)==null?void 0:P.call(I,void 0,A,t,this.state.context,r))}catch(M){Promise.reject(M)}throw Le(this,os,Ma).call(this,{type:"error",error:A}),A}finally{X(this,qt).runNext(this)}}},hc=new WeakMap,is=new WeakMap,qt=new WeakMap,qr=new WeakMap,os=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),_t.batch(()=>{X(this,is).forEach(r=>{r.onMutationUpdate(t)}),X(this,qt).notify({mutation:this,type:"updated",action:t})})},US);function jw(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Us,$n,mc,$S,ET=($S=class extends Eo{constructor(t={}){super();je(this,Us);je(this,$n);je(this,mc);this.config=t,he(this,Us,new Set),he(this,$n,new Map),he(this,mc,0)}build(t,s,r){const i=new jT({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,$n).get(s);r?r.push(t):X(this,$n).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,$n).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,$n).delete(s)}}this.notify({type:"removed",mutation:t})}canRun(t){const s=Zu(t);if(typeof s=="string"){const r=X(this,$n).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,$n).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(){_t.batch(()=>{X(this,Us).forEach(t=>{this.notify({type:"removed",mutation:t})}),X(this,Us).clear(),X(this,$n).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){_t.batch(()=>{this.listeners.forEach(s=>{s(t)})})}resumePausedMutations(){const t=this.getAll().filter(s=>s.state.isPaused);return _t.batch(()=>Promise.all(t.map(s=>s.continue().catch(Ft))))}},Us=new WeakMap,$n=new WeakMap,mc=new WeakMap,$S);function Zu(e){var t;return(t=e.options.scope)==null?void 0:t.id}var $s,Ha,cn,qs,Fs,Ed,Kp,qS,CT=(qS=class extends Eo{constructor(s,r){super();je(this,Fs);je(this,$s);je(this,Ha);je(this,cn);je(this,qs);he(this,$s,s),this.setOptions(r),this.bindMethods(),Le(this,Fs,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,cn),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Zr(r.mutationKey)!==Zr(this.options.mutationKey)?this.reset():((i=X(this,cn))==null?void 0:i.state.status)==="pending"&&X(this,cn).setOptions(this.options)}onUnsubscribe(){var s;this.hasListeners()||(s=X(this,cn))==null||s.removeObserver(this)}onMutationUpdate(s){Le(this,Fs,Ed).call(this),Le(this,Fs,Kp).call(this,s)}getCurrentResult(){return X(this,Ha)}reset(){var s;(s=X(this,cn))==null||s.removeObserver(this),he(this,cn,void 0),Le(this,Fs,Ed).call(this),Le(this,Fs,Kp).call(this)}mutate(s,r){var i;return he(this,qs,r),(i=X(this,cn))==null||i.removeObserver(this),he(this,cn,X(this,$s).getMutationCache().build(X(this,$s),this.options)),X(this,cn).addObserver(this),X(this,cn).execute(s)}},$s=new WeakMap,Ha=new WeakMap,cn=new WeakMap,qs=new WeakMap,Fs=new WeakSet,Ed=function(){var r;const s=((r=X(this,cn))==null?void 0:r.state)??jw();he(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})},Kp=function(s){_t.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))})})},qS),ls,VS,_T=(VS=class extends Eo{constructor(t={}){super();je(this,ls);this.config=t,he(this,ls,new Map)}build(t,s,r){const i=s.queryKey,l=s.queryHash??Og(i,s);let d=this.get(l);return d||(d=new vT({client:t,queryKey:i,queryHash:l,options:t.defaultQueryOptions(s),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(d)),d}add(t){X(this,ls).has(t.queryHash)||(X(this,ls).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const s=X(this,ls).get(t.queryHash);s&&(t.destroy(),s===t&&X(this,ls).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){_t.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return X(this,ls).get(t)}getAll(){return[...X(this,ls).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){_t.batch(()=>{this.listeners.forEach(s=>{s(t)})})}onFocus(){_t.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){_t.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ls=new WeakMap,VS),mt,Ua,$a,ho,mo,qa,po,go,GS,RT=(GS=class{constructor(e={}){je(this,mt);je(this,Ua);je(this,$a);je(this,ho);je(this,mo);je(this,qa);je(this,po);je(this,go);he(this,mt,e.queryCache||new _T),he(this,Ua,e.mutationCache||new ET),he(this,$a,e.defaultOptions||{}),he(this,ho,new Map),he(this,mo,new Map),he(this,qa,0)}mount(){Qu(this,qa)._++,X(this,qa)===1&&(he(this,po,kg.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,mt).onFocus())})),he(this,go,Ud.subscribe(async e=>{e&&(await this.resumePausedMutations(),X(this,mt).onOnline())})))}unmount(){var e,t;Qu(this,qa)._--,X(this,qa)===0&&((e=X(this,po))==null||e.call(this),he(this,po,void 0),(t=X(this,go))==null||t.call(this),he(this,go,void 0))}isFetching(e){return X(this,mt).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,mt).get(t.queryHash))==null?void 0:s.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),s=X(this,mt).build(this,t),r=s.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime(Ka(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return X(this,mt).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,mt).get(r.queryHash),l=i==null?void 0:i.state.data,d=cT(t,l);if(d!==void 0)return X(this,mt).build(this,r).setData(d,{...s,manual:!0})}setQueriesData(e,t,s){return _t.batch(()=>X(this,mt).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,mt).get(t.queryHash))==null?void 0:s.state}removeQueries(e){const t=X(this,mt);_t.batch(()=>{t.findAll(e).forEach(s=>{t.remove(s)})})}resetQueries(e,t){const s=X(this,mt);return _t.batch(()=>(s.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const s={revert:!0,...t},r=_t.batch(()=>X(this,mt).findAll(e).map(i=>i.cancel(s)));return Promise.all(r).then(Ft).catch(Ft)}invalidateQueries(e,t={}){return _t.batch(()=>(X(this,mt).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=_t.batch(()=>X(this,mt).findAll(e).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let l=i.fetch(void 0,s);return s.throwOnError||(l=l.catch(Ft)),i.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(r).then(Ft)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const s=X(this,mt).build(this,t);return s.isStaleByTime(Ka(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ft).catch(Ft)}fetchInfiniteQuery(e){return e.behavior=Kb(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ft).catch(Ft)}ensureInfiniteQueryData(e){return e.behavior=Kb(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ud.isOnline()?X(this,Ua).resumePausedMutations():Promise.resolve()}getQueryCache(){return X(this,mt)}getMutationCache(){return X(this,Ua)}getDefaultOptions(){return X(this,$a)}setDefaultOptions(e){he(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=Og(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===Dg&&(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,mt).clear(),X(this,Ua).clear()}},mt=new WeakMap,Ua=new WeakMap,$a=new WeakMap,ho=new WeakMap,mo=new WeakMap,qa=new WeakMap,po=new WeakMap,go=new WeakMap,GS),Ew=j.createContext(void 0),Tt=e=>{const t=j.useContext(Ew);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},TT=({client:e,children:t})=>(j.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),c.jsx(Ew.Provider,{value:e,children:t})),Cw=j.createContext(!1),AT=()=>j.useContext(Cw);Cw.Provider;function MT(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var kT=j.createContext(MT()),OT=()=>j.useContext(kT),DT=(e,t,s)=>{const r=s!=null&&s.state.error&&typeof e.throwOnError=="function"?Lg(e.throwOnError,[s.state.error,s]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},LT=e=>{j.useEffect(()=>{e.clearReset()},[e])},zT=({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||Lg(s,[e.error,r])),PT=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))}},IT=(e,t)=>e.isLoading&&e.isFetching&&!t,BT=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Zb=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function HT(e,t,s){var y,b,S,w;const r=AT(),i=OT(),l=Tt(),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",PT(d),DT(d,i,f),LT(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 E=g?h.subscribe(_t.batchCalls(N)):Ft;return h.updateResult(),E},[h,g]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),j.useEffect(()=>{h.setOptions(d)},[d,h]),BT(d,v))throw Zb(d,h,i);if(zT({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()&&IT(v,r)){const N=m?Zb(d,h,i):f==null?void 0:f.promise;N==null||N.catch(Ft).finally(()=>{h.updateResult()})}return d.notifyOnChangeProps?v:h.trackResult(v)}function Rt(e,t){return HT(e,bT)}function Ht(e,t){const s=Tt(),[r]=j.useState(()=>new CT(s,e));j.useEffect(()=>{r.setOptions(e)},[r,e]);const i=j.useSyncExternalStore(j.useCallback(d=>r.subscribe(_t.batchCalls(d)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),l=j.useCallback((d,f)=>{r.mutate(d,f).catch(Ft)},[r]);if(i.error&&Lg(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:l,mutateAsync:i.mutate}}const UT=new RT({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 _w=(...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 $T=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 qT=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=qT(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 up={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 VT=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},GT=j.createContext({}),YT=()=>j.useContext(GT),QT=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=""}=YT()??{},S=r??g?Number(s??v)*24/Number(t??h):s??v;return j.createElement("svg",{ref:m,...up,width:t??h??up.width,height:t??h??up.height,stroke:e??y,strokeWidth:S,className:_w("lucide",b,i),...!l&&!VT(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 En=(e,t)=>{const s=j.forwardRef(({className:r,...i},l)=>j.createElement(QT,{ref:l,iconNode:t,className:_w(`lucide-${$T(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"}]],KT=En("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 XT=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ZT=En("chevron-left",XT);/**
|
|
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 WT=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Rw=En("chevron-right",WT);/**
|
|
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 JT=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],eA=En("circle-dot",JT);/**
|
|
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 tA=[["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"}]],nA=En("cog",tA);/**
|
|
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 sA=[["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"}]],aA=En("file-text",sA);/**
|
|
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 rA=[["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"}]],iA=En("globe",rA);/**
|
|
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 oA=[["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"}]],lA=En("layers",oA);/**
|
|
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 cA=[["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"}]],uA=En("panels-top-left",cA);/**
|
|
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 dA=[["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"}]],fA=En("server-cog",dA);/**
|
|
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 hA=[["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"}]],mA=En("server",hA);/**
|
|
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 pA=[["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"}]],gA=En("square-plus",pA);/**
|
|
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 xA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],yA=En("x",xA);async function vA(){const e=await fetch("/api/rigs/summary");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function xc(){return Rt({queryKey:["rigs","summary"],queryFn:vA})}async function bA(){const e=await fetch("/api/ps");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function Pg(){return Rt({queryKey:["ps"],queryFn:bA})}async function SA(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function Tw(e){return Rt({queryKey:["rig",e,"nodes"],queryFn:()=>SA(e),enabled:!!e})}function Aw(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=Aw(e[t]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function Mw(){for(var e,t,s=0,r="",i=arguments.length;s<i;s++)(e=arguments[s])&&(t=Aw(e))&&(r&&(r+=" "),r+=t);return r}const wA=(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},NA=(e,t)=>({classGroupId:e,validator:t}),kw=(e=new Map,t=null,s)=>({nextPart:e,validators:t,classGroupId:s}),$d="-",Jb=[],jA="arbitrary..",EA=e=>{const t=_A(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:d=>{if(d.startsWith("[")&&d.endsWith("]"))return CA(d);const f=d.split($d),m=f[0]===""&&f.length>1?1:0;return Ow(f,m,t)},getConflictingClassGroupIds:(d,f)=>{if(f){const m=r[d],h=s[d];return m?h?wA(h,m):m:h||Jb}return s[d]||Jb}}},Ow=(e,t,s)=>{if(e.length-t===0)return s.classGroupId;const i=e[t],l=s.nextPart.get(i);if(l){const h=Ow(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}},CA=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?jA+r:void 0})(),_A=e=>{const{theme:t,classGroups:s}=e;return RA(s,t)},RA=(e,t)=>{const s=kw();for(const r in e){const i=e[r];Ig(i,s,r,t)}return s},Ig=(e,t,s,r)=>{const i=e.length;for(let l=0;l<i;l++){const d=e[l];TA(d,t,s,r)}},TA=(e,t,s,r)=>{if(typeof e=="string"){AA(e,t,s);return}if(typeof e=="function"){MA(e,t,s,r);return}kA(e,t,s,r)},AA=(e,t,s)=>{const r=e===""?t:Dw(t,e);r.classGroupId=s},MA=(e,t,s,r)=>{if(OA(e)){Ig(e(r),t,s,r);return}t.validators===null&&(t.validators=[]),t.validators.push(NA(s,e))},kA=(e,t,s,r)=>{const i=Object.entries(e),l=i.length;for(let d=0;d<l;d++){const[f,m]=i[d];Ig(m,Dw(t,f),s,r)}},Dw=(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=kw(),s.nextPart.set(d,f)),s=f}return s},OA=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,DA=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)}}},Xp="!",e1=":",LA=[],t1=(e,t,s,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:s,maybePostfixModifierPosition:r,isExternal:i}),zA=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(Xp)?(y=g.slice(0,-1),b=!0):g.startsWith(Xp)&&(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(LA,!1,d,void 0,!0)}if(s){const i=r;r=l=>s({className:l,parseClassName:i})}return r},PA=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}},IA=e=>({cache:DA(e.cacheSize),parseClassName:zA(e),sortModifiers:PA(e),...EA(e)}),BA=/\s+/,HA=(e,t)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:l}=t,d=[],f=e.trim().split(BA);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,E=r(N?S.substring(0,w):S);if(!E){if(!N){m=v+(m.length>0?" "+m:m);continue}if(E=r(S),!E){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+Xp:T,R=_+E;if(d.indexOf(R)>-1)continue;d.push(R);const L=i(E,N);for(let I=0;I<L.length;++I){const P=L[I];d.push(_+P)}m=v+(m.length>0?" "+m:m)}return m},UA=(...e)=>{let t=0,s,r,i="";for(;t<e.length;)(s=e[t++])&&(r=Lw(s))&&(i&&(i+=" "),i+=r);return i},Lw=e=>{if(typeof e=="string")return e;let t,s="";for(let r=0;r<e.length;r++)e[r]&&(t=Lw(e[r]))&&(s&&(s+=" "),s+=t);return s},$A=(e,...t)=>{let s,r,i,l;const d=m=>{const h=t.reduce((v,g)=>g(v),e());return s=IA(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=HA(m,s);return i(m,v),v};return l=d,(...m)=>l(UA(...m))},qA=[],Ct=e=>{const t=s=>s[e]||qA;return t.isThemeGetter=!0,t},zw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Pw=/^\((?:(\w[\w-]*):)?(.+)\)$/i,VA=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,GA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,YA=/\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$/,QA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,FA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,KA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_a=e=>VA.test(e),ze=e=>!!e&&!Number.isNaN(Number(e)),Ra=e=>!!e&&Number.isInteger(Number(e)),dp=e=>e.endsWith("%")&&ze(e.slice(0,-1)),Ps=e=>GA.test(e),Iw=()=>!0,XA=e=>YA.test(e)&&!QA.test(e),Bg=()=>!1,ZA=e=>FA.test(e),WA=e=>KA.test(e),JA=e=>!ge(e)&&!ye(e),eM=e=>er(e,Uw,Bg),ge=e=>zw.test(e),_r=e=>er(e,$w,XA),n1=e=>er(e,lM,ze),tM=e=>er(e,Vw,Iw),nM=e=>er(e,qw,Bg),s1=e=>er(e,Bw,Bg),sM=e=>er(e,Hw,WA),Wu=e=>er(e,Gw,ZA),ye=e=>Pw.test(e),_l=e=>si(e,$w),aM=e=>si(e,qw),a1=e=>si(e,Bw),rM=e=>si(e,Uw),iM=e=>si(e,Hw),Ju=e=>si(e,Gw,!0),oM=e=>si(e,Vw,!0),er=(e,t,s)=>{const r=zw.exec(e);return r?r[1]?t(r[1]):s(r[2]):!1},si=(e,t,s=!1)=>{const r=Pw.exec(e);return r?r[1]?t(r[1]):s:!1},Bw=e=>e==="position"||e==="percentage",Hw=e=>e==="image"||e==="url",Uw=e=>e==="length"||e==="size"||e==="bg-size",$w=e=>e==="length",lM=e=>e==="number",qw=e=>e==="family-name",Vw=e=>e==="number"||e==="weight",Gw=e=>e==="shadow",cM=()=>{const e=Ct("color"),t=Ct("font"),s=Ct("text"),r=Ct("font-weight"),i=Ct("tracking"),l=Ct("leading"),d=Ct("breakpoint"),f=Ct("container"),m=Ct("spacing"),h=Ct("radius"),v=Ct("shadow"),g=Ct("inset-shadow"),y=Ct("text-shadow"),b=Ct("drop-shadow"),S=Ct("blur"),w=Ct("perspective"),N=Ct("aspect"),E=Ct("ease"),T=Ct("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"],L=()=>[...R(),ye,ge],I=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],A=()=>[ye,ge,m],M=()=>[_a,"full","auto",...A()],q=()=>[Ra,"none","subgrid",ye,ge],z=()=>["auto",{span:["full",Ra,ye,ge]},Ra,ye,ge],Q=()=>[Ra,"auto",ye,ge],Y=()=>["auto","min","max","fr",ye,ge],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],V=()=>["start","end","center","stretch","center-safe","end-safe"],k=()=>["auto",...A()],U=()=>[_a,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],$=()=>[_a,"screen","full","dvw","lvw","svw","min","max","fit",...A()],F=()=>[_a,"screen","full","lh","dvh","lvh","svh","min","max","fit",...A()],H=()=>[e,ye,ge],D=()=>[...R(),a1,s1,{position:[ye,ge]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],J=()=>["auto","cover","contain",rM,eM,{size:[ye,ge]}],se=()=>[dp,_l,_r],oe=()=>["","none","full",h,ye,ge],ce=()=>["",ze,_l,_r],de=()=>["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"],fe=()=>[ze,dp,a1,s1],Ce=()=>["","none",S,ye,ge],be=()=>["none",ze,ye,ge],xe=()=>["none",ze,ye,ge],ve=()=>[ze,ye,ge],Te=()=>[_a,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ps],breakpoint:[Ps],color:[Iw],container:[Ps],"drop-shadow":[Ps],ease:["in","out","in-out"],font:[JA],"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,ye,N]}],container:["container"],columns:[{columns:[ze,ge,ye,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:L()}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{"inset-s":M(),start:M()}],end:[{"inset-e":M(),end:M()}],"inset-bs":[{"inset-bs":M()}],"inset-be":[{"inset-be":M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[Ra,"auto",ye,ge]}],basis:[{basis:[_a,"full","auto",f,...A()]}],"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,ye,ge]}],shrink:[{shrink:["",ze,ye,ge]}],order:[{order:[Ra,"first","last","none",ye,ge]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:z()}],"col-start":[{"col-start":Q()}],"col-end":[{"col-end":Q()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:z()}],"row-start":[{"row-start":Q()}],"row-end":[{"row-end":Q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Y()}],"auto-rows":[{"auto-rows":Y()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...V(),"normal"]}],"justify-self":[{"justify-self":["auto",...V()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...V(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...V(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...V(),"baseline"]}],"place-self":[{"place-self":["auto",...V()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pbs:[{pbs:A()}],pbe:[{pbe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mbs:[{mbs:k()}],mbe:[{mbe:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...F()]}],"min-block-size":[{"min-block":["auto",...F()]}],"max-block-size":[{"max-block":["none",...F()]}],w:[{w:[f,"screen",...U()]}],"min-w":[{"min-w":[f,"screen","none",...U()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[d]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",s,_l,_r]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,oM,tM]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",dp,ge]}],"font-family":[{font:[aM,nM,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,ye,ge]}],"line-clamp":[{"line-clamp":[ze,"none",ye,n1]}],leading:[{leading:[l,...A()]}],"list-image":[{"list-image":["none",ye,ge]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ye,ge]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[ze,"from-font","auto",ye,_r]}],"text-decoration-color":[{decoration:H()}],"underline-offset":[{"underline-offset":[ze,"auto",ye,ge]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ye,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",ye,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:D()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:J()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ra,ye,ge],radial:["",ye,ge],conic:[Ra,ye,ge]},iM,sM]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:se()}],"gradient-via-pos":[{via:se()}],"gradient-to-pos":[{to:se()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],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:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-bs":[{"border-bs":H()}],"border-color-be":[{"border-be":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ze,ye,ge]}],"outline-w":[{outline:["",ze,_l,_r]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",v,Ju,Wu]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",g,Ju,Wu]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:ce()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[ze,_r]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":ce()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",y,Ju,Wu]}],"text-shadow-color":[{"text-shadow":H()}],opacity:[{opacity:[ze,ye,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":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"mask-image-radial":[{"mask-radial":[ye,ge]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"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":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:J()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ye,ge]}],filter:[{filter:["","none",ye,ge]}],blur:[{blur:Ce()}],brightness:[{brightness:[ze,ye,ge]}],contrast:[{contrast:[ze,ye,ge]}],"drop-shadow":[{"drop-shadow":["","none",b,Ju,Wu]}],"drop-shadow-color":[{"drop-shadow":H()}],grayscale:[{grayscale:["",ze,ye,ge]}],"hue-rotate":[{"hue-rotate":[ze,ye,ge]}],invert:[{invert:["",ze,ye,ge]}],saturate:[{saturate:[ze,ye,ge]}],sepia:[{sepia:["",ze,ye,ge]}],"backdrop-filter":[{"backdrop-filter":["","none",ye,ge]}],"backdrop-blur":[{"backdrop-blur":Ce()}],"backdrop-brightness":[{"backdrop-brightness":[ze,ye,ge]}],"backdrop-contrast":[{"backdrop-contrast":[ze,ye,ge]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ze,ye,ge]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ze,ye,ge]}],"backdrop-invert":[{"backdrop-invert":["",ze,ye,ge]}],"backdrop-opacity":[{"backdrop-opacity":[ze,ye,ge]}],"backdrop-saturate":[{"backdrop-saturate":[ze,ye,ge]}],"backdrop-sepia":[{"backdrop-sepia":["",ze,ye,ge]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ye,ge]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ze,"initial",ye,ge]}],ease:[{ease:["linear","initial",E,ye,ge]}],delay:[{delay:[ze,ye,ge]}],animate:[{animate:["none",T,ye,ge]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,ye,ge]}],"perspective-origin":[{"perspective-origin":L()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:xe()}],"scale-x":[{"scale-x":xe()}],"scale-y":[{"scale-y":xe()}],"scale-z":[{"scale-z":xe()}],"scale-3d":["scale-3d"],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[ye,ge,"","none","gpu","cpu"]}],"transform-origin":[{origin:L()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Te()}],"translate-x":[{"translate-x":Te()}],"translate-y":[{"translate-y":Te()}],"translate-z":[{"translate-z":Te()}],"translate-none":["translate-none"],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"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",ye,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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mbs":[{"scroll-mbs":A()}],"scroll-mbe":[{"scroll-mbe":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pbs":[{"scroll-pbs":A()}],"scroll-pbe":[{"scroll-pbe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",ye,ge]}],fill:[{fill:["none",...H()]}],"stroke-w":[{stroke:[ze,_l,_r,n1]}],stroke:[{stroke:["none",...H()]}],"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"]}},uM=$A(cM);function Re(...e){return uM(Mw(e))}function Gs(e,t=6){return e.length<=t?e:e.slice(-t)}function ds(e){if(!e)return null;const t=e.split(".");return t.length<=1?e:t[0]??e}function fs(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 Zp(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 dM(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 fM(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 hM(e){const t=e.match(/^\/rigs\/([^/]+)/);return(t==null?void 0:t[1])??null}function Hg({expanded:e,label:t,onClick:s}){return c.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:c.jsx(Rw,{className:Re("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:Re(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 c.jsx(iA,{...i});case"rig":return c.jsx(KT,{...i});case"pod":return c.jsx(lA,{...i});case"infrastructure":return c.jsx(mA,{...i});default:return c.jsx(eA,{...i})}}function mM({podId:e,nodes:t,selection:s,onSelect:r,autoExpand:i}){var v;const[l,d]=j.useState(i),f=ds((v=t[0])==null?void 0:v.logicalId)??fs(e),m=fM(t);j.useEffect(()=>{i&&d(!0)},[i]);const h=[...t].sort((g,y)=>Qr(g.logicalId).localeCompare(Qr(y.logicalId)));return c.jsxs("div",{"data-testid":`pod-branch-${f}`,children:[c.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:[c.jsx(Hg,{expanded:l,label:`pod ${f}`,onClick:()=>d(g=>!g)}),c.jsx(Gl,{kind:"pod",statusClass:Zp(m),testId:`pod-icon-${f}`}),c.jsx("span",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.12em] text-stone-600",children:f})]}),l&&c.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 c.jsxs("button",{type:"button",onClick:()=>r({type:"node",rigId:g.rigId,logicalId:g.logicalId}),"data-testid":`node-${g.logicalId}`,className:Re("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:[c.jsx(Gl,{kind:g.nodeKind==="infrastructure"?"infrastructure":"agent",statusClass:Zp(g.startupStatus),testId:`node-icon-${g.logicalId}`}),c.jsx("span",{className:"font-mono text-[10px] text-stone-700 truncate",children:b}),c.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 pM({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}=Tw(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,E])=>{var R,L;const T=S==="__ungrouped__"?"ungrouped":ds((R=w[0])==null?void 0:R.logicalId)??fs(S),_=N==="__ungrouped__"?"ungrouped":ds((L=E[0])==null?void 0:L.logicalId)??fs(N);return T.localeCompare(_)})},[h]);return c.jsxs("div",{"data-testid":`rig-tree-${e.name}`,children:[c.jsxs("div",{className:Re("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:[c.jsx(Hg,{expanded:d,label:`rig ${e.name}`,onClick:()=>f(b=>!b)}),c.jsx(Gl,{kind:"rig",statusClass:dM(m),testId:`rig-icon-${e.name}`}),c.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:Re("flex-1 truncate font-mono text-[11px] font-semibold text-stone-900",g&&"underline underline-offset-2"),children:e.name})]}),d&&c.jsxs("div",{className:"ml-4 border-l border-stone-200",children:[v&&c.jsx("div",{className:"px-4 py-1.5 font-mono text-[9px] text-stone-400",children:"Loading..."}),!v&&y.length===0&&c.jsx("div",{className:"px-4 py-1.5 font-mono text-[9px] text-stone-400",children:"No nodes"}),y.map(([b,S])=>b==="__ungrouped__"?c.jsx("div",{children:S.map(w=>{const N=(s==null?void 0:s.type)==="node"&&s.rigId===w.rigId&&s.logicalId===w.logicalId,E=Qr(w.logicalId);return c.jsxs("button",{type:"button",onClick:()=>r({type:"node",rigId:w.rigId,logicalId:w.logicalId}),"data-testid":`node-${w.logicalId}`,className:Re("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:[c.jsx(Gl,{kind:w.nodeKind==="infrastructure"?"infrastructure":"agent",statusClass:Zp(w.startupStatus),testId:`node-icon-${w.logicalId}`}),c.jsx("span",{className:"font-mono text-[10px] text-stone-700 truncate",children:E})]},w.logicalId)})},b):c.jsx(mM,{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 gM({rigs:e,psMap:t,selection:s,onSelect:r,onClose:i,currentRigId:l}){const[d,f]=j.useState(!0);return c.jsxs("div",{"data-testid":"environment-branch-local",children:[c.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:[c.jsx(Hg,{expanded:d,label:"environment Local",onClick:()=>f(m=>!m)}),c.jsx(Gl,{kind:"environment",statusClass:"text-stone-500",testId:"environment-icon-local"}),c.jsx("span",{className:"font-mono text-[11px] font-semibold uppercase tracking-[0.12em] text-stone-700",children:"env: local"})]}),d&&c.jsx("div",{className:"ml-4 border-l border-stone-200",children:!e||e.length===0?c.jsx("div",{className:"px-4 py-3 font-mono text-[10px] text-stone-400",children:"No rigs"}):e.map((m,h)=>c.jsx(pM,{rig:m,ps:t.get(m.id),selection:s,onSelect:r,onClose:i,autoExpand:m.id===l},m.id))})]})}function xM({rigs:e,psMap:t,selection:s,onSelect:r,onClose:i,currentRigId:l}){return c.jsx(c.Fragment,{children:c.jsx("div",{className:"flex-1 overflow-y-auto py-2",children:c.jsx(gM,{rigs:e,psMap:t,selection:s,onSelect:r,onClose:i,currentRigId:l})})})}function yM({open:e,onClose:t,selection:s,onSelect:r,desktopMode:i="full",onDesktopToggle:l=()=>{}}){const f=cf().location.pathname,m=hM(f),{data:h}=xc(),{data:v}=Pg(),g=new Map((v??[]).map(y=>[y.rigId,y]));return c.jsx("aside",{"data-testid":"explorer",className:Re("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:c.jsxs("div",{className:"relative flex h-full w-full flex-col",children:[c.jsx("button",{type:"button","data-testid":"explorer-edge-toggle","aria-label":i==="full"?"Collapse explorer":"Expand explorer",onClick:l,className:Re("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"?c.jsx(ZT,{className:"h-4 w-4"}):c.jsx(Rw,{className:"h-4 w-4"})}),i==="full"?c.jsx(xM,{rigs:h,psMap:g,selection:s,onSelect:r,onClose:t,currentRigId:m}):c.jsx("div",{className:"hidden h-full w-full lg:block"})]})})}const vM="modulepreload",bM=function(e){return"/"+e},r1={},SM=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=bM(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":vM,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 wM(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/snapshots`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function NM(e){return Rt({queryKey:["rig",e,"snapshots"],queryFn:()=>wM(e),enabled:!!e})}class Wp 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 Yw extends Error{constructor(s,r){super(s.error??`HTTP ${r}`);bl(this,"code");this.name="RestoreError",this.code=s.code??"unknown"}}function jM(e){const t=Tt();return Ht({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 EM(e){const t=Tt();return Ht({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 Yw(i,r.status)}return r.json()},onSuccess:()=>{t.invalidateQueries({queryKey:["rig",e]})}})}function CM(e){const t=Tt();return Ht({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 _M(e){const t=Tt();return Ht({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 RM(){const e=Tt();return Ht({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 Wp({...l,errors:l.errors??["Cycle detected in rig topology"]}):new Wp(l)}return i.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["rigs","summary"]})}})}function Qw(){const e=Tt();return Ht({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 TM(){const e=Tt();return Ht({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 AM(){const e=Tt();return Ht({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 uf(...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(uf(...e),e)}var MM=Symbol.for("react.lazy"),qd=yg[" use ".trim().toString()];function kM(e){return typeof e=="object"&&e!==null&&"then"in e}function Kw(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===MM&&"_payload"in e&&kM(e._payload)}function OM(e){const t=LM(e),s=j.forwardRef((r,i)=>{let{children:l,...d}=r;Kw(l)&&typeof qd=="function"&&(l=qd(l._payload));const f=j.Children.toArray(l),m=f.find(PM);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 c.jsx(t,{...d,ref:i,children:j.isValidElement(h)?j.cloneElement(h,void 0,v):null})}return c.jsx(t,{...d,ref:i,children:l})});return s.displayName=`${e}.Slot`,s}var DM=OM("Slot");function LM(e){const t=j.forwardRef((s,r)=>{let{children:i,...l}=s;if(Kw(i)&&typeof qd=="function"&&(i=qd(i._payload)),j.isValidElement(i)){const d=BM(i),f=IM(l,i.props);return i.type!==j.Fragment&&(f.ref=r?uf(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 zM=Symbol("radix.slottable");function PM(e){return j.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===zM}function IM(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 BM(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=Mw,Xw=(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)},HM=Xw("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"}}),we=j.forwardRef(({className:e,variant:t,size:s,asChild:r=!1,children:i,...l},d)=>{const f=r?DM:"button";return c.jsx(f,{className:Re(HM({variant:t,size:s,className:e})),ref:d,...l,children:i})});we.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 UM(e,t){const s=j.createContext(t),r=l=>{const{children:d,...f}=l,m=j.useMemo(()=>f,Object.values(f));return c.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 $M(e,t=[]){let s=[];function r(l,d){const f=j.createContext(d),m=s.length;s=[...s,d];const h=g=>{var E;const{scope:y,children:b,...S}=g,w=((E=y==null?void 0:y[e])==null?void 0:E[m])||f,N=j.useMemo(()=>S,Object.values(S));return c.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,qM(i,...t)]}function qM(...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:()=>{},VM=yg[" useId ".trim().toString()]||(()=>{}),GM=0;function fp(e){const[t,s]=j.useState(VM());return Yl(()=>{s(r=>r??String(GM++))},[e]),e||(t?`radix-${t}`:"")}var YM=yg[" useInsertionEffect ".trim().toString()]||Yl;function QM({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=KM(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 YM(()=>{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 KM(e){return typeof e=="function"}function XM(e){const t=ZM(e),s=j.forwardRef((r,i)=>{const{children:l,...d}=r,f=j.Children.toArray(l),m=f.find(JM);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 c.jsx(t,{...d,ref:i,children:j.isValidElement(h)?j.cloneElement(h,void 0,v):null})}return c.jsx(t,{...d,ref:i,children:l})});return s.displayName=`${e}.Slot`,s}function ZM(e){const t=j.forwardRef((s,r)=>{const{children:i,...l}=s;if(j.isValidElement(i)){const d=tk(i),f=ek(l,i.props);return i.type!==j.Fragment&&(f.ref=r?uf(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 WM=Symbol("radix.slottable");function JM(e){return j.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===WM}function ek(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 tk(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 nk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Xs=nk.reduce((e,t)=>{const s=XM(`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),c.jsx(m,{...f,ref:l})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function sk(e,t){e&&Mg.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 ak(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 rk="DismissableLayer",Jp="dismissableLayer.update",ik="dismissableLayer.pointerDownOutside",ok="dismissableLayer.focusOutside",c1,Zw=j.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ww=j.forwardRef((e,t)=>{const{disableOutsidePointerEvents:s=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:l,onInteractOutside:d,onDismiss:f,...m}=e,h=j.useContext(Zw),[v,g]=j.useState(null),y=(v==null?void 0:v.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=j.useState({}),S=ai(t,P=>g(P)),w=Array.from(h.layers),[N]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),E=w.indexOf(N),T=v?w.indexOf(v):-1,_=h.layersWithOutsidePointerEventsDisabled.size>0,R=T>=E,L=uk(P=>{const A=P.target,M=[...h.branches].some(q=>q.contains(A));!R||M||(i==null||i(P),d==null||d(P),P.defaultPrevented||f==null||f())},y),I=dk(P=>{const A=P.target;[...h.branches].some(q=>q.contains(A))||(l==null||l(P),d==null||d(P),P.defaultPrevented||f==null||f())},y);return ak(P=>{T===h.layers.size-1&&(r==null||r(P),!P.defaultPrevented&&f&&(P.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 P=()=>b({});return document.addEventListener(Jp,P),()=>document.removeEventListener(Jp,P)},[]),c.jsx(Xs.div,{...m,ref:S,style:{pointerEvents:_?R?"auto":"none":void 0,...e.style},onFocusCapture:Xa(e.onFocusCapture,I.onFocusCapture),onBlurCapture:Xa(e.onBlurCapture,I.onBlurCapture),onPointerDownCapture:Xa(e.onPointerDownCapture,L.onPointerDownCapture)})});Ww.displayName=rk;var lk="DismissableLayerBranch",ck=j.forwardRef((e,t)=>{const s=j.useContext(Zw),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]),c.jsx(Xs.div,{...e,ref:i})});ck.displayName=lk;function uk(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(){Jw(ik,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 dk(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&&Jw(ok,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(Jp);document.dispatchEvent(e)}function Jw(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?sk(i,l):i.dispatchEvent(l)}var hp="focusScope.autoFocusOnMount",mp="focusScope.autoFocusOnUnmount",d1={bubbles:!1,cancelable:!0},fk="FocusScope",eN=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}))},E=function(_){if(document.activeElement===document.body)for(const L of _)L.removedNodes.length>0&&ka(f)};document.addEventListener("focusin",w),document.addEventListener("focusout",N);const T=new MutationObserver(E);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 E=new CustomEvent(hp,d1);f.addEventListener(hp,h),f.dispatchEvent(E),E.defaultPrevented||(hk(yk(tN(f)),{select:!0}),document.activeElement===w&&ka(f))}return()=>{f.removeEventListener(hp,h),setTimeout(()=>{const E=new CustomEvent(mp,d1);f.addEventListener(mp,v),f.dispatchEvent(E),E.defaultPrevented||ka(w??document.body,{select:!0}),f.removeEventListener(mp,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,E=document.activeElement;if(N&&E){const T=w.currentTarget,[_,R]=mk(T);_&&R?!w.shiftKey&&E===R?(w.preventDefault(),s&&ka(_,{select:!0})):w.shiftKey&&E===_&&(w.preventDefault(),s&&ka(R,{select:!0})):E===T&&w.preventDefault()}},[s,r,b.paused]);return c.jsx(Xs.div,{tabIndex:-1,...d,ref:y,onKeyDown:S})});eN.displayName=fk;function hk(e,{select:t=!1}={}){const s=document.activeElement;for(const r of e)if(ka(r,{select:t}),document.activeElement!==s)return}function mk(e){const t=tN(e),s=f1(t,e),r=f1(t.reverse(),e);return[s,r]}function tN(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(!pk(s,{upTo:t}))return s}function pk(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 gk(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&&gk(e)&&t&&e.select()}}var h1=xk();function xk(){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 yk(e){return e.filter(t=>t.tagName!=="A")}var vk="Portal",nN=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?kR.createPortal(c.jsx(Xs.div,{...r,ref:t}),d):null});nN.displayName=vk;function bk(e,t){return j.useReducer((s,r)=>t[s][r]??s,e)}var df=e=>{const{present:t,children:s}=e,r=Sk(t),i=typeof s=="function"?s({present:r.isPresent}):j.Children.only(s),l=ai(r.ref,wk(i));return typeof s=="function"||r.isPresent?j.cloneElement(i,{ref:l}):null};df.displayName="Presence";function Sk(e){const[t,s]=j.useState(),r=j.useRef(null),i=j.useRef(e),l=j.useRef("none"),d=e?"mounted":"unmounted",[f,m]=bk(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 wk(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 pp=0;function Nk(){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()),pp++,()=>{pp===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),pp--}},[])}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 us=function(){return us=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},us.apply(this,arguments)};function sN(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 jk(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",Ek="with-scroll-bars-hidden",Ck="--removed-body-scroll-bar-size";function gp(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function _k(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 Rk=typeof window<"u"?j.useLayoutEffect:j.useEffect,g1=new WeakMap;function Tk(e,t){var s=_k(null,function(r){return e.forEach(function(i){return gp(i,r)})});return Rk(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)||gp(f,null)}),l.forEach(function(f){i.has(f)||gp(f,d)})}g1.set(s,e)},[e]),s}function Ak(e){return e}function Mk(e,t){t===void 0&&(t=Ak);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 kk(e){e===void 0&&(e={});var t=Mk(null);return t.options=us({async:!0,ssr:!1},e),t}var aN=function(e){var t=e.sideCar,s=sN(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,us({},s))};aN.isSideCarExport=!0;function Ok(e,t){return e.useMedium(t),aN}var rN=kk(),xp=function(){},ff=j.forwardRef(function(e,t){var s=j.useRef(null),r=j.useState({onScrollCapture:xp,onWheelCapture:xp,onTouchMoveCapture:xp}),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,E=e.as,T=E===void 0?"div":E,_=e.gapMode,R=sN(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),L=y,I=Tk([s,t]),P=us(us({},R),i);return j.createElement(j.Fragment,null,v&&j.createElement(L,{sideCar:rN,removeScrollBar:h,shards:g,noRelative:b,noIsolation:S,inert:w,setCallbacks:l,allowPinchZoom:!!N,lockRef:s,gapMode:_}),d?j.cloneElement(j.Children.only(f),us(us({},P),{ref:I})):j.createElement(T,us({},P,{className:m,ref:I}),f))});ff.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ff.classNames={fullWidth:_d,zeroRight:Cd};var Dk=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Lk(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Dk();return t&&e.setAttribute("nonce",t),e}function zk(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Pk(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Ik=function(){var e=0,t=null;return{add:function(s){e==0&&(t=Lk())&&(zk(t,s),Pk(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Bk=function(){var e=Ik();return function(t,s){j.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&s])}},iN=function(){var e=Bk(),t=function(s){var r=s.styles,i=s.dynamic;return e(r,i),null};return t},Hk={left:0,top:0,right:0,gap:0},yp=function(e){return parseInt(e||"",10)||0},Uk=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[yp(s),yp(r),yp(i)]},$k=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Hk;var t=Uk(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])}},qk=iN(),to="data-scroll-locked",Vk=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(Ek,` {
|
|
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(Ck,": ").concat(f,`px;
|
|
201
|
+
}
|
|
202
|
+
`)},x1=function(){var e=parseInt(document.body.getAttribute(to)||"0",10);return isFinite(e)?e:0},Gk=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())}},[])},Yk=function(e){var t=e.noRelative,s=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;Gk();var l=j.useMemo(function(){return $k(i)},[i]);return j.createElement(qk,{styles:Vk(l,!t,i,s?"":"!important")})},eg=!1;if(typeof window<"u")try{var td=Object.defineProperty({},"passive",{get:function(){return eg=!0,!0}});window.addEventListener("test",td,td),window.removeEventListener("test",td,td)}catch{eg=!1}var Yi=eg?{passive:!1}:!1,Qk=function(e){return e.tagName==="TEXTAREA"},oN=function(e,t){if(!(e instanceof Element))return!1;var s=window.getComputedStyle(e);return s[t]!=="hidden"&&!(s.overflowY===s.overflowX&&!Qk(e)&&s[t]==="visible")},Fk=function(e){return oN(e,"overflowY")},Kk=function(e){return oN(e,"overflowX")},y1=function(e,t){var s=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=lN(e,r);if(i){var l=cN(e,r),d=l[1],f=l[2];if(d>f)return!0}r=r.parentNode}while(r&&r!==s.body);return!1},Xk=function(e){var t=e.scrollTop,s=e.scrollHeight,r=e.clientHeight;return[t,s,r]},Zk=function(e){var t=e.scrollLeft,s=e.scrollWidth,r=e.clientWidth;return[t,s,r]},lN=function(e,t){return e==="v"?Fk(t):Kk(t)},cN=function(e,t){return e==="v"?Xk(t):Zk(t)},Wk=function(e,t){return e==="h"&&t==="rtl"?-1:1},Jk=function(e,t,s,r,i){var l=Wk(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=cN(e,f),S=b[0],w=b[1],N=b[2],E=w-N-l*S;(S||E)&&lN(e,f)&&(g+=E,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},e3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},t3=function(e){return`
|
|
203
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
204
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
205
|
+
`)},n3=0,Qi=[];function s3(e){var t=j.useRef([]),s=j.useRef([0,0]),r=j.useRef(),i=j.useState(n3++)[0],l=j.useState(iN)[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=jk([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 E=nd(w),T=s.current,_="deltaX"in w?w.deltaX:T[0]-E[0],R="deltaY"in w?w.deltaY:T[1]-E[1],L,I=w.target,P=Math.abs(_)>Math.abs(R)?"h":"v";if("touches"in w&&P==="h"&&I.type==="range")return!1;var A=window.getSelection(),M=A&&A.anchorNode,q=M?M===I||M.contains(I):!1;if(q)return!1;var z=y1(P,I);if(!z)return!0;if(z?L=P:(L=P==="v"?"h":"v",z=y1(P,I)),!z)return!1;if(!r.current&&"changedTouches"in w&&(_||R)&&(r.current=L),!L)return!0;var Q=r.current||L;return Jk(Q,N,w,Q==="h"?_:R)},[]),m=j.useCallback(function(w){var N=w;if(!(!Qi.length||Qi[Qi.length-1]!==l)){var E="deltaY"in N?v1(N):nd(N),T=t.current.filter(function(L){return L.name===N.type&&(L.target===N.target||N.target===L.shadowParent)&&e3(L.delta,E)})[0];if(T&&T.should){N.cancelable&&N.preventDefault();return}if(!T){var _=(d.current.shards||[]).map(b1).filter(Boolean).filter(function(L){return L.contains(N.target)}),R=_.length>0?f(N,_[0]):!d.current.noIsolation;R&&N.cancelable&&N.preventDefault()}}},[]),h=j.useCallback(function(w,N,E,T){var _={name:w,delta:N,target:E,should:T,shadowParent:a3(E)};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:t3(i)}):null,b?j.createElement(Yk,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function a3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const r3=Ok(rN,s3);var uN=j.forwardRef(function(e,t){return j.createElement(ff,us({},e,{ref:t,sideCar:r3}))});uN.classNames=ff.classNames;var i3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fi=new WeakMap,sd=new WeakMap,ad={},vp=0,dN=function(e){return e&&(e.host||dN(e.parentNode))},o3=function(e,t){return t.map(function(s){if(e.contains(s))return s;var r=dN(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})},l3=function(e,t,s,r){var i=o3(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=(Fi.get(y)||0)+1,N=(l.get(y)||0)+1;Fi.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(E){console.error("aria-hidden: cannot operate on ",y,E)}})};return v(t),f.clear(),vp++,function(){d.forEach(function(g){var y=Fi.get(g)-1,b=l.get(g)-1;Fi.set(g,y),l.set(g,b),y||(sd.has(g)||g.removeAttribute(r),sd.delete(g)),b||g.removeAttribute(s)}),vp--,vp||(Fi=new WeakMap,Fi=new WeakMap,sd=new WeakMap,ad={})}},c3=function(e,t,s){s===void 0&&(s="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=i3(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),l3(r,i,s,"aria-hidden")):function(){return null}};function u3(e){const t=d3(e),s=j.forwardRef((r,i)=>{const{children:l,...d}=r,f=j.Children.toArray(l),m=f.find(h3);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 c.jsx(t,{...d,ref:i,children:j.isValidElement(h)?j.cloneElement(h,void 0,v):null})}return c.jsx(t,{...d,ref:i,children:l})});return s.displayName=`${e}.Slot`,s}function d3(e){const t=j.forwardRef((s,r)=>{const{children:i,...l}=s;if(j.isValidElement(i)){const d=p3(i),f=m3(l,i.props);return i.type!==j.Fragment&&(f.ref=r?uf(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 f3=Symbol("radix.slottable");function h3(e){return j.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===f3}function m3(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 p3(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 hf="Dialog",[fN]=$M(hf),[g3,Kn]=fN(hf),hN=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]=QM({prop:r,defaultProp:i??!1,onChange:l,caller:hf});return c.jsx(g3,{scope:t,triggerRef:f,contentRef:m,contentId:fp(),titleId:fp(),descriptionId:fp(),open:h,onOpenChange:v,onOpenToggle:j.useCallback(()=>v(g=>!g),[v]),modal:d,children:s})};hN.displayName=hf;var mN="DialogTrigger",x3=j.forwardRef((e,t)=>{const{__scopeDialog:s,...r}=e,i=Kn(mN,s),l=ai(t,i.triggerRef);return c.jsx(Xs.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":qg(i.open),...r,ref:l,onClick:Xa(e.onClick,i.onOpenToggle)})});x3.displayName=mN;var Ug="DialogPortal",[y3,pN]=fN(Ug,{forceMount:void 0}),gN=e=>{const{__scopeDialog:t,forceMount:s,children:r,container:i}=e,l=Kn(Ug,t);return c.jsx(y3,{scope:t,forceMount:s,children:j.Children.map(r,d=>c.jsx(df,{present:s||l.open,children:c.jsx(nN,{asChild:!0,container:i,children:d})}))})};gN.displayName=Ug;var Vd="DialogOverlay",xN=j.forwardRef((e,t)=>{const s=pN(Vd,e.__scopeDialog),{forceMount:r=s.forceMount,...i}=e,l=Kn(Vd,e.__scopeDialog);return l.modal?c.jsx(df,{present:r||l.open,children:c.jsx(b3,{...i,ref:t})}):null});xN.displayName=Vd;var v3=u3("DialogOverlay.RemoveScroll"),b3=j.forwardRef((e,t)=>{const{__scopeDialog:s,...r}=e,i=Kn(Vd,s);return c.jsx(uN,{as:v3,allowPinchZoom:!0,shards:[i.contentRef],children:c.jsx(Xs.div,{"data-state":qg(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Wr="DialogContent",yN=j.forwardRef((e,t)=>{const s=pN(Wr,e.__scopeDialog),{forceMount:r=s.forceMount,...i}=e,l=Kn(Wr,e.__scopeDialog);return c.jsx(df,{present:r||l.open,children:l.modal?c.jsx(S3,{...i,ref:t}):c.jsx(w3,{...i,ref:t})})});yN.displayName=Wr;var S3=j.forwardRef((e,t)=>{const s=Kn(Wr,e.__scopeDialog),r=j.useRef(null),i=ai(t,s.contentRef,r);return j.useEffect(()=>{const l=r.current;if(l)return c3(l)},[]),c.jsx(vN,{...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())})}),w3=j.forwardRef((e,t)=>{const s=Kn(Wr,e.__scopeDialog),r=j.useRef(!1),i=j.useRef(!1);return c.jsx(vN,{...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()}})}),vN=j.forwardRef((e,t)=>{const{__scopeDialog:s,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:l,...d}=e,f=Kn(Wr,s),m=j.useRef(null),h=ai(t,m);return Nk(),c.jsxs(c.Fragment,{children:[c.jsx(eN,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:l,children:c.jsx(Ww,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":qg(f.open),...d,ref:h,onDismiss:()=>f.onOpenChange(!1)})}),c.jsxs(c.Fragment,{children:[c.jsx(N3,{titleId:f.titleId}),c.jsx(E3,{contentRef:m,descriptionId:f.descriptionId})]})]})}),$g="DialogTitle",bN=j.forwardRef((e,t)=>{const{__scopeDialog:s,...r}=e,i=Kn($g,s);return c.jsx(Xs.h2,{id:i.titleId,...r,ref:t})});bN.displayName=$g;var SN="DialogDescription",wN=j.forwardRef((e,t)=>{const{__scopeDialog:s,...r}=e,i=Kn(SN,s);return c.jsx(Xs.p,{id:i.descriptionId,...r,ref:t})});wN.displayName=SN;var NN="DialogClose",jN=j.forwardRef((e,t)=>{const{__scopeDialog:s,...r}=e,i=Kn(NN,s);return c.jsx(Xs.button,{type:"button",...r,ref:t,onClick:Xa(e.onClick,()=>i.onOpenChange(!1))})});jN.displayName=NN;function qg(e){return e?"open":"closed"}var EN="DialogTitleWarning",[HI,CN]=UM(EN,{contentName:Wr,titleName:$g,docsSlug:"dialog"}),N3=({titleId:e})=>{const t=CN(EN),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},j3="DialogDescriptionWarning",E3=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${CN(j3).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},C3=hN,_3=gN,_N=xN,RN=yN,TN=bN,AN=wN,R3=jN;const Gd=C3,T3=_3,MN=j.forwardRef(({className:e,...t},s)=>c.jsx(_N,{ref:s,className:Re("fixed inset-0 z-50 bg-black/20 backdrop-blur-[8px]",e),...t}));MN.displayName=_N.displayName;const Fl=j.forwardRef(({className:e,children:t,hideCloseButton:s,...r},i)=>c.jsxs(T3,{children:[c.jsx(MN,{}),c.jsxs(RN,{ref:i,className:Re("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&&c.jsxs(R3,{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:[c.jsx(yA,{className:"h-4 w-4"}),c.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Fl.displayName=RN.displayName;const Kl=({className:e,...t})=>c.jsx("div",{className:Re("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Kl.displayName="DialogHeader";const Xl=({className:e,...t})=>c.jsx("div",{className:Re("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)=>c.jsx(TN,{ref:s,className:Re("text-lg font-semibold leading-none tracking-tight",e),...t}));Zl.displayName=TN.displayName;const Wl=j.forwardRef(({className:e,...t},s)=>c.jsx(AN,{ref:s,className:Re("text-sm text-foreground-muted",e),...t}));Wl.displayName=AN.displayName;async function A3(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 M3(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 k3(e){const t=Tt(),s=Rt({queryKey:["rig",e,"chat"],queryFn:()=>A3(e),enabled:!!e}),r=Ht({mutationFn:({body:i,sender:l})=>M3(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 O3({rigId:e}){const{messages:t,isLoading:s,send:r,isSending:i}=k3(e),[l,d]=j.useState(""),f=m=>{m.preventDefault();const h=l.trim();h&&(r({body:h,sender:"ui"}),d(""))};return c.jsxs("div",{"data-testid":"rig-chat-panel",className:"flex flex-col h-full",children:[c.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:s?c.jsx("div",{className:"font-mono text-[10px] text-stone-400 text-center",children:"Loading messages..."}):t.length===0?c.jsx("div",{className:"font-mono text-[10px] text-stone-400 text-center italic",children:"No messages yet"}):t.map(m=>c.jsx("div",{"data-testid":`chat-msg-${m.id}`,children:m.kind==="topic"?c.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}):c.jsxs("div",{className:"border-l-2 border-stone-200 pl-2",children:[c.jsx("div",{"data-testid":`chat-sender-${m.id}`,className:"font-mono text-[9px] font-bold text-stone-500",children:m.sender}),c.jsx("div",{className:"font-mono text-[10px] leading-relaxed text-stone-800 whitespace-pre-wrap",children:m.body})]})},m.id))}),c.jsxs("form",{"data-testid":"chat-send-form",onSubmit:f,className:"border-t border-stone-200 p-2 flex gap-2",children:[c.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}),c.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 D3({rigId:e,envData:t}){var L,I,P,A;const[s,r]=j.useState(null),[i,l]=j.useState(!1),[d,f]=j.useState(null),[m,h]=j.useState(!1),[v,g]=j.useState(null),y=t.receipt,b=t.surfaces,S=(y==null?void 0:y.services)??[],w=(y==null?void 0:y.waitFor)??[];function N(M){return typeof M.url=="string"?M.url:typeof M.tcp=="string"?M.tcp:typeof M.service=="string"?typeof M.condition=="string"?`${M.service} (${M.condition})`:M.service:JSON.stringify(M)}function E(){if(!y)return"Unknown";const M=S.length>0&&S.every(B=>B.health==="healthy"),q=S.some(B=>B.status==="running"),z=w.length>0&&w.every(B=>B.status==="healthy"),Q=w.some(B=>B.status==="pending"),Y=w.some(B=>B.status==="unhealthy");return M&&(w.length===0||z)?"Healthy":q||Q?"Degraded":Y?"Stopped":z?"Healthy":S.length>0?"Stopped":"Unknown"}const T=E(),_=async()=>{l(!0),f(null);try{const q=await(await fetch(`/api/rigs/${encodeURIComponent(e)}/env/logs?tail=100`)).json();q.ok?r(q.output??""):f(q.error??"Failed to fetch logs")}catch(M){f(M.message)}finally{l(!1)}},R=async()=>{h(!0),g(null);try{const q=await(await fetch(`/api/rigs/${encodeURIComponent(e)}/env/down`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})})).json();g(q.ok?"Environment stopped.":q.error??"Failed to stop environment.")}catch(M){g(M.message)}finally{h(!1)}};return c.jsxs("div",{className:"flex-1 overflow-y-auto","data-testid":"env-panel",children:[c.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-1",children:"Environment"}),c.jsx("div",{"data-testid":"env-state",className:`font-mono text-[12px] font-bold ${T==="Healthy"?"text-green-700":T==="Degraded"?"text-amber-600":T==="Stopped"?"text-red-600":"text-stone-500"}`,children:T})]}),S.length>0&&c.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Services"}),c.jsx("div",{className:"space-y-1",children:S.map(M=>c.jsxs("div",{className:"flex items-center justify-between font-mono text-[10px]",children:[c.jsx("span",{className:"text-stone-800",children:M.name}),c.jsx("span",{className:M.health==="healthy"?"text-green-700":"text-stone-500",children:M.health??M.status})]},M.name))})]}),w.length>0&&c.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Health Gates"}),c.jsx("div",{className:"space-y-2",children:w.map((M,q)=>c.jsxs("div",{className:"space-y-1 font-mono text-[10px]",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("span",{className:"text-stone-800 break-all",children:N(M.target)}),c.jsx("span",{className:M.status==="healthy"?"text-green-700":M.status==="pending"?"text-amber-600":"text-red-600",children:M.status})]}),M.detail&&c.jsx("div",{className:"text-stone-500 break-all",children:M.detail})]},`${N(M.target)}-${q}`))})]}),b&&(((L=b.urls)==null?void 0:L.length)||((I=b.commands)==null?void 0:I.length))&&c.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Surfaces"}),c.jsxs("div",{className:"space-y-1",children:[(P=b.urls)==null?void 0:P.map(M=>c.jsxs("div",{className:"flex items-center justify-between font-mono text-[10px]",children:[c.jsx("span",{className:"text-stone-800",children:M.name}),c.jsx("a",{href:M.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline truncate ml-2",children:M.url})]},M.name)),(A=b.commands)==null?void 0:A.map(M=>c.jsxs("div",{className:"flex items-center justify-between font-mono text-[10px]",children:[c.jsx("span",{className:"text-stone-800",children:M.name}),c.jsx("span",{className:"text-stone-500 truncate ml-2",children:M.command})]},M.name))]})]}),c.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsx(we,{variant:"outline",size:"sm",onClick:()=>void _(),disabled:i,children:i?"Loading...":"View Logs"}),c.jsx(we,{variant:"outline",size:"sm",onClick:()=>void R(),disabled:m,children:m?"Stopping...":"Stop Env"})]}),v&&c.jsx("div",{className:"mt-2 font-mono text-[9px] text-stone-600",children:v})]}),d&&c.jsx("section",{className:"px-4 py-3",children:c.jsx("div",{className:"font-mono text-[9px] text-red-600",children:d})}),s!==null&&!d&&c.jsxs("section",{className:"px-4 py-3",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Logs"}),c.jsx("pre",{className:"font-mono text-[9px] text-stone-700 whitespace-pre-wrap break-all max-h-64 overflow-y-auto bg-stone-50 p-2 border border-stone-200",children:s||"(empty)"})]})]})}function kN({result:e}){var t;return c.jsxs("div",{"data-testid":"expand-result",className:"mt-2 font-mono text-[9px]",children:[c.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=>c.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))]})}async function L3(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/env`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function z3(e){return Rt({queryKey:["rig-env",e],queryFn:()=>L3(e),refetchInterval:1e4})}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 P3(e,t){return e instanceof Yw&&e.code==="rig_not_stopped"?`Stop ${t} before restoring. Run rig down ${t} and retry.`:e.message}function I3(e,t){return e?`${e.runningCount}/${e.nodeCount} running`:`${(t==null?void 0:t.nodeCount)??0} total`}function B3({rigId:e,onClose:t}){const{data:s}=xc(),{data:r}=Pg(),{data:i,isPending:l}=Tw(e),{data:d=[],isPending:f,error:m}=NM(e),h=jM(e),v=EM(e),g=_M(e),y=CM(e),{data:b,isPending:S,error:w}=z3(e),[N,E]=j.useState("info"),[T,_]=j.useState(null),[R,L]=j.useState(!1),[I,P]=j.useState(!1),[A,M]=j.useState(null),[q,z]=j.useState(null),[Q,Y]=j.useState(null),[B,V]=j.useState(!1),[k,U]=j.useState(""),[$,F]=j.useState(null),H=Qw(),D=s==null?void 0:s.find(me=>me.id===e),G=(D==null?void 0:D.hasServices)===!0||(b==null?void 0:b.hasServices)===!0,J=r==null?void 0:r.find(me=>me.rigId===e),se=Array.isArray(i)?i:[],oe=Array.from(se.reduce((me,Pe)=>{const rt=Pe.podId??"__ungrouped__",dt=me.get(rt)??[];return dt.push(Pe),me.set(rt,dt),me},new Map)),ce=[...d].sort((me,Pe)=>new Date(Pe.createdAt).getTime()-new Date(me.createdAt).getTime()),de=ce[0]??null,ue=ce.slice(1),fe=de?Gs(de.id):null,Ce=Gs(e),be=e.slice(0,Math.max(0,e.length-Ce.length)),xe=(J==null?void 0:J.status)??"stopped",ve=()=>{z(null),Y(null),h.mutate(void 0,{onError:me=>Y(me.message)})},Te=me=>{z(null),M(null),v.mutate(me,{onSuccess:Pe=>{M(Pe.nodes??[]),_(null)},onError:Pe=>{z(P3(Pe,(D==null?void 0:D.name)??e)),_(null)}})},Ve=async()=>{Y(null);try{const me=await fetch(`/api/rigs/${encodeURIComponent(e)}/spec`);if(!me.ok){Y(`Export failed (HTTP ${me.status})`);return}const Pe=await me.text(),rt=new Blob([Pe],{type:"text/yaml"}),dt=URL.createObjectURL(rt),mn=document.createElement("a");mn.href=dt,mn.download=`${(D==null?void 0:D.name)??e}.yaml`,mn.click(),URL.revokeObjectURL(dt)}catch(me){Y(me instanceof Error?me.message:"Export failed")}},Oe=()=>{Y(null),g.mutate(void 0,{onError:me=>Y(me.message)})},tt=()=>{Y(null),y.mutate(void 0,{onSuccess:()=>L(!1),onError:me=>Y(me.message)})};return c.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:[c.jsxs("div",{className:"flex justify-between items-center px-4 py-3 border-b border-stone-300/35 shrink-0",children:[c.jsx("h2",{className:"min-w-0 font-mono text-xs font-bold text-stone-900 truncate",children:(D==null?void 0:D.name)??e}),c.jsx("button",{"data-testid":"close-drawer",onClick:t,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),c.jsxs("div",{className:"flex border-b border-stone-300/35 shrink-0","data-testid":"drawer-tabs",children:[c.jsx("button",{"data-testid":"tab-info",onClick:()=>E("info"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${N==="info"?"border-b-2 border-stone-800 font-bold":"text-stone-400"}`,children:"Info"}),G&&c.jsx("button",{"data-testid":"tab-env",onClick:()=>E("env"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${N==="env"?"border-b-2 border-stone-800 font-bold":"text-stone-400"}`,children:"Env"}),c.jsx("button",{"data-testid":"tab-chat",onClick:()=>E("chat"),className:`flex-1 py-2 text-xs font-mono uppercase text-center ${N==="chat"?"border-b-2 border-stone-800 font-bold":"text-stone-400"}`,children:"Chat Room"})]}),N==="chat"?c.jsx(O3,{rigId:e}):N==="env"&&G?b?c.jsx(D3,{rigId:e,envData:b}):c.jsx("div",{className:"flex-1 overflow-y-auto",children:c.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Environment"}),c.jsx("div",{className:"font-mono text-[10px] text-stone-600",children:S?"Loading environment status...":w?"Environment status unavailable.":"Waiting for environment status..."})]})}):c.jsxs("div",{className:"flex-1 overflow-y-auto",children:[c.jsx("section",{className:"px-4 py-3 border-b border-stone-100",children:c.jsxs("div",{children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Identity"}),c.jsx("div",{className:"space-y-1 font-mono text-[10px]",children:c.jsxs("div",{className:"flex justify-between gap-3",children:[c.jsx("span",{className:"text-stone-500",children:"ID"}),c.jsxs("span",{"data-testid":"rig-id-value",className:"min-w-0 truncate text-stone-900",children:[be&&c.jsx("span",{className:"text-stone-500",children:be}),c.jsx("span",{"data-testid":"rig-id-tail",className:"font-bold",children:Ce})]})]})})]})}),c.jsx("section",{className:"px-4 py-3 border-b border-stone-100",children:c.jsxs("div",{children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Status"}),c.jsxs("div",{className:"space-y-1 font-mono text-[10px]",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Nodes"}),c.jsx("span",{children:I3(J,D)})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Uptime"}),c.jsx("span",{"data-testid":"rig-uptime",children:(J==null?void 0:J.uptime)??"—"})]})]})]})}),c.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Actions"}),c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("button",{onClick:ve,"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"}),c.jsx("button",{onClick:Ve,"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"}),xe==="running"||xe==="partial"?c.jsx("button",{onClick:()=>L(!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"}):c.jsx("button",{onClick:Oe,"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"}),c.jsx("button",{onClick:()=>{V(!B),F(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"})]}),Q&&c.jsx("div",{"data-testid":"rig-action-error",className:"mt-2 font-mono text-[9px] text-red-700",children:Q})]}),B&&c.jsxs("section",{"data-testid":"add-pod-form",className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Add Pod — YAML Fragment"}),c.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:me=>U(me.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: []`}),c.jsx("button",{"data-testid":"add-pod-submit",disabled:H.isPending||!k.trim(),onClick:async()=>{F(null),Y(null);try{const{parse:me}=await SM(async()=>{const{parse:dt}=await import("./index-B09doO8H.js");return{parse:dt}},[]),Pe=me(k),rt=await H.mutateAsync({rigId:e,pod:Pe});F(rt),rt.status==="ok"&&(V(!1),U(""))}catch(me){Y(me.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:H.isPending?"Expanding...":"Expand"}),$&&c.jsx(kN,{result:$})]}),c.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Pods"}),l?c.jsx("div",{className:"font-mono text-[9px] text-stone-400",children:"Loading pods..."}):oe.length===0?c.jsx("div",{className:"font-mono text-[9px] text-stone-400",children:"No nodes yet"}):c.jsx("div",{className:"space-y-2",children:oe.map(([me,Pe])=>{var rt;return c.jsxs("div",{className:"p-2 bg-stone-50 border border-stone-200",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("div",{className:"font-mono text-[10px] font-bold",children:ds((rt=Pe[0])==null?void 0:rt.logicalId)??fs(me==="__ungrouped__"?null:me)}),c.jsx("div",{className:"font-mono text-[9px] text-stone-400",children:Pe.length})]}),c.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:Pe.map(dt=>c.jsx("span",{className:"font-mono text-[9px] text-stone-700 border border-stone-200 bg-white px-1.5 py-0.5",children:Qr(dt.logicalId)},dt.logicalId))})]},me)})})]}),c.jsxs("section",{className:"px-4 py-3",children:[c.jsxs("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-3",children:["Snapshots (",d.length,")"]}),q&&c.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:q}),A&&c.jsxs("div",{"data-testid":"restore-result",className:"mb-3 p-2 bg-stone-50 border border-stone-200",children:[c.jsx("div",{className:"font-mono text-[9px] text-stone-500 uppercase mb-1",children:"Restore Complete"}),A.map(me=>c.jsxs("div",{className:"flex items-center justify-between font-mono text-[10px]",children:[c.jsx("span",{children:me.logicalId}),c.jsx("span",{className:Fw(me.status),"data-testid":`restore-status-${me.logicalId}`,children:me.status})]},me.nodeId))]}),m&&c.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?c.jsx("div",{className:"font-mono text-[10px] text-stone-400 py-2 text-center",children:"Loading snapshots..."}):d.length===0&&!m?c.jsx("div",{className:"font-mono text-[10px] text-stone-400 py-2 text-center italic",children:"No snapshots yet"}):c.jsxs("div",{className:"space-y-1",children:[de&&c.jsx("div",{className:"p-2 bg-stone-50 hover:bg-stone-100 transition-colors",children:c.jsxs("div",{className:"flex justify-between items-start",children:[c.jsxs("div",{children:[c.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.12em] text-stone-400",children:"Latest"}),c.jsx("div",{className:"font-mono text-[10px] font-bold","data-testid":`snap-short-${de.id}`,children:fe}),c.jsxs("div",{className:"font-mono text-[9px] text-stone-400 mt-0.5",children:[de.kind," · ",S1(de.createdAt)]})]}),c.jsx("button",{"data-testid":`restore-btn-${de.id}`,onClick:()=>_(de.id),className:"font-mono text-[8px] border border-stone-300 px-1 py-0.5 hover:bg-stone-200",children:"Restore"})]})}),ue.length>0&&c.jsxs("div",{className:"border-t border-stone-200 pt-2",children:[c.jsx("button",{type:"button","data-testid":"snapshot-history-toggle",onClick:()=>P(me=>!me),className:"font-mono text-[8px] uppercase tracking-[0.12em] text-stone-500 hover:text-stone-900",children:I?"Hide history":`Show history (${ue.length})`}),I&&c.jsx("div",{className:"mt-2 space-y-1",children:ue.map(me=>c.jsx("div",{className:"p-2 bg-stone-50 hover:bg-stone-100 transition-colors",children:c.jsxs("div",{className:"flex justify-between items-start gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"font-mono text-[10px] font-bold","data-testid":`snap-short-${me.id}`,children:Gs(me.id)}),c.jsxs("div",{className:"font-mono text-[9px] text-stone-400 mt-0.5",children:[me.kind," · ",S1(me.createdAt)]})]}),c.jsx("button",{"data-testid":`restore-btn-${me.id}`,onClick:()=>_(me.id),className:"shrink-0 font-mono text-[8px] border border-stone-300 px-1 py-0.5 hover:bg-stone-200",children:"Restore"})]})},me.id))})]})]})]}),c.jsx(Gd,{open:T!==null,onOpenChange:me=>{me||_(null)},children:c.jsxs(Fl,{children:[c.jsxs(Kl,{children:[c.jsx(Zl,{className:"font-headline text-lg font-bold uppercase",children:"Restore Snapshot"}),c.jsxs(Wl,{className:"text-sm text-stone-500",children:["Restore from ",T?Gs(T):"","? Existing sessions will be restarted."]})]}),c.jsxs(Xl,{children:[c.jsx(we,{variant:"ghost",onClick:()=>_(null),children:"Cancel"}),c.jsx(we,{variant:"default","data-testid":T?`confirm-restore-${T}`:void 0,onClick:()=>T&&Te(T),children:"Confirm Restore"})]})]})}),c.jsx(Gd,{open:R,onOpenChange:me=>{me||L(!1)},children:c.jsxs(Fl,{children:[c.jsxs(Kl,{children:[c.jsx(Zl,{className:"font-headline text-lg font-bold uppercase",children:"Turn Off Rig"}),c.jsxs(Wl,{className:"text-sm text-stone-500",children:["Stop all running sessions for ",(D==null?void 0:D.name)??e,"?"]})]}),c.jsxs(Xl,{children:[c.jsx(we,{variant:"ghost",onClick:()=>L(!1),children:"Cancel"}),c.jsx(we,{variant:"default","data-testid":"confirm-rig-down",disabled:y.isPending,onClick:tt,children:y.isPending?"Stopping...":"Confirm"})]})]})})]})]})}async function H3(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 ON(e,t){return Rt({queryKey:["rig",e,"nodes",t],queryFn:()=>H3(e,t),enabled:!!e&&!!t,refetchInterval:3e4})}async function Qn(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 DN({peers:e,edges:t,transcript:s,compactSpec:r,contextUsage:i}){return c.jsxs(c.Fragment,{children:[(t.outgoing.length>0||t.incoming.length>0)&&c.jsxs("section",{"data-testid":"detail-edges",className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Edges"}),c.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[t.outgoing.map((l,d)=>{var f;return c.jsxs("div",{className:"flex gap-1",children:[c.jsx("span",{className:"text-stone-400",children:"→"}),c.jsx("span",{className:"text-stone-500",children:l.kind}),c.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 c.jsxs("div",{className:"flex gap-1",children:[c.jsx("span",{className:"text-stone-400",children:"←"}),c.jsx("span",{className:"text-stone-500",children:l.kind}),c.jsx("span",{className:"text-stone-900",children:((f=l.from)==null?void 0:f.logicalId)??"?"})]},`in-${d}`)})]})]}),e.length>0&&c.jsxs("section",{"data-testid":"detail-peers",className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Peers"}),c.jsx("div",{className:"space-y-0.5 font-mono text-[10px]",children:e.map(l=>c.jsxs("div",{className:"space-y-0",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-900",children:l.logicalId}),c.jsx("span",{className:"text-stone-500",children:l.runtime??"—"})]}),l.canonicalSessionName&&c.jsx("div",{className:"text-[9px] text-stone-400 truncate",children:l.canonicalSessionName})]},l.logicalId))})]}),s.enabled&&s.tailCommand&&c.jsxs("section",{"data-testid":"detail-transcript",className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Transcript"}),c.jsx("div",{className:"font-mono text-[9px] text-stone-700",children:s.path??"enabled"}),c.jsx("button",{onClick:()=>Qn(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&&c.jsxs("section",{"data-testid":"detail-compact-spec",className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Agent Spec"}),c.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Spec"}),c.jsx("span",{className:"text-stone-900",children:r.name})]}),r.version&&c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Version"}),c.jsx("span",{className:"text-stone-900",children:r.version})]}),r.profile&&c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Profile"}),c.jsx("span",{className:"text-stone-900",children:r.profile})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Skills"}),c.jsx("span",{className:"text-stone-900",children:r.skillCount})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Guidance"}),c.jsx("span",{className:"text-stone-900",children:r.guidanceCount})]})]})]}),c.jsxs("section",{"data-testid":"detail-context-usage",className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Context"}),(i==null?void 0:i.availability)==="known"?c.jsxs("div",{className:"space-y-0.5 font-mono text-[10px]",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Used"}),c.jsxs("span",{className:"text-stone-900",children:[i.usedPercentage,"%"]})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Remaining"}),c.jsxs("span",{className:"text-stone-900",children:[i.remainingPercentage,"%"]})]}),i.contextWindowSize&&c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Window"}),c.jsx("span",{className:"text-stone-900",children:i.contextWindowSize.toLocaleString()})]}),i.totalInputTokens!=null&&c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Input tokens"}),c.jsx("span",{className:"text-stone-900",children:i.totalInputTokens.toLocaleString()})]}),i.totalOutputTokens!=null&&c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Output tokens"}),c.jsx("span",{className:"text-stone-900",children:i.totalOutputTokens.toLocaleString()})]}),i.sampledAt&&c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Sampled"}),c.jsx("span",{className:"text-stone-400 text-[9px]",children:i.sampledAt})]}),i.fresh===!1&&c.jsx("div",{className:"font-mono text-[9px] text-amber-600 mt-1",children:"Stale sample"})]}):c.jsxs("div",{className:"font-mono text-[10px] text-stone-400",children:["unknown",i!=null&&i.reason?` (${i.reason})`:""]})]})]})}function U3(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 $3({rigId:e,logicalId:t,onClose:s}){const r=Wt(),{data:i,isLoading:l,error:d}=ON(e,t),f=(i==null?void 0:i.canonicalSessionName)??t,m=async()=>{i!=null&&i.tmuxAttachCommand&&await Qn(i.tmuxAttachCommand)},h=async()=>{try{await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/open-cmux`,{method:"POST"})}catch{}},v=async()=>{i!=null&&i.resumeCommand&&await Qn(i.resumeCommand)};return c.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:[c.jsxs("div",{className:"flex justify-between items-center px-4 py-3 border-b border-stone-300/35 shrink-0",children:[c.jsx("span",{className:"font-mono text-xs font-bold text-stone-900 truncate",children:f}),c.jsx("button",{onClick:s,className:"text-stone-400 hover:text-stone-900 text-sm","data-testid":"detail-close",children:"×"})]}),l&&c.jsx("div",{className:"p-4 font-mono text-[9px] text-stone-400",children:"Loading..."}),d&&c.jsx("div",{className:"p-4 font-mono text-[9px] text-red-500",children:"Failed to load node detail"}),i&&c.jsxs("div",{className:"flex-1 overflow-y-auto flex flex-col gap-0",children:[c.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Identity"}),c.jsxs("div",{className:"space-y-1 font-mono text-[10px]",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Rig"}),c.jsx("span",{className:"text-stone-900",children:i.rigName})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Logical ID"}),c.jsx("span",{className:"text-stone-900",children:t})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Pod"}),c.jsx("span",{className:"text-stone-900",children:i.podNamespace??ds(t)??fs(i.podId)})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Session"}),c.jsx("span",{className:"text-stone-900 truncate ml-2",children:i.canonicalSessionName??"—"})]}),c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Runtime"}),c.jsx("span",{className:"text-stone-900",children:i.runtime??"—"})]}),i.cwd&&c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"CWD"}),c.jsx("span",{className:"text-stone-900 truncate ml-2",children:i.cwd})]})]})]}),i.peers&&c.jsx(DN,{peers:i.peers,edges:i.edges,transcript:i.transcript,compactSpec:i.compactSpec,contextUsage:i.contextUsage}),c.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Status"}),c.jsxs("div",{className:"space-y-1 font-mono text-[10px]",children:[c.jsxs("div",{className:"flex justify-between",children:[c.jsx("span",{className:"text-stone-500",children:"Startup"}),c.jsx("span",{className:U3(i.startupStatus),"data-testid":"detail-startup-status",children:i.startupStatus??"stopped"})]}),c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("span",{className:"text-stone-500",children:"Restore"}),c.jsx("span",{className:`font-bold text-xs ${Fw(i.restoreOutcome)}`,"data-testid":"detail-restore-outcome",children:i.restoreOutcome})]}),(i.startupStatus==="failed"||i.latestError)&&c.jsxs("div",{className:"mt-2 p-2 bg-red-50 border border-red-200","data-testid":"detail-failure-banner",children:[c.jsx("div",{className:"font-mono text-[9px] text-red-700 font-bold mb-1",children:i.startupStatus==="failed"?"Startup Failed":"Error"}),i.latestError&&c.jsx("div",{className:"font-mono text-[9px] text-red-600 mb-1",children:i.latestError}),c.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>"})]})]})]}),c.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Actions"}),c.jsxs("div",{className:"flex flex-col gap-1",children:[i.tmuxAttachCommand&&c.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"}),c.jsx("button",{onClick:h,"data-testid":"detail-cmux-open",className:"px-2 py-1 border border-stone-300 font-mono text-[8px] uppercase hover:bg-stone-200 text-left",children:"Open CMUX"}),i.resumeCommand&&c.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"}),c.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&&c.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Startup Command"}),c.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&&c.jsxs("section",{className:"px-4 py-3 border-b border-stone-100",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Startup Files"}),c.jsx("ol",{className:"list-decimal list-inside space-y-0.5",children:i.startupFiles.map((g,y)=>c.jsxs("li",{className:"font-mono text-[9px] text-stone-700 truncate",children:[g.path," ",c.jsxs("span",{className:"text-stone-400",children:["(",g.deliveryHint,")"]})]},y))})]}),i.recentEvents.length>0&&c.jsxs("section",{className:"px-4 py-3",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-2",children:"Recent Events"}),c.jsx("div",{className:"space-y-0.5",children:i.recentEvents.slice(0,10).map((g,y)=>c.jsxs("div",{className:"font-mono text-[9px] flex justify-between",children:[c.jsx("span",{className:"text-stone-700 truncate",children:g.type}),c.jsx("span",{className:"text-stone-400 ml-2 shrink-0",children:g.createdAt})]},y))})]})]})]})}const tg=100;function q3(){const e=Tt(),[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,tg)),(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 bp(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 V3(e){const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"??:??:??":`${bp(t.getHours())}:${bp(t.getMinutes())}:${bp(t.getSeconds())}`}function G3(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 Y3(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 Q3(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 F3({events:e}){const t=Wt(),s=e.length>=tg;return c.jsxs("div",{"data-testid":"feed-scroll-region",className:"relative z-10 overflow-y-auto flex-1 min-h-0",children:[c.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 ",tg," live events in this panel."]}),e.length===0?c.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"}):c.jsxs(c.Fragment,{children:[e.map(r=>{const i=Q3(r),l=i!==null;return c.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:Re("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:[c.jsx("span",{"data-testid":"feed-dot",className:Re("inline-block h-[6px] w-[6px] shrink-0",G3(r.type))}),c.jsx("span",{"data-testid":"feed-time",className:"shrink-0 text-[9px] text-stone-500 tabular-nums",children:V3(r.createdAt)}),c.jsx("span",{"data-testid":"feed-summary",className:"min-w-0 flex-1 truncate text-stone-900",children:Y3(r)})]},r.seq)}),s?c.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 K3(){if(!(await fetch("/healthz")).ok)throw new Error("unhealthy");return!0}async function X3(){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 Z3({onClose:e,events:t,initialTab:s="log"}){var h;const[r,i]=j.useState(s);j.useEffect(()=>{i(s)},[s]);const l=Rt({queryKey:["daemon","health"],queryFn:K3,refetchInterval:1e4,retry:!1}),d=Rt({queryKey:["daemon","cmux"],queryFn:X3,refetchInterval:3e4,retry:!1}),f=l.isSuccess,m=f?((h=d.data)==null?void 0:h.available)??null:null;return c.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:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-stone-300/35 shrink-0",children:[c.jsx("h2",{className:"min-w-0 font-mono text-xs font-bold text-stone-900 truncate",children:"system"}),c.jsx("button",{"data-testid":"system-close",onClick:e,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),c.jsxs("div",{className:"flex border-b border-stone-300/35 shrink-0","data-testid":"system-tabs",children:[c.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"}),c.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"?c.jsx("div",{className:"flex flex-1 min-h-0 flex-col overflow-hidden","data-testid":"system-log-tab",children:c.jsx(F3,{events:t})}):c.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-4","data-testid":"system-status-tab",children:c.jsxs("section",{className:"border border-stone-300/28 bg-white/12 px-3 py-3",children:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase tracking-wider mb-3",children:"Runtime"}),c.jsxs("div",{className:"space-y-3 font-mono text-[10px]",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(fA,{className:`mt-[1px] h-3.5 w-3.5 shrink-0 ${od(f)}`}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-stone-900",children:"Daemon"}),c.jsx("div",{"data-testid":"system-daemon-status",className:od(f),children:w1(f,"connected","unavailable")}),c.jsx("div",{className:"text-stone-500",children:"Controls the local OpenRig daemon connection."})]})]}),c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(uA,{className:`mt-[1px] h-3.5 w-3.5 shrink-0 ${od(m)}`}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"text-stone-900",children:"cmux control"}),c.jsx("div",{"data-testid":"system-cmux-status",className:od(m),children:w1(m,"available","unavailable")}),c.jsx("div",{className:"text-stone-500",children:"OpenRig can control cmux surfaces for node open-or-focus."})]})]})]})]})})]})}function LN(){const e=Tt();return Ht({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 W3(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 Vg(e,t=!0){var i;const s=W3(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 Rt({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 J3(e){const{data:t}=Vg({status:"active"},e);return t??[]}function e4(){const e=Tt();return Ht({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 t4(){const e=Tt();return Ht({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 n4(e){const t=e.match(/^\/rigs\/([^/]+)/);return(t==null?void 0:t[1])??null}function s4(e){switch(e){case"claude-code":return"text-primary";case"codex":return"text-accent";default:return"text-foreground-muted"}}function a4(e){switch(e){case"claude-code":return"Claude Code";case"codex":return"Codex";default:return"Unknown"}}function r4(e){return`'${e.replace(/'/g,"'\\''")}'`}function i4(e){const t=e.tmuxWindow?`${e.tmuxSession}:${e.tmuxWindow}`:e.tmuxSession;return`tmux attach -t ${r4(t)}`}function o4(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 c.jsx("button",{type:"button","data-testid":r,onClick:()=>{f()},className:Re("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 l4({onClose:e,selectedDiscoveredId:t,onSelectDiscoveredId:s,placementTarget:r,onClearPlacement:i}){const l=cf({select:w=>w.location.pathname}),d=n4(l),{data:f=[]}=Vg({status:"active",runtimeHint:["claude-code","codex"],minConfidence:"medium"}),m=LN(),h=t4(),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||o4(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 c.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:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-stone-300/35 shrink-0",children:[c.jsx("h2",{className:"min-w-0 font-mono text-xs font-bold text-stone-900 truncate",children:"discovery"}),c.jsx("button",{"data-testid":"discovery-close",onClick:e,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),c.jsxs("div",{className:"border-b border-stone-300/35 px-4 py-3 shrink-0 space-y-2",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Inventory"}),c.jsx(we,{variant:"ghost",size:"sm","data-testid":"discovery-scan-now",disabled:m.isPending,onClick:()=>m.mutate(),children:m.isPending?"SCANNING...":"SCAN NOW"})]}),c.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"})]}),c.jsx("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:f.length===0?c.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 c.jsxs("div",{"data-testid":`discovery-session-${w.id}`,className:Re("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:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[c.jsx("div",{className:Re("font-mono text-[8px] uppercase tracking-[0.12em]",s4(w.runtimeHint)),children:a4(w.runtimeHint)}),c.jsx("div",{className:"font-mono text-[10px] text-stone-900 truncate",title:w.tmuxSession,children:w.tmuxSession})]}),w.cwd?c.jsx("div",{className:"mt-1 font-mono text-[9px] text-stone-500 truncate",title:w.cwd,children:w.cwd}):null]}),c.jsx(we,{variant:N?"tactical":"ghost",size:"sm","data-testid":`discovery-select-${w.id}`,onClick:()=>s(N?null:w.id),children:N?"SELECTED":"SELECT"})]}),c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[c.jsx(E1,{label:"copy tmux",activeLabel:"copied",testId:`discovery-copy-tmux-${w.id}`,onClick:async()=>Qn(i4(w))}),w.cwd?c.jsx(E1,{label:"copy cwd",activeLabel:"copied",testId:`discovery-copy-cwd-${w.id}`,onClick:async()=>Qn(w.cwd??"")}):null]}),N?c.jsxs("div",{className:"mt-3 space-y-2 border-t border-emerald-200/80 pt-3",children:[b?c.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?c.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?c.jsxs("div",{className:"space-y-2 border border-emerald-300/80 bg-white/70 px-3 py-2","data-testid":"discovery-target-card",children:[c.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-emerald-800",children:"Target"}),c.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"?c.jsxs("div",{className:"space-y-1",children:[c.jsx("label",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-emerald-800",htmlFor:"discovery-member-name",children:"Member name"}),c.jsx("input",{id:"discovery-member-name","data-testid":"discovery-member-name-input",value:g,onChange:E=>y(E.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?c.jsx("div",{"data-testid":"discovery-adopt-error",className:"font-mono text-[9px] text-red-600",children:h.error.message}):null,c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(we,{variant:"tactical",size:"sm","data-testid":"discovery-confirm-adopt",disabled:h.isPending||r.kind==="pod"&&!g.trim(),onClick:S,children:h.isPending?"ADOPTING...":"ADOPT"}),c.jsx(we,{variant:"ghost",size:"sm","data-testid":"discovery-clear-target",onClick:i,children:"CLEAR"})]})]}):null]}):null]},w.id)})})]})}const Un={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"},c4={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"},u4={activeTask:null,currentRigDraft:null,currentAgentDraft:null,recentRigDrafts:[],recentAgentDrafts:[],selectedRigDraft:null,selectedAgentDraft:null,bootstrapSourceRef:"",saveRigDraft:()=>{},rememberRigDraft:()=>{},selectRigDraft:()=>{},clearSelectedRigDraft:()=>{},saveAgentDraft:()=>{},rememberAgentDraft:()=>{},selectAgentDraft:()=>{},clearSelectedAgentDraft:()=>{},setBootstrapSourceRef:()=>{}},zN=j.createContext(u4);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(Un).find(([,m])=>m===e))==null?void 0:s[0])??null;if(!i)return t;const l=c4[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 d4(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 f4({children:e}){const t=cf({select:M=>M.location.pathname}),[s,r]=j.useState(()=>Rl(Un.currentRigDraft,null)),[i,l]=j.useState(()=>Rl(Un.currentAgentDraft,null)),[d,f]=j.useState(()=>Rl(Un.recentRigDrafts,[])),[m,h]=j.useState(()=>Rl(Un.recentAgentDrafts,[])),[v,g]=j.useState(null),[y,b]=j.useState(null),[S,w]=j.useState(()=>Rl(Un.bootstrapSourceRef,""));j.useEffect(()=>{Tl(Un.currentRigDraft,s)},[s]),j.useEffect(()=>{Tl(Un.currentAgentDraft,i)},[i]),j.useEffect(()=>{Tl(Un.recentRigDrafts,d)},[d]),j.useEffect(()=>{Tl(Un.recentAgentDrafts,m)},[m]),j.useEffect(()=>{Tl(Un.bootstrapSourceRef,S.trim())},[S]);const N=j.useMemo(()=>d.find(M=>M.id===v)??((s==null?void 0:s.id)===v?s:null),[s,d,v]),E=j.useMemo(()=>m.find(M=>M.id===y)??((i==null?void 0:i.id)===y?i:null),[i,m,y]),T=j.useCallback((M,q)=>{if(!M.trim()){r(null);return}r(z=>({id:(z==null?void 0:z.id)??ld("rig",M,q).id,kind:"rig",label:q??cd(M,(z==null?void 0:z.label)??"Untitled RigSpec"),yaml:M,updatedAt:Date.now()}))},[]),_=j.useCallback((M,q)=>{if(!M.trim())return;const z=ld("rig",M,q??cd(M,"Untitled RigSpec"));r(z),f(Q=>C1(Q,z)),g(z.id)},[]),R=j.useCallback((M,q)=>{if(!M.trim()){l(null);return}l(z=>({id:(z==null?void 0:z.id)??ld("agent",M,q).id,kind:"agent",label:q??cd(M,(z==null?void 0:z.label)??"Untitled AgentSpec"),yaml:M,updatedAt:Date.now()}))},[]),L=j.useCallback((M,q)=>{if(!M.trim())return;const z=ld("agent",M,q??cd(M,"Untitled AgentSpec"));l(z),h(Q=>C1(Q,z)),b(z.id)},[]),I=j.useCallback(M=>{g(M);const q=d.find(z=>z.id===M)??((s==null?void 0:s.id)===M?s:null);q&&r(q)},[s,d]),P=j.useCallback(M=>{b(M);const q=m.find(z=>z.id===M)??((i==null?void 0:i.id)===M?i:null);q&&l(q)},[i,m]),A=j.useMemo(()=>({activeTask:d4(t,s,i,S),currentRigDraft:s,currentAgentDraft:i,recentRigDrafts:d,recentAgentDrafts:m,selectedRigDraft:N,selectedAgentDraft:E,bootstrapSourceRef:S,saveRigDraft:T,rememberRigDraft:_,selectRigDraft:I,clearSelectedRigDraft:()=>g(null),saveAgentDraft:R,rememberAgentDraft:L,selectAgentDraft:P,clearSelectedAgentDraft:()=>b(null),setBootstrapSourceRef:w}),[t,s,i,d,m,N,E,S,T,_,I,R,L,P]);return c.jsx(zN.Provider,{value:A,children:e})}function Co(){return j.useContext(zN)}async function h4(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 m4(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 Gg(e){return Rt({queryKey:["spec-library",e??"all"],queryFn:()=>h4(e)})}function Yg(e){return Rt({queryKey:["spec-library","review",e],queryFn:()=>m4(e),enabled:!!e})}function p4(e){return e.sourceType!=="builtin"?"Community":(e.relativePath??"").replaceAll("\\","/").startsWith("rigs/launch/")?"Stable":"Experimental"}function g4(e){return e.kind==="agent"?"AGENT":e.hasServices?"APP":"RIG"}function x4(e,t){switch(t){case"apps":return e.filter(s=>s.kind==="rig"&&s.hasServices);case"rigs":return e.filter(s=>s.kind==="rig"&&!s.hasServices);case"agents":return e.filter(s=>s.kind==="agent");default:return e}}function Sp({title:e,description:t,children:s}){return c.jsxs("section",{className:"border border-stone-300/28 bg-white/10 px-3 py-3",children:[c.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),c.jsx("p",{className:"mt-2 text-[11px] leading-5 text-stone-600",children:t}),c.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:c.jsxs("div",{className:"mt-3 w-full space-y-2",children:[c.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),c.jsx("div",{className:"w-full space-y-1",children:t.map(r=>c.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:[c.jsx("span",{className:"min-w-0 truncate text-[11px] text-stone-800",children:r.label}),c.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 y4({title:e,entries:t,onSelect:s,renderAction:r,renderExpanded:i}){return t.length===0?null:c.jsxs("div",{className:"mt-3 w-full space-y-2",children:[e&&c.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),c.jsx("div",{className:"w-full space-y-1",children:t.map(l=>{const d=g4(l),f=p4(l);return c.jsxs("div",{children:[c.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:[c.jsxs("button",{type:"button","data-testid":`library-entry-${l.id}`,onClick:()=>s(l.id),className:"flex flex-1 flex-col gap-0.5 px-2 py-2 text-left min-w-0",children:[c.jsxs("div",{className:"flex items-center justify-between w-full",children:[c.jsx("span",{className:"min-w-0 truncate text-[11px] text-stone-800",children:l.name}),c.jsxs("div",{className:"ml-2 flex shrink-0 items-center gap-1",children:[c.jsx("span",{className:"font-mono text-[7px] uppercase tracking-[0.12em] text-stone-500 border border-stone-300/50 px-1 py-0.5",children:d}),c.jsx("span",{className:"font-mono text-[7px] uppercase tracking-[0.12em] text-stone-400",children:f})]})]}),l.summary&&c.jsx("span",{className:"text-[9px] text-stone-500 leading-tight line-clamp-2",children:l.summary})]}),r&&c.jsx("div",{className:"shrink-0 pr-2",children:r(l)})]}),i&&c.jsx("div",{children:i(l)})]},l.id)})})]})}function v4({entryId:e,onDone:t}){var N,E;const{data:s}=Yg(e),{data:r=[]}=Pg(),i=Qw(),[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?c.jsx("div",{className:"font-mono text-[9px] text-stone-400 p-2",children:"No pods available in this spec."}):c.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:[c.jsx("div",{className:"font-mono text-[8px] text-stone-400 uppercase",children:"Add to Rig"}),c.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:[c.jsx("option",{value:"",children:"Select rig..."}),b.map(T=>c.jsx("option",{value:T.rigId,children:T.name},T.rigId))]}),S.length>1&&c.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,_)=>c.jsx("option",{value:_,children:T.label??T.id},T.id))}),c.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)??((E=S[f])==null?void 0:E.id)??"pod"}`}),h&&c.jsx(kN,{result:h}),g&&c.jsx("div",{className:"font-mono text-[9px] text-red-600",children:g}),c.jsx("button",{onClick:t,className:"font-mono text-[8px] text-stone-400 hover:text-stone-700",children:"Cancel"})]}):c.jsx("div",{className:"font-mono text-[9px] text-stone-400 p-2",children:"Loading spec..."})}function b4({onClose:e}){const t=Wt(),{activeTask:s,currentRigDraft:r,currentAgentDraft:i,recentRigDrafts:l,recentAgentDrafts:d,selectRigDraft:f,selectAgentDraft:m}=Co(),h=async H=>{await t({to:H})},v=async H=>{f(H),await h("/specs/rig")},g=async H=>{m(H),await h("/specs/agent")},{data:y=[]}=Gg(),[b,S]=j.useState("all"),w=x4(y,b),[N,E]=j.useState(null),[T,_]=j.useState(null),[R,L]=j.useState(""),[I,P]=j.useState(null),[A,M]=j.useState(null),q=TM(),z=AM(),Q=async H=>{await t({to:"/specs/library/$entryId",params:{entryId:H}})},Y=l.filter(H=>H.id!==(r==null?void 0:r.id)),B=d.filter(H=>H.id!==(i==null?void 0:i.id)),V=H=>{M(null),P(null),_(H.id),L(H.name)},k=async H=>{try{M(null),await z.mutateAsync({entryId:H,name:R}),_(null),L("")}catch(D){M(D.message)}},U=async H=>{try{M(null),await q.mutateAsync(H),P(null),T===H&&(_(null),L(""))}catch(D){M(D.message)}},$=(H,D)=>c.jsxs("div",{className:"flex items-center gap-1",children:[D&&c.jsx("button",{"data-testid":`library-add-to-rig-${H.id}`,onClick:G=>{G.stopPropagation(),M(null),E(N===H.id?null:H.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"}),H.sourceType==="user_file"&&c.jsxs(c.Fragment,{children:[c.jsx("button",{"data-testid":`library-rename-${H.id}`,onClick:G=>{G.stopPropagation(),V(H)},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"}),c.jsx("button",{"data-testid":`library-remove-${H.id}`,onClick:G=>{G.stopPropagation(),M(null),_(null),P(I===H.id?null:H.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"})]})]}),F=H=>{const D=T===H.id,G=I===H.id;return!D&&!G?null:c.jsxs("div",{className:"border-x border-b border-stone-300/28 bg-white/6 px-2 py-2 space-y-2",children:[D&&c.jsxs("div",{"data-testid":`library-rename-form-${H.id}`,className:"space-y-2",children:[c.jsx("input",{"data-testid":`library-rename-input-${H.id}`,value:R,onChange:J=>L(J.target.value),className:"w-full border border-stone-300 bg-white/80 px-2 py-1 font-mono text-[10px]"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{"data-testid":`library-rename-submit-${H.id}`,onClick:()=>void k(H.id),className:"font-mono text-[8px] uppercase border border-stone-300 px-2 py-1 hover:bg-stone-200",children:"Save"}),c.jsx("button",{onClick:()=>{_(null),L(""),M(null)},className:"font-mono text-[8px] uppercase text-stone-500 hover:text-stone-900",children:"Cancel"})]})]}),G&&c.jsxs("div",{"data-testid":`library-remove-confirm-${H.id}`,className:"space-y-2",children:[c.jsxs("div",{className:"font-mono text-[9px] text-stone-600",children:["Remove ",H.name," from the library?"]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{"data-testid":`library-remove-submit-${H.id}`,onClick:()=>void U(H.id),className:"font-mono text-[8px] uppercase border border-stone-300 px-2 py-1 text-red-600 hover:bg-stone-200",children:"Confirm"}),c.jsx("button",{onClick:()=>{P(null),M(null)},className:"font-mono text-[8px] uppercase text-stone-500 hover:text-stone-900",children:"Cancel"})]})]}),A&&c.jsx("div",{"data-testid":"library-action-error",className:"font-mono text-[9px] text-red-600",children:A})]})};return c.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:[c.jsxs("div",{className:"flex items-center justify-between border-b border-stone-300/35 px-4 py-3 shrink-0",children:[c.jsx("h2",{className:"min-w-0 truncate font-mono text-xs font-bold text-stone-900",children:"specs"}),c.jsx("button",{"data-testid":"specs-close",onClick:e,className:"text-stone-400 hover:text-stone-900 text-sm","aria-label":"Close",children:"✕"})]}),c.jsxs("div",{className:"flex-1 space-y-4 overflow-y-auto px-4 py-3",children:[s&&c.jsx(Sp,{title:"Current Task",description:s.summary,children:c.jsxs(we,{variant:"outline",size:"sm",onClick:()=>h(s.route),children:["Resume ",s.label]})}),c.jsxs(Sp,{title:"Rig Specs",description:"Import a rig spec, review it in the workspace, then instantiate or bootstrap it.",children:[c.jsx(we,{variant:"outline",size:"sm",onClick:()=>h("/import"),children:"Import RigSpec"}),c.jsx(we,{variant:"outline",size:"sm",onClick:()=>h("/bootstrap"),children:"Bootstrap"}),r&&c.jsx(ud,{title:"Current Draft",drafts:[r],onSelect:v}),c.jsx(ud,{title:"Recent Drafts",drafts:Y,onSelect:v})]}),c.jsxs(Sp,{title:"Agent Specs",description:"Validate agent specs and use the workspace for spec-level review surfaces.",children:[c.jsx(we,{variant:"outline",size:"sm",onClick:()=>h("/agents/validate"),children:"Validate AgentSpec"}),i&&c.jsx(ud,{title:"Current Draft",drafts:[i],onSelect:g}),c.jsx(ud,{title:"Recent Drafts",drafts:B,onSelect:g})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Library"}),c.jsx("div",{className:"flex gap-1",children:["all","apps","rigs","agents"].map(H=>c.jsx("button",{"data-testid":`filter-${H}`,onClick:()=>S(H),className:`px-2 py-1 font-mono text-[8px] uppercase tracking-[0.12em] border transition-colors ${b===H?"border-stone-900 text-stone-900 font-bold bg-white/20":"border-stone-300/50 text-stone-500 hover:text-stone-700 hover:border-stone-500"}`,children:H},H))}),c.jsx(y4,{title:"",entries:w,onSelect:Q,renderAction:H=>$(H,H.kind==="rig"),renderExpanded:F}),N&&y.some(H=>H.id===N)&&c.jsx(v4,{entryId:N,onDone:()=>E(null)})]})]})]})}function S4({selection:e,onClose:t,events:s,selectedDiscoveredId:r,onSelectDiscoveredId:i,placementTarget:l,onClearPlacement:d}){return e?e.type==="rig"?c.jsx(B3,{rigId:e.rigId,onClose:t}):e.type==="node"?c.jsx($3,{rigId:e.rigId,logicalId:e.logicalId,onClose:t}):e.type==="system"?c.jsx(Z3,{onClose:t,events:s,initialTab:e.tab??"log"}):e.type==="discovery"?c.jsx(l4,{onClose:t,selectedDiscoveredId:r,onSelectDiscoveredId:i,placementTarget:l,onClearPlacement:d}):e.type==="specs"?c.jsx(b4,{onClose:t}):null:null}function w4(){const e=Tt(),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 PN=j.createContext({selection:null,setSelection:()=>{}}),IN=j.createContext({openExplorer:()=>{}}),BN=j.createContext({selectedDiscoveredId:null,setSelectedDiscoveredId:()=>{},placementTarget:null,setPlacementTarget:()=>{},clearPlacement:()=>{}});function tr(){return j.useContext(PN)}function N4(){return j.useContext(IN)}function j4(){return j.useContext(BN)}function E4(){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 _1=1024;function C4(e){const t=e.match(/^\/rigs\/([^/]+)/);return(t==null?void 0:t[1])??null}function _4(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 R4({children:e}){var M;const s=cf().location.pathname,r=C4(s),{data:i}=xc(),[l,d]=j.useState(!1),[f,m]=j.useState(!0),[h,v]=j.useState(()=>typeof window>"u"?!0:window.innerWidth>=_1),{events:g}=q3(),[y,b]=j.useState(null),[S,w]=j.useState(null),[N,E]=j.useState(null),T=r?((M=i==null?void 0:i.find(q=>q.id===r))==null?void 0:M.name)??null:null,_=_4(s,r,T),R=j.useCallback(q=>{b(q),!h&&q&&d(!1)},[h]),L=j.useCallback(()=>{if(m(!0),!h){b(null),d(!0);return}d(!0)},[h]),I=j.useCallback(()=>{w(null),E(null)},[]),P=j.useCallback(q=>{w(q),E(null)},[]);j.useEffect(()=>{(y==null?void 0:y.type)!=="discovery"&&I()},[y,I]),j.useEffect(()=>{(y==null?void 0:y.type)==="discovery"&&N&&r!==N.rigId&&E(null)},[r,N,y]),j.useEffect(()=>{const q=()=>{v(window.innerWidth>=_1)};return q(),window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]),j.useEffect(()=>{!h&&!(s==="/specs"||s==="/discovery")&&(b(null),d(!1))},[h,s]),w4();const A={"--workspace-left-offset":h?f?"18rem":"3rem":"0rem","--workspace-right-offset":h&&y?"20rem":"0rem"};return c.jsx(f4,{children:c.jsx(PN.Provider,{value:{selection:y,setSelection:R},children:c.jsx(BN.Provider,{value:{selectedDiscoveredId:S,setSelectedDiscoveredId:P,placementTarget:N,setPlacementTarget:E,clearPlacement:I},children:c.jsx(IN.Provider,{value:{openExplorer:L},children:c.jsxs("div",{className:"h-screen flex flex-col",children:[c.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:[_&&c.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center px-28",children:c.jsx("div",{"data-testid":"header-surface-title",className:"truncate font-mono text-sm font-semibold uppercase tracking-[0.12em] text-stone-700",children:_})}),c.jsxs("div",{className:"flex items-center gap-spacing-4",children:[c.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:[c.jsx("span",{className:"block w-4 h-[1.5px] bg-stone-900"}),c.jsx("span",{className:"block w-4 h-[1.5px] bg-stone-900"}),c.jsx("span",{className:"block w-3 h-[1.5px] bg-stone-900"})]}),c.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"})]}),c.jsx("div",{className:"flex-1"}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.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:c.jsx(gA,{className:"h-4 w-4"})}),c.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:c.jsx(aA,{className:"h-4 w-4"})}),c.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:c.jsx(nA,{className:"h-4 w-4"})})]})]}),c.jsxs("div",{className:"flex flex-1 min-h-0 relative",children:[l&&c.jsx("div",{className:"fixed inset-0 bg-black/20 z-20 lg:hidden",onClick:()=>d(!1)}),c.jsx(yM,{open:l,onClose:()=>d(!1),selection:y,onSelect:R,desktopMode:f?"full":"hidden",onDesktopToggle:()=>m(q=>!q)}),c.jsx("main",{"data-testid":"content-area",className:"flex-1 flex flex-col overflow-auto relative",style:A,children:c.jsx("div",{className:"relative z-10 route-enter flex-1 flex flex-col",children:e},s)}),c.jsx(S4,{selection:y,onClose:()=>R(null),events:g,selectedDiscoveredId:S,onSelectDiscoveredId:P,placementTarget:N,onClearPlacement:I})]})]})})})})})}function Nt(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=Nt(e[s]))!==""&&(t+=(t&&" ")+r);else for(let s in e)e[s]&&(t+=(t&&" ")+s);return t}var T4={value:()=>{}};function mf(){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 A4(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=mf.prototype={constructor:Rd,on:function(e,t){var s=this._,r=A4(e+"",s),i,l=-1,d=r.length;if(arguments.length<2){for(;++l<d;)if((i=(e=r[l]).type)&&(i=M4(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]=R1(s[i],e.name,t);else if(t==null)for(i in s)s[i]=R1(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 M4(e,t){for(var s=0,r=e.length,i;s<r;++s)if((i=e[s]).name===t)return i.value}function R1(e,t,s){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=T4,e=e.slice(0,r).concat(e.slice(r+1));break}return s!=null&&e.push({name:t,value:s}),e}var ng="http://www.w3.org/1999/xhtml";const T1={svg:"http://www.w3.org/2000/svg",xhtml:ng,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function pf(e){var t=e+="",s=t.indexOf(":");return s>=0&&(t=e.slice(0,s))!=="xmlns"&&(e=e.slice(s+1)),T1.hasOwnProperty(t)?{space:T1[t],local:e}:e}function k4(e){return function(){var t=this.ownerDocument,s=this.namespaceURI;return s===ng&&t.documentElement.namespaceURI===ng?t.createElement(e):t.createElementNS(s,e)}}function O4(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function HN(e){var t=pf(e);return(t.local?O4:k4)(t)}function D4(){}function Qg(e){return e==null?D4:function(){return this.querySelector(e)}}function L4(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 jn(r,this._parents)}function z4(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function P4(){return[]}function UN(e){return e==null?P4:function(){return this.querySelectorAll(e)}}function I4(e){return function(){return z4(e.apply(this,arguments))}}function B4(e){typeof e=="function"?e=I4(e):e=UN(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 jn(r,i)}function $N(e){return function(){return this.matches(e)}}function qN(e){return function(t){return t.matches(e)}}var H4=Array.prototype.find;function U4(e){return function(){return H4.call(this.children,e)}}function $4(){return this.firstElementChild}function q4(e){return this.select(e==null?$4:U4(typeof e=="function"?e:qN(e)))}var V4=Array.prototype.filter;function G4(){return Array.from(this.children)}function Y4(e){return function(){return V4.call(this.children,e)}}function Q4(e){return this.selectAll(e==null?G4:Y4(typeof e=="function"?e:qN(e)))}function F4(e){typeof e!="function"&&(e=$N(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 jn(r,this._parents)}function VN(e){return new Array(e.length)}function K4(){return new jn(this._enter||this._groups.map(VN),this._parents)}function Yd(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Yd.prototype={constructor:Yd,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 X4(e){return function(){return e}}function Z4(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 Yd(e,l[d]);for(;d<m;++d)(f=t[d])&&(i[d]=f)}function W4(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 Yd(e,l[f]);for(f=0;f<v;++f)(m=t[f])&&h.get(y[f])===m&&(i[f]=m)}function J4(e){return e.__data__}function e5(e,t){if(!arguments.length)return Array.from(this,J4);var s=t?W4:Z4,r=this._parents,i=this._groups;typeof e!="function"&&(e=X4(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=t5(e.call(v,v&&v.__data__,h,r)),S=b.length,w=f[h]=new Array(S),N=d[h]=new Array(S),E=m[h]=new Array(y);s(v,g,w,N,E,b,t);for(var T=0,_=0,R,L;T<S;++T)if(R=w[T]){for(T>=_&&(_=T+1);!(L=N[_])&&++_<S;);R._next=L||null}}return d=new jn(d,r),d._enter=f,d._exit=m,d}function t5(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function n5(){return new jn(this._exit||this._groups.map(VN),this._parents)}function s5(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 a5(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 jn(f,this._parents)}function r5(){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 i5(e){e||(e=o5);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 jn(i,this._parents).order()}function o5(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function l5(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function c5(){return Array.from(this)}function u5(){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 d5(){let e=0;for(const t of this)++e;return e}function f5(){return!this.node()}function h5(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 m5(e){return function(){this.removeAttribute(e)}}function p5(e){return function(){this.removeAttributeNS(e.space,e.local)}}function g5(e,t){return function(){this.setAttribute(e,t)}}function x5(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function y5(e,t){return function(){var s=t.apply(this,arguments);s==null?this.removeAttribute(e):this.setAttribute(e,s)}}function v5(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 b5(e,t){var s=pf(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?p5:m5:typeof t=="function"?s.local?v5:y5:s.local?x5:g5)(s,t))}function GN(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function S5(e){return function(){this.style.removeProperty(e)}}function w5(e,t,s){return function(){this.style.setProperty(e,t,s)}}function N5(e,t,s){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,s)}}function j5(e,t,s){return arguments.length>1?this.each((t==null?S5:typeof t=="function"?N5:w5)(e,t,s??"")):yo(this.node(),e)}function yo(e,t){return e.style.getPropertyValue(t)||GN(e).getComputedStyle(e,null).getPropertyValue(t)}function E5(e){return function(){delete this[e]}}function C5(e,t){return function(){this[e]=t}}function _5(e,t){return function(){var s=t.apply(this,arguments);s==null?delete this[e]:this[e]=s}}function R5(e,t){return arguments.length>1?this.each((t==null?E5:typeof t=="function"?_5:C5)(e,t)):this.node()[e]}function YN(e){return e.trim().split(/^|\s+/)}function Fg(e){return e.classList||new QN(e)}function QN(e){this._node=e,this._names=YN(e.getAttribute("class")||"")}QN.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=Fg(e),r=-1,i=t.length;++r<i;)s.add(t[r])}function KN(e,t){for(var s=Fg(e),r=-1,i=t.length;++r<i;)s.remove(t[r])}function T5(e){return function(){FN(this,e)}}function A5(e){return function(){KN(this,e)}}function M5(e,t){return function(){(t.apply(this,arguments)?FN:KN)(this,e)}}function k5(e,t){var s=YN(e+"");if(arguments.length<2){for(var r=Fg(this.node()),i=-1,l=s.length;++i<l;)if(!r.contains(s[i]))return!1;return!0}return this.each((typeof t=="function"?M5:t?T5:A5)(s,t))}function O5(){this.textContent=""}function D5(e){return function(){this.textContent=e}}function L5(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function z5(e){return arguments.length?this.each(e==null?O5:(typeof e=="function"?L5:D5)(e)):this.node().textContent}function P5(){this.innerHTML=""}function I5(e){return function(){this.innerHTML=e}}function B5(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function H5(e){return arguments.length?this.each(e==null?P5:(typeof e=="function"?B5:I5)(e)):this.node().innerHTML}function U5(){this.nextSibling&&this.parentNode.appendChild(this)}function $5(){return this.each(U5)}function q5(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function V5(){return this.each(q5)}function G5(e){var t=typeof e=="function"?e:HN(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Y5(){return null}function Q5(e,t){var s=typeof e=="function"?e:HN(e),r=t==null?Y5:typeof t=="function"?t:Qg(t);return this.select(function(){return this.insertBefore(s.apply(this,arguments),r.apply(this,arguments)||null)})}function F5(){var e=this.parentNode;e&&e.removeChild(this)}function K5(){return this.each(F5)}function X5(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Z5(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function W5(e){return this.select(e?Z5:X5)}function J5(e){return arguments.length?this.property("__data__",e):this.node().__data__}function eO(e){return function(t){e.call(this,t,this.__data__)}}function tO(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 nO(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 sO(e,t,s){return function(){var r=this.__on,i,l=eO(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 aO(e,t,s){var r=tO(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?sO:nO,i=0;i<l;++i)this.each(f(r[i],t,s));return this}function XN(e,t,s){var r=GN(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 rO(e,t){return function(){return XN(this,e,t)}}function iO(e,t){return function(){return XN(this,e,t.apply(this,arguments))}}function oO(e,t){return this.each((typeof t=="function"?iO:rO)(e,t))}function*lO(){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 ZN=[null];function jn(e,t){this._groups=e,this._parents=t}function yc(){return new jn([[document.documentElement]],ZN)}function cO(){return this}jn.prototype=yc.prototype={constructor:jn,select:L4,selectAll:B4,selectChild:q4,selectChildren:Q4,filter:F4,data:e5,enter:K4,exit:n5,join:s5,merge:a5,selection:cO,order:r5,sort:i5,call:l5,nodes:c5,node:u5,size:d5,empty:f5,each:h5,attr:b5,style:j5,property:R5,classed:k5,text:z5,html:H5,raise:$5,lower:V5,append:G5,insert:Q5,remove:K5,clone:W5,datum:J5,on:aO,dispatch:oO,[Symbol.iterator]:lO};function Nn(e){return typeof e=="string"?new jn([[document.querySelector(e)]],[document.documentElement]):new jn([[e]],ZN)}function uO(e){let t;for(;t=e.sourceEvent;)e=t;return e}function qn(e,t){if(e=uO(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 dO={passive:!1},Jl={capture:!0,passive:!1};function wp(e){e.stopImmediatePropagation()}function no(e){e.preventDefault(),e.stopImmediatePropagation()}function WN(e){var t=e.document.documentElement,s=Nn(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 JN(e,t){var s=e.document.documentElement,r=Nn(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 sg(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}})}sg.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function fO(e){return!e.ctrlKey&&!e.button}function hO(){return this.parentNode}function mO(e,t){return t??{x:e.x,y:e.y}}function pO(){return navigator.maxTouchPoints||"ontouchstart"in this}function ej(){var e=fO,t=hO,s=mO,r=pO,i={},l=mf("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",E,dO).on("touchend.drag touchcancel.drag",T).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function b(R,L){if(!(v||!e.call(this,R,L))){var I=_(this,t.call(this,R,L),R,L,"mouse");I&&(Nn(R.view).on("mousemove.drag",S,Jl).on("mouseup.drag",w,Jl),WN(R.view),wp(R),h=!1,f=R.clientX,m=R.clientY,I("start",R))}}function S(R){if(no(R),!h){var L=R.clientX-f,I=R.clientY-m;h=L*L+I*I>g}i.mouse("drag",R)}function w(R){Nn(R.view).on("mousemove.drag mouseup.drag",null),JN(R.view,h),no(R),i.mouse("end",R)}function N(R,L){if(e.call(this,R,L)){var I=R.changedTouches,P=t.call(this,R,L),A=I.length,M,q;for(M=0;M<A;++M)(q=_(this,P,R,L,I[M].identifier,I[M]))&&(wp(R),q("start",R,I[M]))}}function E(R){var L=R.changedTouches,I=L.length,P,A;for(P=0;P<I;++P)(A=i[L[P].identifier])&&(no(R),A("drag",R,L[P]))}function T(R){var L=R.changedTouches,I=L.length,P,A;for(v&&clearTimeout(v),v=setTimeout(function(){v=null},500),P=0;P<I;++P)(A=i[L[P].identifier])&&(wp(R),A("end",R,L[P]))}function _(R,L,I,P,A,M){var q=l.copy(),z=qn(M||I,L),Q,Y,B;if((B=s.call(R,new sg("beforestart",{sourceEvent:I,target:y,identifier:A,active:d,x:z[0],y:z[1],dx:0,dy:0,dispatch:q}),P))!=null)return Q=B.x-z[0]||0,Y=B.y-z[1]||0,function V(k,U,$){var F=z,H;switch(k){case"start":i[A]=V,H=d++;break;case"end":delete i[A],--d;case"drag":z=qn($||U,L),H=d;break}q.call(k,R,new sg(k,{sourceEvent:U,subject:B,target:y,identifier:A,active:H,x:z[0]+Q,y:z[1]+Y,dx:z[0]-F[0],dy:z[1]-F[1],dispatch:q}),P)}}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 Kg(e,t,s){e.prototype=t.prototype=s,s.constructor=e}function tj(e,t){var s=Object.create(e.prototype);for(var r in t)s[r]=t[r];return s}function vc(){}var ec=.7,Qd=1/ec,so="\\s*([+-]?\\d+)\\s*",tc="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",hs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",gO=/^#([0-9a-f]{3,8})$/,xO=new RegExp(`^rgb\\(${so},${so},${so}\\)$`),yO=new RegExp(`^rgb\\(${hs},${hs},${hs}\\)$`),vO=new RegExp(`^rgba\\(${so},${so},${so},${tc}\\)$`),bO=new RegExp(`^rgba\\(${hs},${hs},${hs},${tc}\\)$`),SO=new RegExp(`^hsl\\(${tc},${hs},${hs}\\)$`),wO=new RegExp(`^hsla\\(${tc},${hs},${hs},${tc}\\)$`),A1={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};Kg(vc,Jr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:M1,formatHex:M1,formatHex8:NO,formatHsl:jO,formatRgb:k1,toString:k1});function M1(){return this.rgb().formatHex()}function NO(){return this.rgb().formatHex8()}function jO(){return nj(this).formatHsl()}function k1(){return this.rgb().formatRgb()}function Jr(e){var t,s;return e=(e+"").trim().toLowerCase(),(t=gO.exec(e))?(s=t[1].length,t=parseInt(t[1],16),s===6?O1(t):s===3?new dn(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=xO.exec(e))?new dn(t[1],t[2],t[3],1):(t=yO.exec(e))?new dn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=vO.exec(e))?fd(t[1],t[2],t[3],t[4]):(t=bO.exec(e))?fd(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=SO.exec(e))?z1(t[1],t[2]/100,t[3]/100,1):(t=wO.exec(e))?z1(t[1],t[2]/100,t[3]/100,t[4]):A1.hasOwnProperty(e)?O1(A1[e]):e==="transparent"?new dn(NaN,NaN,NaN,0):null}function O1(e){return new dn(e>>16&255,e>>8&255,e&255,1)}function fd(e,t,s,r){return r<=0&&(e=t=s=NaN),new dn(e,t,s,r)}function EO(e){return e instanceof vc||(e=Jr(e)),e?(e=e.rgb(),new dn(e.r,e.g,e.b,e.opacity)):new dn}function ag(e,t,s,r){return arguments.length===1?EO(e):new dn(e,t,s,r??1)}function dn(e,t,s,r){this.r=+e,this.g=+t,this.b=+s,this.opacity=+r}Kg(dn,ag,tj(vc,{brighter(e){return e=e==null?Qd:Math.pow(Qd,e),new dn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ec:Math.pow(ec,e),new dn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new dn(Fr(this.r),Fr(this.g),Fr(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:D1,formatHex:D1,formatHex8:CO,formatRgb:L1,toString:L1}));function D1(){return`#${kr(this.r)}${kr(this.g)}${kr(this.b)}`}function CO(){return`#${kr(this.r)}${kr(this.g)}${kr(this.b)}${kr((isNaN(this.opacity)?1:this.opacity)*255)}`}function L1(){const e=Fd(this.opacity);return`${e===1?"rgb(":"rgba("}${Fr(this.r)}, ${Fr(this.g)}, ${Fr(this.b)}${e===1?")":`, ${e})`}`}function Fd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Fr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function kr(e){return e=Fr(e),(e<16?"0":"")+e.toString(16)}function z1(e,t,s,r){return r<=0?e=t=s=NaN:s<=0||s>=1?e=t=NaN:t<=0&&(e=NaN),new Vn(e,t,s,r)}function nj(e){if(e instanceof Vn)return new Vn(e.h,e.s,e.l,e.opacity);if(e instanceof vc||(e=Jr(e)),!e)return new Vn;if(e instanceof Vn)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 Vn(d,f,m,e.opacity)}function _O(e,t,s,r){return arguments.length===1?nj(e):new Vn(e,t,s,r??1)}function Vn(e,t,s,r){this.h=+e,this.s=+t,this.l=+s,this.opacity=+r}Kg(Vn,_O,tj(vc,{brighter(e){return e=e==null?Qd:Math.pow(Qd,e),new Vn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ec:Math.pow(ec,e),new Vn(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 dn(Np(e>=240?e-240:e+120,i,r),Np(e,i,r),Np(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Vn(P1(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("}${P1(this.h)}, ${hd(this.s)*100}%, ${hd(this.l)*100}%${e===1?")":`, ${e})`}`}}));function P1(e){return e=(e||0)%360,e<0?e+360:e}function hd(e){return Math.max(0,Math.min(1,e||0))}function Np(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 RO(e,t){return function(s){return e+s*t}}function TO(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 AO(e){return(e=+e)==1?sj:function(t,s){return s-t?TO(t,s,e):Xg(isNaN(t)?s:t)}}function sj(e,t){var s=t-e;return s?RO(e,s):Xg(isNaN(e)?t:e)}const Kd=(function e(t){var s=AO(t);function r(i,l){var d=s((i=ag(i)).r,(l=ag(l)).r),f=s(i.g,l.g),m=s(i.b,l.b),h=sj(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 MO(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 kO(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function OO(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 DO(e,t){var s=new Date;return e=+e,t=+t,function(r){return s.setTime(e*(1-r)+t*r),s}}function cs(e,t){return e=+e,t=+t,function(s){return e*(1-s)+t*s}}function LO(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 rg=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jp=new RegExp(rg.source,"g");function zO(e){return function(){return e}}function PO(e){return function(t){return e(t)+""}}function aj(e,t){var s=rg.lastIndex=jp.lastIndex=0,r,i,l,d=-1,f=[],m=[];for(e=e+"",t=t+"";(r=rg.exec(e))&&(i=jp.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:cs(r,i)})),s=jp.lastIndex;return s<t.length&&(l=t.slice(s),f[d]?f[d]+=l:f[++d]=l),f.length<2?m[0]?PO(m[0].x):zO(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"?cs:s==="string"?(r=Jr(t))?(t=r,Kd):aj:t instanceof Jr?Kd:t instanceof Date?DO:kO(t)?MO:Array.isArray(t)?OO:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?LO:cs)(e,t)}var I1=180/Math.PI,ig={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function rj(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)*I1,skewX:Math.atan(m)*I1,scaleX:d,scaleY:f}}var md;function IO(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ig:rj(t.a,t.b,t.c,t.d,t.e,t.f)}function BO(e){return e==null||(md||(md=document.createElementNS("http://www.w3.org/2000/svg","g")),md.setAttribute("transform",e),!(e=md.transform.baseVal.consolidate()))?ig:(e=e.matrix,rj(e.a,e.b,e.c,e.d,e.e,e.f))}function ij(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:cs(h,g)},{i:w-2,x:cs(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:cs(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:cs(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:cs(h,g)},{i:w-2,x:cs(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 HO=ij(IO,"px, ","px)","deg)"),UO=ij(BO,", ",")",")"),$O=1e-12;function B1(e){return((e=Math.exp(e))+1/e)/2}function qO(e){return((e=Math.exp(e))-1/e)/2}function VO(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,E;if(w<$O)E=Math.log(y/h)/t,N=function(P){return[f+P*b,m+P*S,h*Math.exp(t*P*E)]};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),L=Math.log(Math.sqrt(_*_+1)-_),I=Math.log(Math.sqrt(R*R+1)-R);E=(I-L)/t,N=function(P){var A=P*E,M=B1(L),q=h/(s*T)*(M*VO(t*A+L)-qO(L));return[f+q*b,m+q*S,h*M/B1(t*A+L)]}}return N.duration=E*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,oj=1e3,Xd,Ll,Zd=0,ei=0,gf=0,nc=typeof performance=="object"&&performance.now?performance:Date,lj=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Zg(){return ei||(lj(GO),ei=nc.now()+gf)}function GO(){ei=0}function Wd(){this._call=this._time=this._next=null}Wd.prototype=cj.prototype={constructor:Wd,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:Xd=this,Ll=this),this._call=e,this._time=s,og()},stop:function(){this._call&&(this._call=null,this._time=1/0,og())}};function cj(e,t,s){var r=new Wd;return r.restart(e,t,s),r}function YO(){Zg(),++vo;for(var e=Xd,t;e;)(t=ei-e._time)>=0&&e._call.call(void 0,t),e=e._next;--vo}function H1(){ei=(Zd=nc.now())+gf,vo=Dl=0;try{YO()}finally{vo=0,FO(),ei=0}}function QO(){var e=nc.now(),t=e-Zd;t>oj&&(gf-=t,Zd=e)}function FO(){for(var e,t=Xd,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:Xd=s);Ll=e,og(r)}function og(e){if(!vo){Dl&&(Dl=clearTimeout(Dl));var t=e-ei;t>24?(e<1/0&&(Dl=setTimeout(H1,e-nc.now()-gf)),Al&&(Al=clearInterval(Al))):(Al||(Zd=nc.now(),Al=setInterval(QO,oj)),vo=1,lj(H1))}}function U1(e,t,s){var r=new Wd;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,s),r}var KO=mf("start","end","cancel","interrupt"),XO=[],uj=0,$1=1,lg=2,Ad=3,q1=4,cg=5,Md=6;function xf(e,t,s,r,i,l){var d=e.__transition;if(!d)e.__transition={};else if(s in d)return;ZO(e,s,{name:t,index:r,group:i,on:KO,tween:XO,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:uj})}function Wg(e,t){var s=Xn(e,t);if(s.state>uj)throw new Error("too late; already scheduled");return s}function ps(e,t){var s=Xn(e,t);if(s.state>Ad)throw new Error("too late; already running");return s}function Xn(e,t){var s=e.__transition;if(!s||!(s=s[t]))throw new Error("transition not found");return s}function ZO(e,t,s){var r=e.__transition,i;r[t]=s,s.timer=cj(l,0,s.time);function l(h){s.state=$1,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!==$1)return m();for(v in r)if(b=r[v],b.name===s.name){if(b.state===Ad)return U1(d);b.state===q1?(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(U1(function(){s.state===Ad&&(s.state=q1,s.timer.restart(f,s.delay,s.time),f(h))}),s.state=lg,s.on.call("start",e,e.__data__,s.index,s.group),s.state===lg){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=cg,1),g=-1,y=i.length;++g<y;)i[g].call(e,v);s.state===cg&&(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>lg&&r.state<cg,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 WO(e){return this.each(function(){kd(this,e)})}function JO(e,t){var s,r;return function(){var i=ps(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 eD(e,t,s){var r,i;if(typeof s!="function")throw new Error;return function(){var l=ps(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 tD(e,t){var s=this._id;if(e+="",arguments.length<2){for(var r=Xn(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?JO:eD)(s,e,t))}function Jg(e,t,s){var r=e._id;return e.each(function(){var i=ps(this,r);(i.value||(i.value={}))[t]=s.apply(this,arguments)}),function(i){return Xn(i,r).value[t]}}function dj(e,t){var s;return(typeof t=="number"?cs:t instanceof Jr?Kd:(s=Jr(t))?(t=s,Kd):aj)(e,t)}function nD(e){return function(){this.removeAttribute(e)}}function sD(e){return function(){this.removeAttributeNS(e.space,e.local)}}function aD(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 rD(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 iD(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 oD(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 lD(e,t){var s=pf(e),r=s==="transform"?UO:dj;return this.attrTween(e,typeof t=="function"?(s.local?oD:iD)(s,r,Jg(this,"attr."+e,t)):t==null?(s.local?sD:nD)(s):(s.local?rD:aD)(s,r,t))}function cD(e,t){return function(s){this.setAttribute(e,t.call(this,s))}}function uD(e,t){return function(s){this.setAttributeNS(e.space,e.local,t.call(this,s))}}function dD(e,t){var s,r;function i(){var l=t.apply(this,arguments);return l!==r&&(s=(r=l)&&uD(e,l)),s}return i._value=t,i}function fD(e,t){var s,r;function i(){var l=t.apply(this,arguments);return l!==r&&(s=(r=l)&&cD(e,l)),s}return i._value=t,i}function hD(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=pf(e);return this.tween(s,(r.local?dD:fD)(r,t))}function mD(e,t){return function(){Wg(this,e).delay=+t.apply(this,arguments)}}function pD(e,t){return t=+t,function(){Wg(this,e).delay=t}}function gD(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?mD:pD)(t,e)):Xn(this.node(),t).delay}function xD(e,t){return function(){ps(this,e).duration=+t.apply(this,arguments)}}function yD(e,t){return t=+t,function(){ps(this,e).duration=t}}function vD(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?xD:yD)(t,e)):Xn(this.node(),t).duration}function bD(e,t){if(typeof t!="function")throw new Error;return function(){ps(this,e).ease=t}}function SD(e){var t=this._id;return arguments.length?this.each(bD(t,e)):Xn(this.node(),t).ease}function wD(e,t){return function(){var s=t.apply(this,arguments);if(typeof s!="function")throw new Error;ps(this,e).ease=s}}function ND(e){if(typeof e!="function")throw new Error;return this.each(wD(this._id,e))}function jD(e){typeof e!="function"&&(e=$N(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 Ks(r,this._parents,this._name,this._id)}function ED(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 Ks(d,this._parents,this._name,this._id)}function CD(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 _D(e,t,s){var r,i,l=CD(t)?Wg:ps;return function(){var d=l(this,e),f=d.on;f!==r&&(i=(r=f).copy()).on(t,s),d.on=i}}function RD(e,t){var s=this._id;return arguments.length<2?Xn(this.node(),s).on.on(e):this.each(_D(s,e,t))}function TD(e){return function(){var t=this.parentNode;for(var s in this.__transition)if(+s!==e)return;t&&t.removeChild(this)}}function AD(){return this.on("end.remove",TD(this._id))}function MD(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,xf(h[y],t,s,y,h,Xn(v,s)));return new Ks(l,this._parents,t,s)}function kD(e){var t=this._name,s=this._id;typeof e!="function"&&(e=UN(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=Xn(v,s),w=0,N=y.length;w<N;++w)(b=y[w])&&xf(b,t,s,w,y,S);l.push(y),d.push(v)}return new Ks(l,d,t,s)}var OD=yc.prototype.constructor;function DD(){return new OD(this._groups,this._parents)}function LD(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 fj(e){return function(){this.style.removeProperty(e)}}function zD(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 PD(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 ID(e,t){var s,r,i,l="style."+t,d="end."+l,f;return function(){var m=ps(this,e),h=m.on,v=m.value[l]==null?f||(f=fj(t)):void 0;(h!==s||i!==v)&&(r=(s=h).copy()).on(d,i=v),m.on=r}}function BD(e,t,s){var r=(e+="")=="transform"?HO:dj;return t==null?this.styleTween(e,LD(e,r)).on("end.style."+e,fj(e)):typeof t=="function"?this.styleTween(e,PD(e,r,Jg(this,"style."+e,t))).each(ID(this._id,e)):this.styleTween(e,zD(e,r,t),s).on("end.style."+e,null)}function HD(e,t,s){return function(r){this.style.setProperty(e,t.call(this,r),s)}}function UD(e,t,s){var r,i;function l(){var d=t.apply(this,arguments);return d!==i&&(r=(i=d)&&HD(e,d,s)),r}return l._value=t,l}function $D(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,UD(e,t,s??""))}function qD(e){return function(){this.textContent=e}}function VD(e){return function(){var t=e(this);this.textContent=t??""}}function GD(e){return this.tween("text",typeof e=="function"?VD(Jg(this,"text",e)):qD(e==null?"":e+""))}function YD(e){return function(t){this.textContent=e.call(this,t)}}function QD(e){var t,s;function r(){var i=e.apply(this,arguments);return i!==s&&(t=(s=i)&&YD(i)),t}return r._value=e,r}function FD(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,QD(e))}function KD(){for(var e=this._name,t=this._id,s=hj(),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=Xn(m,t);xf(m,e,s,h,d,{time:v.time+v.delay+v.duration,delay:0,duration:v.duration,ease:v.ease})}return new Ks(r,this._parents,e,s)}function XD(){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=ps(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 ZD=0;function Ks(e,t,s,r){this._groups=e,this._parents=t,this._name=s,this._id=r}function hj(){return++ZD}var Is=yc.prototype;Ks.prototype={constructor:Ks,select:MD,selectAll:kD,selectChild:Is.selectChild,selectChildren:Is.selectChildren,filter:jD,merge:ED,selection:DD,transition:KD,call:Is.call,nodes:Is.nodes,node:Is.node,size:Is.size,empty:Is.empty,each:Is.each,on:RD,attr:lD,attrTween:hD,style:BD,styleTween:$D,text:GD,textTween:FD,remove:AD,tween:tD,delay:gD,duration:vD,ease:SD,easeVarying:ND,end:XD,[Symbol.iterator]:Is[Symbol.iterator]};function WD(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var JD={time:null,delay:0,duration:250,ease:WD};function eL(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 tL(e){var t,s;e instanceof Ks?(t=e._id,e=e._name):(t=hj(),(s=JD).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])&&xf(m,e,t,h,d,s||eL(m,t));return new Ks(r,this._parents,e,t)}yc.prototype.interrupt=WO;yc.prototype.transition=tL;const pd=e=>()=>e;function nL(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 yf=new Ys(1,0,0);mj.prototype=Ys.prototype;function mj(e){for(;!e.__zoom;)if(!(e=e.parentNode))return yf;return e.__zoom}function Ep(e){e.stopImmediatePropagation()}function Ml(e){e.preventDefault(),e.stopImmediatePropagation()}function sL(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function aL(){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 V1(){return this.__zoom||yf}function rL(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function iL(){return navigator.maxTouchPoints||"ontouchstart"in this}function oL(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 pj(){var e=sL,t=aL,s=oL,r=rL,i=iL,l=[0,1/0],d=[[-1/0,-1/0],[1/0,1/0]],f=250,m=Td,h=mf("start","zoom","end"),v,g,y,b=500,S=150,w=0,N=10;function E(B){B.property("__zoom",V1).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",M).on("dblclick.zoom",q).filter(i).on("touchstart.zoom",z).on("touchmove.zoom",Q).on("touchend.zoom touchcancel.zoom",Y).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(B,V,k,U){var $=B.selection?B.selection():B;$.property("__zoom",V1),B!==$?L(B,V,k,U):$.interrupt().each(function(){I(this,arguments).event(U).start().zoom(null,typeof V=="function"?V.apply(this,arguments):V).end()})},E.scaleBy=function(B,V,k,U){E.scaleTo(B,function(){var $=this.__zoom.k,F=typeof V=="function"?V.apply(this,arguments):V;return $*F},k,U)},E.scaleTo=function(B,V,k,U){E.transform(B,function(){var $=t.apply(this,arguments),F=this.__zoom,H=k==null?R($):typeof k=="function"?k.apply(this,arguments):k,D=F.invert(H),G=typeof V=="function"?V.apply(this,arguments):V;return s(_(T(F,G),H,D),$,d)},k,U)},E.translateBy=function(B,V,k,U){E.transform(B,function(){return s(this.__zoom.translate(typeof V=="function"?V.apply(this,arguments):V,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),d)},null,U)},E.translateTo=function(B,V,k,U,$){E.transform(B,function(){var F=t.apply(this,arguments),H=this.__zoom,D=U==null?R(F):typeof U=="function"?U.apply(this,arguments):U;return s(yf.translate(D[0],D[1]).scale(H.k).translate(typeof V=="function"?-V.apply(this,arguments):-V,typeof k=="function"?-k.apply(this,arguments):-k),F,d)},U,$)};function T(B,V){return V=Math.max(l[0],Math.min(l[1],V)),V===B.k?B:new Ys(V,B.x,B.y)}function _(B,V,k){var U=V[0]-k[0]*B.k,$=V[1]-k[1]*B.k;return U===B.x&&$===B.y?B:new Ys(B.k,U,$)}function R(B){return[(+B[0][0]+ +B[1][0])/2,(+B[0][1]+ +B[1][1])/2]}function L(B,V,k,U){B.on("start.zoom",function(){I(this,arguments).event(U).start()}).on("interrupt.zoom end.zoom",function(){I(this,arguments).event(U).end()}).tween("zoom",function(){var $=this,F=arguments,H=I($,F).event(U),D=t.apply($,F),G=k==null?R(D):typeof k=="function"?k.apply($,F):k,J=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),se=$.__zoom,oe=typeof V=="function"?V.apply($,F):V,ce=m(se.invert(G).concat(J/se.k),oe.invert(G).concat(J/oe.k));return function(de){if(de===1)de=oe;else{var ue=ce(de),fe=J/ue[2];de=new Ys(fe,G[0]-ue[0]*fe,G[1]-ue[1]*fe)}H.zoom(null,de)}})}function I(B,V,k){return!k&&B.__zooming||new P(B,V)}function P(B,V){this.that=B,this.args=V,this.active=0,this.sourceEvent=null,this.extent=t.apply(B,V),this.taps=0}P.prototype={event:function(B){return B&&(this.sourceEvent=B),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(B,V){return this.mouse&&B!=="mouse"&&(this.mouse[1]=V.invert(this.mouse[0])),this.touch0&&B!=="touch"&&(this.touch0[1]=V.invert(this.touch0[0])),this.touch1&&B!=="touch"&&(this.touch1[1]=V.invert(this.touch1[0])),this.that.__zoom=V,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(B){var V=Nn(this.that).datum();h.call(B,this.that,new nL(B,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:h}),V)}};function A(B,...V){if(!e.apply(this,arguments))return;var k=I(this,V).event(B),U=this.__zoom,$=Math.max(l[0],Math.min(l[1],U.k*Math.pow(2,r.apply(this,arguments)))),F=qn(B);if(k.wheel)(k.mouse[0][0]!==F[0]||k.mouse[0][1]!==F[1])&&(k.mouse[1]=U.invert(k.mouse[0]=F)),clearTimeout(k.wheel);else{if(U.k===$)return;k.mouse=[F,U.invert(F)],kd(this),k.start()}Ml(B),k.wheel=setTimeout(H,S),k.zoom("mouse",s(_(T(U,$),k.mouse[0],k.mouse[1]),k.extent,d));function H(){k.wheel=null,k.end()}}function M(B,...V){if(y||!e.apply(this,arguments))return;var k=B.currentTarget,U=I(this,V,!0).event(B),$=Nn(B.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",J,!0),F=qn(B,k),H=B.clientX,D=B.clientY;WN(B.view),Ep(B),U.mouse=[F,this.__zoom.invert(F)],kd(this),U.start();function G(se){if(Ml(se),!U.moved){var oe=se.clientX-H,ce=se.clientY-D;U.moved=oe*oe+ce*ce>w}U.event(se).zoom("mouse",s(_(U.that.__zoom,U.mouse[0]=qn(se,k),U.mouse[1]),U.extent,d))}function J(se){$.on("mousemove.zoom mouseup.zoom",null),JN(se.view,U.moved),Ml(se),U.event(se).end()}}function q(B,...V){if(e.apply(this,arguments)){var k=this.__zoom,U=qn(B.changedTouches?B.changedTouches[0]:B,this),$=k.invert(U),F=k.k*(B.shiftKey?.5:2),H=s(_(T(k,F),U,$),t.apply(this,V),d);Ml(B),f>0?Nn(this).transition().duration(f).call(L,H,U,B):Nn(this).call(E.transform,H,U,B)}}function z(B,...V){if(e.apply(this,arguments)){var k=B.touches,U=k.length,$=I(this,V,B.changedTouches.length===U).event(B),F,H,D,G;for(Ep(B),H=0;H<U;++H)D=k[H],G=qn(D,this),G=[G,this.__zoom.invert(G),D.identifier],$.touch0?!$.touch1&&$.touch0[2]!==G[2]&&($.touch1=G,$.taps=0):($.touch0=G,F=!0,$.taps=1+!!v);v&&(v=clearTimeout(v)),F&&($.taps<2&&(g=G[0],v=setTimeout(function(){v=null},b)),kd(this),$.start())}}function Q(B,...V){if(this.__zooming){var k=I(this,V).event(B),U=B.changedTouches,$=U.length,F,H,D,G;for(Ml(B),F=0;F<$;++F)H=U[F],D=qn(H,this),k.touch0&&k.touch0[2]===H.identifier?k.touch0[0]=D:k.touch1&&k.touch1[2]===H.identifier&&(k.touch1[0]=D);if(H=k.that.__zoom,k.touch1){var J=k.touch0[0],se=k.touch0[1],oe=k.touch1[0],ce=k.touch1[1],de=(de=oe[0]-J[0])*de+(de=oe[1]-J[1])*de,ue=(ue=ce[0]-se[0])*ue+(ue=ce[1]-se[1])*ue;H=T(H,Math.sqrt(de/ue)),D=[(J[0]+oe[0])/2,(J[1]+oe[1])/2],G=[(se[0]+ce[0])/2,(se[1]+ce[1])/2]}else if(k.touch0)D=k.touch0[0],G=k.touch0[1];else return;k.zoom("touch",s(_(H,D,G),k.extent,d))}}function Y(B,...V){if(this.__zooming){var k=I(this,V).event(B),U=B.changedTouches,$=U.length,F,H;for(Ep(B),y&&clearTimeout(y),y=setTimeout(function(){y=null},b),F=0;F<$;++F)H=U[F],k.touch0&&k.touch0[2]===H.identifier?delete k.touch0:k.touch1&&k.touch1[2]===H.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(H=qn(H,this),Math.hypot(g[0]-H[0],g[1]-H[1])<N)){var D=Nn(this).on("dblclick.zoom");D&&D.apply(this,arguments)}}}return E.wheelDelta=function(B){return arguments.length?(r=typeof B=="function"?B:pd(+B),E):r},E.filter=function(B){return arguments.length?(e=typeof B=="function"?B:pd(!!B),E):e},E.touchable=function(B){return arguments.length?(i=typeof B=="function"?B:pd(!!B),E):i},E.extent=function(B){return arguments.length?(t=typeof B=="function"?B:pd([[+B[0][0],+B[0][1]],[+B[1][0],+B[1][1]]]),E):t},E.scaleExtent=function(B){return arguments.length?(l[0]=+B[0],l[1]=+B[1],E):[l[0],l[1]]},E.translateExtent=function(B){return arguments.length?(d[0][0]=+B[0][0],d[1][0]=+B[1][0],d[0][1]=+B[0][1],d[1][1]=+B[1][1],E):[[d[0][0],d[0][1]],[d[1][0],d[1][1]]]},E.constrain=function(B){return arguments.length?(s=B,E):s},E.duration=function(B){return arguments.length?(f=+B,E):f},E.interpolate=function(B){return arguments.length?(m=B,E):m},E.on=function(){var B=h.on.apply(h,arguments);return B===h?E:B},E.clickDistance=function(B){return arguments.length?(w=(B=+B)*B,E):Math.sqrt(w)},E.tapDistance=function(B){return arguments.length?(N=+B,E):N},E}const ms={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]],gj=["Enter"," ","Escape"],xj={"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 Kr;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Kr||(Kr={}));var ac;(function(e){e.Partial="partial",e.Full="full"})(ac||(ac={}));const yj={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 Ne;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ne||(Ne={}));const G1={[Ne.Left]:Ne.Right,[Ne.Right]:Ne.Left,[Ne.Top]:Ne.Bottom,[Ne.Bottom]:Ne.Top};function vj(e){return e===null?null:e?"valid":"invalid"}const bj=e=>"id"in e&&"source"in e&&"target"in e,lL=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}},cL=(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?Jd(d,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return vf(r,f)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return bf(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=vf(s,Jd(i)),r=!0)}),r?bf(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),E=l&&w>0;(!h.internals.handleBounds||E||w>=N||h.dragging)&&m.push(h)}return m},uL=(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 dL(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 fL({nodes:e,width:t,height:s,panZoom:r,minZoom:i,maxZoom:l},d){if(e.size===0)return Promise.resolve(!0);const f=dL(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 Sj({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",ms.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",ms.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 hL({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=uL(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 wj(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 Y1=(e,t,s)=>e<t?So(Math.abs(e-t),1,t)/t:e>s?-So(Math.abs(e-s),1,t)/t:0,Nj=(e,t,s=15,r=40)=>{const i=Y1(e.x,r,t.width-r)*s,l=Y1(e.y,r,t.height-r)*s;return[i,l]},vf=(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)}),ug=({x:e,y:t,width:s,height:r})=>({x:e,y:t,x2:e+s,y2:t+r}),bf=({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}},Jd=(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)}},jj=(e,t)=>bf(vf(ug(e),ug(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)},Q1=e=>Gn(e.width)&&Gn(e.height)&&Gn(e.x)&&Gn(e.y),Gn=e=>!isNaN(e)&&isFinite(e),mL=(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},ef=({x:e,y:t},[s,r,i])=>({x:e*i+s,y:t*i+r});function Ki(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 pL(e,t,s){if(typeof e=="string"||typeof e=="number"){const r=Ki(e,s),i=Ki(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=Ki(e.top??e.y??0,s),i=Ki(e.bottom??e.y??0,s),l=Ki(e.left??e.x??0,t),d=Ki(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 gL(e,t,s,r,i,l){const{x:d,y:f}=ef(e,[t,s,r]),{x:m,y:h}=ef({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=pL(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=gL(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 Ej(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 Cj(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 xL(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function yL(e){return{...xj,...e||{}}}function Il(e,{snapGrid:t=[0,0],snapToGrid:s=!1,transform:r,containerBounds:i}){const{x:l,y:d}=Yn(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}),_j=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},vL=["INPUT","SELECT","TEXTAREA"];function Rj(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:vL.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Tj=e=>"clientX"in e,Yn=(e,t)=>{var l,d;const s=Tj(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)}},K1=(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 Aj({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 X1({pos:e,x1:t,y1:s,x2:r,y2:i,c:l}){switch(e){case Ne.Left:return[t-gd(t-r,l),s];case Ne.Right:return[t+gd(r-t,l),s];case Ne.Top:return[t,s-gd(s-i,l)];case Ne.Bottom:return[t,s+gd(i-s,l)]}}function Mj({sourceX:e,sourceY:t,sourcePosition:s=Ne.Bottom,targetX:r,targetY:i,targetPosition:l=Ne.Top,curvature:d=.25}){const[f,m]=X1({pos:s,x1:e,y1:t,x2:r,y2:i,c:d}),[h,v]=X1({pos:l,x1:r,y1:i,x2:e,y2:t,c:d}),[g,y,b,S]=Aj({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 kj({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 bL({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 SL({sourceNode:e,targetNode:t,width:s,height:r,transform:i}){const l=vf(Jd(e),Jd(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,bf(l))>0}const wL=({source:e,sourceHandle:t,target:s,targetHandle:r})=>`xy-edge__${e}${t||""}-${s}${r||""}`,NL=(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)),jL=(e,t,s={})=>{if(!e.source||!e.target)return t;const r=s.getEdgeId||wL;let i;return bj(e)?i={...e}:i={...e,id:r(e)},NL(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function Oj({sourceX:e,sourceY:t,targetX:s,targetY:r}){const[i,l,d,f]=kj({sourceX:e,sourceY:t,targetX:s,targetY:r});return[`M ${e},${t}L ${s},${r}`,i,l,d,f]}const Z1={[Ne.Left]:{x:-1,y:0},[Ne.Right]:{x:1,y:0},[Ne.Top]:{x:0,y:-1},[Ne.Bottom]:{x:0,y:1}},EL=({source:e,sourcePosition:t=Ne.Bottom,target:s})=>t===Ne.Left||t===Ne.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},W1=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function CL({source:e,sourcePosition:t=Ne.Bottom,target:s,targetPosition:r=Ne.Top,center:i,offset:l,stepPosition:d}){const f=Z1[t],m=Z1[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=EL({source:h,sourcePosition:t,target:v}),y=g.x!==0?"x":"y",b=g[y];let S=[],w,N;const E={x:0,y:0},T={x:0,y:0},[,,_,R]=kj({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 I=[{x:w,y:h.y},{x:w,y:v.y}],P=[{x:h.x,y:N},{x:v.x,y:N}];f[y]===b?S=y==="x"?I:P:S=y==="x"?P:I}else{const I=[{x:h.x,y:v.y}],P=[{x:v.x,y:h.y}];if(y==="x"?S=f.x===b?P:I:S=f.y===b?I:P,t===r){const Q=Math.abs(e[y]-s[y]);if(Q<=l){const Y=Math.min(l-1,l-Q);f[y]===b?E[y]=(h[y]>e[y]?-1:1)*Y:T[y]=(v[y]>s[y]?-1:1)*Y}}if(t!==r){const Q=y==="x"?"y":"x",Y=f[y]===m[Q],B=h[Q]>v[Q],V=h[Q]<v[Q];(f[y]===1&&(!Y&&B||Y&&V)||f[y]!==1&&(!Y&&V||Y&&B))&&(S=y==="x"?I:P)}const A={x:h.x+E.x,y:h.y+E.y},M={x:v.x+T.x,y:v.y+T.y},q=Math.max(Math.abs(A.x-S[0].x),Math.abs(M.x-S[0].x)),z=Math.max(Math.abs(A.y-S[0].y),Math.abs(M.y-S[0].y));q>=z?(w=(A.x+M.x)/2,N=S[0].y):(w=S[0].x,N=(A.y+M.y)/2)}return[[e,{x:h.x+E.x,y:h.y+E.y},...S,{x:v.x+T.x,y:v.y+T.y},s],w,N,_,R]}function _L(e,t,s,r){const i=Math.min(W1(e,t)/2,W1(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 dg({sourceX:e,sourceY:t,sourcePosition:s=Ne.Bottom,targetX:r,targetY:i,targetPosition:l=Ne.Top,borderRadius:d=5,centerX:f,centerY:m,offset:h=20,stepPosition:v=.5}){const[g,y,b,S,w]=CL({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((E,T,_)=>{let R="";return _>0&&_<g.length-1?R=_L(g[_-1],T,g[_+1],d):R=`${_===0?"M":"L"}${T.x} ${T.y}`,E+=R,E},""),y,b,S,w]}function J1(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function RL(e){var g;const{sourceNode:t,targetNode:s}=e;if(!J1(t)||!J1(s))return null;const r=t.internals.handleBounds||eS(t.handles),i=s.internals.handleBounds||eS(s.handles),l=tS((r==null?void 0:r.source)??[],e.sourceHandle),d=tS(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",ms.error008(l?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const f=(l==null?void 0:l.position)||Ne.Bottom,m=(d==null?void 0:d.position)||Ne.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 eS(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=Ne.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 Ne.Top:return{x:i+d/2,y:l};case Ne.Right:return{x:i+d,y:l+f/2};case Ne.Bottom:return{x:i+d/2,y:l+f};case Ne.Left:return{x:i,y:l+f/2}}}function tS(e,t){return e&&(t?e.find(s=>s.id===t):e[0])||null}function fg(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function TL(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=fg(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 Dj=1e3,AL=10,a0={nodeOrigin:[0,0],nodeExtent:sc,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ML={...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 kL(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 OL(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 hg(e,t,s,r={}){var h,v;const i=r0(ML,r),l={i:0},d=new Map(t),f=i!=null&&i.elevateNodesOnSelect&&!i0(i.zIndexMode)?Dj: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:OL(g,y),z:Lj(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 DL(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}DL(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*AL),i&&v.internals.rootParentIndex!==void 0&&(i.i=v.internals.rootParentIndex);const g=l&&!i0(m)?Dj:0,{x:y,y:b,z:S}=LL(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 Lj(e,t,s){const r=Gn(e.zIndex)?e.zIndex:0;return i0(s)?r:r+(e.selected?t:0)}function LL(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=wj(g,m,t));const y=Lj(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=jj(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)),E=(w-g.width)*y[0],T=(N-g.height)*y[1];(b>0||S>0||E||T)&&(i.push({id:h,type:"position",position:{x:m.position.x-b+E,y:m.position.y-S+T}}),(_=s.get(h))==null||_.forEach(R=>{e.some(L=>L.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-E:0),height:N+(S?y[1]*S-T:0)}})}),i}function zL(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=wj(R,w,t.get(S.parentId)):_&&(R=ti(R,_,w));const L={...S,measured:w,internals:{...S.internals,positionAbsolute:R,handleBounds:{source:K1("source",b.nodeElement,T,g,S.id),target:K1("target",b.nodeElement,T,g,S.id)}}};t.set(S.id,L),S.parentId&&o0(L,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(L,i)}))}}if(y.length>0){const b=l0(y,t,s,i);h.push(...b)}return{changes:h,updatedInternals:m}}async function PL({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 nS(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 zj(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}`;nS("source",m,v,e,i,d),nS("target",m,h,e,l,f),t.set(r.id,r)}}function Pj(e,t){if(!e.parentId)return!1;const s=t.get(e.parentId);return s?s.selected?!0:Pj(s,t):!1}function sS(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 IL(e,t,s,r){const i=new Map;for(const[l,d]of e)if((d.selected||d.id===r)&&(!d.parentId||!Pj(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 Cp({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 BL({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 HL({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:L,nodeId:I,nodeClickDistance:P=0}){y=Nn(R);function A({x:Q,y:Y}){const{nodeLookup:B,nodeExtent:V,snapGrid:k,snapToGrid:U,nodeOrigin:$,onNodeDrag:F,onSelectionDrag:H,onError:D,updateNodePositions:G}=t();l={x:Q,y:Y};let J=!1;const se=f.size>1,oe=se&&V?ug(Sc(f)):null,ce=se&&U?BL({dragItems:f,snapGrid:k,x:Q,y:Y}):null;for(const[de,ue]of f){if(!B.has(de))continue;let fe={x:Q-ue.distance.x,y:Y-ue.distance.y};U&&(fe=ce?{x:Math.round(fe.x+ce.x),y:Math.round(fe.y+ce.y)}:wc(fe,k));let Ce=null;if(se&&V&&!ue.extent&&oe){const{positionAbsolute:ve}=ue.internals,Te=ve.x-oe.x+V[0][0],Ve=ve.x+ue.measured.width-oe.x2+V[1][0],Oe=ve.y-oe.y+V[0][1],tt=ve.y+ue.measured.height-oe.y2+V[1][1];Ce=[[Te,Oe],[Ve,tt]]}const{position:be,positionAbsolute:xe}=Sj({nodeId:de,nextPosition:fe,nodeLookup:B,nodeExtent:Ce||V,nodeOrigin:$,onError:D});J=J||ue.position.x!==be.x||ue.position.y!==be.y,ue.position=be,ue.internals.positionAbsolute=xe}if(S=S||J,!!J&&(G(f,!0),w&&(r||F||!I&&H))){const[de,ue]=Cp({nodeId:I,dragItems:f,nodeLookup:B});r==null||r(w,f,de,ue),F==null||F(w,de,ue),I||H==null||H(w,ue)}}async function M(){if(!v)return;const{transform:Q,panBy:Y,autoPanSpeed:B,autoPanOnNodeDrag:V}=t();if(!V){m=!1,cancelAnimationFrame(d);return}const[k,U]=Nj(h,v,B);(k!==0||U!==0)&&(l.x=(l.x??0)-k/Q[2],l.y=(l.y??0)-U/Q[2],await Y({x:k,y:U})&&A(l)),d=requestAnimationFrame(M)}function q(Q){var se;const{nodeLookup:Y,multiSelectionActive:B,nodesDraggable:V,transform:k,snapGrid:U,snapToGrid:$,selectNodesOnDrag:F,onNodeDragStart:H,onSelectionDragStart:D,unselectNodesAndEdges:G}=t();g=!0,(!F||!L)&&!B&&I&&((se=Y.get(I))!=null&&se.selected||G()),L&&F&&I&&(e==null||e(I));const J=Il(Q.sourceEvent,{transform:k,snapGrid:U,snapToGrid:$,containerBounds:v});if(l=J,f=IL(Y,V,J,I),f.size>0&&(s||H||!I&&D)){const[oe,ce]=Cp({nodeId:I,dragItems:f,nodeLookup:Y});s==null||s(Q.sourceEvent,f,oe,ce),H==null||H(Q.sourceEvent,oe,ce),I||D==null||D(Q.sourceEvent,ce)}}const z=ej().clickDistance(P).on("start",Q=>{const{domNode:Y,nodeDragThreshold:B,transform:V,snapGrid:k,snapToGrid:U}=t();v=(Y==null?void 0:Y.getBoundingClientRect())||null,b=!1,S=!1,w=Q.sourceEvent,B===0&&q(Q),l=Il(Q.sourceEvent,{transform:V,snapGrid:k,snapToGrid:U,containerBounds:v}),h=Yn(Q.sourceEvent,v)}).on("drag",Q=>{const{autoPanOnNodeDrag:Y,transform:B,snapGrid:V,snapToGrid:k,nodeDragThreshold:U,nodeLookup:$}=t(),F=Il(Q.sourceEvent,{transform:B,snapGrid:V,snapToGrid:k,containerBounds:v});if(w=Q.sourceEvent,(Q.sourceEvent.type==="touchmove"&&Q.sourceEvent.touches.length>1||I&&!$.has(I))&&(b=!0),!b){if(!m&&Y&&g&&(m=!0,M()),!g){const H=Yn(Q.sourceEvent,v),D=H.x-h.x,G=H.y-h.y;Math.sqrt(D*D+G*G)>U&&q(Q)}(l.x!==F.xSnapped||l.y!==F.ySnapped)&&f&&g&&(h=Yn(Q.sourceEvent,v),A(F))}}).on("end",Q=>{if(!(!g||b)&&(m=!1,g=!1,cancelAnimationFrame(d),f.size>0)){const{nodeLookup:Y,updateNodePositions:B,onNodeDragStop:V,onSelectionDragStop:k}=t();if(S&&(B(f,!1),S=!1),i||V||!I&&k){const[U,$]=Cp({nodeId:I,dragItems:f,nodeLookup:Y,dragging:!1});i==null||i(Q.sourceEvent,f,U,$),V==null||V(Q.sourceEvent,U,$),I||k==null||k(Q.sourceEvent,$)}}}).filter(Q=>{const Y=Q.target;return!Q.button&&(!T||!sS(Y,`.${T}`,R))&&(!_||sS(Y,_,R))});y.call(z)}function E(){y==null||y.on(".drag",null)}return{update:N,destroy:E}}function UL(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 $L=250;function qL(e,t,s,r){var f,m;let i=[],l=1/0;const d=UL(e,s,t+$L);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 Ij(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 Bj(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function VL(e,t){let s=null;return t?s=!0:e&&!t&&(s=!1),s}const Hj=()=>!0;function GL(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:E=Hj,onReconnectEnd:T,updateConnection:_,getTransform:R,getFromHandle:L,autoPanSpeed:I,dragThreshold:P=1,handleDomNode:A}){const M=_j(e.target);let q=0,z;const{x:Q,y:Y}=Yn(e),B=Bj(l,A),V=f==null?void 0:f.getBoundingClientRect();let k=!1;if(!V||!B)return;const U=Ij(i,B,r,m,t);if(!U)return;let $=Yn(e,V),F=!1,H=null,D=!1,G=null;function J(){if(!v||!V)return;const[be,xe]=Nj($,V,I);y({x:be,y:xe}),q=requestAnimationFrame(J)}const se={...U,nodeId:i,type:B,position:U.position},oe=m.get(i);let de={inProgress:!0,isValid:null,from:ni(oe,se,Ne.Left,!0),fromHandle:se,fromPosition:se.position,fromNode:oe,to:$,toHandle:null,toPosition:G1[se.position],toNode:null,pointer:$};function ue(){k=!0,_(de),S==null||S(e,{nodeId:i,handleId:r,handleType:B})}P===0&&ue();function fe(be){if(!k){const{x:tt,y:me}=Yn(be),Pe=tt-Q,rt=me-Y;if(!(Pe*Pe+rt*rt>P*P))return;ue()}if(!L()||!se){Ce(be);return}const xe=R();$=Yn(be,V),z=qL(Nc($,xe,!1,[1,1]),s,m,se),F||(J(),F=!0);const ve=Uj(be,{handle:z,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:d?"target":"source",isValidConnection:E,doc:M,lib:h,flowId:g,nodeLookup:m});G=ve.handleDomNode,H=ve.connection,D=VL(!!z,ve.isValid);const Te=m.get(i),Ve=Te?ni(Te,se,Ne.Left,!0):de.from,Oe={...de,from:Ve,isValid:D,to:ve.toHandle&&D?ef({x:ve.toHandle.x,y:ve.toHandle.y},xe):$,toHandle:ve.toHandle,toPosition:D&&ve.toHandle?ve.toHandle.position:G1[se.position],toNode:ve.toHandle?m.get(ve.toHandle.nodeId):null,pointer:$};_(Oe),de=Oe}function Ce(be){if(!("touches"in be&&be.touches.length>0)){if(k){(z||G)&&H&&D&&(w==null||w(H));const{inProgress:xe,...ve}=de,Te={...ve,toPosition:de.toHandle?de.toPosition:null};N==null||N(be,Te),l&&(T==null||T(be,Te))}b(),cancelAnimationFrame(q),F=!1,D=!1,H=null,G=null,M.removeEventListener("mousemove",fe),M.removeEventListener("mouseup",Ce),M.removeEventListener("touchmove",fe),M.removeEventListener("touchend",Ce)}}M.addEventListener("mousemove",fe),M.addEventListener("mouseup",Ce),M.addEventListener("touchmove",fe),M.addEventListener("touchend",Ce)}function Uj(e,{handle:t,connectionMode:s,fromNodeId:r,fromHandleId:i,fromType:l,doc:d,lib:f,flowId:m,isValidConnection:h=Hj,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}=Yn(e),w=d.elementFromPoint(b,S),N=w!=null&&w.classList.contains(`${f}-flow__handle`)?w:y,E={handleDomNode:N,isValid:!1,connection:null,toHandle:null};if(N){const T=Bj(void 0,N),_=N.getAttribute("data-nodeid"),R=N.getAttribute("data-handleid"),L=N.classList.contains("connectable"),I=N.classList.contains("connectableend");if(!_||!T)return E;const P={source:g?_:r,sourceHandle:g?R:i,target:g?r:_,targetHandle:g?i:R};E.connection=P;const M=L&&I&&(s===bo.Strict?g&&T==="source"||!g&&T==="target":_!==r||R!==i);E.isValid=M&&h(P),E.toHandle=Ij(_,T,R,v,s,!0)}return E}const mg={onPointerDown:GL,isValid:Uj};function YL({domNode:e,panZoom:t,getTransform:s,getViewScale:r}){const i=Nn(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(),L=_.sourceEvent.ctrlKey&&oc()?10:1,I=-_.sourceEvent.deltaY*(_.sourceEvent.deltaMode===1?.05:_.sourceEvent.deltaMode?1:.002)*v,P=R[2]*Math.pow(2,I*L);t.scaleTo(P)};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])},E=_=>{const R=s();if(_.sourceEvent.type!=="mousemove"&&_.sourceEvent.type!=="touchmove"||!t)return;const L=[_.sourceEvent.clientX??_.sourceEvent.touches[0].clientX,_.sourceEvent.clientY??_.sourceEvent.touches[0].clientY],I=[L[0]-w[0],L[1]-w[1]];w=L;const P=r()*Math.max(R[2],Math.log(R[2]))*(b?-1:1),A={x:R[0]-I[0]*P,y:R[1]-I[1]*P},M=[[0,0],[m,h]];t.setViewportConstrained({x:A.x,y:A.y,zoom:R[2]},M,f)},T=pj().on("start",N).on("zoom",g?E:null).on("zoom.wheel",y?S:null);i.call(T,{})}function d(){i.on("zoom",null)}return{update:l,destroy:d,pointer:qn}}const Sf=e=>({x:e.x,y:e.y,zoom:e.k}),_p=({x:e,y:t,zoom:s})=>yf.translate(e,t).scale(s),Wi=(e,t)=>e.target.closest(`.${t}`),$j=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),QL=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Rp=(e,t=0,s=QL,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(s).on("end",r):e},qj=e=>{const t=e.ctrlKey&&oc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function FL({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=qn(v),E=qj(v),T=g*Math.pow(2,E);r.scaleTo(s,T,N,v);return}const y=v.deltaMode===1?20:1;let b=i===Kr.Vertical?0:v.deltaX*y,S=i===Kr.Horizontal?0:v.deltaY*y;!oc()&&v.shiftKey&&i!==Kr.Vertical&&(b=v.deltaY*y,S=0),r.translateBy(s,-(b/g)*l,-(S/g)*l,{internal:!0});const w=Sf(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 KL({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 XL({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:s}){return r=>{var l,d,f;if((l=r.sourceEvent)!=null&&l.internal)return;const i=Sf(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 ZL({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:s,onTransformChange:r,onPanZoom:i}){return l=>{var d,f;e.usedRightMouseButton=!!(s&&$j(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,Sf(l.transform)))}}function WL({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&&$j(t,e.mouseButton??0)&&!e.usedRightMouseButton&&d.sourceEvent&&l(d.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const m=Sf(d.transform);e.prevViewport=m,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(d.sourceEvent,m)},s?150:0)}}}function JL({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 ez({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=pj().scaleExtent([t,s]).translateExtent(r),y=Nn(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(qj);function w(z,Q){return y?new Promise(Y=>{g==null||g.interpolate((Q==null?void 0:Q.interpolate)==="linear"?Pl:Td).transform(Rp(y,Q==null?void 0:Q.duration,Q==null?void 0:Q.ease,()=>Y(!0)),z)}):Promise.resolve(!1)}function N({noWheelClassName:z,noPanClassName:Q,onPaneContextMenu:Y,userSelectionActive:B,panOnScroll:V,panOnDrag:k,panOnScrollMode:U,panOnScrollSpeed:$,preventScrolling:F,zoomOnPinch:H,zoomOnScroll:D,zoomOnDoubleClick:G,zoomActivationKeyPressed:J,lib:se,onTransformChange:oe,connectionInProgress:ce,paneClickDistance:de,selectionOnDrag:ue}){B&&!h.isZoomingOrPanning&&E();const fe=V&&!J&&!B;g.clickDistance(ue?1/0:!Gn(de)||de<0?0:de);const Ce=fe?FL({zoomPanValues:h,noWheelClassName:z,d3Selection:y,d3Zoom:g,panOnScrollMode:U,panOnScrollSpeed:$,zoomOnPinch:H,onPanZoomStart:d,onPanZoom:l,onPanZoomEnd:f}):KL({noWheelClassName:z,preventScrolling:F,d3ZoomHandler:b});if(y.on("wheel.zoom",Ce,{passive:!1}),!B){const xe=XL({zoomPanValues:h,onDraggingChange:m,onPanZoomStart:d});g.on("start",xe);const ve=ZL({zoomPanValues:h,panOnDrag:k,onPaneContextMenu:!!Y,onPanZoom:l,onTransformChange:oe});g.on("zoom",ve);const Te=WL({zoomPanValues:h,panOnDrag:k,panOnScroll:V,onPaneContextMenu:Y,onPanZoomEnd:f,onDraggingChange:m});g.on("end",Te)}const be=JL({zoomActivationKeyPressed:J,panOnDrag:k,zoomOnScroll:D,panOnScroll:V,zoomOnDoubleClick:G,zoomOnPinch:H,userSelectionActive:B,noPanClassName:Q,noWheelClassName:z,lib:se,connectionInProgress:ce});g.filter(be),G?y.on("dblclick.zoom",S):y.on("dblclick.zoom",null)}function E(){g.on("zoom",null)}async function T(z,Q,Y){const B=_p(z),V=g==null?void 0:g.constrain()(B,Q,Y);return V&&await w(V),new Promise(k=>k(V))}async function _(z,Q){const Y=_p(z);return await w(Y,Q),new Promise(B=>B(Y))}function R(z){if(y){const Q=_p(z),Y=y.property("__zoom");(Y.k!==z.zoom||Y.x!==z.x||Y.y!==z.y)&&(g==null||g.transform(y,Q,null,{sync:!0}))}}function L(){const z=y?mj(y.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}function I(z,Q){return y?new Promise(Y=>{g==null||g.interpolate((Q==null?void 0:Q.interpolate)==="linear"?Pl:Td).scaleTo(Rp(y,Q==null?void 0:Q.duration,Q==null?void 0:Q.ease,()=>Y(!0)),z)}):Promise.resolve(!1)}function P(z,Q){return y?new Promise(Y=>{g==null||g.interpolate((Q==null?void 0:Q.interpolate)==="linear"?Pl:Td).scaleBy(Rp(y,Q==null?void 0:Q.duration,Q==null?void 0:Q.ease,()=>Y(!0)),z)}):Promise.resolve(!1)}function A(z){g==null||g.scaleExtent(z)}function M(z){g==null||g.translateExtent(z)}function q(z){const Q=!Gn(z)||z<0?0:z;g==null||g.clickDistance(Q)}return{update:N,destroy:E,setViewport:_,setViewportConstrained:T,getViewport:L,scaleTo:I,scaleBy:P,setScaleExtent:A,setTranslateExtent:M,syncViewport:R,setClickDistance:q}}var jo;(function(e){e.Line="line",e.Handle="handle"})(jo||(jo={}));function tz({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 aS(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 rS(e,t){return e?!t:t}function nz(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:E,maxHeight:T}=r,{x:_,y:R,width:L,height:I,aspectRatio:P}=e;let A=Math.floor(v?b-e.pointerX:0),M=Math.floor(g?S-e.pointerY:0);const q=L+(m?-A:A),z=I+(h?-M:M),Q=-l[0]*L,Y=-l[1]*I;let B=xd(q,w,N),V=xd(z,E,T);if(d){let $=0,F=0;m&&A<0?$=Ta(_+A+Q,d[0][0]):!m&&A>0&&($=Aa(_+q+Q,d[1][0])),h&&M<0?F=Ta(R+M+Y,d[0][1]):!h&&M>0&&(F=Aa(R+z+Y,d[1][1])),B=Math.max(B,$),V=Math.max(V,F)}if(f){let $=0,F=0;m&&A>0?$=Aa(_+A,f[0][0]):!m&&A<0&&($=Ta(_+q,f[1][0])),h&&M>0?F=Aa(R+M,f[0][1]):!h&&M<0&&(F=Ta(R+z,f[1][1])),B=Math.max(B,$),V=Math.max(V,F)}if(i){if(v){const $=xd(q/P,E,T)*P;if(B=Math.max(B,$),d){let F=0;!m&&!h||m&&!h&&y?F=Aa(R+Y+q/P,d[1][1])*P:F=Ta(R+Y+(m?A:-A)/P,d[0][1])*P,B=Math.max(B,F)}if(f){let F=0;!m&&!h||m&&!h&&y?F=Ta(R+q/P,f[1][1])*P:F=Aa(R+(m?A:-A)/P,f[0][1])*P,B=Math.max(B,F)}}if(g){const $=xd(z*P,w,N)/P;if(V=Math.max(V,$),d){let F=0;!m&&!h||h&&!m&&y?F=Aa(_+z*P+Q,d[1][0])/P:F=Ta(_+(h?M:-M)*P+Q,d[0][0])/P,V=Math.max(V,F)}if(f){let F=0;!m&&!h||h&&!m&&y?F=Ta(_+z*P,f[1][0])/P:F=Aa(_+(h?M:-M)*P,f[0][0])/P,V=Math.max(V,F)}}}M=M+(M<0?V:-V),A=A+(A<0?B:-B),i&&(y?q>z*P?M=(rS(m,h)?-A:A)/P:A=(rS(m,h)?-M:M)*P:v?(M=A/P,h=m):(A=M*P,m=h));const k=m?_+A:_,U=h?R+M:R;return{width:L+(m?-A:A),height:I+(h?-M:M),x:l[0]*A*(m?-1:1)+k,y:l[1]*M*(h?-1:1)+U}}const Vj={width:0,height:0,x:0,y:0},sz={...Vj,pointerX:0,pointerY:0,aspectRatio:1};function az(e){return[[0,0],[e.measured.width,e.measured.height]]}function rz(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 iz({domNode:e,nodeId:t,getStoreItems:s,onChange:r,onEnd:i}){const l=Nn(e);let d={controlDirection:aS("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 E={...Vj},T={...sz};d={boundaries:v,resizeDirection:y,keepAspectRatio:g,controlDirection:aS(h)};let _,R=null,L=[],I,P,A,M=!1;const q=ej().on("start",z=>{const{nodeLookup:Q,transform:Y,snapGrid:B,snapToGrid:V,nodeOrigin:k,paneDomNode:U}=s();if(_=Q.get(t),!_)return;R=(U==null?void 0:U.getBoundingClientRect())??null;const{xSnapped:$,ySnapped:F}=Il(z.sourceEvent,{transform:Y,snapGrid:B,snapToGrid:V,containerBounds:R});E={width:_.measured.width??0,height:_.measured.height??0,x:_.position.x??0,y:_.position.y??0},T={...E,pointerX:$,pointerY:F,aspectRatio:E.width/E.height},I=void 0,_.parentId&&(_.extent==="parent"||_.expandParent)&&(I=Q.get(_.parentId),P=I&&_.extent==="parent"?az(I):void 0),L=[],A=void 0;for(const[H,D]of Q)if(D.parentId===t&&(L.push({id:H,position:{...D.position},extent:D.extent}),D.extent==="parent"||D.expandParent)){const G=rz(D,_,D.origin??k);A?A=[[Math.min(G[0][0],A[0][0]),Math.min(G[0][1],A[0][1])],[Math.max(G[1][0],A[1][0]),Math.max(G[1][1],A[1][1])]]:A=G}b==null||b(z,{...E})}).on("drag",z=>{const{transform:Q,snapGrid:Y,snapToGrid:B,nodeOrigin:V}=s(),k=Il(z.sourceEvent,{transform:Q,snapGrid:Y,snapToGrid:B,containerBounds:R}),U=[];if(!_)return;const{x:$,y:F,width:H,height:D}=E,G={},J=_.origin??V,{width:se,height:oe,x:ce,y:de}=nz(T,d.controlDirection,k,d.boundaries,d.keepAspectRatio,J,P,A),ue=se!==H,fe=oe!==D,Ce=ce!==$&&ue,be=de!==F&&fe;if(!Ce&&!be&&!ue&&!fe)return;if((Ce||be||J[0]===1||J[1]===1)&&(G.x=Ce?ce:E.x,G.y=be?de:E.y,E.x=G.x,E.y=G.y,L.length>0)){const Ve=ce-$,Oe=de-F;for(const tt of L)tt.position={x:tt.position.x-Ve+J[0]*(se-H),y:tt.position.y-Oe+J[1]*(oe-D)},U.push(tt)}if((ue||fe)&&(G.width=ue&&(!d.resizeDirection||d.resizeDirection==="horizontal")?se:E.width,G.height=fe&&(!d.resizeDirection||d.resizeDirection==="vertical")?oe:E.height,E.width=G.width,E.height=G.height),I&&_.expandParent){const Ve=J[0]*(G.width??0);G.x&&G.x<Ve&&(E.x=Ve,T.x=T.x-(G.x-Ve));const Oe=J[1]*(G.height??0);G.y&&G.y<Oe&&(E.y=Oe,T.y=T.y-(G.y-Oe))}const xe=tz({width:E.width,prevWidth:H,height:E.height,prevHeight:D,affectsX:d.controlDirection.affectsX,affectsY:d.controlDirection.affectsY}),ve={...E,direction:xe};(N==null?void 0:N(z,ve))!==!1&&(M=!0,S==null||S(z,ve),r(G,U))}).on("end",z=>{M&&(w==null||w(z,{...E}),i==null||i({...E}),M=!1)});l.call(q)}function m(){l.on(".drag",null)}return{update:f,destroy:m}}const oz={},iS=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:()=>{(oz?"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},lz=e=>e?iS(e):iS,{useDebugValue:cz}=Xr,{useSyncExternalStoreWithSelector:uz}=TR,dz=e=>e;function Gj(e,t=dz,s){const r=uz(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,s);return cz(r),r}const oS=(e,t)=>{const s=lz(e),r=(i,l=t)=>Gj(s,i,l);return Object.assign(r,s),r},fz=(e,t)=>e?oS(e,t):oS;function ct(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 wf=j.createContext(null),hz=wf.Provider,Yj=ms.error001();function Ge(e,t){const s=j.useContext(wf);if(s===null)throw new Error(Yj);return Gj(s,e,t)}function ut(){const e=j.useContext(wf);if(e===null)throw new Error(Yj);return j.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const lS={display:"none"},mz={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Qj="react-flow__node-desc",Fj="react-flow__edge-desc",pz="react-flow__aria-live",gz=e=>e.ariaLiveMessage,xz=e=>e.ariaLabelConfig;function yz({rfId:e}){const t=Ge(gz);return c.jsx("div",{id:`${pz}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:mz,children:t})}function vz({rfId:e,disableKeyboardA11y:t}){const s=Ge(xz);return c.jsxs(c.Fragment,{children:[c.jsx("div",{id:`${Qj}-${e}`,style:lS,children:t?s["node.a11yDescription.default"]:s["node.a11yDescription.keyboardDisabled"]}),c.jsx("div",{id:`${Fj}-${e}`,style:lS,children:s["edge.a11yDescription.default"]}),!t&&c.jsx(yz,{rfId:e})]})}const Nf=j.forwardRef(({position:e="top-left",children:t,className:s,style:r,...i},l)=>{const d=`${e}`.split("-");return c.jsx("div",{className:Nt(["react-flow__panel",s,...d]),style:r,ref:l,...i,children:t})});Nf.displayName="Panel";function bz({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:c.jsx(Nf,{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:c.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Sz=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 wz(e,t){return ct(e.selectedNodes.map(yd),t.selectedNodes.map(yd))&&ct(e.selectedEdges.map(yd),t.selectedEdges.map(yd))}function Nz({onSelectionChange:e}){const t=ut(),{selectedNodes:s,selectedEdges:r}=Ge(Sz,wz);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 jz=e=>!!e.onSelectionChangeHandlers;function Ez({onSelectionChange:e}){const t=Ge(jz);return e||t?c.jsx(Nz,{onSelectionChange:e}):null}const Kj=[0,0],Cz={x:0,y:0,zoom:1},_z=["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"],cS=[..._z,"rfId"],Rz=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}),uS={translateExtent:sc,nodeOrigin:Kj,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Tz(e){const{setNodes:t,setEdges:s,setMinZoom:r,setMaxZoom:i,setTranslateExtent:l,setNodeExtent:d,reset:f,setDefaultNodesAndEdges:m}=Ge(Rz,ct),h=ut();j.useEffect(()=>(m(e.defaultNodes,e.defaultEdges),()=>{v.current=uS,f()}),[]);const v=j.useRef(uS);return j.useEffect(()=>{for(const g of cS){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:yL(y)}):g==="fitView"?h.setState({fitViewQueued:y}):g==="fitViewOptions"?h.setState({fitViewOptions:y}):h.setState({[g]:y})))}v.current=e},cS.map(g=>e[g])),null}function dS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Az(e){var r;const[t,s]=j.useState(e==="system"?null:e);return j.useEffect(()=>{if(e!=="system"){s(e);return}const i=dS(),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=dS())!=null&&r.matches?"dark":"light"}const fS=typeof document<"u"?document:null;function lc(e=null,t={target:fS,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)??fS,h=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const v=b=>{var N,E;if(i.current=b.ctrlKey||b.metaKey||b.shiftKey||b.altKey,(!i.current||i.current&&!h)&&Rj(b))return!1;const w=mS(b.code,f);if(l.current.add(b[w]),hS(d,l.current,!1)){const T=((E=(N=b.composedPath)==null?void 0:N.call(b))==null?void 0:E[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=mS(b.code,f);hS(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 hS(e,t,s){return e.filter(r=>s||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function mS(e,t){return t.includes(e)?"code":"key"}const Mz=()=>{const e=ut();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=ef(t,s);return{x:d.x+i,y:d.y+l}}}),[])};function Xj(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)kz(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 kz(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 Oz(e,t){return Xj(e,t)}function Dz(e,t){return Xj(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 pS({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 gS(e){return{id:e.id,type:"remove"}}const xS=e=>lL(e),Lz=e=>bj(e);function Zj(e){return j.forwardRef(e)}const zz=typeof window<"u"?j.useLayoutEffect:j.useEffect;function yS(e){const[t,s]=j.useState(BigInt(0)),[r]=j.useState(()=>Pz(()=>s(i=>i+BigInt(1))));return zz(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function Pz(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:s=>{t.push(s),e()}}}const Wj=j.createContext(null);function Iz({children:e}){const t=ut(),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 E of f)w=typeof E=="function"?E(w):E;let N=pS({items:w,lookup:y});for(const E of S.values())N=E(N);v&&h(w),N.length>0?g==null||g(N):b&&window.requestAnimationFrame(()=>{const{fitViewQueued:E,nodes:T,setNodes:_}=t.getState();E&&_(T)})},[]),r=yS(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(pS({items:b,lookup:y}))},[]),l=yS(i),d=j.useMemo(()=>({nodeQueue:r,edgeQueue:l}),[]);return c.jsx(Wj.Provider,{value:d,children:e})}function Bz(){const e=j.useContext(Wj);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Hz=e=>!!e.panZoom;function c0(){const e=Mz(),t=ut(),s=Bz(),r=Ge(Hz),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 E,T;const{nodeLookup:y,nodeOrigin:b}=t.getState(),S=xS(g)?g:y.get(g.id),w=S.parentId?Cj(S.position,S.measured,S.parentId,y,b):S.position,N={...S,position:w,width:((E=S.measured)==null?void 0:E.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&&xS(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&&Lz(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(E=>({...E})),edges:y.map(E=>({...E})),viewport:{x:S,y:w,zoom:N}}},deleteElements:async({nodes:g=[],edges:y=[]})=>{const{nodes:b,edges:S,onNodesDelete:w,onEdgesDelete:N,triggerNodeChanges:E,triggerEdgeChanges:T,onDelete:_,onBeforeDelete:R}=t.getState(),{nodes:L,edges:I}=await hL({nodesToRemove:g,edgesToRemove:y,nodes:b,edges:S,onBeforeDelete:R}),P=I.length>0,A=L.length>0;if(P){const M=I.map(gS);N==null||N(I),T(M)}if(A){const M=L.map(gS);w==null||w(L),E(M)}return(A||P)&&(_==null||_({nodes:L,edges:I})),{deletedNodes:L,deletedEdges:I}},getIntersectingNodes:(g,y=!0,b)=>{const S=Q1(g),w=S?g:m(g),N=b!==void 0;return w?(b||t.getState().nodes).filter(E=>{const T=t.getState().nodeLookup.get(E.id);if(T&&!S&&(E.id===g.id||!T.internals.positionAbsolute))return!1;const _=wo(N?E:T),R=ic(_,w);return y&&R>0||R>=_.width*_.height||R>=w.width*w.height}):[]},isNodeIntersecting:(g,y,b=!0)=>{const w=Q1(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 cL(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??xL();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 vS=e=>e.selected,Uz=typeof window<"u"?window:void 0;function $z({deleteKeyCode:e,multiSelectionKeyCode:t}){const s=ut(),{deleteElements:r}=c0(),i=lc(e,{actInsideInputWithModifier:!1}),l=lc(t,{target:Uz});j.useEffect(()=>{if(i){const{edges:d,nodes:f}=s.getState();r({nodes:f.filter(vS),edges:d.filter(vS)}),s.setState({nodesSelectionActive:!1})}},[i]),j.useEffect(()=>{s.setState({multiSelectionActive:l})},[l])}function qz(e){const t=ut();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",ms.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 jf={position:"absolute",width:"100%",height:"100%",top:0,left:0},Vz=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Gz({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:s=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:l=Kr.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:E,isControlledViewport:T,paneClickDistance:_,selectionOnDrag:R}){const L=ut(),I=j.useRef(null),{userSelectionActive:P,lib:A,connectionInProgress:M}=Ge(Vz,ct),q=lc(y),z=j.useRef();qz(I);const Q=j.useCallback(Y=>{E==null||E({x:Y[0],y:Y[1],zoom:Y[2]}),T||L.setState({transform:Y})},[E,T]);return j.useEffect(()=>{if(I.current){z.current=ez({domNode:I.current,minZoom:v,maxZoom:g,translateExtent:h,viewport:m,onDraggingChange:k=>L.setState(U=>U.paneDragging===k?U:{paneDragging:k}),onPanZoomStart:(k,U)=>{const{onViewportChangeStart:$,onMoveStart:F}=L.getState();F==null||F(k,U),$==null||$(U)},onPanZoom:(k,U)=>{const{onViewportChange:$,onMove:F}=L.getState();F==null||F(k,U),$==null||$(U)},onPanZoomEnd:(k,U)=>{const{onViewportChangeEnd:$,onMoveEnd:F}=L.getState();F==null||F(k,U),$==null||$(U)}});const{x:Y,y:B,zoom:V}=z.current.getViewport();return L.setState({panZoom:z.current,transform:[Y,B,V],domNode:I.current.closest(".react-flow")}),()=>{var k;(k=z.current)==null||k.destroy()}}},[]),j.useEffect(()=>{var Y;(Y=z.current)==null||Y.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:s,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:l,zoomOnDoubleClick:d,panOnDrag:f,zoomActivationKeyPressed:q,preventScrolling:b,noPanClassName:N,userSelectionActive:P,noWheelClassName:w,lib:A,onTransformChange:Q,connectionInProgress:M,selectionOnDrag:R,paneClickDistance:_})},[e,t,s,r,i,l,d,f,q,b,N,P,w,A,Q,M,R,_]),c.jsx("div",{className:"react-flow__renderer",ref:I,style:jf,children:S})}const Yz=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Qz(){const{userSelectionActive:e,userSelectionRect:t}=Ge(Yz,ct);return e&&t?c.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 Tp=(e,t)=>s=>{s.target===t.current&&(e==null||e(s))},Fz=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Kz({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=ut(),{userSelectionActive:N,elementsSelectable:E,dragging:T,connectionInProgress:_}=Ge(Fz,ct),R=E&&(e||N),L=j.useRef(null),I=j.useRef(),P=j.useRef(new Set),A=j.useRef(new Set),M=j.useRef(!1),q=$=>{if(M.current||_){M.current=!1;return}m==null||m($),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},z=$=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){$.preventDefault();return}h==null||h($)},Q=v?$=>v($):void 0,Y=$=>{M.current&&($.stopPropagation(),M.current=!1)},B=$=>{var oe,ce;const{domNode:F}=w.getState();if(I.current=F==null?void 0:F.getBoundingClientRect(),!I.current)return;const H=$.target===L.current;if(!H&&!!$.target.closest(".nokey")||!e||!(l&&H||t)||$.button!==0||!$.isPrimary)return;(ce=(oe=$.target)==null?void 0:oe.setPointerCapture)==null||ce.call(oe,$.pointerId),M.current=!1;const{x:J,y:se}=Yn($.nativeEvent,I.current);w.setState({userSelectionRect:{width:0,height:0,startX:J,startY:se,x:J,y:se}}),H||($.stopPropagation(),$.preventDefault())},V=$=>{const{userSelectionRect:F,transform:H,nodeLookup:D,edgeLookup:G,connectionLookup:J,triggerNodeChanges:se,triggerEdgeChanges:oe,defaultEdgeOptions:ce,resetSelectedElements:de}=w.getState();if(!I.current||!F)return;const{x:ue,y:fe}=Yn($.nativeEvent,I.current),{startX:Ce,startY:be}=F;if(!M.current){const Oe=t?0:i;if(Math.hypot(ue-Ce,fe-be)<=Oe)return;de(),d==null||d($)}M.current=!0;const xe={startX:Ce,startY:be,x:ue<Ce?ue:Ce,y:fe<be?fe:be,width:Math.abs(ue-Ce),height:Math.abs(fe-be)},ve=P.current,Te=A.current;P.current=new Set(t0(D,xe,H,s===ac.Partial,!0).map(Oe=>Oe.id)),A.current=new Set;const Ve=(ce==null?void 0:ce.selectable)??!0;for(const Oe of P.current){const tt=J.get(Oe);if(tt)for(const{edgeId:me}of tt.values()){const Pe=G.get(me);Pe&&(Pe.selectable??Ve)&&A.current.add(me)}}if(!F1(ve,P.current)){const Oe=Ji(D,P.current,!0);se(Oe)}if(!F1(Te,A.current)){const Oe=Ji(G,A.current);oe(Oe)}w.setState({userSelectionRect:xe,userSelectionActive:!0,nodesSelectionActive:!1})},k=$=>{var F,H;$.button===0&&((H=(F=$.target)==null?void 0:F.releasePointerCapture)==null||H.call(F,$.pointerId),!N&&$.target===L.current&&w.getState().userSelectionRect&&(q==null||q($)),w.setState({userSelectionActive:!1,userSelectionRect:null}),M.current&&(f==null||f($),w.setState({nodesSelectionActive:P.current.size>0})))},U=r===!0||Array.isArray(r)&&r.includes(0);return c.jsxs("div",{className:Nt(["react-flow__pane",{draggable:U,dragging:T,selection:e}]),onClick:R?void 0:Tp(q,L),onContextMenu:Tp(z,L),onWheel:Tp(Q,L),onPointerEnter:R?void 0:g,onPointerMove:R?V:y,onPointerUp:R?k:void 0,onPointerDownCapture:R?B:void 0,onClickCapture:R?Y:void 0,onPointerLeave:b,ref:L,style:jf,children:[S,c.jsx(Qz,{})]})}function pg({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",ms.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 Jj({nodeRef:e,disabled:t=!1,noDragClassName:s,handleSelector:r,nodeId:i,isSelectable:l,nodeClickDistance:d}){const f=ut(),[m,h]=j.useState(!1),v=j.useRef();return j.useEffect(()=>{v.current=HL({getStoreItems:()=>f.getState(),onNodeMouseDown:g=>{pg({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 Xz=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function eE(){const e=ut();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=Xz(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[,E]of h){if(!y(E))continue;let T={x:E.internals.positionAbsolute.x+w,y:E.internals.positionAbsolute.y+N};i&&(T=wc(T,l));const{position:_,positionAbsolute:R}=Sj({nodeId:E.id,nextPosition:T,nodeLookup:h,nodeExtent:r,nodeOrigin:v,onError:f});E.position=_,E.internals.positionAbsolute=R,g.set(E.id,E)}m(g)},[])}const u0=j.createContext(null),Zz=u0.Provider;u0.Consumer;const tE=()=>j.useContext(u0),Wz=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Jz=(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 e8({type:e="source",position:t=Ne.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 V,k;const S=d||null,w=e==="target",N=ut(),E=tE(),{connectOnClick:T,noPanClassName:_,rfId:R}=Ge(Wz,ct),{connectingFrom:L,connectingTo:I,clickConnecting:P,isPossibleEndHandle:A,connectionInProcess:M,clickConnectionInProcess:q,valid:z}=Ge(Jz(E,S,e),ct);E||(k=(V=N.getState()).onError)==null||k.call(V,"010",ms.error010());const Q=U=>{const{defaultEdgeOptions:$,onConnect:F,hasDefaultEdges:H}=N.getState(),D={...$,...U};if(H){const{edges:G,setEdges:J}=N.getState();J(jL(D,G))}F==null||F(D),f==null||f(D)},Y=U=>{if(!E)return;const $=Tj(U.nativeEvent);if(i&&($&&U.button===0||!$)){const F=N.getState();mg.onPointerDown(U.nativeEvent,{handleDomNode:U.currentTarget,autoPanOnConnect:F.autoPanOnConnect,connectionMode:F.connectionMode,connectionRadius:F.connectionRadius,domNode:F.domNode,nodeLookup:F.nodeLookup,lib:F.lib,isTarget:w,handleId:S,nodeId:E,flowId:F.rfId,panBy:F.panBy,cancelConnection:F.cancelConnection,onConnectStart:F.onConnectStart,onConnectEnd:(...H)=>{var D,G;return(G=(D=N.getState()).onConnectEnd)==null?void 0:G.call(D,...H)},updateConnection:F.updateConnection,onConnect:Q,isValidConnection:s||((...H)=>{var D,G;return((G=(D=N.getState()).isValidConnection)==null?void 0:G.call(D,...H))??!0}),getTransform:()=>N.getState().transform,getFromHandle:()=>N.getState().connection.fromHandle,autoPanSpeed:F.autoPanSpeed,dragThreshold:F.connectionDragThreshold})}$?v==null||v(U):g==null||g(U)},B=U=>{const{onClickConnectStart:$,onClickConnectEnd:F,connectionClickStartHandle:H,connectionMode:D,isValidConnection:G,lib:J,rfId:se,nodeLookup:oe,connection:ce}=N.getState();if(!E||!H&&!i)return;if(!H){$==null||$(U.nativeEvent,{nodeId:E,handleId:S,handleType:e}),N.setState({connectionClickStartHandle:{nodeId:E,type:e,id:S}});return}const de=_j(U.target),ue=s||G,{connection:fe,isValid:Ce}=mg.isValid(U.nativeEvent,{handle:{nodeId:E,id:S,type:e},connectionMode:D,fromNodeId:H.nodeId,fromHandleId:H.id||null,fromType:H.type,isValidConnection:ue,flowId:se,doc:de,lib:J,nodeLookup:oe});Ce&&fe&&Q(fe);const be=structuredClone(ce);delete be.inProgress,be.toPosition=be.toHandle?be.toHandle.position:null,F==null||F(U,be),N.setState({connectionClickStartHandle:null})};return c.jsx("div",{"data-handleid":S,"data-nodeid":E,"data-handlepos":t,"data-id":`${R}-${E}-${S}-${e}`,className:Nt(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",_,h,{source:!w,target:w,connectable:r,connectablestart:i,connectableend:l,clickconnecting:P,connectingfrom:L,connectingto:I,valid:z,connectionindicator:r&&(!M||A)&&(M||q?l:i)}]),onMouseDown:Y,onTouchStart:Y,onClick:T?B:void 0,ref:b,...y,children:m})}const Wa=j.memo(Zj(e8));function t8({data:e,isConnectable:t,sourcePosition:s=Ne.Bottom}){return c.jsxs(c.Fragment,{children:[e==null?void 0:e.label,c.jsx(Wa,{type:"source",position:s,isConnectable:t})]})}function n8({data:e,isConnectable:t,targetPosition:s=Ne.Top,sourcePosition:r=Ne.Bottom}){return c.jsxs(c.Fragment,{children:[c.jsx(Wa,{type:"target",position:s,isConnectable:t}),e==null?void 0:e.label,c.jsx(Wa,{type:"source",position:r,isConnectable:t})]})}function s8(){return null}function a8({data:e,isConnectable:t,targetPosition:s=Ne.Top}){return c.jsxs(c.Fragment,{children:[c.jsx(Wa,{type:"target",position:s,isConnectable:t}),e==null?void 0:e.label]})}const tf={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},bS={input:t8,default:n8,output:a8,group:s8};function r8(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 i8=e=>{const{width:t,height:s,x:r,y:i}=Sc(e.nodeLookup,{filter:l=>!!l.selected});return{width:Gn(t)?t:null,height:Gn(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 o8({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:s}){const r=ut(),{width:i,height:l,transformString:d,userSelectionActive:f}=Ge(i8,ct),m=eE(),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(Jj({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(tf,b.key)&&(b.preventDefault(),m({direction:tf[b.key],factor:b.shiftKey?4:1}))};return c.jsx("div",{className:Nt(["react-flow__nodesselection","react-flow__container",t]),style:{transform:d},children:c.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 SS=typeof window<"u"?window:void 0,l8=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function nE({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:E,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:R,panOnScrollSpeed:L,panOnScrollMode:I,zoomOnDoubleClick:P,panOnDrag:A,defaultViewport:M,translateExtent:q,minZoom:z,maxZoom:Q,preventScrolling:Y,onSelectionContextMenu:B,noWheelClassName:V,noPanClassName:k,disableKeyboardA11y:U,onViewportChange:$,isControlledViewport:F}){const{nodesSelectionActive:H,userSelectionActive:D}=Ge(l8,ct),G=lc(h,{target:SS}),J=lc(w,{target:SS}),se=J||A,oe=J||R,ce=v&&se!==!0,de=G||D||ce;return $z({deleteKeyCode:m,multiSelectionKeyCode:S}),c.jsx(Gz,{onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:oe,panOnScrollSpeed:L,panOnScrollMode:I,zoomOnDoubleClick:P,panOnDrag:!G&&se,defaultViewport:M,translateExtent:q,minZoom:z,maxZoom:Q,zoomActivationKeyCode:N,preventScrolling:Y,noWheelClassName:V,noPanClassName:k,onViewportChange:$,isControlledViewport:F,paneClickDistance:f,selectionOnDrag:ce,children:c.jsxs(Kz,{onSelectionStart:y,onSelectionEnd:b,onPaneClick:t,onPaneMouseEnter:s,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:l,onPaneScroll:d,panOnDrag:se,isSelecting:!!de,selectionMode:g,selectionKeyPressed:G,paneClickDistance:f,selectionOnDrag:ce,children:[e,H&&c.jsx(o8,{onSelectionContextMenu:B,noPanClassName:k,disableKeyboardA11y:U})]})})}nE.displayName="FlowRenderer";const c8=j.memo(nE),u8=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 d8(e){return Ge(j.useCallback(u8(e),[e]),ct)}const f8=e=>e.updateNodeInternals;function h8(){const e=Ge(f8),[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 m8({node:e,nodeType:t,hasDimensions:s,resizeObserver:r}){const i=ut(),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 p8({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:E,onError:T}){const{node:_,internals:R,isParent:L}=Ge(ue=>{const fe=ue.nodeLookup.get(e),Ce=ue.parentLookup.has(e);return{node:fe,internals:fe.internals,isParent:Ce}},ct);let I=_.type||"default",P=(N==null?void 0:N[I])||bS[I];P===void 0&&(T==null||T("003",ms.error003(I)),I="default",P=(N==null?void 0:N.default)||bS.default);const A=!!(_.draggable||f&&typeof _.draggable>"u"),M=!!(_.selectable||m&&typeof _.selectable>"u"),q=!!(_.connectable||h&&typeof _.connectable>"u"),z=!!(_.focusable||v&&typeof _.focusable>"u"),Q=ut(),Y=Ej(_),B=m8({node:_,nodeType:I,hasDimensions:Y,resizeObserver:g}),V=Jj({nodeRef:B,disabled:_.hidden||!A,noDragClassName:y,handleSelector:_.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:E}),k=eE();if(_.hidden)return null;const U=Zs(_),$=r8(_),F=M||A||t||s||r||i,H=s?ue=>s(ue,{...R.userNode}):void 0,D=r?ue=>r(ue,{...R.userNode}):void 0,G=i?ue=>i(ue,{...R.userNode}):void 0,J=l?ue=>l(ue,{...R.userNode}):void 0,se=d?ue=>d(ue,{...R.userNode}):void 0,oe=ue=>{const{selectNodesOnDrag:fe,nodeDragThreshold:Ce}=Q.getState();M&&(!fe||!A||Ce>0)&&pg({id:e,store:Q,nodeRef:B}),t&&t(ue,{...R.userNode})},ce=ue=>{if(!(Rj(ue.nativeEvent)||S)){if(gj.includes(ue.key)&&M){const fe=ue.key==="Escape";pg({id:e,store:Q,unselect:fe,nodeRef:B})}else if(A&&_.selected&&Object.prototype.hasOwnProperty.call(tf,ue.key)){ue.preventDefault();const{ariaLabelConfig:fe}=Q.getState();Q.setState({ariaLiveMessage:fe["node.a11yDescription.ariaLiveMessage"]({direction:ue.key.replace("Arrow","").toLowerCase(),x:~~R.positionAbsolute.x,y:~~R.positionAbsolute.y})}),k({direction:tf[ue.key],factor:ue.shiftKey?4:1})}}},de=()=>{var Te;if(S||!((Te=B.current)!=null&&Te.matches(":focus-visible")))return;const{transform:ue,width:fe,height:Ce,autoPanOnNodeFocus:be,setCenter:xe}=Q.getState();if(!be)return;t0(new Map([[e,_]]),{x:0,y:0,width:fe,height:Ce},ue,!0).length>0||xe(_.position.x+U.width/2,_.position.y+U.height/2,{zoom:ue[2]})};return c.jsx("div",{className:Nt(["react-flow__node",`react-flow__node-${I}`,{[b]:A},_.className,{selected:_.selected,selectable:M,parent:L,draggable:A,dragging:V}]),ref:B,style:{zIndex:R.z,transform:`translate(${R.positionAbsolute.x}px,${R.positionAbsolute.y}px)`,pointerEvents:F?"all":"none",visibility:Y?"visible":"hidden",..._.style,...$},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:H,onMouseMove:D,onMouseLeave:G,onContextMenu:J,onClick:oe,onDoubleClick:se,onKeyDown:z?ce:void 0,tabIndex:z?0:void 0,onFocus:z?de:void 0,role:_.ariaRole??(z?"group":void 0),"aria-roledescription":"node","aria-describedby":S?void 0:`${Qj}-${w}`,"aria-label":_.ariaLabel,..._.domAttributes,children:c.jsx(Zz,{value:e,children:c.jsx(P,{id:e,data:_.data,type:I,positionAbsoluteX:R.positionAbsolute.x,positionAbsoluteY:R.positionAbsolute.y,selected:_.selected??!1,selectable:M,draggable:A,deletable:_.deletable??!0,isConnectable:q,sourcePosition:_.sourcePosition,targetPosition:_.targetPosition,dragging:V,dragHandle:_.dragHandle,zIndex:R.z,parentId:_.parentId,...U})})})}var g8=j.memo(p8);const x8=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function sE(e){const{nodesDraggable:t,nodesConnectable:s,nodesFocusable:r,elementsSelectable:i,onError:l}=Ge(x8,ct),d=d8(e.onlyRenderVisibleElements),f=h8();return c.jsx("div",{className:"react-flow__nodes",style:jf,children:d.map(m=>c.jsx(g8,{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))})}sE.displayName="NodeRenderer";const y8=j.memo(sE);function v8(e){return Ge(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&&SL({sourceNode:l,targetNode:d,width:s.width,height:s.height,transform:s.transform})&&r.push(i.id)}return r},[e]),ct)}const b8=({color:e="none",strokeWidth:t=1})=>{const s={strokeWidth:t,...e&&{stroke:e}};return c.jsx("polyline",{className:"arrow",style:s,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},S8=({color:e="none",strokeWidth:t=1})=>{const s={strokeWidth:t,...e&&{stroke:e,fill:e}};return c.jsx("polyline",{className:"arrowclosed",style:s,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},wS={[rc.Arrow]:b8,[rc.ArrowClosed]:S8};function w8(e){const t=ut();return j.useMemo(()=>{var i,l;return Object.prototype.hasOwnProperty.call(wS,e)?wS[e]:((l=(i=t.getState()).onError)==null||l.call(i,"009",ms.error009(e)),null)},[e])}const N8=({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=w8(t);return m?c.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:c.jsx(m,{color:s,strokeWidth:d})}):null},aE=({defaultColor:e,rfId:t})=>{const s=Ge(l=>l.edges),r=Ge(l=>l.defaultEdgeOptions),i=j.useMemo(()=>TL(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?c.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:c.jsx("defs",{children:i.map(l=>c.jsx(N8,{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};aE.displayName="MarkerDefinitions";var j8=j.memo(aE);function rE({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=Nt(["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?c.jsxs("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:b,visibility:g.width?"visible":"hidden",...v,children:[i&&c.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}),c.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:S,style:r,children:s}),m]}):null}rE.displayName="EdgeText";const E8=j.memo(rE);function Ef({path:e,labelX:t,labelY:s,label:r,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m,interactionWidth:h=20,...v}){return c.jsxs(c.Fragment,{children:[c.jsx("path",{...v,d:e,fill:"none",className:Nt(["react-flow__edge-path",v.className])}),h?c.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,r&&Gn(t)&&Gn(s)?c.jsx(E8,{x:t,y:s,label:r,labelStyle:i,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:m}):null]})}function NS({pos:e,x1:t,y1:s,x2:r,y2:i}){return e===Ne.Left||e===Ne.Right?[.5*(t+r),s]:[t,.5*(s+i)]}function iE({sourceX:e,sourceY:t,sourcePosition:s=Ne.Bottom,targetX:r,targetY:i,targetPosition:l=Ne.Top}){const[d,f]=NS({pos:s,x1:e,y1:t,x2:r,y2:i}),[m,h]=NS({pos:l,x1:r,y1:i,x2:e,y2:t}),[v,g,y,b]=Aj({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 oE(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:E})=>{const[T,_,R]=iE({sourceX:s,sourceY:r,sourcePosition:d,targetX:i,targetY:l,targetPosition:f}),L=e.isInternal?void 0:t;return c.jsx(Ef,{id:L,path:T,labelX:_,labelY:R,label:m,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:b,style:S,markerEnd:w,markerStart:N,interactionWidth:E})})}const C8=oE({isInternal:!1}),lE=oE({isInternal:!0});C8.displayName="SimpleBezierEdge";lE.displayName="SimpleBezierEdgeInternal";function cE(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=Ne.Bottom,targetPosition:S=Ne.Top,markerEnd:w,markerStart:N,pathOptions:E,interactionWidth:T})=>{const[_,R,L]=dg({sourceX:s,sourceY:r,sourcePosition:b,targetX:i,targetY:l,targetPosition:S,borderRadius:E==null?void 0:E.borderRadius,offset:E==null?void 0:E.offset,stepPosition:E==null?void 0:E.stepPosition}),I=e.isInternal?void 0:t;return c.jsx(Ef,{id:I,path:_,labelX:R,labelY:L,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:g,style:y,markerEnd:w,markerStart:N,interactionWidth:T})})}const uE=cE({isInternal:!1}),dE=cE({isInternal:!0});uE.displayName="SmoothStepEdge";dE.displayName="SmoothStepEdgeInternal";function fE(e){return j.memo(({id:t,...s})=>{var i;const r=e.isInternal?void 0:t;return c.jsx(uE,{...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 _8=fE({isInternal:!1}),hE=fE({isInternal:!0});_8.displayName="StepEdge";hE.displayName="StepEdgeInternal";function mE(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,E,T]=Oj({sourceX:s,sourceY:r,targetX:i,targetY:l}),_=e.isInternal?void 0:t;return c.jsx(Ef,{id:_,path:N,labelX:E,labelY:T,label:d,labelStyle:f,labelShowBg:m,labelBgStyle:h,labelBgPadding:v,labelBgBorderRadius:g,style:y,markerEnd:b,markerStart:S,interactionWidth:w})})}const R8=mE({isInternal:!1}),pE=mE({isInternal:!0});R8.displayName="StraightEdge";pE.displayName="StraightEdgeInternal";function gE(e){return j.memo(({id:t,sourceX:s,sourceY:r,targetX:i,targetY:l,sourcePosition:d=Ne.Bottom,targetPosition:f=Ne.Top,label:m,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:b,style:S,markerEnd:w,markerStart:N,pathOptions:E,interactionWidth:T})=>{const[_,R,L]=Mj({sourceX:s,sourceY:r,sourcePosition:d,targetX:i,targetY:l,targetPosition:f,curvature:E==null?void 0:E.curvature}),I=e.isInternal?void 0:t;return c.jsx(Ef,{id:I,path:_,labelX:R,labelY:L,label:m,labelStyle:h,labelShowBg:v,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:b,style:S,markerEnd:w,markerStart:N,interactionWidth:T})})}const T8=gE({isInternal:!1}),xE=gE({isInternal:!0});T8.displayName="BezierEdge";xE.displayName="BezierEdgeInternal";const jS={default:xE,straight:pE,step:hE,smoothstep:dE,simplebezier:lE},ES={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},A8=(e,t,s)=>s===Ne.Left?e-t:s===Ne.Right?e+t:e,M8=(e,t,s)=>s===Ne.Top?e-t:s===Ne.Bottom?e+t:e,CS="react-flow__edgeupdater";function _S({position:e,centerX:t,centerY:s,radius:r=10,onMouseDown:i,onMouseEnter:l,onMouseOut:d,type:f}){return c.jsx("circle",{onMouseDown:i,onMouseEnter:l,onMouseOut:d,className:Nt([CS,`${CS}-${f}`]),cx:A8(t,r,e),cy:M8(s,r,e),r,stroke:"transparent",fill:"transparent"})}function k8({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=ut(),w=(R,L)=>{if(R.button!==0)return;const{autoPanOnConnect:I,domNode:P,connectionMode:A,connectionRadius:M,lib:q,onConnectStart:z,cancelConnection:Q,nodeLookup:Y,rfId:B,panBy:V,updateConnection:k}=S.getState(),U=L.type==="target",$=(D,G)=>{y(!1),g==null||g(D,s,L.type,G)},F=D=>h==null?void 0:h(s,D),H=(D,G)=>{y(!0),v==null||v(R,s,L.type),z==null||z(D,G)};mg.onPointerDown(R.nativeEvent,{autoPanOnConnect:I,connectionMode:A,connectionRadius:M,domNode:P,handleId:L.id,nodeId:L.nodeId,nodeLookup:Y,isTarget:U,edgeUpdaterType:L.type,lib:q,flowId:B,cancelConnection:Q,panBy:V,isValidConnection:(...D)=>{var G,J;return((J=(G=S.getState()).isValidConnection)==null?void 0:J.call(G,...D))??!0},onConnect:F,onConnectStart:H,onConnectEnd:(...D)=>{var G,J;return(J=(G=S.getState()).onConnectEnd)==null?void 0:J.call(G,...D)},onReconnectEnd:$,updateConnection:k,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"}),E=R=>w(R,{nodeId:s.source,id:s.sourceHandle??null,type:"source"}),T=()=>b(!0),_=()=>b(!1);return c.jsxs(c.Fragment,{children:[(e===!0||e==="source")&&c.jsx(_S,{position:f,centerX:r,centerY:i,radius:t,onMouseDown:N,onMouseEnter:T,onMouseOut:_,type:"source"}),(e===!0||e==="target")&&c.jsx(_S,{position:m,centerX:l,centerY:d,radius:t,onMouseDown:E,onMouseEnter:T,onMouseOut:_,type:"target"})]})}function O8({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:E,disableKeyboardA11y:T}){let _=Ge(xe=>xe.edgeLookup.get(e));const R=Ge(xe=>xe.defaultEdgeOptions);_=R?{...R,..._}:_;let L=_.type||"default",I=(w==null?void 0:w[L])||jS[L];I===void 0&&(E==null||E("011",ms.error011(L)),L="default",I=(w==null?void 0:w.default)||jS.default);const P=!!(_.focusable||t&&typeof _.focusable>"u"),A=typeof g<"u"&&(_.reconnectable||s&&typeof _.reconnectable>"u"),M=!!(_.selectable||r&&typeof _.selectable>"u"),q=j.useRef(null),[z,Q]=j.useState(!1),[Y,B]=j.useState(!1),V=ut(),{zIndex:k,sourceX:U,sourceY:$,targetX:F,targetY:H,sourcePosition:D,targetPosition:G}=Ge(j.useCallback(xe=>{const ve=xe.nodeLookup.get(_.source),Te=xe.nodeLookup.get(_.target);if(!ve||!Te)return{zIndex:_.zIndex,...ES};const Ve=RL({id:e,sourceNode:ve,targetNode:Te,sourceHandle:_.sourceHandle||null,targetHandle:_.targetHandle||null,connectionMode:xe.connectionMode,onError:E});return{zIndex:bL({selected:_.selected,zIndex:_.zIndex,sourceNode:ve,targetNode:Te,elevateOnSelect:xe.elevateEdgesOnSelect,zIndexMode:xe.zIndexMode}),...Ve||ES}},[_.source,_.target,_.sourceHandle,_.targetHandle,_.selected,_.zIndex]),ct),J=j.useMemo(()=>_.markerStart?`url('#${fg(_.markerStart,S)}')`:void 0,[_.markerStart,S]),se=j.useMemo(()=>_.markerEnd?`url('#${fg(_.markerEnd,S)}')`:void 0,[_.markerEnd,S]);if(_.hidden||U===null||$===null||F===null||H===null)return null;const oe=xe=>{var Oe;const{addSelectedEdges:ve,unselectNodesAndEdges:Te,multiSelectionActive:Ve}=V.getState();M&&(V.setState({nodesSelectionActive:!1}),_.selected&&Ve?(Te({nodes:[],edges:[_]}),(Oe=q.current)==null||Oe.blur()):ve([e])),i&&i(xe,_)},ce=l?xe=>{l(xe,{..._})}:void 0,de=d?xe=>{d(xe,{..._})}:void 0,ue=f?xe=>{f(xe,{..._})}:void 0,fe=m?xe=>{m(xe,{..._})}:void 0,Ce=h?xe=>{h(xe,{..._})}:void 0,be=xe=>{var ve;if(!T&&gj.includes(xe.key)&&M){const{unselectNodesAndEdges:Te,addSelectedEdges:Ve}=V.getState();xe.key==="Escape"?((ve=q.current)==null||ve.blur(),Te({edges:[_]})):Ve([e])}};return c.jsx("svg",{style:{zIndex:k},children:c.jsxs("g",{className:Nt(["react-flow__edge",`react-flow__edge-${L}`,_.className,N,{selected:_.selected,animated:_.animated,inactive:!M&&!i,updating:z,selectable:M}]),onClick:oe,onDoubleClick:ce,onContextMenu:de,onMouseEnter:ue,onMouseMove:fe,onMouseLeave:Ce,onKeyDown:P?be:void 0,tabIndex:P?0:void 0,role:_.ariaRole??(P?"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":P?`${Fj}-${S}`:void 0,ref:q,..._.domAttributes,children:[!Y&&c.jsx(I,{id:e,source:_.source,target:_.target,type:_.type,selected:_.selected,animated:_.animated,selectable:M,deletable:_.deletable??!0,label:_.label,labelStyle:_.labelStyle,labelShowBg:_.labelShowBg,labelBgStyle:_.labelBgStyle,labelBgPadding:_.labelBgPadding,labelBgBorderRadius:_.labelBgBorderRadius,sourceX:U,sourceY:$,targetX:F,targetY:H,sourcePosition:D,targetPosition:G,data:_.data,style:_.style,sourceHandleId:_.sourceHandle,targetHandleId:_.targetHandle,markerStart:J,markerEnd:se,pathOptions:"pathOptions"in _?_.pathOptions:void 0,interactionWidth:_.interactionWidth}),A&&c.jsx(k8,{edge:_,isReconnectable:A,reconnectRadius:v,onReconnect:g,onReconnectStart:y,onReconnectEnd:b,sourceX:U,sourceY:$,targetX:F,targetY:H,sourcePosition:D,targetPosition:G,setUpdateHover:Q,setReconnecting:B})]})})}var D8=j.memo(O8);const L8=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function yE({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:E,elementsSelectable:T,onError:_}=Ge(L8,ct),R=v8(t);return c.jsxs("div",{className:"react-flow__edges",children:[c.jsx(j8,{defaultColor:e,rfId:s}),R.map(L=>c.jsx(D8,{id:L,edgesFocusable:N,edgesReconnectable:E,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},L))]})}yE.displayName="EdgeRenderer";const z8=j.memo(yE),P8=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function I8({children:e}){const t=Ge(P8);return c.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function B8(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 H8=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function U8(e){const t=Ge(H8),s=ut();return j.useEffect(()=>{e&&(t==null||t(e),s.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function $8(e){return e.connection.inProgress?{...e.connection,to:Nc(e.connection.to,e.transform)}:{...e.connection}}function q8(e){return $8}function V8(e){const t=q8();return Ge(t,ct)}const G8=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Y8({containerStyle:e,style:t,type:s,component:r}){const{nodesConnectable:i,width:l,height:d,isValid:f,inProgress:m}=Ge(G8,ct);return!(l&&i&&m)?null:c.jsx("svg",{style:e,width:l,height:d,className:"react-flow__connectionline react-flow__container",children:c.jsx("g",{className:Nt(["react-flow__connection",vj(f)]),children:c.jsx(vE,{style:t,type:s,CustomComponent:r,isValid:f})})})}const vE=({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}=V8();if(!i)return;if(s)return c.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:vj(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]=Mj(w);break;case Da.SimpleBezier:[S]=iE(w);break;case Da.Step:[S]=dg({...w,borderRadius:0});break;case Da.SmoothStep:[S]=dg(w);break;default:[S]=Oj(w)}return c.jsx("path",{d:S,fill:"none",className:"react-flow__connection-path",style:e})};vE.displayName="ConnectionLine";const Q8={};function RS(e=Q8){j.useRef(e),ut(),j.useEffect(()=>{},[e])}function F8(){ut(),j.useRef(!1),j.useEffect(()=>{},[])}function bE({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:E,selectionKeyCode:T,selectionOnDrag:_,selectionMode:R,multiSelectionKeyCode:L,panActivationKeyCode:I,zoomActivationKeyCode:P,deleteKeyCode:A,onlyRenderVisibleElements:M,elementsSelectable:q,defaultViewport:z,translateExtent:Q,minZoom:Y,maxZoom:B,preventScrolling:V,defaultMarkerColor:k,zoomOnScroll:U,zoomOnPinch:$,panOnScroll:F,panOnScrollSpeed:H,panOnScrollMode:D,zoomOnDoubleClick:G,panOnDrag:J,onPaneClick:se,onPaneMouseEnter:oe,onPaneMouseMove:ce,onPaneMouseLeave:de,onPaneScroll:ue,onPaneContextMenu:fe,paneClickDistance:Ce,nodeClickDistance:be,onEdgeContextMenu:xe,onEdgeMouseEnter:ve,onEdgeMouseMove:Te,onEdgeMouseLeave:Ve,reconnectRadius:Oe,onReconnect:tt,onReconnectStart:me,onReconnectEnd:Pe,noDragClassName:rt,noWheelClassName:dt,noPanClassName:mn,disableKeyboardA11y:Zn,nodeExtent:Ae,rfId:pt,viewport:Lt,onViewportChange:Wn}){return RS(e),RS(t),F8(),B8(s),U8(Lt),c.jsx(c8,{onPaneClick:se,onPaneMouseEnter:oe,onPaneMouseMove:ce,onPaneMouseLeave:de,onPaneContextMenu:fe,onPaneScroll:ue,paneClickDistance:Ce,deleteKeyCode:A,selectionKeyCode:T,selectionOnDrag:_,selectionMode:R,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:L,panActivationKeyCode:I,zoomActivationKeyCode:P,elementsSelectable:q,zoomOnScroll:U,zoomOnPinch:$,zoomOnDoubleClick:G,panOnScroll:F,panOnScrollSpeed:H,panOnScrollMode:D,panOnDrag:J,defaultViewport:z,translateExtent:Q,minZoom:Y,maxZoom:B,onSelectionContextMenu:g,preventScrolling:V,noDragClassName:rt,noWheelClassName:dt,noPanClassName:mn,disableKeyboardA11y:Zn,onViewportChange:Wn,isControlledViewport:!!Lt,children:c.jsxs(I8,{children:[c.jsx(z8,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:d,onReconnect:tt,onReconnectStart:me,onReconnectEnd:Pe,onlyRenderVisibleElements:M,onEdgeContextMenu:xe,onEdgeMouseEnter:ve,onEdgeMouseMove:Te,onEdgeMouseLeave:Ve,reconnectRadius:Oe,defaultMarkerColor:k,noPanClassName:mn,disableKeyboardA11y:Zn,rfId:pt}),c.jsx(Y8,{style:w,type:S,component:N,containerStyle:E}),c.jsx("div",{className:"react-flow__edgelabel-renderer"}),c.jsx(y8,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:l,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:h,onNodeContextMenu:v,nodeClickDistance:be,onlyRenderVisibleElements:M,noPanClassName:mn,noDragClassName:rt,disableKeyboardA11y:Zn,nodeExtent:Ae,rfId:pt}),c.jsx("div",{className:"react-flow__viewport-portal"})]})})}bE.displayName="GraphView";const K8=j.memo(bE),TS=({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,E=r??t??[],T=s??e??[],_=v??[0,0],R=g??sc;zj(w,N,E);const L=hg(T,b,S,{nodeOrigin:_,nodeExtent:R,zIndexMode:y});let I=[0,0,1];if(d&&i&&l){const P=Sc(b,{filter:z=>!!((z.width||z.initialWidth)&&(z.height||z.initialHeight))}),{x:A,y:M,zoom:q}=n0(P,i,l,m,h,(f==null?void 0:f.padding)??.1);I=[A,M,q]}return{rfId:"1",width:i??0,height:l??0,transform:I,nodes:T,nodesInitialized:L,nodeLookup:b,parentLookup:S,edges:E,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:{...yj},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:mL,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:xj,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},X8=({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})=>fz((b,S)=>{async function w(){const{nodeLookup:N,panZoom:E,fitViewOptions:T,fitViewResolver:_,width:R,height:L,minZoom:I,maxZoom:P}=S();E&&(await fL({nodes:N,width:R,height:L,panZoom:E,minZoom:I,maxZoom:P},T),_==null||_.resolve(!0),b({fitViewResolver:null}))}return{...TS({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:E,parentLookup:T,nodeOrigin:_,elevateNodesOnSelect:R,fitViewQueued:L,zIndexMode:I}=S(),P=hg(N,E,T,{nodeOrigin:_,nodeExtent:g,elevateNodesOnSelect:R,checkEquality:!0,zIndexMode:I});L&&P?(w(),b({nodes:N,nodesInitialized:P,fitViewQueued:!1,fitViewOptions:void 0})):b({nodes:N,nodesInitialized:P})},setEdges:N=>{const{connectionLookup:E,edgeLookup:T}=S();zj(E,T,N),b({edges:N})},setDefaultNodesAndEdges:(N,E)=>{if(N){const{setNodes:T}=S();T(N),b({hasDefaultNodes:!0})}if(E){const{setEdges:T}=S();T(E),b({hasDefaultEdges:!0})}},updateNodeInternals:N=>{const{triggerNodeChanges:E,nodeLookup:T,parentLookup:_,domNode:R,nodeOrigin:L,nodeExtent:I,debug:P,fitViewQueued:A,zIndexMode:M}=S(),{changes:q,updatedInternals:z}=zL(N,T,_,R,L,I,M);z&&(kL(T,_,{nodeOrigin:L,nodeExtent:I,zIndexMode:M}),A?(w(),b({fitViewQueued:!1,fitViewOptions:void 0})):b({}),(q==null?void 0:q.length)>0&&(P&&console.log("React Flow: trigger node changes",q),E==null||E(q)))},updateNodePositions:(N,E=!1)=>{const T=[];let _=[];const{nodeLookup:R,triggerNodeChanges:L,connection:I,updateConnection:P,onNodesChangeMiddlewareMap:A}=S();for(const[M,q]of N){const z=R.get(M),Q=!!(z!=null&&z.expandParent&&(z!=null&&z.parentId)&&(q!=null&&q.position)),Y={id:M,type:"position",position:Q?{x:Math.max(0,q.position.x),y:Math.max(0,q.position.y)}:q.position,dragging:E};if(z&&I.inProgress&&I.fromNode.id===z.id){const B=ni(z,I.fromHandle,Ne.Left,!0);P({...I,from:B})}Q&&z.parentId&&T.push({id:M,parentId:z.parentId,rect:{...q.internals.positionAbsolute,width:q.measured.width??0,height:q.measured.height??0}}),_.push(Y)}if(T.length>0){const{parentLookup:M,nodeOrigin:q}=S(),z=l0(T,R,M,q);_.push(...z)}for(const M of A.values())_=M(_);L(_)},triggerNodeChanges:N=>{const{onNodesChange:E,setNodes:T,nodes:_,hasDefaultNodes:R,debug:L}=S();if(N!=null&&N.length){if(R){const I=Oz(N,_);T(I)}L&&console.log("React Flow: trigger node changes",N),E==null||E(N)}},triggerEdgeChanges:N=>{const{onEdgesChange:E,setEdges:T,edges:_,hasDefaultEdges:R,debug:L}=S();if(N!=null&&N.length){if(R){const I=Dz(N,_);T(I)}L&&console.log("React Flow: trigger edge changes",N),E==null||E(N)}},addSelectedNodes:N=>{const{multiSelectionActive:E,edgeLookup:T,nodeLookup:_,triggerNodeChanges:R,triggerEdgeChanges:L}=S();if(E){const I=N.map(P=>Rr(P,!0));R(I);return}R(Ji(_,new Set([...N]),!0)),L(Ji(T))},addSelectedEdges:N=>{const{multiSelectionActive:E,edgeLookup:T,nodeLookup:_,triggerNodeChanges:R,triggerEdgeChanges:L}=S();if(E){const I=N.map(P=>Rr(P,!0));L(I);return}L(Ji(T,new Set([...N]))),R(Ji(_,new Set,!0))},unselectNodesAndEdges:({nodes:N,edges:E}={})=>{const{edges:T,nodes:_,nodeLookup:R,triggerNodeChanges:L,triggerEdgeChanges:I}=S(),P=N||_,A=E||T,M=[];for(const z of P){if(!z.selected)continue;const Q=R.get(z.id);Q&&(Q.selected=!1),M.push(Rr(z.id,!1))}const q=[];for(const z of A)z.selected&&q.push(Rr(z.id,!1));L(M),I(q)},setMinZoom:N=>{const{panZoom:E,maxZoom:T}=S();E==null||E.setScaleExtent([N,T]),b({minZoom:N})},setMaxZoom:N=>{const{panZoom:E,minZoom:T}=S();E==null||E.setScaleExtent([T,N]),b({maxZoom:N})},setTranslateExtent:N=>{var E;(E=S().panZoom)==null||E.setTranslateExtent(N),b({translateExtent:N})},resetSelectedElements:()=>{const{edges:N,nodes:E,triggerNodeChanges:T,triggerEdgeChanges:_,elementsSelectable:R}=S();if(!R)return;const L=E.reduce((P,A)=>A.selected?[...P,Rr(A.id,!1)]:P,[]),I=N.reduce((P,A)=>A.selected?[...P,Rr(A.id,!1)]:P,[]);T(L),_(I)},setNodeExtent:N=>{const{nodes:E,nodeLookup:T,parentLookup:_,nodeOrigin:R,elevateNodesOnSelect:L,nodeExtent:I,zIndexMode:P}=S();N[0][0]===I[0][0]&&N[0][1]===I[0][1]&&N[1][0]===I[1][0]&&N[1][1]===I[1][1]||(hg(E,T,_,{nodeOrigin:R,nodeExtent:N,elevateNodesOnSelect:L,checkEquality:!1,zIndexMode:P}),b({nodeExtent:N}))},panBy:N=>{const{transform:E,width:T,height:_,panZoom:R,translateExtent:L}=S();return PL({delta:N,panZoom:R,transform:E,translateExtent:L,width:T,height:_})},setCenter:async(N,E,T)=>{const{width:_,height:R,maxZoom:L,panZoom:I}=S();if(!I)return Promise.resolve(!1);const P=typeof(T==null?void 0:T.zoom)<"u"?T.zoom:L;return await I.setViewport({x:_/2-N*P,y:R/2-E*P,zoom:P},{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:{...yj}})},updateConnection:N=>{b({connection:N})},reset:()=>b({...TS()})}},Object.is);function Z8({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(()=>X8({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 c.jsx(hz,{value:S,children:c.jsx(Iz,{children:b})})}function W8({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(wf)?c.jsx(c.Fragment,{children:e}):c.jsx(Z8,{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 J8={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function e6({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:E,onNodeMouseEnter:T,onNodeMouseMove:_,onNodeMouseLeave:R,onNodeContextMenu:L,onNodeDoubleClick:I,onNodeDragStart:P,onNodeDrag:A,onNodeDragStop:M,onNodesDelete:q,onEdgesDelete:z,onDelete:Q,onSelectionChange:Y,onSelectionDragStart:B,onSelectionDrag:V,onSelectionDragStop:k,onSelectionContextMenu:U,onSelectionStart:$,onSelectionEnd:F,onBeforeDelete:H,connectionMode:D,connectionLineType:G=Da.Bezier,connectionLineStyle:J,connectionLineComponent:se,connectionLineContainerStyle:oe,deleteKeyCode:ce="Backspace",selectionKeyCode:de="Shift",selectionOnDrag:ue=!1,selectionMode:fe=ac.Full,panActivationKeyCode:Ce="Space",multiSelectionKeyCode:be=oc()?"Meta":"Control",zoomActivationKeyCode:xe=oc()?"Meta":"Control",snapToGrid:ve,snapGrid:Te,onlyRenderVisibleElements:Ve=!1,selectNodesOnDrag:Oe,nodesDraggable:tt,autoPanOnNodeFocus:me,nodesConnectable:Pe,nodesFocusable:rt,nodeOrigin:dt=Kj,edgesFocusable:mn,edgesReconnectable:Zn,elementsSelectable:Ae=!0,defaultViewport:pt=Cz,minZoom:Lt=.5,maxZoom:Wn=2,translateExtent:nr=sc,preventScrolling:_f=!0,nodeExtent:ri,defaultMarkerColor:Rf="#b1b1b7",zoomOnScroll:Tf=!0,zoomOnPinch:sr=!0,panOnScroll:Vt=!1,panOnScrollSpeed:Jn=.5,panOnScrollMode:Gt=Kr.Free,zoomOnDoubleClick:Af=!0,panOnDrag:Mf=!0,onPaneClick:kf,onPaneMouseEnter:ii,onPaneMouseMove:oi,onPaneMouseLeave:li,onPaneScroll:gs,onPaneContextMenu:ci,paneClickDistance:ar=1,nodeClickDistance:Of=0,children:jc,onReconnect:_o,onReconnectStart:rr,onReconnectEnd:Df,onEdgeContextMenu:Ec,onEdgeDoubleClick:Cc,onEdgeMouseEnter:_c,onEdgeMouseMove:Ro,onEdgeMouseLeave:To,reconnectRadius:Rc=10,onNodesChange:Tc,onEdgesChange:es,noDragClassName:jt="nodrag",noWheelClassName:Ut="nowheel",noPanClassName:xs="nopan",fitView:ui,fitViewOptions:Ac,connectOnClick:Lf,attributionPosition:Mc,proOptions:ir,defaultEdgeOptions:Ao,elevateNodesOnSelect:Ws=!0,elevateEdgesOnSelect:Js=!1,disableKeyboardA11y:ea=!1,autoPanOnConnect:ta,autoPanOnNodeDrag:yt,autoPanSpeed:kc,connectionRadius:Oc,isValidConnection:ys,onError:na,style:zf,id:Mo,nodeDragThreshold:Dc,connectionDragThreshold:Pf,viewport:di,onViewportChange:fi,width:Pn,height:Jt,colorMode:Lc="light",debug:If,onScroll:sa,ariaLabelConfig:zc,zIndexMode:or="basic",...Bf},en){const lr=Mo||"1",Pc=Az(Lc),ko=j.useCallback(vs=>{vs.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),sa==null||sa(vs)},[sa]);return c.jsx("div",{"data-testid":"rf__wrapper",...Bf,onScroll:ko,style:{...zf,...J8},ref:en,className:Nt(["react-flow",i,Pc]),id:Mo,role:"application",children:c.jsxs(W8,{nodes:e,edges:t,width:Pn,height:Jt,fitView:ui,fitViewOptions:Ac,minZoom:Lt,maxZoom:Wn,nodeOrigin:dt,nodeExtent:ri,zIndexMode:or,children:[c.jsx(K8,{onInit:h,onNodeClick:f,onEdgeClick:m,onNodeMouseEnter:T,onNodeMouseMove:_,onNodeMouseLeave:R,onNodeContextMenu:L,onNodeDoubleClick:I,nodeTypes:l,edgeTypes:d,connectionLineType:G,connectionLineStyle:J,connectionLineComponent:se,connectionLineContainerStyle:oe,selectionKeyCode:de,selectionOnDrag:ue,selectionMode:fe,deleteKeyCode:ce,multiSelectionKeyCode:be,panActivationKeyCode:Ce,zoomActivationKeyCode:xe,onlyRenderVisibleElements:Ve,defaultViewport:pt,translateExtent:nr,minZoom:Lt,maxZoom:Wn,preventScrolling:_f,zoomOnScroll:Tf,zoomOnPinch:sr,zoomOnDoubleClick:Af,panOnScroll:Vt,panOnScrollSpeed:Jn,panOnScrollMode:Gt,panOnDrag:Mf,onPaneClick:kf,onPaneMouseEnter:ii,onPaneMouseMove:oi,onPaneMouseLeave:li,onPaneScroll:gs,onPaneContextMenu:ci,paneClickDistance:ar,nodeClickDistance:Of,onSelectionContextMenu:U,onSelectionStart:$,onSelectionEnd:F,onReconnect:_o,onReconnectStart:rr,onReconnectEnd:Df,onEdgeContextMenu:Ec,onEdgeDoubleClick:Cc,onEdgeMouseEnter:_c,onEdgeMouseMove:Ro,onEdgeMouseLeave:To,reconnectRadius:Rc,defaultMarkerColor:Rf,noDragClassName:jt,noWheelClassName:Ut,noPanClassName:xs,rfId:lr,disableKeyboardA11y:ea,nodeExtent:ri,viewport:di,onViewportChange:fi}),c.jsx(Tz,{nodes:e,edges:t,defaultNodes:s,defaultEdges:r,onConnect:b,onConnectStart:S,onConnectEnd:w,onClickConnectStart:N,onClickConnectEnd:E,nodesDraggable:tt,autoPanOnNodeFocus:me,nodesConnectable:Pe,nodesFocusable:rt,edgesFocusable:mn,edgesReconnectable:Zn,elementsSelectable:Ae,elevateNodesOnSelect:Ws,elevateEdgesOnSelect:Js,minZoom:Lt,maxZoom:Wn,nodeExtent:ri,onNodesChange:Tc,onEdgesChange:es,snapToGrid:ve,snapGrid:Te,connectionMode:D,translateExtent:nr,connectOnClick:Lf,defaultEdgeOptions:Ao,fitView:ui,fitViewOptions:Ac,onNodesDelete:q,onEdgesDelete:z,onDelete:Q,onNodeDragStart:P,onNodeDrag:A,onNodeDragStop:M,onSelectionDrag:V,onSelectionDragStart:B,onSelectionDragStop:k,onMove:v,onMoveStart:g,onMoveEnd:y,noPanClassName:xs,nodeOrigin:dt,rfId:lr,autoPanOnConnect:ta,autoPanOnNodeDrag:yt,autoPanSpeed:kc,onError:na,connectionRadius:Oc,isValidConnection:ys,selectNodesOnDrag:Oe,nodeDragThreshold:Dc,connectionDragThreshold:Pf,onBeforeDelete:H,debug:If,ariaLabelConfig:zc,zIndexMode:or}),c.jsx(Ez,{onSelectionChange:Y}),jc,c.jsx(bz,{proOptions:ir,position:Mc}),c.jsx(vz,{rfId:lr,disableKeyboardA11y:ea})]})})}var SE=Zj(e6);function t6({dimensions:e,lineWidth:t,variant:s,className:r}){return c.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Nt(["react-flow__background-pattern",s,r])})}function n6({radius:e,className:t}){return c.jsx("circle",{cx:e,cy:e,r:e,className:Nt(["react-flow__background-pattern","dots",t])})}var Za;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Za||(Za={}));const s6={[Za.Dots]:1,[Za.Lines]:1,[Za.Cross]:6},a6=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function wE({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}=Ge(a6,ct),S=r||s6[t],w=t===Za.Dots,N=t===Za.Cross,E=Array.isArray(s)?s:[s,s],T=[E[0]*y[2]||1,E[1]*y[2]||1],_=S*y[2],R=Array.isArray(l)?l:[l,l],L=N?[_,_]:T,I=[R[0]*y[2]||1+L[0]/2,R[1]*y[2]||1+L[1]/2],P=`${b}${e||""}`;return c.jsxs("svg",{className:Nt(["react-flow__background",h]),style:{...m,...jf,"--xy-background-color-props":f,"--xy-background-pattern-color-props":d},ref:g,"data-testid":"rf__background",children:[c.jsx("pattern",{id:P,x:y[0]%T[0],y:y[1]%T[1],width:T[0],height:T[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${I[0]},-${I[1]})`,children:w?c.jsx(n6,{radius:_/2,className:v}):c.jsx(t6,{dimensions:L,lineWidth:i,variant:t,className:v})}),c.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${P})`})]})}wE.displayName="Background";const r6=j.memo(wE);function i6(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:c.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function o6(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:c.jsx("path",{d:"M0 0h32v4.2H0z"})})}function l6(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:c.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 c6(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.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 u6(){return c.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:c.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 c.jsx("button",{type:"button",className:Nt(["react-flow__controls-button",t]),...s,children:e})}const d6=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function NE({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=ut(),{isInteractive:w,minZoomReached:N,maxZoomReached:E,ariaLabelConfig:T}=Ge(d6,ct),{zoomIn:_,zoomOut:R,fitView:L}=c0(),I=()=>{_(),l==null||l()},P=()=>{R(),d==null||d()},A=()=>{L(i),f==null||f()},M=()=>{S.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),m==null||m(!w)},q=y==="horizontal"?"horizontal":"vertical";return c.jsxs(Nf,{className:Nt(["react-flow__controls",q,h]),position:g,style:e,"data-testid":"rf__controls","aria-label":b??T["controls.ariaLabel"],children:[t&&c.jsxs(c.Fragment,{children:[c.jsx(vd,{onClick:I,className:"react-flow__controls-zoomin",title:T["controls.zoomIn.ariaLabel"],"aria-label":T["controls.zoomIn.ariaLabel"],disabled:E,children:c.jsx(i6,{})}),c.jsx(vd,{onClick:P,className:"react-flow__controls-zoomout",title:T["controls.zoomOut.ariaLabel"],"aria-label":T["controls.zoomOut.ariaLabel"],disabled:N,children:c.jsx(o6,{})})]}),s&&c.jsx(vd,{className:"react-flow__controls-fitview",onClick:A,title:T["controls.fitView.ariaLabel"],"aria-label":T["controls.fitView.ariaLabel"],children:c.jsx(l6,{})}),r&&c.jsx(vd,{className:"react-flow__controls-interactive",onClick:M,title:T["controls.interactive.ariaLabel"],"aria-label":T["controls.interactive.ariaLabel"],children:w?c.jsx(u6,{}):c.jsx(c6,{})}),v]})}NE.displayName="Controls";const jE=j.memo(NE);function f6({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 c.jsx("rect",{className:Nt(["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?E=>b(E,e):void 0})}const h6=j.memo(f6),m6=e=>e.nodes.map(t=>t.id),Ap=e=>e instanceof Function?e:()=>e;function p6({nodeStrokeColor:e,nodeColor:t,nodeClassName:s="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:l=h6,onClick:d}){const f=Ge(m6,ct),m=Ap(t),h=Ap(e),v=Ap(s),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return c.jsx(c.Fragment,{children:f.map(y=>c.jsx(x6,{id:y,nodeColorFunc:m,nodeStrokeColorFunc:h,nodeClassNameFunc:v,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:l,onClick:d,shapeRendering:g},y))})}function g6({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}=Ge(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:E,y:T}=w.internals.positionAbsolute,{width:_,height:R}=Zs(N);return{node:N,x:E,y:T,width:_,height:R}},ct);return!h||h.hidden||!Ej(h)?null:c.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 x6=j.memo(g6);var y6=j.memo(p6);const v6=200,b6=150,S6=e=>!e.hidden,w6=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?jj(Sc(e.nodeLookup,{filter:S6}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},N6="react-flow__minimap-desc";function EE({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:E,inversePan:T,zoomStep:_=1,offsetScale:R=5}){const L=ut(),I=j.useRef(null),{boundingRect:P,viewBB:A,rfId:M,panZoom:q,translateExtent:z,flowWidth:Q,flowHeight:Y,ariaLabelConfig:B}=Ge(w6,ct),V=(e==null?void 0:e.width)??v6,k=(e==null?void 0:e.height)??b6,U=P.width/V,$=P.height/k,F=Math.max(U,$),H=F*V,D=F*k,G=R*F,J=P.x-(H-P.width)/2-G,se=P.y-(D-P.height)/2-G,oe=H+G*2,ce=D+G*2,de=`${N6}-${M}`,ue=j.useRef(0),fe=j.useRef();ue.current=F,j.useEffect(()=>{if(I.current&&q)return fe.current=YL({domNode:I.current,panZoom:q,getTransform:()=>L.getState().transform,getViewScale:()=>ue.current}),()=>{var ve;(ve=fe.current)==null||ve.destroy()}},[q]),j.useEffect(()=>{var ve;(ve=fe.current)==null||ve.update({translateExtent:z,width:Q,height:Y,inversePan:T,pannable:w,zoomStep:_,zoomable:N})},[w,N,T,_,z,Q,Y]);const Ce=b?ve=>{var Oe;const[Te,Ve]=((Oe=fe.current)==null?void 0:Oe.pointer(ve))||[0,0];b(ve,{x:Te,y:Ve})}:void 0,be=S?j.useCallback((ve,Te)=>{const Ve=L.getState().nodeLookup.get(Te).internals.userNode;S(ve,Ve)},[]):void 0,xe=E??B["minimap.ariaLabel"];return c.jsx(Nf,{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*F: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:Nt(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:c.jsxs("svg",{width:V,height:k,viewBox:`${J} ${se} ${oe} ${ce}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":de,ref:I,onClick:Ce,children:[xe&&c.jsx("title",{id:de,children:xe}),c.jsx(y6,{onClick:be,nodeColor:r,nodeStrokeColor:s,nodeBorderRadius:l,nodeClassName:i,nodeStrokeWidth:d,nodeComponent:f}),c.jsx("path",{className:"react-flow__minimap-mask",d:`M${J-G},${se-G}h${oe+G*2}v${ce+G*2}h${-oe-G*2}z
|
|
221
|
+
M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}EE.displayName="MiniMap";j.memo(EE);const j6=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,E6={[jo.Line]:"right",[jo.Handle]:"bottom-right"};function C6({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:E}){const T=tE(),_=typeof e=="string"?e:T,R=ut(),L=j.useRef(null),I=s===jo.Handle,P=Ge(j.useCallback(j6(I&&b),[I,b]),ct),A=j.useRef(null),M=t??E6[s];j.useEffect(()=>{if(!(!L.current||!_))return A.current||(A.current=iz({domNode:L.current,nodeId:_,getStoreItems:()=>{const{nodeLookup:z,transform:Q,snapGrid:Y,snapToGrid:B,nodeOrigin:V,domNode:k}=R.getState();return{nodeLookup:z,transform:Q,snapGrid:Y,snapToGrid:B,nodeOrigin:V,paneDomNode:k}},onChange:(z,Q)=>{const{triggerNodeChanges:Y,nodeLookup:B,parentLookup:V,nodeOrigin:k}=R.getState(),U=[],$={x:z.x,y:z.y},F=B.get(_);if(F&&F.expandParent&&F.parentId){const H=F.origin??k,D=z.width??F.measured.width??0,G=z.height??F.measured.height??0,J={id:F.id,parentId:F.parentId,rect:{width:D,height:G,...Cj({x:z.x??F.position.x,y:z.y??F.position.y},{width:D,height:G},F.parentId,B,H)}},se=l0([J],B,V,k);U.push(...se),$.x=z.x?Math.max(H[0]*D,z.x):void 0,$.y=z.y?Math.max(H[1]*G,z.y):void 0}if($.x!==void 0&&$.y!==void 0){const H={id:_,type:"position",position:{...$}};U.push(H)}if(z.width!==void 0&&z.height!==void 0){const D={id:_,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:z.width,height:z.height}};U.push(D)}for(const H of Q){const D={...H,type:"position"};U.push(D)}Y(U)},onEnd:({width:z,height:Q})=>{const Y={id:_,type:"dimensions",resizing:!1,dimensions:{width:z,height:Q}};R.getState().triggerNodeChanges([Y])}})),A.current.update({controlPosition:M,boundaries:{minWidth:f,minHeight:m,maxWidth:h,maxHeight:v},keepAspectRatio:g,resizeDirection:y,onResizeStart:w,onResize:N,onResizeEnd:E,shouldResize:S}),()=>{var z;(z=A.current)==null||z.destroy()}},[M,f,m,h,v,g,w,N,E,S]);const q=M.split("-");return c.jsx("div",{className:Nt(["react-flow__resize-control","nodrag",...q,s,r]),ref:L,style:{...i,scale:P,...d&&{[I?"backgroundColor":"borderColor"]:d}},children:l})}j.memo(C6);async function _6(e){const t=await fetch(`/api/rigs/${encodeURIComponent(e)}/graph`);if(!t.ok)throw new Error(`HTTP ${t.status}`);return t.json()}function R6(e){return Rt({queryKey:["rig",e,"graph"],queryFn:()=>_6(e),enabled:!!e,refetchInterval:3e4})}const T6=100;function A6(e){const t=Tt(),[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"]})},T6)))},[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 M6(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 AS(e){return e.type==="group"||e.type==="podGroup"}const d0=240,f0=160,nf=3,CE=36,_E=32,RE=28,TE=44,k6=28,O6=120,D6=0,L6=new Set(["delegates_to","spawned_by"]);function z6(e,t){if(e.length<=1)return e;const s=new Set(e.filter(h=>AS(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(AS(h)){const v=r.get(h.id)??[],{width:g,height:y}=I6(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=P6(t,l),f=U6(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=B6(y)}}return e.map(h=>m.get(h.id)??h)}function P6(e,t){const s=MS(e.filter(r=>L6.has(H6(r))),t);return s.length>0?s:MS(e,t)}function MS(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 I6(e){const t=Math.max(e,1),s=Math.min(t,nf),r=Math.ceil(t/nf),i=s*d0+Math.max(s-1,0)*CE,l=r*f0+Math.max(r-1,0)*_E;return{width:i+RE*2,height:l+TE+k6}}function B6(e){const t=e%nf,s=Math.floor(e/nf);return{x:RE+t*(d0+CE),y:TE+s*(f0+_E)}}function H6(e){var t;return((t=e.data)==null?void 0:t.kind)??e.label??""}function U6(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 E=w.shift();if(d.has(E))continue;d.add(E),l.push(E);const T=Array.from(r.get(E)??[]).sort((R,L)=>bd(R,L,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:D6,y}),y+=S.height+O6)}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 $6(e){return e==="architect"||e==="lead"||e==="orchestrator"}function q6(e){switch(e){case"ready":return"ready";case"pending":return"launching";case"failed":return"failed";default:return"stopped"}}function V6(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 G6({data:e}){var L,I,P;const t=j.useRef(e.startupStatus),s=j.useRef(null),[r,i]=j.useState(!1),[l,d]=j.useState(null),f=$6(e.role),m=e.nodeKind==="infrastructure";j.useEffect(()=>{if(t.current!==e.startupStatus&&t.current!==null){i(!0);const A=setTimeout(()=>i(!1),600);return t.current=e.startupStatus,()=>clearTimeout(A)}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=q6(e.startupStatus),y=V6(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(A=>!!A),w=S.join(`
|
|
222
|
+
`),N=A=>{s.current&&clearTimeout(s.current),d(A),s.current=setTimeout(()=>{d(M=>M===A?null:M),s.current=null},900)},E=async A=>{var q;A.stopPropagation();const M=e.canonicalSessionName??((q=e.binding)==null?void 0:q.tmuxSession);M&&(await Qn(`tmux attach -t ${M}`),N("attach"))},T=async A=>{if(A.stopPropagation(),!!e.rigId)try{(await fetch(`/api/rigs/${encodeURIComponent(e.rigId)}/nodes/${encodeURIComponent(e.logicalId)}/open-cmux`,{method:"POST"})).ok&&N("cmux")}catch{}},_=async A=>{A.stopPropagation(),e.resumeToken&&(e.runtime==="claude-code"?(await Qn(`claude --resume ${e.resumeToken}`),N("resume")):e.runtime==="codex"&&(await Qn(`codex resume ${e.resumeToken}`),N("resume")))},R=A=>`px-1.5 py-0.5 border font-mono text-[7px] uppercase transition-colors ${l===A?"bg-stone-900 text-white border-stone-900":"bg-white text-stone-900 border-stone-300 hover:bg-stone-100"}`;return c.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:[c.jsx(Wa,{type:"target",position:Ne.Top}),c.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:[c.jsx("span",{className:"font-bold truncate",children:v}),c.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})]}),c.jsxs("div",{className:"p-3 space-y-2",children:[h&&c.jsxs("div",{className:"font-mono text-[8px] text-stone-500",children:["RUNTIME: ",h]}),e.resolvedSpecName&&c.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"?c.jsxs("div",{className:"font-mono text-[8px] text-stone-500","data-testid":"context-badge",children:["CTX ",e.contextUsedPercentage,"%"]}):c.jsx("div",{className:"font-mono text-[8px] text-stone-300","data-testid":"context-badge-unknown",children:"CTX unknown"}),e.restoreOutcome&&e.restoreOutcome!=="n-a"&&c.jsxs("div",{className:"font-mono text-[8px] text-stone-500",children:["RESTORE: ",e.restoreOutcome]}),e.packageRefs&&e.packageRefs.length>0&&c.jsxs("div",{"data-testid":"package-badge",title:e.packageRefs.join(", "),className:"font-mono text-[8px] text-stone-400",onClick:A=>A.stopPropagation(),onKeyDown:A=>A.stopPropagation(),children:["PKG ",e.packageRefs.length]}),e.startupStatus==="failed"&&c.jsxs("div",{className:"stamp-badge",children:[c.jsx("div",{className:"w-2 h-2 rounded-full bg-red-500"}),c.jsx("span",{className:"text-red-600",children:"FAILED"})]}),(e.canonicalSessionName??((L=e.binding)==null?void 0:L.tmuxSession)??e.resumeToken??e.rigId)&&c.jsxs("div",{"data-testid":"node-toolbar",className:"flex flex-wrap gap-1 pt-1",onClick:A=>A.stopPropagation(),onKeyDown:A=>A.stopPropagation(),children:[(e.canonicalSessionName??((I=e.binding)==null?void 0:I.tmuxSession))&&c.jsx("button",{onClick:E,"data-testid":"toolbar-copy-attach",className:R("attach"),title:`tmux attach -t ${e.canonicalSessionName??((P=e.binding)==null?void 0:P.tmuxSession)??"?"}`,children:l==="attach"?"copied":"tmux"}),e.rigId&&c.jsx("button",{onClick:T,"data-testid":"toolbar-cmux-open",className:R("cmux"),children:l==="cmux"?"opened":"cmux"}),e.resumeToken&&e.runtime&&e.runtime!=="terminal"&&c.jsx("button",{onClick:_,"data-testid":"toolbar-copy-resume",className:R("resume"),children:l==="resume"?"copied":"resume"})]}),b&&c.jsx("div",{className:"pt-1",children:c.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&&c.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(A=>c.jsx("div",{children:A},A))}),c.jsx(Wa,{type:"source",position:Ne.Bottom})]})}const Y6=Xw("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"}}),Kt=j.forwardRef(({className:e,variant:t,...s},r)=>c.jsx("div",{ref:r,role:"alert",className:Re(Y6({variant:t}),e),...s}));Kt.displayName="Alert";const Q6=j.forwardRef(({className:e,...t},s)=>c.jsx("h5",{ref:s,className:Re("mb-1 font-medium leading-none tracking-tight",e),...t}));Q6.displayName="AlertTitle";const Xt=j.forwardRef(({className:e,...t},s)=>c.jsx("div",{ref:s,className:Re("text-sm [&_p]:leading-relaxed",e),...t}));Xt.displayName="AlertDescription";function F6({data:e}){const t=e.podDisplayName??e.podNamespace??ds(e.logicalId)??fs(e.podId??e.logicalId);return c.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:c.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 K6({data:e}){const t=e.session;return c.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:[c.jsx(Wa,{type:"target",position:Ne.Top,className:"opacity-0"}),c.jsxs("div",{className:"text-label-sm font-mono uppercase mb-spacing-1",children:[t.tmuxSession,":",t.tmuxPane]}),c.jsxs("div",{className:"flex gap-spacing-2 items-center mb-spacing-1",children:[c.jsx("span",{className:"text-label-sm uppercase text-foreground-muted",children:t.runtimeHint}),c.jsx("span",{className:"text-label-sm text-foreground-muted",children:t.confidence})]}),t.cwd&&c.jsx("div",{className:"text-label-sm font-mono text-foreground-muted truncate",children:t.cwd}),c.jsx(Wa,{type:"source",position:Ne.Bottom,className:"opacity-0"})]})}const X6={rigNode:G6,discoveredNode:K6,podGroup:F6};function Z6(){return c.jsxs("div",{className:"flex flex-col items-center justify-center h-full relative text-foreground-muted","data-testid":"empty-topology",children:[c.jsxs("svg",{className:"absolute inset-0 w-full h-full",viewBox:"0 0 400 300",fill:"none",style:{opacity:.08},children:[c.jsx("rect",{x:"160",y:"60",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),c.jsx("rect",{x:"60",y:"180",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),c.jsx("rect",{x:"260",y:"180",width:"80",height:"40",stroke:"currentColor",strokeWidth:"1"}),c.jsx("line",{x1:"200",y1:"100",x2:"100",y2:"180",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 4"}),c.jsx("line",{x1:"200",y1:"100",x2:"300",y2:"180",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 4"})]}),c.jsx("div",{className:"relative z-10 text-center",children:c.jsx("h2",{className:"text-headline-md uppercase",children:"EMPTY TOPOLOGY"})})]})}function W6({rigId:e,rigName:t=null,showDiscovered:s=!0}){const{data:r,isPending:i,error:l}=R6(e??""),d=J3(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}=A6(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(Y=>{b.current&&clearTimeout(b.current),y(Y),b.current=setTimeout(()=>{y(null),b.current=null},3e3)},[]);j.useEffect(()=>()=>{b.current&&clearTimeout(b.current)},[]);const E=j.useMemo(()=>m.map(Y=>{var k;const B=((k=Y.data)==null?void 0:k.kind)??Y.label??"delegates_to",V=M6(B);return{...Y,...V,className:w?"edge-draw-in":void 0,style:{...V.style,animationDelay:w?`${Math.min(f.length*50+100,2e3)}ms`:void 0}}}),[m,w,f.length]),T=j.useMemo(()=>{const Y=new Map;for(const B of f){const V=B.data;if((B.type==="podGroup"||B.type==="group")&&(V!=null&&V.podId)){Y.set(V.podId,{displayName:V.podLabel??V.podNamespace??ds(V.logicalId)??fs(V.podId),namespace:V.podNamespace??V.logicalId??null});continue}const k=(V==null?void 0:V.podId)??null;if(!k)continue;const U=(V==null?void 0:V.podNamespace)??ds(V==null?void 0:V.logicalId)??null,$=(V==null?void 0:V.podLabel)??U??fs(k);Y.has(k)||Y.set(k,{displayName:$,namespace:U})}return Y},[f]),{selection:_,setSelection:R}=tr(),{selectedDiscoveredId:L,placementTarget:I,setPlacementTarget:P}=j4(),A=(_==null?void 0:_.type)==="discovery"&&!!L,M=j.useMemo(()=>{const Y=new Map;for(const $ of f){if(!$.parentId)continue;const F=typeof $.data=="object"&&$.data!==null&&"logicalId"in $.data?$.data.logicalId:null,H=typeof $.data=="object"&&$.data!==null&&"podId"in $.data?$.data.podId:null,D=ds(F)??fs(H);D&&!Y.has($.parentId)&&Y.set($.parentId,D)}const V=z6(f,m).map(($,F)=>({...$,data:(()=>{if($.type==="podGroup"||$.type==="group"){const H=$.data,D=(H==null?void 0:H.podId)??null,G=(I==null?void 0:I.kind)==="pod"&&D!==null&&I.podId===D;return{...$.data??{},podDisplayName:Y.get($.id)??null,placementState:A?G?"selected":"available":null}}if($.type==="rigNode"){const H=$.data,D=!(H!=null&&H.binding)&&!(H!=null&&H.canonicalSessionName),G=(I==null?void 0:I.kind)==="node"&&(H==null?void 0:H.logicalId)!==void 0&&I.logicalId===H.logicalId;return{...$.data??{},placementState:A?G?"selected":D?"available":null:null}}return $.data})(),className:w?"node-enter":void 0,style:{...$.style??{},animationDelay:w?`${Math.min(F*50,2e3)}ms`:void 0}})),k=V.reduce(($,F)=>{var H;return Math.max($,((H=F.position)==null?void 0:H.y)??0)},0),U=d.map(($,F)=>({id:`discovered-${$.id}`,type:"discoveredNode",position:{x:300,y:k+200+F*150},data:{session:$}}));return[...V,...U]},[f,m,w,d,A,I]),{setSelectedNode:q}=E4(),z=t!=null&&t.trim()?t:e?Gs(e):null,Q=j.useCallback(async(Y,B)=>{var k;if(!e)return;if(A){if(B.type==="podGroup"||B.type==="group"){const U=B.data,$=(U==null?void 0:U.podId)??null,F=$?T.get($):null,H=!!($&&(F!=null&&F.namespace));P({kind:"pod",rigId:e,podId:$??"",podNamespace:(F==null?void 0:F.namespace)??null,podLabel:(F==null?void 0:F.displayName)??null,eligible:H,...H?{}:{reason:"This pod cannot receive a new node yet."}});return}if(B.type==="rigNode"){const U=B.data,$=!U.binding&&!U.canonicalSessionName;P({kind:"node",rigId:e,logicalId:U.logicalId,eligible:$,...$?{}:{reason:"This node is already claimed."}});return}}if(B.type==="podGroup"||B.type==="group"){R({type:"rig",rigId:e});return}const V=B.data;if(q({rigId:e,logicalId:V.logicalId}),!((k=V.binding)!=null&&k.cmuxSurface)){N({text:"Not bound to cmux surface",type:"info"});return}try{const U=await fetch(`/api/rigs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(V.logicalId)}/focus`,{method:"POST"});if(!U.ok){N({text:"Focus failed",type:"error"});return}const $=await U.json();$.ok===!1&&$.code==="unavailable"?N({text:"cmux not connected",type:"error"}):$.ok?N({text:"Focused",type:"success"}):N({text:"Focus failed",type:"error"})}catch{N({text:"Focus failed",type:"error"})}},[A,T,e,P,q,R,N]);return e===null?c.jsx("div",{className:"p-spacing-6 text-foreground-muted",children:"No rig selected"}):i?c.jsxs("div",{className:"p-spacing-6","data-testid":"graph-loading",children:[c.jsx("div",{className:"h-8 w-48 animate-pulse-tactical mb-spacing-4"}),c.jsx("div",{className:"h-64 animate-pulse-tactical"})]}):h?c.jsx("div",{className:"p-spacing-6",children:c.jsx(Kt,{"data-testid":"graph-error",children:c.jsxs(Xt,{children:["Error: ",h]})})}):M.length===0?c.jsx(Z6,{}):c.jsxs("div",{className:"w-full h-full relative","data-testid":"graph-view","data-animated":w?"true":"false",children:[c.jsx("div",{className:"absolute top-4 left-4 w-3 h-3 reg-mark",children:c.jsx("div",{className:"reg-tl"})}),c.jsx("div",{className:"absolute top-4 right-4 w-3 h-3",children:c.jsx("div",{className:"reg-tr"})}),c.jsx("div",{className:"absolute bottom-4 left-4 w-3 h-3",children:c.jsx("div",{className:"reg-bl"})}),c.jsx("div",{className:"absolute bottom-4 right-4 w-3 h-3",children:c.jsx("div",{className:"reg-br"})}),z&&c.jsx("div",{"data-testid":"rig-stamp-watermark",className:"stamp-watermark text-3xl left-[20%] top-[35%]",children:z}),v&&c.jsx("div",{className:"absolute top-spacing-4 right-spacing-4 z-20",children:c.jsx(Kt,{children:c.jsx(Xt,{className:"text-warning",children:"Live updates disconnected from daemon — reconnecting..."})})}),g&&c.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}),A&&c.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."}),c.jsx(SE,{nodes:M,edges:E,nodeTypes:X6,onNodeClick:Q,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:c.jsx(jE,{})})]})}function h0(){const{openExplorer:e}=N4(),{setSelection:t}=tr();return c.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:c.jsxs("div",{className:"max-w-xl space-y-3",children:[c.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:"Explorer-Driven Workspace"}),c.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."}),c.jsxs("p",{className:"text-sm text-stone-600",children:["Use ",c.jsx("span",{className:"font-mono text-stone-800",children:"Specs"})," to import a rig spec or run bootstrap, and use the ",c.jsx("span",{className:"font-mono text-stone-800",children:"Discovery"})," drawer to place running sessions."]}),c.jsxs("div",{className:"flex items-center justify-center gap-3 pt-2",children:[c.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"}),c.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"}),c.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 J6(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)=>c.jsx("input",{type:t,className:Re("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)=>c.jsx("textarea",{className:Re("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 lt({children:e,className:t,innerClassName:s}){return c.jsx("div",{"data-testid":"workspace-page",className:Re("w-full flex-1 overflow-y-auto lg:pl-[var(--workspace-left-offset,0px)] lg:pr-[var(--workspace-right-offset,0px)]",t),children:c.jsx("div",{"data-testid":"workspace-page-inner",className:Re("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)=>c.jsx("div",{className:"relative w-full overflow-auto",children:c.jsx("table",{ref:s,className:Re("w-full caption-bottom text-sm",e),...t})}));g0.displayName="Table";const x0=j.forwardRef(({className:e,...t},s)=>c.jsx("thead",{ref:s,className:Re("bg-surface-low [&_tr]:border-b [&_tr]:border-stone-300",e),...t}));x0.displayName="TableHeader";const y0=j.forwardRef(({className:e,...t},s)=>c.jsx("tbody",{ref:s,className:Re("[&_tr:last-child]:border-0",e),...t}));y0.displayName="TableBody";const eP=j.forwardRef(({className:e,...t},s)=>c.jsx("tfoot",{ref:s,className:Re("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));eP.displayName="TableFooter";const cc=j.forwardRef(({className:e,...t},s)=>c.jsx("tr",{ref:s,className:Re("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)=>c.jsx("th",{ref:s,className:Re("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)=>c.jsx("td",{ref:s,className:Re("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Dr.displayName="TableCell";const tP=j.forwardRef(({className:e,...t},s)=>c.jsx("caption",{ref:s,className:Re("mt-4 text-sm text-foreground-muted",e),...t}));tP.displayName="TableCaption";function Fn({eyebrow:e,title:t,description:s,actions:r}){return c.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[c.jsxs("div",{className:"space-y-3",children:[c.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:e}),c.jsx("h2",{className:"text-2xl font-bold uppercase tracking-[0.04em] text-stone-900 sm:text-3xl",children:t}),s&&c.jsx("p",{className:"max-w-2xl text-base leading-8 text-stone-600",children:s})]}),r?c.jsx("div",{className:"flex flex-wrap gap-2",children:r}):null]})}function AE({steps:e,currentStep:t,errorAtStep:s=0,"data-testid":r}){const i=s||t;return c.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 c.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[c.jsxs("div",{"data-testid":`step-${l.num}`,"data-step-state":v,className:Re("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:[c.jsxs("span",{className:"text-[9px] tracking-[0.22em]",children:[f?"✓ ":"",String(l.num).padStart(2,"0")]}),c.jsx("span",{className:"text-[10px] leading-none tracking-[0.2em]",children:l.label})]}),d<e.length-1?c.jsx("div",{"aria-hidden":"true",className:Re("h-px w-4 shrink-0 sm:w-6",f?"bg-primary/35":"bg-stone-300/45")}):null]},l.num)})})}function zn({title:e,description:t,children:s,className:r}){return c.jsxs("section",{className:Re("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:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-stone-500",children:e}),t?c.jsx("p",{className:"text-base leading-8 text-stone-600",children:t}):null]}),s]})}function Cf({children:e}){return c.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:e})}function kt({label:e,value:t,testId:s}){return c.jsxs("div",{className:"border border-stone-300/35 bg-white/10 px-4 py-4",children:[c.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:e}),c.jsx("div",{"data-testid":s,className:"mt-2 text-2xl font-semibold uppercase tracking-[0.04em] text-stone-900",children:t})]})}function ME({title:e,testId:t,children:s}){return c.jsx(zn,{title:e,children:c.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 nP=[{num:1,label:"VALIDATE RIGSPEC"},{num:2,label:"PREFLIGHT"},{num:3,label:"INSTANTIATE"}];function sP(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 aP({onBack:e}={}){const t=RM(),{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([]),[E,T]=j.useState([]),[_,R]=j.useState(null);j.useEffect(()=>{i(f)},[i,f]),j.useEffect(()=>{r&&(m(r.yaml),d())},[d,r]);const L=async()=>{l(f),y("validating"),N([]);try{const M=await(await fetch("/api/rigs/import/validate",{method:"POST",headers:{"Content-Type":"text/yaml"},body:f})).json();M.valid?y("valid"):(N(M.errors??["Validation failed"]),S(1),y("error"))}catch{N(["Validation request failed"]),S(1),y("error")}},I=async()=>{y("preflight"),N([]),T([]);try{const A={"Content-Type":"text/yaml"};h&&(A["X-Rig-Root"]=h);const q=await(await fetch("/api/rigs/import/preflight",{method:"POST",headers:A,body:f})).json();T(q.warnings??[]),q.errors&&q.errors.length>0?(N(q.errors),S(2),y("error")):y("preflight_done")}catch{N(["Preflight request failed"]),S(2),y("error")}},P=async()=>{y("instantiating"),N([]);try{const A=await t.mutateAsync({yaml:f,rigRoot:h.trim()||void 0});R(A),y("done")}catch(A){A instanceof Wp?(A.code==="cycle_error"?N(["Cycle detected in rig topology"]):N(A.errors),T(A.warnings)):N([A instanceof Error?A.message:"Instantiate request failed"]),S(3),y("error")}};return c.jsx(lt,{children:c.jsxs("div",{"data-testid":"import-flow",className:"space-y-8",children:[c.jsx(Fn,{eyebrow:"Rig Import",title:"Import Rig",description:"Validate a RigSpec, run preflight checks, then instantiate a topology from YAML."}),c.jsx(AE,{"data-testid":"step-indicator",steps:nP,currentStep:sP(g),errorAtStep:g==="error"?b:0}),g==="input"&&c.jsxs(zn,{title:"Rig YAML",description:"Paste a rig spec and optionally provide a rig root to anchor relative references during import.",children:[c.jsx(p0,{"data-testid":"yaml-input",value:f,onChange:A=>m(A.target.value),placeholder:"Paste YAML rig spec here...",rows:14,className:"font-mono text-body-sm mb-spacing-4"}),c.jsxs("div",{className:"mb-spacing-4",children:[c.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"RIG ROOT (OPTIONAL)"}),c.jsx(m0,{"data-testid":"rig-root-input",type:"text",value:h,onChange:A=>v(A.target.value),placeholder:"/path/to/rig/root",className:"font-mono text-body-sm"})]}),c.jsx(we,{variant:"tactical","data-testid":"validate-btn",onClick:L,disabled:!f.trim(),children:"VALIDATE RIGSPEC"})]}),g==="validating"&&c.jsx("div",{className:"text-label-md text-foreground-muted",children:"Validating..."}),g==="valid"&&c.jsxs(zn,{title:"Validation Passed",description:"The RigSpec is valid. Run preflight checks before you instantiate it.",children:[c.jsx(Kt,{className:"mb-spacing-4","data-testid":"valid-message",children:c.jsx(Xt,{className:"text-primary",children:"RigSpec valid. Run preflight checks?"})}),c.jsx(we,{variant:"tactical","data-testid":"preflight-btn",onClick:I,children:"RUN PREFLIGHT"})]}),g==="preflight"&&c.jsx("div",{className:"text-label-md text-foreground-muted",children:"Running preflight..."}),g==="preflight_done"&&c.jsxs(zn,{title:"Preflight Results",description:"Review warnings before you instantiate the rig into live runtime sessions.",children:[E.length>0&&c.jsx(Kt,{className:"mb-spacing-4","data-testid":"preflight-warnings",children:c.jsxs(Xt,{className:"text-warning",children:[c.jsx("div",{className:"text-label-md uppercase mb-spacing-1",children:"WARNINGS"}),E.map((A,M)=>c.jsxs("div",{children:["— ",A]},M))]})}),c.jsx(Kt,{className:"mb-spacing-4","data-testid":"preflight-ready",children:c.jsx(Xt,{className:"text-primary",children:"Preflight passed. Ready to instantiate."})}),c.jsx(we,{variant:"tactical","data-testid":"instantiate-btn",onClick:P,children:"INSTANTIATE"})]}),g==="instantiating"&&c.jsx("div",{className:"text-label-md text-foreground-muted",children:"Instantiating..."}),g==="done"&&_&&c.jsx(zn,{title:"Instantiate Result",description:"The daemon returned per-node launch status for the imported topology.",className:"space-y-4",children:c.jsxs("div",{"data-testid":"import-result",children:[c.jsx(Kt,{className:"mb-spacing-4",children:c.jsxs(Xt,{children:[c.jsx("span",{className:"text-primary font-mono",children:_.specName}),c.jsxs("span",{className:"text-foreground-muted",children:[" (",_.rigId,")"]})]})}),c.jsxs(g0,{children:[c.jsx(x0,{children:c.jsxs(cc,{children:[c.jsx(Or,{children:"NODE"}),c.jsx(Or,{children:"STATUS"})]})}),c.jsx(y0,{children:_.nodes.map(A=>c.jsxs(cc,{children:[c.jsx(Dr,{className:"font-mono",children:A.logicalId}),c.jsx(Dr,{children:c.jsx("span",{className:`font-mono ${J6(A.status)}`,"data-testid":`inst-status-${A.logicalId}`,children:A.status})})]},A.logicalId))})]}),e?c.jsx("div",{className:"mt-spacing-6",children:c.jsx(we,{variant:"ghost",onClick:e,children:"Close"})}):null]})}),g==="error"&&c.jsx(zn,{title:"Import Errors",description:"Fix the reported issues, then retry the import flow.",children:c.jsxs("div",{"data-testid":"import-errors",children:[E.length>0&&c.jsx(Kt,{className:"mb-spacing-2","data-testid":"error-warnings",children:c.jsxs(Xt,{className:"text-warning",children:[c.jsx("div",{className:"text-label-md uppercase mb-spacing-1",children:"WARNINGS"}),E.map((A,M)=>c.jsxs("div",{children:["— ",A]},M))]})}),w.map((A,M)=>c.jsx(Kt,{className:"mb-spacing-2",children:c.jsx(Xt,{className:"text-destructive",children:A})},M)),c.jsx(we,{variant:"tactical",className:"mt-spacing-4",onClick:()=>{y("input"),N([]),T([]),R(null),S(0),v("")},children:"TRY AGAIN"})]})})]})})}async function rP(){const e=await fetch("/api/packages/summary");if(!e.ok)throw new Error(`HTTP ${e.status}`);return e.json()}function iP(){return Rt({queryKey:["packages"],queryFn:rP})}function oP(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 lP(e){switch(e){case"applied":return"APPLIED";case"rolled_back":return"ROLLED BACK";case"failed":return"FAILED";default:return"NONE"}}function cP({pkg:e,onSelect:t}){return c.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:[c.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[c.jsx("h3",{className:"text-headline-md uppercase",children:e.name}),c.jsxs("span",{className:"text-label-md font-mono text-foreground-muted-on-dark",children:["v",e.version]})]}),e.summary&&c.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark mb-spacing-4",children:e.summary}),c.jsx("div",{className:"flex items-center gap-spacing-4 text-label-sm",children:c.jsxs("span",{className:"text-foreground-muted-on-dark",children:["SOURCE ",c.jsx("span",{className:"font-mono text-foreground-on-dark",children:e.sourceRef})]})}),c.jsxs("div",{className:"flex items-center gap-spacing-4 mt-spacing-3 text-label-sm",children:[c.jsxs("span",{className:"text-foreground-muted-on-dark",children:["INSTALLS ",c.jsx("span",{className:"font-mono text-foreground-on-dark","data-testid":"install-count",children:e.installCount})]}),c.jsxs("span",{className:"flex items-center gap-spacing-1",children:[c.jsx("span",{className:Re("inline-block w-[6px] h-[6px]",oP(e.latestInstallStatus))}),c.jsx("span",{className:"text-foreground-muted-on-dark","data-testid":"install-status",children:lP(e.latestInstallStatus)})]})]})]})}function uP(){const e=Wt(),{data:t,isPending:s,error:r}=iP(),i=t?[...t].sort((l,d)=>d.createdAt.localeCompare(l.createdAt)):[];return s?c.jsx(lt,{children:c.jsxs("div",{"data-testid":"packages-loading",children:[c.jsxs("div",{className:"flex justify-between mb-spacing-6",children:[c.jsx("div",{className:"h-8 w-32 shimmer"}),c.jsx("div",{className:"h-8 w-28 shimmer"})]}),[1,2].map(l=>c.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-3",children:[c.jsx("div",{className:"h-6 w-48 shimmer-dark mb-spacing-4"}),c.jsx("div",{className:"h-12 shimmer-dark mb-spacing-4"}),c.jsx("div",{className:"h-4 w-64 shimmer-dark"})]},l))]})}):r?c.jsx(lt,{children:c.jsx("div",{children:c.jsx(Kt,{"data-testid":"packages-error",children:c.jsx(Xt,{children:r.message})})})}):i.length===0?c.jsx(lt,{children:c.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh]","data-testid":"packages-empty",children:[c.jsx("h2",{className:"text-display-lg text-foreground mb-spacing-4",children:"NO LEGACY PACKAGE INSTALLS"}),c.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."}),c.jsxs("div",{className:"flex flex-col items-center gap-spacing-3",children:[c.jsx(we,{variant:"default",size:"lg","data-testid":"empty-import-btn",onClick:()=>e({to:"/import"}),children:"IMPORT RIGSPEC"}),c.jsx(we,{variant:"ghost",size:"lg","data-testid":"empty-bootstrap-btn",onClick:()=>e({to:"/bootstrap"}),children:"BOOTSTRAP"})]})]})}):c.jsx(lt,{children:c.jsxs("div",{children:[c.jsxs("div",{className:"flex justify-between items-baseline mb-spacing-6",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-headline-lg uppercase",children:"LEGACY PACKAGE TOOLS"}),c.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"]})]}),c.jsxs("div",{className:"flex flex-col items-end gap-spacing-2",children:[c.jsx(we,{variant:"default",size:"sm","data-testid":"header-import-btn",onClick:()=>e({to:"/import"}),children:"IMPORT RIGSPEC"}),c.jsx(we,{variant:"ghost",size:"sm","data-testid":"header-bootstrap-btn",onClick:()=>e({to:"/bootstrap"}),children:"BOOTSTRAP"})]})]}),i.map(l=>c.jsx(cP,{pkg:l,onSelect:d=>e({to:"/packages/$packageId",params:{packageId:d}})},l.id))]})})}const dP=[{num:1,label:"ENTER"},{num:2,label:"VALIDATE"},{num:3,label:"CONFIGURE"},{num:4,label:"PLAN"},{num:5,label:"APPLY"}];function fP(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 hP({currentStep:e,errorAtStep:t}){const s=e==="error"?t:fP(e);return c.jsx("div",{className:"flex items-center gap-spacing-2 mb-spacing-8 p-spacing-4 inset-light flex-wrap","data-testid":"step-indicator",children:dP.map((r,i)=>{const l=s>r.num,d=s===r.num;return c.jsxs("div",{className:"flex items-center gap-spacing-2",children:[i>0&&c.jsx("div",{className:`w-6 h-px mx-spacing-1 ${l?"bg-primary/40":"bg-foreground-muted/20"}`}),c.jsxs("span",{"data-testid":`step-${r.num}`,className:Re("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 mP(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 pP(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 gP(){const e=Wt(),[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(""),[E,T]=j.useState(!1),[_,R]=j.useState(null),[L,I]=j.useState(null),P=async()=>{i("validating"),m([]);try{const Q=await(await fetch("/api/packages/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceRef:t})})).json();Q.valid?(v(Q.manifest),i("validated")):(m(Q.errors??[Q.error??"Validation failed"]),d(2),i("error"))}catch{m(["Validation request failed"]),d(2),i("error")}},A=async()=>{i("planning"),m([]);try{const z=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:E})});if(!z.ok){const Y=await z.json();m(Y.errors??[Y.error??"Plan failed"]),d(4),i("error");return}const Q=await z.json();R(Q),i("planned")}catch{m(["Plan request failed"]),d(4),i("error")}},M=async()=>{i("applying"),m([]);try{const z=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:E})}),Q=await z.json();if(z.status>=400){m(Q.errors??[Q.error??"Install failed"]),d(5),i("error");return}I(Q),i("done")}catch{m(["Install request failed"]),d(5),i("error")}},q=((_==null?void 0:_.conflicts)??0)>0;return c.jsx(lt,{children:c.jsxs("div",{"data-testid":"install-flow",children:[c.jsx("div",{className:"mb-spacing-8",children:c.jsxs("div",{children:[c.jsx("h2",{className:"text-headline-lg uppercase tracking-[0.06em]",children:"INSTALL PACKAGE (Legacy)"}),c.jsx("p",{className:"text-label-md text-foreground-muted font-grotesk mt-spacing-1",children:"Validate, configure, and apply an agent package"})]})}),c.jsx(hP,{currentStep:r,errorAtStep:l}),r==="enter"&&c.jsxs("div",{children:[c.jsx("label",{className:"text-label-md text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-2",children:"PACKAGE PATH"}),c.jsx("input",{"data-testid":"source-path-input",type:"text",value:t,onChange:z=>s(z.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"}),c.jsx(we,{variant:"tactical","data-testid":"validate-btn",onClick:P,disabled:!t.trim(),className:"mt-spacing-4",children:"VALIDATE"})]}),r==="validating"&&c.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"validating-indicator",children:"Validating..."}),r==="validated"&&h&&c.jsxs("div",{"data-testid":"manifest-summary",children:[c.jsxs("div",{className:"card-dark p-spacing-4 mb-spacing-4",children:[c.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[c.jsx("span",{className:"text-headline-md uppercase",children:h.name}),c.jsxs("span",{className:"font-mono text-foreground-muted-on-dark",children:["v",h.version]})]}),c.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark mb-spacing-3",children:h.summary}),c.jsxs("div",{className:"flex flex-wrap gap-spacing-3 text-label-sm",children:[c.jsxs("span",{children:["Skills: ",c.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.exportCounts.skills})]}),c.jsxs("span",{children:["Guidance: ",c.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.exportCounts.guidance})]}),c.jsxs("span",{children:["Agents: ",c.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.exportCounts.agents})]}),c.jsxs("span",{children:["Hooks: ",c.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.exportCounts.hooks})]}),c.jsxs("span",{children:["Runtimes: ",c.jsx("span",{className:"font-mono text-foreground-on-dark",children:h.runtimes.join(", ")})]})]})]}),c.jsx(we,{variant:"tactical","data-testid":"configure-btn",onClick:()=>i("configure"),children:"CONFIGURE"})]}),r==="configure"&&h&&c.jsxs("div",{"data-testid":"configure-step",children:[c.jsxs("div",{className:"space-y-spacing-4 mb-spacing-6",children:[c.jsxs("div",{children:[c.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"RUNTIME"}),c.jsx("select",{"data-testid":"runtime-select",value:g,onChange:z=>y(z.target.value),className:"bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono outline-none",children:h.runtimes.map(z=>c.jsx("option",{value:z,children:z},z))})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"TARGET ROOT"}),c.jsx("input",{"data-testid":"target-root-input",type:"text",value:b,onChange:z=>S(z.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&&c.jsxs("div",{children:[c.jsx("label",{className:"text-label-sm text-foreground-muted uppercase tracking-[0.04em] block mb-spacing-1",children:"ROLE"}),c.jsxs("select",{"data-testid":"role-select",value:w,onChange:z=>N(z.target.value),className:"bg-transparent border-b border-foreground/20 py-spacing-1 text-body-md font-mono outline-none",children:[c.jsx("option",{value:"",children:"All exports"}),h.roles.map(z=>c.jsxs("option",{value:z.name,children:[z.name,z.description?` — ${z.description}`:""]},z.name))]})]}),c.jsxs("div",{className:"flex items-center gap-spacing-2",children:[c.jsx("input",{"data-testid":"allow-merge-toggle",type:"checkbox",checked:E,onChange:z=>T(z.target.checked),className:"accent-primary"}),c.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)&&c.jsxs("div",{"data-testid":"requirements-section",className:"p-spacing-3 bg-foreground/4",children:[c.jsx("span",{className:"text-label-sm text-foreground-muted uppercase block mb-spacing-1",children:"REQUIREMENTS"}),h.requirements.cliTools.map(z=>c.jsxs("div",{className:"text-body-sm font-mono",children:["CLI: ",z.name]},z.name)),h.requirements.systemPackages.map(z=>c.jsxs("div",{className:"text-body-sm font-mono",children:["System: ",z.name]},z.name))]})]}),c.jsx(we,{variant:"tactical","data-testid":"plan-btn",onClick:A,children:"PREVIEW PLAN"})]}),r==="planning"&&c.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"planning-indicator",children:"Planning..."}),r==="planned"&&_&&c.jsxs("div",{"data-testid":"plan-preview",children:[c.jsxs("div",{className:"flex flex-wrap gap-spacing-4 mb-spacing-4 text-label-sm",children:[c.jsxs("span",{children:["Approved: ",c.jsx("span",{className:"font-mono text-success","data-testid":"plan-actionable",children:_.actionable})]}),c.jsxs("span",{children:["Deferred: ",c.jsx("span",{className:"font-mono text-foreground-muted","data-testid":"plan-deferred",children:_.deferred})]}),c.jsxs("span",{children:["Conflicts: ",c.jsx("span",{className:"font-mono text-destructive","data-testid":"plan-conflicts",children:_.conflicts})]}),c.jsxs("span",{children:["No-ops: ",c.jsx("span",{className:"font-mono","data-testid":"plan-noops",children:_.noOps})]}),_.rejected>0&&c.jsxs("span",{children:["Rejected: ",c.jsx("span",{className:"font-mono text-warning","data-testid":"plan-rejected",children:_.rejected})]})]}),q&&c.jsx(Kt,{className:"mb-spacing-4","data-testid":"conflict-warning",children:c.jsx(Xt,{className:"text-destructive",children:"Conflicts detected — resolve before applying"})}),c.jsxs(g0,{children:[c.jsx(x0,{children:c.jsxs(cc,{children:[c.jsx(Or,{children:"TYPE"}),c.jsx(Or,{children:"NAME"}),c.jsx(Or,{children:"STATUS"}),c.jsx(Or,{children:"TARGET"})]})}),c.jsx(y0,{children:_.entries.map((z,Q)=>c.jsxs(cc,{className:pP(z.policyStatus),"data-testid":"plan-entry","data-policy-status":z.policyStatus,children:[c.jsx(Dr,{className:"font-mono text-label-sm",children:z.exportType}),c.jsx(Dr,{className:"font-mono text-label-sm",children:z.exportName}),c.jsxs(Dr,{className:Re("font-mono text-label-sm uppercase",mP(z.policyStatus)),children:[z.policyStatus,z.deferReason&&c.jsxs("span",{className:"text-foreground-muted normal-case",children:[" — ",z.deferReason]}),z.conflict&&c.jsxs("span",{className:"text-destructive normal-case",children:[" — ",z.conflict.reason]})]}),c.jsx(Dr,{className:"font-mono text-label-sm text-foreground-muted truncate max-w-[200px]",children:z.targetPath||"—"})]},Q))})]}),c.jsx("div",{className:"mt-spacing-4",children:c.jsx(we,{variant:"tactical","data-testid":"apply-btn",onClick:M,disabled:q,title:q?"Resolve conflicts before applying":void 0,children:"APPLY"})})]}),r==="applying"&&c.jsx("div",{className:"text-label-md text-foreground-muted","data-testid":"applying-indicator",children:"Applying..."}),r==="done"&&L&&c.jsxs("div",{"data-testid":"install-result",children:[c.jsx(Kt,{className:"mb-spacing-4",children:c.jsxs(Xt,{children:[c.jsx("span",{className:"text-primary font-mono",children:L.packageName}),c.jsx("span",{className:"text-foreground-muted",children:" installed as "}),c.jsx("span",{className:"font-mono","data-testid":"result-install-id",children:L.installId})]})}),c.jsxs("div",{className:"flex gap-spacing-4 text-label-sm mb-spacing-4",children:[c.jsxs("span",{children:["Applied: ",c.jsx("span",{className:"font-mono text-success","data-testid":"result-applied",children:L.applied.length})]}),c.jsxs("span",{children:["Deferred: ",c.jsx("span",{className:"font-mono text-foreground-muted","data-testid":"result-deferred",children:L.deferred.length})]}),c.jsxs("span",{children:["Verified: ",c.jsx("span",{className:Re("font-mono",L.verification.passed?"text-success":"text-destructive"),"data-testid":"result-verified",children:L.verification.passed?"PASS":"FAIL"})]})]}),c.jsx("div",{className:"flex gap-spacing-3",children:c.jsx(we,{variant:"tactical","data-testid":"detail-link",onClick:()=>e({to:"/packages/$packageId",params:{packageId:L.packageId}}),children:"VIEW INSTALL DETAILS"})})]}),r==="error"&&c.jsxs("div",{"data-testid":"install-errors",children:[f.map((z,Q)=>c.jsx(Kt,{className:"mb-spacing-2",children:c.jsx(Xt,{className:"text-destructive",children:z})},Q)),c.jsx(we,{variant:"tactical",className:"mt-spacing-4","data-testid":"try-again-btn",onClick:()=>{i("enter"),m([]),v(null),R(null),I(null),d(0)},children:"TRY AGAIN"})]})]})})}function xP(e){return Rt({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 yP(e){return Rt({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 vP(e){return Rt({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 bP(e){const t=Tt();return Ht({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 SP(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 wP(e){switch(e){case"applied":return"APPLIED";case"rolled_back":return"ROLLED BACK";case"failed":return"FAILED";default:return e.toUpperCase()}}function NP({installId:e}){const{data:t,isPending:s,isError:r}=vP(e);return s?c.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-foreground-muted",children:"Loading journal..."}):r?c.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?c.jsx("div",{className:"pl-spacing-6 py-spacing-2 text-label-sm text-foreground-muted",children:"No journal entries"}):c.jsx("div",{className:"pl-spacing-6 py-spacing-2 space-y-spacing-1","data-testid":"journal-entries",children:t.map(i=>c.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:[c.jsx("span",{className:"text-foreground-muted w-6 text-right",children:i.seq}),c.jsx("span",{className:"uppercase",children:i.action}),c.jsx("span",{className:"text-foreground-muted",children:i.exportType}),c.jsx("span",{className:"text-foreground-muted truncate max-w-[200px]",children:i.targetPath}),c.jsx("span",{className:"text-foreground-muted ml-auto",children:i.status})]},i.id))})}function jP({install:e,onRollback:t}){const[s,r]=j.useState(!1);return c.jsxs("div",{"data-testid":"install-row",className:"card-dark p-spacing-4 mb-spacing-2",children:[c.jsxs("div",{className:"flex items-center gap-spacing-4",children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-spacing-3 mb-spacing-1",children:[c.jsx("span",{className:"font-mono text-label-sm text-foreground-muted",children:e.createdAt}),c.jsx("span",{"data-testid":"install-status-badge",className:Re("inline-block px-spacing-2 py-px text-label-sm uppercase",SP(e.status)),children:wP(e.status)})]}),c.jsx("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:e.targetRoot}),c.jsxs("div",{className:"flex items-center gap-spacing-3 mt-spacing-1 text-label-sm",children:[c.jsxs("span",{"data-testid":"applied-count",children:[c.jsx("span",{className:"font-mono",children:e.appliedCount})," applied"]}),c.jsx("span",{"data-testid":"deferred-placeholder",className:"text-foreground-muted",children:"— deferred"})]})]}),c.jsxs("div",{className:"flex items-center gap-spacing-2 shrink-0",children:[c.jsx(we,{variant:"tactical",size:"sm","data-testid":"expand-btn",onClick:()=>r(!s),children:s?"COLLAPSE":"EXPAND"}),e.status==="applied"&&c.jsx(we,{variant:"tactical",size:"sm","data-testid":"rollback-btn",onClick:()=>t(e.id),children:"ROLLBACK"})]})]}),s&&c.jsx(NP,{installId:e.id})]})}function EP(){var w;const{packageId:e}=lf({strict:!1}),{data:t,isPending:s,error:r}=xP(e),{data:i,isPending:l,error:d}=yP(e),f=bP(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 c.jsx(lt,{children:c.jsxs("div",{"data-testid":"detail-loading",children:[c.jsx("div",{className:"h-8 w-48 shimmer mb-spacing-4"}),c.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-4",children:[c.jsx("div",{className:"h-6 w-64 shimmer-dark mb-spacing-3"}),c.jsx("div",{className:"h-4 w-full shimmer-dark"})]})]})});if(r)return c.jsx(lt,{children:c.jsx("div",{"data-testid":"detail-error",children:c.jsx("p",{className:"text-destructive",children:r.message})})});if(d)return c.jsx(lt,{children:c.jsx("div",{"data-testid":"installs-error",children:c.jsx("p",{className:"text-destructive",children:"Failed to load install history"})})});const S=i??[];return c.jsx(lt,{children:c.jsxs("div",{children:[t&&c.jsxs("div",{className:"card-dark p-spacing-6 mb-spacing-6","data-testid":"package-header",children:[c.jsxs("div",{className:"flex items-baseline justify-between mb-spacing-2",children:[c.jsxs("h2",{className:"text-headline-lg uppercase",children:[t.name," (Legacy)"]}),c.jsxs("span",{className:"text-label-md font-mono text-foreground-muted-on-dark",children:["v",t.version]})]}),c.jsxs("div",{className:"text-label-sm text-foreground-muted-on-dark mb-spacing-2",children:["SOURCE"," ",c.jsx("span",{className:"font-mono text-foreground-on-dark","data-testid":"package-source",children:t.sourceRef})]}),t.summary&&c.jsx("p",{className:"text-body-sm text-foreground-muted-on-dark",children:t.summary})]}),c.jsx("h3",{className:"text-headline-md uppercase mb-spacing-4",children:"INSTALL HISTORY"}),S.length===0?c.jsx("div",{"data-testid":"empty-installs",className:"text-body-md text-foreground-muted",children:"No installs yet"}):c.jsx("div",{"data-testid":"install-list",children:S.map(N=>c.jsx(jP,{install:N,onRollback:y},N.id))}),c.jsx(Gd,{open:v,onOpenChange:N=>{f.isPending||(g(N),N||f.reset())},children:c.jsxs(Fl,{"data-testid":"rollback-dialog",onPointerDownOutside:N=>{f.isPending&&N.preventDefault()},onEscapeKeyDown:N=>{f.isPending&&N.preventDefault()},hideCloseButton:f.isPending,children:[c.jsxs(Kl,{children:[c.jsx(Zl,{className:"text-headline-md uppercase",children:"CONFIRM ROLLBACK"}),c.jsx(Wl,{children:"This will roll back the install and restore previous file states. This action cannot be undone."})]}),f.isError&&c.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"]}),c.jsxs(Xl,{children:[c.jsx(we,{variant:"ghost",onClick:()=>{f.reset(),g(!1)},"data-testid":"rollback-cancel",disabled:f.isPending,children:"CANCEL"}),c.jsx(we,{variant:"destructive",onClick:b,"data-testid":"rollback-confirm",disabled:f.isPending,children:f.isPending?"ROLLING BACK...":"ROLLBACK"})]})]})})]})})}function CP(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 _P(e){switch(e){case"installed":return"OK";case"missing":return"MISSING";case"unsupported":return"MANUAL";case"unknown":return"UNKNOWN";default:return e.toUpperCase()}}function RP({results:e}){return e.length===0?c.jsx("div",{className:"text-body-sm text-foreground-muted","data-testid":"no-requirements",children:"No requirements declared."}):c.jsx("div",{className:"space-y-spacing-1","data-testid":"requirements-panel",children:e.map(t=>c.jsxs("div",{"data-testid":"requirement-row",className:"flex items-center gap-spacing-3 py-spacing-1 text-label-sm font-mono",children:[c.jsx("span",{"data-testid":"requirement-dot",className:Re("w-2 h-2 shrink-0",CP(t.status))}),c.jsx("span",{"data-testid":"requirement-status",className:"w-16 uppercase",children:_P(t.status)}),c.jsx("span",{className:"text-foreground-muted w-24",children:t.kind}),c.jsx("span",{children:t.name}),t.detectedPath&&c.jsx("span",{className:"text-foreground-muted ml-auto truncate max-w-[200px]",children:t.detectedPath})]},`${t.kind}:${t.name}`))})}function kE(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 TP(){return Ht({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(kE(s,t.status));throw r.data=s,r}return t.json()}})}function AP(){const e=Tt();return Ht({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(kE(l,i.status));throw d.data=l,d}return l},onSuccess:()=>{e.invalidateQueries({queryKey:["rigs","summary"]})}})}const MP=["ENTER","PLAN","REVIEW","APPLY"],kP=MP.map((e,t)=>({num:t+1,label:e}));function OP(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 DP(){const e=Wt(),{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=TP(),N=AP();j.useEffect(()=>{s(l)},[s,l]);const E=async()=>{if(l.trim()){i("planning");try{const Y=await w.mutateAsync({sourceRef:l.trim()});m(Y),v(new Set(Y.actionKeys??[])),i("planned")}catch(Y){S(Y.message),i("error")}}},T=async()=>{i("applying");try{const Y=await N.mutateAsync({sourceRef:l.trim(),autoApprove:g,approvedActionKeys:g?void 0:[...h]});m(Y),i("done")}catch(Y){S(Y.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(Y=>Y.stage==="probe_requirements"),L=R==null?void 0:R.detail,I=(L==null?void 0:L.results)??[],P=f==null?void 0:f.stages.find(Y=>Y.stage==="build_install_plan"),A=P==null?void 0:P.detail,M=(A==null?void 0:A.actions)??[],q=(P==null?void 0:P.status)==="blocked",Q=M.some(Y=>Y.classification!=="manual_only"&&Y.commandPreview)&&h.size===0&&!g;return c.jsx(lt,{children:c.jsxs("div",{"data-testid":"bootstrap-wizard",className:"space-y-8",children:[c.jsx(Fn,{eyebrow:"Bootstrap",title:"Bootstrap",description:"Plan environment requirements, approve install actions, then import the rig into a running topology."}),c.jsx(AE,{"data-testid":"step-indicator",steps:kP,currentStep:OP(r)}),r==="enter"&&c.jsx(zn,{title:"Source",description:"Provide a rig spec or bundle path. Bootstrap will inspect requirements before it imports anything.",children:c.jsxs("div",{"data-testid":"step-enter",children:[c.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"SPEC OR BUNDLE PATH"}),c.jsx(m0,{"data-testid":"spec-input",type:"text",value:l,onChange:Y=>d(Y.target.value),placeholder:"/path/to/rig.yaml or /path/to/bundle.rigbundle",className:"font-mono text-body-md"}),c.jsxs("p",{className:"text-label-sm text-foreground-muted mt-spacing-1",children:["Accepts .yaml rig specs or .rigbundle archives."," ",c.jsx("span",{role:"link",tabIndex:0,className:"text-primary cursor-pointer","data-testid":"inspect-link",onClick:()=>e({to:"/bundles/inspect"}),onKeyDown:Y=>{Y.key==="Enter"&&e({to:"/bundles/inspect"})},children:"Inspect a bundle first →"})]}),c.jsx("div",{className:"mt-spacing-4",children:c.jsx(we,{variant:"tactical",onClick:E,disabled:!l.trim(),"data-testid":"plan-btn",children:"PLAN"})})]})}),r==="planning"&&c.jsx("div",{"data-testid":"step-planning",className:"text-body-md text-foreground-muted",children:"Planning..."}),r==="planned"&&f&&c.jsx(zn,{title:"Plan Review",description:"Review requirement probe results and approve the install actions that bootstrap should execute.",children:c.jsxs("div",{"data-testid":"step-planned",children:[c.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"STAGES"}),c.jsx("div",{className:"space-y-spacing-1 mb-spacing-6","data-testid":"stage-list",children:f.stages.map(Y=>c.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"stage-row",children:[c.jsx("span",{className:Y.status==="ok"?"text-success":Y.status==="blocked"?"text-warning":"text-foreground-muted",children:Y.status.toUpperCase()}),c.jsx("span",{children:Y.stage})]},Y.stage))}),I.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"REQUIREMENTS"}),c.jsx("div",{className:"mb-spacing-6",children:c.jsx(RP,{results:I})})]}),M.length>0&&c.jsxs(c.Fragment,{children:[c.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"ACTIONS"}),c.jsx("div",{className:"space-y-spacing-1 mb-spacing-4",children:M.map(Y=>c.jsxs("label",{className:"flex items-center gap-spacing-3 text-label-sm font-mono cursor-pointer",children:[c.jsx("input",{type:"checkbox",checked:g||h.has(Y.key),disabled:g||Y.classification==="manual_only",onChange:B=>{const V=new Set(h);B.target.checked?V.add(Y.key):V.delete(Y.key),v(V)}}),c.jsx("span",{className:Y.classification==="manual_only"?"text-warning":"",children:Y.requirementName}),Y.commandPreview&&c.jsx("span",{className:"text-foreground-muted",children:Y.commandPreview})]},Y.key))}),c.jsxs("label",{className:"flex items-center gap-spacing-2 text-label-sm mb-spacing-4",children:[c.jsx("input",{type:"checkbox",checked:g,onChange:Y=>y(Y.target.checked)}),"Auto-approve all trusted actions"]})]}),q&&c.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&&c.jsx("div",{className:"mb-spacing-4",children:f.warnings.map((Y,B)=>c.jsx("div",{className:"text-warning text-label-sm",children:Y},B))}),c.jsx(we,{variant:"tactical",onClick:T,disabled:q||Q,title:q?"Manual requirements must be resolved":Q?"Select actions to approve":void 0,"data-testid":"apply-btn",children:"APPLY"})]})}),r==="applying"&&f&&c.jsx(zn,{title:"Applying",description:"Bootstrap is executing the approved actions and importing the rig.",children:c.jsxs("div",{"data-testid":"step-applying",children:[c.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"APPLYING"}),c.jsxs("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"applying-checklist",children:[f.stages.map(Y=>c.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[c.jsx("span",{className:"text-foreground-muted",children:"○"}),c.jsx("span",{children:Y.stage})]},Y.stage)),c.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[c.jsx("span",{className:"text-foreground-muted",children:"○"}),c.jsx("span",{children:"execute_external_installs"})]}),c.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[c.jsx("span",{className:"text-foreground-muted",children:"○"}),c.jsx("span",{children:"install_packages"})]}),c.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono",children:[c.jsx("span",{className:"text-foreground-muted",children:"○"}),c.jsx("span",{children:"import_rig"})]})]}),c.jsx("p",{className:"text-body-sm text-foreground-muted",children:"Bootstrapping..."})]})}),r==="done"&&f&&c.jsx(zn,{title:"Result",description:"Bootstrap finished and returned the managed rig identity.",children:c.jsxs("div",{"data-testid":"step-done",children:[c.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:f.status==="completed"?"BOOTSTRAP COMPLETE":"BOOTSTRAP PARTIAL"}),c.jsxs("div",{className:"text-label-sm font-mono space-y-spacing-1 mb-spacing-4",children:[c.jsxs("div",{children:["Status: ",c.jsx("span",{className:f.status==="completed"?"text-success":"text-warning",children:f.status.toUpperCase()})]}),f.rigId&&c.jsxs("div",{"data-testid":"result-rig-id",children:["Rig: ",f.rigId]})]}),f.rigId&&c.jsx(we,{variant:"tactical","data-testid":"view-rig-btn",onClick:()=>e({to:"/rigs/$rigId",params:{rigId:f.rigId}}),children:"VIEW RIG"})]})}),r==="error"&&c.jsx(zn,{title:"Bootstrap Error",description:"Bootstrap could not complete. Fix the issue and retry the plan.",children:c.jsxs("div",{"data-testid":"step-error",children:[c.jsx("p",{className:"text-destructive text-body-md mb-spacing-4",children:b}),c.jsx(we,{variant:"tactical",onClick:_,"data-testid":"try-again-btn",children:"TRY AGAIN"})]})})]})})}function LP(){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 c.jsx(lt,{children:c.jsxs("div",{"data-testid":"agent-spec-validate-flow",className:"space-y-8",children:[c.jsx(Fn,{eyebrow:"Agent Spec Validation",title:"VALIDATE AGENT",description:"Check an AgentSpec before you use it in a rig."}),c.jsxs(zn,{title:"Agent YAML",description:"Paste or refine an AgentSpec draft, then validate it against the daemon contract.",children:[c.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"}),c.jsx("div",{className:"flex flex-wrap gap-2",children:c.jsx(we,{variant:"tactical","data-testid":"agent-spec-validate-btn",onClick:g,disabled:!l.trim()||f==="pending",children:f==="pending"?"VALIDATING...":"VALIDATE AGENTSPEC"})}),f==="valid"&&c.jsx(Kt,{className:"mt-spacing-1","data-testid":"agent-spec-valid",children:c.jsx(Xt,{className:"text-primary",children:"AgentSpec valid."})}),(f==="invalid"||f==="error")&&c.jsx(Kt,{className:"mt-spacing-1","data-testid":"agent-spec-invalid",children:c.jsx(Xt,{children:c.jsx("ul",{className:"list-disc pl-5",children:h.map(y=>c.jsx("li",{children:y},y))})})})]})]})})}async function zP(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 PP(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 OE(e){let t=0;for(let s=0;s<e.length;s++)t=(t<<5)-t+e.charCodeAt(s)|0;return t}function IP(e,t="draft"){return Rt({queryKey:["spec-review","rig",e?OE(e):null,t],queryFn:()=>zP(e,t),enabled:!!e})}function BP(e,t="draft"){return Rt({queryKey:["spec-review","agent",e?OE(e):null,t],queryFn:()=>PP(e,t),enabled:!!e})}const HP=160,UP=48,kS=200,$P=100;function qP(e){switch(e){case"claude-code":return"#d4c4a8";case"codex":return"#b8c9d4";case"terminal":return"#c4c4c4";default:return"#e0ddd4"}}function VP(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*kS,y:i})}),i+=$P;return s.forEach((l,d)=>{r.push({id:l.id,x:d*kS,y:i})}),r}function GP({graph:e,testId:t}){const s=e??{nodes:[],edges:[]},{nodes:r,edges:i}=j.useMemo(()=>{const l=VP(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:qP(h.runtime),border:"1px solid #8a8577",fontSize:11,fontFamily:"monospace",width:HP,height:UP}}}),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 c.jsx("div",{"data-testid":t??"spec-topology-preview",className:"w-full h-[400px] bg-stone-50 border border-stone-200",children:c.jsxs(SE,{nodes:r,edges:i,fitView:!0,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,proOptions:{hideAttribution:!0},children:[c.jsx(r6,{gap:20,size:.5,color:"#d4d0c8"}),c.jsx(jE,{showInteractive:!1})]})})}function DE({review:e,yaml:t,testIdPrefix:s="",yamlTestId:r,showEnvironmentTab:i,onMemberClick:l}){var S,w,N;const d=i&&!!(e!=null&&e.services),f=d?["topology","configuration","environment","yaml"]:["topology","configuration","yaml"],[m,h]=j.useState("topology"),v=(e==null?void 0:e.pods)??[],g=(e==null?void 0:e.nodes)??[],y=(e==null?void 0:e.edges)??[],b=s?`${s}-`:"";return c.jsxs(c.Fragment,{children:[c.jsx("div",{className:"flex gap-1 border-b border-stone-200",children:f.map(E=>c.jsx("button",{"data-testid":`${b}tab-${E}`,onClick:()=>h(E),className:`px-3 py-1.5 font-mono text-[10px] uppercase tracking-wider transition-colors ${m===E?"border-b-2 border-stone-900 text-stone-900 font-bold":"text-stone-500 hover:text-stone-700"}`,children:E},E))}),m==="topology"&&e&&c.jsx(GP,{graph:e.graph,testId:`${b}topology-preview`}),m==="configuration"&&e&&c.jsxs("div",{"data-testid":`${b}config-tables`,className:"space-y-4",children:[e.format==="pod_aware"&&v.map(E=>c.jsxs("div",{className:"border border-stone-200 p-3",children:[c.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:E.label??E.id}),c.jsxs("table",{className:"w-full font-mono text-[10px]",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[c.jsx("th",{className:"text-left py-1",children:"Member"}),c.jsx("th",{className:"text-left py-1",children:"Agent Ref"}),c.jsx("th",{className:"text-left py-1",children:"Runtime"}),c.jsx("th",{className:"text-left py-1",children:"Profile"})]})}),c.jsx("tbody",{children:E.members.map(T=>c.jsxs("tr",{className:"border-b border-stone-100",children:[c.jsx("td",{className:"py-1",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{children:T.id}),l&&c.jsx(we,{variant:"outline",size:"sm","data-testid":`${b}member-open-agent-${E.id}-${T.id}`,className:"h-6 px-2 font-mono text-[9px] uppercase tracking-[0.12em]",onClick:()=>l(E.id,T),children:"Agent Spec"})]})}),c.jsx("td",{className:"py-1 text-stone-600",children:T.agentRef}),c.jsx("td",{className:"py-1",children:T.runtime}),c.jsx("td",{className:"py-1 text-stone-500",children:T.profile??"—"})]},T.id))})]})]},E.id)),e.format==="legacy"&&g.length>0&&c.jsxs("div",{className:"border border-stone-200 p-3",children:[c.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Nodes"}),c.jsxs("table",{className:"w-full font-mono text-[10px]",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[c.jsx("th",{className:"text-left py-1",children:"ID"}),c.jsx("th",{className:"text-left py-1",children:"Runtime"}),c.jsx("th",{className:"text-left py-1",children:"Role"})]})}),c.jsx("tbody",{children:g.map(E=>c.jsxs("tr",{className:"border-b border-stone-100",children:[c.jsx("td",{className:"py-1",children:E.id}),c.jsx("td",{className:"py-1",children:E.runtime}),c.jsx("td",{className:"py-1 text-stone-500",children:E.role??"—"})]},E.id))})]})]}),y.length>0&&c.jsxs("div",{className:"border border-stone-200 p-3",children:[c.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:e.format==="pod_aware"?"Cross-Pod Edges":"Edges"}),c.jsxs("table",{className:"w-full font-mono text-[10px]",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-stone-200 text-stone-500",children:[c.jsx("th",{className:"text-left py-1",children:"From"}),c.jsx("th",{className:"text-left py-1",children:"To"}),c.jsx("th",{className:"text-left py-1",children:"Kind"})]})}),c.jsx("tbody",{children:y.map((E,T)=>c.jsxs("tr",{className:"border-b border-stone-100",children:[c.jsx("td",{className:"py-1",children:E.from}),c.jsx("td",{className:"py-1",children:E.to}),c.jsx("td",{className:"py-1 text-stone-500",children:E.kind})]},T))})]})]})]}),m==="environment"&&d&&(e==null?void 0:e.services)&&c.jsxs("div",{className:"space-y-4","data-testid":`${b}env-details`,children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Services"}),(S=e.services.composePreview)==null?void 0:S.services.map(E=>c.jsxs("div",{className:"flex items-center justify-between border border-stone-200 px-3 py-2",children:[c.jsx("span",{className:"font-mono text-[11px] text-stone-800",children:E.name}),E.image&&c.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:E.image})]},E.name))]}),e.services.waitFor.length>0&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Health Gates"}),e.services.waitFor.map((E,T)=>c.jsxs("div",{className:"font-mono text-[10px] text-stone-600 border border-stone-200 px-3 py-2",children:[E.url&&c.jsx("span",{children:E.url}),E.tcp&&c.jsxs("span",{children:["tcp: ",E.tcp]}),E.service&&c.jsxs("span",{children:["service: ",E.service,E.condition?` (${E.condition})`:""]})]},T))]}),e.services.surfaces&&c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"font-mono text-[8px] uppercase tracking-[0.16em] text-stone-500",children:"Surfaces"}),(w=e.services.surfaces.urls)==null?void 0:w.map(E=>c.jsxs("div",{className:"flex items-center justify-between border border-stone-200 px-3 py-2",children:[c.jsx("span",{className:"text-[11px] text-stone-800",children:E.name}),c.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:E.url})]},E.name)),(N=e.services.surfaces.commands)==null?void 0:N.map(E=>c.jsxs("div",{className:"flex items-center justify-between border border-stone-200 px-3 py-2",children:[c.jsx("span",{className:"text-[11px] text-stone-800",children:E.name}),c.jsx("span",{className:"font-mono text-[9px] text-stone-500",children:E.command})]},E.name))]})]}),m==="yaml"&&c.jsx(ME,{title:"YAML Preview",testId:r??`${b}spec-yaml`,children:t})]})}function YP(){const e=Wt(),{selectedRigDraft:t,currentRigDraft:s}=Co(),r=t??s,{data:i,isLoading:l,error:d}=IP((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?c.jsx(lt,{children:c.jsxs("div",{"data-testid":"rig-spec-review",className:"space-y-6",children:[c.jsx(Fn,{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:c.jsxs(c.Fragment,{children:[c.jsx(we,{variant:"outline",size:"sm",onClick:()=>e({to:"/import"}),children:"Open In Import"}),c.jsx(we,{variant:"outline",size:"sm",onClick:()=>e({to:"/bootstrap"}),children:"Bootstrap"})]})}),i&&c.jsxs(Cf,{children:[c.jsx(kt,{label:"Format",value:i.format==="pod_aware"?"Pod-Aware":"Legacy",testId:"rig-spec-summary-format"}),c.jsx(kt,{label:i.format==="pod_aware"?"Pods":"Nodes",value:i.format==="pod_aware"?f.length:m.length,testId:"rig-spec-summary-pods"}),c.jsx(kt,{label:"Members",value:i.format==="pod_aware"?f.reduce((v,g)=>v+g.members.length,0):m.length,testId:"rig-spec-summary-members"}),c.jsx(kt,{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&&c.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading review..."}),d&&c.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:d.message}),c.jsx(DE,{review:i,yaml:r.yaml,yamlTestId:"rig-spec-yaml"})]})}):c.jsx(lt,{children:c.jsxs("div",{"data-testid":"rig-spec-review-empty",className:"space-y-5",children:[c.jsx(Fn,{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."}),c.jsx(we,{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 c.jsxs(c.Fragment,{children:[r.length>0&&c.jsxs("div",{"data-testid":`${s}-profiles-section`,className:"border border-stone-200 p-3",children:[c.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Profiles"}),c.jsx("div",{className:"space-y-1",children:r.map(d=>c.jsxs("div",{className:"font-mono text-[10px] flex justify-between",children:[c.jsx("span",{className:"font-bold",children:d.name}),d.description&&c.jsx("span",{className:"text-stone-500",children:d.description})]},d.name))})]}),c.jsxs("div",{"data-testid":`${s}-resources-section`,className:"border border-stone-200 p-3",children:[c.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Resources"}),c.jsxs("div",{className:"space-y-2 font-mono text-[10px]",children:[i.skills.length>0&&c.jsxs("div",{children:[c.jsx("span",{className:"text-stone-500",children:"Skills:"})," ",i.skills.map((d,f)=>c.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&&c.jsxs("div",{children:[c.jsx("span",{className:"text-stone-500",children:"Guidance:"})," ",i.guidance.map((d,f)=>c.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&&c.jsxs("div",{children:[c.jsx("span",{className:"text-stone-500",children:"Hooks:"})," ",i.hooks.join(", ")]})]})]}),(l.files.length>0||l.actions.length>0)&&c.jsxs("div",{"data-testid":`${s}-startup-section`,className:"border border-stone-200 p-3",children:[c.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Startup"}),l.files.length>0&&c.jsxs("div",{className:"mb-2",children:[c.jsx("div",{className:"font-mono text-[9px] text-stone-500 uppercase mb-1",children:"Files"}),l.files.map((d,f)=>c.jsxs("div",{className:"font-mono text-[10px]",children:[d.path," ",d.required&&c.jsx("span",{className:"text-red-500 text-[8px]",children:"REQUIRED"})]},f))]}),l.actions.length>0&&c.jsxs("div",{children:[c.jsx("div",{className:"font-mono text-[9px] text-stone-500 uppercase mb-1",children:"Actions"}),l.actions.map((d,f)=>c.jsxs("div",{className:"font-mono text-[10px]",children:[c.jsxs("span",{className:"text-stone-500",children:[d.type,":"]})," ",d.value]},f))]})]}),c.jsx(ME,{title:"YAML Preview",testId:`${s}-spec-yaml`,children:t})]})}function QP(){const e=Wt(),{selectedAgentDraft:t,currentAgentDraft:s}=Co(),r=t??s,{data:i,isLoading:l,error:d}=BP((r==null?void 0:r.yaml)??null);return r?c.jsx(lt,{children:c.jsxs("div",{"data-testid":"agent-spec-review",className:"space-y-6",children:[c.jsx(Fn,{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:c.jsx(we,{variant:"outline",size:"sm",onClick:()=>e({to:"/agents/validate"}),children:"Open In Validate"})}),i&&c.jsxs(Cf,{children:[c.jsx(kt,{label:"Format",value:"AgentSpec",testId:"agent-spec-summary-format"}),c.jsx(kt,{label:"Version",value:i.version,testId:"agent-spec-summary-version"}),c.jsx(kt,{label:"Profiles",value:(i.profiles??[]).length,testId:"agent-spec-summary-profiles"}),c.jsx(kt,{label:"Skills",value:(i.resources??{skills:[]}).skills.length,testId:"agent-spec-summary-skills"})]}),l&&c.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading review..."}),d&&c.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:d.message}),c.jsx(v0,{review:i,yaml:r.yaml,testIdPrefix:"agent"})]})}):c.jsx(lt,{children:c.jsxs("div",{"data-testid":"agent-spec-review-empty",className:"space-y-5",children:[c.jsx(Fn,{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."}),c.jsx(we,{variant:"outline",size:"sm",onClick:()=>e({to:"/agents/validate"}),children:"Open Validate"})]})})}function FP(){return Ht({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 KP(){return Ht({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 XP(){var l,d;const[e,t]=j.useState(""),s=FP(),r=()=>{e.trim()&&s.mutate({bundlePath:e.trim()})},i=s.data;return c.jsx(lt,{children:c.jsxs("div",{"data-testid":"bundle-inspector",children:[c.jsx("h2",{className:"text-headline-lg uppercase mb-spacing-4",children:"INSPECT BUNDLE"}),c.jsxs("div",{className:"mb-spacing-4",children:[c.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"BUNDLE PATH"}),c.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"}),c.jsx(we,{variant:"tactical",onClick:r,disabled:!e.trim()||s.isPending,className:"mt-spacing-3","data-testid":"inspect-btn",children:s.isPending?"INSPECTING...":"INSPECT"})]}),s.isError&&c.jsx("div",{className:"text-destructive text-body-md mb-spacing-4","data-testid":"inspect-error",children:s.error.message}),i&&c.jsxs("div",{"data-testid":"inspect-result",children:[c.jsxs("div",{className:"card-dark p-spacing-4 mb-spacing-4","data-testid":"manifest-summary",children:[c.jsxs("div",{className:"flex items-center gap-spacing-2 mb-spacing-2",children:[c.jsx("h3",{className:"text-headline-md uppercase",children:i.manifest.name}),c.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]})]}),c.jsxs("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:["v",i.manifest.version]}),c.jsxs("div",{className:"text-label-sm font-mono text-foreground-muted-on-dark",children:["Spec: ",i.manifest.rigSpec]}),c.jsxs("div",{className:"mt-spacing-2 flex gap-spacing-3",children:[c.jsxs("span",{className:Re("text-label-sm",i.digestValid?"text-success":"text-destructive"),children:["DIGEST: ",i.digestValid?"VALID":"INVALID"]}),c.jsxs("span",{className:Re("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?c.jsxs(c.Fragment,{children:[c.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"AGENTS"}),c.jsx("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"agent-list",children:i.manifest.agents.map(f=>c.jsxs("div",{className:"text-label-sm font-mono","data-testid":"agent-entry",children:[f.name," v",f.version," — ",f.path]},f.name))})]}):c.jsxs(c.Fragment,{children:[c.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"PACKAGES"}),c.jsx("div",{className:"space-y-spacing-1 mb-spacing-4","data-testid":"package-list",children:(i.manifest.packages??[]).map(f=>c.jsxs("div",{className:"text-label-sm font-mono","data-testid":"package-entry",children:[f.name," v",f.version," — ",f.path]},f.name))})]}),i.integrityResult&&c.jsxs(c.Fragment,{children:[c.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"FILE INTEGRITY"}),c.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 c.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"file-row",children:[c.jsx("span",{className:Re("w-2 h-2",v==="OK"?"bg-success":"bg-destructive"),"data-testid":"file-dot"}),c.jsx("span",{children:f}),c.jsx("span",{className:"text-foreground-muted ml-auto",children:v})]},f)}),i.integrityResult.extra.map(f=>c.jsxs("div",{className:"flex items-center gap-spacing-3 text-label-sm font-mono","data-testid":"file-row",children:[c.jsx("span",{className:"w-2 h-2 bg-warning","data-testid":"file-dot"}),c.jsx("span",{children:f}),c.jsx("span",{className:"text-foreground-muted ml-auto",children:"EXTRA"})]},f))]})]}),c.jsx(we,{variant:"tactical","data-testid":"install-btn",onClick:()=>window.location.href=`/bundles/install?bundlePath=${encodeURIComponent(e)}`,children:"INSTALL THIS BUNDLE"})]})]})})}function ZP(){const e=Wt(),[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=KP(),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 c.jsx(lt,{children:c.jsxs("div",{"data-testid":"bundle-install-flow",children:[c.jsx("h2",{className:"text-headline-lg uppercase mb-spacing-4",children:"INSTALL BUNDLE"}),t==="enter"&&c.jsxs("div",{"data-testid":"step-enter",children:[c.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"BUNDLE PATH"}),c.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"}),c.jsx("label",{className:"text-label-md uppercase block mb-spacing-2",children:"TARGET ROOT"}),c.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"}),c.jsx(we,{variant:"tactical",onClick:b,disabled:!i.trim(),"data-testid":"plan-btn",children:"PLAN"})]}),t==="planning"&&c.jsx("div",{"data-testid":"step-planning",className:"text-foreground-muted",children:"Planning..."}),t==="planned"&&m&&c.jsxs("div",{"data-testid":"step-planned",children:[c.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"PLAN"}),c.jsx("div",{className:"space-y-spacing-1 mb-spacing-4",children:m.stages.map(w=>c.jsxs("div",{className:"text-label-sm font-mono",children:[c.jsx("span",{className:w.status==="ok"?"text-success":"text-foreground-muted",children:w.status.toUpperCase()})," ",w.stage]},w.stage))}),c.jsx(we,{variant:"tactical",onClick:S,disabled:!d.trim(),"data-testid":"apply-btn",children:"APPLY"})]}),t==="applying"&&c.jsx("div",{"data-testid":"step-applying",className:"text-foreground-muted",children:"Installing..."}),t==="done"&&m&&c.jsxs("div",{"data-testid":"step-done",children:[c.jsx("h3",{className:"text-headline-md uppercase mb-spacing-3",children:"COMPLETE"}),c.jsxs("div",{className:"text-label-sm font-mono",children:["Status: ",c.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"})?c.jsx("span",{className:"ml-spacing-2 text-primary","data-testid":"bundle-type-label",children:"Pod-aware bundle"}):c.jsx("span",{className:"ml-spacing-2 text-foreground-muted","data-testid":"bundle-type-label",children:"Legacy bundle"})]}),m.rigId&&c.jsxs("div",{className:"text-label-sm font-mono","data-testid":"result-rig-id",children:["Rig: ",m.rigId]}),m.rigId&&c.jsx(we,{variant:"tactical",className:"mt-spacing-3",onClick:()=>e({to:"/rigs/$rigId",params:{rigId:m.rigId}}),children:"VIEW RIG"})]}),t==="error"&&c.jsxs("div",{"data-testid":"step-error",children:[c.jsx("p",{className:"text-destructive text-body-md mb-spacing-4",children:v}),c.jsx(we,{variant:"tactical",onClick:()=>{s("enter"),g(null),y.reset()},"data-testid":"try-again-btn",children:"TRY AGAIN"})]})]})})}function WP(e){const t=[`Install and launch the "${e.name}" managed app using OpenRig.`,""];return e.summary&&t.push(`About: ${e.summary}`,""),t.push(`Source: ${e.sourcePath}`,"","Steps:",`1. Run: rig up ${e.name}`,"2. Monitor: rig ps --nodes","3. Check env: rig env status <rig-name>"),t.join(`
|
|
223
|
+
`)}function LE({sourcePath:e,sourceState:t}){return c.jsxs("div",{className:"font-mono text-[9px] text-stone-500","data-testid":"library-provenance",children:["Source: ",e," · ",t]})}function JP({review:e}){const t=Wt(),s=e.profiles??[],r=e.resources??{skills:[]};return c.jsx(lt,{children:c.jsxs("div",{"data-testid":"library-review-agent",className:"space-y-6",children:[c.jsx(Fn,{eyebrow:"Library — Agent Spec",title:e.name,description:e.description??"Agent spec from library.",actions:c.jsx(we,{variant:"outline",size:"sm",onClick:()=>t({to:"/agents/validate"}),children:"Validate"})}),c.jsx(LE,{sourcePath:e.sourcePath,sourceState:e.sourceState}),c.jsxs(Cf,{children:[c.jsx(kt,{label:"Format",value:"AgentSpec",testId:"lib-agent-format"}),c.jsx(kt,{label:"Version",value:e.version,testId:"lib-agent-version"}),c.jsx(kt,{label:"Profiles",value:s.length,testId:"lib-agent-profiles"}),c.jsx(kt,{label:"Skills",value:r.skills.length,testId:"lib-agent-skills"})]}),c.jsx(v0,{review:e,yaml:e.raw,testIdPrefix:"lib-agent"})]})})}function eI({review:e}){const t=Wt(),[s,r]=j.useState(!1),{data:i=[]}=Gg("agent");new Map(i.map(h=>[h.name,h]));const l=e.pods??[],d=e.nodes??[],f=e.edges??[],m=h=>{if(!h.startsWith("local:"))return null;const v=h.slice(6),y=`${e.sourcePath.replace(/\/[^/]+$/,"")}/${v}`.split("/"),b=[];for(const w of y)w===".."?b.pop():w!=="."&&w!==""&&b.push(w);const S="/"+b.join("/");return i.find(w=>w.sourcePath.startsWith(S+"/"))??null};return c.jsx(lt,{children:c.jsxs("div",{"data-testid":"library-review-rig",className:"space-y-6",children:[c.jsx(Fn,{eyebrow:e.services?"Library — Managed App":"Library — Rig Spec",title:e.name,description:e.summary??"Rig spec from library.",actions:c.jsxs("div",{className:"flex gap-2",children:[e.services&&c.jsx(we,{variant:"outline",size:"sm","data-testid":"copy-setup-prompt",onClick:()=>void(async()=>{await Qn(WP({name:e.name,summary:e.summary,sourcePath:e.sourcePath}))&&(r(!0),window.setTimeout(()=>r(!1),2e3))})(),children:s?"Copied":"Copy Setup Prompt"}),c.jsx(we,{variant:"outline",size:"sm",onClick:()=>t({to:"/import"}),children:"Import"})]})}),c.jsx(LE,{sourcePath:e.sourcePath,sourceState:e.sourceState}),c.jsxs(Cf,{children:[c.jsx(kt,{label:"Format",value:e.format==="pod_aware"?"Pod-Aware":"Legacy",testId:"lib-rig-format"}),e.services&&c.jsx(kt,{label:"Type",value:"Agent-Managed App",testId:"lib-rig-type"}),e.services&&l.length>0&&(()=>{const h=l.find(v=>v.members.some(g=>g.id==="specialist"));return h?c.jsx(kt,{label:"Specialist Agent",value:`${h.id}.specialist`,testId:"lib-rig-specialist"}):null})(),c.jsx(kt,{label:e.format==="pod_aware"?"Pods":"Nodes",value:e.format==="pod_aware"?l.length:d.length,testId:"lib-rig-pods"}),c.jsx(kt,{label:"Members",value:e.format==="pod_aware"?l.reduce((h,v)=>h+v.members.length,0):d.length,testId:"lib-rig-members"}),c.jsx(kt,{label:"Edges",value:f.length+(e.format==="pod_aware"?l.reduce((h,v)=>{var g;return h+(((g=v.edges)==null?void 0:g.length)??0)},0):0),testId:"lib-rig-edges"})]}),c.jsx(DE,{review:e,yaml:e.raw,testIdPrefix:"lib",yamlTestId:"lib-rig-yaml",showEnvironmentTab:!!e.services,onMemberClick:(h,v)=>{const g=m(v.agentRef);g&&t({to:"/specs/library/$entryId",params:{entryId:g.id}})}})]})})}function tI({entryId:e}){const t=Wt(),{data:s,isLoading:r,error:i}=Yg(e);return r?c.jsx(lt,{children:c.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading spec review..."})}):i||!s?c.jsx(lt,{children:c.jsxs("div",{"data-testid":"library-review-error",className:"space-y-4",children:[c.jsx(Fn,{eyebrow:"Library",title:"Spec Not Found",description:(i==null?void 0:i.message)??"Could not load spec."}),c.jsx(we,{variant:"outline",size:"sm",onClick:()=>t({to:"/specs"}),children:"Back to Specs"})]})}):s.kind==="agent"?c.jsx(JP,{review:s}):c.jsx(eI,{review:s})}function nI(e){if(!e)return null;const t=e.match(/^local:agents\/([^/]+)$/);return(t==null?void 0:t[1])??null}function sI({agentRef:e}){const t=nI(e),{data:s=[],isLoading:r}=Gg("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?c.jsx("div",{className:"p-4 font-mono text-[10px] text-stone-400",children:"Loading agent spec..."}):i.length===0?c.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?c.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"?c.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"}):c.jsx(v0,{review:d,yaml:d.raw,testIdPrefix:"live-agent"}):c.jsx("div",{"data-testid":"agent-spec-unavailable",className:"p-4 font-mono text-[10px] text-stone-400",children:"No agent spec available"})}function aI({rigId:e,logicalId:t}){const{data:s,isLoading:r,error:i}=ON(e,t),[l,d]=j.useState("identity"),f=s?s.nodeKind!=="infrastructure":!0,m=f?["identity","agent-spec","startup","transcript"]:["identity","startup","transcript"];return c.jsx(lt,{children:c.jsxs("div",{"data-testid":"live-node-details",className:"space-y-6",children:[c.jsx(Fn,{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)??ds(t)??fs((s==null?void 0:s.podId)??null)} / ${t}`}),r&&c.jsx("div",{className:"font-mono text-[10px] text-stone-400",children:"Loading..."}),i&&c.jsx("div",{className:"p-3 bg-red-50 border border-red-200 font-mono text-[10px] text-red-700",children:i.message}),c.jsx("div",{className:"flex gap-1 border-b border-stone-200",children:m.map(h=>c.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"&&c.jsx(DN,{peers:s.peers,edges:s.edges,transcript:s.transcript,compactSpec:s.compactSpec,contextUsage:s.contextUsage}),s&&l==="agent-spec"&&f&&c.jsx(sI,{agentRef:s.agentRef}),s&&l==="startup"&&c.jsx("div",{"data-testid":"live-startup-section",className:"space-y-4",children:s.startupFiles.length>0&&c.jsxs("div",{className:"border border-stone-200 p-3",children:[c.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Startup Files"}),s.startupFiles.map((h,v)=>c.jsxs("div",{className:"font-mono text-[10px]",children:[h.path," ",c.jsxs("span",{className:"text-stone-400",children:["(",h.deliveryHint,")"]}),h.required&&c.jsx("span",{className:"text-red-500 text-[8px] ml-1",children:"REQUIRED"})]},v))]})}),s&&l==="transcript"&&c.jsx("div",{"data-testid":"live-transcript-section",className:"space-y-4",children:s.transcript.enabled?c.jsxs("div",{className:"border border-stone-200 p-3",children:[c.jsx("div",{className:"font-mono text-xs font-bold mb-2",children:"Transcript"}),c.jsx("div",{className:"font-mono text-[10px] text-stone-700",children:s.transcript.path}),s.transcript.tailCommand&&c.jsx("code",{className:"block mt-1 font-mono text-[9px] text-stone-500 bg-stone-100 px-2 py-1",children:s.transcript.tailCommand})]}):c.jsx("div",{className:"font-mono text-[10px] text-stone-400 p-4",children:"Transcript capture not enabled"})})]})})}function rI(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 iI(e){switch(e){case"claude-code":return"Claude Code";case"codex":return"Codex";case"terminal":return"Terminal";default:return"Unknown"}}function oI(e){return`'${e.replace(/'/g,"'\\''")}'`}function lI(e){const t=e.tmuxWindow?`${e.tmuxSession}:${e.tmuxWindow}`:e.tmuxSession;return`tmux attach -t ${oI(t)}`}function OS({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 c.jsx("button",{type:"button","data-testid":r,onClick:()=>{f()},className:Re("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 cI({session:e,onAdopt:t}){return c.jsx("div",{"data-testid":"discovered-node",className:Re("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:c.jsxs("div",{className:"flex flex-col gap-spacing-3 lg:flex-row lg:items-center lg:justify-between",children:[c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-x-spacing-3 gap-y-spacing-1",children:[c.jsx("div",{"data-testid":"runtime-badge",className:Re("text-[10px] uppercase tracking-[0.08em]",rI(e.runtimeHint)),children:iI(e.runtimeHint)}),c.jsx("div",{"data-testid":"session-name",className:"font-mono text-[13px] leading-5 text-foreground",title:e.tmuxSession,children:e.tmuxSession}),e.confidence==="medium"?c.jsx("div",{"data-testid":"runtime-inferred-note",className:"text-[10px] uppercase tracking-[0.08em] text-foreground-muted",children:"runtime inferred"}):null]}),e.cwd?c.jsxs("div",{className:"mt-spacing-2 min-w-0",children:[c.jsx("div",{className:"text-[10px] uppercase tracking-[0.08em] text-foreground-muted",children:"cwd"}),c.jsx("div",{className:"font-mono text-[12px] leading-5 text-foreground-muted truncate",title:e.cwd,children:e.cwd})]}):null]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-spacing-2 lg:justify-end",children:[c.jsx(OS,{label:"copy tmux",activeLabel:"copied",testId:"copy-tmux-btn",onClick:async()=>await Qn(lI(e))}),e.cwd?c.jsx(OS,{label:"copy cwd",activeLabel:"copied",testId:"copy-cwd-btn",onClick:async()=>await Qn(e.cwd??"")}):null,c.jsx(we,{variant:"tactical",size:"sm","data-testid":"adopt-btn",onClick:()=>t(e.id),children:"ADOPT"})]})]})})}function uI(){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 c.jsxs("div",{className:"mt-spacing-4 border-t border-foreground/10 pt-spacing-4","data-testid":"generate-draft-section",children:[c.jsx(we,{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(`
|
|
224
|
+
`),d=l.filter(m=>m.startsWith("# WARNING:")).map(m=>m.replace(/^# WARNING:\s*/,"")),f=l.filter(m=>!m.startsWith("# WARNING:")).join(`
|
|
225
|
+
`).trim();return c.jsxs("div",{className:"relative",children:[d.length>0&&c.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)=>c.jsx("div",{className:"text-warning font-mono",children:m},h))}),c.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}),c.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 dI(){var T,_;const{data:e=[]}=Vg({status:"active",runtimeHint:["claude-code","codex"],minConfidence:"medium"}),t=LN(),{data:s=[]}=xc(),r=e4(),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,E=r.isPending;return c.jsx(lt,{children:c.jsxs("div",{"data-testid":"discovery-overlay",children:[c.jsxs("div",{children:[c.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:[c.jsxs("div",{className:"max-w-[620px]",children:[c.jsx("h2",{className:"text-headline-lg uppercase",children:"DISCOVERY"}),c.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."})]}),c.jsx(we,{variant:"ghost",size:"sm","data-testid":"scan-now-btn",disabled:t.isPending,onClick:()=>t.mutate(),children:t.isPending?"SCANNING...":"SCAN NOW"})]}),t.isError?c.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?c.jsx("div",{className:"py-spacing-8","data-testid":"discovery-empty",children:c.jsx("p",{className:"text-body-md text-foreground-muted",children:"No running Claude or Codex sessions are currently visible."})}):c.jsxs("div",{className:"mt-spacing-6 space-y-spacing-3","data-testid":"discovery-active-section",children:[c.jsxs("div",{className:"mb-spacing-2",children:[c.jsx("h3",{className:"text-headline-sm uppercase",children:"Running agents"}),c.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=>c.jsx(cI,{session:R,onAdopt:b},R.id))]}),c.jsx(uI,{})]}),c.jsx(Gd,{open:f,onOpenChange:m,children:c.jsxs(Fl,{"data-testid":"adopt-dialog",children:[c.jsxs(Kl,{children:[c.jsx(Zl,{className:"text-headline-md uppercase",children:"ADOPT SESSION"}),c.jsx(Wl,{children:"Bind this session to an existing logical node in the rig."})]}),c.jsxs("div",{className:"space-y-spacing-3",children:[c.jsxs("div",{children:[c.jsx("label",{className:"text-label-sm uppercase block mb-spacing-1",children:"RIG"}),c.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:[c.jsx("option",{value:"",children:"Select a rig..."}),s.map(R=>c.jsxs("option",{value:R.id,children:[R.name," (",R.nodeCount," nodes)"]},R.id))]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"text-label-sm uppercase block mb-spacing-1",children:"LOGICAL ID (required)"}),c.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"}),c.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&&c.jsx("p",{className:"text-destructive text-label-sm","data-testid":"adopt-error",children:N}),c.jsxs(Xl,{children:[c.jsx(we,{variant:"ghost",onClick:()=>m(!1),children:"CANCEL"}),c.jsx(we,{variant:"tactical",onClick:w,disabled:!h||!g.trim()||E,"data-testid":"adopt-confirm",children:E?"ADOPTING...":"ADOPT"})]})]})})]})})}const Dt=VR({component:()=>c.jsx(TT,{client:UT,children:c.jsx(R4,{children:c.jsx(mw,{})})})}),fI=Ot({getParentRoute:()=>Dt,path:"/",component:h0});function hI(){var r;const{rigId:e}=zE.useParams(),{data:t}=xc(),s=(r=t==null?void 0:t.find(i=>i.id===e))==null?void 0:r.name;return c.jsx("div",{className:"flex flex-col flex-1 h-full",children:c.jsx("div",{className:"flex-1 min-h-[400px] relative",children:c.jsx(W6,{rigId:e,rigName:s??null,showDiscovered:!1})})})}const zE=Ot({getParentRoute:()=>Dt,path:"/rigs/$rigId",component:hI}),mI=Ot({getParentRoute:()=>Dt,path:"/import",component:aP}),pI=Ot({getParentRoute:()=>Dt,path:"/packages",component:uP}),gI=Ot({getParentRoute:()=>Dt,path:"/packages/install",component:gP}),xI=Ot({getParentRoute:()=>Dt,path:"/bootstrap",component:DP}),yI=Ot({getParentRoute:()=>Dt,path:"/agents/validate",component:LP});function vI(){const{setSelection:e}=tr();return j.useEffect(()=>{e({type:"discovery"})},[e]),c.jsx(h0,{})}function bI(){const{setSelection:e}=tr();return j.useEffect(()=>{e({type:"specs"})},[e]),c.jsx(h0,{})}function SI(){const{setSelection:e}=tr();return j.useEffect(()=>{e({type:"specs"})},[e]),c.jsx(YP,{})}function wI(){const{setSelection:e}=tr();return j.useEffect(()=>{e({type:"specs"})},[e]),c.jsx(QP,{})}const NI=Ot({getParentRoute:()=>Dt,path:"/discovery",component:vI}),jI=Ot({getParentRoute:()=>Dt,path:"/specs",component:bI}),EI=Ot({getParentRoute:()=>Dt,path:"/specs/rig",component:SI}),CI=Ot({getParentRoute:()=>Dt,path:"/specs/agent",component:wI});function _I(){const{entryId:e}=PE.useParams(),{setSelection:t}=tr();return j.useEffect(()=>{t({type:"specs"})},[t]),c.jsx(tI,{entryId:e})}const PE=Ot({getParentRoute:()=>Dt,path:"/specs/library/$entryId",component:_I}),RI=Ot({getParentRoute:()=>Dt,path:"/discovery/inventory",component:dI}),TI=Ot({getParentRoute:()=>Dt,path:"/bundles/inspect",component:XP}),AI=Ot({getParentRoute:()=>Dt,path:"/bundles/install",component:ZP}),MI=Ot({getParentRoute:()=>Dt,path:"/packages/$packageId",component:EP}),IE=Ot({getParentRoute:()=>Dt,path:"/rigs/$rigId/nodes/$logicalId",component:()=>{const{rigId:e,logicalId:t}=IE.useParams();return c.jsx(aI,{rigId:e,logicalId:decodeURIComponent(t)})}}),kI=Dt.addChildren([fI,zE,mI,pI,gI,MI,xI,yI,jI,EI,CI,PE,NI,RI,TI,AI,IE]),OI=eT({routeTree:kI});function DI(){return c.jsx(sT,{router:OI})}const DS=document.getElementById("root");DS&&t_.createRoot(DS).render(c.jsx(j.StrictMode,{children:c.jsx(DI,{})}));
|