@agent-team-foundation/first-tree-hub 0.14.4 → 0.14.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap-BmeaRhRp.mjs +3 -0
- package/dist/{bootstrap-CQQGgIx1.mjs → bootstrap-CmkHQsnS.mjs} +24 -16
- package/dist/cli/index.mjs +6 -94
- package/dist/{dist-CrdnqZjv.mjs → feishu-BE7QRxnE.mjs} +170 -379
- package/dist/feishu-De9_bA91.mjs +3 -0
- package/dist/index.mjs +5 -12
- package/dist/saas-connect-CNY9Ve5V.mjs +13748 -0
- package/package.json +4 -12
- package/dist/chunk-BSw8zbkd.mjs +0 -37
- package/dist/client-BPRIfrOT-CoV_2o7e.mjs +0 -4230
- package/dist/client-CEdYVnoj-BGiGcJbH.mjs +0 -7
- package/dist/dist-LgF7LHpE.mjs +0 -430
- package/dist/drizzle/0000_shocking_darkhawk.sql +0 -92
- package/dist/drizzle/0001_v2_schema_updates.sql +0 -26
- package/dist/drizzle/0002_adapter_tables.sql +0 -64
- package/dist/drizzle/0003_feishu_adapter.sql +0 -21
- package/dist/drizzle/0004_adapter_refactor.sql +0 -13
- package/dist/drizzle/0005_delegate_mention.sql +0 -1
- package/dist/drizzle/0006_agent_tree_path.sql +0 -1
- package/dist/drizzle/0007_decouple_context_tree.sql +0 -2
- package/dist/drizzle/0008_uuid_identity.sql +0 -12
- package/dist/drizzle/0009_agent_runtime_m1.sql +0 -31
- package/dist/drizzle/0010_cloud_multi_tenancy.sql +0 -34
- package/dist/drizzle/0011_org_uuid_pk.sql +0 -22
- package/dist/drizzle/0012_session_level_state.sql +0 -19
- package/dist/drizzle/0013_hub_tasks.sql +0 -38
- package/dist/drizzle/0014_drop_task_fks.sql +0 -9
- package/dist/drizzle/0015_member_system.sql +0 -34
- package/dist/drizzle/0016_strange_havok.sql +0 -25
- package/dist/drizzle/0017_session_outputs_unique.sql +0 -1
- package/dist/drizzle/0018_agent_visibility.sql +0 -13
- package/dist/drizzle/0019_agent_configs.sql +0 -30
- package/dist/drizzle/0020_unified_user_token.sql +0 -154
- package/dist/drizzle/0021_drop_agents_profile.sql +0 -10
- package/dist/drizzle/0022_session_events.sql +0 -32
- package/dist/drizzle/0023_clients_org_scoping.sql +0 -40
- package/dist/drizzle/0024_display_name_not_null.sql +0 -31
- package/dist/drizzle/0025_inbox_silent_entries.sql +0 -53
- package/dist/drizzle/0026_saas_onboarding.sql +0 -153
- package/dist/drizzle/0027_runtime_provider.sql +0 -10
- package/dist/drizzle/0028_auth_identity_user_github_unique.sql +0 -12
- package/dist/drizzle/0029_direct_agent_only_mention_only.sql +0 -28
- package/dist/drizzle/0030_chat_first_workspace.sql +0 -129
- package/dist/drizzle/0031_drop_system_configs.sql +0 -11
- package/dist/drizzle/0032_organization_settings.sql +0 -36
- package/dist/drizzle/0033_onboarding_dismissed_at.sql +0 -13
- package/dist/drizzle/0034_pending_questions.sql +0 -34
- package/dist/drizzle/0035_drop_hub_tasks.sql +0 -7
- package/dist/drizzle/0036_github_entity_chat_mappings.sql +0 -47
- package/dist/drizzle/0037_github_app_installations.sql +0 -52
- package/dist/drizzle/0038_chat_membership_user_state.sql +0 -223
- package/dist/drizzle/0039_drop_chat_participants_subscriptions.sql +0 -26
- package/dist/drizzle/0040_chat_user_state_engagement.sql +0 -24
- package/dist/drizzle/0041_notifications_dedup_key.sql +0 -29
- package/dist/drizzle/0042_notifications_drop_legacy_types.sql +0 -36
- package/dist/drizzle/0043_onboarding_completed_at.sql +0 -32
- package/dist/drizzle/0044_agent_avatar_color.sql +0 -11
- package/dist/drizzle/0045_agent_avatar_image.sql +0 -17
- package/dist/drizzle/meta/0000_snapshot.json +0 -687
- package/dist/drizzle/meta/0001_snapshot.json +0 -687
- package/dist/drizzle/meta/0012_snapshot.json +0 -1451
- package/dist/drizzle/meta/0013_snapshot.json +0 -1771
- package/dist/drizzle/meta/0014_snapshot.json +0 -1717
- package/dist/drizzle/meta/0016_snapshot.json +0 -1917
- package/dist/drizzle/meta/0018_snapshot.json +0 -1938
- package/dist/drizzle/meta/_journal.json +0 -328
- package/dist/esm-iadMkGbV.mjs +0 -1516
- package/dist/execAsync-DUfRkc4a.mjs +0 -10
- package/dist/execAsync-YbEZSOYd.mjs +0 -10
- package/dist/feishu-DNoBroKK.mjs +0 -53
- package/dist/from-DQ7eNRwu.mjs +0 -3840
- package/dist/getMachineId-bsd-BmasEOJr.mjs +0 -27
- package/dist/getMachineId-bsd-Dh3h0DDE.mjs +0 -27
- package/dist/getMachineId-darwin-CuhM3hfZ.mjs +0 -24
- package/dist/getMachineId-darwin-D9wR0SLj.mjs +0 -24
- package/dist/getMachineId-linux-CYfb0oxZ.mjs +0 -20
- package/dist/getMachineId-linux-D8ZaSjAC.mjs +0 -20
- package/dist/getMachineId-unsupported-Cu3iisaD.mjs +0 -15
- package/dist/getMachineId-unsupported-DZqI4ZT5.mjs +0 -15
- package/dist/getMachineId-win-8ZJbtrdf.mjs +0 -26
- package/dist/getMachineId-win-DT-hqwVp.mjs +0 -26
- package/dist/invitation-C9m2gQx4-C_4f5VTs.mjs +0 -4
- package/dist/invitation-D_ENPHyj-5ETiae5r.mjs +0 -167
- package/dist/logger-core-BTmvdflj-DjW8FM4T.mjs +0 -146
- package/dist/multipart-parser-QRu3OKK4.mjs +0 -294
- package/dist/observability-BAScT_5S-BcW9HgkG.mjs +0 -96129
- package/dist/observability-eLA9iNK_.mjs +0 -5
- package/dist/saas-connect-Da55XxRX.mjs +0 -21635
- package/dist/src-DFlbpJfU.mjs +0 -1176
- package/dist/src-DNBS5Yjj.mjs +0 -735
- package/dist/uuid-DbS_4vFh-iFghv4zA.mjs +0 -129
- package/dist/web/assets/index-9wK0udbH.js +0 -416
- package/dist/web/assets/index-C7x7O7dG.js +0 -11
- package/dist/web/assets/index-DE7Q3QWE.css +0 -1
- package/dist/web/favicon.svg +0 -9
- package/dist/web/fonts/inter-latin-ext.woff2 +0 -0
- package/dist/web/fonts/inter-latin.woff2 +0 -0
- package/dist/web/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
- package/dist/web/fonts/jetbrains-mono-latin.woff2 +0 -0
- package/dist/web/index.html +0 -39
- /package/dist/{cli-fetch--tiwKm5S.mjs → cli-fetch-BGVItZxo.mjs} +0 -0
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
var AS=e=>{throw TypeError(e)};var Gp=(e,t,n)=>t.has(e)||AS("Cannot "+n);var $=(e,t,n)=>(Gp(e,t,"read from private field"),n?n.call(e):t.get(e)),Te=(e,t,n)=>t.has(e)?AS("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),je=(e,t,n,a)=>(Gp(e,t,"write to private field"),a?a.call(e,n):t.set(e,n),n),Ye=(e,t,n)=>(Gp(e,t,"access private method"),n);var df=(e,t,n,a)=>({set _(s){je(e,t,s,n)},get _(){return $(e,t,a)}});function uR(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const s in a)if(s!=="default"&&!(s in e)){const o=Object.getOwnPropertyDescriptor(a,s);o&&Object.defineProperty(e,s,o.get?o:{enumerable:!0,get:()=>a[s]})}}}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 s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function a(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();function oh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vp={exports:{}},Oc={};/**
|
|
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 RS;function dR(){if(RS)return Oc;RS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,s,o){var u=null;if(o!==void 0&&(u=""+o),s.key!==void 0&&(u=""+s.key),"key"in s){o={};for(var f in s)f!=="key"&&(o[f]=s[f])}else o=s;return s=o.ref,{$$typeof:e,type:a,key:u,ref:s!==void 0?s:null,props:o}}return Oc.Fragment=t,Oc.jsx=n,Oc.jsxs=n,Oc}var OS;function fR(){return OS||(OS=1,Vp.exports=dR()),Vp.exports}var l=fR(),Qp={exports:{}},Je={};/**
|
|
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 MS;function hR(){if(MS)return Je;MS=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),w=Symbol.iterator;function x(U){return U===null||typeof U!="object"?null:(U=w&&U[w]||U["@@iterator"],typeof U=="function"?U:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,j={};function E(U,P,_){this.props=U,this.context=P,this.refs=j,this.updater=_||k}E.prototype.isReactComponent={},E.prototype.setState=function(U,P){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,P,"setState")},E.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function O(){}O.prototype=E.prototype;function A(U,P,_){this.props=U,this.context=P,this.refs=j,this.updater=_||k}var D=A.prototype=new O;D.constructor=A,C(D,E.prototype),D.isPureReactComponent=!0;var z=Array.isArray;function R(){}var F={H:null,A:null,T:null,S:null},B=Object.prototype.hasOwnProperty;function ee(U,P,_){var V=_.ref;return{$$typeof:e,type:U,key:P,ref:V!==void 0?V:null,props:_}}function L(U,P){return ee(U.type,P,U.props)}function I(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function Q(U){var P={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(_){return P[_]})}var te=/\/+/g;function Y(U,P){return typeof U=="object"&&U!==null&&U.key!=null?Q(""+U.key):P.toString(36)}function X(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(R,R):(U.status="pending",U.then(function(P){U.status==="pending"&&(U.status="fulfilled",U.value=P)},function(P){U.status==="pending"&&(U.status="rejected",U.reason=P)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function G(U,P,_,V,H){var ae=typeof U;(ae==="undefined"||ae==="boolean")&&(U=null);var Se=!1;if(U===null)Se=!0;else switch(ae){case"bigint":case"string":case"number":Se=!0;break;case"object":switch(U.$$typeof){case e:case t:Se=!0;break;case p:return Se=U._init,G(Se(U._payload),P,_,V,H)}}if(Se)return H=H(U),Se=V===""?"."+Y(U,0):V,z(H)?(_="",Se!=null&&(_=Se.replace(te,"$&/")+"/"),G(H,P,_,"",function(Ge){return Ge})):H!=null&&(I(H)&&(H=L(H,_+(H.key==null||U&&U.key===H.key?"":(""+H.key).replace(te,"$&/")+"/")+Se)),P.push(H)),1;Se=0;var Ae=V===""?".":V+":";if(z(U))for(var Ee=0;Ee<U.length;Ee++)V=U[Ee],ae=Ae+Y(V,Ee),Se+=G(V,P,_,ae,H);else if(Ee=x(U),typeof Ee=="function")for(U=Ee.call(U),Ee=0;!(V=U.next()).done;)V=V.value,ae=Ae+Y(V,Ee++),Se+=G(V,P,_,ae,H);else if(ae==="object"){if(typeof U.then=="function")return G(X(U),P,_,V,H);throw P=String(U),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return Se}function se(U,P,_){if(U==null)return U;var V=[],H=0;return G(U,V,"","",function(ae){return P.call(_,ae,H++)}),V}function J(U){if(U._status===-1){var P=U._result;P=P(),P.then(function(_){(U._status===0||U._status===-1)&&(U._status=1,U._result=_)},function(_){(U._status===0||U._status===-1)&&(U._status=2,U._result=_)}),U._status===-1&&(U._status=0,U._result=P)}if(U._status===1)return U._result.default;throw U._result}var ve=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var P=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},M={map:se,forEach:function(U,P,_){se(U,function(){P.apply(this,arguments)},_)},count:function(U){var P=0;return se(U,function(){P++}),P},toArray:function(U){return se(U,function(P){return P})||[]},only:function(U){if(!I(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Je.Activity=g,Je.Children=M,Je.Component=E,Je.Fragment=n,Je.Profiler=s,Je.PureComponent=A,Je.StrictMode=a,Je.Suspense=m,Je.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=F,Je.__COMPILER_RUNTIME={__proto__:null,c:function(U){return F.H.useMemoCache(U)}},Je.cache=function(U){return function(){return U.apply(null,arguments)}},Je.cacheSignal=function(){return null},Je.cloneElement=function(U,P,_){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var V=C({},U.props),H=U.key;if(P!=null)for(ae in P.key!==void 0&&(H=""+P.key),P)!B.call(P,ae)||ae==="key"||ae==="__self"||ae==="__source"||ae==="ref"&&P.ref===void 0||(V[ae]=P[ae]);var ae=arguments.length-2;if(ae===1)V.children=_;else if(1<ae){for(var Se=Array(ae),Ae=0;Ae<ae;Ae++)Se[Ae]=arguments[Ae+2];V.children=Se}return ee(U.type,H,V)},Je.createContext=function(U){return U={$$typeof:u,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:o,_context:U},U},Je.createElement=function(U,P,_){var V,H={},ae=null;if(P!=null)for(V in P.key!==void 0&&(ae=""+P.key),P)B.call(P,V)&&V!=="key"&&V!=="__self"&&V!=="__source"&&(H[V]=P[V]);var Se=arguments.length-2;if(Se===1)H.children=_;else if(1<Se){for(var Ae=Array(Se),Ee=0;Ee<Se;Ee++)Ae[Ee]=arguments[Ee+2];H.children=Ae}if(U&&U.defaultProps)for(V in Se=U.defaultProps,Se)H[V]===void 0&&(H[V]=Se[V]);return ee(U,ae,H)},Je.createRef=function(){return{current:null}},Je.forwardRef=function(U){return{$$typeof:f,render:U}},Je.isValidElement=I,Je.lazy=function(U){return{$$typeof:p,_payload:{_status:-1,_result:U},_init:J}},Je.memo=function(U,P){return{$$typeof:h,type:U,compare:P===void 0?null:P}},Je.startTransition=function(U){var P=F.T,_={};F.T=_;try{var V=U(),H=F.S;H!==null&&H(_,V),typeof V=="object"&&V!==null&&typeof V.then=="function"&&V.then(R,ve)}catch(ae){ve(ae)}finally{P!==null&&_.types!==null&&(P.types=_.types),F.T=P}},Je.unstable_useCacheRefresh=function(){return F.H.useCacheRefresh()},Je.use=function(U){return F.H.use(U)},Je.useActionState=function(U,P,_){return F.H.useActionState(U,P,_)},Je.useCallback=function(U,P){return F.H.useCallback(U,P)},Je.useContext=function(U){return F.H.useContext(U)},Je.useDebugValue=function(){},Je.useDeferredValue=function(U,P){return F.H.useDeferredValue(U,P)},Je.useEffect=function(U,P){return F.H.useEffect(U,P)},Je.useEffectEvent=function(U){return F.H.useEffectEvent(U)},Je.useId=function(){return F.H.useId()},Je.useImperativeHandle=function(U,P,_){return F.H.useImperativeHandle(U,P,_)},Je.useInsertionEffect=function(U,P){return F.H.useInsertionEffect(U,P)},Je.useLayoutEffect=function(U,P){return F.H.useLayoutEffect(U,P)},Je.useMemo=function(U,P){return F.H.useMemo(U,P)},Je.useOptimistic=function(U,P){return F.H.useOptimistic(U,P)},Je.useReducer=function(U,P,_){return F.H.useReducer(U,P,_)},Je.useRef=function(U){return F.H.useRef(U)},Je.useState=function(U){return F.H.useState(U)},Je.useSyncExternalStore=function(U,P,_){return F.H.useSyncExternalStore(U,P,_)},Je.useTransition=function(){return F.H.useTransition()},Je.version="19.2.4",Je}var DS;function cv(){return DS||(DS=1,Qp.exports=hR()),Qp.exports}var b=cv();const mR=oh(b),uv=uR({__proto__:null,default:mR},[b]);var Kp={exports:{}},Mc={},Yp={exports:{}},Xp={};/**
|
|
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 zS;function pR(){return zS||(zS=1,(function(e){function t(G,se){var J=G.length;G.push(se);e:for(;0<J;){var ve=J-1>>>1,M=G[ve];if(0<s(M,se))G[ve]=se,G[J]=M,J=ve;else break e}}function n(G){return G.length===0?null:G[0]}function a(G){if(G.length===0)return null;var se=G[0],J=G.pop();if(J!==se){G[0]=J;e:for(var ve=0,M=G.length,U=M>>>1;ve<U;){var P=2*(ve+1)-1,_=G[P],V=P+1,H=G[V];if(0>s(_,J))V<M&&0>s(H,_)?(G[ve]=H,G[V]=J,ve=V):(G[ve]=_,G[P]=J,ve=P);else if(V<M&&0>s(H,J))G[ve]=H,G[V]=J,ve=V;else break e}}return se}function s(G,se){var J=G.sortIndex-se.sortIndex;return J!==0?J:G.id-se.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var m=[],h=[],p=1,g=null,w=3,x=!1,k=!1,C=!1,j=!1,E=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function D(G){for(var se=n(h);se!==null;){if(se.callback===null)a(h);else if(se.startTime<=G)a(h),se.sortIndex=se.expirationTime,t(m,se);else break;se=n(h)}}function z(G){if(C=!1,D(G),!k)if(n(m)!==null)k=!0,R||(R=!0,Q());else{var se=n(h);se!==null&&X(z,se.startTime-G)}}var R=!1,F=-1,B=5,ee=-1;function L(){return j?!0:!(e.unstable_now()-ee<B)}function I(){if(j=!1,R){var G=e.unstable_now();ee=G;var se=!0;try{e:{k=!1,C&&(C=!1,O(F),F=-1),x=!0;var J=w;try{t:{for(D(G),g=n(m);g!==null&&!(g.expirationTime>G&&L());){var ve=g.callback;if(typeof ve=="function"){g.callback=null,w=g.priorityLevel;var M=ve(g.expirationTime<=G);if(G=e.unstable_now(),typeof M=="function"){g.callback=M,D(G),se=!0;break t}g===n(m)&&a(m),D(G)}else a(m);g=n(m)}if(g!==null)se=!0;else{var U=n(h);U!==null&&X(z,U.startTime-G),se=!1}}break e}finally{g=null,w=J,x=!1}se=void 0}}finally{se?Q():R=!1}}}var Q;if(typeof A=="function")Q=function(){A(I)};else if(typeof MessageChannel<"u"){var te=new MessageChannel,Y=te.port2;te.port1.onmessage=I,Q=function(){Y.postMessage(null)}}else Q=function(){E(I,0)};function X(G,se){F=E(function(){G(e.unstable_now())},se)}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(G){G.callback=null},e.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):B=0<G?Math.floor(1e3/G):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_next=function(G){switch(w){case 1:case 2:case 3:var se=3;break;default:se=w}var J=w;w=se;try{return G()}finally{w=J}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(G,se){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var J=w;w=G;try{return se()}finally{w=J}},e.unstable_scheduleCallback=function(G,se,J){var ve=e.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?ve+J:ve):J=ve,G){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=J+M,G={id:p++,callback:se,priorityLevel:G,startTime:J,expirationTime:M,sortIndex:-1},J>ve?(G.sortIndex=J,t(h,G),n(m)===null&&G===n(h)&&(C?(O(F),F=-1):C=!0,X(z,J-ve))):(G.sortIndex=M,t(m,G),k||x||(k=!0,R||(R=!0,Q()))),G},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(G){var se=w;return function(){var J=w;w=se;try{return G.apply(this,arguments)}finally{w=J}}}})(Xp)),Xp}var IS;function gR(){return IS||(IS=1,Yp.exports=pR()),Yp.exports}var Wp={exports:{}},Jn={};/**
|
|
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 LS;function yR(){if(LS)return Jn;LS=1;var e=cv();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}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 n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function o(m,h,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:g==null?null:""+g,children:m,containerInfo:h,implementation:p}}var u=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 Jn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Jn.createPortal=function(m,h){var p=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 o(m,h,null,p)},Jn.flushSync=function(m){var h=u.T,p=a.p;try{if(u.T=null,a.p=2,m)return m()}finally{u.T=h,a.p=p,a.d.f()}},Jn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,a.d.C(m,h))},Jn.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Jn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var p=h.as,g=f(p,h.crossOrigin),w=typeof h.integrity=="string"?h.integrity:void 0,x=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?a.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:g,integrity:w,fetchPriority:x}):p==="script"&&a.d.X(m,{crossOrigin:g,integrity:w,fetchPriority:x,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Jn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=f(h.as,h.crossOrigin);a.d.M(m,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&a.d.M(m)},Jn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,g=f(p,h.crossOrigin);a.d.L(m,p,{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})}},Jn.preloadModule=function(m,h){if(typeof m=="string")if(h){var p=f(h.as,h.crossOrigin);a.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else a.d.m(m)},Jn.requestFormReset=function(m){a.d.r(m)},Jn.unstable_batchedUpdates=function(m,h){return m(h)},Jn.useFormState=function(m,h,p){return u.H.useFormState(m,h,p)},Jn.useFormStatus=function(){return u.H.useHostTransitionStatus()},Jn.version="19.2.4",Jn}var PS;function Wj(){if(PS)return Wp.exports;PS=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(),Wp.exports=yR(),Wp.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 US;function vR(){if(US)return Mc;US=1;var e=gR(),t=cv(),n=Wj();function a(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)i+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function o(r){var i=r,c=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(c=i.return),r=i.return;while(r)}return i.tag===3?c:null}function u(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function f(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function m(r){if(o(r)!==r)throw Error(a(188))}function h(r){var i=r.alternate;if(!i){if(i=o(r),i===null)throw Error(a(188));return i!==r?null:r}for(var c=r,d=i;;){var y=c.return;if(y===null)break;var v=y.alternate;if(v===null){if(d=y.return,d!==null){c=d;continue}break}if(y.child===v.child){for(v=y.child;v;){if(v===c)return m(y),r;if(v===d)return m(y),i;v=v.sibling}throw Error(a(188))}if(c.return!==d.return)c=y,d=v;else{for(var S=!1,T=y.child;T;){if(T===c){S=!0,c=y,d=v;break}if(T===d){S=!0,d=y,c=v;break}T=T.sibling}if(!S){for(T=v.child;T;){if(T===c){S=!0,c=v,d=y;break}if(T===d){S=!0,d=v,c=y;break}T=T.sibling}if(!S)throw Error(a(189))}}if(c.alternate!==d)throw Error(a(190))}if(c.tag!==3)throw Error(a(188));return c.stateNode.current===c?r:i}function p(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=p(r),i!==null)return i;r=r.sibling}return null}var g=Object.assign,w=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),A=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function Q(r){return r===null||typeof r!="object"?null:(r=I&&r[I]||r["@@iterator"],typeof r=="function"?r:null)}var te=Symbol.for("react.client.reference");function Y(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===te?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case C:return"Fragment";case E:return"Profiler";case j:return"StrictMode";case z:return"Suspense";case R:return"SuspenseList";case ee:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case k:return"Portal";case A:return r.displayName||"Context";case O:return(r._context.displayName||"Context")+".Consumer";case D:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case F:return i=r.displayName||null,i!==null?i:Y(r.type)||"Memo";case B:i=r._payload,r=r._init;try{return Y(r(i))}catch{}}return null}var X=Array.isArray,G=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},ve=[],M=-1;function U(r){return{current:r}}function P(r){0>M||(r.current=ve[M],ve[M]=null,M--)}function _(r,i){M++,ve[M]=r.current,r.current=i}var V=U(null),H=U(null),ae=U(null),Se=U(null);function Ae(r,i){switch(_(ae,i),_(H,r),_(V,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?Jw(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=Jw(i),r=eS(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}P(V),_(V,r)}function Ee(){P(V),P(H),P(ae)}function Ge(r){r.memoizedState!==null&&_(Se,r);var i=V.current,c=eS(i,r.type);i!==c&&(_(H,r),_(V,c))}function Fe(r){H.current===r&&(P(V),P(H)),Se.current===r&&(P(Se),_c._currentValue=J)}var Ve,st;function Nt(r){if(Ve===void 0)try{throw Error()}catch(c){var i=c.stack.trim().match(/\n( *(at )?)/);Ve=i&&i[1]||"",st=-1<c.stack.indexOf(`
|
|
42
|
-
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
-
`+Ve+r+st}var we=!1;function ze(r,i){if(!r||we)return"";we=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(ce){var oe=ce}Reflect.construct(r,[],pe)}else{try{pe.call()}catch(ce){oe=ce}r.call(pe.prototype)}}else{try{throw Error()}catch(ce){oe=ce}(pe=r())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(ce){if(ce&&oe&&typeof ce.stack=="string")return[ce.stack,oe.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var y=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");y&&y.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=d.DetermineComponentFrameRoot(),S=v[0],T=v[1];if(S&&T){var Z=S.split(`
|
|
44
|
-
`),ie=T.split(`
|
|
45
|
-
`);for(y=d=0;d<Z.length&&!Z[d].includes("DetermineComponentFrameRoot");)d++;for(;y<ie.length&&!ie[y].includes("DetermineComponentFrameRoot");)y++;if(d===Z.length||y===ie.length)for(d=Z.length-1,y=ie.length-1;1<=d&&0<=y&&Z[d]!==ie[y];)y--;for(;1<=d&&0<=y;d--,y--)if(Z[d]!==ie[y]){if(d!==1||y!==1)do if(d--,y--,0>y||Z[d]!==ie[y]){var de=`
|
|
46
|
-
`+Z[d].replace(" at new "," at ");return r.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",r.displayName)),de}while(1<=d&&0<=y);break}}}finally{we=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?Nt(c):""}function et(r,i){switch(r.tag){case 26:case 27:case 5:return Nt(r.type);case 16:return Nt("Lazy");case 13:return r.child!==i&&i!==null?Nt("Suspense Fallback"):Nt("Suspense");case 19:return Nt("SuspenseList");case 0:case 15:return ze(r.type,!1);case 11:return ze(r.type.render,!1);case 1:return ze(r.type,!0);case 31:return Nt("Activity");default:return""}}function Ct(r){try{var i="",c=null;do i+=et(r,c),c=r,r=r.return;while(r);return i}catch(d){return`
|
|
47
|
-
Error generating stack: `+d.message+`
|
|
48
|
-
`+d.stack}}var le=Object.prototype.hasOwnProperty,me=e.unstable_scheduleCallback,Pe=e.unstable_cancelCallback,qe=e.unstable_shouldYield,Gt=e.unstable_requestPaint,nt=e.unstable_now,An=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,be=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,Xe=e.unstable_LowPriority,wt=e.unstable_IdlePriority,Rn=e.log,gr=e.unstable_setDisableYieldValue,Yt=null,qt=null;function Bt(r){if(typeof Rn=="function"&&gr(r),qt&&typeof qt.setStrictMode=="function")try{qt.setStrictMode(Yt,r)}catch{}}var yt=Math.clz32?Math.clz32:Bo,yr=Math.log,$n=Math.LN2;function Bo(r){return r>>>=0,r===0?32:31-(yr(r)/$n|0)|0}var ja=256,lr=262144,ma=4194304;function Hn(r){var i=r&42;if(i!==0)return i;switch(r&-r){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 r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Pa(r,i,c){var d=r.pendingLanes;if(d===0)return 0;var y=0,v=r.suspendedLanes,S=r.pingedLanes;r=r.warmLanes;var T=d&134217727;return T!==0?(d=T&~v,d!==0?y=Hn(d):(S&=T,S!==0?y=Hn(S):c||(c=T&~r,c!==0&&(y=Hn(c))))):(T=d&~v,T!==0?y=Hn(T):S!==0?y=Hn(S):c||(c=d&~r,c!==0&&(y=Hn(c)))),y===0?0:i!==0&&i!==y&&(i&v)===0&&(v=y&-y,c=i&-i,v>=c||v===32&&(c&4194048)!==0)?i:y}function pa(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function rn(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+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 i+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 Qr(){var r=ma;return ma<<=1,(ma&62914560)===0&&(ma=4194304),r}function wi(r){for(var i=[],c=0;31>c;c++)i.push(r);return i}function ga(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Si(r,i,c,d,y,v){var S=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var T=r.entanglements,Z=r.expirationTimes,ie=r.hiddenUpdates;for(c=S&~c;0<c;){var de=31-yt(c),pe=1<<de;T[de]=0,Z[de]=-1;var oe=ie[de];if(oe!==null)for(ie[de]=null,de=0;de<oe.length;de++){var ce=oe[de];ce!==null&&(ce.lane&=-536870913)}c&=~pe}d!==0&&ki(r,d,0),v!==0&&y===0&&r.tag!==0&&(r.suspendedLanes|=v&~(S&~i))}function ki(r,i,c){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-yt(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|c&261930}function ji(r,i){var c=r.entangledLanes|=i;for(r=r.entanglements;c;){var d=31-yt(c),y=1<<d;y&i|r[d]&i&&(r[d]|=i),c&=~y}}function js(r,i){var c=i&-i;return c=(c&42)!==0?1:Ln(c),(c&(r.suspendedLanes|i))!==0?0:c}function Ln(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function vr(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Ci(){var r=se.p;return r!==0?r:(r=window.event,r===void 0?32:kS(r.type))}function Ei(r,i){var c=se.p;try{return se.p=r,i()}finally{se.p=c}}var ye=Math.random().toString(36).slice(2),Qe="__reactFiber$"+ye,vt="__reactProps$"+ye,qn="__reactContainer$"+ye,Ua="__reactEvents$"+ye,Fo="__reactListeners$"+ye,Yu="__reactHandles$"+ye,$o="__reactResources$"+ye,Ni="__reactMarker$"+ye;function $e(r){delete r[Qe],delete r[vt],delete r[Ua],delete r[Fo],delete r[Yu]}function q(r){var i=r[Qe];if(i)return i;for(var c=r.parentNode;c;){if(i=c[qn]||c[Qe]){if(c=i.alternate,i.child!==null||c!==null&&c.child!==null)for(r=lS(r);r!==null;){if(c=r[Qe])return c;r=lS(r)}return i}r=c,c=r.parentNode}return null}function ge(r){if(r=r[Qe]||r[qn]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function _e(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(a(33))}function _t(r){var i=r[$o];return i||(i=r[$o]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function St(r){r[Ni]=!0}var an=new Set,Zn={};function xn(r,i){Pn(r,i),Pn(r+"Capture",i)}function Pn(r,i){for(Zn[r]=i,r=0;r<i.length;r++)an.add(i[r])}var Ho=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]*$"),pn={},qo={};function Xu(r){return le.call(qo,r)?!0:le.call(pn,r)?!1:Ho.test(r)?qo[r]=!0:(pn[r]=!0,!1)}function Wu(r,i,c){if(Xu(i))if(c===null)r.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+c)}}function Ju(r,i,c){if(c===null)r.removeAttribute(i);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+c)}}function Ba(r,i,c,d){if(d===null)r.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(i,c,""+d)}}function Kr(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function Zb(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function rA(r,i,c){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,v=d.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return y.call(this)},set:function(S){c=""+S,v.call(this,S)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(S){c=""+S},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Uh(r){if(!r._valueTracker){var i=Zb(r)?"checked":"value";r._valueTracker=rA(r,i,""+r[i])}}function Gb(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var c=i.getValue(),d="";return r&&(d=Zb(r)?r.checked?"true":"false":r.value),r=d,r!==c?(i.setValue(r),!0):!1}function ed(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var aA=/[\n"\\]/g;function Yr(r){return r.replace(aA,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Bh(r,i,c,d,y,v,S,T){r.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?r.type=S:r.removeAttribute("type"),i!=null?S==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+Kr(i)):r.value!==""+Kr(i)&&(r.value=""+Kr(i)):S!=="submit"&&S!=="reset"||r.removeAttribute("value"),i!=null?Fh(r,S,Kr(i)):c!=null?Fh(r,S,Kr(c)):d!=null&&r.removeAttribute("value"),y==null&&v!=null&&(r.defaultChecked=!!v),y!=null&&(r.checked=y&&typeof y!="function"&&typeof y!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?r.name=""+Kr(T):r.removeAttribute("name")}function Vb(r,i,c,d,y,v,S,T){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(r.type=v),i!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||i!=null)){Uh(r);return}c=c!=null?""+Kr(c):"",i=i!=null?""+Kr(i):c,T||i===r.value||(r.value=i),r.defaultValue=i}d=d??y,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=T?r.checked:!!d,r.defaultChecked=!!d,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(r.name=S),Uh(r)}function Fh(r,i,c){i==="number"&&ed(r.ownerDocument)===r||r.defaultValue===""+c||(r.defaultValue=""+c)}function ul(r,i,c,d){if(r=r.options,i){i={};for(var y=0;y<c.length;y++)i["$"+c[y]]=!0;for(c=0;c<r.length;c++)y=i.hasOwnProperty("$"+r[c].value),r[c].selected!==y&&(r[c].selected=y),y&&d&&(r[c].defaultSelected=!0)}else{for(c=""+Kr(c),i=null,y=0;y<r.length;y++){if(r[y].value===c){r[y].selected=!0,d&&(r[y].defaultSelected=!0);return}i!==null||r[y].disabled||(i=r[y])}i!==null&&(i.selected=!0)}}function Qb(r,i,c){if(i!=null&&(i=""+Kr(i),i!==r.value&&(r.value=i),c==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=c!=null?""+Kr(c):""}function Kb(r,i,c,d){if(i==null){if(d!=null){if(c!=null)throw Error(a(92));if(X(d)){if(1<d.length)throw Error(a(93));d=d[0]}c=d}c==null&&(c=""),i=c}c=Kr(i),r.defaultValue=c,d=r.textContent,d===c&&d!==""&&d!==null&&(r.value=d),Uh(r)}function dl(r,i){if(i){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=i;return}}r.textContent=i}var iA=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 Yb(r,i,c){var d=i.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":d?r.setProperty(i,c):typeof c!="number"||c===0||iA.has(i)?i==="float"?r.cssFloat=c:r[i]=(""+c).trim():r[i]=c+"px"}function Xb(r,i,c){if(i!=null&&typeof i!="object")throw Error(a(62));if(r=r.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var y in i)d=i[y],i.hasOwnProperty(y)&&c[y]!==d&&Yb(r,y,d)}else for(var v in i)i.hasOwnProperty(v)&&Yb(r,v,i[v])}function $h(r){if(r.indexOf("-")===-1)return!1;switch(r){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 sA=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"]]),lA=/^[\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 td(r){return lA.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Fa(){}var Hh=null;function qh(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var fl=null,hl=null;function Wb(r){var i=ge(r);if(i&&(r=i.stateNode)){var c=r[vt]||null;e:switch(r=i.stateNode,i.type){case"input":if(Bh(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),i=c.name,c.type==="radio"&&i!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Yr(""+i)+'"][type="radio"]'),i=0;i<c.length;i++){var d=c[i];if(d!==r&&d.form===r.form){var y=d[vt]||null;if(!y)throw Error(a(90));Bh(d,y.value,y.defaultValue,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name)}}for(i=0;i<c.length;i++)d=c[i],d.form===r.form&&Gb(d)}break e;case"textarea":Qb(r,c.value,c.defaultValue);break e;case"select":i=c.value,i!=null&&ul(r,!!c.multiple,i,!1)}}}var Zh=!1;function Jb(r,i,c){if(Zh)return r(i,c);Zh=!0;try{var d=r(i);return d}finally{if(Zh=!1,(fl!==null||hl!==null)&&($d(),fl&&(i=fl,r=hl,hl=fl=null,Wb(i),r)))for(i=0;i<r.length;i++)Wb(r[i])}}function Zo(r,i){var c=r.stateNode;if(c===null)return null;var d=c[vt]||null;if(d===null)return null;c=d[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(a(231,i,typeof c));return c}var $a=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Gh=!1;if($a)try{var Go={};Object.defineProperty(Go,"passive",{get:function(){Gh=!0}}),window.addEventListener("test",Go,Go),window.removeEventListener("test",Go,Go)}catch{Gh=!1}var _i=null,Vh=null,nd=null;function ex(){if(nd)return nd;var r,i=Vh,c=i.length,d,y="value"in _i?_i.value:_i.textContent,v=y.length;for(r=0;r<c&&i[r]===y[r];r++);var S=c-r;for(d=1;d<=S&&i[c-d]===y[v-d];d++);return nd=y.slice(r,1<d?1-d:void 0)}function rd(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function ad(){return!0}function tx(){return!1}function br(r){function i(c,d,y,v,S){this._reactName=c,this._targetInst=y,this.type=d,this.nativeEvent=v,this.target=S,this.currentTarget=null;for(var T in r)r.hasOwnProperty(T)&&(c=r[T],this[T]=c?c(v):v[T]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?ad:tx,this.isPropagationStopped=tx,this}return g(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=ad)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=ad)},persist:function(){},isPersistent:ad}),i}var Cs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},id=br(Cs),Vo=g({},Cs,{view:0,detail:0}),oA=br(Vo),Qh,Kh,Qo,sd=g({},Vo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xh,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Qo&&(Qo&&r.type==="mousemove"?(Qh=r.screenX-Qo.screenX,Kh=r.screenY-Qo.screenY):Kh=Qh=0,Qo=r),Qh)},movementY:function(r){return"movementY"in r?r.movementY:Kh}}),nx=br(sd),cA=g({},sd,{dataTransfer:0}),uA=br(cA),dA=g({},Vo,{relatedTarget:0}),Yh=br(dA),fA=g({},Cs,{animationName:0,elapsedTime:0,pseudoElement:0}),hA=br(fA),mA=g({},Cs,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),pA=br(mA),gA=g({},Cs,{data:0}),rx=br(gA),yA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vA={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"},bA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xA(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=bA[r])?!!i[r]:!1}function Xh(){return xA}var wA=g({},Vo,{key:function(r){if(r.key){var i=yA[r.key]||r.key;if(i!=="Unidentified")return i}return r.type==="keypress"?(r=rd(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?vA[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xh,charCode:function(r){return r.type==="keypress"?rd(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?rd(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),SA=br(wA),kA=g({},sd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ax=br(kA),jA=g({},Vo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xh}),CA=br(jA),EA=g({},Cs,{propertyName:0,elapsedTime:0,pseudoElement:0}),NA=br(EA),_A=g({},sd,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),TA=br(_A),AA=g({},Cs,{newState:0,oldState:0}),RA=br(AA),OA=[9,13,27,32],Wh=$a&&"CompositionEvent"in window,Ko=null;$a&&"documentMode"in document&&(Ko=document.documentMode);var MA=$a&&"TextEvent"in window&&!Ko,ix=$a&&(!Wh||Ko&&8<Ko&&11>=Ko),sx=" ",lx=!1;function ox(r,i){switch(r){case"keyup":return OA.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function cx(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var ml=!1;function DA(r,i){switch(r){case"compositionend":return cx(i);case"keypress":return i.which!==32?null:(lx=!0,sx);case"textInput":return r=i.data,r===sx&&lx?null:r;default:return null}}function zA(r,i){if(ml)return r==="compositionend"||!Wh&&ox(r,i)?(r=ex(),nd=Vh=_i=null,ml=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return ix&&i.locale!=="ko"?null:i.data;default:return null}}var IA={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 ux(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!IA[r.type]:i==="textarea"}function dx(r,i,c,d){fl?hl?hl.push(d):hl=[d]:fl=d,i=Kd(i,"onChange"),0<i.length&&(c=new id("onChange","change",null,c,d),r.push({event:c,listeners:i}))}var Yo=null,Xo=null;function LA(r){Vw(r,0)}function ld(r){var i=_e(r);if(Gb(i))return r}function fx(r,i){if(r==="change")return i}var hx=!1;if($a){var Jh;if($a){var em="oninput"in document;if(!em){var mx=document.createElement("div");mx.setAttribute("oninput","return;"),em=typeof mx.oninput=="function"}Jh=em}else Jh=!1;hx=Jh&&(!document.documentMode||9<document.documentMode)}function px(){Yo&&(Yo.detachEvent("onpropertychange",gx),Xo=Yo=null)}function gx(r){if(r.propertyName==="value"&&ld(Xo)){var i=[];dx(i,Xo,r,qh(r)),Jb(LA,i)}}function PA(r,i,c){r==="focusin"?(px(),Yo=i,Xo=c,Yo.attachEvent("onpropertychange",gx)):r==="focusout"&&px()}function UA(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return ld(Xo)}function BA(r,i){if(r==="click")return ld(i)}function FA(r,i){if(r==="input"||r==="change")return ld(i)}function $A(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var zr=typeof Object.is=="function"?Object.is:$A;function Wo(r,i){if(zr(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var c=Object.keys(r),d=Object.keys(i);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var y=c[d];if(!le.call(i,y)||!zr(r[y],i[y]))return!1}return!0}function yx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function vx(r,i){var c=yx(r);r=0;for(var d;c;){if(c.nodeType===3){if(d=r+c.textContent.length,r<=i&&d>=i)return{node:c,offset:i-r};r=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=yx(c)}}function bx(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?bx(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function xx(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=ed(r.document);i instanceof r.HTMLIFrameElement;){try{var c=typeof i.contentWindow.location.href=="string"}catch{c=!1}if(c)r=i.contentWindow;else break;i=ed(r.document)}return i}function tm(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var HA=$a&&"documentMode"in document&&11>=document.documentMode,pl=null,nm=null,Jo=null,rm=!1;function wx(r,i,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;rm||pl==null||pl!==ed(d)||(d=pl,"selectionStart"in d&&tm(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Jo&&Wo(Jo,d)||(Jo=d,d=Kd(nm,"onSelect"),0<d.length&&(i=new id("onSelect","select",null,i,c),r.push({event:i,listeners:d}),i.target=pl)))}function Es(r,i){var c={};return c[r.toLowerCase()]=i.toLowerCase(),c["Webkit"+r]="webkit"+i,c["Moz"+r]="moz"+i,c}var gl={animationend:Es("Animation","AnimationEnd"),animationiteration:Es("Animation","AnimationIteration"),animationstart:Es("Animation","AnimationStart"),transitionrun:Es("Transition","TransitionRun"),transitionstart:Es("Transition","TransitionStart"),transitioncancel:Es("Transition","TransitionCancel"),transitionend:Es("Transition","TransitionEnd")},am={},Sx={};$a&&(Sx=document.createElement("div").style,"AnimationEvent"in window||(delete gl.animationend.animation,delete gl.animationiteration.animation,delete gl.animationstart.animation),"TransitionEvent"in window||delete gl.transitionend.transition);function Ns(r){if(am[r])return am[r];if(!gl[r])return r;var i=gl[r],c;for(c in i)if(i.hasOwnProperty(c)&&c in Sx)return am[r]=i[c];return r}var kx=Ns("animationend"),jx=Ns("animationiteration"),Cx=Ns("animationstart"),qA=Ns("transitionrun"),ZA=Ns("transitionstart"),GA=Ns("transitioncancel"),Ex=Ns("transitionend"),Nx=new Map,im="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(" ");im.push("scrollEnd");function ya(r,i){Nx.set(r,i),xn(i,[r])}var od=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Xr=[],yl=0,sm=0;function cd(){for(var r=yl,i=sm=yl=0;i<r;){var c=Xr[i];Xr[i++]=null;var d=Xr[i];Xr[i++]=null;var y=Xr[i];Xr[i++]=null;var v=Xr[i];if(Xr[i++]=null,d!==null&&y!==null){var S=d.pending;S===null?y.next=y:(y.next=S.next,S.next=y),d.pending=y}v!==0&&_x(c,y,v)}}function ud(r,i,c,d){Xr[yl++]=r,Xr[yl++]=i,Xr[yl++]=c,Xr[yl++]=d,sm|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function lm(r,i,c,d){return ud(r,i,c,d),dd(r)}function _s(r,i){return ud(r,null,null,i),dd(r)}function _x(r,i,c){r.lanes|=c;var d=r.alternate;d!==null&&(d.lanes|=c);for(var y=!1,v=r.return;v!==null;)v.childLanes|=c,d=v.alternate,d!==null&&(d.childLanes|=c),v.tag===22&&(r=v.stateNode,r===null||r._visibility&1||(y=!0)),r=v,v=v.return;return r.tag===3?(v=r.stateNode,y&&i!==null&&(y=31-yt(c),r=v.hiddenUpdates,d=r[y],d===null?r[y]=[i]:d.push(i),i.lane=c|536870912),v):null}function dd(r){if(50<wc)throw wc=0,gp=null,Error(a(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var vl={};function VA(r,i,c,d){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ir(r,i,c,d){return new VA(r,i,c,d)}function om(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ha(r,i){var c=r.alternate;return c===null?(c=Ir(r.tag,i,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=i,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&65011712,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,i=r.dependencies,c.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function Tx(r,i){r.flags&=65011714;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,i=c.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function fd(r,i,c,d,y,v){var S=0;if(d=r,typeof r=="function")om(r)&&(S=1);else if(typeof r=="string")S=W2(r,c,V.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case ee:return r=Ir(31,c,i,y),r.elementType=ee,r.lanes=v,r;case C:return Ts(c.children,y,v,i);case j:S=8,y|=24;break;case E:return r=Ir(12,c,i,y|2),r.elementType=E,r.lanes=v,r;case z:return r=Ir(13,c,i,y),r.elementType=z,r.lanes=v,r;case R:return r=Ir(19,c,i,y),r.elementType=R,r.lanes=v,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case A:S=10;break e;case O:S=9;break e;case D:S=11;break e;case F:S=14;break e;case B:S=16,d=null;break e}S=29,c=Error(a(130,r===null?"null":typeof r,"")),d=null}return i=Ir(S,c,i,y),i.elementType=r,i.type=d,i.lanes=v,i}function Ts(r,i,c,d){return r=Ir(7,r,d,i),r.lanes=c,r}function cm(r,i,c){return r=Ir(6,r,null,i),r.lanes=c,r}function Ax(r){var i=Ir(18,null,null,0);return i.stateNode=r,i}function um(r,i,c){return i=Ir(4,r.children!==null?r.children:[],r.key,i),i.lanes=c,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var Rx=new WeakMap;function Wr(r,i){if(typeof r=="object"&&r!==null){var c=Rx.get(r);return c!==void 0?c:(i={value:r,source:i,stack:Ct(i)},Rx.set(r,i),i)}return{value:r,source:i,stack:Ct(i)}}var bl=[],xl=0,hd=null,ec=0,Jr=[],ea=0,Ti=null,Ca=1,Ea="";function qa(r,i){bl[xl++]=ec,bl[xl++]=hd,hd=r,ec=i}function Ox(r,i,c){Jr[ea++]=Ca,Jr[ea++]=Ea,Jr[ea++]=Ti,Ti=r;var d=Ca;r=Ea;var y=32-yt(d)-1;d&=~(1<<y),c+=1;var v=32-yt(i)+y;if(30<v){var S=y-y%5;v=(d&(1<<S)-1).toString(32),d>>=S,y-=S,Ca=1<<32-yt(i)+y|c<<y|d,Ea=v+r}else Ca=1<<v|c<<y|d,Ea=r}function dm(r){r.return!==null&&(qa(r,1),Ox(r,1,0))}function fm(r){for(;r===hd;)hd=bl[--xl],bl[xl]=null,ec=bl[--xl],bl[xl]=null;for(;r===Ti;)Ti=Jr[--ea],Jr[ea]=null,Ea=Jr[--ea],Jr[ea]=null,Ca=Jr[--ea],Jr[ea]=null}function Mx(r,i){Jr[ea++]=Ca,Jr[ea++]=Ea,Jr[ea++]=Ti,Ca=i.id,Ea=i.overflow,Ti=r}var Gn=null,Vt=null,kt=!1,Ai=null,ta=!1,hm=Error(a(519));function Ri(r){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw tc(Wr(i,r)),hm}function Dx(r){var i=r.stateNode,c=r.type,d=r.memoizedProps;switch(i[Qe]=r,i[vt]=d,c){case"dialog":ht("cancel",i),ht("close",i);break;case"iframe":case"object":case"embed":ht("load",i);break;case"video":case"audio":for(c=0;c<kc.length;c++)ht(kc[c],i);break;case"source":ht("error",i);break;case"img":case"image":case"link":ht("error",i),ht("load",i);break;case"details":ht("toggle",i);break;case"input":ht("invalid",i),Vb(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ht("invalid",i);break;case"textarea":ht("invalid",i),Kb(i,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||i.textContent===""+c||d.suppressHydrationWarning===!0||Xw(i.textContent,c)?(d.popover!=null&&(ht("beforetoggle",i),ht("toggle",i)),d.onScroll!=null&&ht("scroll",i),d.onScrollEnd!=null&&ht("scrollend",i),d.onClick!=null&&(i.onclick=Fa),i=!0):i=!1,i||Ri(r,!0)}function zx(r){for(Gn=r.return;Gn;)switch(Gn.tag){case 5:case 31:case 13:ta=!1;return;case 27:case 3:ta=!0;return;default:Gn=Gn.return}}function wl(r){if(r!==Gn)return!1;if(!kt)return zx(r),kt=!0,!1;var i=r.tag,c;if((c=i!==3&&i!==27)&&((c=i===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||Rp(r.type,r.memoizedProps)),c=!c),c&&Vt&&Ri(r),zx(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Vt=sS(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(317));Vt=sS(r)}else i===27?(i=Vt,Zi(r.type)?(r=Ip,Ip=null,Vt=r):Vt=i):Vt=Gn?ra(r.stateNode.nextSibling):null;return!0}function As(){Vt=Gn=null,kt=!1}function mm(){var r=Ai;return r!==null&&(kr===null?kr=r:kr.push.apply(kr,r),Ai=null),r}function tc(r){Ai===null?Ai=[r]:Ai.push(r)}var pm=U(null),Rs=null,Za=null;function Oi(r,i,c){_(pm,i._currentValue),i._currentValue=c}function Ga(r){r._currentValue=pm.current,P(pm)}function gm(r,i,c){for(;r!==null;){var d=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),r===c)break;r=r.return}}function ym(r,i,c,d){var y=r.child;for(y!==null&&(y.return=r);y!==null;){var v=y.dependencies;if(v!==null){var S=y.child;v=v.firstContext;e:for(;v!==null;){var T=v;v=y;for(var Z=0;Z<i.length;Z++)if(T.context===i[Z]){v.lanes|=c,T=v.alternate,T!==null&&(T.lanes|=c),gm(v.return,c,r),d||(S=null);break e}v=T.next}}else if(y.tag===18){if(S=y.return,S===null)throw Error(a(341));S.lanes|=c,v=S.alternate,v!==null&&(v.lanes|=c),gm(S,c,r),S=null}else S=y.child;if(S!==null)S.return=y;else for(S=y;S!==null;){if(S===r){S=null;break}if(y=S.sibling,y!==null){y.return=S.return,S=y;break}S=S.return}y=S}}function Sl(r,i,c,d){r=null;for(var y=i,v=!1;y!==null;){if(!v){if((y.flags&524288)!==0)v=!0;else if((y.flags&262144)!==0)break}if(y.tag===10){var S=y.alternate;if(S===null)throw Error(a(387));if(S=S.memoizedProps,S!==null){var T=y.type;zr(y.pendingProps.value,S.value)||(r!==null?r.push(T):r=[T])}}else if(y===Se.current){if(S=y.alternate,S===null)throw Error(a(387));S.memoizedState.memoizedState!==y.memoizedState.memoizedState&&(r!==null?r.push(_c):r=[_c])}y=y.return}r!==null&&ym(i,r,c,d),i.flags|=262144}function md(r){for(r=r.firstContext;r!==null;){if(!zr(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Os(r){Rs=r,Za=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Vn(r){return Ix(Rs,r)}function pd(r,i){return Rs===null&&Os(r),Ix(r,i)}function Ix(r,i){var c=i._currentValue;if(i={context:i,memoizedValue:c,next:null},Za===null){if(r===null)throw Error(a(308));Za=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else Za=Za.next=i;return c}var QA=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(c,d){r.push(d)}};this.abort=function(){i.aborted=!0,r.forEach(function(c){return c()})}},KA=e.unstable_scheduleCallback,YA=e.unstable_NormalPriority,wn={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vm(){return{controller:new QA,data:new Map,refCount:0}}function nc(r){r.refCount--,r.refCount===0&&KA(YA,function(){r.controller.abort()})}var rc=null,bm=0,kl=0,jl=null;function XA(r,i){if(rc===null){var c=rc=[];bm=0,kl=Sp(),jl={status:"pending",value:void 0,then:function(d){c.push(d)}}}return bm++,i.then(Lx,Lx),i}function Lx(){if(--bm===0&&rc!==null){jl!==null&&(jl.status="fulfilled");var r=rc;rc=null,kl=0,jl=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function WA(r,i){var c=[],d={status:"pending",value:null,reason:null,then:function(y){c.push(y)}};return r.then(function(){d.status="fulfilled",d.value=i;for(var y=0;y<c.length;y++)(0,c[y])(i)},function(y){for(d.status="rejected",d.reason=y,y=0;y<c.length;y++)(0,c[y])(void 0)}),d}var Px=G.S;G.S=function(r,i){ww=nt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&XA(r,i),Px!==null&&Px(r,i)};var Ms=U(null);function xm(){var r=Ms.current;return r!==null?r:Ft.pooledCache}function gd(r,i){i===null?_(Ms,Ms.current):_(Ms,i.pool)}function Ux(){var r=xm();return r===null?null:{parent:wn._currentValue,pool:r}}var Cl=Error(a(460)),wm=Error(a(474)),yd=Error(a(542)),vd={then:function(){}};function Bx(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Fx(r,i,c){switch(c=r[c],c===void 0?r.push(i):c!==i&&(i.then(Fa,Fa),i=c),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Hx(r),r;default:if(typeof i.status=="string")i.then(Fa,Fa);else{if(r=Ft,r!==null&&100<r.shellSuspendCounter)throw Error(a(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var y=i;y.status="fulfilled",y.value=d}},function(d){if(i.status==="pending"){var y=i;y.status="rejected",y.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,Hx(r),r}throw zs=i,Cl}}function Ds(r){try{var i=r._init;return i(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(zs=c,Cl):c}}var zs=null;function $x(){if(zs===null)throw Error(a(459));var r=zs;return zs=null,r}function Hx(r){if(r===Cl||r===yd)throw Error(a(483))}var El=null,ac=0;function bd(r){var i=ac;return ac+=1,El===null&&(El=[]),Fx(El,r,i)}function ic(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function xd(r,i){throw i.$$typeof===w?Error(a(525)):(r=Object.prototype.toString.call(i),Error(a(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function qx(r){function i(W,K){if(r){var re=W.deletions;re===null?(W.deletions=[K],W.flags|=16):re.push(K)}}function c(W,K){if(!r)return null;for(;K!==null;)i(W,K),K=K.sibling;return null}function d(W){for(var K=new Map;W!==null;)W.key!==null?K.set(W.key,W):K.set(W.index,W),W=W.sibling;return K}function y(W,K){return W=Ha(W,K),W.index=0,W.sibling=null,W}function v(W,K,re){return W.index=re,r?(re=W.alternate,re!==null?(re=re.index,re<K?(W.flags|=67108866,K):re):(W.flags|=67108866,K)):(W.flags|=1048576,K)}function S(W){return r&&W.alternate===null&&(W.flags|=67108866),W}function T(W,K,re,he){return K===null||K.tag!==6?(K=cm(re,W.mode,he),K.return=W,K):(K=y(K,re),K.return=W,K)}function Z(W,K,re,he){var He=re.type;return He===C?de(W,K,re.props.children,he,re.key):K!==null&&(K.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===B&&Ds(He)===K.type)?(K=y(K,re.props),ic(K,re),K.return=W,K):(K=fd(re.type,re.key,re.props,null,W.mode,he),ic(K,re),K.return=W,K)}function ie(W,K,re,he){return K===null||K.tag!==4||K.stateNode.containerInfo!==re.containerInfo||K.stateNode.implementation!==re.implementation?(K=um(re,W.mode,he),K.return=W,K):(K=y(K,re.children||[]),K.return=W,K)}function de(W,K,re,he,He){return K===null||K.tag!==7?(K=Ts(re,W.mode,he,He),K.return=W,K):(K=y(K,re),K.return=W,K)}function pe(W,K,re){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=cm(""+K,W.mode,re),K.return=W,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case x:return re=fd(K.type,K.key,K.props,null,W.mode,re),ic(re,K),re.return=W,re;case k:return K=um(K,W.mode,re),K.return=W,K;case B:return K=Ds(K),pe(W,K,re)}if(X(K)||Q(K))return K=Ts(K,W.mode,re,null),K.return=W,K;if(typeof K.then=="function")return pe(W,bd(K),re);if(K.$$typeof===A)return pe(W,pd(W,K),re);xd(W,K)}return null}function oe(W,K,re,he){var He=K!==null?K.key:null;if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return He!==null?null:T(W,K,""+re,he);if(typeof re=="object"&&re!==null){switch(re.$$typeof){case x:return re.key===He?Z(W,K,re,he):null;case k:return re.key===He?ie(W,K,re,he):null;case B:return re=Ds(re),oe(W,K,re,he)}if(X(re)||Q(re))return He!==null?null:de(W,K,re,he,null);if(typeof re.then=="function")return oe(W,K,bd(re),he);if(re.$$typeof===A)return oe(W,K,pd(W,re),he);xd(W,re)}return null}function ce(W,K,re,he,He){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return W=W.get(re)||null,T(K,W,""+he,He);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case x:return W=W.get(he.key===null?re:he.key)||null,Z(K,W,he,He);case k:return W=W.get(he.key===null?re:he.key)||null,ie(K,W,he,He);case B:return he=Ds(he),ce(W,K,re,he,He)}if(X(he)||Q(he))return W=W.get(re)||null,de(K,W,he,He,null);if(typeof he.then=="function")return ce(W,K,re,bd(he),He);if(he.$$typeof===A)return ce(W,K,re,pd(K,he),He);xd(K,he)}return null}function Re(W,K,re,he){for(var He=null,Tt=null,Le=K,rt=K=0,xt=null;Le!==null&&rt<re.length;rt++){Le.index>rt?(xt=Le,Le=null):xt=Le.sibling;var At=oe(W,Le,re[rt],he);if(At===null){Le===null&&(Le=xt);break}r&&Le&&At.alternate===null&&i(W,Le),K=v(At,K,rt),Tt===null?He=At:Tt.sibling=At,Tt=At,Le=xt}if(rt===re.length)return c(W,Le),kt&&qa(W,rt),He;if(Le===null){for(;rt<re.length;rt++)Le=pe(W,re[rt],he),Le!==null&&(K=v(Le,K,rt),Tt===null?He=Le:Tt.sibling=Le,Tt=Le);return kt&&qa(W,rt),He}for(Le=d(Le);rt<re.length;rt++)xt=ce(Le,W,rt,re[rt],he),xt!==null&&(r&&xt.alternate!==null&&Le.delete(xt.key===null?rt:xt.key),K=v(xt,K,rt),Tt===null?He=xt:Tt.sibling=xt,Tt=xt);return r&&Le.forEach(function(Yi){return i(W,Yi)}),kt&&qa(W,rt),He}function Ke(W,K,re,he){if(re==null)throw Error(a(151));for(var He=null,Tt=null,Le=K,rt=K=0,xt=null,At=re.next();Le!==null&&!At.done;rt++,At=re.next()){Le.index>rt?(xt=Le,Le=null):xt=Le.sibling;var Yi=oe(W,Le,At.value,he);if(Yi===null){Le===null&&(Le=xt);break}r&&Le&&Yi.alternate===null&&i(W,Le),K=v(Yi,K,rt),Tt===null?He=Yi:Tt.sibling=Yi,Tt=Yi,Le=xt}if(At.done)return c(W,Le),kt&&qa(W,rt),He;if(Le===null){for(;!At.done;rt++,At=re.next())At=pe(W,At.value,he),At!==null&&(K=v(At,K,rt),Tt===null?He=At:Tt.sibling=At,Tt=At);return kt&&qa(W,rt),He}for(Le=d(Le);!At.done;rt++,At=re.next())At=ce(Le,W,rt,At.value,he),At!==null&&(r&&At.alternate!==null&&Le.delete(At.key===null?rt:At.key),K=v(At,K,rt),Tt===null?He=At:Tt.sibling=At,Tt=At);return r&&Le.forEach(function(cR){return i(W,cR)}),kt&&qa(W,rt),He}function Pt(W,K,re,he){if(typeof re=="object"&&re!==null&&re.type===C&&re.key===null&&(re=re.props.children),typeof re=="object"&&re!==null){switch(re.$$typeof){case x:e:{for(var He=re.key;K!==null;){if(K.key===He){if(He=re.type,He===C){if(K.tag===7){c(W,K.sibling),he=y(K,re.props.children),he.return=W,W=he;break e}}else if(K.elementType===He||typeof He=="object"&&He!==null&&He.$$typeof===B&&Ds(He)===K.type){c(W,K.sibling),he=y(K,re.props),ic(he,re),he.return=W,W=he;break e}c(W,K);break}else i(W,K);K=K.sibling}re.type===C?(he=Ts(re.props.children,W.mode,he,re.key),he.return=W,W=he):(he=fd(re.type,re.key,re.props,null,W.mode,he),ic(he,re),he.return=W,W=he)}return S(W);case k:e:{for(He=re.key;K!==null;){if(K.key===He)if(K.tag===4&&K.stateNode.containerInfo===re.containerInfo&&K.stateNode.implementation===re.implementation){c(W,K.sibling),he=y(K,re.children||[]),he.return=W,W=he;break e}else{c(W,K);break}else i(W,K);K=K.sibling}he=um(re,W.mode,he),he.return=W,W=he}return S(W);case B:return re=Ds(re),Pt(W,K,re,he)}if(X(re))return Re(W,K,re,he);if(Q(re)){if(He=Q(re),typeof He!="function")throw Error(a(150));return re=He.call(re),Ke(W,K,re,he)}if(typeof re.then=="function")return Pt(W,K,bd(re),he);if(re.$$typeof===A)return Pt(W,K,pd(W,re),he);xd(W,re)}return typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint"?(re=""+re,K!==null&&K.tag===6?(c(W,K.sibling),he=y(K,re),he.return=W,W=he):(c(W,K),he=cm(re,W.mode,he),he.return=W,W=he),S(W)):c(W,K)}return function(W,K,re,he){try{ac=0;var He=Pt(W,K,re,he);return El=null,He}catch(Le){if(Le===Cl||Le===yd)throw Le;var Tt=Ir(29,Le,null,W.mode);return Tt.lanes=he,Tt.return=W,Tt}finally{}}}var Is=qx(!0),Zx=qx(!1),Mi=!1;function Sm(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function km(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Di(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function zi(r,i,c){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(Rt&2)!==0){var y=d.pending;return y===null?i.next=i:(i.next=y.next,y.next=i),d.pending=i,i=dd(r),_x(r,null,c),i}return ud(r,d,i,c),dd(r)}function sc(r,i,c){if(i=i.updateQueue,i!==null&&(i=i.shared,(c&4194048)!==0)){var d=i.lanes;d&=r.pendingLanes,c|=d,i.lanes=c,ji(r,c)}}function jm(r,i){var c=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var y=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var S={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?y=v=S:v=v.next=S,c=c.next}while(c!==null);v===null?y=v=i:v=v.next=i}else y=v=i;c={baseState:d.baseState,firstBaseUpdate:y,lastBaseUpdate:v,shared:d.shared,callbacks:d.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=i:r.next=i,c.lastBaseUpdate=i}var Cm=!1;function lc(){if(Cm){var r=jl;if(r!==null)throw r}}function oc(r,i,c,d){Cm=!1;var y=r.updateQueue;Mi=!1;var v=y.firstBaseUpdate,S=y.lastBaseUpdate,T=y.shared.pending;if(T!==null){y.shared.pending=null;var Z=T,ie=Z.next;Z.next=null,S===null?v=ie:S.next=ie,S=Z;var de=r.alternate;de!==null&&(de=de.updateQueue,T=de.lastBaseUpdate,T!==S&&(T===null?de.firstBaseUpdate=ie:T.next=ie,de.lastBaseUpdate=Z))}if(v!==null){var pe=y.baseState;S=0,de=ie=Z=null,T=v;do{var oe=T.lane&-536870913,ce=oe!==T.lane;if(ce?(bt&oe)===oe:(d&oe)===oe){oe!==0&&oe===kl&&(Cm=!0),de!==null&&(de=de.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var Re=r,Ke=T;oe=i;var Pt=c;switch(Ke.tag){case 1:if(Re=Ke.payload,typeof Re=="function"){pe=Re.call(Pt,pe,oe);break e}pe=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=Ke.payload,oe=typeof Re=="function"?Re.call(Pt,pe,oe):Re,oe==null)break e;pe=g({},pe,oe);break e;case 2:Mi=!0}}oe=T.callback,oe!==null&&(r.flags|=64,ce&&(r.flags|=8192),ce=y.callbacks,ce===null?y.callbacks=[oe]:ce.push(oe))}else ce={lane:oe,tag:T.tag,payload:T.payload,callback:T.callback,next:null},de===null?(ie=de=ce,Z=pe):de=de.next=ce,S|=oe;if(T=T.next,T===null){if(T=y.shared.pending,T===null)break;ce=T,T=ce.next,ce.next=null,y.lastBaseUpdate=ce,y.shared.pending=null}}while(!0);de===null&&(Z=pe),y.baseState=Z,y.firstBaseUpdate=ie,y.lastBaseUpdate=de,v===null&&(y.shared.lanes=0),Bi|=S,r.lanes=S,r.memoizedState=pe}}function Gx(r,i){if(typeof r!="function")throw Error(a(191,r));r.call(i)}function Vx(r,i){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)Gx(c[r],i)}var Nl=U(null),wd=U(0);function Qx(r,i){r=ti,_(wd,r),_(Nl,i),ti=r|i.baseLanes}function Em(){_(wd,ti),_(Nl,Nl.current)}function Nm(){ti=wd.current,P(Nl),P(wd)}var Lr=U(null),na=null;function Ii(r){var i=r.alternate;_(gn,gn.current&1),_(Lr,r),na===null&&(i===null||Nl.current!==null||i.memoizedState!==null)&&(na=r)}function _m(r){_(gn,gn.current),_(Lr,r),na===null&&(na=r)}function Kx(r){r.tag===22?(_(gn,gn.current),_(Lr,r),na===null&&(na=r)):Li()}function Li(){_(gn,gn.current),_(Lr,Lr.current)}function Pr(r){P(Lr),na===r&&(na=null),P(gn)}var gn=U(0);function Sd(r){for(var i=r;i!==null;){if(i.tag===13){var c=i.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||Dp(c)||zp(c)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Va=0,tt=null,It=null,Sn=null,kd=!1,_l=!1,Ls=!1,jd=0,cc=0,Tl=null,JA=0;function on(){throw Error(a(321))}function Tm(r,i){if(i===null)return!1;for(var c=0;c<i.length&&c<r.length;c++)if(!zr(r[c],i[c]))return!1;return!0}function Am(r,i,c,d,y,v){return Va=v,tt=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,G.H=r===null||r.memoizedState===null?O0:Zm,Ls=!1,v=c(d,y),Ls=!1,_l&&(v=Xx(i,c,d,y)),Yx(r),v}function Yx(r){G.H=fc;var i=It!==null&&It.next!==null;if(Va=0,Sn=It=tt=null,kd=!1,cc=0,Tl=null,i)throw Error(a(300));r===null||kn||(r=r.dependencies,r!==null&&md(r)&&(kn=!0))}function Xx(r,i,c,d){tt=r;var y=0;do{if(_l&&(Tl=null),cc=0,_l=!1,25<=y)throw Error(a(301));if(y+=1,Sn=It=null,r.updateQueue!=null){var v=r.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}G.H=M0,v=i(c,d)}while(_l);return v}function e2(){var r=G.H,i=r.useState()[0];return i=typeof i.then=="function"?uc(i):i,r=r.useState()[0],(It!==null?It.memoizedState:null)!==r&&(tt.flags|=1024),i}function Rm(){var r=jd!==0;return jd=0,r}function Om(r,i,c){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~c}function Mm(r){if(kd){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}kd=!1}Va=0,Sn=It=tt=null,_l=!1,cc=jd=0,Tl=null}function or(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Sn===null?tt.memoizedState=Sn=r:Sn=Sn.next=r,Sn}function yn(){if(It===null){var r=tt.alternate;r=r!==null?r.memoizedState:null}else r=It.next;var i=Sn===null?tt.memoizedState:Sn.next;if(i!==null)Sn=i,It=r;else{if(r===null)throw tt.alternate===null?Error(a(467)):Error(a(310));It=r,r={memoizedState:It.memoizedState,baseState:It.baseState,baseQueue:It.baseQueue,queue:It.queue,next:null},Sn===null?tt.memoizedState=Sn=r:Sn=Sn.next=r}return Sn}function Cd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function uc(r){var i=cc;return cc+=1,Tl===null&&(Tl=[]),r=Fx(Tl,r,i),i=tt,(Sn===null?i.memoizedState:Sn.next)===null&&(i=i.alternate,G.H=i===null||i.memoizedState===null?O0:Zm),r}function Ed(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return uc(r);if(r.$$typeof===A)return Vn(r)}throw Error(a(438,String(r)))}function Dm(r){var i=null,c=tt.updateQueue;if(c!==null&&(i=c.memoCache),i==null){var d=tt.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(y){return y.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),c===null&&(c=Cd(),tt.updateQueue=c),c.memoCache=i,c=i.data[i.index],c===void 0)for(c=i.data[i.index]=Array(r),d=0;d<r;d++)c[d]=L;return i.index++,c}function Qa(r,i){return typeof i=="function"?i(r):i}function Nd(r){var i=yn();return zm(i,It,r)}function zm(r,i,c){var d=r.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=c;var y=r.baseQueue,v=d.pending;if(v!==null){if(y!==null){var S=y.next;y.next=v.next,v.next=S}i.baseQueue=y=v,d.pending=null}if(v=r.baseState,y===null)r.memoizedState=v;else{i=y.next;var T=S=null,Z=null,ie=i,de=!1;do{var pe=ie.lane&-536870913;if(pe!==ie.lane?(bt&pe)===pe:(Va&pe)===pe){var oe=ie.revertLane;if(oe===0)Z!==null&&(Z=Z.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),pe===kl&&(de=!0);else if((Va&oe)===oe){ie=ie.next,oe===kl&&(de=!0);continue}else pe={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},Z===null?(T=Z=pe,S=v):Z=Z.next=pe,tt.lanes|=oe,Bi|=oe;pe=ie.action,Ls&&c(v,pe),v=ie.hasEagerState?ie.eagerState:c(v,pe)}else oe={lane:pe,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},Z===null?(T=Z=oe,S=v):Z=Z.next=oe,tt.lanes|=pe,Bi|=pe;ie=ie.next}while(ie!==null&&ie!==i);if(Z===null?S=v:Z.next=T,!zr(v,r.memoizedState)&&(kn=!0,de&&(c=jl,c!==null)))throw c;r.memoizedState=v,r.baseState=S,r.baseQueue=Z,d.lastRenderedState=v}return y===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Im(r){var i=yn(),c=i.queue;if(c===null)throw Error(a(311));c.lastRenderedReducer=r;var d=c.dispatch,y=c.pending,v=i.memoizedState;if(y!==null){c.pending=null;var S=y=y.next;do v=r(v,S.action),S=S.next;while(S!==y);zr(v,i.memoizedState)||(kn=!0),i.memoizedState=v,i.baseQueue===null&&(i.baseState=v),c.lastRenderedState=v}return[v,d]}function Wx(r,i,c){var d=tt,y=yn(),v=kt;if(v){if(c===void 0)throw Error(a(407));c=c()}else c=i();var S=!zr((It||y).memoizedState,c);if(S&&(y.memoizedState=c,kn=!0),y=y.queue,Um(t0.bind(null,d,y,r),[r]),y.getSnapshot!==i||S||Sn!==null&&Sn.memoizedState.tag&1){if(d.flags|=2048,Al(9,{destroy:void 0},e0.bind(null,d,y,c,i),null),Ft===null)throw Error(a(349));v||(Va&127)!==0||Jx(d,i,c)}return c}function Jx(r,i,c){r.flags|=16384,r={getSnapshot:i,value:c},i=tt.updateQueue,i===null?(i=Cd(),tt.updateQueue=i,i.stores=[r]):(c=i.stores,c===null?i.stores=[r]:c.push(r))}function e0(r,i,c,d){i.value=c,i.getSnapshot=d,n0(i)&&r0(r)}function t0(r,i,c){return c(function(){n0(i)&&r0(r)})}function n0(r){var i=r.getSnapshot;r=r.value;try{var c=i();return!zr(r,c)}catch{return!0}}function r0(r){var i=_s(r,2);i!==null&&jr(i,r,2)}function Lm(r){var i=or();if(typeof r=="function"){var c=r;if(r=c(),Ls){Bt(!0);try{c()}finally{Bt(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:r},i}function a0(r,i,c,d){return r.baseState=c,zm(r,It,typeof d=="function"?d:Qa)}function t2(r,i,c,d,y){if(Ad(r))throw Error(a(485));if(r=i.action,r!==null){var v={payload:y,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){v.listeners.push(S)}};G.T!==null?c(!0):v.isTransition=!1,d(v),c=i.pending,c===null?(v.next=i.pending=v,i0(i,v)):(v.next=c.next,i.pending=c.next=v)}}function i0(r,i){var c=i.action,d=i.payload,y=r.state;if(i.isTransition){var v=G.T,S={};G.T=S;try{var T=c(y,d),Z=G.S;Z!==null&&Z(S,T),s0(r,i,T)}catch(ie){Pm(r,i,ie)}finally{v!==null&&S.types!==null&&(v.types=S.types),G.T=v}}else try{v=c(y,d),s0(r,i,v)}catch(ie){Pm(r,i,ie)}}function s0(r,i,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){l0(r,i,d)},function(d){return Pm(r,i,d)}):l0(r,i,c)}function l0(r,i,c){i.status="fulfilled",i.value=c,o0(i),r.state=c,i=r.pending,i!==null&&(c=i.next,c===i?r.pending=null:(c=c.next,i.next=c,i0(r,c)))}function Pm(r,i,c){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=c,o0(i),i=i.next;while(i!==d)}r.action=null}function o0(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function c0(r,i){return i}function u0(r,i){if(kt){var c=Ft.formState;if(c!==null){e:{var d=tt;if(kt){if(Vt){t:{for(var y=Vt,v=ta;y.nodeType!==8;){if(!v){y=null;break t}if(y=ra(y.nextSibling),y===null){y=null;break t}}v=y.data,y=v==="F!"||v==="F"?y:null}if(y){Vt=ra(y.nextSibling),d=y.data==="F!";break e}}Ri(d)}d=!1}d&&(i=c[0])}}return c=or(),c.memoizedState=c.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:c0,lastRenderedState:i},c.queue=d,c=T0.bind(null,tt,d),d.dispatch=c,d=Lm(!1),v=qm.bind(null,tt,!1,d.queue),d=or(),y={state:i,dispatch:null,action:r,pending:null},d.queue=y,c=t2.bind(null,tt,y,v,c),y.dispatch=c,d.memoizedState=r,[i,c,!1]}function d0(r){var i=yn();return f0(i,It,r)}function f0(r,i,c){if(i=zm(r,i,c0)[0],r=Nd(Qa)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=uc(i)}catch(S){throw S===Cl?yd:S}else d=i;i=yn();var y=i.queue,v=y.dispatch;return c!==i.memoizedState&&(tt.flags|=2048,Al(9,{destroy:void 0},n2.bind(null,y,c),null)),[d,v,r]}function n2(r,i){r.action=i}function h0(r){var i=yn(),c=It;if(c!==null)return f0(i,c,r);yn(),i=i.memoizedState,c=yn();var d=c.queue.dispatch;return c.memoizedState=r,[i,d,!1]}function Al(r,i,c,d){return r={tag:r,create:c,deps:d,inst:i,next:null},i=tt.updateQueue,i===null&&(i=Cd(),tt.updateQueue=i),c=i.lastEffect,c===null?i.lastEffect=r.next=r:(d=c.next,c.next=r,r.next=d,i.lastEffect=r),r}function m0(){return yn().memoizedState}function _d(r,i,c,d){var y=or();tt.flags|=r,y.memoizedState=Al(1|i,{destroy:void 0},c,d===void 0?null:d)}function Td(r,i,c,d){var y=yn();d=d===void 0?null:d;var v=y.memoizedState.inst;It!==null&&d!==null&&Tm(d,It.memoizedState.deps)?y.memoizedState=Al(i,v,c,d):(tt.flags|=r,y.memoizedState=Al(1|i,v,c,d))}function p0(r,i){_d(8390656,8,r,i)}function Um(r,i){Td(2048,8,r,i)}function r2(r){tt.flags|=4;var i=tt.updateQueue;if(i===null)i=Cd(),tt.updateQueue=i,i.events=[r];else{var c=i.events;c===null?i.events=[r]:c.push(r)}}function g0(r){var i=yn().memoizedState;return r2({ref:i,nextImpl:r}),function(){if((Rt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function y0(r,i){return Td(4,2,r,i)}function v0(r,i){return Td(4,4,r,i)}function b0(r,i){if(typeof i=="function"){r=r();var c=i(r);return function(){typeof c=="function"?c():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function x0(r,i,c){c=c!=null?c.concat([r]):null,Td(4,4,b0.bind(null,i,r),c)}function Bm(){}function w0(r,i){var c=yn();i=i===void 0?null:i;var d=c.memoizedState;return i!==null&&Tm(i,d[1])?d[0]:(c.memoizedState=[r,i],r)}function S0(r,i){var c=yn();i=i===void 0?null:i;var d=c.memoizedState;if(i!==null&&Tm(i,d[1]))return d[0];if(d=r(),Ls){Bt(!0);try{r()}finally{Bt(!1)}}return c.memoizedState=[d,i],d}function Fm(r,i,c){return c===void 0||(Va&1073741824)!==0&&(bt&261930)===0?r.memoizedState=i:(r.memoizedState=c,r=kw(),tt.lanes|=r,Bi|=r,c)}function k0(r,i,c,d){return zr(c,i)?c:Nl.current!==null?(r=Fm(r,c,d),zr(r,i)||(kn=!0),r):(Va&42)===0||(Va&1073741824)!==0&&(bt&261930)===0?(kn=!0,r.memoizedState=c):(r=kw(),tt.lanes|=r,Bi|=r,i)}function j0(r,i,c,d,y){var v=se.p;se.p=v!==0&&8>v?v:8;var S=G.T,T={};G.T=T,qm(r,!1,i,c);try{var Z=y(),ie=G.S;if(ie!==null&&ie(T,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var de=WA(Z,d);dc(r,i,de,Fr(r))}else dc(r,i,d,Fr(r))}catch(pe){dc(r,i,{then:function(){},status:"rejected",reason:pe},Fr())}finally{se.p=v,S!==null&&T.types!==null&&(S.types=T.types),G.T=S}}function a2(){}function $m(r,i,c,d){if(r.tag!==5)throw Error(a(476));var y=C0(r).queue;j0(r,y,i,J,c===null?a2:function(){return E0(r),c(d)})}function C0(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:J},next:null};var c={};return i.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Qa,lastRenderedState:c},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function E0(r){var i=C0(r);i.next===null&&(i=r.alternate.memoizedState),dc(r,i.next.queue,{},Fr())}function Hm(){return Vn(_c)}function N0(){return yn().memoizedState}function _0(){return yn().memoizedState}function i2(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var c=Fr();r=Di(c);var d=zi(i,r,c);d!==null&&(jr(d,i,c),sc(d,i,c)),i={cache:vm()},r.payload=i;return}i=i.return}}function s2(r,i,c){var d=Fr();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Ad(r)?A0(i,c):(c=lm(r,i,c,d),c!==null&&(jr(c,r,d),R0(c,i,d)))}function T0(r,i,c){var d=Fr();dc(r,i,c,d)}function dc(r,i,c,d){var y={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Ad(r))A0(i,y);else{var v=r.alternate;if(r.lanes===0&&(v===null||v.lanes===0)&&(v=i.lastRenderedReducer,v!==null))try{var S=i.lastRenderedState,T=v(S,c);if(y.hasEagerState=!0,y.eagerState=T,zr(T,S))return ud(r,i,y,0),Ft===null&&cd(),!1}catch{}finally{}if(c=lm(r,i,y,d),c!==null)return jr(c,r,d),R0(c,i,d),!0}return!1}function qm(r,i,c,d){if(d={lane:2,revertLane:Sp(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ad(r)){if(i)throw Error(a(479))}else i=lm(r,c,d,2),i!==null&&jr(i,r,2)}function Ad(r){var i=r.alternate;return r===tt||i!==null&&i===tt}function A0(r,i){_l=kd=!0;var c=r.pending;c===null?i.next=i:(i.next=c.next,c.next=i),r.pending=i}function R0(r,i,c){if((c&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,c|=d,i.lanes=c,ji(r,c)}}var fc={readContext:Vn,use:Ed,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useLayoutEffect:on,useInsertionEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useSyncExternalStore:on,useId:on,useHostTransitionStatus:on,useFormState:on,useActionState:on,useOptimistic:on,useMemoCache:on,useCacheRefresh:on};fc.useEffectEvent=on;var O0={readContext:Vn,use:Ed,useCallback:function(r,i){return or().memoizedState=[r,i===void 0?null:i],r},useContext:Vn,useEffect:p0,useImperativeHandle:function(r,i,c){c=c!=null?c.concat([r]):null,_d(4194308,4,b0.bind(null,i,r),c)},useLayoutEffect:function(r,i){return _d(4194308,4,r,i)},useInsertionEffect:function(r,i){_d(4,2,r,i)},useMemo:function(r,i){var c=or();i=i===void 0?null:i;var d=r();if(Ls){Bt(!0);try{r()}finally{Bt(!1)}}return c.memoizedState=[d,i],d},useReducer:function(r,i,c){var d=or();if(c!==void 0){var y=c(i);if(Ls){Bt(!0);try{c(i)}finally{Bt(!1)}}}else y=i;return d.memoizedState=d.baseState=y,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:y},d.queue=r,r=r.dispatch=s2.bind(null,tt,r),[d.memoizedState,r]},useRef:function(r){var i=or();return r={current:r},i.memoizedState=r},useState:function(r){r=Lm(r);var i=r.queue,c=T0.bind(null,tt,i);return i.dispatch=c,[r.memoizedState,c]},useDebugValue:Bm,useDeferredValue:function(r,i){var c=or();return Fm(c,r,i)},useTransition:function(){var r=Lm(!1);return r=j0.bind(null,tt,r.queue,!0,!1),or().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,c){var d=tt,y=or();if(kt){if(c===void 0)throw Error(a(407));c=c()}else{if(c=i(),Ft===null)throw Error(a(349));(bt&127)!==0||Jx(d,i,c)}y.memoizedState=c;var v={value:c,getSnapshot:i};return y.queue=v,p0(t0.bind(null,d,v,r),[r]),d.flags|=2048,Al(9,{destroy:void 0},e0.bind(null,d,v,c,i),null),c},useId:function(){var r=or(),i=Ft.identifierPrefix;if(kt){var c=Ea,d=Ca;c=(d&~(1<<32-yt(d)-1)).toString(32)+c,i="_"+i+"R_"+c,c=jd++,0<c&&(i+="H"+c.toString(32)),i+="_"}else c=JA++,i="_"+i+"r_"+c.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:Hm,useFormState:u0,useActionState:u0,useOptimistic:function(r){var i=or();i.memoizedState=i.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=c,i=qm.bind(null,tt,!0,c),c.dispatch=i,[r,i]},useMemoCache:Dm,useCacheRefresh:function(){return or().memoizedState=i2.bind(null,tt)},useEffectEvent:function(r){var i=or(),c={impl:r};return i.memoizedState=c,function(){if((Rt&2)!==0)throw Error(a(440));return c.impl.apply(void 0,arguments)}}},Zm={readContext:Vn,use:Ed,useCallback:w0,useContext:Vn,useEffect:Um,useImperativeHandle:x0,useInsertionEffect:y0,useLayoutEffect:v0,useMemo:S0,useReducer:Nd,useRef:m0,useState:function(){return Nd(Qa)},useDebugValue:Bm,useDeferredValue:function(r,i){var c=yn();return k0(c,It.memoizedState,r,i)},useTransition:function(){var r=Nd(Qa)[0],i=yn().memoizedState;return[typeof r=="boolean"?r:uc(r),i]},useSyncExternalStore:Wx,useId:N0,useHostTransitionStatus:Hm,useFormState:d0,useActionState:d0,useOptimistic:function(r,i){var c=yn();return a0(c,It,r,i)},useMemoCache:Dm,useCacheRefresh:_0};Zm.useEffectEvent=g0;var M0={readContext:Vn,use:Ed,useCallback:w0,useContext:Vn,useEffect:Um,useImperativeHandle:x0,useInsertionEffect:y0,useLayoutEffect:v0,useMemo:S0,useReducer:Im,useRef:m0,useState:function(){return Im(Qa)},useDebugValue:Bm,useDeferredValue:function(r,i){var c=yn();return It===null?Fm(c,r,i):k0(c,It.memoizedState,r,i)},useTransition:function(){var r=Im(Qa)[0],i=yn().memoizedState;return[typeof r=="boolean"?r:uc(r),i]},useSyncExternalStore:Wx,useId:N0,useHostTransitionStatus:Hm,useFormState:h0,useActionState:h0,useOptimistic:function(r,i){var c=yn();return It!==null?a0(c,It,r,i):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:Dm,useCacheRefresh:_0};M0.useEffectEvent=g0;function Gm(r,i,c,d){i=r.memoizedState,c=c(d,i),c=c==null?i:g({},i,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var Vm={enqueueSetState:function(r,i,c){r=r._reactInternals;var d=Fr(),y=Di(d);y.payload=i,c!=null&&(y.callback=c),i=zi(r,y,d),i!==null&&(jr(i,r,d),sc(i,r,d))},enqueueReplaceState:function(r,i,c){r=r._reactInternals;var d=Fr(),y=Di(d);y.tag=1,y.payload=i,c!=null&&(y.callback=c),i=zi(r,y,d),i!==null&&(jr(i,r,d),sc(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var c=Fr(),d=Di(c);d.tag=2,i!=null&&(d.callback=i),i=zi(r,d,c),i!==null&&(jr(i,r,c),sc(i,r,c))}};function D0(r,i,c,d,y,v,S){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,v,S):i.prototype&&i.prototype.isPureReactComponent?!Wo(c,d)||!Wo(y,v):!0}function z0(r,i,c,d){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(c,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(c,d),i.state!==r&&Vm.enqueueReplaceState(i,i.state,null)}function Ps(r,i){var c=i;if("ref"in i){c={};for(var d in i)d!=="ref"&&(c[d]=i[d])}if(r=r.defaultProps){c===i&&(c=g({},c));for(var y in r)c[y]===void 0&&(c[y]=r[y])}return c}function I0(r){od(r)}function L0(r){console.error(r)}function P0(r){od(r)}function Rd(r,i){try{var c=r.onUncaughtError;c(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function U0(r,i,c){try{var d=r.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(y){setTimeout(function(){throw y})}}function Qm(r,i,c){return c=Di(c),c.tag=3,c.payload={element:null},c.callback=function(){Rd(r,i)},c}function B0(r){return r=Di(r),r.tag=3,r}function F0(r,i,c,d){var y=c.type.getDerivedStateFromError;if(typeof y=="function"){var v=d.value;r.payload=function(){return y(v)},r.callback=function(){U0(i,c,d)}}var S=c.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(r.callback=function(){U0(i,c,d),typeof y!="function"&&(Fi===null?Fi=new Set([this]):Fi.add(this));var T=d.stack;this.componentDidCatch(d.value,{componentStack:T!==null?T:""})})}function l2(r,i,c,d,y){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=c.alternate,i!==null&&Sl(i,c,y,!0),c=Lr.current,c!==null){switch(c.tag){case 31:case 13:return na===null?Hd():c.alternate===null&&cn===0&&(cn=3),c.flags&=-257,c.flags|=65536,c.lanes=y,d===vd?c.flags|=16384:(i=c.updateQueue,i===null?c.updateQueue=new Set([d]):i.add(d),bp(r,d,y)),!1;case 22:return c.flags|=65536,d===vd?c.flags|=16384:(i=c.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=i):(c=i.retryQueue,c===null?i.retryQueue=new Set([d]):c.add(d)),bp(r,d,y)),!1}throw Error(a(435,c.tag))}return bp(r,d,y),Hd(),!1}if(kt)return i=Lr.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=y,d!==hm&&(r=Error(a(422),{cause:d}),tc(Wr(r,c)))):(d!==hm&&(i=Error(a(423),{cause:d}),tc(Wr(i,c))),r=r.current.alternate,r.flags|=65536,y&=-y,r.lanes|=y,d=Wr(d,c),y=Qm(r.stateNode,d,y),jm(r,y),cn!==4&&(cn=2)),!1;var v=Error(a(520),{cause:d});if(v=Wr(v,c),xc===null?xc=[v]:xc.push(v),cn!==4&&(cn=2),i===null)return!0;d=Wr(d,c),c=i;do{switch(c.tag){case 3:return c.flags|=65536,r=y&-y,c.lanes|=r,r=Qm(c.stateNode,d,r),jm(c,r),!1;case 1:if(i=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Fi===null||!Fi.has(v))))return c.flags|=65536,y&=-y,c.lanes|=y,y=B0(y),F0(y,r,c,d),jm(c,y),!1}c=c.return}while(c!==null);return!1}var Km=Error(a(461)),kn=!1;function Qn(r,i,c,d){i.child=r===null?Zx(i,null,c,d):Is(i,r.child,c,d)}function $0(r,i,c,d,y){c=c.render;var v=i.ref;if("ref"in d){var S={};for(var T in d)T!=="ref"&&(S[T]=d[T])}else S=d;return Os(i),d=Am(r,i,c,S,v,y),T=Rm(),r!==null&&!kn?(Om(r,i,y),Ka(r,i,y)):(kt&&T&&dm(i),i.flags|=1,Qn(r,i,d,y),i.child)}function H0(r,i,c,d,y){if(r===null){var v=c.type;return typeof v=="function"&&!om(v)&&v.defaultProps===void 0&&c.compare===null?(i.tag=15,i.type=v,q0(r,i,v,d,y)):(r=fd(c.type,null,d,i,i.mode,y),r.ref=i.ref,r.return=i,i.child=r)}if(v=r.child,!rp(r,y)){var S=v.memoizedProps;if(c=c.compare,c=c!==null?c:Wo,c(S,d)&&r.ref===i.ref)return Ka(r,i,y)}return i.flags|=1,r=Ha(v,d),r.ref=i.ref,r.return=i,i.child=r}function q0(r,i,c,d,y){if(r!==null){var v=r.memoizedProps;if(Wo(v,d)&&r.ref===i.ref)if(kn=!1,i.pendingProps=d=v,rp(r,y))(r.flags&131072)!==0&&(kn=!0);else return i.lanes=r.lanes,Ka(r,i,y)}return Ym(r,i,c,d,y)}function Z0(r,i,c,d){var y=d.children,v=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(v=v!==null?v.baseLanes|c:c,r!==null){for(d=i.child=r.child,y=0;d!==null;)y=y|d.lanes|d.childLanes,d=d.sibling;d=y&~v}else d=0,i.child=null;return G0(r,i,v,c,d)}if((c&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&gd(i,v!==null?v.cachePool:null),v!==null?Qx(i,v):Em(),Kx(i);else return d=i.lanes=536870912,G0(r,i,v!==null?v.baseLanes|c:c,c,d)}else v!==null?(gd(i,v.cachePool),Qx(i,v),Li(),i.memoizedState=null):(r!==null&&gd(i,null),Em(),Li());return Qn(r,i,y,c),i.child}function hc(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function G0(r,i,c,d,y){var v=xm();return v=v===null?null:{parent:wn._currentValue,pool:v},i.memoizedState={baseLanes:c,cachePool:v},r!==null&&gd(i,null),Em(),Kx(i),r!==null&&Sl(r,i,d,!0),i.childLanes=y,null}function Od(r,i){return i=Dd({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function V0(r,i,c){return Is(i,r.child,null,c),r=Od(i,i.pendingProps),r.flags|=2,Pr(i),i.memoizedState=null,r}function o2(r,i,c){var d=i.pendingProps,y=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(kt){if(d.mode==="hidden")return r=Od(i,d),i.lanes=536870912,hc(null,r);if(_m(i),(r=Vt)?(r=iS(r,ta),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Ti!==null?{id:Ca,overflow:Ea}:null,retryLane:536870912,hydrationErrors:null},c=Ax(r),c.return=i,i.child=c,Gn=i,Vt=null)):r=null,r===null)throw Ri(i);return i.lanes=536870912,null}return Od(i,d)}var v=r.memoizedState;if(v!==null){var S=v.dehydrated;if(_m(i),y)if(i.flags&256)i.flags&=-257,i=V0(r,i,c);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(a(558));else if(kn||Sl(r,i,c,!1),y=(c&r.childLanes)!==0,kn||y){if(d=Ft,d!==null&&(S=js(d,c),S!==0&&S!==v.retryLane))throw v.retryLane=S,_s(r,S),jr(d,r,S),Km;Hd(),i=V0(r,i,c)}else r=v.treeContext,Vt=ra(S.nextSibling),Gn=i,kt=!0,Ai=null,ta=!1,r!==null&&Mx(i,r),i=Od(i,d),i.flags|=4096;return i}return r=Ha(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function Md(r,i){var c=i.ref;if(c===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(a(284));(r===null||r.ref!==c)&&(i.flags|=4194816)}}function Ym(r,i,c,d,y){return Os(i),c=Am(r,i,c,d,void 0,y),d=Rm(),r!==null&&!kn?(Om(r,i,y),Ka(r,i,y)):(kt&&d&&dm(i),i.flags|=1,Qn(r,i,c,y),i.child)}function Q0(r,i,c,d,y,v){return Os(i),i.updateQueue=null,c=Xx(i,d,c,y),Yx(r),d=Rm(),r!==null&&!kn?(Om(r,i,v),Ka(r,i,v)):(kt&&d&&dm(i),i.flags|=1,Qn(r,i,c,v),i.child)}function K0(r,i,c,d,y){if(Os(i),i.stateNode===null){var v=vl,S=c.contextType;typeof S=="object"&&S!==null&&(v=Vn(S)),v=new c(d,v),i.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Vm,i.stateNode=v,v._reactInternals=i,v=i.stateNode,v.props=d,v.state=i.memoizedState,v.refs={},Sm(i),S=c.contextType,v.context=typeof S=="object"&&S!==null?Vn(S):vl,v.state=i.memoizedState,S=c.getDerivedStateFromProps,typeof S=="function"&&(Gm(i,c,S,d),v.state=i.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(S=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),S!==v.state&&Vm.enqueueReplaceState(v,v.state,null),oc(i,d,v,y),lc(),v.state=i.memoizedState),typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(r===null){v=i.stateNode;var T=i.memoizedProps,Z=Ps(c,T);v.props=Z;var ie=v.context,de=c.contextType;S=vl,typeof de=="object"&&de!==null&&(S=Vn(de));var pe=c.getDerivedStateFromProps;de=typeof pe=="function"||typeof v.getSnapshotBeforeUpdate=="function",T=i.pendingProps!==T,de||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(T||ie!==S)&&z0(i,v,d,S),Mi=!1;var oe=i.memoizedState;v.state=oe,oc(i,d,v,y),lc(),ie=i.memoizedState,T||oe!==ie||Mi?(typeof pe=="function"&&(Gm(i,c,pe,d),ie=i.memoizedState),(Z=Mi||D0(i,c,Z,d,oe,ie,S))?(de||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(i.flags|=4194308)):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=ie),v.props=d,v.state=ie,v.context=S,d=Z):(typeof v.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{v=i.stateNode,km(r,i),S=i.memoizedProps,de=Ps(c,S),v.props=de,pe=i.pendingProps,oe=v.context,ie=c.contextType,Z=vl,typeof ie=="object"&&ie!==null&&(Z=Vn(ie)),T=c.getDerivedStateFromProps,(ie=typeof T=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(S!==pe||oe!==Z)&&z0(i,v,d,Z),Mi=!1,oe=i.memoizedState,v.state=oe,oc(i,d,v,y),lc();var ce=i.memoizedState;S!==pe||oe!==ce||Mi||r!==null&&r.dependencies!==null&&md(r.dependencies)?(typeof T=="function"&&(Gm(i,c,T,d),ce=i.memoizedState),(de=Mi||D0(i,c,de,d,oe,ce,Z)||r!==null&&r.dependencies!==null&&md(r.dependencies))?(ie||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(d,ce,Z),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(d,ce,Z)),typeof v.componentDidUpdate=="function"&&(i.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof v.componentDidUpdate!="function"||S===r.memoizedProps&&oe===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===r.memoizedProps&&oe===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=ce),v.props=d,v.state=ce,v.context=Z,d=de):(typeof v.componentDidUpdate!="function"||S===r.memoizedProps&&oe===r.memoizedState||(i.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===r.memoizedProps&&oe===r.memoizedState||(i.flags|=1024),d=!1)}return v=d,Md(r,i),d=(i.flags&128)!==0,v||d?(v=i.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:v.render(),i.flags|=1,r!==null&&d?(i.child=Is(i,r.child,null,y),i.child=Is(i,null,c,y)):Qn(r,i,c,y),i.memoizedState=v.state,r=i.child):r=Ka(r,i,y),r}function Y0(r,i,c,d){return As(),i.flags|=256,Qn(r,i,c,d),i.child}var Xm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wm(r){return{baseLanes:r,cachePool:Ux()}}function Jm(r,i,c){return r=r!==null?r.childLanes&~c:0,i&&(r|=Br),r}function X0(r,i,c){var d=i.pendingProps,y=!1,v=(i.flags&128)!==0,S;if((S=v)||(S=r!==null&&r.memoizedState===null?!1:(gn.current&2)!==0),S&&(y=!0,i.flags&=-129),S=(i.flags&32)!==0,i.flags&=-33,r===null){if(kt){if(y?Ii(i):Li(),(r=Vt)?(r=iS(r,ta),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:Ti!==null?{id:Ca,overflow:Ea}:null,retryLane:536870912,hydrationErrors:null},c=Ax(r),c.return=i,i.child=c,Gn=i,Vt=null)):r=null,r===null)throw Ri(i);return zp(r)?i.lanes=32:i.lanes=536870912,null}var T=d.children;return d=d.fallback,y?(Li(),y=i.mode,T=Dd({mode:"hidden",children:T},y),d=Ts(d,y,c,null),T.return=i,d.return=i,T.sibling=d,i.child=T,d=i.child,d.memoizedState=Wm(c),d.childLanes=Jm(r,S,c),i.memoizedState=Xm,hc(null,d)):(Ii(i),ep(i,T))}var Z=r.memoizedState;if(Z!==null&&(T=Z.dehydrated,T!==null)){if(v)i.flags&256?(Ii(i),i.flags&=-257,i=tp(r,i,c)):i.memoizedState!==null?(Li(),i.child=r.child,i.flags|=128,i=null):(Li(),T=d.fallback,y=i.mode,d=Dd({mode:"visible",children:d.children},y),T=Ts(T,y,c,null),T.flags|=2,d.return=i,T.return=i,d.sibling=T,i.child=d,Is(i,r.child,null,c),d=i.child,d.memoizedState=Wm(c),d.childLanes=Jm(r,S,c),i.memoizedState=Xm,i=hc(null,d));else if(Ii(i),zp(T)){if(S=T.nextSibling&&T.nextSibling.dataset,S)var ie=S.dgst;S=ie,d=Error(a(419)),d.stack="",d.digest=S,tc({value:d,source:null,stack:null}),i=tp(r,i,c)}else if(kn||Sl(r,i,c,!1),S=(c&r.childLanes)!==0,kn||S){if(S=Ft,S!==null&&(d=js(S,c),d!==0&&d!==Z.retryLane))throw Z.retryLane=d,_s(r,d),jr(S,r,d),Km;Dp(T)||Hd(),i=tp(r,i,c)}else Dp(T)?(i.flags|=192,i.child=r.child,i=null):(r=Z.treeContext,Vt=ra(T.nextSibling),Gn=i,kt=!0,Ai=null,ta=!1,r!==null&&Mx(i,r),i=ep(i,d.children),i.flags|=4096);return i}return y?(Li(),T=d.fallback,y=i.mode,Z=r.child,ie=Z.sibling,d=Ha(Z,{mode:"hidden",children:d.children}),d.subtreeFlags=Z.subtreeFlags&65011712,ie!==null?T=Ha(ie,T):(T=Ts(T,y,c,null),T.flags|=2),T.return=i,d.return=i,d.sibling=T,i.child=d,hc(null,d),d=i.child,T=r.child.memoizedState,T===null?T=Wm(c):(y=T.cachePool,y!==null?(Z=wn._currentValue,y=y.parent!==Z?{parent:Z,pool:Z}:y):y=Ux(),T={baseLanes:T.baseLanes|c,cachePool:y}),d.memoizedState=T,d.childLanes=Jm(r,S,c),i.memoizedState=Xm,hc(r.child,d)):(Ii(i),c=r.child,r=c.sibling,c=Ha(c,{mode:"visible",children:d.children}),c.return=i,c.sibling=null,r!==null&&(S=i.deletions,S===null?(i.deletions=[r],i.flags|=16):S.push(r)),i.child=c,i.memoizedState=null,c)}function ep(r,i){return i=Dd({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Dd(r,i){return r=Ir(22,r,null,i),r.lanes=0,r}function tp(r,i,c){return Is(i,r.child,null,c),r=ep(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function W0(r,i,c){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),gm(r.return,i,c)}function np(r,i,c,d,y,v){var S=r.memoizedState;S===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:y,treeForkCount:v}:(S.isBackwards=i,S.rendering=null,S.renderingStartTime=0,S.last=d,S.tail=c,S.tailMode=y,S.treeForkCount=v)}function J0(r,i,c){var d=i.pendingProps,y=d.revealOrder,v=d.tail;d=d.children;var S=gn.current,T=(S&2)!==0;if(T?(S=S&1|2,i.flags|=128):S&=1,_(gn,S),Qn(r,i,d,c),d=kt?ec:0,!T&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&W0(r,c,i);else if(r.tag===19)W0(r,c,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(y){case"forwards":for(c=i.child,y=null;c!==null;)r=c.alternate,r!==null&&Sd(r)===null&&(y=c),c=c.sibling;c=y,c===null?(y=i.child,i.child=null):(y=c.sibling,c.sibling=null),np(i,!1,y,c,v,d);break;case"backwards":case"unstable_legacy-backwards":for(c=null,y=i.child,i.child=null;y!==null;){if(r=y.alternate,r!==null&&Sd(r)===null){i.child=y;break}r=y.sibling,y.sibling=c,c=y,y=r}np(i,!0,c,null,v,d);break;case"together":np(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Ka(r,i,c){if(r!==null&&(i.dependencies=r.dependencies),Bi|=i.lanes,(c&i.childLanes)===0)if(r!==null){if(Sl(r,i,c,!1),(c&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(a(153));if(i.child!==null){for(r=i.child,c=Ha(r,r.pendingProps),i.child=c,c.return=i;r.sibling!==null;)r=r.sibling,c=c.sibling=Ha(r,r.pendingProps),c.return=i;c.sibling=null}return i.child}function rp(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&md(r)))}function c2(r,i,c){switch(i.tag){case 3:Ae(i,i.stateNode.containerInfo),Oi(i,wn,r.memoizedState.cache),As();break;case 27:case 5:Ge(i);break;case 4:Ae(i,i.stateNode.containerInfo);break;case 10:Oi(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,_m(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(Ii(i),i.flags|=128,null):(c&i.child.childLanes)!==0?X0(r,i,c):(Ii(i),r=Ka(r,i,c),r!==null?r.sibling:null);Ii(i);break;case 19:var y=(r.flags&128)!==0;if(d=(c&i.childLanes)!==0,d||(Sl(r,i,c,!1),d=(c&i.childLanes)!==0),y){if(d)return J0(r,i,c);i.flags|=128}if(y=i.memoizedState,y!==null&&(y.rendering=null,y.tail=null,y.lastEffect=null),_(gn,gn.current),d)break;return null;case 22:return i.lanes=0,Z0(r,i,c,i.pendingProps);case 24:Oi(i,wn,r.memoizedState.cache)}return Ka(r,i,c)}function ew(r,i,c){if(r!==null)if(r.memoizedProps!==i.pendingProps)kn=!0;else{if(!rp(r,c)&&(i.flags&128)===0)return kn=!1,c2(r,i,c);kn=(r.flags&131072)!==0}else kn=!1,kt&&(i.flags&1048576)!==0&&Ox(i,ec,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Ds(i.elementType),i.type=r,typeof r=="function")om(r)?(d=Ps(r,d),i.tag=1,i=K0(null,i,r,d,c)):(i.tag=0,i=Ym(null,i,r,d,c));else{if(r!=null){var y=r.$$typeof;if(y===D){i.tag=11,i=$0(null,i,r,d,c);break e}else if(y===F){i.tag=14,i=H0(null,i,r,d,c);break e}}throw i=Y(r)||r,Error(a(306,i,""))}}return i;case 0:return Ym(r,i,i.type,i.pendingProps,c);case 1:return d=i.type,y=Ps(d,i.pendingProps),K0(r,i,d,y,c);case 3:e:{if(Ae(i,i.stateNode.containerInfo),r===null)throw Error(a(387));d=i.pendingProps;var v=i.memoizedState;y=v.element,km(r,i),oc(i,d,null,c);var S=i.memoizedState;if(d=S.cache,Oi(i,wn,d),d!==v.cache&&ym(i,[wn],c,!0),lc(),d=S.element,v.isDehydrated)if(v={element:d,isDehydrated:!1,cache:S.cache},i.updateQueue.baseState=v,i.memoizedState=v,i.flags&256){i=Y0(r,i,d,c);break e}else if(d!==y){y=Wr(Error(a(424)),i),tc(y),i=Y0(r,i,d,c);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Vt=ra(r.firstChild),Gn=i,kt=!0,Ai=null,ta=!0,c=Zx(i,null,d,c),i.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(As(),d===y){i=Ka(r,i,c);break e}Qn(r,i,d,c)}i=i.child}return i;case 26:return Md(r,i),r===null?(c=dS(i.type,null,i.pendingProps,null))?i.memoizedState=c:kt||(c=i.type,r=i.pendingProps,d=Yd(ae.current).createElement(c),d[Qe]=i,d[vt]=r,Kn(d,c,r),St(d),i.stateNode=d):i.memoizedState=dS(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Ge(i),r===null&&kt&&(d=i.stateNode=oS(i.type,i.pendingProps,ae.current),Gn=i,ta=!0,y=Vt,Zi(i.type)?(Ip=y,Vt=ra(d.firstChild)):Vt=y),Qn(r,i,i.pendingProps.children,c),Md(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&kt&&((y=d=Vt)&&(d=U2(d,i.type,i.pendingProps,ta),d!==null?(i.stateNode=d,Gn=i,Vt=ra(d.firstChild),ta=!1,y=!0):y=!1),y||Ri(i)),Ge(i),y=i.type,v=i.pendingProps,S=r!==null?r.memoizedProps:null,d=v.children,Rp(y,v)?d=null:S!==null&&Rp(y,S)&&(i.flags|=32),i.memoizedState!==null&&(y=Am(r,i,e2,null,null,c),_c._currentValue=y),Md(r,i),Qn(r,i,d,c),i.child;case 6:return r===null&&kt&&((r=c=Vt)&&(c=B2(c,i.pendingProps,ta),c!==null?(i.stateNode=c,Gn=i,Vt=null,r=!0):r=!1),r||Ri(i)),null;case 13:return X0(r,i,c);case 4:return Ae(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=Is(i,null,d,c):Qn(r,i,d,c),i.child;case 11:return $0(r,i,i.type,i.pendingProps,c);case 7:return Qn(r,i,i.pendingProps,c),i.child;case 8:return Qn(r,i,i.pendingProps.children,c),i.child;case 12:return Qn(r,i,i.pendingProps.children,c),i.child;case 10:return d=i.pendingProps,Oi(i,i.type,d.value),Qn(r,i,d.children,c),i.child;case 9:return y=i.type._context,d=i.pendingProps.children,Os(i),y=Vn(y),d=d(y),i.flags|=1,Qn(r,i,d,c),i.child;case 14:return H0(r,i,i.type,i.pendingProps,c);case 15:return q0(r,i,i.type,i.pendingProps,c);case 19:return J0(r,i,c);case 31:return o2(r,i,c);case 22:return Z0(r,i,c,i.pendingProps);case 24:return Os(i),d=Vn(wn),r===null?(y=xm(),y===null&&(y=Ft,v=vm(),y.pooledCache=v,v.refCount++,v!==null&&(y.pooledCacheLanes|=c),y=v),i.memoizedState={parent:d,cache:y},Sm(i),Oi(i,wn,y)):((r.lanes&c)!==0&&(km(r,i),oc(i,null,null,c),lc()),y=r.memoizedState,v=i.memoizedState,y.parent!==d?(y={parent:d,cache:d},i.memoizedState=y,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=y),Oi(i,wn,d)):(d=v.cache,Oi(i,wn,d),d!==y.cache&&ym(i,[wn],c,!0))),Qn(r,i,i.pendingProps.children,c),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function Ya(r){r.flags|=4}function ap(r,i,c,d,y){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(y&335544128)===y)if(r.stateNode.complete)r.flags|=8192;else if(Nw())r.flags|=8192;else throw zs=vd,wm}else r.flags&=-16777217}function tw(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!gS(i))if(Nw())r.flags|=8192;else throw zs=vd,wm}function zd(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?Qr():536870912,r.lanes|=i,Dl|=i)}function mc(r,i){if(!kt)switch(r.tailMode){case"hidden":i=r.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?r.tail=null:c.sibling=null;break;case"collapsed":c=r.tail;for(var d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Qt(r){var i=r.alternate!==null&&r.alternate.child===r.child,c=0,d=0;if(i)for(var y=r.child;y!==null;)c|=y.lanes|y.childLanes,d|=y.subtreeFlags&65011712,d|=y.flags&65011712,y.return=r,y=y.sibling;else for(y=r.child;y!==null;)c|=y.lanes|y.childLanes,d|=y.subtreeFlags,d|=y.flags,y.return=r,y=y.sibling;return r.subtreeFlags|=d,r.childLanes=c,i}function u2(r,i,c){var d=i.pendingProps;switch(fm(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qt(i),null;case 1:return Qt(i),null;case 3:return c=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),Ga(wn),Ee(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(wl(i)?Ya(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,mm())),Qt(i),null;case 26:var y=i.type,v=i.memoizedState;return r===null?(Ya(i),v!==null?(Qt(i),tw(i,v)):(Qt(i),ap(i,y,null,d,c))):v?v!==r.memoizedState?(Ya(i),Qt(i),tw(i,v)):(Qt(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&Ya(i),Qt(i),ap(i,y,r,d,c)),null;case 27:if(Fe(i),c=ae.current,y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Ya(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Qt(i),null}r=V.current,wl(i)?Dx(i):(r=oS(y,d,c),i.stateNode=r,Ya(i))}return Qt(i),null;case 5:if(Fe(i),y=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&Ya(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return Qt(i),null}if(v=V.current,wl(i))Dx(i);else{var S=Yd(ae.current);switch(v){case 1:v=S.createElementNS("http://www.w3.org/2000/svg",y);break;case 2:v=S.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;default:switch(y){case"svg":v=S.createElementNS("http://www.w3.org/2000/svg",y);break;case"math":v=S.createElementNS("http://www.w3.org/1998/Math/MathML",y);break;case"script":v=S.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof d.is=="string"?S.createElement("select",{is:d.is}):S.createElement("select"),d.multiple?v.multiple=!0:d.size&&(v.size=d.size);break;default:v=typeof d.is=="string"?S.createElement(y,{is:d.is}):S.createElement(y)}}v[Qe]=i,v[vt]=d;e:for(S=i.child;S!==null;){if(S.tag===5||S.tag===6)v.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===i)break e;for(;S.sibling===null;){if(S.return===null||S.return===i)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}i.stateNode=v;e:switch(Kn(v,y,d),y){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Ya(i)}}return Qt(i),ap(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,c),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&Ya(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(a(166));if(r=ae.current,wl(i)){if(r=i.stateNode,c=i.memoizedProps,d=null,y=Gn,y!==null)switch(y.tag){case 27:case 5:d=y.memoizedProps}r[Qe]=i,r=!!(r.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||Xw(r.nodeValue,c)),r||Ri(i,!0)}else r=Yd(r).createTextNode(d),r[Qe]=i,i.stateNode=r}return Qt(i),null;case 31:if(c=i.memoizedState,r===null||r.memoizedState!==null){if(d=wl(i),c!==null){if(r===null){if(!d)throw Error(a(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(a(557));r[Qe]=i}else As(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Qt(i),r=!1}else c=mm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return i.flags&256?(Pr(i),i):(Pr(i),null);if((i.flags&128)!==0)throw Error(a(558))}return Qt(i),null;case 13:if(d=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(y=wl(i),d!==null&&d.dehydrated!==null){if(r===null){if(!y)throw Error(a(318));if(y=i.memoizedState,y=y!==null?y.dehydrated:null,!y)throw Error(a(317));y[Qe]=i}else As(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Qt(i),y=!1}else y=mm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=y),y=!0;if(!y)return i.flags&256?(Pr(i),i):(Pr(i),null)}return Pr(i),(i.flags&128)!==0?(i.lanes=c,i):(c=d!==null,r=r!==null&&r.memoizedState!==null,c&&(d=i.child,y=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(y=d.alternate.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==y&&(d.flags|=2048)),c!==r&&c&&(i.child.flags|=8192),zd(i,i.updateQueue),Qt(i),null);case 4:return Ee(),r===null&&Ep(i.stateNode.containerInfo),Qt(i),null;case 10:return Ga(i.type),Qt(i),null;case 19:if(P(gn),d=i.memoizedState,d===null)return Qt(i),null;if(y=(i.flags&128)!==0,v=d.rendering,v===null)if(y)mc(d,!1);else{if(cn!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(v=Sd(r),v!==null){for(i.flags|=128,mc(d,!1),r=v.updateQueue,i.updateQueue=r,zd(i,r),i.subtreeFlags=0,r=c,c=i.child;c!==null;)Tx(c,r),c=c.sibling;return _(gn,gn.current&1|2),kt&&qa(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&nt()>Bd&&(i.flags|=128,y=!0,mc(d,!1),i.lanes=4194304)}else{if(!y)if(r=Sd(v),r!==null){if(i.flags|=128,y=!0,r=r.updateQueue,i.updateQueue=r,zd(i,r),mc(d,!0),d.tail===null&&d.tailMode==="hidden"&&!v.alternate&&!kt)return Qt(i),null}else 2*nt()-d.renderingStartTime>Bd&&c!==536870912&&(i.flags|=128,y=!0,mc(d,!1),i.lanes=4194304);d.isBackwards?(v.sibling=i.child,i.child=v):(r=d.last,r!==null?r.sibling=v:i.child=v,d.last=v)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=nt(),r.sibling=null,c=gn.current,_(gn,y?c&1|2:c&1),kt&&qa(i,d.treeForkCount),r):(Qt(i),null);case 22:case 23:return Pr(i),Nm(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(c&536870912)!==0&&(i.flags&128)===0&&(Qt(i),i.subtreeFlags&6&&(i.flags|=8192)):Qt(i),c=i.updateQueue,c!==null&&zd(i,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==c&&(i.flags|=2048),r!==null&&P(Ms),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),i.memoizedState.cache!==c&&(i.flags|=2048),Ga(wn),Qt(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function d2(r,i){switch(fm(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return Ga(wn),Ee(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return Fe(i),null;case 31:if(i.memoizedState!==null){if(Pr(i),i.alternate===null)throw Error(a(340));As()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(Pr(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(a(340));As()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return P(gn),null;case 4:return Ee(),null;case 10:return Ga(i.type),null;case 22:case 23:return Pr(i),Nm(),r!==null&&P(Ms),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return Ga(wn),null;case 25:return null;default:return null}}function nw(r,i){switch(fm(i),i.tag){case 3:Ga(wn),Ee();break;case 26:case 27:case 5:Fe(i);break;case 4:Ee();break;case 31:i.memoizedState!==null&&Pr(i);break;case 13:Pr(i);break;case 19:P(gn);break;case 10:Ga(i.type);break;case 22:case 23:Pr(i),Nm(),r!==null&&P(Ms);break;case 24:Ga(wn)}}function pc(r,i){try{var c=i.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var y=d.next;c=y;do{if((c.tag&r)===r){d=void 0;var v=c.create,S=c.inst;d=v(),S.destroy=d}c=c.next}while(c!==y)}}catch(T){zt(i,i.return,T)}}function Pi(r,i,c){try{var d=i.updateQueue,y=d!==null?d.lastEffect:null;if(y!==null){var v=y.next;d=v;do{if((d.tag&r)===r){var S=d.inst,T=S.destroy;if(T!==void 0){S.destroy=void 0,y=i;var Z=c,ie=T;try{ie()}catch(de){zt(y,Z,de)}}}d=d.next}while(d!==v)}}catch(de){zt(i,i.return,de)}}function rw(r){var i=r.updateQueue;if(i!==null){var c=r.stateNode;try{Vx(i,c)}catch(d){zt(r,r.return,d)}}}function aw(r,i,c){c.props=Ps(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(d){zt(r,i,d)}}function gc(r,i){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof c=="function"?r.refCleanup=c(d):c.current=d}}catch(y){zt(r,i,y)}}function Na(r,i){var c=r.ref,d=r.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(y){zt(r,i,y)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(y){zt(r,i,y)}else c.current=null}function iw(r){var i=r.type,c=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(y){zt(r,r.return,y)}}function ip(r,i,c){try{var d=r.stateNode;M2(d,r.type,c,i),d[vt]=i}catch(y){zt(r,r.return,y)}}function sw(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Zi(r.type)||r.tag===4}function sp(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||sw(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&Zi(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function lp(r,i,c){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(r,i):(i=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,i.appendChild(r),c=c._reactRootContainer,c!=null||i.onclick!==null||(i.onclick=Fa));else if(d!==4&&(d===27&&Zi(r.type)&&(c=r.stateNode,i=null),r=r.child,r!==null))for(lp(r,i,c),r=r.sibling;r!==null;)lp(r,i,c),r=r.sibling}function Id(r,i,c){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?c.insertBefore(r,i):c.appendChild(r);else if(d!==4&&(d===27&&Zi(r.type)&&(c=r.stateNode),r=r.child,r!==null))for(Id(r,i,c),r=r.sibling;r!==null;)Id(r,i,c),r=r.sibling}function lw(r){var i=r.stateNode,c=r.memoizedProps;try{for(var d=r.type,y=i.attributes;y.length;)i.removeAttributeNode(y[0]);Kn(i,d,c),i[Qe]=r,i[vt]=c}catch(v){zt(r,r.return,v)}}var Xa=!1,jn=!1,op=!1,ow=typeof WeakSet=="function"?WeakSet:Set,Un=null;function f2(r,i){if(r=r.containerInfo,Tp=rf,r=xx(r),tm(r)){if("selectionStart"in r)var c={start:r.selectionStart,end:r.selectionEnd};else e:{c=(c=r.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&d.rangeCount!==0){c=d.anchorNode;var y=d.anchorOffset,v=d.focusNode;d=d.focusOffset;try{c.nodeType,v.nodeType}catch{c=null;break e}var S=0,T=-1,Z=-1,ie=0,de=0,pe=r,oe=null;t:for(;;){for(var ce;pe!==c||y!==0&&pe.nodeType!==3||(T=S+y),pe!==v||d!==0&&pe.nodeType!==3||(Z=S+d),pe.nodeType===3&&(S+=pe.nodeValue.length),(ce=pe.firstChild)!==null;)oe=pe,pe=ce;for(;;){if(pe===r)break t;if(oe===c&&++ie===y&&(T=S),oe===v&&++de===d&&(Z=S),(ce=pe.nextSibling)!==null)break;pe=oe,oe=pe.parentNode}pe=ce}c=T===-1||Z===-1?null:{start:T,end:Z}}else c=null}c=c||{start:0,end:0}}else c=null;for(Ap={focusedElem:r,selectionRange:c},rf=!1,Un=i;Un!==null;)if(i=Un,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,Un=r;else for(;Un!==null;){switch(i=Un,v=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(c=0;c<r.length;c++)y=r[c],y.ref.impl=y.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&v!==null){r=void 0,c=i,y=v.memoizedProps,v=v.memoizedState,d=c.stateNode;try{var Re=Ps(c.type,y);r=d.getSnapshotBeforeUpdate(Re,v),d.__reactInternalSnapshotBeforeUpdate=r}catch(Ke){zt(c,c.return,Ke)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,c=r.nodeType,c===9)Mp(r);else if(c===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Mp(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(a(163))}if(r=i.sibling,r!==null){r.return=i.return,Un=r;break}Un=i.return}}function cw(r,i,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:Ja(r,c),d&4&&pc(5,c);break;case 1:if(Ja(r,c),d&4)if(r=c.stateNode,i===null)try{r.componentDidMount()}catch(S){zt(c,c.return,S)}else{var y=Ps(c.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(y,i,r.__reactInternalSnapshotBeforeUpdate)}catch(S){zt(c,c.return,S)}}d&64&&rw(c),d&512&&gc(c,c.return);break;case 3:if(Ja(r,c),d&64&&(r=c.updateQueue,r!==null)){if(i=null,c.child!==null)switch(c.child.tag){case 27:case 5:i=c.child.stateNode;break;case 1:i=c.child.stateNode}try{Vx(r,i)}catch(S){zt(c,c.return,S)}}break;case 27:i===null&&d&4&&lw(c);case 26:case 5:Ja(r,c),i===null&&d&4&&iw(c),d&512&&gc(c,c.return);break;case 12:Ja(r,c);break;case 31:Ja(r,c),d&4&&fw(r,c);break;case 13:Ja(r,c),d&4&&hw(r,c),d&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=w2.bind(null,c),F2(r,c))));break;case 22:if(d=c.memoizedState!==null||Xa,!d){i=i!==null&&i.memoizedState!==null||jn,y=Xa;var v=jn;Xa=d,(jn=i)&&!v?ei(r,c,(c.subtreeFlags&8772)!==0):Ja(r,c),Xa=y,jn=v}break;case 30:break;default:Ja(r,c)}}function uw(r){var i=r.alternate;i!==null&&(r.alternate=null,uw(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&$e(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Xt=null,xr=!1;function Wa(r,i,c){for(c=c.child;c!==null;)dw(r,i,c),c=c.sibling}function dw(r,i,c){if(qt&&typeof qt.onCommitFiberUnmount=="function")try{qt.onCommitFiberUnmount(Yt,c)}catch{}switch(c.tag){case 26:jn||Na(c,i),Wa(r,i,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:jn||Na(c,i);var d=Xt,y=xr;Zi(c.type)&&(Xt=c.stateNode,xr=!1),Wa(r,i,c),Cc(c.stateNode),Xt=d,xr=y;break;case 5:jn||Na(c,i);case 6:if(d=Xt,y=xr,Xt=null,Wa(r,i,c),Xt=d,xr=y,Xt!==null)if(xr)try{(Xt.nodeType===9?Xt.body:Xt.nodeName==="HTML"?Xt.ownerDocument.body:Xt).removeChild(c.stateNode)}catch(v){zt(c,i,v)}else try{Xt.removeChild(c.stateNode)}catch(v){zt(c,i,v)}break;case 18:Xt!==null&&(xr?(r=Xt,rS(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),$l(r)):rS(Xt,c.stateNode));break;case 4:d=Xt,y=xr,Xt=c.stateNode.containerInfo,xr=!0,Wa(r,i,c),Xt=d,xr=y;break;case 0:case 11:case 14:case 15:Pi(2,c,i),jn||Pi(4,c,i),Wa(r,i,c);break;case 1:jn||(Na(c,i),d=c.stateNode,typeof d.componentWillUnmount=="function"&&aw(c,i,d)),Wa(r,i,c);break;case 21:Wa(r,i,c);break;case 22:jn=(d=jn)||c.memoizedState!==null,Wa(r,i,c),jn=d;break;default:Wa(r,i,c)}}function fw(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{$l(r)}catch(c){zt(i,i.return,c)}}}function hw(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{$l(r)}catch(c){zt(i,i.return,c)}}function h2(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new ow),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new ow),i;default:throw Error(a(435,r.tag))}}function Ld(r,i){var c=h2(r);i.forEach(function(d){if(!c.has(d)){c.add(d);var y=S2.bind(null,r,d);d.then(y,y)}})}function wr(r,i){var c=i.deletions;if(c!==null)for(var d=0;d<c.length;d++){var y=c[d],v=r,S=i,T=S;e:for(;T!==null;){switch(T.tag){case 27:if(Zi(T.type)){Xt=T.stateNode,xr=!1;break e}break;case 5:Xt=T.stateNode,xr=!1;break e;case 3:case 4:Xt=T.stateNode.containerInfo,xr=!0;break e}T=T.return}if(Xt===null)throw Error(a(160));dw(v,S,y),Xt=null,xr=!1,v=y.alternate,v!==null&&(v.return=null),y.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)mw(i,r),i=i.sibling}var va=null;function mw(r,i){var c=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:wr(i,r),Sr(r),d&4&&(Pi(3,r,r.return),pc(3,r),Pi(5,r,r.return));break;case 1:wr(i,r),Sr(r),d&512&&(jn||c===null||Na(c,c.return)),d&64&&Xa&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?d:c.concat(d))));break;case 26:var y=va;if(wr(i,r),Sr(r),d&512&&(jn||c===null||Na(c,c.return)),d&4){var v=c!==null?c.memoizedState:null;if(d=r.memoizedState,c===null)if(d===null)if(r.stateNode===null){e:{d=r.type,c=r.memoizedProps,y=y.ownerDocument||y;t:switch(d){case"title":v=y.getElementsByTagName("title")[0],(!v||v[Ni]||v[Qe]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=y.createElement(d),y.head.insertBefore(v,y.querySelector("head > title"))),Kn(v,d,c),v[Qe]=r,St(v),d=v;break e;case"link":var S=mS("link","href",y).get(d+(c.href||""));if(S){for(var T=0;T<S.length;T++)if(v=S[T],v.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&v.getAttribute("rel")===(c.rel==null?null:c.rel)&&v.getAttribute("title")===(c.title==null?null:c.title)&&v.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){S.splice(T,1);break t}}v=y.createElement(d),Kn(v,d,c),y.head.appendChild(v);break;case"meta":if(S=mS("meta","content",y).get(d+(c.content||""))){for(T=0;T<S.length;T++)if(v=S[T],v.getAttribute("content")===(c.content==null?null:""+c.content)&&v.getAttribute("name")===(c.name==null?null:c.name)&&v.getAttribute("property")===(c.property==null?null:c.property)&&v.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&v.getAttribute("charset")===(c.charSet==null?null:c.charSet)){S.splice(T,1);break t}}v=y.createElement(d),Kn(v,d,c),y.head.appendChild(v);break;default:throw Error(a(468,d))}v[Qe]=r,St(v),d=v}r.stateNode=d}else pS(y,r.type,r.stateNode);else r.stateNode=hS(y,d,r.memoizedProps);else v!==d?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,d===null?pS(y,r.type,r.stateNode):hS(y,d,r.memoizedProps)):d===null&&r.stateNode!==null&&ip(r,r.memoizedProps,c.memoizedProps)}break;case 27:wr(i,r),Sr(r),d&512&&(jn||c===null||Na(c,c.return)),c!==null&&d&4&&ip(r,r.memoizedProps,c.memoizedProps);break;case 5:if(wr(i,r),Sr(r),d&512&&(jn||c===null||Na(c,c.return)),r.flags&32){y=r.stateNode;try{dl(y,"")}catch(Re){zt(r,r.return,Re)}}d&4&&r.stateNode!=null&&(y=r.memoizedProps,ip(r,y,c!==null?c.memoizedProps:y)),d&1024&&(op=!0);break;case 6:if(wr(i,r),Sr(r),d&4){if(r.stateNode===null)throw Error(a(162));d=r.memoizedProps,c=r.stateNode;try{c.nodeValue=d}catch(Re){zt(r,r.return,Re)}}break;case 3:if(Jd=null,y=va,va=Xd(i.containerInfo),wr(i,r),va=y,Sr(r),d&4&&c!==null&&c.memoizedState.isDehydrated)try{$l(i.containerInfo)}catch(Re){zt(r,r.return,Re)}op&&(op=!1,pw(r));break;case 4:d=va,va=Xd(r.stateNode.containerInfo),wr(i,r),Sr(r),va=d;break;case 12:wr(i,r),Sr(r);break;case 31:wr(i,r),Sr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Ld(r,d)));break;case 13:wr(i,r),Sr(r),r.child.flags&8192&&r.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(Ud=nt()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Ld(r,d)));break;case 22:y=r.memoizedState!==null;var Z=c!==null&&c.memoizedState!==null,ie=Xa,de=jn;if(Xa=ie||y,jn=de||Z,wr(i,r),jn=de,Xa=ie,Sr(r),d&8192)e:for(i=r.stateNode,i._visibility=y?i._visibility&-2:i._visibility|1,y&&(c===null||Z||Xa||jn||Us(r)),c=null,i=r;;){if(i.tag===5||i.tag===26){if(c===null){Z=c=i;try{if(v=Z.stateNode,y)S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{T=Z.stateNode;var pe=Z.memoizedProps.style,oe=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;T.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Re){zt(Z,Z.return,Re)}}}else if(i.tag===6){if(c===null){Z=i;try{Z.stateNode.nodeValue=y?"":Z.memoizedProps}catch(Re){zt(Z,Z.return,Re)}}}else if(i.tag===18){if(c===null){Z=i;try{var ce=Z.stateNode;y?aS(ce,!0):aS(Z.stateNode,!1)}catch(Re){zt(Z,Z.return,Re)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;c===i&&(c=null),i=i.return}c===i&&(c=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(c=d.retryQueue,c!==null&&(d.retryQueue=null,Ld(r,c))));break;case 19:wr(i,r),Sr(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,Ld(r,d)));break;case 30:break;case 21:break;default:wr(i,r),Sr(r)}}function Sr(r){var i=r.flags;if(i&2){try{for(var c,d=r.return;d!==null;){if(sw(d)){c=d;break}d=d.return}if(c==null)throw Error(a(160));switch(c.tag){case 27:var y=c.stateNode,v=sp(r);Id(r,v,y);break;case 5:var S=c.stateNode;c.flags&32&&(dl(S,""),c.flags&=-33);var T=sp(r);Id(r,T,S);break;case 3:case 4:var Z=c.stateNode.containerInfo,ie=sp(r);lp(r,ie,Z);break;default:throw Error(a(161))}}catch(de){zt(r,r.return,de)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function pw(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;pw(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Ja(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)cw(r,i.alternate,i),i=i.sibling}function Us(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:Pi(4,i,i.return),Us(i);break;case 1:Na(i,i.return);var c=i.stateNode;typeof c.componentWillUnmount=="function"&&aw(i,i.return,c),Us(i);break;case 27:Cc(i.stateNode);case 26:case 5:Na(i,i.return),Us(i);break;case 22:i.memoizedState===null&&Us(i);break;case 30:Us(i);break;default:Us(i)}r=r.sibling}}function ei(r,i,c){for(c=c&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,y=r,v=i,S=v.flags;switch(v.tag){case 0:case 11:case 15:ei(y,v,c),pc(4,v);break;case 1:if(ei(y,v,c),d=v,y=d.stateNode,typeof y.componentDidMount=="function")try{y.componentDidMount()}catch(ie){zt(d,d.return,ie)}if(d=v,y=d.updateQueue,y!==null){var T=d.stateNode;try{var Z=y.shared.hiddenCallbacks;if(Z!==null)for(y.shared.hiddenCallbacks=null,y=0;y<Z.length;y++)Gx(Z[y],T)}catch(ie){zt(d,d.return,ie)}}c&&S&64&&rw(v),gc(v,v.return);break;case 27:lw(v);case 26:case 5:ei(y,v,c),c&&d===null&&S&4&&iw(v),gc(v,v.return);break;case 12:ei(y,v,c);break;case 31:ei(y,v,c),c&&S&4&&fw(y,v);break;case 13:ei(y,v,c),c&&S&4&&hw(y,v);break;case 22:v.memoizedState===null&&ei(y,v,c),gc(v,v.return);break;case 30:break;default:ei(y,v,c)}i=i.sibling}}function cp(r,i){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&nc(c))}function up(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&nc(r))}function ba(r,i,c,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)gw(r,i,c,d),i=i.sibling}function gw(r,i,c,d){var y=i.flags;switch(i.tag){case 0:case 11:case 15:ba(r,i,c,d),y&2048&&pc(9,i);break;case 1:ba(r,i,c,d);break;case 3:ba(r,i,c,d),y&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&nc(r)));break;case 12:if(y&2048){ba(r,i,c,d),r=i.stateNode;try{var v=i.memoizedProps,S=v.id,T=v.onPostCommit;typeof T=="function"&&T(S,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(Z){zt(i,i.return,Z)}}else ba(r,i,c,d);break;case 31:ba(r,i,c,d);break;case 13:ba(r,i,c,d);break;case 23:break;case 22:v=i.stateNode,S=i.alternate,i.memoizedState!==null?v._visibility&2?ba(r,i,c,d):yc(r,i):v._visibility&2?ba(r,i,c,d):(v._visibility|=2,Rl(r,i,c,d,(i.subtreeFlags&10256)!==0||!1)),y&2048&&cp(S,i);break;case 24:ba(r,i,c,d),y&2048&&up(i.alternate,i);break;default:ba(r,i,c,d)}}function Rl(r,i,c,d,y){for(y=y&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var v=r,S=i,T=c,Z=d,ie=S.flags;switch(S.tag){case 0:case 11:case 15:Rl(v,S,T,Z,y),pc(8,S);break;case 23:break;case 22:var de=S.stateNode;S.memoizedState!==null?de._visibility&2?Rl(v,S,T,Z,y):yc(v,S):(de._visibility|=2,Rl(v,S,T,Z,y)),y&&ie&2048&&cp(S.alternate,S);break;case 24:Rl(v,S,T,Z,y),y&&ie&2048&&up(S.alternate,S);break;default:Rl(v,S,T,Z,y)}i=i.sibling}}function yc(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var c=r,d=i,y=d.flags;switch(d.tag){case 22:yc(c,d),y&2048&&cp(d.alternate,d);break;case 24:yc(c,d),y&2048&&up(d.alternate,d);break;default:yc(c,d)}i=i.sibling}}var vc=8192;function Ol(r,i,c){if(r.subtreeFlags&vc)for(r=r.child;r!==null;)yw(r,i,c),r=r.sibling}function yw(r,i,c){switch(r.tag){case 26:Ol(r,i,c),r.flags&vc&&r.memoizedState!==null&&J2(c,va,r.memoizedState,r.memoizedProps);break;case 5:Ol(r,i,c);break;case 3:case 4:var d=va;va=Xd(r.stateNode.containerInfo),Ol(r,i,c),va=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=vc,vc=16777216,Ol(r,i,c),vc=d):Ol(r,i,c));break;default:Ol(r,i,c)}}function vw(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function bc(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var d=i[c];Un=d,xw(d,r)}vw(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)bw(r),r=r.sibling}function bw(r){switch(r.tag){case 0:case 11:case 15:bc(r),r.flags&2048&&Pi(9,r,r.return);break;case 3:bc(r);break;case 12:bc(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,Pd(r)):bc(r);break;default:bc(r)}}function Pd(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var c=0;c<i.length;c++){var d=i[c];Un=d,xw(d,r)}vw(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Pi(8,i,i.return),Pd(i);break;case 22:c=i.stateNode,c._visibility&2&&(c._visibility&=-3,Pd(i));break;default:Pd(i)}r=r.sibling}}function xw(r,i){for(;Un!==null;){var c=Un;switch(c.tag){case 0:case 11:case 15:Pi(8,c,i);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:nc(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,Un=d;else e:for(c=r;Un!==null;){d=Un;var y=d.sibling,v=d.return;if(uw(d),d===c){Un=null;break e}if(y!==null){y.return=v,Un=y;break e}Un=v}}}var m2={getCacheForType:function(r){var i=Vn(wn),c=i.data.get(r);return c===void 0&&(c=r(),i.data.set(r,c)),c},cacheSignal:function(){return Vn(wn).controller.signal}},p2=typeof WeakMap=="function"?WeakMap:Map,Rt=0,Ft=null,ft=null,bt=0,Dt=0,Ur=null,Ui=!1,Ml=!1,dp=!1,ti=0,cn=0,Bi=0,Bs=0,fp=0,Br=0,Dl=0,xc=null,kr=null,hp=!1,Ud=0,ww=0,Bd=1/0,Fd=null,Fi=null,On=0,$i=null,zl=null,ni=0,mp=0,pp=null,Sw=null,wc=0,gp=null;function Fr(){return(Rt&2)!==0&&bt!==0?bt&-bt:G.T!==null?Sp():Ci()}function kw(){if(Br===0)if((bt&536870912)===0||kt){var r=lr;lr<<=1,(lr&3932160)===0&&(lr=262144),Br=r}else Br=536870912;return r=Lr.current,r!==null&&(r.flags|=32),Br}function jr(r,i,c){(r===Ft&&(Dt===2||Dt===9)||r.cancelPendingCommit!==null)&&(Il(r,0),Hi(r,bt,Br,!1)),ga(r,c),((Rt&2)===0||r!==Ft)&&(r===Ft&&((Rt&2)===0&&(Bs|=c),cn===4&&Hi(r,bt,Br,!1)),_a(r))}function jw(r,i,c){if((Rt&6)!==0)throw Error(a(327));var d=!c&&(i&127)===0&&(i&r.expiredLanes)===0||pa(r,i),y=d?v2(r,i):vp(r,i,!0),v=d;do{if(y===0){Ml&&!d&&Hi(r,i,0,!1);break}else{if(c=r.current.alternate,v&&!g2(c)){y=vp(r,i,!1),v=!1;continue}if(y===2){if(v=i,r.errorRecoveryDisabledLanes&v)var S=0;else S=r.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){i=S;e:{var T=r;y=xc;var Z=T.current.memoizedState.isDehydrated;if(Z&&(Il(T,S).flags|=256),S=vp(T,S,!1),S!==2){if(dp&&!Z){T.errorRecoveryDisabledLanes|=v,Bs|=v,y=4;break e}v=kr,kr=y,v!==null&&(kr===null?kr=v:kr.push.apply(kr,v))}y=S}if(v=!1,y!==2)continue}}if(y===1){Il(r,0),Hi(r,i,0,!0);break}e:{switch(d=r,v=y,v){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:Hi(d,i,Br,!Ui);break e;case 2:kr=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(y=Ud+300-nt(),10<y)){if(Hi(d,i,Br,!Ui),Pa(d,0,!0)!==0)break e;ni=i,d.timeoutHandle=tS(Cw.bind(null,d,c,kr,Fd,hp,i,Br,Bs,Dl,Ui,v,"Throttled",-0,0),y);break e}Cw(d,c,kr,Fd,hp,i,Br,Bs,Dl,Ui,v,null,-0,0)}}break}while(!0);_a(r)}function Cw(r,i,c,d,y,v,S,T,Z,ie,de,pe,oe,ce){if(r.timeoutHandle=-1,pe=i.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fa},yw(i,v,pe);var Re=(v&62914560)===v?Ud-nt():(v&4194048)===v?ww-nt():0;if(Re=eR(pe,Re),Re!==null){ni=v,r.cancelPendingCommit=Re(Mw.bind(null,r,i,v,c,d,y,S,T,Z,de,pe,null,oe,ce)),Hi(r,v,S,!ie);return}}Mw(r,i,v,c,d,y,S,T,Z)}function g2(r){for(var i=r;;){var c=i.tag;if((c===0||c===11||c===15)&&i.flags&16384&&(c=i.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var y=c[d],v=y.getSnapshot;y=y.value;try{if(!zr(v(),y))return!1}catch{return!1}}if(c=i.child,i.subtreeFlags&16384&&c!==null)c.return=i,i=c;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Hi(r,i,c,d){i&=~fp,i&=~Bs,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var y=i;0<y;){var v=31-yt(y),S=1<<v;d[v]=-1,y&=~S}c!==0&&ki(r,c,i)}function $d(){return(Rt&6)===0?(Sc(0),!1):!0}function yp(){if(ft!==null){if(Dt===0)var r=ft.return;else r=ft,Za=Rs=null,Mm(r),El=null,ac=0,r=ft;for(;r!==null;)nw(r.alternate,r),r=r.return;ft=null}}function Il(r,i){var c=r.timeoutHandle;c!==-1&&(r.timeoutHandle=-1,I2(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),ni=0,yp(),Ft=r,ft=c=Ha(r.current,null),bt=i,Dt=0,Ur=null,Ui=!1,Ml=pa(r,i),dp=!1,Dl=Br=fp=Bs=Bi=cn=0,kr=xc=null,hp=!1,(i&8)!==0&&(i|=i&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=i;0<d;){var y=31-yt(d),v=1<<y;i|=r[y],d&=~v}return ti=i,cd(),c}function Ew(r,i){tt=null,G.H=fc,i===Cl||i===yd?(i=$x(),Dt=3):i===wm?(i=$x(),Dt=4):Dt=i===Km?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Ur=i,ft===null&&(cn=1,Rd(r,Wr(i,r.current)))}function Nw(){var r=Lr.current;return r===null?!0:(bt&4194048)===bt?na===null:(bt&62914560)===bt||(bt&536870912)!==0?r===na:!1}function _w(){var r=G.H;return G.H=fc,r===null?fc:r}function Tw(){var r=G.A;return G.A=m2,r}function Hd(){cn=4,Ui||(bt&4194048)!==bt&&Lr.current!==null||(Ml=!0),(Bi&134217727)===0&&(Bs&134217727)===0||Ft===null||Hi(Ft,bt,Br,!1)}function vp(r,i,c){var d=Rt;Rt|=2;var y=_w(),v=Tw();(Ft!==r||bt!==i)&&(Fd=null,Il(r,i)),i=!1;var S=cn;e:do try{if(Dt!==0&&ft!==null){var T=ft,Z=Ur;switch(Dt){case 8:yp(),S=6;break e;case 3:case 2:case 9:case 6:Lr.current===null&&(i=!0);var ie=Dt;if(Dt=0,Ur=null,Ll(r,T,Z,ie),c&&Ml){S=0;break e}break;default:ie=Dt,Dt=0,Ur=null,Ll(r,T,Z,ie)}}y2(),S=cn;break}catch(de){Ew(r,de)}while(!0);return i&&r.shellSuspendCounter++,Za=Rs=null,Rt=d,G.H=y,G.A=v,ft===null&&(Ft=null,bt=0,cd()),S}function y2(){for(;ft!==null;)Aw(ft)}function v2(r,i){var c=Rt;Rt|=2;var d=_w(),y=Tw();Ft!==r||bt!==i?(Fd=null,Bd=nt()+500,Il(r,i)):Ml=pa(r,i);e:do try{if(Dt!==0&&ft!==null){i=ft;var v=Ur;t:switch(Dt){case 1:Dt=0,Ur=null,Ll(r,i,v,1);break;case 2:case 9:if(Bx(v)){Dt=0,Ur=null,Rw(i);break}i=function(){Dt!==2&&Dt!==9||Ft!==r||(Dt=7),_a(r)},v.then(i,i);break e;case 3:Dt=7;break e;case 4:Dt=5;break e;case 7:Bx(v)?(Dt=0,Ur=null,Rw(i)):(Dt=0,Ur=null,Ll(r,i,v,7));break;case 5:var S=null;switch(ft.tag){case 26:S=ft.memoizedState;case 5:case 27:var T=ft;if(S?gS(S):T.stateNode.complete){Dt=0,Ur=null;var Z=T.sibling;if(Z!==null)ft=Z;else{var ie=T.return;ie!==null?(ft=ie,qd(ie)):ft=null}break t}}Dt=0,Ur=null,Ll(r,i,v,5);break;case 6:Dt=0,Ur=null,Ll(r,i,v,6);break;case 8:yp(),cn=6;break e;default:throw Error(a(462))}}b2();break}catch(de){Ew(r,de)}while(!0);return Za=Rs=null,G.H=d,G.A=y,Rt=c,ft!==null?0:(Ft=null,bt=0,cd(),cn)}function b2(){for(;ft!==null&&!qe();)Aw(ft)}function Aw(r){var i=ew(r.alternate,r,ti);r.memoizedProps=r.pendingProps,i===null?qd(r):ft=i}function Rw(r){var i=r,c=i.alternate;switch(i.tag){case 15:case 0:i=Q0(c,i,i.pendingProps,i.type,void 0,bt);break;case 11:i=Q0(c,i,i.pendingProps,i.type.render,i.ref,bt);break;case 5:Mm(i);default:nw(c,i),i=ft=Tx(i,ti),i=ew(c,i,ti)}r.memoizedProps=r.pendingProps,i===null?qd(r):ft=i}function Ll(r,i,c,d){Za=Rs=null,Mm(i),El=null,ac=0;var y=i.return;try{if(l2(r,y,i,c,bt)){cn=1,Rd(r,Wr(c,r.current)),ft=null;return}}catch(v){if(y!==null)throw ft=y,v;cn=1,Rd(r,Wr(c,r.current)),ft=null;return}i.flags&32768?(kt||d===1?r=!0:Ml||(bt&536870912)!==0?r=!1:(Ui=r=!0,(d===2||d===9||d===3||d===6)&&(d=Lr.current,d!==null&&d.tag===13&&(d.flags|=16384))),Ow(i,r)):qd(i)}function qd(r){var i=r;do{if((i.flags&32768)!==0){Ow(i,Ui);return}r=i.return;var c=u2(i.alternate,i,ti);if(c!==null){ft=c;return}if(i=i.sibling,i!==null){ft=i;return}ft=i=r}while(i!==null);cn===0&&(cn=5)}function Ow(r,i){do{var c=d2(r.alternate,r);if(c!==null){c.flags&=32767,ft=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!i&&(r=r.sibling,r!==null)){ft=r;return}ft=r=c}while(r!==null);cn=6,ft=null}function Mw(r,i,c,d,y,v,S,T,Z){r.cancelPendingCommit=null;do Zd();while(On!==0);if((Rt&6)!==0)throw Error(a(327));if(i!==null){if(i===r.current)throw Error(a(177));if(v=i.lanes|i.childLanes,v|=sm,Si(r,c,v,S,T,Z),r===Ft&&(ft=Ft=null,bt=0),zl=i,$i=r,ni=c,mp=v,pp=y,Sw=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,k2(Ne,function(){return Pw(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=G.T,G.T=null,y=se.p,se.p=2,S=Rt,Rt|=4;try{f2(r,i,c)}finally{Rt=S,se.p=y,G.T=d}}On=1,Dw(),zw(),Iw()}}function Dw(){if(On===1){On=0;var r=$i,i=zl,c=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||c){c=G.T,G.T=null;var d=se.p;se.p=2;var y=Rt;Rt|=4;try{mw(i,r);var v=Ap,S=xx(r.containerInfo),T=v.focusedElem,Z=v.selectionRange;if(S!==T&&T&&T.ownerDocument&&bx(T.ownerDocument.documentElement,T)){if(Z!==null&&tm(T)){var ie=Z.start,de=Z.end;if(de===void 0&&(de=ie),"selectionStart"in T)T.selectionStart=ie,T.selectionEnd=Math.min(de,T.value.length);else{var pe=T.ownerDocument||document,oe=pe&&pe.defaultView||window;if(oe.getSelection){var ce=oe.getSelection(),Re=T.textContent.length,Ke=Math.min(Z.start,Re),Pt=Z.end===void 0?Ke:Math.min(Z.end,Re);!ce.extend&&Ke>Pt&&(S=Pt,Pt=Ke,Ke=S);var W=vx(T,Ke),K=vx(T,Pt);if(W&&K&&(ce.rangeCount!==1||ce.anchorNode!==W.node||ce.anchorOffset!==W.offset||ce.focusNode!==K.node||ce.focusOffset!==K.offset)){var re=pe.createRange();re.setStart(W.node,W.offset),ce.removeAllRanges(),Ke>Pt?(ce.addRange(re),ce.extend(K.node,K.offset)):(re.setEnd(K.node,K.offset),ce.addRange(re))}}}}for(pe=[],ce=T;ce=ce.parentNode;)ce.nodeType===1&&pe.push({element:ce,left:ce.scrollLeft,top:ce.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<pe.length;T++){var he=pe[T];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}rf=!!Tp,Ap=Tp=null}finally{Rt=y,se.p=d,G.T=c}}r.current=i,On=2}}function zw(){if(On===2){On=0;var r=$i,i=zl,c=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||c){c=G.T,G.T=null;var d=se.p;se.p=2;var y=Rt;Rt|=4;try{cw(r,i.alternate,i)}finally{Rt=y,se.p=d,G.T=c}}On=3}}function Iw(){if(On===4||On===3){On=0,Gt();var r=$i,i=zl,c=ni,d=Sw;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?On=5:(On=0,zl=$i=null,Lw(r,r.pendingLanes));var y=r.pendingLanes;if(y===0&&(Fi=null),vr(c),i=i.stateNode,qt&&typeof qt.onCommitFiberRoot=="function")try{qt.onCommitFiberRoot(Yt,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=G.T,y=se.p,se.p=2,G.T=null;try{for(var v=r.onRecoverableError,S=0;S<d.length;S++){var T=d[S];v(T.value,{componentStack:T.stack})}}finally{G.T=i,se.p=y}}(ni&3)!==0&&Zd(),_a(r),y=r.pendingLanes,(c&261930)!==0&&(y&42)!==0?r===gp?wc++:(wc=0,gp=r):wc=0,Sc(0)}}function Lw(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,nc(i)))}function Zd(){return Dw(),zw(),Iw(),Pw()}function Pw(){if(On!==5)return!1;var r=$i,i=mp;mp=0;var c=vr(ni),d=G.T,y=se.p;try{se.p=32>c?32:c,G.T=null,c=pp,pp=null;var v=$i,S=ni;if(On=0,zl=$i=null,ni=0,(Rt&6)!==0)throw Error(a(331));var T=Rt;if(Rt|=4,bw(v.current),gw(v,v.current,S,c),Rt=T,Sc(0,!1),qt&&typeof qt.onPostCommitFiberRoot=="function")try{qt.onPostCommitFiberRoot(Yt,v)}catch{}return!0}finally{se.p=y,G.T=d,Lw(r,i)}}function Uw(r,i,c){i=Wr(c,i),i=Qm(r.stateNode,i,2),r=zi(r,i,2),r!==null&&(ga(r,2),_a(r))}function zt(r,i,c){if(r.tag===3)Uw(r,r,c);else for(;i!==null;){if(i.tag===3){Uw(i,r,c);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Fi===null||!Fi.has(d))){r=Wr(c,r),c=B0(2),d=zi(i,c,2),d!==null&&(F0(c,d,i,r),ga(d,2),_a(d));break}}i=i.return}}function bp(r,i,c){var d=r.pingCache;if(d===null){d=r.pingCache=new p2;var y=new Set;d.set(i,y)}else y=d.get(i),y===void 0&&(y=new Set,d.set(i,y));y.has(c)||(dp=!0,y.add(c),r=x2.bind(null,r,i,c),i.then(r,r))}function x2(r,i,c){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,Ft===r&&(bt&c)===c&&(cn===4||cn===3&&(bt&62914560)===bt&&300>nt()-Ud?(Rt&2)===0&&Il(r,0):fp|=c,Dl===bt&&(Dl=0)),_a(r)}function Bw(r,i){i===0&&(i=Qr()),r=_s(r,i),r!==null&&(ga(r,i),_a(r))}function w2(r){var i=r.memoizedState,c=0;i!==null&&(c=i.retryLane),Bw(r,c)}function S2(r,i){var c=0;switch(r.tag){case 31:case 13:var d=r.stateNode,y=r.memoizedState;y!==null&&(c=y.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(a(314))}d!==null&&d.delete(i),Bw(r,c)}function k2(r,i){return me(r,i)}var Gd=null,Pl=null,xp=!1,Vd=!1,wp=!1,qi=0;function _a(r){r!==Pl&&r.next===null&&(Pl===null?Gd=Pl=r:Pl=Pl.next=r),Vd=!0,xp||(xp=!0,C2())}function Sc(r,i){if(!wp&&Vd){wp=!0;do for(var c=!1,d=Gd;d!==null;){if(r!==0){var y=d.pendingLanes;if(y===0)var v=0;else{var S=d.suspendedLanes,T=d.pingedLanes;v=(1<<31-yt(42|r)+1)-1,v&=y&~(S&~T),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,qw(d,v))}else v=bt,v=Pa(d,d===Ft?v:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(v&3)===0||pa(d,v)||(c=!0,qw(d,v));d=d.next}while(c);wp=!1}}function j2(){Fw()}function Fw(){Vd=xp=!1;var r=0;qi!==0&&z2()&&(r=qi);for(var i=nt(),c=null,d=Gd;d!==null;){var y=d.next,v=$w(d,i);v===0?(d.next=null,c===null?Gd=y:c.next=y,y===null&&(Pl=c)):(c=d,(r!==0||(v&3)!==0)&&(Vd=!0)),d=y}On!==0&&On!==5||Sc(r),qi!==0&&(qi=0)}function $w(r,i){for(var c=r.suspendedLanes,d=r.pingedLanes,y=r.expirationTimes,v=r.pendingLanes&-62914561;0<v;){var S=31-yt(v),T=1<<S,Z=y[S];Z===-1?((T&c)===0||(T&d)!==0)&&(y[S]=rn(T,i)):Z<=i&&(r.expiredLanes|=T),v&=~T}if(i=Ft,c=bt,c=Pa(r,r===i?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,c===0||r===i&&(Dt===2||Dt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&Pe(d),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||pa(r,c)){if(i=c&-c,i===r.callbackPriority)return i;switch(d!==null&&Pe(d),vr(c)){case 2:case 8:c=be;break;case 32:c=Ne;break;case 268435456:c=wt;break;default:c=Ne}return d=Hw.bind(null,r),c=me(c,d),r.callbackPriority=i,r.callbackNode=c,i}return d!==null&&d!==null&&Pe(d),r.callbackPriority=2,r.callbackNode=null,2}function Hw(r,i){if(On!==0&&On!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(Zd()&&r.callbackNode!==c)return null;var d=bt;return d=Pa(r,r===Ft?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(jw(r,d,i),$w(r,nt()),r.callbackNode!=null&&r.callbackNode===c?Hw.bind(null,r):null)}function qw(r,i){if(Zd())return null;jw(r,i,!0)}function C2(){L2(function(){(Rt&6)!==0?me(ue,j2):Fw()})}function Sp(){if(qi===0){var r=kl;r===0&&(r=ja,ja<<=1,(ja&261888)===0&&(ja=256)),qi=r}return qi}function Zw(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:td(""+r)}function Gw(r,i){var c=i.ownerDocument.createElement("input");return c.name=i.name,c.value=i.value,r.id&&c.setAttribute("form",r.id),i.parentNode.insertBefore(c,i),r=new FormData(r),c.parentNode.removeChild(c),r}function E2(r,i,c,d,y){if(i==="submit"&&c&&c.stateNode===y){var v=Zw((y[vt]||null).action),S=d.submitter;S&&(i=(i=S[vt]||null)?Zw(i.formAction):S.getAttribute("formAction"),i!==null&&(v=i,S=null));var T=new id("action","action",null,d,y);r.push({event:T,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(qi!==0){var Z=S?Gw(y,S):new FormData(y);$m(c,{pending:!0,data:Z,method:y.method,action:v},null,Z)}}else typeof v=="function"&&(T.preventDefault(),Z=S?Gw(y,S):new FormData(y),$m(c,{pending:!0,data:Z,method:y.method,action:v},v,Z))},currentTarget:y}]})}}for(var kp=0;kp<im.length;kp++){var jp=im[kp],N2=jp.toLowerCase(),_2=jp[0].toUpperCase()+jp.slice(1);ya(N2,"on"+_2)}ya(kx,"onAnimationEnd"),ya(jx,"onAnimationIteration"),ya(Cx,"onAnimationStart"),ya("dblclick","onDoubleClick"),ya("focusin","onFocus"),ya("focusout","onBlur"),ya(qA,"onTransitionRun"),ya(ZA,"onTransitionStart"),ya(GA,"onTransitionCancel"),ya(Ex,"onTransitionEnd"),Pn("onMouseEnter",["mouseout","mouseover"]),Pn("onMouseLeave",["mouseout","mouseover"]),Pn("onPointerEnter",["pointerout","pointerover"]),Pn("onPointerLeave",["pointerout","pointerover"]),xn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xn("onBeforeInput",["compositionend","keypress","textInput","paste"]),xn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var kc="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(" "),T2=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(kc));function Vw(r,i){i=(i&4)!==0;for(var c=0;c<r.length;c++){var d=r[c],y=d.event;d=d.listeners;e:{var v=void 0;if(i)for(var S=d.length-1;0<=S;S--){var T=d[S],Z=T.instance,ie=T.currentTarget;if(T=T.listener,Z!==v&&y.isPropagationStopped())break e;v=T,y.currentTarget=ie;try{v(y)}catch(de){od(de)}y.currentTarget=null,v=Z}else for(S=0;S<d.length;S++){if(T=d[S],Z=T.instance,ie=T.currentTarget,T=T.listener,Z!==v&&y.isPropagationStopped())break e;v=T,y.currentTarget=ie;try{v(y)}catch(de){od(de)}y.currentTarget=null,v=Z}}}}function ht(r,i){var c=i[Ua];c===void 0&&(c=i[Ua]=new Set);var d=r+"__bubble";c.has(d)||(Qw(i,r,2,!1),c.add(d))}function Cp(r,i,c){var d=0;i&&(d|=4),Qw(c,r,d,i)}var Qd="_reactListening"+Math.random().toString(36).slice(2);function Ep(r){if(!r[Qd]){r[Qd]=!0,an.forEach(function(c){c!=="selectionchange"&&(T2.has(c)||Cp(c,!1,r),Cp(c,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Qd]||(i[Qd]=!0,Cp("selectionchange",!1,i))}}function Qw(r,i,c,d){switch(kS(i)){case 2:var y=rR;break;case 8:y=aR;break;default:y=Fp}c=y.bind(null,i,c,r),y=void 0,!Gh||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(y=!0),d?y!==void 0?r.addEventListener(i,c,{capture:!0,passive:y}):r.addEventListener(i,c,!0):y!==void 0?r.addEventListener(i,c,{passive:y}):r.addEventListener(i,c,!1)}function Np(r,i,c,d,y){var v=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var S=d.tag;if(S===3||S===4){var T=d.stateNode.containerInfo;if(T===y)break;if(S===4)for(S=d.return;S!==null;){var Z=S.tag;if((Z===3||Z===4)&&S.stateNode.containerInfo===y)return;S=S.return}for(;T!==null;){if(S=q(T),S===null)return;if(Z=S.tag,Z===5||Z===6||Z===26||Z===27){d=v=S;continue e}T=T.parentNode}}d=d.return}Jb(function(){var ie=v,de=qh(c),pe=[];e:{var oe=Nx.get(r);if(oe!==void 0){var ce=id,Re=r;switch(r){case"keypress":if(rd(c)===0)break e;case"keydown":case"keyup":ce=SA;break;case"focusin":Re="focus",ce=Yh;break;case"focusout":Re="blur",ce=Yh;break;case"beforeblur":case"afterblur":ce=Yh;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ce=nx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=uA;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=CA;break;case kx:case jx:case Cx:ce=hA;break;case Ex:ce=NA;break;case"scroll":case"scrollend":ce=oA;break;case"wheel":ce=TA;break;case"copy":case"cut":case"paste":ce=pA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=ax;break;case"toggle":case"beforetoggle":ce=RA}var Ke=(i&4)!==0,Pt=!Ke&&(r==="scroll"||r==="scrollend"),W=Ke?oe!==null?oe+"Capture":null:oe;Ke=[];for(var K=ie,re;K!==null;){var he=K;if(re=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||re===null||W===null||(he=Zo(K,W),he!=null&&Ke.push(jc(K,he,re))),Pt)break;K=K.return}0<Ke.length&&(oe=new ce(oe,Re,null,c,de),pe.push({event:oe,listeners:Ke}))}}if((i&7)===0){e:{if(oe=r==="mouseover"||r==="pointerover",ce=r==="mouseout"||r==="pointerout",oe&&c!==Hh&&(Re=c.relatedTarget||c.fromElement)&&(q(Re)||Re[qn]))break e;if((ce||oe)&&(oe=de.window===de?de:(oe=de.ownerDocument)?oe.defaultView||oe.parentWindow:window,ce?(Re=c.relatedTarget||c.toElement,ce=ie,Re=Re?q(Re):null,Re!==null&&(Pt=o(Re),Ke=Re.tag,Re!==Pt||Ke!==5&&Ke!==27&&Ke!==6)&&(Re=null)):(ce=null,Re=ie),ce!==Re)){if(Ke=nx,he="onMouseLeave",W="onMouseEnter",K="mouse",(r==="pointerout"||r==="pointerover")&&(Ke=ax,he="onPointerLeave",W="onPointerEnter",K="pointer"),Pt=ce==null?oe:_e(ce),re=Re==null?oe:_e(Re),oe=new Ke(he,K+"leave",ce,c,de),oe.target=Pt,oe.relatedTarget=re,he=null,q(de)===ie&&(Ke=new Ke(W,K+"enter",Re,c,de),Ke.target=re,Ke.relatedTarget=Pt,he=Ke),Pt=he,ce&&Re)t:{for(Ke=A2,W=ce,K=Re,re=0,he=W;he;he=Ke(he))re++;he=0;for(var He=K;He;He=Ke(He))he++;for(;0<re-he;)W=Ke(W),re--;for(;0<he-re;)K=Ke(K),he--;for(;re--;){if(W===K||K!==null&&W===K.alternate){Ke=W;break t}W=Ke(W),K=Ke(K)}Ke=null}else Ke=null;ce!==null&&Kw(pe,oe,ce,Ke,!1),Re!==null&&Pt!==null&&Kw(pe,Pt,Re,Ke,!0)}}e:{if(oe=ie?_e(ie):window,ce=oe.nodeName&&oe.nodeName.toLowerCase(),ce==="select"||ce==="input"&&oe.type==="file")var Tt=fx;else if(ux(oe))if(hx)Tt=FA;else{Tt=UA;var Le=PA}else ce=oe.nodeName,!ce||ce.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?ie&&$h(ie.elementType)&&(Tt=fx):Tt=BA;if(Tt&&(Tt=Tt(r,ie))){dx(pe,Tt,c,de);break e}Le&&Le(r,oe,ie),r==="focusout"&&ie&&oe.type==="number"&&ie.memoizedProps.value!=null&&Fh(oe,"number",oe.value)}switch(Le=ie?_e(ie):window,r){case"focusin":(ux(Le)||Le.contentEditable==="true")&&(pl=Le,nm=ie,Jo=null);break;case"focusout":Jo=nm=pl=null;break;case"mousedown":rm=!0;break;case"contextmenu":case"mouseup":case"dragend":rm=!1,wx(pe,c,de);break;case"selectionchange":if(HA)break;case"keydown":case"keyup":wx(pe,c,de)}var rt;if(Wh)e:{switch(r){case"compositionstart":var xt="onCompositionStart";break e;case"compositionend":xt="onCompositionEnd";break e;case"compositionupdate":xt="onCompositionUpdate";break e}xt=void 0}else ml?ox(r,c)&&(xt="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(xt="onCompositionStart");xt&&(ix&&c.locale!=="ko"&&(ml||xt!=="onCompositionStart"?xt==="onCompositionEnd"&&ml&&(rt=ex()):(_i=de,Vh="value"in _i?_i.value:_i.textContent,ml=!0)),Le=Kd(ie,xt),0<Le.length&&(xt=new rx(xt,r,null,c,de),pe.push({event:xt,listeners:Le}),rt?xt.data=rt:(rt=cx(c),rt!==null&&(xt.data=rt)))),(rt=MA?DA(r,c):zA(r,c))&&(xt=Kd(ie,"onBeforeInput"),0<xt.length&&(Le=new rx("onBeforeInput","beforeinput",null,c,de),pe.push({event:Le,listeners:xt}),Le.data=rt)),E2(pe,r,ie,c,de)}Vw(pe,i)})}function jc(r,i,c){return{instance:r,listener:i,currentTarget:c}}function Kd(r,i){for(var c=i+"Capture",d=[];r!==null;){var y=r,v=y.stateNode;if(y=y.tag,y!==5&&y!==26&&y!==27||v===null||(y=Zo(r,c),y!=null&&d.unshift(jc(r,y,v)),y=Zo(r,i),y!=null&&d.push(jc(r,y,v))),r.tag===3)return d;r=r.return}return[]}function A2(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function Kw(r,i,c,d,y){for(var v=i._reactName,S=[];c!==null&&c!==d;){var T=c,Z=T.alternate,ie=T.stateNode;if(T=T.tag,Z!==null&&Z===d)break;T!==5&&T!==26&&T!==27||ie===null||(Z=ie,y?(ie=Zo(c,v),ie!=null&&S.unshift(jc(c,ie,Z))):y||(ie=Zo(c,v),ie!=null&&S.push(jc(c,ie,Z)))),c=c.return}S.length!==0&&r.push({event:i,listeners:S})}var R2=/\r\n?/g,O2=/\u0000|\uFFFD/g;function Yw(r){return(typeof r=="string"?r:""+r).replace(R2,`
|
|
49
|
-
`).replace(O2,"")}function Xw(r,i){return i=Yw(i),Yw(r)===i}function Lt(r,i,c,d,y,v){switch(c){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||dl(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&dl(r,""+d);break;case"className":Ju(r,"class",d);break;case"tabIndex":Ju(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Ju(r,c,d);break;case"style":Xb(r,d,v);break;case"data":if(i!=="object"){Ju(r,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||c!=="href")){r.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=td(""+d),r.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(c,"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 v=="function"&&(c==="formAction"?(i!=="input"&&Lt(r,i,"name",y.name,y,null),Lt(r,i,"formEncType",y.formEncType,y,null),Lt(r,i,"formMethod",y.formMethod,y,null),Lt(r,i,"formTarget",y.formTarget,y,null)):(Lt(r,i,"encType",y.encType,y,null),Lt(r,i,"method",y.method,y,null),Lt(r,i,"target",y.target,y,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=td(""+d),r.setAttribute(c,d);break;case"onClick":d!=null&&(r.onclick=Fa);break;case"onScroll":d!=null&&ht("scroll",r);break;case"onScrollEnd":d!=null&&ht("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(c=d.__html,c!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=c}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}c=td(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,""+d):r.removeAttribute(c);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":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,""):r.removeAttribute(c);break;case"capture":case"download":d===!0?r.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,d):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(c,d):r.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(c):r.setAttribute(c,d);break;case"popover":ht("beforetoggle",r),ht("toggle",r),Wu(r,"popover",d);break;case"xlinkActuate":Ba(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":Ba(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":Ba(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":Ba(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":Ba(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":Ba(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":Ba(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":Ba(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":Ba(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Wu(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=sA.get(c)||c,Wu(r,c,d))}}function _p(r,i,c,d,y,v){switch(c){case"style":Xb(r,d,v);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(c=d.__html,c!=null){if(y.children!=null)throw Error(a(60));r.innerHTML=c}}break;case"children":typeof d=="string"?dl(r,d):(typeof d=="number"||typeof d=="bigint")&&dl(r,""+d);break;case"onScroll":d!=null&&ht("scroll",r);break;case"onScrollEnd":d!=null&&ht("scrollend",r);break;case"onClick":d!=null&&(r.onclick=Fa);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zn.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(y=c.endsWith("Capture"),i=c.slice(2,y?c.length-7:void 0),v=r[vt]||null,v=v!=null?v[c]:null,typeof v=="function"&&r.removeEventListener(i,v,y),typeof d=="function")){typeof v!="function"&&v!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(i,d,y);break e}c in r?r[c]=d:d===!0?r.setAttribute(c,""):Wu(r,c,d)}}}function Kn(r,i,c){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ht("error",r),ht("load",r);var d=!1,y=!1,v;for(v in c)if(c.hasOwnProperty(v)){var S=c[v];if(S!=null)switch(v){case"src":d=!0;break;case"srcSet":y=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Lt(r,i,v,S,c,null)}}y&&Lt(r,i,"srcSet",c.srcSet,c,null),d&&Lt(r,i,"src",c.src,c,null);return;case"input":ht("invalid",r);var T=v=S=y=null,Z=null,ie=null;for(d in c)if(c.hasOwnProperty(d)){var de=c[d];if(de!=null)switch(d){case"name":y=de;break;case"type":S=de;break;case"checked":Z=de;break;case"defaultChecked":ie=de;break;case"value":v=de;break;case"defaultValue":T=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(a(137,i));break;default:Lt(r,i,d,de,c,null)}}Vb(r,v,T,Z,ie,S,y,!1);return;case"select":ht("invalid",r),d=S=v=null;for(y in c)if(c.hasOwnProperty(y)&&(T=c[y],T!=null))switch(y){case"value":v=T;break;case"defaultValue":S=T;break;case"multiple":d=T;default:Lt(r,i,y,T,c,null)}i=v,c=S,r.multiple=!!d,i!=null?ul(r,!!d,i,!1):c!=null&&ul(r,!!d,c,!0);return;case"textarea":ht("invalid",r),v=y=d=null;for(S in c)if(c.hasOwnProperty(S)&&(T=c[S],T!=null))switch(S){case"value":d=T;break;case"defaultValue":y=T;break;case"children":v=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(a(91));break;default:Lt(r,i,S,T,c,null)}Kb(r,d,y,v);return;case"option":for(Z in c)if(c.hasOwnProperty(Z)&&(d=c[Z],d!=null))switch(Z){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Lt(r,i,Z,d,c,null)}return;case"dialog":ht("beforetoggle",r),ht("toggle",r),ht("cancel",r),ht("close",r);break;case"iframe":case"object":ht("load",r);break;case"video":case"audio":for(d=0;d<kc.length;d++)ht(kc[d],r);break;case"image":ht("error",r),ht("load",r);break;case"details":ht("toggle",r);break;case"embed":case"source":case"link":ht("error",r),ht("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ie in c)if(c.hasOwnProperty(ie)&&(d=c[ie],d!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:Lt(r,i,ie,d,c,null)}return;default:if($h(i)){for(de in c)c.hasOwnProperty(de)&&(d=c[de],d!==void 0&&_p(r,i,de,d,c,void 0));return}}for(T in c)c.hasOwnProperty(T)&&(d=c[T],d!=null&&Lt(r,i,T,d,c,null))}function M2(r,i,c,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var y=null,v=null,S=null,T=null,Z=null,ie=null,de=null;for(ce in c){var pe=c[ce];if(c.hasOwnProperty(ce)&&pe!=null)switch(ce){case"checked":break;case"value":break;case"defaultValue":Z=pe;default:d.hasOwnProperty(ce)||Lt(r,i,ce,null,d,pe)}}for(var oe in d){var ce=d[oe];if(pe=c[oe],d.hasOwnProperty(oe)&&(ce!=null||pe!=null))switch(oe){case"type":v=ce;break;case"name":y=ce;break;case"checked":ie=ce;break;case"defaultChecked":de=ce;break;case"value":S=ce;break;case"defaultValue":T=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(a(137,i));break;default:ce!==pe&&Lt(r,i,oe,ce,d,pe)}}Bh(r,S,T,Z,ie,de,v,y);return;case"select":ce=S=T=oe=null;for(v in c)if(Z=c[v],c.hasOwnProperty(v)&&Z!=null)switch(v){case"value":break;case"multiple":ce=Z;default:d.hasOwnProperty(v)||Lt(r,i,v,null,d,Z)}for(y in d)if(v=d[y],Z=c[y],d.hasOwnProperty(y)&&(v!=null||Z!=null))switch(y){case"value":oe=v;break;case"defaultValue":T=v;break;case"multiple":S=v;default:v!==Z&&Lt(r,i,y,v,d,Z)}i=T,c=S,d=ce,oe!=null?ul(r,!!c,oe,!1):!!d!=!!c&&(i!=null?ul(r,!!c,i,!0):ul(r,!!c,c?[]:"",!1));return;case"textarea":ce=oe=null;for(T in c)if(y=c[T],c.hasOwnProperty(T)&&y!=null&&!d.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:Lt(r,i,T,null,d,y)}for(S in d)if(y=d[S],v=c[S],d.hasOwnProperty(S)&&(y!=null||v!=null))switch(S){case"value":oe=y;break;case"defaultValue":ce=y;break;case"children":break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(a(91));break;default:y!==v&&Lt(r,i,S,y,d,v)}Qb(r,oe,ce);return;case"option":for(var Re in c)if(oe=c[Re],c.hasOwnProperty(Re)&&oe!=null&&!d.hasOwnProperty(Re))switch(Re){case"selected":r.selected=!1;break;default:Lt(r,i,Re,null,d,oe)}for(Z in d)if(oe=d[Z],ce=c[Z],d.hasOwnProperty(Z)&&oe!==ce&&(oe!=null||ce!=null))switch(Z){case"selected":r.selected=oe&&typeof oe!="function"&&typeof oe!="symbol";break;default:Lt(r,i,Z,oe,d,ce)}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 Ke in c)oe=c[Ke],c.hasOwnProperty(Ke)&&oe!=null&&!d.hasOwnProperty(Ke)&&Lt(r,i,Ke,null,d,oe);for(ie in d)if(oe=d[ie],ce=c[ie],d.hasOwnProperty(ie)&&oe!==ce&&(oe!=null||ce!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(a(137,i));break;default:Lt(r,i,ie,oe,d,ce)}return;default:if($h(i)){for(var Pt in c)oe=c[Pt],c.hasOwnProperty(Pt)&&oe!==void 0&&!d.hasOwnProperty(Pt)&&_p(r,i,Pt,void 0,d,oe);for(de in d)oe=d[de],ce=c[de],!d.hasOwnProperty(de)||oe===ce||oe===void 0&&ce===void 0||_p(r,i,de,oe,d,ce);return}}for(var W in c)oe=c[W],c.hasOwnProperty(W)&&oe!=null&&!d.hasOwnProperty(W)&&Lt(r,i,W,null,d,oe);for(pe in d)oe=d[pe],ce=c[pe],!d.hasOwnProperty(pe)||oe===ce||oe==null&&ce==null||Lt(r,i,pe,oe,d,ce)}function Ww(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function D2(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var y=c[d],v=y.transferSize,S=y.initiatorType,T=y.duration;if(v&&T&&Ww(S)){for(S=0,T=y.responseEnd,d+=1;d<c.length;d++){var Z=c[d],ie=Z.startTime;if(ie>T)break;var de=Z.transferSize,pe=Z.initiatorType;de&&Ww(pe)&&(Z=Z.responseEnd,S+=de*(Z<T?1:(T-ie)/(Z-ie)))}if(--d,i+=8*(v+S)/(y.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Tp=null,Ap=null;function Yd(r){return r.nodeType===9?r:r.ownerDocument}function Jw(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function eS(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function Rp(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Op=null;function z2(){var r=window.event;return r&&r.type==="popstate"?r===Op?!1:(Op=r,!0):(Op=null,!1)}var tS=typeof setTimeout=="function"?setTimeout:void 0,I2=typeof clearTimeout=="function"?clearTimeout:void 0,nS=typeof Promise=="function"?Promise:void 0,L2=typeof queueMicrotask=="function"?queueMicrotask:typeof nS<"u"?function(r){return nS.resolve(null).then(r).catch(P2)}:tS;function P2(r){setTimeout(function(){throw r})}function Zi(r){return r==="head"}function rS(r,i){var c=i,d=0;do{var y=c.nextSibling;if(r.removeChild(c),y&&y.nodeType===8)if(c=y.data,c==="/$"||c==="/&"){if(d===0){r.removeChild(y),$l(i);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")Cc(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,Cc(c);for(var v=c.firstChild;v;){var S=v.nextSibling,T=v.nodeName;v[Ni]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=S}}else c==="body"&&Cc(r.ownerDocument.body);c=y}while(c);$l(i)}function aS(r,i){var c=r;r=0;do{var d=c.nextSibling;if(c.nodeType===1?i?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(i?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=d}while(c)}function Mp(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var c=i;switch(i=i.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Mp(c),$e(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function U2(r,i,c,d){for(;r.nodeType===1;){var y=c;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[Ni])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(v=r.getAttribute("rel"),v==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(v!==y.rel||r.getAttribute("href")!==(y.href==null||y.href===""?null:y.href)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin)||r.getAttribute("title")!==(y.title==null?null:y.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(v=r.getAttribute("src"),(v!==(y.src==null?null:y.src)||r.getAttribute("type")!==(y.type==null?null:y.type)||r.getAttribute("crossorigin")!==(y.crossOrigin==null?null:y.crossOrigin))&&v&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var v=y.name==null?null:""+y.name;if(y.type==="hidden"&&r.getAttribute("name")===v)return r}else return r;if(r=ra(r.nextSibling),r===null)break}return null}function B2(r,i,c){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=ra(r.nextSibling),r===null))return null;return r}function iS(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=ra(r.nextSibling),r===null))return null;return r}function Dp(r){return r.data==="$?"||r.data==="$~"}function zp(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function F2(r,i){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||c.readyState!=="loading")i();else{var d=function(){i(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function ra(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var Ip=null;function sS(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(i===0)return ra(r.nextSibling);i--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||i++}r=r.nextSibling}return null}function lS(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(i===0)return r;i--}else c!=="/$"&&c!=="/&"||i++}r=r.previousSibling}return null}function oS(r,i,c){switch(i=Yd(c),r){case"html":if(r=i.documentElement,!r)throw Error(a(452));return r;case"head":if(r=i.head,!r)throw Error(a(453));return r;case"body":if(r=i.body,!r)throw Error(a(454));return r;default:throw Error(a(451))}}function Cc(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);$e(r)}var aa=new Map,cS=new Set;function Xd(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var ri=se.d;se.d={f:$2,r:H2,D:q2,C:Z2,L:G2,m:V2,X:K2,S:Q2,M:Y2};function $2(){var r=ri.f(),i=$d();return r||i}function H2(r){var i=ge(r);i!==null&&i.tag===5&&i.type==="form"?E0(i):ri.r(r)}var Ul=typeof document>"u"?null:document;function uS(r,i,c){var d=Ul;if(d&&typeof i=="string"&&i){var y=Yr(i);y='link[rel="'+r+'"][href="'+y+'"]',typeof c=="string"&&(y+='[crossorigin="'+c+'"]'),cS.has(y)||(cS.add(y),r={rel:r,crossOrigin:c,href:i},d.querySelector(y)===null&&(i=d.createElement("link"),Kn(i,"link",r),St(i),d.head.appendChild(i)))}}function q2(r){ri.D(r),uS("dns-prefetch",r,null)}function Z2(r,i){ri.C(r,i),uS("preconnect",r,i)}function G2(r,i,c){ri.L(r,i,c);var d=Ul;if(d&&r&&i){var y='link[rel="preload"][as="'+Yr(i)+'"]';i==="image"&&c&&c.imageSrcSet?(y+='[imagesrcset="'+Yr(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(y+='[imagesizes="'+Yr(c.imageSizes)+'"]')):y+='[href="'+Yr(r)+'"]';var v=y;switch(i){case"style":v=Bl(r);break;case"script":v=Fl(r)}aa.has(v)||(r=g({rel:"preload",href:i==="image"&&c&&c.imageSrcSet?void 0:r,as:i},c),aa.set(v,r),d.querySelector(y)!==null||i==="style"&&d.querySelector(Ec(v))||i==="script"&&d.querySelector(Nc(v))||(i=d.createElement("link"),Kn(i,"link",r),St(i),d.head.appendChild(i)))}}function V2(r,i){ri.m(r,i);var c=Ul;if(c&&r){var d=i&&typeof i.as=="string"?i.as:"script",y='link[rel="modulepreload"][as="'+Yr(d)+'"][href="'+Yr(r)+'"]',v=y;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Fl(r)}if(!aa.has(v)&&(r=g({rel:"modulepreload",href:r},i),aa.set(v,r),c.querySelector(y)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Nc(v)))return}d=c.createElement("link"),Kn(d,"link",r),St(d),c.head.appendChild(d)}}}function Q2(r,i,c){ri.S(r,i,c);var d=Ul;if(d&&r){var y=_t(d).hoistableStyles,v=Bl(r);i=i||"default";var S=y.get(v);if(!S){var T={loading:0,preload:null};if(S=d.querySelector(Ec(v)))T.loading=5;else{r=g({rel:"stylesheet",href:r,"data-precedence":i},c),(c=aa.get(v))&&Lp(r,c);var Z=S=d.createElement("link");St(Z),Kn(Z,"link",r),Z._p=new Promise(function(ie,de){Z.onload=ie,Z.onerror=de}),Z.addEventListener("load",function(){T.loading|=1}),Z.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Wd(S,i,d)}S={type:"stylesheet",instance:S,count:1,state:T},y.set(v,S)}}}function K2(r,i){ri.X(r,i);var c=Ul;if(c&&r){var d=_t(c).hoistableScripts,y=Fl(r),v=d.get(y);v||(v=c.querySelector(Nc(y)),v||(r=g({src:r,async:!0},i),(i=aa.get(y))&&Pp(r,i),v=c.createElement("script"),St(v),Kn(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function Y2(r,i){ri.M(r,i);var c=Ul;if(c&&r){var d=_t(c).hoistableScripts,y=Fl(r),v=d.get(y);v||(v=c.querySelector(Nc(y)),v||(r=g({src:r,async:!0,type:"module"},i),(i=aa.get(y))&&Pp(r,i),v=c.createElement("script"),St(v),Kn(v,"link",r),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},d.set(y,v))}}function dS(r,i,c,d){var y=(y=ae.current)?Xd(y):null;if(!y)throw Error(a(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(i=Bl(c.href),c=_t(y).hoistableStyles,d=c.get(i),d||(d={type:"style",instance:null,count:0,state:null},c.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=Bl(c.href);var v=_t(y).hoistableStyles,S=v.get(r);if(S||(y=y.ownerDocument||y,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(r,S),(v=y.querySelector(Ec(r)))&&!v._p&&(S.instance=v,S.state.loading=5),aa.has(r)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},aa.set(r,c),v||X2(y,r,c,S.state))),i&&d===null)throw Error(a(528,""));return S}if(i&&d!==null)throw Error(a(529,""));return null;case"script":return i=c.async,c=c.src,typeof c=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=Fl(c),c=_t(y).hoistableScripts,d=c.get(i),d||(d={type:"script",instance:null,count:0,state:null},c.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,r))}}function Bl(r){return'href="'+Yr(r)+'"'}function Ec(r){return'link[rel="stylesheet"]['+r+"]"}function fS(r){return g({},r,{"data-precedence":r.precedence,precedence:null})}function X2(r,i,c,d){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=r.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),Kn(i,"link",c),St(i),r.head.appendChild(i))}function Fl(r){return'[src="'+Yr(r)+'"]'}function Nc(r){return"script[async]"+r}function hS(r,i,c){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+Yr(c.href)+'"]');if(d)return i.instance=d,St(d),d;var y=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),St(d),Kn(d,"style",y),Wd(d,c.precedence,r),i.instance=d;case"stylesheet":y=Bl(c.href);var v=r.querySelector(Ec(y));if(v)return i.state.loading|=4,i.instance=v,St(v),v;d=fS(c),(y=aa.get(y))&&Lp(d,y),v=(r.ownerDocument||r).createElement("link"),St(v);var S=v;return S._p=new Promise(function(T,Z){S.onload=T,S.onerror=Z}),Kn(v,"link",d),i.state.loading|=4,Wd(v,c.precedence,r),i.instance=v;case"script":return v=Fl(c.src),(y=r.querySelector(Nc(v)))?(i.instance=y,St(y),y):(d=c,(y=aa.get(v))&&(d=g({},c),Pp(d,y)),r=r.ownerDocument||r,y=r.createElement("script"),St(y),Kn(y,"link",d),r.head.appendChild(y),i.instance=y);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,Wd(d,c.precedence,r));return i.instance}function Wd(r,i,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),y=d.length?d[d.length-1]:null,v=y,S=0;S<d.length;S++){var T=d[S];if(T.dataset.precedence===i)v=T;else if(v!==y)break}v?v.parentNode.insertBefore(r,v.nextSibling):(i=c.nodeType===9?c.head:c,i.insertBefore(r,i.firstChild))}function Lp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function Pp(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var Jd=null;function mS(r,i,c){if(Jd===null){var d=new Map,y=Jd=new Map;y.set(c,d)}else y=Jd,d=y.get(c),d||(d=new Map,y.set(c,d));if(d.has(r))return d;for(d.set(r,null),c=c.getElementsByTagName(r),y=0;y<c.length;y++){var v=c[y];if(!(v[Ni]||v[Qe]||r==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var S=v.getAttribute(i)||"";S=r+S;var T=d.get(S);T?T.push(v):d.set(S,[v])}}return d}function pS(r,i,c){r=r.ownerDocument||r,r.head.insertBefore(c,i==="title"?r.querySelector("head > title"):null)}function W2(r,i,c){if(c===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return r=i.disabled,typeof i.precedence=="string"&&r==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function gS(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function J2(r,i,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var y=Bl(d.href),v=i.querySelector(Ec(y));if(v){i=v._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=ef.bind(r),i.then(r,r)),c.state.loading|=4,c.instance=v,St(v);return}v=i.ownerDocument||i,d=fS(d),(y=aa.get(y))&&Lp(d,y),v=v.createElement("link"),St(v);var S=v;S._p=new Promise(function(T,Z){S.onload=T,S.onerror=Z}),Kn(v,"link",d),c.instance=v}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,i),(i=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=ef.bind(r),i.addEventListener("load",c),i.addEventListener("error",c))}}var Up=0;function eR(r,i){return r.stylesheets&&r.count===0&&nf(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var d=setTimeout(function(){if(r.stylesheets&&nf(r,r.stylesheets),r.unsuspend){var v=r.unsuspend;r.unsuspend=null,v()}},6e4+i);0<r.imgBytes&&Up===0&&(Up=62500*D2());var y=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&nf(r,r.stylesheets),r.unsuspend)){var v=r.unsuspend;r.unsuspend=null,v()}},(r.imgBytes>Up?50:800)+i);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(y)}}:null}function ef(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)nf(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var tf=null;function nf(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,tf=new Map,i.forEach(tR,r),tf=null,ef.call(r))}function tR(r,i){if(!(i.state.loading&4)){var c=tf.get(r);if(c)var d=c.get(null);else{c=new Map,tf.set(r,c);for(var y=r.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<y.length;v++){var S=y[v];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(c.set(S.dataset.precedence,S),d=S)}d&&c.set(null,d)}y=i.instance,S=y.getAttribute("data-precedence"),v=c.get(S)||d,v===d&&c.set(null,y),c.set(S,y),this.count++,d=ef.bind(this),y.addEventListener("load",d),y.addEventListener("error",d),v?v.parentNode.insertBefore(y,v.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(y,r.firstChild)),i.state.loading|=4}}var _c={$$typeof:A,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function nR(r,i,c,d,y,v,S,T,Z){this.tag=1,this.containerInfo=r,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=wi(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=wi(0),this.hiddenUpdates=wi(null),this.identifierPrefix=d,this.onUncaughtError=y,this.onCaughtError=v,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Z,this.incompleteTransitions=new Map}function yS(r,i,c,d,y,v,S,T,Z,ie,de,pe){return r=new nR(r,i,c,S,Z,ie,de,pe,T),i=1,v===!0&&(i|=24),v=Ir(3,null,null,i),r.current=v,v.stateNode=r,i=vm(),i.refCount++,r.pooledCache=i,i.refCount++,v.memoizedState={element:d,isDehydrated:c,cache:i},Sm(v),r}function vS(r){return r?(r=vl,r):vl}function bS(r,i,c,d,y,v){y=vS(y),d.context===null?d.context=y:d.pendingContext=y,d=Di(i),d.payload={element:c},v=v===void 0?null:v,v!==null&&(d.callback=v),c=zi(r,d,i),c!==null&&(jr(c,r,i),sc(c,r,i))}function xS(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<i?c:i}}function Bp(r,i){xS(r,i),(r=r.alternate)&&xS(r,i)}function wS(r){if(r.tag===13||r.tag===31){var i=_s(r,67108864);i!==null&&jr(i,r,67108864),Bp(r,67108864)}}function SS(r){if(r.tag===13||r.tag===31){var i=Fr();i=Ln(i);var c=_s(r,i);c!==null&&jr(c,r,i),Bp(r,i)}}var rf=!0;function rR(r,i,c,d){var y=G.T;G.T=null;var v=se.p;try{se.p=2,Fp(r,i,c,d)}finally{se.p=v,G.T=y}}function aR(r,i,c,d){var y=G.T;G.T=null;var v=se.p;try{se.p=8,Fp(r,i,c,d)}finally{se.p=v,G.T=y}}function Fp(r,i,c,d){if(rf){var y=$p(d);if(y===null)Np(r,i,d,af,c),jS(r,d);else if(sR(y,r,i,c,d))d.stopPropagation();else if(jS(r,d),i&4&&-1<iR.indexOf(r)){for(;y!==null;){var v=ge(y);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var S=Hn(v.pendingLanes);if(S!==0){var T=v;for(T.pendingLanes|=2,T.entangledLanes|=2;S;){var Z=1<<31-yt(S);T.entanglements[1]|=Z,S&=~Z}_a(v),(Rt&6)===0&&(Bd=nt()+500,Sc(0))}}break;case 31:case 13:T=_s(v,2),T!==null&&jr(T,v,2),$d(),Bp(v,2)}if(v=$p(d),v===null&&Np(r,i,d,af,c),v===y)break;y=v}y!==null&&d.stopPropagation()}else Np(r,i,d,null,c)}}function $p(r){return r=qh(r),Hp(r)}var af=null;function Hp(r){if(af=null,r=q(r),r!==null){var i=o(r);if(i===null)r=null;else{var c=i.tag;if(c===13){if(r=u(i),r!==null)return r;r=null}else if(c===31){if(r=f(i),r!==null)return r;r=null}else if(c===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return af=r,null}function kS(r){switch(r){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(An()){case ue:return 2;case be:return 8;case Ne:case Xe:return 32;case wt:return 268435456;default:return 32}default:return 32}}var qp=!1,Gi=null,Vi=null,Qi=null,Tc=new Map,Ac=new Map,Ki=[],iR="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 jS(r,i){switch(r){case"focusin":case"focusout":Gi=null;break;case"dragenter":case"dragleave":Vi=null;break;case"mouseover":case"mouseout":Qi=null;break;case"pointerover":case"pointerout":Tc.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ac.delete(i.pointerId)}}function Rc(r,i,c,d,y,v){return r===null||r.nativeEvent!==v?(r={blockedOn:i,domEventName:c,eventSystemFlags:d,nativeEvent:v,targetContainers:[y]},i!==null&&(i=ge(i),i!==null&&wS(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,y!==null&&i.indexOf(y)===-1&&i.push(y),r)}function sR(r,i,c,d,y){switch(i){case"focusin":return Gi=Rc(Gi,r,i,c,d,y),!0;case"dragenter":return Vi=Rc(Vi,r,i,c,d,y),!0;case"mouseover":return Qi=Rc(Qi,r,i,c,d,y),!0;case"pointerover":var v=y.pointerId;return Tc.set(v,Rc(Tc.get(v)||null,r,i,c,d,y)),!0;case"gotpointercapture":return v=y.pointerId,Ac.set(v,Rc(Ac.get(v)||null,r,i,c,d,y)),!0}return!1}function CS(r){var i=q(r.target);if(i!==null){var c=o(i);if(c!==null){if(i=c.tag,i===13){if(i=u(c),i!==null){r.blockedOn=i,Ei(r.priority,function(){SS(c)});return}}else if(i===31){if(i=f(c),i!==null){r.blockedOn=i,Ei(r.priority,function(){SS(c)});return}}else if(i===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function sf(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var c=$p(r.nativeEvent);if(c===null){c=r.nativeEvent;var d=new c.constructor(c.type,c);Hh=d,c.target.dispatchEvent(d),Hh=null}else return i=ge(c),i!==null&&wS(i),r.blockedOn=c,!1;i.shift()}return!0}function ES(r,i,c){sf(r)&&c.delete(i)}function lR(){qp=!1,Gi!==null&&sf(Gi)&&(Gi=null),Vi!==null&&sf(Vi)&&(Vi=null),Qi!==null&&sf(Qi)&&(Qi=null),Tc.forEach(ES),Ac.forEach(ES)}function lf(r,i){r.blockedOn===i&&(r.blockedOn=null,qp||(qp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,lR)))}var of=null;function NS(r){of!==r&&(of=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){of===r&&(of=null);for(var i=0;i<r.length;i+=3){var c=r[i],d=r[i+1],y=r[i+2];if(typeof d!="function"){if(Hp(d||c)===null)continue;break}var v=ge(c);v!==null&&(r.splice(i,3),i-=3,$m(v,{pending:!0,data:y,method:c.method,action:d},d,y))}}))}function $l(r){function i(Z){return lf(Z,r)}Gi!==null&&lf(Gi,r),Vi!==null&&lf(Vi,r),Qi!==null&&lf(Qi,r),Tc.forEach(i),Ac.forEach(i);for(var c=0;c<Ki.length;c++){var d=Ki[c];d.blockedOn===r&&(d.blockedOn=null)}for(;0<Ki.length&&(c=Ki[0],c.blockedOn===null);)CS(c),c.blockedOn===null&&Ki.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var y=c[d],v=c[d+1],S=y[vt]||null;if(typeof v=="function")S||NS(c);else if(S){var T=null;if(v&&v.hasAttribute("formAction")){if(y=v,S=v[vt]||null)T=S.formAction;else if(Hp(y)!==null)continue}else T=S.action;typeof T=="function"?c[d+1]=T:(c.splice(d,3),d-=3),NS(c)}}}function _S(){function r(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(S){return y=S})},focusReset:"manual",scroll:"manual"})}function i(){y!==null&&(y(),y=null),d||setTimeout(c,20)}function c(){if(!d&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,y=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),y!==null&&(y(),y=null)}}}function Zp(r){this._internalRoot=r}cf.prototype.render=Zp.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(a(409));var c=i.current,d=Fr();bS(c,d,r,i,null,null)},cf.prototype.unmount=Zp.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;bS(r.current,2,null,r,null,null),$d(),i[qn]=null}};function cf(r){this._internalRoot=r}cf.prototype.unstable_scheduleHydration=function(r){if(r){var i=Ci();r={blockedOn:null,target:r,priority:i};for(var c=0;c<Ki.length&&i!==0&&i<Ki[c].priority;c++);Ki.splice(c,0,r),c===0&&CS(r)}};var TS=t.version;if(TS!=="19.2.4")throw Error(a(527,TS,"19.2.4"));se.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(a(188)):(r=Object.keys(r).join(","),Error(a(268,r)));return r=h(i),r=r!==null?p(r):null,r=r===null?null:r.stateNode,r};var oR={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:G,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var uf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!uf.isDisabled&&uf.supportsFiber)try{Yt=uf.inject(oR),qt=uf}catch{}}return Mc.createRoot=function(r,i){if(!s(r))throw Error(a(299));var c=!1,d="",y=I0,v=L0,S=P0;return i!=null&&(i.unstable_strictMode===!0&&(c=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(v=i.onCaughtError),i.onRecoverableError!==void 0&&(S=i.onRecoverableError)),i=yS(r,1,!1,null,null,c,d,null,y,v,S,_S),r[qn]=i.current,Ep(r),new Zp(i)},Mc.hydrateRoot=function(r,i,c){if(!s(r))throw Error(a(299));var d=!1,y="",v=I0,S=L0,T=P0,Z=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(y=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(S=c.onCaughtError),c.onRecoverableError!==void 0&&(T=c.onRecoverableError),c.formState!==void 0&&(Z=c.formState)),i=yS(r,1,!0,i,c??null,d,y,Z,v,S,T,_S),i.context=vS(null),c=i.current,d=Fr(),d=Ln(d),y=Di(d),y.callback=null,zi(c,y,d),c=d,i.current.lanes=c,ga(i,c),_a(i),r[qn]=i.current,Ep(r),new cf(i)},Mc.version="19.2.4",Mc}var BS;function bR(){if(BS)return Kp.exports;BS=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(),Kp.exports=vR(),Kp.exports}var xR=bR(),il=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(){}},Gs,rs,oo,Bj,wR=(Bj=class extends il{constructor(){super();Te(this,Gs);Te(this,rs);Te(this,oo);je(this,oo,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){$(this,rs)||this.setEventListener($(this,oo))}onUnsubscribe(){var t;this.hasListeners()||((t=$(this,rs))==null||t.call(this),je(this,rs,void 0))}setEventListener(t){var n;je(this,oo,t),(n=$(this,rs))==null||n.call(this),je(this,rs,t(a=>{typeof a=="boolean"?this.setFocused(a):this.onFocus()}))}setFocused(t){$(this,Gs)!==t&&(je(this,Gs,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof $(this,Gs)=="boolean"?$(this,Gs):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Gs=new WeakMap,rs=new WeakMap,oo=new WeakMap,Bj),dv=new wR,SR={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},as,ov,Fj,kR=(Fj=class{constructor(){Te(this,as,SR);Te(this,ov,!1)}setTimeoutProvider(e){je(this,as,e)}setTimeout(e,t){return $(this,as).setTimeout(e,t)}clearTimeout(e){$(this,as).clearTimeout(e)}setInterval(e,t){return $(this,as).setInterval(e,t)}clearInterval(e){$(this,as).clearInterval(e)}},as=new WeakMap,ov=new WeakMap,Fj),qs=new kR;function jR(e){setTimeout(e,0)}var CR=typeof window>"u"||"Deno"in globalThis;function nr(){}function ER(e,t){return typeof e=="function"?e(t):e}function Kg(e){return typeof e=="number"&&e>=0&&e!==1/0}function Jj(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ms(e,t){return typeof e=="function"?e(t):e}function oa(e,t){return typeof e=="function"?e(t):e}function FS(e,t){const{type:n="all",exact:a,fetchStatus:s,predicate:o,queryKey:u,stale:f}=e;if(u){if(a){if(t.queryHash!==fv(u,t.options))return!1}else if(!su(t.queryKey,u))return!1}if(n!=="all"){const m=t.isActive();if(n==="active"&&!m||n==="inactive"&&m)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||s&&s!==t.state.fetchStatus||o&&!o(t))}function $S(e,t){const{exact:n,status:a,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(tl(t.options.mutationKey)!==tl(o))return!1}else if(!su(t.options.mutationKey,o))return!1}return!(a&&t.state.status!==a||s&&!s(t))}function fv(e,t){return((t==null?void 0:t.queryKeyHashFn)||tl)(e)}function tl(e){return JSON.stringify(e,(t,n)=>Yg(n)?Object.keys(n).sort().reduce((a,s)=>(a[s]=n[s],a),{}):n)}function su(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>su(e[n],t[n])):!1}var NR=Object.prototype.hasOwnProperty;function hv(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=HS(e)&&HS(t);if(!a&&!(Yg(e)&&Yg(t)))return t;const o=(a?e:Object.keys(e)).length,u=a?t:Object.keys(t),f=u.length,m=a?new Array(f):{};let h=0;for(let p=0;p<f;p++){const g=a?p:u[p],w=e[g],x=t[g];if(w===x){m[g]=w,(a?p<o:NR.call(e,g))&&h++;continue}if(w===null||x===null||typeof w!="object"||typeof x!="object"){m[g]=x;continue}const k=hv(w,x,n+1);m[g]=k,k===w&&h++}return o===f&&h===o?e:m}function lu(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function HS(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Yg(e){if(!qS(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!qS(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function qS(e){return Object.prototype.toString.call(e)==="[object Object]"}function _R(e){return new Promise(t=>{qs.setTimeout(t,e)})}function Xg(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?hv(e,t):t}function TR(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function AR(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var mv=Symbol();function eC(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===mv?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function pv(e,t){return typeof e=="function"?e(...t):!!e}function RR(e,t,n){let a=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??(s=t()),a||(a=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}var ou=(()=>{let e=()=>CR;return{isServer(){return e()},setIsServer(t){e=t}}})();function Wg(){let e,t;const n=new Promise((s,o)=>{e=s,t=o});n.status="pending",n.catch(()=>{});function a(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{a({status:"fulfilled",value:s}),e(s)},n.reject=s=>{a({status:"rejected",reason:s}),t(s)},n}var OR=jR;function MR(){let e=[],t=0,n=f=>{f()},a=f=>{f()},s=OR;const o=f=>{t?e.push(f):s(()=>{n(f)})},u=()=>{const f=e;e=[],f.length&&s(()=>{a(()=>{f.forEach(m=>{n(m)})})})};return{batch:f=>{let m;t++;try{m=f()}finally{t--,t||u()}return m},batchCalls:f=>(...m)=>{o(()=>{f(...m)})},schedule:o,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{a=f},setScheduler:f=>{s=f}}}var fn=MR(),co,is,uo,$j,DR=($j=class extends il{constructor(){super();Te(this,co,!0);Te(this,is);Te(this,uo);je(this,uo,t=>{if(typeof window<"u"&&window.addEventListener){const n=()=>t(!0),a=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",a,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",a)}}})}onSubscribe(){$(this,is)||this.setEventListener($(this,uo))}onUnsubscribe(){var t;this.hasListeners()||((t=$(this,is))==null||t.call(this),je(this,is,void 0))}setEventListener(t){var n;je(this,uo,t),(n=$(this,is))==null||n.call(this),je(this,is,t(this.setOnline.bind(this)))}setOnline(t){$(this,co)!==t&&(je(this,co,t),this.listeners.forEach(a=>{a(t)}))}isOnline(){return $(this,co)}},co=new WeakMap,is=new WeakMap,uo=new WeakMap,$j),$f=new DR;function zR(e){return Math.min(1e3*2**e,3e4)}function tC(e){return(e??"online")==="online"?$f.isOnline():!0}var Jg=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function nC(e){let t=!1,n=0,a;const s=Wg(),o=()=>s.status!=="pending",u=C=>{var j;if(!o()){const E=new Jg(C);w(E),(j=e.onCancel)==null||j.call(e,E)}},f=()=>{t=!0},m=()=>{t=!1},h=()=>dv.isFocused()&&(e.networkMode==="always"||$f.isOnline())&&e.canRun(),p=()=>tC(e.networkMode)&&e.canRun(),g=C=>{o()||(a==null||a(),s.resolve(C))},w=C=>{o()||(a==null||a(),s.reject(C))},x=()=>new Promise(C=>{var j;a=E=>{(o()||h())&&C(E)},(j=e.onPause)==null||j.call(e)}).then(()=>{var C;a=void 0,o()||(C=e.onContinue)==null||C.call(e)}),k=()=>{if(o())return;let C;const j=n===0?e.initialPromise:void 0;try{C=j??e.fn()}catch(E){C=Promise.reject(E)}Promise.resolve(C).then(g).catch(E=>{var R;if(o())return;const O=e.retry??(ou.isServer()?0:3),A=e.retryDelay??zR,D=typeof A=="function"?A(n,E):A,z=O===!0||typeof O=="number"&&n<O||typeof O=="function"&&O(n,E);if(t||!z){w(E);return}n++,(R=e.onFail)==null||R.call(e,n,E),_R(D).then(()=>h()?void 0:x()).then(()=>{t?w(E):k()})})};return{promise:s,status:()=>s.status,cancel:u,continue:()=>(a==null||a(),s),cancelRetry:f,continueRetry:m,canStart:p,start:()=>(p()?k():x().then(k),s)}}var Vs,Hj,rC=(Hj=class{constructor(){Te(this,Vs)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Kg(this.gcTime)&&je(this,Vs,qs.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(ou.isServer()?1/0:300*1e3))}clearGcTimeout(){$(this,Vs)&&(qs.clearTimeout($(this,Vs)),je(this,Vs,void 0))}},Vs=new WeakMap,Hj),Qs,fo,sa,Ks,Bn,ju,Ys,qr,aC,ii,qj,IR=(qj=class extends rC{constructor(t){super();Te(this,qr);Te(this,Qs);Te(this,fo);Te(this,sa);Te(this,Ks);Te(this,Bn);Te(this,ju);Te(this,Ys);je(this,Ys,!1),je(this,ju,t.defaultOptions),this.setOptions(t.options),this.observers=[],je(this,Ks,t.client),je(this,sa,$(this,Ks).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,je(this,Qs,GS(this.options)),this.state=t.state??$(this,Qs),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=$(this,Bn))==null?void 0:t.promise}setOptions(t){if(this.options={...$(this,ju),...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=GS(this.options);n.data!==void 0&&(this.setState(ZS(n.data,n.dataUpdatedAt)),je(this,Qs,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&$(this,sa).remove(this)}setData(t,n){const a=Xg(this.state.data,t,this.options);return Ye(this,qr,ii).call(this,{data:a,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),a}setState(t,n){Ye(this,qr,ii).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var a,s;const n=(a=$(this,Bn))==null?void 0:a.promise;return(s=$(this,Bn))==null||s.cancel(t),n?n.then(nr).catch(nr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return $(this,Qs)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>oa(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===mv||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ms(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:!Jj(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(a=>a.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=$(this,Bn))==null||n.continue()}onOnline(){var n;const t=this.observers.find(a=>a.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=$(this,Bn))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),$(this,sa).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||($(this,Bn)&&($(this,Ys)||Ye(this,qr,aC).call(this)?$(this,Bn).cancel({revert:!0}):$(this,Bn).cancelRetry()),this.scheduleGc()),$(this,sa).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Ye(this,qr,ii).call(this,{type:"invalidate"})}async fetch(t,n){var m,h,p,g,w,x,k,C,j,E,O,A;if(this.state.fetchStatus!=="idle"&&((m=$(this,Bn))==null?void 0:m.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if($(this,Bn))return $(this,Bn).continueRetry(),$(this,Bn).promise}if(t&&this.setOptions(t),!this.options.queryFn){const D=this.observers.find(z=>z.options.queryFn);D&&this.setOptions(D.options)}const a=new AbortController,s=D=>{Object.defineProperty(D,"signal",{enumerable:!0,get:()=>(je(this,Ys,!0),a.signal)})},o=()=>{const D=eC(this.options,n),R=(()=>{const F={client:$(this,Ks),queryKey:this.queryKey,meta:this.meta};return s(F),F})();return je(this,Ys,!1),this.options.persister?this.options.persister(D,R,this):D(R)},f=(()=>{const D={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:$(this,Ks),state:this.state,fetchFn:o};return s(D),D})();(h=this.options.behavior)==null||h.onFetch(f,this),je(this,fo,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=f.fetchOptions)==null?void 0:p.meta))&&Ye(this,qr,ii).call(this,{type:"fetch",meta:(g=f.fetchOptions)==null?void 0:g.meta}),je(this,Bn,nC({initialPromise:n==null?void 0:n.initialPromise,fn:f.fetchFn,onCancel:D=>{D instanceof Jg&&D.revert&&this.setState({...$(this,fo),fetchStatus:"idle"}),a.abort()},onFail:(D,z)=>{Ye(this,qr,ii).call(this,{type:"failed",failureCount:D,error:z})},onPause:()=>{Ye(this,qr,ii).call(this,{type:"pause"})},onContinue:()=>{Ye(this,qr,ii).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0}));try{const D=await $(this,Bn).start();if(D===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(D),(x=(w=$(this,sa).config).onSuccess)==null||x.call(w,D,this),(C=(k=$(this,sa).config).onSettled)==null||C.call(k,D,this.state.error,this),D}catch(D){if(D instanceof Jg){if(D.silent)return $(this,Bn).promise;if(D.revert){if(this.state.data===void 0)throw D;return this.state.data}}throw Ye(this,qr,ii).call(this,{type:"error",error:D}),(E=(j=$(this,sa).config).onError)==null||E.call(j,D,this),(A=(O=$(this,sa).config).onSettled)==null||A.call(O,this.state.data,D,this),D}finally{this.scheduleGc()}}},Qs=new WeakMap,fo=new WeakMap,sa=new WeakMap,Ks=new WeakMap,Bn=new WeakMap,ju=new WeakMap,Ys=new WeakMap,qr=new WeakSet,aC=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},ii=function(t){const n=a=>{switch(t.type){case"failed":return{...a,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...a,fetchStatus:"paused"};case"continue":return{...a,fetchStatus:"fetching"};case"fetch":return{...a,...iC(a.data,this.options),fetchMeta:t.meta??null};case"success":const s={...a,...ZS(t.data,t.dataUpdatedAt),dataUpdateCount:a.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return je(this,fo,t.manual?s:void 0),s;case"error":const o=t.error;return{...a,error:o,errorUpdateCount:a.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:a.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...a,isInvalidated:!0};case"setState":return{...a,...t.state}}};this.state=n(this.state),fn.batch(()=>{this.observers.forEach(a=>{a.onQueryUpdate()}),$(this,sa).notify({query:this,type:"updated",action:t})})},qj);function iC(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:tC(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ZS(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function GS(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,a=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Nr,jt,Cu,dr,Xs,ho,si,ss,Eu,mo,po,Ws,Js,ls,go,Mt,Yc,ey,ty,ny,ry,ay,iy,sy,sC,Zj,gv=(Zj=class extends il{constructor(t,n){super();Te(this,Mt);Te(this,Nr);Te(this,jt);Te(this,Cu);Te(this,dr);Te(this,Xs);Te(this,ho);Te(this,si);Te(this,ss);Te(this,Eu);Te(this,mo);Te(this,po);Te(this,Ws);Te(this,Js);Te(this,ls);Te(this,go,new Set);this.options=n,je(this,Nr,t),je(this,ss,null),je(this,si,Wg()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&($(this,jt).addObserver(this),VS($(this,jt),this.options)?Ye(this,Mt,Yc).call(this):this.updateResult(),Ye(this,Mt,ry).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return ly($(this,jt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return ly($(this,jt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Ye(this,Mt,ay).call(this),Ye(this,Mt,iy).call(this),$(this,jt).removeObserver(this)}setOptions(t){const n=this.options,a=$(this,jt);if(this.options=$(this,Nr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof oa(this.options.enabled,$(this,jt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Ye(this,Mt,sy).call(this),$(this,jt).setOptions(this.options),n._defaulted&&!lu(this.options,n)&&$(this,Nr).getQueryCache().notify({type:"observerOptionsUpdated",query:$(this,jt),observer:this});const s=this.hasListeners();s&&QS($(this,jt),a,this.options,n)&&Ye(this,Mt,Yc).call(this),this.updateResult(),s&&($(this,jt)!==a||oa(this.options.enabled,$(this,jt))!==oa(n.enabled,$(this,jt))||ms(this.options.staleTime,$(this,jt))!==ms(n.staleTime,$(this,jt)))&&Ye(this,Mt,ey).call(this);const o=Ye(this,Mt,ty).call(this);s&&($(this,jt)!==a||oa(this.options.enabled,$(this,jt))!==oa(n.enabled,$(this,jt))||o!==$(this,ls))&&Ye(this,Mt,ny).call(this,o)}getOptimisticResult(t){const n=$(this,Nr).getQueryCache().build($(this,Nr),t),a=this.createResult(n,t);return PR(this,a)&&(je(this,dr,a),je(this,ho,this.options),je(this,Xs,$(this,jt).state)),a}getCurrentResult(){return $(this,dr)}trackResult(t,n){return new Proxy(t,{get:(a,s)=>(this.trackProp(s),n==null||n(s),s==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&$(this,si).status==="pending"&&$(this,si).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,s))})}trackProp(t){$(this,go).add(t)}getCurrentQuery(){return $(this,jt)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=$(this,Nr).defaultQueryOptions(t),a=$(this,Nr).getQueryCache().build($(this,Nr),n);return a.fetch().then(()=>this.createResult(a,n))}fetch(t){return Ye(this,Mt,Yc).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),$(this,dr)))}createResult(t,n){var ee;const a=$(this,jt),s=this.options,o=$(this,dr),u=$(this,Xs),f=$(this,ho),h=t!==a?t.state:$(this,Cu),{state:p}=t;let g={...p},w=!1,x;if(n._optimisticResults){const L=this.hasListeners(),I=!L&&VS(t,n),Q=L&&QS(t,a,n,s);(I||Q)&&(g={...g,...iC(p.data,t.options)}),n._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:k,errorUpdatedAt:C,status:j}=g;x=g.data;let E=!1;if(n.placeholderData!==void 0&&x===void 0&&j==="pending"){let L;o!=null&&o.isPlaceholderData&&n.placeholderData===(f==null?void 0:f.placeholderData)?(L=o.data,E=!0):L=typeof n.placeholderData=="function"?n.placeholderData((ee=$(this,po))==null?void 0:ee.state.data,$(this,po)):n.placeholderData,L!==void 0&&(j="success",x=Xg(o==null?void 0:o.data,L,n),w=!0)}if(n.select&&x!==void 0&&!E)if(o&&x===(u==null?void 0:u.data)&&n.select===$(this,Eu))x=$(this,mo);else try{je(this,Eu,n.select),x=n.select(x),x=Xg(o==null?void 0:o.data,x,n),je(this,mo,x),je(this,ss,null)}catch(L){je(this,ss,L)}$(this,ss)&&(k=$(this,ss),x=$(this,mo),C=Date.now(),j="error");const O=g.fetchStatus==="fetching",A=j==="pending",D=j==="error",z=A&&O,R=x!==void 0,B={status:j,fetchStatus:g.fetchStatus,isPending:A,isSuccess:j==="success",isError:D,isInitialLoading:z,isLoading:z,data:x,dataUpdatedAt:g.dataUpdatedAt,error:k,errorUpdatedAt:C,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>h.dataUpdateCount||g.errorUpdateCount>h.errorUpdateCount,isFetching:O,isRefetching:O&&!A,isLoadingError:D&&!R,isPaused:g.fetchStatus==="paused",isPlaceholderData:w,isRefetchError:D&&R,isStale:yv(t,n),refetch:this.refetch,promise:$(this,si),isEnabled:oa(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const L=B.data!==void 0,I=B.status==="error"&&!L,Q=X=>{I?X.reject(B.error):L&&X.resolve(B.data)},te=()=>{const X=je(this,si,B.promise=Wg());Q(X)},Y=$(this,si);switch(Y.status){case"pending":t.queryHash===a.queryHash&&Q(Y);break;case"fulfilled":(I||B.data!==Y.value)&&te();break;case"rejected":(!I||B.error!==Y.reason)&&te();break}}return B}updateResult(){const t=$(this,dr),n=this.createResult($(this,jt),this.options);if(je(this,Xs,$(this,jt).state),je(this,ho,this.options),$(this,Xs).data!==void 0&&je(this,po,$(this,jt)),lu(n,t))return;je(this,dr,n);const a=()=>{if(!t)return!0;const{notifyOnChangeProps:s}=this.options,o=typeof s=="function"?s():s;if(o==="all"||!o&&!$(this,go).size)return!0;const u=new Set(o??$(this,go));return this.options.throwOnError&&u.add("error"),Object.keys($(this,dr)).some(f=>{const m=f;return $(this,dr)[m]!==t[m]&&u.has(m)})};Ye(this,Mt,sC).call(this,{listeners:a()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Ye(this,Mt,ry).call(this)}},Nr=new WeakMap,jt=new WeakMap,Cu=new WeakMap,dr=new WeakMap,Xs=new WeakMap,ho=new WeakMap,si=new WeakMap,ss=new WeakMap,Eu=new WeakMap,mo=new WeakMap,po=new WeakMap,Ws=new WeakMap,Js=new WeakMap,ls=new WeakMap,go=new WeakMap,Mt=new WeakSet,Yc=function(t){Ye(this,Mt,sy).call(this);let n=$(this,jt).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(nr)),n},ey=function(){Ye(this,Mt,ay).call(this);const t=ms(this.options.staleTime,$(this,jt));if(ou.isServer()||$(this,dr).isStale||!Kg(t))return;const a=Jj($(this,dr).dataUpdatedAt,t)+1;je(this,Ws,qs.setTimeout(()=>{$(this,dr).isStale||this.updateResult()},a))},ty=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval($(this,jt)):this.options.refetchInterval)??!1},ny=function(t){Ye(this,Mt,iy).call(this),je(this,ls,t),!(ou.isServer()||oa(this.options.enabled,$(this,jt))===!1||!Kg($(this,ls))||$(this,ls)===0)&&je(this,Js,qs.setInterval(()=>{(this.options.refetchIntervalInBackground||dv.isFocused())&&Ye(this,Mt,Yc).call(this)},$(this,ls)))},ry=function(){Ye(this,Mt,ey).call(this),Ye(this,Mt,ny).call(this,Ye(this,Mt,ty).call(this))},ay=function(){$(this,Ws)&&(qs.clearTimeout($(this,Ws)),je(this,Ws,void 0))},iy=function(){$(this,Js)&&(qs.clearInterval($(this,Js)),je(this,Js,void 0))},sy=function(){const t=$(this,Nr).getQueryCache().build($(this,Nr),this.options);if(t===$(this,jt))return;const n=$(this,jt);je(this,jt,t),je(this,Cu,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},sC=function(t){fn.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n($(this,dr))}),$(this,Nr).getQueryCache().notify({query:$(this,jt),type:"observerResultsUpdated"})})},Zj);function LR(e,t){return oa(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function VS(e,t){return LR(e,t)||e.state.data!==void 0&&ly(e,t,t.refetchOnMount)}function ly(e,t,n){if(oa(t.enabled,e)!==!1&&ms(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&yv(e,t)}return!1}function QS(e,t,n,a){return(e!==t||oa(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&yv(e,n)}function yv(e,t){return oa(t.enabled,e)!==!1&&e.isStaleByTime(ms(t.staleTime,e))}function PR(e,t){return!lu(e.getCurrentResult(),t)}function KS(e){return{onFetch:(t,n)=>{var p,g,w,x,k;const a=t.options,s=(w=(g=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:g.fetchMore)==null?void 0:w.direction,o=((x=t.state.data)==null?void 0:x.pages)||[],u=((k=t.state.data)==null?void 0:k.pageParams)||[];let f={pages:[],pageParams:[]},m=0;const h=async()=>{let C=!1;const j=A=>{RR(A,()=>t.signal,()=>C=!0)},E=eC(t.options,t.fetchOptions),O=async(A,D,z)=>{if(C)return Promise.reject();if(D==null&&A.pages.length)return Promise.resolve(A);const F=(()=>{const I={client:t.client,queryKey:t.queryKey,pageParam:D,direction:z?"backward":"forward",meta:t.options.meta};return j(I),I})(),B=await E(F),{maxPages:ee}=t.options,L=z?AR:TR;return{pages:L(A.pages,B,ee),pageParams:L(A.pageParams,D,ee)}};if(s&&o.length){const A=s==="backward",D=A?UR:YS,z={pages:o,pageParams:u},R=D(a,z);f=await O(z,R,A)}else{const A=e??o.length;do{const D=m===0?u[0]??a.initialPageParam:YS(a,f);if(m>0&&D==null)break;f=await O(f,D),m++}while(m<A)}return f};t.options.persister?t.fetchFn=()=>{var C,j;return(j=(C=t.options).persister)==null?void 0:j.call(C,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=h}}}function YS(e,{pages:t,pageParams:n}){const a=t.length-1;return t.length>0?e.getNextPageParam(t[a],t,n[a],n):void 0}function UR(e,{pages:t,pageParams:n}){var a;return t.length>0?(a=e.getPreviousPageParam)==null?void 0:a.call(e,t[0],t,n[0],n):void 0}var Nu,Aa,er,el,Ra,es,Gj,BR=(Gj=class extends rC{constructor(t){super();Te(this,Ra);Te(this,Nu);Te(this,Aa);Te(this,er);Te(this,el);je(this,Nu,t.client),this.mutationId=t.mutationId,je(this,er,t.mutationCache),je(this,Aa,[]),this.state=t.state||lC(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){$(this,Aa).includes(t)||($(this,Aa).push(t),this.clearGcTimeout(),$(this,er).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){je(this,Aa,$(this,Aa).filter(n=>n!==t)),this.scheduleGc(),$(this,er).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){$(this,Aa).length||(this.state.status==="pending"?this.scheduleGc():$(this,er).remove(this))}continue(){var t;return((t=$(this,el))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var u,f,m,h,p,g,w,x,k,C,j,E,O,A,D,z,R,F;const n=()=>{Ye(this,Ra,es).call(this,{type:"continue"})},a={client:$(this,Nu),meta:this.options.meta,mutationKey:this.options.mutationKey};je(this,el,nC({fn:()=>this.options.mutationFn?this.options.mutationFn(t,a):Promise.reject(new Error("No mutationFn found")),onFail:(B,ee)=>{Ye(this,Ra,es).call(this,{type:"failed",failureCount:B,error:ee})},onPause:()=>{Ye(this,Ra,es).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>$(this,er).canRun(this)}));const s=this.state.status==="pending",o=!$(this,el).canStart();try{if(s)n();else{Ye(this,Ra,es).call(this,{type:"pending",variables:t,isPaused:o}),$(this,er).config.onMutate&&await $(this,er).config.onMutate(t,this,a);const ee=await((f=(u=this.options).onMutate)==null?void 0:f.call(u,t,a));ee!==this.state.context&&Ye(this,Ra,es).call(this,{type:"pending",context:ee,variables:t,isPaused:o})}const B=await $(this,el).start();return await((h=(m=$(this,er).config).onSuccess)==null?void 0:h.call(m,B,t,this.state.context,this,a)),await((g=(p=this.options).onSuccess)==null?void 0:g.call(p,B,t,this.state.context,a)),await((x=(w=$(this,er).config).onSettled)==null?void 0:x.call(w,B,null,this.state.variables,this.state.context,this,a)),await((C=(k=this.options).onSettled)==null?void 0:C.call(k,B,null,t,this.state.context,a)),Ye(this,Ra,es).call(this,{type:"success",data:B}),B}catch(B){try{await((E=(j=$(this,er).config).onError)==null?void 0:E.call(j,B,t,this.state.context,this,a))}catch(ee){Promise.reject(ee)}try{await((A=(O=this.options).onError)==null?void 0:A.call(O,B,t,this.state.context,a))}catch(ee){Promise.reject(ee)}try{await((z=(D=$(this,er).config).onSettled)==null?void 0:z.call(D,void 0,B,this.state.variables,this.state.context,this,a))}catch(ee){Promise.reject(ee)}try{await((F=(R=this.options).onSettled)==null?void 0:F.call(R,void 0,B,t,this.state.context,a))}catch(ee){Promise.reject(ee)}throw Ye(this,Ra,es).call(this,{type:"error",error:B}),B}finally{$(this,er).runNext(this)}}},Nu=new WeakMap,Aa=new WeakMap,er=new WeakMap,el=new WeakMap,Ra=new WeakSet,es=function(t){const n=a=>{switch(t.type){case"failed":return{...a,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...a,isPaused:!0};case"continue":return{...a,isPaused:!1};case"pending":return{...a,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{...a,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...a,data:void 0,error:t.error,failureCount:a.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),fn.batch(()=>{$(this,Aa).forEach(a=>{a.onMutationUpdate(t)}),$(this,er).notify({mutation:this,type:"updated",action:t})})},Gj);function lC(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var li,xa,_u,Vj,FR=(Vj=class extends il{constructor(t={}){super();Te(this,li);Te(this,xa);Te(this,_u);this.config=t,je(this,li,new Set),je(this,xa,new Map),je(this,_u,0)}build(t,n,a){const s=new BR({client:t,mutationCache:this,mutationId:++df(this,_u)._,options:t.defaultMutationOptions(n),state:a});return this.add(s),s}add(t){$(this,li).add(t);const n=ff(t);if(typeof n=="string"){const a=$(this,xa).get(n);a?a.push(t):$(this,xa).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if($(this,li).delete(t)){const n=ff(t);if(typeof n=="string"){const a=$(this,xa).get(n);if(a)if(a.length>1){const s=a.indexOf(t);s!==-1&&a.splice(s,1)}else a[0]===t&&$(this,xa).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=ff(t);if(typeof n=="string"){const a=$(this,xa).get(n),s=a==null?void 0:a.find(o=>o.state.status==="pending");return!s||s===t}else return!0}runNext(t){var a;const n=ff(t);if(typeof n=="string"){const s=(a=$(this,xa).get(n))==null?void 0:a.find(o=>o!==t&&o.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){fn.batch(()=>{$(this,li).forEach(t=>{this.notify({type:"removed",mutation:t})}),$(this,li).clear(),$(this,xa).clear()})}getAll(){return Array.from($(this,li))}find(t){const n={exact:!0,...t};return this.getAll().find(a=>$S(n,a))}findAll(t={}){return this.getAll().filter(n=>$S(t,n))}notify(t){fn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return fn.batch(()=>Promise.all(t.map(n=>n.continue().catch(nr))))}},li=new WeakMap,xa=new WeakMap,_u=new WeakMap,Vj);function ff(e){var t;return(t=e.options.scope)==null?void 0:t.id}var oi,os,_r,ci,fi,Df,oy,Qj,$R=(Qj=class extends il{constructor(n,a){super();Te(this,fi);Te(this,oi);Te(this,os);Te(this,_r);Te(this,ci);je(this,oi,n),this.setOptions(a),this.bindMethods(),Ye(this,fi,Df).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const a=this.options;this.options=$(this,oi).defaultMutationOptions(n),lu(this.options,a)||$(this,oi).getMutationCache().notify({type:"observerOptionsUpdated",mutation:$(this,_r),observer:this}),a!=null&&a.mutationKey&&this.options.mutationKey&&tl(a.mutationKey)!==tl(this.options.mutationKey)?this.reset():((s=$(this,_r))==null?void 0:s.state.status)==="pending"&&$(this,_r).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=$(this,_r))==null||n.removeObserver(this)}onMutationUpdate(n){Ye(this,fi,Df).call(this),Ye(this,fi,oy).call(this,n)}getCurrentResult(){return $(this,os)}reset(){var n;(n=$(this,_r))==null||n.removeObserver(this),je(this,_r,void 0),Ye(this,fi,Df).call(this),Ye(this,fi,oy).call(this)}mutate(n,a){var s;return je(this,ci,a),(s=$(this,_r))==null||s.removeObserver(this),je(this,_r,$(this,oi).getMutationCache().build($(this,oi),this.options)),$(this,_r).addObserver(this),$(this,_r).execute(n)}},oi=new WeakMap,os=new WeakMap,_r=new WeakMap,ci=new WeakMap,fi=new WeakSet,Df=function(){var a;const n=((a=$(this,_r))==null?void 0:a.state)??lC();je(this,os,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},oy=function(n){fn.batch(()=>{var a,s,o,u,f,m,h,p;if($(this,ci)&&this.hasListeners()){const g=$(this,os).variables,w=$(this,os).context,x={client:$(this,oi),meta:this.options.meta,mutationKey:this.options.mutationKey};if((n==null?void 0:n.type)==="success"){try{(s=(a=$(this,ci)).onSuccess)==null||s.call(a,n.data,g,w,x)}catch(k){Promise.reject(k)}try{(u=(o=$(this,ci)).onSettled)==null||u.call(o,n.data,null,g,w,x)}catch(k){Promise.reject(k)}}else if((n==null?void 0:n.type)==="error"){try{(m=(f=$(this,ci)).onError)==null||m.call(f,n.error,g,w,x)}catch(k){Promise.reject(k)}try{(p=(h=$(this,ci)).onSettled)==null||p.call(h,void 0,n.error,g,w,x)}catch(k){Promise.reject(k)}}}this.listeners.forEach(g=>{g($(this,os))})})},Qj);function XS(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function HR(e,t,n){const a=e.slice(0);return a[t]=n,a}var yo,Hr,vo,bo,la,cs,Tu,Au,Ru,Ou,Wn,cy,uy,dy,fy,hy,Kj,qR=(Kj=class extends il{constructor(t,n,a){super();Te(this,Wn);Te(this,yo);Te(this,Hr);Te(this,vo);Te(this,bo);Te(this,la);Te(this,cs);Te(this,Tu);Te(this,Au);Te(this,Ru);Te(this,Ou,[]);je(this,yo,t),je(this,bo,a),je(this,vo,[]),je(this,la,[]),je(this,Hr,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&$(this,la).forEach(t=>{t.subscribe(n=>{Ye(this,Wn,fy).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,$(this,la).forEach(t=>{t.destroy()})}setQueries(t,n){je(this,vo,t),je(this,bo,n),fn.batch(()=>{const a=$(this,la),s=Ye(this,Wn,dy).call(this,$(this,vo));s.forEach(g=>g.observer.setOptions(g.defaultedQueryOptions));const o=s.map(g=>g.observer),u=o.map(g=>g.getCurrentResult()),f=a.length!==o.length,m=o.some((g,w)=>g!==a[w]),h=f||m,p=h?!0:u.some((g,w)=>{const x=$(this,Hr)[w];return!x||!lu(g,x)});!h&&!p||(h&&(je(this,Ou,s),je(this,la,o)),je(this,Hr,u),this.hasListeners()&&(h&&(XS(a,o).forEach(g=>{g.destroy()}),XS(o,a).forEach(g=>{g.subscribe(w=>{Ye(this,Wn,fy).call(this,g,w)})})),Ye(this,Wn,hy).call(this)))})}getCurrentResult(){return $(this,Hr)}getQueries(){return $(this,la).map(t=>t.getCurrentQuery())}getObservers(){return $(this,la)}getOptimisticResult(t,n){const a=Ye(this,Wn,dy).call(this,t),s=a.map(u=>u.observer.getOptimisticResult(u.defaultedQueryOptions)),o=a.map(u=>u.defaultedQueryOptions.queryHash);return[s,u=>Ye(this,Wn,uy).call(this,u??s,n,o),()=>Ye(this,Wn,cy).call(this,s,a)]}},yo=new WeakMap,Hr=new WeakMap,vo=new WeakMap,bo=new WeakMap,la=new WeakMap,cs=new WeakMap,Tu=new WeakMap,Au=new WeakMap,Ru=new WeakMap,Ou=new WeakMap,Wn=new WeakSet,cy=function(t,n){return n.map((a,s)=>{const o=t[s];return a.defaultedQueryOptions.notifyOnChangeProps?o:a.observer.trackResult(o,u=>{n.forEach(f=>{f.observer.trackProp(u)})})})},uy=function(t,n,a){if(n){const s=$(this,Ru),o=a!==void 0&&s!==void 0&&(s.length!==a.length||a.some((u,f)=>u!==s[f]));return(!$(this,cs)||$(this,Hr)!==$(this,Au)||o||n!==$(this,Tu))&&(je(this,Tu,n),je(this,Au,$(this,Hr)),a!==void 0&&je(this,Ru,a),je(this,cs,hv($(this,cs),n(t)))),$(this,cs)}return t},dy=function(t){const n=new Map;$(this,la).forEach(s=>{const o=s.options.queryHash;if(!o)return;const u=n.get(o);u?u.push(s):n.set(o,[s])});const a=[];return t.forEach(s=>{var m;const o=$(this,yo).defaultQueryOptions(s),f=((m=n.get(o.queryHash))==null?void 0:m.shift())??new gv($(this,yo),o);a.push({defaultedQueryOptions:o,observer:f})}),a},fy=function(t,n){const a=$(this,la).indexOf(t);a!==-1&&(je(this,Hr,HR($(this,Hr),a,n)),Ye(this,Wn,hy).call(this))},hy=function(){var t;if(this.hasListeners()){const n=$(this,cs),a=Ye(this,Wn,cy).call(this,$(this,Hr),$(this,Ou)),s=Ye(this,Wn,uy).call(this,a,(t=$(this,bo))==null?void 0:t.combine);n!==s&&fn.batch(()=>{this.listeners.forEach(o=>{o($(this,Hr))})})}},Kj),Oa,Yj,ZR=(Yj=class extends il{constructor(t={}){super();Te(this,Oa);this.config=t,je(this,Oa,new Map)}build(t,n,a){const s=n.queryKey,o=n.queryHash??fv(s,n);let u=this.get(o);return u||(u=new IR({client:t,queryKey:s,queryHash:o,options:t.defaultQueryOptions(n),state:a,defaultOptions:t.getQueryDefaults(s)}),this.add(u)),u}add(t){$(this,Oa).has(t.queryHash)||($(this,Oa).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=$(this,Oa).get(t.queryHash);n&&(t.destroy(),n===t&&$(this,Oa).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){fn.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return $(this,Oa).get(t)}getAll(){return[...$(this,Oa).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(a=>FS(n,a))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(a=>FS(t,a)):n}notify(t){fn.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){fn.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){fn.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Oa=new WeakMap,Yj),dn,us,ds,xo,wo,fs,So,ko,Xj,GR=(Xj=class{constructor(e={}){Te(this,dn);Te(this,us);Te(this,ds);Te(this,xo);Te(this,wo);Te(this,fs);Te(this,So);Te(this,ko);je(this,dn,e.queryCache||new ZR),je(this,us,e.mutationCache||new FR),je(this,ds,e.defaultOptions||{}),je(this,xo,new Map),je(this,wo,new Map),je(this,fs,0)}mount(){df(this,fs)._++,$(this,fs)===1&&(je(this,So,dv.subscribe(async e=>{e&&(await this.resumePausedMutations(),$(this,dn).onFocus())})),je(this,ko,$f.subscribe(async e=>{e&&(await this.resumePausedMutations(),$(this,dn).onOnline())})))}unmount(){var e,t;df(this,fs)._--,$(this,fs)===0&&((e=$(this,So))==null||e.call(this),je(this,So,void 0),(t=$(this,ko))==null||t.call(this),je(this,ko,void 0))}isFetching(e){return $(this,dn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return $(this,us).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=$(this,dn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=$(this,dn).build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ms(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return $(this,dn).findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),s=$(this,dn).get(a.queryHash),o=s==null?void 0:s.state.data,u=ER(t,o);if(u!==void 0)return $(this,dn).build(this,a).setData(u,{...n,manual:!0})}setQueriesData(e,t,n){return fn.batch(()=>$(this,dn).findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=$(this,dn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=$(this,dn);fn.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=$(this,dn);return fn.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=fn.batch(()=>$(this,dn).findAll(e).map(s=>s.cancel(n)));return Promise.all(a).then(nr).catch(nr)}invalidateQueries(e,t={}){return fn.batch(()=>($(this,dn).findAll(e).forEach(n=>{n.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 n={...t,cancelRefetch:t.cancelRefetch??!0},a=fn.batch(()=>$(this,dn).findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,n);return n.throwOnError||(o=o.catch(nr)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(a).then(nr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=$(this,dn).build(this,t);return n.isStaleByTime(ms(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(nr).catch(nr)}fetchInfiniteQuery(e){return e.behavior=KS(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(nr).catch(nr)}ensureInfiniteQueryData(e){return e.behavior=KS(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return $f.isOnline()?$(this,us).resumePausedMutations():Promise.resolve()}getQueryCache(){return $(this,dn)}getMutationCache(){return $(this,us)}getDefaultOptions(){return $(this,ds)}setDefaultOptions(e){je(this,ds,e)}setQueryDefaults(e,t){$(this,xo).set(tl(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...$(this,xo).values()],n={};return t.forEach(a=>{su(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){$(this,wo).set(tl(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...$(this,wo).values()],n={};return t.forEach(a=>{su(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...$(this,ds).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=fv(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===mv&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...$(this,ds).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){$(this,dn).clear(),$(this,us).clear()}},dn=new WeakMap,us=new WeakMap,ds=new WeakMap,xo=new WeakMap,wo=new WeakMap,fs=new WeakMap,So=new WeakMap,ko=new WeakMap,Xj),oC=b.createContext(void 0),vn=e=>{const t=b.useContext(oC);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},VR=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(oC.Provider,{value:e,children:t})),cC=b.createContext(!1),uC=()=>b.useContext(cC);cC.Provider;function QR(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var KR=b.createContext(QR()),dC=()=>b.useContext(KR),fC=(e,t,n)=>{const a=n!=null&&n.state.error&&typeof e.throwOnError=="function"?pv(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},hC=e=>{b.useEffect(()=>{e.clearReset()},[e])},mC=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(s&&e.data===void 0||pv(n,[e.error,a])),pC=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...s)=>n(a(...s)):n(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},YR=(e,t)=>e.isLoading&&e.isFetching&&!t,my=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,py=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function XR({queries:e,...t},n){const a=vn(),s=uC(),o=dC(),u=b.useMemo(()=>e.map(C=>{const j=a.defaultQueryOptions(C);return j._optimisticResults=s?"isRestoring":"optimistic",j}),[e,a,s]);u.forEach(C=>{pC(C);const j=a.getQueryCache().get(C.queryHash);fC(C,o,j)}),hC(o);const[f]=b.useState(()=>new qR(a,u,t)),[m,h,p]=f.getOptimisticResult(u,t.combine),g=!s&&t.subscribed!==!1;b.useSyncExternalStore(b.useCallback(C=>g?f.subscribe(fn.batchCalls(C)):nr,[f,g]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),b.useEffect(()=>{f.setQueries(u,t)},[u,t,f]);const x=m.some((C,j)=>my(u[j],C))?m.flatMap((C,j)=>{const E=u[j];if(E&&my(E,C)){const O=new gv(a,E);return py(E,O,o)}return[]}):[];if(x.length>0)throw Promise.all(x);const k=m.find((C,j)=>{const E=u[j];return E&&mC({result:C,errorResetBoundary:o,throwOnError:E.throwOnError,query:a.getQueryCache().get(E.queryHash),suspense:E.suspense})});if(k!=null&&k.error)throw k.error;return h(p())}function WR(e,t,n){var w,x,k,C;const a=uC(),s=dC(),o=vn(),u=o.defaultQueryOptions(e);(x=(w=o.getDefaultOptions().queries)==null?void 0:w._experimental_beforeQuery)==null||x.call(w,u);const f=o.getQueryCache().get(u.queryHash);u._optimisticResults=a?"isRestoring":"optimistic",pC(u),fC(u,s,f),hC(s);const m=!o.getQueryCache().get(u.queryHash),[h]=b.useState(()=>new t(o,u)),p=h.getOptimisticResult(u),g=!a&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(j=>{const E=g?h.subscribe(fn.batchCalls(j)):nr;return h.updateResult(),E},[h,g]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),b.useEffect(()=>{h.setOptions(u)},[u,h]),my(u,p))throw py(u,h,s);if(mC({result:p,errorResetBoundary:s,throwOnError:u.throwOnError,query:f,suspense:u.suspense}))throw p.error;if((C=(k=o.getDefaultOptions().queries)==null?void 0:k._experimental_afterQuery)==null||C.call(k,u,p),u.experimental_prefetchInRender&&!ou.isServer()&&YR(p,a)){const j=m?py(u,h,s):f==null?void 0:f.promise;j==null||j.catch(nr).finally(()=>{h.updateResult()})}return u.notifyOnChangeProps?p:h.trackResult(p)}function We(e,t){return WR(e,gv)}function pt(e,t){const n=vn(),[a]=b.useState(()=>new $R(n,e));b.useEffect(()=>{a.setOptions(e)},[a,e]);const s=b.useSyncExternalStore(b.useCallback(u=>a.subscribe(fn.batchCalls(u)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),o=b.useCallback((u,f)=>{a.mutate(u,f).catch(nr)},[a]);if(s.error&&pv(a.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}/**
|
|
50
|
-
* react-router v7.13.1
|
|
51
|
-
*
|
|
52
|
-
* Copyright (c) Remix Software Inc.
|
|
53
|
-
*
|
|
54
|
-
* This source code is licensed under the MIT license found in the
|
|
55
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
56
|
-
*
|
|
57
|
-
* @license MIT
|
|
58
|
-
*/var WS="popstate";function JS(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function JR(e={}){function t(a,s){var h;let o=(h=s.state)==null?void 0:h.masked,{pathname:u,search:f,hash:m}=o||a.location;return gy("",{pathname:u,search:f,hash:m},s.state&&s.state.usr||null,s.state&&s.state.key||"default",o?{pathname:a.location.pathname,search:a.location.search,hash:a.location.hash}:void 0)}function n(a,s){return typeof s=="string"?s:cu(s)}return tO(t,n,null,e)}function Jt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function ua(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function eO(){return Math.random().toString(36).substring(2,10)}function e1(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.unstable_mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function gy(e,t,n=null,a,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?To(t):t,state:n,key:t&&t.key||a||eO(),unstable_mask:s}}function cu({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function To(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function tO(e,t,n,a={}){let{window:s=document.defaultView,v5Compat:o=!1}=a,u=s.history,f="POP",m=null,h=p();h==null&&(h=0,u.replaceState({...u.state,idx:h},""));function p(){return(u.state||{idx:null}).idx}function g(){f="POP";let j=p(),E=j==null?null:j-h;h=j,m&&m({action:f,location:C.location,delta:E})}function w(j,E){f="PUSH";let O=JS(j)?j:gy(C.location,j,E);h=p()+1;let A=e1(O,h),D=C.createHref(O.unstable_mask||O);try{u.pushState(A,"",D)}catch(z){if(z instanceof DOMException&&z.name==="DataCloneError")throw z;s.location.assign(D)}o&&m&&m({action:f,location:C.location,delta:1})}function x(j,E){f="REPLACE";let O=JS(j)?j:gy(C.location,j,E);h=p();let A=e1(O,h),D=C.createHref(O.unstable_mask||O);u.replaceState(A,"",D),o&&m&&m({action:f,location:C.location,delta:0})}function k(j){return nO(j)}let C={get action(){return f},get location(){return e(s,u)},listen(j){if(m)throw new Error("A history only accepts one active listener");return s.addEventListener(WS,g),m=j,()=>{s.removeEventListener(WS,g),m=null}},createHref(j){return t(s,j)},createURL:k,encodeLocation(j){let E=k(j);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:w,replace:x,go(j){return u.go(j)}};return C}function nO(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Jt(n,"No window.location.(origin|href) available to create URL");let a=typeof e=="string"?e:cu(e);return a=a.replace(/ $/,"%20"),!t&&a.startsWith("//")&&(a=n+a),new URL(a,n)}function gC(e,t,n="/"){return rO(e,t,n,!1)}function rO(e,t,n,a){let s=typeof t=="string"?To(t):t,o=hi(s.pathname||"/",n);if(o==null)return null;let u=yC(e);aO(u);let f=null;for(let m=0;f==null&&m<u.length;++m){let h=pO(o);f=hO(u[m],h,a)}return f}function yC(e,t=[],n=[],a="",s=!1){let o=(u,f,m=s,h)=>{let p={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:f,route:u};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(a)&&m)return;Jt(p.relativePath.startsWith(a),`Absolute route path "${p.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(a.length)}let g=Da([a,p.relativePath]),w=n.concat(p);u.children&&u.children.length>0&&(Jt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),yC(u.children,t,w,g,m)),!(u.path==null&&!u.index)&&t.push({path:g,score:dO(g,u.index),routesMeta:w})};return e.forEach((u,f)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))o(u,f);else for(let h of vC(u.path))o(u,f,!0,h)}),t}function vC(e){let t=e.split("/");if(t.length===0)return[];let[n,...a]=t,s=n.endsWith("?"),o=n.replace(/\?$/,"");if(a.length===0)return s?[o,""]:[o];let u=vC(a.join("/")),f=[];return f.push(...u.map(m=>m===""?o:[o,m].join("/"))),s&&f.push(...u),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function aO(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:fO(t.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var iO=/^:[\w-]+$/,sO=3,lO=2,oO=1,cO=10,uO=-2,t1=e=>e==="*";function dO(e,t){let n=e.split("/"),a=n.length;return n.some(t1)&&(a+=uO),t&&(a+=lO),n.filter(s=>!t1(s)).reduce((s,o)=>s+(iO.test(o)?sO:o===""?oO:cO),a)}function fO(e,t){return e.length===t.length&&e.slice(0,-1).every((a,s)=>a===t[s])?e[e.length-1]-t[t.length-1]:0}function hO(e,t,n=!1){let{routesMeta:a}=e,s={},o="/",u=[];for(let f=0;f<a.length;++f){let m=a[f],h=f===a.length-1,p=o==="/"?t:t.slice(o.length)||"/",g=Hf({path:m.relativePath,caseSensitive:m.caseSensitive,end:h},p),w=m.route;if(!g&&h&&n&&!a[a.length-1].route.index&&(g=Hf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},p)),!g)return null;Object.assign(s,g.params),u.push({params:s,pathname:Da([o,g.pathname]),pathnameBase:bO(Da([o,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(o=Da([o,g.pathnameBase]))}return u}function Hf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,a]=mO(e.path,e.caseSensitive,e.end),s=t.match(n);if(!s)return null;let o=s[0],u=o.replace(/(.)\/+$/,"$1"),f=s.slice(1);return{params:a.reduce((h,{paramName:p,isOptional:g},w)=>{if(p==="*"){let k=f[w]||"";u=o.slice(0,o.length-k.length).replace(/(.)\/+$/,"$1")}const x=f[w];return g&&!x?h[p]=void 0:h[p]=(x||"").replace(/%2F/g,"/"),h},{}),pathname:o,pathnameBase:u,pattern:e}}function mO(e,t=!1,n=!0){ua(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,f,m,h,p)=>{if(a.push({paramName:f,isOptional:m!=null}),m){let g=p.charAt(h+u.length);return g&&g!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),a]}function pO(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return ua(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function hi(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,a=e.charAt(n);return a&&a!=="/"?null:e.slice(n)||"/"}var gO=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function yO(e,t="/"){let{pathname:n,search:a="",hash:s=""}=typeof e=="string"?To(e):e,o;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?o=n1(n.substring(1),"/"):o=n1(n,t)):o=t,{pathname:o,search:xO(a),hash:wO(s)}}function n1(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function Jp(e,t,n,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function vO(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function vv(e){let t=vO(e);return t.map((n,a)=>a===t.length-1?n.pathname:n.pathnameBase)}function ch(e,t,n,a=!1){let s;typeof e=="string"?s=To(e):(s={...e},Jt(!s.pathname||!s.pathname.includes("?"),Jp("?","pathname","search",s)),Jt(!s.pathname||!s.pathname.includes("#"),Jp("#","pathname","hash",s)),Jt(!s.search||!s.search.includes("#"),Jp("#","search","hash",s)));let o=e===""||s.pathname==="",u=o?"/":s.pathname,f;if(u==null)f=n;else{let g=t.length-1;if(!a&&u.startsWith("..")){let w=u.split("/");for(;w[0]==="..";)w.shift(),g-=1;s.pathname=w.join("/")}f=g>=0?t[g]:"/"}let m=yO(s,f),h=u&&u!=="/"&&u.endsWith("/"),p=(o||u===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(h||p)&&(m.pathname+="/"),m}var Da=e=>e.join("/").replace(/\/\/+/g,"/"),bO=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),xO=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,wO=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,SO=class{constructor(e,t,n,a=!1){this.status=e,this.statusText=t||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function kO(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function jO(e){return e.map(t=>t.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var bC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function xC(e,t){let n=e;if(typeof n!="string"||!gO.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,s=!1;if(bC)try{let o=new URL(window.location.href),u=n.startsWith("//")?new URL(o.protocol+n):new URL(n),f=hi(u.pathname,t);u.origin===o.origin&&f!=null?n=f+u.search+u.hash:s=!0}catch{ua(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var wC=["POST","PUT","PATCH","DELETE"];new Set(wC);var CO=["GET",...wC];new Set(CO);var Ao=b.createContext(null);Ao.displayName="DataRouter";var uh=b.createContext(null);uh.displayName="DataRouterState";var EO=b.createContext(!1),SC=b.createContext({isTransitioning:!1});SC.displayName="ViewTransition";var NO=b.createContext(new Map);NO.displayName="Fetchers";var _O=b.createContext(null);_O.displayName="Await";var Gr=b.createContext(null);Gr.displayName="Navigation";var Mu=b.createContext(null);Mu.displayName="Location";var fa=b.createContext({outlet:null,matches:[],isDataRoute:!1});fa.displayName="Route";var bv=b.createContext(null);bv.displayName="RouteError";var kC="REACT_ROUTER_ERROR",TO="REDIRECT",AO="ROUTE_ERROR_RESPONSE";function RO(e){if(e.startsWith(`${kC}:${TO}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function OO(e){if(e.startsWith(`${kC}:${AO}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new SO(t.status,t.statusText,t.data)}catch{}}function MO(e,{relative:t}={}){Jt(Ro(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=b.useContext(Gr),{hash:s,pathname:o,search:u}=Du(e,{relative:t}),f=o;return n!=="/"&&(f=o==="/"?n:Da([n,o])),a.createHref({pathname:f,search:u,hash:s})}function Ro(){return b.useContext(Mu)!=null}function Rr(){return Jt(Ro(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Mu).location}var jC="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function CC(e){b.useContext(Gr).static||b.useLayoutEffect(e)}function zn(){let{isDataRoute:e}=b.useContext(fa);return e?QO():DO()}function DO(){Jt(Ro(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(Ao),{basename:t,navigator:n}=b.useContext(Gr),{matches:a}=b.useContext(fa),{pathname:s}=Rr(),o=JSON.stringify(vv(a)),u=b.useRef(!1);return CC(()=>{u.current=!0}),b.useCallback((m,h={})=>{if(ua(u.current,jC),!u.current)return;if(typeof m=="number"){n.go(m);return}let p=ch(m,JSON.parse(o),s,h.relative==="path");e==null&&t!=="/"&&(p.pathname=p.pathname==="/"?t:Da([t,p.pathname])),(h.replace?n.replace:n.push)(p,h.state,h)},[t,n,o,s,e])}var zO=b.createContext(null);function IO(e){let t=b.useContext(fa).outlet;return b.useMemo(()=>t&&b.createElement(zO.Provider,{value:e},t),[t,e])}function EC(){let{matches:e}=b.useContext(fa),t=e[e.length-1];return t?t.params:{}}function Du(e,{relative:t}={}){let{matches:n}=b.useContext(fa),{pathname:a}=Rr(),s=JSON.stringify(vv(n));return b.useMemo(()=>ch(e,JSON.parse(s),a,t==="path"),[e,s,a,t])}function LO(e,t){return NC(e,t)}function NC(e,t,n){var j;Jt(Ro(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=b.useContext(Gr),{matches:s}=b.useContext(fa),o=s[s.length-1],u=o?o.params:{},f=o?o.pathname:"/",m=o?o.pathnameBase:"/",h=o&&o.route;{let E=h&&h.path||"";TC(f,!h||E.endsWith("*")||E.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${E}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
|
-
|
|
60
|
-
Please change the parent <Route path="${E}"> to <Route path="${E==="/"?"*":`${E}/*`}">.`)}let p=Rr(),g;if(t){let E=typeof t=="string"?To(t):t;Jt(m==="/"||((j=E.pathname)==null?void 0:j.startsWith(m)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${E.pathname}" was given in the \`location\` prop.`),g=E}else g=p;let w=g.pathname||"/",x=w;if(m!=="/"){let E=m.replace(/^\//,"").split("/");x="/"+w.replace(/^\//,"").split("/").slice(E.length).join("/")}let k=gC(e,{pathname:x});ua(h||k!=null,`No routes matched location "${g.pathname}${g.search}${g.hash}" `),ua(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${g.pathname}${g.search}${g.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let C=$O(k&&k.map(E=>Object.assign({},E,{params:Object.assign({},u,E.params),pathname:Da([m,a.encodeLocation?a.encodeLocation(E.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathname]),pathnameBase:E.pathnameBase==="/"?m:Da([m,a.encodeLocation?a.encodeLocation(E.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:E.pathnameBase])})),s,n);return t&&C?b.createElement(Mu.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...g},navigationType:"POP"}},C):C}function PO(){let e=VO(),t=kO(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:a},o={padding:"2px 4px",backgroundColor:a},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:o},"ErrorBoundary")," or"," ",b.createElement("code",{style:o},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:s},n):null,u)}var UO=b.createElement(PO,null),_C=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=OO(e.digest);n&&(e=n)}let t=e!==void 0?b.createElement(fa.Provider,{value:this.props.routeContext},b.createElement(bv.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(BO,{error:e},t):t}};_C.contextType=EO;var eg=new WeakMap;function BO({children:e,error:t}){let{basename:n}=b.useContext(Gr);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=RO(t.digest);if(a){let s=eg.get(t);if(s)throw s;let o=xC(a.location,n);if(bC&&!eg.get(t))if(o.isExternal||a.reloadDocument)window.location.href=o.absoluteURL||o.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(o.to,{replace:a.replace}));throw eg.set(t,u),u}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o.absoluteURL||o.to}`})}}return e}function FO({routeContext:e,match:t,children:n}){let a=b.useContext(Ao);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(fa.Provider,{value:e},n)}function $O(e,t=[],n){let a=n==null?void 0:n.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let s=e,o=a==null?void 0:a.errors;if(o!=null){let p=s.findIndex(g=>g.route.id&&(o==null?void 0:o[g.route.id])!==void 0);Jt(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,p+1))}let u=!1,f=-1;if(n&&a){u=a.renderFallback;for(let p=0;p<s.length;p++){let g=s[p];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=p),g.route.id){let{loaderData:w,errors:x}=a,k=g.route.loader&&!w.hasOwnProperty(g.route.id)&&(!x||x[g.route.id]===void 0);if(g.route.lazy||k){n.isStatic&&(u=!0),f>=0?s=s.slice(0,f+1):s=[s[0]];break}}}}let m=n==null?void 0:n.onError,h=a&&m?(p,g)=>{var w,x;m(p,{location:a.location,params:((x=(w=a.matches)==null?void 0:w[0])==null?void 0:x.params)??{},unstable_pattern:jO(a.matches),errorInfo:g})}:void 0;return s.reduceRight((p,g,w)=>{let x,k=!1,C=null,j=null;a&&(x=o&&g.route.id?o[g.route.id]:void 0,C=g.route.errorElement||UO,u&&(f<0&&w===0?(TC("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,j=null):f===w&&(k=!0,j=g.route.hydrateFallbackElement||null)));let E=t.concat(s.slice(0,w+1)),O=()=>{let A;return x?A=C:k?A=j:g.route.Component?A=b.createElement(g.route.Component,null):g.route.element?A=g.route.element:A=p,b.createElement(FO,{match:g,routeContext:{outlet:p,matches:E,isDataRoute:a!=null},children:A})};return a&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?b.createElement(_C,{location:a.location,revalidation:a.revalidation,component:C,error:x,children:O(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:h}):O()},null)}function xv(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function HO(e){let t=b.useContext(Ao);return Jt(t,xv(e)),t}function qO(e){let t=b.useContext(uh);return Jt(t,xv(e)),t}function ZO(e){let t=b.useContext(fa);return Jt(t,xv(e)),t}function wv(e){let t=ZO(e),n=t.matches[t.matches.length-1];return Jt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function GO(){return wv("useRouteId")}function VO(){var a;let e=b.useContext(bv),t=qO("useRouteError"),n=wv("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[n]}function QO(){let{router:e}=HO("useNavigate"),t=wv("useNavigate"),n=b.useRef(!1);return CC(()=>{n.current=!0}),b.useCallback(async(s,o={})=>{ua(n.current,jC),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var r1={};function TC(e,t,n){!t&&!r1[e]&&(r1[e]=!0,ua(!1,n))}b.memo(KO);function KO({routes:e,future:t,state:n,isStatic:a,onError:s}){return NC(e,void 0,{state:n,isStatic:a,onError:s})}function tr({to:e,replace:t,state:n,relative:a}){Jt(Ro(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=b.useContext(Gr);ua(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:o}=b.useContext(fa),{pathname:u}=Rr(),f=zn(),m=ch(e,vv(o),u,a==="path"),h=JSON.stringify(m);return b.useEffect(()=>{f(JSON.parse(h),{replace:t,state:n,relative:a})},[f,h,a,t,n]),null}function qf(e){return IO(e.context)}function $t(e){Jt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function YO({basename:e="/",children:t=null,location:n,navigationType:a="POP",navigator:s,static:o=!1,unstable_useTransitions:u}){Jt(!Ro(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=b.useMemo(()=>({basename:f,navigator:s,static:o,unstable_useTransitions:u,future:{}}),[f,s,o,u]);typeof n=="string"&&(n=To(n));let{pathname:h="/",search:p="",hash:g="",state:w=null,key:x="default",unstable_mask:k}=n,C=b.useMemo(()=>{let j=hi(h,f);return j==null?null:{location:{pathname:j,search:p,hash:g,state:w,key:x,unstable_mask:k},navigationType:a}},[f,h,p,g,w,x,a,k]);return ua(C!=null,`<Router basename="${f}"> is not able to match the URL "${h}${p}${g}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:b.createElement(Gr.Provider,{value:m},b.createElement(Mu.Provider,{children:t,value:C}))}function XO({children:e,location:t}){return LO(yy(e),t)}function yy(e,t=[]){let n=[];return b.Children.forEach(e,(a,s)=>{if(!b.isValidElement(a))return;let o=[...t,s];if(a.type===b.Fragment){n.push.apply(n,yy(a.props.children,o));return}Jt(a.type===$t,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Jt(!a.props.index||!a.props.children,"An index route cannot have child routes.");let u={id:a.props.id||o.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(u.children=yy(a.props.children,o)),n.push(u)}),n}var zf="get",If="application/x-www-form-urlencoded";function dh(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function WO(e){return dh(e)&&e.tagName.toLowerCase()==="button"}function JO(e){return dh(e)&&e.tagName.toLowerCase()==="form"}function eM(e){return dh(e)&&e.tagName.toLowerCase()==="input"}function tM(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function nM(e,t){return e.button===0&&(!t||t==="_self")&&!tM(e)}function vy(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let a=e[n];return t.concat(Array.isArray(a)?a.map(s=>[n,s]):[[n,a]])},[]))}function rM(e,t){let n=vy(e);return t&&t.forEach((a,s)=>{n.has(s)||t.getAll(s).forEach(o=>{n.append(s,o)})}),n}var hf=null;function aM(){if(hf===null)try{new FormData(document.createElement("form"),0),hf=!1}catch{hf=!0}return hf}var iM=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function tg(e){return e!=null&&!iM.has(e)?(ua(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${If}"`),null):e}function sM(e,t){let n,a,s,o,u;if(JO(e)){let f=e.getAttribute("action");a=f?hi(f,t):null,n=e.getAttribute("method")||zf,s=tg(e.getAttribute("enctype"))||If,o=new FormData(e)}else if(WO(e)||eM(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(a=m?hi(m,t):null,n=e.getAttribute("formmethod")||f.getAttribute("method")||zf,s=tg(e.getAttribute("formenctype"))||tg(f.getAttribute("enctype"))||If,o=new FormData(f,e),!aM()){let{name:h,type:p,value:g}=e;if(p==="image"){let w=h?`${h}.`:"";o.append(`${w}x`,"0"),o.append(`${w}y`,"0")}else h&&o.append(h,g)}}else{if(dh(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=zf,a=null,s=If,u=e}return o&&s==="text/plain"&&(u=o,o=void 0),{action:a,method:n.toLowerCase(),encType:s,formData:o,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Sv(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function lM(e,t,n,a){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${a}`:s.pathname=`${s.pathname}.${a}`:s.pathname==="/"?s.pathname=`_root.${a}`:t&&hi(s.pathname,t)==="/"?s.pathname=`${t.replace(/\/$/,"")}/_root.${a}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${a}`,s}async function oM(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function cM(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function uM(e,t,n){let a=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let u=await oM(o,n);return u.links?u.links():[]}return[]}));return mM(a.flat(1).filter(cM).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function a1(e,t,n,a,s,o){let u=(m,h)=>n[h]?m.route.id!==n[h].route.id:!0,f=(m,h)=>{var p;return n[h].pathname!==m.pathname||((p=n[h].route.path)==null?void 0:p.endsWith("*"))&&n[h].params["*"]!==m.params["*"]};return o==="assets"?t.filter((m,h)=>u(m,h)||f(m,h)):o==="data"?t.filter((m,h)=>{var g;let p=a.routes[m.route.id];if(!p||!p.hasLoader)return!1;if(u(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let w=m.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((g=n[0])==null?void 0:g.params)||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof w=="boolean")return w}return!0}):[]}function dM(e,t,{includeHydrateFallback:n}={}){return fM(e.map(a=>{let s=t.routes[a.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function fM(e){return[...new Set(e)]}function hM(e){let t={},n=Object.keys(e).sort();for(let a of n)t[a]=e[a];return t}function mM(e,t){let n=new Set;return new Set(t),e.reduce((a,s)=>{let o=JSON.stringify(hM(s));return n.has(o)||(n.add(o),a.push({key:o,link:s})),a},[])}function AC(){let e=b.useContext(Ao);return Sv(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function pM(){let e=b.useContext(uh);return Sv(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var kv=b.createContext(void 0);kv.displayName="FrameworkContext";function RC(){let e=b.useContext(kv);return Sv(e,"You must render this element inside a <HydratedRouter> element"),e}function gM(e,t){let n=b.useContext(kv),[a,s]=b.useState(!1),[o,u]=b.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:p,onTouchStart:g}=t,w=b.useRef(null);b.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let C=E=>{E.forEach(O=>{u(O.isIntersecting)})},j=new IntersectionObserver(C,{threshold:.5});return w.current&&j.observe(w.current),()=>{j.disconnect()}}},[e]),b.useEffect(()=>{if(a){let C=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(C)}}},[a]);let x=()=>{s(!0)},k=()=>{s(!1),u(!1)};return n?e!=="intent"?[o,w,{}]:[o,w,{onFocus:Dc(f,x),onBlur:Dc(m,k),onMouseEnter:Dc(h,x),onMouseLeave:Dc(p,k),onTouchStart:Dc(g,x)}]:[!1,w,{}]}function Dc(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function yM({page:e,...t}){let{router:n}=AC(),a=b.useMemo(()=>gC(n.routes,e,n.basename),[n.routes,e,n.basename]);return a?b.createElement(bM,{page:e,matches:a,...t}):null}function vM(e){let{manifest:t,routeModules:n}=RC(),[a,s]=b.useState([]);return b.useEffect(()=>{let o=!1;return uM(e,t,n).then(u=>{o||s(u)}),()=>{o=!0}},[e,t,n]),a}function bM({page:e,matches:t,...n}){let a=Rr(),{future:s,manifest:o,routeModules:u}=RC(),{basename:f}=AC(),{loaderData:m,matches:h}=pM(),p=b.useMemo(()=>a1(e,t,h,o,a,"data"),[e,t,h,o,a]),g=b.useMemo(()=>a1(e,t,h,o,a,"assets"),[e,t,h,o,a]),w=b.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let C=new Set,j=!1;if(t.forEach(O=>{var D;let A=o.routes[O.route.id];!A||!A.hasLoader||(!p.some(z=>z.route.id===O.route.id)&&O.route.id in m&&((D=u[O.route.id])!=null&&D.shouldRevalidate)||A.hasClientLoader?j=!0:C.add(O.route.id))}),C.size===0)return[];let E=lM(e,f,s.unstable_trailingSlashAwareDataRequests,"data");return j&&C.size>0&&E.searchParams.set("_routes",t.filter(O=>C.has(O.route.id)).map(O=>O.route.id).join(",")),[E.pathname+E.search]},[f,s.unstable_trailingSlashAwareDataRequests,m,a,o,p,t,e,u]),x=b.useMemo(()=>dM(g,o),[g,o]),k=vM(g);return b.createElement(b.Fragment,null,w.map(C=>b.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...n})),x.map(C=>b.createElement("link",{key:C,rel:"modulepreload",href:C,...n})),k.map(({key:C,link:j})=>b.createElement("link",{key:C,nonce:n.nonce,...j,crossOrigin:j.crossOrigin??n.crossOrigin})))}function xM(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var wM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{wM&&(window.__reactRouterVersion="7.13.1")}catch{}function SM({basename:e,children:t,unstable_useTransitions:n,window:a}){let s=b.useRef();s.current==null&&(s.current=JR({window:a,v5Compat:!0}));let o=s.current,[u,f]=b.useState({action:o.action,location:o.location}),m=b.useCallback(h=>{n===!1?f(h):b.startTransition(()=>f(h))},[n]);return b.useLayoutEffect(()=>o.listen(m),[o,m]),b.createElement(YO,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:o,unstable_useTransitions:n})}var OC=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,zu=b.forwardRef(function({onClick:t,discover:n="render",prefetch:a="none",relative:s,reloadDocument:o,replace:u,unstable_mask:f,state:m,target:h,to:p,preventScrollReset:g,viewTransition:w,unstable_defaultShouldRevalidate:x,...k},C){let{basename:j,navigator:E,unstable_useTransitions:O}=b.useContext(Gr),A=typeof p=="string"&&OC.test(p),D=xC(p,j);p=D.to;let z=MO(p,{relative:s}),R=Rr(),F=null;if(f){let X=ch(f,[],R.unstable_mask?R.unstable_mask.pathname:"/",!0);j!=="/"&&(X.pathname=X.pathname==="/"?j:Da([j,X.pathname])),F=E.createHref(X)}let[B,ee,L]=gM(a,k),I=CM(p,{replace:u,unstable_mask:f,state:m,target:h,preventScrollReset:g,relative:s,viewTransition:w,unstable_defaultShouldRevalidate:x,unstable_useTransitions:O});function Q(X){t&&t(X),X.defaultPrevented||I(X)}let te=!(D.isExternal||o),Y=b.createElement("a",{...k,...L,href:(te?F:void 0)||D.absoluteURL||z,onClick:te?Q:t,ref:xM(C,ee),target:h,"data-discover":!A&&n==="render"?"true":void 0});return B&&!A?b.createElement(b.Fragment,null,Y,b.createElement(yM,{page:z})):Y});zu.displayName="Link";var jv=b.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:a="",end:s=!1,style:o,to:u,viewTransition:f,children:m,...h},p){let g=Du(u,{relative:h.relative}),w=Rr(),x=b.useContext(uh),{navigator:k,basename:C}=b.useContext(Gr),j=x!=null&&AM(g)&&f===!0,E=k.encodeLocation?k.encodeLocation(g).pathname:g.pathname,O=w.pathname,A=x&&x.navigation&&x.navigation.location?x.navigation.location.pathname:null;n||(O=O.toLowerCase(),A=A?A.toLowerCase():null,E=E.toLowerCase()),A&&C&&(A=hi(A,C)||A);const D=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let z=O===E||!s&&O.startsWith(E)&&O.charAt(D)==="/",R=A!=null&&(A===E||!s&&A.startsWith(E)&&A.charAt(E.length)==="/"),F={isActive:z,isPending:R,isTransitioning:j},B=z?t:void 0,ee;typeof a=="function"?ee=a(F):ee=[a,z?"active":null,R?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let L=typeof o=="function"?o(F):o;return b.createElement(zu,{...h,"aria-current":B,className:ee,ref:p,style:L,to:u,viewTransition:f},typeof m=="function"?m(F):m)});jv.displayName="NavLink";var kM=b.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:a,replace:s,state:o,method:u=zf,action:f,onSubmit:m,relative:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:w,...x},k)=>{let{unstable_useTransitions:C}=b.useContext(Gr),j=_M(),E=TM(f,{relative:h}),O=u.toLowerCase()==="get"?"get":"post",A=typeof f=="string"&&OC.test(f),D=z=>{if(m&&m(z),z.defaultPrevented)return;z.preventDefault();let R=z.nativeEvent.submitter,F=(R==null?void 0:R.getAttribute("formmethod"))||u,B=()=>j(R||z.currentTarget,{fetcherKey:t,method:F,navigate:n,replace:s,state:o,relative:h,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:w});C&&n!==!1?b.startTransition(()=>B()):B()};return b.createElement("form",{ref:k,method:O,action:E,onSubmit:a?m:D,...x,"data-discover":!A&&e==="render"?"true":void 0})});kM.displayName="Form";function jM(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function MC(e){let t=b.useContext(Ao);return Jt(t,jM(e)),t}function CM(e,{target:t,replace:n,unstable_mask:a,state:s,preventScrollReset:o,relative:u,viewTransition:f,unstable_defaultShouldRevalidate:m,unstable_useTransitions:h}={}){let p=zn(),g=Rr(),w=Du(e,{relative:u});return b.useCallback(x=>{if(nM(x,t)){x.preventDefault();let k=n!==void 0?n:cu(g)===cu(w),C=()=>p(e,{replace:k,unstable_mask:a,state:s,preventScrollReset:o,relative:u,viewTransition:f,unstable_defaultShouldRevalidate:m});h?b.startTransition(()=>C()):C()}},[g,p,w,n,a,s,t,e,o,u,f,m,h])}function Oo(e){ua(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=b.useRef(vy(e)),n=b.useRef(!1),a=Rr(),s=b.useMemo(()=>rM(a.search,n.current?null:t.current),[a.search]),o=zn(),u=b.useCallback((f,m)=>{const h=vy(typeof f=="function"?f(new URLSearchParams(s)):f);n.current=!0,o("?"+h,m)},[o,s]);return[s,u]}var EM=0,NM=()=>`__${String(++EM)}__`;function _M(){let{router:e}=MC("useSubmit"),{basename:t}=b.useContext(Gr),n=GO(),a=e.fetch,s=e.navigate;return b.useCallback(async(o,u={})=>{let{action:f,method:m,encType:h,formData:p,body:g}=sM(o,t);if(u.navigate===!1){let w=u.fetcherKey||NM();await a(w,n,u.action||f,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:p,body:g,formMethod:u.method||m,formEncType:u.encType||h,flushSync:u.flushSync})}else await s(u.action||f,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:p,body:g,formMethod:u.method||m,formEncType:u.encType||h,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[a,s,t,n])}function TM(e,{relative:t}={}){let{basename:n}=b.useContext(Gr),a=b.useContext(fa);Jt(a,"useFormAction must be used inside a RouteContext");let[s]=a.matches.slice(-1),o={...Du(e||".",{relative:t})},u=Rr();if(e==null){o.search=u.search;let f=new URLSearchParams(o.search),m=f.getAll("index");if(m.some(p=>p==="")){f.delete("index"),m.filter(g=>g).forEach(g=>f.append("index",g));let p=f.toString();o.search=p?`?${p}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(o.pathname=o.pathname==="/"?n:Da([n,o.pathname])),cu(o)}function AM(e,{relative:t}={}){let n=b.useContext(SC);Jt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=MC("useViewTransitionState"),s=Du(e,{relative:t});if(!n.isTransitioning)return!1;let o=hi(n.currentLocation.pathname,a)||n.currentLocation.pathname,u=hi(n.nextLocation.pathname,a)||n.nextLocation.pathname;return Hf(s.pathname,u)!=null||Hf(s.pathname,o)!=null}const RM="/api/v1";async function OM(e,t){const n=await fetch(`${RM}/auth/login`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:e,password:t})});if(!n.ok){const a=await n.text();let s;try{s=JSON.parse(a).error??a}catch{s=a}throw new Error(s)}return await n.json()}const DC="/api/v1",Cv="first-tree-hub:tokens";let by=null;function zc(e){by=e}function hn(e){if(!by)throw new Error(`withOrg("${e}") called before an organization is selected`);return`/orgs/${encodeURIComponent(by)}${e}`}function xy(e,t){return`/orgs/${encodeURIComponent(e)}${t}`}function Iu(){const e=localStorage.getItem(Cv);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function wy(e){localStorage.setItem(Cv,JSON.stringify(e))}function zC(){localStorage.removeItem(Cv)}class xs extends Error{constructor(t,n,a){super(n),this.status=t,this.issues=a,this.name="ApiError"}}let Ic=null;async function MM(){const e=Iu();return e!=null&&e.refreshToken?IC(e.refreshToken):null}async function IC(e){return Ic||(Ic=(async()=>{try{const t=await fetch(`${DC}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:e})});if(!t.ok)return null;const n=await t.json(),a={accessToken:n.accessToken,refreshToken:n.refreshToken??e};return wy(a),a}catch{return null}finally{Ic=null}})(),Ic)}async function Lc(e,t){const{method:n="GET",body:a}=t??{},s=f=>{const m={};return f&&(m.Authorization=`Bearer ${f}`),a!==void 0&&(m["Content-Type"]="application/json"),fetch(`${DC}${e}`,{method:n,headers:m,body:a!==void 0?JSON.stringify(a):void 0})},o=Iu();let u=await s(o==null?void 0:o.accessToken);if(u.status===401&&(o!=null&&o.refreshToken)){const f=await IC(o.refreshToken);f&&(u=await s(f.accessToken))}if(!u.ok){u.status===401&&(zC(),window.dispatchEvent(new CustomEvent("auth:logout")));const f=await u.text();let m,h;try{const p=JSON.parse(f);m=p.error??f,Array.isArray(p.details)&&(h=p.details.filter(g=>typeof g=="object"&&g!==null&&Array.isArray(g.path)))}catch{m=f}throw new xs(u.status,m,h)}if(u.status!==204)return await u.json()}const Ce={get:e=>Lc(e),post:(e,t)=>Lc(e,{method:"POST",body:t}),patch:(e,t)=>Lc(e,{method:"PATCH",body:t}),put:(e,t)=>Lc(e,{method:"PUT",body:t}),delete:e=>Lc(e,{method:"DELETE"})};async function mi(e,t){try{await Ce.post("/me/onboarding/events",{event:e,attrs:t})}catch{}}async function DM(){try{await Ce.post("/me/onboarding-completed",{})}catch{}}const Ev="onboarding:joinPath",zM="onboarding:draft",Sy="onboarding:step1Confirmed";function LC(){return typeof window>"u"?!1:window.sessionStorage.getItem(Sy)==="1"}function IM(e){typeof window>"u"||(e?window.sessionStorage.setItem(Sy,"1"):window.sessionStorage.removeItem(Sy))}const ky="onboarding:agentUuid";function LM(){return typeof window>"u"?null:window.sessionStorage.getItem(ky)}function PM(e){typeof window>"u"||(e?window.sessionStorage.setItem(ky,e):window.sessionStorage.removeItem(ky))}function PC(e){typeof window>"u"||window.sessionStorage.setItem(Ev,e)}function UM(){if(typeof window>"u")return null;const e=window.sessionStorage.getItem(Ev);return e==="solo"||e==="invite"?e:null}function BM(){typeof window>"u"||window.sessionStorage.removeItem(Ev)}function FM(e,t){return`${e??"unknown-org"}:${t??"unknown-member"}`}function Nv(e){return`${zM}:${e}`}function $M(e){if(!e||typeof e!="object"||!("displayName"in e)||typeof e.displayName!="string")return null;const t="selectedRuntime"in e?e.selectedRuntime:null;if(t!==null&&typeof t!="string")return null;const n="connectToken"in e?e.connectToken:null;if(n!==null&&typeof n!="string")return null;const a="connectTokenExpiresAt"in e?e.connectTokenExpiresAt:null;if(a!==null&&typeof a!="number")return null;const s="visibility"in e?e.visibility:null,o=s==="private"||s==="organization"?s:null;return{displayName:e.displayName,selectedRuntime:t,connectToken:n,connectTokenExpiresAt:a,visibility:o}}function HM(e){if(typeof window>"u")return null;const t=window.sessionStorage.getItem(Nv(e));if(!t)return null;try{return $M(JSON.parse(t))}catch{return null}}function qM(e,t){typeof window>"u"||window.sessionStorage.setItem(Nv(e),JSON.stringify(t))}function ZM(e){typeof window>"u"||window.sessionStorage.removeItem(Nv(e))}function GM(){if(typeof window>"u")return;const e=window.sessionStorage,t=[];for(let n=0;n<e.length;n++){const a=e.key(n);a!=null&&a.startsWith("onboarding:")&&t.push(a)}for(const n of t)e.removeItem(n)}const UC=b.createContext(null),jy="first-tree-hub:selectedOrganizationId";function VM(){try{return localStorage.getItem(jy)}catch{return null}}function ng(e){try{e===null?localStorage.removeItem(jy):localStorage.setItem(jy,e)}catch{}}function QM({children:e}){const t=vn(),[n,a]=b.useState(()=>!!Iu()),[s,o]=b.useState(null),[u,f]=b.useState([]),[m,h]=b.useState(()=>{const Q=VM();return zc(Q),Q}),[p,g]=b.useState(null),[w,x]=b.useState(null),[k,C]=b.useState(null),[j,E]=b.useState(!1),O=b.useCallback(()=>{zC(),ng(null),zc(null),t.clear(),GM(),a(!1),o(null),f([]),h(null),g(null),x(null),C(null),E(!1)},[t]),A=b.useCallback(async()=>{var Q,te,Y;try{const X=await Ce.get("/me");o(X.user??null);const G=X.memberships??[];f(G);const se=((Q=X.onboarding)==null?void 0:Q.step)??null;g(se),x(((te=X.onboarding)==null?void 0:te.dismissedAt)??null),C(((Y=X.onboarding)==null?void 0:Y.completedAt)??null),se==="completed"&&BM(),h(J=>{var U;const ve=J&&G.some(P=>P.organizationId===J)?J:null;if(ve)return zc(ve),ve;const M=X.defaultOrganizationId??((U=G[0])==null?void 0:U.organizationId)??null;return ng(M),zc(M),M})}catch{}finally{E(!0)}},[]),D=b.useCallback(async(Q,te)=>{const Y=await OM(Q,te);wy({accessToken:Y.accessToken,refreshToken:Y.refreshToken}),a(!0),await A()},[A]),z=b.useCallback(async Q=>{wy(Q),a(!0),await A()},[A]),R=b.useCallback(async Q=>{ng(Q),zc(Q),t.clear(),h(Q),await A()},[A,t]),F=b.useRef(null);b.useEffect(()=>{F.current=w},[w]);const B=b.useCallback(async()=>{const Q=F.current;x(new Date().toISOString());try{const te=await Ce.patch("/me/onboarding",{dismissed:!0});te!=null&&te.dismissedAt&&x(te.dismissedAt)}catch{x(Q)}},[]),ee=b.useCallback(async()=>{const Q=F.current;x(null);try{await Ce.patch("/me/onboarding",{dismissed:!1})}catch{x(Q)}},[]),L=b.useCallback(async()=>{C(Q=>Q??new Date().toISOString()),await DM()},[]);b.useEffect(()=>{n&&!s&&A()},[n,s,A]),b.useEffect(()=>{const Q=()=>O();return window.addEventListener("auth:logout",Q),()=>window.removeEventListener("auth:logout",Q)},[O]);const I=b.useMemo(()=>u.length===0?null:u.find(te=>te.organizationId===m)??u[0]??null,[u,m]);return l.jsx(UC.Provider,{value:{isAuthenticated:n,meLoaded:j,user:s,memberships:u,currentMembership:I,organizationId:(I==null?void 0:I.organizationId)??null,memberId:(I==null?void 0:I.id)??null,role:(I==null?void 0:I.role)??null,agentId:(I==null?void 0:I.agentId)??null,teamDisplayName:(I==null?void 0:I.organizationName)??null,orgHasOtherMembers:(I==null?void 0:I.orgHasOtherMembers)??!1,onboardingStep:p,onboardingDismissedAt:w,onboardingCompletedAt:k,dismissOnboarding:B,restoreOnboarding:ee,markOnboardingCompleted:L,login:D,adoptTokens:z,selectOrganization:R,refreshMe:A,logout:O},children:e})}function ut(){const e=b.useContext(UC);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const KM="modulepreload",YM=function(e){return"/"+e},i1={},XM=function(t,n,a){let s=Promise.resolve();if(n&&n.length>0){let u=function(h){return Promise.all(h.map(p=>Promise.resolve(p).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"));s=u(n.map(h=>{if(h=YM(h),h in i1)return;i1[h]=!0;const p=h.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const w=document.createElement("link");if(w.rel=p?"stylesheet":KM,p||(w.as="script"),w.crossOrigin="",w.href=h,m&&w.setAttribute("nonce",m),document.head.appendChild(w),p)return new Promise((x,k)=>{w.addEventListener("load",x),w.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(u){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=u,window.dispatchEvent(f),!f.defaultPrevented)throw u}return s.then(u=>{for(const f of u||[])f.status==="rejected"&&o(f.reason);return t().catch(o)})},WM=b.lazy(()=>XM(()=>import("./index-C7x7O7dG.js"),[]).then(e=>({default:e.LandingPage}))),s1=()=>l.jsx("div",{className:"landing-marketing min-h-screen bg-background"});function JM(){const{isAuthenticated:e,meLoaded:t}=ut(),n=Rr();return e?t?l.jsx(qf,{}):l.jsx(s1,{}):n.pathname==="/"?l.jsx(b.Suspense,{fallback:l.jsx(s1,{}),children:l.jsx(WM,{})}):l.jsx(tr,{to:"/login",replace:!0,state:{from:n}})}/**
|
|
61
|
-
* @license lucide-react v0.577.0 - ISC
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the ISC license.
|
|
64
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/const BC=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim();/**
|
|
66
|
-
* @license lucide-react v0.577.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 eD=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
71
|
-
* @license lucide-react v0.577.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 tD=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase());/**
|
|
76
|
-
* @license lucide-react v0.577.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 l1=e=>{const t=tD(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
81
|
-
* @license lucide-react v0.577.0 - ISC
|
|
82
|
-
*
|
|
83
|
-
* This source code is licensed under the ISC license.
|
|
84
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
-
*/var nD={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
86
|
-
* @license lucide-react v0.577.0 - ISC
|
|
87
|
-
*
|
|
88
|
-
* This source code is licensed under the ISC license.
|
|
89
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
-
*/const rD=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
|
|
91
|
-
* @license lucide-react v0.577.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 aD=b.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:s="",children:o,iconNode:u,...f},m)=>b.createElement("svg",{ref:m,...nD,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:BC("lucide",s),...!o&&!rD(f)&&{"aria-hidden":"true"},...f},[...u.map(([h,p])=>b.createElement(h,p)),...Array.isArray(o)?o:[o]]));/**
|
|
96
|
-
* @license lucide-react v0.577.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 ot=(e,t)=>{const n=b.forwardRef(({className:a,...s},o)=>b.createElement(aD,{ref:o,iconNode:t,className:BC(`lucide-${eD(l1(e))}`,`lucide-${e}`,a),...s}));return n.displayName=l1(e),n};/**
|
|
101
|
-
* @license lucide-react v0.577.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 iD=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],_v=ot("arrow-left",iD);/**
|
|
106
|
-
* @license lucide-react v0.577.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 sD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],FC=ot("arrow-right",sD);/**
|
|
111
|
-
* @license lucide-react v0.577.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 lD=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],$C=ot("arrow-up",lD);/**
|
|
116
|
-
* @license lucide-react v0.577.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 oD=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],cD=ot("at-sign",oD);/**
|
|
121
|
-
* @license lucide-react v0.577.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 uD=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],dD=ot("bell",uD);/**
|
|
126
|
-
* @license lucide-react v0.577.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 fD=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],HC=ot("bot",fD);/**
|
|
131
|
-
* @license lucide-react v0.577.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 hD=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],mD=ot("building-2",hD);/**
|
|
136
|
-
* @license lucide-react v0.577.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 pD=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],mr=ot("check",pD);/**
|
|
141
|
-
* @license lucide-react v0.577.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 gD=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Tv=ot("chevron-down",gD);/**
|
|
146
|
-
* @license lucide-react v0.577.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 yD=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],vD=ot("chevron-right",yD);/**
|
|
151
|
-
* @license lucide-react v0.577.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 bD=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],xD=ot("circle-pause",bD);/**
|
|
156
|
-
* @license lucide-react v0.577.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 wD=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],qC=ot("copy",wD);/**
|
|
161
|
-
* @license lucide-react v0.577.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 SD=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],kD=ot("ellipsis",SD);/**
|
|
166
|
-
* @license lucide-react v0.577.0 - ISC
|
|
167
|
-
*
|
|
168
|
-
* This source code is licensed under the ISC license.
|
|
169
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
-
*/const jD=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Av=ot("external-link",jD);/**
|
|
171
|
-
* @license lucide-react v0.577.0 - ISC
|
|
172
|
-
*
|
|
173
|
-
* This source code is licensed under the ISC license.
|
|
174
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
-
*/const CD=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ED=ot("eye-off",CD);/**
|
|
176
|
-
* @license lucide-react v0.577.0 - ISC
|
|
177
|
-
*
|
|
178
|
-
* This source code is licensed under the ISC license.
|
|
179
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
-
*/const ND=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],ZC=ot("eye",ND);/**
|
|
181
|
-
* @license lucide-react v0.577.0 - ISC
|
|
182
|
-
*
|
|
183
|
-
* This source code is licensed under the ISC license.
|
|
184
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
-
*/const _D=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],GC=ot("github",_D);/**
|
|
186
|
-
* @license lucide-react v0.577.0 - ISC
|
|
187
|
-
*
|
|
188
|
-
* This source code is licensed under the ISC license.
|
|
189
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
-
*/const TD=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],AD=ot("layout-dashboard",TD);/**
|
|
191
|
-
* @license lucide-react v0.577.0 - ISC
|
|
192
|
-
*
|
|
193
|
-
* This source code is licensed under the ISC license.
|
|
194
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
-
*/const RD=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Cy=ot("link-2",RD);/**
|
|
196
|
-
* @license lucide-react v0.577.0 - ISC
|
|
197
|
-
*
|
|
198
|
-
* This source code is licensed under the ISC license.
|
|
199
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
-
*/const OD=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Zf=ot("loader-circle",OD);/**
|
|
201
|
-
* @license lucide-react v0.577.0 - ISC
|
|
202
|
-
*
|
|
203
|
-
* This source code is licensed under the ISC license.
|
|
204
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
-
*/const MD=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],fh=ot("lock",MD);/**
|
|
206
|
-
* @license lucide-react v0.577.0 - ISC
|
|
207
|
-
*
|
|
208
|
-
* This source code is licensed under the ISC license.
|
|
209
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
-
*/const DD=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],zD=ot("log-out",DD);/**
|
|
211
|
-
* @license lucide-react v0.577.0 - ISC
|
|
212
|
-
*
|
|
213
|
-
* This source code is licensed under the ISC license.
|
|
214
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
-
*/const ID=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Rv=ot("message-square",ID);/**
|
|
216
|
-
* @license lucide-react v0.577.0 - ISC
|
|
217
|
-
*
|
|
218
|
-
* This source code is licensed under the ISC license.
|
|
219
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
-
*/const LD=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],PD=ot("moon",LD);/**
|
|
221
|
-
* @license lucide-react v0.577.0 - ISC
|
|
222
|
-
*
|
|
223
|
-
* This source code is licensed under the ISC license.
|
|
224
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
-
*/const UD=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],BD=ot("network",UD);/**
|
|
226
|
-
* @license lucide-react v0.577.0 - ISC
|
|
227
|
-
*
|
|
228
|
-
* This source code is licensed under the ISC license.
|
|
229
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const FD=[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]],$D=ot("paperclip",FD);/**
|
|
231
|
-
* @license lucide-react v0.577.0 - ISC
|
|
232
|
-
*
|
|
233
|
-
* This source code is licensed under the ISC license.
|
|
234
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
-
*/const HD=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],hh=ot("pencil",HD);/**
|
|
236
|
-
* @license lucide-react v0.577.0 - ISC
|
|
237
|
-
*
|
|
238
|
-
* This source code is licensed under the ISC license.
|
|
239
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
-
*/const qD=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],VC=ot("play",qD);/**
|
|
241
|
-
* @license lucide-react v0.577.0 - ISC
|
|
242
|
-
*
|
|
243
|
-
* This source code is licensed under the ISC license.
|
|
244
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
-
*/const ZD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Sa=ot("plus",ZD);/**
|
|
246
|
-
* @license lucide-react v0.577.0 - ISC
|
|
247
|
-
*
|
|
248
|
-
* This source code is licensed under the ISC license.
|
|
249
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
-
*/const GD=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],VD=ot("refresh-cw",GD);/**
|
|
251
|
-
* @license lucide-react v0.577.0 - ISC
|
|
252
|
-
*
|
|
253
|
-
* This source code is licensed under the ISC license.
|
|
254
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
-
*/const QD=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ov=ot("search",QD);/**
|
|
256
|
-
* @license lucide-react v0.577.0 - ISC
|
|
257
|
-
*
|
|
258
|
-
* This source code is licensed under the ISC license.
|
|
259
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
-
*/const KD=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],YD=ot("sun",KD);/**
|
|
261
|
-
* @license lucide-react v0.577.0 - ISC
|
|
262
|
-
*
|
|
263
|
-
* This source code is licensed under the ISC license.
|
|
264
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
-
*/const XD=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Gf=ot("trash-2",XD);/**
|
|
266
|
-
* @license lucide-react v0.577.0 - ISC
|
|
267
|
-
*
|
|
268
|
-
* This source code is licensed under the ISC license.
|
|
269
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
-
*/const WD=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Lu=ot("triangle-alert",WD);/**
|
|
271
|
-
* @license lucide-react v0.577.0 - ISC
|
|
272
|
-
*
|
|
273
|
-
* This source code is licensed under the ISC license.
|
|
274
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
-
*/const JD=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],e3=ot("undo-2",JD);/**
|
|
276
|
-
* @license lucide-react v0.577.0 - ISC
|
|
277
|
-
*
|
|
278
|
-
* This source code is licensed under the ISC license.
|
|
279
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
-
*/const t3=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],QC=ot("user-plus",t3);/**
|
|
281
|
-
* @license lucide-react v0.577.0 - ISC
|
|
282
|
-
*
|
|
283
|
-
* This source code is licensed under the ISC license.
|
|
284
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
-
*/const n3=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Mv=ot("user",n3);/**
|
|
286
|
-
* @license lucide-react v0.577.0 - ISC
|
|
287
|
-
*
|
|
288
|
-
* This source code is licensed under the ISC license.
|
|
289
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
-
*/const r3=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],KC=ot("users",r3);/**
|
|
291
|
-
* @license lucide-react v0.577.0 - ISC
|
|
292
|
-
*
|
|
293
|
-
* This source code is licensed under the ISC license.
|
|
294
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
-
*/const a3=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],pi=ot("x",a3);/**
|
|
296
|
-
* @license lucide-react v0.577.0 - ISC
|
|
297
|
-
*
|
|
298
|
-
* This source code is licensed under the ISC license.
|
|
299
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
-
*/const i3=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],s3=ot("zap",i3);function YC(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=YC(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function XC(){for(var e,t,n=0,a="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=YC(e))&&(a&&(a+=" "),a+=t);return a}const l3=(e,t)=>{const n=new Array(e.length+t.length);for(let a=0;a<e.length;a++)n[a]=e[a];for(let a=0;a<t.length;a++)n[e.length+a]=t[a];return n},o3=(e,t)=>({classGroupId:e,validator:t}),WC=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Vf="-",o1=[],c3="arbitrary..",u3=e=>{const t=f3(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return d3(u);const f=u.split(Vf),m=f[0]===""&&f.length>1?1:0;return JC(f,m,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const m=a[u],h=n[u];return m?h?l3(h,m):m:h||o1}return n[u]||o1}}},JC=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],o=n.nextPart.get(s);if(o){const h=JC(e,t+1,o);if(h)return h}const u=n.validators;if(u===null)return;const f=t===0?e.join(Vf):e.slice(t).join(Vf),m=u.length;for(let h=0;h<m;h++){const p=u[h];if(p.validator(f))return p.classGroupId}},d3=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),a=t.slice(0,n);return a?c3+a:void 0})(),f3=e=>{const{theme:t,classGroups:n}=e;return h3(n,t)},h3=(e,t)=>{const n=WC();for(const a in e){const s=e[a];Dv(s,n,a,t)}return n},Dv=(e,t,n,a)=>{const s=e.length;for(let o=0;o<s;o++){const u=e[o];m3(u,t,n,a)}},m3=(e,t,n,a)=>{if(typeof e=="string"){p3(e,t,n);return}if(typeof e=="function"){g3(e,t,n,a);return}y3(e,t,n,a)},p3=(e,t,n)=>{const a=e===""?t:eE(t,e);a.classGroupId=n},g3=(e,t,n,a)=>{if(v3(e)){Dv(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(o3(n,e))},y3=(e,t,n,a)=>{const s=Object.entries(e),o=s.length;for(let u=0;u<o;u++){const[f,m]=s[u];Dv(m,eE(t,f),n,a)}},eE=(e,t)=>{let n=e;const a=t.split(Vf),s=a.length;for(let o=0;o<s;o++){const u=a[o];let f=n.nextPart.get(u);f||(f=WC(),n.nextPart.set(u,f)),n=f}return n},v3=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,b3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const s=(o,u)=>{n[o]=u,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(o){let u=n[o];if(u!==void 0)return u;if((u=a[o])!==void 0)return s(o,u),u},set(o,u){o in n?n[o]=u:s(o,u)}}},Ey="!",c1=":",x3=[],u1=(e,t,n,a,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:s}),w3=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=s=>{const o=[];let u=0,f=0,m=0,h;const p=s.length;for(let C=0;C<p;C++){const j=s[C];if(u===0&&f===0){if(j===c1){o.push(s.slice(m,C)),m=C+1;continue}if(j==="/"){h=C;continue}}j==="["?u++:j==="]"?u--:j==="("?f++:j===")"&&f--}const g=o.length===0?s:s.slice(m);let w=g,x=!1;g.endsWith(Ey)?(w=g.slice(0,-1),x=!0):g.startsWith(Ey)&&(w=g.slice(1),x=!0);const k=h&&h>m?h-m:void 0;return u1(o,x,w,k)};if(t){const s=t+c1,o=a;a=u=>u.startsWith(s)?o(u.slice(s.length)):u1(x3,!1,u,void 0,!0)}if(n){const s=a;a=o=>n({className:o,parseClassName:s})}return a},S3=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let s=[];for(let o=0;o<n.length;o++){const u=n[o],f=u[0]==="[",m=t.has(u);f||m?(s.length>0&&(s.sort(),a.push(...s),s=[]),a.push(u)):s.push(u)}return s.length>0&&(s.sort(),a.push(...s)),a}},k3=e=>({cache:b3(e.cacheSize),parseClassName:w3(e),sortModifiers:S3(e),...u3(e)}),j3=/\s+/,C3=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:s,sortModifiers:o}=t,u=[],f=e.trim().split(j3);let m="";for(let h=f.length-1;h>=0;h-=1){const p=f[h],{isExternal:g,modifiers:w,hasImportantModifier:x,baseClassName:k,maybePostfixModifierPosition:C}=n(p);if(g){m=p+(m.length>0?" "+m:m);continue}let j=!!C,E=a(j?k.substring(0,C):k);if(!E){if(!j){m=p+(m.length>0?" "+m:m);continue}if(E=a(k),!E){m=p+(m.length>0?" "+m:m);continue}j=!1}const O=w.length===0?"":w.length===1?w[0]:o(w).join(":"),A=x?O+Ey:O,D=A+E;if(u.indexOf(D)>-1)continue;u.push(D);const z=s(E,j);for(let R=0;R<z.length;++R){const F=z[R];u.push(A+F)}m=p+(m.length>0?" "+m:m)}return m},E3=(...e)=>{let t=0,n,a,s="";for(;t<e.length;)(n=e[t++])&&(a=tE(n))&&(s&&(s+=" "),s+=a);return s},tE=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=tE(e[a]))&&(n&&(n+=" "),n+=t);return n},N3=(e,...t)=>{let n,a,s,o;const u=m=>{const h=t.reduce((p,g)=>g(p),e());return n=k3(h),a=n.cache.get,s=n.cache.set,o=f,f(m)},f=m=>{const h=a(m);if(h)return h;const p=C3(m,n);return s(m,p),p};return o=u,(...m)=>o(E3(...m))},_3=[],Mn=e=>{const t=n=>n[e]||_3;return t.isThemeGetter=!0,t},nE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,rE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,T3=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,A3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,R3=/\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$/,O3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,M3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,D3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Xi=e=>T3.test(e),ct=e=>!!e&&!Number.isNaN(Number(e)),Wi=e=>!!e&&Number.isInteger(Number(e)),rg=e=>e.endsWith("%")&&ct(e.slice(0,-1)),ai=e=>A3.test(e),aE=()=>!0,z3=e=>R3.test(e)&&!O3.test(e),zv=()=>!1,I3=e=>M3.test(e),L3=e=>D3.test(e),P3=e=>!Me(e)&&!Ie(e),U3=e=>ws(e,lE,zv),Me=e=>nE.test(e),Fs=e=>ws(e,oE,z3),d1=e=>ws(e,V3,ct),B3=e=>ws(e,uE,aE),F3=e=>ws(e,cE,zv),f1=e=>ws(e,iE,zv),$3=e=>ws(e,sE,L3),mf=e=>ws(e,dE,I3),Ie=e=>rE.test(e),Pc=e=>sl(e,oE),H3=e=>sl(e,cE),h1=e=>sl(e,iE),q3=e=>sl(e,lE),Z3=e=>sl(e,sE),pf=e=>sl(e,dE,!0),G3=e=>sl(e,uE,!0),ws=(e,t,n)=>{const a=nE.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},sl=(e,t,n=!1)=>{const a=rE.exec(e);return a?a[1]?t(a[1]):n:!1},iE=e=>e==="position"||e==="percentage",sE=e=>e==="image"||e==="url",lE=e=>e==="length"||e==="size"||e==="bg-size",oE=e=>e==="length",V3=e=>e==="number",cE=e=>e==="family-name",uE=e=>e==="number"||e==="weight",dE=e=>e==="shadow",Q3=()=>{const e=Mn("color"),t=Mn("font"),n=Mn("text"),a=Mn("font-weight"),s=Mn("tracking"),o=Mn("leading"),u=Mn("breakpoint"),f=Mn("container"),m=Mn("spacing"),h=Mn("radius"),p=Mn("shadow"),g=Mn("inset-shadow"),w=Mn("text-shadow"),x=Mn("drop-shadow"),k=Mn("blur"),C=Mn("perspective"),j=Mn("aspect"),E=Mn("ease"),O=Mn("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],z=()=>[...D(),Ie,Me],R=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],B=()=>[Ie,Me,m],ee=()=>[Xi,"full","auto",...B()],L=()=>[Wi,"none","subgrid",Ie,Me],I=()=>["auto",{span:["full",Wi,Ie,Me]},Wi,Ie,Me],Q=()=>[Wi,"auto",Ie,Me],te=()=>["auto","min","max","fr",Ie,Me],Y=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...B()],se=()=>[Xi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...B()],J=()=>[Xi,"screen","full","dvw","lvw","svw","min","max","fit",...B()],ve=()=>[Xi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...B()],M=()=>[e,Ie,Me],U=()=>[...D(),h1,f1,{position:[Ie,Me]}],P=()=>["no-repeat",{repeat:["","x","y","space","round"]}],_=()=>["auto","cover","contain",q3,U3,{size:[Ie,Me]}],V=()=>[rg,Pc,Fs],H=()=>["","none","full",h,Ie,Me],ae=()=>["",ct,Pc,Fs],Se=()=>["solid","dashed","dotted","double"],Ae=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ee=()=>[ct,rg,h1,f1],Ge=()=>["","none",k,Ie,Me],Fe=()=>["none",ct,Ie,Me],Ve=()=>["none",ct,Ie,Me],st=()=>[ct,Ie,Me],Nt=()=>[Xi,"full",...B()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ai],breakpoint:[ai],color:[aE],container:[ai],"drop-shadow":[ai],ease:["in","out","in-out"],font:[P3],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ai],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ai],shadow:[ai],spacing:["px",ct],text:[ai],"text-shadow":[ai],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Xi,Me,Ie,j]}],container:["container"],columns:[{columns:[ct,Me,Ie,f]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"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:z()}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ee()}],"inset-x":[{"inset-x":ee()}],"inset-y":[{"inset-y":ee()}],start:[{"inset-s":ee(),start:ee()}],end:[{"inset-e":ee(),end:ee()}],"inset-bs":[{"inset-bs":ee()}],"inset-be":[{"inset-be":ee()}],top:[{top:ee()}],right:[{right:ee()}],bottom:[{bottom:ee()}],left:[{left:ee()}],visibility:["visible","invisible","collapse"],z:[{z:[Wi,"auto",Ie,Me]}],basis:[{basis:[Xi,"full","auto",f,...B()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ct,Xi,"auto","initial","none",Me]}],grow:[{grow:["",ct,Ie,Me]}],shrink:[{shrink:["",ct,Ie,Me]}],order:[{order:[Wi,"first","last","none",Ie,Me]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":Q()}],"col-end":[{"col-end":Q()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:I()}],"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":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:B()}],"gap-x":[{"gap-x":B()}],"gap-y":[{"gap-y":B()}],"justify-content":[{justify:[...Y(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...Y()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":Y()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:B()}],px:[{px:B()}],py:[{py:B()}],ps:[{ps:B()}],pe:[{pe:B()}],pbs:[{pbs:B()}],pbe:[{pbe:B()}],pt:[{pt:B()}],pr:[{pr:B()}],pb:[{pb:B()}],pl:[{pl:B()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mbs:[{mbs:G()}],mbe:[{mbe:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":B()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":B()}],"space-y-reverse":["space-y-reverse"],size:[{size:se()}],"inline-size":[{inline:["auto",...J()]}],"min-inline-size":[{"min-inline":["auto",...J()]}],"max-inline-size":[{"max-inline":["none",...J()]}],"block-size":[{block:["auto",...ve()]}],"min-block-size":[{"min-block":["auto",...ve()]}],"max-block-size":[{"max-block":["none",...ve()]}],w:[{w:[f,"screen",...se()]}],"min-w":[{"min-w":[f,"screen","none",...se()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[u]},...se()]}],h:[{h:["screen","lh",...se()]}],"min-h":[{"min-h":["screen","lh","none",...se()]}],"max-h":[{"max-h":["screen","lh",...se()]}],"font-size":[{text:["base",n,Pc,Fs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,G3,B3]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",rg,Me]}],"font-family":[{font:[H3,F3,t]}],"font-features":[{"font-features":[Me]}],"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:[s,Ie,Me]}],"line-clamp":[{"line-clamp":[ct,"none",Ie,d1]}],leading:[{leading:[o,...B()]}],"list-image":[{"list-image":["none",Ie,Me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ie,Me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:M()}],"text-color":[{text:M()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Se(),"wavy"]}],"text-decoration-thickness":[{decoration:[ct,"from-font","auto",Ie,Fs]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[ct,"auto",Ie,Me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ie,Me]}],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",Ie,Me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:U()}],"bg-repeat":[{bg:P()}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Wi,Ie,Me],radial:["",Ie,Me],conic:[Wi,Ie,Me]},Z3,$3]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-bs":[{"border-bs":ae()}],"border-w-be":[{"border-be":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Se(),"hidden","none"]}],"divide-style":[{divide:[...Se(),"hidden","none"]}],"border-color":[{border:M()}],"border-color-x":[{"border-x":M()}],"border-color-y":[{"border-y":M()}],"border-color-s":[{"border-s":M()}],"border-color-e":[{"border-e":M()}],"border-color-bs":[{"border-bs":M()}],"border-color-be":[{"border-be":M()}],"border-color-t":[{"border-t":M()}],"border-color-r":[{"border-r":M()}],"border-color-b":[{"border-b":M()}],"border-color-l":[{"border-l":M()}],"divide-color":[{divide:M()}],"outline-style":[{outline:[...Se(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ct,Ie,Me]}],"outline-w":[{outline:["",ct,Pc,Fs]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",p,pf,mf]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",g,pf,mf]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[ct,Fs]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",w,pf,mf]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[ct,Ie,Me]}],"mix-blend":[{"mix-blend":[...Ae(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ae()}],"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":[ct]}],"mask-image-linear-from-pos":[{"mask-linear-from":Ee()}],"mask-image-linear-to-pos":[{"mask-linear-to":Ee()}],"mask-image-linear-from-color":[{"mask-linear-from":M()}],"mask-image-linear-to-color":[{"mask-linear-to":M()}],"mask-image-t-from-pos":[{"mask-t-from":Ee()}],"mask-image-t-to-pos":[{"mask-t-to":Ee()}],"mask-image-t-from-color":[{"mask-t-from":M()}],"mask-image-t-to-color":[{"mask-t-to":M()}],"mask-image-r-from-pos":[{"mask-r-from":Ee()}],"mask-image-r-to-pos":[{"mask-r-to":Ee()}],"mask-image-r-from-color":[{"mask-r-from":M()}],"mask-image-r-to-color":[{"mask-r-to":M()}],"mask-image-b-from-pos":[{"mask-b-from":Ee()}],"mask-image-b-to-pos":[{"mask-b-to":Ee()}],"mask-image-b-from-color":[{"mask-b-from":M()}],"mask-image-b-to-color":[{"mask-b-to":M()}],"mask-image-l-from-pos":[{"mask-l-from":Ee()}],"mask-image-l-to-pos":[{"mask-l-to":Ee()}],"mask-image-l-from-color":[{"mask-l-from":M()}],"mask-image-l-to-color":[{"mask-l-to":M()}],"mask-image-x-from-pos":[{"mask-x-from":Ee()}],"mask-image-x-to-pos":[{"mask-x-to":Ee()}],"mask-image-x-from-color":[{"mask-x-from":M()}],"mask-image-x-to-color":[{"mask-x-to":M()}],"mask-image-y-from-pos":[{"mask-y-from":Ee()}],"mask-image-y-to-pos":[{"mask-y-to":Ee()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Ie,Me]}],"mask-image-radial-from-pos":[{"mask-radial-from":Ee()}],"mask-image-radial-to-pos":[{"mask-radial-to":Ee()}],"mask-image-radial-from-color":[{"mask-radial-from":M()}],"mask-image-radial-to-color":[{"mask-radial-to":M()}],"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":D()}],"mask-image-conic-pos":[{"mask-conic":[ct]}],"mask-image-conic-from-pos":[{"mask-conic-from":Ee()}],"mask-image-conic-to-pos":[{"mask-conic-to":Ee()}],"mask-image-conic-from-color":[{"mask-conic-from":M()}],"mask-image-conic-to-color":[{"mask-conic-to":M()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:U()}],"mask-repeat":[{mask:P()}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ie,Me]}],filter:[{filter:["","none",Ie,Me]}],blur:[{blur:Ge()}],brightness:[{brightness:[ct,Ie,Me]}],contrast:[{contrast:[ct,Ie,Me]}],"drop-shadow":[{"drop-shadow":["","none",x,pf,mf]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",ct,Ie,Me]}],"hue-rotate":[{"hue-rotate":[ct,Ie,Me]}],invert:[{invert:["",ct,Ie,Me]}],saturate:[{saturate:[ct,Ie,Me]}],sepia:[{sepia:["",ct,Ie,Me]}],"backdrop-filter":[{"backdrop-filter":["","none",Ie,Me]}],"backdrop-blur":[{"backdrop-blur":Ge()}],"backdrop-brightness":[{"backdrop-brightness":[ct,Ie,Me]}],"backdrop-contrast":[{"backdrop-contrast":[ct,Ie,Me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ct,Ie,Me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ct,Ie,Me]}],"backdrop-invert":[{"backdrop-invert":["",ct,Ie,Me]}],"backdrop-opacity":[{"backdrop-opacity":[ct,Ie,Me]}],"backdrop-saturate":[{"backdrop-saturate":[ct,Ie,Me]}],"backdrop-sepia":[{"backdrop-sepia":["",ct,Ie,Me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":B()}],"border-spacing-x":[{"border-spacing-x":B()}],"border-spacing-y":[{"border-spacing-y":B()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ie,Me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ct,"initial",Ie,Me]}],ease:[{ease:["linear","initial",E,Ie,Me]}],delay:[{delay:[ct,Ie,Me]}],animate:[{animate:["none",O,Ie,Me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[C,Ie,Me]}],"perspective-origin":[{"perspective-origin":z()}],rotate:[{rotate:Fe()}],"rotate-x":[{"rotate-x":Fe()}],"rotate-y":[{"rotate-y":Fe()}],"rotate-z":[{"rotate-z":Fe()}],scale:[{scale:Ve()}],"scale-x":[{"scale-x":Ve()}],"scale-y":[{"scale-y":Ve()}],"scale-z":[{"scale-z":Ve()}],"scale-3d":["scale-3d"],skew:[{skew:st()}],"skew-x":[{"skew-x":st()}],"skew-y":[{"skew-y":st()}],transform:[{transform:[Ie,Me,"","none","gpu","cpu"]}],"transform-origin":[{origin:z()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Nt()}],"translate-x":[{"translate-x":Nt()}],"translate-y":[{"translate-y":Nt()}],"translate-z":[{"translate-z":Nt()}],"translate-none":["translate-none"],accent:[{accent:M()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:M()}],"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",Ie,Me]}],"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":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mbs":[{"scroll-mbs":B()}],"scroll-mbe":[{"scroll-mbe":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pbs":[{"scroll-pbs":B()}],"scroll-pbe":[{"scroll-pbe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"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",Ie,Me]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[ct,Pc,Fs,d1]}],stroke:[{stroke:["none",...M()]}],"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"]}},K3=N3(Q3);function Oe(...e){return K3(XC(e))}function uu(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(e)):"—"}function fE(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date(e)):"—"}function Y3(e){return Ce.delete(`/clients/${encodeURIComponent(e)}`)}function Pu(){return Ce.get(hn("/activity"))}function gi(){return Ce.get("/me/clients")}function X3(){return Ce.get(hn("/clients"))}function mh(e){return Ce.get(`/clients/${e}`)}function W3(e){return Ce.post(`/clients/${e}/disconnect`)}function J3(){return Ce.post("/me/connect-tokens")}const m1=e=>["agent-sessions",e];function ez(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.toolUseId!="string"||typeof t.name!="string"||t.status!=="pending"&&t.status!=="ok"&&t.status!=="error"?null:{toolUseId:t.toolUseId,name:t.name,args:t.args,status:t.status,durationMs:typeof t.durationMs=="number"?t.durationMs:void 0,resultPreview:typeof t.resultPreview=="string"?t.resultPreview:void 0}}function tz(e){if(typeof e!="object"||e===null)return null;const t=e;return t.source!=="sdk"&&t.source!=="runtime"&&t.source!=="tool"||typeof t.message!="string"?null:{source:t.source,message:t.message}}function nz(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.text!="string"?null:{text:t.text}}function hE(e,t){const n=new URLSearchParams;t!=null&&t.state&&n.set("state",t.state),t!=null&&t.runtimeState&&n.set("runtimeState",t.runtimeState);const a=n.toString();return Ce.get(`/agents/${e}/sessions${a?`?${a}`:""}`)}function rz(e,t,n){const a=new URLSearchParams;a.set("limit",String(n.limit)),(n==null?void 0:n.cursor)!==void 0&&a.set("cursor",String(n.cursor)),n!=null&&n.direction&&a.set("direction",n.direction);const s=a.toString();return Ce.get(`/agents/${e}/sessions/${t}/events${s?`?${s}`:""}`)}var p1=1,az=.9,iz=.8,sz=.17,ag=.1,ig=.999,lz=.9999,oz=.99,cz=/[\\\/_+.#"@\[\(\{&]/,uz=/[\\\/_+.#"@\[\(\{&]/g,dz=/[\s-]/,mE=/[\s-]/g;function Ny(e,t,n,a,s,o,u){if(o===t.length)return s===e.length?p1:oz;var f=`${s},${o}`;if(u[f]!==void 0)return u[f];for(var m=a.charAt(o),h=n.indexOf(m,s),p=0,g,w,x,k;h>=0;)g=Ny(e,t,n,a,h+1,o+1,u),g>p&&(h===s?g*=p1:cz.test(e.charAt(h-1))?(g*=iz,x=e.slice(s,h-1).match(uz),x&&s>0&&(g*=Math.pow(ig,x.length))):dz.test(e.charAt(h-1))?(g*=az,k=e.slice(s,h-1).match(mE),k&&s>0&&(g*=Math.pow(ig,k.length))):(g*=sz,s>0&&(g*=Math.pow(ig,h-s))),e.charAt(h)!==t.charAt(o)&&(g*=lz)),(g<ag&&n.charAt(h-1)===a.charAt(o+1)||a.charAt(o+1)===a.charAt(o)&&n.charAt(h-1)!==a.charAt(o))&&(w=Ny(e,t,n,a,h+1,o+2,u),w*ag>g&&(g=w*ag)),g>p&&(p=g),h=n.indexOf(m,h+1);return u[f]=p,p}function g1(e){return e.toLowerCase().replace(mE," ")}function fz(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Ny(e,t,g1(e),g1(t),0,0,{})}function ps(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function y1(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gs(...e){return t=>{let n=!1;const a=e.map(s=>{const o=y1(s,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let s=0;s<a.length;s++){const o=a[s];typeof o=="function"?o():y1(e[s],null)}}}}function ll(...e){return b.useCallback(gs(...e),e)}function hz(e,t){const n=b.createContext(t),a=o=>{const{children:u,...f}=o,m=b.useMemo(()=>f,Object.values(f));return l.jsx(n.Provider,{value:m,children:u})};a.displayName=e+"Provider";function s(o){const u=b.useContext(n);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[a,s]}function mz(e,t=[]){let n=[];function a(o,u){const f=b.createContext(u),m=n.length;n=[...n,u];const h=g=>{var E;const{scope:w,children:x,...k}=g,C=((E=w==null?void 0:w[e])==null?void 0:E[m])||f,j=b.useMemo(()=>k,Object.values(k));return l.jsx(C.Provider,{value:j,children:x})};h.displayName=o+"Provider";function p(g,w){var C;const x=((C=w==null?void 0:w[e])==null?void 0:C[m])||f,k=b.useContext(x);if(k)return k;if(u!==void 0)return u;throw new Error(`\`${g}\` must be used within \`${o}\``)}return[h,p]}const s=()=>{const o=n.map(u=>b.createContext(u));return function(f){const m=(f==null?void 0:f[e])||o;return b.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return s.scopeName=e,[a,pz(s,...t)]}function pz(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const u=a.reduce((f,{useScope:m,scopeName:h})=>{const g=m(o)[`__scope${h}`];return{...f,...g}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var du=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},gz=uv[" useId ".trim().toString()]||(()=>{}),yz=0;function ui(e){const[t,n]=b.useState(gz());return du(()=>{n(a=>a??String(yz++))},[e]),t?`radix-${t}`:""}var vz=uv[" useInsertionEffect ".trim().toString()]||du;function bz({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[s,o,u]=xz({defaultProp:t,onChange:n}),f=e!==void 0,m=f?e:s;{const p=b.useRef(e!==void 0);b.useEffect(()=>{const g=p.current;g!==f&&console.warn(`${a} 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.`),p.current=f},[f,a])}const h=b.useCallback(p=>{var g;if(f){const w=wz(p)?p(e):p;w!==e&&((g=u.current)==null||g.call(u,w))}else o(p)},[f,e,o,u]);return[m,h]}function xz({defaultProp:e,onChange:t}){const[n,a]=b.useState(e),s=b.useRef(n),o=b.useRef(t);return vz(()=>{o.current=t},[t]),b.useEffect(()=>{var u;s.current!==n&&((u=o.current)==null||u.call(o,n),s.current=n)},[n,s]),[n,a,o]}function wz(e){return typeof e=="function"}var Iv=Wj();const Sz=oh(Iv);function pE(e){const t=kz(e),n=b.forwardRef((a,s)=>{const{children:o,...u}=a,f=b.Children.toArray(o),m=f.find(Cz);if(m){const h=m.props.children,p=f.map(g=>g===m?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:g);return l.jsx(t,{...u,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,p):null})}return l.jsx(t,{...u,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}function kz(e){const t=b.forwardRef((n,a)=>{const{children:s,...o}=n;if(b.isValidElement(s)){const u=Nz(s),f=Ez(o,s.props);return s.type!==b.Fragment&&(f.ref=a?gs(a,u):u),b.cloneElement(s,f)}return b.Children.count(s)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var jz=Symbol("radix.slottable");function Cz(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===jz}function Ez(e,t){const n={...t};for(const a in t){const s=e[a],o=t[a];/^on[A-Z]/.test(a)?s&&o?n[a]=(...f)=>{const m=o(...f);return s(...f),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...o}:a==="className"&&(n[a]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function Nz(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _z=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yi=_z.reduce((e,t)=>{const n=pE(`Primitive.${t}`),a=b.forwardRef((s,o)=>{const{asChild:u,...f}=s,m=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function Tz(e,t){e&&Iv.flushSync(()=>e.dispatchEvent(t))}function fu(e){const t=b.useRef(e);return b.useEffect(()=>{t.current=e}),b.useMemo(()=>(...n)=>{var a;return(a=t.current)==null?void 0:a.call(t,...n)},[])}function Az(e,t=globalThis==null?void 0:globalThis.document){const n=fu(e);b.useEffect(()=>{const a=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var Rz="DismissableLayer",_y="dismissableLayer.update",Oz="dismissableLayer.pointerDownOutside",Mz="dismissableLayer.focusOutside",v1,gE=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yE=b.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:u,onDismiss:f,...m}=e,h=b.useContext(gE),[p,g]=b.useState(null),w=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=b.useState({}),k=ll(t,F=>g(F)),C=Array.from(h.layers),[j]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),E=C.indexOf(j),O=p?C.indexOf(p):-1,A=h.layersWithOutsidePointerEventsDisabled.size>0,D=O>=E,z=Iz(F=>{const B=F.target,ee=[...h.branches].some(L=>L.contains(B));!D||ee||(s==null||s(F),u==null||u(F),F.defaultPrevented||f==null||f())},w),R=Lz(F=>{const B=F.target;[...h.branches].some(L=>L.contains(B))||(o==null||o(F),u==null||u(F),F.defaultPrevented||f==null||f())},w);return Az(F=>{O===h.layers.size-1&&(a==null||a(F),!F.defaultPrevented&&f&&(F.preventDefault(),f()))},w),b.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(v1=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),b1(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=v1)}},[p,w,n,h]),b.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),b1())},[p,h]),b.useEffect(()=>{const F=()=>x({});return document.addEventListener(_y,F),()=>document.removeEventListener(_y,F)},[]),l.jsx(yi.div,{...m,ref:k,style:{pointerEvents:A?D?"auto":"none":void 0,...e.style},onFocusCapture:ps(e.onFocusCapture,R.onFocusCapture),onBlurCapture:ps(e.onBlurCapture,R.onBlurCapture),onPointerDownCapture:ps(e.onPointerDownCapture,z.onPointerDownCapture)})});yE.displayName=Rz;var Dz="DismissableLayerBranch",zz=b.forwardRef((e,t)=>{const n=b.useContext(gE),a=b.useRef(null),s=ll(t,a);return b.useEffect(()=>{const o=a.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),l.jsx(yi.div,{...e,ref:s})});zz.displayName=Dz;function Iz(e,t=globalThis==null?void 0:globalThis.document){const n=fu(e),a=b.useRef(!1),s=b.useRef(()=>{});return b.useEffect(()=>{const o=f=>{if(f.target&&!a.current){let m=function(){vE(Oz,n,h,{discrete:!0})};const h={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=m,t.addEventListener("click",s.current,{once:!0})):m()}else t.removeEventListener("click",s.current);a.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function Lz(e,t=globalThis==null?void 0:globalThis.document){const n=fu(e),a=b.useRef(!1);return b.useEffect(()=>{const s=o=>{o.target&&!a.current&&vE(Mz,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function b1(){const e=new CustomEvent(_y);document.dispatchEvent(e)}function vE(e,t,n,{discrete:a}){const s=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),a?Tz(s,o):s.dispatchEvent(o)}var sg="focusScope.autoFocusOnMount",lg="focusScope.autoFocusOnUnmount",x1={bubbles:!1,cancelable:!0},Pz="FocusScope",bE=b.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...u}=e,[f,m]=b.useState(null),h=fu(s),p=fu(o),g=b.useRef(null),w=ll(t,C=>m(C)),x=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(a){let C=function(A){if(x.paused||!f)return;const D=A.target;f.contains(D)?g.current=D:ts(g.current,{select:!0})},j=function(A){if(x.paused||!f)return;const D=A.relatedTarget;D!==null&&(f.contains(D)||ts(g.current,{select:!0}))},E=function(A){if(document.activeElement===document.body)for(const z of A)z.removedNodes.length>0&&ts(f)};document.addEventListener("focusin",C),document.addEventListener("focusout",j);const O=new MutationObserver(E);return f&&O.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",C),document.removeEventListener("focusout",j),O.disconnect()}}},[a,f,x.paused]),b.useEffect(()=>{if(f){S1.add(x);const C=document.activeElement;if(!f.contains(C)){const E=new CustomEvent(sg,x1);f.addEventListener(sg,h),f.dispatchEvent(E),E.defaultPrevented||(Uz(qz(xE(f)),{select:!0}),document.activeElement===C&&ts(f))}return()=>{f.removeEventListener(sg,h),setTimeout(()=>{const E=new CustomEvent(lg,x1);f.addEventListener(lg,p),f.dispatchEvent(E),E.defaultPrevented||ts(C??document.body,{select:!0}),f.removeEventListener(lg,p),S1.remove(x)},0)}}},[f,h,p,x]);const k=b.useCallback(C=>{if(!n&&!a||x.paused)return;const j=C.key==="Tab"&&!C.altKey&&!C.ctrlKey&&!C.metaKey,E=document.activeElement;if(j&&E){const O=C.currentTarget,[A,D]=Bz(O);A&&D?!C.shiftKey&&E===D?(C.preventDefault(),n&&ts(A,{select:!0})):C.shiftKey&&E===A&&(C.preventDefault(),n&&ts(D,{select:!0})):E===O&&C.preventDefault()}},[n,a,x.paused]);return l.jsx(yi.div,{tabIndex:-1,...u,ref:w,onKeyDown:k})});bE.displayName=Pz;function Uz(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(ts(a,{select:t}),document.activeElement!==n)return}function Bz(e){const t=xE(e),n=w1(t,e),a=w1(t.reverse(),e);return[n,a]}function xE(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const s=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||s?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function w1(e,t){for(const n of e)if(!Fz(n,{upTo:t}))return n}function Fz(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 $z(e){return e instanceof HTMLInputElement&&"select"in e}function ts(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&$z(e)&&t&&e.select()}}var S1=Hz();function Hz(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=k1(e,t),e.unshift(t)},remove(t){var n;e=k1(e,t),(n=e[0])==null||n.resume()}}}function k1(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function qz(e){return e.filter(t=>t.tagName!=="A")}var Zz="Portal",wE=b.forwardRef((e,t)=>{var f;const{container:n,...a}=e,[s,o]=b.useState(!1);du(()=>o(!0),[]);const u=n||s&&((f=globalThis==null?void 0:globalThis.document)==null?void 0:f.body);return u?Sz.createPortal(l.jsx(yi.div,{...a,ref:t}),u):null});wE.displayName=Zz;function Gz(e,t){return b.useReducer((n,a)=>t[n][a]??n,e)}var ph=e=>{const{present:t,children:n}=e,a=Vz(t),s=typeof n=="function"?n({present:a.isPresent}):b.Children.only(n),o=ll(a.ref,Qz(s));return typeof n=="function"||a.isPresent?b.cloneElement(s,{ref:o}):null};ph.displayName="Presence";function Vz(e){const[t,n]=b.useState(),a=b.useRef(null),s=b.useRef(e),o=b.useRef("none"),u=e?"mounted":"unmounted",[f,m]=Gz(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const h=gf(a.current);o.current=f==="mounted"?h:"none"},[f]),du(()=>{const h=a.current,p=s.current;if(p!==e){const w=o.current,x=gf(h);e?m("MOUNT"):x==="none"||(h==null?void 0:h.display)==="none"?m("UNMOUNT"):m(p&&w!==x?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,m]),du(()=>{if(t){let h;const p=t.ownerDocument.defaultView??window,g=x=>{const C=gf(a.current).includes(CSS.escape(x.animationName));if(x.target===t&&C&&(m("ANIMATION_END"),!s.current)){const j=t.style.animationFillMode;t.style.animationFillMode="forwards",h=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=j)})}},w=x=>{x.target===t&&(o.current=gf(a.current))};return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{p.clearTimeout(h),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:b.useCallback(h=>{a.current=h?getComputedStyle(h):null,n(h)},[])}}function gf(e){return(e==null?void 0:e.animationName)||"none"}function Qz(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var og=0;function Kz(){b.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??j1()),document.body.insertAdjacentElement("beforeend",e[1]??j1()),og++,()=>{og===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),og--}},[])}function j1(){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 Ma=function(){return Ma=Object.assign||function(t){for(var n,a=1,s=arguments.length;a<s;a++){n=arguments[a];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},Ma.apply(this,arguments)};function SE(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(e);s<a.length;s++)t.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(e,a[s])&&(n[a[s]]=e[a[s]]);return n}function Yz(e,t,n){if(n||arguments.length===2)for(var a=0,s=t.length,o;a<s;a++)(o||!(a in t))&&(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}var Lf="right-scroll-bar-position",Pf="width-before-scroll-bar",Xz="with-scroll-bars-hidden",Wz="--removed-body-scroll-bar-size";function cg(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Jz(e,t){var n=b.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var s=n.value;s!==a&&(n.value=a,n.callback(a,s))}}}})[0];return n.callback=t,n.facade}var eI=typeof window<"u"?b.useLayoutEffect:b.useEffect,C1=new WeakMap;function tI(e,t){var n=Jz(null,function(a){return e.forEach(function(s){return cg(s,a)})});return eI(function(){var a=C1.get(n);if(a){var s=new Set(a),o=new Set(e),u=n.current;s.forEach(function(f){o.has(f)||cg(f,null)}),o.forEach(function(f){s.has(f)||cg(f,u)})}C1.set(n,e)},[e]),n}function nI(e){return e}function rI(e,t){t===void 0&&(t=nI);var n=[],a=!1,s={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(o){var u=t(o,a);return n.push(u),function(){n=n.filter(function(f){return f!==u})}},assignSyncMedium:function(o){for(a=!0;n.length;){var u=n;n=[],u.forEach(o)}n={push:function(f){return o(f)},filter:function(){return n}}},assignMedium:function(o){a=!0;var u=[];if(n.length){var f=n;n=[],f.forEach(o),u=n}var m=function(){var p=u;u=[],p.forEach(o)},h=function(){return Promise.resolve().then(m)};h(),n={push:function(p){u.push(p),h()},filter:function(p){return u=u.filter(p),n}}}};return s}function aI(e){e===void 0&&(e={});var t=rI(null);return t.options=Ma({async:!0,ssr:!1},e),t}var kE=function(e){var t=e.sideCar,n=SE(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return b.createElement(a,Ma({},n))};kE.isSideCarExport=!0;function iI(e,t){return e.useMedium(t),kE}var jE=aI(),ug=function(){},gh=b.forwardRef(function(e,t){var n=b.useRef(null),a=b.useState({onScrollCapture:ug,onWheelCapture:ug,onTouchMoveCapture:ug}),s=a[0],o=a[1],u=e.forwardProps,f=e.children,m=e.className,h=e.removeScrollBar,p=e.enabled,g=e.shards,w=e.sideCar,x=e.noRelative,k=e.noIsolation,C=e.inert,j=e.allowPinchZoom,E=e.as,O=E===void 0?"div":E,A=e.gapMode,D=SE(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),z=w,R=tI([n,t]),F=Ma(Ma({},D),s);return b.createElement(b.Fragment,null,p&&b.createElement(z,{sideCar:jE,removeScrollBar:h,shards:g,noRelative:x,noIsolation:k,inert:C,setCallbacks:o,allowPinchZoom:!!j,lockRef:n,gapMode:A}),u?b.cloneElement(b.Children.only(f),Ma(Ma({},F),{ref:R})):b.createElement(O,Ma({},F,{className:m,ref:R}),f))});gh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};gh.classNames={fullWidth:Pf,zeroRight:Lf};var sI=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function lI(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=sI();return t&&e.setAttribute("nonce",t),e}function oI(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function cI(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var uI=function(){var e=0,t=null;return{add:function(n){e==0&&(t=lI())&&(oI(t,n),cI(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},dI=function(){var e=uI();return function(t,n){b.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},CE=function(){var e=dI(),t=function(n){var a=n.styles,s=n.dynamic;return e(a,s),null};return t},fI={left:0,top:0,right:0,gap:0},dg=function(e){return parseInt(e||"",10)||0},hI=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[dg(n),dg(a),dg(s)]},mI=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return fI;var t=hI(e),n=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-n+t[2]-t[0])}},pI=CE(),ao="data-scroll-locked",gI=function(e,t,n,a){var s=e.left,o=e.top,u=e.right,f=e.gap;return n===void 0&&(n="margin"),`
|
|
301
|
-
.`.concat(Xz,` {
|
|
302
|
-
overflow: hidden `).concat(a,`;
|
|
303
|
-
padding-right: `).concat(f,"px ").concat(a,`;
|
|
304
|
-
}
|
|
305
|
-
body[`).concat(ao,`] {
|
|
306
|
-
overflow: hidden `).concat(a,`;
|
|
307
|
-
overscroll-behavior: contain;
|
|
308
|
-
`).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
|
|
309
|
-
padding-left: `.concat(s,`px;
|
|
310
|
-
padding-top: `).concat(o,`px;
|
|
311
|
-
padding-right: `).concat(u,`px;
|
|
312
|
-
margin-left:0;
|
|
313
|
-
margin-top:0;
|
|
314
|
-
margin-right: `).concat(f,"px ").concat(a,`;
|
|
315
|
-
`),n==="padding"&&"padding-right: ".concat(f,"px ").concat(a,";")].filter(Boolean).join(""),`
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
.`).concat(Lf,` {
|
|
319
|
-
right: `).concat(f,"px ").concat(a,`;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
.`).concat(Pf,` {
|
|
323
|
-
margin-right: `).concat(f,"px ").concat(a,`;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
.`).concat(Lf," .").concat(Lf,` {
|
|
327
|
-
right: 0 `).concat(a,`;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
.`).concat(Pf," .").concat(Pf,` {
|
|
331
|
-
margin-right: 0 `).concat(a,`;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
body[`).concat(ao,`] {
|
|
335
|
-
`).concat(Wz,": ").concat(f,`px;
|
|
336
|
-
}
|
|
337
|
-
`)},E1=function(){var e=parseInt(document.body.getAttribute(ao)||"0",10);return isFinite(e)?e:0},yI=function(){b.useEffect(function(){return document.body.setAttribute(ao,(E1()+1).toString()),function(){var e=E1()-1;e<=0?document.body.removeAttribute(ao):document.body.setAttribute(ao,e.toString())}},[])},vI=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,s=a===void 0?"margin":a;yI();var o=b.useMemo(function(){return mI(s)},[s]);return b.createElement(pI,{styles:gI(o,!t,s,n?"":"!important")})},Ty=!1;if(typeof window<"u")try{var yf=Object.defineProperty({},"passive",{get:function(){return Ty=!0,!0}});window.addEventListener("test",yf,yf),window.removeEventListener("test",yf,yf)}catch{Ty=!1}var Hl=Ty?{passive:!1}:!1,bI=function(e){return e.tagName==="TEXTAREA"},EE=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!bI(e)&&n[t]==="visible")},xI=function(e){return EE(e,"overflowY")},wI=function(e){return EE(e,"overflowX")},N1=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var s=NE(e,a);if(s){var o=_E(e,a),u=o[1],f=o[2];if(u>f)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},SI=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},kI=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},NE=function(e,t){return e==="v"?xI(t):wI(t)},_E=function(e,t){return e==="v"?SI(t):kI(t)},jI=function(e,t){return e==="h"&&t==="rtl"?-1:1},CI=function(e,t,n,a,s){var o=jI(e,window.getComputedStyle(t).direction),u=o*a,f=n.target,m=t.contains(f),h=!1,p=u>0,g=0,w=0;do{if(!f)break;var x=_E(e,f),k=x[0],C=x[1],j=x[2],E=C-j-o*k;(k||E)&&NE(e,f)&&(g+=E,w+=k);var O=f.parentNode;f=O&&O.nodeType===Node.DOCUMENT_FRAGMENT_NODE?O.host:O}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(p&&Math.abs(g)<1||!p&&Math.abs(w)<1)&&(h=!0),h},vf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},_1=function(e){return[e.deltaX,e.deltaY]},T1=function(e){return e&&"current"in e?e.current:e},EI=function(e,t){return e[0]===t[0]&&e[1]===t[1]},NI=function(e){return`
|
|
338
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
339
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
340
|
-
`)},_I=0,ql=[];function TI(e){var t=b.useRef([]),n=b.useRef([0,0]),a=b.useRef(),s=b.useState(_I++)[0],o=b.useState(CE)[0],u=b.useRef(e);b.useEffect(function(){u.current=e},[e]),b.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var C=Yz([e.lockRef.current],(e.shards||[]).map(T1),!0).filter(Boolean);return C.forEach(function(j){return j.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),C.forEach(function(j){return j.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var f=b.useCallback(function(C,j){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!u.current.allowPinchZoom;var E=vf(C),O=n.current,A="deltaX"in C?C.deltaX:O[0]-E[0],D="deltaY"in C?C.deltaY:O[1]-E[1],z,R=C.target,F=Math.abs(A)>Math.abs(D)?"h":"v";if("touches"in C&&F==="h"&&R.type==="range")return!1;var B=window.getSelection(),ee=B&&B.anchorNode,L=ee?ee===R||ee.contains(R):!1;if(L)return!1;var I=N1(F,R);if(!I)return!0;if(I?z=F:(z=F==="v"?"h":"v",I=N1(F,R)),!I)return!1;if(!a.current&&"changedTouches"in C&&(A||D)&&(a.current=z),!z)return!0;var Q=a.current||z;return CI(Q,j,C,Q==="h"?A:D)},[]),m=b.useCallback(function(C){var j=C;if(!(!ql.length||ql[ql.length-1]!==o)){var E="deltaY"in j?_1(j):vf(j),O=t.current.filter(function(z){return z.name===j.type&&(z.target===j.target||j.target===z.shadowParent)&&EI(z.delta,E)})[0];if(O&&O.should){j.cancelable&&j.preventDefault();return}if(!O){var A=(u.current.shards||[]).map(T1).filter(Boolean).filter(function(z){return z.contains(j.target)}),D=A.length>0?f(j,A[0]):!u.current.noIsolation;D&&j.cancelable&&j.preventDefault()}}},[]),h=b.useCallback(function(C,j,E,O){var A={name:C,delta:j,target:E,should:O,shadowParent:AI(E)};t.current.push(A),setTimeout(function(){t.current=t.current.filter(function(D){return D!==A})},1)},[]),p=b.useCallback(function(C){n.current=vf(C),a.current=void 0},[]),g=b.useCallback(function(C){h(C.type,_1(C),C.target,f(C,e.lockRef.current))},[]),w=b.useCallback(function(C){h(C.type,vf(C),C.target,f(C,e.lockRef.current))},[]);b.useEffect(function(){return ql.push(o),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:w}),document.addEventListener("wheel",m,Hl),document.addEventListener("touchmove",m,Hl),document.addEventListener("touchstart",p,Hl),function(){ql=ql.filter(function(C){return C!==o}),document.removeEventListener("wheel",m,Hl),document.removeEventListener("touchmove",m,Hl),document.removeEventListener("touchstart",p,Hl)}},[]);var x=e.removeScrollBar,k=e.inert;return b.createElement(b.Fragment,null,k?b.createElement(o,{styles:NI(s)}):null,x?b.createElement(vI,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function AI(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const RI=iI(jE,TI);var TE=b.forwardRef(function(e,t){return b.createElement(gh,Ma({},e,{ref:t,sideCar:RI}))});TE.classNames=gh.classNames;var OI=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Zl=new WeakMap,bf=new WeakMap,xf={},fg=0,AE=function(e){return e&&(e.host||AE(e.parentNode))},MI=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=AE(n);return a&&e.contains(a)?a:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},DI=function(e,t,n,a){var s=MI(t,Array.isArray(e)?e:[e]);xf[n]||(xf[n]=new WeakMap);var o=xf[n],u=[],f=new Set,m=new Set(s),h=function(g){!g||f.has(g)||(f.add(g),h(g.parentNode))};s.forEach(h);var p=function(g){!g||m.has(g)||Array.prototype.forEach.call(g.children,function(w){if(f.has(w))p(w);else try{var x=w.getAttribute(a),k=x!==null&&x!=="false",C=(Zl.get(w)||0)+1,j=(o.get(w)||0)+1;Zl.set(w,C),o.set(w,j),u.push(w),C===1&&k&&bf.set(w,!0),j===1&&w.setAttribute(n,"true"),k||w.setAttribute(a,"true")}catch(E){console.error("aria-hidden: cannot operate on ",w,E)}})};return p(t),f.clear(),fg++,function(){u.forEach(function(g){var w=Zl.get(g)-1,x=o.get(g)-1;Zl.set(g,w),o.set(g,x),w||(bf.has(g)||g.removeAttribute(a),bf.delete(g)),x||g.removeAttribute(n)}),fg--,fg||(Zl=new WeakMap,Zl=new WeakMap,bf=new WeakMap,xf={})}},zI=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),s=OI(e);return s?(a.push.apply(a,Array.from(s.querySelectorAll("[aria-live], script"))),DI(a,s,n,"aria-hidden")):function(){return null}},yh="Dialog",[RE]=mz(yh),[II,ka]=RE(yh),OE=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:s,onOpenChange:o,modal:u=!0}=e,f=b.useRef(null),m=b.useRef(null),[h,p]=bz({prop:a,defaultProp:s??!1,onChange:o,caller:yh});return l.jsx(II,{scope:t,triggerRef:f,contentRef:m,contentId:ui(),titleId:ui(),descriptionId:ui(),open:h,onOpenChange:p,onOpenToggle:b.useCallback(()=>p(g=>!g),[p]),modal:u,children:n})};OE.displayName=yh;var ME="DialogTrigger",LI=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ka(ME,n),o=ll(t,s.triggerRef);return l.jsx(yi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Uv(s.open),...a,ref:o,onClick:ps(e.onClick,s.onOpenToggle)})});LI.displayName=ME;var Lv="DialogPortal",[PI,DE]=RE(Lv,{forceMount:void 0}),zE=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:s}=e,o=ka(Lv,t);return l.jsx(PI,{scope:t,forceMount:n,children:b.Children.map(a,u=>l.jsx(ph,{present:n||o.open,children:l.jsx(wE,{asChild:!0,container:s,children:u})}))})};zE.displayName=Lv;var Qf="DialogOverlay",IE=b.forwardRef((e,t)=>{const n=DE(Qf,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=ka(Qf,e.__scopeDialog);return o.modal?l.jsx(ph,{present:a||o.open,children:l.jsx(BI,{...s,ref:t})}):null});IE.displayName=Qf;var UI=pE("DialogOverlay.RemoveScroll"),BI=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ka(Qf,n);return l.jsx(TE,{as:UI,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(yi.div,{"data-state":Uv(s.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),nl="DialogContent",LE=b.forwardRef((e,t)=>{const n=DE(nl,e.__scopeDialog),{forceMount:a=n.forceMount,...s}=e,o=ka(nl,e.__scopeDialog);return l.jsx(ph,{present:a||o.open,children:o.modal?l.jsx(FI,{...s,ref:t}):l.jsx($I,{...s,ref:t})})});LE.displayName=nl;var FI=b.forwardRef((e,t)=>{const n=ka(nl,e.__scopeDialog),a=b.useRef(null),s=ll(t,n.contentRef,a);return b.useEffect(()=>{const o=a.current;if(o)return zI(o)},[]),l.jsx(PE,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ps(e.onCloseAutoFocus,o=>{var u;o.preventDefault(),(u=n.triggerRef.current)==null||u.focus()}),onPointerDownOutside:ps(e.onPointerDownOutside,o=>{const u=o.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0;(u.button===2||f)&&o.preventDefault()}),onFocusOutside:ps(e.onFocusOutside,o=>o.preventDefault())})}),$I=b.forwardRef((e,t)=>{const n=ka(nl,e.__scopeDialog),a=b.useRef(!1),s=b.useRef(!1);return l.jsx(PE,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var u,f;(u=e.onCloseAutoFocus)==null||u.call(e,o),o.defaultPrevented||(a.current||(f=n.triggerRef.current)==null||f.focus(),o.preventDefault()),a.current=!1,s.current=!1},onInteractOutside:o=>{var m,h;(m=e.onInteractOutside)==null||m.call(e,o),o.defaultPrevented||(a.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const u=o.target;((h=n.triggerRef.current)==null?void 0:h.contains(u))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),PE=b.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:s,onCloseAutoFocus:o,...u}=e,f=ka(nl,n),m=b.useRef(null),h=ll(t,m);return Kz(),l.jsxs(l.Fragment,{children:[l.jsx(bE,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:s,onUnmountAutoFocus:o,children:l.jsx(yE,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Uv(f.open),...u,ref:h,onDismiss:()=>f.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(HI,{titleId:f.titleId}),l.jsx(ZI,{contentRef:m,descriptionId:f.descriptionId})]})]})}),Pv="DialogTitle",UE=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ka(Pv,n);return l.jsx(yi.h2,{id:s.titleId,...a,ref:t})});UE.displayName=Pv;var BE="DialogDescription",FE=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ka(BE,n);return l.jsx(yi.p,{id:s.descriptionId,...a,ref:t})});FE.displayName=BE;var $E="DialogClose",HE=b.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,s=ka($E,n);return l.jsx(yi.button,{type:"button",...a,ref:t,onClick:ps(e.onClick,()=>s.onOpenChange(!1))})});HE.displayName=$E;function Uv(e){return e?"open":"closed"}var qE="DialogTitleWarning",[IX,ZE]=hz(qE,{contentName:nl,titleName:Pv,docsSlug:"dialog"}),HI=({titleId:e})=>{const t=ZE(qE),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
341
|
-
|
|
342
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
343
|
-
|
|
344
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return b.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},qI="DialogDescriptionWarning",ZI=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ZE(qI).contentName}}.`;return b.useEffect(()=>{var o;const s=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},GE=OE,VE=zE,QE=IE,KE=LE,GI=UE,VI=FE,QI=HE,KI=Symbol.for("react.lazy"),Kf=uv[" use ".trim().toString()];function YI(e){return typeof e=="object"&&e!==null&&"then"in e}function YE(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===KI&&"_payload"in e&&YI(e._payload)}function XE(e){const t=WI(e),n=b.forwardRef((a,s)=>{let{children:o,...u}=a;YE(o)&&typeof Kf=="function"&&(o=Kf(o._payload));const f=b.Children.toArray(o),m=f.find(e4);if(m){const h=m.props.children,p=f.map(g=>g===m?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:g);return l.jsx(t,{...u,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,p):null})}return l.jsx(t,{...u,ref:s,children:o})});return n.displayName=`${e}.Slot`,n}var XI=XE("Slot");function WI(e){const t=b.forwardRef((n,a)=>{let{children:s,...o}=n;if(YE(s)&&typeof Kf=="function"&&(s=Kf(s._payload)),b.isValidElement(s)){const u=n4(s),f=t4(o,s.props);return s.type!==b.Fragment&&(f.ref=a?gs(a,u):u),b.cloneElement(s,f)}return b.Children.count(s)>1?b.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var JI=Symbol("radix.slottable");function e4(e){return b.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===JI}function t4(e,t){const n={...t};for(const a in t){const s=e[a],o=t[a];/^on[A-Z]/.test(a)?s&&o?n[a]=(...f)=>{const m=o(...f);return s(...f),m}:s&&(n[a]=s):a==="style"?n[a]={...s,...o}:a==="className"&&(n[a]=[s,o].filter(Boolean).join(" "))}return{...e,...n}}function n4(e){var a,s;let t=(a=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var r4=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vi=r4.reduce((e,t)=>{const n=XE(`Primitive.${t}`),a=b.forwardRef((s,o)=>{const{asChild:u,...f}=s,m=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(m,{...f,ref:o})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),Uc='[cmdk-group=""]',hg='[cmdk-group-items=""]',a4='[cmdk-group-heading=""]',WE='[cmdk-item=""]',A1=`${WE}:not([aria-disabled="true"])`,Ay="cmdk-item-select",Kl="data-value",i4=(e,t,n)=>fz(e,t,n),JE=b.createContext(void 0),Uu=()=>b.useContext(JE),eN=b.createContext(void 0),Bv=()=>b.useContext(eN),tN=b.createContext(void 0),nN=b.forwardRef((e,t)=>{let n=Yl(()=>{var P,_;return{search:"",value:(_=(P=e.value)!=null?P:e.defaultValue)!=null?_:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),a=Yl(()=>new Set),s=Yl(()=>new Map),o=Yl(()=>new Map),u=Yl(()=>new Set),f=rN(e),{label:m,children:h,value:p,onValueChange:g,filter:w,shouldFilter:x,loop:k,disablePointerSelection:C=!1,vimBindings:j=!0,...E}=e,O=ui(),A=ui(),D=ui(),z=b.useRef(null),R=g4();rl(()=>{if(p!==void 0){let P=p.trim();n.current.value=P,F.emit()}},[p]),rl(()=>{R(6,te)},[]);let F=b.useMemo(()=>({subscribe:P=>(u.current.add(P),()=>u.current.delete(P)),snapshot:()=>n.current,setState:(P,_,V)=>{var H,ae,Se,Ae;if(!Object.is(n.current[P],_)){if(n.current[P]=_,P==="search")Q(),L(),R(1,I);else if(P==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Ee=document.getElementById(D);Ee?Ee.focus():(H=document.getElementById(O))==null||H.focus()}if(R(7,()=>{var Ee;n.current.selectedItemId=(Ee=Y())==null?void 0:Ee.id,F.emit()}),V||R(5,te),((ae=f.current)==null?void 0:ae.value)!==void 0){let Ee=_??"";(Ae=(Se=f.current).onValueChange)==null||Ae.call(Se,Ee);return}}F.emit()}},emit:()=>{u.current.forEach(P=>P())}}),[]),B=b.useMemo(()=>({value:(P,_,V)=>{var H;_!==((H=o.current.get(P))==null?void 0:H.value)&&(o.current.set(P,{value:_,keywords:V}),n.current.filtered.items.set(P,ee(_,V)),R(2,()=>{L(),F.emit()}))},item:(P,_)=>(a.current.add(P),_&&(s.current.has(_)?s.current.get(_).add(P):s.current.set(_,new Set([P]))),R(3,()=>{Q(),L(),n.current.value||I(),F.emit()}),()=>{o.current.delete(P),a.current.delete(P),n.current.filtered.items.delete(P);let V=Y();R(4,()=>{Q(),(V==null?void 0:V.getAttribute("id"))===P&&I(),F.emit()})}),group:P=>(s.current.has(P)||s.current.set(P,new Set),()=>{o.current.delete(P),s.current.delete(P)}),filter:()=>f.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>f.current.disablePointerSelection,listId:O,inputId:D,labelId:A,listInnerRef:z}),[]);function ee(P,_){var V,H;let ae=(H=(V=f.current)==null?void 0:V.filter)!=null?H:i4;return P?ae(P,n.current.search,_):0}function L(){if(!n.current.search||f.current.shouldFilter===!1)return;let P=n.current.filtered.items,_=[];n.current.filtered.groups.forEach(H=>{let ae=s.current.get(H),Se=0;ae.forEach(Ae=>{let Ee=P.get(Ae);Se=Math.max(Ee,Se)}),_.push([H,Se])});let V=z.current;X().sort((H,ae)=>{var Se,Ae;let Ee=H.getAttribute("id"),Ge=ae.getAttribute("id");return((Se=P.get(Ge))!=null?Se:0)-((Ae=P.get(Ee))!=null?Ae:0)}).forEach(H=>{let ae=H.closest(hg);ae?ae.appendChild(H.parentElement===ae?H:H.closest(`${hg} > *`)):V.appendChild(H.parentElement===V?H:H.closest(`${hg} > *`))}),_.sort((H,ae)=>ae[1]-H[1]).forEach(H=>{var ae;let Se=(ae=z.current)==null?void 0:ae.querySelector(`${Uc}[${Kl}="${encodeURIComponent(H[0])}"]`);Se==null||Se.parentElement.appendChild(Se)})}function I(){let P=X().find(V=>V.getAttribute("aria-disabled")!=="true"),_=P==null?void 0:P.getAttribute(Kl);F.setState("value",_||void 0)}function Q(){var P,_,V,H;if(!n.current.search||f.current.shouldFilter===!1){n.current.filtered.count=a.current.size;return}n.current.filtered.groups=new Set;let ae=0;for(let Se of a.current){let Ae=(_=(P=o.current.get(Se))==null?void 0:P.value)!=null?_:"",Ee=(H=(V=o.current.get(Se))==null?void 0:V.keywords)!=null?H:[],Ge=ee(Ae,Ee);n.current.filtered.items.set(Se,Ge),Ge>0&&ae++}for(let[Se,Ae]of s.current)for(let Ee of Ae)if(n.current.filtered.items.get(Ee)>0){n.current.filtered.groups.add(Se);break}n.current.filtered.count=ae}function te(){var P,_,V;let H=Y();H&&(((P=H.parentElement)==null?void 0:P.firstChild)===H&&((V=(_=H.closest(Uc))==null?void 0:_.querySelector(a4))==null||V.scrollIntoView({block:"nearest"})),H.scrollIntoView({block:"nearest"}))}function Y(){var P;return(P=z.current)==null?void 0:P.querySelector(`${WE}[aria-selected="true"]`)}function X(){var P;return Array.from(((P=z.current)==null?void 0:P.querySelectorAll(A1))||[])}function G(P){let _=X()[P];_&&F.setState("value",_.getAttribute(Kl))}function se(P){var _;let V=Y(),H=X(),ae=H.findIndex(Ae=>Ae===V),Se=H[ae+P];(_=f.current)!=null&&_.loop&&(Se=ae+P<0?H[H.length-1]:ae+P===H.length?H[0]:H[ae+P]),Se&&F.setState("value",Se.getAttribute(Kl))}function J(P){let _=Y(),V=_==null?void 0:_.closest(Uc),H;for(;V&&!H;)V=P>0?m4(V,Uc):p4(V,Uc),H=V==null?void 0:V.querySelector(A1);H?F.setState("value",H.getAttribute(Kl)):se(P)}let ve=()=>G(X().length-1),M=P=>{P.preventDefault(),P.metaKey?ve():P.altKey?J(1):se(1)},U=P=>{P.preventDefault(),P.metaKey?G(0):P.altKey?J(-1):se(-1)};return b.createElement(vi.div,{ref:t,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:P=>{var _;(_=E.onKeyDown)==null||_.call(E,P);let V=P.nativeEvent.isComposing||P.keyCode===229;if(!(P.defaultPrevented||V))switch(P.key){case"n":case"j":{j&&P.ctrlKey&&M(P);break}case"ArrowDown":{M(P);break}case"p":case"k":{j&&P.ctrlKey&&U(P);break}case"ArrowUp":{U(P);break}case"Home":{P.preventDefault(),G(0);break}case"End":{P.preventDefault(),ve();break}case"Enter":{P.preventDefault();let H=Y();if(H){let ae=new Event(Ay);H.dispatchEvent(ae)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:B.inputId,id:B.labelId,style:v4},m),vh(e,P=>b.createElement(eN.Provider,{value:F},b.createElement(JE.Provider,{value:B},P))))}),s4=b.forwardRef((e,t)=>{var n,a;let s=ui(),o=b.useRef(null),u=b.useContext(tN),f=Uu(),m=rN(e),h=(a=(n=m.current)==null?void 0:n.forceMount)!=null?a:u==null?void 0:u.forceMount;rl(()=>{if(!h)return f.item(s,u==null?void 0:u.id)},[h]);let p=aN(s,o,[e.value,e.children,o],e.keywords),g=Bv(),w=ys(R=>R.value&&R.value===p.current),x=ys(R=>h||f.filter()===!1?!0:R.search?R.filtered.items.get(s)>0:!0);b.useEffect(()=>{let R=o.current;if(!(!R||e.disabled))return R.addEventListener(Ay,k),()=>R.removeEventListener(Ay,k)},[x,e.onSelect,e.disabled]);function k(){var R,F;C(),(F=(R=m.current).onSelect)==null||F.call(R,p.current)}function C(){g.setState("value",p.current,!0)}if(!x)return null;let{disabled:j,value:E,onSelect:O,forceMount:A,keywords:D,...z}=e;return b.createElement(vi.div,{ref:gs(o,t),...z,id:s,"cmdk-item":"",role:"option","aria-disabled":!!j,"aria-selected":!!w,"data-disabled":!!j,"data-selected":!!w,onPointerMove:j||f.getDisablePointerSelection()?void 0:C,onClick:j?void 0:k},e.children)}),l4=b.forwardRef((e,t)=>{let{heading:n,children:a,forceMount:s,...o}=e,u=ui(),f=b.useRef(null),m=b.useRef(null),h=ui(),p=Uu(),g=ys(x=>s||p.filter()===!1?!0:x.search?x.filtered.groups.has(u):!0);rl(()=>p.group(u),[]),aN(u,f,[e.value,e.heading,m]);let w=b.useMemo(()=>({id:u,forceMount:s}),[s]);return b.createElement(vi.div,{ref:gs(f,t),...o,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},n&&b.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),vh(e,x=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},b.createElement(tN.Provider,{value:w},x))))}),o4=b.forwardRef((e,t)=>{let{alwaysRender:n,...a}=e,s=b.useRef(null),o=ys(u=>!u.search);return!n&&!o?null:b.createElement(vi.div,{ref:gs(s,t),...a,"cmdk-separator":"",role:"separator"})}),c4=b.forwardRef((e,t)=>{let{onValueChange:n,...a}=e,s=e.value!=null,o=Bv(),u=ys(h=>h.search),f=ys(h=>h.selectedItemId),m=Uu();return b.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),b.createElement(vi.input,{ref:t,...a,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":f,id:m.inputId,type:"text",value:s?e.value:u,onChange:h=>{s||o.setState("search",h.target.value),n==null||n(h.target.value)}})}),u4=b.forwardRef((e,t)=>{let{children:n,label:a="Suggestions",...s}=e,o=b.useRef(null),u=b.useRef(null),f=ys(h=>h.selectedItemId),m=Uu();return b.useEffect(()=>{if(u.current&&o.current){let h=u.current,p=o.current,g,w=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let x=h.offsetHeight;p.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return w.observe(h),()=>{cancelAnimationFrame(g),w.unobserve(h)}}},[]),b.createElement(vi.div,{ref:gs(o,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":f,"aria-label":a,id:m.listId},vh(e,h=>b.createElement("div",{ref:gs(u,m.listInnerRef),"cmdk-list-sizer":""},h)))}),d4=b.forwardRef((e,t)=>{let{open:n,onOpenChange:a,overlayClassName:s,contentClassName:o,container:u,...f}=e;return b.createElement(GE,{open:n,onOpenChange:a},b.createElement(VE,{container:u},b.createElement(QE,{"cmdk-overlay":"",className:s}),b.createElement(KE,{"aria-label":e.label,"cmdk-dialog":"",className:o},b.createElement(nN,{ref:t,...f}))))}),f4=b.forwardRef((e,t)=>ys(n=>n.filtered.count===0)?b.createElement(vi.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),h4=b.forwardRef((e,t)=>{let{progress:n,children:a,label:s="Loading...",...o}=e;return b.createElement(vi.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},vh(e,u=>b.createElement("div",{"aria-hidden":!0},u)))}),Or=Object.assign(nN,{List:u4,Item:s4,Input:c4,Group:l4,Separator:o4,Dialog:d4,Empty:f4,Loading:h4});function m4(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function p4(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function rN(e){let t=b.useRef(e);return rl(()=>{t.current=e}),t}var rl=typeof window>"u"?b.useEffect:b.useLayoutEffect;function Yl(e){let t=b.useRef();return t.current===void 0&&(t.current=e()),t}function ys(e){let t=Bv(),n=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,n,n)}function aN(e,t,n,a=[]){let s=b.useRef(),o=Uu();return rl(()=>{var u;let f=(()=>{var h;for(let p of n){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(h=p.current.textContent)==null?void 0:h.trim():s.current}})(),m=a.map(h=>h.trim());o.value(e,f,m),(u=t.current)==null||u.setAttribute(Kl,f),s.current=f}),s}var g4=()=>{let[e,t]=b.useState(),n=Yl(()=>new Map);return rl(()=>{n.current.forEach(a=>a()),n.current=new Map},[e]),(a,s)=>{n.current.set(a,s),t({})}};function y4(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function vh({asChild:e,children:t},n){return e&&b.isValidElement(t)?b.cloneElement(y4(t),{ref:t.ref},n(t.props.children)):n(t)}var v4={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const _n=GE,b4=VE,iN=b.forwardRef(({className:e,...t},n)=>l.jsx(QE,{ref:n,className:Oe("fixed inset-0 z-50 bg-overlay-scrim data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));iN.displayName="DialogOverlay";const bn=b.forwardRef(({className:e,children:t,...n},a)=>l.jsxs(b4,{children:[l.jsx(iN,{}),l.jsxs(KE,{ref:a,className:Oe("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...n,children:[t,l.jsxs(QI,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(pi,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));bn.displayName="DialogContent";function In({className:e,...t}){return l.jsx("div",{className:Oe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function ir({className:e,...t}){return l.jsx("div",{className:Oe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t})}const Tn=b.forwardRef(({className:e,...t},n)=>l.jsx(GI,{ref:n,className:Oe("text-subtitle leading-none tracking-tight",e),...t}));Tn.displayName="DialogTitle";const Fv=b.forwardRef(({className:e,...t},n)=>l.jsx(VI,{ref:n,className:Oe("text-body text-muted-foreground",e),...t}));Fv.displayName="DialogDescription";const sN=b.forwardRef(({className:e,...t},n)=>l.jsx(Or,{ref:n,className:Oe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));sN.displayName=Or.displayName;function x4({open:e,onOpenChange:t,children:n}){return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsx(bn,{className:"overflow-hidden p-0 shadow-lg",children:l.jsx(sN,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:n})})})}const lN=b.forwardRef(({className:e,...t},n)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(Ov,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx(Or.Input,{ref:n,className:Oe("flex h-11 w-full rounded-md bg-transparent py-3 text-body outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));lN.displayName=Or.Input.displayName;const oN=b.forwardRef(({className:e,...t},n)=>l.jsx(Or.List,{ref:n,className:Oe("max-h-[var(--sp-75)] overflow-y-auto overflow-x-hidden",e),...t}));oN.displayName=Or.List.displayName;const cN=b.forwardRef((e,t)=>l.jsx(Or.Empty,{ref:t,className:"py-6 text-center text-body",...e}));cN.displayName=Or.Empty.displayName;const Uf=b.forwardRef(({className:e,...t},n)=>l.jsx(Or.Group,{ref:n,className:Oe("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-caption [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));Uf.displayName=Or.Group.displayName;const Ry=b.forwardRef(({className:e,...t},n)=>l.jsx(Or.Separator,{ref:n,className:Oe("-mx-1 h-px bg-border",e),...t}));Ry.displayName=Or.Separator.displayName;const Bf=b.forwardRef(({className:e,...t},n)=>l.jsx(Or.Item,{ref:n,className:Oe("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-body outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t}));Bf.displayName=Or.Item.displayName;function Bu(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.type&&t.set("type",e.type);const n=t.toString();return Ce.get(hn(`/agents${n?`?${n}`:""}`))}function w4(e){const t=new URLSearchParams;e!=null&&e.limit&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor);const n=t.toString();return Ce.get(hn(`/agents/all${n?`?${n}`:""}`))}function $v(){return Ce.get("/me/managed-agents")}function S4(e){return Ce.get(`/agents/${encodeURIComponent(e)}`)}function k4(e){return Ce.post(hn("/agents"),e)}function j4(e){return Ce.get(hn(`/agents/names/${encodeURIComponent(e)}/availability`))}function Oy(e,t){return Ce.patch(`/agents/${encodeURIComponent(e)}`,t)}function C4(e,t){return Ce.patch(`/agents/${encodeURIComponent(e)}/rebind`,t)}function uN(e){return Ce.delete(`/agents/${encodeURIComponent(e)}`)}async function E4(e,t){const n=Iu(),a={"Content-Type":t.type||"application/octet-stream"};n!=null&&n.accessToken&&(a.Authorization=`Bearer ${n.accessToken}`);const s=await fetch(`/api/v1/agents/${encodeURIComponent(e)}/avatar`,{method:"PUT",headers:a,body:t});if(!s.ok){const o=await s.text();let u=o;try{const f=JSON.parse(o);f.error&&(u=f.error)}catch{}throw new xs(s.status,u)}return await s.json()}function N4(e){return Ce.delete(`/agents/${encodeURIComponent(e)}/avatar`)}function dN(e){return Ce.post(`/agents/${encodeURIComponent(e)}/suspend`,{})}function fN(e){return Ce.post(`/agents/${encodeURIComponent(e)}/reactivate`,{})}function _4(e){return Ce.post(`/agents/${encodeURIComponent(e)}/test`,{})}function bh(){const{data:e}=We({queryKey:["agents","name-map"],queryFn:()=>Bu({limit:100}),staleTime:3e4}),{data:t}=We({queryKey:["managed-agents","name-map"],queryFn:$v,staleTime:3e4});return b.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,a.displayName);if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,a.displayName);return a=>a?n.get(a)??a:"—"},[e,t])}function Hv(){const{data:e}=We({queryKey:["agents","name-map"],queryFn:()=>Bu({limit:100}),staleTime:3e4}),{data:t}=We({queryKey:["managed-agents","name-map"],queryFn:$v,staleTime:3e4});return b.useMemo(()=>{const n=new Map;if(t)for(const a of t)n.set(a.uuid,{name:a.name,displayName:a.displayName,avatarImageUrl:a.avatarImageUrl??null});if(e!=null&&e.items)for(const a of e.items)n.set(a.uuid,{name:a.name,displayName:a.displayName,avatarImageUrl:a.avatarImageUrl??null});return a=>a?n.get(a)??null:null},[e,t])}const T4=[{path:"/",label:"Workspace"},{path:"/context",label:"Context"},{path:"/team",label:"Team"},{path:"/settings",label:"Settings"}];function A4({open:e,onOpenChange:t}){const n=zn(),a=bh(),{data:s}=We({queryKey:["activity"],queryFn:Pu,enabled:e,staleTime:3e4}),o=(s==null?void 0:s.agents)??[],f=We({queryKey:["palette-sessions",o.map(h=>h.agentId).join(",")],queryFn:async()=>{const h=[];for(const p of o)try{const g=await hE(p.agentId);for(const w of g)h.push({agentId:p.agentId,session:w})}catch{}return h},enabled:e&&o.length>0,staleTime:3e4}).data??[],m=h=>{t(!1),n(h)};return l.jsxs(x4,{open:e,onOpenChange:t,children:[l.jsx(lN,{placeholder:"Jump to agent, chat, or page…"}),l.jsxs(oN,{children:[l.jsx(cN,{children:"No results"}),o.length>0&&l.jsx(Uf,{heading:"Agents",children:o.map(h=>{const p=a(h.agentId);return l.jsxs(Bf,{value:`agent ${p} ${h.agentId}`,onSelect:()=>m(`/?a=${h.agentId}`),children:[l.jsx(HC,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{className:"flex-1 truncate",children:p}),l.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:h.agentId.slice(0,8)})]},h.agentId)})}),f.length>0&&l.jsxs(l.Fragment,{children:[l.jsx(Ry,{}),l.jsx(Uf,{heading:"Chats",children:f.map(({agentId:h,session:p})=>{const g=a(h);return l.jsxs(Bf,{value:`chat ${g} ${p.chatId}`,onSelect:()=>m(`/?a=${h}&c=${p.chatId}`),children:[l.jsx(Rv,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{className:"flex-1 truncate",children:g}),l.jsx("span",{className:"text-caption text-muted-foreground font-mono ml-2",children:p.chatId.slice(0,8)})]},`${h}-${p.chatId}`)})})]}),l.jsx(Ry,{}),l.jsx(Uf,{heading:"Pages",children:T4.map(h=>l.jsxs(Bf,{value:`page ${h.label}`,onSelect:()=>m(h.path),children:[l.jsx(AD,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),l.jsx("span",{children:h.label})]},h.path))})]})]})}function R4(e,t){return t?e.filter(n=>n.userId===t&&n.status==="disconnected"&&n.agentCount>0):[]}function O4(){var a;const{user:e}=ut(),{data:t}=We({queryKey:["clients"],queryFn:gi,refetchInterval:1e4,enabled:!!e});if(!t||!e)return{rows:[],firstHostname:null};const n=R4(t,e.id);return{rows:n,firstHostname:((a=n[0])==null?void 0:a.hostname)??null}}const M4=160;function D4(){const e=zn(),{rows:t,firstHostname:n}=O4();if(t.length===0)return null;const a=t.length>1,s=a?`${t.length} computers disconnected. Click to manage.`:`${n??"Your computer"} is disconnected. Click to manage.`;return l.jsxs("button",{type:"button",onClick:()=>e("/settings/computers"),title:s,"aria-label":s,className:"inline-flex items-center cursor-pointer text-body font-medium",style:{gap:8,height:26,padding:"0 var(--sp-2_5) 0 var(--sp-2_25)",borderRadius:999,border:0,outline:"var(--hairline) solid color-mix(in oklch, var(--state-error) 38%, transparent)",outlineOffset:-1,background:"color-mix(in oklch, var(--state-error) 14%, transparent)",color:"color-mix(in oklch, var(--state-error) 80%, var(--fg))",minWidth:0},children:[l.jsx(z4,{}),a?l.jsxs("span",{style:{fontVariantNumeric:"tabular-nums"},children:[l.jsx("span",{className:"font-semibold",children:t.length})," computers disconnected"]}):l.jsxs("span",{className:"inline-flex items-center",style:{gap:5,minWidth:0},children:[l.jsx("span",{className:"mono text-label font-medium",style:{maxWidth:M4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:"color-mix(in oklch, var(--state-error) 60%, var(--fg))"},children:n??"computer"}),l.jsx("span",{style:{flexShrink:0},children:"disconnected"})]})]})}function z4(){return l.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:8,height:8,flexShrink:0,display:"inline-block"},children:[l.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-error)"}}),l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--state-error)",animation:"ring-pulse 1.8s infinite",opacity:.6}})]})}function Fu(e){return l.jsxs("svg",{viewBox:"0 0 9 10",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",shapeRendering:"crispEdges","aria-hidden":"true",...e,children:[l.jsx("rect",{x:"4",y:"0",width:"1",height:"1"}),l.jsx("rect",{x:"3",y:"1",width:"3",height:"1"}),l.jsx("rect",{x:"2",y:"2",width:"5",height:"1"}),l.jsx("rect",{x:"3",y:"3",width:"3",height:"1"}),l.jsx("rect",{x:"2",y:"4",width:"5",height:"1"}),l.jsx("rect",{x:"1",y:"5",width:"7",height:"1"}),l.jsx("rect",{x:"2",y:"6",width:"5",height:"1"}),l.jsx("rect",{x:"1",y:"7",width:"7",height:"1"}),l.jsx("rect",{x:"0",y:"8",width:"9",height:"1"}),l.jsx("rect",{x:"3",y:"9",width:"3",height:"1"})]})}function I4(e){const t=new URLSearchParams;t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.severity&&t.set("severity",e.severity),(e==null?void 0:e.read)!==void 0&&t.set("read",String(e.read)),e!=null&&e.agentId&&t.set("agentId",e.agentId);const n=t.toString();return Ce.get(hn(`/notifications${n?`?${n}`:""}`))}function L4(e){return Ce.post(hn(`/notifications/${e}/read`))}function P4(){return Ce.post(hn("/notifications/read-all"))}function U4(){return Ce.get(hn("/notifications/unread-count"))}const B4={agent_error:"Error",agent_blocked:"Blocked",agent_stale:"Stale"};function F4(e){switch(e){case"high":return"var(--state-error)";case"medium":return"var(--state-blocked)";default:return"var(--accent-dim)"}}function $4({notification:e,onClick:t,clickable:n}){const a=(B4[e.type]??e.type).toString(),s=F4(e.severity),o=n??!0;return l.jsxs("button",{type:"button",onClick:t,className:Oe("w-full text-left transition-colors text-body",o?"cursor-pointer":"cursor-default"),style:{padding:"var(--sp-1_5) var(--sp-2)",background:e.read?"transparent":"var(--bg-sunken)",borderLeft:`var(--hairline-bold) solid ${s}`,borderRadius:"0 var(--sp-0_75) var(--sp-0_75) 0"},onMouseEnter:u=>{o&&(u.currentTarget.style.background="var(--bg-hover)")},onMouseLeave:u=>{u.currentTarget.style.background=e.read?"transparent":"var(--bg-sunken)"},children:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:8},children:[l.jsx("span",{className:"mono uppercase text-label",style:{color:e.severity==="high"?"var(--state-error)":"var(--fg-3)"},children:a.replace("_"," ")}),l.jsx("span",{className:"mono text-label",style:{color:"var(--fg-4)",whiteSpace:"nowrap"},children:uu(e.createdAt)})]}),l.jsx("div",{style:{color:"var(--fg-2)",marginTop:1,wordBreak:"break-word"},children:e.message})]})}function H4(){const[e,t]=b.useState(!1),[n,a]=b.useState(null),s=b.useRef(null),o=zn(),u=vn(),{data:f}=We({queryKey:["notifications","bell"],queryFn:()=>I4({limit:8})}),{data:m}=We({queryKey:["notifications","unread-count"],queryFn:()=>U4()}),h=(m==null?void 0:m.count)??0,p=h>0,g=b.useCallback(async x=>{x.read||(L4(x.id).catch(()=>{}),u.invalidateQueries({queryKey:["notifications"]})),t(!1),x.chatId?o(`/?c=${x.chatId}`):x.agentId&&o(`/agents/${x.agentId}`)},[o,u]),w=b.useCallback(async()=>{a(null);try{await P4(),await u.invalidateQueries({queryKey:["notifications"]})}catch(x){a(x instanceof Error?x.message:"Failed to mark all as read")}},[u]);return l.jsxs("div",{className:"relative",children:[l.jsxs("button",{type:"button",onClick:()=>t(!e),className:"relative flex items-center justify-center rounded-md p-1.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors",children:[l.jsx(dD,{className:"h-4 w-4"}),p&&l.jsx("span",{className:"absolute -top-0.5 -right-0.5 flex items-center justify-center rounded-full px-1 font-medium text-label",style:{height:16,minWidth:16,background:"var(--state-error)",color:"var(--bg)"},children:h>99?"99+":h})]}),e&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"fixed inset-0 z-40 cursor-default",onClick:()=>t(!1)}),l.jsxs("div",{ref:s,className:"absolute right-0 top-full mt-1 z-50",style:{width:320,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:6,boxShadow:"var(--shadow-md)"},children:[l.jsxs("div",{className:"flex items-center justify-between",style:{padding:"var(--sp-2) var(--sp-3)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsx("span",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:"Notifications"}),p&&l.jsx("button",{type:"button",onClick:w,className:"hover:underline text-body",style:{color:"var(--accent)"},children:"Mark all read"})]}),n&&l.jsx("div",{className:"text-body",style:{padding:"var(--sp-1_5) var(--sp-3)",color:"var(--state-error)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:n}),l.jsx("div",{className:"flex flex-col overflow-y-auto",style:{maxHeight:360,padding:8,gap:4},children:!(f!=null&&f.items)||f.items.length===0?l.jsx("div",{className:"text-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-4_5) 0"},children:"No notifications"}):f.items.map(x=>l.jsx($4,{notification:x,clickable:!!x.chatId||!!x.agentId,onClick:()=>g(x)},x.id))})]})]})]})}function q4(){if(typeof window>"u")return"light";const e=window.localStorage.getItem("theme");return e==="light"||e==="dark"?e:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Z4(){const[e,t]=b.useState(q4);return b.useEffect(()=>{document.documentElement.classList.toggle("dark",e==="dark"),window.localStorage.setItem("theme",e)},[e]),l.jsx("button",{type:"button",onClick:()=>t(e==="dark"?"light":"dark"),"aria-label":e==="dark"?"Switch to light theme":"Switch to dark theme",className:"flex items-center gap-1.5 rounded-md px-2 py-1.5 text-body text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:e==="dark"?l.jsx(YD,{className:"h-4 w-4"}):l.jsx(PD,{className:"h-4 w-4"})})}function hN(e){var t;return((t=e.trim()[0])==null?void 0:t.toUpperCase())??"?"}const G4=8,V4="var(--avatar-hue-0)";function Q4(e){if(e.length===0)return V4;let t=5381;for(let a=0;a<e.length;a++)t=t*33^e.charCodeAt(a);return`var(--avatar-hue-${Math.abs(t)%G4})`}function $u(e,t){return typeof e=="string"&&/^hue-[0-7]$/.test(e)?`var(--avatar-${e})`:Q4(t)}function K4(e){return e<=1?"single":e===2?"n2":e===3?"n3":e===4?"n4":"n5+"}function Y4(e){return e<=0?null:e>99?"99+":String(e)}function X4(e){const t=[];return e.engaged&&t.push("engaged"),e.unread>0&&t.push(`${e.unread} unread`),t.length>0?t.join(", "):null}function W4({title:e,type:t,participants:n,selfAgentId:a,engagedAgentIds:s,unreadCount:o,size:u=36}){const f=t==="direct",m=n.filter(x=>x.agentId!==a),h=m[0],p=m.some(x=>s.includes(x.agentId)),g=X4({engaged:p,unread:o}),w=g===null?{"aria-hidden":!0}:{role:"img","aria-label":g};return l.jsxs("span",{...w,style:{position:"relative",width:u,height:u,flexShrink:0,display:"inline-block"},children:[f||m.length<=1?l.jsx(J4,{size:u,name:(h==null?void 0:h.displayName)??e,hueSeed:(h==null?void 0:h.agentId)??e,colorToken:(h==null?void 0:h.avatarColorToken)??null,imageUrl:(h==null?void 0:h.avatarImageUrl)??null}):l.jsx(e5,{size:u,peers:m}),p&&l.jsx(n5,{size:u}),o>0&&l.jsx(r5,{count:o})]})}function J4({size:e,name:t,hueSeed:n,colorToken:a,imageUrl:s}){return s?l.jsx("img",{src:s,alt:t,width:e,height:e,style:{width:e,height:e,borderRadius:"50%",objectFit:"cover",display:"block"}}):l.jsx("span",{"aria-hidden":"true",style:{width:e,height:e,borderRadius:"50%",background:$u(a,n),color:"var(--fg-on-vivid)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:Math.round(e*.42),fontWeight:700,lineHeight:1,letterSpacing:"-0.02em",userSelect:"none"},children:hN(t)})}function e5({size:e,peers:t}){var m,h,p,g,w,x,k,C,j,E,O,A,D,z,R,F,B,ee,L,I,Q,te,Y,X,G,se,J,ve,M,U,P,_,V,H,ae,Se;const n=t.length,a=K4(n),s=Math.round(e*(n===2?.36:.28)),o=Math.round(e*.32),u=Math.round(e*.26),f=a==="n2"?{gridTemplateColumns:"1fr 1fr"}:{gridTemplateColumns:"1fr 1fr",gridTemplateRows:"1fr 1fr"};return l.jsxs("div",{"aria-hidden":"true",style:{width:e,height:e,borderRadius:"50%",overflow:"hidden",display:"grid",gap:"var(--hairline)",background:"var(--bg-raised)",userSelect:"none",...f},children:[a==="n2"&&l.jsxs(l.Fragment,{children:[l.jsx(ia,{name:((m=t[0])==null?void 0:m.displayName)??"?",hueSeed:((h=t[0])==null?void 0:h.agentId)??"0",colorToken:((p=t[0])==null?void 0:p.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((g=t[1])==null?void 0:g.displayName)??"?",hueSeed:((w=t[1])==null?void 0:w.agentId)??"1",colorToken:((x=t[1])==null?void 0:x.avatarColorToken)??null,fontSize:s})]}),a==="n3"&&l.jsxs(l.Fragment,{children:[l.jsx(ia,{name:((k=t[0])==null?void 0:k.displayName)??"?",hueSeed:((C=t[0])==null?void 0:C.agentId)??"0",colorToken:((j=t[0])==null?void 0:j.avatarColorToken)??null,fontSize:o,fullWidth:!0}),l.jsx(ia,{name:((E=t[1])==null?void 0:E.displayName)??"?",hueSeed:((O=t[1])==null?void 0:O.agentId)??"1",colorToken:((A=t[1])==null?void 0:A.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((D=t[2])==null?void 0:D.displayName)??"?",hueSeed:((z=t[2])==null?void 0:z.agentId)??"2",colorToken:((R=t[2])==null?void 0:R.avatarColorToken)??null,fontSize:s})]}),a==="n4"&&l.jsxs(l.Fragment,{children:[l.jsx(ia,{name:((F=t[0])==null?void 0:F.displayName)??"?",hueSeed:((B=t[0])==null?void 0:B.agentId)??"0",colorToken:((ee=t[0])==null?void 0:ee.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((L=t[1])==null?void 0:L.displayName)??"?",hueSeed:((I=t[1])==null?void 0:I.agentId)??"1",colorToken:((Q=t[1])==null?void 0:Q.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((te=t[2])==null?void 0:te.displayName)??"?",hueSeed:((Y=t[2])==null?void 0:Y.agentId)??"2",colorToken:((X=t[2])==null?void 0:X.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((G=t[3])==null?void 0:G.displayName)??"?",hueSeed:((se=t[3])==null?void 0:se.agentId)??"3",colorToken:((J=t[3])==null?void 0:J.avatarColorToken)??null,fontSize:s})]}),a==="n5+"&&l.jsxs(l.Fragment,{children:[l.jsx(ia,{name:((ve=t[0])==null?void 0:ve.displayName)??"?",hueSeed:((M=t[0])==null?void 0:M.agentId)??"0",colorToken:((U=t[0])==null?void 0:U.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((P=t[1])==null?void 0:P.displayName)??"?",hueSeed:((_=t[1])==null?void 0:_.agentId)??"1",colorToken:((V=t[1])==null?void 0:V.avatarColorToken)??null,fontSize:s}),l.jsx(ia,{name:((H=t[2])==null?void 0:H.displayName)??"?",hueSeed:((ae=t[2])==null?void 0:ae.agentId)??"2",colorToken:((Se=t[2])==null?void 0:Se.avatarColorToken)??null,fontSize:s}),l.jsx(t5,{count:n-3,fontSize:u})]})]})}function ia({name:e,hueSeed:t,colorToken:n,fontSize:a,fullWidth:s}){return l.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",background:$u(n,t),color:"var(--fg-on-vivid)",fontSize:a,fontWeight:700,lineHeight:1,letterSpacing:"-0.02em",...s?{gridColumn:"1 / -1"}:null},children:hN(e)})}function t5({count:e,fontSize:t}){return l.jsx("span",{style:{display:"flex",alignItems:"center",justifyContent:"center",background:"var(--bg-sunken)",color:"var(--fg-3)",fontSize:t,fontWeight:600,lineHeight:1,userSelect:"none"},children:`+${e}`})}function n5({size:e}){return l.jsx("span",{"aria-hidden":"true",className:"chat-row-avatar__working-ring",style:{position:"absolute",inset:-3,width:e+6,height:e+6,borderRadius:"50%",border:"var(--hairline-bold) solid var(--state-working)",pointerEvents:"none",zIndex:1}})}function r5({count:e}){const t=Y4(e);return t===null?null:l.jsx("span",{"aria-hidden":"true",style:{position:"absolute",bottom:-3,right:-3,minWidth:"var(--sp-4)",height:"var(--sp-4)",padding:"0 var(--sp-1)",borderRadius:"var(--sp-2)",background:"var(--state-error)",color:"var(--fg-on-vivid)",fontSize:"var(--text-caption)",fontWeight:700,lineHeight:"var(--sp-4)",textAlign:"center",border:"var(--hairline-bold) solid var(--bg-raised)",boxSizing:"content-box",zIndex:3,userSelect:"none"},children:t})}function a5(e){var n;const t=e.trim();return t?((n=t[0])==null?void 0:n.toUpperCase())??"?":"?"}function Yf({src:e,name:t,size:n=28,className:a,colorToken:s,seed:o}){const u=`${n}px`;if(e)return l.jsx("img",{src:e,alt:t,width:n,height:n,className:a,style:{width:u,height:u,borderRadius:"50%",objectFit:"cover",display:"block"}});const f=typeof s=="string"&&s.length>0||o&&o.length>0,m=f?$u(s,o??""):"var(--accent)",h=f?"var(--fg-on-vivid)":"var(--bg-raised)";return l.jsx("span",{className:a,role:"img","aria-label":t,style:{width:u,height:u,borderRadius:"50%",background:m,color:h,display:"inline-flex",alignItems:"center",justifyContent:"center",lineHeight:1,userSelect:"none"},children:l.jsx("span",{className:"text-subtitle font-semibold",children:a5(t)})})}const R1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,O1=XC,i5=(e,t)=>n=>{var a;if((t==null?void 0:t.variants)==null)return O1(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:o}=t,u=Object.keys(s).map(h=>{const p=n==null?void 0:n[h],g=o==null?void 0:o[h];if(p===null)return null;const w=R1(p)||R1(g);return s[h][w]}),f=n&&Object.entries(n).reduce((h,p)=>{let[g,w]=p;return w===void 0||(h[g]=w),h},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((h,p)=>{let{class:g,className:w,...x}=p;return Object.entries(x).every(k=>{let[C,j]=k;return Array.isArray(j)?j.includes({...o,...f}[C]):{...o,...f}[C]===j})?[...h,g,w]:h},[]);return O1(e,u,m,n==null?void 0:n.class,n==null?void 0:n.className)},s5=i5("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[var(--radius-input)] text-body font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 px-3 text-label",xs:"h-7 rounded-[var(--radius-chip)] px-2.5 text-label gap-1.5",lg:"h-10 px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),xe=b.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...s},o)=>{const u=a?XI:"button";return l.jsx(u,{className:Oe(s5({variant:t,size:n,className:e})),ref:o,...s})});xe.displayName="Button";const Kt=b.forwardRef(({className:e,type:t,...n},a)=>l.jsx("input",{type:t,className:Oe("flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors file:border-0 file:bg-transparent file:text-body file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...n}));Kt.displayName="Input";function l5({action:e,onClose:t}){const n=e!==null;return l.jsx(_n,{open:n,onOpenChange:a=>!a&&t(),children:l.jsxs(bn,{children:[l.jsxs(In,{children:[l.jsx(Tn,{children:e==="join"?"Join a team":"Create a new team"}),l.jsx(Fv,{children:e==="join"?"Paste the invite token shared with you.":"You'll be the admin. You can rename or invite teammates afterward."})]}),e==="create"&&l.jsx(c5,{onDone:t}),e==="join"&&l.jsx(u5,{onDone:t})]})})}function o5(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"team"}function c5({onDone:e}){const{adoptTokens:t}=ut(),n=zn(),[a,s]=b.useState(""),[o,u]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{s(""),u(null),m(!1)},[]);const h=async p=>{p.preventDefault();const g=a.trim();if(g){m(!0),u(null);try{const w=await Ce.post("/me/organizations",{name:o5(g),displayName:g});await t(w.tokens),e(),n("/",{replace:!0})}catch(w){u(w instanceof Error?w.message:"Failed to create team")}finally{m(!1)}}};return l.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),l.jsx(Kt,{id:"team-display-name","aria-label":"Team name",value:a,onChange:p=>s(p.target.value),placeholder:"Acme Robotics",autoFocus:!0}),l.jsx(xe,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Creating…":"Create team"})]})}function u5({onDone:e}){const{adoptTokens:t}=ut(),n=zn(),[a,s]=b.useState(""),[o,u]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{s(""),u(null),m(!1)},[]);const h=async p=>{if(p.preventDefault(),!!a.trim()){m(!0),u(null);try{const g=a.trim(),w=/\/invite\/([^/?#]+)/.exec(g),x=(w==null?void 0:w[1])??g,k=await Ce.post("/me/organizations/join",{token:x});await t(k.tokens),e(),n("/",{replace:!0})}catch(g){u(g instanceof Error?g.message:"Failed to join team")}finally{m(!1)}}};return l.jsxs("form",{className:"space-y-3",onSubmit:h,children:[o&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:o}),l.jsx(Kt,{id:"join-token","aria-label":"Invite token or full URL",value:a,onChange:p=>s(p.target.value),placeholder:"abc123… or https://hub/invite/abc123",autoFocus:!0}),l.jsx(xe,{type:"submit",className:"w-full",disabled:f||!a.trim(),children:f?"Joining…":"Join team"})]})}function d5(){var z,R;const{organizationId:e,role:t,user:n,selectOrganization:a,logout:s}=ut(),o=zn(),[u,f]=b.useState([]),[m,h]=b.useState(!1),[p,g]=b.useState(null),w=b.useRef(null);b.useEffect(()=>{(async()=>{try{const F=await Ce.get("/me/organizations");f(F)}catch{}})()},[]),b.useEffect(()=>{const F=ee=>{m&&w.current&&!w.current.contains(ee.target)&&h(!1)},B=ee=>{m&&ee.key==="Escape"&&h(!1)};return window.addEventListener("mousedown",F),window.addEventListener("keydown",B),()=>{window.removeEventListener("mousedown",F),window.removeEventListener("keydown",B)}},[m]);const x=(n==null?void 0:n.displayName)??"User",k=(n==null?void 0:n.username)??"",C=(n==null?void 0:n.avatarUrl)??null,j=u.find(F=>F.id===e)??null,E=(j==null?void 0:j.role)??(t==="admin"||t==="member"?t:null),O=async F=>{if(F===e){h(!1);return}try{await a(F),h(!1),o("/",{replace:!0})}catch{}},A=()=>{h(!1),g("create")},D=()=>{h(!1),g("join")};return l.jsxs(l.Fragment,{children:[l.jsxs("div",{ref:w,className:"relative","data-testid":"user-menu",children:[l.jsx("button",{type:"button","aria-label":`User menu, ${x}`,"aria-haspopup":"menu","aria-expanded":m,onClick:()=>h(F=>!F),className:"inline-flex items-center justify-center rounded-full focus:outline-none focus:ring-2 focus:ring-ring transition-shadow",style:{background:"transparent",border:m?"var(--hairline) solid var(--border)":"var(--hairline) solid transparent",padding:1,cursor:"pointer"},children:l.jsx(Yf,{src:C,name:x,size:28})}),m&&l.jsxs("div",{role:"menu",className:"absolute right-0 z-30 mt-2 rounded-md border bg-popover shadow-md",style:{width:280},children:[l.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",style:{borderColor:"var(--border)"},children:[l.jsx(Yf,{src:C,name:x,size:32}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("div",{className:"text-subtitle font-medium truncate",style:{color:"var(--fg)"},children:x}),k&&k!==x&&l.jsxs("div",{className:"text-label text-muted-foreground truncate",children:["@",k]})]})]}),u.length>0&&l.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[l.jsx("div",{className:"px-4 py-1 text-eyebrow text-muted-foreground",children:"Current team"}),u.length===1?l.jsxs("div",{className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body",style:{color:"var(--fg)"},children:[l.jsx("span",{style:{width:14,display:"inline-flex"},children:l.jsx(mr,{className:"h-3.5 w-3.5"})}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:(z=u[0])==null?void 0:z.displayName}),l.jsx(M1,{role:((R=u[0])==null?void 0:R.role)??E})]}):l.jsx("div",{children:u.map(F=>l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>void O(F.id),className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[l.jsx("span",{style:{width:14,display:"inline-flex"},children:F.id===e?l.jsx(mr,{className:"h-3.5 w-3.5"}):null}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:F.displayName}),l.jsx(M1,{role:F.role})]},F.id))})]}),l.jsxs("div",{className:"border-b py-1",style:{borderColor:"var(--border)"},children:[l.jsxs("button",{type:"button",role:"menuitem",onClick:A,className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[l.jsx(Sa,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Create new team"})]}),l.jsxs("button",{type:"button",role:"menuitem",onClick:D,className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[l.jsx(QC,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Join with invite link"})]})]}),l.jsx("div",{className:"py-1",children:l.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{h(!1),s()},className:"flex w-full items-center gap-2 px-4 py-1.5 text-left text-body hover:bg-accent transition-colors",style:{color:"var(--fg)"},children:[l.jsx(zD,{className:"h-3.5 w-3.5"}),l.jsx("span",{children:"Sign out"})]})})]})]}),l.jsx(l5,{action:p,onClose:()=>g(null)})]})}function M1({role:e}){return e!=="admin"&&e!=="member"?null:l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:e==="admin"?"var(--accent-dim)":"var(--fg-3)",border:"var(--hairline) solid var(--border)",background:e==="admin"?"var(--accent-bg)":"var(--bg-sunken)"},children:e})}const f5=[{to:"/",label:"Workspace",end:!0},{to:"/context",label:"Context",end:!1},{to:"/team",label:"Team",end:!1},{to:"/settings",label:"Settings",end:!1}];function h5(){const[e,t]=b.useState(!1),n=Rr(),a=n.pathname==="/"||n.search.includes("a=");return l.jsxs("div",{className:"flex flex-col overflow-hidden",style:{height:"100vh",background:"var(--bg)"},children:[l.jsxs("header",{className:"relative shrink-0 grid items-center",style:{height:48,gridTemplateColumns:"1fr auto 1fr",gap:"var(--sp-3)",padding:"0 var(--sp-3)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg-raised)"},children:[l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3_5)",justifySelf:"start",minWidth:0},children:[l.jsxs("span",{className:"flex items-center",style:{gap:10,flexShrink:0},children:[l.jsx(Fu,{width:16,height:18,style:{color:"var(--fg)"}}),l.jsx("span",{className:"text-title",style:{color:"var(--fg)"},children:"First Tree"})]}),l.jsx(D4,{})]}),l.jsx("nav",{className:"flex",style:{gap:2,pointerEvents:"none",justifySelf:"center"},children:f5.map(s=>l.jsx(jv,{to:s.to,end:s.end,style:{pointerEvents:"auto"},className:({isActive:o})=>Oe("inline-flex items-center transition-colors",o?"":"hover:text-[var(--fg)]"),children:({isActive:o})=>l.jsx("span",{className:"inline-flex items-center text-subtitle font-medium",style:{padding:"var(--sp-1_5) var(--sp-3)",gap:6,borderRadius:5,color:o?"var(--fg)":"var(--fg-3)",background:o?"var(--bg-hover)":"transparent"},children:s.label})},s.to))}),l.jsxs("div",{className:"flex items-center",style:{gap:6,justifySelf:"end"},children:[l.jsxs("button",{type:"button",onClick:()=>t(!0),"aria-label":"Open command palette",className:"inline-flex items-center transition-colors text-body",style:{gap:8,padding:"var(--sp-1) var(--sp-3)",minWidth:200,color:"var(--fg-3)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)"},onMouseEnter:s=>{s.currentTarget.style.color="var(--fg)"},onMouseLeave:s=>{s.currentTarget.style.color="var(--fg-3)"},children:[l.jsx(Ov,{className:"h-4 w-4"}),l.jsx("span",{children:"Jump to…"})]}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(H4,{}),l.jsx(Z4,{}),l.jsx("span",{style:{width:1,height:18,background:"var(--border)",margin:"0 var(--sp-1)"}}),l.jsx(d5,{})]})]}),l.jsx(A4,{open:e,onOpenChange:t}),a?l.jsx(qf,{}):l.jsx("main",{className:"flex-1 overflow-auto",children:l.jsx("div",{className:"p-6 mx-auto",style:{maxWidth:1280},children:l.jsx(qf,{})})})]})}const mN=b.createContext(null),m5=5e3;function p5({children:e}){const[t,n]=b.useState([]),a=b.useCallback(u=>{n(f=>f.filter(m=>m.id!==u))},[]),o={addToast:b.useCallback(u=>{const f=`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;n(m=>[...m,{...u,id:f}])},[])};return l.jsxs(mN.Provider,{value:o,children:[e,l.jsx(g5,{toasts:t,onDismiss:a})]})}function Hu(){const e=b.useContext(mN);if(!e)throw new Error("useToast must be used within ToastProvider");return e}function g5({toasts:e,onDismiss:t}){return e.length===0?null:l.jsx("div",{style:{position:"fixed",bottom:"var(--sp-4)",right:"var(--sp-4)",zIndex:100,display:"flex",flexDirection:"column",gap:"var(--sp-2)",pointerEvents:"none",maxWidth:380},"aria-live":"polite","aria-atomic":"false",children:e.map(n=>l.jsx(y5,{toast:n,onDismiss:()=>t(n.id)},n.id))})}function y5({toast:e,onDismiss:t}){const n=b.useRef(t);return n.current=t,b.useEffect(()=>{if(e.durationMs===null)return;const a=e.durationMs??m5,s=setTimeout(()=>n.current(),a);return()=>clearTimeout(s)},[e.durationMs]),l.jsxs("div",{role:"status",style:{pointerEvents:"auto",display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"var(--sp-3) var(--sp-3_5)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",boxShadow:"var(--shadow-md)",animation:"toast-slide-in 180ms ease-out"},children:[l.jsxs("div",{className:"flex-1 min-w-0",style:{display:"flex",flexDirection:"column",gap:"var(--sp-1)"},children:[l.jsx("p",{className:"text-body font-medium",style:{margin:0,color:"var(--fg)"},children:e.title}),e.description?l.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)"},children:e.description}):null,e.action?l.jsx("button",{type:"button",onClick:()=>{var a;(a=e.action)==null||a.onClick(),t()},className:"text-label font-medium hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{alignSelf:"flex-start",marginTop:"var(--sp-1)",padding:0,background:"transparent",border:"none",color:"var(--accent)",cursor:"pointer"},children:e.action.label}):null]}),l.jsx("button",{type:"button",onClick:t,"aria-label":"Dismiss",className:"hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{padding:"var(--sp-1)",background:"transparent",border:"none",borderRadius:"var(--radius-input)",cursor:"pointer",color:"var(--fg-4)",flexShrink:0},children:l.jsx(pi,{className:"h-4 w-4"})})]})}function fe(e,t,n){function a(f,m){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:m,constr:u,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,m);const h=u.prototype,p=Object.keys(h);for(let g=0;g<p.length;g++){const w=p[g];w in f||(f[w]=h[w].bind(f))}}const s=(n==null?void 0:n.Parent)??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function u(f){var m;const h=n!=null&&n.Parent?new o:this;a(h,f),(m=h._zod).deferred??(m.deferred=[]);for(const p of h._zod.deferred)p();return h}return Object.defineProperty(u,"init",{value:a}),Object.defineProperty(u,Symbol.hasInstance,{value:f=>{var m,h;return n!=null&&n.Parent&&f instanceof n.Parent?!0:(h=(m=f==null?void 0:f._zod)==null?void 0:m.traits)==null?void 0:h.has(e)}}),Object.defineProperty(u,"name",{value:e}),u}class io extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class pN extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const gN={};function vs(e){return gN}function yN(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,s])=>t.indexOf(+a)===-1).map(([a,s])=>s)}function My(e,t){return typeof t=="bigint"?t.toString():t}function xh(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function qv(e){return e==null}function Zv(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function v5(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let s=(a.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(a)){const m=a.match(/\d?e-(\d?)/);m!=null&&m[1]&&(s=Number.parseInt(m[1]))}const o=n>s?n:s,u=Number.parseInt(e.toFixed(o).replace(".","")),f=Number.parseInt(t.toFixed(o).replace(".",""));return u%f/10**o}const D1=Symbol("evaluating");function Ot(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==D1)return a===void 0&&(a=D1,a=n()),a},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function ol(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ss(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function z1(e){return JSON.stringify(e)}function b5(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const vN="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function hu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const x5=xh(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function jo(e){if(hu(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(hu(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function bN(e){return jo(e)?{...e}:Array.isArray(e)?[...e]:e}const w5=new Set(["string","number","symbol"]);function Co(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function bi(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(a._zod.parent=e),a}function Ue(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function S5(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const k5={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function j5(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=Ss(e._zod.def,{get shape(){const u={};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(u[f]=n.shape[f])}return ol(this,"shape",u),u},checks:[]});return bi(e,o)}function C5(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=Ss(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete u[f]}return ol(this,"shape",u),u},checks:[]});return bi(e,o)}function E5(e,t){if(!jo(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const o=e._zod.def.shape;for(const u in t)if(Object.getOwnPropertyDescriptor(o,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=Ss(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return ol(this,"shape",o),o}});return bi(e,s)}function N5(e,t){if(!jo(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Ss(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return ol(this,"shape",a),a}});return bi(e,n)}function _5(e,t){const n=Ss(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return ol(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return bi(e,n)}function T5(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=Ss(t._zod.def,{get shape(){const f=t._zod.def.shape,m={...f};if(n)for(const h in n){if(!(h in f))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(m[h]=e?new e({type:"optional",innerType:f[h]}):f[h])}else for(const h in f)m[h]=e?new e({type:"optional",innerType:f[h]}):f[h];return ol(this,"shape",m),m},checks:[]});return bi(t,u)}function A5(e,t,n){const a=Ss(t._zod.def,{get shape(){const s=t._zod.def.shape,o={...s};if(n)for(const u in n){if(!(u in o))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(o[u]=new e({type:"nonoptional",innerType:s[u]}))}else for(const u in s)o[u]=new e({type:"nonoptional",innerType:s[u]});return ol(this,"shape",o),o}});return bi(t,a)}function eo(e,t=0){var n;if(e.aborted===!0)return!0;for(let a=t;a<e.issues.length;a++)if(((n=e.issues[a])==null?void 0:n.continue)!==!0)return!0;return!1}function to(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function wf(e){return typeof e=="string"?e:e==null?void 0:e.message}function bs(e,t,n){var s,o,u,f,m,h;const a={...e,path:e.path??[]};if(!e.message){const p=wf((u=(o=(s=e.inst)==null?void 0:s._zod.def)==null?void 0:o.error)==null?void 0:u.call(o,e))??wf((f=t==null?void 0:t.error)==null?void 0:f.call(t,e))??wf((m=n.customError)==null?void 0:m.call(n,e))??wf((h=n.localeError)==null?void 0:h.call(n,e))??"Invalid input";a.message=p}return delete a.inst,delete a.continue,t!=null&&t.reportInput||delete a.input,a}function Gv(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function mu(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const xN=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,My,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},wN=fe("$ZodError",xN),SN=fe("$ZodError",xN,{Parent:Error});function R5(e,t=n=>n.message){const n={},a=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):a.push(t(s));return{formErrors:a,fieldErrors:n}}function O5(e,t=n=>n.message){const n={_errors:[]},a=s=>{for(const o of s.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(u=>a({issues:u}));else if(o.code==="invalid_key")a({issues:o.issues});else if(o.code==="invalid_element")a({issues:o.issues});else if(o.path.length===0)n._errors.push(t(o));else{let u=n,f=0;for(;f<o.path.length;){const m=o.path[f];f===o.path.length-1?(u[m]=u[m]||{_errors:[]},u[m]._errors.push(t(o))):u[m]=u[m]||{_errors:[]},u=u[m],f++}}};return a(e),n}const Vv=e=>(t,n,a,s)=>{const o=a?Object.assign(a,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},o);if(u instanceof Promise)throw new io;if(u.issues.length){const f=new((s==null?void 0:s.Err)??e)(u.issues.map(m=>bs(m,o,vs())));throw vN(f,s==null?void 0:s.callee),f}return u.value},Qv=e=>async(t,n,a,s)=>{const o=a?Object.assign(a,{async:!0}):{async:!0};let u=t._zod.run({value:n,issues:[]},o);if(u instanceof Promise&&(u=await u),u.issues.length){const f=new((s==null?void 0:s.Err)??e)(u.issues.map(m=>bs(m,o,vs())));throw vN(f,s==null?void 0:s.callee),f}return u.value},wh=e=>(t,n,a)=>{const s=a?{...a,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},s);if(o instanceof Promise)throw new io;return o.issues.length?{success:!1,error:new(e??wN)(o.issues.map(u=>bs(u,s,vs())))}:{success:!0,data:o.value}},M5=wh(SN),Sh=e=>async(t,n,a)=>{const s=a?Object.assign(a,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},s);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(u=>bs(u,s,vs())))}:{success:!0,data:o.value}},D5=Sh(SN),z5=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Vv(e)(t,n,s)},I5=e=>(t,n,a)=>Vv(e)(t,n,a),L5=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Qv(e)(t,n,s)},P5=e=>async(t,n,a)=>Qv(e)(t,n,a),U5=e=>(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return wh(e)(t,n,s)},B5=e=>(t,n,a)=>wh(e)(t,n,a),F5=e=>async(t,n,a)=>{const s=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Sh(e)(t,n,s)},$5=e=>async(t,n,a)=>Sh(e)(t,n,a),H5=/^[cC][^\s-]{8,}$/,q5=/^[0-9a-z]+$/,Z5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,G5=/^[0-9a-vA-V]{20}$/,V5=/^[A-Za-z0-9]{27}$/,Q5=/^[a-zA-Z0-9_-]{21}$/,K5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Y5=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,I1=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,X5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,W5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function J5(){return new RegExp(W5,"u")}const eL=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tL=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,nL=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,rL=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,aL=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,kN=/^[A-Za-z0-9_-]*$/,iL=/^\+[1-9]\d{6,14}$/,jN="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",sL=new RegExp(`^${jN}$`);function CN(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function lL(e){return new RegExp(`^${CN(e)}$`)}function oL(e){const t=CN({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${t}(?:${n.join("|")})`;return new RegExp(`^${jN}T(?:${a})$`)}const cL=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},uL=/^-?\d+$/,EN=/^-?\d+(?:\.\d+)?$/,dL=/^(?:true|false)$/i,fL=/^null$/i,hL=/^[^A-Z]*$/,mL=/^[^a-z]*$/,Mr=fe("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),NN={number:"number",bigint:"bigint",object:"date"},_N=fe("$ZodCheckLessThan",(e,t)=>{Mr.init(e,t);const n=NN[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,o=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?s.maximum=t.value:s.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),TN=fe("$ZodCheckGreaterThan",(e,t)=>{Mr.init(e,t);const n=NN[typeof t.value];e._zod.onattach.push(a=>{const s=a._zod.bag,o=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pL=fe("$ZodCheckMultipleOf",(e,t)=>{Mr.init(e,t),e._zod.onattach.push(n=>{var a;(a=n._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):v5(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),gL=fe("$ZodCheckNumberFormat",(e,t)=>{var u;Mr.init(e,t),t.format=t.format||"float64";const n=(u=t.format)==null?void 0:u.includes("int"),a=n?"int":"number",[s,o]=k5[t.format];e._zod.onattach.push(f=>{const m=f._zod.bag;m.format=t.format,m.minimum=s,m.maximum=o,n&&(m.pattern=uL)}),e._zod.check=f=>{const m=f.value;if(n){if(!Number.isInteger(m)){f.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:m,inst:e});return}if(!Number.isSafeInteger(m)){m>0?f.issues.push({input:m,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):f.issues.push({input:m,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort});return}}m<s&&f.issues.push({origin:"number",input:m,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),m>o&&f.issues.push({origin:"number",input:m,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),yL=fe("$ZodCheckMaxLength",(e,t)=>{var n;Mr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!qv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<s&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const s=a.value;if(s.length<=t.maximum)return;const u=Gv(s);a.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),vL=fe("$ZodCheckMinLength",(e,t)=>{var n;Mr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!qv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const s=a.value;if(s.length>=t.minimum)return;const u=Gv(s);a.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),bL=fe("$ZodCheckLengthEquals",(e,t)=>{var n;Mr.init(e,t),(n=e._zod.def).when??(n.when=a=>{const s=a.value;return!qv(s)&&s.length!==void 0}),e._zod.onattach.push(a=>{const s=a._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=a=>{const s=a.value,o=s.length;if(o===t.length)return;const u=Gv(s),f=o>t.length;a.issues.push({origin:u,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),kh=fe("$ZodCheckStringFormat",(e,t)=>{var n,a;Mr.init(e,t),e._zod.onattach.push(s=>{const o=s._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),xL=fe("$ZodCheckRegex",(e,t)=>{kh.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),wL=fe("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=hL),kh.init(e,t)}),SL=fe("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=mL),kh.init(e,t)}),kL=fe("$ZodCheckIncludes",(e,t)=>{Mr.init(e,t);const n=Co(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(a)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),jL=fe("$ZodCheckStartsWith",(e,t)=>{Mr.init(e,t);const n=new RegExp(`^${Co(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),CL=fe("$ZodCheckEndsWith",(e,t)=>{Mr.init(e,t);const n=new RegExp(`.*${Co(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}}),EL=fe("$ZodCheckOverwrite",(e,t)=>{Mr.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class NL{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const a=t.split(`
|
|
345
|
-
`).filter(u=>u),s=Math.min(...a.map(u=>u.length-u.trimStart().length)),o=a.map(u=>u.slice(s)).map(u=>" ".repeat(this.indent*2)+u);for(const u of o)this.content.push(u)}compile(){const t=Function,n=this==null?void 0:this.args,s=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new t(...n,s.join(`
|
|
346
|
-
`))}}const _L={major:4,minor:3,patch:6},en=fe("$ZodType",(e,t)=>{var s;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=_L;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const o of a)for(const u of o._zod.onattach)u(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),(s=e._zod.deferred)==null||s.push(()=>{e._zod.run=e._zod.parse});else{const o=(f,m,h)=>{let p=eo(f),g;for(const w of m){if(w._zod.def.when){if(!w._zod.def.when(f))continue}else if(p)continue;const x=f.issues.length,k=w._zod.check(f);if(k instanceof Promise&&(h==null?void 0:h.async)===!1)throw new io;if(g||k instanceof Promise)g=(g??Promise.resolve()).then(async()=>{await k,f.issues.length!==x&&(p||(p=eo(f,x)))});else{if(f.issues.length===x)continue;p||(p=eo(f,x))}}return g?g.then(()=>f):f},u=(f,m,h)=>{if(eo(f))return f.aborted=!0,f;const p=o(m,a,h);if(p instanceof Promise){if(h.async===!1)throw new io;return p.then(g=>e._zod.parse(g,h))}return e._zod.parse(p,h)};e._zod.run=(f,m)=>{if(m.skipChecks)return e._zod.parse(f,m);if(m.direction==="backward"){const p=e._zod.parse({value:f.value,issues:[]},{...m,skipChecks:!0});return p instanceof Promise?p.then(g=>u(g,f,m)):u(p,f,m)}const h=e._zod.parse(f,m);if(h instanceof Promise){if(m.async===!1)throw new io;return h.then(p=>o(p,a,m))}return o(h,a,m)}}Ot(e,"~standard",()=>({validate:o=>{var u;try{const f=M5(e,o);return f.success?{value:f.data}:{issues:(u=f.error)==null?void 0:u.issues}}catch{return D5(e,o).then(m=>{var h;return m.success?{value:m.data}:{issues:(h=m.error)==null?void 0:h.issues}})}},vendor:"zod",version:1}))}),Kv=fe("$ZodString",(e,t)=>{var n;en.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??cL(e._zod.bag),e._zod.parse=(a,s)=>{if(t.coerce)try{a.value=String(a.value)}catch{}return typeof a.value=="string"||a.issues.push({expected:"string",code:"invalid_type",input:a.value,inst:e}),a}}),tn=fe("$ZodStringFormat",(e,t)=>{kh.init(e,t),Kv.init(e,t)}),TL=fe("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Y5),tn.init(e,t)}),AL=fe("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=I1(a))}else t.pattern??(t.pattern=I1());tn.init(e,t)}),RL=fe("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=X5),tn.init(e,t)}),OL=fe("$ZodURL",(e,t)=>{tn.init(e,t),e._zod.check=n=>{try{const a=n.value.trim(),s=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=s.href:n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),ML=fe("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=J5()),tn.init(e,t)}),DL=fe("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Q5),tn.init(e,t)}),zL=fe("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=H5),tn.init(e,t)}),IL=fe("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=q5),tn.init(e,t)}),LL=fe("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Z5),tn.init(e,t)}),PL=fe("$ZodXID",(e,t)=>{t.pattern??(t.pattern=G5),tn.init(e,t)}),UL=fe("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=V5),tn.init(e,t)}),BL=fe("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=oL(t)),tn.init(e,t)}),FL=fe("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=sL),tn.init(e,t)}),$L=fe("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=lL(t)),tn.init(e,t)}),HL=fe("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=K5),tn.init(e,t)}),qL=fe("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=eL),tn.init(e,t),e._zod.bag.format="ipv4"}),ZL=fe("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=tL),tn.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),GL=fe("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=nL),tn.init(e,t)}),VL=fe("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=rL),tn.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[s,o]=a;if(!o)throw new Error;const u=Number(o);if(`${u}`!==o)throw new Error;if(u<0||u>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function AN(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const QL=fe("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=aL),tn.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{AN(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function KL(e){if(!kN.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return AN(n)}const YL=fe("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=kN),tn.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{KL(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),XL=fe("$ZodE164",(e,t)=>{t.pattern??(t.pattern=iL),tn.init(e,t)});function WL(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[a]=n;if(!a)return!1;const s=JSON.parse(atob(a));return!("typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const JL=fe("$ZodJWT",(e,t)=>{tn.init(e,t),e._zod.check=n=>{WL(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),RN=fe("$ZodNumber",(e,t)=>{en.init(e,t),e._zod.pattern=e._zod.bag.pattern??EN,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const o=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...o?{received:o}:{}}),n}}),eP=fe("$ZodNumberFormat",(e,t)=>{gL.init(e,t),RN.init(e,t)}),tP=fe("$ZodBoolean",(e,t)=>{en.init(e,t),e._zod.pattern=dL,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}}),nP=fe("$ZodNull",(e,t)=>{en.init(e,t),e._zod.pattern=fL,e._zod.values=new Set([null]),e._zod.parse=(n,a)=>{const s=n.value;return s===null||n.issues.push({expected:"null",code:"invalid_type",input:s,inst:e}),n}}),rP=fe("$ZodUnknown",(e,t)=>{en.init(e,t),e._zod.parse=n=>n}),aP=fe("$ZodNever",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function L1(e,t,n){e.issues.length&&t.issues.push(...to(n,e.issues)),t.value[n]=e.value}const iP=fe("$ZodArray",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const o=[];for(let u=0;u<s.length;u++){const f=s[u],m=t.element._zod.run({value:f,issues:[]},a);m instanceof Promise?o.push(m.then(h=>L1(h,n,u))):L1(m,n,u)}return o.length?Promise.all(o).then(()=>n):n}});function Xf(e,t,n,a,s){if(e.issues.length){if(s&&!(n in a))return;t.issues.push(...to(n,e.issues))}e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function ON(e){var a,s,o,u;const t=Object.keys(e.shape);for(const f of t)if(!((u=(o=(s=(a=e.shape)==null?void 0:a[f])==null?void 0:s._zod)==null?void 0:o.traits)!=null&&u.has("$ZodType")))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);const n=S5(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function MN(e,t,n,a,s,o){const u=[],f=s.keySet,m=s.catchall._zod,h=m.def.type,p=m.optout==="optional";for(const g in t){if(f.has(g))continue;if(h==="never"){u.push(g);continue}const w=m.run({value:t[g],issues:[]},a);w instanceof Promise?e.push(w.then(x=>Xf(x,n,g,t,p))):Xf(w,n,g,t,p)}return u.length&&n.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}const sP=fe("$ZodObject",(e,t)=>{en.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...f};return Object.defineProperty(t,"shape",{value:m}),m}})}const a=xh(()=>ON(t));Ot(e._zod,"propValues",()=>{const f=t.shape,m={};for(const h in f){const p=f[h]._zod;if(p.values){m[h]??(m[h]=new Set);for(const g of p.values)m[h].add(g)}}return m});const s=hu,o=t.catchall;let u;e._zod.parse=(f,m)=>{u??(u=a.value);const h=f.value;if(!s(h))return f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f;f.value={};const p=[],g=u.shape;for(const w of u.keys){const x=g[w],k=x._zod.optout==="optional",C=x._zod.run({value:h[w],issues:[]},m);C instanceof Promise?p.push(C.then(j=>Xf(j,f,w,h,k))):Xf(C,f,w,h,k)}return o?MN(p,h,f,m,a.value,e):p.length?Promise.all(p).then(()=>f):f}}),lP=fe("$ZodObjectJIT",(e,t)=>{sP.init(e,t);const n=e._zod.parse,a=xh(()=>ON(t)),s=w=>{var A;const x=new NL(["shape","payload","ctx"]),k=a.value,C=D=>{const z=z1(D);return`shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`};x.write("const input = payload.value;");const j=Object.create(null);let E=0;for(const D of k.keys)j[D]=`key_${E++}`;x.write("const newResult = {};");for(const D of k.keys){const z=j[D],R=z1(D),F=w[D],B=((A=F==null?void 0:F._zod)==null?void 0:A.optout)==="optional";x.write(`const ${z} = ${C(D)};`),B?x.write(`
|
|
347
|
-
if (${z}.issues.length) {
|
|
348
|
-
if (${R} in input) {
|
|
349
|
-
payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
|
|
350
|
-
...iss,
|
|
351
|
-
path: iss.path ? [${R}, ...iss.path] : [${R}]
|
|
352
|
-
})));
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
if (${z}.value === undefined) {
|
|
357
|
-
if (${R} in input) {
|
|
358
|
-
newResult[${R}] = undefined;
|
|
359
|
-
}
|
|
360
|
-
} else {
|
|
361
|
-
newResult[${R}] = ${z}.value;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
`):x.write(`
|
|
365
|
-
if (${z}.issues.length) {
|
|
366
|
-
payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
|
|
367
|
-
...iss,
|
|
368
|
-
path: iss.path ? [${R}, ...iss.path] : [${R}]
|
|
369
|
-
})));
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
if (${z}.value === undefined) {
|
|
373
|
-
if (${R} in input) {
|
|
374
|
-
newResult[${R}] = undefined;
|
|
375
|
-
}
|
|
376
|
-
} else {
|
|
377
|
-
newResult[${R}] = ${z}.value;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
`)}x.write("payload.value = newResult;"),x.write("return payload;");const O=x.compile();return(D,z)=>O(w,D,z)};let o;const u=hu,f=!gN.jitless,h=f&&x5.value,p=t.catchall;let g;e._zod.parse=(w,x)=>{g??(g=a.value);const k=w.value;return u(k)?f&&h&&(x==null?void 0:x.async)===!1&&x.jitless!==!0?(o||(o=s(t.shape)),w=o(w,x),p?MN([],k,w,x,g,e):w):n(w,x):(w.issues.push({expected:"object",code:"invalid_type",input:k,inst:e}),w)}});function P1(e,t,n,a){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;const s=e.filter(o=>!eo(o));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(u=>bs(u,a,vs())))}),t)}const DN=fe("$ZodUnion",(e,t)=>{en.init(e,t),Ot(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),Ot(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),Ot(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),Ot(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>Zv(o.source)).join("|")})$`)}});const n=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(s,o)=>{if(n)return a(s,o);let u=!1;const f=[];for(const m of t.options){const h=m._zod.run({value:s.value,issues:[]},o);if(h instanceof Promise)f.push(h),u=!0;else{if(h.issues.length===0)return h;f.push(h)}}return u?Promise.all(f).then(m=>P1(m,s,e,o)):P1(f,s,e,o)}}),oP=fe("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,DN.init(e,t);const n=e._zod.parse;Ot(e._zod,"propValues",()=>{const s={};for(const o of t.options){const u=o._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(const[f,m]of Object.entries(u)){s[f]||(s[f]=new Set);for(const h of m)s[f].add(h)}}return s});const a=xh(()=>{var u;const s=t.options,o=new Map;for(const f of s){const m=(u=f._zod.propValues)==null?void 0:u[t.discriminator];if(!m||m.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(f)}"`);for(const h of m){if(o.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);o.set(h,f)}}return o});e._zod.parse=(s,o)=>{const u=s.value;if(!hu(u))return s.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),s;const f=a.value.get(u==null?void 0:u[t.discriminator]);return f?f._zod.run(s,o):t.unionFallback?n(s,o):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:u,path:[t.discriminator],inst:e}),s)}}),cP=fe("$ZodIntersection",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>{const s=n.value,o=t.left._zod.run({value:s,issues:[]},a),u=t.right._zod.run({value:s,issues:[]},a);return o instanceof Promise||u instanceof Promise?Promise.all([o,u]).then(([m,h])=>U1(n,m,h)):U1(n,o,u)}});function Dy(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(jo(e)&&jo(t)){const n=Object.keys(t),a=Object.keys(e).filter(o=>n.indexOf(o)!==-1),s={...e,...t};for(const o of a){const u=Dy(e[o],t[o]);if(!u.valid)return{valid:!1,mergeErrorPath:[o,...u.mergeErrorPath]};s[o]=u.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const s=e[a],o=t[a],u=Dy(s,o);if(!u.valid)return{valid:!1,mergeErrorPath:[a,...u.mergeErrorPath]};n.push(u.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function U1(e,t,n){const a=new Map;let s;for(const f of t.issues)if(f.code==="unrecognized_keys"){s??(s=f);for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).l=!0}else e.issues.push(f);for(const f of n.issues)if(f.code==="unrecognized_keys")for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).r=!0;else e.issues.push(f);const o=[...a].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(o.length&&s&&e.issues.push({...s,keys:o}),eo(e))return e;const u=Dy(t.value,n.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const uP=fe("$ZodRecord",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>{const s=n.value;if(!jo(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const o=[],u=t.keyType._zod.values;if(u){n.value={};const f=new Set;for(const h of u)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){f.add(typeof h=="number"?h.toString():h);const p=t.valueType._zod.run({value:s[h],issues:[]},a);p instanceof Promise?o.push(p.then(g=>{g.issues.length&&n.issues.push(...to(h,g.issues)),n.value[h]=g.value})):(p.issues.length&&n.issues.push(...to(h,p.issues)),n.value[h]=p.value)}let m;for(const h in s)f.has(h)||(m=m??[],m.push(h));m&&m.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:m})}else{n.value={};for(const f of Reflect.ownKeys(s)){if(f==="__proto__")continue;let m=t.keyType._zod.run({value:f,issues:[]},a);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&EN.test(f)&&m.issues.length){const g=t.keyType._zod.run({value:Number(f),issues:[]},a);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(m=g)}if(m.issues.length){t.mode==="loose"?n.value[f]=s[f]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(g=>bs(g,a,vs())),input:f,path:[f],inst:e});continue}const p=t.valueType._zod.run({value:s[f],issues:[]},a);p instanceof Promise?o.push(p.then(g=>{g.issues.length&&n.issues.push(...to(f,g.issues)),n.value[m.value]=g.value})):(p.issues.length&&n.issues.push(...to(f,p.issues)),n.value[m.value]=p.value)}}return o.length?Promise.all(o).then(()=>n):n}}),dP=fe("$ZodEnum",(e,t)=>{en.init(e,t);const n=yN(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(s=>w5.has(typeof s)).map(s=>typeof s=="string"?Co(s):s.toString()).join("|")})$`),e._zod.parse=(s,o)=>{const u=s.value;return a.has(u)||s.issues.push({code:"invalid_value",values:n,input:u,inst:e}),s}}),fP=fe("$ZodLiteral",(e,t)=>{if(en.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(a=>typeof a=="string"?Co(a):a?Co(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,s)=>{const o=a.value;return n.has(o)||a.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),a}}),hP=fe("$ZodTransform",(e,t)=>{en.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new pN(e.constructor.name);const s=t.transform(n.value,n);if(a.async)return(s instanceof Promise?s:Promise.resolve(s)).then(u=>(n.value=u,n));if(s instanceof Promise)throw new io;return n.value=s,n}});function B1(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const zN=fe("$ZodOptional",(e,t)=>{en.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ot(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ot(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Zv(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>B1(o,n.value)):B1(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),mP=fe("$ZodExactOptional",(e,t)=>{zN.init(e,t),Ot(e._zod,"values",()=>t.innerType._zod.values),Ot(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,a)=>t.innerType._zod.run(n,a)}),pP=fe("$ZodNullable",(e,t)=>{en.init(e,t),Ot(e._zod,"optin",()=>t.innerType._zod.optin),Ot(e._zod,"optout",()=>t.innerType._zod.optout),Ot(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Zv(n.source)}|null)$`):void 0}),Ot(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,a)=>n.value===null?n:t.innerType._zod.run(n,a)}),gP=fe("$ZodDefault",(e,t)=>{en.init(e,t),e._zod.optin="optional",Ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>F1(o,t)):F1(s,t)}});function F1(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const yP=fe("$ZodPrefault",(e,t)=>{en.init(e,t),e._zod.optin="optional",Ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>(a.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,a))}),vP=fe("$ZodNonOptional",(e,t)=>{en.init(e,t),Ot(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>$1(o,e)):$1(s,e)}});function $1(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const bP=fe("$ZodCatch",(e,t)=>{en.init(e,t),Ot(e._zod,"optin",()=>t.innerType._zod.optin),Ot(e._zod,"optout",()=>t.innerType._zod.optout),Ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(o=>(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(u=>bs(u,a,vs()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(o=>bs(o,a,vs()))},input:n.value}),n.issues=[]),n)}}),xP=fe("$ZodPipe",(e,t)=>{en.init(e,t),Ot(e._zod,"values",()=>t.in._zod.values),Ot(e._zod,"optin",()=>t.in._zod.optin),Ot(e._zod,"optout",()=>t.out._zod.optout),Ot(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,a)=>{if(a.direction==="backward"){const o=t.out._zod.run(n,a);return o instanceof Promise?o.then(u=>Sf(u,t.in,a)):Sf(o,t.in,a)}const s=t.in._zod.run(n,a);return s instanceof Promise?s.then(o=>Sf(o,t.out,a)):Sf(s,t.out,a)}});function Sf(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const wP=fe("$ZodReadonly",(e,t)=>{en.init(e,t),Ot(e._zod,"propValues",()=>t.innerType._zod.propValues),Ot(e._zod,"values",()=>t.innerType._zod.values),Ot(e._zod,"optin",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optin}),Ot(e._zod,"optout",()=>{var n,a;return(a=(n=t.innerType)==null?void 0:n._zod)==null?void 0:a.optout}),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const s=t.innerType._zod.run(n,a);return s instanceof Promise?s.then(H1):H1(s)}});function H1(e){return e.value=Object.freeze(e.value),e}const SP=fe("$ZodCustom",(e,t)=>{Mr.init(e,t),en.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,s=t.fn(a);if(s instanceof Promise)return s.then(o=>q1(o,n,a,e));q1(s,n,a,e)}});function q1(e,t,n,a){if(!e){const s={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(s.params=a._zod.def.params),t.issues.push(mu(s))}}var Z1;class kP{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const a=n[0];return this._map.set(t,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const a={...this.get(n)??{}};delete a.id;const s={...a,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function jP(){return new kP}(Z1=globalThis).__zod_globalRegistry??(Z1.__zod_globalRegistry=jP());const Xc=globalThis.__zod_globalRegistry;function CP(e,t){return new e({type:"string",...Ue(t)})}function EP(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ue(t)})}function G1(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ue(t)})}function NP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ue(t)})}function _P(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ue(t)})}function TP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ue(t)})}function AP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ue(t)})}function RP(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ue(t)})}function OP(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ue(t)})}function MP(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ue(t)})}function DP(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ue(t)})}function zP(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ue(t)})}function IP(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ue(t)})}function LP(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ue(t)})}function PP(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ue(t)})}function UP(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ue(t)})}function BP(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ue(t)})}function FP(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ue(t)})}function $P(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ue(t)})}function HP(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ue(t)})}function qP(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ue(t)})}function ZP(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ue(t)})}function GP(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ue(t)})}function VP(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ue(t)})}function QP(e,t){return new e({type:"string",format:"date",check:"string_format",...Ue(t)})}function KP(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ue(t)})}function YP(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ue(t)})}function XP(e,t){return new e({type:"number",checks:[],...Ue(t)})}function WP(e,t){return new e({type:"number",coerce:!0,checks:[],...Ue(t)})}function JP(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ue(t)})}function eU(e,t){return new e({type:"boolean",...Ue(t)})}function tU(e,t){return new e({type:"null",...Ue(t)})}function nU(e){return new e({type:"unknown"})}function rU(e,t){return new e({type:"never",...Ue(t)})}function V1(e,t){return new _N({check:"less_than",...Ue(t),value:e,inclusive:!1})}function mg(e,t){return new _N({check:"less_than",...Ue(t),value:e,inclusive:!0})}function Q1(e,t){return new TN({check:"greater_than",...Ue(t),value:e,inclusive:!1})}function pg(e,t){return new TN({check:"greater_than",...Ue(t),value:e,inclusive:!0})}function K1(e,t){return new pL({check:"multiple_of",...Ue(t),value:e})}function IN(e,t){return new yL({check:"max_length",...Ue(t),maximum:e})}function Wf(e,t){return new vL({check:"min_length",...Ue(t),minimum:e})}function LN(e,t){return new bL({check:"length_equals",...Ue(t),length:e})}function aU(e,t){return new xL({check:"string_format",format:"regex",...Ue(t),pattern:e})}function iU(e){return new wL({check:"string_format",format:"lowercase",...Ue(e)})}function sU(e){return new SL({check:"string_format",format:"uppercase",...Ue(e)})}function lU(e,t){return new kL({check:"string_format",format:"includes",...Ue(t),includes:e})}function oU(e,t){return new jL({check:"string_format",format:"starts_with",...Ue(t),prefix:e})}function cU(e,t){return new CL({check:"string_format",format:"ends_with",...Ue(t),suffix:e})}function Mo(e){return new EL({check:"overwrite",tx:e})}function uU(e){return Mo(t=>t.normalize(e))}function dU(){return Mo(e=>e.trim())}function fU(){return Mo(e=>e.toLowerCase())}function hU(){return Mo(e=>e.toUpperCase())}function mU(){return Mo(e=>b5(e))}function pU(e,t,n){return new e({type:"array",element:t,...Ue(n)})}function gU(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Ue(n)})}function yU(e){const t=vU(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(mu(a,n.value,t._zod.def));else{const s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(mu(s))}},e(n.value,n)));return t}function vU(e,t){const n=new Mr({check:"custom",...Ue(t)});return n._zod.check=e,n}function PN(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??Xc,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function En(e,t,n={path:[],schemaPath:[]}){var p,g;var a;const s=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.schema;const u={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,u);const f=(g=(p=e._zod).toJSONSchema)==null?void 0:g.call(p);if(f)u.schema=f;else{const w={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,w);else{const k=u.schema,C=t.processors[s.type];if(!C)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);C(e,t,k,w)}const x=e._zod.parent;x&&(u.ref||(u.ref=x),En(x,t,w),t.seen.get(x).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(u.schema,m),t.io==="input"&&cr(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&u.schema._prefault&&((a=u.schema).default??(a.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}function UN(e,t){var u,f,m,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=new Map;for(const p of e.seen.entries()){const g=(u=e.metadataRegistry.get(p[0]))==null?void 0:u.id;if(g){const w=a.get(g);if(w&&w!==p[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(g,p[0])}}const s=p=>{var C;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const j=(C=e.external.registry.get(p[0]))==null?void 0:C.id,E=e.external.uri??(A=>A);if(j)return{ref:E(j)};const O=p[1].defId??p[1].schema.id??`schema${e.counter++}`;return p[1].defId=O,{defId:O,ref:`${E("__shared")}#/${g}/${O}`}}if(p[1]===n)return{ref:"#"};const x=`#/${g}/`,k=p[1].schema.id??`__schema${e.counter++}`;return{defId:k,ref:x+k}},o=p=>{if(p[1].schema.$ref)return;const g=p[1],{ref:w,defId:x}=s(p);g.def={...g.schema},x&&(g.defId=x);const k=g.schema;for(const C in k)delete k[C];k.$ref=w};if(e.cycles==="throw")for(const p of e.seen.entries()){const g=p[1];if(g.cycle)throw new Error(`Cycle detected: #/${(f=g.cycle)==null?void 0:f.join("/")}/<root>
|
|
381
|
-
|
|
382
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of e.seen.entries()){const g=p[1];if(t===p[0]){o(p);continue}if(e.external){const x=(m=e.external.registry.get(p[0]))==null?void 0:m.id;if(t!==p[0]&&x){o(p);continue}}if((h=e.metadataRegistry.get(p[0]))==null?void 0:h.id){o(p);continue}if(g.cycle){o(p);continue}if(g.count>1&&e.reused==="ref"){o(p);continue}}}function BN(e,t){var u,f,m;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=h=>{const p=e.seen.get(h);if(p.ref===null)return;const g=p.def??p.schema,w={...g},x=p.ref;if(p.ref=null,x){a(x);const C=e.seen.get(x),j=C.schema;if(j.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(j)):Object.assign(g,j),Object.assign(g,w),h._zod.parent===x)for(const O in g)O==="$ref"||O==="allOf"||O in w||delete g[O];if(j.$ref&&C.def)for(const O in g)O==="$ref"||O==="allOf"||O in C.def&&JSON.stringify(g[O])===JSON.stringify(C.def[O])&&delete g[O]}const k=h._zod.parent;if(k&&k!==x){a(k);const C=e.seen.get(k);if(C!=null&&C.schema.$ref&&(g.$ref=C.schema.$ref,C.def))for(const j in g)j==="$ref"||j==="allOf"||j in C.def&&JSON.stringify(g[j])===JSON.stringify(C.def[j])&&delete g[j]}e.override({zodSchema:h,jsonSchema:g,path:p.path??[]})};for(const h of[...e.seen.entries()].reverse())a(h[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,(u=e.external)!=null&&u.uri){const h=(f=e.external.registry.get(t))==null?void 0:f.id;if(!h)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(h)}Object.assign(s,n.def??n.schema);const o=((m=e.external)==null?void 0:m.defs)??{};for(const h of e.seen.entries()){const p=h[1];p.def&&p.defId&&(o[p.defId]=p.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?s.$defs=o:s.definitions=o);try{const h=JSON.parse(JSON.stringify(s));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:Jf(t,"input",e.processors),output:Jf(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function cr(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return cr(a.element,n);if(a.type==="set")return cr(a.valueType,n);if(a.type==="lazy")return cr(a.getter(),n);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return cr(a.innerType,n);if(a.type==="intersection")return cr(a.left,n)||cr(a.right,n);if(a.type==="record"||a.type==="map")return cr(a.keyType,n)||cr(a.valueType,n);if(a.type==="pipe")return cr(a.in,n)||cr(a.out,n);if(a.type==="object"){for(const s in a.shape)if(cr(a.shape[s],n))return!0;return!1}if(a.type==="union"){for(const s of a.options)if(cr(s,n))return!0;return!1}if(a.type==="tuple"){for(const s of a.items)if(cr(s,n))return!0;return!!(a.rest&&cr(a.rest,n))}return!1}const bU=(e,t={})=>n=>{const a=PN({...n,processors:t});return En(e,a),UN(a,e),BN(a,e)},Jf=(e,t,n={})=>a=>{const{libraryOptions:s,target:o}=a??{},u=PN({...s??{},target:o,io:t,processors:n});return En(e,u),UN(u,e),BN(u,e)},xU={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},wU=(e,t,n,a)=>{const s=n;s.type="string";const{minimum:o,maximum:u,format:f,patterns:m,contentEncoding:h}=e._zod.bag;if(typeof o=="number"&&(s.minLength=o),typeof u=="number"&&(s.maxLength=u),f&&(s.format=xU[f]??f,s.format===""&&delete s.format,f==="time"&&delete s.format),h&&(s.contentEncoding=h),m&&m.size>0){const p=[...m];p.length===1?s.pattern=p[0].source:p.length>1&&(s.allOf=[...p.map(g=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:g.source}))])}},SU=(e,t,n,a)=>{const s=n,{minimum:o,maximum:u,format:f,multipleOf:m,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof f=="string"&&f.includes("int")?s.type="integer":s.type="number",typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=p,s.exclusiveMinimum=!0):s.exclusiveMinimum=p),typeof o=="number"&&(s.minimum=o,typeof p=="number"&&t.target!=="draft-04"&&(p>=o?delete s.minimum:delete s.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=h,s.exclusiveMaximum=!0):s.exclusiveMaximum=h),typeof u=="number"&&(s.maximum=u,typeof h=="number"&&t.target!=="draft-04"&&(h<=u?delete s.maximum:delete s.exclusiveMaximum)),typeof m=="number"&&(s.multipleOf=m)},kU=(e,t,n,a)=>{n.type="boolean"},jU=(e,t,n,a)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},CU=(e,t,n,a)=>{n.not={}},EU=(e,t,n,a)=>{},NU=(e,t,n,a)=>{const s=e._zod.def,o=yN(s.entries);o.every(u=>typeof u=="number")&&(n.type="number"),o.every(u=>typeof u=="string")&&(n.type="string"),n.enum=o},_U=(e,t,n,a)=>{const s=e._zod.def,o=[];for(const u of s.values)if(u===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof u=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(u))}else o.push(u);if(o.length!==0)if(o.length===1){const u=o[0];n.type=u===null?"null":typeof u,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[u]:n.const=u}else o.every(u=>typeof u=="number")&&(n.type="number"),o.every(u=>typeof u=="string")&&(n.type="string"),o.every(u=>typeof u=="boolean")&&(n.type="boolean"),o.every(u=>u===null)&&(n.type="null"),n.enum=o},TU=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},AU=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},RU=(e,t,n,a)=>{const s=n,o=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(s.minItems=u),typeof f=="number"&&(s.maxItems=f),s.type="array",s.items=En(o.element,t,{...a,path:[...a.path,"items"]})},OU=(e,t,n,a)=>{var h;const s=n,o=e._zod.def;s.type="object",s.properties={};const u=o.shape;for(const p in u)s.properties[p]=En(u[p],t,{...a,path:[...a.path,"properties",p]});const f=new Set(Object.keys(u)),m=new Set([...f].filter(p=>{const g=o.shape[p]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));m.size>0&&(s.required=Array.from(m)),((h=o.catchall)==null?void 0:h._zod.def.type)==="never"?s.additionalProperties=!1:o.catchall?o.catchall&&(s.additionalProperties=En(o.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},MU=(e,t,n,a)=>{const s=e._zod.def,o=s.inclusive===!1,u=s.options.map((f,m)=>En(f,t,{...a,path:[...a.path,o?"oneOf":"anyOf",m]}));o?n.oneOf=u:n.anyOf=u},DU=(e,t,n,a)=>{const s=e._zod.def,o=En(s.left,t,{...a,path:[...a.path,"allOf",0]}),u=En(s.right,t,{...a,path:[...a.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,m=[...f(o)?o.allOf:[o],...f(u)?u.allOf:[u]];n.allOf=m},zU=(e,t,n,a)=>{const s=n,o=e._zod.def;s.type="object";const u=o.keyType,f=u._zod.bag,m=f==null?void 0:f.patterns;if(o.mode==="loose"&&m&&m.size>0){const p=En(o.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});s.patternProperties={};for(const g of m)s.patternProperties[g.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=En(o.keyType,t,{...a,path:[...a.path,"propertyNames"]})),s.additionalProperties=En(o.valueType,t,{...a,path:[...a.path,"additionalProperties"]});const h=u._zod.values;if(h){const p=[...h].filter(g=>typeof g=="string"||typeof g=="number");p.length>0&&(s.required=p)}},IU=(e,t,n,a)=>{const s=e._zod.def,o=En(s.innerType,t,a),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=s.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]},LU=(e,t,n,a)=>{const s=e._zod.def;En(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},PU=(e,t,n,a)=>{const s=e._zod.def;En(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},UU=(e,t,n,a)=>{const s=e._zod.def;En(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},BU=(e,t,n,a)=>{const s=e._zod.def;En(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType;let u;try{u=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=u},FU=(e,t,n,a)=>{const s=e._zod.def,o=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;En(o,t,a);const u=t.seen.get(e);u.ref=o},$U=(e,t,n,a)=>{const s=e._zod.def;En(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType,n.readOnly=!0},FN=(e,t,n,a)=>{const s=e._zod.def;En(s.innerType,t,a);const o=t.seen.get(e);o.ref=s.innerType},HU=fe("ZodISODateTime",(e,t)=>{BL.init(e,t),ln.init(e,t)});function qU(e){return VP(HU,e)}const ZU=fe("ZodISODate",(e,t)=>{FL.init(e,t),ln.init(e,t)});function GU(e){return QP(ZU,e)}const VU=fe("ZodISOTime",(e,t)=>{$L.init(e,t),ln.init(e,t)});function QU(e){return KP(VU,e)}const KU=fe("ZodISODuration",(e,t)=>{HL.init(e,t),ln.init(e,t)});function YU(e){return YP(KU,e)}const XU=(e,t)=>{wN.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>O5(e,n)},flatten:{value:n=>R5(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,My,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,My,2)}},isEmpty:{get(){return e.issues.length===0}}})},ha=fe("ZodError",XU,{Parent:Error}),WU=Vv(ha),JU=Qv(ha),e6=wh(ha),t6=Sh(ha),n6=z5(ha),r6=I5(ha),a6=L5(ha),i6=P5(ha),s6=U5(ha),l6=B5(ha),o6=F5(ha),c6=$5(ha),nn=fe("ZodType",(e,t)=>(en.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Jf(e,"input"),output:Jf(e,"output")}}),e.toJSONSchema=bU(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Ss(t,{checks:[...t.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(n,a)=>bi(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>WU(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>e6(e,n,a),e.parseAsync=async(n,a)=>JU(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>t6(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>n6(e,n,a),e.decode=(n,a)=>r6(e,n,a),e.encodeAsync=async(n,a)=>a6(e,n,a),e.decodeAsync=async(n,a)=>i6(e,n,a),e.safeEncode=(n,a)=>s6(e,n,a),e.safeDecode=(n,a)=>l6(e,n,a),e.safeEncodeAsync=async(n,a)=>o6(e,n,a),e.safeDecodeAsync=async(n,a)=>c6(e,n,a),e.refine=(n,a)=>e.check(rB(n,a)),e.superRefine=n=>e.check(aB(n)),e.overwrite=n=>e.check(Mo(n)),e.optional=()=>W1(e),e.exactOptional=()=>q6(e),e.nullable=()=>J1(e),e.nullish=()=>W1(J1(e)),e.nonoptional=n=>Y6(e,n),e.array=()=>dt(e),e.or=n=>jh([e,n]),e.and=n=>U6(e,n),e.transform=n=>Iy(e,ZN(n)),e.default=n=>V6(e,n),e.prefault=n=>K6(e,n),e.catch=n=>W6(e,n),e.pipe=n=>Iy(e,n),e.readonly=()=>tB(e),e.describe=n=>{const a=e.clone();return Xc.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){var n;return(n=Xc.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Xc.get(e);const a=e.clone();return Xc.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),$N=fe("_ZodString",(e,t)=>{Kv.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(a,s,o)=>wU(e,a,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...a)=>e.check(aU(...a)),e.includes=(...a)=>e.check(lU(...a)),e.startsWith=(...a)=>e.check(oU(...a)),e.endsWith=(...a)=>e.check(cU(...a)),e.min=(...a)=>e.check(Wf(...a)),e.max=(...a)=>e.check(IN(...a)),e.length=(...a)=>e.check(LN(...a)),e.nonempty=(...a)=>e.check(Wf(1,...a)),e.lowercase=a=>e.check(iU(a)),e.uppercase=a=>e.check(sU(a)),e.trim=()=>e.check(dU()),e.normalize=(...a)=>e.check(uU(...a)),e.toLowerCase=()=>e.check(fU()),e.toUpperCase=()=>e.check(hU()),e.slugify=()=>e.check(mU())}),u6=fe("ZodString",(e,t)=>{Kv.init(e,t),$N.init(e,t),e.email=n=>e.check(EP(d6,n)),e.url=n=>e.check(RP(f6,n)),e.jwt=n=>e.check(GP(N6,n)),e.emoji=n=>e.check(OP(h6,n)),e.guid=n=>e.check(G1(Y1,n)),e.uuid=n=>e.check(NP(kf,n)),e.uuidv4=n=>e.check(_P(kf,n)),e.uuidv6=n=>e.check(TP(kf,n)),e.uuidv7=n=>e.check(AP(kf,n)),e.nanoid=n=>e.check(MP(m6,n)),e.guid=n=>e.check(G1(Y1,n)),e.cuid=n=>e.check(DP(p6,n)),e.cuid2=n=>e.check(zP(g6,n)),e.ulid=n=>e.check(IP(y6,n)),e.base64=n=>e.check(HP(j6,n)),e.base64url=n=>e.check(qP(C6,n)),e.xid=n=>e.check(LP(v6,n)),e.ksuid=n=>e.check(PP(b6,n)),e.ipv4=n=>e.check(UP(x6,n)),e.ipv6=n=>e.check(BP(w6,n)),e.cidrv4=n=>e.check(FP(S6,n)),e.cidrv6=n=>e.check($P(k6,n)),e.e164=n=>e.check(ZP(E6,n)),e.datetime=n=>e.check(qU(n)),e.date=n=>e.check(GU(n)),e.time=n=>e.check(QU(n)),e.duration=n=>e.check(YU(n))});function N(e){return CP(u6,e)}const ln=fe("ZodStringFormat",(e,t)=>{tn.init(e,t),$N.init(e,t)}),d6=fe("ZodEmail",(e,t)=>{RL.init(e,t),ln.init(e,t)}),Y1=fe("ZodGUID",(e,t)=>{TL.init(e,t),ln.init(e,t)}),kf=fe("ZodUUID",(e,t)=>{AL.init(e,t),ln.init(e,t)}),f6=fe("ZodURL",(e,t)=>{OL.init(e,t),ln.init(e,t)}),h6=fe("ZodEmoji",(e,t)=>{ML.init(e,t),ln.init(e,t)}),m6=fe("ZodNanoID",(e,t)=>{DL.init(e,t),ln.init(e,t)}),p6=fe("ZodCUID",(e,t)=>{zL.init(e,t),ln.init(e,t)}),g6=fe("ZodCUID2",(e,t)=>{IL.init(e,t),ln.init(e,t)}),y6=fe("ZodULID",(e,t)=>{LL.init(e,t),ln.init(e,t)}),v6=fe("ZodXID",(e,t)=>{PL.init(e,t),ln.init(e,t)}),b6=fe("ZodKSUID",(e,t)=>{UL.init(e,t),ln.init(e,t)}),x6=fe("ZodIPv4",(e,t)=>{qL.init(e,t),ln.init(e,t)}),w6=fe("ZodIPv6",(e,t)=>{ZL.init(e,t),ln.init(e,t)}),S6=fe("ZodCIDRv4",(e,t)=>{GL.init(e,t),ln.init(e,t)}),k6=fe("ZodCIDRv6",(e,t)=>{VL.init(e,t),ln.init(e,t)}),j6=fe("ZodBase64",(e,t)=>{QL.init(e,t),ln.init(e,t)}),C6=fe("ZodBase64URL",(e,t)=>{YL.init(e,t),ln.init(e,t)}),E6=fe("ZodE164",(e,t)=>{XL.init(e,t),ln.init(e,t)}),N6=fe("ZodJWT",(e,t)=>{JL.init(e,t),ln.init(e,t)}),Yv=fe("ZodNumber",(e,t)=>{RN.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(a,s,o)=>SU(e,a,s),e.gt=(a,s)=>e.check(Q1(a,s)),e.gte=(a,s)=>e.check(pg(a,s)),e.min=(a,s)=>e.check(pg(a,s)),e.lt=(a,s)=>e.check(V1(a,s)),e.lte=(a,s)=>e.check(mg(a,s)),e.max=(a,s)=>e.check(mg(a,s)),e.int=a=>e.check(X1(a)),e.safe=a=>e.check(X1(a)),e.positive=a=>e.check(Q1(0,a)),e.nonnegative=a=>e.check(pg(0,a)),e.negative=a=>e.check(V1(0,a)),e.nonpositive=a=>e.check(mg(0,a)),e.multipleOf=(a,s)=>e.check(K1(a,s)),e.step=(a,s)=>e.check(K1(a,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Be(e){return XP(Yv,e)}const _6=fe("ZodNumberFormat",(e,t)=>{eP.init(e,t),Yv.init(e,t)});function X1(e){return JP(_6,e)}const T6=fe("ZodBoolean",(e,t)=>{tP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>kU(e,n,a)});function Dn(e){return eU(T6,e)}const A6=fe("ZodNull",(e,t)=>{nP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>jU(e,n,a)});function R6(e){return tU(A6,e)}const O6=fe("ZodUnknown",(e,t)=>{rP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>EU()});function sn(){return nU(O6)}const M6=fe("ZodNever",(e,t)=>{aP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>CU(e,n,a)});function D6(e){return rU(M6,e)}const z6=fe("ZodArray",(e,t)=>{iP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>RU(e,n,a,s),e.element=t.element,e.min=(n,a)=>e.check(Wf(n,a)),e.nonempty=n=>e.check(Wf(1,n)),e.max=(n,a)=>e.check(IN(n,a)),e.length=(n,a)=>e.check(LN(n,a)),e.unwrap=()=>e.element});function dt(e,t){return pU(z6,e,t)}const I6=fe("ZodObject",(e,t)=>{lP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>OU(e,n,a,s),Ot(e,"shape",()=>t.shape),e.keyof=()=>De(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:sn()}),e.loose=()=>e.clone({...e._zod.def,catchall:sn()}),e.strict=()=>e.clone({...e._zod.def,catchall:D6()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>E5(e,n),e.safeExtend=n=>N5(e,n),e.merge=n=>_5(e,n),e.pick=n=>j5(e,n),e.omit=n=>C5(e,n),e.partial=(...n)=>T5(GN,e,n[0]),e.required=(...n)=>A5(VN,e,n[0])});function ne(e,t){const n={type:"object",shape:e??{},...Ue(t)};return new I6(n)}const HN=fe("ZodUnion",(e,t)=>{DN.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>MU(e,n,a,s),e.options=t.options});function jh(e,t){return new HN({type:"union",options:e,...Ue(t)})}const L6=fe("ZodDiscriminatedUnion",(e,t)=>{HN.init(e,t),oP.init(e,t)});function Ch(e,t,n){return new L6({type:"union",options:t,discriminator:e,...Ue(n)})}const P6=fe("ZodIntersection",(e,t)=>{cP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>DU(e,n,a,s)});function U6(e,t){return new P6({type:"intersection",left:e,right:t})}const qN=fe("ZodRecord",(e,t)=>{uP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>zU(e,n,a,s),e.keyType=t.keyType,e.valueType=t.valueType});function mn(e,t,n){return new qN({type:"record",keyType:e,valueType:t,...Ue(n)})}function B6(e,t,n){const a=bi(e);return a._zod.values=void 0,new qN({type:"record",keyType:a,valueType:t,...Ue(n)})}const zy=fe("ZodEnum",(e,t)=>{dP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(a,s,o)=>NU(e,a,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,s)=>{const o={};for(const u of a)if(n.has(u))o[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new zy({...t,checks:[],...Ue(s),entries:o})},e.exclude=(a,s)=>{const o={...t.entries};for(const u of a)if(n.has(u))delete o[u];else throw new Error(`Key ${u} not found in enum`);return new zy({...t,checks:[],...Ue(s),entries:o})}});function De(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new zy({type:"enum",entries:n,...Ue(t)})}const F6=fe("ZodLiteral",(e,t)=>{fP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>_U(e,n,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ut(e,t){return new F6({type:"literal",values:Array.isArray(e)?e:[e],...Ue(t)})}const $6=fe("ZodTransform",(e,t)=>{hP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>AU(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new pN(e.constructor.name);n.addIssue=o=>{if(typeof o=="string")n.issues.push(mu(o,n.value,t));else{const u=o;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=n.value),u.inst??(u.inst=e),n.issues.push(mu(u))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(o=>(n.value=o,n)):(n.value=s,n)}});function ZN(e){return new $6({type:"transform",transform:e})}const GN=fe("ZodOptional",(e,t)=>{zN.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>FN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function W1(e){return new GN({type:"optional",innerType:e})}const H6=fe("ZodExactOptional",(e,t)=>{mP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>FN(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function q6(e){return new H6({type:"optional",innerType:e})}const Z6=fe("ZodNullable",(e,t)=>{pP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>IU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function J1(e){return new Z6({type:"nullable",innerType:e})}const G6=fe("ZodDefault",(e,t)=>{gP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>PU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function V6(e,t){return new G6({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():bN(t)}})}const Q6=fe("ZodPrefault",(e,t)=>{yP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>UU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function K6(e,t){return new Q6({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():bN(t)}})}const VN=fe("ZodNonOptional",(e,t)=>{vP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>LU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function Y6(e,t){return new VN({type:"nonoptional",innerType:e,...Ue(t)})}const X6=fe("ZodCatch",(e,t)=>{bP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>BU(e,n,a,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function W6(e,t){return new X6({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const J6=fe("ZodPipe",(e,t)=>{xP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>FU(e,n,a,s),e.in=t.in,e.out=t.out});function Iy(e,t){return new J6({type:"pipe",in:e,out:t})}const eB=fe("ZodReadonly",(e,t)=>{wP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>$U(e,n,a,s),e.unwrap=()=>e._zod.def.innerType});function tB(e){return new eB({type:"readonly",innerType:e})}const nB=fe("ZodCustom",(e,t)=>{SP.init(e,t),nn.init(e,t),e._zod.processJSONSchema=(n,a,s)=>TU(e,n)});function rB(e,t={}){return gU(nB,e,t)}function aB(e){return yU(e)}function iB(e,t){return Iy(ZN(e),t)}const hs={custom:"custom"};function Eh(e){return WP(Yv,e)}const QN=new RegExp("(?<![A-Za-z0-9_.@-])@([A-Za-z0-9][A-Za-z0-9_-]{0,63})\\b","g");function KN(e){return e.replace(/```[\s\S]*?```/g,"").replace(/~~~[\s\S]*?~~~/g,"").replace(/`[^`\n]+`/g,"")}function YN(e,t){const n=KN(e),a=new Map;for(const o of t)o.name&&a.set(o.name.toLowerCase(),o.agentId);if(a.size===0)return[];const s=new Set;for(const o of n.matchAll(QN)){const u=o[1];if(!u)continue;const f=a.get(u.toLowerCase());f&&s.add(f)}return[...s]}function sB(e){const t=KN(e),n=[];for(const a of t.matchAll(QN)){const s=a[1];s&&n.push(s.toLowerCase())}return n}const lB=/^\/(?![/\\])[A-Za-z0-9_\-./?=&%#]*$/,ek="/";function XN(e){return!e||typeof e!="string"||e.length>256||!lB.test(e)?"/":e}const oB={FEISHU:"feishu",SLACK:"slack",KAEL:"kael"},WN=De(["feishu","slack","kael"]),JN=De(["active","inactive"]);ne({platform:WN,agentId:N().min(1),credentials:mn(N(),sn()),status:JN.default("active")});ne({agentId:N().min(1).optional(),credentials:mn(N(),sn()).optional(),status:JN.optional()});ne({id:Be(),platform:N(),agentId:N(),hasCredentials:Dn(),status:N(),createdAt:N(),updatedAt:N()});const cB=De(["code","reverse_token","oauth","manual"]);ne({appId:N().min(1),appSecret:N().min(1)});ne({platform:WN,externalUserId:N().min(1),agentId:N().min(1),boundVia:cB.default("manual"),displayName:N().max(200).optional()});ne({id:Be(),platform:N(),externalUserId:N(),agentId:N(),boundVia:N().nullable(),displayName:N().nullable(),createdAt:N()});ne({feishuUserId:N().min(1),displayName:N().max(200).optional()});ne({configId:Be(),platform:N(),agentId:N(),appId:N(),connected:Dn(),lastActiveAt:N().nullable()});const uB=32e3,Xv=/^[a-z0-9][a-z0-9_-]{0,63}$/i,dB=/^[A-Z][A-Z0-9_]*$/,fB=/^[A-Za-z]:/,e_=ne({append:N().max(uB).default("")}),hB=ne({name:N().regex(Xv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Ut("stdio"),command:N().min(1),args:dt(N()).optional()}),mB=ne({name:N().regex(Xv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Ut("http"),url:N().url(),headers:mn(N(),N()).optional()}),pB=ne({name:N().regex(Xv,"MCP name must match /^[a-z0-9][a-z0-9_-]{0,63}$/i"),transport:Ut("sse"),url:N().url(),headers:mn(N(),N()).optional()}),t_=Ch("transport",[hB,mB,pB]),n_=ne({key:N().regex(dB,"Env key must match /^[A-Z][A-Z0-9_]*$/"),value:N(),sensitive:Dn().default(!1)});function gB(e){for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<=31||n===127)return!0}return!1}function yB(e){if(e.length===0)return"Git repo local path must not be empty";if(e.trim()!==e)return"Git repo local path must not have leading or trailing whitespace";if(gB(e))return"Git repo local path must not contain control characters";if(e.includes("\\"))return"Git repo local path must use forward slashes";if(e.startsWith("/")||fB.test(e))return"Git repo local path must be relative";const t=e.split("/");for(const n of t){if(!n)return"Git repo local path must not contain empty path segments";if(n==="."||n==="..")return"Git repo local path must not contain dot segments";if(n.trim()!==n)return"Git repo local path segments must not have leading or trailing whitespace"}return null}const Wv=ne({url:N().min(1),ref:N().min(1).optional(),localPath:N().min(1).superRefine((e,t)=>{const n=yB(e);n&&t.addIssue({code:hs.custom,message:n})}).optional()}),r_=ne({prompt:e_.default({append:""}),model:N().default("opus"),mcpServers:dt(t_).default([]),env:dt(n_).default([]),gitRepos:dt(Wv).default([])}),vB=r_.extend({kind:Ut("claude-code")}),bB=r_.extend({kind:Ut("codex")}),xB=Ch("kind",[vB,bB]),wB=(e,t)=>{const n=new Set;e.mcpServers.forEach((o,u)=>{const f=o.name.toLowerCase();n.has(f)&&t.addIssue({code:hs.custom,path:["mcpServers",u,"name"],message:`Duplicate MCP server name "${o.name}"`}),n.add(f)});const a=new Set;e.env.forEach((o,u)=>{a.has(o.key)&&t.addIssue({code:hs.custom,path:["env",u,"key"],message:`Duplicate env key "${o.key}"`}),a.add(o.key)});const s=new Set;e.gitRepos.forEach((o,u)=>{const f=o.localPath??eh(o.url);f&&(s.has(f)&&t.addIssue({code:hs.custom,path:["gitRepos",u,"localPath"],message:`Duplicate git repo local path "${f}"`}),s.add(f))})},a_=iB(e=>e&&typeof e=="object"&&!Array.isArray(e)&&!("kind"in e)?{...e,kind:"claude-code"}:e,xB).superRefine((e,t)=>{wB(e,t)}),SB=ne({agentId:N(),version:Be().int().positive(),payload:a_,updatedAt:N(),updatedBy:N()}),i_=ne({prompt:e_,model:N(),mcpServers:dt(t_),env:dt(n_),gitRepos:dt(Wv)}).partial();ne({expectedVersion:Be().int().positive(),payload:i_});ne({payload:i_});ne({current:SB,next:a_,diff:dt(ne({path:N(),op:De(["add","remove","replace"]),before:sn().optional(),after:sn().optional()}))});const pu="***";function eh(e){const t=e.trim();return t?((t.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,""):""}const s_=De(["online","offline"]),l_=De(["idle","working","blocked","error"]);De(["active","suspended","evicted","errored"]);const kB=De(["active","suspended","errored"]);ne({chatId:N().min(1),state:kB});ne({runtimeState:l_});ne({agentId:N().min(1),runtimeType:N().max(50),runtimeVersion:N().max(50).optional()});De(["wrong_client","not_owned","agent_suspended","wrong_org","unknown_agent","runtime_provider_mismatch"]);ne({agentId:N(),status:s_,connectedAt:N().nullable(),lastSeenAt:N(),clientId:N().nullable().optional(),runtimeType:N().nullable().optional(),runtimeVersion:N().nullable().optional(),runtimeState:l_.nullable().optional(),activeSessions:Be().int().nullable().optional(),totalSessions:Be().int().nullable().optional(),runtimeUpdatedAt:N().nullable().optional()});ne({total:Be().int(),running:Be().int(),byState:ne({idle:Be().int(),working:Be().int(),blocked:Be().int(),error:Be().int()}),clients:Be().int()});const th={CLAUDE_CODE:"claude-code",CODEX:"codex"},Nh=De(["claude-code","codex"]),_h=De(["human","personal_assistant","autonomous_agent"]),tk={PRIVATE:"private",ORGANIZATION:"organization"},Jv=De(["private","organization"]),Ly=["hue-0","hue-1","hue-2","hue-3","hue-4","hue-5","hue-6","hue-7"],jB=De(Ly),CB=De(["admin-api","portal"]);De(["active","suspended"]);const Py=/^[a-z0-9][a-z0-9_-]{0,63}$/,no=64,EB=["admin","agent","first-tree","hub","me","null","system","undefined"],NB=new Set(EB);function Uy(e){return NB.has(e)}ne({name:N().min(1).max(64).regex(Py,"Must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_). Max 64 chars.").refine(e=>!Uy(e),{message:"That agent name is reserved — pick a different one."}).optional(),type:_h,displayName:N().min(1).max(200).optional(),delegateMention:N().max(100).optional(),organizationId:N().min(1).max(100).optional(),source:CB.optional(),visibility:Jv.optional(),metadata:mn(N(),sn()).optional(),managerId:N().optional(),clientId:N().min(1).max(100).optional(),runtimeProvider:Nh.optional(),gitRepos:dt(Wv).optional()});ne({type:_h.optional(),displayName:N().min(1).max(200).optional(),delegateMention:N().max(100).nullable().optional(),visibility:Jv.optional(),metadata:mn(N(),sn()).optional(),managerId:N().nullable().optional(),clientId:N().min(1).max(100).nullable().optional(),avatarColorToken:jB.nullable().optional()});ne({clientId:N().min(1).max(100),runtimeProvider:Nh,force:Dn().optional()});ne({uuid:N(),name:N().nullable(),organizationId:N(),type:_h,displayName:N(),delegateMention:N().nullable(),inboxId:N(),status:N(),source:N().nullable().optional(),visibility:Jv,metadata:mn(N(),sn()),managerId:N().nullable(),clientId:N().nullable(),runtimeProvider:Nh,avatarColorToken:N().nullable(),avatarImageUrl:N().nullable(),presenceStatus:s_.optional(),createdAt:N(),updatedAt:N()});ne({repo:N().nullable(),branch:N().nullable()});ne({type:Ut("agent:pinned"),agentId:N(),name:N().nullable(),displayName:N(),agentType:_h,runtimeProvider:Nh});ne({username:N().min(1),password:N().min(1)});ne({accessToken:N(),refreshToken:N()});ne({refreshToken:N().min(1)});ne({token:N().min(1)});ne({token:N(),expiresIn:Be(),command:N()});const _B=["issue","pull_request","discussion","commit"],eb=De(_B),TB=ne({source:Ut("github"),entityType:eb,entityKey:N().min(1),entityUrl:N().url().optional()}),AB=ne({source:Ut("feishu"),externalChannelId:N().min(1)}),RB=Ch("source",[TB,AB]),OB=jh([ne({}).strict(),RB]),MB=["manual","github_issue","github_pull_request","github_discussion","github_commit","feishu"],tb=De(MB),DB=De(["direct","group"]),By={ACTIVE:"active",ARCHIVED:"archived",DELETED:"deleted"},nb=De(["active","archived","deleted"]);ne({status:nb});ne({type:DB,topic:N().max(500).optional(),participantIds:dt(N()).min(1),metadata:OB.optional()});const zB=ne({agentId:N(),role:N(),mode:N(),joinedAt:N()}),IB=zB.extend({name:N().nullable(),displayName:N(),type:N()}),LB=ne({id:N(),organizationId:N(),type:N(),topic:N().nullable(),lifecyclePolicy:N().nullable().optional(),metadata:mn(N(),sn()),createdAt:N(),updatedAt:N()});LB.extend({participants:dt(IB),title:N(),firstMessagePreview:N().nullable(),engagementStatus:nb,viewerMembershipKind:De(["participant","watching"]).nullable()});ne({topic:N().trim().max(500).nullable()});ne({agentId:N().min(1)});ne({agentId:N().min(1)});const PB=De(["connected","disconnected"]),UB=De(["ok","expired"]);ne({id:N(),userId:N().nullable(),status:PB,authState:UB,sdkVersion:N().max(50).nullable(),hostname:N().max(100).nullable(),os:N().max(50).nullable(),agentCount:Be().int().min(0),connectedAt:N().nullable(),lastSeenAt:N(),metadata:mn(N(),sn()).nullable()});const BB=ne({wsInboxDeliver:Dn().default(!1)}).partial();ne({clientId:N().min(1).max(100),hostname:N().max(100).optional(),os:N().max(50).optional(),sdkVersion:N().max(50).optional(),wireCapabilities:BB.optional()});ne({clientId:N(),previousUserId:N().nullable(),unpinnedAgentCount:Be().int().nonnegative()});const FB=De(["ok","missing","unauthenticated","error"]),$B=De(["api_key","oauth","auth_json","none"]),HB=ne({state:FB,available:Dn(),authenticated:Dn(),sdkVersion:N().nullable().optional(),authMethod:$B,error:N().nullable().optional(),detectedAt:N()}),qB=mn(N(),HB);ne({capabilities:qB});ne({limit:Eh().int().min(1).max(100).default(20),cursor:N().optional()});const ZB=De(["active","stale","unavailable"]),GB=De(["ok","warning","error"]),VB=ne({label:N(),detail:N().nullable(),severity:GB}),QB=De(["root","domain","subdomain","leaf"]),rb=De(["added","edited","removed"]),KB=De(["parent","soft_link","markdown_link"]),YB=De(["low","medium","high"]),XB=ne({id:N(),path:N(),sourcePath:N().nullable(),title:N(),kind:QB,owners:dt(N()),parentId:N().nullable(),preview:N().nullable(),relatedNodeIds:dt(N()),affectedContextArea:N(),changeType:rb.nullable(),changedAtCommit:N().nullable()}),WB=ne({source:N(),target:N(),kind:KB}),JB=ne({path:N(),nodeId:N().nullable(),type:rb,commit:N().nullable(),changedAt:N().nullable(),changedBy:N().nullable(),summary:N().nullable()}),eF=ne({id:N(),nodeId:N().nullable(),path:N(),title:N(),changeType:rb,affectedContextArea:N(),reason:N(),summary:N(),changedBy:N().nullable(),owners:dt(N()),relatedNodeIds:dt(N()),sourceCommit:N().nullable(),riskLevel:YB}),tF=ne({addedCount:Be().int().nonnegative(),editedCount:Be().int().nonnegative(),removedCount:Be().int().nonnegative(),changedNodeCount:Be().int().nonnegative()}),nF=ne({windowDays:Be().int().positive(),agentCount:Be().int().nonnegative(),usageCount:Be().int().nonnegative()});ne({repo:N().nullable(),branch:N().nullable(),headCommit:N().nullable(),syncedAt:N().nullable(),snapshotStatus:ZB,contextStatus:VB,summary:tF,usage:nF,updates:dt(eF),nodes:dt(XB),edges:dt(WB),changes:dt(JB)});const rF=["User","Organization"],aF=De(rF),iF=["read","write","admin"],sF=De(iF),lF=mn(N(),sF),oF=dt(N());ne({login:N().optional(),accessToken:N().optional(),accessTokenExpiresAt:N().datetime({offset:!0}).optional(),refreshToken:N().optional(),refreshTokenExpiresAt:N().datetime({offset:!0}).optional()});ne({installationId:Be().int().positive()});ne({installationId:Be().int().positive(),accountType:aF,accountLogin:N(),accountGithubId:Be().int().positive(),permissions:lF,events:oF,suspended:Dn(),manageUrl:N().url(),createdAt:N().datetime({offset:!0}),updatedAt:N().datetime({offset:!0})});const cF=["image/png","image/jpeg","image/gif","image/webp"],ab=De(cF);ne({data:N().min(1),mimeType:ab,filename:N().min(1),size:Be().int().nonnegative().optional(),imageId:N().uuid().optional()});ne({imageId:N().uuid(),mimeType:ab,filename:N().min(1),size:Be().int().nonnegative().optional()});ne({type:Ut("image_payload"),imageId:N().uuid(),chatId:N(),base64:N().min(1),mimeType:ab,filename:N().min(1),size:Be().int().nonnegative().optional()});const ib=De(["hub_ui","cli","feishu","github","api"]),o_=De(["text","markdown","card","reference","file","question","question_answer"]),uF=De(["agent-final-text"]);ne({format:o_.default("text"),content:sn(),metadata:mn(N(),sn()).optional(),inReplyTo:N().optional(),replyToInbox:N().optional(),replyToChat:N().optional(),source:ib.optional(),purpose:uF.optional()});ne({format:o_.default("text"),content:sn(),metadata:mn(N(),sn()).optional(),replyToInbox:N().optional(),replyToChat:N().optional(),source:ib.optional(),direct:Dn().optional()});const dF=ne({id:N(),chatId:N(),senderId:N(),format:N(),content:sn(),metadata:mn(N(),sn()),replyToInbox:N().nullable(),replyToChat:N().nullable(),inReplyTo:N().nullable(),source:ib.nullable(),createdAt:N()}),fF=ne({senderId:N(),chatId:N(),replyToChat:N().nullable()}).nullable(),hF=De(["full","mention_only"]),mF=ne({id:N(),senderId:N(),format:N(),content:sn(),metadata:mn(N(),sn()).default({}),createdAt:N()}),c_=dF.extend({configVersion:Be().int().positive(),recipientMode:hF.default("full"),inReplyToSnapshot:fF.default(null),precedingMessages:dt(mF).default([])});De(["pending","delivered","acked","failed"]);const pF=ne({id:Be(),inboxId:N(),messageId:N(),chatId:N().nullable(),status:N(),retryCount:Be(),createdAt:N(),deliveredAt:N().nullable(),ackedAt:N().nullable()});pF.extend({message:c_});ne({limit:Eh().int().min(1).max(50).default(10)});ne({type:Ut("inbox:deliver"),entryId:Be().int().nonnegative(),inboxId:N().min(1),chatId:N().nullable(),message:c_}).passthrough();ne({type:Ut("inbox:ack"),entryId:Be().int().nonnegative()});const gF=7;ne({organizationId:N(),organizationName:N(),organizationDisplayName:N(),role:N(),expiresAt:N().nullable()});ne({id:N(),organizationId:N(),token:N(),inviteUrl:N(),role:N(),createdAt:N(),expiresAt:N().nullable()});ne({token:N().min(1)});ne({}).optional();const yF=["all","unread","watching"],vF=De(yF),u_=De(["participant","watching"]),bF=["active","archived","all"],sb=De(bF);ne({cursor:N().optional(),limit:Eh().int().min(1).max(200).default(50),filter:vF.default("all"),engagement:sb.default("active"),source:tb.optional()});const xF=ne({agentId:N(),displayName:N(),type:N(),avatarColorToken:N().nullable(),avatarImageUrl:N().nullable()}),wF=De(["tool_call","thinking","assistant_text"]),SF=ne({agentId:N(),kind:wF,label:N(),startedAt:N()}),kF=ne({chatId:N(),type:N(),membershipKind:u_,title:N(),topic:N().nullable(),participants:dt(xF),participantCount:Be().int(),lastMessageAt:N().nullable(),lastMessagePreview:N().nullable(),unreadMentionCount:Be().int(),canReply:Dn(),engagementStatus:nb,engagedAgentIds:dt(N()),liveActivity:SF.nullable()});ne({rows:dt(kF),nextCursor:N().nullable()});ne({participantIds:dt(N().min(1)).min(1),topic:N().trim().max(500).optional().nullable()});ne({participantIds:dt(N().min(1)).min(1)});ne({chatId:N(),lastReadAt:N(),unreadMentionCount:Be().int()});ne({chatId:N(),unreadMentionCount:Be().int()});ne({chatId:N(),membershipKind:u_.nullable()});ne({type:Ut("chat:message"),chatId:N()});const jF=ne({chatCount:Be().int().nonnegative(),unreadChatCount:Be().int().nonnegative()});ne({engagement:sb.default("active")});ne({counts:B6(tb,jF)});const CF=ne({type:Ut("workspace"),chatId:N().trim().min(1),agentId:N().trim().min(1),basePath:N().trim().optional(),path:N().trim().min(1)}),EF=ne({basePath:N().trim().min(1)});ne({agentId:N().trim().min(1),basePath:N().trim().optional(),path:N().trim().min(1)});ne({ref:CF,path:N(),content:N()});De(["connect","create_agent","completed"]);ne({id:N(),name:N(),displayName:N(),role:De(["admin","member"])});ne({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/),displayName:N().min(1).max(200)});ne({dismissed:Dn().optional()});const NF=De(["team_renamed","agent_created","tree_chat_started","tree_intro_dismissed"]);ne({event:NF,attrs:mn(N(),jh([N(),Be(),Dn(),R6()])).optional()});ne({id:N(),organizationId:N(),organizationName:N(),role:De(["admin","member"]),agentId:N(),orgHasOtherMembers:Dn()});const _F={ADMIN:"admin",MEMBER:"member"},lb=De(["admin","member"]),TF=ne({id:N(),userId:N(),organizationId:N(),agentId:N(),role:lb,createdAt:N()});ne({username:N().min(1).max(100),displayName:N().min(1).max(200),role:lb.default("member")});ne({role:lb.optional(),displayName:N().min(1).max(200).optional()});TF.extend({username:N(),displayName:N(),password:N()});const AF=ne({kind:Ut("github-app-installation"),installationId:Be().int(),organizationId:N().min(1)}),RF=["mentioned","review_requested","assigned"],OF=De(RF),MF=["opened","edited","closed","merged","reopened","commented","review_requested","reviewed","review_comment","synchronized","commit_commented","assigned","other"],d_=De(MF),DF=ne({type:eb,repo:N().min(1),key:N().min(1),title:N().optional(),url:N().optional()}),zF=ne({githubLogin:N().min(1),isBot:Dn()}),IF=ne({githubLogin:N().min(1),reason:OF}),LF=ne({title:N(),body:N(),url:N()}),PF=ne({type:Ut("issue"),key:N().min(1)});ne({source:AF,deliveryId:N().nullable(),rawEventType:N().min(1),rawAction:N().nullable(),entity:DF,actor:zF,kind:d_,involves:dt(IF),surface:LF,relatedRefs:dt(PF)});const UF=["mentioned","review_requested","assigned","subscribed"],BF=De(UF);ne({type:Ut("github_event"),reason:BF,event:N().min(1),action:N().nullable(),kind:d_,repository:N(),sender:N(),title:N(),body:N(),url:N(),entity:ne({type:eb,key:N().min(1),url:N().nullable()}),mentionedUser:N().optional()});const FF=De(["agent_error","agent_blocked","agent_stale"]),f_=De(["high","medium","low"]);ne({id:N(),organizationId:N(),type:FF,severity:f_,agentId:N().nullable(),chatId:N().nullable(),message:N(),read:Dn(),createdAt:N()});ne({limit:Eh().int().min(1).max(100).default(20),cursor:N().optional(),severity:f_.optional(),read:De(["true","false"]).transform(e=>e==="true").optional(),agentId:N().optional()});ne({next:N().max(256).optional()});ne({code:N().min(1),state:N().min(1),installation_id:N().regex(/^\d+$/).optional(),setup_action:De(["install","update","request"]).optional()});ne({githubId:N().min(1),login:N().min(1),email:N().email().optional(),displayName:N().optional(),next:N().max(256).optional(),installationId:N().regex(/^\d+$/).optional(),installationAccountType:De(["User","Organization"]).optional(),installationAccountLogin:N().min(1).optional(),installationAccountGithubId:N().regex(/^\d+$/).optional()});const $F=/^(?:[A-Za-z0-9_.-]+@)?[A-Za-z0-9.-]+:(?!\d+(?:\/|$))[^/:@\s][^:@\s]*$/;function HF(e){return e.includes("://")?!1:$F.test(e)}const Th=N().min(1).superRefine((e,t)=>{if(HF(e))return;let n;try{n=new URL(e)}catch{t.addIssue({code:hs.custom,message:"Repo URL must be HTTPS, SSH (ssh://...), or scp-like (git@host:path)."});return}if(n.protocol!=="https:"&&n.protocol!=="ssh:"){t.addIssue({code:hs.custom,message:"Repo URL must use HTTPS or SSH."});return}if(n.password.length>0){t.addIssue({code:hs.custom,message:"Repo URL must not include credentials."});return}if(n.protocol==="https:"&&n.username.length>0){t.addIssue({code:hs.custom,message:"Repo URL must not include credentials."});return}}),qF=ne({repo:Th.optional(),branch:N().default("main")}),ZF=ne({repo:Th.nullish(),branch:N().min(1).nullish()}),GF=ne({repo:N().optional(),branch:N().optional()}),VF=ne({repos:dt(ne({url:Th,defaultBranch:N().optional()})).default([])}),QF=ne({repos:dt(ne({url:Th,defaultBranch:N().min(1).optional()})).optional()}),KF=ne({repos:dt(ne({url:N(),defaultBranch:N().optional()}))}),YF={context_tree:{storage:qF,input:ZF,output:GF,readPolicy:"member"},source_repos:{storage:VF,input:QF,output:KF,readPolicy:"member"}},XF=Object.keys(YF);De(XF);const h_=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;ne({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!h_.test(e),"Name must not be a UUID format"),displayName:N().min(1).max(200),maxAgents:Be().int().min(0).default(0),maxMessagesPerMinute:Be().int().min(0).default(0),features:mn(N(),sn()).default({})});ne({name:N().min(2).max(50).regex(/^[a-z0-9][a-z0-9-]*$/,"Must start with a letter or digit and contain only lowercase alphanumeric and hyphens").refine(e=>!h_.test(e),"Name must not be a UUID format").optional(),displayName:N().min(1).max(200).optional(),maxAgents:Be().int().min(0).optional(),maxMessagesPerMinute:Be().int().min(0).optional(),features:mn(N(),sn()).optional()});ne({id:N(),name:N(),displayName:N(),maxAgents:Be(),maxMessagesPerMinute:Be(),features:mn(N(),sn()),createdAt:N(),updatedAt:N()});const WF=ne({workingCount:Be().int().nonnegative(),errorMask:Dn()}),JF=ne({type:Ut("pulse:tick"),organizationId:N(),agents:mn(N(),dt(WF).length(32))}),e9=ne({label:N().min(1),description:N(),preview:N().nullable().optional()}),t9=ne({question:N().min(1),header:N().min(1).max(24),options:dt(e9).min(2).max(4),multiSelect:Dn()}),n9=De(["html","markdown"]).nullable(),r9=ne({correlationId:N().min(1),questions:dt(t9).min(1).max(4),previewFormat:n9,allowFreeText:Dn()}),a9=ne({correlationId:N().min(1),answers:mn(N().min(1),N())});ne({answers:mn(N().min(1),N())});De(["pending","answered","superseded"]);const i9=De(["tool_call","error","assistant_text","thinking","turn_end","context_tree_usage"]),m_=ne({toolUseId:N(),name:N(),args:sn(),status:De(["pending","ok","error"]),durationMs:Be().int().nonnegative().optional(),resultPreview:N().max(400).optional()}),p_=ne({source:De(["sdk","runtime","tool"]),message:N().max(2e3)}),g_=ne({text:N().max(8e3)}),y_=ne({}),v_=ne({status:De(["success","error"])}),b_=ne({purpose:Ut("design_decision"),treeRepoUrl:N().nullable()}),s9=Ch("kind",[ne({kind:Ut("tool_call"),payload:m_}),ne({kind:Ut("error"),payload:p_}),ne({kind:Ut("assistant_text"),payload:g_}),ne({kind:Ut("thinking"),payload:y_}),ne({kind:Ut("turn_end"),payload:v_}),ne({kind:Ut("context_tree_usage"),payload:b_})]);ne({id:N(),agentId:N(),chatId:N(),seq:Be().int().positive(),kind:i9,payload:jh([m_,p_,g_,y_,v_,b_]),createdAt:N()});ne({agentId:N(),chatId:N(),event:s9});ne({type:Ut("session:reconcile"),agentId:N().min(1),chatIds:dt(N().min(1)).max(500)});ne({type:Ut("session:reconcile:result"),agentId:N().min(1),staleChatIds:dt(N().min(1))});const l9=ne({organizationId:N(),agentCount:Be(),chatCount:Be(),messageCount:Be()});ne({totalAgents:Be(),totalChats:Be(),totalMessages:Be(),byOrganization:dt(l9)});const o9=De(["active","suspended"]);ne({id:N(),username:N(),displayName:N(),avatarUrl:N().nullable(),status:o9,createdAt:N(),updatedAt:N()});ne({username:N().min(1).max(100),displayName:N().min(1).max(200),password:N().min(8).max(200)});ne({displayName:N().min(1).max(200).optional(),password:N().min(8).max(200).optional()});ne({type:Ut("auth"),token:N().min(1)});const c9=ne({wsInboxDeliver:Dn().default(!1)}).partial();ne({type:Ut("server:welcome"),serverCommandVersion:N().min(1),serverTimeMs:Be().int().nonnegative(),capabilities:c9.optional()}).passthrough();const x_=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));function u9(e){const t=Array.from({length:32},()=>({workingCount:0,errorMask:!1}));for(const n of Object.values(e))for(let a=0;a<32&&a<n.length;a++){const s=n[a],o=t[a];!s||!o||(o.workingCount+=s.workingCount,o.errorMask=o.errorMask||s.errorMask)}return t}const d9=2e3,f9=3e4;let ns=null,gu=!1,eu=0,tu=null;const Fy=new Set;let Fn=null,Zs=0;const nk=1e3;let gg=0,so=null;function yg(e){const t=Date.now(),n=t-gg;if(n>=nk){gg=t,e.invalidateQueries({queryKey:["me","chats"]});return}so===null&&(so=setTimeout(()=>{so=null,gg=Date.now(),Fn&&Fn.invalidateQueries({queryKey:["me","chats"]})},nk-n))}function rk(e){for(const t of Fy)try{t(e)}catch{}if(Fn){if(e.type==="notification")Fn.invalidateQueries({queryKey:["notifications"]});else if(e.type==="session:state")Fn.invalidateQueries({queryKey:["activity"]}),Fn.invalidateQueries({queryKey:["sessions"]}),yg(Fn);else if(e.type==="session:event")yg(Fn);else if(e.type==="chat:message"){const t=typeof e.chatId=="string"?e.chatId:null;yg(Fn),t&&(Fn.invalidateQueries({queryKey:["chat-messages",t]}),Fn.invalidateQueries({queryKey:["chat-detail",t]}))}}}function ob(){const e=Iu();if(!(e!=null&&e.accessToken))return;let t=null;try{t=localStorage.getItem("first-tree-hub:selectedOrganizationId")}catch{t=null}if(!t)return;const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/orgs/${encodeURIComponent(t)}/ws/?token=${e.accessToken}`,s=new WebSocket(a);ns=s,s.onmessage=o=>{if(s===ns)try{const u=JSON.parse(o.data);rk(u)}catch{}},s.onopen=()=>{if(s!==ns)return;const o=eu>0;eu=0,Fn&&(Fn.invalidateQueries({queryKey:["notifications"]}),Fn.invalidateQueries({queryKey:["activity"]}),Fn.invalidateQueries({queryKey:["sessions"]}),Fn.invalidateQueries({queryKey:["me","chats"]}),Fn.invalidateQueries({queryKey:["chat-detail"]})),o&&rk({type:"ws:reconnect"})},s.onclose=o=>{if(s===ns&&(ns=null,!(gu||Zs===0))){if(o.code===4001){MM().then(u=>{gu||Zs===0||(u?(eu=0,ob()):ak())});return}ak()}}}function ak(){eu++;const e=Math.min(d9*2**(eu-1),f9);tu=setTimeout(()=>{tu=null,!gu&&Zs>0&&ob()},e)}function h9(){gu=!0,tu&&(clearTimeout(tu),tu=null),so&&(clearTimeout(so),so=null),ns&&(ns.close(1e3,"unmount"),ns=null)}function cb(e){const{onMessage:t,enabled:n=!0}=e??{},a=vn(),s=b.useRef(t);s.current=t,b.useEffect(()=>{Fn=a},[a]),b.useEffect(()=>{if(!n)return;const o=u=>{var f;return(f=s.current)==null?void 0:f.call(s,u)};return Fy.add(o),Zs++,Zs===1&&(gu=!1,ob()),()=>{Fy.delete(o),Zs--,Zs===0&&h9()}},[n])}const m9=b.createContext({aggregated:x_,agents:{},receivedAtMs:null,stale:!0});function p9({children:e}){const[t,n]=b.useState({aggregated:x_,agents:{},receivedAtMs:null}),[a,s]=b.useState(()=>Date.now());cb({onMessage:u=>{const f=JF.safeParse(u);f.success&&n({aggregated:u9(f.data.agents),agents:f.data.agents,receivedAtMs:Date.now()})}}),b.useEffect(()=>{const u=setInterval(()=>s(Date.now()),1e4);return()=>clearInterval(u)},[]);const o=b.useMemo(()=>({...t,stale:t.receivedAtMs===null||a-t.receivedAtMs>3e4}),[t,a]);return l.jsx(m9.Provider,{value:o,children:e})}function yu(e){return Ce.get(`/agents/${e}/config`)}function Ah(e,t){return Ce.patch(`/agents/${e}/config`,t)}function g9(e,t){return Ce.post(`/agents/${e}/config/dry-run`,{payload:t})}function y9(e){return Ce.get(`/agents/${e}/client-status`)}function v9({className:e,style:t,...n}){return l.jsx("div",{className:Oe("flex items-center text-body",e),style:{gap:6,color:"var(--fg-3)",...t},...n})}function b9({onClick:e,children:t}){return l.jsx("button",{type:"button",onClick:e,className:"bg-transparent border-0 p-0 cursor-pointer",style:{color:"var(--fg-3)",textDecoration:"none",font:"inherit"},onMouseEnter:n=>{n.currentTarget.style.color="var(--fg)"},onMouseLeave:n=>{n.currentTarget.style.color="var(--fg-3)"},children:t})}function x9(){return l.jsx("span",{style:{color:"var(--fg-4)"},children:"/"})}function w9({children:e,mono:t}){return l.jsx("span",{className:Oe("font-medium",t&&"mono"),style:{color:"var(--fg)"},children:e})}const S9={neutral:{bg:"var(--bg-sunken)",fg:"var(--fg-2)",bd:"var(--border)"},accent:{bg:"var(--accent-bg)",fg:"var(--accent-dim)",bd:"color-mix(in oklch, var(--accent) 30%, transparent)"},warn:{bg:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},error:{bg:"color-mix(in oklch, var(--state-error) 14%, transparent)",fg:"var(--state-error)",bd:"color-mix(in oklch, var(--state-error) 30%, transparent)"},outline:{bg:"transparent",fg:"var(--fg-3)",bd:"var(--border)"},idle:{bg:"color-mix(in oklch, var(--state-idle) 14%, transparent)",fg:"var(--state-idle)",bd:"color-mix(in oklch, var(--state-idle) 30%, transparent)"},working:{bg:"color-mix(in oklch, var(--state-working) 14%, transparent)",fg:"var(--state-working)",bd:"color-mix(in oklch, var(--state-working) 30%, transparent)"},blocked:{bg:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",fg:"color-mix(in oklch, var(--state-blocked) 50%, var(--fg))",bd:"color-mix(in oklch, var(--state-blocked) 30%, transparent)"},offline:{bg:"color-mix(in oklch, var(--state-offline) 14%, transparent)",fg:"var(--state-offline)",bd:"color-mix(in oklch, var(--state-offline) 30%, transparent)"}};function hr({tone:e="neutral",className:t,style:n,...a}){const s=S9[e],o={background:s.bg,color:s.fg,border:`var(--hairline) solid ${s.bd}`,...n};return l.jsx("span",{className:Oe("mono inline-flex items-center uppercase text-caption leading-[1.6]",t),style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",...o},...a})}function $y({children:e,right:t,className:n,style:a,...s}){return l.jsxs("div",{className:Oe("mono flex items-center justify-between uppercase text-eyebrow",n),style:{padding:"var(--sp-1_75) var(--sp-3_5)",color:"var(--fg-4)",background:"var(--bg-raised)",borderBottom:"var(--hairline) solid var(--border-faint)",...a},...s,children:[l.jsx("span",{children:e}),t]})}function ub({className:e,style:t,...n}){return l.jsx("span",{className:Oe("mono uppercase text-caption",e),style:{color:"var(--fg-3)",...t},...n})}function nu({state:e,size:t=8,className:n}){const a={width:t,height:t,display:"inline-block",position:"relative",flexShrink:0};return e==="working"?l.jsxs("span",{className:Oe("shrink-0",n),style:a,role:"img","aria-label":"working",children:[l.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--state-working)"}}),l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--state-working)",animation:"ring-pulse 1.8s infinite",opacity:.6}})]}):e==="blocked"?l.jsx("span",{className:Oe("shrink-0",n),style:{...a,border:"var(--hairline-bold) dashed var(--state-blocked)",borderRadius:"50%",animation:"dash-spin 4s linear infinite"},role:"img","aria-label":"blocked",children:l.jsx("span",{style:{position:"absolute",inset:2,borderRadius:"50%",background:"var(--state-blocked)"}})}):e==="error"?l.jsx("span",{className:Oe("shrink-0",n),style:{...a,background:"var(--state-error)",clipPath:"polygon(50% 0%, 100% 100%, 0% 100%)",borderRadius:1},role:"img","aria-label":"error"}):e==="idle"?l.jsx("span",{className:Oe("shrink-0",n),style:{...a,borderRadius:"50%",background:"var(--state-idle)"},role:"img","aria-label":"idle"}):l.jsx("span",{className:Oe("shrink-0",n),style:{...a,borderRadius:"50%",border:"var(--hairline) solid var(--state-offline)",background:"transparent"},role:"img","aria-label":"offline"})}function k9(e){return e==="idle"||e==="working"||e==="blocked"||e==="error"||e==="offline"}function vu({state:e,className:t}){const n=e!==null&&k9(e)?e:"offline",a=n==="offline"?"var(--fg-3)":`var(--state-${n})`;return l.jsxs("span",{className:Oe("mono inline-flex items-center gap-1.5 uppercase text-caption",t),style:{color:a},children:[l.jsx(nu,{state:n,size:7}),n]})}function jf({label:e,value:t,accent:n}){return l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",cursor:"default"},children:[l.jsx("div",{className:"mono uppercase text-eyebrow",style:{color:"var(--fg-4)"},children:e}),l.jsx("div",{className:"mono text-subtitle font-semibold",style:{color:n??"var(--fg)",marginTop:"var(--sp-px)"},children:t})]})}function j9(e,t,n){return e?n==="admin"||!!t&&e.managerId===t:!1}function C9(e){var t;return e.agentStatus!=="active"?{disabled:!0,title:"Only active agents can be tested."}:e.clientStatusLoading?{disabled:!0,title:"Checking the bound computer before testing."}:(t=e.clientStatus)!=null&&t.clientId?e.clientStatus.online?e.testPending?{disabled:!0,title:"Test in progress."}:{disabled:!1,title:"Send a test message to verify this agent can respond."}:{disabled:!0,title:"The bound computer is offline."}:{disabled:!0,title:"Bind a computer before testing this agent."}}function ik(e){return e.status==="connected"}var E9="Label",w_=b.forwardRef((e,t)=>l.jsx(vi.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));w_.displayName=E9;var N9=w_;const mt=b.forwardRef(({className:e,...t},n)=>l.jsx(N9,{ref:n,className:Oe("text-label leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));mt.displayName="Label";const Xn=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:Oe("overflow-hidden",e),style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",...t},...n}));Xn.displayName="Panel";const za=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:Oe("flex items-center justify-between gap-3",e),style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));za.displayName="PanelHeader";const Ia=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:Oe("inline-flex items-center gap-2 text-body font-semibold",e),style:{color:"var(--fg)",...t},...n}));Ia.displayName="PanelTitle";const Vr=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("div",{ref:a,className:Oe(e),style:{padding:"var(--sp-3) var(--sp-3_5)",...t},...n}));Vr.displayName="PanelBody";const Cf=256,_9="image/png,image/jpeg,image/webp";function T9(e){var t;return((t=e.trim()[0])==null?void 0:t.toUpperCase())??"?"}function Hy({agent:e,size:t}){return e.avatarImageUrl?l.jsx("img",{src:e.avatarImageUrl,alt:e.displayName,width:t,height:t,style:{width:t,height:t,borderRadius:"50%",objectFit:"cover",display:"block"}}):l.jsx("span",{"aria-hidden":"true",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:t,height:t,borderRadius:"50%",background:$u(e.avatarColorToken,e.uuid),color:"var(--fg-on-vivid)",fontSize:Math.round(t*.42),fontWeight:700,lineHeight:1,letterSpacing:"-0.02em",userSelect:"none"},children:T9(e.displayName)})}function A9({agent:e,canEdit:t=!0,onSave:n,onRefresh:a}){const[s,o]=b.useState(!1),u=typeof e.avatarColorToken=="string"&&e.avatarColorToken.length>0?e.avatarColorToken:"auto";return l.jsxs(Xn,{children:[l.jsxs(za,{children:[l.jsx(Ia,{children:"Appearance"}),t&&e.status==="active"&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>o(!0),children:[l.jsx(hh,{className:"h-3 w-3"})," Edit"]})]}),l.jsx(Vr,{className:"text-body",children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(Hy,{agent:e,size:48}),l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsx("span",{className:"text-body",children:"Color"}),l.jsx("span",{className:"mono text-caption text-muted-foreground",children:u})]}),l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsx("span",{className:"text-body",children:"Image"}),l.jsx("span",{className:"mono text-caption text-muted-foreground",children:e.avatarImageUrl?"custom":"none"})]})]})]})}),t&&l.jsx(O9,{agent:e,open:s,onOpenChange:o,onSave:n,onRefresh:a})]})}async function R9(e){const t=URL.createObjectURL(e);try{const n=await new Promise((h,p)=>{const g=new Image;g.onload=()=>h(g),g.onerror=()=>p(new Error("Unable to decode the selected image.")),g.src=t}),a=Math.min(n.naturalWidth,n.naturalHeight),s=Math.max(0,Math.round((n.naturalWidth-a)/2)),o=Math.max(0,Math.round((n.naturalHeight-a)/2)),u=document.createElement("canvas");u.width=Cf,u.height=Cf;const f=u.getContext("2d");if(!f)throw new Error("Canvas 2D context is unavailable in this browser.");f.drawImage(n,s,o,a,a,0,0,Cf,Cf);const m=await new Promise(h=>u.toBlob(p=>h(p),"image/webp",.85));if(!m)throw new Error("Failed to encode resized image to WEBP.");return m}finally{URL.revokeObjectURL(t)}}function O9({agent:e,open:t,onOpenChange:n,onSave:a,onRefresh:s}){const o=Ly.find(D=>D===e.avatarColorToken)??null,[u,f]=b.useState(o),[m,h]=b.useState(!1),[p,g]=b.useState(!1),[w,x]=b.useState(null),k=b.useRef(null);b.useEffect(()=>{t&&(f(o),x(null))},[t,o]);async function C(D){D.preventDefault(),x(null),h(!0);try{await a({avatarColorToken:u}),n(!1)}catch(z){x(z instanceof Error?z.message:String(z))}finally{h(!1)}}async function j(D){var R;const z=(R=D.target.files)==null?void 0:R[0];if(k.current&&(k.current.value=""),!!z){x(null),g(!0);try{const F=await R9(z);await E4(e.uuid,F),await(s==null?void 0:s())}catch(F){x(F instanceof Error?F.message:String(F))}finally{g(!1)}}}async function E(){x(null),g(!0);try{await N4(e.uuid),await(s==null?void 0:s())}catch(D){x(D instanceof Error?D.message:String(D))}finally{g(!1)}}const O={...e,avatarColorToken:u},A=!!e.avatarImageUrl;return l.jsx(_n,{open:t,onOpenChange:n,children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsx(Tn,{children:"Edit Appearance"})}),l.jsxs("form",{onSubmit:C,className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx(Hy,{agent:O,size:64}),l.jsx(Hy,{agent:O,size:32}),l.jsx("span",{className:"text-caption text-muted-foreground",children:"Preview at 64 / 32 px"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Image"}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("input",{ref:k,type:"file",accept:_9,onChange:j,style:{display:"none"}}),l.jsx(xe,{type:"button",variant:"outline",size:"sm",onClick:()=>{var D;return(D=k.current)==null?void 0:D.click()},disabled:p||m,children:p?"Uploading…":A?"Replace image":"Upload image"}),A&&l.jsx(xe,{type:"button",variant:"ghost",size:"sm",onClick:E,disabled:p||m,children:"Remove image"})]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"PNG / JPEG / WEBP. The browser crops to a square and resizes to 256 × 256 WEBP before upload. An image takes precedence over the color below."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Color"}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(sk,{label:"Auto",selected:u===null,onClick:()=>f(null),background:$u(null,e.uuid),isAuto:!0}),Ly.map(D=>l.jsx(sk,{label:D,selected:u===D,onClick:()=>f(D),background:`var(--avatar-${D})`},D))]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:`"Auto" falls back to a hash of the agent's id, matching the legacy default. The color is used as the background under the initial when no image is set.`})]}),w&&l.jsx("p",{className:"text-body text-destructive",children:w}),l.jsxs(ir,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:m||p,children:"Cancel"}),l.jsx(xe,{type:"submit",disabled:m||p,children:m?"Saving…":"Save"})]})]})]})})}function sk({label:e,selected:t,onClick:n,background:a,isAuto:s}){return l.jsx("button",{type:"button",onClick:n,"aria-pressed":t,title:e,style:{position:"relative",width:32,height:32,borderRadius:"50%",background:a,border:t?"var(--hairline-bold) solid var(--fg)":"var(--hairline) solid var(--border)",cursor:"pointer",padding:0,outline:"none",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:s&&l.jsx("span",{"aria-hidden":!0,style:{position:"absolute",inset:4,borderRadius:"50%",background:"var(--bg-raised)",color:"var(--fg-3)",fontSize:10,fontWeight:600,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:"A"})})}function M9({runtimeLabel:e,computerLabel:t,visible:n=!0}){return n?l.jsx("div",{className:"sticky z-20 flex items-center justify-between gap-3 backdrop-blur",style:{top:0,padding:"var(--sp-1_75) var(--sp-5)",background:"color-mix(in oklch, var(--bg-raised) 94%, transparent)",borderBottom:"var(--hairline) solid var(--border-faint)"},children:l.jsxs("div",{className:"mono text-caption flex items-center gap-2",style:{color:"var(--fg-3)"},children:[l.jsxs("span",{children:["Runs on ",l.jsx("span",{style:{color:"var(--fg-2)"},children:e})]}),t&&l.jsxs(l.Fragment,{children:[l.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"@"}),l.jsx("span",{style:{color:"var(--fg-2)"},children:t})]})]})}):null}function D9(e){const{agent:t}=e,[n,a]=b.useState(!1),[s,o]=b.useState(!1),u=t.displayName||t.name||t.uuid,f=t.status==="suspended";return l.jsxs("section",{id:"ad-danger",style:{background:"color-mix(in oklch, var(--state-error) 6%, var(--bg-raised))",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-panel)"},children:[l.jsxs("header",{className:"flex items-center gap-2",style:{padding:"var(--sp-2_5) var(--sp-3_5)"},children:[l.jsx(Lu,{className:"h-3.5 w-3.5",style:{color:"var(--state-error)"}}),l.jsx("h3",{className:"text-body font-semibold",style:{color:"var(--state-error)"},children:"Danger zone"})]}),l.jsxs("div",{children:[t.status==="active"?l.jsx(vg,{title:"Suspend agent",body:"Pause all active sessions. You can reactivate later; tokens stay revoked until then.",action:l.jsx(xe,{variant:"outline",size:"xs",onClick:()=>o(!0),disabled:e.suspendPending,children:e.suspendPending?"Suspending…":"Suspend"})}):l.jsx(vg,{title:"Reactivate agent",body:"Resume sessions. Tokens must be recreated — they are not restored.",action:l.jsx(xe,{variant:"outline",size:"xs",onClick:e.onReactivate,disabled:e.reactivatePending,children:e.reactivatePending?"Reactivating…":"Reactivate"})}),l.jsx(vg,{title:"Delete agent",body:f?"Permanent. Configuration, bindings, tokens, and session history are all dropped.":"Suspend this agent before deleting it.",action:l.jsxs(xe,{variant:"destructive",size:"xs",onClick:()=>{f&&a(!0)},disabled:e.deletePending||!f,title:f?void 0:"Suspend this agent before deleting it",children:[l.jsx(Gf,{className:"h-3 w-3"}),"Delete"]})})]}),e.errorMessage&&l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderTop:"var(--hairline) solid color-mix(in oklch, var(--state-error) 14%, transparent)",color:"var(--state-error)"},children:e.errorMessage}),l.jsx(z9,{open:s,onOpenChange:o,label:u,onConfirm:()=>{o(!1),e.onSuspend()},pending:e.suspendPending}),l.jsx(I9,{open:n,onOpenChange:a,expected:u,onDelete:()=>{a(!1),e.onDelete()},deleting:e.deletePending})]})}function vg(e){return l.jsxs("div",{className:"flex items-start justify-between gap-4 text-body",style:{padding:"var(--sp-2_5) var(--sp-3_5)",borderTop:"var(--hairline) solid color-mix(in oklch, var(--state-error) 14%, transparent)"},children:[l.jsxs("div",{children:[l.jsx("p",{className:"font-medium",style:{color:"var(--fg)"},children:e.title}),l.jsx("p",{className:"text-label font-normal",style:{color:"var(--fg-3)"},children:e.body})]}),l.jsx("div",{children:e.action})]})}function z9({open:e,onOpenChange:t,label:n,onConfirm:a,pending:s}){return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsxs(Tn,{children:['Suspend "',n,'"?']})}),l.jsx("div",{className:"space-y-3",children:l.jsx("p",{className:"text-body",style:{color:"var(--fg-2)"},children:"Runtime binds and HTTP calls will be refused while the agent is suspended. Active sessions end on their next message. You can reactivate later from this same page."})}),l.jsxs(ir,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(xe,{type:"button",variant:"destructive",onClick:a,disabled:s,children:s?"Suspending…":"Suspend"})]})]})})}function I9({open:e,onOpenChange:t,expected:n,onDelete:a,deleting:s}){const[o,u]=b.useState("");function f(m){m.preventDefault(),o===n&&a()}return l.jsx(_n,{open:e,onOpenChange:m=>{t(m),m||u("")},children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsxs(Tn,{children:['Delete "',n,'"?']})}),l.jsxs("form",{onSubmit:f,className:"space-y-4",children:[l.jsxs("p",{className:"text-body text-muted-foreground",children:["This action cannot be undone. Type ",l.jsx("span",{className:"font-mono font-medium text-foreground",children:n})," ","to confirm."]}),l.jsx(Kt,{value:o,onChange:m=>u(m.target.value),autoFocus:!0,placeholder:n,className:"font-mono"}),l.jsxs(ir,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>t(!1),disabled:s,children:"Cancel"}),l.jsx(xe,{type:"submit",variant:"destructive",disabled:o!==n||s,children:s?"Deleting…":"Delete"})]})]})]})})}const L9={unchanged:{label:"",tone:""},added:{label:"new",tone:"bg-success-soft text-success"},modified:{label:"changed",tone:"bg-warn-soft text-warn"},deleted:{label:"will be removed on save",tone:"bg-error-soft text-error"}};function db({status:e,onEdit:t,onDelete:n,onUndo:a,children:s,disabled:o}){const u=L9[e],f=e==="deleted";return l.jsxs("div",{className:Oe("flex items-center gap-2 rounded border px-3 py-2 text-body",f?"bg-error-soft border-error text-error line-through decoration-error":"bg-card"),children:[l.jsx("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:s}),u.label&&l.jsx("span",{className:Oe("text-caption rounded px-1.5 py-0.5 whitespace-nowrap",u.tone),children:u.label}),!o&&(f?l.jsxs(xe,{size:"sm",variant:"ghost",onClick:a,children:[l.jsx(e3,{className:"h-3.5 w-3.5 mr-1"}),"Undo"]}):l.jsxs("div",{className:"flex gap-1 shrink-0",children:[l.jsxs(xe,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:t,title:"Edit",children:[l.jsx(hh,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Edit"})]}),l.jsxs(xe,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:n,title:"Delete",children:[l.jsx(Gf,{className:"h-3.5 w-3.5"}),l.jsx("span",{className:"sr-only",children:"Delete"})]})]}))]})}function P9(e){var f;const[t,n]=b.useState(null),[a,s]=b.useState(()=>new Set),o=m=>s(h=>{const p=new Set(h);return p.has(m)?p.delete(m):p.add(m),p}),u=e.items.filter(m=>m.status!=="deleted").length;return l.jsxs(Xn,{children:[l.jsxs(za,{children:[l.jsxs(Ia,{children:["Environment variables (",u,")"]}),!e.disabled&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(Sa,{className:"h-3 w-3"})," Add"]})]}),l.jsx(Vr,{className:"space-y-2",children:e.items.length===0?l.jsx("p",{className:"text-body text-muted-foreground",children:"No environment variables."}):e.items.map(m=>{const h=m.value.sensitive,p=m.value.value===pu,g=h&&!p&&!!m.value.value,w=a.has(m.key);let x;return h?g&&w?x=m.value.value:x="••••••":x=m.value.value||l.jsx("em",{children:"(empty)"}),l.jsxs(db,{status:m.status,onEdit:()=>n({mode:"edit",key:m.key,initial:m.value}),onDelete:()=>e.onDelete(m.key),onUndo:()=>e.onUndoDelete(m.key),disabled:e.disabled,children:[l.jsx("span",{className:"font-mono font-medium",children:m.value.key}),l.jsx("span",{className:"font-mono text-caption text-muted-foreground truncate max-w-xs",children:x}),h&&l.jsx(fh,{className:"h-3 w-3 text-muted-foreground","aria-hidden":!0}),h&&l.jsx("button",{type:"button",onClick:()=>g&&o(m.key),className:"bg-transparent border-0 cursor-pointer inline-flex items-center text-muted-foreground",title:g?w?"Hide value":"Reveal value":"Saved sensitive values can't be revealed. Edit to set a new value.","aria-label":w?"Hide value":"Reveal value",disabled:!g,style:{padding:0,opacity:g?1:.4},children:w?l.jsx(ED,{className:"h-3.5 w-3.5"}):l.jsx(ZC,{className:"h-3.5 w-3.5"})})]},m.key)})}),t&&l.jsx(F9,{open:!!t,onOpenChange:m=>!m&&n(null),initial:t.mode==="edit"?t.initial:null,allowKeepExisting:t.mode==="edit"&&U9(t.initial,(f=e.items.find(m=>m.key===t.key))==null?void 0:f.status),forbiddenKeys:e.otherKeys(t.mode==="edit"?t.key:null),onSubmit:m=>{t.mode==="edit"?e.onUpdate(t.key,m):e.onAdd(m),n(null)}})]})}function U9(e,t){return e.sensitive&&e.value===pu&&t!==void 0&&t!=="added"}function lk(e,t){return!e||t?"":e.value}function B9(e){return e.sensitive&&e.allowKeepExisting&&!e.value?{ok:!0,value:pu}:e.sensitive&&!e.value?{ok:!1,error:"Value is required for sensitive entries."}:{ok:!0,value:e.value}}function F9({open:e,onOpenChange:t,initial:n,allowKeepExisting:a,forbiddenKeys:s,onSubmit:o}){const[u,f]=b.useState((n==null?void 0:n.key)??""),[m,h]=b.useState(lk(n,a)),[p,g]=b.useState((n==null?void 0:n.sensitive)??!1),[w,x]=b.useState(null);b.useEffect(()=>{e&&(f((n==null?void 0:n.key)??""),h(lk(n,a)),g((n==null?void 0:n.sensitive)??!1),x(null))},[e,n,a]);function k(C){if(C.preventDefault(),!u.match(/^[A-Z][A-Z0-9_]*$/)){x("Key must match /^[A-Z][A-Z0-9_]*$/.");return}if(s.has(u)){x(`Another entry already uses key "${u}".`);return}const j=B9({value:m,sensitive:p,allowKeepExisting:a});if(!j.ok){x(j.error);return}if(!p&&!n&&!m){x("Value is required for non-sensitive entries.");return}o({key:u,value:j.value,sensitive:p})}return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsx(Tn,{children:n?"Edit environment variable":"Add environment variable"})}),l.jsxs("form",{onSubmit:k,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"env-key",children:"Key"}),l.jsx(Kt,{id:"env-key",value:u,onChange:C=>f(C.target.value.toUpperCase()),placeholder:"OPENAI_API_KEY",className:"font-mono",disabled:!!n}),n&&l.jsx("p",{className:"text-caption text-muted-foreground",children:"Key can't be renamed — delete and re-add."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"env-value",children:"Value"}),l.jsx(Kt,{id:"env-value",type:p?"password":"text",autoComplete:"new-password",value:m,onChange:C=>h(C.target.value),placeholder:a?"Leave empty to keep existing value":p?"new secret":"value",className:"font-mono"})]}),l.jsxs("label",{className:"flex items-center gap-2 text-body",children:[l.jsx("input",{type:"checkbox",checked:p,onChange:C=>g(C.target.checked),className:"h-4 w-4",disabled:!!n&&n.sensitive}),"Mark as sensitive (encrypted at rest, never displayed again)"]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Sensitive values cannot be viewed after saving. If you need to verify, save a new value."}),w&&l.jsx("p",{className:"text-body text-destructive",children:w}),l.jsxs(ir,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(xe,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function $9(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(Xn,{children:[l.jsxs(za,{children:[l.jsxs(Ia,{children:["Git repositories (",a,")"]}),!e.disabled&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(Sa,{className:"h-3 w-3"})," Add"]})]}),l.jsx(Vr,{className:"space-y-2",children:e.items.length===0?l.jsx("p",{className:"text-body text-muted-foreground",children:"No Git repositories."}):e.items.map(s=>{const o=s.value.localPath??eh(s.value.url);return l.jsxs(db,{status:s.status,onEdit:()=>n({mode:"edit",key:s.key,initial:s.value}),onDelete:()=>e.onDelete(s.key),onUndo:()=>e.onUndoDelete(s.key),disabled:e.disabled,children:[l.jsx("span",{className:"font-mono text-caption",children:s.value.url}),s.value.ref&&l.jsxs("span",{className:"text-caption text-muted-foreground",children:["@ ",s.value.ref]}),l.jsxs("span",{className:"text-caption text-muted-foreground",children:["→ ",o||"./"]})]},s.key)})}),t&&l.jsx(H9,{open:!!t,onOpenChange:s=>!s&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenPaths:e.otherPaths(t.mode==="edit"?t.key:null),onSubmit:s=>{t.mode==="edit"?e.onUpdate(t.key,s):e.onAdd(s),n(null)}})]})}function H9({open:e,onOpenChange:t,initial:n,forbiddenPaths:a,onSubmit:s}){const[o,u]=b.useState((n==null?void 0:n.url)??""),[f,m]=b.useState((n==null?void 0:n.ref)??""),[h,p]=b.useState((n==null?void 0:n.localPath)??""),[g,w]=b.useState(null);b.useEffect(()=>{e&&(u((n==null?void 0:n.url)??""),m((n==null?void 0:n.ref)??""),p((n==null?void 0:n.localPath)??""),w(null))},[e,n]);function x(k){k.preventDefault();const C=o.trim();if(!C){w("URL is required.");return}const j=h.trim()||eh(C);if(j&&a.has(j)){w(`Another repo already occupies local path "${j}".`);return}const E={url:C,...f.trim()?{ref:f.trim()}:{},...h.trim()?{localPath:h.trim()}:{}};s(E)}return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsx(Tn,{children:n?"Edit Git repository":"Add Git repository"})}),l.jsxs("form",{onSubmit:x,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"git-url",children:"URL"}),l.jsx(Kt,{id:"git-url",value:o,onChange:k=>u(k.target.value),placeholder:"git@github.com:org/repo.git",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"git-ref",children:"Ref (branch / tag / sha, optional)"}),l.jsx(Kt,{id:"git-ref",value:f,onChange:k=>m(k.target.value),placeholder:"main",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"git-path",children:"Local path (optional)"}),l.jsx(Kt,{id:"git-path",value:h,onChange:k=>p(k.target.value),placeholder:eh(o)||"repo-name",className:"font-mono"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Relative to the session working directory. Leave empty to derive from the URL."})]}),g&&l.jsx("p",{className:"text-body text-destructive",children:g}),l.jsxs(ir,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(xe,{type:"submit",children:n?"Done":"Add"})]})]})]})})}function S_({name:e,displayName:t,variant:n="inline",tone:a="neutral",emptyLabel:s="—",className:o,style:u,title:f}){const m=typeof e=="string"&&e.length>0,h=typeof t=="string"&&t.length>0;if(!m&&!h)return l.jsx("span",{className:Oe("mono text-label",o),style:{color:"var(--fg-4)",...u},title:f,children:s});const p=f??(m&&h?`${t} (@${e})`:h?t:`@${e}`),g=a==="accent"?"var(--accent-dim)":void 0,w=a==="accent"?"var(--accent-dim)":"var(--fg-3)";return n==="stacked"?l.jsxs("span",{className:Oe("inline-flex flex-col leading-tight",o),style:{gap:1,...u},title:p??void 0,children:[h&&l.jsx("span",{className:"text-body",style:{color:g},children:t}),m&&l.jsxs("span",{className:"mono text-caption",style:{color:w},children:["@",e]})]}):l.jsxs("span",{className:Oe("inline-flex items-baseline gap-1.5",o),style:u,title:p??void 0,children:[h&&l.jsx("span",{style:{color:g},children:t}),m&&l.jsxs("span",{className:"mono text-caption",style:{color:w},children:["@",e]})]})}function fb(){return Ce.get(hn("/members"))}function q9(e,t){return Ce.patch(hn(`/members/${encodeURIComponent(e)}`),t)}function Z9(e){return Ce.delete(hn(`/members/${encodeURIComponent(e)}`))}function k_(){const{data:e}=We({queryKey:["members","name-map"],queryFn:fb,staleTime:3e4});return b.useMemo(()=>{const t=new Map;if(e)for(const n of e)t.set(n.id,n.displayName||n.username);return n=>n?t.get(n)??n:"—"},[e])}function G9({agent:e,canEdit:t=!0,onSave:n}){const[a,s]=b.useState(!1),o=Hv(),u=k_(),f=e.metadata,m=f==null?void 0:f.tree,h=typeof(m==null?void 0:m.role)=="string"?m.role:null,p=Array.isArray(m==null?void 0:m.domains)?(m==null?void 0:m.domains).filter(x=>typeof x=="string"):[],g=e.managerId?u(e.managerId):null,w=e.delegateMention?o(e.delegateMention):null;return l.jsxs(Xn,{children:[l.jsxs(za,{children:[l.jsx(Ia,{children:"Profile"}),t&&e.status==="active"&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>s(!0),children:[l.jsx(hh,{className:"h-3 w-3"})," Edit"]})]}),l.jsxs(Vr,{className:"text-body space-y-1",children:[l.jsxs("div",{children:[l.jsx("span",{className:"font-semibold",children:e.displayName}),e.name&&l.jsxs("span",{className:"ml-2 font-mono text-caption text-muted-foreground",children:["@",e.name]}),w&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"mx-2 text-muted-foreground",children:"·"}),l.jsxs("span",{className:"text-muted-foreground",children:["delegate ",l.jsx(S_,{name:w.name,displayName:w.displayName})]})]})]}),l.jsxs("div",{className:"text-caption text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-1",children:[l.jsxs("span",{children:["owner ",l.jsx("span",{className:"text-foreground",children:g??"—"})]}),h&&l.jsxs("span",{children:["role ",l.jsx("span",{className:"text-foreground",children:h})]}),l.jsxs("span",{children:["type ",l.jsx(hr,{tone:e.type==="autonomous_agent"?"accent":"neutral",children:e.type})]}),l.jsxs("span",{children:["visibility"," ",l.jsx(hr,{tone:e.visibility==="organization"?"accent":"outline",children:e.visibility})]}),p.length>0&&l.jsxs("span",{children:["domains"," ",l.jsx("span",{className:"inline-flex flex-wrap gap-1 align-middle",children:p.map(x=>l.jsx(hr,{tone:"outline",children:x},x))})]})]})]}),t&&l.jsx(V9,{agent:e,open:a,onOpenChange:s,onSave:n})]})}function V9({agent:e,open:t,onOpenChange:n,onSave:a}){var D;const{memberId:s,role:o}=ut(),[u,f]=b.useState(e.displayName),[m,h]=b.useState(e.delegateMention??""),[p,g]=b.useState(e.visibility),[w,x]=b.useState(!1),[k,C]=b.useState(null);b.useEffect(()=>{t&&(f(e.displayName),h(e.delegateMention??""),g(e.visibility),C(null))},[t,e]);const j=e.type==="human",E=o==="admin"||e.managerId===s,O=We({queryKey:["agents-for-delegate"],queryFn:async()=>(await Bu({limit:100})).items.filter(R=>R.type==="personal_assistant"&&R.status==="active"),enabled:t&&j});async function A(z){z.preventDefault(),C(null);const R=u.trim();if(!R){C("Display name is required.");return}x(!0);try{const F={displayName:R,delegateMention:m||null};p!==e.visibility&&(F.visibility=p),await a(F),n(!1)}catch(F){C(F instanceof Error?F.message:String(F))}finally{x(!1)}}return l.jsx(_n,{open:t,onOpenChange:n,children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsx(Tn,{children:"Edit Identity"})}),l.jsxs("form",{onSubmit:A,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Agent name"}),l.jsx(Kt,{value:e.name?`@${e.name}`:"",disabled:!0,className:"font-mono"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Agent name is permanent after creation — used in @mentions and CLI commands."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"id-display",children:"Display Name"}),l.jsx(Kt,{id:"id-display",value:u,onChange:z=>f(z.target.value),placeholder:"How teammates see this agent",maxLength:200})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"id-visibility",children:"Visibility"}),l.jsxs("select",{id:"id-visibility",value:p,onChange:z=>g(z.target.value),disabled:!E,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[l.jsx("option",{value:tk.PRIVATE,children:"Private — only the manager"}),l.jsx("option",{value:tk.ORGANIZATION,children:"Organization — all members"})]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:E?"Private agents are only visible to their manager; organization agents appear in every member's list.":"Only the manager or an admin can change this agent's visibility."})]}),j&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"id-delegate",children:"Delegate Mention"}),l.jsxs("select",{id:"id-delegate",value:m,onChange:z=>h(z.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"",children:"None"}),(D=O.data)==null?void 0:D.map(z=>l.jsx("option",{value:z.uuid,children:z.displayName?`${z.displayName} (@${z.name??z.uuid})`:z.name?`@${z.name}`:z.uuid},z.uuid))]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Assistant that acts on behalf of this agent."})]}),k&&l.jsx("p",{className:"text-body text-destructive",children:k}),l.jsxs(ir,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>n(!1),disabled:w,children:"Cancel"}),l.jsx(xe,{type:"submit",disabled:w,children:w?"Saving…":"Save"})]})]})]})})}function Q9(e){return e==="working"?"accent":e==="error"?"error":"outline"}function K9(e){const[t,n]=b.useState(null),a=e.items.filter(s=>s.status!=="deleted").length;return l.jsxs(Xn,{children:[l.jsxs(za,{children:[l.jsxs(Ia,{children:["MCP servers (",a,")"]}),!e.disabled&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>n({mode:"add"}),children:[l.jsx(Sa,{className:"h-3 w-3"})," Add"]})]}),l.jsx(Vr,{className:"space-y-2",children:e.items.length===0?l.jsx("p",{className:"text-body text-muted-foreground",children:"No MCP servers. Add one to extend the agent's tools."}):e.items.map(s=>{const o=e.toolHealth?s.status==="deleted"?"unknown":e.toolHealth(s.value.name):null;return l.jsxs(db,{status:s.status,onEdit:()=>n({mode:"edit",key:s.key,initial:s.value}),onDelete:()=>e.onDelete(s.key),onUndo:()=>e.onUndoDelete(s.key),disabled:e.disabled,children:[l.jsx("span",{className:"text-caption rounded bg-muted px-1.5 py-0.5 font-mono",children:s.value.transport}),l.jsx("span",{className:"font-medium font-mono",children:s.value.name}),o&&l.jsx(hr,{tone:Q9(o),children:o}),l.jsx("span",{className:"text-caption text-muted-foreground truncate",children:Y9(s.value)})]},s.key)})}),t&&l.jsx(J9,{open:!!t,onOpenChange:s=>!s&&n(null),initial:t.mode==="edit"?t.initial:null,forbiddenNames:e.otherNames(t.mode==="edit"?t.key:null),onSubmit:s=>{t.mode==="edit"?e.onUpdate(t.key,s):e.onAdd(s),n(null)}})]})}function Y9(e){var t;if(e.transport==="stdio"){const n=(t=e.args)!=null&&t.length?` ${e.args.map(a=>/[\s"']/.test(a)?JSON.stringify(a):a).join(" ")}`:"";return`${e.command}${n}`}return e.url}function ok(e){return e!=null&&e.length?JSON.stringify(e,null,2):""}function X9(e){const t=e.trim();if(!t)return{ok:!0,value:void 0};let n;try{n=JSON.parse(t)}catch{return{ok:!1,error:"Args must be a JSON array of strings."}}return!Array.isArray(n)||n.some(a=>typeof a!="string")?{ok:!1,error:"Args must be a JSON array of strings."}:{ok:!0,value:n}}function ck(e){return e&&Object.keys(e).length>0?JSON.stringify(e,null,2):""}function W9(e){const t=e.trim();if(!t)return{ok:!0,value:void 0};let n;try{n=JSON.parse(t)}catch{return{ok:!1,error:"Headers must be a JSON object with string values."}}if(!n||typeof n!="object"||Array.isArray(n))return{ok:!1,error:"Headers must be a JSON object with string values."};const a=Object.entries(n);return a.some(([s,o])=>!s||typeof o!="string")?{ok:!1,error:"Headers must be a JSON object with string values."}:{ok:!0,value:a.length>0?Object.fromEntries(a):void 0}}function J9({open:e,onOpenChange:t,initial:n,forbiddenNames:a,onSubmit:s}){const[o,u]=b.useState((n==null?void 0:n.transport)??"stdio"),[f,m]=b.useState((n==null?void 0:n.name)??""),[h,p]=b.useState((n==null?void 0:n.transport)==="stdio"?n.command:""),[g,w]=b.useState(ok((n==null?void 0:n.transport)==="stdio"?n.args:void 0)),[x,k]=b.useState(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),[C,j]=b.useState(ck(n&&(n.transport==="http"||n.transport==="sse")?n.headers:void 0)),[E,O]=b.useState(null);b.useEffect(()=>{e&&(u((n==null?void 0:n.transport)??"stdio"),m((n==null?void 0:n.name)??""),p((n==null?void 0:n.transport)==="stdio"?n.command:""),w(ok((n==null?void 0:n.transport)==="stdio"?n.args:void 0)),k(n&&(n.transport==="http"||n.transport==="sse")?n.url:""),j(ck(n&&(n.transport==="http"||n.transport==="sse")?n.headers:void 0)),O(null))},[e,n]);function A(D){if(D.preventDefault(),!f.match(/^[a-z0-9][a-z0-9_-]{0,63}$/i)){O("Name must start alphanumeric and contain only a-z0-9_-.");return}if(a.has(f.toLowerCase())){O(`Another MCP server is already named "${f}".`);return}let z;if(o==="stdio"){if(!h.trim()){O("stdio transport requires a command.");return}const R=X9(g);if(!R.ok){O(R.error);return}z={name:f,transport:"stdio",command:h.trim(),...R.value?{args:R.value}:{}}}else{const R=x.trim();try{new URL(R)}catch{O("URL is not valid.");return}const F=W9(C);if(!F.ok){O(F.error);return}z={name:f,transport:o,url:R,...F.value?{headers:F.value}:{}}}s(z)}return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsx(Tn,{children:n?"Edit MCP server":"Add MCP server"})}),l.jsxs("form",{onSubmit:A,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"mcp-transport",children:"Transport"}),l.jsxs("select",{id:"mcp-transport",value:o,onChange:D=>u(D.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"stdio",children:"stdio (local subprocess)"}),l.jsx("option",{value:"http",children:"http"}),l.jsx("option",{value:"sse",children:"sse"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"mcp-name",children:"Name"}),l.jsx(Kt,{id:"mcp-name",value:f,onChange:D=>m(D.target.value),placeholder:"playwright",className:"font-mono"})]}),o==="stdio"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"mcp-command",children:"Command"}),l.jsx(Kt,{id:"mcp-command",value:h,onChange:D=>p(D.target.value),placeholder:"/usr/local/bin/playwright-mcp",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"mcp-args",children:"Args (JSON array, optional)"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"Each arg as a separate JSON string. Use this when an arg contains spaces or quotes."}),l.jsx("textarea",{id:"mcp-args",value:g,onChange:D=>w(D.target.value),placeholder:'["--port", "3000"]',className:"flex min-h-24 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-2 text-body font-mono shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"})]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"mcp-url",children:"URL"}),l.jsx(Kt,{id:"mcp-url",value:x,onChange:D=>k(D.target.value),placeholder:"https://internal.api/mcp",className:"font-mono"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"mcp-headers",children:"Headers (JSON object, optional)"}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"JSON object of request headers, for example auth headers required by the MCP server."}),l.jsx("textarea",{id:"mcp-headers",value:C,onChange:D=>j(D.target.value),placeholder:'{"Authorization": "Bearer ..."}',className:"flex min-h-24 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-2 text-body font-mono shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"})]})]}),E&&l.jsx("p",{className:"text-body text-destructive",children:E}),l.jsxs(ir,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),l.jsx(xe,{type:"submit",children:n?"Done":"Add"})]})]})]})})}const e$=[{value:"opus",label:"opus",hint:"most capable"},{value:"sonnet",label:"sonnet",hint:"balanced"},{value:"haiku",label:"haiku",hint:"fastest"}],t$=[{value:"gpt-5.5",label:"gpt-5.5",hint:"latest"},{value:"gpt-5.4",label:"gpt-5.4"},{value:"gpt-5.4-mini",label:"gpt-5.4-mini",hint:"fastest"},{value:"gpt-5.3-codex",label:"gpt-5.3-codex",hint:"coding-specialized"},{value:"gpt-5.2",label:"gpt-5.2"}],n$={"claude-code":e$,codex:t$},r$={"claude-code":"Choose which Claude model powers this agent. Aliases (opus / sonnet / haiku) follow the CLI's latest-in-family mapping and may shift across releases. Applies to new sessions immediately; active sessions switch on their next message. Unset falls back to the operator's local ~/.claude/settings.json model preference, then the CLI default.",codex:"Pick a Codex model. Slugs come from the Codex CLI bundled with @openai/codex-sdk; ChatGPT-account auth currently only accepts gpt-5.5, while API-key auth accepts the wider set. Applies to new sessions immediately; active sessions switch on their next message. Unset lets the codex CLI choose a model that matches the user's auth mode."},a$={value:"",label:"(unset — inherits local)"};function i$({value:e,baseline:t,onChange:n,onRevert:a,disabled:s,provider:o="claude-code"}){const u=e!==t,f=n$[o],m=b.useMemo(()=>{const h=[a$,...f];return e!==""&&!f.some(p=>p.value===e)&&h.push({value:e,label:e,hint:"custom"}),h},[f,e]);return l.jsxs(Xn,{style:{borderColor:u?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(za,{children:[l.jsxs(Ia,{children:["Model",u&&l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",color:"color-mix(in oklch, var(--state-blocked) 60%, var(--fg))"},children:"changed"})]}),u&&l.jsx(xe,{size:"xs",variant:"ghost",onClick:a,disabled:s,children:"Revert"})]}),l.jsxs(Vr,{className:"space-y-2",children:[l.jsx(s$,{items:m,value:e,onChange:n,disabled:s}),l.jsx("p",{className:"text-caption text-muted-foreground",children:r$[o]})]})]})}function s$({items:e,value:t,onChange:n,disabled:a}){const[s,o]=b.useState(!1),[u,f]=b.useState(null),m=b.useRef(null),h=b.useRef(null),p=e.find(w=>w.value===t)??e[0],g=b.useCallback(()=>{const w=m.current;if(!w)return;const x=w.getBoundingClientRect();f({top:x.bottom+4,left:x.left,width:x.width})},[]);return b.useLayoutEffect(()=>{s&&g()},[s,g]),b.useEffect(()=>{if(!s)return;const w=C=>{var E,O;const j=C.target;(E=m.current)!=null&&E.contains(j)||(O=h.current)!=null&&O.contains(j)||o(!1)},x=C=>{var j;C.key==="Escape"&&(o(!1),(j=m.current)==null||j.focus())},k=()=>g();return document.addEventListener("pointerdown",w),document.addEventListener("keydown",x),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{document.removeEventListener("pointerdown",w),document.removeEventListener("keydown",x),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[s,g]),l.jsxs("div",{className:"max-w-md",children:[l.jsxs("button",{ref:m,type:"button",disabled:a,onClick:()=>o(w=>!w),className:"mono flex h-9 w-full items-center justify-between rounded-[var(--radius-input)] border border-input bg-transparent pl-3 pr-2 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50 hover:border-ring transition-colors cursor-pointer","aria-haspopup":"listbox","aria-expanded":s,children:[l.jsx("span",{className:"truncate",style:{color:(p==null?void 0:p.value)===""?"var(--fg-3)":void 0},children:(p==null?void 0:p.label)??t}),l.jsx(Tv,{className:"ml-2 h-3.5 w-3.5 transition-transform",style:{color:"var(--fg-3)",transform:s?"rotate(180deg)":void 0}})]}),s&&u&&Iv.createPortal(l.jsx("div",{ref:h,className:"fixed z-50 overflow-hidden rounded-[var(--radius-input)] py-1",style:{top:u.top,left:u.left,width:u.width,background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",boxShadow:"var(--shadow-md)",maxHeight:280,overflowY:"auto"},children:e.map(w=>{const x=w.value===t;return l.jsxs("button",{type:"button",onClick:()=>{n(w.value),o(!1)},className:"mono flex w-full items-center gap-2 cursor-pointer px-3 py-1.5 text-body text-left hover:bg-accent/40 transition-colors focus-visible:outline-none focus-visible:bg-accent/40",style:{background:x?"var(--bg-hover)":void 0,color:w.value===""?"var(--fg-3)":void 0},children:[l.jsx(mr,{className:"h-3.5 w-3.5 flex-shrink-0",style:{visibility:x?"visible":"hidden",color:"var(--state-idle)"}}),l.jsx("span",{className:"flex-1 truncate",children:w.label}),w.hint&&l.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:w.hint})]},w.value||"__unset")})}),document.body)]})}function l$(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const o$=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,c$=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,u$={};function uk(e,t){return(u$.jsx?c$:o$).test(e)}const d$=/[ \t\n\f\r]/g;function f$(e){return typeof e=="object"?e.type==="text"?dk(e.value):!1:dk(e)}function dk(e){return e.replace(d$,"")===""}class qu{constructor(t,n,a){this.normal=n,this.property=t,a&&(this.space=a)}}qu.prototype.normal={};qu.prototype.property={};qu.prototype.space=void 0;function j_(e,t){const n={},a={};for(const s of e)Object.assign(n,s.property),Object.assign(a,s.normal);return new qu(n,a,t)}function qy(e){return e.toLowerCase()}class Dr{constructor(t,n){this.attribute=n,this.property=t}}Dr.prototype.attribute="";Dr.prototype.booleanish=!1;Dr.prototype.boolean=!1;Dr.prototype.commaOrSpaceSeparated=!1;Dr.prototype.commaSeparated=!1;Dr.prototype.defined=!1;Dr.prototype.mustUseProperty=!1;Dr.prototype.number=!1;Dr.prototype.overloadedBoolean=!1;Dr.prototype.property="";Dr.prototype.spaceSeparated=!1;Dr.prototype.space=void 0;let h$=0;const it=cl(),Cn=cl(),Zy=cl(),ke=cl(),Zt=cl(),lo=cl(),$r=cl();function cl(){return 2**++h$}const Gy=Object.freeze(Object.defineProperty({__proto__:null,boolean:it,booleanish:Cn,commaOrSpaceSeparated:$r,commaSeparated:lo,number:ke,overloadedBoolean:Zy,spaceSeparated:Zt},Symbol.toStringTag,{value:"Module"})),bg=Object.keys(Gy);class hb extends Dr{constructor(t,n,a,s){let o=-1;if(super(t,n),fk(this,"space",s),typeof a=="number")for(;++o<bg.length;){const u=bg[o];fk(this,bg[o],(a&Gy[u])===Gy[u])}}}hb.prototype.defined=!0;function fk(e,t,n){n&&(e[t]=n)}function Do(e){const t={},n={};for(const[a,s]of Object.entries(e.properties)){const o=new hb(a,e.transform(e.attributes||{},a),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(a)&&(o.mustUseProperty=!0),t[a]=o,n[qy(a)]=a,n[qy(o.attribute)]=a}return new qu(t,n,e.space)}const C_=Do({properties:{ariaActiveDescendant:null,ariaAtomic:Cn,ariaAutoComplete:null,ariaBusy:Cn,ariaChecked:Cn,ariaColCount:ke,ariaColIndex:ke,ariaColSpan:ke,ariaControls:Zt,ariaCurrent:null,ariaDescribedBy:Zt,ariaDetails:null,ariaDisabled:Cn,ariaDropEffect:Zt,ariaErrorMessage:null,ariaExpanded:Cn,ariaFlowTo:Zt,ariaGrabbed:Cn,ariaHasPopup:null,ariaHidden:Cn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Zt,ariaLevel:ke,ariaLive:null,ariaModal:Cn,ariaMultiLine:Cn,ariaMultiSelectable:Cn,ariaOrientation:null,ariaOwns:Zt,ariaPlaceholder:null,ariaPosInSet:ke,ariaPressed:Cn,ariaReadOnly:Cn,ariaRelevant:null,ariaRequired:Cn,ariaRoleDescription:Zt,ariaRowCount:ke,ariaRowIndex:ke,ariaRowSpan:ke,ariaSelected:Cn,ariaSetSize:ke,ariaSort:null,ariaValueMax:ke,ariaValueMin:ke,ariaValueNow:ke,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function E_(e,t){return t in e?e[t]:t}function N_(e,t){return E_(e,t.toLowerCase())}const m$=Do({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:lo,acceptCharset:Zt,accessKey:Zt,action:null,allow:null,allowFullScreen:it,allowPaymentRequest:it,allowUserMedia:it,alt:null,as:null,async:it,autoCapitalize:null,autoComplete:Zt,autoFocus:it,autoPlay:it,blocking:Zt,capture:null,charSet:null,checked:it,cite:null,className:Zt,cols:ke,colSpan:null,content:null,contentEditable:Cn,controls:it,controlsList:Zt,coords:ke|lo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:it,defer:it,dir:null,dirName:null,disabled:it,download:Zy,draggable:Cn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:it,formTarget:null,headers:Zt,height:ke,hidden:Zy,high:ke,href:null,hrefLang:null,htmlFor:Zt,httpEquiv:Zt,id:null,imageSizes:null,imageSrcSet:null,inert:it,inputMode:null,integrity:null,is:null,isMap:it,itemId:null,itemProp:Zt,itemRef:Zt,itemScope:it,itemType:Zt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:it,low:ke,manifest:null,max:null,maxLength:ke,media:null,method:null,min:null,minLength:ke,multiple:it,muted:it,name:null,nonce:null,noModule:it,noValidate:it,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:it,optimum:ke,pattern:null,ping:Zt,placeholder:null,playsInline:it,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:it,referrerPolicy:null,rel:Zt,required:it,reversed:it,rows:ke,rowSpan:ke,sandbox:Zt,scope:null,scoped:it,seamless:it,selected:it,shadowRootClonable:it,shadowRootDelegatesFocus:it,shadowRootMode:null,shape:null,size:ke,sizes:null,slot:null,span:ke,spellCheck:Cn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ke,step:null,style:null,tabIndex:ke,target:null,title:null,translate:null,type:null,typeMustMatch:it,useMap:null,value:Cn,width:ke,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Zt,axis:null,background:null,bgColor:null,border:ke,borderColor:null,bottomMargin:ke,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:it,declare:it,event:null,face:null,frame:null,frameBorder:null,hSpace:ke,leftMargin:ke,link:null,longDesc:null,lowSrc:null,marginHeight:ke,marginWidth:ke,noResize:it,noHref:it,noShade:it,noWrap:it,object:null,profile:null,prompt:null,rev:null,rightMargin:ke,rules:null,scheme:null,scrolling:Cn,standby:null,summary:null,text:null,topMargin:ke,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ke,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:it,disableRemotePlayback:it,prefix:null,property:null,results:ke,security:null,unselectable:null},space:"html",transform:N_}),p$=Do({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:$r,accentHeight:ke,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ke,amplitude:ke,arabicForm:null,ascent:ke,attributeName:null,attributeType:null,azimuth:ke,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ke,by:null,calcMode:null,capHeight:ke,className:Zt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ke,diffuseConstant:ke,direction:null,display:null,dur:null,divisor:ke,dominantBaseline:null,download:it,dx:null,dy:null,edgeMode:null,editable:null,elevation:ke,enableBackground:null,end:null,event:null,exponent:ke,externalResourcesRequired:null,fill:null,fillOpacity:ke,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:lo,g2:lo,glyphName:lo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ke,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ke,horizOriginX:ke,horizOriginY:ke,id:null,ideographic:ke,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ke,k:ke,k1:ke,k2:ke,k3:ke,k4:ke,kernelMatrix:$r,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ke,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ke,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ke,overlineThickness:ke,paintOrder:null,panose1:null,path:null,pathLength:ke,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Zt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ke,pointsAtY:ke,pointsAtZ:ke,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:$r,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:$r,rev:$r,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:$r,requiredFeatures:$r,requiredFonts:$r,requiredFormats:$r,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ke,specularExponent:ke,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ke,strikethroughThickness:ke,string:null,stroke:null,strokeDashArray:$r,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ke,strokeOpacity:ke,strokeWidth:null,style:null,surfaceScale:ke,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:$r,tabIndex:ke,tableValues:null,target:null,targetX:ke,targetY:ke,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:$r,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ke,underlineThickness:ke,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ke,values:null,vAlphabetic:ke,vMathematical:ke,vectorEffect:null,vHanging:ke,vIdeographic:ke,version:null,vertAdvY:ke,vertOriginX:ke,vertOriginY:ke,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ke,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:E_}),__=Do({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),T_=Do({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:N_}),A_=Do({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),g$={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},y$=/[A-Z]/g,hk=/-[a-z]/g,v$=/^data[-\w.:]+$/i;function b$(e,t){const n=qy(t);let a=t,s=Dr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&v$.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(hk,w$);a="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!hk.test(o)){let u=o.replace(y$,x$);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}s=hb}return new s(a,t)}function x$(e){return"-"+e.toLowerCase()}function w$(e){return e.charAt(1).toUpperCase()}const S$=j_([C_,m$,__,T_,A_],"html"),mb=j_([C_,p$,__,T_,A_],"svg");function k$(e){return e.join(" ").trim()}var Gl={},xg,mk;function j$(){if(mk)return xg;mk=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,o=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
383
|
-
`,h="/",p="*",g="",w="comment",x="declaration";function k(j,E){if(typeof j!="string")throw new TypeError("First argument must be a string");if(!j)return[];E=E||{};var O=1,A=1;function D(Y){var X=Y.match(t);X&&(O+=X.length);var G=Y.lastIndexOf(m);A=~G?Y.length-G:A+Y.length}function z(){var Y={line:O,column:A};return function(X){return X.position=new R(Y),ee(),X}}function R(Y){this.start=Y,this.end={line:O,column:A},this.source=E.source}R.prototype.content=j;function F(Y){var X=new Error(E.source+":"+O+":"+A+": "+Y);if(X.reason=Y,X.filename=E.source,X.line=O,X.column=A,X.source=j,!E.silent)throw X}function B(Y){var X=Y.exec(j);if(X){var G=X[0];return D(G),j=j.slice(G.length),X}}function ee(){B(n)}function L(Y){var X;for(Y=Y||[];X=I();)X!==!1&&Y.push(X);return Y}function I(){var Y=z();if(!(h!=j.charAt(0)||p!=j.charAt(1))){for(var X=2;g!=j.charAt(X)&&(p!=j.charAt(X)||h!=j.charAt(X+1));)++X;if(X+=2,g===j.charAt(X-1))return F("End of comment missing");var G=j.slice(2,X-2);return A+=2,D(G),j=j.slice(X),A+=2,Y({type:w,comment:G})}}function Q(){var Y=z(),X=B(a);if(X){if(I(),!B(s))return F("property missing ':'");var G=B(o),se=Y({type:x,property:C(X[0].replace(e,g)),value:G?C(G[0].replace(e,g)):g});return B(u),se}}function te(){var Y=[];L(Y);for(var X;X=Q();)X!==!1&&(Y.push(X),L(Y));return Y}return ee(),te()}function C(j){return j?j.replace(f,g):g}return xg=k,xg}var pk;function C$(){if(pk)return Gl;pk=1;var e=Gl&&Gl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Gl,"__esModule",{value:!0}),Gl.default=n;const t=e(j$());function n(a,s){let o=null;if(!a||typeof a!="string")return o;const u=(0,t.default)(a),f=typeof s=="function";return u.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:p}=m;f?s(h,p,m):p&&(o=o||{},o[h]=p)}),o}return Gl}var Bc={},gk;function E$(){if(gk)return Bc;gk=1,Object.defineProperty(Bc,"__esModule",{value:!0}),Bc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,o=function(h){return!h||n.test(h)||e.test(h)},u=function(h,p){return p.toUpperCase()},f=function(h,p){return"".concat(p,"-")},m=function(h,p){return p===void 0&&(p={}),o(h)?h:(h=h.toLowerCase(),p.reactCompat?h=h.replace(s,f):h=h.replace(a,f),h.replace(t,u))};return Bc.camelCase=m,Bc}var Fc,yk;function N$(){if(yk)return Fc;yk=1;var e=Fc&&Fc.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(C$()),n=E$();function a(s,o){var u={};return!s||typeof s!="string"||(0,t.default)(s,function(f,m){f&&m&&(u[(0,n.camelCase)(f,o)]=m)}),u}return a.default=a,Fc=a,Fc}var _$=N$();const T$=oh(_$),R_=O_("end"),pb=O_("start");function O_(e){return t;function t(n){const a=n&&n.position&&n.position[e]||{};if(typeof a.line=="number"&&a.line>0&&typeof a.column=="number"&&a.column>0)return{line:a.line,column:a.column,offset:typeof a.offset=="number"&&a.offset>-1?a.offset:void 0}}}function A$(e){const t=pb(e),n=R_(e);if(t&&n)return{start:t,end:n}}function ru(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?vk(e.position):"start"in e||"end"in e?vk(e):"line"in e||"column"in e?Vy(e):""}function Vy(e){return bk(e&&e.line)+":"+bk(e&&e.column)}function vk(e){return Vy(e&&e.start)+"-"+Vy(e&&e.end)}function bk(e){return e&&typeof e=="number"?e:1}class sr extends Error{constructor(t,n,a){super(),typeof n=="string"&&(a=n,n=void 0);let s="",o={},u=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?s=t:!o.cause&&t&&(u=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof a=="string"){const m=a.indexOf(":");m===-1?o.ruleId=a:(o.source=a.slice(0,m),o.ruleId=a.slice(m+1))}if(!o.place&&o.ancestors&&o.ancestors){const m=o.ancestors[o.ancestors.length-1];m&&(o.place=m.position)}const f=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=f?f.line:void 0,this.name=ru(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=u&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}sr.prototype.file="";sr.prototype.name="";sr.prototype.reason="";sr.prototype.message="";sr.prototype.stack="";sr.prototype.column=void 0;sr.prototype.line=void 0;sr.prototype.ancestors=void 0;sr.prototype.cause=void 0;sr.prototype.fatal=void 0;sr.prototype.place=void 0;sr.prototype.ruleId=void 0;sr.prototype.source=void 0;const gb={}.hasOwnProperty,R$=new Map,O$=/[A-Z]/g,M$=new Set(["table","tbody","thead","tfoot","tr"]),D$=new Set(["td","th"]),M_="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function z$(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let a;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");a=H$(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");a=$$(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:a,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?mb:S$,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=D_(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function D_(e,t,n){if(t.type==="element")return I$(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return L$(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return U$(e,t,n);if(t.type==="mdxjsEsm")return P$(e,t);if(t.type==="root")return B$(e,t,n);if(t.type==="text")return F$(e,t)}function I$(e,t,n){const a=e.schema;let s=a;t.tagName.toLowerCase()==="svg"&&a.space==="html"&&(s=mb,e.schema=s),e.ancestors.push(t);const o=I_(e,t.tagName,!1),u=q$(e,t);let f=vb(e,t);return M$.has(t.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!f$(m):!0})),z_(e,u,o,t),yb(u,f),e.ancestors.pop(),e.schema=a,e.create(t,o,u,n)}function L$(e,t){if(t.data&&t.data.estree&&e.evaluater){const a=t.data.estree.body[0];return a.type,e.evaluater.evaluateExpression(a.expression)}bu(e,t.position)}function P$(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);bu(e,t.position)}function U$(e,t,n){const a=e.schema;let s=a;t.name==="svg"&&a.space==="html"&&(s=mb,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:I_(e,t.name,!0),u=Z$(e,t),f=vb(e,t);return z_(e,u,o,t),yb(u,f),e.ancestors.pop(),e.schema=a,e.create(t,o,u,n)}function B$(e,t,n){const a={};return yb(a,vb(e,t)),e.create(t,e.Fragment,a,n)}function F$(e,t){return t.value}function z_(e,t,n,a){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=a)}function yb(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function $$(e,t,n){return a;function a(s,o,u,f){const h=Array.isArray(u.children)?n:t;return f?h(o,u,f):h(o,u)}}function H$(e,t){return n;function n(a,s,o,u){const f=Array.isArray(o.children),m=pb(a);return t(s,o,u,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function q$(e,t){const n={};let a,s;for(s in t.properties)if(s!=="children"&&gb.call(t.properties,s)){const o=G$(e,s,t.properties[s]);if(o){const[u,f]=o;e.tableCellAlignToStyle&&u==="align"&&typeof f=="string"&&D$.has(t.tagName)?a=f:n[u]=f}}if(a){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=a}return n}function Z$(e,t){const n={};for(const a of t.attributes)if(a.type==="mdxJsxExpressionAttribute")if(a.data&&a.data.estree&&e.evaluater){const o=a.data.estree.body[0];o.type;const u=o.expression;u.type;const f=u.properties[0];f.type,Object.assign(n,e.evaluater.evaluateExpression(f.argument))}else bu(e,t.position);else{const s=a.name;let o;if(a.value&&typeof a.value=="object")if(a.value.data&&a.value.data.estree&&e.evaluater){const f=a.value.data.estree.body[0];f.type,o=e.evaluater.evaluateExpression(f.expression)}else bu(e,t.position);else o=a.value===null?!0:a.value;n[s]=o}return n}function vb(e,t){const n=[];let a=-1;const s=e.passKeys?new Map:R$;for(;++a<t.children.length;){const o=t.children[a];let u;if(e.passKeys){const m=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(m){const h=s.get(m)||0;u=m+"-"+h,s.set(m,h+1)}}const f=D_(e,o,u);f!==void 0&&n.push(f)}return n}function G$(e,t,n){const a=b$(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=a.commaSeparated?l$(n):k$(n)),a.property==="style"){let s=typeof n=="object"?n:V$(e,String(n));return e.stylePropertyNameCase==="css"&&(s=Q$(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&a.space?g$[a.property]||a.property:a.attribute,n]}}function V$(e,t){try{return T$(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const a=n,s=new sr("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:a,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=M_+"#cannot-parse-style-attribute",s}}function I_(e,t,n){let a;if(!n)a={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,u;for(;++o<s.length;){const f=uk(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};u=u?{type:"MemberExpression",object:u,property:f,computed:!!(o&&f.type==="Literal"),optional:!1}:f}a=u}else a=uk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(a.type==="Literal"){const s=a.value;return gb.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(a);bu(e)}function bu(e,t){const n=new sr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=M_+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Q$(e){const t={};let n;for(n in e)gb.call(e,n)&&(t[K$(n)]=e[n]);return t}function K$(e){let t=e.replace(O$,Y$);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Y$(e){return"-"+e.toLowerCase()}const wg={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},X$={};function bb(e,t){const n=X$,a=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return L_(e,a,s)}function L_(e,t,n){if(W$(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return xk(e.children,t,n)}return Array.isArray(e)?xk(e,t,n):""}function xk(e,t,n){const a=[];let s=-1;for(;++s<e.length;)a[s]=L_(e[s],t,n);return a.join("")}function W$(e){return!!(e&&typeof e=="object")}const wk=document.createElement("i");function xb(e){const t="&"+e+";";wk.innerHTML=t;const n=wk.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Zr(e,t,n,a){const s=e.length;let o=0,u;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,a.length<1e4)u=Array.from(a),u.unshift(t,n),e.splice(...u);else for(n&&e.splice(t,n);o<a.length;)u=a.slice(o,o+1e4),u.unshift(t,0),e.splice(...u),o+=1e4,t+=1e4}function ca(e,t){return e.length>0?(Zr(e,e.length,0,t),e):t}const Sk={}.hasOwnProperty;function P_(e){const t={};let n=-1;for(;++n<e.length;)J$(t,e[n]);return t}function J$(e,t){let n;for(n in t){const s=(Sk.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let u;if(o)for(u in o){Sk.call(s,u)||(s[u]=[]);const f=o[u];e8(s[u],Array.isArray(f)?f:f?[f]:[])}}}function e8(e,t){let n=-1;const a=[];for(;++n<t.length;)(t[n].add==="after"?e:a).push(t[n]);Zr(e,0,0,a)}function U_(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function wa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const fr=ks(/[A-Za-z]/),ar=ks(/[\dA-Za-z]/),t8=ks(/[#-'*+\--9=?A-Z^-~]/);function nh(e){return e!==null&&(e<32||e===127)}const Qy=ks(/\d/),n8=ks(/[\dA-Fa-f]/),r8=ks(/[!-/:-@[-`{-~]/);function Ze(e){return e!==null&&e<-2}function Ht(e){return e!==null&&(e<0||e===32)}function gt(e){return e===-2||e===-1||e===32}const Rh=ks(new RegExp("\\p{P}|\\p{S}","u")),al=ks(/\s/);function ks(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function zo(e){const t=[];let n=-1,a=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let u="";if(o===37&&ar(e.charCodeAt(n+1))&&ar(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(u=String.fromCharCode(o));else if(o>55295&&o<57344){const f=e.charCodeAt(n+1);o<56320&&f>56319&&f<57344?(u=String.fromCharCode(o,f),s=1):u="�"}else u=String.fromCharCode(o);u&&(t.push(e.slice(a,n),encodeURIComponent(u)),a=n+s+1,u=""),s&&(n+=s,s=0)}return t.join("")+e.slice(a)}function Et(e,t,n,a){const s=a?a-1:Number.POSITIVE_INFINITY;let o=0;return u;function u(m){return gt(m)?(e.enter(n),f(m)):t(m)}function f(m){return gt(m)&&o++<s?(e.consume(m),f):(e.exit(n),t(m))}}const a8={tokenize:i8};function i8(e){const t=e.attempt(this.parser.constructs.contentInitial,a,s);let n;return t;function a(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Et(e,t,"linePrefix")}function s(f){return e.enter("paragraph"),o(f)}function o(f){const m=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=m),n=m,u(f)}function u(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Ze(f)?(e.consume(f),e.exit("chunkText"),o):(e.consume(f),u)}}const s8={tokenize:l8},kk={tokenize:o8};function l8(e){const t=this,n=[];let a=0,s,o,u;return f;function f(A){if(a<n.length){const D=n[a];return t.containerState=D[1],e.attempt(D[0].continuation,m,h)(A)}return h(A)}function m(A){if(a++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&O();const D=t.events.length;let z=D,R;for(;z--;)if(t.events[z][0]==="exit"&&t.events[z][1].type==="chunkFlow"){R=t.events[z][1].end;break}E(a);let F=D;for(;F<t.events.length;)t.events[F][1].end={...R},F++;return Zr(t.events,z+1,0,t.events.slice(D)),t.events.length=F,h(A)}return f(A)}function h(A){if(a===n.length){if(!s)return w(A);if(s.currentConstruct&&s.currentConstruct.concrete)return k(A);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(kk,p,g)(A)}function p(A){return s&&O(),E(a),w(A)}function g(A){return t.parser.lazy[t.now().line]=a!==n.length,u=t.now().offset,k(A)}function w(A){return t.containerState={},e.attempt(kk,x,k)(A)}function x(A){return a++,n.push([t.currentConstruct,t.containerState]),w(A)}function k(A){if(A===null){s&&O(),E(0),e.consume(A);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),C(A)}function C(A){if(A===null){j(e.exit("chunkFlow"),!0),E(0),e.consume(A);return}return Ze(A)?(e.consume(A),j(e.exit("chunkFlow")),a=0,t.interrupt=void 0,f):(e.consume(A),C)}function j(A,D){const z=t.sliceStream(A);if(D&&z.push(null),A.previous=o,o&&(o.next=A),o=A,s.defineSkip(A.start),s.write(z),t.parser.lazy[A.start.line]){let R=s.events.length;for(;R--;)if(s.events[R][1].start.offset<u&&(!s.events[R][1].end||s.events[R][1].end.offset>u))return;const F=t.events.length;let B=F,ee,L;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){if(ee){L=t.events[B][1].end;break}ee=!0}for(E(a),R=F;R<t.events.length;)t.events[R][1].end={...L},R++;Zr(t.events,B+1,0,t.events.slice(F)),t.events.length=R}}function E(A){let D=n.length;for(;D-- >A;){const z=n[D];t.containerState=z[1],z[0].exit.call(t,e)}n.length=A}function O(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function o8(e,t,n){return Et(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Eo(e){if(e===null||Ht(e)||al(e))return 1;if(Rh(e))return 2}function Oh(e,t,n){const a=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!a.includes(o)&&(t=o(t,n),a.push(o))}return t}const Ky={name:"attention",resolveAll:c8,tokenize:u8};function c8(e,t){let n=-1,a,s,o,u,f,m,h,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(a=n;a--;)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;m=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[a][1].end},w={...e[n][1].start};jk(g,-m),jk(w,m),u={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[a][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:w},o={type:m>1?"strongText":"emphasisText",start:{...e[a][1].end},end:{...e[n][1].start}},s={type:m>1?"strong":"emphasis",start:{...u.start},end:{...f.end}},e[a][1].end={...u.start},e[n][1].start={...f.end},h=[],e[a][1].end.offset-e[a][1].start.offset&&(h=ca(h,[["enter",e[a][1],t],["exit",e[a][1],t]])),h=ca(h,[["enter",s,t],["enter",u,t],["exit",u,t],["enter",o,t]]),h=ca(h,Oh(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),h=ca(h,[["exit",o,t],["enter",f,t],["exit",f,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,h=ca(h,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,Zr(e,a-1,n-a+3,h),n=a+h.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function u8(e,t){const n=this.parser.constructs.attentionMarkers.null,a=this.previous,s=Eo(a);let o;return u;function u(m){return o=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===o)return e.consume(m),f;const h=e.exit("attentionSequence"),p=Eo(m),g=!p||p===2&&s||n.includes(m),w=!s||s===2&&p||n.includes(a);return h._open=!!(o===42?g:g&&(s||!w)),h._close=!!(o===42?w:w&&(p||!g)),t(m)}}function jk(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const d8={name:"autolink",tokenize:f8};function f8(e,t,n){let a=0;return s;function s(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),o}function o(x){return fr(x)?(e.consume(x),u):x===64?n(x):h(x)}function u(x){return x===43||x===45||x===46||ar(x)?(a=1,f(x)):h(x)}function f(x){return x===58?(e.consume(x),a=0,m):(x===43||x===45||x===46||ar(x))&&a++<32?(e.consume(x),f):(a=0,h(x))}function m(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):x===null||x===32||x===60||nh(x)?n(x):(e.consume(x),m)}function h(x){return x===64?(e.consume(x),p):t8(x)?(e.consume(x),h):n(x)}function p(x){return ar(x)?g(x):n(x)}function g(x){return x===46?(e.consume(x),a=0,p):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):w(x)}function w(x){if((x===45||ar(x))&&a++<63){const k=x===45?w:g;return e.consume(x),k}return n(x)}}const Zu={partial:!0,tokenize:h8};function h8(e,t,n){return a;function a(o){return gt(o)?Et(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||Ze(o)?t(o):n(o)}}const B_={continuation:{tokenize:p8},exit:g8,name:"blockQuote",tokenize:m8};function m8(e,t,n){const a=this;return s;function s(u){if(u===62){const f=a.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),o}return n(u)}function o(u){return gt(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function p8(e,t,n){const a=this;return s;function s(u){return gt(u)?Et(e,o,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):o(u)}function o(u){return e.attempt(B_,t,n)(u)}}function g8(e){e.exit("blockQuote")}const F_={name:"characterEscape",tokenize:y8};function y8(e,t,n){return a;function a(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),s}function s(o){return r8(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const $_={name:"characterReference",tokenize:v8};function v8(e,t,n){const a=this;let s=0,o,u;return f;function f(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),o=31,u=ar,p(g))}function h(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,u=n8,p):(e.enter("characterReferenceValue"),o=7,u=Qy,p(g))}function p(g){if(g===59&&s){const w=e.exit("characterReferenceValue");return u===ar&&!xb(a.sliceSerialize(w))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(g)&&s++<o?(e.consume(g),p):n(g)}}const Ck={partial:!0,tokenize:x8},Ek={concrete:!0,name:"codeFenced",tokenize:b8};function b8(e,t,n){const a=this,s={partial:!0,tokenize:z};let o=0,u=0,f;return m;function m(R){return h(R)}function h(R){const F=a.events[a.events.length-1];return o=F&&F[1].type==="linePrefix"?F[2].sliceSerialize(F[1],!0).length:0,f=R,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(R)}function p(R){return R===f?(u++,e.consume(R),p):u<3?n(R):(e.exit("codeFencedFenceSequence"),gt(R)?Et(e,g,"whitespace")(R):g(R))}function g(R){return R===null||Ze(R)?(e.exit("codeFencedFence"),a.interrupt?t(R):e.check(Ck,C,D)(R)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),w(R))}function w(R){return R===null||Ze(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(R)):gt(R)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Et(e,x,"whitespace")(R)):R===96&&R===f?n(R):(e.consume(R),w)}function x(R){return R===null||Ze(R)?g(R):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),k(R))}function k(R){return R===null||Ze(R)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(R)):R===96&&R===f?n(R):(e.consume(R),k)}function C(R){return e.attempt(s,D,j)(R)}function j(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),E}function E(R){return o>0&>(R)?Et(e,O,"linePrefix",o+1)(R):O(R)}function O(R){return R===null||Ze(R)?e.check(Ck,C,D)(R):(e.enter("codeFlowValue"),A(R))}function A(R){return R===null||Ze(R)?(e.exit("codeFlowValue"),O(R)):(e.consume(R),A)}function D(R){return e.exit("codeFenced"),t(R)}function z(R,F,B){let ee=0;return L;function L(X){return R.enter("lineEnding"),R.consume(X),R.exit("lineEnding"),I}function I(X){return R.enter("codeFencedFence"),gt(X)?Et(R,Q,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(X):Q(X)}function Q(X){return X===f?(R.enter("codeFencedFenceSequence"),te(X)):B(X)}function te(X){return X===f?(ee++,R.consume(X),te):ee>=u?(R.exit("codeFencedFenceSequence"),gt(X)?Et(R,Y,"whitespace")(X):Y(X)):B(X)}function Y(X){return X===null||Ze(X)?(R.exit("codeFencedFence"),F(X)):B(X)}}}function x8(e,t,n){const a=this;return s;function s(u){return u===null?n(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o)}function o(u){return a.parser.lazy[a.now().line]?n(u):t(u)}}const Sg={name:"codeIndented",tokenize:S8},w8={partial:!0,tokenize:k8};function S8(e,t,n){const a=this;return s;function s(h){return e.enter("codeIndented"),Et(e,o,"linePrefix",5)(h)}function o(h){const p=a.events[a.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?u(h):n(h)}function u(h){return h===null?m(h):Ze(h)?e.attempt(w8,u,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Ze(h)?(e.exit("codeFlowValue"),u(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),t(h)}}function k8(e,t,n){const a=this;return s;function s(u){return a.parser.lazy[a.now().line]?n(u):Ze(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),s):Et(e,o,"linePrefix",5)(u)}function o(u){const f=a.events[a.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):Ze(u)?s(u):n(u)}}const j8={name:"codeText",previous:E8,resolve:C8,tokenize:N8};function C8(e){let t=e.length-4,n=3,a,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(a=n;++a<t;)if(e[a][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(a=n-1,t++;++a<=t;)s===void 0?a!==t&&e[a][1].type!=="lineEnding"&&(s=a):(a===t||e[a][1].type==="lineEnding")&&(e[s][1].type="codeTextData",a!==s+2&&(e[s][1].end=e[a-1][1].end,e.splice(s+2,a-s-2),t-=a-s-2,a=s+2),s=void 0);return e}function E8(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function N8(e,t,n){let a=0,s,o;return u;function u(g){return e.enter("codeText"),e.enter("codeTextSequence"),f(g)}function f(g){return g===96?(e.consume(g),a++,f):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(o=e.enter("codeTextSequence"),s=0,p(g)):Ze(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(g))}function h(g){return g===null||g===32||g===96||Ze(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),h)}function p(g){return g===96?(e.consume(g),s++,p):s===a?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(o.type="codeTextData",h(g))}}class _8{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const a=n??Number.POSITIVE_INFINITY;return a<this.left.length?this.left.slice(t,a):t>this.left.length?this.right.slice(this.right.length-a+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-a+this.left.length).reverse())}splice(t,n,a){const s=n||0;this.setCursor(Math.trunc(t));const o=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return a&&$c(this.left,a),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),$c(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),$c(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);$c(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);$c(this.left,n.reverse())}}}function $c(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function H_(e){const t={};let n=-1,a,s,o,u,f,m,h;const p=new _8(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(a=p.get(n),n&&a[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(m=a[1]._tokenizer.events,o=0,o<m.length&&m[o][1].type==="lineEndingBlank"&&(o+=2),o<m.length&&m[o][1].type==="content"))for(;++o<m.length&&m[o][1].type!=="content";)m[o][1].type==="chunkText"&&(m[o][1]._isInFirstContentOfListItem=!0,o++);if(a[0]==="enter")a[1].contentType&&(Object.assign(t,T8(p,n)),n=t[n],h=!0);else if(a[1]._container){for(o=n,s=void 0;o--;)if(u=p.get(o),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),u[1].type="lineEnding",s=o);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;s&&(a[1].end={...p.get(s)[1].start},f=p.slice(s,n),f.unshift(a),p.splice(s,n-s+1,f))}}return Zr(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!h}function T8(e,t){const n=e.get(t)[1],a=e.get(t)[2];let s=t-1;const o=[];let u=n._tokenizer;u||(u=a.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const f=u.events,m=[],h={};let p,g,w=-1,x=n,k=0,C=0;const j=[C];for(;x;){for(;e.get(++s)[1]!==x;);o.push(s),x._tokenizer||(p=a.sliceStream(x),x.next||p.push(null),g&&u.defineSkip(x.start),x._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(p),x._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),g=x,x=x.next}for(x=n;++w<f.length;)f[w][0]==="exit"&&f[w-1][0]==="enter"&&f[w][1].type===f[w-1][1].type&&f[w][1].start.line!==f[w][1].end.line&&(C=w+1,j.push(C),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(u.events=[],x?(x._tokenizer=void 0,x.previous=void 0):j.pop(),w=j.length;w--;){const E=f.slice(j[w],j[w+1]),O=o.pop();m.push([O,O+E.length-1]),e.splice(O,2,E)}for(m.reverse(),w=-1;++w<m.length;)h[k+m[w][0]]=k+m[w][1],k+=m[w][1]-m[w][0]-1;return h}const A8={resolve:O8,tokenize:M8},R8={partial:!0,tokenize:D8};function O8(e){return H_(e),e}function M8(e,t){let n;return a;function a(f){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(f)}function s(f){return f===null?o(f):Ze(f)?e.check(R8,u,o)(f):(e.consume(f),s)}function o(f){return e.exit("chunkContent"),e.exit("content"),t(f)}function u(f){return e.consume(f),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function D8(e,t,n){const a=this;return s;function s(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Et(e,o,"linePrefix")}function o(u){if(u===null||Ze(u))return n(u);const f=a.events[a.events.length-1];return!a.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?t(u):e.interrupt(a.parser.constructs.flow,n,t)(u)}}function q_(e,t,n,a,s,o,u,f,m){const h=m||Number.POSITIVE_INFINITY;let p=0;return g;function g(E){return E===60?(e.enter(a),e.enter(s),e.enter(o),e.consume(E),e.exit(o),w):E===null||E===32||E===41||nh(E)?n(E):(e.enter(a),e.enter(u),e.enter(f),e.enter("chunkString",{contentType:"string"}),C(E))}function w(E){return E===62?(e.enter(o),e.consume(E),e.exit(o),e.exit(s),e.exit(a),t):(e.enter(f),e.enter("chunkString",{contentType:"string"}),x(E))}function x(E){return E===62?(e.exit("chunkString"),e.exit(f),w(E)):E===null||E===60||Ze(E)?n(E):(e.consume(E),E===92?k:x)}function k(E){return E===60||E===62||E===92?(e.consume(E),x):x(E)}function C(E){return!p&&(E===null||E===41||Ht(E))?(e.exit("chunkString"),e.exit(f),e.exit(u),e.exit(a),t(E)):p<h&&E===40?(e.consume(E),p++,C):E===41?(e.consume(E),p--,C):E===null||E===32||E===40||nh(E)?n(E):(e.consume(E),E===92?j:C)}function j(E){return E===40||E===41||E===92?(e.consume(E),C):C(E)}}function Z_(e,t,n,a,s,o){const u=this;let f=0,m;return h;function h(x){return e.enter(a),e.enter(s),e.consume(x),e.exit(s),e.enter(o),p}function p(x){return f>999||x===null||x===91||x===93&&!m||x===94&&!f&&"_hiddenFootnoteSupport"in u.parser.constructs?n(x):x===93?(e.exit(o),e.enter(s),e.consume(x),e.exit(s),e.exit(a),t):Ze(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||x===91||x===93||Ze(x)||f++>999?(e.exit("chunkString"),p(x)):(e.consume(x),m||(m=!gt(x)),x===92?w:g)}function w(x){return x===91||x===92||x===93?(e.consume(x),f++,g):g(x)}}function G_(e,t,n,a,s,o){let u;return f;function f(w){return w===34||w===39||w===40?(e.enter(a),e.enter(s),e.consume(w),e.exit(s),u=w===40?41:w,m):n(w)}function m(w){return w===u?(e.enter(s),e.consume(w),e.exit(s),e.exit(a),t):(e.enter(o),h(w))}function h(w){return w===u?(e.exit(o),m(u)):w===null?n(w):Ze(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),Et(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(w))}function p(w){return w===u||w===null||Ze(w)?(e.exit("chunkString"),h(w)):(e.consume(w),w===92?g:p)}function g(w){return w===u||w===92?(e.consume(w),p):p(w)}}function au(e,t){let n;return a;function a(s){return Ze(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,a):gt(s)?Et(e,a,n?"linePrefix":"lineSuffix")(s):t(s)}}const z8={name:"definition",tokenize:L8},I8={partial:!0,tokenize:P8};function L8(e,t,n){const a=this;let s;return o;function o(x){return e.enter("definition"),u(x)}function u(x){return Z_.call(a,e,f,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function f(x){return s=wa(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),m):n(x)}function m(x){return Ht(x)?au(e,h)(x):h(x)}function h(x){return q_(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function p(x){return e.attempt(I8,g,g)(x)}function g(x){return gt(x)?Et(e,w,"whitespace")(x):w(x)}function w(x){return x===null||Ze(x)?(e.exit("definition"),a.parser.defined.push(s),t(x)):n(x)}}function P8(e,t,n){return a;function a(f){return Ht(f)?au(e,s)(f):n(f)}function s(f){return G_(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function o(f){return gt(f)?Et(e,u,"whitespace")(f):u(f)}function u(f){return f===null||Ze(f)?t(f):n(f)}}const U8={name:"hardBreakEscape",tokenize:B8};function B8(e,t,n){return a;function a(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return Ze(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const F8={name:"headingAtx",resolve:$8,tokenize:H8};function $8(e,t){let n=e.length-2,a=3,s,o;return e[a][1].type==="whitespace"&&(a+=2),n-2>a&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(a===n-1||n-4>a&&e[n-2][1].type==="whitespace")&&(n-=a+1===n?2:4),n>a&&(s={type:"atxHeadingText",start:e[a][1].start,end:e[n][1].end},o={type:"chunkText",start:e[a][1].start,end:e[n][1].end,contentType:"text"},Zr(e,a,n-a+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function H8(e,t,n){let a=0;return s;function s(p){return e.enter("atxHeading"),o(p)}function o(p){return e.enter("atxHeadingSequence"),u(p)}function u(p){return p===35&&a++<6?(e.consume(p),u):p===null||Ht(p)?(e.exit("atxHeadingSequence"),f(p)):n(p)}function f(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||Ze(p)?(e.exit("atxHeading"),t(p)):gt(p)?Et(e,f,"whitespace")(p):(e.enter("atxHeadingText"),h(p))}function m(p){return p===35?(e.consume(p),m):(e.exit("atxHeadingSequence"),f(p))}function h(p){return p===null||p===35||Ht(p)?(e.exit("atxHeadingText"),f(p)):(e.consume(p),h)}}const q8=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Nk=["pre","script","style","textarea"],Z8={concrete:!0,name:"htmlFlow",resolveTo:Q8,tokenize:K8},G8={partial:!0,tokenize:X8},V8={partial:!0,tokenize:Y8};function Q8(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function K8(e,t,n){const a=this;let s,o,u,f,m;return h;function h(_){return p(_)}function p(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),g}function g(_){return _===33?(e.consume(_),w):_===47?(e.consume(_),o=!0,C):_===63?(e.consume(_),s=3,a.interrupt?t:M):fr(_)?(e.consume(_),u=String.fromCharCode(_),j):n(_)}function w(_){return _===45?(e.consume(_),s=2,x):_===91?(e.consume(_),s=5,f=0,k):fr(_)?(e.consume(_),s=4,a.interrupt?t:M):n(_)}function x(_){return _===45?(e.consume(_),a.interrupt?t:M):n(_)}function k(_){const V="CDATA[";return _===V.charCodeAt(f++)?(e.consume(_),f===V.length?a.interrupt?t:Q:k):n(_)}function C(_){return fr(_)?(e.consume(_),u=String.fromCharCode(_),j):n(_)}function j(_){if(_===null||_===47||_===62||Ht(_)){const V=_===47,H=u.toLowerCase();return!V&&!o&&Nk.includes(H)?(s=1,a.interrupt?t(_):Q(_)):q8.includes(u.toLowerCase())?(s=6,V?(e.consume(_),E):a.interrupt?t(_):Q(_)):(s=7,a.interrupt&&!a.parser.lazy[a.now().line]?n(_):o?O(_):A(_))}return _===45||ar(_)?(e.consume(_),u+=String.fromCharCode(_),j):n(_)}function E(_){return _===62?(e.consume(_),a.interrupt?t:Q):n(_)}function O(_){return gt(_)?(e.consume(_),O):L(_)}function A(_){return _===47?(e.consume(_),L):_===58||_===95||fr(_)?(e.consume(_),D):gt(_)?(e.consume(_),A):L(_)}function D(_){return _===45||_===46||_===58||_===95||ar(_)?(e.consume(_),D):z(_)}function z(_){return _===61?(e.consume(_),R):gt(_)?(e.consume(_),z):A(_)}function R(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),m=_,F):gt(_)?(e.consume(_),R):B(_)}function F(_){return _===m?(e.consume(_),m=null,ee):_===null||Ze(_)?n(_):(e.consume(_),F)}function B(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||Ht(_)?z(_):(e.consume(_),B)}function ee(_){return _===47||_===62||gt(_)?A(_):n(_)}function L(_){return _===62?(e.consume(_),I):n(_)}function I(_){return _===null||Ze(_)?Q(_):gt(_)?(e.consume(_),I):n(_)}function Q(_){return _===45&&s===2?(e.consume(_),G):_===60&&s===1?(e.consume(_),se):_===62&&s===4?(e.consume(_),U):_===63&&s===3?(e.consume(_),M):_===93&&s===5?(e.consume(_),ve):Ze(_)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(G8,P,te)(_)):_===null||Ze(_)?(e.exit("htmlFlowData"),te(_)):(e.consume(_),Q)}function te(_){return e.check(V8,Y,P)(_)}function Y(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),X}function X(_){return _===null||Ze(_)?te(_):(e.enter("htmlFlowData"),Q(_))}function G(_){return _===45?(e.consume(_),M):Q(_)}function se(_){return _===47?(e.consume(_),u="",J):Q(_)}function J(_){if(_===62){const V=u.toLowerCase();return Nk.includes(V)?(e.consume(_),U):Q(_)}return fr(_)&&u.length<8?(e.consume(_),u+=String.fromCharCode(_),J):Q(_)}function ve(_){return _===93?(e.consume(_),M):Q(_)}function M(_){return _===62?(e.consume(_),U):_===45&&s===2?(e.consume(_),M):Q(_)}function U(_){return _===null||Ze(_)?(e.exit("htmlFlowData"),P(_)):(e.consume(_),U)}function P(_){return e.exit("htmlFlow"),t(_)}}function Y8(e,t,n){const a=this;return s;function s(u){return Ze(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),o):n(u)}function o(u){return a.parser.lazy[a.now().line]?n(u):t(u)}}function X8(e,t,n){return a;function a(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Zu,t,n)}}const W8={name:"htmlText",tokenize:J8};function J8(e,t,n){const a=this;let s,o,u;return f;function f(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),m}function m(M){return M===33?(e.consume(M),h):M===47?(e.consume(M),z):M===63?(e.consume(M),A):fr(M)?(e.consume(M),B):n(M)}function h(M){return M===45?(e.consume(M),p):M===91?(e.consume(M),o=0,k):fr(M)?(e.consume(M),O):n(M)}function p(M){return M===45?(e.consume(M),x):n(M)}function g(M){return M===null?n(M):M===45?(e.consume(M),w):Ze(M)?(u=g,se(M)):(e.consume(M),g)}function w(M){return M===45?(e.consume(M),x):g(M)}function x(M){return M===62?G(M):M===45?w(M):g(M)}function k(M){const U="CDATA[";return M===U.charCodeAt(o++)?(e.consume(M),o===U.length?C:k):n(M)}function C(M){return M===null?n(M):M===93?(e.consume(M),j):Ze(M)?(u=C,se(M)):(e.consume(M),C)}function j(M){return M===93?(e.consume(M),E):C(M)}function E(M){return M===62?G(M):M===93?(e.consume(M),E):C(M)}function O(M){return M===null||M===62?G(M):Ze(M)?(u=O,se(M)):(e.consume(M),O)}function A(M){return M===null?n(M):M===63?(e.consume(M),D):Ze(M)?(u=A,se(M)):(e.consume(M),A)}function D(M){return M===62?G(M):A(M)}function z(M){return fr(M)?(e.consume(M),R):n(M)}function R(M){return M===45||ar(M)?(e.consume(M),R):F(M)}function F(M){return Ze(M)?(u=F,se(M)):gt(M)?(e.consume(M),F):G(M)}function B(M){return M===45||ar(M)?(e.consume(M),B):M===47||M===62||Ht(M)?ee(M):n(M)}function ee(M){return M===47?(e.consume(M),G):M===58||M===95||fr(M)?(e.consume(M),L):Ze(M)?(u=ee,se(M)):gt(M)?(e.consume(M),ee):G(M)}function L(M){return M===45||M===46||M===58||M===95||ar(M)?(e.consume(M),L):I(M)}function I(M){return M===61?(e.consume(M),Q):Ze(M)?(u=I,se(M)):gt(M)?(e.consume(M),I):ee(M)}function Q(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),s=M,te):Ze(M)?(u=Q,se(M)):gt(M)?(e.consume(M),Q):(e.consume(M),Y)}function te(M){return M===s?(e.consume(M),s=void 0,X):M===null?n(M):Ze(M)?(u=te,se(M)):(e.consume(M),te)}function Y(M){return M===null||M===34||M===39||M===60||M===61||M===96?n(M):M===47||M===62||Ht(M)?ee(M):(e.consume(M),Y)}function X(M){return M===47||M===62||Ht(M)?ee(M):n(M)}function G(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),t):n(M)}function se(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),J}function J(M){return gt(M)?Et(e,ve,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):ve(M)}function ve(M){return e.enter("htmlTextData"),u(M)}}const wb={name:"labelEnd",resolveAll:rH,resolveTo:aH,tokenize:iH},eH={tokenize:sH},tH={tokenize:lH},nH={tokenize:oH};function rH(e){let t=-1;const n=[];for(;++t<e.length;){const a=e[t][1];if(n.push(e[t]),a.type==="labelImage"||a.type==="labelLink"||a.type==="labelEnd"){const s=a.type==="labelImage"?4:2;a.type="data",t+=s}}return e.length!==n.length&&Zr(e,0,e.length,n),e}function aH(e,t){let n=e.length,a=0,s,o,u,f;for(;n--;)if(s=e[n][1],o){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(u){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(o=n,s.type!=="labelLink")){a=2;break}}else s.type==="labelEnd"&&(u=n);const m={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[o][1].start},end:{...e[u][1].end}},p={type:"labelText",start:{...e[o+a+2][1].end},end:{...e[u-2][1].start}};return f=[["enter",m,t],["enter",h,t]],f=ca(f,e.slice(o+1,o+a+3)),f=ca(f,[["enter",p,t]]),f=ca(f,Oh(t.parser.constructs.insideSpan.null,e.slice(o+a+4,u-3),t)),f=ca(f,[["exit",p,t],e[u-2],e[u-1],["exit",h,t]]),f=ca(f,e.slice(u+1)),f=ca(f,[["exit",m,t]]),Zr(e,o,e.length,f),e}function iH(e,t,n){const a=this;let s=a.events.length,o,u;for(;s--;)if((a.events[s][1].type==="labelImage"||a.events[s][1].type==="labelLink")&&!a.events[s][1]._balanced){o=a.events[s][1];break}return f;function f(w){return o?o._inactive?g(w):(u=a.parser.defined.includes(wa(a.sliceSerialize({start:o.end,end:a.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(w),e.exit("labelMarker"),e.exit("labelEnd"),m):n(w)}function m(w){return w===40?e.attempt(eH,p,u?p:g)(w):w===91?e.attempt(tH,p,u?h:g)(w):u?p(w):g(w)}function h(w){return e.attempt(nH,p,g)(w)}function p(w){return t(w)}function g(w){return o._balanced=!0,n(w)}}function sH(e,t,n){return a;function a(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),s}function s(g){return Ht(g)?au(e,o)(g):o(g)}function o(g){return g===41?p(g):q_(e,u,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function u(g){return Ht(g)?au(e,m)(g):p(g)}function f(g){return n(g)}function m(g){return g===34||g===39||g===40?G_(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):p(g)}function h(g){return Ht(g)?au(e,p)(g):p(g)}function p(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function lH(e,t,n){const a=this;return s;function s(f){return Z_.call(a,e,o,u,"reference","referenceMarker","referenceString")(f)}function o(f){return a.parser.defined.includes(wa(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(f):n(f)}function u(f){return n(f)}}function oH(e,t,n){return a;function a(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const cH={name:"labelStartImage",resolveAll:wb.resolveAll,tokenize:uH};function uH(e,t,n){const a=this;return s;function s(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),o}function o(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),u):n(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(f):t(f)}}const dH={name:"labelStartLink",resolveAll:wb.resolveAll,tokenize:fH};function fH(e,t,n){const a=this;return s;function s(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),o}function o(u){return u===94&&"_hiddenFootnoteSupport"in a.parser.constructs?n(u):t(u)}}const kg={name:"lineEnding",tokenize:hH};function hH(e,t){return n;function n(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Et(e,t,"linePrefix")}}const Ff={name:"thematicBreak",tokenize:mH};function mH(e,t,n){let a=0,s;return o;function o(h){return e.enter("thematicBreak"),u(h)}function u(h){return s=h,f(h)}function f(h){return h===s?(e.enter("thematicBreakSequence"),m(h)):a>=3&&(h===null||Ze(h))?(e.exit("thematicBreak"),t(h)):n(h)}function m(h){return h===s?(e.consume(h),a++,m):(e.exit("thematicBreakSequence"),gt(h)?Et(e,f,"whitespace")(h):f(h))}}const Cr={continuation:{tokenize:vH},exit:xH,name:"list",tokenize:yH},pH={partial:!0,tokenize:wH},gH={partial:!0,tokenize:bH};function yH(e,t,n){const a=this,s=a.events[a.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,u=0;return f;function f(x){const k=a.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(k==="listUnordered"?!a.containerState.marker||x===a.containerState.marker:Qy(x)){if(a.containerState.type||(a.containerState.type=k,e.enter(k,{_container:!0})),k==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(Ff,n,h)(x):h(x);if(!a.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(x)}return n(x)}function m(x){return Qy(x)&&++u<10?(e.consume(x),m):(!a.interrupt||u<2)&&(a.containerState.marker?x===a.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),h(x)):n(x)}function h(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),a.containerState.marker=a.containerState.marker||x,e.check(Zu,a.interrupt?n:p,e.attempt(pH,w,g))}function p(x){return a.containerState.initialBlankLine=!0,o++,w(x)}function g(x){return gt(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),w):n(x)}function w(x){return a.containerState.size=o+a.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(x)}}function vH(e,t,n){const a=this;return a.containerState._closeFlow=void 0,e.check(Zu,s,o);function s(f){return a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,Et(e,t,"listItemIndent",a.containerState.size+1)(f)}function o(f){return a.containerState.furtherBlankLines||!gt(f)?(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,u(f)):(a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(gH,t,u)(f))}function u(f){return a.containerState._closeFlow=!0,a.interrupt=void 0,Et(e,e.attempt(Cr,t,n),"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function bH(e,t,n){const a=this;return Et(e,s,"listItemIndent",a.containerState.size+1);function s(o){const u=a.events[a.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===a.containerState.size?t(o):n(o)}}function xH(e){e.exit(this.containerState.type)}function wH(e,t,n){const a=this;return Et(e,s,"listItemPrefixWhitespace",a.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const u=a.events[a.events.length-1];return!gt(o)&&u&&u[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const _k={name:"setextUnderline",resolveTo:SH,tokenize:kH};function SH(e,t){let n=e.length,a,s,o;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){a=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!o&&e[n][1].type==="definition"&&(o=n);const u={type:"setextHeading",start:{...e[a][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",o?(e.splice(s,0,["enter",u,t]),e.splice(o+1,0,["exit",e[a][1],t]),e[a][1].end={...e[o][1].end}):e[a][1]=u,e.push(["exit",u,t]),e}function kH(e,t,n){const a=this;let s;return o;function o(h){let p=a.events.length,g;for(;p--;)if(a.events[p][1].type!=="lineEnding"&&a.events[p][1].type!=="linePrefix"&&a.events[p][1].type!=="content"){g=a.events[p][1].type==="paragraph";break}return!a.parser.lazy[a.now().line]&&(a.interrupt||g)?(e.enter("setextHeadingLine"),s=h,u(h)):n(h)}function u(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===s?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),gt(h)?Et(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Ze(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const jH={tokenize:CH};function CH(e){const t=this,n=e.attempt(Zu,a,e.attempt(this.parser.constructs.flowInitial,s,Et(e,e.attempt(this.parser.constructs.flow,s,e.attempt(A8,s)),"linePrefix")));return n;function a(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const EH={resolveAll:Q_()},NH=V_("string"),_H=V_("text");function V_(e){return{resolveAll:Q_(e==="text"?TH:void 0),tokenize:t};function t(n){const a=this,s=this.parser.constructs[e],o=n.attempt(s,u,f);return u;function u(p){return h(p)?o(p):f(p)}function f(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),m}function m(p){return h(p)?(n.exit("data"),o(p)):(n.consume(p),m)}function h(p){if(p===null)return!0;const g=s[p];let w=-1;if(g)for(;++w<g.length;){const x=g[w];if(!x.previous||x.previous.call(a,a.previous))return!0}return!1}}}function Q_(e){return t;function t(n,a){let s=-1,o;for(;++s<=n.length;)o===void 0?n[s]&&n[s][1].type==="data"&&(o=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==o+2&&(n[o][1].end=n[s-1][1].end,n.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(n,a):n}}function TH(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const a=e[n-1][1],s=t.sliceStream(a);let o=s.length,u=-1,f=0,m;for(;o--;){const h=s[o];if(typeof h=="string"){for(u=h.length;h.charCodeAt(u-1)===32;)f++,u--;if(u)break;u=-1}else if(h===-2)m=!0,f++;else if(h!==-1){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(f=0),f){const h={type:n===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?u:a.start._bufferIndex+u,_index:a.start._index+o,line:a.end.line,column:a.end.column-f,offset:a.end.offset-f},end:{...a.end}};a.end={...h.start},a.start.offset===a.end.offset?Object.assign(a,h):(e.splice(n,0,["enter",h,t],["exit",h,t]),n+=2)}n++}return e}const AH={42:Cr,43:Cr,45:Cr,48:Cr,49:Cr,50:Cr,51:Cr,52:Cr,53:Cr,54:Cr,55:Cr,56:Cr,57:Cr,62:B_},RH={91:z8},OH={[-2]:Sg,[-1]:Sg,32:Sg},MH={35:F8,42:Ff,45:[_k,Ff],60:Z8,61:_k,95:Ff,96:Ek,126:Ek},DH={38:$_,92:F_},zH={[-5]:kg,[-4]:kg,[-3]:kg,33:cH,38:$_,42:Ky,60:[d8,W8],91:dH,92:[U8,F_],93:wb,95:Ky,96:j8},IH={null:[Ky,EH]},LH={null:[42,95]},PH={null:[]},UH=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:LH,contentInitial:RH,disable:PH,document:AH,flow:MH,flowInitial:OH,insideSpan:IH,string:DH,text:zH},Symbol.toStringTag,{value:"Module"}));function BH(e,t,n){let a={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},o=[];let u=[],f=[];const m={attempt:F(z),check:F(R),consume:O,enter:A,exit:D,interrupt:F(R,{interrupt:!0})},h={code:null,containerState:{},defineSkip:C,events:[],now:k,parser:e,previous:null,sliceSerialize:w,sliceStream:x,write:g};let p=t.tokenize.call(h,m);return t.resolveAll&&o.push(t),h;function g(I){return u=ca(u,I),j(),u[u.length-1]!==null?[]:(B(t,0),h.events=Oh(o,h.events,h),h.events)}function w(I,Q){return $H(x(I),Q)}function x(I){return FH(u,I)}function k(){const{_bufferIndex:I,_index:Q,line:te,column:Y,offset:X}=a;return{_bufferIndex:I,_index:Q,line:te,column:Y,offset:X}}function C(I){s[I.line]=I.column,L()}function j(){let I;for(;a._index<u.length;){const Q=u[a._index];if(typeof Q=="string")for(I=a._index,a._bufferIndex<0&&(a._bufferIndex=0);a._index===I&&a._bufferIndex<Q.length;)E(Q.charCodeAt(a._bufferIndex));else E(Q)}}function E(I){p=p(I)}function O(I){Ze(I)?(a.line++,a.column=1,a.offset+=I===-3?2:1,L()):I!==-1&&(a.column++,a.offset++),a._bufferIndex<0?a._index++:(a._bufferIndex++,a._bufferIndex===u[a._index].length&&(a._bufferIndex=-1,a._index++)),h.previous=I}function A(I,Q){const te=Q||{};return te.type=I,te.start=k(),h.events.push(["enter",te,h]),f.push(te),te}function D(I){const Q=f.pop();return Q.end=k(),h.events.push(["exit",Q,h]),Q}function z(I,Q){B(I,Q.from)}function R(I,Q){Q.restore()}function F(I,Q){return te;function te(Y,X,G){let se,J,ve,M;return Array.isArray(Y)?P(Y):"tokenize"in Y?P([Y]):U(Y);function U(ae){return Se;function Se(Ae){const Ee=Ae!==null&&ae[Ae],Ge=Ae!==null&&ae.null,Fe=[...Array.isArray(Ee)?Ee:Ee?[Ee]:[],...Array.isArray(Ge)?Ge:Ge?[Ge]:[]];return P(Fe)(Ae)}}function P(ae){return se=ae,J=0,ae.length===0?G:_(ae[J])}function _(ae){return Se;function Se(Ae){return M=ee(),ve=ae,ae.partial||(h.currentConstruct=ae),ae.name&&h.parser.constructs.disable.null.includes(ae.name)?H():ae.tokenize.call(Q?Object.assign(Object.create(h),Q):h,m,V,H)(Ae)}}function V(ae){return I(ve,M),X}function H(ae){return M.restore(),++J<se.length?_(se[J]):G}}}function B(I,Q){I.resolveAll&&!o.includes(I)&&o.push(I),I.resolve&&Zr(h.events,Q,h.events.length-Q,I.resolve(h.events.slice(Q),h)),I.resolveTo&&(h.events=I.resolveTo(h.events,h))}function ee(){const I=k(),Q=h.previous,te=h.currentConstruct,Y=h.events.length,X=Array.from(f);return{from:Y,restore:G};function G(){a=I,h.previous=Q,h.currentConstruct=te,h.events.length=Y,f=X,L()}}function L(){a.line in s&&a.column<2&&(a.column=s[a.line],a.offset+=s[a.line]-1)}}function FH(e,t){const n=t.start._index,a=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let u;if(n===s)u=[e[n].slice(a,o)];else{if(u=e.slice(n,s),a>-1){const f=u[0];typeof f=="string"?u[0]=f.slice(a):u.shift()}o>0&&u.push(e[s].slice(0,o))}return u}function $H(e,t){let n=-1;const a=[];let s;for(;++n<e.length;){const o=e[n];let u;if(typeof o=="string")u=o;else switch(o){case-5:{u="\r";break}case-4:{u=`
|
|
384
|
-
`;break}case-3:{u=`\r
|
|
385
|
-
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&s)continue;u=" ";break}default:u=String.fromCharCode(o)}s=o===-2,a.push(u)}return a.join("")}function HH(e){const a={constructs:P_([UH,...(e||{}).extensions||[]]),content:s(a8),defined:[],document:s(s8),flow:s(jH),lazy:{},string:s(NH),text:s(_H)};return a;function s(o){return u;function u(f){return BH(a,o,f)}}}function qH(e){for(;!H_(e););return e}const Tk=/[\0\t\n\r]/g;function ZH(){let e=1,t="",n=!0,a;return s;function s(o,u,f){const m=[];let h,p,g,w,x;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(u||void 0).decode(o)),g=0,t="",n&&(o.charCodeAt(0)===65279&&g++,n=void 0);g<o.length;){if(Tk.lastIndex=g,h=Tk.exec(o),w=h&&h.index!==void 0?h.index:o.length,x=o.charCodeAt(w),!h){t=o.slice(g);break}if(x===10&&g===w&&a)m.push(-3),a=void 0;else switch(a&&(m.push(-5),a=void 0),g<w&&(m.push(o.slice(g,w)),e+=w-g),x){case 0:{m.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,m.push(-2);e++<p;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:a=!0,e=1}g=w+1}return f&&(a&&m.push(-5),t&&m.push(t),m.push(null)),m}}const GH=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function VH(e){return e.replace(GH,QH)}function QH(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return U_(n.slice(o?2:1),o?16:10)}return xb(n)||e}const K_={}.hasOwnProperty;function KH(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),YH(n)(qH(HH(n).document().write(ZH()(e,t,!0))))}function YH(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(le),autolinkProtocol:ee,autolinkEmail:ee,atxHeading:o(we),blockQuote:o(Ge),characterEscape:ee,characterReference:ee,codeFenced:o(Fe),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:o(Fe,u),codeText:o(Ve,u),codeTextData:ee,data:ee,codeFlowValue:ee,definition:o(st),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:o(Nt),hardBreakEscape:o(ze),hardBreakTrailing:o(ze),htmlFlow:o(et,u),htmlFlowData:ee,htmlText:o(et,u),htmlTextData:ee,image:o(Ct),label:u,link:o(le),listItem:o(Pe),listItemValue:w,listOrdered:o(me,g),listUnordered:o(me),paragraph:o(qe),reference:_,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:o(we),strong:o(Gt),thematicBreak:o(An)},exit:{atxHeading:m(),atxHeadingSequence:z,autolink:m(),autolinkEmail:Ee,autolinkProtocol:Ae,blockQuote:m(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:H,characterReferenceMarkerNumeric:H,characterReferenceValue:ae,characterReference:Se,codeFenced:m(j),codeFencedFence:C,codeFencedFenceInfo:x,codeFencedFenceMeta:k,codeFlowValue:L,codeIndented:m(E),codeText:m(X),codeTextData:L,data:L,definition:m(),definitionDestinationString:D,definitionLabelString:O,definitionTitleString:A,emphasis:m(),hardBreakEscape:m(Q),hardBreakTrailing:m(Q),htmlFlow:m(te),htmlFlowData:L,htmlText:m(Y),htmlTextData:L,image:m(se),label:ve,labelText:J,lineEnding:I,link:m(G),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:V,resourceDestinationString:M,resourceTitleString:U,resource:P,setextHeading:m(B),setextHeadingLineSequence:F,setextHeadingText:R,strong:m(),thematicBreak:m()}};Y_(t,(e||{}).mdastExtensions||[]);const n={};return a;function a(ue){let be={type:"root",children:[]};const Ne={stack:[be],tokenStack:[],config:t,enter:f,exit:h,buffer:u,resume:p,data:n},Xe=[];let wt=-1;for(;++wt<ue.length;)if(ue[wt][1].type==="listOrdered"||ue[wt][1].type==="listUnordered")if(ue[wt][0]==="enter")Xe.push(wt);else{const Rn=Xe.pop();wt=s(ue,Rn,wt)}for(wt=-1;++wt<ue.length;){const Rn=t[ue[wt][0]];K_.call(Rn,ue[wt][1].type)&&Rn[ue[wt][1].type].call(Object.assign({sliceSerialize:ue[wt][2].sliceSerialize},Ne),ue[wt][1])}if(Ne.tokenStack.length>0){const Rn=Ne.tokenStack[Ne.tokenStack.length-1];(Rn[1]||Ak).call(Ne,void 0,Rn[0])}for(be.position={start:Ji(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:Ji(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},wt=-1;++wt<t.transforms.length;)be=t.transforms[wt](be)||be;return be}function s(ue,be,Ne){let Xe=be-1,wt=-1,Rn=!1,gr,Yt,qt,Bt;for(;++Xe<=Ne;){const yt=ue[Xe];switch(yt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{yt[0]==="enter"?wt++:wt--,Bt=void 0;break}case"lineEndingBlank":{yt[0]==="enter"&&(gr&&!Bt&&!wt&&!qt&&(qt=Xe),Bt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Bt=void 0}if(!wt&&yt[0]==="enter"&&yt[1].type==="listItemPrefix"||wt===-1&&yt[0]==="exit"&&(yt[1].type==="listUnordered"||yt[1].type==="listOrdered")){if(gr){let yr=Xe;for(Yt=void 0;yr--;){const $n=ue[yr];if($n[1].type==="lineEnding"||$n[1].type==="lineEndingBlank"){if($n[0]==="exit")continue;Yt&&(ue[Yt][1].type="lineEndingBlank",Rn=!0),$n[1].type="lineEnding",Yt=yr}else if(!($n[1].type==="linePrefix"||$n[1].type==="blockQuotePrefix"||$n[1].type==="blockQuotePrefixWhitespace"||$n[1].type==="blockQuoteMarker"||$n[1].type==="listItemIndent"))break}qt&&(!Yt||qt<Yt)&&(gr._spread=!0),gr.end=Object.assign({},Yt?ue[Yt][1].start:yt[1].end),ue.splice(Yt||Xe,0,["exit",gr,yt[2]]),Xe++,Ne++}if(yt[1].type==="listItemPrefix"){const yr={type:"listItem",_spread:!1,start:Object.assign({},yt[1].start),end:void 0};gr=yr,ue.splice(Xe,0,["enter",yr,yt[2]]),Xe++,Ne++,qt=void 0,Bt=!0}}}return ue[be][1]._spread=Rn,Ne}function o(ue,be){return Ne;function Ne(Xe){f.call(this,ue(Xe),Xe),be&&be.call(this,Xe)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(ue,be,Ne){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([be,Ne||void 0]),ue.position={start:Ji(be.start),end:void 0}}function m(ue){return be;function be(Ne){ue&&ue.call(this,Ne),h.call(this,Ne)}}function h(ue,be){const Ne=this.stack.pop(),Xe=this.tokenStack.pop();if(Xe)Xe[0].type!==ue.type&&(be?be.call(this,ue,Xe[0]):(Xe[1]||Ak).call(this,ue,Xe[0]));else throw new Error("Cannot close `"+ue.type+"` ("+ru({start:ue.start,end:ue.end})+"): it’s not open");Ne.position.end=Ji(ue.end)}function p(){return bb(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function w(ue){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function x(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.lang=ue}function k(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.meta=ue}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function j(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue.replace(/(\r?\n|\r)$/g,"")}function O(ue){const be=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=be,Ne.identifier=wa(this.sliceSerialize(ue)).toLowerCase()}function A(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.title=ue}function D(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.url=ue}function z(ue){const be=this.stack[this.stack.length-1];if(!be.depth){const Ne=this.sliceSerialize(ue).length;be.depth=Ne}}function R(){this.data.setextHeadingSlurpLineEnding=!0}function F(ue){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function ee(ue){const Ne=this.stack[this.stack.length-1].children;let Xe=Ne[Ne.length-1];(!Xe||Xe.type!=="text")&&(Xe=nt(),Xe.position={start:Ji(ue.start),end:void 0},Ne.push(Xe)),this.stack.push(Xe)}function L(ue){const be=this.stack.pop();be.value+=this.sliceSerialize(ue),be.position.end=Ji(ue.end)}function I(ue){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ne=be.children[be.children.length-1];Ne.position.end=Ji(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(ee.call(this,ue),L.call(this,ue))}function Q(){this.data.atHardBreak=!0}function te(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function Y(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function X(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.value=ue}function G(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=be,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function se(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=be,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function J(ue){const be=this.sliceSerialize(ue),Ne=this.stack[this.stack.length-2];Ne.label=VH(be),Ne.identifier=wa(be).toLowerCase()}function ve(){const ue=this.stack[this.stack.length-1],be=this.resume(),Ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ne.type==="link"){const Xe=ue.children;Ne.children=Xe}else Ne.alt=be}function M(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.url=ue}function U(){const ue=this.resume(),be=this.stack[this.stack.length-1];be.title=ue}function P(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function V(ue){const be=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=be,Ne.identifier=wa(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function H(ue){this.data.characterReferenceType=ue.type}function ae(ue){const be=this.sliceSerialize(ue),Ne=this.data.characterReferenceType;let Xe;Ne?(Xe=U_(be,Ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Xe=xb(be);const wt=this.stack[this.stack.length-1];wt.value+=Xe}function Se(ue){const be=this.stack.pop();be.position.end=Ji(ue.end)}function Ae(ue){L.call(this,ue);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(ue)}function Ee(ue){L.call(this,ue);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(ue)}function Ge(){return{type:"blockquote",children:[]}}function Fe(){return{type:"code",lang:null,meta:null,value:""}}function Ve(){return{type:"inlineCode",value:""}}function st(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Nt(){return{type:"emphasis",children:[]}}function we(){return{type:"heading",depth:0,children:[]}}function ze(){return{type:"break"}}function et(){return{type:"html",value:""}}function Ct(){return{type:"image",title:null,url:"",alt:null}}function le(){return{type:"link",title:null,url:"",children:[]}}function me(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function Pe(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function qe(){return{type:"paragraph",children:[]}}function Gt(){return{type:"strong",children:[]}}function nt(){return{type:"text",value:""}}function An(){return{type:"thematicBreak"}}}function Ji(e){return{line:e.line,column:e.column,offset:e.offset}}function Y_(e,t){let n=-1;for(;++n<t.length;){const a=t[n];Array.isArray(a)?Y_(e,a):XH(e,a)}}function XH(e,t){let n;for(n in t)if(K_.call(t,n))switch(n){case"canContainEols":{const a=t[n];a&&e[n].push(...a);break}case"transforms":{const a=t[n];a&&e[n].push(...a);break}case"enter":case"exit":{const a=t[n];a&&Object.assign(e[n],a);break}}}function Ak(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ru({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ru({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ru({start:t.start,end:t.end})+") is still open")}function WH(e){const t=this;t.parser=n;function n(a){return KH(a,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function JH(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function eq(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
386
|
-
`}]}function tq(e,t){const n=t.value?t.value+`
|
|
387
|
-
`:"",a={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(a.className=["language-"+s[0]]);let o={type:"element",tagName:"code",properties:a,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function nq(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function rq(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aq(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",a=String(t.identifier).toUpperCase(),s=zo(a.toLowerCase()),o=e.footnoteOrder.indexOf(a);let u,f=e.footnoteCounts.get(a);f===void 0?(f=0,e.footnoteOrder.push(a),u=e.footnoteOrder.length):u=o+1,f+=1,e.footnoteCounts.set(a,f);const m={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,h),e.applyData(t,h)}function iq(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sq(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function X_(e,t){const n=t.referenceType;let a="]";if(n==="collapsed"?a+="[]":n==="full"&&(a+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+a}];const s=e.all(t),o=s[0];o&&o.type==="text"?o.value="["+o.value:s.unshift({type:"text",value:"["});const u=s[s.length-1];return u&&u.type==="text"?u.value+=a:s.push({type:"text",value:a}),s}function lq(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return X_(e,t);const s={src:zo(a.url||""),alt:t.alt};a.title!==null&&a.title!==void 0&&(s.title=a.title);const o={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,o),e.applyData(t,o)}function oq(e,t){const n={src:zo(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,a),e.applyData(t,a)}function cq(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const a={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,a),e.applyData(t,a)}function uq(e,t){const n=String(t.identifier).toUpperCase(),a=e.definitionById.get(n);if(!a)return X_(e,t);const s={href:zo(a.url||"")};a.title!==null&&a.title!==void 0&&(s.title=a.title);const o={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function dq(e,t){const n={href:zo(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const a={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function fq(e,t,n){const a=e.all(t),s=n?hq(n):W_(t),o={},u=[];if(typeof t.checked=="boolean"){const p=a[0];let g;p&&p.type==="element"&&p.tagName==="p"?g=p:(g={type:"element",tagName:"p",properties:{},children:[]},a.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let f=-1;for(;++f<a.length;){const p=a[f];(s||f!==0||p.type!=="element"||p.tagName!=="p")&&u.push({type:"text",value:`
|
|
388
|
-
`}),p.type==="element"&&p.tagName==="p"&&!s?u.push(...p.children):u.push(p)}const m=a[a.length-1];m&&(s||m.type!=="element"||m.tagName!=="p")&&u.push({type:"text",value:`
|
|
389
|
-
`});const h={type:"element",tagName:"li",properties:o,children:u};return e.patch(t,h),e.applyData(t,h)}function hq(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let a=-1;for(;!t&&++a<n.length;)t=W_(n[a])}return t}function W_(e){const t=e.spread;return t??e.children.length>1}function mq(e,t){const n={},a=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<a.length;){const u=a[s];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(a,!0)};return e.patch(t,o),e.applyData(t,o)}function pq(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function gq(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function yq(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vq(e,t){const n=e.all(t),a=n.shift(),s=[];if(a){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([a],!0)};e.patch(t.children[0],u),s.push(u)}if(n.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},f=pb(t.children[1]),m=R_(t.children[t.children.length-1]);f&&m&&(u.position={start:f,end:m}),s.push(u)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function bq(e,t,n){const a=n?n.children:void 0,o=(a?a.indexOf(t):1)===0?"th":"td",u=n&&n.type==="table"?n.align:void 0,f=u?u.length:t.children.length;let m=-1;const h=[];for(;++m<f;){const g=t.children[m],w={},x=u?u[m]:void 0;x&&(w.align=x);let k={type:"element",tagName:o,properties:w,children:[]};g&&(k.children=e.all(g),e.patch(g,k),k=e.applyData(g,k)),h.push(k)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,p),e.applyData(t,p)}function xq(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Rk=9,Ok=32;function wq(e){const t=String(e),n=/\r?\n|\r/g;let a=n.exec(t),s=0;const o=[];for(;a;)o.push(Mk(t.slice(s,a.index),s>0,!0),a[0]),s=a.index+a[0].length,a=n.exec(t);return o.push(Mk(t.slice(s),s>0,!1)),o.join("")}function Mk(e,t,n){let a=0,s=e.length;if(t){let o=e.codePointAt(a);for(;o===Rk||o===Ok;)a++,o=e.codePointAt(a)}if(n){let o=e.codePointAt(s-1);for(;o===Rk||o===Ok;)s--,o=e.codePointAt(s-1)}return s>a?e.slice(a,s):""}function Sq(e,t){const n={type:"text",value:wq(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function kq(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const jq={blockquote:JH,break:eq,code:tq,delete:nq,emphasis:rq,footnoteReference:aq,heading:iq,html:sq,imageReference:lq,image:oq,inlineCode:cq,linkReference:uq,link:dq,listItem:fq,list:mq,paragraph:pq,root:gq,strong:yq,table:vq,tableCell:xq,tableRow:bq,text:Sq,thematicBreak:kq,toml:Ef,yaml:Ef,definition:Ef,footnoteDefinition:Ef};function Ef(){}const J_=-1,Mh=0,iu=1,rh=2,Sb=3,kb=4,jb=5,Cb=6,eT=7,tT=8,Dk=typeof self=="object"?self:globalThis,Cq=(e,t)=>{const n=(s,o)=>(e.set(o,s),s),a=s=>{if(e.has(s))return e.get(s);const[o,u]=t[s];switch(o){case Mh:case J_:return n(u,s);case iu:{const f=n([],s);for(const m of u)f.push(a(m));return f}case rh:{const f=n({},s);for(const[m,h]of u)f[a(m)]=a(h);return f}case Sb:return n(new Date(u),s);case kb:{const{source:f,flags:m}=u;return n(new RegExp(f,m),s)}case jb:{const f=n(new Map,s);for(const[m,h]of u)f.set(a(m),a(h));return f}case Cb:{const f=n(new Set,s);for(const m of u)f.add(a(m));return f}case eT:{const{name:f,message:m}=u;return n(new Dk[f](m),s)}case tT:return n(BigInt(u),s);case"BigInt":return n(Object(BigInt(u)),s);case"ArrayBuffer":return n(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:f}=new Uint8Array(u);return n(new DataView(f),u)}}return n(new Dk[o](u),s)};return a},zk=e=>Cq(new Map,e)(0),Vl="",{toString:Eq}={},{keys:Nq}=Object,Hc=e=>{const t=typeof e;if(t!=="object"||!e)return[Mh,t];const n=Eq.call(e).slice(8,-1);switch(n){case"Array":return[iu,Vl];case"Object":return[rh,Vl];case"Date":return[Sb,Vl];case"RegExp":return[kb,Vl];case"Map":return[jb,Vl];case"Set":return[Cb,Vl];case"DataView":return[iu,n]}return n.includes("Array")?[iu,n]:n.includes("Error")?[eT,n]:[rh,n]},Nf=([e,t])=>e===Mh&&(t==="function"||t==="symbol"),_q=(e,t,n,a)=>{const s=(u,f)=>{const m=a.push(u)-1;return n.set(f,m),m},o=u=>{if(n.has(u))return n.get(u);let[f,m]=Hc(u);switch(f){case Mh:{let p=u;switch(m){case"bigint":f=tT,p=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);p=null;break;case"undefined":return s([J_],u)}return s([f,p],u)}case iu:{if(m){let w=u;return m==="DataView"?w=new Uint8Array(u.buffer):m==="ArrayBuffer"&&(w=new Uint8Array(u)),s([m,[...w]],u)}const p=[],g=s([f,p],u);for(const w of u)p.push(o(w));return g}case rh:{if(m)switch(m){case"BigInt":return s([m,u.toString()],u);case"Boolean":case"Number":case"String":return s([m,u.valueOf()],u)}if(t&&"toJSON"in u)return o(u.toJSON());const p=[],g=s([f,p],u);for(const w of Nq(u))(e||!Nf(Hc(u[w])))&&p.push([o(w),o(u[w])]);return g}case Sb:return s([f,u.toISOString()],u);case kb:{const{source:p,flags:g}=u;return s([f,{source:p,flags:g}],u)}case jb:{const p=[],g=s([f,p],u);for(const[w,x]of u)(e||!(Nf(Hc(w))||Nf(Hc(x))))&&p.push([o(w),o(x)]);return g}case Cb:{const p=[],g=s([f,p],u);for(const w of u)(e||!Nf(Hc(w)))&&p.push(o(w));return g}}const{message:h}=u;return s([f,{name:m,message:h}],u)};return o},Ik=(e,{json:t,lossy:n}={})=>{const a=[];return _q(!(t||n),!!t,new Map,a)(e),a},ah=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?zk(Ik(e,t)):structuredClone(e):(e,t)=>zk(Ik(e,t));function Tq(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Aq(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Rq(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Tq,a=e.options.footnoteBackLabel||Aq,s=e.options.footnoteLabel||"Footnotes",o=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[m]);if(!h)continue;const p=e.all(h),g=String(h.identifier).toUpperCase(),w=zo(g.toLowerCase());let x=0;const k=[],C=e.footnoteCounts.get(g);for(;C!==void 0&&++x<=C;){k.length>0&&k.push({type:"text",value:" "});let O=typeof n=="string"?n:n(m,x);typeof O=="string"&&(O={type:"text",value:O}),k.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+w+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof a=="string"?a:a(m,x),className:["data-footnote-backref"]},children:Array.isArray(O)?O:[O]})}const j=p[p.length-1];if(j&&j.type==="element"&&j.tagName==="p"){const O=j.children[j.children.length-1];O&&O.type==="text"?O.value+=" ":j.children.push({type:"text",value:" "}),j.children.push(...k)}else p.push(...k);const E={type:"element",tagName:"li",properties:{id:t+"fn-"+w},children:e.wrap(p,!0)};e.patch(h,E),f.push(E)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...ah(u),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
|
|
390
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
391
|
-
`}]}}const Dh=(function(e){if(e==null)return zq;if(typeof e=="function")return zh(e);if(typeof e=="object")return Array.isArray(e)?Oq(e):Mq(e);if(typeof e=="string")return Dq(e);throw new Error("Expected function, string, or object as test")});function Oq(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Dh(e[n]);return zh(a);function a(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function Mq(e){const t=e;return zh(n);function n(a){const s=a;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function Dq(e){return zh(t);function t(n){return n&&n.type===e}}function zh(e){return t;function t(n,a,s){return!!(Iq(n)&&e.call(this,n,typeof a=="number"?a:void 0,s||void 0))}}function zq(){return!0}function Iq(e){return e!==null&&typeof e=="object"&&"type"in e}const nT=[],Lq=!0,Yy=!1,Pq="skip";function rT(e,t,n,a){let s;typeof t=="function"&&typeof n!="function"?(a=n,n=t):s=t;const o=Dh(s),u=a?-1:1;f(e,void 0,[])();function f(m,h,p){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const x=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(w,"name",{value:"node ("+(m.type+(x?"<"+x+">":""))+")"})}return w;function w(){let x=nT,k,C,j;if((!t||o(m,h,p[p.length-1]||void 0))&&(x=Uq(n(m,p)),x[0]===Yy))return x;if("children"in m&&m.children){const E=m;if(E.children&&x[0]!==Pq)for(C=(a?E.children.length:-1)+u,j=p.concat(E);C>-1&&C<E.children.length;){const O=E.children[C];if(k=f(O,C,j)(),k[0]===Yy)return k;C=typeof k[1]=="number"?k[1]:C+u}}return x}}}function Uq(e){return Array.isArray(e)?e:typeof e=="number"?[Lq,e]:e==null?nT:[e]}function Eb(e,t,n,a){let s,o,u;typeof t=="function"&&typeof n!="function"?(o=void 0,u=t,s=n):(o=t,u=n,s=a),rT(e,o,f,s);function f(m,h){const p=h[h.length-1],g=p?p.children.indexOf(m):void 0;return u(m,g,p)}}const Xy={}.hasOwnProperty,Bq={};function Fq(e,t){const n=t||Bq,a=new Map,s=new Map,o=new Map,u={...jq,...n.handlers},f={all:h,applyData:Hq,definitionById:a,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:u,one:m,options:n,patch:$q,wrap:Zq};return Eb(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const g=p.type==="definition"?a:s,w=String(p.identifier).toUpperCase();g.has(w)||g.set(w,p)}}),f;function m(p,g){const w=p.type,x=f.handlers[w];if(Xy.call(f.handlers,w)&&x)return x(f,p,g);if(f.options.passThrough&&f.options.passThrough.includes(w)){if("children"in p){const{children:C,...j}=p,E=ah(j);return E.children=f.all(p),E}return ah(p)}return(f.options.unknownHandler||qq)(f,p,g)}function h(p){const g=[];if("children"in p){const w=p.children;let x=-1;for(;++x<w.length;){const k=f.one(w[x],p);if(k){if(x&&w[x-1].type==="break"&&(!Array.isArray(k)&&k.type==="text"&&(k.value=Lk(k.value)),!Array.isArray(k)&&k.type==="element")){const C=k.children[0];C&&C.type==="text"&&(C.value=Lk(C.value))}Array.isArray(k)?g.push(...k):g.push(k)}}}return g}}function $q(e,t){e.position&&(t.position=A$(e))}function Hq(e,t){let n=t;if(e&&e.data){const a=e.data.hName,s=e.data.hChildren,o=e.data.hProperties;if(typeof a=="string")if(n.type==="element")n.tagName=a;else{const u="children"in n?n.children:[n];n={type:"element",tagName:a,properties:{},children:u}}n.type==="element"&&o&&Object.assign(n.properties,ah(o)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function qq(e,t){const n=t.data||{},a="value"in t&&!(Xy.call(n,"hProperties")||Xy.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Zq(e,t){const n=[];let a=-1;for(t&&n.push({type:"text",value:`
|
|
392
|
-
`});++a<e.length;)a&&n.push({type:"text",value:`
|
|
393
|
-
`}),n.push(e[a]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
394
|
-
`}),n}function Lk(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Pk(e,t){const n=Fq(e,t),a=n.one(e,void 0),s=Rq(n),o=Array.isArray(a)?{type:"root",children:a}:a||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
|
|
395
|
-
`},s),o}function Gq(e,t){return e&&"run"in e?async function(n,a){const s=Pk(n,{file:a,...t});await e.run(s,a)}:function(n,a){return Pk(n,{file:a,...e||t})}}function Uk(e){if(e)throw e}var jg,Bk;function Vq(){if(Bk)return jg;Bk=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},o=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var p=e.call(h,"constructor"),g=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!p&&!g)return!1;var w;for(w in h);return typeof w>"u"||e.call(h,w)},u=function(h,p){n&&p.name==="__proto__"?n(h,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):h[p.name]=p.newValue},f=function(h,p){if(p==="__proto__")if(e.call(h,p)){if(a)return a(h,p).value}else return;return h[p]};return jg=function m(){var h,p,g,w,x,k,C=arguments[0],j=1,E=arguments.length,O=!1;for(typeof C=="boolean"&&(O=C,C=arguments[1]||{},j=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});j<E;++j)if(h=arguments[j],h!=null)for(p in h)g=f(C,p),w=f(h,p),C!==w&&(O&&w&&(o(w)||(x=s(w)))?(x?(x=!1,k=g&&s(g)?g:[]):k=g&&o(g)?g:{},u(C,{name:p,newValue:m(O,k,w)})):typeof w<"u"&&u(C,{name:p,newValue:w}));return C},jg}var Qq=Vq();const Cg=oh(Qq);function Wy(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Kq(){const e=[],t={run:n,use:a};return t;function n(...s){let o=-1;const u=s.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);f(null,...s);function f(m,...h){const p=e[++o];let g=-1;if(m){u(m);return}for(;++g<s.length;)(h[g]===null||h[g]===void 0)&&(h[g]=s[g]);s=h,p?Yq(p,f)(...h):u(null,...h)}}function a(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function Yq(e,t){let n;return a;function a(...u){const f=e.length>u.length;let m;f&&u.push(s);try{m=e.apply(this,u)}catch(h){const p=h;if(f&&n)throw p;return s(p)}f||(m&&m.then&&typeof m.then=="function"?m.then(o,s):m instanceof Error?s(m):o(m))}function s(u,...f){n||(n=!0,t(u,...f))}function o(u){s(null,u)}}const Ta={basename:Xq,dirname:Wq,extname:Jq,join:e7,sep:"/"};function Xq(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Gu(e);let n=0,a=-1,s=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else a<0&&(o=!0,a=s+1);return a<0?"":e.slice(n,a)}if(t===e)return"";let u=-1,f=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else u<0&&(o=!0,u=s+1),f>-1&&(e.codePointAt(s)===t.codePointAt(f--)?f<0&&(a=s):(f=-1,a=u));return n===a?a=u:a<0&&(a=e.length),e.slice(n,a)}function Wq(e){if(Gu(e),e.length===0)return".";let t=-1,n=e.length,a;for(;--n;)if(e.codePointAt(n)===47){if(a){t=n;break}}else a||(a=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Jq(e){Gu(e);let t=e.length,n=-1,a=0,s=-1,o=0,u;for(;t--;){const f=e.codePointAt(t);if(f===47){if(u){a=t+1;break}continue}n<0&&(u=!0,n=t+1),f===46?s<0?s=t:o!==1&&(o=1):s>-1&&(o=-1)}return s<0||n<0||o===0||o===1&&s===n-1&&s===a+1?"":e.slice(s,n)}function e7(...e){let t=-1,n;for(;++t<e.length;)Gu(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":t7(n)}function t7(e){Gu(e);const t=e.codePointAt(0)===47;let n=n7(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function n7(e,t){let n="",a=0,s=-1,o=0,u=-1,f,m;for(;++u<=e.length;){if(u<e.length)f=e.codePointAt(u);else{if(f===47)break;f=47}if(f===47){if(!(s===u-1||o===1))if(s!==u-1&&o===2){if(n.length<2||a!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(m=n.lastIndexOf("/"),m!==n.length-1){m<0?(n="",a=0):(n=n.slice(0,m),a=n.length-1-n.lastIndexOf("/")),s=u,o=0;continue}}else if(n.length>0){n="",a=0,s=u,o=0;continue}}t&&(n=n.length>0?n+"/..":"..",a=2)}else n.length>0?n+="/"+e.slice(s+1,u):n=e.slice(s+1,u),a=u-s-1;s=u,o=0}else f===46&&o>-1?o++:o=-1}return n}function Gu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const r7={cwd:a7};function a7(){return"/"}function Jy(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function i7(e){if(typeof e=="string")e=new URL(e);else if(!Jy(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return s7(e)}function s7(e){if(e.hostname!==""){const a=new TypeError('File URL host must be "localhost" or empty on darwin');throw a.code="ERR_INVALID_FILE_URL_HOST",a}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const a=t.codePointAt(n+2);if(a===70||a===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Eg=["history","path","basename","stem","extname","dirname"];class aT{constructor(t){let n;t?Jy(t)?n={path:t}:typeof t=="string"||l7(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":r7.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let a=-1;for(;++a<Eg.length;){const o=Eg[a];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let s;for(s in n)Eg.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Ta.basename(this.path):void 0}set basename(t){_g(t,"basename"),Ng(t,"basename"),this.path=Ta.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ta.dirname(this.path):void 0}set dirname(t){Fk(this.basename,"dirname"),this.path=Ta.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ta.extname(this.path):void 0}set extname(t){if(Ng(t,"extname"),Fk(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ta.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Jy(t)&&(t=i7(t)),_g(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ta.basename(this.path,this.extname):void 0}set stem(t){_g(t,"stem"),Ng(t,"stem"),this.path=Ta.join(this.dirname||"",t+(this.extname||""))}fail(t,n,a){const s=this.message(t,n,a);throw s.fatal=!0,s}info(t,n,a){const s=this.message(t,n,a);return s.fatal=void 0,s}message(t,n,a){const s=new sr(t,n,a);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Ng(e,t){if(e&&e.includes(Ta.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ta.sep+"`")}function _g(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Fk(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function l7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const o7=(function(e){const a=this.constructor.prototype,s=a[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,a),o}),c7={}.hasOwnProperty;class Nb extends o7{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Kq()}copy(){const t=new Nb;let n=-1;for(;++n<this.attachers.length;){const a=this.attachers[n];t.use(...a)}return t.data(Cg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Rg("data",this.frozen),this.namespace[t]=n,this):c7.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Rg("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...a]=this.attachers[this.freezeIndex];if(a[0]===!1)continue;a[0]===!0&&(a[0]=void 0);const s=n.call(t,...a);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=_f(t),a=this.parser||this.Parser;return Tg("parse",a),a(String(n),n)}process(t,n){const a=this;return this.freeze(),Tg("process",this.parser||this.Parser),Ag("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,u){const f=_f(t),m=a.parse(f);a.run(m,f,function(p,g,w){if(p||!g||!w)return h(p);const x=g,k=a.stringify(x,w);f7(k)?w.value=k:w.result=k,h(p,w)});function h(p,g){p||!g?u(p):o?o(g):n(void 0,g)}}}processSync(t){let n=!1,a;return this.freeze(),Tg("processSync",this.parser||this.Parser),Ag("processSync",this.compiler||this.Compiler),this.process(t,s),Hk("processSync","process",n),a;function s(o,u){n=!0,Uk(o),a=u}}run(t,n,a){$k(t),this.freeze();const s=this.transformers;return!a&&typeof n=="function"&&(a=n,n=void 0),a?o(void 0,a):new Promise(o);function o(u,f){const m=_f(n);s.run(t,m,h);function h(p,g,w){const x=g||t;p?f(p):u?u(x):a(void 0,x,w)}}}runSync(t,n){let a=!1,s;return this.run(t,n,o),Hk("runSync","run",a),s;function o(u,f){Uk(u),s=f,a=!0}}stringify(t,n){this.freeze();const a=_f(n),s=this.compiler||this.Compiler;return Ag("stringify",s),$k(t),s(t,a)}use(t,...n){const a=this.attachers,s=this.namespace;if(Rg("use",this.frozen),t!=null)if(typeof t=="function")m(t,n);else if(typeof t=="object")Array.isArray(t)?f(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function o(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[p,...g]=h;m(p,g)}else u(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function u(h){if(!("plugins"in h)&&!("settings"in h))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");f(h.plugins),h.settings&&(s.settings=Cg(!0,s.settings,h.settings))}function f(h){let p=-1;if(h!=null)if(Array.isArray(h))for(;++p<h.length;){const g=h[p];o(g)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,p){let g=-1,w=-1;for(;++g<a.length;)if(a[g][0]===h){w=g;break}if(w===-1)a.push([h,...p]);else if(p.length>0){let[x,...k]=p;const C=a[w][1];Wy(C)&&Wy(x)&&(x=Cg(!0,C,x)),a[w]=[h,x,...k]}}}}const u7=new Nb().freeze();function Tg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ag(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Rg(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function $k(e){if(!Wy(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Hk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function _f(e){return d7(e)?e:new aT(e)}function d7(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function f7(e){return typeof e=="string"||h7(e)}function h7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const m7="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",qk=[],Zk={allowDangerousHtml:!0},p7=/^(https?|ircs?|mailto|xmpp)$/i,g7=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function y7(e){const t=v7(e),n=b7(e);return x7(t.runSync(t.parse(n),n),e)}function v7(e){const t=e.rehypePlugins||qk,n=e.remarkPlugins||qk,a=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Zk}:Zk;return u7().use(WH).use(n).use(Gq,a).use(t)}function b7(e){const t=e.children||"",n=new aT;return typeof t=="string"&&(n.value=t),n}function x7(e,t){const n=t.allowedElements,a=t.allowElement,s=t.components,o=t.disallowedElements,u=t.skipHtml,f=t.unwrapDisallowed,m=t.urlTransform||w7;for(const p of g7)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+m7+p.id,void 0);return Eb(e,h),z$(e,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(p,g,w){if(p.type==="raw"&&w&&typeof g=="number")return u?w.children.splice(g,1):w.children[g]={type:"text",value:p.value},g;if(p.type==="element"){let x;for(x in wg)if(Object.hasOwn(wg,x)&&Object.hasOwn(p.properties,x)){const k=p.properties[x],C=wg[x];(C===null||C.includes(p.tagName))&&(p.properties[x]=m(String(k||""),x,p))}}if(p.type==="element"){let x=n?!n.includes(p.tagName):o?o.includes(p.tagName):!1;if(!x&&a&&typeof g=="number"&&(x=!a(p,g,w)),x&&w&&typeof g=="number")return f&&p.children?w.children.splice(g,1,...p.children):w.children.splice(g,1),g}}}function w7(e){const t=e.indexOf(":"),n=e.indexOf("?"),a=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||a!==-1&&t>a||p7.test(e.slice(0,t))?e:""}function S7(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function iT(e,t,n){const s=Dh((n||{}).ignore||[]),o=k7(t);let u=-1;for(;++u<o.length;)rT(e,"text",f);function f(h,p){let g=-1,w;for(;++g<p.length;){const x=p[g],k=w?w.children:void 0;if(s(x,k?k.indexOf(x):void 0,w))return;w=x}if(w)return m(h,p)}function m(h,p){const g=p[p.length-1],w=o[u][0],x=o[u][1];let k=0;const j=g.children.indexOf(h);let E=!1,O=[];w.lastIndex=0;let A=w.exec(h.value);for(;A;){const D=A.index,z={index:A.index,input:A.input,stack:[...p,h]};let R=x(...A,z);if(typeof R=="string"&&(R=R.length>0?{type:"text",value:R}:void 0),R===!1?w.lastIndex=D+1:(k!==D&&O.push({type:"text",value:h.value.slice(k,D)}),Array.isArray(R)?O.push(...R):R&&O.push(R),k=D+A[0].length,E=!0),!w.global)break;A=w.exec(h.value)}return E?(k<h.value.length&&O.push({type:"text",value:h.value.slice(k)}),g.children.splice(j,1,...O)):O=[h],j+O.length}}function k7(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let a=-1;for(;++a<n.length;){const s=n[a];t.push([j7(s[0]),C7(s[1])])}return t}function j7(e){return typeof e=="string"?new RegExp(S7(e),"g"):e}function C7(e){return typeof e=="function"?e:function(){return e}}function E7(e){iT(e,[/\r?\n|\r/g,N7])}function N7(){return{type:"break"}}function _7(){return function(e){E7(e)}}function Gk(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let a=0,s=n.indexOf(t);for(;s!==-1;)a++,s=n.indexOf(t,s+t.length);return a}const Og="phrasing",Mg=["autolink","link","image","label"];function T7(){return{transforms:[I7],enter:{literalAutolink:R7,literalAutolinkEmail:Dg,literalAutolinkHttp:Dg,literalAutolinkWww:Dg},exit:{literalAutolink:z7,literalAutolinkEmail:D7,literalAutolinkHttp:O7,literalAutolinkWww:M7}}}function A7(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Og,notInConstruct:Mg},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Og,notInConstruct:Mg},{character:":",before:"[ps]",after:"\\/",inConstruct:Og,notInConstruct:Mg}]}}function R7(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Dg(e){this.config.enter.autolinkProtocol.call(this,e)}function O7(e){this.config.exit.autolinkProtocol.call(this,e)}function M7(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function D7(e){this.config.exit.autolinkEmail.call(this,e)}function z7(e){this.exit(e)}function I7(e){iT(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,L7],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),P7]],{ignore:["link","linkReference"]})}function L7(e,t,n,a,s){let o="";if(!sT(s)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!U7(n)))return!1;const u=B7(n+a);if(!u[0])return!1;const f={type:"link",title:null,url:o+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[f,{type:"text",value:u[1]}]:f}function P7(e,t,n,a){return!sT(a,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function U7(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function B7(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")");const s=Gk(e,"(");let o=Gk(e,")");for(;a!==-1&&s>o;)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),o++;return[e,n]}function sT(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||al(n)||Rh(n))&&(!t||n!==47)}lT.peek=K7;function F7(){this.buffer()}function $7(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function H7(){this.buffer()}function q7(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Z7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function G7(e){this.exit(e)}function V7(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=wa(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Q7(e){this.exit(e)}function K7(){return"["}function lT(e,t,n,a){const s=n.createTracker(a);let o=s.move("[^");const u=n.enter("footnoteReference"),f=n.enter("reference");return o+=s.move(n.safe(n.associationId(e),{after:"]",before:o})),f(),u(),o+=s.move("]"),o}function Y7(){return{enter:{gfmFootnoteCallString:F7,gfmFootnoteCall:$7,gfmFootnoteDefinitionLabelString:H7,gfmFootnoteDefinition:q7},exit:{gfmFootnoteCallString:Z7,gfmFootnoteCall:G7,gfmFootnoteDefinitionLabelString:V7,gfmFootnoteDefinition:Q7}}}function X7(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:lT},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(a,s,o,u){const f=o.createTracker(u);let m=f.move("[^");const h=o.enter("footnoteDefinition"),p=o.enter("label");return m+=f.move(o.safe(o.associationId(a),{before:m,after:"]"})),p(),m+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),m+=f.move((t?`
|
|
396
|
-
`:" ")+o.indentLines(o.containerFlow(a,f.current()),t?oT:W7))),h(),m}}function W7(e,t,n){return t===0?e:oT(e,t,n)}function oT(e,t,n){return(n?"":" ")+e}const J7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];cT.peek=aZ;function eZ(){return{canContainEols:["delete"],enter:{strikethrough:nZ},exit:{strikethrough:rZ}}}function tZ(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:J7}],handlers:{delete:cT}}}function nZ(e){this.enter({type:"delete",children:[]},e)}function rZ(e){this.exit(e)}function cT(e,t,n,a){const s=n.createTracker(a),o=n.enter("strikethrough");let u=s.move("~~");return u+=n.containerPhrasing(e,{...s.current(),before:u,after:"~"}),u+=s.move("~~"),o(),u}function aZ(){return"~"}function iZ(e){return e.length}function sZ(e,t){const n=t||{},a=(n.align||[]).concat(),s=n.stringLength||iZ,o=[],u=[],f=[],m=[];let h=0,p=-1;for(;++p<e.length;){const C=[],j=[];let E=-1;for(e[p].length>h&&(h=e[p].length);++E<e[p].length;){const O=lZ(e[p][E]);if(n.alignDelimiters!==!1){const A=s(O);j[E]=A,(m[E]===void 0||A>m[E])&&(m[E]=A)}C.push(O)}u[p]=C,f[p]=j}let g=-1;if(typeof a=="object"&&"length"in a)for(;++g<h;)o[g]=Vk(a[g]);else{const C=Vk(a);for(;++g<h;)o[g]=C}g=-1;const w=[],x=[];for(;++g<h;){const C=o[g];let j="",E="";C===99?(j=":",E=":"):C===108?j=":":C===114&&(E=":");let O=n.alignDelimiters===!1?1:Math.max(1,m[g]-j.length-E.length);const A=j+"-".repeat(O)+E;n.alignDelimiters!==!1&&(O=j.length+O+E.length,O>m[g]&&(m[g]=O),x[g]=O),w[g]=A}u.splice(1,0,w),f.splice(1,0,x),p=-1;const k=[];for(;++p<u.length;){const C=u[p],j=f[p];g=-1;const E=[];for(;++g<h;){const O=C[g]||"";let A="",D="";if(n.alignDelimiters!==!1){const z=m[g]-(j[g]||0),R=o[g];R===114?A=" ".repeat(z):R===99?z%2?(A=" ".repeat(z/2+.5),D=" ".repeat(z/2-.5)):(A=" ".repeat(z/2),D=A):D=" ".repeat(z)}n.delimiterStart!==!1&&!g&&E.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&O==="")&&(n.delimiterStart!==!1||g)&&E.push(" "),n.alignDelimiters!==!1&&E.push(A),E.push(O),n.alignDelimiters!==!1&&E.push(D),n.padding!==!1&&E.push(" "),(n.delimiterEnd!==!1||g!==h-1)&&E.push("|")}k.push(n.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return k.join(`
|
|
397
|
-
`)}function lZ(e){return e==null?"":String(e)}function Vk(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function oZ(e,t,n,a){const s=n.enter("blockquote"),o=n.createTracker(a);o.move("> "),o.shift(2);const u=n.indentLines(n.containerFlow(e,o.current()),cZ);return s(),u}function cZ(e,t,n){return">"+(n?"":" ")+e}function uZ(e,t){return Qk(e,t.inConstruct,!0)&&!Qk(e,t.notInConstruct,!1)}function Qk(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let a=-1;for(;++a<t.length;)if(e.includes(t[a]))return!0;return!1}function Kk(e,t,n,a){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
|
|
398
|
-
`&&uZ(n.stack,n.unsafe[s]))return/[ \t]/.test(a.before)?"":" ";return`\\
|
|
399
|
-
`}function dZ(e,t){const n=String(e);let a=n.indexOf(t),s=a,o=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;a!==-1;)a===s?++o>u&&(u=o):o=1,s=a+t.length,a=n.indexOf(t,s);return u}function fZ(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function hZ(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function mZ(e,t,n,a){const s=hZ(n),o=e.value||"",u=s==="`"?"GraveAccent":"Tilde";if(fZ(e,n)){const g=n.enter("codeIndented"),w=n.indentLines(o,pZ);return g(),w}const f=n.createTracker(a),m=s.repeat(Math.max(dZ(o,s)+1,3)),h=n.enter("codeFenced");let p=f.move(m);if(e.lang){const g=n.enter(`codeFencedLang${u}`);p+=f.move(n.safe(e.lang,{before:p,after:" ",encode:["`"],...f.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${u}`);p+=f.move(" "),p+=f.move(n.safe(e.meta,{before:p,after:`
|
|
400
|
-
`,encode:["`"],...f.current()})),g()}return p+=f.move(`
|
|
401
|
-
`),o&&(p+=f.move(o+`
|
|
402
|
-
`)),p+=f.move(m),h(),p}function pZ(e,t,n){return(n?"":" ")+e}function _b(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function gZ(e,t,n,a){const s=_b(n),o=s==='"'?"Quote":"Apostrophe",u=n.enter("definition");let f=n.enter("label");const m=n.createTracker(a);let h=m.move("[");return h+=m.move(n.safe(n.associationId(e),{before:h,after:"]",...m.current()})),h+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":`
|
|
403
|
-
`,...m.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=m.move(" "+s),h+=m.move(n.safe(e.title,{before:h,after:s,...m.current()})),h+=m.move(s),f()),u(),h}function yZ(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function xu(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ih(e,t,n){const a=Eo(e),s=Eo(t);return a===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:a===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}uT.peek=vZ;function uT(e,t,n,a){const s=yZ(n),o=n.enter("emphasis"),u=n.createTracker(a),f=u.move(s);let m=u.move(n.containerPhrasing(e,{after:s,before:f,...u.current()}));const h=m.charCodeAt(0),p=ih(a.before.charCodeAt(a.before.length-1),h,s);p.inside&&(m=xu(h)+m.slice(1));const g=m.charCodeAt(m.length-1),w=ih(a.after.charCodeAt(0),g,s);w.inside&&(m=m.slice(0,-1)+xu(g));const x=u.move(s);return o(),n.attentionEncodeSurroundingInfo={after:w.outside,before:p.outside},f+m+x}function vZ(e,t,n){return n.options.emphasis||"*"}function bZ(e,t){let n=!1;return Eb(e,function(a){if("value"in a&&/\r?\n|\r/.test(a.value)||a.type==="break")return n=!0,Yy}),!!((!e.depth||e.depth<3)&&bb(e)&&(t.options.setext||n))}function xZ(e,t,n,a){const s=Math.max(Math.min(6,e.depth||1),1),o=n.createTracker(a);if(bZ(e,n)){const p=n.enter("headingSetext"),g=n.enter("phrasing"),w=n.containerPhrasing(e,{...o.current(),before:`
|
|
404
|
-
`,after:`
|
|
405
|
-
`});return g(),p(),w+`
|
|
406
|
-
`+(s===1?"=":"-").repeat(w.length-(Math.max(w.lastIndexOf("\r"),w.lastIndexOf(`
|
|
407
|
-
`))+1))}const u="#".repeat(s),f=n.enter("headingAtx"),m=n.enter("phrasing");o.move(u+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
|
|
408
|
-
`,...o.current()});return/^[\t ]/.test(h)&&(h=xu(h.charCodeAt(0))+h.slice(1)),h=h?u+" "+h:u,n.options.closeAtx&&(h+=" "+u),m(),f(),h}dT.peek=wZ;function dT(e){return e.value||""}function wZ(){return"<"}fT.peek=SZ;function fT(e,t,n,a){const s=_b(n),o=s==='"'?"Quote":"Apostrophe",u=n.enter("image");let f=n.enter("label");const m=n.createTracker(a);let h=m.move("![");return h+=m.move(n.safe(e.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(n.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=n.enter("destinationRaw"),h+=m.move(n.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=n.enter(`title${o}`),h+=m.move(" "+s),h+=m.move(n.safe(e.title,{before:h,after:s,...m.current()})),h+=m.move(s),f()),h+=m.move(")"),u(),h}function SZ(){return"!"}hT.peek=kZ;function hT(e,t,n,a){const s=e.referenceType,o=n.enter("imageReference");let u=n.enter("label");const f=n.createTracker(a);let m=f.move("![");const h=n.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return u(),n.stack=p,o(),s==="full"||!h||h!==g?m+=f.move(g+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function kZ(){return"!"}mT.peek=jZ;function mT(e,t,n){let a=e.value||"",s="`",o=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(a);)s+="`";for(/[^ \r\n]/.test(a)&&(/^[ \r\n]/.test(a)&&/[ \r\n]$/.test(a)||/^`|`$/.test(a))&&(a=" "+a+" ");++o<n.unsafe.length;){const u=n.unsafe[o],f=n.compilePattern(u);let m;if(u.atBreak)for(;m=f.exec(a);){let h=m.index;a.charCodeAt(h)===10&&a.charCodeAt(h-1)===13&&h--,a=a.slice(0,h)+" "+a.slice(m.index+1)}}return s+a+s}function jZ(){return"`"}function pT(e,t){const n=bb(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}gT.peek=CZ;function gT(e,t,n,a){const s=_b(n),o=s==='"'?"Quote":"Apostrophe",u=n.createTracker(a);let f,m;if(pT(e,n)){const p=n.stack;n.stack=[],f=n.enter("autolink");let g=u.move("<");return g+=u.move(n.containerPhrasing(e,{before:g,after:">",...u.current()})),g+=u.move(">"),f(),n.stack=p,g}f=n.enter("link"),m=n.enter("label");let h=u.move("[");return h+=u.move(n.containerPhrasing(e,{before:h,after:"](",...u.current()})),h+=u.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=n.enter("destinationLiteral"),h+=u.move("<"),h+=u.move(n.safe(e.url,{before:h,after:">",...u.current()})),h+=u.move(">")):(m=n.enter("destinationRaw"),h+=u.move(n.safe(e.url,{before:h,after:e.title?" ":")",...u.current()}))),m(),e.title&&(m=n.enter(`title${o}`),h+=u.move(" "+s),h+=u.move(n.safe(e.title,{before:h,after:s,...u.current()})),h+=u.move(s),m()),h+=u.move(")"),f(),h}function CZ(e,t,n){return pT(e,n)?"<":"["}yT.peek=EZ;function yT(e,t,n,a){const s=e.referenceType,o=n.enter("linkReference");let u=n.enter("label");const f=n.createTracker(a);let m=f.move("[");const h=n.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),u();const p=n.stack;n.stack=[],u=n.enter("reference");const g=n.safe(n.associationId(e),{before:m,after:"]",...f.current()});return u(),n.stack=p,o(),s==="full"||!h||h!==g?m+=f.move(g+"]"):s==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function EZ(){return"["}function Tb(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function NZ(e){const t=Tb(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function _Z(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function vT(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function TZ(e,t,n,a){const s=n.enter("list"),o=n.bulletCurrent;let u=e.ordered?_Z(n):Tb(n);const f=e.ordered?u==="."?")":".":NZ(n);let m=t&&n.bulletLastUsed?u===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(m=!0),vT(n)===u&&p){let g=-1;for(;++g<e.children.length;){const w=e.children[g];if(w&&w.type==="listItem"&&w.children&&w.children[0]&&w.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(u=f),n.bulletCurrent=u;const h=n.containerFlow(e,a);return n.bulletLastUsed=u,n.bulletCurrent=o,s(),h}function AZ(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function RZ(e,t,n,a){const s=AZ(n);let o=n.bulletCurrent||Tb(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let u=o.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const f=n.createTracker(a);f.move(o+" ".repeat(u-o.length)),f.shift(u);const m=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,f.current()),p);return m(),h;function p(g,w,x){return w?(x?"":" ".repeat(u))+g:(x?o:o+" ".repeat(u-o.length))+g}}function OZ(e,t,n,a){const s=n.enter("paragraph"),o=n.enter("phrasing"),u=n.containerPhrasing(e,a);return o(),s(),u}const MZ=Dh(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function DZ(e,t,n,a){return(e.children.some(function(u){return MZ(u)})?n.containerPhrasing:n.containerFlow).call(n,e,a)}function zZ(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}bT.peek=IZ;function bT(e,t,n,a){const s=zZ(n),o=n.enter("strong"),u=n.createTracker(a),f=u.move(s+s);let m=u.move(n.containerPhrasing(e,{after:s,before:f,...u.current()}));const h=m.charCodeAt(0),p=ih(a.before.charCodeAt(a.before.length-1),h,s);p.inside&&(m=xu(h)+m.slice(1));const g=m.charCodeAt(m.length-1),w=ih(a.after.charCodeAt(0),g,s);w.inside&&(m=m.slice(0,-1)+xu(g));const x=u.move(s+s);return o(),n.attentionEncodeSurroundingInfo={after:w.outside,before:p.outside},f+m+x}function IZ(e,t,n){return n.options.strong||"*"}function LZ(e,t,n,a){return n.safe(e.value,a)}function PZ(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function UZ(e,t,n){const a=(vT(n)+(n.options.ruleSpaces?" ":"")).repeat(PZ(n));return n.options.ruleSpaces?a.slice(0,-1):a}const xT={blockquote:oZ,break:Kk,code:mZ,definition:gZ,emphasis:uT,hardBreak:Kk,heading:xZ,html:dT,image:fT,imageReference:hT,inlineCode:mT,link:gT,linkReference:yT,list:TZ,listItem:RZ,paragraph:OZ,root:DZ,strong:bT,text:LZ,thematicBreak:UZ};function BZ(){return{enter:{table:FZ,tableData:Yk,tableHeader:Yk,tableRow:HZ},exit:{codeText:qZ,table:$Z,tableData:zg,tableHeader:zg,tableRow:zg}}}function FZ(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function $Z(e){this.exit(e),this.data.inTable=void 0}function HZ(e){this.enter({type:"tableRow",children:[]},e)}function zg(e){this.exit(e)}function Yk(e){this.enter({type:"tableCell",children:[]},e)}function qZ(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,ZZ));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function ZZ(e,t){return t==="|"?t:e}function GZ(e){const t=e||{},n=t.tableCellPadding,a=t.tablePipeAlign,s=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
409
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:w,table:u,tableCell:m,tableRow:f}};function u(x,k,C,j){return h(p(x,C,j),x.align)}function f(x,k,C,j){const E=g(x,C,j),O=h([E]);return O.slice(0,O.indexOf(`
|
|
410
|
-
`))}function m(x,k,C,j){const E=C.enter("tableCell"),O=C.enter("phrasing"),A=C.containerPhrasing(x,{...j,before:o,after:o});return O(),E(),A}function h(x,k){return sZ(x,{align:k,alignDelimiters:a,padding:n,stringLength:s})}function p(x,k,C){const j=x.children;let E=-1;const O=[],A=k.enter("table");for(;++E<j.length;)O[E]=g(j[E],k,C);return A(),O}function g(x,k,C){const j=x.children;let E=-1;const O=[],A=k.enter("tableRow");for(;++E<j.length;)O[E]=m(j[E],x,k,C);return A(),O}function w(x,k,C){let j=xT.inlineCode(x,k,C);return C.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function VZ(){return{exit:{taskListCheckValueChecked:Xk,taskListCheckValueUnchecked:Xk,paragraph:KZ}}}function QZ(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:YZ}}}function Xk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function KZ(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const a=n.children[0];if(a&&a.type==="text"){const s=t.children;let o=-1,u;for(;++o<s.length;){const f=s[o];if(f.type==="paragraph"){u=f;break}}u===n&&(a.value=a.value.slice(1),a.value.length===0?n.children.shift():n.position&&a.position&&typeof a.position.start.offset=="number"&&(a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)))}}this.exit(e)}function YZ(e,t,n,a){const s=e.children[0],o=typeof e.checked=="boolean"&&s&&s.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",f=n.createTracker(a);o&&f.move(u);let m=xT.listItem(e,t,n,{...a,...f.current()});return o&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(p){return p+u}}function XZ(){return[T7(),Y7(),eZ(),BZ(),VZ()]}function WZ(e){return{extensions:[A7(),X7(e),tZ(),GZ(e),QZ()]}}const JZ={tokenize:iG,partial:!0},wT={tokenize:sG,partial:!0},ST={tokenize:lG,partial:!0},kT={tokenize:oG,partial:!0},eG={tokenize:cG,partial:!0},jT={name:"wwwAutolink",tokenize:rG,previous:ET},CT={name:"protocolAutolink",tokenize:aG,previous:NT},xi={name:"emailAutolink",tokenize:nG,previous:_T},La={};function tG(){return{text:La}}let $s=48;for(;$s<123;)La[$s]=xi,$s++,$s===58?$s=65:$s===91&&($s=97);La[43]=xi;La[45]=xi;La[46]=xi;La[95]=xi;La[72]=[xi,CT];La[104]=[xi,CT];La[87]=[xi,jT];La[119]=[xi,jT];function nG(e,t,n){const a=this;let s,o;return u;function u(g){return!ev(g)||!_T.call(a,a.previous)||Ab(a.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(g))}function f(g){return ev(g)?(e.consume(g),f):g===64?(e.consume(g),m):n(g)}function m(g){return g===46?e.check(eG,p,h)(g):g===45||g===95||ar(g)?(o=!0,e.consume(g),m):p(g)}function h(g){return e.consume(g),s=!0,m}function p(g){return o&&s&&fr(a.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function rG(e,t,n){const a=this;return s;function s(u){return u!==87&&u!==119||!ET.call(a,a.previous)||Ab(a.events)?n(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(JZ,e.attempt(wT,e.attempt(ST,o),n),n)(u))}function o(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function aG(e,t,n){const a=this;let s="",o=!1;return u;function u(g){return(g===72||g===104)&&NT.call(a,a.previous)&&!Ab(a.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(g),e.consume(g),f):n(g)}function f(g){if(fr(g)&&s.length<5)return s+=String.fromCodePoint(g),e.consume(g),f;if(g===58){const w=s.toLowerCase();if(w==="http"||w==="https")return e.consume(g),m}return n(g)}function m(g){return g===47?(e.consume(g),o?h:(o=!0,m)):n(g)}function h(g){return g===null||nh(g)||Ht(g)||al(g)||Rh(g)?n(g):e.attempt(wT,e.attempt(ST,p),n)(g)}function p(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function iG(e,t,n){let a=0;return s;function s(u){return(u===87||u===119)&&a<3?(a++,e.consume(u),s):u===46&&a===3?(e.consume(u),o):n(u)}function o(u){return u===null?n(u):t(u)}}function sG(e,t,n){let a,s,o;return u;function u(h){return h===46||h===95?e.check(kT,m,f)(h):h===null||Ht(h)||al(h)||h!==45&&Rh(h)?m(h):(o=!0,e.consume(h),u)}function f(h){return h===95?a=!0:(s=a,a=void 0),e.consume(h),u}function m(h){return s||a||!o?n(h):t(h)}}function lG(e,t){let n=0,a=0;return s;function s(u){return u===40?(n++,e.consume(u),s):u===41&&a<n?o(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(kT,t,o)(u):u===null||Ht(u)||al(u)?t(u):(e.consume(u),s)}function o(u){return u===41&&a++,e.consume(u),s}}function oG(e,t,n){return a;function a(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),a):f===38?(e.consume(f),o):f===93?(e.consume(f),s):f===60||f===null||Ht(f)||al(f)?t(f):n(f)}function s(f){return f===null||f===40||f===91||Ht(f)||al(f)?t(f):a(f)}function o(f){return fr(f)?u(f):n(f)}function u(f){return f===59?(e.consume(f),a):fr(f)?(e.consume(f),u):n(f)}}function cG(e,t,n){return a;function a(o){return e.consume(o),s}function s(o){return ar(o)?n(o):t(o)}}function ET(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Ht(e)}function NT(e){return!fr(e)}function _T(e){return!(e===47||ev(e))}function ev(e){return e===43||e===45||e===46||e===95||ar(e)}function Ab(e){let t=e.length,n=!1;for(;t--;){const a=e[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){n=!0;break}if(a._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const uG={tokenize:vG,partial:!0};function dG(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:pG,continuation:{tokenize:gG},exit:yG}},text:{91:{name:"gfmFootnoteCall",tokenize:mG},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:fG,resolveTo:hG}}}}function fG(e,t,n){const a=this;let s=a.events.length;const o=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let u;for(;s--;){const m=a.events[s][1];if(m.type==="labelImage"){u=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!u||!u._balanced)return n(m);const h=wa(a.sliceSerialize({start:u.end,end:a.now()}));return h.codePointAt(0)!==94||!o.includes(h.slice(1))?n(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function hG(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const a={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},f=[e[n+1],e[n+2],["enter",a,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",o,t],["enter",u,t],["exit",u,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",a,t]];return e.splice(n,e.length-n+1,...f),e}function mG(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o=0,u;return f;function f(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(g){if(o>999||g===93&&!u||g===null||g===91||Ht(g))return n(g);if(g===93){e.exit("chunkString");const w=e.exit("gfmFootnoteCallString");return s.includes(wa(a.sliceSerialize(w)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return Ht(g)||(u=!0),o++,e.consume(g),g===92?p:h}function p(g){return g===91||g===92||g===93?(e.consume(g),o++,h):h(g)}}function pG(e,t,n){const a=this,s=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]);let o,u=0,f;return m;function m(k){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(k){return k===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(k)}function p(k){if(u>999||k===93&&!f||k===null||k===91||Ht(k))return n(k);if(k===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return o=wa(a.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(k),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),w}return Ht(k)||(f=!0),u++,e.consume(k),k===92?g:p}function g(k){return k===91||k===92||k===93?(e.consume(k),u++,p):p(k)}function w(k){return k===58?(e.enter("definitionMarker"),e.consume(k),e.exit("definitionMarker"),s.includes(o)||s.push(o),Et(e,x,"gfmFootnoteDefinitionWhitespace")):n(k)}function x(k){return t(k)}}function gG(e,t,n){return e.check(Zu,t,e.attempt(uG,t,n))}function yG(e){e.exit("gfmFootnoteDefinition")}function vG(e,t,n){const a=this;return Et(e,s,"gfmFootnoteDefinitionIndent",5);function s(o){const u=a.events[a.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(o):n(o)}}function bG(e){let n=(e||{}).singleTilde;const a={name:"strikethrough",tokenize:o,resolveAll:s};return n==null&&(n=!0),{text:{126:a},insideSpan:{null:[a]},attentionMarkers:{null:[126]}};function s(u,f){let m=-1;for(;++m<u.length;)if(u[m][0]==="enter"&&u[m][1].type==="strikethroughSequenceTemporary"&&u[m][1]._close){let h=m;for(;h--;)if(u[h][0]==="exit"&&u[h][1].type==="strikethroughSequenceTemporary"&&u[h][1]._open&&u[m][1].end.offset-u[m][1].start.offset===u[h][1].end.offset-u[h][1].start.offset){u[m][1].type="strikethroughSequence",u[h][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},u[h][1].start),end:Object.assign({},u[m][1].end)},g={type:"strikethroughText",start:Object.assign({},u[h][1].end),end:Object.assign({},u[m][1].start)},w=[["enter",p,f],["enter",u[h][1],f],["exit",u[h][1],f],["enter",g,f]],x=f.parser.constructs.insideSpan.null;x&&Zr(w,w.length,0,Oh(x,u.slice(h+1,m),f)),Zr(w,w.length,0,[["exit",g,f],["enter",u[m][1],f],["exit",u[m][1],f],["exit",p,f]]),Zr(u,h-1,m-h+3,w),m=h+w.length-2;break}}for(m=-1;++m<u.length;)u[m][1].type==="strikethroughSequenceTemporary"&&(u[m][1].type="data");return u}function o(u,f,m){const h=this.previous,p=this.events;let g=0;return w;function w(k){return h===126&&p[p.length-1][1].type!=="characterEscape"?m(k):(u.enter("strikethroughSequenceTemporary"),x(k))}function x(k){const C=Eo(h);if(k===126)return g>1?m(k):(u.consume(k),g++,x);if(g<2&&!n)return m(k);const j=u.exit("strikethroughSequenceTemporary"),E=Eo(k);return j._open=!E||E===2&&!!C,j._close=!C||C===2&&!!E,f(k)}}}class xG{constructor(){this.map=[]}add(t,n,a){wG(this,t,n,a)}consume(t){if(this.map.sort(function(o,u){return o[0]-u[0]}),this.map.length===0)return;let n=this.map.length;const a=[];for(;n>0;)n-=1,a.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];a.push(t.slice()),t.length=0;let s=a.pop();for(;s;){for(const o of s)t.push(o);s=a.pop()}this.map.length=0}}function wG(e,t,n,a){let s=0;if(!(n===0&&a.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...a);return}s+=1}e.map.push([t,n,a])}}function SG(e,t){let n=!1;const a=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=a.length-1;a[o]=a[o]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return a}function kG(){return{flow:{null:{name:"table",tokenize:jG,resolveAll:CG}}}}function jG(e,t,n){const a=this;let s=0,o=0,u;return f;function f(L){let I=a.events.length-1;for(;I>-1;){const Y=a.events[I][1].type;if(Y==="lineEnding"||Y==="linePrefix")I--;else break}const Q=I>-1?a.events[I][1].type:null,te=Q==="tableHead"||Q==="tableRow"?R:m;return te===R&&a.parser.lazy[a.now().line]?n(L):te(L)}function m(L){return e.enter("tableHead"),e.enter("tableRow"),h(L)}function h(L){return L===124||(u=!0,o+=1),p(L)}function p(L){return L===null?n(L):Ze(L)?o>1?(o=0,a.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),x):n(L):gt(L)?Et(e,p,"whitespace")(L):(o+=1,u&&(u=!1,s+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),u=!0,p):(e.enter("data"),g(L)))}function g(L){return L===null||L===124||Ht(L)?(e.exit("data"),p(L)):(e.consume(L),L===92?w:g)}function w(L){return L===92||L===124?(e.consume(L),g):g(L)}function x(L){return a.interrupt=!1,a.parser.lazy[a.now().line]?n(L):(e.enter("tableDelimiterRow"),u=!1,gt(L)?Et(e,k,"linePrefix",a.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):k(L))}function k(L){return L===45||L===58?j(L):L===124?(u=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),C):z(L)}function C(L){return gt(L)?Et(e,j,"whitespace")(L):j(L)}function j(L){return L===58?(o+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),E):L===45?(o+=1,E(L)):L===null||Ze(L)?D(L):z(L)}function E(L){return L===45?(e.enter("tableDelimiterFiller"),O(L)):z(L)}function O(L){return L===45?(e.consume(L),O):L===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),A):(e.exit("tableDelimiterFiller"),A(L))}function A(L){return gt(L)?Et(e,D,"whitespace")(L):D(L)}function D(L){return L===124?k(L):L===null||Ze(L)?!u||s!==o?z(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):z(L)}function z(L){return n(L)}function R(L){return e.enter("tableRow"),F(L)}function F(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),F):L===null||Ze(L)?(e.exit("tableRow"),t(L)):gt(L)?Et(e,F,"whitespace")(L):(e.enter("data"),B(L))}function B(L){return L===null||L===124||Ht(L)?(e.exit("data"),F(L)):(e.consume(L),L===92?ee:B)}function ee(L){return L===92||L===124?(e.consume(L),B):B(L)}}function CG(e,t){let n=-1,a=!0,s=0,o=[0,0,0,0],u=[0,0,0,0],f=!1,m=0,h,p,g;const w=new xG;for(;++n<e.length;){const x=e[n],k=x[1];x[0]==="enter"?k.type==="tableHead"?(f=!1,m!==0&&(Wk(w,t,m,h,p),p=void 0,m=0),h={type:"table",start:Object.assign({},k.start),end:Object.assign({},k.end)},w.add(n,0,[["enter",h,t]])):k.type==="tableRow"||k.type==="tableDelimiterRow"?(a=!0,g=void 0,o=[0,0,0,0],u=[0,n+1,0,0],f&&(f=!1,p={type:"tableBody",start:Object.assign({},k.start),end:Object.assign({},k.end)},w.add(n,0,[["enter",p,t]])),s=k.type==="tableDelimiterRow"?2:p?3:1):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")?(a=!1,u[2]===0&&(o[1]!==0&&(u[0]=u[1],g=Tf(w,t,o,s,void 0,g),o=[0,0,0,0]),u[2]=n)):k.type==="tableCellDivider"&&(a?a=!1:(o[1]!==0&&(u[0]=u[1],g=Tf(w,t,o,s,void 0,g)),o=u,u=[o[1],n,0,0])):k.type==="tableHead"?(f=!0,m=n):k.type==="tableRow"||k.type==="tableDelimiterRow"?(m=n,o[1]!==0?(u[0]=u[1],g=Tf(w,t,o,s,n,g)):u[1]!==0&&(g=Tf(w,t,u,s,n,g)),s=0):s&&(k.type==="data"||k.type==="tableDelimiterMarker"||k.type==="tableDelimiterFiller")&&(u[3]=n)}for(m!==0&&Wk(w,t,m,h,p),w.consume(t.events),n=-1;++n<t.events.length;){const x=t.events[n];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=SG(t.events,n))}return e}function Tf(e,t,n,a,s,o){const u=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",f="tableContent";n[0]!==0&&(o.end=Object.assign({},Xl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const m=Xl(t.events,n[1]);if(o={type:u,start:Object.assign({},m),end:Object.assign({},m)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const h=Xl(t.events,n[2]),p=Xl(t.events,n[3]),g={type:f,start:Object.assign({},h),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",g,t]]),a!==2){const w=t.events[n[2]],x=t.events[n[3]];if(w[1].end=Object.assign({},x[1].end),w[1].type="chunkText",w[1].contentType="text",n[3]>n[2]+1){const k=n[2]+1,C=n[3]-n[2]-1;e.add(k,C,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return s!==void 0&&(o.end=Object.assign({},Xl(t.events,s)),e.add(s,0,[["exit",o,t]]),o=void 0),o}function Wk(e,t,n,a,s){const o=[],u=Xl(t.events,n);s&&(s.end=Object.assign({},u),o.push(["exit",s,t])),a.end=Object.assign({},u),o.push(["exit",a,t]),e.add(n+1,0,o)}function Xl(e,t){const n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}const EG={name:"tasklistCheck",tokenize:_G};function NG(){return{text:{91:EG}}}function _G(e,t,n){const a=this;return s;function s(m){return a.previous!==null||!a._gfmTasklistFirstContentOfListItem?n(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),o)}function o(m){return Ht(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),u):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),u):n(m)}function u(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):n(m)}function f(m){return Ze(m)?t(m):gt(m)?e.check({tokenize:TG},t,n)(m):n(m)}}function TG(e,t,n){return Et(e,a,"whitespace");function a(s){return s===null?n(s):t(s)}}function AG(e){return P_([tG(),dG(),bG(e),kG(),NG()])}const RG={};function OG(e){const t=this,n=e||RG,a=t.data(),s=a.micromarkExtensions||(a.micromarkExtensions=[]),o=a.fromMarkdownExtensions||(a.fromMarkdownExtensions=[]),u=a.toMarkdownExtensions||(a.toMarkdownExtensions=[]);s.push(AG(n)),o.push(XZ()),u.push(WZ(n))}function Ih({children:e,className:t,components:n}){return l.jsx("div",{className:Oe("prose prose-sm max-w-none leading-[1.55] text-[color:inherit]","prose-headings:text-current prose-p:text-current prose-li:text-current prose-strong:text-current prose-em:text-current prose-blockquote:text-current","prose-p:my-2 prose-headings:mt-3 prose-headings:mb-1.5 prose-ul:my-2 prose-ol:my-2 prose-li:my-0.5 prose-pre:my-2 prose-blockquote:my-2 prose-hr:my-3","prose-a:text-[color:var(--accent)] prose-a:no-underline hover:prose-a:underline","prose-code:text-current prose-code:bg-[color:var(--bg-sunken)] prose-code:rounded prose-code:px-1 prose-code:py-0.5 prose-code:text-[0.9em] prose-code:before:content-none prose-code:after:content-none","prose-pre:bg-[color:var(--bg-sunken)] prose-pre:text-current prose-pre:border prose-pre:border-[color:var(--border)]","prose-hr:border-[color:var(--border)]","prose-blockquote:border-l-[color:var(--border-strong)] prose-blockquote:text-[color:var(--fg-2)]","prose-th:border-[color:var(--border)] prose-td:border-[color:var(--border)]",t),children:l.jsx(y7,{remarkPlugins:[OG,_7],components:{a:({node:a,...s})=>l.jsx("a",{...s,target:"_blank",rel:"noopener noreferrer"}),...n},children:e})})}function MG({value:e,baseline:t,onChange:n,onRevert:a,disabled:s}){const[o,u]=b.useState(!1),f=b.useRef(null),m=e!==t;return b.useEffect(()=>{var h;o&&((h=f.current)==null||h.focus())},[o]),l.jsxs(Xn,{style:{borderColor:m?"color-mix(in oklch, var(--state-blocked) 70%, transparent)":void 0},children:[l.jsxs(za,{children:[l.jsxs(Ia,{children:["System prompt append",m&&l.jsx(DG,{})]}),!o&&!s&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>u(!0),children:[l.jsx(hh,{className:"h-3 w-3"})," Edit"]})]}),l.jsx(Vr,{children:o?l.jsxs("div",{className:"space-y-2",children:[l.jsx("textarea",{ref:f,value:e,onChange:h=>n(h.target.value),onKeyDown:h=>{h.key==="Escape"&&(h.preventDefault(),u(!1))},rows:10,className:"w-full rounded border bg-transparent p-2 font-mono text-body shadow-sm focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Appended to Claude Code's default system prompt.",maxLength:32e3,spellCheck:!1}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(xe,{size:"xs",variant:"ghost",onClick:()=>{a(),u(!1)},disabled:!m,children:"Revert"}),l.jsx(xe,{size:"xs",onClick:()=>u(!1),children:"Done"})]}),l.jsx("p",{className:"text-caption text-muted-foreground",children:"`Done` collapses this editor. The change is saved only when you click Save in the bar at the bottom of the page."})]}):l.jsx("div",{className:"rounded bg-muted p-3 text-body max-h-64 overflow-auto min-h-8",children:e?l.jsx(Ih,{children:e}):l.jsx("span",{className:"text-muted-foreground italic",children:"No prompt append."})})})]})}function DG(){return l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"color-mix(in oklch, var(--state-blocked) 16%, transparent)",color:"color-mix(in oklch, var(--state-blocked) 60%, var(--fg))"},children:"changed"})}const TT={"claude-code":"Claude Code",codex:"Codex"},zG=[th.CLAUDE_CODE,th.CODEX];function IG({open:e,onOpenChange:t,agent:n}){const a=vn(),s=n.clientId,o=n.runtimeProvider,[u,f]=b.useState(s),[m,h]=b.useState(o),[p,g]=b.useState(!1),x=We({queryKey:["clients-rebind"],queryFn:gi,enabled:e}).data??[],k=XR({queries:x.map(B=>({queryKey:["client-capabilities",B.id],queryFn:()=>mh(B.id),enabled:e}))}),C=b.useMemo(()=>{const B=new Map;return k.forEach((ee,L)=>{const I=x[L];if(!I)return;const Q=ee.data;Q!=null&&Q.capabilities&&B.set(I.id,Q.capabilities)}),B},[k,x]);b.useEffect(()=>{e||(f(s),h(o),g(!1))},[e,s,o]);const j=u?C.get(u)??null:null,E=(j==null?void 0:j[m])??null,O=!E||E.state==="missing"||E.state==="error",A=!!u&&(u!==s||m!==o)&&(!O||p),D=m!==o,z=u!==s,R=pt({mutationFn:()=>{if(!u)throw new Error("clientId required");return C4(n.uuid,{clientId:u,runtimeProvider:m,force:O&&p?!0:void 0})},onSuccess:()=>{a.invalidateQueries({queryKey:["agent",n.uuid]}),a.invalidateQueries({queryKey:["agents"]}),t(!1)}}),F=R.error instanceof xs||R.error instanceof Error?R.error.message:null;return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{className:"max-w-lg",children:[l.jsx(In,{children:l.jsx(Tn,{children:"Re-bind agent"})}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:["Currently:"," ",l.jsx("span",{className:"mono",children:PG(s,x,o)})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Computer"}),l.jsx("select",{value:u??"",onChange:B=>f(B.target.value||null),className:"w-full rounded-[var(--radius-input)] border border-input bg-background px-3 py-2 text-body",children:x.map(B=>l.jsx("option",{value:B.id,children:LG(B)},B.id))})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Runtime"}),l.jsx("div",{className:"space-y-2",children:zG.map(B=>{const ee=(j==null?void 0:j[B])??null,L=!!ee&&ee.state!=="missing",I=m===B;return l.jsxs("label",{className:I?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":L?"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30":"flex items-start gap-3 rounded-md border border-border p-3 opacity-60",children:[l.jsx("input",{type:"radio",name:"rebind-runtime",checked:I,onChange:()=>h(B),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:TT[B]}),l.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:BG(ee,B)})]})]},B)})})]}),(z||D)&&l.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2 text-caption space-y-1",children:[l.jsxs("p",{children:[l.jsx("span",{className:"font-medium",children:"Heads up:"})," active sessions on the previous computer are suspended at re-bind. Chat history is preserved."]}),D&&l.jsx("p",{children:"Some configuration fields don't transfer between providers (e.g. claude permission_mode is dropped; codex sandboxMode resets to default)."})]}),O&&l.jsxs("label",{className:"flex items-start gap-2 text-caption",style:{color:"var(--fg-2)"},children:[l.jsx("input",{type:"checkbox",checked:p,onChange:B=>g(B.target.checked),className:"mt-0.5"}),l.jsx("span",{children:"Override capability check — pick this if the destination computer is offline or the SDK was just installed and capabilities haven't refreshed yet."})]}),F&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:F})]}),l.jsxs(ir,{children:[l.jsx(xe,{variant:"outline",onClick:()=>t(!1),disabled:R.isPending,children:"Cancel"}),l.jsx(xe,{onClick:()=>R.mutate(),disabled:!A||R.isPending,children:R.isPending?"Re-binding…":"Re-bind"})]})]})})}function LG(e){return`${e.hostname??e.id} · ${e.status}`}function PG(e,t,n){const a=e?t.find(o=>o.id===e):null;return`${(a==null?void 0:a.hostname)??e??"(unbound)"} · ${TT[n]}`}const UG={"claude-code":"Run `claude login` (or set ANTHROPIC_API_KEY) on the computer.",codex:"Run `codex login` (or set CODEX_API_KEY) on the computer."};function BG(e,t){if(!e)return"Not reported on this computer.";switch(e.state){case"ok":return`Installed${e.sdkVersion?` v${e.sdkVersion}`:""}, authenticated.`;case"unauthenticated":return`Installed${e.sdkVersion?` v${e.sdkVersion}`:""}, not authenticated. ${UG[t]}`;case"missing":return"SDK not installed on this computer.";case"error":return e.error?`Probe error: ${e.error}`:"Probe error."}}const FG={prompt:"Prompt",model:"Model",mcp:"MCP",env:"Env",git:"Git"};function $G(e){if(!e.summary.anyDirty&&!e.conflictMessage&&!e.errorMessage&&!e.justSaved)return null;const t=e.summary.dirtySections.length,n=e.summary.anyDirty||e.saving;return l.jsx("div",{className:"sticky bottom-0 z-30 -mx-6 backdrop-blur",style:{padding:"var(--sp-3) var(--sp-6)",background:"color-mix(in oklch, var(--bg-raised) 94%, transparent)",borderTop:"var(--hairline) solid var(--border)"},children:l.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[l.jsxs("div",{className:"flex flex-col gap-1 text-body min-w-0",children:[e.summary.anyDirty&&l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx(nu,{state:"blocked",size:8}),l.jsxs("span",{className:"font-medium",children:[t," section",t===1?"":"s"," with unsaved changes"]}),l.jsx("span",{style:{color:"var(--fg-4)"},"aria-hidden":!0,children:"·"}),l.jsx("span",{className:"flex flex-wrap gap-1",children:e.summary.dirtySections.map(a=>l.jsx("button",{type:"button",onClick:()=>e.onJumpTo(a),className:"text-caption transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",color:"var(--fg-2)",cursor:"pointer"},children:FG[a]},a))})]}),e.justSaved&&!e.summary.anyDirty&&!e.errorMessage&&!e.conflictMessage&&l.jsxs("div",{className:"inline-flex items-center gap-1.5 text-body font-medium",style:{color:"var(--state-idle)"},children:[l.jsx(mr,{className:"h-3.5 w-3.5"}),"Saved"]}),e.saveHint&&l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.saveHint}),e.conflictMessage&&l.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-blocked)"},children:e.conflictMessage}),e.errorMessage&&l.jsx("p",{className:"text-caption font-medium",style:{color:"var(--state-error)"},children:e.errorMessage})]}),l.jsxs("div",{className:"flex gap-2 shrink-0",children:[e.conflictMessage&&l.jsx(xe,{variant:"outline",size:"sm",onClick:e.onReloadRemote,disabled:!!e.reloadingRemote,children:e.reloadingRemote?l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsx(Zf,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Loading latest…"]}):"Discard mine, load latest"}),n&&l.jsxs(l.Fragment,{children:[l.jsx(xe,{variant:"ghost",size:"sm",onClick:e.onDiscard,disabled:e.saving,children:"Discard changes"}),l.jsx(xe,{size:"sm",onClick:e.onSave,disabled:e.saving||!e.summary.anyDirty,children:e.saving?l.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[l.jsx(Zf,{className:"h-3 w-3 animate-spin","aria-hidden":!0}),"Saving…"]}):"Save"})]})]})]})})}function sh(e){return`agent-cfg-${e}`}function Hs({anchorId:e,title:t,caption:n,right:a,children:s,className:o,sectionProps:u}){return l.jsxs("section",{id:e,className:Oe("space-y-3",o),...u,children:[l.jsxs("div",{className:"flex items-end justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("h2",{className:"text-subtitle",style:{color:"var(--fg)"},children:t}),n&&l.jsx("div",{className:"text-caption",style:{color:"var(--fg-3)"},children:n})]}),a]}),l.jsx("div",{className:"space-y-3",children:s})]})}function HG(){return l.jsx("hr",{"aria-hidden":!0,style:{border:0,borderTop:"var(--hairline) solid var(--border)",margin:"var(--sp-2) 0"}})}const qG={"claude-code":{name:"Claude Code",caption:"Anthropic's Claude Code runtime. Re-bind via the agent's settings to switch computer or runtime."},codex:{name:"Codex",caption:"OpenAI's Codex CLI runtime. Re-bind via the agent's settings to switch computer or runtime."}};function ZG(e){const t=qG[e.runtimeProvider];return l.jsxs("div",{className:"space-y-3",children:[l.jsx(GG,{name:t.name,caption:t.caption,locked:!0}),l.jsx(VG,{computerLabel:e.computerLabel,statusLoading:e.computerStatusLoading??!1,statusError:e.computerStatusError??null,canBindComputer:e.canBindComputer,bindPending:e.bindComputerPending??!1,onBindComputer:e.onBindComputer,onRebind:e.onRebind}),e.modelSlot]})}function GG({name:e,caption:t,locked:n}){return l.jsxs(Xn,{children:[l.jsx(za,{children:l.jsxs(Ia,{children:["Where it runs",n&&l.jsxs("span",{className:"mono uppercase text-caption inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[l.jsx(fh,{className:"h-3 w-3","aria-hidden":!0})," locked"]})]})}),l.jsxs(Vr,{className:"space-y-1 text-body",children:[l.jsxs("div",{className:"inline-flex items-center gap-2",children:[l.jsx(VC,{className:"h-3.5 w-3.5","aria-hidden":!0,style:{color:"var(--accent)"}}),l.jsx("span",{className:"font-medium",children:e})]}),l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:t})]})]})}function VG(e){const t=!!e.computerLabel,n=!e.statusLoading&&!e.statusError;return l.jsxs(Xn,{children:[l.jsxs(za,{children:[l.jsx(Ia,{children:"Bound computer"}),n&&e.canBindComputer&&e.onBindComputer&&!t&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:e.onBindComputer,disabled:e.bindPending,title:e.bindPending?"Binding computer…":"Pick a connected computer for this agent",children:[l.jsx(Cy,{className:"h-3 w-3"}),e.bindPending?"Binding…":"Bind computer"]}),n&&t&&e.onRebind&&l.jsxs(xe,{size:"xs",variant:"outline",onClick:e.onRebind,title:"Move this agent to another computer",children:[l.jsx(Cy,{className:"h-3 w-3"}),"Re-bind"]})]}),l.jsx(Vr,{className:"text-body",children:e.statusLoading?l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Checking computer binding…"}):e.statusError?l.jsxs("p",{className:"text-caption",style:{color:"var(--state-error)"},children:["Could not verify computer binding: ",e.statusError]}):t?l.jsx("div",{className:"mono",style:{color:"var(--fg-2)"},children:e.computerLabel}):l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"No computer bound. A computer claims this agent on its first WebSocket connect, or you can pick one manually via the button above."})})]})}function QG(e){return e.isUnclaimed?"Saving: configuration stored; will apply when a computer claims this agent.":e.isOffline?"Saving: configuration stored; will apply when the computer reconnects.":e.activeSessions>0?`Saving: new chats use this immediately; ${e.activeSessions} active chat${e.activeSessions===1?"":"s"} switch on their next message.`:"Saving: new chats use this immediately."}function KG(e,t){let n=t.size+1;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function YG(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Ig(e,t){return e.map((n,a)=>({key:`${t}-${a+1}`,value:n,baseline:n,status:"unchanged"}))}function Jk(e){return e.map(t=>t.status==="deleted"?t:t.baseline==null?{...t,status:"added"}:YG(t.value,t.baseline)?{...t,status:"unchanged"}:{...t,status:"modified"})}function Lg(e,t){const n=e;return{add:a=>t(s=>{const o=s[e],u=new Set(o.map(h=>h.key)),f=KG(n,u),m=[...o,{key:f,value:a,baseline:null,status:"added"}];return{...s,[e]:Jk(m)}}),update:(a,s)=>t(o=>{const f=o[e].map(m=>m.key===a?{...m,value:s}:m);return{...o,[e]:Jk(f)}}),remove:a=>t(s=>{const u=s[e].map(f=>f.key!==a?f:f.baseline==null?null:{...f,status:"deleted"}).filter(f=>f!==null);return{...s,[e]:u}}),undo:a=>t(s=>{const u=s[e].map(f=>f.key!==a||f.baseline==null?f:{...f,value:f.baseline,status:"unchanged"});return{...s,[e]:u}})}}function ej(e){return{promptAppend:e.payload.prompt.append,model:e.payload.model,mcp:Ig(e.payload.mcpServers,"mcp"),env:Ig(e.payload.env,"env"),git:Ig(e.payload.gitRepos,"git")}}function XG(e){const[t,n]=b.useState(null),[a,s]=b.useState(null);b.useEffect(()=>{e&&a===null&&(n(e),s(ej(e)))},[e,a]);const o=a??{promptAppend:"",model:"",mcp:[],env:[],git:[]},u=(t==null?void 0:t.payload.prompt.append)??"",f=(t==null?void 0:t.payload.model)??"",m=o.promptAppend!==u,h=o.model!==f,p=b.useMemo(()=>{const R=[],F=I=>I.reduce((Q,te)=>te.status==="unchanged"?Q:Q+1,0),B=F(o.mcp),ee=F(o.env),L=F(o.git);return m&&R.push("prompt"),h&&R.push("model"),B>0&&R.push("mcp"),ee>0&&R.push("env"),L>0&&R.push("git"),{anyDirty:R.length>0,dirtySections:R,counts:{prompt:m?1:0,model:h?1:0,mcp:B,env:ee,git:L}}},[o,m,h]),g=b.useCallback(R=>{s(F=>F&&R(F))},[]),w=b.useCallback(R=>g(F=>({...F,promptAppend:R})),[g]),x=b.useCallback(()=>g(R=>({...R,promptAppend:u})),[g,u]),k=b.useCallback(R=>g(F=>({...F,model:R})),[g]),C=b.useCallback(()=>g(R=>({...R,model:f})),[g,f]),j=b.useMemo(()=>Lg("mcp",g),[g]),E=b.useMemo(()=>Lg("env",g),[g]),O=b.useMemo(()=>Lg("git",g),[g]),A=b.useCallback(()=>{n(null),s(null)},[]),D=b.useCallback(R=>{n(R),s(ej(R))},[]),z=b.useCallback(()=>{if(!a||!t)return{};const R={};m&&(R.prompt={append:a.promptAppend}),h&&(R.model=a.model);const F=p.counts.mcp>0,B=p.counts.env>0,ee=p.counts.git>0;return F&&(R.mcpServers=a.mcp.filter(L=>L.status!=="deleted").map(L=>L.value)),B&&(R.env=a.env.filter(L=>L.status!=="deleted").map(L=>{const I=L.value;return I.sensitive&&I.value===pu?{key:I.key,value:pu,sensitive:!0}:I})),ee&&(R.gitRepos=a.git.filter(L=>L.status!=="deleted").map(L=>L.value)),R},[a,t,m,h,p]);return{draft:o,summary:p,promptDirty:m,modelDirty:h,setPromptAppend:w,revertPrompt:x,setModel:k,revertModel:C,addMcp:j.add,updateMcp:j.update,deleteMcp:j.remove,undoDeleteMcp:j.undo,addEnv:E.add,updateEnv:E.update,deleteEnv:E.remove,undoDeleteEnv:E.undo,addGit:O.add,updateGit:O.update,deleteGit:O.remove,undoDeleteGit:O.undo,resetAll:A,resetToConfig:D,buildPayloadPatch:z}}const rr={overview:"ad-overview",setup:"ad-setup",prompt:sh("prompt"),tools:sh("mcp"),advanced:"ad-advanced",danger:"ad-danger"};function tj(e){return e==="model"?rr.setup:e==="mcp"?rr.tools:e==="env"||e==="git"?rr.advanced:rr.prompt}function WG(e,t){const n=[{key:"overview",label:"Profile",anchor:rr.overview}];return!e&&t&&n.push({key:"setup",label:"Setup",anchor:rr.setup},{key:"prompt",label:"Prompt",anchor:rr.prompt},{key:"tools",label:"Tools",anchor:rr.tools},{key:"advanced",label:"Advanced",anchor:rr.advanced}),t&&n.push({key:"danger",label:"Danger zone",anchor:rr.danger,divider:!0,danger:!0}),n}function JG(){var Qr,wi,ga,Si,ki,ji,js,Ln,vr,Ci,Ei;const t=EC().uuid??"",n=zn(),a=vn(),{memberId:s,role:o}=ut(),u=We({queryKey:["agent",t],queryFn:()=>S4(t),enabled:!!t}),f=j9(u.data,s,o),m=((Qr=u.data)==null?void 0:Qr.type)!=="human"&&f,h=We({queryKey:["agent-config",t],queryFn:()=>yu(t),enabled:!!t&&m}),p=We({queryKey:["agent-client-status",t],queryFn:()=>y9(t),enabled:!!t&&((wi=u.data)==null?void 0:wi.type)!=="human"}),g=We({queryKey:["agent-sessions-active",t],queryFn:()=>hE(t,{state:"active"}),enabled:!!t&&((ga=u.data)==null?void 0:ga.type)!=="human"}),w=We({queryKey:["clients"],queryFn:gi,enabled:!!t&&m,refetchInterval:3e4}),x=XG(h.data),[k,C]=b.useState(null),[j,E]=b.useState(null),[O,A]=b.useState(null),[D,z]=b.useState(!1),[R,F]=b.useState(!1),B=pt({mutationFn:async()=>{if(!h.data)throw new Error("config not loaded");const ye=x.buildPayloadPatch();return Ah(t,{expectedVersion:h.data.version,payload:ye})},onSuccess:ye=>{a.setQueryData(["agent-config",t],ye),x.resetToConfig(ye),C(null),E(null),F(!0)},onError:ye=>{if(F(!1),ye instanceof xs&&ye.status===409){E("Someone else saved a newer version while you were editing."),C(null);return}C(ye instanceof Error?ye.message:String(ye))}});b.useEffect(()=>{if(!R)return;const ye=setTimeout(()=>F(!1),2500);return()=>clearTimeout(ye)},[R]),b.useEffect(()=>{x.summary.anyDirty&&F(!1)},[x.summary.anyDirty]);const ee=x.resetToConfig,L=b.useCallback(async()=>{C(null),z(!0);try{const ye=await a.fetchQuery({queryKey:["agent-config",t],queryFn:()=>yu(t),staleTime:0});ee(ye)}catch(ye){C(ye instanceof Error?ye.message:String(ye))}finally{z(!1),E(null)}},[a,t,ee]),I=b.useCallback(ye=>{const Qe=document.getElementById(ye);Qe&&Qe.scrollIntoView({behavior:"smooth",block:"start"})},[]),Q=pt({mutationFn:ye=>Oy(t,ye),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agents"]})}}),te=pt({mutationFn:()=>dN(t),onMutate:()=>A(null),onSuccess:()=>{A(null),a.invalidateQueries({queryKey:["agent",t]})},onError:ye=>A(ye instanceof Error?ye.message:String(ye))}),Y=pt({mutationFn:()=>fN(t),onMutate:()=>A(null),onSuccess:()=>{A(null),a.invalidateQueries({queryKey:["agent",t]})},onError:ye=>A(ye instanceof Error?ye.message:String(ye))}),X=pt({mutationFn:()=>uN(t),onMutate:()=>A(null),onSuccess:()=>n("/team"),onError:ye=>A(ye instanceof Error?ye.message:String(ye))}),G=pt({mutationFn:()=>_4(t)}),[se,J]=b.useState(!1),[ve,M]=b.useState(""),[U,P]=b.useState(null),[_,V]=b.useState(!1),H=We({queryKey:["clients"],queryFn:gi,enabled:se}),ae=pt({mutationFn:ye=>Oy(t,{clientId:ye}),onSuccess:()=>{a.invalidateQueries({queryKey:["agent",t]}),a.invalidateQueries({queryKey:["agent-client-status",t]}),a.invalidateQueries({queryKey:["agents"]}),J(!1),M(""),P(null)},onError:ye=>P(ye instanceof Error?ye.message:String(ye))}),[Se,Ae]=b.useState(!1),[Ee,Ge]=b.useState(null),Fe=pt({mutationFn:()=>g9(t,x.buildPayloadPatch()),onSuccess:ye=>{const Qe=ye.diff.length?ye.diff.map(vt=>`${vt.op} ${vt.path}`).join(`
|
|
411
|
-
`):"(no changes)";Ge(Qe)},onError:ye=>Ge(`Dry run failed: ${ye instanceof Error?ye.message:String(ye)}`)});b.useEffect(()=>{if(!x.summary.anyDirty)return;const ye=Qe=>{Qe.preventDefault(),Qe.returnValue=""};return window.addEventListener("beforeunload",ye),()=>window.removeEventListener("beforeunload",ye)},[x.summary.anyDirty]);const Ve=((Si=u.data)==null?void 0:Si.type)==="human",st=b.useMemo(()=>WG(Ve,f),[Ve,f]),Nt=b.useRef(null),[we,ze]=b.useState(!1);b.useEffect(()=>{if(Ve)return;const ye=Nt.current;if(!ye||typeof IntersectionObserver>"u")return;const Qe=new IntersectionObserver(vt=>{const qn=vt[0];qn&&ze(!qn.isIntersecting&&qn.boundingClientRect.top<0)},{threshold:0});return Qe.observe(ye),()=>Qe.disconnect()},[Ve]);const[et,Ct]=b.useState(rr.overview);b.useEffect(()=>{if(typeof IntersectionObserver>"u")return;const ye=[];for(const Qe of st){const vt=document.getElementById(Qe.anchor);if(!vt)continue;const qn=new IntersectionObserver(Ua=>{for(const Fo of Ua)Fo.isIntersecting&&Ct(Qe.anchor)},{rootMargin:"0% 0% -70% 0%",threshold:0});qn.observe(vt),ye.push(qn)}return()=>{for(const Qe of ye)Qe.disconnect()}},[st]);const le=b.useMemo(()=>{const ye=new Set;for(const Qe of x.summary.dirtySections)ye.add(tj(Qe));return ye},[x.summary.dirtySections]);if(u.isLoading)return l.jsx("div",{className:"-m-6 flex",style:{minHeight:"100%"},children:l.jsx("div",{className:"p-6 text-body",style:{color:"var(--fg-3)"},children:"Loading…"})});if(u.error)return l.jsxs("div",{className:"-m-6 p-6 text-body",style:{color:"var(--state-error)"},children:["Failed to load agent: ",u.error instanceof Error?u.error.message:"Unknown error"]});const me=u.data;if(!me)return l.jsx("div",{className:"-m-6 p-6 text-body",style:{color:"var(--fg-3)"},children:"Agent not found"});const Pe=me.type==="human",qe=p.data,Gt=((ki=g.data)==null?void 0:ki.length)??0,nt=!Pe&&!qe&&p.isLoading,An=p.error instanceof Error?p.error.message:p.error?"Unknown":null,ue=!Pe&&p.isSuccess&&!(qe!=null&&qe.clientId),be=!Pe&&qe?!qe.online&&!!qe.clientId:!1,Ne=C9({agentStatus:me.status,clientStatus:qe,clientStatusLoading:nt,testPending:G.isPending}),Xe=me,wt=Xe.runtimeState??null,Rn=Xe.runtimeType??null,gr=Xe.totalSessions??null,Yt=me.uuid.slice(0,8),qt=QG({activeSessions:Gt,isUnclaimed:ue,isOffline:be}),Bt=x.draft.mcp.filter(ye=>ye.status!=="deleted"),yt=x.draft.env.filter(ye=>ye.status!=="deleted"),yr=x.draft.git.filter(ye=>ye.status!=="deleted"),$n=ye=>new Set(Bt.filter(Qe=>Qe.key!==ye).map(Qe=>Qe.value.name.toLowerCase())),Bo=ye=>new Set(yt.filter(Qe=>Qe.key!==ye).map(Qe=>Qe.value.key)),ja=ye=>new Set(yr.filter(Qe=>Qe.key!==ye).map(Qe=>{const{value:vt}=Qe;return vt.localPath?vt.localPath:((vt.url.split(/[?#]/)[0]??"").split(/[/:]/).filter(Boolean).pop()??"").replace(/\.git$/i,"")}).filter(Boolean)),lr={sessions:gr??"—",active:Gt,runtime:Rn??(Pe?"human":"—"),model:((js=(ji=h.data)==null?void 0:ji.payload.model)==null?void 0:js.trim())||"—"},ma=(qe==null?void 0:qe.clientId)??null,Hn=ma?((Ln=w.data)==null?void 0:Ln.find(ye=>ye.id===ma))??null:null,Pa=ma&&m?(Hn==null?void 0:Hn.hostname)??ma:null,pa=me.runtimeProvider??"claude-code",rn=pa==="codex"?"Codex":"Claude Code";return l.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[l.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:220,borderRight:"var(--hairline) solid var(--border)",background:"var(--bg-raised)",padding:"var(--sp-3) 0"},children:[l.jsx(ub,{style:{display:"block",padding:"var(--sp-1) var(--sp-4) var(--sp-2)"},children:"Agent"}),st.map(ye=>l.jsxs("div",{children:[ye.divider&&l.jsx("div",{"aria-hidden":!0,style:{margin:"var(--sp-2) var(--sp-3_5)",borderTop:"var(--hairline) solid var(--border)"}}),l.jsx(tV,{label:ye.label,active:et===ye.anchor,danger:ye.danger??!1,dirty:le.has(ye.anchor),onClick:()=>I(ye.anchor)})]},ye.key))]}),l.jsxs("div",{className:"flex-1 min-w-0 overflow-auto",style:{background:"var(--bg)"},children:[l.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"var(--bg-raised)"},children:[l.jsxs(v9,{style:{marginBottom:"var(--sp-2)"},children:[l.jsx(b9,{onClick:()=>n("/team"),children:"Agents"}),l.jsx(x9,{}),l.jsx(w9,{mono:!0,children:me.name??Yt})]}),l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("div",{className:"inline-flex items-center justify-center",style:{width:36,height:36,borderRadius:"var(--radius-panel)",background:"var(--bg-active)",border:"var(--hairline) solid var(--border-strong)"},children:l.jsx(Fu,{width:18,height:20,style:{color:"var(--accent)"}})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-baseline gap-2",children:[l.jsx("span",{className:"text-title",title:`agt_${Yt}`,children:me.displayName}),l.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:["@",me.name??Yt]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 text-caption",style:{color:"var(--fg-4)"},children:[l.jsx(hr,{tone:me.type==="autonomous_agent"?"accent":"neutral",children:me.type}),me.visibility&&l.jsx(hr,{tone:me.visibility==="organization"?"accent":"outline",children:me.visibility}),(qe==null?void 0:qe.offlineSince)&&l.jsxs("span",{className:"mono",children:["offline since ",uu(qe.offlineSince)]})]})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx(vu,{state:wt}),l.jsxs(xe,{variant:"ghost",size:"xs",onClick:()=>n(`/?a=${me.uuid}`),children:[l.jsx(Rv,{className:"h-3 w-3"})," Open chat"]}),!Pe&&f&&me.status==="active"&&l.jsxs(xe,{variant:"outline",size:"xs",onClick:()=>{G.reset(),G.mutate()},disabled:Ne.disabled,title:Ne.title,children:[l.jsx(VC,{className:"h-3 w-3"}),G.isPending?"Testing…":"Test"]})]})]}),l.jsxs("div",{className:"grid gap-1.5 mt-3",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[l.jsx(jf,{label:"sessions",value:lr.sessions}),l.jsx(jf,{label:"active",value:lr.active,accent:typeof lr.active=="number"&&lr.active>0?"var(--accent)":void 0}),l.jsx(jf,{label:"runtime",value:lr.runtime}),l.jsx(jf,{label:"model",value:lr.model})]})]}),l.jsx("div",{ref:Nt,"aria-hidden":!0,style:{height:0}}),!Pe&&l.jsx(M9,{runtimeLabel:rn,computerLabel:Pa,visible:we}),l.jsxs("div",{className:"mx-auto",style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)",maxWidth:960,display:"flex",flexDirection:"column",gap:20},children:[(G.data||G.error)&&l.jsx(lV,{result:G.data??{status:"error",message:"Failed to reach server"},onDismiss:()=>G.reset()}),l.jsx(Hs,{anchorId:rr.overview,title:"Profile",right:f?l.jsxs(xe,{variant:"outline",size:"xs",onClick:()=>n(`/settings/integrations?agent=${me.uuid}`),title:"Manage platform bindings in Integrations",children:[l.jsx(Cy,{className:"h-3 w-3"}),"Manage bindings"]}):null,children:l.jsx(G9,{agent:me,canEdit:f,onSave:async ye=>{await Q.mutateAsync(ye)}})}),l.jsx(Hs,{anchorId:"ad-appearance",title:"Appearance",children:l.jsx(A9,{agent:me,canEdit:f,onSave:async ye=>{await Q.mutateAsync(ye)},onRefresh:async()=>{await a.invalidateQueries({queryKey:["agent",t]}),await a.invalidateQueries({queryKey:["agents"]}),await a.invalidateQueries({queryKey:["me","chats"]}),await a.invalidateQueries({queryKey:["chat-detail"]})}})}),!Pe&&!f&&l.jsx(eV,{}),m&&l.jsxs(l.Fragment,{children:[l.jsxs(Hs,{anchorId:rr.setup,title:"Setup",caption:((vr=h.data)==null?void 0:vr.version)!=null?l.jsxs("span",{className:"mono",children:["config v",h.data.version,x.summary.anyDirty&&l.jsxs(l.Fragment,{children:[" · ",l.jsx("span",{style:{color:"var(--state-blocked)"},children:"draft"})]})]}):null,children:[h.isLoading&&l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading configuration…"}),h.error&&l.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load configuration: ",String(h.error)]}),h.data&&l.jsx(ZG,{runtimeProvider:pa,computerLabel:Pa,computerStatusLoading:nt,computerStatusError:An,canBindComputer:ue&&me.status==="active",bindComputerPending:ae.isPending,onBindComputer:()=>J(!0),onRebind:me.clientId?()=>V(!0):void 0,modelSlot:l.jsx(i$,{value:x.draft.model,baseline:((Ci=h.data)==null?void 0:Ci.payload.model)??"",onChange:x.setModel,onRevert:x.revertModel,disabled:me.status!=="active",provider:pa})})]}),l.jsx(Hs,{anchorId:rr.prompt,title:"Prompt",children:h.data?l.jsx(MG,{value:x.draft.promptAppend,baseline:((Ei=h.data)==null?void 0:Ei.payload.prompt.append)??"",onChange:x.setPromptAppend,onRevert:x.revertPrompt,disabled:me.status!=="active"}):null}),l.jsx(Hs,{anchorId:rr.tools,title:"Tools",caption:"MCP servers available to this agent",children:h.data?l.jsx(K9,{items:x.draft.mcp,otherNames:$n,onAdd:x.addMcp,onUpdate:x.updateMcp,onDelete:x.deleteMcp,onUndoDelete:x.undoDeleteMcp,disabled:me.status!=="active"}):null}),l.jsx(Hs,{anchorId:rr.advanced,title:"Advanced",caption:"Environment variables and git repositories the runtime clones into each session.",children:h.data&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{id:sh("env"),children:l.jsx(P9,{items:x.draft.env,otherKeys:Bo,onAdd:x.addEnv,onUpdate:x.updateEnv,onDelete:x.deleteEnv,onUndoDelete:x.undoDeleteEnv,disabled:me.status!=="active"})}),l.jsx("div",{id:sh("git"),children:l.jsx($9,{items:x.draft.git,otherPaths:ja,onAdd:x.addGit,onUpdate:x.updateGit,onDelete:x.deleteGit,onUndoDelete:x.undoDeleteGit,disabled:me.status!=="active"})}),Ee&&l.jsx("pre",{className:"whitespace-pre-wrap mono text-label",style:{padding:"var(--sp-2)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",color:"var(--fg-2)"},children:Ee}),x.summary.anyDirty&&l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)"},children:l.jsx("button",{type:"button",onClick:()=>Fe.mutate(),className:"underline bg-transparent border-0 cursor-pointer",style:{color:"var(--fg-3)"},disabled:Fe.isPending,children:Fe.isPending?"Computing dry-run…":"Preview server-side diff"})})]})})]}),f&&l.jsxs(l.Fragment,{children:[l.jsx(HG,{}),l.jsx(D9,{agent:me,suspendPending:te.isPending,reactivatePending:Y.isPending,deletePending:X.isPending,errorMessage:O,onSuspend:()=>te.mutate(),onReactivate:()=>Y.mutate(),onDelete:()=>X.mutate()})]})]}),m&&l.jsx($G,{summary:x.summary,saveHint:qt,conflictMessage:j,errorMessage:k,saving:B.isPending,reloadingRemote:D,justSaved:R,onSave:()=>B.mutate(),onDiscard:()=>{x.summary.anyDirty&&Ae(!0)},onReloadRemote:()=>{L()},onJumpTo:ye=>I(tj(ye))})]}),l.jsx(nV,{open:Se,onOpenChange:Ae,title:"Discard unsaved changes?",description:"Your edits to Prompt / Model / Tools / Advanced will be reverted to the last saved baseline.",confirmLabel:"Discard changes",destructive:!0,onConfirm:()=>{x.resetAll(),C(null),E(null),Ae(!1)}}),l.jsx(_n,{open:se,onOpenChange:ye=>{J(ye),ye||(M(""),P(null),ae.reset())},children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsx(Tn,{children:"Bind computer"})}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick a computer you own to pin this agent to. The bind is one-shot — once set, moving the agent requires deleting and re-creating it on the target computer."}),H.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading computers…"}):H.error?l.jsxs("div",{className:"text-body",style:{color:"var(--state-error)"},children:["Failed to load computers: ",H.error instanceof Error?H.error.message:"Unknown"]}):l.jsx(rV,{clients:H.data??[],selected:ve,onSelect:M}),U&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:U})]}),l.jsxs(ir,{children:[l.jsx(xe,{variant:"outline",onClick:()=>J(!1),children:"Cancel"}),l.jsx(xe,{disabled:!ve||ae.isPending,onClick:()=>{P(null),ae.mutate(ve)},children:ae.isPending?"Binding…":"Bind"})]})]})}),l.jsx(IG,{open:_,onOpenChange:V,agent:me})]})}function eV(){return l.jsx(Hs,{anchorId:"ad-runtime-readonly",title:"Runtime configuration",children:l.jsx("div",{className:"text-body",style:{padding:"var(--sp-3)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-panel)",background:"var(--bg-raised)",color:"var(--fg-3)"},children:"You can view this shared agent profile. Runtime configuration, bindings, testing, and lifecycle controls are limited to the agent manager or an organization admin."})})}function tV({label:e,active:t,danger:n,dirty:a,onClick:s}){return l.jsx("button",{type:"button",onClick:s,className:Oe("block w-full text-left bg-transparent text-body transition-colors cursor-pointer","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",t?"":"hover:bg-accent"),style:{padding:"var(--sp-1_25) var(--sp-4) var(--sp-1_25) var(--sp-3_5)",border:"none",borderLeft:`var(--hairline-bold) solid ${t?"var(--accent)":"transparent"}`,background:t?"var(--bg-active)":"transparent",color:t?"var(--fg)":"var(--fg-3)",fontWeight:t?500:400},children:l.jsxs("span",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"flex-1 truncate",children:e}),a&&l.jsx("span",{role:"img","aria-label":"unsaved changes",style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--state-blocked)",flexShrink:0}}),n&&!a&&l.jsx("span",{"aria-hidden":!0,style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--state-error)",flexShrink:0}})]})})}function nV(e){return l.jsx(_n,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsx(Tn,{children:e.title})}),l.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),l.jsxs(ir,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(xe,{type:"button",variant:e.destructive?"destructive":"default",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function rV({clients:e,selected:t,onSelect:n}){const a=e.filter(ik);return a.length===0?l.jsxs("div",{className:"text-body",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",padding:"var(--sp-2_5) var(--sp-3)",color:"var(--fg-3)"},children:["No connected computers available. Run"," ",l.jsx("code",{className:"mono text-label",children:"first-tree-hub connect <token>"})," on the computer that should run this agent, then reopen this dialog."]}):l.jsx("ul",{className:"max-h-64 overflow-y-auto",style:{border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",margin:0,padding:0,listStyle:"none"},children:a.map(s=>{const o=s.id===t;return l.jsx("li",{style:{borderTop:"var(--hairline) solid var(--border-faint)"},children:l.jsxs("button",{type:"button",onClick:()=>n(s.id),className:Oe("w-full text-left flex items-center gap-3"),style:{padding:"var(--sp-2) var(--sp-3)",background:o?"var(--accent-bg)":"transparent",border:"none",cursor:"pointer"},children:[l.jsx("span",{className:Oe("inline-block h-2 w-2 rounded-full shrink-0"),style:{background:ik(s)?"var(--state-idle)":"var(--fg-4)"},"aria-hidden":!0}),l.jsxs("span",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"block text-body truncate font-medium",children:s.hostname??s.id}),l.jsxs("span",{className:"block mono truncate text-caption",style:{color:"var(--fg-4)"},children:[s.id,s.os?` · ${s.os}`:"",s.sdkVersion?` · SDK ${s.sdkVersion}`:""]})]}),l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:s.status})]})},s.id)})})}const aV={success:"Connected",timeout:"Timed out",offline:"Offline",stale:"Stale",error:"Error"},iV={success:"var(--state-idle)",timeout:"var(--state-blocked)",offline:"var(--state-offline)",stale:"var(--state-blocked)",error:"var(--state-error)"},sV={success:"accent",timeout:"warn",stale:"warn",error:"error",offline:"neutral"};function lV({result:e,onDismiss:t}){const n=iV[e.status],a=sV[e.status],s=e.connection;return l.jsx("div",{style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderLeft:`var(--sp-0_75) solid ${n}`,borderRadius:"var(--radius-panel)",padding:"var(--sp-3) var(--sp-3_5)"},children:l.jsxs("div",{className:"flex items-start justify-between gap-3",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(hr,{tone:a,children:aV[e.status]}),e.responseTime!=null&&l.jsxs("span",{className:"mono text-label",style:{color:"var(--fg-4)"},children:[(e.responseTime/1e3).toFixed(1),"s"]})]}),e.message&&l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:e.message}),s&&l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",borderTop:"var(--hairline) solid var(--border-faint)",paddingTop:6,marginTop:2},children:[l.jsx("div",{children:s.runtimeState&&l.jsxs("span",{className:"mono",children:["runtime: ",s.runtimeState]})}),s.client?l.jsxs("div",{children:["Computer: ",s.client.hostname??s.client.id,s.client.os&&` (${s.client.os})`,s.client.sdkVersion&&` · SDK ${s.client.sdkVersion}`]}):l.jsx("div",{children:"No computer bound"}),s.lastSeenAt&&l.jsxs("div",{children:["Last seen: ",new Date(s.lastSeenAt).toLocaleString()]})]}),e.responseContent&&l.jsx("p",{className:"mono whitespace-pre-wrap text-label",style:{background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",padding:8,maxHeight:160,overflow:"auto"},children:e.responseContent})]}),l.jsx(xe,{variant:"ghost",size:"sm",onClick:t,children:"Dismiss"})]})})}function oV(e,t){const n=`?window=${encodeURIComponent(t)}`;return Ce.get(xy(e,`/context-tree/snapshot${n}`))}const nj="7d";function cV({previewSnapshot:e}={}){const{organizationId:t}=ut(),[n,a]=b.useState(null),s=e!==void 0,o=We({queryKey:["context-tree-snapshot",t,nj,s],queryFn:()=>{if(!t)throw new Error("No organization selected");return oV(t,nj)},enabled:!s&&!!t}),u=e??o.data,f=b.useMemo(()=>u?u.updates.find(h=>h.id===n)??u.updates[0]??null:null,[n,u]),m=(f==null?void 0:f.nodeId)??null;return b.useEffect(()=>{var h;u&&(n&&u.updates.some(p=>p.id===n)||a(((h=u.updates[0])==null?void 0:h.id)??null))},[n,u]),l.jsxs("div",{className:"context-live-page",style:{display:"flex",flexDirection:"column",gap:"var(--sp-10)"},children:[!s&&o.isLoading?l.jsx(hV,{}):null,!s&&o.error?l.jsx(mV,{message:o.error instanceof Error?o.error.message:"Failed to load"}):null,u&&(s||!o.isLoading)?u.snapshotStatus==="unavailable"?l.jsx(pV,{snapshot:u}):l.jsxs(l.Fragment,{children:[l.jsx(uV,{snapshot:u}),l.jsx(dV,{snapshot:u,selectedNodeId:m,onSelectNode:h=>{const p=u.updates.find(g=>g.nodeId===h);a((p==null?void 0:p.id)??null)}}),l.jsx(fV,{snapshot:u})]}):null]})}function uV({snapshot:e}){const t=NV(e.syncedAt)??"sync time unknown",n=CV(e.contextStatus.severity),a=e.contextStatus.severity==="ok"?null:e.contextStatus.detail??e.contextStatus.label;return l.jsxs("section",{className:"context-live-hero","aria-label":e.contextStatus.label,children:[l.jsxs("div",{className:"context-live-title-row",children:[l.jsx("span",{"aria-hidden":"true",className:"context-live-dot",style:{background:n,"--context-live-dot-color":n}}),l.jsx("h2",{className:"m-0 context-live-title",children:"Context tree is live"})]}),l.jsxs("div",{className:"text-lead context-live-subtitle",children:["Last updated at ",l.jsx("strong",{children:t})]}),a?l.jsx("div",{className:"text-body context-live-status-detail",children:a}):null]})}function dV({snapshot:e,selectedNodeId:t,onSelectNode:n}){const a=b.useMemo(()=>vV(e.nodes),[e.nodes]),s=b.useMemo(()=>wV(e.nodes,t),[e.nodes,t]),o=b.useMemo(()=>SV(a,s),[a,s]),u=Math.max(e.summary.changedNodeCount,e.updates.length);return l.jsxs("section",{className:"context-map-section","aria-label":"Context Tree update change map",children:[l.jsx("div",{className:"text-label context-map-kicker",children:"Past 7 days · Top updated domains"}),l.jsx("div",{className:"context-map-frame",children:o.length===0?l.jsx(gV,{}):l.jsxs("svg",{viewBox:"0 0 920 420",role:"img","aria-label":"Recent Context Tree update branches",preserveAspectRatio:"xMidYMid meet",className:"context-network-svg",children:[l.jsx("title",{children:"Update Change Map"}),l.jsx("circle",{className:"context-network-live-halo",cx:"460",cy:"210",r:"104"}),o.map(f=>l.jsx("path",{d:kV(f),fill:"none",stroke:f.selected?"var(--ok)":"var(--border-strong)",strokeDasharray:"5 8",strokeLinecap:"round",strokeOpacity:f.selected?.7:.36,strokeWidth:f.selected?2:1.4},`path:${f.id}`)),l.jsx("foreignObject",{x:"338",y:"122",width:"244",height:"176",className:"context-network-card-wrap",children:l.jsxs("div",{className:"context-network-summary-card",children:[l.jsx("span",{className:"context-network-summary-icon","aria-hidden":"true",children:l.jsx(BD,{size:30,strokeWidth:2.3})}),l.jsx("span",{className:"context-network-summary-title",children:"Context Tree"}),l.jsxs("span",{className:"context-network-summary-scale",children:[Pg(e.nodes.length),l.jsx("span",{children:"total nodes"})]}),l.jsxs("span",{className:"text-body context-network-summary-badge",children:["+",Pg(u)," updates"]})]})}),o.map(f=>l.jsx("foreignObject",{x:f.x,y:f.y,width:f.width,height:f.height,className:"context-network-card-wrap",children:l.jsxs("button",{type:"button",className:f.selected?"context-network-card is-live":"context-network-card",onClick:()=>n(f.representativeNodeId),children:[l.jsx("span",{className:"context-network-pin","aria-hidden":"true"}),l.jsx("span",{className:"text-subtitle context-network-title",children:f.title}),l.jsx("span",{className:"context-change-breakdown",children:xV(f.changeCounts).map(m=>l.jsxs("span",{"data-change-type":m.type,children:[Pg(m.count)," ",m.label]},m.type))})]})},f.id))]})})]})}function fV({snapshot:e}){const t=e.usage.windowDays===1?"1 day":`${e.usage.windowDays} days`,n=e.usage.agentCount===1?"1 agent":`${e.usage.agentCount} agents`,a=e.usage.usageCount===1?"1 time":`${e.usage.usageCount} times`;return l.jsxs("div",{className:"text-lead context-signal",style:{color:"var(--fg-3)"},children:[l.jsxs("span",{children:["In the last ",t,", ",l.jsx("mark",{children:n})]}),l.jsxs("span",{children:["used the tree ",l.jsx("mark",{children:a})," to make design decisions."]})]})}function hV(){return l.jsx(Xn,{children:l.jsx(Vr,{children:l.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[l.jsx(VD,{size:17}),"Loading team context..."]})})})}function mV({message:e}){return l.jsx(Xn,{children:l.jsx(Vr,{children:l.jsxs("div",{className:"flex items-center text-body",style:{color:"var(--danger)",gap:"var(--sp-2)"},children:[l.jsx(Lu,{size:17}),e]})})})}function pV({snapshot:e}){const t=e.repo?"Context Tree sync unavailable":"Connect Context Tree",n=e.repo?"Hub cannot read the team Context Tree yet. Agents and users will see context here after the server can sync the configured repo.":"Connect a Context Tree repo to show the team knowledge agents can use.",a=e.contextStatus.detail,s=e.repo?EV(e.repo):null;return l.jsx(Xn,{children:l.jsx(Vr,{children:l.jsxs("div",{className:"flex items-start text-body",style:{color:"var(--fg-2)",gap:"var(--sp-2)"},children:[l.jsx(Lu,{size:18,style:{color:"var(--warn)"}}),l.jsxs("div",{children:[l.jsx("div",{className:"font-semibold",style:{color:"var(--fg)"},children:t}),l.jsx("div",{style:{marginTop:"var(--sp-1)"},children:n}),a?l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:a}):null,e.repo||e.branch?l.jsxs("div",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[s?`Repo: ${s}`:null,e.repo&&e.branch?" · ":null,e.branch?`Branch: ${e.branch}`:null]}):null]})]})})})}function gV(){return l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"No context updates in the past 7 days."})}function yV(e){const t=new Map(e.map(a=>[a.id,a])),n=new Set;for(const a of e)a.changeType&&jV(a.id,t,n);return e.filter(a=>n.has(a.id))}function vV(e){const t=yV(e).filter(s=>s.changeType);if(t.length===0)return[];const n=new Map(e.map(s=>[s.id,s])),a=new Map;for(const s of t){const o=AT(s,n),u=a.get(o.id);if(u){a.set(o.id,{...u,updateCount:u.updateCount+1,changeCounts:rj(u.changeCounts,s.changeType),representativeNodeId:u.representativeNodeId===o.id?s.id:u.representativeNodeId});continue}a.set(o.id,{id:o.id,title:o.title,path:o.path,representativeNodeId:s.id,updateCount:1,changeCounts:rj(bV(),s.changeType)})}return[...a.values()].sort((s,o)=>o.updateCount-s.updateCount||s.path.localeCompare(o.path)).slice(0,4)}function bV(){return{added:0,edited:0,removed:0}}function rj(e,t){return t==="added"?{...e,added:e.added+1}:t==="edited"?{...e,edited:e.edited+1}:t==="removed"?{...e,removed:e.removed+1}:e}function xV(e){const t=[];return e.added>0&&t.push({type:"added",label:"added",count:e.added}),e.edited>0&&t.push({type:"edited",label:"edited",count:e.edited}),e.removed>0&&t.push({type:"removed",label:"removed",count:e.removed}),t}function wV(e,t){if(!t)return null;const n=new Map(e.map(s=>[s.id,s])),a=n.get(t);return a?AT(a,n).id:null}function SV(e,t){const n=[{x:96,y:34,width:196,height:98,anchorX:292,anchorY:83},{x:628,y:34,width:196,height:98,anchorX:628,anchorY:83},{x:96,y:286,width:196,height:98,anchorX:292,anchorY:335},{x:628,y:286,width:196,height:98,anchorX:628,anchorY:335}],a=n[n.length-1];return a?e.map((s,o)=>{const u=n[o]??a;return{...s,...u,selected:s.id===t||t===null&&o===0}}):[]}function kV(e){const s=460+(e.anchorX<460?-1:1)*124,o=210+(e.anchorY>210?48:-48),u=(s+e.anchorX)/2,f=e.anchorY>210?o+62:o-62;return`M ${s} ${o} Q ${u} ${f} ${e.anchorX} ${e.anchorY}`}function AT(e,t){let n=e,a=n.parentId?t.get(n.parentId):void 0;for(;a&&a.parentId!==null;)n=a,a=n.parentId?t.get(n.parentId):void 0;return n}function jV(e,t,n){let a=t.get(e);for(;a;)n.add(a.id),a=a.parentId?t.get(a.parentId):void 0}function CV(e){return e==="ok"?"var(--ok)":e==="warning"?"var(--warn)":"var(--danger)"}function EV(e){return e.replace(/(https?:\/\/)[^/@\s]+@/g,"$1[redacted]@")}function Pg(e){return new Intl.NumberFormat("en-US").format(e)}function NV(e){return e?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(e)):null}const Io=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:Oe("rounded-[var(--radius-panel)] border bg-card text-card-foreground shadow-sm",e),...t}));Io.displayName="Card";const Lo=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:Oe("flex flex-col space-y-1.5 p-6",e),...t}));Lo.displayName="CardHeader";const Vu=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:Oe("text-subtitle leading-none",e),...t}));Vu.displayName="CardTitle";const RT=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:Oe("text-body text-muted-foreground",e),...t}));RT.displayName="CardDescription";const Po=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:Oe("p-6 pt-0",e),...t}));Po.displayName="CardContent";const _V=b.forwardRef(({className:e,...t},n)=>l.jsx("div",{ref:n,className:Oe("flex items-center p-6 pt-0",e),...t}));_V.displayName="CardFooter";function TV(){const{token:e}=EC(),t=zn(),{isAuthenticated:n,adoptTokens:a}=ut(),[s,o]=b.useState(null),[u,f]=b.useState(null),[m,h]=b.useState(!1),[p,g]=b.useState(null);if(b.useEffect(()=>{e&&(async()=>{try{const j=await fetch(`/api/v1/invitations/${encodeURIComponent(e)}/preview`);if(!j.ok){f("This invitation is no longer valid");return}o(await j.json())}catch{f("Network error while loading invitation")}})()},[e]),b.useEffect(()=>{n&&(async()=>{try{const j=await Ce.get("/me/organizations"),E=await Ce.get("/me"),O=j.find(A=>A.id===E.member.organizationId);g((O==null?void 0:O.displayName)??null)}catch{}})()},[n]),!e)return l.jsx(aj,{message:"Bad invitation URL"});if(u)return l.jsx(aj,{message:"This invitation is no longer valid"});if(!s)return l.jsx(AV,{});const w=async()=>{h(!0);try{const j=await Ce.post("/me/organizations/join",{token:e});await a(j.tokens),PC("invite"),t("/",{replace:!0})}catch(j){f(j instanceof Error?j.message:"Failed to join team")}finally{h(!1)}},x=`/api/v1/auth/github/start?next=${encodeURIComponent(`/invite/${e}`)}`,k=n&&p&&p!==s.organizationDisplayName,C=RV(s.expiresAt);return l.jsx(Rb,{children:l.jsxs(Io,{className:"w-full max-w-sm",children:[l.jsx(Lo,{className:"text-center",children:l.jsxs(Vu,{className:"text-title",children:["You're invited to join",l.jsx("br",{}),s.organizationDisplayName]})}),l.jsxs(Po,{className:"space-y-4",children:[k&&l.jsxs("div",{className:"flex items-start gap-2 rounded-md p-3 text-label",style:{background:"var(--bg-sunken)",color:"var(--fg-2)"},children:[l.jsx(Lu,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),l.jsxs("span",{children:["You'll switch from ",l.jsx("span",{className:"font-medium",children:p})," to"," ",l.jsx("span",{className:"font-medium",children:s.organizationDisplayName}),"."]})]}),n?l.jsx(xe,{className:"w-full",disabled:m,onClick:w,children:m?"Joining…":`Join ${s.organizationDisplayName}`}):l.jsx(xe,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:x,children:[l.jsx(GC,{className:"h-4 w-4"}),"Continue with GitHub to join"]})}),C&&l.jsx("p",{className:"text-center text-label",style:{color:C.urgent?"var(--destructive)":"var(--fg-3)"},children:C.text}),l.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",l.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",l.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]})]})]})})}function Rb({children:e}){return l.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[l.jsx("header",{className:"px-4 py-3",children:l.jsxs(zu,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[l.jsx(_v,{className:"h-3.5 w-3.5"}),"Back to home"]})}),l.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:e})]})}function AV(){return l.jsx(Rb,{children:l.jsxs(Io,{className:"w-full max-w-sm",children:[l.jsxs(Lo,{className:"text-center",children:[l.jsx("div",{className:"mx-auto h-5 w-2/3 rounded-md",style:{background:"var(--bg-sunken)"}}),l.jsx("div",{className:"mx-auto mt-2 h-5 w-1/2 rounded-md",style:{background:"var(--bg-sunken)"}})]}),l.jsxs(Po,{className:"space-y-4",children:[l.jsx("div",{className:"h-9 w-full rounded-md",style:{background:"var(--bg-sunken)"}}),l.jsx("div",{className:"mx-auto h-3 w-1/3 rounded-md",style:{background:"var(--bg-sunken)"}})]})]})})}function aj({message:e}){return l.jsx(Rb,{children:l.jsxs(Io,{className:"w-full max-w-sm",children:[l.jsxs(Lo,{className:"text-center",children:[l.jsx("div",{className:"mb-2 flex justify-center text-fg-3",children:l.jsx(Lu,{className:"h-6 w-6"})}),l.jsx(Vu,{className:"text-title",children:e})]}),l.jsxs(Po,{className:"space-y-4",children:[l.jsx("p",{className:"text-center text-body text-muted-foreground",children:"It may have expired or been revoked. Ask the team admin for a fresh link."}),l.jsx(xe,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs(zu,{to:"/",children:[l.jsx(_v,{className:"h-3.5 w-3.5"}),"Back to home"]})})]})]})})}function RV(e){if(!e)return null;const t=new Date(e).getTime();if(!Number.isFinite(t))return null;const n=t-Date.now();if(n<=0)return null;const a=Math.floor(n/6e4),s=Math.floor(a/60),o=Math.floor(s/24);return o>7?null:o>=1?{text:`Expires in ${o} ${o===1?"day":"days"}`,urgent:!1}:s>=1?{text:`Expires in ${s} ${s===1?"hour":"hours"}`,urgent:!0}:{text:`Expires in ${Math.max(1,a)} ${a===1?"minute":"minutes"}`,urgent:!0}}function OV(e){if(typeof e!="object"||e===null||!("from"in e))return null;const t=e.from;if(typeof t!="object"||t===null||!("pathname"in t)||typeof t.pathname!="string"||t.pathname==="/login")return null;const n="search"in t&&typeof t.search=="string"?t.search:"",a="hash"in t&&typeof t.hash=="string"?t.hash:"",s=`${t.pathname}${n}${a}`,o=XN(s);return o===ek&&s!==ek?null:o}function MV(){const{isAuthenticated:e}=ut(),t=Rr(),n=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),a=OV(t.state)??"/",s=a==="/"?"/api/v1/auth/github/start":`/api/v1/auth/github/start?next=${encodeURIComponent(a)}`,o="/api/v1/auth/github/dev-callback?githubId=1&login=devuser&displayName=Dev+User";return e?l.jsx(tr,{to:a,replace:!0}):l.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[l.jsx("header",{className:"px-4 py-3",children:l.jsxs(zu,{to:"/",className:"inline-flex items-center gap-1.5 rounded-[var(--radius-input)] px-2 py-1 text-body text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",children:[l.jsx(_v,{className:"h-3.5 w-3.5"}),"Back to home"]})}),l.jsx("div",{className:"flex flex-1 items-center justify-center px-4 pb-16",children:l.jsxs(Io,{className:"w-full max-w-sm",children:[l.jsxs(Lo,{className:"text-center",children:[l.jsx("div",{className:"mb-2 flex justify-center text-foreground",children:l.jsx(Fu,{width:28,height:32})}),l.jsxs(Vu,{className:"text-title",children:["First Tree ",l.jsx("span",{className:"font-normal text-muted-foreground",children:"Hub"})]})]}),l.jsxs(Po,{className:"space-y-4",children:[l.jsx(xe,{asChild:!0,className:"w-full",children:l.jsxs("a",{href:s,children:[l.jsx(GC,{className:"h-4 w-4"}),"Continue with GitHub"]})}),l.jsxs("p",{className:"text-center text-label text-muted-foreground",children:["By continuing you agree to our"," ",l.jsx("a",{href:"/terms",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Terms"})," ","·"," ",l.jsx("a",{href:"/privacy",className:"underline underline-offset-2 transition-colors hover:text-foreground",children:"Privacy"})]}),n&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative my-2 text-center text-label text-muted-foreground",children:[l.jsx("span",{className:"relative z-10 bg-card px-2",children:"localhost only"}),l.jsx("div",{className:"absolute inset-x-0 top-1/2 h-px bg-border"})]}),l.jsx(xe,{asChild:!0,variant:"outline",className:"w-full",children:l.jsxs("a",{href:o,children:[l.jsx(s3,{className:"h-4 w-4"}),"Dev: skip GitHub"]})})]})]})]})})]})}function DV(){const e=zn(),{adoptTokens:t}=ut(),[n,a]=b.useState(null);return b.useEffect(()=>{const s=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,o=new URLSearchParams(s),u=o.get("access"),f=o.get("refresh"),m=XN(o.get("next")),h=o.get("joinPath");if(!u||!f){a("Sign-in did not complete. Please try again.");return}(h==="solo"||h==="invite")&&PC(h),window.history.replaceState(null,"",window.location.pathname),(async()=>(await t({accessToken:u,refreshToken:f}),e(m,{replace:!0})))()},[t,e]),l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background text-body text-muted-foreground",children:n??"Signing you in…"})}const wu=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("table",{ref:a,className:Oe("w-full",e),style:{borderCollapse:"separate",borderSpacing:0,...t},...n}));wu.displayName="DenseTable";const Su=b.forwardRef(({className:e,...t},n)=>l.jsx("thead",{ref:n,className:e,...t}));Su.displayName="DenseTableHeader";const ku=b.forwardRef(({className:e,...t},n)=>l.jsx("tbody",{ref:n,className:e,...t}));ku.displayName="DenseTableBody";const Ar=b.forwardRef(({className:e,interactive:t,selected:n,style:a,...s},o)=>l.jsx("tr",{ref:o,className:Oe("transition-colors",e),"data-interactive":t?"":void 0,"data-selected":n?"":void 0,style:{background:n?"var(--bg-active)":void 0,cursor:t?"pointer":void 0,...a},...s}));Ar.displayName="DenseTableRow";const Wt=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("th",{ref:a,className:Oe("text-left text-label whitespace-nowrap",e),style:{padding:"var(--sp-2) var(--sp-3_5)",color:"var(--fg-3)",fontWeight:500,borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));Wt.displayName="DenseTableHead";const lt=b.forwardRef(({className:e,style:t,...n},a)=>l.jsx("td",{ref:a,className:Oe("align-middle text-body",e),style:{padding:"var(--sp-2_25) var(--sp-3_5)",borderBottom:"var(--hairline) solid var(--border-faint)",...t},...n}));lt.displayName="DenseTableCell";function Uo({title:e,subtitle:t,right:n,className:a,style:s,...o}){return l.jsxs("div",{className:Oe("flex items-baseline gap-3 shrink-0",a),style:{padding:"var(--sp-4) var(--sp-5) var(--sp-3)",...s},...o,children:[l.jsx("h1",{className:"m-0 text-subtitle",style:{color:"var(--fg)"},children:e}),t&&l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:t}),l.jsx("div",{style:{flex:1}}),n]})}const zV=1500;function IV({command:e,expiresInSeconds:t,phase:n,copyLabel:a={idle:"Copy",done:"Copied"},waitingText:s="Waiting for your computer to connect…",successContent:o,errorContent:u,caption:f="Single-use · regenerates the previous one.",copyButtonPlacement:m="right"}){const[h,p]=b.useState(!1),g=async()=>{e&&(await navigator.clipboard.writeText(e),p(!0),setTimeout(()=>p(!1),zV))},w=t!==void 0?Math.max(1,Math.round(t/60)):null,x=l.jsx("pre",{className:"mono text-label",style:{margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"pre-wrap",wordBreak:"break-all",overflowWrap:"anywhere",minWidth:0,flex:m==="right"?1:void 0},title:e??"",children:e?l.jsxs(l.Fragment,{children:[e,w!==null&&l.jsxs("span",{style:{color:"var(--fg-4)"},children:[" # expires in ",w,"m"]})]}):"Generating token…"}),k=l.jsxs(xe,{type:"button",variant:"outline",size:"sm",onClick:g,disabled:!e,style:{alignSelf:"flex-start"},children:[h?l.jsx(mr,{className:"h-3.5 w-3.5"}):l.jsx(qC,{className:"h-3.5 w-3.5"}),h?a.done:a.idle]});return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[m==="right"?l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[x,k]}):l.jsxs(l.Fragment,{children:[x,k]}),f&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",margin:0},children:f}),n==="waiting"&&l.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2_5)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-blocked) 14%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 35%, transparent)",borderRadius:"var(--radius-input)",color:"color-mix(in oklch, var(--state-blocked) 35%, var(--fg))"},children:[l.jsx(LV,{}),s]}),n==="success"&&o&&l.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2_5)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-idle) 14%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-idle) 35%, transparent)",borderRadius:"var(--radius-input)",color:"color-mix(in oklch, var(--state-idle) 45%, var(--fg))"},children:[l.jsx(mr,{className:"h-3.5 w-3.5",style:{flexShrink:0}}),l.jsx("span",{style:{minWidth:0},children:o})]}),n==="error"&&u&&l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:u})]})}function LV(){return l.jsx("span",{"aria-hidden":"true",style:{width:12,height:12,flexShrink:0,borderRadius:"50%",border:"var(--hairline-bold) solid color-mix(in oklch, var(--state-blocked) 30%, transparent)",borderTopColor:"var(--state-blocked)",animation:"spin 0.85s linear infinite"}})}const PV=3e3,UV=1200;function BV({open:e,onOpenChange:t}){const n=vn(),{user:a}=ut(),[s,o]=b.useState("loading"),[u,f]=b.useState(null),[m,h]=b.useState(null),[p,g]=b.useState(null),w=b.useRef(new Set);return b.useEffect(()=>{if(!e){o("loading"),f(null),h(null),g(null),w.current=new Set;return}let x=!1;const k=(n.getQueryData(["clients"])??[]).map(C=>C.id);return w.current=new Set(k),(async()=>{try{const C=await J3();if(x)return;f(C),o("waiting")}catch(C){if(x)return;h(C instanceof Error?C.message:"Failed to generate connect token"),o("error")}})(),()=>{x=!0}},[e,n]),b.useEffect(()=>{if(!e||s!=="waiting"||!a)return;const k=setInterval(async()=>{try{const C=await n.fetchQuery({queryKey:["clients"],queryFn:gi}),j=w.current,E=C.find(O=>!j.has(O.id)&&O.status==="connected"&&O.userId===a.id);E&&(g(E.hostname??null),o("success"))}catch{}},PV);return()=>clearInterval(k)},[e,s,n,a]),b.useEffect(()=>{if(s!=="success")return;const x=setTimeout(()=>{n.invalidateQueries({queryKey:["clients"]}),t(!1)},UV);return()=>clearTimeout(x)},[s,t,n]),l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{children:[l.jsxs(In,{children:[l.jsx(Tn,{children:"Connect computer"}),l.jsx(Fv,{children:"Run this command on the machine you want to pair with this Hub."})]}),l.jsx(IV,{command:(u==null?void 0:u.command)??null,expiresInSeconds:u==null?void 0:u.expiresIn,phase:s,successContent:l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"font-semibold",children:p??"Computer"})," connected. Closing…"]}),errorContent:m}),l.jsx("div",{className:"flex justify-end",style:{gap:"var(--sp-2)"},children:l.jsx(xe,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"})})]})})}function FV({embedded:e=!1}={}){const t=vn(),n=bh(),{role:a,user:s}=ut(),o=a==="admin",[u,f]=b.useState(()=>new Set),[m,h]=b.useState(null),[p,g]=b.useState(null),[w,x]=b.useState(null),[k,C]=b.useState(!1),j=We({queryKey:["clients","org"],queryFn:X3,enabled:o,refetchInterval:1e4}),E=We({queryKey:["clients","me"],queryFn:gi,enabled:!o||j.isError,refetchInterval:1e4}),O=We({queryKey:["members"],queryFn:fb,enabled:o,staleTime:6e4}),A=o&&!j.isError,D=o&&j.isError,z=A?j.data:E.data,{data:R}=We({queryKey:["activity"],queryFn:Pu,refetchInterval:1e4}),F=pt({mutationFn:W3,onSuccess:()=>{h(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})}}),B=pt({mutationFn:Y3,onSuccess:()=>{g(null),x(null),t.invalidateQueries({queryKey:["clients"]}),t.invalidateQueries({queryKey:["activity"]})},onError:J=>{J instanceof xs?x(J.message):x(J instanceof Error?J.message:String(J))}}),ee=b.useMemo(()=>{const J=new Map;for(const ve of(R==null?void 0:R.agents)??[]){if(!ve.clientId)continue;const M=J.get(ve.clientId)??[];M.push(ve),J.set(ve.clientId,M)}return J},[R==null?void 0:R.agents]),L=J=>ee.get(J)??[],I=b.useMemo(()=>!A||!j.data||!s?[]:[...j.data].filter(J=>J.userId===s.id).sort((J,ve)=>J.lastSeenAt>ve.lastSeenAt?-1:J.lastSeenAt<ve.lastSeenAt?1:0),[A,j.data,s]),Q=b.useMemo(()=>!A||!j.data||!s?[]:[...j.data].filter(J=>J.userId!==s.id).sort((J,ve)=>J.lastSeenAt>ve.lastSeenAt?-1:J.lastSeenAt<ve.lastSeenAt?1:0),[A,j.data,s]),te=b.useMemo(()=>{const J=new Map;for(const ve of O.data??[])J.set(ve.userId,ve.displayName);return J},[O.data]),Y=J=>{if(J.userId===null)return{text:"—"};if(J.userId===(s==null?void 0:s.id)){const M=te.get(J.userId);return{text:M?`${M} (you)`:"you"}}const ve=te.get(J.userId);return ve?{text:ve}:{text:J.userId.slice(0,8),title:J.userId}},X=(z??[]).filter(J=>J.status==="connected").length,G=(z??[]).reduce((J,ve)=>J+ve.agentCount,0),se=(z??[]).filter(J=>J.authState!=="ok").length;return l.jsxs("div",{className:e?"":"-m-6",children:[l.jsx(Uo,{title:"Computers",subtitle:z&&z.length>0?l.jsxs(l.Fragment,{children:[z.length," total · ",X," connected · ",G," agents bound",se>0&&l.jsxs(l.Fragment,{children:[" · ",l.jsxs("span",{style:{color:"var(--state-error)"},children:[se," need re-auth"]})]})]}):null,right:l.jsx("div",{className:"flex items-center gap-1.5",children:l.jsxs(xe,{size:"xs",onClick:()=>C(!0),children:[l.jsx(Sa,{className:"h-3 w-3"}),"Connect computer"]})})}),l.jsxs("div",{style:{padding:"var(--sp-3_5) var(--sp-5) var(--sp-7)"},children:[l.jsx(BV,{open:k,onOpenChange:C}),p&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:l.jsxs("div",{className:"max-w-md w-full",style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:24,boxShadow:"var(--shadow-md)"},children:[l.jsx("h3",{className:"text-subtitle mb-2",children:"Retire Computer"}),l.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["Permanently remove"," ",l.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:p.hostname??p.id.slice(0,8)}),". Retire refuses if any agent is still pinned to this computer — you must delete those agents first (reassign is not available in this milestone)."]}),L(p.id).length>0&&l.jsxs("div",{className:"mb-3 p-2 rounded",style:{background:"color-mix(in oklch, var(--state-blocked) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-blocked) 28%, transparent)"},children:[l.jsx("div",{className:"text-label mb-1",children:"Agents currently bound to this computer (delete them first):"}),l.jsx("ul",{className:"text-body space-y-0.5",children:L(p.id).map(J=>l.jsx("li",{className:"font-medium",children:n(J.agentId)},J.agentId))})]}),w&&l.jsx("div",{className:"mb-3 p-2 rounded text-body",style:{background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",color:"var(--state-error)"},children:w}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(xe,{variant:"outline",size:"sm",onClick:()=>{g(null),x(null)},children:"Cancel"}),l.jsx(xe,{variant:"destructive",size:"sm",onClick:()=>B.mutate(p.id),disabled:B.isPending,children:B.isPending?"Retiring…":"Retire"})]})]})}),m&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-overlay-scrim",children:l.jsxs("div",{className:"max-w-md w-full",style:{background:"var(--bg-raised)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-panel)",padding:24,boxShadow:"var(--shadow-md)"},children:[l.jsx("h3",{className:"text-subtitle mb-2",children:"Disconnect Computer"}),l.jsxs("p",{className:"text-body mb-3",style:{color:"var(--fg-3)"},children:["This will disconnect"," ",l.jsx("span",{className:"font-medium",style:{color:"var(--fg)"},children:m.hostname??m.id.slice(0,8)})," ","and affect all bound agents:"]}),l.jsx("ul",{className:"mb-4 space-y-1",children:L(m.id).length===0?l.jsx("li",{className:"text-body",style:{color:"var(--fg-3)"},children:"No bound agents"}):L(m.id).map(J=>l.jsxs("li",{className:"text-body flex items-center gap-2",children:[l.jsx("span",{className:"font-medium",children:n(J.agentId)}),l.jsx(vu,{state:J.runtimeState})]},J.agentId))}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(xe,{variant:"outline",size:"sm",onClick:()=>h(null),children:"Cancel"}),l.jsx(xe,{variant:"destructive",size:"sm",onClick:()=>F.mutate(m.id),disabled:F.isPending,children:F.isPending?"Disconnecting…":"Disconnect"})]})]})}),!z||z.length===0?l.jsxs(Xn,{children:[D&&l.jsx(sj,{}),l.jsx("div",{className:"text-center py-10 text-body",style:{color:"var(--fg-3)"},children:"No computers connected. Use the button above to generate a connect command."})]}):l.jsxs(Xn,{children:[D&&l.jsx(sj,{}),l.jsxs($y,{children:["Registered · ",z.length]}),l.jsxs(wu,{children:[l.jsx(Su,{children:l.jsxs(Ar,{children:[l.jsx(Wt,{style:{width:16}}),l.jsx(Wt,{children:"Hostname"}),A&&l.jsx(Wt,{children:"Owner"}),l.jsx(Wt,{children:"OS"}),l.jsx(Wt,{children:"SDK"}),l.jsx(Wt,{children:"Agents"}),l.jsx(Wt,{children:"Connected"}),l.jsx(Wt,{children:"Status"}),l.jsx(Wt,{"aria-hidden":!0})]})}),l.jsx(ku,{children:A?l.jsxs(l.Fragment,{children:[l.jsx(lj,{icon:Mv,title:"Your computers",count:I.length,colSpan:Wc}),I.length===0?l.jsx(oj,{colSpan:Wc,message:"No computers of your own."}):I.map(J=>{const ve=!u.has(J.id),M=L(J.id);return l.jsx(Ug,{client:J,boundAgents:M,isExpanded:ve,agentName:n,onToggle:()=>f(U=>{const P=new Set(U);return P.has(J.id)?P.delete(J.id):P.add(J.id),P}),onDisconnect:()=>h(J),onRetire:()=>{x(null),g(J)},onReconnect:()=>C(!0),showOwner:!0,ownerLabel:Y(J)},J.id)}),l.jsx(lj,{icon:KC,title:"Team computers",count:Q.length,colSpan:Wc}),Q.length===0?l.jsx(oj,{colSpan:Wc,message:"No other team computers."}):Q.map(J=>{const ve=!u.has(J.id),M=L(J.id);return l.jsx(Ug,{client:J,boundAgents:M,isExpanded:ve,agentName:n,onToggle:()=>f(U=>{const P=new Set(U);return P.has(J.id)?P.delete(J.id):P.add(J.id),P}),onDisconnect:()=>{},onRetire:()=>{},onReconnect:()=>{},showOwner:!0,ownerLabel:Y(J),restricted:!0},J.id)})]}):z.map(J=>{const ve=!u.has(J.id),M=L(J.id);return l.jsx(Ug,{client:J,boundAgents:M,isExpanded:ve,agentName:n,onToggle:()=>f(U=>{const P=new Set(U);return P.has(J.id)?P.delete(J.id):P.add(J.id),P}),onDisconnect:()=>h(J),onRetire:()=>{x(null),g(J)},onReconnect:()=>C(!0)},J.id)})})]})]})]})]})}const $V={"claude-code":"Claude Code",codex:"Codex"},HV=[th.CLAUDE_CODE,th.CODEX],ij={"claude-code":"Run `npm install -g @anthropic-ai/claude-code` on this computer.",codex:"Install the OpenAI Codex CLI on this computer."},qV={"claude-code":"Run `claude login` (or set ANTHROPIC_API_KEY) on the computer.",codex:"Run `codex login` (or set CODEX_API_KEY) on the computer."};function ZV({clientId:e,enabled:t}){const{data:n,isLoading:a}=We({queryKey:["client-capabilities",e],queryFn:()=>mh(e),enabled:t}),s=(n==null?void 0:n.capabilities)??null;return l.jsxs(l.Fragment,{children:[l.jsx(ub,{style:{display:"block",marginBottom:6},children:"Runtimes"}),a&&!s?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):s&&Object.keys(s).length===0?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Capabilities not yet reported. Reconnect this computer to refresh."}):l.jsx("div",{className:"flex flex-col gap-1",children:HV.map(o=>l.jsx(GV,{provider:o,entry:s?s[o]??null:null},o))})]})}function GV({provider:e,entry:t}){const n=$V[e];if(!t)return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["not reported · ",ij[e]]})]});switch(t.state){case"ok":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-idle)"},children:["✓ ",t.sdkVersion?`v${t.sdkVersion} · `:"","authenticated (",t.authMethod,")"]})]});case"unauthenticated":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-blocked)"},children:["⚠ installed",t.sdkVersion?` v${t.sdkVersion}`:"",", not authenticated ·"," ",qV[e]]})]});case"missing":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",style:{opacity:.7},children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:["✗ not installed · ",ij[e]]})]});case"error":return l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:n}),l.jsxs("span",{className:"text-caption",style:{color:"var(--state-error)"},children:["error · ",t.error??"probe failed"]})]})}}function VV(){return l.jsxs("span",{className:"mono inline-flex items-center gap-1.5 uppercase text-caption",style:{color:"var(--state-error)"},children:[l.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:"var(--state-error)",display:"inline-block"}}),"AUTH EXPIRED"]})}const OT=8,Wc=OT+1;function sj(){return l.jsx("div",{className:"text-body",style:{margin:"var(--sp-3) var(--sp-3) 0",padding:"var(--sp-2_5) var(--sp-3)",borderRadius:"var(--radius-panel)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",color:"var(--state-error)"},children:"Failed to load team computers. Showing only your computers."})}function lj({icon:e,title:t,count:n,colSpan:a}){return l.jsx(Ar,{children:l.jsx("td",{colSpan:a,style:{padding:"var(--sp-6) var(--sp-3_5) var(--sp-2) 0"},children:l.jsxs("span",{className:"inline-flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(e,{className:"h-4 w-4","aria-hidden":!0,style:{color:"var(--fg-3)"}}),l.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:t}),l.jsx(hr,{tone:"outline",children:n})]})})})}function oj({colSpan:e,message:t}){return l.jsx(Ar,{children:l.jsx("td",{colSpan:e,className:"text-body",style:{padding:"var(--sp-3) var(--sp-3_5)",color:"var(--fg-4)"},children:t})})}function Ug({client:e,boundAgents:t,isExpanded:n,agentName:a,onToggle:s,onDisconnect:o,onRetire:u,onReconnect:f,showOwner:m=!1,ownerLabel:h,restricted:p=!1}){const g=m?Wc:OT,w=e.status!=="connected",x=p?!1:n,k=e.authState!=="ok",C=e.status==="connected"?"idle":"offline";return l.jsxs(l.Fragment,{children:[l.jsxs(Ar,{interactive:!p,selected:x,onClick:p?void 0:s,children:[l.jsx(lt,{style:{width:16},children:p?null:l.jsx("span",{style:{color:"var(--fg-4)",display:"inline-flex"},children:x?l.jsx(Tv,{className:"h-3.5 w-3.5"}):l.jsx(vD,{className:"h-3.5 w-3.5"})})}),l.jsx(lt,{className:"font-medium",children:e.hostname??"—"}),m&&l.jsx(lt,{style:{color:"var(--fg-3)"},title:h==null?void 0:h.title,children:(h==null?void 0:h.text)??"—"}),l.jsx(lt,{style:{color:"var(--fg-3)"},children:e.os??"—"}),l.jsx(lt,{className:"mono text-label",style:{color:"var(--fg-3)"},children:e.sdkVersion??"—"}),l.jsx(lt,{children:l.jsx("span",{className:"mono tnum text-label",children:e.agentCount})}),l.jsx(lt,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:e.connectedAt?uu(e.connectedAt):"—"}),l.jsx(lt,{children:k?l.jsx(VV,{}):l.jsx(vu,{state:C})}),l.jsx(lt,{style:{width:1,whiteSpace:"nowrap"},children:p?null:l.jsxs("div",{className:"flex items-center justify-end text-label",style:{gap:"var(--sp-3_5)"},children:[w&&l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:k?"var(--state-error)":"var(--fg-2)"},onClick:j=>{j.stopPropagation(),f()},children:"Reconnect"}),l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-2)"},onClick:j=>{j.stopPropagation(),o()},children:"Disconnect"}),l.jsx("button",{type:"button",className:"rounded-sm hover:underline focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",style:{color:"var(--fg-4)"},onClick:j=>{j.stopPropagation(),u()},children:"Retire"})]})})]}),x&&l.jsxs("tr",{style:{background:"var(--bg-sunken)"},children:[l.jsx(lt,{}),l.jsxs(lt,{colSpan:g-1,style:{padding:"var(--sp-2_5) var(--sp-3) var(--sp-3_5)"},children:[l.jsx(ZV,{clientId:e.id,enabled:x}),t.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs(ub,{style:{display:"block",marginTop:"var(--sp-3)",marginBottom:6},children:["Bound agents · ",t.length]}),l.jsx("div",{className:"flex flex-col gap-1",children:t.map(j=>l.jsxs("div",{className:"flex items-center gap-2.5 text-body",children:[l.jsx("span",{className:"font-medium",style:{minWidth:140},children:a(j.agentId)}),l.jsx(vu,{state:j.runtimeState}),j.activeSessions!==null&&l.jsxs("span",{className:"mono tnum text-caption",style:{color:"var(--fg-3)"},children:[j.activeSessions," / ",j.totalSessions??0," sessions"]})]},j.agentId))})]})]})]})]})}function QV(){return l.jsx(FV,{embedded:!0})}async function KV(e){try{return await Ce.get(`/orgs/${e}/github-app-installation`)}catch(t){if(t instanceof xs&&t.status===404)return null;throw t}}async function YV(e){const{installUrl:t}=await Ce.get(`/orgs/${e}/github-app-installation/install-url`);return t}function Qu({title:e,description:t,right:n,children:a,isFirst:s=!1}){return l.jsxs("section",{style:{padding:"var(--sp-6) 0",borderTop:s?void 0:"var(--hairline) solid var(--border-faint)"},children:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-3)"},children:[l.jsxs("div",{style:{minWidth:0},children:[l.jsx("h2",{className:"text-subtitle font-medium m-0",style:{color:"var(--fg)"},children:e}),t&&l.jsx("p",{className:"text-label m-0",style:{color:"var(--fg-3)",marginTop:"var(--sp-0_5)"},children:t})]}),n]}),l.jsx("div",{style:{marginTop:"var(--sp-4)"},children:a})]})}function XV({isFirst:e=!1}){const{organizationId:t}=ut(),n=We({queryKey:["github-app-installation",t],queryFn:()=>t?KV(t):Promise.reject(new Error("no org")),enabled:!!t});return l.jsx(Qu,{title:"GitHub App",description:"One installation unlocks user sign-in, webhook ingestion, and (later) server-side write access.",isFirst:e,children:n.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):n.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:n.error instanceof Error?n.error.message:"Failed to load installation"}):n.data==null?l.jsx(WV,{organizationId:t}):l.jsx(JV,{data:n.data})})}function WV({organizationId:e}){const t=pt({mutationFn:()=>{if(!e)throw new Error("No organization selected");return YV(e)},onSuccess:o=>{window.location.assign(o)}}),n=t.error instanceof xs&&t.error.status===503,a=t.isPending,s=!e||a;return l.jsxs("div",{children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-2)",marginBottom:"var(--sp-3)"},children:"Install the GitHub App on your personal account or organization to start receiving issues, pull requests, and reviews as routed messages."}),n?l.jsxs("p",{className:"text-body",style:{color:"var(--state-error)"},children:["The GitHub App slug isn't configured on this hub. Ask your operator to set"," ",l.jsx("code",{className:"mono",children:"FIRST_TREE_HUB_GITHUB_APP_SLUG"}),"."]}):l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",onClick:()=>t.mutate(),disabled:s,className:"inline-flex items-center justify-center font-medium",style:{gap:"var(--sp-1)",padding:"var(--sp-2) var(--sp-3)",background:"var(--accent)",color:"var(--accent-fg, white)",border:"none",borderRadius:"var(--radius-input)",cursor:s?"default":"pointer",opacity:s?.6:1},children:[a?"Opening GitHub…":"Install on GitHub",l.jsx(Av,{className:"h-3 w-3"})]}),t.error&&!n&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:t.error instanceof Error?t.error.message:"Failed to build the install URL"})]})]})}function JV({data:e}){const t=e.accountType==="Organization"?mD:Mv,n=Object.entries(e.permissions);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[e.suspended&&l.jsx(eQ,{}),l.jsxs("div",{children:[l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Connected as"}),l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsx(t,{className:"h-4 w-4",style:{color:"var(--fg-2)"}}),l.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e.accountLogin}),l.jsx("span",{className:"text-label",style:{padding:"var(--sp-0_5) var(--sp-1_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",color:"var(--fg-3)"},children:e.accountType})]})]}),n.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Permissions granted"}),l.jsx("ul",{className:"text-body",style:{listStyle:"none",padding:0,margin:0,display:"grid",gridTemplateColumns:"1fr 1fr",gap:"var(--sp-1)",color:"var(--fg-2)"},children:n.map(([a,s])=>l.jsxs("li",{className:"mono",children:[a,": ",l.jsx("strong",{style:{color:"var(--fg)"},children:s})]},a))})]}),e.events.length>0&&l.jsxs("div",{children:[l.jsx("div",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Subscribed events"}),l.jsx("div",{className:"text-body mono",style:{color:"var(--fg-2)"},children:e.events.join(", ")})]}),l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsxs("a",{href:e.manageUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center text-body",style:{gap:"var(--sp-1)",padding:"var(--sp-1_5) var(--sp-2_5)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",textDecoration:"none"},children:["Manage on GitHub",l.jsx(Av,{className:"h-3 w-3"})]}),l.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)"},children:["Installation #",e.installationId]})]})]})}function eQ(){return l.jsxs("div",{className:"flex items-start text-body",style:{gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)",color:"var(--state-warning, var(--fg-3))"},children:[l.jsx(xD,{className:"h-4 w-4 shrink-0",style:{marginTop:"var(--sp-0_5)"}}),l.jsx("span",{children:"This installation is suspended upstream. GitHub is not delivering webhooks and Hub can't act as the App on this account. Unsuspend it from the GitHub side to restore service."})]})}function tQ(){const{role:e}=ut();return e===null?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-5)",color:"var(--fg-3)"},children:"Loading..."}):e!=="admin"?l.jsx(tr,{to:"/settings/computers",replace:!0}):l.jsxs(l.Fragment,{children:[l.jsx(Uo,{title:"GitHub",subtitle:"Connected GitHub App and granted permissions"}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(XV,{isFirst:!0})})]})}function nQ(){return Ce.get(hn("/adapter-mappings"))}function rQ(e){return Ce.post(hn("/adapter-mappings"),e)}function aQ(e){return Ce.delete(`/adapter-mappings/${e}`)}function iQ(){return Ce.get(hn("/adapters/status"))}function sQ(){return Ce.get(hn("/adapters"))}function lQ(e){return Ce.post(hn("/adapters"),e)}function oQ(e,t){return Ce.patch(`/adapters/${e}`,t)}function cQ(e){return Ce.delete(`/adapters/${e}`)}const uQ=Object.values(oB),cj={platform:"feishu",feishuAppId:"",feishuAppSecret:"",credentialsJson:"{}",status:"active",externalUserId:"",displayName:"",kaelUserId:"",kaelProjectId:""};function uj(e){const[t,n]=b.useState(cj),[a,s]=b.useState("");b.useEffect(()=>{e.open&&(n({...cj,platform:e.initialPlatform??"feishu",status:e.initialStatus??"active"}),s(""))},[e.open,e.initialPlatform,e.initialStatus]);function o(f){if(f.preventDefault(),s(""),e.kind==="user"){if(!t.externalUserId)return;e.onSubmit({kind:"user-create",draft:{platform:t.platform,externalUserId:t.externalUserId,displayName:t.displayName||null}});return}if(t.platform==="feishu"){if(!e.editingId&&(!t.feishuAppId||!t.feishuAppSecret)){s("App ID and App Secret are required");return}}else if(t.platform==="kael"){if(!e.editingId&&(!t.kaelUserId||!t.kaelProjectId)){s("User ID and Project ID are required");return}}else{const h=t.credentialsJson.trim();if(!e.editingId&&!h){s("Credentials are required");return}if(h)try{JSON.parse(h)}catch{s("Invalid JSON");return}}const m=dQ(t);if(!e.editingId&&!m){s("Credentials are required");return}if(e.editingId)e.onSubmit({kind:"bot-update",status:t.status,...m?{credentials:m}:{}});else{if(!m)return;e.onSubmit({kind:"bot-create",draft:{platform:t.platform,status:t.status,credentials:m}})}}const u=e.kind==="user"?`Bind external user → ${e.agentLabel}`:e.editingId?`Edit bot binding · ${e.agentLabel}`:`Bind bot → ${e.agentLabel}`;return l.jsx(_n,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsx(Tn,{children:u})}),l.jsxs("form",{onSubmit:o,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"binding-platform",children:"Platform"}),l.jsx("select",{id:"binding-platform",value:t.platform,onChange:f=>n({...t,platform:f.target.value}),disabled:!!e.editingId,className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:opacity-50",children:uQ.map(f=>l.jsx("option",{value:f,children:f},f))})]}),e.kind==="user"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"binding-ext-id",children:"External user ID"}),l.jsx(Kt,{id:"binding-ext-id",value:t.externalUserId,onChange:f=>n({...t,externalUserId:f.target.value}),placeholder:"ou_xxxxxxxx...",className:"font-mono",required:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"binding-name",children:"Display name (optional)"}),l.jsx(Kt,{id:"binding-name",value:t.displayName,onChange:f=>n({...t,displayName:f.target.value})})]})]}):l.jsxs(l.Fragment,{children:[t.platform==="feishu"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(mt,{htmlFor:"feishu-app-id",children:["App ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Kt,{id:"feishu-app-id",value:t.feishuAppId,onChange:f=>n({...t,feishuAppId:f.target.value}),placeholder:"cli_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(mt,{htmlFor:"feishu-app-secret",children:["App Secret",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Kt,{id:"feishu-app-secret",type:"password",autoComplete:"new-password",value:t.feishuAppSecret,onChange:f=>n({...t,feishuAppSecret:f.target.value}),placeholder:"••••••••"})]})]}):t.platform==="kael"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(mt,{htmlFor:"kael-user-id",children:["User ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Kt,{id:"kael-user-id",value:t.kaelUserId,onChange:f=>n({...t,kaelUserId:f.target.value}),placeholder:"user_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(mt,{htmlFor:"kael-project-id",children:["Project ID",e.editingId?" — leave empty to keep existing":""]}),l.jsx(Kt,{id:"kael-project-id",value:t.kaelProjectId,onChange:f=>n({...t,kaelProjectId:f.target.value}),placeholder:"proj_xxxxxxxx",className:"font-mono",autoComplete:"off"})]}),!e.editingId&&l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Agent Token will be created automatically when you save."})]}):l.jsxs("div",{className:"space-y-2",children:[l.jsxs(mt,{htmlFor:"binding-creds",children:["Credentials (JSON)",e.editingId?" — leave empty to keep existing":""]}),l.jsx("textarea",{id:"binding-creds",value:t.credentialsJson,onChange:f=>n({...t,credentialsJson:f.target.value}),rows:4,className:"flex w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-2 text-body shadow-sm font-mono focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",placeholder:'{"bot_token": "xoxb-...", "signing_secret": "..."}'})]}),a&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:a}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"binding-status",children:"Status"}),l.jsxs("select",{id:"binding-status",value:t.status,onChange:f=>n({...t,status:f.target.value}),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"active",children:"active"}),l.jsx("option",{value:"inactive",children:"inactive"})]})]})]}),e.errorMessage&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:e.errorMessage}),l.jsxs(ir,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(xe,{type:"submit",disabled:e.pending,children:e.pending?"Saving…":e.editingId?"Update":"Create"})]})]})]})})}function dQ(e){if(e.platform==="feishu")return!e.feishuAppId&&!e.feishuAppSecret||!e.feishuAppId||!e.feishuAppSecret?null:{app_id:e.feishuAppId,app_secret:e.feishuAppSecret};if(e.platform==="kael")return!e.kaelUserId&&!e.kaelProjectId||!e.kaelUserId||!e.kaelProjectId?null:{kaelUserId:e.kaelUserId,kaelProjectId:e.kaelProjectId};const t=e.credentialsJson.trim();return t?JSON.parse(t):null}function fQ(){var _;const e=zn(),t=vn(),[n,a]=Oo(),s=n.get("agent"),o=bh(),u=We({queryKey:["adapters"],queryFn:sQ}),f=We({queryKey:["adapter-mappings"],queryFn:nQ}),m=We({queryKey:["adapter-statuses"],queryFn:iQ,refetchInterval:15e3}),p=((_=We({queryKey:["agents","name-map"],queryFn:()=>Bu({limit:100}),staleTime:3e4}).data)==null?void 0:_.items)??[],g=b.useMemo(()=>{const V=new Map;for(const H of m.data??[])V.set(H.configId,H);return V},[m.data]),w=b.useMemo(()=>{const V=u.data??[];return s?V.filter(H=>H.agentId===s):V},[u.data,s]),x=b.useMemo(()=>{const V=f.data??[];return s?V.filter(H=>H.agentId===s):V},[f.data,s]),k=w.reduce((V,H)=>{var ae;return V+((ae=g.get(H.id))!=null&&ae.connected?1:0)},0),C=w.length-k,j=u.isLoading||f.isLoading,[E,O]=b.useState(null),[A,D]=b.useState(""),[z,R]=b.useState(null),[F,B]=b.useState(null),[ee,L]=b.useState(null),[I,Q]=b.useState(null),te=pt({mutationFn:V=>lQ({platform:V.platform,agentId:V.agentId,credentials:V.credentials,status:V.status}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),R(null)}}),Y=pt({mutationFn:V=>{const H={status:V.status};return V.credentials&&(H.credentials=V.credentials),oQ(V.id,H)},onSuccess:()=>{t.invalidateQueries({queryKey:["adapters"]}),R(null)}}),X=pt({mutationFn:cQ,onSuccess:()=>t.invalidateQueries({queryKey:["adapters"]})}),G=pt({mutationFn:V=>rQ({platform:V.platform,externalUserId:V.externalUserId,agentId:V.agentId,boundVia:"manual",displayName:V.displayName??void 0}),onSuccess:()=>{t.invalidateQueries({queryKey:["adapter-mappings"]}),B(null)}}),se=pt({mutationFn:aQ,onSuccess:()=>t.invalidateQueries({queryKey:["adapter-mappings"]})});function J(V){if(s){V==="bot"?R({agentId:s,editingId:null}):B({agentId:s});return}D(""),O({kind:V})}function ve(){!E||!A||(E.kind==="bot"?R({agentId:A,editingId:null}):B({agentId:A}),O(null))}function M(V){if(z){if(V.kind==="bot-create")te.mutate({agentId:z.agentId,platform:V.draft.platform,status:V.draft.status,credentials:V.draft.credentials});else if(V.kind==="bot-update"){if(!z.editingId)return;Y.mutate({id:z.editingId,status:V.status,credentials:V.credentials})}}}function U(V){!F||V.kind!=="user-create"||G.mutate({agentId:F.agentId,platform:V.draft.platform,externalUserId:V.draft.externalUserId,displayName:V.draft.displayName})}const P=s?p.find(V=>V.uuid===s):null;return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",padding:"0 var(--sp-0_5) var(--sp-3)"},children:"Manage how external platforms (Feishu, Slack, Kael) reach your agents. Bot bindings hold encrypted credentials; user bindings map an external user to a human agent in this organization."}),s&&l.jsxs("div",{className:"flex items-center gap-2",style:{padding:"0 var(--sp-0_5) var(--sp-3)"},children:[l.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Filtered to"}),l.jsxs("span",{className:"inline-flex items-center gap-1.5 mono text-caption",style:{padding:"var(--sp-0_5) var(--sp-2)",borderRadius:"var(--radius-chip)",background:"var(--bg-active)",border:"var(--hairline) solid var(--border)"},children:[(P==null?void 0:P.displayName)??s,l.jsx("button",{type:"button",onClick:()=>{const V=new URLSearchParams(n);V.delete("agent"),a(V,{replace:!0})},"aria-label":"Clear filter",className:"inline-flex items-center justify-center hover:bg-accent rounded-full",style:{width:14,height:14,border:"none",background:"transparent",cursor:"pointer"},children:l.jsx(pi,{className:"h-3 w-3"})})]})]}),l.jsxs(Xn,{className:"mb-3.5",children:[l.jsxs($y,{right:l.jsxs("span",{className:"inline-flex items-center gap-2",children:[l.jsxs("span",{className:"inline-flex items-center gap-3 text-caption",children:[l.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--state-idle)"},children:[l.jsx(nu,{state:"idle",size:6})," ",k," online"]}),l.jsxs("span",{className:"mono inline-flex items-center gap-1",style:{color:"var(--fg-4)"},children:[l.jsx(nu,{state:"offline",size:6})," ",C," offline"]})]}),l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>J("bot"),children:[l.jsx(Sa,{className:"h-3 w-3"})," Bot binding"]})]}),children:["Bot bindings · ",w.length]}),j?l.jsx(Af,{children:"Loading…"}):w.length?l.jsxs(wu,{children:[l.jsx(Su,{children:l.jsxs(Ar,{children:[l.jsx(Wt,{children:"Agent"}),l.jsx(Wt,{children:"Platform"}),l.jsx(Wt,{children:"Status"}),l.jsx(Wt,{children:"Connection"}),l.jsx(Wt,{children:"Created"}),l.jsx(Wt,{style:{width:96,textAlign:"right"}})]})}),l.jsx(ku,{children:w.map(V=>{var ae;const H=((ae=g.get(V.id))==null?void 0:ae.connected)??!1;return l.jsxs(Ar,{interactive:!0,onClick:()=>e(`/agents/${V.agentId}`),children:[l.jsx(lt,{children:l.jsx("span",{className:"mono font-medium",children:o(V.agentId)})}),l.jsx(lt,{children:l.jsx(hr,{children:V.platform})}),l.jsx(lt,{children:l.jsx(hr,{tone:V.status==="active"?"accent":"outline",children:V.status})}),l.jsx(lt,{children:l.jsxs("span",{className:"inline-flex items-center gap-1.5 text-label",children:[l.jsx(nu,{state:H?"idle":"offline",size:7}),l.jsx("span",{style:{color:"var(--fg-3)"},children:H?"Online":"Offline"})]})}),l.jsx(lt,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:uu(V.createdAt)}),l.jsxs(lt,{style:{textAlign:"right",whiteSpace:"nowrap"},onClick:Se=>Se.stopPropagation(),children:[l.jsx(xe,{variant:"ghost",size:"xs",className:"text-label",onClick:()=>R({agentId:V.agentId,editingId:V.id,initialPlatform:hQ(V.platform),initialStatus:mQ(V.status)}),children:"Edit"}),l.jsx(xe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>L(V.id),disabled:X.isPending,title:"Delete",children:l.jsx(Gf,{className:"h-3.5 w-3.5"})})]})]},V.id)})})]}):l.jsx(Af,{children:s?"No bot bindings for this agent yet.":"No bot bindings"})]}),l.jsxs(Xn,{children:[l.jsxs($y,{right:l.jsxs(xe,{size:"xs",variant:"outline",onClick:()=>J("user"),children:[l.jsx(Sa,{className:"h-3 w-3"})," User binding"]}),children:["User bindings · ",x.length]}),j?l.jsx(Af,{children:"Loading…"}):x.length?l.jsxs(wu,{children:[l.jsx(Su,{children:l.jsxs(Ar,{children:[l.jsx(Wt,{children:"Agent"}),l.jsx(Wt,{children:"Platform"}),l.jsx(Wt,{children:"External user ID"}),l.jsx(Wt,{children:"Display name"}),l.jsx(Wt,{children:"Bound via"}),l.jsx(Wt,{children:"Created"}),l.jsx(Wt,{style:{width:32}})]})}),l.jsx(ku,{children:x.map(V=>l.jsxs(Ar,{interactive:!0,onClick:()=>e(`/agents/${V.agentId}`),children:[l.jsx(lt,{children:l.jsx("span",{className:"mono font-medium",style:{color:"var(--accent-dim)"},children:o(V.agentId)})}),l.jsx(lt,{children:l.jsx(hr,{children:V.platform})}),l.jsx(lt,{children:l.jsx("span",{className:"mono text-label",style:{color:"var(--fg-2)"},children:V.externalUserId})}),l.jsx(lt,{style:{color:"var(--fg-2)"},children:V.displayName??"—"}),l.jsx(lt,{children:l.jsx(hr,{tone:"outline",children:V.boundVia??"—"})}),l.jsx(lt,{className:"mono text-caption",style:{color:"var(--fg-4)"},children:uu(V.createdAt)}),l.jsx(lt,{onClick:H=>H.stopPropagation(),children:l.jsx(xe,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>Q(V.id),disabled:se.isPending,title:"Delete",children:l.jsx(Gf,{className:"h-3.5 w-3.5"})})})]},V.id))})]}):l.jsx(Af,{children:s?"No user bindings for this agent yet.":"No user bindings"})]}),l.jsx(pQ,{open:E!=null,kind:(E==null?void 0:E.kind)??"bot",agents:p,agentId:A,onAgentChange:D,onCancel:()=>O(null),onConfirm:ve}),l.jsx(uj,{open:z!=null,kind:"bot",editingId:(z==null?void 0:z.editingId)??null,initialPlatform:z==null?void 0:z.initialPlatform,initialStatus:z==null?void 0:z.initialStatus,agentLabel:z?o(z.agentId):"",pending:te.isPending||Y.isPending,errorMessage:(te.error??Y.error)instanceof Error?(te.error??Y.error).message:null,onOpenChange:V=>{V||(R(null),te.reset(),Y.reset())},onSubmit:M}),l.jsx(uj,{open:F!=null,kind:"user",editingId:null,agentLabel:F?o(F.agentId):"",pending:G.isPending,errorMessage:G.error instanceof Error?G.error.message:null,onOpenChange:V=>{V||(B(null),G.reset())},onSubmit:U}),l.jsx(dj,{open:ee!=null,onOpenChange:V=>!V&&L(null),title:"Remove this bot binding?",description:"The bot will stop routing to this agent and any platform credentials stored here will be dropped.",confirmLabel:"Remove binding",pending:X.isPending,onConfirm:()=>{ee!=null&&(X.mutate(ee),L(null))}}),l.jsx(dj,{open:I!=null,onOpenChange:V=>!V&&Q(null),title:"Remove this binding?",description:"The external user will stop routing to this agent. You can add the mapping again later.",confirmLabel:"Remove binding",pending:se.isPending,onConfirm:()=>{I!=null&&(se.mutate(I),Q(null))}})]})}function hQ(e){return e==="feishu"||e==="slack"||e==="kael"?e:"feishu"}function mQ(e){return e==="inactive"?"inactive":"active"}function Af({children:e}){return l.jsx("div",{className:"text-center py-6 text-body",style:{color:"var(--fg-3)"},children:e})}function pQ(e){const t=e.kind==="user"?e.agents.filter(n=>n.type==="human"&&n.status==="active"):e.agents.filter(n=>n.type!=="human"&&n.status==="active");return l.jsx(_n,{open:e.open,onOpenChange:n=>!n&&e.onCancel(),children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsx(Tn,{children:e.kind==="bot"?"Bind a bot":"Bind an external user"})}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Pick the agent this binding routes to."}),l.jsxs("select",{value:e.agentId,onChange:n=>e.onAgentChange(n.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"",children:"Select an agent…"}),t.map(n=>l.jsxs("option",{value:n.uuid,children:[n.displayName," ",n.name?`(@${n.name})`:""]},n.uuid))]})]}),l.jsxs(ir,{children:[l.jsx(xe,{variant:"ghost",onClick:e.onCancel,children:"Cancel"}),l.jsx(xe,{onClick:e.onConfirm,disabled:!e.agentId,children:"Continue"})]})]})})}function dj(e){return l.jsx(_n,{open:e.open,onOpenChange:e.onOpenChange,children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsx(Tn,{children:e.title})}),l.jsx("div",{className:"space-y-3 text-body",style:{color:"var(--fg-2)"},children:e.description}),l.jsxs(ir,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:()=>e.onOpenChange(!1),disabled:e.pending,children:"Cancel"}),l.jsx(xe,{type:"button",variant:"destructive",onClick:e.onConfirm,disabled:e.pending,children:e.pending?"Working…":e.confirmLabel})]})]})})}function gQ({embedded:e=!1}={}){return l.jsxs("div",{className:e?"":"-m-6",children:[l.jsx(Uo,{title:"Messaging",subtitle:"Feishu / Slack bridges to your team's agents"}),l.jsx("div",{style:{padding:"var(--sp-4) var(--sp-5) var(--sp-7)"},children:l.jsx(fQ,{})})]})}function yQ(){return l.jsx(gQ,{embedded:!0})}function vQ(){const{onboardingStep:e,onboardingDismissedAt:t,onboardingCompletedAt:n,dismissOnboarding:a,restoreOnboarding:s}=ut();if(n)return l.jsx(tr,{to:"/settings/team",replace:!0});const o=!!t,u=e==="completed";return l.jsxs(l.Fragment,{children:[l.jsx(Uo,{title:"Onboarding",subtitle:"Guided setup controls"}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(Qu,{title:"Onboarding guide",description:o?"The stepper is hidden. Bring it back if you want to walk through Step 3 (build your context-tree).":"The stepper is shown above your workspace. You can hide it any time once your agent is set up.",right:o?null:l.jsx(bQ,{}),isFirst:!0,children:o?l.jsx(xe,{type:"button",size:"sm",onClick:()=>void s(),children:"Resume onboarding"}):l.jsx(xe,{type:"button",size:"sm",variant:"outline",onClick:()=>void a(),disabled:!u,title:u?void 0:"Finish setting up your agent first",children:"Hide onboarding guide"})})})]})}function bQ(){return l.jsxs("span",{className:"text-label inline-flex items-center",style:{gap:"var(--sp-1)",color:"color-mix(in oklch, var(--accent) 35%, var(--fg))"},children:[l.jsx(mr,{className:"h-3 w-3"}),"Active"]})}function xQ(){const{role:e,onboardingCompletedAt:t}=ut(),n=e==="admin",a=t!==null;return l.jsxs("div",{className:"-m-6 flex",style:{minHeight:"calc(100vh - var(--sp-10))"},children:[l.jsxs("aside",{className:"shrink-0 overflow-auto",style:{width:200,padding:"var(--sp-4) var(--sp-2)"},children:[l.jsx(qc,{to:"/settings/team",label:"Team"}),l.jsx(qc,{to:"/settings/computers",label:"Computers"}),n&&l.jsx(qc,{to:"/settings/github",label:"GitHub"}),l.jsx(qc,{to:"/settings/integrations",label:"Messaging"}),!a&&l.jsx(qc,{to:"/settings/onboarding",label:"Onboarding"})]}),l.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:l.jsx(qf,{})})]})}function qc({to:e,label:t}){return l.jsx(jv,{to:e,className:({isActive:n})=>Oe("block w-full text-left bg-transparent text-body transition-colors","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",!n&&"hover:bg-accent"),style:{borderRadius:"var(--radius-input)"},children:({isActive:n})=>l.jsx("span",{className:"flex items-center",style:{padding:"var(--sp-1_25) var(--sp-2_5)",background:n?"var(--bg-active)":"transparent",color:n?"var(--fg)":"var(--fg-3)",fontWeight:n?500:400,borderRadius:"var(--radius-input)"},children:l.jsx("span",{className:"flex-1 truncate",children:t})})})}function tv(e){return e.normalize("NFKD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+|[-_]+$/g,"").slice(0,no)}const Bg=200;function wQ(e){if(!e||e.length===0)return{};const t={},n=["name","displayName","clientId"];for(const a of e){const s=a.path[0];if(typeof s=="string"&&n.includes(s)){const o=s;t[o]||(t[o]=a.message)}else t._root=a.message}return t}function SQ(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^[-_]+/,"").slice(0,no)}function MT(e){return e==="claude-code"||e==="codex"?e:null}function kQ(e){var t,n;if(((t=e["claude-code"])==null?void 0:t.state)==="ok")return"claude-code";if(((n=e.codex)==null?void 0:n.state)==="ok")return"codex";for(const[a,s]of Object.entries(e))if(s.state==="ok"){const o=MT(a);if(o)return o}return null}function jQ(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function CQ(e){switch(e){case"taken":return"That agent name is already in use in this organization. Pick a different one.";case"reserved":return"That agent name is reserved — pick a different one.";case"invalid":return"Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_)."}}function EQ({open:e,onOpenChange:t,onCreated:n}){const a=vn(),{refreshMe:s,organizationId:o}=ut(),[u,f]=b.useState(""),[m,h]=b.useState(""),[p,g]=b.useState(!1),[w,x]=b.useState("private"),[k,C]=b.useState("claude-code"),[j,E]=b.useState(!1),[O,A]=b.useState([]),[D,z]=b.useState(!1),[R,F]=b.useState(null),[B,ee]=b.useState(null),[L,I]=b.useState(null),[Q,te]=b.useState(null),[Y,X]=b.useState(null),[G,se]=b.useState(null),[J,ve]=b.useState(!1),[M,U]=b.useState({}),[P,_]=b.useState({status:"idle"});b.useEffect(()=>{e&&(f(""),h(""),g(!1),x("private"),C("claude-code"),E(!1),A([]),z(!1),F(null),ee(null),I(null),te(null),X(null),se(null),ve(!1),U({}),_({status:"idle"}))},[e]),b.useEffect(()=>{p||h(tv(u))},[u,p]);const V=b.useRef(0);b.useEffect(()=>{if(!e||!m){_({status:"idle"});return}if(!Py.test(m)){_({status:"bad",reason:"invalid"});return}if(Uy(m)){_({status:"bad",reason:"reserved"});return}const we=++V.current;_({status:"checking"});const ze=window.setTimeout(()=>{j4(m).then(et=>{we===V.current&&(et.available?_({status:"ok"}):_({status:"bad",reason:et.reason}))}).catch(()=>{we===V.current&&_({status:"idle"})})},300);return()=>window.clearTimeout(ze)},[m,e]),b.useEffect(()=>{if(!e)return;let we=!1;const ze=async()=>{try{const Ct=await gi();if(we)return;const le=Ct.filter(me=>me.status==="connected").sort((me,Pe)=>Pe.lastSeenAt.localeCompare(me.lastSeenAt));A(le),z(!0)}catch{we||z(!0)}};ze();const et=window.setInterval(ze,3e3);return()=>{we=!0,window.clearInterval(et)}},[e]),b.useEffect(()=>{if(O.length===0){F(null);return}F(we=>{var ze;return we&&O.some(et=>et.id===we)?we:((ze=O[0])==null?void 0:ze.id)??null})},[O]),b.useEffect(()=>{if(!R){ee(null),I(null);return}let we=!1;const ze=async()=>{try{const Ct=await mh(R);if(we)return;ee(Ct.capabilities),I(R)}catch{}};ze();const et=window.setInterval(ze,3e3);return()=>{we=!0,window.clearInterval(et)}},[R]),b.useEffect(()=>{if(!e||O.length>0)return;if(Q&&G&&G>Date.now()){const ze=Math.max(G-Date.now(),0),et=window.setTimeout(()=>{te(null),se(null)},ze);return()=>window.clearTimeout(et)}Q&&(te(null),X(null),se(null));let we=!1;return(async()=>{try{const ze=await Ce.post("/me/connect-tokens",{});if(we)return;te(ze.token),X(ze.command),se(Date.now()+ze.expiresIn*1e3)}catch{}})(),()=>{we=!0}},[e,O.length,Q,G]);const H=R&&L===R?B:null,ae=b.useMemo(()=>{if(!H)return[];const we=[];for(const[ze,et]of Object.entries(H)){if(et.state!=="ok")continue;const Ct=MT(ze);Ct&&we.push(Ct)}return we},[H]);b.useEffect(()=>{H&&C(we=>{var ze;return((ze=H[we])==null?void 0:ze.state)==="ok"?we:kQ(H)??we})},[H]);const Se=pt({mutationFn:async we=>{const ze=u.trim()||m.trim()||"Untitled assistant";return k4({name:m||void 0,type:"personal_assistant",displayName:ze,clientId:we.clientId,runtimeProvider:k,visibility:w,...o?{organizationId:o}:{}})},onSuccess:we=>{a.invalidateQueries({queryKey:["agents"]}),a.invalidateQueries({queryKey:["activity"]}),s(),n(we,k)}}),Ae=b.useMemo(()=>{const we=Se.error;if(!we)return{};if(we instanceof xs){const ze=wQ(we.issues);return Object.keys(ze).length>0?ze:we.status===409?{name:"That agent name is already in use in this organization. Pick a different one."}:{_root:we.message}}return we instanceof Error?{_root:we.message}:{}},[Se.error]),Ee=P.status==="bad"?CQ(P.reason):void 0,Ge={...Ee?{name:Ee}:{},...Ae,...M};function Fe(){const we={};return m?m.length>no?we.name=`Agent name must be at most ${no} characters (got ${m.length}).`:Py.test(m)?Uy(m)&&(we.name="That agent name is reserved — pick a different one."):we.name="Agent name must start with a letter or digit and contain only lowercase letters, digits, hyphens (-), and underscores (_).":u.trim().length>0&&(we.name="Agent name must contain at least one letter or digit (e.g. a-z, 0-9)."),u.length>Bg&&(we.displayName=`Display name must be at most ${Bg} characters (got ${u.length}).`),we}function Ve(we){we.preventDefault();const ze=Fe();U(ze),!(Object.keys(ze).length>0)&&P.status!=="bad"&&R&&(ae.length===0||!ae.includes(k)||Se.mutate({clientId:R}))}const st=P.status==="bad",Nt=u.trim().length>0&&!st&&!Se.isPending&&!!R&&ae.length>0&&ae.includes(k);return l.jsx(_n,{open:e,onOpenChange:t,children:l.jsxs(bn,{className:"max-w-lg",children:[l.jsx(In,{children:l.jsx(Tn,{children:"New Agent"})}),l.jsxs("form",{onSubmit:Ve,className:"space-y-5 min-w-0",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"new-agent-display-name",children:"Display name"}),l.jsx(Kt,{id:"new-agent-display-name",value:u,onChange:we=>{f(we.target.value),M.displayName&&U(ze=>({...ze,displayName:void 0}))},placeholder:"My Dev Assistant",autoFocus:!0,maxLength:Bg,"aria-invalid":Ge.displayName?!0:void 0,"aria-describedby":"new-agent-display-name-help new-agent-display-name-error"}),l.jsx("p",{id:"new-agent-display-name-help",className:"text-caption text-muted-foreground",children:"How teammates see this agent in chats and lists. Can be changed anytime."}),Ge.displayName&&l.jsx("p",{id:"new-agent-display-name-error",className:"text-caption text-destructive",children:Ge.displayName}),!j&&(u.trim()||m)&&l.jsxs("div",{className:"flex items-baseline gap-2 text-caption text-muted-foreground",children:[m?l.jsxs(l.Fragment,{children:[l.jsxs("span",{className:"font-mono",children:["@",m]}),l.jsx("span",{"aria-hidden":!0,children:"·"}),l.jsx("span",{children:"permanent"})]}):l.jsx("span",{className:"italic",children:"No @handle from this display name"}),l.jsx("span",{"aria-hidden":!0,children:"·"}),l.jsx("button",{type:"button",onClick:()=>E(!0),className:"text-foreground underline underline-offset-2 hover:text-primary focus:outline-none focus-visible:text-primary",children:"Edit"})]}),!j&&Ge.name&&l.jsx("p",{className:"text-caption text-destructive",children:Ge.name})]}),j&&l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[l.jsx(mt,{htmlFor:"new-agent-name",children:"Agent name"}),l.jsx("button",{type:"button",onClick:()=>E(!1),className:"text-caption text-muted-foreground underline underline-offset-2 hover:text-primary focus:outline-none focus-visible:text-primary",children:"Done"})]}),l.jsxs("div",{className:"flex items-stretch",children:[l.jsx("span",{"aria-hidden":!0,className:"inline-flex items-center px-2 font-mono text-body text-muted-foreground border border-r-0 border-input rounded-l-[var(--radius-input)] bg-muted/40",children:"@"}),l.jsx(Kt,{id:"new-agent-name",value:m,autoFocus:!0,onChange:we=>{const ze=SQ(we.target.value);h(ze),g(!0),M.name&&U(et=>({...et,name:void 0}))},onBlur:we=>{const ze=tv(we.target.value);ze!==m&&h(ze)},placeholder:"my-dev-assistant",className:"rounded-l-none font-mono",maxLength:no,"aria-invalid":Ge.name?!0:void 0,"aria-describedby":"new-agent-name-help new-agent-name-error new-agent-name-status"})]}),l.jsxs("p",{id:"new-agent-name-help",className:"text-caption text-muted-foreground",children:["Used in @mentions and CLI commands. Lowercase letters, digits, hyphens (-), and underscores (_). Up to"," ",no," characters. Permanent after creation."]}),m&&!Ge.name&&P.status!=="idle"&&l.jsxs("p",{id:"new-agent-name-status",className:"text-caption",style:{color:P.status==="ok"?"var(--state-idle)":P.status==="checking"?"var(--fg-3)":"var(--fg-4)"},children:[P.status==="checking"&&"Checking availability…",P.status==="ok"&&"Available."]}),Ge.name&&l.jsx("p",{id:"new-agent-name-error",className:"text-caption text-destructive",children:Ge.name})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Visibility"}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:w==="organization"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"visibility",checked:w==="organization",onChange:()=>x("organization"),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:"Shared with team"}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Anyone in your org can @mention and chat with this agent."})]})]}),l.jsxs("label",{className:w==="private"?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"visibility",checked:w==="private",onChange:()=>x("private"),className:"mt-1"}),l.jsxs("div",{children:[l.jsx("div",{className:"text-body font-medium",children:"Private to you"}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Only you can see this agent and chat with it. Others on the team won't see it listed. (default)"})]})]})]})]}),l.jsxs("div",{className:"space-y-3",style:{minHeight:168},children:[l.jsx(mt,{children:"Where it runs"}),D?O.length===0?l.jsx(NQ,{command:Y,copied:J,onCopy:async()=>{Y&&(await navigator.clipboard.writeText(Y),ve(!0),window.setTimeout(()=>ve(!1),1500))}}):O.length===1?l.jsx(_Q,{client:O[0]}):l.jsx("div",{className:"space-y-2",children:O.map(we=>{const ze=R===we.id;return l.jsxs("label",{className:ze?"flex items-start gap-3 rounded-md border border-primary bg-primary/5 p-3 cursor-pointer":"flex items-start gap-3 rounded-md border border-border p-3 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"picked-client",checked:ze,onChange:()=>F(we.id),className:"mt-1"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body font-medium truncate",children:we.hostname??we.id}),l.jsxs("div",{className:"text-caption text-muted-foreground",children:[we.os??"unknown OS"," · last seen ",new Date(we.lastSeenAt).toLocaleString()]})]})]},we.id)})}):l.jsx(TQ,{label:"Detecting connected computers…"}),(R||!D)&&l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("div",{className:"text-caption text-muted-foreground",children:"Powered by"}),!R||H===null?l.jsx(AQ,{}):ae.length===0?l.jsx("p",{className:"text-caption text-destructive",children:"No runtime ready on this computer. Install Claude Code or Codex on it (and sign in), then come back."}):l.jsx("div",{className:"flex flex-wrap gap-2",children:ae.map(we=>{const ze=k===we;return l.jsxs("label",{className:ze?"inline-flex items-center gap-2 rounded-md border border-primary bg-primary/5 px-3 py-1.5 cursor-pointer":"inline-flex items-center gap-2 rounded-md border border-border px-3 py-1.5 cursor-pointer hover:bg-accent/30",children:[l.jsx("input",{type:"radio",name:"runtime",checked:ze,onChange:()=>C(we)}),l.jsx("span",{className:"text-body",children:jQ(we)})]},we)})})]}),Ge.clientId&&l.jsx("p",{className:"text-caption text-destructive",children:Ge.clientId})]}),Ge._root&&l.jsx("div",{className:"rounded-md border border-destructive/50 bg-destructive/5 px-3 py-2 text-body text-destructive",children:Ge._root}),l.jsx(ir,{children:l.jsx(xe,{type:"submit",disabled:!Nt,children:Se.isPending?"Creating…":"Create"})})]})]})})}function NQ({command:e,copied:t,onCopy:n}){return l.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3 space-y-2",children:[l.jsx("div",{className:"text-body font-medium",children:"No computer connected yet."}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Run this on the machine where this agent should live. We'll pick it up here automatically."}),l.jsxs("div",{className:"flex items-stretch gap-2 min-w-0",children:[l.jsx("code",{className:"block flex-1 min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-caption px-2 py-1.5 bg-muted/50 border border-border rounded",title:e??void 0,children:e??"Generating token…"}),l.jsx("button",{type:"button",onClick:n,disabled:!e,className:"shrink-0 px-3 py-1.5 text-caption font-medium border border-border rounded hover:bg-accent/30 disabled:opacity-50",children:t?"Copied":"Copy"})]})]})}function _Q({client:e}){return e?l.jsxs("div",{className:"rounded-md border border-primary bg-primary/5 p-3",children:[l.jsx("div",{className:"text-body font-medium truncate",children:e.hostname??e.id}),l.jsxs("div",{className:"text-caption text-muted-foreground",children:[e.os??"unknown OS"," · last seen ",new Date(e.lastSeenAt).toLocaleString()]})]}):null}function TQ({label:e}){return l.jsxs("div",{className:"rounded-md border border-border bg-muted/20 p-3",role:"status","aria-live":"polite","aria-label":e,children:[l.jsx("div",{className:"text-body font-medium",style:{color:"var(--fg-3)"},children:e}),l.jsx("div",{className:"text-caption text-muted-foreground",children:"Looking for a machine running the Hub client…"})]})}function AQ(){return l.jsx("div",{className:"flex flex-wrap gap-2",role:"status","aria-live":"polite","aria-label":"Detecting installed runtimes",children:l.jsx("span",{className:"inline-flex items-center rounded-md border border-border bg-muted/30 px-3 py-1.5 text-body",style:{color:"var(--fg-4)"},children:"Detecting installed runtimes…"})})}function nv({active:e,count:t,warn:n,className:a,children:s,style:o,...u}){return l.jsxs("button",{type:"button",className:Oe("mono inline-flex items-center gap-1 text-caption leading-[1.6]",a),style:{padding:"var(--sp-0_5) var(--sp-1_75)",borderRadius:3,border:`var(--hairline) solid ${e?"var(--border-strong)":"var(--border)"}`,background:e?"var(--bg-active)":"transparent",color:e?"var(--fg)":"var(--fg-3)",cursor:"pointer",...o},...u,children:[s,t!==void 0&&l.jsx("span",{className:"mono",style:{color:n&&typeof t=="number"&&t>0?"var(--state-error)":"var(--fg-4)"},children:t})]})}function RQ(e){const t=new Date(e),n=Date.now(),a=t.getTime()-n;if(a<=0)return`expired ${t.toLocaleDateString()}`;const s=Math.ceil(a/(1440*60*1e3));return`expires ${s===1?"in less than a day":`in ${s} days`} · ${t.toLocaleDateString()}`}function OQ(){const{organizationId:e}=ut(),[t,n]=b.useState(null),[a,s]=b.useState(null),[o,u]=b.useState(!1),[f,m]=b.useState(!1);b.useEffect(()=>{e&&(async()=>{try{const p=await Ce.get(xy(e,"/invitations"));n(p)}catch(p){s(p instanceof Error?p.message:"Failed to load invite link")}})()},[e]);const h=async()=>{if(e){u(!0),s(null);try{const p=await Ce.post(xy(e,"/invitations/rotate"));n(p)}catch(p){s(p instanceof Error?p.message:"Failed to rotate invite link")}finally{u(!1)}}};return l.jsxs(Io,{children:[l.jsxs(Lo,{children:[l.jsx(Vu,{children:"Invite link"}),l.jsxs(RT,{children:["Anyone with this link can join your team as a member. Links expire after ",gF," days; rotating revokes the old link instantly and resets the timer."]})]}),l.jsxs(Po,{className:"space-y-3",children:[a&&l.jsx("div",{className:"rounded-md bg-destructive/10 p-2 text-label text-destructive",children:a}),t?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex gap-2",children:[l.jsx("input",{readOnly:!0,className:"flex-1 rounded-md border bg-muted px-2 py-1 text-label font-mono",value:t.inviteUrl}),l.jsx(xe,{size:"sm",variant:"outline",onClick:()=>{navigator.clipboard.writeText(t.inviteUrl),m(!0),setTimeout(()=>m(!1),1500)},children:f?"Copied!":"Copy"}),l.jsx(xe,{size:"sm",onClick:h,disabled:o,children:o?"Rotating…":"Rotate"})]}),l.jsxs("p",{className:"text-label text-muted-foreground",children:["Created ",new Date(t.createdAt).toLocaleString(),t.expiresAt?` · ${RQ(t.expiresAt)}`:" · no expiry"]})]}):l.jsx("p",{className:"text-label text-muted-foreground",children:"Loading…"})]})]})}function Ob({actions:e,ariaLabel:t,triggerClassName:n,icon:a=kD}){const[s,o]=b.useState(!1),[u,f]=b.useState("down"),m=b.useRef(null),h=b.useRef(null);return b.useEffect(()=>{if(!s)return;const p=w=>{m.current&&!m.current.contains(w.target)&&o(!1)},g=w=>{w.key==="Escape"&&o(!1)};return window.addEventListener("mousedown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("mousedown",p),window.removeEventListener("keydown",g)}},[s]),b.useEffect(()=>{if(!s||!h.current)return;const p=32,g=8,w=h.current.getBoundingClientRect(),x=window.innerHeight-w.bottom,k=e.length*p+g;f(x>=k?"down":"up")},[s,e.length]),e.length===0?null:l.jsxs("div",{ref:m,className:"relative inline-flex",children:[l.jsx("button",{ref:h,type:"button","aria-label":t,"aria-haspopup":"menu","aria-expanded":s,onClick:p=>{p.stopPropagation(),o(g=>!g)},className:Oe("inline-flex items-center justify-center",n),style:{width:28,height:28,borderRadius:4,background:"transparent",color:"var(--fg-3)",cursor:"pointer",border:0},children:l.jsx(a,{className:"h-3.5 w-3.5"})}),s&&l.jsx("div",{role:"menu",className:"absolute right-0 z-30 rounded-md border bg-popover shadow-md",onClick:p=>p.stopPropagation(),onKeyDown:p=>p.stopPropagation(),style:{minWidth:180,borderColor:"var(--border)",...u==="up"?{bottom:"100%",marginBottom:4}:{top:"100%",marginTop:4}},children:e.map(p=>l.jsx("button",{type:"button",role:"menuitem",disabled:p.disabled,onClick:g=>{g.stopPropagation(),o(!1),p.onSelect()},className:"flex w-full items-center px-3 py-1.5 text-left text-body hover:bg-accent transition-colors disabled:opacity-50 disabled:cursor-not-allowed",style:{color:p.destructive?"var(--state-error)":"var(--fg)",background:"transparent",border:0,cursor:p.disabled?"not-allowed":"pointer"},children:p.label},p.key))})]})}const Mb=[{key:"name",label:"Name",width:220},{key:"delegate",label:"Delegate",width:180},{key:"manager",label:"Manager",width:180},{key:"runtime",label:"Runs on",width:220},{key:"status",label:"Status",width:160},{key:"created",label:"Created",width:160},{key:"actions",label:"",width:44}];function Tr(e,t){return e?{...t,borderBottom:0}:t}function MQ({groups:e,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o}){return l.jsxs(wu,{className:"table-fixed",children:[l.jsx(Su,{children:l.jsx(Ar,{children:Mb.map(u=>l.jsx(Wt,{style:{width:u.width,...u.key==="name"?{paddingLeft:"var(--sp-6)"}:null},"aria-hidden":u.key==="actions",children:u.label},u.key))})}),e.map(u=>l.jsx(DQ,{group:u,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o},u.key))]})}function DQ({group:e,runtimeMap:t,clientHostMap:n,onAgentClick:a,getHumanActions:s,getAgentActions:o}){const[u,f]=b.useState(!e.collapsible);return l.jsxs(ku,{children:[l.jsx(IQ,{group:e,open:u,onToggle:()=>f(m=>!m)}),u&&e.rows.length===0&&e.emptyMessage&&l.jsx(Ar,{children:l.jsx(lt,{colSpan:Mb.length,style:{color:"var(--fg-4)",textAlign:"left",padding:"0 var(--sp-3_5) var(--sp-3) var(--sp-6)",borderBottom:0},children:e.emptyMessage})}),u&&e.rows.map((m,h)=>{const p=h===e.rows.length-1;return m.kind==="human"?l.jsx(LQ,{row:m,actions:s(m),isLast:p},`h:${m.id}`):l.jsx(UQ,{row:m,runtime:t.get(m.agent.uuid)??null,clientHost:m.agent.clientId?n.get(m.agent.clientId)??null:null,actions:o(m),onClick:()=>a(m.agent.uuid),isLast:p},`a:${m.agent.uuid}`)})]})}function zQ(e){switch(e){case"humans":return Mv;case"yours":case"team":return HC;case"other-private":return fh;default:return null}}function IQ({group:e,open:t,onToggle:n}){const a=zQ(e.key),s=l.jsxs("span",{className:"inline-flex items-center relative",style:{gap:"var(--sp-2)"},children:[e.collapsible&&l.jsx("span",{"aria-hidden":!0,style:{position:"absolute",left:"calc(-1 * var(--sp-3))",top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)",lineHeight:1},children:t?"▾":"▸"}),a&&l.jsx(a,{className:"h-4 w-4","aria-hidden":!0,style:{color:"var(--fg-3)"}}),l.jsx("span",{className:"text-body font-medium",style:{color:"var(--fg)"},children:e.title}),l.jsx(hr,{tone:"outline",children:e.count})]});return l.jsx(Ar,{children:l.jsx("td",{colSpan:Mb.length,style:{padding:"var(--sp-6) var(--sp-3_5) var(--sp-2) 0"},children:e.collapsible?l.jsx("button",{type:"button",onClick:n,"aria-expanded":t,style:{background:"transparent",border:0,cursor:"pointer",color:"inherit",padding:"0 0 0 var(--sp-3)",marginLeft:"calc(-1 * var(--sp-3))"},children:s}):s})})}function LQ({row:e,actions:t,isLast:n}){return l.jsxs(Ar,{children:[l.jsx(lt,{style:Tr(n,{paddingLeft:"var(--sp-6)"}),children:l.jsx(DT,{displayName:e.displayName,handle:`@${e.username}`,selfTag:e.isSelf})}),l.jsx(lt,{style:Tr(n),children:l.jsx(PQ,{row:e})}),l.jsx(lt,{className:"text-label",style:Tr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(lt,{className:"text-label",style:Tr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(lt,{className:"text-label",style:Tr(n,{color:"var(--fg-4)"}),children:"—"}),l.jsx(lt,{className:"mono text-caption",style:Tr(n,{color:"var(--fg-4)"}),children:fE(e.createdAt)}),l.jsx(lt,{style:Tr(n,{padding:0,textAlign:"right"}),children:l.jsx(Ob,{actions:t,ariaLabel:`Actions for ${e.displayName}`})})]})}function PQ({row:e}){if(!e.delegate&&!e.canEditDelegate)return l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:"—"});const t=e.delegate?e.delegate.name?`${e.delegate.displayName} (@${e.delegate.name})`:e.delegate.displayName:"Set delegate",n=e.delegate?l.jsx("span",{className:"block max-w-full overflow-hidden text-ellipsis whitespace-nowrap",children:l.jsx(S_,{name:e.delegate.name,displayName:e.delegate.displayName})}):l.jsx("span",{style:{color:"var(--accent-dim)"},children:"Set delegate →"}),a=e.delegate?e.canEditDelegate?`Change delegate · ${t}`:t:"Set delegate";return e.canEditDelegate?l.jsx("button",{type:"button",onClick:e.onEditDelegate,className:"text-label hover:underline block max-w-full overflow-hidden",style:{background:"transparent",border:0,padding:0,cursor:"pointer",color:"inherit",textAlign:"left"},title:a,children:n}):l.jsx("span",{className:"text-label block max-w-full overflow-hidden",title:a,children:n})}function UQ({row:e,runtime:t,clientHost:n,actions:a,onClick:s,isLast:o}){const{agent:u,managerLabel:f,isOwnedBySelf:m,showVisibilityChip:h}=e;return l.jsxs(Ar,{interactive:!0,onClick:s,children:[l.jsx(lt,{style:Tr(o,{paddingLeft:"var(--sp-6)"}),children:l.jsx(DT,{displayName:u.displayName,handle:u.name?`@${u.name}`:null,visibility:h?u.visibility:null})}),l.jsx(lt,{className:"text-label",style:Tr(o,{color:"var(--fg-4)"}),children:"—"}),l.jsx(lt,{className:"text-label",style:Tr(o,{color:"var(--fg-2)"}),children:f?l.jsxs("span",{className:"truncate inline-block max-w-full",title:f,children:[f,m&&l.jsx("span",{className:"text-label italic",style:{marginLeft:6,color:"var(--fg-3)"},children:"(you)"})]}):l.jsx("span",{style:{color:"var(--fg-4)"},children:"—"})}),l.jsx(lt,{className:"mono text-caption",style:Tr(o,{color:"var(--fg-3)"}),children:l.jsxs("div",{className:"truncate",title:n?`${u.runtimeProvider} @ ${n}`:u.runtimeProvider,children:[u.runtimeProvider,n&&l.jsxs("span",{style:{color:"var(--fg-4)"},children:[" @ ",n]})]})}),l.jsx(lt,{style:Tr(o),children:l.jsx(vu,{state:(t==null?void 0:t.runtimeState)??null})}),l.jsx(lt,{className:"mono text-caption",style:Tr(o,{color:"var(--fg-4)"}),children:fE(u.createdAt)}),l.jsx(lt,{style:Tr(o,{padding:0,textAlign:"right"}),onClick:p=>p.stopPropagation(),children:l.jsx(Ob,{actions:a,ariaLabel:`Actions for ${u.displayName}`})})]})}function DT({displayName:e,handle:t,selfTag:n,visibility:a}){return l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline gap-1.5 min-w-0",children:[l.jsx("span",{className:"font-medium text-body truncate",style:{color:"var(--fg)"},title:e,children:e}),n&&l.jsx("span",{className:"text-label italic shrink-0",style:{color:"var(--fg-3)"},children:"(you)"}),a&&l.jsx(BQ,{visibility:a})]}),t&&l.jsx("div",{className:"mono text-caption truncate",style:{color:"var(--fg-4)"},title:t,children:t})]})}function BQ({visibility:e}){return e==="private"?l.jsxs(hr,{tone:"outline",title:"Private — only you can see this agent",className:"shrink-0",children:[l.jsx(fh,{className:"h-2.5 w-2.5","aria-hidden":!0,style:{marginRight:3}}),"Private"]}):l.jsxs(hr,{tone:"accent",title:"Shared — anyone in the team can @mention this agent",className:"shrink-0",children:[l.jsx(KC,{className:"h-2.5 w-2.5","aria-hidden":!0,style:{marginRight:3}}),"Shared"]})}const fj=100,hj=100;async function FQ(e){const t=[];let n;for(let a=0;a<hj;a++){const s=await e(n?{limit:fj,cursor:n}:{limit:fj});if(t.push(...s.items),!s.nextCursor)return t;n=s.nextCursor}throw new Error(`fetchAllAgents exceeded ${hj} pages; server cursor pagination may be broken`)}function $Q(){const{role:e,memberId:t}=ut(),n=e==="admin",a=zn(),s=vn(),o=k_(),[u,f]=b.useState(!1),[m,h]=b.useState(!1),[p,g]=b.useState(null),[w,x]=b.useState(null),[k,C]=b.useState("all"),[j,E]=b.useState(""),O=We({queryKey:["members"],queryFn:fb}),A=We({queryKey:["agents","team-page",n?"admin":"member"],queryFn:()=>FQ(H=>n?w4(H):Bu(H))}),{data:D}=We({queryKey:["activity"],queryFn:Pu,refetchInterval:1e4}),z=b.useMemo(()=>{const H=new Map;for(const ae of(D==null?void 0:D.agents)??[])H.set(ae.agentId,ae);return H},[D==null?void 0:D.agents]),{data:R}=We({queryKey:["clients","team-page"],queryFn:gi,staleTime:3e4}),F=b.useMemo(()=>{const H=new Map;for(const ae of R??[])ae.hostname&&H.set(ae.id,ae.hostname);return H},[R]),B=b.useMemo(()=>O.data??[],[O.data]),ee=b.useMemo(()=>A.data??[],[A.data]),L=b.useMemo(()=>{const H=new Map;for(const ae of ee)H.set(ae.uuid,ae);return H},[ee]),I=b.useMemo(()=>ee.filter(H=>H.type!=="human"),[ee]),Q=b.useMemo(()=>I.filter(H=>H.managerId===t),[I,t]),te=b.useMemo(()=>I.filter(H=>H.visibility==="organization"&&H.managerId!==t),[I,t]),Y=b.useMemo(()=>I.filter(H=>H.visibility==="private"&&H.managerId!==t),[I,t]),X=pt({mutationFn:async H=>q9(H.id,H.patch),onSuccess:()=>s.invalidateQueries({queryKey:["members"]})}),G=pt({mutationFn:Z9,onSuccess:()=>{s.invalidateQueries({queryKey:["members"]}),s.invalidateQueries({queryKey:["agents"]})}}),se=pt({mutationFn:uN,onSuccess:()=>{s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),J=pt({mutationFn:dN,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),ve=pt({mutationFn:fN,onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),M=pt({mutationFn:async H=>Oy(H.humanAgentId,{delegateMention:H.delegateMention}),onSuccess:()=>s.invalidateQueries({queryKey:["agents"]})}),U=j.trim().toLowerCase(),P=b.useMemo(()=>ZQ({filter:k,search:U,isAdmin:n,selfMemberId:t,members:B,yourAgents:Q,teamAgents:te,otherPrivateAgents:Y,resolveMember:o,agentByUuid:L,openDelegate:(H,ae)=>{var Se;return x({humanAgentId:H,humanDisplayName:ae,currentDelegate:((Se=L.get(H))==null?void 0:Se.delegateMention)??null})}}),[k,U,n,t,B,Q,te,Y,o,L]);function _(H){const ae=[];return n&&ae.push({key:"edit",label:"Edit profile",onSelect:()=>g({id:H.id,username:H.username,displayName:H.displayName,role:H.role})}),n&&!H.isSelf&&ae.push({key:"remove",label:"Remove from org",destructive:!0,onSelect:()=>{window.confirm(`Remove ${H.displayName} from the org? The human agent will be deactivated.`)&&G.mutate(H.id)}}),ae}function V(H){const{agent:ae,isOwnedBySelf:Se}=H,Ae=n||Se,Ee=[{key:"open",label:"Open",onSelect:()=>a(`/agents/${encodeURIComponent(ae.uuid)}`)}];return Ae&&(ae.status==="suspended"?Ee.push({key:"reactivate",label:"Reactivate",onSelect:()=>ve.mutate(ae.uuid)}):Ee.push({key:"suspend",label:"Suspend",onSelect:()=>J.mutate(ae.uuid)}),Ee.push({key:"delete",label:"Delete",destructive:!0,onSelect:()=>{window.confirm(`Delete agent ${ae.displayName}? This cannot be undone.`)&&se.mutate(ae.uuid)}})),Ee}return l.jsxs(l.Fragment,{children:[l.jsx(Uo,{title:"Team",right:l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-2)"},children:[l.jsxs(xe,{size:"xs",onClick:()=>h(!0),children:[l.jsx(Sa,{className:"h-3 w-3"}),"New agent"]}),n&&l.jsxs(xe,{size:"xs",variant:"ghost",onClick:()=>f(!0),children:[l.jsx(QC,{className:"h-3 w-3"}),"Invite link"]})]})}),l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[l.jsx(qQ,{filter:k,onFilter:C,query:j,onQuery:E,counts:{yours:Q.length,humans:B.length,team:te.length}}),A.isLoading||O.isLoading?l.jsx("div",{className:"text-center py-8 text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):A.error||O.error?l.jsxs("div",{className:"text-center py-8 text-body",style:{color:"var(--state-error)"},children:["Failed to load: ",HQ(A.error??O.error)]}):l.jsx(MQ,{groups:P,runtimeMap:z,clientHostMap:F,onAgentClick:H=>a(`/agents/${encodeURIComponent(H)}`),getHumanActions:_,getAgentActions:V})]}),l.jsx(_n,{open:u,onOpenChange:f,children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsx(Tn,{children:"Invite link"})}),l.jsx(OQ,{})]})}),l.jsx(EQ,{open:m,onOpenChange:h,onCreated:(H,ae)=>{h(!1),s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["activity"]})}}),l.jsx(QQ,{target:p,isAdmin:n,isSaving:X.isPending,onClose:()=>g(null),onSave:async H=>{p&&(await X.mutateAsync({id:p.id,patch:H}),g(null))}}),l.jsx(KQ,{target:w,candidates:GQ(ee),isSaving:M.isPending,onClose:()=>x(null),onSave:async H=>{w&&(await M.mutateAsync({humanAgentId:w.humanAgentId,delegateMention:H}),x(null))}})]})}function HQ(e){return e instanceof Error?e.message:String(e)}function qQ({filter:e,onFilter:t,query:n,onQuery:a,counts:s}){const o=[{key:"all",label:"All"},{key:"yours",label:"Your agents",count:s.yours},{key:"humans",label:"Humans",count:s.humans},{key:"team",label:"Team agents",count:s.team}];return l.jsxs("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-2)"},children:[l.jsx("div",{className:"flex flex-wrap items-center",style:{gap:"var(--sp-1)"},children:o.map(u=>l.jsx(nv,{active:e===u.key,count:u.count,onClick:()=>t(u.key),children:u.label},u.key))}),l.jsxs("div",{className:"relative",style:{width:220},children:[l.jsx(Ov,{"aria-hidden":!0,className:"h-3.5 w-3.5",style:{position:"absolute",left:"var(--sp-1_5)",top:"50%",transform:"translateY(-50%)",color:"var(--fg-4)"}}),l.jsx(Kt,{value:n,onChange:u=>a(u.target.value),placeholder:"Search name or @handle","aria-label":"Search team",className:"h-7 text-caption",style:{paddingLeft:"var(--sp-5)",borderRadius:3}})]})]})}function ZQ(e){const{filter:t,search:n,isAdmin:a,selfMemberId:s,members:o,yourAgents:u,teamAgents:f,otherPrivateAgents:m,agentByUuid:h,openDelegate:p}=e,g=B=>{const ee=h.get(B);if(!(ee!=null&&ee.delegateMention))return null;const L=h.get(ee.delegateMention);return L?{name:L.name,displayName:L.displayName}:null},w=B=>!n||B.displayName.toLowerCase().includes(n)||B.username.toLowerCase().includes(n),x=B=>!n||B.displayName.toLowerCase().includes(n)||(B.name??"").toLowerCase().includes(n),k=t==="all"||t==="yours",C=t==="all"||t==="humans",j=t==="all"||t==="team",E=a&&t==="all",O=o.filter(w).map(B=>{const ee=s===B.id;return{kind:"human",id:B.id,agentId:B.agentId,username:B.username,displayName:B.displayName,role:B.role,createdAt:B.createdAt,isSelf:ee,delegate:g(B.agentId),canEditDelegate:ee||a,onEditDelegate:()=>p(B.agentId,B.displayName)}}).sort((B,ee)=>Number(ee.isSelf)-Number(B.isSelf)),A=(B,ee)=>({kind:"agent",agent:B,managerLabel:B.managerId?e.resolveMember(B.managerId):null,isOwnedBySelf:B.managerId===s,showVisibilityChip:(ee==null?void 0:ee.showVisibilityChip)??!1}),D=u.filter(x).map(B=>A(B,{showVisibilityChip:!0})).sort((B,ee)=>{const L=B.agent.visibility==="private"?0:1,I=ee.agent.visibility==="private"?0:1;return L!==I?L-I:B.agent.displayName.localeCompare(ee.agent.displayName,void 0,{sensitivity:"base"})}),z=f.filter(x).map(B=>A(B)),R=m.filter(x).map(B=>A(B)),F=[];return k&&F.push({key:"yours",title:"Your agents",count:D.length,rows:D,emptyMessage:n?"No agents match this search.":"You haven't created any agents yet. Click New agent above to add one."}),C&&F.push({key:"humans",title:"Humans",count:O.length,rows:O,emptyMessage:n?"No humans match this search.":void 0}),j&&F.push({key:"team",title:"Team agents",count:z.length,rows:z,emptyMessage:n?"No team agents match this search.":"No shared agents from other team members yet."}),E&&R.length>0&&F.push({key:"other-private",title:"Other members' private agents",count:R.length,rows:R,collapsible:!0}),F}function GQ(e){return e.filter(t=>t.type==="personal_assistant"&&t.status==="active")}const VQ=Object.values(_F);function QQ({target:e,isAdmin:t,isSaving:n,onClose:a,onSave:s}){const[o,u]=b.useState(""),[f,m]=b.useState("member"),[h,p]=b.useState(null);b.useEffect(()=>{e&&(u(e.displayName),m(e.role),p(null))},[e]);async function g(x){if(x.preventDefault(),!e)return;const k={};if(o.trim()&&o!==e.displayName&&(k.displayName=o.trim()),t&&f!==e.role&&(k.role=f),Object.keys(k).length===0){a();return}try{await s(k)}catch(C){p(C instanceof Error?C.message:String(C))}}const w=e!==null;return l.jsx(_n,{open:w,onOpenChange:x=>x?void 0:a(),children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsx(Tn,{children:"Edit profile"})}),e&&l.jsxs("form",{onSubmit:g,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{children:"Username"}),l.jsx(Kt,{value:e.username,disabled:!0,className:"font-mono"}),l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Username is permanent after creation."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"edit-member-display",children:"Display name"}),l.jsx(Kt,{id:"edit-member-display",value:o,onChange:x=>u(x.target.value),required:!0,maxLength:200})]}),t&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"edit-member-role",children:"Role"}),l.jsx("select",{id:"edit-member-role",value:f,onChange:x=>m(x.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:VQ.map(x=>l.jsx("option",{value:x,children:x},x))}),l.jsx("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:"Demoting the last admin is blocked — every org needs at least one admin to manage members."})]}),h&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:h}),l.jsxs(ir,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),l.jsx(xe,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function KQ({target:e,candidates:t,isSaving:n,onClose:a,onSave:s}){const[o,u]=b.useState(""),[f,m]=b.useState(null);b.useEffect(()=>{e&&(u(e.currentDelegate??""),m(null))},[e]);async function h(g){if(g.preventDefault(),!!e){m(null);try{await s(o||null)}catch(w){m(w instanceof Error?w.message:String(w))}}}const p=e!==null;return l.jsx(_n,{open:p,onOpenChange:g=>g?void 0:a(),children:l.jsxs(bn,{children:[l.jsx(In,{children:l.jsx(Tn,{children:"Set delegate"})}),e&&l.jsxs("form",{onSubmit:h,className:"space-y-4",children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-2)"},children:["Pick a personal assistant to act on behalf of ",l.jsx("strong",{children:e.humanDisplayName}),". When teammates @mention this human, the assistant receives the message and can reply in their place."]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(mt,{htmlFor:"set-delegate-pick",children:"Delegate"}),l.jsxs("select",{id:"set-delegate-pick",value:o,onChange:g=>u(g.target.value),className:"flex h-9 w-full rounded-[var(--radius-input)] border border-input bg-transparent px-3 py-1 text-body shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[l.jsx("option",{value:"",children:"None — no delegate"}),t.map(g=>l.jsx("option",{value:g.uuid,children:g.displayName?`${g.displayName} (@${g.name??g.uuid})`:g.name?`@${g.name}`:g.uuid},g.uuid))]}),t.length===0&&l.jsxs("p",{className:"text-caption",style:{color:"var(--fg-3)"},children:["No personal assistants available. Create one from the ",l.jsx("em",{children:"New agent"})," button above first."]})]}),f&&l.jsx("p",{className:"text-body",style:{color:"var(--state-error)"},children:f}),l.jsxs(ir,{children:[l.jsx(xe,{type:"button",variant:"ghost",onClick:a,disabled:n,children:"Cancel"}),l.jsx(xe,{type:"submit",disabled:n,children:n?"Saving…":"Save"})]})]})]})})}function Lh(e,t){return`/orgs/${encodeURIComponent(e)}/settings/${encodeURIComponent(t)}`}function Db(e){return Ce.get(Lh(e,"context_tree"))}function zT(e,t){return Ce.put(Lh(e,"context_tree"),t)}function IT(e){return Ce.get(Lh(e,"source_repos"))}function LT(e,t){return Ce.put(Lh(e,"source_repos"),t)}function rv({label:e,hint:t,value:n,onChange:a,saved:s=!1,mono:o=!1,type:u="text",placeholder:f,rightSlot:m,readOnly:h=!1,pattern:p}){const g=b.useId(),w=`flex-1 min-w-0 outline-none text-body focus-visible:ring-1 focus-visible:ring-ring ${o?"mono":""}`,x={padding:"var(--sp-1_5) var(--sp-2_5)",background:"var(--bg-sunken)",border:"var(--hairline) solid transparent",borderRadius:"var(--radius-input)",color:"var(--fg)"};return l.jsxs("div",{style:{marginBottom:"var(--sp-4)"},children:[l.jsxs("div",{className:"flex items-baseline justify-between",style:{gap:"var(--sp-2)"},children:[l.jsx("label",{htmlFor:g,className:"text-body font-medium",style:{color:"var(--fg)"},children:e}),s&&l.jsx(YQ,{})]}),t&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",margin:"var(--sp-0_5) 0 var(--sp-2)"},children:t}),l.jsxs("div",{className:"flex items-stretch",style:{gap:"var(--sp-2)"},children:[h?l.jsx("input",{id:g,value:n,readOnly:!0,className:w,style:{...x,color:"var(--fg-2)"}}):l.jsx("input",{id:g,value:n,onChange:k=>a==null?void 0:a(k.target.value),type:u,placeholder:f,pattern:p,className:w,style:x}),m]})]})}function YQ(){return l.jsxs("span",{className:"text-label inline-flex items-center fade-in",style:{gap:"var(--sp-1)",color:"color-mix(in oklch, var(--accent) 35%, var(--fg))"},children:[l.jsx(mr,{className:"h-3 w-3"}),"Saved"]})}function PT({pending:e,disabled:t=!1}){const n=e||t;return l.jsx("button",{type:"submit",disabled:n,"aria-label":"Save",title:"Save",className:"settings-save-button",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,width:"var(--sp-8)",background:"transparent",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",padding:0,cursor:n?"default":"pointer",color:"var(--fg-3)",opacity:n?.5:1,transition:"color 0.15s, background 0.15s, border-color 0.15s"},children:e?l.jsx(Zf,{className:"h-4 w-4 animate-spin"}):l.jsx(mr,{className:"h-4 w-4"})})}function XQ({isFirst:e=!1}){const{organizationId:t}=ut(),n=vn(),a=We({queryKey:["org-setting",t,"context_tree"],queryFn:()=>t?Db(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=b.useState(""),[u,f]=b.useState(""),[m,h]=b.useState(!1);b.useEffect(()=>{a.data&&(o(a.data.repo??""),f(a.data.branch??"main"))},[a.data]);const p=pt({mutationFn:()=>{if(!t)throw new Error("organization not loaded");return zT(t,{repo:s.trim()?s.trim():null,branch:u.trim()?u.trim():null})},onSuccess:w=>{n.setQueryData(["org-setting",t,"context_tree"],w),h(!0),setTimeout(()=>h(!1),2e3)}}),g=w=>{w.preventDefault(),p.mutate()};return l.jsx(Qu,{title:"Context tree",description:"Changes apply to new agent sessions. Members should restart agents to pick up updated tree contents.",isFirst:e,children:a.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load setting"}):l.jsxs("form",{onSubmit:g,children:[l.jsx(rv,{label:"Repo URL",hint:"HTTPS URL of the Context Tree git repository for this team.",value:s,onChange:o,mono:!0,placeholder:"https://github.com/your-org/first-tree-context"}),l.jsx(rv,{label:"Branch",hint:"Branch checked out by client agents on startup.",value:u,onChange:f,mono:!0,placeholder:"main",saved:m,rightSlot:l.jsx(PT,{pending:p.isPending,disabled:!a.data})}),p.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:p.error.message})]})})}function WQ({isFirst:e=!1}){var h;const{organizationId:t,role:n}=ut(),a=n==="admin",s=vn(),o=We({queryKey:["org-setting",t,"source_repos"],queryFn:()=>t?IT(t):Promise.reject(new Error("no org")),enabled:!!t}),u=pt({mutationFn:async p=>{var x;if(!t)throw new Error("organization not loaded");const w=(((x=o.data)==null?void 0:x.repos)??[]).filter(k=>k.url!==p);return LT(t,{repos:w})},onSuccess:p=>{s.setQueryData(["org-setting",t,"source_repos"],p)}}),f=((h=o.data)==null?void 0:h.repos)??[],m=f.length>0?l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:f.length}):null;return l.jsxs(Qu,{title:"Source repos",description:a?"Repos your team's agents are bound to. New repos are added during agent onboarding.":"Repos your team's agents are bound to. Read-only — only admins can edit.",right:m,isFirst:e,children:[o.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):o.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:o.error instanceof Error?o.error.message:"Failed to load setting"}):f.length===0?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)",padding:"var(--sp-3) var(--sp-2_5)",background:"var(--bg-sunken)",borderRadius:"var(--radius-input)"},children:"No source repos bound yet."}):l.jsx("ul",{style:{listStyle:"none",margin:0,padding:0},children:f.map(p=>l.jsx(JQ,{url:p.url,defaultBranch:p.defaultBranch,isAdmin:a,isRemoving:u.isPending,onRemove:()=>u.mutate(p.url)},p.url))}),u.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)",marginTop:"var(--sp-2)"},children:u.error.message})]})}function JQ({url:e,defaultBranch:t,isAdmin:n,isRemoving:a,onRemove:s}){return l.jsxs("li",{className:"group flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-2_5)",borderRadius:"var(--radius-input)"},children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body mono",style:{color:"var(--fg)",overflowWrap:"anywhere"},children:e}),t&&l.jsxs("div",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-0_5)"},children:["branch: ",t]})]}),n&&l.jsx("button",{type:"button","aria-label":`Remove ${e}`,disabled:a,onClick:s,className:"opacity-0 group-hover:opacity-100 focus:opacity-100 transition-opacity",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,border:0,borderRadius:"var(--radius-input)",background:"transparent",color:"var(--fg-3)",cursor:a?"not-allowed":"pointer",flexShrink:0},onMouseEnter:o=>{o.currentTarget.style.background="var(--surface-2)",o.currentTarget.style.color="var(--fg)"},onMouseLeave:o=>{o.currentTarget.style.background="transparent",o.currentTarget.style.color="var(--fg-3)"},children:l.jsx(pi,{className:"h-3.5 w-3.5"})})]})}function eK(e){return Ce.get(`/orgs/${encodeURIComponent(e)}`)}function tK(e,t){return Ce.patch(`/orgs/${encodeURIComponent(e)}`,t)}function nK({isFirst:e=!1}){const{organizationId:t}=ut(),n=vn(),a=We({queryKey:["organization",t],queryFn:()=>t?eK(t):Promise.reject(new Error("no org")),enabled:!!t}),[s,o]=b.useState(""),[u,f]=b.useState(!1);b.useEffect(()=>{a.data&&o(a.data.displayName)},[a.data]);const m=pt({mutationFn:()=>{if(!t||!a.data)throw new Error("organization not loaded");const p=s.trim();return!p||p===a.data.displayName?Promise.resolve(a.data):tK(t,{displayName:p})},onSuccess:p=>{n.setQueryData(["organization",t],p),n.invalidateQueries({queryKey:["me-organizations"]}),f(!0),setTimeout(()=>f(!1),2e3)}}),h=p=>{p.preventDefault(),m.mutate()};return l.jsx(Qu,{title:"Identity",isFirst:e,children:a.isLoading?l.jsx("div",{className:"text-body",style:{color:"var(--fg-3)"},children:"Loading…"}):a.error?l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:a.error instanceof Error?a.error.message:"Failed to load team"}):l.jsxs("form",{onSubmit:h,children:[l.jsx(rv,{label:"Team name",hint:"Shown in the team switcher and dashboard header.",value:s,onChange:o,saved:u,rightSlot:l.jsx(PT,{pending:m.isPending,disabled:!a.data})}),m.error instanceof Error&&l.jsx("div",{className:"text-body",style:{color:"var(--state-error)"},children:m.error.message})]})})}function rK(){const{role:e}=ut(),t=e==="admin";return l.jsxs("div",{children:[t&&l.jsx(nK,{isFirst:!0}),t&&l.jsx(XQ,{}),l.jsx(WQ,{isFirst:!t})]})}function aK(){const{role:e}=ut();if(e===null)return l.jsx("div",{className:"text-body",style:{padding:"var(--sp-5)",color:"var(--fg-3)"},children:"Loading..."});const t=e==="admin"?"Identity, Context Tree, source repos":"Repos your team's agents are bound to";return l.jsxs(l.Fragment,{children:[l.jsx(Uo,{title:"Team settings",subtitle:t}),l.jsx("div",{style:{padding:"var(--sp-2) var(--sp-5) var(--sp-7)"},children:l.jsx(rK,{})})]})}function iK(e,t){const n=new URLSearchParams({agentId:t.agentId,path:t.path});return t.basePath&&n.set("basePath",t.basePath),Ce.get(`/chats/${encodeURIComponent(e)}/docs/preview?${n.toString()}`)}const sK=/^[a-z][a-z0-9+.-]*:/i;function UT(e,t){const n=e.trim();if(!n||n.startsWith("#")||n.startsWith("//")||sK.test(n))return null;const a=n.split(/[?#]/,1).at(0)??"";if(!a.toLowerCase().endsWith(".md"))return null;let s=a.startsWith("/")?a.slice(1):a;if(t&&!a.startsWith("/")){const o=t.lastIndexOf("/");s=`${o>=0?t.slice(0,o+1):""}${a}`}return lK(s)}function lK(e){const t=[];for(const n of e.split("/"))if(!(!n||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n)}return t.length>0?t.join("/"):null}const mj=720,oK=.45,av=360,cK=320,pj=24;function uK(){return typeof window>"u"?mj:Math.max(av,Math.min(mj,Math.round(window.innerWidth*oK)))}function Fg(e){const t=Math.max(av,window.innerWidth-cK);return Math.min(Math.max(e,av),t)}function dK(){const[e,t]=b.useState(()=>typeof window>"u"?!1:window.matchMedia("(max-width: 47.999rem)").matches);return b.useEffect(()=>{const n=window.matchMedia("(max-width: 47.999rem)"),a=()=>t(n.matches);return a(),n.addEventListener("change",a),()=>n.removeEventListener("change",a)},[]),e}function fK(){var B,ee;const[e,t]=Oo(),n=e.get("docChat"),a=e.get("docAgent"),s=e.get("docPath"),o=e.get("docBase")??void 0,u=!!(n&&a&&s),f=dK(),[m,h]=b.useState(uK),p=b.useRef(null),g=b.useRef(null),w=b.useRef(null),x=b.useCallback(()=>{const L=new URLSearchParams(e);L.delete("docChat"),L.delete("docAgent"),L.delete("docPath"),L.delete("docBase"),t(L,{replace:!0})},[e,t]);b.useEffect(()=>{if(!u)return;const L=I=>{I.key==="Escape"&&x()};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[x,u]),b.useEffect(()=>{if(!u||!f)return;w.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const L=window.setTimeout(()=>{var I;return(I=g.current)==null?void 0:I.focus()},0);return()=>{window.clearTimeout(L);const I=w.current;w.current=null,I&&document.contains(I)&&I.focus()}},[u,f]);const k=We({queryKey:["me","docs","preview",n,a,o,s],queryFn:()=>iK(n??"",{agentId:a??"",basePath:o,path:s??""}),enabled:u}),C=((B=k.data)==null?void 0:B.ref.path)??s,j=((ee=k.data)==null?void 0:ee.path)??s,E=b.useMemo(()=>{const L=j??"";return L.split("/").filter(Boolean).at(-1)??L},[j]),O=j&&j!==E?j:null,A=b.useCallback(L=>{const I=new URLSearchParams(e);I.set("docPath",L),t(I)},[e,t]),D=b.useMemo(()=>({a({href:L,children:I,...Q}){const te=Y=>{if(!L||Y.defaultPrevented||Y.button!==0||Y.metaKey||Y.altKey||Y.ctrlKey||Y.shiftKey)return;const X=UT(L,C);X&&(Y.preventDefault(),A(X))};return l.jsx("a",{...Q,href:L,onClick:te,target:"_blank",rel:"noopener noreferrer",children:I})}}),[A,C]),z=b.useCallback(L=>{L.preventDefault();const I=document.body.style.cursor,Q=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const te=X=>{h(Fg(window.innerWidth-X.clientX))},Y=()=>{document.body.style.cursor=I,document.body.style.userSelect=Q,window.removeEventListener("mousemove",te),window.removeEventListener("mouseup",Y)};window.addEventListener("mousemove",te),window.addEventListener("mouseup",Y)},[]),R=b.useCallback(L=>{L.key==="ArrowLeft"&&(L.preventDefault(),h(I=>Fg(I+pj))),L.key==="ArrowRight"&&(L.preventDefault(),h(I=>Fg(I-pj)))},[]),F=b.useCallback(L=>{var Y;if(!f||L.key!=="Tab")return;const I=Array.from(((Y=p.current)==null?void 0:Y.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'))??[]).filter(X=>!X.hasAttribute("disabled")&&X.getAttribute("aria-hidden")!=="true"),Q=I.at(0),te=I.at(-1);if(!Q||!te){L.preventDefault();return}L.shiftKey&&document.activeElement===Q?(L.preventDefault(),te.focus()):!L.shiftKey&&document.activeElement===te&&(L.preventDefault(),Q.focus())},[f]);return u?l.jsxs("aside",{"aria-label":"Document preview","aria-modal":f,"data-doc-preview-drawer":"",className:Oe("z-40 flex flex-col bg-surface-raised text-text-primary shadow-2xl","animate-in slide-in-from-right duration-200",f?"fixed inset-0 w-full border-l border-border":"relative my-3 mr-3 h-auto shrink-0 overflow-hidden rounded-[var(--radius-panel)] border border-border-faint max-w-[calc(100vw-var(--sp-8))]"),onKeyDown:F,ref:p,role:"dialog",style:f?void 0:{width:m},children:[f?null:l.jsx("button",{"aria-label":"Resize document preview",className:"group absolute top-0 left-0 h-full w-3 -translate-x-1/2 cursor-col-resize",onMouseDown:z,onKeyDown:R,type:"button",children:l.jsx("div",{className:"mx-auto h-full w-1 bg-accent opacity-0 transition-opacity group-hover:opacity-100"})}),l.jsxs("header",{className:"flex min-h-12 items-center gap-3 px-4 pt-3 pb-2",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("div",{className:"truncate text-body font-medium",children:E}),O?l.jsx("div",{className:"truncate text-caption text-text-tertiary",children:O}):null]}),l.jsx(xe,{"aria-label":"Close document preview",onClick:x,ref:g,size:"icon",type:"button",variant:"ghost",children:l.jsx(pi,{className:"h-4 w-4","aria-hidden":"true"})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:[k.isLoading?l.jsxs("div",{className:"flex h-full items-center justify-center text-body text-text-secondary",children:[l.jsx(Zf,{className:"mr-2 h-4 w-4 animate-spin","aria-hidden":"true"}),"Loading preview"]}):null,k.isError?l.jsx("div",{className:"rounded-[var(--radius-panel)] border border-error bg-error-soft p-4 text-body text-error",children:k.error instanceof Error?k.error.message:"Unable to load document"}):null,k.data?l.jsx(Ih,{components:D,children:k.data.content}):null]})]}):null}function gj(e){const t=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&t.set("limit",String(e.limit)),e!=null&&e.cursor&&t.set("cursor",e.cursor),e!=null&&e.filter&&t.set("filter",e.filter),e!=null&&e.engagement&&t.set("engagement",e.engagement),e!=null&&e.source&&t.set("source",e.source);const n=t.toString();return Ce.get(hn(`/chats${n?`?${n}`:""}`))}function hK(e){const t=new URLSearchParams;e!=null&&e.engagement&&t.set("engagement",e.engagement);const n=t.toString();return Ce.get(hn(`/chats/source-counts${n?`?${n}`:""}`))}function mK(e){return Ce.post(hn("/chats"),e)}function pK(e){return Ce.post(`/chats/${encodeURIComponent(e)}/read`)}function gK(e){return Ce.post(`/chats/${encodeURIComponent(e)}/unread`)}function yK(e,t){return Ce.post(`/chats/${encodeURIComponent(e)}/participants`,t)}function vK(e){return Ce.post(`/chats/${encodeURIComponent(e)}/workspace-join`)}const bK=1e3;function xK(e){if(e<0)return"0s";if(e<1e3)return`${(e/1e3).toFixed(1)}s`;const t=Math.floor(e/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60),a=t%60;return`${n}m${a.toString().padStart(2,"0")}s`}function wK({activity:e}){const t=new Date(e.startedAt).getTime(),[n,a]=b.useState(()=>Date.now());b.useEffect(()=>{const o=setInterval(()=>a(Date.now()),bK);return()=>clearInterval(o)},[]);const s=xK(n-t);return l.jsxs("span",{role:"status","aria-label":`${e.label}, ${s}`,className:"mono text-caption shrink-0 inline-flex items-center",style:{gap:6,color:"var(--state-working)"},children:[l.jsx("span",{"aria-hidden":"true",className:"chat-row-live-chip__dot",style:{display:"inline-block",width:6,height:6,borderRadius:"50%",background:"var(--state-working)"}}),l.jsx("span",{className:"truncate",style:{maxWidth:96},children:e.label}),l.jsx("span",{style:{color:"var(--fg-4)"},children:s})]})}function BT(e){return Ce.get(`/chats/${encodeURIComponent(e)}`)}function SK(e,t){return Ce.patch(`/chats/${encodeURIComponent(e)}`,{topic:t})}function FT(e,t){return Ce.post(`/chats/${encodeURIComponent(e)}/engagement`,{status:t})}function No(e,t){return Ce.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"text",content:t})}function kK(e,t,n){const a=n==null?void 0:n.mentions,s=Array.isArray(a)&&a.length>0;return Ce.post(`/chats/${encodeURIComponent(e)}/messages`,{format:"file",content:t,...s?{metadata:{mentions:a}}:{}})}function jK(e){return new Promise((t,n)=>{const a=new FileReader;a.onload=()=>{const s=a.result;if(typeof s!="string"){n(new Error("Unexpected FileReader result"));return}const o=s.indexOf(",");t(o>=0?s.slice(o+1):s)},a.onerror=()=>n(a.error??new Error("FileReader error")),a.readAsDataURL(e)})}function zb(e){return Ce.post(`/agents/${encodeURIComponent(e)}/chats`,{})}function CK(e,t){const n=new URLSearchParams;n.set("limit",String(t.limit)),t!=null&&t.cursor&&n.set("cursor",t.cursor);const a=n.toString();return Ce.get(`/chats/${encodeURIComponent(e)}/messages${a?`?${a}`:""}`)}const{ACTIVE:yj,ARCHIVED:vj,DELETED:bj}=By;function EK({status:e,hasUnread:t,runEngagement:n,runMarkUnread:a}){return e===yj?[{key:"mark-unread",label:"Mark as unread",disabled:t,onSelect:a},{key:"archive",label:"Archive",onSelect:()=>n(vj)},{key:"delete",label:"Delete",destructive:!0,onSelect:()=>n(bj)}]:e===vj?[{key:"unarchive",label:"Unarchive",onSelect:()=>n(yj)},{key:"delete",label:"Delete",destructive:!0,onSelect:()=>n(bj)}]:[]}const NK="opacity-0 group-hover:opacity-100 focus-visible:opacity-100 aria-expanded:opacity-100";function _K({chatId:e,status:t,hasUnread:n}){const a=vn(),s=()=>{a.invalidateQueries({queryKey:["me","chats"]}),a.invalidateQueries({queryKey:["chat-detail",e]})},o=pt({mutationFn:m=>FT(e,m),onSuccess:s}),u=pt({mutationFn:()=>gK(e),onSuccess:s}),f=EK({status:t,hasUnread:n,runEngagement:m=>o.mutate(m),runMarkUnread:()=>u.mutate()});return l.jsx(Ob,{actions:f,ariaLabel:"Manage chat",triggerClassName:NK})}const Ib="draft",TK=[{value:"active",label:"Active"},{value:"archived",label:"Archived"},{value:"all",label:"All"}],AK=[{value:"manual",label:"Manual"},{value:"github_pull_request",label:"PR"},{value:"github_issue",label:"Issue"},{value:"github_discussion",label:"Discussion"},{value:"github_commit",label:"Commit"},{value:"feishu",label:"Feishu"}];function RK(e){if(!e)return"";const t=new Date(e),a=Date.now()-t.getTime();if(a<6e4)return"now";if(a<60*6e4)return`${Math.round(a/6e4)}m`;if(a<1440*6e4)return`${Math.round(a/36e5)}h`;const s=new Intl.DateTimeFormat("en-GB",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),o=u=>{var f;return((f=s.find(m=>m.type===u))==null?void 0:f.value)??""};return`${o("month")}/${o("day")} ${o("hour")}:${o("minute")}`}function OK(e){return e.membershipKind==="watching"?e.lastMessagePreview?`Watching · ${e.lastMessagePreview}`:"Watching":e.lastMessagePreview??""}function MK({selectedChatId:e,onSelectChat:t,onNewChat:n,engagement:a,onEngagementChange:s,source:o,onSourceChange:u}){const{agentId:f}=ut(),[m,h]=b.useState("all"),[p,g]=b.useState([]),[w,x]=b.useState(!1),[k,C]=b.useState(null),{data:j,isLoading:E}=We({queryKey:["me","chats",m,a,o],queryFn:()=>gj({filter:m,engagement:a,source:o}),refetchInterval:15e3}),{data:O}=We({queryKey:["me","chats","source-counts",a],queryFn:()=>hK({engagement:a}),refetchInterval:15e3}),A=()=>{p.length>0&&g([]),C(null)};b.useEffect(()=>{g(te=>te.length>0?[]:te),C(null)},[o,a]);const D=(j==null?void 0:j.rows)??[],z=b.useMemo(()=>[...D,...p],[D,p]),R=async()=>{if(w)return;const te=j==null?void 0:j.nextCursor;if(te){x(!0),C(null);try{const Y=await gj({filter:m,engagement:a,cursor:te,source:o});g(X=>[...X,...Y.rows]),B(Y.nextCursor)}catch(Y){C(Y instanceof Error?Y.message:"Failed to load more")}finally{x(!1)}}},[F,B]=b.useState(null),ee=(j==null?void 0:j.nextCursor)??null;b.useEffect(()=>{B(ee)},[ee]);const L=b.useMemo(()=>z.reduce((te,Y)=>te+(Y.unreadMentionCount>0?1:0),0),[z]),I=e===Ib,Q=m==="unread";return b.useEffect(()=>{Q&&L===0&&h("all")},[Q,L]),l.jsxs("aside",{className:"shrink-0 flex flex-col overflow-hidden",style:{width:320,background:"var(--bg-raised)",borderRight:"var(--hairline) solid var(--border)"},children:[l.jsxs("div",{className:"shrink-0 flex flex-col",style:{gap:"var(--sp-2)",padding:"var(--sp-2_5) var(--sp-3) var(--sp-2)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"radial-gradient(140% 80% at 0% 0%, var(--accent-bg) 0%, transparent 60%)"},children:[l.jsxs("button",{type:"button",onClick:n,"aria-current":I?"page":void 0,className:Oe("group relative w-full inline-flex items-center transition-colors text-body cursor-pointer font-semibold",!I&&"hover:bg-[var(--bg-hover)] hover:border-[var(--border-strong)]","focus-visible:outline-none focus-visible:border-[var(--accent-dim)]"),style:{gap:"var(--sp-2)",padding:"var(--sp-1_75) var(--sp-2) var(--sp-1_75) var(--sp-2_5)",borderWidth:"var(--hairline)",borderStyle:"solid",borderColor:I?"var(--accent-dim)":"var(--border)",borderRadius:"var(--radius-panel)",background:I?"var(--accent-bg)":"var(--bg-raised)",color:I?"var(--accent)":"var(--fg)"},title:"New chat",children:[l.jsx("span",{"aria-hidden":!0,className:"absolute pointer-events-none",style:{left:-1,top:-1,bottom:-1,width:3,background:"var(--accent)",borderRadius:"var(--radius-panel) 0 0 var(--radius-panel)"}}),l.jsx("span",{"aria-hidden":!0,className:"inline-flex items-center justify-center shrink-0 transition-colors group-hover:bg-[var(--accent)] group-hover:text-[var(--fg-on-vivid)]",style:{width:20,height:20,borderRadius:"var(--radius-chip)",background:I?"var(--accent)":"var(--accent-bg)",color:I?"var(--fg-on-vivid)":"var(--accent)"},children:l.jsx(Sa,{className:"h-3 w-3",strokeWidth:2})}),l.jsx("span",{className:"flex-1 text-left",children:"New chat"})]}),l.jsx("div",{className:"flex items-center flex-wrap",style:{gap:4},children:AK.map(te=>{const Y=O==null?void 0:O.counts[te.value];if(te.value!=="manual"&&(!Y||Y.chatCount===0))return null;const X=(Y==null?void 0:Y.unreadChatCount)??0;return l.jsx(nv,{active:o===te.value,count:X>0?X:void 0,warn:X>0,onClick:()=>{o!==te.value&&(u(te.value),A())},children:te.label},te.value)})}),l.jsx("div",{className:"flex items-center",style:{gap:4},children:TK.map(te=>l.jsx(nv,{active:a===te.value,onClick:()=>{a!==te.value&&(s(te.value),A())},children:te.label},te.value))}),L>0&&l.jsxs("div",{className:"mono flex items-center justify-between text-caption",style:{padding:"0 var(--sp-0_5)",color:"var(--fg-4)"},children:[l.jsxs("button",{type:"button",onClick:()=>{h(Q?"all":"unread"),A()},"aria-pressed":Q,className:"mono cursor-pointer bg-transparent border-0 p-0 text-caption transition-opacity hover:opacity-80",style:{color:"var(--state-unread)",textDecoration:Q?"underline":"none",textUnderlineOffset:2},title:Q?"Show all chats":"Filter to unread only",children:[L," unread"]}),!Q&&l.jsxs("span",{children:[z.length," ",z.length===1?"chat":"chats"," · workspace"]})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto",children:[E&&z.length===0&&l.jsx("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:"Loading…"}),!E&&z.length===0&&l.jsxs("div",{className:"text-center text-body",style:{padding:"var(--sp-6) var(--sp-3)",color:"var(--fg-3)"},children:[l.jsx("p",{style:{margin:0},children:"No conversations yet."}),l.jsx("p",{className:"text-label",style:{margin:"var(--sp-1) 0 0",color:"var(--fg-4)"},children:"Start with New chat."})]}),z.map(te=>{const Y=e===te.chatId,X=OK(te),G=X&&X!==te.title?X:"",se=te.unreadMentionCount>0;return l.jsxs("div",{className:"group relative",style:{borderBottom:"var(--hairline) solid var(--border-faint)"},children:[l.jsxs("button",{type:"button",onClick:()=>t(te.chatId),className:Oe("w-full text-left transition-colors flex items-center","hover:bg-[var(--bg-hover)]"),style:{padding:"var(--sp-2) var(--sp-3)",gap:"var(--sp-2_5)",background:Y?"var(--bg-active)":"transparent",borderLeft:`var(--hairline-bold) solid ${Y?"var(--accent)":"transparent"}`},children:[l.jsx(W4,{title:te.title,type:te.type,participants:te.participants,selfAgentId:f??"",engagedAgentIds:te.engagedAgentIds,unreadCount:te.unreadMentionCount}),l.jsxs("div",{className:"flex flex-col",style:{flex:1,minWidth:0},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:6},children:[l.jsx("span",{className:"truncate text-subtitle",style:{color:se?"var(--fg)":"var(--fg-2)",fontWeight:se?700:500,flex:1,minWidth:0},children:te.title}),(()=>{const J=te.liveActivity?l.jsx(wK,{activity:te.liveActivity}):te.lastMessageAt?l.jsx("span",{className:"mono text-caption shrink-0",style:{color:"var(--fg-4)"},children:RK(te.lastMessageAt)}):null;return J?l.jsx("span",{className:"shrink-0 transition-opacity group-hover:opacity-0 group-has-aria-expanded:opacity-0",children:J}):null})()]}),l.jsx("div",{className:"truncate text-body",style:{color:se?"var(--fg-2)":"var(--fg-3)",marginTop:2},children:G||"—"})]})]}),l.jsx("div",{className:"absolute",style:{top:"var(--sp-2)",right:"var(--sp-3)"},children:l.jsx(_K,{chatId:te.chatId,status:te.engagementStatus,hasUnread:se})})]},te.chatId)}),F&&z.length>0&&l.jsxs("div",{style:{padding:"var(--sp-2) var(--sp-3)"},children:[l.jsx("button",{type:"button",onClick:R,disabled:w,className:"w-full text-body mono",style:{padding:"var(--sp-1_25) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-sunken)",color:"var(--fg-2)",cursor:w?"default":"pointer",opacity:w?.6:1},children:w?"Loading…":"Load more"}),k&&l.jsx("p",{className:"mono text-caption",style:{color:"var(--state-error)",marginTop:4},children:k})]})]})]})}function Lb(e){const t=new Map;for(const a of e)a.displayName&&t.set(a.displayName,(t.get(a.displayName)??0)+1);const n=new Set;for(const[a,s]of t)s>1&&n.add(a);return n}function DK(e,t){return!e.name||!e.displayName?!1:e.displayName!==e.name?!0:t.has(e.displayName)}function Pb({candidate:e,ambiguous:t}){const n=e.name?`@${e.name}`:"—";return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"font-medium",children:e.displayName??n}),DK(e,t)&&l.jsxs("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:["@",e.name]})]})}function zK(e,t){if(t<=0||t>e.length)return null;let n=t-1;for(;n>=0;){const s=e[n];if(s===void 0)return null;if(s==="@")break;if(!/[A-Za-z0-9_-]/.test(s))return null;n--}if(n<0||e[n]!=="@")return null;if(n>0){const s=e[n-1];if(s!==void 0&&/[A-Za-z0-9_.@-]/.test(s))return null}const a=e.slice(n+1,t).toLowerCase();return{triggerIndex:n,query:a}}function xj(e,t){return(e.displayName??e.name??"").localeCompare(t.displayName??t.name??"")}function Ub(e){const t=e.filter(a=>a.managedByMe).sort(xj),n=e.filter(a=>!a.managedByMe).sort(xj);return t.length>0&&n.length>0?[...t,{divider:!0},...n]:[...t,...n]}function IK(e,t){if(!t)return Ub(e).filter(a=>!("divider"in a)).slice(0,8);const n=[];for(const a of e){const s=(a.name??"").toLowerCase(),o=(a.displayName??"").toLowerCase();let u=1/0;s.startsWith(t)?u=0:o.startsWith(t)?u=1:o.includes(t)&&(u=2),u!==1/0&&n.push({c:a,score:u})}return n.sort((a,s)=>a.score-s.score||(a.c.displayName??"").localeCompare(s.c.displayName??"")),n.slice(0,8).map(a=>a.c)}function LK(e,t,n,a){if(!a.name)return null;const s=e.slice(0,t.triggerIndex),o=e.slice(n),u=`@${a.name}`,f=o.length===0||!/\s/.test(o[0]??""),m=f?` ${o}`:o,h=`${s}${u}${m}`,p=s.length+u.length+(f?1:0);return{text:h,cursor:p}}function $T({value:e,cursor:t,candidates:n,onSelect:a,disabled:s}){const[o,u]=b.useState(0),[f,m]=b.useState(null),h=b.useMemo(()=>s?null:zK(e,t),[e,t,s]),p=b.useMemo(()=>h?IK(n,h.query):[],[h,n]),g=h?`${h.triggerIndex}:${h.query}`:"";b.useEffect(()=>{u(0)},[g]),b.useEffect(()=>{h===null&&f!==null&&m(null)},[h,f]);const w=f!==null&&h!==null&&f===h.triggerIndex,x=h!==null&&p.length>0&&!w;function k(){m((h==null?void 0:h.triggerIndex)??null)}function C(E){if(!h)return;const O=LK(e,h,t,E);O&&a(O)}return{trigger:x?h:null,results:x?p:[],highlightIndex:o,handleKey:E=>{if(!x||!h)return!1;if(E.key==="ArrowDown")return E.preventDefault(),u(O=>p.length===0?0:(O+1)%p.length),!0;if(E.key==="ArrowUp")return E.preventDefault(),u(O=>p.length===0?0:(O-1+p.length)%p.length),!0;if(E.key==="Enter"||E.key==="Tab"){const O=p[o]??p[0];return O?(E.preventDefault(),C(O),!0):!1}return E.key==="Escape"?(E.preventDefault(),k(),!0):!1},pick:C,dismiss:k}}function HT({trigger:e,results:t,highlightIndex:n,onPick:a,anchorRef:s}){const o=b.useRef(null);return b.useEffect(()=>{var m;const f=(m=o.current)==null?void 0:m.querySelector(`[data-mention-index="${n}"]`);f==null||f.scrollIntoView({block:"nearest"})},[n]),!e||t.length===0||!s.current?null:l.jsx("div",{ref:o,role:"listbox","aria-label":"Mention suggestions",className:Oe("absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg"),style:{bottom:"calc(100% + var(--sp-1))",left:0,minWidth:240,maxWidth:360,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const f=Lb(t);return t.map((m,h)=>{const p=h===n;return l.jsx("button",{type:"button",role:"option","aria-selected":p,"data-mention-index":h,title:m.name?`@${m.name}`:void 0,onMouseDown:g=>{g.preventDefault(),a(m)},className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:p?"var(--bg-hover)":"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(Pb,{candidate:m,ambiguous:f})},m.agentId)})})()})}function qT(e,t){b.useLayoutEffect(()=>{const n=e.current;n&&(n.style.height="auto",n.style.height=`${n.scrollHeight}px`)},[e,t])}function PK({onCreated:e}){const t=vn(),{agentId:n}=ut(),a=Hv(),[s,o]=b.useState([]),[u,f]=b.useState(""),[m,h]=b.useState(0),[p,g]=b.useState(null),[w,x]=b.useState(!1),[k,C]=b.useState(!1),j=b.useRef(null),E=b.useRef(!1),O=b.useRef(null);qT(j,u);const{data:A}=We({queryKey:["activity"],queryFn:Pu,refetchInterval:15e3}),D=b.useMemo(()=>{const Y=(A==null?void 0:A.agents)??[],X=[];for(const G of Y){if(n&&G.agentId===n)continue;const se=a(G.agentId);!se||!se.name||X.push({agentId:G.agentId,name:se.name,displayName:se.displayName,managedByMe:G.managedByMe})}return X},[A,a,n]);b.useEffect(()=>{if(E.current||s.length>0||D.length===0)return;const Y=BK(D,(A==null?void 0:A.agents)??[]);Y&&(o([Y]),E.current=!0)},[D,A,s.length]);const z=b.useMemo(()=>{const Y=D.map(X=>({agentId:X.agentId,name:X.name}));return YN(u,Y)},[u,D]),R=$T({value:u,cursor:m,candidates:D,disabled:w,onSelect:Y=>{f(Y.text),h(Y.cursor),requestAnimationFrame(()=>{const X=j.current;X&&(X.focus(),X.setSelectionRange(Y.cursor,Y.cursor))})}});b.useEffect(()=>{z.length!==0&&o(Y=>{const X=new Set(Y);let G=!1;for(const se of z)X.has(se)||(X.add(se),G=!0);return G?[...X]:Y})},[z]),b.useEffect(()=>{if(!k)return;const Y=X=>{O.current&&(O.current.contains(X.target)||C(!1))};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[k]);const F=pt({mutationFn:async({participantIds:Y,text:X})=>{const G=await mK({participantIds:Y}),se=X.trim();return se.length>0&&await No(G.chatId,se),G.chatId},onSuccess:Y=>{f(""),o([]),E.current=!1,t.invalidateQueries({queryKey:["me","chats"]}),e(Y)},onError:Y=>{g(Y instanceof Error?Y.message:"Failed to create chat")}}),B=b.useMemo(()=>!(w||F.isPending||s.length===0||u.trim().length===0||s.length>=2&&z.length===0),[w,F.isPending,s.length,u,z.length]),ee=b.useMemo(()=>s.length===0?"Add at least one participant":u.trim().length===0?null:s.length>=2&&z.length===0?"Group chats need an @ to wake at least one participant":null,[s.length,u,z.length]),L=async()=>{if(!B)return;const Y=Array.from(new Set([...s,...z]));g(null),x(!0);try{await F.mutateAsync({participantIds:Y,text:u})}finally{x(!1)}},I=Y=>{o(X=>X.filter(G=>G!==Y))},Q=Y=>{o(X=>X.includes(Y)?X:[...X,Y]),C(!1)},te=b.useMemo(()=>D.filter(Y=>!s.includes(Y.agentId)),[D,s]);return l.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",style:{background:"var(--bg-base)"},children:l.jsx("div",{className:"flex-1 flex flex-col items-center justify-center",style:{padding:"var(--sp-6)"},children:l.jsxs("div",{style:{width:"100%",maxWidth:"clamp(55rem, 75%, 70rem)"},children:[l.jsx("p",{className:"text-title",style:{color:"var(--fg)",textAlign:"center",marginBottom:"var(--sp-5)"},children:"What's the task?"}),l.jsxs("div",{style:{borderRadius:10,background:"var(--bg-raised)",boxShadow:"var(--shadow-md)",overflow:"visible"},children:[l.jsx(UK,{chips:s,candidates:D,chipCandidates:te,pickerOpen:k,setPickerOpen:C,pickerContainerRef:O,onAdd:Q,onRemove:I}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx(HT,{trigger:R.trigger,results:R.results,highlightIndex:R.highlightIndex,anchorRef:j,onPick:R.pick}),l.jsx("textarea",{ref:j,value:u,onChange:Y=>{f(Y.target.value),h(Y.target.selectionStart??Y.target.value.length)},onSelect:Y=>{h(Y.currentTarget.selectionStart??u.length)},placeholder:s.length>=2?"Describe the task. Use @ to address one or more.":"Describe the task…",rows:1,onKeyDown:Y=>{Y.nativeEvent.isComposing||R.handleKey(Y)||Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),L())},disabled:w||F.isPending,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2) var(--sp-3)",background:"transparent",border:"none",maxHeight:"10.5rem",overflowY:"auto",resize:"none",color:"var(--fg)"}}),s.length>=2&&z.length===0&&u.trim().length>0&&l.jsxs("div",{"aria-hidden":"true",className:"text-subtitle font-normal",style:{position:"absolute",inset:0,padding:"var(--sp-2) var(--sp-3)",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",pointerEvents:"none",color:"transparent",overflow:"hidden"},children:[u,l.jsx("span",{style:{color:"var(--fg-4)"},children:" ← @ a group member to send"})]})]}),l.jsx("div",{className:"flex items-center justify-end",style:{padding:"var(--sp-1_5) var(--sp-2_5)"},children:l.jsx("button",{type:"button",onClick:()=>void L(),disabled:!B,title:ee??"Send (Enter)","aria-label":"Send",className:Oe("inline-flex items-center justify-center transition-opacity",!B&&"opacity-40 cursor-not-allowed"),style:{width:28,height:28,borderRadius:"var(--radius-input)",background:"var(--fg)",color:"var(--bg-raised)",border:"none"},children:l.jsx($C,{className:"h-3.5 w-3.5",strokeWidth:2.5})})})]}),p&&l.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:8},children:p})]})})})}function UK({chips:e,candidates:t,chipCandidates:n,pickerOpen:a,setPickerOpen:s,pickerContainerRef:o,onAdd:u,onRemove:f}){return l.jsxs("div",{className:"flex items-center flex-wrap",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) var(--sp-1)"},children:[e.map(m=>{const h=t.find(g=>g.agentId===m),p=(h==null?void 0:h.displayName)??(h==null?void 0:h.name)??m;return l.jsxs("span",{className:"group inline-flex items-center text-label",style:{gap:2,padding:"var(--sp-0_5) var(--sp-1_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-sunken)",color:"var(--fg)"},children:[l.jsx("span",{children:p}),l.jsx("button",{type:"button",onClick:()=>f(m),title:"Remove participant",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{background:"none",border:"none",padding:0,marginLeft:2,cursor:"pointer",color:"var(--fg-3)",display:"inline-flex",alignItems:"center"},children:l.jsx(pi,{className:"h-3 w-3"})})]},m)}),l.jsxs("div",{ref:o,style:{position:"relative"},children:[l.jsx("button",{type:"button",onClick:()=>s(!a),title:"Add participant","aria-label":"Add participant",disabled:n.length===0,className:"inline-flex items-center transition-colors hover:bg-[var(--bg-sunken)]",style:{padding:"var(--sp-0_5) var(--sp-1)",borderRadius:"var(--radius-chip)",border:"var(--hairline) solid var(--border)",background:"transparent",color:n.length===0?"var(--fg-4)":"var(--fg-3)",cursor:n.length===0?"not-allowed":"pointer"},children:l.jsx(Sa,{className:"h-3 w-3"})}),a&&n.length>0&&l.jsx("div",{role:"listbox","aria-label":"Add participant",className:"absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg",style:{top:"calc(100% + var(--sp-1))",left:0,minWidth:280,background:"var(--bg-raised)",borderColor:"var(--border)"},children:(()=>{const m=Lb(n);return Ub(n).map(h=>"divider"in h?l.jsx("div",{role:"presentation",style:{height:"var(--hairline)",background:"var(--border-faint)",margin:"var(--sp-0_5) var(--sp-3)"}},"__divider"):l.jsx("button",{type:"button",role:"option","aria-selected":"false",title:h.name?`@${h.name}`:void 0,onClick:()=>u(h.agentId),className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(Pb,{candidate:h,ambiguous:m})},h.agentId))})()})]})]})}function BK(e,t){var u;const n=new Set(e.map(f=>f.agentId)),a=t.filter(f=>n.has(f.agentId)&&f.managedByMe);if(a.length===0)return null;const s=[...a].filter(f=>f.runtimeUpdatedAt).sort((f,m)=>(m.runtimeUpdatedAt??"").localeCompare(f.runtimeUpdatedAt??""))[0];if(s)return s.agentId;const o=a.find(f=>f.type==="personal_assistant");return o?o.agentId:((u=a[0])==null?void 0:u.agentId)??null}const FK="first-tree-hub-images",$K=1,_o="images";let Rf=null;function ZT(){return Rf||(Rf=new Promise(e=>{if(typeof indexedDB>"u"){e(null);return}const t=indexedDB.open(FK,$K);t.onupgradeneeded=()=>{const n=t.result;n.objectStoreNames.contains(_o)||n.createObjectStore(_o,{keyPath:"imageId"})},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null),t.onblocked=()=>e(null)}),Rf)}async function HK(e){const t=await ZT();if(!t)throw new Error("Image storage unavailable (IndexedDB disabled or blocked)");await new Promise((n,a)=>{const s=t.transaction(_o,"readwrite"),o=s.objectStore(_o),u={imageId:e.imageId,base64:e.base64,mimeType:e.mimeType,createdAt:Date.now()};o.put(u),s.oncomplete=()=>n(),s.onerror=()=>a(s.error??new Error("Image storage write failed")),s.onabort=()=>a(s.error??new Error("Image storage write aborted"))})}async function qK(e){const t=await ZT();return t?new Promise(n=>{const o=t.transaction(_o,"readonly").objectStore(_o).get(e);o.onsuccess=()=>{const u=o.result;if(!u){n(null);return}n({base64:u.base64,mimeType:u.mimeType})},o.onerror=()=>n(null)}):null}function ZK(e,t,n){return Ce.post(`/chats/${encodeURIComponent(e)}/questions/${encodeURIComponent(t)}/answer`,{answers:n})}/*! @license DOMPurify 3.4.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.2/LICENSE */const{entries:GT,setPrototypeOf:wj,isFrozen:GK,getPrototypeOf:VK,getOwnPropertyDescriptor:QK}=Object;let{freeze:pr,seal:da,create:Wl}=Object,{apply:iv,construct:sv}=typeof Reflect<"u"&&Reflect;pr||(pr=function(t){return t});da||(da=function(t){return t});iv||(iv=function(t,n){for(var a=arguments.length,s=new Array(a>2?a-2:0),o=2;o<a;o++)s[o-2]=arguments[o];return t.apply(n,s)});sv||(sv=function(t){for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return new t(...a)});const Zc=Nn(Array.prototype.forEach),KK=Nn(Array.prototype.lastIndexOf),Sj=Nn(Array.prototype.pop),Gc=Nn(Array.prototype.push),YK=Nn(Array.prototype.splice),ur=Array.isArray,Jc=Nn(String.prototype.toLowerCase),$g=Nn(String.prototype.toString),kj=Nn(String.prototype.match),Ql=Nn(String.prototype.replace),jj=Nn(String.prototype.indexOf),XK=Nn(String.prototype.trim),WK=Nn(Number.prototype.toString),JK=Nn(Boolean.prototype.toString),Cj=typeof BigInt>"u"?null:Nn(BigInt.prototype.toString),Ej=typeof Symbol>"u"?null:Nn(Symbol.prototype.toString),un=Nn(Object.prototype.hasOwnProperty),Vc=Nn(Object.prototype.toString),Yn=Nn(RegExp.prototype.test),Of=eY(TypeError);function Nn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,a=new Array(n>1?n-1:0),s=1;s<n;s++)a[s-1]=arguments[s];return iv(e,t,a)}}function eY(e){return function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return sv(e,n)}}function at(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Jc;if(wj&&wj(e,null),!ur(t))return e;let a=t.length;for(;a--;){let s=t[a];if(typeof s=="string"){const o=n(s);o!==s&&(GK(t)||(t[a]=o),s=o)}e[s]=!0}return e}function tY(e){for(let t=0;t<e.length;t++)un(e,t)||(e[t]=null);return e}function Er(e){const t=Wl(null);for(const[n,a]of GT(e))un(e,n)&&(ur(a)?t[n]=tY(a):a&&typeof a=="object"&&a.constructor===Object?t[n]=Er(a):t[n]=a);return t}function nY(e){switch(typeof e){case"string":return e;case"number":return WK(e);case"boolean":return JK(e);case"bigint":return Cj?Cj(e):"0";case"symbol":return Ej?Ej(e):"Symbol()";case"undefined":return Vc(e);case"function":case"object":{if(e===null)return Vc(e);const t=e,n=Jl(t,"toString");if(typeof n=="function"){const a=n(t);return typeof a=="string"?a:Vc(a)}return Vc(e)}default:return Vc(e)}}function Jl(e,t){for(;e!==null;){const a=QK(e,t);if(a){if(a.get)return Nn(a.get);if(typeof a.value=="function")return Nn(a.value)}e=VK(e)}function n(){return null}return n}function rY(e){try{return Yn(e,""),!0}catch{return!1}}const Nj=pr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Hg=pr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),qg=pr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),aY=pr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Zg=pr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),iY=pr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_j=pr(["#text"]),Tj=pr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Gg=pr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Aj=pr(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Mf=pr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),sY=da(/\{\{[\w\W]*|[\w\W]*\}\}/gm),lY=da(/<%[\w\W]*|[\w\W]*%>/gm),oY=da(/\$\{[\w\W]*/gm),cY=da(/^data-[\-\w.\u00B7-\uFFFF]+$/),uY=da(/^aria-[\-\w]+$/),VT=da(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),dY=da(/^(?:\w+script|data):/i),fY=da(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),QT=da(/^html$/i),hY=da(/^[a-z][.\w]*(-[.\w]+)+$/i);var Rj=Object.freeze({__proto__:null,ARIA_ATTR:uY,ATTR_WHITESPACE:fY,CUSTOM_ELEMENT:hY,DATA_ATTR:cY,DOCTYPE_NAME:QT,ERB_EXPR:lY,IS_ALLOWED_URI:VT,IS_SCRIPT_OR_DATA:dY,MUSTACHE_EXPR:sY,TMPLIT_EXPR:oY});const Qc={element:1,text:3,progressingInstruction:7,comment:8,document:9},mY=function(){return typeof window>"u"?null:window},pY=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let a=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(a=n.getAttribute(s));const o="dompurify"+(a?"#"+a:"");try{return t.createPolicy(o,{createHTML(u){return u},createScriptURL(u){return u}})}catch{return console.warn("TrustedTypes policy "+o+" could not be created."),null}},Oj=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function KT(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:mY();const t=$e=>KT($e);if(t.version="3.4.2",t.removed=[],!e||!e.document||e.document.nodeType!==Qc.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const a=n,s=a.currentScript,{DocumentFragment:o,HTMLTemplateElement:u,Node:f,Element:m,NodeFilter:h,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:w,trustedTypes:x}=e,k=m.prototype,C=Jl(k,"cloneNode"),j=Jl(k,"remove"),E=Jl(k,"nextSibling"),O=Jl(k,"childNodes"),A=Jl(k,"parentNode");if(typeof u=="function"){const $e=n.createElement("template");$e.content&&$e.content.ownerDocument&&(n=$e.content.ownerDocument)}let D,z="";const{implementation:R,createNodeIterator:F,createDocumentFragment:B,getElementsByTagName:ee}=n,{importNode:L}=a;let I=Oj();t.isSupported=typeof GT=="function"&&typeof A=="function"&&R&&R.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Q,ERB_EXPR:te,TMPLIT_EXPR:Y,DATA_ATTR:X,ARIA_ATTR:G,IS_SCRIPT_OR_DATA:se,ATTR_WHITESPACE:J,CUSTOM_ELEMENT:ve}=Rj;let{IS_ALLOWED_URI:M}=Rj,U=null;const P=at({},[...Nj,...Hg,...qg,...Zg,..._j]);let _=null;const V=at({},[...Tj,...Gg,...Aj,...Mf]);let H=Object.seal(Wl(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ae=null,Se=null;const Ae=Object.seal(Wl(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ee=!0,Ge=!0,Fe=!1,Ve=!0,st=!1,Nt=!0,we=!1,ze=!1,et=!1,Ct=!1,le=!1,me=!1,Pe=!0,qe=!1;const Gt="user-content-";let nt=!0,An=!1,ue={},be=null;const Ne=at({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Xe=null;const wt=at({},["audio","video","img","source","image","track"]);let Rn=null;const gr=at({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Yt="http://www.w3.org/1998/Math/MathML",qt="http://www.w3.org/2000/svg",Bt="http://www.w3.org/1999/xhtml";let yt=Bt,yr=!1,$n=null;const Bo=at({},[Yt,qt,Bt],$g);let ja=at({},["mi","mo","mn","ms","mtext"]),lr=at({},["annotation-xml"]);const ma=at({},["title","style","font","a","script"]);let Hn=null;const Pa=["application/xhtml+xml","text/html"],pa="text/html";let rn=null,Qr=null;const wi=n.createElement("form"),ga=function(q){return q instanceof RegExp||q instanceof Function},Si=function(){let q=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Qr&&Qr===q)return;(!q||typeof q!="object")&&(q={}),q=Er(q),Hn=Pa.indexOf(q.PARSER_MEDIA_TYPE)===-1?pa:q.PARSER_MEDIA_TYPE,rn=Hn==="application/xhtml+xml"?$g:Jc,U=un(q,"ALLOWED_TAGS")&&ur(q.ALLOWED_TAGS)?at({},q.ALLOWED_TAGS,rn):P,_=un(q,"ALLOWED_ATTR")&&ur(q.ALLOWED_ATTR)?at({},q.ALLOWED_ATTR,rn):V,$n=un(q,"ALLOWED_NAMESPACES")&&ur(q.ALLOWED_NAMESPACES)?at({},q.ALLOWED_NAMESPACES,$g):Bo,Rn=un(q,"ADD_URI_SAFE_ATTR")&&ur(q.ADD_URI_SAFE_ATTR)?at(Er(gr),q.ADD_URI_SAFE_ATTR,rn):gr,Xe=un(q,"ADD_DATA_URI_TAGS")&&ur(q.ADD_DATA_URI_TAGS)?at(Er(wt),q.ADD_DATA_URI_TAGS,rn):wt,be=un(q,"FORBID_CONTENTS")&&ur(q.FORBID_CONTENTS)?at({},q.FORBID_CONTENTS,rn):Ne,ae=un(q,"FORBID_TAGS")&&ur(q.FORBID_TAGS)?at({},q.FORBID_TAGS,rn):Er({}),Se=un(q,"FORBID_ATTR")&&ur(q.FORBID_ATTR)?at({},q.FORBID_ATTR,rn):Er({}),ue=un(q,"USE_PROFILES")?q.USE_PROFILES&&typeof q.USE_PROFILES=="object"?Er(q.USE_PROFILES):q.USE_PROFILES:!1,Ee=q.ALLOW_ARIA_ATTR!==!1,Ge=q.ALLOW_DATA_ATTR!==!1,Fe=q.ALLOW_UNKNOWN_PROTOCOLS||!1,Ve=q.ALLOW_SELF_CLOSE_IN_ATTR!==!1,st=q.SAFE_FOR_TEMPLATES||!1,Nt=q.SAFE_FOR_XML!==!1,we=q.WHOLE_DOCUMENT||!1,Ct=q.RETURN_DOM||!1,le=q.RETURN_DOM_FRAGMENT||!1,me=q.RETURN_TRUSTED_TYPE||!1,et=q.FORCE_BODY||!1,Pe=q.SANITIZE_DOM!==!1,qe=q.SANITIZE_NAMED_PROPS||!1,nt=q.KEEP_CONTENT!==!1,An=q.IN_PLACE||!1,M=rY(q.ALLOWED_URI_REGEXP)?q.ALLOWED_URI_REGEXP:VT,yt=typeof q.NAMESPACE=="string"?q.NAMESPACE:Bt,ja=un(q,"MATHML_TEXT_INTEGRATION_POINTS")&&q.MATHML_TEXT_INTEGRATION_POINTS&&typeof q.MATHML_TEXT_INTEGRATION_POINTS=="object"?Er(q.MATHML_TEXT_INTEGRATION_POINTS):at({},["mi","mo","mn","ms","mtext"]),lr=un(q,"HTML_INTEGRATION_POINTS")&&q.HTML_INTEGRATION_POINTS&&typeof q.HTML_INTEGRATION_POINTS=="object"?Er(q.HTML_INTEGRATION_POINTS):at({},["annotation-xml"]);const ge=un(q,"CUSTOM_ELEMENT_HANDLING")&&q.CUSTOM_ELEMENT_HANDLING&&typeof q.CUSTOM_ELEMENT_HANDLING=="object"?Er(q.CUSTOM_ELEMENT_HANDLING):Wl(null);if(H=Wl(null),un(ge,"tagNameCheck")&&ga(ge.tagNameCheck)&&(H.tagNameCheck=ge.tagNameCheck),un(ge,"attributeNameCheck")&&ga(ge.attributeNameCheck)&&(H.attributeNameCheck=ge.attributeNameCheck),un(ge,"allowCustomizedBuiltInElements")&&typeof ge.allowCustomizedBuiltInElements=="boolean"&&(H.allowCustomizedBuiltInElements=ge.allowCustomizedBuiltInElements),st&&(Ge=!1),le&&(Ct=!0),ue&&(U=at({},_j),_=Wl(null),ue.html===!0&&(at(U,Nj),at(_,Tj)),ue.svg===!0&&(at(U,Hg),at(_,Gg),at(_,Mf)),ue.svgFilters===!0&&(at(U,qg),at(_,Gg),at(_,Mf)),ue.mathMl===!0&&(at(U,Zg),at(_,Aj),at(_,Mf))),Ae.tagCheck=null,Ae.attributeCheck=null,un(q,"ADD_TAGS")&&(typeof q.ADD_TAGS=="function"?Ae.tagCheck=q.ADD_TAGS:ur(q.ADD_TAGS)&&(U===P&&(U=Er(U)),at(U,q.ADD_TAGS,rn))),un(q,"ADD_ATTR")&&(typeof q.ADD_ATTR=="function"?Ae.attributeCheck=q.ADD_ATTR:ur(q.ADD_ATTR)&&(_===V&&(_=Er(_)),at(_,q.ADD_ATTR,rn))),un(q,"ADD_URI_SAFE_ATTR")&&ur(q.ADD_URI_SAFE_ATTR)&&at(Rn,q.ADD_URI_SAFE_ATTR,rn),un(q,"FORBID_CONTENTS")&&ur(q.FORBID_CONTENTS)&&(be===Ne&&(be=Er(be)),at(be,q.FORBID_CONTENTS,rn)),un(q,"ADD_FORBID_CONTENTS")&&ur(q.ADD_FORBID_CONTENTS)&&(be===Ne&&(be=Er(be)),at(be,q.ADD_FORBID_CONTENTS,rn)),nt&&(U["#text"]=!0),we&&at(U,["html","head","body"]),U.table&&(at(U,["tbody"]),delete ae.tbody),q.TRUSTED_TYPES_POLICY){if(typeof q.TRUSTED_TYPES_POLICY.createHTML!="function")throw Of('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof q.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Of('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');D=q.TRUSTED_TYPES_POLICY,z=D.createHTML("")}else D===void 0&&(D=pY(x,s)),D!==null&&typeof z=="string"&&(z=D.createHTML(""));pr&&pr(q),Qr=q},ki=at({},[...Hg,...qg,...aY]),ji=at({},[...Zg,...iY]),js=function(q){let ge=A(q);(!ge||!ge.tagName)&&(ge={namespaceURI:yt,tagName:"template"});const _e=Jc(q.tagName),_t=Jc(ge.tagName);return $n[q.namespaceURI]?q.namespaceURI===qt?ge.namespaceURI===Bt?_e==="svg":ge.namespaceURI===Yt?_e==="svg"&&(_t==="annotation-xml"||ja[_t]):!!ki[_e]:q.namespaceURI===Yt?ge.namespaceURI===Bt?_e==="math":ge.namespaceURI===qt?_e==="math"&&lr[_t]:!!ji[_e]:q.namespaceURI===Bt?ge.namespaceURI===qt&&!lr[_t]||ge.namespaceURI===Yt&&!ja[_t]?!1:!ji[_e]&&(ma[_e]||!ki[_e]):!!(Hn==="application/xhtml+xml"&&$n[q.namespaceURI]):!1},Ln=function(q){Gc(t.removed,{element:q});try{A(q).removeChild(q)}catch{j(q)}},vr=function(q,ge){try{Gc(t.removed,{attribute:ge.getAttributeNode(q),from:ge})}catch{Gc(t.removed,{attribute:null,from:ge})}if(ge.removeAttribute(q),q==="is")if(Ct||le)try{Ln(ge)}catch{}else try{ge.setAttribute(q,"")}catch{}},Ci=function(q){let ge=null,_e=null;if(et)q="<remove></remove>"+q;else{const an=kj(q,/^[\r\n\t ]+/);_e=an&&an[0]}Hn==="application/xhtml+xml"&&yt===Bt&&(q='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+q+"</body></html>");const _t=D?D.createHTML(q):q;if(yt===Bt)try{ge=new w().parseFromString(_t,Hn)}catch{}if(!ge||!ge.documentElement){ge=R.createDocument(yt,"template",null);try{ge.documentElement.innerHTML=yr?z:_t}catch{}}const St=ge.body||ge.documentElement;return q&&_e&&St.insertBefore(n.createTextNode(_e),St.childNodes[0]||null),yt===Bt?ee.call(ge,we?"html":"body")[0]:we?ge.documentElement:St},Ei=function(q){return F.call(q.ownerDocument||q,q,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},ye=function(q){return q instanceof g&&(typeof q.nodeName!="string"||typeof q.textContent!="string"||typeof q.removeChild!="function"||!(q.attributes instanceof p)||typeof q.removeAttribute!="function"||typeof q.setAttribute!="function"||typeof q.namespaceURI!="string"||typeof q.insertBefore!="function"||typeof q.hasChildNodes!="function")},Qe=function(q){return typeof f=="function"&&q instanceof f};function vt($e,q,ge){Zc($e,_e=>{_e.call(t,q,ge,Qr)})}const qn=function(q){let ge=null;if(vt(I.beforeSanitizeElements,q,null),ye(q))return Ln(q),!0;const _e=rn(q.nodeName);if(vt(I.uponSanitizeElement,q,{tagName:_e,allowedTags:U}),Nt&&q.hasChildNodes()&&!Qe(q.firstElementChild)&&Yn(/<[/\w!]/g,q.innerHTML)&&Yn(/<[/\w!]/g,q.textContent)||Nt&&q.namespaceURI===Bt&&_e==="style"&&Qe(q.firstElementChild)||q.nodeType===Qc.progressingInstruction||Nt&&q.nodeType===Qc.comment&&Yn(/<[/\w]/g,q.data))return Ln(q),!0;if(ae[_e]||!(Ae.tagCheck instanceof Function&&Ae.tagCheck(_e))&&!U[_e]){if(!ae[_e]&&Yu(_e)&&(H.tagNameCheck instanceof RegExp&&Yn(H.tagNameCheck,_e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(_e)))return!1;if(nt&&!be[_e]){const _t=A(q)||q.parentNode,St=O(q)||q.childNodes;if(St&&_t){const an=St.length;for(let Zn=an-1;Zn>=0;--Zn){const xn=C(St[Zn],!0);_t.insertBefore(xn,E(q))}}}return Ln(q),!0}return q instanceof m&&!js(q)||(_e==="noscript"||_e==="noembed"||_e==="noframes")&&Yn(/<\/no(script|embed|frames)/i,q.innerHTML)?(Ln(q),!0):(st&&q.nodeType===Qc.text&&(ge=q.textContent,Zc([Q,te,Y],_t=>{ge=Ql(ge,_t," ")}),q.textContent!==ge&&(Gc(t.removed,{element:q.cloneNode()}),q.textContent=ge)),vt(I.afterSanitizeElements,q,null),!1)},Ua=function(q,ge,_e){if(Se[ge]||Pe&&(ge==="id"||ge==="name")&&(_e in n||_e in wi))return!1;const _t=_[ge]||Ae.attributeCheck instanceof Function&&Ae.attributeCheck(ge,q);if(!(Ge&&!Se[ge]&&Yn(X,ge))){if(!(Ee&&Yn(G,ge))){if(!_t||Se[ge]){if(!(Yu(q)&&(H.tagNameCheck instanceof RegExp&&Yn(H.tagNameCheck,q)||H.tagNameCheck instanceof Function&&H.tagNameCheck(q))&&(H.attributeNameCheck instanceof RegExp&&Yn(H.attributeNameCheck,ge)||H.attributeNameCheck instanceof Function&&H.attributeNameCheck(ge,q))||ge==="is"&&H.allowCustomizedBuiltInElements&&(H.tagNameCheck instanceof RegExp&&Yn(H.tagNameCheck,_e)||H.tagNameCheck instanceof Function&&H.tagNameCheck(_e))))return!1}else if(!Rn[ge]){if(!Yn(M,Ql(_e,J,""))){if(!((ge==="src"||ge==="xlink:href"||ge==="href")&&q!=="script"&&jj(_e,"data:")===0&&Xe[q])){if(!(Fe&&!Yn(se,Ql(_e,J,"")))){if(_e)return!1}}}}}}return!0},Fo=at({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Yu=function(q){return!Fo[Jc(q)]&&Yn(ve,q)},$o=function(q){vt(I.beforeSanitizeAttributes,q,null);const{attributes:ge}=q;if(!ge||ye(q))return;const _e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_,forceKeepAttr:void 0};let _t=ge.length;for(;_t--;){const St=ge[_t],{name:an,namespaceURI:Zn,value:xn}=St,Pn=rn(an),Ho=xn;let pn=an==="value"?Ho:XK(Ho);if(_e.attrName=Pn,_e.attrValue=pn,_e.keepAttr=!0,_e.forceKeepAttr=void 0,vt(I.uponSanitizeAttribute,q,_e),pn=_e.attrValue,qe&&(Pn==="id"||Pn==="name")&&jj(pn,Gt)!==0&&(vr(an,q),pn=Gt+pn),Nt&&Yn(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,pn)){vr(an,q);continue}if(Pn==="attributename"&&kj(pn,"href")){vr(an,q);continue}if(_e.forceKeepAttr)continue;if(!_e.keepAttr){vr(an,q);continue}if(!Ve&&Yn(/\/>/i,pn)){vr(an,q);continue}st&&Zc([Q,te,Y],Xu=>{pn=Ql(pn,Xu," ")});const qo=rn(q.nodeName);if(!Ua(qo,Pn,pn)){vr(an,q);continue}if(D&&typeof x=="object"&&typeof x.getAttributeType=="function"&&!Zn)switch(x.getAttributeType(qo,Pn)){case"TrustedHTML":{pn=D.createHTML(pn);break}case"TrustedScriptURL":{pn=D.createScriptURL(pn);break}}if(pn!==Ho)try{Zn?q.setAttributeNS(Zn,an,pn):q.setAttribute(an,pn),ye(q)?Ln(q):Sj(t.removed)}catch{vr(an,q)}}vt(I.afterSanitizeAttributes,q,null)},Ni=function(q){let ge=null;const _e=Ei(q);for(vt(I.beforeSanitizeShadowDOM,q,null);ge=_e.nextNode();)vt(I.uponSanitizeShadowNode,ge,null),qn(ge),$o(ge),ge.content instanceof o&&Ni(ge.content);vt(I.afterSanitizeShadowDOM,q,null)};return t.sanitize=function($e){let q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ge=null,_e=null,_t=null,St=null;if(yr=!$e,yr&&($e="<!-->"),typeof $e!="string"&&!Qe($e)&&($e=nY($e),typeof $e!="string"))throw Of("dirty is not a string, aborting");if(!t.isSupported)return $e;if(ze||Si(q),t.removed=[],typeof $e=="string"&&(An=!1),An){const xn=$e.nodeName;if(typeof xn=="string"){const Pn=rn(xn);if(!U[Pn]||ae[Pn])throw Of("root node is forbidden and cannot be sanitized in-place")}}else if($e instanceof f)ge=Ci("<!---->"),_e=ge.ownerDocument.importNode($e,!0),_e.nodeType===Qc.element&&_e.nodeName==="BODY"||_e.nodeName==="HTML"?ge=_e:ge.appendChild(_e);else{if(!Ct&&!st&&!we&&$e.indexOf("<")===-1)return D&&me?D.createHTML($e):$e;if(ge=Ci($e),!ge)return Ct?null:me?z:""}ge&&et&&Ln(ge.firstChild);const an=Ei(An?$e:ge);for(;_t=an.nextNode();)qn(_t),$o(_t),_t.content instanceof o&&Ni(_t.content);if(An)return $e;if(Ct){if(st){ge.normalize();let xn=ge.innerHTML;Zc([Q,te,Y],Pn=>{xn=Ql(xn,Pn," ")}),ge.innerHTML=xn}if(le)for(St=B.call(ge.ownerDocument);ge.firstChild;)St.appendChild(ge.firstChild);else St=ge;return(_.shadowroot||_.shadowrootmode)&&(St=L.call(a,St,!0)),St}let Zn=we?ge.outerHTML:ge.innerHTML;return we&&U["!doctype"]&&ge.ownerDocument&&ge.ownerDocument.doctype&&ge.ownerDocument.doctype.name&&Yn(QT,ge.ownerDocument.doctype.name)&&(Zn="<!DOCTYPE "+ge.ownerDocument.doctype.name+`>
|
|
412
|
-
`+Zn),st&&Zc([Q,te,Y],xn=>{Zn=Ql(Zn,xn," ")}),D&&me?D.createHTML(Zn):Zn},t.setConfig=function(){let $e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Si($e),ze=!0},t.clearConfig=function(){Qr=null,ze=!1},t.isValidAttribute=function($e,q,ge){Qr||Si({});const _e=rn($e),_t=rn(q);return Ua(_e,_t,ge)},t.addHook=function($e,q){typeof q=="function"&&Gc(I[$e],q)},t.removeHook=function($e,q){if(q!==void 0){const ge=KK(I[$e],q);return ge===-1?void 0:YK(I[$e],ge,1)[0]}return Sj(I[$e])},t.removeHooks=function($e){I[$e]=[]},t.removeAllHooks=function(){I=Oj()},t}var YT=KT();let Mj=!1;function gY(){Mj||(Mj=!0,YT.addHook("afterSanitizeAttributes",e=>{e.tagName==="A"&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"))}))}function yY({option:e,previewFormat:t,selected:n,disabled:a,showCheckmark:s,onToggle:o}){const u=b.useMemo(()=>!e.preview||t!=="html"?null:(gY(),YT.sanitize(e.preview,{USE_PROFILES:{html:!0}})),[e.preview,t]);return l.jsxs("button",{type:"button",disabled:a,onClick:a?void 0:o,className:Oe("w-full text-left rounded-[var(--radius-input)] border transition-colors","flex flex-col",a?"cursor-default opacity-70":"cursor-pointer hover:bg-[color:var(--bg-hover)]"),style:{padding:"var(--sp-2_5) var(--sp-3)",gap:"var(--sp-1_5)",borderColor:n?"var(--accent)":"var(--border)",background:n?"var(--bg-active)":"var(--bg-raised)"},children:[e.preview?t==="html"&&u?l.jsx("div",{dangerouslySetInnerHTML:{__html:u},className:"max-h-[20rem] overflow-auto rounded-[var(--radius-input)] border",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)"}}):t==="markdown"?l.jsx("div",{className:"max-h-[20rem] overflow-auto rounded-[var(--radius-input)] border",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)"},children:l.jsx(Ih,{children:e.preview})}):null:null,l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:n?"var(--accent)":"var(--fg)"},children:e.label}),s&&n?l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Selected",children:"✓"}):null]}),e.description?l.jsx("span",{className:"text-caption",style:{color:"var(--fg-3)"},children:e.description}):null]})}const ro="__free_text__";function Kc(){return{picked:[],freeText:""}}function Dj(e,t){if(t.picked.includes(ro)){const n=t.freeText.trim();return n.length===0?null:n}return t.picked.length===0?null:e.multiSelect?t.picked.join(", "):t.picked[0]??null}function vY({chatId:e,questionMessageId:t,content:n,answer:a,status:s}){const o=s==="pending",u=s==="answered",f=s==="superseded",[m,h]=b.useState(()=>{const j={};for(const E of n.questions)j[E.question]=Kc();return j});b.useEffect(()=>{if(!a)return;const j={};for(const E of n.questions){const O=a.answers[E.question];if(!O){j[E.question]=Kc();continue}const A=new Set(E.options.map(R=>R.label)),D=E.multiSelect?O.split(/,\s*/u):[O],z=D.filter(R=>A.has(R));z.length===D.length&&z.length>0?j[E.question]={picked:z,freeText:""}:j[E.question]={picked:[ro],freeText:O}}h(j)},[a,n.questions]);const p=vn(),[g,w]=b.useState(null),x=pt({mutationFn:async j=>ZK(e,n.correlationId,j),onSuccess:()=>{w(null),p.invalidateQueries({queryKey:["chat-messages",e]})},onError:j=>{w(j instanceof Error?j.message:String(j))}}),k=b.useCallback(()=>{w(null);const j={};for(const E of n.questions){const O=m[E.question]??Kc(),A=Dj(E,O);if(A===null){w(`Please answer "${E.question}" before submitting.`);return}j[E.question]=A}x.mutate(j)},[n.questions,m,x]),C=b.useMemo(()=>n.questions.every(j=>{const E=m[j.question]??Kc();return Dj(j,E)!==null}),[n.questions,m]);return l.jsxs("div",{className:Oe("rounded-[var(--radius-panel)] border flex flex-col",o?"":"opacity-80"),style:{padding:"var(--sp-3)",gap:"var(--sp-3)",borderColor:o?"var(--accent)":"var(--border)",background:"var(--bg-raised)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:o?"var(--accent)":"var(--fg-3)"},children:"AGENT QUESTION"}),u?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"• Answered"}):null,f?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"• Superseded"}):null]}),l.jsx("div",{className:"flex flex-col",style:{gap:"var(--sp-4)"},children:n.questions.map(j=>l.jsx(bY,{question:j,previewFormat:n.previewFormat,selection:m[j.question]??Kc(),allowFreeText:n.allowFreeText,disabled:!o,showAnsweredCheck:u||f,onChange:E=>h(O=>({...O,[j.question]:E}))},j.question))}),o?l.jsxs("div",{className:"flex items-center justify-end",style:{gap:"var(--sp-2)"},children:[g?l.jsx("span",{className:"text-caption",style:{color:"var(--state-danger)"},children:g}):null,l.jsx(xe,{type:"button",disabled:!C||x.isPending,onClick:k,children:x.isPending?"Submitting…":"Submit answer"})]}):null]})}function bY({question:e,previewFormat:t,selection:n,allowFreeText:a,disabled:s,showAnsweredCheck:o,onChange:u}){const f=b.useRef(null),m=n.picked.includes(ro);b.useEffect(()=>{var p;m&&!s&&((p=f.current)==null||p.focus())},[m,s]);const h=b.useCallback(p=>{const g=n.picked.includes(p);let w;e.multiSelect?w=g?n.picked.filter(x=>x!==p):[...n.picked,p]:w=g?[]:[p],u({...n,picked:w})},[e.multiSelect,n,u]);return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)"},children:[l.jsx("span",{className:"mono text-eyebrow font-semibold",style:{color:"var(--fg-2)"},children:e.header}),e.multiSelect?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"(pick any)"}):null]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg)"},children:e.question}),l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1_5)"},children:[e.options.map(p=>l.jsx(yY,{option:p,previewFormat:t,selected:n.picked.includes(p.label),disabled:s,showCheckmark:o,onToggle:()=>h(p.label)},p.label)),a?l.jsxs("button",{type:"button",disabled:s,onClick:s?void 0:()=>u({picked:e.multiSelect?m?n.picked.filter(p=>p!==ro):[...n.picked,ro]:m?[]:[ro],freeText:n.freeText}),className:Oe("w-full text-left rounded-[var(--radius-input)] border transition-colors","flex flex-col",s?"cursor-default opacity-70":"cursor-pointer hover:bg-[color:var(--bg-hover)]"),style:{padding:"var(--sp-2_5) var(--sp-3)",gap:"var(--sp-1_5)",borderColor:m?"var(--accent)":"var(--border)",background:m?"var(--bg-active)":"var(--bg-raised)"},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:m?"var(--accent)":"var(--fg-3)"},children:"Other…"}),l.jsx("span",{className:"text-caption",style:{color:"var(--fg-4)"},children:"Type a free-text answer."}),m?l.jsx("textarea",{ref:f,value:n.freeText,disabled:s,onChange:p=>u({...n,freeText:p.target.value}),onClick:p=>p.stopPropagation(),onKeyDown:p=>{p.key==="Enter"&&!p.metaKey&&!p.ctrlKey&&p.stopPropagation()},rows:2,className:"rounded-[var(--radius-input)] border text-body",style:{padding:"var(--sp-2)",borderColor:"var(--border)",background:"var(--bg-sunken)",color:"var(--fg)",resize:"vertical"}}):null]}):null]})]})}function xY(e){return r9.safeParse(e).success}function XT(e){return a9.safeParse(e).success}function wY(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}function SY(e){if(e<60)return`${e}s`;const t=Math.floor(e/60),n=e%60;return`${t}m${n.toString().padStart(2,"0")}s`}function zj(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"…"}}function kY({event:e}){const t=ez(e.payload);if(!t)return null;const n=t.status==="error",a=t.status==="pending",s=n?"var(--state-error)":a?"var(--state-blocked)":"var(--fg-3)",o=n?"failed":a?"using":"used";return l.jsxs("div",{className:"mono flex items-center text-label",style:{gap:8,padding:"var(--sp-0_5) var(--sp-2)",color:"var(--fg-3)"},children:[a?l.jsx("span",{"aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:s,animation:"heartbeat-pulse 1.2s ease-in-out infinite",flexShrink:0,marginTop:5}}):l.jsx("span",{"aria-hidden":!0,style:{color:s,flexShrink:0},children:n?"⚠":"↳"}),l.jsxs("span",{className:"flex items-baseline",style:{color:"var(--fg-3)",minWidth:0,flex:1},title:t.args!==void 0&&t.args!==null?zj(t.args):void 0,children:[l.jsxs("span",{style:{whiteSpace:"nowrap",flexShrink:0},children:[o," ",l.jsx("span",{style:{color:"var(--fg-2)"},children:t.name})]}),t.args!==void 0&&t.args!==null?l.jsxs("span",{className:"truncate",style:{color:"var(--fg-4)",minWidth:0,flex:1},children:["(",zj(t.args),")"]}):null,t.durationMs!==void 0&&!a?l.jsxs("span",{className:"text-caption",style:{color:"var(--fg-4)",marginLeft:6,whiteSpace:"nowrap",flexShrink:0},children:["· ",wY(t.durationMs)]}):null]})]})}function jY(e){const t=new Date(e),n=new Intl.DateTimeFormat("en-GB",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),a=s=>{var o;return((o=n.find(u=>u.type===s))==null?void 0:o.value)??""};return`${a("month")}/${a("day")} ${a("hour")}:${a("minute")}`}function CY({event:e}){return l.jsxs("div",{className:"mono flex items-center text-label",style:{gap:8,padding:"var(--sp-0_5) var(--sp-2)",color:"var(--fg-3)"},children:[l.jsx("span",{"aria-hidden":!0,style:{width:6,height:6,borderRadius:"50%",background:"var(--accent)",animation:"heartbeat-pulse 1.2s ease-in-out infinite",flexShrink:0}}),l.jsx("span",{style:{color:"var(--fg-3)"},children:"thinking…"}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:jY(e.createdAt)})]})}function Ij(e){return e.kind==="tool_call"?l.jsx(kY,{event:e}):e.kind==="thinking"?l.jsx(CY,{event:e}):null}function EY(e){let t=0,n=0;for(const o of e)o.kind==="tool_call"&&(t+=1),o.kind==="thinking"&&(n+=1);const a=e[0],s=a?Math.max(0,Math.round((Date.now()-new Date(a.createdAt).getTime())/1e3)):0;return{toolCalls:t,thinkings:n,elapsedSec:s}}function NY({events:e,defaultOpen:t}){const[n,a]=b.useState(t),s=e[e.length-1];if(!s)return null;const{toolCalls:o,thinkings:u,elapsedSec:f}=EY(e);return l.jsxs("div",{children:[l.jsxs("button",{type:"button",onClick:()=>a(m=>!m),className:"w-full text-left",style:{display:"flex",alignItems:"center",gap:4,background:"transparent",border:0,padding:0,cursor:"pointer",minWidth:0},"aria-expanded":n,"aria-label":n?"Collapse working details":"Expand working details",children:[l.jsx("span",{style:{flex:1,minWidth:0},children:Ij(s)}),l.jsx("span",{"aria-hidden":!0,className:"text-caption",style:{color:"var(--fg-4)",transform:n?"rotate(180deg)":"none",transition:"transform 150ms ease",marginRight:"var(--sp-1_5)",flexShrink:0,lineHeight:1},children:"▾"})]}),n?l.jsxs("div",{children:[e.map(m=>l.jsx("div",{children:Ij(m)},m.id)),l.jsxs("div",{className:"mono text-caption",style:{color:"var(--fg-4)",padding:"var(--sp-0_5) var(--sp-2) 0 var(--sp-4)"},children:[o," ",o===1?"tool":"tools"," · ",u," thinking · ",SY(f)]})]}):null]})}function _Y(e){let t=-1;for(const s of e)s.kind==="turn_end"&&s.seq>t&&(t=s.seq);const n=e.filter(s=>s.kind==="turn_end"||s.kind==="context_tree_usage"?!1:s.kind==="error"?!0:s.seq>t),a=new Map;for(const s of n){if(s.kind!=="tool_call")continue;const o=Lj(s.payload);if(!o)continue;const u=a.get(o)??-1;s.seq>u&&a.set(o,s.seq)}return n.filter(s=>{if(s.kind!=="tool_call")return!0;const o=Lj(s.payload);return o?a.get(o)===s.seq:!0})}function Lj(e){if(typeof e!="object"||e===null)return;const t=e.toolUseId;return typeof t=="string"?t:void 0}function Ku(e){const t=new Date(e),n=new Intl.DateTimeFormat("en-GB",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(t),a=s=>{var o;return((o=n.find(u=>u.type===s))==null?void 0:o.value)??""};return`${a("month")}/${a("day")} ${a("hour")}:${a("minute")}`}function TY({msg:e,myAgentId:t}){if(!t||e.senderId!==t)return null;const n=e.deliveryStatus??"sent";return n==="acked"?l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},title:"Agent has started processing",children:"✓✓ read"}):n==="delivered"?l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},title:"Delivered to agent inbox",children:"✓✓"}):l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},title:"Sent",children:"✓ sent"})}function AY({event:e,agentNameFn:t,agentAvatarFn:n,agentId:a}){const s=nz(e.payload);if(!s||s.text.length===0)return null;const o=t(a);return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1) 0",opacity:.85},children:[l.jsx(Ph,{name:o,isSelf:!1,imageUrl:n(a)}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-label font-semibold",style:{color:"var(--accent)"},children:o}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Ku(e.createdAt)}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:"· streaming"})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",whiteSpace:"pre-wrap",marginTop:2},children:s.text})]})]})}function RY({event:e}){const t=tz(e.payload),n=Ku(e.createdAt);return l.jsxs("div",{style:{padding:"var(--sp-1_5) var(--sp-2_5)",borderLeft:"var(--hairline-bold) solid var(--state-error)",background:"color-mix(in oklch, var(--state-error) 6%, transparent)",borderRadius:"0 var(--radius-input) var(--radius-input) 0"},children:[l.jsxs("div",{className:"mono uppercase text-caption",style:{color:"var(--state-error)"},children:["error · ",(t==null?void 0:t.source)??"unknown"," · ",n]}),l.jsx("div",{className:"text-label",style:{marginTop:2,color:"var(--fg-2)",whiteSpace:"pre-wrap"},children:(t==null?void 0:t.message)??"(invalid error payload)"})]})}function Ph({name:e,isSelf:t,imageUrl:n}){if(n)return l.jsx(Yf,{src:n,name:e,size:20});const a=e.slice(0,2).toUpperCase();return l.jsx("div",{className:"mono text-eyebrow font-bold",style:{width:20,height:20,borderRadius:"var(--radius-input)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:t?"linear-gradient(135deg, var(--accent), oklch(0.58 0.14 170))":"var(--bg-active)",border:t?"none":"var(--hairline) solid var(--border-strong)",color:t?"oklch(0.14 0.01 150)":"var(--fg-2)"},children:t?a:l.jsx(Fu,{width:9,height:10,style:{color:"var(--accent)"}})})}function OY({msg:e,myAgentId:t,agentNameFn:n,agentAvatarFn:a}){const[s,o]=Oo(),u=n(e.senderId),f=t===e.senderId,m=MY(e.metadata),h=b.useMemo(()=>({a({href:p,children:g,...w}){const x=k=>{if(!p||k.defaultPrevented||k.button!==0||k.metaKey||k.altKey||k.ctrlKey||k.shiftKey)return;const C=UT(p);if(!C)return;k.preventDefault();const j=new URLSearchParams(s);j.set("docChat",e.chatId),j.set("docAgent",e.senderId),j.set("docPath",C),m?j.set("docBase",m):j.delete("docBase"),o(j)};return l.jsx("a",{...w,href:p,onClick:x,target:"_blank",rel:"noopener noreferrer",children:g})}}),[m,e.chatId,e.senderId,s,o]);return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Ph,{name:u,isSelf:f,imageUrl:a(e.senderId)}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:f?"var(--fg)":"var(--accent)"},children:u}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Ku(e.createdAt)}),l.jsx("span",{style:{marginLeft:"auto"},children:l.jsx(TY,{msg:e,myAgentId:t})})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg)",marginTop:2},children:e.format==="file"&&DY(e.content)?l.jsx("img",{src:`data:${e.content.mimeType};base64,${e.content.data}`,alt:e.content.filename??"image",style:{maxWidth:320,borderRadius:"var(--radius-panel)",marginTop:4}}):e.format==="file"&&zY(e.content)?l.jsx(IY,{content:e.content}):e.format==="text"||e.format==="markdown"?l.jsx(Ih,{components:h,children:typeof e.content=="string"?e.content:JSON.stringify(e.content)}):l.jsx("pre",{className:"mono text-label",style:{background:"var(--bg-sunken)",padding:8,borderRadius:"var(--radius-input)",overflow:"auto",maxHeight:160},children:JSON.stringify(e.content,null,2)})})]})]})}function MY(e){const t=EF.safeParse(e==null?void 0:e.documentContext);return t.success?t.data.basePath:void 0}function DY(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.data=="string"&&typeof t.mimeType=="string"&&t.mimeType.startsWith("image/")}function zY(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.imageId=="string"&&typeof t.mimeType=="string"&&t.mimeType.startsWith("image/")&&typeof t.filename=="string"}function IY({content:e}){const[t,n]=b.useState({kind:"loading"});return b.useEffect(()=>{let a=!1;return qK(e.imageId).then(s=>{a||n(s?{kind:"hit",src:`data:${s.mimeType};base64,${s.base64}`}:{kind:"miss"})}),()=>{a=!0}},[e.imageId]),t.kind==="hit"?l.jsx("img",{src:t.src,alt:e.filename,style:{maxWidth:320,borderRadius:"var(--radius-panel)",marginTop:4}}):t.kind==="miss"?l.jsxs("span",{className:"text-label",style:{color:"var(--fg-3)",fontStyle:"italic"},children:['[Image "',e.filename,'" not available on this device]']}):l.jsx("span",{className:"text-label",style:{color:"var(--fg-4)"},children:"…"})}function LY({msg:e,chatId:t,content:n,answer:a,status:s,agentNameFn:o,agentAvatarFn:u}){const f=o(e.senderId);return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Ph,{name:f,isSelf:!1,imageUrl:u(e.senderId)}),l.jsxs("div",{className:"min-w-0 flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--accent)"},children:f}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Ku(e.createdAt)})]}),l.jsx(vY,{chatId:t,questionMessageId:e.id,content:n,answer:a,status:s})]})]})}function PY({msg:e,agentNameFn:t,agentAvatarFn:n}){const a=XT(e.content)?e.content:null,s=t(e.senderId),o=a?Object.entries(a.answers).map(([u,f])=>`${u.replace(/\s+\?$/u,"?")}: ${f}`).join(" · "):"(answer)";return l.jsxs("div",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:8,padding:"var(--sp-1_5) 0"},children:[l.jsx(Ph,{name:s,isSelf:!0,imageUrl:n(e.senderId)}),l.jsxs("div",{className:"min-w-0",children:[l.jsxs("div",{className:"flex items-baseline",style:{gap:8},children:[l.jsx("span",{className:"mono text-body font-semibold",style:{color:"var(--fg)"},children:s}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-4)"},children:Ku(e.createdAt)}),l.jsx("span",{className:"mono text-caption",style:{color:"var(--fg-3)"},children:"answered question"})]}),l.jsx("div",{className:"text-body",style:{color:"var(--fg-2)",marginTop:2},children:o})]})]})}function UY({metadata:e}){if(!e||e.source!=="github")return null;const t=typeof e.entityUrl=="string"?e.entityUrl:null;return t?l.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",title:"View on GitHub",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:"0 var(--sp-1)",textDecoration:"none"},children:l.jsx(Av,{className:"h-3.5 w-3.5"})}):null}function Pj({agentId:e,chatId:t,readOnly:n=!1,titleFallback:a,joinAction:s}){var Ct;const o=vn(),u=bh(),f=Hv(),m=b.useCallback(le=>{var me;return((me=f(le))==null?void 0:me.avatarImageUrl)??null},[f]),{agentId:h}=ut(),[p,g]=b.useState(""),[w,x]=b.useState(0),[k,C]=b.useState([]),[j,E]=b.useState(!1),[O,A]=b.useState(null),D=b.useRef(null),z=b.useRef(null),R=b.useRef(null);qT(z,p);const F=b.useRef(!1),B=b.useRef(new Set);b.useEffect(()=>{F.current=!1},[t]);const{data:ee}=We({queryKey:["chat-messages",t],queryFn:()=>CK(t,{limit:50}),refetchInterval:5e3}),{data:L}=We({queryKey:["session-events",e,t],queryFn:()=>rz(e,t,{limit:200,direction:"desc"}),refetchInterval:5e3}),{data:I}=We({queryKey:["chat-detail",t],queryFn:()=>BT(t),enabled:!!t}),{data:Q}=We({queryKey:["activity"],queryFn:Pu,refetchInterval:15e3}),te=pt({mutationFn:le=>No(t,le),onSuccess:()=>{g(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:m1(e)})},onError:le=>{A(le instanceof Error?le.message:"Failed to send message")}}),Y=b.useCallback(le=>{const Pe=le.filter(nt=>nt.type.startsWith("image/"));if(Pe.length===0)return;const qe=Pe.find(nt=>nt.size>5242880);if(qe){A(`Image too large (${(qe.size/1024/1024).toFixed(1)}MB). Maximum ${5242880/1024/1024}MB per image.`);return}const Gt=Pe.map(nt=>({id:crypto.randomUUID(),file:nt,previewUrl:URL.createObjectURL(nt)}));C(nt=>[...nt,...Gt]),A(null)},[]),X=b.useCallback(le=>{C(me=>{const Pe=me.find(qe=>qe.id===le);return Pe&&URL.revokeObjectURL(Pe.previewUrl),me.filter(qe=>qe.id!==le)}),A(null)},[]),G=async()=>{const le=p.trim(),me=k;if(!(!le&&me.length===0)&&!j){if(le){const Pe=new Set(((I==null?void 0:I.participants)??[]).map(Gt=>{var nt,An;return(An=(nt=Ge(Gt.agentId))==null?void 0:nt.name)==null?void 0:An.toLowerCase()}).filter(Gt=>!!Gt)),qe=sB(le).filter(Gt=>!Pe.has(Gt));if(qe.length>0){const Gt=qe[0];A(`Cannot @-mention "${Gt}" — they're not in this chat. Use the [+] button above to add them first.`);return}}if(we&&ze.length===0){me.length>0&&A("@mention a group member in the text — images will be addressed to the same recipient(s).");return}if(me.length>0){E(!0),A(null);try{const Pe=ze.length>0?{mentions:ze}:void 0;for(const qe of me){const Gt=await jK(qe.file),nt=crypto.randomUUID();await HK({imageId:nt,base64:Gt,mimeType:qe.file.type}),await kK(t,{data:Gt,mimeType:qe.file.type,filename:qe.file.name,size:qe.file.size,imageId:nt},Pe),URL.revokeObjectURL(qe.previewUrl)}C([]),le&&await No(t,le),g(""),o.invalidateQueries({queryKey:["chat-messages",t]}),o.invalidateQueries({queryKey:m1(e)})}catch(Pe){A(Pe instanceof Error?Pe.message:"Failed to send image")}finally{E(!1)}return}te.mutate(le)}},[se,J]=b.useState(!1),[ve,M]=b.useState(""),U=b.useRef(null);b.useEffect(()=>{var le;se&&((le=U.current)==null||le.focus())},[se]);const P=pt({mutationFn:le=>SK(t,le),onSuccess:()=>{J(!1),o.invalidateQueries({queryKey:["chat-detail",t]}),o.invalidateQueries({queryKey:["agent-sessions",e]}),o.invalidateQueries({queryKey:["session",e,t]})}}),_=()=>{const le=ve.trim();P.mutate(le.length>0?le:null)},V=pt({mutationFn:()=>FT(t,By.ACTIVE),onSuccess:()=>{o.invalidateQueries({queryKey:["me","chats"]}),o.invalidateQueries({queryKey:["chat-detail",t]})}}),H=b.useMemo(()=>{const le=(ee==null?void 0:ee.items)??[],me=(L==null?void 0:L.items)??[],Pe=_Y(me);let qe=-1;for(const Ne of me)Ne.kind==="turn_end"&&Ne.seq>qe&&(qe=Ne.seq);const Gt=[...le.map(Ne=>({kind:"message",at:Ne.createdAt,key:`m-${Ne.id}`,data:Ne})),...Pe.map(Ne=>({kind:"event",at:Ne.createdAt,key:`e-${Ne.id}`,data:Ne}))];Gt.sort((Ne,Xe)=>Ne.at.localeCompare(Xe.at));const nt=[];let An=[],ue=0;const be=()=>{const Ne=An[0];Ne&&(nt.push({kind:"workgroup",at:Ne.createdAt,key:`wg-${qe}-${ue}`,events:An}),ue+=1,An=[])};for(const Ne of Gt){if(Ne.kind==="event"&&(Ne.data.kind==="tool_call"||Ne.data.kind==="thinking")){An.push(Ne.data);continue}be(),nt.push(Ne)}return be(),nt},[ee,L]),ae=b.useMemo(()=>{const le=new Map;for(const me of(ee==null?void 0:ee.items)??[])me.format==="question_answer"&&XT(me.content)&&le.set(me.content.correlationId,me.content);return le},[ee]),Se=H.length;b.useEffect(()=>{var le;Se>0&&((le=R.current)==null||le.scrollIntoView({behavior:"smooth"}))},[Se]);const Ae=b.useMemo(()=>{const le=new Map;for(const me of(I==null?void 0:I.participants)??[])le.set(me.agentId,{name:me.name,displayName:me.displayName});return le},[I==null?void 0:I.participants]),Ee=b.useCallback(le=>{if(!le)return"—";const me=Ae.get(le);return me?me.displayName:u(le)},[Ae,u]),Ge=b.useCallback(le=>{var Pe;if(!le)return null;const me=Ae.get(le);return me?{name:me.name,displayName:me.displayName,avatarImageUrl:((Pe=f(le))==null?void 0:Pe.avatarImageUrl)??null}:f(le)},[Ae,f]),Fe=Ee(e),Ve=b.useMemo(()=>{const le=new Map;for(const me of(Q==null?void 0:Q.agents)??[])le.set(me.agentId,me.managedByMe);return le},[Q==null?void 0:Q.agents]),st=b.useMemo(()=>{const le=[];for(const me of(I==null?void 0:I.participants)??[]){if(me.agentId===h)continue;const Pe=Ge(me.agentId);!Pe||!Pe.name||le.push({agentId:me.agentId,name:Pe.name,displayName:Pe.displayName,managedByMe:Ve.get(me.agentId)??!1})}return le},[I==null?void 0:I.participants,Ge,h,Ve]),Nt=b.useMemo(()=>{const le=new Set;for(const Pe of(I==null?void 0:I.participants)??[])le.add(Pe.agentId);for(const Pe of(Q==null?void 0:Q.agents)??[])le.add(Pe.agentId);le.size===0&&le.add(e);const me=[];for(const Pe of le){if(Pe===h)continue;const qe=Ge(Pe);!qe||!qe.name||me.push({agentId:Pe,name:qe.name,displayName:qe.displayName,managedByMe:Ve.get(Pe)??!1})}return me},[I==null?void 0:I.participants,Q==null?void 0:Q.agents,e,Ge,h,Ve]),we=b.useMemo(()=>{if(!I)return!1;if(I.type==="group")return!0;const le=I.participants.some(me=>me.agentId===h);return I.type==="direct"&&!le&&I.participants.length>=2},[I,h]);b.useEffect(()=>{if(n||B.current.has(t)||!ee||!L||!I||H.length>0||p.length>0||we||Fe===e)return;const le=`Hi ${Fe}! What can you help with?`;g(le),x(le.length),B.current.add(t),requestAnimationFrame(()=>{const me=z.current;me&&(me.focus(),me.setSelectionRange(le.length,le.length))})},[t,e,ee,L,I,H.length,p.length,Fe,we,n]);const ze=b.useMemo(()=>{const le=st.map(me=>({agentId:me.agentId,name:me.name}));return YN(p,le)},[p,st]),et=$T({value:p,cursor:w,candidates:st,disabled:te.isPending||j,onSelect:le=>{g(le.text),x(le.cursor),requestAnimationFrame(()=>{const me=z.current;me&&(me.focus(),me.setSelectionRange(le.cursor,le.cursor))})}});return l.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[l.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6)",borderBottom:"var(--hairline) solid var(--border)"},children:l.jsxs("div",{className:"flex items-center",style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%",gap:10},children:[l.jsxs("div",{className:"flex items-center min-w-0",style:{gap:8,flex:1},children:[n?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"truncate text-subtitle min-w-0",style:{color:"var(--fg)"},children:(I==null?void 0:I.title)??a??"…"}),l.jsx("span",{className:"mono uppercase text-eyebrow shrink-0",style:{padding:"var(--hairline) var(--sp-1_25)",borderRadius:2,color:"var(--fg-3)",background:"var(--bg-sunken)"},children:"watching"})]}):se?l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:U,value:ve,onChange:le=>M(le.target.value),onKeyDown:le=>{le.nativeEvent.isComposing||(le.key==="Enter"?(le.preventDefault(),_()):le.key==="Escape"&&(le.preventDefault(),J(!1)))},disabled:P.isPending,maxLength:500,placeholder:(I==null?void 0:I.title)??"Chat name",className:"outline-none text-subtitle",style:{fieldSizing:"content",minWidth:200,maxWidth:480,color:"var(--fg)",background:"var(--bg-sunken)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",padding:"var(--sp-0_5) var(--sp-1_5)"}}),l.jsx("button",{type:"button",onClick:_,disabled:P.isPending,title:"Save",className:"inline-flex items-center",style:{color:"var(--accent)",padding:2},children:l.jsx(mr,{className:"h-3.5 w-3.5"})}),l.jsx("button",{type:"button",onClick:()=>J(!1),disabled:P.isPending,title:"Cancel",className:"inline-flex items-center",style:{color:"var(--fg-3)",padding:2},children:l.jsx(pi,{className:"h-3.5 w-3.5"})})]}):l.jsx("button",{type:"button",onClick:()=>{M((I==null?void 0:I.topic)??""),J(!0)},title:"Click to rename",className:"truncate text-subtitle text-left min-w-0",style:{color:"var(--fg)",background:"transparent",border:"none",padding:0,cursor:"pointer"},children:(I==null?void 0:I.title)??"…"}),l.jsx(UY,{metadata:I==null?void 0:I.metadata})]}),l.jsx(BY,{chatId:t,participantIds:((Ct=I==null?void 0:I.participants)==null?void 0:Ct.map(le=>le.agentId))??[e],candidates:Nt,agentIdentity:Ge,onAdded:()=>o.invalidateQueries({queryKey:["chat-detail",t]}),readOnly:n})]})}),(I==null?void 0:I.engagementStatus)===By.DELETED&&l.jsxs("div",{className:"shrink-0 flex items-center",style:{gap:"var(--sp-2)",padding:"var(--sp-1_5) var(--sp-6)",background:"var(--bg-sunken)",borderBottom:"var(--hairline) solid var(--border-faint)",color:"var(--fg-2)"},children:[l.jsx("span",{className:"text-body",style:{flex:1},children:"This chat is deleted and won't appear in your conversation list."}),l.jsx("button",{type:"button",disabled:V.isPending,onClick:()=>V.mutate(),className:"text-body",style:{padding:"var(--sp-0_5) var(--sp-2)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",background:"var(--bg-raised)",color:"var(--fg)",cursor:V.isPending?"default":"pointer",opacity:V.isPending?.6:1},children:V.isPending?"Restoring…":"Restore"})]}),l.jsx("div",{className:"flex-1 overflow-y-auto relative",style:{padding:"var(--sp-2_5) var(--sp-6)"},children:l.jsxs("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:[Se===0&&l.jsxs("div",{className:"flex flex-col items-center text-body",style:{color:"var(--fg-3)",padding:"var(--sp-8) 0",gap:6},children:[l.jsx(Rv,{className:"h-8 w-8",style:{opacity:.3}}),n?"No messages yet":"Send a message to start the conversation"]}),l.jsx("div",{className:"flex flex-col",style:{gap:4},children:H.map(le=>{if(le.kind==="workgroup")return l.jsx(NY,{events:le.events,defaultOpen:(I==null?void 0:I.type)==="direct"},le.key);if(le.kind==="event"){const Pe=le.data;switch(Pe.kind){case"assistant_text":return l.jsx(AY,{event:Pe,agentId:e,agentNameFn:Ee,agentAvatarFn:m},le.key);case"error":return l.jsx(RY,{event:Pe},le.key);default:return null}}const me=le.data;if(me.format==="question"&&xY(me.content)){const Pe=ae.get(me.content.correlationId)??null,qe=Pe?"answered":"pending";return l.jsx(LY,{msg:me,chatId:t,content:me.content,answer:Pe,status:qe,agentNameFn:Ee,agentAvatarFn:m},le.key)}return me.format==="question_answer"?l.jsx(PY,{msg:me,agentNameFn:Ee,agentAvatarFn:m},le.key):l.jsx(OY,{msg:me,myAgentId:h,agentNameFn:Ee,agentAvatarFn:m},le.key)})}),l.jsx("div",{ref:R})]})}),l.jsx("div",{className:"shrink-0",style:{padding:"var(--sp-2_5) var(--sp-6) var(--sp-3)"},children:l.jsx("div",{style:{maxWidth:"clamp(55rem, 75%, 70rem)",margin:"0 auto",width:"100%"},children:n?l.jsxs("div",{className:"flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-2) var(--sp-3)",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},children:[l.jsx(ZC,{className:"h-4 w-4 shrink-0",style:{color:"var(--fg-3)"}}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"text-body",style:{color:"var(--fg-2)"},children:"You're watching this chat — read-only."}),(s==null?void 0:s.error)&&l.jsx("div",{className:"mono text-label",style:{color:"var(--state-error)",marginTop:2},children:s.error})]}),s&&l.jsx(xe,{type:"button",variant:"secondary",size:"sm",className:"shrink-0",onClick:s.onJoin,disabled:s.joining,children:s.joining?"Joining…":"Join to reply"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{position:"relative",border:"var(--hairline) solid var(--border)",borderRadius:6,background:"var(--bg-sunken)"},onDragOver:le=>le.preventDefault(),onDrop:le=>{le.preventDefault(),Y(Array.from(le.dataTransfer.files))},children:[k.length>0&&l.jsx("div",{className:"flex items-center",style:{gap:6,padding:"var(--sp-1_5) var(--sp-2_5) 0",overflowX:"auto"},children:k.map(le=>l.jsxs("div",{style:{position:"relative",flexShrink:0,borderRadius:4,border:"var(--hairline) solid var(--border)",overflow:"hidden"},children:[l.jsx("img",{src:le.previewUrl,alt:le.file.name,style:{height:32,width:"auto",display:"block",objectFit:"cover"}}),l.jsx("button",{type:"button",onClick:()=>X(le.id),style:{position:"absolute",top:1,right:1,width:14,height:14,borderRadius:"50%",background:"var(--color-overlay-scrim)",border:"none",color:"var(--bg-raised)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",padding:0},children:l.jsx(pi,{className:"h-2 w-2"})})]},le.id))}),l.jsxs("div",{style:{position:"relative"},children:[l.jsx(HT,{trigger:et.trigger,results:et.results,highlightIndex:et.highlightIndex,anchorRef:z,onPick:et.pick}),l.jsx("textarea",{ref:z,value:p,onChange:le=>{g(le.target.value),x(le.target.selectionStart??le.target.value.length),A(null)},onSelect:le=>{x(le.currentTarget.selectionStart??p.length)},onFocus:()=>{we&&(F.current||p.length>0||st.length===0||(F.current=!0,g("@"),x(1),requestAnimationFrame(()=>{const le=z.current;le&&le.setSelectionRange(1,1)})))},onPaste:le=>{const me=Array.from(le.clipboardData.files);me.length>0&&(le.preventDefault(),Y(me))},placeholder:we?"Type @ to pick a recipient, then your message":`Message @${Fe} · / for commands · @ to mention`,rows:2,onKeyDown:le=>{le.nativeEvent.isComposing||et.handleKey(le)||le.key==="Enter"&&!le.shiftKey&&(le.preventDefault(),G())},disabled:te.isPending||j,className:"w-full outline-none text-subtitle font-normal",style:{padding:"var(--sp-2_25) var(--sp-3) var(--sp-7_5)",background:"transparent",border:"none",minHeight:"calc(2lh + var(--sp-2_25) + var(--sp-7_5))",maxHeight:"10.5rem",overflowY:"auto",resize:"none",color:"var(--fg)"}})]}),l.jsxs("div",{className:"flex items-center justify-between text-caption",style:{position:"absolute",bottom:6,left:10,right:10,color:"var(--fg-4)"},children:[l.jsxs("span",{className:"mono flex items-center",style:{gap:10},children:[l.jsx("button",{type:"button",onClick:()=>{const le=z.current;if(!le)return;const me=le.selectionStart??p.length,Pe=le.selectionEnd??me,qe=`${p.slice(0,me)}@${p.slice(Pe)}`;g(qe),x(me+1),requestAnimationFrame(()=>{le.focus(),le.setSelectionRange(me+1,me+1)})},title:"Mention an agent (or type @)",style:{background:"none",border:"none",cursor:"pointer",color:"var(--fg-3)",padding:0,display:"inline-flex",alignItems:"center"},children:l.jsx(cD,{className:"h-3.5 w-3.5"})}),l.jsx("button",{type:"button",onClick:()=>{var le;return(le=D.current)==null?void 0:le.click()},title:"Attach image",style:{background:"none",border:"none",cursor:"pointer",color:"var(--fg-3)",padding:0,display:"inline-flex",alignItems:"center"},children:l.jsx($D,{className:"h-3.5 w-3.5"})}),l.jsx("input",{ref:D,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:le=>{le.target.files&&(Y(Array.from(le.target.files)),le.target.value="")}})]}),l.jsxs("span",{className:"flex items-center",style:{gap:8},children:[j&&l.jsx("span",{className:"mono text-caption",style:{color:"var(--accent)"},children:"uploading…"}),l.jsx("button",{type:"button",onClick:G,disabled:te.isPending||j||!p.trim()&&k.length===0||we&&ze.length===0,title:we&&ze.length===0?"Pick at least one recipient with @ before sending in a group chat":"Send (Enter)","aria-label":"Send",className:Oe("inline-flex items-center justify-center transition-opacity",(te.isPending||j||!p.trim()&&k.length===0||we&&ze.length===0)&&"opacity-40 cursor-not-allowed"),style:{width:28,height:28,borderRadius:"var(--radius-input)",background:"var(--fg)",color:"var(--bg-raised)",border:"none"},children:l.jsx($C,{className:"h-3.5 w-3.5",strokeWidth:2.5})})]})]})]}),(te.isError||O)&&l.jsx("p",{className:"mono text-label",style:{color:"var(--state-error)",padding:"var(--sp-1_5) var(--sp-0_5) 0"},children:O??(te.error instanceof Error?te.error.message:"Failed to send")})]})})})]})}function BY({chatId:e,participantIds:t,candidates:n,agentIdentity:a,onAdded:s,readOnly:o=!1}){const[u,f]=b.useState(!1),m=b.useRef(null);b.useEffect(()=>{if(!u)return;const g=w=>{m.current&&(m.current.contains(w.target)||f(!1))};return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[u]);const h=pt({mutationFn:g=>yK(e,{participantIds:[g]}),onSuccess:()=>{f(!1),s()}}),p=b.useMemo(()=>n.filter(g=>!t.includes(g.agentId)),[n,t]);return l.jsxs("div",{className:"inline-flex items-center flex-wrap",style:{gap:4},children:[t.map(g=>{const w=a(g),x=(w==null?void 0:w.displayName)??(w==null?void 0:w.name)??g.slice(0,8);return l.jsxs("span",{className:"inline-flex items-center text-label",style:{padding:"var(--sp-0_5) var(--sp-1_5) var(--sp-0_5) var(--sp-0_5)",borderRadius:"var(--radius-chip)",background:"var(--bg-sunken)",color:"var(--fg-2)",gap:6},children:[l.jsx(Yf,{src:(w==null?void 0:w.avatarImageUrl)??null,name:x,seed:g,size:16}),x]},g)}),!o&&l.jsxs("div",{ref:m,style:{position:"relative"},children:[l.jsx("button",{type:"button",onClick:()=>f(!u),disabled:p.length===0||h.isPending,title:p.length===0?"All available agents are already in this chat":"Add participant","aria-label":"Add participant",className:"inline-flex items-center transition-colors hover:bg-[var(--bg-sunken)]",style:{padding:"var(--sp-0_5) var(--sp-1)",borderRadius:"var(--radius-chip)",border:"var(--hairline) solid var(--border)",background:"transparent",color:p.length===0?"var(--fg-4)":"var(--fg-3)",cursor:p.length===0?"not-allowed":"pointer"},children:l.jsx(Sa,{className:"h-3 w-3"})}),u&&p.length>0&&l.jsxs("div",{role:"listbox","aria-label":"Add participant",className:"absolute z-20 max-h-56 overflow-auto rounded-md border shadow-lg",style:{top:"calc(100% + var(--sp-1))",right:0,minWidth:280,background:"var(--bg-raised)",borderColor:"var(--border)"},children:[l.jsx("div",{role:"note",className:"text-caption",style:{padding:"var(--sp-1) var(--sp-3)",color:"var(--fg-3)",borderBottom:"var(--hairline) solid var(--border-faint)",background:"var(--bg-sunken)",whiteSpace:"normal",lineHeight:1.4},children:"Adding is final in V1 — participants can't be removed yet."}),(()=>{const g=Lb(p);return Ub(p).map(w=>"divider"in w?l.jsx("div",{role:"presentation",style:{height:"var(--hairline)",background:"var(--border-faint)",margin:"var(--sp-0_5) var(--sp-3)"}},"__divider"):l.jsx("button",{type:"button",role:"option","aria-selected":"false",title:w.name?`@${w.name}`:void 0,onClick:()=>h.mutate(w.agentId),disabled:h.isPending,className:"flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-body",style:{background:"transparent",color:"var(--fg)",border:"none",cursor:"pointer",whiteSpace:"nowrap"},children:l.jsx(Pb,{candidate:w,ambiguous:g})},w.agentId))})()]})]})]})}function FY(e,t){var s;const n=e.filter(o=>o.agentId!==t),a=n.find(o=>o.type!=="human");return a?a.agentId:((s=n[0])==null?void 0:s.agentId)??null}function $Y({chatId:e}){const t=vn(),{agentId:n}=ut(),{data:a}=We({queryKey:["chat-detail",e],queryFn:()=>BT(e),enabled:!!e}),s=b.useMemo(()=>a?FY(a.participants.map(g=>({agentId:g.agentId,type:g.type})),n):null,[a,n]),u=pt({mutationFn:()=>pK(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]})}}).mutate,f=b.useRef(null),m=a!=null&&a.viewerMembershipKind!==null;b.useEffect(()=>{m&&f.current!==e&&(f.current=e,u())},[e,m,u]),cb({onMessage:g=>{if(!m)return;if(g.type==="ws:reconnect"){u();return}g.type!=="chat:message"||(typeof g.chatId=="string"?g.chatId:null)!==e||u()}});const h=pt({mutationFn:()=>vK(e),onSuccess:()=>{t.invalidateQueries({queryKey:["me","chats"]}),t.invalidateQueries({queryKey:["chat-detail",e]})}}),p=(a==null?void 0:a.viewerMembershipKind)==="watching";return s?p?l.jsx(Pj,{agentId:s,chatId:e,readOnly:!0,titleFallback:(a==null?void 0:a.title)??null,joinAction:{onJoin:()=>h.mutate(),joining:h.isPending,error:h.isError?h.error instanceof Error?h.error.message:"Failed to join":null}}):l.jsx(Pj,{agentId:s,chatId:e}):l.jsx("div",{className:"flex-1 flex items-center justify-center",style:{padding:"var(--sp-8)"},children:l.jsxs("div",{className:"text-center",style:{color:"var(--fg-3)"},children:[l.jsx("div",{className:"text-subtitle",style:{color:"var(--fg-2)",marginBottom:6},children:"Loading chat…"}),l.jsx("div",{className:"text-body",children:"Resolving participants."})]})})}function HY(){return l.jsx("div",{className:"flex-1 flex items-center justify-center p-8",children:l.jsxs("div",{className:"text-center max-w-sm",children:[l.jsx(Fu,{width:36,height:40,className:"mx-auto mb-3 text-primary opacity-60"}),l.jsx("div",{className:"text-subtitle mb-1",children:"Select a chat"}),l.jsx("div",{className:"text-body text-muted-foreground",children:"Pick an agent from the roster to view its sessions, or open a chat to start collaborating."})]})})}function qY(e,t){return!e||!t?!1:e.toLowerCase()===`${t.toLowerCase()}'s team`}function ZY({organizationId:e,onContinue:t}){const[n,a]=b.useState([]),[s,o]=b.useState(""),[u,f]=b.useState(""),[m,h]=b.useState(!1),[p,g]=b.useState(null),[w,x]=b.useState(!1),[k,C]=b.useState(null),j=b.useRef(null);b.useEffect(()=>{(async()=>{try{const D=await Ce.get("/me/organizations");a(D)}catch(D){C(D instanceof Error?D.message:"Failed to load your team")}finally{x(!0)}})()},[]),b.useEffect(()=>{var z;const D=((z=n.find(R=>R.id===e))==null?void 0:z.displayName)??"";o(D),f(D)},[n,e]),b.useEffect(()=>{const D=j.current;if(!D||!u)return;D.focus();const z=D.value.length;D.setSelectionRange(z,z)},[u]);const E=s.trim(),O=E.length>0&&!m&&w&&!k,A=b.useCallback(async D=>{if(D==null||D.preventDefault(),!(!O||!e)){g(null);try{E!==u.trim()&&(h(!0),await Ce.patch(`/orgs/${encodeURIComponent(e)}`,{displayName:E}),mi("team_renamed")),t()}catch(z){g(z instanceof Error?z.message:"Failed to rename team")}finally{h(!1)}}},[O,e,E,u,t]);return l.jsxs("form",{onSubmit:A,className:"flex flex-col",style:{gap:"var(--sp-5)"},children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:["Name your ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"agent team"})," — where humans and AIs collaborate."]}),l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-2)"},children:[l.jsx("label",{htmlFor:"onboarding-team-name",className:"text-label",style:{color:"var(--fg-3)"},children:"Team name"}),l.jsx("input",{ref:j,id:"onboarding-team-name","aria-label":"Team display name",value:s,onChange:D=>o(D.target.value),maxLength:200,disabled:m,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",caretColor:"var(--accent)"},onFocus:D=>{D.currentTarget.style.borderColor="var(--accent)"},onBlur:D=>{D.currentTarget.style.borderColor="var(--border)"}})]}),p||k?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:p??`Couldn't load your team — ${k}. Refresh the page and try again.`}):null,l.jsx("div",{className:"flex justify-end",children:l.jsxs(xe,{type:"submit",disabled:!O,children:[l.jsx("span",{children:"Continue"}),l.jsx(FC,{className:"h-4 w-4"})]})})]})}function Bb(){return l.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:"var(--sp-5)",bottom:"var(--sp-5)",left:"calc(var(--sp-2_5) - var(--hairline))",width:"var(--hairline)",background:"color-mix(in oklch, var(--border-faint) 56%, transparent)"}})}function di({number:e,state:t,children:n}){const a=t==="active",s=t==="complete";return l.jsxs("section",{className:"grid",style:{gridTemplateColumns:"var(--sp-5) 1fr",columnGap:"var(--sp-3)",marginTop:e==="01"?0:"var(--sp-5)",position:"relative"},children:[l.jsx("div",{className:"mono text-caption flex items-center justify-center",style:{width:"var(--sp-5)",height:"var(--sp-5)",borderRadius:999,background:a||s?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:a||s?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",color:a||s?"var(--accent)":"var(--fg-4)",zIndex:1},children:s?l.jsx(mr,{className:"h-3 w-3"}):e}),l.jsx("div",{style:{minHeight:"var(--sp-6)",paddingBottom:"var(--sp-1)"},children:n})]})}const GY=3e4,VY=1e3,QY=3e3;function KY(e){return e==="claude-code"?"Claude Code":e==="codex"?"Codex":e}function YY({organizationId:e,memberId:t,orgHasOtherMembers:n,refreshMe:a}){var Ge;const s=zn(),{user:o}=ut(),u=FM(e,t),f=HM(u),m=f!=null&&f.connectToken&&f.connectTokenExpiresAt&&f.connectTokenExpiresAt>Date.now()?f.connectToken:null,h=m?(f==null?void 0:f.connectTokenExpiresAt)??null:null,[p,g]=b.useState(()=>(f==null?void 0:f.displayName)??(o!=null&&o.username?`${o.username}'s assistant`:"Assistant")),[w,x]=b.useState(()=>(f==null?void 0:f.visibility)??"organization"),[k,C]=b.useState(()=>(f==null?void 0:f.selectedRuntime)??null),[j,E]=b.useState(null),[O,A]=b.useState(null),[D,z]=b.useState(null),[R,F]=b.useState(()=>m),[B,ee]=b.useState(()=>h),[L,I]=b.useState([]),[Q,te]=b.useState("form"),[Y,X]=b.useState(null),G=b.useRef(null),se=b.useRef(null),J=b.useRef(null),ve=b.useRef(0);b.useEffect(()=>()=>{se.current&&(se.current.cancelled=!0)},[]),b.useEffect(()=>{qM(u,{displayName:p,selectedRuntime:k,connectToken:R,connectTokenExpiresAt:B,visibility:w})},[u,p,k,R,B,w]),b.useEffect(()=>{(async()=>{try{const Fe=await Ce.get("/me/organizations");I(Fe)}catch{}})()},[]),b.useEffect(()=>{if(Q!=="form")return;let Fe=!1;const Ve=async()=>{const Nt=++ve.current;try{const we=await gi();if(Fe||Nt!==ve.current)return;const et=we.filter(Ct=>Ct.status==="connected").sort((Ct,le)=>le.lastSeenAt.localeCompare(Ct.lastSeenAt))[0]??null;if(E(Ct=>(Ct==null?void 0:Ct.id)===(et==null?void 0:et.id)?Ct:et),et){J.current!==et.id&&(J.current=null,z(null),A(null));try{const Ct=await mh(et.id);if(Fe||Nt!==ve.current)return;J.current=et.id,z(et.id),A(Ct.capabilities)}catch{}}else J.current=null,z(null),A(null)}catch{}};Ve();const st=setInterval(Ve,QY);return()=>{Fe=!0,clearInterval(st)}},[Q]),b.useEffect(()=>{if(j)return;if(R&&B&&B>Date.now()){const Ve=Math.max(B-Date.now(),0),st=window.setTimeout(()=>{F(null),ee(null)},Ve);return()=>window.clearTimeout(st)}R&&(F(null),ee(null));let Fe=!1;return(async()=>{try{const Ve=await Ce.post("/me/connect-tokens",{});Fe||(F(Ve.token),ee(Date.now()+Ve.expiresIn*1e3))}catch(Ve){Fe||X(Ve instanceof Error?Ve.message:"Failed to generate connect token")}})(),()=>{Fe=!0}},[j,R,B]);const M=j&&D===j.id?O:null;b.useEffect(()=>{C(Fe=>{var st;if(!M)return Fe;const Ve=XY(M);return Fe&&Ve&&Object.keys(M).includes(Fe)&&((st=M[Fe])==null?void 0:st.state)==="ok"?Fe:Ve})},[M]);const U=M?Object.entries(M).filter(([,Fe])=>Fe.state==="ok").map(([Fe])=>Fe):[],P=((Ge=L.find(Fe=>Fe.id===e))==null?void 0:Ge.displayName)??"",_=p.trim(),V=_||"your agent",H=R?`npm install -g @agent-team-foundation/first-tree-hub
|
|
413
|
-
first-tree-hub connect ${R}`:null,ae=b.useCallback(async Fe=>{se.current&&(se.current.cancelled=!0);const Ve={cancelled:!1};se.current=Ve;const st=Date.now();for(;!Ve.cancelled;){let Nt=!1;try{const we=await Ce.get(`/agents/${encodeURIComponent(Fe)}/client-status`);if(Ve.cancelled)return;Nt=we.online===!0}catch{if(Ve.cancelled)return}if(Nt){ZM(u);try{await a()}catch{}if(Ve.cancelled)return;s("/",{replace:!0});return}if(Date.now()-st>GY){Ve.cancelled||te("timeout");return}await new Promise(we=>setTimeout(we,VY))}},[u,a,s]),Se=!!(_&&j&&k&&U.includes(k)&&Q==="form"),Ae=b.useCallback(async()=>{if(!j||!k||!_)return;X(null),te("creating");const Fe=tv(_);let Ve;try{Ve=(await Ce.post(hn("/agents"),{type:"personal_assistant",displayName:_,...Fe?{name:Fe}:{},clientId:j.id,runtimeProvider:k,visibility:w,...e?{organizationId:e}:{}})).uuid,G.current=Ve,PM(Ve),mi("agent_created",{runtimeProvider:k})}catch(st){X(st instanceof Error?st.message:"Failed to create agent"),te("form");return}await ae(Ve)},[_,j,k,w,ae,e]),Ee=b.useCallback(async()=>{const Fe=G.current;Fe&&(X(null),te("creating"),await ae(Fe))},[ae]);return Q==="creating"?l.jsx(iX,{nameOrFallback:V}):Q==="timeout"?l.jsx(sX,{nameOrFallback:V,hostname:(j==null?void 0:j.hostname)??null,error:Y,onRetry:Ee}):l.jsx(WY,{orgHasOtherMembers:n,teamName:P,displayName:p,setDisplayName:g,trimmedName:_,connectedClient:j,cliCommand:H,capabilitiesLoaded:M!==null,okRuntimes:U,selectedRuntime:k,setSelectedRuntime:C,visibility:w,setVisibility:x,error:Y,canCreate:Se,onCreate:Ae})}function XY(e){const t=a=>{var s;return((s=e[a])==null?void 0:s.state)==="ok"};if(t("claude-code"))return"claude-code";if(t("codex"))return"codex";const n=Object.entries(e).find(([,a])=>a.state==="ok");return n?n[0]:null}function WY({orgHasOtherMembers:e,teamName:t,displayName:n,setDisplayName:a,trimmedName:s,connectedClient:o,cliCommand:u,capabilitiesLoaded:f,okRuntimes:m,selectedRuntime:h,setSelectedRuntime:p,visibility:g,setVisibility:w,error:x,canCreate:k,onCreate:C}){const j=b.useRef(null),E=e&&!!t,O=!!o&&!!h&&f&&m.includes(h),A=f&&m.length===0&&!!o,D=s?o?A?"Install Claude Code (or Codex) on that computer, then sign in.":h?"Ready to create.":"Detecting installed runtimes…":"Next: connect the computer where they'll work.":"Next: name your agent.";return b.useEffect(()=>{var z;s||(z=j.current)==null||z.focus()},[s]),l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:E?l.jsxs(l.Fragment,{children:["You've joined"," ",l.jsx("span",{className:"font-semibold",style:{color:"var(--fg-2)"},children:t}),". Let's set up your first agent."]}):l.jsx(l.Fragment,{children:"Let's set up your first agent."})}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(Bb,{}),l.jsx(di,{number:"01",state:s?"complete":"active",children:l.jsxs("div",{className:"flex items-baseline",style:{gap:"var(--sp-2)",flexWrap:"wrap"},children:[l.jsx("label",{htmlFor:"onboarding-name",className:"text-body font-normal",style:{color:"var(--fg-2)",whiteSpace:"nowrap"},children:"Name your agent"}),l.jsx("input",{ref:j,id:"onboarding-name","aria-label":"Agent display name",value:n,onChange:z=>a(z.target.value),placeholder:"e.g. Buddy, Helper",maxLength:200,className:"onboarding-name-input text-body font-medium",style:{flex:"0 1 28ch",minWidth:"22ch",maxWidth:"30ch",padding:"var(--sp-0_5) 0",background:"transparent",border:0,borderBottom:"var(--hairline) solid var(--border-faint)",borderRadius:0,boxShadow:"none",color:"var(--fg)",outline:"none",caretColor:"var(--accent)",transition:"border-color 160ms ease, color 160ms ease"},onFocus:z=>{z.currentTarget.style.borderBottomColor="var(--accent)"},onBlur:z=>{z.currentTarget.style.borderBottomColor="var(--border-faint)"}})]})}),l.jsx(di,{number:"02",state:O?"complete":s?"active":"idle",children:l.jsxs("div",{style:{animation:s?"subtle-fade 200ms ease-out":void 0},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{color:s?"var(--fg)":"var(--fg-4)",fontWeight:s?600:500},children:"Connect a computer"}),s?l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:o?`${s} will run on this computer and stay connected to Hub.`:`${s} needs a computer to run on. Connect one with the command below.`}),!o&&l.jsx("p",{className:"text-label",style:{color:"var(--fg-4)",marginTop:"var(--sp-2)"},children:"Open Terminal on that computer and run this command."}),o?l.jsxs(l.Fragment,{children:[l.jsx(rX,{hostname:o.hostname??o.id}),l.jsx(tX,{runtimes:m,selected:h,onSelect:p,capabilitiesLoaded:f})]}):l.jsxs(l.Fragment,{children:[l.jsx(JY,{command:u}),l.jsx(eX,{})]})]}):null]})}),l.jsx(di,{number:"03",state:O?"active":"idle",children:l.jsxs("div",{style:{animation:O?"subtle-fade 200ms ease-out":void 0},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{color:O?"var(--fg)":"var(--fg-4)",fontWeight:O?600:500},children:"Pick who can use it"}),O?l.jsx(nX,{value:g,onChange:w}):null]})})]}),x&&l.jsx("div",{className:"text-body",style:{marginTop:"var(--sp-4)",padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:x}),s&&l.jsxs("div",{style:{marginTop:k?"var(--sp-4)":"var(--sp-5)",marginLeft:"calc(var(--sp-5) + var(--sp-3))",animation:"subtle-fade 180ms ease-out"},children:[!k&&l.jsx("p",{className:"text-label",style:{margin:0,color:"var(--fg-4)"},children:D}),k&&l.jsxs(xe,{type:"button",size:"default",style:{marginTop:0,border:"var(--hairline) solid color-mix(in oklch, var(--accent) 32%, transparent)",background:"var(--accent)",boxShadow:"var(--shadow-md)",color:"var(--primary-foreground, var(--color-primary-foreground))",opacity:1,transform:"translateZ(0)",transition:"box-shadow 160ms ease, transform 160ms ease"},onClick:C,onMouseEnter:z=>{z.currentTarget.style.transform="scale(1.01)",z.currentTarget.style.boxShadow="var(--shadow-md)"},onMouseLeave:z=>{z.currentTarget.style.transform="scale(1)",z.currentTarget.style.boxShadow="var(--shadow-md)"},children:[l.jsxs("span",{children:["Create ",s]}),l.jsx(FC,{className:"h-4 w-4"})]}),l.jsx("p",{className:"text-caption",style:{margin:k?"var(--sp-2) 0 0":"var(--sp-0_5) 0 0",color:"var(--fg-4)"},children:"You can customize this agent after setup."})]})]})}function JY({command:e}){const[t,n]=b.useState(!1),s=(e?e.split(`
|
|
414
|
-
`):[]).find(m=>m.startsWith("first-tree-hub"))??"",o="first-tree-hub connect ",u=s.startsWith(o)?`${o}${s.slice(o.length,o.length+22)}…`:s.length>52?`${s.slice(0,52)}…`:s,f=async()=>{e&&(await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500))};return l.jsx("div",{style:{marginTop:"var(--sp-2)"},children:l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)",alignItems:"stretch"},children:[l.jsx("pre",{className:"mono text-label",title:s,style:{flex:1,minHeight:38,margin:0,padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--bg-sunken) 42%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--border-faint) 58%, transparent)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",whiteSpace:"nowrap",overflow:"hidden",minWidth:0},children:u||"Generating token…"}),l.jsxs(xe,{type:"button",variant:"outline",size:"sm",onClick:f,disabled:!e,style:{alignSelf:"stretch",background:"color-mix(in oklch, var(--bg-raised) 48%, transparent)",borderColor:"color-mix(in oklch, var(--border) 58%, transparent)",boxShadow:"none",height:"auto",minHeight:38},children:[t?l.jsx(mr,{className:"h-3.5 w-3.5"}):l.jsx(qC,{className:"h-3.5 w-3.5"}),t?"Copied":"Copy"]})]})})}function eX(){return l.jsxs("div",{className:"flex items-center text-body",style:{gap:"var(--sp-2)",marginTop:"var(--sp-2_5)",color:"color-mix(in oklch, var(--accent) 24%, var(--fg-3))"},children:[l.jsx(aX,{}),l.jsx("span",{children:"Waiting for your computer…"})]})}function tX({runtimes:e,selected:t,onSelect:n,capabilitiesLoaded:a}){return e.length===0?l.jsx("p",{className:"text-label",style:{marginTop:"var(--sp-3)",color:"var(--fg-3)"},children:a?"No runtime ready on this computer. Install Claude Code or Codex, then check back.":"Detecting installed runtimes…"}):l.jsxs("div",{style:{marginTop:"var(--sp-3)"},children:[l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginBottom:"var(--sp-1)"},children:"Powered by"}),l.jsxs("fieldset",{className:"flex",style:{gap:"var(--sp-4)",flexWrap:"wrap",margin:0,padding:0,border:0},children:[l.jsx("legend",{className:"sr-only",children:"Runtime provider"}),e.map((s,o)=>{const u=t===s;return l.jsxs("label",{className:"onboarding-runtime-option inline-flex items-center text-body",style:{gap:"var(--sp-1_5)",padding:"var(--sp-1) 0",cursor:"pointer",color:u?"color-mix(in oklch, var(--accent) 30%, var(--fg))":"var(--fg)",fontWeight:u?600:400,animation:`onboarding-rise 220ms ease-out ${o*80}ms both`,transition:"color 160ms ease, opacity 160ms ease, transform 160ms ease"},children:[l.jsx("input",{type:"radio",name:"onboarding-runtime",value:s,checked:u,onChange:()=>n(s),className:"sr-only"}),l.jsx("span",{"aria-hidden":"true",className:"inline-flex items-center justify-center",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",borderRadius:"50%",border:u?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-strong)",background:u?"color-mix(in oklch, var(--accent) 8%, transparent)":"transparent",boxShadow:u?"0 0 0 var(--sp-0_5) color-mix(in oklch, var(--accent) 10%, transparent)":"none",transition:"border-color 160ms ease, background 160ms ease, box-shadow 160ms ease"},children:u&&l.jsx("span",{style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--accent)"}})}),KY(s)]},s)})]})]})}function nX({value:e,onChange:t}){const n=[{value:"organization",title:"Shared with team",description:"Anyone in your org can @mention and chat with this agent."},{value:"private",title:"Private to you",description:"Only you can see this agent and chat with it. Others on the team won't see it listed."}];return l.jsxs("fieldset",{className:"flex flex-col",style:{gap:"var(--sp-2)",margin:"var(--sp-2) 0 0",padding:0,border:0},children:[l.jsx("legend",{className:"sr-only",children:"Agent visibility"}),n.map(a=>{const s=e===a.value;return l.jsxs("label",{className:"text-body",style:{display:"flex",alignItems:"flex-start",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:s?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:s?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",cursor:"pointer",color:s?"var(--fg)":"var(--fg-2)",transition:"background 120ms ease, border-color 120ms ease"},children:[l.jsx("input",{type:"radio",name:"onboarding-visibility",value:a.value,checked:s,onChange:()=>t(a.value),className:"sr-only"}),l.jsx("span",{"aria-hidden":"true",className:"inline-flex items-center justify-center",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",marginTop:"var(--sp-0_5)",borderRadius:"50%",border:s?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-strong)",background:s?"color-mix(in oklch, var(--accent) 8%, transparent)":"transparent",flexShrink:0,transition:"border-color 160ms ease, background 160ms ease"},children:s&&l.jsx("span",{style:{width:"var(--sp-1_5)",height:"var(--sp-1_5)",borderRadius:"50%",background:"var(--accent)"}})}),l.jsxs("span",{className:"flex flex-col",style:{gap:"var(--sp-0_5)",minWidth:0},children:[l.jsx("span",{className:"font-medium",style:{color:s?"var(--fg)":"var(--fg-2)"},children:a.title}),l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:a.description})]})]},a.value)})]})}function rX({hostname:e}){return l.jsxs("div",{className:"inline-flex items-center text-body",style:{gap:"var(--sp-2)",marginTop:"var(--sp-2_5)",padding:"var(--sp-1_5) var(--sp-2_5)",borderRadius:999,background:"color-mix(in oklch, var(--accent) 10%, transparent)",color:"color-mix(in oklch, var(--accent) 26%, var(--fg))",animation:"onboarding-pop 260ms cubic-bezier(0.2, 0.9, 0.2, 1.15)"},children:[l.jsx(mr,{className:"h-3.5 w-3.5"}),l.jsxs("span",{children:[l.jsx("span",{className:"mono font-semibold",children:e})," connected"]})]})}function aX(){return l.jsxs("span",{"aria-hidden":"true",style:{position:"relative",display:"inline-block",width:8,height:8,flexShrink:0},children:[l.jsx("span",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--accent)"}}),l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.55}})]})}function iX({nameOrFallback:e}){return l.jsxs("div",{className:"flex flex-col items-center text-center",style:{paddingTop:"var(--sp-12)",gap:"var(--sp-4)"},children:[l.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:["Creating ",e,"…"]}),l.jsx(lX,{}),l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)"},children:"Usually takes ~10 seconds"})]})}function sX({nameOrFallback:e,hostname:t,error:n,onRetry:a}){const s=t??"your computer";return l.jsxs("div",{className:"flex flex-col",style:{paddingTop:"var(--sp-8)",gap:"var(--sp-4)"},children:[l.jsxs("p",{className:"text-title",style:{color:"var(--fg)"},children:[e," is taking longer than expected."]}),n?l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 10%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 25%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)"},children:n}):l.jsxs("div",{className:"text-body",style:{color:"var(--fg-2)"},children:[l.jsx("p",{children:"This usually means:"}),l.jsxs("ul",{style:{paddingLeft:"var(--sp-4)",listStyle:"disc",marginTop:"var(--sp-1_5)"},children:[l.jsxs("li",{children:["The runtime can't start on ",s," (missing API key, etc.)"]}),l.jsxs("li",{children:["The connection to ",s," dropped"]})]}),l.jsxs("p",{style:{marginTop:"var(--sp-2)"},children:["Fix it on ",s,", then click ",l.jsx("span",{className:"font-semibold",children:"Try again"}),"."]})]}),l.jsx("div",{className:"flex",style:{gap:"var(--sp-2)"},children:l.jsx(xe,{onClick:a,children:"Try again"})})]})}function lX(){return l.jsxs("span",{className:"flex items-center",style:{gap:6},children:[l.jsx(Vg,{delayMs:0}),l.jsx(Vg,{delayMs:160}),l.jsx(Vg,{delayMs:320})]})}function Vg({delayMs:e}){return l.jsx("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:"50%",background:"var(--accent)",animation:"heartbeat-pulse 1.2s ease-in-out infinite",animationDelay:`${e}ms`,display:"inline-block"}})}async function WT(){return(await Ce.get("/me/github/repos")).repos}const JT="https://github.com/agent-team-foundation/first-tree";function eA(e){return e.length===1?[`Source repo: ${e[0]}`]:["Source repos:",...e.map(t=>`- ${t}`)]}function Fb(e,t){const n=eA(e),a=e.length===1?"Bind my source repo to an existing context-tree.":"Bind my source repos to an existing context-tree.",s=e.length===1?"Your workspace already has the source repo cloned in a subdirectory; the first-tree skill will locate it. Use the first-tree CLI to install the skill in the source repo and write the binding metadata pointing at the existing tree, then open a PR back to the source with those changes. Walk me through the PR when it's up.":"Your workspace already has each source repo cloned in its own subdirectory; the first-tree skill will locate them. For every source repo, use the first-tree CLI to install the skill and write the binding metadata pointing at the existing tree, then open a PR back to that source repo. Walk me through each PR as it goes up.";return[a,"",...n,`Existing tree: ${t}`,"",s,"",`Reference: ${JT}`].join(`
|
|
415
|
-
`)}function oX(e){const t=eA(e),n=e.length===1?"Create a brand-new context-tree for my source repo.":"Create a brand-new context-tree for my source repos.",a=e.length===1?"Your workspace already has the source repo cloned in a subdirectory; the first-tree skill will locate it. Use the first-tree CLI to install the skill in the source, scaffold a sibling tree directory, and write the binding metadata. Then push that new tree directory up to GitHub as a sibling repo under the same owner as the source, and open a PR back to the source with the skill + binding files.":"Your workspace already has each source repo cloned in its own subdirectory; the first-tree skill will locate them. Scaffold ONE shared tree directory that all the source repos bind to. For every source repo, install the first-tree skill and write the binding metadata pointing at that shared tree. Push the new tree directory up to GitHub as its own repo — if all the source repos share a single GitHub owner, host the tree under that owner; otherwise ask me which owner to use before pushing. Then open a PR back to each source repo with its skill + binding files.";return[n,"",...t,"",a,"","Once you know the URL of the new tree repo, use the first-tree-hub CLI's `org bind-tree` command to record it on the Hub so future agents in this team can find it.","","When everything is up, walk me through what was created — which directory, which repo, which PRs.","",`Reference: ${JT}`].join(`
|
|
416
|
-
`)}function cX(){const{role:e}=ut();return e==="admin"?l.jsx(gX,{}):l.jsx(uX,{})}function uX(){var f,m;const{organizationId:e}=ut(),[t,n]=b.useState({kind:"loading"}),[a,s]=b.useState(0);if(b.useEffect(()=>{if(!e){n({kind:"loaded",tree:null,repos:null});return}let h=!1;return n({kind:"loading"}),(async()=>{try{const[p,g]=await Promise.all([Db(e),IT(e)]);if(h)return;n({kind:"loaded",tree:p,repos:g})}catch(p){if(h)return;n({kind:"error",message:p instanceof Error?p.message:"Failed to load team setup"})}})(),()=>{h=!0}},[e,a]),t.kind==="loading")return l.jsx(fX,{});if(t.kind==="error")return l.jsx(dX,{message:t.message,onRetry:()=>s(h=>h+1)});const o=((f=t.tree)==null?void 0:f.repo)??"",u=((m=t.repos)==null?void 0:m.repos)??[];return o&&u.length>0?l.jsx(hX,{treeUrl:o,teamRepos:u}):o?l.jsx(mX,{treeUrl:o}):l.jsx(pX,{})}function dX({message:e,onRetry:t}){return l.jsxs("div",{style:{padding:"var(--sp-5) var(--sp-4)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-card)"},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Couldn't load your team's setup"}),l.jsxs("p",{className:"text-body",style:{marginTop:"var(--sp-2)",color:"var(--fg-3)"},children:[e,". This is usually a transient network issue."]}),l.jsx("div",{style:{marginTop:"var(--sp-3)"},children:l.jsx(xe,{type:"button",onClick:t,children:"Try again"})})]})}function fX(){return l.jsx("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)"},children:"Checking your team's setup…"})}function hX({treeUrl:e,teamRepos:t}){var j;const n=zn(),{dismissOnboarding:a,markOnboardingCompleted:s}=ut(),{addToast:o}=Hu(),[u,f]=b.useState(!1),[m,h]=b.useState(null),[p,g]=b.useState(()=>t.map(E=>E.url)),w=p.length>0,x=b.useCallback(E=>{g(O=>O.includes(E)?O.filter(A=>A!==E):[...O,E])},[]),k=b.useCallback(async()=>{if(p.length!==0){f(!0),h(null);try{const E=await $b(),O=await yu(E.uuid);await Ah(E.uuid,{expectedVersion:O.version,payload:{gitRepos:p.map(z=>({url:z}))}});const A=await zb(E.uuid),D=Fb(p,e);try{await No(A.id,D)}catch{}mi("tree_chat_started",{agentUuid:E.uuid,chatId:A.id,treeMode:"existing",joinPath:"invite"}),a(),s(),n(`/?c=${encodeURIComponent(A.id)}`,{replace:!1})}catch(E){h(E instanceof Error?E.message:"Failed to start the chat"),f(!1)}}},[p,e,n,a,s]),C=b.useCallback(()=>{mi("tree_intro_dismissed",{joinPath:"invite"}),a(),o(Hb(n))},[a,o,n]);return l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Your team has already set up its ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"}),". Confirm to bind your agent."]}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",display:"flex",flexDirection:"column",gap:"var(--sp-4)"},children:[l.jsx(lv,{label:"Tree",value:e}),t.length===1?l.jsx(lv,{label:"Source repo",value:((j=t[0])==null?void 0:j.url)??""}):l.jsxs("fieldset",{disabled:u,style:{display:"flex",flexDirection:"column",gap:"var(--sp-2)",margin:0,padding:0,border:0},children:[l.jsx("legend",{className:"text-label",style:{color:"var(--fg-3)",padding:0,marginBottom:"var(--sp-1)"},children:"Pick the source repos to bind your agent to"}),t.map(E=>{const O=p.includes(E.url);return l.jsxs("label",{className:"text-body",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:O?"color-mix(in oklch, var(--accent) 8%, var(--bg))":"var(--bg)",border:O?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",cursor:u?"not-allowed":"pointer",color:O?"var(--fg)":"var(--fg-2)",fontWeight:O?600:400},children:[l.jsx("input",{type:"checkbox",value:E.url,checked:O,onChange:()=>x(E.url),className:"sr-only"}),l.jsx("span",{"aria-hidden":"true",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:O?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:O?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:O?l.jsx(mr,{className:"h-3 w-3",strokeWidth:3}):null}),l.jsx("span",{className:"mono truncate",style:{minWidth:0,flex:1},children:E.url})]},E.url)})]}),m?l.jsx(qb,{children:m}):null,l.jsxs("div",{className:"flex",style:{gap:"var(--sp-2)"},children:[l.jsx(xe,{type:"button",disabled:!w||u,onClick:()=>void k(),children:u?"Starting…":"Confirm"}),l.jsx(xe,{type:"button",variant:"outline",onClick:C,disabled:u,children:"I'll do it later"})]})]})]})}function mX({treeUrl:e}){const t=zn(),{dismissOnboarding:n,markOnboardingCompleted:a}=ut(),{addToast:s}=Hu(),[o,u]=b.useState(!1),[f,m]=b.useState(null),[h,p]=b.useState(null),[g,w]=b.useState(null),[x,k]=b.useState([]),C=x.length>0,j=b.useCallback(A=>{k(D=>D.includes(A)?D.filter(z=>z!==A):[...D,A])},[]);b.useEffect(()=>{let A=!1;return(async()=>{try{const D=await WT();if(A)return;p(D)}catch(D){A||w(D instanceof Error?D.message:"Failed to list GitHub repositories")}})(),()=>{A=!0}},[]);const E=b.useCallback(async()=>{if(x.length!==0){u(!0),m(null);try{const A=await $b(),D=await yu(A.uuid);await Ah(A.uuid,{expectedVersion:D.version,payload:{gitRepos:x.map(F=>({url:F}))}});const z=await zb(A.uuid),R=Fb(x,e);try{await No(z.id,R)}catch{}mi("tree_chat_started",{agentUuid:A.uuid,chatId:z.id,treeMode:"existing",joinPath:"invite"}),n(),a(),t(`/?c=${encodeURIComponent(z.id)}`,{replace:!1})}catch(A){m(A instanceof Error?A.message:"Failed to start the chat"),u(!1)}}},[x,e,t,n,a]),O=b.useCallback(()=>{mi("tree_intro_dismissed",{joinPath:"invite"}),n(),s(Hb(t))},[n,s,t]);return l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Joining your team's ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"}),". Pick the source repos you'll work with."]}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(Bb,{}),l.jsx(di,{number:"01",state:"complete",children:l.jsx(lv,{label:"Tree",value:e})}),l.jsx(di,{number:"02",state:C?"complete":"active",children:l.jsx(tA,{disabled:o,repos:h,error:g,selectedRepoUrls:x,onToggle:j})}),l.jsxs(di,{number:"03",state:C?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:C?"var(--fg)":"var(--fg-4)",fontWeight:C?600:500},children:"Let your agent join the tree"}),C?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:["It'll install the skill and bind"," ",x.length>1?"each source repo":"your source repo"," to the existing team tree."]}),f?l.jsx(qb,{style:{marginTop:"var(--sp-3)"},children:f}):null,l.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[l.jsx(xe,{type:"button",disabled:!C||o,onClick:()=>void E(),children:o?"Starting…":"Continue"}),l.jsx(xe,{type:"button",variant:"outline",onClick:O,disabled:o,children:"I'll do it later"})]})]}):null]})]})]})}function pX(){const{dismissOnboarding:e}=ut(),{addToast:t}=Hu(),n=b.useRef(!1);return b.useEffect(()=>{n.current||(n.current=!0,mi("tree_intro_dismissed",{joinPath:"invite",reason:"team_unconfigured"}),e(),t({title:"Your team admin hasn't finished setup",description:"Ask your admin to bind a context-tree and source repo. You can keep using your agent for general chat in the meantime."}))},[e,t]),l.jsxs("div",{style:{padding:"var(--sp-5) var(--sp-4)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-card)"},children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:"var(--fg)"},children:"Your team admin hasn't finished setup yet"}),l.jsx("p",{className:"text-body",style:{marginTop:"var(--sp-2)",color:"var(--fg-3)"},children:"Once they finish setup, this view will guide your agent to join. For now, your agent can help with anything that doesn't depend on your team's shared knowledge."})]})}function gX(){const e=zn(),{dismissOnboarding:t,markOnboardingCompleted:n,organizationId:a}=ut(),{addToast:s}=Hu(),[o,u]=b.useState(!1),[f,m]=b.useState(null),[h,p]=b.useState(null),[g,w]=b.useState(""),[x,k]=b.useState([]),[C,j]=b.useState(null),[E,O]=b.useState(null),A=b.useCallback(I=>{k(Q=>Q.includes(I)?Q.filter(te=>te!==I):[...Q,I])},[]);b.useEffect(()=>{let I=!1;return(async()=>{try{const Q=await WT();if(I)return;j(Q)}catch(Q){I||O(Q instanceof Error?Q.message:"Failed to list GitHub repositories")}})(),()=>{I=!0}},[]),b.useEffect(()=>{if(!a)return;let I=!1;return(async()=>{try{const Q=await Db(a);if(I)return;Q.repo&&(w(Q.repo),p(te=>te??"existing"))}catch{}})(),()=>{I=!0}},[a]);const D=g.trim(),z=(()=>{if(h!=="existing")return!0;if(!D)return!1;try{return new URL(D).protocol==="https:"}catch{return!1}})(),R=b.useCallback(()=>{mi("tree_intro_dismissed"),t(),s(Hb(e))},[t,s,e]),F=b.useCallback(async()=>{if(x.length!==0&&h&&!(h==="existing"&&!z)){m(null),u(!0);try{const I=await $b(),Q=await yu(I.uuid),te=x.map(G=>({url:G}));await Ah(I.uuid,{expectedVersion:Q.version,payload:{gitRepos:te}}),a&&await LT(a,{repos:te}),h==="existing"&&a&&await zT(a,{repo:D});const Y=await zb(I.uuid),X=h==="existing"?Fb(x,D):oX(x);try{await No(Y.id,X)}catch{}mi("tree_chat_started",{agentUuid:I.uuid,chatId:Y.id,treeMode:h}),t(),n(),e(`/?c=${encodeURIComponent(Y.id)}`,{replace:!1})}catch(I){m(I instanceof Error?I.message:"Failed to start the tree-init chat"),u(!1)}}},[x,h,z,D,a,e,t,n]),B=x.length>0,ee=B&&h!==null&&!o&&(h==="new"||z),L=!!h&&(h==="new"||z);return l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{margin:0,color:"var(--fg-3)",maxWidth:720},children:["Build the ",l.jsx("span",{style:{color:"var(--fg-2)"},children:"context-tree"})," — your team's shared knowledge that grows with your code."]}),l.jsxs("div",{style:{marginTop:"var(--sp-5)",position:"relative"},children:[l.jsx(Bb,{}),l.jsx(di,{number:"01",state:B?"complete":"active",children:l.jsx(tA,{disabled:o,repos:C,error:E,selectedRepoUrls:x,onToggle:A})}),l.jsxs(di,{number:"02",state:L?"complete":B?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:B?"var(--fg)":"var(--fg-4)",fontWeight:B?600:500},children:"Bind or create the tree"}),B?l.jsxs("div",{style:{marginTop:"var(--sp-3)",display:"flex",flexDirection:"column",gap:"var(--sp-3)"},children:[l.jsxs("fieldset",{"aria-label":"Bind or create the tree",disabled:o,style:{display:"inline-flex",alignSelf:"flex-start",padding:"var(--sp-0_5)",margin:0,background:"var(--surface-2)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",gap:"var(--sp-0_5)"},children:[l.jsx("legend",{className:"sr-only",children:"Bind or create the tree"}),[{value:"existing",label:"Bind to an existing tree"},{value:"new",label:"Create a new tree"}].map(I=>{const Q=h===I.value;return l.jsxs("label",{className:"text-body transition-colors",style:{padding:"var(--sp-1_5) var(--sp-3)",background:Q?"var(--bg)":"transparent",borderRadius:"calc(var(--radius-input) - var(--sp-0_5))",color:Q?"var(--fg)":"var(--fg-3)",fontWeight:Q?600:400,boxShadow:Q?"var(--shadow-sm)":"none",cursor:o?"not-allowed":"pointer",userSelect:"none"},children:[l.jsx("input",{type:"radio",name:"tree-mode",value:I.value,checked:Q,onChange:()=>p(I.value),className:"sr-only"}),I.label]},I.value)})]}),h==="existing"?l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsx("label",{htmlFor:"onboarding-existing-tree-url",className:"text-label",style:{color:"var(--fg-3)"},children:"Tree GitHub URL"}),l.jsx("input",{id:"onboarding-existing-tree-url",type:"url",value:g,onChange:I=>w(I.target.value),placeholder:"https://github.com/your-org/your-tree",disabled:o,className:"text-body",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg)",outline:"none",fontFamily:"var(--font-mono)"}})]}):null,h==="new"?l.jsxs("p",{className:"text-label",style:{margin:0,color:"var(--fg-3)"},children:["Your agent will scaffold a new GitHub repo for the tree and bind"," ",x.length>1?"each selected source repo":"the source repo"," to it."]}):null]}):null]}),l.jsxs(di,{number:"03",state:L?"active":"idle",children:[l.jsx("h2",{className:"text-subtitle font-semibold",style:{margin:0,color:L?"var(--fg)":"var(--fg-4)",fontWeight:L?600:500},children:"Let your agent build it"}),L?l.jsxs(l.Fragment,{children:[l.jsxs("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:["It'll install the skill, set up the tree, and open a PR back to"," ",x.length>1?"each source repo":"your source repo","."]}),f?l.jsx(qb,{style:{marginTop:"var(--sp-3)"},children:f}):null,l.jsxs("div",{className:"flex",style:{marginTop:"var(--sp-3)",gap:"var(--sp-2)"},children:[l.jsx(xe,{type:"button",disabled:!ee,onClick:()=>void F(),children:o?"Starting…":"Continue"}),l.jsx(xe,{type:"button",variant:"outline",onClick:R,disabled:o,children:"I'll do it later"})]})]}):null]})]})]})}async function $b(){const e=LM(),t=await $v(),n=t.filter(s=>s.type!=="human"),a=(e?t.find(s=>s.uuid===e):void 0)??n.slice().sort((s,o)=>o.uuid.localeCompare(s.uuid))[0]??t[0];if(!a)throw new Error("No agent available to chat with — finish Step 2 first.");return a}function Hb(e){return{title:"Setup hidden",description:"Your agent isn't bound to a source repo yet. Resume from Settings → Onboarding any time to finish.",action:{label:"Resume setup",onClick:()=>e("/settings/onboarding")}}}function lv({label:e,value:t}){return l.jsxs("div",{className:"flex flex-col",style:{gap:"var(--sp-1)"},children:[l.jsx("span",{className:"text-label",style:{color:"var(--fg-3)"},children:e}),l.jsx("span",{className:"mono text-body truncate",style:{padding:"var(--sp-2) var(--sp-3)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-input)",color:"var(--fg-2)",minWidth:0},title:t,children:t})]})}function qb({children:e,style:t}){return l.jsx("div",{className:"text-body",style:{padding:"var(--sp-2_5) var(--sp-3)",background:"color-mix(in oklch, var(--state-error) 12%, transparent)",border:"var(--hairline) solid color-mix(in oklch, var(--state-error) 28%, transparent)",borderRadius:"var(--radius-input)",color:"var(--state-error)",...t},children:e})}function tA({disabled:e,repos:t,error:n,selectedRepoUrls:a,onToggle:s}){const o=l.jsx("h2",{className:"text-subtitle font-semibold",style:{color:e?"var(--fg-4)":"var(--fg)",fontWeight:e?500:600},children:"Pick source repos"});return e?l.jsx("div",{children:o}):n?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsxs("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:[n,". Reconnect your GitHub account to grant repo access."]}),l.jsx("div",{style:{marginTop:"var(--sp-2)"},children:l.jsx(xe,{type:"button",variant:"outline",size:"sm",asChild:!0,children:l.jsx("a",{href:"/api/v1/auth/github/start?next=/",children:"Reconnect GitHub"})})})]}):t===null?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"Loading your GitHub repositories…"})]}):t.length===0?l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-label",style:{color:"var(--fg-3)",marginTop:"var(--sp-2)"},children:"No repositories found on your GitHub account. Create one and refresh this page."})]}):l.jsxs("div",{style:{animation:"subtle-fade 200ms ease-out"},children:[o,l.jsx("p",{className:"text-body",style:{color:"var(--fg-3)",marginTop:"var(--sp-1)"},children:"The code your tree will organize knowledge about. Pick one or more."}),l.jsx(yX,{repos:t,selectedRepoUrls:a,onToggle:s})]})}function yX({repos:e,selectedRepoUrls:t,onToggle:n}){const[a,s]=b.useState(!1),o=b.useRef(null);b.useEffect(()=>{if(!a)return;const p=w=>{o.current&&!o.current.contains(w.target)&&s(!1)},g=w=>{w.key==="Escape"&&s(!1)};return window.addEventListener("mousedown",p),window.addEventListener("keydown",g),()=>{window.removeEventListener("mousedown",p),window.removeEventListener("keydown",g)}},[a]);const u=b.useMemo(()=>{const p=new Map;for(const g of e){const w=g.fullName.split("/")[0]??"",x=p.get(w);x?x.push(g):p.set(w,[g])}return[...p.entries()].sort(([g],[w])=>g.localeCompare(w))},[e]),f=b.useMemo(()=>new Set(t),[t]),m=b.useMemo(()=>e.filter(p=>f.has(p.cloneUrl)),[e,f]),h=m.length===0?"Select repositories…":"Add another repository";return l.jsxs("div",{ref:o,className:"relative",style:{marginTop:"var(--sp-2)"},children:[m.length>0&&l.jsx("div",{style:{marginBottom:"var(--sp-2)",display:"flex",flexWrap:"wrap",gap:"var(--sp-1_5)"},children:m.map(p=>l.jsx(vX,{fullName:p.fullName,onRemove:()=>n(p.cloneUrl)},p.cloneUrl))}),l.jsxs("button",{type:"button","aria-haspopup":"listbox","aria-expanded":a,onClick:()=>s(p=>!p),className:"text-body",style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"var(--sp-2)",padding:"var(--sp-2) var(--sp-3)",background:"var(--bg)",border:"var(--hairline) solid var(--border)",borderRadius:"var(--radius-input)",color:"var(--fg-3)",outline:"none",cursor:"pointer",textAlign:"left"},children:[l.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:h}),l.jsx(Tv,{className:"h-4 w-4",style:{color:"var(--fg-3)",transition:"transform 120ms ease",transform:a?"rotate(180deg)":"none",flexShrink:0}})]}),a&&l.jsx("div",{role:"listbox","aria-label":"GitHub repositories","aria-multiselectable":"true",className:"absolute z-30 rounded-md border bg-popover shadow-md",style:{top:"calc(100% + var(--sp-1))",left:0,right:0,maxHeight:"min(56vh, 30rem)",overflowY:"auto",padding:"var(--sp-1) 0"},children:u.map(([p,g],w)=>l.jsxs("div",{children:[l.jsx("div",{className:"text-eyebrow",style:{paddingTop:w>0?"var(--sp-3)":"var(--sp-1)",paddingBottom:"var(--sp-1)",paddingLeft:"calc(var(--sp-3) + var(--sp-3_5) + var(--sp-2))",paddingRight:"var(--sp-3)",color:"var(--fg-2)"},children:p}),g.map(x=>{const k=f.has(x.cloneUrl),C=x.fullName.slice(p.length+1);return l.jsxs("button",{type:"button",role:"option","aria-selected":k,onClick:()=>n(x.cloneUrl),className:"text-body transition-colors w-full",style:{display:"flex",alignItems:"center",gap:"var(--sp-2)",padding:"var(--sp-1) var(--sp-3)",background:k?"var(--accent-bg)":"transparent",color:k?"var(--accent)":"var(--fg)",border:"none",cursor:"pointer",textAlign:"left"},onMouseEnter:j=>{k||(j.currentTarget.style.background="var(--surface-1)")},onMouseLeave:j=>{k||(j.currentTarget.style.background="transparent")},children:[l.jsx("span",{"aria-hidden":"true",style:{width:"var(--sp-3_5)",height:"var(--sp-3_5)",display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:k?"var(--hairline) solid var(--accent)":"var(--hairline) solid var(--border)",borderRadius:"var(--radius-chip)",background:k?"var(--accent)":"transparent",color:"var(--bg)",transition:"background 120ms ease, border-color 120ms ease"},children:k?l.jsx(mr,{className:"h-3 w-3",strokeWidth:3}):null}),l.jsx("span",{className:"truncate",style:{minWidth:0,flex:1},children:C}),x.private&&l.jsx("span",{className:"mono uppercase text-caption",style:{padding:"var(--hairline) var(--sp-1_75)",borderRadius:"var(--radius-chip)",color:"var(--fg-4)",border:"var(--hairline) solid var(--border-faint)",background:"var(--bg-sunken)",flexShrink:0},children:"private"})]},x.cloneUrl)})]},p))})]})}function vX({fullName:e,onRemove:t}){return l.jsxs("span",{className:"text-label inline-flex items-center",style:{gap:"var(--sp-1)",paddingLeft:"var(--sp-2)",paddingRight:"var(--sp-0_5)",paddingTop:"var(--sp-0_5)",paddingBottom:"var(--sp-0_5)",background:"var(--surface-1)",border:"var(--hairline) solid var(--border-faint)",borderRadius:"var(--radius-chip)",color:"var(--fg-2)",maxWidth:"20rem"},children:[l.jsx("span",{className:"mono truncate",style:{minWidth:0},children:e}),l.jsx("button",{type:"button","aria-label":`Remove ${e}`,onClick:t,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:"var(--sp-4)",height:"var(--sp-4)",border:0,padding:0,background:"transparent",color:"var(--fg-3)",cursor:"pointer",borderRadius:"var(--radius-chip)",flexShrink:0,transition:"background 120ms ease, color 120ms ease"},onMouseEnter:n=>{n.currentTarget.style.background="var(--surface-2)",n.currentTarget.style.color="var(--fg)"},onMouseLeave:n=>{n.currentTarget.style.background="transparent",n.currentTarget.style.color="var(--fg-3)"},children:l.jsx(pi,{className:"h-3 w-3"})})]})}function bX(){const{onboardingStep:e,refreshMe:t,organizationId:n,memberId:a,role:s,user:o,teamDisplayName:u,orgHasOtherMembers:f}=ut(),[m,h]=Oo(),p=m.get("step"),[g,w]=b.useState(()=>LC()),x=b.useCallback(A=>{IM(A),w(A)},[]),k=s==="admin",C=(o==null?void 0:o.username)??null,j=qY(u,C),E=b.useMemo(()=>p==="team"&&k?"step1":p==="agent"?"step2":p==="tree"||e==="completed"?"step3-intro":e==="connect"&&!g&&k&&j?"step1":"step2",[p,e,g,k,j]),O=b.useCallback(()=>{x(!0);const A=new URLSearchParams(m);A.delete("step"),h(A,{replace:!0})},[x,m,h]);return l.jsx("div",{className:"flex-1 overflow-auto",style:{display:"flex",justifyContent:"center",padding:"clamp(var(--sp-16), 12vh, var(--sp-45)) var(--sp-4) var(--sp-12)"},children:l.jsx("div",{style:{width:"100%",maxWidth:720},children:E==="step1"?l.jsx(ZY,{organizationId:n,onContinue:O}):E==="step2"?l.jsx(YY,{organizationId:n,memberId:a,orgHasOtherMembers:f,refreshMe:t}):l.jsx(cX,{})})})}function xX({selectedChatId:e,onSelectChat:t}){const{onboardingStep:n,onboardingDismissedAt:a}=ut();return e===Ib?l.jsx(PK,{onCreated:t}):e?l.jsx($Y,{chatId:e}):n!==null&&!a?l.jsx(bX,{}):l.jsx(HY,{})}const wX={1:"Name your team",2:"Set up your agent",3:"Build your context-tree"};function SX(){const{onboardingStep:e,onboardingDismissedAt:t,dismissOnboarding:n}=ut(),{addToast:a}=Hu(),s=zn(),[o,u]=Oo(),f=o.get("c"),m=o.get("step"),h=LC(),g=UM()==="invite",w=b.useMemo(()=>m==="team"?1:m==="agent"?2:m==="tree"||f||e==="completed"?3:e==="create_agent"?2:e==="connect"&&!h&&!g?1:2,[m,f,e,h,g]);if(e===null||t)return null;const x=e==="completed",k=()=>{n(),a({title:"Setup hidden",description:"Resume any time in Settings → Onboarding.",action:{label:"Open settings",onClick:()=>s("/settings/onboarding")}})},C={1:Qg(1,w,e),2:Qg(2,w,e),3:Qg(3,w,e)},j=E=>{if(E!==3)return;const O=new URLSearchParams(o);O.delete("c"),O.set("step","tree"),u(O,{replace:!1})};return l.jsxs("nav",{"aria-label":"Onboarding progress",className:"flex items-center",style:{gap:"var(--sp-3)",padding:"var(--sp-3) var(--sp-4)",borderBottom:"var(--hairline) solid var(--border)",background:"var(--bg)"},children:[l.jsx("ol",{className:"flex items-center justify-center flex-1 min-w-0",style:{gap:0,listStyle:"none",margin:0,padding:0},children:[1,2,3].map((E,O)=>{const A=C[E],D=[1,2,3][O+1],z=D?Uj(A)&&Uj(C[D]):!1;return l.jsxs("li",{className:"flex items-center",style:{minWidth:0},children:[l.jsx(kX,{index:E,state:A,label:wX[E],onClick:E===3&&A==="active"?()=>j(E):void 0}),D?l.jsx(CX,{solid:z}):null]},E)})}),l.jsx("button",{type:"button",onClick:k,disabled:!x,title:x?"Hide setup steps":"Finish setting up your agent first","aria-label":"Hide setup steps",className:x?"cursor-pointer":"cursor-not-allowed",style:{flexShrink:0,width:24,height:24,display:"inline-flex",alignItems:"center",justifyContent:"center",background:"transparent",border:0,borderRadius:"var(--rd-1)",color:x?"var(--fg-2)":"var(--fg-4)",fontSize:14,lineHeight:1,opacity:x?1:.5},onMouseEnter:E=>{x&&(E.currentTarget.style.background="var(--surface-2)")},onMouseLeave:E=>{E.currentTarget.style.background="transparent"},children:"✕"})]})}function Qg(e,t,n){return e===t?"active":e===1||e===2&&n==="completed"?"completed":"pending"}function Uj(e){return e==="active"||e==="completed"}function kX({index:e,state:t,label:n,onClick:a}){const s=!!a,o=jX(t,e);return l.jsxs("button",{type:"button",onClick:s?a:void 0,disabled:!s,"aria-current":t==="active"?"step":void 0,className:`flex items-center ${s?"cursor-pointer":"cursor-default"}`,style:{gap:"var(--sp-2)",background:"transparent",border:0,padding:0,font:"inherit",color:t==="active"?"var(--fg)":t==="completed"?"var(--fg-2)":"var(--fg-3)",fontWeight:t==="active"?600:500},children:[o,l.jsxs("span",{className:"text-label whitespace-nowrap",style:{textDecoration:s?"none":void 0},children:["Step ",e," · ",n]})]})}function jX(e,t){return e==="completed"?l.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"var(--accent)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:12,lineHeight:1,flexShrink:0},children:"✓"}):e==="active"?l.jsxs("span",{"aria-hidden":"true",style:{position:"relative",width:22,height:22,flexShrink:0,display:"inline-block"},children:[l.jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:"var(--hairline) solid var(--accent)",animation:"ring-pulse 1.8s infinite",opacity:.5}}),l.jsx("span",{className:"mono",style:{position:"absolute",inset:0,borderRadius:"50%",background:"var(--accent)",border:"var(--hairline-bold) solid var(--accent)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:12,fontWeight:600,lineHeight:1},children:t})]}):e==="error"?l.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"var(--state-error)",display:"inline-flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:13,lineHeight:1,flexShrink:0},children:"⊗"}):l.jsx("span",{"aria-hidden":"true",style:{width:22,height:22,borderRadius:"50%",background:"transparent",border:"var(--hairline) solid var(--fg-3)",flexShrink:0,display:"inline-block"}})}function CX({solid:e}){return l.jsx("span",{"aria-hidden":"true",style:{flex:"0 1 var(--sp-15)",minWidth:24,height:0,margin:"0 var(--sp-2)",borderTop:e?"var(--hairline-bold) solid var(--accent)":"var(--hairline) dashed var(--fg-3)"}})}const EX=sb.catch("active"),NX=tb.catch("manual");function _X(){const[e,t]=Oo(),n=e.get("c"),a=e.get("a"),s=EX.parse(e.get("engagement")),o=NX.parse(e.get("source"));cb(),b.useEffect(()=>{if(a&&n){const p=new URLSearchParams(e);p.delete("a"),p.set("c",n),t(p,{replace:!0});return}if(a&&!n){const p=new URLSearchParams(e);p.delete("a"),p.delete("c"),t(p,{replace:!0})}},[a,e,n,t]);const u=b.useCallback(p=>{const g=new URLSearchParams(e);g.set("c",p),lh(g),t(g)},[e,t]),f=b.useCallback(()=>{const p=new URLSearchParams(e);p.set("c",Ib),lh(p),t(p)},[e,t]),m=b.useCallback(p=>{t(TX(e,p),{replace:!0})},[e,t]),h=b.useCallback(p=>{t(AX(e,p),{replace:!0})},[e,t]);return l.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[l.jsx(MK,{selectedChatId:n,onSelectChat:u,onNewChat:f,engagement:s,onEngagementChange:m,source:o,onSourceChange:h}),l.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden min-w-0",style:{background:"var(--bg)"},children:[l.jsx(SX,{}),l.jsx(xX,{selectedChatId:n,onSelectChat:u})]}),l.jsx(fK,{})]})}function lh(e){e.delete("docChat"),e.delete("docAgent"),e.delete("docPath"),e.delete("docBase")}function TX(e,t){const n=new URLSearchParams(e);return t==="active"?n.delete("engagement"):n.set("engagement",t),n.delete("c"),lh(n),n}function AX(e,t){const n=new URLSearchParams(e);return t==="manual"?n.delete("source"):n.set("source",t),n.delete("c"),lh(n),n}const RX=new GR({defaultOptions:{queries:{retry:!1,refetchOnWindowFocus:!1}}});function OX(){return l.jsx(VR,{client:RX,children:l.jsx(QM,{children:l.jsx(p5,{children:l.jsx(SM,{children:l.jsxs(XO,{children:[l.jsx($t,{path:"/login",element:l.jsx(MV,{})}),l.jsx($t,{path:"/signup",element:l.jsx(tr,{to:"/login",replace:!0})}),l.jsx($t,{path:"/auth/github/complete",element:l.jsx(DV,{})}),l.jsx($t,{path:"/invite/:token",element:l.jsx(TV,{})}),null,null,l.jsx($t,{element:l.jsx(JM,{}),children:l.jsxs($t,{element:l.jsx(p9,{children:l.jsx(h5,{})}),children:[l.jsx($t,{index:!0,element:l.jsx(_X,{})}),l.jsx($t,{path:"context",element:l.jsx(cV,{})}),l.jsx($t,{path:"agents/:uuid",element:l.jsx(JG,{})}),l.jsx($t,{path:"team",element:l.jsx($Q,{})}),l.jsxs($t,{path:"settings",element:l.jsx(xQ,{}),children:[l.jsx($t,{index:!0,element:l.jsx(tr,{to:"computers",replace:!0})}),l.jsx($t,{path:"team",element:l.jsx(aK,{})}),l.jsx($t,{path:"computers",element:l.jsx(QV,{})}),l.jsx($t,{path:"github",element:l.jsx(tQ,{})}),l.jsx($t,{path:"integrations",element:l.jsx(yQ,{})}),l.jsx($t,{path:"onboarding",element:l.jsx(vQ,{})}),l.jsx($t,{path:"setup",element:l.jsx(tr,{to:"/settings/onboarding",replace:!0})})]}),l.jsx($t,{path:"agents",element:l.jsx(tr,{to:"/team",replace:!0})}),l.jsx($t,{path:"clients",element:l.jsx(tr,{to:"/settings/computers",replace:!0})}),l.jsx($t,{path:"integrations",element:l.jsx(tr,{to:"/settings/integrations",replace:!0})}),l.jsx($t,{path:"team/members",element:l.jsx(tr,{to:"/team",replace:!0})}),l.jsx($t,{path:"team/agents",element:l.jsx(tr,{to:"/team",replace:!0})}),l.jsx($t,{path:"team/invite",element:l.jsx(tr,{to:"/team",replace:!0})}),l.jsx($t,{path:"team/settings",element:l.jsx(tr,{to:"/settings/team",replace:!0})}),l.jsx($t,{path:"admin",element:l.jsx(MX,{})})]})})]})})})})})}function MX(){const e=Rr();return e.hash==="#bindings"?l.jsx(tr,{to:`/settings/integrations${e.search}`,replace:!0}):l.jsx(tr,{to:`/team${e.hash}`,replace:!0})}const nA=document.getElementById("root");if(!nA)throw new Error("Root element not found");xR.createRoot(nA).render(l.jsx(b.StrictMode,{children:l.jsx(OX,{})}));export{FC as A,Fu as F,zu as L,KC as U,ot as c,l as j,b as r};
|